diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 0000000..a396537 --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,6 @@ +name: ci-build +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + uses: looker-open-source/reusable-actions/.github/workflows/marketplace-viz-ci-build.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6b5b8f0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: release + +on: + workflow_dispatch: + push: + branches: + - master + +# Cancels an release workflows in progress +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + release: + permissions: + contents: write + pull-requests: write + uses: looker-open-source/reusable-actions/.github/workflows/marketplace-viz-release.yml@main + secrets: inherit diff --git a/dist/bundle.js b/dist/bundle.js new file mode 100644 index 0000000..0c7c8d4 --- /dev/null +++ b/dist/bundle.js @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.collapsible_tree=n():t.collapsible_tree=n()}(window,(function(){return e={},t.m=n={33:function(t,n,e){"use strict";e.r(n);var r=function(t,n){return t>>1;t(n[o],e)<0?r=1+o:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;0>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?gt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?gt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=it.exec(t))?new yt(n[1],n[2],n[3],1):(n=ot.exec(t))?new yt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=ut.exec(t))?gt(n[1],n[2],n[3],n[4]):(n=at.exec(t))?gt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=st.exec(t))?xt(n[1],n[2]/100,n[3]/100,1):(n=ct.exec(t))?xt(n[1],n[2]/100,n[3]/100,n[4]):lt.hasOwnProperty(t)?dt(lt[t]):"transparent"===t?new yt(NaN,NaN,NaN,0):null}function dt(t){return new yt(t>>16&255,t>>8&255,255&t,1)}function gt(t,n,e,r){return r<=0&&(t=n=e=NaN),new yt(t,n,e,r)}function vt(t,n,e,r){return 1===arguments.length?((i=t)instanceof K||(i=pt(i)),i?new yt((i=i.rgb()).r,i.g,i.b,i.opacity):new yt):new yt(t,n,e,null==r?1:r);var i}function yt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function _t(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)}function mt(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function wt(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||1<=e?t=n=NaN:n<=0&&(t=NaN),new Mt(t,n,e,r)}function bt(t){if(t instanceof Mt)return new Mt(t.h,t.s,t.l,t.opacity);if(t instanceof K||(t=pt(t)),!t)return new Mt;if(t instanceof Mt)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(ea&&(i=n.slice(a,i),c[s]?c[s]+=i:c[++s]=i),(e=e[0])===(r=r[0])?c[s]?c[s]+=r:c[++s]=r:(c[++s]=null,l.push({i:s,x:St(e,r)})),a=Et.lastIndex;return ae._time&&(r=e._time),(t=e)._next):(n=e._next,e._next=null,t?t._next=n:zt=n);Ft=t,Qt(r)}(),jt=0}}function Wt(){var t=Xt.now(),n=t-Lt;1e3nn)throw new Error("too late; already scheduled");return e}function on(t,n){var e=un(t,n);if(e.state>en)throw new Error("too late; already running");return e}function un(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function an(t,n,e,r,i,o){var u,a,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,s/=a),t*rzn&&i?(a=v*v+y*y,s=(o=e-d)*o+(u=r-g)*u,c=Math.sqrt(a),l=Math.sqrt(w),f=(h=i*Math.tan((En-Math.acos((a+w-s)/(2*c*l)))/2))/l,p=h/c,Math.abs(f-1)>zn&&(this._+="L"+(t+f*_)+","+(n+f*m)),this._+="A"+i+","+i+",0,0,"+ +(_*uzn||Math.abs(this._y1-c)>zn)&&(this._+="L"+s+","+c),e&&(h<0&&(h=h%Yn+Yn),Fn=(o=(g+y)/2))?g=o:y=o,(l=e>=(u=(v+_)/2))?v=u:_=u,!(p=(i=p)[h=l<<1|c]))return i[h]=d,t;if(a=+t._x.call(null,p.data),s=+t._y.call(null,p.data),n===a&&e===s)return d.next=p,i?i[h]=d:t._root=d,t;for(;i=i?i[h]=new Array(4):t._root=new Array(4),(c=n>=(o=(g+y)/2))?g=o:y=o,(l=e>=(u=(v+_)/2))?v=u:_=u,(h=l<<1|c)==(f=(u<=s)<<1|o<=a););return i[f]=p,i[h]=d,t}function Bn(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function In(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Vn(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}jn.prototype={constructor:jn,has:On.has,add:function(t){return this[qn+(t+="")]=t,this},remove:On.remove,clear:On.clear,values:On.keys,size:On.size,empty:On.empty,each:On.each},Array.prototype.slice;var $n=In.prototype;function Rn(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[1_||(i=a.y0)>m||(o=a.x1)=(a=(d+v)/2))?d=a:v=a,(l=u>=(s=(g+y)/2))?g=s:y=s,!(p=(n=p)[h=l<<1|c]))return this;if(!p.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,f=h)}for(;p.data!==t;)if(!(p=(r=p).next))return this;return(i=p.next)&&delete p.next,r?i?r.next=i:delete r.next:n?(i?n[h]=i:delete n[h],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[f]=p:this._root=p)):this._root=i,this},$n.removeAll=function(t){for(var n=0,e=t.length;n=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wn(t){if(!(n=Zn.exec(t)))throw new Error("invalid format: "+t);var n;return new Qn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Qn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Jn(t,n){var e=Rn(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}function Gn(t){return t}Wn.prototype=Qn.prototype,Qn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Kn,te,ne={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Jn(100*t,n)},r:Jn,s:function(t,n){var e=Rn(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Kn=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:un));)a=e[u=(u+1)%e.length];return o.reverse().join(r)}),o=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Gn:(n=ee.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,(function(t){return n[+t]}))}),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Wn(t)).fill,e=t.align,r=t.sign,f=t.symbol,p=t.zero,d=t.width,g=t.comma,v=t.precision,y=t.trim,_=t.type;"n"===_?(g=!0,_="g"):ne[_]||(void 0===v&&(v=12),y=!0,_="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var m="$"===f?o:"#"===f&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",w="$"===f?u:/[%p]/.test(_)?c:"",x=ne[_],b=/[defgprs%]/.test(_);function M(t){var o,u,c,f=m,M=w;if("c"===_)M=x(t)+M,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),v),y&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r>1)+f+t+M+C.slice(A);break;default:t=C+f+t+M}return s(t)}return v=void 0===v?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),M.toString=function(){return t+""},M}return{format:f,formatPrefix:function(t,n){var e=f(((t=Wn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(function(t){return(t=Rn(Math.abs(t)))?t[1]:NaN}(n)/3))),i=Math.pow(10,-r),o=re[8+r/3];return function(t){return e(i*t)+o}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"})).format,te.formatPrefix,ce.prototype=oe.prototype={constructor:ce,count:function(){return this.eachAfter(ie)},each:function(t){var n,e,r,i,o=this,u=[o];do{for(n=u.reverse(),u=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;rc?" ...":"")));return"".concat(t.data.name,"").concat(l)})).on("click",(function(t){LookerCharts.Utils.openDrillMenu({links:g.get(t.data.name),event:event})}));var h=l.merge(c);h.transition().duration(s).attr("transform",(function(t){return"translate("+t.y+","+t.x+")"})),h.select("circle.node").attr("r",a).style("fill",(function(t){return t._children?o.children:o.empty})).style("stroke",o.children).style("stroke-width",1.5).attr("cursor","pointer");var f=c.exit().transition().duration(s).attr("transform",(function(n){return"translate("+t.y+","+t.x+")"})).remove();f.select("circle").attr("r",1e-6),f.select("text").style("fill-opacity",1e-6);var p=y.selectAll("path.link").data(r,(function(t){return t.id}));p.enter().insert("path","g").attr("class","link").style("fill","none").style("stroke","#ddd").style("stroke-width",1.5).attr("d",(function(n){var e={x:t.x0,y:t.y0};return w(e,e)})).merge(p).transition().duration(s).attr("d",(function(t){return w(t,t.parent)})),p.exit().transition().duration(s).attr("d",(function(n){var e={x:t.x,y:t.y};return w(e,e)})).remove(),e.forEach((function(t){t.x0=t.x,t.y0=t.y}))}(function(t,n,e){function r(n,e,r,i,o){return!(!t.addError||!t.clearErrors||(rc.x&&(c=t),t.depth>l.depth&&(l=t)})),h=s===c?1:t(s,c)/2,f=h-s.x,p=n/(c.x+h+f),d=e/(l.depth||1),i.eachBefore((function(t){t.x=(t.x+f)*p,t.y=t.depth*d}))),i}function o(n){var e,r=n.children,i=n.parent.children,o=n.i?i[n.i-1]:null;r?(function(t){for(var n,e=0,r=0,i=t.children,o=i.length;0<=--o;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n),e=(r[0].z+r[r.length-1].z)/2,o?(n.z=o.z+t(n._,o._),n.m=n.z-e):n.z=e):o&&(n.z=o.z+t(n._,o._)),n.parent.A=function(n,e,r){if(e){for(var i,o=n,u=n,a=e,s=o.parent.children[0],c=o.m,l=u.m,h=a.m,f=s.m;a=fe(a),o=he(o),a&&o;)s=he(s),(u=fe(u)).a=n,0<(i=a.z+h-o.z-c+t(a._,o._))&&(function(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}(function(t,n,e){return t.a.parent===n.parent?t.a:e}(a,n,r),n,i),c+=i,l+=i),h+=a.m,c+=o.m,f+=s.m,l+=u.m;a&&!fe(u)&&(u.t=a,u.m+=h-l),o&&!he(s)&&(s.t=o,s.m+=c-f,r=n)}return r}(n,o,n.parent.A||i[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function a(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}().size([d,p]),(m=oe(v,(function(t){return t.children}))).x0=d/2,m.y0=0,m.children.forEach((function t(n){n.children&&(n._children=n.children,n._children.forEach(t),n.children=null)})),b(m))}};looker.plugins.visualizations.add(si)}},t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var i in n)t.d(r,i,function(t){return n[t]}.bind(null,i));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},t.p="",t(t.s=33);function t(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n,e})); \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 5e5c9e9..5941a77 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,4 @@ -var path = require('path') +var path = require('path'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); @@ -8,29 +8,27 @@ var webpackConfig = { collapsible_tree: './src/collapsible_tree/collapsible_tree.ts', }, output: { - filename: "[name].js", - path: path.join(__dirname), - library: "[name]", - libraryTarget: "umd" + filename: 'collapsible_tree.js', + path: path.join(path.resolve(__dirname), '/dist'), + library: '[name]', + libraryTarget: 'umd', }, resolve: { - extensions: [".ts", ".js"] + extensions: ['.ts', '.js'], }, - plugins: [ - new UglifyJSPlugin() - ], + plugins: [new UglifyJSPlugin()], module: { rules: [ - { test: /\.js$/, loader: "babel-loader" }, - { test: /\.ts$/, loader: "ts-loader" }, - { test: /\.css$/, loader: [ 'to-string-loader', 'css-loader' ] } - ] + {test: /\.js$/, loader: 'babel-loader'}, + {test: /\.ts$/, loader: 'ts-loader'}, + {test: /\.css$/, loader: ['to-string-loader', 'css-loader']}, + ], }, performance: { hints: false, maxEntrypointSize: 512000, - maxAssetSize: 512000 - } -} + maxAssetSize: 512000, + }, +}; -module.exports = webpackConfig \ No newline at end of file +module.exports = webpackConfig;