dev-process-kit 0.0.2-beta.1 → 0.0.3
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 +22 -9
- package/dist/chunks/shared-B2K3LoOU.js +1016 -0
- package/dist/chunks/shared-BqW3KAJ4.js +613 -0
- package/dist/chunks/shared-Byv6cc0r.js +2779 -0
- package/dist/chunks/{shared-CmM4cgd6.js → shared-CKG_SQh5.js} +1 -1
- package/dist/chunks/shared-CPAT0Cgk.js +29 -0
- package/dist/chunks/shared-CwbzACTe.js +1874 -0
- package/dist/chunks/shared-DBDgdVsd.js +1 -0
- package/dist/chunks/shared-DMlMTd3c.js +1018 -0
- package/dist/chunks/shared-DaoPCw6-.js +556 -0
- package/dist/chunks/shared-DqB_TR20.js +1599 -0
- package/dist/chunks/shared-DsVxrO_3.js +609 -0
- package/dist/chunks/shared-iQIywbRc.js +676 -0
- package/dist/chunks/shared-xrCdgpNS.js +1 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -0
- package/dist/templates/task-board.js +1 -0
- package/dist/templates/usm.js +1 -1
- package/package.json +4 -2
- package/dist/chunks/shared-5C6fORCL.js +0 -1404
- package/dist/chunks/shared-B1lFGiYZ.js +0 -1
- package/dist/chunks/shared-BEjjbZ0X.js +0 -2543
- package/dist/chunks/shared-BFAVBf4I.js +0 -1
- package/dist/chunks/shared-BybvAQye.js +0 -579
- package/dist/chunks/shared-DKxAm7wL.js +0 -27
- package/dist/chunks/shared-DgusMFKr.js +0 -1
- package/dist/chunks/shared-Dx0MEuAf.js +0 -921
- package/dist/chunks/shared-RclF4vSf.js +0 -692
- package/dist/chunks/shared-ao1beBgL.js +0 -544
- package/dist/chunks/shared-eiZoh1aF.js +0 -521
|
@@ -0,0 +1,1016 @@
|
|
|
1
|
+
import{a9 as lt,aa as q,ab as te,ac as ne,at as _,ad as v,au as B,ae as F,af as L,ag as M,q as T,an as S,v as oe,as as fe,P as ct,f as pt,_ as ht,V as U,R as $,a0 as ge,a5 as mt,k as ut,$ as xe,a6 as ft,a1 as N,av as gt,a2 as k,A as xt,K as bt,i as vt,aw as kt,a4 as X,a3 as be,ax as Et,T as ve,m as z}from"./shared-CwbzACTe.js";import{P as ke,c as yt,r as wt,p as $t,a as Tt}from"./shared-CPAT0Cgk.js";import{c as Ee}from"./shared-ml5h7U5L.js";function St(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}const V=["actor","command","aggregate","event","policy","readmodel","external","hotspot"],It=q({id:B,name:L(v(),M(1)),description:_(v())}),Lt=q({id:B,type:F(V),name:L(v(),M(1)),description:_(v()),contextId:_(v())}),Mt=q({id:B,from:L(v(),M(1)),to:L(v(),M(1)),label:_(v()),kind:_(F(["member","flow"]))}),ye=q({title:_(v()),contexts:te(ne(It),[]),elements:te(ne(Lt),[]),links:te(ne(Mt),[])}),we=t=>{const e=lt(ye,t),n=new Set(e.elements.map(i=>i.id)),o=new Set(e.contexts.map(i=>i.id));for(const i of e.elements)if(i.contextId!==void 0&&!o.has(i.contextId))throw new Error(`unknown context "${i.contextId}" for note "${i.id}"`);for(const i of e.links){if(!n.has(i.from))throw new Error(`unknown note "${i.from}" in link "${i.id}"`);if(!n.has(i.to))throw new Error(`unknown note "${i.to}" in link "${i.id}"`)}return e},$e=()=>({contexts:[],elements:[],links:[]}),P=(t,e)=>{if(e!==void 0)return t.elements.find(n=>n.id===e)},Y=(t,e)=>{if(e!==void 0)return t.contexts.find(n=>n.id===e)},ie=(t,e)=>{if(e!==void 0)return t.links.find(n=>n.id===e)},K=t=>t.elements.map(e=>e.id),w={SET_ELEMENT_NAME:T("SET_ELEMENT_NAME","element",S({name:L(v(),M(1))})),SET_ELEMENT_DESCRIPTION:T("SET_ELEMENT_DESCRIPTION","element",S({description:v()})),SET_ELEMENT_TYPE:T("SET_ELEMENT_TYPE","element",S({type:F(V)})),SET_ELEMENT_CONTEXT:T("SET_ELEMENT_CONTEXT","element",S({contextId:fe(v())})),MOVE_ELEMENT:T("MOVE_ELEMENT","element",S({after:fe(v())}),{mode:"sequence"}),ADD_ELEMENT:T("ADD_ELEMENT","page",S({id:B,type:F(V),name:L(v(),M(1)),description:_(v()),contextId:_(v())}),{dedupeKey:oe}),DELETE_ELEMENT:T("DELETE_ELEMENT","element",S({})),LINK_ELEMENTS:T("LINK_ELEMENTS","page",S({id:B,from:L(v(),M(1)),to:L(v(),M(1)),label:_(v()),kind:_(F(["member","flow"]))}),{dedupeKey:oe}),SET_LINK_LABEL:T("SET_LINK_LABEL","link",S({label:v()})),UNLINK_ELEMENTS:T("UNLINK_ELEMENTS","page",S({from:L(v(),M(1)),to:L(v(),M(1))}),{mode:"sequence"}),ADD_CONTEXT:T("ADD_CONTEXT","page",S({id:B,name:L(v(),M(1)),description:_(v())}),{dedupeKey:oe}),SET_CONTEXT_NAME:T("SET_CONTEXT_NAME","context",S({name:L(v(),M(1))})),DELETE_CONTEXT:T("DELETE_CONTEXT","context",S({}))},E={setElementName:(t,e)=>({type:"SET_ELEMENT_NAME",target:{type:"element",id:t},payload:{name:e}}),setElementDescription:(t,e)=>({type:"SET_ELEMENT_DESCRIPTION",target:{type:"element",id:t},payload:{description:e}}),setElementType:(t,e)=>({type:"SET_ELEMENT_TYPE",target:{type:"element",id:t},payload:{type:e}}),setElementContext:(t,e)=>({type:"SET_ELEMENT_CONTEXT",target:{type:"element",id:t},payload:{contextId:e}}),moveElement:(t,e)=>({type:"MOVE_ELEMENT",target:{type:"element",id:t},payload:{after:e}}),addElement:(t,e,n)=>({type:"ADD_ELEMENT",target:{type:"page",id:"event-storming"},payload:{id:t,type:e,name:n}}),deleteElement:t=>({type:"DELETE_ELEMENT",target:{type:"element",id:t},payload:{}}),linkElements:(t,e,n,o)=>({type:"LINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{id:t,from:e,to:n,...o?.label===void 0?{}:{label:o.label},...o?.kind===void 0?{}:{kind:o.kind}}}),setLinkLabel:(t,e)=>({type:"SET_LINK_LABEL",target:{type:"link",id:t},payload:{label:e}}),unlinkElements:(t,e)=>({type:"UNLINK_ELEMENTS",target:{type:"page",id:"event-storming"},payload:{from:t,to:e}}),addContext:(t,e)=>({type:"ADD_CONTEXT",target:{type:"page",id:"event-storming"},payload:{id:t,name:e}}),setContextName:(t,e)=>({type:"SET_CONTEXT_NAME",target:{type:"context",id:t},payload:{name:e}}),deleteContext:t=>({type:"DELETE_CONTEXT",target:{type:"context",id:t},payload:{}})},Te=(t,e)=>{const n=ct(w,e);if(n===null)return null;const o=n.target.id;switch(n.type){case"SET_ELEMENT_NAME":return j(t,o,i=>({...i,name:n.payload.name}));case"SET_ELEMENT_DESCRIPTION":return j(t,o,i=>({...i,description:n.payload.description}));case"SET_ELEMENT_TYPE":return j(t,o,i=>({...i,type:n.payload.type}));case"SET_ELEMENT_CONTEXT":{const{contextId:i}=n.payload;return i!==null&&!t.contexts.some(s=>s.id===i)?null:j(t,o,s=>i===null?Se(s):{...s,contextId:i})}case"MOVE_ELEMENT":{const{after:i}=n.payload,s=Nt(t.elements,o,i);return s===null?null:{...t,elements:s}}case"ADD_ELEMENT":{const i=n.payload;if(t.elements.some(r=>r.id===i.id))return t;if(i.contextId!==void 0&&!t.contexts.some(r=>r.id===i.contextId))return null;const s={id:i.id,type:i.type,name:i.name,...i.description===void 0?{}:{description:i.description},...i.contextId===void 0?{}:{contextId:i.contextId}};return{...t,elements:[...t.elements,s]}}case"DELETE_ELEMENT":return t.elements.some(i=>i.id===o)?{...t,elements:t.elements.filter(i=>i.id!==o),links:t.links.filter(i=>i.from!==o&&i.to!==o)}:null;case"LINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.id===i.id)?t:!t.elements.some(s=>s.id===i.from)||!t.elements.some(s=>s.id===i.to)?null:{...t,links:[...t.links,{id:i.id,from:i.from,to:i.to,...i.label===void 0?{}:{label:i.label},...i.kind===void 0?{}:{kind:i.kind}}]}}case"SET_LINK_LABEL":return t.links.some(i=>i.id===o)?{...t,links:t.links.map(i=>i.id===o?{...i,label:n.payload.label}:i)}:null;case"UNLINK_ELEMENTS":{const i=n.payload;return t.links.some(s=>s.from===i.from&&s.to===i.to)?{...t,links:t.links.filter(s=>!(s.from===i.from&&s.to===i.to))}:null}case"ADD_CONTEXT":{const i=n.payload;if(t.contexts.some(r=>r.id===i.id))return t;const s={id:i.id,name:i.name,...i.description===void 0?{}:{description:i.description}};return{...t,contexts:[...t.contexts,s]}}case"SET_CONTEXT_NAME":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.map(i=>i.id===o?{...i,name:n.payload.name}:i)}:null;case"DELETE_CONTEXT":return t.contexts.some(i=>i.id===o)?{...t,contexts:t.contexts.filter(i=>i.id!==o),elements:t.elements.map(i=>i.contextId===o?Se(i):i)}:null;default:return pt(n)}},Se=t=>{const e={...t};return delete e.contextId,e},j=(t,e,n)=>t.elements.some(o=>o.id===e)?{...t,elements:t.elements.map(o=>o.id===e?n(o):o)}:null,Nt=(t,e,n)=>{const o=t.findIndex(a=>a.id===e);if(o<0||n!==null&&!t.some(a=>a.id===n))return null;const i=t[o];if(i===void 0)return null;const r=[...t.filter(a=>a.id!==e)];return r.splice(n===null?0:r.findIndex(a=>a.id===n)+1,0,i),r},_t=new Set(["actor>command","command>aggregate","aggregate>event","command>event","policy>command","external>event"]),Z=(t,e)=>_t.has(`${t}>${e}`),Ct=(t,e,n)=>t.kind!==void 0?t.kind==="member":Z(e,n),Ot=["readmodel","actor","policy","command","aggregate","external","event","hotspot"],At=(t,e)=>{const n=new Map;for(const o of t.links){const i=e.get(o.from),s=e.get(o.to);if(i===void 0||s===void 0||i==="hotspot"==(s==="hotspot")||o.kind!==void 0&&o.kind!=="member")continue;const r=i==="hotspot"?o.from:o.to;n.has(r)||n.set(r,i==="hotspot"?o.to:o.from)}return n},zt=(t,e,n)=>{const o=new Map(t.map(a=>[a.id,a.id])),i=a=>{let d=a;for(;o.get(d)!==d;)d=o.get(d)??d;let l=a;for(;l!==d;){const p=o.get(l)??d;o.set(l,d),l=p}return d};for(const a of e){if(!o.has(a.from)||!o.has(a.to))continue;const d=n.get(a.from),l=n.get(a.to);d===void 0||l===void 0||Ct(a,d,l)&&o.set(i(a.from),i(a.to))}const s=new Map,r=new Map;for(const a of t){const d=i(a.id);r.set(a.id,d);const l=s.get(d);l?l.push(a):s.set(d,[a])}return{groups:s,rootOf:r}},R=t=>{const e=new Map(t.elements.map(l=>[l.id,l.type])),n=At(t,e),o=t.elements.filter(l=>!n.has(l.id)),{groups:i,rootOf:s}=zt(o,t.links,e),r=new Map;for(const[l,p]of n){const m=P(t,l),h=s.get(p);if(m===void 0||h===void 0)continue;const g=r.get(h);g?g.push({note:m,targetId:p}):r.set(h,[{note:m,targetId:p}])}const a=new Map(Ot.map((l,p)=>[l,p])),d=new Map(t.elements.map((l,p)=>[l.id,p]));return[...i].map(([l,p])=>{const m=[...p].sort((h,g)=>(a.get(h.type)??0)-(a.get(g.type)??0)||(d.get(h.id)??0)-(d.get(g.id)??0));return{id:p[0]?.id??"",notes:m,pins:r.get(l)??[],contextId:p.find(h=>h.contextId!==void 0)?.contextId}})},Dt=t=>{const e=R(t).flatMap(o=>[...o.notes,...o.pins.map(i=>i.note)]),n=new Set(e.map(o=>o.id));return{...t,elements:[...e,...t.elements.filter(o=>!n.has(o.id))]}},Ie=(t,e)=>{const n=[...t.notes,...t.pins.map(r=>r.note)],o=n.find(r=>Z(e,r.type));if(o!==void 0)return{anchorId:o.id,incoming:!0};const i=n.find(r=>Z(r.type,e));if(i!==void 0)return{anchorId:i.id,incoming:!1};const s=n[0];return s===void 0?void 0:{anchorId:s.id,incoming:!0}},Le=(t,e)=>{const n=new Map(e.flatMap(o=>o.notes.map(i=>[i.id,o.id])));return t.links.flatMap(o=>{const i=n.get(o.from),s=n.get(o.to);return i===void 0||s===void 0||i===s?[]:[{id:o.id,from:i,to:s,...o.label!==void 0?{label:o.label}:{}}]})},se=(t,e)=>`${t}\0${e}`,Me=(t,e,n)=>{const{widthOf:o,gapX:i,padX:s,maxWidth:r}=n,a=new Map;for(const c of e)a.set(se(c.from,c.to),c),a.set(se(c.to,c.from),c);const d=(c,f)=>c===void 0||f===void 0?void 0:a.get(se(c,f)),l=c=>St(c,f=>o(f))+i*Math.max(0,c.length-1)+s*2<=r,p=[];let m=[],h;const g=()=>{m.length!==0&&(p.push({sliceIds:m,...h===void 0?{}:{cutFrom:h}}),m=[],h=void 0)};for(const c of t.map(f=>f.id)){if(m.length>0&&!l([...m,c])){let f=m.length;for(;d(m[f-1],f===m.length?c:m[f])!==void 0&&(f-=1,f!==0););const x=f===0?[]:m.splice(f),b=f===0?d(m.at(-1),c):d(m.at(-1),x[0]);g(),m=x,h=b}m.push(c)}return g(),p},W=t=>[...t.notes].reverse().find(e=>e.type==="event")??t.notes.at(-1),Ne=(t,e)=>{const n=W(t),o=e.notes[0];if(!(n===void 0||o===void 0))return{from:n.id,to:o.id}},_e={actor:"Actor",command:"Command",aggregate:"Aggregate",event:"Domain Event",policy:"Policy",readmodel:"Read Model",external:"External System",hotspot:"Hotspot"},Ce={actor:"\u30A2\u30AF\u30BF\u30FC",command:"\u30B3\u30DE\u30F3\u30C9",aggregate:"\u96C6\u7D04",event:"\u30A4\u30D9\u30F3\u30C8",policy:"\u30DD\u30EA\u30B7\u30FC",readmodel:"\u30EA\u30FC\u30C9\u30E2\u30C7\u30EB",external:"\u5916\u90E8\u30B7\u30B9\u30C6\u30E0",hotspot:"\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8"},O=ht({en:{renameElementTitle:"Rename element",updateDescriptionTitle:"Update element description",changeTypeTitle:"Change element type",changeContextTitle:"Change the element\u2019s context",moveTitle:"Change timeline position",addElementTitle:"Add element",deleteElementTitle:"Delete element",linkTitle:"Link elements",renameLinkTitle:"Change link label",unlinkTitle:"Remove link",addContextTitle:"Add bounded context",renameContextTitle:"Rename bounded context",deleteContextTitle:"Delete bounded context",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"No context",moveToFront:"\u2192 To the front",moveAfter:t=>`\u2192 Right after "${t}"`,elementLabel:t=>`Element \xB7 ${t}`,contextLabel:t=>`Bounded context \xB7 ${t}`,linkLabel:(t,e)=>`Link \xB7 ${t}\u2192${e}`,linkGroup:"Link",pageLabel:t=>`Page \xB7 ${t}`,elementGroup:"Element",contextGroup:"Bounded context",noteTypeLabel:t=>_e[t],addTypeLabel:t=>`+ ${_e[t]}`,addHotspot:"+ Hotspot",pinHotspotTitle:"Pin a hotspot on this note",deleteNote:"Delete",noteNameLabel:"Note name",newContextTitle:"New bounded context",contextNamePlaceholder:"Context name",cancel:"Cancel",create:"Create",save:"Save",appendMenuNext:"Note to add next",appendMenuAfter:t=>`Continue after \u201C${t}\u201D`,emptyTitle:"No notes yet",emptyBody:"Start Event Storming by placing domain events on the timeline.",addFirstEvent:"+ First event",portAriaLabel:"Add what comes next (pick a type, or drag to connect to another slice)",portTitle:"Click: pick a note to continue / Drag: connect to another slice",renameContextHint:"Click to rename",dissolveContextAria:t=>`Dissolve bounded context "${t}"`,dissolveContextTitle:"Dissolve the bounded context (notes stay)",noteCount:t=>`${t} notes`,sliceCount:t=>`${t} slices`,contextCount:t=>`${t} bounded contexts`,hudHint:"Wheel: pan \xB7 Pinch: zoom \xB7 Drag background: select area",zoomOut:"Zoom out",zoomReset:"Reset to 100%",zoomIn:"Zoom in",zoomFit:"Fit to view",selectedLinks:t=>`${t} links selected`,deleteLinks:"Delete links",deleteHint:"Delete works too",clearSelection:"Clear selection",selectedSlices:t=>`${t} slices selected`,groupIntoContext:"Group into a bounded context",addToExistingAria:"Add to an existing bounded context",addToExistingOption:"Add to existing\u2026",removeFromContext:"Remove from context",deleteButton:"Delete"},ja:{renameElementTitle:"\u8981\u7D20\u540D\u3092\u5909\u66F4",updateDescriptionTitle:"\u8981\u7D20\u306E\u8AAC\u660E\u3092\u66F4\u65B0",changeTypeTitle:"\u8981\u7D20\u306E\u7A2E\u5225\u3092\u5909\u66F4",changeContextTitle:"\u6240\u5C5E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u5909\u66F4",moveTitle:"\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u4F4D\u7F6E\u3092\u5909\u66F4",addElementTitle:"\u8981\u7D20\u3092\u8FFD\u52A0",deleteElementTitle:"\u8981\u7D20\u3092\u524A\u9664",linkTitle:"\u8981\u7D20\u3092\u9023\u7D50",renameLinkTitle:"\u30EA\u30F3\u30AF\u540D\u3092\u5909\u66F4",unlinkTitle:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",addContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8FFD\u52A0",renameContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D\u3092\u5909\u66F4",deleteContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u524A\u9664",renamed:(t,e)=>`"${t}" \u2192 "${e}"`,noContext:"\u672A\u6240\u5C5E",moveToFront:"\u2192 \u5148\u982D\u3078",moveAfter:t=>`\u2192 "${t}" \u306E\u76F4\u5F8C\u3078`,elementLabel:t=>`\u8981\u7D20 \xB7 ${t}`,contextLabel:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8 \xB7 ${t}`,linkLabel:(t,e)=>`\u30EA\u30F3\u30AF \xB7 ${t}\u2192${e}`,linkGroup:"\u30EA\u30F3\u30AF",pageLabel:t=>`\u30DA\u30FC\u30B8 \xB7 ${t}`,elementGroup:"\u8981\u7D20",contextGroup:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",noteTypeLabel:t=>Ce[t],addTypeLabel:t=>`+ ${Ce[t]}`,addHotspot:"+ \u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8",pinHotspotTitle:"\u3053\u306E\u4ED8\u7B8B\u306B\u30DB\u30C3\u30C8\u30B9\u30DD\u30C3\u30C8\u3092\u7ACB\u3066\u308B",deleteNote:"\u524A\u9664",noteNameLabel:"\u4ED8\u7B8B\u540D",newContextTitle:"\u65B0\u3057\u3044\u5883\u754C\u3065\u3051\u3089\u308C\u305F\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8",contextNamePlaceholder:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u540D",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",create:"\u4F5C\u6210",save:"\u4FDD\u5B58",appendMenuNext:"\u7D9A\u304D\u306B\u8FFD\u52A0\u3059\u308B\u4ED8\u7B8B",appendMenuAfter:t=>`\u300C${t}\u300D\u306E\u7D9A\u304D\u306B\u8FFD\u52A0`,emptyTitle:"\u4ED8\u7B8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",emptyBody:"\u30A4\u30D9\u30F3\u30C8\u30B9\u30C8\u30FC\u30DF\u30F3\u30B0\u3092\u958B\u59CB\u3057\u307E\u3057\u3087\u3046\u3002\u30C9\u30E1\u30A4\u30F3\u30A4\u30D9\u30F3\u30C8\u3092\u6642\u7CFB\u5217\u306B\u8CBC\u308B\u3068\u3053\u308D\u304B\u3089\u59CB\u3081\u307E\u3059\u3002",addFirstEvent:"+ \u6700\u521D\u306E\u30A4\u30D9\u30F3\u30C8",portAriaLabel:"\u7D9A\u304D\u3092\u8FFD\u52A0\uFF08\u7A2E\u985E\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0\u3067\u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A\uFF09",portTitle:"\u30AF\u30EA\u30C3\u30AF: \u7D9A\u304D\u306E\u4ED8\u7B8B\u3092\u9078\u3093\u3067\u8FFD\u52A0 / \u30C9\u30E9\u30C3\u30B0: \u4ED6\u306E\u30B9\u30E9\u30A4\u30B9\u3078\u63A5\u7D9A",renameContextHint:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u540D\u524D\u3092\u5909\u66F4",dissolveContextAria:t=>`\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u300C${t}\u300D\u3092\u89E3\u4F53`,dissolveContextTitle:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u89E3\u4F53\uFF08\u4ED8\u7B8B\u306F\u6B8B\u308A\u307E\u3059\uFF09",noteCount:t=>`${t} \u4ED8\u7B8B`,sliceCount:t=>`${t} \u30B9\u30E9\u30A4\u30B9`,contextCount:t=>`${t} \u30B3\u30F3\u30C6\u30AD\u30B9\u30C8`,hudHint:"\u30DB\u30A4\u30FC\u30EB: \u79FB\u52D5 \xB7 \u30D4\u30F3\u30C1: \u30BA\u30FC\u30E0 \xB7 \u80CC\u666F\u30C9\u30E9\u30C3\u30B0: \u7BC4\u56F2\u9078\u629E",zoomOut:"\u7E2E\u5C0F",zoomReset:"100% \u306B\u623B\u3059",zoomIn:"\u62E1\u5927",zoomFit:"\u5168\u4F53\u3092\u8868\u793A",selectedLinks:t=>`${t} \u672C\u306E\u30EA\u30F3\u30AF\u3092\u9078\u629E\u4E2D`,deleteLinks:"\u30EA\u30F3\u30AF\u3092\u524A\u9664",deleteHint:"Delete \u3067\u3082\u524A\u9664\u3067\u304D\u307E\u3059",clearSelection:"\u9078\u629E\u89E3\u9664",selectedSlices:t=>`${t} \u30B9\u30E9\u30A4\u30B9\u3092\u9078\u629E\u4E2D`,groupIntoContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306B\u307E\u3068\u3081\u308B",addToExistingAria:"\u65E2\u5B58\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3078\u8FFD\u52A0",addToExistingOption:"\u65E2\u5B58\u3078\u8FFD\u52A0\u2026",removeFromContext:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u89E3\u9664",deleteButton:"\u524A\u9664"}}),Pt={SET_ELEMENT_NAME:(t,e,n)=>({title:t.renameElementTitle,tone:"update",body:t.renamed(P(n,e.target.id)?.name??"?",$(w.SET_ELEMENT_NAME,e).name)}),SET_ELEMENT_DESCRIPTION:(t,e)=>({title:t.updateDescriptionTitle,tone:"update",body:`\u2192 "${$(w.SET_ELEMENT_DESCRIPTION,e).description.slice(0,60)}"`}),SET_ELEMENT_TYPE:(t,e)=>({title:t.changeTypeTitle,tone:"update",body:`\u2192 ${$(w.SET_ELEMENT_TYPE,e).type}`}),SET_ELEMENT_CONTEXT:(t,e)=>({title:t.changeContextTitle,tone:"move",body:`\u2192 ${$(w.SET_ELEMENT_CONTEXT,e).contextId??t.noContext}`}),MOVE_ELEMENT:(t,e)=>({title:t.moveTitle,tone:"move",body:$(w.MOVE_ELEMENT,e).after===null?t.moveToFront:t.moveAfter($(w.MOVE_ELEMENT,e).after??"")}),ADD_ELEMENT:(t,e)=>({title:t.addElementTitle,tone:"create",body:`+ "${$(w.ADD_ELEMENT,e).name}"`}),DELETE_ELEMENT:(t,e,n)=>({title:t.deleteElementTitle,tone:"delete",body:`\u2212 "${P(n,e.target.id)?.name??e.target.id}"`}),LINK_ELEMENTS:(t,e)=>({title:t.linkTitle,tone:"create",body:`${$(w.LINK_ELEMENTS,e).from} \u2192 ${$(w.LINK_ELEMENTS,e).to}`}),SET_LINK_LABEL:(t,e)=>({title:t.renameLinkTitle,tone:"update",body:`\u2192 "${$(w.SET_LINK_LABEL,e).label}"`}),UNLINK_ELEMENTS:(t,e)=>({title:t.unlinkTitle,tone:"delete",body:`${$(w.UNLINK_ELEMENTS,e).from} \u2192 ${$(w.UNLINK_ELEMENTS,e).to}`}),ADD_CONTEXT:(t,e)=>({title:t.addContextTitle,tone:"create",body:`+ "${$(w.ADD_CONTEXT,e).name}"`}),SET_CONTEXT_NAME:(t,e)=>({title:t.renameContextTitle,tone:"update",body:`\u2192 "${$(w.SET_CONTEXT_NAME,e).name}"`}),DELETE_CONTEXT:(t,e,n)=>({title:t.deleteContextTitle,tone:"delete",body:`\u2212 "${Y(n,e.target.id)?.name??e.target.id}"`})},Oe=(t,e,n,o)=>{const i=Pt[e.type],r=i?i(t,e,o??n):{title:e.type,tone:"meta"};return{title:r.title,targetLabel:ze(t,n,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},Ae=t=>`${t.type} ${U(t.target)} ${JSON.stringify(t.payload)}`,ze=(t,e,n)=>{switch(n.type){case"element":{const o=P(e,n.id);return o?t.elementLabel(o.name):`${t.elementLabel(n.id)} (missing)`}case"context":{const o=Y(e,n.id);return o?t.contextLabel(o.name):`${t.contextLabel(n.id)} (missing)`}case"link":{const o=ie(e,n.id);return o?t.linkLabel(o.from,o.to):`${t.linkGroup} \xB7 ${n.id} (missing)`}case"page":return t.pageLabel(re(e));default:return`${n.type} \xB7 ${n.id}`}},De=(t,e)=>[...e.elements.map(n=>({value:U({type:"element",id:n.id}),label:n.name,group:t.elementGroup})),...e.contexts.map(n=>({value:U({type:"context",id:n.id}),label:n.name,group:t.contextGroup}))],Rt=(t,e,n)=>{const o=e.elements.find(i=>i.id===n.note);return o?{value:U({type:"element",id:o.id}),label:o.name,group:t.elementGroup}:null},re=t=>t.title??"Event Storming",Pe=(t,e)=>{const n={...e},o=P(t,e.note);e.note!==void 0&&!o&&delete n.note;const i=Y(t,e.context);return e.context!==void 0&&!i&&delete n.context,n},Re=(t,e)=>{switch(e.type){case"element":return P(t,e.id)!==void 0;case"context":return Y(t,e.id)!==void 0;case"link":return ie(t,e.id)!==void 0;case"page":return!0;default:return!1}},Be=t=>{const e=O(t);return{name:"event-storming",label:"Event Storming",parseBase:we,emptyBase:$e,actions:w,apply:Te,canonicalState:Dt,hasTarget:Re,describe:(n,o,i)=>Oe(e,n,o,i),serialize:Ae,resolveNavigation:Pe,commentTargets:(n,o)=>De(e,n),currentTarget:(n,o)=>Rt(e,n,o),title:re}},Bt={width:300,height:260},Xt={event:{bg:"linear-gradient(178deg, #ffbc55, #f8a52e)",ink:"#402703"},command:{bg:"linear-gradient(178deg, #93c9f2, #74b4e8)",ink:"#0e2c4b"},aggregate:{bg:"linear-gradient(178deg, #fff3a6, #fdea7e)",ink:"#4a3a06"},actor:{bg:"linear-gradient(178deg, #ffdf63, #fdd23e)",ink:"#423204"},policy:{bg:"linear-gradient(178deg, #dcc2f7, #c9a6f0)",ink:"#32195c"},readmodel:{bg:"linear-gradient(178deg, #c0e788, #a8dc63)",ink:"#22380a"},external:{bg:"linear-gradient(178deg, #f9bcd3, #f4a0c0)",ink:"#4b1029"},hotspot:{bg:"linear-gradient(178deg, #d63550, #b81c33)",ink:"#ffffff"}},ae=t=>{const{bg:e,ink:n}=Xt[t];return`--es-note-bg:${e};--es-note-ink:${n}`},Yt=ge`
|
|
2
|
+
:host {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
/* Top-aligned: the name stays put when the editor takes its place. */
|
|
6
|
+
justify-content: flex-start;
|
|
7
|
+
position: relative;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
padding: 16px 9px 8px;
|
|
10
|
+
border-radius: 3px;
|
|
11
|
+
background:
|
|
12
|
+
linear-gradient(165deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 40%),
|
|
13
|
+
var(--es-note-bg, var(--dpk-paper-raised));
|
|
14
|
+
color: var(--es-note-ink, var(--dpk-ink));
|
|
15
|
+
box-shadow:
|
|
16
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.3),
|
|
17
|
+
0 1px 2px rgba(30, 24, 10, 0.14),
|
|
18
|
+
0 5px 10px -4px rgba(30, 24, 10, 0.24);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transform: rotate(var(--es-tilt, 0deg));
|
|
21
|
+
transition:
|
|
22
|
+
transform 180ms var(--dpk-ease),
|
|
23
|
+
box-shadow 180ms var(--dpk-ease);
|
|
24
|
+
overflow: visible;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* A dog-eared corner: a quiet cue that this is a paper note, not a flat chip. */
|
|
28
|
+
:host::after {
|
|
29
|
+
content: '';
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
width: 13px;
|
|
34
|
+
height: 13px;
|
|
35
|
+
background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.16) 50%);
|
|
36
|
+
border-bottom-left-radius: 3px;
|
|
37
|
+
opacity: 0.6;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host(:hover) {
|
|
42
|
+
transform: rotate(0deg) translateY(-2px);
|
|
43
|
+
box-shadow:
|
|
44
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.32),
|
|
45
|
+
0 2px 4px rgba(30, 24, 10, 0.16),
|
|
46
|
+
0 12px 22px -6px rgba(30, 24, 10, 0.3);
|
|
47
|
+
z-index: 6;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([focused]) {
|
|
51
|
+
outline: 2px solid var(--dpk-blue);
|
|
52
|
+
outline-offset: 2px;
|
|
53
|
+
transform: rotate(0deg);
|
|
54
|
+
z-index: 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([data-mode='editing']),
|
|
58
|
+
:host([data-mode='commenting']) {
|
|
59
|
+
z-index: 7;
|
|
60
|
+
transform: rotate(0deg);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* --------------------------------------------------- sticky note palette */
|
|
64
|
+
|
|
65
|
+
/* Small, faint, top-left: readable when looked for, quiet when not. */
|
|
66
|
+
.note-type {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 5px;
|
|
69
|
+
left: 7px;
|
|
70
|
+
font-family: var(--dpk-mono);
|
|
71
|
+
font-size: 8px;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
letter-spacing: 0.12em;
|
|
74
|
+
opacity: 0.5;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Pinned hotspots are small: the type label is off and the name is centered. */
|
|
78
|
+
:host([compact]) {
|
|
79
|
+
justify-content: center;
|
|
80
|
+
padding: 7px 9px 8px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([compact]) .note-type {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.note-name {
|
|
88
|
+
flex: 1 1 auto;
|
|
89
|
+
min-width: 0;
|
|
90
|
+
min-height: 0;
|
|
91
|
+
font-size: 13px;
|
|
92
|
+
font-weight: 680;
|
|
93
|
+
line-height: 1.32;
|
|
94
|
+
letter-spacing: -0.01em;
|
|
95
|
+
overflow-wrap: anywhere;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host([compact]) .note-name {
|
|
99
|
+
flex: 0 1 auto;
|
|
100
|
+
font-size: 11.5px;
|
|
101
|
+
line-height: 1.3;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Comments already left: a passive corner flag, readable without hover. */
|
|
105
|
+
.note-flag {
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: -7px;
|
|
108
|
+
right: -7px;
|
|
109
|
+
min-width: 17px;
|
|
110
|
+
height: 17px;
|
|
111
|
+
padding: 0 4px;
|
|
112
|
+
border: 1.5px solid var(--dpk-paper-raised);
|
|
113
|
+
border-radius: 999px;
|
|
114
|
+
background: linear-gradient(180deg, var(--dpk-accent-bright), var(--dpk-accent));
|
|
115
|
+
color: var(--dpk-accent-ink);
|
|
116
|
+
font-family: var(--dpk-mono);
|
|
117
|
+
font-size: 9.5px;
|
|
118
|
+
font-weight: 650;
|
|
119
|
+
line-height: 17px;
|
|
120
|
+
text-align: center;
|
|
121
|
+
box-shadow: 0 1px 4px rgba(217, 73, 32, 0.35);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* A side rail of round buttons that fades in on hover, like the hotspot chip:
|
|
125
|
+
nothing crosses the card's face, and it stays clear of the pins above. */
|
|
126
|
+
.note-tools {
|
|
127
|
+
position: absolute;
|
|
128
|
+
top: 9px;
|
|
129
|
+
right: -11px;
|
|
130
|
+
z-index: 8;
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 3px;
|
|
134
|
+
opacity: 0;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
transition: opacity 140ms ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Labelled, not a glyph: the hotspot affordance names itself on the card's
|
|
140
|
+
top-right corner. It stays above the pins, which hang above that corner. */
|
|
141
|
+
.note-hotspot {
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: -9px;
|
|
144
|
+
right: -4px;
|
|
145
|
+
z-index: 9;
|
|
146
|
+
padding: 2px 7px;
|
|
147
|
+
border: 1px solid color-mix(in srgb, var(--dpk-danger) 45%, transparent);
|
|
148
|
+
border-radius: 999px;
|
|
149
|
+
font-size: 9.5px;
|
|
150
|
+
font-weight: 620;
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
color: var(--dpk-danger);
|
|
153
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
|
|
154
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
opacity: 0;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
transition:
|
|
159
|
+
opacity 140ms var(--dpk-ease),
|
|
160
|
+
transform 140ms var(--dpk-ease-spring),
|
|
161
|
+
background 140ms var(--dpk-ease),
|
|
162
|
+
border-color 140ms var(--dpk-ease);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host(:hover) .note-hotspot,
|
|
166
|
+
:host([data-mode='editing']) .note-hotspot,
|
|
167
|
+
.note-hotspot:focus-visible {
|
|
168
|
+
opacity: 1;
|
|
169
|
+
pointer-events: auto;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.note-hotspot:hover {
|
|
173
|
+
border-color: var(--dpk-danger);
|
|
174
|
+
background: var(--dpk-danger-soft);
|
|
175
|
+
transform: translateY(-1px);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:host(:hover) .note-tools,
|
|
179
|
+
:host([data-mode='commenting']) .note-tools,
|
|
180
|
+
.note-tools:focus-within {
|
|
181
|
+
opacity: 1;
|
|
182
|
+
pointer-events: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.note-tools .dpk-icon-btn {
|
|
186
|
+
width: 22px;
|
|
187
|
+
height: 22px;
|
|
188
|
+
border: 1px solid var(--dpk-rule);
|
|
189
|
+
border-radius: 50%;
|
|
190
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
|
|
191
|
+
backdrop-filter: blur(4px);
|
|
192
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
193
|
+
}
|
|
194
|
+
`;class Ht extends mt{static{this.styles=[ut,Yt,xe]}static{this.properties={note:{attribute:!1},notes:{attribute:!1},mode:{type:String,reflect:!0,attribute:"data-mode"},focused:{type:Boolean,reflect:!0},compact:{type:Boolean,reflect:!0},onIntent:{attribute:!1}}}#t="";#l=new ke(this);#i=new ft(this);constructor(){super(),this.note=null,this.notes=[],this.mode="view",this.focused=!1,this.compact=!1,this.onIntent=null,this.addEventListener("click",()=>this.#e({kind:"select"}))}updated(e){if(e.has("note")&&this.note&&(this.setAttribute("data-type",this.note.type),this.note.description===void 0?this.removeAttribute("title"):this.setAttribute("title",this.note.description)),e.has("mode")&&(this.mode!=="commenting"&&(this.#t=""),this.mode==="editing"&&this.renderRoot.querySelector("dpk-component-inline-edit")?.startEditing()),this.mode!=="commenting")return;const n=this.renderRoot.querySelector(".comment-pop"),o=this.renderRoot.querySelector('[data-role="comment"]');n&&o&&this.#l.open(n,o,Bt)}render(){const e=this.note;if(!e)return N;const n=O(this.#i.locale),o=yt(this.#i.locale);return k`
|
|
195
|
+
<div class="note-type">${n.noteTypeLabel(e.type)}</div>
|
|
196
|
+
<dpk-component-inline-edit
|
|
197
|
+
class="note-name"
|
|
198
|
+
?wrap=${!0}
|
|
199
|
+
?seamless=${!0}
|
|
200
|
+
.value=${e.name}
|
|
201
|
+
.label=${n.noteNameLabel}
|
|
202
|
+
@dpk-commit=${gt(i=>this.#e({kind:"rename",name:i}))}
|
|
203
|
+
></dpk-component-inline-edit>
|
|
204
|
+
${this.notes.length>0?k`<span class="note-flag">${this.notes.length}</span>`:N}
|
|
205
|
+
${e.type==="hotspot"?N:k`<button
|
|
206
|
+
class="note-hotspot"
|
|
207
|
+
type="button"
|
|
208
|
+
data-role="hotspot"
|
|
209
|
+
title=${n.pinHotspotTitle}
|
|
210
|
+
@click=${this.#s(()=>({kind:"add-hotspot"}))}
|
|
211
|
+
>
|
|
212
|
+
${n.addHotspot}
|
|
213
|
+
</button>`}
|
|
214
|
+
<div class="note-tools">
|
|
215
|
+
<button
|
|
216
|
+
class="dpk-icon-btn"
|
|
217
|
+
type="button"
|
|
218
|
+
data-role="comment"
|
|
219
|
+
aria-label=${o.comment}
|
|
220
|
+
data-active=${String(this.mode==="commenting")}
|
|
221
|
+
@click=${this.#s(()=>({kind:"toggle-comment"}))}
|
|
222
|
+
>
|
|
223
|
+
${xt()}
|
|
224
|
+
</button>
|
|
225
|
+
<button
|
|
226
|
+
class="dpk-icon-btn"
|
|
227
|
+
type="button"
|
|
228
|
+
data-role="delete"
|
|
229
|
+
aria-label=${n.deleteNote}
|
|
230
|
+
@click=${this.#s(()=>({kind:"delete"}))}
|
|
231
|
+
>
|
|
232
|
+
${bt()}
|
|
233
|
+
</button>
|
|
234
|
+
</div>
|
|
235
|
+
${this.mode==="commenting"?this.#c(o):N}
|
|
236
|
+
`}#c(e){return wt(e,$t(this.#t,this.notes.map(vt)),n=>{n.kind==="input"?(this.#t=n.body,this.requestUpdate()):this.#e(n)})}#s(e){return n=>{n.stopPropagation(),this.#e(e(n))}}#e(e){this.onIntent?.(e)}}const Ft=()=>{customElements.get("dpk-internal-event-storming-note")||customElements.define("dpk-internal-event-storming-note",Ht)},de=.25,Xe=2,Ye=(t,e,n)=>({...t,panX:t.panX+e,panY:t.panY+n}),le=(t,e,n,o)=>{const i=Ee(t.zoom*o,de,Xe),s=(e-t.panX)/t.zoom,r=(n-t.panY)/t.zoom;return{panX:e-s*i,panY:n-r*i,zoom:i}},He=(t,e,n)=>{const o=Math.max(1,e.width-n*2),i=Math.max(1,e.height-n*2),s=Math.max(de,Math.min(1,o/Math.max(1,t.width),i/Math.max(1,t.height)));return{panX:(e.width-t.width*s)/2,panY:(e.height-t.height*s)/2,zoom:s}},Fe=(t,e,n,o)=>{const i=(s,r,a,d)=>{const l=a*t.zoom;return l<=d?(d-l)/2-r*t.zoom:Math.min(-r*t.zoom,Math.max(d-(r+a)*t.zoom,s))};return{zoom:t.zoom,panX:i(t.panX,-o,e.width+o*2,n.width),panY:i(t.panY,-o,e.height+o*2,n.height)}},Kt=(t,e,n)=>e>=t.left&&e<=t.left+t.width&&n>=t.top&&n<=t.top+t.height,ce=(t,e,n)=>{for(let o=t.length-1;o>=0;o-=1){const i=t[o];if(i!==void 0&&Kt(i.rect,e,n))return i.id}},Ke=(t,e)=>e<t.left+t.width/2?"before":"after",We=(t,e)=>t.filter(({rect:n})=>n.left<e.left+e.width&&e.left<n.left+n.width&&n.top<e.top+e.height&&e.top<n.top+n.height).map(({id:n})=>n),pe=(t,e,n,o)=>{const i=new Set(e);if(n.some(p=>i.has(p)))return[];const s=t.filter(p=>!i.has(p)),r=n.map(p=>s.indexOf(p)).filter(p=>p>=0);if(r.length===0)return[];const a=o==="before"?Math.min(...r):Math.max(...r)+1,d=[];let l=s[a-1]??null;for(const p of t)i.has(p)&&(d.push({id:p,after:l}),l=p);return d},Ge=(t,e,n,o)=>{const i=pe(t,e,n,o);if(i.length===0)return i;const s=[...t];for(const r of i){const a=s.indexOf(r.id),d=a<0?void 0:s[a];d!==void 0&&(s.splice(a,1),s.splice(r.after===null?0:s.indexOf(r.after)+1,0,d))}return kt(s,t)?[]:i},qe=(t,e,n,o=4)=>{if(e.pointerId!==t.pointerId)return t;const{point:i}=e,s={pointerId:t.pointerId,start:t.start,current:i,moved:t.moved||Math.hypot(i.x-t.start.x,i.y-t.start.y)>o},r=ce(n,i.x,i.y);switch(t.kind){case"connect":return{...s,kind:"connect",fromSliceId:t.fromSliceId,...r!==void 0&&r!==t.fromSliceId?{targetSliceId:r}:{}};case"move-slice":{const a=n.find(d=>d.id===r)?.rect;return{...s,kind:"move-slice",sliceId:t.sliceId,...r!==void 0&&r!==t.sliceId&&a!==void 0?{drop:{sliceId:r,side:Ke(a,i.x)}}:{}}}case"select":return{...s,kind:"select"}}},C={kind:"idle"},Ue=(t,e)=>t.kind==="editing"&&t.noteId===e?"editing":t.kind==="commenting"&&t.noteId===e?"commenting":"view",Ve=(t,e,n)=>{switch(n.kind){case"toggle-comment":return t.kind==="commenting"&&t.noteId===e?C:{kind:"commenting",noteId:e};case"comment":case"delete":case"dismiss":return C;case"select":case"add-hotspot":return t;case"rename":return t.kind==="editing"&&t.noteId===e?C:t}},G=132,je=96,he=10,me=24,J=12,D=je+J*2,Q=46,ee=16,Ze=44,Je=40,ue=16,Qe=13,H=8,Wt=6,et=92,tt=54,nt=72,ot=tt+4,Gt=t=>Math.max(Ze,nt+(t-1)*ot-J),qt=["actor","command","aggregate","event","policy","readmodel","external"],it=t=>me*2+t*G+(t-1)*he,Ut=t=>{if(t===void 0)return 0;const e=new Map;for(const n of t.pins)e.set(n.targetId,(e.get(n.targetId)??0)+1);return Math.max(0,...e.values())},Vt=(t,e,n)=>{const o=new Map(e.map(g=>[g.id,it(g.notes.length)])),i=Le(t,e),s=Me(e,i,{widthOf:g=>o.get(g)??0,gapX:Q,padX:ee,maxWidth:Math.max(n,it(1))}),r=new Map,a=new Map,d=new Map,l=new Map(e.map(g=>[g.id,g]));let p=H;const m=s.map((g,c)=>{const f=g.cutFrom===void 0?void 0:a.get(g.cutFrom.from),x=f===void 0?0:Math.max(0,f-ee);let b=x+ee;const y=Gt(Math.max(1,...g.sliceIds.map(I=>Ut(l.get(I)))));for(const I of g.sliceIds)r.set(I,b-x),a.set(I,b),d.set(I,c),b+=(o.get(I)??0)+Q;const u=y+D+Je,A={sliceIds:g.sliceIds,x,width:b-Q+ee-x,height:u,y:p,head:y,cutFrom:g.cutFrom};return p+=u+Wt,A}),h=m.at(-1);return{slices:e,bands:m,xOf:r,absXOf:a,bandOf:d,widthOf:o,arrows:i,width:Math.max(0,...m.map(g=>g.x+g.width))+H*2,height:h===void 0?H*2:h.y+h.height+H}},jt=t=>{const{m:e,context:n,maxRowWidth:o,viewport:i,handlers:s}=t,{state:r}=n,a=24*i.zoom,d=`background-size:${a}px ${a}px;background-position:${i.panX}px ${i.panY}px`;if(r.elements.length===0)return k`<div class="board-viewport board-viewport--empty" style=${d}>
|
|
237
|
+
<div class="empty">
|
|
238
|
+
<h2>${e.emptyTitle}</h2>
|
|
239
|
+
<p>${e.emptyBody}</p>
|
|
240
|
+
<button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>s.addFirst()}>
|
|
241
|
+
${e.addFirstEvent}
|
|
242
|
+
</button>
|
|
243
|
+
</div>
|
|
244
|
+
</div>`;const l=R(r),p=Vt(r,l,o);return k`
|
|
245
|
+
<div
|
|
246
|
+
class="board-viewport${t.gesture!==void 0?" board-viewport--gesturing":""}"
|
|
247
|
+
data-testid="es-viewport"
|
|
248
|
+
tabindex="0"
|
|
249
|
+
style=${d}
|
|
250
|
+
@pointerdown=${s.viewportPointerDown}
|
|
251
|
+
@pointermove=${s.viewportPointerMove}
|
|
252
|
+
@pointerup=${s.viewportPointerUp}
|
|
253
|
+
@pointercancel=${s.viewportPointerCancel}
|
|
254
|
+
@pointerleave=${s.viewportPointerLeave}
|
|
255
|
+
@wheel=${s.viewportWheel}
|
|
256
|
+
@keydown=${s.keyDown}
|
|
257
|
+
>
|
|
258
|
+
<div
|
|
259
|
+
class="board-content"
|
|
260
|
+
style=${`transform:translate(${i.panX}px, ${i.panY}px) scale(${i.zoom})`}
|
|
261
|
+
>
|
|
262
|
+
<div class="wall" data-testid="es-wall" style=${`width:${p.width}px;height:${p.height}px`}>
|
|
263
|
+
${rn(t,p)}
|
|
264
|
+
${p.bands.map((m,h)=>Jt(t,p,m,h))}
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
${en(t.gesture)} ${tn(e,r,l)} ${nn(t)}
|
|
268
|
+
${on(t)}
|
|
269
|
+
</div>
|
|
270
|
+
`},Zt=(t,e)=>{const n=["slice"];t.selectedSliceIds.includes(e.id)&&n.push("slice--selected");const o=t.gesture;return o?.kind==="connect"&&o.moved&&(o.fromSliceId!==e.id&&n.push("slice--candidate"),o.targetSliceId===e.id&&n.push("slice--target")),o?.kind==="move-slice"&&o.moved&&(o.sliceId===e.id&&n.push("slice--lifted"),o.drop?.sliceId===e.id&&n.push(o.drop.side==="before"?"slice--insert-before":"slice--insert-after")),n.join(" ")},Jt=(t,e,n,o)=>{const{m:i,context:s,mode:r,gesture:a,hoverSliceId:d,handlers:l}=t,{navigation:p}=s,m=n.sliceIds.flatMap(c=>e.slices.filter(f=>f.id===c)),h=c=>({x:e.xOf.get(c.id)??0,y:n.head,w:e.widthOf.get(c.id)??0}),g=(c,f,x=!1)=>k`<dpk-internal-event-storming-note
|
|
271
|
+
style=${f}
|
|
272
|
+
.note=${c}
|
|
273
|
+
.notes=${s.comments.filter(b=>b.target.type==="element"&&b.target.id===c.id)}
|
|
274
|
+
.mode=${Ue(r,c.id)}
|
|
275
|
+
?focused=${p.note===c.id}
|
|
276
|
+
?compact=${x}
|
|
277
|
+
.onIntent=${b=>l.noteIntent(c.id,b)}
|
|
278
|
+
></dpk-internal-event-storming-note>`;return k`
|
|
279
|
+
<section class="band" data-band=${o} style=${`left:${H+n.x}px;top:${n.y}px`}>
|
|
280
|
+
<div class="band-canvas" style=${`width:${n.width}px;height:${n.height}px`}>
|
|
281
|
+
${Qt(t,e,o)}
|
|
282
|
+
${m.map(c=>{const{x:f,y:x,w:b}=h(c);return k`<div
|
|
283
|
+
class=${Zt(t,c)}
|
|
284
|
+
data-slice-id=${c.id}
|
|
285
|
+
style=${`left:${f}px;top:${x}px;width:${b}px;height:${D}px`}
|
|
286
|
+
@pointerdown=${y=>l.slicePointerDown(c.id,y)}
|
|
287
|
+
></div>`})}
|
|
288
|
+
${be(m.flatMap(c=>c.notes.map((f,x)=>({slice:c,note:f,slot:x}))),({note:c})=>c.id,({slice:c,note:f,slot:x})=>{const{x:b,y}=h(c),u=b+me+x*(G+he);return g(f,`${ae(f.type)};position:absolute;left:${u}px;top:${y+J}px;width:${G}px;height:${je}px;--es-tilt:${ln(f.id)}deg;z-index:2`)})}
|
|
289
|
+
${be(m.flatMap(c=>{const f=h(c);return c.notes.flatMap((x,b)=>c.pins.filter(u=>u.targetId===x.id).map((u,A)=>({pin:u,slot:b,index:A,at:f})))}),({pin:c})=>c.note.id,({pin:c,slot:f,index:x,at:b})=>{const y=b.x+me+f*(G+he),u=b.y+J;return g(c.note,`${ae(c.note.type)};position:absolute;left:${y+G-et-6-x*10}px;top:${u-nt-x*ot}px;width:${et}px;height:${tt}px;--es-tilt:-2.4deg;z-index:3`,!0)})}
|
|
290
|
+
${m.map(c=>{const{x:f,y:x,w:b}=h(c),y=d===c.id||a?.kind==="connect"&&a.fromSliceId===c.id;return k`<button
|
|
291
|
+
class="slice-port${y?" slice-port--on":""}"
|
|
292
|
+
type="button"
|
|
293
|
+
style=${`left:${f+b-Qe}px;top:${x+D/2-Qe}px`}
|
|
294
|
+
aria-label=${i.portAriaLabel}
|
|
295
|
+
title=${i.portTitle}
|
|
296
|
+
@pointerdown=${u=>l.portPointerDown(c.id,u)}
|
|
297
|
+
>
|
|
298
|
+
→
|
|
299
|
+
</button>`})}
|
|
300
|
+
${m.map(c=>{if(d!==c.id||a!==void 0)return N;const{x:f,y:x}=h(c),b=new Set(c.notes.map(u=>u.type)),y=qt.filter(u=>!b.has(u));return k`<div
|
|
301
|
+
class="slice-chips"
|
|
302
|
+
style=${`left:${f}px;top:${x+D+6}px`}
|
|
303
|
+
@pointerdown=${u=>u.stopPropagation()}
|
|
304
|
+
>
|
|
305
|
+
${y.map(u=>k`<button class="slice-chip" type="button" @click=${()=>l.attachNote(c.id,u)}>
|
|
306
|
+
${i.addTypeLabel(u)}
|
|
307
|
+
</button>`)}
|
|
308
|
+
</div>`})}
|
|
309
|
+
</div>
|
|
310
|
+
</section>
|
|
311
|
+
`},Qt=(t,e,n)=>{const{m:o,context:i,handlers:s}=t,r=i.state.contexts.flatMap((a,d)=>{const p=e.slices.filter(u=>u.contextId===a.id).flatMap(u=>{const A=e.xOf.get(u.id),I=e.bandOf.get(u.id);return A===void 0||I===void 0?[]:[{x:A,band:I,width:e.widthOf.get(u.id)??0}]}),m=p.filter(u=>u.band===n);if(m.length===0)return[];const h=Math.min(...m.map(u=>u.x))-10,g=Math.max(...m.map(u=>u.x+u.width))+10,c=14,f=(e.bands[n]?.head??Ze)+D+12,x=p.some(u=>u.band<n)?"\u2026 ":"",b=p.some(u=>u.band>n)?" \u2026":"",y=String(d%5);return[k`<div
|
|
312
|
+
class="context-region"
|
|
313
|
+
data-hue=${y}
|
|
314
|
+
style=${`left:${h}px;top:${c}px;width:${g-h}px;height:${f-c}px`}
|
|
315
|
+
title=${a.description??a.name}
|
|
316
|
+
></div>
|
|
317
|
+
<div
|
|
318
|
+
class="context-label"
|
|
319
|
+
data-hue=${y}
|
|
320
|
+
style=${`left:${h+10}px;top:${c}px`}
|
|
321
|
+
@pointerdown=${u=>u.stopPropagation()}
|
|
322
|
+
>
|
|
323
|
+
<button
|
|
324
|
+
class="context-label-name"
|
|
325
|
+
type="button"
|
|
326
|
+
title=${o.renameContextHint}
|
|
327
|
+
@click=${u=>s.renameContext(a.id,{x:u.clientX,y:u.clientY})}
|
|
328
|
+
>
|
|
329
|
+
${x}${a.name}${b}
|
|
330
|
+
</button>
|
|
331
|
+
<button
|
|
332
|
+
class="context-label-x"
|
|
333
|
+
type="button"
|
|
334
|
+
aria-label=${o.dissolveContextAria(a.name)}
|
|
335
|
+
title=${o.dissolveContextTitle}
|
|
336
|
+
@click=${()=>s.dissolveContext(a.id)}
|
|
337
|
+
>
|
|
338
|
+
✕
|
|
339
|
+
</button>
|
|
340
|
+
</div>`]});return r.length>0?k`${r}`:N},en=t=>{if(t===void 0||!t.moved)return N;if(t.kind==="connect")return k`<svg class="gesture-layer" aria-hidden="true">
|
|
341
|
+
${X`<path class="connect-line" d=${`M ${t.start.x} ${t.start.y} L ${t.current.x} ${t.current.y}`}></path>
|
|
342
|
+
<circle class="connect-tip" cx=${t.current.x} cy=${t.current.y} r="5"></circle>`}
|
|
343
|
+
</svg>`;if(t.kind==="select"){const e=Math.min(t.start.x,t.current.x),n=Math.min(t.start.y,t.current.y),o=Math.abs(t.current.x-t.start.x),i=Math.abs(t.current.y-t.start.y);return k`<div
|
|
344
|
+
class="select-rect"
|
|
345
|
+
style=${`left:${e}px;top:${n}px;width:${o}px;height:${i}px`}
|
|
346
|
+
></div>`}return N},tn=(t,e,n)=>k`<div class="board-hud">
|
|
347
|
+
<span class="board-hud-stat">${t.noteCount(e.elements.length)}</span>
|
|
348
|
+
<span class="board-hud-stat">${t.sliceCount(n.length)}</span>
|
|
349
|
+
<span class="board-hud-stat">${t.contextCount(e.contexts.length)}</span>
|
|
350
|
+
<span class="board-hint">${t.hudHint}</span>
|
|
351
|
+
</div>`,nn=t=>{const{m:e,viewport:n,handlers:o}=t;return k`<div class="board-zoom" @pointerdown=${i=>i.stopPropagation()}>
|
|
352
|
+
<button type="button" aria-label=${e.zoomOut} @click=${()=>o.zoomStep(-1)}>−</button>
|
|
353
|
+
<button type="button" class="board-zoom-pct" title=${e.zoomReset} @click=${()=>o.zoomReset()}>
|
|
354
|
+
${Math.round(n.zoom*100)}%
|
|
355
|
+
</button>
|
|
356
|
+
<button type="button" aria-label=${e.zoomIn} @click=${()=>o.zoomStep(1)}>+</button>
|
|
357
|
+
<button type="button" aria-label=${e.zoomFit} title=${e.zoomFit} @click=${()=>o.zoomFit()}>⛶</button>
|
|
358
|
+
</div>`},on=t=>{const{m:e,context:n,selectedSliceIds:o,selectedLinkIds:i,handlers:s}=t;if(i.length===0&&o.length===0)return N;const r=n.state.contexts;return i.length>0?k`<div class="board-selection" @pointerdown=${a=>a.stopPropagation()}>
|
|
359
|
+
<span class="board-selection-count">${e.selectedLinks(i.length)}</span>
|
|
360
|
+
<button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>s.deleteSelection()}>
|
|
361
|
+
${e.deleteLinks}
|
|
362
|
+
</button>
|
|
363
|
+
<span class="board-selection-hint">${e.deleteHint}</span>
|
|
364
|
+
<button
|
|
365
|
+
class="dpk-icon-btn"
|
|
366
|
+
type="button"
|
|
367
|
+
aria-label=${e.clearSelection}
|
|
368
|
+
@click=${()=>s.clearSelection()}
|
|
369
|
+
>
|
|
370
|
+
✕
|
|
371
|
+
</button>
|
|
372
|
+
</div>`:k`<div class="board-selection" @pointerdown=${a=>a.stopPropagation()}>
|
|
373
|
+
<span class="board-selection-count">${e.selectedSlices(o.length)}</span>
|
|
374
|
+
<button
|
|
375
|
+
class="dpk-btn dpk-btn--accent"
|
|
376
|
+
type="button"
|
|
377
|
+
@click=${a=>s.groupSelection({x:a.clientX,y:a.clientY})}
|
|
378
|
+
>
|
|
379
|
+
${e.groupIntoContext}
|
|
380
|
+
</button>
|
|
381
|
+
${r.length>0?k`<select
|
|
382
|
+
class="dpk-select"
|
|
383
|
+
aria-label=${e.addToExistingAria}
|
|
384
|
+
@change=${a=>{const d=Et(a.target,HTMLSelectElement);d!==null&&(d.value!==""&&s.assignSelection(d.value),d.value="")}}
|
|
385
|
+
>
|
|
386
|
+
<option value="" selected>${e.addToExistingOption}</option>
|
|
387
|
+
${r.map(a=>k`<option value=${a.id}>${a.name}</option>`)}
|
|
388
|
+
</select>`:N}
|
|
389
|
+
<button class="dpk-btn" type="button" @click=${()=>s.stripSelectionContext()}>
|
|
390
|
+
${e.removeFromContext}
|
|
391
|
+
</button>
|
|
392
|
+
<button class="dpk-btn" type="button" @click=${()=>s.deleteSelection()}>${e.deleteButton}</button>
|
|
393
|
+
<button class="dpk-icon-btn" type="button" aria-label=${e.clearSelection} @click=${()=>s.clearSelection()}>
|
|
394
|
+
✕
|
|
395
|
+
</button>
|
|
396
|
+
</div>`},st=(t,e,n,o)=>({d:`M ${t.x} ${t.y} C ${e.x} ${e.y}, ${n.x} ${n.y}, ${o.x} ${o.y}`,mid:{x:(t.x+3*e.x+3*n.x+o.x)/8,y:(t.y+3*e.y+3*n.y+o.y)/8}}),sn=()=>X`<marker id="es-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
397
|
+
<path d="M0,0 L8,4 L0,8 z"></path>
|
|
398
|
+
</marker>`,rn=(t,e)=>{const n="url(#es-arrow)",o=[],i=a=>{const d=e.absXOf.get(a),l=e.bandOf.get(a),p=l===void 0?void 0:e.bands[l];if(!(d===void 0||l===void 0||p===void 0))return{x:H+d,y:p.y+p.head,w:e.widthOf.get(a)??0,band:l}},s=a=>{const d=e.bands[a];return d===void 0?0:d.y+d.height},r=(a,d,l,p)=>{o.push(X`<path class="link-hit" d=${d} @pointerdown=${g=>g.stopPropagation()} @click=${g=>t.handlers.linkClick(a.id,g.shiftKey||g.metaKey||g.ctrlKey)}></path>`);const m=t.selectedLinkIds.includes(a.id)?" is-selected":"";if(o.push(X`<path class="link-path${m}" d=${d} marker-end=${n}></path>`),a.label===void 0)return;const h={start:6,end:-6,middle:0}[p];o.push(X`<text class="link-label" x=${l.x+h} y=${l.y-6} text-anchor=${p}>${a.label}</text>`)};for(const a of e.arrows){const d=i(a.from),l=i(a.to);if(d===void 0||l===void 0)continue;if(d.band===l.band){const x=l.x>=d.x+d.w;if((x?l.x-(d.x+d.w):d.x-(l.x+l.w))<=Q+2){const u=d.y+D/2,A=x?d.x+d.w:d.x,I=x?l.x:l.x+l.w;r(a,`M ${A} ${u} L ${I} ${u}`,{x:(A+I)/2,y:u},"middle");continue}const y=an(d,l,s(d.band)-Je/2);r(a,y.d,y.mid,"middle");continue}const p=d.y<l.y,m=d.x+ue,h=Ee(m,l.x+ue,l.x+l.w-ue),g={x:m,y:p?d.y+D:d.y},c={x:h,y:p?l.y:l.y+D},f=p?(s(d.band)+(e.bands[l.band]?.y??0))/2:(s(l.band)+(e.bands[d.band]?.y??0))/2;r(a,dn([g,{x:g.x,y:f},{x:c.x,y:f},c]),{x:c.x-6,y:f},"end")}return X`<svg class="links-layer" width=${e.width} height=${e.height}>
|
|
399
|
+
<defs>${sn()}</defs>
|
|
400
|
+
${o}
|
|
401
|
+
</svg>`},an=(t,e,n)=>{const o=t.y+D;if(e.x>=t.x+t.w){const r={x:t.x+t.w-18,y:o},a={x:e.x+18,y:o};return st(r,{x:r.x+48,y:n},{x:a.x-48,y:n},a)}const i={x:t.x+18,y:o},s={x:e.x+e.w-18,y:o};return st(i,{x:i.x-48,y:n},{x:s.x+48,y:n},s)},dn=(t,e=10)=>{let n=`M ${t[0]?.x??0} ${t[0]?.y??0}`;for(let i=1;i<t.length-1;i+=1){const s=t[i-1],r=t[i],a=t[i+1];if(s===void 0||r===void 0||a===void 0)continue;const d=Math.sign(r.x-s.x),l=Math.sign(r.y-s.y),p=Math.sign(a.x-r.x),m=Math.sign(a.y-r.y),h=Math.hypot(r.x-s.x,r.y-s.y),g=Math.hypot(a.x-r.x,a.y-r.y),c=Math.max(0,Math.min(e,h/2,g/2));n+=` L ${r.x-d*c} ${r.y-l*c} Q ${r.x} ${r.y} ${r.x+p*c} ${r.y+m*c}`}const o=t.at(-1);return o===void 0?n:`${n} L ${o.x} ${o.y}`},ln=t=>{let e=0;for(const n of t)e=(e*31+n.charCodeAt(0))%997;return(e%17-8)*.09},cn=ge`
|
|
402
|
+
/* The board owns the whole main area; the viewport clips, never the shell. */
|
|
403
|
+
.dpk-main {
|
|
404
|
+
overflow: hidden;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.dpk-main-body {
|
|
408
|
+
flex: 1 1 auto;
|
|
409
|
+
min-height: 0;
|
|
410
|
+
display: flex;
|
|
411
|
+
flex-direction: column;
|
|
412
|
+
padding: 0;
|
|
413
|
+
gap: 0;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* ------------------------------------------------------------- viewport */
|
|
417
|
+
|
|
418
|
+
/* An infinite pannable surface; the dot grid scrolls with the content
|
|
419
|
+
(background-position/-size are set inline from the viewport state). A
|
|
420
|
+
quiet sunken tray reads as the working surface under the wall. */
|
|
421
|
+
.board-viewport {
|
|
422
|
+
position: relative;
|
|
423
|
+
flex: 1 1 auto;
|
|
424
|
+
min-height: 0;
|
|
425
|
+
overflow: hidden;
|
|
426
|
+
touch-action: none;
|
|
427
|
+
background: var(--dpk-dots), var(--dpk-paper-sunken);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.board-viewport--gesturing,
|
|
431
|
+
.board-viewport--gesturing * {
|
|
432
|
+
user-select: none;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.board-viewport--empty {
|
|
436
|
+
display: grid;
|
|
437
|
+
place-items: center;
|
|
438
|
+
padding: 24px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.board-viewport:focus-visible {
|
|
442
|
+
outline: none;
|
|
443
|
+
box-shadow: inset var(--dpk-focus);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.board-content {
|
|
447
|
+
position: absolute;
|
|
448
|
+
left: 0;
|
|
449
|
+
top: 0;
|
|
450
|
+
width: max-content;
|
|
451
|
+
transform-origin: 0 0;
|
|
452
|
+
will-change: transform;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/* The wall is a fixed-size canvas: bands and the arrow layer are placed inside
|
|
456
|
+
it at explicit coordinates, so an arrow may span several bands. */
|
|
457
|
+
.wall {
|
|
458
|
+
position: relative;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.band {
|
|
462
|
+
position: absolute;
|
|
463
|
+
display: flex;
|
|
464
|
+
align-items: flex-start;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.band-canvas {
|
|
468
|
+
position: relative;
|
|
469
|
+
flex: 0 0 auto;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* ---------------------------------------------------------------- slices */
|
|
473
|
+
|
|
474
|
+
/* One causal slice: its notes framed together, read left to right.
|
|
475
|
+
The frame is also the drag handle for moving the whole slice. */
|
|
476
|
+
.slice {
|
|
477
|
+
position: absolute;
|
|
478
|
+
z-index: 1;
|
|
479
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
480
|
+
border-radius: var(--dpk-radius-lg);
|
|
481
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 82%, transparent);
|
|
482
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
483
|
+
cursor: grab;
|
|
484
|
+
transition:
|
|
485
|
+
border-color 160ms var(--dpk-ease),
|
|
486
|
+
background 160ms var(--dpk-ease),
|
|
487
|
+
box-shadow 160ms var(--dpk-ease);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.slice:hover {
|
|
491
|
+
border-color: var(--dpk-rule-hover);
|
|
492
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.slice--selected {
|
|
496
|
+
border-color: var(--dpk-blue);
|
|
497
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 60%, var(--dpk-paper-raised));
|
|
498
|
+
box-shadow:
|
|
499
|
+
var(--dpk-bevel),
|
|
500
|
+
0 0 0 2px var(--dpk-blue-soft),
|
|
501
|
+
var(--dpk-shadow-sm);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/* While a connection drag is out: everywhere it may land lights up dashed… */
|
|
505
|
+
.slice--candidate {
|
|
506
|
+
border: 1.5px dashed color-mix(in srgb, var(--dpk-blue) 55%, transparent);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/* …and the slice under the cursor confirms the landing. */
|
|
510
|
+
.slice--target {
|
|
511
|
+
border: 1.5px solid var(--dpk-blue);
|
|
512
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 55%, transparent);
|
|
513
|
+
box-shadow:
|
|
514
|
+
0 0 0 3px var(--dpk-blue-soft),
|
|
515
|
+
var(--dpk-shadow-sm);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/* The slice being carried by a move drag. */
|
|
519
|
+
.slice--lifted {
|
|
520
|
+
opacity: 0.45;
|
|
521
|
+
border-style: dashed;
|
|
522
|
+
cursor: grabbing;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* Insertion bar on the side of the drop target the slice will land on. */
|
|
526
|
+
.slice--insert-before::before,
|
|
527
|
+
.slice--insert-after::after {
|
|
528
|
+
content: '';
|
|
529
|
+
position: absolute;
|
|
530
|
+
top: -6px;
|
|
531
|
+
bottom: -6px;
|
|
532
|
+
width: 3px;
|
|
533
|
+
border-radius: 2px;
|
|
534
|
+
background: var(--dpk-blue);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.slice--insert-before::before {
|
|
538
|
+
left: -10px;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.slice--insert-after::after {
|
|
542
|
+
right: -10px;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/* Connection port on a slice's right edge: click continues, drag connects.
|
|
546
|
+
Shown only for the hovered slice (hover is hit-tested by the element,
|
|
547
|
+
with padding, so it stays up while the cursor crosses over to it). */
|
|
548
|
+
.slice-port {
|
|
549
|
+
position: absolute;
|
|
550
|
+
z-index: 5;
|
|
551
|
+
width: 26px;
|
|
552
|
+
height: 26px;
|
|
553
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
554
|
+
border-radius: 50%;
|
|
555
|
+
background: var(--dpk-paper-raised);
|
|
556
|
+
color: var(--dpk-ink-soft);
|
|
557
|
+
font-size: 13px;
|
|
558
|
+
line-height: 1;
|
|
559
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
560
|
+
cursor: crosshair;
|
|
561
|
+
opacity: 0;
|
|
562
|
+
pointer-events: none;
|
|
563
|
+
transition:
|
|
564
|
+
opacity 120ms var(--dpk-ease),
|
|
565
|
+
border-color 120ms var(--dpk-ease),
|
|
566
|
+
color 120ms var(--dpk-ease),
|
|
567
|
+
background 120ms var(--dpk-ease),
|
|
568
|
+
transform 160ms var(--dpk-ease-spring);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.slice-port--on,
|
|
572
|
+
.slice-port:focus-visible {
|
|
573
|
+
opacity: 1;
|
|
574
|
+
pointer-events: auto;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.slice-port:hover {
|
|
578
|
+
border-color: var(--dpk-blue);
|
|
579
|
+
background: var(--dpk-blue-soft);
|
|
580
|
+
color: var(--dpk-blue);
|
|
581
|
+
transform: scale(1.08);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* Add-note chips under the hovered slice: the roles it is still missing. */
|
|
585
|
+
.slice-chips {
|
|
586
|
+
position: absolute;
|
|
587
|
+
z-index: 6;
|
|
588
|
+
display: flex;
|
|
589
|
+
gap: 4px;
|
|
590
|
+
padding: 2px 0;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.slice-chip {
|
|
594
|
+
border: 1px dashed var(--dpk-rule-strong);
|
|
595
|
+
border-radius: 999px;
|
|
596
|
+
padding: 3px 9px;
|
|
597
|
+
font-size: 10.5px;
|
|
598
|
+
font-weight: 620;
|
|
599
|
+
white-space: nowrap;
|
|
600
|
+
color: var(--dpk-ink-soft);
|
|
601
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 90%, transparent);
|
|
602
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
603
|
+
cursor: pointer;
|
|
604
|
+
transition:
|
|
605
|
+
border-color 120ms var(--dpk-ease),
|
|
606
|
+
color 120ms var(--dpk-ease),
|
|
607
|
+
background 120ms var(--dpk-ease),
|
|
608
|
+
transform 140ms var(--dpk-ease-spring);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.slice-chip:hover {
|
|
612
|
+
border-color: var(--dpk-blue);
|
|
613
|
+
border-style: solid;
|
|
614
|
+
color: var(--dpk-blue);
|
|
615
|
+
background: var(--dpk-blue-soft);
|
|
616
|
+
transform: translateY(-1px);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/* ------------------------------------------------------ bounded contexts */
|
|
620
|
+
|
|
621
|
+
.context-region[data-hue='0'],
|
|
622
|
+
.context-label[data-hue='0'] {
|
|
623
|
+
--ctx-rgb: 51, 102, 204;
|
|
624
|
+
}
|
|
625
|
+
.context-region[data-hue='1'],
|
|
626
|
+
.context-label[data-hue='1'] {
|
|
627
|
+
--ctx-rgb: 13, 148, 136;
|
|
628
|
+
}
|
|
629
|
+
.context-region[data-hue='2'],
|
|
630
|
+
.context-label[data-hue='2'] {
|
|
631
|
+
--ctx-rgb: 174, 110, 6;
|
|
632
|
+
}
|
|
633
|
+
.context-region[data-hue='3'],
|
|
634
|
+
.context-label[data-hue='3'] {
|
|
635
|
+
--ctx-rgb: 124, 58, 237;
|
|
636
|
+
}
|
|
637
|
+
.context-region[data-hue='4'],
|
|
638
|
+
.context-label[data-hue='4'] {
|
|
639
|
+
--ctx-rgb: 190, 50, 100;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.context-region {
|
|
643
|
+
position: absolute;
|
|
644
|
+
z-index: 0;
|
|
645
|
+
border: 1.5px dashed rgba(var(--ctx-rgb), 0.36);
|
|
646
|
+
border-radius: var(--dpk-radius-lg);
|
|
647
|
+
background: linear-gradient(180deg, rgba(var(--ctx-rgb), 0.07), rgba(var(--ctx-rgb), 0.025));
|
|
648
|
+
box-shadow: inset 0 1px 0 rgba(var(--ctx-rgb), 0.14);
|
|
649
|
+
pointer-events: none;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/* The label rides the region's top edge and carries the rename/dissolve UI. */
|
|
653
|
+
.context-label {
|
|
654
|
+
position: absolute;
|
|
655
|
+
z-index: 7;
|
|
656
|
+
transform: translateY(-55%);
|
|
657
|
+
display: flex;
|
|
658
|
+
align-items: center;
|
|
659
|
+
gap: 4px;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.context-label-name {
|
|
663
|
+
border: none;
|
|
664
|
+
border-radius: 999px;
|
|
665
|
+
padding: 3px 10px;
|
|
666
|
+
font-family: var(--dpk-mono);
|
|
667
|
+
font-size: 9.5px;
|
|
668
|
+
font-weight: 650;
|
|
669
|
+
letter-spacing: 0.13em;
|
|
670
|
+
text-transform: uppercase;
|
|
671
|
+
white-space: nowrap;
|
|
672
|
+
color: #fff;
|
|
673
|
+
background: linear-gradient(180deg, rgba(var(--ctx-rgb), 0.98), rgba(var(--ctx-rgb), 0.84));
|
|
674
|
+
cursor: pointer;
|
|
675
|
+
box-shadow:
|
|
676
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.28),
|
|
677
|
+
0 1px 2px rgba(var(--ctx-rgb), 0.3),
|
|
678
|
+
var(--dpk-shadow-xs);
|
|
679
|
+
transition: transform 140ms var(--dpk-ease-spring);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.context-label-name:hover {
|
|
683
|
+
background: linear-gradient(180deg, rgba(var(--ctx-rgb), 1), rgba(var(--ctx-rgb), 0.92));
|
|
684
|
+
transform: translateY(-1px);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.context-label-x {
|
|
688
|
+
width: 18px;
|
|
689
|
+
height: 18px;
|
|
690
|
+
border: none;
|
|
691
|
+
border-radius: 50%;
|
|
692
|
+
font-size: 9px;
|
|
693
|
+
line-height: 1;
|
|
694
|
+
color: rgba(var(--ctx-rgb), 0.9);
|
|
695
|
+
background: color-mix(in srgb, var(--dpk-paper-raised) 92%, transparent);
|
|
696
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
697
|
+
cursor: pointer;
|
|
698
|
+
opacity: 0;
|
|
699
|
+
transition:
|
|
700
|
+
opacity 120ms var(--dpk-ease),
|
|
701
|
+
transform 140ms var(--dpk-ease-spring);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.context-label-x:hover {
|
|
705
|
+
transform: scale(1.1);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
.context-label:hover .context-label-x,
|
|
709
|
+
.context-label-x:focus-visible {
|
|
710
|
+
opacity: 1;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/* ---------------------------------------------------------------- arrows */
|
|
714
|
+
|
|
715
|
+
.links-layer {
|
|
716
|
+
position: absolute;
|
|
717
|
+
inset: 0;
|
|
718
|
+
/* Causality strokes are annotations drawn over the wall. */
|
|
719
|
+
z-index: 4;
|
|
720
|
+
pointer-events: none;
|
|
721
|
+
overflow: visible;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/* Stroke must come from a stylesheet, not a presentation attribute:
|
|
725
|
+
a var() inside stroke="..." is not substituted and the line stays invisible. */
|
|
726
|
+
.link-path {
|
|
727
|
+
fill: none;
|
|
728
|
+
stroke: var(--dpk-ink-soft);
|
|
729
|
+
stroke-width: 1.75;
|
|
730
|
+
stroke-linecap: round;
|
|
731
|
+
stroke-linejoin: round;
|
|
732
|
+
opacity: 0.65;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/* Invisible fat stroke on top of the line: a mistaken connection is easy to
|
|
736
|
+
pick, and picking it never starts a wall gesture. */
|
|
737
|
+
.link-hit {
|
|
738
|
+
fill: none;
|
|
739
|
+
stroke: transparent;
|
|
740
|
+
stroke-width: 14;
|
|
741
|
+
stroke-linecap: round;
|
|
742
|
+
pointer-events: stroke;
|
|
743
|
+
cursor: pointer;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.link-path.is-selected {
|
|
747
|
+
stroke: var(--dpk-blue);
|
|
748
|
+
stroke-width: 2.6;
|
|
749
|
+
opacity: 1;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.link-label {
|
|
753
|
+
font-family: var(--dpk-mono);
|
|
754
|
+
font-size: 9px;
|
|
755
|
+
font-weight: 620;
|
|
756
|
+
letter-spacing: 0.06em;
|
|
757
|
+
fill: var(--dpk-ink-soft);
|
|
758
|
+
paint-order: stroke;
|
|
759
|
+
stroke: var(--dpk-paper-sunken);
|
|
760
|
+
stroke-width: 4;
|
|
761
|
+
stroke-linejoin: round;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.links-layer marker path {
|
|
765
|
+
fill: var(--dpk-ink-soft);
|
|
766
|
+
opacity: 0.8;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/* --------------------------------------------------------------- gesture */
|
|
770
|
+
|
|
771
|
+
/* Overlays live in viewport space, above the transformed content. */
|
|
772
|
+
.gesture-layer {
|
|
773
|
+
position: absolute;
|
|
774
|
+
inset: 0;
|
|
775
|
+
z-index: 30;
|
|
776
|
+
width: 100%;
|
|
777
|
+
height: 100%;
|
|
778
|
+
pointer-events: none;
|
|
779
|
+
overflow: visible;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.connect-line {
|
|
783
|
+
fill: none;
|
|
784
|
+
stroke: var(--dpk-blue);
|
|
785
|
+
stroke-width: 2;
|
|
786
|
+
stroke-linecap: round;
|
|
787
|
+
stroke-dasharray: 6 4;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
.connect-tip {
|
|
791
|
+
fill: var(--dpk-blue);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.select-rect {
|
|
795
|
+
position: absolute;
|
|
796
|
+
z-index: 30;
|
|
797
|
+
border: 1px solid var(--dpk-blue);
|
|
798
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 40%, transparent);
|
|
799
|
+
pointer-events: none;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/* ------------------------------------------------------------ floating UI */
|
|
803
|
+
|
|
804
|
+
.board-hud {
|
|
805
|
+
position: absolute;
|
|
806
|
+
left: 12px;
|
|
807
|
+
bottom: 12px;
|
|
808
|
+
z-index: 40;
|
|
809
|
+
display: flex;
|
|
810
|
+
gap: 10px;
|
|
811
|
+
align-items: center;
|
|
812
|
+
padding: 6px 8px 6px 14px;
|
|
813
|
+
border: 1px solid var(--dpk-rule);
|
|
814
|
+
border-radius: 999px;
|
|
815
|
+
font-family: var(--dpk-mono);
|
|
816
|
+
font-size: 10px;
|
|
817
|
+
letter-spacing: 0.05em;
|
|
818
|
+
color: var(--dpk-ink-faint);
|
|
819
|
+
background: var(--dpk-glass);
|
|
820
|
+
backdrop-filter: blur(12px);
|
|
821
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
822
|
+
pointer-events: none;
|
|
823
|
+
animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.board-hud-stat {
|
|
827
|
+
padding-right: 10px;
|
|
828
|
+
border-right: 1px solid var(--dpk-rule);
|
|
829
|
+
font-variant-numeric: tabular-nums;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.board-hud-stat:last-of-type {
|
|
833
|
+
padding-right: 0;
|
|
834
|
+
border-right: 0;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
.board-hint {
|
|
838
|
+
color: var(--dpk-ink-faint);
|
|
839
|
+
opacity: 0.8;
|
|
840
|
+
letter-spacing: 0.02em;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
@keyframes dpk-hud-in {
|
|
844
|
+
from {
|
|
845
|
+
opacity: 0;
|
|
846
|
+
transform: translateY(6px);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
.board-zoom {
|
|
851
|
+
position: absolute;
|
|
852
|
+
right: 12px;
|
|
853
|
+
bottom: 12px;
|
|
854
|
+
z-index: 40;
|
|
855
|
+
display: flex;
|
|
856
|
+
align-items: center;
|
|
857
|
+
border: 1px solid var(--dpk-rule);
|
|
858
|
+
border-radius: var(--dpk-radius);
|
|
859
|
+
background: var(--dpk-glass);
|
|
860
|
+
backdrop-filter: blur(12px);
|
|
861
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
862
|
+
overflow: hidden;
|
|
863
|
+
animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.board-zoom button {
|
|
867
|
+
border: none;
|
|
868
|
+
background: transparent;
|
|
869
|
+
padding: 6px 10px;
|
|
870
|
+
font-size: 12px;
|
|
871
|
+
line-height: 1;
|
|
872
|
+
color: var(--dpk-ink-soft);
|
|
873
|
+
cursor: pointer;
|
|
874
|
+
transition:
|
|
875
|
+
background 140ms var(--dpk-ease),
|
|
876
|
+
color 140ms var(--dpk-ease);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.board-zoom button:hover {
|
|
880
|
+
background: var(--dpk-blue-soft);
|
|
881
|
+
color: var(--dpk-blue);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.board-zoom .board-zoom-pct {
|
|
885
|
+
min-width: 48px;
|
|
886
|
+
font-family: var(--dpk-mono);
|
|
887
|
+
font-size: 10.5px;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
.board-selection {
|
|
891
|
+
position: absolute;
|
|
892
|
+
left: 50%;
|
|
893
|
+
bottom: 14px;
|
|
894
|
+
transform: translateX(-50%);
|
|
895
|
+
z-index: 45;
|
|
896
|
+
display: flex;
|
|
897
|
+
gap: 8px;
|
|
898
|
+
align-items: center;
|
|
899
|
+
padding: 8px 12px;
|
|
900
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
901
|
+
border-radius: var(--dpk-radius);
|
|
902
|
+
background: var(--dpk-glass);
|
|
903
|
+
backdrop-filter: blur(12px);
|
|
904
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
905
|
+
animation: dpk-hud-in 200ms var(--dpk-ease-spring) backwards;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
.board-selection-count {
|
|
909
|
+
font-family: var(--dpk-mono);
|
|
910
|
+
font-size: 10.5px;
|
|
911
|
+
color: var(--dpk-ink-soft);
|
|
912
|
+
white-space: nowrap;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.board-selection-hint {
|
|
916
|
+
font-size: 10.5px;
|
|
917
|
+
color: var(--dpk-ink-faint);
|
|
918
|
+
white-space: nowrap;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/* ----------------------------------------------------------------- empty */
|
|
922
|
+
|
|
923
|
+
.empty {
|
|
924
|
+
border: 1.5px dashed var(--dpk-rule-strong);
|
|
925
|
+
border-radius: var(--dpk-radius-xl);
|
|
926
|
+
padding: 28px 24px;
|
|
927
|
+
background: var(--dpk-paper-raised);
|
|
928
|
+
max-width: 560px;
|
|
929
|
+
display: grid;
|
|
930
|
+
gap: 10px;
|
|
931
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
932
|
+
justify-items: start;
|
|
933
|
+
animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/* --------------------------------------------------------------- pickers */
|
|
937
|
+
|
|
938
|
+
.context-pop {
|
|
939
|
+
min-width: 220px;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/* -------------------------------------------------------- append picker */
|
|
943
|
+
|
|
944
|
+
/* The palette travels in --es-note-bg/-ink, so a chip previews what it adds. */
|
|
945
|
+
.append-menu {
|
|
946
|
+
min-width: 220px;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.append-menu .type-options {
|
|
950
|
+
display: grid;
|
|
951
|
+
grid-template-columns: 1fr 1fr;
|
|
952
|
+
gap: 4px;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.type-chip {
|
|
956
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
957
|
+
border-radius: var(--dpk-radius-xs);
|
|
958
|
+
padding: 6px 8px;
|
|
959
|
+
font-size: 11px;
|
|
960
|
+
font-weight: 620;
|
|
961
|
+
text-align: left;
|
|
962
|
+
background: var(--es-note-bg, var(--dpk-paper-raised));
|
|
963
|
+
color: var(--es-note-ink, var(--dpk-ink));
|
|
964
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
965
|
+
cursor: pointer;
|
|
966
|
+
transition:
|
|
967
|
+
transform 140ms var(--dpk-ease-spring),
|
|
968
|
+
box-shadow 140ms var(--dpk-ease);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
.type-chip:hover {
|
|
972
|
+
transform: translateY(-1px);
|
|
973
|
+
box-shadow: var(--dpk-shadow-sm);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.link-add .dpk-select {
|
|
977
|
+
flex: 1 1 auto;
|
|
978
|
+
min-width: 0;
|
|
979
|
+
}
|
|
980
|
+
`,pn={width:260,height:150},hn={width:236,height:210},mn=64,un=["event","command","aggregate","actor","policy","readmodel","external"],fn=1200,rt=5,gn={x:20,top:46,bottom:40};class at extends ve{static{this.styles=[ve.styles,cn,xe]}definitionFor(e){return Be(e)}static{this.properties={mode:{state:!0},boardWidth:{state:!0},viewport:{state:!0},gesture:{state:!0},hoverSliceId:{state:!0},selectedSliceIds:{state:!0},selectedLinkIds:{state:!0},naming:{state:!0}}}#t;#l=new ke(this);constructor(){super(),this.mode=C,this.boardWidth=fn,this.viewport={panX:24,panY:16,zoom:1},this.gesture=void 0,this.hoverSliceId=void 0,this.selectedSliceIds=[],this.selectedLinkIds=[],this.naming=void 0}disconnectedCallback(){super.disconnectedCallback(),this.#t?.disconnect(),this.#t=void 0}firstUpdated(){typeof ResizeObserver>"u"||(this.#t=new ResizeObserver(e=>{const n=e[0]?.contentRect.width;n!==void 0&&n>0&&(this.boardWidth=n)}),this.#t.observe(this))}updated(){super.updated(),this.#d(this.viewport),this.mode.kind==="append"&&this.#i("#append-menu",this.mode.point,hn),this.naming!==void 0&&this.#i("#context-pop",this.naming.point,pn,"#context-name")}#i(e,n,o,i){const s=this.renderRoot.querySelector(e);if(!s||s.matches(":popover-open")||(this.#l.open(s,Tt(n.x,n.y),o),i===void 0))return;const r=this.renderRoot.querySelector(i);r?.focus(),r instanceof HTMLInputElement&&r.select()}#c(){return Math.max(xn,this.boardWidth-96)}renderRegions(e){return{main:this.#s(e)}}#s(e){const n=O(this.locale);return k`
|
|
981
|
+
${jt({m:n,context:e,mode:this.mode,maxRowWidth:this.#c(),viewport:this.viewport,gesture:this.gesture,hoverSliceId:this.hoverSliceId,selectedSliceIds:this.selectedSliceIds,selectedLinkIds:this.selectedLinkIds,handlers:{noteIntent:(o,i)=>this.#T(o,i),addFirst:()=>this.#P(e),attachNote:(o,i)=>this.#_(e,o,i),viewportPointerDown:o=>this.#v(o),viewportPointerMove:o=>this.#k(o),viewportPointerUp:o=>this.#E(e,o),viewportPointerCancel:()=>this.gesture=void 0,viewportPointerLeave:()=>{this.gesture===void 0&&(this.hoverSliceId=void 0)},viewportWheel:o=>this.#y(o),portPointerDown:(o,i)=>this.#x(o,i),slicePointerDown:(o,i)=>this.#b(o,i),zoomStep:o=>this.#w(o),zoomFit:()=>this.#$(),zoomReset:()=>this.#h(1/this.viewport.zoom),groupSelection:o=>{this.selectedSliceIds.length>0&&(this.naming={kind:"create-context",sliceIds:this.selectedSliceIds,point:o})},assignSelection:o=>this.#f(e,o),stripSelectionContext:()=>this.#f(e,null),clearSelection:()=>{this.selectedSliceIds=[],this.selectedLinkIds=[]},linkClick:(o,i)=>this.#O(o,i),deleteSelection:()=>this.#u(e),keyDown:o=>this.#A(e,o),renameContext:(o,i)=>this.naming={kind:"rename-context",contextId:o,point:i},dissolveContext:o=>e.dispatch(E.deleteContext(o))}})}
|
|
982
|
+
${this.mode.kind==="append"?this.#D(e,this.mode.sliceId):N}
|
|
983
|
+
${this.naming!==void 0?this.#z(e,this.naming):N}
|
|
984
|
+
`}#e(){return this.renderRoot.querySelector(".board-viewport")}#n(e){const n=this.#e()?.getBoundingClientRect();return n===void 0?{x:e.clientX,y:e.clientY}:{x:e.clientX-n.left,y:e.clientY-n.top}}#r(e){const n=this.#e();if(n===null)return[];const o=n.getBoundingClientRect();return[...this.renderRoot.querySelectorAll("[data-slice-id]")].map(i=>{const s=i.getBoundingClientRect();return{id:i.dataset.sliceId??"",rect:{left:s.left-o.left-(e?.x??0),top:s.top-o.top-(e?.top??0),width:s.width+(e?.x??0)*2,height:s.height+(e?.top??0)+(e?.bottom??0)}}})}#p(e,n){const o=this.#e();o!==null&&(o.setPointerCapture(e.pointerId),this.gesture=n)}#x(e,n){if(n.button!==0)return;n.stopPropagation(),n.preventDefault();const o=this.#n(n);this.#p(n,{kind:"connect",pointerId:n.pointerId,fromSliceId:e,start:o,current:o,moved:!1})}#b(e,n){if(n.button!==0)return;n.stopPropagation(),n.preventDefault();const o=this.#n(n);this.#p(n,{kind:"move-slice",pointerId:n.pointerId,sliceId:e,start:o,current:o,moved:!1})}#v(e){if(e.button!==0||this.gesture!==void 0)return;for(const o of e.composedPath()){if(o===e.currentTarget)break;if(o instanceof Element&&(o.tagName.toLowerCase()==="dpk-internal-event-storming-note"||o.matches("button, select, textarea, input, a")))return}const n=this.#n(e);(this.mode.kind==="editing"||this.mode.kind==="append")&&(this.mode=C),this.selectedLinkIds=[],this.#p(e,{kind:"select",pointerId:e.pointerId,start:n,current:n,moved:!1})}#k(e){const n=this.gesture,o=this.#n(e);if(n===void 0){const i=ce(this.#r(gn),o.x,o.y);i!==this.hoverSliceId&&(this.hoverSliceId=i);return}this.gesture=qe(n,{pointerId:e.pointerId,point:o},this.#r(),rt)}#E(e,n){const o=this.gesture;if(o===void 0||n.pointerId!==o.pointerId)return;const i=qe(o,{pointerId:n.pointerId,point:this.#n(n)},this.#r(),rt);if(this.gesture=void 0,i.kind==="connect"){i.moved?i.targetSliceId!==void 0&&this.#S(e,i.fromSliceId,i.targetSliceId):this.#L(i.fromSliceId);return}if(i.kind==="move-slice"){if(!i.moved){this.selectedSliceIds=this.selectedSliceIds.includes(i.sliceId)?this.selectedSliceIds.filter(r=>r!==i.sliceId):[...this.selectedSliceIds,i.sliceId];return}i.drop!==void 0&&this.#C(e,i.sliceId,i.drop.sliceId,i.drop.side);return}if(!i.moved){this.selectedSliceIds=[];return}const s={left:Math.min(i.start.x,i.current.x),top:Math.min(i.start.y,i.current.y),width:Math.abs(i.current.x-i.start.x),height:Math.abs(i.current.y-i.start.y)};this.selectedSliceIds=[...We(this.#r(),s)]}#y(e){e.preventDefault();const n=this.#n(e);this.#d(e.ctrlKey||e.metaKey?le(this.viewport,n.x,n.y,Math.exp(-e.deltaY*.01)):Ye(this.viewport,-e.deltaX,-e.deltaY))}#h(e){const n=this.#e()?.getBoundingClientRect();this.#d(le(this.viewport,(n?.width??0)/2,(n?.height??0)/2,e))}#w(e){this.#h(e===1?1.2:1/1.2)}#$(){const e=this.#e()?.getBoundingClientRect(),n=this.#m();e===void 0||n===void 0||this.#d(He(n,{width:e.width,height:e.height},48))}#m(){const e=this.renderRoot.querySelector(".wall");return e===null?void 0:{width:e.offsetWidth,height:e.offsetHeight}}#d(e){const n=this.#e()?.getBoundingClientRect(),o=this.#m(),i=n===void 0||o===void 0||o.width===0||n.width===0?e:Fe(e,o,{width:n.width,height:n.height},mn),s=this.viewport;i.panX===s.panX&&i.panY===s.panY&&i.zoom===s.zoom||(this.viewport=i)}#T(e,n){const o=this.context();switch(n.kind){case"select":o.navigate({note:e});break;case"rename":o.dispatch(E.setElementName(e,n.name));break;case"comment":o.dispatch({type:"comment",target:`element:${e}`,payload:{body:n.body}});break;case"delete":o.dispatch(E.deleteElement(e)),o.navigation.note===e&&o.navigate({note:null});break;case"add-hotspot":this.#N(o,e);break}this.mode=Ve(this.mode,e,n)}#a(e,n){return R(e).find(o=>o.id===n)}#o(e){return e===void 0?[]:[...e.notes,...e.pins.map(n=>n.note)].map(n=>n.id)}#S(e,n,o){if(n===o)return;const i=R(e.state),s=i.find(h=>h.id===n),r=i.find(h=>h.id===o),a=s&&r?Ne(s,r):void 0;if(s===void 0||r===void 0||a===void 0||e.state.links.some(h=>h.from===a.from&&h.to===a.to))return;const d=e.state.links.map(h=>h.id),l=e.state.elements.map(h=>h.id),p=W(s)?.id,m=p!==void 0&&i.indexOf(r)>i.indexOf(s)?Ge(l,this.#o(r),[p],"after"):[];e.dispatchBatch([E.linkElements(z(`link-${a.from}`,d),a.from,a.to,{kind:"flow"}),...m.map(h=>E.moveElement(h.id,h.after))])}#I(e){const n=this.#e(),o=this.#r().find(s=>s.id===e)?.rect;if(n===null||o===void 0)return;const i=n.getBoundingClientRect();return{x:i.left+o.left+o.width,y:i.top+o.top+o.height/2}}#L(e){const n=this.#I(e);n!==void 0&&(this.mode={kind:"append",sliceId:e,point:n})}#M(e,n,o){const i=this.#a(e.state,n),s=i?W(i):void 0;if(s===void 0){this.mode=C;return}const r=z(`new-${o}`,K(e.state)),a=e.state.links.map(l=>l.id);if(!e.dispatchBatch([E.addElement(r,o,O(this.locale).noteTypeLabel(o)),E.linkElements(z(`link-${s.id}`,a),s.id,r,{kind:"flow"})]).ok){this.mode=C;return}e.navigate({note:r}),this.mode={kind:"editing",noteId:r}}#N(e,n){const o=z("new-hotspot",K(e.state)),i=e.state.links.map(r=>r.id);e.dispatchBatch([E.addElement(o,"hotspot",O(this.locale).noteTypeLabel("hotspot")),E.linkElements(z(`link-${o}`,i),o,n,{kind:"member"})]).ok&&(e.navigate({note:o}),this.mode={kind:"editing",noteId:o})}#_(e,n,o){const i=this.#a(e.state,n),s=i===void 0?void 0:Ie(i,o);if(s===void 0)return;const r=z(`new-${o}`,K(e.state)),[a,d]=s.incoming?[r,s.anchorId]:[s.anchorId,r],l=e.state.links.map(m=>m.id);e.dispatchBatch([E.addElement(r,o,O(this.locale).noteTypeLabel(o)),E.linkElements(z(`link-${a}`,l),a,d,{kind:"member"})]).ok&&(e.navigate({note:r}),this.mode={kind:"editing",noteId:r})}#C(e,n,o,i){const s=e.state,r=pe(s.elements.map(a=>a.id),this.#o(this.#a(s,n)),this.#o(this.#a(s,o)),i);e.dispatchBatch(r.map(a=>E.moveElement(a.id,a.after)))}#O(e,n){this.mode.kind==="editing"&&(this.mode=C),this.selectedSliceIds=[],this.selectedLinkIds=n?this.selectedLinkIds.includes(e)?this.selectedLinkIds.filter(o=>o!==e):[...this.selectedLinkIds,e]:[e],this.#e()?.focus()}#u(e){if(this.selectedLinkIds.length>0){const i=e.state.links.filter(s=>this.selectedLinkIds.includes(s.id));e.dispatchBatch(i.map(s=>E.unlinkElements(s.from,s.to))),this.selectedLinkIds=[];return}if(this.selectedSliceIds.length===0)return;const n=R(e.state),o=this.selectedSliceIds.flatMap(i=>this.#o(n.find(s=>s.id===i)));e.dispatchBatch(o.map(i=>E.deleteElement(i))),this.selectedSliceIds=[]}#A(e,n){if(n.target!==n.currentTarget)return;if(n.key==="Escape"){this.selectedSliceIds=[],this.selectedLinkIds=[];return}if(n.key!=="Delete"&&n.key!=="Backspace"||this.mode.kind!=="idle"||this.naming!==void 0)return;if(n.preventDefault(),this.selectedLinkIds.length>0||this.selectedSliceIds.length>0){this.#u(e);return}const o=e.navigation.note;o===void 0||P(e.state,o)===void 0||(e.dispatch(E.deleteElement(o)),e.navigate({note:null}))}#f(e,n){const o=R(e.state),i=this.selectedSliceIds.flatMap(r=>this.#o(o.find(a=>a.id===r)));e.dispatchBatch(i.map(r=>E.setElementContext(r,n))).ok&&(this.selectedSliceIds=[])}#g(e,n){const i=this.renderRoot.querySelector("#context-name")?.value.trim()??"";if(i==="")return;if(n.kind==="rename-context"){e.dispatch(E.setContextName(n.contextId,i)).ok&&(this.naming=void 0);return}const s=z("context",e.state.contexts.map(l=>l.id)),r=R(e.state),a=n.sliceIds.flatMap(l=>this.#o(r.find(p=>p.id===l)));e.dispatchBatch([E.addContext(s,i),...a.map(l=>E.setElementContext(l,s))]).ok&&(this.selectedSliceIds=[],this.naming=void 0)}#z(e,n){const o=O(this.locale),i=n.kind==="rename-context"?Y(e.state,n.contextId)?.name??"":"";return k`<div id="context-pop" class="comment-pop context-pop" popover="manual">
|
|
985
|
+
<span class="dpk-label"> ${n.kind==="create-context"?o.newContextTitle:o.renameContextTitle} </span>
|
|
986
|
+
<input
|
|
987
|
+
id="context-name"
|
|
988
|
+
class="dpk-input"
|
|
989
|
+
type="text"
|
|
990
|
+
placeholder=${o.contextNamePlaceholder}
|
|
991
|
+
.value=${i}
|
|
992
|
+
@keydown=${s=>{s.key==="Enter"&&this.#g(e,n),s.key==="Escape"&&(this.naming=void 0)}}
|
|
993
|
+
/>
|
|
994
|
+
<div class="pop-actions">
|
|
995
|
+
<button class="dpk-btn" type="button" @click=${()=>this.naming=void 0}>${o.cancel}</button>
|
|
996
|
+
<button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>this.#g(e,n)}>
|
|
997
|
+
${n.kind==="create-context"?o.create:o.save}
|
|
998
|
+
</button>
|
|
999
|
+
</div>
|
|
1000
|
+
</div>`}#D(e,n){const o=O(this.locale),i=this.#a(e.state,n),s=i===void 0?void 0:W(i);return k`<div id="append-menu" class="comment-pop append-menu" popover="manual">
|
|
1001
|
+
<span class="dpk-label">${s===void 0?o.appendMenuNext:o.appendMenuAfter(s.name)}</span>
|
|
1002
|
+
<div class="type-options">
|
|
1003
|
+
${un.map(r=>k`<button
|
|
1004
|
+
class="type-chip"
|
|
1005
|
+
type="button"
|
|
1006
|
+
data-type=${r}
|
|
1007
|
+
style=${ae(r)}
|
|
1008
|
+
@click=${()=>this.#M(e,n,r)}
|
|
1009
|
+
>
|
|
1010
|
+
${o.noteTypeLabel(r)}
|
|
1011
|
+
</button>`)}
|
|
1012
|
+
</div>
|
|
1013
|
+
<div class="pop-actions">
|
|
1014
|
+
<button class="dpk-btn" type="button" @click=${()=>this.mode=C}>${o.cancel}</button>
|
|
1015
|
+
</div>
|
|
1016
|
+
</div>`}#P(e){const n=z("new-event",K(e.state));if(!e.dispatch(E.addElement(n,"event",O(this.locale).noteTypeLabel("event"))).ok){this.mode=C;return}e.navigate({note:n}),this.mode={kind:"editing",noteId:n}}}const xn=264,dt=()=>{Ft(),customElements.get("dpk-template-event-storming")||customElements.define("dpk-template-event-storming",at)},bn=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateEventStorming:at,ES_IDLE:C,NOTE_TYPES:V,ZOOM_MAX:Xe,ZOOM_MIN:de,allNoteIds:K,applyEventStormingAction:Te,attachAnchor:Ie,buildSlices:R,connectionEndpoints:Ne,constrainViewport:Fe,defineEventStormingElement:dt,describeEventStormingAction:Oe,dropSide:Ke,emptyEventStormingBase:$e,eventStormingAction:E,eventStormingActions:w,eventStormingBaseSchema:ye,eventStormingCommentTargets:De,eventStormingDefinitionFor:Be,eventStormingHasTarget:Re,eventStormingMessages:O,eventStormingTargetLabel:ze,eventStormingTitle:re,findContext:Y,findLink:ie,findNote:P,fitViewport:He,hitRect:ce,noteCardModeOf:Ue,panBy:Ye,parseEventStormingBase:we,planSliceBands:Me,rectsInBand:We,reduceNoteIntent:Ve,resolveEventStormingNavigation:Pe,sameSlice:Z,serializeEventStormingAction:Ae,sliceArrows:Le,sliceMovePlan:pe,sliceMoveSteps:Ge,sliceVoice:W,zoomAt:le},Symbol.toStringTag,{value:"Module"}));export{dt as d,bn as i};
|