dev-process-kit 0.0.10 → 0.0.12
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/THIRD_PARTY_LICENSES.md +46 -0
- package/dist/chunks/{shared-BQFDKhM1.js → shared-BC5MlWBY.js} +155 -348
- package/dist/chunks/{shared-CDUEK_Mh.js → shared-BvuW5NtY.js} +8 -8
- package/dist/chunks/{shared-DkFF4haI.js → shared-BwaDMwUS.js} +8 -8
- package/dist/chunks/{shared-CmNWTIOz.js → shared-CLnfjHCQ.js} +1 -1
- package/dist/chunks/{shared-COrrbgIn.js → shared-C__W71Hw.js} +1 -1
- package/dist/chunks/shared-CcrRNZCH.js +30 -0
- package/dist/chunks/shared-CoDXb-Yj.js +556 -0
- package/dist/chunks/shared-D7CMQLaX.js +2323 -0
- package/dist/chunks/{shared-CQXKAPdi.js → shared-DBJaP5gF.js} +65 -48
- package/dist/chunks/shared-DUq2-pM9.js +2023 -0
- package/dist/chunks/{shared-CNbKTeSv.js → shared-DYe0OZr-.js} +4 -4
- package/dist/chunks/shared-DhwK_dh_.js +1093 -0
- package/dist/chunks/{shared-BdUyaZo-.js → shared-DkkBQzIf.js} +14 -14
- package/dist/chunks/shared-aDPp8Vry.js +1 -0
- package/dist/chunks/{shared-qb0tjbw2.js → shared-y3FwoRgh.js} +8 -8
- 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/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-Bd9pmv5a.js +0 -30
- package/dist/chunks/shared-C2ytkQtn.js +0 -1094
- package/dist/chunks/shared-Dmq-C6h3.js +0 -2239
- package/dist/chunks/shared-Ds5vLeFk.js +0 -556
- package/dist/chunks/shared-FtbePk3S.js +0 -1252
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,a7 as Ye,a8 as Ve,A as We,a9 as Es,aa as qs,ab as G,ac as q,ad as f,ae as z,af as u,ag as H,ah as S,ai as M,aj as ae,ak as Ke,al as Xe,am as Z,an as we,ao as zs,ap as $e,aq as Se,ar as Ds,as as Me,l as Je,at as Ts,au as As,av as Ls,aw as ne,ax as Rs,q as Os,r as Is}from"./shared-BQFDKhM1.js";import{i as Ze}from"./shared-COrrbgIn.js";import{P as Qe,p as et,r as tt,c as st}from"./shared-Bd9pmv5a.js";import{c as me}from"./shared-ml5h7U5L.js";const Ps='script[type="application/json"]',at=(a,e)=>{const t=a.querySelector(Ps);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)}}},nt=(a,e,t)=>{const s=at(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=at(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},rt={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},js=(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))}},Fs=(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},Ns=(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((p,k)=>[p,k])),c=p=>{const k=l.get(p);return k===void 0?null:k},m=d.map(p=>{const k=(e.get(p)??[]).filter(x=>(t.get(x)??o)===o+(i?-1:1)).map(c).filter(x=>x!==null);return{id:p,want:k.length>0?ge(k):l.get(p)??0}});m.sort((p,k)=>p.want-k.want||(l.get(p.id)??0)-(l.get(k.id)??0)),a.set(o,m.map(p=>p.id))}}},it=(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)}},Us=(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,it(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 m of a.get(l)??[]){const p=e.get(m);p&&(p.y+=c)}}const d=(l,c)=>{const m=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const k=e.get(p);return k?[k.y+k.spec.height/2]:[]});return m.length>0?ge(m):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const m of c?r:[...r].reverse()){const p=a.get(m)??[],k=new Map;for(const w of p){const D=d(w,m+(c?-1:1)),I=e.get(w);I!==void 0&&k.set(w,D===null?I.y+I.spec.height/2:D)}const x=p.map(w=>e.get(w)?.y??0);it(p,e,k,n.nodeSpacing);const v=p.map(w=>e.get(w)?.y??0),y=ge(x)-ge(v);for(const w of p){const D=e.get(w);D&&(D.y+=y)}}}},ot=(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}},dt=(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=ot(i,r.fromPort,"out"),l=ot(o,r.toPort,"in");if(r.from===r.to){const x=i.x+i.spec.width,v=i.y+i.spec.height,y=Math.max(t.padding/2,v+18);n.push({id:r.id,points:[d,{x:x+20,y:d.y},{x:x+20,y},{x:i.x-20,y},{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 v=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:v,y:d.y},{x:v,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,m=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,m.y)+18+s*14;s+=1;const k=[d,c,{x:c.x,y:p},{x:m.x,y:p},m,l].filter((x,v,y)=>v===0||x.x!==y[v-1]?.x||x.y!==y[v-1]?.y);n.push({id:r.id,points:k})}return n},lt=(a,e,t)=>{const s=e.flatMap(p=>[...p.points]),n=[...a.map(p=>p.x),...a.map(p=>p.x+p.spec.width),...s.map(p=>p.x)],r=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,m=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+m,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(k=>({x:k.x+c,y:k.y+m}))}))}},ct=(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},pt=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Hs=(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},_s=(a,e,t={})=>{const s={...rt,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(v=>v.id)),r=e.filter(v=>n.has(v.from)&&n.has(v.to)),{forward:i,reversed:o}=js(a,r),d=Fs(a,i),l=Hs(a,d);Ns(l,ct(a,r),d,s.sweeps);const c=new Map;for(const v of l.values())v.forEach((y,w)=>c.set(y,w));const m=pt(a,d,c,()=>({x:0,y:0})),p=new Map(m.map(v=>[v.spec.id,v]));Us(l,p,ct(a,r),d,s);const k=[...l.keys()].sort((v,y)=>v-y);let x=0;for(const v of k){const y=Math.max(...(l.get(v)??[]).map(w=>p.get(w)?.spec.width??0));for(const w of l.get(v)??[]){const D=p.get(w);D&&(D.x=x)}x+=y+s.layerSpacing}return lt(m,dt(r,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Bs=(a,e,t={})=>{const s={...rt,...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=pt(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return lt(i,dt(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Gs=_({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`}}),Ys={active:[],match:"single"},Q=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Vs=(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]},Ws=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Ks=a=>({...a,active:[]}),Xs=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}))},Y={nodes:new Map,edges:new Set},N=(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,m=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(m)&&(o.add(m),n.set(m,d.depth+1),i.push({id:m,depth:d.depth+1})))}return{nodes:n,edges:r}},Js=(a,e)=>{const t=new Map(a.map(r=>[r,N(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]))),ht=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),ut=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},mt=(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}},ee=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Zs=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}},Qs=(a,e)=>Xs(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),ea=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[_e,Be,Ge,B`
|
|
1
|
+
import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as qs,J as zs,a7 as O,a8 as Ye,a9 as Ve,A as We,aa as Ds,ab as Ts,ac as G,ad as q,ae as f,af as z,ag as u,ah as H,ai as S,aj as M,ak as ae,al as Ke,am as Xe,an as Z,ao as we,ap as Je,aq as As,ar as Ls,as as $e,at as Se,au as Rs,av as Me,l as Ze,aw as Os,ax as Is,ay as Ps,az as ne,q as js,r as Fs}from"./shared-BC5MlWBY.js";import{i as Qe}from"./shared-C__W71Hw.js";import{P as et}from"./shared-aDPp8Vry.js";import{p as tt,r as st,c as at}from"./shared-CcrRNZCH.js";import{c as me}from"./shared-ml5h7U5L.js";const Ns='script[type="application/json"]',nt=(a,e)=>{const t=a.querySelector(Ns);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)}}},rt=(a,e,t)=>{const s=nt(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=nt(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},it={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},Us=(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))}},Hs=(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},_s=(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((p,k)=>[p,k])),c=p=>{const k=l.get(p);return k===void 0?null:k},m=d.map(p=>{const k=(e.get(p)??[]).filter(x=>(t.get(x)??o)===o+(i?-1:1)).map(c).filter(x=>x!==null);return{id:p,want:k.length>0?ge(k):l.get(p)??0}});m.sort((p,k)=>p.want-k.want||(l.get(p.id)??0)-(l.get(k.id)??0)),a.set(o,m.map(p=>p.id))}}},ot=(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)}},Bs=(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,ot(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 m of a.get(l)??[]){const p=e.get(m);p&&(p.y+=c)}}const d=(l,c)=>{const m=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const k=e.get(p);return k?[k.y+k.spec.height/2]:[]});return m.length>0?ge(m):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const m of c?r:[...r].reverse()){const p=a.get(m)??[],k=new Map;for(const w of p){const D=d(w,m+(c?-1:1)),I=e.get(w);I!==void 0&&k.set(w,D===null?I.y+I.spec.height/2:D)}const x=p.map(w=>e.get(w)?.y??0);ot(p,e,k,n.nodeSpacing);const v=p.map(w=>e.get(w)?.y??0),y=ge(x)-ge(v);for(const w of p){const D=e.get(w);D&&(D.y+=y)}}}},dt=(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}},lt=(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=dt(i,r.fromPort,"out"),l=dt(o,r.toPort,"in");if(r.from===r.to){const x=i.x+i.spec.width,v=i.y+i.spec.height,y=Math.max(t.padding/2,v+18);n.push({id:r.id,points:[d,{x:x+20,y:d.y},{x:x+20,y},{x:i.x-20,y},{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 v=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:v,y:d.y},{x:v,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,m=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,m.y)+18+s*14;s+=1;const k=[d,c,{x:c.x,y:p},{x:m.x,y:p},m,l].filter((x,v,y)=>v===0||x.x!==y[v-1]?.x||x.y!==y[v-1]?.y);n.push({id:r.id,points:k})}return n},ct=(a,e,t)=>{const s=e.flatMap(p=>[...p.points]),n=[...a.map(p=>p.x),...a.map(p=>p.x+p.spec.width),...s.map(p=>p.x)],r=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,m=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+m,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(k=>({x:k.x+c,y:k.y+m}))}))}},pt=(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},ht=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Gs=(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},Ys=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(v=>v.id)),r=e.filter(v=>n.has(v.from)&&n.has(v.to)),{forward:i,reversed:o}=Us(a,r),d=Hs(a,i),l=Gs(a,d);_s(l,pt(a,r),d,s.sweeps);const c=new Map;for(const v of l.values())v.forEach((y,w)=>c.set(y,w));const m=ht(a,d,c,()=>({x:0,y:0})),p=new Map(m.map(v=>[v.spec.id,v]));Bs(l,p,pt(a,r),d,s);const k=[...l.keys()].sort((v,y)=>v-y);let x=0;for(const v of k){const y=Math.max(...(l.get(v)??[]).map(w=>p.get(w)?.spec.width??0));for(const w of l.get(v)??[]){const D=p.get(w);D&&(D.x=x)}x+=y+s.layerSpacing}return ct(m,lt(r,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Vs=(a,e,t={})=>{const s={...it,...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=ht(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return ct(i,lt(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ws=_({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`}}),Ks={active:[],match:"single"},Q=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Xs=(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]},Js=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Zs=a=>({...a,active:[]}),Qs=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}))},Y={nodes:new Map,edges:new Set},N=(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,m=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(m)&&(o.add(m),n.set(m,d.depth+1),i.push({id:m,depth:d.depth+1})))}return{nodes:n,edges:r}},ea=(a,e)=>{const t=new Map(a.map(r=>[r,N(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]))),ut=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),mt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},gt=(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}},ee=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),ta=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}},sa=(a,e)=>Qs(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),aa=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[_e,Be,Ge,B`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
container-type: inline-size;
|
|
@@ -244,6 +244,9 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
.diagram-zoom button {
|
|
247
|
+
display: inline-flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: center;
|
|
247
250
|
border: 0;
|
|
248
251
|
border-radius: 0;
|
|
249
252
|
padding: 6px 9px;
|
|
@@ -256,6 +259,11 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
256
259
|
color 140ms var(--dpk-ease);
|
|
257
260
|
}
|
|
258
261
|
|
|
262
|
+
.diagram-zoom button svg {
|
|
263
|
+
width: 12px;
|
|
264
|
+
height: 12px;
|
|
265
|
+
}
|
|
266
|
+
|
|
259
267
|
.diagram-zoom button + button {
|
|
260
268
|
border-left: 1px solid var(--dpk-rule);
|
|
261
269
|
}
|
|
@@ -489,7 +497,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
489
497
|
display: none;
|
|
490
498
|
}
|
|
491
499
|
}
|
|
492
|
-
`],re=a=>a.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),
|
|
500
|
+
`],re=a=>a.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),ft=a=>O`
|
|
493
501
|
<defs>
|
|
494
502
|
${a.map(e=>O`
|
|
495
503
|
<marker
|
|
@@ -511,7 +519,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
511
519
|
</marker>
|
|
512
520
|
`)}
|
|
513
521
|
</defs>
|
|
514
|
-
`,
|
|
522
|
+
`,na=(a,e,t,s)=>h`
|
|
515
523
|
<div class="diagram-tags" role="group" aria-label=${a.tagFilter}>
|
|
516
524
|
<div class="diagram-match" role="group" aria-label=${a.tagMatch}>
|
|
517
525
|
${[["single","Single"],["all","AND"],["any","OR"]].map(([n,r])=>h`
|
|
@@ -540,14 +548,14 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
540
548
|
${a.clearTags}
|
|
541
549
|
</button>`:b}
|
|
542
550
|
</div>
|
|
543
|
-
`,
|
|
551
|
+
`,ra=(a,e)=>h`
|
|
544
552
|
<div class="diagram-zoom">
|
|
545
553
|
<button
|
|
546
554
|
type="button"
|
|
547
555
|
aria-label=${a.zoomOut}
|
|
548
556
|
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1/1.1})}}
|
|
549
557
|
>
|
|
550
|
-
|
|
558
|
+
${qs()}
|
|
551
559
|
</button>
|
|
552
560
|
<button
|
|
553
561
|
type="button"
|
|
@@ -563,10 +571,10 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
563
571
|
aria-label=${a.zoomIn}
|
|
564
572
|
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1.1})}}
|
|
565
573
|
>
|
|
566
|
-
|
|
574
|
+
${zs()}
|
|
567
575
|
</button>
|
|
568
576
|
</div>
|
|
569
|
-
`,Ee=.08,
|
|
577
|
+
`,Ee=.08,ia=1.8,oa=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(r=>r.x)),t=Math.min(...a.map(r=>r.y)),s=Math.max(...a.map(r=>r.x+r.width))-e,n=Math.max(...a.map(r=>r.y+r.height))-t;return{x:e-s*.1,y:t-n*.1,width:s*1.2,height:n*1.2}},qe=(a,e)=>a+e/12,ze=16,bt=(a,e,t,s,n="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const r=(i,o,d,l)=>{const c=d*a.scale;return c<=l?n==="start"?ze-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:r(a.x,e.x,e.width,t),y:r(a.y,e.y,e.height,s)}},da=(a,e,t,s,n,r,i="center")=>{const o=bt({...a,x:a.x-n,y:a.y-r},e,t,s,i);return Math.abs(r)>Math.abs(n)&&o.y===a.y?null:o},kt='button,[role="button"],a,input,textarea,select',la=a=>{const{canvas:e,world:t,onClearSelection:s,onView:n,align:r="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:C}=d();o=bt(o,i,g,C,r),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,n?.(o)},c=()=>{const{width:g,height:C}=d(),E=i.width/1.2||1,R=i.height/1.2||1;o={...o,scale:me(Math.min((g-24)/E,(C-40)/R),Ee,1)},o={...o,x:(g-i.width*o.scale)/2-i.x*o.scale,y:(C-i.height*o.scale)/2-i.y*o.scale},l()},m=()=>{const{width:g}=d(),C=i.width/1.2||1,E=me((g-24)/C,Ee,1);o={scale:E,x:(g-i.width*E)/2-i.x*E,y:16},l()},p=()=>{o={scale:1,x:ze-qe(i.x,i.width),y:ze-qe(i.y,i.height)},l()},k=(g,C=d().width/2,E=d().height/2)=>{const R=o.scale,P=me(R*g,Ee,ia);P!==R&&(o={scale:P,x:C-(C-o.x)*P/R,y:E-(E-o.y)*P/R},l())},x=g=>{if(g.target instanceof Element&&g.target.closest(".diagram-zoom"))return;const C=g.deltaMode===1?16:g.deltaMode===2?d().height:1;if(g.ctrlKey||g.metaKey){g.preventDefault();const X=e.getBoundingClientRect();k(Math.exp(-me(g.deltaY*C,-60,60)*.0012),g.clientX-X.left,g.clientY-X.top);return}const{width:E,height:R}=d(),P=da(o,i,E,R,g.deltaX*C,g.deltaY*C,r);P!==null&&(g.preventDefault(),o=P,l())},v=new Map;let y=null,w=!1;const D=()=>{const g=[...v.values()],C=g[0];if(!C)return null;const E=g[1];return E?{x:(C.x+E.x)/2,y:(C.y+E.y)/2,distance:Math.hypot(E.x-C.x,E.y-C.y)}:{...C,distance:0}},I=g=>{v.size===0&&(w=!1);const E=(g.target instanceof Element?g.target:null)?.closest(kt)??null;g.button!==0||g.pointerType!=="touch"&&E!==null||(v.set(g.pointerId,{x:g.clientX,y:g.clientY}),y=D(),E===null&&e.setPointerCapture(g.pointerId),g.pointerType!=="touch"&&E===null&&(g.preventDefault(),e.focus({preventScroll:!0})))},T=g=>{if(!v.has(g.pointerId)||y===null)return;v.set(g.pointerId,{x:g.clientX,y:g.clientY});const C=D();if(C===null)return;const E=C.x-y.x,R=C.y-y.y;if((Math.abs(E)+Math.abs(R)>1||Math.abs(C.distance-y.distance)>1)&&(w=!0),C.distance>0&&y.distance>0){const P=e.getBoundingClientRect();k(Math.pow(C.distance/y.distance,.45),y.x-P.left,y.y-P.top)}o={...o,x:o.x+E,y:o.y+R},l(),y=C,e.classList.toggle("is-panning",w)},j=g=>{v.delete(g.pointerId),y=D(),!(v.size>0)&&(e.classList.remove("is-panning"),g.type==="pointercancel"&&(w=!1))},V=g=>{w&&(g.preventDefault(),g.stopPropagation()),j(g)},$=g=>{if(w){g.preventDefault(),g.stopPropagation(),w=!1;return}const C=g.target instanceof Element?g.target:null;C===null||C.closest(kt)!==null||s()},A=g=>{if(g.target!==e)return;const C=30;if(g.key==="+"||g.key==="=")k(1.1);else if(g.key==="-")k(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"?C:g.key==="ArrowRight"?-C:0),y:o.y+(g.key==="ArrowUp"?C:g.key==="ArrowDown"?-C:0)},l();else return;g.preventDefault()},L=g=>{const C=g.target instanceof HTMLElement?g.target:null;if(C===null||!t.contains(C))return;const E=C.getBoundingClientRect(),R=e.getBoundingClientRect();let P=0,X=0;E.left<R.left+12?P=R.left+12-E.left:E.right>R.right-12&&(P=R.right-12-E.right),E.top<R.top+12?X=R.top+12-E.top:E.bottom>R.bottom-40&&(X=R.bottom-40-E.bottom),!(P===0&&X===0)&&(o={...o,x:o.x+P,y:o.y+X},l())};e.addEventListener("wheel",x,{passive:!1}),e.addEventListener("pointerdown",I),e.addEventListener("pointermove",T),e.addEventListener("pointerup",V),e.addEventListener("pointercancel",j),e.addEventListener("lostpointercapture",j),e.addEventListener("click",$,!0),e.addEventListener("keydown",A),e.addEventListener("focusin",L);const U=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return U?.observe(e),{setContent(g){i=oa(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:m,reset:p,zoom:k,view:()=>({...o}),destroy(){U?.disconnect(),e.removeEventListener("wheel",x),e.removeEventListener("pointerdown",I),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",V),e.removeEventListener("pointercancel",j),e.removeEventListener("lostpointercapture",j),e.removeEventListener("click",$,!0),e.removeEventListener("keydown",A),e.removeEventListener("focusin",L)}}};class De extends Ye{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=[];#n=null;#r=Ks;#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 et(this);#v=new Ve(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=rt(this,e=>this.parseData(e),e=>{e.ok?this.#x(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.#x(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??=la({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#y(null),onView:r=>{this.#c&&(this.#c.textContent=`${Math.round(r.scale*100)}%`),this.dispatchEvent(new CustomEvent("dpk-diagram-view",{detail:{view:r},bubbles:!0,composed:!0})),this.onViewChange(r)}});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 n=this.layoutVersion();n!==this.#l&&(this.#l=n,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.#n!==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(n=>n.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 n=new CustomEvent("dpk-element-action",{detail:{type:e,target:this.commentRef(...t),payload:s},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n),n.defaultPrevented}get selection(){return this.#i}select(e){this.#y(e)}get tagFilter(){return this.#r}set tagFilter(e){this.#r=e,this.requestUpdate()}get dataError(){return this.#n}resetView(){this.fitViewport()}#E(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};#q={handleEvent:e=>{e.key!=="Escape"||this.#i!==null||(e.preventDefault(),this.#E(!1))},capture:!0};get locale(){return this.#v.locale}get chromeMessages(){return Ws(this.#v.locale)}renderSelection(){const e=this.#h,t=e===null?void 0:this.#g.get(e);if(e===null||t===void 0)return b;const s=tt(this.#d.get(e)??"",[],{label:t,key:e,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return h`${Qe(e,st(at(this.#v.locale),s,n=>this.#z(e,n)))}`}renderCommentTrigger(e,t,s){if(!this.id)return b;const n=this.commentRef(e.kind,e.id);return this.#g.set(n,t),h`<button
|
|
570
578
|
type="button"
|
|
571
579
|
class=${ee("diagram-comment-trigger",s&&"is-placed")}
|
|
572
580
|
style=${s?`left:${s.x}px; top:${s.y}px`:b}
|
|
@@ -585,7 +593,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
585
593
|
y=${(r.y+i.y)/2-16}
|
|
586
594
|
width="32"
|
|
587
595
|
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===""?b: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 b}renderLegend(){return b}renderAboveCanvas(){return b}get viewport(){return this.#o}items(){return this.#a??this.emptyData()}authoredItems(){return this.#e??this.emptyData()}elementClass(e,...t){return ee(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#x(e){this.#n=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 r=new Map(this.#d);r.delete(e),this.#d=r}this.#m=null;const s=this.#S();this.#y(null),s?.focus({preventScroll:!0})}#R(e){this.#n=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.#r=
|
|
596
|
+
>${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===""?b: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 b}renderLegend(){return b}renderAboveCanvas(){return b}get viewport(){return this.#o}items(){return this.#a??this.emptyData()}authoredItems(){return this.#e??this.emptyData()}elementClass(e,...t){return ee(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#x(e){this.#n=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 r=new Map(this.#d);r.delete(e),this.#d=r}this.#m=null;const s=this.#S();this.#y(null),s?.focus({preventScroll:!0})}#R(e){this.#n=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.#r=Xs(this.#r,e.tag),this.requestUpdate();return;case"match":this.#r=Js(this.#r,e.match),this.requestUpdate();return;case"clear-tags":this.#r=Zs(this.#r),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=sa(this.tagItems(),this.#r),t=this.#b,s=this.chromeMessages,n=t===null?s.maximize:s.restore;return h`
|
|
589
597
|
${t===null?b:h`<div class="diagram-placeholder" style="height:${t.height}px"></div>`}
|
|
590
598
|
<div
|
|
591
599
|
class=${ee("diagram",this.shellClass(),t!==null&&"is-maximized")}
|
|
@@ -607,22 +615,22 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
607
615
|
aria-pressed=${t===null?"false":"true"}
|
|
608
616
|
@click=${()=>this.#E(t===null)}
|
|
609
617
|
>
|
|
610
|
-
${t===null?
|
|
618
|
+
${t===null?Ds():Ts()}
|
|
611
619
|
</button>
|
|
612
620
|
</div>
|
|
613
621
|
</div>
|
|
614
|
-
${
|
|
622
|
+
${na(s,e,this.#r.match,this.#D)} ${this.renderAboveCanvas()}
|
|
615
623
|
<div class="diagram-canvas" tabindex="0" aria-label=${s.canvas}>
|
|
616
624
|
<div class="diagram-world">${this.renderCanvas()}</div>
|
|
617
625
|
${this.isEmpty()?h`<p class="diagram-empty">${this.emptyMessage()}</p>`:b}
|
|
618
626
|
${this.#n===null?b:h`<p class="diagram-notice" role="alert">${s.dataError}<br />${this.#n}</p>`}
|
|
619
|
-
${this.renderLegend()} ${
|
|
627
|
+
${this.renderLegend()} ${ra(s,this.#D)}
|
|
620
628
|
</div>
|
|
621
629
|
${this.renderSelection()}
|
|
622
630
|
</div>
|
|
623
|
-
`}}class ie extends De{#e=null;#a="";#s=0;#t=Y;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
|
|
624
|
-
${
|
|
625
|
-
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const n=e.edges.filter(i=>Q(i.tags,this.tagFilter)&&this.matchesFilter(i)),r=new Set(n.flatMap(i=>[i.from,i.to]));return{...e,edges:n,nodes:e.nodes.filter(i=>r.has(i.id))}}const t=e.nodes.filter(n=>Q(n.tags,this.tagFilter)&&this.matchesFilter(n)),s=new Set(t.map(n=>n.id));return{...e,nodes:t,edges:e.edges.filter(n=>s.has(n.from)&&s.has(n.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(r=>({id:r.id,width:r.width,height:r.height,...r.ports===void 0?{}:{ports:r.ports},...r.position===void 0?{}:{position:r.position}})),s=e.edges.map(r=>({id:r.id,from:r.from,to:r.to,...r.fromPort===void 0?{}:{fromPort:r.fromPort},...r.toPort===void 0?{}:{toPort:r.toPort}})),n=this.layoutOptions();return this.layoutMode==="fixed"?
|
|
631
|
+
`}}class ie extends De{#e=null;#a="";#s=0;#t=Y;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 aa(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 gt(e,this.selection,"node",this.#t)}edgeState(e){return gt(e,this.selection,"edge",this.#t)}renderEdges(e,t){const s=this.#e?.width??0,n=this.#e?.height??0;return h`<svg class="diagram-edges" width=${s} height=${n}>
|
|
632
|
+
${ft(t)}${e}
|
|
633
|
+
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const n=e.edges.filter(i=>Q(i.tags,this.tagFilter)&&this.matchesFilter(i)),r=new Set(n.flatMap(i=>[i.from,i.to]));return{...e,edges:n,nodes:e.nodes.filter(i=>r.has(i.id))}}const t=e.nodes.filter(n=>Q(n.tags,this.tagFilter)&&this.matchesFilter(n)),s=new Set(t.map(n=>n.id));return{...e,nodes:t,edges:e.edges.filter(n=>s.has(n.from)&&s.has(n.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(r=>({id:r.id,width:r.width,height:r.height,...r.ports===void 0?{}:{ports:r.ports},...r.position===void 0?{}:{position:r.position}})),s=e.edges.map(r=>({id:r.id,from:r.from,to:r.to,...r.fromPort===void 0?{}:{fromPort:r.fromPort},...r.toPort===void 0?{}:{toPort:r.toPort}})),n=this.layoutOptions();return this.layoutMode==="fixed"?Vs(t,s,n):Ys(t,s,n)}}const fe=_({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}`}}),ca=q({x:ae(),y:ae()}),pa=q({id:S(u(),M(1)),name:S(u(),M(1)),code:f(u()),kind:f(H(["normal","initial","terminal","compensation"]),"normal"),description:f(u()),position:f(ca),questions:f(u())}),ha=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),kind:f(H(["normal","exception"]),"normal"),tags:f(z(u()),[]),guard:f(u()),effect:f(u()),questions:f(u())}),xt={width:178,height:86},ua=()=>({nodes:[],edges:[]}),ma=q({states:z(pa),transitions:f(z(ha),[])}),vt=a=>{const e=G(ma,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,n=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:xt.width,height:xt.height,tags:[],...i.position===void 0?{}:{position:i.position},...i.questions===void 0?{}:{questions:i.questions}})),edges:n}},ga=a=>a.length>0&&a.every(e=>e.position!==void 0),fa=B`
|
|
626
634
|
.state-node {
|
|
627
635
|
display: flex;
|
|
628
636
|
flex-direction: column;
|
|
@@ -780,8 +788,8 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
780
788
|
fill: var(--dpk-amber);
|
|
781
789
|
stroke: var(--dpk-amber);
|
|
782
790
|
}
|
|
783
|
-
`,
|
|
784
|
-
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],
|
|
791
|
+
`,ba=[{id:"state-arrow"},{id:"state-arrow-active"},{id:"state-arrow-exception"}];class yt extends ie{static{this.styles=[W,fa]}parseData(e){return vt(e)}emptyData(){return ua()}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 ga(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 Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderCanvas(){const e=this.visible.nodes,t=e.filter(s=>s.kind==="initial").map(s=>this.#s(s));return h`
|
|
792
|
+
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],ba)}
|
|
785
793
|
${e.map(s=>this.#n(s))} ${this.visible.edges.map(s=>this.#r(s))}
|
|
786
794
|
`}#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
795
|
`)||e.title}#s(e){const t=this.placedNode(e.id);if(!t)return b;const s=t.y+t.height/2,n=this.nodeState(e.id);return O`
|
|
@@ -824,7 +832,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
824
832
|
${e.code===null?b:h`<span class="state-code">${e.code}</span>`}
|
|
825
833
|
</button>
|
|
826
834
|
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:t.x+e.width-20,y:t.y-14})}
|
|
827
|
-
`}#r(e){const t=this.edgeState(e.id),s=
|
|
835
|
+
`}#r(e){const t=this.edgeState(e.id),s=ta(this.routeOf(e.id));return h`
|
|
828
836
|
<span class="state-label-slot" style="left:${s.x}px; top:${s.y}px">
|
|
829
837
|
<button
|
|
830
838
|
type="button"
|
|
@@ -838,7 +846,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
838
846
|
</button>
|
|
839
847
|
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#e(e.from)} \u2192 ${this.#e(e.to)} \xB7 ${e.title}`)}
|
|
840
848
|
</span>
|
|
841
|
-
`}}const
|
|
849
|
+
`}}const wt=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",yt)},$t=(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],oe=_({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>$t(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=>$t(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`}}),ka=q({kind:Z("message"),id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),style:f(H(["request","response","async"]),"request"),tags:f(z(u()),[]),guard:f(u()),detail:f(u()),questions:f(u())}),xa=q({label:S(u(),M(1)),items:z(Xe())}),va=q({kind:Z("fragment"),id:S(u(),M(1)),operator:H(["alt","opt","loop","par"]),title:S(u(),M(1)),collapsed:f(we(),!1),branches:S(z(xa),M(1))}),ya=Ke("kind",[ka,va]),wa=q({id:S(u(),M(1)),name:S(u(),M(1)),role:f(u()),symbol:f(u()),kind:f(H(["internal","external"]),"internal"),description:f(u()),questions:f(u())}),$a=q({participants:S(z(wa),M(1)),items:f(z(Xe()),[])}),St=240,Te=(a,e,t)=>{if(a.has(e))throw new Error(`duplicate ${t} id: ${e}`);a.add(e)},Mt=(a,e,t)=>a.map(s=>{const n=G(ya,s);if(n.kind==="message"){if(Te(t,n.id,"message"),!e.has(n.from))throw new Error(`unknown sender: ${n.from}`);if(!e.has(n.to))throw new Error(`unknown receiver: ${n.to}`);return{kind:"message",id:n.id,from:n.from,to:n.to,title:n.title,style:n.style,tags:n.tags,guard:n.guard??null,detail:n.detail??null,questions:n.questions??null}}return Te(t,n.id,"fragment"),{kind:"fragment",id:n.id,operator:n.operator,title:n.title,collapsed:n.collapsed,branches:n.branches.map(i=>({label:i.label,items:Mt(i.items,e,t)}))}}),Ct=a=>{const e=G($a,a),t=new Set;for(const s of e.participants)Te(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:Mt(e.items,t,new Set)}},Sa=()=>({participants:[],items:[]}),Et=(a,e)=>{for(const t of a)if(t.kind==="message")e.push(t);else for(const s of t.branches)Et(s.items,e)},K=a=>{const e=[];return Et(a,e),e},Ma=a=>new Map(K(a.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),Ca=a=>K(a).length,qt=(a,e)=>{const t=[];for(const s of a){if(s.kind==="message"){e(s)&&t.push(s);continue}const n=s.branches.map(r=>({label:r.label,items:qt(r.items,e)})).filter(r=>r.items.length>0);n.length>0&&t.push({...s,branches:n})}return t},Ea=64,qa=86,za=31,Da=32,Ta=40,Aa=(a,e)=>{const t=qt(a.items,e),s=new Set;for(const x of K(t))s.add(x.from),s.add(x.to);const n=a.participants.filter(x=>s.has(x.id)),r=new Map(n.map((x,v)=>[x.id,120+v*St])),i=Math.max(360,n.length*St),o=[],d=[],l=[],c=[],m=[];let p=25;const k=(x,v)=>{for(const y of x){if(y.kind==="message"){o.push({message:y,y:p+29,depth:v}),p+=y.from===y.to?qa:Ea;continue}const w=22+v*13,D=p,I=i-44-v*26;p+=za,y.collapsed?(m.push({fragment:y,x:w,y:p+6}),p+=Ta):y.branches.forEach((T,j)=>{j>0&&(c.push({x:w,y:p,width:I}),p+=8),l.push({label:T.label,x:w+12,y:p}),p+=Da,k(T.items,v+1),p+=8}),d.push({fragment:y,x:w,y:D,width:I,height:p-D,count:Ca([y])}),p+=14}};return k(t,0),{width:i,height:p+24,participants:n,rows:o,frames:d,branches:l,dividers:c,folds:m,x:r}},La=B`
|
|
842
850
|
.sequence .diagram-canvas {
|
|
843
851
|
background-image: none;
|
|
844
852
|
}
|
|
@@ -987,6 +995,15 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
987
995
|
pointer-events: none;
|
|
988
996
|
}
|
|
989
997
|
|
|
998
|
+
.sequence-frame-chevron {
|
|
999
|
+
display: inline-flex;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
.sequence-frame-chevron svg {
|
|
1003
|
+
width: 11px;
|
|
1004
|
+
height: 11px;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
990
1007
|
.sequence-frame-header {
|
|
991
1008
|
position: absolute;
|
|
992
1009
|
display: flex;
|
|
@@ -1114,7 +1131,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1114
1131
|
fill: var(--dpk-ink);
|
|
1115
1132
|
stroke: var(--dpk-ink);
|
|
1116
1133
|
}
|
|
1117
|
-
`,
|
|
1134
|
+
`,Ra=[{id:"seq-request"},{id:"seq-response"},{id:"seq-async"},{id:"seq-related"},{id:"seq-selected"}];class zt extends De{static{this.styles=[W,La]}#e=null;#a=new Map;#s=new Map;#t=new Set;#n=new Set;#r="";#i=0;commentItems(){const e=this.items();return[...e.participants.map(t=>({value:this.commentRef("participant",t.id),label:t.name})),...K(e.items).map(t=>({value:this.commentRef("message",t.id),label:t.title}))]}parseData(e){return this.#s.clear(),Ct(e)}emptyData(){return Sa()}defaultHeading(){return oe(this.locale).heading}shellClass(){return"sequence"}emptyMessage(){return oe(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):K(t.items).some(s=>s.id===e.id)}tagItems(){return K(this.items().items).map(e=>e.tags)}statsText(){const e=this.#e,t=K(this.items().items).length;return e===null?"":oe(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(","),K(e.items).map(i=>i.id).join(",")].join("|");s!==this.#r&&(this.#r=s,this.#i+=1,this.#a=Ma(this.items()),this.#e=Aa(e,i=>Q(i.tags,t))),this.#t=new Set,this.#n=new Set;const n=this.selection,r=this.#e;if(n!==null&&r!==null)if(n.kind==="message"){const i=r.rows.find(o=>o.message.id===n.id);this.#t.add(n.id),i&&(this.#n.add(i.message.from),this.#n.add(i.message.to))}else for(const i of r.rows)i.message.from!==n.id&&i.message.to!==n.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(n=>n!==null).join(`
|
|
1118
1135
|
`)||e.title}#c(){const e=this.items(),t=s=>s.map(n=>n.kind==="message"?n:{...n,collapsed:this.#s.get(n.id)??n.collapsed,branches:n.branches.map(r=>({label:r.label,items:t(r.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.#n.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}renderAboveCanvas(){const e=this.#e;if(e===null)return b;const t=oe(this.locale);return h`
|
|
1119
1136
|
<div class="sequence-rail" role="group" aria-label=${t.participants}>
|
|
1120
1137
|
<div class="sequence-rail-world">
|
|
@@ -1169,7 +1186,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1169
1186
|
<path class="sequence-message is-${i.message.style}" d=${l} marker-end=${`url(#${m})`}></path>
|
|
1170
1187
|
</g>
|
|
1171
1188
|
`});return h`<svg class="diagram-edges" width=${e.width} height=${e.height}>
|
|
1172
|
-
${
|
|
1189
|
+
${ft(Ra)} ${s} ${n} ${r}
|
|
1173
1190
|
</svg>`}#m(e,t,s,n,r,i){const o=this.#u(e);return h`
|
|
1174
1191
|
<button
|
|
1175
1192
|
type="button"
|
|
@@ -1180,7 +1197,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1180
1197
|
aria-label=${i.frameHeaderLabel(e.operator,e.title,o)}
|
|
1181
1198
|
@click=${()=>this.#l(e)}
|
|
1182
1199
|
>
|
|
1183
|
-
<span
|
|
1200
|
+
<span class="sequence-frame-chevron">${o?Je():As()}</span>
|
|
1184
1201
|
<span class="sequence-operator">${e.operator}</span>
|
|
1185
1202
|
<span class="sequence-text">${e.title}</span>
|
|
1186
1203
|
<span class="sequence-frame-count">${i.frameCount(r)}</span>
|
|
@@ -1199,7 +1216,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1199
1216
|
<span class="sequence-text">${t.title}</span>
|
|
1200
1217
|
</button>
|
|
1201
1218
|
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#a.get(t.id)??""} ${t.title}`.trim(),{x:l+c-30,y:e-31})}
|
|
1202
|
-
`}}const
|
|
1219
|
+
`}}const Dt=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",zt)},te=_({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"}}),Tt={width:176,height:84},Oa=q({id:S(u(),M(1)),name:S(u(),M(1)),path:f(u()),layer:f(u()),tags:f(z(u()),[]),description:f(u()),questions:f(u())}),Ia=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),contract:f(u()),description:f(u()),questions:f(u())}),Pa=q({modules:z(Oa),dependencies:f(z(Ia),[])}),ja=()=>({nodes:[],edges:[]}),Fa=a=>{const e=G(Pa,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,n=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:Tt.width,height:Tt.height,...i.questions===void 0?{}:{questions:i.questions}})),edges:n}},Na=B`
|
|
1203
1220
|
.dep-direction {
|
|
1204
1221
|
display: flex;
|
|
1205
1222
|
gap: 2px;
|
|
@@ -1393,7 +1410,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1393
1410
|
fill: var(--dpk-blue);
|
|
1394
1411
|
stroke: var(--dpk-blue);
|
|
1395
1412
|
}
|
|
1396
|
-
`,
|
|
1413
|
+
`,Ua=[{id:"dep-neutral"},{id:"dep-outgoing"},{id:"dep-incoming"},{id:"dep-cycle"},{id:"dep-selected"}];class At extends ie{static{this.styles=[W,Na]}#e="both";#a=!1;#s=!1;#t=[];#n=Y;#r=Y;parseData(e){return Fa(e)}emptyData(){return ja()}defaultHeading(){return te(this.locale).heading}statsLabels(){const e=te(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){const e=te(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"?Y:{nodes:new Map([...this.#n.nodes,...this.#r.nodes]),edges:new Set([...this.#n.edges,...this.#r.edges])}}refreshContent(){const e=this.items(),t=this.tagFilter,s=e.nodes.filter(o=>Q(o.tags,t)),n=new Set(s.map(o=>o.id)),r=e.edges.filter(o=>n.has(o.from)&&n.has(o.to));this.#t=ea(s.map(o=>o.id),r);const i=this.selection;this.#n=i!==null&&i.kind==="node"&&this.#e!=="incoming"?N(r,i.id,"outgoing",this.#a):Y,this.#r=i!==null&&i.kind==="node"&&this.#e!=="outgoing"?N(r,i.id,"incoming",this.#a):Y,super.refreshContent()}matchesFilter(e){return this.#s?Ce(this.#t).has(e.id):!0}filtered(){const e=super.filtered();if(!this.#s)return e;const t=Ce(this.#t),s=e.edges.filter(r=>ut(r,t)),n=new Set(s.flatMap(r=>[r.from,r.to]));return{nodes:e.nodes.filter(r=>n.has(r.id)),edges:s}}renderToolbarActions(){const e=te(this.locale),t=this.#t.length;return h`
|
|
1397
1414
|
<div class="dep-direction" role="group" aria-label=${e.directionGroup}>
|
|
1398
1415
|
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,n])=>h`
|
|
1399
1416
|
<button
|
|
@@ -1430,7 +1447,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1430
1447
|
<span><i class="dep-swatch-outgoing"></i>${e.legendOutgoing}</span>
|
|
1431
1448
|
<span><i class="dep-swatch-incoming"></i>${e.legendIncoming}</span>
|
|
1432
1449
|
<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":
|
|
1450
|
+
</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":ut(e,t)?"dep-cycle":this.#n.edges.has(e.id)?"dep-outgoing":this.#r.edges.has(e.id)?"dep-incoming":"dep-neutral"}renderCanvas(){const e=te(this.locale),t=this.visible,s=Ce(this.#t),n=o=>t.nodes.find(d=>d.id===o)?.name??o,r=t.edges.map(o=>{const d=this.edgeState(o.id),l=this.routeOf(o.id),c=re(l),m=()=>this.select({kind:"edge",id:o.id});return O`
|
|
1434
1451
|
<g class=${this.elementClass(d,"d-edge","dep-edge")} data-dependency=${o.id}>
|
|
1435
1452
|
<title>${[o.contract,o.description].filter(p=>p!==null).join(`
|
|
1436
1453
|
`)||o.id}</title>
|
|
@@ -1467,7 +1484,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1467
1484
|
<span class="dep-path">${o.path??""}</span>
|
|
1468
1485
|
</button>
|
|
1469
1486
|
${this.renderCommentTrigger({kind:"node",id:o.id},o.name,{x:d.x+o.width-20,y:d.y-14})}
|
|
1470
|
-
`});return h`${this.renderEdges(r,
|
|
1487
|
+
`});return h`${this.renderEdges(r,Ua)}${i}`}}const Lt=()=>{customElements.get("dpk-component-dependency-graph")||customElements.define("dpk-component-dependency-graph",At)},Rt=(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],se=_({en:{heading:"ERD",node:"Table",edge:"Relation",empty:"No matching tables.",search:"Search",legendAdded:"Added",legendRemoved:"Removed",legendChanged:"Changed",legendCardinality:"Crow\u2019s foot: | one \xB7 \u25CB zero \xB7 fork many \u2014 each end counts that table\u2019s rows per row across the line",statusLabel:a=>Rt(a,!0),edgeLabel:(a,e,t)=>`${a} and ${e}, related ${t}`,was:a=>`was ${a}`,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",legendCardinality:"\u30AB\u30E9\u30B9\u306E\u8DB3\u8A18\u6CD5: | 1 \xB7 \u25CB 0 \xB7 \u4E09\u53C9 \u591A \u2014 \u5404\u7AEF\u306E\u8A18\u53F7\u3068\u6570\u5B57\u306F\u3001\u76F8\u624B\u5074 1 \u884C\u306B\u5BFE\u3059\u308B\u305D\u306E\u7AEF\u306E\u30C6\u30FC\u30D6\u30EB\u306E\u884C\u6570",statusLabel:a=>Rt(a,!1),edgeLabel:(a,e,t)=>`${a} \u3068 ${e} \u306E\u95A2\u9023 (${t})`,was:a=>`\u5909\u66F4\u524D ${a}`,nullable:"null\u53EF"}}),Ot=276,Ae=74,Ha=28,_a=44,It=["1","0..1"],Pt=["1","0..1","1..N","0..N"],Ba=It.flatMap(a=>Pt.map(e=>`${a}:${e}`)),jt=H(["PK","FK","UQ"]),Ga=q({id:S(u(),M(1)),type:S(u(),M(1)),key:f(Ls([jt,S(z(jt),M(1))])),ref:f(u()),nullable:f(we(),!1),cardinality:f(H(Ba)),label:f(S(u(),M(1))),questions:f(u())}),Ya=q({id:S(u(),M(1)),name:S(u(),M(1)),tags:f(z(u()),[]),fields:z(Ga),questions:f(u())}),Ft=q({tables:z(Ya)}),Va=q({before:f(Ft),after:Ft}),Wa=()=>({nodes:[],edges:[]}),Le=a=>a.key===void 0?[]:[...new Set(typeof a.key=="string"?[a.key]:a.key)],Nt=a=>({id:a.id,type:a.type,keys:Le(a),ref:a.ref??null,nullable:a.nullable,cardinality:a.cardinality??null,label:a.label??null,questions:a.questions??null}),Ut=(a,e)=>a.type===e.type&&a.keys.join()===e.keys.join()&&a.ref===e.ref&&a.nullable===e.nullable&&a.cardinality===e.cardinality&&a.label===e.label,be=a=>`${a.parent} : ${a.child}`,Ka=(a,e)=>be(a.cardinality)===be(e.cardinality)&&a.label===e.label,Xa=(a,e)=>{const t=Le(e);return t.includes("UQ")?!0:t.includes("PK")&&a.fields.filter(s=>Le(s).includes("PK")).length===1},Ja=new Map(It.map(a=>[a,a])),Za=new Map(Pt.map(a=>[a,a])),Qa=(a,e)=>{const t=Xa(a,e),s={parent:e.nullable?"0..1":"1",child:t?"0..1":"0..N"};if(e.cardinality===void 0)return s;const[n="",r=""]=e.cardinality.split(":"),i=Ja.get(n),o=Za.get(r),d=`${a.id}.${e.id}`;if(i===void 0||o===void 0)throw new Error(`invalid cardinality on ${d}`);if(i!==s.parent)throw new Error(`cardinality "${e.cardinality}" on ${d} needs the parent end ${s.parent}: the FK is ${e.nullable?"":"not "}nullable`);if(t&&(o==="1..N"||o==="0..N"))throw new Error(`cardinality "${e.cardinality}" on ${d} allows many rows, but the column is unique`);return{parent:i,child:o}},Re=a=>a.status==="changed"?_a:Ha,en=a=>Ae+a.reduce((e,t)=>e+Re(t),0),Ht=(a,e)=>{let t=Ae;for(const s of a){if(s.id===e)return t+Re(s)/2;t+=Re(s)}return Ae/2},tn=14,sn=(a,e)=>(a-(e-1)/2)*tn,Oe=a=>{const e=new Map;for(const t of a){const s=`${t.from}.${t.sourceField}`;e.set(s,[...e.get(s)??[],t.id])}return new Map([...e.values()].flatMap(t=>t.map((s,n)=>[s,sn(n,t.length)])))},_t=a=>a.flatMap(e=>e.fields.flatMap(t=>{if(t.ref===void 0){if(t.cardinality!==void 0||t.label!==void 0)throw new Error(`cardinality and label on ${e.id}.${t.id} describe a relation; add its ref`);return[]}const[s,n]=t.ref.split(".");if(s===void 0||n===void 0)throw new Error(`invalid ref "${t.ref}" on ${e.id}.${t.id}; expected table.field`);return[{id:`${s}:${n}>${e.id}:${t.id}`,from:s,to:e.id,sourceField:n,targetField:t.id,cardinality:Qa(e,t),label:t.label??null}]})),an=(a,e)=>[...new Set([...a,...e].map(s=>s.id))].flatMap(s=>{const n=a.find(l=>l.id===s),r=e.find(l=>l.id===s),i=r??n;if(!i)return[];const o=Nt(i);if(!n)return[{...o,status:"added",before:null}];if(!r)return[{...o,status:"removed",before:null}];const d=Nt(n);return[{...o,status:Ut(d,o)?"same":"changed",before:Ut(d,o)?null:d}]}),nn=a=>{const e=G(Va,a),t=e.before?.tables??e.after.tables,s=e.after.tables,n=[...new Set([...t,...s].map(x=>x.id))],r=new Map;for(const x of[...t,...s])r.set(x.id,x.tags);const i=n.flatMap(x=>{const v=t.find(T=>T.id===x),y=s.find(T=>T.id===x),w=y??v;if(!w)return[];const D=an(v?.fields??[],y?.fields??[]),I=v?y?D.some(T=>T.status!=="same")?"changed":"same":"removed":"added";return[{id:x,name:w.name,status:I,fields:D,tags:r.get(x)??[],width:Ot,height:en(D),...w.questions===void 0?{}:{questions:w.questions}}]}),o=new Map(i.map(x=>[x.id,x])),d=_t(t),l=_t(s),m=[...new Set([...d,...l].map(x=>x.id))].flatMap(x=>{const v=d.find(V=>V.id===x),y=l.find(V=>V.id===x),w=y??v;if(!w)return[];const D=o.get(w.from),I=o.get(w.to);if(!D||!I)return[];const T=v&&y&&!Ka(v,y)?v:null,j=v?y?T?"changed":"same":"removed":"added";return[{id:x,from:w.from,to:w.to,sourceField:w.sourceField,targetField:w.targetField,cardinality:w.cardinality,label:w.label,before:T&&{cardinality:T.cardinality,label:T.label},status:j,tags:[],fromPort:`${x}:out`,toPort:`${x}:in`}]}),p=Oe(m),k=x=>{const v={},y={};for(const w of m)w.from===x.id&&(v[`${w.id}:out`]={x:Ot,y:Ht(x.fields,w.sourceField)+(p.get(w.id)??0)}),w.to===x.id&&(y[`${w.id}:in`]={x:0,y:Ht(x.fields,w.targetField)});return{out:v,in:y}};return{nodes:i.map(x=>{const v=k(x);return{...x,ports:{...v.out,...v.in}}}),edges:m}},rn=a=>{switch(a){case"1":return{min:"one",max:"one"};case"0..1":return{min:"zero",max:"one"};case"1..N":return{min:"one",max:"many"};case"0..N":return{min:"zero",max:"many"}}},Ie=4,Bt=6,on=12,Gt=7,dn=7,ln=14,cn=19,pn=6,hn=(a,e)=>{const t=e==="start"?a:[...a].reverse(),[s]=t,n=t.find(i=>s!==void 0&&(i.x!==s.x||i.y!==s.y));if(s===void 0||n===void 0)return{x:e==="start"?1:-1,y:0};const r=Math.hypot(n.x-s.x,n.y-s.y);return{x:(n.x-s.x)/r,y:(n.y-s.y)/r}},Yt=a=>Math.round(a*100)/100||0,un=(a,e,t)=>{const s=(e==="start"?a[0]:a.at(-1))??{x:0,y:0},n=hn(a,e),r={x:-n.y,y:n.x},i=(y,w=0)=>({x:Yt(s.x+n.x*y+r.x*w),y:Yt(s.y+n.y*y+r.y*w)}),o=y=>[i(y,-Bt),i(y,Bt)],d=rn(t),l=d.max==="many"?[-Gt,0,Gt].map(y=>[i(on),i(0,y)]):[o(dn)],c=d.max==="many"?cn:ln,m=c+Ie-2,p=d.min==="one"?[...l,o(c)]:l,k=d.min==="zero"?i(m):null,x=(d.min==="zero"?m+Ie:c)+pn,v=i(x);return{segments:p,circle:k,label:{...v,anchor:n.x>=0?"start":"end"}}},mn=B`
|
|
1471
1488
|
.er-search {
|
|
1472
1489
|
display: flex;
|
|
1473
1490
|
align-items: center;
|
|
@@ -1847,7 +1864,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1847
1864
|
.diagram-legend .er-swatch-changed {
|
|
1848
1865
|
border-color: var(--dpk-amber);
|
|
1849
1866
|
}
|
|
1850
|
-
`,Pe=7,
|
|
1867
|
+
`,Pe=7,Vt={same:"",added:"+",removed:"\u2212",changed:"~"};class Wt extends ie{static{this.styles=[W,mn]}#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,n=t.getBoundingClientRect();if(s===void 0||n.width===0)continue;const r=n.width/t.offsetWidth,i=d=>Math.round(d*64)/64,o={height:i(n.height/r),rows:[...t.querySelectorAll(".er-field")].map(d=>{const l=d.getBoundingClientRect();return i((l.top+l.height/2-n.top)/r)})};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(),t=Oe(e.edges);return{...e,nodes:e.nodes.map(s=>{const n=this.#a.get(s.id);if(!n)return s;const r={...s.ports};for(const i of e.edges){if(i.from===s.id&&i.fromPort!==void 0){const o=n.rows[s.fields.findIndex(d=>d.id===i.sourceField)];o!==void 0&&(r[i.fromPort]={x:s.width,y:o+(t.get(i.id)??0)})}if(i.to===s.id&&i.toPort!==void 0){const o=n.rows[s.fields.findIndex(d=>d.id===i.targetField)];o!==void 0&&(r[i.toPort]={x:0,y:o})}}return{...s,height:n.height,ports:r}})}}parseData(e){return nn(e)}emptyData(){return Wa()}defaultHeading(){return se(this.locale).heading}statsLabels(){const e=se(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return se(this.locale).empty}layoutOptions(){return{nodeSpacing:38,layerSpacing:128,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 Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=se(this.locale);return h`
|
|
1851
1868
|
<label class="er-search">
|
|
1852
1869
|
<span class="dpk-label">${e.search}</span>
|
|
1853
1870
|
<input
|
|
@@ -1879,7 +1896,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1879
1896
|
${o.length>0?this.#n(o,r,s.get(r.id)??0):b}
|
|
1880
1897
|
${this.renderEdgeCommentTrigger({kind:"edge",id:r.id},`${r.from}.${r.sourceField} \u2192 ${r.to}.${r.targetField}`,o)}
|
|
1881
1898
|
</g>
|
|
1882
|
-
`});return h`${this.renderEdges(n,[])}${t.nodes.map(r=>this.#r(r,e))}`}#n(e,t,s){const n=t.before,r=(c,m)=>O`${m!=null&&m!==c?O`<tspan class="er-was">${m}</tspan> `:b}${c??b}`,i=c=>{const m=c==="start"?t.cardinality.parent:t.cardinality.child,p=n&&(c==="start"?n.cardinality.parent:n.cardinality.child),k=
|
|
1899
|
+
`});return h`${this.renderEdges(n,[])}${t.nodes.map(r=>this.#r(r,e))}`}#n(e,t,s){const n=t.before,r=(c,m)=>O`${m!=null&&m!==c?O`<tspan class="er-was">${m}</tspan> `:b}${c??b}`,i=c=>{const m=c==="start"?t.cardinality.parent:t.cardinality.child,p=n&&(c==="start"?n.cardinality.parent:n.cardinality.child),k=un(e,c,m);return{glyph:k,content:O`
|
|
1883
1900
|
<g class="er-end" data-end=${c} data-multiplicity=${m}>
|
|
1884
1901
|
${k.segments.map(([x,v])=>O`<line x1=${x.x} y1=${x.y} x2=${v.x} y2=${v.y}></line>`)}
|
|
1885
1902
|
${k.circle===null?b:O`<circle cx=${k.circle.x} cy=${k.circle.y} r=${Ie}></circle>`}
|
|
@@ -1916,7 +1933,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1916
1933
|
title=${`${e.id} / ${e.name}`}
|
|
1917
1934
|
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
1918
1935
|
>
|
|
1919
|
-
${e.status==="same"?b:h`<span class="er-mark" aria-hidden="true">${
|
|
1936
|
+
${e.status==="same"?b:h`<span class="er-mark" aria-hidden="true">${Vt[e.status]}</span>`}
|
|
1920
1937
|
<span class="er-name">${e.id}</span>
|
|
1921
1938
|
<span class="er-label">${e.name}</span>
|
|
1922
1939
|
<span class="dpk-label er-status">${t.statusLabel(e.status)}</span>
|
|
@@ -1930,7 +1947,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1930
1947
|
data-grill-questions=${this.questionsOf(e)}
|
|
1931
1948
|
title=${[t.statusLabel(e.status),e.id,s(e)].filter(Boolean).join(" / ")}
|
|
1932
1949
|
>
|
|
1933
|
-
<span class="er-field-mark" aria-hidden="true">${
|
|
1950
|
+
<span class="er-field-mark" aria-hidden="true">${Vt[e.status]}</span>
|
|
1934
1951
|
<span class="er-key" data-empty=${e.keys.length===0?"true":"false"}
|
|
1935
1952
|
>${e.keys.length===0?"\xB7":e.keys.map(r=>h`<span>${r}</span>`)}</span
|
|
1936
1953
|
>
|
|
@@ -1940,7 +1957,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
1940
1957
|
<ins>+ ${s(e)}</ins>
|
|
1941
1958
|
</span>`:h`<span class="er-field-type">${s(e)}</span>`}
|
|
1942
1959
|
</div>
|
|
1943
|
-
`}}const
|
|
1960
|
+
`}}const Kt=()=>{customElements.get("dpk-component-er-diagram")||customElements.define("dpk-component-er-diagram",Wt)},de=_({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}`}}),Xt={width:220,height:112},ke=26,gn=q({src:S(u(),M(1)),alt:S(u(),M(1)),license:f(u())}),fn=q({id:S(u(),M(1)),name:S(u(),M(1)),description:f(u()),boundary:f(u()),symbol:f(u()),tags:f(z(u()),[]),artwork:f(gn),position:q({x:ae(),y:ae()}),questions:f(u())}),bn=q({id:S(u(),M(1)),label:S(u(),M(1)),kind:f(H(["internal","external"]),"internal")}),kn=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),label:f(u())}),xn=q({boundaries:f(z(bn),[]),services:z(fn),links:f(z(kn),[])}),vn=()=>({nodes:[],edges:[],boundaries:[]}),yn=a=>{const e=G(xn,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,n=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:Xt.width,height:Xt.height,position:o.position,...o.questions===void 0?{}:{questions:o.questions}}}),r=new Set,i=e.links.map(o=>{if(r.has(o.id))throw new Error(`duplicate link id: ${o.id}`);if(r.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:n,edges:i,boundaries:e.boundaries.map(o=>({id:o.id,label:o.label,kind:o.kind}))}},je={left:ke,top:ke*1.6,right:ke,bottom:ke},wn={left:0,top:0,right:0,bottom:0},$n=12,Jt=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))}),Sn=(a,e,t,s)=>{const n=a.left-e.left<t.right+s.right&&t.left-s.left<a.right+e.right,r=a.top-e.top<t.bottom+s.bottom&&t.top-s.top<a.bottom+e.bottom;if(!n||!r)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,m)=>l===0?0:Math.max(0,m-$n)*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))}},Mn=(a,e)=>{const t=e.flatMap(n=>{const r=a.filter(i=>i.boundary===n.id);return r.length===0?[]:[{boundary:n,bounds:Jt(r)}]}),s=[...t.map(n=>({id:n.boundary.id,bounds:n.bounds,padding:je})),...a.filter(n=>n.boundary===null||!t.some(r=>r.boundary.id===n.boundary)).map(n=>({id:null,bounds:Jt([n]),padding:wn}))];return t.map(({boundary:n,bounds:r})=>{const i=s.filter(l=>l.id!==n.id).map(l=>Sn(r,je,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)}),je),o=r.left-i.left,d=r.top-i.top;return{boundary:n,x:o,y:d,width:r.right+i.right-o,height:r.bottom+i.bottom-d}})},Cn=(a,e)=>{const t=r=>r.y+r.height/2,s=r=>r.x+r.width/2,n=(r,i,o)=>{if(o?r.y===i.y:r.x===i.x)return[r,i];if(o){const l=(r.x+i.x)/2;return[r,{x:l,y:r.y},{x:l,y:i.y},i]}const d=(r.y+i.y)/2;return[r,{x:r.x,y:d},{x:i.x,y:d},i]};return e.x>=a.x+a.width?n({x:a.x+a.width,y:t(a)},{x:e.x,y:t(e)},!0):a.x>=e.x+e.width?n({x:a.x,y:t(a)},{x:e.x+e.width,y:t(e)},!0):e.y>=a.y+a.height?n({x:s(a),y:a.y+a.height},{x:s(e),y:e.y},!1):a.y>=e.y+e.height?n({x:s(a),y:a.y},{x:s(e),y:e.y+e.height},!1):null},En=(a,e)=>{const t=new Map(a.nodes.map(n=>[n.id,n])),s=a.routes.map(n=>{const r=e.find(l=>l.id===n.id),i=r?t.get(r.from):void 0,o=r?t.get(r.to):void 0,d=i&&o&&i!==o?Cn(i,o):null;return d===null?n:{id:n.id,points:d}});return{...a,routes:s}},qn=B`
|
|
1944
1961
|
.arch-toggle {
|
|
1945
1962
|
min-height: 26px;
|
|
1946
1963
|
padding: 0 9px;
|
|
@@ -2096,7 +2113,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2096
2113
|
fill: var(--dpk-blue);
|
|
2097
2114
|
stroke: var(--dpk-blue);
|
|
2098
2115
|
}
|
|
2099
|
-
`,
|
|
2116
|
+
`,zn=[{id:"arch-neutral"},{id:"arch-selected"}];class Zt extends ie{static{this.styles=[W,qn]}#e=!0;parseData(e){return yn(e)}emptyData(){return vn()}defaultHeading(){return de(this.locale).heading}statsLabels(){const e=de(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return de(this.locale).empty}get layoutMode(){return"fixed"}layoutOptions(){return{padding:40}}computePlacement(e){return En(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 Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=de(this.locale);return h`
|
|
2100
2117
|
<button
|
|
2101
2118
|
type="button"
|
|
2102
2119
|
class="dpk-btn dpk-btn--ghost arch-toggle"
|
|
@@ -2106,7 +2123,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2106
2123
|
>
|
|
2107
2124
|
${e.boundaries}
|
|
2108
2125
|
</button>
|
|
2109
|
-
`}#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
|
|
2126
|
+
`}#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 Mn(e,this.items().boundaries)}renderCanvas(){const e=de(this.locale),t=this.visible,s=r=>t.nodes.find(i=>i.id===r)?.name??r,n=t.edges.map(r=>{const i=this.edgeState(r.id),o=this.routeOf(r.id),d=re(o),l=()=>this.select({kind:"edge",id:r.id});return O`
|
|
2110
2127
|
<g class=${this.elementClass(i,"d-edge","arch-link")} data-link=${r.id}>
|
|
2111
2128
|
<title>${r.label??r.id}</title>
|
|
2112
2129
|
<path
|
|
@@ -2134,7 +2151,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2134
2151
|
>
|
|
2135
2152
|
<span>${r.boundary.label}</span>
|
|
2136
2153
|
</div>`):b}
|
|
2137
|
-
${this.renderEdges(n,
|
|
2154
|
+
${this.renderEdges(n,zn)} ${t.nodes.map(r=>this.#t(r,e))}
|
|
2138
2155
|
`}#s(e,t){const s=t[Math.floor(t.length/2)]??t[0];return s?O`<text class="arch-link-label" x=${s.x} y=${s.y-6}>${e}</text>`:h``}#t(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id);return h`
|
|
2139
2156
|
<button
|
|
2140
2157
|
type="button"
|
|
@@ -2158,7 +2175,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2158
2175
|
</span>
|
|
2159
2176
|
</button>
|
|
2160
2177
|
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:s.x+e.width-20,y:s.y-14})}
|
|
2161
|
-
`}}const
|
|
2178
|
+
`}}const Qt=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",Zt)},es=[72,52,40],ts=[0,22,10,8],Dn=a=>es[Math.min(a,es.length-1)]??40,ss=a=>ts[Math.min(a,ts.length-1)]??8,Tn=(a,e={})=>{const t=e.padding??40,s=a.nodes.find($=>$.parent===null);if(s===void 0)return{width:0,height:0,nodes:[],routes:[]};const n=new Map(a.nodes.map($=>[$.id,$])),r=$=>$.children.flatMap(A=>{const L=n.get(A);return L===void 0?[]:[L]}),i=new Map,o=$=>$.reduce((A,L,U)=>A+d(L)+(U===0?0:ss(L.depth)),0),d=$=>{const A=i.get($.id);if(A!==void 0)return A;const L=Math.max($.height,o(r($)));return i.set($.id,L),L},l=[],c=($,A,L)=>{if(A.length===0)return;const U=Dn($.node.depth);let g=$.y+$.node.height/2-o(A)/2;for(const C of A){const E=d(C),P={x:L==="right"?$.x+$.node.width+U:$.x-U-C.width,y:g+E/2-C.height/2,node:C};l.push(P),c(P,r(C),L),g+=E+ss(C.depth)}},m={x:-s.width/2,y:-s.height/2,node:s};l.push(m);const p=r(s);c(m,p.filter($=>$.side!=="left"),"right"),c(m,p.filter($=>$.side==="left"),"left");const k=Math.min(...l.map($=>$.x)),x=Math.min(...l.map($=>$.y)),v=Math.max(...l.map($=>$.x+$.node.width)),y=Math.max(...l.map($=>$.y+$.node.height)),w=t-k,D=t-x,I=new Map,T=l.map($=>{const A=I.get($.node.depth)??0;return I.set($.node.depth,A+1),{id:$.node.id,x:$.x+w,y:$.y+D,width:$.node.width,height:$.node.height,layer:$.node.depth,order:A}}),j=new Map(T.map($=>[$.id,$])),V=a.edges.flatMap($=>{const A=j.get($.from),L=j.get($.to),U=n.get($.to);if(A===void 0||L===void 0||U===void 0)return[];const g=U.side==="left",C={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:$.id,points:[C,E]}]});return{width:v-k+t*2,height:y-x+t*2,nodes:T,routes:V}},An=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}`},le=_({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}`}}),as=Rs(()=>q({id:S(u(),M(1)),label:S(u(),M(1)),description:f(u()),tags:f(z(u())),questions:f(u()),collapsed:f(we()),side:f(H(["left","right"])),children:f(z(as))})),Ln=q({root:as}),ns=()=>({root:null,nodes:[],edges:[]}),rs=[{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}],Rn=a=>rs[Math.min(a,rs.length-1)]??{fontSize:12.5,padding:12,height:28,min:56,max:220},On=(a,e)=>{let t=0;for(const s of a)t+=(s.codePointAt(0)??0)>=11904?e:e*.62;return t},In=(a,e)=>{const t=Rn(e),s=Math.ceil(On(a,t.fontSize)+t.padding*2+4);return{width:Math.min(t.max,Math.max(t.min,s)),height:t.height}},Fe=a=>a.children===void 0||a.children.length===0?1:a.children.reduce((e,t)=>e+Fe(t),0),is=a=>{const e={left:0,right:0};for(const t of a)t.side!==void 0&&(e[t.side]+=Fe(t));return a.map(t=>{if(t.side!==void 0)return t.side;const s=e.right<=e.left?"right":"left";return e[s]+=Fe(t),s})},os=a=>ds(G(Ln,a).root),ds=(a,e=new Set)=>{const t=[],s=[],n=new Set,r=(i,o,d,l,c)=>{if(n.has(i.id))throw new Error(`duplicate topic id: ${i.id}`);if(n.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 m=i.children??[];t.push({id:i.id,label:i.label,description:i.description??null,parent:o,depth:d,branch:l,side:c,children:m.map(k=>k.id),collapsed:i.collapsed??!1,added:e.has(i.id),tags:i.tags??[],...In(i.label,d),...i.questions===void 0?{}:{questions:i.questions}}),o!==null&&s.push({id:i.id,from:o,to:i.id,tags:[]});const p=d===0?is(m):[];m.forEach((k,x)=>r(k,i.id,d+1,d===0?x:l,d===0?p[x]??"right":c))};return r(a,null,0,-1,null),{root:a,nodes:t,edges:s}},ls="ADD_TOPIC",Pn=Se({id:S(u(),M(1)),label:S(u(),Me(),M(1))}),jn=a=>{const e=mt(a);return e?.length===3&&e[1]==="node"?e[2]??null:null},cs=(a,e,t)=>a.id===e?{...a,children:[...a.children??[],t]}:a.children===void 0?a:{...a,children:a.children.map(s=>cs(s,e,t))},Fn=a=>{if(a.children===void 0)return a;const e=is(a.children);return{...a,children:a.children.map((t,s)=>({...t,side:e[s]??"right"}))}},Nn=(a,e,t)=>{const s=a.addTopicTitle,n=new Map(e.nodes.map(d=>[d.id,d.label])),r=new Set,i=[];let o=e.root===null?null:Fn(e.root);for(const d of t){if(d.type!==ls){i.push({id:d.id,title:d.type,stale:"unsupported-action-type"});continue}const l=jn(d.target.id),c=l===null?void 0:n.get(l),m=$e(Pn,d.payload);if(o===null||l===null||c===void 0){i.push({id:d.id,title:s,stale:"target-missing"});continue}if(!m.success||n.has(m.output.id)){i.push({id:d.id,title:s,stale:"constraint-violated"});continue}const{id:p,label:k}=m.output;o=cs(o,l,{id:p,label:k}),n.set(p,k),r.add(p),i.push({id:d.id,title:s,summary:a.addSummary(c,k),tone:"create"})}return{data:o===null||r.size===0?e:ds(o,r),results:i}},Ne=(a,e)=>{const t=new Map(a.nodes.map(r=>[r.id,r])),s=[];let n=t.get(e)?.parent??null;for(;n!==null&&!s.includes(n);)s.push(n),n=t.get(n)?.parent??null;return s},Un=(a,e)=>{const t=new Map(a.nodes.map(r=>[r.id,r]));let s=0;const n=[...t.get(e)?.children??[]];for(let r=n.pop();r!==void 0;r=n.pop())s+=1,n.push(...t.get(r)?.children??[]);return s},Hn=(a,e,t)=>{let s=null;if(e!==null){const i=a.nodes.filter(e);if(i.length===0)return ns();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 m of Ne(a,l.id))d.add(m);const c=[...l.children];for(let m=c.pop();m!==void 0;m=c.pop())d.add(m),c.push(...o.get(m)?.children??[])}s=d}const n=a.nodes.filter(i=>(s===null||s.has(i.id))&&!Ne(a,i.id).some(o=>t.has(o))),r=new Set(n.map(i=>i.id));return{...a,nodes:n,edges:a.edges.filter(i=>r.has(i.from)&&r.has(i.to))}},_n=B`
|
|
2162
2179
|
.branch-root {
|
|
2163
2180
|
--mind-color: var(--dpk-ink);
|
|
2164
2181
|
--mind-soft: var(--dpk-paper-sunken);
|
|
@@ -2375,14 +2392,14 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2375
2392
|
opacity: 1;
|
|
2376
2393
|
}
|
|
2377
2394
|
}
|
|
2378
|
-
`,
|
|
2395
|
+
`,Bn=5;class ps extends ie{static{this.styles=[W,_n]}#e=new Set;#a=null;#s=!1;#t=null;toggle(e,t){const s=this.items().nodes.find(r=>r.id===e);if(s===void 0||s.children.length===0)return;const n=t??!this.#e.has(e);if(n!==this.#e.has(e)){if(n){this.#e.add(e);const r=this.selection;r!==null&&Ne(this.items(),r.id).includes(e)&&this.select(null)}else this.#e.delete(e);this.requestUpdate()}}get collapsed(){return[...this.#e]}parseData(e){return os(e)}emptyData(){return ns()}reduceElementActions(e,t){return Nn(le(this.locale),e,t)}defaultHeading(){return le(this.locale).heading}emptyMessage(){return le(this.locale).empty}statsText(){const e=le(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=>Q(s.tags,e);return Hn(this.items(),t,this.#e)}layoutSignature(){return this.filtered().nodes.map(e=>`${e.id}<${e.parent??""}:${e.side??""}`).join(",")}computePlacement(e){return Tn(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=N(t.edges,e.id,"outgoing",!0),n=N(t.edges,e.id,"incoming",!0);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderSelection(){return b}renderCanvas(){const e=this.filtered(),t=le(this.locale);return h`
|
|
2379
2396
|
${this.renderEdges(e.edges.map(s=>this.#r(s)),[])}
|
|
2380
2397
|
${e.nodes.map(s=>this.#i(s,t))} ${this.#c(t)}
|
|
2381
|
-
`}#n(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%
|
|
2398
|
+
`}#n(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%Bn}`}#r(e){const t=this.items().nodes.find(n=>n.id===e.to),s=this.edgeState(e.id);return O`
|
|
2382
2399
|
<path
|
|
2383
2400
|
class=${this.elementClass(s,"d-edge","mind-branch",this.#n(t),`depth-${Math.min(t?.depth??1,3)}`)}
|
|
2384
2401
|
data-branch=${e.id}
|
|
2385
|
-
d=${
|
|
2402
|
+
d=${An(this.routeOf(e.id))}
|
|
2386
2403
|
></path>
|
|
2387
2404
|
`}#i(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id),r=this.#e.has(e.id),i=`depth-${Math.min(e.depth,3)}`;return h`
|
|
2388
2405
|
<button
|
|
@@ -2398,7 +2415,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2398
2415
|
<span class="mind-label">${e.label}</span>
|
|
2399
2416
|
</button>
|
|
2400
2417
|
${e.depth===0||e.children.length===0?b:this.#o(e,s,r,n.dimmed,t)}
|
|
2401
|
-
`}#o(e,t,s,n,r){const i=s?
|
|
2418
|
+
`}#o(e,t,s,n,r){const i=s?Un(this.items(),e.id):0,o=e.side==="left"?t.x:t.x+t.width,d=s?r.toggleOpen(e.label,i):r.toggleClose(e.label);return h`
|
|
2402
2419
|
<button
|
|
2403
2420
|
type="button"
|
|
2404
2421
|
class=${this.elementClass({selected:!1,related:!1,dimmed:n,depth:null},"mind-toggle",this.#n(e),s&&"is-folded")}
|
|
@@ -2442,7 +2459,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2442
2459
|
${r.failed?h`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:b}
|
|
2443
2460
|
`}
|
|
2444
2461
|
</div>
|
|
2445
|
-
`}#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 n=
|
|
2462
|
+
`}#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 n=Ze(`topic ${s}`,this.items().nodes.map(i=>i.id));if(!this.dispatchElementAction(ls,["node",t],{id:n,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:n}),this.requestUpdate()}}const hs=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",ps)},ce=_({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}`}}),Gn=q({id:S(u(),M(1)),title:S(u(),M(1)),description:f(u()),tags:f(z(u())),assignee:f(u()),questions:f(u())}),Yn=["gray","blue","green","amber","violet","red"],Vn=q({id:S(u(),M(1)),label:S(u(),M(1)),description:f(u()),color:f(H(Yn)),limit:f(S(ae(),Is(),Os(1))),cards:f(z(Gn))}),Wn=q({columns:z(Vn)}),Kn=()=>({columns:[]}),us=a=>{const e=G(Wn,a),t=new Set,s=new Set;return{columns:e.columns.map(r=>{if(t.has(r.id))throw new Error(`duplicate column id: ${r.id}`);return t.add(r.id),{id:r.id,label:r.label,description:r.description??null,color:r.color??null,limit:r.limit??null,cards:(r.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:r.id,change:null}})}})}},xe=(a,e)=>a.columns.flatMap(t=>t.cards).find(t=>t.id===e),pe=a=>a.columns.flatMap(e=>e.cards),Xn=(a,e)=>e===null?a:{columns:a.columns.map(t=>({...t,cards:t.cards.filter(e)}))},Jn=(a,e,t,s)=>{const n=xe(a,e);if(n===void 0||n.column!==t)return!1;if(s===e)return!0;const r=a.columns.find(o=>o.id===t)?.cards??[],i=r.findIndex(o=>o.id===e);return(r[i+1]?.id??null)===s},ms="ADD_CARD",gs="MOVE_CARD",Zn=Se({id:S(u(),M(1)),title:S(u(),Me(),M(1))}),Qn=Se({column:S(u(),M(1)),before:Ps(S(u(),M(1)))}),fs=(a,e)=>{const t=mt(a);return t?.length===3&&t[1]===e?t[2]??null:null},er=(a,e)=>({columns:a.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),bs=(a,e,t)=>({columns:a.columns.map(s=>{if(s.id!==t.column)return s;const n={...e,column:s.id},r=t.before===null?-1:s.cards.findIndex(i=>i.id===t.before);return{...s,cards:r<0?[...s.cards,n]:[...s.cards.slice(0,r),n,...s.cards.slice(r)]}})}),tr=(a,e,t)=>{const s=a.addCardTitle,n=fs(t.target.id,"column"),r=e.columns.find(d=>d.id===n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(Zn,t.payload);if(!i.success||xe(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:r.id,change:"added"};return{data:bs(e,o,{column:r.id,before:null}),result:{id:t.id,title:s,summary:a.addSummary(r.label,o.title),tone:"create"}}},sr=(a,e,t)=>{const s=a.moveCardTitle,n=fs(t.target.id,"card"),r=n===null?void 0:xe(e,n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(Qn,t.payload),o=e.columns.find(k=>k.id===r.column),d=i.success?e.columns.find(k=>k.id===i.output.column):void 0,l=i.success?i.output.before:null,c=l===null||l!==r.id&&d?.cards.some(k=>k.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 m={...r,change:r.change??"moved"},p=o.id===d.id?a.moveSummarySame(r.title,d.label):a.moveSummaryAcross(r.title,o.label,d.label);return{data:bs(er(e,r.id),m,{column:d.id,before:l}),result:{id:t.id,title:s,summary:p,tone:"move"}}},ar=(a,e,t)=>{let s=e;const n=[];for(const r of t){const i=r.type===ms?tr(a,s,r):r.type===gs?sr(a,s,r):{data:s,result:{id:r.id,title:r.type,stale:"unsupported-action-type"}};s=i.data,n.push(i.result)}return{data:s,results:n}},nr=B`
|
|
2446
2463
|
.kanban-board {
|
|
2447
2464
|
display: flex;
|
|
2448
2465
|
align-items: flex-start;
|
|
@@ -2776,9 +2793,9 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2776
2793
|
width: 100%;
|
|
2777
2794
|
font-size: 12.5px;
|
|
2778
2795
|
}
|
|
2779
|
-
`;class
|
|
2796
|
+
`;class ks extends De{static{this.styles=[W,nr]}#e=null;#a=null;#s=null;#t=null;#n=null;parseData(e){return us(e)}emptyData(){return Kn()}reduceElementActions(e,t){return ar(ce(this.locale),e,t)}defaultHeading(){return ce(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return ce(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(t=>({value:this.commentRef("column",t.id),label:t.label})),...pe(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):xe(t,e.id)!==void 0}tagItems(){return pe(this.items()).map(e=>e.tags)}statsText(){const e=ce(this.locale),t=pe(this.items()).length,s=pe(this.#r()).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.#r(),t=new Map(this.items().columns.map(s=>[s.id,s.cards.length]));return h`<div class="kanban-board">
|
|
2780
2797
|
${J(e.columns,s=>s.id,s=>this.#o(s,t.get(s.id)??0))}
|
|
2781
|
-
</div>`}#r(){const e=this.tagFilter;return
|
|
2798
|
+
</div>`}#r(){const e=this.tagFilter;return Xn(this.items(),e.active.length===0?null:t=>Q(t.tags,e))}#i(e,t){const s=this.selection;return s!==null&&s.kind===e&&s.id===t}#o(e,t){const s=ce(this.locale),n=e.limit!==null&&t>e.limit,r=this.#n?.column===e.id?this.#n:null;return h`
|
|
2782
2799
|
<section
|
|
2783
2800
|
class=${ee("kanban-column",n&&"is-over",this.#i("column",e.id)&&"is-selected",r!==null&&"is-drop-target")}
|
|
2784
2801
|
data-column=${e.id}
|
|
@@ -2857,7 +2874,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
2857
2874
|
/>
|
|
2858
2875
|
${s.failed?h`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:b}
|
|
2859
2876
|
`}
|
|
2860
|
-
</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(ms,["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.#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(),Wn(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}}#v(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 n=[...this.items().columns.map(i=>i.id),...pe(this.items()).map(i=>i.id)],r=Je(`card ${s}`,n);if(!this.dispatchElementAction(us,["column",t],{id:r,title:s})){this.#a={column:t,title:s,failed:!0},this.requestUpdate();return}this.#a=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const ks=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",bs)},sr=_({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=S(u(),Me(),M(1)),he=q({id:ne,text:F}),ar=Ke("kind",[q({kind:Z("proved"),assumptions:f(z(F))}),q({kind:Z("bounded"),bound:F}),q({kind:Z("incomplete"),gaps:f(z(F))}),q({kind:Z("planned")})]),nr=q({id:ne,target:f(ne),statement:F,subjects:f(z(he)),premises:f(z(he)),conclusions:S(z(he),M(1,"a claim needs at least one conclusion")),examples:f(z(he)),notClaimed:f(z(he)),assurance:ar,source:f(q({tool:f(F),ref:F}))}),rr=q({id:ne,name:F,meaning:F}),ir=q({id:ne,name:F,code:f(F),summary:f(F)}),or=q({targets:f(z(ir)),terms:f(z(rr)),claims:z(nr)}),dr=()=>({targets:[],terms:[],claims:[]}),lr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,cr=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(lr)){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},Ue=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)}},xs=a=>{const e=G(or,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 n=new Map(s.map(c=>[c.id,c.name])),r=c=>cr(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 m=T=>(T??[]).map(j=>({id:j.id,text:r(j.text)})),p=m(c.subjects),k=m(c.premises),x=m(c.conclusions),v=m(c.examples),y=m(c.notClaimed),w=[...p,...k,...x,...v,...y];ve(w.map(T=>T.id),`clause (in claim ${c.id})`);const D=hr(c.assurance,r),I=r(c.statement);return{id:c.id,target:c.target??null,statement:I,subjects:p,premises:k,conclusions:x,examples:v,notClaimed:y,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:pr([I,...w.map(T=>T.text),...ur(D)])}});return{targets:o,terms:i,claims:l}},hr=(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"}}},ur=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},mr=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[vs(t.assurance)?"conditional":t.assurance.kind]+=1;return e},vs=a=>a.kind==="proved"&&a.assumptions.length>0,ys=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}))},ue=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},He=(a,e)=>{switch(e.kind){case"proved":return vs(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ue(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ue("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ue(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ue(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ue("",[])}}},gr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},fr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],ws=32,ye=a=>{const e=Ue(a.statement);return e.length<=ws?e:`${e.slice(0,ws).trimEnd()}\u2026`},br=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...fr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ue(e.text)}`}))],kr=a=>ys(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(br)]),xr=[_e,Be,Ge,B`
|
|
2877
|
+
</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(gs,["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.#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(),Jn(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}}#v(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 n=[...this.items().columns.map(i=>i.id),...pe(this.items()).map(i=>i.id)],r=Ze(`card ${s}`,n);if(!this.dispatchElementAction(ms,["column",t],{id:r,title:s})){this.#a={column:t,title:s,failed:!0},this.requestUpdate();return}this.#a=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const xs=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",ks)},rr=_({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=S(u(),Me(),M(1)),he=q({id:ne,text:F}),ir=Ke("kind",[q({kind:Z("proved"),assumptions:f(z(F))}),q({kind:Z("bounded"),bound:F}),q({kind:Z("incomplete"),gaps:f(z(F))}),q({kind:Z("planned")})]),or=q({id:ne,target:f(ne),statement:F,subjects:f(z(he)),premises:f(z(he)),conclusions:S(z(he),M(1,"a claim needs at least one conclusion")),examples:f(z(he)),notClaimed:f(z(he)),assurance:ir,source:f(q({tool:f(F),ref:F}))}),dr=q({id:ne,name:F,meaning:F}),lr=q({id:ne,name:F,code:f(F),summary:f(F)}),cr=q({targets:f(z(lr)),terms:f(z(dr)),claims:z(or)}),pr=()=>({targets:[],terms:[],claims:[]}),hr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,ur=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(hr)){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},Ue=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),mr=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)}},vs=a=>{const e=G(cr,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 n=new Map(s.map(c=>[c.id,c.name])),r=c=>ur(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 m=T=>(T??[]).map(j=>({id:j.id,text:r(j.text)})),p=m(c.subjects),k=m(c.premises),x=m(c.conclusions),v=m(c.examples),y=m(c.notClaimed),w=[...p,...k,...x,...v,...y];ve(w.map(T=>T.id),`clause (in claim ${c.id})`);const D=gr(c.assurance,r),I=r(c.statement);return{id:c.id,target:c.target??null,statement:I,subjects:p,premises:k,conclusions:x,examples:v,notClaimed:y,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:mr([I,...w.map(T=>T.text),...fr(D)])}});return{targets:o,terms:i,claims:l}},gr=(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[]}},br=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[ys(t.assurance)?"conditional":t.assurance.kind]+=1;return e},ys=a=>a.kind==="proved"&&a.assumptions.length>0,ws=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}))},ue=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},He=(a,e)=>{switch(e.kind){case"proved":return ys(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ue(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ue("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ue(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ue(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ue("",[])}}},kr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},xr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],$s=32,ye=a=>{const e=Ue(a.statement);return e.length<=$s?e:`${e.slice(0,$s).trimEnd()}\u2026`},vr=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...xr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ue(e.text)}`}))],yr=a=>ws(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(vr)]),wr=[_e,Be,Ge,B`
|
|
2861
2878
|
:host {
|
|
2862
2879
|
display: block;
|
|
2863
2880
|
container-type: inline-size;
|
|
@@ -3400,7 +3417,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
3400
3417
|
font-size: 11px;
|
|
3401
3418
|
color: var(--dpk-accent);
|
|
3402
3419
|
}
|
|
3403
|
-
`]
|
|
3420
|
+
`],Ss=a=>`claim-body-${a}`;class Ms extends Ye{static{this.styles=wr}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;#n="";#r=null;#i=null;#o=new Map;#c=null;#u=new Set;#l=null;#p=null;#h=new et(this);#f=new Ve(this,()=>{this.#n=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#n="",document.addEventListener("keydown",this.#w),document.addEventListener("pointerdown",this.#S),this.#t=rt(this,vs,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.#v(),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 yr(this.#e).map(({target:t,label:s})=>({value:this.#k(t),label:s,group:e}))}get dataError(){return this.#s}get#d(){return rr(this.#f.locale)}#m(){return this.#e??pr()}#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,...kr(e)].map(t=>encodeURIComponent(t)).join("/")}`}#v(){const e=JSON.stringify(this.commentTargets);e!==this.#n&&(this.#n=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#$(){const e=this.#i!==this.#r;this.#i=this.#r;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#M(this.#r);!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 r=new Map(this.#o);r.delete(e),this.#o=r}this.#c=null;const s=this.#M(e);this.#r=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.#r?.startsWith(s)&&(this.#r=null);const n=this.#l?.anchor;n?.closest(".claim-body")?.id===Ss(e)&&this.#x(n)}this.requestUpdate()}#E(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"})}#q(e,t){this.#l?.anchor!==t&&(this.#l={tip:e,anchor:t},this.requestUpdate())}#x(e){this.#l===null||e!==void 0&&this.#l.anchor!==e||(this.#l=null,this.requestUpdate())}#w=e=>{e.key==="Escape"&&this.#x()};#S=e=>{this.#l!==null&&!e.composedPath().includes(this.#l.anchor)&&this.#x()};#z(e){const t=(n,r)=>{n.currentTarget instanceof HTMLElement&&r(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&t(n,r=>this.#q(e,r)),leave:n=>s(n)&&t(n,r=>this.#x(r)),show:n=>t(n,r=>this.#q(e,r)),hide:n=>t(n,r=>this.#x(r))}}render(){const e=this.#d,t=this.#m();return h`
|
|
3404
3421
|
<section class="spec">
|
|
3405
3422
|
<header class="spec-toolbar">
|
|
3406
3423
|
<span class="spec-title">${this.heading??e.heading}</span>
|
|
@@ -3410,11 +3427,11 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
3410
3427
|
${this.#s===null?b:h`<p class="spec-notice" role="alert">${e.dataError}<br />${this.#s}</p>`}
|
|
3411
3428
|
${this.#s===null&&t.claims.length===0?h`<p class="spec-empty">${e.empty}</p>`:b}
|
|
3412
3429
|
<div class="spec-groups">
|
|
3413
|
-
${J(
|
|
3430
|
+
${J(ws(t),s=>s.target?.id??"",s=>this.#y(s))}
|
|
3414
3431
|
</div>
|
|
3415
3432
|
</section>
|
|
3416
3433
|
${this.#H()} ${this.#B()}
|
|
3417
|
-
`}#R(e){const t=this.#d,s=
|
|
3434
|
+
`}#R(e){const t=this.#d,s=br(e),n=[{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(r=>r.count>0);return h`${t.claims(e.claims.length)}
|
|
3418
3435
|
${n.map(r=>h`<span class="spec-chip" data-tone=${r.tone}>${r.label} ${r.count}</span>`)}`}#y(e){const t=h`<div class="spec-claims">
|
|
3419
3436
|
${J(e.claims,n=>n.id,n=>this.#D(n))}
|
|
3420
3437
|
</div>`,s=e.target;return s===null?t:h`<section class="target-group" data-target=${s.id}>
|
|
@@ -3426,7 +3443,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
3426
3443
|
</header>
|
|
3427
3444
|
${s.summary===null?b:h`<p class="target-summary">${this.#T(s.summary)}</p>`}
|
|
3428
3445
|
${e.claims.length===0?h`<p class="spec-empty">${this.#d.noClaims}</p>`:t}
|
|
3429
|
-
</section>`}#D(e){const t=this.#d,s=He(t,e.assurance),n=this.#u.has(e.id),r=this.#z({kind:"assurance",claim:e.id}),i
|
|
3446
|
+
</section>`}#D(e){const t=this.#d,s=He(t,e.assurance),n=this.#u.has(e.id),r=this.#z({kind:"assurance",claim:e.id}),i=Ss(e.id);return h`
|
|
3430
3447
|
<article class="claim" data-claim=${e.id} data-tone=${s.tone}>
|
|
3431
3448
|
<div class="claim-head" @click=${o=>this.#E(o,e.id)}>
|
|
3432
3449
|
<button
|
|
@@ -3437,7 +3454,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
3437
3454
|
aria-label=${n?t.hideDetails:t.showDetails}
|
|
3438
3455
|
@click=${()=>this.#C(e.id)}
|
|
3439
3456
|
>
|
|
3440
|
-
${
|
|
3457
|
+
${Je()}
|
|
3441
3458
|
</button>
|
|
3442
3459
|
<h4 class="claim-statement">${this.#T(e.statement)}</h4>
|
|
3443
3460
|
<button
|
|
@@ -3526,4 +3543,4 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as O,
|
|
|
3526
3543
|
@click=${()=>{this.#r=this.#r===s?null:s,this.requestUpdate()}}
|
|
3527
3544
|
>
|
|
3528
3545
|
${We()}
|
|
3529
|
-
</button>`}#B(){const e=this.#r,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=
|
|
3546
|
+
</button>`}#B(){const e=this.#r,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=tt(this.#o.get(e)??"",[],{label:t,key:e,...this.#c===e?{error:this.#d.sendFailed}:{}});return h`${Qe(e,st(at(this.#f.locale),s,n=>this.#A(e,n)))}`}}const Cs=()=>{customElements.get("dpk-component-formal-spec")||customElements.define("dpk-component-formal-spec",Ms)},Es=()=>{wt(),Dt(),Lt(),Kt(),Qt(),hs(),xs()},$r=()=>{js(),Fs(),Es(),Cs()};export{Zt as D,At as a,Wt as b,Ms as c,ks as d,ps as e,zt as f,yt as g,Qt as h,Lt as i,Kt as j,Cs as k,xs as l,hs as m,Dt as n,wt as o,vs as p,us as q,$r as r,os as s,Ct as t,vt as u,Es as v};
|