dev-process-kit 0.0.18 → 0.2.0
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 +1 -1
- package/dist/chunks/shared-Ae8HmujL.js +49 -0
- package/dist/chunks/{shared-DEjjuQMh.js → shared-BCmqTEeQ.js} +9 -7
- package/dist/chunks/shared-BkM7jfZs.js +1104 -0
- package/dist/chunks/shared-Bo8OdTee.js +4206 -0
- package/dist/chunks/shared-C-7mxPbV.js +301 -0
- package/dist/chunks/shared-C-Os1zsf.js +572 -0
- package/dist/chunks/{shared-CWKqlSx3.js → shared-C02b6b2m.js} +1 -1
- package/dist/chunks/shared-CjW1DhGL.js +1 -0
- package/dist/chunks/{shared-8NAMqG0U.js → shared-DJruxrrR.js} +32 -50
- package/dist/chunks/{shared-DzxR5Yzc.js → shared-DLdJfSN-.js} +1 -1
- package/dist/chunks/{shared-CUPe-wfx.js → shared-DYKbMmHn.js} +8 -8
- package/dist/chunks/{shared-DRvgJdY6.js → shared-DbBoZvUP.js} +173 -203
- package/dist/chunks/shared-DbnPOaXf.js +4210 -0
- package/dist/chunks/shared-DnJBtKmH.js +3769 -0
- package/dist/chunks/shared-v63w_5VP.js +2774 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -2
- package/dist/chunks/shared-B00JP4in.js +0 -572
- package/dist/chunks/shared-BtN-8ibq.js +0 -30
- package/dist/chunks/shared-C6QYWD8M.js +0 -2560
- package/dist/chunks/shared-CpTDkEui.js +0 -3751
- package/dist/chunks/shared-CtHWU02m.js +0 -1
- package/dist/chunks/shared-D4K7KsfJ.js +0 -1
- package/dist/chunks/shared-DWY93NpU.js +0 -3598
- package/dist/chunks/shared-DXaIVZ_z.js +0 -2766
- package/dist/chunks/shared-Ezic-gbC.js +0 -1104
- package/dist/chunks/shared-IQ2sflGo.js +0 -1027
- package/dist/chunks/shared-ml5h7U5L.js +0 -1
- package/dist/templates/grill.js +0 -1
|
@@ -1,3598 +0,0 @@
|
|
|
1
|
-
import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs,J as Ds,a7 as I,a8 as Ye,a9 as Ve,aa as We,A as Ke,ab as Ts,ac as As,ad as G,ae as q,af as f,ag as z,ah as u,ai as H,aj as S,ak as M,al as ae,am as Xe,an as Je,ao as Z,ap as we,aq as Ze,ar as Ls,as as Rs,at as $e,au as Se,av as Os,aw as Me,l as Qe,ax as Is,ay as Ps,az as js,aA as ne,q as Fs,r as Ns}from"./shared-DXaIVZ_z.js";import{i as et}from"./shared-CWKqlSx3.js";import{p as tt,r as st,c as at}from"./shared-BtN-8ibq.js";import{c as me}from"./shared-ml5h7U5L.js";const Us='script[type="application/json"]',nt=(a,e)=>{const t=a.querySelector(Us);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}},rt=(a,e,t)=>{const s=nt(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=nt(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},it={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,n)=>s-n);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Hs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,n=new Set,r=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?n.add(o.id):d==="new"&&r(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&r(i.id);return{reversed:n,forward:e.filter(i=>!n.has(i.id))}},_s=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const n=new Map(a.map(o=>[o.id,0])),r=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(r.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=n.get(d.to)??0;n.set(d.to,Math.max(l,(n.get(o)??0)+1));const c=(r.get(d.to)??0)-1;r.set(d.to,c),c===0&&i.push(d.to)}return n},Bs=(a,e,t,s)=>{const n=[...a.keys()].sort((r,i)=>r-i);for(let r=0;r<s;r++){const i=r%2===0;for(const o of i?n:[...n].reverse()){const d=a.get(o)??[],l=new Map(d.map((p,k)=>[p,k])),c=p=>{const k=l.get(p);return k===void 0?null:k},g=d.map(p=>{const k=(e.get(p)??[]).filter(x=>(t.get(x)??o)===o+(i?-1:1)).map(c).filter(x=>x!==null);return{id:p,want:k.length>0?ge(k):l.get(p)??0}});g.sort((p,k)=>p.want-k.want||(l.get(p.id)??0)-(l.get(k.id)??0)),a.set(o,g.map(p=>p.id))}}},ot=(a,e,t,s)=>{const n=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));n.sort((i,o)=>i.want-o.want||i.index-o.index);let r=0;for(const i of n){const o=e.get(i.id);o&&(o.y=r,r+=o.spec.height+s)}return{height:Math.max(0,r-s)}},Gs=(a,e,t,s,n)=>{const r=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of r)i.set(l,ot(a.get(l)??[],e,new Map,n.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of r){const c=(o-(i.get(l)??0))/2;for(const g of a.get(l)??[]){const p=e.get(g);p&&(p.y+=c)}}const d=(l,c)=>{const g=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const k=e.get(p);return k?[k.y+k.spec.height/2]:[]});return g.length>0?ge(g):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const g of c?r:[...r].reverse()){const p=a.get(g)??[],k=new Map;for(const w of p){const D=d(w,g+(c?-1:1)),L=e.get(w);L!==void 0&&k.set(w,D===null?L.y+L.spec.height/2:D)}const x=p.map(w=>e.get(w)?.y??0);ot(p,e,k,n.nodeSpacing);const v=p.map(w=>e.get(w)?.y??0),y=ge(x)-ge(v);for(const w of p){const D=e.get(w);D&&(D.y+=y)}}}},dt=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},lt=(a,e,t)=>{let s=0;const n=[];for(const r of a){const i=t.byId.get(r.from),o=t.byId.get(r.to);if(!i||!o)continue;const d=dt(i,r.fromPort,"out"),l=dt(o,r.toPort,"in");if(r.from===r.to){const x=i.x+i.spec.width,v=i.y+i.spec.height,y=Math.max(t.padding/2,v+18);n.push({id:r.id,points:[d,{x:x+20,y:d.y},{x:x+20,y},{x:i.x-20,y},{x:i.x-20,y:l.y},l]});continue}if(!e.has(r.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){n.push({id:r.id,points:[d,l]});continue}const v=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;n.push({id:r.id,points:[d,{x:v,y:d.y},{x:v,y:l.y},l]});continue}const c=r.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,g=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,g.y)+18+s*14;s+=1;const k=[d,c,{x:c.x,y:p},{x:g.x,y:p},g,l].filter((x,v,y)=>v===0||x.x!==y[v-1]?.x||x.y!==y[v-1]?.y);n.push({id:r.id,points:k})}return n},ct=(a,e,t)=>{const s=e.flatMap(p=>[...p.points]),n=[...a.map(p=>p.x),...a.map(p=>p.x+p.spec.width),...s.map(p=>p.x)],r=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,g=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+g,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(k=>({x:k.x+c,y:k.y+g}))}))}},pt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},ht=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Ys=(a,e)=>{const t=new Map;for(const s of a){const n=e.get(s.id)??0,r=t.get(n);r?r.push(s.id):t.set(n,[s.id])}return t},Vs=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(v=>v.id)),r=e.filter(v=>n.has(v.from)&&n.has(v.to)),{forward:i,reversed:o}=Hs(a,r),d=_s(a,i),l=Ys(a,d);Bs(l,pt(a,r),d,s.sweeps);const c=new Map;for(const v of l.values())v.forEach((y,w)=>c.set(y,w));const g=ht(a,d,c,()=>({x:0,y:0})),p=new Map(g.map(v=>[v.spec.id,v]));Gs(l,p,pt(a,r),d,s);const k=[...l.keys()].sort((v,y)=>v-y);let x=0;for(const v of k){const y=Math.max(...(l.get(v)??[]).map(w=>p.get(w)?.spec.width??0));for(const w of l.get(v)??[]){const D=p.get(w);D&&(D.x=x)}x+=y+s.layerSpacing}return ct(g,lt(r,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ws=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(d=>d.id)),r=e.filter(d=>n.has(d.from)&&n.has(d.to)),i=ht(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return ct(i,lt(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ks=_({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Xs={active:[],match:"single"},Q=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Js=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Zs=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Qs=a=>({...a,active:[]}),ea=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},Y={nodes:new Map,edges:new Set},N=(a,e,t,s)=>{const n=new Map,r=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,g=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(g)&&(o.add(g),n.set(g,d.depth+1),i.push({id:g,depth:d.depth+1})))}return{nodes:n,edges:r}},ta=(a,e)=>{const t=new Map(a.map(r=>[r,N(e,r,"outgoing",!0).nodes])),s=new Set,n=[];for(const r of a){if(s.has(r))continue;const i=a.filter(o=>o===r||t.get(r)?.has(o)===!0&&t.get(o)?.has(r)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===r&&o.to===r))&&n.push(i)}return n},Ce=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ut=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),mt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},gt=(a,e,t,s)=>{const n=e!==null&&e.kind===t&&e.id===a,r=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:n,related:r&&!n,dimmed:e!==null&&!n&&!r,depth:i}},ee=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),sa=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const r=a[1]??e,i=a[2]??t;return{x:r.x,y:(r.y+i.y)/2}}const s=a[2]??e,n=a[3]??t;return{x:(s.x+n.x)/2,y:s.y}},aa=(a,e)=>ea(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),na=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[_e,Be,Ge,B`
|
|
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
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
resize: vertical;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
* Maximized: the shell covers the viewport. It is also a manual popover in
|
|
24
|
-
* the top layer, so the UA popover box (fit-content, margin, border,
|
|
25
|
-
* padding) is reset here. A vertical resize leaves an inline height behind,
|
|
26
|
-
* which only !important overrides.
|
|
27
|
-
*/
|
|
28
|
-
.diagram.is-maximized {
|
|
29
|
-
position: fixed;
|
|
30
|
-
inset: 0;
|
|
31
|
-
z-index: 2147483000;
|
|
32
|
-
width: auto !important;
|
|
33
|
-
height: auto !important;
|
|
34
|
-
max-width: none;
|
|
35
|
-
max-height: none;
|
|
36
|
-
margin: 0;
|
|
37
|
-
padding: 0;
|
|
38
|
-
border: 0;
|
|
39
|
-
border-radius: 0;
|
|
40
|
-
color: var(--dpk-ink);
|
|
41
|
-
background:
|
|
42
|
-
radial-gradient(
|
|
43
|
-
ellipse 900px 400px at 0% 0%,
|
|
44
|
-
color-mix(in srgb, var(--dpk-accent) 4%, transparent),
|
|
45
|
-
transparent 70%
|
|
46
|
-
),
|
|
47
|
-
var(--dpk-paper-raised);
|
|
48
|
-
box-shadow: none;
|
|
49
|
-
resize: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.diagram-maximize {
|
|
53
|
-
flex-shrink: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.diagram-toolbar {
|
|
57
|
-
display: flex;
|
|
58
|
-
align-items: center;
|
|
59
|
-
gap: 10px;
|
|
60
|
-
flex-wrap: wrap;
|
|
61
|
-
min-height: 44px;
|
|
62
|
-
padding: 8px 14px;
|
|
63
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
64
|
-
background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
|
|
65
|
-
box-shadow: 0 1px 0 var(--dpk-highlight) inset;
|
|
66
|
-
flex-shrink: 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.diagram-title {
|
|
70
|
-
font-family: var(--dpk-display);
|
|
71
|
-
font-size: 12.5px;
|
|
72
|
-
font-weight: 660;
|
|
73
|
-
letter-spacing: -0.015em;
|
|
74
|
-
color: var(--dpk-ink);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* A long heading or subject elides (the full text is its tooltip) instead of pushing the actions off the toolbar. */
|
|
78
|
-
.diagram-title,
|
|
79
|
-
.diagram-subject {
|
|
80
|
-
min-width: 0;
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
overflow: hidden;
|
|
83
|
-
text-overflow: ellipsis;
|
|
84
|
-
white-space: nowrap;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.diagram-subject {
|
|
88
|
-
font-size: 10px;
|
|
89
|
-
color: var(--dpk-ink-faint);
|
|
90
|
-
padding-left: 10px;
|
|
91
|
-
border-left: 1px solid var(--dpk-rule-strong);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.diagram-toolbar-actions {
|
|
95
|
-
display: flex;
|
|
96
|
-
align-items: center;
|
|
97
|
-
gap: 6px;
|
|
98
|
-
margin-left: auto;
|
|
99
|
-
flex-wrap: wrap;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.diagram-stats {
|
|
103
|
-
font-family: var(--dpk-mono);
|
|
104
|
-
font-size: 10px;
|
|
105
|
-
font-weight: 550;
|
|
106
|
-
padding: 3px 9px;
|
|
107
|
-
border: 1px solid var(--dpk-rule);
|
|
108
|
-
border-radius: 999px;
|
|
109
|
-
background: var(--dpk-paper-sunken);
|
|
110
|
-
color: var(--dpk-ink-faint);
|
|
111
|
-
font-variant-numeric: tabular-nums;
|
|
112
|
-
white-space: nowrap;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.diagram-tags {
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
gap: 5px;
|
|
119
|
-
flex-wrap: wrap;
|
|
120
|
-
padding: 7px 12px;
|
|
121
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
122
|
-
background: var(--dpk-paper);
|
|
123
|
-
flex-shrink: 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.diagram-match {
|
|
127
|
-
display: flex;
|
|
128
|
-
gap: 2px;
|
|
129
|
-
padding: 3px;
|
|
130
|
-
margin-right: 6px;
|
|
131
|
-
border: 1px solid var(--dpk-rule);
|
|
132
|
-
border-radius: var(--dpk-radius-sm);
|
|
133
|
-
background: var(--dpk-paper-sunken);
|
|
134
|
-
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.diagram-match button {
|
|
138
|
-
border: 0;
|
|
139
|
-
border-radius: var(--dpk-radius-xs);
|
|
140
|
-
padding: 4px 8px;
|
|
141
|
-
background: transparent;
|
|
142
|
-
color: var(--dpk-ink-faint);
|
|
143
|
-
font-size: 9.5px;
|
|
144
|
-
font-weight: 600;
|
|
145
|
-
letter-spacing: 0.01em;
|
|
146
|
-
cursor: pointer;
|
|
147
|
-
transition:
|
|
148
|
-
background 160ms var(--dpk-ease),
|
|
149
|
-
color 160ms var(--dpk-ease),
|
|
150
|
-
box-shadow 160ms var(--dpk-ease);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.diagram-match button:hover[aria-pressed='false'] {
|
|
154
|
-
color: var(--dpk-ink-soft);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.diagram-match button[aria-pressed='true'] {
|
|
158
|
-
background: var(--dpk-paper-raised);
|
|
159
|
-
color: var(--dpk-ink);
|
|
160
|
-
font-weight: 650;
|
|
161
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.dpk-tag {
|
|
165
|
-
display: inline-flex;
|
|
166
|
-
align-items: center;
|
|
167
|
-
gap: 5px;
|
|
168
|
-
max-width: 100%;
|
|
169
|
-
padding: 4px 9px;
|
|
170
|
-
border: 1px solid transparent;
|
|
171
|
-
border-radius: var(--dpk-radius-xs);
|
|
172
|
-
background: var(--dpk-paper-inset);
|
|
173
|
-
color: var(--dpk-ink-soft);
|
|
174
|
-
font-size: 10.5px;
|
|
175
|
-
cursor: pointer;
|
|
176
|
-
transition:
|
|
177
|
-
background 140ms var(--dpk-ease),
|
|
178
|
-
color 140ms var(--dpk-ease),
|
|
179
|
-
border-color 140ms var(--dpk-ease),
|
|
180
|
-
box-shadow 140ms var(--dpk-ease);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.dpk-tag:hover {
|
|
184
|
-
background: var(--dpk-paper-sunken);
|
|
185
|
-
color: var(--dpk-ink);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.dpk-tag[aria-pressed='true'] {
|
|
189
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
|
|
190
|
-
background: var(--dpk-blue-soft);
|
|
191
|
-
color: var(--dpk-blue);
|
|
192
|
-
font-weight: 600;
|
|
193
|
-
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.dpk-tag-name {
|
|
197
|
-
min-width: 0;
|
|
198
|
-
overflow: hidden;
|
|
199
|
-
text-overflow: ellipsis;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.dpk-tag-count {
|
|
204
|
-
flex: none;
|
|
205
|
-
font-family: var(--dpk-mono);
|
|
206
|
-
font-size: 9px;
|
|
207
|
-
opacity: 0.7;
|
|
208
|
-
font-variant-numeric: tabular-nums;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.dpk-tag-clear {
|
|
212
|
-
border: 0;
|
|
213
|
-
background: none;
|
|
214
|
-
padding: 4px 6px;
|
|
215
|
-
color: var(--dpk-ink-faint);
|
|
216
|
-
font-size: 10px;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.diagram-canvas {
|
|
221
|
-
position: relative;
|
|
222
|
-
flex: 1;
|
|
223
|
-
min-height: 220px;
|
|
224
|
-
overflow: hidden;
|
|
225
|
-
touch-action: none;
|
|
226
|
-
cursor: grab;
|
|
227
|
-
background: var(--dpk-dots), var(--dpk-paper-sunken);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.diagram-canvas:focus-visible {
|
|
231
|
-
outline: none;
|
|
232
|
-
box-shadow: inset var(--dpk-focus);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.diagram-canvas.is-panning {
|
|
236
|
-
cursor: grabbing;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.diagram-world {
|
|
240
|
-
position: absolute;
|
|
241
|
-
inset: 0 auto auto 0;
|
|
242
|
-
transform-origin: 0 0;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.diagram-edges {
|
|
246
|
-
position: absolute;
|
|
247
|
-
inset: 0;
|
|
248
|
-
overflow: visible;
|
|
249
|
-
pointer-events: none;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.diagram-zoom {
|
|
253
|
-
position: absolute;
|
|
254
|
-
right: 12px;
|
|
255
|
-
bottom: 12px;
|
|
256
|
-
display: flex;
|
|
257
|
-
overflow: hidden;
|
|
258
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
259
|
-
border-radius: var(--dpk-radius-sm);
|
|
260
|
-
background: var(--dpk-glass);
|
|
261
|
-
backdrop-filter: blur(12px);
|
|
262
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.diagram-zoom button {
|
|
266
|
-
display: inline-flex;
|
|
267
|
-
align-items: center;
|
|
268
|
-
justify-content: center;
|
|
269
|
-
border: 0;
|
|
270
|
-
border-radius: 0;
|
|
271
|
-
padding: 6px 9px;
|
|
272
|
-
background: transparent;
|
|
273
|
-
color: var(--dpk-ink-soft);
|
|
274
|
-
font-size: 10.5px;
|
|
275
|
-
cursor: pointer;
|
|
276
|
-
transition:
|
|
277
|
-
background 140ms var(--dpk-ease),
|
|
278
|
-
color 140ms var(--dpk-ease);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.diagram-zoom button svg {
|
|
282
|
-
width: 12px;
|
|
283
|
-
height: 12px;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.diagram-zoom button + button {
|
|
287
|
-
border-left: 1px solid var(--dpk-rule);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.diagram-zoom button:hover {
|
|
291
|
-
background: var(--dpk-paper-inset);
|
|
292
|
-
color: var(--dpk-ink);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.diagram-zoom-value {
|
|
296
|
-
font-family: var(--dpk-mono);
|
|
297
|
-
font-variant-numeric: tabular-nums;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.diagram-legend {
|
|
301
|
-
position: absolute;
|
|
302
|
-
left: 12px;
|
|
303
|
-
bottom: 14px;
|
|
304
|
-
display: flex;
|
|
305
|
-
gap: 12px;
|
|
306
|
-
flex-wrap: wrap;
|
|
307
|
-
max-width: calc(100% - 150px);
|
|
308
|
-
padding: 4px 8px;
|
|
309
|
-
border: 1px solid var(--dpk-rule);
|
|
310
|
-
border-radius: var(--dpk-radius-xs);
|
|
311
|
-
background: var(--dpk-glass);
|
|
312
|
-
backdrop-filter: blur(10px);
|
|
313
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
314
|
-
font-size: 9.5px;
|
|
315
|
-
color: var(--dpk-ink-faint);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.diagram-legend span {
|
|
319
|
-
display: inline-flex;
|
|
320
|
-
align-items: center;
|
|
321
|
-
gap: 5px;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.diagram-legend i {
|
|
325
|
-
width: 16px;
|
|
326
|
-
border-top: 1.6px solid var(--dpk-rule-strong);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.diagram-empty,
|
|
330
|
-
.diagram-notice {
|
|
331
|
-
position: absolute;
|
|
332
|
-
left: 50%;
|
|
333
|
-
top: 50%;
|
|
334
|
-
transform: translate(-50%, -50%);
|
|
335
|
-
margin: 0;
|
|
336
|
-
max-width: min(80%, 360px);
|
|
337
|
-
font-size: 12px;
|
|
338
|
-
color: var(--dpk-ink-faint);
|
|
339
|
-
text-align: center;
|
|
340
|
-
pointer-events: none;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
.diagram-empty {
|
|
344
|
-
padding: 16px 26px;
|
|
345
|
-
border: 1.5px dashed var(--dpk-rule-strong);
|
|
346
|
-
border-radius: var(--dpk-radius);
|
|
347
|
-
background: color-mix(in srgb, var(--dpk-paper-raised) 55%, transparent);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.diagram-notice {
|
|
351
|
-
pointer-events: auto;
|
|
352
|
-
padding: 12px 16px 12px 19px;
|
|
353
|
-
border: 1px solid color-mix(in srgb, var(--dpk-danger) 35%, transparent);
|
|
354
|
-
border-radius: var(--dpk-radius);
|
|
355
|
-
background: linear-gradient(90deg, var(--dpk-danger) 0 3px, transparent 3px), var(--dpk-danger-soft);
|
|
356
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow);
|
|
357
|
-
color: var(--dpk-ink-soft);
|
|
358
|
-
text-align: left;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.diagram-notice p {
|
|
362
|
-
margin: 0 0 9px;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/*
|
|
366
|
-
* Contextual comments: an icon per element, revealed while the element that
|
|
367
|
-
* contains it (or the element just before it) is hovered, focused or
|
|
368
|
-
* selected, and always on touch devices. It opens the composer beside it.
|
|
369
|
-
*/
|
|
370
|
-
.diagram-comment-trigger {
|
|
371
|
-
display: grid;
|
|
372
|
-
place-items: center;
|
|
373
|
-
width: 28px;
|
|
374
|
-
height: 28px;
|
|
375
|
-
padding: 5px;
|
|
376
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
377
|
-
border-radius: var(--dpk-radius-sm);
|
|
378
|
-
background: var(--dpk-paper-raised);
|
|
379
|
-
color: var(--dpk-ink-soft);
|
|
380
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
381
|
-
cursor: pointer;
|
|
382
|
-
opacity: 0;
|
|
383
|
-
pointer-events: none;
|
|
384
|
-
transition:
|
|
385
|
-
opacity 120ms ease,
|
|
386
|
-
background 160ms var(--dpk-ease),
|
|
387
|
-
color 160ms var(--dpk-ease),
|
|
388
|
-
border-color 160ms var(--dpk-ease),
|
|
389
|
-
box-shadow 160ms var(--dpk-ease),
|
|
390
|
-
transform 160ms var(--dpk-ease-spring);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.diagram-comment-trigger.is-placed {
|
|
394
|
-
position: absolute;
|
|
395
|
-
z-index: 2;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.diagram-comment-trigger svg {
|
|
399
|
-
width: 16px;
|
|
400
|
-
height: 16px;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
.diagram-edge-comment {
|
|
404
|
-
overflow: visible;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
.diagram-edge-comment .diagram-comment-trigger {
|
|
408
|
-
margin: 2px;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
:is(.d-node, .d-edge):is(:hover, :focus-within, .is-selected) .diagram-comment-trigger,
|
|
412
|
-
:is(:hover, :focus-visible, .is-selected) + .diagram-comment-trigger,
|
|
413
|
-
.diagram-comment-trigger:is(:hover, :focus-visible, [aria-expanded='true']) {
|
|
414
|
-
opacity: 1;
|
|
415
|
-
pointer-events: auto;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.diagram-comment-trigger:hover,
|
|
419
|
-
.diagram-comment-trigger:focus-visible {
|
|
420
|
-
color: var(--dpk-accent);
|
|
421
|
-
border-color: var(--dpk-accent);
|
|
422
|
-
background: var(--dpk-accent-soft);
|
|
423
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
424
|
-
transform: translateY(-1px);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.diagram-comment-trigger:focus-visible {
|
|
428
|
-
outline: none;
|
|
429
|
-
box-shadow: var(--dpk-focus);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
@media (hover: none) {
|
|
433
|
-
.diagram-comment-trigger {
|
|
434
|
-
opacity: 1;
|
|
435
|
-
pointer-events: auto;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
.comment-target {
|
|
440
|
-
font-size: 12px;
|
|
441
|
-
overflow-wrap: anywhere;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.comment-error {
|
|
445
|
-
margin: 0;
|
|
446
|
-
font-size: 11px;
|
|
447
|
-
color: var(--dpk-accent);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
/* Element state, shared by every diagram so highlighting reads the same. */
|
|
451
|
-
.d-node {
|
|
452
|
-
position: absolute;
|
|
453
|
-
cursor: pointer;
|
|
454
|
-
transition:
|
|
455
|
-
opacity 150ms ease,
|
|
456
|
-
border-color 160ms var(--dpk-ease),
|
|
457
|
-
box-shadow 160ms var(--dpk-ease),
|
|
458
|
-
background 160ms var(--dpk-ease),
|
|
459
|
-
transform 160ms var(--dpk-ease);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.d-node.is-dimmed,
|
|
463
|
-
.d-edge.is-dimmed {
|
|
464
|
-
opacity: 0.26;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
.d-edge {
|
|
468
|
-
outline: none;
|
|
469
|
-
cursor: pointer;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.d-edge-hit {
|
|
473
|
-
fill: none;
|
|
474
|
-
stroke: transparent;
|
|
475
|
-
stroke-width: 16;
|
|
476
|
-
pointer-events: stroke;
|
|
477
|
-
cursor: pointer;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
.d-edge-path {
|
|
481
|
-
fill: none;
|
|
482
|
-
stroke: var(--dpk-rule-strong);
|
|
483
|
-
stroke-width: 1.5;
|
|
484
|
-
stroke-linejoin: round;
|
|
485
|
-
stroke-linecap: round;
|
|
486
|
-
transition:
|
|
487
|
-
stroke 160ms var(--dpk-ease),
|
|
488
|
-
stroke-width 160ms var(--dpk-ease);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
.d-edge.is-selected .d-edge-path,
|
|
492
|
-
.d-edge:focus-visible .d-edge-path {
|
|
493
|
-
stroke: var(--dpk-ink);
|
|
494
|
-
stroke-width: 2.6;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
.d-edge:focus-visible .d-edge-hit {
|
|
498
|
-
stroke: var(--dpk-blue-soft);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
.d-edge-label {
|
|
502
|
-
font-size: 9.5px;
|
|
503
|
-
fill: var(--dpk-ink-faint);
|
|
504
|
-
paint-order: stroke;
|
|
505
|
-
stroke: var(--dpk-paper-raised);
|
|
506
|
-
stroke-width: 5px;
|
|
507
|
-
stroke-linejoin: round;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
.d-edge-label.is-dimmed {
|
|
511
|
-
opacity: 0.3;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
@media (max-width: 700px) {
|
|
515
|
-
.diagram-subject {
|
|
516
|
-
display: none;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
`],re=a=>a.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),ft=a=>I`
|
|
520
|
-
<defs>
|
|
521
|
-
${a.map(e=>I`
|
|
522
|
-
<marker
|
|
523
|
-
id=${e.id}
|
|
524
|
-
viewBox="0 0 10 10"
|
|
525
|
-
refX="9"
|
|
526
|
-
refY="5"
|
|
527
|
-
markerWidth="7"
|
|
528
|
-
markerHeight="7"
|
|
529
|
-
orient="auto-start-reverse"
|
|
530
|
-
>
|
|
531
|
-
<path
|
|
532
|
-
class="diagram-arrow"
|
|
533
|
-
d=${e.open===!0?"M1 1 L9 5 L1 9":"M1 1 L9 5 L1 9 Z"}
|
|
534
|
-
fill=${e.open===!0||e.color===void 0?b:e.color}
|
|
535
|
-
stroke=${e.color??b}
|
|
536
|
-
stroke-width="1.3"
|
|
537
|
-
></path>
|
|
538
|
-
</marker>
|
|
539
|
-
`)}
|
|
540
|
-
</defs>
|
|
541
|
-
`,ra=(a,e,t,s)=>h`
|
|
542
|
-
<div class="diagram-tags" role="group" aria-label=${a.tagFilter}>
|
|
543
|
-
<div class="diagram-match" role="group" aria-label=${a.tagMatch}>
|
|
544
|
-
${[["single","Single"],["all","AND"],["any","OR"]].map(([n,r])=>h`
|
|
545
|
-
<button
|
|
546
|
-
type="button"
|
|
547
|
-
data-match=${n}
|
|
548
|
-
aria-pressed=${t===n?"true":"false"}
|
|
549
|
-
@click=${()=>s({kind:"match",match:n})}
|
|
550
|
-
>
|
|
551
|
-
${r}
|
|
552
|
-
</button>
|
|
553
|
-
`)}
|
|
554
|
-
</div>
|
|
555
|
-
${J(e,n=>n.tag,n=>h`
|
|
556
|
-
<button
|
|
557
|
-
type="button"
|
|
558
|
-
class="dpk-tag"
|
|
559
|
-
data-tag=${n.tag}
|
|
560
|
-
aria-pressed=${n.selected?"true":"false"}
|
|
561
|
-
@click=${()=>s({kind:"tag",tag:n.tag})}
|
|
562
|
-
>
|
|
563
|
-
<span class="dpk-tag-name" title=${n.tag}>${n.tag}</span><span class="dpk-tag-count">${n.count}</span>
|
|
564
|
-
</button>
|
|
565
|
-
`)}
|
|
566
|
-
${e.some(n=>n.selected)?h`<button type="button" class="dpk-tag-clear" @click=${()=>s({kind:"clear-tags"})}>
|
|
567
|
-
${a.clearTags}
|
|
568
|
-
</button>`:b}
|
|
569
|
-
</div>
|
|
570
|
-
`,ia=(a,e)=>h`
|
|
571
|
-
<div class="diagram-zoom">
|
|
572
|
-
<button
|
|
573
|
-
type="button"
|
|
574
|
-
aria-label=${a.zoomOut}
|
|
575
|
-
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1/1.1})}}
|
|
576
|
-
>
|
|
577
|
-
${zs()}
|
|
578
|
-
</button>
|
|
579
|
-
<button
|
|
580
|
-
type="button"
|
|
581
|
-
class="diagram-zoom-value"
|
|
582
|
-
title=${a.fit}
|
|
583
|
-
aria-label=${a.fit}
|
|
584
|
-
@click=${()=>e?.({kind:"fit"})}
|
|
585
|
-
>
|
|
586
|
-
100%
|
|
587
|
-
</button>
|
|
588
|
-
<button
|
|
589
|
-
type="button"
|
|
590
|
-
aria-label=${a.zoomIn}
|
|
591
|
-
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1.1})}}
|
|
592
|
-
>
|
|
593
|
-
${Ds()}
|
|
594
|
-
</button>
|
|
595
|
-
</div>
|
|
596
|
-
`,Ee=.08,oa=1.8,da=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(r=>r.x)),t=Math.min(...a.map(r=>r.y)),s=Math.max(...a.map(r=>r.x+r.width))-e,n=Math.max(...a.map(r=>r.y+r.height))-t;return{x:e-s*.1,y:t-n*.1,width:s*1.2,height:n*1.2}},qe=(a,e)=>a+e/12,la=(a,e)=>{if(a.length===0)return null;const t=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<t+e);return{x:Math.min(...s.map(n=>n.x)),y:t}},ze=16,bt=(a,e,t,s,n="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const r=(i,o,d,l)=>{const c=d*a.scale;return c<=l?n==="start"?ze-qe(o,d)*a.scale:(l-c)/2-o*a.scale:Math.min(-o*a.scale,Math.max(l-(o+d)*a.scale,i))};return{...a,x:r(a.x,e.x,e.width,t),y:r(a.y,e.y,e.height,s)}},ca=(a,e,t,s,n,r,i="center")=>{const o=bt({...a,x:a.x-n,y:a.y-r},e,t,s,i);return Math.abs(r)>Math.abs(n)&&o.y===a.y?null:o},kt='button,[role="button"],a,input,textarea,select',pa=a=>{const{canvas:e,world:t,onClearSelection:s,onView:n,align:r="center"}=a;let i={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const d=()=>({width:e.clientWidth||1e3,height:e.clientHeight||560}),l=()=>{const{width:m,height:C}=d();o=bt(o,i,m,C,r),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,n?.(o)},c=()=>{const{width:m,height:C}=d(),E=i.width/1.2||1,O=i.height/1.2||1;o={...o,scale:me(Math.min((m-24)/E,(C-40)/O),Ee,1)},o={...o,x:(m-i.width*o.scale)/2-i.x*o.scale,y:(C-i.height*o.scale)/2-i.y*o.scale},l()},g=()=>{const{width:m}=d(),C=i.width/1.2||1,E=me((m-24)/C,Ee,1);o={scale:E,x:(m-i.width*E)/2-i.x*E,y:16},l()},p=m=>{o={scale:1,x:ze-(m?.x??qe(i.x,i.width)),y:ze-(m?.y??qe(i.y,i.height))},l()},k=(m,C=d().width/2,E=d().height/2)=>{const O=o.scale,P=me(O*m,Ee,oa);P!==O&&(o={scale:P,x:C-(C-o.x)*P/O,y:E-(E-o.y)*P/O},l())},x=m=>{if(m.target instanceof Element&&m.target.closest(".diagram-zoom"))return;const C=m.deltaMode===1?16:m.deltaMode===2?d().height:1;if(m.ctrlKey||m.metaKey){m.preventDefault();const X=e.getBoundingClientRect();k(Math.exp(-me(m.deltaY*C,-60,60)*.0012),m.clientX-X.left,m.clientY-X.top);return}const{width:E,height:O}=d(),P=ca(o,i,E,O,m.deltaX*C,m.deltaY*C,r);P!==null&&(m.preventDefault(),o=P,l())},v=new Map;let y=null,w=!1;const D=()=>{const m=[...v.values()],C=m[0];if(!C)return null;const E=m[1];return E?{x:(C.x+E.x)/2,y:(C.y+E.y)/2,distance:Math.hypot(E.x-C.x,E.y-C.y)}:{...C,distance:0}},L=m=>{v.size===0&&(w=!1);const E=(m.target instanceof Element?m.target:null)?.closest(kt)??null;m.button!==0||m.pointerType!=="touch"&&E!==null||(v.set(m.pointerId,{x:m.clientX,y:m.clientY}),y=D(),E===null&&e.setPointerCapture(m.pointerId),m.pointerType!=="touch"&&E===null&&(m.preventDefault(),e.focus({preventScroll:!0})))},T=m=>{if(!v.has(m.pointerId)||y===null)return;v.set(m.pointerId,{x:m.clientX,y:m.clientY});const C=D();if(C===null)return;const E=C.x-y.x,O=C.y-y.y;if((Math.abs(E)+Math.abs(O)>1||Math.abs(C.distance-y.distance)>1)&&(w=!0),C.distance>0&&y.distance>0){const P=e.getBoundingClientRect();k(Math.pow(C.distance/y.distance,.45),y.x-P.left,y.y-P.top)}o={...o,x:o.x+E,y:o.y+O},l(),y=C,e.classList.toggle("is-panning",w)},j=m=>{v.delete(m.pointerId),y=D(),!(v.size>0)&&(e.classList.remove("is-panning"),m.type==="pointercancel"&&(w=!1))},V=m=>{w&&(m.preventDefault(),m.stopPropagation()),j(m)},$=m=>{if(w){m.preventDefault(),m.stopPropagation(),w=!1;return}const C=m.target instanceof Element?m.target:null;C===null||C.closest(kt)!==null||s()},A=m=>{if(m.target!==e)return;const C=30;if(m.key==="+"||m.key==="=")k(1.1);else if(m.key==="-")k(1/1.1);else if(m.key==="0")c();else if(m.key==="Escape")s();else if(m.key==="ArrowLeft"||m.key==="ArrowRight"||m.key==="ArrowUp"||m.key==="ArrowDown")o={...o,x:o.x+(m.key==="ArrowLeft"?C:m.key==="ArrowRight"?-C:0),y:o.y+(m.key==="ArrowUp"?C:m.key==="ArrowDown"?-C:0)},l();else return;m.preventDefault()},R=m=>{const C=m.target instanceof HTMLElement?m.target:null;if(C===null||!t.contains(C))return;const E=C.getBoundingClientRect(),O=e.getBoundingClientRect();let P=0,X=0;E.left<O.left+12?P=O.left+12-E.left:E.right>O.right-12&&(P=O.right-12-E.right),E.top<O.top+12?X=O.top+12-E.top:E.bottom>O.bottom-40&&(X=O.bottom-40-E.bottom),!(P===0&&X===0)&&(o={...o,x:o.x+P,y:o.y+X},l())};e.addEventListener("wheel",x,{passive:!1}),e.addEventListener("pointerdown",L),e.addEventListener("pointermove",T),e.addEventListener("pointerup",V),e.addEventListener("pointercancel",j),e.addEventListener("lostpointercapture",j),e.addEventListener("click",$,!0),e.addEventListener("keydown",A),e.addEventListener("focusin",R);const U=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return U?.observe(e),{setContent(m){i=da(m.width===0&&m.height===0?[]:[m]),t.style.width=`${m.width}px`,t.style.height=`${m.height}px`,l()},apply:l,fit:c,fitWidth:g,reset:p,zoom:k,view:()=>({...o}),destroy(){U?.disconnect(),e.removeEventListener("wheel",x),e.removeEventListener("pointerdown",L),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",V),e.removeEventListener("pointercancel",j),e.removeEventListener("lostpointercapture",j),e.removeEventListener("click",$,!0),e.removeEventListener("keydown",A),e.removeEventListener("focusin",R)}}};class De extends Ye{static{this.styles=W}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=null;#a=[];#t=[];#n=null;#r=Xs;#i=null;#o=null;#c=null;#u=null;#l=-1;#p="";#h=null;#f=null;#d=new Map;#m=null;#g=new Map;#b=null;#k=new Ve(this);#v=new We(this,()=>{this.#p=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#p="",this.requestUpdate(),this.#u=rt(this,e=>this.parseData(e),e=>{e.ok?this.#x(e.value):this.#R(e.error)})}disconnectedCallback(){super.disconnectedCallback(),this.#u?.(),this.#u=null,this.#o?.destroy(),this.#o=null,this.#c=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#x(this.data)}updated(){this.#M(),this.#$(),this.#A(),this.#C()}#$(){const e=this.renderRoot.querySelector(".diagram");if(!(this.#b===null||!e||typeof e.showPopover!="function")&&!e.matches(":popover-open"))try{e.showPopover()}catch{}}#M(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#p&&(this.#p=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#A(){this.#c=this.renderRoot.querySelector(".diagram-zoom-value");const e=this.renderRoot.querySelector(".diagram-canvas"),t=this.renderRoot.querySelector(".diagram-world");if(!e||!t)return;this.#o??=pa({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#y(null),onView:r=>{this.#c&&(this.#c.textContent=`${Math.round(r.scale*100)}%`),this.dispatchEvent(new CustomEvent("dpk-diagram-view",{detail:{view:r},bubbles:!0,composed:!0})),this.onViewChange(r)}});const s=this.contentSize();if(s===null){this.#o.apply();return}this.#o.setContent({x:0,y:0,width:s.width,height:s.height});const n=this.layoutVersion();n!==this.#l&&(this.#l=n,this.initialView())}#C(){const e=this.#f!==this.#h;this.#f=this.#h;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#S();!t||!s||(this.#k.open(t,s,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}get commentTargets(){if(!this.id||this.#n!==null)return[];const e=`${this.subject??this.heading??this.defaultHeading()} \xB7 ${this.id}`;return this.commentItems().map(t=>({...t,group:e}))}commentItems(){return[]}commentRef(e,...t){return`element:${[this.id,e,...t].map(s=>encodeURIComponent(s)).join("/")}`}requestElementComment(e,...t){const s=this.commentRef(e,...t);this.commentTargets.some(n=>n.value===s)&&this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:s},bubbles:!0,composed:!0}))}get elementActions(){return this.#a}set elementActions(e){this.#a=e,this.#w()}get elementActionResults(){return this.#t}reduceElementActions(e,t){return{data:e,results:t.map(s=>({id:s.id,title:s.type,stale:"unsupported-action-type"}))}}dispatchElementAction(e,t,s){const n=new CustomEvent("dpk-element-action",{detail:{type:e,target:this.commentRef(...t),payload:s},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n),n.defaultPrevented}get selection(){return this.#i}select(e){this.#y(e)}get tagFilter(){return this.#r}set tagFilter(e){this.#r=e,this.requestUpdate()}get dataError(){return this.#n}resetView(){this.fitViewport()}#E(e){if(e===(this.#b!==null))return;const t=this.renderRoot.querySelector(".diagram");this.#b=e?{height:t?.offsetHeight??0}:null,this.#h=null,this.requestUpdate()}#L={handleEvent:e=>e.preventDefault(),passive:!1};#q={handleEvent:e=>{e.key!=="Escape"||this.#i!==null||(e.preventDefault(),this.#E(!1))},capture:!0};get locale(){return this.#v.locale}get chromeMessages(){return Ks(this.#v.locale)}renderSelection(){const e=this.#h,t=e===null?void 0:this.#g.get(e);if(e===null||t===void 0)return b;const s=tt(this.#d.get(e)??"",[],{label:t,key:e,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return h`${et(e,st(at(this.#v.locale),s,n=>this.#z(e,n)))}`}renderCommentTrigger(e,t,s){if(!this.id)return b;const n=this.commentRef(e.kind,e.id);return this.#g.set(n,t),h`<button
|
|
597
|
-
type="button"
|
|
598
|
-
class=${ee("diagram-comment-trigger",s&&"is-placed")}
|
|
599
|
-
style=${s?`left:${s.x}px; top:${s.y}px`:b}
|
|
600
|
-
data-comment-kind=${e.kind}
|
|
601
|
-
data-comment-id=${e.id}
|
|
602
|
-
aria-label=${this.chromeMessages.commentOn(t)}
|
|
603
|
-
title=${this.chromeMessages.commentOn(t)}
|
|
604
|
-
aria-haspopup="dialog"
|
|
605
|
-
aria-expanded=${this.#h===n?"true":"false"}
|
|
606
|
-
@click=${()=>{this.#y(e),this.#h=n,this.requestUpdate()}}
|
|
607
|
-
>
|
|
608
|
-
${Ke()}
|
|
609
|
-
</button>`}renderEdgeCommentTrigger(e,t,s){const n=Math.floor((s.length-1)/2),r=s[n],i=s[n+1]??r;return!this.id||!r||!i?b:I`<foreignObject
|
|
610
|
-
class="diagram-edge-comment"
|
|
611
|
-
x=${(r.x+i.x)/2-16}
|
|
612
|
-
y=${(r.y+i.y)/2-16}
|
|
613
|
-
width="32"
|
|
614
|
-
height="32"
|
|
615
|
-
>${this.renderCommentTrigger(e,t)}</foreignObject>`}layoutVersion(){return 0}fitViewport(){this.viewport?.fit()}initialView(){this.viewport?.reset()}viewAlign(){return"center"}questionsOf(e){const t=e.questions?.trim();return t===void 0||t===""?b:t}onViewChange(e){}statsText(){return""}tagItems(){return[]}isEmpty(){return this.contentSize()===null}shellClass(){return""}defaultHeading(){return""}defaultSubject(){return""}emptyMessage(){return this.chromeMessages.noMatches}renderToolbarActions(){return b}renderLegend(){return b}renderAboveCanvas(){return b}get viewport(){return this.#o}items(){return this.#s??this.emptyData()}authoredItems(){return this.#e??this.emptyData()}elementClass(e,...t){return ee(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#x(e){this.#n=null,this.#e=e,this.#w()}#w(){if(this.#e===null){this.#t=this.#a.map(t=>({id:t.id,title:t.type,stale:"target-missing"})),this.requestUpdate();return}const e=this.reduceElementActions(this.#e,this.#a);this.#s=e.data,this.#t=e.results,this.#i!==null&&(this.hasSelection(this.#i)||(this.#i=null,this.#h=null)),this.requestUpdate()}#S(){const e=this.#i;return e?[...this.renderRoot.querySelectorAll("[data-comment-kind]")].find(t=>t.dataset.commentKind===e.kind&&t.dataset.commentId===e.id)??null:null}#z(e,t){if(t.kind==="input"){this.#d=new Map(this.#d).set(e,t.body),this.#m=null,this.requestUpdate();return}if(t.kind==="comment"){if(!!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t.body},bubbles:!0,composed:!0,cancelable:!0}))){this.#m=e,this.requestUpdate();return}const r=new Map(this.#d);r.delete(e),this.#d=r}this.#m=null;const s=this.#S();this.#y(null),s?.focus({preventScroll:!0})}#R(e){this.#n=e,this.#e=null,this.#s=null,this.#w(),console.error("[dev-process-kit] invalid diagram data:",e),this.requestUpdate()}hasSelection(e){return!0}#y(e){(e===null?this.#i===null:this.#i!==null&&this.#i.kind===e.kind&&this.#i.id===e.id)||(this.#i=e,this.#h=null,this.dispatchEvent(new CustomEvent("dpk-diagram-select",{detail:{selection:e},bubbles:!0,composed:!0})),this.requestUpdate())}#D=e=>{switch(e.kind){case"tag":this.#r=Js(this.#r,e.tag),this.requestUpdate();return;case"match":this.#r=Zs(this.#r,e.match),this.requestUpdate();return;case"clear-tags":this.#r=Qs(this.#r),this.requestUpdate();return;case"select":this.#y(e.selection);return;case"zoom":this.#o?.zoom(e.factor);return;case"fit":this.fitViewport();return;default:return}};refreshContent(){}render(){this.#g=new Map,this.refreshContent();const e=aa(this.tagItems(),this.#r),t=this.#b,s=this.chromeMessages,n=t===null?s.maximize:s.restore;return h`
|
|
616
|
-
${t===null?b:h`<div class="diagram-placeholder" style="height:${t.height}px"></div>`}
|
|
617
|
-
<div
|
|
618
|
-
class=${ee("diagram",this.shellClass(),t!==null&&"is-maximized")}
|
|
619
|
-
popover=${t===null?b:"manual"}
|
|
620
|
-
@wheel=${t===null?b:this.#L}
|
|
621
|
-
@keydown=${t===null?b:this.#q}
|
|
622
|
-
>
|
|
623
|
-
<div class="diagram-toolbar">
|
|
624
|
-
<span class="diagram-title" title=${this.heading??this.defaultHeading()}
|
|
625
|
-
>${this.heading??this.defaultHeading()}</span
|
|
626
|
-
>
|
|
627
|
-
${(this.subject??this.defaultSubject())===""?b:h`<span class="diagram-subject" title=${this.subject??this.defaultSubject()}
|
|
628
|
-
>${this.subject??this.defaultSubject()}</span
|
|
629
|
-
>`}
|
|
630
|
-
<div class="diagram-toolbar-actions">
|
|
631
|
-
${this.renderToolbarActions()}
|
|
632
|
-
<span class="diagram-stats">${this.statsText()}</span>
|
|
633
|
-
<button
|
|
634
|
-
type="button"
|
|
635
|
-
class="dpk-icon-btn diagram-maximize"
|
|
636
|
-
aria-label=${n}
|
|
637
|
-
title=${n}
|
|
638
|
-
aria-pressed=${t===null?"false":"true"}
|
|
639
|
-
@click=${()=>this.#E(t===null)}
|
|
640
|
-
>
|
|
641
|
-
${t===null?Ts():As()}
|
|
642
|
-
</button>
|
|
643
|
-
</div>
|
|
644
|
-
</div>
|
|
645
|
-
${ra(s,e,this.#r.match,this.#D)} ${this.renderAboveCanvas()}
|
|
646
|
-
<div class="diagram-canvas" tabindex="0" aria-label=${s.canvas}>
|
|
647
|
-
<div class="diagram-world">${this.renderCanvas()}</div>
|
|
648
|
-
${this.isEmpty()?h`<p class="diagram-empty">${this.emptyMessage()}</p>`:b}
|
|
649
|
-
${this.#n===null?b:h`<p class="diagram-notice" role="alert">${s.dataError}<br />${this.#n}</p>`}
|
|
650
|
-
${this.renderLegend()} ${ia(s,this.#D)}
|
|
651
|
-
</div>
|
|
652
|
-
${this.renderSelection()}
|
|
653
|
-
</div>
|
|
654
|
-
`}}class ie extends De{#e=null;#s="";#a=0;#t=Y;commentItems(){const e=this.items();return[...e.nodes.map(t=>({value:this.commentRef("node",t.id),label:t.id})),...e.edges.map(t=>({value:this.commentRef("edge",t.id),label:`${t.from} \u2192 ${t.to} (${t.id})`}))]}get visible(){const e=this.filtered();return{nodes:e.nodes,edges:e.edges}}get layout(){return this.#e}get layoutMode(){return"layered"}get tagDimension(){return"node"}layoutOptions(){return{}}matchesFilter(e){return!0}layoutSignature(){return""}statsLabels(){return{node:this.chromeMessages.nodes,edge:this.chromeMessages.edges}}statsText(){const e=this.filtered();return na(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.#a}hasSelection(e){const t=this.items();return e.kind==="node"?t.nodes.some(s=>s.id===e.id):t.edges.some(s=>s.id===e.id)}placedNode(e){return this.#e?.nodes.find(t=>t.id===e)}routeOf(e){return this.#e?.routes.find(t=>t.id===e)?.points??[]}nodeState(e){return gt(e,this.selection,"node",this.#t)}edgeState(e){return gt(e,this.selection,"edge",this.#t)}renderEdges(e,t){const s=this.#e?.width??0,n=this.#e?.height??0;return h`<svg class="diagram-edges" width=${s} height=${n}>
|
|
655
|
-
${ft(t)}${e}
|
|
656
|
-
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const n=e.edges.filter(i=>Q(i.tags,this.tagFilter)&&this.matchesFilter(i)),r=new Set(n.flatMap(i=>[i.from,i.to]));return{...e,edges:n,nodes:e.nodes.filter(i=>r.has(i.id))}}const t=e.nodes.filter(n=>Q(n.tags,this.tagFilter)&&this.matchesFilter(n)),s=new Set(t.map(n=>n.id));return{...e,nodes:t,edges:e.edges.filter(n=>s.has(n.from)&&s.has(n.to))}}refreshContent(){const e=this.filtered(),t=[this.layoutMode,e.nodes.map(s=>`${s.id}:${s.width}x${s.height}`).join(","),e.edges.map(s=>`${s.id}:${s.from}>${s.to}`).join(","),this.layoutSignature()].join("|");t!==this.#s&&(this.#s=t,this.#a+=1,this.#e=this.computePlacement(e)),this.#t=this.relations(this.selection,e)}computePlacement(e){const t=e.nodes.map(r=>({id:r.id,width:r.width,height:r.height,...r.ports===void 0?{}:{ports:r.ports},...r.position===void 0?{}:{position:r.position}})),s=e.edges.map(r=>({id:r.id,from:r.from,to:r.to,...r.fromPort===void 0?{}:{fromPort:r.fromPort},...r.toPort===void 0?{}:{toPort:r.toPort}})),n=this.layoutOptions();return this.layoutMode==="fixed"?Ws(t,s,n):Vs(t,s,n)}}const fe=_({en:{heading:"State machine",node:"State",edge:"Transition",empty:"No matching transitions.",transitionLabel:(a,e,t)=>`${t} from ${a} to ${e}`},ja:{heading:"\u30B9\u30C6\u30FC\u30C8\u30DE\u30B7\u30F3",node:"\u72B6\u614B",edge:"\u9077\u79FB",empty:"\u8A72\u5F53\u3059\u308B\u9077\u79FB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",transitionLabel:(a,e,t)=>`${a} \u304B\u3089 ${e} \u3078\u306E ${t}`}}),ha=q({x:ae(),y:ae()}),ua=q({id:S(u(),M(1)),name:S(u(),M(1)),code:f(u()),kind:f(H(["normal","initial","terminal","compensation"]),"normal"),description:f(u()),position:f(ha),questions:f(u())}),ma=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),kind:f(H(["normal","exception"]),"normal"),tags:f(z(u()),[]),guard:f(u()),effect:f(u()),questions:f(u())}),xt={width:178,height:86},ga=()=>({nodes:[],edges:[]}),fa=q({states:z(ua),transitions:f(z(ma),[])}),vt=a=>{const e=G(fa,a),t=new Set;for(const i of e.states){if(t.has(i.id))throw new Error(`duplicate state id: ${i.id}`);t.add(i.id)}const s=new Set,n=e.transitions.map(i=>{if(s.has(i.id))throw new Error(`duplicate transition id: ${i.id}`);if(s.add(i.id),!t.has(i.from))throw new Error(`unknown transition source: ${i.from}`);if(!t.has(i.to))throw new Error(`unknown transition target: ${i.to}`);return{id:i.id,from:i.from,to:i.to,title:i.title,kind:i.kind,tags:i.tags,guard:i.guard??null,effect:i.effect??null,...i.questions===void 0?{}:{questions:i.questions}}});return{nodes:e.states.map(i=>({id:i.id,name:i.name,code:i.code??null,kind:i.kind,description:i.description??null,width:xt.width,height:xt.height,tags:[],...i.position===void 0?{}:{position:i.position},...i.questions===void 0?{}:{questions:i.questions}})),edges:n}},ba=a=>a.length>0&&a.every(e=>e.position!==void 0),ka=B`
|
|
657
|
-
.state-node {
|
|
658
|
-
display: flex;
|
|
659
|
-
flex-direction: column;
|
|
660
|
-
justify-content: center;
|
|
661
|
-
gap: 6px;
|
|
662
|
-
padding: 0 15px;
|
|
663
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
664
|
-
border-radius: var(--dpk-radius);
|
|
665
|
-
background: var(--dpk-paper-raised);
|
|
666
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
667
|
-
text-align: left;
|
|
668
|
-
overflow: hidden;
|
|
669
|
-
transition:
|
|
670
|
-
border-color 160ms var(--dpk-ease),
|
|
671
|
-
box-shadow 160ms var(--dpk-ease),
|
|
672
|
-
transform 160ms var(--dpk-ease);
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
.state-node:hover {
|
|
676
|
-
border-color: var(--dpk-blue);
|
|
677
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
678
|
-
transform: translateY(-1px);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
.state-node.is-initial {
|
|
682
|
-
border-left-width: 3px;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
.state-node.is-terminal {
|
|
686
|
-
border: 3px double var(--dpk-rule-strong);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
.state-node.is-compensation {
|
|
690
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 50%, transparent);
|
|
691
|
-
background: var(--dpk-amber-soft);
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.state-node.is-selected {
|
|
695
|
-
border-color: var(--dpk-blue);
|
|
696
|
-
box-shadow:
|
|
697
|
-
var(--dpk-bevel),
|
|
698
|
-
var(--dpk-shadow-sm),
|
|
699
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
.state-node.is-related {
|
|
703
|
-
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
.state-code {
|
|
707
|
-
font-family: var(--dpk-mono);
|
|
708
|
-
font-size: 9px;
|
|
709
|
-
letter-spacing: 0.02em;
|
|
710
|
-
color: var(--dpk-ink-faint);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
.state-name {
|
|
714
|
-
font-size: 13.5px;
|
|
715
|
-
font-weight: 640;
|
|
716
|
-
letter-spacing: -0.01em;
|
|
717
|
-
white-space: nowrap;
|
|
718
|
-
overflow: hidden;
|
|
719
|
-
text-overflow: ellipsis;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/* The slot centres a label on its route and carries the label's comment icon beside it. */
|
|
723
|
-
.state-label-slot {
|
|
724
|
-
position: absolute;
|
|
725
|
-
transform: translate(-50%, -50%);
|
|
726
|
-
display: flex;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
/* Overlaps the label by a hair so the pointer never crosses a gap that would hide it. */
|
|
730
|
-
.state-label-slot > .diagram-comment-trigger {
|
|
731
|
-
position: absolute;
|
|
732
|
-
left: calc(100% - 2px);
|
|
733
|
-
top: 50%;
|
|
734
|
-
transform: translateY(-50%);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
.state-label {
|
|
738
|
-
max-width: 190px;
|
|
739
|
-
padding: 3px 7px;
|
|
740
|
-
border: 1px solid transparent;
|
|
741
|
-
border-radius: var(--dpk-radius-xs);
|
|
742
|
-
background: var(--dpk-paper-raised);
|
|
743
|
-
color: var(--dpk-ink-soft);
|
|
744
|
-
font-size: 10px;
|
|
745
|
-
line-height: 1.5;
|
|
746
|
-
white-space: nowrap;
|
|
747
|
-
overflow: hidden;
|
|
748
|
-
text-overflow: ellipsis;
|
|
749
|
-
cursor: pointer;
|
|
750
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
751
|
-
transition:
|
|
752
|
-
border-color 160ms var(--dpk-ease),
|
|
753
|
-
background 160ms var(--dpk-ease),
|
|
754
|
-
color 160ms var(--dpk-ease),
|
|
755
|
-
box-shadow 160ms var(--dpk-ease);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
.state-label:hover {
|
|
759
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
760
|
-
color: var(--dpk-blue);
|
|
761
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
.state-label.is-selected {
|
|
765
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
766
|
-
background: var(--dpk-blue-soft);
|
|
767
|
-
color: var(--dpk-blue);
|
|
768
|
-
font-weight: 600;
|
|
769
|
-
box-shadow:
|
|
770
|
-
var(--dpk-shadow-xs),
|
|
771
|
-
inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
.state-label.is-dimmed {
|
|
775
|
-
opacity: 0.35;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
.state-edge.is-exception .d-edge-path {
|
|
779
|
-
stroke: color-mix(in srgb, var(--dpk-amber) 65%, var(--dpk-rule-strong));
|
|
780
|
-
stroke-dasharray: 5 4;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
.state-edge.is-related .d-edge-path {
|
|
784
|
-
stroke: var(--dpk-green);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
.state-edge.is-selected .d-edge-path {
|
|
788
|
-
stroke: var(--dpk-blue);
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
.state-initial-mark {
|
|
792
|
-
fill: var(--dpk-ink-faint);
|
|
793
|
-
stroke: var(--dpk-ink-faint);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
.state-initial-mark.is-dimmed {
|
|
797
|
-
opacity: 0.26;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
#state-arrow .diagram-arrow {
|
|
801
|
-
fill: var(--dpk-ink-faint);
|
|
802
|
-
stroke: var(--dpk-ink-faint);
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
#state-arrow-active .diagram-arrow {
|
|
806
|
-
fill: var(--dpk-blue);
|
|
807
|
-
stroke: var(--dpk-blue);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
#state-arrow-exception .diagram-arrow {
|
|
811
|
-
fill: var(--dpk-amber);
|
|
812
|
-
stroke: var(--dpk-amber);
|
|
813
|
-
}
|
|
814
|
-
`,xa=[{id:"state-arrow"},{id:"state-arrow-active"},{id:"state-arrow-exception"}];class yt extends ie{static{this.styles=[W,ka]}parseData(e){return vt(e)}emptyData(){return ga()}defaultHeading(){return fe(this.locale).heading}statsLabels(){const e=fe(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return fe(this.locale).empty}get tagDimension(){return"edge"}get layoutMode(){return ba(this.filtered().nodes)?"fixed":"layered"}layoutOptions(){return this.layoutMode==="fixed"?{padding:44}:{nodeSpacing:40,layerSpacing:110,padding:44}}relations(e,t){if(e===null||e.kind!=="node")return Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderCanvas(){const e=this.visible.nodes,t=e.filter(s=>s.kind==="initial").map(s=>this.#a(s));return h`
|
|
815
|
-
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#t(s))],xa)}
|
|
816
|
-
${e.map(s=>this.#n(s))} ${this.visible.edges.map(s=>this.#r(s))}
|
|
817
|
-
`}#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(`
|
|
818
|
-
`)||e.title}#a(e){const t=this.placedNode(e.id);if(!t)return b;const s=t.y+t.height/2,n=this.nodeState(e.id);return I`
|
|
819
|
-
<g class=${ee("state-initial-mark",n.dimmed&&"is-dimmed")}>
|
|
820
|
-
<circle cx=${t.x-22} cy=${s} r="5"></circle>
|
|
821
|
-
<path
|
|
822
|
-
d=${re([{x:t.x-17,y:s},{x:t.x-1,y:s}])}
|
|
823
|
-
stroke-width="1.6"
|
|
824
|
-
></path>
|
|
825
|
-
</g>
|
|
826
|
-
`}#t(e){const t=fe(this.locale),s=this.edgeState(e.id),n=this.routeOf(e.id),r=re(n),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`
|
|
827
|
-
<g
|
|
828
|
-
class=${this.elementClass(s,"d-edge","state-edge",e.kind==="exception"&&"is-exception")}
|
|
829
|
-
data-transition=${e.id}
|
|
830
|
-
>
|
|
831
|
-
<title>${this.#s(e)}</title>
|
|
832
|
-
<path class="d-edge-path" d=${r} marker-end=${`url(#${o})`}></path>
|
|
833
|
-
<path
|
|
834
|
-
class="d-edge-hit"
|
|
835
|
-
d=${r}
|
|
836
|
-
role="button"
|
|
837
|
-
tabindex="0"
|
|
838
|
-
aria-label=${t.transitionLabel(this.#e(e.from),this.#e(e.to),e.title)}
|
|
839
|
-
@click=${d}
|
|
840
|
-
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
841
|
-
></path>
|
|
842
|
-
</g>
|
|
843
|
-
`}#n(e){const t=this.placedNode(e.id);if(!t)return b;const s=this.nodeState(e.id);return h`
|
|
844
|
-
<button
|
|
845
|
-
type="button"
|
|
846
|
-
class=${this.elementClass(s,"d-node","state-node",`is-${e.kind}`)}
|
|
847
|
-
data-state=${e.id}
|
|
848
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
849
|
-
style="left:${t.x}px; top:${t.y}px; width:${e.width}px; height:${e.height}px"
|
|
850
|
-
aria-pressed=${s.selected?"true":"false"}
|
|
851
|
-
title=${e.description??e.name}
|
|
852
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
853
|
-
>
|
|
854
|
-
<span class="state-name">${e.name}</span>
|
|
855
|
-
${e.code===null?b:h`<span class="state-code">${e.code}</span>`}
|
|
856
|
-
</button>
|
|
857
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:t.x+e.width-20,y:t.y-14})}
|
|
858
|
-
`}#r(e){const t=this.edgeState(e.id),s=sa(this.routeOf(e.id));return h`
|
|
859
|
-
<span class="state-label-slot" style="left:${s.x}px; top:${s.y}px">
|
|
860
|
-
<button
|
|
861
|
-
type="button"
|
|
862
|
-
class=${this.elementClass(t,"state-label")}
|
|
863
|
-
data-transition-label=${e.id}
|
|
864
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
865
|
-
title=${this.#s(e)}
|
|
866
|
-
@click=${()=>this.select({kind:"edge",id:e.id})}
|
|
867
|
-
>
|
|
868
|
-
${e.title}
|
|
869
|
-
</button>
|
|
870
|
-
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#e(e.from)} \u2192 ${this.#e(e.to)} \xB7 ${e.title}`)}
|
|
871
|
-
</span>
|
|
872
|
-
`}}const wt=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",yt)},$t=(a,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[a]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[a],oe=_({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>$t(a,!0),selectMessage:a=>`Select ${a}`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${t?`Expand ${e}`:`Collapse ${e}`}`,frameCount:a=>`${a} message${a===1?"":"s"}`},ja:{heading:"\u30B7\u30FC\u30B1\u30F3\u30B9\u56F3",empty:"\u8A72\u5F53\u3059\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",participants:"\u53C2\u52A0\u8005",stats:(a,e)=>`${a} / ${e} \u30E1\u30C3\u30BB\u30FC\u30B8`,detailLabel:a=>$t(a,!1),selectMessage:a=>`${a}\u3092\u9078\u629E`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${e}\u3092${t?"\u5C55\u958B":"\u6298\u308A\u305F\u305F\u3080"}`,frameCount:a=>`${a} \u30E1\u30C3\u30BB\u30FC\u30B8`}}),va=q({kind:Z("message"),id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),style:f(H(["request","response","async"]),"request"),tags:f(z(u()),[]),guard:f(u()),detail:f(u()),questions:f(u())}),ya=q({label:S(u(),M(1)),items:z(Je())}),wa=q({kind:Z("fragment"),id:S(u(),M(1)),operator:H(["alt","opt","loop","par"]),title:S(u(),M(1)),collapsed:f(we(),!1),branches:S(z(ya),M(1))}),$a=Xe("kind",[va,wa]),Sa=q({id:S(u(),M(1)),name:S(u(),M(1)),role:f(u()),symbol:f(u()),kind:f(H(["internal","external"]),"internal"),description:f(u()),questions:f(u())}),Ma=q({participants:S(z(Sa),M(1)),items:f(z(Je()),[])}),St=240,Te=(a,e,t)=>{if(a.has(e))throw new Error(`duplicate ${t} id: ${e}`);a.add(e)},Mt=(a,e,t)=>a.map(s=>{const n=G($a,s);if(n.kind==="message"){if(Te(t,n.id,"message"),!e.has(n.from))throw new Error(`unknown sender: ${n.from}`);if(!e.has(n.to))throw new Error(`unknown receiver: ${n.to}`);return{kind:"message",id:n.id,from:n.from,to:n.to,title:n.title,style:n.style,tags:n.tags,guard:n.guard??null,detail:n.detail??null,questions:n.questions??null}}return Te(t,n.id,"fragment"),{kind:"fragment",id:n.id,operator:n.operator,title:n.title,collapsed:n.collapsed,branches:n.branches.map(i=>({label:i.label,items:Mt(i.items,e,t)}))}}),Ct=a=>{const e=G(Ma,a),t=new Set;for(const s of e.participants)Te(t,s.id,"participant");return{participants:e.participants.map(s=>({id:s.id,name:s.name,role:s.role??null,symbol:s.symbol??null,external:s.kind==="external",description:s.description??null,questions:s.questions??null})),items:Mt(e.items,t,new Set)}},Ca=()=>({participants:[],items:[]}),Et=(a,e)=>{for(const t of a)if(t.kind==="message")e.push(t);else for(const s of t.branches)Et(s.items,e)},K=a=>{const e=[];return Et(a,e),e},Ea=a=>new Map(K(a.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),qa=a=>K(a).length,qt=(a,e)=>{const t=[];for(const s of a){if(s.kind==="message"){e(s)&&t.push(s);continue}const n=s.branches.map(r=>({label:r.label,items:qt(r.items,e)})).filter(r=>r.items.length>0);n.length>0&&t.push({...s,branches:n})}return t},za=64,Da=86,Ta=31,Aa=32,La=40,Ra=(a,e)=>{const t=qt(a.items,e),s=new Set;for(const x of K(t))s.add(x.from),s.add(x.to);const n=a.participants.filter(x=>s.has(x.id)),r=new Map(n.map((x,v)=>[x.id,120+v*St])),i=Math.max(360,n.length*St),o=[],d=[],l=[],c=[],g=[];let p=25;const k=(x,v)=>{for(const y of x){if(y.kind==="message"){o.push({message:y,y:p+29,depth:v}),p+=y.from===y.to?Da:za;continue}const w=22+v*13,D=p,L=i-44-v*26;p+=Ta,y.collapsed?(g.push({fragment:y,x:w,y:p+6,width:L}),p+=La):y.branches.forEach((T,j)=>{j>0&&(c.push({x:w,y:p,width:L}),p+=8),l.push({label:T.label,x:w+12,y:p,width:L-24}),p+=Aa,k(T.items,v+1),p+=8}),d.push({fragment:y,x:w,y:D,width:L,height:p-D,count:qa([y])}),p+=14}};return k(t,0),{width:i,height:p+24,participants:n,rows:o,frames:d,branches:l,dividers:c,folds:g,x:r}},Oa=B`
|
|
873
|
-
.sequence .diagram-canvas {
|
|
874
|
-
background-image: none;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
.sequence-rail {
|
|
878
|
-
position: relative;
|
|
879
|
-
height: 62px;
|
|
880
|
-
flex-shrink: 0;
|
|
881
|
-
overflow: hidden;
|
|
882
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
883
|
-
background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
.sequence-rail-world {
|
|
887
|
-
position: absolute;
|
|
888
|
-
top: 0;
|
|
889
|
-
left: 0;
|
|
890
|
-
height: 62px;
|
|
891
|
-
transform-origin: 0 0;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
.sequence-participant {
|
|
895
|
-
position: absolute;
|
|
896
|
-
top: 9px;
|
|
897
|
-
width: 190px;
|
|
898
|
-
height: 44px;
|
|
899
|
-
display: flex;
|
|
900
|
-
align-items: center;
|
|
901
|
-
gap: 9px;
|
|
902
|
-
padding: 6px 10px;
|
|
903
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
904
|
-
border-radius: var(--dpk-radius-sm);
|
|
905
|
-
background: var(--dpk-paper-raised);
|
|
906
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
907
|
-
text-align: left;
|
|
908
|
-
cursor: pointer;
|
|
909
|
-
transition:
|
|
910
|
-
border-color 160ms var(--dpk-ease),
|
|
911
|
-
box-shadow 160ms var(--dpk-ease),
|
|
912
|
-
transform 160ms var(--dpk-ease);
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
.sequence-participant.is-external {
|
|
916
|
-
border-style: dashed;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
.sequence-participant:hover {
|
|
920
|
-
border-color: var(--dpk-blue);
|
|
921
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
922
|
-
transform: translateY(-1px);
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.sequence-participant[aria-pressed='true'] {
|
|
926
|
-
border-color: var(--dpk-blue);
|
|
927
|
-
box-shadow:
|
|
928
|
-
var(--dpk-bevel),
|
|
929
|
-
var(--dpk-shadow-sm),
|
|
930
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
.sequence-participant.is-related {
|
|
934
|
-
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
.sequence-symbol {
|
|
938
|
-
flex-shrink: 0;
|
|
939
|
-
display: grid;
|
|
940
|
-
place-items: center;
|
|
941
|
-
width: 26px;
|
|
942
|
-
height: 26px;
|
|
943
|
-
border-radius: var(--dpk-radius-xs);
|
|
944
|
-
background: var(--dpk-paper-inset);
|
|
945
|
-
color: var(--dpk-ink-faint);
|
|
946
|
-
font-family: var(--dpk-mono);
|
|
947
|
-
font-size: 9.5px;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
.sequence-participant.is-external .sequence-symbol {
|
|
951
|
-
background: var(--dpk-amber-soft);
|
|
952
|
-
color: var(--dpk-amber);
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
/* The lane is a fixed width: a long name or role elides inside it (the button's title has it whole). */
|
|
956
|
-
.sequence-names {
|
|
957
|
-
min-width: 0;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
.sequence-name {
|
|
961
|
-
display: block;
|
|
962
|
-
font-size: 11.5px;
|
|
963
|
-
font-weight: 640;
|
|
964
|
-
white-space: nowrap;
|
|
965
|
-
overflow: hidden;
|
|
966
|
-
text-overflow: ellipsis;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
.sequence-role {
|
|
970
|
-
display: block;
|
|
971
|
-
margin-top: 2px;
|
|
972
|
-
font-size: 9px;
|
|
973
|
-
color: var(--dpk-ink-faint);
|
|
974
|
-
white-space: nowrap;
|
|
975
|
-
overflow: hidden;
|
|
976
|
-
text-overflow: ellipsis;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
.sequence-lifeline {
|
|
980
|
-
stroke: var(--dpk-rule-strong);
|
|
981
|
-
stroke-width: 1;
|
|
982
|
-
stroke-dasharray: 4 6;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
.sequence-divider {
|
|
986
|
-
stroke: var(--dpk-rule-strong);
|
|
987
|
-
stroke-dasharray: 4 4;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
.sequence-message {
|
|
991
|
-
fill: none;
|
|
992
|
-
stroke: var(--dpk-ink-faint);
|
|
993
|
-
stroke-width: 1.5;
|
|
994
|
-
stroke-linejoin: round;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
.sequence-message.is-response {
|
|
998
|
-
stroke-dasharray: 5 4;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
.sequence-message.is-async {
|
|
1002
|
-
stroke: var(--dpk-blue);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
.sequence-message-row.is-related .sequence-message {
|
|
1006
|
-
stroke: var(--dpk-green);
|
|
1007
|
-
stroke-width: 2;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
.sequence-message-row.is-selected .sequence-message {
|
|
1011
|
-
stroke: var(--dpk-ink);
|
|
1012
|
-
stroke-width: 2.4;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
.sequence-message-row.is-dimmed,
|
|
1016
|
-
.sequence-label.is-dimmed {
|
|
1017
|
-
opacity: 0.24;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
.sequence-frame {
|
|
1021
|
-
position: absolute;
|
|
1022
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1023
|
-
border-radius: var(--dpk-radius-xs);
|
|
1024
|
-
background: color-mix(in srgb, var(--dpk-blue-soft) 50%, transparent);
|
|
1025
|
-
box-shadow: 0 1px 2px var(--dpk-shade-1);
|
|
1026
|
-
pointer-events: none;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
.sequence-frame-chevron {
|
|
1030
|
-
display: inline-flex;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
.sequence-frame-chevron svg {
|
|
1034
|
-
width: 11px;
|
|
1035
|
-
height: 11px;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
.sequence-frame-header {
|
|
1039
|
-
position: absolute;
|
|
1040
|
-
display: flex;
|
|
1041
|
-
align-items: center;
|
|
1042
|
-
gap: 9px;
|
|
1043
|
-
padding: 5px 9px;
|
|
1044
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1045
|
-
border-bottom: 0;
|
|
1046
|
-
border-radius: var(--dpk-radius-xs) var(--dpk-radius-xs) 0 0;
|
|
1047
|
-
background: var(--dpk-paper-sunken);
|
|
1048
|
-
color: var(--dpk-ink-soft);
|
|
1049
|
-
font-size: 10px;
|
|
1050
|
-
text-align: left;
|
|
1051
|
-
cursor: pointer;
|
|
1052
|
-
transition:
|
|
1053
|
-
background 160ms var(--dpk-ease),
|
|
1054
|
-
color 160ms var(--dpk-ease);
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
.sequence-frame-header:hover {
|
|
1058
|
-
background: var(--dpk-paper-inset);
|
|
1059
|
-
color: var(--dpk-ink);
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
.sequence-operator {
|
|
1063
|
-
flex: none;
|
|
1064
|
-
min-width: 26px;
|
|
1065
|
-
font-family: var(--dpk-mono);
|
|
1066
|
-
font-weight: 700;
|
|
1067
|
-
color: var(--dpk-blue);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
.sequence-frame-count {
|
|
1071
|
-
flex: none;
|
|
1072
|
-
margin-left: auto;
|
|
1073
|
-
font-family: var(--dpk-mono);
|
|
1074
|
-
font-size: 9px;
|
|
1075
|
-
color: var(--dpk-ink-faint);
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
/* A branch or fold label is bounded by its frame (an inline max-width) and elides past it. */
|
|
1079
|
-
:is(.sequence-branch, .sequence-fold) {
|
|
1080
|
-
white-space: nowrap;
|
|
1081
|
-
overflow: hidden;
|
|
1082
|
-
text-overflow: ellipsis;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
.sequence-branch {
|
|
1086
|
-
position: absolute;
|
|
1087
|
-
font-size: 9.5px;
|
|
1088
|
-
color: var(--dpk-ink-faint);
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
.sequence-fold {
|
|
1092
|
-
position: absolute;
|
|
1093
|
-
font-size: 10px;
|
|
1094
|
-
color: var(--dpk-ink-faint);
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
.sequence-label {
|
|
1098
|
-
position: absolute;
|
|
1099
|
-
display: flex;
|
|
1100
|
-
align-items: center;
|
|
1101
|
-
gap: 6px;
|
|
1102
|
-
max-height: 27px;
|
|
1103
|
-
padding: 3px 5px;
|
|
1104
|
-
border: 1px solid transparent;
|
|
1105
|
-
border-radius: var(--dpk-radius-xs);
|
|
1106
|
-
background: var(--dpk-paper-raised);
|
|
1107
|
-
color: var(--dpk-ink-soft);
|
|
1108
|
-
font-size: 10px;
|
|
1109
|
-
text-align: left;
|
|
1110
|
-
cursor: pointer;
|
|
1111
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
1112
|
-
transition:
|
|
1113
|
-
border-color 160ms var(--dpk-ease),
|
|
1114
|
-
background 160ms var(--dpk-ease),
|
|
1115
|
-
color 160ms var(--dpk-ease),
|
|
1116
|
-
box-shadow 160ms var(--dpk-ease);
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
.sequence-label:hover {
|
|
1120
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1121
|
-
color: var(--dpk-blue);
|
|
1122
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
.sequence-label.is-selected {
|
|
1126
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
1127
|
-
background: var(--dpk-blue-soft);
|
|
1128
|
-
color: var(--dpk-blue);
|
|
1129
|
-
box-shadow:
|
|
1130
|
-
var(--dpk-shadow-xs),
|
|
1131
|
-
inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.sequence-number {
|
|
1135
|
-
flex-shrink: 0;
|
|
1136
|
-
display: grid;
|
|
1137
|
-
place-items: center;
|
|
1138
|
-
width: 19px;
|
|
1139
|
-
height: 17px;
|
|
1140
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1141
|
-
border-radius: 3px;
|
|
1142
|
-
font-family: var(--dpk-mono);
|
|
1143
|
-
font-size: 8px;
|
|
1144
|
-
font-variant-numeric: tabular-nums;
|
|
1145
|
-
color: var(--dpk-ink-faint);
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
.sequence-text {
|
|
1149
|
-
min-width: 0;
|
|
1150
|
-
white-space: nowrap;
|
|
1151
|
-
overflow: hidden;
|
|
1152
|
-
text-overflow: ellipsis;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
#seq-request .diagram-arrow,
|
|
1156
|
-
#seq-response .diagram-arrow {
|
|
1157
|
-
fill: var(--dpk-ink-faint);
|
|
1158
|
-
stroke: var(--dpk-ink-faint);
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
#seq-async .diagram-arrow {
|
|
1162
|
-
stroke: var(--dpk-blue);
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
#seq-related .diagram-arrow {
|
|
1166
|
-
fill: var(--dpk-green);
|
|
1167
|
-
stroke: var(--dpk-green);
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
#seq-selected .diagram-arrow {
|
|
1171
|
-
fill: var(--dpk-ink);
|
|
1172
|
-
stroke: var(--dpk-ink);
|
|
1173
|
-
}
|
|
1174
|
-
`,Ia=[{id:"seq-request"},{id:"seq-response"},{id:"seq-async"},{id:"seq-related"},{id:"seq-selected"}];class zt extends De{static{this.styles=[W,Oa]}#e=null;#s=new Map;#a=new Map;#t=new Set;#n=new Set;#r="";#i=0;commentItems(){const e=this.items();return[...e.participants.map(t=>({value:this.commentRef("participant",t.id),label:t.name})),...K(e.items).map(t=>({value:this.commentRef("message",t.id),label:t.title}))]}parseData(e){return this.#a.clear(),Ct(e)}emptyData(){return Ca()}defaultHeading(){return oe(this.locale).heading}shellClass(){return"sequence"}emptyMessage(){return oe(this.locale).empty}fitViewport(){this.viewport?.fitWidth()}onViewChange(e){const t=this.renderRoot.querySelector(".sequence-rail-world");t&&(t.style.transform=`translateX(${e.x}px) scale(${e.scale})`)}hasSelection(e){const t=this.items();return e.kind==="participant"?t.participants.some(s=>s.id===e.id):K(t.items).some(s=>s.id===e.id)}tagItems(){return K(this.items().items).map(e=>e.tags)}statsText(){const e=this.#e,t=K(this.items().items).length;return e===null?"":oe(this.locale).stats(e.rows.length,t)}contentSize(){const e=this.#e;return e===null||e.rows.length===0?null:{width:e.width,height:e.height}}isEmpty(){return this.contentSize()===null}layoutVersion(){return this.#i}refreshContent(){const e=this.#c(),t=this.tagFilter,s=[t.match,[...t.active].join(","),[...this.#a].map(([i,o])=>`${i}:${o}`).join(","),K(e.items).map(i=>i.id).join(",")].join("|");s!==this.#r&&(this.#r=s,this.#i+=1,this.#s=Ea(this.items()),this.#e=Ra(e,i=>Q(i.tags,t))),this.#t=new Set,this.#n=new Set;const n=this.selection,r=this.#e;if(n!==null&&r!==null)if(n.kind==="message"){const i=r.rows.find(o=>o.message.id===n.id);this.#t.add(n.id),i&&(this.#n.add(i.message.from),this.#n.add(i.message.to))}else for(const i of r.rows)i.message.from!==n.id&&i.message.to!==n.id||this.#t.add(i.message.id)}#o(e,t){const s=e.detail===null?null:`${t.detailLabel(e.style)}: ${e.detail}`;return[e.guard,s].filter(n=>n!==null).join(`
|
|
1175
|
-
`)||e.title}#c(){const e=this.items(),t=s=>s.map(n=>n.kind==="message"?n:{...n,collapsed:this.#a.get(n.id)??n.collapsed,branches:n.branches.map(r=>({label:r.label,items:t(r.items)}))});return{participants:e.participants,items:t(e.items)}}#u(e){return this.#e?.frames.find(t=>t.fragment.id===e.id)?.fragment.collapsed??e.collapsed}#l(e){this.#a.set(e.id,!this.#u(e)),this.requestUpdate()}#p(e){const t=this.selection?.kind==="message"&&this.selection.id===e,s=!t&&this.#t.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}#h(e){const t=this.selection?.kind==="participant"&&this.selection.id===e,s=!t&&this.#n.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}renderAboveCanvas(){const e=this.#e;if(e===null)return b;const t=oe(this.locale);return h`
|
|
1176
|
-
<div class="sequence-rail" role="group" aria-label=${t.participants}>
|
|
1177
|
-
<div class="sequence-rail-world">
|
|
1178
|
-
${e.participants.map(s=>this.#f(s,e))}
|
|
1179
|
-
</div>
|
|
1180
|
-
</div>
|
|
1181
|
-
`}#f(e,t){const s=t.x.get(e.id)??0,n=this.#h(e.id);return h`
|
|
1182
|
-
<button
|
|
1183
|
-
type="button"
|
|
1184
|
-
class=${this.elementClass(n,"sequence-participant",e.external&&"is-external")}
|
|
1185
|
-
data-participant=${e.id}
|
|
1186
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1187
|
-
style="left:${s-95}px"
|
|
1188
|
-
aria-pressed=${n.selected?"true":"false"}
|
|
1189
|
-
title=${e.description??e.name}
|
|
1190
|
-
@click=${()=>this.select({kind:"participant",id:e.id})}
|
|
1191
|
-
>
|
|
1192
|
-
<span class="sequence-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>
|
|
1193
|
-
<span class="sequence-names">
|
|
1194
|
-
<span class="sequence-name">${e.name}</span>
|
|
1195
|
-
${e.role===null?b:h`<span class="sequence-role">${e.role}</span>`}
|
|
1196
|
-
</span>
|
|
1197
|
-
</button>
|
|
1198
|
-
${this.renderCommentTrigger({kind:"participant",id:e.id},e.name,{x:s+95-34,y:17})}
|
|
1199
|
-
`}renderCanvas(){const e=this.#e;if(e===null)return h``;const t=oe(this.locale);return h`
|
|
1200
|
-
${this.#d(e,t)}
|
|
1201
|
-
${e.frames.map(s=>h`<div
|
|
1202
|
-
class="sequence-frame"
|
|
1203
|
-
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
1204
|
-
></div>`)}
|
|
1205
|
-
${e.frames.map(s=>this.#m(s.fragment,s.x,s.y,s.width,s.count,t))}
|
|
1206
|
-
${e.branches.map(s=>h`<span
|
|
1207
|
-
class="sequence-branch"
|
|
1208
|
-
style="left:${s.x}px; top:${s.y}px; max-width:${s.width}px"
|
|
1209
|
-
title=${s.label}
|
|
1210
|
-
>[${s.label}]</span
|
|
1211
|
-
>`)}
|
|
1212
|
-
${e.folds.map(s=>{const n=s.fragment.branches.map(r=>`[${r.label}]`).join(" / ");return h`<span
|
|
1213
|
-
class="sequence-fold"
|
|
1214
|
-
style="left:${s.x}px; top:${s.y}px; max-width:${s.width}px"
|
|
1215
|
-
title=${n}
|
|
1216
|
-
>${n}</span
|
|
1217
|
-
>`})}
|
|
1218
|
-
${e.rows.map(s=>this.#g(s.y,s.message,e,t))}
|
|
1219
|
-
`}#d(e,t){const s=e.participants.map(i=>I`<path
|
|
1220
|
-
class="sequence-lifeline"
|
|
1221
|
-
d=${`M${e.x.get(i.id)??0} 0 V${e.height}`}
|
|
1222
|
-
></path>`),n=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}`,c=this.#p(i.message.id),g=c.selected?"seq-selected":c.related?"seq-related":i.message.style==="async"?"seq-async":i.message.style==="response"?"seq-response":"seq-request",p=()=>this.select({kind:"message",id:i.message.id});return I`
|
|
1223
|
-
<g
|
|
1224
|
-
class=${this.elementClass(c,"sequence-message-row","d-edge",`is-${i.message.style}`)}
|
|
1225
|
-
data-message=${i.message.id}
|
|
1226
|
-
>
|
|
1227
|
-
<title>${this.#o(i.message,t)}</title>
|
|
1228
|
-
<path class="d-edge-hit" d=${l} role="button" tabindex="0"
|
|
1229
|
-
aria-label=${t.selectMessage(i.message.title)}
|
|
1230
|
-
@click=${p}
|
|
1231
|
-
@keydown=${k=>{k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),p())}}></path>
|
|
1232
|
-
<path class="sequence-message is-${i.message.style}" d=${l} marker-end=${`url(#${g})`}></path>
|
|
1233
|
-
</g>
|
|
1234
|
-
`});return h`<svg class="diagram-edges" width=${e.width} height=${e.height}>
|
|
1235
|
-
${ft(Ia)} ${s} ${n} ${r}
|
|
1236
|
-
</svg>`}#m(e,t,s,n,r,i){const o=this.#u(e);return h`
|
|
1237
|
-
<button
|
|
1238
|
-
type="button"
|
|
1239
|
-
class="sequence-frame-header"
|
|
1240
|
-
data-fragment=${e.id}
|
|
1241
|
-
style="left:${t}px; top:${s}px; width:${n}px"
|
|
1242
|
-
aria-expanded=${o?"false":"true"}
|
|
1243
|
-
aria-label=${i.frameHeaderLabel(e.operator,e.title,o)}
|
|
1244
|
-
@click=${()=>this.#l(e)}
|
|
1245
|
-
>
|
|
1246
|
-
<span class="sequence-frame-chevron">${o?Ze():Ls()}</span>
|
|
1247
|
-
<span class="sequence-operator">${e.operator}</span>
|
|
1248
|
-
<span class="sequence-text">${e.title}</span>
|
|
1249
|
-
<span class="sequence-frame-count">${i.frameCount(r)}</span>
|
|
1250
|
-
</button>
|
|
1251
|
-
`}#g(e,t,s,n){const r=s.x.get(t.from)??0,i=s.x.get(t.to)??0,o=r===i,d=this.#p(t.id),l=o?r+12:Math.min(r,i)+14,c=o?175:Math.abs(i-r)-28;return h`
|
|
1252
|
-
<button
|
|
1253
|
-
type="button"
|
|
1254
|
-
class=${this.elementClass(d,"sequence-label")}
|
|
1255
|
-
data-message-label=${t.id}
|
|
1256
|
-
data-grill-questions=${this.questionsOf(t)}
|
|
1257
|
-
style="left:${l}px; top:${e-28}px; width:${c}px"
|
|
1258
|
-
title=${this.#o(t,n)}
|
|
1259
|
-
@click=${()=>this.select({kind:"message",id:t.id})}
|
|
1260
|
-
>
|
|
1261
|
-
<span class="sequence-number">${this.#s.get(t.id)??""}</span>
|
|
1262
|
-
<span class="sequence-text">${t.title}</span>
|
|
1263
|
-
</button>
|
|
1264
|
-
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#s.get(t.id)??""} ${t.title}`.trim(),{x:l+c-30,y:e-31})}
|
|
1265
|
-
`}}const Dt=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",zt)},te=_({en:{heading:"Dependencies",node:"Module",edge:"Dependency",emptyCycles:"No matching cycles.",emptyModules:"No matching modules.",directionGroup:"Direction to follow from the selected module",directionOutgoing:"Depends on",directionIncoming:"Depended on by",directionBoth:"Both",transitive:"Include indirect",cyclesToggleLabel:a=>`Show only ${a} cycle group(s)`,cyclesCount:a=>`Cycles ${a}`,legendOutgoing:"Depends on",legendIncoming:"Depended on by",legendCycle:"Cycle",edgeLabel:(a,e)=>`${a} depends on ${e}`,cyclicSuffix:a=>`${a}, part of a cycle`,cycleBadge:"Cycle"},ja:{heading:"\u4F9D\u5B58\u95A2\u4FC2\u30B0\u30E9\u30D5",node:"\u30E2\u30B8\u30E5\u30FC\u30EB",edge:"\u4F9D\u5B58",emptyCycles:"\u8A72\u5F53\u3059\u308B\u5FAA\u74B0\u4F9D\u5B58\u306F\u3042\u308A\u307E\u305B\u3093\u3002",emptyModules:"\u8A72\u5F53\u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",directionGroup:"\u9078\u629E\u3057\u305F\u30E2\u30B8\u30E5\u30FC\u30EB\u304B\u3089\u8FFD\u3046\u65B9\u5411",directionOutgoing:"\u4F9D\u5B58\u5148",directionIncoming:"\u4F9D\u5B58\u5143",directionBoth:"\u4E21\u65B9",transitive:"\u9593\u63A5\u3082\u542B\u3080",cyclesToggleLabel:a=>`\u5FAA\u74B0\u4F9D\u5B58 ${a} \u30B0\u30EB\u30FC\u30D7\u3060\u3051\u8868\u793A`,cyclesCount:a=>`\u5FAA\u74B0 ${a}`,legendOutgoing:"\u4F9D\u5B58\u5148",legendIncoming:"\u4F9D\u5B58\u5143",legendCycle:"\u5FAA\u74B0",edgeLabel:(a,e)=>`${a} \u304C ${e} \u306B\u4F9D\u5B58`,cyclicSuffix:a=>`${a}\u30FB\u5FAA\u74B0\u4F9D\u5B58\u3042\u308A`,cycleBadge:"\u5FAA\u74B0"}}),Tt={width:176,height:84},Pa=q({id:S(u(),M(1)),name:S(u(),M(1)),path:f(u()),layer:f(u()),tags:f(z(u()),[]),description:f(u()),questions:f(u())}),ja=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),contract:f(u()),description:f(u()),questions:f(u())}),Fa=q({modules:z(Pa),dependencies:f(z(ja),[])}),Na=()=>({nodes:[],edges:[]}),Ua=a=>{const e=G(Fa,a),t=new Set;for(const i of e.modules){if(t.has(i.id))throw new Error(`duplicate module id: ${i.id}`);t.add(i.id)}const s=new Set,n=e.dependencies.map(i=>{if(s.has(i.id))throw new Error(`duplicate dependency id: ${i.id}`);if(s.add(i.id),!t.has(i.from))throw new Error(`unknown dependency source: ${i.from}`);if(!t.has(i.to))throw new Error(`unknown dependency target: ${i.to}`);return{id:i.id,from:i.from,to:i.to,tags:[],contract:i.contract??null,description:i.description??null}});return{nodes:e.modules.map(i=>({id:i.id,name:i.name,path:i.path??null,layer:i.layer??null,description:i.description??null,tags:i.tags,width:Tt.width,height:Tt.height,...i.questions===void 0?{}:{questions:i.questions}})),edges:n}},Ha=B`
|
|
1266
|
-
.dep-direction {
|
|
1267
|
-
display: flex;
|
|
1268
|
-
gap: 2px;
|
|
1269
|
-
padding: 3px;
|
|
1270
|
-
border: 1px solid var(--dpk-rule);
|
|
1271
|
-
border-radius: var(--dpk-radius-sm);
|
|
1272
|
-
background: var(--dpk-paper-sunken);
|
|
1273
|
-
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
.dep-direction button {
|
|
1277
|
-
border: 0;
|
|
1278
|
-
border-radius: var(--dpk-radius-xs);
|
|
1279
|
-
padding: 4px 8px;
|
|
1280
|
-
background: transparent;
|
|
1281
|
-
color: var(--dpk-ink-faint);
|
|
1282
|
-
font-size: 9.5px;
|
|
1283
|
-
font-weight: 600;
|
|
1284
|
-
cursor: pointer;
|
|
1285
|
-
transition:
|
|
1286
|
-
background 160ms var(--dpk-ease),
|
|
1287
|
-
color 160ms var(--dpk-ease),
|
|
1288
|
-
box-shadow 160ms var(--dpk-ease);
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
.dep-direction button[aria-pressed='true'] {
|
|
1292
|
-
background: var(--dpk-paper-raised);
|
|
1293
|
-
color: var(--dpk-ink);
|
|
1294
|
-
font-weight: 650;
|
|
1295
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
.dep-toggle {
|
|
1299
|
-
min-height: 26px;
|
|
1300
|
-
padding: 0 8px;
|
|
1301
|
-
font-size: 10.5px;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
.dep-toggle[aria-pressed='true'] {
|
|
1305
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1306
|
-
background: var(--dpk-blue-soft);
|
|
1307
|
-
color: var(--dpk-blue);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
.dep-module {
|
|
1311
|
-
display: flex;
|
|
1312
|
-
flex-direction: column;
|
|
1313
|
-
gap: 5px;
|
|
1314
|
-
padding: 11px 12px;
|
|
1315
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1316
|
-
border-radius: var(--dpk-radius-sm);
|
|
1317
|
-
background: var(--dpk-paper-raised);
|
|
1318
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1319
|
-
text-align: left;
|
|
1320
|
-
overflow: hidden;
|
|
1321
|
-
transition:
|
|
1322
|
-
border-color 160ms var(--dpk-ease),
|
|
1323
|
-
box-shadow 160ms var(--dpk-ease),
|
|
1324
|
-
transform 160ms var(--dpk-ease);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
.dep-module:hover {
|
|
1328
|
-
border-color: var(--dpk-blue);
|
|
1329
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
1330
|
-
transform: translateY(-1px);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
.dep-module.is-cyclic:not(.is-selected) {
|
|
1334
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
.dep-module.is-selected {
|
|
1338
|
-
border-color: var(--dpk-blue);
|
|
1339
|
-
background: var(--dpk-blue-soft);
|
|
1340
|
-
box-shadow:
|
|
1341
|
-
var(--dpk-bevel),
|
|
1342
|
-
var(--dpk-shadow-sm),
|
|
1343
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
.dep-module.is-related {
|
|
1347
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1348
|
-
background: var(--dpk-green-soft);
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
.dep-module.is-dependency {
|
|
1352
|
-
border-color: color-mix(in srgb, #6e9b61 60%, transparent);
|
|
1353
|
-
background: color-mix(in srgb, #6e9b61 8%, transparent);
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
.dep-module.is-dependent {
|
|
1357
|
-
border-color: color-mix(in srgb, #729aaa 60%, transparent);
|
|
1358
|
-
background: color-mix(in srgb, #729aaa 8%, transparent);
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
.dep-head {
|
|
1362
|
-
display: flex;
|
|
1363
|
-
align-items: center;
|
|
1364
|
-
justify-content: space-between;
|
|
1365
|
-
gap: 6px;
|
|
1366
|
-
min-height: 14px;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
.dep-layer {
|
|
1370
|
-
font-size: 9px;
|
|
1371
|
-
color: var(--dpk-ink-faint);
|
|
1372
|
-
white-space: nowrap;
|
|
1373
|
-
overflow: hidden;
|
|
1374
|
-
text-overflow: ellipsis;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
.dep-cycle-badge {
|
|
1378
|
-
flex-shrink: 0;
|
|
1379
|
-
padding: 1px 4px;
|
|
1380
|
-
border-radius: 3px;
|
|
1381
|
-
background: var(--dpk-amber-soft);
|
|
1382
|
-
color: var(--dpk-amber);
|
|
1383
|
-
font-size: 8.5px;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
.dep-name {
|
|
1387
|
-
font-size: 13px;
|
|
1388
|
-
font-weight: 640;
|
|
1389
|
-
letter-spacing: -0.01em;
|
|
1390
|
-
white-space: nowrap;
|
|
1391
|
-
overflow: hidden;
|
|
1392
|
-
text-overflow: ellipsis;
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
.dep-path {
|
|
1396
|
-
font-family: var(--dpk-mono);
|
|
1397
|
-
font-size: 9px;
|
|
1398
|
-
color: var(--dpk-ink-faint);
|
|
1399
|
-
white-space: nowrap;
|
|
1400
|
-
overflow: hidden;
|
|
1401
|
-
text-overflow: ellipsis;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
.dep-edge .d-edge-path {
|
|
1405
|
-
stroke: var(--dpk-rule-strong);
|
|
1406
|
-
stroke-width: 1.4;
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
.dep-edge.is-related .d-edge-path {
|
|
1410
|
-
stroke: var(--dpk-green);
|
|
1411
|
-
stroke-width: 2;
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
.dep-edge.is-selected .d-edge-path {
|
|
1415
|
-
stroke: var(--dpk-blue);
|
|
1416
|
-
stroke-width: 2.6;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
.dep-edge:focus-visible .d-edge-path {
|
|
1420
|
-
stroke: var(--dpk-blue);
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
.diagram-legend .dep-swatch-outgoing {
|
|
1424
|
-
border-color: #6e9b61;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
.diagram-legend .dep-swatch-incoming {
|
|
1428
|
-
border-color: #729aaa;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
.diagram-legend .dep-swatch-cycle {
|
|
1432
|
-
border-color: var(--dpk-amber);
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
#dep-neutral .diagram-arrow {
|
|
1436
|
-
fill: var(--dpk-rule-strong);
|
|
1437
|
-
stroke: var(--dpk-rule-strong);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
#dep-outgoing .diagram-arrow {
|
|
1441
|
-
fill: #6e9b61;
|
|
1442
|
-
stroke: #6e9b61;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
#dep-incoming .diagram-arrow {
|
|
1446
|
-
fill: #729aaa;
|
|
1447
|
-
stroke: #729aaa;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
#dep-cycle .diagram-arrow {
|
|
1451
|
-
fill: var(--dpk-amber);
|
|
1452
|
-
stroke: var(--dpk-amber);
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
#dep-selected .diagram-arrow {
|
|
1456
|
-
fill: var(--dpk-blue);
|
|
1457
|
-
stroke: var(--dpk-blue);
|
|
1458
|
-
}
|
|
1459
|
-
`,_a=[{id:"dep-neutral"},{id:"dep-outgoing"},{id:"dep-incoming"},{id:"dep-cycle"},{id:"dep-selected"}];class At extends ie{static{this.styles=[W,Ha]}#e="both";#s=!1;#a=!1;#t=[];#n=Y;#r=Y;parseData(e){return Ua(e)}emptyData(){return Na()}defaultHeading(){return te(this.locale).heading}statsLabels(){const e=te(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){const e=te(this.locale);return this.#a?e.emptyCycles:e.emptyModules}layoutOptions(){return{nodeSpacing:40,layerSpacing:96,padding:32}}relations(e,t){return e===null||e.kind!=="node"?Y:{nodes:new Map([...this.#n.nodes,...this.#r.nodes]),edges:new Set([...this.#n.edges,...this.#r.edges])}}refreshContent(){const e=this.items(),t=this.tagFilter,s=e.nodes.filter(o=>Q(o.tags,t)),n=new Set(s.map(o=>o.id)),r=e.edges.filter(o=>n.has(o.from)&&n.has(o.to));this.#t=ta(s.map(o=>o.id),r);const i=this.selection;this.#n=i!==null&&i.kind==="node"&&this.#e!=="incoming"?N(r,i.id,"outgoing",this.#s):Y,this.#r=i!==null&&i.kind==="node"&&this.#e!=="outgoing"?N(r,i.id,"incoming",this.#s):Y,super.refreshContent()}matchesFilter(e){return this.#a?Ce(this.#t).has(e.id):!0}filtered(){const e=super.filtered();if(!this.#a)return e;const t=Ce(this.#t),s=e.edges.filter(r=>ut(r,t)),n=new Set(s.flatMap(r=>[r.from,r.to]));return{nodes:e.nodes.filter(r=>n.has(r.id)),edges:s}}renderToolbarActions(){const e=te(this.locale),t=this.#t.length;return h`
|
|
1460
|
-
<div class="dep-direction" role="group" aria-label=${e.directionGroup}>
|
|
1461
|
-
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,n])=>h`
|
|
1462
|
-
<button
|
|
1463
|
-
type="button"
|
|
1464
|
-
data-direction=${s}
|
|
1465
|
-
aria-pressed=${this.#e===s?"true":"false"}
|
|
1466
|
-
@click=${()=>this.#i(s)}
|
|
1467
|
-
>
|
|
1468
|
-
${n}
|
|
1469
|
-
</button>
|
|
1470
|
-
`)}
|
|
1471
|
-
</div>
|
|
1472
|
-
<button
|
|
1473
|
-
type="button"
|
|
1474
|
-
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1475
|
-
data-toggle="transitive"
|
|
1476
|
-
aria-pressed=${this.#s?"true":"false"}
|
|
1477
|
-
@click=${()=>{this.#s=!this.#s,this.requestUpdate()}}
|
|
1478
|
-
>
|
|
1479
|
-
${e.transitive}
|
|
1480
|
-
</button>
|
|
1481
|
-
<button
|
|
1482
|
-
type="button"
|
|
1483
|
-
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1484
|
-
data-toggle="cycles"
|
|
1485
|
-
aria-pressed=${this.#a?"true":"false"}
|
|
1486
|
-
aria-label=${e.cyclesToggleLabel(t)}
|
|
1487
|
-
?disabled=${!this.#a&&t===0}
|
|
1488
|
-
@click=${()=>{this.#a=!this.#a,this.requestUpdate()}}
|
|
1489
|
-
>
|
|
1490
|
-
${e.cyclesCount(t)}
|
|
1491
|
-
</button>
|
|
1492
|
-
`}renderLegend(){const e=te(this.locale);return h`<div class="diagram-legend">
|
|
1493
|
-
<span><i class="dep-swatch-outgoing"></i>${e.legendOutgoing}</span>
|
|
1494
|
-
<span><i class="dep-swatch-incoming"></i>${e.legendIncoming}</span>
|
|
1495
|
-
<span><i class="dep-swatch-cycle"></i>${e.legendCycle}</span>
|
|
1496
|
-
</div>`}#i(e){this.#e=e,this.requestUpdate()}#o(e,t){const s=this.selection;return s!==null&&s.kind==="edge"&&s.id===e.id?"dep-selected":ut(e,t)?"dep-cycle":this.#n.edges.has(e.id)?"dep-outgoing":this.#r.edges.has(e.id)?"dep-incoming":"dep-neutral"}renderCanvas(){const e=te(this.locale),t=this.visible,s=Ce(this.#t),n=o=>t.nodes.find(d=>d.id===o)?.name??o,r=t.edges.map(o=>{const d=this.edgeState(o.id),l=this.routeOf(o.id),c=re(l),g=()=>this.select({kind:"edge",id:o.id});return I`
|
|
1497
|
-
<g class=${this.elementClass(d,"d-edge","dep-edge")} data-dependency=${o.id}>
|
|
1498
|
-
<title>${[o.contract,o.description].filter(p=>p!==null).join(`
|
|
1499
|
-
`)||o.id}</title>
|
|
1500
|
-
<path class="d-edge-path" d=${c} marker-end=${`url(#${this.#o(o,s)})`}></path>
|
|
1501
|
-
<path
|
|
1502
|
-
class="d-edge-hit"
|
|
1503
|
-
d=${c}
|
|
1504
|
-
role="button"
|
|
1505
|
-
tabindex="0"
|
|
1506
|
-
aria-label=${e.edgeLabel(n(o.from),n(o.to))}
|
|
1507
|
-
@click=${g}
|
|
1508
|
-
@keydown=${p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),g())}}
|
|
1509
|
-
></path>
|
|
1510
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${n(o.from)} \u2192 ${n(o.to)}`,l)}
|
|
1511
|
-
</g>
|
|
1512
|
-
`}),i=t.nodes.map(o=>{const d=this.placedNode(o.id);if(!d)return b;const l=this.nodeState(o.id),c=s.has(o.id),g=this.#n.nodes.has(o.id),p=this.#r.nodes.has(o.id);return h`
|
|
1513
|
-
<button
|
|
1514
|
-
type="button"
|
|
1515
|
-
class=${this.elementClass(l,"d-node","dep-module",c&&"is-cyclic",g&&"is-dependency",p&&"is-dependent")}
|
|
1516
|
-
data-module=${o.id}
|
|
1517
|
-
data-grill-questions=${this.questionsOf(o)}
|
|
1518
|
-
style="left:${d.x}px; top:${d.y}px; width:${o.width}px; height:${o.height}px"
|
|
1519
|
-
aria-pressed=${l.selected?"true":"false"}
|
|
1520
|
-
aria-label=${c?e.cyclicSuffix(o.name):o.name}
|
|
1521
|
-
title=${[o.path??o.name,o.description].filter(k=>k!==null).join(`
|
|
1522
|
-
`)}
|
|
1523
|
-
@click=${()=>this.select({kind:"node",id:o.id})}
|
|
1524
|
-
>
|
|
1525
|
-
<span class="dep-head">
|
|
1526
|
-
<span class="dep-layer">${o.layer??""}</span>
|
|
1527
|
-
${c?h`<span class="dep-cycle-badge">${e.cycleBadge}</span>`:b}
|
|
1528
|
-
</span>
|
|
1529
|
-
<span class="dep-name">${o.name}</span>
|
|
1530
|
-
<span class="dep-path">${o.path??""}</span>
|
|
1531
|
-
</button>
|
|
1532
|
-
${this.renderCommentTrigger({kind:"node",id:o.id},o.name,{x:d.x+o.width-20,y:d.y-14})}
|
|
1533
|
-
`});return h`${this.renderEdges(r,_a)}${i}`}}const Lt=()=>{customElements.get("dpk-component-dependency-graph")||customElements.define("dpk-component-dependency-graph",At)},Rt=(a,e)=>e?{same:"Unchanged",added:"Added",removed:"Removed",changed:"Changed"}[a]:{same:"\u5909\u66F4\u306A\u3057",added:"\u8FFD\u52A0",removed:"\u524A\u9664",changed:"\u5909\u66F4"}[a],se=_({en:{heading:"ERD",node:"Table",edge:"Relation",empty:"No matching tables.",search:"Search",legendAdded:"Added",legendRemoved:"Removed",legendChanged:"Changed",legendCardinality:"Crow\u2019s foot: | one \xB7 \u25CB zero \xB7 fork many \u2014 each end counts that table\u2019s rows per row across the line",statusLabel:a=>Rt(a,!0),edgeLabel:(a,e,t)=>`${a} and ${e}, related ${t}`,was:a=>`was ${a}`,nullable:"nullable"},ja:{heading:"ER\u56F3",node:"\u30C6\u30FC\u30D6\u30EB",edge:"\u95A2\u9023",empty:"\u8A72\u5F53\u3059\u308B\u30C6\u30FC\u30D6\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",search:"\u691C\u7D22",legendAdded:"\u8FFD\u52A0",legendRemoved:"\u524A\u9664",legendChanged:"\u5909\u66F4",legendCardinality:"\u30AB\u30E9\u30B9\u306E\u8DB3\u8A18\u6CD5: | 1 \xB7 \u25CB 0 \xB7 \u4E09\u53C9 \u591A \u2014 \u5404\u7AEF\u306E\u8A18\u53F7\u3068\u6570\u5B57\u306F\u3001\u76F8\u624B\u5074 1 \u884C\u306B\u5BFE\u3059\u308B\u305D\u306E\u7AEF\u306E\u30C6\u30FC\u30D6\u30EB\u306E\u884C\u6570",statusLabel:a=>Rt(a,!1),edgeLabel:(a,e,t)=>`${a} \u3068 ${e} \u306E\u95A2\u9023 (${t})`,was:a=>`\u5909\u66F4\u524D ${a}`,nullable:"null\u53EF"}}),Ot=276,Ae=74,Ba=28,Ga=44,It=["1","0..1"],Pt=["1","0..1","1..N","0..N"],Ya=It.flatMap(a=>Pt.map(e=>`${a}:${e}`)),jt=H(["PK","FK","UQ"]),Va=q({id:S(u(),M(1)),type:S(u(),M(1)),key:f(Rs([jt,S(z(jt),M(1))])),ref:f(u()),nullable:f(we(),!1),cardinality:f(H(Ya)),label:f(S(u(),M(1))),questions:f(u())}),Wa=q({id:S(u(),M(1)),name:S(u(),M(1)),tags:f(z(u()),[]),fields:z(Va),questions:f(u())}),Ft=q({tables:z(Wa)}),Ka=q({before:f(Ft),after:Ft}),Xa=()=>({nodes:[],edges:[]}),Le=a=>a.key===void 0?[]:[...new Set(typeof a.key=="string"?[a.key]:a.key)],Nt=a=>({id:a.id,type:a.type,keys:Le(a),ref:a.ref??null,nullable:a.nullable,cardinality:a.cardinality??null,label:a.label??null,questions:a.questions??null}),Ut=(a,e)=>a.type===e.type&&a.keys.join()===e.keys.join()&&a.ref===e.ref&&a.nullable===e.nullable&&a.cardinality===e.cardinality&&a.label===e.label,be=a=>`${a.parent} : ${a.child}`,Ja=(a,e)=>be(a.cardinality)===be(e.cardinality)&&a.label===e.label,Za=(a,e)=>{const t=Le(e);return t.includes("UQ")?!0:t.includes("PK")&&a.fields.filter(s=>Le(s).includes("PK")).length===1},Qa=new Map(It.map(a=>[a,a])),en=new Map(Pt.map(a=>[a,a])),tn=(a,e)=>{const t=Za(a,e),s={parent:e.nullable?"0..1":"1",child:t?"0..1":"0..N"};if(e.cardinality===void 0)return s;const[n="",r=""]=e.cardinality.split(":"),i=Qa.get(n),o=en.get(r),d=`${a.id}.${e.id}`;if(i===void 0||o===void 0)throw new Error(`invalid cardinality on ${d}`);if(i!==s.parent)throw new Error(`cardinality "${e.cardinality}" on ${d} needs the parent end ${s.parent}: the FK is ${e.nullable?"":"not "}nullable`);if(t&&(o==="1..N"||o==="0..N"))throw new Error(`cardinality "${e.cardinality}" on ${d} allows many rows, but the column is unique`);return{parent:i,child:o}},Re=a=>a.status==="changed"?Ga:Ba,sn=a=>Ae+a.reduce((e,t)=>e+Re(t),0),Ht=(a,e)=>{let t=Ae;for(const s of a){if(s.id===e)return t+Re(s)/2;t+=Re(s)}return Ae/2},an=14,nn=(a,e)=>(a-(e-1)/2)*an,Oe=a=>{const e=new Map;for(const t of a){const s=`${t.from}.${t.sourceField}`;e.set(s,[...e.get(s)??[],t.id])}return new Map([...e.values()].flatMap(t=>t.map((s,n)=>[s,nn(n,t.length)])))},_t=a=>a.flatMap(e=>e.fields.flatMap(t=>{if(t.ref===void 0){if(t.cardinality!==void 0||t.label!==void 0)throw new Error(`cardinality and label on ${e.id}.${t.id} describe a relation; add its ref`);return[]}const[s,n]=t.ref.split(".");if(s===void 0||n===void 0)throw new Error(`invalid ref "${t.ref}" on ${e.id}.${t.id}; expected table.field`);return[{id:`${s}:${n}>${e.id}:${t.id}`,from:s,to:e.id,sourceField:n,targetField:t.id,cardinality:tn(e,t),label:t.label??null}]})),rn=(a,e)=>[...new Set([...a,...e].map(s=>s.id))].flatMap(s=>{const n=a.find(l=>l.id===s),r=e.find(l=>l.id===s),i=r??n;if(!i)return[];const o=Nt(i);if(!n)return[{...o,status:"added",before:null}];if(!r)return[{...o,status:"removed",before:null}];const d=Nt(n);return[{...o,status:Ut(d,o)?"same":"changed",before:Ut(d,o)?null:d}]}),on=a=>{const e=G(Ka,a),t=e.before?.tables??e.after.tables,s=e.after.tables,n=[...new Set([...t,...s].map(x=>x.id))],r=new Map;for(const x of[...t,...s])r.set(x.id,x.tags);const i=n.flatMap(x=>{const v=t.find(T=>T.id===x),y=s.find(T=>T.id===x),w=y??v;if(!w)return[];const D=rn(v?.fields??[],y?.fields??[]),L=v?y?D.some(T=>T.status!=="same")?"changed":"same":"removed":"added";return[{id:x,name:w.name,status:L,fields:D,tags:r.get(x)??[],width:Ot,height:sn(D),...w.questions===void 0?{}:{questions:w.questions}}]}),o=new Map(i.map(x=>[x.id,x])),d=_t(t),l=_t(s),g=[...new Set([...d,...l].map(x=>x.id))].flatMap(x=>{const v=d.find(V=>V.id===x),y=l.find(V=>V.id===x),w=y??v;if(!w)return[];const D=o.get(w.from),L=o.get(w.to);if(!D||!L)return[];const T=v&&y&&!Ja(v,y)?v:null,j=v?y?T?"changed":"same":"removed":"added";return[{id:x,from:w.from,to:w.to,sourceField:w.sourceField,targetField:w.targetField,cardinality:w.cardinality,label:w.label,before:T&&{cardinality:T.cardinality,label:T.label},status:j,tags:[],fromPort:`${x}:out`,toPort:`${x}:in`}]}),p=Oe(g),k=x=>{const v={},y={};for(const w of g)w.from===x.id&&(v[`${w.id}:out`]={x:Ot,y:Ht(x.fields,w.sourceField)+(p.get(w.id)??0)}),w.to===x.id&&(y[`${w.id}:in`]={x:0,y:Ht(x.fields,w.targetField)});return{out:v,in:y}};return{nodes:i.map(x=>{const v=k(x);return{...x,ports:{...v.out,...v.in}}}),edges:g}},dn=a=>{switch(a){case"1":return{min:"one",max:"one"};case"0..1":return{min:"zero",max:"one"};case"1..N":return{min:"one",max:"many"};case"0..N":return{min:"zero",max:"many"}}},Ie=4,Bt=6,ln=12,Gt=7,cn=7,pn=14,hn=19,un=6,mn=(a,e)=>{const t=e==="start"?a:[...a].reverse(),[s]=t,n=t.find(i=>s!==void 0&&(i.x!==s.x||i.y!==s.y));if(s===void 0||n===void 0)return{x:e==="start"?1:-1,y:0};const r=Math.hypot(n.x-s.x,n.y-s.y);return{x:(n.x-s.x)/r,y:(n.y-s.y)/r}},Yt=a=>Math.round(a*100)/100||0,gn=(a,e,t)=>{const s=(e==="start"?a[0]:a.at(-1))??{x:0,y:0},n=mn(a,e),r={x:-n.y,y:n.x},i=(y,w=0)=>({x:Yt(s.x+n.x*y+r.x*w),y:Yt(s.y+n.y*y+r.y*w)}),o=y=>[i(y,-Bt),i(y,Bt)],d=dn(t),l=d.max==="many"?[-Gt,0,Gt].map(y=>[i(ln),i(0,y)]):[o(cn)],c=d.max==="many"?hn:pn,g=c+Ie-2,p=d.min==="one"?[...l,o(c)]:l,k=d.min==="zero"?i(g):null,x=(d.min==="zero"?g+Ie:c)+un,v=i(x);return{segments:p,circle:k,label:{...v,anchor:n.x>=0?"start":"end"}}},fn=B`
|
|
1534
|
-
.er-search {
|
|
1535
|
-
display: flex;
|
|
1536
|
-
align-items: center;
|
|
1537
|
-
gap: 6px;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
.er-search .dpk-input {
|
|
1541
|
-
width: 150px;
|
|
1542
|
-
min-height: 26px;
|
|
1543
|
-
font-size: 11px;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
.er-table {
|
|
1547
|
-
display: flex;
|
|
1548
|
-
flex-direction: column;
|
|
1549
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
1550
|
-
border-radius: var(--dpk-radius-sm);
|
|
1551
|
-
background: var(--dpk-paper-raised);
|
|
1552
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1553
|
-
overflow: hidden;
|
|
1554
|
-
cursor: default;
|
|
1555
|
-
transition:
|
|
1556
|
-
border-color 160ms var(--dpk-ease),
|
|
1557
|
-
box-shadow 160ms var(--dpk-ease),
|
|
1558
|
-
transform 160ms var(--dpk-ease);
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
.er-table:hover {
|
|
1562
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
1563
|
-
transform: translateY(-1px);
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
.er-table.is-added {
|
|
1567
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
.er-table.is-removed {
|
|
1571
|
-
border-color: color-mix(in srgb, var(--dpk-accent) 55%, transparent);
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
.er-table.is-changed {
|
|
1575
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
.er-table.is-selected {
|
|
1579
|
-
border-color: var(--dpk-blue);
|
|
1580
|
-
box-shadow:
|
|
1581
|
-
var(--dpk-bevel),
|
|
1582
|
-
var(--dpk-shadow-sm),
|
|
1583
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
.er-table.is-related {
|
|
1587
|
-
border-color: color-mix(in srgb, var(--dpk-green) 50%, transparent);
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
.er-head {
|
|
1591
|
-
display: grid;
|
|
1592
|
-
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1593
|
-
grid-template-areas:
|
|
1594
|
-
'mark name name'
|
|
1595
|
-
'mark label label'
|
|
1596
|
-
'. status status';
|
|
1597
|
-
align-items: center;
|
|
1598
|
-
gap: 1px 8px;
|
|
1599
|
-
width: 100%;
|
|
1600
|
-
min-height: 74px;
|
|
1601
|
-
flex-shrink: 0;
|
|
1602
|
-
padding: 7px 11px;
|
|
1603
|
-
border: 0;
|
|
1604
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
1605
|
-
border-radius: 0;
|
|
1606
|
-
background: var(--dpk-paper);
|
|
1607
|
-
text-align: left;
|
|
1608
|
-
cursor: pointer;
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
.er-head:hover {
|
|
1612
|
-
background: var(--dpk-paper-sunken);
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
.er-table:has(> .diagram-comment-trigger) .er-head {
|
|
1616
|
-
padding-right: 46px;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
.er-table > .diagram-comment-trigger {
|
|
1620
|
-
position: absolute;
|
|
1621
|
-
top: 8px;
|
|
1622
|
-
right: 8px;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
.er-table:hover,
|
|
1626
|
-
.er-table:focus-within,
|
|
1627
|
-
.er-edge:hover,
|
|
1628
|
-
.er-edge:focus-within {
|
|
1629
|
-
opacity: 1;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
.er-mark {
|
|
1633
|
-
grid-area: mark;
|
|
1634
|
-
display: grid;
|
|
1635
|
-
place-items: center;
|
|
1636
|
-
width: 16px;
|
|
1637
|
-
height: 16px;
|
|
1638
|
-
border-radius: 3px;
|
|
1639
|
-
font-family: var(--dpk-mono);
|
|
1640
|
-
font-size: 10px;
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
.er-table.is-added .er-mark {
|
|
1644
|
-
background: var(--dpk-green-soft);
|
|
1645
|
-
color: var(--dpk-green);
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
.er-table.is-removed .er-mark {
|
|
1649
|
-
background: var(--dpk-accent-soft);
|
|
1650
|
-
color: var(--dpk-accent);
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
.er-table.is-changed .er-mark {
|
|
1654
|
-
background: var(--dpk-amber-soft);
|
|
1655
|
-
color: var(--dpk-amber);
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
.er-name {
|
|
1659
|
-
grid-area: name;
|
|
1660
|
-
font-family: var(--dpk-mono);
|
|
1661
|
-
font-size: 12px;
|
|
1662
|
-
font-weight: 640;
|
|
1663
|
-
letter-spacing: -0.01em;
|
|
1664
|
-
white-space: normal;
|
|
1665
|
-
overflow-wrap: anywhere;
|
|
1666
|
-
min-width: 0;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
.er-label {
|
|
1670
|
-
grid-area: label;
|
|
1671
|
-
font-size: 9.5px;
|
|
1672
|
-
color: var(--dpk-ink-faint);
|
|
1673
|
-
white-space: normal;
|
|
1674
|
-
overflow-wrap: anywhere;
|
|
1675
|
-
min-width: 0;
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
.er-status {
|
|
1679
|
-
grid-area: status;
|
|
1680
|
-
font-size: 8.5px;
|
|
1681
|
-
text-align: right;
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
.er-fields {
|
|
1685
|
-
display: flex;
|
|
1686
|
-
flex-direction: column;
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
.er-field {
|
|
1690
|
-
display: grid;
|
|
1691
|
-
grid-template-columns: 14px 26px minmax(0, 1fr);
|
|
1692
|
-
grid-template-areas: 'mark key name' '. . type';
|
|
1693
|
-
align-items: center;
|
|
1694
|
-
gap: 6px;
|
|
1695
|
-
padding: 6px 10px;
|
|
1696
|
-
min-height: 28px;
|
|
1697
|
-
flex-shrink: 0;
|
|
1698
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
1699
|
-
font-size: 10.5px;
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
.er-field:last-child {
|
|
1703
|
-
border-bottom: 0;
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
.er-field.is-added {
|
|
1707
|
-
background: color-mix(in srgb, var(--dpk-green) 10%, transparent);
|
|
1708
|
-
box-shadow: inset 2px 0 0 var(--dpk-green);
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
.er-field.is-removed {
|
|
1712
|
-
background: color-mix(in srgb, var(--dpk-accent) 10%, transparent);
|
|
1713
|
-
box-shadow: inset 2px 0 0 var(--dpk-accent);
|
|
1714
|
-
text-decoration: line-through;
|
|
1715
|
-
color: var(--dpk-ink-faint);
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
.er-field.is-changed {
|
|
1719
|
-
background: color-mix(in srgb, var(--dpk-amber) 10%, transparent);
|
|
1720
|
-
box-shadow: inset 2px 0 0 var(--dpk-amber);
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
.er-field.is-match {
|
|
1724
|
-
box-shadow: inset 2px 0 0 var(--dpk-blue);
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
.er-field-mark {
|
|
1728
|
-
grid-area: mark;
|
|
1729
|
-
font-family: var(--dpk-mono);
|
|
1730
|
-
font-size: 10px;
|
|
1731
|
-
text-align: center;
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
.er-field.is-added .er-field-mark {
|
|
1735
|
-
color: var(--dpk-green);
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
.er-field.is-removed .er-field-mark {
|
|
1739
|
-
color: var(--dpk-accent);
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
.er-field.is-changed .er-field-mark {
|
|
1743
|
-
color: var(--dpk-amber);
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
.er-key {
|
|
1747
|
-
grid-area: key;
|
|
1748
|
-
display: grid;
|
|
1749
|
-
place-items: center;
|
|
1750
|
-
/* A column with several roles (FK + UQ) stacks one badge line per key. */
|
|
1751
|
-
line-height: 1.25;
|
|
1752
|
-
padding: 1px 0;
|
|
1753
|
-
border-radius: 3px;
|
|
1754
|
-
background: var(--dpk-paper-inset);
|
|
1755
|
-
font-family: var(--dpk-mono);
|
|
1756
|
-
font-size: 8.5px;
|
|
1757
|
-
color: var(--dpk-ink-faint);
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
.er-key[data-empty='true'] {
|
|
1761
|
-
background: transparent;
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
.er-field-name {
|
|
1765
|
-
grid-area: name;
|
|
1766
|
-
font-family: var(--dpk-mono);
|
|
1767
|
-
white-space: normal;
|
|
1768
|
-
overflow-wrap: anywhere;
|
|
1769
|
-
min-width: 0;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
.er-field-type {
|
|
1773
|
-
grid-area: type;
|
|
1774
|
-
font-size: 9.5px;
|
|
1775
|
-
color: var(--dpk-ink-faint);
|
|
1776
|
-
white-space: normal;
|
|
1777
|
-
overflow-wrap: anywhere;
|
|
1778
|
-
min-width: 0;
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
.er-change {
|
|
1782
|
-
grid-area: type;
|
|
1783
|
-
display: flex;
|
|
1784
|
-
flex-direction: column;
|
|
1785
|
-
align-items: flex-start;
|
|
1786
|
-
font-size: 9px;
|
|
1787
|
-
line-height: 1.6;
|
|
1788
|
-
white-space: normal;
|
|
1789
|
-
overflow-wrap: anywhere;
|
|
1790
|
-
min-width: 0;
|
|
1791
|
-
text-align: left;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
.er-change del {
|
|
1795
|
-
color: var(--dpk-accent);
|
|
1796
|
-
text-decoration: line-through;
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
.er-change ins {
|
|
1800
|
-
color: var(--dpk-green);
|
|
1801
|
-
text-decoration: none;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
.er-edge .d-edge-path {
|
|
1805
|
-
stroke-width: 1.5;
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
.er-edge.is-added .d-edge-path {
|
|
1809
|
-
stroke: var(--dpk-green);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
.er-edge.is-removed .d-edge-path {
|
|
1813
|
-
stroke: var(--dpk-accent);
|
|
1814
|
-
stroke-dasharray: 5 4;
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
.er-edge.is-selected .d-edge-path {
|
|
1818
|
-
stroke: var(--dpk-blue);
|
|
1819
|
-
stroke-width: 2.6;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
.er-cardinality {
|
|
1823
|
-
font-family: var(--dpk-mono);
|
|
1824
|
-
font-size: 10px;
|
|
1825
|
-
fill: var(--dpk-ink-soft);
|
|
1826
|
-
paint-order: stroke;
|
|
1827
|
-
stroke: var(--dpk-paper-sunken);
|
|
1828
|
-
stroke-width: 5px;
|
|
1829
|
-
stroke-linejoin: round;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
.er-cardinality.is-added {
|
|
1833
|
-
fill: var(--dpk-green);
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
.er-cardinality.is-removed {
|
|
1837
|
-
fill: var(--dpk-accent);
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
.er-relation-label {
|
|
1841
|
-
font-size: 10px;
|
|
1842
|
-
font-style: italic;
|
|
1843
|
-
fill: var(--dpk-ink-soft);
|
|
1844
|
-
paint-order: stroke;
|
|
1845
|
-
stroke: var(--dpk-paper-sunken);
|
|
1846
|
-
stroke-width: 4px;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
.er-relation-label.is-added {
|
|
1850
|
-
fill: var(--dpk-green);
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
.er-relation-label.is-removed {
|
|
1854
|
-
fill: var(--dpk-accent);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
.er-cardinality.is-changed,
|
|
1858
|
-
.er-relation-label.is-changed {
|
|
1859
|
-
fill: var(--dpk-amber);
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
.er-was {
|
|
1863
|
-
fill: var(--dpk-accent);
|
|
1864
|
-
text-decoration: line-through;
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
.er-edge.is-changed .d-edge-path {
|
|
1868
|
-
stroke: var(--dpk-amber);
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
/* Crow's foot ends take the line's colour; the "zero" circle is hollow. */
|
|
1872
|
-
.er-end {
|
|
1873
|
-
pointer-events: none;
|
|
1874
|
-
fill: var(--dpk-paper-raised);
|
|
1875
|
-
stroke: var(--dpk-ink-faint);
|
|
1876
|
-
stroke-width: 1.5;
|
|
1877
|
-
stroke-linecap: round;
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
.er-edge.is-added .er-end {
|
|
1881
|
-
stroke: var(--dpk-green);
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
.er-edge.is-removed .er-end {
|
|
1885
|
-
stroke: var(--dpk-accent);
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
.er-edge.is-changed .er-end {
|
|
1889
|
-
stroke: var(--dpk-amber);
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
.er-edge.is-selected .er-end {
|
|
1893
|
-
stroke: var(--dpk-blue);
|
|
1894
|
-
stroke-width: 2;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
.diagram-legend .er-legend-cardinality {
|
|
1898
|
-
font-family: var(--dpk-mono);
|
|
1899
|
-
font-size: 9px;
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
.diagram-legend .er-swatch-added {
|
|
1903
|
-
border-color: var(--dpk-green);
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
.diagram-legend .er-swatch-removed {
|
|
1907
|
-
border-color: var(--dpk-accent);
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
.diagram-legend .er-swatch-changed {
|
|
1911
|
-
border-color: var(--dpk-amber);
|
|
1912
|
-
}
|
|
1913
|
-
`,Pe=7,Vt={same:"",added:"+",removed:"\u2212",changed:"~"};class Wt extends ie{static{this.styles=[W,fn]}#e="";#s=new Map;#a=null;disconnectedCallback(){this.#a?.disconnect(),this.#a=null,super.disconnectedCallback()}updated(){super.updated(),typeof ResizeObserver<"u"&&(this.#a??=new ResizeObserver(()=>this.#t())),this.#a?.disconnect();for(const e of this.renderRoot.querySelectorAll(".er-table")){this.#a?.observe(e);for(const t of e.querySelectorAll(".er-field"))this.#a?.observe(t)}this.#t()}#t(){let e=!1;for(const t of this.renderRoot.querySelectorAll(".er-table")){const s=t.dataset.erTable,n=t.getBoundingClientRect();if(s===void 0||n.width===0)continue;const r=n.width/t.offsetWidth,i=d=>Math.round(d*64)/64,o={height:i(n.height/r),rows:[...t.querySelectorAll(".er-field")].map(d=>{const l=d.getBoundingClientRect();return i((l.top+l.height/2-n.top)/r)})};JSON.stringify(this.#s.get(s))!==JSON.stringify(o)&&(this.#s.set(s,o),e=!0)}e&&this.requestUpdate()}layoutSignature(){return JSON.stringify([...this.#s])}filtered(){const e=super.filtered(),t=Oe(e.edges);return{...e,nodes:e.nodes.map(s=>{const n=this.#s.get(s.id);if(!n)return s;const r={...s.ports};for(const i of e.edges){if(i.from===s.id&&i.fromPort!==void 0){const o=n.rows[s.fields.findIndex(d=>d.id===i.sourceField)];o!==void 0&&(r[i.fromPort]={x:s.width,y:o+(t.get(i.id)??0)})}if(i.to===s.id&&i.toPort!==void 0){const o=n.rows[s.fields.findIndex(d=>d.id===i.targetField)];o!==void 0&&(r[i.toPort]={x:0,y:o})}}return{...s,height:n.height,ports:r}})}}parseData(e){return on(e)}emptyData(){return Xa()}defaultHeading(){return se(this.locale).heading}statsLabels(){const e=se(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return se(this.locale).empty}layoutOptions(){return{nodeSpacing:38,layerSpacing:128,padding:32}}matchesFilter(e){return this.#e===""?!0:[e.id,e.name,...e.fields.map(t=>t.id)].some(t=>t.toLowerCase().includes(this.#e))}relations(e,t){if(e===null||e.kind!=="node")return Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=se(this.locale);return h`
|
|
1914
|
-
<label class="er-search">
|
|
1915
|
-
<span class="dpk-label">${e.search}</span>
|
|
1916
|
-
<input
|
|
1917
|
-
class="dpk-input"
|
|
1918
|
-
type="search"
|
|
1919
|
-
placeholder="table / field"
|
|
1920
|
-
.value=${this.#e}
|
|
1921
|
-
@input=${t=>{const s=t.currentTarget;s instanceof HTMLInputElement&&(this.#e=s.value.trim().toLowerCase(),this.requestUpdate())}}
|
|
1922
|
-
/>
|
|
1923
|
-
</label>
|
|
1924
|
-
`}renderLegend(){const e=se(this.locale);return h`<div class="diagram-legend">
|
|
1925
|
-
<span><i class="er-swatch-added"></i>${e.legendAdded}</span>
|
|
1926
|
-
<span><i class="er-swatch-removed"></i>${e.legendRemoved}</span>
|
|
1927
|
-
<span><i class="er-swatch-changed"></i>${e.legendChanged}</span>
|
|
1928
|
-
<span class="er-legend-cardinality">${e.legendCardinality}</span>
|
|
1929
|
-
</div>`}renderCanvas(){const e=se(this.locale),t=this.visible,s=Oe(t.edges),n=t.edges.map(r=>{const i=this.edgeState(r.id),o=this.routeOf(r.id),d=re(o),l=()=>this.select({kind:"edge",id:r.id}),c=[be(r.cardinality),r.label].filter(Boolean).join(" \xB7 "),g=r.before===null?null:[be(r.before.cardinality),r.before.label].filter(Boolean).join(" \xB7 ");return I`
|
|
1930
|
-
<g class=${this.elementClass(i,"d-edge","er-edge",`is-${r.status}`)} data-relation=${r.id}>
|
|
1931
|
-
<title>${[`${r.from}.${r.sourceField} \u2192 ${r.to}.${r.targetField}`,c,g===null?null:`(${e.was(g)})`].filter(Boolean).join(" \xB7 ")}</title>
|
|
1932
|
-
<path class="d-edge-path" d=${d}></path>
|
|
1933
|
-
<path
|
|
1934
|
-
class="d-edge-hit"
|
|
1935
|
-
d=${d}
|
|
1936
|
-
role="button"
|
|
1937
|
-
tabindex="0"
|
|
1938
|
-
aria-label=${e.edgeLabel(r.from,r.to,c)}
|
|
1939
|
-
@click=${l}
|
|
1940
|
-
@keydown=${p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),l())}}
|
|
1941
|
-
></path>
|
|
1942
|
-
${o.length>0?this.#n(o,r,s.get(r.id)??0):b}
|
|
1943
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:r.id},`${r.from}.${r.sourceField} \u2192 ${r.to}.${r.targetField}`,o)}
|
|
1944
|
-
</g>
|
|
1945
|
-
`});return h`${this.renderEdges(n,[])}${t.nodes.map(r=>this.#r(r,e))}`}#n(e,t,s){const n=t.before,r=(c,g)=>I`${g!=null&&g!==c?I`<tspan class="er-was">${g}</tspan> `:b}${c??b}`,i=c=>{const g=c==="start"?t.cardinality.parent:t.cardinality.child,p=n&&(c==="start"?n.cardinality.parent:n.cardinality.child),k=gn(e,c,g);return{glyph:k,content:I`
|
|
1946
|
-
<g class="er-end" data-end=${c} data-multiplicity=${g}>
|
|
1947
|
-
${k.segments.map(([x,v])=>I`<line x1=${x.x} y1=${x.y} x2=${v.x} y2=${v.y}></line>`)}
|
|
1948
|
-
${k.circle===null?b:I`<circle cx=${k.circle.x} cy=${k.circle.y} r=${Ie}></circle>`}
|
|
1949
|
-
</g>
|
|
1950
|
-
<text
|
|
1951
|
-
class="er-cardinality is-${t.status}"
|
|
1952
|
-
data-end=${c}
|
|
1953
|
-
text-anchor=${k.label.anchor}
|
|
1954
|
-
dominant-baseline="central"
|
|
1955
|
-
x=${k.label.x}
|
|
1956
|
-
y=${k.label.y+(c==="start"&&s>0?Pe:-Pe)}
|
|
1957
|
-
>${r(g,p)}</text>
|
|
1958
|
-
`}},o=i("start"),d=i("end"),l=t.label??n?.label??null;return I`
|
|
1959
|
-
${o.content}${d.content}
|
|
1960
|
-
${l===null?b:I`<text
|
|
1961
|
-
class="er-relation-label is-${t.status}"
|
|
1962
|
-
text-anchor=${d.glyph.label.anchor}
|
|
1963
|
-
x=${d.glyph.label.x}
|
|
1964
|
-
dominant-baseline="central"
|
|
1965
|
-
y=${d.glyph.label.y+Pe}
|
|
1966
|
-
>${r(t.label,n?.label)}</text>`}
|
|
1967
|
-
`}#r(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id);return h`
|
|
1968
|
-
<div
|
|
1969
|
-
class=${this.elementClass(n,"d-node","er-table",`is-${e.status}`)}
|
|
1970
|
-
data-er-table=${e.id}
|
|
1971
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1972
|
-
style="left:${s.x}px; top:${s.y}px; width:${e.width}px"
|
|
1973
|
-
>
|
|
1974
|
-
<button
|
|
1975
|
-
type="button"
|
|
1976
|
-
class="er-head"
|
|
1977
|
-
data-table=${e.id}
|
|
1978
|
-
aria-pressed=${n.selected?"true":"false"}
|
|
1979
|
-
title=${`${e.id} / ${e.name}`}
|
|
1980
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
1981
|
-
>
|
|
1982
|
-
${e.status==="same"?b:h`<span class="er-mark" aria-hidden="true">${Vt[e.status]}</span>`}
|
|
1983
|
-
<span class="er-name">${e.id}</span>
|
|
1984
|
-
<span class="er-label">${e.name}</span>
|
|
1985
|
-
<span class="dpk-label er-status">${t.statusLabel(e.status)}</span>
|
|
1986
|
-
</button>
|
|
1987
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},`${e.id} \xB7 ${e.name}`)}
|
|
1988
|
-
<div class="er-fields">${e.fields.map(r=>this.#i(r,t))}</div>
|
|
1989
|
-
</div>
|
|
1990
|
-
`}#i(e,t){const s=r=>[r.type,r.keys.length===0?"\u2014":r.keys.join("+"),r.ref,r.cardinality,r.label===null?null:`\u201C${r.label}\u201D`,r.nullable?t.nullable:null].filter(Boolean).join(" \xB7 "),n=this.#e!==""&&e.id.toLowerCase().includes(this.#e);return h`
|
|
1991
|
-
<div
|
|
1992
|
-
class="er-field is-${e.status} ${n?"is-match":""}"
|
|
1993
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
1994
|
-
title=${[t.statusLabel(e.status),e.id,s(e)].filter(Boolean).join(" / ")}
|
|
1995
|
-
>
|
|
1996
|
-
<span class="er-field-mark" aria-hidden="true">${Vt[e.status]}</span>
|
|
1997
|
-
<span class="er-key" data-empty=${e.keys.length===0?"true":"false"}
|
|
1998
|
-
>${e.keys.length===0?"\xB7":e.keys.map(r=>h`<span>${r}</span>`)}</span
|
|
1999
|
-
>
|
|
2000
|
-
<span class="er-field-name">${e.id}</span>
|
|
2001
|
-
${e.status==="changed"&&e.before!==null?h`<span class="er-change">
|
|
2002
|
-
<del>− ${s(e.before)}</del>
|
|
2003
|
-
<ins>+ ${s(e)}</ins>
|
|
2004
|
-
</span>`:h`<span class="er-field-type">${s(e)}</span>`}
|
|
2005
|
-
</div>
|
|
2006
|
-
`}}const Kt=()=>{customElements.get("dpk-component-er-diagram")||customElements.define("dpk-component-er-diagram",Wt)},de=_({en:{heading:"Architecture",node:"Service",edge:"Connection",empty:"No matching services.",boundaries:"Boundaries",edgeLabel:(a,e)=>`Connection from ${a} to ${e}`,artworkCredit:a=>`Icon credit: ${a}`},ja:{heading:"\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3\u56F3",node:"\u30B5\u30FC\u30D3\u30B9",edge:"\u63A5\u7D9A",empty:"\u8A72\u5F53\u3059\u308B\u30B5\u30FC\u30D3\u30B9\u306F\u3042\u308A\u307E\u305B\u3093\u3002",boundaries:"\u5883\u754C",edgeLabel:(a,e)=>`${a} \u304B\u3089 ${e} \u3078\u306E\u63A5\u7D9A`,artworkCredit:a=>`\u30A2\u30A4\u30B3\u30F3\u51FA\u5178: ${a}`}}),Xt={width:220,height:112},ke=26,bn=q({src:S(u(),M(1)),alt:S(u(),M(1)),license:f(u())}),kn=q({id:S(u(),M(1)),name:S(u(),M(1)),description:f(u()),boundary:f(u()),symbol:f(u()),tags:f(z(u()),[]),artwork:f(bn),position:q({x:ae(),y:ae()}),questions:f(u())}),xn=q({id:S(u(),M(1)),label:S(u(),M(1)),kind:f(H(["internal","external"]),"internal")}),vn=q({id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),label:f(u())}),yn=q({boundaries:f(z(xn),[]),services:z(kn),links:f(z(vn),[])}),wn=()=>({nodes:[],edges:[],boundaries:[]}),$n=a=>{const e=G(yn,a),t=new Set;for(const o of e.boundaries){if(t.has(o.id))throw new Error(`duplicate boundary id: ${o.id}`);t.add(o.id)}const s=new Set,n=e.services.map(o=>{if(s.has(o.id))throw new Error(`duplicate service id: ${o.id}`);if(s.add(o.id),o.boundary!==void 0&&!t.has(o.boundary))throw new Error(`unknown boundary: ${o.boundary}`);return{id:o.id,name:o.name,description:o.description??null,boundary:o.boundary??null,symbol:o.symbol??null,artwork:o.artwork?{src:o.artwork.src,alt:o.artwork.alt,license:o.artwork.license??null}:null,tags:o.tags,width:Xt.width,height:Xt.height,position:o.position,...o.questions===void 0?{}:{questions:o.questions}}}),r=new Set,i=e.links.map(o=>{if(r.has(o.id))throw new Error(`duplicate link id: ${o.id}`);if(r.add(o.id),!s.has(o.from))throw new Error(`unknown link source: ${o.from}`);if(!s.has(o.to))throw new Error(`unknown link target: ${o.to}`);return{id:o.id,from:o.from,to:o.to,label:o.label??null,tags:[]}});return{nodes:n,edges:i,boundaries:e.boundaries.map(o=>({id:o.id,label:o.label,kind:o.kind}))}},je={left:ke,top:ke*1.6,right:ke,bottom:ke},Sn={left:0,top:0,right:0,bottom:0},Mn=12,Jt=a=>({left:Math.min(...a.map(e=>e.position?.x??0)),top:Math.min(...a.map(e=>e.position?.y??0)),right:Math.max(...a.map(e=>(e.position?.x??0)+e.width)),bottom:Math.max(...a.map(e=>(e.position?.y??0)+e.height))}),Cn=(a,e,t,s)=>{const n=a.left-e.left<t.right+s.right&&t.left-s.left<a.right+e.right,r=a.top-e.top<t.bottom+s.bottom&&t.top-s.top<a.bottom+e.bottom;if(!n||!r)return e;const i=Math.max(t.left-a.right,a.left-t.right),o=Math.max(t.top-a.bottom,a.top-t.bottom);if(i<0&&o<0)return e;const d=(l,c,g)=>l===0?0:Math.max(0,g-Mn)*l/(l+c);return i>=o?t.left>=a.right?{...e,right:Math.min(e.right,d(e.right,s.left,i))}:{...e,left:Math.min(e.left,d(e.left,s.right,i))}:t.top>=a.bottom?{...e,bottom:Math.min(e.bottom,d(e.bottom,s.top,o))}:{...e,top:Math.min(e.top,d(e.top,s.bottom,o))}},En=(a,e)=>{const t=e.flatMap(n=>{const r=a.filter(i=>i.boundary===n.id);return r.length===0?[]:[{boundary:n,bounds:Jt(r)}]}),s=[...t.map(n=>({id:n.boundary.id,bounds:n.bounds,padding:je})),...a.filter(n=>n.boundary===null||!t.some(r=>r.boundary.id===n.boundary)).map(n=>({id:null,bounds:Jt([n]),padding:Sn}))];return t.map(({boundary:n,bounds:r})=>{const i=s.filter(l=>l.id!==n.id).map(l=>Cn(r,je,l.bounds,l.padding)).reduce((l,c)=>({left:Math.min(l.left,c.left),top:Math.min(l.top,c.top),right:Math.min(l.right,c.right),bottom:Math.min(l.bottom,c.bottom)}),je),o=r.left-i.left,d=r.top-i.top;return{boundary:n,x:o,y:d,width:r.right+i.right-o,height:r.bottom+i.bottom-d}})},qn=(a,e)=>{const t=r=>r.y+r.height/2,s=r=>r.x+r.width/2,n=(r,i,o)=>{if(o?r.y===i.y:r.x===i.x)return[r,i];if(o){const l=(r.x+i.x)/2;return[r,{x:l,y:r.y},{x:l,y:i.y},i]}const d=(r.y+i.y)/2;return[r,{x:r.x,y:d},{x:i.x,y:d},i]};return e.x>=a.x+a.width?n({x:a.x+a.width,y:t(a)},{x:e.x,y:t(e)},!0):a.x>=e.x+e.width?n({x:a.x,y:t(a)},{x:e.x+e.width,y:t(e)},!0):e.y>=a.y+a.height?n({x:s(a),y:a.y+a.height},{x:s(e),y:e.y},!1):a.y>=e.y+e.height?n({x:s(a),y:a.y},{x:s(e),y:e.y+e.height},!1):null},zn=(a,e)=>{const t=new Map(a.nodes.map(n=>[n.id,n])),s=a.routes.map(n=>{const r=e.find(l=>l.id===n.id),i=r?t.get(r.from):void 0,o=r?t.get(r.to):void 0,d=i&&o&&i!==o?qn(i,o):null;return d===null?n:{id:n.id,points:d}});return{...a,routes:s}},Dn=B`
|
|
2007
|
-
.arch-toggle {
|
|
2008
|
-
min-height: 26px;
|
|
2009
|
-
padding: 0 9px;
|
|
2010
|
-
font-size: 10.5px;
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
.arch-toggle[aria-pressed='true'] {
|
|
2014
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
2015
|
-
background: var(--dpk-blue-soft);
|
|
2016
|
-
color: var(--dpk-blue);
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
.arch-boundary {
|
|
2020
|
-
position: absolute;
|
|
2021
|
-
border: 1.5px dashed var(--dpk-rule-strong);
|
|
2022
|
-
border-radius: var(--dpk-radius-lg);
|
|
2023
|
-
background: color-mix(in srgb, var(--dpk-blue) 3%, transparent);
|
|
2024
|
-
pointer-events: none;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
.arch-boundary.is-external {
|
|
2028
|
-
border-color: color-mix(in srgb, var(--dpk-amber) 45%, transparent);
|
|
2029
|
-
background: color-mix(in srgb, var(--dpk-amber) 4%, transparent);
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
.arch-boundary span {
|
|
2033
|
-
position: absolute;
|
|
2034
|
-
top: 9px;
|
|
2035
|
-
left: 14px;
|
|
2036
|
-
/* Stays inside its own boundary, eliding a long label, rather than running over its neighbours. */
|
|
2037
|
-
box-sizing: border-box;
|
|
2038
|
-
max-width: calc(100% - 28px);
|
|
2039
|
-
overflow: hidden;
|
|
2040
|
-
text-overflow: ellipsis;
|
|
2041
|
-
white-space: nowrap;
|
|
2042
|
-
padding: 2px 7px;
|
|
2043
|
-
border-radius: 999px;
|
|
2044
|
-
background: var(--dpk-glass);
|
|
2045
|
-
backdrop-filter: blur(8px);
|
|
2046
|
-
font-family: var(--dpk-mono);
|
|
2047
|
-
font-size: 9px;
|
|
2048
|
-
letter-spacing: 0.1em;
|
|
2049
|
-
text-transform: uppercase;
|
|
2050
|
-
color: var(--dpk-ink-faint);
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
.arch-service {
|
|
2054
|
-
display: grid;
|
|
2055
|
-
grid-template-columns: 38px minmax(0, 1fr);
|
|
2056
|
-
gap: 10px;
|
|
2057
|
-
align-items: start;
|
|
2058
|
-
padding: 14px 13px;
|
|
2059
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
2060
|
-
border-radius: var(--dpk-radius-sm);
|
|
2061
|
-
background: var(--dpk-paper-raised);
|
|
2062
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2063
|
-
text-align: left;
|
|
2064
|
-
overflow: hidden;
|
|
2065
|
-
transition:
|
|
2066
|
-
border-color 160ms var(--dpk-ease),
|
|
2067
|
-
box-shadow 160ms var(--dpk-ease),
|
|
2068
|
-
transform 160ms var(--dpk-ease);
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
.arch-service:hover {
|
|
2072
|
-
border-color: var(--dpk-blue);
|
|
2073
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2074
|
-
transform: translateY(-1px);
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
.arch-service.is-selected {
|
|
2078
|
-
border-color: var(--dpk-blue);
|
|
2079
|
-
box-shadow:
|
|
2080
|
-
var(--dpk-bevel),
|
|
2081
|
-
var(--dpk-shadow-sm),
|
|
2082
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
.arch-service.is-related {
|
|
2086
|
-
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
2087
|
-
background: var(--dpk-green-soft);
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
.arch-artwork {
|
|
2091
|
-
width: 38px;
|
|
2092
|
-
height: 38px;
|
|
2093
|
-
object-fit: contain;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
.arch-symbol {
|
|
2097
|
-
display: grid;
|
|
2098
|
-
place-items: center;
|
|
2099
|
-
width: 38px;
|
|
2100
|
-
height: 38px;
|
|
2101
|
-
border-radius: var(--dpk-radius-xs);
|
|
2102
|
-
background: var(--dpk-paper-inset);
|
|
2103
|
-
color: var(--dpk-ink-faint);
|
|
2104
|
-
font-family: var(--dpk-mono);
|
|
2105
|
-
font-size: 12px;
|
|
2106
|
-
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
.arch-body {
|
|
2110
|
-
display: flex;
|
|
2111
|
-
flex-direction: column;
|
|
2112
|
-
gap: 6px;
|
|
2113
|
-
min-width: 0;
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
.arch-name {
|
|
2117
|
-
font-size: 13px;
|
|
2118
|
-
font-weight: 640;
|
|
2119
|
-
letter-spacing: -0.01em;
|
|
2120
|
-
white-space: nowrap;
|
|
2121
|
-
overflow: hidden;
|
|
2122
|
-
text-overflow: ellipsis;
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
.arch-description {
|
|
2126
|
-
font-size: 10px;
|
|
2127
|
-
line-height: 1.6;
|
|
2128
|
-
color: var(--dpk-ink-faint);
|
|
2129
|
-
display: -webkit-box;
|
|
2130
|
-
-webkit-line-clamp: 3;
|
|
2131
|
-
-webkit-box-orient: vertical;
|
|
2132
|
-
overflow: hidden;
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
.arch-link .d-edge-path {
|
|
2136
|
-
stroke: var(--dpk-rule-strong);
|
|
2137
|
-
stroke-width: 1.5;
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
.arch-link.is-related .d-edge-path {
|
|
2141
|
-
stroke: var(--dpk-green);
|
|
2142
|
-
stroke-width: 2;
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
.arch-link.is-selected .d-edge-path {
|
|
2146
|
-
stroke: var(--dpk-blue);
|
|
2147
|
-
stroke-width: 2.4;
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
.arch-link-label {
|
|
2151
|
-
font-size: 9.5px;
|
|
2152
|
-
fill: var(--dpk-ink-faint);
|
|
2153
|
-
paint-order: stroke;
|
|
2154
|
-
stroke: var(--dpk-paper-raised);
|
|
2155
|
-
stroke-width: 5px;
|
|
2156
|
-
stroke-linejoin: round;
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
#arch-neutral .diagram-arrow {
|
|
2160
|
-
fill: var(--dpk-rule-strong);
|
|
2161
|
-
stroke: var(--dpk-rule-strong);
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
#arch-selected .diagram-arrow {
|
|
2165
|
-
fill: var(--dpk-blue);
|
|
2166
|
-
stroke: var(--dpk-blue);
|
|
2167
|
-
}
|
|
2168
|
-
`,Tn=[{id:"arch-neutral"},{id:"arch-selected"}];class Zt extends ie{static{this.styles=[W,Dn]}#e=!0;parseData(e){return $n(e)}emptyData(){return wn()}defaultHeading(){return de(this.locale).heading}statsLabels(){const e=de(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return de(this.locale).empty}get layoutMode(){return"fixed"}layoutOptions(){return{padding:40}}computePlacement(e){return zn(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))}}initialView(){const e=this.visible.nodes.flatMap(n=>{const r=this.placedNode(n.id);return r?[r]:[]}),t=this.renderRoot.querySelector(".diagram-canvas"),s=la([...e,...this.#s()],t?.clientHeight??0);this.viewport?.reset(s??void 0)}relations(e,t){if(e===null||e.kind!=="node")return Y;const s=N(t.edges,e.id,"outgoing",!1),n=N(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=de(this.locale);return h`
|
|
2169
|
-
<button
|
|
2170
|
-
type="button"
|
|
2171
|
-
class="dpk-btn dpk-btn--ghost arch-toggle"
|
|
2172
|
-
data-toggle="boundaries"
|
|
2173
|
-
aria-pressed=${this.#e?"true":"false"}
|
|
2174
|
-
@click=${()=>{this.#e=!this.#e,this.requestUpdate()}}
|
|
2175
|
-
>
|
|
2176
|
-
${e.boundaries}
|
|
2177
|
-
</button>
|
|
2178
|
-
`}#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 En(e,this.items().boundaries)}renderCanvas(){const e=de(this.locale),t=this.visible,s=r=>t.nodes.find(i=>i.id===r)?.name??r,n=t.edges.map(r=>{const i=this.edgeState(r.id),o=this.routeOf(r.id),d=re(o),l=()=>this.select({kind:"edge",id:r.id});return I`
|
|
2179
|
-
<g class=${this.elementClass(i,"d-edge","arch-link")} data-link=${r.id}>
|
|
2180
|
-
<title>${r.label??r.id}</title>
|
|
2181
|
-
<path
|
|
2182
|
-
class="d-edge-path"
|
|
2183
|
-
d=${d}
|
|
2184
|
-
marker-end=${`url(#${i.selected?"arch-selected":"arch-neutral"})`}
|
|
2185
|
-
></path>
|
|
2186
|
-
<path
|
|
2187
|
-
class="d-edge-hit"
|
|
2188
|
-
d=${d}
|
|
2189
|
-
role="button"
|
|
2190
|
-
tabindex="0"
|
|
2191
|
-
aria-label=${e.edgeLabel(s(r.from),s(r.to))}
|
|
2192
|
-
@click=${l}
|
|
2193
|
-
@keydown=${c=>{c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),l())}}
|
|
2194
|
-
></path>
|
|
2195
|
-
${r.label===null||o.length===0?b:this.#a(r.label,o)}
|
|
2196
|
-
${this.renderEdgeCommentTrigger({kind:"edge",id:r.id},`${s(r.from)} \u2192 ${s(r.to)}${r.label===null?"":` \xB7 ${r.label}`}`,o)}
|
|
2197
|
-
</g>
|
|
2198
|
-
`});return h`
|
|
2199
|
-
${this.#e?this.#s().map(r=>h`<div
|
|
2200
|
-
class=${`arch-boundary ${r.boundary.kind==="external"?"is-external":""}`}
|
|
2201
|
-
data-boundary=${r.boundary.id}
|
|
2202
|
-
style="left:${r.x}px; top:${r.y}px; width:${r.width}px; height:${r.height}px"
|
|
2203
|
-
>
|
|
2204
|
-
<span>${r.boundary.label}</span>
|
|
2205
|
-
</div>`):b}
|
|
2206
|
-
${this.renderEdges(n,Tn)} ${t.nodes.map(r=>this.#t(r,e))}
|
|
2207
|
-
`}#a(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>`:h``}#t(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id);return h`
|
|
2208
|
-
<button
|
|
2209
|
-
type="button"
|
|
2210
|
-
class=${this.elementClass(n,"d-node","arch-service")}
|
|
2211
|
-
data-service=${e.id}
|
|
2212
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
2213
|
-
style="left:${s.x}px; top:${s.y}px; width:${e.width}px; height:${e.height}px"
|
|
2214
|
-
aria-pressed=${n.selected?"true":"false"}
|
|
2215
|
-
title=${e.description??e.name}
|
|
2216
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2217
|
-
>
|
|
2218
|
-
${e.artwork===null?h`<span class="arch-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>`:h`<img
|
|
2219
|
-
class="arch-artwork"
|
|
2220
|
-
src=${e.artwork.src}
|
|
2221
|
-
alt=${e.artwork.alt}
|
|
2222
|
-
title=${e.artwork.license===null?b:t.artworkCredit(e.artwork.license)}
|
|
2223
|
-
/>`}
|
|
2224
|
-
<span class="arch-body">
|
|
2225
|
-
<span class="arch-name">${e.name}</span>
|
|
2226
|
-
${e.description===null?b:h`<span class="arch-description">${e.description}</span>`}
|
|
2227
|
-
</span>
|
|
2228
|
-
</button>
|
|
2229
|
-
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:s.x+e.width-20,y:s.y-14})}
|
|
2230
|
-
`}}const Qt=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",Zt)},es=[72,52,40],ts=[0,22,10,8],An=a=>es[Math.min(a,es.length-1)]??40,ss=a=>ts[Math.min(a,ts.length-1)]??8,Ln=(a,e={})=>{const t=e.padding??40,s=a.nodes.find($=>$.parent===null);if(s===void 0)return{width:0,height:0,nodes:[],routes:[]};const n=new Map(a.nodes.map($=>[$.id,$])),r=$=>$.children.flatMap(A=>{const R=n.get(A);return R===void 0?[]:[R]}),i=new Map,o=$=>$.reduce((A,R,U)=>A+d(R)+(U===0?0:ss(R.depth)),0),d=$=>{const A=i.get($.id);if(A!==void 0)return A;const R=Math.max($.height,o(r($)));return i.set($.id,R),R},l=[],c=($,A,R)=>{if(A.length===0)return;const U=An($.node.depth);let m=$.y+$.node.height/2-o(A)/2;for(const C of A){const E=d(C),P={x:R==="right"?$.x+$.node.width+U:$.x-U-C.width,y:m+E/2-C.height/2,node:C};l.push(P),c(P,r(C),R),m+=E+ss(C.depth)}},g={x:-s.width/2,y:-s.height/2,node:s};l.push(g);const p=r(s);c(g,p.filter($=>$.side!=="left"),"right"),c(g,p.filter($=>$.side==="left"),"left");const k=Math.min(...l.map($=>$.x)),x=Math.min(...l.map($=>$.y)),v=Math.max(...l.map($=>$.x+$.node.width)),y=Math.max(...l.map($=>$.y+$.node.height)),w=t-k,D=t-x,L=new Map,T=l.map($=>{const A=L.get($.node.depth)??0;return L.set($.node.depth,A+1),{id:$.node.id,x:$.x+w,y:$.y+D,width:$.node.width,height:$.node.height,layer:$.node.depth,order:A}}),j=new Map(T.map($=>[$.id,$])),V=a.edges.flatMap($=>{const A=j.get($.from),R=j.get($.to),U=n.get($.to);if(A===void 0||R===void 0||U===void 0)return[];const m=U.side==="left",C={x:m?A.x:A.x+A.width,y:A.y+A.height/2},E={x:m?R.x+R.width:R.x,y:R.y+R.height/2};return[{id:$.id,points:[C,E]}]});return{width:v-k+t*2,height:y-x+t*2,nodes:T,routes:V}},Rn=a=>{const e=a[0],t=a.at(-1);if(e===void 0||t===void 0)return"";const s=(t.x-e.x)/2;return`M${e.x} ${e.y} C${e.x+s} ${e.y} ${t.x-s} ${t.y} ${t.x} ${t.y}`},le=_({en:{heading:"Mind map",empty:"No matching topics.",topics:"Topic",toggleOpen:(a,e)=>`Open ${e} subtopics of ${a}`,toggleClose:a=>`Collapse subtopics of ${a}`,addSubtopicButton:"+ Subtopic",commentButton:"Comment",addSubtopicAriaLabel:a=>`Subtopic of ${a}`,addSubtopicPlaceholder:"Subtopic title (Enter to add)",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",addTopicTitle:"Add topic",addSummary:(a,e)=>`${a} \u203A ${e}`},ja:{heading:"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7",empty:"\u8A72\u5F53\u3059\u308B\u30C8\u30D4\u30C3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",topics:"\u30C8\u30D4\u30C3\u30AF",toggleOpen:(a,e)=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF ${e} \u4EF6\u3092\u3072\u3089\u304F`,toggleClose:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u3092\u305F\u305F\u3080`,addSubtopicButton:"\uFF0B \u30B5\u30D6\u30C8\u30D4\u30C3\u30AF",commentButton:"\u30B3\u30E1\u30F3\u30C8",addSubtopicAriaLabel:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF`,addSubtopicPlaceholder:"\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",addTopicTitle:"\u30C8\u30D4\u30C3\u30AF\u3092\u8FFD\u52A0",addSummary:(a,e)=>`${a} \u203A ${e}`}}),as=Os(()=>q({id:S(u(),M(1)),label:S(u(),M(1)),description:f(u()),tags:f(z(u())),questions:f(u()),collapsed:f(we()),side:f(H(["left","right"])),children:f(z(as))})),On=q({root:as}),ns=()=>({root:null,nodes:[],edges:[]}),rs=[{fontSize:16,padding:22,height:48,min:120,max:280},{fontSize:13.5,padding:15,height:34,min:80,max:240},{fontSize:12.5,padding:12,height:28,min:56,max:220}],In=a=>rs[Math.min(a,rs.length-1)]??{fontSize:12.5,padding:12,height:28,min:56,max:220},Pn=(a,e)=>{let t=0;for(const s of a)t+=(s.codePointAt(0)??0)>=11904?e:e*.62;return t},jn=(a,e)=>{const t=In(e),s=Math.ceil(Pn(a,t.fontSize)+t.padding*2+4);return{width:Math.min(t.max,Math.max(t.min,s)),height:t.height}},Fe=a=>a.children===void 0||a.children.length===0?1:a.children.reduce((e,t)=>e+Fe(t),0),is=a=>{const e={left:0,right:0};for(const t of a)t.side!==void 0&&(e[t.side]+=Fe(t));return a.map(t=>{if(t.side!==void 0)return t.side;const s=e.right<=e.left?"right":"left";return e[s]+=Fe(t),s})},os=a=>ds(G(On,a).root),ds=(a,e=new Set)=>{const t=[],s=[],n=new Set,r=(i,o,d,l,c)=>{if(n.has(i.id))throw new Error(`duplicate topic id: ${i.id}`);if(n.add(i.id),i.side!==void 0&&d!==1)throw new Error(`side is only allowed on a main topic (a child of the root): ${i.id}`);const g=i.children??[];t.push({id:i.id,label:i.label,description:i.description??null,parent:o,depth:d,branch:l,side:c,children:g.map(k=>k.id),collapsed:i.collapsed??!1,added:e.has(i.id),tags:i.tags??[],...jn(i.label,d),...i.questions===void 0?{}:{questions:i.questions}}),o!==null&&s.push({id:i.id,from:o,to:i.id,tags:[]});const p=d===0?is(g):[];g.forEach((k,x)=>r(k,i.id,d+1,d===0?x:l,d===0?p[x]??"right":c))};return r(a,null,0,-1,null),{root:a,nodes:t,edges:s}},ls="ADD_TOPIC",Fn=Se({id:S(u(),M(1)),label:S(u(),Me(),M(1))}),Nn=a=>{const e=mt(a);return e?.length===3&&e[1]==="node"?e[2]??null:null},cs=(a,e,t)=>a.id===e?{...a,children:[...a.children??[],t]}:a.children===void 0?a:{...a,children:a.children.map(s=>cs(s,e,t))},Un=a=>{if(a.children===void 0)return a;const e=is(a.children);return{...a,children:a.children.map((t,s)=>({...t,side:e[s]??"right"}))}},Hn=(a,e,t)=>{const s=a.addTopicTitle,n=new Map(e.nodes.map(d=>[d.id,d.label])),r=new Set,i=[];let o=e.root===null?null:Un(e.root);for(const d of t){if(d.type!==ls){i.push({id:d.id,title:d.type,stale:"unsupported-action-type"});continue}const l=Nn(d.target.id),c=l===null?void 0:n.get(l),g=$e(Fn,d.payload);if(o===null||l===null||c===void 0){i.push({id:d.id,title:s,stale:"target-missing"});continue}if(!g.success||n.has(g.output.id)){i.push({id:d.id,title:s,stale:"constraint-violated"});continue}const{id:p,label:k}=g.output;o=cs(o,l,{id:p,label:k}),n.set(p,k),r.add(p),i.push({id:d.id,title:s,summary:a.addSummary(c,k),tone:"create"})}return{data:o===null||r.size===0?e:ds(o,r),results:i}},Ne=(a,e)=>{const t=new Map(a.nodes.map(r=>[r.id,r])),s=[];let n=t.get(e)?.parent??null;for(;n!==null&&!s.includes(n);)s.push(n),n=t.get(n)?.parent??null;return s},_n=(a,e)=>{const t=new Map(a.nodes.map(r=>[r.id,r]));let s=0;const n=[...t.get(e)?.children??[]];for(let r=n.pop();r!==void 0;r=n.pop())s+=1,n.push(...t.get(r)?.children??[]);return s},Bn=(a,e,t)=>{let s=null;if(e!==null){const i=a.nodes.filter(e);if(i.length===0)return ns();const o=new Map(a.nodes.map(l=>[l.id,l])),d=new Set;for(const l of i){d.add(l.id);for(const g of Ne(a,l.id))d.add(g);const c=[...l.children];for(let g=c.pop();g!==void 0;g=c.pop())d.add(g),c.push(...o.get(g)?.children??[])}s=d}const n=a.nodes.filter(i=>(s===null||s.has(i.id))&&!Ne(a,i.id).some(o=>t.has(o))),r=new Set(n.map(i=>i.id));return{...a,nodes:n,edges:a.edges.filter(i=>r.has(i.from)&&r.has(i.to))}},Gn=B`
|
|
2231
|
-
.branch-root {
|
|
2232
|
-
--mind-color: var(--dpk-ink);
|
|
2233
|
-
--mind-soft: var(--dpk-paper-sunken);
|
|
2234
|
-
}
|
|
2235
|
-
.branch-0 {
|
|
2236
|
-
--mind-color: var(--dpk-blue);
|
|
2237
|
-
--mind-soft: var(--dpk-blue-soft);
|
|
2238
|
-
}
|
|
2239
|
-
.branch-1 {
|
|
2240
|
-
--mind-color: var(--dpk-green);
|
|
2241
|
-
--mind-soft: var(--dpk-green-soft);
|
|
2242
|
-
}
|
|
2243
|
-
.branch-2 {
|
|
2244
|
-
--mind-color: var(--dpk-violet);
|
|
2245
|
-
--mind-soft: var(--dpk-violet-soft);
|
|
2246
|
-
}
|
|
2247
|
-
.branch-3 {
|
|
2248
|
-
--mind-color: var(--dpk-amber);
|
|
2249
|
-
--mind-soft: var(--dpk-amber-soft);
|
|
2250
|
-
}
|
|
2251
|
-
.branch-4 {
|
|
2252
|
-
--mind-color: var(--dpk-accent);
|
|
2253
|
-
--mind-soft: var(--dpk-accent-soft);
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
.mind-topic {
|
|
2257
|
-
display: flex;
|
|
2258
|
-
align-items: center;
|
|
2259
|
-
justify-content: center;
|
|
2260
|
-
padding: 0 12px;
|
|
2261
|
-
border: 1px solid color-mix(in srgb, var(--mind-color) 45%, transparent);
|
|
2262
|
-
border-radius: 999px;
|
|
2263
|
-
background: var(--dpk-paper-raised);
|
|
2264
|
-
color: var(--dpk-ink);
|
|
2265
|
-
font-family: var(--dpk-body);
|
|
2266
|
-
font-size: 12.5px;
|
|
2267
|
-
line-height: 1.3;
|
|
2268
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2269
|
-
transition:
|
|
2270
|
-
border-color 160ms var(--dpk-ease),
|
|
2271
|
-
box-shadow 160ms var(--dpk-ease),
|
|
2272
|
-
transform 160ms var(--dpk-ease);
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
.mind-label {
|
|
2276
|
-
min-width: 0;
|
|
2277
|
-
white-space: nowrap;
|
|
2278
|
-
overflow: hidden;
|
|
2279
|
-
text-overflow: ellipsis;
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
.mind-topic.depth-0 {
|
|
2283
|
-
padding: 0 22px;
|
|
2284
|
-
border: 0;
|
|
2285
|
-
background: linear-gradient(155deg, color-mix(in srgb, var(--dpk-ink) 88%, transparent), var(--dpk-ink));
|
|
2286
|
-
color: var(--dpk-paper-raised);
|
|
2287
|
-
font-size: 16px;
|
|
2288
|
-
font-weight: 680;
|
|
2289
|
-
letter-spacing: -0.01em;
|
|
2290
|
-
box-shadow:
|
|
2291
|
-
inset 0 1px 0 var(--dpk-highlight),
|
|
2292
|
-
var(--dpk-shadow-sm);
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
.mind-topic.depth-1 {
|
|
2296
|
-
padding: 0 15px;
|
|
2297
|
-
border-width: 1.5px;
|
|
2298
|
-
border-color: var(--mind-color);
|
|
2299
|
-
background: var(--mind-soft);
|
|
2300
|
-
font-size: 13.5px;
|
|
2301
|
-
font-weight: 620;
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
.mind-topic.depth-1 .mind-label {
|
|
2305
|
-
color: color-mix(in srgb, var(--mind-color) 70%, var(--dpk-ink));
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
.mind-topic:hover {
|
|
2309
|
-
border-color: var(--mind-color);
|
|
2310
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2311
|
-
transform: translateY(-1px);
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
.mind-topic.is-selected {
|
|
2315
|
-
border-color: var(--mind-color);
|
|
2316
|
-
box-shadow:
|
|
2317
|
-
var(--dpk-bevel),
|
|
2318
|
-
var(--dpk-shadow-sm),
|
|
2319
|
-
0 0 0 3px color-mix(in srgb, var(--mind-color) 22%, transparent);
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2322
|
-
.mind-topic.depth-0.is-selected {
|
|
2323
|
-
box-shadow:
|
|
2324
|
-
inset 0 1px 0 var(--dpk-highlight),
|
|
2325
|
-
var(--dpk-shadow-sm),
|
|
2326
|
-
0 0 0 3px var(--dpk-blue-soft);
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
|
-
.mind-topic.is-related {
|
|
2330
|
-
border-color: var(--mind-color);
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
.mind-topic:focus-visible {
|
|
2334
|
-
outline: none;
|
|
2335
|
-
box-shadow: var(--dpk-focus);
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
/* Added on this page by a draft action: not authored yet. */
|
|
2339
|
-
.mind-topic.is-added {
|
|
2340
|
-
border-style: dashed;
|
|
2341
|
-
border-color: var(--mind-color);
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
.mind-actions {
|
|
2345
|
-
position: absolute;
|
|
2346
|
-
z-index: 3;
|
|
2347
|
-
display: flex;
|
|
2348
|
-
flex-wrap: wrap;
|
|
2349
|
-
align-items: center;
|
|
2350
|
-
gap: 6px;
|
|
2351
|
-
width: 220px;
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
.mind-actions .dpk-btn {
|
|
2355
|
-
padding: 3px 9px;
|
|
2356
|
-
font-size: 12px;
|
|
2357
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
.mind-actions .dpk-input {
|
|
2361
|
-
width: 100%;
|
|
2362
|
-
font-size: 12.5px;
|
|
2363
|
-
box-shadow: var(--dpk-shadow-xs);
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
.mind-actions-error {
|
|
2367
|
-
font-size: 11.5px;
|
|
2368
|
-
line-height: 1.4;
|
|
2369
|
-
color: var(--dpk-accent);
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2372
|
-
.mind-branch {
|
|
2373
|
-
fill: none;
|
|
2374
|
-
stroke: color-mix(in srgb, var(--mind-color) 55%, transparent);
|
|
2375
|
-
stroke-width: 1.5;
|
|
2376
|
-
stroke-linecap: round;
|
|
2377
|
-
cursor: default;
|
|
2378
|
-
transition: opacity 150ms ease;
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
.mind-branch.depth-1 {
|
|
2382
|
-
stroke-width: 3;
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
.mind-branch.depth-2 {
|
|
2386
|
-
stroke-width: 2;
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
.mind-branch.is-related {
|
|
2390
|
-
stroke: var(--mind-color);
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
.mind-toggle {
|
|
2394
|
-
position: absolute;
|
|
2395
|
-
z-index: 1;
|
|
2396
|
-
min-width: 18px;
|
|
2397
|
-
height: 18px;
|
|
2398
|
-
padding: 0 4px;
|
|
2399
|
-
transform: translate(-50%, -50%);
|
|
2400
|
-
border: 1.5px solid var(--mind-color);
|
|
2401
|
-
border-radius: 999px;
|
|
2402
|
-
background: var(--dpk-paper-raised);
|
|
2403
|
-
color: var(--mind-color);
|
|
2404
|
-
font-family: var(--dpk-mono);
|
|
2405
|
-
font-size: 10px;
|
|
2406
|
-
font-weight: 700;
|
|
2407
|
-
line-height: 1;
|
|
2408
|
-
cursor: pointer;
|
|
2409
|
-
opacity: 0;
|
|
2410
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2411
|
-
transition:
|
|
2412
|
-
opacity 120ms ease,
|
|
2413
|
-
box-shadow 160ms var(--dpk-ease);
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
.mind-toggle:hover,
|
|
2417
|
-
.mind-toggle:focus-visible {
|
|
2418
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
/* Expanded toggles appear with their topic; folded ones always show the count. */
|
|
2422
|
-
.mind-topic:hover + .mind-toggle,
|
|
2423
|
-
.mind-toggle:hover,
|
|
2424
|
-
.mind-toggle:focus-visible,
|
|
2425
|
-
.mind-toggle.is-folded {
|
|
2426
|
-
opacity: 1;
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
.mind-toggle.is-dimmed {
|
|
2430
|
-
opacity: 0;
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
.mind-toggle.is-folded.is-dimmed {
|
|
2434
|
-
opacity: 0.26;
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
.mind-toggle:focus-visible {
|
|
2438
|
-
outline: none;
|
|
2439
|
-
box-shadow: var(--dpk-focus);
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
@media (hover: none) {
|
|
2443
|
-
.mind-toggle {
|
|
2444
|
-
opacity: 1;
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
`,Yn=5,ps=.6;class hs extends ie{static{this.styles=[W,Gn]}#e=new Set;#s=null;#a=!1;#t=null;toggle(e,t){const s=this.items().nodes.find(r=>r.id===e);if(s===void 0||s.children.length===0)return;const n=t??!this.#e.has(e);if(n!==this.#e.has(e)){if(n){this.#e.add(e);const r=this.selection;r!==null&&Ne(this.items(),r.id).includes(e)&&this.select(null)}else this.#e.delete(e);this.requestUpdate()}}get collapsed(){return[...this.#e]}parseData(e){return os(e)}emptyData(){return ns()}reduceElementActions(e,t){return Hn(le(this.locale),e,t)}defaultHeading(){return le(this.locale).heading}emptyMessage(){return le(this.locale).empty}statsText(){const e=le(this.locale),t=this.items().nodes.length,s=this.filtered().nodes.length;return s===t?`${t} ${e.topics}`:`${s} / ${t} ${e.topics}`}filtered(){const e=this.tagFilter,t=e.active.length===0?null:s=>Q(s.tags,e);return Bn(this.items(),t,this.#e)}layoutSignature(){return this.filtered().nodes.map(e=>`${e.id}<${e.parent??""}:${e.side??""}`).join(",")}computePlacement(e){return Ln(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.#a=!1,this.#t=null),super.refreshContent()}initialView(){const e=this.viewport;if(e===null)return;if(this.#a){e.apply();return}this.#a=!0,e.fit();const{scale:t}=e.view();t<ps&&e.zoom(ps/t)}commentItems(){return this.items().nodes.map(e=>({value:this.commentRef("node",e.id),label:e.label}))}hasSelection(e){return e.kind==="node"&&this.items().nodes.some(t=>t.id===e.id)}relations(e,t){if(e===null||e.kind!=="node")return{nodes:new Map,edges:new Set};const s=N(t.edges,e.id,"outgoing",!0),n=N(t.edges,e.id,"incoming",!0);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderSelection(){return b}renderCanvas(){const e=this.filtered(),t=le(this.locale);return h`
|
|
2448
|
-
${this.renderEdges(e.edges.map(s=>this.#r(s)),[])}
|
|
2449
|
-
${e.nodes.map(s=>this.#i(s,t))} ${this.#c(t)}
|
|
2450
|
-
`}#n(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%Yn}`}#r(e){const t=this.items().nodes.find(n=>n.id===e.to),s=this.edgeState(e.id);return I`
|
|
2451
|
-
<path
|
|
2452
|
-
class=${this.elementClass(s,"d-edge","mind-branch",this.#n(t),`depth-${Math.min(t?.depth??1,3)}`)}
|
|
2453
|
-
data-branch=${e.id}
|
|
2454
|
-
d=${Rn(this.routeOf(e.id))}
|
|
2455
|
-
></path>
|
|
2456
|
-
`}#i(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id),r=this.#e.has(e.id),i=`depth-${Math.min(e.depth,3)}`;return h`
|
|
2457
|
-
<button
|
|
2458
|
-
type="button"
|
|
2459
|
-
class=${this.elementClass(n,"d-node","mind-topic",i,this.#n(e),r&&"is-folded",e.added&&"is-added")}
|
|
2460
|
-
data-topic=${e.id}
|
|
2461
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
2462
|
-
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
2463
|
-
aria-pressed=${n.selected?"true":"false"}
|
|
2464
|
-
title=${e.description??e.label}
|
|
2465
|
-
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2466
|
-
>
|
|
2467
|
-
<span class="mind-label">${e.label}</span>
|
|
2468
|
-
</button>
|
|
2469
|
-
${e.depth===0||e.children.length===0?b:this.#o(e,s,r,n.dimmed,t)}
|
|
2470
|
-
`}#o(e,t,s,n,r){const i=s?_n(this.items(),e.id):0,o=e.side==="left"?t.x:t.x+t.width,d=s?r.toggleOpen(e.label,i):r.toggleClose(e.label);return h`
|
|
2471
|
-
<button
|
|
2472
|
-
type="button"
|
|
2473
|
-
class=${this.elementClass({selected:!1,related:!1,dimmed:n,depth:null},"mind-toggle",this.#n(e),s&&"is-folded")}
|
|
2474
|
-
data-toggle=${e.id}
|
|
2475
|
-
style="left:${o}px; top:${t.y+t.height/2}px"
|
|
2476
|
-
aria-expanded=${s?"false":"true"}
|
|
2477
|
-
aria-label=${d}
|
|
2478
|
-
title=${d}
|
|
2479
|
-
@click=${l=>{l.stopPropagation(),this.toggle(e.id)}}
|
|
2480
|
-
>
|
|
2481
|
-
${s?i:"\u2212"}
|
|
2482
|
-
</button>
|
|
2483
|
-
`}#c(e){const t=this.selection;if(t===null||t.kind!=="node")return b;const s=this.items().nodes.find(i=>i.id===t.id),n=this.placedNode(t.id);if(s===void 0||n===void 0)return b;const r=this.#t?.parent===s.id?this.#t:null;return h`
|
|
2484
|
-
<div
|
|
2485
|
-
class="mind-actions"
|
|
2486
|
-
data-for=${s.id}
|
|
2487
|
-
style="left:${this.#u(s,n)}px; top:${n.y+n.height+8}px"
|
|
2488
|
-
@click=${i=>i.stopPropagation()}
|
|
2489
|
-
>
|
|
2490
|
-
${r===null?h`
|
|
2491
|
-
<button type="button" class="dpk-btn" data-action="add" @click=${()=>this.#l(s.id)}>
|
|
2492
|
-
${e.addSubtopicButton}
|
|
2493
|
-
</button>
|
|
2494
|
-
<button
|
|
2495
|
-
type="button"
|
|
2496
|
-
class="dpk-btn"
|
|
2497
|
-
data-action="comment"
|
|
2498
|
-
@click=${()=>this.requestElementComment("node",s.id)}
|
|
2499
|
-
>
|
|
2500
|
-
${e.commentButton}
|
|
2501
|
-
</button>
|
|
2502
|
-
`:h`
|
|
2503
|
-
<input
|
|
2504
|
-
class="dpk-input"
|
|
2505
|
-
aria-label="${e.addSubtopicAriaLabel(s.label)}"
|
|
2506
|
-
placeholder="${e.addSubtopicPlaceholder}"
|
|
2507
|
-
.value=${r.label}
|
|
2508
|
-
@input=${i=>{const o=i.currentTarget;o instanceof HTMLInputElement&&(this.#t={...r,label:o.value,failed:!1})}}
|
|
2509
|
-
@keydown=${i=>this.#p(i,s.id)}
|
|
2510
|
-
/>
|
|
2511
|
-
${r.failed?h`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:b}
|
|
2512
|
-
`}
|
|
2513
|
-
</div>
|
|
2514
|
-
`}#u(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#p(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#t=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#t?.label.trim()??"";if(s.length===0)return;const n=Qe(`topic ${s}`,this.items().nodes.map(i=>i.id));if(!this.dispatchElementAction(ls,["node",t],{id:n,label:s})){this.#t={parent:t,label:s,failed:!0},this.requestUpdate();return}this.#t=null,this.#e.delete(t),this.select({kind:"node",id:n}),this.requestUpdate()}}const us=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",hs)},ce=_({en:{heading:"Kanban",empty:"No columns.",cards:"Card",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",wipLimit:a=>`WIP limit ${a}`,addCardButton:"+ Card",addCardAriaLabel:a=>`Card to add to ${a}`,addCardPlaceholder:"Card title (Enter to add)",addCardTitle:"Add card",moveCardTitle:"Move card",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: reorder within ${e}`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`},ja:{heading:"\u30AB\u30F3\u30D0\u30F3",empty:"\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002",cards:"\u30AB\u30FC\u30C9",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",wipLimit:a=>`WIP \u4E0A\u9650 ${a}`,addCardButton:"\uFF0B \u30AB\u30FC\u30C9",addCardAriaLabel:a=>`${a} \u306B\u8FFD\u52A0\u3059\u308B\u30AB\u30FC\u30C9`,addCardPlaceholder:"\u30AB\u30FC\u30C9\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",addCardTitle:"\u30AB\u30FC\u30C9\u3092\u8FFD\u52A0",moveCardTitle:"\u30AB\u30FC\u30C9\u3092\u79FB\u52D5",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: ${e} \u5185\u3067\u4E26\u3079\u66FF\u3048`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`}}),Vn=q({id:S(u(),M(1)),title:S(u(),M(1)),description:f(u()),tags:f(z(u())),assignee:f(u()),questions:f(u())}),Wn=["gray","blue","green","amber","violet","red"],Kn=q({id:S(u(),M(1)),label:S(u(),M(1)),description:f(u()),color:f(H(Wn)),limit:f(S(ae(),Ps(),Is(1))),cards:f(z(Vn))}),Xn=q({columns:z(Kn)}),Jn=()=>({columns:[]}),ms=a=>{const e=G(Xn,a),t=new Set,s=new Set;return{columns:e.columns.map(r=>{if(t.has(r.id))throw new Error(`duplicate column id: ${r.id}`);return t.add(r.id),{id:r.id,label:r.label,description:r.description??null,color:r.color??null,limit:r.limit??null,cards:(r.cards??[]).map(i=>{if(s.has(i.id))throw new Error(`duplicate card id: ${i.id}`);return s.add(i.id),{id:i.id,title:i.title,description:i.description??null,tags:i.tags??[],assignee:i.assignee??null,...i.questions===void 0?{}:{questions:i.questions},column:r.id,change:null}})}})}},xe=(a,e)=>a.columns.flatMap(t=>t.cards).find(t=>t.id===e),pe=a=>a.columns.flatMap(e=>e.cards),Zn=(a,e)=>e===null?a:{columns:a.columns.map(t=>({...t,cards:t.cards.filter(e)}))},Qn=(a,e,t,s)=>{const n=xe(a,e);if(n===void 0||n.column!==t)return!1;if(s===e)return!0;const r=a.columns.find(o=>o.id===t)?.cards??[],i=r.findIndex(o=>o.id===e);return(r[i+1]?.id??null)===s},gs="ADD_CARD",fs="MOVE_CARD",er=Se({id:S(u(),M(1)),title:S(u(),Me(),M(1))}),tr=Se({column:S(u(),M(1)),before:js(S(u(),M(1)))}),bs=(a,e)=>{const t=mt(a);return t?.length===3&&t[1]===e?t[2]??null:null},sr=(a,e)=>({columns:a.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),ks=(a,e,t)=>({columns:a.columns.map(s=>{if(s.id!==t.column)return s;const n={...e,column:s.id},r=t.before===null?-1:s.cards.findIndex(i=>i.id===t.before);return{...s,cards:r<0?[...s.cards,n]:[...s.cards.slice(0,r),n,...s.cards.slice(r)]}})}),ar=(a,e,t)=>{const s=a.addCardTitle,n=bs(t.target.id,"column"),r=e.columns.find(d=>d.id===n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(er,t.payload);if(!i.success||xe(e,i.output.id)!==void 0)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const o={id:i.output.id,title:i.output.title,description:null,tags:[],assignee:null,column:r.id,change:"added"};return{data:ks(e,o,{column:r.id,before:null}),result:{id:t.id,title:s,summary:a.addSummary(r.label,o.title),tone:"create"}}},nr=(a,e,t)=>{const s=a.moveCardTitle,n=bs(t.target.id,"card"),r=n===null?void 0:xe(e,n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(tr,t.payload),o=e.columns.find(k=>k.id===r.column),d=i.success?e.columns.find(k=>k.id===i.output.column):void 0,l=i.success?i.output.before:null,c=l===null||l!==r.id&&d?.cards.some(k=>k.id===l)===!0;if(!i.success||o===void 0||d===void 0||!c)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const g={...r,change:r.change??"moved"},p=o.id===d.id?a.moveSummarySame(r.title,d.label):a.moveSummaryAcross(r.title,o.label,d.label);return{data:ks(sr(e,r.id),g,{column:d.id,before:l}),result:{id:t.id,title:s,summary:p,tone:"move"}}},rr=(a,e,t)=>{let s=e;const n=[];for(const r of t){const i=r.type===gs?ar(a,s,r):r.type===fs?nr(a,s,r):{data:s,result:{id:r.id,title:r.type,stale:"unsupported-action-type"}};s=i.data,n.push(i.result)}return{data:s,results:n}},ir=B`
|
|
2515
|
-
.kanban-board {
|
|
2516
|
-
display: flex;
|
|
2517
|
-
align-items: flex-start;
|
|
2518
|
-
gap: 14px;
|
|
2519
|
-
width: max-content;
|
|
2520
|
-
padding: 18px;
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
.kanban-column {
|
|
2524
|
-
display: flex;
|
|
2525
|
-
flex-direction: column;
|
|
2526
|
-
gap: 8px;
|
|
2527
|
-
width: 264px;
|
|
2528
|
-
padding: 10px;
|
|
2529
|
-
border: 1px solid var(--dpk-rule);
|
|
2530
|
-
border-radius: var(--dpk-radius-lg);
|
|
2531
|
-
background: var(--dpk-paper-sunken);
|
|
2532
|
-
box-shadow: inset 0 1px 3px var(--dpk-shade-1);
|
|
2533
|
-
cursor: default;
|
|
2534
|
-
transition:
|
|
2535
|
-
border-color 150ms var(--dpk-ease),
|
|
2536
|
-
box-shadow 150ms var(--dpk-ease);
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
.kanban-column.is-selected {
|
|
2540
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
2541
|
-
box-shadow:
|
|
2542
|
-
inset 0 1px 3px var(--dpk-shade-1),
|
|
2543
|
-
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
2544
|
-
}
|
|
2545
|
-
|
|
2546
|
-
.kanban-column.is-drop-target {
|
|
2547
|
-
border-color: var(--dpk-blue);
|
|
2548
|
-
background: color-mix(in srgb, var(--dpk-blue-soft) 60%, var(--dpk-paper-sunken));
|
|
2549
|
-
box-shadow:
|
|
2550
|
-
inset 0 1px 3px var(--dpk-shade-1),
|
|
2551
|
-
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 30%, transparent);
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
.kanban-column-head {
|
|
2555
|
-
position: relative;
|
|
2556
|
-
display: flex;
|
|
2557
|
-
align-items: center;
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
.kanban-column-title {
|
|
2561
|
-
display: flex;
|
|
2562
|
-
flex: 1;
|
|
2563
|
-
align-items: center;
|
|
2564
|
-
gap: 8px;
|
|
2565
|
-
min-width: 0;
|
|
2566
|
-
padding: 2px 34px 2px 2px;
|
|
2567
|
-
border: 0;
|
|
2568
|
-
border-radius: var(--dpk-radius-xs);
|
|
2569
|
-
background: none;
|
|
2570
|
-
color: var(--dpk-ink);
|
|
2571
|
-
font-family: var(--dpk-body);
|
|
2572
|
-
font-size: 13px;
|
|
2573
|
-
font-weight: 650;
|
|
2574
|
-
letter-spacing: -0.01em;
|
|
2575
|
-
text-align: left;
|
|
2576
|
-
cursor: pointer;
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
.kanban-column-title:focus-visible {
|
|
2580
|
-
outline: none;
|
|
2581
|
-
box-shadow: var(--dpk-focus);
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
.kanban-column-label {
|
|
2585
|
-
min-width: 0;
|
|
2586
|
-
overflow: hidden;
|
|
2587
|
-
text-overflow: ellipsis;
|
|
2588
|
-
white-space: nowrap;
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
|
-
/* An authored color marks the heading, not the cards: the status reads at a glance. */
|
|
2592
|
-
.kanban-column[data-color='gray'] {
|
|
2593
|
-
--kanban-tone: var(--dpk-ink-soft);
|
|
2594
|
-
}
|
|
2595
|
-
|
|
2596
|
-
.kanban-column[data-color='blue'] {
|
|
2597
|
-
--kanban-tone: var(--dpk-blue);
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
.kanban-column[data-color='green'] {
|
|
2601
|
-
--kanban-tone: var(--dpk-green);
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
.kanban-column[data-color='amber'] {
|
|
2605
|
-
--kanban-tone: var(--dpk-amber);
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
.kanban-column[data-color='violet'] {
|
|
2609
|
-
--kanban-tone: var(--dpk-violet);
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
.kanban-column[data-color='red'] {
|
|
2613
|
-
--kanban-tone: var(--dpk-accent);
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
.kanban-column[data-color] .kanban-column-label {
|
|
2617
|
-
padding: 2px 9px;
|
|
2618
|
-
border-radius: 999px;
|
|
2619
|
-
background: color-mix(in srgb, var(--kanban-tone) 14%, transparent);
|
|
2620
|
-
color: var(--kanban-tone);
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
.kanban-count {
|
|
2624
|
-
flex: none;
|
|
2625
|
-
padding: 1px 7px;
|
|
2626
|
-
border-radius: 999px;
|
|
2627
|
-
background: var(--dpk-paper-raised);
|
|
2628
|
-
color: var(--dpk-ink-soft);
|
|
2629
|
-
font-family: var(--dpk-mono);
|
|
2630
|
-
font-size: 11px;
|
|
2631
|
-
font-weight: 600;
|
|
2632
|
-
font-variant-numeric: tabular-nums;
|
|
2633
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
/* Over its WIP limit: the column asks for attention, not the cards. */
|
|
2637
|
-
.kanban-column.is-over {
|
|
2638
|
-
border-color: color-mix(in srgb, var(--dpk-accent) 55%, transparent);
|
|
2639
|
-
}
|
|
2640
|
-
|
|
2641
|
-
.kanban-column.is-over .kanban-count {
|
|
2642
|
-
background: var(--dpk-accent-soft);
|
|
2643
|
-
color: var(--dpk-accent);
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
.kanban-column-head > .diagram-comment-trigger {
|
|
2647
|
-
position: absolute;
|
|
2648
|
-
top: 50%;
|
|
2649
|
-
right: 0;
|
|
2650
|
-
transform: translateY(-50%);
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
.kanban-column-description {
|
|
2654
|
-
margin: 0 2px;
|
|
2655
|
-
color: var(--dpk-ink-soft);
|
|
2656
|
-
font-size: 11.5px;
|
|
2657
|
-
line-height: 1.45;
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2660
|
-
.kanban-cards {
|
|
2661
|
-
display: flex;
|
|
2662
|
-
flex-direction: column;
|
|
2663
|
-
gap: 8px;
|
|
2664
|
-
min-height: 44px;
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
.kanban-card-slot {
|
|
2668
|
-
position: relative;
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
.kanban-card {
|
|
2672
|
-
display: flex;
|
|
2673
|
-
flex-direction: column;
|
|
2674
|
-
gap: 5px;
|
|
2675
|
-
padding: 9px 34px 9px 11px;
|
|
2676
|
-
border: 1px solid var(--dpk-rule);
|
|
2677
|
-
border-radius: var(--dpk-radius-sm);
|
|
2678
|
-
background: var(--dpk-paper-raised);
|
|
2679
|
-
color: var(--dpk-ink);
|
|
2680
|
-
font-family: var(--dpk-body);
|
|
2681
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2682
|
-
cursor: grab;
|
|
2683
|
-
transition:
|
|
2684
|
-
border-color 150ms var(--dpk-ease),
|
|
2685
|
-
box-shadow 150ms var(--dpk-ease),
|
|
2686
|
-
opacity 150ms var(--dpk-ease),
|
|
2687
|
-
transform 150ms var(--dpk-ease);
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
|
-
.kanban-card:hover {
|
|
2691
|
-
border-color: var(--dpk-rule-hover);
|
|
2692
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2693
|
-
transform: translateY(-1px);
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2696
|
-
.kanban-card.is-selected {
|
|
2697
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
2698
|
-
box-shadow:
|
|
2699
|
-
var(--dpk-bevel),
|
|
2700
|
-
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 45%, transparent),
|
|
2701
|
-
var(--dpk-shadow-xs);
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
.kanban-card:focus-visible {
|
|
2705
|
-
outline: none;
|
|
2706
|
-
box-shadow: var(--dpk-focus);
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
.kanban-card.is-dragging {
|
|
2710
|
-
opacity: 0.45;
|
|
2711
|
-
transform: rotate(-1.5deg) scale(0.98);
|
|
2712
|
-
box-shadow: var(--dpk-shadow-sm);
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
/* Changed on this page by a draft action: not authored yet. */
|
|
2716
|
-
.kanban-card.is-added {
|
|
2717
|
-
border-style: dashed;
|
|
2718
|
-
border-color: var(--dpk-green);
|
|
2719
|
-
background: linear-gradient(90deg, var(--dpk-green-soft), transparent 60%), var(--dpk-paper-raised);
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
.kanban-card.is-moved {
|
|
2723
|
-
border-left: 3px solid var(--dpk-blue);
|
|
2724
|
-
background: linear-gradient(90deg, var(--dpk-blue-soft), transparent 60%), var(--dpk-paper-raised);
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
.kanban-card-title {
|
|
2728
|
-
font-size: 13px;
|
|
2729
|
-
font-weight: 600;
|
|
2730
|
-
letter-spacing: -0.005em;
|
|
2731
|
-
line-height: 1.45;
|
|
2732
|
-
overflow-wrap: anywhere;
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
.kanban-card-description {
|
|
2736
|
-
display: -webkit-box;
|
|
2737
|
-
overflow: hidden;
|
|
2738
|
-
color: var(--dpk-ink-soft);
|
|
2739
|
-
font-size: 11.5px;
|
|
2740
|
-
line-height: 1.45;
|
|
2741
|
-
-webkit-box-orient: vertical;
|
|
2742
|
-
-webkit-line-clamp: 3;
|
|
2743
|
-
line-clamp: 3;
|
|
2744
|
-
overflow-wrap: anywhere;
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
.kanban-card-meta {
|
|
2748
|
-
display: flex;
|
|
2749
|
-
flex-wrap: wrap;
|
|
2750
|
-
align-items: center;
|
|
2751
|
-
gap: 4px;
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
.kanban-tag {
|
|
2755
|
-
padding: 1px 7px;
|
|
2756
|
-
border: 1px solid var(--dpk-rule);
|
|
2757
|
-
border-radius: 999px;
|
|
2758
|
-
background: var(--dpk-paper-sunken);
|
|
2759
|
-
color: var(--dpk-ink-soft);
|
|
2760
|
-
font-size: 10.5px;
|
|
2761
|
-
}
|
|
2762
|
-
|
|
2763
|
-
.kanban-assignee {
|
|
2764
|
-
margin-left: auto;
|
|
2765
|
-
color: var(--dpk-ink-faint);
|
|
2766
|
-
font-size: 11px;
|
|
2767
|
-
}
|
|
2768
|
-
|
|
2769
|
-
.kanban-assignee::before {
|
|
2770
|
-
content: '';
|
|
2771
|
-
display: inline-block;
|
|
2772
|
-
width: 5px;
|
|
2773
|
-
height: 5px;
|
|
2774
|
-
margin-right: 4px;
|
|
2775
|
-
border-radius: 999px;
|
|
2776
|
-
background: var(--dpk-ink-faint);
|
|
2777
|
-
vertical-align: middle;
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
.kanban-card-slot > .diagram-comment-trigger {
|
|
2781
|
-
position: absolute;
|
|
2782
|
-
top: 5px;
|
|
2783
|
-
right: 5px;
|
|
2784
|
-
z-index: 2;
|
|
2785
|
-
}
|
|
2786
|
-
|
|
2787
|
-
.kanban-error {
|
|
2788
|
-
margin: 6px 0 0;
|
|
2789
|
-
padding: 4px 7px;
|
|
2790
|
-
border-radius: var(--dpk-radius-xs);
|
|
2791
|
-
background: var(--dpk-accent-soft);
|
|
2792
|
-
color: var(--dpk-accent);
|
|
2793
|
-
font-size: 11.5px;
|
|
2794
|
-
line-height: 1.4;
|
|
2795
|
-
}
|
|
2796
|
-
|
|
2797
|
-
/* Takes no room of its own, so the cards do not jump while dragging. */
|
|
2798
|
-
.kanban-drop-marker {
|
|
2799
|
-
height: 3px;
|
|
2800
|
-
margin: -5.5px 0;
|
|
2801
|
-
border-radius: 2px;
|
|
2802
|
-
background: var(--dpk-blue);
|
|
2803
|
-
box-shadow: 0 0 0 3px color-mix(in srgb, var(--dpk-blue) 22%, transparent);
|
|
2804
|
-
animation: dpk-drop-in 140ms var(--dpk-ease-spring) backwards;
|
|
2805
|
-
}
|
|
2806
|
-
|
|
2807
|
-
@keyframes dpk-drop-in {
|
|
2808
|
-
from {
|
|
2809
|
-
opacity: 0;
|
|
2810
|
-
transform: scaleX(0.4);
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
.kanban-add {
|
|
2815
|
-
display: flex;
|
|
2816
|
-
flex-direction: column;
|
|
2817
|
-
gap: 6px;
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
.kanban-add-button {
|
|
2821
|
-
padding: 6px 8px;
|
|
2822
|
-
border: 1px dashed var(--dpk-rule-strong);
|
|
2823
|
-
border-radius: var(--dpk-radius-sm);
|
|
2824
|
-
background: none;
|
|
2825
|
-
color: var(--dpk-ink-soft);
|
|
2826
|
-
font-family: var(--dpk-body);
|
|
2827
|
-
font-size: 12px;
|
|
2828
|
-
text-align: left;
|
|
2829
|
-
cursor: pointer;
|
|
2830
|
-
transition:
|
|
2831
|
-
border-color 140ms var(--dpk-ease),
|
|
2832
|
-
background 140ms var(--dpk-ease),
|
|
2833
|
-
color 140ms var(--dpk-ease);
|
|
2834
|
-
}
|
|
2835
|
-
|
|
2836
|
-
.kanban-add-button:hover,
|
|
2837
|
-
.kanban-add-button:focus-visible {
|
|
2838
|
-
border-color: color-mix(in srgb, var(--dpk-blue) 45%, var(--dpk-rule-strong));
|
|
2839
|
-
background: var(--dpk-paper-raised);
|
|
2840
|
-
color: var(--dpk-ink);
|
|
2841
|
-
outline: none;
|
|
2842
|
-
}
|
|
2843
|
-
|
|
2844
|
-
.kanban-add .dpk-input {
|
|
2845
|
-
width: 100%;
|
|
2846
|
-
font-size: 12.5px;
|
|
2847
|
-
}
|
|
2848
|
-
`;class xs extends De{static{this.styles=[W,ir]}#e=null;#s=null;#a=null;#t=null;#n=null;parseData(e){return ms(e)}emptyData(){return Jn()}reduceElementActions(e,t){return rr(ce(this.locale),e,t)}defaultHeading(){return ce(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return ce(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(t=>({value:this.commentRef("column",t.id),label:t.label})),...pe(e).map(t=>({value:this.commentRef("card",t.id),label:t.title}))]}hasSelection(e){const t=this.items();return e.kind==="column"?t.columns.some(s=>s.id===e.id):xe(t,e.id)!==void 0}tagItems(){return pe(this.items()).map(e=>e.tags)}statsText(){const e=ce(this.locale),t=pe(this.items()).length,s=pe(this.#r()).length;return s===t?`${t} ${e.cards}`:`${s} / ${t} ${e.cards}`}isEmpty(){return this.items().columns.length===0}viewAlign(){return"start"}contentSize(){if(this.isEmpty())return null;const e=this.renderRoot.querySelector(".kanban-board");return{width:e?.offsetWidth??0,height:e?.offsetHeight??0}}refreshContent(){const e=this.authoredItems();e!==this.#e&&(this.#e=e,this.#s=null,this.#a=null)}renderCanvas(){const e=this.#r(),t=new Map(this.items().columns.map(s=>[s.id,s.cards.length]));return h`<div class="kanban-board">
|
|
2849
|
-
${J(e.columns,s=>s.id,s=>this.#o(s,t.get(s.id)??0))}
|
|
2850
|
-
</div>`}#r(){const e=this.tagFilter;return Zn(this.items(),e.active.length===0?null:t=>Q(t.tags,e))}#i(e,t){const s=this.selection;return s!==null&&s.kind===e&&s.id===t}#o(e,t){const s=ce(this.locale),n=e.limit!==null&&t>e.limit,r=this.#n?.column===e.id?this.#n:null;return h`
|
|
2851
|
-
<section
|
|
2852
|
-
class=${ee("kanban-column",n&&"is-over",this.#i("column",e.id)&&"is-selected",r!==null&&"is-drop-target")}
|
|
2853
|
-
data-column=${e.id}
|
|
2854
|
-
data-color=${e.color??b}
|
|
2855
|
-
aria-label=${e.label}
|
|
2856
|
-
>
|
|
2857
|
-
<div class="kanban-column-head">
|
|
2858
|
-
<button
|
|
2859
|
-
type="button"
|
|
2860
|
-
class="kanban-column-title"
|
|
2861
|
-
aria-pressed=${this.#i("column",e.id)?"true":"false"}
|
|
2862
|
-
title=${e.description??e.label}
|
|
2863
|
-
@click=${()=>this.select({kind:"column",id:e.id})}
|
|
2864
|
-
>
|
|
2865
|
-
<span class="kanban-column-label">${e.label}</span>
|
|
2866
|
-
<span class="kanban-count" title=${e.limit===null?b:s.wipLimit(e.limit)}>
|
|
2867
|
-
${e.limit===null?t:`${t} / ${e.limit}`}
|
|
2868
|
-
</span>
|
|
2869
|
-
</button>
|
|
2870
|
-
${this.renderCommentTrigger({kind:"column",id:e.id},e.label)}
|
|
2871
|
-
</div>
|
|
2872
|
-
${e.description===null?b:h`<p class="kanban-column-description">${e.description}</p>`}
|
|
2873
|
-
<div
|
|
2874
|
-
class="kanban-cards"
|
|
2875
|
-
@dragover=${i=>this.#d(i,e.id)}
|
|
2876
|
-
@dragleave=${i=>this.#m(i)}
|
|
2877
|
-
@drop=${i=>this.#g(i,e.id)}
|
|
2878
|
-
>
|
|
2879
|
-
${J(e.cards,i=>i.id,i=>h`${r?.before===i.id?this.#c():b}${this.#u(i,s)}`)}
|
|
2880
|
-
${r!==null&&r.before===null?this.#c():b}
|
|
2881
|
-
</div>
|
|
2882
|
-
${this.#l(e,s)}
|
|
2883
|
-
</section>
|
|
2884
|
-
`}#c(){return h`<div class="kanban-drop-marker" aria-hidden="true"></div>`}#u(e,t){const s=this.#i("card",e.id);return h`
|
|
2885
|
-
<div class="kanban-card-slot">
|
|
2886
|
-
<div
|
|
2887
|
-
role="button"
|
|
2888
|
-
tabindex="0"
|
|
2889
|
-
draggable="true"
|
|
2890
|
-
class=${ee("kanban-card",s&&"is-selected",e.change==="added"&&"is-added",e.change==="moved"&&"is-moved",this.#t===e.id&&"is-dragging")}
|
|
2891
|
-
data-card=${e.id}
|
|
2892
|
-
data-grill-questions=${this.questionsOf(e)}
|
|
2893
|
-
title=${e.description??e.title}
|
|
2894
|
-
aria-pressed=${s?"true":"false"}
|
|
2895
|
-
@click=${()=>this.select({kind:"card",id:e.id})}
|
|
2896
|
-
@keydown=${n=>this.#p(n,e.id)}
|
|
2897
|
-
@dragstart=${n=>this.#f(n,e.id)}
|
|
2898
|
-
@dragend=${()=>this.#b()}
|
|
2899
|
-
>
|
|
2900
|
-
<span class="kanban-card-title">${e.title}</span>
|
|
2901
|
-
${e.description===null?b:h`<span class="kanban-card-description">${e.description}</span>`}
|
|
2902
|
-
${e.tags.length===0&&e.assignee===null?b:h`<span class="kanban-card-meta">
|
|
2903
|
-
${e.tags.map(n=>h`<span class="kanban-tag">${n}</span>`)}
|
|
2904
|
-
${e.assignee===null?b:h`<span class="kanban-assignee">${e.assignee}</span>`}
|
|
2905
|
-
</span>`}
|
|
2906
|
-
</div>
|
|
2907
|
-
${this.renderCommentTrigger({kind:"card",id:e.id},e.title)}
|
|
2908
|
-
${this.#a===e.id?h`<p class="kanban-error" role="alert">${t.notRecorded}</p>`:b}
|
|
2909
|
-
</div>
|
|
2910
|
-
`}#l(e,t){const s=this.#s?.column===e.id?this.#s:null;return h`<div class="kanban-add">
|
|
2911
|
-
${s===null?h`<button
|
|
2912
|
-
type="button"
|
|
2913
|
-
class="kanban-add-button"
|
|
2914
|
-
data-action="add"
|
|
2915
|
-
@click=${()=>this.#v(e.id)}
|
|
2916
|
-
>
|
|
2917
|
-
${t.addCardButton}
|
|
2918
|
-
</button>`:h`
|
|
2919
|
-
<input
|
|
2920
|
-
class="dpk-input"
|
|
2921
|
-
aria-label="${t.addCardAriaLabel(e.label)}"
|
|
2922
|
-
placeholder="${t.addCardPlaceholder}"
|
|
2923
|
-
.value=${s.title}
|
|
2924
|
-
@input=${n=>{const r=n.currentTarget;r instanceof HTMLInputElement&&(this.#s={...s,title:r.value,failed:!1})}}
|
|
2925
|
-
@keydown=${n=>this.#$(n,e.id)}
|
|
2926
|
-
/>
|
|
2927
|
-
${s.failed?h`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:b}
|
|
2928
|
-
`}
|
|
2929
|
-
</div>`}#p(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#h(e,t){const s=this.dispatchElementAction(fs,["card",e],{column:t.column,before:t.before});this.#a=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#f(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#k(e,t);this.#n?.column===s.column&&this.#n.before===s.before||(this.#n=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#n=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const n=this.#k(e,t);this.#b(),Qn(this.items(),s,n.column,n.before)||this.#h(s,n)}#b(){this.#t===null&&this.#n===null||(this.#t=null,this.#n=null,this.requestUpdate())}#k(e,t){const s=e.currentTarget,r=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(i=>{if(i.dataset.card===this.#t)return!1;const o=i.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:r?.dataset.card??null}}#v(e){this.#s={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#$(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#s=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#s?.title.trim()??"";if(s.length===0)return;const n=[...this.items().columns.map(i=>i.id),...pe(this.items()).map(i=>i.id)],r=Qe(`card ${s}`,n);if(!this.dispatchElementAction(gs,["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 vs=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",xs)},or=_({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),F=S(u(),Me(),M(1)),he=q({id:ne,text:F}),dr=Xe("kind",[q({kind:Z("proved"),assumptions:f(z(F))}),q({kind:Z("bounded"),bound:F}),q({kind:Z("incomplete"),gaps:f(z(F))}),q({kind:Z("planned")})]),lr=q({id:ne,target:f(ne),statement:F,subjects:f(z(he)),premises:f(z(he)),conclusions:S(z(he),M(1,"a claim needs at least one conclusion")),examples:f(z(he)),notClaimed:f(z(he)),assurance:dr,source:f(q({tool:f(F),ref:F}))}),cr=q({id:ne,name:F,meaning:F}),pr=q({id:ne,name:F,code:f(F),summary:f(F)}),hr=q({targets:f(z(pr)),terms:f(z(cr)),claims:z(lr)}),ur=()=>({targets:[],terms:[],claims:[]}),mr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,gr=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(mr)){const r=(n[1]??"").trim(),i=e.get(r);if(i===void 0)throw new Error(`unknown term reference: [[${r}]]`);n.index>s&&t.push({kind:"text",text:a.slice(s,n.index)}),t.push({kind:"term",id:r,label:n[2]?.trim()||i}),s=n.index+n[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Ue=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),fr=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],ve=(a,e)=>{const t=new Set;for(const s of a){if(t.has(s))throw new Error(`duplicate ${e} id: ${s}`);t.add(s)}},ys=a=>{const e=G(hr,a),t=e.targets??[],s=e.terms??[];ve(t.map(c=>c.id),"target"),ve(s.map(c=>c.id),"term"),ve(e.claims.map(c=>c.id),"claim");const n=new Map(s.map(c=>[c.id,c.name])),r=c=>gr(c,n),i=s.map(c=>({id:c.id,name:c.name,meaning:r(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:r(c.summary)})),d=new Set(o.map(c=>c.id)),l=e.claims.map(c=>{if(c.target!==void 0&&!d.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const g=T=>(T??[]).map(j=>({id:j.id,text:r(j.text)})),p=g(c.subjects),k=g(c.premises),x=g(c.conclusions),v=g(c.examples),y=g(c.notClaimed),w=[...p,...k,...x,...v,...y];ve(w.map(T=>T.id),`clause (in claim ${c.id})`);const D=br(c.assurance,r),L=r(c.statement);return{id:c.id,target:c.target??null,statement:L,subjects:p,premises:k,conclusions:x,examples:v,notClaimed:y,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:fr([L,...w.map(T=>T.text),...kr(D)])}});return{targets:o,terms:i,claims:l}},br=(a,e)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(e)};case"bounded":return{kind:"bounded",bound:e(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(e)};case"planned":return{kind:"planned"}}},kr=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},xr=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[ws(t.assurance)?"conditional":t.assurance.kind]+=1;return e},ws=a=>a.kind==="proved"&&a.assumptions.length>0,$s=a=>{const e=new Map(a.targets.map(s=>[s.id,s])),t=new Map;for(const s of a.claims)t.set(s.target,[...t.get(s.target)??[],s]);for(const s of a.targets)t.has(s.id)||t.set(s.id,[]);return[...t].map(([s,n])=>({target:s===null?null:e.get(s)??null,claims:n}))},ue=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},He=(a,e)=>{switch(e.kind){case"proved":return ws(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ue(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ue("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ue(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ue(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ue("",[])}}},vr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},yr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Ss=32,ye=a=>{const e=Ue(a.statement);return e.length<=Ss?e:`${e.slice(0,Ss).trimEnd()}\u2026`},wr=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...yr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ue(e.text)}`}))],$r=a=>$s(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(wr)]),Sr=[_e,Be,Ge,B`
|
|
2930
|
-
:host {
|
|
2931
|
-
display: block;
|
|
2932
|
-
container-type: inline-size;
|
|
2933
|
-
color: var(--dpk-ink);
|
|
2934
|
-
font-family: var(--dpk-body);
|
|
2935
|
-
}
|
|
2936
|
-
|
|
2937
|
-
.spec {
|
|
2938
|
-
display: grid;
|
|
2939
|
-
gap: 14px;
|
|
2940
|
-
}
|
|
2941
|
-
|
|
2942
|
-
/* ----------------------------------------------------------- toolbar */
|
|
2943
|
-
|
|
2944
|
-
.spec-toolbar {
|
|
2945
|
-
display: flex;
|
|
2946
|
-
flex-wrap: wrap;
|
|
2947
|
-
align-items: baseline;
|
|
2948
|
-
gap: 4px 10px;
|
|
2949
|
-
padding: 0 2px 10px;
|
|
2950
|
-
border-bottom: 1px solid var(--dpk-rule);
|
|
2951
|
-
}
|
|
2952
|
-
|
|
2953
|
-
.spec-title {
|
|
2954
|
-
font-family: var(--dpk-display);
|
|
2955
|
-
font-size: 14px;
|
|
2956
|
-
font-weight: 650;
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
|
-
.spec-subject {
|
|
2960
|
-
color: var(--dpk-ink-soft);
|
|
2961
|
-
font-size: 12.5px;
|
|
2962
|
-
}
|
|
2963
|
-
|
|
2964
|
-
.spec-stats {
|
|
2965
|
-
display: inline-flex;
|
|
2966
|
-
flex-wrap: wrap;
|
|
2967
|
-
align-items: center;
|
|
2968
|
-
gap: 6px;
|
|
2969
|
-
margin-left: auto;
|
|
2970
|
-
color: var(--dpk-ink-faint);
|
|
2971
|
-
font-size: 12px;
|
|
2972
|
-
}
|
|
2973
|
-
|
|
2974
|
-
.spec-chip {
|
|
2975
|
-
padding: 1px 8px;
|
|
2976
|
-
border-radius: 999px;
|
|
2977
|
-
font-weight: 600;
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
.spec-notice,
|
|
2981
|
-
.spec-empty {
|
|
2982
|
-
margin: 0;
|
|
2983
|
-
padding: 14px;
|
|
2984
|
-
border-radius: var(--dpk-radius);
|
|
2985
|
-
font-size: 12.5px;
|
|
2986
|
-
}
|
|
2987
|
-
|
|
2988
|
-
.spec-notice {
|
|
2989
|
-
background: var(--dpk-danger-soft);
|
|
2990
|
-
color: var(--dpk-danger);
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
.spec-empty {
|
|
2994
|
-
color: var(--dpk-ink-faint);
|
|
2995
|
-
text-align: center;
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
/* ------------------------------------------------------------ tones */
|
|
2999
|
-
|
|
3000
|
-
[data-tone='sound'] {
|
|
3001
|
-
--tone: var(--dpk-green);
|
|
3002
|
-
--tone-soft: var(--dpk-green-soft);
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
[data-tone='caveat'] {
|
|
3006
|
-
--tone: var(--dpk-amber);
|
|
3007
|
-
--tone-soft: var(--dpk-amber-soft);
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
[data-tone='unsound'] {
|
|
3011
|
-
--tone: var(--dpk-danger);
|
|
3012
|
-
--tone-soft: var(--dpk-danger-soft);
|
|
3013
|
-
}
|
|
3014
|
-
|
|
3015
|
-
[data-tone='planned'] {
|
|
3016
|
-
--tone: var(--dpk-blue);
|
|
3017
|
-
--tone-soft: var(--dpk-blue-soft);
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
.spec-chip,
|
|
3021
|
-
.assurance-badge {
|
|
3022
|
-
background: var(--tone-soft);
|
|
3023
|
-
color: var(--tone);
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
|
-
/* ----------------------------------------------------------- targets */
|
|
3027
|
-
|
|
3028
|
-
.spec-groups {
|
|
3029
|
-
display: grid;
|
|
3030
|
-
gap: 28px;
|
|
3031
|
-
}
|
|
3032
|
-
|
|
3033
|
-
.target-group {
|
|
3034
|
-
display: grid;
|
|
3035
|
-
gap: 12px;
|
|
3036
|
-
}
|
|
3037
|
-
|
|
3038
|
-
.target-head {
|
|
3039
|
-
display: flex;
|
|
3040
|
-
flex-wrap: wrap;
|
|
3041
|
-
align-items: baseline;
|
|
3042
|
-
gap: 4px 10px;
|
|
3043
|
-
}
|
|
3044
|
-
|
|
3045
|
-
.target-label {
|
|
3046
|
-
color: var(--dpk-ink-faint);
|
|
3047
|
-
font-size: 11.5px;
|
|
3048
|
-
font-weight: 650;
|
|
3049
|
-
letter-spacing: 0.04em;
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
.target-name {
|
|
3053
|
-
margin: 0;
|
|
3054
|
-
font-family: var(--dpk-display);
|
|
3055
|
-
font-size: 17px;
|
|
3056
|
-
font-weight: 700;
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
.target-code {
|
|
3060
|
-
padding: 1px 7px;
|
|
3061
|
-
border: 1px solid var(--dpk-rule);
|
|
3062
|
-
border-radius: var(--dpk-radius-sm);
|
|
3063
|
-
background: var(--dpk-paper-sunken);
|
|
3064
|
-
color: var(--dpk-ink-soft);
|
|
3065
|
-
font-family: var(--dpk-mono);
|
|
3066
|
-
font-size: 12px;
|
|
3067
|
-
}
|
|
3068
|
-
|
|
3069
|
-
.target-head .comment-trigger {
|
|
3070
|
-
align-self: center;
|
|
3071
|
-
margin-left: auto;
|
|
3072
|
-
}
|
|
3073
|
-
|
|
3074
|
-
.target-summary {
|
|
3075
|
-
margin: -4px 0 0;
|
|
3076
|
-
color: var(--dpk-ink-soft);
|
|
3077
|
-
font-size: 13.5px;
|
|
3078
|
-
line-height: 1.7;
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
/* ------------------------------------------------------------ claims */
|
|
3082
|
-
|
|
3083
|
-
.spec-claims {
|
|
3084
|
-
display: grid;
|
|
3085
|
-
gap: 8px;
|
|
3086
|
-
}
|
|
3087
|
-
|
|
3088
|
-
.claim {
|
|
3089
|
-
padding: 10px 14px 10px 8px;
|
|
3090
|
-
border: 1px solid var(--dpk-rule);
|
|
3091
|
-
border-left: 4px solid var(--tone);
|
|
3092
|
-
border-radius: var(--dpk-radius-lg);
|
|
3093
|
-
background: var(--dpk-paper-raised);
|
|
3094
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
/* Folded, the head row is the whole card: the statement and how strongly it holds. */
|
|
3098
|
-
.claim-head {
|
|
3099
|
-
display: flex;
|
|
3100
|
-
align-items: flex-start;
|
|
3101
|
-
gap: 8px;
|
|
3102
|
-
cursor: pointer;
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
.claim-toggle {
|
|
3106
|
-
display: grid;
|
|
3107
|
-
flex: none;
|
|
3108
|
-
place-items: center;
|
|
3109
|
-
width: 24px;
|
|
3110
|
-
height: 24px;
|
|
3111
|
-
margin-top: 1px;
|
|
3112
|
-
padding: 0;
|
|
3113
|
-
border: none;
|
|
3114
|
-
border-radius: var(--dpk-radius);
|
|
3115
|
-
background: transparent;
|
|
3116
|
-
color: var(--dpk-ink-faint);
|
|
3117
|
-
cursor: pointer;
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3120
|
-
.claim-toggle svg {
|
|
3121
|
-
width: 14px;
|
|
3122
|
-
height: 14px;
|
|
3123
|
-
transition: transform 120ms ease;
|
|
3124
|
-
}
|
|
3125
|
-
|
|
3126
|
-
.claim-toggle[aria-expanded='true'] svg {
|
|
3127
|
-
transform: rotate(90deg);
|
|
3128
|
-
}
|
|
3129
|
-
|
|
3130
|
-
.claim-toggle:hover,
|
|
3131
|
-
.claim-toggle:focus-visible {
|
|
3132
|
-
background: var(--dpk-paper-sunken);
|
|
3133
|
-
color: var(--dpk-ink);
|
|
3134
|
-
}
|
|
3135
|
-
|
|
3136
|
-
.claim-body {
|
|
3137
|
-
display: grid;
|
|
3138
|
-
gap: 14px;
|
|
3139
|
-
margin: 12px 0 6px 32px;
|
|
3140
|
-
}
|
|
3141
|
-
|
|
3142
|
-
/* The badge explains itself in a tooltip, so it is a button that hover, focus or a tap opens. */
|
|
3143
|
-
.assurance-badge {
|
|
3144
|
-
flex: none;
|
|
3145
|
-
margin-top: 2px;
|
|
3146
|
-
padding: 2px 10px;
|
|
3147
|
-
border: none;
|
|
3148
|
-
border-radius: 999px;
|
|
3149
|
-
font: inherit;
|
|
3150
|
-
font-size: 11.5px;
|
|
3151
|
-
font-weight: 650;
|
|
3152
|
-
white-space: nowrap;
|
|
3153
|
-
cursor: help;
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
.assurance-badge:focus-visible {
|
|
3157
|
-
outline: 2px solid var(--tone);
|
|
3158
|
-
outline-offset: 2px;
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
.claim-head .comment-trigger {
|
|
3162
|
-
margin-left: auto;
|
|
3163
|
-
}
|
|
3164
|
-
|
|
3165
|
-
.claim-statement {
|
|
3166
|
-
flex: 1;
|
|
3167
|
-
margin: 0;
|
|
3168
|
-
font-size: 14.5px;
|
|
3169
|
-
line-height: 1.65;
|
|
3170
|
-
font-weight: 500;
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
|
-
/* Subjects / premises / conclusions: the structure of the claim, one row per part. */
|
|
3174
|
-
.claim-parts {
|
|
3175
|
-
display: grid;
|
|
3176
|
-
grid-template-columns: max-content 1fr;
|
|
3177
|
-
margin: 0;
|
|
3178
|
-
border: 1px solid var(--dpk-rule);
|
|
3179
|
-
border-radius: var(--dpk-radius);
|
|
3180
|
-
background: var(--dpk-paper-sunken);
|
|
3181
|
-
overflow: hidden;
|
|
3182
|
-
}
|
|
3183
|
-
|
|
3184
|
-
.claim-part {
|
|
3185
|
-
display: contents;
|
|
3186
|
-
}
|
|
3187
|
-
|
|
3188
|
-
.claim-part > dt,
|
|
3189
|
-
.claim-part > dd {
|
|
3190
|
-
margin: 0;
|
|
3191
|
-
padding: 9px 12px;
|
|
3192
|
-
border-top: 1px solid var(--dpk-rule);
|
|
3193
|
-
}
|
|
3194
|
-
|
|
3195
|
-
.claim-part:first-child > dt,
|
|
3196
|
-
.claim-part:first-child > dd {
|
|
3197
|
-
border-top: none;
|
|
3198
|
-
}
|
|
3199
|
-
|
|
3200
|
-
.claim-part > dt {
|
|
3201
|
-
color: var(--dpk-ink-soft);
|
|
3202
|
-
font-size: 11.5px;
|
|
3203
|
-
font-weight: 650;
|
|
3204
|
-
letter-spacing: 0.04em;
|
|
3205
|
-
padding-top: 11px;
|
|
3206
|
-
}
|
|
3207
|
-
|
|
3208
|
-
/* The conclusion is what the claim asserts: its label reads strongest. */
|
|
3209
|
-
.claim-part[data-part='conclusions'] > dt {
|
|
3210
|
-
color: var(--dpk-ink);
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
.claim-none {
|
|
3214
|
-
margin: 0;
|
|
3215
|
-
color: var(--dpk-ink-faint);
|
|
3216
|
-
font-size: 13px;
|
|
3217
|
-
}
|
|
3218
|
-
|
|
3219
|
-
.clauses {
|
|
3220
|
-
display: grid;
|
|
3221
|
-
gap: 2px;
|
|
3222
|
-
margin: 0;
|
|
3223
|
-
padding: 0;
|
|
3224
|
-
list-style: none;
|
|
3225
|
-
}
|
|
3226
|
-
|
|
3227
|
-
.clause {
|
|
3228
|
-
position: relative;
|
|
3229
|
-
display: flex;
|
|
3230
|
-
align-items: flex-start;
|
|
3231
|
-
gap: 6px;
|
|
3232
|
-
min-height: 28px;
|
|
3233
|
-
padding: 2px 0 2px 14px;
|
|
3234
|
-
font-size: 13.5px;
|
|
3235
|
-
line-height: 1.7;
|
|
3236
|
-
}
|
|
3237
|
-
|
|
3238
|
-
.clause::before {
|
|
3239
|
-
content: '';
|
|
3240
|
-
position: absolute;
|
|
3241
|
-
left: 2px;
|
|
3242
|
-
top: 0.95em;
|
|
3243
|
-
width: 5px;
|
|
3244
|
-
height: 5px;
|
|
3245
|
-
border-radius: 50%;
|
|
3246
|
-
background: var(--dpk-ink-faint);
|
|
3247
|
-
}
|
|
3248
|
-
|
|
3249
|
-
.clause-text {
|
|
3250
|
-
flex: 1;
|
|
3251
|
-
min-width: 0;
|
|
3252
|
-
overflow-wrap: anywhere;
|
|
3253
|
-
}
|
|
3254
|
-
|
|
3255
|
-
/* ---------------------------------------------------------- assurance */
|
|
3256
|
-
|
|
3257
|
-
.assurance {
|
|
3258
|
-
padding: 10px 14px;
|
|
3259
|
-
border-radius: var(--dpk-radius);
|
|
3260
|
-
background: var(--tone-soft);
|
|
3261
|
-
font-size: 12.5px;
|
|
3262
|
-
line-height: 1.6;
|
|
3263
|
-
}
|
|
3264
|
-
|
|
3265
|
-
.assurance-label {
|
|
3266
|
-
margin: 0;
|
|
3267
|
-
color: var(--tone);
|
|
3268
|
-
font-weight: 650;
|
|
3269
|
-
}
|
|
3270
|
-
|
|
3271
|
-
.assurance ul {
|
|
3272
|
-
margin: 4px 0 0;
|
|
3273
|
-
padding-left: 18px;
|
|
3274
|
-
color: var(--dpk-ink);
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
|
-
/* ---------------------------------------------------- examples / not */
|
|
3278
|
-
|
|
3279
|
-
.claim-aside h5 {
|
|
3280
|
-
margin: 0 0 2px;
|
|
3281
|
-
color: var(--dpk-ink-soft);
|
|
3282
|
-
font-size: 11.5px;
|
|
3283
|
-
font-weight: 650;
|
|
3284
|
-
letter-spacing: 0.04em;
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
.claim-aside[data-part='not-claimed'] {
|
|
3288
|
-
padding: 10px 14px;
|
|
3289
|
-
border: 1px dashed var(--dpk-rule-strong);
|
|
3290
|
-
border-radius: var(--dpk-radius);
|
|
3291
|
-
}
|
|
3292
|
-
|
|
3293
|
-
.claim-aside[data-part='not-claimed'] .clause::before {
|
|
3294
|
-
content: '×';
|
|
3295
|
-
left: 0;
|
|
3296
|
-
top: 0;
|
|
3297
|
-
width: auto;
|
|
3298
|
-
height: auto;
|
|
3299
|
-
border-radius: 0;
|
|
3300
|
-
background: none;
|
|
3301
|
-
color: var(--dpk-ink-faint);
|
|
3302
|
-
font-weight: 700;
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
.claim-aside[data-part='not-claimed'] .clause-text {
|
|
3306
|
-
color: var(--dpk-ink-soft);
|
|
3307
|
-
}
|
|
3308
|
-
|
|
3309
|
-
/* ------------------------------------------------------------- footer */
|
|
3310
|
-
|
|
3311
|
-
.claim-foot {
|
|
3312
|
-
display: flex;
|
|
3313
|
-
flex-wrap: wrap;
|
|
3314
|
-
align-items: center;
|
|
3315
|
-
gap: 6px 8px;
|
|
3316
|
-
padding-top: 10px;
|
|
3317
|
-
border-top: 1px solid var(--dpk-rule);
|
|
3318
|
-
color: var(--dpk-ink-faint);
|
|
3319
|
-
font-size: 11.5px;
|
|
3320
|
-
}
|
|
3321
|
-
|
|
3322
|
-
.claim-foot-label {
|
|
3323
|
-
font-weight: 650;
|
|
3324
|
-
}
|
|
3325
|
-
|
|
3326
|
-
.term-chip {
|
|
3327
|
-
padding: 1px 9px;
|
|
3328
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
3329
|
-
border-radius: 999px;
|
|
3330
|
-
background: var(--dpk-paper);
|
|
3331
|
-
color: var(--dpk-ink-soft);
|
|
3332
|
-
font: inherit;
|
|
3333
|
-
cursor: help;
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
|
-
.term-chip:is(:hover, :focus-visible) {
|
|
3337
|
-
border-color: var(--dpk-violet);
|
|
3338
|
-
color: var(--dpk-violet);
|
|
3339
|
-
}
|
|
3340
|
-
|
|
3341
|
-
.claim-source {
|
|
3342
|
-
margin-left: auto;
|
|
3343
|
-
}
|
|
3344
|
-
|
|
3345
|
-
.claim-source code {
|
|
3346
|
-
font-family: var(--dpk-mono);
|
|
3347
|
-
font-size: 11px;
|
|
3348
|
-
}
|
|
3349
|
-
|
|
3350
|
-
/* -------------------------------------------------------------- terms */
|
|
3351
|
-
|
|
3352
|
-
.term {
|
|
3353
|
-
display: inline;
|
|
3354
|
-
padding: 0 1px;
|
|
3355
|
-
border: none;
|
|
3356
|
-
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
3357
|
-
background: none;
|
|
3358
|
-
color: inherit;
|
|
3359
|
-
font: inherit;
|
|
3360
|
-
font-weight: 600;
|
|
3361
|
-
cursor: help;
|
|
3362
|
-
}
|
|
3363
|
-
|
|
3364
|
-
.term:hover,
|
|
3365
|
-
.term:focus-visible {
|
|
3366
|
-
background: var(--dpk-violet-soft);
|
|
3367
|
-
outline: none;
|
|
3368
|
-
}
|
|
3369
|
-
|
|
3370
|
-
/* ----------------------------------------------------------- tooltip */
|
|
3371
|
-
|
|
3372
|
-
/* Sized to its text: the popover helper sets a fixed width, which only !important overrides. */
|
|
3373
|
-
.spec-tip {
|
|
3374
|
-
box-sizing: border-box;
|
|
3375
|
-
position: fixed;
|
|
3376
|
-
inset: auto;
|
|
3377
|
-
width: max-content !important;
|
|
3378
|
-
max-width: min(300px, calc(100vw - 16px));
|
|
3379
|
-
margin: 0;
|
|
3380
|
-
padding: 8px 11px;
|
|
3381
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
3382
|
-
border-radius: var(--dpk-radius);
|
|
3383
|
-
background: var(--dpk-paper-raised);
|
|
3384
|
-
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
3385
|
-
color: var(--dpk-ink);
|
|
3386
|
-
font-size: 12.5px;
|
|
3387
|
-
line-height: 1.6;
|
|
3388
|
-
pointer-events: none;
|
|
3389
|
-
}
|
|
3390
|
-
|
|
3391
|
-
.spec-tip p {
|
|
3392
|
-
margin: 0;
|
|
3393
|
-
}
|
|
3394
|
-
|
|
3395
|
-
.tip-title {
|
|
3396
|
-
color: var(--dpk-violet);
|
|
3397
|
-
font-weight: 650;
|
|
3398
|
-
}
|
|
3399
|
-
|
|
3400
|
-
.spec-tip[data-tone] .tip-title {
|
|
3401
|
-
color: var(--tone);
|
|
3402
|
-
}
|
|
3403
|
-
|
|
3404
|
-
.term-static {
|
|
3405
|
-
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
3406
|
-
font-weight: 600;
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
|
-
@container (max-width: 520px) {
|
|
3410
|
-
.claim-parts {
|
|
3411
|
-
grid-template-columns: 1fr;
|
|
3412
|
-
}
|
|
3413
|
-
|
|
3414
|
-
.claim-part > dd {
|
|
3415
|
-
border-top: none;
|
|
3416
|
-
padding-top: 0;
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
/* ---------------------------------------------------------- comments */
|
|
3421
|
-
|
|
3422
|
-
.comment-trigger {
|
|
3423
|
-
flex: none;
|
|
3424
|
-
display: grid;
|
|
3425
|
-
place-items: center;
|
|
3426
|
-
width: 24px;
|
|
3427
|
-
height: 24px;
|
|
3428
|
-
padding: 4px;
|
|
3429
|
-
border: 1px solid var(--dpk-rule-strong);
|
|
3430
|
-
border-radius: var(--dpk-radius-sm);
|
|
3431
|
-
background: var(--dpk-paper-raised);
|
|
3432
|
-
color: var(--dpk-ink-soft);
|
|
3433
|
-
cursor: pointer;
|
|
3434
|
-
opacity: 0;
|
|
3435
|
-
transition: opacity 120ms ease;
|
|
3436
|
-
}
|
|
3437
|
-
|
|
3438
|
-
.comment-trigger svg {
|
|
3439
|
-
width: 14px;
|
|
3440
|
-
height: 14px;
|
|
3441
|
-
}
|
|
3442
|
-
|
|
3443
|
-
:is(.target-head, .claim-head, .clause):is(:hover, :focus-within) > .comment-trigger,
|
|
3444
|
-
.comment-trigger[aria-expanded='true'] {
|
|
3445
|
-
opacity: 1;
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
.comment-trigger:hover,
|
|
3449
|
-
.comment-trigger:focus-visible {
|
|
3450
|
-
border-color: var(--dpk-accent);
|
|
3451
|
-
background: var(--dpk-accent-soft);
|
|
3452
|
-
color: var(--dpk-accent);
|
|
3453
|
-
outline: none;
|
|
3454
|
-
}
|
|
3455
|
-
|
|
3456
|
-
@media (hover: none) {
|
|
3457
|
-
.comment-trigger {
|
|
3458
|
-
opacity: 1;
|
|
3459
|
-
}
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
.comment-target {
|
|
3463
|
-
font-size: 12px;
|
|
3464
|
-
overflow-wrap: anywhere;
|
|
3465
|
-
}
|
|
3466
|
-
|
|
3467
|
-
.comment-error {
|
|
3468
|
-
margin: 0;
|
|
3469
|
-
font-size: 11px;
|
|
3470
|
-
color: var(--dpk-accent);
|
|
3471
|
-
}
|
|
3472
|
-
`],Ms=a=>`claim-body-${a}`;class Cs extends Ye{static{this.styles=Sr}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=new Map;#a=null;#t=null;#n="";#r=null;#i=null;#o=new Map;#c=null;#u=new Set;#l=null;#p=null;#h=new Ve(this);#f=new We(this,()=>{this.#n=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#n="",document.addEventListener("keydown",this.#w),document.addEventListener("pointerdown",this.#S),this.#t=rt(this,ys,e=>{e.ok?this.#g(e.value):this.#b(e.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#w),document.removeEventListener("pointerdown",this.#S),this.#t?.(),this.#t=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#v(),this.#$(),this.#L()}get commentTargets(){if(!this.id||this.#e===null)return[];const e=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return $r(this.#e).map(({target:t,label:s})=>({value:this.#k(t),label:s,group:e}))}get dataError(){return this.#a}get#d(){return or(this.#f.locale)}#m(){return this.#e??ur()}#g(e){this.#e=e,this.#s=new Map(e.terms.map(t=>[t.id,t])),this.#a=null,this.requestUpdate()}#b(e){this.#e=null,this.#s=new Map,this.#a=e,console.error("[dev-process-kit] invalid formal spec data:",e),this.requestUpdate()}#k(e){return`element:${[this.id,...vr(e)].map(t=>encodeURIComponent(t)).join("/")}`}#v(){const e=JSON.stringify(this.commentTargets);e!==this.#n&&(this.#n=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#$(){const e=this.#i!==this.#r;this.#i=this.#r;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#M(this.#r);!t||!s||(this.#h.open(t,s,{width:300,height:280},{placement:"right-start"}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}#M(e){return e===null?null:[...this.renderRoot.querySelectorAll("[data-comment-ref]")].find(t=>t.dataset.commentRef===e)??null}#A(e,t){if(t.kind==="input"){this.#o=new Map(this.#o).set(e,t.body),this.#c=null,this.requestUpdate();return}if(t.kind==="comment"){if(!!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t.body},bubbles:!0,composed:!0,cancelable:!0}))){this.#c=e,this.requestUpdate();return}const r=new Map(this.#o);r.delete(e),this.#o=r}this.#c=null;const s=this.#M(e);this.#r=null,this.requestUpdate(),s?.focus({preventScroll:!0})}#C(e){const t=new Set(this.#u);if(t.delete(e)||t.add(e),this.#u=t,!t.has(e)){const s=this.#k({kind:"clause",claim:e,clause:""});this.#r?.startsWith(s)&&(this.#r=null);const n=this.#l?.anchor;n?.closest(".claim-body")?.id===Ms(e)&&this.#x(n)}this.requestUpdate()}#E(e,t){const s=e.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#C(t)}#L(){const e=this.#l?.anchor??null,t=this.#p!==e;t&&(this.#p?.removeAttribute("aria-describedby"),e?.setAttribute("aria-describedby","spec-tip")),this.#p=e;const s=this.renderRoot.querySelector(".spec-tip");!s||!e||!t||this.#h.open(s,e,{width:300,height:240},{placement:"top-start"})}#q(e,t){this.#l?.anchor!==t&&(this.#l={tip:e,anchor:t},this.requestUpdate())}#x(e){this.#l===null||e!==void 0&&this.#l.anchor!==e||(this.#l=null,this.requestUpdate())}#w=e=>{e.key==="Escape"&&this.#x()};#S=e=>{this.#l!==null&&!e.composedPath().includes(this.#l.anchor)&&this.#x()};#z(e){const t=(n,r)=>{n.currentTarget instanceof HTMLElement&&r(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&t(n,r=>this.#q(e,r)),leave:n=>s(n)&&t(n,r=>this.#x(r)),show:n=>t(n,r=>this.#q(e,r)),hide:n=>t(n,r=>this.#x(r))}}render(){const e=this.#d,t=this.#m();return h`
|
|
3473
|
-
<section class="spec">
|
|
3474
|
-
<header class="spec-toolbar">
|
|
3475
|
-
<span class="spec-title">${this.heading??e.heading}</span>
|
|
3476
|
-
${this.subject?h`<span class="spec-subject">${this.subject}</span>`:b}
|
|
3477
|
-
<span class="spec-stats">${this.#R(t)}</span>
|
|
3478
|
-
</header>
|
|
3479
|
-
${this.#a===null?b:h`<p class="spec-notice" role="alert">${e.dataError}<br />${this.#a}</p>`}
|
|
3480
|
-
${this.#a===null&&t.claims.length===0?h`<p class="spec-empty">${e.empty}</p>`:b}
|
|
3481
|
-
<div class="spec-groups">
|
|
3482
|
-
${J($s(t),s=>s.target?.id??"",s=>this.#y(s))}
|
|
3483
|
-
</div>
|
|
3484
|
-
</section>
|
|
3485
|
-
${this.#H()} ${this.#B()}
|
|
3486
|
-
`}#R(e){const t=this.#d,s=xr(e),n=[{tone:"unsound",label:t.incomplete,count:s.incomplete},{tone:"caveat",label:t.bounded,count:s.bounded},{tone:"caveat",label:t.conditional,count:s.conditional},{tone:"planned",label:t.planned,count:s.planned}].filter(r=>r.count>0);return h`${t.claims(e.claims.length)}
|
|
3487
|
-
${n.map(r=>h`<span class="spec-chip" data-tone=${r.tone}>${r.label} ${r.count}</span>`)}`}#y(e){const t=h`<div class="spec-claims">
|
|
3488
|
-
${J(e.claims,n=>n.id,n=>this.#D(n))}
|
|
3489
|
-
</div>`,s=e.target;return s===null?t:h`<section class="target-group" data-target=${s.id}>
|
|
3490
|
-
<header class="target-head">
|
|
3491
|
-
<span class="target-label">${this.#d.target}</span>
|
|
3492
|
-
<h3 class="target-name">${s.name}</h3>
|
|
3493
|
-
${s.code===null?b:h`<code class="target-code">${s.code}</code>`}
|
|
3494
|
-
${this.#P({kind:"target",target:s.id},s.name)}
|
|
3495
|
-
</header>
|
|
3496
|
-
${s.summary===null?b:h`<p class="target-summary">${this.#T(s.summary)}</p>`}
|
|
3497
|
-
${e.claims.length===0?h`<p class="spec-empty">${this.#d.noClaims}</p>`:t}
|
|
3498
|
-
</section>`}#D(e){const t=this.#d,s=He(t,e.assurance),n=this.#u.has(e.id),r=this.#z({kind:"assurance",claim:e.id}),i=Ms(e.id);return h`
|
|
3499
|
-
<article class="claim" data-claim=${e.id} data-tone=${s.tone}>
|
|
3500
|
-
<div class="claim-head" @click=${o=>this.#E(o,e.id)}>
|
|
3501
|
-
<button
|
|
3502
|
-
type="button"
|
|
3503
|
-
class="claim-toggle"
|
|
3504
|
-
aria-expanded=${n?"true":"false"}
|
|
3505
|
-
aria-controls=${n?i:b}
|
|
3506
|
-
aria-label=${n?t.hideDetails:t.showDetails}
|
|
3507
|
-
@click=${()=>this.#C(e.id)}
|
|
3508
|
-
>
|
|
3509
|
-
${Ze()}
|
|
3510
|
-
</button>
|
|
3511
|
-
<h4 class="claim-statement">${this.#T(e.statement)}</h4>
|
|
3512
|
-
<button
|
|
3513
|
-
type="button"
|
|
3514
|
-
class="assurance-badge"
|
|
3515
|
-
data-tone=${s.tone}
|
|
3516
|
-
@pointerenter=${r.enter}
|
|
3517
|
-
@pointerleave=${r.leave}
|
|
3518
|
-
@focus=${r.show}
|
|
3519
|
-
@blur=${r.hide}
|
|
3520
|
-
@click=${r.show}
|
|
3521
|
-
>
|
|
3522
|
-
${s.label}
|
|
3523
|
-
</button>
|
|
3524
|
-
${this.#P({kind:"claim",claim:e.id},ye(e))}
|
|
3525
|
-
</div>
|
|
3526
|
-
${n?this.#F(e,i):b}
|
|
3527
|
-
</article>
|
|
3528
|
-
`}#F(e,t){const s=this.#d,n=He(s,e.assurance);return h`<div class="claim-body" id=${t}>
|
|
3529
|
-
<dl class="claim-parts">
|
|
3530
|
-
${e.subjects.length===0?b:this.#O("subjects",s.subjects,e,e.subjects)}
|
|
3531
|
-
${e.premises.length===0?h`<div class="claim-part" data-part="premises">
|
|
3532
|
-
<dt>${s.premises}</dt>
|
|
3533
|
-
<dd><p class="claim-none">${s.noPremises}</p></dd>
|
|
3534
|
-
</div>`:this.#O("premises",s.premises,e,e.premises)}
|
|
3535
|
-
${this.#O("conclusions",s.conclusions,e,e.conclusions)}
|
|
3536
|
-
</dl>
|
|
3537
|
-
${n.itemsLabel===null?b:h`<div class="assurance" data-tone=${n.tone}>
|
|
3538
|
-
<p class="assurance-label">${n.itemsLabel}</p>
|
|
3539
|
-
<ul>
|
|
3540
|
-
${n.items.map(r=>h`<li>${this.#T(r)}</li>`)}
|
|
3541
|
-
</ul>
|
|
3542
|
-
</div>`}
|
|
3543
|
-
${e.examples.length===0?b:h`<section class="claim-aside" data-part="examples">
|
|
3544
|
-
<h5>${s.examples}</h5>
|
|
3545
|
-
${this.#I(e,e.examples)}
|
|
3546
|
-
</section>`}
|
|
3547
|
-
${e.notClaimed.length===0?b:h`<section class="claim-aside" data-part="not-claimed">
|
|
3548
|
-
<h5>${s.notClaimed}</h5>
|
|
3549
|
-
${this.#I(e,e.notClaimed)}
|
|
3550
|
-
</section>`}
|
|
3551
|
-
${this.#N(e)}
|
|
3552
|
-
</div>`}#O(e,t,s,n){return h`<div class="claim-part" data-part=${e}>
|
|
3553
|
-
<dt>${t}</dt>
|
|
3554
|
-
<dd>${this.#I(s,n)}</dd>
|
|
3555
|
-
</div>`}#I(e,t){return h`<ul class="clauses">
|
|
3556
|
-
${J(t,s=>s.id,s=>h`<li class="clause" data-clause=${s.id}>
|
|
3557
|
-
<span class="clause-text">${this.#T(s.text)}</span>
|
|
3558
|
-
${this.#P({kind:"clause",claim:e.id,clause:s.id},`${ye(e)} \u203A ${Ue(s.text)}`)}
|
|
3559
|
-
</li>`)}
|
|
3560
|
-
</ul>`}#N(e){const t=this.#d,s=e.terms.flatMap(n=>this.#s.get(n)??[]);return s.length===0&&e.source===null?b:h`<footer class="claim-foot">
|
|
3561
|
-
${s.length===0?b:h`<span class="claim-foot-label">${t.usesTerms}</span> ${s.map(n=>this.#j("term-chip",n.id,n.name))}`}
|
|
3562
|
-
${e.source===null?b:h`<span class="claim-source"
|
|
3563
|
-
>${t.source}: ${e.source.tool===null?b:h`${e.source.tool} · `}<code
|
|
3564
|
-
>${e.source.ref}</code
|
|
3565
|
-
></span
|
|
3566
|
-
>`}
|
|
3567
|
-
</footer>`}#T(e){return h`${e.map(t=>t.kind==="text"?t.text:this.#j("term",t.id,t.label))}`}#U(e){return h`${e.map(t=>t.kind==="text"?t.text:h`<span class="term-static">${t.label}</span>`)}`}#j(e,t,s){const n=this.#z({kind:"term",term:t});return h`<button
|
|
3568
|
-
type="button"
|
|
3569
|
-
class=${e}
|
|
3570
|
-
data-term=${t}
|
|
3571
|
-
@pointerenter=${n.enter}
|
|
3572
|
-
@pointerleave=${n.leave}
|
|
3573
|
-
@focus=${n.show}
|
|
3574
|
-
@blur=${n.hide}
|
|
3575
|
-
@click=${n.show}
|
|
3576
|
-
>
|
|
3577
|
-
${s}
|
|
3578
|
-
</button>`}#H(){const e=this.#l?.tip;if(e===void 0)return b;const t=this.#_(e);return t===null?b:h`<div
|
|
3579
|
-
id="spec-tip"
|
|
3580
|
-
class="spec-tip"
|
|
3581
|
-
role="tooltip"
|
|
3582
|
-
popover="manual"
|
|
3583
|
-
data-tone=${t.tone??b}
|
|
3584
|
-
>
|
|
3585
|
-
<p class="tip-title">${t.title}</p>
|
|
3586
|
-
<p class="tip-body">${t.body}</p>
|
|
3587
|
-
</div>`}#_(e){if(e.kind==="term"){const n=this.#s.get(e.term);return n===void 0?null:{title:n.name,body:this.#U(n.meaning)}}const t=this.#e?.claims.find(n=>n.id===e.claim);if(t===void 0)return null;const s=He(this.#d,t.assurance);return{title:s.label,body:s.detail,tone:s.tone}}#P(e,t){if(!this.id)return b;const s=this.#k(e),n=this.#d.commentOn(t);return h`<button
|
|
3588
|
-
type="button"
|
|
3589
|
-
class="comment-trigger"
|
|
3590
|
-
data-comment-ref=${s}
|
|
3591
|
-
aria-label=${n}
|
|
3592
|
-
title=${n}
|
|
3593
|
-
aria-haspopup="dialog"
|
|
3594
|
-
aria-expanded=${this.#r===s?"true":"false"}
|
|
3595
|
-
@click=${()=>{this.#r=this.#r===s?null:s,this.requestUpdate()}}
|
|
3596
|
-
>
|
|
3597
|
-
${Ke()}
|
|
3598
|
-
</button>`}#B(){const e=this.#r,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=tt(this.#o.get(e)??"",[],{label:t,key:e,...this.#c===e?{error:this.#d.sendFailed}:{}});return h`${et(e,st(at(this.#f.locale),s,n=>this.#A(e,n)))}`}}const Es=()=>{customElements.get("dpk-component-formal-spec")||customElements.define("dpk-component-formal-spec",Cs)},qs=()=>{wt(),Dt(),Lt(),Kt(),Qt(),us(),vs()},Mr=()=>{Fs(),Ns(),qs(),Es()};export{Zt as D,At as a,Wt as b,Cs as c,xs as d,hs as e,zt as f,yt as g,Qt as h,Lt as i,Kt as j,Es as k,vs as l,us as m,Dt as n,wt as o,ys as p,ms as q,Mr as r,os as s,Ct as t,vt as u,qs as v};
|