@next-bricks/diagram 0.68.6 → 0.68.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +5 -5
- package/dist/chunks/{3171.77fcc3d5.js → 3171.3bd2c8f0.js} +2 -2
- package/dist/chunks/{5552.a03dc5df.js.map → 3171.3bd2c8f0.js.map} +1 -1
- package/dist/chunks/3654.59bd8992.js +3 -0
- package/dist/chunks/{3654.485b2ee1.js.map → 3654.59bd8992.js.map} +1 -1
- package/dist/chunks/3746.591c50d8.js +2 -0
- package/dist/chunks/{3746.f01acf89.js.map → 3746.591c50d8.js.map} +1 -1
- package/dist/chunks/{7470.28763ed7.js → 4667.53203ccd.js} +2 -2
- package/dist/chunks/{7470.28763ed7.js.map → 4667.53203ccd.js.map} +1 -1
- package/dist/chunks/4765.0ab66eb8.js +2 -0
- package/dist/chunks/{4765.09fa27a9.js.map → 4765.0ab66eb8.js.map} +1 -1
- package/dist/chunks/{4837.23693f19.js → 4837.32dece7c.js} +2 -2
- package/dist/chunks/{7218.ae373a36.js.map → 4837.32dece7c.js.map} +1 -1
- package/dist/chunks/{5552.a03dc5df.js → 5552.e3e728b7.js} +2 -2
- package/dist/chunks/{3171.77fcc3d5.js.map → 5552.e3e728b7.js.map} +1 -1
- package/dist/chunks/577.c9c65352.js +2 -0
- package/dist/chunks/577.c9c65352.js.map +1 -0
- package/dist/chunks/7146.564428f1.js +2 -0
- package/dist/chunks/{7146.a40fefdc.js.map → 7146.564428f1.js.map} +1 -1
- package/dist/chunks/{7218.ae373a36.js → 7218.e0bf22af.js} +2 -2
- package/dist/chunks/{4837.23693f19.js.map → 7218.e0bf22af.js.map} +1 -1
- package/dist/chunks/7920.df65d810.js +3 -0
- package/dist/chunks/7920.df65d810.js.map +1 -0
- package/dist/chunks/948.83e23068.js +3 -0
- package/dist/chunks/948.83e23068.js.map +1 -0
- package/dist/chunks/editable-label.667b04d5.js.map +1 -1
- package/dist/chunks/eo-diagram.78450578.js.map +1 -1
- package/dist/chunks/eo-display-canvas.2a43ce91.js.map +1 -1
- package/dist/chunks/eo-draw-canvas.e01342d6.js +2 -0
- package/dist/chunks/eo-draw-canvas.e01342d6.js.map +1 -0
- package/dist/chunks/experimental-node.2f4d802a.js.map +1 -1
- package/dist/chunks/main.4630d30e.js +2 -0
- package/dist/chunks/{main.16deb8ab.js.map → main.4630d30e.js.map} +1 -1
- package/dist/examples.json +5 -5
- package/dist/index.c366c6da.js +2 -0
- package/dist/index.c366c6da.js.map +1 -0
- package/dist/manifest.json +220 -220
- package/dist/types.json +5169 -5169
- package/dist-types/diagram/index.d.ts +16 -0
- package/dist-types/display-canvas/index.d.ts +11 -1
- package/dist-types/draw-canvas/index.d.ts +46 -0
- package/dist-types/editable-label/index.d.ts +8 -0
- package/dist-types/experimental-node/index.d.ts +10 -0
- package/package.json +5 -3
- package/dist/chunks/3654.485b2ee1.js +0 -3
- package/dist/chunks/3746.f01acf89.js +0 -2
- package/dist/chunks/4765.09fa27a9.js +0 -2
- package/dist/chunks/577.8a00080d.js +0 -2
- package/dist/chunks/577.8a00080d.js.map +0 -1
- package/dist/chunks/7146.a40fefdc.js +0 -2
- package/dist/chunks/7920.367555e2.js +0 -3
- package/dist/chunks/7920.367555e2.js.map +0 -1
- package/dist/chunks/948.48c4319a.js +0 -3
- package/dist/chunks/948.48c4319a.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.80ff662d.js +0 -2
- package/dist/chunks/eo-draw-canvas.80ff662d.js.map +0 -1
- package/dist/chunks/main.16deb8ab.js +0 -2
- package/dist/index.e2b7a362.js +0 -2
- package/dist/index.e2b7a362.js.map +0 -1
- /package/dist/chunks/{3654.485b2ee1.js.LICENSE.txt → 3654.59bd8992.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{7920.367555e2.js.LICENSE.txt → 7920.df65d810.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{948.48c4319a.js.LICENSE.txt → 948.83e23068.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4667],{883:(t,e,r)=>{r.d(e,{h:()=>o});var i=r(3016),n=r(9918);function o(t,e,r,n){const o=!(null==n||!n.exitPosition),s=!(null==n||!n.entryPosition);if(t===e||(0,i.w)(t,e,0,0)&&!o&&!s)return null;let y,x,a=0,c=0;if(r){const i=e.x-t.x,n=e.y-t.y,o=Math.atan2(n,i);a=r/2*Math.cos(o+Math.PI/2),c=r/2*Math.sin(o+Math.PI/2)}const l=[o?[t.x+(n.exitPosition.x-.5)*t.width,t.y+(n.exitPosition.y-.5)*t.height]:[t.x+a,t.y+c],s?[e.x+(n.entryPosition.x-.5)*e.width,e.y+(n.entryPosition.y-.5)*e.height]:[e.x+a,e.y+c]];if(o)y=l[0];else{const e=h(t,l);y=e.length>0?e[0]:[t.x,t.y]}if(s)x=l[1];else{const t=h(e,l);x=t.length>0?t[0]:[e.x,e.y]}return[{x:y[0],y:y[1]},{x:x[0],y:x[1]}]}function h(t,e){const r=[[t.x-t.width/2,t.y-t.height/2],[t.x+t.width/2,t.y-t.height/2],[t.x+t.width/2,t.y+t.height/2],[t.x-t.width/2,t.y+t.height/2]],i=[];for(let t=0;t<4;t++)i.push([r[t],r[(t+1)%4]]);const o=[];for(const t of i){const r=(0,n.y)(e[0],e[1],t[0],t[1]);r&&o.push(r)}return o}},3016:(t,e,r)=>{function i(t,e,r,i){const o=r?n(t,r):t,h=i?n(e,i):e,s=Math.min(o.x-o.width/2,h.x-h.width/2),y=Math.max(o.x+o.width/2,h.x+h.width/2),x=Math.min(o.y-o.height/2,h.y-h.height/2),a=Math.max(o.y+o.height/2,h.y+h.height/2);return y-s<o.width+h.width&&a-x<o.height+h.height}function n(t,e){return{x:t.x-t.width/2-e,y:t.y-t.height/2-e,width:t.width+2*e,height:t.height+2*e}}r.d(e,{w:()=>i})},4487:(t,e,r)=>{function i(t){if(Array.isArray(t)){const e=t[0],r=t.length>1?t[1]:e;return[e,r,t.length>2?t[2]:e,t.length>3?t[3]:r]}return new Array(4).fill(t)}r.d(e,{D:()=>i})},4928:(t,e,r)=>{r.d(e,{o:()=>n});const i=20;function n(t,e,r,n,h,s){const y=o(t,r,h),x=o(e,n,s);let a=[],c=!1;const l="top"===r||"bottom"===r;if(l!==("top"===n||"bottom"===n)){let o,h,s,u,f,d;l?(o=e,h=t,s="right"===n?1:-1,u="bottom"===r?1:-1,f=x,d=y):(o=t,h=e,s="right"===r?1:-1,u="bottom"===n?1:-1,f=y,d=x,c=!0);const g=f.x+i*s,k=d.y+i*u;if((o.x-h.x)*s>=0)if((h.y-o.y)*u>=0)a=[{x:d.x,y:k},{x:g,y:k},{x:g,y:f.y}];else{const t=h.y+(h.height/2+i)*u,e=o.y-(o.height/2+i)*u;if((e-t)*u>=0){const r=(t+e)/2;a=[{x:d.x,y:r},{x:g,y:r},{x:g,y:f.y}]}else{const r=(h.x+h.width/2*s+o.x-o.width/2*s)/2;a=[{x:d.x,y:t},{x:r,y:t},{x:r,y:e},{x:g,y:e},{x:g,y:f.y}]}}else if((f.y-k)*u>=0)if((d.x-g)*s>=0)a=[{x:d.x,y:f.y}];else{const t=(h.y+(h.height/2+i)*u+(o.y-(o.height/2+i)*u))/2;a=[{x:d.x,y:t},{x:g,y:t},{x:g,y:f.y}]}else{const t=h.x-(h.width/2+i)*s;if((t-g)*s>=0){const e=(t+g)/2;a=[{x:d.x,y:k},{x:e,y:k},{x:e,y:f.y}]}else{const e=(h.y-h.height/2*u+o.y+o.height/2*u)/2;a=[{x:d.x,y:k},{x:t,y:k},{x:t,y:e},{x:g,y:e},{x:g,y:f.y}]}}}else if(r===n){const n="bottom"===r||"right"===r?1:-1;let o,h,s,u;const f=l?"y":"x",d=l?"x":"y";let g,k,m,w;e[f]<t[f]?(o=e,h=t,s=x,u=y,c=1===n):(o=t,h=e,s=y,u=x,c=1!==n),1===n?(g=h,k=o,m=u,w=s):(g=o,k=h,m=s,w=u);const M=g===(e[d]<t[d]?t:e)?1:-1;if(l){const t=g.x-(g.width/2+i)*M,e=m.y+i*n;if((t-w.x)*M>=0)a=[{x:w.x,y:e},{x:m.x,y:e}];else{const r=(k.y+k.height/2*n+g.y-g.height/2*n)/2;a=[{x:w.x,y:r},{x:t,y:r},{x:t,y:e},{x:m.x,y:e}]}}else{const t=m.x+i*n,e=g.y-(g.height/2+i)*M;if((e-w.y)*M>=0)a=[{x:t,y:w.y},{x:t,y:m.y}];else{const r=(k.x+k.width/2*n+g.x-g.width/2*n)/2;a=[{x:r,y:w.y},{x:r,y:e},{x:t,y:e},{x:t,y:m.y}]}}}else{const r="bottom"===n||"right"===n?1:-1;let o,h,s,c;l?(o="y",h="x",s="height",c="width"):(o="x",h="y",s="width",c="height");const u=e[o]+e[s]/2*r,f=t[o]-t[s]/2*r,d=u+i*r,g=f-i*r,k=y[h]===x[h];if((g-d)*r>=0){const t=(g+d)/2;a=k?[]:[{[h]:y[h],[o]:t},{[h]:x[h],[o]:t}]}else if(k&&(f-u)*r>=0)a=[];else{const n=e[h]<t[h]?-1:1,l=t[h]+(t[c]/2+i)*n,u=e[h]-(e[c]/2+i)*n;if((u-l)*n>=0||Math.abs((g-d)*r)<i){const t=(l+u)/2;a=[{[h]:y[h],[o]:g},{[h]:t,[o]:g},{[h]:t,[o]:d},{[h]:x[h],[o]:d}]}else{const i=(t[o]+t[s]/2*r+e[o]-e[s]/2*r)/2;a=[{[h]:y[h],[o]:g},{[h]:l,[o]:g},{[h]:l,[o]:i},{[h]:u,[o]:i},{[h]:u,[o]:d},{[h]:x[h],[o]:d}]}}}return c&&a.reverse(),[y,...a,x]}function o(t,e,r){const{x:i,y:n,width:o,height:h}=t;switch(e){case"top":return{x:i-o/2+o*r,y:n-h/2};case"bottom":return{x:i-o/2+o*r,y:n+h/2};case"left":return{x:i-o/2,y:n-h/2+h*r};case"right":return{x:i+o/2,y:n-h/2+h*r}}}},5078:(t,e,r)=>{r.d(e,{c:()=>o});var i=r(8769),n=r.n(i);function o(t){let e,{id:r,type:i,strokeColor:o}=t;switch(i){case"0..1":e=y;break;case"0..N":e=x;break;case"circle":e=h;break;default:e=s}return n().createElement(e,{id:r,strokeColor:o})}function h(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{viewBox:"0 0 9 9",refX:3,refY:3,id:e,overflow:"visible",markerWidth:9,markerHeight:9},n().createElement("circle",{stroke:"none",fill:r,cx:3,cy:3,r:3}))}function s(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},n().createElement("path",{d:"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z",stroke:r,strokeWidth:1,fill:r}))}function y(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}function x(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}},9698:(t,e,r)=>{r.d(e,{S:()=>x});var i=r(482),n=r(4643),o=r(3488),h=r(6066),s=r(4993),y=r(3269);function x(t,e,r,x,c){if(!Array.isArray(t))return"";let l;switch(e){case"curveLinear":l=i.A;break;case"curveBumpX":l=n.dJ;break;case"curveBumpY":l=n.kl;break;case"curveMonotoneX":l=o.G;break;case"curveMonotoneY":l=o.N;break;case"curveNatural":l=h.A;break;default:l=s.Ay}const u=a(t[1],t[0],r),f=a(t[t.length-2],t[t.length-1],x),d=(0,y.A)().x(((e,r)=>e.x-(0===r?u.x:r===t.length-1?f.x:0))).y(((e,r)=>e.y-(0===r?u.y:r===t.length-1?f.y:0))).curve(l);if(c&&"curveLinear"==e){const e=[];for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];0===r&&e.push(`M${i.x},${i.y}`);const o=c.get(r);if(o){const t=n.x-i.x,r=n.y-i.y,h=Math.atan2(r,t),s=Math.abs(h)<=Math.PI/2?-1:1,y=h+Math.PI/2*s,x=1.3*o.radius*Math.cos(y),a=1.3*o.radius*Math.sin(y),c=o.radius*Math.cos(h),l=o.radius*Math.sin(h);for(const t of o.jumpPoints){const r=t.x-c,i=t.y-l,n=t.x+c,o=t.y+l;e.push(`L${r},${i}`),e.push(`C${r+x},${i+a} ${n+x},${o+a} ${n},${o}`)}}e.push(`L${n.x},${n.y}`)}return e.join("")}return d(t)}function a(t,e,r){if(!r)return{x:0,y:0};const{x:i,y:n}=t,{x:o,y:h}=e,s=r/Math.sqrt(Math.pow(o-i,2)+Math.pow(h-n,2));return{x:(o-i)*s,y:(h-n)*s}}},9918:(t,e,r)=>{function i(t,e,r,i){let[n,o]=t,[h,s]=e,[y,x]=r,[a,c]=i;if(n===h&&o===s||y===a&&x===c)return null;const l=(c-x)*(h-n)-(a-y)*(s-o);if(0===l)return null;const u=((a-y)*(o-x)-(c-x)*(n-y))/l,f=((h-n)*(o-x)-(s-o)*(n-y))/l;return u<0||u>1||f<0||f>1?null:[n+u*(h-n),o+u*(s-o)]}r.d(e,{y:()=>i})}}]);
|
|
2
|
+
//# sourceMappingURL=4667.53203ccd.js.map
|
|
@@ -1 +1 @@
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AEoC,KAAK,GAChB,CAEA,OAAOf,EAAahB,EACtB,CAEA,SAASc,EACPxE,EACAC,EACAyF,GAEA,IAAKA,EACH,MAAO,CAAEjK,EAAG,EAAGE,EAAG,GAEpB,MAAQF,EAAG4J,EAAI1J,EAAG2J,GAAOtF,GACjBvE,EAAG8J,EAAI5J,EAAG6J,GAAOvF,EAEnB0F,EAAQD,EADG7J,KAAK+J,KAAK/J,KAAKgK,IAAIN,EAAKF,EAAI,GAAKxJ,KAAKgK,IAAIL,EAAKF,EAAI,IAEpE,MAAO,CACL7J,GAAI8J,EAAKF,GAAMM,EACfhK,GAAI6J,EAAKF,GAAMK,EAEnB,C,iBCnIO,SAAS1I,EAAS4E,EAAAU,EAAAW,EAAAK,GAKD,IAJrBgC,EAAIC,GAAkB3D,GACtBiE,EAAIC,GAAkBxD,GACtByD,EAAIC,GAAkB/C,GACtBgD,EAAIC,GAAkB5C,EAGvB,GAAKgC,IAAOO,GAAMN,IAAOO,GAAQC,IAAOE,GAAMD,IAAOE,EACnD,OAAO,KAGT,MAAMC,GAAeD,EAAKF,IAAOH,EAAKP,IAAOW,EAAKF,IAAOD,EAAKP,GAG9D,GAAoB,IAAhBY,EACF,OAAO,KAGT,MAAMC,IAAOH,EAAKF,IAAOR,EAAKS,IAAOE,EAAKF,IAAOV,EAAKS,IAAOI,EACvDE,IAAOR,EAAKP,IAAOC,EAAKS,IAAOF,EAAKP,IAAOD,EAAKS,IAAOI,EAG7D,OAAIC,EAAK,GAAKA,EAAK,GAAKC,EAAK,GAAKA,EAAK,EAC9B,KAOF,CAHGf,EAAKc,GAAMP,EAAKP,GAChBC,EAAKa,GAAMN,EAAKP,GAG5B,C","sources":["webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/diagram/lines/getPolyLinePoints.ts","webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/curveLine.ts","webpack:///./src/diagram/lines/intersect.ts"],"sourcesContent":["import type { EdgeView } from \"../../draw-canvas/interfaces\";\nimport type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\nimport { intersect } from \"./intersect\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number,\n edgeView?: EdgeView\n): NodePosition[] | null {\n const hasExitPosition = !!edgeView?.exitPosition;\n const hasEntryPosition = !!edgeView?.entryPosition;\n\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap and no entry nor exit position.\n if (\n source === target ||\n (doTwoNodesOverlap(source, target, 0, 0) &&\n !(hasExitPosition || hasEntryPosition))\n ) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n hasExitPosition\n ? [\n source.x + (edgeView!.exitPosition!.x - 0.5) * source.width,\n source.y + (edgeView!.exitPosition!.y - 0.5) * source.height,\n ]\n : [source.x + xDiff, source.y + yDiff],\n hasEntryPosition\n ? [\n target.x + (edgeView!.entryPosition!.x - 0.5) * target.width,\n target.y + (edgeView!.entryPosition!.y - 0.5) * target.height,\n ]\n : [target.x + xDiff, target.y + yDiff],\n ];\n\n if (hasExitPosition) {\n p0 = line[0];\n } else {\n const sourceIntersections = getIntersections(source, line);\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n }\n\n if (hasEntryPosition) {\n p1 = line[1];\n } else {\n const targetIntersections = getIntersections(target, line);\n // Todo: handle when more than one intersection\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Direction, NodePosition, NodeRect } from \"../interfaces\";\n\nconst MINIMAL_OFFSET = 20;\n\nexport function getPolyLinePoints(\n source: NodeRect,\n target: NodeRect,\n sourceDirection: Direction,\n targetDirection: Direction,\n sourcePosition: number,\n targetPosition: number\n): NodePosition[] {\n const p0 = getCoordinates(source, sourceDirection, sourcePosition);\n const p1 = getCoordinates(target, targetDirection, targetPosition);\n\n let controls: NodePosition[] = [];\n let reverseControls = false;\n\n const sourceIsVertical =\n sourceDirection === \"top\" || sourceDirection === \"bottom\";\n const targetIsVertical =\n targetDirection === \"top\" || targetDirection === \"bottom\";\n\n if (sourceIsVertical !== targetIsVertical) {\n // One is vertical and the other is horizontal\n let horizontal: NodeRect;\n let vertical: NodeRect;\n let horizontalSign: number;\n let verticalSign: number;\n let horizontalPosition: NodePosition;\n let verticalPosition: NodePosition;\n if (sourceIsVertical) {\n horizontal = target;\n vertical = source;\n horizontalSign = targetDirection === \"right\" ? 1 : -1;\n verticalSign = sourceDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p1;\n verticalPosition = p0;\n } else {\n horizontal = source;\n vertical = target;\n horizontalSign = sourceDirection === \"right\" ? 1 : -1;\n verticalSign = targetDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p0;\n verticalPosition = p1;\n reverseControls = true;\n }\n\n const defaultControlX =\n horizontalPosition.x + MINIMAL_OFFSET * horizontalSign;\n const defaultControlY = verticalPosition.y + MINIMAL_OFFSET * verticalSign;\n\n if ((horizontal.x - vertical.x) * horizontalSign >= 0) {\n if ((vertical.y - horizontal.y) * verticalSign >= 0) {\n // ┌──────────────┐\n // ┌──┴──┐ ┌─────┐ │\n // │ S │ │ T ├─┘\n // └─────┘ └─────┘\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n if ((controlY1 - controlY0) * verticalSign >= 0) {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌────────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n // ┌─────┐\n // ┌────┐ │ T ├─┐\n // ┌──┴──┐ │ └─────┘ │\n // │ S │ └─────────┘\n // └─────┘\n const middleX =\n (vertical.x +\n (vertical.width / 2) * horizontalSign +\n horizontal.x -\n (horizontal.width / 2) * horizontalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: controlY0 },\n { x: middleX, y: controlY0 },\n { x: middleX, y: controlY1 },\n { x: defaultControlX, y: controlY1 },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if ((horizontalPosition.y - defaultControlY) * verticalSign >= 0) {\n if ((verticalPosition.x - defaultControlX) * horizontalSign >= 0) {\n // ┌─────┐\n // ┌──┤ T │\n // │ └─────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [{ x: verticalPosition.x, y: horizontalPosition.y }];\n } else {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌─┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n } else {\n const sourceExtendX =\n vertical.x - (vertical.width / 2 + MINIMAL_OFFSET) * horizontalSign;\n if ((sourceExtendX - defaultControlX) * horizontalSign >= 0) {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // ┌─────┐ │ └─────┘\n // │ T ├─┘\n // └─────┘\n const middleX = (sourceExtendX + defaultControlX) / 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: middleX, y: defaultControlY },\n { x: middleX, y: horizontalPosition.y },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // │ └─────┘\n // └───┐\n // ┌─────┐ │\n // │ T ├─┘\n // └─────┘\n const middleY =\n (vertical.y -\n (vertical.height / 2) * verticalSign +\n horizontal.y +\n (horizontal.height / 2) * verticalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: sourceExtendX, y: defaultControlY },\n { x: sourceExtendX, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if (sourceDirection === targetDirection) {\n // Same direction\n const sign =\n sourceDirection === \"bottom\" || sourceDirection === \"right\" ? 1 : -1;\n let start: NodeRect;\n let end: NodeRect;\n let startPosition: NodePosition;\n let endPosition: NodePosition;\n const axis = sourceIsVertical ? \"y\" : \"x\";\n const oppositeAxis = sourceIsVertical ? \"x\" : \"y\";\n if (target[axis] < source[axis]) {\n start = target;\n end = source;\n startPosition = p1;\n endPosition = p0;\n reverseControls = sign === 1;\n } else {\n start = source;\n end = target;\n startPosition = p0;\n endPosition = p1;\n reverseControls = sign !== 1;\n }\n const perpendicular =\n target[oppositeAxis] < source[oppositeAxis] ? source : target;\n let around: NodeRect;\n let nonAround: NodeRect;\n let aroundPosition: NodePosition;\n let nonAroundPosition: NodePosition;\n if (sign === 1) {\n around = end;\n nonAround = start;\n aroundPosition = endPosition;\n nonAroundPosition = startPosition;\n } else {\n around = start;\n nonAround = end;\n aroundPosition = startPosition;\n nonAroundPosition = endPosition;\n }\n const aroundSign = around === perpendicular ? 1 : -1;\n if (sourceIsVertical) {\n const defaultControlX =\n around.x - (around.width / 2 + MINIMAL_OFFSET) * aroundSign;\n const defaultControlY = aroundPosition.y + MINIMAL_OFFSET * sign;\n if ((defaultControlX - nonAroundPosition.x) * aroundSign >= 0) {\n // ┌─────────┐\n // │ ┌──┴──┐\n // │ │ T │\n // ┌──┴──┐ └─────┘\n // │ S │\n // └─────┘\n controls = [\n { x: nonAroundPosition.x, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ T │\n // │ └─────┘\n // └─┐\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY =\n (nonAround.y +\n (nonAround.height / 2) * sign +\n around.y -\n (around.height / 2) * sign) /\n 2;\n controls = [\n { x: nonAroundPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n }\n } else {\n const defaultControlX = aroundPosition.x + MINIMAL_OFFSET * sign;\n const defaultControlY =\n around.y - (around.height / 2 + MINIMAL_OFFSET) * aroundSign;\n if ((defaultControlY - nonAroundPosition.y) * aroundSign >= 0) {\n // ┌─────┐\n // ┌─────────┤ T │\n // │ ┌─────┐ └─────┘\n // └─┤ S │\n // └─────┘\n controls = [\n { x: defaultControlX, y: nonAroundPosition.y },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n } else {\n // ┌─────────┐\n // │ ┌─────┐ │ ┌─────┐\n // └─┤ S │ └─┤ T │\n // └─────┘ └─────┘\n const middleX =\n (nonAround.x +\n (nonAround.width / 2) * sign +\n around.x -\n (around.width / 2) * sign) /\n 2;\n controls = [\n { x: middleX, y: nonAroundPosition.y },\n { x: middleX, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n }\n }\n } else {\n // Opposite direction\n const targetSign =\n targetDirection === \"bottom\" || targetDirection === \"right\" ? 1 : -1;\n let axis: \"x\" | \"y\";\n let oppositeAxis: \"x\" | \"y\";\n let size: \"width\" | \"height\";\n let oppositeSize: \"width\" | \"height\";\n if (sourceIsVertical) {\n axis = \"y\";\n oppositeAxis = \"x\";\n size = \"height\";\n oppositeSize = \"width\";\n } else {\n axis = \"x\";\n oppositeAxis = \"y\";\n size = \"width\";\n oppositeSize = \"height\";\n }\n const targetEdge = target[axis] + (target[size] / 2) * targetSign;\n const sourceEdge = source[axis] - (source[size] / 2) * targetSign;\n const targetControl = targetEdge + MINIMAL_OFFSET * targetSign;\n const sourceControl = sourceEdge - MINIMAL_OFFSET * targetSign;\n const oppositeIsStraight = p0[oppositeAxis] === p1[oppositeAxis];\n if ((sourceControl - targetControl) * targetSign >= 0) {\n const middle = (sourceControl + targetControl) / 2;\n if (oppositeIsStraight) {\n // Straight line\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // │\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌───┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: middle },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: middle },\n ] as unknown[] as NodePosition[];\n }\n } else if (\n oppositeIsStraight &&\n (sourceEdge - targetEdge) * targetSign >= 0\n ) {\n // Straight line (very close)\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n const targetOppositeSign =\n target[oppositeAxis] < source[oppositeAxis] ? -1 : 1;\n const sourceOppositeControl =\n source[oppositeAxis] +\n (source[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n const targetOppositeControl =\n target[oppositeAxis] -\n (target[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n if (\n (targetOppositeControl - sourceOppositeControl) * targetOppositeSign >=\n 0 ||\n Math.abs((sourceControl - targetControl) * targetSign) < MINIMAL_OFFSET\n ) {\n // ┌─────┐\n // ┌────┐ │ T │\n // ┌──┴──┐ │ └──┬──┘\n // │ S │ └────┘\n // └─────┘\n const oppositeMiddle =\n (sourceOppositeControl + targetOppositeControl) / 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n } else {\n // ┌────┐\n // ┌──┴──┐ │\n // │ S │ │\n // └─────┘ │\n // ┌─────────┘\n // │ ┌─────┐\n // │ │ T │\n // │ └──┬──┘\n // └────┘\n const middle =\n (source[axis] +\n (source[size] / 2) * targetSign +\n target[axis] -\n (target[size] / 2) * targetSign) /\n 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n }\n }\n }\n\n if (reverseControls) {\n controls.reverse();\n }\n\n return [p0, ...controls, p1] as NodePosition[];\n}\n\nfunction getCoordinates(\n node: NodeRect,\n direction: Direction,\n position: number\n): NodePosition {\n const { x, y, width, height } = node;\n switch (direction) {\n case \"top\":\n return {\n x: x - width / 2 + width * position,\n y: y - height / 2,\n };\n case \"bottom\":\n return {\n x: x - width / 2 + width * position,\n y: y + height / 2,\n };\n case \"left\":\n return {\n x: x - width / 2,\n y: y - height / 2 + height * position,\n };\n case \"right\":\n return {\n x: x + width / 2,\n y: y - height / 2 + height * position,\n };\n }\n}\n","import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n case \"circle\":\n Component = CircleMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction CircleMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n const r = 3;\n const d = r * 3;\n return (\n <marker\n viewBox={`0 0 ${d} ${d}`}\n refX={r}\n refY={r}\n id={id}\n overflow=\"visible\"\n markerWidth={d}\n markerHeight={d}\n >\n <circle stroke=\"none\" fill={strokeColor} cx={r} cy={r} r={r} />\n </marker>\n );\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import {\n curveLinear,\n line,\n curveBasis,\n curveBumpX,\n curveBumpY,\n type CurveFactory,\n curveMonotoneX,\n curveNatural,\n curveMonotoneY,\n} from \"d3-shape\";\nimport type { CurveType, NodePosition } from \"../interfaces\";\nimport type { LineSegmentJumps } from \"../../draw-canvas/interfaces\";\n\n/**\n * Generate Line from points\n */\nexport function curveLine(\n points: Array<NodePosition> | null | undefined,\n curveType: CurveType | undefined,\n startOffset: number,\n endOffset: number,\n jumpsMap?: Map<number, LineSegmentJumps> | null\n): string {\n if (!Array.isArray(points)) {\n return \"\";\n }\n let curveFactory: CurveFactory;\n switch (curveType) {\n case \"curveLinear\":\n curveFactory = curveLinear;\n break;\n case \"curveBumpX\":\n curveFactory = curveBumpX;\n break;\n case \"curveBumpY\":\n curveFactory = curveBumpY;\n break;\n case \"curveMonotoneX\":\n curveFactory = curveMonotoneX;\n break;\n case \"curveMonotoneY\":\n curveFactory = curveMonotoneY;\n break;\n case \"curveNatural\":\n curveFactory = curveNatural;\n break;\n default:\n curveFactory = curveBasis;\n }\n const startOffsets = getOffsets(points[1], points[0], startOffset);\n const endOffsets = getOffsets(\n points[points.length - 2],\n points[points.length - 1],\n endOffset\n );\n const lineFunction = line<NodePosition>()\n .x(\n (d, index) =>\n d.x -\n (index === 0\n ? startOffsets.x\n : index === points.length - 1\n ? endOffsets.x\n : 0)\n )\n .y(\n (d, index) =>\n d.y -\n (index === 0\n ? startOffsets.y\n : index === points.length - 1\n ? endOffsets.y\n : 0)\n )\n .curve(curveFactory);\n\n if (jumpsMap && curveType == \"curveLinear\") {\n const d: string[] = [];\n for (let i = 0; i < points.length - 1; i++) {\n const start = points[i];\n const end = points[i + 1];\n if (i === 0) {\n d.push(`M${start.x},${start.y}`);\n }\n // 处理交叉跨线点\n const jump = jumpsMap.get(i);\n if (jump) {\n // 跨线点近似为一段半圆,参考 draw.io 使用三次贝赛尔曲线实现。\n // 一条 jump 记录中所有的 jumpPoints 都在同一线段上,因此角度一致、尺寸一致。\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const angle = Math.atan2(dy, dx);\n const direction = Math.abs(angle) <= Math.PI / 2 ? -1 : 1;\n const verticalAngle = angle + (Math.PI / 2) * direction;\n const offsetX = jump.radius * 1.3 * Math.cos(verticalAngle);\n const offsetY = jump.radius * 1.3 * Math.sin(verticalAngle);\n const xDiff = jump.radius * Math.cos(angle);\n const yDiff = jump.radius * Math.sin(angle);\n for (const p of jump.jumpPoints) {\n const x0 = p.x - xDiff;\n const y0 = p.y - yDiff;\n const x1 = p.x + xDiff;\n const y1 = p.y + yDiff;\n d.push(`L${x0},${y0}`);\n d.push(\n `C${x0 + offsetX},${y0 + offsetY} ${x1 + offsetX},${y1 + offsetY} ${x1},${y1}`\n );\n }\n }\n d.push(`L${end.x},${end.y}`);\n }\n return d.join(\"\");\n }\n\n return lineFunction(points)!;\n}\n\nfunction getOffsets(\n start: NodePosition,\n end: NodePosition,\n offset: number\n): NodePosition {\n if (!offset) {\n return { x: 0, y: 0 };\n }\n const { x: x0, y: y0 } = start;\n const { x: x1, y: y1 } = end;\n const distance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n const ratio = offset / distance;\n return {\n x: (x1 - x0) * ratio,\n y: (y1 - y0) * ratio,\n };\n}\n","import type { PositionTuple } from \"../interfaces\";\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nexport function intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n"],"names":["getDirectLinePoints","source","target","parallelGap","edgeView","hasExitPosition","exitPosition","hasEntryPosition","entryPosition","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","x","dy","y","angle","Math","atan2","cos","PI","sin","line","width","height","sourceIntersections","getIntersections","length","targetIntersections","rect","vertices","possibleLines","i","push","intersections","item","intersection","intersect","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","extractPartialRectTuple","value","Array","isArray","v0","v1","fill","MINIMAL_OFFSET","getPolyLinePoints","sourceDirection","targetDirection","sourcePosition","targetPosition","getCoordinates","controls","reverseControls","sourceIsVertical","horizontal","vertical","horizontalSign","verticalSign","horizontalPosition","verticalPosition","defaultControlX","defaultControlY","controlY0","controlY1","middleY","middleX","sourceExtendX","sign","start","end","startPosition","endPosition","axis","oppositeAxis","around","nonAround","aroundPosition","nonAroundPosition","aroundSign","targetSign","size","oppositeSize","targetEdge","sourceEdge","targetControl","sourceControl","oppositeIsStraight","middle","targetOppositeSign","sourceOppositeControl","targetOppositeControl","abs","oppositeMiddle","reverse","direction","position","MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","CircleMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","overflow","markerWidth","r","markerHeight","stroke","cx","cy","_ref3","orient","strokeLinejoin","d","strokeWidth","_ref4","_ref5","curveLine","points","curveType","startOffset","endOffset","jumpsMap","curveFactory","curveLinear","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveNatural","curveBasis","startOffsets","getOffsets","endOffsets","lineFunction","index","curve","jump","get","verticalAngle","offsetX","radius","offsetY","p","jumpPoints","x0","y0","x1","y1","join","offset","ratio","sqrt","pow","x2","y2","x3","y3","x4","y4","denominator","ua","ub"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"chunks/4667.53203ccd.js","mappings":"gLAOO,SAASA,EACdC,EACAC,EACAC,EACAC,GAEA,MAAMC,IAAoBD,UAAAA,EAAUE,cAC9BC,IAAqBH,UAAAA,EAAUI,eAIrC,GACEP,IAAWC,IACVO,EAAAA,EAAAA,GAAkBR,EAAQC,EAAQ,EAAG,KAClCG,IAAmBE,EAEvB,OAAO,KAGT,IAAIG,EACAC,EAEAC,EAAQ,EACRC,EAAQ,EAEZ,GAAIV,EAAa,CACf,MAAMW,EAAKZ,EAAOa,EAAId,EAAOc,EACvBC,EAAKd,EAAOe,EAAIhB,EAAOgB,EACvBC,EAAQC,KAAKC,MAAMJ,EAAIF,GAC7BF,EAAST,EAAc,EAAKgB,KAAKE,IAAIH,EAAQC,KAAKG,GAAK,GACvDT,EAASV,EAAc,EAAKgB,KAAKI,IAAIL,EAAQC,KAAKG,GAAK,EACzD,CAEA,MAAME,EAAkB,CACtBnB,EACI,CACEJ,EAAOc,GAAKX,EAAUE,aAAcS,EAAI,IAAOd,EAAOwB,MACtDxB,EAAOgB,GAAKb,EAAUE,aAAcW,EAAI,IAAOhB,EAAOyB,QAExD,CAACzB,EAAOc,EAAIH,EAAOX,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MC,IAAOH,EAAKF,IAAOR,EAAKS,IAAOE,EAAKF,IAAOV,EAAKS,IAAOI,EACvDE,IAAOR,EAAKP,IAAOC,EAAKS,IAAOF,EAAKP,IAAOD,EAAKS,IAAOI,EAG7D,OAAIC,EAAK,GAAKA,EAAK,GAAKC,EAAK,GAAKA,EAAK,EAC9B,KAOF,CAHGf,EAAKc,GAAMP,EAAKP,GAChBC,EAAKa,GAAMN,EAAKP,GAG5B,C","sources":["webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/diagram/lines/getPolyLinePoints.ts","webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/curveLine.ts","webpack:///./src/diagram/lines/intersect.ts"],"sourcesContent":["import type { EdgeView } from \"../../draw-canvas/interfaces\";\nimport type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\nimport { intersect } from \"./intersect\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number,\n edgeView?: EdgeView\n): NodePosition[] | null {\n const hasExitPosition = !!edgeView?.exitPosition;\n const hasEntryPosition = !!edgeView?.entryPosition;\n\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap and no entry nor exit position.\n if (\n source === target ||\n (doTwoNodesOverlap(source, target, 0, 0) &&\n !(hasExitPosition || hasEntryPosition))\n ) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n hasExitPosition\n ? [\n source.x + (edgeView!.exitPosition!.x - 0.5) * source.width,\n source.y + (edgeView!.exitPosition!.y - 0.5) * source.height,\n ]\n : [source.x + xDiff, source.y + yDiff],\n hasEntryPosition\n ? [\n target.x + (edgeView!.entryPosition!.x - 0.5) * target.width,\n target.y + (edgeView!.entryPosition!.y - 0.5) * target.height,\n ]\n : [target.x + xDiff, target.y + yDiff],\n ];\n\n if (hasExitPosition) {\n p0 = line[0];\n } else {\n const sourceIntersections = getIntersections(source, line);\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n }\n\n if (hasEntryPosition) {\n p1 = line[1];\n } else {\n const targetIntersections = getIntersections(target, line);\n // Todo: handle when more than one intersection\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Direction, NodePosition, NodeRect } from \"../interfaces\";\n\nconst MINIMAL_OFFSET = 20;\n\nexport function getPolyLinePoints(\n source: NodeRect,\n target: NodeRect,\n sourceDirection: Direction,\n targetDirection: Direction,\n sourcePosition: number,\n targetPosition: number\n): NodePosition[] {\n const p0 = getCoordinates(source, sourceDirection, sourcePosition);\n const p1 = getCoordinates(target, targetDirection, targetPosition);\n\n let controls: NodePosition[] = [];\n let reverseControls = false;\n\n const sourceIsVertical =\n sourceDirection === \"top\" || sourceDirection === \"bottom\";\n const targetIsVertical =\n targetDirection === \"top\" || targetDirection === \"bottom\";\n\n if (sourceIsVertical !== targetIsVertical) {\n // One is vertical and the other is horizontal\n let horizontal: NodeRect;\n let vertical: NodeRect;\n let horizontalSign: number;\n let verticalSign: number;\n let horizontalPosition: NodePosition;\n let verticalPosition: NodePosition;\n if (sourceIsVertical) {\n horizontal = target;\n vertical = source;\n horizontalSign = targetDirection === \"right\" ? 1 : -1;\n verticalSign = sourceDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p1;\n verticalPosition = p0;\n } else {\n horizontal = source;\n vertical = target;\n horizontalSign = sourceDirection === \"right\" ? 1 : -1;\n verticalSign = targetDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p0;\n verticalPosition = p1;\n reverseControls = true;\n }\n\n const defaultControlX =\n horizontalPosition.x + MINIMAL_OFFSET * horizontalSign;\n const defaultControlY = verticalPosition.y + MINIMAL_OFFSET * verticalSign;\n\n if ((horizontal.x - vertical.x) * horizontalSign >= 0) {\n if ((vertical.y - horizontal.y) * verticalSign >= 0) {\n // ┌──────────────┐\n // ┌──┴──┐ ┌─────┐ │\n // │ S │ │ T ├─┘\n // └─────┘ └─────┘\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n if ((controlY1 - controlY0) * verticalSign >= 0) {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌────────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n // ┌─────┐\n // ┌────┐ │ T ├─┐\n // ┌──┴──┐ │ └─────┘ │\n // │ S │ └─────────┘\n // └─────┘\n const middleX =\n (vertical.x +\n (vertical.width / 2) * horizontalSign +\n horizontal.x -\n (horizontal.width / 2) * horizontalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: controlY0 },\n { x: middleX, y: controlY0 },\n { x: middleX, y: controlY1 },\n { x: defaultControlX, y: controlY1 },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if ((horizontalPosition.y - defaultControlY) * verticalSign >= 0) {\n if ((verticalPosition.x - defaultControlX) * horizontalSign >= 0) {\n // ┌─────┐\n // ┌──┤ T │\n // │ └─────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [{ x: verticalPosition.x, y: horizontalPosition.y }];\n } else {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌─┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n } else {\n const sourceExtendX =\n vertical.x - (vertical.width / 2 + MINIMAL_OFFSET) * horizontalSign;\n if ((sourceExtendX - defaultControlX) * horizontalSign >= 0) {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // ┌─────┐ │ └─────┘\n // │ T ├─┘\n // └─────┘\n const middleX = (sourceExtendX + defaultControlX) / 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: middleX, y: defaultControlY },\n { x: middleX, y: horizontalPosition.y },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // │ └─────┘\n // └───┐\n // ┌─────┐ │\n // │ T ├─┘\n // └─────┘\n const middleY =\n (vertical.y -\n (vertical.height / 2) * verticalSign +\n horizontal.y +\n (horizontal.height / 2) * verticalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: sourceExtendX, y: defaultControlY },\n { x: sourceExtendX, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if (sourceDirection === targetDirection) {\n // Same direction\n const sign =\n sourceDirection === \"bottom\" || sourceDirection === \"right\" ? 1 : -1;\n let start: NodeRect;\n let end: NodeRect;\n let startPosition: NodePosition;\n let endPosition: NodePosition;\n const axis = sourceIsVertical ? \"y\" : \"x\";\n const oppositeAxis = sourceIsVertical ? \"x\" : \"y\";\n if (target[axis] < source[axis]) {\n start = target;\n end = source;\n startPosition = p1;\n endPosition = p0;\n reverseControls = sign === 1;\n } else {\n start = source;\n end = target;\n startPosition = p0;\n endPosition = p1;\n reverseControls = sign !== 1;\n }\n const perpendicular =\n target[oppositeAxis] < source[oppositeAxis] ? source : target;\n let around: NodeRect;\n let nonAround: NodeRect;\n let aroundPosition: NodePosition;\n let nonAroundPosition: NodePosition;\n if (sign === 1) {\n around = end;\n nonAround = start;\n aroundPosition = endPosition;\n nonAroundPosition = startPosition;\n } else {\n around = start;\n nonAround = end;\n aroundPosition = startPosition;\n nonAroundPosition = endPosition;\n }\n const aroundSign = around === perpendicular ? 1 : -1;\n if (sourceIsVertical) {\n const defaultControlX =\n around.x - (around.width / 2 + MINIMAL_OFFSET) * aroundSign;\n const defaultControlY = aroundPosition.y + MINIMAL_OFFSET * sign;\n if ((defaultControlX - nonAroundPosition.x) * aroundSign >= 0) {\n // ┌─────────┐\n // │ ┌──┴──┐\n // │ │ T │\n // ┌──┴──┐ └─────┘\n // │ S │\n // └─────┘\n controls = [\n { x: nonAroundPosition.x, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ T │\n // │ └─────┘\n // └─┐\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY =\n (nonAround.y +\n (nonAround.height / 2) * sign +\n around.y -\n (around.height / 2) * sign) /\n 2;\n controls = [\n { x: nonAroundPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n }\n } else {\n const defaultControlX = aroundPosition.x + MINIMAL_OFFSET * sign;\n const defaultControlY =\n around.y - (around.height / 2 + MINIMAL_OFFSET) * aroundSign;\n if ((defaultControlY - nonAroundPosition.y) * aroundSign >= 0) {\n // ┌─────┐\n // ┌─────────┤ T │\n // │ ┌─────┐ └─────┘\n // └─┤ S │\n // └─────┘\n controls = [\n { x: defaultControlX, y: nonAroundPosition.y },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n } else {\n // ┌─────────┐\n // │ ┌─────┐ │ ┌─────┐\n // └─┤ S │ └─┤ T │\n // └─────┘ └─────┘\n const middleX =\n (nonAround.x +\n (nonAround.width / 2) * sign +\n around.x -\n (around.width / 2) * sign) /\n 2;\n controls = [\n { x: middleX, y: nonAroundPosition.y },\n { x: middleX, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n }\n }\n } else {\n // Opposite direction\n const targetSign =\n targetDirection === \"bottom\" || targetDirection === \"right\" ? 1 : -1;\n let axis: \"x\" | \"y\";\n let oppositeAxis: \"x\" | \"y\";\n let size: \"width\" | \"height\";\n let oppositeSize: \"width\" | \"height\";\n if (sourceIsVertical) {\n axis = \"y\";\n oppositeAxis = \"x\";\n size = \"height\";\n oppositeSize = \"width\";\n } else {\n axis = \"x\";\n oppositeAxis = \"y\";\n size = \"width\";\n oppositeSize = \"height\";\n }\n const targetEdge = target[axis] + (target[size] / 2) * targetSign;\n const sourceEdge = source[axis] - (source[size] / 2) * targetSign;\n const targetControl = targetEdge + MINIMAL_OFFSET * targetSign;\n const sourceControl = sourceEdge - MINIMAL_OFFSET * targetSign;\n const oppositeIsStraight = p0[oppositeAxis] === p1[oppositeAxis];\n if ((sourceControl - targetControl) * targetSign >= 0) {\n const middle = (sourceControl + targetControl) / 2;\n if (oppositeIsStraight) {\n // Straight line\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // │\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌───┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: middle },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: middle },\n ] as unknown[] as NodePosition[];\n }\n } else if (\n oppositeIsStraight &&\n (sourceEdge - targetEdge) * targetSign >= 0\n ) {\n // Straight line (very close)\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n const targetOppositeSign =\n target[oppositeAxis] < source[oppositeAxis] ? -1 : 1;\n const sourceOppositeControl =\n source[oppositeAxis] +\n (source[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n const targetOppositeControl =\n target[oppositeAxis] -\n (target[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n if (\n (targetOppositeControl - sourceOppositeControl) * targetOppositeSign >=\n 0 ||\n Math.abs((sourceControl - targetControl) * targetSign) < MINIMAL_OFFSET\n ) {\n // ┌─────┐\n // ┌────┐ │ T │\n // ┌──┴──┐ │ └──┬──┘\n // │ S │ └────┘\n // └─────┘\n const oppositeMiddle =\n (sourceOppositeControl + targetOppositeControl) / 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n } else {\n // ┌────┐\n // ┌──┴──┐ │\n // │ S │ │\n // └─────┘ │\n // ┌─────────┘\n // │ ┌─────┐\n // │ │ T │\n // │ └──┬──┘\n // └────┘\n const middle =\n (source[axis] +\n (source[size] / 2) * targetSign +\n target[axis] -\n (target[size] / 2) * targetSign) /\n 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n }\n }\n }\n\n if (reverseControls) {\n controls.reverse();\n }\n\n return [p0, ...controls, p1] as NodePosition[];\n}\n\nfunction getCoordinates(\n node: NodeRect,\n direction: Direction,\n position: number\n): NodePosition {\n const { x, y, width, height } = node;\n switch (direction) {\n case \"top\":\n return {\n x: x - width / 2 + width * position,\n y: y - height / 2,\n };\n case \"bottom\":\n return {\n x: x - width / 2 + width * position,\n y: y + height / 2,\n };\n case \"left\":\n return {\n x: x - width / 2,\n y: y - height / 2 + height * position,\n };\n case \"right\":\n return {\n x: x + width / 2,\n y: y - height / 2 + height * position,\n };\n }\n}\n","import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n case \"circle\":\n Component = CircleMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction CircleMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n const r = 3;\n const d = r * 3;\n return (\n <marker\n viewBox={`0 0 ${d} ${d}`}\n refX={r}\n refY={r}\n id={id}\n overflow=\"visible\"\n markerWidth={d}\n markerHeight={d}\n >\n <circle stroke=\"none\" fill={strokeColor} cx={r} cy={r} r={r} />\n </marker>\n );\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import {\n curveLinear,\n line,\n curveBasis,\n curveBumpX,\n curveBumpY,\n type CurveFactory,\n curveMonotoneX,\n curveNatural,\n curveMonotoneY,\n} from \"d3-shape\";\nimport type { CurveType, NodePosition } from \"../interfaces\";\nimport type { LineSegmentJumps } from \"../../draw-canvas/interfaces\";\n\n/**\n * Generate Line from points\n */\nexport function curveLine(\n points: Array<NodePosition> | null | undefined,\n curveType: CurveType | undefined,\n startOffset: number,\n endOffset: number,\n jumpsMap?: Map<number, LineSegmentJumps> | null\n): string {\n if (!Array.isArray(points)) {\n return \"\";\n }\n let curveFactory: CurveFactory;\n switch (curveType) {\n case \"curveLinear\":\n curveFactory = curveLinear;\n break;\n case \"curveBumpX\":\n curveFactory = curveBumpX;\n break;\n case \"curveBumpY\":\n curveFactory = curveBumpY;\n break;\n case \"curveMonotoneX\":\n curveFactory = curveMonotoneX;\n break;\n case \"curveMonotoneY\":\n curveFactory = curveMonotoneY;\n break;\n case \"curveNatural\":\n curveFactory = curveNatural;\n break;\n default:\n curveFactory = curveBasis;\n }\n const startOffsets = getOffsets(points[1], points[0], startOffset);\n const endOffsets = getOffsets(\n points[points.length - 2],\n points[points.length - 1],\n endOffset\n );\n const lineFunction = line<NodePosition>()\n .x(\n (d, index) =>\n d.x -\n (index === 0\n ? startOffsets.x\n : index === points.length - 1\n ? endOffsets.x\n : 0)\n )\n .y(\n (d, index) =>\n d.y -\n (index === 0\n ? startOffsets.y\n : index === points.length - 1\n ? endOffsets.y\n : 0)\n )\n .curve(curveFactory);\n\n if (jumpsMap && curveType == \"curveLinear\") {\n const d: string[] = [];\n for (let i = 0; i < points.length - 1; i++) {\n const start = points[i];\n const end = points[i + 1];\n if (i === 0) {\n d.push(`M${start.x},${start.y}`);\n }\n // 处理交叉跨线点\n const jump = jumpsMap.get(i);\n if (jump) {\n // 跨线点近似为一段半圆,参考 draw.io 使用三次贝赛尔曲线实现。\n // 一条 jump 记录中所有的 jumpPoints 都在同一线段上,因此角度一致、尺寸一致。\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const angle = Math.atan2(dy, dx);\n const direction = Math.abs(angle) <= Math.PI / 2 ? -1 : 1;\n const verticalAngle = angle + (Math.PI / 2) * direction;\n const offsetX = jump.radius * 1.3 * Math.cos(verticalAngle);\n const offsetY = jump.radius * 1.3 * Math.sin(verticalAngle);\n const xDiff = jump.radius * Math.cos(angle);\n const yDiff = jump.radius * Math.sin(angle);\n for (const p of jump.jumpPoints) {\n const x0 = p.x - xDiff;\n const y0 = p.y - yDiff;\n const x1 = p.x + xDiff;\n const y1 = p.y + yDiff;\n d.push(`L${x0},${y0}`);\n d.push(\n `C${x0 + offsetX},${y0 + offsetY} ${x1 + offsetX},${y1 + offsetY} ${x1},${y1}`\n );\n }\n }\n d.push(`L${end.x},${end.y}`);\n }\n return d.join(\"\");\n }\n\n return lineFunction(points)!;\n}\n\nfunction getOffsets(\n start: NodePosition,\n end: NodePosition,\n offset: number\n): NodePosition {\n if (!offset) {\n return { x: 0, y: 0 };\n }\n const { x: x0, y: y0 } = start;\n const { x: x1, y: y1 } = end;\n const distance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n const ratio = offset / distance;\n return {\n x: (x1 - x0) * ratio,\n y: (y1 - y0) * ratio,\n };\n}\n","import type { PositionTuple } from \"../interfaces\";\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nexport function intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n"],"names":["getDirectLinePoints","source","target","parallelGap","edgeView","hasExitPosition","exitPosition","hasEntryPosition","entryPosition","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","x","dy","y","angle","Math","atan2","cos","PI","sin","line","width","height","sourceIntersections","getIntersections","length","targetIntersections","rect","vertices","possibleLines","i","push","intersections","item","intersection","intersect","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","extractPartialRectTuple","value","Array","isArray","v0","v1","fill","MINIMAL_OFFSET","getPolyLinePoints","sourceDirection","targetDirection","sourcePosition","targetPosition","getCoordinates","controls","reverseControls","sourceIsVertical","horizontal","vertical","horizontalSign","verticalSign","horizontalPosition","verticalPosition","defaultControlX","defaultControlY","controlY0","controlY1","middleY","middleX","sourceExtendX","sign","start","end","startPosition","endPosition","axis","oppositeAxis","around","nonAround","aroundPosition","nonAroundPosition","aroundSign","targetSign","size","oppositeSize","targetEdge","sourceEdge","targetControl","sourceControl","oppositeIsStraight","middle","targetOppositeSign","sourceOppositeControl","targetOppositeControl","abs","oppositeMiddle","reverse","direction","position","MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","CircleMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","overflow","markerWidth","r","markerHeight","stroke","cx","cy","_ref3","orient","strokeLinejoin","d","strokeWidth","_ref4","_ref5","curveLine","points","curveType","startOffset","endOffset","jumpsMap","curveFactory","curveLinear","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveNatural","curveBasis","startOffsets","getOffsets","endOffsets","lineFunction","index","curve","jump","get","verticalAngle","offsetX","radius","offsetY","p","jumpPoints","x0","y0","x1","y1","join","offset","ratio","sqrt","pow","x2","y2","x3","y3","x4","y4","denominator","ua","ub"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4765,7146],{7146:(e,t,r)=>{function o(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return function(n,s){if("string"==typeof t?n.name===t:t.includes(n.name)){const t=[];for(let i=1;i<=r;i++){const r=s[s.length-i];if("MemberExpression"===(null==r?void 0:r.node.type)&&"object"===r.key){const s=r.node;s.computed||"Identifier"!==s.property.type?s.computed&&"Literal"===s.property.type&&"string"==typeof s.property.value?t.push(o?`${n.name}.${s.property.value}`:s.property.value):e.hasNonStaticUsage=!0:t.push(o?`${n.name}.${s.property.name}`:s.property.name)}else e.hasNonStaticUsage=!0}t.length===r&&e.usedProperties.add(t.join("."))}}}function n(e,t){return function(r,o,n){if(o.name===e){const e=n[n.length-1],o=n[n.length-2];if("CallExpression"===(null==o?void 0:o.node.type)&&"callee"===(null==o?void 0:o.key)&&"MemberExpression"===(null==e?void 0:e.node.type)&&"object"===e.key&&(e.node.computed?"Literal"===e.node.property.type&&e.node.property.value===t:"Identifier"===e.node.property.type&&e.node.property.name===t)){const e=o.node.arguments;if(e.length>0){const t=e[0];"Literal"===t.type&&"string"==typeof t.value?r.usedArgs.add(t.value):r.hasNonStaticUsage=!0}}}}}r.r(t),r.d(t,{beforeVisitGlobalMember:()=>o,collectAppGetMenuUsage:()=>s,collectInstalledAppsHasUsage:()=>i,collectMemberUsage:()=>p,collectMemberUsageInFunction:()=>b,createProviderClass:()=>c.createProviderClass,replaceUseChildren:()=>x,scanPermissionActionsInAny:()=>A,scanPermissionActionsInStoryboard:()=>v,strictCollectMemberUsage:()=>u,track:()=>f,trackAll:()=>y,traverseStoryboardExpressions:()=>l,traverseStoryboardFunction:()=>g,traverseStoryboardFunctions:()=>h,unwrapProvider:()=>c.unwrapProvider});const s=n("APP","getMenu"),i=n("INSTALLED_APPS","has");var a=r(1321),c=r(410);function l(e,t,r){const o=new WeakSet,{matchExpressionString:n,visitNotMatchedExpressionString:s,visitNonExpressionString:i,visitObject:l}="string"==typeof r?{matchExpressionString:e=>e.includes(r)}:r;!function e(r){if("string"==typeof r)if((0,a.isEvaluable)(r))if(n(r))try{(0,a.preevaluate)(r,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal(e,o){t(e,o,r)}}})}catch(e){console.error("Parse storyboard expression failed:",e)}else null==s||s(r);else null==i||i(r);else if((0,c.isObject)(r)){if(o.has(r))return;o.add(r),null==l||l(r);for(const t of Array.isArray(r)?r:Object.values(r))e(t)}}(e)}function u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const{hasNonStaticUsage:o,nonStaticUsage:n,usedProperties:s}=p(e,t,r);if(o)throw new Error(`Non-static usage of ${t} is prohibited, check your expression: "${n}"`);return s}function p(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n={usedProperties:new Set,hasNonStaticUsage:!1},s=o(n,t,r);return l(e,((e,t,r)=>{s(e,t),n.hasNonStaticUsage&&(n.nonStaticUsage=r)}),t),n}const d=["CTX","STATE","FORM_STATE"];function f(e,t,r){if(e.includes(t)){const n={usedProperties:new Set,hasNonStaticUsage:!1},{expression:s}=(0,a.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal:o(n,r)}});let i;if("SequenceExpression"===s.type&&(i=s.expressions[0])&&"Literal"===i.type&&i.value===t){if(n.usedProperties.size>0)return n.usedProperties;console.warn(`You are using "${t}" but no \`${r}\` usage found in your expression: ${JSON.stringify(e)}`)}}return!1}function y(e){if(d.some((t=>e.includes(t)))){const t={usedProperties:new Set,hasNonStaticUsage:!1};if((0,a.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal:o(t,d,1,!0)}}),t.usedProperties.size>0){const e=[...t.usedProperties],r={context:!1,state:!1,formState:!1},o={CTX:"context",STATE:"state",FORM_STATE:"formState"};return e.forEach((e=>{const[t,n]=e.split(".");r[o[t]]||(r[o[t]]=[]),r[o[t]].push(n)})),r}console.warn(`You are using track all but no "CTX" or "STATE" or "FORM_STATE" usage found in your expression: ${JSON.stringify(e)}`)}return!1}function h(e,t,r){if(Array.isArray(e))for(const o of e)null!=r&&r.matchSource&&!r.matchSource(o.source)||g(o,t)}function g(e,t,r){try{(0,a.precookFunction)(e.source,{typescript:e.typescript,withParent:!0,hooks:{beforeVisitGlobal:t},cacheKey:e})}catch(t){r||console.error(`Parse storyboard function "${e.name}" failed:`,t)}}function b(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const s={usedProperties:new Set,hasNonStaticUsage:!1};if(e.source.includes(t)&&g(e,o(s,t,n),r),s.hasNonStaticUsage&&!r)throw new Error(`Non-static usage of ${t} is prohibited, check your function: "${e.name}"`);return s.usedProperties.delete(e.name),s.usedProperties}const S="PERMISSIONS",m="check";function v(e){var t;const r=new Set,o=P(r),{customTemplates:n,functions:s}=null!==(t=e.meta)&&void 0!==t?t:{};return l([e.routes,n],o,S),h(s,o,{matchSource:e=>e.includes(S)}),Array.from(r)}function A(e){const t=new Set;return l(e,P(t),S),Array.from(t)}function P(e){return function(t,r){if(t.name===S){const t=r[r.length-1],o=r[r.length-2];if("CallExpression"===(null==o?void 0:o.node.type)&&"callee"===(null==o?void 0:o.key)&&"MemberExpression"===(null==t?void 0:t.node.type)&&"object"===t.key&&(t.node.computed?"Literal"===t.node.property.type&&t.node.property.value===m:"Identifier"===t.node.property.type&&t.node.property.name===m))for(const t of o.node.arguments)"Literal"===t.type&&"string"==typeof t.value&&e.add(t.value)}}}var k=r(1030);const{pull:w}=k,E=/^\[\w+\]$/;function x(e){if(Array.isArray(e))for(const t of e)T(t);else T(e)}function T(e){let t=e.slots;const r=new Map;if(Array.isArray(e.children)&&!t){const t=[];for(const n of e.children){var o;const e=null!==(o=n.slot)&&void 0!==o?o:"";if(E.test(e)){delete n.slot;const o=r.get(e);o?o.push(n):r.set(e,[n]),t.push(n)}T(n)}w(e.children,...t)}else{null!=t||(t={});for(const[e,o]of Object.entries(t)){if(E.test(e)){const{bricks:n}=o;Array.isArray(n)&&n.length>0&&(r.set(e,n),x(n)),delete t[e]}Array.isArray(o.bricks)&&x(o.bricks)}}r.size>0&&N(e.properties,r)}function N(e,t){if(Array.isArray(e))for(const r of e)N(r,t);else if((0,c.isObject)(e))for(const[r,o]of Object.entries(e))if("useChildren"===r){const n=t.get(o);n&&(delete e[r],e.useBrick=1===n.length?n[0]:n)}else N(o,t)}}}]);
|
|
2
|
+
//# sourceMappingURL=4765.0ab66eb8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/4765.09fa27a9.js","mappings":"6IAAO,SAASA,EAAwBC,EAAOC,GAC7C,IAAIC,EAAQC,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,EAC5EG,EAAqBH,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,IAAmBA,UAAU,GACxF,OAAO,SAA2BI,EAAMC,GACtC,GAA0B,iBAAfP,EAA0BM,EAAKE,OAASR,EAAaA,EAAWS,SAASH,EAAKE,MAAO,CAC9F,MAAME,EAAW,GACjB,IAAK,IAAIC,EAAI,EAAGA,GAAKV,EAAOU,IAAK,CAC/B,MAAMC,EAAeL,EAAOA,EAAOJ,OAASQ,GAC5C,GAA6F,sBAAxFC,aAAmD,EAASA,EAAaN,KAAKO,OAAqD,WAArBD,EAAaE,IAAkB,CAChJ,MAAMC,EAAaH,EAAaN,KAC3BS,EAAWC,UAAyC,eAA7BD,EAAWE,SAASJ,KAErCE,EAAWC,UAAyC,YAA7BD,EAAWE,SAASJ,MAA2D,iBAA9BE,EAAWE,SAASC,MACrGR,EAASS,KAAKd,EAAqB,GAAGC,EAAKE,QAAQO,EAAWE,SAASC,QAAUH,EAAWE,SAASC,OAErGnB,EAAMqB,mBAAoB,EAJ1BV,EAASS,KAAKd,EAAqB,GAAGC,EAAKE,QAAQO,EAAWE,SAAST,OAASO,EAAWE,SAAST,KAMxG,MACET,EAAMqB,mBAAoB,CAE9B,CACIV,EAASP,SAAWF,GACtBF,EAAMsB,eAAeC,IAAIZ,EAASa,KAAK,KAE3C,CACF,CACF,CC1BA,SAASC,EAA8BC,EAAQR,GAC7C,OAAO,SAAgClB,EAAOO,EAAMC,GAClD,GAAID,EAAKE,OAASiB,EAAQ,CACxB,MAAMb,EAAeL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GACNQ,EACA7E,MAAMC,QAAQoE,IAAaA,EAASxH,OAAS,IAC/CsH,EAAeS,IAAIH,EAAMJ,GACzBP,EAAmBO,WAEdH,EAAMO,EACf,CACIzE,MAAMC,QAAQ4E,EAASE,SACzBjB,EAAmBe,EAASE,OAEhC,CACF,CACIZ,EAAejD,KAAO,GACxB8D,EAAoBhB,EAAMiB,WAAYd,EAE1C,CACA,SAASa,EAAoBpH,EAAOuG,GAClC,GAAInE,MAAMC,QAAQrC,GAChB,IAAK,MAAMmC,KAAQnC,EACjBoH,EAAoBjF,EAAMoE,QAEvB,IAAI,IAAAtE,UAASjC,GAClB,IAAK,MAAOsH,EAAG9F,KAAMc,OAAO4E,QAAQlH,GAClC,GAAU,gBAANsH,EAAqB,CACvB,MAAMb,EAAWF,EAAeQ,IAAIvF,GAChCiF,WACKzG,EAAMsH,GACbtH,EAAMuH,SAA+B,IAApBd,EAASxH,OAAewH,EAAS,GAAKA,EAE3D,MACEW,EAAoB5F,EAAG+E,EAI/B,C","sources":["webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/beforeVisitGlobalMember.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/collectMemberCallUsage.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/traverse.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/collectMemberUsage.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/track.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/functions/traverse.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/functions/collectMemberUsageInFunction.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/permissions.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/replaceUseChildren.js"],"sourcesContent":["export function beforeVisitGlobalMember(usage, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n let rememberObjectName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return function beforeVisitGlobal(node, parent) {\n if (typeof objectName === \"string\" ? node.name === objectName : objectName.includes(node.name)) {\n const segments = [];\n for (let i = 1; i <= level; i++) {\n const memberParent = parent[parent.length - i];\n if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\") {\n const memberNode = memberParent.node;\n if (!memberNode.computed && memberNode.property.type === \"Identifier\") {\n segments.push(rememberObjectName ? `${node.name}.${memberNode.property.name}` : memberNode.property.name);\n } else if (memberNode.computed && memberNode.property.type === \"Literal\" && typeof memberNode.property.value === \"string\") {\n segments.push(rememberObjectName ? `${node.name}.${memberNode.property.value}` : memberNode.property.value);\n } else {\n usage.hasNonStaticUsage = true;\n }\n } else {\n usage.hasNonStaticUsage = true;\n }\n }\n if (segments.length === level) {\n usage.usedProperties.add(segments.join(\".\"));\n }\n }\n };\n}\n//# sourceMappingURL=beforeVisitGlobalMember.js.map","function collectMemberCallUsageFactory(object, property) {\n return function collectMemberCallUsage(usage, node, parent) {\n if (node.name === object) {\n const memberParent = parent[parent.length - 1];\n const callParent = parent[parent.length - 2];\n if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === \"CallExpression\" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === \"callee\" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\" && (memberParent.node.computed ? memberParent.node.property.type === \"Literal\" && memberParent.node.property.value === property : memberParent.node.property.type === \"Identifier\" && memberParent.node.property.name === property)) {\n const args = callParent.node.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n if (firstArg.type === \"Literal\" && typeof firstArg.value === \"string\") {\n usage.usedArgs.add(firstArg.value);\n } else {\n usage.hasNonStaticUsage = true;\n }\n }\n }\n }\n };\n}\nexport const collectAppGetMenuUsage = collectMemberCallUsageFactory(\"APP\", \"getMenu\");\nexport const collectInstalledAppsHasUsage = collectMemberCallUsageFactory(\"INSTALLED_APPS\", \"has\");\n//# sourceMappingURL=collectMemberCallUsage.js.map","import { isEvaluable, preevaluate } from \"@next-core/cook\";\nimport { isObject } from \"@next-core/utils/general\";\nexport function traverseStoryboardExpressions(data, beforeVisitGlobal,\n// If `options` is a string, it means the *keyword*.\noptions) {\n const memo = new WeakSet();\n const {\n matchExpressionString,\n visitNotMatchedExpressionString,\n visitNonExpressionString,\n visitObject\n } = typeof options === \"string\" ? {\n matchExpressionString: v => v.includes(options)\n } : options;\n function traverse(value) {\n if (typeof value === \"string\") {\n if (isEvaluable(value)) {\n if (matchExpressionString(value)) {\n try {\n preevaluate(value, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n beforeVisitGlobal(node, parent, value);\n }\n }\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Parse storyboard expression failed:\", error);\n }\n } else {\n visitNotMatchedExpressionString === null || visitNotMatchedExpressionString === void 0 || visitNotMatchedExpressionString(value);\n }\n } else {\n visitNonExpressionString === null || visitNonExpressionString === void 0 || visitNonExpressionString(value);\n }\n } else if (isObject(value)) {\n // Avoid call stack overflow.\n if (memo.has(value)) {\n return;\n }\n memo.add(value);\n visitObject === null || visitObject === void 0 || visitObject(value);\n for (const item of Array.isArray(value) ? value : Object.values(value)) {\n traverse(item);\n }\n }\n }\n traverse(data);\n}\n//# sourceMappingURL=traverse.js.map","import { beforeVisitGlobalMember } from \"./beforeVisitGlobalMember.js\";\nimport { traverseStoryboardExpressions } from \"./traverse.js\";\nexport function strictCollectMemberUsage(data, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const {\n hasNonStaticUsage,\n nonStaticUsage,\n usedProperties\n } = collectMemberUsage(data, objectName, level);\n if (hasNonStaticUsage) {\n throw new Error(`Non-static usage of ${objectName} is prohibited, check your expression: \"${nonStaticUsage}\"`);\n }\n return usedProperties;\n}\nexport function collectMemberUsage(data, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n const beforeVisitGlobal = beforeVisitGlobalMember(usage, objectName, level);\n traverseStoryboardExpressions(data, (node, parent, expr) => {\n beforeVisitGlobal(node, parent);\n if (usage.hasNonStaticUsage) {\n usage.nonStaticUsage = expr;\n }\n }, objectName);\n return usage;\n}\n//# sourceMappingURL=collectMemberUsage.js.map","import { preevaluate } from \"@next-core/cook\";\nimport { beforeVisitGlobalMember } from \"./beforeVisitGlobalMember.js\";\nconst TRACK_NAMES = [\"CTX\", \"STATE\", \"FORM_STATE\"];\nexport function track(raw, trackText, variableName) {\n if (raw.includes(trackText)) {\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n const {\n expression\n } = preevaluate(raw, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal: beforeVisitGlobalMember(usage, variableName)\n }\n });\n let trackCtxExp;\n if (expression.type === \"SequenceExpression\" && (trackCtxExp = expression.expressions[0]) && trackCtxExp.type === \"Literal\" && trackCtxExp.value === trackText) {\n if (usage.usedProperties.size > 0) {\n return usage.usedProperties;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`You are using \"${trackText}\" but no \\`${variableName}\\` usage found in your expression: ${JSON.stringify(raw)}`);\n }\n }\n }\n return false;\n}\nexport function trackAll(raw) {\n // Do not pre-evaluate a string if it doesn't include track names.\n if (TRACK_NAMES.some(name => raw.includes(name))) {\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n preevaluate(raw, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal: beforeVisitGlobalMember(usage, TRACK_NAMES, 1, true)\n }\n });\n if (usage.usedProperties.size > 0) {\n const usedProperties = [...usage.usedProperties];\n const result = {\n context: false,\n state: false,\n formState: false\n };\n const keyMap = {\n CTX: \"context\",\n STATE: \"state\",\n FORM_STATE: \"formState\"\n };\n usedProperties.forEach(item => {\n const [key, name] = item.split(\".\");\n if (!result[keyMap[key]]) {\n result[keyMap[key]] = [];\n }\n result[keyMap[key]].push(name);\n });\n return result;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`You are using track all but no \"CTX\" or \"STATE\" or \"FORM_STATE\" usage found in your expression: ${JSON.stringify(raw)}`);\n }\n }\n return false;\n}\n//# sourceMappingURL=track.js.map","import { precookFunction } from \"@next-core/cook\";\nexport function traverseStoryboardFunctions(functions, beforeVisitGlobal, options) {\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n if (!(options !== null && options !== void 0 && options.matchSource) || options.matchSource(fn.source)) {\n traverseStoryboardFunction(fn, beforeVisitGlobal);\n }\n }\n }\n}\nexport function traverseStoryboardFunction(fn, beforeVisitGlobal, silentErrors) {\n try {\n precookFunction(fn.source, {\n typescript: fn.typescript,\n withParent: true,\n hooks: {\n beforeVisitGlobal\n },\n cacheKey: fn\n });\n } catch (error) {\n if (!silentErrors) {\n // eslint-disable-next-line no-console\n console.error(`Parse storyboard function \"${fn.name}\" failed:`, error);\n }\n }\n}\n//# sourceMappingURL=traverse.js.map","import { beforeVisitGlobalMember } from \"../expressions/beforeVisitGlobalMember.js\";\nimport { traverseStoryboardFunction } from \"./traverse.js\";\nexport function collectMemberUsageInFunction(fn, objectName, silentErrors) {\n let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n if (fn.source.includes(objectName)) {\n traverseStoryboardFunction(fn, beforeVisitGlobalMember(usage, objectName, level), silentErrors);\n }\n if (usage.hasNonStaticUsage && !silentErrors) {\n throw new Error(`Non-static usage of ${objectName} is prohibited, check your function: \"${fn.name}\"`);\n }\n usage.usedProperties.delete(fn.name);\n return usage.usedProperties;\n}\n//# sourceMappingURL=collectMemberUsageInFunction.js.map","import { traverseStoryboardExpressions } from \"./expressions/index.js\";\nimport { traverseStoryboardFunctions } from \"./functions/index.js\";\nconst PERMISSIONS = \"PERMISSIONS\";\nconst check = \"check\";\nexport function scanPermissionActionsInStoryboard(storyboard) {\n var _storyboard$meta;\n const collection = new Set();\n const beforeVisitPermissions = beforeVisitPermissionsFactory(collection);\n const {\n customTemplates,\n functions\n } = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};\n traverseStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitPermissions, PERMISSIONS);\n traverseStoryboardFunctions(functions, beforeVisitPermissions, {\n matchSource(source) {\n return source.includes(PERMISSIONS);\n }\n });\n return Array.from(collection);\n}\nexport function scanPermissionActionsInAny(data) {\n const collection = new Set();\n traverseStoryboardExpressions(data, beforeVisitPermissionsFactory(collection), PERMISSIONS);\n return Array.from(collection);\n}\nfunction beforeVisitPermissionsFactory(collection) {\n return function beforeVisitPermissions(node, parent) {\n if (node.name === PERMISSIONS) {\n const memberParent = parent[parent.length - 1];\n const callParent = parent[parent.length - 2];\n if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === \"CallExpression\" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === \"callee\" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\" && (memberParent.node.computed ? memberParent.node.property.type === \"Literal\" && memberParent.node.property.value === check : memberParent.node.property.type === \"Identifier\" && memberParent.node.property.name === check)) {\n for (const arg of callParent.node.arguments) {\n if (arg.type === \"Literal\" && typeof arg.value === \"string\") {\n collection.add(arg.value);\n }\n }\n }\n }\n };\n}\n//# sourceMappingURL=permissions.js.map","import { isObject } from \"@next-core/utils/general\";\nimport lodash from \"lodash\";\nconst {\n pull\n} = lodash;\nconst USE_CHILDREN_SLOT_REGEXP = /^\\[\\w+\\]$/;\n\n/**\n * Replace `useChildren: \"[xxx]\"` with `useBrick`.\n *\n * This will mutate the input.\n */\nexport function replaceUseChildren(input) {\n if (Array.isArray(input)) {\n for (const brick of input) {\n replaceInBrick(brick);\n }\n } else {\n replaceInBrick(input);\n }\n}\nfunction replaceInBrick(brick) {\n let slots = brick.slots;\n const useChildrenMap = new Map();\n if (Array.isArray(brick.children) && !slots) {\n const removeBricks = [];\n for (const child of brick.children) {\n var _child$slot;\n const slot = (_child$slot = child.slot) !== null && _child$slot !== void 0 ? _child$slot : \"\";\n if (USE_CHILDREN_SLOT_REGEXP.test(slot)) {\n delete child.slot;\n const children = useChildrenMap.get(slot);\n if (children) {\n children.push(child);\n } else {\n useChildrenMap.set(slot, [child]);\n }\n removeBricks.push(child);\n }\n replaceInBrick(child);\n }\n pull(brick.children, ...removeBricks);\n } else {\n slots !== null && slots !== void 0 ? slots : slots = {};\n for (const [slot, slotConf] of Object.entries(slots)) {\n if (USE_CHILDREN_SLOT_REGEXP.test(slot)) {\n const {\n bricks: children\n } = slotConf;\n if (Array.isArray(children) && children.length > 0) {\n useChildrenMap.set(slot, children);\n replaceUseChildren(children);\n }\n delete slots[slot];\n }\n if (Array.isArray(slotConf.bricks)) {\n replaceUseChildren(slotConf.bricks);\n }\n }\n }\n if (useChildrenMap.size > 0) {\n replaceInProperties(brick.properties, useChildrenMap);\n }\n}\nfunction replaceInProperties(value, useChildrenMap) {\n if (Array.isArray(value)) {\n for (const item of value) {\n replaceInProperties(item, useChildrenMap);\n }\n } else if (isObject(value)) {\n for (const [k, v] of Object.entries(value)) {\n if (k === \"useChildren\") {\n const children = useChildrenMap.get(v);\n if (children) {\n delete value[k];\n value.useBrick = children.length === 1 ? children[0] : children;\n }\n } else {\n replaceInProperties(v, useChildrenMap);\n }\n }\n }\n}\n//# sourceMappingURL=replaceUseChildren.js.map"],"names":["beforeVisitGlobalMember","usage","objectName","level","arguments","length","undefined","rememberObjectName","node","parent","name","includes","segments","i","memberParent","type","key","memberNode","computed","property","value","push","hasNonStaticUsage","usedProperties","add","join","collectMemberCallUsageFactory","object","callParent","args","firstArg","usedArgs","collectAppGetMenuUsage","collectInstalledAppsHasUsage","traverseStoryboardExpressions","data","beforeVisitGlobal","options","memo","WeakSet","matchExpressionString","visitNotMatchedExpressionString","visitNonExpressionString","visitObject","v","traverse","isEvaluable","preevaluate","cache","withParent","hooks","error","console","isObject","has","item","Array","isArray","Object","values","strictCollectMemberUsage","nonStaticUsage","collectMemberUsage","Error","Set","expr","TRACK_NAMES","track","raw","trackText","variableName","expression","trackCtxExp","expressions","size","warn","JSON","stringify","trackAll","some","result","context","state","formState","keyMap","CTX","STATE","FORM_STATE","forEach","split","traverseStoryboardFunctions","functions","fn","matchSource","source","traverseStoryboardFunction","silentErrors","precookFunction","typescript","cacheKey","collectMemberUsageInFunction","delete","PERMISSIONS","check","scanPermissionActionsInStoryboard","storyboard","_storyboard$meta","collection","beforeVisitPermissions","beforeVisitPermissionsFactory","customTemplates","meta","routes","from","scanPermissionActionsInAny","arg","pull","USE_CHILDREN_SLOT_REGEXP","replaceUseChildren","input","brick","replaceInBrick","slots","useChildrenMap","Map","children","removeBricks","child","_child$slot","slot","test","get","set","slotConf","entries","bricks","replaceInProperties","properties","k","useBrick"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"chunks/4765.0ab66eb8.js","mappings":"6IAAO,SAASA,EAAwBC,EAAOC,GAC7C,IAAIC,EAAQC,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,EAC5EG,EAAqBH,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,IAAmBA,UAAU,GACxF,OAAO,SAA2BI,EAAMC,GACtC,GAA0B,iBAAfP,EAA0BM,EAAKE,OAASR,EAAaA,EAAWS,SAASH,EAAKE,MAAO,CAC9F,MAAME,EAAW,GACjB,IAAK,IAAIC,EAAI,EAAGA,GAAKV,EAAOU,IAAK,CAC/B,MAAMC,EAAeL,EAAOA,EAAOJ,OAASQ,GAC5C,GAA6F,sBAAxFC,aAAmD,EAASA,EAAaN,KAAKO,OAAqD,WAArBD,EAAaE,IAAkB,CAChJ,MAAMC,EAAaH,EAAaN,KAC3BS,EAAWC,UAAyC,eAA7BD,EAAWE,SAASJ,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IAAK,MAAMC,KAASP,EAAMK,SAAU,CAClC,IAAIG,EACJ,MAAMC,EAAsC,QAA9BD,EAAcD,EAAME,YAAkC,IAAhBD,EAAyBA,EAAc,GAC3F,GAAIX,EAAyBa,KAAKD,GAAO,QAChCF,EAAME,KACb,MAAMJ,EAAWF,EAAeQ,IAAIF,GAChCJ,EACFA,EAASxG,KAAK0G,GAEdJ,EAAeS,IAAIH,EAAM,CAACF,IAE5BD,EAAazG,KAAK0G,EACpB,CACAN,EAAeM,EACjB,CACAX,EAAKI,EAAMK,YAAaC,EAC1B,KAAO,CACLJ,UAA6CA,EAAQ,CAAC,GACtD,IAAK,MAAOO,EAAMI,KAAa3E,OAAO4E,QAAQZ,GAAQ,CACpD,GAAIL,EAAyBa,KAAKD,GAAO,CACvC,MACEM,OAAQV,GACNQ,EACA7E,MAAMC,QAAQoE,IAAaA,EAASxH,OAAS,IAC/CsH,EAAeS,IAAIH,EAAMJ,GACzBP,EAAmBO,WAEdH,EAAMO,EACf,CACIzE,MAAMC,QAAQ4E,EAASE,SACzBjB,EAAmBe,EAASE,OAEhC,CACF,CACIZ,EAAejD,KAAO,GACxB8D,EAAoBhB,EAAMiB,WAAYd,EAE1C,CACA,SAASa,EAAoBpH,EAAOuG,GAClC,GAAInE,MAAMC,QAAQrC,GAChB,IAAK,MAAMmC,KAAQnC,EACjBoH,EAAoBjF,EAAMoE,QAEvB,IAAI,IAAAtE,UAASjC,GAClB,IAAK,MAAOsH,EAAG9F,KAAMc,OAAO4E,QAAQlH,GAClC,GAAU,gBAANsH,EAAqB,CACvB,MAAMb,EAAWF,EAAeQ,IAAIvF,GAChCiF,WACKzG,EAAMsH,GACbtH,EAAMuH,SAA+B,IAApBd,EAASxH,OAAewH,EAAS,GAAKA,EAE3D,MACEW,EAAoB5F,EAAG+E,EAI/B,C","sources":["webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/beforeVisitGlobalMember.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/collectMemberCallUsage.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/traverse.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/collectMemberUsage.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/expressions/track.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/functions/traverse.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/functions/collectMemberUsageInFunction.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/permissions.js","webpack:///../../node_modules/@next-core/utils/dist/esm/storyboard/replaceUseChildren.js"],"sourcesContent":["export function beforeVisitGlobalMember(usage, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n let rememberObjectName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n return function beforeVisitGlobal(node, parent) {\n if (typeof objectName === \"string\" ? node.name === objectName : objectName.includes(node.name)) {\n const segments = [];\n for (let i = 1; i <= level; i++) {\n const memberParent = parent[parent.length - i];\n if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\") {\n const memberNode = memberParent.node;\n if (!memberNode.computed && memberNode.property.type === \"Identifier\") {\n segments.push(rememberObjectName ? `${node.name}.${memberNode.property.name}` : memberNode.property.name);\n } else if (memberNode.computed && memberNode.property.type === \"Literal\" && typeof memberNode.property.value === \"string\") {\n segments.push(rememberObjectName ? `${node.name}.${memberNode.property.value}` : memberNode.property.value);\n } else {\n usage.hasNonStaticUsage = true;\n }\n } else {\n usage.hasNonStaticUsage = true;\n }\n }\n if (segments.length === level) {\n usage.usedProperties.add(segments.join(\".\"));\n }\n }\n };\n}\n//# sourceMappingURL=beforeVisitGlobalMember.js.map","function collectMemberCallUsageFactory(object, property) {\n return function collectMemberCallUsage(usage, node, parent) {\n if (node.name === object) {\n const memberParent = parent[parent.length - 1];\n const callParent = parent[parent.length - 2];\n if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === \"CallExpression\" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === \"callee\" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\" && (memberParent.node.computed ? memberParent.node.property.type === \"Literal\" && memberParent.node.property.value === property : memberParent.node.property.type === \"Identifier\" && memberParent.node.property.name === property)) {\n const args = callParent.node.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n if (firstArg.type === \"Literal\" && typeof firstArg.value === \"string\") {\n usage.usedArgs.add(firstArg.value);\n } else {\n usage.hasNonStaticUsage = true;\n }\n }\n }\n }\n };\n}\nexport const collectAppGetMenuUsage = collectMemberCallUsageFactory(\"APP\", \"getMenu\");\nexport const collectInstalledAppsHasUsage = collectMemberCallUsageFactory(\"INSTALLED_APPS\", \"has\");\n//# sourceMappingURL=collectMemberCallUsage.js.map","import { isEvaluable, preevaluate } from \"@next-core/cook\";\nimport { isObject } from \"@next-core/utils/general\";\nexport function traverseStoryboardExpressions(data, beforeVisitGlobal,\n// If `options` is a string, it means the *keyword*.\noptions) {\n const memo = new WeakSet();\n const {\n matchExpressionString,\n visitNotMatchedExpressionString,\n visitNonExpressionString,\n visitObject\n } = typeof options === \"string\" ? {\n matchExpressionString: v => v.includes(options)\n } : options;\n function traverse(value) {\n if (typeof value === \"string\") {\n if (isEvaluable(value)) {\n if (matchExpressionString(value)) {\n try {\n preevaluate(value, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n beforeVisitGlobal(node, parent, value);\n }\n }\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Parse storyboard expression failed:\", error);\n }\n } else {\n visitNotMatchedExpressionString === null || visitNotMatchedExpressionString === void 0 || visitNotMatchedExpressionString(value);\n }\n } else {\n visitNonExpressionString === null || visitNonExpressionString === void 0 || visitNonExpressionString(value);\n }\n } else if (isObject(value)) {\n // Avoid call stack overflow.\n if (memo.has(value)) {\n return;\n }\n memo.add(value);\n visitObject === null || visitObject === void 0 || visitObject(value);\n for (const item of Array.isArray(value) ? value : Object.values(value)) {\n traverse(item);\n }\n }\n }\n traverse(data);\n}\n//# sourceMappingURL=traverse.js.map","import { beforeVisitGlobalMember } from \"./beforeVisitGlobalMember.js\";\nimport { traverseStoryboardExpressions } from \"./traverse.js\";\nexport function strictCollectMemberUsage(data, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const {\n hasNonStaticUsage,\n nonStaticUsage,\n usedProperties\n } = collectMemberUsage(data, objectName, level);\n if (hasNonStaticUsage) {\n throw new Error(`Non-static usage of ${objectName} is prohibited, check your expression: \"${nonStaticUsage}\"`);\n }\n return usedProperties;\n}\nexport function collectMemberUsage(data, objectName) {\n let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n const beforeVisitGlobal = beforeVisitGlobalMember(usage, objectName, level);\n traverseStoryboardExpressions(data, (node, parent, expr) => {\n beforeVisitGlobal(node, parent);\n if (usage.hasNonStaticUsage) {\n usage.nonStaticUsage = expr;\n }\n }, objectName);\n return usage;\n}\n//# sourceMappingURL=collectMemberUsage.js.map","import { preevaluate } from \"@next-core/cook\";\nimport { beforeVisitGlobalMember } from \"./beforeVisitGlobalMember.js\";\nconst TRACK_NAMES = [\"CTX\", \"STATE\", \"FORM_STATE\"];\nexport function track(raw, trackText, variableName) {\n if (raw.includes(trackText)) {\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n const {\n expression\n } = preevaluate(raw, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal: beforeVisitGlobalMember(usage, variableName)\n }\n });\n let trackCtxExp;\n if (expression.type === \"SequenceExpression\" && (trackCtxExp = expression.expressions[0]) && trackCtxExp.type === \"Literal\" && trackCtxExp.value === trackText) {\n if (usage.usedProperties.size > 0) {\n return usage.usedProperties;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`You are using \"${trackText}\" but no \\`${variableName}\\` usage found in your expression: ${JSON.stringify(raw)}`);\n }\n }\n }\n return false;\n}\nexport function trackAll(raw) {\n // Do not pre-evaluate a string if it doesn't include track names.\n if (TRACK_NAMES.some(name => raw.includes(name))) {\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n preevaluate(raw, {\n cache: true,\n withParent: true,\n hooks: {\n beforeVisitGlobal: beforeVisitGlobalMember(usage, TRACK_NAMES, 1, true)\n }\n });\n if (usage.usedProperties.size > 0) {\n const usedProperties = [...usage.usedProperties];\n const result = {\n context: false,\n state: false,\n formState: false\n };\n const keyMap = {\n CTX: \"context\",\n STATE: \"state\",\n FORM_STATE: \"formState\"\n };\n usedProperties.forEach(item => {\n const [key, name] = item.split(\".\");\n if (!result[keyMap[key]]) {\n result[keyMap[key]] = [];\n }\n result[keyMap[key]].push(name);\n });\n return result;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`You are using track all but no \"CTX\" or \"STATE\" or \"FORM_STATE\" usage found in your expression: ${JSON.stringify(raw)}`);\n }\n }\n return false;\n}\n//# sourceMappingURL=track.js.map","import { precookFunction } from \"@next-core/cook\";\nexport function traverseStoryboardFunctions(functions, beforeVisitGlobal, options) {\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n if (!(options !== null && options !== void 0 && options.matchSource) || options.matchSource(fn.source)) {\n traverseStoryboardFunction(fn, beforeVisitGlobal);\n }\n }\n }\n}\nexport function traverseStoryboardFunction(fn, beforeVisitGlobal, silentErrors) {\n try {\n precookFunction(fn.source, {\n typescript: fn.typescript,\n withParent: true,\n hooks: {\n beforeVisitGlobal\n },\n cacheKey: fn\n });\n } catch (error) {\n if (!silentErrors) {\n // eslint-disable-next-line no-console\n console.error(`Parse storyboard function \"${fn.name}\" failed:`, error);\n }\n }\n}\n//# sourceMappingURL=traverse.js.map","import { beforeVisitGlobalMember } from \"../expressions/beforeVisitGlobalMember.js\";\nimport { traverseStoryboardFunction } from \"./traverse.js\";\nexport function collectMemberUsageInFunction(fn, objectName, silentErrors) {\n let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n const usage = {\n usedProperties: new Set(),\n hasNonStaticUsage: false\n };\n if (fn.source.includes(objectName)) {\n traverseStoryboardFunction(fn, beforeVisitGlobalMember(usage, objectName, level), silentErrors);\n }\n if (usage.hasNonStaticUsage && !silentErrors) {\n throw new Error(`Non-static usage of ${objectName} is prohibited, check your function: \"${fn.name}\"`);\n }\n usage.usedProperties.delete(fn.name);\n return usage.usedProperties;\n}\n//# sourceMappingURL=collectMemberUsageInFunction.js.map","import { traverseStoryboardExpressions } from \"./expressions/index.js\";\nimport { traverseStoryboardFunctions } from \"./functions/index.js\";\nconst PERMISSIONS = \"PERMISSIONS\";\nconst check = \"check\";\nexport function scanPermissionActionsInStoryboard(storyboard) {\n var _storyboard$meta;\n const collection = new Set();\n const beforeVisitPermissions = beforeVisitPermissionsFactory(collection);\n const {\n customTemplates,\n functions\n } = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};\n traverseStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitPermissions, PERMISSIONS);\n traverseStoryboardFunctions(functions, beforeVisitPermissions, {\n matchSource(source) {\n return source.includes(PERMISSIONS);\n }\n });\n return Array.from(collection);\n}\nexport function scanPermissionActionsInAny(data) {\n const collection = new Set();\n traverseStoryboardExpressions(data, beforeVisitPermissionsFactory(collection), PERMISSIONS);\n return Array.from(collection);\n}\nfunction beforeVisitPermissionsFactory(collection) {\n return function beforeVisitPermissions(node, parent) {\n if (node.name === PERMISSIONS) {\n const memberParent = parent[parent.length - 1];\n const callParent = parent[parent.length - 2];\n if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === \"CallExpression\" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === \"callee\" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === \"MemberExpression\" && memberParent.key === \"object\" && (memberParent.node.computed ? memberParent.node.property.type === \"Literal\" && memberParent.node.property.value === check : memberParent.node.property.type === \"Identifier\" && memberParent.node.property.name === check)) {\n for (const arg of callParent.node.arguments) {\n if (arg.type === \"Literal\" && typeof arg.value === \"string\") {\n collection.add(arg.value);\n }\n }\n }\n }\n };\n}\n//# sourceMappingURL=permissions.js.map","import { isObject } from \"@next-core/utils/general\";\nimport lodash from \"lodash\";\nconst {\n pull\n} = lodash;\nconst USE_CHILDREN_SLOT_REGEXP = /^\\[\\w+\\]$/;\n\n/**\n * Replace `useChildren: \"[xxx]\"` with `useBrick`.\n *\n * This will mutate the input.\n */\nexport function replaceUseChildren(input) {\n if (Array.isArray(input)) {\n for (const brick of input) {\n replaceInBrick(brick);\n }\n } else {\n replaceInBrick(input);\n }\n}\nfunction replaceInBrick(brick) {\n let slots = brick.slots;\n const useChildrenMap = new Map();\n if (Array.isArray(brick.children) && !slots) {\n const removeBricks = [];\n for (const child of brick.children) {\n var _child$slot;\n const slot = (_child$slot = child.slot) !== null && _child$slot !== void 0 ? _child$slot : \"\";\n if (USE_CHILDREN_SLOT_REGEXP.test(slot)) {\n delete child.slot;\n const children = useChildrenMap.get(slot);\n if (children) {\n children.push(child);\n } else {\n useChildrenMap.set(slot, [child]);\n }\n removeBricks.push(child);\n }\n replaceInBrick(child);\n }\n pull(brick.children, ...removeBricks);\n } else {\n slots !== null && slots !== void 0 ? slots : slots = {};\n for (const [slot, slotConf] of Object.entries(slots)) {\n if (USE_CHILDREN_SLOT_REGEXP.test(slot)) {\n const {\n bricks: children\n } = slotConf;\n if (Array.isArray(children) && children.length > 0) {\n useChildrenMap.set(slot, children);\n replaceUseChildren(children);\n }\n delete slots[slot];\n }\n if (Array.isArray(slotConf.bricks)) {\n replaceUseChildren(slotConf.bricks);\n }\n }\n }\n if (useChildrenMap.size > 0) {\n replaceInProperties(brick.properties, useChildrenMap);\n }\n}\nfunction replaceInProperties(value, useChildrenMap) {\n if (Array.isArray(value)) {\n for (const item of value) {\n replaceInProperties(item, useChildrenMap);\n }\n } else if (isObject(value)) {\n for (const [k, v] of Object.entries(value)) {\n if (k === \"useChildren\") {\n const children = useChildrenMap.get(v);\n if (children) {\n delete value[k];\n value.useBrick = children.length === 1 ? children[0] : children;\n }\n } else {\n replaceInProperties(v, useChildrenMap);\n }\n }\n }\n}\n//# sourceMappingURL=replaceUseChildren.js.map"],"names":["beforeVisitGlobalMember","usage","objectName","level","arguments","length","undefined","rememberObjectName","node","parent","name","includes","segments","i","memberParent","type","key","memberNode","computed","property","value","push","hasNonStaticUsage","usedProperties","add","join","collectMemberCallUsageFactory","object","callParent","args","firstArg","usedArgs","collectAppGetMenuUsage","collectInstalledAppsHasUsage","traverseStoryboardExpressions","data","beforeVisitGlobal","options","memo","WeakSet","matchExpressionString","visitNotMatchedExpressionString","visitNonExpressionString","visitObject","v","traverse","isEvaluable","preevaluate","cache","withParent","hooks","error","console","isObject","has","item","Array","isArray","Object","values","strictCollectMemberUsage","nonStaticUsage","collectMemberUsage","Error","Set","expr","TRACK_NAMES","track","raw","trackText","variableName","expression","trackCtxExp","expressions","size","warn","JSON","stringify","trackAll","some","result","context","state","formState","keyMap","CTX","STATE","FORM_STATE","forEach","split","traverseStoryboardFunctions","functions","fn","matchSource","source","traverseStoryboardFunction","silentErrors","precookFunction","typescript","cacheKey","collectMemberUsageInFunction","delete","PERMISSIONS","check","scanPermissionActionsInStoryboard","storyboard","_storyboard$meta","collection","beforeVisitPermissions","beforeVisitPermissionsFactory","customTemplates","meta","routes","from","scanPermissionActionsInAny","arg","pull","USE_CHILDREN_SLOT_REGEXP","replaceUseChildren","input","brick","replaceInBrick","slots","useChildrenMap","Map","children","removeBricks","child","_child$slot","slot","test","get","set","slotConf","entries","bricks","replaceInProperties","properties","k","useBrick"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4837,7218],{4837:(e,r,t)=>{t.r(r),t.d(r,{ReactUseBrick:()=>s,ReactUseMultipleBricks:()=>u,asyncWrapBrick:()=>k,useCurrentApp:()=>l,useCurrentTheme:()=>o,useLazyWrapBrick:()=>w,useNavConfig:()=>h,useProvider:()=>m,useRecentApps:()=>i,useRouteRender:()=>d});var n=t(8769),c=t(
|
|
2
|
-
//# sourceMappingURL=4837.
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4837,7218],{4837:(e,r,t)=>{t.r(r),t.d(r,{ReactUseBrick:()=>s,ReactUseMultipleBricks:()=>u,asyncWrapBrick:()=>k,useCurrentApp:()=>l,useCurrentTheme:()=>o,useLazyWrapBrick:()=>w,useNavConfig:()=>h,useProvider:()=>m,useRecentApps:()=>i,useRouteRender:()=>d});var n=t(8769),c=t(128);let s=function(e){let{useBrick:r,data:t,errorBoundary:s,refCallback:u,ignoredCallback:a}=e;const[o,i]=(0,n.useState)(null),l=(0,n.useRef)(),[d,f]=(0,n.useState)(),p=(0,n.useRef)(0),g=(0,n.useMemo)((()=>{var e;return null===(e=c.__secret_internals.getRenderId)||void 0===e?void 0:e.call(c.__secret_internals)}),[]);(0,n.useEffect)((()=>{let e=!1;return async function(){try{const n=await c.__secret_internals.renderUseBrick(r,t,s);if(e)return;i(n),f(++p.current)}catch(n){!e&&function(e){var r;const t=null===(r=c.__secret_internals.getRenderId)||void 0===r?void 0:r.call(c.__secret_internals);return!e||!t||e===t}(g)&&(console.error("Render useBrick failed:",r,"with data:",t),(0,c.handleHttpError)(n))}}(),()=>{e=!0}}),[t,r,g,s]);const y=(0,n.useCallback)((e=>{e?l.current=c.__secret_internals.mountUseBrick(o,e):(c.__secret_internals.unmountUseBrick(o,l.current),l.current=void 0),null==u||u(e)}),[u,o]);if(!o)return null;const{tagName:m}=o;if(null===m)return null==a||a(),null;const v=m;return n.createElement(v,{key:d,ref:y})},u=function(e){let{useBrick:r,data:t,errorBoundary:c}=e;return Array.isArray(r)?n.createElement(n.Fragment,null,r.map(((e,r)=>n.createElement(s,{key:r,useBrick:e,data:t,errorBoundary:c})))):n.createElement(s,{useBrick:r,data:t,errorBoundary:c})};const a=(0,c.getV2RuntimeFromDll)();if(a){const{SingleBrickAsComponentFactory:e,BrickAsComponentFactory:r}=a;e&&r&&(s=e(n),u=r(n))}function o(){const[e,r]=(0,n.useState)(c.getCurrentTheme);return(0,n.useEffect)((()=>{const e=e=>{r(e.detail)};return window.addEventListener("theme.change",e),()=>{window.removeEventListener("theme.change",e)}}),[]),e}function i(){const[e,r]=n.useState((()=>(0,c.getRuntime)().getRecentApps()));return n.useEffect((()=>{const e=e=>{r(e.detail)};return window.addEventListener("app.change",e),()=>window.removeEventListener("app.change",e)}),[]),e}function l(){return i().currentApp}function d(){const[e,r]=n.useState(null);return n.useEffect((()=>{const e=e=>{r(e.detail)};return window.addEventListener("route.render",e),()=>window.removeEventListener("route.render",e)}),[]),e}const f={provider:"",customOptions:{onError:()=>{},transform:(e,r)=>r,data:void 0,loading:!1,suspense:!1,cache:!0},dependencies:void 0},p=Object.entries(f).reduce(((e,r)=>{let[t,n]=r;return"[object Object]"===Object.prototype.toString.call(n)?{...e,...n}:{...e,[t]:n}}),{});var g=t(1030);const y=new Map;function m(){const{provider:e,customOptions:r,dependencies:t,requestInit:s}=function(e,r,t){const c=(0,n.useMemo)((()=>"string"==typeof e?e:f.provider),[e,r]),s=(0,n.useMemo)((()=>{let t={};return(0,g.isObject)(e)?t=e:(0,g.isObject)(r)&&(t=r),{...p,...t}}),[e,r]),u=(0,n.useMemo)((()=>{const e=[...Object.keys(f),...Object.keys(f.customOptions)],{args:r=null,...t}=Object.keys(s).reduce(((r,t)=>(e.includes(t)||(r[t]=s[t]),r)),{});return{options:{...t},args:r}}),[s]),a=(0,n.useMemo)((()=>Array.isArray(r)?r:Array.isArray(t)?t:p.dependencies),[r,t]),o=s.loading||Array.isArray(a);return{provider:c,customOptions:(0,n.useMemo)((()=>({...Object.keys(f.customOptions).reduce(((e,r)=>(e[r]=s[r],e)),{}),loading:o})),[s]),requestInit:u,dependencies:a}}(...arguments),{onError:u,transform:a,suspense:o,cache:i,...l}=r,[d,m]=(0,n.useState)(l.loading),v=(0,n.useRef)("pending"),k=(0,n.useRef)(),h=(0,n.useRef)(!1),w=(0,n.useRef)(),_=(0,n.useRef)(),b=(0,n.useRef)(l.data),B=(0,n.useReducer)((()=>({})),[])[1],E=(0,n.useCallback)((async(e,r)=>{try{w.current=void 0,o||m(!0);const t=await async function(e,r,t){let n;const s=function(e){const r=e=>Object.keys(e).sort().map((r=>({[r]:e[r]})));for(var t=arguments.length,n=new Array(t>1?t-1:0),c=1;c<t;c++)n[c-1]=arguments[c];try{const t="object"!=typeof(s=n)||null===s||Array.isArray(s)?n.map((e=>function(e){return"string"==typeof e}(e)?e:r(e))):r(n);return JSON.stringify({provider:e,args:t})}catch(r){return JSON.stringify({provider:e,args:n})}var s}(e,...t);return!r&&y.has(s)&&y.delete(s),y.has(s)?n=y.get(s):(n=(0,c.fetchByProvider)(e,t,{cache:r?"default":"reload"}),r&&y.set(s,n)),n}(e,i,r);_.current=t,b.current=a(b.current,t)}catch(e){w.current=e,b.current=void 0}return o||m(!1),w.current&&u(w.current),b.current}),[e,r,t,s,o,a,l.data,u,i]),O=(0,n.useCallback)((async(r,t)=>{let n=e,c=[];return(0,g.isString)(r)&&(n=r),(0,g.isObject)(r)?c=r:(0,g.isObject)(t)&&(c=t),o?(async()=>(k.current=E(n,c).then((e=>(v.current="success",e)),(e=>(v.current="error",e.current=e,e))),B(),await k.current))():E(n,c)}),[E]),R=(0,n.useMemo)((()=>Object.defineProperties({query:O},{loading:{get:()=>d},data:{get:()=>b.current},error:{get:()=>w.current}})),[O]);if((0,n.useEffect)((()=>(h.current=!0,Array.isArray(t)&&e&&R.query(e,s.args),()=>h.current=!1)),t),o&&k.current)switch(v.current){case"pending":throw k.current;case"error":throw w.current}return Object.assign([R,_.current,d,w.current],{request:R,...R,response:_.current,data:b.current,loading:d,error:w.current})}var v=t(981);async function k(e,r){return await c.__secret_internals.loadBricks([e]),(0,v.wrapBrick)(e,r)}function h(){const[e,r]=(0,n.useState)((()=>(0,c.getRuntime)().getNavConfig()));return(0,n.useEffect)((()=>{const e=e=>{r(e.detail)};return window.addEventListener("navConfig.change",e),()=>window.removeEventListener("navConfig.change",e)}),[]),e}function w(e,r){return(0,n.useMemo)((()=>null!=e?(0,n.lazy)((async()=>({default:await k(e,r)}))):null),[e,r])}}}]);
|
|
2
|
+
//# sourceMappingURL=4837.32dece7c.js.map
|