dev-process-kit 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -22
- package/dist/chunks/{shared-D3EKtSkd.js → shared-ARDbveKk.js} +1 -1
- package/dist/chunks/shared-B76KHxdC.js +1599 -0
- package/dist/chunks/shared-BAvT77LJ.js +3448 -0
- package/dist/chunks/shared-By_biQNN.js +556 -0
- package/dist/chunks/{shared-D6UXy-Qw.js → shared-C0ctJXPv.js} +99 -46
- package/dist/chunks/{shared-utv1engQ.js → shared-CAzb0Ecs.js} +1 -1
- package/dist/chunks/shared-CBM3Dha3.js +609 -0
- package/dist/chunks/shared-CU-s47EI.js +1874 -0
- package/dist/chunks/shared-CtB9MFc6.js +1018 -0
- package/dist/chunks/{shared-C4Y4jSXa.js → shared-CvU8S9Oz.js} +4 -2
- package/dist/chunks/shared-CzhOCQdU.js +1016 -0
- package/dist/chunks/shared-DOi0CODr.js +736 -0
- package/dist/chunks/shared-xrCdgpNS.js +1 -0
- package/dist/components.js +1 -1
- package/dist/index.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 -0
- package/dist/templates/usm.js +1 -1
- package/package.json +3 -2
- package/dist/chunks/shared-BFAVBf4I.js +0 -1
- package/dist/chunks/shared-BXV4Dm_n.js +0 -522
- package/dist/chunks/shared-CQlssGTf.js +0 -692
- package/dist/chunks/shared-CcD4vDCE.js +0 -1461
- package/dist/chunks/shared-D2QreyJq.js +0 -926
- package/dist/chunks/shared-DZlREPaN.js +0 -2537
- package/dist/chunks/shared-OdGbSUTa.js +0 -574
- package/dist/chunks/shared-TjJWiz7W.js +0 -546
|
@@ -1,2537 +0,0 @@
|
|
|
1
|
-
import{_ as N,Z as Nt,k as _t,$ as Vt,a0 as _,a1 as w,a2 as g,a3 as me,a4 as I,a5 as Wt,a6 as Gt,A as Yt,a7 as Kt,a8 as Xt,a9 as V,aa as E,ab as f,ac as z,ad as p,ae as U,af as $,ag as S,ah as Q,ai as Zt,aj as Ee,ak as De,al as ge,am as fe,an as be,ao as Jt,ap as ze,m as Te,aq as Qt,ar as es,as as ts,r as ss,s as ns}from"./shared-CcD4vDCE.js";import{i as as}from"./shared-D3EKtSkd.js";import{P as is,p as rs,r as os,c as ds}from"./shared-C4Y4jSXa.js";import{c as de}from"./shared-ml5h7U5L.js";const ls='script[type="application/json"]',Ae=(n,e)=>{const t=n.querySelector(ls);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(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}},cs=(n,e,t)=>{const s=Ae(n,e);if(s)return t(s),()=>{};const a=new MutationObserver(()=>{const r=Ae(n,e);r&&(a.disconnect(),t(r))});return a.observe(n,{childList:!0,subtree:!0}),()=>a.disconnect()},Le={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},le=n=>{const e=[...n].sort((s,a)=>s-a);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},ps=(n,e)=>{const t=new Map;for(const i of n)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,a=new Set,r=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?a.add(o.id):d==="new"&&r(o.to)}s.set(i,"done")};for(const i of n)(s.get(i.id)??"new")==="new"&&r(i.id);return{reversed:a,forward:e.filter(i=>!a.has(i.id))}},hs=(n,e)=>{const t=new Map,s=new Map;for(const o of n)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 a=new Map(n.map(o=>[o.id,0])),r=new Map(n.map(o=>[o.id,(t.get(o.id)??[]).length])),i=n.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=a.get(d.to)??0;a.set(d.to,Math.max(l,(a.get(o)??0)+1));const m=(r.get(d.to)??0)-1;r.set(d.to,m),m===0&&i.push(d.to)}return a},us=(n,e,t,s)=>{const a=[...n.keys()].sort((r,i)=>r-i);for(let r=0;r<s;r++){const i=r%2===0;for(const o of i?a:[...a].reverse()){const d=n.get(o)??[],l=new Map(d.map((c,h)=>[c,h])),m=c=>{const h=l.get(c);return h===void 0?null:h},b=d.map(c=>{const h=(e.get(c)??[]).filter(M=>(t.get(M)??o)===o+(i?-1:1)).map(m).filter(M=>M!==null);return{id:c,want:h.length>0?le(h):l.get(c)??0}});b.sort((c,h)=>c.want-h.want||(l.get(c.id)??0)-(l.get(h.id)??0)),n.set(o,b.map(c=>c.id))}}},Oe=(n,e,t,s)=>{const a=n.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));a.sort((i,o)=>i.want-o.want||i.index-o.index);let r=0;for(const i of a){const o=e.get(i.id);o&&(o.y=r,r+=o.spec.height+s)}return{height:Math.max(0,r-s)}},ms=(n,e,t,s,a)=>{const r=[...n.keys()].sort((l,m)=>l-m),i=new Map;for(const l of r)i.set(l,Oe(n.get(l)??[],e,new Map,a.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of r){const m=(o-(i.get(l)??0))/2;for(const b of n.get(l)??[]){const c=e.get(b);c&&(c.y+=m)}}const d=(l,m)=>{const b=(t.get(l)??[]).filter(c=>s.get(c)===m).flatMap(c=>{const h=e.get(c);return h?[h.y+h.spec.height/2]:[]});return b.length>0?le(b):null};for(let l=0;l<a.coordinatePasses;l++){const m=l%2===0;for(const b of m?r:[...r].reverse()){const c=n.get(b)??[],h=new Map;for(const C of c){const T=d(C,b+(m?-1:1)),O=e.get(C);O!==void 0&&h.set(C,T===null?O.y+O.spec.height/2:T)}const M=c.map(C=>e.get(C)?.y??0);Oe(c,e,h,a.nodeSpacing);const v=c.map(C=>e.get(C)?.y??0),k=le(M)-le(v);for(const C of c){const T=e.get(C);T&&(T.y+=k)}}}},Re=(n,e,t)=>{const s=e===void 0?void 0:n.spec.ports?.[e];return s?{x:n.x+s.x,y:n.y+s.y}:t==="out"?{x:n.x+n.spec.width,y:n.y+n.spec.height/2}:{x:n.x,y:n.y+n.spec.height/2}},Ie=(n,e,t)=>{let s=0;const a=[];for(const r of n){const i=t.byId.get(r.from),o=t.byId.get(r.to);if(!i||!o)continue;const d=Re(i,r.fromPort,"out"),l=Re(o,r.toPort,"in");if(r.from===r.to){const M=i.x+i.spec.width,v=i.y+i.spec.height,k=Math.max(t.padding/2,v+18);a.push({id:r.id,points:[d,{x:M+20,y:d.y},{x:M+20,y:k},{x:i.x-20,y:k},{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){a.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;a.push({id:r.id,points:[d,{x:v,y:d.y},{x:v,y:l.y},l]});continue}const m=r.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,b=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,c=Math.max(m.y,b.y)+18+s*14;s+=1;const h=[d,m,{x:m.x,y:c},{x:b.x,y:c},b,l].filter((M,v,k)=>v===0||M.x!==k[v-1]?.x||M.y!==k[v-1]?.y);a.push({id:r.id,points:h})}return a},Pe=(n,e,t)=>{const s=e.flatMap(c=>[...c.points]),a=[...n.map(c=>c.x),...n.map(c=>c.x+c.spec.width),...s.map(c=>c.x)],r=[...n.map(c=>c.y),...n.map(c=>c.y+c.spec.height),...s.map(c=>c.y)],i=Math.min(0,...a),o=Math.min(0,...r),d=Math.max(0,...a),l=Math.max(0,...r),m=t-i,b=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:n.map(c=>({id:c.spec.id,x:c.x+m,y:c.y+b,width:c.spec.width,height:c.spec.height,layer:c.layer,order:c.order})),routes:e.map(c=>({id:c.id,points:c.points.map(h=>({x:h.x+m,y:h.y+b}))}))}},je=(n,e)=>{const t=new Map(n.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},Fe=(n,e,t,s)=>n.map(a=>({spec:a,layer:e.get(a.id)??0,order:t.get(a.id)??0,...s(a)})),gs=(n,e)=>{const t=new Map;for(const s of n){const a=e.get(s.id)??0,r=t.get(a);r?r.push(s.id):t.set(a,[s.id])}return t},fs=(n,e,t={})=>{const s={...Le,...t};if(n.length===0)return{width:0,height:0,nodes:[],routes:[]};const a=new Set(n.map(v=>v.id)),r=e.filter(v=>a.has(v.from)&&a.has(v.to)),{forward:i,reversed:o}=ps(n,r),d=hs(n,i),l=gs(n,d);us(l,je(n,r),d,s.sweeps);const m=new Map;for(const v of l.values())v.forEach((k,C)=>m.set(k,C));const b=Fe(n,d,m,()=>({x:0,y:0})),c=new Map(b.map(v=>[v.spec.id,v]));ms(l,c,je(n,r),d,s);const h=[...l.keys()].sort((v,k)=>v-k);let M=0;for(const v of h){const k=Math.max(...(l.get(v)??[]).map(C=>c.get(C)?.spec.width??0));for(const C of l.get(v)??[]){const T=c.get(C);T&&(T.x=M)}M+=k+s.layerSpacing}return Pe(b,Ie(r,o,{byId:c,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},bs=(n,e,t={})=>{const s={...Le,...t};if(n.length===0)return{width:0,height:0,nodes:[],routes:[]};const a=new Set(n.map(d=>d.id)),r=e.filter(d=>a.has(d.from)&&a.has(d.to)),i=Fe(n,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return Pe(i,Ie(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},ks=N({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:n=>`Comment on ${n}`,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:(n,e)=>`\u201C${n}\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:n=>`${n}\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:(n,e)=>`\u300C${n}\u300D\u2192\u300C${e}\u300D`}}),xs={active:[],match:"single"},K=(n,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>n.includes(t)):e.active.some(t=>n.includes(t)),vs=(n,e)=>n.active.includes(e)?{...n,active:n.active.filter(t=>t!==e)}:n.match==="single"?{...n,active:[e]}:{...n,active:[...n.active,e]},ys=(n,e)=>({match:e,active:e==="single"&&n.active.length>1?n.active.slice(-1):n.active}),ws=n=>({...n,active:[]}),$s=n=>{const e=new Map;for(const t of n)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},B={nodes:new Map,edges:new Set},j=(n,e,t,s)=>{const a=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 n){const m=t==="outgoing"?l.from:l.to,b=t==="outgoing"?l.to:l.from;m===d.id&&(r.add(l.id),!o.has(b)&&(o.add(b),a.set(b,d.depth+1),i.push({id:b,depth:d.depth+1})))}return{nodes:a,edges:r}},Ss=(n,e)=>{const t=new Map(n.map(r=>[r,j(e,r,"outgoing",!0).nodes])),s=new Set,a=[];for(const r of n){if(s.has(r))continue;const i=n.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))&&a.push(i)}return a},ke=n=>new Map(n.flatMap((e,t)=>e.map(s=>[s,t]))),He=(n,e)=>e.get(n.from)===e.get(n.to)&&e.has(n.from),Ue=n=>{try{return n.split("/").map(e=>decodeURIComponent(e))}catch{return null}},Be=(n,e,t,s)=>{const a=e!==null&&e.kind===t&&e.id===n,r=t==="node"?s.nodes.has(n):s.edges.has(n),i=t==="node"?s.nodes.get(n)??null:null;return{selected:a,related:r&&!a,dimmed:e!==null&&!a&&!r,depth:i}},X=(...n)=>n.filter(e=>typeof e=="string"&&e!=="").join(" "),Ms=n=>{const e=n[0]??{x:0,y:0},t=n.at(-1)??e;if(n.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(n.length===4){const r=n[1]??e,i=n[2]??t;return{x:r.x,y:(r.y+i.y)/2}}const s=n[2]??e,a=n[3]??t;return{x:(s.x+a.x)/2,y:s.y}},Cs=(n,e)=>$s(n).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),qs=(n,e,t)=>`${n} ${t.node} \xB7 ${e} ${t.edge}`,W=[Nt,_t,Vt,_`
|
|
2
|
-
:host {
|
|
3
|
-
display: block;
|
|
4
|
-
container-type: inline-size;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.diagram {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
/* The sizing knob: the shell may be resized vertically, and the canvas
|
|
11
|
-
takes whatever is left of it. */
|
|
12
|
-
height: var(--diagram-height, 560px);
|
|
13
|
-
min-height: 260px;
|
|
14
|
-
border: 1px solid var(--dpk-rule);
|
|
15
|
-
border-radius: var(--dpk-radius-lg);
|
|
16
|
-
background: var(--dpk-paper-raised);
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
resize: vertical;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
* Maximized: the shell covers the viewport. It is also a manual popover in
|
|
23
|
-
* the top layer, so the UA popover box (fit-content, margin, border,
|
|
24
|
-
* padding) is reset here. A vertical resize leaves an inline height behind,
|
|
25
|
-
* which only !important overrides.
|
|
26
|
-
*/
|
|
27
|
-
.diagram.is-maximized {
|
|
28
|
-
position: fixed;
|
|
29
|
-
inset: 0;
|
|
30
|
-
z-index: 2147483000;
|
|
31
|
-
width: auto !important;
|
|
32
|
-
height: auto !important;
|
|
33
|
-
max-width: none;
|
|
34
|
-
max-height: none;
|
|
35
|
-
margin: 0;
|
|
36
|
-
padding: 0;
|
|
37
|
-
border: 0;
|
|
38
|
-
border-radius: 0;
|
|
39
|
-
color: var(--dpk-ink);
|
|
40
|
-
resize: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.diagram-maximize {
|
|
44
|
-
flex-shrink: 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.diagram-toolbar {
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
gap: 10px;
|
|
51
|
-
flex-wrap: wrap;
|
|
52
|
-
min-height: 42px;
|
|
53
|
-
padding: 7px 12px;
|
|
54
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
55
|
-
background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
|
|
56
|
-
flex-shrink: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.diagram-title {
|
|
60
|
-
font-size: 12.5px;
|
|
61
|
-
font-weight: 620;
|
|
62
|
-
letter-spacing: -0.01em;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.diagram-subject {
|
|
66
|
-
font-size: 10px;
|
|
67
|
-
color: var(--dpk-ink-faint);
|
|
68
|
-
padding-left: 10px;
|
|
69
|
-
border-left: 1px solid var(--dpk-rule-strong);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.diagram-toolbar-actions {
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
gap: 5px;
|
|
76
|
-
margin-left: auto;
|
|
77
|
-
flex-wrap: wrap;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.diagram-stats {
|
|
81
|
-
font-family: var(--dpk-mono);
|
|
82
|
-
font-size: 10px;
|
|
83
|
-
color: var(--dpk-ink-faint);
|
|
84
|
-
font-variant-numeric: tabular-nums;
|
|
85
|
-
white-space: nowrap;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.diagram-tags {
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
gap: 4px;
|
|
92
|
-
flex-wrap: wrap;
|
|
93
|
-
padding: 6px 12px;
|
|
94
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
95
|
-
background: var(--dpk-paper);
|
|
96
|
-
flex-shrink: 0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.diagram-match {
|
|
100
|
-
display: flex;
|
|
101
|
-
gap: 1px;
|
|
102
|
-
padding: 2px;
|
|
103
|
-
margin-right: 5px;
|
|
104
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
105
|
-
border-radius: var(--dpk-radius-xs);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.diagram-match button {
|
|
109
|
-
border: 0;
|
|
110
|
-
border-radius: 3px;
|
|
111
|
-
padding: 3px 6px;
|
|
112
|
-
background: transparent;
|
|
113
|
-
color: var(--dpk-ink-faint);
|
|
114
|
-
font-size: 9.5px;
|
|
115
|
-
cursor: pointer;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.diagram-match button[aria-pressed='true'] {
|
|
119
|
-
background: var(--dpk-blue-soft);
|
|
120
|
-
color: var(--dpk-blue);
|
|
121
|
-
font-weight: 650;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.dpk-tag {
|
|
125
|
-
display: inline-flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
gap: 5px;
|
|
128
|
-
padding: 4px 8px;
|
|
129
|
-
border: 1px solid transparent;
|
|
130
|
-
border-radius: var(--dpk-radius-xs);
|
|
131
|
-
background: var(--dpk-paper-inset);
|
|
132
|
-
color: var(--dpk-ink-soft);
|
|
133
|
-
font-size: 10.5px;
|
|
134
|
-
cursor: pointer;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.dpk-tag:hover {
|
|
138
|
-
background: var(--dpk-paper-sunken);
|
|
139
|
-
color: var(--dpk-ink);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.dpk-tag[aria-pressed='true'] {
|
|
143
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
144
|
-
background: var(--dpk-blue-soft);
|
|
145
|
-
color: var(--dpk-blue);
|
|
146
|
-
font-weight: 600;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.dpk-tag-count {
|
|
150
|
-
font-family: var(--dpk-mono);
|
|
151
|
-
font-size: 9px;
|
|
152
|
-
opacity: 0.7;
|
|
153
|
-
font-variant-numeric: tabular-nums;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.dpk-tag-clear {
|
|
157
|
-
border: 0;
|
|
158
|
-
background: none;
|
|
159
|
-
padding: 4px 6px;
|
|
160
|
-
color: var(--dpk-ink-faint);
|
|
161
|
-
font-size: 10px;
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.diagram-canvas {
|
|
166
|
-
position: relative;
|
|
167
|
-
flex: 1;
|
|
168
|
-
min-height: 220px;
|
|
169
|
-
overflow: hidden;
|
|
170
|
-
touch-action: none;
|
|
171
|
-
cursor: grab;
|
|
172
|
-
background-color: var(--dpk-paper-raised);
|
|
173
|
-
background-image: radial-gradient(var(--dpk-rule-strong) 0.7px, transparent 0.7px);
|
|
174
|
-
background-size: 22px 22px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.diagram-canvas:focus-visible {
|
|
178
|
-
outline: none;
|
|
179
|
-
box-shadow: inset var(--dpk-focus);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.diagram-canvas.is-panning {
|
|
183
|
-
cursor: grabbing;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.diagram-world {
|
|
187
|
-
position: absolute;
|
|
188
|
-
inset: 0 auto auto 0;
|
|
189
|
-
transform-origin: 0 0;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.diagram-edges {
|
|
193
|
-
position: absolute;
|
|
194
|
-
inset: 0;
|
|
195
|
-
overflow: visible;
|
|
196
|
-
pointer-events: none;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.diagram-zoom {
|
|
200
|
-
position: absolute;
|
|
201
|
-
right: 12px;
|
|
202
|
-
bottom: 12px;
|
|
203
|
-
display: flex;
|
|
204
|
-
overflow: hidden;
|
|
205
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
206
|
-
border-radius: var(--dpk-radius-sm);
|
|
207
|
-
background: var(--dpk-paper-raised);
|
|
208
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.diagram-zoom button {
|
|
212
|
-
border: 0;
|
|
213
|
-
border-radius: 0;
|
|
214
|
-
padding: 6px 9px;
|
|
215
|
-
background: transparent;
|
|
216
|
-
font-size: 10.5px;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.diagram-zoom button:hover {
|
|
221
|
-
background: var(--dpk-paper-sunken);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.diagram-legend {
|
|
225
|
-
position: absolute;
|
|
226
|
-
left: 12px;
|
|
227
|
-
bottom: 14px;
|
|
228
|
-
display: flex;
|
|
229
|
-
gap: 12px;
|
|
230
|
-
flex-wrap: wrap;
|
|
231
|
-
max-width: calc(100% - 150px);
|
|
232
|
-
padding: 3px 6px;
|
|
233
|
-
border-radius: var(--dpk-radius-xs);
|
|
234
|
-
background: color-mix(in srgb, var(--dpk-paper-raised) 88%, transparent);
|
|
235
|
-
font-size: 9.5px;
|
|
236
|
-
color: var(--dpk-ink-faint);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.diagram-legend span {
|
|
240
|
-
display: inline-flex;
|
|
241
|
-
align-items: center;
|
|
242
|
-
gap: 5px;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.diagram-legend i {
|
|
246
|
-
width: 16px;
|
|
247
|
-
border-top: 1.6px solid var(--dpk-rule-strong);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.diagram-empty,
|
|
251
|
-
.diagram-notice {
|
|
252
|
-
position: absolute;
|
|
253
|
-
left: 50%;
|
|
254
|
-
top: 50%;
|
|
255
|
-
transform: translate(-50%, -50%);
|
|
256
|
-
margin: 0;
|
|
257
|
-
font-size: 12px;
|
|
258
|
-
color: var(--dpk-ink-faint);
|
|
259
|
-
text-align: center;
|
|
260
|
-
pointer-events: none;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.diagram-notice {
|
|
264
|
-
pointer-events: auto;
|
|
265
|
-
padding: 12px 16px;
|
|
266
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
267
|
-
border-radius: var(--dpk-radius);
|
|
268
|
-
background: var(--dpk-paper-raised);
|
|
269
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
270
|
-
color: var(--dpk-ink-soft);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.diagram-notice p {
|
|
274
|
-
margin: 0 0 9px;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/*
|
|
278
|
-
* Contextual comments: an icon per element, revealed while the element that
|
|
279
|
-
* contains it (or the element just before it) is hovered, focused or
|
|
280
|
-
* selected, and always on touch devices. It opens the composer beside it.
|
|
281
|
-
*/
|
|
282
|
-
.diagram-comment-trigger {
|
|
283
|
-
display: grid;
|
|
284
|
-
place-items: center;
|
|
285
|
-
width: 28px;
|
|
286
|
-
height: 28px;
|
|
287
|
-
padding: 5px;
|
|
288
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
289
|
-
border-radius: var(--dpk-radius-sm);
|
|
290
|
-
background: var(--dpk-paper-raised);
|
|
291
|
-
color: var(--dpk-ink-soft);
|
|
292
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
293
|
-
cursor: pointer;
|
|
294
|
-
opacity: 0;
|
|
295
|
-
pointer-events: none;
|
|
296
|
-
transition: opacity 120ms ease;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.diagram-comment-trigger.is-placed {
|
|
300
|
-
position: absolute;
|
|
301
|
-
z-index: 2;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.diagram-comment-trigger svg {
|
|
305
|
-
width: 16px;
|
|
306
|
-
height: 16px;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.diagram-edge-comment {
|
|
310
|
-
overflow: visible;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.diagram-edge-comment .diagram-comment-trigger {
|
|
314
|
-
margin: 2px;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
:is(.d-node, .d-edge):is(:hover, :focus-within, .is-selected) .diagram-comment-trigger,
|
|
318
|
-
:is(:hover, :focus-visible, .is-selected) + .diagram-comment-trigger,
|
|
319
|
-
.diagram-comment-trigger:is(:hover, :focus-visible, [aria-expanded='true']) {
|
|
320
|
-
opacity: 1;
|
|
321
|
-
pointer-events: auto;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.diagram-comment-trigger:hover,
|
|
325
|
-
.diagram-comment-trigger:focus-visible {
|
|
326
|
-
color: var(--dpk-accent);
|
|
327
|
-
border-color: var(--dpk-accent);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
@media (hover: none) {
|
|
331
|
-
.diagram-comment-trigger {
|
|
332
|
-
opacity: 1;
|
|
333
|
-
pointer-events: auto;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.comment-target {
|
|
338
|
-
font-size: 12px;
|
|
339
|
-
overflow-wrap: anywhere;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.comment-error {
|
|
343
|
-
margin: 0;
|
|
344
|
-
font-size: 11px;
|
|
345
|
-
color: var(--dpk-accent);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/* Element state, shared by every diagram so highlighting reads the same. */
|
|
349
|
-
.d-node {
|
|
350
|
-
position: absolute;
|
|
351
|
-
cursor: pointer;
|
|
352
|
-
transition:
|
|
353
|
-
opacity 150ms ease,
|
|
354
|
-
border-color 150ms ease,
|
|
355
|
-
box-shadow 150ms ease;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.d-node.is-dimmed,
|
|
359
|
-
.d-edge.is-dimmed {
|
|
360
|
-
opacity: 0.26;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.d-edge {
|
|
364
|
-
outline: none;
|
|
365
|
-
cursor: pointer;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.d-edge-hit {
|
|
369
|
-
fill: none;
|
|
370
|
-
stroke: transparent;
|
|
371
|
-
stroke-width: 16;
|
|
372
|
-
pointer-events: stroke;
|
|
373
|
-
cursor: pointer;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
.d-edge-path {
|
|
377
|
-
fill: none;
|
|
378
|
-
stroke: var(--dpk-rule-strong);
|
|
379
|
-
stroke-width: 1.5;
|
|
380
|
-
stroke-linejoin: round;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.d-edge.is-selected .d-edge-path,
|
|
384
|
-
.d-edge:focus-visible .d-edge-path {
|
|
385
|
-
stroke: var(--dpk-ink);
|
|
386
|
-
stroke-width: 2.4;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.d-edge:focus-visible .d-edge-hit {
|
|
390
|
-
stroke: var(--dpk-blue-soft);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.d-edge-label {
|
|
394
|
-
font-size: 9.5px;
|
|
395
|
-
fill: var(--dpk-ink-faint);
|
|
396
|
-
paint-order: stroke;
|
|
397
|
-
stroke: var(--dpk-paper-raised);
|
|
398
|
-
stroke-width: 5px;
|
|
399
|
-
stroke-linejoin: round;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.d-edge-label.is-dimmed {
|
|
403
|
-
opacity: 0.3;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
@media (max-width: 700px) {
|
|
407
|
-
.diagram-subject {
|
|
408
|
-
display: none;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
`],ee=n=>n.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),Ne=n=>I`
|
|
412
|
-
<defs>
|
|
413
|
-
${n.map(e=>I`
|
|
414
|
-
<marker
|
|
415
|
-
id=${e.id}
|
|
416
|
-
viewBox="0 0 10 10"
|
|
417
|
-
refX="9"
|
|
418
|
-
refY="5"
|
|
419
|
-
markerWidth="7"
|
|
420
|
-
markerHeight="7"
|
|
421
|
-
orient="auto-start-reverse"
|
|
422
|
-
>
|
|
423
|
-
<path
|
|
424
|
-
class="diagram-arrow"
|
|
425
|
-
d=${e.open===!0?"M1 1 L9 5 L1 9":"M1 1 L9 5 L1 9 Z"}
|
|
426
|
-
fill=${e.open===!0||e.color===void 0?w:e.color}
|
|
427
|
-
stroke=${e.color??w}
|
|
428
|
-
stroke-width="1.3"
|
|
429
|
-
></path>
|
|
430
|
-
</marker>
|
|
431
|
-
`)}
|
|
432
|
-
</defs>
|
|
433
|
-
`,Es=(n,e,t,s)=>g`
|
|
434
|
-
<div class="diagram-tags" role="group" aria-label=${n.tagFilter}>
|
|
435
|
-
<div class="diagram-match" role="group" aria-label=${n.tagMatch}>
|
|
436
|
-
${[["single","Single"],["all","AND"],["any","OR"]].map(([a,r])=>g`
|
|
437
|
-
<button
|
|
438
|
-
type="button"
|
|
439
|
-
data-match=${a}
|
|
440
|
-
aria-pressed=${t===a?"true":"false"}
|
|
441
|
-
@click=${()=>s({kind:"match",match:a})}
|
|
442
|
-
>
|
|
443
|
-
${r}
|
|
444
|
-
</button>
|
|
445
|
-
`)}
|
|
446
|
-
</div>
|
|
447
|
-
${me(e,a=>a.tag,a=>g`
|
|
448
|
-
<button
|
|
449
|
-
type="button"
|
|
450
|
-
class="dpk-tag"
|
|
451
|
-
data-tag=${a.tag}
|
|
452
|
-
aria-pressed=${a.selected?"true":"false"}
|
|
453
|
-
@click=${()=>s({kind:"tag",tag:a.tag})}
|
|
454
|
-
>
|
|
455
|
-
${a.tag}<span class="dpk-tag-count">${a.count}</span>
|
|
456
|
-
</button>
|
|
457
|
-
`)}
|
|
458
|
-
${e.some(a=>a.selected)?g`<button type="button" class="dpk-tag-clear" @click=${()=>s({kind:"clear-tags"})}>
|
|
459
|
-
${n.clearTags}
|
|
460
|
-
</button>`:w}
|
|
461
|
-
</div>
|
|
462
|
-
`,Ds=(n,e)=>g`
|
|
463
|
-
<div class="diagram-zoom">
|
|
464
|
-
<button
|
|
465
|
-
type="button"
|
|
466
|
-
aria-label=${n.zoomOut}
|
|
467
|
-
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1/1.1})}}
|
|
468
|
-
>
|
|
469
|
-
−
|
|
470
|
-
</button>
|
|
471
|
-
<button
|
|
472
|
-
type="button"
|
|
473
|
-
class="diagram-zoom-value"
|
|
474
|
-
title=${n.fit}
|
|
475
|
-
aria-label=${n.fit}
|
|
476
|
-
@click=${()=>e?.({kind:"fit"})}
|
|
477
|
-
>
|
|
478
|
-
100%
|
|
479
|
-
</button>
|
|
480
|
-
<button
|
|
481
|
-
type="button"
|
|
482
|
-
aria-label=${n.zoomIn}
|
|
483
|
-
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1.1})}}
|
|
484
|
-
>
|
|
485
|
-
+
|
|
486
|
-
</button>
|
|
487
|
-
</div>
|
|
488
|
-
`,xe=.08,zs=1.8,Ts=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...n.map(r=>r.x)),t=Math.min(...n.map(r=>r.y)),s=Math.max(...n.map(r=>r.x+r.width))-e,a=Math.max(...n.map(r=>r.y+r.height))-t;return{x:e-s*.1,y:t-a*.1,width:s*1.2,height:a*1.2}},ve=(n,e)=>n+e/12,ye=16,_e=(n,e,t,s,a="center")=>{if(e.width===0||e.height===0)return{...n,x:0,y:0};const r=(i,o,d,l)=>{const m=d*n.scale;return m<=l?a==="start"?ye-ve(o,d)*n.scale:(l-m)/2-o*n.scale:Math.min(-o*n.scale,Math.max(l-(o+d)*n.scale,i))};return{...n,x:r(n.x,e.x,e.width,t),y:r(n.y,e.y,e.height,s)}},As=(n,e,t,s,a,r,i="center")=>{const o=_e({...n,x:n.x-a,y:n.y-r},e,t,s,i);return Math.abs(r)>Math.abs(a)&&o.y===n.y?null:o},Ve='button,[role="button"],a,input,textarea,select',Ls=n=>{const{canvas:e,world:t,onClearSelection:s,onView:a,align:r="center"}=n;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:u,height:y}=d();o=_e(o,i,u,y,r),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,a?.(o)},m=()=>{const{width:u,height:y}=d(),q=i.width/1.2||1,L=i.height/1.2||1;o={...o,scale:de(Math.min((u-24)/q,(y-40)/L),xe,1)},o={...o,x:(u-i.width*o.scale)/2-i.x*o.scale,y:(y-i.height*o.scale)/2-i.y*o.scale},l()},b=()=>{const{width:u}=d(),y=i.width/1.2||1,q=de((u-24)/y,xe,1);o={scale:q,x:(u-i.width*q)/2-i.x*q,y:16},l()},c=()=>{o={scale:1,x:ye-ve(i.x,i.width),y:ye-ve(i.y,i.height)},l()},h=(u,y=d().width/2,q=d().height/2)=>{const L=o.scale,R=de(L*u,xe,zs);R!==L&&(o={scale:R,x:y-(y-o.x)*R/L,y:q-(q-o.y)*R/L},l())},M=u=>{if(u.target instanceof Element&&u.target.closest(".diagram-zoom"))return;const y=u.deltaMode===1?16:u.deltaMode===2?d().height:1;if(u.ctrlKey||u.metaKey){u.preventDefault();const Y=e.getBoundingClientRect();h(Math.exp(-de(u.deltaY*y,-60,60)*.0012),u.clientX-Y.left,u.clientY-Y.top);return}const{width:q,height:L}=d(),R=As(o,i,q,L,u.deltaX*y,u.deltaY*y,r);R!==null&&(u.preventDefault(),o=R,l())},v=new Map;let k=null,C=!1;const T=()=>{const u=[...v.values()],y=u[0];if(!y)return null;const q=u[1];return q?{x:(y.x+q.x)/2,y:(y.y+q.y)/2,distance:Math.hypot(q.x-y.x,q.y-y.y)}:{...y,distance:0}},O=u=>{v.size===0&&(C=!1);const q=(u.target instanceof Element?u.target:null)?.closest(Ve)??null;u.button!==0||u.pointerType!=="touch"&&q!==null||(v.set(u.pointerId,{x:u.clientX,y:u.clientY}),k=T(),q===null&&e.setPointerCapture(u.pointerId))},P=u=>{if(!v.has(u.pointerId)||k===null)return;v.set(u.pointerId,{x:u.clientX,y:u.clientY});const y=T();if(y===null)return;const q=y.x-k.x,L=y.y-k.y;if((Math.abs(q)+Math.abs(L)>1||Math.abs(y.distance-k.distance)>1)&&(C=!0),y.distance>0&&k.distance>0){const R=e.getBoundingClientRect();h(Math.pow(y.distance/k.distance,.45),k.x-R.left,k.y-R.top)}o={...o,x:o.x+q,y:o.y+L},l(),k=y,e.classList.toggle("is-panning",C)},F=u=>{v.delete(u.pointerId),k=T(),!(v.size>0)&&(e.classList.remove("is-panning"),u.type==="pointercancel"&&(C=!1))},oe=u=>{C&&(u.preventDefault(),u.stopPropagation()),F(u)},x=u=>{if(C){u.preventDefault(),u.stopPropagation(),C=!1;return}const y=u.target instanceof Element?u.target:null;y===null||y.closest(Ve)!==null||s()},D=u=>{if(u.target!==e)return;const y=30;if(u.key==="+"||u.key==="=")h(1.1);else if(u.key==="-")h(1/1.1);else if(u.key==="0")m();else if(u.key==="Escape")s();else if(u.key==="ArrowLeft"||u.key==="ArrowRight"||u.key==="ArrowUp"||u.key==="ArrowDown")o={...o,x:o.x+(u.key==="ArrowLeft"?y:u.key==="ArrowRight"?-y:0),y:o.y+(u.key==="ArrowUp"?y:u.key==="ArrowDown"?-y:0)},l();else return;u.preventDefault()},A=u=>{const y=u.target instanceof HTMLElement?u.target:null;if(y===null||!t.contains(y))return;const q=y.getBoundingClientRect(),L=e.getBoundingClientRect();let R=0,Y=0;q.left<L.left+12?R=L.left+12-q.left:q.right>L.right-12&&(R=L.right-12-q.right),q.top<L.top+12?Y=L.top+12-q.top:q.bottom>L.bottom-40&&(Y=L.bottom-40-q.bottom),!(R===0&&Y===0)&&(o={...o,x:o.x+R,y:o.y+Y},l())};e.addEventListener("wheel",M,{passive:!1}),e.addEventListener("pointerdown",O),e.addEventListener("pointermove",P),e.addEventListener("pointerup",oe),e.addEventListener("pointercancel",F),e.addEventListener("lostpointercapture",F),e.addEventListener("click",x,!0),e.addEventListener("keydown",D),e.addEventListener("focusin",A);const H=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return H?.observe(e),{setContent(u){i=Ts(u.width===0&&u.height===0?[]:[u]),t.style.width=`${u.width}px`,t.style.height=`${u.height}px`,l()},apply:l,fit:m,fitWidth:b,reset:c,zoom:h,view:()=>({...o}),destroy(){H?.disconnect(),e.removeEventListener("wheel",M),e.removeEventListener("pointerdown",O),e.removeEventListener("pointermove",P),e.removeEventListener("pointerup",oe),e.removeEventListener("pointercancel",F),e.removeEventListener("lostpointercapture",F),e.removeEventListener("click",x,!0),e.removeEventListener("keydown",D),e.removeEventListener("focusin",A)}}};class we extends Wt{static{this.styles=W}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=null;#n=[];#t=[];#a=null;#i=xs;#r=null;#o=null;#l=null;#p=null;#u=-1;#c="";#d=null;#b=null;#h=new Map;#m=null;#g=new Map;#f=null;#v=new is(this);#k=new Gt(this,()=>{this.#c=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#c="",this.requestUpdate(),this.#p=cs(this,e=>this.parseData(e),e=>{e.ok?this.#S(e.value):this.#L(e.error)})}disconnectedCallback(){super.disconnectedCallback(),this.#p?.(),this.#p=null,this.#o?.destroy(),this.#o=null,this.#l=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#S(this.data)}updated(){this.#q(),this.#y(),this.#E(),this.#D()}#y(){const e=this.renderRoot.querySelector(".diagram");if(!(this.#f===null||!e||typeof e.showPopover!="function")&&!e.matches(":popover-open"))try{e.showPopover()}catch{}}#q(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#c&&(this.#c=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#E(){this.#l=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??=Ls({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#x(null),onView:r=>{this.#l&&(this.#l.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 a=this.layoutVersion();a!==this.#u&&(this.#u=a,this.initialView())}#D(){const e=this.#b!==this.#d;this.#b=this.#d;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#M();!t||!s||(this.#v.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.#a!==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(a=>a.value===s)&&this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:s},bubbles:!0,composed:!0}))}get elementActions(){return this.#n}set elementActions(e){this.#n=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 a=new CustomEvent("dpk-element-action",{detail:{type:e,target:this.commentRef(...t),payload:s},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(a),a.defaultPrevented}get selection(){return this.#r}select(e){this.#x(e)}get tagFilter(){return this.#i}set tagFilter(e){this.#i=e,this.requestUpdate()}get dataError(){return this.#a}resetView(){this.fitViewport()}#$(e){if(e===(this.#f!==null))return;const t=this.renderRoot.querySelector(".diagram");this.#f=e?{height:t?.offsetHeight??0}:null,this.#d=null,this.requestUpdate()}#z={handleEvent:e=>e.preventDefault(),passive:!1};#T={handleEvent:e=>{e.key!=="Escape"||this.#r!==null||(e.preventDefault(),this.#$(!1))},capture:!0};get locale(){return this.#k.locale}get chromeMessages(){return ks(this.#k.locale)}renderSelection(){const e=this.#d,t=e===null?void 0:this.#g.get(e);if(e===null||t===void 0)return w;const s=rs(this.#h.get(e)??"",[],{label:t,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return g`${as(e,os(ds(this.#k.locale),s,a=>this.#A(e,a)))}`}renderCommentTrigger(e,t,s){if(!this.id)return w;const a=this.commentRef(e.kind,e.id);return this.#g.set(a,t),g`<button
|
|
489
|
-
type="button"
|
|
490
|
-
class=${X("diagram-comment-trigger",s&&"is-placed")}
|
|
491
|
-
style=${s?`left:${s.x}px; top:${s.y}px`:w}
|
|
492
|
-
data-comment-kind=${e.kind}
|
|
493
|
-
data-comment-id=${e.id}
|
|
494
|
-
aria-label=${this.chromeMessages.commentOn(t)}
|
|
495
|
-
title=${this.chromeMessages.commentOn(t)}
|
|
496
|
-
aria-haspopup="dialog"
|
|
497
|
-
aria-expanded=${this.#d===a?"true":"false"}
|
|
498
|
-
@click=${()=>{this.#x(e),this.#d=a,this.requestUpdate()}}
|
|
499
|
-
>
|
|
500
|
-
${Yt()}
|
|
501
|
-
</button>`}renderEdgeCommentTrigger(e,t,s){const a=Math.floor((s.length-1)/2),r=s[a],i=s[a+1]??r;return!this.id||!r||!i?w:I`<foreignObject
|
|
502
|
-
class="diagram-edge-comment"
|
|
503
|
-
x=${(r.x+i.x)/2-16}
|
|
504
|
-
y=${(r.y+i.y)/2-16}
|
|
505
|
-
width="32"
|
|
506
|
-
height="32"
|
|
507
|
-
>${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===""?w: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 w}renderLegend(){return w}renderAboveCanvas(){return w}get viewport(){return this.#o}items(){return this.#s??this.emptyData()}authoredItems(){return this.#e??this.emptyData()}elementClass(e,...t){return X(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#S(e){this.#a=null,this.#e=e,this.#w()}#w(){if(this.#e===null){this.#t=this.#n.map(t=>({id:t.id,title:t.type,stale:"target-missing"})),this.requestUpdate();return}const e=this.reduceElementActions(this.#e,this.#n);this.#s=e.data,this.#t=e.results,this.#r!==null&&(this.hasSelection(this.#r)||(this.#r=null,this.#d=null)),this.requestUpdate()}#M(){const e=this.#r;return e?[...this.renderRoot.querySelectorAll("[data-comment-kind]")].find(t=>t.dataset.commentKind===e.kind&&t.dataset.commentId===e.id)??null:null}#A(e,t){if(t.kind==="input"){this.#h=new Map(this.#h).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.#h);r.delete(e),this.#h=r}this.#m=null;const s=this.#M();this.#x(null),s?.focus({preventScroll:!0})}#L(e){this.#a=e,this.#e=null,this.#s=null,this.#w(),console.error("[dev-process-kit] invalid diagram data:",e),this.requestUpdate()}hasSelection(e){return!0}#x(e){(e===null?this.#r===null:this.#r!==null&&this.#r.kind===e.kind&&this.#r.id===e.id)||(this.#r=e,this.#d=null,this.dispatchEvent(new CustomEvent("dpk-diagram-select",{detail:{selection:e},bubbles:!0,composed:!0})),this.requestUpdate())}#C=e=>{switch(e.kind){case"tag":this.#i=vs(this.#i,e.tag),this.requestUpdate();return;case"match":this.#i=ys(this.#i,e.match),this.requestUpdate();return;case"clear-tags":this.#i=ws(this.#i),this.requestUpdate();return;case"select":this.#x(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=Cs(this.tagItems(),this.#i),t=this.#f,s=this.chromeMessages,a=t===null?s.maximize:s.restore;return g`
|
|
508
|
-
${t===null?w:g`<div class="diagram-placeholder" style="height:${t.height}px"></div>`}
|
|
509
|
-
<div
|
|
510
|
-
class=${X("diagram",this.shellClass(),t!==null&&"is-maximized")}
|
|
511
|
-
popover=${t===null?w:"manual"}
|
|
512
|
-
@wheel=${t===null?w:this.#z}
|
|
513
|
-
@keydown=${t===null?w:this.#T}
|
|
514
|
-
>
|
|
515
|
-
<div class="diagram-toolbar">
|
|
516
|
-
<span class="diagram-title">${this.heading??this.defaultHeading()}</span>
|
|
517
|
-
${(this.subject??this.defaultSubject())===""?w:g`<span class="diagram-subject">${this.subject??this.defaultSubject()}</span>`}
|
|
518
|
-
<div class="diagram-toolbar-actions">
|
|
519
|
-
${this.renderToolbarActions()}
|
|
520
|
-
<span class="diagram-stats">${this.statsText()}</span>
|
|
521
|
-
<button
|
|
522
|
-
type="button"
|
|
523
|
-
class="dpk-icon-btn diagram-maximize"
|
|
524
|
-
aria-label=${a}
|
|
525
|
-
title=${a}
|
|
526
|
-
aria-pressed=${t===null?"false":"true"}
|
|
527
|
-
@click=${()=>this.#$(t===null)}
|
|
528
|
-
>
|
|
529
|
-
${t===null?Kt():Xt()}
|
|
530
|
-
</button>
|
|
531
|
-
</div>
|
|
532
|
-
</div>
|
|
533
|
-
${Es(s,e,this.#i.match,this.#C)} ${this.renderAboveCanvas()}
|
|
534
|
-
<div class="diagram-canvas" tabindex="0" aria-label=${s.canvas}>
|
|
535
|
-
<div class="diagram-world">${this.renderCanvas()}</div>
|
|
536
|
-
${this.isEmpty()?g`<p class="diagram-empty">${this.emptyMessage()}</p>`:w}
|
|
537
|
-
${this.#a===null?w:g`<p class="diagram-notice" role="alert">${s.dataError}<br />${this.#a}</p>`}
|
|
538
|
-
${this.renderLegend()} ${Ds(s,this.#C)}
|
|
539
|
-
</div>
|
|
540
|
-
${this.renderSelection()}
|
|
541
|
-
</div>
|
|
542
|
-
`}}class te extends we{#e=null;#s="";#n=0;#t=B;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 qs(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.#n}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 Be(e,this.selection,"node",this.#t)}edgeState(e){return Be(e,this.selection,"edge",this.#t)}renderEdges(e,t){const s=this.#e?.width??0,a=this.#e?.height??0;return g`<svg class="diagram-edges" width=${s} height=${a}>
|
|
543
|
-
${Ne(t)}${e}
|
|
544
|
-
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const a=e.edges.filter(i=>K(i.tags,this.tagFilter)&&this.matchesFilter(i)),r=new Set(a.flatMap(i=>[i.from,i.to]));return{...e,edges:a,nodes:e.nodes.filter(i=>r.has(i.id))}}const t=e.nodes.filter(a=>K(a.tags,this.tagFilter)&&this.matchesFilter(a)),s=new Set(t.map(a=>a.id));return{...e,nodes:t,edges:e.edges.filter(a=>s.has(a.from)&&s.has(a.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.#s&&(this.#s=t,this.#n+=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}})),a=this.layoutOptions();return this.layoutMode==="fixed"?bs(t,s,a):fs(t,s,a)}}const ce=N({en:{heading:"State machine",node:"State",edge:"Transition",empty:"No matching transitions.",transitionLabel:(n,e,t)=>`${t} from ${n} 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:(n,e,t)=>`${n} \u304B\u3089 ${e} \u3078\u306E ${t}`}}),Os=E({x:Q(),y:Q()}),Rs=E({id:$(p(),S(1)),name:$(p(),S(1)),code:f(p()),kind:f(U(["normal","initial","terminal","compensation"]),"normal"),description:f(p()),position:f(Os),questions:f(p())}),Is=E({id:$(p(),S(1)),from:$(p(),S(1)),to:$(p(),S(1)),title:$(p(),S(1)),kind:f(U(["normal","exception"]),"normal"),tags:f(z(p()),[]),guard:f(p()),effect:f(p()),questions:f(p())}),We={width:178,height:86},Ps=()=>({nodes:[],edges:[]}),js=E({states:z(Rs),transitions:f(z(Is),[])}),Ge=n=>{const e=V(js,n),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,a=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:We.width,height:We.height,tags:[],...i.position===void 0?{}:{position:i.position},...i.questions===void 0?{}:{questions:i.questions}})),edges:a}},Fs=n=>n.length>0&&n.every(e=>e.position!==void 0),Hs=_`
|
|
545
|
-
.state-node {
|
|
546
|
-
display: flex;
|
|
547
|
-
flex-direction: column;
|
|
548
|
-
justify-content: center;
|
|
549
|
-
gap: 6px;
|
|
550
|
-
padding: 0 15px;
|
|
551
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
552
|
-
border-radius: var(--dpk-radius);
|
|
553
|
-
background: var(--dpk-paper-raised);
|
|
554
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
555
|
-
text-align: left;
|
|
556
|
-
overflow: hidden;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
.state-node:hover {
|
|
560
|
-
border-color: var(--dpk-blue);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
.state-node.is-initial {
|
|
564
|
-
border-left-width: 3px;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
.state-node.is-terminal {
|
|
568
|
-
border: 3px double var(--dpk-rule-strong);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
.state-node.is-compensation {
|
|
572
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 50%, transparent);
|
|
573
|
-
background: var(--dpk-amber-soft);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
.state-node.is-selected {
|
|
577
|
-
border-color: var(--dpk-blue);
|
|
578
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
.state-node.is-related {
|
|
582
|
-
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
.state-code {
|
|
586
|
-
font-family: var(--dpk-mono);
|
|
587
|
-
font-size: 9px;
|
|
588
|
-
letter-spacing: 0.02em;
|
|
589
|
-
color: var(--dpk-ink-faint);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
.state-name {
|
|
593
|
-
font-size: 13.5px;
|
|
594
|
-
font-weight: 640;
|
|
595
|
-
letter-spacing: -0.01em;
|
|
596
|
-
white-space: nowrap;
|
|
597
|
-
overflow: hidden;
|
|
598
|
-
text-overflow: ellipsis;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/* The slot centres a label on its route and carries the label's comment icon beside it. */
|
|
602
|
-
.state-label-slot {
|
|
603
|
-
position: absolute;
|
|
604
|
-
transform: translate(-50%, -50%);
|
|
605
|
-
display: flex;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/* Overlaps the label by a hair so the pointer never crosses a gap that would hide it. */
|
|
609
|
-
.state-label-slot > .diagram-comment-trigger {
|
|
610
|
-
position: absolute;
|
|
611
|
-
left: calc(100% - 2px);
|
|
612
|
-
top: 50%;
|
|
613
|
-
transform: translateY(-50%);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
.state-label {
|
|
617
|
-
max-width: 190px;
|
|
618
|
-
padding: 3px 7px;
|
|
619
|
-
border: 1px solid transparent;
|
|
620
|
-
border-radius: var(--dpk-radius-xs);
|
|
621
|
-
background: var(--dpk-paper-raised);
|
|
622
|
-
color: var(--dpk-ink-soft);
|
|
623
|
-
font-size: 10px;
|
|
624
|
-
line-height: 1.5;
|
|
625
|
-
white-space: nowrap;
|
|
626
|
-
overflow: hidden;
|
|
627
|
-
text-overflow: ellipsis;
|
|
628
|
-
cursor: pointer;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
.state-label:hover {
|
|
632
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
633
|
-
color: var(--dpk-blue);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
.state-label.is-selected {
|
|
637
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
638
|
-
background: var(--dpk-blue-soft);
|
|
639
|
-
color: var(--dpk-blue);
|
|
640
|
-
font-weight: 600;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
.state-label.is-dimmed {
|
|
644
|
-
opacity: 0.35;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
.state-edge.is-exception .d-edge-path {
|
|
648
|
-
stroke: color-mix(in srgb, var(--dpk-amber) 65%, var(--dpk-rule-strong));
|
|
649
|
-
stroke-dasharray: 5 4;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
.state-edge.is-related .d-edge-path {
|
|
653
|
-
stroke: var(--dpk-green);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.state-edge.is-selected .d-edge-path {
|
|
657
|
-
stroke: var(--dpk-blue);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
.state-initial-mark {
|
|
661
|
-
fill: var(--dpk-ink-faint);
|
|
662
|
-
stroke: var(--dpk-ink-faint);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.state-initial-mark.is-dimmed {
|
|
666
|
-
opacity: 0.26;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
#state-arrow .diagram-arrow {
|
|
670
|
-
fill: var(--dpk-ink-faint);
|
|
671
|
-
stroke: var(--dpk-ink-faint);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
#state-arrow-active .diagram-arrow {
|
|
675
|
-
fill: var(--dpk-blue);
|
|
676
|
-
stroke: var(--dpk-blue);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
#state-arrow-exception .diagram-arrow {
|
|
680
|
-
fill: var(--dpk-amber);
|
|
681
|
-
stroke: var(--dpk-amber);
|
|
682
|
-
}
|
|
683
|
-
`,Us=[{id:"state-arrow"},{id:"state-arrow-active"},{id:"state-arrow-exception"}];class Ye extends te{static{this.styles=[W,Hs]}parseData(e){return Ge(e)}emptyData(){return Ps()}defaultHeading(){return ce(this.locale).heading}statsLabels(){const e=ce(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return ce(this.locale).empty}get tagDimension(){return"edge"}get layoutMode(){return Fs(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 B;const s=j(t.edges,e.id,"outgoing",!1),a=j(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...a.nodes]),edges:new Set([...s.edges,...a.edges])}}renderCanvas(){const e=this.visible.nodes,t=e.filter(s=>s.kind==="initial").map(s=>this.#n(s));return g`
|
|
684
|
-
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],Us)}
|
|
685
|
-
${e.map(s=>this.#a(s))} ${this.visible.edges.map(s=>this.#i(s))}
|
|
686
|
-
`}#e(e){return this.filtered().nodes.find(t=>t.id===e)?.name??e}#s(e){return[e.guard,e.effect].filter(t=>t!==null).join(`
|
|
687
|
-
`)||e.title}#n(e){const t=this.placedNode(e.id);if(!t)return w;const s=t.y+t.height/2,a=this.nodeState(e.id);return I`
|
|
688
|
-
<g class=${X("state-initial-mark",a.dimmed&&"is-dimmed")}>
|
|
689
|
-
<circle cx=${t.x-22} cy=${s} r="5"></circle>
|
|
690
|
-
<path
|
|
691
|
-
d=${ee([{x:t.x-17,y:s},{x:t.x-1,y:s}])}
|
|
692
|
-
stroke-width="1.6"
|
|
693
|
-
></path>
|
|
694
|
-
</g>
|
|
695
|
-
`}#t(e){const t=ce(this.locale),s=this.edgeState(e.id),a=this.routeOf(e.id),r=ee(a),o=s.selected||s.related?"state-arrow-active":e.kind==="exception"?"state-arrow-exception":"state-arrow",d=()=>this.select({kind:"edge",id:e.id});return I`
|
|
696
|
-
<g
|
|
697
|
-
class=${this.elementClass(s,"d-edge","state-edge",e.kind==="exception"&&"is-exception")}
|
|
698
|
-
data-transition=${e.id}
|
|
699
|
-
>
|
|
700
|
-
<title>${this.#s(e)}</title>
|
|
701
|
-
<path class="d-edge-path" d=${r} marker-end=${`url(#${o})`}></path>
|
|
702
|
-
<path
|
|
703
|
-
class="d-edge-hit"
|
|
704
|
-
d=${r}
|
|
705
|
-
role="button"
|
|
706
|
-
tabindex="0"
|
|
707
|
-
aria-label=${t.transitionLabel(this.#e(e.from),this.#e(e.to),e.title)}
|
|
708
|
-
@click=${d}
|
|
709
|
-
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
710
|
-
></path>
|
|
711
|
-
</g>
|
|
712
|
-
`}#a(e){const t=this.placedNode(e.id);if(!t)return w;const s=this.nodeState(e.id);return g`
|
|
713
|
-
<button
|
|
714
|
-
type="button"
|
|
715
|
-
class=${this.elementClass(s,"d-node","state-node",`is-${e.kind}`)}
|
|
716
|
-
data-state=${e.id}
|
|
717
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
718
|
-
style="left:${t.x}px; top:${t.y}px; width:${e.width}px; height:${e.height}px"
|
|
719
|
-
aria-pressed=${s.selected?"true":"false"}
|
|
720
|
-
title=${e.description??e.name}
|
|
721
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
722
|
-
>
|
|
723
|
-
<span class="state-name">${e.name}</span>
|
|
724
|
-
${e.code===null?w:g`<span class="state-code">${e.code}</span>`}
|
|
725
|
-
</button>
|
|
726
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:t.x+e.width-20,y:t.y-14})}
|
|
727
|
-
`}#i(e){const t=this.edgeState(e.id),s=Ms(this.routeOf(e.id));return g`
|
|
728
|
-
<span class="state-label-slot" style="left:${s.x}px; top:${s.y}px">
|
|
729
|
-
<button
|
|
730
|
-
type="button"
|
|
731
|
-
class=${this.elementClass(t,"state-label")}
|
|
732
|
-
data-transition-label=${e.id}
|
|
733
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
734
|
-
title=${this.#s(e)}
|
|
735
|
-
@click=${()=>this.select({kind:"edge",id:e.id})}
|
|
736
|
-
>
|
|
737
|
-
${e.title}
|
|
738
|
-
</button>
|
|
739
|
-
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#e(e.from)} \u2192 ${this.#e(e.to)} \xB7 ${e.title}`)}
|
|
740
|
-
</span>
|
|
741
|
-
`}}const Ke=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",Ye)},Xe=(n,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[n]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[n],se=N({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(n,e)=>`${n} / ${e} messages`,detailLabel:n=>Xe(n,!0),selectMessage:n=>`Select ${n}`,frameHeaderLabel:(n,e,t)=>`${n} \xB7 ${t?`Expand ${e}`:`Collapse ${e}`}`,frameCount:n=>`${n} message${n===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:(n,e)=>`${n} / ${e} \u30E1\u30C3\u30BB\u30FC\u30B8`,detailLabel:n=>Xe(n,!1),selectMessage:n=>`${n}\u3092\u9078\u629E`,frameHeaderLabel:(n,e,t)=>`${n} \xB7 ${e}\u3092${t?"\u5C55\u958B":"\u6298\u308A\u305F\u305F\u3080"}`,frameCount:n=>`${n} \u30E1\u30C3\u30BB\u30FC\u30B8`}}),Bs=E({kind:De("message"),id:$(p(),S(1)),from:$(p(),S(1)),to:$(p(),S(1)),title:$(p(),S(1)),style:f(U(["request","response","async"]),"request"),tags:f(z(p()),[]),guard:f(p()),detail:f(p()),questions:f(p())}),Ns=E({label:$(p(),S(1)),items:z(Ee())}),_s=E({kind:De("fragment"),id:$(p(),S(1)),operator:U(["alt","opt","loop","par"]),title:$(p(),S(1)),collapsed:f(ge(),!1),branches:$(z(Ns),S(1))}),Vs=Zt("kind",[Bs,_s]),Ws=E({id:$(p(),S(1)),name:$(p(),S(1)),role:f(p()),symbol:f(p()),kind:f(U(["internal","external"]),"internal"),description:f(p()),questions:f(p())}),Gs=E({participants:$(z(Ws),S(1)),items:f(z(Ee()),[])}),Ze=240,$e=(n,e,t)=>{if(n.has(e))throw new Error(`duplicate ${t} id: ${e}`);n.add(e)},Je=(n,e,t)=>n.map(s=>{const a=V(Vs,s);if(a.kind==="message"){if($e(t,a.id,"message"),!e.has(a.from))throw new Error(`unknown sender: ${a.from}`);if(!e.has(a.to))throw new Error(`unknown receiver: ${a.to}`);return{kind:"message",id:a.id,from:a.from,to:a.to,title:a.title,style:a.style,tags:a.tags,guard:a.guard??null,detail:a.detail??null,questions:a.questions??null}}return $e(t,a.id,"fragment"),{kind:"fragment",id:a.id,operator:a.operator,title:a.title,collapsed:a.collapsed,branches:a.branches.map(i=>({label:i.label,items:Je(i.items,e,t)}))}}),Qe=n=>{const e=V(Gs,n),t=new Set;for(const s of e.participants)$e(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:Je(e.items,t,new Set)}},Ys=()=>({participants:[],items:[]}),et=(n,e)=>{for(const t of n)if(t.kind==="message")e.push(t);else for(const s of t.branches)et(s.items,e)},G=n=>{const e=[];return et(n,e),e},Ks=n=>new Map(G(n.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),Xs=n=>G(n).length,tt=(n,e)=>{const t=[];for(const s of n){if(s.kind==="message"){e(s)&&t.push(s);continue}const a=s.branches.map(r=>({label:r.label,items:tt(r.items,e)})).filter(r=>r.items.length>0);a.length>0&&t.push({...s,branches:a})}return t},Zs=64,Js=86,Qs=31,en=32,tn=40,sn=(n,e)=>{const t=tt(n.items,e),s=new Set;for(const M of G(t))s.add(M.from),s.add(M.to);const a=n.participants.filter(M=>s.has(M.id)),r=new Map(a.map((M,v)=>[M.id,120+v*Ze])),i=Math.max(360,a.length*Ze),o=[],d=[],l=[],m=[],b=[];let c=25;const h=(M,v)=>{for(const k of M){if(k.kind==="message"){o.push({message:k,y:c+29,depth:v}),c+=k.from===k.to?Js:Zs;continue}const C=22+v*13,T=c,O=i-44-v*26;c+=Qs,k.collapsed?(b.push({fragment:k,x:C,y:c+6}),c+=tn):k.branches.forEach((P,F)=>{F>0&&(m.push({x:C,y:c,width:O}),c+=8),l.push({label:P.label,x:C+12,y:c}),c+=en,h(P.items,v+1),c+=8}),d.push({fragment:k,x:C,y:T,width:O,height:c-T,count:Xs([k])}),c+=14}};return h(t,0),{width:i,height:c+24,participants:a,rows:o,frames:d,branches:l,dividers:m,folds:b,x:r}},nn=_`
|
|
742
|
-
.sequence .diagram-canvas {
|
|
743
|
-
background-image: none;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
.sequence-rail {
|
|
747
|
-
position: relative;
|
|
748
|
-
height: 62px;
|
|
749
|
-
flex-shrink: 0;
|
|
750
|
-
overflow: hidden;
|
|
751
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
752
|
-
background: var(--dpk-paper);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
.sequence-rail-world {
|
|
756
|
-
position: absolute;
|
|
757
|
-
top: 0;
|
|
758
|
-
left: 0;
|
|
759
|
-
height: 62px;
|
|
760
|
-
transform-origin: 0 0;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
.sequence-participant {
|
|
764
|
-
position: absolute;
|
|
765
|
-
top: 9px;
|
|
766
|
-
width: 190px;
|
|
767
|
-
height: 44px;
|
|
768
|
-
display: flex;
|
|
769
|
-
align-items: center;
|
|
770
|
-
gap: 9px;
|
|
771
|
-
padding: 6px 10px;
|
|
772
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
773
|
-
border-radius: var(--dpk-radius-sm);
|
|
774
|
-
background: var(--dpk-paper-raised);
|
|
775
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
776
|
-
text-align: left;
|
|
777
|
-
cursor: pointer;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
.sequence-participant.is-external {
|
|
781
|
-
border-style: dashed;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
.sequence-participant[aria-pressed='true'] {
|
|
785
|
-
border-color: var(--dpk-blue);
|
|
786
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
.sequence-participant.is-related {
|
|
790
|
-
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
.sequence-symbol {
|
|
794
|
-
flex-shrink: 0;
|
|
795
|
-
display: grid;
|
|
796
|
-
place-items: center;
|
|
797
|
-
width: 26px;
|
|
798
|
-
height: 26px;
|
|
799
|
-
border-radius: var(--dpk-radius-xs);
|
|
800
|
-
background: var(--dpk-paper-inset);
|
|
801
|
-
color: var(--dpk-ink-faint);
|
|
802
|
-
font-family: var(--dpk-mono);
|
|
803
|
-
font-size: 9.5px;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
.sequence-participant.is-external .sequence-symbol {
|
|
807
|
-
background: var(--dpk-amber-soft);
|
|
808
|
-
color: var(--dpk-amber);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
.sequence-name {
|
|
812
|
-
display: block;
|
|
813
|
-
font-size: 11.5px;
|
|
814
|
-
font-weight: 640;
|
|
815
|
-
white-space: nowrap;
|
|
816
|
-
overflow: hidden;
|
|
817
|
-
text-overflow: ellipsis;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
.sequence-role {
|
|
821
|
-
display: block;
|
|
822
|
-
margin-top: 2px;
|
|
823
|
-
font-size: 9px;
|
|
824
|
-
color: var(--dpk-ink-faint);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
.sequence-lifeline {
|
|
828
|
-
stroke: var(--dpk-rule-strong);
|
|
829
|
-
stroke-width: 1;
|
|
830
|
-
stroke-dasharray: 4 6;
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
.sequence-divider {
|
|
834
|
-
stroke: var(--dpk-rule-strong);
|
|
835
|
-
stroke-dasharray: 4 4;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
.sequence-message {
|
|
839
|
-
fill: none;
|
|
840
|
-
stroke: var(--dpk-ink-faint);
|
|
841
|
-
stroke-width: 1.5;
|
|
842
|
-
stroke-linejoin: round;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
.sequence-message.is-response {
|
|
846
|
-
stroke-dasharray: 5 4;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
.sequence-message.is-async {
|
|
850
|
-
stroke: var(--dpk-blue);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
.sequence-message-row.is-related .sequence-message {
|
|
854
|
-
stroke: var(--dpk-green);
|
|
855
|
-
stroke-width: 2;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
.sequence-message-row.is-selected .sequence-message {
|
|
859
|
-
stroke: var(--dpk-ink);
|
|
860
|
-
stroke-width: 2.4;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
.sequence-message-row.is-dimmed,
|
|
864
|
-
.sequence-label.is-dimmed {
|
|
865
|
-
opacity: 0.24;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
.sequence-frame {
|
|
869
|
-
position: absolute;
|
|
870
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
871
|
-
border-radius: var(--dpk-radius-xs);
|
|
872
|
-
background: color-mix(in srgb, var(--dpk-blue-soft) 50%, transparent);
|
|
873
|
-
pointer-events: none;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
.sequence-frame-header {
|
|
877
|
-
position: absolute;
|
|
878
|
-
display: flex;
|
|
879
|
-
align-items: center;
|
|
880
|
-
gap: 9px;
|
|
881
|
-
padding: 5px 9px;
|
|
882
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
883
|
-
border-bottom: 0;
|
|
884
|
-
border-radius: var(--dpk-radius-xs) var(--dpk-radius-xs) 0 0;
|
|
885
|
-
background: var(--dpk-paper-sunken);
|
|
886
|
-
color: var(--dpk-ink-soft);
|
|
887
|
-
font-size: 10px;
|
|
888
|
-
text-align: left;
|
|
889
|
-
cursor: pointer;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
.sequence-frame-header:hover {
|
|
893
|
-
background: var(--dpk-paper-inset);
|
|
894
|
-
color: var(--dpk-ink);
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
.sequence-operator {
|
|
898
|
-
min-width: 26px;
|
|
899
|
-
font-family: var(--dpk-mono);
|
|
900
|
-
font-weight: 700;
|
|
901
|
-
color: var(--dpk-blue);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
.sequence-frame-count {
|
|
905
|
-
margin-left: auto;
|
|
906
|
-
font-family: var(--dpk-mono);
|
|
907
|
-
font-size: 9px;
|
|
908
|
-
color: var(--dpk-ink-faint);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.sequence-branch {
|
|
912
|
-
position: absolute;
|
|
913
|
-
font-size: 9.5px;
|
|
914
|
-
color: var(--dpk-ink-faint);
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.sequence-fold {
|
|
918
|
-
position: absolute;
|
|
919
|
-
font-size: 10px;
|
|
920
|
-
color: var(--dpk-ink-faint);
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
.sequence-label {
|
|
924
|
-
position: absolute;
|
|
925
|
-
display: flex;
|
|
926
|
-
align-items: center;
|
|
927
|
-
gap: 6px;
|
|
928
|
-
max-height: 27px;
|
|
929
|
-
padding: 3px 5px;
|
|
930
|
-
border: 1px solid transparent;
|
|
931
|
-
border-radius: var(--dpk-radius-xs);
|
|
932
|
-
background: var(--dpk-paper-raised);
|
|
933
|
-
color: var(--dpk-ink-soft);
|
|
934
|
-
font-size: 10px;
|
|
935
|
-
text-align: left;
|
|
936
|
-
cursor: pointer;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
.sequence-label:hover {
|
|
940
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
941
|
-
color: var(--dpk-blue);
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
.sequence-label.is-selected {
|
|
945
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
946
|
-
background: var(--dpk-blue-soft);
|
|
947
|
-
color: var(--dpk-blue);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
.sequence-number {
|
|
951
|
-
flex-shrink: 0;
|
|
952
|
-
display: grid;
|
|
953
|
-
place-items: center;
|
|
954
|
-
width: 19px;
|
|
955
|
-
height: 17px;
|
|
956
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
957
|
-
border-radius: 3px;
|
|
958
|
-
font-family: var(--dpk-mono);
|
|
959
|
-
font-size: 8px;
|
|
960
|
-
font-variant-numeric: tabular-nums;
|
|
961
|
-
color: var(--dpk-ink-faint);
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
.sequence-text {
|
|
965
|
-
min-width: 0;
|
|
966
|
-
white-space: nowrap;
|
|
967
|
-
overflow: hidden;
|
|
968
|
-
text-overflow: ellipsis;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
#seq-request .diagram-arrow,
|
|
972
|
-
#seq-response .diagram-arrow {
|
|
973
|
-
fill: var(--dpk-ink-faint);
|
|
974
|
-
stroke: var(--dpk-ink-faint);
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
#seq-async .diagram-arrow {
|
|
978
|
-
stroke: var(--dpk-blue);
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
#seq-related .diagram-arrow {
|
|
982
|
-
fill: var(--dpk-green);
|
|
983
|
-
stroke: var(--dpk-green);
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
#seq-selected .diagram-arrow {
|
|
987
|
-
fill: var(--dpk-ink);
|
|
988
|
-
stroke: var(--dpk-ink);
|
|
989
|
-
}
|
|
990
|
-
`,an=[{id:"seq-request"},{id:"seq-response"},{id:"seq-async"},{id:"seq-related"},{id:"seq-selected"}];class st extends we{static{this.styles=[W,nn]}#e=null;#s=new Map;#n=new Map;#t=new Set;#a=new Set;#i="";#r=0;commentItems(){const e=this.items();return[...e.participants.map(t=>({value:this.commentRef("participant",t.id),label:t.name})),...G(e.items).map(t=>({value:this.commentRef("message",t.id),label:t.title}))]}parseData(e){return this.#n.clear(),Qe(e)}emptyData(){return Ys()}defaultHeading(){return se(this.locale).heading}shellClass(){return"sequence"}emptyMessage(){return se(this.locale).empty}fitViewport(){this.viewport?.fitWidth()}onViewChange(e){const t=this.renderRoot.querySelector(".sequence-rail-world");t&&(t.style.transform=`translateX(${e.x}px) scale(${e.scale})`)}hasSelection(e){const t=this.items();return e.kind==="participant"?t.participants.some(s=>s.id===e.id):G(t.items).some(s=>s.id===e.id)}tagItems(){return G(this.items().items).map(e=>e.tags)}statsText(){const e=this.#e,t=G(this.items().items).length;return e===null?"":se(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.#r}refreshContent(){const e=this.#l(),t=this.tagFilter,s=[t.match,[...t.active].join(","),[...this.#n].map(([i,o])=>`${i}:${o}`).join(","),G(e.items).map(i=>i.id).join(",")].join("|");s!==this.#i&&(this.#i=s,this.#r+=1,this.#s=Ks(this.items()),this.#e=sn(e,i=>K(i.tags,t))),this.#t=new Set,this.#a=new Set;const a=this.selection,r=this.#e;if(a!==null&&r!==null)if(a.kind==="message"){const i=r.rows.find(o=>o.message.id===a.id);this.#t.add(a.id),i&&(this.#a.add(i.message.from),this.#a.add(i.message.to))}else for(const i of r.rows)i.message.from!==a.id&&i.message.to!==a.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(a=>a!==null).join(`
|
|
991
|
-
`)||e.title}#l(){const e=this.items(),t=s=>s.map(a=>a.kind==="message"?a:{...a,collapsed:this.#n.get(a.id)??a.collapsed,branches:a.branches.map(r=>({label:r.label,items:t(r.items)}))});return{participants:e.participants,items:t(e.items)}}#p(e){return this.#e?.frames.find(t=>t.fragment.id===e.id)?.fragment.collapsed??e.collapsed}#u(e){this.#n.set(e.id,!this.#p(e)),this.requestUpdate()}#c(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}}#d(e){const t=this.selection?.kind==="participant"&&this.selection.id===e,s=!t&&this.#a.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}renderAboveCanvas(){const e=this.#e;if(e===null)return w;const t=se(this.locale);return g`
|
|
992
|
-
<div class="sequence-rail" role="group" aria-label=${t.participants}>
|
|
993
|
-
<div class="sequence-rail-world">
|
|
994
|
-
${e.participants.map(s=>this.#b(s,e))}
|
|
995
|
-
</div>
|
|
996
|
-
</div>
|
|
997
|
-
`}#b(e,t){const s=t.x.get(e.id)??0,a=this.#d(e.id);return g`
|
|
998
|
-
<button
|
|
999
|
-
type="button"
|
|
1000
|
-
class=${this.elementClass(a,"sequence-participant",e.external&&"is-external")}
|
|
1001
|
-
data-participant=${e.id}
|
|
1002
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1003
|
-
style="left:${s-95}px"
|
|
1004
|
-
aria-pressed=${a.selected?"true":"false"}
|
|
1005
|
-
title=${e.description??e.name}
|
|
1006
|
-
@click=${()=>this.select({kind:"participant",id:e.id})}
|
|
1007
|
-
>
|
|
1008
|
-
<span class="sequence-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>
|
|
1009
|
-
<span>
|
|
1010
|
-
<span class="sequence-name">${e.name}</span>
|
|
1011
|
-
${e.role===null?w:g`<span class="sequence-role">${e.role}</span>`}
|
|
1012
|
-
</span>
|
|
1013
|
-
</button>
|
|
1014
|
-
${this.renderCommentTrigger({kind:"participant",id:e.id},e.name,{x:s+95-34,y:17})}
|
|
1015
|
-
`}renderCanvas(){const e=this.#e;if(e===null)return g``;const t=se(this.locale);return g`
|
|
1016
|
-
${this.#h(e,t)}
|
|
1017
|
-
${e.frames.map(s=>g`<div
|
|
1018
|
-
class="sequence-frame"
|
|
1019
|
-
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
1020
|
-
></div>`)}
|
|
1021
|
-
${e.frames.map(s=>this.#m(s.fragment,s.x,s.y,s.width,s.count,t))}
|
|
1022
|
-
${e.branches.map(s=>g`<span class="sequence-branch" style="left:${s.x}px; top:${s.y}px"
|
|
1023
|
-
>[${s.label}]</span
|
|
1024
|
-
>`)}
|
|
1025
|
-
${e.folds.map(s=>g`<span class="sequence-fold" style="left:${s.x}px; top:${s.y}px"
|
|
1026
|
-
>${s.fragment.branches.map(a=>`[${a.label}]`).join(" / ")}</span
|
|
1027
|
-
>`)}
|
|
1028
|
-
${e.rows.map(s=>this.#g(s.y,s.message,e,t))}
|
|
1029
|
-
`}#h(e,t){const s=e.participants.map(i=>I`<path
|
|
1030
|
-
class="sequence-lifeline"
|
|
1031
|
-
d=${`M${e.x.get(i.id)??0} 0 V${e.height}`}
|
|
1032
|
-
></path>`),a=e.dividers.map(i=>I`<path class="sequence-divider" d=${`M${i.x} ${i.y} h${i.width}`}></path>`),r=e.rows.map(i=>{const o=e.x.get(i.message.from)??0,d=e.x.get(i.message.to)??0,l=o===d?`M${o} ${i.y} h42 v25 H${o}`:`M${o} ${i.y} H${d}`,m=this.#c(i.message.id),b=m.selected?"seq-selected":m.related?"seq-related":i.message.style==="async"?"seq-async":i.message.style==="response"?"seq-response":"seq-request",c=()=>this.select({kind:"message",id:i.message.id});return I`
|
|
1033
|
-
<g
|
|
1034
|
-
class=${this.elementClass(m,"sequence-message-row","d-edge",`is-${i.message.style}`)}
|
|
1035
|
-
data-message=${i.message.id}
|
|
1036
|
-
>
|
|
1037
|
-
<title>${this.#o(i.message,t)}</title>
|
|
1038
|
-
<path class="d-edge-hit" d=${l} role="button" tabindex="0"
|
|
1039
|
-
aria-label=${t.selectMessage(i.message.title)}
|
|
1040
|
-
@click=${c}
|
|
1041
|
-
@keydown=${h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}></path>
|
|
1042
|
-
<path class="sequence-message is-${i.message.style}" d=${l} marker-end=${`url(#${b})`}></path>
|
|
1043
|
-
</g>
|
|
1044
|
-
`});return g`<svg class="diagram-edges" width=${e.width} height=${e.height}>
|
|
1045
|
-
${Ne(an)} ${s} ${a} ${r}
|
|
1046
|
-
</svg>`}#m(e,t,s,a,r,i){const o=this.#p(e);return g`
|
|
1047
|
-
<button
|
|
1048
|
-
type="button"
|
|
1049
|
-
class="sequence-frame-header"
|
|
1050
|
-
data-fragment=${e.id}
|
|
1051
|
-
style="left:${t}px; top:${s}px; width:${a}px"
|
|
1052
|
-
aria-expanded=${o?"false":"true"}
|
|
1053
|
-
aria-label=${i.frameHeaderLabel(e.operator,e.title,o)}
|
|
1054
|
-
@click=${()=>this.#u(e)}
|
|
1055
|
-
>
|
|
1056
|
-
<span aria-hidden="true">${o?"\u25B8":"\u25BE"}</span>
|
|
1057
|
-
<span class="sequence-operator">${e.operator}</span>
|
|
1058
|
-
<span class="sequence-text">${e.title}</span>
|
|
1059
|
-
<span class="sequence-frame-count">${i.frameCount(r)}</span>
|
|
1060
|
-
</button>
|
|
1061
|
-
`}#g(e,t,s,a){const r=s.x.get(t.from)??0,i=s.x.get(t.to)??0,o=r===i,d=this.#c(t.id),l=o?r+12:Math.min(r,i)+14,m=o?175:Math.abs(i-r)-28;return g`
|
|
1062
|
-
<button
|
|
1063
|
-
type="button"
|
|
1064
|
-
class=${this.elementClass(d,"sequence-label")}
|
|
1065
|
-
data-message-label=${t.id}
|
|
1066
|
-
data-grill-questions=${this.questionsOf(t)}
|
|
1067
|
-
style="left:${l}px; top:${e-28}px; width:${m}px"
|
|
1068
|
-
title=${this.#o(t,a)}
|
|
1069
|
-
@click=${()=>this.select({kind:"message",id:t.id})}
|
|
1070
|
-
>
|
|
1071
|
-
<span class="sequence-number">${this.#s.get(t.id)??""}</span>
|
|
1072
|
-
<span class="sequence-text">${t.title}</span>
|
|
1073
|
-
</button>
|
|
1074
|
-
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#s.get(t.id)??""} ${t.title}`.trim(),{x:l+m-30,y:e-31})}
|
|
1075
|
-
`}}const nt=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",st)},Z=N({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:n=>`Show only ${n} cycle group(s)`,cyclesCount:n=>`Cycles ${n}`,legendOutgoing:"Depends on",legendIncoming:"Depended on by",legendCycle:"Cycle",edgeLabel:(n,e)=>`${n} depends on ${e}`,cyclicSuffix:n=>`${n}, 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:n=>`\u5FAA\u74B0\u4F9D\u5B58 ${n} \u30B0\u30EB\u30FC\u30D7\u3060\u3051\u8868\u793A`,cyclesCount:n=>`\u5FAA\u74B0 ${n}`,legendOutgoing:"\u4F9D\u5B58\u5148",legendIncoming:"\u4F9D\u5B58\u5143",legendCycle:"\u5FAA\u74B0",edgeLabel:(n,e)=>`${n} \u304C ${e} \u306B\u4F9D\u5B58`,cyclicSuffix:n=>`${n}\u30FB\u5FAA\u74B0\u4F9D\u5B58\u3042\u308A`,cycleBadge:"\u5FAA\u74B0"}}),at={width:176,height:84},rn=E({id:$(p(),S(1)),name:$(p(),S(1)),path:f(p()),layer:f(p()),tags:f(z(p()),[]),description:f(p()),questions:f(p())}),on=E({id:$(p(),S(1)),from:$(p(),S(1)),to:$(p(),S(1)),contract:f(p()),description:f(p()),questions:f(p())}),dn=E({modules:z(rn),dependencies:f(z(on),[])}),ln=()=>({nodes:[],edges:[]}),cn=n=>{const e=V(dn,n),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,a=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:at.width,height:at.height,...i.questions===void 0?{}:{questions:i.questions}})),edges:a}},pn=_`
|
|
1076
|
-
.dep-direction {
|
|
1077
|
-
display: flex;
|
|
1078
|
-
gap: 1px;
|
|
1079
|
-
padding: 2px;
|
|
1080
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1081
|
-
border-radius: var(--dpk-radius-xs);
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
.dep-direction button {
|
|
1085
|
-
border: 0;
|
|
1086
|
-
border-radius: 3px;
|
|
1087
|
-
padding: 3px 7px;
|
|
1088
|
-
background: transparent;
|
|
1089
|
-
color: var(--dpk-ink-faint);
|
|
1090
|
-
font-size: 9.5px;
|
|
1091
|
-
cursor: pointer;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
.dep-direction button[aria-pressed='true'] {
|
|
1095
|
-
background: var(--dpk-blue-soft);
|
|
1096
|
-
color: var(--dpk-blue);
|
|
1097
|
-
font-weight: 650;
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
.dep-toggle {
|
|
1101
|
-
min-height: 26px;
|
|
1102
|
-
padding: 0 8px;
|
|
1103
|
-
font-size: 10.5px;
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
.dep-toggle[aria-pressed='true'] {
|
|
1107
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1108
|
-
background: var(--dpk-blue-soft);
|
|
1109
|
-
color: var(--dpk-blue);
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
.dep-module {
|
|
1113
|
-
display: flex;
|
|
1114
|
-
flex-direction: column;
|
|
1115
|
-
gap: 5px;
|
|
1116
|
-
padding: 11px 12px;
|
|
1117
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1118
|
-
border-radius: var(--dpk-radius-sm);
|
|
1119
|
-
background: var(--dpk-paper-raised);
|
|
1120
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
1121
|
-
text-align: left;
|
|
1122
|
-
overflow: hidden;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
.dep-module:hover {
|
|
1126
|
-
border-color: var(--dpk-blue);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
.dep-module.is-cyclic:not(.is-selected) {
|
|
1130
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
.dep-module.is-selected {
|
|
1134
|
-
border-color: var(--dpk-blue);
|
|
1135
|
-
background: var(--dpk-blue-soft);
|
|
1136
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
.dep-module.is-related {
|
|
1140
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1141
|
-
background: var(--dpk-green-soft);
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
.dep-module.is-dependency {
|
|
1145
|
-
border-color: color-mix(in srgb, #6e9b61 60%, transparent);
|
|
1146
|
-
background: color-mix(in srgb, #6e9b61 8%, transparent);
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
.dep-module.is-dependent {
|
|
1150
|
-
border-color: color-mix(in srgb, #729aaa 60%, transparent);
|
|
1151
|
-
background: color-mix(in srgb, #729aaa 8%, transparent);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
.dep-head {
|
|
1155
|
-
display: flex;
|
|
1156
|
-
align-items: center;
|
|
1157
|
-
justify-content: space-between;
|
|
1158
|
-
gap: 6px;
|
|
1159
|
-
min-height: 14px;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
.dep-layer {
|
|
1163
|
-
font-size: 9px;
|
|
1164
|
-
color: var(--dpk-ink-faint);
|
|
1165
|
-
white-space: nowrap;
|
|
1166
|
-
overflow: hidden;
|
|
1167
|
-
text-overflow: ellipsis;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
.dep-cycle-badge {
|
|
1171
|
-
flex-shrink: 0;
|
|
1172
|
-
padding: 1px 4px;
|
|
1173
|
-
border-radius: 3px;
|
|
1174
|
-
background: var(--dpk-amber-soft);
|
|
1175
|
-
color: var(--dpk-amber);
|
|
1176
|
-
font-size: 8.5px;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
.dep-name {
|
|
1180
|
-
font-size: 13px;
|
|
1181
|
-
font-weight: 640;
|
|
1182
|
-
letter-spacing: -0.01em;
|
|
1183
|
-
white-space: nowrap;
|
|
1184
|
-
overflow: hidden;
|
|
1185
|
-
text-overflow: ellipsis;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
.dep-path {
|
|
1189
|
-
font-family: var(--dpk-mono);
|
|
1190
|
-
font-size: 9px;
|
|
1191
|
-
color: var(--dpk-ink-faint);
|
|
1192
|
-
white-space: nowrap;
|
|
1193
|
-
overflow: hidden;
|
|
1194
|
-
text-overflow: ellipsis;
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
.dep-edge .d-edge-path {
|
|
1198
|
-
stroke: var(--dpk-rule-strong);
|
|
1199
|
-
stroke-width: 1.4;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
.dep-edge.is-related .d-edge-path {
|
|
1203
|
-
stroke: var(--dpk-green);
|
|
1204
|
-
stroke-width: 2;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
.dep-edge.is-selected .d-edge-path {
|
|
1208
|
-
stroke: var(--dpk-blue);
|
|
1209
|
-
stroke-width: 2.6;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
.dep-edge:focus-visible .d-edge-path {
|
|
1213
|
-
stroke: var(--dpk-blue);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
.diagram-legend .dep-swatch-outgoing {
|
|
1217
|
-
border-color: #6e9b61;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
.diagram-legend .dep-swatch-incoming {
|
|
1221
|
-
border-color: #729aaa;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
.diagram-legend .dep-swatch-cycle {
|
|
1225
|
-
border-color: var(--dpk-amber);
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
#dep-neutral .diagram-arrow {
|
|
1229
|
-
fill: var(--dpk-rule-strong);
|
|
1230
|
-
stroke: var(--dpk-rule-strong);
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
#dep-outgoing .diagram-arrow {
|
|
1234
|
-
fill: #6e9b61;
|
|
1235
|
-
stroke: #6e9b61;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
#dep-incoming .diagram-arrow {
|
|
1239
|
-
fill: #729aaa;
|
|
1240
|
-
stroke: #729aaa;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
#dep-cycle .diagram-arrow {
|
|
1244
|
-
fill: var(--dpk-amber);
|
|
1245
|
-
stroke: var(--dpk-amber);
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
#dep-selected .diagram-arrow {
|
|
1249
|
-
fill: var(--dpk-blue);
|
|
1250
|
-
stroke: var(--dpk-blue);
|
|
1251
|
-
}
|
|
1252
|
-
`,hn=[{id:"dep-neutral"},{id:"dep-outgoing"},{id:"dep-incoming"},{id:"dep-cycle"},{id:"dep-selected"}];class it extends te{static{this.styles=[W,pn]}#e="both";#s=!1;#n=!1;#t=[];#a=B;#i=B;parseData(e){return cn(e)}emptyData(){return ln()}defaultHeading(){return Z(this.locale).heading}statsLabels(){const e=Z(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){const e=Z(this.locale);return this.#n?e.emptyCycles:e.emptyModules}layoutOptions(){return{nodeSpacing:40,layerSpacing:96,padding:32}}relations(e,t){return e===null||e.kind!=="node"?B:{nodes:new Map([...this.#a.nodes,...this.#i.nodes]),edges:new Set([...this.#a.edges,...this.#i.edges])}}refreshContent(){const e=this.items(),t=this.tagFilter,s=e.nodes.filter(o=>K(o.tags,t)),a=new Set(s.map(o=>o.id)),r=e.edges.filter(o=>a.has(o.from)&&a.has(o.to));this.#t=Ss(s.map(o=>o.id),r);const i=this.selection;this.#a=i!==null&&i.kind==="node"&&this.#e!=="incoming"?j(r,i.id,"outgoing",this.#s):B,this.#i=i!==null&&i.kind==="node"&&this.#e!=="outgoing"?j(r,i.id,"incoming",this.#s):B,super.refreshContent()}matchesFilter(e){return this.#n?ke(this.#t).has(e.id):!0}filtered(){const e=super.filtered();if(!this.#n)return e;const t=ke(this.#t),s=e.edges.filter(r=>He(r,t)),a=new Set(s.flatMap(r=>[r.from,r.to]));return{nodes:e.nodes.filter(r=>a.has(r.id)),edges:s}}renderToolbarActions(){const e=Z(this.locale),t=this.#t.length;return g`
|
|
1253
|
-
<div class="dep-direction" role="group" aria-label=${e.directionGroup}>
|
|
1254
|
-
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,a])=>g`
|
|
1255
|
-
<button
|
|
1256
|
-
type="button"
|
|
1257
|
-
data-direction=${s}
|
|
1258
|
-
aria-pressed=${this.#e===s?"true":"false"}
|
|
1259
|
-
@click=${()=>this.#r(s)}
|
|
1260
|
-
>
|
|
1261
|
-
${a}
|
|
1262
|
-
</button>
|
|
1263
|
-
`)}
|
|
1264
|
-
</div>
|
|
1265
|
-
<button
|
|
1266
|
-
type="button"
|
|
1267
|
-
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1268
|
-
data-toggle="transitive"
|
|
1269
|
-
aria-pressed=${this.#s?"true":"false"}
|
|
1270
|
-
@click=${()=>{this.#s=!this.#s,this.requestUpdate()}}
|
|
1271
|
-
>
|
|
1272
|
-
${e.transitive}
|
|
1273
|
-
</button>
|
|
1274
|
-
<button
|
|
1275
|
-
type="button"
|
|
1276
|
-
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1277
|
-
data-toggle="cycles"
|
|
1278
|
-
aria-pressed=${this.#n?"true":"false"}
|
|
1279
|
-
aria-label=${e.cyclesToggleLabel(t)}
|
|
1280
|
-
?disabled=${!this.#n&&t===0}
|
|
1281
|
-
@click=${()=>{this.#n=!this.#n,this.requestUpdate()}}
|
|
1282
|
-
>
|
|
1283
|
-
${e.cyclesCount(t)}
|
|
1284
|
-
</button>
|
|
1285
|
-
`}renderLegend(){const e=Z(this.locale);return g`<div class="diagram-legend">
|
|
1286
|
-
<span><i class="dep-swatch-outgoing"></i>${e.legendOutgoing}</span>
|
|
1287
|
-
<span><i class="dep-swatch-incoming"></i>${e.legendIncoming}</span>
|
|
1288
|
-
<span><i class="dep-swatch-cycle"></i>${e.legendCycle}</span>
|
|
1289
|
-
</div>`}#r(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":He(e,t)?"dep-cycle":this.#a.edges.has(e.id)?"dep-outgoing":this.#i.edges.has(e.id)?"dep-incoming":"dep-neutral"}renderCanvas(){const e=Z(this.locale),t=this.visible,s=ke(this.#t),a=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),m=ee(l),b=()=>this.select({kind:"edge",id:o.id});return I`
|
|
1290
|
-
<g class=${this.elementClass(d,"d-edge","dep-edge")} data-dependency=${o.id}>
|
|
1291
|
-
<title>${[o.contract,o.description].filter(c=>c!==null).join(`
|
|
1292
|
-
`)||o.id}</title>
|
|
1293
|
-
<path class="d-edge-path" d=${m} marker-end=${`url(#${this.#o(o,s)})`}></path>
|
|
1294
|
-
<path
|
|
1295
|
-
class="d-edge-hit"
|
|
1296
|
-
d=${m}
|
|
1297
|
-
role="button"
|
|
1298
|
-
tabindex="0"
|
|
1299
|
-
aria-label=${e.edgeLabel(a(o.from),a(o.to))}
|
|
1300
|
-
@click=${b}
|
|
1301
|
-
@keydown=${c=>{c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),b())}}
|
|
1302
|
-
></path>
|
|
1303
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${a(o.from)} \u2192 ${a(o.to)}`,l)}
|
|
1304
|
-
</g>
|
|
1305
|
-
`}),i=t.nodes.map(o=>{const d=this.placedNode(o.id);if(!d)return w;const l=this.nodeState(o.id),m=s.has(o.id),b=this.#a.nodes.has(o.id),c=this.#i.nodes.has(o.id);return g`
|
|
1306
|
-
<button
|
|
1307
|
-
type="button"
|
|
1308
|
-
class=${this.elementClass(l,"d-node","dep-module",m&&"is-cyclic",b&&"is-dependency",c&&"is-dependent")}
|
|
1309
|
-
data-module=${o.id}
|
|
1310
|
-
data-grill-questions=${this.questionsOf(o)}
|
|
1311
|
-
style="left:${d.x}px; top:${d.y}px; width:${o.width}px; height:${o.height}px"
|
|
1312
|
-
aria-pressed=${l.selected?"true":"false"}
|
|
1313
|
-
aria-label=${m?e.cyclicSuffix(o.name):o.name}
|
|
1314
|
-
title=${[o.path??o.name,o.description].filter(h=>h!==null).join(`
|
|
1315
|
-
`)}
|
|
1316
|
-
@click=${()=>this.select({kind:"node",id:o.id})}
|
|
1317
|
-
>
|
|
1318
|
-
<span class="dep-head">
|
|
1319
|
-
<span class="dep-layer">${o.layer??""}</span>
|
|
1320
|
-
${m?g`<span class="dep-cycle-badge">${e.cycleBadge}</span>`:w}
|
|
1321
|
-
</span>
|
|
1322
|
-
<span class="dep-name">${o.name}</span>
|
|
1323
|
-
<span class="dep-path">${o.path??""}</span>
|
|
1324
|
-
</button>
|
|
1325
|
-
${this.renderCommentTrigger({kind:"node",id:o.id},o.name,{x:d.x+o.width-20,y:d.y-14})}
|
|
1326
|
-
`});return g`${this.renderEdges(r,hn)}${i}`}}const rt=()=>{customElements.get("dpk-component-dependency-graph")||customElements.define("dpk-component-dependency-graph",it)},ot=(n,e)=>e?{same:"Unchanged",added:"Added",removed:"Removed",changed:"Changed"}[n]:{same:"\u5909\u66F4\u306A\u3057",added:"\u8FFD\u52A0",removed:"\u524A\u9664",changed:"\u5909\u66F4"}[n],J=N({en:{heading:"ERD",node:"Table",edge:"Relation",empty:"No matching tables.",search:"Search",legendAdded:"Added",legendRemoved:"Removed",legendChanged:"Changed",statusLabel:n=>ot(n,!0),edgeLabel:(n,e)=>`${n} and ${e}, related`,nullable:"nullable"},ja:{heading:"ER\u56F3",node:"\u30C6\u30FC\u30D6\u30EB",edge:"\u95A2\u9023",empty:"\u8A72\u5F53\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",search:"\u691C\u7D22",legendAdded:"\u8FFD\u52A0",legendRemoved:"\u524A\u9664",legendChanged:"\u5909\u66F4",statusLabel:n=>ot(n,!1),edgeLabel:(n,e)=>`${n} \u3068 ${e} \u306E\u95A2\u9023`,nullable:"null\u53EF"}}),dt=276,Se=74,un=28,mn=44,gn=E({id:$(p(),S(1)),type:$(p(),S(1)),key:f(U(["PK","FK","UQ"])),ref:f(p()),nullable:f(ge(),!1),questions:f(p())}),fn=E({id:$(p(),S(1)),name:$(p(),S(1)),tags:f(z(p()),[]),fields:z(gn),questions:f(p())}),lt=E({tables:z(fn)}),bn=E({before:f(lt),after:lt}),kn=()=>({nodes:[],edges:[]}),ct=n=>({id:n.id,type:n.type,key:n.key??null,ref:n.ref??null,nullable:n.nullable,questions:n.questions??null}),pt=(n,e)=>n.type===e.type&&n.key===e.key&&n.ref===e.ref&&n.nullable===e.nullable,pe=n=>n.status==="changed"?mn:un,ht=n=>Se+n.reduce((e,t)=>e+pe(t),0),ut=(n,e)=>{let t=Se;for(const s of n){if(s.id===e)return t+pe(s)/2;t+=pe(s)}return Se/2},mt=n=>n.flatMap(e=>e.fields.flatMap(t=>{if(t.ref===void 0)return[];const[s,a]=t.ref.split(".");if(s===void 0||a===void 0)throw new Error(`invalid ref "${t.ref}" on ${e.id}.${t.id}; expected table.field`);return[{id:`${s}:${a}>${e.id}:${t.id}`,from:s,to:e.id,sourceField:a,targetField:t.id}]})),xn=(n,e)=>[...new Set([...n,...e].map(s=>s.id))].flatMap(s=>{const a=n.find(l=>l.id===s),r=e.find(l=>l.id===s),i=r??a;if(!i)return[];const o=ct(i);if(!a)return[{...o,status:"added",before:null}];if(!r)return[{...o,status:"removed",before:null}];const d=ct(a);return[{...o,status:pt(d,o)?"same":"changed",before:pt(d,o)?null:d}]}),vn=n=>{const e=V(bn,n),t=e.before?.tables??e.after.tables,s=e.after.tables,a=[...new Set([...t,...s].map(h=>h.id))],r=new Map;for(const h of[...t,...s])r.set(h.id,h.tags);const i=a.flatMap(h=>{const M=t.find(O=>O.id===h),v=s.find(O=>O.id===h),k=v??M;if(!k)return[];const C=xn(M?.fields??[],v?.fields??[]),T=M?v?C.some(O=>O.status!=="same")?"changed":"same":"removed":"added";return[{id:h,name:k.name,status:T,fields:C,tags:r.get(h)??[],width:dt,height:ht(C),...k.questions===void 0?{}:{questions:k.questions}}]}),o=new Map(i.map(h=>[h.id,h])),d=mt(t),l=mt(s),b=[...new Set([...d,...l].map(h=>h.id))].flatMap(h=>{const M=d.find(P=>P.id===h),v=l.find(P=>P.id===h),k=v??M;if(!k)return[];const C=o.get(k.from),T=o.get(k.to);if(!C||!T)return[];const O=M?v?"same":"removed":"added";return[{id:h,from:k.from,to:k.to,sourceField:k.sourceField,targetField:k.targetField,status:O,tags:[],fromPort:`${h}:out`,toPort:`${h}:in`}]}),c=h=>{const M={},v={};for(const k of b)k.from===h.id&&(M[`${k.id}:out`]={x:dt,y:ut(h.fields,k.sourceField)}),k.to===h.id&&(v[`${k.id}:in`]={x:0,y:ut(h.fields,k.targetField)});return{out:M,in:v}};return{nodes:i.map(h=>{const M=c(h);return{...h,ports:{...M.out,...M.in}}}),edges:b}},yn=_`
|
|
1327
|
-
.er-search {
|
|
1328
|
-
display: flex;
|
|
1329
|
-
align-items: center;
|
|
1330
|
-
gap: 6px;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
.er-search .dpk-input {
|
|
1334
|
-
width: 150px;
|
|
1335
|
-
min-height: 26px;
|
|
1336
|
-
font-size: 11px;
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
.er-table {
|
|
1340
|
-
display: flex;
|
|
1341
|
-
flex-direction: column;
|
|
1342
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1343
|
-
border-radius: var(--dpk-radius-sm);
|
|
1344
|
-
background: var(--dpk-paper-raised);
|
|
1345
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
1346
|
-
overflow: hidden;
|
|
1347
|
-
cursor: default;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
.er-table.is-added {
|
|
1351
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
.er-table.is-removed {
|
|
1355
|
-
border-color: color-mix(in srgb, var(--dpk-accent) 55%, transparent);
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
.er-table.is-changed {
|
|
1359
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
.er-table.is-selected {
|
|
1363
|
-
border-color: var(--dpk-blue);
|
|
1364
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
.er-table.is-related {
|
|
1368
|
-
border-color: color-mix(in srgb, var(--dpk-green) 50%, transparent);
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
.er-head {
|
|
1372
|
-
display: grid;
|
|
1373
|
-
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1374
|
-
grid-template-areas:
|
|
1375
|
-
'mark name status'
|
|
1376
|
-
'mark label status';
|
|
1377
|
-
align-items: center;
|
|
1378
|
-
gap: 1px 8px;
|
|
1379
|
-
width: 100%;
|
|
1380
|
-
min-height: 42px;
|
|
1381
|
-
padding: 7px 11px;
|
|
1382
|
-
border: 0;
|
|
1383
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
1384
|
-
border-radius: 0;
|
|
1385
|
-
background: var(--dpk-paper);
|
|
1386
|
-
text-align: left;
|
|
1387
|
-
cursor: pointer;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
.er-head:hover {
|
|
1391
|
-
background: var(--dpk-paper-sunken);
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
.er-table:has(> .diagram-comment-trigger) .er-head {
|
|
1395
|
-
padding-right: 46px;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
.er-table > .diagram-comment-trigger {
|
|
1399
|
-
position: absolute;
|
|
1400
|
-
top: 8px;
|
|
1401
|
-
right: 8px;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
.er-table:hover,
|
|
1405
|
-
.er-table:focus-within,
|
|
1406
|
-
.er-edge:hover,
|
|
1407
|
-
.er-edge:focus-within {
|
|
1408
|
-
opacity: 1;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
.er-mark {
|
|
1412
|
-
grid-area: mark;
|
|
1413
|
-
display: grid;
|
|
1414
|
-
place-items: center;
|
|
1415
|
-
width: 16px;
|
|
1416
|
-
height: 16px;
|
|
1417
|
-
border-radius: 3px;
|
|
1418
|
-
font-family: var(--dpk-mono);
|
|
1419
|
-
font-size: 10px;
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
.er-table.is-added .er-mark {
|
|
1423
|
-
background: var(--dpk-green-soft);
|
|
1424
|
-
color: var(--dpk-green);
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
.er-table.is-removed .er-mark {
|
|
1428
|
-
background: var(--dpk-accent-soft);
|
|
1429
|
-
color: var(--dpk-accent);
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
.er-table.is-changed .er-mark {
|
|
1433
|
-
background: var(--dpk-amber-soft);
|
|
1434
|
-
color: var(--dpk-amber);
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
.er-name {
|
|
1438
|
-
grid-area: name;
|
|
1439
|
-
font-family: var(--dpk-mono);
|
|
1440
|
-
font-size: 12px;
|
|
1441
|
-
font-weight: 640;
|
|
1442
|
-
letter-spacing: -0.01em;
|
|
1443
|
-
white-space: nowrap;
|
|
1444
|
-
overflow: hidden;
|
|
1445
|
-
text-overflow: ellipsis;
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
.er-label {
|
|
1449
|
-
grid-area: label;
|
|
1450
|
-
font-size: 9.5px;
|
|
1451
|
-
color: var(--dpk-ink-faint);
|
|
1452
|
-
white-space: nowrap;
|
|
1453
|
-
overflow: hidden;
|
|
1454
|
-
text-overflow: ellipsis;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
.er-status {
|
|
1458
|
-
grid-area: status;
|
|
1459
|
-
font-size: 8.5px;
|
|
1460
|
-
text-align: right;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
.er-fields {
|
|
1464
|
-
display: flex;
|
|
1465
|
-
flex-direction: column;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
.er-field {
|
|
1469
|
-
display: grid;
|
|
1470
|
-
grid-template-columns: 14px 26px minmax(0, 1fr) auto;
|
|
1471
|
-
align-items: center;
|
|
1472
|
-
gap: 6px;
|
|
1473
|
-
padding: 0 10px;
|
|
1474
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
1475
|
-
font-size: 10.5px;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
.er-field:last-child {
|
|
1479
|
-
border-bottom: 0;
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
.er-field.is-added {
|
|
1483
|
-
background: color-mix(in srgb, var(--dpk-green) 7%, transparent);
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
.er-field.is-removed {
|
|
1487
|
-
background: color-mix(in srgb, var(--dpk-accent) 7%, transparent);
|
|
1488
|
-
text-decoration: line-through;
|
|
1489
|
-
color: var(--dpk-ink-faint);
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
.er-field.is-changed {
|
|
1493
|
-
background: color-mix(in srgb, var(--dpk-amber) 7%, transparent);
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
.er-field.is-match {
|
|
1497
|
-
box-shadow: inset 2px 0 0 var(--dpk-blue);
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
.er-field-mark {
|
|
1501
|
-
font-family: var(--dpk-mono);
|
|
1502
|
-
font-size: 10px;
|
|
1503
|
-
text-align: center;
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
.er-field.is-added .er-field-mark {
|
|
1507
|
-
color: var(--dpk-green);
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
.er-field.is-removed .er-field-mark {
|
|
1511
|
-
color: var(--dpk-accent);
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
.er-field.is-changed .er-field-mark {
|
|
1515
|
-
color: var(--dpk-amber);
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
.er-key {
|
|
1519
|
-
display: grid;
|
|
1520
|
-
place-items: center;
|
|
1521
|
-
border-radius: 3px;
|
|
1522
|
-
background: var(--dpk-paper-inset);
|
|
1523
|
-
font-family: var(--dpk-mono);
|
|
1524
|
-
font-size: 8.5px;
|
|
1525
|
-
color: var(--dpk-ink-faint);
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
.er-key[data-empty='true'] {
|
|
1529
|
-
background: transparent;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
.er-field-name {
|
|
1533
|
-
font-family: var(--dpk-mono);
|
|
1534
|
-
white-space: nowrap;
|
|
1535
|
-
overflow: hidden;
|
|
1536
|
-
text-overflow: ellipsis;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
.er-field-type {
|
|
1540
|
-
font-size: 9.5px;
|
|
1541
|
-
color: var(--dpk-ink-faint);
|
|
1542
|
-
white-space: nowrap;
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
.er-change {
|
|
1546
|
-
display: flex;
|
|
1547
|
-
flex-direction: column;
|
|
1548
|
-
align-items: flex-end;
|
|
1549
|
-
font-size: 9px;
|
|
1550
|
-
line-height: 1.6;
|
|
1551
|
-
white-space: nowrap;
|
|
1552
|
-
text-align: right;
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
.er-change del {
|
|
1556
|
-
color: var(--dpk-accent);
|
|
1557
|
-
text-decoration: line-through;
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
.er-change ins {
|
|
1561
|
-
color: var(--dpk-green);
|
|
1562
|
-
text-decoration: none;
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
.er-edge .d-edge-path {
|
|
1566
|
-
stroke-width: 1.5;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
.er-edge.is-added .d-edge-path {
|
|
1570
|
-
stroke: var(--dpk-green);
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
.er-edge.is-removed .d-edge-path {
|
|
1574
|
-
stroke: var(--dpk-accent);
|
|
1575
|
-
stroke-dasharray: 5 4;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
.er-edge.is-selected .d-edge-path {
|
|
1579
|
-
stroke: var(--dpk-blue);
|
|
1580
|
-
stroke-width: 2.6;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
.er-cardinality {
|
|
1584
|
-
font-family: var(--dpk-mono);
|
|
1585
|
-
font-size: 10px;
|
|
1586
|
-
fill: var(--dpk-ink-faint);
|
|
1587
|
-
paint-order: stroke;
|
|
1588
|
-
stroke: var(--dpk-paper-raised);
|
|
1589
|
-
stroke-width: 4px;
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
.er-cardinality.is-added {
|
|
1593
|
-
fill: var(--dpk-green);
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
.er-cardinality.is-removed {
|
|
1597
|
-
fill: var(--dpk-accent);
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
.diagram-legend .er-swatch-added {
|
|
1601
|
-
border-color: var(--dpk-green);
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
.diagram-legend .er-swatch-removed {
|
|
1605
|
-
border-color: var(--dpk-accent);
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
.diagram-legend .er-swatch-changed {
|
|
1609
|
-
border-color: var(--dpk-amber);
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
#er-neutral .diagram-arrow {
|
|
1613
|
-
fill: var(--dpk-rule-strong);
|
|
1614
|
-
stroke: var(--dpk-rule-strong);
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
#er-added .diagram-arrow {
|
|
1618
|
-
fill: var(--dpk-green);
|
|
1619
|
-
stroke: var(--dpk-green);
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
#er-removed .diagram-arrow {
|
|
1623
|
-
fill: var(--dpk-accent);
|
|
1624
|
-
stroke: var(--dpk-accent);
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
#er-selected .diagram-arrow {
|
|
1628
|
-
fill: var(--dpk-blue);
|
|
1629
|
-
stroke: var(--dpk-blue);
|
|
1630
|
-
}
|
|
1631
|
-
`,wn=[{id:"er-neutral"},{id:"er-added"},{id:"er-removed"},{id:"er-selected"}],gt={same:"",added:"+",removed:"\u2212",changed:"~"};class ft extends te{static{this.styles=[W,yn]}#e="";parseData(e){return vn(e)}emptyData(){return kn()}defaultHeading(){return J(this.locale).heading}statsLabels(){const e=J(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return J(this.locale).empty}layoutOptions(){return{nodeSpacing:38,layerSpacing:96,padding:32}}matchesFilter(e){return this.#e===""?!0:[e.id,e.name,...e.fields.map(t=>t.id)].some(t=>t.toLowerCase().includes(this.#e))}relations(e,t){if(e===null||e.kind!=="node")return B;const s=j(t.edges,e.id,"outgoing",!1),a=j(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...a.nodes]),edges:new Set([...s.edges,...a.edges])}}renderToolbarActions(){const e=J(this.locale);return g`
|
|
1632
|
-
<label class="er-search">
|
|
1633
|
-
<span class="dpk-label">${e.search}</span>
|
|
1634
|
-
<input
|
|
1635
|
-
class="dpk-input"
|
|
1636
|
-
type="search"
|
|
1637
|
-
placeholder="table / field"
|
|
1638
|
-
.value=${this.#e}
|
|
1639
|
-
@input=${t=>{const s=t.currentTarget;s instanceof HTMLInputElement&&(this.#e=s.value.trim().toLowerCase(),this.requestUpdate())}}
|
|
1640
|
-
/>
|
|
1641
|
-
</label>
|
|
1642
|
-
`}renderLegend(){const e=J(this.locale);return g`<div class="diagram-legend">
|
|
1643
|
-
<span><i class="er-swatch-added"></i>${e.legendAdded}</span>
|
|
1644
|
-
<span><i class="er-swatch-removed"></i>${e.legendRemoved}</span>
|
|
1645
|
-
<span><i class="er-swatch-changed"></i>${e.legendChanged}</span>
|
|
1646
|
-
</div>`}#s(e){const t=this.selection;return t!==null&&t.kind==="edge"?"er-selected":e==="added"?"er-added":e==="removed"?"er-removed":"er-neutral"}renderCanvas(){const e=J(this.locale),t=this.visible,s=t.edges.map(a=>{const r=this.edgeState(a.id),i=this.routeOf(a.id),o=ee(i),d=()=>this.select({kind:"edge",id:a.id});return I`
|
|
1647
|
-
<g class=${this.elementClass(r,"d-edge","er-edge",`is-${a.status}`)} data-relation=${a.id}>
|
|
1648
|
-
<title>${`${a.from}.${a.sourceField} \u2192 ${a.to}.${a.targetField}`}</title>
|
|
1649
|
-
<path class="d-edge-path" d=${o} marker-end=${`url(#${this.#s(a.status)})`}></path>
|
|
1650
|
-
<path
|
|
1651
|
-
class="d-edge-hit"
|
|
1652
|
-
d=${o}
|
|
1653
|
-
role="button"
|
|
1654
|
-
tabindex="0"
|
|
1655
|
-
aria-label=${e.edgeLabel(a.from,a.to)}
|
|
1656
|
-
@click=${d}
|
|
1657
|
-
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
1658
|
-
></path>
|
|
1659
|
-
${i.length>0?this.#n(i,a.status):w}
|
|
1660
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:a.id},`${a.from}.${a.sourceField} \u2192 ${a.to}.${a.targetField}`,i)}
|
|
1661
|
-
</g>
|
|
1662
|
-
`});return g`${this.renderEdges(s,wn)}${t.nodes.map(a=>this.#t(a,e))}`}#n(e,t){const s=e[0],a=e.at(-1);return!s||!a?g``:I`
|
|
1663
|
-
<text class="er-cardinality is-${t}" x=${s.x+9} y=${s.y-5}>1</text>
|
|
1664
|
-
<text class="er-cardinality is-${t}" x=${a.x-13} y=${a.y-5}>N</text>
|
|
1665
|
-
`}#t(e,t){const s=this.placedNode(e.id);if(!s)return w;const a=this.nodeState(e.id);return g`
|
|
1666
|
-
<div
|
|
1667
|
-
class=${this.elementClass(a,"d-node","er-table",`is-${e.status}`)}
|
|
1668
|
-
data-er-table=${e.id}
|
|
1669
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1670
|
-
style="left:${s.x}px; top:${s.y}px; width:${e.width}px; height:${ht(e.fields)}px"
|
|
1671
|
-
>
|
|
1672
|
-
<button
|
|
1673
|
-
type="button"
|
|
1674
|
-
class="er-head"
|
|
1675
|
-
data-table=${e.id}
|
|
1676
|
-
aria-pressed=${a.selected?"true":"false"}
|
|
1677
|
-
title=${`${e.id} / ${e.name}`}
|
|
1678
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
1679
|
-
>
|
|
1680
|
-
${e.status==="same"?w:g`<span class="er-mark" aria-hidden="true">${gt[e.status]}</span>`}
|
|
1681
|
-
<span class="er-name">${e.id}</span>
|
|
1682
|
-
<span class="er-label">${e.name}</span>
|
|
1683
|
-
<span class="dpk-label er-status">${t.statusLabel(e.status)}</span>
|
|
1684
|
-
</button>
|
|
1685
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},`${e.id} \xB7 ${e.name}`)}
|
|
1686
|
-
<div class="er-fields">${e.fields.map(r=>this.#a(r,t))}</div>
|
|
1687
|
-
</div>
|
|
1688
|
-
`}#a(e,t){const s=r=>[r.type,r.key??"\u2014",r.ref??null,r.nullable?t.nullable:null].filter(Boolean).join(" \xB7 "),a=this.#e!==""&&e.id.toLowerCase().includes(this.#e);return g`
|
|
1689
|
-
<div
|
|
1690
|
-
class="er-field is-${e.status} ${a?"is-match":""}"
|
|
1691
|
-
style="height:${pe(e)}px"
|
|
1692
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1693
|
-
title=${[t.statusLabel(e.status),e.id,s(e)].filter(Boolean).join(" / ")}
|
|
1694
|
-
>
|
|
1695
|
-
<span class="er-field-mark" aria-hidden="true">${gt[e.status]}</span>
|
|
1696
|
-
<span class="er-key" data-empty=${e.key===null?"true":"false"}>${e.key??"\xB7"}</span>
|
|
1697
|
-
<span class="er-field-name">${e.id}</span>
|
|
1698
|
-
${e.status==="changed"&&e.before!==null?g`<span class="er-change">
|
|
1699
|
-
<del>− ${s(e.before)}</del>
|
|
1700
|
-
<ins>+ ${s(e)}</ins>
|
|
1701
|
-
</span>`:g`<span class="er-field-type">${s(e)}</span>`}
|
|
1702
|
-
</div>
|
|
1703
|
-
`}}const bt=()=>{customElements.get("dpk-component-er-diagram")||customElements.define("dpk-component-er-diagram",ft)},ne=N({en:{heading:"Architecture",node:"Service",edge:"Connection",empty:"No matching services.",boundaries:"Boundaries",edgeLabel:(n,e)=>`Connection from ${n} to ${e}`,artworkCredit:n=>`Icon credit: ${n}`},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:(n,e)=>`${n} \u304B\u3089 ${e} \u3078\u306E\u63A5\u7D9A`,artworkCredit:n=>`\u30A2\u30A4\u30B3\u30F3\u51FA\u5178: ${n}`}}),kt={width:220,height:112},he=26,$n=E({src:$(p(),S(1)),alt:$(p(),S(1)),license:f(p())}),Sn=E({id:$(p(),S(1)),name:$(p(),S(1)),description:f(p()),boundary:f(p()),symbol:f(p()),tags:f(z(p()),[]),artwork:f($n),position:E({x:Q(),y:Q()}),questions:f(p())}),Mn=E({id:$(p(),S(1)),label:$(p(),S(1)),kind:f(U(["internal","external"]),"internal")}),Cn=E({id:$(p(),S(1)),from:$(p(),S(1)),to:$(p(),S(1)),label:f(p())}),qn=E({boundaries:f(z(Mn),[]),services:z(Sn),links:f(z(Cn),[])}),En=()=>({nodes:[],edges:[],boundaries:[]}),Dn=n=>{const e=V(qn,n),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,a=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:kt.width,height:kt.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:a,edges:i,boundaries:e.boundaries.map(o=>({id:o.id,label:o.label,kind:o.kind}))}},Me={left:he,top:he*1.6,right:he,bottom:he},zn={left:0,top:0,right:0,bottom:0},Tn=12,xt=n=>({left:Math.min(...n.map(e=>e.position?.x??0)),top:Math.min(...n.map(e=>e.position?.y??0)),right:Math.max(...n.map(e=>(e.position?.x??0)+e.width)),bottom:Math.max(...n.map(e=>(e.position?.y??0)+e.height))}),An=(n,e,t,s)=>{const a=n.left-e.left<t.right+s.right&&t.left-s.left<n.right+e.right,r=n.top-e.top<t.bottom+s.bottom&&t.top-s.top<n.bottom+e.bottom;if(!a||!r)return e;const i=Math.max(t.left-n.right,n.left-t.right),o=Math.max(t.top-n.bottom,n.top-t.bottom);if(i<0&&o<0)return e;const d=(l,m,b)=>l===0?0:Math.max(0,b-Tn)*l/(l+m);return i>=o?t.left>=n.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>=n.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))}},Ln=(n,e)=>{const t=e.flatMap(a=>{const r=n.filter(i=>i.boundary===a.id);return r.length===0?[]:[{boundary:a,bounds:xt(r)}]}),s=[...t.map(a=>({id:a.boundary.id,bounds:a.bounds,padding:Me})),...n.filter(a=>a.boundary===null||!t.some(r=>r.boundary.id===a.boundary)).map(a=>({id:null,bounds:xt([a]),padding:zn}))];return t.map(({boundary:a,bounds:r})=>{const i=s.filter(l=>l.id!==a.id).map(l=>An(r,Me,l.bounds,l.padding)).reduce((l,m)=>({left:Math.min(l.left,m.left),top:Math.min(l.top,m.top),right:Math.min(l.right,m.right),bottom:Math.min(l.bottom,m.bottom)}),Me),o=r.left-i.left,d=r.top-i.top;return{boundary:a,x:o,y:d,width:r.right+i.right-o,height:r.bottom+i.bottom-d}})},On=(n,e)=>{const t=r=>r.y+r.height/2,s=r=>r.x+r.width/2,a=(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>=n.x+n.width?a({x:n.x+n.width,y:t(n)},{x:e.x,y:t(e)},!0):n.x>=e.x+e.width?a({x:n.x,y:t(n)},{x:e.x+e.width,y:t(e)},!0):e.y>=n.y+n.height?a({x:s(n),y:n.y+n.height},{x:s(e),y:e.y},!1):n.y>=e.y+e.height?a({x:s(n),y:n.y},{x:s(e),y:e.y+e.height},!1):null},Rn=(n,e)=>{const t=new Map(n.nodes.map(a=>[a.id,a])),s=n.routes.map(a=>{const r=e.find(l=>l.id===a.id),i=r?t.get(r.from):void 0,o=r?t.get(r.to):void 0,d=i&&o&&i!==o?On(i,o):null;return d===null?a:{id:a.id,points:d}});return{...n,routes:s}},In=_`
|
|
1704
|
-
.arch-toggle {
|
|
1705
|
-
min-height: 26px;
|
|
1706
|
-
padding: 0 9px;
|
|
1707
|
-
font-size: 10.5px;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
.arch-toggle[aria-pressed='true'] {
|
|
1711
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1712
|
-
background: var(--dpk-blue-soft);
|
|
1713
|
-
color: var(--dpk-blue);
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
.arch-boundary {
|
|
1717
|
-
position: absolute;
|
|
1718
|
-
border: 1px dashed var(--dpk-rule-strong);
|
|
1719
|
-
border-radius: var(--dpk-radius-lg);
|
|
1720
|
-
background: color-mix(in srgb, var(--dpk-blue) 3%, transparent);
|
|
1721
|
-
pointer-events: none;
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
.arch-boundary.is-external {
|
|
1725
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 45%, transparent);
|
|
1726
|
-
background: color-mix(in srgb, var(--dpk-amber) 4%, transparent);
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
.arch-boundary span {
|
|
1730
|
-
position: absolute;
|
|
1731
|
-
top: 9px;
|
|
1732
|
-
left: 14px;
|
|
1733
|
-
font-family: var(--dpk-mono);
|
|
1734
|
-
font-size: 9px;
|
|
1735
|
-
letter-spacing: 0.1em;
|
|
1736
|
-
text-transform: uppercase;
|
|
1737
|
-
color: var(--dpk-ink-faint);
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
.arch-service {
|
|
1741
|
-
display: grid;
|
|
1742
|
-
grid-template-columns: 38px minmax(0, 1fr);
|
|
1743
|
-
gap: 10px;
|
|
1744
|
-
align-items: start;
|
|
1745
|
-
padding: 14px 13px;
|
|
1746
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1747
|
-
border-radius: var(--dpk-radius-sm);
|
|
1748
|
-
background: var(--dpk-paper-raised);
|
|
1749
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
1750
|
-
text-align: left;
|
|
1751
|
-
overflow: hidden;
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
.arch-service:hover {
|
|
1755
|
-
border-color: var(--dpk-blue);
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
.arch-service.is-selected {
|
|
1759
|
-
border-color: var(--dpk-blue);
|
|
1760
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
.arch-service.is-related {
|
|
1764
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1765
|
-
background: var(--dpk-green-soft);
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
.arch-artwork {
|
|
1769
|
-
width: 38px;
|
|
1770
|
-
height: 38px;
|
|
1771
|
-
object-fit: contain;
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
.arch-symbol {
|
|
1775
|
-
display: grid;
|
|
1776
|
-
place-items: center;
|
|
1777
|
-
width: 38px;
|
|
1778
|
-
height: 38px;
|
|
1779
|
-
border-radius: var(--dpk-radius-xs);
|
|
1780
|
-
background: var(--dpk-paper-inset);
|
|
1781
|
-
color: var(--dpk-ink-faint);
|
|
1782
|
-
font-family: var(--dpk-mono);
|
|
1783
|
-
font-size: 12px;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
.arch-body {
|
|
1787
|
-
display: flex;
|
|
1788
|
-
flex-direction: column;
|
|
1789
|
-
gap: 6px;
|
|
1790
|
-
min-width: 0;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
.arch-name {
|
|
1794
|
-
font-size: 13px;
|
|
1795
|
-
font-weight: 640;
|
|
1796
|
-
letter-spacing: -0.01em;
|
|
1797
|
-
white-space: nowrap;
|
|
1798
|
-
overflow: hidden;
|
|
1799
|
-
text-overflow: ellipsis;
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
.arch-description {
|
|
1803
|
-
font-size: 10px;
|
|
1804
|
-
line-height: 1.6;
|
|
1805
|
-
color: var(--dpk-ink-faint);
|
|
1806
|
-
display: -webkit-box;
|
|
1807
|
-
-webkit-line-clamp: 3;
|
|
1808
|
-
-webkit-box-orient: vertical;
|
|
1809
|
-
overflow: hidden;
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
.arch-link .d-edge-path {
|
|
1813
|
-
stroke: var(--dpk-rule-strong);
|
|
1814
|
-
stroke-width: 1.5;
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
.arch-link.is-related .d-edge-path {
|
|
1818
|
-
stroke: var(--dpk-green);
|
|
1819
|
-
stroke-width: 2;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
.arch-link.is-selected .d-edge-path {
|
|
1823
|
-
stroke: var(--dpk-blue);
|
|
1824
|
-
stroke-width: 2.4;
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
.arch-link-label {
|
|
1828
|
-
font-size: 9.5px;
|
|
1829
|
-
fill: var(--dpk-ink-faint);
|
|
1830
|
-
paint-order: stroke;
|
|
1831
|
-
stroke: var(--dpk-paper-raised);
|
|
1832
|
-
stroke-width: 5px;
|
|
1833
|
-
stroke-linejoin: round;
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
#arch-neutral .diagram-arrow {
|
|
1837
|
-
fill: var(--dpk-rule-strong);
|
|
1838
|
-
stroke: var(--dpk-rule-strong);
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
|
-
#arch-selected .diagram-arrow {
|
|
1842
|
-
fill: var(--dpk-blue);
|
|
1843
|
-
stroke: var(--dpk-blue);
|
|
1844
|
-
}
|
|
1845
|
-
`,Pn=[{id:"arch-neutral"},{id:"arch-selected"}];class vt extends te{static{this.styles=[W,In]}#e=!0;parseData(e){return Dn(e)}emptyData(){return En()}defaultHeading(){return ne(this.locale).heading}statsLabels(){const e=ne(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return ne(this.locale).empty}get layoutMode(){return"fixed"}layoutOptions(){return{padding:40}}computePlacement(e){return Rn(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.#s();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 B;const s=j(t.edges,e.id,"outgoing",!1),a=j(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...a.nodes]),edges:new Set([...s.edges,...a.edges])}}renderToolbarActions(){const e=ne(this.locale);return g`
|
|
1846
|
-
<button
|
|
1847
|
-
type="button"
|
|
1848
|
-
class="dpk-btn dpk-btn--ghost arch-toggle"
|
|
1849
|
-
data-toggle="boundaries"
|
|
1850
|
-
aria-pressed=${this.#e?"true":"false"}
|
|
1851
|
-
@click=${()=>{this.#e=!this.#e,this.requestUpdate()}}
|
|
1852
|
-
>
|
|
1853
|
-
${e.boundaries}
|
|
1854
|
-
</button>
|
|
1855
|
-
`}#s(){const e=this.visible.nodes.flatMap(t=>{const s=this.placedNode(t.id);return s?[{...t,position:{x:s.x,y:s.y}}]:[]});return Ln(e,this.items().boundaries)}renderCanvas(){const e=ne(this.locale),t=this.visible,s=r=>t.nodes.find(i=>i.id===r)?.name??r,a=t.edges.map(r=>{const i=this.edgeState(r.id),o=this.routeOf(r.id),d=ee(o),l=()=>this.select({kind:"edge",id:r.id});return I`
|
|
1856
|
-
<g class=${this.elementClass(i,"d-edge","arch-link")} data-link=${r.id}>
|
|
1857
|
-
<title>${r.label??r.id}</title>
|
|
1858
|
-
<path
|
|
1859
|
-
class="d-edge-path"
|
|
1860
|
-
d=${d}
|
|
1861
|
-
marker-end=${`url(#${i.selected?"arch-selected":"arch-neutral"})`}
|
|
1862
|
-
></path>
|
|
1863
|
-
<path
|
|
1864
|
-
class="d-edge-hit"
|
|
1865
|
-
d=${d}
|
|
1866
|
-
role="button"
|
|
1867
|
-
tabindex="0"
|
|
1868
|
-
aria-label=${e.edgeLabel(s(r.from),s(r.to))}
|
|
1869
|
-
@click=${l}
|
|
1870
|
-
@keydown=${m=>{m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),l())}}
|
|
1871
|
-
></path>
|
|
1872
|
-
${r.label===null||o.length===0?w:this.#n(r.label,o)}
|
|
1873
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:r.id},`${s(r.from)} \u2192 ${s(r.to)}${r.label===null?"":` \xB7 ${r.label}`}`,o)}
|
|
1874
|
-
</g>
|
|
1875
|
-
`});return g`
|
|
1876
|
-
${this.#e?this.#s().map(r=>g`<div
|
|
1877
|
-
class=${`arch-boundary ${r.boundary.kind==="external"?"is-external":""}`}
|
|
1878
|
-
data-boundary=${r.boundary.id}
|
|
1879
|
-
style="left:${r.x}px; top:${r.y}px; width:${r.width}px; height:${r.height}px"
|
|
1880
|
-
>
|
|
1881
|
-
<span>${r.boundary.label}</span>
|
|
1882
|
-
</div>`):w}
|
|
1883
|
-
${this.renderEdges(a,Pn)} ${t.nodes.map(r=>this.#t(r,e))}
|
|
1884
|
-
`}#n(e,t){const s=t[Math.floor(t.length/2)]??t[0];return s?I`<text class="arch-link-label" x=${s.x} y=${s.y-6}>${e}</text>`:g``}#t(e,t){const s=this.placedNode(e.id);if(!s)return w;const a=this.nodeState(e.id);return g`
|
|
1885
|
-
<button
|
|
1886
|
-
type="button"
|
|
1887
|
-
class=${this.elementClass(a,"d-node","arch-service")}
|
|
1888
|
-
data-service=${e.id}
|
|
1889
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1890
|
-
style="left:${s.x}px; top:${s.y}px; width:${e.width}px; height:${e.height}px"
|
|
1891
|
-
aria-pressed=${a.selected?"true":"false"}
|
|
1892
|
-
title=${e.description??e.name}
|
|
1893
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
1894
|
-
>
|
|
1895
|
-
${e.artwork===null?g`<span class="arch-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>`:g`<img
|
|
1896
|
-
class="arch-artwork"
|
|
1897
|
-
src=${e.artwork.src}
|
|
1898
|
-
alt=${e.artwork.alt}
|
|
1899
|
-
title=${e.artwork.license===null?w:t.artworkCredit(e.artwork.license)}
|
|
1900
|
-
/>`}
|
|
1901
|
-
<span class="arch-body">
|
|
1902
|
-
<span class="arch-name">${e.name}</span>
|
|
1903
|
-
${e.description===null?w:g`<span class="arch-description">${e.description}</span>`}
|
|
1904
|
-
</span>
|
|
1905
|
-
</button>
|
|
1906
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:s.x+e.width-20,y:s.y-14})}
|
|
1907
|
-
`}}const yt=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",vt)},wt=[72,52,40],$t=[0,22,10,8],jn=n=>wt[Math.min(n,wt.length-1)]??40,St=n=>$t[Math.min(n,$t.length-1)]??8,Fn=(n,e={})=>{const t=e.padding??40,s=n.nodes.find(x=>x.parent===null);if(s===void 0)return{width:0,height:0,nodes:[],routes:[]};const a=new Map(n.nodes.map(x=>[x.id,x])),r=x=>x.children.flatMap(D=>{const A=a.get(D);return A===void 0?[]:[A]}),i=new Map,o=x=>x.reduce((D,A,H)=>D+d(A)+(H===0?0:St(A.depth)),0),d=x=>{const D=i.get(x.id);if(D!==void 0)return D;const A=Math.max(x.height,o(r(x)));return i.set(x.id,A),A},l=[],m=(x,D,A)=>{if(D.length===0)return;const H=jn(x.node.depth);let u=x.y+x.node.height/2-o(D)/2;for(const y of D){const q=d(y),R={x:A==="right"?x.x+x.node.width+H:x.x-H-y.width,y:u+q/2-y.height/2,node:y};l.push(R),m(R,r(y),A),u+=q+St(y.depth)}},b={x:-s.width/2,y:-s.height/2,node:s};l.push(b);const c=r(s);m(b,c.filter(x=>x.side!=="left"),"right"),m(b,c.filter(x=>x.side==="left"),"left");const h=Math.min(...l.map(x=>x.x)),M=Math.min(...l.map(x=>x.y)),v=Math.max(...l.map(x=>x.x+x.node.width)),k=Math.max(...l.map(x=>x.y+x.node.height)),C=t-h,T=t-M,O=new Map,P=l.map(x=>{const D=O.get(x.node.depth)??0;return O.set(x.node.depth,D+1),{id:x.node.id,x:x.x+C,y:x.y+T,width:x.node.width,height:x.node.height,layer:x.node.depth,order:D}}),F=new Map(P.map(x=>[x.id,x])),oe=n.edges.flatMap(x=>{const D=F.get(x.from),A=F.get(x.to),H=a.get(x.to);if(D===void 0||A===void 0||H===void 0)return[];const u=H.side==="left",y={x:u?D.x:D.x+D.width,y:D.y+D.height/2},q={x:u?A.x+A.width:A.x,y:A.y+A.height/2};return[{id:x.id,points:[y,q]}]});return{width:v-h+t*2,height:k-M+t*2,nodes:P,routes:oe}},Hn=n=>{const e=n[0],t=n.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}`},ae=N({en:{heading:"Mind map",empty:"No matching topics.",topics:"Topic",toggleOpen:(n,e)=>`Open ${e} subtopics of ${n}`,toggleClose:n=>`Collapse subtopics of ${n}`,addSubtopicButton:"+ Subtopic",commentButton:"Comment",addSubtopicAriaLabel:n=>`Subtopic of ${n}`,addSubtopicPlaceholder:"Subtopic title (Enter to add)",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",addTopicTitle:"Add topic",addSummary:(n,e)=>`${n} \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:(n,e)=>`${n} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF ${e} \u4EF6\u3092\u3072\u3089\u304F`,toggleClose:n=>`${n} \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:n=>`${n} \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:(n,e)=>`${n} \u203A ${e}`}}),Mt=Jt(()=>E({id:$(p(),S(1)),label:$(p(),S(1)),description:f(p()),tags:f(z(p())),questions:f(p()),collapsed:f(ge()),side:f(U(["left","right"])),children:f(z(Mt))})),Un=E({root:Mt}),Ct=()=>({root:null,nodes:[],edges:[]}),qt=[{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}],Bn=n=>qt[Math.min(n,qt.length-1)]??{fontSize:12.5,padding:12,height:28,min:56,max:220},Nn=(n,e)=>{let t=0;for(const s of n)t+=(s.codePointAt(0)??0)>=11904?e:e*.62;return t},_n=(n,e)=>{const t=Bn(e),s=Math.ceil(Nn(n,t.fontSize)+t.padding*2+4);return{width:Math.min(t.max,Math.max(t.min,s)),height:t.height}},Ce=n=>n.children===void 0||n.children.length===0?1:n.children.reduce((e,t)=>e+Ce(t),0),Et=n=>{const e={left:0,right:0};for(const t of n)t.side!==void 0&&(e[t.side]+=Ce(t));return n.map(t=>{if(t.side!==void 0)return t.side;const s=e.right<=e.left?"right":"left";return e[s]+=Ce(t),s})},Dt=n=>zt(V(Un,n).root),zt=(n,e=new Set)=>{const t=[],s=[],a=new Set,r=(i,o,d,l,m)=>{if(a.has(i.id))throw new Error(`duplicate topic id: ${i.id}`);if(a.add(i.id),i.side!==void 0&&d!==1)throw new Error(`side is only allowed on a main topic (a child of the root): ${i.id}`);const b=i.children??[];t.push({id:i.id,label:i.label,description:i.description??null,parent:o,depth:d,branch:l,side:m,children:b.map(h=>h.id),collapsed:i.collapsed??!1,added:e.has(i.id),tags:i.tags??[],..._n(i.label,d),...i.questions===void 0?{}:{questions:i.questions}}),o!==null&&s.push({id:i.id,from:o,to:i.id,tags:[]});const c=d===0?Et(b):[];b.forEach((h,M)=>r(h,i.id,d+1,d===0?M:l,d===0?c[M]??"right":m))};return r(n,null,0,-1,null),{root:n,nodes:t,edges:s}},Tt="ADD_TOPIC",Vn=be({id:$(p(),S(1)),label:$(p(),ze(),S(1))}),Wn=n=>{const e=Ue(n);return e?.length===3&&e[1]==="node"?e[2]??null:null},At=(n,e,t)=>n.id===e?{...n,children:[...n.children??[],t]}:n.children===void 0?n:{...n,children:n.children.map(s=>At(s,e,t))},Gn=n=>{if(n.children===void 0)return n;const e=Et(n.children);return{...n,children:n.children.map((t,s)=>({...t,side:e[s]??"right"}))}},Yn=(n,e,t)=>{const s=n.addTopicTitle,a=new Map(e.nodes.map(d=>[d.id,d.label])),r=new Set,i=[];let o=e.root===null?null:Gn(e.root);for(const d of t){if(d.type!==Tt){i.push({id:d.id,title:d.type,stale:"unsupported-action-type"});continue}const l=Wn(d.target.id),m=l===null?void 0:a.get(l),b=fe(Vn,d.payload);if(o===null||l===null||m===void 0){i.push({id:d.id,title:s,stale:"target-missing"});continue}if(!b.success||a.has(b.output.id)){i.push({id:d.id,title:s,stale:"constraint-violated"});continue}const{id:c,label:h}=b.output;o=At(o,l,{id:c,label:h}),a.set(c,h),r.add(c),i.push({id:d.id,title:s,summary:n.addSummary(m,h),tone:"create"})}return{data:o===null||r.size===0?e:zt(o,r),results:i}},qe=(n,e)=>{const t=new Map(n.nodes.map(r=>[r.id,r])),s=[];let a=t.get(e)?.parent??null;for(;a!==null&&!s.includes(a);)s.push(a),a=t.get(a)?.parent??null;return s},Kn=(n,e)=>{const t=new Map(n.nodes.map(r=>[r.id,r]));let s=0;const a=[...t.get(e)?.children??[]];for(let r=a.pop();r!==void 0;r=a.pop())s+=1,a.push(...t.get(r)?.children??[]);return s},Xn=(n,e,t)=>{let s=null;if(e!==null){const i=n.nodes.filter(e);if(i.length===0)return Ct();const o=new Map(n.nodes.map(l=>[l.id,l])),d=new Set;for(const l of i){d.add(l.id);for(const b of qe(n,l.id))d.add(b);const m=[...l.children];for(let b=m.pop();b!==void 0;b=m.pop())d.add(b),m.push(...o.get(b)?.children??[])}s=d}const a=n.nodes.filter(i=>(s===null||s.has(i.id))&&!qe(n,i.id).some(o=>t.has(o))),r=new Set(a.map(i=>i.id));return{...n,nodes:a,edges:n.edges.filter(i=>r.has(i.from)&&r.has(i.to))}},Zn=_`
|
|
1908
|
-
.branch-root {
|
|
1909
|
-
--mind-color: var(--dpk-ink);
|
|
1910
|
-
--mind-soft: var(--dpk-paper-sunken);
|
|
1911
|
-
}
|
|
1912
|
-
.branch-0 {
|
|
1913
|
-
--mind-color: var(--dpk-blue);
|
|
1914
|
-
--mind-soft: var(--dpk-blue-soft);
|
|
1915
|
-
}
|
|
1916
|
-
.branch-1 {
|
|
1917
|
-
--mind-color: var(--dpk-green);
|
|
1918
|
-
--mind-soft: var(--dpk-green-soft);
|
|
1919
|
-
}
|
|
1920
|
-
.branch-2 {
|
|
1921
|
-
--mind-color: var(--dpk-violet);
|
|
1922
|
-
--mind-soft: var(--dpk-violet-soft);
|
|
1923
|
-
}
|
|
1924
|
-
.branch-3 {
|
|
1925
|
-
--mind-color: var(--dpk-amber);
|
|
1926
|
-
--mind-soft: var(--dpk-amber-soft);
|
|
1927
|
-
}
|
|
1928
|
-
.branch-4 {
|
|
1929
|
-
--mind-color: var(--dpk-accent);
|
|
1930
|
-
--mind-soft: var(--dpk-accent-soft);
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
.mind-topic {
|
|
1934
|
-
display: flex;
|
|
1935
|
-
align-items: center;
|
|
1936
|
-
justify-content: center;
|
|
1937
|
-
padding: 0 12px;
|
|
1938
|
-
border: 1px solid color-mix(in srgb, var(--mind-color) 45%, transparent);
|
|
1939
|
-
border-radius: 999px;
|
|
1940
|
-
background: var(--dpk-paper-raised);
|
|
1941
|
-
color: var(--dpk-ink);
|
|
1942
|
-
font-family: var(--dpk-body);
|
|
1943
|
-
font-size: 12.5px;
|
|
1944
|
-
line-height: 1.3;
|
|
1945
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
.mind-label {
|
|
1949
|
-
min-width: 0;
|
|
1950
|
-
white-space: nowrap;
|
|
1951
|
-
overflow: hidden;
|
|
1952
|
-
text-overflow: ellipsis;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
.mind-topic.depth-0 {
|
|
1956
|
-
padding: 0 22px;
|
|
1957
|
-
border: 0;
|
|
1958
|
-
background: var(--dpk-ink);
|
|
1959
|
-
color: var(--dpk-paper-raised);
|
|
1960
|
-
font-size: 16px;
|
|
1961
|
-
font-weight: 680;
|
|
1962
|
-
letter-spacing: -0.01em;
|
|
1963
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
.mind-topic.depth-1 {
|
|
1967
|
-
padding: 0 15px;
|
|
1968
|
-
border-width: 1.5px;
|
|
1969
|
-
border-color: var(--mind-color);
|
|
1970
|
-
background: var(--mind-soft);
|
|
1971
|
-
font-size: 13.5px;
|
|
1972
|
-
font-weight: 620;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
.mind-topic.depth-1 .mind-label {
|
|
1976
|
-
color: color-mix(in srgb, var(--mind-color) 70%, var(--dpk-ink));
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
.mind-topic:hover {
|
|
1980
|
-
border-color: var(--mind-color);
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
.mind-topic.is-selected {
|
|
1984
|
-
border-color: var(--mind-color);
|
|
1985
|
-
box-shadow: 0 0 0 3px color-mix(in srgb, var(--mind-color) 22%, transparent);
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
.mind-topic.depth-0.is-selected {
|
|
1989
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
.mind-topic.is-related {
|
|
1993
|
-
border-color: var(--mind-color);
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
.mind-topic:focus-visible {
|
|
1997
|
-
outline: none;
|
|
1998
|
-
box-shadow: var(--dpk-focus);
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
/* Added on this page by a draft action: not authored yet. */
|
|
2002
|
-
.mind-topic.is-added {
|
|
2003
|
-
border-style: dashed;
|
|
2004
|
-
border-color: var(--mind-color);
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
.mind-actions {
|
|
2008
|
-
position: absolute;
|
|
2009
|
-
z-index: 3;
|
|
2010
|
-
display: flex;
|
|
2011
|
-
flex-wrap: wrap;
|
|
2012
|
-
align-items: center;
|
|
2013
|
-
gap: 6px;
|
|
2014
|
-
width: 220px;
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
|
-
.mind-actions .dpk-btn {
|
|
2018
|
-
padding: 3px 9px;
|
|
2019
|
-
font-size: 12px;
|
|
2020
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
.mind-actions .dpk-input {
|
|
2024
|
-
width: 100%;
|
|
2025
|
-
font-size: 12.5px;
|
|
2026
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
.mind-actions-error {
|
|
2030
|
-
font-size: 11.5px;
|
|
2031
|
-
line-height: 1.4;
|
|
2032
|
-
color: var(--dpk-accent);
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
.mind-branch {
|
|
2036
|
-
fill: none;
|
|
2037
|
-
stroke: color-mix(in srgb, var(--mind-color) 55%, transparent);
|
|
2038
|
-
stroke-width: 1.5;
|
|
2039
|
-
stroke-linecap: round;
|
|
2040
|
-
cursor: default;
|
|
2041
|
-
transition: opacity 150ms ease;
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
.mind-branch.depth-1 {
|
|
2045
|
-
stroke-width: 3;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
.mind-branch.depth-2 {
|
|
2049
|
-
stroke-width: 2;
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
.mind-branch.is-related {
|
|
2053
|
-
stroke: var(--mind-color);
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
.mind-toggle {
|
|
2057
|
-
position: absolute;
|
|
2058
|
-
z-index: 1;
|
|
2059
|
-
min-width: 18px;
|
|
2060
|
-
height: 18px;
|
|
2061
|
-
padding: 0 4px;
|
|
2062
|
-
transform: translate(-50%, -50%);
|
|
2063
|
-
border: 1.5px solid var(--mind-color);
|
|
2064
|
-
border-radius: 999px;
|
|
2065
|
-
background: var(--dpk-paper-raised);
|
|
2066
|
-
color: var(--mind-color);
|
|
2067
|
-
font-family: var(--dpk-mono);
|
|
2068
|
-
font-size: 10px;
|
|
2069
|
-
font-weight: 700;
|
|
2070
|
-
line-height: 1;
|
|
2071
|
-
cursor: pointer;
|
|
2072
|
-
opacity: 0;
|
|
2073
|
-
transition: opacity 120ms ease;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
/* Expanded toggles appear with their topic; folded ones always show the count. */
|
|
2077
|
-
.mind-topic:hover + .mind-toggle,
|
|
2078
|
-
.mind-toggle:hover,
|
|
2079
|
-
.mind-toggle:focus-visible,
|
|
2080
|
-
.mind-toggle.is-folded {
|
|
2081
|
-
opacity: 1;
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
.mind-toggle.is-dimmed {
|
|
2085
|
-
opacity: 0;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
.mind-toggle.is-folded.is-dimmed {
|
|
2089
|
-
opacity: 0.26;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
.mind-toggle:focus-visible {
|
|
2093
|
-
outline: none;
|
|
2094
|
-
box-shadow: var(--dpk-focus);
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
@media (hover: none) {
|
|
2098
|
-
.mind-toggle {
|
|
2099
|
-
opacity: 1;
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
`,Jn=5;class Lt extends te{static{this.styles=[W,Zn]}#e=new Set;#s=null;#n=!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 a=t??!this.#e.has(e);if(a!==this.#e.has(e)){if(a){this.#e.add(e);const r=this.selection;r!==null&&qe(this.items(),r.id).includes(e)&&this.select(null)}else this.#e.delete(e);this.requestUpdate()}}get collapsed(){return[...this.#e]}parseData(e){return Dt(e)}emptyData(){return Ct()}reduceElementActions(e,t){return Yn(ae(this.locale),e,t)}defaultHeading(){return ae(this.locale).heading}emptyMessage(){return ae(this.locale).empty}statsText(){const e=ae(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=>K(s.tags,e);return Xn(this.items(),t,this.#e)}layoutSignature(){return this.filtered().nodes.map(e=>`${e.id}<${e.parent??""}:${e.side??""}`).join(",")}computePlacement(e){return Fn(e)}refreshContent(){const e=this.authoredItems();e!==this.#s&&(this.#s=e,this.#e=new Set(e.nodes.filter(t=>t.collapsed).map(t=>t.id)),this.#n=!1,this.#t=null),super.refreshContent()}initialView(){if(this.#n){this.viewport?.apply();return}this.#n=!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=j(t.edges,e.id,"outgoing",!0),a=j(t.edges,e.id,"incoming",!0);return{nodes:new Map([...s.nodes,...a.nodes]),edges:new Set([...s.edges,...a.edges])}}renderSelection(){return w}renderCanvas(){const e=this.filtered(),t=ae(this.locale);return g`
|
|
2103
|
-
${this.renderEdges(e.edges.map(s=>this.#i(s)),[])}
|
|
2104
|
-
${e.nodes.map(s=>this.#r(s,t))} ${this.#l(t)}
|
|
2105
|
-
`}#a(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%Jn}`}#i(e){const t=this.items().nodes.find(a=>a.id===e.to),s=this.edgeState(e.id);return I`
|
|
2106
|
-
<path
|
|
2107
|
-
class=${this.elementClass(s,"d-edge","mind-branch",this.#a(t),`depth-${Math.min(t?.depth??1,3)}`)}
|
|
2108
|
-
data-branch=${e.id}
|
|
2109
|
-
d=${Hn(this.routeOf(e.id))}
|
|
2110
|
-
></path>
|
|
2111
|
-
`}#r(e,t){const s=this.placedNode(e.id);if(!s)return w;const a=this.nodeState(e.id),r=this.#e.has(e.id),i=`depth-${Math.min(e.depth,3)}`;return g`
|
|
2112
|
-
<button
|
|
2113
|
-
type="button"
|
|
2114
|
-
class=${this.elementClass(a,"d-node","mind-topic",i,this.#a(e),r&&"is-folded",e.added&&"is-added")}
|
|
2115
|
-
data-topic=${e.id}
|
|
2116
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
2117
|
-
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
2118
|
-
aria-pressed=${a.selected?"true":"false"}
|
|
2119
|
-
title=${e.description??e.label}
|
|
2120
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2121
|
-
>
|
|
2122
|
-
<span class="mind-label">${e.label}</span>
|
|
2123
|
-
</button>
|
|
2124
|
-
${e.depth===0||e.children.length===0?w:this.#o(e,s,r,a.dimmed,t)}
|
|
2125
|
-
`}#o(e,t,s,a,r){const i=s?Kn(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 g`
|
|
2126
|
-
<button
|
|
2127
|
-
type="button"
|
|
2128
|
-
class=${this.elementClass({selected:!1,related:!1,dimmed:a,depth:null},"mind-toggle",this.#a(e),s&&"is-folded")}
|
|
2129
|
-
data-toggle=${e.id}
|
|
2130
|
-
style="left:${o}px; top:${t.y+t.height/2}px"
|
|
2131
|
-
aria-expanded=${s?"false":"true"}
|
|
2132
|
-
aria-label=${d}
|
|
2133
|
-
title=${d}
|
|
2134
|
-
@click=${l=>{l.stopPropagation(),this.toggle(e.id)}}
|
|
2135
|
-
>
|
|
2136
|
-
${s?i:"\u2212"}
|
|
2137
|
-
</button>
|
|
2138
|
-
`}#l(e){const t=this.selection;if(t===null||t.kind!=="node")return w;const s=this.items().nodes.find(i=>i.id===t.id),a=this.placedNode(t.id);if(s===void 0||a===void 0)return w;const r=this.#t?.parent===s.id?this.#t:null;return g`
|
|
2139
|
-
<div
|
|
2140
|
-
class="mind-actions"
|
|
2141
|
-
data-for=${s.id}
|
|
2142
|
-
style="left:${this.#p(s,a)}px; top:${a.y+a.height+8}px"
|
|
2143
|
-
@click=${i=>i.stopPropagation()}
|
|
2144
|
-
>
|
|
2145
|
-
${r===null?g`
|
|
2146
|
-
<button type="button" class="dpk-btn" data-action="add" @click=${()=>this.#u(s.id)}>
|
|
2147
|
-
${e.addSubtopicButton}
|
|
2148
|
-
</button>
|
|
2149
|
-
<button
|
|
2150
|
-
type="button"
|
|
2151
|
-
class="dpk-btn"
|
|
2152
|
-
data-action="comment"
|
|
2153
|
-
@click=${()=>this.requestElementComment("node",s.id)}
|
|
2154
|
-
>
|
|
2155
|
-
${e.commentButton}
|
|
2156
|
-
</button>
|
|
2157
|
-
`:g`
|
|
2158
|
-
<input
|
|
2159
|
-
class="dpk-input"
|
|
2160
|
-
aria-label="${e.addSubtopicAriaLabel(s.label)}"
|
|
2161
|
-
placeholder="${e.addSubtopicPlaceholder}"
|
|
2162
|
-
.value=${r.label}
|
|
2163
|
-
@input=${i=>{const o=i.currentTarget;o instanceof HTMLInputElement&&(this.#t={...r,label:o.value,failed:!1})}}
|
|
2164
|
-
@keydown=${i=>this.#c(i,s.id)}
|
|
2165
|
-
/>
|
|
2166
|
-
${r.failed?g`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:w}
|
|
2167
|
-
`}
|
|
2168
|
-
</div>
|
|
2169
|
-
`}#p(e,t){return e.side==="left"?t.x+t.width-220:t.x}#u(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#c(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 a=Te(`topic ${s}`,this.items().nodes.map(i=>i.id));if(!this.dispatchElementAction(Tt,["node",t],{id:a,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:a}),this.requestUpdate()}}const Ot=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",Lt)},ie=N({en:{heading:"Kanban",empty:"No columns.",cards:"Card",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",wipLimit:n=>`WIP limit ${n}`,addCardButton:"+ Card",addCardAriaLabel:n=>`Card to add to ${n}`,addCardPlaceholder:"Card title (Enter to add)",addCardTitle:"Add card",moveCardTitle:"Move card",addSummary:(n,e)=>`${n} \u203A ${e}`,moveSummarySame:(n,e)=>`${n}: reorder within ${e}`,moveSummaryAcross:(n,e,t)=>`${n}: ${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:n=>`WIP \u4E0A\u9650 ${n}`,addCardButton:"\uFF0B \u30AB\u30FC\u30C9",addCardAriaLabel:n=>`${n} \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:(n,e)=>`${n} \u203A ${e}`,moveSummarySame:(n,e)=>`${n}: ${e} \u5185\u3067\u4E26\u3079\u66FF\u3048`,moveSummaryAcross:(n,e,t)=>`${n}: ${e} \u2192 ${t}`}}),Qn=E({id:$(p(),S(1)),title:$(p(),S(1)),description:f(p()),tags:f(z(p())),assignee:f(p()),questions:f(p())}),ea=["gray","blue","green","amber","violet","red"],ta=E({id:$(p(),S(1)),label:$(p(),S(1)),description:f(p()),color:f(U(ea)),limit:f($(Q(),es(),Qt(1))),cards:f(z(Qn))}),sa=E({columns:z(ta)}),na=()=>({columns:[]}),Rt=n=>{const e=V(sa,n),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}})}})}},ue=(n,e)=>n.columns.flatMap(t=>t.cards).find(t=>t.id===e),re=n=>n.columns.flatMap(e=>e.cards),aa=(n,e)=>e===null?n:{columns:n.columns.map(t=>({...t,cards:t.cards.filter(e)}))},ia=(n,e,t,s)=>{const a=ue(n,e);if(a===void 0||a.column!==t)return!1;if(s===e)return!0;const r=n.columns.find(o=>o.id===t)?.cards??[],i=r.findIndex(o=>o.id===e);return(r[i+1]?.id??null)===s},It="ADD_CARD",Pt="MOVE_CARD",ra=be({id:$(p(),S(1)),title:$(p(),ze(),S(1))}),oa=be({column:$(p(),S(1)),before:ts($(p(),S(1)))}),jt=(n,e)=>{const t=Ue(n);return t?.length===3&&t[1]===e?t[2]??null:null},da=(n,e)=>({columns:n.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),Ft=(n,e,t)=>({columns:n.columns.map(s=>{if(s.id!==t.column)return s;const a={...e,column:s.id},r=t.before===null?-1:s.cards.findIndex(i=>i.id===t.before);return{...s,cards:r<0?[...s.cards,a]:[...s.cards.slice(0,r),a,...s.cards.slice(r)]}})}),la=(n,e,t)=>{const s=n.addCardTitle,a=jt(t.target.id,"column"),r=e.columns.find(d=>d.id===a);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=fe(ra,t.payload);if(!i.success||ue(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:Ft(e,o,{column:r.id,before:null}),result:{id:t.id,title:s,summary:n.addSummary(r.label,o.title),tone:"create"}}},ca=(n,e,t)=>{const s=n.moveCardTitle,a=jt(t.target.id,"card"),r=a===null?void 0:ue(e,a);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=fe(oa,t.payload),o=e.columns.find(h=>h.id===r.column),d=i.success?e.columns.find(h=>h.id===i.output.column):void 0,l=i.success?i.output.before:null,m=l===null||l!==r.id&&d?.cards.some(h=>h.id===l)===!0;if(!i.success||o===void 0||d===void 0||!m)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const b={...r,change:r.change??"moved"},c=o.id===d.id?n.moveSummarySame(r.title,d.label):n.moveSummaryAcross(r.title,o.label,d.label);return{data:Ft(da(e,r.id),b,{column:d.id,before:l}),result:{id:t.id,title:s,summary:c,tone:"move"}}},pa=(n,e,t)=>{let s=e;const a=[];for(const r of t){const i=r.type===It?la(n,s,r):r.type===Pt?ca(n,s,r):{data:s,result:{id:r.id,title:r.type,stale:"unsupported-action-type"}};s=i.data,a.push(i.result)}return{data:s,results:a}},ha=_`
|
|
2170
|
-
.kanban-board {
|
|
2171
|
-
display: flex;
|
|
2172
|
-
align-items: flex-start;
|
|
2173
|
-
gap: 14px;
|
|
2174
|
-
width: max-content;
|
|
2175
|
-
padding: 18px;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
.kanban-column {
|
|
2179
|
-
display: flex;
|
|
2180
|
-
flex-direction: column;
|
|
2181
|
-
gap: 8px;
|
|
2182
|
-
width: 264px;
|
|
2183
|
-
padding: 10px;
|
|
2184
|
-
border: 1px solid var(--dpk-rule);
|
|
2185
|
-
border-radius: var(--dpk-radius);
|
|
2186
|
-
background: var(--dpk-paper-sunken);
|
|
2187
|
-
cursor: default;
|
|
2188
|
-
transition:
|
|
2189
|
-
border-color 150ms ease,
|
|
2190
|
-
box-shadow 150ms ease;
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
.kanban-column.is-selected {
|
|
2194
|
-
border-color: var(--dpk-ink-soft);
|
|
2195
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
.kanban-column.is-drop-target {
|
|
2199
|
-
border-color: var(--dpk-blue);
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
.kanban-column-head {
|
|
2203
|
-
position: relative;
|
|
2204
|
-
display: flex;
|
|
2205
|
-
align-items: center;
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
.kanban-column-title {
|
|
2209
|
-
display: flex;
|
|
2210
|
-
flex: 1;
|
|
2211
|
-
align-items: center;
|
|
2212
|
-
gap: 8px;
|
|
2213
|
-
min-width: 0;
|
|
2214
|
-
padding: 2px 34px 2px 2px;
|
|
2215
|
-
border: 0;
|
|
2216
|
-
border-radius: var(--dpk-radius-xs);
|
|
2217
|
-
background: none;
|
|
2218
|
-
color: var(--dpk-ink);
|
|
2219
|
-
font-family: var(--dpk-body);
|
|
2220
|
-
font-size: 13px;
|
|
2221
|
-
font-weight: 650;
|
|
2222
|
-
text-align: left;
|
|
2223
|
-
cursor: pointer;
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
.kanban-column-title:focus-visible {
|
|
2227
|
-
outline: none;
|
|
2228
|
-
box-shadow: var(--dpk-focus);
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
.kanban-column-label {
|
|
2232
|
-
min-width: 0;
|
|
2233
|
-
overflow: hidden;
|
|
2234
|
-
text-overflow: ellipsis;
|
|
2235
|
-
white-space: nowrap;
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
/* An authored color marks the heading, not the cards: the status reads at a glance. */
|
|
2239
|
-
.kanban-column[data-color='gray'] {
|
|
2240
|
-
--kanban-tone: var(--dpk-ink-soft);
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
.kanban-column[data-color='blue'] {
|
|
2244
|
-
--kanban-tone: var(--dpk-blue);
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
.kanban-column[data-color='green'] {
|
|
2248
|
-
--kanban-tone: var(--dpk-green);
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
.kanban-column[data-color='amber'] {
|
|
2252
|
-
--kanban-tone: var(--dpk-amber);
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
.kanban-column[data-color='violet'] {
|
|
2256
|
-
--kanban-tone: var(--dpk-violet);
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
|
-
.kanban-column[data-color='red'] {
|
|
2260
|
-
--kanban-tone: var(--dpk-accent);
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
.kanban-column[data-color] .kanban-column-label {
|
|
2264
|
-
padding: 2px 9px;
|
|
2265
|
-
border-radius: 999px;
|
|
2266
|
-
background: color-mix(in srgb, var(--kanban-tone) 14%, transparent);
|
|
2267
|
-
color: var(--kanban-tone);
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
.kanban-count {
|
|
2271
|
-
flex: none;
|
|
2272
|
-
padding: 1px 7px;
|
|
2273
|
-
border-radius: 999px;
|
|
2274
|
-
background: var(--dpk-paper-raised);
|
|
2275
|
-
color: var(--dpk-ink-soft);
|
|
2276
|
-
font-family: var(--dpk-mono);
|
|
2277
|
-
font-size: 11px;
|
|
2278
|
-
font-weight: 600;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
/* Over its WIP limit: the column asks for attention, not the cards. */
|
|
2282
|
-
.kanban-column.is-over {
|
|
2283
|
-
border-color: color-mix(in srgb, var(--dpk-accent) 55%, transparent);
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
.kanban-column.is-over .kanban-count {
|
|
2287
|
-
background: var(--dpk-accent-soft);
|
|
2288
|
-
color: var(--dpk-accent);
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
.kanban-column-head > .diagram-comment-trigger {
|
|
2292
|
-
position: absolute;
|
|
2293
|
-
top: 50%;
|
|
2294
|
-
right: 0;
|
|
2295
|
-
transform: translateY(-50%);
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
.kanban-column-description {
|
|
2299
|
-
margin: 0 2px;
|
|
2300
|
-
color: var(--dpk-ink-soft);
|
|
2301
|
-
font-size: 11.5px;
|
|
2302
|
-
line-height: 1.45;
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
.kanban-cards {
|
|
2306
|
-
display: flex;
|
|
2307
|
-
flex-direction: column;
|
|
2308
|
-
gap: 8px;
|
|
2309
|
-
min-height: 44px;
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
.kanban-card-slot {
|
|
2313
|
-
position: relative;
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
.kanban-card {
|
|
2317
|
-
display: flex;
|
|
2318
|
-
flex-direction: column;
|
|
2319
|
-
gap: 5px;
|
|
2320
|
-
padding: 9px 34px 9px 11px;
|
|
2321
|
-
border: 1px solid var(--dpk-rule);
|
|
2322
|
-
border-radius: var(--dpk-radius-sm);
|
|
2323
|
-
background: var(--dpk-paper-raised);
|
|
2324
|
-
color: var(--dpk-ink);
|
|
2325
|
-
font-family: var(--dpk-body);
|
|
2326
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
2327
|
-
cursor: grab;
|
|
2328
|
-
transition:
|
|
2329
|
-
border-color 150ms ease,
|
|
2330
|
-
box-shadow 150ms ease,
|
|
2331
|
-
opacity 150ms ease;
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
.kanban-card:hover {
|
|
2335
|
-
border-color: var(--dpk-rule-strong);
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
.kanban-card.is-selected {
|
|
2339
|
-
border-color: var(--dpk-ink-soft);
|
|
2340
|
-
box-shadow: 0 0 0 3px var(--dpk-blue-soft);
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
.kanban-card:focus-visible {
|
|
2344
|
-
outline: none;
|
|
2345
|
-
box-shadow: var(--dpk-focus);
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
.kanban-card.is-dragging {
|
|
2349
|
-
opacity: 0.4;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
/* Changed on this page by a draft action: not authored yet. */
|
|
2353
|
-
.kanban-card.is-added {
|
|
2354
|
-
border-style: dashed;
|
|
2355
|
-
border-color: var(--dpk-green);
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
.kanban-card.is-moved {
|
|
2359
|
-
border-left: 3px solid var(--dpk-blue);
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
.kanban-card-title {
|
|
2363
|
-
font-size: 13px;
|
|
2364
|
-
font-weight: 560;
|
|
2365
|
-
line-height: 1.45;
|
|
2366
|
-
overflow-wrap: anywhere;
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
.kanban-card-description {
|
|
2370
|
-
display: -webkit-box;
|
|
2371
|
-
overflow: hidden;
|
|
2372
|
-
color: var(--dpk-ink-soft);
|
|
2373
|
-
font-size: 11.5px;
|
|
2374
|
-
line-height: 1.45;
|
|
2375
|
-
-webkit-box-orient: vertical;
|
|
2376
|
-
-webkit-line-clamp: 3;
|
|
2377
|
-
line-clamp: 3;
|
|
2378
|
-
overflow-wrap: anywhere;
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
.kanban-card-meta {
|
|
2382
|
-
display: flex;
|
|
2383
|
-
flex-wrap: wrap;
|
|
2384
|
-
align-items: center;
|
|
2385
|
-
gap: 4px;
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
.kanban-tag {
|
|
2389
|
-
padding: 1px 6px;
|
|
2390
|
-
border-radius: var(--dpk-radius-xs);
|
|
2391
|
-
background: var(--dpk-paper-sunken);
|
|
2392
|
-
color: var(--dpk-ink-soft);
|
|
2393
|
-
font-size: 10.5px;
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
.kanban-assignee {
|
|
2397
|
-
margin-left: auto;
|
|
2398
|
-
color: var(--dpk-ink-faint);
|
|
2399
|
-
font-size: 11px;
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
.kanban-card-slot > .diagram-comment-trigger {
|
|
2403
|
-
position: absolute;
|
|
2404
|
-
top: 5px;
|
|
2405
|
-
right: 5px;
|
|
2406
|
-
z-index: 2;
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
.kanban-error {
|
|
2410
|
-
margin: 6px 0 0;
|
|
2411
|
-
padding: 4px 6px;
|
|
2412
|
-
border-radius: var(--dpk-radius-xs);
|
|
2413
|
-
background: var(--dpk-paper-raised);
|
|
2414
|
-
color: var(--dpk-accent);
|
|
2415
|
-
font-size: 11.5px;
|
|
2416
|
-
line-height: 1.4;
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
/* Takes no room of its own, so the cards do not jump while dragging. */
|
|
2420
|
-
.kanban-drop-marker {
|
|
2421
|
-
height: 3px;
|
|
2422
|
-
margin: -5.5px 0;
|
|
2423
|
-
border-radius: 2px;
|
|
2424
|
-
background: var(--dpk-blue);
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
.kanban-add {
|
|
2428
|
-
display: flex;
|
|
2429
|
-
flex-direction: column;
|
|
2430
|
-
gap: 6px;
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
.kanban-add-button {
|
|
2434
|
-
padding: 6px 8px;
|
|
2435
|
-
border: 1px dashed var(--dpk-rule-strong);
|
|
2436
|
-
border-radius: var(--dpk-radius-sm);
|
|
2437
|
-
background: none;
|
|
2438
|
-
color: var(--dpk-ink-soft);
|
|
2439
|
-
font-family: var(--dpk-body);
|
|
2440
|
-
font-size: 12px;
|
|
2441
|
-
text-align: left;
|
|
2442
|
-
cursor: pointer;
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
.kanban-add-button:hover,
|
|
2446
|
-
.kanban-add-button:focus-visible {
|
|
2447
|
-
border-color: var(--dpk-ink-soft);
|
|
2448
|
-
color: var(--dpk-ink);
|
|
2449
|
-
outline: none;
|
|
2450
|
-
}
|
|
2451
|
-
|
|
2452
|
-
.kanban-add .dpk-input {
|
|
2453
|
-
width: 100%;
|
|
2454
|
-
font-size: 12.5px;
|
|
2455
|
-
}
|
|
2456
|
-
`;class Ht extends we{static{this.styles=[W,ha]}#e=null;#s=null;#n=null;#t=null;#a=null;parseData(e){return Rt(e)}emptyData(){return na()}reduceElementActions(e,t){return pa(ie(this.locale),e,t)}defaultHeading(){return ie(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return ie(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(t=>({value:this.commentRef("column",t.id),label:t.label})),...re(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):ue(t,e.id)!==void 0}tagItems(){return re(this.items()).map(e=>e.tags)}statsText(){const e=ie(this.locale),t=re(this.items()).length,s=re(this.#i()).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.#s=null,this.#n=null)}renderCanvas(){const e=this.#i(),t=new Map(this.items().columns.map(s=>[s.id,s.cards.length]));return g`<div class="kanban-board">
|
|
2457
|
-
${me(e.columns,s=>s.id,s=>this.#o(s,t.get(s.id)??0))}
|
|
2458
|
-
</div>`}#i(){const e=this.tagFilter;return aa(this.items(),e.active.length===0?null:t=>K(t.tags,e))}#r(e,t){const s=this.selection;return s!==null&&s.kind===e&&s.id===t}#o(e,t){const s=ie(this.locale),a=e.limit!==null&&t>e.limit,r=this.#a?.column===e.id?this.#a:null;return g`
|
|
2459
|
-
<section
|
|
2460
|
-
class=${X("kanban-column",a&&"is-over",this.#r("column",e.id)&&"is-selected",r!==null&&"is-drop-target")}
|
|
2461
|
-
data-column=${e.id}
|
|
2462
|
-
data-color=${e.color??w}
|
|
2463
|
-
aria-label=${e.label}
|
|
2464
|
-
>
|
|
2465
|
-
<div class="kanban-column-head">
|
|
2466
|
-
<button
|
|
2467
|
-
type="button"
|
|
2468
|
-
class="kanban-column-title"
|
|
2469
|
-
aria-pressed=${this.#r("column",e.id)?"true":"false"}
|
|
2470
|
-
title=${e.description??e.label}
|
|
2471
|
-
@click=${()=>this.select({kind:"column",id:e.id})}
|
|
2472
|
-
>
|
|
2473
|
-
<span class="kanban-column-label">${e.label}</span>
|
|
2474
|
-
<span class="kanban-count" title=${e.limit===null?w:s.wipLimit(e.limit)}>
|
|
2475
|
-
${e.limit===null?t:`${t} / ${e.limit}`}
|
|
2476
|
-
</span>
|
|
2477
|
-
</button>
|
|
2478
|
-
${this.renderCommentTrigger({kind:"column",id:e.id},e.label)}
|
|
2479
|
-
</div>
|
|
2480
|
-
${e.description===null?w:g`<p class="kanban-column-description">${e.description}</p>`}
|
|
2481
|
-
<div
|
|
2482
|
-
class="kanban-cards"
|
|
2483
|
-
@dragover=${i=>this.#h(i,e.id)}
|
|
2484
|
-
@dragleave=${i=>this.#m(i)}
|
|
2485
|
-
@drop=${i=>this.#g(i,e.id)}
|
|
2486
|
-
>
|
|
2487
|
-
${me(e.cards,i=>i.id,i=>g`${r?.before===i.id?this.#l():w}${this.#p(i,s)}`)}
|
|
2488
|
-
${r!==null&&r.before===null?this.#l():w}
|
|
2489
|
-
</div>
|
|
2490
|
-
${this.#u(e,s)}
|
|
2491
|
-
</section>
|
|
2492
|
-
`}#l(){return g`<div class="kanban-drop-marker" aria-hidden="true"></div>`}#p(e,t){const s=this.#r("card",e.id);return g`
|
|
2493
|
-
<div class="kanban-card-slot">
|
|
2494
|
-
<div
|
|
2495
|
-
role="button"
|
|
2496
|
-
tabindex="0"
|
|
2497
|
-
draggable="true"
|
|
2498
|
-
class=${X("kanban-card",s&&"is-selected",e.change==="added"&&"is-added",e.change==="moved"&&"is-moved",this.#t===e.id&&"is-dragging")}
|
|
2499
|
-
data-card=${e.id}
|
|
2500
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
2501
|
-
title=${e.description??e.title}
|
|
2502
|
-
aria-pressed=${s?"true":"false"}
|
|
2503
|
-
@click=${()=>this.select({kind:"card",id:e.id})}
|
|
2504
|
-
@keydown=${a=>this.#c(a,e.id)}
|
|
2505
|
-
@dragstart=${a=>this.#b(a,e.id)}
|
|
2506
|
-
@dragend=${()=>this.#f()}
|
|
2507
|
-
>
|
|
2508
|
-
<span class="kanban-card-title">${e.title}</span>
|
|
2509
|
-
${e.description===null?w:g`<span class="kanban-card-description">${e.description}</span>`}
|
|
2510
|
-
${e.tags.length===0&&e.assignee===null?w:g`<span class="kanban-card-meta">
|
|
2511
|
-
${e.tags.map(a=>g`<span class="kanban-tag">${a}</span>`)}
|
|
2512
|
-
${e.assignee===null?w:g`<span class="kanban-assignee">${e.assignee}</span>`}
|
|
2513
|
-
</span>`}
|
|
2514
|
-
</div>
|
|
2515
|
-
${this.renderCommentTrigger({kind:"card",id:e.id},e.title)}
|
|
2516
|
-
${this.#n===e.id?g`<p class="kanban-error" role="alert">${t.notRecorded}</p>`:w}
|
|
2517
|
-
</div>
|
|
2518
|
-
`}#u(e,t){const s=this.#s?.column===e.id?this.#s:null;return g`<div class="kanban-add">
|
|
2519
|
-
${s===null?g`<button
|
|
2520
|
-
type="button"
|
|
2521
|
-
class="kanban-add-button"
|
|
2522
|
-
data-action="add"
|
|
2523
|
-
@click=${()=>this.#k(e.id)}
|
|
2524
|
-
>
|
|
2525
|
-
${t.addCardButton}
|
|
2526
|
-
</button>`:g`
|
|
2527
|
-
<input
|
|
2528
|
-
class="dpk-input"
|
|
2529
|
-
aria-label="${t.addCardAriaLabel(e.label)}"
|
|
2530
|
-
placeholder="${t.addCardPlaceholder}"
|
|
2531
|
-
.value=${s.title}
|
|
2532
|
-
@input=${a=>{const r=a.currentTarget;r instanceof HTMLInputElement&&(this.#s={...s,title:r.value,failed:!1})}}
|
|
2533
|
-
@keydown=${a=>this.#y(a,e.id)}
|
|
2534
|
-
/>
|
|
2535
|
-
${s.failed?g`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:w}
|
|
2536
|
-
`}
|
|
2537
|
-
</div>`}#c(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#d(e,t){const s=this.dispatchElementAction(Pt,["card",e],{column:t.column,before:t.before});this.#n=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#b(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#h(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#v(e,t);this.#a?.column===s.column&&this.#a.before===s.before||(this.#a=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#a=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const a=this.#v(e,t);this.#f(),ia(this.items(),s,a.column,a.before)||this.#d(s,a)}#f(){this.#t===null&&this.#a===null||(this.#t=null,this.#a=null,this.requestUpdate())}#v(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}}#k(e){this.#s={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#y(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#s=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#s?.title.trim()??"";if(s.length===0)return;const a=[...this.items().columns.map(i=>i.id),...re(this.items()).map(i=>i.id)],r=Te(`card ${s}`,a);if(!this.dispatchElementAction(It,["column",t],{id:r,title:s})){this.#s={column:t,title:s,failed:!0},this.requestUpdate();return}this.#s=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const Ut=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",Ht)},Bt=()=>{Ke(),nt(),rt(),bt(),yt(),Ot(),Ut()},ua=()=>{ss(),ns(),Bt()};export{vt as D,it as a,ft as b,Ht as c,Lt as d,st as e,Ye as f,yt as g,rt as h,bt as i,Ut as j,Ot as k,nt as l,Ke as m,Dt as n,Qe as o,Rt as p,Ge as q,ua as r,Bt as s};
|