dev-process-kit 0.0.6 → 0.0.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/chunks/{shared-BF8AzhLw.js → shared-1AA-0t4O.js} +1 -1
- package/dist/chunks/shared-BAePwoKi.js +679 -0
- package/dist/chunks/{shared-DI7xrx1a.js → shared-BTlCV660.js} +4 -12
- package/dist/chunks/shared-BYZoeQ97.js +1963 -0
- package/dist/chunks/{shared-B_b3KXSe.js → shared-CSV1HkB2.js} +1 -1
- package/dist/chunks/{shared-nn8xc7-Q.js → shared-CaLe76va.js} +1 -1
- package/dist/chunks/{shared-Pli_DImS.js → shared-Csmm_KdH.js} +1 -1
- package/dist/chunks/{shared-DL7Zn-cH.js → shared-CupreHTH.js} +1 -1
- package/dist/chunks/{shared-CbTVavOV.js → shared-CwwZhA40.js} +216 -203
- package/dist/chunks/{shared-D9zBdXMP.js → shared-DEdm-PCj.js} +1 -1
- package/dist/chunks/{shared-DSF_A3cy.js → shared-DNk3phV5.js} +1 -1
- package/dist/chunks/{shared-vUXShHFm.js → shared-Dn4XK7mS.js} +27 -28
- package/dist/chunks/{shared-Blnsyn6U.js → shared-VNSWugEg.js} +1 -1
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-BN5XrMLt.js +0 -1874
- package/dist/chunks/shared-BZ71JLz_.js +0 -609
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5 as He,a6 as Ne,A as Be,a7 as bs,a8 as ks,a9 as _,aa as q,ab as f,ac as D,ad as m,ae as Y,af as $,ag as M,ah as se,ai as _e,aj as Ye,ak as J,al as we,am as $e,an as Se,ao as vs,ap as Me,m as Ve,aq as xs,ar as ys,as as ws,at as ae,au as $s,r as Ss,s as Ms}from"./shared-BN5XrMLt.js";import{i as Ge}from"./shared-DSF_A3cy.js";import{P as We,p as Ke,r as Xe,c as Je}from"./shared-BF8AzhLw.js";import{c as me}from"./shared-ml5h7U5L.js";const Cs='script[type="application/json"]',Ze=(a,e)=>{const t=a.querySelector(Cs);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}},Qe=(a,e,t)=>{const s=Ze(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=Ze(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},et={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,n)=>s-n);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},qs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,n=new Set,r=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?n.add(o.id):d==="new"&&r(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&r(i.id);return{reversed:n,forward:e.filter(i=>!n.has(i.id))}},Es=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const n=new Map(a.map(o=>[o.id,0])),r=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(r.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=n.get(d.to)??0;n.set(d.to,Math.max(l,(n.get(o)??0)+1));const c=(r.get(d.to)??0)-1;r.set(d.to,c),c===0&&i.push(d.to)}return n},Ds=(a,e,t,s)=>{const n=[...a.keys()].sort((r,i)=>r-i);for(let r=0;r<s;r++){const i=r%2===0;for(const o of i?n:[...n].reverse()){const d=a.get(o)??[],l=new Map(d.map((h,u)=>[h,u])),c=h=>{const u=l.get(h);return u===void 0?null:u},b=d.map(h=>{const u=(e.get(h)??[]).filter(S=>(t.get(S)??o)===o+(i?-1:1)).map(c).filter(S=>S!==null);return{id:h,want:u.length>0?ge(u):l.get(h)??0}});b.sort((h,u)=>h.want-u.want||(l.get(h.id)??0)-(l.get(u.id)??0)),a.set(o,b.map(h=>h.id))}}},tt=(a,e,t,s)=>{const n=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));n.sort((i,o)=>i.want-o.want||i.index-o.index);let r=0;for(const i of n){const o=e.get(i.id);o&&(o.y=r,r+=o.spec.height+s)}return{height:Math.max(0,r-s)}},zs=(a,e,t,s,n)=>{const r=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of r)i.set(l,tt(a.get(l)??[],e,new Map,n.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of r){const c=(o-(i.get(l)??0))/2;for(const b of a.get(l)??[]){const h=e.get(b);h&&(h.y+=c)}}const d=(l,c)=>{const b=(t.get(l)??[]).filter(h=>s.get(h)===c).flatMap(h=>{const u=e.get(h);return u?[u.y+u.spec.height/2]:[]});return b.length>0?ge(b):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const b of c?r:[...r].reverse()){const h=a.get(b)??[],u=new Map;for(const C of h){const z=d(C,b+(c?-1:1)),T=e.get(C);T!==void 0&&u.set(C,z===null?T.y+T.spec.height/2:z)}const S=h.map(C=>e.get(C)?.y??0);tt(h,e,u,n.nodeSpacing);const x=h.map(C=>e.get(C)?.y??0),v=ge(S)-ge(x);for(const C of h){const z=e.get(C);z&&(z.y+=v)}}}},st=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},at=(a,e,t)=>{let s=0;const n=[];for(const r of a){const i=t.byId.get(r.from),o=t.byId.get(r.to);if(!i||!o)continue;const d=st(i,r.fromPort,"out"),l=st(o,r.toPort,"in");if(r.from===r.to){const S=i.x+i.spec.width,x=i.y+i.spec.height,v=Math.max(t.padding/2,x+18);n.push({id:r.id,points:[d,{x:S+20,y:d.y},{x:S+20,y:v},{x:i.x-20,y:v},{x:i.x-20,y:l.y},l]});continue}if(!e.has(r.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){n.push({id:r.id,points:[d,l]});continue}const x=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;n.push({id:r.id,points:[d,{x,y:d.y},{x,y:l.y},l]});continue}const c=r.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,b=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,h=Math.max(c.y,b.y)+18+s*14;s+=1;const u=[d,c,{x:c.x,y:h},{x:b.x,y:h},b,l].filter((S,x,v)=>x===0||S.x!==v[x-1]?.x||S.y!==v[x-1]?.y);n.push({id:r.id,points:u})}return n},nt=(a,e,t)=>{const s=e.flatMap(h=>[...h.points]),n=[...a.map(h=>h.x),...a.map(h=>h.x+h.spec.width),...s.map(h=>h.x)],r=[...a.map(h=>h.y),...a.map(h=>h.y+h.spec.height),...s.map(h=>h.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,b=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(h=>({id:h.spec.id,x:h.x+c,y:h.y+b,width:h.spec.width,height:h.spec.height,layer:h.layer,order:h.order})),routes:e.map(h=>({id:h.id,points:h.points.map(u=>({x:u.x+c,y:u.y+b}))}))}},rt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},it=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Ts=(a,e)=>{const t=new Map;for(const s of a){const n=e.get(s.id)??0,r=t.get(n);r?r.push(s.id):t.set(n,[s.id])}return t},As=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(x=>x.id)),r=e.filter(x=>n.has(x.from)&&n.has(x.to)),{forward:i,reversed:o}=qs(a,r),d=Es(a,i),l=Ts(a,d);Ds(l,rt(a,r),d,s.sweeps);const c=new Map;for(const x of l.values())x.forEach((v,C)=>c.set(v,C));const b=it(a,d,c,()=>({x:0,y:0})),h=new Map(b.map(x=>[x.spec.id,x]));zs(l,h,rt(a,r),d,s);const u=[...l.keys()].sort((x,v)=>x-v);let S=0;for(const x of u){const v=Math.max(...(l.get(x)??[]).map(C=>h.get(C)?.spec.width??0));for(const C of l.get(x)??[]){const z=h.get(C);z&&(z.x=S)}S+=v+s.layerSpacing}return nt(b,at(r,o,{byId:h,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ls=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(d=>d.id)),r=e.filter(d=>n.has(d.from)&&n.has(d.to)),i=it(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return nt(i,at(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Rs=N({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Os={active:[],match:"single"},Z=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Is=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Ps=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),js=a=>({...a,active:[]}),Fs=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},V={nodes:new Map,edges:new Set},U=(a,e,t,s)=>{const n=new Map,r=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,b=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(b)&&(o.add(b),n.set(b,d.depth+1),i.push({id:b,depth:d.depth+1})))}return{nodes:n,edges:r}},Us=(a,e)=>{const t=new Map(a.map(r=>[r,U(e,r,"outgoing",!0).nodes])),s=new Set,n=[];for(const r of a){if(s.has(r))continue;const i=a.filter(o=>o===r||t.get(r)?.has(o)===!0&&t.get(o)?.has(r)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===r&&o.to===r))&&n.push(i)}return n},Ce=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ot=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),dt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},lt=(a,e,t,s)=>{const n=e!==null&&e.kind===t&&e.id===a,r=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:n,related:r&&!n,dimmed:e!==null&&!n&&!r,depth:i}},Q=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Hs=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const r=a[1]??e,i=a[2]??t;return{x:r.x,y:(r.y+i.y)/2}}const s=a[2]??e,n=a[3]??t;return{x:(s.x+n.x)/2,y:s.y}},Ns=(a,e)=>Fs(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),Bs=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,G=[je,Fe,Ue,B`
|
|
1
|
+
import{_ as H,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5 as Ne,a6 as He,A as Be,a7 as fs,a8 as bs,a9 as _,aa as q,ab as f,ac as z,ad as m,ae as Y,af as $,ag as M,ah as se,ai as _e,aj as Ye,ak as J,al as ye,am as we,an as $e,ao as ks,ap as Se,m as Ve,aq as vs,ar as xs,as as ys,at as ae,au as ws,r as $s,s as Ss}from"./shared-BYZoeQ97.js";import{i as We}from"./shared-DNk3phV5.js";import{P as Ge,p as Ke,r as Xe,c as Je}from"./shared-1AA-0t4O.js";import{c as me}from"./shared-ml5h7U5L.js";const Ms='script[type="application/json"]',Ze=(a,e)=>{const t=a.querySelector(Ms);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}},Qe=(a,e,t)=>{const s=Ze(a,e);if(s)return t(s),()=>{};const r=new MutationObserver(()=>{const n=Ze(a,e);n&&(r.disconnect(),t(n))});return r.observe(a,{childList:!0,subtree:!0}),()=>r.disconnect()},et={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,r)=>s-r);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Cs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,r=new Set,n=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?r.add(o.id):d==="new"&&n(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&n(i.id);return{reversed:r,forward:e.filter(i=>!r.has(i.id))}},qs=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const r=new Map(a.map(o=>[o.id,0])),n=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(n.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=r.get(d.to)??0;r.set(d.to,Math.max(l,(r.get(o)??0)+1));const c=(n.get(d.to)??0)-1;n.set(d.to,c),c===0&&i.push(d.to)}return r},Es=(a,e,t,s)=>{const r=[...a.keys()].sort((n,i)=>n-i);for(let n=0;n<s;n++){const i=n%2===0;for(const o of i?r:[...r].reverse()){const d=a.get(o)??[],l=new Map(d.map((h,u)=>[h,u])),c=h=>{const u=l.get(h);return u===void 0?null:u},b=d.map(h=>{const u=(e.get(h)??[]).filter(S=>(t.get(S)??o)===o+(i?-1:1)).map(c).filter(S=>S!==null);return{id:h,want:u.length>0?ge(u):l.get(h)??0}});b.sort((h,u)=>h.want-u.want||(l.get(h.id)??0)-(l.get(u.id)??0)),a.set(o,b.map(h=>h.id))}}},tt=(a,e,t,s)=>{const r=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));r.sort((i,o)=>i.want-o.want||i.index-o.index);let n=0;for(const i of r){const o=e.get(i.id);o&&(o.y=n,n+=o.spec.height+s)}return{height:Math.max(0,n-s)}},zs=(a,e,t,s,r)=>{const n=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of n)i.set(l,tt(a.get(l)??[],e,new Map,r.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of n){const c=(o-(i.get(l)??0))/2;for(const b of a.get(l)??[]){const h=e.get(b);h&&(h.y+=c)}}const d=(l,c)=>{const b=(t.get(l)??[]).filter(h=>s.get(h)===c).flatMap(h=>{const u=e.get(h);return u?[u.y+u.spec.height/2]:[]});return b.length>0?ge(b):null};for(let l=0;l<r.coordinatePasses;l++){const c=l%2===0;for(const b of c?n:[...n].reverse()){const h=a.get(b)??[],u=new Map;for(const C of h){const D=d(C,b+(c?-1:1)),T=e.get(C);T!==void 0&&u.set(C,D===null?T.y+T.spec.height/2:D)}const S=h.map(C=>e.get(C)?.y??0);tt(h,e,u,r.nodeSpacing);const x=h.map(C=>e.get(C)?.y??0),v=ge(S)-ge(x);for(const C of h){const D=e.get(C);D&&(D.y+=v)}}}},st=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},at=(a,e,t)=>{let s=0;const r=[];for(const n of a){const i=t.byId.get(n.from),o=t.byId.get(n.to);if(!i||!o)continue;const d=st(i,n.fromPort,"out"),l=st(o,n.toPort,"in");if(n.from===n.to){const S=i.x+i.spec.width,x=i.y+i.spec.height,v=Math.max(t.padding/2,x+18);r.push({id:n.id,points:[d,{x:S+20,y:d.y},{x:S+20,y:v},{x:i.x-20,y:v},{x:i.x-20,y:l.y},l]});continue}if(!e.has(n.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){r.push({id:n.id,points:[d,l]});continue}const x=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;r.push({id:n.id,points:[d,{x,y:d.y},{x,y:l.y},l]});continue}const c=n.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,b=n.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,h=Math.max(c.y,b.y)+18+s*14;s+=1;const u=[d,c,{x:c.x,y:h},{x:b.x,y:h},b,l].filter((S,x,v)=>x===0||S.x!==v[x-1]?.x||S.y!==v[x-1]?.y);r.push({id:n.id,points:u})}return r},rt=(a,e,t)=>{const s=e.flatMap(h=>[...h.points]),r=[...a.map(h=>h.x),...a.map(h=>h.x+h.spec.width),...s.map(h=>h.x)],n=[...a.map(h=>h.y),...a.map(h=>h.y+h.spec.height),...s.map(h=>h.y)],i=Math.min(0,...r),o=Math.min(0,...n),d=Math.max(0,...r),l=Math.max(0,...n),c=t-i,b=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(h=>({id:h.spec.id,x:h.x+c,y:h.y+b,width:h.spec.width,height:h.spec.height,layer:h.layer,order:h.order})),routes:e.map(h=>({id:h.id,points:h.points.map(u=>({x:u.x+c,y:u.y+b}))}))}},nt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},it=(a,e,t,s)=>a.map(r=>({spec:r,layer:e.get(r.id)??0,order:t.get(r.id)??0,...s(r)})),Ds=(a,e)=>{const t=new Map;for(const s of a){const r=e.get(s.id)??0,n=t.get(r);n?n.push(s.id):t.set(r,[s.id])}return t},Ts=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(x=>x.id)),n=e.filter(x=>r.has(x.from)&&r.has(x.to)),{forward:i,reversed:o}=Cs(a,n),d=qs(a,i),l=Ds(a,d);Es(l,nt(a,n),d,s.sweeps);const c=new Map;for(const x of l.values())x.forEach((v,C)=>c.set(v,C));const b=it(a,d,c,()=>({x:0,y:0})),h=new Map(b.map(x=>[x.spec.id,x]));zs(l,h,nt(a,n),d,s);const u=[...l.keys()].sort((x,v)=>x-v);let S=0;for(const x of u){const v=Math.max(...(l.get(x)??[]).map(C=>h.get(C)?.spec.width??0));for(const C of l.get(x)??[]){const D=h.get(C);D&&(D.x=S)}S+=v+s.layerSpacing}return rt(b,at(n,o,{byId:h,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},As=(a,e,t={})=>{const s={...et,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const r=new Set(a.map(d=>d.id)),n=e.filter(d=>r.has(d.from)&&r.has(d.to)),i=it(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return rt(i,at(n,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ls=H({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Rs={active:[],match:"single"},Z=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Os=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Is=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Ps=a=>({...a,active:[]}),js=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},V={nodes:new Map,edges:new Set},U=(a,e,t,s)=>{const r=new Map,n=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,b=t==="outgoing"?l.to:l.from;c===d.id&&(n.add(l.id),!o.has(b)&&(o.add(b),r.set(b,d.depth+1),i.push({id:b,depth:d.depth+1})))}return{nodes:r,edges:n}},Fs=(a,e)=>{const t=new Map(a.map(n=>[n,U(e,n,"outgoing",!0).nodes])),s=new Set,r=[];for(const n of a){if(s.has(n))continue;const i=a.filter(o=>o===n||t.get(n)?.has(o)===!0&&t.get(o)?.has(n)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===n&&o.to===n))&&r.push(i)}return r},Me=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ot=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),dt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},lt=(a,e,t,s)=>{const r=e!==null&&e.kind===t&&e.id===a,n=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:r,related:n&&!r,dimmed:e!==null&&!r&&!n,depth:i}},Q=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Us=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const n=a[1]??e,i=a[2]??t;return{x:n.x,y:(n.y+i.y)/2}}const s=a[2]??e,r=a[3]??t;return{x:(s.x+r.x)/2,y:s.y}},Ns=(a,e)=>js(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),Hs=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[je,Fe,Ue,B`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
container-type: inline-size;
|
|
@@ -489,7 +489,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
489
489
|
display: none;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
`],
|
|
492
|
+
`],re=a=>a.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),ct=a=>P`
|
|
493
493
|
<defs>
|
|
494
494
|
${a.map(e=>P`
|
|
495
495
|
<marker
|
|
@@ -511,36 +511,36 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
511
511
|
</marker>
|
|
512
512
|
`)}
|
|
513
513
|
</defs>
|
|
514
|
-
`,
|
|
514
|
+
`,Bs=(a,e,t,s)=>p`
|
|
515
515
|
<div class="diagram-tags" role="group" aria-label=${a.tagFilter}>
|
|
516
516
|
<div class="diagram-match" role="group" aria-label=${a.tagMatch}>
|
|
517
|
-
${[["single","Single"],["all","AND"],["any","OR"]].map(([n
|
|
517
|
+
${[["single","Single"],["all","AND"],["any","OR"]].map(([r,n])=>p`
|
|
518
518
|
<button
|
|
519
519
|
type="button"
|
|
520
|
-
data-match=${
|
|
521
|
-
aria-pressed=${t===
|
|
522
|
-
@click=${()=>s({kind:"match",match:
|
|
520
|
+
data-match=${r}
|
|
521
|
+
aria-pressed=${t===r?"true":"false"}
|
|
522
|
+
@click=${()=>s({kind:"match",match:r})}
|
|
523
523
|
>
|
|
524
|
-
${
|
|
524
|
+
${n}
|
|
525
525
|
</button>
|
|
526
526
|
`)}
|
|
527
527
|
</div>
|
|
528
|
-
${X(e,
|
|
528
|
+
${X(e,r=>r.tag,r=>p`
|
|
529
529
|
<button
|
|
530
530
|
type="button"
|
|
531
531
|
class="dpk-tag"
|
|
532
|
-
data-tag=${
|
|
533
|
-
aria-pressed=${
|
|
534
|
-
@click=${()=>s({kind:"tag",tag:
|
|
532
|
+
data-tag=${r.tag}
|
|
533
|
+
aria-pressed=${r.selected?"true":"false"}
|
|
534
|
+
@click=${()=>s({kind:"tag",tag:r.tag})}
|
|
535
535
|
>
|
|
536
|
-
${
|
|
536
|
+
${r.tag}<span class="dpk-tag-count">${r.count}</span>
|
|
537
537
|
</button>
|
|
538
538
|
`)}
|
|
539
|
-
${e.some(
|
|
539
|
+
${e.some(r=>r.selected)?p`<button type="button" class="dpk-tag-clear" @click=${()=>s({kind:"clear-tags"})}>
|
|
540
540
|
${a.clearTags}
|
|
541
541
|
</button>`:k}
|
|
542
542
|
</div>
|
|
543
|
-
`,
|
|
543
|
+
`,_s=(a,e)=>p`
|
|
544
544
|
<div class="diagram-zoom">
|
|
545
545
|
<button
|
|
546
546
|
type="button"
|
|
@@ -566,7 +566,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
566
566
|
+
|
|
567
567
|
</button>
|
|
568
568
|
</div>
|
|
569
|
-
`,
|
|
569
|
+
`,Ce=.08,Ys=1.8,Vs=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(n=>n.x)),t=Math.min(...a.map(n=>n.y)),s=Math.max(...a.map(n=>n.x+n.width))-e,r=Math.max(...a.map(n=>n.y+n.height))-t;return{x:e-s*.1,y:t-r*.1,width:s*1.2,height:r*1.2}},qe=(a,e)=>a+e/12,Ee=16,pt=(a,e,t,s,r="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const n=(i,o,d,l)=>{const c=d*a.scale;return c<=l?r==="start"?Ee-qe(o,d)*a.scale:(l-c)/2-o*a.scale:Math.min(-o*a.scale,Math.max(l-(o+d)*a.scale,i))};return{...a,x:n(a.x,e.x,e.width,t),y:n(a.y,e.y,e.height,s)}},Ws=(a,e,t,s,r,n,i="center")=>{const o=pt({...a,x:a.x-r,y:a.y-n},e,t,s,i);return Math.abs(n)>Math.abs(r)&&o.y===a.y?null:o},ht='button,[role="button"],a,input,textarea,select',Gs=a=>{const{canvas:e,world:t,onClearSelection:s,onView:r,align:n="center"}=a;let i={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const d=()=>({width:e.clientWidth||1e3,height:e.clientHeight||560}),l=()=>{const{width:g,height:w}=d();o=pt(o,i,g,w,n),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,r?.(o)},c=()=>{const{width:g,height:w}=d(),E=i.width/1.2||1,R=i.height/1.2||1;o={...o,scale:me(Math.min((g-24)/E,(w-40)/R),Ce,1)},o={...o,x:(g-i.width*o.scale)/2-i.x*o.scale,y:(w-i.height*o.scale)/2-i.y*o.scale},l()},b=()=>{const{width:g}=d(),w=i.width/1.2||1,E=me((g-24)/w,Ce,1);o={scale:E,x:(g-i.width*E)/2-i.x*E,y:16},l()},h=()=>{o={scale:1,x:Ee-qe(i.x,i.width),y:Ee-qe(i.y,i.height)},l()},u=(g,w=d().width/2,E=d().height/2)=>{const R=o.scale,I=me(R*g,Ce,Ys);I!==R&&(o={scale:I,x:w-(w-o.x)*I/R,y:E-(E-o.y)*I/R},l())},S=g=>{if(g.target instanceof Element&&g.target.closest(".diagram-zoom"))return;const w=g.deltaMode===1?16:g.deltaMode===2?d().height:1;if(g.ctrlKey||g.metaKey){g.preventDefault();const K=e.getBoundingClientRect();u(Math.exp(-me(g.deltaY*w,-60,60)*.0012),g.clientX-K.left,g.clientY-K.top);return}const{width:E,height:R}=d(),I=Ws(o,i,E,R,g.deltaX*w,g.deltaY*w,n);I!==null&&(g.preventDefault(),o=I,l())},x=new Map;let v=null,C=!1;const D=()=>{const g=[...x.values()],w=g[0];if(!w)return null;const E=g[1];return E?{x:(w.x+E.x)/2,y:(w.y+E.y)/2,distance:Math.hypot(E.x-w.x,E.y-w.y)}:{...w,distance:0}},T=g=>{x.size===0&&(C=!1);const E=(g.target instanceof Element?g.target:null)?.closest(ht)??null;g.button!==0||g.pointerType!=="touch"&&E!==null||(x.set(g.pointerId,{x:g.clientX,y:g.clientY}),v=D(),E===null&&e.setPointerCapture(g.pointerId))},O=g=>{if(!x.has(g.pointerId)||v===null)return;x.set(g.pointerId,{x:g.clientX,y:g.clientY});const w=D();if(w===null)return;const E=w.x-v.x,R=w.y-v.y;if((Math.abs(E)+Math.abs(R)>1||Math.abs(w.distance-v.distance)>1)&&(C=!0),w.distance>0&&v.distance>0){const I=e.getBoundingClientRect();u(Math.pow(w.distance/v.distance,.45),v.x-I.left,v.y-I.top)}o={...o,x:o.x+E,y:o.y+R},l(),v=w,e.classList.toggle("is-panning",C)},j=g=>{x.delete(g.pointerId),v=D(),!(x.size>0)&&(e.classList.remove("is-panning"),g.type==="pointercancel"&&(C=!1))},ue=g=>{C&&(g.preventDefault(),g.stopPropagation()),j(g)},y=g=>{if(C){g.preventDefault(),g.stopPropagation(),C=!1;return}const w=g.target instanceof Element?g.target:null;w===null||w.closest(ht)!==null||s()},A=g=>{if(g.target!==e)return;const w=30;if(g.key==="+"||g.key==="=")u(1.1);else if(g.key==="-")u(1/1.1);else if(g.key==="0")c();else if(g.key==="Escape")s();else if(g.key==="ArrowLeft"||g.key==="ArrowRight"||g.key==="ArrowUp"||g.key==="ArrowDown")o={...o,x:o.x+(g.key==="ArrowLeft"?w:g.key==="ArrowRight"?-w:0),y:o.y+(g.key==="ArrowUp"?w:g.key==="ArrowDown"?-w:0)},l();else return;g.preventDefault()},L=g=>{const w=g.target instanceof HTMLElement?g.target:null;if(w===null||!t.contains(w))return;const E=w.getBoundingClientRect(),R=e.getBoundingClientRect();let I=0,K=0;E.left<R.left+12?I=R.left+12-E.left:E.right>R.right-12&&(I=R.right-12-E.right),E.top<R.top+12?K=R.top+12-E.top:E.bottom>R.bottom-40&&(K=R.bottom-40-E.bottom),!(I===0&&K===0)&&(o={...o,x:o.x+I,y:o.y+K},l())};e.addEventListener("wheel",S,{passive:!1}),e.addEventListener("pointerdown",T),e.addEventListener("pointermove",O),e.addEventListener("pointerup",ue),e.addEventListener("pointercancel",j),e.addEventListener("lostpointercapture",j),e.addEventListener("click",y,!0),e.addEventListener("keydown",A),e.addEventListener("focusin",L);const N=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return N?.observe(e),{setContent(g){i=Vs(g.width===0&&g.height===0?[]:[g]),t.style.width=`${g.width}px`,t.style.height=`${g.height}px`,l()},apply:l,fit:c,fitWidth:b,reset:h,zoom:u,view:()=>({...o}),destroy(){N?.disconnect(),e.removeEventListener("wheel",S),e.removeEventListener("pointerdown",T),e.removeEventListener("pointermove",O),e.removeEventListener("pointerup",ue),e.removeEventListener("pointercancel",j),e.removeEventListener("lostpointercapture",j),e.removeEventListener("click",y,!0),e.removeEventListener("keydown",A),e.removeEventListener("focusin",L)}}};class ze extends Ne{static{this.styles=W}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#a=null;#s=[];#t=[];#r=null;#n=Rs;#i=null;#o=null;#c=null;#u=null;#l=-1;#p="";#h=null;#f=null;#d=new Map;#m=null;#g=new Map;#b=null;#k=new Ge(this);#x=new He(this,()=>{this.#p=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#p="",this.requestUpdate(),this.#u=Qe(this,e=>this.parseData(e),e=>{e.ok?this.#v(e.value):this.#R(e.error)})}disconnectedCallback(){super.disconnectedCallback(),this.#u?.(),this.#u=null,this.#o?.destroy(),this.#o=null,this.#c=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#v(this.data)}updated(){this.#M(),this.#$(),this.#A(),this.#C()}#$(){const e=this.renderRoot.querySelector(".diagram");if(!(this.#b===null||!e||typeof e.showPopover!="function")&&!e.matches(":popover-open"))try{e.showPopover()}catch{}}#M(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#p&&(this.#p=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#A(){this.#c=this.renderRoot.querySelector(".diagram-zoom-value");const e=this.renderRoot.querySelector(".diagram-canvas"),t=this.renderRoot.querySelector(".diagram-world");if(!e||!t)return;this.#o??=Gs({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#y(null),onView:n=>{this.#c&&(this.#c.textContent=`${Math.round(n.scale*100)}%`),this.dispatchEvent(new CustomEvent("dpk-diagram-view",{detail:{view:n},bubbles:!0,composed:!0})),this.onViewChange(n)}});const s=this.contentSize();if(s===null){this.#o.apply();return}this.#o.setContent({x:0,y:0,width:s.width,height:s.height});const r=this.layoutVersion();r!==this.#l&&(this.#l=r,this.initialView())}#C(){const e=this.#f!==this.#h;this.#f=this.#h;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#S();!t||!s||(this.#k.open(t,s,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}get commentTargets(){if(!this.id||this.#r!==null)return[];const e=`${this.subject??this.heading??this.defaultHeading()} \xB7 ${this.id}`;return this.commentItems().map(t=>({...t,group:e}))}commentItems(){return[]}commentRef(e,...t){return`element:${[this.id,e,...t].map(s=>encodeURIComponent(s)).join("/")}`}requestElementComment(e,...t){const s=this.commentRef(e,...t);this.commentTargets.some(r=>r.value===s)&&this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:s},bubbles:!0,composed:!0}))}get elementActions(){return this.#s}set elementActions(e){this.#s=e,this.#w()}get elementActionResults(){return this.#t}reduceElementActions(e,t){return{data:e,results:t.map(s=>({id:s.id,title:s.type,stale:"unsupported-action-type"}))}}dispatchElementAction(e,t,s){const r=new CustomEvent("dpk-element-action",{detail:{type:e,target:this.commentRef(...t),payload:s},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(r),r.defaultPrevented}get selection(){return this.#i}select(e){this.#y(e)}get tagFilter(){return this.#n}set tagFilter(e){this.#n=e,this.requestUpdate()}get dataError(){return this.#r}resetView(){this.fitViewport()}#q(e){if(e===(this.#b!==null))return;const t=this.renderRoot.querySelector(".diagram");this.#b=e?{height:t?.offsetHeight??0}:null,this.#h=null,this.requestUpdate()}#L={handleEvent:e=>e.preventDefault(),passive:!1};#E={handleEvent:e=>{e.key!=="Escape"||this.#i!==null||(e.preventDefault(),this.#q(!1))},capture:!0};get locale(){return this.#x.locale}get chromeMessages(){return Ls(this.#x.locale)}renderSelection(){const e=this.#h,t=e===null?void 0:this.#g.get(e);if(e===null||t===void 0)return k;const s=Ke(this.#d.get(e)??"",[],{label:t,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return p`${We(e,Xe(Je(this.#x.locale),s,r=>this.#z(e,r)))}`}renderCommentTrigger(e,t,s){if(!this.id)return k;const r=this.commentRef(e.kind,e.id);return this.#g.set(r,t),p`<button
|
|
570
570
|
type="button"
|
|
571
571
|
class=${Q("diagram-comment-trigger",s&&"is-placed")}
|
|
572
572
|
style=${s?`left:${s.x}px; top:${s.y}px`:k}
|
|
@@ -575,17 +575,17 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
575
575
|
aria-label=${this.chromeMessages.commentOn(t)}
|
|
576
576
|
title=${this.chromeMessages.commentOn(t)}
|
|
577
577
|
aria-haspopup="dialog"
|
|
578
|
-
aria-expanded=${this.#h===
|
|
579
|
-
@click=${()=>{this.#y(e),this.#h=
|
|
578
|
+
aria-expanded=${this.#h===r?"true":"false"}
|
|
579
|
+
@click=${()=>{this.#y(e),this.#h=r,this.requestUpdate()}}
|
|
580
580
|
>
|
|
581
581
|
${Be()}
|
|
582
|
-
</button>`}renderEdgeCommentTrigger(e,t,s){const
|
|
582
|
+
</button>`}renderEdgeCommentTrigger(e,t,s){const r=Math.floor((s.length-1)/2),n=s[r],i=s[r+1]??n;return!this.id||!n||!i?k:P`<foreignObject
|
|
583
583
|
class="diagram-edge-comment"
|
|
584
|
-
x=${(
|
|
585
|
-
y=${(
|
|
584
|
+
x=${(n.x+i.x)/2-16}
|
|
585
|
+
y=${(n.y+i.y)/2-16}
|
|
586
586
|
width="32"
|
|
587
587
|
height="32"
|
|
588
|
-
>${this.renderCommentTrigger(e,t)}</foreignObject>`}layoutVersion(){return 0}fitViewport(){this.viewport?.fit()}initialView(){this.viewport?.reset()}viewAlign(){return"center"}questionsOf(e){const t=e.questions?.trim();return t===void 0||t===""?k:t}onViewChange(e){}statsText(){return""}tagItems(){return[]}isEmpty(){return this.contentSize()===null}shellClass(){return""}defaultHeading(){return""}defaultSubject(){return""}emptyMessage(){return this.chromeMessages.noMatches}renderToolbarActions(){return k}renderLegend(){return k}renderAboveCanvas(){return k}get viewport(){return this.#o}items(){return this.#
|
|
588
|
+
>${this.renderCommentTrigger(e,t)}</foreignObject>`}layoutVersion(){return 0}fitViewport(){this.viewport?.fit()}initialView(){this.viewport?.reset()}viewAlign(){return"center"}questionsOf(e){const t=e.questions?.trim();return t===void 0||t===""?k:t}onViewChange(e){}statsText(){return""}tagItems(){return[]}isEmpty(){return this.contentSize()===null}shellClass(){return""}defaultHeading(){return""}defaultSubject(){return""}emptyMessage(){return this.chromeMessages.noMatches}renderToolbarActions(){return k}renderLegend(){return k}renderAboveCanvas(){return k}get viewport(){return this.#o}items(){return this.#a??this.emptyData()}authoredItems(){return this.#e??this.emptyData()}elementClass(e,...t){return Q(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#v(e){this.#r=null,this.#e=e,this.#w()}#w(){if(this.#e===null){this.#t=this.#s.map(t=>({id:t.id,title:t.type,stale:"target-missing"})),this.requestUpdate();return}const e=this.reduceElementActions(this.#e,this.#s);this.#a=e.data,this.#t=e.results,this.#i!==null&&(this.hasSelection(this.#i)||(this.#i=null,this.#h=null)),this.requestUpdate()}#S(){const e=this.#i;return e?[...this.renderRoot.querySelectorAll("[data-comment-kind]")].find(t=>t.dataset.commentKind===e.kind&&t.dataset.commentId===e.id)??null:null}#z(e,t){if(t.kind==="input"){this.#d=new Map(this.#d).set(e,t.body),this.#m=null,this.requestUpdate();return}if(t.kind==="comment"){if(!!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t.body},bubbles:!0,composed:!0,cancelable:!0}))){this.#m=e,this.requestUpdate();return}const n=new Map(this.#d);n.delete(e),this.#d=n}this.#m=null;const s=this.#S();this.#y(null),s?.focus({preventScroll:!0})}#R(e){this.#r=e,this.#e=null,this.#a=null,this.#w(),console.error("[dev-process-kit] invalid diagram data:",e),this.requestUpdate()}hasSelection(e){return!0}#y(e){(e===null?this.#i===null:this.#i!==null&&this.#i.kind===e.kind&&this.#i.id===e.id)||(this.#i=e,this.#h=null,this.dispatchEvent(new CustomEvent("dpk-diagram-select",{detail:{selection:e},bubbles:!0,composed:!0})),this.requestUpdate())}#D=e=>{switch(e.kind){case"tag":this.#n=Os(this.#n,e.tag),this.requestUpdate();return;case"match":this.#n=Is(this.#n,e.match),this.requestUpdate();return;case"clear-tags":this.#n=Ps(this.#n),this.requestUpdate();return;case"select":this.#y(e.selection);return;case"zoom":this.#o?.zoom(e.factor);return;case"fit":this.fitViewport();return;default:return}};refreshContent(){}render(){this.#g=new Map,this.refreshContent();const e=Ns(this.tagItems(),this.#n),t=this.#b,s=this.chromeMessages,r=t===null?s.maximize:s.restore;return p`
|
|
589
589
|
${t===null?k:p`<div class="diagram-placeholder" style="height:${t.height}px"></div>`}
|
|
590
590
|
<div
|
|
591
591
|
class=${Q("diagram",this.shellClass(),t!==null&&"is-maximized")}
|
|
@@ -602,27 +602,27 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
602
602
|
<button
|
|
603
603
|
type="button"
|
|
604
604
|
class="dpk-icon-btn diagram-maximize"
|
|
605
|
-
aria-label=${
|
|
606
|
-
title=${
|
|
605
|
+
aria-label=${r}
|
|
606
|
+
title=${r}
|
|
607
607
|
aria-pressed=${t===null?"false":"true"}
|
|
608
608
|
@click=${()=>this.#q(t===null)}
|
|
609
609
|
>
|
|
610
|
-
${t===null?
|
|
610
|
+
${t===null?fs():bs()}
|
|
611
611
|
</button>
|
|
612
612
|
</div>
|
|
613
613
|
</div>
|
|
614
|
-
${
|
|
614
|
+
${Bs(s,e,this.#n.match,this.#D)} ${this.renderAboveCanvas()}
|
|
615
615
|
<div class="diagram-canvas" tabindex="0" aria-label=${s.canvas}>
|
|
616
616
|
<div class="diagram-world">${this.renderCanvas()}</div>
|
|
617
617
|
${this.isEmpty()?p`<p class="diagram-empty">${this.emptyMessage()}</p>`:k}
|
|
618
|
-
${this.#
|
|
619
|
-
${this.renderLegend()} ${
|
|
618
|
+
${this.#r===null?k:p`<p class="diagram-notice" role="alert">${s.dataError}<br />${this.#r}</p>`}
|
|
619
|
+
${this.renderLegend()} ${_s(s,this.#D)}
|
|
620
620
|
</div>
|
|
621
621
|
${this.renderSelection()}
|
|
622
622
|
</div>
|
|
623
|
-
`}}class
|
|
623
|
+
`}}class ne extends ze{#e=null;#a="";#s=0;#t=V;commentItems(){const e=this.items();return[...e.nodes.map(t=>({value:this.commentRef("node",t.id),label:t.id})),...e.edges.map(t=>({value:this.commentRef("edge",t.id),label:`${t.from} \u2192 ${t.to} (${t.id})`}))]}get visible(){const e=this.filtered();return{nodes:e.nodes,edges:e.edges}}get layout(){return this.#e}get layoutMode(){return"layered"}get tagDimension(){return"node"}layoutOptions(){return{}}matchesFilter(e){return!0}layoutSignature(){return""}statsLabels(){return{node:this.chromeMessages.nodes,edge:this.chromeMessages.edges}}statsText(){const e=this.filtered();return Hs(e.nodes.length,e.edges.length,this.statsLabels())}tagItems(){const e=this.items();return(this.tagDimension==="edge"?e.edges:e.nodes).map(t=>t.tags)}contentSize(){const e=this.#e;return e===null||e.nodes.length===0?null:{width:e.width,height:e.height}}layoutVersion(){return this.#s}hasSelection(e){const t=this.items();return e.kind==="node"?t.nodes.some(s=>s.id===e.id):t.edges.some(s=>s.id===e.id)}placedNode(e){return this.#e?.nodes.find(t=>t.id===e)}routeOf(e){return this.#e?.routes.find(t=>t.id===e)?.points??[]}nodeState(e){return lt(e,this.selection,"node",this.#t)}edgeState(e){return lt(e,this.selection,"edge",this.#t)}renderEdges(e,t){const s=this.#e?.width??0,r=this.#e?.height??0;return p`<svg class="diagram-edges" width=${s} height=${r}>
|
|
624
624
|
${ct(t)}${e}
|
|
625
|
-
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const
|
|
625
|
+
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const r=e.edges.filter(i=>Z(i.tags,this.tagFilter)&&this.matchesFilter(i)),n=new Set(r.flatMap(i=>[i.from,i.to]));return{...e,edges:r,nodes:e.nodes.filter(i=>n.has(i.id))}}const t=e.nodes.filter(r=>Z(r.tags,this.tagFilter)&&this.matchesFilter(r)),s=new Set(t.map(r=>r.id));return{...e,nodes:t,edges:e.edges.filter(r=>s.has(r.from)&&s.has(r.to))}}refreshContent(){const e=this.filtered(),t=[this.layoutMode,e.nodes.map(s=>`${s.id}:${s.width}x${s.height}`).join(","),e.edges.map(s=>`${s.id}:${s.from}>${s.to}`).join(","),this.layoutSignature()].join("|");t!==this.#a&&(this.#a=t,this.#s+=1,this.#e=this.computePlacement(e)),this.#t=this.relations(this.selection,e)}computePlacement(e){const t=e.nodes.map(n=>({id:n.id,width:n.width,height:n.height,...n.ports===void 0?{}:{ports:n.ports},...n.position===void 0?{}:{position:n.position}})),s=e.edges.map(n=>({id:n.id,from:n.from,to:n.to,...n.fromPort===void 0?{}:{fromPort:n.fromPort},...n.toPort===void 0?{}:{toPort:n.toPort}})),r=this.layoutOptions();return this.layoutMode==="fixed"?As(t,s,r):Ts(t,s,r)}}const fe=H({en:{heading:"State machine",node:"State",edge:"Transition",empty:"No matching transitions.",transitionLabel:(a,e,t)=>`${t} from ${a} to ${e}`},ja:{heading:"\u30B9\u30C6\u30FC\u30C8\u30DE\u30B7\u30F3",node:"\u72B6\u614B",edge:"\u9077\u79FB",empty:"\u8A72\u5F53\u3059\u308B\u9077\u79FB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",transitionLabel:(a,e,t)=>`${a} \u304B\u3089 ${e} \u3078\u306E ${t}`}}),Ks=q({x:se(),y:se()}),Xs=q({id:$(m(),M(1)),name:$(m(),M(1)),code:f(m()),kind:f(Y(["normal","initial","terminal","compensation"]),"normal"),description:f(m()),position:f(Ks),questions:f(m())}),Js=q({id:$(m(),M(1)),from:$(m(),M(1)),to:$(m(),M(1)),title:$(m(),M(1)),kind:f(Y(["normal","exception"]),"normal"),tags:f(z(m()),[]),guard:f(m()),effect:f(m()),questions:f(m())}),ut={width:178,height:86},Zs=()=>({nodes:[],edges:[]}),Qs=q({states:z(Xs),transitions:f(z(Js),[])}),mt=a=>{const e=_(Qs,a),t=new Set;for(const i of e.states){if(t.has(i.id))throw new Error(`duplicate state id: ${i.id}`);t.add(i.id)}const s=new Set,r=e.transitions.map(i=>{if(s.has(i.id))throw new Error(`duplicate transition id: ${i.id}`);if(s.add(i.id),!t.has(i.from))throw new Error(`unknown transition source: ${i.from}`);if(!t.has(i.to))throw new Error(`unknown transition target: ${i.to}`);return{id:i.id,from:i.from,to:i.to,title:i.title,kind:i.kind,tags:i.tags,guard:i.guard??null,effect:i.effect??null,...i.questions===void 0?{}:{questions:i.questions}}});return{nodes:e.states.map(i=>({id:i.id,name:i.name,code:i.code??null,kind:i.kind,description:i.description??null,width:ut.width,height:ut.height,tags:[],...i.position===void 0?{}:{position:i.position},...i.questions===void 0?{}:{questions:i.questions}})),edges:r}},ea=a=>a.length>0&&a.every(e=>e.position!==void 0),ta=B`
|
|
626
626
|
.state-node {
|
|
627
627
|
display: flex;
|
|
628
628
|
flex-direction: column;
|
|
@@ -780,28 +780,28 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
780
780
|
fill: var(--dpk-amber);
|
|
781
781
|
stroke: var(--dpk-amber);
|
|
782
782
|
}
|
|
783
|
-
`,
|
|
784
|
-
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],
|
|
785
|
-
${e.map(s=>this.#
|
|
786
|
-
`}#e(e){return this.filtered().nodes.find(t=>t.id===e)?.name??e}#
|
|
787
|
-
`)||e.title}#
|
|
788
|
-
<g class=${Q("state-initial-mark",
|
|
783
|
+
`,sa=[{id:"state-arrow"},{id:"state-arrow-active"},{id:"state-arrow-exception"}];class gt extends ne{static{this.styles=[W,ta]}parseData(e){return mt(e)}emptyData(){return Zs()}defaultHeading(){return fe(this.locale).heading}statsLabels(){const e=fe(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return fe(this.locale).empty}get tagDimension(){return"edge"}get layoutMode(){return ea(this.filtered().nodes)?"fixed":"layered"}layoutOptions(){return this.layoutMode==="fixed"?{padding:44}:{nodeSpacing:40,layerSpacing:110,padding:44}}relations(e,t){if(e===null||e.kind!=="node")return V;const s=U(t.edges,e.id,"outgoing",!1),r=U(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...r.nodes]),edges:new Set([...s.edges,...r.edges])}}renderCanvas(){const e=this.visible.nodes,t=e.filter(s=>s.kind==="initial").map(s=>this.#s(s));return p`
|
|
784
|
+
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],sa)}
|
|
785
|
+
${e.map(s=>this.#r(s))} ${this.visible.edges.map(s=>this.#n(s))}
|
|
786
|
+
`}#e(e){return this.filtered().nodes.find(t=>t.id===e)?.name??e}#a(e){return[e.guard,e.effect].filter(t=>t!==null).join(`
|
|
787
|
+
`)||e.title}#s(e){const t=this.placedNode(e.id);if(!t)return k;const s=t.y+t.height/2,r=this.nodeState(e.id);return P`
|
|
788
|
+
<g class=${Q("state-initial-mark",r.dimmed&&"is-dimmed")}>
|
|
789
789
|
<circle cx=${t.x-22} cy=${s} r="5"></circle>
|
|
790
790
|
<path
|
|
791
|
-
d=${
|
|
791
|
+
d=${re([{x:t.x-17,y:s},{x:t.x-1,y:s}])}
|
|
792
792
|
stroke-width="1.6"
|
|
793
793
|
></path>
|
|
794
794
|
</g>
|
|
795
|
-
`}#t(e){const t=fe(this.locale),s=this.edgeState(e.id),
|
|
795
|
+
`}#t(e){const t=fe(this.locale),s=this.edgeState(e.id),r=this.routeOf(e.id),n=re(r),o=s.selected||s.related?"state-arrow-active":e.kind==="exception"?"state-arrow-exception":"state-arrow",d=()=>this.select({kind:"edge",id:e.id});return P`
|
|
796
796
|
<g
|
|
797
797
|
class=${this.elementClass(s,"d-edge","state-edge",e.kind==="exception"&&"is-exception")}
|
|
798
798
|
data-transition=${e.id}
|
|
799
799
|
>
|
|
800
|
-
<title>${this.#
|
|
801
|
-
<path class="d-edge-path" d=${
|
|
800
|
+
<title>${this.#a(e)}</title>
|
|
801
|
+
<path class="d-edge-path" d=${n} marker-end=${`url(#${o})`}></path>
|
|
802
802
|
<path
|
|
803
803
|
class="d-edge-hit"
|
|
804
|
-
d=${
|
|
804
|
+
d=${n}
|
|
805
805
|
role="button"
|
|
806
806
|
tabindex="0"
|
|
807
807
|
aria-label=${t.transitionLabel(this.#e(e.from),this.#e(e.to),e.title)}
|
|
@@ -809,7 +809,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
809
809
|
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
810
810
|
></path>
|
|
811
811
|
</g>
|
|
812
|
-
`}#
|
|
812
|
+
`}#r(e){const t=this.placedNode(e.id);if(!t)return k;const s=this.nodeState(e.id);return p`
|
|
813
813
|
<button
|
|
814
814
|
type="button"
|
|
815
815
|
class=${this.elementClass(s,"d-node","state-node",`is-${e.kind}`)}
|
|
@@ -824,21 +824,21 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
824
824
|
${e.code===null?k:p`<span class="state-code">${e.code}</span>`}
|
|
825
825
|
</button>
|
|
826
826
|
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:t.x+e.width-20,y:t.y-14})}
|
|
827
|
-
`}#
|
|
827
|
+
`}#n(e){const t=this.edgeState(e.id),s=Us(this.routeOf(e.id));return p`
|
|
828
828
|
<span class="state-label-slot" style="left:${s.x}px; top:${s.y}px">
|
|
829
829
|
<button
|
|
830
830
|
type="button"
|
|
831
831
|
class=${this.elementClass(t,"state-label")}
|
|
832
832
|
data-transition-label=${e.id}
|
|
833
833
|
data-grill-questions=${this.questionsOf(e)}
|
|
834
|
-
title=${this.#
|
|
834
|
+
title=${this.#a(e)}
|
|
835
835
|
@click=${()=>this.select({kind:"edge",id:e.id})}
|
|
836
836
|
>
|
|
837
837
|
${e.title}
|
|
838
838
|
</button>
|
|
839
839
|
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#e(e.from)} \u2192 ${this.#e(e.to)} \xB7 ${e.title}`)}
|
|
840
840
|
</span>
|
|
841
|
-
`}}const ft=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",gt)},bt=(a,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[a]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[a],ie=
|
|
841
|
+
`}}const ft=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",gt)},bt=(a,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[a]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[a],ie=H({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>bt(a,!0),selectMessage:a=>`Select ${a}`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${t?`Expand ${e}`:`Collapse ${e}`}`,frameCount:a=>`${a} message${a===1?"":"s"}`},ja:{heading:"\u30B7\u30FC\u30B1\u30F3\u30B9\u56F3",empty:"\u8A72\u5F53\u3059\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",participants:"\u53C2\u52A0\u8005",stats:(a,e)=>`${a} / ${e} \u30E1\u30C3\u30BB\u30FC\u30B8`,detailLabel:a=>bt(a,!1),selectMessage:a=>`${a}\u3092\u9078\u629E`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${e}\u3092${t?"\u5C55\u958B":"\u6298\u308A\u305F\u305F\u3080"}`,frameCount:a=>`${a} \u30E1\u30C3\u30BB\u30FC\u30B8`}}),aa=q({kind:J("message"),id:$(m(),M(1)),from:$(m(),M(1)),to:$(m(),M(1)),title:$(m(),M(1)),style:f(Y(["request","response","async"]),"request"),tags:f(z(m()),[]),guard:f(m()),detail:f(m()),questions:f(m())}),ra=q({label:$(m(),M(1)),items:z(Ye())}),na=q({kind:J("fragment"),id:$(m(),M(1)),operator:Y(["alt","opt","loop","par"]),title:$(m(),M(1)),collapsed:f(ye(),!1),branches:$(z(ra),M(1))}),ia=_e("kind",[aa,na]),oa=q({id:$(m(),M(1)),name:$(m(),M(1)),role:f(m()),symbol:f(m()),kind:f(Y(["internal","external"]),"internal"),description:f(m()),questions:f(m())}),da=q({participants:$(z(oa),M(1)),items:f(z(Ye()),[])}),kt=240,De=(a,e,t)=>{if(a.has(e))throw new Error(`duplicate ${t} id: ${e}`);a.add(e)},vt=(a,e,t)=>a.map(s=>{const r=_(ia,s);if(r.kind==="message"){if(De(t,r.id,"message"),!e.has(r.from))throw new Error(`unknown sender: ${r.from}`);if(!e.has(r.to))throw new Error(`unknown receiver: ${r.to}`);return{kind:"message",id:r.id,from:r.from,to:r.to,title:r.title,style:r.style,tags:r.tags,guard:r.guard??null,detail:r.detail??null,questions:r.questions??null}}return De(t,r.id,"fragment"),{kind:"fragment",id:r.id,operator:r.operator,title:r.title,collapsed:r.collapsed,branches:r.branches.map(i=>({label:i.label,items:vt(i.items,e,t)}))}}),xt=a=>{const e=_(da,a),t=new Set;for(const s of e.participants)De(t,s.id,"participant");return{participants:e.participants.map(s=>({id:s.id,name:s.name,role:s.role??null,symbol:s.symbol??null,external:s.kind==="external",description:s.description??null,questions:s.questions??null})),items:vt(e.items,t,new Set)}},la=()=>({participants:[],items:[]}),yt=(a,e)=>{for(const t of a)if(t.kind==="message")e.push(t);else for(const s of t.branches)yt(s.items,e)},G=a=>{const e=[];return yt(a,e),e},ca=a=>new Map(G(a.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),pa=a=>G(a).length,wt=(a,e)=>{const t=[];for(const s of a){if(s.kind==="message"){e(s)&&t.push(s);continue}const r=s.branches.map(n=>({label:n.label,items:wt(n.items,e)})).filter(n=>n.items.length>0);r.length>0&&t.push({...s,branches:r})}return t},ha=64,ua=86,ma=31,ga=32,fa=40,ba=(a,e)=>{const t=wt(a.items,e),s=new Set;for(const S of G(t))s.add(S.from),s.add(S.to);const r=a.participants.filter(S=>s.has(S.id)),n=new Map(r.map((S,x)=>[S.id,120+x*kt])),i=Math.max(360,r.length*kt),o=[],d=[],l=[],c=[],b=[];let h=25;const u=(S,x)=>{for(const v of S){if(v.kind==="message"){o.push({message:v,y:h+29,depth:x}),h+=v.from===v.to?ua:ha;continue}const C=22+x*13,D=h,T=i-44-x*26;h+=ma,v.collapsed?(b.push({fragment:v,x:C,y:h+6}),h+=fa):v.branches.forEach((O,j)=>{j>0&&(c.push({x:C,y:h,width:T}),h+=8),l.push({label:O.label,x:C+12,y:h}),h+=ga,u(O.items,x+1),h+=8}),d.push({fragment:v,x:C,y:D,width:T,height:h-D,count:pa([v])}),h+=14}};return u(t,0),{width:i,height:h+24,participants:r,rows:o,frames:d,branches:l,dividers:c,folds:b,x:n}},ka=B`
|
|
842
842
|
.sequence .diagram-canvas {
|
|
843
843
|
background-image: none;
|
|
844
844
|
}
|
|
@@ -1114,21 +1114,21 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1114
1114
|
fill: var(--dpk-ink);
|
|
1115
1115
|
stroke: var(--dpk-ink);
|
|
1116
1116
|
}
|
|
1117
|
-
`,
|
|
1118
|
-
`)||e.title}#c(){const e=this.items(),t=s=>s.map(
|
|
1117
|
+
`,va=[{id:"seq-request"},{id:"seq-response"},{id:"seq-async"},{id:"seq-related"},{id:"seq-selected"}];class $t extends ze{static{this.styles=[W,ka]}#e=null;#a=new Map;#s=new Map;#t=new Set;#r=new Set;#n="";#i=0;commentItems(){const e=this.items();return[...e.participants.map(t=>({value:this.commentRef("participant",t.id),label:t.name})),...G(e.items).map(t=>({value:this.commentRef("message",t.id),label:t.title}))]}parseData(e){return this.#s.clear(),xt(e)}emptyData(){return la()}defaultHeading(){return ie(this.locale).heading}shellClass(){return"sequence"}emptyMessage(){return ie(this.locale).empty}fitViewport(){this.viewport?.fitWidth()}onViewChange(e){const t=this.renderRoot.querySelector(".sequence-rail-world");t&&(t.style.transform=`translateX(${e.x}px) scale(${e.scale})`)}hasSelection(e){const t=this.items();return e.kind==="participant"?t.participants.some(s=>s.id===e.id):G(t.items).some(s=>s.id===e.id)}tagItems(){return G(this.items().items).map(e=>e.tags)}statsText(){const e=this.#e,t=G(this.items().items).length;return e===null?"":ie(this.locale).stats(e.rows.length,t)}contentSize(){const e=this.#e;return e===null||e.rows.length===0?null:{width:e.width,height:e.height}}isEmpty(){return this.contentSize()===null}layoutVersion(){return this.#i}refreshContent(){const e=this.#c(),t=this.tagFilter,s=[t.match,[...t.active].join(","),[...this.#s].map(([i,o])=>`${i}:${o}`).join(","),G(e.items).map(i=>i.id).join(",")].join("|");s!==this.#n&&(this.#n=s,this.#i+=1,this.#a=ca(this.items()),this.#e=ba(e,i=>Z(i.tags,t))),this.#t=new Set,this.#r=new Set;const r=this.selection,n=this.#e;if(r!==null&&n!==null)if(r.kind==="message"){const i=n.rows.find(o=>o.message.id===r.id);this.#t.add(r.id),i&&(this.#r.add(i.message.from),this.#r.add(i.message.to))}else for(const i of n.rows)i.message.from!==r.id&&i.message.to!==r.id||this.#t.add(i.message.id)}#o(e,t){const s=e.detail===null?null:`${t.detailLabel(e.style)}: ${e.detail}`;return[e.guard,s].filter(r=>r!==null).join(`
|
|
1118
|
+
`)||e.title}#c(){const e=this.items(),t=s=>s.map(r=>r.kind==="message"?r:{...r,collapsed:this.#s.get(r.id)??r.collapsed,branches:r.branches.map(n=>({label:n.label,items:t(n.items)}))});return{participants:e.participants,items:t(e.items)}}#u(e){return this.#e?.frames.find(t=>t.fragment.id===e.id)?.fragment.collapsed??e.collapsed}#l(e){this.#s.set(e.id,!this.#u(e)),this.requestUpdate()}#p(e){const t=this.selection?.kind==="message"&&this.selection.id===e,s=!t&&this.#t.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}#h(e){const t=this.selection?.kind==="participant"&&this.selection.id===e,s=!t&&this.#r.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}renderAboveCanvas(){const e=this.#e;if(e===null)return k;const t=ie(this.locale);return p`
|
|
1119
1119
|
<div class="sequence-rail" role="group" aria-label=${t.participants}>
|
|
1120
1120
|
<div class="sequence-rail-world">
|
|
1121
1121
|
${e.participants.map(s=>this.#f(s,e))}
|
|
1122
1122
|
</div>
|
|
1123
1123
|
</div>
|
|
1124
|
-
`}#f(e,t){const s=t.x.get(e.id)??0,
|
|
1124
|
+
`}#f(e,t){const s=t.x.get(e.id)??0,r=this.#h(e.id);return p`
|
|
1125
1125
|
<button
|
|
1126
1126
|
type="button"
|
|
1127
|
-
class=${this.elementClass(
|
|
1127
|
+
class=${this.elementClass(r,"sequence-participant",e.external&&"is-external")}
|
|
1128
1128
|
data-participant=${e.id}
|
|
1129
1129
|
data-grill-questions=${this.questionsOf(e)}
|
|
1130
1130
|
style="left:${s-95}px"
|
|
1131
|
-
aria-pressed=${
|
|
1131
|
+
aria-pressed=${r.selected?"true":"false"}
|
|
1132
1132
|
title=${e.description??e.name}
|
|
1133
1133
|
@click=${()=>this.select({kind:"participant",id:e.id})}
|
|
1134
1134
|
>
|
|
@@ -1150,13 +1150,13 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1150
1150
|
>[${s.label}]</span
|
|
1151
1151
|
>`)}
|
|
1152
1152
|
${e.folds.map(s=>p`<span class="sequence-fold" style="left:${s.x}px; top:${s.y}px"
|
|
1153
|
-
>${s.fragment.branches.map(
|
|
1153
|
+
>${s.fragment.branches.map(r=>`[${r.label}]`).join(" / ")}</span
|
|
1154
1154
|
>`)}
|
|
1155
1155
|
${e.rows.map(s=>this.#g(s.y,s.message,e,t))}
|
|
1156
1156
|
`}#d(e,t){const s=e.participants.map(i=>P`<path
|
|
1157
1157
|
class="sequence-lifeline"
|
|
1158
1158
|
d=${`M${e.x.get(i.id)??0} 0 V${e.height}`}
|
|
1159
|
-
></path>`),
|
|
1159
|
+
></path>`),r=e.dividers.map(i=>P`<path class="sequence-divider" d=${`M${i.x} ${i.y} h${i.width}`}></path>`),n=e.rows.map(i=>{const o=e.x.get(i.message.from)??0,d=e.x.get(i.message.to)??0,l=o===d?`M${o} ${i.y} h42 v25 H${o}`:`M${o} ${i.y} H${d}`,c=this.#p(i.message.id),b=c.selected?"seq-selected":c.related?"seq-related":i.message.style==="async"?"seq-async":i.message.style==="response"?"seq-response":"seq-request",h=()=>this.select({kind:"message",id:i.message.id});return P`
|
|
1160
1160
|
<g
|
|
1161
1161
|
class=${this.elementClass(c,"sequence-message-row","d-edge",`is-${i.message.style}`)}
|
|
1162
1162
|
data-message=${i.message.id}
|
|
@@ -1169,13 +1169,13 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1169
1169
|
<path class="sequence-message is-${i.message.style}" d=${l} marker-end=${`url(#${b})`}></path>
|
|
1170
1170
|
</g>
|
|
1171
1171
|
`});return p`<svg class="diagram-edges" width=${e.width} height=${e.height}>
|
|
1172
|
-
${ct(
|
|
1173
|
-
</svg>`}#m(e,t,s,n,
|
|
1172
|
+
${ct(va)} ${s} ${r} ${n}
|
|
1173
|
+
</svg>`}#m(e,t,s,r,n,i){const o=this.#u(e);return p`
|
|
1174
1174
|
<button
|
|
1175
1175
|
type="button"
|
|
1176
1176
|
class="sequence-frame-header"
|
|
1177
1177
|
data-fragment=${e.id}
|
|
1178
|
-
style="left:${t}px; top:${s}px; width:${
|
|
1178
|
+
style="left:${t}px; top:${s}px; width:${r}px"
|
|
1179
1179
|
aria-expanded=${o?"false":"true"}
|
|
1180
1180
|
aria-label=${i.frameHeaderLabel(e.operator,e.title,o)}
|
|
1181
1181
|
@click=${()=>this.#l(e)}
|
|
@@ -1183,23 +1183,23 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1183
1183
|
<span aria-hidden="true">${o?"\u25B8":"\u25BE"}</span>
|
|
1184
1184
|
<span class="sequence-operator">${e.operator}</span>
|
|
1185
1185
|
<span class="sequence-text">${e.title}</span>
|
|
1186
|
-
<span class="sequence-frame-count">${i.frameCount(
|
|
1186
|
+
<span class="sequence-frame-count">${i.frameCount(n)}</span>
|
|
1187
1187
|
</button>
|
|
1188
|
-
`}#g(e,t,s,
|
|
1188
|
+
`}#g(e,t,s,r){const n=s.x.get(t.from)??0,i=s.x.get(t.to)??0,o=n===i,d=this.#p(t.id),l=o?n+12:Math.min(n,i)+14,c=o?175:Math.abs(i-n)-28;return p`
|
|
1189
1189
|
<button
|
|
1190
1190
|
type="button"
|
|
1191
1191
|
class=${this.elementClass(d,"sequence-label")}
|
|
1192
1192
|
data-message-label=${t.id}
|
|
1193
1193
|
data-grill-questions=${this.questionsOf(t)}
|
|
1194
1194
|
style="left:${l}px; top:${e-28}px; width:${c}px"
|
|
1195
|
-
title=${this.#o(t,
|
|
1195
|
+
title=${this.#o(t,r)}
|
|
1196
1196
|
@click=${()=>this.select({kind:"message",id:t.id})}
|
|
1197
1197
|
>
|
|
1198
|
-
<span class="sequence-number">${this.#
|
|
1198
|
+
<span class="sequence-number">${this.#a.get(t.id)??""}</span>
|
|
1199
1199
|
<span class="sequence-text">${t.title}</span>
|
|
1200
1200
|
</button>
|
|
1201
|
-
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#
|
|
1202
|
-
`}}const St=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",$t)},ee=
|
|
1201
|
+
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#a.get(t.id)??""} ${t.title}`.trim(),{x:l+c-30,y:e-31})}
|
|
1202
|
+
`}}const St=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",$t)},ee=H({en:{heading:"Dependencies",node:"Module",edge:"Dependency",emptyCycles:"No matching cycles.",emptyModules:"No matching modules.",directionGroup:"Direction to follow from the selected module",directionOutgoing:"Depends on",directionIncoming:"Depended on by",directionBoth:"Both",transitive:"Include indirect",cyclesToggleLabel:a=>`Show only ${a} cycle group(s)`,cyclesCount:a=>`Cycles ${a}`,legendOutgoing:"Depends on",legendIncoming:"Depended on by",legendCycle:"Cycle",edgeLabel:(a,e)=>`${a} depends on ${e}`,cyclicSuffix:a=>`${a}, part of a cycle`,cycleBadge:"Cycle"},ja:{heading:"\u4F9D\u5B58\u95A2\u4FC2\u30B0\u30E9\u30D5",node:"\u30E2\u30B8\u30E5\u30FC\u30EB",edge:"\u4F9D\u5B58",emptyCycles:"\u8A72\u5F53\u3059\u308B\u5FAA\u74B0\u4F9D\u5B58\u306F\u3042\u308A\u307E\u305B\u3093\u3002",emptyModules:"\u8A72\u5F53\u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",directionGroup:"\u9078\u629E\u3057\u305F\u30E2\u30B8\u30E5\u30FC\u30EB\u304B\u3089\u8FFD\u3046\u65B9\u5411",directionOutgoing:"\u4F9D\u5B58\u5148",directionIncoming:"\u4F9D\u5B58\u5143",directionBoth:"\u4E21\u65B9",transitive:"\u9593\u63A5\u3082\u542B\u3080",cyclesToggleLabel:a=>`\u5FAA\u74B0\u4F9D\u5B58 ${a} \u30B0\u30EB\u30FC\u30D7\u3060\u3051\u8868\u793A`,cyclesCount:a=>`\u5FAA\u74B0 ${a}`,legendOutgoing:"\u4F9D\u5B58\u5148",legendIncoming:"\u4F9D\u5B58\u5143",legendCycle:"\u5FAA\u74B0",edgeLabel:(a,e)=>`${a} \u304C ${e} \u306B\u4F9D\u5B58`,cyclicSuffix:a=>`${a}\u30FB\u5FAA\u74B0\u4F9D\u5B58\u3042\u308A`,cycleBadge:"\u5FAA\u74B0"}}),Mt={width:176,height:84},xa=q({id:$(m(),M(1)),name:$(m(),M(1)),path:f(m()),layer:f(m()),tags:f(z(m()),[]),description:f(m()),questions:f(m())}),ya=q({id:$(m(),M(1)),from:$(m(),M(1)),to:$(m(),M(1)),contract:f(m()),description:f(m()),questions:f(m())}),wa=q({modules:z(xa),dependencies:f(z(ya),[])}),$a=()=>({nodes:[],edges:[]}),Sa=a=>{const e=_(wa,a),t=new Set;for(const i of e.modules){if(t.has(i.id))throw new Error(`duplicate module id: ${i.id}`);t.add(i.id)}const s=new Set,r=e.dependencies.map(i=>{if(s.has(i.id))throw new Error(`duplicate dependency id: ${i.id}`);if(s.add(i.id),!t.has(i.from))throw new Error(`unknown dependency source: ${i.from}`);if(!t.has(i.to))throw new Error(`unknown dependency target: ${i.to}`);return{id:i.id,from:i.from,to:i.to,tags:[],contract:i.contract??null,description:i.description??null}});return{nodes:e.modules.map(i=>({id:i.id,name:i.name,path:i.path??null,layer:i.layer??null,description:i.description??null,tags:i.tags,width:Mt.width,height:Mt.height,...i.questions===void 0?{}:{questions:i.questions}})),edges:r}},Ma=B`
|
|
1203
1203
|
.dep-direction {
|
|
1204
1204
|
display: flex;
|
|
1205
1205
|
gap: 2px;
|
|
@@ -1393,16 +1393,16 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1393
1393
|
fill: var(--dpk-blue);
|
|
1394
1394
|
stroke: var(--dpk-blue);
|
|
1395
1395
|
}
|
|
1396
|
-
`,
|
|
1396
|
+
`,Ca=[{id:"dep-neutral"},{id:"dep-outgoing"},{id:"dep-incoming"},{id:"dep-cycle"},{id:"dep-selected"}];class Ct extends ne{static{this.styles=[W,Ma]}#e="both";#a=!1;#s=!1;#t=[];#r=V;#n=V;parseData(e){return Sa(e)}emptyData(){return $a()}defaultHeading(){return ee(this.locale).heading}statsLabels(){const e=ee(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){const e=ee(this.locale);return this.#s?e.emptyCycles:e.emptyModules}layoutOptions(){return{nodeSpacing:40,layerSpacing:96,padding:32}}relations(e,t){return e===null||e.kind!=="node"?V:{nodes:new Map([...this.#r.nodes,...this.#n.nodes]),edges:new Set([...this.#r.edges,...this.#n.edges])}}refreshContent(){const e=this.items(),t=this.tagFilter,s=e.nodes.filter(o=>Z(o.tags,t)),r=new Set(s.map(o=>o.id)),n=e.edges.filter(o=>r.has(o.from)&&r.has(o.to));this.#t=Fs(s.map(o=>o.id),n);const i=this.selection;this.#r=i!==null&&i.kind==="node"&&this.#e!=="incoming"?U(n,i.id,"outgoing",this.#a):V,this.#n=i!==null&&i.kind==="node"&&this.#e!=="outgoing"?U(n,i.id,"incoming",this.#a):V,super.refreshContent()}matchesFilter(e){return this.#s?Me(this.#t).has(e.id):!0}filtered(){const e=super.filtered();if(!this.#s)return e;const t=Me(this.#t),s=e.edges.filter(n=>ot(n,t)),r=new Set(s.flatMap(n=>[n.from,n.to]));return{nodes:e.nodes.filter(n=>r.has(n.id)),edges:s}}renderToolbarActions(){const e=ee(this.locale),t=this.#t.length;return p`
|
|
1397
1397
|
<div class="dep-direction" role="group" aria-label=${e.directionGroup}>
|
|
1398
|
-
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,
|
|
1398
|
+
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,r])=>p`
|
|
1399
1399
|
<button
|
|
1400
1400
|
type="button"
|
|
1401
1401
|
data-direction=${s}
|
|
1402
1402
|
aria-pressed=${this.#e===s?"true":"false"}
|
|
1403
1403
|
@click=${()=>this.#i(s)}
|
|
1404
1404
|
>
|
|
1405
|
-
${
|
|
1405
|
+
${r}
|
|
1406
1406
|
</button>
|
|
1407
1407
|
`)}
|
|
1408
1408
|
</div>
|
|
@@ -1410,8 +1410,8 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1410
1410
|
type="button"
|
|
1411
1411
|
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1412
1412
|
data-toggle="transitive"
|
|
1413
|
-
aria-pressed=${this.#
|
|
1414
|
-
@click=${()=>{this.#
|
|
1413
|
+
aria-pressed=${this.#a?"true":"false"}
|
|
1414
|
+
@click=${()=>{this.#a=!this.#a,this.requestUpdate()}}
|
|
1415
1415
|
>
|
|
1416
1416
|
${e.transitive}
|
|
1417
1417
|
</button>
|
|
@@ -1419,10 +1419,10 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1419
1419
|
type="button"
|
|
1420
1420
|
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1421
1421
|
data-toggle="cycles"
|
|
1422
|
-
aria-pressed=${this.#
|
|
1422
|
+
aria-pressed=${this.#s?"true":"false"}
|
|
1423
1423
|
aria-label=${e.cyclesToggleLabel(t)}
|
|
1424
|
-
?disabled=${!this.#
|
|
1425
|
-
@click=${()=>{this.#
|
|
1424
|
+
?disabled=${!this.#s&&t===0}
|
|
1425
|
+
@click=${()=>{this.#s=!this.#s,this.requestUpdate()}}
|
|
1426
1426
|
>
|
|
1427
1427
|
${e.cyclesCount(t)}
|
|
1428
1428
|
</button>
|
|
@@ -1430,7 +1430,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1430
1430
|
<span><i class="dep-swatch-outgoing"></i>${e.legendOutgoing}</span>
|
|
1431
1431
|
<span><i class="dep-swatch-incoming"></i>${e.legendIncoming}</span>
|
|
1432
1432
|
<span><i class="dep-swatch-cycle"></i>${e.legendCycle}</span>
|
|
1433
|
-
</div>`}#i(e){this.#e=e,this.requestUpdate()}#o(e,t){const s=this.selection;return s!==null&&s.kind==="edge"&&s.id===e.id?"dep-selected":ot(e,t)?"dep-cycle":this.#
|
|
1433
|
+
</div>`}#i(e){this.#e=e,this.requestUpdate()}#o(e,t){const s=this.selection;return s!==null&&s.kind==="edge"&&s.id===e.id?"dep-selected":ot(e,t)?"dep-cycle":this.#r.edges.has(e.id)?"dep-outgoing":this.#n.edges.has(e.id)?"dep-incoming":"dep-neutral"}renderCanvas(){const e=ee(this.locale),t=this.visible,s=Me(this.#t),r=o=>t.nodes.find(d=>d.id===o)?.name??o,n=t.edges.map(o=>{const d=this.edgeState(o.id),l=this.routeOf(o.id),c=re(l),b=()=>this.select({kind:"edge",id:o.id});return P`
|
|
1434
1434
|
<g class=${this.elementClass(d,"d-edge","dep-edge")} data-dependency=${o.id}>
|
|
1435
1435
|
<title>${[o.contract,o.description].filter(h=>h!==null).join(`
|
|
1436
1436
|
`)||o.id}</title>
|
|
@@ -1440,13 +1440,13 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1440
1440
|
d=${c}
|
|
1441
1441
|
role="button"
|
|
1442
1442
|
tabindex="0"
|
|
1443
|
-
aria-label=${e.edgeLabel(
|
|
1443
|
+
aria-label=${e.edgeLabel(r(o.from),r(o.to))}
|
|
1444
1444
|
@click=${b}
|
|
1445
1445
|
@keydown=${h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),b())}}
|
|
1446
1446
|
></path>
|
|
1447
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${
|
|
1447
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${r(o.from)} \u2192 ${r(o.to)}`,l)}
|
|
1448
1448
|
</g>
|
|
1449
|
-
`}),i=t.nodes.map(o=>{const d=this.placedNode(o.id);if(!d)return k;const l=this.nodeState(o.id),c=s.has(o.id),b=this.#
|
|
1449
|
+
`}),i=t.nodes.map(o=>{const d=this.placedNode(o.id);if(!d)return k;const l=this.nodeState(o.id),c=s.has(o.id),b=this.#r.nodes.has(o.id),h=this.#n.nodes.has(o.id);return p`
|
|
1450
1450
|
<button
|
|
1451
1451
|
type="button"
|
|
1452
1452
|
class=${this.elementClass(l,"d-node","dep-module",c&&"is-cyclic",b&&"is-dependency",h&&"is-dependent")}
|
|
@@ -1467,7 +1467,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1467
1467
|
<span class="dep-path">${o.path??""}</span>
|
|
1468
1468
|
</button>
|
|
1469
1469
|
${this.renderCommentTrigger({kind:"node",id:o.id},o.name,{x:d.x+o.width-20,y:d.y-14})}
|
|
1470
|
-
`});return p`${this.renderEdges(
|
|
1470
|
+
`});return p`${this.renderEdges(n,Ca)}${i}`}}const qt=()=>{customElements.get("dpk-component-dependency-graph")||customElements.define("dpk-component-dependency-graph",Ct)},Et=(a,e)=>e?{same:"Unchanged",added:"Added",removed:"Removed",changed:"Changed"}[a]:{same:"\u5909\u66F4\u306A\u3057",added:"\u8FFD\u52A0",removed:"\u524A\u9664",changed:"\u5909\u66F4"}[a],te=H({en:{heading:"ERD",node:"Table",edge:"Relation",empty:"No matching tables.",search:"Search",legendAdded:"Added",legendRemoved:"Removed",legendChanged:"Changed",statusLabel:a=>Et(a,!0),edgeLabel:(a,e)=>`${a} and ${e}, related`,nullable:"nullable"},ja:{heading:"ER\u56F3",node:"\u30C6\u30FC\u30D6\u30EB",edge:"\u95A2\u9023",empty:"\u8A72\u5F53\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",search:"\u691C\u7D22",legendAdded:"\u8FFD\u52A0",legendRemoved:"\u524A\u9664",legendChanged:"\u5909\u66F4",statusLabel:a=>Et(a,!1),edgeLabel:(a,e)=>`${a} \u3068 ${e} \u306E\u95A2\u9023`,nullable:"null\u53EF"}}),zt=276,Te=74,qa=28,Ea=44,za=q({id:$(m(),M(1)),type:$(m(),M(1)),key:f(Y(["PK","FK","UQ"])),ref:f(m()),nullable:f(ye(),!1),questions:f(m())}),Da=q({id:$(m(),M(1)),name:$(m(),M(1)),tags:f(z(m()),[]),fields:z(za),questions:f(m())}),Dt=q({tables:z(Da)}),Ta=q({before:f(Dt),after:Dt}),Aa=()=>({nodes:[],edges:[]}),Tt=a=>({id:a.id,type:a.type,key:a.key??null,ref:a.ref??null,nullable:a.nullable,questions:a.questions??null}),At=(a,e)=>a.type===e.type&&a.key===e.key&&a.ref===e.ref&&a.nullable===e.nullable,Ae=a=>a.status==="changed"?Ea:qa,La=a=>Te+a.reduce((e,t)=>e+Ae(t),0),Lt=(a,e)=>{let t=Te;for(const s of a){if(s.id===e)return t+Ae(s)/2;t+=Ae(s)}return Te/2},Rt=a=>a.flatMap(e=>e.fields.flatMap(t=>{if(t.ref===void 0)return[];const[s,r]=t.ref.split(".");if(s===void 0||r===void 0)throw new Error(`invalid ref "${t.ref}" on ${e.id}.${t.id}; expected table.field`);return[{id:`${s}:${r}>${e.id}:${t.id}`,from:s,to:e.id,sourceField:r,targetField:t.id}]})),Ra=(a,e)=>[...new Set([...a,...e].map(s=>s.id))].flatMap(s=>{const r=a.find(l=>l.id===s),n=e.find(l=>l.id===s),i=n??r;if(!i)return[];const o=Tt(i);if(!r)return[{...o,status:"added",before:null}];if(!n)return[{...o,status:"removed",before:null}];const d=Tt(r);return[{...o,status:At(d,o)?"same":"changed",before:At(d,o)?null:d}]}),Oa=a=>{const e=_(Ta,a),t=e.before?.tables??e.after.tables,s=e.after.tables,r=[...new Set([...t,...s].map(u=>u.id))],n=new Map;for(const u of[...t,...s])n.set(u.id,u.tags);const i=r.flatMap(u=>{const S=t.find(T=>T.id===u),x=s.find(T=>T.id===u),v=x??S;if(!v)return[];const C=Ra(S?.fields??[],x?.fields??[]),D=S?x?C.some(T=>T.status!=="same")?"changed":"same":"removed":"added";return[{id:u,name:v.name,status:D,fields:C,tags:n.get(u)??[],width:zt,height:La(C),...v.questions===void 0?{}:{questions:v.questions}}]}),o=new Map(i.map(u=>[u.id,u])),d=Rt(t),l=Rt(s),b=[...new Set([...d,...l].map(u=>u.id))].flatMap(u=>{const S=d.find(O=>O.id===u),x=l.find(O=>O.id===u),v=x??S;if(!v)return[];const C=o.get(v.from),D=o.get(v.to);if(!C||!D)return[];const T=S?x?"same":"removed":"added";return[{id:u,from:v.from,to:v.to,sourceField:v.sourceField,targetField:v.targetField,status:T,tags:[],fromPort:`${u}:out`,toPort:`${u}:in`}]}),h=u=>{const S={},x={};for(const v of b)v.from===u.id&&(S[`${v.id}:out`]={x:zt,y:Lt(u.fields,v.sourceField)}),v.to===u.id&&(x[`${v.id}:in`]={x:0,y:Lt(u.fields,v.targetField)});return{out:S,in:x}};return{nodes:i.map(u=>{const S=h(u);return{...u,ports:{...S.out,...S.in}}}),edges:b}},Ia=B`
|
|
1471
1471
|
.er-search {
|
|
1472
1472
|
display: flex;
|
|
1473
1473
|
align-items: center;
|
|
@@ -1528,12 +1528,14 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1528
1528
|
display: grid;
|
|
1529
1529
|
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1530
1530
|
grid-template-areas:
|
|
1531
|
-
'mark name
|
|
1532
|
-
'mark label
|
|
1531
|
+
'mark name name'
|
|
1532
|
+
'mark label label'
|
|
1533
|
+
'. status status';
|
|
1533
1534
|
align-items: center;
|
|
1534
1535
|
gap: 1px 8px;
|
|
1535
1536
|
width: 100%;
|
|
1536
|
-
min-height:
|
|
1537
|
+
min-height: 74px;
|
|
1538
|
+
flex-shrink: 0;
|
|
1537
1539
|
padding: 7px 11px;
|
|
1538
1540
|
border: 0;
|
|
1539
1541
|
border-bottom: 1px solid var(--dpk-rule);
|
|
@@ -1596,18 +1598,18 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1596
1598
|
font-size: 12px;
|
|
1597
1599
|
font-weight: 640;
|
|
1598
1600
|
letter-spacing: -0.01em;
|
|
1599
|
-
white-space:
|
|
1600
|
-
overflow:
|
|
1601
|
-
|
|
1601
|
+
white-space: normal;
|
|
1602
|
+
overflow-wrap: anywhere;
|
|
1603
|
+
min-width: 0;
|
|
1602
1604
|
}
|
|
1603
1605
|
|
|
1604
1606
|
.er-label {
|
|
1605
1607
|
grid-area: label;
|
|
1606
1608
|
font-size: 9.5px;
|
|
1607
1609
|
color: var(--dpk-ink-faint);
|
|
1608
|
-
white-space:
|
|
1609
|
-
overflow:
|
|
1610
|
-
|
|
1610
|
+
white-space: normal;
|
|
1611
|
+
overflow-wrap: anywhere;
|
|
1612
|
+
min-width: 0;
|
|
1611
1613
|
}
|
|
1612
1614
|
|
|
1613
1615
|
.er-status {
|
|
@@ -1623,10 +1625,13 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1623
1625
|
|
|
1624
1626
|
.er-field {
|
|
1625
1627
|
display: grid;
|
|
1626
|
-
grid-template-columns: 14px 26px minmax(0, 1fr)
|
|
1628
|
+
grid-template-columns: 14px 26px minmax(0, 1fr);
|
|
1629
|
+
grid-template-areas: 'mark key name' '. . type';
|
|
1627
1630
|
align-items: center;
|
|
1628
1631
|
gap: 6px;
|
|
1629
|
-
padding:
|
|
1632
|
+
padding: 6px 10px;
|
|
1633
|
+
min-height: 28px;
|
|
1634
|
+
flex-shrink: 0;
|
|
1630
1635
|
border-bottom: 1px solid var(--dpk-rule);
|
|
1631
1636
|
font-size: 10.5px;
|
|
1632
1637
|
}
|
|
@@ -1657,6 +1662,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1657
1662
|
}
|
|
1658
1663
|
|
|
1659
1664
|
.er-field-mark {
|
|
1665
|
+
grid-area: mark;
|
|
1660
1666
|
font-family: var(--dpk-mono);
|
|
1661
1667
|
font-size: 10px;
|
|
1662
1668
|
text-align: center;
|
|
@@ -1675,6 +1681,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1675
1681
|
}
|
|
1676
1682
|
|
|
1677
1683
|
.er-key {
|
|
1684
|
+
grid-area: key;
|
|
1678
1685
|
display: grid;
|
|
1679
1686
|
place-items: center;
|
|
1680
1687
|
border-radius: 3px;
|
|
@@ -1689,26 +1696,33 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1689
1696
|
}
|
|
1690
1697
|
|
|
1691
1698
|
.er-field-name {
|
|
1699
|
+
grid-area: name;
|
|
1692
1700
|
font-family: var(--dpk-mono);
|
|
1693
|
-
white-space:
|
|
1694
|
-
overflow:
|
|
1695
|
-
|
|
1701
|
+
white-space: normal;
|
|
1702
|
+
overflow-wrap: anywhere;
|
|
1703
|
+
min-width: 0;
|
|
1696
1704
|
}
|
|
1697
1705
|
|
|
1698
1706
|
.er-field-type {
|
|
1707
|
+
grid-area: type;
|
|
1699
1708
|
font-size: 9.5px;
|
|
1700
1709
|
color: var(--dpk-ink-faint);
|
|
1701
|
-
white-space:
|
|
1710
|
+
white-space: normal;
|
|
1711
|
+
overflow-wrap: anywhere;
|
|
1712
|
+
min-width: 0;
|
|
1702
1713
|
}
|
|
1703
1714
|
|
|
1704
1715
|
.er-change {
|
|
1716
|
+
grid-area: type;
|
|
1705
1717
|
display: flex;
|
|
1706
1718
|
flex-direction: column;
|
|
1707
|
-
align-items: flex-
|
|
1719
|
+
align-items: flex-start;
|
|
1708
1720
|
font-size: 9px;
|
|
1709
1721
|
line-height: 1.6;
|
|
1710
|
-
white-space:
|
|
1711
|
-
|
|
1722
|
+
white-space: normal;
|
|
1723
|
+
overflow-wrap: anywhere;
|
|
1724
|
+
min-width: 0;
|
|
1725
|
+
text-align: left;
|
|
1712
1726
|
}
|
|
1713
1727
|
|
|
1714
1728
|
.er-change del {
|
|
@@ -1787,7 +1801,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1787
1801
|
fill: var(--dpk-blue);
|
|
1788
1802
|
stroke: var(--dpk-blue);
|
|
1789
1803
|
}
|
|
1790
|
-
`,Pa=[{id:"er-neutral"},{id:"er-added"},{id:"er-removed"},{id:"er-selected"}],
|
|
1804
|
+
`,Pa=[{id:"er-neutral"},{id:"er-added"},{id:"er-removed"},{id:"er-selected"}],Ot={same:"",added:"+",removed:"\u2212",changed:"~"};class It extends ne{static{this.styles=[W,Ia]}#e="";#a=new Map;#s=null;disconnectedCallback(){this.#s?.disconnect(),this.#s=null,super.disconnectedCallback()}updated(){super.updated(),typeof ResizeObserver<"u"&&(this.#s??=new ResizeObserver(()=>this.#t())),this.#s?.disconnect();for(const e of this.renderRoot.querySelectorAll(".er-table")){this.#s?.observe(e);for(const t of e.querySelectorAll(".er-field"))this.#s?.observe(t)}this.#t()}#t(){let e=!1;for(const t of this.renderRoot.querySelectorAll(".er-table")){const s=t.dataset.erTable,r=t.getBoundingClientRect();if(s===void 0||r.width===0)continue;const n=r.width/t.offsetWidth,i=d=>Math.round(d*64)/64,o={height:i(r.height/n),rows:[...t.querySelectorAll(".er-field")].map(d=>{const l=d.getBoundingClientRect();return i((l.top+l.height/2-r.top)/n)})};JSON.stringify(this.#a.get(s))!==JSON.stringify(o)&&(this.#a.set(s,o),e=!0)}e&&this.requestUpdate()}layoutSignature(){return JSON.stringify([...this.#a])}filtered(){const e=super.filtered();return{...e,nodes:e.nodes.map(t=>{const s=this.#a.get(t.id);if(!s)return t;const r={...t.ports};for(const n of e.edges){if(n.from===t.id&&n.fromPort!==void 0){const i=s.rows[t.fields.findIndex(o=>o.id===n.sourceField)];i!==void 0&&(r[n.fromPort]={x:t.width,y:i})}if(n.to===t.id&&n.toPort!==void 0){const i=s.rows[t.fields.findIndex(o=>o.id===n.targetField)];i!==void 0&&(r[n.toPort]={x:0,y:i})}}return{...t,height:s.height,ports:r}})}}parseData(e){return Oa(e)}emptyData(){return Aa()}defaultHeading(){return te(this.locale).heading}statsLabels(){const e=te(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return te(this.locale).empty}layoutOptions(){return{nodeSpacing:38,layerSpacing:96,padding:32}}matchesFilter(e){return this.#e===""?!0:[e.id,e.name,...e.fields.map(t=>t.id)].some(t=>t.toLowerCase().includes(this.#e))}relations(e,t){if(e===null||e.kind!=="node")return V;const s=U(t.edges,e.id,"outgoing",!1),r=U(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...r.nodes]),edges:new Set([...s.edges,...r.edges])}}renderToolbarActions(){const e=te(this.locale);return p`
|
|
1791
1805
|
<label class="er-search">
|
|
1792
1806
|
<span class="dpk-label">${e.search}</span>
|
|
1793
1807
|
<input
|
|
@@ -1802,56 +1816,55 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1802
1816
|
<span><i class="er-swatch-added"></i>${e.legendAdded}</span>
|
|
1803
1817
|
<span><i class="er-swatch-removed"></i>${e.legendRemoved}</span>
|
|
1804
1818
|
<span><i class="er-swatch-changed"></i>${e.legendChanged}</span>
|
|
1805
|
-
</div>`}#
|
|
1806
|
-
<g class=${this.elementClass(
|
|
1807
|
-
<title>${`${
|
|
1808
|
-
<path class="d-edge-path" d=${o} marker-end=${`url(#${this.#
|
|
1819
|
+
</div>`}#r(e){const t=this.selection;return t!==null&&t.kind==="edge"?"er-selected":e==="added"?"er-added":e==="removed"?"er-removed":"er-neutral"}renderCanvas(){const e=te(this.locale),t=this.visible,s=t.edges.map(r=>{const n=this.edgeState(r.id),i=this.routeOf(r.id),o=re(i),d=()=>this.select({kind:"edge",id:r.id});return P`
|
|
1820
|
+
<g class=${this.elementClass(n,"d-edge","er-edge",`is-${r.status}`)} data-relation=${r.id}>
|
|
1821
|
+
<title>${`${r.from}.${r.sourceField} \u2192 ${r.to}.${r.targetField}`}</title>
|
|
1822
|
+
<path class="d-edge-path" d=${o} marker-end=${`url(#${this.#r(r.status)})`}></path>
|
|
1809
1823
|
<path
|
|
1810
1824
|
class="d-edge-hit"
|
|
1811
1825
|
d=${o}
|
|
1812
1826
|
role="button"
|
|
1813
1827
|
tabindex="0"
|
|
1814
|
-
aria-label=${e.edgeLabel(
|
|
1828
|
+
aria-label=${e.edgeLabel(r.from,r.to)}
|
|
1815
1829
|
@click=${d}
|
|
1816
1830
|
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
1817
1831
|
></path>
|
|
1818
|
-
${i.length>0?this.#
|
|
1819
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:
|
|
1832
|
+
${i.length>0?this.#n(i,r.status):k}
|
|
1833
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:r.id},`${r.from}.${r.sourceField} \u2192 ${r.to}.${r.targetField}`,i)}
|
|
1820
1834
|
</g>
|
|
1821
|
-
`});return p`${this.renderEdges(s,Pa)}${t.nodes.map(
|
|
1835
|
+
`});return p`${this.renderEdges(s,Pa)}${t.nodes.map(r=>this.#i(r,e))}`}#n(e,t){const s=e[0],r=e.at(-1);return!s||!r?p``:P`
|
|
1822
1836
|
<text class="er-cardinality is-${t}" x=${s.x+9} y=${s.y-5}>1</text>
|
|
1823
|
-
<text class="er-cardinality is-${t}" x=${
|
|
1824
|
-
`}#
|
|
1837
|
+
<text class="er-cardinality is-${t}" x=${r.x-13} y=${r.y-5}>N</text>
|
|
1838
|
+
`}#i(e,t){const s=this.placedNode(e.id);if(!s)return k;const r=this.nodeState(e.id);return p`
|
|
1825
1839
|
<div
|
|
1826
|
-
class=${this.elementClass(
|
|
1840
|
+
class=${this.elementClass(r,"d-node","er-table",`is-${e.status}`)}
|
|
1827
1841
|
data-er-table=${e.id}
|
|
1828
1842
|
data-grill-questions=${this.questionsOf(e)}
|
|
1829
|
-
style="left:${s.x}px; top:${s.y}px; width:${e.width}px
|
|
1843
|
+
style="left:${s.x}px; top:${s.y}px; width:${e.width}px"
|
|
1830
1844
|
>
|
|
1831
1845
|
<button
|
|
1832
1846
|
type="button"
|
|
1833
1847
|
class="er-head"
|
|
1834
1848
|
data-table=${e.id}
|
|
1835
|
-
aria-pressed=${
|
|
1849
|
+
aria-pressed=${r.selected?"true":"false"}
|
|
1836
1850
|
title=${`${e.id} / ${e.name}`}
|
|
1837
1851
|
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
1838
1852
|
>
|
|
1839
|
-
${e.status==="same"?k:p`<span class="er-mark" aria-hidden="true">${
|
|
1853
|
+
${e.status==="same"?k:p`<span class="er-mark" aria-hidden="true">${Ot[e.status]}</span>`}
|
|
1840
1854
|
<span class="er-name">${e.id}</span>
|
|
1841
1855
|
<span class="er-label">${e.name}</span>
|
|
1842
1856
|
<span class="dpk-label er-status">${t.statusLabel(e.status)}</span>
|
|
1843
1857
|
</button>
|
|
1844
1858
|
${this.renderCommentTrigger({kind:"node",id:e.id},`${e.id} \xB7 ${e.name}`)}
|
|
1845
|
-
<div class="er-fields">${e.fields.map(
|
|
1859
|
+
<div class="er-fields">${e.fields.map(n=>this.#o(n,t))}</div>
|
|
1846
1860
|
</div>
|
|
1847
|
-
`}#
|
|
1861
|
+
`}#o(e,t){const s=n=>[n.type,n.key??"\u2014",n.ref??null,n.nullable?t.nullable:null].filter(Boolean).join(" \xB7 "),r=this.#e!==""&&e.id.toLowerCase().includes(this.#e);return p`
|
|
1848
1862
|
<div
|
|
1849
|
-
class="er-field is-${e.status} ${
|
|
1850
|
-
style="height:${be(e)}px"
|
|
1863
|
+
class="er-field is-${e.status} ${r?"is-match":""}"
|
|
1851
1864
|
data-grill-questions=${this.questionsOf(e)}
|
|
1852
1865
|
title=${[t.statusLabel(e.status),e.id,s(e)].filter(Boolean).join(" / ")}
|
|
1853
1866
|
>
|
|
1854
|
-
<span class="er-field-mark" aria-hidden="true">${
|
|
1867
|
+
<span class="er-field-mark" aria-hidden="true">${Ot[e.status]}</span>
|
|
1855
1868
|
<span class="er-key" data-empty=${e.key===null?"true":"false"}>${e.key??"\xB7"}</span>
|
|
1856
1869
|
<span class="er-field-name">${e.id}</span>
|
|
1857
1870
|
${e.status==="changed"&&e.before!==null?p`<span class="er-change">
|
|
@@ -1859,7 +1872,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
1859
1872
|
<ins>+ ${s(e)}</ins>
|
|
1860
1873
|
</span>`:p`<span class="er-field-type">${s(e)}</span>`}
|
|
1861
1874
|
</div>
|
|
1862
|
-
`}}const
|
|
1875
|
+
`}}const Pt=()=>{customElements.get("dpk-component-er-diagram")||customElements.define("dpk-component-er-diagram",It)},oe=H({en:{heading:"Architecture",node:"Service",edge:"Connection",empty:"No matching services.",boundaries:"Boundaries",edgeLabel:(a,e)=>`Connection from ${a} to ${e}`,artworkCredit:a=>`Icon credit: ${a}`},ja:{heading:"\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3\u56F3",node:"\u30B5\u30FC\u30D3\u30B9",edge:"\u63A5\u7D9A",empty:"\u8A72\u5F53\u3059\u308B\u30B5\u30FC\u30D3\u30B9\u306F\u3042\u308A\u307E\u305B\u3093\u3002",boundaries:"\u5883\u754C",edgeLabel:(a,e)=>`${a} \u304B\u3089 ${e} \u3078\u306E\u63A5\u7D9A`,artworkCredit:a=>`\u30A2\u30A4\u30B3\u30F3\u51FA\u5178: ${a}`}}),jt={width:220,height:112},be=26,ja=q({src:$(m(),M(1)),alt:$(m(),M(1)),license:f(m())}),Fa=q({id:$(m(),M(1)),name:$(m(),M(1)),description:f(m()),boundary:f(m()),symbol:f(m()),tags:f(z(m()),[]),artwork:f(ja),position:q({x:se(),y:se()}),questions:f(m())}),Ua=q({id:$(m(),M(1)),label:$(m(),M(1)),kind:f(Y(["internal","external"]),"internal")}),Na=q({id:$(m(),M(1)),from:$(m(),M(1)),to:$(m(),M(1)),label:f(m())}),Ha=q({boundaries:f(z(Ua),[]),services:z(Fa),links:f(z(Na),[])}),Ba=()=>({nodes:[],edges:[],boundaries:[]}),_a=a=>{const e=_(Ha,a),t=new Set;for(const o of e.boundaries){if(t.has(o.id))throw new Error(`duplicate boundary id: ${o.id}`);t.add(o.id)}const s=new Set,r=e.services.map(o=>{if(s.has(o.id))throw new Error(`duplicate service id: ${o.id}`);if(s.add(o.id),o.boundary!==void 0&&!t.has(o.boundary))throw new Error(`unknown boundary: ${o.boundary}`);return{id:o.id,name:o.name,description:o.description??null,boundary:o.boundary??null,symbol:o.symbol??null,artwork:o.artwork?{src:o.artwork.src,alt:o.artwork.alt,license:o.artwork.license??null}:null,tags:o.tags,width:jt.width,height:jt.height,position:o.position,...o.questions===void 0?{}:{questions:o.questions}}}),n=new Set,i=e.links.map(o=>{if(n.has(o.id))throw new Error(`duplicate link id: ${o.id}`);if(n.add(o.id),!s.has(o.from))throw new Error(`unknown link source: ${o.from}`);if(!s.has(o.to))throw new Error(`unknown link target: ${o.to}`);return{id:o.id,from:o.from,to:o.to,label:o.label??null,tags:[]}});return{nodes:r,edges:i,boundaries:e.boundaries.map(o=>({id:o.id,label:o.label,kind:o.kind}))}},Le={left:be,top:be*1.6,right:be,bottom:be},Ya={left:0,top:0,right:0,bottom:0},Va=12,Ft=a=>({left:Math.min(...a.map(e=>e.position?.x??0)),top:Math.min(...a.map(e=>e.position?.y??0)),right:Math.max(...a.map(e=>(e.position?.x??0)+e.width)),bottom:Math.max(...a.map(e=>(e.position?.y??0)+e.height))}),Wa=(a,e,t,s)=>{const r=a.left-e.left<t.right+s.right&&t.left-s.left<a.right+e.right,n=a.top-e.top<t.bottom+s.bottom&&t.top-s.top<a.bottom+e.bottom;if(!r||!n)return e;const i=Math.max(t.left-a.right,a.left-t.right),o=Math.max(t.top-a.bottom,a.top-t.bottom);if(i<0&&o<0)return e;const d=(l,c,b)=>l===0?0:Math.max(0,b-Va)*l/(l+c);return i>=o?t.left>=a.right?{...e,right:Math.min(e.right,d(e.right,s.left,i))}:{...e,left:Math.min(e.left,d(e.left,s.right,i))}:t.top>=a.bottom?{...e,bottom:Math.min(e.bottom,d(e.bottom,s.top,o))}:{...e,top:Math.min(e.top,d(e.top,s.bottom,o))}},Ga=(a,e)=>{const t=e.flatMap(r=>{const n=a.filter(i=>i.boundary===r.id);return n.length===0?[]:[{boundary:r,bounds:Ft(n)}]}),s=[...t.map(r=>({id:r.boundary.id,bounds:r.bounds,padding:Le})),...a.filter(r=>r.boundary===null||!t.some(n=>n.boundary.id===r.boundary)).map(r=>({id:null,bounds:Ft([r]),padding:Ya}))];return t.map(({boundary:r,bounds:n})=>{const i=s.filter(l=>l.id!==r.id).map(l=>Wa(n,Le,l.bounds,l.padding)).reduce((l,c)=>({left:Math.min(l.left,c.left),top:Math.min(l.top,c.top),right:Math.min(l.right,c.right),bottom:Math.min(l.bottom,c.bottom)}),Le),o=n.left-i.left,d=n.top-i.top;return{boundary:r,x:o,y:d,width:n.right+i.right-o,height:n.bottom+i.bottom-d}})},Ka=(a,e)=>{const t=n=>n.y+n.height/2,s=n=>n.x+n.width/2,r=(n,i,o)=>{if(o?n.y===i.y:n.x===i.x)return[n,i];if(o){const l=(n.x+i.x)/2;return[n,{x:l,y:n.y},{x:l,y:i.y},i]}const d=(n.y+i.y)/2;return[n,{x:n.x,y:d},{x:i.x,y:d},i]};return e.x>=a.x+a.width?r({x:a.x+a.width,y:t(a)},{x:e.x,y:t(e)},!0):a.x>=e.x+e.width?r({x:a.x,y:t(a)},{x:e.x+e.width,y:t(e)},!0):e.y>=a.y+a.height?r({x:s(a),y:a.y+a.height},{x:s(e),y:e.y},!1):a.y>=e.y+e.height?r({x:s(a),y:a.y},{x:s(e),y:e.y+e.height},!1):null},Xa=(a,e)=>{const t=new Map(a.nodes.map(r=>[r.id,r])),s=a.routes.map(r=>{const n=e.find(l=>l.id===r.id),i=n?t.get(n.from):void 0,o=n?t.get(n.to):void 0,d=i&&o&&i!==o?Ka(i,o):null;return d===null?r:{id:r.id,points:d}});return{...a,routes:s}},Ja=B`
|
|
1863
1876
|
.arch-toggle {
|
|
1864
1877
|
min-height: 26px;
|
|
1865
1878
|
padding: 0 9px;
|
|
@@ -2015,7 +2028,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2015
2028
|
fill: var(--dpk-blue);
|
|
2016
2029
|
stroke: var(--dpk-blue);
|
|
2017
2030
|
}
|
|
2018
|
-
`,Za=[{id:"arch-neutral"},{id:"arch-selected"}];class
|
|
2031
|
+
`,Za=[{id:"arch-neutral"},{id:"arch-selected"}];class Ut extends ne{static{this.styles=[W,Ja]}#e=!0;parseData(e){return _a(e)}emptyData(){return Ba()}defaultHeading(){return oe(this.locale).heading}statsLabels(){const e=oe(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return oe(this.locale).empty}get layoutMode(){return"fixed"}layoutOptions(){return{padding:40}}computePlacement(e){return Xa(super.computePlacement(e),e.edges)}isEmpty(){return this.visible.nodes.length===0}contentSize(){const e=super.contentSize();if(e===null)return null;const t=this.#a();return t.length===0?e:{width:Math.max(e.width,...t.map(s=>s.x+s.width)),height:Math.max(e.height,...t.map(s=>s.y+s.height))}}relations(e,t){if(e===null||e.kind!=="node")return V;const s=U(t.edges,e.id,"outgoing",!1),r=U(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...r.nodes]),edges:new Set([...s.edges,...r.edges])}}renderToolbarActions(){const e=oe(this.locale);return p`
|
|
2019
2032
|
<button
|
|
2020
2033
|
type="button"
|
|
2021
2034
|
class="dpk-btn dpk-btn--ghost arch-toggle"
|
|
@@ -2025,9 +2038,9 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2025
2038
|
>
|
|
2026
2039
|
${e.boundaries}
|
|
2027
2040
|
</button>
|
|
2028
|
-
`}#
|
|
2029
|
-
<g class=${this.elementClass(i,"d-edge","arch-link")} data-link=${
|
|
2030
|
-
<title>${
|
|
2041
|
+
`}#a(){const e=this.visible.nodes.flatMap(t=>{const s=this.placedNode(t.id);return s?[{...t,position:{x:s.x,y:s.y}}]:[]});return Ga(e,this.items().boundaries)}renderCanvas(){const e=oe(this.locale),t=this.visible,s=n=>t.nodes.find(i=>i.id===n)?.name??n,r=t.edges.map(n=>{const i=this.edgeState(n.id),o=this.routeOf(n.id),d=re(o),l=()=>this.select({kind:"edge",id:n.id});return P`
|
|
2042
|
+
<g class=${this.elementClass(i,"d-edge","arch-link")} data-link=${n.id}>
|
|
2043
|
+
<title>${n.label??n.id}</title>
|
|
2031
2044
|
<path
|
|
2032
2045
|
class="d-edge-path"
|
|
2033
2046
|
d=${d}
|
|
@@ -2038,30 +2051,30 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2038
2051
|
d=${d}
|
|
2039
2052
|
role="button"
|
|
2040
2053
|
tabindex="0"
|
|
2041
|
-
aria-label=${e.edgeLabel(s(
|
|
2054
|
+
aria-label=${e.edgeLabel(s(n.from),s(n.to))}
|
|
2042
2055
|
@click=${l}
|
|
2043
2056
|
@keydown=${c=>{c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),l())}}
|
|
2044
2057
|
></path>
|
|
2045
|
-
${
|
|
2046
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:
|
|
2058
|
+
${n.label===null||o.length===0?k:this.#s(n.label,o)}
|
|
2059
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:n.id},`${s(n.from)} \u2192 ${s(n.to)}${n.label===null?"":` \xB7 ${n.label}`}`,o)}
|
|
2047
2060
|
</g>
|
|
2048
2061
|
`});return p`
|
|
2049
|
-
${this.#e?this.#
|
|
2050
|
-
class=${`arch-boundary ${
|
|
2051
|
-
data-boundary=${
|
|
2052
|
-
style="left:${
|
|
2062
|
+
${this.#e?this.#a().map(n=>p`<div
|
|
2063
|
+
class=${`arch-boundary ${n.boundary.kind==="external"?"is-external":""}`}
|
|
2064
|
+
data-boundary=${n.boundary.id}
|
|
2065
|
+
style="left:${n.x}px; top:${n.y}px; width:${n.width}px; height:${n.height}px"
|
|
2053
2066
|
>
|
|
2054
|
-
<span>${
|
|
2067
|
+
<span>${n.boundary.label}</span>
|
|
2055
2068
|
</div>`):k}
|
|
2056
|
-
${this.renderEdges(
|
|
2057
|
-
`}#
|
|
2069
|
+
${this.renderEdges(r,Za)} ${t.nodes.map(n=>this.#t(n,e))}
|
|
2070
|
+
`}#s(e,t){const s=t[Math.floor(t.length/2)]??t[0];return s?P`<text class="arch-link-label" x=${s.x} y=${s.y-6}>${e}</text>`:p``}#t(e,t){const s=this.placedNode(e.id);if(!s)return k;const r=this.nodeState(e.id);return p`
|
|
2058
2071
|
<button
|
|
2059
2072
|
type="button"
|
|
2060
|
-
class=${this.elementClass(
|
|
2073
|
+
class=${this.elementClass(r,"d-node","arch-service")}
|
|
2061
2074
|
data-service=${e.id}
|
|
2062
2075
|
data-grill-questions=${this.questionsOf(e)}
|
|
2063
2076
|
style="left:${s.x}px; top:${s.y}px; width:${e.width}px; height:${e.height}px"
|
|
2064
|
-
aria-pressed=${
|
|
2077
|
+
aria-pressed=${r.selected?"true":"false"}
|
|
2065
2078
|
title=${e.description??e.name}
|
|
2066
2079
|
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2067
2080
|
>
|
|
@@ -2077,7 +2090,7 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2077
2090
|
</span>
|
|
2078
2091
|
</button>
|
|
2079
2092
|
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:s.x+e.width-20,y:s.y-14})}
|
|
2080
|
-
`}}const Nt=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",
|
|
2093
|
+
`}}const Nt=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",Ut)},Ht=[72,52,40],Bt=[0,22,10,8],Qa=a=>Ht[Math.min(a,Ht.length-1)]??40,_t=a=>Bt[Math.min(a,Bt.length-1)]??8,er=(a,e={})=>{const t=e.padding??40,s=a.nodes.find(y=>y.parent===null);if(s===void 0)return{width:0,height:0,nodes:[],routes:[]};const r=new Map(a.nodes.map(y=>[y.id,y])),n=y=>y.children.flatMap(A=>{const L=r.get(A);return L===void 0?[]:[L]}),i=new Map,o=y=>y.reduce((A,L,N)=>A+d(L)+(N===0?0:_t(L.depth)),0),d=y=>{const A=i.get(y.id);if(A!==void 0)return A;const L=Math.max(y.height,o(n(y)));return i.set(y.id,L),L},l=[],c=(y,A,L)=>{if(A.length===0)return;const N=Qa(y.node.depth);let g=y.y+y.node.height/2-o(A)/2;for(const w of A){const E=d(w),I={x:L==="right"?y.x+y.node.width+N:y.x-N-w.width,y:g+E/2-w.height/2,node:w};l.push(I),c(I,n(w),L),g+=E+_t(w.depth)}},b={x:-s.width/2,y:-s.height/2,node:s};l.push(b);const h=n(s);c(b,h.filter(y=>y.side!=="left"),"right"),c(b,h.filter(y=>y.side==="left"),"left");const u=Math.min(...l.map(y=>y.x)),S=Math.min(...l.map(y=>y.y)),x=Math.max(...l.map(y=>y.x+y.node.width)),v=Math.max(...l.map(y=>y.y+y.node.height)),C=t-u,D=t-S,T=new Map,O=l.map(y=>{const A=T.get(y.node.depth)??0;return T.set(y.node.depth,A+1),{id:y.node.id,x:y.x+C,y:y.y+D,width:y.node.width,height:y.node.height,layer:y.node.depth,order:A}}),j=new Map(O.map(y=>[y.id,y])),ue=a.edges.flatMap(y=>{const A=j.get(y.from),L=j.get(y.to),N=r.get(y.to);if(A===void 0||L===void 0||N===void 0)return[];const g=N.side==="left",w={x:g?A.x:A.x+A.width,y:A.y+A.height/2},E={x:g?L.x+L.width:L.x,y:L.y+L.height/2};return[{id:y.id,points:[w,E]}]});return{width:x-u+t*2,height:v-S+t*2,nodes:O,routes:ue}},tr=a=>{const e=a[0],t=a.at(-1);if(e===void 0||t===void 0)return"";const s=(t.x-e.x)/2;return`M${e.x} ${e.y} C${e.x+s} ${e.y} ${t.x-s} ${t.y} ${t.x} ${t.y}`},de=H({en:{heading:"Mind map",empty:"No matching topics.",topics:"Topic",toggleOpen:(a,e)=>`Open ${e} subtopics of ${a}`,toggleClose:a=>`Collapse subtopics of ${a}`,addSubtopicButton:"+ Subtopic",commentButton:"Comment",addSubtopicAriaLabel:a=>`Subtopic of ${a}`,addSubtopicPlaceholder:"Subtopic title (Enter to add)",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",addTopicTitle:"Add topic",addSummary:(a,e)=>`${a} \u203A ${e}`},ja:{heading:"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7",empty:"\u8A72\u5F53\u3059\u308B\u30C8\u30D4\u30C3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",topics:"\u30C8\u30D4\u30C3\u30AF",toggleOpen:(a,e)=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF ${e} \u4EF6\u3092\u3072\u3089\u304F`,toggleClose:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u3092\u305F\u305F\u3080`,addSubtopicButton:"\uFF0B \u30B5\u30D6\u30C8\u30D4\u30C3\u30AF",commentButton:"\u30B3\u30E1\u30F3\u30C8",addSubtopicAriaLabel:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF`,addSubtopicPlaceholder:"\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",addTopicTitle:"\u30C8\u30D4\u30C3\u30AF\u3092\u8FFD\u52A0",addSummary:(a,e)=>`${a} \u203A ${e}`}}),Yt=ks(()=>q({id:$(m(),M(1)),label:$(m(),M(1)),description:f(m()),tags:f(z(m())),questions:f(m()),collapsed:f(ye()),side:f(Y(["left","right"])),children:f(z(Yt))})),sr=q({root:Yt}),Vt=()=>({root:null,nodes:[],edges:[]}),Wt=[{fontSize:16,padding:22,height:48,min:120,max:280},{fontSize:13.5,padding:15,height:34,min:80,max:240},{fontSize:12.5,padding:12,height:28,min:56,max:220}],ar=a=>Wt[Math.min(a,Wt.length-1)]??{fontSize:12.5,padding:12,height:28,min:56,max:220},rr=(a,e)=>{let t=0;for(const s of a)t+=(s.codePointAt(0)??0)>=11904?e:e*.62;return t},nr=(a,e)=>{const t=ar(e),s=Math.ceil(rr(a,t.fontSize)+t.padding*2+4);return{width:Math.min(t.max,Math.max(t.min,s)),height:t.height}},Re=a=>a.children===void 0||a.children.length===0?1:a.children.reduce((e,t)=>e+Re(t),0),Gt=a=>{const e={left:0,right:0};for(const t of a)t.side!==void 0&&(e[t.side]+=Re(t));return a.map(t=>{if(t.side!==void 0)return t.side;const s=e.right<=e.left?"right":"left";return e[s]+=Re(t),s})},Kt=a=>Xt(_(sr,a).root),Xt=(a,e=new Set)=>{const t=[],s=[],r=new Set,n=(i,o,d,l,c)=>{if(r.has(i.id))throw new Error(`duplicate topic id: ${i.id}`);if(r.add(i.id),i.side!==void 0&&d!==1)throw new Error(`side is only allowed on a main topic (a child of the root): ${i.id}`);const b=i.children??[];t.push({id:i.id,label:i.label,description:i.description??null,parent:o,depth:d,branch:l,side:c,children:b.map(u=>u.id),collapsed:i.collapsed??!1,added:e.has(i.id),tags:i.tags??[],...nr(i.label,d),...i.questions===void 0?{}:{questions:i.questions}}),o!==null&&s.push({id:i.id,from:o,to:i.id,tags:[]});const h=d===0?Gt(b):[];b.forEach((u,S)=>n(u,i.id,d+1,d===0?S:l,d===0?h[S]??"right":c))};return n(a,null,0,-1,null),{root:a,nodes:t,edges:s}},Jt="ADD_TOPIC",ir=$e({id:$(m(),M(1)),label:$(m(),Se(),M(1))}),or=a=>{const e=dt(a);return e?.length===3&&e[1]==="node"?e[2]??null:null},Zt=(a,e,t)=>a.id===e?{...a,children:[...a.children??[],t]}:a.children===void 0?a:{...a,children:a.children.map(s=>Zt(s,e,t))},dr=a=>{if(a.children===void 0)return a;const e=Gt(a.children);return{...a,children:a.children.map((t,s)=>({...t,side:e[s]??"right"}))}},lr=(a,e,t)=>{const s=a.addTopicTitle,r=new Map(e.nodes.map(d=>[d.id,d.label])),n=new Set,i=[];let o=e.root===null?null:dr(e.root);for(const d of t){if(d.type!==Jt){i.push({id:d.id,title:d.type,stale:"unsupported-action-type"});continue}const l=or(d.target.id),c=l===null?void 0:r.get(l),b=we(ir,d.payload);if(o===null||l===null||c===void 0){i.push({id:d.id,title:s,stale:"target-missing"});continue}if(!b.success||r.has(b.output.id)){i.push({id:d.id,title:s,stale:"constraint-violated"});continue}const{id:h,label:u}=b.output;o=Zt(o,l,{id:h,label:u}),r.set(h,u),n.add(h),i.push({id:d.id,title:s,summary:a.addSummary(c,u),tone:"create"})}return{data:o===null||n.size===0?e:Xt(o,n),results:i}},Oe=(a,e)=>{const t=new Map(a.nodes.map(n=>[n.id,n])),s=[];let r=t.get(e)?.parent??null;for(;r!==null&&!s.includes(r);)s.push(r),r=t.get(r)?.parent??null;return s},cr=(a,e)=>{const t=new Map(a.nodes.map(n=>[n.id,n]));let s=0;const r=[...t.get(e)?.children??[]];for(let n=r.pop();n!==void 0;n=r.pop())s+=1,r.push(...t.get(n)?.children??[]);return s},pr=(a,e,t)=>{let s=null;if(e!==null){const i=a.nodes.filter(e);if(i.length===0)return Vt();const o=new Map(a.nodes.map(l=>[l.id,l])),d=new Set;for(const l of i){d.add(l.id);for(const b of Oe(a,l.id))d.add(b);const c=[...l.children];for(let b=c.pop();b!==void 0;b=c.pop())d.add(b),c.push(...o.get(b)?.children??[])}s=d}const r=a.nodes.filter(i=>(s===null||s.has(i.id))&&!Oe(a,i.id).some(o=>t.has(o))),n=new Set(r.map(i=>i.id));return{...a,nodes:r,edges:a.edges.filter(i=>n.has(i.from)&&n.has(i.to))}},hr=B`
|
|
2081
2094
|
.branch-root {
|
|
2082
2095
|
--mind-color: var(--dpk-ink);
|
|
2083
2096
|
--mind-soft: var(--dpk-paper-sunken);
|
|
@@ -2294,33 +2307,33 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2294
2307
|
opacity: 1;
|
|
2295
2308
|
}
|
|
2296
2309
|
}
|
|
2297
|
-
`,
|
|
2298
|
-
${this.renderEdges(e.edges.map(s=>this.#
|
|
2310
|
+
`,ur=5;class Qt extends ne{static{this.styles=[W,hr]}#e=new Set;#a=null;#s=!1;#t=null;toggle(e,t){const s=this.items().nodes.find(n=>n.id===e);if(s===void 0||s.children.length===0)return;const r=t??!this.#e.has(e);if(r!==this.#e.has(e)){if(r){this.#e.add(e);const n=this.selection;n!==null&&Oe(this.items(),n.id).includes(e)&&this.select(null)}else this.#e.delete(e);this.requestUpdate()}}get collapsed(){return[...this.#e]}parseData(e){return Kt(e)}emptyData(){return Vt()}reduceElementActions(e,t){return lr(de(this.locale),e,t)}defaultHeading(){return de(this.locale).heading}emptyMessage(){return de(this.locale).empty}statsText(){const e=de(this.locale),t=this.items().nodes.length,s=this.filtered().nodes.length;return s===t?`${t} ${e.topics}`:`${s} / ${t} ${e.topics}`}filtered(){const e=this.tagFilter,t=e.active.length===0?null:s=>Z(s.tags,e);return pr(this.items(),t,this.#e)}layoutSignature(){return this.filtered().nodes.map(e=>`${e.id}<${e.parent??""}:${e.side??""}`).join(",")}computePlacement(e){return er(e)}refreshContent(){const e=this.authoredItems();e!==this.#a&&(this.#a=e,this.#e=new Set(e.nodes.filter(t=>t.collapsed).map(t=>t.id)),this.#s=!1,this.#t=null),super.refreshContent()}initialView(){if(this.#s){this.viewport?.apply();return}this.#s=!0,this.viewport?.fit()}commentItems(){return this.items().nodes.map(e=>({value:this.commentRef("node",e.id),label:e.label}))}hasSelection(e){return e.kind==="node"&&this.items().nodes.some(t=>t.id===e.id)}relations(e,t){if(e===null||e.kind!=="node")return{nodes:new Map,edges:new Set};const s=U(t.edges,e.id,"outgoing",!0),r=U(t.edges,e.id,"incoming",!0);return{nodes:new Map([...s.nodes,...r.nodes]),edges:new Set([...s.edges,...r.edges])}}renderSelection(){return k}renderCanvas(){const e=this.filtered(),t=de(this.locale);return p`
|
|
2311
|
+
${this.renderEdges(e.edges.map(s=>this.#n(s)),[])}
|
|
2299
2312
|
${e.nodes.map(s=>this.#i(s,t))} ${this.#c(t)}
|
|
2300
|
-
`}#
|
|
2313
|
+
`}#r(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%ur}`}#n(e){const t=this.items().nodes.find(r=>r.id===e.to),s=this.edgeState(e.id);return P`
|
|
2301
2314
|
<path
|
|
2302
|
-
class=${this.elementClass(s,"d-edge","mind-branch",this.#
|
|
2315
|
+
class=${this.elementClass(s,"d-edge","mind-branch",this.#r(t),`depth-${Math.min(t?.depth??1,3)}`)}
|
|
2303
2316
|
data-branch=${e.id}
|
|
2304
|
-
d=${
|
|
2317
|
+
d=${tr(this.routeOf(e.id))}
|
|
2305
2318
|
></path>
|
|
2306
|
-
`}#i(e,t){const s=this.placedNode(e.id);if(!s)return k;const
|
|
2319
|
+
`}#i(e,t){const s=this.placedNode(e.id);if(!s)return k;const r=this.nodeState(e.id),n=this.#e.has(e.id),i=`depth-${Math.min(e.depth,3)}`;return p`
|
|
2307
2320
|
<button
|
|
2308
2321
|
type="button"
|
|
2309
|
-
class=${this.elementClass(
|
|
2322
|
+
class=${this.elementClass(r,"d-node","mind-topic",i,this.#r(e),n&&"is-folded",e.added&&"is-added")}
|
|
2310
2323
|
data-topic=${e.id}
|
|
2311
2324
|
data-grill-questions=${this.questionsOf(e)}
|
|
2312
2325
|
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
2313
|
-
aria-pressed=${
|
|
2326
|
+
aria-pressed=${r.selected?"true":"false"}
|
|
2314
2327
|
title=${e.description??e.label}
|
|
2315
2328
|
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2316
2329
|
>
|
|
2317
2330
|
<span class="mind-label">${e.label}</span>
|
|
2318
2331
|
</button>
|
|
2319
|
-
${e.depth===0||e.children.length===0?k:this.#o(e,s,r
|
|
2320
|
-
`}#o(e,t,s,n
|
|
2332
|
+
${e.depth===0||e.children.length===0?k:this.#o(e,s,n,r.dimmed,t)}
|
|
2333
|
+
`}#o(e,t,s,r,n){const i=s?cr(this.items(),e.id):0,o=e.side==="left"?t.x:t.x+t.width,d=s?n.toggleOpen(e.label,i):n.toggleClose(e.label);return p`
|
|
2321
2334
|
<button
|
|
2322
2335
|
type="button"
|
|
2323
|
-
class=${this.elementClass({selected:!1,related:!1,dimmed:
|
|
2336
|
+
class=${this.elementClass({selected:!1,related:!1,dimmed:r,depth:null},"mind-toggle",this.#r(e),s&&"is-folded")}
|
|
2324
2337
|
data-toggle=${e.id}
|
|
2325
2338
|
style="left:${o}px; top:${t.y+t.height/2}px"
|
|
2326
2339
|
aria-expanded=${s?"false":"true"}
|
|
@@ -2330,14 +2343,14 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2330
2343
|
>
|
|
2331
2344
|
${s?i:"\u2212"}
|
|
2332
2345
|
</button>
|
|
2333
|
-
`}#c(e){const t=this.selection;if(t===null||t.kind!=="node")return k;const s=this.items().nodes.find(i=>i.id===t.id),
|
|
2346
|
+
`}#c(e){const t=this.selection;if(t===null||t.kind!=="node")return k;const s=this.items().nodes.find(i=>i.id===t.id),r=this.placedNode(t.id);if(s===void 0||r===void 0)return k;const n=this.#t?.parent===s.id?this.#t:null;return p`
|
|
2334
2347
|
<div
|
|
2335
2348
|
class="mind-actions"
|
|
2336
2349
|
data-for=${s.id}
|
|
2337
|
-
style="left:${this.#u(s,
|
|
2350
|
+
style="left:${this.#u(s,r)}px; top:${r.y+r.height+8}px"
|
|
2338
2351
|
@click=${i=>i.stopPropagation()}
|
|
2339
2352
|
>
|
|
2340
|
-
${
|
|
2353
|
+
${n===null?p`
|
|
2341
2354
|
<button type="button" class="dpk-btn" data-action="add" @click=${()=>this.#l(s.id)}>
|
|
2342
2355
|
${e.addSubtopicButton}
|
|
2343
2356
|
</button>
|
|
@@ -2354,14 +2367,14 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2354
2367
|
class="dpk-input"
|
|
2355
2368
|
aria-label="${e.addSubtopicAriaLabel(s.label)}"
|
|
2356
2369
|
placeholder="${e.addSubtopicPlaceholder}"
|
|
2357
|
-
.value=${
|
|
2358
|
-
@input=${i=>{const o=i.currentTarget;o instanceof HTMLInputElement&&(this.#t={...
|
|
2370
|
+
.value=${n.label}
|
|
2371
|
+
@input=${i=>{const o=i.currentTarget;o instanceof HTMLInputElement&&(this.#t={...n,label:o.value,failed:!1})}}
|
|
2359
2372
|
@keydown=${i=>this.#p(i,s.id)}
|
|
2360
2373
|
/>
|
|
2361
|
-
${
|
|
2374
|
+
${n.failed?p`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:k}
|
|
2362
2375
|
`}
|
|
2363
2376
|
</div>
|
|
2364
|
-
`}#u(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#p(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#t=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#t?.label.trim()??"";if(s.length===0)return;const
|
|
2377
|
+
`}#u(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#p(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#t=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#t?.label.trim()??"";if(s.length===0)return;const r=Ve(`topic ${s}`,this.items().nodes.map(i=>i.id));if(!this.dispatchElementAction(Jt,["node",t],{id:r,label:s})){this.#t={parent:t,label:s,failed:!0},this.requestUpdate();return}this.#t=null,this.#e.delete(t),this.select({kind:"node",id:r}),this.requestUpdate()}}const es=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",Qt)},le=H({en:{heading:"Kanban",empty:"No columns.",cards:"Card",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",wipLimit:a=>`WIP limit ${a}`,addCardButton:"+ Card",addCardAriaLabel:a=>`Card to add to ${a}`,addCardPlaceholder:"Card title (Enter to add)",addCardTitle:"Add card",moveCardTitle:"Move card",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: reorder within ${e}`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`},ja:{heading:"\u30AB\u30F3\u30D0\u30F3",empty:"\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002",cards:"\u30AB\u30FC\u30C9",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",wipLimit:a=>`WIP \u4E0A\u9650 ${a}`,addCardButton:"\uFF0B \u30AB\u30FC\u30C9",addCardAriaLabel:a=>`${a} \u306B\u8FFD\u52A0\u3059\u308B\u30AB\u30FC\u30C9`,addCardPlaceholder:"\u30AB\u30FC\u30C9\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",addCardTitle:"\u30AB\u30FC\u30C9\u3092\u8FFD\u52A0",moveCardTitle:"\u30AB\u30FC\u30C9\u3092\u79FB\u52D5",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: ${e} \u5185\u3067\u4E26\u3079\u66FF\u3048`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`}}),mr=q({id:$(m(),M(1)),title:$(m(),M(1)),description:f(m()),tags:f(z(m())),assignee:f(m()),questions:f(m())}),gr=["gray","blue","green","amber","violet","red"],fr=q({id:$(m(),M(1)),label:$(m(),M(1)),description:f(m()),color:f(Y(gr)),limit:f($(se(),xs(),vs(1))),cards:f(z(mr))}),br=q({columns:z(fr)}),kr=()=>({columns:[]}),ts=a=>{const e=_(br,a),t=new Set,s=new Set;return{columns:e.columns.map(n=>{if(t.has(n.id))throw new Error(`duplicate column id: ${n.id}`);return t.add(n.id),{id:n.id,label:n.label,description:n.description??null,color:n.color??null,limit:n.limit??null,cards:(n.cards??[]).map(i=>{if(s.has(i.id))throw new Error(`duplicate card id: ${i.id}`);return s.add(i.id),{id:i.id,title:i.title,description:i.description??null,tags:i.tags??[],assignee:i.assignee??null,...i.questions===void 0?{}:{questions:i.questions},column:n.id,change:null}})}})}},ke=(a,e)=>a.columns.flatMap(t=>t.cards).find(t=>t.id===e),ce=a=>a.columns.flatMap(e=>e.cards),vr=(a,e)=>e===null?a:{columns:a.columns.map(t=>({...t,cards:t.cards.filter(e)}))},xr=(a,e,t,s)=>{const r=ke(a,e);if(r===void 0||r.column!==t)return!1;if(s===e)return!0;const n=a.columns.find(o=>o.id===t)?.cards??[],i=n.findIndex(o=>o.id===e);return(n[i+1]?.id??null)===s},ss="ADD_CARD",as="MOVE_CARD",yr=$e({id:$(m(),M(1)),title:$(m(),Se(),M(1))}),wr=$e({column:$(m(),M(1)),before:ys($(m(),M(1)))}),rs=(a,e)=>{const t=dt(a);return t?.length===3&&t[1]===e?t[2]??null:null},$r=(a,e)=>({columns:a.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),ns=(a,e,t)=>({columns:a.columns.map(s=>{if(s.id!==t.column)return s;const r={...e,column:s.id},n=t.before===null?-1:s.cards.findIndex(i=>i.id===t.before);return{...s,cards:n<0?[...s.cards,r]:[...s.cards.slice(0,n),r,...s.cards.slice(n)]}})}),Sr=(a,e,t)=>{const s=a.addCardTitle,r=rs(t.target.id,"column"),n=e.columns.find(d=>d.id===r);if(n===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=we(yr,t.payload);if(!i.success||ke(e,i.output.id)!==void 0)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const o={id:i.output.id,title:i.output.title,description:null,tags:[],assignee:null,column:n.id,change:"added"};return{data:ns(e,o,{column:n.id,before:null}),result:{id:t.id,title:s,summary:a.addSummary(n.label,o.title),tone:"create"}}},Mr=(a,e,t)=>{const s=a.moveCardTitle,r=rs(t.target.id,"card"),n=r===null?void 0:ke(e,r);if(n===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=we(wr,t.payload),o=e.columns.find(u=>u.id===n.column),d=i.success?e.columns.find(u=>u.id===i.output.column):void 0,l=i.success?i.output.before:null,c=l===null||l!==n.id&&d?.cards.some(u=>u.id===l)===!0;if(!i.success||o===void 0||d===void 0||!c)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const b={...n,change:n.change??"moved"},h=o.id===d.id?a.moveSummarySame(n.title,d.label):a.moveSummaryAcross(n.title,o.label,d.label);return{data:ns($r(e,n.id),b,{column:d.id,before:l}),result:{id:t.id,title:s,summary:h,tone:"move"}}},Cr=(a,e,t)=>{let s=e;const r=[];for(const n of t){const i=n.type===ss?Sr(a,s,n):n.type===as?Mr(a,s,n):{data:s,result:{id:n.id,title:n.type,stale:"unsupported-action-type"}};s=i.data,r.push(i.result)}return{data:s,results:r}},qr=B`
|
|
2365
2378
|
.kanban-board {
|
|
2366
2379
|
display: flex;
|
|
2367
2380
|
align-items: flex-start;
|
|
@@ -2695,11 +2708,11 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2695
2708
|
width: 100%;
|
|
2696
2709
|
font-size: 12.5px;
|
|
2697
2710
|
}
|
|
2698
|
-
`;class
|
|
2711
|
+
`;class is extends ze{static{this.styles=[W,qr]}#e=null;#a=null;#s=null;#t=null;#r=null;parseData(e){return ts(e)}emptyData(){return kr()}reduceElementActions(e,t){return Cr(le(this.locale),e,t)}defaultHeading(){return le(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return le(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(t=>({value:this.commentRef("column",t.id),label:t.label})),...ce(e).map(t=>({value:this.commentRef("card",t.id),label:t.title}))]}hasSelection(e){const t=this.items();return e.kind==="column"?t.columns.some(s=>s.id===e.id):ke(t,e.id)!==void 0}tagItems(){return ce(this.items()).map(e=>e.tags)}statsText(){const e=le(this.locale),t=ce(this.items()).length,s=ce(this.#n()).length;return s===t?`${t} ${e.cards}`:`${s} / ${t} ${e.cards}`}isEmpty(){return this.items().columns.length===0}viewAlign(){return"start"}contentSize(){if(this.isEmpty())return null;const e=this.renderRoot.querySelector(".kanban-board");return{width:e?.offsetWidth??0,height:e?.offsetHeight??0}}refreshContent(){const e=this.authoredItems();e!==this.#e&&(this.#e=e,this.#a=null,this.#s=null)}renderCanvas(){const e=this.#n(),t=new Map(this.items().columns.map(s=>[s.id,s.cards.length]));return p`<div class="kanban-board">
|
|
2699
2712
|
${X(e.columns,s=>s.id,s=>this.#o(s,t.get(s.id)??0))}
|
|
2700
|
-
</div>`}#
|
|
2713
|
+
</div>`}#n(){const e=this.tagFilter;return vr(this.items(),e.active.length===0?null:t=>Z(t.tags,e))}#i(e,t){const s=this.selection;return s!==null&&s.kind===e&&s.id===t}#o(e,t){const s=le(this.locale),r=e.limit!==null&&t>e.limit,n=this.#r?.column===e.id?this.#r:null;return p`
|
|
2701
2714
|
<section
|
|
2702
|
-
class=${Q("kanban-column",
|
|
2715
|
+
class=${Q("kanban-column",r&&"is-over",this.#i("column",e.id)&&"is-selected",n!==null&&"is-drop-target")}
|
|
2703
2716
|
data-column=${e.id}
|
|
2704
2717
|
data-color=${e.color??k}
|
|
2705
2718
|
aria-label=${e.label}
|
|
@@ -2726,8 +2739,8 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2726
2739
|
@dragleave=${i=>this.#m(i)}
|
|
2727
2740
|
@drop=${i=>this.#g(i,e.id)}
|
|
2728
2741
|
>
|
|
2729
|
-
${X(e.cards,i=>i.id,i=>p`${
|
|
2730
|
-
${
|
|
2742
|
+
${X(e.cards,i=>i.id,i=>p`${n?.before===i.id?this.#c():k}${this.#u(i,s)}`)}
|
|
2743
|
+
${n!==null&&n.before===null?this.#c():k}
|
|
2731
2744
|
</div>
|
|
2732
2745
|
${this.#l(e,s)}
|
|
2733
2746
|
</section>
|
|
@@ -2743,21 +2756,21 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2743
2756
|
title=${e.description??e.title}
|
|
2744
2757
|
aria-pressed=${s?"true":"false"}
|
|
2745
2758
|
@click=${()=>this.select({kind:"card",id:e.id})}
|
|
2746
|
-
@keydown=${
|
|
2747
|
-
@dragstart=${
|
|
2759
|
+
@keydown=${r=>this.#p(r,e.id)}
|
|
2760
|
+
@dragstart=${r=>this.#f(r,e.id)}
|
|
2748
2761
|
@dragend=${()=>this.#b()}
|
|
2749
2762
|
>
|
|
2750
2763
|
<span class="kanban-card-title">${e.title}</span>
|
|
2751
2764
|
${e.description===null?k:p`<span class="kanban-card-description">${e.description}</span>`}
|
|
2752
2765
|
${e.tags.length===0&&e.assignee===null?k:p`<span class="kanban-card-meta">
|
|
2753
|
-
${e.tags.map(
|
|
2766
|
+
${e.tags.map(r=>p`<span class="kanban-tag">${r}</span>`)}
|
|
2754
2767
|
${e.assignee===null?k:p`<span class="kanban-assignee">${e.assignee}</span>`}
|
|
2755
2768
|
</span>`}
|
|
2756
2769
|
</div>
|
|
2757
2770
|
${this.renderCommentTrigger({kind:"card",id:e.id},e.title)}
|
|
2758
|
-
${this.#
|
|
2771
|
+
${this.#s===e.id?p`<p class="kanban-error" role="alert">${t.notRecorded}</p>`:k}
|
|
2759
2772
|
</div>
|
|
2760
|
-
`}#l(e,t){const s=this.#
|
|
2773
|
+
`}#l(e,t){const s=this.#a?.column===e.id?this.#a:null;return p`<div class="kanban-add">
|
|
2761
2774
|
${s===null?p`<button
|
|
2762
2775
|
type="button"
|
|
2763
2776
|
class="kanban-add-button"
|
|
@@ -2771,12 +2784,12 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
2771
2784
|
aria-label="${t.addCardAriaLabel(e.label)}"
|
|
2772
2785
|
placeholder="${t.addCardPlaceholder}"
|
|
2773
2786
|
.value=${s.title}
|
|
2774
|
-
@input=${
|
|
2775
|
-
@keydown=${
|
|
2787
|
+
@input=${r=>{const n=r.currentTarget;n instanceof HTMLInputElement&&(this.#a={...s,title:n.value,failed:!1})}}
|
|
2788
|
+
@keydown=${r=>this.#$(r,e.id)}
|
|
2776
2789
|
/>
|
|
2777
2790
|
${s.failed?p`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:k}
|
|
2778
2791
|
`}
|
|
2779
|
-
</div>`}#p(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#h(e,t){const s=this.dispatchElementAction(ns,["card",e],{column:t.column,before:t.before});this.#a=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#f(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#k(e,t);this.#n?.column===s.column&&this.#n.before===s.before||(this.#n=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#n=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const n=this.#k(e,t);this.#b(),yn(this.items(),s,n.column,n.before)||this.#h(s,n)}#b(){this.#t===null&&this.#n===null||(this.#t=null,this.#n=null,this.requestUpdate())}#k(e,t){const s=e.currentTarget,r=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(i=>{if(i.dataset.card===this.#t)return!1;const o=i.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:r?.dataset.card??null}}#x(e){this.#s={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#$(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#s=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#s?.title.trim()??"";if(s.length===0)return;const n=[...this.items().columns.map(i=>i.id),...ce(this.items()).map(i=>i.id)],r=Ve(`card ${s}`,n);if(!this.dispatchElementAction(as,["column",t],{id:r,title:s})){this.#s={column:t,title:s,failed:!0},this.requestUpdate();return}this.#s=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const ds=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",os)},Dn=N({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),F=$(m(),Me(),M(1)),pe=q({id:ae,text:F}),zn=_e("kind",[q({kind:J("proved"),assumptions:f(D(F))}),q({kind:J("bounded"),bound:F}),q({kind:J("incomplete"),gaps:f(D(F))}),q({kind:J("planned")})]),Tn=q({id:ae,target:f(ae),statement:F,subjects:f(D(pe)),premises:f(D(pe)),conclusions:$(D(pe),M(1,"a claim needs at least one conclusion")),examples:f(D(pe)),notClaimed:f(D(pe)),assurance:zn,source:f(q({tool:f(F),ref:F}))}),An=q({id:ae,name:F,meaning:F}),Ln=q({id:ae,name:F,code:f(F),summary:f(F)}),Rn=q({targets:f(D(Ln)),terms:f(D(An)),claims:D(Tn)}),On=()=>({targets:[],terms:[],claims:[]}),In=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,Pn=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(In)){const r=(n[1]??"").trim(),i=e.get(r);if(i===void 0)throw new Error(`unknown term reference: [[${r}]]`);n.index>s&&t.push({kind:"text",text:a.slice(s,n.index)}),t.push({kind:"term",id:r,label:n[2]?.trim()||i}),s=n.index+n[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Ie=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),jn=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],xe=(a,e)=>{const t=new Set;for(const s of a){if(t.has(s))throw new Error(`duplicate ${e} id: ${s}`);t.add(s)}},ls=a=>{const e=_(Rn,a),t=e.targets??[],s=e.terms??[];xe(t.map(c=>c.id),"target"),xe(s.map(c=>c.id),"term"),xe(e.claims.map(c=>c.id),"claim");const n=new Map(s.map(c=>[c.id,c.name])),r=c=>Pn(c,n),i=s.map(c=>({id:c.id,name:c.name,meaning:r(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:r(c.summary)})),d=new Set(o.map(c=>c.id)),l=e.claims.map(c=>{if(c.target!==void 0&&!d.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const b=O=>(O??[]).map(j=>({id:j.id,text:r(j.text)})),h=b(c.subjects),u=b(c.premises),S=b(c.conclusions),x=b(c.examples),v=b(c.notClaimed),C=[...h,...u,...S,...x,...v];xe(C.map(O=>O.id),`clause (in claim ${c.id})`);const z=Fn(c.assurance,r),T=r(c.statement);return{id:c.id,target:c.target??null,statement:T,subjects:h,premises:u,conclusions:S,examples:x,notClaimed:v,assurance:z,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:jn([T,...C.map(O=>O.text),...Un(z)])}});return{targets:o,terms:i,claims:l}},Fn=(a,e)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(e)};case"bounded":return{kind:"bounded",bound:e(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(e)};case"planned":return{kind:"planned"}}},Un=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},Hn=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[cs(t.assurance)?"conditional":t.assurance.kind]+=1;return e},cs=a=>a.kind==="proved"&&a.assumptions.length>0,ps=a=>{const e=new Map(a.targets.map(s=>[s.id,s])),t=new Map;for(const s of a.claims)t.set(s.target,[...t.get(s.target)??[],s]);for(const s of a.targets)t.has(s.id)||t.set(s.id,[]);return[...t].map(([s,n])=>({target:s===null?null:e.get(s)??null,claims:n}))},he=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},Pe=(a,e)=>{switch(e.kind){case"proved":return cs(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...he(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...he("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...he(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...he(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...he("",[])}}},Nn=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},Bn=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],hs=32,ye=a=>{const e=Ie(a.statement);return e.length<=hs?e:`${e.slice(0,hs).trimEnd()}\u2026`},_n=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...Bn(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ie(e.text)}`}))],Yn=a=>ps(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(_n)]),Vn=[je,Fe,Ue,B`
|
|
2792
|
+
</div>`}#p(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#h(e,t){const s=this.dispatchElementAction(as,["card",e],{column:t.column,before:t.before});this.#s=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#f(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#k(e,t);this.#r?.column===s.column&&this.#r.before===s.before||(this.#r=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#r=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const r=this.#k(e,t);this.#b(),xr(this.items(),s,r.column,r.before)||this.#h(s,r)}#b(){this.#t===null&&this.#r===null||(this.#t=null,this.#r=null,this.requestUpdate())}#k(e,t){const s=e.currentTarget,n=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(i=>{if(i.dataset.card===this.#t)return!1;const o=i.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:n?.dataset.card??null}}#x(e){this.#a={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#$(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#a=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#a?.title.trim()??"";if(s.length===0)return;const r=[...this.items().columns.map(i=>i.id),...ce(this.items()).map(i=>i.id)],n=Ve(`card ${s}`,r);if(!this.dispatchElementAction(ss,["column",t],{id:n,title:s})){this.#a={column:t,title:s,failed:!0},this.requestUpdate();return}this.#a=null,this.select({kind:"card",id:n}),this.requestUpdate()}}const os=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",is)},Er=H({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),F=$(m(),Se(),M(1)),pe=q({id:ae,text:F}),zr=_e("kind",[q({kind:J("proved"),assumptions:f(z(F))}),q({kind:J("bounded"),bound:F}),q({kind:J("incomplete"),gaps:f(z(F))}),q({kind:J("planned")})]),Dr=q({id:ae,target:f(ae),statement:F,subjects:f(z(pe)),premises:f(z(pe)),conclusions:$(z(pe),M(1,"a claim needs at least one conclusion")),examples:f(z(pe)),notClaimed:f(z(pe)),assurance:zr,source:f(q({tool:f(F),ref:F}))}),Tr=q({id:ae,name:F,meaning:F}),Ar=q({id:ae,name:F,code:f(F),summary:f(F)}),Lr=q({targets:f(z(Ar)),terms:f(z(Tr)),claims:z(Dr)}),Rr=()=>({targets:[],terms:[],claims:[]}),Or=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,Ir=(a,e)=>{const t=[];let s=0;for(const r of a.matchAll(Or)){const n=(r[1]??"").trim(),i=e.get(n);if(i===void 0)throw new Error(`unknown term reference: [[${n}]]`);r.index>s&&t.push({kind:"text",text:a.slice(s,r.index)}),t.push({kind:"term",id:n,label:r[2]?.trim()||i}),s=r.index+r[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Ie=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),Pr=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],ve=(a,e)=>{const t=new Set;for(const s of a){if(t.has(s))throw new Error(`duplicate ${e} id: ${s}`);t.add(s)}},ds=a=>{const e=_(Lr,a),t=e.targets??[],s=e.terms??[];ve(t.map(c=>c.id),"target"),ve(s.map(c=>c.id),"term"),ve(e.claims.map(c=>c.id),"claim");const r=new Map(s.map(c=>[c.id,c.name])),n=c=>Ir(c,r),i=s.map(c=>({id:c.id,name:c.name,meaning:n(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:n(c.summary)})),d=new Set(o.map(c=>c.id)),l=e.claims.map(c=>{if(c.target!==void 0&&!d.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const b=O=>(O??[]).map(j=>({id:j.id,text:n(j.text)})),h=b(c.subjects),u=b(c.premises),S=b(c.conclusions),x=b(c.examples),v=b(c.notClaimed),C=[...h,...u,...S,...x,...v];ve(C.map(O=>O.id),`clause (in claim ${c.id})`);const D=jr(c.assurance,n),T=n(c.statement);return{id:c.id,target:c.target??null,statement:T,subjects:h,premises:u,conclusions:S,examples:x,notClaimed:v,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:Pr([T,...C.map(O=>O.text),...Fr(D)])}});return{targets:o,terms:i,claims:l}},jr=(a,e)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(e)};case"bounded":return{kind:"bounded",bound:e(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(e)};case"planned":return{kind:"planned"}}},Fr=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},Ur=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[ls(t.assurance)?"conditional":t.assurance.kind]+=1;return e},ls=a=>a.kind==="proved"&&a.assumptions.length>0,cs=a=>{const e=new Map(a.targets.map(s=>[s.id,s])),t=new Map;for(const s of a.claims)t.set(s.target,[...t.get(s.target)??[],s]);for(const s of a.targets)t.has(s.id)||t.set(s.id,[]);return[...t].map(([s,r])=>({target:s===null?null:e.get(s)??null,claims:r}))},he=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},Pe=(a,e)=>{switch(e.kind){case"proved":return ls(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...he(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...he("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...he(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...he(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...he("",[])}}},Nr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},Hr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],ps=32,xe=a=>{const e=Ie(a.statement);return e.length<=ps?e:`${e.slice(0,ps).trimEnd()}\u2026`},Br=a=>[{target:{kind:"claim",claim:a.id},label:xe(a)},...Hr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${xe(a)} \u203A ${Ie(e.text)}`}))],_r=a=>cs(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(Br)]),Yr=[je,Fe,Ue,B`
|
|
2780
2793
|
:host {
|
|
2781
2794
|
display: block;
|
|
2782
2795
|
container-type: inline-size;
|
|
@@ -3319,23 +3332,23 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
3319
3332
|
font-size: 11px;
|
|
3320
3333
|
color: var(--dpk-accent);
|
|
3321
3334
|
}
|
|
3322
|
-
`],
|
|
3335
|
+
`],hs=a=>`claim-body-${a}`;class us extends Ne{static{this.styles=Yr}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#a=new Map;#s=null;#t=null;#r="";#n=null;#i=null;#o=new Map;#c=null;#u=new Set;#l=null;#p=null;#h=new Ge(this);#f=new He(this,()=>{this.#r=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#r="",document.addEventListener("keydown",this.#w),document.addEventListener("pointerdown",this.#S),this.#t=Qe(this,ds,e=>{e.ok?this.#g(e.value):this.#b(e.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#w),document.removeEventListener("pointerdown",this.#S),this.#t?.(),this.#t=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#x(),this.#$(),this.#L()}get commentTargets(){if(!this.id||this.#e===null)return[];const e=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return _r(this.#e).map(({target:t,label:s})=>({value:this.#k(t),label:s,group:e}))}get dataError(){return this.#s}get#d(){return Er(this.#f.locale)}#m(){return this.#e??Rr()}#g(e){this.#e=e,this.#a=new Map(e.terms.map(t=>[t.id,t])),this.#s=null,this.requestUpdate()}#b(e){this.#e=null,this.#a=new Map,this.#s=e,console.error("[dev-process-kit] invalid formal spec data:",e),this.requestUpdate()}#k(e){return`element:${[this.id,...Nr(e)].map(t=>encodeURIComponent(t)).join("/")}`}#x(){const e=JSON.stringify(this.commentTargets);e!==this.#r&&(this.#r=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#$(){const e=this.#i!==this.#n;this.#i=this.#n;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#M(this.#n);!t||!s||(this.#h.open(t,s,{width:300,height:280},{placement:"right-start"}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}#M(e){return e===null?null:[...this.renderRoot.querySelectorAll("[data-comment-ref]")].find(t=>t.dataset.commentRef===e)??null}#A(e,t){if(t.kind==="input"){this.#o=new Map(this.#o).set(e,t.body),this.#c=null,this.requestUpdate();return}if(t.kind==="comment"){if(!!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t.body},bubbles:!0,composed:!0,cancelable:!0}))){this.#c=e,this.requestUpdate();return}const n=new Map(this.#o);n.delete(e),this.#o=n}this.#c=null;const s=this.#M(e);this.#n=null,this.requestUpdate(),s?.focus({preventScroll:!0})}#C(e){const t=new Set(this.#u);if(t.delete(e)||t.add(e),this.#u=t,!t.has(e)){const s=this.#k({kind:"clause",claim:e,clause:""});this.#n?.startsWith(s)&&(this.#n=null);const r=this.#l?.anchor;r?.closest(".claim-body")?.id===hs(e)&&this.#v(r)}this.requestUpdate()}#q(e,t){const s=e.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#C(t)}#L(){const e=this.#l?.anchor??null,t=this.#p!==e;t&&(this.#p?.removeAttribute("aria-describedby"),e?.setAttribute("aria-describedby","spec-tip")),this.#p=e;const s=this.renderRoot.querySelector(".spec-tip");!s||!e||!t||this.#h.open(s,e,{width:300,height:240},{placement:"top-start"})}#E(e,t){this.#l?.anchor!==t&&(this.#l={tip:e,anchor:t},this.requestUpdate())}#v(e){this.#l===null||e!==void 0&&this.#l.anchor!==e||(this.#l=null,this.requestUpdate())}#w=e=>{e.key==="Escape"&&this.#v()};#S=e=>{this.#l!==null&&!e.composedPath().includes(this.#l.anchor)&&this.#v()};#z(e){const t=(r,n)=>{r.currentTarget instanceof HTMLElement&&n(r.currentTarget)},s=r=>r.pointerType!=="touch";return{enter:r=>s(r)&&t(r,n=>this.#E(e,n)),leave:r=>s(r)&&t(r,n=>this.#v(n)),show:r=>t(r,n=>this.#E(e,n)),hide:r=>t(r,n=>this.#v(n))}}render(){const e=this.#d,t=this.#m();return p`
|
|
3323
3336
|
<section class="spec">
|
|
3324
3337
|
<header class="spec-toolbar">
|
|
3325
3338
|
<span class="spec-title">${this.heading??e.heading}</span>
|
|
3326
3339
|
${this.subject?p`<span class="spec-subject">${this.subject}</span>`:k}
|
|
3327
3340
|
<span class="spec-stats">${this.#R(t)}</span>
|
|
3328
3341
|
</header>
|
|
3329
|
-
${this.#
|
|
3330
|
-
${this.#
|
|
3342
|
+
${this.#s===null?k:p`<p class="spec-notice" role="alert">${e.dataError}<br />${this.#s}</p>`}
|
|
3343
|
+
${this.#s===null&&t.claims.length===0?p`<p class="spec-empty">${e.empty}</p>`:k}
|
|
3331
3344
|
<div class="spec-groups">
|
|
3332
|
-
${X(
|
|
3345
|
+
${X(cs(t),s=>s.target?.id??"",s=>this.#y(s))}
|
|
3333
3346
|
</div>
|
|
3334
3347
|
</section>
|
|
3335
|
-
${this.#
|
|
3336
|
-
`}#R(e){const t=this.#d,s=
|
|
3337
|
-
${
|
|
3338
|
-
${X(e.claims,
|
|
3348
|
+
${this.#H()} ${this.#_()}
|
|
3349
|
+
`}#R(e){const t=this.#d,s=Ur(e),r=[{tone:"unsound",label:t.incomplete,count:s.incomplete},{tone:"caveat",label:t.bounded,count:s.bounded},{tone:"caveat",label:t.conditional,count:s.conditional},{tone:"planned",label:t.planned,count:s.planned}].filter(n=>n.count>0);return p`${t.claims(e.claims.length)}
|
|
3350
|
+
${r.map(n=>p`<span class="spec-chip" data-tone=${n.tone}>${n.label} ${n.count}</span>`)}`}#y(e){const t=p`<div class="spec-claims">
|
|
3351
|
+
${X(e.claims,r=>r.id,r=>this.#D(r))}
|
|
3339
3352
|
</div>`,s=e.target;return s===null?t:p`<section class="target-group" data-target=${s.id}>
|
|
3340
3353
|
<header class="target-head">
|
|
3341
3354
|
<span class="target-label">${this.#d.target}</span>
|
|
@@ -3345,37 +3358,37 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
3345
3358
|
</header>
|
|
3346
3359
|
${s.summary===null?k:p`<p class="target-summary">${this.#T(s.summary)}</p>`}
|
|
3347
3360
|
${e.claims.length===0?p`<p class="spec-empty">${this.#d.noClaims}</p>`:t}
|
|
3348
|
-
</section>`}#
|
|
3361
|
+
</section>`}#D(e){const t=this.#d,s=Pe(t,e.assurance),r=this.#u.has(e.id),n=this.#z({kind:"assurance",claim:e.id}),i=hs(e.id);return p`
|
|
3349
3362
|
<article class="claim" data-claim=${e.id} data-tone=${s.tone}>
|
|
3350
3363
|
<div class="claim-head" @click=${o=>this.#q(o,e.id)}>
|
|
3351
3364
|
<button
|
|
3352
3365
|
type="button"
|
|
3353
3366
|
class="claim-toggle"
|
|
3354
|
-
aria-expanded=${
|
|
3355
|
-
aria-controls=${
|
|
3356
|
-
aria-label=${
|
|
3367
|
+
aria-expanded=${r?"true":"false"}
|
|
3368
|
+
aria-controls=${r?i:k}
|
|
3369
|
+
aria-label=${r?t.hideDetails:t.showDetails}
|
|
3357
3370
|
@click=${()=>this.#C(e.id)}
|
|
3358
3371
|
>
|
|
3359
|
-
${
|
|
3372
|
+
${ws()}
|
|
3360
3373
|
</button>
|
|
3361
3374
|
<h4 class="claim-statement">${this.#T(e.statement)}</h4>
|
|
3362
3375
|
<button
|
|
3363
3376
|
type="button"
|
|
3364
3377
|
class="assurance-badge"
|
|
3365
3378
|
data-tone=${s.tone}
|
|
3366
|
-
@pointerenter=${
|
|
3367
|
-
@pointerleave=${
|
|
3368
|
-
@focus=${
|
|
3369
|
-
@blur=${
|
|
3370
|
-
@click=${
|
|
3379
|
+
@pointerenter=${n.enter}
|
|
3380
|
+
@pointerleave=${n.leave}
|
|
3381
|
+
@focus=${n.show}
|
|
3382
|
+
@blur=${n.hide}
|
|
3383
|
+
@click=${n.show}
|
|
3371
3384
|
>
|
|
3372
3385
|
${s.label}
|
|
3373
3386
|
</button>
|
|
3374
|
-
${this.#P({kind:"claim",claim:e.id},
|
|
3387
|
+
${this.#P({kind:"claim",claim:e.id},xe(e))}
|
|
3375
3388
|
</div>
|
|
3376
|
-
${
|
|
3389
|
+
${r?this.#F(e,i):k}
|
|
3377
3390
|
</article>
|
|
3378
|
-
`}#F(e,t){const s=this.#d,
|
|
3391
|
+
`}#F(e,t){const s=this.#d,r=Pe(s,e.assurance);return p`<div class="claim-body" id=${t}>
|
|
3379
3392
|
<dl class="claim-parts">
|
|
3380
3393
|
${e.subjects.length===0?k:this.#O("subjects",s.subjects,e,e.subjects)}
|
|
3381
3394
|
${e.premises.length===0?p`<div class="claim-part" data-part="premises">
|
|
@@ -3384,10 +3397,10 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
3384
3397
|
</div>`:this.#O("premises",s.premises,e,e.premises)}
|
|
3385
3398
|
${this.#O("conclusions",s.conclusions,e,e.conclusions)}
|
|
3386
3399
|
</dl>
|
|
3387
|
-
${
|
|
3388
|
-
<p class="assurance-label">${
|
|
3400
|
+
${r.itemsLabel===null?k:p`<div class="assurance" data-tone=${r.tone}>
|
|
3401
|
+
<p class="assurance-label">${r.itemsLabel}</p>
|
|
3389
3402
|
<ul>
|
|
3390
|
-
${
|
|
3403
|
+
${r.items.map(n=>p`<li>${this.#T(n)}</li>`)}
|
|
3391
3404
|
</ul>
|
|
3392
3405
|
</div>`}
|
|
3393
3406
|
${e.examples.length===0?k:p`<section class="claim-aside" data-part="examples">
|
|
@@ -3399,33 +3412,33 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
3399
3412
|
${this.#I(e,e.notClaimed)}
|
|
3400
3413
|
</section>`}
|
|
3401
3414
|
${this.#U(e)}
|
|
3402
|
-
</div>`}#O(e,t,s,
|
|
3415
|
+
</div>`}#O(e,t,s,r){return p`<div class="claim-part" data-part=${e}>
|
|
3403
3416
|
<dt>${t}</dt>
|
|
3404
|
-
<dd>${this.#I(s,
|
|
3417
|
+
<dd>${this.#I(s,r)}</dd>
|
|
3405
3418
|
</div>`}#I(e,t){return p`<ul class="clauses">
|
|
3406
3419
|
${X(t,s=>s.id,s=>p`<li class="clause" data-clause=${s.id}>
|
|
3407
3420
|
<span class="clause-text">${this.#T(s.text)}</span>
|
|
3408
|
-
${this.#P({kind:"clause",claim:e.id,clause:s.id},`${
|
|
3421
|
+
${this.#P({kind:"clause",claim:e.id,clause:s.id},`${xe(e)} \u203A ${Ie(s.text)}`)}
|
|
3409
3422
|
</li>`)}
|
|
3410
|
-
</ul>`}#U(e){const t=this.#d,s=e.terms.flatMap(
|
|
3411
|
-
${s.length===0?k:p`<span class="claim-foot-label">${t.usesTerms}</span> ${s.map(
|
|
3423
|
+
</ul>`}#U(e){const t=this.#d,s=e.terms.flatMap(r=>this.#a.get(r)??[]);return s.length===0&&e.source===null?k:p`<footer class="claim-foot">
|
|
3424
|
+
${s.length===0?k:p`<span class="claim-foot-label">${t.usesTerms}</span> ${s.map(r=>this.#j("term-chip",r.id,r.name))}`}
|
|
3412
3425
|
${e.source===null?k:p`<span class="claim-source"
|
|
3413
3426
|
>${t.source}: ${e.source.tool===null?k:p`${e.source.tool} · `}<code
|
|
3414
3427
|
>${e.source.ref}</code
|
|
3415
3428
|
></span
|
|
3416
3429
|
>`}
|
|
3417
|
-
</footer>`}#T(e){return p`${e.map(t=>t.kind==="text"?t.text:this.#j("term",t.id,t.label))}`}#
|
|
3430
|
+
</footer>`}#T(e){return p`${e.map(t=>t.kind==="text"?t.text:this.#j("term",t.id,t.label))}`}#N(e){return p`${e.map(t=>t.kind==="text"?t.text:p`<span class="term-static">${t.label}</span>`)}`}#j(e,t,s){const r=this.#z({kind:"term",term:t});return p`<button
|
|
3418
3431
|
type="button"
|
|
3419
3432
|
class=${e}
|
|
3420
3433
|
data-term=${t}
|
|
3421
|
-
@pointerenter=${
|
|
3422
|
-
@pointerleave=${
|
|
3423
|
-
@focus=${
|
|
3424
|
-
@blur=${
|
|
3425
|
-
@click=${
|
|
3434
|
+
@pointerenter=${r.enter}
|
|
3435
|
+
@pointerleave=${r.leave}
|
|
3436
|
+
@focus=${r.show}
|
|
3437
|
+
@blur=${r.hide}
|
|
3438
|
+
@click=${r.show}
|
|
3426
3439
|
>
|
|
3427
3440
|
${s}
|
|
3428
|
-
</button>`}#
|
|
3441
|
+
</button>`}#H(){const e=this.#l?.tip;if(e===void 0)return k;const t=this.#B(e);return t===null?k:p`<div
|
|
3429
3442
|
id="spec-tip"
|
|
3430
3443
|
class="spec-tip"
|
|
3431
3444
|
role="tooltip"
|
|
@@ -3434,15 +3447,15 @@ import{_ as N,Z as je,k as Fe,$ as Ue,a0 as B,a1 as k,a2 as p,a3 as X,a4 as P,a5
|
|
|
3434
3447
|
>
|
|
3435
3448
|
<p class="tip-title">${t.title}</p>
|
|
3436
3449
|
<p class="tip-body">${t.body}</p>
|
|
3437
|
-
</div>`}#B(e){if(e.kind==="term"){const
|
|
3450
|
+
</div>`}#B(e){if(e.kind==="term"){const r=this.#a.get(e.term);return r===void 0?null:{title:r.name,body:this.#N(r.meaning)}}const t=this.#e?.claims.find(r=>r.id===e.claim);if(t===void 0)return null;const s=Pe(this.#d,t.assurance);return{title:s.label,body:s.detail,tone:s.tone}}#P(e,t){if(!this.id)return k;const s=this.#k(e),r=this.#d.commentOn(t);return p`<button
|
|
3438
3451
|
type="button"
|
|
3439
3452
|
class="comment-trigger"
|
|
3440
3453
|
data-comment-ref=${s}
|
|
3441
|
-
aria-label=${
|
|
3442
|
-
title=${
|
|
3454
|
+
aria-label=${r}
|
|
3455
|
+
title=${r}
|
|
3443
3456
|
aria-haspopup="dialog"
|
|
3444
|
-
aria-expanded=${this.#
|
|
3445
|
-
@click=${()=>{this.#
|
|
3457
|
+
aria-expanded=${this.#n===s?"true":"false"}
|
|
3458
|
+
@click=${()=>{this.#n=this.#n===s?null:s,this.requestUpdate()}}
|
|
3446
3459
|
>
|
|
3447
3460
|
${Be()}
|
|
3448
|
-
</button>`}#_(){const e=this.#
|
|
3461
|
+
</button>`}#_(){const e=this.#n,t=e===null?void 0:this.commentTargets.find(r=>r.value===e)?.label;if(e===null||t===void 0)return k;const s=Ke(this.#o.get(e)??"",[],{label:t,...this.#c===e?{error:this.#d.sendFailed}:{}});return p`${We(e,Xe(Je(this.#f.locale),s,r=>this.#A(e,r)))}`}}const ms=()=>{customElements.get("dpk-component-formal-spec")||customElements.define("dpk-component-formal-spec",us)},gs=()=>{ft(),St(),qt(),Pt(),Nt(),es(),os()},Vr=()=>{$s(),Ss(),gs(),ms()};export{Ut as D,Ct as a,It as b,us as c,is as d,Qt as e,$t as f,gt as g,Nt as h,qt as i,Pt as j,ms as k,os as l,es as m,St as n,ft as o,ds as p,ts as q,Vr as r,Kt as s,xt as t,mt as u,gs as v};
|