json-canvas-viewer 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -156
- package/dist/bridges.cjs +1 -1
- package/dist/bridges.cjs.map +1 -1
- package/dist/bridges.js +1 -1
- package/dist/bridges.js.map +1 -1
- package/dist/chimp.cjs +1 -1
- package/dist/chimp.js +1 -1
- package/dist/controller-BRBUPg_j.js +2 -0
- package/dist/controller-BRBUPg_j.js.map +1 -0
- package/dist/controller-Bc-S4ZVK.cjs +2 -0
- package/dist/controller-Bc-S4ZVK.cjs.map +1 -0
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +1 -1
- package/dist/index-DJQyGIFX.js +2 -0
- package/dist/index-DJQyGIFX.js.map +1 -0
- package/dist/index-DwvIUSbr.cjs +2 -0
- package/dist/index-DwvIUSbr.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/modules.cjs +1 -1
- package/dist/modules.cjs.map +1 -1
- package/dist/modules.js +1 -1
- package/dist/modules.js.map +1 -1
- package/dist/react.cjs +2 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -0
- package/dist/renderToString-ChykAKof.js +2 -0
- package/dist/renderToString-ChykAKof.js.map +1 -0
- package/dist/renderToString-Cxh5DtRo.cjs +2 -0
- package/dist/renderToString-Cxh5DtRo.cjs.map +1 -0
- package/dist/renderer-0RqgAOLH.js +2 -0
- package/dist/renderer-0RqgAOLH.js.map +1 -0
- package/dist/renderer-BEKV7hr3.cjs +2 -0
- package/dist/renderer-BEKV7hr3.cjs.map +1 -0
- package/dist/types/bridges/reactComponent.d.ts +6 -3
- package/dist/types/bridges/vueComponent.vue.d.ts +7 -2
- package/dist/types/bridges/webpackPlugin.d.ts +7 -0
- package/dist/types/bridges.d.ts +1 -2
- package/dist/types/core/baseModule.d.ts +13 -9
- package/dist/types/core/controller.d.ts +6 -1
- package/dist/types/core/dataManager.d.ts +23 -16
- package/dist/types/core/declarations.d.ts +20 -4
- package/dist/types/core/index.d.ts +16 -5
- package/dist/types/core/interactionHandler.d.ts +3 -1
- package/dist/types/core/overlayManager.d.ts +7 -1
- package/dist/types/core/renderer.d.ts +9 -2
- package/dist/types/core/styleManager.d.ts +48 -0
- package/dist/types/core/utilities.d.ts +3 -6
- package/dist/types/dev.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/modules/controls/index.d.ts +4 -1
- package/dist/types/modules/minimap/index.d.ts +5 -1
- package/dist/types/modules/mistouchPreventer/index.d.ts +7 -5
- package/dist/vue.cjs +2 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.js +2 -0
- package/dist/vue.js.map +1 -0
- package/dist/webpackLoader.js +33 -0
- package/package.json +56 -41
- package/dist/controller-CnUlrkdp.cjs +0 -2
- package/dist/controller-CnUlrkdp.cjs.map +0 -1
- package/dist/controller-UN-hOZ_r.js +0 -2
- package/dist/controller-UN-hOZ_r.js.map +0 -1
- package/dist/index-RXeXyAu0.cjs +0 -2
- package/dist/index-RXeXyAu0.cjs.map +0 -1
- package/dist/index-ujiv9m9Y.js +0 -2
- package/dist/index-ujiv9m9Y.js.map +0 -1
- package/dist/renderer-Bzv3aLXp.cjs +0 -2
- package/dist/renderer-Bzv3aLXp.cjs.map +0 -1
- package/dist/renderer-NPxavnke.js +0 -2
- package/dist/renderer-NPxavnke.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{toHslString as t,rgbToHsl as e,parseHex as o}from"@ahmedsemih/color-fns";class s{constructor(t,e,o,s,a,r){this.container=t,this.options=e,this.onStart=o.subscribe,this.onDispose=s.subscribe,this.onRestart=a.subscribe,this.augment=r}onStart;onRestart;onDispose;augment;options}const a={round:function(t,e){const o=10**e;return Math.round(t*o)/o},resizeCanvasForDPR:function(t,e,o){const s=window.devicePixelRatio||1,a=t.getContext("2d");if(!a)throw new Error("[JSONCanvasViewer] This error is unexpected, probably caused uncontrollable runtime errors. Please contact the developer and show how to reproduce.");t.width=Math.round(e*s),t.height=Math.round(o*s),a.setTransform(1,0,0,1,0,0),a.scale(s,s)},applyStyles:function(t,e){const o=document.createElement("style");o.innerHTML=e,t.appendChild(o)},drawRoundRect:function(t,e,o,s,a,r){t.beginPath(),t.moveTo(e+r,o),t.lineTo(e+s-r,o),t.quadraticCurveTo(e+s,o,e+s,o+r),t.lineTo(e+s,o+a-r),t.quadraticCurveTo(e+s,o+a,e+s-r,o+a),t.lineTo(e+r,o+a),t.quadraticCurveTo(e,o+a,e,o+a-r),t.lineTo(e,o+r),t.quadraticCurveTo(e,o,e+r,o),t.closePath()},getAnchorCoord:function(t,e){const o=t.x+t.width/2,s=t.y+t.height/2;switch(e){case"top":return{x:o,y:t.y};case"bottom":return{x:o,y:t.y+t.height};case"left":return{x:t.x,y:s};case"right":return{x:t.x+t.width,y:s};default:return{x:o,y:s}}},makeHook:function(t=!1){const e=(...o)=>{if(t){Array.from(e.subs).reverse().forEach(t=>{t(...o)})}else e.subs.forEach(t=>{t(...o)})};return e.subs=/* @__PURE__ */new Set,e.subscribe=t=>{e.subs.add(t)},e.unsubscribe=t=>{e.subs.delete(t)},e}},r=new Error("[JSONCanvasViewer] Resource hasn't been set up or has been disposed.");class i extends s{onToggleFullscreen=a.makeHook();data={canvasData:{nodes:[],edges:[]},nodeMap:{},edgeMap:{},canvasBaseDir:"./",nodeBounds:{maxX:0,maxY:0,minX:0,minY:0,width:0,height:0,centerX:0,centerY:0},offsetX:0,offsetY:0,scale:1,container:document.createElement("div")};constructor(...t){super(...t);const e=this.options.container;for(;e.firstElementChild;)e.firstElementChild.remove();e.innerHTML="";const o=this.options.noShadow||!1?e:e.attachShadow({mode:"open"});a.applyStyles(o,".full,.overlay-container .click-layer,.overlay-container .link-iframe,.overlay-container .audio{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.overlay-container.markdown-content{display:flex;justify-content:center;align-items:center}.border-shadow-bg{background:var(--background-secondary);border:1px solid var(--border);box-shadow:var(--shadow)}.collapse-button{border-radius:8px;transition:transform .2s,background-color .2s}.collapse-button:hover{background-color:var(--border)}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;width:32px;padding:5px 0}button svg{width:100%;height:100%}.container{--contentTransition: color .2s, opacity .2s, text-shadow .2s, fill .2s;--containerTransition: background .2s, opacity .2s, box-shadow .2s, border .2s, filter .2s, backdrop-filter .2s;color:var(--text);fill:var(--text);stroke:var(--text);background-color:var(--background);position:relative;width:100%;height:100%;overflow:hidden}.container.numb,.container.numb *{pointer-events:none!important}.main-canvas{width:100%;height:100%;transform-origin:top left}.overlays{position:absolute;transform-origin:top left;will-change:transform}.overlay-container{position:absolute;box-sizing:border-box;border-radius:12px;overflow:hidden;-webkit-user-select:none;user-select:none;contain:strict;content-visibility:auto;box-shadow:var(--shadow);background-color:var(--overlay-card);transition:var(--containerTransition)}.overlay-container .overlay-border{box-sizing:border-box;pointer-events:none;position:absolute;color:var(--overlay-border);top:0;left:0;width:100%;height:100%;border-width:1px;border-style:solid;border-radius:12px;transition:var(--containerTransition)}.overlay-container.active{-webkit-user-select:auto;user-select:auto;pointer-events:auto}.overlay-container.active .overlay-border{border:4px solid var(--overlay-active)}.overlay-container .link-iframe,.overlay-container .audio{border:none;background:transparent}.overlay-container .click-layer{background:transparent;pointer-events:auto}.overlay-container.active .click-layer{pointer-events:none}.overlay-container img{width:100%;height:100%;object-fit:cover;pointer-events:none}.overlay-container.active img{pointer-events:auto}.overlay-container.markdown-content{position:absolute;padding:0 7px}.overlay-container.markdown-content.rtl{direction:rtl;text-align:right}.overlay-container .parsed-content-wrapper{font-family:sans-serif;box-sizing:border-box;max-width:100%;max-height:100%;padding:10px 6px;pointer-events:none;overflow:hidden;scrollbar-gutter:stable both-edges;display:flex;flex-direction:column;gap:12px}@supports not (scrollbar-gutter: stable both-edges){.overlay-container .parsed-content-wrapper{padding:10px}}.overlay-container.active .parsed-content-wrapper{overflow:auto}::-webkit-scrollbar{width:4px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:2px;background:#ffffff40}::-webkit-scrollbar-thumb:hover{background:#1e1e1ebf}p{font-size:16px;line-height:21px}.parsed-content-wrapper img{width:100%;border-radius:8px}h1{font-size:25px}h2{font-size:23px}h3{font-size:22px}h4{font-size:20px}h5{font-size:19px}h6{font-size:17px}p,h1,h2,h3,h4,h5,h6,ol,ul{margin:0}h1,h2{font-weight:800}h3,h4{font-weight:700}h5,h6{font-weight:600}code{background:#ffffff1a;padding:2px 4px;border-radius:8px}pre code{display:block;box-sizing:border-box;width:100%}pre:has(code),table{margin:6px 0}strong{color:#fe8e7c}em{color:#5affb2}a{text-decoration:none;color:#6dadd0;font-weight:800;font-style:italic;cursor:pointer;transition:var(--contentTransition)}a:hover{color:#86d3fd}hr{height:1px;width:100%;background-color:#fff3;border:none}li{margin:5px 0}ul{padding-left:16px}ol{padding-left:15px;padding-right:7.5px}table{border-collapse:collapse;border-radius:8px;overflow:hidden;width:100%}table th,table td{border:1px solid rgba(255,255,255,.2);padding:6px 10px;background:#ffffff0f;text-align:left}table th{background:#ffffff1f;font-weight:700}"+this.options.extraCSS),this.data.container.classList.add("container"),o.appendChild(this.data.container),this.augment({zoom:this.zoom,zoomToScale:this.zoomToScale,pan:this.pan,panToCoords:this.panToCoords,resetView:this.resetView,shiftFullscreen:this.shiftFullscreen}),this.onStart(this.start),this.onRestart(this.start),this.onDispose(this.dispose)}start=()=>{const t=Object.assign({nodes:[],edges:[]},this.options.canvas);Object.assign(this.data,{canvasData:t,nodeMap:{},edgeMap:{},canvasBaseDir:this.processBaseDir(this.options.attachmentDir),nodeBounds:this.calculateNodeBounds(t),offsetX:0,offsetY:0,scale:1}),this.data.canvasData.nodes.forEach(t=>{const e={ref:t,box:this.getNodeBox(t)};if(this.data.nodeMap[t.id]=e,"file"===t.type){const o=t.file.split("/").pop()||"";e.fileName=o,t.file.startsWith("http://")||t.file.startsWith("https://")||(t.file=this.data.canvasBaseDir+o)}}),this.data.canvasData.edges.forEach(t=>{this.data.edgeMap[t.id]={ref:t,box:this.getEdgeBox(t)}}),this.resetView()};processBaseDir=t=>{if(!t)return"./";const e=t?.slice(-1);return"/"===e?t:`${t}/`};getNodeBox=t=>({left:t.x,top:t.y-40,right:t.width+t.x,bottom:t.y+t.height});getEdgeBox=t=>{const e=this.data.nodeMap,o=e[t.fromNode].ref,s=e[t.toNode].ref,r=a.getAnchorCoord(o,t.fromSide),i=a.getAnchorCoord(s,t.toSide),n=Math.min(r.x,i.x),h=Math.min(r.y,i.y),d=Math.max(r.x,i.x),c=Math.max(r.y,i.y),l=d-n,u=c-h,f=Math.min(l,u),p=0===f?1:f,g=Math.max(l,u),b=10*Math.log2(g/p);return{left:n-b,top:h-b,right:d+b,bottom:c+b}};calculateNodeBounds(t){let e=1/0,o=1/0,s=-1/0,a=-1/0;t.nodes.forEach(t=>{e=Math.min(e,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x+t.width),a=Math.max(a,t.y+t.height)});const r=s-e,i=a-o;return{minX:e,minY:o,maxX:s,maxY:a,width:r,height:i,centerX:e+r/2,centerY:o+i/2}}zoom=(t,e)=>{const o=this.data.scale*t;this.zoomToScale(o,e)};zoomToScale=(t,e)=>{const o=Math.max(Math.min(t,20),.05),s=this.data.scale;if(o===s)return;const a=this.C2C(e);this.data.offsetX=e.x-a.x*o/s,this.data.offsetY=e.y-a.y*o/s,this.data.scale=o};pan=({x:t,y:e})=>{this.data.offsetX=this.data.offsetX+t,this.data.offsetY=this.data.offsetY+e};panToCoords=({x:t,y:e})=>{this.data.offsetX=t,this.data.offsetY=e};shiftFullscreen=async t=>{document.fullscreenElement||t&&"enter"!==t?!document.fullscreenElement||t&&"exit"!==t||(await document.exitFullscreen(),this.onToggleFullscreen(!1)):(await this.data.container.requestFullscreen(),this.onToggleFullscreen(!0))};resetView=()=>{const t=this.data.nodeBounds,e=this.data.container;if(!t||!e)return;const o=t.width+200,s=t.height+200,a=e.clientWidth,r=e.clientHeight,i=a/o,n=r/s,h=Math.round(1e3*Math.min(i,n))/1e3,d={scale:h,offsetX:a/2-t.centerX*h,offsetY:r/2-t.centerY*h};this.data.offsetX=d.offsetX,this.data.offsetY=d.offsetY,this.data.scale=d.scale};C2C=({x:t,y:e})=>({x:t-this.data.offsetX,y:e-this.data.offsetY});middleViewer=()=>{const t=this.data.container;return{x:t.clientWidth/2,y:t.clientHeight/2,width:t.clientWidth,height:t.clientHeight}};dispose=()=>this.data.container.remove()}const n={light:{0:{hue:0,saturation:0,lightness:72},1:{hue:358,saturation:81,lightness:55},2:{hue:19,saturation:87,lightness:58},3:{hue:41,saturation:79,lightness:52},4:{hue:150,saturation:100,lightness:37},5:{hue:221,saturation:100,lightness:59},6:{hue:257,saturation:81,lightness:62}},dark:{0:{hue:0,saturation:0,lightness:40},1:{hue:358,saturation:100,lightness:65},2:{hue:23,saturation:86,lightness:63},3:{hue:39,saturation:91,lightness:70},4:{hue:153,saturation:80,lightness:45},5:{hue:217,saturation:100,lightness:62},6:{hue:259,saturation:100,lightness:75}}},h={light:{dots:"hsla(0, 0%, 72%, 0.4)",text:"rgb(30, 30, 30)",background:"rgb(250, 250, 250)","background-secondary":"rgb(255, 255, 255)",shadow:"0px 0px 8px rgb(0, 0, 0, 0.1)",border:"hsla(0, 0%, 82%, 0.7)"},dark:{dots:"hsla(0, 0%, 40%, 0.3)",text:"rgb(242, 242, 242)",background:"rgb(30, 30, 30)","background-secondary":"rgb(37, 37, 40)",shadow:"0px 0px 8px rgb(0, 0, 0, 0.2)",border:"hsla(0, 0%, 30%, 0.7)"}};class d extends s{theme="light";onChangeTheme=a.makeHook();colorCache={dark:{},light:{}};constructor(...t){super(...t),this.changeTheme(this.options.theme||"light"),this.augment({changeTheme:this.changeTheme})}hslProcessor=e=>{const{hue:o,saturation:s,lightness:a}=e;let r;return r="dark"===this.theme?{active:e,card:{hue:o,saturation:s/3,lightness:a/3},border:{...e,alpha:.7},background:{...e,alpha:.1},text:e.lightness>=70?"rgb(30, 30, 30)":"rgb(242, 242, 242)"}:{active:e,card:0===o?{hue:o,saturation:s,lightness:100}:{hue:o,saturation:.4*s,lightness:90},border:{...e,alpha:.7},background:{...e,alpha:.1},text:e.lightness>=70?"rgb(30, 30, 30)":"rgb(242, 242, 242)"},{active:t(r.active),card:t(r.card),border:t(r.border),background:t(r.background),text:r.text}};getColor=(t="0")=>{const s=this.theme;let a;return this.colorCache[s][t]?this.colorCache[s][t]:(a=t in n[s]?this.hslProcessor(n[s][t]):this.hslProcessor(e(o(t))),this.colorCache[s][t]=a,a)};getNamedColor=t=>h[this.theme][t];changeTheme=t=>{this.theme=t||("dark"===this.theme?"light":"dark");const e=this.container.get(i).data.container;Object.entries(h[this.theme]).forEach(([t,o])=>{e.style.setProperty(`--${t}`,o)}),this.onChangeTheme(this.theme)}}class c extends s{animationId=null;resizeAnimationId=null;DM;SM;resizeObserver;perFrame={lastScale:1,lastOffsets:{x:0,y:0}};lastResizeCenter={x:null,y:null};hooks={onResize:a.makeHook(),onRefresh:a.makeHook()};constructor(...t){super(...t),this.DM=this.container.get(i),this.SM=this.container.get(d),this.resizeObserver=new ResizeObserver(this.onResize),this.SM.onChangeTheme.subscribe(this.refresh),this.augment({refresh:this.refresh}),this.onStart(this.start),this.onRestart(this.refresh),this.onDispose(this.dispose)}start=()=>{this.resizeObserver.observe(this.DM.data.container),this.animationId=requestAnimationFrame(this.draw)};draw=()=>{this.perFrame.lastScale===this.DM.data.scale&&this.perFrame.lastOffsets.x===this.DM.data.offsetX&&this.perFrame.lastOffsets.y===this.DM.data.offsetY||this.refresh(),this.animationId=requestAnimationFrame(this.draw)};refresh=()=>{this.perFrame={lastScale:this.DM.data.scale,lastOffsets:{x:this.DM.data.offsetX,y:this.DM.data.offsetY}},this.hooks.onRefresh()};onResize=()=>{this.resizeAnimationId=requestAnimationFrame(()=>{const t=this.DM.middleViewer();this.lastResizeCenter.x&&this.lastResizeCenter.y&&(this.DM.data.offsetX=this.DM.data.offsetX+t.x-this.lastResizeCenter.x,this.DM.data.offsetY=this.DM.data.offsetY+t.y-this.lastResizeCenter.y),this.lastResizeCenter.x=t.x,this.lastResizeCenter.y=t.y,this.hooks.onResize(t.width,t.height),this.refresh()})};dispose=()=>{this.animationId&&cancelAnimationFrame(this.animationId),this.resizeAnimationId&&cancelAnimationFrame(this.resizeAnimationId),this.resizeObserver.disconnect()}}export{s as B,c as C,i as D,d as S,r as d,a as u};
|
|
2
|
+
//# sourceMappingURL=controller-BRBUPg_j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-BRBUPg_j.js","sources":["../src/core/baseModule.ts","../src/core/utilities.ts","../src/core/dataManager.ts","../src/core/styleManager.ts","../src/core/controller.ts"],"sourcesContent":["import type { DefaultOptions, Empty, GeneralObject, Indexable } from '$/declarations';\nimport type utilities from '$/utilities';\nimport type { Container } from '@needle-di/core';\n\ntype Hook = ReturnType<typeof utilities.makeHook>;\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type Augmentation = Record<Indexable, any>;\n\nexport type BaseArgs = [Container, GeneralObject, Hook, Hook, Hook, (aug: Augmentation) => void];\n\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type GeneralModuleCtor = typeof BaseModule<GeneralObject, any>;\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type GeneralModule = BaseModule<GeneralObject, any>;\n\nexport class BaseModule<O extends GeneralObject = Empty, A extends Augmentation = Empty> {\n\tonStart: Hook['subscribe'];\n\tonRestart: Hook['subscribe'];\n\tonDispose: Hook['subscribe'];\n\taugment: (aug: A) => void;\n\tconstructor(\n\t\tprotected container: Container,\n\t\toptions: GeneralObject,\n\t\tonStart: Hook,\n\t\tonDispose: Hook,\n\t\tonRestart: Hook,\n\t\taugment: (aug: A) => void,\n\t) {\n\t\tthis.options = options as DefaultOptions & O;\n\t\tthis.onStart = onStart.subscribe;\n\t\tthis.onDispose = onDispose.subscribe;\n\t\tthis.onRestart = onRestart.subscribe;\n\t\tthis.augment = augment;\n\t}\n\toptions: DefaultOptions & O;\n\tdeclare _providedMethods: A;\n}\n","import type { GeneralArguments } from '$/declarations';\n\nexport default {\n\tround,\n\tresizeCanvasForDPR,\n\tapplyStyles,\n\tdrawRoundRect,\n\tgetAnchorCoord,\n\tmakeHook,\n};\n\nexport const destroyError = new Error(\n\t\"[JSONCanvasViewer] Resource hasn't been set up or has been disposed.\",\n);\n\nfunction applyStyles(container: HTMLElement | ShadowRoot, styleString: string) {\n\tconst style = document.createElement('style');\n\tstyle.innerHTML = styleString;\n\tcontainer.appendChild(style);\n}\n\nfunction drawRoundRect(\n\tctx: CanvasRenderingContext2D,\n\tx: number,\n\ty: number,\n\twidth: number,\n\theight: number,\n\tradius: number,\n) {\n\tctx.beginPath();\n\tctx.moveTo(x + radius, y);\n\tctx.lineTo(x + width - radius, y);\n\tctx.quadraticCurveTo(x + width, y, x + width, y + radius);\n\tctx.lineTo(x + width, y + height - radius);\n\tctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n\tctx.lineTo(x + radius, y + height);\n\tctx.quadraticCurveTo(x, y + height, x, y + height - radius);\n\tctx.lineTo(x, y + radius);\n\tctx.quadraticCurveTo(x, y, x + radius, y);\n\tctx.closePath();\n}\n\nfunction getAnchorCoord(node: JSONCanvasNode, side: 'top' | 'bottom' | 'left' | 'right') {\n\tconst midX = node.x + node.width / 2;\n\tconst midY = node.y + node.height / 2;\n\tswitch (side) {\n\t\tcase 'top':\n\t\t\treturn { x: midX, y: node.y };\n\t\tcase 'bottom':\n\t\t\treturn { x: midX, y: node.y + node.height };\n\t\tcase 'left':\n\t\t\treturn { x: node.x, y: midY };\n\t\tcase 'right':\n\t\t\treturn { x: node.x + node.width, y: midY };\n\t\tdefault:\n\t\t\treturn { x: midX, y: midY };\n\t}\n}\n\nfunction resizeCanvasForDPR(canvas: HTMLCanvasElement, width: number, height: number) {\n\tconst dpr = window.devicePixelRatio || 1;\n\tconst ctx = canvas.getContext('2d');\n\tif (!ctx)\n\t\tthrow new Error(\n\t\t\t'[JSONCanvasViewer] This error is unexpected, probably caused uncontrollable runtime errors. Please contact the developer and show how to reproduce.',\n\t\t);\n\tcanvas.width = Math.round(width * dpr);\n\tcanvas.height = Math.round(height * dpr);\n\tctx.setTransform(1, 0, 0, 1, 0, 0);\n\tctx.scale(dpr, dpr);\n}\n\nfunction round(roundedNum: number, digits: number) {\n\tconst factor = 10 ** digits;\n\treturn Math.round(roundedNum * factor) / factor;\n}\n\nfunction makeHook<Args extends GeneralArguments = []>(reverse: boolean = false) {\n\ttype MatchingFunc = (...args: Args) => unknown;\n\ttype Hook = {\n\t\t(...args: Args): void;\n\t\tsubs: Set<MatchingFunc>;\n\t\tsubscribe(callback: MatchingFunc): void;\n\t\tunsubscribe(callback: MatchingFunc): void;\n\t};\n\tconst result: Hook = (...args: Args) => {\n\t\tif (reverse) {\n\t\t\tconst items = Array.from(result.subs).reverse();\n\t\t\titems.forEach((callback) => {\n\t\t\t\tcallback(...args);\n\t\t\t});\n\t\t} else\n\t\t\tresult.subs.forEach((callback) => {\n\t\t\t\tcallback(...args);\n\t\t\t});\n\t};\n\tresult.subs = new Set();\n\tresult.subscribe = (callback: MatchingFunc) => {\n\t\tresult.subs.add(callback);\n\t};\n\tresult.unsubscribe = (callback: MatchingFunc) => {\n\t\tresult.subs.delete(callback);\n\t};\n\treturn result;\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport type { Box, Coordinates, NodeBounds } from '$/declarations';\nimport style from '$/styles.scss?inline';\nimport utilities from '$/utilities';\n\nconst INITIAL_VIEWPORT_PADDING = 100;\nconst NODE_LABEL_MARGIN = 40;\nconst EDGE_BOX_HEURISTICS_BASE_MARGIN = 10;\n\ntype Options = {\n\tnoShadow?: boolean;\n\tcanvas?: JSONCanvas;\n\tattachmentDir?: string;\n\textraCSS?: string;\n};\n\ntype Augmentation = {\n\tzoom: DataManager['zoom'];\n\tzoomToScale: DataManager['zoomToScale'];\n\tpan: DataManager['pan'];\n\tpanToCoords: DataManager['panToCoords'];\n\tresetView: DataManager['resetView'];\n\tshiftFullscreen: DataManager['shiftFullscreen'];\n};\n\nexport interface NodeItem {\n\tref: JSONCanvasNode;\n\tbox: Box;\n\tfileName?: string;\n}\n\nexport interface EdgeItem {\n\tref: JSONCanvasEdge;\n\tbox: Box;\n\tcontrolPoints?: Array<number>;\n}\n\ntype NodeMap = Record<string, NodeItem>;\ntype EdgeMap = Record<string, EdgeItem>;\n\nexport default class DataManager extends BaseModule<Options, Augmentation> {\n\tonToggleFullscreen = utilities.makeHook<[boolean]>();\n\n\tdata: {\n\t\tcanvasData: Required<JSONCanvas>;\n\t\tnodeMap: NodeMap;\n\t\tedgeMap: EdgeMap;\n\t\tcanvasBaseDir: string;\n\t\tnodeBounds: NodeBounds;\n\t\toffsetX: number;\n\t\toffsetY: number;\n\t\tscale: number;\n\t\tcontainer: HTMLDivElement;\n\t} = {\n\t\tcanvasData: {\n\t\t\tnodes: [],\n\t\t\tedges: [],\n\t\t},\n\t\tnodeMap: {},\n\t\tedgeMap: {},\n\t\tcanvasBaseDir: './',\n\t\tnodeBounds: {\n\t\t\tmaxX: 0,\n\t\t\tmaxY: 0,\n\t\t\tminX: 0,\n\t\t\tminY: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tcenterX: 0,\n\t\t\tcenterY: 0,\n\t\t},\n\t\toffsetX: 0,\n\t\toffsetY: 0,\n\t\tscale: 1,\n\t\tcontainer: document.createElement('div'),\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tconst viewerContainer = this.options.container;\n\t\twhile (viewerContainer.firstElementChild) viewerContainer.firstElementChild.remove();\n\t\tviewerContainer.innerHTML = '';\n\n\t\tconst noShadow = this.options.noShadow || false;\n\t\tconst realContainer = noShadow\n\t\t\t? viewerContainer\n\t\t\t: viewerContainer.attachShadow({ mode: 'open' });\n\n\t\tutilities.applyStyles(realContainer, style + this.options.extraCSS);\n\n\t\tthis.data.container.classList.add('container');\n\t\trealContainer.appendChild(this.data.container);\n\n\t\tthis.augment({\n\t\t\tzoom: this.zoom,\n\t\t\tzoomToScale: this.zoomToScale,\n\t\t\tpan: this.pan,\n\t\t\tpanToCoords: this.panToCoords,\n\t\t\tresetView: this.resetView,\n\t\t\tshiftFullscreen: this.shiftFullscreen,\n\t\t});\n\t\tthis.onStart(this.start);\n\t\tthis.onRestart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate start = () => {\n\t\tconst canvasData = Object.assign(\n\t\t\t{\n\t\t\t\tnodes: [],\n\t\t\t\tedges: [],\n\t\t\t},\n\t\t\tthis.options.canvas,\n\t\t);\n\n\t\tObject.assign(this.data, {\n\t\t\tcanvasData: canvasData,\n\t\t\tnodeMap: {},\n\t\t\tedgeMap: {},\n\t\t\tcanvasBaseDir: this.processBaseDir(this.options.attachmentDir),\n\t\t\tnodeBounds: this.calculateNodeBounds(canvasData),\n\t\t\toffsetX: 0,\n\t\t\toffsetY: 0,\n\t\t\tscale: 1,\n\t\t});\n\n\t\tthis.data.canvasData.nodes.forEach((node) => {\n\t\t\tconst item: NodeItem = {\n\t\t\t\tref: node,\n\t\t\t\tbox: this.getNodeBox(node),\n\t\t\t};\n\t\t\tthis.data.nodeMap[node.id] = item;\n\t\t\tif (node.type === 'file') {\n\t\t\t\tconst path = node.file.split('/');\n\t\t\t\tconst fileName = path.pop() || '';\n\t\t\t\titem.fileName = fileName;\n\t\t\t\tif (!node.file.startsWith('http://') && !node.file.startsWith('https://'))\n\t\t\t\t\tnode.file = this.data.canvasBaseDir + fileName;\n\t\t\t}\n\t\t});\n\t\tthis.data.canvasData.edges.forEach((edge) => {\n\t\t\tthis.data.edgeMap[edge.id] = {\n\t\t\t\tref: edge,\n\t\t\t\tbox: this.getEdgeBox(edge),\n\t\t\t};\n\t\t});\n\t\tthis.resetView();\n\t};\n\n\tprivate processBaseDir = (baseDir: string | undefined) => {\n\t\tif (!baseDir) return './';\n\t\tconst lastChar = baseDir?.slice(-1);\n\t\tif (lastChar === '/') return baseDir;\n\t\treturn `${baseDir}/`;\n\t};\n\n\tprivate getNodeBox = (node: JSONCanvasNode) => {\n\t\treturn {\n\t\t\tleft: node.x,\n\t\t\ttop: node.y - NODE_LABEL_MARGIN,\n\t\t\tright: node.width + node.x,\n\t\t\tbottom: node.y + node.height,\n\t\t};\n\t};\n\n\tprivate getEdgeBox = (edge: JSONCanvasEdge) => {\n\t\tconst nodes = this.data.nodeMap;\n\t\tconst from = nodes[edge.fromNode].ref;\n\t\tconst to = nodes[edge.toNode].ref;\n\t\tconst fromAnchor = utilities.getAnchorCoord(from, edge.fromSide);\n\t\tconst toAnchor = utilities.getAnchorCoord(to, edge.toSide);\n\t\tconst strictBox = {\n\t\t\tleft: Math.min(fromAnchor.x, toAnchor.x),\n\t\t\ttop: Math.min(fromAnchor.y, toAnchor.y),\n\t\t\tright: Math.max(fromAnchor.x, toAnchor.x),\n\t\t\tbottom: Math.max(fromAnchor.y, toAnchor.y),\n\t\t};\n\t\t// edge size heuristics\n\t\tconst width = strictBox.right - strictBox.left;\n\t\tconst height = strictBox.bottom - strictBox.top;\n\t\tconst _min = Math.min(width, height);\n\t\tconst min = _min === 0 ? 1 : _min;\n\t\tconst max = Math.max(width, height);\n\t\tconst edgeFactor = Math.log2(max / min);\n\t\tconst margin = edgeFactor * EDGE_BOX_HEURISTICS_BASE_MARGIN;\n\t\treturn {\n\t\t\tleft: strictBox.left - margin,\n\t\t\ttop: strictBox.top - margin,\n\t\t\tright: strictBox.right + margin,\n\t\t\tbottom: strictBox.bottom + margin,\n\t\t};\n\t};\n\n\tprivate calculateNodeBounds(canvasData: Required<JSONCanvas>) {\n\t\tlet minX = Infinity,\n\t\t\tminY = Infinity,\n\t\t\tmaxX = -Infinity,\n\t\t\tmaxY = -Infinity;\n\t\tcanvasData.nodes.forEach((node) => {\n\t\t\tminX = Math.min(minX, node.x);\n\t\t\tminY = Math.min(minY, node.y);\n\t\t\tmaxX = Math.max(maxX, node.x + node.width);\n\t\t\tmaxY = Math.max(maxY, node.y + node.height);\n\t\t});\n\t\tconst width = maxX - minX;\n\t\tconst height = maxY - minY;\n\t\tconst centerX = minX + width / 2;\n\t\tconst centerY = minY + height / 2;\n\t\treturn { minX, minY, maxX, maxY, width, height, centerX, centerY };\n\t}\n\n\tzoom = (factor: number, origin: Coordinates) => {\n\t\tconst newScale = this.data.scale * factor;\n\t\tthis.zoomToScale(newScale, origin);\n\t};\n\tzoomToScale = (newScale: number, origin: Coordinates) => {\n\t\tconst validNewScale = Math.max(Math.min(newScale, 20), 0.05);\n\t\tconst scale = this.data.scale;\n\t\tif (validNewScale === scale) return;\n\t\tconst canvasCoords = this.C2C(origin);\n\t\tthis.data.offsetX = origin.x - (canvasCoords.x * validNewScale) / scale;\n\t\tthis.data.offsetY = origin.y - (canvasCoords.y * validNewScale) / scale;\n\t\tthis.data.scale = validNewScale;\n\t};\n\tpan = ({ x, y }: Coordinates) => {\n\t\tthis.data.offsetX = this.data.offsetX + x;\n\t\tthis.data.offsetY = this.data.offsetY + y;\n\t};\n\tpanToCoords = ({ x, y }: Coordinates) => {\n\t\tthis.data.offsetX = x;\n\t\tthis.data.offsetY = y;\n\t};\n\tshiftFullscreen = async (option?: 'enter' | 'exit') => {\n\t\tif (!document.fullscreenElement && (!option || option === 'enter')) {\n\t\t\tawait this.data.container.requestFullscreen();\n\t\t\tthis.onToggleFullscreen(true);\n\t\t} else if (document.fullscreenElement && (!option || option === 'exit')) {\n\t\t\tawait document.exitFullscreen();\n\t\t\tthis.onToggleFullscreen(false);\n\t\t}\n\t};\n\tresetView = () => {\n\t\tconst bounds = this.data.nodeBounds;\n\t\tconst container = this.data.container;\n\t\tif (!bounds || !container) return;\n\t\tconst contentWidth = bounds.width + INITIAL_VIEWPORT_PADDING * 2;\n\t\tconst contentHeight = bounds.height + INITIAL_VIEWPORT_PADDING * 2;\n\t\t// Use logical dimensions for scaling calculations\n\t\tconst viewWidth = container.clientWidth;\n\t\tconst viewHeight = container.clientHeight;\n\t\tconst scaleX = viewWidth / contentWidth;\n\t\tconst scaleY = viewHeight / contentHeight;\n\t\tconst newScale = Math.round(Math.min(scaleX, scaleY) * 1000) / 1000;\n\t\tconst contentCenterX = bounds.centerX;\n\t\tconst contentCenterY = bounds.centerY;\n\t\tconst initialView = {\n\t\t\tscale: newScale,\n\t\t\toffsetX: viewWidth / 2 - contentCenterX * newScale,\n\t\t\toffsetY: viewHeight / 2 - contentCenterY * newScale,\n\t\t};\n\t\tthis.data.offsetX = initialView.offsetX;\n\t\tthis.data.offsetY = initialView.offsetY;\n\t\tthis.data.scale = initialView.scale;\n\t};\n\n\t// Container to Canvas\n\tprivate C2C = ({ x: containerX, y: containerY }: Coordinates) => ({\n\t\tx: containerX - this.data.offsetX,\n\t\ty: containerY - this.data.offsetY,\n\t});\n\n\tmiddleViewer = () => {\n\t\tconst container = this.data.container;\n\t\treturn {\n\t\t\tx: container.clientWidth / 2,\n\t\t\ty: container.clientHeight / 2,\n\t\t\twidth: container.clientWidth,\n\t\t\theight: container.clientHeight,\n\t\t};\n\t};\n\n\tprivate dispose = () => this.data.container.remove();\n}\n","import { BaseModule, type BaseArgs } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities from '$/utilities';\nimport { parseHex, toHslString, type HslColor, rgbToHsl } from '@ahmedsemih/color-fns';\n\nexport type Color = {\n\tborder: string;\n\tbackground: string;\n\tactive: string;\n\ttext: string;\n\tcard: string;\n};\n\ntype Options = {\n\ttheme?: 'dark' | 'light';\n};\n\ntype Augmentation = {\n\tchangeTheme: StyleManager['changeTheme'];\n};\n\nconst definedColors = {\n\tlight: {\n\t\t'0': { hue: 0, saturation: 0, lightness: 72 },\n\t\t'1': { hue: 358, saturation: 81, lightness: 55 },\n\t\t'2': { hue: 19, saturation: 87, lightness: 58 },\n\t\t'3': { hue: 41, saturation: 79, lightness: 52 },\n\t\t'4': { hue: 150, saturation: 100, lightness: 37 },\n\t\t'5': { hue: 221, saturation: 100, lightness: 59 },\n\t\t'6': { hue: 257, saturation: 81, lightness: 62 },\n\t},\n\tdark: {\n\t\t'0': { hue: 0, saturation: 0, lightness: 40 },\n\t\t'1': { hue: 358, saturation: 100, lightness: 65 },\n\t\t'2': { hue: 23, saturation: 86, lightness: 63 },\n\t\t'3': { hue: 39, saturation: 91, lightness: 70 },\n\t\t'4': { hue: 153, saturation: 80, lightness: 45 },\n\t\t'5': { hue: 217, saturation: 100, lightness: 62 },\n\t\t'6': { hue: 259, saturation: 100, lightness: 75 },\n\t},\n};\n\nconst namedColors = {\n\tlight: {\n\t\tdots: 'hsla(0, 0%, 72%, 0.4)',\n\t\ttext: 'rgb(30, 30, 30)',\n\t\tbackground: 'rgb(250, 250, 250)',\n\t\t'background-secondary': 'rgb(255, 255, 255)',\n\t\tshadow: '0px 0px 8px rgb(0, 0, 0, 0.1)',\n\t\tborder: 'hsla(0, 0%, 82%, 0.7)',\n\t},\n\tdark: {\n\t\tdots: 'hsla(0, 0%, 40%, 0.3)',\n\t\ttext: 'rgb(242, 242, 242)',\n\t\tbackground: 'rgb(30, 30, 30)',\n\t\t'background-secondary': 'rgb(37, 37, 40)',\n\t\tshadow: '0px 0px 8px rgb(0, 0, 0, 0.2)',\n\t\tborder: 'hsla(0, 0%, 30%, 0.7)',\n\t},\n};\n\nexport default class StyleManager extends BaseModule<Options, Augmentation> {\n\ttheme: 'dark' | 'light' = 'light';\n\tonChangeTheme = utilities.makeHook<['light' | 'dark']>();\n\n\tprivate colorCache: {\n\t\tdark: {\n\t\t\t[key: string]: Color;\n\t\t};\n\t\tlight: {\n\t\t\t[key: string]: Color;\n\t\t};\n\t} = {\n\t\tdark: {},\n\t\tlight: {},\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.changeTheme(this.options.theme || 'light');\n\t\tthis.augment({ changeTheme: this.changeTheme });\n\t}\n\n\tprivate hslProcessor = (color: HslColor) => {\n\t\tconst { hue, saturation, lightness } = color;\n\t\tlet result;\n\t\tif (this.theme === 'dark') {\n\t\t\tresult = {\n\t\t\t\tactive: color,\n\t\t\t\tcard: { hue, saturation: saturation / 3, lightness: lightness / 3 },\n\t\t\t\tborder: { ...color, alpha: 0.7 },\n\t\t\t\tbackground: { ...color, alpha: 0.1 },\n\t\t\t\ttext: color.lightness >= 70 ? 'rgb(30, 30, 30)' : 'rgb(242, 242, 242)',\n\t\t\t};\n\t\t} else {\n\t\t\tresult = {\n\t\t\t\tactive: color,\n\t\t\t\tcard:\n\t\t\t\t\thue === 0\n\t\t\t\t\t\t? { hue, saturation, lightness: 100 }\n\t\t\t\t\t\t: { hue, saturation: saturation * 0.4, lightness: 90 },\n\t\t\t\tborder: { ...color, alpha: 0.7 },\n\t\t\t\tbackground: { ...color, alpha: 0.1 },\n\t\t\t\ttext: color.lightness >= 70 ? 'rgb(30, 30, 30)' : 'rgb(242, 242, 242)',\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tactive: toHslString(result.active),\n\t\t\tcard: toHslString(result.card),\n\t\t\tborder: toHslString(result.border),\n\t\t\tbackground: toHslString(result.background),\n\t\t\ttext: result.text,\n\t\t};\n\t};\n\n\tgetColor = (colorIndex: string = '0') => {\n\t\tconst theme = this.theme;\n\t\tlet color: Color;\n\t\tif (this.colorCache[theme][colorIndex]) return this.colorCache[theme][colorIndex];\n\t\telse if (colorIndex in definedColors[theme])\n\t\t\tcolor = this.hslProcessor(\n\t\t\t\tdefinedColors[theme][colorIndex as keyof typeof definedColors.dark],\n\t\t\t);\n\t\telse color = this.hslProcessor(rgbToHsl(parseHex(colorIndex)));\n\t\tthis.colorCache[theme][colorIndex] = color;\n\t\treturn color;\n\t};\n\n\tgetNamedColor = (name: keyof typeof namedColors.dark) => namedColors[this.theme][name];\n\n\tchangeTheme = (theme?: 'dark' | 'light') => {\n\t\tthis.theme = theme ? theme : this.theme === 'dark' ? 'light' : 'dark';\n\t\tconst container = this.container.get(DataManager).data.container;\n\t\tObject.entries(namedColors[this.theme]).forEach(([key, value]) => {\n\t\t\tcontainer.style.setProperty(`--${key}`, value);\n\t\t});\n\t\tthis.onChangeTheme(this.theme);\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport StyleManager from '$/styleManager';\nimport utilities from '$/utilities';\n\ntype Augmentation = {\n\trefresh: Controller['refresh'];\n};\n\nexport default class Controller extends BaseModule<{}, Augmentation> {\n\tprivate animationId: null | number = null;\n\tprivate resizeAnimationId: null | number = null;\n\tprivate DM: DataManager;\n\tprivate SM: StyleManager;\n\tprivate resizeObserver: ResizeObserver;\n\tprivate perFrame: {\n\t\tlastScale: number;\n\t\tlastOffsets: { x: number; y: number };\n\t} = {\n\t\tlastScale: 1,\n\t\tlastOffsets: { x: 0, y: 0 },\n\t};\n\tprivate lastResizeCenter: {\n\t\tx: null | number;\n\t\ty: null | number;\n\t} = {\n\t\tx: null,\n\t\ty: null,\n\t};\n\n\thooks = {\n\t\tonResize: utilities.makeHook<[number, number]>(),\n\t\tonRefresh: utilities.makeHook(),\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.SM = this.container.get(StyleManager);\n\t\tthis.resizeObserver = new ResizeObserver(this.onResize);\n\t\tthis.SM.onChangeTheme.subscribe(this.refresh);\n\t\tthis.augment({ refresh: this.refresh });\n\t\tthis.onStart(this.start);\n\t\tthis.onRestart(this.refresh);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate start = () => {\n\t\tthis.resizeObserver.observe(this.DM.data.container);\n\t\tthis.animationId = requestAnimationFrame(this.draw);\n\t};\n\n\tprivate draw = () => {\n\t\tif (\n\t\t\tthis.perFrame.lastScale !== this.DM.data.scale ||\n\t\t\tthis.perFrame.lastOffsets.x !== this.DM.data.offsetX ||\n\t\t\tthis.perFrame.lastOffsets.y !== this.DM.data.offsetY\n\t\t)\n\t\t\tthis.refresh();\n\t\tthis.animationId = requestAnimationFrame(this.draw);\n\t};\n\n\trefresh = () => {\n\t\tthis.perFrame = {\n\t\t\tlastScale: this.DM.data.scale,\n\t\t\tlastOffsets: { x: this.DM.data.offsetX, y: this.DM.data.offsetY },\n\t\t};\n\t\tthis.hooks.onRefresh();\n\t};\n\n\tprivate onResize = () => {\n\t\tthis.resizeAnimationId = requestAnimationFrame(() => {\n\t\t\tconst center = this.DM.middleViewer();\n\t\t\tif (this.lastResizeCenter.x && this.lastResizeCenter.y) {\n\t\t\t\tthis.DM.data.offsetX = this.DM.data.offsetX + center.x - this.lastResizeCenter.x;\n\t\t\t\tthis.DM.data.offsetY = this.DM.data.offsetY + center.y - this.lastResizeCenter.y;\n\t\t\t}\n\t\t\tthis.lastResizeCenter.x = center.x;\n\t\t\tthis.lastResizeCenter.y = center.y;\n\t\t\tthis.hooks.onResize(center.width, center.height);\n\t\t\tthis.refresh();\n\t\t});\n\t};\n\n\tprivate dispose = () => {\n\t\tif (this.animationId) cancelAnimationFrame(this.animationId);\n\t\tif (this.resizeAnimationId) cancelAnimationFrame(this.resizeAnimationId);\n\t\tthis.resizeObserver.disconnect();\n\t};\n}\n"],"names":["BaseModule","constructor","container","options","onStart","onDispose","onRestart","augment","this","subscribe","utilities","round","roundedNum","digits","factor","Math","resizeCanvasForDPR","canvas","width","height","dpr","window","devicePixelRatio","ctx","getContext","Error","setTransform","scale","applyStyles","styleString","style","document","createElement","innerHTML","appendChild","drawRoundRect","x","y","radius","beginPath","moveTo","lineTo","quadraticCurveTo","closePath","getAnchorCoord","node","side","midX","midY","makeHook","reverse","result","args","Array","from","subs","forEach","callback","Set","add","unsubscribe","delete","destroyError","DataManager","onToggleFullscreen","data","canvasData","nodes","edges","nodeMap","edgeMap","canvasBaseDir","nodeBounds","maxX","maxY","minX","minY","centerX","centerY","offsetX","offsetY","super","viewerContainer","firstElementChild","remove","realContainer","noShadow","attachShadow","mode","extraCSS","classList","zoom","zoomToScale","pan","panToCoords","resetView","shiftFullscreen","start","dispose","Object","assign","processBaseDir","attachmentDir","calculateNodeBounds","item","ref","box","getNodeBox","id","type","fileName","file","split","pop","startsWith","edge","getEdgeBox","baseDir","lastChar","slice","left","top","right","bottom","fromNode","to","toNode","fromAnchor","fromSide","toAnchor","toSide","strictBox","min","max","_min","margin","log2","Infinity","origin","newScale","validNewScale","canvasCoords","C2C","async","option","fullscreenElement","exitFullscreen","requestFullscreen","bounds","contentWidth","INITIAL_VIEWPORT_PADDING","contentHeight","viewWidth","clientWidth","viewHeight","clientHeight","scaleX","scaleY","initialView","containerX","containerY","middleViewer","definedColors","light","hue","saturation","lightness","dark","namedColors","dots","text","background","shadow","border","StyleManager","theme","onChangeTheme","colorCache","changeTheme","hslProcessor","color","active","card","alpha","toHslString","getColor","colorIndex","rgbToHsl","parseHex","getNamedColor","name","get","entries","key","value","setProperty","Controller","animationId","resizeAnimationId","DM","SM","resizeObserver","perFrame","lastScale","lastOffsets","lastResizeCenter","hooks","onResize","onRefresh","ResizeObserver","refresh","observe","requestAnimationFrame","draw","center","cancelAnimationFrame","disconnect"],"mappings":"gFAeO,MAAMA,EAKZ,WAAAC,CACWC,EACVC,EACAC,EACAC,EACAC,EACAC,GALUC,KAAAN,UAAAA,EAOVM,KAAKL,QAAUA,EACfK,KAAKJ,QAAUA,EAAQK,UACvBD,KAAKH,UAAYA,EAAUI,UAC3BD,KAAKF,UAAYA,EAAUG,UAC3BD,KAAKD,QAAUA,CAChB,CAjBAH,QACAE,UACAD,UACAE,QAeAJ,cChCDO,EAAe,CACdC,MAqED,SAAeC,EAAoBC,GAClC,MAAMC,EAAS,IAAMD,EACrB,OAAOE,KAAKJ,MAAMC,EAAaE,GAAUA,CAC1C,EAvECE,mBAuDD,SAA4BC,EAA2BC,EAAeC,GACrE,MAAMC,EAAMC,OAAOC,kBAAoB,EACjCC,EAAMN,EAAOO,WAAW,MAC9B,IAAKD,EACJ,MAAM,IAAIE,MACT,uJAEFR,EAAOC,MAAQH,KAAKJ,MAAM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KAAKqM,iBAAiBzK,EAC/E5B,KAAK+L,GAAGtI,KAAKe,QAAUxE,KAAK+L,GAAGtI,KAAKe,QAAUsI,EAAOjL,EAAI7B,KAAKqM,iBAAiBxK,GAEhF7B,KAAKqM,iBAAiBzK,EAAIkL,EAAOlL,EACjC5B,KAAKqM,iBAAiBxK,EAAIiL,EAAOjL,EACjC7B,KAAKsM,MAAMC,SAASO,EAAOpM,MAAOoM,EAAOnM,QACzCX,KAAK0M,aAIChH,QAAU,KACb1F,KAAK6L,aAAakB,qBAAqB/M,KAAK6L,aAC5C7L,KAAK8L,mBAAmBiB,qBAAqB/M,KAAK8L,mBACtD9L,KAAKiM,eAAee"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t=require("@ahmedsemih/color-fns");class e{constructor(t,e,o,s,a,r){this.container=t,this.options=e,this.onStart=o.subscribe,this.onDispose=s.subscribe,this.onRestart=a.subscribe,this.augment=r}onStart;onRestart;onDispose;augment;options}const o={round:function(t,e){const o=10**e;return Math.round(t*o)/o},resizeCanvasForDPR:function(t,e,o){const s=window.devicePixelRatio||1,a=t.getContext("2d");if(!a)throw new Error("[JSONCanvasViewer] This error is unexpected, probably caused uncontrollable runtime errors. Please contact the developer and show how to reproduce.");t.width=Math.round(e*s),t.height=Math.round(o*s),a.setTransform(1,0,0,1,0,0),a.scale(s,s)},applyStyles:function(t,e){const o=document.createElement("style");o.innerHTML=e,t.appendChild(o)},drawRoundRect:function(t,e,o,s,a,r){t.beginPath(),t.moveTo(e+r,o),t.lineTo(e+s-r,o),t.quadraticCurveTo(e+s,o,e+s,o+r),t.lineTo(e+s,o+a-r),t.quadraticCurveTo(e+s,o+a,e+s-r,o+a),t.lineTo(e+r,o+a),t.quadraticCurveTo(e,o+a,e,o+a-r),t.lineTo(e,o+r),t.quadraticCurveTo(e,o,e+r,o),t.closePath()},getAnchorCoord:function(t,e){const o=t.x+t.width/2,s=t.y+t.height/2;switch(e){case"top":return{x:o,y:t.y};case"bottom":return{x:o,y:t.y+t.height};case"left":return{x:t.x,y:s};case"right":return{x:t.x+t.width,y:s};default:return{x:o,y:s}}},makeHook:function(t=!1){const e=(...o)=>{if(t){Array.from(e.subs).reverse().forEach(t=>{t(...o)})}else e.subs.forEach(t=>{t(...o)})};return e.subs=new Set,e.subscribe=t=>{e.subs.add(t)},e.unsubscribe=t=>{e.subs.delete(t)},e}},s=new Error("[JSONCanvasViewer] Resource hasn't been set up or has been disposed.");class a extends e{onToggleFullscreen=o.makeHook();data={canvasData:{nodes:[],edges:[]},nodeMap:{},edgeMap:{},canvasBaseDir:"./",nodeBounds:{maxX:0,maxY:0,minX:0,minY:0,width:0,height:0,centerX:0,centerY:0},offsetX:0,offsetY:0,scale:1,container:document.createElement("div")};constructor(...t){super(...t);const e=this.options.container;for(;e.firstElementChild;)e.firstElementChild.remove();e.innerHTML="";const s=this.options.noShadow||!1?e:e.attachShadow({mode:"open"});o.applyStyles(s,".full,.overlay-container .click-layer,.overlay-container .link-iframe,.overlay-container .audio{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.overlay-container.markdown-content{display:flex;justify-content:center;align-items:center}.border-shadow-bg{background:var(--background-secondary);border:1px solid var(--border);box-shadow:var(--shadow)}.collapse-button{border-radius:8px;transition:transform .2s,background-color .2s}.collapse-button:hover{background-color:var(--border)}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;width:32px;padding:5px 0}button svg{width:100%;height:100%}.container{--contentTransition: color .2s, opacity .2s, text-shadow .2s, fill .2s;--containerTransition: background .2s, opacity .2s, box-shadow .2s, border .2s, filter .2s, backdrop-filter .2s;color:var(--text);fill:var(--text);stroke:var(--text);background-color:var(--background);position:relative;width:100%;height:100%;overflow:hidden}.container.numb,.container.numb *{pointer-events:none!important}.main-canvas{width:100%;height:100%;transform-origin:top left}.overlays{position:absolute;transform-origin:top left;will-change:transform}.overlay-container{position:absolute;box-sizing:border-box;border-radius:12px;overflow:hidden;-webkit-user-select:none;user-select:none;contain:strict;content-visibility:auto;box-shadow:var(--shadow);background-color:var(--overlay-card);transition:var(--containerTransition)}.overlay-container .overlay-border{box-sizing:border-box;pointer-events:none;position:absolute;color:var(--overlay-border);top:0;left:0;width:100%;height:100%;border-width:1px;border-style:solid;border-radius:12px;transition:var(--containerTransition)}.overlay-container.active{-webkit-user-select:auto;user-select:auto;pointer-events:auto}.overlay-container.active .overlay-border{border:4px solid var(--overlay-active)}.overlay-container .link-iframe,.overlay-container .audio{border:none;background:transparent}.overlay-container .click-layer{background:transparent;pointer-events:auto}.overlay-container.active .click-layer{pointer-events:none}.overlay-container img{width:100%;height:100%;object-fit:cover;pointer-events:none}.overlay-container.active img{pointer-events:auto}.overlay-container.markdown-content{position:absolute;padding:0 7px}.overlay-container.markdown-content.rtl{direction:rtl;text-align:right}.overlay-container .parsed-content-wrapper{font-family:sans-serif;box-sizing:border-box;max-width:100%;max-height:100%;padding:10px 6px;pointer-events:none;overflow:hidden;scrollbar-gutter:stable both-edges;display:flex;flex-direction:column;gap:12px}@supports not (scrollbar-gutter: stable both-edges){.overlay-container .parsed-content-wrapper{padding:10px}}.overlay-container.active .parsed-content-wrapper{overflow:auto}::-webkit-scrollbar{width:4px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:2px;background:#ffffff40}::-webkit-scrollbar-thumb:hover{background:#1e1e1ebf}p{font-size:16px;line-height:21px}.parsed-content-wrapper img{width:100%;border-radius:8px}h1{font-size:25px}h2{font-size:23px}h3{font-size:22px}h4{font-size:20px}h5{font-size:19px}h6{font-size:17px}p,h1,h2,h3,h4,h5,h6,ol,ul{margin:0}h1,h2{font-weight:800}h3,h4{font-weight:700}h5,h6{font-weight:600}code{background:#ffffff1a;padding:2px 4px;border-radius:8px}pre code{display:block;box-sizing:border-box;width:100%}pre:has(code),table{margin:6px 0}strong{color:#fe8e7c}em{color:#5affb2}a{text-decoration:none;color:#6dadd0;font-weight:800;font-style:italic;cursor:pointer;transition:var(--contentTransition)}a:hover{color:#86d3fd}hr{height:1px;width:100%;background-color:#fff3;border:none}li{margin:5px 0}ul{padding-left:16px}ol{padding-left:15px;padding-right:7.5px}table{border-collapse:collapse;border-radius:8px;overflow:hidden;width:100%}table th,table td{border:1px solid rgba(255,255,255,.2);padding:6px 10px;background:#ffffff0f;text-align:left}table th{background:#ffffff1f;font-weight:700}"+this.options.extraCSS),this.data.container.classList.add("container"),s.appendChild(this.data.container),this.augment({zoom:this.zoom,zoomToScale:this.zoomToScale,pan:this.pan,panToCoords:this.panToCoords,resetView:this.resetView,shiftFullscreen:this.shiftFullscreen}),this.onStart(this.start),this.onRestart(this.start),this.onDispose(this.dispose)}start=()=>{const t=Object.assign({nodes:[],edges:[]},this.options.canvas);Object.assign(this.data,{canvasData:t,nodeMap:{},edgeMap:{},canvasBaseDir:this.processBaseDir(this.options.attachmentDir),nodeBounds:this.calculateNodeBounds(t),offsetX:0,offsetY:0,scale:1}),this.data.canvasData.nodes.forEach(t=>{const e={ref:t,box:this.getNodeBox(t)};if(this.data.nodeMap[t.id]=e,"file"===t.type){const o=t.file.split("/").pop()||"";e.fileName=o,t.file.startsWith("http://")||t.file.startsWith("https://")||(t.file=this.data.canvasBaseDir+o)}}),this.data.canvasData.edges.forEach(t=>{this.data.edgeMap[t.id]={ref:t,box:this.getEdgeBox(t)}}),this.resetView()};processBaseDir=t=>{if(!t)return"./";const e=t?.slice(-1);return"/"===e?t:`${t}/`};getNodeBox=t=>({left:t.x,top:t.y-40,right:t.width+t.x,bottom:t.y+t.height});getEdgeBox=t=>{const e=this.data.nodeMap,s=e[t.fromNode].ref,a=e[t.toNode].ref,r=o.getAnchorCoord(s,t.fromSide),i=o.getAnchorCoord(a,t.toSide),n=Math.min(r.x,i.x),h=Math.min(r.y,i.y),d=Math.max(r.x,i.x),c=Math.max(r.y,i.y),l=d-n,u=c-h,f=Math.min(l,u),p=0===f?1:f,g=Math.max(l,u),b=10*Math.log2(g/p);return{left:n-b,top:h-b,right:d+b,bottom:c+b}};calculateNodeBounds(t){let e=1/0,o=1/0,s=-1/0,a=-1/0;t.nodes.forEach(t=>{e=Math.min(e,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x+t.width),a=Math.max(a,t.y+t.height)});const r=s-e,i=a-o;return{minX:e,minY:o,maxX:s,maxY:a,width:r,height:i,centerX:e+r/2,centerY:o+i/2}}zoom=(t,e)=>{const o=this.data.scale*t;this.zoomToScale(o,e)};zoomToScale=(t,e)=>{const o=Math.max(Math.min(t,20),.05),s=this.data.scale;if(o===s)return;const a=this.C2C(e);this.data.offsetX=e.x-a.x*o/s,this.data.offsetY=e.y-a.y*o/s,this.data.scale=o};pan=({x:t,y:e})=>{this.data.offsetX=this.data.offsetX+t,this.data.offsetY=this.data.offsetY+e};panToCoords=({x:t,y:e})=>{this.data.offsetX=t,this.data.offsetY=e};shiftFullscreen=async t=>{document.fullscreenElement||t&&"enter"!==t?!document.fullscreenElement||t&&"exit"!==t||(await document.exitFullscreen(),this.onToggleFullscreen(!1)):(await this.data.container.requestFullscreen(),this.onToggleFullscreen(!0))};resetView=()=>{const t=this.data.nodeBounds,e=this.data.container;if(!t||!e)return;const o=t.width+200,s=t.height+200,a=e.clientWidth,r=e.clientHeight,i=a/o,n=r/s,h=Math.round(1e3*Math.min(i,n))/1e3,d={scale:h,offsetX:a/2-t.centerX*h,offsetY:r/2-t.centerY*h};this.data.offsetX=d.offsetX,this.data.offsetY=d.offsetY,this.data.scale=d.scale};C2C=({x:t,y:e})=>({x:t-this.data.offsetX,y:e-this.data.offsetY});middleViewer=()=>{const t=this.data.container;return{x:t.clientWidth/2,y:t.clientHeight/2,width:t.clientWidth,height:t.clientHeight}};dispose=()=>this.data.container.remove()}const r={light:{0:{hue:0,saturation:0,lightness:72},1:{hue:358,saturation:81,lightness:55},2:{hue:19,saturation:87,lightness:58},3:{hue:41,saturation:79,lightness:52},4:{hue:150,saturation:100,lightness:37},5:{hue:221,saturation:100,lightness:59},6:{hue:257,saturation:81,lightness:62}},dark:{0:{hue:0,saturation:0,lightness:40},1:{hue:358,saturation:100,lightness:65},2:{hue:23,saturation:86,lightness:63},3:{hue:39,saturation:91,lightness:70},4:{hue:153,saturation:80,lightness:45},5:{hue:217,saturation:100,lightness:62},6:{hue:259,saturation:100,lightness:75}}},i={light:{dots:"hsla(0, 0%, 72%, 0.4)",text:"rgb(30, 30, 30)",background:"rgb(250, 250, 250)","background-secondary":"rgb(255, 255, 255)",shadow:"0px 0px 8px rgb(0, 0, 0, 0.1)",border:"hsla(0, 0%, 82%, 0.7)"},dark:{dots:"hsla(0, 0%, 40%, 0.3)",text:"rgb(242, 242, 242)",background:"rgb(30, 30, 30)","background-secondary":"rgb(37, 37, 40)",shadow:"0px 0px 8px rgb(0, 0, 0, 0.2)",border:"hsla(0, 0%, 30%, 0.7)"}};class n extends e{theme="light";onChangeTheme=o.makeHook();colorCache={dark:{},light:{}};constructor(...t){super(...t),this.changeTheme(this.options.theme||"light"),this.augment({changeTheme:this.changeTheme})}hslProcessor=e=>{const{hue:o,saturation:s,lightness:a}=e;let r;return r="dark"===this.theme?{active:e,card:{hue:o,saturation:s/3,lightness:a/3},border:{...e,alpha:.7},background:{...e,alpha:.1},text:e.lightness>=70?"rgb(30, 30, 30)":"rgb(242, 242, 242)"}:{active:e,card:0===o?{hue:o,saturation:s,lightness:100}:{hue:o,saturation:.4*s,lightness:90},border:{...e,alpha:.7},background:{...e,alpha:.1},text:e.lightness>=70?"rgb(30, 30, 30)":"rgb(242, 242, 242)"},{active:t.toHslString(r.active),card:t.toHslString(r.card),border:t.toHslString(r.border),background:t.toHslString(r.background),text:r.text}};getColor=(e="0")=>{const o=this.theme;let s;return this.colorCache[o][e]?this.colorCache[o][e]:(s=e in r[o]?this.hslProcessor(r[o][e]):this.hslProcessor(t.rgbToHsl(t.parseHex(e))),this.colorCache[o][e]=s,s)};getNamedColor=t=>i[this.theme][t];changeTheme=t=>{this.theme=t||("dark"===this.theme?"light":"dark");const e=this.container.get(a).data.container;Object.entries(i[this.theme]).forEach(([t,o])=>{e.style.setProperty(`--${t}`,o)}),this.onChangeTheme(this.theme)}}exports.BaseModule=e,exports.Controller=class extends e{animationId=null;resizeAnimationId=null;DM;SM;resizeObserver;perFrame={lastScale:1,lastOffsets:{x:0,y:0}};lastResizeCenter={x:null,y:null};hooks={onResize:o.makeHook(),onRefresh:o.makeHook()};constructor(...t){super(...t),this.DM=this.container.get(a),this.SM=this.container.get(n),this.resizeObserver=new ResizeObserver(this.onResize),this.SM.onChangeTheme.subscribe(this.refresh),this.augment({refresh:this.refresh}),this.onStart(this.start),this.onRestart(this.refresh),this.onDispose(this.dispose)}start=()=>{this.resizeObserver.observe(this.DM.data.container),this.animationId=requestAnimationFrame(this.draw)};draw=()=>{this.perFrame.lastScale===this.DM.data.scale&&this.perFrame.lastOffsets.x===this.DM.data.offsetX&&this.perFrame.lastOffsets.y===this.DM.data.offsetY||this.refresh(),this.animationId=requestAnimationFrame(this.draw)};refresh=()=>{this.perFrame={lastScale:this.DM.data.scale,lastOffsets:{x:this.DM.data.offsetX,y:this.DM.data.offsetY}},this.hooks.onRefresh()};onResize=()=>{this.resizeAnimationId=requestAnimationFrame(()=>{const t=this.DM.middleViewer();this.lastResizeCenter.x&&this.lastResizeCenter.y&&(this.DM.data.offsetX=this.DM.data.offsetX+t.x-this.lastResizeCenter.x,this.DM.data.offsetY=this.DM.data.offsetY+t.y-this.lastResizeCenter.y),this.lastResizeCenter.x=t.x,this.lastResizeCenter.y=t.y,this.hooks.onResize(t.width,t.height),this.refresh()})};dispose=()=>{this.animationId&&cancelAnimationFrame(this.animationId),this.resizeAnimationId&&cancelAnimationFrame(this.resizeAnimationId),this.resizeObserver.disconnect()}},exports.DataManager=a,exports.StyleManager=n,exports.destroyError=s,exports.utilities=o;
|
|
2
|
+
//# sourceMappingURL=controller-Bc-S4ZVK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-Bc-S4ZVK.cjs","sources":["../src/core/baseModule.ts","../src/core/utilities.ts","../src/core/dataManager.ts","../src/core/styleManager.ts","../src/core/controller.ts"],"sourcesContent":["import type { DefaultOptions, Empty, GeneralObject, Indexable } from '$/declarations';\nimport type utilities from '$/utilities';\nimport type { Container } from '@needle-di/core';\n\ntype Hook = ReturnType<typeof utilities.makeHook>;\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type Augmentation = Record<Indexable, any>;\n\nexport type BaseArgs = [Container, GeneralObject, Hook, Hook, Hook, (aug: Augmentation) => void];\n\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type GeneralModuleCtor = typeof BaseModule<GeneralObject, any>;\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type GeneralModule = BaseModule<GeneralObject, any>;\n\nexport class BaseModule<O extends GeneralObject = Empty, A extends Augmentation = Empty> {\n\tonStart: Hook['subscribe'];\n\tonRestart: Hook['subscribe'];\n\tonDispose: Hook['subscribe'];\n\taugment: (aug: A) => void;\n\tconstructor(\n\t\tprotected container: Container,\n\t\toptions: GeneralObject,\n\t\tonStart: Hook,\n\t\tonDispose: Hook,\n\t\tonRestart: Hook,\n\t\taugment: (aug: A) => void,\n\t) {\n\t\tthis.options = options as DefaultOptions & O;\n\t\tthis.onStart = onStart.subscribe;\n\t\tthis.onDispose = onDispose.subscribe;\n\t\tthis.onRestart = onRestart.subscribe;\n\t\tthis.augment = augment;\n\t}\n\toptions: DefaultOptions & O;\n\tdeclare _providedMethods: A;\n}\n","import type { GeneralArguments } from '$/declarations';\n\nexport default {\n\tround,\n\tresizeCanvasForDPR,\n\tapplyStyles,\n\tdrawRoundRect,\n\tgetAnchorCoord,\n\tmakeHook,\n};\n\nexport const destroyError = new Error(\n\t\"[JSONCanvasViewer] Resource hasn't been set up or has been disposed.\",\n);\n\nfunction applyStyles(container: HTMLElement | ShadowRoot, styleString: string) {\n\tconst style = document.createElement('style');\n\tstyle.innerHTML = styleString;\n\tcontainer.appendChild(style);\n}\n\nfunction drawRoundRect(\n\tctx: CanvasRenderingContext2D,\n\tx: number,\n\ty: number,\n\twidth: number,\n\theight: number,\n\tradius: number,\n) {\n\tctx.beginPath();\n\tctx.moveTo(x + radius, y);\n\tctx.lineTo(x + width - radius, y);\n\tctx.quadraticCurveTo(x + width, y, x + width, y + radius);\n\tctx.lineTo(x + width, y + height - radius);\n\tctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n\tctx.lineTo(x + radius, y + height);\n\tctx.quadraticCurveTo(x, y + height, x, y + height - radius);\n\tctx.lineTo(x, y + radius);\n\tctx.quadraticCurveTo(x, y, x + radius, y);\n\tctx.closePath();\n}\n\nfunction getAnchorCoord(node: JSONCanvasNode, side: 'top' | 'bottom' | 'left' | 'right') {\n\tconst midX = node.x + node.width / 2;\n\tconst midY = node.y + node.height / 2;\n\tswitch (side) {\n\t\tcase 'top':\n\t\t\treturn { x: midX, y: node.y };\n\t\tcase 'bottom':\n\t\t\treturn { x: midX, y: node.y + node.height };\n\t\tcase 'left':\n\t\t\treturn { x: node.x, y: midY };\n\t\tcase 'right':\n\t\t\treturn { x: node.x + node.width, y: midY };\n\t\tdefault:\n\t\t\treturn { x: midX, y: midY };\n\t}\n}\n\nfunction resizeCanvasForDPR(canvas: HTMLCanvasElement, width: number, height: number) {\n\tconst dpr = window.devicePixelRatio || 1;\n\tconst ctx = canvas.getContext('2d');\n\tif (!ctx)\n\t\tthrow new Error(\n\t\t\t'[JSONCanvasViewer] This error is unexpected, probably caused uncontrollable runtime errors. Please contact the developer and show how to reproduce.',\n\t\t);\n\tcanvas.width = Math.round(width * dpr);\n\tcanvas.height = Math.round(height * dpr);\n\tctx.setTransform(1, 0, 0, 1, 0, 0);\n\tctx.scale(dpr, dpr);\n}\n\nfunction round(roundedNum: number, digits: number) {\n\tconst factor = 10 ** digits;\n\treturn Math.round(roundedNum * factor) / factor;\n}\n\nfunction makeHook<Args extends GeneralArguments = []>(reverse: boolean = false) {\n\ttype MatchingFunc = (...args: Args) => unknown;\n\ttype Hook = {\n\t\t(...args: Args): void;\n\t\tsubs: Set<MatchingFunc>;\n\t\tsubscribe(callback: MatchingFunc): void;\n\t\tunsubscribe(callback: MatchingFunc): void;\n\t};\n\tconst result: Hook = (...args: Args) => {\n\t\tif (reverse) {\n\t\t\tconst items = Array.from(result.subs).reverse();\n\t\t\titems.forEach((callback) => {\n\t\t\t\tcallback(...args);\n\t\t\t});\n\t\t} else\n\t\t\tresult.subs.forEach((callback) => {\n\t\t\t\tcallback(...args);\n\t\t\t});\n\t};\n\tresult.subs = new Set();\n\tresult.subscribe = (callback: MatchingFunc) => {\n\t\tresult.subs.add(callback);\n\t};\n\tresult.unsubscribe = (callback: MatchingFunc) => {\n\t\tresult.subs.delete(callback);\n\t};\n\treturn result;\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport type { Box, Coordinates, NodeBounds } from '$/declarations';\nimport style from '$/styles.scss?inline';\nimport utilities from '$/utilities';\n\nconst INITIAL_VIEWPORT_PADDING = 100;\nconst NODE_LABEL_MARGIN = 40;\nconst EDGE_BOX_HEURISTICS_BASE_MARGIN = 10;\n\ntype Options = {\n\tnoShadow?: boolean;\n\tcanvas?: JSONCanvas;\n\tattachmentDir?: string;\n\textraCSS?: string;\n};\n\ntype Augmentation = {\n\tzoom: DataManager['zoom'];\n\tzoomToScale: DataManager['zoomToScale'];\n\tpan: DataManager['pan'];\n\tpanToCoords: DataManager['panToCoords'];\n\tresetView: DataManager['resetView'];\n\tshiftFullscreen: DataManager['shiftFullscreen'];\n};\n\nexport interface NodeItem {\n\tref: JSONCanvasNode;\n\tbox: Box;\n\tfileName?: string;\n}\n\nexport interface EdgeItem {\n\tref: JSONCanvasEdge;\n\tbox: Box;\n\tcontrolPoints?: Array<number>;\n}\n\ntype NodeMap = Record<string, NodeItem>;\ntype EdgeMap = Record<string, EdgeItem>;\n\nexport default class DataManager extends BaseModule<Options, Augmentation> {\n\tonToggleFullscreen = utilities.makeHook<[boolean]>();\n\n\tdata: {\n\t\tcanvasData: Required<JSONCanvas>;\n\t\tnodeMap: NodeMap;\n\t\tedgeMap: EdgeMap;\n\t\tcanvasBaseDir: string;\n\t\tnodeBounds: NodeBounds;\n\t\toffsetX: number;\n\t\toffsetY: number;\n\t\tscale: number;\n\t\tcontainer: HTMLDivElement;\n\t} = {\n\t\tcanvasData: {\n\t\t\tnodes: [],\n\t\t\tedges: [],\n\t\t},\n\t\tnodeMap: {},\n\t\tedgeMap: {},\n\t\tcanvasBaseDir: './',\n\t\tnodeBounds: {\n\t\t\tmaxX: 0,\n\t\t\tmaxY: 0,\n\t\t\tminX: 0,\n\t\t\tminY: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tcenterX: 0,\n\t\t\tcenterY: 0,\n\t\t},\n\t\toffsetX: 0,\n\t\toffsetY: 0,\n\t\tscale: 1,\n\t\tcontainer: document.createElement('div'),\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tconst viewerContainer = this.options.container;\n\t\twhile (viewerContainer.firstElementChild) viewerContainer.firstElementChild.remove();\n\t\tviewerContainer.innerHTML = '';\n\n\t\tconst noShadow = this.options.noShadow || false;\n\t\tconst realContainer = noShadow\n\t\t\t? viewerContainer\n\t\t\t: viewerContainer.attachShadow({ mode: 'open' });\n\n\t\tutilities.applyStyles(realContainer, style + this.options.extraCSS);\n\n\t\tthis.data.container.classList.add('container');\n\t\trealContainer.appendChild(this.data.container);\n\n\t\tthis.augment({\n\t\t\tzoom: this.zoom,\n\t\t\tzoomToScale: this.zoomToScale,\n\t\t\tpan: this.pan,\n\t\t\tpanToCoords: this.panToCoords,\n\t\t\tresetView: this.resetView,\n\t\t\tshiftFullscreen: this.shiftFullscreen,\n\t\t});\n\t\tthis.onStart(this.start);\n\t\tthis.onRestart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate start = () => {\n\t\tconst canvasData = Object.assign(\n\t\t\t{\n\t\t\t\tnodes: [],\n\t\t\t\tedges: [],\n\t\t\t},\n\t\t\tthis.options.canvas,\n\t\t);\n\n\t\tObject.assign(this.data, {\n\t\t\tcanvasData: canvasData,\n\t\t\tnodeMap: {},\n\t\t\tedgeMap: {},\n\t\t\tcanvasBaseDir: this.processBaseDir(this.options.attachmentDir),\n\t\t\tnodeBounds: this.calculateNodeBounds(canvasData),\n\t\t\toffsetX: 0,\n\t\t\toffsetY: 0,\n\t\t\tscale: 1,\n\t\t});\n\n\t\tthis.data.canvasData.nodes.forEach((node) => {\n\t\t\tconst item: NodeItem = {\n\t\t\t\tref: node,\n\t\t\t\tbox: this.getNodeBox(node),\n\t\t\t};\n\t\t\tthis.data.nodeMap[node.id] = item;\n\t\t\tif (node.type === 'file') {\n\t\t\t\tconst path = node.file.split('/');\n\t\t\t\tconst fileName = path.pop() || '';\n\t\t\t\titem.fileName = fileName;\n\t\t\t\tif (!node.file.startsWith('http://') && !node.file.startsWith('https://'))\n\t\t\t\t\tnode.file = this.data.canvasBaseDir + fileName;\n\t\t\t}\n\t\t});\n\t\tthis.data.canvasData.edges.forEach((edge) => {\n\t\t\tthis.data.edgeMap[edge.id] = {\n\t\t\t\tref: edge,\n\t\t\t\tbox: this.getEdgeBox(edge),\n\t\t\t};\n\t\t});\n\t\tthis.resetView();\n\t};\n\n\tprivate processBaseDir = (baseDir: string | undefined) => {\n\t\tif (!baseDir) return './';\n\t\tconst lastChar = baseDir?.slice(-1);\n\t\tif (lastChar === '/') return baseDir;\n\t\treturn `${baseDir}/`;\n\t};\n\n\tprivate getNodeBox = (node: JSONCanvasNode) => {\n\t\treturn {\n\t\t\tleft: node.x,\n\t\t\ttop: node.y - NODE_LABEL_MARGIN,\n\t\t\tright: node.width + node.x,\n\t\t\tbottom: node.y + node.height,\n\t\t};\n\t};\n\n\tprivate getEdgeBox = (edge: JSONCanvasEdge) => {\n\t\tconst nodes = this.data.nodeMap;\n\t\tconst from = nodes[edge.fromNode].ref;\n\t\tconst to = nodes[edge.toNode].ref;\n\t\tconst fromAnchor = utilities.getAnchorCoord(from, edge.fromSide);\n\t\tconst toAnchor = utilities.getAnchorCoord(to, edge.toSide);\n\t\tconst strictBox = {\n\t\t\tleft: Math.min(fromAnchor.x, toAnchor.x),\n\t\t\ttop: Math.min(fromAnchor.y, toAnchor.y),\n\t\t\tright: Math.max(fromAnchor.x, toAnchor.x),\n\t\t\tbottom: Math.max(fromAnchor.y, toAnchor.y),\n\t\t};\n\t\t// edge size heuristics\n\t\tconst width = strictBox.right - strictBox.left;\n\t\tconst height = strictBox.bottom - strictBox.top;\n\t\tconst _min = Math.min(width, height);\n\t\tconst min = _min === 0 ? 1 : _min;\n\t\tconst max = Math.max(width, height);\n\t\tconst edgeFactor = Math.log2(max / min);\n\t\tconst margin = edgeFactor * EDGE_BOX_HEURISTICS_BASE_MARGIN;\n\t\treturn {\n\t\t\tleft: strictBox.left - margin,\n\t\t\ttop: strictBox.top - margin,\n\t\t\tright: strictBox.right + margin,\n\t\t\tbottom: strictBox.bottom + margin,\n\t\t};\n\t};\n\n\tprivate calculateNodeBounds(canvasData: Required<JSONCanvas>) {\n\t\tlet minX = Infinity,\n\t\t\tminY = Infinity,\n\t\t\tmaxX = -Infinity,\n\t\t\tmaxY = -Infinity;\n\t\tcanvasData.nodes.forEach((node) => {\n\t\t\tminX = Math.min(minX, node.x);\n\t\t\tminY = Math.min(minY, node.y);\n\t\t\tmaxX = Math.max(maxX, node.x + node.width);\n\t\t\tmaxY = Math.max(maxY, node.y + node.height);\n\t\t});\n\t\tconst width = maxX - minX;\n\t\tconst height = maxY - minY;\n\t\tconst centerX = minX + width / 2;\n\t\tconst centerY = minY + height / 2;\n\t\treturn { minX, minY, maxX, maxY, width, height, centerX, centerY };\n\t}\n\n\tzoom = (factor: number, origin: Coordinates) => {\n\t\tconst newScale = this.data.scale * factor;\n\t\tthis.zoomToScale(newScale, origin);\n\t};\n\tzoomToScale = (newScale: number, origin: Coordinates) => {\n\t\tconst validNewScale = Math.max(Math.min(newScale, 20), 0.05);\n\t\tconst scale = this.data.scale;\n\t\tif (validNewScale === scale) return;\n\t\tconst canvasCoords = this.C2C(origin);\n\t\tthis.data.offsetX = origin.x - (canvasCoords.x * validNewScale) / scale;\n\t\tthis.data.offsetY = origin.y - (canvasCoords.y * validNewScale) / scale;\n\t\tthis.data.scale = validNewScale;\n\t};\n\tpan = ({ x, y }: Coordinates) => {\n\t\tthis.data.offsetX = this.data.offsetX + x;\n\t\tthis.data.offsetY = this.data.offsetY + y;\n\t};\n\tpanToCoords = ({ x, y }: Coordinates) => {\n\t\tthis.data.offsetX = x;\n\t\tthis.data.offsetY = y;\n\t};\n\tshiftFullscreen = async (option?: 'enter' | 'exit') => {\n\t\tif (!document.fullscreenElement && (!option || option === 'enter')) {\n\t\t\tawait this.data.container.requestFullscreen();\n\t\t\tthis.onToggleFullscreen(true);\n\t\t} else if (document.fullscreenElement && (!option || option === 'exit')) {\n\t\t\tawait document.exitFullscreen();\n\t\t\tthis.onToggleFullscreen(false);\n\t\t}\n\t};\n\tresetView = () => {\n\t\tconst bounds = this.data.nodeBounds;\n\t\tconst container = this.data.container;\n\t\tif (!bounds || !container) return;\n\t\tconst contentWidth = bounds.width + INITIAL_VIEWPORT_PADDING * 2;\n\t\tconst contentHeight = bounds.height + INITIAL_VIEWPORT_PADDING * 2;\n\t\t// Use logical dimensions for scaling calculations\n\t\tconst viewWidth = container.clientWidth;\n\t\tconst viewHeight = container.clientHeight;\n\t\tconst scaleX = viewWidth / contentWidth;\n\t\tconst scaleY = viewHeight / contentHeight;\n\t\tconst newScale = Math.round(Math.min(scaleX, scaleY) * 1000) / 1000;\n\t\tconst contentCenterX = bounds.centerX;\n\t\tconst contentCenterY = bounds.centerY;\n\t\tconst initialView = {\n\t\t\tscale: newScale,\n\t\t\toffsetX: viewWidth / 2 - contentCenterX * newScale,\n\t\t\toffsetY: viewHeight / 2 - contentCenterY * newScale,\n\t\t};\n\t\tthis.data.offsetX = initialView.offsetX;\n\t\tthis.data.offsetY = initialView.offsetY;\n\t\tthis.data.scale = initialView.scale;\n\t};\n\n\t// Container to Canvas\n\tprivate C2C = ({ x: containerX, y: containerY }: Coordinates) => ({\n\t\tx: containerX - this.data.offsetX,\n\t\ty: containerY - this.data.offsetY,\n\t});\n\n\tmiddleViewer = () => {\n\t\tconst container = this.data.container;\n\t\treturn {\n\t\t\tx: container.clientWidth / 2,\n\t\t\ty: container.clientHeight / 2,\n\t\t\twidth: container.clientWidth,\n\t\t\theight: container.clientHeight,\n\t\t};\n\t};\n\n\tprivate dispose = () => this.data.container.remove();\n}\n","import { BaseModule, type BaseArgs } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities from '$/utilities';\nimport { parseHex, toHslString, type HslColor, rgbToHsl } from '@ahmedsemih/color-fns';\n\nexport type Color = {\n\tborder: string;\n\tbackground: string;\n\tactive: string;\n\ttext: string;\n\tcard: string;\n};\n\ntype Options = {\n\ttheme?: 'dark' | 'light';\n};\n\ntype Augmentation = {\n\tchangeTheme: StyleManager['changeTheme'];\n};\n\nconst definedColors = {\n\tlight: {\n\t\t'0': { hue: 0, saturation: 0, lightness: 72 },\n\t\t'1': { hue: 358, saturation: 81, lightness: 55 },\n\t\t'2': { hue: 19, saturation: 87, lightness: 58 },\n\t\t'3': { hue: 41, saturation: 79, lightness: 52 },\n\t\t'4': { hue: 150, saturation: 100, lightness: 37 },\n\t\t'5': { hue: 221, saturation: 100, lightness: 59 },\n\t\t'6': { hue: 257, saturation: 81, lightness: 62 },\n\t},\n\tdark: {\n\t\t'0': { hue: 0, saturation: 0, lightness: 40 },\n\t\t'1': { hue: 358, saturation: 100, lightness: 65 },\n\t\t'2': { hue: 23, saturation: 86, lightness: 63 },\n\t\t'3': { hue: 39, saturation: 91, lightness: 70 },\n\t\t'4': { hue: 153, saturation: 80, lightness: 45 },\n\t\t'5': { hue: 217, saturation: 100, lightness: 62 },\n\t\t'6': { hue: 259, saturation: 100, lightness: 75 },\n\t},\n};\n\nconst namedColors = {\n\tlight: {\n\t\tdots: 'hsla(0, 0%, 72%, 0.4)',\n\t\ttext: 'rgb(30, 30, 30)',\n\t\tbackground: 'rgb(250, 250, 250)',\n\t\t'background-secondary': 'rgb(255, 255, 255)',\n\t\tshadow: '0px 0px 8px rgb(0, 0, 0, 0.1)',\n\t\tborder: 'hsla(0, 0%, 82%, 0.7)',\n\t},\n\tdark: {\n\t\tdots: 'hsla(0, 0%, 40%, 0.3)',\n\t\ttext: 'rgb(242, 242, 242)',\n\t\tbackground: 'rgb(30, 30, 30)',\n\t\t'background-secondary': 'rgb(37, 37, 40)',\n\t\tshadow: '0px 0px 8px rgb(0, 0, 0, 0.2)',\n\t\tborder: 'hsla(0, 0%, 30%, 0.7)',\n\t},\n};\n\nexport default class StyleManager extends BaseModule<Options, Augmentation> {\n\ttheme: 'dark' | 'light' = 'light';\n\tonChangeTheme = utilities.makeHook<['light' | 'dark']>();\n\n\tprivate colorCache: {\n\t\tdark: {\n\t\t\t[key: string]: Color;\n\t\t};\n\t\tlight: {\n\t\t\t[key: string]: Color;\n\t\t};\n\t} = {\n\t\tdark: {},\n\t\tlight: {},\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.changeTheme(this.options.theme || 'light');\n\t\tthis.augment({ changeTheme: this.changeTheme });\n\t}\n\n\tprivate hslProcessor = (color: HslColor) => {\n\t\tconst { hue, saturation, lightness } = color;\n\t\tlet result;\n\t\tif (this.theme === 'dark') {\n\t\t\tresult = {\n\t\t\t\tactive: color,\n\t\t\t\tcard: { hue, saturation: saturation / 3, lightness: lightness / 3 },\n\t\t\t\tborder: { ...color, alpha: 0.7 },\n\t\t\t\tbackground: { ...color, alpha: 0.1 },\n\t\t\t\ttext: color.lightness >= 70 ? 'rgb(30, 30, 30)' : 'rgb(242, 242, 242)',\n\t\t\t};\n\t\t} else {\n\t\t\tresult = {\n\t\t\t\tactive: color,\n\t\t\t\tcard:\n\t\t\t\t\thue === 0\n\t\t\t\t\t\t? { hue, saturation, lightness: 100 }\n\t\t\t\t\t\t: { hue, saturation: saturation * 0.4, lightness: 90 },\n\t\t\t\tborder: { ...color, alpha: 0.7 },\n\t\t\t\tbackground: { ...color, alpha: 0.1 },\n\t\t\t\ttext: color.lightness >= 70 ? 'rgb(30, 30, 30)' : 'rgb(242, 242, 242)',\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tactive: toHslString(result.active),\n\t\t\tcard: toHslString(result.card),\n\t\t\tborder: toHslString(result.border),\n\t\t\tbackground: toHslString(result.background),\n\t\t\ttext: result.text,\n\t\t};\n\t};\n\n\tgetColor = (colorIndex: string = '0') => {\n\t\tconst theme = this.theme;\n\t\tlet color: Color;\n\t\tif (this.colorCache[theme][colorIndex]) return this.colorCache[theme][colorIndex];\n\t\telse if (colorIndex in definedColors[theme])\n\t\t\tcolor = this.hslProcessor(\n\t\t\t\tdefinedColors[theme][colorIndex as keyof typeof definedColors.dark],\n\t\t\t);\n\t\telse color = this.hslProcessor(rgbToHsl(parseHex(colorIndex)));\n\t\tthis.colorCache[theme][colorIndex] = color;\n\t\treturn color;\n\t};\n\n\tgetNamedColor = (name: keyof typeof namedColors.dark) => namedColors[this.theme][name];\n\n\tchangeTheme = (theme?: 'dark' | 'light') => {\n\t\tthis.theme = theme ? theme : this.theme === 'dark' ? 'light' : 'dark';\n\t\tconst container = this.container.get(DataManager).data.container;\n\t\tObject.entries(namedColors[this.theme]).forEach(([key, value]) => {\n\t\t\tcontainer.style.setProperty(`--${key}`, value);\n\t\t});\n\t\tthis.onChangeTheme(this.theme);\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport StyleManager from '$/styleManager';\nimport utilities from '$/utilities';\n\ntype Augmentation = {\n\trefresh: Controller['refresh'];\n};\n\nexport default class Controller extends BaseModule<{}, Augmentation> {\n\tprivate animationId: null | number = null;\n\tprivate resizeAnimationId: null | number = null;\n\tprivate DM: DataManager;\n\tprivate SM: StyleManager;\n\tprivate resizeObserver: ResizeObserver;\n\tprivate perFrame: {\n\t\tlastScale: number;\n\t\tlastOffsets: { x: number; y: number };\n\t} = {\n\t\tlastScale: 1,\n\t\tlastOffsets: { x: 0, y: 0 },\n\t};\n\tprivate lastResizeCenter: {\n\t\tx: null | number;\n\t\ty: null | number;\n\t} = {\n\t\tx: null,\n\t\ty: null,\n\t};\n\n\thooks = {\n\t\tonResize: utilities.makeHook<[number, number]>(),\n\t\tonRefresh: utilities.makeHook(),\n\t};\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.SM = this.container.get(StyleManager);\n\t\tthis.resizeObserver = new ResizeObserver(this.onResize);\n\t\tthis.SM.onChangeTheme.subscribe(this.refresh);\n\t\tthis.augment({ refresh: this.refresh });\n\t\tthis.onStart(this.start);\n\t\tthis.onRestart(this.refresh);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate start = () => {\n\t\tthis.resizeObserver.observe(this.DM.data.container);\n\t\tthis.animationId = requestAnimationFrame(this.draw);\n\t};\n\n\tprivate draw = () => {\n\t\tif (\n\t\t\tthis.perFrame.lastScale !== this.DM.data.scale ||\n\t\t\tthis.perFrame.lastOffsets.x !== this.DM.data.offsetX ||\n\t\t\tthis.perFrame.lastOffsets.y !== this.DM.data.offsetY\n\t\t)\n\t\t\tthis.refresh();\n\t\tthis.animationId = requestAnimationFrame(this.draw);\n\t};\n\n\trefresh = () => {\n\t\tthis.perFrame = {\n\t\t\tlastScale: this.DM.data.scale,\n\t\t\tlastOffsets: { x: this.DM.data.offsetX, y: this.DM.data.offsetY },\n\t\t};\n\t\tthis.hooks.onRefresh();\n\t};\n\n\tprivate onResize = () => {\n\t\tthis.resizeAnimationId = requestAnimationFrame(() => {\n\t\t\tconst center = this.DM.middleViewer();\n\t\t\tif (this.lastResizeCenter.x && this.lastResizeCenter.y) {\n\t\t\t\tthis.DM.data.offsetX = this.DM.data.offsetX + center.x - this.lastResizeCenter.x;\n\t\t\t\tthis.DM.data.offsetY = this.DM.data.offsetY + center.y - this.lastResizeCenter.y;\n\t\t\t}\n\t\t\tthis.lastResizeCenter.x = center.x;\n\t\t\tthis.lastResizeCenter.y = center.y;\n\t\t\tthis.hooks.onResize(center.width, center.height);\n\t\t\tthis.refresh();\n\t\t});\n\t};\n\n\tprivate dispose = () => {\n\t\tif (this.animationId) cancelAnimationFrame(this.animationId);\n\t\tif (this.resizeAnimationId) cancelAnimationFrame(this.resizeAnimationId);\n\t\tthis.resizeObserver.disconnect();\n\t};\n}\n"],"names":["BaseModule","constructor","container","options","onStart","onDispose","onRestart","augment","this","subscribe","utilities","round","roundedNum","digits","factor","Math","resizeCanvasForDPR","canvas","width","height","dpr","window","devicePixelRatio","ctx","getContext","Error","setTransform","scale","applyStyles","styleString","style","document","createElement","innerHTML","appendChild","drawRoundRect","x","y","radius","beginPath","moveTo","lineTo","quadraticCurveTo","closePath","getAnchorCoord","node","side","midX","midY","makeHook","reverse","result","args","Array","from","subs","forEach","callback","Set","add","unsubscribe","delete","destroyError","DataManager","onToggleFullscreen","data","canvasData","nodes","edges","nodeMap","edgeMap","canvasBaseDir","nodeBounds","maxX","maxY","minX","minY","centerX","centerY","offsetX","offsetY","super","viewerContainer","firstElementChild","remove","realContainer","noShadow","attachShadow","mode","extraCSS","classList","zoom","zoomToScale","pan","panToCoords","resetView","shiftFullscreen","start","dispose","Object","assign","processBaseDir","attachmentDir","calculateNodeBounds","item","ref","box","getNodeBox","id","type","fileName","file","split","pop","startsWith","edge","getEdgeBox","baseDir","lastChar","slice","left","top","right","bottom","fromNode","to","toNode","fromAnchor","fromSide","toAnchor","toSide","strictBox","min","max","_min","margin","log2","Infinity","origin","newScale","validNewScale","canvasCoords","C2C","async","option","fullscreenElement","exitFullscreen","requestFullscreen","bounds","contentWidth","INITIAL_VIEWPORT_PADDING","contentHeight","viewWidth","clientWidth","viewHeight","clientHeight","scaleX","scaleY","initialView","containerX","containerY","middleViewer","definedColors","light","hue","saturation","lightness","dark","namedColors","dots","text","background","shadow","border","StyleManager","theme","onChangeTheme","colorCache","changeTheme","hslProcessor","color","active","card","alpha","toHslString","getColor","colorIndex","rgbToHsl","parseHex","getNamedColor","name","get","entries","key","value","setProperty","animationId","resizeAnimationId","DM","SM","resizeObserver","perFrame","lastScale","lastOffsets","lastResizeCenter","hooks","onResize","onRefresh","ResizeObserver","refresh","observe","requestAnimationFrame","draw","center","cancelAnimationFrame","disconnect"],"mappings":"sDAeO,MAAMA,EAKZ,WAAAC,CACWC,EACVC,EACAC,EACAC,EACAC,EACAC,GALUC,KAAAN,UAAAA,EAOVM,KAAKL,QAAUA,EACfK,KAAKJ,QAAUA,EAAQK,UACvBD,KAAKH,UAAYA,EAAUI,UAC3BD,KAAKF,UAAYA,EAAUG,UAC3BD,KAAKD,QAAUA,CAChB,CAjBAH,QACAE,UACAD,UACAE,QAeAJ,cChCDO,EAAe,CACdC,MAqED,SAAeC,EAAoBC,GAClC,MAAMC,EAAS,IAAMD,EACrB,OAAOE,KAAKJ,MAAMC,EAAaE,GAAUA,CAC1C,EAvECE,mBAuDD,SAA4BC,EAA2BC,EAAeC,GACrE,MAAMC,EAAMC,OAAOC,kBAAoB,EACjCC,EAAMN,EAAOO,WAAW,MAC9B,IAAKD,EACJ,MAAM,IAAIE,MACT,uJAEFR,EAAOC,MAAQH,KAAKJ,MAAMO,EAAQE,GAClCH,EAAOE,OAASJ,KAAKJ,MAAMQ,EAASC,GACpCG,EAAIG,aAAa,EAAG,EAAG,EAAG,EAAG,EAAG,GAChCH,EAAII,MAAMP,EAAKA,EAChB,EAjECQ,YAUD,SAAqB1B,EAAqC2B,GACzD,MAAMC,EAAQC,SAASC,cAAc,SACrCF,EAAMG,UAAYJ,EAClB3B,EAAUgC,YAAYJ,EACvB,EAbCK,cAeD,SACCZ,EACAa,EACAC,EACAnB,EACAC,EACAmB,GAEAf,EAAIgB,YACJhB,EAAIiB,OAAOJ,EAAIE,EAAQD,GACvBd,EAAIkB,OAAOL,EAAIlB,EAAQoB,EAAQD,GAC/Bd,EAAImB,iBAA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D7L,KAAKgM,eAAee"}
|
package/dist/dev.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./controller-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./controller-Bc-S4ZVK.cjs"),r=require("./renderer-BEKV7hr3.cjs");exports.BaseModule=e.BaseModule,exports.Controller=e.Controller,exports.DataManager=e.DataManager,exports.StyleManager=e.StyleManager,exports.canvasUtils=e.utilities,exports.InteractionHandler=r.InteractionHandler,exports.OverlayManager=r.OverlayManager,exports.Renderer=r.Renderer;
|
|
2
2
|
//# sourceMappingURL=dev.cjs.map
|
package/dist/dev.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as a,C as r,D as e,u as
|
|
1
|
+
import{B as a,C as r,D as e,S as s,u as n}from"./controller-BRBUPg_j.js";import{I as o,O as t,R as l}from"./renderer-0RqgAOLH.js";export{a as BaseModule,r as Controller,e as DataManager,o as InteractionHandler,t as OverlayManager,l as Renderer,s as StyleManager,n as canvasUtils};
|
|
2
2
|
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{u as t,D as s,S as o,C as i}from"./controller-BRBUPg_j.js";import{O as n,I as e,R as r}from"./renderer-0RqgAOLH.js";import{Container as a}from"@needle-di/core";class h{allModules;IO=null;onDispose=t.makeHook(!0);onStart=t.makeHook();onRestart=t.makeHook();started=!1;options;container;constructor(t,h){this.container=new a,this.options=t;this.allModules=[s,o,i,n,e,r,...h||[]],this.allModules.forEach(t=>{this.container.bind({provide:t,useFactory:()=>new t(this.container,this.options,this.onStart,this.onDispose,this.onRestart,this.augment)})}),this.allModules.forEach(t=>{this.container.get(t)});const l=this.options.loading||"normal";"normal"===l?this.load():"lazy"===l&&(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container))}onVisibilityCheck=t=>{t.forEach(t=>{if(t.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};augment=t=>{Object.entries(t).forEach(([t,s])=>{this[t]=s})};load=t=>{t&&Object.assign(this.options,t),this.started?this.onRestart():(this.onStart(),this.started=!0)};dispose=()=>{this.IO?.disconnect(),this.IO=null;const t=this.options.container;for(;t.firstChild;)t.firstChild.remove();this.onDispose(),this.container.unbindAll()}}export{h as J};
|
|
2
|
+
//# sourceMappingURL=index-DJQyGIFX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DJQyGIFX.js","sources":["../src/core/index.ts"],"sourcesContent":["import type { Augmentation, GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type {\n\tModuleInputCtor,\n\tUserOptions,\n\tUserAugmentation,\n\tGeneralFunction,\n\tModuleInput,\n} from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport StyleManager from '$/styleManager';\nimport utilities from '$/utilities';\nimport { Container } from '@needle-di/core';\n\nclass JSONCanvasViewer<M extends ModuleInputCtor> {\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onDispose = utilities.makeHook(true);\n\tprivate onStart = utilities.makeHook();\n\tprivate onRestart = utilities.makeHook();\n\tprivate started = false;\n\toptions: UserOptions<M>;\n\tcontainer: Container;\n\n\tconstructor(options: UserOptions<M>, modules?: M) {\n\t\tthis.container = new Container();\n\t\tthis.options = options;\n\t\tconst bind = (Class: GeneralModuleCtor) => {\n\t\t\tthis.container.bind({\n\t\t\t\tprovide: Class,\n\t\t\t\tuseFactory: () =>\n\t\t\t\t\tnew Class(\n\t\t\t\t\t\tthis.container,\n\t\t\t\t\t\tthis.options,\n\t\t\t\t\t\tthis.onStart,\n\t\t\t\t\t\tthis.onDispose,\n\t\t\t\t\t\tthis.onRestart,\n\t\t\t\t\t\tthis.augment,\n\t\t\t\t\t),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\n\t\t\tStyleManager,\n\t\t\tController,\n\t\t\tOverlayManager,\n\t\t\tInteractionHandler,\n\t\t\tRenderer,\n\t\t\t...(modules || []),\n\t\t];\n\t\tthis.allModules.forEach(bind);\n\t\tthis.allModules.forEach((Module) => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\n\t\tconst loading = this.options.loading || 'normal';\n\t\tif (loading === 'normal') this.load();\n\t\telse if (loading === 'lazy') {\n\t\t\tthis.IO = new IntersectionObserver(this.onVisibilityCheck, {\n\t\t\t\troot: null,\n\t\t\t\trootMargin: '50px',\n\t\t\t\tthreshold: 0,\n\t\t\t});\n\t\t\tthis.IO.observe(this.options.container);\n\t\t}\n\t}\n\n\tprivate onVisibilityCheck = (entries: Array<IntersectionObserverEntry>) => {\n\t\tentries.forEach((entry) => {\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\tthis.load();\n\t\t\t\tthis.IO?.disconnect();\n\t\t\t\tthis.IO = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\t};\n\n\tdeclare private _augmentSlot: GeneralFunction;\n\tprivate augment = (aug: Augmentation) => {\n\t\tObject.entries(aug).forEach(([key, value]) => {\n\t\t\tthis[key as '_augmentSlot'] = value;\n\t\t});\n\t};\n\n\tload = (options?: { canvas?: JSONCanvas; attachmentDir?: string }) => {\n\t\tif (options) Object.assign(this.options, options);\n\t\tif (this.started) this.onRestart();\n\t\telse {\n\t\t\tthis.onStart();\n\t\t\tthis.started = true;\n\t\t}\n\t};\n\n\tdispose = () => {\n\t\tthis.IO?.disconnect();\n\t\tthis.IO = null;\n\t\tconst container = this.options.container;\n\t\twhile (container.firstChild) container.firstChild.remove();\n\t\tthis.onDispose();\n\t\tthis.container.unbindAll();\n\t};\n}\n\ntype JSONCanvasViewerType = new <M extends ModuleInputCtor = []>(\n\t...args: ConstructorParameters<typeof JSONCanvasViewer<M>>\n) => JSONCanvasViewer<M> & UserAugmentation<M>;\n\nexport type JSONCanvasViewerInterface<M extends ModuleInput = []> = JSONCanvasViewer<[]> &\n\tUserAugmentation<M>;\n\nexport default JSONCanvasViewer as unknown as JSONCanvasViewerType;\n"],"names":["JSONCanvasViewer","allModules","IO","onDispose","utilities","makeHook","onStart","onRestart","started","options","container","constructor","modules","this","Container","DataManager","StyleManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","augment","Module","get","loading","load","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","entries","entry","isIntersecting","disconnect","aug","Object","key","value","assign","dispose","firstChild","remove","unbindAll"],"mappings":"uKAiBA,MAAMA,EACGC,WACAC,GAAkC,KAClCC,UAAYC,EAAUC,UAAS,GAC/BC,QAAUF,EAAUC,WACpBE,UAAYH,EAAUC,WACtBG,SAAU,EAClBC,QACAC,UAEA,WAAAC,CAAYF,EAAyBG,GACpCC,KAAKH,UAAY,IAAII,EACrBD,KAAKJ,QAAUA,EAefI,KAAKZ,WAAa,CACjBc,EACAC,EACAC,EACAC,EACAC,EACAC,KACIR,GAAW,IAEhBC,KAAKZ,WAAWoB,QAvBFC,IACbT,KAAKH,UAAUa,KAAK,CACnBC,QAASF,EACTG,WAAY,IACX,IAAIH,EACHT,KAAKH,UACLG,KAAKJ,QACLI,KAAKP,QACLO,KAAKV,UACLU,KAAKN,UACLM,KAAKa,aAcTb,KAAKZ,WAAWoB,QAASM,IACxBd,KAAKH,UAAUkB,IAAID,KAGpB,MAAME,EAAUhB,KAAKJ,QAAQoB,SAAW,SACxB,WAAZA,EAAsBhB,KAAKiB,OACV,SAAZD,IACRhB,KAAKX,GAAK,IAAI6B,qBAAqBlB,KAAKmB,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZtB,KAAKX,GAAGkC,QAAQvB,KAAKJ,QAAQC,WAE/B,CAEQsB,kBAAqBK,IAC5BA,EAAQhB,QAASiB,IAChB,GAAIA,EAAMC,eAIT,OAHA1B,KAAKiB,OACLjB,KAAKX,IAAIsC,kBACT3B,KAAKX,GAAK,SAOLwB,QAAWe,IAClBC,OAAOL,QAAQI,GAAKpB,QAAQ,EAAEsB,EAAKC,MAClC/B,KAAK8B,GAAyBC,KAIhCd,KAAQrB,IACHA,GAASiC,OAAOG,OAAOhC,KAAKJ,QAASA,GACrCI,KAAKL,QAASK,KAAKN,aAEtBM,KAAKP,UACLO,KAAKL,SAAU,IAIjBsC,QAAU,KACTjC,KAAKX,IAAIsC,aACT3B,KAAKX,GAAK,KACV,MAAMQ,EAAYG,KAAKJ,QAAQC,UAC/B,KAAOA,EAAUqC,YAAYrC,EAAUqC,WAAWC,SAClDnC,KAAKV,YACLU,KAAKH,UAAUuC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t=require("./controller-Bc-S4ZVK.cjs"),i=require("./renderer-BEKV7hr3.cjs"),s=require("@needle-di/core");exports.JSONCanvasViewer=class{allModules;IO=null;onDispose=t.utilities.makeHook(!0);onStart=t.utilities.makeHook();onRestart=t.utilities.makeHook();started=!1;options;container;constructor(e,o){this.container=new s.Container,this.options=e;this.allModules=[t.DataManager,t.StyleManager,t.Controller,i.OverlayManager,i.InteractionHandler,i.Renderer,...o||[]],this.allModules.forEach(t=>{this.container.bind({provide:t,useFactory:()=>new t(this.container,this.options,this.onStart,this.onDispose,this.onRestart,this.augment)})}),this.allModules.forEach(t=>{this.container.get(t)});const n=this.options.loading||"normal";"normal"===n?this.load():"lazy"===n&&(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container))}onVisibilityCheck=t=>{t.forEach(t=>{if(t.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};augment=t=>{Object.entries(t).forEach(([t,i])=>{this[t]=i})};load=t=>{t&&Object.assign(this.options,t),this.started?this.onRestart():(this.onStart(),this.started=!0)};dispose=()=>{this.IO?.disconnect(),this.IO=null;const t=this.options.container;for(;t.firstChild;)t.firstChild.remove();this.onDispose(),this.container.unbindAll()}};
|
|
2
|
+
//# sourceMappingURL=index-DwvIUSbr.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DwvIUSbr.cjs","sources":["../src/core/index.ts"],"sourcesContent":["import type { Augmentation, GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type {\n\tModuleInputCtor,\n\tUserOptions,\n\tUserAugmentation,\n\tGeneralFunction,\n\tModuleInput,\n} from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport StyleManager from '$/styleManager';\nimport utilities from '$/utilities';\nimport { Container } from '@needle-di/core';\n\nclass JSONCanvasViewer<M extends ModuleInputCtor> {\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onDispose = utilities.makeHook(true);\n\tprivate onStart = utilities.makeHook();\n\tprivate onRestart = utilities.makeHook();\n\tprivate started = false;\n\toptions: UserOptions<M>;\n\tcontainer: Container;\n\n\tconstructor(options: UserOptions<M>, modules?: M) {\n\t\tthis.container = new Container();\n\t\tthis.options = options;\n\t\tconst bind = (Class: GeneralModuleCtor) => {\n\t\t\tthis.container.bind({\n\t\t\t\tprovide: Class,\n\t\t\t\tuseFactory: () =>\n\t\t\t\t\tnew Class(\n\t\t\t\t\t\tthis.container,\n\t\t\t\t\t\tthis.options,\n\t\t\t\t\t\tthis.onStart,\n\t\t\t\t\t\tthis.onDispose,\n\t\t\t\t\t\tthis.onRestart,\n\t\t\t\t\t\tthis.augment,\n\t\t\t\t\t),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\n\t\t\tStyleManager,\n\t\t\tController,\n\t\t\tOverlayManager,\n\t\t\tInteractionHandler,\n\t\t\tRenderer,\n\t\t\t...(modules || []),\n\t\t];\n\t\tthis.allModules.forEach(bind);\n\t\tthis.allModules.forEach((Module) => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\n\t\tconst loading = this.options.loading || 'normal';\n\t\tif (loading === 'normal') this.load();\n\t\telse if (loading === 'lazy') {\n\t\t\tthis.IO = new IntersectionObserver(this.onVisibilityCheck, {\n\t\t\t\troot: null,\n\t\t\t\trootMargin: '50px',\n\t\t\t\tthreshold: 0,\n\t\t\t});\n\t\t\tthis.IO.observe(this.options.container);\n\t\t}\n\t}\n\n\tprivate onVisibilityCheck = (entries: Array<IntersectionObserverEntry>) => {\n\t\tentries.forEach((entry) => {\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\tthis.load();\n\t\t\t\tthis.IO?.disconnect();\n\t\t\t\tthis.IO = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\t};\n\n\tdeclare private _augmentSlot: GeneralFunction;\n\tprivate augment = (aug: Augmentation) => {\n\t\tObject.entries(aug).forEach(([key, value]) => {\n\t\t\tthis[key as '_augmentSlot'] = value;\n\t\t});\n\t};\n\n\tload = (options?: { canvas?: JSONCanvas; attachmentDir?: string }) => {\n\t\tif (options) Object.assign(this.options, options);\n\t\tif (this.started) this.onRestart();\n\t\telse {\n\t\t\tthis.onStart();\n\t\t\tthis.started = true;\n\t\t}\n\t};\n\n\tdispose = () => {\n\t\tthis.IO?.disconnect();\n\t\tthis.IO = null;\n\t\tconst container = this.options.container;\n\t\twhile (container.firstChild) container.firstChild.remove();\n\t\tthis.onDispose();\n\t\tthis.container.unbindAll();\n\t};\n}\n\ntype JSONCanvasViewerType = new <M extends ModuleInputCtor = []>(\n\t...args: ConstructorParameters<typeof JSONCanvasViewer<M>>\n) => JSONCanvasViewer<M> & UserAugmentation<M>;\n\nexport type JSONCanvasViewerInterface<M extends ModuleInput = []> = JSONCanvasViewer<[]> &\n\tUserAugmentation<M>;\n\nexport default JSONCanvasViewer as unknown as JSONCanvasViewerType;\n"],"names":["allModules","IO","onDispose","utilities","makeHook","onStart","onRestart","started","options","container","constructor","modules","this","Container","DataManager","StyleManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","augment","Module","get","loading","load","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","entries","entry","isIntersecting","disconnect","aug","Object","key","value","assign","dispose","firstChild","remove","unbindAll"],"mappings":"qJAiBA,MACSA,WACAC,GAAkC,KAClCC,UAAYC,EAAAA,UAAUC,UAAS,GAC/BC,QAAUF,EAAAA,UAAUC,WACpBE,UAAYH,EAAAA,UAAUC,WACtBG,SAAU,EAClBC,QACAC,UAEA,WAAAC,CAAYF,EAAyBG,GACpCC,KAAKH,UAAY,IAAII,YACrBD,KAAKJ,QAAUA,EAefI,KAAKZ,WAAa,CACjBc,EAAAA,YACAC,EAAAA,aACAC,EAAAA,WACAC,EAAAA,eACAC,EAAAA,mBACAC,EAAAA,YACIR,GAAW,IAEhBC,KAAKZ,WAAWoB,QAvBFC,IACbT,KAAKH,UAAUa,KAAK,CACnBC,QAASF,EACTG,WAAY,IACX,IAAIH,EACHT,KAAKH,UACLG,KAAKJ,QACLI,KAAKP,QACLO,KAAKV,UACLU,KAAKN,UACLM,KAAKa,aAcTb,KAAKZ,WAAWoB,QAASM,IACxBd,KAAKH,UAAUkB,IAAID,KAGpB,MAAME,EAAUhB,KAAKJ,QAAQoB,SAAW,SACxB,WAAZA,EAAsBhB,KAAKiB,OACV,SAAZD,IACRhB,KAAKX,GAAK,IAAI6B,qBAAqBlB,KAAKmB,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZtB,KAAKX,GAAGkC,QAAQvB,KAAKJ,QAAQC,WAE/B,CAEQsB,kBAAqBK,IAC5BA,EAAQhB,QAASiB,IAChB,GAAIA,EAAMC,eAIT,OAHA1B,KAAKiB,OACLjB,KAAKX,IAAIsC,kBACT3B,KAAKX,GAAK,SAOLwB,QAAWe,IAClBC,OAAOL,QAAQI,GAAKpB,QAAQ,EAAEsB,EAAKC,MAClC/B,KAAK8B,GAAyBC,KAIhCd,KAAQrB,IACHA,GAASiC,OAAOG,OAAOhC,KAAKJ,QAASA,GACrCI,KAAKL,QAASK,KAAKN,aAEtBM,KAAKP,UACLO,KAAKL,SAAU,IAIjBsC,QAAU,KACTjC,KAAKX,IAAIsC,aACT3B,KAAKX,GAAK,KACV,MAAMQ,EAAYG,KAAKJ,QAAQC,UAC/B,KAAOA,EAAUqC,YAAYrC,EAAUqC,WAAWC,SAClDnC,KAAKV,YACLU,KAAKH,UAAUuC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DwvIUSbr.cjs");exports.JSONCanvasViewer=e.JSONCanvasViewer;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{J as e}from"./index-
|
|
1
|
+
import{J as e}from"./index-DJQyGIFX.js";export{e as JSONCanvasViewer};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/modules.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./controller-CnUlrkdp.cjs"),e='<svg viewBox="-5.28 -5.28 34.56 34.56" fill="none"><path d="M4 9V5.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C4.76 4 5.04 4 5.6 4H9M4 15v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C4.76 20 5.04 20 5.6 20H9m6-16h3.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C20 4.76 20 5.04 20 5.6V9m0 6v3.4c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C19.24 20 18.96 20 18.4 20H15" stroke-width="2.4" stroke-linecap="round"/></svg>';class i extends t.BaseModule{_controlsPanel=null;_toggleCollapseBtn=null;_toggleFullscreenBtn=null;_zoomOutBtn=null;_zoomSlider=null;_zoomInBtn=null;_resetViewBtn=null;DM;collapsed;get controlsPanel(){if(null===this._controlsPanel)throw t.destroyError;return this._controlsPanel}get toggleCollapseBtn(){if(null===this._toggleCollapseBtn)throw t.destroyError;return this._toggleCollapseBtn}get toggleFullscreenBtn(){if(null===this._toggleFullscreenBtn)throw t.destroyError;return this._toggleFullscreenBtn}get zoomOutBtn(){if(null===this._zoomOutBtn)throw t.destroyError;return this._zoomOutBtn}get zoomSlider(){if(null===this._zoomSlider)throw t.destroyError;return this._zoomSlider}get zoomInBtn(){if(null===this._zoomInBtn)throw t.destroyError;return this._zoomInBtn}get resetViewBtn(){if(null===this._resetViewBtn)throw t.destroyError;return this._resetViewBtn}constructor(...i){super(...i),this.collapsed=this.options.controlsCollapsed||!1,this.DM=this.container.get(t.DataManager),this.DM.onToggleFullscreen.subscribe(this.updateFullscreenBtn),this.container.get(t.Controller).hooks.onRefresh.subscribe(this.updateSlider),this._controlsPanel=document.createElement("div"),this._controlsPanel.className="controls",this._controlsPanel.classList.toggle("collapsed",this.collapsed),t.utilities.applyStyles(this._controlsPanel,".collapse-button{border-radius:8px;transition:transform .2s}.collapse-button:hover{background:#444c}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;background-color:#444;width:32px;padding:5px 0}button svg{width:100%;height:100%}.controls{position:absolute;top:10px;right:10px;display:flex;align-items:center;transition:transform .2s;border-radius:8px;gap:10px}.controls.collapsed{transform:translate(calc(100% - 32px))}.controls.collapsed .collapse-button{transform:rotate(180deg)}.controls .controls-content{display:flex;gap:1px;align-items:center;border-radius:8px;overflow:hidden;background:#333c}.controls button:hover{background:#555}.zoom-slider{width:100px;margin:0 10px}"),this._toggleCollapseBtn=document.createElement("button"),this._toggleCollapseBtn.className="collapse-button",this._toggleCollapseBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._controlsPanel.appendChild(this._toggleCollapseBtn);const n=document.createElement("div");n.className="controls-content",this._toggleFullscreenBtn=document.createElement("button"),this._toggleFullscreenBtn.innerHTML=e,n.appendChild(this._toggleFullscreenBtn),this._zoomOutBtn=document.createElement("button"),this._zoomOutBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12" stroke-width="2" stroke-linecap="round" /></svg>',n.appendChild(this._zoomOutBtn),this._zoomSlider=document.createElement("input"),this._zoomSlider.type="range",this._zoomSlider.className="zoom-slider",this._zoomSlider.min="-30",this._zoomSlider.max="30",this._zoomSlider.value="0",n.appendChild(this._zoomSlider),this._zoomInBtn=document.createElement("button"),this._zoomInBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12m-6-6v12" stroke-width="2" stroke-linecap="round" /></svg>',n.appendChild(this._zoomInBtn),this._resetViewBtn=document.createElement("button"),this._resetViewBtn.innerHTML='<svg viewBox="-6 -6 30 30" stroke-width=".08"><path d="m14.955 7.986.116.01a1 1 0 0 1 .85 1.13 8 8 0 0 1-13.374 4.728l-.84.84c-.63.63-1.707.184-1.707-.707V10h3.987c.89 0 1.337 1.077.707 1.707l-.731.731a6 6 0 0 0 8.347-.264 6 6 0 0 0 1.63-3.33 1 1 0 0 1 1.131-.848zM11.514.813a8 8 0 0 1 1.942 1.336l.837-.837c.63-.63 1.707-.184 1.707.707V6h-3.981c-.89 0-1.337-1.077-.707-1.707l.728-.729a6 6 0 0 0-9.98 3.591 1 1 0 1 1-1.98-.281A8 8 0 0 1 11.514.813Z" /></svg>',n.appendChild(this._resetViewBtn),this._controlsPanel.appendChild(n),this.DM.data.container.appendChild(this._controlsPanel),this._toggleCollapseBtn.addEventListener("click",this.toggleCollapse),this._zoomInBtn.addEventListener("click",this.zoomIn),this._zoomOutBtn.addEventListener("click",this.zoomOut),this._zoomSlider.addEventListener("input",this.slide),this._resetViewBtn.addEventListener("click",this.DM.resetView),this._toggleFullscreenBtn.addEventListener("click",this.toggleFullscreen),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.controlsPanel.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateSlider()};zoomIn=()=>this.DM.zoom(1.1,this.DM.middleViewer());zoomOut=()=>this.DM.zoom(1/1.1,this.DM.middleViewer());slide=()=>this.DM.zoomToScale(1.1**Number(this.zoomSlider.value),this.DM.middleViewer());updateFullscreenBtn=t=>{this.toggleFullscreenBtn.innerHTML=t?'<svg viewBox="-40.32 -40.32 176.64 176.64"><path d="M30 60H6a6 6 0 0 0 0 12h18v18a6 6 0 0 0 12 0V66a5.997 5.997 0 0 0-6-6Zm60 0H66a5.997 5.997 0 0 0-6 6v24a6 6 0 0 0 12 0V72h18a6 6 0 0 0 0-12ZM66 36h24a6 6 0 0 0 0-12H72V6a6 6 0 0 0-12 0v24a5.997 5.997 0 0 0 6 6ZM30 0a5.997 5.997 0 0 0-6 6v18H6a6 6 0 0 0 0 12h24a5.997 5.997 0 0 0 6-6V6a5.997 5.997 0 0 0-6-6Z"/></svg>':e};toggleFullscreen=()=>this.DM.shiftFullscreen("toggle");updateSlider=()=>{this.collapsed||(this.zoomSlider.value=String(this.scaleToSlider(this.DM.data.scale)))};scaleToSlider=t=>Math.log(t)/Math.log(1.1);dispose=()=>{this.toggleCollapseBtn.removeEventListener("click",this.toggleCollapse),this.zoomInBtn.removeEventListener("click",this.zoomIn),this.zoomOutBtn.removeEventListener("click",this.zoomOut),this.zoomSlider.removeEventListener("input",this.slide),this.resetViewBtn.removeEventListener("click",this.DM.resetView),this.toggleFullscreenBtn.removeEventListener("click",this.toggleFullscreen),this.controlsPanel.remove(),this._controlsPanel=null,this._toggleCollapseBtn=null,this._zoomInBtn=null,this._zoomOutBtn=null,this._zoomSlider=null,this._resetViewBtn=null,this._toggleFullscreenBtn=null}}class n extends t.BaseModule{_debugPanel=null;DM;get debugPanel(){if(!this._debugPanel)throw t.destroyError;return this._debugPanel}constructor(...e){super(...e),this.DM=this.container.get(t.DataManager),this.container.get(t.Controller).hooks.onRefresh.subscribe(this.update),this._debugPanel=document.createElement("div"),this._debugPanel.className="debug-panel";const i=this.DM.data.container;t.utilities.applyStyles(i,".debug-panel{position:absolute;bottom:12px;left:12px;background:#0006;border-radius:12px;padding:12px;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);color:#fff;font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);pointer-events:none}"),i.appendChild(this._debugPanel),this.onDispose(this.dispose)}update=()=>{const e=t.utilities.round,i=this.DM.data;this.debugPanel.innerHTML=`<p>Scale: ${e(i.scale,3)}</p><p>Offset: ${e(i.offsetX,1)}, ${e(i.offsetY,1)}</p>`};dispose=()=>{this.debugPanel.remove(),this._debugPanel=null}}class o extends t.BaseModule{_minimapCtx=null;_viewportRectangle=null;_minimap=null;_minimapContainer=null;_toggleMinimapBtn=null;minimapCache={scale:1,centerX:0,centerY:0};DM;collapsed;get minimap(){if(null===this._minimap)throw t.destroyError;return this._minimap}get minimapCtx(){if(null===this._minimapCtx)throw t.destroyError;return this._minimapCtx}get viewportRectangle(){if(null===this._viewportRectangle)throw t.destroyError;return this._viewportRectangle}get minimapContainer(){if(null===this._minimapContainer)throw t.destroyError;return this._minimapContainer}get toggleMinimapBtn(){if(null===this._toggleMinimapBtn)throw t.destroyError;return this._toggleMinimapBtn}constructor(...e){super(...e),this.collapsed=this.options.minimapCollapsed||!1,this.container.get(t.Controller).hooks.onRefresh.subscribe(this.updateViewportRectangle),this.DM=this.container.get(t.DataManager),this._minimapContainer=document.createElement("div"),this._minimapContainer.className="minimap-container",t.utilities.applyStyles(this._minimapContainer,".collapse-button{border-radius:8px;transition:transform .2s}.collapse-button:hover{background:#444c}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;background-color:#444;width:32px;padding:5px 0}button svg{width:100%;height:100%}.minimap-container{position:absolute;bottom:10px;right:10px;display:flex;pointer-events:none;transition:transform .2s}.minimap-container.collapsed{transform:translate(calc(100% - 32px))}.toggle-minimap{margin:auto 10px 0 0;pointer-events:auto}.collapsed .toggle-minimap{transform:rotate(180deg)}.minimap{position:relative;width:200px;height:150px;overflow:hidden;border-radius:12px;background:#202020;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);transform-origin:0 0}.minimap .minimap-canvas{width:100%;height:100%}.minimap .viewport-rectangle{position:absolute;top:0;left:0;pointer-events:none;border:2px solid #fff;border-radius:6px;box-sizing:border-box;background:transparent}@container (max-width: 768px){.container .minimap{transform:scale(.6)}.container .toggle-minimap{transform:translateY(-60px)}.collapsed .container .toggle-minimap{transform:translateY(-60px) rotate(180deg)}.container .minimap-container{transform:translateY(60px) translate(80px)}.container .minimap-container.collapsed{transform:translateY(60px) translate(calc(100% - 32px))}}"),this._toggleMinimapBtn=document.createElement("button"),this._toggleMinimapBtn.className="toggle-minimap collapse-button",this._toggleMinimapBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._minimapContainer.appendChild(this._toggleMinimapBtn),this._minimap=document.createElement("div"),this._minimap.className="minimap";const i=document.createElement("canvas");i.className="minimap-canvas",i.width=200,i.height=150,this._minimap.appendChild(i),this._minimapCtx=i.getContext("2d"),this._viewportRectangle=document.createElement("div"),this._viewportRectangle.className="viewport-rectangle",this._minimap.appendChild(this._viewportRectangle),this._minimapContainer.appendChild(this._minimap),this.DM.data.container.appendChild(this._minimapContainer),this._minimapContainer.classList.toggle("collapsed",this.collapsed),this._toggleMinimapBtn.addEventListener("click",this.toggleCollapse),t.utilities.resizeCanvasForDPR(i,i.width,i.height),this.onStart(this.start),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.minimapContainer.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateViewportRectangle()};start=()=>{const t=this.DM.data.nodeBounds;if(!t)return;const e=this.minimap.clientWidth,i=this.minimap.clientHeight,n=e/t.width,o=i/t.height;this.minimapCache.scale=.9*Math.min(n,o),this.minimapCache.centerX=e/2,this.minimapCache.centerY=i/2,this.minimapCtx.clearRect(0,0,e,i),this.minimapCtx.save(),this.minimapCtx.translate(this.minimapCache.centerX,this.minimapCache.centerY),this.minimapCtx.scale(this.minimapCache.scale,this.minimapCache.scale),this.minimapCtx.translate(-t.centerX,-t.centerY);const s=this.DM.data.canvasData;for(const r of s.edges)this.drawMinimapEdge(r);for(const r of s.nodes)this.drawMinimapNode(r);this.minimapCtx.restore()};drawMinimapNode=e=>{const i=t.utilities.getColor(e.color);this.minimapCtx.fillStyle=i.border,this.minimapCtx.globalAlpha=.3,t.utilities.drawRoundRect(this.minimapCtx,e.x,e.y,e.width,e.height,25),this.minimapCtx.fill(),this.minimapCtx.globalAlpha=1};drawMinimapEdge=e=>{const i=this.DM.data.canvasMap,n=i[e.fromNode].ref,o=i[e.toNode].ref;if(!n||!o)return;const[s,r]=t.utilities.getAnchorCoord(n,e.fromSide),[a,l]=t.utilities.getAnchorCoord(o,e.toSide);this.minimapCtx.beginPath(),this.minimapCtx.moveTo(s,r),this.minimapCtx.lineTo(a,l),this.minimapCtx.strokeStyle="#555",this.minimapCtx.lineWidth=10,this.minimapCtx.stroke()};updateViewportRectangle=()=>{if(this.collapsed)return;const t=this.DM.data.nodeBounds,e=this.DM.data.container,i=this.DM.data.scale;if(!t)return;const n=e.clientWidth/i,o=e.clientHeight/i,s=-this.DM.data.offsetX/i+e.clientWidth/(2*i),r=-this.DM.data.offsetY/i+e.clientHeight/(2*i),a=this.minimapCache.centerX+(s-n/2-t.centerX)*this.minimapCache.scale,l=this.minimapCache.centerY+(r-o/2-t.centerY)*this.minimapCache.scale,h=n*this.minimapCache.scale,p=o*this.minimapCache.scale;this.viewportRectangle.style.left=`${a}px`,this.viewportRectangle.style.top=`${l}px`,this.viewportRectangle.style.width=`${h}px`,this.viewportRectangle.style.height=`${p}px`};dispose=()=>{this.toggleMinimapBtn.removeEventListener("click",this.toggleCollapse),this.minimapCtx.clearRect(0,0,this.minimap.clientWidth,this.minimap.clientHeight),this.minimapContainer.remove(),this._minimapContainer=null,this._toggleMinimapBtn=null,this._viewportRectangle=null,this._minimap=null}}class s extends t.BaseModule{_preventionContainer=null;preventMt=!1;DM;preventMistouch={record:!1,lastX:0,lastY:0,initialX:0,initialY:0};get preventionContainer(){if(null===this._preventionContainer)throw t.destroyError;return this._preventionContainer}constructor(...e){super(...e);const i=Object.assign({preventAtStart:!0,labelText:"Click on to unlock."},this.options.mistouchPreventer||{}),n=document.createElement("div");n.className="prevention-banner",n.textContent=i.labelText,this.DM=this.container.get(t.DataManager),this._preventionContainer=document.createElement("div"),this._preventionContainer.className="prevention-container hidden",t.utilities.applyStyles(this._preventionContainer,".full,.prevention-container{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.prevention-container{display:flex;justify-content:center;align-items:center}.prevention-container{overflow:visible;transition:background .2s,opacity .2s,box-shadow .2s,border .2s,filter .2s,backdrop-filter .2s}.prevention-container.hidden{pointer-events:none;opacity:0}.prevention-container .prevention-banner{background:#0006;border-radius:12px;padding:12px;margin:12px;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);color:#fff;font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);text-align:center}"),this._preventionContainer.appendChild(n),this.DM.data.container.appendChild(this._preventionContainer),i.preventAtStart&&this.startPrevention(),window.addEventListener("pointerdown",this.onPointerDown),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),this.onDispose(this.dispose)}onPointerDown=t=>{const e=this.DM.data.container.getBoundingClientRect();t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom?this.preventMt||this.startPrevention():this.preventMt&&(this.preventMistouch.initialX=t.clientX,this.preventMistouch.initialY=t.clientY,this.preventMistouch.lastX=t.clientX,this.preventMistouch.lastY=t.clientY,this.preventMistouch.record=!0)};onPointerMove=t=>{this.preventMistouch.record&&(this.preventMistouch.lastX=t.clientX,this.preventMistouch.lastY=t.clientY)};onPointerUp=()=>{this.preventMistouch.record&&(this.preventMistouch.record=!1,Math.abs(this.preventMistouch.lastX-this.preventMistouch.initialX)+Math.abs(this.preventMistouch.lastY-this.preventMistouch.initialY)<5&&this.endPrevention())};startPrevention=()=>{this.preventionContainer.classList.remove("hidden"),this.DM.data.container.classList.add("numb"),this.preventMt=!0};endPrevention=()=>{this.preventMt=!1,this.preventionContainer.classList.add("hidden"),setTimeout(()=>this.DM.data.container.classList.remove("numb"),50)};dispose=()=>{window.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this.preventionContainer.remove(),this._preventionContainer=null}}exports.Controls=i,exports.DebugPanel=n,exports.Minimap=o,exports.MistouchPreventer=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./controller-Bc-S4ZVK.cjs"),e='<svg viewBox="-5.28 -5.28 34.56 34.56" fill="none"><path d="M4 9V5.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C4.76 4 5.04 4 5.6 4H9M4 15v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C4.76 20 5.04 20 5.6 20H9m6-16h3.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C20 4.76 20 5.04 20 5.6V9m0 6v3.4c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C19.24 20 18.96 20 18.4 20H15" stroke-width="2.4" stroke-linecap="round"/></svg>';class i extends t.BaseModule{_controlsPanel=null;_toggleCollapseBtn=null;_toggleFullscreenBtn=null;_zoomOutBtn=null;_zoomSlider=null;_zoomInBtn=null;_resetViewBtn=null;DM;collapsed;get controlsPanel(){if(null===this._controlsPanel)throw t.destroyError;return this._controlsPanel}get toggleCollapseBtn(){if(null===this._toggleCollapseBtn)throw t.destroyError;return this._toggleCollapseBtn}get toggleFullscreenBtn(){if(null===this._toggleFullscreenBtn)throw t.destroyError;return this._toggleFullscreenBtn}get zoomOutBtn(){if(null===this._zoomOutBtn)throw t.destroyError;return this._zoomOutBtn}get zoomSlider(){if(null===this._zoomSlider)throw t.destroyError;return this._zoomSlider}get zoomInBtn(){if(null===this._zoomInBtn)throw t.destroyError;return this._zoomInBtn}get resetViewBtn(){if(null===this._resetViewBtn)throw t.destroyError;return this._resetViewBtn}constructor(...i){super(...i),this.collapsed=this.options.controlsCollapsed||!1,this.DM=this.container.get(t.DataManager),this.DM.onToggleFullscreen.subscribe(this.updateFullscreenBtn),this.container.get(t.Controller).hooks.onRefresh.subscribe(this.updateSlider),this._controlsPanel=document.createElement("div"),this._controlsPanel.className="controls",this._controlsPanel.classList.toggle("collapsed",this.collapsed),t.utilities.applyStyles(this._controlsPanel,".controls{position:absolute;top:10px;right:10px;display:flex;align-items:center;transition:transform .2s;border-radius:8px;gap:10px}.controls.collapsed{transform:translate(calc(100% - 32px))}.controls.collapsed .collapse-button{transform:rotate(180deg)}.controls .controls-content{display:flex;gap:1px;align-items:center;border-radius:8px;overflow:hidden;background:var(--border);box-shadow:var(--shadow);outline:1px solid var(--border)}.controls button{background-color:var(--background-secondary)}.controls button:hover{background:var(--border)}.zoom-slider{width:100px;margin:0 10px}"),this._toggleCollapseBtn=document.createElement("button"),this._toggleCollapseBtn.className="collapse-button border-shadow-bg",this._toggleCollapseBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._controlsPanel.appendChild(this._toggleCollapseBtn);const n=document.createElement("div");n.className="controls-content",this._toggleFullscreenBtn=document.createElement("button"),this._toggleFullscreenBtn.innerHTML=e,n.appendChild(this._toggleFullscreenBtn),this._zoomOutBtn=document.createElement("button"),this._zoomOutBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12" stroke-width="2" stroke-linecap="round" /></svg>',n.appendChild(this._zoomOutBtn),this._zoomSlider=document.createElement("input"),this._zoomSlider.type="range",this._zoomSlider.className="zoom-slider",this._zoomSlider.min="-30",this._zoomSlider.max="30",this._zoomSlider.value="0",n.appendChild(this._zoomSlider),this._zoomInBtn=document.createElement("button"),this._zoomInBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12m-6-6v12" stroke-width="2" stroke-linecap="round" /></svg>',n.appendChild(this._zoomInBtn),this._resetViewBtn=document.createElement("button"),this._resetViewBtn.innerHTML='<svg viewBox="-6 -6 30 30" stroke-width=".08"><path d="m14.955 7.986.116.01a1 1 0 0 1 .85 1.13 8 8 0 0 1-13.374 4.728l-.84.84c-.63.63-1.707.184-1.707-.707V10h3.987c.89 0 1.337 1.077.707 1.707l-.731.731a6 6 0 0 0 8.347-.264 6 6 0 0 0 1.63-3.33 1 1 0 0 1 1.131-.848zM11.514.813a8 8 0 0 1 1.942 1.336l.837-.837c.63-.63 1.707-.184 1.707.707V6h-3.981c-.89 0-1.337-1.077-.707-1.707l.728-.729a6 6 0 0 0-9.98 3.591 1 1 0 1 1-1.98-.281A8 8 0 0 1 11.514.813Z" /></svg>',n.appendChild(this._resetViewBtn),this._controlsPanel.appendChild(n),this.DM.data.container.appendChild(this._controlsPanel),this._toggleCollapseBtn.addEventListener("click",this.toggleCollapse),this._zoomInBtn.addEventListener("click",this.zoomIn),this._zoomOutBtn.addEventListener("click",this.zoomOut),this._zoomSlider.addEventListener("input",this.slide),this._resetViewBtn.addEventListener("click",this.DM.resetView),this._toggleFullscreenBtn.addEventListener("click",this.toggleFullscreen),this.augment({toggleControlsCollapse:this.toggleCollapse}),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.controlsPanel.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateSlider()};zoomIn=()=>this.DM.zoom(1.1,this.DM.middleViewer());zoomOut=()=>this.DM.zoom(1/1.1,this.DM.middleViewer());slide=()=>this.DM.zoomToScale(1.1**Number(this.zoomSlider.value),this.DM.middleViewer());updateFullscreenBtn=t=>{this.toggleFullscreenBtn.innerHTML=t?'<svg viewBox="-40.32 -40.32 176.64 176.64"><path d="M30 60H6a6 6 0 0 0 0 12h18v18a6 6 0 0 0 12 0V66a5.997 5.997 0 0 0-6-6Zm60 0H66a5.997 5.997 0 0 0-6 6v24a6 6 0 0 0 12 0V72h18a6 6 0 0 0 0-12ZM66 36h24a6 6 0 0 0 0-12H72V6a6 6 0 0 0-12 0v24a5.997 5.997 0 0 0 6 6ZM30 0a5.997 5.997 0 0 0-6 6v18H6a6 6 0 0 0 0 12h24a5.997 5.997 0 0 0 6-6V6a5.997 5.997 0 0 0-6-6Z"/></svg>':e};toggleFullscreen=()=>this.DM.shiftFullscreen();updateSlider=()=>{this.collapsed||(this.zoomSlider.value=String(this.scaleToSlider(this.DM.data.scale)))};scaleToSlider=t=>Math.log(t)/Math.log(1.1);dispose=()=>{this.toggleCollapseBtn.removeEventListener("click",this.toggleCollapse),this.zoomInBtn.removeEventListener("click",this.zoomIn),this.zoomOutBtn.removeEventListener("click",this.zoomOut),this.zoomSlider.removeEventListener("input",this.slide),this.resetViewBtn.removeEventListener("click",this.DM.resetView),this.toggleFullscreenBtn.removeEventListener("click",this.toggleFullscreen),this.controlsPanel.remove(),this._controlsPanel=null,this._toggleCollapseBtn=null,this._zoomInBtn=null,this._zoomOutBtn=null,this._zoomSlider=null,this._resetViewBtn=null,this._toggleFullscreenBtn=null}}class n extends t.BaseModule{_debugPanel=null;DM;get debugPanel(){if(!this._debugPanel)throw t.destroyError;return this._debugPanel}constructor(...e){super(...e),this.DM=this.container.get(t.DataManager),this.container.get(t.Controller).hooks.onRefresh.subscribe(this.update),this._debugPanel=document.createElement("div"),this._debugPanel.className="debug-panel border-shadow-bg";const i=this.DM.data.container;t.utilities.applyStyles(i,".debug-panel{position:absolute;bottom:12px;left:12px;border-radius:12px;padding:12px;color:var(--text);font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);pointer-events:none}"),i.appendChild(this._debugPanel),this.onDispose(this.dispose)}update=()=>{const e=t.utilities.round,i=this.DM.data;this.debugPanel.innerHTML=`<p>Scale: ${e(i.scale,3)}</p><p>Offset: ${e(i.offsetX,1)}, ${e(i.offsetY,1)}</p>`};dispose=()=>{this.debugPanel.remove(),this._debugPanel=null}}class o extends t.BaseModule{_minimapCtx=null;_viewportRectangle=null;_minimap=null;_minimapContainer=null;_toggleMinimapBtn=null;minimapCache={scale:1,centerX:0,centerY:0};DM;SM;collapsed;get minimap(){if(null===this._minimap)throw t.destroyError;return this._minimap}get minimapCtx(){if(null===this._minimapCtx)throw t.destroyError;return this._minimapCtx}get viewportRectangle(){if(null===this._viewportRectangle)throw t.destroyError;return this._viewportRectangle}get minimapContainer(){if(null===this._minimapContainer)throw t.destroyError;return this._minimapContainer}get toggleMinimapBtn(){if(null===this._toggleMinimapBtn)throw t.destroyError;return this._toggleMinimapBtn}constructor(...e){super(...e),this.collapsed=this.options.minimapCollapsed||!1,this.container.get(t.Controller).hooks.onRefresh.subscribe(this.updateViewportRectangle),this.DM=this.container.get(t.DataManager),this.SM=this.container.get(t.StyleManager),this._minimapContainer=document.createElement("div"),this._minimapContainer.className="minimap-container",t.utilities.applyStyles(this._minimapContainer,".minimap-container{position:absolute;bottom:10px;right:10px;display:flex;pointer-events:none;transition:transform .2s}.minimap-container.collapsed{transform:translate(calc(100% - 32px))}.toggle-minimap{margin:auto 10px 0 0;pointer-events:auto}.collapsed .toggle-minimap{transform:rotate(180deg)}.minimap{position:relative;pointer-events:none;width:200px;height:150px;overflow:hidden;border-radius:12px;transform-origin:0 0}.minimap .minimap-canvas{width:100%;height:100%}.minimap .viewport-rectangle{position:absolute;top:0;left:0;pointer-events:none;border-radius:6px;box-sizing:border-box;border:2px dashed var(--text)}@container (max-width: 768px){.container .minimap{transform:scale(.6)}.container .toggle-minimap{transform:translateY(-60px)}.collapsed .container .toggle-minimap{transform:translateY(-60px) rotate(180deg)}.container .minimap-container{transform:translateY(60px) translate(80px)}.container .minimap-container.collapsed{transform:translateY(60px) translate(calc(100% - 32px))}}"),this._toggleMinimapBtn=document.createElement("button"),this._toggleMinimapBtn.className="toggle-minimap collapse-button border-shadow-bg",this._toggleMinimapBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._minimapContainer.appendChild(this._toggleMinimapBtn),this._minimap=document.createElement("div"),this._minimap.className="minimap border-shadow-bg";const i=document.createElement("canvas");i.className="minimap-canvas",i.width=200,i.height=150,this._minimap.appendChild(i),this._minimapCtx=i.getContext("2d"),this._viewportRectangle=document.createElement("div"),this._viewportRectangle.className="viewport-rectangle",this._minimap.appendChild(this._viewportRectangle),this._minimapContainer.appendChild(this._minimap),this.DM.data.container.appendChild(this._minimapContainer),this._minimapContainer.classList.toggle("collapsed",this.collapsed),this._toggleMinimapBtn.addEventListener("click",this.toggleCollapse),t.utilities.resizeCanvasForDPR(i,i.width,i.height),this.augment({toggleMinimapCollapse:this.toggleCollapse}),this.onStart(this.start),this.onRestart(this.start),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.minimapContainer.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateViewportRectangle()};start=()=>{const t=this.DM.data.nodeBounds;if(!t)return;const e=this.minimap.clientWidth,i=this.minimap.clientHeight,n=e/t.width,o=i/t.height;this.minimapCache.scale=.9*Math.min(n,o),this.minimapCache.centerX=e/2,this.minimapCache.centerY=i/2,this.minimapCtx.clearRect(0,0,e,i),this.minimapCtx.save(),this.minimapCtx.translate(this.minimapCache.centerX,this.minimapCache.centerY),this.minimapCtx.scale(this.minimapCache.scale,this.minimapCache.scale),this.minimapCtx.translate(-t.centerX,-t.centerY);const s=this.DM.data.canvasData;for(const r of s.edges)this.drawMinimapEdge(r);for(const r of s.nodes)this.drawMinimapNode(r);this.minimapCtx.restore()};drawMinimapNode=e=>{const i=this.SM.getColor(e.color);this.minimapCtx.fillStyle=i.border,t.utilities.drawRoundRect(this.minimapCtx,e.x,e.y,e.width,e.height,25),this.minimapCtx.fill()};drawMinimapEdge=e=>{const i=this.DM.data.nodeMap,n=i[e.fromNode].ref,o=i[e.toNode].ref;if(!n||!o)return;const{x:s,y:r}=t.utilities.getAnchorCoord(n,e.fromSide),{x:a,y:l}=t.utilities.getAnchorCoord(o,e.toSide);this.minimapCtx.beginPath(),this.minimapCtx.moveTo(s,r),this.minimapCtx.lineTo(a,l),this.minimapCtx.strokeStyle=this.SM.getColor(e.color).active,this.minimapCtx.lineWidth=10,this.minimapCtx.stroke()};updateViewportRectangle=()=>{if(this.collapsed)return;const t=this.DM.data.nodeBounds,e=this.DM.data.container,i=this.DM.data.scale;if(!t)return;const n=e.clientWidth/i,o=e.clientHeight/i,s=-this.DM.data.offsetX/i+e.clientWidth/(2*i),r=-this.DM.data.offsetY/i+e.clientHeight/(2*i),a=this.minimapCache.centerX+(s-n/2-t.centerX)*this.minimapCache.scale,l=this.minimapCache.centerY+(r-o/2-t.centerY)*this.minimapCache.scale,h=n*this.minimapCache.scale,p=o*this.minimapCache.scale;this.viewportRectangle.style.left=`${a}px`,this.viewportRectangle.style.top=`${l}px`,this.viewportRectangle.style.width=`${h}px`,this.viewportRectangle.style.height=`${p}px`};dispose=()=>{this.toggleMinimapBtn.removeEventListener("click",this.toggleCollapse),this.minimapCtx.clearRect(0,0,this.minimap.clientWidth,this.minimap.clientHeight),this.minimapContainer.remove(),this._minimapContainer=null,this._toggleMinimapBtn=null,this._viewportRectangle=null,this._minimap=null}}class s extends t.BaseModule{_preventionContainer=null;preventMt=!1;DM;preventMistouch={record:!1,lastX:0,lastY:0,initialX:0,initialY:0};get preventionContainer(){if(null===this._preventionContainer)throw t.destroyError;return this._preventionContainer}constructor(...e){super(...e);const i=document.createElement("div");i.className="prevention-banner border-shadow-bg",i.textContent=this.options.mistouchPreventerBannerText||"Click on to unlock.",this.DM=this.container.get(t.DataManager),this._preventionContainer=document.createElement("div"),this._preventionContainer.className="prevention-container hidden",t.utilities.applyStyles(this._preventionContainer,".full,.prevention-container{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.prevention-container{display:flex;justify-content:center;align-items:center}.prevention-container{overflow:visible;transition:background .2s,opacity .2s,box-shadow .2s,border .2s,filter .2s,backdrop-filter .2s}.prevention-container.hidden{pointer-events:none;opacity:0}.prevention-container .prevention-banner{border-radius:12px;padding:12px;margin:12px;font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);text-align:center}"),this._preventionContainer.appendChild(i),this.DM.data.container.appendChild(this._preventionContainer),this.options.preventMistouchAtStart&&this.startPrevention(),window.addEventListener("pointerdown",this.onPointerDown),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),this.augment({startMistouchPrevention:this.startPrevention,endMistouchPrevention:this.endPrevention}),this.onDispose(this.dispose)}onPointerDown=t=>{const e=this.DM.data.container.getBoundingClientRect();t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom?this.preventMt||this.startPrevention():this.preventMt&&(this.preventMistouch.initialX=t.clientX,this.preventMistouch.initialY=t.clientY,this.preventMistouch.lastX=t.clientX,this.preventMistouch.lastY=t.clientY,this.preventMistouch.record=!0)};onPointerMove=t=>{this.preventMistouch.record&&(this.preventMistouch.lastX=t.clientX,this.preventMistouch.lastY=t.clientY)};onPointerUp=()=>{this.preventMistouch.record&&(this.preventMistouch.record=!1,Math.abs(this.preventMistouch.lastX-this.preventMistouch.initialX)+Math.abs(this.preventMistouch.lastY-this.preventMistouch.initialY)<5&&this.endPrevention())};startPrevention=()=>{this.preventionContainer.classList.remove("hidden"),this.DM.data.container.classList.add("numb"),this.preventMt=!0};endPrevention=()=>{this.preventMt=!1,this.preventionContainer.classList.add("hidden"),setTimeout(()=>this.DM.data.container.classList.remove("numb"),50)};dispose=()=>{window.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this.preventionContainer.remove(),this._preventionContainer=null}}exports.Controls=i,exports.DebugPanel=n,exports.Minimap=o,exports.MistouchPreventer=s;
|
|
2
2
|
//# sourceMappingURL=modules.cjs.map
|
package/dist/modules.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.cjs","sources":["../src/modules/controls/index.ts","../src/modules/debugPanel/index.ts","../src/modules/minimap/index.ts","../src/modules/mistouchPreventer/index.ts"],"sourcesContent":["import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tcontrolsCollapsed?: boolean;\n};\n\nconst resetIcon =\n\t'<svg viewBox=\"-6 -6 30 30\" stroke-width=\".08\"><path d=\"m14.955 7.986.116.01a1 1 0 0 1 .85 1.13 8 8 0 0 1-13.374 4.728l-.84.84c-.63.63-1.707.184-1.707-.707V10h3.987c.89 0 1.337 1.077.707 1.707l-.731.731a6 6 0 0 0 8.347-.264 6 6 0 0 0 1.63-3.33 1 1 0 0 1 1.131-.848zM11.514.813a8 8 0 0 1 1.942 1.336l.837-.837c.63-.63 1.707-.184 1.707.707V6h-3.981c-.89 0-1.337-1.077-.707-1.707l.728-.729a6 6 0 0 0-9.98 3.591 1 1 0 1 1-1.98-.281A8 8 0 0 1 11.514.813Z\" /></svg>';\nconst enterFullscreenIcon =\n\t'<svg viewBox=\"-5.28 -5.28 34.56 34.56\" fill=\"none\"><path d=\"M4 9V5.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C4.76 4 5.04 4 5.6 4H9M4 15v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C4.76 20 5.04 20 5.6 20H9m6-16h3.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C20 4.76 20 5.04 20 5.6V9m0 6v3.4c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C19.24 20 18.96 20 18.4 20H15\" stroke-width=\"2.4\" stroke-linecap=\"round\"/></svg>';\nconst exitFullscreenIcon =\n\t'<svg viewBox=\"-40.32 -40.32 176.64 176.64\"><path d=\"M30 60H6a6 6 0 0 0 0 12h18v18a6 6 0 0 0 12 0V66a5.997 5.997 0 0 0-6-6Zm60 0H66a5.997 5.997 0 0 0-6 6v24a6 6 0 0 0 12 0V72h18a6 6 0 0 0 0-12ZM66 36h24a6 6 0 0 0 0-12H72V6a6 6 0 0 0-12 0v24a5.997 5.997 0 0 0 6 6ZM30 0a5.997 5.997 0 0 0-6 6v18H6a6 6 0 0 0 0 12h24a5.997 5.997 0 0 0 6-6V6a5.997 5.997 0 0 0-6-6Z\"/></svg>';\nconst zoomInIcon =\n\t'<svg viewBox=\"-1.2 -1.2 26.4 26.4\"><path d=\"M6 12h12m-6-6v12\" stroke-width=\"2\" stroke-linecap=\"round\" /></svg>';\nconst zoomOutIcon =\n\t'<svg viewBox=\"-1.2 -1.2 26.4 26.4\"><path d=\"M6 12h12\" stroke-width=\"2\" stroke-linecap=\"round\" /></svg>';\nconst toggleCollapseIcon =\n\t'<svg viewBox=\"-3.6 -3.6 31.2 31.2\" stroke-width=\".4\"><path d=\"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z\" /></svg>';\n\nexport default class Controls extends BaseModule<Options> {\n\tprivate _controlsPanel: HTMLDivElement | null = null;\n\tprivate _toggleCollapseBtn: HTMLButtonElement | null = null;\n\tprivate _toggleFullscreenBtn: HTMLButtonElement | null = null;\n\tprivate _zoomOutBtn: HTMLButtonElement | null = null;\n\tprivate _zoomSlider: HTMLInputElement | null = null;\n\tprivate _zoomInBtn: HTMLButtonElement | null = null;\n\tprivate _resetViewBtn: HTMLButtonElement | null = null;\n\tprivate DM: DataManager;\n\tprivate collapsed: boolean;\n\n\tprivate get controlsPanel() {\n\t\tif (this._controlsPanel === null) throw destroyError;\n\t\treturn this._controlsPanel;\n\t}\n\tprivate get toggleCollapseBtn() {\n\t\tif (this._toggleCollapseBtn === null) throw destroyError;\n\t\treturn this._toggleCollapseBtn;\n\t}\n\tprivate get toggleFullscreenBtn() {\n\t\tif (this._toggleFullscreenBtn === null) throw destroyError;\n\t\treturn this._toggleFullscreenBtn;\n\t}\n\tprivate get zoomOutBtn() {\n\t\tif (this._zoomOutBtn === null) throw destroyError;\n\t\treturn this._zoomOutBtn;\n\t}\n\tprivate get zoomSlider() {\n\t\tif (this._zoomSlider === null) throw destroyError;\n\t\treturn this._zoomSlider;\n\t}\n\tprivate get zoomInBtn() {\n\t\tif (this._zoomInBtn === null) throw destroyError;\n\t\treturn this._zoomInBtn;\n\t}\n\tprivate get resetViewBtn() {\n\t\tif (this._resetViewBtn === null) throw destroyError;\n\t\treturn this._resetViewBtn;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.collapsed = this.options.controlsCollapsed || false;\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.DM.onToggleFullscreen.subscribe(this.updateFullscreenBtn);\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.updateSlider);\n\n\t\tthis._controlsPanel = document.createElement('div');\n\t\tthis._controlsPanel.className = 'controls';\n\t\tthis._controlsPanel.classList.toggle('collapsed', this.collapsed);\n\n\t\tutilities.applyStyles(this._controlsPanel, style);\n\n\t\tthis._toggleCollapseBtn = document.createElement('button');\n\t\tthis._toggleCollapseBtn.className = 'collapse-button';\n\t\tthis._toggleCollapseBtn.innerHTML = toggleCollapseIcon;\n\t\tthis._controlsPanel.appendChild(this._toggleCollapseBtn);\n\n\t\tconst controlsContent = document.createElement('div');\n\t\tcontrolsContent.className = 'controls-content';\n\n\t\tthis._toggleFullscreenBtn = document.createElement('button');\n\t\tthis._toggleFullscreenBtn.innerHTML = enterFullscreenIcon;\n\t\tcontrolsContent.appendChild(this._toggleFullscreenBtn);\n\n\t\tthis._zoomOutBtn = document.createElement('button');\n\t\tthis._zoomOutBtn.innerHTML = zoomOutIcon;\n\t\tcontrolsContent.appendChild(this._zoomOutBtn);\n\n\t\tthis._zoomSlider = document.createElement('input');\n\t\tthis._zoomSlider.type = 'range';\n\t\tthis._zoomSlider.className = 'zoom-slider';\n\t\tthis._zoomSlider.min = '-30';\n\t\tthis._zoomSlider.max = '30';\n\t\tthis._zoomSlider.value = '0';\n\t\tcontrolsContent.appendChild(this._zoomSlider);\n\n\t\tthis._zoomInBtn = document.createElement('button');\n\t\tthis._zoomInBtn.innerHTML = zoomInIcon;\n\t\tcontrolsContent.appendChild(this._zoomInBtn);\n\n\t\tthis._resetViewBtn = document.createElement('button');\n\t\tthis._resetViewBtn.innerHTML = resetIcon;\n\t\tcontrolsContent.appendChild(this._resetViewBtn);\n\n\t\tthis._controlsPanel.appendChild(controlsContent);\n\n\t\tthis.DM.data.container.appendChild(this._controlsPanel);\n\n\t\tthis._toggleCollapseBtn.addEventListener('click', this.toggleCollapse);\n\t\tthis._zoomInBtn.addEventListener('click', this.zoomIn);\n\t\tthis._zoomOutBtn.addEventListener('click', this.zoomOut);\n\t\tthis._zoomSlider.addEventListener('input', this.slide);\n\t\tthis._resetViewBtn.addEventListener('click', this.DM.resetView);\n\t\tthis._toggleFullscreenBtn.addEventListener('click', this.toggleFullscreen);\n\n\t\tthis.onDispose(this.dispose);\n\t}\n\ttoggleCollapse = () => {\n\t\tthis.collapsed = !this.collapsed;\n\t\tthis.controlsPanel.classList.toggle('collapsed', this.collapsed);\n\t\tif (!this.collapsed) this.updateSlider();\n\t};\n\tprivate zoomIn = () => this.DM.zoom(1.1, this.DM.middleViewer());\n\tprivate zoomOut = () => this.DM.zoom(1 / 1.1, this.DM.middleViewer());\n\tprivate slide = () => this.DM.zoomToScale(1.1 ** Number(this.zoomSlider.value), this.DM.middleViewer());\n\n\tprivate updateFullscreenBtn = (enter: boolean) => {\n\t\tif (enter) this.toggleFullscreenBtn.innerHTML = exitFullscreenIcon;\n\t\telse this.toggleFullscreenBtn.innerHTML = enterFullscreenIcon;\n\t};\n\tprivate toggleFullscreen = () => this.DM.shiftFullscreen('toggle');\n\n\tprivate updateSlider = () => {\n\t\tif (this.collapsed) return;\n\t\tthis.zoomSlider.value = String(this.scaleToSlider(this.DM.data.scale));\n\t};\n\tprivate scaleToSlider = (scale: number) => Math.log(scale) / Math.log(1.1);\n\n\tprivate dispose = () => {\n\t\tthis.toggleCollapseBtn.removeEventListener('click', this.toggleCollapse);\n\t\tthis.zoomInBtn.removeEventListener('click', this.zoomIn);\n\t\tthis.zoomOutBtn.removeEventListener('click', this.zoomOut);\n\t\tthis.zoomSlider.removeEventListener('input', this.slide);\n\t\tthis.resetViewBtn.removeEventListener('click', this.DM.resetView);\n\t\tthis.toggleFullscreenBtn.removeEventListener('click', this.toggleFullscreen);\n\t\tthis.controlsPanel.remove();\n\t\tthis._controlsPanel = null;\n\t\tthis._toggleCollapseBtn = null;\n\t\tthis._zoomInBtn = null;\n\t\tthis._zoomOutBtn = null;\n\t\tthis._zoomSlider = null;\n\t\tthis._resetViewBtn = null;\n\t\tthis._toggleFullscreenBtn = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\nimport style from './styles.scss?inline';\n\nexport default class DebugPanel extends BaseModule {\n\tprivate _debugPanel: HTMLDivElement | null = null;\n\tprivate DM: DataManager;\n\n\tprivate get debugPanel() {\n\t\tif (!this._debugPanel) throw destroyError;\n\t\treturn this._debugPanel;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.update);\n\t\tthis._debugPanel = document.createElement('div');\n\t\tthis._debugPanel.className = 'debug-panel';\n\t\tconst HTMLContainer = this.DM.data.container;\n\t\tutilities.applyStyles(HTMLContainer, style);\n\t\tHTMLContainer.appendChild(this._debugPanel);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate update = () => {\n\t\tconst round = utilities.round;\n\t\tconst data = this.DM.data;\n\t\tthis.debugPanel.innerHTML = `<p>Scale: ${round(data.scale, 3)}</p><p>Offset: ${round(data.offsetX, 1)}, ${round(data.offsetY, 1)}</p>`;\n\t};\n\n\tprivate dispose = () => {\n\t\tthis.debugPanel.remove();\n\t\tthis._debugPanel = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tminimapCollapsed?: boolean;\n};\n\nconst toggleCollapseIcon =\n\t'<svg viewBox=\"-3.6 -3.6 31.2 31.2\" stroke-width=\".4\"><path d=\"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z\" /></svg>';\n\nexport default class Minimap extends BaseModule<Options> {\n\tprivate _minimapCtx: CanvasRenderingContext2D | null = null;\n\tprivate _viewportRectangle: HTMLDivElement | null = null;\n\tprivate _minimap: HTMLDivElement | null = null;\n\tprivate _minimapContainer: HTMLDivElement | null = null;\n\tprivate _toggleMinimapBtn: HTMLButtonElement | null = null;\n\tprivate minimapCache: { scale: number; centerX: number; centerY: number } = {\n\t\tscale: 1,\n\t\tcenterX: 0,\n\t\tcenterY: 0,\n\t};\n\tprivate DM: DataManager;\n\tprivate collapsed: boolean;\n\n\tprivate get minimap() {\n\t\tif (this._minimap === null) throw destroyError;\n\t\treturn this._minimap;\n\t}\n\tprivate get minimapCtx() {\n\t\tif (this._minimapCtx === null) throw destroyError;\n\t\treturn this._minimapCtx;\n\t}\n\tprivate get viewportRectangle() {\n\t\tif (this._viewportRectangle === null) throw destroyError;\n\t\treturn this._viewportRectangle;\n\t}\n\tprivate get minimapContainer() {\n\t\tif (this._minimapContainer === null) throw destroyError;\n\t\treturn this._minimapContainer;\n\t}\n\tprivate get toggleMinimapBtn() {\n\t\tif (this._toggleMinimapBtn === null) throw destroyError;\n\t\treturn this._toggleMinimapBtn;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.collapsed = this.options.minimapCollapsed || false;\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.updateViewportRectangle);\n\t\tthis.DM = this.container.get(DataManager);\n\n\t\tthis._minimapContainer = document.createElement('div');\n\t\tthis._minimapContainer.className = 'minimap-container';\n\n\t\tutilities.applyStyles(this._minimapContainer, style);\n\n\t\tthis._toggleMinimapBtn = document.createElement('button');\n\t\tthis._toggleMinimapBtn.className = 'toggle-minimap collapse-button';\n\t\tthis._toggleMinimapBtn.innerHTML = toggleCollapseIcon;\n\t\tthis._minimapContainer.appendChild(this._toggleMinimapBtn);\n\n\t\tthis._minimap = document.createElement('div');\n\t\tthis._minimap.className = 'minimap';\n\t\tconst minimapCanvas = document.createElement('canvas');\n\t\tminimapCanvas.className = 'minimap-canvas';\n\t\tminimapCanvas.width = 200;\n\t\tminimapCanvas.height = 150;\n\n\t\tthis._minimap.appendChild(minimapCanvas);\n\t\tthis._minimapCtx = minimapCanvas.getContext('2d') as CanvasRenderingContext2D;\n\t\tthis._viewportRectangle = document.createElement('div');\n\t\tthis._viewportRectangle.className = 'viewport-rectangle';\n\t\tthis._minimap.appendChild(this._viewportRectangle);\n\t\tthis._minimapContainer.appendChild(this._minimap);\n\n\t\tthis.DM.data.container.appendChild(this._minimapContainer);\n\n\t\tthis._minimapContainer.classList.toggle('collapsed', this.collapsed);\n\n\t\tthis._toggleMinimapBtn.addEventListener('click', this.toggleCollapse);\n\t\tutilities.resizeCanvasForDPR(minimapCanvas, minimapCanvas.width, minimapCanvas.height);\n\n\t\tthis.onStart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\ttoggleCollapse = () => {\n\t\tthis.collapsed = !this.collapsed;\n\t\tthis.minimapContainer.classList.toggle('collapsed', this.collapsed);\n\t\tif (!this.collapsed) this.updateViewportRectangle();\n\t};\n\n\tprivate start = () => {\n\t\tconst bounds = this.DM.data.nodeBounds;\n\t\tif (!bounds) return;\n\t\tconst displayWidth = this.minimap.clientWidth;\n\t\tconst displayHeight = this.minimap.clientHeight;\n\t\tconst scaleX = displayWidth / bounds.width;\n\t\tconst scaleY = displayHeight / bounds.height;\n\t\tthis.minimapCache.scale = Math.min(scaleX, scaleY) * 0.9;\n\t\tthis.minimapCache.centerX = displayWidth / 2;\n\t\tthis.minimapCache.centerY = displayHeight / 2;\n\t\tthis.minimapCtx.clearRect(0, 0, displayWidth, displayHeight);\n\t\tthis.minimapCtx.save();\n\t\tthis.minimapCtx.translate(this.minimapCache.centerX, this.minimapCache.centerY);\n\t\tthis.minimapCtx.scale(this.minimapCache.scale, this.minimapCache.scale);\n\t\tthis.minimapCtx.translate(-bounds.centerX, -bounds.centerY);\n\t\tconst canvasData = this.DM.data.canvasData;\n\t\tfor (const edge of canvasData.edges) this.drawMinimapEdge(edge);\n\t\tfor (const node of canvasData.nodes) this.drawMinimapNode(node);\n\t\tthis.minimapCtx.restore();\n\t};\n\n\tprivate drawMinimapNode = (node: JSONCanvasNode) => {\n\t\tconst colors = utilities.getColor(node.color);\n\t\tconst radius = 25;\n\t\tthis.minimapCtx.fillStyle = colors.border;\n\t\tthis.minimapCtx.globalAlpha = 0.3;\n\t\tutilities.drawRoundRect(this.minimapCtx, node.x, node.y, node.width, node.height, radius);\n\t\tthis.minimapCtx.fill();\n\t\tthis.minimapCtx.globalAlpha = 1.0;\n\t};\n\n\tprivate drawMinimapEdge = (edge: JSONCanvasEdge) => {\n\t\tconst canvasMap = this.DM.data.canvasMap;\n\t\tconst fromNode = canvasMap[edge.fromNode].ref as JSONCanvasNode;\n\t\tconst toNode = canvasMap[edge.toNode].ref as JSONCanvasNode;\n\t\tif (!fromNode || !toNode) return;\n\t\tconst [startX, startY] = utilities.getAnchorCoord(fromNode, edge.fromSide);\n\t\tconst [endX, endY] = utilities.getAnchorCoord(toNode, edge.toSide);\n\t\tthis.minimapCtx.beginPath();\n\t\tthis.minimapCtx.moveTo(startX, startY);\n\t\tthis.minimapCtx.lineTo(endX, endY);\n\t\tthis.minimapCtx.strokeStyle = '#555';\n\t\tthis.minimapCtx.lineWidth = 10;\n\t\tthis.minimapCtx.stroke();\n\t};\n\n\tprivate updateViewportRectangle = () => {\n\t\tif (this.collapsed) return;\n\t\tconst bounds = this.DM.data.nodeBounds;\n\t\tconst container = this.DM.data.container;\n\t\tconst scale = this.DM.data.scale;\n\t\tif (!bounds) return;\n\t\tconst viewWidth = container.clientWidth / scale;\n\t\tconst viewHeight = container.clientHeight / scale;\n\t\tconst viewportCenterX = -this.DM.data.offsetX / scale + container.clientWidth / (2 * scale);\n\t\tconst viewportCenterY = -this.DM.data.offsetY / scale + container.clientHeight / (2 * scale);\n\t\tconst viewRectX =\n\t\t\tthis.minimapCache.centerX +\n\t\t\t(viewportCenterX - viewWidth / 2 - bounds.centerX) * this.minimapCache.scale;\n\t\tconst viewRectY =\n\t\t\tthis.minimapCache.centerY +\n\t\t\t(viewportCenterY - viewHeight / 2 - bounds.centerY) * this.minimapCache.scale;\n\t\tconst viewRectWidth = viewWidth * this.minimapCache.scale;\n\t\tconst viewRectHeight = viewHeight * this.minimapCache.scale;\n\t\tthis.viewportRectangle.style.left = `${viewRectX}px`;\n\t\tthis.viewportRectangle.style.top = `${viewRectY}px`;\n\t\tthis.viewportRectangle.style.width = `${viewRectWidth}px`;\n\t\tthis.viewportRectangle.style.height = `${viewRectHeight}px`;\n\t};\n\n\tprivate dispose = () => {\n\t\tthis.toggleMinimapBtn.removeEventListener('click', this.toggleCollapse);\n\t\tthis.minimapCtx.clearRect(0, 0, this.minimap.clientWidth, this.minimap.clientHeight);\n\t\tthis.minimapContainer.remove();\n\t\tthis._minimapContainer = null;\n\t\tthis._toggleMinimapBtn = null;\n\t\tthis._viewportRectangle = null;\n\t\tthis._minimap = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tmistouchPreventer?: {\n\t\tpreventAtStart?: boolean;\n\t\tlabelText?: string;\n\t};\n};\n\nexport default class MistouchPreventer extends BaseModule<Options> {\n\tprivate _preventionContainer: HTMLDivElement | null = null;\n\tprivate preventMt: boolean = false;\n\tprivate DM: DataManager;\n\tprivate preventMistouch: {\n\t\trecord: boolean;\n\t\tlastX: number;\n\t\tlastY: number;\n\t\tinitialX: number;\n\t\tinitialY: number;\n\t} = {\n\t\trecord: false,\n\t\tlastX: 0,\n\t\tlastY: 0,\n\t\tinitialX: 0,\n\t\tinitialY: 0,\n\t};\n\n\tprivate get preventionContainer() {\n\t\tif (this._preventionContainer === null) throw destroyError;\n\t\treturn this._preventionContainer;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tconst options = Object.assign(\n\t\t\t{\n\t\t\t\tpreventAtStart: true,\n\t\t\t\tlabelText: 'Click on to unlock.',\n\t\t\t},\n\t\t\tthis.options.mistouchPreventer || {},\n\t\t);\n\n\t\tconst preventionBanner = document.createElement('div');\n\t\tpreventionBanner.className = 'prevention-banner';\n\t\tpreventionBanner.textContent = options.labelText;\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis._preventionContainer = document.createElement('div');\n\t\tthis._preventionContainer.className = 'prevention-container hidden';\n\n\t\tutilities.applyStyles(this._preventionContainer, style);\n\t\tthis._preventionContainer.appendChild(preventionBanner);\n\t\tthis.DM.data.container.appendChild(this._preventionContainer);\n\n\t\tif (options.preventAtStart) this.startPrevention();\n\n\t\twindow.addEventListener('pointerdown', this.onPointerDown);\n\t\twindow.addEventListener('pointermove', this.onPointerMove);\n\t\twindow.addEventListener('pointerup', this.onPointerUp);\n\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate onPointerDown = (e: PointerEvent) => {\n\t\tconst bounds = this.DM.data.container.getBoundingClientRect();\n\t\tif (\n\t\t\te.clientX < bounds.left ||\n\t\t\te.clientX > bounds.right ||\n\t\t\te.clientY < bounds.top ||\n\t\t\te.clientY > bounds.bottom\n\t\t) {\n\t\t\tif (!this.preventMt) this.startPrevention();\n\t\t} else if (this.preventMt) {\n\t\t\tthis.preventMistouch.initialX = e.clientX;\n\t\t\tthis.preventMistouch.initialY = e.clientY;\n\t\t\tthis.preventMistouch.lastX = e.clientX;\n\t\t\tthis.preventMistouch.lastY = e.clientY;\n\t\t\tthis.preventMistouch.record = true;\n\t\t}\n\t};\n\n\tprivate onPointerMove = (e: PointerEvent) => {\n\t\tif (this.preventMistouch.record) {\n\t\t\tthis.preventMistouch.lastX = e.clientX;\n\t\t\tthis.preventMistouch.lastY = e.clientY;\n\t\t}\n\t};\n\n\tprivate onPointerUp = () => {\n\t\tif (this.preventMistouch.record) {\n\t\t\tthis.preventMistouch.record = false;\n\t\t\tif (\n\t\t\t\tMath.abs(this.preventMistouch.lastX - this.preventMistouch.initialX) +\n\t\t\t\t\tMath.abs(this.preventMistouch.lastY - this.preventMistouch.initialY) <\n\t\t\t\t5\n\t\t\t)\n\t\t\t\tthis.endPrevention();\n\t\t}\n\t};\n\n\tstartPrevention = () => {\n\t\tthis.preventionContainer.classList.remove('hidden');\n\t\tthis.DM.data.container.classList.add('numb');\n\t\tthis.preventMt = true;\n\t};\n\n\tendPrevention = () => {\n\t\tthis.preventMt = false;\n\t\tthis.preventionContainer.classList.add('hidden');\n\t\tsetTimeout(() => this.DM.data.container.classList.remove('numb'), 50); // minimum delay to prevent triggering undesired button touch\n\t};\n\n\tprivate dispose = () => {\n\t\twindow.removeEventListener('pointerdown', this.onPointerDown);\n\t\twindow.removeEventListener('pointermove', this.onPointerMove);\n\t\twindow.removeEventListener('pointerup', this.onPointerUp);\n\t\tthis.preventionContainer.remove();\n\t\tthis._preventionContainer = null;\n\t};\n}\n"],"names":["enterFullscreenIcon","Controls","BaseModule","_controlsPanel","_toggleCollapseBtn","_toggleFullscreenBtn","_zoomOutBtn","_zoomSlider","_zoomInBtn","_resetViewBtn","DM","collapsed","controlsPanel","this","destroyError","toggleCollapseBtn","toggleFullscreenBtn","zoomOutBtn","zoomSlider","zoomInBtn","resetViewBtn","constructor","args","super","options","controlsCollapsed","container","get","DataManager","onToggleFullscreen","subscribe","updateFullscreenBtn","Controller","hooks","onRefresh","updateSlider","document","createElement","className","classList","toggle","utilities","applyStyles","innerHTML","appendChild","controlsContent","type","min","max","value","data","addEventListener","toggleCollapse","zoomIn","zoomOut","slide","resetView","toggleFullscreen","onDispose","dispose","zoom","middleViewer","zoomToScale","Number","enter","shiftFullscreen","String","scaleToSlider","scale","Math","log","removeEventListener","remove","DebugPanel","_debugPanel","debugPanel","update","HTMLContainer","round","offsetX","offsetY","Minimap","_minimapCtx","_viewportRectangle","_minimap","_minimapContainer","_toggleMinimapBtn","minimapCache","centerX","centerY","minimap","minimapCtx","viewportRectangle","minimapContainer","toggleMinimapBtn","minimapCollapsed","updateViewportRectangle","minimapCanvas","width","height","getContext","resizeCanvasForDPR","onStart","start","bounds","nodeBounds","displayWidth","clientWidth","displayHeight","clientHeight","scaleX","scaleY","clearRect","save","translate","canvasData","edge","edges","drawMinimapEdge","node","nodes","drawMinimapNode","restore","colors","getColor","color","fillStyle","border","globalAlpha","drawRoundRect","x","y","fill","canvasMap","fromNode","ref","toNode","startX","startY","getAnchorCoord","fromSide","endX","endY","toSide","beginPath","moveTo","lineTo","strokeStyle","lineWidth","stroke","viewWidth","viewHeight","viewportCenterX","viewportCenterY","viewRectX","viewRectY","viewRectWidth","viewRectHeight","style","left","top","MistouchPreventer","_preventionContainer","preventMt","preventMistouch","record","lastX","lastY","initialX","initialY","preventionContainer","Object","assign","preventAtStart","labelText","mistouchPreventer","preventionBanner","textContent","startPrevention","window","onPointerDown","onPointerMove","onPointerUp","e","getBoundingClientRect","clientX","right","clientY","bottom","abs","endPrevention","add","setTimeout"],"mappings":"6HAYMA,EACL,+ZAUD,MAAqBC,UAAiBC,EAAAA,WAC7BC,eAAwC,KACxCC,mBAA+C,KAC/CC,qBAAiD,KACjDC,YAAwC,KACxCC,YAAuC,KACvCC,WAAuC,KACvCC,cAA0C,KAC1CC,GACAC,UAER,iBAAYC,GACX,GAA4B,OAAxBC,KAAKV,eAAyB,MAAMW,EAAAA,aACxC,OAAOD,KAAKV,cACb,CACA,qBAAYY,GACX,GAAgC,OAA5BF,KAAKT,mBAA6B,MAAMU,EAAAA,aAC5C,OAAOD,KAAKT,kBACb,CACA,uBAAYY,GACX,GAAkC,OAA9BH,KAAKR,qBAA+B,MAAMS,EAAAA,aAC9C,OAAOD,KAAKR,oBACb,CACA,cAAYY,GACX,GAAyB,OAArBJ,KAAKP,YAAsB,MAAMQ,EAAAA,aACrC,OAAOD,KAAKP,WACb,CACA,cAAYY,GACX,GAAyB,OAArBL,KAAKN,YAAsB,MAAMO,EAAAA,aACrC,OAAOD,KAAKN,WACb,CACA,aAAYY,GACX,GAAwB,OAApB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We,EAAEE,QAClC5K,KAAKuJ,gBAAgBK,SAAWc,EAAEI,QAClC9K,KAAKuJ,gBAAgBE,MAAQiB,EAAEE,QAC/B5K,KAAKuJ,gBAAgBG,MAAQgB,EAAEI,QAC/B9K,KAAKuJ,gBAAgBC,QAAS,IAIxBgB,cAAiBE,IACpB1K,KAAKuJ,gBAAgBC,SACxBxJ,KAAKuJ,gBAAgBE,MAAQiB,EAAEE,QAC/B5K,KAAKuJ,gBAAgBG,MAAQgB,EAAEI,UAIzBL,YAAc,KACjBzK,KAAKuJ,gBAAgBC,SACxBxJ,KAAKuJ,gBAAgBC,QAAS,EAE7BhG,KAAKwH,IAAIhL,KAAKuJ,gBAAgBE,MAAQzJ,KAAKuJ,gBAAgBI,UAC1DnG,KAAKwH,IAAIhL,KAAKuJ,gBAAgBG,MAAQ1J,KAAKuJ,gBAAgBK,UAC5D,GAEA5J,KAAKiL,kBAIRZ,gBAAkB,KACjBrK,KAAK6J,oBAAoBnI,UAAUiC,OAAO,UAC1C3D,KAAKH,GAAGwC,KAAKxB,UAAUa,UAAUwJ,IAAI,QACrClL,KAAKsJ,WAAY,GAGlB2B,cAAgB,KACfjL,KAAKsJ,WAAY,EACjBtJ,KAAK6J,oBAAoBnI,UAAUwJ,IAAI,UACvCC,WAAW,IAAMnL,KAAKH,GAAGwC,KAAKxB,UAAUa,UAAUiC,OAAO,QAAS,KAG3Db,QAAU,KACjBwH,OAAO5G,oBAAoB,cAAe1D,KAAKuK,eAC/CD,OAAO5G,oBAAoB,cAAe1D,KAAKwK,eAC/CF,OAAO5G,oBAAoB,YAAa1D,KAAKyK,aAC7CzK,KAAK6J,oBAAoBlG,SACzB3D,KAAKqJ,qBAAuB"}
|
|
1
|
+
{"version":3,"file":"modules.cjs","sources":["../src/modules/controls/index.ts","../src/modules/debugPanel/index.ts","../src/modules/minimap/index.ts","../src/modules/mistouchPreventer/index.ts"],"sourcesContent":["import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\n\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tcontrolsCollapsed?: boolean;\n};\n\ntype Augmentation = {\n\ttoggleControlsCollapse: Controls['toggleCollapse'];\n};\n\nconst resetIcon =\n\t'<svg viewBox=\"-6 -6 30 30\" stroke-width=\".08\"><path d=\"m14.955 7.986.116.01a1 1 0 0 1 .85 1.13 8 8 0 0 1-13.374 4.728l-.84.84c-.63.63-1.707.184-1.707-.707V10h3.987c.89 0 1.337 1.077.707 1.707l-.731.731a6 6 0 0 0 8.347-.264 6 6 0 0 0 1.63-3.33 1 1 0 0 1 1.131-.848zM11.514.813a8 8 0 0 1 1.942 1.336l.837-.837c.63-.63 1.707-.184 1.707.707V6h-3.981c-.89 0-1.337-1.077-.707-1.707l.728-.729a6 6 0 0 0-9.98 3.591 1 1 0 1 1-1.98-.281A8 8 0 0 1 11.514.813Z\" /></svg>';\nconst enterFullscreenIcon =\n\t'<svg viewBox=\"-5.28 -5.28 34.56 34.56\" fill=\"none\"><path d=\"M4 9V5.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C4.76 4 5.04 4 5.6 4H9M4 15v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C4.76 20 5.04 20 5.6 20H9m6-16h3.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C20 4.76 20 5.04 20 5.6V9m0 6v3.4c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C19.24 20 18.96 20 18.4 20H15\" stroke-width=\"2.4\" stroke-linecap=\"round\"/></svg>';\nconst exitFullscreenIcon =\n\t'<svg viewBox=\"-40.32 -40.32 176.64 176.64\"><path d=\"M30 60H6a6 6 0 0 0 0 12h18v18a6 6 0 0 0 12 0V66a5.997 5.997 0 0 0-6-6Zm60 0H66a5.997 5.997 0 0 0-6 6v24a6 6 0 0 0 12 0V72h18a6 6 0 0 0 0-12ZM66 36h24a6 6 0 0 0 0-12H72V6a6 6 0 0 0-12 0v24a5.997 5.997 0 0 0 6 6ZM30 0a5.997 5.997 0 0 0-6 6v18H6a6 6 0 0 0 0 12h24a5.997 5.997 0 0 0 6-6V6a5.997 5.997 0 0 0-6-6Z\"/></svg>';\nconst zoomInIcon =\n\t'<svg viewBox=\"-1.2 -1.2 26.4 26.4\"><path d=\"M6 12h12m-6-6v12\" stroke-width=\"2\" stroke-linecap=\"round\" /></svg>';\nconst zoomOutIcon =\n\t'<svg viewBox=\"-1.2 -1.2 26.4 26.4\"><path d=\"M6 12h12\" stroke-width=\"2\" stroke-linecap=\"round\" /></svg>';\nconst toggleCollapseIcon =\n\t'<svg viewBox=\"-3.6 -3.6 31.2 31.2\" stroke-width=\".4\"><path d=\"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z\" /></svg>';\n\nexport default class Controls extends BaseModule<Options, Augmentation> {\n\tprivate _controlsPanel: HTMLDivElement | null = null;\n\tprivate _toggleCollapseBtn: HTMLButtonElement | null = null;\n\tprivate _toggleFullscreenBtn: HTMLButtonElement | null = null;\n\tprivate _zoomOutBtn: HTMLButtonElement | null = null;\n\tprivate _zoomSlider: HTMLInputElement | null = null;\n\tprivate _zoomInBtn: HTMLButtonElement | null = null;\n\tprivate _resetViewBtn: HTMLButtonElement | null = null;\n\tprivate DM: DataManager;\n\tprivate collapsed: boolean;\n\n\tprivate get controlsPanel() {\n\t\tif (this._controlsPanel === null) throw destroyError;\n\t\treturn this._controlsPanel;\n\t}\n\tprivate get toggleCollapseBtn() {\n\t\tif (this._toggleCollapseBtn === null) throw destroyError;\n\t\treturn this._toggleCollapseBtn;\n\t}\n\tprivate get toggleFullscreenBtn() {\n\t\tif (this._toggleFullscreenBtn === null) throw destroyError;\n\t\treturn this._toggleFullscreenBtn;\n\t}\n\tprivate get zoomOutBtn() {\n\t\tif (this._zoomOutBtn === null) throw destroyError;\n\t\treturn this._zoomOutBtn;\n\t}\n\tprivate get zoomSlider() {\n\t\tif (this._zoomSlider === null) throw destroyError;\n\t\treturn this._zoomSlider;\n\t}\n\tprivate get zoomInBtn() {\n\t\tif (this._zoomInBtn === null) throw destroyError;\n\t\treturn this._zoomInBtn;\n\t}\n\tprivate get resetViewBtn() {\n\t\tif (this._resetViewBtn === null) throw destroyError;\n\t\treturn this._resetViewBtn;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.collapsed = this.options.controlsCollapsed || false;\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.DM.onToggleFullscreen.subscribe(this.updateFullscreenBtn);\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.updateSlider);\n\n\t\tthis._controlsPanel = document.createElement('div');\n\t\tthis._controlsPanel.className = 'controls';\n\t\tthis._controlsPanel.classList.toggle('collapsed', this.collapsed);\n\n\t\tutilities.applyStyles(this._controlsPanel, style);\n\n\t\tthis._toggleCollapseBtn = document.createElement('button');\n\t\tthis._toggleCollapseBtn.className = 'collapse-button border-shadow-bg';\n\t\tthis._toggleCollapseBtn.innerHTML = toggleCollapseIcon;\n\t\tthis._controlsPanel.appendChild(this._toggleCollapseBtn);\n\n\t\tconst controlsContent = document.createElement('div');\n\t\tcontrolsContent.className = 'controls-content';\n\n\t\tthis._toggleFullscreenBtn = document.createElement('button');\n\t\tthis._toggleFullscreenBtn.innerHTML = enterFullscreenIcon;\n\t\tcontrolsContent.appendChild(this._toggleFullscreenBtn);\n\n\t\tthis._zoomOutBtn = document.createElement('button');\n\t\tthis._zoomOutBtn.innerHTML = zoomOutIcon;\n\t\tcontrolsContent.appendChild(this._zoomOutBtn);\n\n\t\tthis._zoomSlider = document.createElement('input');\n\t\tthis._zoomSlider.type = 'range';\n\t\tthis._zoomSlider.className = 'zoom-slider';\n\t\tthis._zoomSlider.min = '-30';\n\t\tthis._zoomSlider.max = '30';\n\t\tthis._zoomSlider.value = '0';\n\t\tcontrolsContent.appendChild(this._zoomSlider);\n\n\t\tthis._zoomInBtn = document.createElement('button');\n\t\tthis._zoomInBtn.innerHTML = zoomInIcon;\n\t\tcontrolsContent.appendChild(this._zoomInBtn);\n\n\t\tthis._resetViewBtn = document.createElement('button');\n\t\tthis._resetViewBtn.innerHTML = resetIcon;\n\t\tcontrolsContent.appendChild(this._resetViewBtn);\n\n\t\tthis._controlsPanel.appendChild(controlsContent);\n\n\t\tthis.DM.data.container.appendChild(this._controlsPanel);\n\n\t\tthis._toggleCollapseBtn.addEventListener('click', this.toggleCollapse);\n\t\tthis._zoomInBtn.addEventListener('click', this.zoomIn);\n\t\tthis._zoomOutBtn.addEventListener('click', this.zoomOut);\n\t\tthis._zoomSlider.addEventListener('input', this.slide);\n\t\tthis._resetViewBtn.addEventListener('click', this.DM.resetView);\n\t\tthis._toggleFullscreenBtn.addEventListener('click', this.toggleFullscreen);\n\n\t\tthis.augment({ toggleControlsCollapse: this.toggleCollapse });\n\t\tthis.onDispose(this.dispose);\n\t}\n\ttoggleCollapse = () => {\n\t\tthis.collapsed = !this.collapsed;\n\t\tthis.controlsPanel.classList.toggle('collapsed', this.collapsed);\n\t\tif (!this.collapsed) this.updateSlider();\n\t};\n\tprivate zoomIn = () => this.DM.zoom(1.1, this.DM.middleViewer());\n\tprivate zoomOut = () => this.DM.zoom(1 / 1.1, this.DM.middleViewer());\n\tprivate slide = () =>\n\t\tthis.DM.zoomToScale(1.1 ** Number(this.zoomSlider.value), this.DM.middleViewer());\n\n\tprivate updateFullscreenBtn = (enter: boolean) => {\n\t\tif (enter) this.toggleFullscreenBtn.innerHTML = exitFullscreenIcon;\n\t\telse this.toggleFullscreenBtn.innerHTML = enterFullscreenIcon;\n\t};\n\tprivate toggleFullscreen = () => this.DM.shiftFullscreen();\n\n\tprivate updateSlider = () => {\n\t\tif (this.collapsed) return;\n\t\tthis.zoomSlider.value = String(this.scaleToSlider(this.DM.data.scale));\n\t};\n\tprivate scaleToSlider = (scale: number) => Math.log(scale) / Math.log(1.1);\n\n\tprivate dispose = () => {\n\t\tthis.toggleCollapseBtn.removeEventListener('click', this.toggleCollapse);\n\t\tthis.zoomInBtn.removeEventListener('click', this.zoomIn);\n\t\tthis.zoomOutBtn.removeEventListener('click', this.zoomOut);\n\t\tthis.zoomSlider.removeEventListener('input', this.slide);\n\t\tthis.resetViewBtn.removeEventListener('click', this.DM.resetView);\n\t\tthis.toggleFullscreenBtn.removeEventListener('click', this.toggleFullscreen);\n\t\tthis.controlsPanel.remove();\n\t\tthis._controlsPanel = null;\n\t\tthis._toggleCollapseBtn = null;\n\t\tthis._zoomInBtn = null;\n\t\tthis._zoomOutBtn = null;\n\t\tthis._zoomSlider = null;\n\t\tthis._resetViewBtn = null;\n\t\tthis._toggleFullscreenBtn = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\n\nimport style from './styles.scss?inline';\n\nexport default class DebugPanel extends BaseModule {\n\tprivate _debugPanel: HTMLDivElement | null = null;\n\tprivate DM: DataManager;\n\n\tprivate get debugPanel() {\n\t\tif (!this._debugPanel) throw destroyError;\n\t\treturn this._debugPanel;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.update);\n\t\tthis._debugPanel = document.createElement('div');\n\t\tthis._debugPanel.className = 'debug-panel border-shadow-bg';\n\t\tconst HTMLContainer = this.DM.data.container;\n\t\tutilities.applyStyles(HTMLContainer, style);\n\t\tHTMLContainer.appendChild(this._debugPanel);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate update = () => {\n\t\tconst round = utilities.round;\n\t\tconst data = this.DM.data;\n\t\tthis.debugPanel.innerHTML = `<p>Scale: ${round(data.scale, 3)}</p><p>Offset: ${round(data.offsetX, 1)}, ${round(data.offsetY, 1)}</p>`;\n\t};\n\n\tprivate dispose = () => {\n\t\tthis.debugPanel.remove();\n\t\tthis._debugPanel = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\n\nimport StyleManager from '@/core/styleManager';\n\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tminimapCollapsed?: boolean;\n};\n\ntype Augmentation = {\n\ttoggleMinimapCollapse: Minimap['toggleCollapse'];\n};\n\nconst toggleCollapseIcon =\n\t'<svg viewBox=\"-3.6 -3.6 31.2 31.2\" stroke-width=\".4\"><path d=\"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z\" /></svg>';\n\nexport default class Minimap extends BaseModule<Options, Augmentation> {\n\tprivate _minimapCtx: CanvasRenderingContext2D | null = null;\n\tprivate _viewportRectangle: HTMLDivElement | null = null;\n\tprivate _minimap: HTMLDivElement | null = null;\n\tprivate _minimapContainer: HTMLDivElement | null = null;\n\tprivate _toggleMinimapBtn: HTMLButtonElement | null = null;\n\tprivate minimapCache: { scale: number; centerX: number; centerY: number } = {\n\t\tscale: 1,\n\t\tcenterX: 0,\n\t\tcenterY: 0,\n\t};\n\tprivate DM: DataManager;\n\tprivate SM: StyleManager;\n\tprivate collapsed: boolean;\n\n\tprivate get minimap() {\n\t\tif (this._minimap === null) throw destroyError;\n\t\treturn this._minimap;\n\t}\n\tprivate get minimapCtx() {\n\t\tif (this._minimapCtx === null) throw destroyError;\n\t\treturn this._minimapCtx;\n\t}\n\tprivate get viewportRectangle() {\n\t\tif (this._viewportRectangle === null) throw destroyError;\n\t\treturn this._viewportRectangle;\n\t}\n\tprivate get minimapContainer() {\n\t\tif (this._minimapContainer === null) throw destroyError;\n\t\treturn this._minimapContainer;\n\t}\n\tprivate get toggleMinimapBtn() {\n\t\tif (this._toggleMinimapBtn === null) throw destroyError;\n\t\treturn this._toggleMinimapBtn;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tthis.collapsed = this.options.minimapCollapsed || false;\n\t\tthis.container.get(Controller).hooks.onRefresh.subscribe(this.updateViewportRectangle);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.SM = this.container.get(StyleManager);\n\n\t\tthis._minimapContainer = document.createElement('div');\n\t\tthis._minimapContainer.className = 'minimap-container';\n\n\t\tutilities.applyStyles(this._minimapContainer, style);\n\n\t\tthis._toggleMinimapBtn = document.createElement('button');\n\t\tthis._toggleMinimapBtn.className = 'toggle-minimap collapse-button border-shadow-bg';\n\t\tthis._toggleMinimapBtn.innerHTML = toggleCollapseIcon;\n\t\tthis._minimapContainer.appendChild(this._toggleMinimapBtn);\n\n\t\tthis._minimap = document.createElement('div');\n\t\tthis._minimap.className = 'minimap border-shadow-bg';\n\t\tconst minimapCanvas = document.createElement('canvas');\n\t\tminimapCanvas.className = 'minimap-canvas';\n\t\tminimapCanvas.width = 200;\n\t\tminimapCanvas.height = 150;\n\n\t\tthis._minimap.appendChild(minimapCanvas);\n\t\tthis._minimapCtx = minimapCanvas.getContext('2d') as CanvasRenderingContext2D;\n\t\tthis._viewportRectangle = document.createElement('div');\n\t\tthis._viewportRectangle.className = 'viewport-rectangle';\n\t\tthis._minimap.appendChild(this._viewportRectangle);\n\t\tthis._minimapContainer.appendChild(this._minimap);\n\n\t\tthis.DM.data.container.appendChild(this._minimapContainer);\n\n\t\tthis._minimapContainer.classList.toggle('collapsed', this.collapsed);\n\n\t\tthis._toggleMinimapBtn.addEventListener('click', this.toggleCollapse);\n\t\tutilities.resizeCanvasForDPR(minimapCanvas, minimapCanvas.width, minimapCanvas.height);\n\n\t\tthis.augment({ toggleMinimapCollapse: this.toggleCollapse });\n\t\tthis.onStart(this.start);\n\t\tthis.onRestart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\ttoggleCollapse = () => {\n\t\tthis.collapsed = !this.collapsed;\n\t\tthis.minimapContainer.classList.toggle('collapsed', this.collapsed);\n\t\tif (!this.collapsed) this.updateViewportRectangle();\n\t};\n\n\tprivate start = () => {\n\t\tconst bounds = this.DM.data.nodeBounds;\n\t\tif (!bounds) return;\n\t\tconst displayWidth = this.minimap.clientWidth;\n\t\tconst displayHeight = this.minimap.clientHeight;\n\t\tconst scaleX = displayWidth / bounds.width;\n\t\tconst scaleY = displayHeight / bounds.height;\n\t\tthis.minimapCache.scale = Math.min(scaleX, scaleY) * 0.9;\n\t\tthis.minimapCache.centerX = displayWidth / 2;\n\t\tthis.minimapCache.centerY = displayHeight / 2;\n\t\tthis.minimapCtx.clearRect(0, 0, displayWidth, displayHeight);\n\t\tthis.minimapCtx.save();\n\t\tthis.minimapCtx.translate(this.minimapCache.centerX, this.minimapCache.centerY);\n\t\tthis.minimapCtx.scale(this.minimapCache.scale, this.minimapCache.scale);\n\t\tthis.minimapCtx.translate(-bounds.centerX, -bounds.centerY);\n\t\tconst canvasData = this.DM.data.canvasData;\n\t\tfor (const edge of canvasData.edges) this.drawMinimapEdge(edge);\n\t\tfor (const node of canvasData.nodes) this.drawMinimapNode(node);\n\t\tthis.minimapCtx.restore();\n\t};\n\n\tprivate drawMinimapNode = (node: JSONCanvasNode) => {\n\t\tconst colors = this.SM.getColor(node.color);\n\t\tconst radius = 25;\n\t\tthis.minimapCtx.fillStyle = colors.border;\n\t\tutilities.drawRoundRect(this.minimapCtx, node.x, node.y, node.width, node.height, radius);\n\t\tthis.minimapCtx.fill();\n\t};\n\n\tprivate drawMinimapEdge = (edge: JSONCanvasEdge) => {\n\t\tconst canvasMap = this.DM.data.nodeMap;\n\t\tconst fromNode = canvasMap[edge.fromNode].ref;\n\t\tconst toNode = canvasMap[edge.toNode].ref;\n\t\tif (!fromNode || !toNode) return;\n\t\tconst { x: startX, y: startY } = utilities.getAnchorCoord(fromNode, edge.fromSide);\n\t\tconst { x: endX, y: endY } = utilities.getAnchorCoord(toNode, edge.toSide);\n\t\tthis.minimapCtx.beginPath();\n\t\tthis.minimapCtx.moveTo(startX, startY);\n\t\tthis.minimapCtx.lineTo(endX, endY);\n\t\tthis.minimapCtx.strokeStyle = this.SM.getColor(edge.color).active;\n\t\tthis.minimapCtx.lineWidth = 10;\n\t\tthis.minimapCtx.stroke();\n\t};\n\n\tprivate updateViewportRectangle = () => {\n\t\tif (this.collapsed) return;\n\t\tconst bounds = this.DM.data.nodeBounds;\n\t\tconst container = this.DM.data.container;\n\t\tconst scale = this.DM.data.scale;\n\t\tif (!bounds) return;\n\t\tconst viewWidth = container.clientWidth / scale;\n\t\tconst viewHeight = container.clientHeight / scale;\n\t\tconst viewportCenterX = -this.DM.data.offsetX / scale + container.clientWidth / (2 * scale);\n\t\tconst viewportCenterY =\n\t\t\t-this.DM.data.offsetY / scale + container.clientHeight / (2 * scale);\n\t\tconst viewRectX =\n\t\t\tthis.minimapCache.centerX +\n\t\t\t(viewportCenterX - viewWidth / 2 - bounds.centerX) * this.minimapCache.scale;\n\t\tconst viewRectY =\n\t\t\tthis.minimapCache.centerY +\n\t\t\t(viewportCenterY - viewHeight / 2 - bounds.centerY) * this.minimapCache.scale;\n\t\tconst viewRectWidth = viewWidth * this.minimapCache.scale;\n\t\tconst viewRectHeight = viewHeight * this.minimapCache.scale;\n\t\tthis.viewportRectangle.style.left = `${viewRectX}px`;\n\t\tthis.viewportRectangle.style.top = `${viewRectY}px`;\n\t\tthis.viewportRectangle.style.width = `${viewRectWidth}px`;\n\t\tthis.viewportRectangle.style.height = `${viewRectHeight}px`;\n\t};\n\n\tprivate dispose = () => {\n\t\tthis.toggleMinimapBtn.removeEventListener('click', this.toggleCollapse);\n\t\tthis.minimapCtx.clearRect(0, 0, this.minimap.clientWidth, this.minimap.clientHeight);\n\t\tthis.minimapContainer.remove();\n\t\tthis._minimapContainer = null;\n\t\tthis._toggleMinimapBtn = null;\n\t\tthis._viewportRectangle = null;\n\t\tthis._minimap = null;\n\t};\n}\n","import { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities, { destroyError } from '$/utilities';\n\nimport style from './styles.scss?inline';\n\ntype Options = {\n\tpreventMistouchAtStart?: boolean;\n\tmistouchPreventerBannerText?: string;\n};\n\ntype Augmentation = {\n\tstartMistouchPrevention: MistouchPreventer['startPrevention'];\n\tendMistouchPrevention: MistouchPreventer['endPrevention'];\n};\n\nexport default class MistouchPreventer extends BaseModule<Options, Augmentation> {\n\tprivate _preventionContainer: HTMLDivElement | null = null;\n\tprivate preventMt: boolean = false;\n\tprivate DM: DataManager;\n\tprivate preventMistouch: {\n\t\trecord: boolean;\n\t\tlastX: number;\n\t\tlastY: number;\n\t\tinitialX: number;\n\t\tinitialY: number;\n\t} = {\n\t\trecord: false,\n\t\tlastX: 0,\n\t\tlastY: 0,\n\t\tinitialX: 0,\n\t\tinitialY: 0,\n\t};\n\n\tprivate get preventionContainer() {\n\t\tif (this._preventionContainer === null) throw destroyError;\n\t\treturn this._preventionContainer;\n\t}\n\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\n\t\tconst preventionBanner = document.createElement('div');\n\t\tpreventionBanner.className = 'prevention-banner border-shadow-bg';\n\t\tpreventionBanner.textContent =\n\t\t\tthis.options.mistouchPreventerBannerText || 'Click on to unlock.';\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis._preventionContainer = document.createElement('div');\n\t\tthis._preventionContainer.className = 'prevention-container hidden';\n\n\t\tutilities.applyStyles(this._preventionContainer, style);\n\t\tthis._preventionContainer.appendChild(preventionBanner);\n\t\tthis.DM.data.container.appendChild(this._preventionContainer);\n\n\t\tif (this.options.preventMistouchAtStart) this.startPrevention();\n\n\t\twindow.addEventListener('pointerdown', this.onPointerDown);\n\t\twindow.addEventListener('pointermove', this.onPointerMove);\n\t\twindow.addEventListener('pointerup', this.onPointerUp);\n\n\t\tthis.augment({\n\t\t\tstartMistouchPrevention: this.startPrevention,\n\t\t\tendMistouchPrevention: this.endPrevention,\n\t\t});\n\t\tthis.onDispose(this.dispose);\n\t}\n\n\tprivate onPointerDown = (e: PointerEvent) => {\n\t\tconst bounds = this.DM.data.container.getBoundingClientRect();\n\t\tif (\n\t\t\te.clientX < bounds.left ||\n\t\t\te.clientX > bounds.right ||\n\t\t\te.clientY < bounds.top ||\n\t\t\te.clientY > bounds.bottom\n\t\t) {\n\t\t\tif (!this.preventMt) this.startPrevention();\n\t\t} else if (this.preventMt) {\n\t\t\tthis.preventMistouch.initialX = e.clientX;\n\t\t\tthis.preventMistouch.initialY = e.clientY;\n\t\t\tthis.preventMistouch.lastX = e.clientX;\n\t\t\tthis.preventMistouch.lastY = e.clientY;\n\t\t\tthis.preventMistouch.record = true;\n\t\t}\n\t};\n\n\tprivate onPointerMove = (e: PointerEvent) => {\n\t\tif (this.preventMistouch.record) {\n\t\t\tthis.preventMistouch.lastX = e.clientX;\n\t\t\tthis.preventMistouch.lastY = e.clientY;\n\t\t}\n\t};\n\n\tprivate onPointerUp = () => {\n\t\tif (this.preventMistouch.record) {\n\t\t\tthis.preventMistouch.record = false;\n\t\t\tif (\n\t\t\t\tMath.abs(this.preventMistouch.lastX - this.preventMistouch.initialX) +\n\t\t\t\t\tMath.abs(this.preventMistouch.lastY - this.preventMistouch.initialY) <\n\t\t\t\t5\n\t\t\t)\n\t\t\t\tthis.endPrevention();\n\t\t}\n\t};\n\n\tstartPrevention = () => {\n\t\tthis.preventionContainer.classList.remove('hidden');\n\t\tthis.DM.data.container.classList.add('numb');\n\t\tthis.preventMt = true;\n\t};\n\n\tendPrevention = () => {\n\t\tthis.preventMt = false;\n\t\tthis.preventionContainer.classList.add('hidden');\n\t\tsetTimeout(() => this.DM.data.container.classList.remove('numb'), 50); // minimum delay to prevent triggering undesired button touch\n\t};\n\n\tprivate dispose = () => {\n\t\twindow.removeEventListener('pointerdown', this.onPointerDown);\n\t\twindow.removeEventListener('pointermove', this.onPointerMove);\n\t\twindow.removeEventListener('pointerup', this.onPointerUp);\n\t\tthis.preventionContainer.remove();\n\t\tthis._preventionContainer = null;\n\t};\n}\n"],"names":["enterFullscreenIcon","Controls","BaseModule","_controlsPanel","_toggleCollapseBtn","_toggleFullscreenBtn","_zoomOutBtn","_zoomSlider","_zoomInBtn","_resetViewBtn","DM","collapsed","controlsPanel","this","destroyError","toggleCollapseBtn","toggleFullscreenBtn","zoomOutBtn","zoomSlider","zoomInBtn","resetViewBtn","constructor","args","super","options","controlsCollapsed","container","get","DataManager","onToggleFullscreen","subscribe","updateFullscreenBtn","Controller","hooks","onRefresh","updateSlider","document","createElement","className","classList","toggle","utilities","applyStyles","innerHTML","appendChild","controlsContent","type","min","max","value","data","addEventListener","toggleCollapse","zoomIn","zoomOut","slide","resetView","toggleFullscreen","augment","toggleControlsCollapse","onDispose","dispose","zoom","middleViewer","zoomToScale","Number","enter","shiftFullscreen","String","scaleToSlider","scale","Math","log","removeEventListener","remove","DebugPanel","_debugPanel","debugPanel","update","HTMLContainer","round","offsetX","offsetY","Minimap","_minimapCtx","_viewportRectangle","_minimap","_minimapContainer","_toggleMinimapBtn","minimapCache","centerX","centerY","SM","minimap","minimapCtx","viewportRectangle","minimapContainer","toggleMinimapBtn","minimapCollapsed","updateViewportRectangle","StyleManager","minimapCanvas","width","height","getContext","resizeCanvasForDPR","toggleMinimapCollapse","onStart","start","onRestart","bounds","nodeBounds","displayWidth","clientWidth","displayHeight","clientHeight","scaleX","scaleY","clearRect","save","translate","canvasData","edge","edges","drawMinimapEdge","node","nodes","drawMinimapNode","restore","colors","getColor","color","fillStyle","border","drawRoundRect","x","y","fill","canvasMap","nodeMap","fromNode","ref","toNode","startX","startY","getAnchorCoord","fromSide","endX","endY","toSide","beginPath","moveTo","lineTo","strokeStyle","active","lineWidth","stroke","viewWidth","viewHeight","viewportCenterX","viewportCenterY","viewRectX","viewRectY","viewRectWidth","viewRectHeight","style","left","top","MistouchPreventer","_preventionContainer","preventMt","preventMistouch","record","lastX","lastY","initialX","initialY","preventionContainer","preventionBanner","textContent","mistouchPreventerBannerText","preventMistouchAtStart","startPrevention","window","onPointerDown","onPointerMove","onPointerUp","startMistouchPrevention","endMistouchPrevention","endPrevention","e","getBoundingClientRect","clientX","right","clientY","bottom","abs","add","setTimeout"],"mappings":"6HAiBMA,EACL,+ZAUD,MAAqBC,UAAiBC,EAAAA,WAC7BC,eAAwC,KACxCC,mBAA+C,KAC/CC,qBAAiD,KACjDC,YAAwC,KACxCC,YAAuC,KACvCC,WAAuC,KACvCC,cAA0C,KAC1CC,GACAC,UAER,iBAAYC,GACX,GAA4B,OAAxBC,KAAKV,eAAyB,MAAMW,EAAAA,aACxC,OAAOD,KAAKV,cACb,CACA,qBAAYY,GACX,GAAgC,OAA5BF,KAAKT,mBAA6B,MAAMU,EAAAA,aAC5C,OAAOD,KAAKT,kBACb,CACA,uBAAYY,GACX,GAAkC,OAA9BH,KAAKR,qBAA+B,MAAMS,EAAAA,aAC9C,OAAOD,KAAKR,oBACb,CACA,cAAYY,GACX,GAAyB,OAArBJ,KAAKP,YAAsB,MAAMQ,EAAAA,aACrC,OAAOD,KAAKP,WACb,CACA,cAAYY,GACX,GAAyB,OAArBL,KAAKN,YAAsB,MAAMO,EAAAA,aACrC,OAAOD,KAAKN,WACb,CACA,aAAYY,GACX,GAAwB,OAApBN,KAAKL,WAAqB,MAAMM,EAAAA,aACpC,OAAOD,KAAKL,UACb,CACA,gBAAYY,GACX,GAA2B,OAAvBP,KAAKJ,cAAwB,MAAMK,EAAAA,aACvC,OAAOD,KAAKJ,aACb,CAEA,WAAAY,IAAeC,GACdC,SAASD,GACTT,KAAKF,UAAYE,KAAKW,QAAQC,oBAAqB,EACnDZ,KAAKH,GAAKG,KAAKa,UAAUC,IAAIC,EAAAA,aAC7Bf,KAAKH,GAAGmB,mBAAmBC,UAAUjB,KAAKkB,qBAC1ClB,KAAKa,UAAUC,IAAIK,cAAYC,MAAMC,UAAUJ,UAAUjB,KAAKsB,cAE9DtB,KAAKV,eAAiBiC,SAASC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