dev-process-kit 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/shared-BjyoXjSO.js +1 -0
- package/dist/chunks/shared-C-d71uRP.js +573 -0
- package/dist/chunks/shared-C5n6LBUz.js +1105 -0
- package/dist/chunks/{shared-XXW1oBnj.js → shared-CAWKGcWJ.js} +56 -54
- package/dist/chunks/{shared-BqL8W-G6.js → shared-CdZhkPto.js} +1 -1
- package/dist/chunks/{shared-D6pr-dx0.js → shared-DB_C1Mdu.js} +1 -1
- package/dist/chunks/{shared-k9bZPE_p.js → shared-DDOpqbVL.js} +1 -1
- package/dist/chunks/shared-DeXM1v86.js +610 -0
- package/dist/chunks/{shared-DRzfRsiJ.js → shared-DehzCTC2.js} +179 -172
- package/dist/chunks/{shared-BWk3i0ft.js → shared-Dfj6O0K4.js} +1 -1
- package/dist/chunks/{shared-BDka-8DG.js → shared-DiFAX1_p.js} +264 -204
- package/dist/chunks/{shared-D1W4I3eq.js → shared-DkPo0jX3.js} +391 -320
- package/dist/chunks/shared-GL2Z98Cz.js +4206 -0
- package/dist/chunks/shared-cMhjZGRs.js +301 -0
- package/dist/chunks/{shared-CqjOqXJ3.js → shared-zZF1zU0o.js} +2 -2
- 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 -1
- package/dist/chunks/shared-BZK_cqqQ.js +0 -1104
- package/dist/chunks/shared-Bhrkz9uX.js +0 -3595
- package/dist/chunks/shared-BqvHpTHr.js +0 -572
- package/dist/chunks/shared-gytWODMC.js +0 -610
|
@@ -0,0 +1,4206 @@
|
|
|
1
|
+
import{a0 as H,Z as Ze,j as Qe,a1 as et,a2 as G,a3 as b,a4 as u,a5 as Q,a6 as Vs,J as De,a7 as R,a8 as ve,a9 as tt,aa as Le,ab as st,B as at,ac as Ys,ad as Js,ae as K,af as T,ag as k,ah as D,ai as g,aj as _,ak as $,al as S,am as ie,an as nt,ao as it,ap as ee,aq as re,ar as rt,as as Xs,at as oe,au as de,av as te,aw as Zs,ax as Qs,ay as ea,az as ot,G as ta,aA as sa,I as aa,aB as na,aC as ia,l as dt,aD as ra,aE as oa,aF as da,aG as le,q as la,r as ca}from"./shared-DiFAX1_p.js";import{i as lt}from"./shared-DB_C1Mdu.js";import{p as ct,r as pt,c as ut}from"./shared-DDOpqbVL.js";const pa='script[type="application/json"]',ht=(a,e)=>{const t=a.querySelector(pa);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)}}},mt=(a,e,t)=>{const s=ht(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const i=ht(a,e);i&&(n.disconnect(),t(i))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},gt={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ye=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},ua=(a,e)=>{const t=new Map;for(const r of a)t.set(r.id,[]);for(const r of e)t.get(r.from)?.push(r);const s=new Map,n=new Set,i=r=>{s.set(r,"open");for(const o of t.get(r)??[]){const d=s.get(o.to)??"new";d==="open"?n.add(o.id):d==="new"&&i(o.to)}s.set(r,"done")};for(const r of a)(s.get(r.id)??"new")==="new"&&i(r.id);return{reversed:n,forward:e.filter(r=>!n.has(r.id))}},ha=(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])),i=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),r=a.filter(o=>(i.get(o.id)??0)===0).map(o=>o.id);for(const o of r)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=(i.get(d.to)??0)-1;i.set(d.to,c),c===0&&r.push(d.to)}return n},ma=(a,e,t,s)=>{const n=[...a.keys()].sort((i,r)=>i-r);for(let i=0;i<s;i++){const r=i%2===0;for(const o of r?n:[...n].reverse()){const d=a.get(o)??[],l=new Map(d.map((p,m)=>[p,m])),c=p=>{const m=l.get(p);return m===void 0?null:m},h=d.map(p=>{const m=(e.get(p)??[]).filter(v=>(t.get(v)??o)===o+(r?-1:1)).map(c).filter(v=>v!==null);return{id:p,want:m.length>0?ye(m):l.get(p)??0}});h.sort((p,m)=>p.want-m.want||(l.get(p.id)??0)-(l.get(m.id)??0)),a.set(o,h.map(p=>p.id))}}},ft=(a,e,t,s)=>{const n=a.map((r,o)=>({id:r,want:t.get(r)??o*100,index:o}));n.sort((r,o)=>r.want-o.want||r.index-o.index);let i=0;for(const r of n){const o=e.get(r.id);o&&(o.y=i,i+=o.spec.height+s)}return{height:Math.max(0,i-s)}},ga=(a,e,t,s,n)=>{const i=[...a.keys()].sort((l,c)=>l-c),r=new Map;for(const l of i)r.set(l,ft(a.get(l)??[],e,new Map,n.nodeSpacing).height);const o=Math.max(0,...r.values());for(const l of i){const c=(o-(r.get(l)??0))/2;for(const h of a.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const d=(l,c)=>{const h=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const m=e.get(p);return m?[m.y+m.spec.height/2]:[]});return h.length>0?ye(h):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const h of c?i:[...i].reverse()){const p=a.get(h)??[],m=new Map;for(const y of p){const E=d(y,h+(c?-1:1)),O=e.get(y);O!==void 0&&m.set(y,E===null?O.y+O.spec.height/2:E)}const v=p.map(y=>e.get(y)?.y??0);ft(p,e,m,n.nodeSpacing);const x=p.map(y=>e.get(y)?.y??0),w=ye(v)-ye(x);for(const y of p){const E=e.get(y);E&&(E.y+=w)}}}},bt=(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}},kt=(a,e,t)=>{let s=0;const n=[];for(const i of a){const r=t.byId.get(i.from),o=t.byId.get(i.to);if(!r||!o)continue;const d=bt(r,i.fromPort,"out"),l=bt(o,i.toPort,"in");if(i.from===i.to){const v=r.x+r.spec.width,x=r.y+r.spec.height,w=Math.max(t.padding/2,x+18);n.push({id:i.id,points:[d,{x:v+20,y:d.y},{x:v+20,y:w},{x:r.x-20,y:w},{x:r.x-20,y:l.y},l]});continue}if(!e.has(i.id)&&(r.layer<o.layer||r.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){n.push({id:i.id,points:[d,l]});continue}const x=r.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;n.push({id:i.id,points:[d,{x,y:d.y},{x,y:l.y},l]});continue}const c=i.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:d,h=i.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,h.y)+18+s*14;s+=1;const m=[d,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((v,x,w)=>x===0||v.x!==w[x-1]?.x||v.y!==w[x-1]?.y);n.push({id:i.id,points:m})}return n},xt=(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)],i=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],r=Math.min(0,...n),o=Math.min(0,...i),d=Math.max(0,...n),l=Math.max(0,...i),c=t-r,h=t-o;return{width:d-r+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+h,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(m=>({x:m.x+c,y:m.y+h}))}))}},vt=(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},yt=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),fa=(a,e)=>{const t=new Map;for(const s of a){const n=e.get(s.id)??0,i=t.get(n);i?i.push(s.id):t.set(n,[s.id])}return t},ba=(a,e,t={})=>{const s={...gt,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(x=>x.id)),i=e.filter(x=>n.has(x.from)&&n.has(x.to)),{forward:r,reversed:o}=ua(a,i),d=ha(a,r),l=fa(a,d);ma(l,vt(a,i),d,s.sweeps);const c=new Map;for(const x of l.values())x.forEach((w,y)=>c.set(w,y));const h=yt(a,d,c,()=>({x:0,y:0})),p=new Map(h.map(x=>[x.spec.id,x]));ga(l,p,vt(a,i),d,s);const m=[...l.keys()].sort((x,w)=>x-w);let v=0;for(const x of m){const w=Math.max(...(l.get(x)??[]).map(y=>p.get(y)?.spec.width??0));for(const y of l.get(x)??[]){const E=p.get(y);E&&(E.x=v)}v+=w+s.layerSpacing}return xt(h,kt(i,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},ka=(a,e,t={})=>{const s={...gt,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(d=>d.id)),i=e.filter(d=>n.has(d.from)&&n.has(d.to)),r=yt(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(r.map(d=>[d.spec.id,d]));return xt(r,kt(i,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},xa=H({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),va={active:[],match:"single"},se=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),ya=(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]},wa=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),$a=a=>({...a,active:[]}),Sa=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}))},W={nodes:new Map,edges:new Set},j=(a,e,t,s)=>{const n=new Map,i=new Set,r=[{id:e,depth:0}],o=new Set([e]);for(const d of r)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,h=t==="outgoing"?l.to:l.from;c===d.id&&(i.add(l.id),!o.has(h)&&(o.add(h),n.set(h,d.depth+1),r.push({id:h,depth:d.depth+1})))}return{nodes:n,edges:i}},Ma=(a,e)=>{const t=new Map(a.map(i=>[i,j(e,i,"outgoing",!0).nodes])),s=new Set,n=[];for(const i of a){if(s.has(i))continue;const r=a.filter(o=>o===i||t.get(i)?.has(o)===!0&&t.get(o)?.has(i)===!0);for(const o of r)s.add(o);(r.length>1||e.some(o=>o.from===i&&o.to===i))&&n.push(r)}return n},ze=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),wt=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),Ae=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},$t=(a,e,t,s)=>{const n=e!==null&&e.kind===t&&e.id===a,i=t==="node"?s.nodes.has(a):s.edges.has(a),r=t==="node"?s.nodes.get(a)??null:null;return{selected:n,related:i&&!n,dimmed:e!==null&&!n&&!i,depth:r}},V=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),Ca=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 i=a[1]??e,r=a[2]??t;return{x:i.x,y:(i.y+r.y)/2}}const s=a[2]??e,n=a[3]??t;return{x:(s.x+n.x)/2,y:s.y}},Ea=(a,e)=>Sa(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),qa=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,Y=[Ze,Qe,et,G`
|
|
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
|
+
/* Above the dock in the top layer, so nothing to clear. */
|
|
51
|
+
--dpk-dock-overlap: 0px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.diagram-maximize {
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.diagram-toolbar {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 10px;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
min-height: 44px;
|
|
64
|
+
padding: 8px 14px;
|
|
65
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
66
|
+
background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
|
|
67
|
+
box-shadow: 0 1px 0 var(--dpk-highlight) inset;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.diagram-title {
|
|
72
|
+
font-family: var(--dpk-display);
|
|
73
|
+
font-size: 12.5px;
|
|
74
|
+
font-weight: 660;
|
|
75
|
+
letter-spacing: -0.015em;
|
|
76
|
+
color: var(--dpk-ink);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* A long heading or subject elides (the full text is its tooltip) instead of pushing the actions off the toolbar. */
|
|
80
|
+
.diagram-title,
|
|
81
|
+
.diagram-subject {
|
|
82
|
+
min-width: 0;
|
|
83
|
+
max-width: 100%;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
text-overflow: ellipsis;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.diagram-subject {
|
|
90
|
+
font-size: 10px;
|
|
91
|
+
color: var(--dpk-ink-faint);
|
|
92
|
+
padding-left: 10px;
|
|
93
|
+
border-left: 1px solid var(--dpk-rule-strong);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.diagram-toolbar-actions {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
gap: 6px;
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
flex-wrap: wrap;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.diagram-stats {
|
|
105
|
+
font-family: var(--dpk-mono);
|
|
106
|
+
font-size: 10px;
|
|
107
|
+
font-weight: 550;
|
|
108
|
+
padding: 3px 9px;
|
|
109
|
+
border: 1px solid var(--dpk-rule);
|
|
110
|
+
border-radius: 999px;
|
|
111
|
+
background: var(--dpk-paper-sunken);
|
|
112
|
+
color: var(--dpk-ink-faint);
|
|
113
|
+
font-variant-numeric: tabular-nums;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.diagram-tags {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 5px;
|
|
121
|
+
flex-wrap: wrap;
|
|
122
|
+
padding: 7px 12px;
|
|
123
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
124
|
+
background: var(--dpk-paper);
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.diagram-match {
|
|
129
|
+
display: flex;
|
|
130
|
+
gap: 2px;
|
|
131
|
+
padding: 3px;
|
|
132
|
+
margin-right: 6px;
|
|
133
|
+
border: 1px solid var(--dpk-rule);
|
|
134
|
+
border-radius: var(--dpk-radius-sm);
|
|
135
|
+
background: var(--dpk-paper-sunken);
|
|
136
|
+
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.diagram-match button {
|
|
140
|
+
border: 0;
|
|
141
|
+
border-radius: var(--dpk-radius-xs);
|
|
142
|
+
padding: 4px 8px;
|
|
143
|
+
background: transparent;
|
|
144
|
+
color: var(--dpk-ink-faint);
|
|
145
|
+
font-size: 9.5px;
|
|
146
|
+
font-weight: 600;
|
|
147
|
+
letter-spacing: 0.01em;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
transition:
|
|
150
|
+
background 160ms var(--dpk-ease),
|
|
151
|
+
color 160ms var(--dpk-ease),
|
|
152
|
+
box-shadow 160ms var(--dpk-ease);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.diagram-match button:hover[aria-pressed='false'] {
|
|
156
|
+
color: var(--dpk-ink-soft);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.diagram-match button[aria-pressed='true'] {
|
|
160
|
+
background: var(--dpk-paper-raised);
|
|
161
|
+
color: var(--dpk-ink);
|
|
162
|
+
font-weight: 650;
|
|
163
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.dpk-tag {
|
|
167
|
+
display: inline-flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 5px;
|
|
170
|
+
max-width: 100%;
|
|
171
|
+
padding: 4px 9px;
|
|
172
|
+
border: 1px solid transparent;
|
|
173
|
+
border-radius: var(--dpk-radius-xs);
|
|
174
|
+
background: var(--dpk-paper-inset);
|
|
175
|
+
color: var(--dpk-ink-soft);
|
|
176
|
+
font-size: 10.5px;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
transition:
|
|
179
|
+
background 140ms var(--dpk-ease),
|
|
180
|
+
color 140ms var(--dpk-ease),
|
|
181
|
+
border-color 140ms var(--dpk-ease),
|
|
182
|
+
box-shadow 140ms var(--dpk-ease);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.dpk-tag:hover {
|
|
186
|
+
background: var(--dpk-paper-sunken);
|
|
187
|
+
color: var(--dpk-ink);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.dpk-tag[aria-pressed='true'] {
|
|
191
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
|
|
192
|
+
background: var(--dpk-blue-soft);
|
|
193
|
+
color: var(--dpk-blue);
|
|
194
|
+
font-weight: 600;
|
|
195
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.dpk-tag-name {
|
|
199
|
+
min-width: 0;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
text-overflow: ellipsis;
|
|
202
|
+
white-space: nowrap;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.dpk-tag-count {
|
|
206
|
+
flex: none;
|
|
207
|
+
font-family: var(--dpk-mono);
|
|
208
|
+
font-size: 9px;
|
|
209
|
+
opacity: 0.7;
|
|
210
|
+
font-variant-numeric: tabular-nums;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.dpk-tag-clear {
|
|
214
|
+
border: 0;
|
|
215
|
+
background: none;
|
|
216
|
+
padding: 4px 6px;
|
|
217
|
+
color: var(--dpk-ink-faint);
|
|
218
|
+
font-size: 10px;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.diagram-canvas {
|
|
223
|
+
position: relative;
|
|
224
|
+
flex: 1;
|
|
225
|
+
min-height: 220px;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
touch-action: none;
|
|
228
|
+
cursor: grab;
|
|
229
|
+
background: var(--dpk-dots), var(--dpk-paper-sunken);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.diagram-canvas:focus-visible {
|
|
233
|
+
outline: none;
|
|
234
|
+
box-shadow: inset var(--dpk-focus);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.diagram-canvas.is-panning {
|
|
238
|
+
cursor: grabbing;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.diagram-world {
|
|
242
|
+
position: absolute;
|
|
243
|
+
inset: 0 auto auto 0;
|
|
244
|
+
transform-origin: 0 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.diagram-edges {
|
|
248
|
+
position: absolute;
|
|
249
|
+
inset: 0;
|
|
250
|
+
overflow: visible;
|
|
251
|
+
pointer-events: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/*
|
|
255
|
+
* The controls along the bottom edge rise by \`--dpk-dock-overlap\`, set
|
|
256
|
+
* where the shell's hand-off dock floats over that edge, rather than the
|
|
257
|
+
* diagram giving up room to it.
|
|
258
|
+
*/
|
|
259
|
+
.diagram-zoom {
|
|
260
|
+
position: absolute;
|
|
261
|
+
right: 12px;
|
|
262
|
+
bottom: calc(12px + var(--dpk-dock-overlap, 0px));
|
|
263
|
+
display: flex;
|
|
264
|
+
overflow: hidden;
|
|
265
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
266
|
+
border-radius: var(--dpk-radius-sm);
|
|
267
|
+
background: var(--dpk-glass);
|
|
268
|
+
backdrop-filter: blur(12px);
|
|
269
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.diagram-zoom button {
|
|
273
|
+
display: inline-flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
justify-content: center;
|
|
276
|
+
border: 0;
|
|
277
|
+
border-radius: 0;
|
|
278
|
+
padding: 6px 9px;
|
|
279
|
+
background: transparent;
|
|
280
|
+
color: var(--dpk-ink-soft);
|
|
281
|
+
font-size: 10.5px;
|
|
282
|
+
cursor: pointer;
|
|
283
|
+
transition:
|
|
284
|
+
background 140ms var(--dpk-ease),
|
|
285
|
+
color 140ms var(--dpk-ease);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.diagram-zoom button svg {
|
|
289
|
+
width: 12px;
|
|
290
|
+
height: 12px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.diagram-zoom button + button {
|
|
294
|
+
border-left: 1px solid var(--dpk-rule);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.diagram-zoom button:hover {
|
|
298
|
+
background: var(--dpk-paper-inset);
|
|
299
|
+
color: var(--dpk-ink);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.diagram-zoom-value {
|
|
303
|
+
font-family: var(--dpk-mono);
|
|
304
|
+
font-variant-numeric: tabular-nums;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.diagram-legend {
|
|
308
|
+
position: absolute;
|
|
309
|
+
left: 12px;
|
|
310
|
+
bottom: calc(14px + var(--dpk-dock-overlap, 0px));
|
|
311
|
+
display: flex;
|
|
312
|
+
gap: 12px;
|
|
313
|
+
flex-wrap: wrap;
|
|
314
|
+
max-width: calc(100% - 150px);
|
|
315
|
+
padding: 4px 8px;
|
|
316
|
+
border: 1px solid var(--dpk-rule);
|
|
317
|
+
border-radius: var(--dpk-radius-xs);
|
|
318
|
+
background: var(--dpk-glass);
|
|
319
|
+
backdrop-filter: blur(10px);
|
|
320
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
321
|
+
font-size: 9.5px;
|
|
322
|
+
color: var(--dpk-ink-faint);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.diagram-legend span {
|
|
326
|
+
display: inline-flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 5px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.diagram-legend i {
|
|
332
|
+
width: 16px;
|
|
333
|
+
border-top: 1.6px solid var(--dpk-rule-strong);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.diagram-empty,
|
|
337
|
+
.diagram-notice {
|
|
338
|
+
position: absolute;
|
|
339
|
+
left: 50%;
|
|
340
|
+
top: 50%;
|
|
341
|
+
transform: translate(-50%, -50%);
|
|
342
|
+
margin: 0;
|
|
343
|
+
max-width: min(80%, 360px);
|
|
344
|
+
font-size: 12px;
|
|
345
|
+
color: var(--dpk-ink-faint);
|
|
346
|
+
text-align: center;
|
|
347
|
+
pointer-events: none;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.diagram-empty {
|
|
351
|
+
padding: 16px 26px;
|
|
352
|
+
border: 1.5px dashed var(--dpk-rule-strong);
|
|
353
|
+
border-radius: var(--dpk-radius);
|
|
354
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 55%, transparent);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.diagram-notice {
|
|
358
|
+
pointer-events: auto;
|
|
359
|
+
padding: 12px 16px 12px 19px;
|
|
360
|
+
border: 1px solid color-mix(in srgb, var(--dpk-danger) 35%, transparent);
|
|
361
|
+
border-radius: var(--dpk-radius);
|
|
362
|
+
background: linear-gradient(90deg, var(--dpk-danger) 0 3px, transparent 3px), var(--dpk-danger-soft);
|
|
363
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow);
|
|
364
|
+
color: var(--dpk-ink-soft);
|
|
365
|
+
text-align: left;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.diagram-notice p {
|
|
369
|
+
margin: 0 0 9px;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/*
|
|
373
|
+
* Contextual comments: an icon per element, revealed while the element that
|
|
374
|
+
* contains it (or the element just before it) is hovered, focused or
|
|
375
|
+
* selected, and always on touch devices. It opens the composer beside it.
|
|
376
|
+
*/
|
|
377
|
+
.diagram-comment-trigger {
|
|
378
|
+
display: grid;
|
|
379
|
+
place-items: center;
|
|
380
|
+
width: 28px;
|
|
381
|
+
height: 28px;
|
|
382
|
+
padding: 5px;
|
|
383
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
384
|
+
border-radius: var(--dpk-radius-sm);
|
|
385
|
+
background: var(--dpk-paper-raised);
|
|
386
|
+
color: var(--dpk-ink-soft);
|
|
387
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
388
|
+
cursor: pointer;
|
|
389
|
+
opacity: 0;
|
|
390
|
+
pointer-events: none;
|
|
391
|
+
transition:
|
|
392
|
+
opacity 120ms ease,
|
|
393
|
+
background 160ms var(--dpk-ease),
|
|
394
|
+
color 160ms var(--dpk-ease),
|
|
395
|
+
border-color 160ms var(--dpk-ease),
|
|
396
|
+
box-shadow 160ms var(--dpk-ease),
|
|
397
|
+
transform 160ms var(--dpk-ease-spring);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.diagram-comment-trigger.is-placed {
|
|
401
|
+
position: absolute;
|
|
402
|
+
z-index: 2;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.diagram-comment-trigger svg {
|
|
406
|
+
width: 16px;
|
|
407
|
+
height: 16px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.diagram-edge-comment {
|
|
411
|
+
overflow: visible;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.diagram-edge-comment .diagram-comment-trigger {
|
|
415
|
+
margin: 2px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
:is(.d-node, .d-edge):is(:hover, :focus-within, .is-selected) .diagram-comment-trigger,
|
|
419
|
+
:is(:hover, :focus-visible, .is-selected) + .diagram-comment-trigger,
|
|
420
|
+
.diagram-comment-trigger:is(:hover, :focus-visible, [aria-expanded='true']) {
|
|
421
|
+
opacity: 1;
|
|
422
|
+
pointer-events: auto;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.diagram-comment-trigger:hover,
|
|
426
|
+
.diagram-comment-trigger:focus-visible {
|
|
427
|
+
color: var(--dpk-accent);
|
|
428
|
+
border-color: var(--dpk-accent);
|
|
429
|
+
background: var(--dpk-accent-soft);
|
|
430
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
431
|
+
transform: translateY(-1px);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.diagram-comment-trigger:focus-visible {
|
|
435
|
+
outline: none;
|
|
436
|
+
box-shadow: var(--dpk-focus);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
@media (hover: none) {
|
|
440
|
+
.diagram-comment-trigger {
|
|
441
|
+
opacity: 1;
|
|
442
|
+
pointer-events: auto;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.comment-target {
|
|
447
|
+
font-size: 12px;
|
|
448
|
+
overflow-wrap: anywhere;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.comment-error {
|
|
452
|
+
margin: 0;
|
|
453
|
+
font-size: 11px;
|
|
454
|
+
color: var(--dpk-accent);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* Element state, shared by every diagram so highlighting reads the same. */
|
|
458
|
+
.d-node {
|
|
459
|
+
position: absolute;
|
|
460
|
+
cursor: pointer;
|
|
461
|
+
transition:
|
|
462
|
+
opacity 150ms ease,
|
|
463
|
+
border-color 160ms var(--dpk-ease),
|
|
464
|
+
box-shadow 160ms var(--dpk-ease),
|
|
465
|
+
background 160ms var(--dpk-ease),
|
|
466
|
+
transform 160ms var(--dpk-ease);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.d-node.is-dimmed,
|
|
470
|
+
.d-edge.is-dimmed {
|
|
471
|
+
opacity: 0.26;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.d-edge {
|
|
475
|
+
outline: none;
|
|
476
|
+
cursor: pointer;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.d-edge-hit {
|
|
480
|
+
fill: none;
|
|
481
|
+
stroke: transparent;
|
|
482
|
+
stroke-width: 16;
|
|
483
|
+
pointer-events: stroke;
|
|
484
|
+
cursor: pointer;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.d-edge-path {
|
|
488
|
+
fill: none;
|
|
489
|
+
stroke: var(--dpk-rule-strong);
|
|
490
|
+
stroke-width: 1.5;
|
|
491
|
+
stroke-linejoin: round;
|
|
492
|
+
stroke-linecap: round;
|
|
493
|
+
transition:
|
|
494
|
+
stroke 160ms var(--dpk-ease),
|
|
495
|
+
stroke-width 160ms var(--dpk-ease);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.d-edge.is-selected .d-edge-path,
|
|
499
|
+
.d-edge:focus-visible .d-edge-path {
|
|
500
|
+
stroke: var(--dpk-ink);
|
|
501
|
+
stroke-width: 2.6;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.d-edge:focus-visible .d-edge-hit {
|
|
505
|
+
stroke: var(--dpk-blue-soft);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.d-edge-label {
|
|
509
|
+
font-size: 9.5px;
|
|
510
|
+
fill: var(--dpk-ink-faint);
|
|
511
|
+
paint-order: stroke;
|
|
512
|
+
stroke: var(--dpk-paper-raised);
|
|
513
|
+
stroke-width: 5px;
|
|
514
|
+
stroke-linejoin: round;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.d-edge-label.is-dimmed {
|
|
518
|
+
opacity: 0.3;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
@media (max-width: 700px) {
|
|
522
|
+
.diagram-subject {
|
|
523
|
+
display: none;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
`],we=a=>a.map((e,t)=>`${t===0?"M":"L"}${e.x} ${e.y}`).join(" "),St=a=>R`
|
|
527
|
+
<defs>
|
|
528
|
+
${a.map(e=>R`
|
|
529
|
+
<marker
|
|
530
|
+
id=${e.id}
|
|
531
|
+
viewBox="0 0 10 10"
|
|
532
|
+
refX="9"
|
|
533
|
+
refY="5"
|
|
534
|
+
markerWidth="7"
|
|
535
|
+
markerHeight="7"
|
|
536
|
+
orient="auto-start-reverse"
|
|
537
|
+
>
|
|
538
|
+
<path
|
|
539
|
+
class="diagram-arrow"
|
|
540
|
+
d=${e.open===!0?"M1 1 L9 5 L1 9":"M1 1 L9 5 L1 9 Z"}
|
|
541
|
+
fill=${e.open===!0||e.color===void 0?b:e.color}
|
|
542
|
+
stroke=${e.color??b}
|
|
543
|
+
stroke-width="1.3"
|
|
544
|
+
></path>
|
|
545
|
+
</marker>
|
|
546
|
+
`)}
|
|
547
|
+
</defs>
|
|
548
|
+
`,Ta=(a,e,t,s)=>u`
|
|
549
|
+
<div class="diagram-tags" role="group" aria-label=${a.tagFilter}>
|
|
550
|
+
<div class="diagram-match" role="group" aria-label=${a.tagMatch}>
|
|
551
|
+
${[["single","Single"],["all","AND"],["any","OR"]].map(([n,i])=>u`
|
|
552
|
+
<button
|
|
553
|
+
type="button"
|
|
554
|
+
data-match=${n}
|
|
555
|
+
aria-pressed=${t===n?"true":"false"}
|
|
556
|
+
@click=${()=>s({kind:"match",match:n})}
|
|
557
|
+
>
|
|
558
|
+
${i}
|
|
559
|
+
</button>
|
|
560
|
+
`)}
|
|
561
|
+
</div>
|
|
562
|
+
${Q(e,n=>n.tag,n=>u`
|
|
563
|
+
<button
|
|
564
|
+
type="button"
|
|
565
|
+
class="dpk-tag"
|
|
566
|
+
data-tag=${n.tag}
|
|
567
|
+
aria-pressed=${n.selected?"true":"false"}
|
|
568
|
+
@click=${()=>s({kind:"tag",tag:n.tag})}
|
|
569
|
+
>
|
|
570
|
+
<span class="dpk-tag-name" title=${n.tag}>${n.tag}</span><span class="dpk-tag-count">${n.count}</span>
|
|
571
|
+
</button>
|
|
572
|
+
`)}
|
|
573
|
+
${e.some(n=>n.selected)?u`<button type="button" class="dpk-tag-clear" @click=${()=>s({kind:"clear-tags"})}>
|
|
574
|
+
${a.clearTags}
|
|
575
|
+
</button>`:b}
|
|
576
|
+
</div>
|
|
577
|
+
`,Da=(a,e)=>u`
|
|
578
|
+
<div class="diagram-zoom">
|
|
579
|
+
<button
|
|
580
|
+
type="button"
|
|
581
|
+
aria-label=${a.zoomOut}
|
|
582
|
+
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1/1.1})}}
|
|
583
|
+
>
|
|
584
|
+
${Vs()}
|
|
585
|
+
</button>
|
|
586
|
+
<button
|
|
587
|
+
type="button"
|
|
588
|
+
class="diagram-zoom-value"
|
|
589
|
+
title=${a.fit}
|
|
590
|
+
aria-label=${a.fit}
|
|
591
|
+
@click=${()=>e?.({kind:"fit"})}
|
|
592
|
+
>
|
|
593
|
+
100%
|
|
594
|
+
</button>
|
|
595
|
+
<button
|
|
596
|
+
type="button"
|
|
597
|
+
aria-label=${a.zoomIn}
|
|
598
|
+
@click=${t=>{t.stopPropagation(),e?.({kind:"zoom",factor:1.1})}}
|
|
599
|
+
>
|
|
600
|
+
${De()}
|
|
601
|
+
</button>
|
|
602
|
+
</div>
|
|
603
|
+
`,Re=.08,La=1.8,za=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(i=>i.x)),t=Math.min(...a.map(i=>i.y)),s=Math.max(...a.map(i=>i.x+i.width))-e,n=Math.max(...a.map(i=>i.y+i.height))-t;return{x:e-s*.1,y:t-n*.1,width:s*1.2,height:n*1.2}},Oe=(a,e)=>a+e/12,Aa=(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}},Ie=16,Mt=(a,e,t,s,n="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const i=(r,o,d,l)=>{const c=d*a.scale;return c<=l?n==="start"?Ie-Oe(o,d)*a.scale:(l-c)/2-o*a.scale:Math.min(-o*a.scale,Math.max(l-(o+d)*a.scale,r))};return{...a,x:i(a.x,e.x,e.width,t),y:i(a.y,e.y,e.height,s)}},Ra=(a,e,t,s,n,i,r="center")=>{const o=Mt({...a,x:a.x-n,y:a.y-i},e,t,s,r);return Math.abs(i)>Math.abs(n)&&o.y===a.y?null:o},Ct='button,[role="button"],a,input,textarea,select',Oa=a=>{const{canvas:e,world:t,onClearSelection:s,onView:n,align:i="center"}=a;let r={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:f,height:C}=d();o=Mt(o,r,f,C,i),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,n?.(o)},c=()=>{const{width:f,height:C}=d(),q=r.width/1.2||1,A=r.height/1.2||1;o={...o,scale:ve(Math.min((f-24)/q,(C-40)/A),Re,1)},o={...o,x:(f-r.width*o.scale)/2-r.x*o.scale,y:(C-r.height*o.scale)/2-r.y*o.scale},l()},h=()=>{const{width:f}=d(),C=r.width/1.2||1,q=ve((f-24)/C,Re,1);o={scale:q,x:(f-r.width*q)/2-r.x*q,y:16},l()},p=f=>{o={scale:1,x:Ie-(f?.x??Oe(r.x,r.width)),y:Ie-(f?.y??Oe(r.y,r.height))},l()},m=(f,C=d().width/2,q=d().height/2)=>{const A=o.scale,F=ve(A*f,Re,La);F!==A&&(o={scale:F,x:C-(C-o.x)*F/A,y:q-(q-o.y)*F/A},l())},v=f=>{if(f.target instanceof Element&&f.target.closest(".diagram-zoom"))return;const C=f.deltaMode===1?16:f.deltaMode===2?d().height:1;if(f.ctrlKey||f.metaKey){f.preventDefault();const Z=e.getBoundingClientRect();m(Math.exp(-ve(f.deltaY*C,-60,60)*.0012),f.clientX-Z.left,f.clientY-Z.top);return}const{width:q,height:A}=d(),F=Ra(o,r,q,A,f.deltaX*C,f.deltaY*C,i);F!==null&&(f.preventDefault(),o=F,l())},x=new Map;let w=null,y=!1;const E=()=>{const f=[...x.values()],C=f[0];if(!C)return null;const q=f[1];return q?{x:(C.x+q.x)/2,y:(C.y+q.y)/2,distance:Math.hypot(q.x-C.x,q.y-C.y)}:{...C,distance:0}},O=f=>{x.size===0&&(y=!1);const q=(f.target instanceof Element?f.target:null)?.closest(Ct)??null;f.button!==0||f.pointerType!=="touch"&&q!==null||(x.set(f.pointerId,{x:f.clientX,y:f.clientY}),w=E(),q===null&&e.setPointerCapture(f.pointerId),f.pointerType!=="touch"&&q===null&&(f.preventDefault(),e.focus({preventScroll:!0})))},I=f=>{if(!x.has(f.pointerId)||w===null)return;x.set(f.pointerId,{x:f.clientX,y:f.clientY});const C=E();if(C===null)return;const q=C.x-w.x,A=C.y-w.y;if((Math.abs(q)+Math.abs(A)>1||Math.abs(C.distance-w.distance)>1)&&(y=!0),C.distance>0&&w.distance>0){const F=e.getBoundingClientRect();m(Math.pow(C.distance/w.distance,.45),w.x-F.left,w.y-F.top)}o={...o,x:o.x+q,y:o.y+A},l(),w=C,e.classList.toggle("is-panning",y)},N=f=>{x.delete(f.pointerId),w=E(),!(x.size>0)&&(e.classList.remove("is-panning"),f.type==="pointercancel"&&(y=!1))},xe=f=>{y&&(f.preventDefault(),f.stopPropagation()),N(f)},M=f=>{if(y){f.preventDefault(),f.stopPropagation(),y=!1;return}const C=f.target instanceof Element?f.target:null;C===null||C.closest(Ct)!==null||s()},L=f=>{if(f.target!==e)return;const C=30;if(f.key==="+"||f.key==="=")m(1.1);else if(f.key==="-")m(1/1.1);else if(f.key==="0")c();else if(f.key==="Escape")s();else if(f.key==="ArrowLeft"||f.key==="ArrowRight"||f.key==="ArrowUp"||f.key==="ArrowDown")o={...o,x:o.x+(f.key==="ArrowLeft"?C:f.key==="ArrowRight"?-C:0),y:o.y+(f.key==="ArrowUp"?C:f.key==="ArrowDown"?-C:0)},l();else return;f.preventDefault()},z=f=>{const C=f.target instanceof HTMLElement?f.target:null;if(C===null||!t.contains(C))return;const q=C.getBoundingClientRect(),A=e.getBoundingClientRect();let F=0,Z=0;q.left<A.left+12?F=A.left+12-q.left:q.right>A.right-12&&(F=A.right-12-q.right),q.top<A.top+12?Z=A.top+12-q.top:q.bottom>A.bottom-40&&(Z=A.bottom-40-q.bottom),!(F===0&&Z===0)&&(o={...o,x:o.x+F,y:o.y+Z},l())};e.addEventListener("wheel",v,{passive:!1}),e.addEventListener("pointerdown",O),e.addEventListener("pointermove",I),e.addEventListener("pointerup",xe),e.addEventListener("pointercancel",N),e.addEventListener("lostpointercapture",N),e.addEventListener("click",M,!0),e.addEventListener("keydown",L),e.addEventListener("focusin",z);const U=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return U?.observe(e),{setContent(f){r=za(f.width===0&&f.height===0?[]:[f]),t.style.width=`${f.width}px`,t.style.height=`${f.height}px`,l()},apply:l,fit:c,fitWidth:h,reset:p,zoom:m,view:()=>({...o}),destroy(){U?.disconnect(),e.removeEventListener("wheel",v),e.removeEventListener("pointerdown",O),e.removeEventListener("pointermove",I),e.removeEventListener("pointerup",xe),e.removeEventListener("pointercancel",N),e.removeEventListener("lostpointercapture",N),e.removeEventListener("click",M,!0),e.removeEventListener("keydown",L),e.removeEventListener("focusin",z)}}};class Fe extends tt{static{this.styles=Y}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#t=null;#n=null;#e=[];#s=[];#i=null;#a=va;#r=null;#o=null;#c=null;#p=null;#l=-1;#u="";#h=null;#b=null;#d=new Map;#m=null;#g=new Map;#f=null;#x=new Le(this);#M=new st(this,()=>{this.#u=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#u="",this.requestUpdate(),this.#p=mt(this,e=>this.parseData(e),e=>{e.ok?this.#k(e.value):this.#z(e.error)})}disconnectedCallback(){super.disconnectedCallback(),this.#p?.(),this.#p=null,this.#o?.destroy(),this.#o=null,this.#c=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#k(this.data)}updated(){this.#E(),this.#C(),this.#v(),this.#q()}#C(){const e=this.renderRoot.querySelector(".diagram");if(!(this.#f===null||!e||typeof e.showPopover!="function")&&!e.matches(":popover-open"))try{e.showPopover()}catch{}}#E(){const e=JSON.stringify([this.commentTargets,this.#s]);e!==this.#u&&(this.#u=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#v(){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??=Oa({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#S(null),onView:i=>{this.#c&&(this.#c.textContent=`${Math.round(i.scale*100)}%`),this.dispatchEvent(new CustomEvent("dpk-diagram-view",{detail:{view:i},bubbles:!0,composed:!0})),this.onViewChange(i)}});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())}#q(){const e=this.#b!==this.#h;this.#b=this.#h;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#w();!t||!s||(this.#x.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.#i!==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.#e}set elementActions(e){this.#e=e,this.#y()}get elementActionResults(){return this.#s}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.#r}select(e){this.#S(e)}get tagFilter(){return this.#a}set tagFilter(e){this.#a=e,this.requestUpdate()}get dataError(){return this.#i}resetView(){this.fitViewport()}#T(e){if(e===(this.#f!==null))return;const t=this.renderRoot.querySelector(".diagram");this.#f=e?{height:t?.offsetHeight??0}:null,this.#h=null,this.requestUpdate()}#L={handleEvent:e=>e.preventDefault(),passive:!1};#D={handleEvent:e=>{e.key!=="Escape"||this.#r!==null||(e.preventDefault(),this.#T(!1))},capture:!0};get locale(){return this.#M.locale}get chromeMessages(){return xa(this.#M.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=ct(this.#d.get(e)??"",[],{label:t,key:e,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return u`${lt(e,pt(ut(this.#M.locale),s,n=>this.#$(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),u`<button
|
|
604
|
+
type="button"
|
|
605
|
+
class=${V("diagram-comment-trigger",s&&"is-placed")}
|
|
606
|
+
style=${s?`left:${s.x}px; top:${s.y}px`:b}
|
|
607
|
+
data-comment-kind=${e.kind}
|
|
608
|
+
data-comment-id=${e.id}
|
|
609
|
+
aria-label=${this.chromeMessages.commentOn(t)}
|
|
610
|
+
title=${this.chromeMessages.commentOn(t)}
|
|
611
|
+
aria-haspopup="dialog"
|
|
612
|
+
aria-expanded=${this.#h===n?"true":"false"}
|
|
613
|
+
@click=${()=>{this.#S(e),this.#h=n,this.requestUpdate()}}
|
|
614
|
+
>
|
|
615
|
+
${at()}
|
|
616
|
+
</button>`}renderEdgeCommentTrigger(e,t,s){const n=Math.floor((s.length-1)/2),i=s[n],r=s[n+1]??i;return!this.id||!i||!r?b:R`<foreignObject
|
|
617
|
+
class="diagram-edge-comment"
|
|
618
|
+
x=${(i.x+r.x)/2-16}
|
|
619
|
+
y=${(i.y+r.y)/2-16}
|
|
620
|
+
width="32"
|
|
621
|
+
height="32"
|
|
622
|
+
>${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.#n??this.emptyData()}authoredItems(){return this.#t??this.emptyData()}elementClass(e,...t){return V(...t,e.selected&&"is-selected",e.related&&"is-related",e.dimmed&&"is-dimmed")}#k(e){this.#i=null,this.#t=e,this.#y()}#y(){if(this.#t===null){this.#s=this.#e.map(t=>({id:t.id,title:t.type,stale:"target-missing"})),this.requestUpdate();return}const e=this.reduceElementActions(this.#t,this.#e);this.#n=e.data,this.#s=e.results,this.#r!==null&&(this.hasSelection(this.#r)||(this.#r=null,this.#h=null)),this.requestUpdate()}#w(){const e=this.#r;return e?[...this.renderRoot.querySelectorAll("[data-comment-kind]")].find(t=>t.dataset.commentKind===e.kind&&t.dataset.commentId===e.id)??null:null}#$(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 i=new Map(this.#d);i.delete(e),this.#d=i}this.#m=null;const s=this.#w();this.#S(null),s?.focus({preventScroll:!0})}#z(e){this.#i=e,this.#t=null,this.#n=null,this.#y(),console.error("[dev-process-kit] invalid diagram data:",e),this.requestUpdate()}hasSelection(e){return!0}#S(e){(e===null?this.#r===null:this.#r!==null&&this.#r.kind===e.kind&&this.#r.id===e.id)||(this.#r=e,this.#h=null,this.dispatchEvent(new CustomEvent("dpk-diagram-select",{detail:{selection:e},bubbles:!0,composed:!0})),this.requestUpdate())}#A=e=>{switch(e.kind){case"tag":this.#a=ya(this.#a,e.tag),this.requestUpdate();return;case"match":this.#a=wa(this.#a,e.match),this.requestUpdate();return;case"clear-tags":this.#a=$a(this.#a),this.requestUpdate();return;case"select":this.#S(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=Ea(this.tagItems(),this.#a),t=this.#f,s=this.chromeMessages,n=t===null?s.maximize:s.restore;return u`
|
|
623
|
+
${t===null?b:u`<div class="diagram-placeholder" style="height:${t.height}px"></div>`}
|
|
624
|
+
<div
|
|
625
|
+
class=${V("diagram",this.shellClass(),t!==null&&"is-maximized")}
|
|
626
|
+
popover=${t===null?b:"manual"}
|
|
627
|
+
@wheel=${t===null?b:this.#L}
|
|
628
|
+
@keydown=${t===null?b:this.#D}
|
|
629
|
+
>
|
|
630
|
+
<div class="diagram-toolbar">
|
|
631
|
+
<span class="diagram-title" title=${this.heading??this.defaultHeading()}
|
|
632
|
+
>${this.heading??this.defaultHeading()}</span
|
|
633
|
+
>
|
|
634
|
+
${(this.subject??this.defaultSubject())===""?b:u`<span class="diagram-subject" title=${this.subject??this.defaultSubject()}
|
|
635
|
+
>${this.subject??this.defaultSubject()}</span
|
|
636
|
+
>`}
|
|
637
|
+
<div class="diagram-toolbar-actions">
|
|
638
|
+
${this.renderToolbarActions()}
|
|
639
|
+
<span class="diagram-stats">${this.statsText()}</span>
|
|
640
|
+
<button
|
|
641
|
+
type="button"
|
|
642
|
+
class="dpk-icon-btn diagram-maximize"
|
|
643
|
+
aria-label=${n}
|
|
644
|
+
title=${n}
|
|
645
|
+
aria-pressed=${t===null?"false":"true"}
|
|
646
|
+
@click=${()=>this.#T(t===null)}
|
|
647
|
+
>
|
|
648
|
+
${t===null?Ys():Js()}
|
|
649
|
+
</button>
|
|
650
|
+
</div>
|
|
651
|
+
</div>
|
|
652
|
+
${Ta(s,e,this.#a.match,this.#A)} ${this.renderAboveCanvas()}
|
|
653
|
+
<div class="diagram-canvas" tabindex="0" aria-label=${s.canvas}>
|
|
654
|
+
<div class="diagram-world">${this.renderCanvas()}</div>
|
|
655
|
+
${this.isEmpty()?u`<p class="diagram-empty">${this.emptyMessage()}</p>`:b}
|
|
656
|
+
${this.#i===null?b:u`<p class="diagram-notice" role="alert">${s.dataError}<br />${this.#i}</p>`}
|
|
657
|
+
${this.renderLegend()} ${Da(s,this.#A)}
|
|
658
|
+
</div>
|
|
659
|
+
${this.renderSelection()}
|
|
660
|
+
</div>
|
|
661
|
+
`}}class ce extends Fe{#t=null;#n="";#e=0;#s=W;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.#t}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 qa(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.#t;return e===null||e.nodes.length===0?null:{width:e.width,height:e.height}}layoutVersion(){return this.#e}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.#t?.nodes.find(t=>t.id===e)}routeOf(e){return this.#t?.routes.find(t=>t.id===e)?.points??[]}nodeState(e){return $t(e,this.selection,"node",this.#s)}edgeState(e){return $t(e,this.selection,"edge",this.#s)}renderEdges(e,t){const s=this.#t?.width??0,n=this.#t?.height??0;return u`<svg class="diagram-edges" width=${s} height=${n}>
|
|
662
|
+
${St(t)}${e}
|
|
663
|
+
</svg>`}filtered(){const e=this.items();if(this.tagDimension==="edge"){const n=e.edges.filter(r=>se(r.tags,this.tagFilter)&&this.matchesFilter(r)),i=new Set(n.flatMap(r=>[r.from,r.to]));return{...e,edges:n,nodes:e.nodes.filter(r=>i.has(r.id))}}const t=e.nodes.filter(n=>se(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.#n&&(this.#n=t,this.#e+=1,this.#t=this.computePlacement(e)),this.#s=this.relations(this.selection,e)}computePlacement(e){const t=e.nodes.map(i=>({id:i.id,width:i.width,height:i.height,...i.ports===void 0?{}:{ports:i.ports},...i.position===void 0?{}:{position:i.position}})),s=e.edges.map(i=>({id:i.id,from:i.from,to:i.to,...i.fromPort===void 0?{}:{fromPort:i.fromPort},...i.toPort===void 0?{}:{toPort:i.toPort}})),n=this.layoutOptions();return this.layoutMode==="fixed"?ka(t,s,n):ba(t,s,n)}}const $e=H({en:{heading:"State machine",node:"State",edge:"Transition",empty:"No matching transitions.",transitionLabel:(a,e,t)=>`${t} from ${a} to ${e}`},ja:{heading:"\u30B9\u30C6\u30FC\u30C8\u30DE\u30B7\u30F3",node:"\u72B6\u614B",edge:"\u9077\u79FB",empty:"\u8A72\u5F53\u3059\u308B\u9077\u79FB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",transitionLabel:(a,e,t)=>`${a} \u304B\u3089 ${e} \u3078\u306E ${t}`}}),Ia=T({x:ie(),y:ie()}),Fa=T({id:$(g(),S(1)),name:$(g(),S(1)),code:k(g()),kind:k(_(["normal","initial","terminal","compensation"]),"normal"),description:k(g()),position:k(Ia),questions:k(g())}),Na=T({id:$(g(),S(1)),from:$(g(),S(1)),to:$(g(),S(1)),title:$(g(),S(1)),kind:k(_(["normal","exception"]),"normal"),tags:k(D(g()),[]),guard:k(g()),effect:k(g()),questions:k(g())}),Et={width:178,height:86},Pa=()=>({nodes:[],edges:[]}),ja=T({states:D(Fa),transitions:k(D(Na),[])}),qt=a=>{const e=K(ja,a),t=new Set;for(const r of e.states){if(t.has(r.id))throw new Error(`duplicate state id: ${r.id}`);t.add(r.id)}const s=new Set,n=e.transitions.map(r=>{if(s.has(r.id))throw new Error(`duplicate transition id: ${r.id}`);if(s.add(r.id),!t.has(r.from))throw new Error(`unknown transition source: ${r.from}`);if(!t.has(r.to))throw new Error(`unknown transition target: ${r.to}`);return{id:r.id,from:r.from,to:r.to,title:r.title,kind:r.kind,tags:r.tags,guard:r.guard??null,effect:r.effect??null,...r.questions===void 0?{}:{questions:r.questions}}});return{nodes:e.states.map(r=>({id:r.id,name:r.name,code:r.code??null,kind:r.kind,description:r.description??null,width:Et.width,height:Et.height,tags:[],...r.position===void 0?{}:{position:r.position},...r.questions===void 0?{}:{questions:r.questions}})),edges:n}},Ua=a=>a.length>0&&a.every(e=>e.position!==void 0),_a=G`
|
|
664
|
+
.state-node {
|
|
665
|
+
display: flex;
|
|
666
|
+
flex-direction: column;
|
|
667
|
+
justify-content: center;
|
|
668
|
+
gap: 6px;
|
|
669
|
+
padding: 0 15px;
|
|
670
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
671
|
+
border-radius: var(--dpk-radius);
|
|
672
|
+
background: var(--dpk-paper-raised);
|
|
673
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
674
|
+
text-align: left;
|
|
675
|
+
overflow: hidden;
|
|
676
|
+
transition:
|
|
677
|
+
border-color 160ms var(--dpk-ease),
|
|
678
|
+
box-shadow 160ms var(--dpk-ease),
|
|
679
|
+
transform 160ms var(--dpk-ease);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.state-node:hover {
|
|
683
|
+
border-color: var(--dpk-blue);
|
|
684
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
685
|
+
transform: translateY(-1px);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
.state-node.is-initial {
|
|
689
|
+
border-width: 2px;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.state-node.is-terminal {
|
|
693
|
+
border: 3px double var(--dpk-rule-strong);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.state-node.is-compensation {
|
|
697
|
+
border-color: color-mix(in srgb, var(--dpk-amber) 50%, transparent);
|
|
698
|
+
background: var(--dpk-amber-soft);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.state-node.is-selected {
|
|
702
|
+
border-color: var(--dpk-blue);
|
|
703
|
+
box-shadow:
|
|
704
|
+
var(--dpk-bevel),
|
|
705
|
+
var(--dpk-shadow-sm),
|
|
706
|
+
0 0 0 3px var(--dpk-blue-soft);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.state-node.is-related {
|
|
710
|
+
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.state-code {
|
|
714
|
+
font-family: var(--dpk-mono);
|
|
715
|
+
font-size: 9px;
|
|
716
|
+
letter-spacing: 0.02em;
|
|
717
|
+
color: var(--dpk-ink-faint);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.state-name {
|
|
721
|
+
font-size: 13.5px;
|
|
722
|
+
font-weight: 640;
|
|
723
|
+
letter-spacing: -0.01em;
|
|
724
|
+
white-space: nowrap;
|
|
725
|
+
overflow: hidden;
|
|
726
|
+
text-overflow: ellipsis;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/* The slot centres a label on its route and carries the label's comment icon beside it. */
|
|
730
|
+
.state-label-slot {
|
|
731
|
+
position: absolute;
|
|
732
|
+
transform: translate(-50%, -50%);
|
|
733
|
+
display: flex;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/* Overlaps the label by a hair so the pointer never crosses a gap that would hide it. */
|
|
737
|
+
.state-label-slot > .diagram-comment-trigger {
|
|
738
|
+
position: absolute;
|
|
739
|
+
left: calc(100% - 2px);
|
|
740
|
+
top: 50%;
|
|
741
|
+
transform: translateY(-50%);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.state-label {
|
|
745
|
+
max-width: 190px;
|
|
746
|
+
padding: 3px 7px;
|
|
747
|
+
border: 1px solid transparent;
|
|
748
|
+
border-radius: var(--dpk-radius-xs);
|
|
749
|
+
background: var(--dpk-paper-raised);
|
|
750
|
+
color: var(--dpk-ink-soft);
|
|
751
|
+
font-size: 10px;
|
|
752
|
+
line-height: 1.5;
|
|
753
|
+
white-space: nowrap;
|
|
754
|
+
overflow: hidden;
|
|
755
|
+
text-overflow: ellipsis;
|
|
756
|
+
cursor: pointer;
|
|
757
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
758
|
+
transition:
|
|
759
|
+
border-color 160ms var(--dpk-ease),
|
|
760
|
+
background 160ms var(--dpk-ease),
|
|
761
|
+
color 160ms var(--dpk-ease),
|
|
762
|
+
box-shadow 160ms var(--dpk-ease);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.state-label:hover {
|
|
766
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
767
|
+
color: var(--dpk-blue);
|
|
768
|
+
box-shadow: var(--dpk-shadow-sm);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
.state-label.is-selected {
|
|
772
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
773
|
+
background: var(--dpk-blue-soft);
|
|
774
|
+
color: var(--dpk-blue);
|
|
775
|
+
font-weight: 600;
|
|
776
|
+
box-shadow:
|
|
777
|
+
var(--dpk-shadow-xs),
|
|
778
|
+
inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.state-label.is-dimmed {
|
|
782
|
+
opacity: 0.35;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
.state-edge.is-exception .d-edge-path {
|
|
786
|
+
stroke: color-mix(in srgb, var(--dpk-amber) 65%, var(--dpk-rule-strong));
|
|
787
|
+
stroke-dasharray: 5 4;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
.state-edge.is-related .d-edge-path {
|
|
791
|
+
stroke: var(--dpk-green);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.state-edge.is-selected .d-edge-path {
|
|
795
|
+
stroke: var(--dpk-blue);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.state-initial-mark {
|
|
799
|
+
fill: var(--dpk-ink-faint);
|
|
800
|
+
stroke: var(--dpk-ink-faint);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.state-initial-mark.is-dimmed {
|
|
804
|
+
opacity: 0.26;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
#state-arrow .diagram-arrow {
|
|
808
|
+
fill: var(--dpk-ink-faint);
|
|
809
|
+
stroke: var(--dpk-ink-faint);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
#state-arrow-active .diagram-arrow {
|
|
813
|
+
fill: var(--dpk-blue);
|
|
814
|
+
stroke: var(--dpk-blue);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
#state-arrow-exception .diagram-arrow {
|
|
818
|
+
fill: var(--dpk-amber);
|
|
819
|
+
stroke: var(--dpk-amber);
|
|
820
|
+
}
|
|
821
|
+
`,Ba=[{id:"state-arrow"},{id:"state-arrow-active"},{id:"state-arrow-exception"}];class Tt extends ce{static{this.styles=[Y,_a]}parseData(e){return qt(e)}emptyData(){return Pa()}defaultHeading(){return $e(this.locale).heading}statsLabels(){const e=$e(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return $e(this.locale).empty}get tagDimension(){return"edge"}get layoutMode(){return Ua(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 W;const s=j(t.edges,e.id,"outgoing",!1),n=j(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.#e(s));return u`
|
|
822
|
+
${this.renderEdges([...t,...this.visible.edges.map(s=>this.#s(s))],Ba)}
|
|
823
|
+
${e.map(s=>this.#i(s))} ${this.visible.edges.map(s=>this.#a(s))}
|
|
824
|
+
`}#t(e){return this.filtered().nodes.find(t=>t.id===e)?.name??e}#n(e){return[e.guard,e.effect].filter(t=>t!==null).join(`
|
|
825
|
+
`)||e.title}#e(e){const t=this.placedNode(e.id);if(!t)return b;const s=t.y+t.height/2,n=this.nodeState(e.id);return R`
|
|
826
|
+
<g class=${V("state-initial-mark",n.dimmed&&"is-dimmed")}>
|
|
827
|
+
<circle cx=${t.x-22} cy=${s} r="5"></circle>
|
|
828
|
+
<path
|
|
829
|
+
d=${we([{x:t.x-17,y:s},{x:t.x-1,y:s}])}
|
|
830
|
+
stroke-width="1.6"
|
|
831
|
+
></path>
|
|
832
|
+
</g>
|
|
833
|
+
`}#s(e){const t=$e(this.locale),s=this.edgeState(e.id),n=this.routeOf(e.id),i=we(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 R`
|
|
834
|
+
<g
|
|
835
|
+
class=${this.elementClass(s,"d-edge","state-edge",e.kind==="exception"&&"is-exception")}
|
|
836
|
+
data-transition=${e.id}
|
|
837
|
+
>
|
|
838
|
+
<title>${this.#n(e)}</title>
|
|
839
|
+
<path class="d-edge-path" d=${i} marker-end=${`url(#${o})`}></path>
|
|
840
|
+
<path
|
|
841
|
+
class="d-edge-hit"
|
|
842
|
+
d=${i}
|
|
843
|
+
role="button"
|
|
844
|
+
tabindex="0"
|
|
845
|
+
aria-label=${t.transitionLabel(this.#t(e.from),this.#t(e.to),e.title)}
|
|
846
|
+
@click=${d}
|
|
847
|
+
@keydown=${l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),d())}}
|
|
848
|
+
></path>
|
|
849
|
+
</g>
|
|
850
|
+
`}#i(e){const t=this.placedNode(e.id);if(!t)return b;const s=this.nodeState(e.id);return u`
|
|
851
|
+
<button
|
|
852
|
+
type="button"
|
|
853
|
+
class=${this.elementClass(s,"d-node","state-node",`is-${e.kind}`)}
|
|
854
|
+
data-state=${e.id}
|
|
855
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
856
|
+
style="left:${t.x}px; top:${t.y}px; width:${e.width}px; height:${e.height}px"
|
|
857
|
+
aria-pressed=${s.selected?"true":"false"}
|
|
858
|
+
title=${e.description??e.name}
|
|
859
|
+
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
860
|
+
>
|
|
861
|
+
<span class="state-name">${e.name}</span>
|
|
862
|
+
${e.code===null?b:u`<span class="state-code">${e.code}</span>`}
|
|
863
|
+
</button>
|
|
864
|
+
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:t.x+e.width-20,y:t.y-14})}
|
|
865
|
+
`}#a(e){const t=this.edgeState(e.id),s=Ca(this.routeOf(e.id));return u`
|
|
866
|
+
<span class="state-label-slot" style="left:${s.x}px; top:${s.y}px">
|
|
867
|
+
<button
|
|
868
|
+
type="button"
|
|
869
|
+
class=${this.elementClass(t,"state-label")}
|
|
870
|
+
data-transition-label=${e.id}
|
|
871
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
872
|
+
title=${this.#n(e)}
|
|
873
|
+
@click=${()=>this.select({kind:"edge",id:e.id})}
|
|
874
|
+
>
|
|
875
|
+
${e.title}
|
|
876
|
+
</button>
|
|
877
|
+
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#t(e.from)} \u2192 ${this.#t(e.to)} \xB7 ${e.title}`)}
|
|
878
|
+
</span>
|
|
879
|
+
`}}const Dt=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",Tt)},Lt=(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],pe=H({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>Lt(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=>Lt(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`}}),Ha=T({kind:ee("message"),id:$(g(),S(1)),from:$(g(),S(1)),to:$(g(),S(1)),title:$(g(),S(1)),style:k(_(["request","response","async"]),"request"),tags:k(D(g()),[]),guard:k(g()),detail:k(g()),questions:k(g())}),Ga=T({label:$(g(),S(1)),items:D(it())}),Ka=T({kind:ee("fragment"),id:$(g(),S(1)),operator:_(["alt","opt","loop","par"]),title:$(g(),S(1)),collapsed:k(re(),!1),branches:$(D(Ga),S(1))}),Wa=nt("kind",[Ha,Ka]),Va=T({id:$(g(),S(1)),name:$(g(),S(1)),role:k(g()),symbol:k(g()),kind:k(_(["internal","external"]),"internal"),description:k(g()),questions:k(g())}),Ya=T({participants:$(D(Va),S(1)),items:k(D(it()),[])}),zt=240,Ne=(a,e,t)=>{if(a.has(e))throw new Error(`duplicate ${t} id: ${e}`);a.add(e)},At=(a,e,t)=>a.map(s=>{const n=K(Wa,s);if(n.kind==="message"){if(Ne(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 Ne(t,n.id,"fragment"),{kind:"fragment",id:n.id,operator:n.operator,title:n.title,collapsed:n.collapsed,branches:n.branches.map(r=>({label:r.label,items:At(r.items,e,t)}))}}),Rt=a=>{const e=K(Ya,a),t=new Set;for(const s of e.participants)Ne(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:At(e.items,t,new Set)}},Ja=()=>({participants:[],items:[]}),Ot=(a,e)=>{for(const t of a)if(t.kind==="message")e.push(t);else for(const s of t.branches)Ot(s.items,e)},J=a=>{const e=[];return Ot(a,e),e},Xa=a=>new Map(J(a.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),Za=a=>J(a).length,It=(a,e)=>{const t=[];for(const s of a){if(s.kind==="message"){e(s)&&t.push(s);continue}const n=s.branches.map(i=>({label:i.label,items:It(i.items,e)})).filter(i=>i.items.length>0);n.length>0&&t.push({...s,branches:n})}return t},Qa=64,en=86,tn=31,sn=32,an=40,nn=(a,e)=>{const t=It(a.items,e),s=new Set;for(const v of J(t))s.add(v.from),s.add(v.to);const n=a.participants.filter(v=>s.has(v.id)),i=new Map(n.map((v,x)=>[v.id,120+x*zt])),r=Math.max(360,n.length*zt),o=[],d=[],l=[],c=[],h=[];let p=25;const m=(v,x)=>{for(const w of v){if(w.kind==="message"){o.push({message:w,y:p+29,depth:x}),p+=w.from===w.to?en:Qa;continue}const y=22+x*13,E=p,O=r-44-x*26;p+=tn,w.collapsed?(h.push({fragment:w,x:y,y:p+6,width:O}),p+=an):w.branches.forEach((I,N)=>{N>0&&(c.push({x:y,y:p,width:O}),p+=8),l.push({label:I.label,x:y+12,y:p,width:O-24}),p+=sn,m(I.items,x+1),p+=8}),d.push({fragment:w,x:y,y:E,width:O,height:p-E,count:Za([w])}),p+=14}};return m(t,0),{width:r,height:p+24,participants:n,rows:o,frames:d,branches:l,dividers:c,folds:h,x:i}},rn=G`
|
|
880
|
+
.sequence .diagram-canvas {
|
|
881
|
+
background-image: none;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.sequence-rail {
|
|
885
|
+
position: relative;
|
|
886
|
+
height: 62px;
|
|
887
|
+
flex-shrink: 0;
|
|
888
|
+
overflow: hidden;
|
|
889
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
890
|
+
background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
.sequence-rail-world {
|
|
894
|
+
position: absolute;
|
|
895
|
+
top: 0;
|
|
896
|
+
left: 0;
|
|
897
|
+
height: 62px;
|
|
898
|
+
transform-origin: 0 0;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
.sequence-participant {
|
|
902
|
+
position: absolute;
|
|
903
|
+
top: 9px;
|
|
904
|
+
width: 190px;
|
|
905
|
+
height: 44px;
|
|
906
|
+
display: flex;
|
|
907
|
+
align-items: center;
|
|
908
|
+
gap: 9px;
|
|
909
|
+
padding: 6px 10px;
|
|
910
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
911
|
+
border-radius: var(--dpk-radius-sm);
|
|
912
|
+
background: var(--dpk-paper-raised);
|
|
913
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
914
|
+
text-align: left;
|
|
915
|
+
cursor: pointer;
|
|
916
|
+
transition:
|
|
917
|
+
border-color 160ms var(--dpk-ease),
|
|
918
|
+
box-shadow 160ms var(--dpk-ease),
|
|
919
|
+
transform 160ms var(--dpk-ease);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
.sequence-participant.is-external {
|
|
923
|
+
border-style: dashed;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
.sequence-participant:hover {
|
|
927
|
+
border-color: var(--dpk-blue);
|
|
928
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
929
|
+
transform: translateY(-1px);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
.sequence-participant[aria-pressed='true'] {
|
|
933
|
+
border-color: var(--dpk-blue);
|
|
934
|
+
box-shadow:
|
|
935
|
+
var(--dpk-bevel),
|
|
936
|
+
var(--dpk-shadow-sm),
|
|
937
|
+
0 0 0 3px var(--dpk-blue-soft);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.sequence-participant.is-related {
|
|
941
|
+
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.sequence-symbol {
|
|
945
|
+
flex-shrink: 0;
|
|
946
|
+
display: grid;
|
|
947
|
+
place-items: center;
|
|
948
|
+
width: 26px;
|
|
949
|
+
height: 26px;
|
|
950
|
+
border-radius: var(--dpk-radius-xs);
|
|
951
|
+
background: var(--dpk-paper-inset);
|
|
952
|
+
color: var(--dpk-ink-faint);
|
|
953
|
+
font-family: var(--dpk-mono);
|
|
954
|
+
font-size: 9.5px;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.sequence-participant.is-external .sequence-symbol {
|
|
958
|
+
background: var(--dpk-amber-soft);
|
|
959
|
+
color: var(--dpk-amber);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/* The lane is a fixed width: a long name or role elides inside it (the button's title has it whole). */
|
|
963
|
+
.sequence-names {
|
|
964
|
+
min-width: 0;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
.sequence-name {
|
|
968
|
+
display: block;
|
|
969
|
+
font-size: 11.5px;
|
|
970
|
+
font-weight: 640;
|
|
971
|
+
white-space: nowrap;
|
|
972
|
+
overflow: hidden;
|
|
973
|
+
text-overflow: ellipsis;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.sequence-role {
|
|
977
|
+
display: block;
|
|
978
|
+
margin-top: 2px;
|
|
979
|
+
font-size: 9px;
|
|
980
|
+
color: var(--dpk-ink-faint);
|
|
981
|
+
white-space: nowrap;
|
|
982
|
+
overflow: hidden;
|
|
983
|
+
text-overflow: ellipsis;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
.sequence-lifeline {
|
|
987
|
+
stroke: var(--dpk-rule-strong);
|
|
988
|
+
stroke-width: 1;
|
|
989
|
+
stroke-dasharray: 4 6;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.sequence-divider {
|
|
993
|
+
stroke: var(--dpk-rule-strong);
|
|
994
|
+
stroke-dasharray: 4 4;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
.sequence-message {
|
|
998
|
+
fill: none;
|
|
999
|
+
stroke: var(--dpk-ink-faint);
|
|
1000
|
+
stroke-width: 1.5;
|
|
1001
|
+
stroke-linejoin: round;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.sequence-message.is-response {
|
|
1005
|
+
stroke-dasharray: 5 4;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.sequence-message.is-async {
|
|
1009
|
+
stroke: var(--dpk-blue);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.sequence-message-row.is-related .sequence-message {
|
|
1013
|
+
stroke: var(--dpk-green);
|
|
1014
|
+
stroke-width: 2;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
.sequence-message-row.is-selected .sequence-message {
|
|
1018
|
+
stroke: var(--dpk-ink);
|
|
1019
|
+
stroke-width: 2.4;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
.sequence-message-row.is-dimmed,
|
|
1023
|
+
.sequence-label.is-dimmed {
|
|
1024
|
+
opacity: 0.24;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.sequence-frame {
|
|
1028
|
+
position: absolute;
|
|
1029
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1030
|
+
border-radius: var(--dpk-radius-xs);
|
|
1031
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 50%, transparent);
|
|
1032
|
+
box-shadow: 0 1px 2px var(--dpk-shade-1);
|
|
1033
|
+
pointer-events: none;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
.sequence-frame-chevron {
|
|
1037
|
+
display: inline-flex;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.sequence-frame-chevron svg {
|
|
1041
|
+
width: 11px;
|
|
1042
|
+
height: 11px;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
.sequence-frame-header {
|
|
1046
|
+
position: absolute;
|
|
1047
|
+
display: flex;
|
|
1048
|
+
align-items: center;
|
|
1049
|
+
gap: 9px;
|
|
1050
|
+
padding: 5px 9px;
|
|
1051
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1052
|
+
border-bottom: 0;
|
|
1053
|
+
border-radius: var(--dpk-radius-xs) var(--dpk-radius-xs) 0 0;
|
|
1054
|
+
background: var(--dpk-paper-sunken);
|
|
1055
|
+
color: var(--dpk-ink-soft);
|
|
1056
|
+
font-size: 10px;
|
|
1057
|
+
text-align: left;
|
|
1058
|
+
cursor: pointer;
|
|
1059
|
+
transition:
|
|
1060
|
+
background 160ms var(--dpk-ease),
|
|
1061
|
+
color 160ms var(--dpk-ease);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
.sequence-frame-header:hover {
|
|
1065
|
+
background: var(--dpk-paper-inset);
|
|
1066
|
+
color: var(--dpk-ink);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
.sequence-operator {
|
|
1070
|
+
flex: none;
|
|
1071
|
+
min-width: 26px;
|
|
1072
|
+
font-family: var(--dpk-mono);
|
|
1073
|
+
font-weight: 700;
|
|
1074
|
+
color: var(--dpk-blue);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
.sequence-frame-count {
|
|
1078
|
+
flex: none;
|
|
1079
|
+
margin-left: auto;
|
|
1080
|
+
font-family: var(--dpk-mono);
|
|
1081
|
+
font-size: 9px;
|
|
1082
|
+
color: var(--dpk-ink-faint);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/* A branch or fold label is bounded by its frame (an inline max-width) and elides past it. */
|
|
1086
|
+
:is(.sequence-branch, .sequence-fold) {
|
|
1087
|
+
white-space: nowrap;
|
|
1088
|
+
overflow: hidden;
|
|
1089
|
+
text-overflow: ellipsis;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.sequence-branch {
|
|
1093
|
+
position: absolute;
|
|
1094
|
+
font-size: 9.5px;
|
|
1095
|
+
color: var(--dpk-ink-faint);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.sequence-fold {
|
|
1099
|
+
position: absolute;
|
|
1100
|
+
font-size: 10px;
|
|
1101
|
+
color: var(--dpk-ink-faint);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
.sequence-label {
|
|
1105
|
+
position: absolute;
|
|
1106
|
+
display: flex;
|
|
1107
|
+
align-items: center;
|
|
1108
|
+
gap: 6px;
|
|
1109
|
+
max-height: 27px;
|
|
1110
|
+
padding: 3px 5px;
|
|
1111
|
+
border: 1px solid transparent;
|
|
1112
|
+
border-radius: var(--dpk-radius-xs);
|
|
1113
|
+
background: var(--dpk-paper-raised);
|
|
1114
|
+
color: var(--dpk-ink-soft);
|
|
1115
|
+
font-size: 10px;
|
|
1116
|
+
text-align: left;
|
|
1117
|
+
cursor: pointer;
|
|
1118
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
1119
|
+
transition:
|
|
1120
|
+
border-color 160ms var(--dpk-ease),
|
|
1121
|
+
background 160ms var(--dpk-ease),
|
|
1122
|
+
color 160ms var(--dpk-ease),
|
|
1123
|
+
box-shadow 160ms var(--dpk-ease);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
.sequence-label:hover {
|
|
1127
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1128
|
+
color: var(--dpk-blue);
|
|
1129
|
+
box-shadow: var(--dpk-shadow-sm);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.sequence-label.is-selected {
|
|
1133
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
1134
|
+
background: var(--dpk-blue-soft);
|
|
1135
|
+
color: var(--dpk-blue);
|
|
1136
|
+
box-shadow:
|
|
1137
|
+
var(--dpk-shadow-xs),
|
|
1138
|
+
inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
.sequence-number {
|
|
1142
|
+
flex-shrink: 0;
|
|
1143
|
+
display: grid;
|
|
1144
|
+
place-items: center;
|
|
1145
|
+
width: 19px;
|
|
1146
|
+
height: 17px;
|
|
1147
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1148
|
+
border-radius: 3px;
|
|
1149
|
+
font-family: var(--dpk-mono);
|
|
1150
|
+
font-size: 8px;
|
|
1151
|
+
font-variant-numeric: tabular-nums;
|
|
1152
|
+
color: var(--dpk-ink-faint);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
.sequence-text {
|
|
1156
|
+
min-width: 0;
|
|
1157
|
+
white-space: nowrap;
|
|
1158
|
+
overflow: hidden;
|
|
1159
|
+
text-overflow: ellipsis;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
#seq-request .diagram-arrow,
|
|
1163
|
+
#seq-response .diagram-arrow {
|
|
1164
|
+
fill: var(--dpk-ink-faint);
|
|
1165
|
+
stroke: var(--dpk-ink-faint);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
#seq-async .diagram-arrow {
|
|
1169
|
+
stroke: var(--dpk-blue);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
#seq-related .diagram-arrow {
|
|
1173
|
+
fill: var(--dpk-green);
|
|
1174
|
+
stroke: var(--dpk-green);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
#seq-selected .diagram-arrow {
|
|
1178
|
+
fill: var(--dpk-ink);
|
|
1179
|
+
stroke: var(--dpk-ink);
|
|
1180
|
+
}
|
|
1181
|
+
`,on=[{id:"seq-request"},{id:"seq-response"},{id:"seq-async"},{id:"seq-related"},{id:"seq-selected"}];class Ft extends Fe{static{this.styles=[Y,rn]}#t=null;#n=new Map;#e=new Map;#s=new Set;#i=new Set;#a="";#r=0;commentItems(){const e=this.items();return[...e.participants.map(t=>({value:this.commentRef("participant",t.id),label:t.name})),...J(e.items).map(t=>({value:this.commentRef("message",t.id),label:t.title}))]}parseData(e){return this.#e.clear(),Rt(e)}emptyData(){return Ja()}defaultHeading(){return pe(this.locale).heading}shellClass(){return"sequence"}emptyMessage(){return pe(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):J(t.items).some(s=>s.id===e.id)}tagItems(){return J(this.items().items).map(e=>e.tags)}statsText(){const e=this.#t,t=J(this.items().items).length;return e===null?"":pe(this.locale).stats(e.rows.length,t)}contentSize(){const e=this.#t;return e===null||e.rows.length===0?null:{width:e.width,height:e.height}}isEmpty(){return this.contentSize()===null}layoutVersion(){return this.#r}refreshContent(){const e=this.#c(),t=this.tagFilter,s=[t.match,[...t.active].join(","),[...this.#e].map(([r,o])=>`${r}:${o}`).join(","),J(e.items).map(r=>r.id).join(",")].join("|");s!==this.#a&&(this.#a=s,this.#r+=1,this.#n=Xa(this.items()),this.#t=nn(e,r=>se(r.tags,t))),this.#s=new Set,this.#i=new Set;const n=this.selection,i=this.#t;if(n!==null&&i!==null)if(n.kind==="message"){const r=i.rows.find(o=>o.message.id===n.id);this.#s.add(n.id),r&&(this.#i.add(r.message.from),this.#i.add(r.message.to))}else for(const r of i.rows)r.message.from!==n.id&&r.message.to!==n.id||this.#s.add(r.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(`
|
|
1182
|
+
`)||e.title}#c(){const e=this.items(),t=s=>s.map(n=>n.kind==="message"?n:{...n,collapsed:this.#e.get(n.id)??n.collapsed,branches:n.branches.map(i=>({label:i.label,items:t(i.items)}))});return{participants:e.participants,items:t(e.items)}}#p(e){return this.#t?.frames.find(t=>t.fragment.id===e.id)?.fragment.collapsed??e.collapsed}#l(e){this.#e.set(e.id,!this.#p(e)),this.requestUpdate()}#u(e){const t=this.selection?.kind==="message"&&this.selection.id===e,s=!t&&this.#s.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.#i.has(e);return{selected:t,related:s,dimmed:this.selection!==null&&!t&&!s,depth:null}}renderAboveCanvas(){const e=this.#t;if(e===null)return b;const t=pe(this.locale);return u`
|
|
1183
|
+
<div class="sequence-rail" role="group" aria-label=${t.participants}>
|
|
1184
|
+
<div class="sequence-rail-world">
|
|
1185
|
+
${e.participants.map(s=>this.#b(s,e))}
|
|
1186
|
+
</div>
|
|
1187
|
+
</div>
|
|
1188
|
+
`}#b(e,t){const s=t.x.get(e.id)??0,n=this.#h(e.id);return u`
|
|
1189
|
+
<button
|
|
1190
|
+
type="button"
|
|
1191
|
+
class=${this.elementClass(n,"sequence-participant",e.external&&"is-external")}
|
|
1192
|
+
data-participant=${e.id}
|
|
1193
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
1194
|
+
style="left:${s-95}px"
|
|
1195
|
+
aria-pressed=${n.selected?"true":"false"}
|
|
1196
|
+
title=${e.description??e.name}
|
|
1197
|
+
@click=${()=>this.select({kind:"participant",id:e.id})}
|
|
1198
|
+
>
|
|
1199
|
+
<span class="sequence-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>
|
|
1200
|
+
<span class="sequence-names">
|
|
1201
|
+
<span class="sequence-name">${e.name}</span>
|
|
1202
|
+
${e.role===null?b:u`<span class="sequence-role">${e.role}</span>`}
|
|
1203
|
+
</span>
|
|
1204
|
+
</button>
|
|
1205
|
+
${this.renderCommentTrigger({kind:"participant",id:e.id},e.name,{x:s+95-34,y:17})}
|
|
1206
|
+
`}renderCanvas(){const e=this.#t;if(e===null)return u``;const t=pe(this.locale);return u`
|
|
1207
|
+
${this.#d(e,t)}
|
|
1208
|
+
${e.frames.map(s=>u`<div
|
|
1209
|
+
class="sequence-frame"
|
|
1210
|
+
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
1211
|
+
></div>`)}
|
|
1212
|
+
${e.frames.map(s=>this.#m(s.fragment,s.x,s.y,s.width,s.count,t))}
|
|
1213
|
+
${e.branches.map(s=>u`<span
|
|
1214
|
+
class="sequence-branch"
|
|
1215
|
+
style="left:${s.x}px; top:${s.y}px; max-width:${s.width}px"
|
|
1216
|
+
title=${s.label}
|
|
1217
|
+
>[${s.label}]</span
|
|
1218
|
+
>`)}
|
|
1219
|
+
${e.folds.map(s=>{const n=s.fragment.branches.map(i=>`[${i.label}]`).join(" / ");return u`<span
|
|
1220
|
+
class="sequence-fold"
|
|
1221
|
+
style="left:${s.x}px; top:${s.y}px; max-width:${s.width}px"
|
|
1222
|
+
title=${n}
|
|
1223
|
+
>${n}</span
|
|
1224
|
+
>`})}
|
|
1225
|
+
${e.rows.map(s=>this.#g(s.y,s.message,e,t))}
|
|
1226
|
+
`}#d(e,t){const s=e.participants.map(r=>R`<path
|
|
1227
|
+
class="sequence-lifeline"
|
|
1228
|
+
d=${`M${e.x.get(r.id)??0} 0 V${e.height}`}
|
|
1229
|
+
></path>`),n=e.dividers.map(r=>R`<path class="sequence-divider" d=${`M${r.x} ${r.y} h${r.width}`}></path>`),i=e.rows.map(r=>{const o=e.x.get(r.message.from)??0,d=e.x.get(r.message.to)??0,l=o===d?`M${o} ${r.y} h42 v25 H${o}`:`M${o} ${r.y} H${d}`,c=this.#u(r.message.id),h=c.selected?"seq-selected":c.related?"seq-related":r.message.style==="async"?"seq-async":r.message.style==="response"?"seq-response":"seq-request",p=()=>this.select({kind:"message",id:r.message.id});return R`
|
|
1230
|
+
<g
|
|
1231
|
+
class=${this.elementClass(c,"sequence-message-row","d-edge",`is-${r.message.style}`)}
|
|
1232
|
+
data-message=${r.message.id}
|
|
1233
|
+
>
|
|
1234
|
+
<title>${this.#o(r.message,t)}</title>
|
|
1235
|
+
<path class="d-edge-hit" d=${l} role="button" tabindex="0"
|
|
1236
|
+
aria-label=${t.selectMessage(r.message.title)}
|
|
1237
|
+
@click=${p}
|
|
1238
|
+
@keydown=${m=>{m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),p())}}></path>
|
|
1239
|
+
<path class="sequence-message is-${r.message.style}" d=${l} marker-end=${`url(#${h})`}></path>
|
|
1240
|
+
</g>
|
|
1241
|
+
`});return u`<svg class="diagram-edges" width=${e.width} height=${e.height}>
|
|
1242
|
+
${St(on)} ${s} ${n} ${i}
|
|
1243
|
+
</svg>`}#m(e,t,s,n,i,r){const o=this.#p(e);return u`
|
|
1244
|
+
<button
|
|
1245
|
+
type="button"
|
|
1246
|
+
class="sequence-frame-header"
|
|
1247
|
+
data-fragment=${e.id}
|
|
1248
|
+
style="left:${t}px; top:${s}px; width:${n}px"
|
|
1249
|
+
aria-expanded=${o?"false":"true"}
|
|
1250
|
+
aria-label=${r.frameHeaderLabel(e.operator,e.title,o)}
|
|
1251
|
+
@click=${()=>this.#l(e)}
|
|
1252
|
+
>
|
|
1253
|
+
<span class="sequence-frame-chevron">${o?rt():Xs()}</span>
|
|
1254
|
+
<span class="sequence-operator">${e.operator}</span>
|
|
1255
|
+
<span class="sequence-text">${e.title}</span>
|
|
1256
|
+
<span class="sequence-frame-count">${r.frameCount(i)}</span>
|
|
1257
|
+
</button>
|
|
1258
|
+
`}#g(e,t,s,n){const i=s.x.get(t.from)??0,r=s.x.get(t.to)??0,o=i===r,d=this.#u(t.id),l=o?i+12:Math.min(i,r)+14,c=o?175:Math.abs(r-i)-28;return u`
|
|
1259
|
+
<button
|
|
1260
|
+
type="button"
|
|
1261
|
+
class=${this.elementClass(d,"sequence-label")}
|
|
1262
|
+
data-message-label=${t.id}
|
|
1263
|
+
data-grill-questions=${this.questionsOf(t)}
|
|
1264
|
+
style="left:${l}px; top:${e-28}px; width:${c}px"
|
|
1265
|
+
title=${this.#o(t,n)}
|
|
1266
|
+
@click=${()=>this.select({kind:"message",id:t.id})}
|
|
1267
|
+
>
|
|
1268
|
+
<span class="sequence-number">${this.#n.get(t.id)??""}</span>
|
|
1269
|
+
<span class="sequence-text">${t.title}</span>
|
|
1270
|
+
</button>
|
|
1271
|
+
${this.renderCommentTrigger({kind:"message",id:t.id},`${this.#n.get(t.id)??""} ${t.title}`.trim(),{x:l+c-30,y:e-31})}
|
|
1272
|
+
`}}const Nt=()=>{customElements.get("dpk-component-sequence-diagram")||customElements.define("dpk-component-sequence-diagram",Ft)},ae=H({en:{heading:"Dependencies",node:"Module",edge:"Dependency",emptyCycles:"No matching cycles.",emptyModules:"No matching modules.",directionGroup:"Direction to follow from the selected module",directionOutgoing:"Depends on",directionIncoming:"Depended on by",directionBoth:"Both",transitive:"Include indirect",cyclesToggleLabel:a=>`Show only ${a} cycle group(s)`,cyclesCount:a=>`Cycles ${a}`,legendOutgoing:"Depends on",legendIncoming:"Depended on by",legendCycle:"Cycle",edgeLabel:(a,e)=>`${a} depends on ${e}`,cyclicSuffix:a=>`${a}, part of a cycle`,cycleBadge:"Cycle"},ja:{heading:"\u4F9D\u5B58\u95A2\u4FC2\u30B0\u30E9\u30D5",node:"\u30E2\u30B8\u30E5\u30FC\u30EB",edge:"\u4F9D\u5B58",emptyCycles:"\u8A72\u5F53\u3059\u308B\u5FAA\u74B0\u4F9D\u5B58\u306F\u3042\u308A\u307E\u305B\u3093\u3002",emptyModules:"\u8A72\u5F53\u3059\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002",directionGroup:"\u9078\u629E\u3057\u305F\u30E2\u30B8\u30E5\u30FC\u30EB\u304B\u3089\u8FFD\u3046\u65B9\u5411",directionOutgoing:"\u4F9D\u5B58\u5148",directionIncoming:"\u4F9D\u5B58\u5143",directionBoth:"\u4E21\u65B9",transitive:"\u9593\u63A5\u3082\u542B\u3080",cyclesToggleLabel:a=>`\u5FAA\u74B0\u4F9D\u5B58 ${a} \u30B0\u30EB\u30FC\u30D7\u3060\u3051\u8868\u793A`,cyclesCount:a=>`\u5FAA\u74B0 ${a}`,legendOutgoing:"\u4F9D\u5B58\u5148",legendIncoming:"\u4F9D\u5B58\u5143",legendCycle:"\u5FAA\u74B0",edgeLabel:(a,e)=>`${a} \u304C ${e} \u306B\u4F9D\u5B58`,cyclicSuffix:a=>`${a}\u30FB\u5FAA\u74B0\u4F9D\u5B58\u3042\u308A`,cycleBadge:"\u5FAA\u74B0"}}),Pt={width:176,height:84},dn=T({id:$(g(),S(1)),name:$(g(),S(1)),path:k(g()),layer:k(g()),tags:k(D(g()),[]),description:k(g()),questions:k(g())}),ln=T({id:$(g(),S(1)),from:$(g(),S(1)),to:$(g(),S(1)),contract:k(g()),description:k(g()),questions:k(g())}),cn=T({modules:D(dn),dependencies:k(D(ln),[])}),pn=()=>({nodes:[],edges:[]}),un=a=>{const e=K(cn,a),t=new Set;for(const r of e.modules){if(t.has(r.id))throw new Error(`duplicate module id: ${r.id}`);t.add(r.id)}const s=new Set,n=e.dependencies.map(r=>{if(s.has(r.id))throw new Error(`duplicate dependency id: ${r.id}`);if(s.add(r.id),!t.has(r.from))throw new Error(`unknown dependency source: ${r.from}`);if(!t.has(r.to))throw new Error(`unknown dependency target: ${r.to}`);return{id:r.id,from:r.from,to:r.to,tags:[],contract:r.contract??null,description:r.description??null}});return{nodes:e.modules.map(r=>({id:r.id,name:r.name,path:r.path??null,layer:r.layer??null,description:r.description??null,tags:r.tags,width:Pt.width,height:Pt.height,...r.questions===void 0?{}:{questions:r.questions}})),edges:n}},hn=G`
|
|
1273
|
+
.dep-direction {
|
|
1274
|
+
display: flex;
|
|
1275
|
+
gap: 2px;
|
|
1276
|
+
padding: 3px;
|
|
1277
|
+
border: 1px solid var(--dpk-rule);
|
|
1278
|
+
border-radius: var(--dpk-radius-sm);
|
|
1279
|
+
background: var(--dpk-paper-sunken);
|
|
1280
|
+
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
.dep-direction button {
|
|
1284
|
+
border: 0;
|
|
1285
|
+
border-radius: var(--dpk-radius-xs);
|
|
1286
|
+
padding: 4px 8px;
|
|
1287
|
+
background: transparent;
|
|
1288
|
+
color: var(--dpk-ink-faint);
|
|
1289
|
+
font-size: 9.5px;
|
|
1290
|
+
font-weight: 600;
|
|
1291
|
+
cursor: pointer;
|
|
1292
|
+
transition:
|
|
1293
|
+
background 160ms var(--dpk-ease),
|
|
1294
|
+
color 160ms var(--dpk-ease),
|
|
1295
|
+
box-shadow 160ms var(--dpk-ease);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.dep-direction button[aria-pressed='true'] {
|
|
1299
|
+
background: var(--dpk-paper-raised);
|
|
1300
|
+
color: var(--dpk-ink);
|
|
1301
|
+
font-weight: 650;
|
|
1302
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
.dep-toggle {
|
|
1306
|
+
min-height: 26px;
|
|
1307
|
+
padding: 0 8px;
|
|
1308
|
+
font-size: 10.5px;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
.dep-toggle[aria-pressed='true'] {
|
|
1312
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1313
|
+
background: var(--dpk-blue-soft);
|
|
1314
|
+
color: var(--dpk-blue);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
.dep-module {
|
|
1318
|
+
display: flex;
|
|
1319
|
+
flex-direction: column;
|
|
1320
|
+
gap: 5px;
|
|
1321
|
+
padding: 11px 12px;
|
|
1322
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1323
|
+
border-radius: var(--dpk-radius-sm);
|
|
1324
|
+
background: var(--dpk-paper-raised);
|
|
1325
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1326
|
+
text-align: left;
|
|
1327
|
+
overflow: hidden;
|
|
1328
|
+
transition:
|
|
1329
|
+
border-color 160ms var(--dpk-ease),
|
|
1330
|
+
box-shadow 160ms var(--dpk-ease),
|
|
1331
|
+
transform 160ms var(--dpk-ease);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
.dep-module:hover {
|
|
1335
|
+
border-color: var(--dpk-blue);
|
|
1336
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
1337
|
+
transform: translateY(-1px);
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
.dep-module.is-cyclic:not(.is-selected) {
|
|
1341
|
+
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.dep-module.is-selected {
|
|
1345
|
+
border-color: var(--dpk-blue);
|
|
1346
|
+
background: var(--dpk-blue-soft);
|
|
1347
|
+
box-shadow:
|
|
1348
|
+
var(--dpk-bevel),
|
|
1349
|
+
var(--dpk-shadow-sm),
|
|
1350
|
+
0 0 0 3px var(--dpk-blue-soft);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.dep-module.is-related {
|
|
1354
|
+
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
1355
|
+
background: var(--dpk-green-soft);
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
.dep-module.is-dependency {
|
|
1359
|
+
border-color: color-mix(in srgb, #6e9b61 60%, transparent);
|
|
1360
|
+
background: color-mix(in srgb, #6e9b61 8%, transparent);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
.dep-module.is-dependent {
|
|
1364
|
+
border-color: color-mix(in srgb, #729aaa 60%, transparent);
|
|
1365
|
+
background: color-mix(in srgb, #729aaa 8%, transparent);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
.dep-head {
|
|
1369
|
+
display: flex;
|
|
1370
|
+
align-items: center;
|
|
1371
|
+
justify-content: space-between;
|
|
1372
|
+
gap: 6px;
|
|
1373
|
+
min-height: 14px;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
.dep-layer {
|
|
1377
|
+
font-size: 9px;
|
|
1378
|
+
color: var(--dpk-ink-faint);
|
|
1379
|
+
white-space: nowrap;
|
|
1380
|
+
overflow: hidden;
|
|
1381
|
+
text-overflow: ellipsis;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.dep-cycle-badge {
|
|
1385
|
+
flex-shrink: 0;
|
|
1386
|
+
padding: 1px 4px;
|
|
1387
|
+
border-radius: 3px;
|
|
1388
|
+
background: var(--dpk-amber-soft);
|
|
1389
|
+
color: var(--dpk-amber);
|
|
1390
|
+
font-size: 8.5px;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
.dep-name {
|
|
1394
|
+
font-size: 13px;
|
|
1395
|
+
font-weight: 640;
|
|
1396
|
+
letter-spacing: -0.01em;
|
|
1397
|
+
white-space: nowrap;
|
|
1398
|
+
overflow: hidden;
|
|
1399
|
+
text-overflow: ellipsis;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
.dep-path {
|
|
1403
|
+
font-family: var(--dpk-mono);
|
|
1404
|
+
font-size: 9px;
|
|
1405
|
+
color: var(--dpk-ink-faint);
|
|
1406
|
+
white-space: nowrap;
|
|
1407
|
+
overflow: hidden;
|
|
1408
|
+
text-overflow: ellipsis;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
.dep-edge .d-edge-path {
|
|
1412
|
+
stroke: var(--dpk-rule-strong);
|
|
1413
|
+
stroke-width: 1.4;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
.dep-edge.is-related .d-edge-path {
|
|
1417
|
+
stroke: var(--dpk-green);
|
|
1418
|
+
stroke-width: 2;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
.dep-edge.is-selected .d-edge-path {
|
|
1422
|
+
stroke: var(--dpk-blue);
|
|
1423
|
+
stroke-width: 2.6;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
.dep-edge:focus-visible .d-edge-path {
|
|
1427
|
+
stroke: var(--dpk-blue);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
.diagram-legend .dep-swatch-outgoing {
|
|
1431
|
+
border-color: #6e9b61;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
.diagram-legend .dep-swatch-incoming {
|
|
1435
|
+
border-color: #729aaa;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
.diagram-legend .dep-swatch-cycle {
|
|
1439
|
+
border-color: var(--dpk-amber);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
#dep-neutral .diagram-arrow {
|
|
1443
|
+
fill: var(--dpk-rule-strong);
|
|
1444
|
+
stroke: var(--dpk-rule-strong);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
#dep-outgoing .diagram-arrow {
|
|
1448
|
+
fill: #6e9b61;
|
|
1449
|
+
stroke: #6e9b61;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
#dep-incoming .diagram-arrow {
|
|
1453
|
+
fill: #729aaa;
|
|
1454
|
+
stroke: #729aaa;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
#dep-cycle .diagram-arrow {
|
|
1458
|
+
fill: var(--dpk-amber);
|
|
1459
|
+
stroke: var(--dpk-amber);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
#dep-selected .diagram-arrow {
|
|
1463
|
+
fill: var(--dpk-blue);
|
|
1464
|
+
stroke: var(--dpk-blue);
|
|
1465
|
+
}
|
|
1466
|
+
`,mn=[{id:"dep-neutral"},{id:"dep-outgoing"},{id:"dep-incoming"},{id:"dep-cycle"},{id:"dep-selected"}];class jt extends ce{static{this.styles=[Y,hn]}#t="both";#n=!1;#e=!1;#s=[];#i=W;#a=W;parseData(e){return un(e)}emptyData(){return pn()}defaultHeading(){return ae(this.locale).heading}statsLabels(){const e=ae(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){const e=ae(this.locale);return this.#e?e.emptyCycles:e.emptyModules}layoutOptions(){return{nodeSpacing:40,layerSpacing:96,padding:32}}relations(e,t){return e===null||e.kind!=="node"?W:{nodes:new Map([...this.#i.nodes,...this.#a.nodes]),edges:new Set([...this.#i.edges,...this.#a.edges])}}refreshContent(){const e=this.items(),t=this.tagFilter,s=e.nodes.filter(o=>se(o.tags,t)),n=new Set(s.map(o=>o.id)),i=e.edges.filter(o=>n.has(o.from)&&n.has(o.to));this.#s=Ma(s.map(o=>o.id),i);const r=this.selection;this.#i=r!==null&&r.kind==="node"&&this.#t!=="incoming"?j(i,r.id,"outgoing",this.#n):W,this.#a=r!==null&&r.kind==="node"&&this.#t!=="outgoing"?j(i,r.id,"incoming",this.#n):W,super.refreshContent()}matchesFilter(e){return this.#e?ze(this.#s).has(e.id):!0}filtered(){const e=super.filtered();if(!this.#e)return e;const t=ze(this.#s),s=e.edges.filter(i=>wt(i,t)),n=new Set(s.flatMap(i=>[i.from,i.to]));return{nodes:e.nodes.filter(i=>n.has(i.id)),edges:s}}renderToolbarActions(){const e=ae(this.locale),t=this.#s.length;return u`
|
|
1467
|
+
<div class="dep-direction" role="group" aria-label=${e.directionGroup}>
|
|
1468
|
+
${[["outgoing",e.directionOutgoing],["incoming",e.directionIncoming],["both",e.directionBoth]].map(([s,n])=>u`
|
|
1469
|
+
<button
|
|
1470
|
+
type="button"
|
|
1471
|
+
data-direction=${s}
|
|
1472
|
+
aria-pressed=${this.#t===s?"true":"false"}
|
|
1473
|
+
@click=${()=>this.#r(s)}
|
|
1474
|
+
>
|
|
1475
|
+
${n}
|
|
1476
|
+
</button>
|
|
1477
|
+
`)}
|
|
1478
|
+
</div>
|
|
1479
|
+
<button
|
|
1480
|
+
type="button"
|
|
1481
|
+
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1482
|
+
data-toggle="transitive"
|
|
1483
|
+
aria-pressed=${this.#n?"true":"false"}
|
|
1484
|
+
@click=${()=>{this.#n=!this.#n,this.requestUpdate()}}
|
|
1485
|
+
>
|
|
1486
|
+
${e.transitive}
|
|
1487
|
+
</button>
|
|
1488
|
+
<button
|
|
1489
|
+
type="button"
|
|
1490
|
+
class="dpk-btn dpk-btn--ghost dep-toggle"
|
|
1491
|
+
data-toggle="cycles"
|
|
1492
|
+
aria-pressed=${this.#e?"true":"false"}
|
|
1493
|
+
aria-label=${e.cyclesToggleLabel(t)}
|
|
1494
|
+
?disabled=${!this.#e&&t===0}
|
|
1495
|
+
@click=${()=>{this.#e=!this.#e,this.requestUpdate()}}
|
|
1496
|
+
>
|
|
1497
|
+
${e.cyclesCount(t)}
|
|
1498
|
+
</button>
|
|
1499
|
+
`}renderLegend(){const e=ae(this.locale);return u`<div class="diagram-legend">
|
|
1500
|
+
<span><i class="dep-swatch-outgoing"></i>${e.legendOutgoing}</span>
|
|
1501
|
+
<span><i class="dep-swatch-incoming"></i>${e.legendIncoming}</span>
|
|
1502
|
+
<span><i class="dep-swatch-cycle"></i>${e.legendCycle}</span>
|
|
1503
|
+
</div>`}#r(e){this.#t=e,this.requestUpdate()}#o(e,t){const s=this.selection;return s!==null&&s.kind==="edge"&&s.id===e.id?"dep-selected":wt(e,t)?"dep-cycle":this.#i.edges.has(e.id)?"dep-outgoing":this.#a.edges.has(e.id)?"dep-incoming":"dep-neutral"}renderCanvas(){const e=ae(this.locale),t=this.visible,s=ze(this.#s),n=o=>t.nodes.find(d=>d.id===o)?.name??o,i=t.edges.map(o=>{const d=this.edgeState(o.id),l=this.routeOf(o.id),c=we(l),h=()=>this.select({kind:"edge",id:o.id});return R`
|
|
1504
|
+
<g class=${this.elementClass(d,"d-edge","dep-edge")} data-dependency=${o.id}>
|
|
1505
|
+
<title>${[o.contract,o.description].filter(p=>p!==null).join(`
|
|
1506
|
+
`)||o.id}</title>
|
|
1507
|
+
<path class="d-edge-path" d=${c} marker-end=${`url(#${this.#o(o,s)})`}></path>
|
|
1508
|
+
<path
|
|
1509
|
+
class="d-edge-hit"
|
|
1510
|
+
d=${c}
|
|
1511
|
+
role="button"
|
|
1512
|
+
tabindex="0"
|
|
1513
|
+
aria-label=${e.edgeLabel(n(o.from),n(o.to))}
|
|
1514
|
+
@click=${h}
|
|
1515
|
+
@keydown=${p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),h())}}
|
|
1516
|
+
></path>
|
|
1517
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${n(o.from)} \u2192 ${n(o.to)}`,l)}
|
|
1518
|
+
</g>
|
|
1519
|
+
`}),r=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),h=this.#i.nodes.has(o.id),p=this.#a.nodes.has(o.id);return u`
|
|
1520
|
+
<button
|
|
1521
|
+
type="button"
|
|
1522
|
+
class=${this.elementClass(l,"d-node","dep-module",c&&"is-cyclic",h&&"is-dependency",p&&"is-dependent")}
|
|
1523
|
+
data-module=${o.id}
|
|
1524
|
+
data-grill-questions=${this.questionsOf(o)}
|
|
1525
|
+
style="left:${d.x}px; top:${d.y}px; width:${o.width}px; height:${o.height}px"
|
|
1526
|
+
aria-pressed=${l.selected?"true":"false"}
|
|
1527
|
+
aria-label=${c?e.cyclicSuffix(o.name):o.name}
|
|
1528
|
+
title=${[o.path??o.name,o.description].filter(m=>m!==null).join(`
|
|
1529
|
+
`)}
|
|
1530
|
+
@click=${()=>this.select({kind:"node",id:o.id})}
|
|
1531
|
+
>
|
|
1532
|
+
<span class="dep-head">
|
|
1533
|
+
<span class="dep-layer">${o.layer??""}</span>
|
|
1534
|
+
${c?u`<span class="dep-cycle-badge">${e.cycleBadge}</span>`:b}
|
|
1535
|
+
</span>
|
|
1536
|
+
<span class="dep-name">${o.name}</span>
|
|
1537
|
+
<span class="dep-path">${o.path??""}</span>
|
|
1538
|
+
</button>
|
|
1539
|
+
${this.renderCommentTrigger({kind:"node",id:o.id},o.name,{x:d.x+o.width-20,y:d.y-14})}
|
|
1540
|
+
`});return u`${this.renderEdges(i,mn)}${r}`}}const Ut=()=>{customElements.get("dpk-component-dependency-graph")||customElements.define("dpk-component-dependency-graph",jt)},_t=(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],X=H({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=>_t(a,!0),edgeLabel:(a,e,t)=>`${a} and ${e}, related ${t}`,was:a=>`was ${a}`,nullable:"nullable",notNull:"not null",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",addFieldButton:"Add column",addFieldTitle:"Add column",addFieldName:"Column name",addFieldType:"Type",columnNameLabel:"Name",columnNamePlaceholder:"column_name",columnTypePlaceholder:"e.g. text",columnTypeChoices:"Types in this schema",columnTypeNew:"New type",columnNullable:"Allow NULL",columnNameTaken:"This table already has a column with this name.",cancel:"Cancel",columnAdd:"Add",columnSave:"Save",columnKeys:"Enter to confirm \xB7 Esc to cancel",addFieldSummary:(a,e,t)=>`${a}.${e} (${t})`,editFieldButton:a=>`Edit ${a}`,editFieldTitle:"Edit column",editFieldSummary:(a,e,t)=>`${a}.${e} \u2192 ${t}`,columnRole:a=>({primary:"Primary key",foreign:"Foreign key","not-null":"NOT NULL",nullable:"Nullable"})[a],changesLabel:"Changes",attributeLabel:a=>({type:"type",keys:"keys",ref:"ref",nullable:"null",cardinality:"card.",label:"label"})[a]},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=>_t(a,!1),edgeLabel:(a,e,t)=>`${a} \u3068 ${e} \u306E\u95A2\u9023 (${t})`,was:a=>`\u5909\u66F4\u524D ${a}`,nullable:"NULL \u53EF",notNull:"NOT NULL",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",addFieldButton:"\u30AB\u30E9\u30E0\u3092\u8FFD\u52A0",addFieldTitle:"\u30AB\u30E9\u30E0\u3092\u8FFD\u52A0",addFieldName:"\u30AB\u30E9\u30E0\u540D",addFieldType:"\u578B",columnNameLabel:"\u540D\u524D",columnNamePlaceholder:"column_name",columnTypePlaceholder:"\u4F8B: text",columnTypeChoices:"\u3053\u306E\u30B9\u30AD\u30FC\u30DE\u306E\u578B",columnTypeNew:"\u65B0\u3057\u3044\u578B",columnNullable:"NULL \u3092\u8A31\u53EF",columnNameTaken:"\u540C\u3058\u540D\u524D\u306E\u30AB\u30E9\u30E0\u304C\u3059\u3067\u306B\u3042\u308A\u307E\u3059\u3002",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",columnAdd:"\u8FFD\u52A0",columnSave:"\u4FDD\u5B58",columnKeys:"Enter \u3067\u78BA\u5B9A \xB7 Esc \u3067\u9589\u3058\u308B",addFieldSummary:(a,e,t)=>`${a}.${e} (${t})`,editFieldButton:a=>`${a} \u3092\u7DE8\u96C6`,editFieldTitle:"\u30AB\u30E9\u30E0\u3092\u7DE8\u96C6",editFieldSummary:(a,e,t)=>`${a}.${e} \u2192 ${t}`,columnRole:a=>({primary:"\u4E3B\u30AD\u30FC",foreign:"\u5916\u90E8\u30AD\u30FC","not-null":"NOT NULL",nullable:"NULL \u53EF"})[a],changesLabel:"\u5909\u66F4\u70B9",attributeLabel:a=>({type:"\u578B",keys:"\u30AD\u30FC",ref:"\u53C2\u7167",nullable:"NULL",cardinality:"\u591A\u91CD\u5EA6",label:"\u30E9\u30D9\u30EB"})[a]}}),Bt=280,Pe=40,gn=32,fn=52,Ht=["1","0..1"],Gt=["1","0..1","1..N","0..N"],bn=Ht.flatMap(a=>Gt.map(e=>`${a}:${e}`)),Kt=_(["PK","FK","UQ"]),kn=T({id:$(g(),S(1)),type:$(g(),S(1)),key:k(Zs([Kt,$(D(Kt),S(1))])),ref:k(g()),nullable:k(re(),!1),cardinality:k(_(bn)),label:k($(g(),S(1))),questions:k(g())}),xn=T({id:$(g(),S(1)),name:$(g(),S(1)),tags:k(D(g()),[]),fields:D(kn),questions:k(g())}),Wt=T({tables:D(xn)}),vn=T({before:k(Wt),after:Wt}),yn=()=>({nodes:[],edges:[]}),je=a=>a.key===void 0?[]:[...new Set(typeof a.key=="string"?[a.key]:a.key)],Vt=a=>({id:a.id,type:a.type,keys:je(a),ref:a.ref??null,nullable:a.nullable,cardinality:a.cardinality??null,label:a.label??null,questions:a.questions??null}),Ue=(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,Se=a=>`${a.parent} : ${a.child}`,wn=(a,e)=>Se(a.cardinality)===Se(e.cardinality)&&a.label===e.label,$n=(a,e)=>{const t=je(e);return t.includes("UQ")?!0:t.includes("PK")&&a.fields.filter(s=>je(s).includes("PK")).length===1},Sn=new Map(Ht.map(a=>[a,a])),Mn=new Map(Gt.map(a=>[a,a])),Cn=(a,e)=>{const t=$n(a,e),s={parent:e.nullable?"0..1":"1",child:t?"0..1":"0..N"};if(e.cardinality===void 0)return s;const[n="",i=""]=e.cardinality.split(":"),r=Sn.get(n),o=Mn.get(i),d=`${a.id}.${e.id}`;if(r===void 0||o===void 0)throw new Error(`invalid cardinality on ${d}`);if(r!==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:r,child:o}},_e=a=>a.status==="changed"?fn:gn,Yt=a=>Pe+a.reduce((e,t)=>e+_e(t),0),Jt=(a,e)=>{let t=Pe;for(const s of a){if(s.id===e)return t+_e(s)/2;t+=_e(s)}return Pe/2},En=14,qn=(a,e)=>(a-(e-1)/2)*En,Be=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,qn(n,t.length)])))},Xt=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:Cn(e,t),label:t.label??null}]})),Tn=(a,e)=>[...new Set([...a,...e].map(s=>s.id))].flatMap(s=>{const n=a.find(l=>l.id===s),i=e.find(l=>l.id===s),r=i??n;if(!r)return[];const o=Vt(r);if(!n)return[{...o,status:"added",before:null}];if(!i)return[{...o,status:"removed",before:null}];const d=Vt(n);return[{...o,status:Ue(d,o)?"same":"changed",before:Ue(d,o)?null:d}]}),Zt=(a,e)=>{const t=Be(e),s={};for(const n of e)n.from===a.id&&(s[`${n.id}:out`]={x:Bt,y:Jt(a.fields,n.sourceField)+(t.get(n.id)??0)}),n.to===a.id&&(s[`${n.id}:in`]={x:0,y:Jt(a.fields,n.targetField)});return{...a,ports:s}},Dn=a=>{const e=K(vn,a),t=e.before?.tables??e.after.tables,s=e.after.tables,n=[...new Set([...t,...s].map(p=>p.id))],i=new Map;for(const p of[...t,...s])i.set(p.id,p.tags);const r=n.flatMap(p=>{const m=t.find(E=>E.id===p),v=s.find(E=>E.id===p),x=v??m;if(!x)return[];const w=Tn(m?.fields??[],v?.fields??[]),y=m?v?w.some(E=>E.status!=="same")?"changed":"same":"removed":"added";return[{id:p,name:x.name,status:y,fields:w,tags:i.get(p)??[],width:Bt,height:Yt(w),...x.questions===void 0?{}:{questions:x.questions}}]}),o=new Map(r.map(p=>[p.id,p])),d=Xt(t),l=Xt(s),h=[...new Set([...d,...l].map(p=>p.id))].flatMap(p=>{const m=d.find(I=>I.id===p),v=l.find(I=>I.id===p),x=v??m;if(!x)return[];const w=o.get(x.from),y=o.get(x.to);if(!w||!y)return[];const E=m&&v&&!wn(m,v)?m:null,O=m?v?E?"changed":"same":"removed":"added";return[{id:p,from:x.from,to:x.to,sourceField:x.sourceField,targetField:x.targetField,cardinality:x.cardinality,label:x.label,before:E&&{cardinality:E.cardinality,label:E.label},status:O,tags:[],fromPort:`${p}:out`,toPort:`${p}:in`}]});return{nodes:r.map(p=>Zt(p,h)),edges:h}},Qt="ADD_FIELD",es="EDIT_FIELD",Ln=de({id:$(g(),te(),S(1)),type:$(g(),te(),S(1)),nullable:k(re(),!1)}),zn=de({field:$(g(),S(1)),type:$(g(),te(),S(1)),nullable:re()}),ts=a=>{const e=Ae(a);return e?.length===3&&e[1]==="node"?e[2]??null:null},ss=(a,e,t)=>{const s=a.nodes.map(n=>{if(n.id!==e)return n;const i=n.status==="added"||n.status==="removed"?n.status:t.some(r=>r.status!=="same")?"changed":"same";return Zt({...n,status:i,fields:t,height:Yt(t)},a.edges)});return{...a,nodes:s}},An=(a,e,t)=>{const s=a.addFieldTitle,n=e.nodes.find(o=>o.id===ts(t.target.id));if(n===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=oe(Ln,t.payload);if(!i.success||n.fields.some(o=>o.id===i.output.id))return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const r={id:i.output.id,type:i.output.type,keys:[],ref:null,nullable:i.output.nullable,cardinality:null,label:null,questions:null,status:"added",before:null};return{data:ss(e,n.id,[...n.fields,r]),result:{id:t.id,title:s,summary:a.addFieldSummary(n.id,r.id,r.type),tone:"create"}}},Rn=(a,e,t)=>{const s=a.editFieldTitle,n=e.nodes.find(v=>v.id===ts(t.target.id)),i=oe(zn,t.payload),r=i.success?n?.fields.find(v=>v.id===i.output.field):void 0;if(n===void 0||i.success&&r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};if(!i.success||r===void 0||r.ref!==null||r.status==="removed")return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const{before:o,status:d,...l}=r,c={...l,type:i.output.type,nullable:i.output.nullable},h=r.before??l,p=r.status==="added"?"added":Ue(h,c)?"same":"changed",m={...c,status:p,before:p==="changed"?h:null};return{data:ss(e,n.id,n.fields.map(v=>v.id===r.id?m:v)),result:{id:t.id,title:s,summary:a.editFieldSummary(n.id,r.id,c.type),tone:"update"}}},On=(a,e,t)=>{let s=e;const n=[];for(const i of t){const r=i.type===Qt?An(a,s,i):i.type===es?Rn(a,s,i):{data:s,result:{id:i.id,title:i.type,stale:"unsupported-action-type"}};s=r.data,n.push(r.result)}return{data:s,results:n}},In=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"}}},He=4,as=6,Fn=12,ns=7,Nn=7,Pn=14,jn=19,Un=6,_n=(a,e)=>{const t=e==="start"?a:[...a].reverse(),[s]=t,n=t.find(r=>s!==void 0&&(r.x!==s.x||r.y!==s.y));if(s===void 0||n===void 0)return{x:e==="start"?1:-1,y:0};const i=Math.hypot(n.x-s.x,n.y-s.y);return{x:(n.x-s.x)/i,y:(n.y-s.y)/i}},is=a=>Math.round(a*100)/100||0,Bn=(a,e,t)=>{const s=(e==="start"?a[0]:a.at(-1))??{x:0,y:0},n=_n(a,e),i={x:-n.y,y:n.x},r=(w,y=0)=>({x:is(s.x+n.x*w+i.x*y),y:is(s.y+n.y*w+i.y*y)}),o=w=>[r(w,-as),r(w,as)],d=In(t),l=d.max==="many"?[-ns,0,ns].map(w=>[r(Fn),r(0,w)]):[o(Nn)],c=d.max==="many"?jn:Pn,h=c+He-2,p=d.min==="one"?[...l,o(c)]:l,m=d.min==="zero"?r(h):null,v=(d.min==="zero"?h+He:c)+Un,x=r(v);return{segments:p,circle:m,label:{...x,anchor:n.x>=0?"start":"end"}}},Hn=G`
|
|
1541
|
+
.er-search {
|
|
1542
|
+
display: flex;
|
|
1543
|
+
align-items: center;
|
|
1544
|
+
gap: 6px;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
.er-search .dpk-input {
|
|
1548
|
+
width: 150px;
|
|
1549
|
+
min-height: 26px;
|
|
1550
|
+
font-size: 11px;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/* ---- Table card ---- */
|
|
1554
|
+
|
|
1555
|
+
.er-table {
|
|
1556
|
+
/* Where a row's name starts: the left padding plus the icon and its gap. */
|
|
1557
|
+
--er-indent: 33px;
|
|
1558
|
+
display: flex;
|
|
1559
|
+
flex-direction: column;
|
|
1560
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1561
|
+
border-radius: var(--dpk-radius-xs);
|
|
1562
|
+
background: var(--dpk-paper-raised);
|
|
1563
|
+
box-shadow: var(--dpk-shadow-sm);
|
|
1564
|
+
overflow: hidden;
|
|
1565
|
+
cursor: default;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
.er-table.has-diff {
|
|
1569
|
+
/* Plus the change mark's column. */
|
|
1570
|
+
--er-indent: 50px;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.er-table.is-added {
|
|
1574
|
+
border-color: color-mix(in srgb, var(--dpk-green) 60%, transparent);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.er-table.is-removed {
|
|
1578
|
+
border-style: dashed;
|
|
1579
|
+
border-color: color-mix(in srgb, var(--dpk-accent) 60%, transparent);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.er-table.is-changed {
|
|
1583
|
+
border-color: color-mix(in srgb, var(--dpk-amber) 55%, transparent);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
.er-table.is-lit {
|
|
1587
|
+
border-color: var(--dpk-blue);
|
|
1588
|
+
box-shadow:
|
|
1589
|
+
var(--dpk-shadow-sm),
|
|
1590
|
+
0 0 18px color-mix(in srgb, var(--dpk-blue) 30%, transparent);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
.er-table.is-selected {
|
|
1594
|
+
border-color: var(--dpk-blue);
|
|
1595
|
+
box-shadow:
|
|
1596
|
+
inset 0 0 0 1px var(--dpk-blue),
|
|
1597
|
+
var(--dpk-shadow-sm),
|
|
1598
|
+
0 0 22px color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
.er-head {
|
|
1602
|
+
display: flex;
|
|
1603
|
+
align-items: center;
|
|
1604
|
+
gap: 2px;
|
|
1605
|
+
min-height: 40px;
|
|
1606
|
+
flex-shrink: 0;
|
|
1607
|
+
padding-right: 6px;
|
|
1608
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
1609
|
+
background: color-mix(in srgb, var(--dpk-paper-inset) 60%, var(--dpk-paper-raised));
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
.er-head-select {
|
|
1613
|
+
display: flex;
|
|
1614
|
+
align-items: center;
|
|
1615
|
+
gap: 7px;
|
|
1616
|
+
flex: 1;
|
|
1617
|
+
min-width: 0;
|
|
1618
|
+
align-self: stretch;
|
|
1619
|
+
padding: 8px 4px 8px 10px;
|
|
1620
|
+
border: 0;
|
|
1621
|
+
background: none;
|
|
1622
|
+
color: var(--dpk-ink);
|
|
1623
|
+
font: inherit;
|
|
1624
|
+
text-align: left;
|
|
1625
|
+
cursor: pointer;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
.er-head-select:focus-visible {
|
|
1629
|
+
outline: none;
|
|
1630
|
+
box-shadow: inset 0 0 0 2px var(--dpk-blue);
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
.er-table-icon {
|
|
1634
|
+
display: grid;
|
|
1635
|
+
place-items: center;
|
|
1636
|
+
flex-shrink: 0;
|
|
1637
|
+
width: 16px;
|
|
1638
|
+
color: var(--dpk-ink-faint);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.er-table-icon svg {
|
|
1642
|
+
width: 15px;
|
|
1643
|
+
height: 15px;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
.er-table.is-lit .er-table-icon,
|
|
1647
|
+
.er-table.is-selected .er-table-icon {
|
|
1648
|
+
color: var(--dpk-blue);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.er-title {
|
|
1652
|
+
display: flex;
|
|
1653
|
+
flex-wrap: wrap;
|
|
1654
|
+
align-items: baseline;
|
|
1655
|
+
gap: 0 7px;
|
|
1656
|
+
min-width: 0;
|
|
1657
|
+
flex: 1;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
.er-name {
|
|
1661
|
+
/* The id is what the schema is read by: it wraps rather than being cut. */
|
|
1662
|
+
min-width: 0;
|
|
1663
|
+
overflow-wrap: anywhere;
|
|
1664
|
+
font-size: 13px;
|
|
1665
|
+
font-weight: 600;
|
|
1666
|
+
letter-spacing: -0.01em;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
.er-table.is-removed .er-name {
|
|
1670
|
+
text-decoration: line-through;
|
|
1671
|
+
color: var(--dpk-ink-soft);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
.er-label {
|
|
1675
|
+
flex: 0 1 auto;
|
|
1676
|
+
min-width: 0;
|
|
1677
|
+
max-width: 100%;
|
|
1678
|
+
overflow: hidden;
|
|
1679
|
+
text-overflow: ellipsis;
|
|
1680
|
+
white-space: nowrap;
|
|
1681
|
+
font-size: 11px;
|
|
1682
|
+
color: var(--dpk-ink-faint);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.er-status {
|
|
1686
|
+
display: inline-flex;
|
|
1687
|
+
align-items: center;
|
|
1688
|
+
gap: 3px;
|
|
1689
|
+
flex-shrink: 0;
|
|
1690
|
+
padding: 1px 6px;
|
|
1691
|
+
border-radius: 999px;
|
|
1692
|
+
font-size: 10px;
|
|
1693
|
+
font-weight: 560;
|
|
1694
|
+
line-height: 1.5;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
.er-status > span {
|
|
1698
|
+
font-family: var(--dpk-mono);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
.er-table.is-added .er-status {
|
|
1702
|
+
background: var(--dpk-green-soft);
|
|
1703
|
+
color: var(--dpk-green);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
.er-table.is-removed .er-status {
|
|
1707
|
+
background: var(--dpk-accent-soft);
|
|
1708
|
+
color: var(--dpk-accent);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
.er-table.is-changed .er-status {
|
|
1712
|
+
background: var(--dpk-amber-soft);
|
|
1713
|
+
color: var(--dpk-amber);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
.er-head .diagram-comment-trigger {
|
|
1717
|
+
flex-shrink: 0;
|
|
1718
|
+
width: 24px;
|
|
1719
|
+
height: 24px;
|
|
1720
|
+
padding: 4px;
|
|
1721
|
+
border-radius: var(--dpk-radius-xs);
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
.er-head .diagram-comment-trigger svg {
|
|
1725
|
+
width: 14px;
|
|
1726
|
+
height: 14px;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
/* ---- Column rows ---- */
|
|
1730
|
+
|
|
1731
|
+
.er-fields {
|
|
1732
|
+
display: flex;
|
|
1733
|
+
flex-direction: column;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
.er-field {
|
|
1737
|
+
flex-shrink: 0;
|
|
1738
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
1739
|
+
font-size: 12px;
|
|
1740
|
+
transition: background 120ms ease;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
.er-field:last-child {
|
|
1744
|
+
border-bottom: 0;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
.er-field:hover {
|
|
1748
|
+
background: color-mix(in srgb, var(--dpk-paper-inset) 45%, transparent);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
.er-field-line {
|
|
1752
|
+
display: grid;
|
|
1753
|
+
grid-template-columns: auto 16px minmax(0, 1fr) auto 20px;
|
|
1754
|
+
align-items: center;
|
|
1755
|
+
gap: 7px;
|
|
1756
|
+
min-height: 31px;
|
|
1757
|
+
padding: 4px 6px 4px 10px;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
.er-field-mark {
|
|
1761
|
+
width: 10px;
|
|
1762
|
+
font-family: var(--dpk-mono);
|
|
1763
|
+
font-size: 11px;
|
|
1764
|
+
font-weight: 600;
|
|
1765
|
+
text-align: center;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/* Without a diff the mark's column goes away, and the name starts at the icon. */
|
|
1769
|
+
.er-table:not(.has-diff) .er-field-mark {
|
|
1770
|
+
display: none;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
.er-table:not(.has-diff) .er-field-line {
|
|
1774
|
+
grid-template-columns: 16px minmax(0, 1fr) auto 20px;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
.er-icon {
|
|
1778
|
+
display: grid;
|
|
1779
|
+
place-items: center;
|
|
1780
|
+
width: 16px;
|
|
1781
|
+
color: var(--dpk-ink-faint);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
.er-icon svg {
|
|
1785
|
+
width: 13px;
|
|
1786
|
+
height: 13px;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
.er-icon:is([data-icon='primary'], [data-icon='foreign']) {
|
|
1790
|
+
color: var(--dpk-blue);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
.er-icon[data-icon='not-null'] {
|
|
1794
|
+
color: var(--dpk-ink-soft);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
.er-icon[data-icon='not-null'] svg {
|
|
1798
|
+
fill: currentColor;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
.er-field-name {
|
|
1802
|
+
min-width: 0;
|
|
1803
|
+
overflow-wrap: anywhere;
|
|
1804
|
+
color: var(--dpk-ink);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.er-key {
|
|
1808
|
+
display: inline-block;
|
|
1809
|
+
margin-left: 6px;
|
|
1810
|
+
padding: 0 4px;
|
|
1811
|
+
border-radius: 3px;
|
|
1812
|
+
background: var(--dpk-paper-inset);
|
|
1813
|
+
font-family: var(--dpk-mono);
|
|
1814
|
+
font-size: 9px;
|
|
1815
|
+
line-height: 1.6;
|
|
1816
|
+
color: var(--dpk-ink-soft);
|
|
1817
|
+
vertical-align: 1px;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
/* A changed type breaks between its old and new value, never inside a word. */
|
|
1821
|
+
.er-field-type {
|
|
1822
|
+
display: flex;
|
|
1823
|
+
flex-wrap: wrap;
|
|
1824
|
+
justify-content: flex-end;
|
|
1825
|
+
align-items: baseline;
|
|
1826
|
+
gap: 0 5px;
|
|
1827
|
+
max-width: 168px;
|
|
1828
|
+
min-width: 0;
|
|
1829
|
+
font-family: var(--dpk-mono);
|
|
1830
|
+
font-size: 11px;
|
|
1831
|
+
color: var(--dpk-ink-faint);
|
|
1832
|
+
text-align: right;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
.er-field-type > :is(del, ins) {
|
|
1836
|
+
white-space: nowrap;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.er-field-action {
|
|
1840
|
+
display: grid;
|
|
1841
|
+
place-items: center;
|
|
1842
|
+
width: 20px;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
.er-field-edit {
|
|
1846
|
+
width: 20px;
|
|
1847
|
+
height: 20px;
|
|
1848
|
+
padding: 3px;
|
|
1849
|
+
opacity: 0;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.er-field-edit svg {
|
|
1853
|
+
width: 12px;
|
|
1854
|
+
height: 12px;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
.er-field:hover .er-field-edit,
|
|
1858
|
+
.er-field:focus-within .er-field-edit {
|
|
1859
|
+
opacity: 1;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
@media (hover: none) {
|
|
1863
|
+
.er-field-edit {
|
|
1864
|
+
opacity: 1;
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/* A joined column: the row a lit relation lands on reads as the key it is. */
|
|
1869
|
+
.er-field.is-lit {
|
|
1870
|
+
background: color-mix(in srgb, var(--dpk-blue) 16%, var(--dpk-paper-raised));
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
.er-field.is-lit .er-field-name {
|
|
1874
|
+
color: var(--dpk-blue);
|
|
1875
|
+
font-weight: 600;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
.er-field.is-lit .er-field-type {
|
|
1879
|
+
color: var(--dpk-ink-soft);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
.er-field.is-added {
|
|
1883
|
+
background: color-mix(in srgb, var(--dpk-green) 9%, transparent);
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
.er-field.is-removed {
|
|
1887
|
+
background: color-mix(in srgb, var(--dpk-accent) 8%, transparent);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
.er-field.is-removed :is(.er-field-name, .er-field-type) {
|
|
1891
|
+
text-decoration: line-through;
|
|
1892
|
+
color: var(--dpk-ink-faint);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
.er-field.is-changed {
|
|
1896
|
+
background: color-mix(in srgb, var(--dpk-amber) 9%, transparent);
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
.er-field.is-added .er-field-mark {
|
|
1900
|
+
color: var(--dpk-green);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
.er-field.is-removed .er-field-mark {
|
|
1904
|
+
color: var(--dpk-accent);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
.er-field.is-changed .er-field-mark {
|
|
1908
|
+
color: var(--dpk-amber);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
.er-field.is-match {
|
|
1912
|
+
box-shadow: inset 0 0 0 1px var(--dpk-blue);
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
/* Old and new values side by side: the type in its own cell, the rest under the row. */
|
|
1916
|
+
.er-field del {
|
|
1917
|
+
color: var(--dpk-accent);
|
|
1918
|
+
text-decoration: line-through;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.er-field ins {
|
|
1922
|
+
color: var(--dpk-green);
|
|
1923
|
+
text-decoration: none;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
.er-deltas {
|
|
1927
|
+
display: flex;
|
|
1928
|
+
flex-wrap: wrap;
|
|
1929
|
+
gap: 2px 12px;
|
|
1930
|
+
margin: -3px 0 0;
|
|
1931
|
+
padding: 0 8px 6px var(--er-indent);
|
|
1932
|
+
list-style: none;
|
|
1933
|
+
font-family: var(--dpk-mono);
|
|
1934
|
+
font-size: 10px;
|
|
1935
|
+
line-height: 1.5;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
.er-delta {
|
|
1939
|
+
display: flex;
|
|
1940
|
+
align-items: baseline;
|
|
1941
|
+
gap: 4px;
|
|
1942
|
+
min-width: 0;
|
|
1943
|
+
overflow-wrap: anywhere;
|
|
1944
|
+
color: var(--dpk-ink-faint);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
.er-delta-name {
|
|
1948
|
+
font-family: var(--dpk-body);
|
|
1949
|
+
font-size: 9.5px;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
/* ---- Relations ---- */
|
|
1953
|
+
|
|
1954
|
+
.er-edge {
|
|
1955
|
+
--er-line: color-mix(in srgb, var(--dpk-ink-faint) 75%, transparent);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
.er-edge.is-added {
|
|
1959
|
+
--er-line: var(--dpk-green);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
.er-edge.is-removed {
|
|
1963
|
+
--er-line: var(--dpk-accent);
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
.er-edge.is-changed {
|
|
1967
|
+
--er-line: var(--dpk-amber);
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
.er-edge.is-same:is(.is-lit, .is-selected) {
|
|
1971
|
+
--er-line: var(--dpk-blue);
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
.er-edge .d-edge-path {
|
|
1975
|
+
stroke: var(--er-line);
|
|
1976
|
+
stroke-width: 1.25;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/* While something is lit, the relations it does not reach step back. */
|
|
1980
|
+
.er-edge {
|
|
1981
|
+
transition: opacity 160ms ease;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
.er-edge.is-faded {
|
|
1985
|
+
opacity: 0.28;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
.er-edge.is-removed .d-edge-path {
|
|
1989
|
+
stroke-dasharray: 5 4;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
.er-edge:is(.is-lit, :hover, :focus-visible) .d-edge-path {
|
|
1993
|
+
stroke: var(--er-line);
|
|
1994
|
+
stroke-width: 1.75;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
.er-edge.is-selected .d-edge-path {
|
|
1998
|
+
stroke: var(--er-line);
|
|
1999
|
+
stroke-width: 2.25;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/* Dots running from the referenced column to the FK column while lit. */
|
|
2003
|
+
.er-edge-flow {
|
|
2004
|
+
fill: none;
|
|
2005
|
+
stroke: none;
|
|
2006
|
+
pointer-events: none;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
.er-edge:is(.is-lit, .is-selected) .er-edge-flow {
|
|
2010
|
+
stroke: var(--er-line);
|
|
2011
|
+
stroke-width: 3;
|
|
2012
|
+
stroke-linecap: round;
|
|
2013
|
+
stroke-dasharray: 0.1 13;
|
|
2014
|
+
animation: er-flow 900ms linear infinite;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
@keyframes er-flow {
|
|
2018
|
+
to {
|
|
2019
|
+
stroke-dashoffset: -13.1;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2024
|
+
.er-edge:is(.is-lit, .is-selected) .er-edge-flow {
|
|
2025
|
+
animation: none;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/* Crow's foot ends take the line's colour; the "zero" circle is hollow. */
|
|
2030
|
+
.er-end {
|
|
2031
|
+
pointer-events: none;
|
|
2032
|
+
fill: var(--dpk-paper-sunken);
|
|
2033
|
+
stroke: var(--er-line);
|
|
2034
|
+
stroke-width: 1.25;
|
|
2035
|
+
stroke-linecap: round;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
.er-edge:is(.is-lit, .is-selected) .er-end {
|
|
2039
|
+
stroke-width: 1.75;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
/*
|
|
2043
|
+
* Multiplicities and labels appear with the relation's highlight, as in
|
|
2044
|
+
* Liam ERD, so the resting diagram stays quiet. A changed relation keeps
|
|
2045
|
+
* them on: the change is in them.
|
|
2046
|
+
*/
|
|
2047
|
+
.er-cardinality,
|
|
2048
|
+
.er-relation-label {
|
|
2049
|
+
paint-order: stroke;
|
|
2050
|
+
stroke: var(--dpk-paper-sunken);
|
|
2051
|
+
stroke-linejoin: round;
|
|
2052
|
+
fill: var(--dpk-ink-soft);
|
|
2053
|
+
opacity: 0;
|
|
2054
|
+
transition: opacity 120ms ease;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
.er-edge:is(.is-lit, .is-selected, .is-changed, :hover, :focus-within) :is(.er-cardinality, .er-relation-label) {
|
|
2058
|
+
opacity: 1;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
.er-cardinality {
|
|
2062
|
+
font-family: var(--dpk-mono);
|
|
2063
|
+
font-size: 10px;
|
|
2064
|
+
stroke-width: 5px;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
.er-relation-label {
|
|
2068
|
+
font-size: 10px;
|
|
2069
|
+
font-style: italic;
|
|
2070
|
+
stroke-width: 4px;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
.er-edge.is-same:is(.is-lit, .is-selected) :is(.er-cardinality, .er-relation-label) {
|
|
2074
|
+
fill: var(--dpk-blue);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
.er-cardinality.is-added,
|
|
2078
|
+
.er-relation-label.is-added {
|
|
2079
|
+
fill: var(--dpk-green);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
.er-cardinality.is-removed,
|
|
2083
|
+
.er-relation-label.is-removed {
|
|
2084
|
+
fill: var(--dpk-accent);
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
.er-cardinality.is-changed,
|
|
2088
|
+
.er-relation-label.is-changed {
|
|
2089
|
+
fill: var(--dpk-amber);
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.er-was {
|
|
2093
|
+
fill: var(--dpk-accent);
|
|
2094
|
+
text-decoration: line-through;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
.diagram-legend .er-legend-cardinality {
|
|
2098
|
+
font-family: var(--dpk-mono);
|
|
2099
|
+
font-size: 9px;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
.diagram-legend .er-swatch-added {
|
|
2103
|
+
border-color: var(--dpk-green);
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
.diagram-legend .er-swatch-removed {
|
|
2107
|
+
border-color: var(--dpk-accent);
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
.diagram-legend .er-swatch-changed {
|
|
2111
|
+
border-color: var(--dpk-amber);
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
/* ---- Adding and editing columns ---- */
|
|
2115
|
+
|
|
2116
|
+
.er-add {
|
|
2117
|
+
border-top: 1px solid var(--dpk-rule);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
.er-add-button {
|
|
2121
|
+
display: flex;
|
|
2122
|
+
align-items: center;
|
|
2123
|
+
gap: 7px;
|
|
2124
|
+
width: 100%;
|
|
2125
|
+
min-height: 30px;
|
|
2126
|
+
padding: 4px 10px 4px calc(var(--er-indent) - 23px);
|
|
2127
|
+
border: 0;
|
|
2128
|
+
background: none;
|
|
2129
|
+
color: var(--dpk-ink-faint);
|
|
2130
|
+
font-family: var(--dpk-body);
|
|
2131
|
+
font-size: 11.5px;
|
|
2132
|
+
text-align: left;
|
|
2133
|
+
cursor: pointer;
|
|
2134
|
+
transition:
|
|
2135
|
+
background 120ms ease,
|
|
2136
|
+
color 120ms ease;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
.er-add-button:hover {
|
|
2140
|
+
background: color-mix(in srgb, var(--dpk-paper-inset) 45%, transparent);
|
|
2141
|
+
color: var(--dpk-ink);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
.er-add-button:focus-visible {
|
|
2145
|
+
outline: none;
|
|
2146
|
+
color: var(--dpk-ink);
|
|
2147
|
+
box-shadow: inset 0 0 0 2px var(--dpk-blue);
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
.er-add-button.is-open {
|
|
2151
|
+
background: color-mix(in srgb, var(--dpk-blue) 9%, transparent);
|
|
2152
|
+
color: var(--dpk-ink);
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
/* The row being edited stays in place under the editor, ringed. */
|
|
2156
|
+
.er-field.is-editing {
|
|
2157
|
+
background: color-mix(in srgb, var(--dpk-blue) 9%, var(--dpk-paper-raised));
|
|
2158
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 65%, transparent);
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
.er-field.is-editing .er-field-edit {
|
|
2162
|
+
opacity: 1;
|
|
2163
|
+
color: var(--dpk-blue);
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
/* The editor: a small card in the top layer, like a tooltip, under its row. */
|
|
2167
|
+
.er-editor {
|
|
2168
|
+
box-sizing: border-box;
|
|
2169
|
+
position: fixed;
|
|
2170
|
+
inset: auto;
|
|
2171
|
+
margin: 0;
|
|
2172
|
+
overflow: auto;
|
|
2173
|
+
display: grid;
|
|
2174
|
+
gap: 10px;
|
|
2175
|
+
padding: 10px 12px 12px;
|
|
2176
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
2177
|
+
border-radius: var(--dpk-radius-sm);
|
|
2178
|
+
background: var(--dpk-paper-raised);
|
|
2179
|
+
box-shadow: var(--dpk-shadow);
|
|
2180
|
+
color: var(--dpk-ink);
|
|
2181
|
+
font-family: var(--dpk-body);
|
|
2182
|
+
font-size: 12px;
|
|
2183
|
+
animation: er-editor-in 140ms var(--dpk-ease);
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
@keyframes er-editor-in {
|
|
2187
|
+
from {
|
|
2188
|
+
opacity: 0;
|
|
2189
|
+
transform: translateY(-3px);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2194
|
+
.er-editor {
|
|
2195
|
+
animation: none;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
.er-editor-head {
|
|
2200
|
+
display: flex;
|
|
2201
|
+
align-items: center;
|
|
2202
|
+
gap: 7px;
|
|
2203
|
+
min-width: 0;
|
|
2204
|
+
padding-bottom: 8px;
|
|
2205
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
.er-editor-title {
|
|
2209
|
+
flex-shrink: 0;
|
|
2210
|
+
font-size: 11.5px;
|
|
2211
|
+
font-weight: 600;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
.er-editor-target {
|
|
2215
|
+
min-width: 0;
|
|
2216
|
+
margin-left: auto;
|
|
2217
|
+
overflow: hidden;
|
|
2218
|
+
font-family: var(--dpk-mono);
|
|
2219
|
+
font-size: 11px;
|
|
2220
|
+
color: var(--dpk-ink-faint);
|
|
2221
|
+
text-overflow: ellipsis;
|
|
2222
|
+
white-space: nowrap;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
.er-editor-fields {
|
|
2226
|
+
display: grid;
|
|
2227
|
+
grid-auto-flow: column;
|
|
2228
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
2229
|
+
gap: 8px;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
.er-editor-field {
|
|
2233
|
+
display: grid;
|
|
2234
|
+
gap: 4px;
|
|
2235
|
+
min-width: 0;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
.er-editor-field .dpk-input {
|
|
2239
|
+
min-height: 28px;
|
|
2240
|
+
padding: 3px 8px;
|
|
2241
|
+
font-family: var(--dpk-mono);
|
|
2242
|
+
font-size: 11.5px;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.er-editor-field .dpk-input[aria-invalid='true'] {
|
|
2246
|
+
border-color: var(--dpk-accent);
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
.er-editor-combo {
|
|
2250
|
+
min-width: 0;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
/* A manual popover in the top layer, placed by the element; the UA popover box is reset. */
|
|
2254
|
+
.er-type-options {
|
|
2255
|
+
box-sizing: border-box;
|
|
2256
|
+
position: fixed;
|
|
2257
|
+
inset: auto;
|
|
2258
|
+
align-content: start;
|
|
2259
|
+
gap: 1px;
|
|
2260
|
+
margin: 0;
|
|
2261
|
+
padding: 4px;
|
|
2262
|
+
overflow-y: auto;
|
|
2263
|
+
overscroll-behavior: contain;
|
|
2264
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
2265
|
+
border-radius: var(--dpk-radius-sm);
|
|
2266
|
+
background: var(--dpk-paper-raised);
|
|
2267
|
+
box-shadow: var(--dpk-shadow);
|
|
2268
|
+
color: var(--dpk-ink);
|
|
2269
|
+
list-style: none;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
.er-type-options:popover-open {
|
|
2273
|
+
display: grid;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
.er-type-options [role='option'] {
|
|
2277
|
+
display: flex;
|
|
2278
|
+
align-items: center;
|
|
2279
|
+
gap: 6px;
|
|
2280
|
+
min-width: 0;
|
|
2281
|
+
padding: 4px 8px;
|
|
2282
|
+
border-radius: var(--dpk-radius-xs);
|
|
2283
|
+
color: var(--dpk-ink-soft);
|
|
2284
|
+
font-size: 11.5px;
|
|
2285
|
+
cursor: pointer;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
.er-type-options [role='option']:hover,
|
|
2289
|
+
.er-type-options [role='option'][aria-selected='true'] {
|
|
2290
|
+
background: var(--dpk-paper-sunken);
|
|
2291
|
+
color: var(--dpk-ink);
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
.er-type-options code {
|
|
2295
|
+
overflow: hidden;
|
|
2296
|
+
text-overflow: ellipsis;
|
|
2297
|
+
white-space: nowrap;
|
|
2298
|
+
font-family: var(--dpk-mono);
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
.er-type-options [data-kind='new'] .er-icon {
|
|
2302
|
+
color: var(--dpk-green);
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
.er-type-option-hint {
|
|
2306
|
+
flex: none;
|
|
2307
|
+
margin-left: auto;
|
|
2308
|
+
padding-left: 8px;
|
|
2309
|
+
color: var(--dpk-ink-faint);
|
|
2310
|
+
font-size: 10.5px;
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
.er-editor-check {
|
|
2314
|
+
display: flex;
|
|
2315
|
+
align-items: center;
|
|
2316
|
+
gap: 6px;
|
|
2317
|
+
width: fit-content;
|
|
2318
|
+
font-size: 11.5px;
|
|
2319
|
+
color: var(--dpk-ink-soft);
|
|
2320
|
+
cursor: pointer;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
.er-editor-check input {
|
|
2324
|
+
width: 13px;
|
|
2325
|
+
height: 13px;
|
|
2326
|
+
margin: 0;
|
|
2327
|
+
accent-color: var(--dpk-blue);
|
|
2328
|
+
cursor: pointer;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
.er-editor-foot {
|
|
2332
|
+
display: flex;
|
|
2333
|
+
align-items: center;
|
|
2334
|
+
gap: 6px;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
.er-editor-keys {
|
|
2338
|
+
margin-right: auto;
|
|
2339
|
+
font-size: 10px;
|
|
2340
|
+
color: var(--dpk-ink-faint);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
.er-editor-foot .dpk-btn {
|
|
2344
|
+
min-height: 26px;
|
|
2345
|
+
padding: 0 12px;
|
|
2346
|
+
font-size: 11.5px;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
.er-editor-note,
|
|
2350
|
+
.er-error {
|
|
2351
|
+
margin: 0;
|
|
2352
|
+
font-size: 10.5px;
|
|
2353
|
+
line-height: 1.45;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
.er-editor-note {
|
|
2357
|
+
color: var(--dpk-accent);
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
.er-error {
|
|
2361
|
+
padding: 5px 8px;
|
|
2362
|
+
border-radius: var(--dpk-radius-xs);
|
|
2363
|
+
background: var(--dpk-accent-soft);
|
|
2364
|
+
color: var(--dpk-accent);
|
|
2365
|
+
}
|
|
2366
|
+
`,Gn=(a,e,t=!1)=>[[a.type,a.ref===null?null:`\u2192 ${a.ref}`].filter(Boolean).join(" "),t&&a.keys.length>0?a.keys.join("+"):null,a.cardinality,a.label===null?null:`\u201C${a.label}\u201D`,a.nullable?e.nullable:null].filter(Boolean).join(" \xB7 "),Me="\u2014",Kn=(a,e)=>{const t=a.before;return t===null?[]:[["type",n=>n.type],["keys",n=>n.keys.length===0?Me:n.keys.join("+")],["ref",n=>n.ref??Me],["nullable",n=>n.nullable?e.nullable:e.notNull],["cardinality",n=>n.cardinality??Me],["label",n=>n.label===null?Me:`\u201C${n.label}\u201D`]].flatMap(([n,i])=>i(t)===i(a)?[]:[{attribute:n,before:i(t),after:i(a)}])},Wn=(a,e)=>a!==void 0&&JSON.stringify(a.base)===JSON.stringify(e)?a.draft:e,rs=a=>[...new Set(a.nodes.flatMap(e=>e.fields.map(t=>t.type)))].sort(),os=(a,e,t)=>{const s=e.trim(),n=s.toLowerCase(),i=a.findIndex(d=>d.toLowerCase()===n),r=n===""||i!==-1?a.map(d=>({kind:"schema",type:d})):[...a.filter(d=>d.toLowerCase().startsWith(n)),...a.filter(d=>!d.toLowerCase().startsWith(n)&&d.toLowerCase().includes(n))].map(d=>({kind:"schema",type:d})).concat({kind:"new",type:s});if(r.length===0)return{options:r,active:-1};const o=t??Math.max(0,i);return{options:r,active:(o%r.length+r.length)%r.length}},ds=(a,e)=>{const t=a.type.trim();if(a.kind==="add"){const i=a.name.trim();return e.fields.some(r=>r.id===i)?{ready:!1,issue:"name-taken"}:{ready:i!==""&&t!=="",issue:null}}const s=e.fields.find(i=>i.id===a.field),n=s===void 0||t!==s.type||a.nullable!==s.nullable;return{ready:t!==""&&n,issue:null}},Vn=a=>a.keys.includes("PK")?"primary":a.keys.includes("FK")||a.ref!==null?"foreign":a.nullable?"nullable":"not-null",ls=(a,e)=>e.kind==="relation"?a.id===e.id:e.kind==="table"?a.from===e.id||a.to===e.id:a.from===e.table&&a.sourceField===e.field||a.to===e.table&&a.targetField===e.field,Yn=(a,e)=>{const t=e.map(r=>r.kind==="column"&&!a.some(o=>ls(o,r))?{kind:"table",id:r.table}:r),s=new Set(t.flatMap(r=>r.kind==="relation"?[]:[r.kind==="table"?r.id:r.table])),n=new Set,i=new Set;for(const r of a)t.some(o=>ls(r,o))&&(n.add(r.id),s.add(r.from).add(r.to),i.add(`${r.from}.${r.sourceField}`).add(`${r.to}.${r.targetField}`));return{tables:s,edges:n,columns:i}},Jn=(a,e,t,s)=>{const n=t.filter(c=>c.x>=a.x&&c.x+c.width<=e.x),i=[];for(const c of[...n].sort((h,p)=>h.x-p.x)){const h=i.find(p=>p.some(m=>c.x<m.x+m.width&&m.x<c.x+c.width));h?h.push(c):i.push([c])}const r=[a];let o=a.x,d=a.y;const l=(c,h)=>{h!==d&&(r.push({x:c,y:d},{x:c,y:h}),d=h)};for(const c of i){const h=Math.min(...c.map(y=>y.x)),p=Math.max(...c.map(y=>y.x+y.width)),m=y=>c.every(E=>y<=E.y-s||y>=E.y+E.height+s),v=[d,e.y,...c.flatMap(y=>[y.y-s,y.y+y.height+s])].filter(m),x=y=>Math.abs(y-d)+Math.abs(y-e.y),w=v.reduce((y,E)=>x(E)<x(y)?E:y,v[0]??d);l((o+h)/2,w),o=p}return l((o+e.x)/2,e.y),r.push(e),r},Xn=10,Zn=(a,e)=>{const t=a[0],s=a.at(-1);if(t===void 0||s===void 0||!cs(a))return Qn(a,Xn);const n=[`M${B(t)}`];let i=t;const r=o=>{(o.x!==i.x||o.y!==i.y)&&n.push(`L${B(o)}`),i=o};for(let o=1;o+1<a.length;o+=2){const d=a[o],l=a[o+1];if(d===void 0||l===void 0)continue;const c=(v,x)=>x?v/2:v,h=c(d.x-(a[o-1]?.x??d.x),o-1>0),p=c((a[o+2]?.x??l.x)-l.x,o+2<a.length-1),m=ne(Math.min(e,h,p));r({x:ne(d.x-m),y:d.y}),n.push(`C${B(d)} ${B(l)} ${ne(l.x+m)} ${l.y}`),i={x:ne(l.x+m),y:l.y}}return r(s),n.join(" ")},cs=a=>a.length>=2&&a.length%2===0&&a.every((e,t)=>{const s=a[t-1];return s===void 0?!0:t%2===1?e.y===s.y&&e.x>=s.x:e.x===s.x})&&(a.at(-1)?.x??0)>(a[0]?.x??0),B=a=>`${a.x} ${a.y}`,Qn=(a,e)=>{const[t,...s]=a;if(t===void 0)return"";const n=[`M${B(t)}`];return s.forEach((i,r)=>{const o=a[r]??i,d=s[r+1];if(d===void 0){n.push(`L${B(i)}`);return}const l=Math.hypot(i.x-o.x,i.y-o.y),c=Math.hypot(d.x-i.x,d.y-i.y),h=Math.min(e,l/2,c/2);if(h===0){n.push(`L${B(i)}`);return}const p=(m,v,x)=>({x:ne(m.x+(v.x-m.x)/x*h),y:ne(m.y+(v.y-m.y)/x*h)});n.push(`L${B(p(i,o,l))}`,`Q${B(i)} ${B(p(i,d,c))}`)}),n.join(" ")},ne=a=>Math.round(a*100)/100||0,Ge=7,Ke={nodeSpacing:40,layerSpacing:136,padding:32},ei=Ke.nodeSpacing/2,ti=Ke.layerSpacing/2,si='[data-action="add-field"], [data-action="edit-field"]',ps={same:"",added:"+",removed:"\u2212",changed:"~"},ai={primary:sa,foreign:ta,"not-null":ot,nullable:ot},ni=(a,e)=>a.keys.filter(t=>!(e==="primary"&&t==="PK")&&!(e==="foreign"&&t==="FK"));class us extends ce{static{this.styles=[Y,Hn]}#t="";#n=null;#e=null;#s=null;#i=new Map;#a=null;#r=new Map;#o=null;#c=new Le(this);constructor(){super(),new Qs(this,{open:()=>this.#e!==null,closesOn:e=>!e.some(t=>t instanceof Element&&t.matches(`.er-editor, ${si}`)),ownsEscape:()=>!1,dismiss:()=>this.#$(!1,!1)})}disconnectedCallback(){this.#o?.disconnect(),this.#o=null,super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),this.#n!==null&&!this.#u(this.#n)&&(this.#n=null)}updated(){super.updated(),this.#C(),typeof ResizeObserver<"u"&&(this.#o??=new ResizeObserver(()=>this.#p())),this.#o?.disconnect();for(const e of this.renderRoot.querySelectorAll(".er-table")){this.#o?.observe(e);for(const t of e.querySelectorAll(".er-field"))this.#o?.observe(t)}this.#p()}#p(){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 i=n.width/t.offsetWidth,r=c=>Math.round(c*64)/64,o=c=>{const h=c?.getBoundingClientRect();return h===void 0?0:r((h.top+h.height/2-n.top)/i)},d={};for(const c of t.querySelectorAll(".er-field[data-field]")){const h=c.dataset.field;h!==void 0&&(d[h]=o(c.querySelector(".er-field-line")??c))}const l={height:r(n.height/i),head:o(t.querySelector(".er-head")),rows:d};JSON.stringify(this.#r.get(s))!==JSON.stringify(l)&&(this.#r.set(s,l),e=!0)}e&&this.requestUpdate()}layoutSignature(){return JSON.stringify([...this.#r])}filtered(){const e=super.filtered(),t=Be(e.edges);return{...e,nodes:e.nodes.map(s=>{const n=this.#r.get(s.id);if(!n)return s;const i={...s.ports};for(const r of e.edges){if(r.from===s.id&&r.fromPort!==void 0){const o=n.rows[r.sourceField]??n.head;i[r.fromPort]={x:s.width,y:o+(t.get(r.id)??0)}}r.to===s.id&&r.toPort!==void 0&&(i[r.toPort]={x:0,y:n.rows[r.targetField]??n.head})}return{...s,height:n.height,ports:i}})}}parseData(e){return Dn(e)}reduceElementActions(e,t){return On(X(this.locale),e,t)}emptyData(){return yn()}defaultHeading(){return X(this.locale).heading}statsLabels(){const e=X(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return X(this.locale).empty}layoutOptions(){return Ke}matchesFilter(e){return this.#t===""?!0:[e.id,e.name,...e.fields.map(t=>t.id)].some(t=>t.toLowerCase().includes(this.#t))}relations(e,t){if(e===null||e.kind!=="node")return W;const s=j(t.edges,e.id,"outgoing",!1),n=j(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=X(this.locale);return u`
|
|
2367
|
+
<label class="er-search">
|
|
2368
|
+
<span class="dpk-label">${e.search}</span>
|
|
2369
|
+
<input
|
|
2370
|
+
class="dpk-input"
|
|
2371
|
+
type="search"
|
|
2372
|
+
placeholder="table / field"
|
|
2373
|
+
.value=${this.#t}
|
|
2374
|
+
@input=${t=>{const s=t.currentTarget;s instanceof HTMLInputElement&&(this.#t=s.value.trim().toLowerCase(),this.requestUpdate())}}
|
|
2375
|
+
/>
|
|
2376
|
+
</label>
|
|
2377
|
+
`}renderLegend(){const e=X(this.locale);return u`<div class="diagram-legend">
|
|
2378
|
+
<span><i class="er-swatch-added"></i>${e.legendAdded}</span>
|
|
2379
|
+
<span><i class="er-swatch-removed"></i>${e.legendRemoved}</span>
|
|
2380
|
+
<span><i class="er-swatch-changed"></i>${e.legendChanged}</span>
|
|
2381
|
+
<span class="er-legend-cardinality">${e.legendCardinality}</span>
|
|
2382
|
+
</div>`}#l(e){const t=this.selection,s=t===null?null:t.kind==="node"?{kind:"table",id:t.id}:{kind:"relation",id:t.id};return Yn(e.edges,[this.#n,s].filter(n=>n!==null))}#u(e){const t=this.visible;if(e.kind==="relation")return t.edges.some(n=>n.id===e.id);const s=e.kind==="table"?e.id:e.table;return t.nodes.some(n=>n.id===s)}#h(e,t){const s=this.routeOf(e.id),n=s[0],i=s.at(-1);if(n===void 0||i===void 0||!cs(s))return s;const r=t.nodes.flatMap(o=>{const d=this.placedNode(o.id);return d===void 0?[]:[d]});return Jn(n,i,r,ei)}renderCanvas(){const e=X(this.locale),t=this.visible,s=this.#l(t),n=Be(t.edges),i=[...t.edges].sort((o,d)=>Number(s.edges.has(o.id))-Number(s.edges.has(d.id))),r=i.map(o=>{const d=this.edgeState(o.id),l=this.#h(o,t),c=Zn(l,ti),h=()=>this.select({kind:"edge",id:o.id}),p=[Se(o.cardinality),o.label].filter(Boolean).join(" \xB7 "),m=o.before===null?null:[Se(o.before.cardinality),o.before.label].filter(Boolean).join(" \xB7 ");return R`
|
|
2383
|
+
<g
|
|
2384
|
+
class=${this.elementClass({...d,dimmed:!1},"d-edge","er-edge",`is-${o.status}`,s.edges.has(o.id)&&"is-lit",s.edges.size>0&&!s.edges.has(o.id)&&"is-faded")}
|
|
2385
|
+
data-relation=${o.id}
|
|
2386
|
+
@pointerenter=${()=>this.#v({kind:"relation",id:o.id})}
|
|
2387
|
+
@pointerleave=${()=>this.#v(null)}
|
|
2388
|
+
>
|
|
2389
|
+
<title>${[`${o.from}.${o.sourceField} \u2192 ${o.to}.${o.targetField}`,p,m===null?null:`(${e.was(m)})`].filter(Boolean).join(" \xB7 ")}</title>
|
|
2390
|
+
<path class="d-edge-path" d=${c}></path>
|
|
2391
|
+
<path class="er-edge-flow" d=${c}></path>
|
|
2392
|
+
<path
|
|
2393
|
+
class="d-edge-hit"
|
|
2394
|
+
d=${c}
|
|
2395
|
+
role="button"
|
|
2396
|
+
tabindex="0"
|
|
2397
|
+
aria-label=${e.edgeLabel(o.from,o.to,p)}
|
|
2398
|
+
@click=${h}
|
|
2399
|
+
@keydown=${v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),h())}}
|
|
2400
|
+
></path>
|
|
2401
|
+
${l.length>0?this.#b(l,o,n.get(o.id)??0):b}
|
|
2402
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:o.id},`${o.from}.${o.sourceField} \u2192 ${o.to}.${o.targetField}`,l)}
|
|
2403
|
+
</g>
|
|
2404
|
+
`});return u`${this.renderEdges(Q(r,(o,d)=>i[d]?.id,o=>o),[])}${t.nodes.map(o=>this.#d(o,s,e))}`}#b(e,t,s){const n=t.before,i=(c,h)=>R`${h!=null&&h!==c?R`<tspan class="er-was">${h}</tspan> `:b}${c??b}`,r=c=>{const h=c==="start"?t.cardinality.parent:t.cardinality.child,p=n&&(c==="start"?n.cardinality.parent:n.cardinality.child),m=Bn(e,c,h);return{glyph:m,content:R`
|
|
2405
|
+
<g class="er-end" data-end=${c} data-multiplicity=${h}>
|
|
2406
|
+
${m.segments.map(([v,x])=>R`<line x1=${v.x} y1=${v.y} x2=${x.x} y2=${x.y}></line>`)}
|
|
2407
|
+
${m.circle===null?b:R`<circle cx=${m.circle.x} cy=${m.circle.y} r=${He}></circle>`}
|
|
2408
|
+
</g>
|
|
2409
|
+
<text
|
|
2410
|
+
class="er-cardinality is-${t.status}"
|
|
2411
|
+
data-end=${c}
|
|
2412
|
+
text-anchor=${m.label.anchor}
|
|
2413
|
+
dominant-baseline="central"
|
|
2414
|
+
x=${m.label.x}
|
|
2415
|
+
y=${m.label.y+(c==="start"&&s>0?Ge:-Ge)}
|
|
2416
|
+
>${i(h,p)}</text>
|
|
2417
|
+
`}},o=r("start"),d=r("end"),l=t.label??n?.label??null;return R`
|
|
2418
|
+
${o.content}${d.content}
|
|
2419
|
+
${l===null?b:R`<text
|
|
2420
|
+
class="er-relation-label is-${t.status}"
|
|
2421
|
+
text-anchor=${d.glyph.label.anchor}
|
|
2422
|
+
x=${d.glyph.label.x}
|
|
2423
|
+
dominant-baseline="central"
|
|
2424
|
+
y=${d.glyph.label.y+Ge}
|
|
2425
|
+
>${i(t.label,n?.label)}</text>`}
|
|
2426
|
+
`}#d(e,t,s){const n=this.placedNode(e.id);if(!n)return b;const i=this.nodeState(e.id),r=e.fields;return u`
|
|
2427
|
+
<div
|
|
2428
|
+
class=${this.elementClass({...i,dimmed:!1},"d-node","er-table",`is-${e.status}`,t.tables.has(e.id)&&"is-lit",e.fields.some(o=>o.status!=="same")&&"has-diff")}
|
|
2429
|
+
data-er-table=${e.id}
|
|
2430
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
2431
|
+
style="left:${n.x}px; top:${n.y}px; width:${e.width}px"
|
|
2432
|
+
@pointerenter=${()=>this.#v({kind:"table",id:e.id})}
|
|
2433
|
+
@pointerleave=${()=>this.#v(null)}
|
|
2434
|
+
>
|
|
2435
|
+
<div class="er-head">
|
|
2436
|
+
<button
|
|
2437
|
+
type="button"
|
|
2438
|
+
class="er-head-select"
|
|
2439
|
+
data-table=${e.id}
|
|
2440
|
+
aria-pressed=${i.selected?"true":"false"}
|
|
2441
|
+
title=${`${e.id} / ${e.name}`}
|
|
2442
|
+
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2443
|
+
>
|
|
2444
|
+
<span class="er-table-icon" aria-hidden="true">${ea()}</span>
|
|
2445
|
+
<span class="er-title">
|
|
2446
|
+
<span class="er-name">${e.id}</span>
|
|
2447
|
+
<span class="er-label">${e.name}</span>
|
|
2448
|
+
</span>
|
|
2449
|
+
${e.status==="same"?b:u`<span class="er-status"
|
|
2450
|
+
><span aria-hidden="true">${ps[e.status]}</span>${s.statusLabel(e.status)}</span
|
|
2451
|
+
>`}
|
|
2452
|
+
</button>
|
|
2453
|
+
${this.renderCommentTrigger({kind:"node",id:e.id},`${e.id} \xB7 ${e.name}`)}
|
|
2454
|
+
</div>
|
|
2455
|
+
${r.length===0?b:u`<div class="er-fields">${r.map(o=>this.#g(e,o,t,s))}</div>`}
|
|
2456
|
+
${this.#x(e,s)}
|
|
2457
|
+
</div>
|
|
2458
|
+
`}#m(e,t){return u`<span class="er-icon" data-icon=${e} role="img" aria-label=${t.columnRole(e)}
|
|
2459
|
+
>${ai[e]()}</span
|
|
2460
|
+
>`}#g(e,t,s,n){const i=this.#e,r=i?.kind==="edit"&&i.table===e.id&&i.field===t.id,o=this.#f&&t.status!=="removed"&&t.ref===null,d=this.#t!==""&&t.id.toLowerCase().includes(this.#t),l=Vn(t),c=Kn(t,n),h=c.find(m=>m.attribute==="type"),p=c.filter(m=>m.attribute!=="type");return u`
|
|
2461
|
+
<div
|
|
2462
|
+
class=${V("er-field",`is-${t.status}`,d&&"is-match",s.columns.has(`${e.id}.${t.id}`)&&"is-lit",r&&"is-editing")}
|
|
2463
|
+
data-field=${t.id}
|
|
2464
|
+
data-grill-questions=${this.questionsOf(t)}
|
|
2465
|
+
title=${[n.statusLabel(t.status),t.id,Gn(t,n,!0)].join(" / ")}
|
|
2466
|
+
@pointerenter=${()=>this.#v({kind:"column",table:e.id,field:t.id})}
|
|
2467
|
+
@pointerleave=${()=>this.#v({kind:"table",id:e.id})}
|
|
2468
|
+
>
|
|
2469
|
+
<div class="er-field-line">
|
|
2470
|
+
<span class="er-field-mark" aria-hidden="true">${ps[t.status]}</span>
|
|
2471
|
+
${this.#m(l,n)}
|
|
2472
|
+
<span class="er-field-name"
|
|
2473
|
+
>${t.id}${ni(t,l).map(m=>u`<span class="er-key">${m}</span>`)}</span
|
|
2474
|
+
>
|
|
2475
|
+
<span class="er-field-type">
|
|
2476
|
+
${h===void 0?t.type:u`<del>${h.before}</del><ins>${h.after}</ins>`}
|
|
2477
|
+
</span>
|
|
2478
|
+
<span class="er-field-action">
|
|
2479
|
+
${o?u`<button
|
|
2480
|
+
type="button"
|
|
2481
|
+
class="dpk-icon-btn er-field-edit"
|
|
2482
|
+
data-action="edit-field"
|
|
2483
|
+
data-field=${t.id}
|
|
2484
|
+
aria-label=${n.editFieldButton(t.id)}
|
|
2485
|
+
aria-haspopup="dialog"
|
|
2486
|
+
aria-expanded=${r?"true":"false"}
|
|
2487
|
+
title=${n.editFieldButton(t.id)}
|
|
2488
|
+
@click=${()=>this.#q({kind:"edit",table:e.id,field:t.id,type:t.type,nullable:t.nullable,failed:!1})}
|
|
2489
|
+
>
|
|
2490
|
+
${aa()}
|
|
2491
|
+
</button>`:b}
|
|
2492
|
+
</span>
|
|
2493
|
+
</div>
|
|
2494
|
+
${p.length===0?b:u`<ul class="er-deltas" aria-label=${n.changesLabel}>
|
|
2495
|
+
${p.map(m=>u`<li class="er-delta" data-attribute=${m.attribute}>
|
|
2496
|
+
<span class="er-delta-name">${n.attributeLabel(m.attribute)}</span>
|
|
2497
|
+
<del>${m.before}</del><span aria-hidden="true">→</span><ins>${m.after}</ins>
|
|
2498
|
+
</li>`)}
|
|
2499
|
+
</ul>`}
|
|
2500
|
+
</div>
|
|
2501
|
+
`}get#f(){return this.id!==""}#x(e,t){if(!this.#f||e.status==="removed")return b;const s=this.#e?.kind==="add"&&this.#e.table===e.id;return u`<div class="er-add">
|
|
2502
|
+
<button
|
|
2503
|
+
type="button"
|
|
2504
|
+
class=${V("er-add-button",s&&"is-open")}
|
|
2505
|
+
data-action="add-field"
|
|
2506
|
+
aria-haspopup="dialog"
|
|
2507
|
+
aria-expanded=${s?"true":"false"}
|
|
2508
|
+
@click=${()=>this.#q({kind:"add",table:e.id,name:"",type:"",nullable:!1,failed:!1})}
|
|
2509
|
+
>
|
|
2510
|
+
<span class="er-icon" aria-hidden="true">${De()}</span><span>${t.addFieldButton}</span>
|
|
2511
|
+
</button>
|
|
2512
|
+
</div>`}renderSelection(){const e=this.#e,t=e===null?void 0:this.visible.nodes.find(n=>n.id===e.table),s=super.renderSelection();return e===null||t===void 0?s:u`${s}${this.#M(t,e,X(this.locale))}`}#M(e,t,s){const n=ds(t,e),i=t.kind==="edit"?e.fields.find(l=>l.id===t.field):void 0,r=i!==void 0&&i.keys.includes("PK")?"primary":t.nullable?"nullable":"not-null",o=t.kind==="add"?s.addFieldTitle:s.editFieldTitle,d=t.kind==="add"?e.id:`${e.id}.${t.field}`;return u`<div
|
|
2513
|
+
class="er-editor"
|
|
2514
|
+
popover="manual"
|
|
2515
|
+
role="dialog"
|
|
2516
|
+
data-kind=${t.kind}
|
|
2517
|
+
aria-label=${`${o} ${d}`}
|
|
2518
|
+
@keydown=${l=>this.#z(l)}
|
|
2519
|
+
>
|
|
2520
|
+
<div class="er-editor-head">
|
|
2521
|
+
${this.#m(r,s)}
|
|
2522
|
+
<span class="er-editor-title">${o}</span>
|
|
2523
|
+
<code class="er-editor-target">${d}</code>
|
|
2524
|
+
</div>
|
|
2525
|
+
<div class="er-editor-fields">
|
|
2526
|
+
${t.kind==="add"?u`<label class="er-editor-field">
|
|
2527
|
+
<span class="dpk-label">${s.columnNameLabel}</span>
|
|
2528
|
+
<input
|
|
2529
|
+
class="dpk-input"
|
|
2530
|
+
data-input="add-name"
|
|
2531
|
+
autocomplete="off"
|
|
2532
|
+
spellcheck="false"
|
|
2533
|
+
aria-invalid=${n.issue==="name-taken"?"true":"false"}
|
|
2534
|
+
placeholder=${s.columnNamePlaceholder}
|
|
2535
|
+
.value=${t.name}
|
|
2536
|
+
@input=${l=>{const c=l.currentTarget;this.#e?.kind==="add"&&c instanceof HTMLInputElement&&this.#w({...this.#e,name:c.value})}}
|
|
2537
|
+
/>
|
|
2538
|
+
</label>`:b}
|
|
2539
|
+
${this.#L(t,s)}
|
|
2540
|
+
</div>
|
|
2541
|
+
${n.issue==="name-taken"?u`<p class="er-editor-note" role="status">${s.columnNameTaken}</p>`:b}
|
|
2542
|
+
${t.failed?u`<p class="er-error" role="alert">${s.notRecorded}</p>`:b}
|
|
2543
|
+
<label class="er-editor-check">
|
|
2544
|
+
<input
|
|
2545
|
+
type="checkbox"
|
|
2546
|
+
data-input="nullable"
|
|
2547
|
+
.checked=${t.nullable}
|
|
2548
|
+
@change=${l=>{const c=l.currentTarget;this.#e!==null&&c instanceof HTMLInputElement&&this.#w({...this.#e,nullable:c.checked})}}
|
|
2549
|
+
/>
|
|
2550
|
+
<span>${s.columnNullable}</span>
|
|
2551
|
+
</label>
|
|
2552
|
+
<div class="er-editor-foot">
|
|
2553
|
+
<span class="er-editor-keys">${s.columnKeys}</span>
|
|
2554
|
+
<button
|
|
2555
|
+
type="button"
|
|
2556
|
+
class="dpk-btn dpk-btn--ghost"
|
|
2557
|
+
data-action="cancel-column"
|
|
2558
|
+
data-dpk-text-discard
|
|
2559
|
+
@click=${()=>this.#$(!0)}
|
|
2560
|
+
>
|
|
2561
|
+
${s.cancel}
|
|
2562
|
+
</button>
|
|
2563
|
+
<button
|
|
2564
|
+
type="button"
|
|
2565
|
+
class="dpk-btn dpk-btn--accent"
|
|
2566
|
+
data-action="submit-column"
|
|
2567
|
+
?disabled=${!n.ready}
|
|
2568
|
+
@click=${()=>this.#S()}
|
|
2569
|
+
>
|
|
2570
|
+
${t.kind==="add"?s.columnAdd:s.columnSave}
|
|
2571
|
+
</button>
|
|
2572
|
+
</div>
|
|
2573
|
+
</div>`}#C(){const e=this.#e,t=this.renderRoot.querySelector(".er-editor");if(e===null||t===null)return;const s=this.renderRoot.querySelector(`[data-er-table="${CSS.escape(e.table)}"] ${hs(e)}`),n=e.kind==="edit"?s?.closest(".er-field"):s;if(!n)return;this.#c.open(t,n,{width:300,height:340},{placement:"bottom-start",trackTransform:!0});const i=t.querySelector(".er-type-options"),r=t.querySelector(".er-editor-type");i===null||r===null||this.#c.open(i,r,{width:Math.max(r.offsetWidth,200),height:220},{placement:"bottom-start",trackTransform:!0})}#E(){this.#e===null||this.#s===null||this.#i.set(ue(this.#e),{draft:this.#e,base:this.#s})}#v(e){JSON.stringify(this.#n)!==JSON.stringify(e)&&(this.#n=e,this.requestUpdate())}#q(e){if(this.#e!==null&&ue(this.#e)===ue(e)){this.#$(!1);return}this.#T(e)}#T(e){this.#E(),this.#e=Wn(this.#i.get(ue(e)),e),this.#s=e,this.#i.delete(ue(e)),this.#a=null,this.requestUpdate();const t=e.kind==="add"?"add-name":"edit-type";this.updateComplete.then(()=>{const s=this.renderRoot.querySelector(`.er-editor [data-input="${t}"]`);s?.focus({preventScroll:!0}),s?.select()})}#L(e,t){const s=this.#a,n=s===null?null:os(rs(this.items()),e.type,s.moved),i=n!==null&&n.options.length>0,r=d=>`er-type-option-${d}`,o=()=>{this.#a===null&&(this.#a={moved:null},this.requestUpdate())};return u`<div class="er-editor-combo">
|
|
2574
|
+
<label class="er-editor-field">
|
|
2575
|
+
<span class="dpk-label">${t.addFieldType}</span>
|
|
2576
|
+
<input
|
|
2577
|
+
class="dpk-input er-editor-type"
|
|
2578
|
+
data-input=${e.kind==="add"?"add-type":"edit-type"}
|
|
2579
|
+
role="combobox"
|
|
2580
|
+
aria-autocomplete="list"
|
|
2581
|
+
aria-controls="er-type-options"
|
|
2582
|
+
aria-expanded=${String(i)}
|
|
2583
|
+
aria-activedescendant=${i?r(n.active):b}
|
|
2584
|
+
autocomplete="off"
|
|
2585
|
+
spellcheck="false"
|
|
2586
|
+
placeholder=${t.columnTypePlaceholder}
|
|
2587
|
+
.value=${e.type}
|
|
2588
|
+
@click=${o}
|
|
2589
|
+
@blur=${()=>this.#y()}
|
|
2590
|
+
@input=${d=>{const l=d.currentTarget;this.#e===null||!(l instanceof HTMLInputElement)||(this.#a={moved:null},this.#w({...this.#e,type:l.value}))}}
|
|
2591
|
+
@keydown=${d=>this.#D(d)}
|
|
2592
|
+
/>
|
|
2593
|
+
</label>
|
|
2594
|
+
${i?u`<ul
|
|
2595
|
+
id="er-type-options"
|
|
2596
|
+
class="er-type-options"
|
|
2597
|
+
popover="manual"
|
|
2598
|
+
role="listbox"
|
|
2599
|
+
aria-label=${t.columnTypeChoices}
|
|
2600
|
+
>
|
|
2601
|
+
${n.options.map((d,l)=>u`<li
|
|
2602
|
+
id=${r(l)}
|
|
2603
|
+
role="option"
|
|
2604
|
+
data-type=${d.type}
|
|
2605
|
+
data-kind=${d.kind}
|
|
2606
|
+
aria-selected=${String(l===n.active)}
|
|
2607
|
+
@pointerdown=${c=>c.preventDefault()}
|
|
2608
|
+
@click=${()=>this.#k(d.type)}
|
|
2609
|
+
>
|
|
2610
|
+
${d.kind==="new"?u`<span class="er-icon" aria-hidden="true">${De()}</span>`:b}
|
|
2611
|
+
<code>${d.type}</code>
|
|
2612
|
+
${d.kind==="new"?u`<span class="er-type-option-hint">${t.columnTypeNew}</span>`:b}
|
|
2613
|
+
</li>`)}
|
|
2614
|
+
</ul>`:b}
|
|
2615
|
+
</div>`}#D(e){const t=this.#e,s=this.#a;if(e.isComposing||t===null)return;const n=s===null?null:os(rs(this.items()),t.type,s.moved);switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this.#a=n===null||n.options.length===0?{moved:null}:{moved:n.active+(e.key==="ArrowDown"?1:-1)},this.requestUpdate(),this.updateComplete.then(()=>{const i=this.renderRoot.querySelector(".er-type-options"),r=i?.querySelector('[aria-selected="true"]');i&&r&&na(i,r)});return;case"Enter":{const i=n?.options[n.active];if(i===void 0||i.type===t.type.trim()){this.#y();return}e.preventDefault(),e.stopPropagation(),this.#k(i.type);return}case"Escape":if(s===null)return;e.preventDefault(),e.stopPropagation(),this.#y();return}}#k(e){this.#e!==null&&(this.#a=null,this.#w({...this.#e,type:e}))}#y(){this.#a!==null&&(this.#a=null,this.requestUpdate())}#w(e){this.#e={...e,failed:!1},this.requestUpdate()}#$(e,t=!0){const s=this.#e;s!==null&&(e||this.#E(),this.#e=null,this.#a=null,this.requestUpdate(),t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-er-table="${CSS.escape(s.table)}"] ${hs(s)}`)?.focus({preventScroll:!0})))}#z(e){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.#$(!1);return}if(e.key!=="Enter"||!(e.target instanceof HTMLInputElement)||e.target.type==="checkbox")return;e.preventDefault();const t=this.#e;if(t?.kind==="add"&&e.target.dataset.input==="add-name"&&t.type.trim()===""){e.target.closest(".er-editor")?.querySelector('[data-input="add-type"]')?.focus();return}this.#S()}#S(){const e=this.#e,t=e===null?void 0:this.visible.nodes.find(i=>i.id===e.table);if(e===null||t===void 0||!ds(e,t).ready)return;const s=e.type.trim();if(!(e.kind==="add"?this.dispatchElementAction(Qt,["node",e.table],{id:e.name.trim(),type:s,nullable:e.nullable}):this.dispatchElementAction(es,["node",e.table],{field:e.field,type:s,nullable:e.nullable}))){this.#e={...e,failed:!0},this.requestUpdate();return}this.#$(!0)}}const hs=a=>a.kind==="add"?'[data-action="add-field"]':`[data-action="edit-field"][data-field="${CSS.escape(a.field)}"]`,ue=a=>a.kind==="add"?`add:${a.table}`:`edit:${a.table}:${a.field}`,ms=()=>{customElements.get("dpk-component-er-diagram")||customElements.define("dpk-component-er-diagram",us)},he=H({en:{heading:"Architecture",node:"Service",edge:"Connection",empty:"No matching services.",boundaries:"Boundaries",edgeLabel:(a,e)=>`Connection from ${a} to ${e}`,artworkCredit:a=>`Icon credit: ${a}`},ja:{heading:"\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3\u56F3",node:"\u30B5\u30FC\u30D3\u30B9",edge:"\u63A5\u7D9A",empty:"\u8A72\u5F53\u3059\u308B\u30B5\u30FC\u30D3\u30B9\u306F\u3042\u308A\u307E\u305B\u3093\u3002",boundaries:"\u5883\u754C",edgeLabel:(a,e)=>`${a} \u304B\u3089 ${e} \u3078\u306E\u63A5\u7D9A`,artworkCredit:a=>`\u30A2\u30A4\u30B3\u30F3\u51FA\u5178: ${a}`}}),gs={width:220,height:112},Ce=26,ii=T({src:$(g(),S(1)),alt:$(g(),S(1)),license:k(g())}),ri=T({id:$(g(),S(1)),name:$(g(),S(1)),description:k(g()),boundary:k(g()),symbol:k(g()),tags:k(D(g()),[]),artwork:k(ii),position:T({x:ie(),y:ie()}),questions:k(g())}),oi=T({id:$(g(),S(1)),label:$(g(),S(1)),kind:k(_(["internal","external"]),"internal")}),di=T({id:$(g(),S(1)),from:$(g(),S(1)),to:$(g(),S(1)),label:k(g())}),li=T({boundaries:k(D(oi),[]),services:D(ri),links:k(D(di),[])}),ci=()=>({nodes:[],edges:[],boundaries:[]}),pi=a=>{const e=K(li,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:gs.width,height:gs.height,position:o.position,...o.questions===void 0?{}:{questions:o.questions}}}),i=new Set,r=e.links.map(o=>{if(i.has(o.id))throw new Error(`duplicate link id: ${o.id}`);if(i.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:r,boundaries:e.boundaries.map(o=>({id:o.id,label:o.label,kind:o.kind}))}},We={left:Ce,top:Ce*1.6,right:Ce,bottom:Ce},ui={left:0,top:0,right:0,bottom:0},hi=12,fs=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))}),mi=(a,e,t,s)=>{const n=a.left-e.left<t.right+s.right&&t.left-s.left<a.right+e.right,i=a.top-e.top<t.bottom+s.bottom&&t.top-s.top<a.bottom+e.bottom;if(!n||!i)return e;const r=Math.max(t.left-a.right,a.left-t.right),o=Math.max(t.top-a.bottom,a.top-t.bottom);if(r<0&&o<0)return e;const d=(l,c,h)=>l===0?0:Math.max(0,h-hi)*l/(l+c);return r>=o?t.left>=a.right?{...e,right:Math.min(e.right,d(e.right,s.left,r))}:{...e,left:Math.min(e.left,d(e.left,s.right,r))}: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))}},gi=(a,e)=>{const t=e.flatMap(n=>{const i=a.filter(r=>r.boundary===n.id);return i.length===0?[]:[{boundary:n,bounds:fs(i)}]}),s=[...t.map(n=>({id:n.boundary.id,bounds:n.bounds,padding:We})),...a.filter(n=>n.boundary===null||!t.some(i=>i.boundary.id===n.boundary)).map(n=>({id:null,bounds:fs([n]),padding:ui}))];return t.map(({boundary:n,bounds:i})=>{const r=s.filter(l=>l.id!==n.id).map(l=>mi(i,We,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)}),We),o=i.left-r.left,d=i.top-r.top;return{boundary:n,x:o,y:d,width:i.right+r.right-o,height:i.bottom+r.bottom-d}})},fi=(a,e)=>{const t=i=>i.y+i.height/2,s=i=>i.x+i.width/2,n=(i,r,o)=>{if(o?i.y===r.y:i.x===r.x)return[i,r];if(o){const l=(i.x+r.x)/2;return[i,{x:l,y:i.y},{x:l,y:r.y},r]}const d=(i.y+r.y)/2;return[i,{x:i.x,y:d},{x:r.x,y:d},r]};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},bi=(a,e)=>{const t=new Map(a.nodes.map(n=>[n.id,n])),s=a.routes.map(n=>{const i=e.find(l=>l.id===n.id),r=i?t.get(i.from):void 0,o=i?t.get(i.to):void 0,d=r&&o&&r!==o?fi(r,o):null;return d===null?n:{id:n.id,points:d}});return{...a,routes:s}},ki=G`
|
|
2616
|
+
.arch-toggle {
|
|
2617
|
+
min-height: 26px;
|
|
2618
|
+
padding: 0 9px;
|
|
2619
|
+
font-size: 10.5px;
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
.arch-toggle[aria-pressed='true'] {
|
|
2623
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
2624
|
+
background: var(--dpk-blue-soft);
|
|
2625
|
+
color: var(--dpk-blue);
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
.arch-boundary {
|
|
2629
|
+
position: absolute;
|
|
2630
|
+
border: 1.5px dashed var(--dpk-rule-strong);
|
|
2631
|
+
border-radius: var(--dpk-radius-lg);
|
|
2632
|
+
background: color-mix(in srgb, var(--dpk-blue) 3%, transparent);
|
|
2633
|
+
pointer-events: none;
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
.arch-boundary.is-external {
|
|
2637
|
+
border-color: color-mix(in srgb, var(--dpk-amber) 45%, transparent);
|
|
2638
|
+
background: color-mix(in srgb, var(--dpk-amber) 4%, transparent);
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
.arch-boundary span {
|
|
2642
|
+
position: absolute;
|
|
2643
|
+
top: 9px;
|
|
2644
|
+
left: 14px;
|
|
2645
|
+
/* Stays inside its own boundary, eliding a long label, rather than running over its neighbours. */
|
|
2646
|
+
box-sizing: border-box;
|
|
2647
|
+
max-width: calc(100% - 28px);
|
|
2648
|
+
overflow: hidden;
|
|
2649
|
+
text-overflow: ellipsis;
|
|
2650
|
+
white-space: nowrap;
|
|
2651
|
+
padding: 2px 7px;
|
|
2652
|
+
border-radius: 999px;
|
|
2653
|
+
background: var(--dpk-glass);
|
|
2654
|
+
backdrop-filter: blur(8px);
|
|
2655
|
+
font-family: var(--dpk-mono);
|
|
2656
|
+
font-size: 9px;
|
|
2657
|
+
letter-spacing: 0.1em;
|
|
2658
|
+
text-transform: uppercase;
|
|
2659
|
+
color: var(--dpk-ink-faint);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
.arch-service {
|
|
2663
|
+
display: grid;
|
|
2664
|
+
grid-template-columns: 38px minmax(0, 1fr);
|
|
2665
|
+
gap: 10px;
|
|
2666
|
+
align-items: start;
|
|
2667
|
+
padding: 14px 13px;
|
|
2668
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
2669
|
+
border-radius: var(--dpk-radius-sm);
|
|
2670
|
+
background: var(--dpk-paper-raised);
|
|
2671
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2672
|
+
text-align: left;
|
|
2673
|
+
overflow: hidden;
|
|
2674
|
+
transition:
|
|
2675
|
+
border-color 160ms var(--dpk-ease),
|
|
2676
|
+
box-shadow 160ms var(--dpk-ease),
|
|
2677
|
+
transform 160ms var(--dpk-ease);
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
.arch-service:hover {
|
|
2681
|
+
border-color: var(--dpk-blue);
|
|
2682
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2683
|
+
transform: translateY(-1px);
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
.arch-service.is-selected {
|
|
2687
|
+
border-color: var(--dpk-blue);
|
|
2688
|
+
box-shadow:
|
|
2689
|
+
var(--dpk-bevel),
|
|
2690
|
+
var(--dpk-shadow-sm),
|
|
2691
|
+
0 0 0 3px var(--dpk-blue-soft);
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
.arch-service.is-related {
|
|
2695
|
+
border-color: color-mix(in srgb, var(--dpk-green) 55%, transparent);
|
|
2696
|
+
background: var(--dpk-green-soft);
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
.arch-artwork {
|
|
2700
|
+
width: 38px;
|
|
2701
|
+
height: 38px;
|
|
2702
|
+
object-fit: contain;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
.arch-symbol {
|
|
2706
|
+
display: grid;
|
|
2707
|
+
place-items: center;
|
|
2708
|
+
width: 38px;
|
|
2709
|
+
height: 38px;
|
|
2710
|
+
border-radius: var(--dpk-radius-xs);
|
|
2711
|
+
background: var(--dpk-paper-inset);
|
|
2712
|
+
color: var(--dpk-ink-faint);
|
|
2713
|
+
font-family: var(--dpk-mono);
|
|
2714
|
+
font-size: 12px;
|
|
2715
|
+
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
.arch-body {
|
|
2719
|
+
display: flex;
|
|
2720
|
+
flex-direction: column;
|
|
2721
|
+
gap: 6px;
|
|
2722
|
+
min-width: 0;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
.arch-name {
|
|
2726
|
+
font-size: 13px;
|
|
2727
|
+
font-weight: 640;
|
|
2728
|
+
letter-spacing: -0.01em;
|
|
2729
|
+
white-space: nowrap;
|
|
2730
|
+
overflow: hidden;
|
|
2731
|
+
text-overflow: ellipsis;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
.arch-description {
|
|
2735
|
+
font-size: 10px;
|
|
2736
|
+
line-height: 1.6;
|
|
2737
|
+
color: var(--dpk-ink-faint);
|
|
2738
|
+
display: -webkit-box;
|
|
2739
|
+
-webkit-line-clamp: 3;
|
|
2740
|
+
-webkit-box-orient: vertical;
|
|
2741
|
+
overflow: hidden;
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
.arch-link .d-edge-path {
|
|
2745
|
+
stroke: var(--dpk-rule-strong);
|
|
2746
|
+
stroke-width: 1.5;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
.arch-link.is-related .d-edge-path {
|
|
2750
|
+
stroke: var(--dpk-green);
|
|
2751
|
+
stroke-width: 2;
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
.arch-link.is-selected .d-edge-path {
|
|
2755
|
+
stroke: var(--dpk-blue);
|
|
2756
|
+
stroke-width: 2.4;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
.arch-link-label {
|
|
2760
|
+
font-size: 9.5px;
|
|
2761
|
+
fill: var(--dpk-ink-faint);
|
|
2762
|
+
paint-order: stroke;
|
|
2763
|
+
stroke: var(--dpk-paper-raised);
|
|
2764
|
+
stroke-width: 5px;
|
|
2765
|
+
stroke-linejoin: round;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
#arch-neutral .diagram-arrow {
|
|
2769
|
+
fill: var(--dpk-rule-strong);
|
|
2770
|
+
stroke: var(--dpk-rule-strong);
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
#arch-selected .diagram-arrow {
|
|
2774
|
+
fill: var(--dpk-blue);
|
|
2775
|
+
stroke: var(--dpk-blue);
|
|
2776
|
+
}
|
|
2777
|
+
`,xi=[{id:"arch-neutral"},{id:"arch-selected"}];class bs extends ce{static{this.styles=[Y,ki]}#t=!0;parseData(e){return pi(e)}emptyData(){return ci()}defaultHeading(){return he(this.locale).heading}statsLabels(){const e=he(this.locale);return{node:e.node,edge:e.edge}}emptyMessage(){return he(this.locale).empty}get layoutMode(){return"fixed"}layoutOptions(){return{padding:40}}computePlacement(e){return bi(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.#n();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 i=this.placedNode(n.id);return i?[i]:[]}),t=this.renderRoot.querySelector(".diagram-canvas"),s=Aa([...e,...this.#n()],t?.clientHeight??0);this.viewport?.reset(s??void 0)}relations(e,t){if(e===null||e.kind!=="node")return W;const s=j(t.edges,e.id,"outgoing",!1),n=j(t.edges,e.id,"incoming",!1);return{nodes:new Map([...s.nodes,...n.nodes]),edges:new Set([...s.edges,...n.edges])}}renderToolbarActions(){const e=he(this.locale);return u`
|
|
2778
|
+
<button
|
|
2779
|
+
type="button"
|
|
2780
|
+
class="dpk-btn dpk-btn--ghost arch-toggle"
|
|
2781
|
+
data-toggle="boundaries"
|
|
2782
|
+
aria-pressed=${this.#t?"true":"false"}
|
|
2783
|
+
@click=${()=>{this.#t=!this.#t,this.requestUpdate()}}
|
|
2784
|
+
>
|
|
2785
|
+
${e.boundaries}
|
|
2786
|
+
</button>
|
|
2787
|
+
`}#n(){const e=this.visible.nodes.flatMap(t=>{const s=this.placedNode(t.id);return s?[{...t,position:{x:s.x,y:s.y}}]:[]});return gi(e,this.items().boundaries)}renderCanvas(){const e=he(this.locale),t=this.visible,s=i=>t.nodes.find(r=>r.id===i)?.name??i,n=t.edges.map(i=>{const r=this.edgeState(i.id),o=this.routeOf(i.id),d=we(o),l=()=>this.select({kind:"edge",id:i.id});return R`
|
|
2788
|
+
<g class=${this.elementClass(r,"d-edge","arch-link")} data-link=${i.id}>
|
|
2789
|
+
<title>${i.label??i.id}</title>
|
|
2790
|
+
<path
|
|
2791
|
+
class="d-edge-path"
|
|
2792
|
+
d=${d}
|
|
2793
|
+
marker-end=${`url(#${r.selected?"arch-selected":"arch-neutral"})`}
|
|
2794
|
+
></path>
|
|
2795
|
+
<path
|
|
2796
|
+
class="d-edge-hit"
|
|
2797
|
+
d=${d}
|
|
2798
|
+
role="button"
|
|
2799
|
+
tabindex="0"
|
|
2800
|
+
aria-label=${e.edgeLabel(s(i.from),s(i.to))}
|
|
2801
|
+
@click=${l}
|
|
2802
|
+
@keydown=${c=>{c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),l())}}
|
|
2803
|
+
></path>
|
|
2804
|
+
${i.label===null||o.length===0?b:this.#e(i.label,o)}
|
|
2805
|
+
${this.renderEdgeCommentTrigger({kind:"edge",id:i.id},`${s(i.from)} \u2192 ${s(i.to)}${i.label===null?"":` \xB7 ${i.label}`}`,o)}
|
|
2806
|
+
</g>
|
|
2807
|
+
`});return u`
|
|
2808
|
+
${this.#t?this.#n().map(i=>u`<div
|
|
2809
|
+
class=${`arch-boundary ${i.boundary.kind==="external"?"is-external":""}`}
|
|
2810
|
+
data-boundary=${i.boundary.id}
|
|
2811
|
+
style="left:${i.x}px; top:${i.y}px; width:${i.width}px; height:${i.height}px"
|
|
2812
|
+
>
|
|
2813
|
+
<span>${i.boundary.label}</span>
|
|
2814
|
+
</div>`):b}
|
|
2815
|
+
${this.renderEdges(n,xi)} ${t.nodes.map(i=>this.#s(i,e))}
|
|
2816
|
+
`}#e(e,t){const s=t[Math.floor(t.length/2)]??t[0];return s?R`<text class="arch-link-label" x=${s.x} y=${s.y-6}>${e}</text>`:u``}#s(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id);return u`
|
|
2817
|
+
<button
|
|
2818
|
+
type="button"
|
|
2819
|
+
class=${this.elementClass(n,"d-node","arch-service")}
|
|
2820
|
+
data-service=${e.id}
|
|
2821
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
2822
|
+
style="left:${s.x}px; top:${s.y}px; width:${e.width}px; height:${e.height}px"
|
|
2823
|
+
aria-pressed=${n.selected?"true":"false"}
|
|
2824
|
+
title=${e.description??e.name}
|
|
2825
|
+
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
2826
|
+
>
|
|
2827
|
+
${e.artwork===null?u`<span class="arch-symbol" aria-hidden="true">${e.symbol??e.name.slice(0,2)}</span>`:u`<img
|
|
2828
|
+
class="arch-artwork"
|
|
2829
|
+
src=${e.artwork.src}
|
|
2830
|
+
alt=${e.artwork.alt}
|
|
2831
|
+
title=${e.artwork.license===null?b:t.artworkCredit(e.artwork.license)}
|
|
2832
|
+
/>`}
|
|
2833
|
+
<span class="arch-body">
|
|
2834
|
+
<span class="arch-name">${e.name}</span>
|
|
2835
|
+
${e.description===null?b:u`<span class="arch-description">${e.description}</span>`}
|
|
2836
|
+
</span>
|
|
2837
|
+
</button>
|
|
2838
|
+
${this.renderCommentTrigger({kind:"node",id:e.id},e.name,{x:s.x+e.width-20,y:s.y-14})}
|
|
2839
|
+
`}}const ks=()=>{customElements.get("dpk-component-architecture-map")||customElements.define("dpk-component-architecture-map",bs)},xs=[72,52,40],vs=[0,22,10,8],vi=a=>xs[Math.min(a,xs.length-1)]??40,ys=a=>vs[Math.min(a,vs.length-1)]??8,yi=(a,e={})=>{const t=e.padding??40,s=a.nodes.find(M=>M.parent===null);if(s===void 0)return{width:0,height:0,nodes:[],routes:[]};const n=new Map(a.nodes.map(M=>[M.id,M])),i=M=>M.children.flatMap(L=>{const z=n.get(L);return z===void 0?[]:[z]}),r=new Map,o=M=>M.reduce((L,z,U)=>L+d(z)+(U===0?0:ys(z.depth)),0),d=M=>{const L=r.get(M.id);if(L!==void 0)return L;const z=Math.max(M.height,o(i(M)));return r.set(M.id,z),z},l=[],c=(M,L,z)=>{if(L.length===0)return;const U=vi(M.node.depth);let f=M.y+M.node.height/2-o(L)/2;for(const C of L){const q=d(C),F={x:z==="right"?M.x+M.node.width+U:M.x-U-C.width,y:f+q/2-C.height/2,node:C};l.push(F),c(F,i(C),z),f+=q+ys(C.depth)}},h={x:-s.width/2,y:-s.height/2,node:s};l.push(h);const p=i(s);c(h,p.filter(M=>M.side!=="left"),"right"),c(h,p.filter(M=>M.side==="left"),"left");const m=Math.min(...l.map(M=>M.x)),v=Math.min(...l.map(M=>M.y)),x=Math.max(...l.map(M=>M.x+M.node.width)),w=Math.max(...l.map(M=>M.y+M.node.height)),y=t-m,E=t-v,O=new Map,I=l.map(M=>{const L=O.get(M.node.depth)??0;return O.set(M.node.depth,L+1),{id:M.node.id,x:M.x+y,y:M.y+E,width:M.node.width,height:M.node.height,layer:M.node.depth,order:L}}),N=new Map(I.map(M=>[M.id,M])),xe=a.edges.flatMap(M=>{const L=N.get(M.from),z=N.get(M.to),U=n.get(M.to);if(L===void 0||z===void 0||U===void 0)return[];const f=U.side==="left",C={x:f?L.x:L.x+L.width,y:L.y+L.height/2},q={x:f?z.x+z.width:z.x,y:z.y+z.height/2};return[{id:M.id,points:[C,q]}]});return{width:x-m+t*2,height:w-v+t*2,nodes:I,routes:xe}},wi=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}`},me=H({en:{heading:"Mind map",empty:"No matching topics.",topics:"Topic",toggleOpen:(a,e)=>`Open ${e} subtopics of ${a}`,toggleClose:a=>`Collapse subtopics of ${a}`,addSubtopicButton:"+ Subtopic",commentButton:"Comment",addSubtopicAriaLabel:a=>`Subtopic of ${a}`,addSubtopicPlaceholder:"Subtopic title (Enter to add)",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",addTopicTitle:"Add topic",addSummary:(a,e)=>`${a} \u203A ${e}`},ja:{heading:"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7",empty:"\u8A72\u5F53\u3059\u308B\u30C8\u30D4\u30C3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",topics:"\u30C8\u30D4\u30C3\u30AF",toggleOpen:(a,e)=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF ${e} \u4EF6\u3092\u3072\u3089\u304F`,toggleClose:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u3092\u305F\u305F\u3080`,addSubtopicButton:"\uFF0B \u30B5\u30D6\u30C8\u30D4\u30C3\u30AF",commentButton:"\u30B3\u30E1\u30F3\u30C8",addSubtopicAriaLabel:a=>`${a} \u306E\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF`,addSubtopicPlaceholder:"\u30B5\u30D6\u30C8\u30D4\u30C3\u30AF\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",addTopicTitle:"\u30C8\u30D4\u30C3\u30AF\u3092\u8FFD\u52A0",addSummary:(a,e)=>`${a} \u203A ${e}`}}),ws=ia(()=>T({id:$(g(),S(1)),label:$(g(),S(1)),description:k(g()),tags:k(D(g())),questions:k(g()),collapsed:k(re()),side:k(_(["left","right"])),children:k(D(ws))})),$i=T({root:ws}),$s=()=>({root:null,nodes:[],edges:[]}),Ss=[{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}],Si=a=>Ss[Math.min(a,Ss.length-1)]??{fontSize:12.5,padding:12,height:28,min:56,max:220},Mi=(a,e)=>{let t=0;for(const s of a)t+=(s.codePointAt(0)??0)>=11904?e:e*.62;return t},Ci=(a,e)=>{const t=Si(e),s=Math.ceil(Mi(a,t.fontSize)+t.padding*2+4);return{width:Math.min(t.max,Math.max(t.min,s)),height:t.height}},Ve=a=>a.children===void 0||a.children.length===0?1:a.children.reduce((e,t)=>e+Ve(t),0),Ms=a=>{const e={left:0,right:0};for(const t of a)t.side!==void 0&&(e[t.side]+=Ve(t));return a.map(t=>{if(t.side!==void 0)return t.side;const s=e.right<=e.left?"right":"left";return e[s]+=Ve(t),s})},Cs=a=>Es(K($i,a).root),Es=(a,e=new Set)=>{const t=[],s=[],n=new Set,i=(r,o,d,l,c)=>{if(n.has(r.id))throw new Error(`duplicate topic id: ${r.id}`);if(n.add(r.id),r.side!==void 0&&d!==1)throw new Error(`side is only allowed on a main topic (a child of the root): ${r.id}`);const h=r.children??[];t.push({id:r.id,label:r.label,description:r.description??null,parent:o,depth:d,branch:l,side:c,children:h.map(m=>m.id),collapsed:r.collapsed??!1,added:e.has(r.id),tags:r.tags??[],...Ci(r.label,d),...r.questions===void 0?{}:{questions:r.questions}}),o!==null&&s.push({id:r.id,from:o,to:r.id,tags:[]});const p=d===0?Ms(h):[];h.forEach((m,v)=>i(m,r.id,d+1,d===0?v:l,d===0?p[v]??"right":c))};return i(a,null,0,-1,null),{root:a,nodes:t,edges:s}},qs="ADD_TOPIC",Ei=de({id:$(g(),S(1)),label:$(g(),te(),S(1))}),qi=a=>{const e=Ae(a);return e?.length===3&&e[1]==="node"?e[2]??null:null},Ts=(a,e,t)=>a.id===e?{...a,children:[...a.children??[],t]}:a.children===void 0?a:{...a,children:a.children.map(s=>Ts(s,e,t))},Ti=a=>{if(a.children===void 0)return a;const e=Ms(a.children);return{...a,children:a.children.map((t,s)=>({...t,side:e[s]??"right"}))}},Di=(a,e,t)=>{const s=a.addTopicTitle,n=new Map(e.nodes.map(d=>[d.id,d.label])),i=new Set,r=[];let o=e.root===null?null:Ti(e.root);for(const d of t){if(d.type!==qs){r.push({id:d.id,title:d.type,stale:"unsupported-action-type"});continue}const l=qi(d.target.id),c=l===null?void 0:n.get(l),h=oe(Ei,d.payload);if(o===null||l===null||c===void 0){r.push({id:d.id,title:s,stale:"target-missing"});continue}if(!h.success||n.has(h.output.id)){r.push({id:d.id,title:s,stale:"constraint-violated"});continue}const{id:p,label:m}=h.output;o=Ts(o,l,{id:p,label:m}),n.set(p,m),i.add(p),r.push({id:d.id,title:s,summary:a.addSummary(c,m),tone:"create"})}return{data:o===null||i.size===0?e:Es(o,i),results:r}},Ye=(a,e)=>{const t=new Map(a.nodes.map(i=>[i.id,i])),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},Li=(a,e)=>{const t=new Map(a.nodes.map(i=>[i.id,i]));let s=0;const n=[...t.get(e)?.children??[]];for(let i=n.pop();i!==void 0;i=n.pop())s+=1,n.push(...t.get(i)?.children??[]);return s},zi=(a,e,t)=>{let s=null;if(e!==null){const r=a.nodes.filter(e);if(r.length===0)return $s();const o=new Map(a.nodes.map(l=>[l.id,l])),d=new Set;for(const l of r){d.add(l.id);for(const h of Ye(a,l.id))d.add(h);const c=[...l.children];for(let h=c.pop();h!==void 0;h=c.pop())d.add(h),c.push(...o.get(h)?.children??[])}s=d}const n=a.nodes.filter(r=>(s===null||s.has(r.id))&&!Ye(a,r.id).some(o=>t.has(o))),i=new Set(n.map(r=>r.id));return{...a,nodes:n,edges:a.edges.filter(r=>i.has(r.from)&&i.has(r.to))}},Ai=G`
|
|
2840
|
+
.branch-root {
|
|
2841
|
+
--mind-color: var(--dpk-ink);
|
|
2842
|
+
--mind-soft: var(--dpk-paper-sunken);
|
|
2843
|
+
}
|
|
2844
|
+
.branch-0 {
|
|
2845
|
+
--mind-color: var(--dpk-blue);
|
|
2846
|
+
--mind-soft: var(--dpk-blue-soft);
|
|
2847
|
+
}
|
|
2848
|
+
.branch-1 {
|
|
2849
|
+
--mind-color: var(--dpk-green);
|
|
2850
|
+
--mind-soft: var(--dpk-green-soft);
|
|
2851
|
+
}
|
|
2852
|
+
.branch-2 {
|
|
2853
|
+
--mind-color: var(--dpk-violet);
|
|
2854
|
+
--mind-soft: var(--dpk-violet-soft);
|
|
2855
|
+
}
|
|
2856
|
+
.branch-3 {
|
|
2857
|
+
--mind-color: var(--dpk-amber);
|
|
2858
|
+
--mind-soft: var(--dpk-amber-soft);
|
|
2859
|
+
}
|
|
2860
|
+
.branch-4 {
|
|
2861
|
+
--mind-color: var(--dpk-accent);
|
|
2862
|
+
--mind-soft: var(--dpk-accent-soft);
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
.mind-topic {
|
|
2866
|
+
display: flex;
|
|
2867
|
+
align-items: center;
|
|
2868
|
+
justify-content: center;
|
|
2869
|
+
padding: 0 12px;
|
|
2870
|
+
border: 1px solid color-mix(in srgb, var(--mind-color) 45%, transparent);
|
|
2871
|
+
border-radius: 999px;
|
|
2872
|
+
background: var(--dpk-paper-raised);
|
|
2873
|
+
color: var(--dpk-ink);
|
|
2874
|
+
font-family: var(--dpk-body);
|
|
2875
|
+
font-size: 12.5px;
|
|
2876
|
+
line-height: 1.3;
|
|
2877
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
2878
|
+
transition:
|
|
2879
|
+
border-color 160ms var(--dpk-ease),
|
|
2880
|
+
box-shadow 160ms var(--dpk-ease),
|
|
2881
|
+
transform 160ms var(--dpk-ease);
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
.mind-label {
|
|
2885
|
+
min-width: 0;
|
|
2886
|
+
white-space: nowrap;
|
|
2887
|
+
overflow: hidden;
|
|
2888
|
+
text-overflow: ellipsis;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
.mind-topic.depth-0 {
|
|
2892
|
+
padding: 0 22px;
|
|
2893
|
+
border: 0;
|
|
2894
|
+
background: linear-gradient(155deg, color-mix(in srgb, var(--dpk-ink) 88%, transparent), var(--dpk-ink));
|
|
2895
|
+
color: var(--dpk-paper-raised);
|
|
2896
|
+
font-size: 16px;
|
|
2897
|
+
font-weight: 680;
|
|
2898
|
+
letter-spacing: -0.01em;
|
|
2899
|
+
box-shadow:
|
|
2900
|
+
inset 0 1px 0 var(--dpk-highlight),
|
|
2901
|
+
var(--dpk-shadow-sm);
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
.mind-topic.depth-1 {
|
|
2905
|
+
padding: 0 15px;
|
|
2906
|
+
border-width: 1.5px;
|
|
2907
|
+
border-color: var(--mind-color);
|
|
2908
|
+
background: var(--mind-soft);
|
|
2909
|
+
font-size: 13.5px;
|
|
2910
|
+
font-weight: 620;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
.mind-topic.depth-1 .mind-label {
|
|
2914
|
+
color: color-mix(in srgb, var(--mind-color) 70%, var(--dpk-ink));
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
.mind-topic:hover {
|
|
2918
|
+
border-color: var(--mind-color);
|
|
2919
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
2920
|
+
transform: translateY(-1px);
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
.mind-topic.is-selected {
|
|
2924
|
+
border-color: var(--mind-color);
|
|
2925
|
+
box-shadow:
|
|
2926
|
+
var(--dpk-bevel),
|
|
2927
|
+
var(--dpk-shadow-sm),
|
|
2928
|
+
0 0 0 3px color-mix(in srgb, var(--mind-color) 22%, transparent);
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
.mind-topic.depth-0.is-selected {
|
|
2932
|
+
box-shadow:
|
|
2933
|
+
inset 0 1px 0 var(--dpk-highlight),
|
|
2934
|
+
var(--dpk-shadow-sm),
|
|
2935
|
+
0 0 0 3px var(--dpk-blue-soft);
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
.mind-topic.is-related {
|
|
2939
|
+
border-color: var(--mind-color);
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
.mind-topic:focus-visible {
|
|
2943
|
+
outline: none;
|
|
2944
|
+
box-shadow: var(--dpk-focus);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
/* Added on this page by a draft action: not authored yet. */
|
|
2948
|
+
.mind-topic.is-added {
|
|
2949
|
+
border-style: dashed;
|
|
2950
|
+
border-color: var(--mind-color);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
.mind-actions {
|
|
2954
|
+
position: absolute;
|
|
2955
|
+
z-index: 3;
|
|
2956
|
+
display: flex;
|
|
2957
|
+
flex-wrap: wrap;
|
|
2958
|
+
align-items: center;
|
|
2959
|
+
gap: 6px;
|
|
2960
|
+
width: 220px;
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
.mind-actions .dpk-btn {
|
|
2964
|
+
padding: 3px 9px;
|
|
2965
|
+
font-size: 12px;
|
|
2966
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
.mind-actions .dpk-input {
|
|
2970
|
+
width: 100%;
|
|
2971
|
+
font-size: 12.5px;
|
|
2972
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
.mind-actions-error {
|
|
2976
|
+
font-size: 11.5px;
|
|
2977
|
+
line-height: 1.4;
|
|
2978
|
+
color: var(--dpk-accent);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
.mind-branch {
|
|
2982
|
+
fill: none;
|
|
2983
|
+
stroke: color-mix(in srgb, var(--mind-color) 55%, transparent);
|
|
2984
|
+
stroke-width: 1.5;
|
|
2985
|
+
stroke-linecap: round;
|
|
2986
|
+
cursor: default;
|
|
2987
|
+
transition: opacity 150ms ease;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
.mind-branch.depth-1 {
|
|
2991
|
+
stroke-width: 3;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
.mind-branch.depth-2 {
|
|
2995
|
+
stroke-width: 2;
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
.mind-branch.is-related {
|
|
2999
|
+
stroke: var(--mind-color);
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
.mind-toggle {
|
|
3003
|
+
position: absolute;
|
|
3004
|
+
z-index: 1;
|
|
3005
|
+
min-width: 18px;
|
|
3006
|
+
height: 18px;
|
|
3007
|
+
padding: 0 4px;
|
|
3008
|
+
transform: translate(-50%, -50%);
|
|
3009
|
+
border: 1.5px solid var(--mind-color);
|
|
3010
|
+
border-radius: 999px;
|
|
3011
|
+
background: var(--dpk-paper-raised);
|
|
3012
|
+
color: var(--mind-color);
|
|
3013
|
+
font-family: var(--dpk-mono);
|
|
3014
|
+
font-size: 10px;
|
|
3015
|
+
font-weight: 700;
|
|
3016
|
+
line-height: 1;
|
|
3017
|
+
cursor: pointer;
|
|
3018
|
+
opacity: 0;
|
|
3019
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
3020
|
+
transition:
|
|
3021
|
+
opacity 120ms ease,
|
|
3022
|
+
box-shadow 160ms var(--dpk-ease);
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
.mind-toggle:hover,
|
|
3026
|
+
.mind-toggle:focus-visible {
|
|
3027
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
/* Expanded toggles appear with their topic; folded ones always show the count. */
|
|
3031
|
+
.mind-topic:hover + .mind-toggle,
|
|
3032
|
+
.mind-toggle:hover,
|
|
3033
|
+
.mind-toggle:focus-visible,
|
|
3034
|
+
.mind-toggle.is-folded {
|
|
3035
|
+
opacity: 1;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
.mind-toggle.is-dimmed {
|
|
3039
|
+
opacity: 0;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
.mind-toggle.is-folded.is-dimmed {
|
|
3043
|
+
opacity: 0.26;
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
.mind-toggle:focus-visible {
|
|
3047
|
+
outline: none;
|
|
3048
|
+
box-shadow: var(--dpk-focus);
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
@media (hover: none) {
|
|
3052
|
+
.mind-toggle {
|
|
3053
|
+
opacity: 1;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
`,Ri=5,Ds=.6;class Ls extends ce{static{this.styles=[Y,Ai]}#t=new Set;#n=null;#e=!1;#s=null;toggle(e,t){const s=this.items().nodes.find(i=>i.id===e);if(s===void 0||s.children.length===0)return;const n=t??!this.#t.has(e);if(n!==this.#t.has(e)){if(n){this.#t.add(e);const i=this.selection;i!==null&&Ye(this.items(),i.id).includes(e)&&this.select(null)}else this.#t.delete(e);this.requestUpdate()}}get collapsed(){return[...this.#t]}parseData(e){return Cs(e)}emptyData(){return $s()}reduceElementActions(e,t){return Di(me(this.locale),e,t)}defaultHeading(){return me(this.locale).heading}emptyMessage(){return me(this.locale).empty}statsText(){const e=me(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=>se(s.tags,e);return zi(this.items(),t,this.#t)}layoutSignature(){return this.filtered().nodes.map(e=>`${e.id}<${e.parent??""}:${e.side??""}`).join(",")}computePlacement(e){return yi(e)}refreshContent(){const e=this.authoredItems();e!==this.#n&&(this.#n=e,this.#t=new Set(e.nodes.filter(t=>t.collapsed).map(t=>t.id)),this.#e=!1,this.#s=null),super.refreshContent()}initialView(){const e=this.viewport;if(e===null)return;if(this.#e){e.apply();return}this.#e=!0,e.fit();const{scale:t}=e.view();t<Ds&&e.zoom(Ds/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=j(t.edges,e.id,"outgoing",!0),n=j(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=me(this.locale);return u`
|
|
3057
|
+
${this.renderEdges(e.edges.map(s=>this.#a(s)),[])}
|
|
3058
|
+
${e.nodes.map(s=>this.#r(s,t))} ${this.#c(t)}
|
|
3059
|
+
`}#i(e){return e===void 0||e.branch<0?"branch-root":`branch-${e.branch%Ri}`}#a(e){const t=this.items().nodes.find(n=>n.id===e.to),s=this.edgeState(e.id);return R`
|
|
3060
|
+
<path
|
|
3061
|
+
class=${this.elementClass(s,"d-edge","mind-branch",this.#i(t),`depth-${Math.min(t?.depth??1,3)}`)}
|
|
3062
|
+
data-branch=${e.id}
|
|
3063
|
+
d=${wi(this.routeOf(e.id))}
|
|
3064
|
+
></path>
|
|
3065
|
+
`}#r(e,t){const s=this.placedNode(e.id);if(!s)return b;const n=this.nodeState(e.id),i=this.#t.has(e.id),r=`depth-${Math.min(e.depth,3)}`;return u`
|
|
3066
|
+
<button
|
|
3067
|
+
type="button"
|
|
3068
|
+
class=${this.elementClass(n,"d-node","mind-topic",r,this.#i(e),i&&"is-folded",e.added&&"is-added")}
|
|
3069
|
+
data-topic=${e.id}
|
|
3070
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
3071
|
+
style="left:${s.x}px; top:${s.y}px; width:${s.width}px; height:${s.height}px"
|
|
3072
|
+
aria-pressed=${n.selected?"true":"false"}
|
|
3073
|
+
title=${e.description??e.label}
|
|
3074
|
+
@click=${()=>this.select({kind:"node",id:e.id})}
|
|
3075
|
+
>
|
|
3076
|
+
<span class="mind-label">${e.label}</span>
|
|
3077
|
+
</button>
|
|
3078
|
+
${e.depth===0||e.children.length===0?b:this.#o(e,s,i,n.dimmed,t)}
|
|
3079
|
+
`}#o(e,t,s,n,i){const r=s?Li(this.items(),e.id):0,o=e.side==="left"?t.x:t.x+t.width,d=s?i.toggleOpen(e.label,r):i.toggleClose(e.label);return u`
|
|
3080
|
+
<button
|
|
3081
|
+
type="button"
|
|
3082
|
+
class=${this.elementClass({selected:!1,related:!1,dimmed:n,depth:null},"mind-toggle",this.#i(e),s&&"is-folded")}
|
|
3083
|
+
data-toggle=${e.id}
|
|
3084
|
+
style="left:${o}px; top:${t.y+t.height/2}px"
|
|
3085
|
+
aria-expanded=${s?"false":"true"}
|
|
3086
|
+
aria-label=${d}
|
|
3087
|
+
title=${d}
|
|
3088
|
+
@click=${l=>{l.stopPropagation(),this.toggle(e.id)}}
|
|
3089
|
+
>
|
|
3090
|
+
${s?r:"\u2212"}
|
|
3091
|
+
</button>
|
|
3092
|
+
`}#c(e){const t=this.selection;if(t===null||t.kind!=="node")return b;const s=this.items().nodes.find(r=>r.id===t.id),n=this.placedNode(t.id);if(s===void 0||n===void 0)return b;const i=this.#s?.parent===s.id?this.#s:null;return u`
|
|
3093
|
+
<div
|
|
3094
|
+
class="mind-actions"
|
|
3095
|
+
data-for=${s.id}
|
|
3096
|
+
style="left:${this.#p(s,n)}px; top:${n.y+n.height+8}px"
|
|
3097
|
+
@click=${r=>r.stopPropagation()}
|
|
3098
|
+
>
|
|
3099
|
+
${i===null?u`
|
|
3100
|
+
<button type="button" class="dpk-btn" data-action="add" @click=${()=>this.#l(s.id)}>
|
|
3101
|
+
${e.addSubtopicButton}
|
|
3102
|
+
</button>
|
|
3103
|
+
<button
|
|
3104
|
+
type="button"
|
|
3105
|
+
class="dpk-btn"
|
|
3106
|
+
data-action="comment"
|
|
3107
|
+
@click=${()=>this.requestElementComment("node",s.id)}
|
|
3108
|
+
>
|
|
3109
|
+
${e.commentButton}
|
|
3110
|
+
</button>
|
|
3111
|
+
`:u`
|
|
3112
|
+
<input
|
|
3113
|
+
class="dpk-input"
|
|
3114
|
+
aria-label="${e.addSubtopicAriaLabel(s.label)}"
|
|
3115
|
+
placeholder="${e.addSubtopicPlaceholder}"
|
|
3116
|
+
.value=${i.label}
|
|
3117
|
+
@input=${r=>{const o=r.currentTarget;o instanceof HTMLInputElement&&(this.#s={...i,label:o.value,failed:!1})}}
|
|
3118
|
+
@keydown=${r=>this.#u(r,s.id)}
|
|
3119
|
+
/>
|
|
3120
|
+
${i.failed?u`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:b}
|
|
3121
|
+
`}
|
|
3122
|
+
</div>
|
|
3123
|
+
`}#p(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#s={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#u(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?.label.trim()??"";if(s.length===0)return;const n=dt(`topic ${s}`,this.items().nodes.map(r=>r.id));if(!this.dispatchElementAction(qs,["node",t],{id:n,label:s})){this.#s={parent:t,label:s,failed:!0},this.requestUpdate();return}this.#s=null,this.#t.delete(t),this.select({kind:"node",id:n}),this.requestUpdate()}}const zs=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",Ls)},ge=H({en:{heading:"Kanban",empty:"No columns.",cards:"Card",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",wipLimit:a=>`WIP limit ${a}`,addCardButton:"+ Card",addCardAriaLabel:a=>`Card to add to ${a}`,addCardPlaceholder:"Card title (Enter to add)",addCardTitle:"Add card",moveCardTitle:"Move card",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: reorder within ${e}`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`},ja:{heading:"\u30AB\u30F3\u30D0\u30F3",empty:"\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002",cards:"\u30AB\u30FC\u30C9",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",wipLimit:a=>`WIP \u4E0A\u9650 ${a}`,addCardButton:"\uFF0B \u30AB\u30FC\u30C9",addCardAriaLabel:a=>`${a} \u306B\u8FFD\u52A0\u3059\u308B\u30AB\u30FC\u30C9`,addCardPlaceholder:"\u30AB\u30FC\u30C9\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",addCardTitle:"\u30AB\u30FC\u30C9\u3092\u8FFD\u52A0",moveCardTitle:"\u30AB\u30FC\u30C9\u3092\u79FB\u52D5",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: ${e} \u5185\u3067\u4E26\u3079\u66FF\u3048`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`}}),Oi=T({id:$(g(),S(1)),title:$(g(),S(1)),description:k(g()),tags:k(D(g())),assignee:k(g()),questions:k(g())}),Ii=["gray","blue","green","amber","violet","red"],Fi=T({id:$(g(),S(1)),label:$(g(),S(1)),description:k(g()),color:k(_(Ii)),limit:k($(ie(),da(),oa(1))),cards:k(D(Oi))}),Ni=T({columns:D(Fi)}),Pi=()=>({columns:[]}),As=a=>{const e=K(Ni,a),t=new Set,s=new Set;return{columns:e.columns.map(i=>{if(t.has(i.id))throw new Error(`duplicate column id: ${i.id}`);return t.add(i.id),{id:i.id,label:i.label,description:i.description??null,color:i.color??null,limit:i.limit??null,cards:(i.cards??[]).map(r=>{if(s.has(r.id))throw new Error(`duplicate card id: ${r.id}`);return s.add(r.id),{id:r.id,title:r.title,description:r.description??null,tags:r.tags??[],assignee:r.assignee??null,...r.questions===void 0?{}:{questions:r.questions},column:i.id,change:null}})}})}},Ee=(a,e)=>a.columns.flatMap(t=>t.cards).find(t=>t.id===e),fe=a=>a.columns.flatMap(e=>e.cards),ji=(a,e)=>e===null?a:{columns:a.columns.map(t=>({...t,cards:t.cards.filter(e)}))},Ui=(a,e,t,s)=>{const n=Ee(a,e);if(n===void 0||n.column!==t)return!1;if(s===e)return!0;const i=a.columns.find(o=>o.id===t)?.cards??[],r=i.findIndex(o=>o.id===e);return(i[r+1]?.id??null)===s},Rs="ADD_CARD",Os="MOVE_CARD",_i=de({id:$(g(),S(1)),title:$(g(),te(),S(1))}),Bi=de({column:$(g(),S(1)),before:ra($(g(),S(1)))}),Is=(a,e)=>{const t=Ae(a);return t?.length===3&&t[1]===e?t[2]??null:null},Hi=(a,e)=>({columns:a.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),Fs=(a,e,t)=>({columns:a.columns.map(s=>{if(s.id!==t.column)return s;const n={...e,column:s.id},i=t.before===null?-1:s.cards.findIndex(r=>r.id===t.before);return{...s,cards:i<0?[...s.cards,n]:[...s.cards.slice(0,i),n,...s.cards.slice(i)]}})}),Gi=(a,e,t)=>{const s=a.addCardTitle,n=Is(t.target.id,"column"),i=e.columns.find(d=>d.id===n);if(i===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const r=oe(_i,t.payload);if(!r.success||Ee(e,r.output.id)!==void 0)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const o={id:r.output.id,title:r.output.title,description:null,tags:[],assignee:null,column:i.id,change:"added"};return{data:Fs(e,o,{column:i.id,before:null}),result:{id:t.id,title:s,summary:a.addSummary(i.label,o.title),tone:"create"}}},Ki=(a,e,t)=>{const s=a.moveCardTitle,n=Is(t.target.id,"card"),i=n===null?void 0:Ee(e,n);if(i===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const r=oe(Bi,t.payload),o=e.columns.find(m=>m.id===i.column),d=r.success?e.columns.find(m=>m.id===r.output.column):void 0,l=r.success?r.output.before:null,c=l===null||l!==i.id&&d?.cards.some(m=>m.id===l)===!0;if(!r.success||o===void 0||d===void 0||!c)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const h={...i,change:i.change??"moved"},p=o.id===d.id?a.moveSummarySame(i.title,d.label):a.moveSummaryAcross(i.title,o.label,d.label);return{data:Fs(Hi(e,i.id),h,{column:d.id,before:l}),result:{id:t.id,title:s,summary:p,tone:"move"}}},Wi=(a,e,t)=>{let s=e;const n=[];for(const i of t){const r=i.type===Rs?Gi(a,s,i):i.type===Os?Ki(a,s,i):{data:s,result:{id:i.id,title:i.type,stale:"unsupported-action-type"}};s=r.data,n.push(r.result)}return{data:s,results:n}},Vi=G`
|
|
3124
|
+
.kanban-board {
|
|
3125
|
+
display: flex;
|
|
3126
|
+
align-items: flex-start;
|
|
3127
|
+
gap: 14px;
|
|
3128
|
+
width: max-content;
|
|
3129
|
+
padding: 18px;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
.kanban-column {
|
|
3133
|
+
display: flex;
|
|
3134
|
+
flex-direction: column;
|
|
3135
|
+
gap: 8px;
|
|
3136
|
+
width: 264px;
|
|
3137
|
+
padding: 10px;
|
|
3138
|
+
border: 1px solid var(--dpk-rule);
|
|
3139
|
+
border-radius: var(--dpk-radius-lg);
|
|
3140
|
+
background: var(--dpk-paper-sunken);
|
|
3141
|
+
box-shadow: inset 0 1px 3px var(--dpk-shade-1);
|
|
3142
|
+
cursor: default;
|
|
3143
|
+
transition:
|
|
3144
|
+
border-color 150ms var(--dpk-ease),
|
|
3145
|
+
box-shadow 150ms var(--dpk-ease);
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
.kanban-column.is-selected {
|
|
3149
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
3150
|
+
box-shadow:
|
|
3151
|
+
inset 0 1px 3px var(--dpk-shade-1),
|
|
3152
|
+
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 40%, transparent);
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
.kanban-column.is-drop-target {
|
|
3156
|
+
border-color: var(--dpk-blue);
|
|
3157
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 60%, var(--dpk-paper-sunken));
|
|
3158
|
+
box-shadow:
|
|
3159
|
+
inset 0 1px 3px var(--dpk-shade-1),
|
|
3160
|
+
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 30%, transparent);
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
.kanban-column-head {
|
|
3164
|
+
position: relative;
|
|
3165
|
+
display: flex;
|
|
3166
|
+
align-items: center;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
.kanban-column-title {
|
|
3170
|
+
display: flex;
|
|
3171
|
+
flex: 1;
|
|
3172
|
+
align-items: center;
|
|
3173
|
+
gap: 8px;
|
|
3174
|
+
min-width: 0;
|
|
3175
|
+
padding: 2px 34px 2px 2px;
|
|
3176
|
+
border: 0;
|
|
3177
|
+
border-radius: var(--dpk-radius-xs);
|
|
3178
|
+
background: none;
|
|
3179
|
+
color: var(--dpk-ink);
|
|
3180
|
+
font-family: var(--dpk-body);
|
|
3181
|
+
font-size: 13px;
|
|
3182
|
+
font-weight: 650;
|
|
3183
|
+
letter-spacing: -0.01em;
|
|
3184
|
+
text-align: left;
|
|
3185
|
+
cursor: pointer;
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
.kanban-column-title:focus-visible {
|
|
3189
|
+
outline: none;
|
|
3190
|
+
box-shadow: var(--dpk-focus);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
.kanban-column-label {
|
|
3194
|
+
min-width: 0;
|
|
3195
|
+
overflow: hidden;
|
|
3196
|
+
text-overflow: ellipsis;
|
|
3197
|
+
white-space: nowrap;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
/* An authored color marks the heading, not the cards: the status reads at a glance. */
|
|
3201
|
+
.kanban-column[data-color='gray'] {
|
|
3202
|
+
--kanban-tone: var(--dpk-ink-soft);
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
.kanban-column[data-color='blue'] {
|
|
3206
|
+
--kanban-tone: var(--dpk-blue);
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
.kanban-column[data-color='green'] {
|
|
3210
|
+
--kanban-tone: var(--dpk-green);
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3213
|
+
.kanban-column[data-color='amber'] {
|
|
3214
|
+
--kanban-tone: var(--dpk-amber);
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
.kanban-column[data-color='violet'] {
|
|
3218
|
+
--kanban-tone: var(--dpk-violet);
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
.kanban-column[data-color='red'] {
|
|
3222
|
+
--kanban-tone: var(--dpk-accent);
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
.kanban-column[data-color] .kanban-column-label {
|
|
3226
|
+
padding: 2px 9px;
|
|
3227
|
+
border-radius: 999px;
|
|
3228
|
+
background: color-mix(in srgb, var(--kanban-tone) 14%, transparent);
|
|
3229
|
+
color: var(--kanban-tone);
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
.kanban-count {
|
|
3233
|
+
flex: none;
|
|
3234
|
+
padding: 1px 7px;
|
|
3235
|
+
border-radius: 999px;
|
|
3236
|
+
background: var(--dpk-paper-raised);
|
|
3237
|
+
color: var(--dpk-ink-soft);
|
|
3238
|
+
font-family: var(--dpk-mono);
|
|
3239
|
+
font-size: 11px;
|
|
3240
|
+
font-weight: 600;
|
|
3241
|
+
font-variant-numeric: tabular-nums;
|
|
3242
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
/* Over its WIP limit: the column asks for attention, not the cards. */
|
|
3246
|
+
.kanban-column.is-over {
|
|
3247
|
+
border-color: color-mix(in srgb, var(--dpk-accent) 55%, transparent);
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
.kanban-column.is-over .kanban-count {
|
|
3251
|
+
background: var(--dpk-accent-soft);
|
|
3252
|
+
color: var(--dpk-accent);
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
.kanban-column-head > .diagram-comment-trigger {
|
|
3256
|
+
position: absolute;
|
|
3257
|
+
top: 50%;
|
|
3258
|
+
right: 0;
|
|
3259
|
+
transform: translateY(-50%);
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
.kanban-column-description {
|
|
3263
|
+
margin: 0 2px;
|
|
3264
|
+
color: var(--dpk-ink-soft);
|
|
3265
|
+
font-size: 11.5px;
|
|
3266
|
+
line-height: 1.45;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
.kanban-cards {
|
|
3270
|
+
display: flex;
|
|
3271
|
+
flex-direction: column;
|
|
3272
|
+
gap: 8px;
|
|
3273
|
+
min-height: 44px;
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
.kanban-card-slot {
|
|
3277
|
+
position: relative;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
.kanban-card {
|
|
3281
|
+
display: flex;
|
|
3282
|
+
flex-direction: column;
|
|
3283
|
+
gap: 5px;
|
|
3284
|
+
padding: 9px 34px 9px 11px;
|
|
3285
|
+
border: 1px solid var(--dpk-rule);
|
|
3286
|
+
border-radius: var(--dpk-radius-sm);
|
|
3287
|
+
background: var(--dpk-paper-raised);
|
|
3288
|
+
color: var(--dpk-ink);
|
|
3289
|
+
font-family: var(--dpk-body);
|
|
3290
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
3291
|
+
cursor: grab;
|
|
3292
|
+
transition:
|
|
3293
|
+
border-color 150ms var(--dpk-ease),
|
|
3294
|
+
box-shadow 150ms var(--dpk-ease),
|
|
3295
|
+
opacity 150ms var(--dpk-ease),
|
|
3296
|
+
transform 150ms var(--dpk-ease);
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
.kanban-card:hover {
|
|
3300
|
+
border-color: var(--dpk-rule-hover);
|
|
3301
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
3302
|
+
transform: translateY(-1px);
|
|
3303
|
+
}
|
|
3304
|
+
|
|
3305
|
+
.kanban-card.is-selected {
|
|
3306
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
3307
|
+
box-shadow:
|
|
3308
|
+
var(--dpk-bevel),
|
|
3309
|
+
inset 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 45%, transparent),
|
|
3310
|
+
var(--dpk-shadow-xs);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
.kanban-card:focus-visible {
|
|
3314
|
+
outline: none;
|
|
3315
|
+
box-shadow: var(--dpk-focus);
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3318
|
+
.kanban-card.is-dragging {
|
|
3319
|
+
opacity: 0.45;
|
|
3320
|
+
transform: rotate(-1.5deg) scale(0.98);
|
|
3321
|
+
box-shadow: var(--dpk-shadow-sm);
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
/* Changed on this page by a draft action: not authored yet. */
|
|
3325
|
+
.kanban-card.is-added {
|
|
3326
|
+
border-style: dashed;
|
|
3327
|
+
border-color: var(--dpk-green);
|
|
3328
|
+
background: linear-gradient(var(--dpk-green-soft), var(--dpk-green-soft)), var(--dpk-paper-raised);
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
.kanban-card.is-moved {
|
|
3332
|
+
border-color: var(--dpk-blue);
|
|
3333
|
+
background: linear-gradient(var(--dpk-blue-soft), var(--dpk-blue-soft)), var(--dpk-paper-raised);
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
.kanban-card-title {
|
|
3337
|
+
font-size: 13px;
|
|
3338
|
+
font-weight: 600;
|
|
3339
|
+
letter-spacing: -0.005em;
|
|
3340
|
+
line-height: 1.45;
|
|
3341
|
+
overflow-wrap: anywhere;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
.kanban-card-description {
|
|
3345
|
+
display: -webkit-box;
|
|
3346
|
+
overflow: hidden;
|
|
3347
|
+
color: var(--dpk-ink-soft);
|
|
3348
|
+
font-size: 11.5px;
|
|
3349
|
+
line-height: 1.45;
|
|
3350
|
+
-webkit-box-orient: vertical;
|
|
3351
|
+
-webkit-line-clamp: 3;
|
|
3352
|
+
line-clamp: 3;
|
|
3353
|
+
overflow-wrap: anywhere;
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
.kanban-card-meta {
|
|
3357
|
+
display: flex;
|
|
3358
|
+
flex-wrap: wrap;
|
|
3359
|
+
align-items: center;
|
|
3360
|
+
gap: 4px;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
.kanban-tag {
|
|
3364
|
+
padding: 1px 7px;
|
|
3365
|
+
border: 1px solid var(--dpk-rule);
|
|
3366
|
+
border-radius: 999px;
|
|
3367
|
+
background: var(--dpk-paper-sunken);
|
|
3368
|
+
color: var(--dpk-ink-soft);
|
|
3369
|
+
font-size: 10.5px;
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
.kanban-assignee {
|
|
3373
|
+
margin-left: auto;
|
|
3374
|
+
color: var(--dpk-ink-faint);
|
|
3375
|
+
font-size: 11px;
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
.kanban-assignee::before {
|
|
3379
|
+
content: '';
|
|
3380
|
+
display: inline-block;
|
|
3381
|
+
width: 5px;
|
|
3382
|
+
height: 5px;
|
|
3383
|
+
margin-right: 4px;
|
|
3384
|
+
border-radius: 999px;
|
|
3385
|
+
background: var(--dpk-ink-faint);
|
|
3386
|
+
vertical-align: middle;
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
.kanban-card-slot > .diagram-comment-trigger {
|
|
3390
|
+
position: absolute;
|
|
3391
|
+
top: 5px;
|
|
3392
|
+
right: 5px;
|
|
3393
|
+
z-index: 2;
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
.kanban-error {
|
|
3397
|
+
margin: 6px 0 0;
|
|
3398
|
+
padding: 4px 7px;
|
|
3399
|
+
border-radius: var(--dpk-radius-xs);
|
|
3400
|
+
background: var(--dpk-accent-soft);
|
|
3401
|
+
color: var(--dpk-accent);
|
|
3402
|
+
font-size: 11.5px;
|
|
3403
|
+
line-height: 1.4;
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
/* Takes no room of its own, so the cards do not jump while dragging. */
|
|
3407
|
+
.kanban-drop-marker {
|
|
3408
|
+
height: 3px;
|
|
3409
|
+
margin: -5.5px 0;
|
|
3410
|
+
border-radius: 2px;
|
|
3411
|
+
background: var(--dpk-blue);
|
|
3412
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--dpk-blue) 22%, transparent);
|
|
3413
|
+
animation: dpk-drop-in 140ms var(--dpk-ease-spring) backwards;
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
@keyframes dpk-drop-in {
|
|
3417
|
+
from {
|
|
3418
|
+
opacity: 0;
|
|
3419
|
+
transform: scaleX(0.4);
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
.kanban-add {
|
|
3424
|
+
display: flex;
|
|
3425
|
+
flex-direction: column;
|
|
3426
|
+
gap: 6px;
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
.kanban-add-button {
|
|
3430
|
+
padding: 6px 8px;
|
|
3431
|
+
border: 1px dashed var(--dpk-rule-strong);
|
|
3432
|
+
border-radius: var(--dpk-radius-sm);
|
|
3433
|
+
background: none;
|
|
3434
|
+
color: var(--dpk-ink-soft);
|
|
3435
|
+
font-family: var(--dpk-body);
|
|
3436
|
+
font-size: 12px;
|
|
3437
|
+
text-align: left;
|
|
3438
|
+
cursor: pointer;
|
|
3439
|
+
transition:
|
|
3440
|
+
border-color 140ms var(--dpk-ease),
|
|
3441
|
+
background 140ms var(--dpk-ease),
|
|
3442
|
+
color 140ms var(--dpk-ease);
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
.kanban-add-button:hover,
|
|
3446
|
+
.kanban-add-button:focus-visible {
|
|
3447
|
+
border-color: color-mix(in srgb, var(--dpk-blue) 45%, var(--dpk-rule-strong));
|
|
3448
|
+
background: var(--dpk-paper-raised);
|
|
3449
|
+
color: var(--dpk-ink);
|
|
3450
|
+
outline: none;
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
.kanban-add .dpk-input {
|
|
3454
|
+
width: 100%;
|
|
3455
|
+
font-size: 12.5px;
|
|
3456
|
+
}
|
|
3457
|
+
`;class Ns extends Fe{static{this.styles=[Y,Vi]}#t=null;#n=null;#e=null;#s=null;#i=null;parseData(e){return As(e)}emptyData(){return Pi()}reduceElementActions(e,t){return Wi(ge(this.locale),e,t)}defaultHeading(){return ge(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return ge(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(t=>({value:this.commentRef("column",t.id),label:t.label})),...fe(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):Ee(t,e.id)!==void 0}tagItems(){return fe(this.items()).map(e=>e.tags)}statsText(){const e=ge(this.locale),t=fe(this.items()).length,s=fe(this.#a()).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.#t&&(this.#t=e,this.#n=null,this.#e=null)}renderCanvas(){const e=this.#a(),t=new Map(this.items().columns.map(s=>[s.id,s.cards.length]));return u`<div class="kanban-board">
|
|
3458
|
+
${Q(e.columns,s=>s.id,s=>this.#o(s,t.get(s.id)??0))}
|
|
3459
|
+
</div>`}#a(){const e=this.tagFilter;return ji(this.items(),e.active.length===0?null:t=>se(t.tags,e))}#r(e,t){const s=this.selection;return s!==null&&s.kind===e&&s.id===t}#o(e,t){const s=ge(this.locale),n=e.limit!==null&&t>e.limit,i=this.#i?.column===e.id?this.#i:null;return u`
|
|
3460
|
+
<section
|
|
3461
|
+
class=${V("kanban-column",n&&"is-over",this.#r("column",e.id)&&"is-selected",i!==null&&"is-drop-target")}
|
|
3462
|
+
data-column=${e.id}
|
|
3463
|
+
data-color=${e.color??b}
|
|
3464
|
+
aria-label=${e.label}
|
|
3465
|
+
>
|
|
3466
|
+
<div class="kanban-column-head">
|
|
3467
|
+
<button
|
|
3468
|
+
type="button"
|
|
3469
|
+
class="kanban-column-title"
|
|
3470
|
+
aria-pressed=${this.#r("column",e.id)?"true":"false"}
|
|
3471
|
+
title=${e.description??e.label}
|
|
3472
|
+
@click=${()=>this.select({kind:"column",id:e.id})}
|
|
3473
|
+
>
|
|
3474
|
+
<span class="kanban-column-label">${e.label}</span>
|
|
3475
|
+
<span class="kanban-count" title=${e.limit===null?b:s.wipLimit(e.limit)}>
|
|
3476
|
+
${e.limit===null?t:`${t} / ${e.limit}`}
|
|
3477
|
+
</span>
|
|
3478
|
+
</button>
|
|
3479
|
+
${this.renderCommentTrigger({kind:"column",id:e.id},e.label)}
|
|
3480
|
+
</div>
|
|
3481
|
+
${e.description===null?b:u`<p class="kanban-column-description">${e.description}</p>`}
|
|
3482
|
+
<div
|
|
3483
|
+
class="kanban-cards"
|
|
3484
|
+
@dragover=${r=>this.#d(r,e.id)}
|
|
3485
|
+
@dragleave=${r=>this.#m(r)}
|
|
3486
|
+
@drop=${r=>this.#g(r,e.id)}
|
|
3487
|
+
>
|
|
3488
|
+
${Q(e.cards,r=>r.id,r=>u`${i?.before===r.id?this.#c():b}${this.#p(r,s)}`)}
|
|
3489
|
+
${i!==null&&i.before===null?this.#c():b}
|
|
3490
|
+
</div>
|
|
3491
|
+
${this.#l(e,s)}
|
|
3492
|
+
</section>
|
|
3493
|
+
`}#c(){return u`<div class="kanban-drop-marker" aria-hidden="true"></div>`}#p(e,t){const s=this.#r("card",e.id);return u`
|
|
3494
|
+
<div class="kanban-card-slot">
|
|
3495
|
+
<div
|
|
3496
|
+
role="button"
|
|
3497
|
+
tabindex="0"
|
|
3498
|
+
draggable="true"
|
|
3499
|
+
class=${V("kanban-card",s&&"is-selected",e.change==="added"&&"is-added",e.change==="moved"&&"is-moved",this.#s===e.id&&"is-dragging")}
|
|
3500
|
+
data-card=${e.id}
|
|
3501
|
+
data-grill-questions=${this.questionsOf(e)}
|
|
3502
|
+
title=${e.description??e.title}
|
|
3503
|
+
aria-pressed=${s?"true":"false"}
|
|
3504
|
+
@click=${()=>this.select({kind:"card",id:e.id})}
|
|
3505
|
+
@keydown=${n=>this.#u(n,e.id)}
|
|
3506
|
+
@dragstart=${n=>this.#b(n,e.id)}
|
|
3507
|
+
@dragend=${()=>this.#f()}
|
|
3508
|
+
>
|
|
3509
|
+
<span class="kanban-card-title">${e.title}</span>
|
|
3510
|
+
${e.description===null?b:u`<span class="kanban-card-description">${e.description}</span>`}
|
|
3511
|
+
${e.tags.length===0&&e.assignee===null?b:u`<span class="kanban-card-meta">
|
|
3512
|
+
${e.tags.map(n=>u`<span class="kanban-tag">${n}</span>`)}
|
|
3513
|
+
${e.assignee===null?b:u`<span class="kanban-assignee">${e.assignee}</span>`}
|
|
3514
|
+
</span>`}
|
|
3515
|
+
</div>
|
|
3516
|
+
${this.renderCommentTrigger({kind:"card",id:e.id},e.title)}
|
|
3517
|
+
${this.#e===e.id?u`<p class="kanban-error" role="alert">${t.notRecorded}</p>`:b}
|
|
3518
|
+
</div>
|
|
3519
|
+
`}#l(e,t){const s=this.#n?.column===e.id?this.#n:null;return u`<div class="kanban-add">
|
|
3520
|
+
${s===null?u`<button
|
|
3521
|
+
type="button"
|
|
3522
|
+
class="kanban-add-button"
|
|
3523
|
+
data-action="add"
|
|
3524
|
+
@click=${()=>this.#M(e.id)}
|
|
3525
|
+
>
|
|
3526
|
+
${t.addCardButton}
|
|
3527
|
+
</button>`:u`
|
|
3528
|
+
<input
|
|
3529
|
+
class="dpk-input"
|
|
3530
|
+
aria-label="${t.addCardAriaLabel(e.label)}"
|
|
3531
|
+
placeholder="${t.addCardPlaceholder}"
|
|
3532
|
+
.value=${s.title}
|
|
3533
|
+
@input=${n=>{const i=n.currentTarget;i instanceof HTMLInputElement&&(this.#n={...s,title:i.value,failed:!1})}}
|
|
3534
|
+
@keydown=${n=>this.#C(n,e.id)}
|
|
3535
|
+
/>
|
|
3536
|
+
${s.failed?u`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:b}
|
|
3537
|
+
`}
|
|
3538
|
+
</div>`}#u(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(Os,["card",e],{column:t.column,before:t.before});this.#e=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#b(e,t){this.#s=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#s===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#x(e,t);this.#i?.column===s.column&&this.#i.before===s.before||(this.#i=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#i=null,this.requestUpdate())}#g(e,t){const s=this.#s;if(s===null)return;e.preventDefault();const n=this.#x(e,t);this.#f(),Ui(this.items(),s,n.column,n.before)||this.#h(s,n)}#f(){this.#s===null&&this.#i===null||(this.#s=null,this.#i=null,this.requestUpdate())}#x(e,t){const s=e.currentTarget,i=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(r=>{if(r.dataset.card===this.#s)return!1;const o=r.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:i?.dataset.card??null}}#M(e){this.#n={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#C(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#n=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#n?.title.trim()??"";if(s.length===0)return;const n=[...this.items().columns.map(r=>r.id),...fe(this.items()).map(r=>r.id)],i=dt(`card ${s}`,n);if(!this.dispatchElementAction(Rs,["column",t],{id:i,title:s})){this.#n={column:t,title:s,failed:!0},this.requestUpdate();return}this.#n=null,this.select({kind:"card",id:i}),this.requestUpdate()}}const Ps=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",Ns)},Yi=H({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),P=$(g(),te(),S(1)),be=T({id:le,text:P}),Ji=nt("kind",[T({kind:ee("proved"),assumptions:k(D(P))}),T({kind:ee("bounded"),bound:P}),T({kind:ee("incomplete"),gaps:k(D(P))}),T({kind:ee("planned")})]),Xi=T({id:le,target:k(le),statement:P,subjects:k(D(be)),premises:k(D(be)),conclusions:$(D(be),S(1,"a claim needs at least one conclusion")),examples:k(D(be)),notClaimed:k(D(be)),assurance:Ji,source:k(T({tool:k(P),ref:P}))}),Zi=T({id:le,name:P,meaning:P}),Qi=T({id:le,name:P,code:k(P),summary:k(P)}),er=T({targets:k(D(Qi)),terms:k(D(Zi)),claims:D(Xi)}),tr=()=>({targets:[],terms:[],claims:[]}),sr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,ar=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(sr)){const i=(n[1]??"").trim(),r=e.get(i);if(r===void 0)throw new Error(`unknown term reference: [[${i}]]`);n.index>s&&t.push({kind:"text",text:a.slice(s,n.index)}),t.push({kind:"term",id:i,label:n[2]?.trim()||r}),s=n.index+n[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Je=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),nr=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],qe=(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)}},js=a=>{const e=K(er,a),t=e.targets??[],s=e.terms??[];qe(t.map(c=>c.id),"target"),qe(s.map(c=>c.id),"term"),qe(e.claims.map(c=>c.id),"claim");const n=new Map(s.map(c=>[c.id,c.name])),i=c=>ar(c,n),r=s.map(c=>({id:c.id,name:c.name,meaning:i(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:i(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 h=I=>(I??[]).map(N=>({id:N.id,text:i(N.text)})),p=h(c.subjects),m=h(c.premises),v=h(c.conclusions),x=h(c.examples),w=h(c.notClaimed),y=[...p,...m,...v,...x,...w];qe(y.map(I=>I.id),`clause (in claim ${c.id})`);const E=ir(c.assurance,i),O=i(c.statement);return{id:c.id,target:c.target??null,statement:O,subjects:p,premises:m,conclusions:v,examples:x,notClaimed:w,assurance:E,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:nr([O,...y.map(I=>I.text),...rr(E)])}});return{targets:o,terms:r,claims:l}},ir=(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"}}},rr=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},or=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[Us(t.assurance)?"conditional":t.assurance.kind]+=1;return e},Us=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}))},ke=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},Xe=(a,e)=>{switch(e.kind){case"proved":return Us(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ke(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ke("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ke(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ke(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ke("",[])}}},dr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},lr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Bs=32,Te=a=>{const e=Je(a.statement);return e.length<=Bs?e:`${e.slice(0,Bs).trimEnd()}\u2026`},cr=a=>[{target:{kind:"claim",claim:a.id},label:Te(a)},...lr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${Te(a)} \u203A ${Je(e.text)}`}))],pr=a=>_s(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(cr)]),ur=[Ze,Qe,et,G`
|
|
3539
|
+
:host {
|
|
3540
|
+
display: block;
|
|
3541
|
+
container-type: inline-size;
|
|
3542
|
+
color: var(--dpk-ink);
|
|
3543
|
+
font-family: var(--dpk-body);
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
.spec {
|
|
3547
|
+
display: grid;
|
|
3548
|
+
gap: 14px;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
/* ----------------------------------------------------------- toolbar */
|
|
3552
|
+
|
|
3553
|
+
.spec-toolbar {
|
|
3554
|
+
display: flex;
|
|
3555
|
+
flex-wrap: wrap;
|
|
3556
|
+
align-items: baseline;
|
|
3557
|
+
gap: 4px 10px;
|
|
3558
|
+
padding: 0 2px 10px;
|
|
3559
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
.spec-title {
|
|
3563
|
+
font-family: var(--dpk-display);
|
|
3564
|
+
font-size: 14px;
|
|
3565
|
+
font-weight: 650;
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
.spec-subject {
|
|
3569
|
+
color: var(--dpk-ink-soft);
|
|
3570
|
+
font-size: 12.5px;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
.spec-stats {
|
|
3574
|
+
display: inline-flex;
|
|
3575
|
+
flex-wrap: wrap;
|
|
3576
|
+
align-items: center;
|
|
3577
|
+
gap: 6px;
|
|
3578
|
+
margin-left: auto;
|
|
3579
|
+
color: var(--dpk-ink-faint);
|
|
3580
|
+
font-size: 12px;
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
.spec-chip {
|
|
3584
|
+
padding: 1px 8px;
|
|
3585
|
+
border-radius: 999px;
|
|
3586
|
+
font-weight: 600;
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
.spec-notice,
|
|
3590
|
+
.spec-empty {
|
|
3591
|
+
margin: 0;
|
|
3592
|
+
padding: 14px;
|
|
3593
|
+
border-radius: var(--dpk-radius);
|
|
3594
|
+
font-size: 12.5px;
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
.spec-notice {
|
|
3598
|
+
background: var(--dpk-danger-soft);
|
|
3599
|
+
color: var(--dpk-danger);
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
.spec-empty {
|
|
3603
|
+
color: var(--dpk-ink-faint);
|
|
3604
|
+
text-align: center;
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
/* ------------------------------------------------------------ tones */
|
|
3608
|
+
|
|
3609
|
+
[data-tone='sound'] {
|
|
3610
|
+
--tone: var(--dpk-green);
|
|
3611
|
+
--tone-soft: var(--dpk-green-soft);
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
[data-tone='caveat'] {
|
|
3615
|
+
--tone: var(--dpk-amber);
|
|
3616
|
+
--tone-soft: var(--dpk-amber-soft);
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
[data-tone='unsound'] {
|
|
3620
|
+
--tone: var(--dpk-danger);
|
|
3621
|
+
--tone-soft: var(--dpk-danger-soft);
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
[data-tone='planned'] {
|
|
3625
|
+
--tone: var(--dpk-blue);
|
|
3626
|
+
--tone-soft: var(--dpk-blue-soft);
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
.spec-chip,
|
|
3630
|
+
.assurance-badge {
|
|
3631
|
+
background: var(--tone-soft);
|
|
3632
|
+
color: var(--tone);
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
/* ----------------------------------------------------------- targets */
|
|
3636
|
+
|
|
3637
|
+
.spec-groups {
|
|
3638
|
+
display: grid;
|
|
3639
|
+
gap: 28px;
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
.target-group {
|
|
3643
|
+
display: grid;
|
|
3644
|
+
gap: 12px;
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
.target-head {
|
|
3648
|
+
display: flex;
|
|
3649
|
+
flex-wrap: wrap;
|
|
3650
|
+
align-items: baseline;
|
|
3651
|
+
gap: 4px 10px;
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3654
|
+
.target-label {
|
|
3655
|
+
color: var(--dpk-ink-faint);
|
|
3656
|
+
font-size: 11.5px;
|
|
3657
|
+
font-weight: 650;
|
|
3658
|
+
letter-spacing: 0.04em;
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3661
|
+
.target-name {
|
|
3662
|
+
margin: 0;
|
|
3663
|
+
font-family: var(--dpk-display);
|
|
3664
|
+
font-size: 17px;
|
|
3665
|
+
font-weight: 700;
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
.target-code {
|
|
3669
|
+
padding: 1px 7px;
|
|
3670
|
+
border: 1px solid var(--dpk-rule);
|
|
3671
|
+
border-radius: var(--dpk-radius-sm);
|
|
3672
|
+
background: var(--dpk-paper-sunken);
|
|
3673
|
+
color: var(--dpk-ink-soft);
|
|
3674
|
+
font-family: var(--dpk-mono);
|
|
3675
|
+
font-size: 12px;
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
.target-head .comment-trigger {
|
|
3679
|
+
align-self: center;
|
|
3680
|
+
margin-left: auto;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
.target-summary {
|
|
3684
|
+
margin: -4px 0 0;
|
|
3685
|
+
color: var(--dpk-ink-soft);
|
|
3686
|
+
font-size: 13.5px;
|
|
3687
|
+
line-height: 1.7;
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3690
|
+
/* ------------------------------------------------------------ claims */
|
|
3691
|
+
|
|
3692
|
+
.spec-claims {
|
|
3693
|
+
display: grid;
|
|
3694
|
+
gap: 8px;
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
.claim {
|
|
3698
|
+
padding: 10px 14px 10px 8px;
|
|
3699
|
+
border: 1px solid var(--dpk-rule);
|
|
3700
|
+
border-radius: var(--dpk-radius-lg);
|
|
3701
|
+
background: var(--dpk-paper-raised);
|
|
3702
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
/* Folded, the head row is the whole card: the statement and how strongly it holds. */
|
|
3706
|
+
.claim-head {
|
|
3707
|
+
display: flex;
|
|
3708
|
+
align-items: flex-start;
|
|
3709
|
+
gap: 8px;
|
|
3710
|
+
cursor: pointer;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
.claim-toggle {
|
|
3714
|
+
display: grid;
|
|
3715
|
+
flex: none;
|
|
3716
|
+
place-items: center;
|
|
3717
|
+
width: 24px;
|
|
3718
|
+
height: 24px;
|
|
3719
|
+
margin-top: 1px;
|
|
3720
|
+
padding: 0;
|
|
3721
|
+
border: none;
|
|
3722
|
+
border-radius: var(--dpk-radius);
|
|
3723
|
+
background: transparent;
|
|
3724
|
+
color: var(--dpk-ink-faint);
|
|
3725
|
+
cursor: pointer;
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
.claim-toggle svg {
|
|
3729
|
+
width: 14px;
|
|
3730
|
+
height: 14px;
|
|
3731
|
+
transition: transform 120ms ease;
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
.claim-toggle[aria-expanded='true'] svg {
|
|
3735
|
+
transform: rotate(90deg);
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
.claim-toggle:hover,
|
|
3739
|
+
.claim-toggle:focus-visible {
|
|
3740
|
+
background: var(--dpk-paper-sunken);
|
|
3741
|
+
color: var(--dpk-ink);
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
.claim-body {
|
|
3745
|
+
display: grid;
|
|
3746
|
+
gap: 14px;
|
|
3747
|
+
margin: 12px 0 6px 32px;
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
/* The badge explains itself in a tooltip, so it is a button that hover, focus or a tap opens. */
|
|
3751
|
+
.assurance-badge {
|
|
3752
|
+
flex: none;
|
|
3753
|
+
margin-top: 2px;
|
|
3754
|
+
padding: 2px 10px;
|
|
3755
|
+
border: none;
|
|
3756
|
+
border-radius: 999px;
|
|
3757
|
+
font: inherit;
|
|
3758
|
+
font-size: 11.5px;
|
|
3759
|
+
font-weight: 650;
|
|
3760
|
+
white-space: nowrap;
|
|
3761
|
+
cursor: help;
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
.assurance-badge:focus-visible {
|
|
3765
|
+
outline: 2px solid var(--tone);
|
|
3766
|
+
outline-offset: 2px;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
.claim-head .comment-trigger {
|
|
3770
|
+
margin-left: auto;
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
.claim-statement {
|
|
3774
|
+
flex: 1;
|
|
3775
|
+
margin: 0;
|
|
3776
|
+
font-size: 14.5px;
|
|
3777
|
+
line-height: 1.65;
|
|
3778
|
+
font-weight: 500;
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
/* Subjects / premises / conclusions: the structure of the claim, one row per part. */
|
|
3782
|
+
.claim-parts {
|
|
3783
|
+
display: grid;
|
|
3784
|
+
grid-template-columns: max-content 1fr;
|
|
3785
|
+
margin: 0;
|
|
3786
|
+
border: 1px solid var(--dpk-rule);
|
|
3787
|
+
border-radius: var(--dpk-radius);
|
|
3788
|
+
background: var(--dpk-paper-sunken);
|
|
3789
|
+
overflow: hidden;
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
.claim-part {
|
|
3793
|
+
display: contents;
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
.claim-part > dt,
|
|
3797
|
+
.claim-part > dd {
|
|
3798
|
+
margin: 0;
|
|
3799
|
+
padding: 9px 12px;
|
|
3800
|
+
border-top: 1px solid var(--dpk-rule);
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
.claim-part:first-child > dt,
|
|
3804
|
+
.claim-part:first-child > dd {
|
|
3805
|
+
border-top: none;
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
.claim-part > dt {
|
|
3809
|
+
color: var(--dpk-ink-soft);
|
|
3810
|
+
font-size: 11.5px;
|
|
3811
|
+
font-weight: 650;
|
|
3812
|
+
letter-spacing: 0.04em;
|
|
3813
|
+
padding-top: 11px;
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
/* The conclusion is what the claim asserts: its label reads strongest. */
|
|
3817
|
+
.claim-part[data-part='conclusions'] > dt {
|
|
3818
|
+
color: var(--dpk-ink);
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
.claim-none {
|
|
3822
|
+
margin: 0;
|
|
3823
|
+
color: var(--dpk-ink-faint);
|
|
3824
|
+
font-size: 13px;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
.clauses {
|
|
3828
|
+
display: grid;
|
|
3829
|
+
gap: 2px;
|
|
3830
|
+
margin: 0;
|
|
3831
|
+
padding: 0;
|
|
3832
|
+
list-style: none;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
.clause {
|
|
3836
|
+
position: relative;
|
|
3837
|
+
display: flex;
|
|
3838
|
+
align-items: flex-start;
|
|
3839
|
+
gap: 6px;
|
|
3840
|
+
min-height: 28px;
|
|
3841
|
+
padding: 2px 0 2px 14px;
|
|
3842
|
+
font-size: 13.5px;
|
|
3843
|
+
line-height: 1.7;
|
|
3844
|
+
}
|
|
3845
|
+
|
|
3846
|
+
.clause::before {
|
|
3847
|
+
content: '';
|
|
3848
|
+
position: absolute;
|
|
3849
|
+
left: 2px;
|
|
3850
|
+
top: 0.95em;
|
|
3851
|
+
width: 5px;
|
|
3852
|
+
height: 5px;
|
|
3853
|
+
border-radius: 50%;
|
|
3854
|
+
background: var(--dpk-ink-faint);
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
.clause-text {
|
|
3858
|
+
flex: 1;
|
|
3859
|
+
min-width: 0;
|
|
3860
|
+
overflow-wrap: anywhere;
|
|
3861
|
+
}
|
|
3862
|
+
|
|
3863
|
+
/* ---------------------------------------------------------- assurance */
|
|
3864
|
+
|
|
3865
|
+
.assurance {
|
|
3866
|
+
padding: 10px 14px;
|
|
3867
|
+
border-radius: var(--dpk-radius);
|
|
3868
|
+
background: var(--tone-soft);
|
|
3869
|
+
font-size: 12.5px;
|
|
3870
|
+
line-height: 1.6;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
.assurance-label {
|
|
3874
|
+
margin: 0;
|
|
3875
|
+
color: var(--tone);
|
|
3876
|
+
font-weight: 650;
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
.assurance ul {
|
|
3880
|
+
margin: 4px 0 0;
|
|
3881
|
+
padding-left: 18px;
|
|
3882
|
+
color: var(--dpk-ink);
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
/* ---------------------------------------------------- examples / not */
|
|
3886
|
+
|
|
3887
|
+
.claim-aside h5 {
|
|
3888
|
+
margin: 0 0 2px;
|
|
3889
|
+
color: var(--dpk-ink-soft);
|
|
3890
|
+
font-size: 11.5px;
|
|
3891
|
+
font-weight: 650;
|
|
3892
|
+
letter-spacing: 0.04em;
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
.claim-aside[data-part='not-claimed'] {
|
|
3896
|
+
padding: 10px 14px;
|
|
3897
|
+
border: 1px dashed var(--dpk-rule-strong);
|
|
3898
|
+
border-radius: var(--dpk-radius);
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3901
|
+
.claim-aside[data-part='not-claimed'] .clause::before {
|
|
3902
|
+
content: '×';
|
|
3903
|
+
left: 0;
|
|
3904
|
+
top: 0;
|
|
3905
|
+
width: auto;
|
|
3906
|
+
height: auto;
|
|
3907
|
+
border-radius: 0;
|
|
3908
|
+
background: none;
|
|
3909
|
+
color: var(--dpk-ink-faint);
|
|
3910
|
+
font-weight: 700;
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
.claim-aside[data-part='not-claimed'] .clause-text {
|
|
3914
|
+
color: var(--dpk-ink-soft);
|
|
3915
|
+
}
|
|
3916
|
+
|
|
3917
|
+
/* ------------------------------------------------------------- footer */
|
|
3918
|
+
|
|
3919
|
+
.claim-foot {
|
|
3920
|
+
display: flex;
|
|
3921
|
+
flex-wrap: wrap;
|
|
3922
|
+
align-items: center;
|
|
3923
|
+
gap: 6px 8px;
|
|
3924
|
+
padding-top: 10px;
|
|
3925
|
+
border-top: 1px solid var(--dpk-rule);
|
|
3926
|
+
color: var(--dpk-ink-faint);
|
|
3927
|
+
font-size: 11.5px;
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
.claim-foot-label {
|
|
3931
|
+
font-weight: 650;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
.term-chip {
|
|
3935
|
+
padding: 1px 9px;
|
|
3936
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
3937
|
+
border-radius: 999px;
|
|
3938
|
+
background: var(--dpk-paper);
|
|
3939
|
+
color: var(--dpk-ink-soft);
|
|
3940
|
+
font: inherit;
|
|
3941
|
+
cursor: help;
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3944
|
+
.term-chip:is(:hover, :focus-visible) {
|
|
3945
|
+
border-color: var(--dpk-violet);
|
|
3946
|
+
color: var(--dpk-violet);
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
.claim-source {
|
|
3950
|
+
margin-left: auto;
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
.claim-source code {
|
|
3954
|
+
font-family: var(--dpk-mono);
|
|
3955
|
+
font-size: 11px;
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
/* -------------------------------------------------------------- terms */
|
|
3959
|
+
|
|
3960
|
+
.term {
|
|
3961
|
+
display: inline;
|
|
3962
|
+
padding: 0 1px;
|
|
3963
|
+
border: none;
|
|
3964
|
+
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
3965
|
+
background: none;
|
|
3966
|
+
color: inherit;
|
|
3967
|
+
font: inherit;
|
|
3968
|
+
font-weight: 600;
|
|
3969
|
+
cursor: help;
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
.term:hover,
|
|
3973
|
+
.term:focus-visible {
|
|
3974
|
+
background: var(--dpk-violet-soft);
|
|
3975
|
+
outline: none;
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3978
|
+
/* ----------------------------------------------------------- tooltip */
|
|
3979
|
+
|
|
3980
|
+
/* Sized to its text: the popover helper sets a fixed width, which only !important overrides. */
|
|
3981
|
+
.spec-tip {
|
|
3982
|
+
box-sizing: border-box;
|
|
3983
|
+
position: fixed;
|
|
3984
|
+
inset: auto;
|
|
3985
|
+
width: max-content !important;
|
|
3986
|
+
max-width: min(300px, calc(100vw - 16px));
|
|
3987
|
+
margin: 0;
|
|
3988
|
+
padding: 8px 11px;
|
|
3989
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
3990
|
+
border-radius: var(--dpk-radius);
|
|
3991
|
+
background: var(--dpk-paper-raised);
|
|
3992
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
3993
|
+
color: var(--dpk-ink);
|
|
3994
|
+
font-size: 12.5px;
|
|
3995
|
+
line-height: 1.6;
|
|
3996
|
+
pointer-events: none;
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3999
|
+
.spec-tip p {
|
|
4000
|
+
margin: 0;
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
.tip-title {
|
|
4004
|
+
color: var(--dpk-violet);
|
|
4005
|
+
font-weight: 650;
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
.spec-tip[data-tone] .tip-title {
|
|
4009
|
+
color: var(--tone);
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
.term-static {
|
|
4013
|
+
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
4014
|
+
font-weight: 600;
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
@container (max-width: 520px) {
|
|
4018
|
+
.claim-parts {
|
|
4019
|
+
grid-template-columns: 1fr;
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
.claim-part > dd {
|
|
4023
|
+
border-top: none;
|
|
4024
|
+
padding-top: 0;
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
/* ---------------------------------------------------------- comments */
|
|
4029
|
+
|
|
4030
|
+
.comment-trigger {
|
|
4031
|
+
flex: none;
|
|
4032
|
+
display: grid;
|
|
4033
|
+
place-items: center;
|
|
4034
|
+
width: 24px;
|
|
4035
|
+
height: 24px;
|
|
4036
|
+
padding: 4px;
|
|
4037
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
4038
|
+
border-radius: var(--dpk-radius-sm);
|
|
4039
|
+
background: var(--dpk-paper-raised);
|
|
4040
|
+
color: var(--dpk-ink-soft);
|
|
4041
|
+
cursor: pointer;
|
|
4042
|
+
opacity: 0;
|
|
4043
|
+
transition: opacity 120ms ease;
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
.comment-trigger svg {
|
|
4047
|
+
width: 14px;
|
|
4048
|
+
height: 14px;
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
:is(.target-head, .claim-head, .clause):is(:hover, :focus-within) > .comment-trigger,
|
|
4052
|
+
.comment-trigger[aria-expanded='true'] {
|
|
4053
|
+
opacity: 1;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
.comment-trigger:hover,
|
|
4057
|
+
.comment-trigger:focus-visible {
|
|
4058
|
+
border-color: var(--dpk-accent);
|
|
4059
|
+
background: var(--dpk-accent-soft);
|
|
4060
|
+
color: var(--dpk-accent);
|
|
4061
|
+
outline: none;
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
@media (hover: none) {
|
|
4065
|
+
.comment-trigger {
|
|
4066
|
+
opacity: 1;
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
.comment-target {
|
|
4071
|
+
font-size: 12px;
|
|
4072
|
+
overflow-wrap: anywhere;
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
.comment-error {
|
|
4076
|
+
margin: 0;
|
|
4077
|
+
font-size: 11px;
|
|
4078
|
+
color: var(--dpk-accent);
|
|
4079
|
+
}
|
|
4080
|
+
`],Hs=a=>`claim-body-${a}`;class Gs extends tt{static{this.styles=ur}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#t=null;#n=new Map;#e=null;#s=null;#i="";#a=null;#r=null;#o=new Map;#c=null;#p=new Set;#l=null;#u=null;#h=new Le(this);#b=new st(this,()=>{this.#i=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#i="",document.addEventListener("keydown",this.#y),document.addEventListener("pointerdown",this.#w),this.#s=mt(this,js,e=>{e.ok?this.#g(e.value):this.#f(e.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#y),document.removeEventListener("pointerdown",this.#w),this.#s?.(),this.#s=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#M(),this.#C(),this.#L()}get commentTargets(){if(!this.id||this.#t===null)return[];const e=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return pr(this.#t).map(({target:t,label:s})=>({value:this.#x(t),label:s,group:e}))}get dataError(){return this.#e}get#d(){return Yi(this.#b.locale)}#m(){return this.#t??tr()}#g(e){this.#t=e,this.#n=new Map(e.terms.map(t=>[t.id,t])),this.#e=null,this.requestUpdate()}#f(e){this.#t=null,this.#n=new Map,this.#e=e,console.error("[dev-process-kit] invalid formal spec data:",e),this.requestUpdate()}#x(e){return`element:${[this.id,...dr(e)].map(t=>encodeURIComponent(t)).join("/")}`}#M(){const e=JSON.stringify(this.commentTargets);e!==this.#i&&(this.#i=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#C(){const e=this.#r!==this.#a;this.#r=this.#a;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#E(this.#a);!t||!s||(this.#h.open(t,s,{width:300,height:280},{placement:"right-start"}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}#E(e){return e===null?null:[...this.renderRoot.querySelectorAll("[data-comment-ref]")].find(t=>t.dataset.commentRef===e)??null}#v(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 i=new Map(this.#o);i.delete(e),this.#o=i}this.#c=null;const s=this.#E(e);this.#a=null,this.requestUpdate(),s?.focus({preventScroll:!0})}#q(e){const t=new Set(this.#p);if(t.delete(e)||t.add(e),this.#p=t,!t.has(e)){const s=this.#x({kind:"clause",claim:e,clause:""});this.#a?.startsWith(s)&&(this.#a=null);const n=this.#l?.anchor;n?.closest(".claim-body")?.id===Hs(e)&&this.#k(n)}this.requestUpdate()}#T(e,t){const s=e.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#q(t)}#L(){const e=this.#l?.anchor??null,t=this.#u!==e;t&&(this.#u?.removeAttribute("aria-describedby"),e?.setAttribute("aria-describedby","spec-tip")),this.#u=e;const s=this.renderRoot.querySelector(".spec-tip");!s||!e||!t||this.#h.open(s,e,{width:300,height:240},{placement:"top-start"})}#D(e,t){this.#l?.anchor!==t&&(this.#l={tip:e,anchor:t},this.requestUpdate())}#k(e){this.#l===null||e!==void 0&&this.#l.anchor!==e||(this.#l=null,this.requestUpdate())}#y=e=>{e.key==="Escape"&&this.#k()};#w=e=>{this.#l!==null&&!e.composedPath().includes(this.#l.anchor)&&this.#k()};#$(e){const t=(n,i)=>{n.currentTarget instanceof HTMLElement&&i(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&t(n,i=>this.#D(e,i)),leave:n=>s(n)&&t(n,i=>this.#k(i)),show:n=>t(n,i=>this.#D(e,i)),hide:n=>t(n,i=>this.#k(i))}}render(){const e=this.#d,t=this.#m();return u`
|
|
4081
|
+
<section class="spec">
|
|
4082
|
+
<header class="spec-toolbar">
|
|
4083
|
+
<span class="spec-title">${this.heading??e.heading}</span>
|
|
4084
|
+
${this.subject?u`<span class="spec-subject">${this.subject}</span>`:b}
|
|
4085
|
+
<span class="spec-stats">${this.#z(t)}</span>
|
|
4086
|
+
</header>
|
|
4087
|
+
${this.#e===null?b:u`<p class="spec-notice" role="alert">${e.dataError}<br />${this.#e}</p>`}
|
|
4088
|
+
${this.#e===null&&t.claims.length===0?u`<p class="spec-empty">${e.empty}</p>`:b}
|
|
4089
|
+
<div class="spec-groups">
|
|
4090
|
+
${Q(_s(t),s=>s.target?.id??"",s=>this.#S(s))}
|
|
4091
|
+
</div>
|
|
4092
|
+
</section>
|
|
4093
|
+
${this.#_()} ${this.#H()}
|
|
4094
|
+
`}#z(e){const t=this.#d,s=or(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(i=>i.count>0);return u`${t.claims(e.claims.length)}
|
|
4095
|
+
${n.map(i=>u`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#S(e){const t=u`<div class="spec-claims">
|
|
4096
|
+
${Q(e.claims,n=>n.id,n=>this.#A(n))}
|
|
4097
|
+
</div>`,s=e.target;return s===null?t:u`<section class="target-group" data-target=${s.id}>
|
|
4098
|
+
<header class="target-head">
|
|
4099
|
+
<span class="target-label">${this.#d.target}</span>
|
|
4100
|
+
<h3 class="target-name">${s.name}</h3>
|
|
4101
|
+
${s.code===null?b:u`<code class="target-code">${s.code}</code>`}
|
|
4102
|
+
${this.#F({kind:"target",target:s.id},s.name)}
|
|
4103
|
+
</header>
|
|
4104
|
+
${s.summary===null?b:u`<p class="target-summary">${this.#R(s.summary)}</p>`}
|
|
4105
|
+
${e.claims.length===0?u`<p class="spec-empty">${this.#d.noClaims}</p>`:t}
|
|
4106
|
+
</section>`}#A(e){const t=this.#d,s=Xe(t,e.assurance),n=this.#p.has(e.id),i=this.#$({kind:"assurance",claim:e.id}),r=Hs(e.id);return u`
|
|
4107
|
+
<article class="claim" data-claim=${e.id} data-tone=${s.tone}>
|
|
4108
|
+
<div class="claim-head" @click=${o=>this.#T(o,e.id)}>
|
|
4109
|
+
<button
|
|
4110
|
+
type="button"
|
|
4111
|
+
class="claim-toggle"
|
|
4112
|
+
aria-expanded=${n?"true":"false"}
|
|
4113
|
+
aria-controls=${n?r:b}
|
|
4114
|
+
aria-label=${n?t.hideDetails:t.showDetails}
|
|
4115
|
+
@click=${()=>this.#q(e.id)}
|
|
4116
|
+
>
|
|
4117
|
+
${rt()}
|
|
4118
|
+
</button>
|
|
4119
|
+
<h4 class="claim-statement">${this.#R(e.statement)}</h4>
|
|
4120
|
+
<button
|
|
4121
|
+
type="button"
|
|
4122
|
+
class="assurance-badge"
|
|
4123
|
+
data-tone=${s.tone}
|
|
4124
|
+
@pointerenter=${i.enter}
|
|
4125
|
+
@pointerleave=${i.leave}
|
|
4126
|
+
@focus=${i.show}
|
|
4127
|
+
@blur=${i.hide}
|
|
4128
|
+
@click=${i.show}
|
|
4129
|
+
>
|
|
4130
|
+
${s.label}
|
|
4131
|
+
</button>
|
|
4132
|
+
${this.#F({kind:"claim",claim:e.id},Te(e))}
|
|
4133
|
+
</div>
|
|
4134
|
+
${n?this.#P(e,r):b}
|
|
4135
|
+
</article>
|
|
4136
|
+
`}#P(e,t){const s=this.#d,n=Xe(s,e.assurance);return u`<div class="claim-body" id=${t}>
|
|
4137
|
+
<dl class="claim-parts">
|
|
4138
|
+
${e.subjects.length===0?b:this.#O("subjects",s.subjects,e,e.subjects)}
|
|
4139
|
+
${e.premises.length===0?u`<div class="claim-part" data-part="premises">
|
|
4140
|
+
<dt>${s.premises}</dt>
|
|
4141
|
+
<dd><p class="claim-none">${s.noPremises}</p></dd>
|
|
4142
|
+
</div>`:this.#O("premises",s.premises,e,e.premises)}
|
|
4143
|
+
${this.#O("conclusions",s.conclusions,e,e.conclusions)}
|
|
4144
|
+
</dl>
|
|
4145
|
+
${n.itemsLabel===null?b:u`<div class="assurance" data-tone=${n.tone}>
|
|
4146
|
+
<p class="assurance-label">${n.itemsLabel}</p>
|
|
4147
|
+
<ul>
|
|
4148
|
+
${n.items.map(i=>u`<li>${this.#R(i)}</li>`)}
|
|
4149
|
+
</ul>
|
|
4150
|
+
</div>`}
|
|
4151
|
+
${e.examples.length===0?b:u`<section class="claim-aside" data-part="examples">
|
|
4152
|
+
<h5>${s.examples}</h5>
|
|
4153
|
+
${this.#I(e,e.examples)}
|
|
4154
|
+
</section>`}
|
|
4155
|
+
${e.notClaimed.length===0?b:u`<section class="claim-aside" data-part="not-claimed">
|
|
4156
|
+
<h5>${s.notClaimed}</h5>
|
|
4157
|
+
${this.#I(e,e.notClaimed)}
|
|
4158
|
+
</section>`}
|
|
4159
|
+
${this.#j(e)}
|
|
4160
|
+
</div>`}#O(e,t,s,n){return u`<div class="claim-part" data-part=${e}>
|
|
4161
|
+
<dt>${t}</dt>
|
|
4162
|
+
<dd>${this.#I(s,n)}</dd>
|
|
4163
|
+
</div>`}#I(e,t){return u`<ul class="clauses">
|
|
4164
|
+
${Q(t,s=>s.id,s=>u`<li class="clause" data-clause=${s.id}>
|
|
4165
|
+
<span class="clause-text">${this.#R(s.text)}</span>
|
|
4166
|
+
${this.#F({kind:"clause",claim:e.id,clause:s.id},`${Te(e)} \u203A ${Je(s.text)}`)}
|
|
4167
|
+
</li>`)}
|
|
4168
|
+
</ul>`}#j(e){const t=this.#d,s=e.terms.flatMap(n=>this.#n.get(n)??[]);return s.length===0&&e.source===null?b:u`<footer class="claim-foot">
|
|
4169
|
+
${s.length===0?b:u`<span class="claim-foot-label">${t.usesTerms}</span> ${s.map(n=>this.#N("term-chip",n.id,n.name))}`}
|
|
4170
|
+
${e.source===null?b:u`<span class="claim-source"
|
|
4171
|
+
>${t.source}: ${e.source.tool===null?b:u`${e.source.tool} · `}<code
|
|
4172
|
+
>${e.source.ref}</code
|
|
4173
|
+
></span
|
|
4174
|
+
>`}
|
|
4175
|
+
</footer>`}#R(e){return u`${e.map(t=>t.kind==="text"?t.text:this.#N("term",t.id,t.label))}`}#U(e){return u`${e.map(t=>t.kind==="text"?t.text:u`<span class="term-static">${t.label}</span>`)}`}#N(e,t,s){const n=this.#$({kind:"term",term:t});return u`<button
|
|
4176
|
+
type="button"
|
|
4177
|
+
class=${e}
|
|
4178
|
+
data-term=${t}
|
|
4179
|
+
@pointerenter=${n.enter}
|
|
4180
|
+
@pointerleave=${n.leave}
|
|
4181
|
+
@focus=${n.show}
|
|
4182
|
+
@blur=${n.hide}
|
|
4183
|
+
@click=${n.show}
|
|
4184
|
+
>
|
|
4185
|
+
${s}
|
|
4186
|
+
</button>`}#_(){const e=this.#l?.tip;if(e===void 0)return b;const t=this.#B(e);return t===null?b:u`<div
|
|
4187
|
+
id="spec-tip"
|
|
4188
|
+
class="spec-tip"
|
|
4189
|
+
role="tooltip"
|
|
4190
|
+
popover="manual"
|
|
4191
|
+
data-tone=${t.tone??b}
|
|
4192
|
+
>
|
|
4193
|
+
<p class="tip-title">${t.title}</p>
|
|
4194
|
+
<p class="tip-body">${t.body}</p>
|
|
4195
|
+
</div>`}#B(e){if(e.kind==="term"){const n=this.#n.get(e.term);return n===void 0?null:{title:n.name,body:this.#U(n.meaning)}}const t=this.#t?.claims.find(n=>n.id===e.claim);if(t===void 0)return null;const s=Xe(this.#d,t.assurance);return{title:s.label,body:s.detail,tone:s.tone}}#F(e,t){if(!this.id)return b;const s=this.#x(e),n=this.#d.commentOn(t);return u`<button
|
|
4196
|
+
type="button"
|
|
4197
|
+
class="comment-trigger"
|
|
4198
|
+
data-comment-ref=${s}
|
|
4199
|
+
aria-label=${n}
|
|
4200
|
+
title=${n}
|
|
4201
|
+
aria-haspopup="dialog"
|
|
4202
|
+
aria-expanded=${this.#a===s?"true":"false"}
|
|
4203
|
+
@click=${()=>{this.#a=this.#a===s?null:s,this.requestUpdate()}}
|
|
4204
|
+
>
|
|
4205
|
+
${at()}
|
|
4206
|
+
</button>`}#H(){const e=this.#a,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=ct(this.#o.get(e)??"",[],{label:t,key:e,...this.#c===e?{error:this.#d.sendFailed}:{}});return u`${lt(e,pt(ut(this.#b.locale),s,n=>this.#v(e,n)))}`}}const Ks=()=>{customElements.get("dpk-component-formal-spec")||customElements.define("dpk-component-formal-spec",Gs)},Ws=()=>{Dt(),Nt(),Ut(),ms(),ks(),zs(),Ps()},hr=()=>{la(),ca(),Ws(),Ks()};export{bs as D,jt as a,us as b,Gs as c,Ns as d,Ls as e,Ft as f,Tt as g,ks as h,Ut as i,ms as j,Ks as k,Ps as l,zs as m,Nt as n,Dt as o,js as p,As as q,hr as r,Cs as s,Rt as t,qt as u,Ws as v};
|