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