json-canvas-viewer 3.3.0 → 3.3.1

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.
Files changed (42) hide show
  1. package/README.md +5 -5
  2. package/dist/bridges.cjs +1 -1
  3. package/dist/bridges.cjs.map +1 -1
  4. package/dist/bridges.js +1 -1
  5. package/dist/bridges.js.map +1 -1
  6. package/dist/chimp.cjs +1 -1
  7. package/dist/chimp.js +1 -1
  8. package/dist/controller-CnUlrkdp.cjs +2 -0
  9. package/dist/controller-CnUlrkdp.cjs.map +1 -0
  10. package/dist/controller-UN-hOZ_r.js +2 -0
  11. package/dist/controller-UN-hOZ_r.js.map +1 -0
  12. package/dist/dev.cjs +1 -1
  13. package/dist/dev.js +1 -1
  14. package/dist/{index-BSkMdAcV.cjs → index-RXeXyAu0.cjs} +2 -2
  15. package/dist/{index-BSkMdAcV.cjs.map → index-RXeXyAu0.cjs.map} +1 -1
  16. package/dist/{index-u8PUIMyl.js → index-ujiv9m9Y.js} +2 -2
  17. package/dist/{index-u8PUIMyl.js.map → index-ujiv9m9Y.js.map} +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/modules.cjs +1 -1
  21. package/dist/modules.cjs.map +1 -1
  22. package/dist/modules.js +1 -1
  23. package/dist/modules.js.map +1 -1
  24. package/dist/renderer-Bzv3aLXp.cjs +2 -0
  25. package/dist/renderer-Bzv3aLXp.cjs.map +1 -0
  26. package/dist/renderer-NPxavnke.js +2 -0
  27. package/dist/renderer-NPxavnke.js.map +1 -0
  28. package/dist/types/bridges/reactComponent.d.ts +9 -0
  29. package/dist/types/bridges/vueComponent.vue.d.ts +1 -1
  30. package/dist/types/bridges.d.ts +1 -0
  31. package/dist/types/core/dataManager.d.ts +13 -1
  32. package/dist/types/core/declarations.d.ts +0 -10
  33. package/dist/types/core/renderer.d.ts +1 -2
  34. package/package.json +4 -2
  35. package/dist/controller--Q72jFEw.cjs +0 -2
  36. package/dist/controller--Q72jFEw.cjs.map +0 -1
  37. package/dist/controller-siZ5v-SD.js +0 -2
  38. package/dist/controller-siZ5v-SD.js.map +0 -1
  39. package/dist/renderer-CZ85ZN6O.js +0 -2
  40. package/dist/renderer-CZ85ZN6O.js.map +0 -1
  41. package/dist/renderer-D9iInH9_.cjs +0 -2
  42. package/dist/renderer-D9iInH9_.cjs.map +0 -1
@@ -0,0 +1,2 @@
1
+ "use strict";class t{constructor(t,e,s,a){this.container=t,Object.assign(this.options,e),this.onStart=s.subscribe,this.onDispose=a.subscribe}onStart;onDispose;options={}}const e={round:function(t,e){const s=10**e;return Math.round(t*s)/s},resizeCanvasForDPR:function(t,e,s){const a=window.devicePixelRatio||1,i=t.getContext("2d");if(!i)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*a),t.height=Math.round(s*a),i.setTransform(1,0,0,1,0,0),i.scale(a,a)},applyStyles:function(t,e){const s=document.createElement("style");s.innerHTML=e,t.appendChild(s)},drawRoundRect:function(t,e,s,a,i,o){t.beginPath(),t.moveTo(e+o,s),t.lineTo(e+a-o,s),t.quadraticCurveTo(e+a,s,e+a,s+o),t.lineTo(e+a,s+i-o),t.quadraticCurveTo(e+a,s+i,e+a-o,s+i),t.lineTo(e+o,s+i),t.quadraticCurveTo(e,s+i,e,s+i-o),t.lineTo(e,s+o),t.quadraticCurveTo(e,s,e+o,s),t.closePath()},getAnchorCoord:function(t,e){const s=t.x+t.width/2,a=t.y+t.height/2;switch(e){case"top":return[s,t.y];case"bottom":return[s,t.y+t.height];case"left":return[t.x,a];case"right":return[t.x+t.width,a];default:return[s,a]}},getColor:function(t="0"){let e=null;if(1===t.length)switch(t){case"1":e="rgba(255, 120, 129, ?)";break;case"2":e="rgba(251, 187, 131, ?)";break;case"3":e="rgba(255, 232, 139, ?)";break;case"4":e="rgba(124, 211, 124, ?)";break;case"5":e="rgba(134, 223, 226, ?)";break;case"6":e="rgba(203, 158, 255, ?)";break;default:e="rgba(140, 140, 140, ?)"}else{const s=function(t){const e=t.replace("#","");return{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16)}}(t);e=`rgba(${s.r}, ${s.g}, ${s.b}, ?)`}return{border:e.replace("?","0.75"),background:e.replace("?","0.1"),active:e.replace("?","1")}},makeHook:function(t=!1){const e=(...s)=>{if(t){Array.from(e.subs).reverse().forEach(t=>{t(...s)})}else e.subs.forEach(t=>{t(...s)})};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.");const a=800;class i extends t{spatialGrid=null;onToggleFullscreen=e.makeHook();data;constructor(...t){super(...t);const s=this.options.container;for(;s.firstElementChild;)s.firstElementChild.remove();s.innerHTML="";const a=this.options.noShadow||!1?s:s.attachShadow({mode:"open"});e.applyStyles(a,".full,.click-layer,.link-iframe,.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}.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:#fff;fill:#fff;stroke:#fff;position:relative;width:100%;height:100%;overflow:hidden;background-color:#141414}.container.numb,.container.numb *{pointer-events:none!important}.main-canvas{width:100%;height:100%;transform-origin:top left}.overlays{position:absolute;top:0;left:0;width:10000px;height:10000px;transform-origin:top left;will-change:transform}.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){.parsed-content-wrapper{padding:10px}}.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}.overlay-container:hover{box-shadow:0 2px 12px #00000080}.overlay-container{transition:var(--containerTransition)}.overlay-container .overlay-border{box-sizing:border-box;pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:12px;transition:var(--containerTransition)}.overlay-container img{width:100%;height:100%;object-fit:cover;pointer-events:none}.overlay-container.active .overlay-border{border:6px solid var(--active-color)}.overlay-container.markdown-content{position:absolute;padding:0 7px}.overlay-container.markdown-content.active .parsed-content-wrapper{overflow:auto;-webkit-user-select:text;user-select:text;pointer-events:auto}.overlay-container.markdown-content.rtl{direction:rtl;text-align:right}.link-iframe,.audio{border:none;background:transparent}.click-layer{background:transparent;pointer-events:auto}.active .click-layer{pointer-events:none}::-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);const i=document.createElement("div");i.classList.add("container"),a.appendChild(i);const o=Object.assign({nodes:[],edges:[]},this.options.canvas);this.data={canvasData:o,canvasMap:{},canvasBaseDir:this.processBaseDir(this.options.attachmentDir),nodeBounds:this.calculateNodeBounds(o),offsetX:0,offsetY:0,scale:1,container:i},this.data.canvasData.nodes.forEach(t=>{this.data.canvasMap[t.id]={type:"node",ref:t};const e=this.data.canvasMap[t.id],s=e.ref;if("file"===s.type){const t=s.file.split("/").pop()||"";e.fileName=t,s.file.startsWith("http://")||s.file.startsWith("https://")||(s.file=this.data.canvasBaseDir+t)}}),this.data.canvasData.edges.forEach(t=>{this.data.canvasMap[t.id]={type:"edge",ref:t}}),this.buildSpatialGrid(),this.resetView(),this.onDispose(this.dispose)}processBaseDir=t=>{if(!t)return"./";const e=t?.slice(-1);return"/"===e?t:`${t}/`};findNodeAt=t=>{const{x:e,y:s}=this.C2W(this.C2C({x:t.x,y:t.y}));let i=[];if(this.spatialGrid){const t=`${Math.floor(e/a)},${Math.floor(s/a)}`;i=this.spatialGrid[t]||[]}else i=this.data.canvasData.nodes;for(const a of i)if(!(e<a.x||e>a.x+a.width||s<a.y||s>a.y+a.height||"non-interactive"===this.judgeInteract(a)))return a;return null};judgeInteract=t=>{switch(t?.type){case"text":case"link":return"select";case"file":return t.file.match(/\.(md|wav|mp3)$/i)?"select":"non-interactive";default:return"non-interactive"}};calculateNodeBounds(t){let e=1/0,s=1/0,a=-1/0,i=-1/0;t.nodes.forEach(t=>{e=Math.min(e,t.x),s=Math.min(s,t.y),a=Math.max(a,t.x+t.width),i=Math.max(i,t.y+t.height)});const o=a-e,r=i-s;return{minX:e,minY:s,maxX:a,maxY:i,width:o,height:r,centerX:e+o/2,centerY:s+r/2}}buildSpatialGrid(){const t=this.data.canvasData;if(!(t.nodes.length<50)){this.spatialGrid={};for(const e of t.nodes){const t=Math.floor(e.x/a),s=Math.floor((e.x+e.width)/a),i=Math.floor(e.y/a),o=Math.floor((e.y+e.height)/a);for(let a=t;a<=s;a++)for(let t=i;t<=o;t++){const s=`${a},${t}`;this.spatialGrid[s]||(this.spatialGrid[s]=[]),this.spatialGrid[s].push(e)}}}}zoom=(t,e)=>{const s=this.data.scale*t;this.zoomToScale(s,e)};zoomToScale=(t,e)=>{const s=Math.max(Math.min(t,20),.05),a=this.data.scale;if(s===a)return;const i=this.C2C(e);this.data.offsetX=e.x-i.x*s/a,this.data.offsetY=e.y-i.y*s/a,this.data.scale=s};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=(t="toggle")=>{document.fullscreenElement||"toggle"!==t&&"enter"!==t?!document.fullscreenElement||"toggle"!==t&&"exit"!==t||(document.exitFullscreen(),this.onToggleFullscreen(!1)):(this.data.container.requestFullscreen(),this.onToggleFullscreen(!0))};resetView=()=>{const t=this.data.nodeBounds,e=this.data.container;if(!t||!e)return;const s=t.width+200,a=t.height+200,i=e.clientWidth,o=e.clientHeight,r=i/s,n=o/a,l=Math.round(1e3*Math.min(r,n))/1e3,c={scale:l,offsetX:i/2-t.centerX*l,offsetY:o/2-t.centerY*l};this.data.offsetX=c.offsetX,this.data.offsetY=c.offsetY,this.data.scale=c.scale};C2C=({x:t,y:e})=>({x:t-this.data.offsetX,y:e-this.data.offsetY});C2W=({x:t,y:e})=>({x:t/this.data.scale,y:e/this.data.scale});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()}exports.BaseModule=t,exports.Controller=class extends t{animationId=null;resizeAnimationId=null;DM;resizeObserver;perFrame={lastScale:1,lastOffsets:{x:0,y:0}};lastResizeCenter={x:null,y:null};hooks={onResize:e.makeHook(),onRefresh:e.makeHook()};constructor(...t){super(...t),this.onStart(this.start),this.onDispose(this.dispose),this.DM=this.container.get(i),this.resizeObserver=new ResizeObserver(this.onResize)}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,this.perFrame.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=i,exports.destroyError=s,exports.utilities=e;
2
+ //# sourceMappingURL=controller-CnUlrkdp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-CnUlrkdp.cjs","sources":["../src/core/baseModule.ts","../src/core/utilities.ts","../src/core/dataManager.ts","../src/core/controller.ts"],"sourcesContent":["import type { Container } from '@needle-di/core';\nimport type { DefaultOptions, Empty, GeneralFunction, GeneralObject } from '$/declarations';\nimport type utilities from '$/utilities';\n\ntype Hook = ReturnType<typeof utilities.makeHook>;\n\nexport type BaseArgs = [Container, GeneralObject, Hook, Hook];\n\nexport type GeneralModuleCtor = typeof BaseModule<GeneralObject>;\nexport type GeneralModule = BaseModule<GeneralObject>;\n\nexport class BaseModule<O extends GeneralObject = Empty> {\n\tonStart: (callback: GeneralFunction) => void;\n\tonDispose: (callback: GeneralFunction) => void;\n\tconstructor(\n\t\tprotected container: Container,\n\t\toptions: GeneralObject,\n\t\tonStart: Hook,\n\t\tonDispose: Hook,\n\t) {\n\t\tObject.assign(this.options, options);\n\t\tthis.onStart = onStart.subscribe;\n\t\tthis.onDispose = onDispose.subscribe;\n\t}\n\toptions = {} as DefaultOptions & O;\n}\n","import type { GeneralArguments } from '$/declarations';\n\nexport default {\n\tround,\n\tresizeCanvasForDPR,\n\tapplyStyles,\n\tdrawRoundRect,\n\tgetAnchorCoord,\n\tgetColor,\n\tmakeHook,\n};\n\nexport const destroyError = new Error(\"[JSONCanvasViewer] Resource hasn't been set up or has been disposed.\");\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 [midX, node.y];\n\t\tcase 'bottom':\n\t\t\treturn [midX, node.y + node.height];\n\t\tcase 'left':\n\t\t\treturn [node.x, midY];\n\t\tcase 'right':\n\t\t\treturn [node.x + node.width, midY];\n\t\tdefault:\n\t\t\treturn [midX, midY];\n\t}\n}\n\nfunction getColor(colorIndex: string = '0') {\n\tlet themeColor = null;\n\n\tfunction hexToRgb(hex: string) {\n\t\tconst cleanHex = hex.replace('#', '');\n\t\tconst r = parseInt(cleanHex.substring(0, 2), 16);\n\t\tconst g = parseInt(cleanHex.substring(2, 4), 16);\n\t\tconst b = parseInt(cleanHex.substring(4, 6), 16);\n\t\treturn { r, g, b };\n\t}\n\n\tif (colorIndex.length === 1) {\n\t\tswitch (colorIndex) {\n\t\t\tcase '1':\n\t\t\t\tthemeColor = 'rgba(255, 120, 129, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '2':\n\t\t\t\tthemeColor = 'rgba(251, 187, 131, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '3':\n\t\t\t\tthemeColor = 'rgba(255, 232, 139, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '4':\n\t\t\t\tthemeColor = 'rgba(124, 211, 124, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '5':\n\t\t\t\tthemeColor = 'rgba(134, 223, 226, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '6':\n\t\t\t\tthemeColor = 'rgba(203, 158, 255, ?)';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthemeColor = 'rgba(140, 140, 140, ?)';\n\t\t}\n\t} else {\n\t\tconst rgb = hexToRgb(colorIndex);\n\t\tthemeColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ?)`;\n\t}\n\treturn {\n\t\tborder: themeColor.replace('?', '0.75'),\n\t\tbackground: themeColor.replace('?', '0.1'),\n\t\tactive: themeColor.replace('?', '1'),\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 { Coordinates, NodeBounds } from '$/declarations';\nimport style from '$/styles.scss?inline';\nimport utilities from '$/utilities';\n\nconst GRID_CELL_SIZE = 800;\nconst INITIAL_VIEWPORT_PADDING = 100;\n\ntype Options = {\n\tnoShadow?: boolean;\n\tcanvas: JSONCanvas;\n\tattachmentDir?: string;\n\textraCSS?: string;\n};\n\nexport interface MapNodeItem {\n\ttype: 'node';\n\tref: JSONCanvasNode;\n\tfileName?: string;\n}\n\nexport interface MapEdgeItem {\n\ttype: 'edge';\n\tref: JSONCanvasEdge;\n\tcontrolPoints?: Array<number>;\n}\n\ntype MapItem = MapEdgeItem | MapNodeItem;\n\ntype CanvasMap = Record<string, MapItem>;\n\nexport default class DataManager extends BaseModule<Options> {\n\tprivate spatialGrid: Record<string, Array<JSONCanvasNode>> | null = null;\n\tonToggleFullscreen = utilities.makeHook<[boolean]>();\n\n\tdata: {\n\t\tcanvasData: Required<JSONCanvas>;\n\t\tcanvasMap: CanvasMap;\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\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tconst parentContainer = this.options.container;\n\t\twhile (parentContainer.firstElementChild) parentContainer.firstElementChild.remove();\n\t\tparentContainer.innerHTML = '';\n\n\t\tconst noShadow = this.options.noShadow || false;\n\t\tconst realContainer = noShadow ? parentContainer : parentContainer.attachShadow({ mode: 'open' });\n\n\t\tutilities.applyStyles(realContainer, style + this.options.extraCSS);\n\n\t\tconst HTMLContainer = document.createElement('div');\n\t\tHTMLContainer.classList.add('container');\n\t\trealContainer.appendChild(HTMLContainer);\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\tthis.data = {\n\t\t\tcanvasData: canvasData,\n\t\t\tcanvasMap: {},\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\tcontainer: HTMLContainer,\n\t\t};\n\n\t\tthis.data.canvasData.nodes.forEach(node => {\n\t\t\tthis.data.canvasMap[node.id] = {\n\t\t\t\ttype: 'node',\n\t\t\t\tref: node,\n\t\t\t};\n\t\t\tconst target = this.data.canvasMap[node.id] as MapNodeItem;\n\t\t\tconst ref = target.ref;\n\t\t\tif (ref.type === 'file') {\n\t\t\t\tconst path = ref.file.split('/');\n\t\t\t\tconst fileName = path.pop() || '';\n\t\t\t\ttarget.fileName = fileName;\n\t\t\t\tif (!ref.file.startsWith('http://') && !ref.file.startsWith('https://'))\n\t\t\t\t\tref.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.canvasMap[edge.id] = {\n\t\t\t\ttype: 'edge',\n\t\t\t\tref: edge,\n\t\t\t};\n\t\t});\n\n\t\tthis.buildSpatialGrid();\n\t\tthis.resetView();\n\t\tthis.onDispose(this.dispose);\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\tfindNodeAt = (screenCoords: Coordinates) => {\n\t\tconst { x, y } = this.C2W(this.C2C({ x: screenCoords.x, y: screenCoords.y }));\n\t\tlet candidates: Array<JSONCanvasNode> = [];\n\t\tif (!this.spatialGrid) candidates = this.data.canvasData.nodes;\n\t\telse {\n\t\t\tconst col = Math.floor(x / GRID_CELL_SIZE);\n\t\t\tconst row = Math.floor(y / GRID_CELL_SIZE);\n\t\t\tconst key = `${col},${row}`;\n\t\t\tcandidates = this.spatialGrid[key] || [];\n\t\t}\n\t\tfor (const node of candidates) {\n\t\t\tif (\n\t\t\t\tx < node.x ||\n\t\t\t\tx > node.x + node.width ||\n\t\t\t\ty < node.y ||\n\t\t\t\ty > node.y + node.height ||\n\t\t\t\tthis.judgeInteract(node) === 'non-interactive'\n\t\t\t)\n\t\t\t\tcontinue;\n\t\t\treturn node;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// how should the app handle node interactions\n\tprivate judgeInteract = (node: JSONCanvasNode | null) => {\n\t\tswitch (node?.type) {\n\t\t\tcase 'text':\n\t\t\tcase 'link':\n\t\t\t\treturn 'select';\n\t\t\tcase 'file': {\n\t\t\t\tif (node.file.match(/\\.(md|wav|mp3)$/i)) return 'select';\n\t\t\t\telse return 'non-interactive';\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn 'non-interactive';\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\tprivate buildSpatialGrid() {\n\t\tconst canvasData = this.data.canvasData;\n\t\tif (canvasData.nodes.length < 50) return;\n\t\tthis.spatialGrid = {};\n\t\tfor (const node of canvasData.nodes) {\n\t\t\tconst minCol = Math.floor(node.x / GRID_CELL_SIZE);\n\t\t\tconst maxCol = Math.floor((node.x + node.width) / GRID_CELL_SIZE);\n\t\t\tconst minRow = Math.floor(node.y / GRID_CELL_SIZE);\n\t\t\tconst maxRow = Math.floor((node.y + node.height) / GRID_CELL_SIZE);\n\t\t\tfor (let col = minCol; col <= maxCol; col++) {\n\t\t\t\tfor (let row = minRow; row <= maxRow; row++) {\n\t\t\t\t\tconst key = `${col},${row}`;\n\t\t\t\t\tif (!this.spatialGrid[key]) this.spatialGrid[key] = [];\n\t\t\t\t\tthis.spatialGrid[key].push(node);\n\t\t\t\t}\n\t\t\t}\n\t\t}\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 = (option: string = 'toggle') => {\n\t\tif (!document.fullscreenElement && (option === 'toggle' || option === 'enter')) {\n\t\t\tthis.data.container.requestFullscreen();\n\t\t\tthis.onToggleFullscreen(true);\n\t\t} else if (document.fullscreenElement && (option === 'toggle' || option === 'exit')) {\n\t\t\tdocument.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\t// Canvas to World\n\tprivate C2W = ({ x: canvasX, y: canvasY }: Coordinates) => ({\n\t\tx: canvasX / this.data.scale,\n\t\ty: canvasY / this.data.scale,\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 { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities from '$/utilities';\n\nexport default class Controller extends BaseModule {\n\tprivate animationId: null | number = null;\n\tprivate resizeAnimationId: null | number = null;\n\tprivate DM: DataManager;\n\tprivate resizeObserver: ResizeObserver;\n\tprivate perFrame = {\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.onStart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.resizeObserver = new ResizeObserver(this.onResize);\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.lastScale = this.DM.data.scale;\n\t\tthis.perFrame.lastOffsets = {\n\t\t\tx: this.DM.data.offsetX,\n\t\t\ty: 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","this","Object","assign","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","getColor","colorIndex","themeColor","length","rgb","hex","cleanHex","replace","r","parseInt","substring","g","b","hexToRgb","border","background","active","makeHook","reverse","result","args","Array","from","subs","forEach","callback","Set","add","unsubscribe","delete","destroyError","GRID_CELL_SIZE","DataManager","spatialGrid","onToggleFullscreen","data","super","parentContainer","firstElementChild","remove","realContainer","noShadow","attachShadow","mode","extraCSS","HTMLContainer","classList","canvasData","nodes","edges","canvasMap","canvasBaseDir","processBaseDir","attachmentDir","nodeBounds","calculateNodeBounds","offsetX","offsetY","id","type","ref","target","fileName","file","split","pop","startsWith","edge","buildSpatialGrid","resetView","dispose","baseDir","lastChar","slice","findNodeAt","screenCoords","C2W","C2C","candidates","key","floor","judgeInteract","match","minX","Infinity","minY","maxX","maxY","min","max","centerX","centerY","minCol","maxCol","minRow","maxRow","col","row","push","zoom","origin","newScale","zoomToScale","validNewScale","canvasCoords","pan","panToCoords","shiftFullscreen","option","fullscreenElement","exitFullscreen","requestFullscreen","bounds","contentWidth","INITIAL_VIEWPORT_PADDING","contentHeight","viewWidth","clientWidth","viewHeight","clientHeight","scaleX","scaleY","initialView","containerX","containerY","canvasX","canvasY","middleViewer","animationId","resizeAnimationId","DM","resizeObserver","perFrame","lastScale","lastOffsets","lastResizeCenter","hooks","onResize","onRefresh","start","get","ResizeObserver","observe","requestAnimationFrame","draw","refresh","center","cancelAnimationFrame","disconnect"],"mappings":"aAWO,MAAMA,EAGZ,WAAAC,CACWC,EACVC,EACAC,EACAC,GAHUC,KAAAJ,UAAAA,EAKVK,OAAOC,OAAOF,KAAKH,QAASA,GAC5BG,KAAKF,QAAUA,EAAQK,UACvBH,KAAKD,UAAYA,EAAUI,SAC5B,CAXAL,QACAC,UAWAF,QAAU,CAAA,QCtBXO,EAAe,CACdC,MAiHD,SAAeC,EAAoBC,GAClC,MAAMC,EAAS,IAAMD,EACrB,OAAOE,KAAKJ,MAAMC,EAAaE,GAAUA,CAC1C,EAnHCE,mBAmGD,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,M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AK6K,GAAG/F,KAAKqB,QAChBpE,EAAG/B,KAAK6K,GAAG/F,KAAKsB,SAEjBpG,KAAKmL,MAAME,aAGJD,SAAW,KAClBpL,KAAK4K,kBAAoBc,sBAAsB,KAC9C,MAAMG,EAAS7L,KAAK6K,GAAGH,eACnB1K,KAAKkL,iBAAiBpJ,GAAK9B,KAAKkL,iBAAiBnJ,IACpD/B,KAAK6K,GAAG/F,KAAKqB,QAAUnG,KAAK6K,GAAG/F,KAAKqB,QAAU0F,EAAO/J,EAAI9B,KAAKkL,iBAAiBpJ,EAC/E9B,KAAK6K,GAAG/F,KAAKsB,QAAUpG,KAAK6K,GAAG/F,KAAKsB,QAAUyF,EAAO9J,EAAI/B,KAAKkL,iBAAiBnJ,GAEhF/B,KAAKkL,iBAAiBpJ,EAAI+J,EAAO/J,EACjC9B,KAAKkL,iBAAiBnJ,EAAI8J,EAAO9J,EACjC/B,KAAKmL,MAAMC,SAASS,EAAOjL,MAAOiL,EAAOhL,QACzCb,KAAK4L,aAIC3E,QAAU,KACbjH,KAAK2K,aAAamB,qBAAqB9L,KAAK2K,aAC5C3K,KAAK4K,mBAAmBkB,qBAAqB9L,KAAK4K,mBACtD5K,KAAK8K,eAAeiB"}
@@ -0,0 +1,2 @@
1
+ class t{constructor(t,e,a,s){this.container=t,Object.assign(this.options,e),this.onStart=a.subscribe,this.onDispose=s.subscribe}onStart;onDispose;options={}}const e={round:function(t,e){const a=10**e;return Math.round(t*a)/a},resizeCanvasForDPR:function(t,e,a){const s=window.devicePixelRatio||1,i=t.getContext("2d");if(!i)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(a*s),i.setTransform(1,0,0,1,0,0),i.scale(s,s)},applyStyles:function(t,e){const a=document.createElement("style");a.innerHTML=e,t.appendChild(a)},drawRoundRect:function(t,e,a,s,i,o){t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+s-o,a),t.quadraticCurveTo(e+s,a,e+s,a+o),t.lineTo(e+s,a+i-o),t.quadraticCurveTo(e+s,a+i,e+s-o,a+i),t.lineTo(e+o,a+i),t.quadraticCurveTo(e,a+i,e,a+i-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()},getAnchorCoord:function(t,e){const a=t.x+t.width/2,s=t.y+t.height/2;switch(e){case"top":return[a,t.y];case"bottom":return[a,t.y+t.height];case"left":return[t.x,s];case"right":return[t.x+t.width,s];default:return[a,s]}},getColor:function(t="0"){let e=null;if(1===t.length)switch(t){case"1":e="rgba(255, 120, 129, ?)";break;case"2":e="rgba(251, 187, 131, ?)";break;case"3":e="rgba(255, 232, 139, ?)";break;case"4":e="rgba(124, 211, 124, ?)";break;case"5":e="rgba(134, 223, 226, ?)";break;case"6":e="rgba(203, 158, 255, ?)";break;default:e="rgba(140, 140, 140, ?)"}else{const a=function(t){const e=t.replace("#","");return{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16)}}(t);e=`rgba(${a.r}, ${a.g}, ${a.b}, ?)`}return{border:e.replace("?","0.75"),background:e.replace("?","0.1"),active:e.replace("?","1")}},makeHook:function(t=!1){const e=(...a)=>{if(t){Array.from(e.subs).reverse().forEach(t=>{t(...a)})}else e.subs.forEach(t=>{t(...a)})};return e.subs=/* @__PURE__ */new Set,e.subscribe=t=>{e.subs.add(t)},e.unsubscribe=t=>{e.subs.delete(t)},e}},a=new Error("[JSONCanvasViewer] Resource hasn't been set up or has been disposed.");const s=800;class i extends t{spatialGrid=null;onToggleFullscreen=e.makeHook();data;constructor(...t){super(...t);const a=this.options.container;for(;a.firstElementChild;)a.firstElementChild.remove();a.innerHTML="";const s=this.options.noShadow||!1?a:a.attachShadow({mode:"open"});e.applyStyles(s,".full,.click-layer,.link-iframe,.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}.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:#fff;fill:#fff;stroke:#fff;position:relative;width:100%;height:100%;overflow:hidden;background-color:#141414}.container.numb,.container.numb *{pointer-events:none!important}.main-canvas{width:100%;height:100%;transform-origin:top left}.overlays{position:absolute;top:0;left:0;width:10000px;height:10000px;transform-origin:top left;will-change:transform}.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){.parsed-content-wrapper{padding:10px}}.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}.overlay-container:hover{box-shadow:0 2px 12px #00000080}.overlay-container{transition:var(--containerTransition)}.overlay-container .overlay-border{box-sizing:border-box;pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:12px;transition:var(--containerTransition)}.overlay-container img{width:100%;height:100%;object-fit:cover;pointer-events:none}.overlay-container.active .overlay-border{border:6px solid var(--active-color)}.overlay-container.markdown-content{position:absolute;padding:0 7px}.overlay-container.markdown-content.active .parsed-content-wrapper{overflow:auto;-webkit-user-select:text;user-select:text;pointer-events:auto}.overlay-container.markdown-content.rtl{direction:rtl;text-align:right}.link-iframe,.audio{border:none;background:transparent}.click-layer{background:transparent;pointer-events:auto}.active .click-layer{pointer-events:none}::-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);const i=document.createElement("div");i.classList.add("container"),s.appendChild(i);const o=Object.assign({nodes:[],edges:[]},this.options.canvas);this.data={canvasData:o,canvasMap:{},canvasBaseDir:this.processBaseDir(this.options.attachmentDir),nodeBounds:this.calculateNodeBounds(o),offsetX:0,offsetY:0,scale:1,container:i},this.data.canvasData.nodes.forEach(t=>{this.data.canvasMap[t.id]={type:"node",ref:t};const e=this.data.canvasMap[t.id],a=e.ref;if("file"===a.type){const t=a.file.split("/").pop()||"";e.fileName=t,a.file.startsWith("http://")||a.file.startsWith("https://")||(a.file=this.data.canvasBaseDir+t)}}),this.data.canvasData.edges.forEach(t=>{this.data.canvasMap[t.id]={type:"edge",ref:t}}),this.buildSpatialGrid(),this.resetView(),this.onDispose(this.dispose)}processBaseDir=t=>{if(!t)return"./";const e=t?.slice(-1);return"/"===e?t:`${t}/`};findNodeAt=t=>{const{x:e,y:a}=this.C2W(this.C2C({x:t.x,y:t.y}));let i=[];if(this.spatialGrid){const t=`${Math.floor(e/s)},${Math.floor(a/s)}`;i=this.spatialGrid[t]||[]}else i=this.data.canvasData.nodes;for(const s of i)if(!(e<s.x||e>s.x+s.width||a<s.y||a>s.y+s.height||"non-interactive"===this.judgeInteract(s)))return s;return null};judgeInteract=t=>{switch(t?.type){case"text":case"link":return"select";case"file":return t.file.match(/\.(md|wav|mp3)$/i)?"select":"non-interactive";default:return"non-interactive"}};calculateNodeBounds(t){let e=1/0,a=1/0,s=-1/0,i=-1/0;t.nodes.forEach(t=>{e=Math.min(e,t.x),a=Math.min(a,t.y),s=Math.max(s,t.x+t.width),i=Math.max(i,t.y+t.height)});const o=s-e,n=i-a;return{minX:e,minY:a,maxX:s,maxY:i,width:o,height:n,centerX:e+o/2,centerY:a+n/2}}buildSpatialGrid(){const t=this.data.canvasData;if(!(t.nodes.length<50)){this.spatialGrid={};for(const e of t.nodes){const t=Math.floor(e.x/s),a=Math.floor((e.x+e.width)/s),i=Math.floor(e.y/s),o=Math.floor((e.y+e.height)/s);for(let s=t;s<=a;s++)for(let t=i;t<=o;t++){const a=`${s},${t}`;this.spatialGrid[a]||(this.spatialGrid[a]=[]),this.spatialGrid[a].push(e)}}}}zoom=(t,e)=>{const a=this.data.scale*t;this.zoomToScale(a,e)};zoomToScale=(t,e)=>{const a=Math.max(Math.min(t,20),.05),s=this.data.scale;if(a===s)return;const i=this.C2C(e);this.data.offsetX=e.x-i.x*a/s,this.data.offsetY=e.y-i.y*a/s,this.data.scale=a};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=(t="toggle")=>{document.fullscreenElement||"toggle"!==t&&"enter"!==t?!document.fullscreenElement||"toggle"!==t&&"exit"!==t||(document.exitFullscreen(),this.onToggleFullscreen(!1)):(this.data.container.requestFullscreen(),this.onToggleFullscreen(!0))};resetView=()=>{const t=this.data.nodeBounds,e=this.data.container;if(!t||!e)return;const a=t.width+200,s=t.height+200,i=e.clientWidth,o=e.clientHeight,n=i/a,r=o/s,c=Math.round(1e3*Math.min(n,r))/1e3,h={scale:c,offsetX:i/2-t.centerX*c,offsetY:o/2-t.centerY*c};this.data.offsetX=h.offsetX,this.data.offsetY=h.offsetY,this.data.scale=h.scale};C2C=({x:t,y:e})=>({x:t-this.data.offsetX,y:e-this.data.offsetY});C2W=({x:t,y:e})=>({x:t/this.data.scale,y:e/this.data.scale});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()}class o extends t{animationId=null;resizeAnimationId=null;DM;resizeObserver;perFrame={lastScale:1,lastOffsets:{x:0,y:0}};lastResizeCenter={x:null,y:null};hooks={onResize:e.makeHook(),onRefresh:e.makeHook()};constructor(...t){super(...t),this.onStart(this.start),this.onDispose(this.dispose),this.DM=this.container.get(i),this.resizeObserver=new ResizeObserver(this.onResize)}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,this.perFrame.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{t as B,o as C,i as D,a as d,e as u};
2
+ //# sourceMappingURL=controller-UN-hOZ_r.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-UN-hOZ_r.js","sources":["../src/core/baseModule.ts","../src/core/utilities.ts","../src/core/dataManager.ts","../src/core/controller.ts"],"sourcesContent":["import type { Container } from '@needle-di/core';\nimport type { DefaultOptions, Empty, GeneralFunction, GeneralObject } from '$/declarations';\nimport type utilities from '$/utilities';\n\ntype Hook = ReturnType<typeof utilities.makeHook>;\n\nexport type BaseArgs = [Container, GeneralObject, Hook, Hook];\n\nexport type GeneralModuleCtor = typeof BaseModule<GeneralObject>;\nexport type GeneralModule = BaseModule<GeneralObject>;\n\nexport class BaseModule<O extends GeneralObject = Empty> {\n\tonStart: (callback: GeneralFunction) => void;\n\tonDispose: (callback: GeneralFunction) => void;\n\tconstructor(\n\t\tprotected container: Container,\n\t\toptions: GeneralObject,\n\t\tonStart: Hook,\n\t\tonDispose: Hook,\n\t) {\n\t\tObject.assign(this.options, options);\n\t\tthis.onStart = onStart.subscribe;\n\t\tthis.onDispose = onDispose.subscribe;\n\t}\n\toptions = {} as DefaultOptions & O;\n}\n","import type { GeneralArguments } from '$/declarations';\n\nexport default {\n\tround,\n\tresizeCanvasForDPR,\n\tapplyStyles,\n\tdrawRoundRect,\n\tgetAnchorCoord,\n\tgetColor,\n\tmakeHook,\n};\n\nexport const destroyError = new Error(\"[JSONCanvasViewer] Resource hasn't been set up or has been disposed.\");\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 [midX, node.y];\n\t\tcase 'bottom':\n\t\t\treturn [midX, node.y + node.height];\n\t\tcase 'left':\n\t\t\treturn [node.x, midY];\n\t\tcase 'right':\n\t\t\treturn [node.x + node.width, midY];\n\t\tdefault:\n\t\t\treturn [midX, midY];\n\t}\n}\n\nfunction getColor(colorIndex: string = '0') {\n\tlet themeColor = null;\n\n\tfunction hexToRgb(hex: string) {\n\t\tconst cleanHex = hex.replace('#', '');\n\t\tconst r = parseInt(cleanHex.substring(0, 2), 16);\n\t\tconst g = parseInt(cleanHex.substring(2, 4), 16);\n\t\tconst b = parseInt(cleanHex.substring(4, 6), 16);\n\t\treturn { r, g, b };\n\t}\n\n\tif (colorIndex.length === 1) {\n\t\tswitch (colorIndex) {\n\t\t\tcase '1':\n\t\t\t\tthemeColor = 'rgba(255, 120, 129, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '2':\n\t\t\t\tthemeColor = 'rgba(251, 187, 131, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '3':\n\t\t\t\tthemeColor = 'rgba(255, 232, 139, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '4':\n\t\t\t\tthemeColor = 'rgba(124, 211, 124, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '5':\n\t\t\t\tthemeColor = 'rgba(134, 223, 226, ?)';\n\t\t\t\tbreak;\n\t\t\tcase '6':\n\t\t\t\tthemeColor = 'rgba(203, 158, 255, ?)';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthemeColor = 'rgba(140, 140, 140, ?)';\n\t\t}\n\t} else {\n\t\tconst rgb = hexToRgb(colorIndex);\n\t\tthemeColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ?)`;\n\t}\n\treturn {\n\t\tborder: themeColor.replace('?', '0.75'),\n\t\tbackground: themeColor.replace('?', '0.1'),\n\t\tactive: themeColor.replace('?', '1'),\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 { Coordinates, NodeBounds } from '$/declarations';\nimport style from '$/styles.scss?inline';\nimport utilities from '$/utilities';\n\nconst GRID_CELL_SIZE = 800;\nconst INITIAL_VIEWPORT_PADDING = 100;\n\ntype Options = {\n\tnoShadow?: boolean;\n\tcanvas: JSONCanvas;\n\tattachmentDir?: string;\n\textraCSS?: string;\n};\n\nexport interface MapNodeItem {\n\ttype: 'node';\n\tref: JSONCanvasNode;\n\tfileName?: string;\n}\n\nexport interface MapEdgeItem {\n\ttype: 'edge';\n\tref: JSONCanvasEdge;\n\tcontrolPoints?: Array<number>;\n}\n\ntype MapItem = MapEdgeItem | MapNodeItem;\n\ntype CanvasMap = Record<string, MapItem>;\n\nexport default class DataManager extends BaseModule<Options> {\n\tprivate spatialGrid: Record<string, Array<JSONCanvasNode>> | null = null;\n\tonToggleFullscreen = utilities.makeHook<[boolean]>();\n\n\tdata: {\n\t\tcanvasData: Required<JSONCanvas>;\n\t\tcanvasMap: CanvasMap;\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\n\tconstructor(...args: BaseArgs) {\n\t\tsuper(...args);\n\t\tconst parentContainer = this.options.container;\n\t\twhile (parentContainer.firstElementChild) parentContainer.firstElementChild.remove();\n\t\tparentContainer.innerHTML = '';\n\n\t\tconst noShadow = this.options.noShadow || false;\n\t\tconst realContainer = noShadow ? parentContainer : parentContainer.attachShadow({ mode: 'open' });\n\n\t\tutilities.applyStyles(realContainer, style + this.options.extraCSS);\n\n\t\tconst HTMLContainer = document.createElement('div');\n\t\tHTMLContainer.classList.add('container');\n\t\trealContainer.appendChild(HTMLContainer);\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\tthis.data = {\n\t\t\tcanvasData: canvasData,\n\t\t\tcanvasMap: {},\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\tcontainer: HTMLContainer,\n\t\t};\n\n\t\tthis.data.canvasData.nodes.forEach(node => {\n\t\t\tthis.data.canvasMap[node.id] = {\n\t\t\t\ttype: 'node',\n\t\t\t\tref: node,\n\t\t\t};\n\t\t\tconst target = this.data.canvasMap[node.id] as MapNodeItem;\n\t\t\tconst ref = target.ref;\n\t\t\tif (ref.type === 'file') {\n\t\t\t\tconst path = ref.file.split('/');\n\t\t\t\tconst fileName = path.pop() || '';\n\t\t\t\ttarget.fileName = fileName;\n\t\t\t\tif (!ref.file.startsWith('http://') && !ref.file.startsWith('https://'))\n\t\t\t\t\tref.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.canvasMap[edge.id] = {\n\t\t\t\ttype: 'edge',\n\t\t\t\tref: edge,\n\t\t\t};\n\t\t});\n\n\t\tthis.buildSpatialGrid();\n\t\tthis.resetView();\n\t\tthis.onDispose(this.dispose);\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\tfindNodeAt = (screenCoords: Coordinates) => {\n\t\tconst { x, y } = this.C2W(this.C2C({ x: screenCoords.x, y: screenCoords.y }));\n\t\tlet candidates: Array<JSONCanvasNode> = [];\n\t\tif (!this.spatialGrid) candidates = this.data.canvasData.nodes;\n\t\telse {\n\t\t\tconst col = Math.floor(x / GRID_CELL_SIZE);\n\t\t\tconst row = Math.floor(y / GRID_CELL_SIZE);\n\t\t\tconst key = `${col},${row}`;\n\t\t\tcandidates = this.spatialGrid[key] || [];\n\t\t}\n\t\tfor (const node of candidates) {\n\t\t\tif (\n\t\t\t\tx < node.x ||\n\t\t\t\tx > node.x + node.width ||\n\t\t\t\ty < node.y ||\n\t\t\t\ty > node.y + node.height ||\n\t\t\t\tthis.judgeInteract(node) === 'non-interactive'\n\t\t\t)\n\t\t\t\tcontinue;\n\t\t\treturn node;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// how should the app handle node interactions\n\tprivate judgeInteract = (node: JSONCanvasNode | null) => {\n\t\tswitch (node?.type) {\n\t\t\tcase 'text':\n\t\t\tcase 'link':\n\t\t\t\treturn 'select';\n\t\t\tcase 'file': {\n\t\t\t\tif (node.file.match(/\\.(md|wav|mp3)$/i)) return 'select';\n\t\t\t\telse return 'non-interactive';\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn 'non-interactive';\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\tprivate buildSpatialGrid() {\n\t\tconst canvasData = this.data.canvasData;\n\t\tif (canvasData.nodes.length < 50) return;\n\t\tthis.spatialGrid = {};\n\t\tfor (const node of canvasData.nodes) {\n\t\t\tconst minCol = Math.floor(node.x / GRID_CELL_SIZE);\n\t\t\tconst maxCol = Math.floor((node.x + node.width) / GRID_CELL_SIZE);\n\t\t\tconst minRow = Math.floor(node.y / GRID_CELL_SIZE);\n\t\t\tconst maxRow = Math.floor((node.y + node.height) / GRID_CELL_SIZE);\n\t\t\tfor (let col = minCol; col <= maxCol; col++) {\n\t\t\t\tfor (let row = minRow; row <= maxRow; row++) {\n\t\t\t\t\tconst key = `${col},${row}`;\n\t\t\t\t\tif (!this.spatialGrid[key]) this.spatialGrid[key] = [];\n\t\t\t\t\tthis.spatialGrid[key].push(node);\n\t\t\t\t}\n\t\t\t}\n\t\t}\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 = (option: string = 'toggle') => {\n\t\tif (!document.fullscreenElement && (option === 'toggle' || option === 'enter')) {\n\t\t\tthis.data.container.requestFullscreen();\n\t\t\tthis.onToggleFullscreen(true);\n\t\t} else if (document.fullscreenElement && (option === 'toggle' || option === 'exit')) {\n\t\t\tdocument.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\t// Canvas to World\n\tprivate C2W = ({ x: canvasX, y: canvasY }: Coordinates) => ({\n\t\tx: canvasX / this.data.scale,\n\t\ty: canvasY / this.data.scale,\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 { type BaseArgs, BaseModule } from '$/baseModule';\nimport DataManager from '$/dataManager';\nimport utilities from '$/utilities';\n\nexport default class Controller extends BaseModule {\n\tprivate animationId: null | number = null;\n\tprivate resizeAnimationId: null | number = null;\n\tprivate DM: DataManager;\n\tprivate resizeObserver: ResizeObserver;\n\tprivate perFrame = {\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.onStart(this.start);\n\t\tthis.onDispose(this.dispose);\n\t\tthis.DM = this.container.get(DataManager);\n\t\tthis.resizeObserver = new ResizeObserver(this.onResize);\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.lastScale = this.DM.data.scale;\n\t\tthis.perFrame.lastOffsets = {\n\t\t\tx: this.DM.data.offsetX,\n\t\t\ty: 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","this","Object","assign","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","getColor","colorIndex","themeColor","length","rgb","hex","cleanHex","replace","r","parseInt","substring","g","b","hexToRgb","border","background","active","makeHook","reverse","result","args","Array","from","subs","forEach","callback","Set","add","unsubscribe","delete","destroyError","GRID_CELL_SIZE","DataManager","spatialGrid","onToggleFullscreen","data","super","parentContainer","firstElementChild","remove","realContainer","noShadow","attachShadow","mode","extraCSS","HTMLContainer","classList","canvasData","nodes","edges","canvasMap","canvasBaseDir","processBaseDir","attachmentDir","nodeBounds","calculateNodeBounds","offsetX","offsetY","id","type","ref","target","fileName","file","split","pop","startsWith","edge","buildSpatialGrid","resetView","dispose","baseDir","lastChar","slice","findNodeAt","screenCoords","C2W","C2C","candidates","key","floor","judgeInteract","match","minX","Infinity","minY","maxX","maxY","min","max","centerX","centerY","minCol","maxCol","minRow","maxRow","col","row","push","zoom","origin","newScale","zoomToScale","validNewScale","canvasCoords","pan","panToCoords","shiftFullscreen","option","fullscreenElement","exitFullscreen","requestFullscreen","bounds","contentWidth","INITIAL_VIEWPORT_PADDING","contentHeight","viewWidth","clientWidth","viewHeight","clientHeight","scaleX","scaleY","initialView","containerX","containerY","canvasX","canvasY","middleViewer","Controller","animationId","resizeAnimationId","DM","resizeObserver","perFrame","lastScale","lastOffsets","lastResizeCenter","hooks","onResize","onRefresh","start","get","ResizeObserver","observe","requestAnimationFrame","draw","refresh","center","cancelAnimationFrame","disconnect"],"mappings":"AAWO,MAAMA,EAGZ,WAAAC,CACWC,EACVC,EACAC,EACAC,GAHUC,KAAAJ,UAAAA,EAKVK,OAAOC,OAAOF,KAAKH,QAASA,GAC5BG,KAAKF,QAAUA,EA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6K,mBACtD7K,KAAK+K,eAAeiB"}
package/dist/dev.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./controller--Q72jFEw.cjs"),r=require("./renderer-D9iInH9_.cjs");exports.BaseModule=e.BaseModule,exports.Controller=e.Controller,exports.DataManager=e.DataManager,exports.canvasUtils=e.utilities,exports.InteractionHandler=r.InteractionHandler,exports.OverlayManager=r.OverlayManager,exports.Renderer=r.Renderer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./controller-CnUlrkdp.cjs"),r=require("./renderer-Bzv3aLXp.cjs");exports.BaseModule=e.BaseModule,exports.Controller=e.Controller,exports.DataManager=e.DataManager,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 s}from"./controller-siZ5v-SD.js";import{I as o,O as n,R as t}from"./renderer-CZ85ZN6O.js";export{a as BaseModule,r as Controller,e as DataManager,o as InteractionHandler,n as OverlayManager,t as Renderer,s as canvasUtils};
1
+ import{B as a,C as r,D as e,u as s}from"./controller-UN-hOZ_r.js";import{I as o,O as n,R as t}from"./renderer-NPxavnke.js";export{a as BaseModule,r as Controller,e as DataManager,o as InteractionHandler,n as OverlayManager,t as Renderer,s as canvasUtils};
2
2
  //# sourceMappingURL=dev.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const i=require("@needle-di/core"),t=require("./controller--Q72jFEw.cjs"),o=require("./renderer-D9iInH9_.cjs");exports.JSONCanvasViewer=class{options;allModules;IO=null;onStart=t.utilities.makeHook();onDispose=t.utilities.makeHook(!0);container;constructor(e,s){this.container=new i.Container,this.options=e;this.allModules=[t.DataManager,t.Controller,o.OverlayManager,o.InteractionHandler,o.Renderer,...s||[]],this.allModules.forEach(i=>{this.container.bind({provide:i,useFactory:()=>new i(this.container,this.options,this.onStart,this.onDispose)})}),this.options.lazyLoading?(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container)):this.load()}load=()=>{this.allModules.forEach(i=>{this.container.get(i)}),this.onStart()};onVisibilityCheck=i=>{i.forEach(i=>{if(i.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};dispose=()=>{this.IO?.disconnect(),this.IO=null;const i=this.options.container;for(;i.firstChild;)i.firstChild.remove();this.onDispose(),this.container.unbindAll()}};
2
- //# sourceMappingURL=index-BSkMdAcV.cjs.map
1
+ "use strict";const i=require("@needle-di/core"),t=require("./controller-CnUlrkdp.cjs"),o=require("./renderer-Bzv3aLXp.cjs");exports.JSONCanvasViewer=class{options;allModules;IO=null;onStart=t.utilities.makeHook();onDispose=t.utilities.makeHook(!0);container;constructor(e,s){this.container=new i.Container,this.options=e;this.allModules=[t.DataManager,t.Controller,o.OverlayManager,o.InteractionHandler,o.Renderer,...s||[]],this.allModules.forEach(i=>{this.container.bind({provide:i,useFactory:()=>new i(this.container,this.options,this.onStart,this.onDispose)})}),this.options.lazyLoading?(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container)):this.load()}load=()=>{this.allModules.forEach(i=>{this.container.get(i)}),this.onStart()};onVisibilityCheck=i=>{i.forEach(i=>{if(i.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};dispose=()=>{this.IO?.disconnect(),this.IO=null;const i=this.options.container;for(;i.firstChild;)i.firstChild.remove();this.onDispose(),this.container.unbindAll()}};
2
+ //# sourceMappingURL=index-RXeXyAu0.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BSkMdAcV.cjs","sources":["../src/core/index.ts"],"sourcesContent":["import { Container } from '@needle-di/core';\nimport type { GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport utilities from '$/utilities';\n\nexport default class JSONCanvasViewer<M extends ModuleInputCtor = []> {\n\tprivate options: UserOptions<M>;\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onStart = utilities.makeHook();\n\tprivate onDispose = utilities.makeHook(true);\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: () => new Class(this.container, this.options, this.onStart, this.onDispose),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\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\n\t\tthis.allModules.forEach(bind);\n\t\tif (this.options.lazyLoading) {\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} else this.load();\n\t}\n\n\tprivate load = () => {\n\t\tthis.allModules.forEach(Module => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\t\tthis.onStart();\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\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"],"names":["options","allModules","IO","onStart","utilities","makeHook","onDispose","container","constructor","modules","this","Container","DataManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","lazyLoading","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","load","Module","get","entries","entry","isIntersecting","disconnect","dispose","firstChild","remove","unbindAll"],"mappings":"qJAUA,MACSA,QACAC,WACAC,GAAkC,KAClCC,QAAUC,EAAAA,UAAUC,WACpBC,UAAYF,EAAAA,UAAUC,UAAS,GACvCE,UAEA,WAAAC,CAAYR,EAAyBS,GACpCC,KAAKH,UAAY,IAAII,YACrBD,KAAKV,QAAUA,EAOfU,KAAKT,WAAa,CACjBW,EAAAA,YACAC,EAAAA,WACAC,EAAAA,eACAC,EAAAA,mBACAC,EAAAA,YACIP,GAAW,IAGhBC,KAAKT,WAAWgB,QAfFC,IACbR,KAAKH,UAAUY,KAAK,CACnBC,QAASF,EACTG,WAAY,IAAM,IAAIH,EAAMR,KAAKH,UAAWG,KAAKV,QAASU,KAAKP,QAASO,KAAKJ,eAa3EI,KAAKV,QAAQsB,aAChBZ,KAAKR,GAAK,IAAIqB,qBAAqBb,KAAKc,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZjB,KAAKR,GAAG0B,QAAQlB,KAAKV,QAAQO,iBAClBsB,MACb,CAEQA,KAAO,KACdnB,KAAKT,WAAWgB,QAAQa,IACvBpB,KAAKH,UAAUwB,IAAID,KAEpBpB,KAAKP,WAGEqB,kBAAqBQ,IAC5BA,EAAQf,QAAQgB,IACf,GAAIA,EAAMC,eAIT,OAHAxB,KAAKmB,OACLnB,KAAKR,IAAIiC,kBACTzB,KAAKR,GAAK,SAMbkC,QAAU,KACT1B,KAAKR,IAAIiC,aACTzB,KAAKR,GAAK,KACV,MAAMK,EAAYG,KAAKV,QAAQO,UAC/B,KAAOA,EAAU8B,YAAY9B,EAAU8B,WAAWC,SAClD5B,KAAKJ,YACLI,KAAKH,UAAUgC"}
1
+ {"version":3,"file":"index-RXeXyAu0.cjs","sources":["../src/core/index.ts"],"sourcesContent":["import { Container } from '@needle-di/core';\nimport type { GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport utilities from '$/utilities';\n\nexport default class JSONCanvasViewer<M extends ModuleInputCtor = []> {\n\tprivate options: UserOptions<M>;\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onStart = utilities.makeHook();\n\tprivate onDispose = utilities.makeHook(true);\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: () => new Class(this.container, this.options, this.onStart, this.onDispose),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\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\n\t\tthis.allModules.forEach(bind);\n\t\tif (this.options.lazyLoading) {\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} else this.load();\n\t}\n\n\tprivate load = () => {\n\t\tthis.allModules.forEach(Module => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\t\tthis.onStart();\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\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"],"names":["options","allModules","IO","onStart","utilities","makeHook","onDispose","container","constructor","modules","this","Container","DataManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","lazyLoading","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","load","Module","get","entries","entry","isIntersecting","disconnect","dispose","firstChild","remove","unbindAll"],"mappings":"qJAUA,MACSA,QACAC,WACAC,GAAkC,KAClCC,QAAUC,EAAAA,UAAUC,WACpBC,UAAYF,EAAAA,UAAUC,UAAS,GACvCE,UAEA,WAAAC,CAAYR,EAAyBS,GACpCC,KAAKH,UAAY,IAAII,YACrBD,KAAKV,QAAUA,EAOfU,KAAKT,WAAa,CACjBW,EAAAA,YACAC,EAAAA,WACAC,EAAAA,eACAC,EAAAA,mBACAC,EAAAA,YACIP,GAAW,IAGhBC,KAAKT,WAAWgB,QAfFC,IACbR,KAAKH,UAAUY,KAAK,CACnBC,QAASF,EACTG,WAAY,IAAM,IAAIH,EAAMR,KAAKH,UAAWG,KAAKV,QAASU,KAAKP,QAASO,KAAKJ,eAa3EI,KAAKV,QAAQsB,aAChBZ,KAAKR,GAAK,IAAIqB,qBAAqBb,KAAKc,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZjB,KAAKR,GAAG0B,QAAQlB,KAAKV,QAAQO,iBAClBsB,MACb,CAEQA,KAAO,KACdnB,KAAKT,WAAWgB,QAAQa,IACvBpB,KAAKH,UAAUwB,IAAID,KAEpBpB,KAAKP,WAGEqB,kBAAqBQ,IAC5BA,EAAQf,QAAQgB,IACf,GAAIA,EAAMC,eAIT,OAHAxB,KAAKmB,OACLnB,KAAKR,IAAIiC,kBACTzB,KAAKR,GAAK,SAMbkC,QAAU,KACT1B,KAAKR,IAAIiC,aACTzB,KAAKR,GAAK,KACV,MAAMK,EAAYG,KAAKV,QAAQO,UAC/B,KAAOA,EAAU8B,YAAY9B,EAAU8B,WAAWC,SAClD5B,KAAKJ,YACLI,KAAKH,UAAUgC"}
@@ -1,2 +1,2 @@
1
- import{Container as o}from"@needle-di/core";import{u as i,D as s,C as t}from"./controller-siZ5v-SD.js";import{O as n,I as e,R as r}from"./renderer-CZ85ZN6O.js";class a{options;allModules;IO=null;onStart=i.makeHook();onDispose=i.makeHook(!0);container;constructor(i,a){this.container=new o,this.options=i;this.allModules=[s,t,n,e,r,...a||[]],this.allModules.forEach(o=>{this.container.bind({provide:o,useFactory:()=>new o(this.container,this.options,this.onStart,this.onDispose)})}),this.options.lazyLoading?(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container)):this.load()}load=()=>{this.allModules.forEach(o=>{this.container.get(o)}),this.onStart()};onVisibilityCheck=o=>{o.forEach(o=>{if(o.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};dispose=()=>{this.IO?.disconnect(),this.IO=null;const o=this.options.container;for(;o.firstChild;)o.firstChild.remove();this.onDispose(),this.container.unbindAll()}}export{a as J};
2
- //# sourceMappingURL=index-u8PUIMyl.js.map
1
+ import{Container as o}from"@needle-di/core";import{u as i,D as s,C as t}from"./controller-UN-hOZ_r.js";import{O as n,I as e,R as r}from"./renderer-NPxavnke.js";class a{options;allModules;IO=null;onStart=i.makeHook();onDispose=i.makeHook(!0);container;constructor(i,a){this.container=new o,this.options=i;this.allModules=[s,t,n,e,r,...a||[]],this.allModules.forEach(o=>{this.container.bind({provide:o,useFactory:()=>new o(this.container,this.options,this.onStart,this.onDispose)})}),this.options.lazyLoading?(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container)):this.load()}load=()=>{this.allModules.forEach(o=>{this.container.get(o)}),this.onStart()};onVisibilityCheck=o=>{o.forEach(o=>{if(o.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};dispose=()=>{this.IO?.disconnect(),this.IO=null;const o=this.options.container;for(;o.firstChild;)o.firstChild.remove();this.onDispose(),this.container.unbindAll()}}export{a as J};
2
+ //# sourceMappingURL=index-ujiv9m9Y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-u8PUIMyl.js","sources":["../src/core/index.ts"],"sourcesContent":["import { Container } from '@needle-di/core';\nimport type { GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport utilities from '$/utilities';\n\nexport default class JSONCanvasViewer<M extends ModuleInputCtor = []> {\n\tprivate options: UserOptions<M>;\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onStart = utilities.makeHook();\n\tprivate onDispose = utilities.makeHook(true);\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: () => new Class(this.container, this.options, this.onStart, this.onDispose),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\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\n\t\tthis.allModules.forEach(bind);\n\t\tif (this.options.lazyLoading) {\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} else this.load();\n\t}\n\n\tprivate load = () => {\n\t\tthis.allModules.forEach(Module => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\t\tthis.onStart();\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\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"],"names":["JSONCanvasViewer","options","allModules","IO","onStart","utilities","makeHook","onDispose","container","constructor","modules","this","Container","DataManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","lazyLoading","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","load","Module","get","entries","entry","isIntersecting","disconnect","dispose","firstChild","remove","unbindAll"],"mappings":"gKAUA,MAAqBA,EACZC,QACAC,WACAC,GAAkC,KAClCC,QAAUC,EAAUC,WACpBC,UAAYF,EAAUC,UAAS,GACvCE,UAEA,WAAAC,CAAYR,EAAyBS,GACpCC,KAAKH,UAAY,IAAII,EACrBD,KAAKV,QAAUA,EAOfU,KAAKT,WAAa,CACjBW,EACAC,EACAC,EACAC,EACAC,KACIP,GAAW,IAGhBC,KAAKT,WAAWgB,QAfFC,IACbR,KAAKH,UAAUY,KAAK,CACnBC,QAASF,EACTG,WAAY,IAAM,IAAIH,EAAMR,KAAKH,UAAWG,KAAKV,QAASU,KAAKP,QAASO,KAAKJ,eAa3EI,KAAKV,QAAQsB,aAChBZ,KAAKR,GAAK,IAAIqB,qBAAqBb,KAAKc,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZjB,KAAKR,GAAG0B,QAAQlB,KAAKV,QAAQO,iBAClBsB,MACb,CAEQA,KAAO,KACdnB,KAAKT,WAAWgB,QAAQa,IACvBpB,KAAKH,UAAUwB,IAAID,KAEpBpB,KAAKP,WAGEqB,kBAAqBQ,IAC5BA,EAAQf,QAAQgB,IACf,GAAIA,EAAMC,eAIT,OAHAxB,KAAKmB,OACLnB,KAAKR,IAAIiC,kBACTzB,KAAKR,GAAK,SAMbkC,QAAU,KACT1B,KAAKR,IAAIiC,aACTzB,KAAKR,GAAK,KACV,MAAMK,EAAYG,KAAKV,QAAQO,UAC/B,KAAOA,EAAU8B,YAAY9B,EAAU8B,WAAWC,SAClD5B,KAAKJ,YACLI,KAAKH,UAAUgC"}
1
+ {"version":3,"file":"index-ujiv9m9Y.js","sources":["../src/core/index.ts"],"sourcesContent":["import { Container } from '@needle-di/core';\nimport type { GeneralModuleCtor } from '$/baseModule';\nimport Controller from '$/controller';\nimport DataManager from '$/dataManager';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport InteractionHandler from '$/interactionHandler';\nimport OverlayManager from '$/overlayManager';\nimport Renderer from '$/renderer';\nimport utilities from '$/utilities';\n\nexport default class JSONCanvasViewer<M extends ModuleInputCtor = []> {\n\tprivate options: UserOptions<M>;\n\tprivate allModules: ModuleInputCtor;\n\tprivate IO: IntersectionObserver | null = null;\n\tprivate onStart = utilities.makeHook();\n\tprivate onDispose = utilities.makeHook(true);\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: () => new Class(this.container, this.options, this.onStart, this.onDispose),\n\t\t\t});\n\t\t};\n\t\tthis.allModules = [\n\t\t\tDataManager,\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\n\t\tthis.allModules.forEach(bind);\n\t\tif (this.options.lazyLoading) {\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} else this.load();\n\t}\n\n\tprivate load = () => {\n\t\tthis.allModules.forEach(Module => {\n\t\t\tthis.container.get(Module);\n\t\t});\n\t\tthis.onStart();\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\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"],"names":["JSONCanvasViewer","options","allModules","IO","onStart","utilities","makeHook","onDispose","container","constructor","modules","this","Container","DataManager","Controller","OverlayManager","InteractionHandler","Renderer","forEach","Class","bind","provide","useFactory","lazyLoading","IntersectionObserver","onVisibilityCheck","root","rootMargin","threshold","observe","load","Module","get","entries","entry","isIntersecting","disconnect","dispose","firstChild","remove","unbindAll"],"mappings":"gKAUA,MAAqBA,EACZC,QACAC,WACAC,GAAkC,KAClCC,QAAUC,EAAUC,WACpBC,UAAYF,EAAUC,UAAS,GACvCE,UAEA,WAAAC,CAAYR,EAAyBS,GACpCC,KAAKH,UAAY,IAAII,EACrBD,KAAKV,QAAUA,EAOfU,KAAKT,WAAa,CACjBW,EACAC,EACAC,EACAC,EACAC,KACIP,GAAW,IAGhBC,KAAKT,WAAWgB,QAfFC,IACbR,KAAKH,UAAUY,KAAK,CACnBC,QAASF,EACTG,WAAY,IAAM,IAAIH,EAAMR,KAAKH,UAAWG,KAAKV,QAASU,KAAKP,QAASO,KAAKJ,eAa3EI,KAAKV,QAAQsB,aAChBZ,KAAKR,GAAK,IAAIqB,qBAAqBb,KAAKc,kBAAmB,CAC1DC,KAAM,KACNC,WAAY,OACZC,UAAW,IAEZjB,KAAKR,GAAG0B,QAAQlB,KAAKV,QAAQO,iBAClBsB,MACb,CAEQA,KAAO,KACdnB,KAAKT,WAAWgB,QAAQa,IACvBpB,KAAKH,UAAUwB,IAAID,KAEpBpB,KAAKP,WAGEqB,kBAAqBQ,IAC5BA,EAAQf,QAAQgB,IACf,GAAIA,EAAMC,eAIT,OAHAxB,KAAKmB,OACLnB,KAAKR,IAAIiC,kBACTzB,KAAKR,GAAK,SAMbkC,QAAU,KACT1B,KAAKR,IAAIiC,aACTzB,KAAKR,GAAK,KACV,MAAMK,EAAYG,KAAKV,QAAQO,UAC/B,KAAOA,EAAU8B,YAAY9B,EAAU8B,WAAWC,SAClD5B,KAAKJ,YACLI,KAAKH,UAAUgC"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BSkMdAcV.cjs");exports.JSONCanvasViewer=e.JSONCanvasViewer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-RXeXyAu0.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-u8PUIMyl.js";export{e as JSONCanvasViewer};
1
+ import{J as e}from"./index-ujiv9m9Y.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--Q72jFEw.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.nodeMap,n=i[e.fromNode],o=i[e.toNode];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-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;
2
2
  //# sourceMappingURL=modules.cjs.map
@@ -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 nodeMap = this.DM.data.nodeMap;\n\t\tconst fromNode = nodeMap[edge.fromNode];\n\t\tconst toNode = nodeMap[edge.toNode];\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","nodeMap","fromNode","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,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,cAAc,OAC7CxB,KAAKV,eAAemC,UAAY,WAChCzB,KAAKV,eAAeoC,UAAUC,OAAO,YAAa3B,KAAKF,WAEvD8B,EA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,GAEA3J,KAAKgL,kBAIRZ,gBAAkB,KACjBpK,KAAK4J,oBAAoBlI,UAAUiC,OAAO,UAC1C3D,KAAKH,GAAGwC,KAAKxB,UAAUa,UAAUuJ,IAAI,QACrCjL,KAAKqJ,WAAY,GAGlB2B,cAAgB,KACfhL,KAAKqJ,WAAY,EACjBrJ,KAAK4J,oBAAoBlI,UAAUuJ,IAAI,UACvCC,WAAW,IAAMlL,KAAKH,GAAGwC,KAAKxB,UAAUa,UAAUiC,OAAO,QAAS,KAG3Db,QAAU,KACjBuH,OAAO3G,oBAAoB,cAAe1D,KAAKsK,eAC/CD,OAAO3G,oBAAoB,cAAe1D,KAAKuK,eAC/CF,OAAO3G,oBAAoB,YAAa1D,KAAKwK,aAC7CxK,KAAK4J,oBAAoBjG,SACzB3D,KAAKoJ,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';\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,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,QAAQ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