dev-process-kit 0.2.0 → 0.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +178 -60
  2. package/dist/boards.js +1 -0
  3. package/dist/chunks/shared-B0QTGEwR.js +1844 -0
  4. package/dist/chunks/shared-BQqlFaPv.js +4928 -0
  5. package/dist/chunks/shared-BR7trWLo.js +3586 -0
  6. package/dist/chunks/shared-BpfuvyBP.js +1636 -0
  7. package/dist/chunks/shared-C1rWkW_W.js +705 -0
  8. package/dist/chunks/shared-C6hVLci2.js +574 -0
  9. package/dist/chunks/shared-CtoQ05tb.js +1 -0
  10. package/dist/chunks/{shared-DJruxrrR.js → shared-DW3QUBTw.js} +25 -56
  11. package/dist/chunks/shared-DXoggfKr.js +31 -0
  12. package/dist/chunks/shared-DbgUhOLb.js +686 -0
  13. package/dist/chunks/shared-Dj_D4ypT.js +2165 -0
  14. package/dist/chunks/shared-DuB4veji.js +904 -0
  15. package/dist/chunks/shared-TrlnHjrJ.js +1 -0
  16. package/dist/chunks/shared-bW1cft1H.js +2530 -0
  17. package/dist/chunks/shared-jVZVFFNq.js +602 -0
  18. package/dist/chunks/shared-xpAS9Ri4.js +6208 -0
  19. package/dist/chunks/shared-ztEUikTm.js +1 -0
  20. package/dist/components.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/views/delegation-poker.js +1 -0
  23. package/dist/views/plain.js +1 -0
  24. package/dist/views/prototype.js +1 -0
  25. package/dist/views/slides.js +1 -0
  26. package/dist/views/task-board.js +1 -0
  27. package/dist/views/usm.js +1 -0
  28. package/package.json +8 -10
  29. package/dist/chunks/shared-Ae8HmujL.js +0 -49
  30. package/dist/chunks/shared-B5lBiq5s.js +0 -1
  31. package/dist/chunks/shared-BCmqTEeQ.js +0 -1051
  32. package/dist/chunks/shared-BkM7jfZs.js +0 -1104
  33. package/dist/chunks/shared-Bo8OdTee.js +0 -4206
  34. package/dist/chunks/shared-C-7mxPbV.js +0 -301
  35. package/dist/chunks/shared-C-Os1zsf.js +0 -572
  36. package/dist/chunks/shared-C02b6b2m.js +0 -1
  37. package/dist/chunks/shared-DLdJfSN-.js +0 -1
  38. package/dist/chunks/shared-DYKbMmHn.js +0 -610
  39. package/dist/chunks/shared-DbBoZvUP.js +0 -1609
  40. package/dist/chunks/shared-DbnPOaXf.js +0 -4210
  41. package/dist/chunks/shared-DnJBtKmH.js +0 -3769
  42. package/dist/chunks/shared-v63w_5VP.js +0 -2774
  43. package/dist/templates/delegation-poker.js +0 -1
  44. package/dist/templates/event-storming.js +0 -1
  45. package/dist/templates/example-mapping.js +0 -1
  46. package/dist/templates/plain.js +0 -1
  47. package/dist/templates/prototype.js +0 -1
  48. package/dist/templates/slides.js +0 -1
  49. package/dist/templates/task-board.js +0 -1
  50. package/dist/templates/usm.js +0 -1
  51. package/dist/templates/whiteboard.js +0 -1
@@ -1,1051 +0,0 @@
1
- import{ae as xt,af as q,ag as oe,ah as ie,aH as _,ai as v,aG as X,aj as K,ak as M,al as N,p as I,au as L,w as se,aD as Ee,P as bt,e as vt,a0 as kt,V as W,R as $,a2 as ye,a9 as Et,j as yt,a1 as we,aa as $e,ab as wt,a3 as T,aK as $t,a4 as k,B as Tt,K as St,h as It,a8 as Te,aN as Lt,a7 as F,a5 as Se,aO as Mt,T as Ie,aP as Nt,aQ as _t,l as z}from"./shared-DnJBtKmH.js";import{c as Ct,r as Ot,p as At}from"./shared-Ae8HmujL.js";function zt(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}const j=["actor","command","aggregate","event","policy","readmodel","external","hotspot"],Dt=q({id:X,name:M(v(),N(1)),description:_(v())}),Pt=q({id:X,type:K(j),name:M(v(),N(1)),description:_(v()),contextId:_(v())}),Rt=q({id:X,from:M(v(),N(1)),to:M(v(),N(1)),label:_(v()),kind:_(K(["member","flow"]))}),Le=q({title:_(v()),contexts:oe(ie(Dt),[]),elements:oe(ie(Pt),[]),links:oe(ie(Rt),[])}),Me=t=>{const e=xt(Le,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},Ne=()=>({contexts:[],elements:[],links:[]}),D=(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)},re=(t,e)=>{if(e!==void 0)return t.links.find(n=>n.id===e)},G=t=>t.elements.map(e=>e.id),w={SET_ELEMENT_NAME:I("SET_ELEMENT_NAME","element",L({name:M(v(),N(1))})),SET_ELEMENT_DESCRIPTION:I("SET_ELEMENT_DESCRIPTION","element",L({description:v()})),SET_ELEMENT_TYPE:I("SET_ELEMENT_TYPE","element",L({type:K(j)})),SET_ELEMENT_CONTEXT:I("SET_ELEMENT_CONTEXT","element",L({contextId:Ee(v())})),MOVE_ELEMENT:I("MOVE_ELEMENT","element",L({after:Ee(v())}),{mode:"sequence"}),ADD_ELEMENT:I("ADD_ELEMENT","page",L({id:X,type:K(j),name:M(v(),N(1)),description:_(v()),contextId:_(v())}),{dedupeKey:se}),DELETE_ELEMENT:I("DELETE_ELEMENT","element",L({})),LINK_ELEMENTS:I("LINK_ELEMENTS","page",L({id:X,from:M(v(),N(1)),to:M(v(),N(1)),label:_(v()),kind:_(K(["member","flow"]))}),{dedupeKey:se}),SET_LINK_LABEL:I("SET_LINK_LABEL","link",L({label:v()})),UNLINK_ELEMENTS:I("UNLINK_ELEMENTS","page",L({from:M(v(),N(1)),to:M(v(),N(1))}),{mode:"sequence"}),ADD_CONTEXT:I("ADD_CONTEXT","page",L({id:X,name:M(v(),N(1)),description:_(v())}),{dedupeKey:se}),SET_CONTEXT_NAME:I("SET_CONTEXT_NAME","context",L({name:M(v(),N(1))})),DELETE_CONTEXT:I("DELETE_CONTEXT","context",L({}))},y={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:{}})},_e=(t,e)=>{const n=bt(w,e);if(n===null)return null;const o=n.target.id;switch(n.type){case"SET_ELEMENT_NAME":return Z(t,o,i=>({...i,name:n.payload.name}));case"SET_ELEMENT_DESCRIPTION":return Z(t,o,i=>({...i,description:n.payload.description}));case"SET_ELEMENT_TYPE":return Z(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:Z(t,o,s=>i===null?Ce(s):{...s,contextId:i})}case"MOVE_ELEMENT":{const{after:i}=n.payload,s=Bt(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?Ce(i):i)}:null;default:return vt(n)}},Ce=t=>{const e={...t};return delete e.contextId,e},Z=(t,e,n)=>t.elements.some(o=>o.id===e)?{...t,elements:t.elements.map(o=>o.id===e?n(o):o)}:null,Bt=(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},Xt=new Set(["actor>command","command>aggregate","aggregate>event","command>event","policy>command","external>event"]),J=(t,e)=>Xt.has(`${t}>${e}`),Yt=(t,e,n)=>t.kind!==void 0?t.kind==="member":J(e,n),Ht=["readmodel","actor","policy","command","aggregate","external","event","hotspot"],Kt=(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},Wt=(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||Yt(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}},B=t=>{const e=new Map(t.elements.map(l=>[l.id,l.type])),n=Kt(t,e),o=t.elements.filter(l=>!n.has(l.id)),{groups:i,rootOf:s}=Wt(o,t.links,e),r=new Map;for(const[l,p]of n){const m=D(t,l),u=s.get(p);if(m===void 0||u===void 0)continue;const b=r.get(u);b?b.push({note:m,targetId:p}):r.set(u,[{note:m,targetId:p}])}const a=new Map(Ht.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((u,b)=>(a.get(u.type)??0)-(a.get(b.type)??0)||(d.get(u.id)??0)-(d.get(b.id)??0));return{id:p[0]?.id??"",notes:m,pins:r.get(l)??[],contextId:p.find(u=>u.contextId!==void 0)?.contextId}})},Ft=t=>{const e=B(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))]}},Oe=(t,e)=>{const n=[...t.notes,...t.pins.map(r=>r.note)],o=n.find(r=>J(e,r.type));if(o!==void 0)return{anchorId:o.id,incoming:!0};const i=n.find(r=>J(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}},Ae=(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}:{}}]})},ae=(t,e)=>`${t}\0${e}`,ze=(t,e,n)=>{const{widthOf:o,gapX:i,padX:s,maxWidth:r}=n,a=new Map;for(const c of e)a.set(ae(c.from,c.to),c),a.set(ae(c.to,c.from),c);const d=(c,g)=>c===void 0||g===void 0?void 0:a.get(ae(c,g)),l=c=>zt(c,g=>o(g))+i*Math.max(0,c.length-1)+s*2<=r,p=[];let m=[],u;const b=()=>{m.length!==0&&(p.push({sliceIds:m,...u===void 0?{}:{cutFrom:u}}),m=[],u=void 0)};for(const c of t.map(g=>g.id)){if(m.length>0&&!l([...m,c])){let g=m.length;for(;d(m[g-1],g===m.length?c:m[g])!==void 0&&(g-=1,g!==0););const f=g===0?[]:m.splice(g),x=g===0?d(m.at(-1),c):d(m.at(-1),f[0]);b(),m=f,u=x}m.push(c)}return b(),p},U=t=>[...t.notes].reverse().find(e=>e.type==="event")??t.notes.at(-1),De=(t,e)=>{const n=U(t),o=e.notes[0];if(!(n===void 0||o===void 0))return{from:n.id,to:o.id}},Pe={actor:"Actor",command:"Command",aggregate:"Aggregate",event:"Domain Event",policy:"Policy",readmodel:"Read Model",external:"External System",hotspot:"Hotspot"},Re={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=kt({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=>Pe[t],addTypeLabel:t=>`+ ${Pe[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=>Re[t],addTypeLabel:t=>`+ ${Re[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"}}),Gt={SET_ELEMENT_NAME:(t,e,n)=>({title:t.renameElementTitle,tone:"update",body:t.renamed(D(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 "${D(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}"`})},Be=(t,e,n,o)=>{const i=Gt[e.type],r=i?i(t,e,o??n):{title:e.type,tone:"meta"};return{title:r.title,targetLabel:Ye(t,n,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},Xe=t=>`${t.type} ${W(t.target)} ${JSON.stringify(t.payload)}`,Ye=(t,e,n)=>{switch(n.type){case"element":{const o=D(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=re(e,n.id);return o?t.linkLabel(o.from,o.to):`${t.linkGroup} \xB7 ${n.id} (missing)`}case"page":return t.pageLabel(de(e));default:return`${n.type} \xB7 ${n.id}`}},He=(t,e)=>[...e.elements.map(n=>({value:W({type:"element",id:n.id}),label:n.name,group:t.elementGroup})),...e.contexts.map(n=>({value:W({type:"context",id:n.id}),label:n.name,group:t.contextGroup}))],Ut=(t,e,n)=>{const o=e.elements.find(i=>i.id===n.note);return o?{value:W({type:"element",id:o.id}),label:o.name,group:t.elementGroup}:null},de=t=>t.title??"Event Storming",Ke=(t,e)=>{const n={...e},o=D(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},We=(t,e)=>{switch(e.type){case"element":return D(t,e.id)!==void 0;case"context":return Y(t,e.id)!==void 0;case"link":return re(t,e.id)!==void 0;case"page":return!0;default:return!1}},Fe=t=>{const e=O(t);return{name:"event-storming",label:"Event Storming",parseBase:Me,emptyBase:Ne,actions:w,apply:_e,canonicalState:Ft,hasTarget:We,describe:(n,o,i)=>Be(e,n,o,i),serialize:Xe,resolveNavigation:Ke,navigationFor:(n,o)=>o.type==="element"&&D(n,o.id)!==void 0?{note:o.id}:null,commentTargets:(n,o)=>He(e,n),currentTarget:(n,o)=>Ut(e,n,o),title:de}},Vt={width:300,height:260},qt={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"}},le=t=>{const{bg:e,ink:n}=qt[t];return`--es-note-bg:${e};--es-note-ink:${n}`},jt=ye`
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
- /* As many lines as the fixed-size card holds; the rest ends in an ellipsis. */
97
- --dpk-inline-edit-lines: 4;
98
- }
99
-
100
- :host([compact]) .note-name {
101
- flex: 0 1 auto;
102
- font-size: 11.5px;
103
- line-height: 1.3;
104
- }
105
-
106
- /* Comments already left: a passive corner flag, readable without hover. */
107
- .note-flag {
108
- position: absolute;
109
- top: -7px;
110
- right: -7px;
111
- min-width: 17px;
112
- height: 17px;
113
- padding: 0 4px;
114
- border: 1.5px solid var(--dpk-paper-raised);
115
- border-radius: 999px;
116
- background: linear-gradient(180deg, var(--dpk-accent-bright), var(--dpk-accent));
117
- color: var(--dpk-accent-ink);
118
- font-family: var(--dpk-mono);
119
- font-size: 9.5px;
120
- font-weight: 650;
121
- line-height: 17px;
122
- text-align: center;
123
- box-shadow: 0 1px 4px rgba(217, 73, 32, 0.35);
124
- }
125
-
126
- /* A side rail of round buttons that fades in on hover, like the hotspot chip:
127
- nothing crosses the card's face, and it stays clear of the pins above. */
128
- .note-tools {
129
- position: absolute;
130
- top: 9px;
131
- right: -11px;
132
- z-index: 8;
133
- display: flex;
134
- flex-direction: column;
135
- gap: 3px;
136
- opacity: 0;
137
- pointer-events: none;
138
- transition: opacity 140ms ease;
139
- }
140
-
141
- /* Labelled, not a glyph: the hotspot affordance names itself on the card's
142
- top-right corner. It stays above the pins, which hang above that corner. */
143
- .note-hotspot {
144
- position: absolute;
145
- top: -9px;
146
- right: -4px;
147
- z-index: 9;
148
- padding: 2px 7px;
149
- border: 1px solid color-mix(in srgb, var(--dpk-danger) 45%, transparent);
150
- border-radius: 999px;
151
- font-size: 9.5px;
152
- font-weight: 620;
153
- white-space: nowrap;
154
- color: var(--dpk-danger);
155
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
156
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
157
- cursor: pointer;
158
- opacity: 0;
159
- pointer-events: none;
160
- transition:
161
- opacity 140ms var(--dpk-ease),
162
- transform 140ms var(--dpk-ease-spring),
163
- background 140ms var(--dpk-ease),
164
- border-color 140ms var(--dpk-ease);
165
- }
166
-
167
- :host(:hover) .note-hotspot,
168
- :host([data-mode='editing']) .note-hotspot,
169
- .note-hotspot:focus-visible {
170
- opacity: 1;
171
- pointer-events: auto;
172
- }
173
-
174
- .note-hotspot:hover {
175
- border-color: var(--dpk-danger);
176
- background: var(--dpk-danger-soft);
177
- transform: translateY(-1px);
178
- }
179
-
180
- :host(:hover) .note-tools,
181
- :host([data-mode='commenting']) .note-tools,
182
- .note-tools:focus-within {
183
- opacity: 1;
184
- pointer-events: auto;
185
- }
186
-
187
- .note-tools .dpk-icon-btn {
188
- width: 22px;
189
- height: 22px;
190
- border: 1px solid var(--dpk-rule);
191
- border-radius: 50%;
192
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
193
- backdrop-filter: blur(4px);
194
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
195
- }
196
- `;class Zt extends Et{static{this.styles=[yt,jt,we]}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}}}#e="";#n=new $e(this);#o=new wt(this);constructor(){super(),this.note=null,this.notes=[],this.mode="view",this.focused=!1,this.compact=!1,this.onIntent=null,this.addEventListener("click",()=>this.#r({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.#e=""),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.#n.open(n,o,Vt)}render(){const e=this.note;if(!e)return T;const n=O(this.#o.locale),o=Ct(this.#o.locale);return k`
197
- <div class="note-type">${n.noteTypeLabel(e.type)}</div>
198
- <dpk-component-inline-edit
199
- class="note-name"
200
- ?wrap=${!0}
201
- ?truncate=${!this.compact}
202
- ?seamless=${!0}
203
- .value=${e.name}
204
- .label=${n.noteNameLabel}
205
- @dpk-commit=${$t(i=>this.#r({kind:"rename",name:i}))}
206
- ></dpk-component-inline-edit>
207
- ${this.notes.length>0?k`<span class="note-flag">${this.notes.length}</span>`:T}
208
- ${e.type==="hotspot"?T:k`<button
209
- class="note-hotspot"
210
- type="button"
211
- data-role="hotspot"
212
- title=${n.pinHotspotTitle}
213
- @click=${this.#s(()=>({kind:"add-hotspot"}))}
214
- >
215
- ${n.addHotspot}
216
- </button>`}
217
- <div class="note-tools">
218
- <button
219
- class="dpk-icon-btn"
220
- type="button"
221
- data-role="comment"
222
- aria-label=${o.comment}
223
- data-active=${String(this.mode==="commenting")}
224
- @click=${this.#s(()=>({kind:"toggle-comment"}))}
225
- >
226
- ${Tt()}
227
- </button>
228
- <button
229
- class="dpk-icon-btn"
230
- type="button"
231
- data-role="delete"
232
- aria-label=${n.deleteNote}
233
- @click=${this.#s(()=>({kind:"delete"}))}
234
- >
235
- ${St()}
236
- </button>
237
- </div>
238
- ${this.mode==="commenting"?this.#t(o):T}
239
- `}#t(e){return Ot(e,At(this.#e,this.notes.map(It),this.note?{key:`note:${this.note.id}`}:{}),n=>{n.kind==="input"?(this.#e=n.body,this.requestUpdate()):n.kind!=="choose"&&this.#r(n)})}#s(e){return n=>{n.stopPropagation(),this.#r(e(n))}}#r(e){this.onIntent?.(e)}}const Jt=()=>{customElements.get("dpk-internal-event-storming-note")||customElements.define("dpk-internal-event-storming-note",Zt)},ce=.25,Ge=2,pe=(t,e,n)=>({...t,panX:t.panX+e,panY:t.panY+n}),Ue=(t,e,n,o)=>t>=o&&t+e<=n-o?0:t<o||e>n-2*o?o-t:n-o-(t+e),Qt=(t,e,n,o)=>{const i=Ue(e.left,e.width,n.width,o),s=Ue(e.top,e.height,n.height,o);return i===0&&s===0?t:pe(t,i,s)},he=(t,e,n,o)=>{const i=Te(t.zoom*o,ce,Ge),s=(e-t.panX)/t.zoom,r=(n-t.panY)/t.zoom;return{panX:e-s*i,panY:n-r*i,zoom:i}},Ve=(t,e,n)=>{const o=Math.max(1,e.width-n*2),i=Math.max(1,e.height-n*2),s=Math.max(ce,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}},qe=(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)}},en=(t,e,n)=>e>=t.left&&e<=t.left+t.width&&n>=t.top&&n<=t.top+t.height,me=(t,e,n)=>{for(let o=t.length-1;o>=0;o-=1){const i=t[o];if(i!==void 0&&en(i.rect,e,n))return i.id}},je=(t,e)=>e<t.left+t.width/2?"before":"after",Ze=(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),ue=(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},Je=(t,e,n,o)=>{const i=ue(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 Lt(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=me(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:je(a,i.x)}}:{}}}case"select":return{...s,kind:"select"}}},fe="data-pin";class tn{#e;#n=new Set;#o;#t=new Map;constructor(e){this.#e=e,e.addController(this)}get heights(){return this.#t}hostConnected(){typeof ResizeObserver>"u"||(this.#o=new ResizeObserver(e=>this.#s(e)))}hostUpdated(){const e=this.#o;if(e===void 0)return;const n=new Set(this.#e.renderRoot.querySelectorAll(`[${fe}]`));for(const i of this.#n)n.has(i)||(e.unobserve(i),this.#n.delete(i));for(const i of n)this.#n.has(i)||(e.observe(i),this.#n.add(i));const o=new Set([...n].map(i=>i.getAttribute(fe)));[...this.#t.keys()].some(i=>!o.has(i))&&(this.#t=new Map([...this.#t].filter(([i])=>o.has(i))))}hostDisconnected(){this.#o?.disconnect(),this.#o=void 0,this.#n.clear()}#s(e){const n=new Map(this.#t);for(const o of e){const i=o.target.getAttribute(fe),s=o.borderBoxSize[0]?.blockSize;i===null||s===void 0||s===0||n.set(i,s)}[...n].every(([o,i])=>this.#t.get(o)===i)||(this.#t=n,this.#e.requestUpdate())}}const C={kind:"idle"},et=(t,e)=>t.kind==="editing"&&t.noteId===e?"editing":t.kind==="commenting"&&t.noteId===e?"commenting":"view",tt=(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}},nn=6,on=10,nt="\u2026",sn=[[4352,4447],[11904,42191],[44032,55203],[63744,64255],[65072,65103],[65280,65376],[65504,65510],[127744,129791],[131072,262141]],ge=t=>{const e=t.codePointAt(0)??0;return sn.some(([n,o])=>e>=n&&e<=o)?on:nn},rn=(t,e)=>{const n=Array.from(t);if(n.reduce((s,r)=>s+ge(r),0)<=e)return t;let o=ge(nt),i="";for(const s of n){if(o+=ge(s),o>e)break;i+=s}return`${i}${nt}`},ot=92,xe=54,an=18,it=4,st=t=>{const e=[];let n=an;for(const o of t)e.push(n),n+=o+it;return{lifts:e,extent:t.length===0?0:n-it}},rt=240,V=132,at=96,be=10,Q=24,ee=12,P=at+ee*2,te=46,ne=16,dt=44,lt=40,ve=16,ct=13,H=8,dn=6,ln=26,cn=(t,e)=>Math.max(dt,t-ee+(e?ln:0)),pn=st([xe]).extent,hn=["actor","command","aggregate","event","policy","readmodel","external"],pt=t=>Q*2+t*V+(t-1)*be,mn=(t,e)=>{const n=new Map;let o=0;for(const i of t.notes){const s=t.pins.filter(a=>a.targetId===i.id),r=st(s.map(a=>e(a.note.id)));s.forEach((a,d)=>n.set(a.note.id,r.lifts[d]??0)),o=Math.max(o,r.extent)}return{liftOf:n,extent:o}},un=(t,e,n,o)=>{const i=new Map(e.map(f=>[f.id,pt(f.notes.length)])),s=Ae(t,e),r=ze(e,s,{widthOf:f=>i.get(f)??0,gapX:te,padX:ne,maxWidth:Math.max(n,pt(1))}),a=new Map,d=new Map,l=new Map,p=new Map,m=new Map,u=new Map(e.map(f=>[f.id,f.contextId]));for(const f of e){const x=mn(f,E=>o.get(E)??xe);for(const[E,h]of x.liftOf)p.set(E,h);m.set(f.id,x.extent)}let b=H;const c=r.map((f,x)=>{const E=f.cutFrom===void 0?void 0:d.get(f.cutFrom.from),h=E===void 0?0:Math.max(0,E-ne);let S=h+ne;const A=cn(Math.max(pn,...f.sliceIds.map(R=>m.get(R)??0)),f.sliceIds.some(R=>u.get(R)!==void 0));for(const R of f.sliceIds)a.set(R,S-h),d.set(R,S),l.set(R,x),S+=(i.get(R)??0)+te;const ke=A+P+lt,gt={sliceIds:f.sliceIds,x:h,width:S-te+ne-h,height:ke,y:b,head:A,cutFrom:f.cutFrom};return b+=ke+dn,gt}),g=c.at(-1);return{slices:e,bands:c,xOf:a,absXOf:d,bandOf:l,widthOf:i,pinLiftOf:p,arrows:s,width:Math.max(0,...c.map(f=>f.x+f.width))+H*2,height:g===void 0?H*2:g.y+g.height+H}},fn=t=>{const{m:e,context:n,maxRowWidth:o,pinHeights:i,viewport:s,handlers:r}=t,{state:a}=n,d=24*s.zoom,l=`background-size:${d}px ${d}px;background-position:${s.panX}px ${s.panY}px`;if(a.elements.length===0)return k`<div class="board-viewport board-viewport--empty" style=${l}>
240
- <div class="empty">
241
- <h2>${e.emptyTitle}</h2>
242
- <p>${e.emptyBody}</p>
243
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>r.addFirst()}>
244
- ${e.addFirstEvent}
245
- </button>
246
- </div>
247
- </div>`;const p=B(a),m=un(a,p,o,i);return k`
248
- <div
249
- class="board-viewport${t.gesture!==void 0?" board-viewport--gesturing":""}"
250
- data-testid="es-viewport"
251
- tabindex="0"
252
- style=${l}
253
- @pointerdown=${r.viewportPointerDown}
254
- @pointermove=${r.viewportPointerMove}
255
- @pointerup=${r.viewportPointerUp}
256
- @pointercancel=${r.viewportPointerCancel}
257
- @pointerleave=${r.viewportPointerLeave}
258
- @wheel=${r.viewportWheel}
259
- @keydown=${r.keyDown}
260
- >
261
- <div
262
- class="board-content"
263
- style=${`transform:translate(${s.panX}px, ${s.panY}px) scale(${s.zoom})`}
264
- >
265
- <div class="wall" data-testid="es-wall" style=${`width:${m.width}px;height:${m.height}px`}>
266
- ${$n(t,m)}
267
- ${m.bands.map((u,b)=>xn(t,m,u,b))}
268
- </div>
269
- </div>
270
- ${vn(t.gesture)} ${kn(e,a,p)} ${En(t)}
271
- ${yn(t)}
272
- </div>
273
- `},gn=(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(" ")},xn=(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(g=>g.id===c)),u=c=>({x:e.xOf.get(c.id)??0,y:n.head,w:e.widthOf.get(c.id)??0}),b=(c,g,f=!1)=>k`<dpk-internal-event-storming-note
274
- style=${g}
275
- .note=${c}
276
- .notes=${s.comments.filter(x=>x.target.type==="element"&&x.target.id===c.id)}
277
- .mode=${et(r,c.id)}
278
- ?focused=${p.note===c.id}
279
- ?compact=${f}
280
- data-pin=${f?c.id:T}
281
- data-dpk-target=${`element:${c.id}`}
282
- .onIntent=${x=>l.noteIntent(c.id,x)}
283
- ></dpk-internal-event-storming-note>`;return k`
284
- <section class="band" data-band=${o} style=${`left:${H+n.x}px;top:${n.y}px`}>
285
- <div class="band-canvas" style=${`width:${n.width}px;height:${n.height}px`}>
286
- ${bn(t,e,o)}
287
- ${m.map(c=>{const{x:g,y:f,w:x}=u(c);return k`<div
288
- class=${gn(t,c)}
289
- data-slice-id=${c.id}
290
- style=${`left:${g}px;top:${f}px;width:${x}px;height:${P}px`}
291
- @pointerdown=${E=>l.slicePointerDown(c.id,E)}
292
- ></div>`})}
293
- ${Se(m.flatMap(c=>c.notes.map((g,f)=>({slice:c,note:g,slot:f}))),({note:c})=>c.id,({slice:c,note:g,slot:f})=>{const{x,y:E}=u(c),h=x+Q+f*(V+be);return b(g,`${le(g.type)};position:absolute;left:${h}px;top:${E+ee}px;width:${V}px;height:${at}px;--es-tilt:${In(g.id)}deg;z-index:2`)})}
294
- ${Se(m.flatMap(c=>{const g=u(c);return c.notes.flatMap((f,x)=>c.pins.filter(h=>h.targetId===f.id).map((h,S)=>({pin:h,slot:x,index:S,at:g})))}),({pin:c})=>c.note.id,({pin:c,slot:g,index:f,at:x})=>{const E=x.x+Q+g*(V+be),h=x.y+ee;return b(c.note,`${le(c.note.type)};position:absolute;left:${E+V-ot-6-f*10}px;bottom:${n.height-(h-(e.pinLiftOf.get(c.note.id)??0))}px;width:${ot}px;min-height:${xe}px;--es-tilt:-2.4deg;z-index:3`,!0)})}
295
- ${m.map(c=>{const{x:g,y:f,w:x}=u(c),E=d===c.id||a?.kind==="connect"&&a.fromSliceId===c.id;return k`<button
296
- class="slice-port${E?" slice-port--on":""}"
297
- type="button"
298
- style=${`left:${g+x-ct}px;top:${f+P/2-ct}px`}
299
- aria-label=${i.portAriaLabel}
300
- title=${i.portTitle}
301
- @pointerdown=${h=>l.portPointerDown(c.id,h)}
302
- >
303
- →
304
- </button>`})}
305
- ${m.map(c=>{if(d!==c.id||a!==void 0)return T;const{x:g,y:f}=u(c),x=new Set(c.notes.map(h=>h.type)),E=hn.filter(h=>!x.has(h));return k`<div
306
- class="slice-chips"
307
- style=${`left:${g}px;top:${f+P+6}px`}
308
- @pointerdown=${h=>h.stopPropagation()}
309
- >
310
- ${E.map(h=>k`<button class="slice-chip" type="button" @click=${()=>l.attachNote(c.id,h)}>
311
- ${i.addTypeLabel(h)}
312
- </button>`)}
313
- </div>`})}
314
- </div>
315
- </section>
316
- `},bn=(t,e,n)=>{const{m:o,context:i,handlers:s}=t,r=i.state.contexts.flatMap((a,d)=>{const p=e.slices.filter(h=>h.contextId===a.id).flatMap(h=>{const S=e.xOf.get(h.id),A=e.bandOf.get(h.id);return S===void 0||A===void 0?[]:[{x:S,band:A,width:e.widthOf.get(h.id)??0}]}),m=p.filter(h=>h.band===n);if(m.length===0)return[];const u=Math.min(...m.map(h=>h.x))-10,b=Math.max(...m.map(h=>h.x+h.width))+10,c=14,g=(e.bands[n]?.head??dt)+P+12,f=p.some(h=>h.band<n)?"\u2026 ":"",x=p.some(h=>h.band>n)?" \u2026":"",E=String(d%5);return[k`<div
317
- class="context-region"
318
- data-hue=${E}
319
- data-dpk-target=${`context:${a.id}`}
320
- style=${`left:${u}px;top:${c}px;width:${b-u}px;height:${g-c}px`}
321
- title=${a.description??a.name}
322
- ></div>
323
- <div
324
- class="context-label"
325
- data-hue=${E}
326
- style=${`left:${u+10}px;top:${c}px;max-width:${b-u-20}px`}
327
- @pointerdown=${h=>h.stopPropagation()}
328
- >
329
- <button
330
- class="context-label-name"
331
- type="button"
332
- title=${`${a.name}
333
- ${o.renameContextHint}`}
334
- @click=${h=>s.renameContext(a.id,{x:h.clientX,y:h.clientY})}
335
- >
336
- ${f}${a.name}${x}
337
- </button>
338
- <button
339
- class="context-label-x"
340
- type="button"
341
- aria-label=${o.dissolveContextAria(a.name)}
342
- title=${o.dissolveContextTitle}
343
- @click=${()=>s.dissolveContext(a.id)}
344
- >
345
- ✕
346
- </button>
347
- </div>`]});return r.length>0?k`${r}`:T},vn=t=>{if(t===void 0||!t.moved)return T;if(t.kind==="connect")return k`<svg class="gesture-layer" aria-hidden="true">
348
- ${F`<path class="connect-line" d=${`M ${t.start.x} ${t.start.y} L ${t.current.x} ${t.current.y}`}></path>
349
- <circle class="connect-tip" cx=${t.current.x} cy=${t.current.y} r="5"></circle>`}
350
- </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
351
- class="select-rect"
352
- style=${`left:${e}px;top:${n}px;width:${o}px;height:${i}px`}
353
- ></div>`}return T},kn=(t,e,n)=>k`<div class="board-hud">
354
- <span class="board-hud-stat">${t.noteCount(e.elements.length)}</span>
355
- <span class="board-hud-stat">${t.sliceCount(n.length)}</span>
356
- <span class="board-hud-stat">${t.contextCount(e.contexts.length)}</span>
357
- <span class="board-hint">${t.hudHint}</span>
358
- </div>`,En=t=>{const{m:e,viewport:n,handlers:o}=t;return k`<div class="board-zoom" @pointerdown=${i=>i.stopPropagation()}>
359
- <button type="button" aria-label=${e.zoomOut} @click=${()=>o.zoomStep(-1)}>−</button>
360
- <button type="button" class="board-zoom-pct" title=${e.zoomReset} @click=${()=>o.zoomReset()}>
361
- ${Math.round(n.zoom*100)}%
362
- </button>
363
- <button type="button" aria-label=${e.zoomIn} @click=${()=>o.zoomStep(1)}>+</button>
364
- <button type="button" aria-label=${e.zoomFit} title=${e.zoomFit} @click=${()=>o.zoomFit()}>⛶</button>
365
- </div>`},yn=t=>{const{m:e,context:n,selectedSliceIds:o,selectedLinkIds:i,handlers:s}=t;if(i.length===0&&o.length===0)return T;const r=n.state.contexts;return i.length>0?k`<div class="board-selection" @pointerdown=${a=>a.stopPropagation()}>
366
- <span class="board-selection-count">${e.selectedLinks(i.length)}</span>
367
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>s.deleteSelection()}>
368
- ${e.deleteLinks}
369
- </button>
370
- <span class="board-selection-hint">${e.deleteHint}</span>
371
- <button
372
- class="dpk-icon-btn"
373
- type="button"
374
- aria-label=${e.clearSelection}
375
- @click=${()=>s.clearSelection()}
376
- >
377
- ✕
378
- </button>
379
- </div>`:k`<div class="board-selection" @pointerdown=${a=>a.stopPropagation()}>
380
- <span class="board-selection-count">${e.selectedSlices(o.length)}</span>
381
- <button
382
- class="dpk-btn dpk-btn--accent"
383
- type="button"
384
- @click=${a=>s.groupSelection({x:a.clientX,y:a.clientY})}
385
- >
386
- ${e.groupIntoContext}
387
- </button>
388
- ${r.length>0?k`<select
389
- class="dpk-select"
390
- aria-label=${e.addToExistingAria}
391
- @change=${a=>{const d=Mt(a.target,HTMLSelectElement);d!==null&&(d.value!==""&&s.assignSelection(d.value),d.value="")}}
392
- >
393
- <option value="" selected>${e.addToExistingOption}</option>
394
- ${r.map(a=>k`<option value=${a.id}>${a.name}</option>`)}
395
- </select>`:T}
396
- <button class="dpk-btn" type="button" @click=${()=>s.stripSelectionContext()}>
397
- ${e.removeFromContext}
398
- </button>
399
- <button class="dpk-btn" type="button" @click=${()=>s.deleteSelection()}>${e.deleteButton}</button>
400
- <button class="dpk-icon-btn" type="button" aria-label=${e.clearSelection} @click=${()=>s.clearSelection()}>
401
- ✕
402
- </button>
403
- </div>`},ht=(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}}),wn=()=>F`<marker id="es-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
404
- <path d="M0,0 L8,4 L0,8 z"></path>
405
- </marker>`,$n=(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,m)=>{const u=t.selectedLinkIds.includes(a.id)?" is-selected":"",b={start:6,end:-6,middle:0}[p];o.push(F`<g data-link-id=${a.id} data-dpk-target=${`link:${a.id}`}>
406
- <path class="link-hit" d=${d} @pointerdown=${c=>c.stopPropagation()} @click=${c=>t.handlers.linkClick(a.id,c.shiftKey||c.metaKey||c.ctrlKey)}></path>
407
- <path class=${`link-path${u}`} d=${d} marker-end=${n}></path>
408
- ${a.label===void 0?T:F`<text class="link-label" x=${l.x+b} y=${l.y-6} text-anchor=${p}><title>${a.label}</title>${rn(a.label,Math.min(m,rt))}</text>`}
409
- </g>`)};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 f=l.x>=d.x+d.w,x=f?l.x-(d.x+d.w):d.x-(l.x+l.w);if(x<=te+2){const h=d.y+P/2,S=f?d.x+d.w:d.x,A=f?l.x:l.x+l.w;r(a,`M ${S} ${h} L ${A} ${h}`,{x:(S+A)/2,y:h},"middle",Math.abs(A-S)-4);continue}const E=Tn(d,l,s(d.band)-lt/2);r(a,E.d,E.mid,"middle",x+2*Q);continue}const p=d.y<l.y,m=d.x+ve,u=Te(m,l.x+ve,l.x+l.w-ve),b={x:m,y:p?d.y+P:d.y},c={x:u,y:p?l.y:l.y+P},g=p?(s(d.band)+(e.bands[l.band]?.y??0))/2:(s(l.band)+(e.bands[d.band]?.y??0))/2;r(a,Sn([b,{x:b.x,y:g},{x:c.x,y:g},c]),{x:c.x-6,y:g},"end",rt)}return F`<svg class="links-layer" width=${e.width} height=${e.height}>
410
- <defs>${wn()}</defs>
411
- ${o}
412
- </svg>`},Tn=(t,e,n)=>{const o=t.y+P;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 ht(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 ht(i,{x:i.x-48,y:n},{x:s.x+48,y:n},s)},Sn=(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),u=Math.hypot(r.x-s.x,r.y-s.y),b=Math.hypot(a.x-r.x,a.y-r.y),c=Math.max(0,Math.min(e,u/2,b/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}`},In=t=>{let e=0;for(const n of t)e=(e*31+n.charCodeAt(0))%997;return(e%17-8)*.09},Ln=ye`
413
- /* The board owns the whole main area; the viewport clips, never the shell. */
414
- .dpk-main {
415
- overflow: hidden;
416
- }
417
-
418
- .dpk-main-body {
419
- flex: 1 1 auto;
420
- min-height: 0;
421
- display: flex;
422
- flex-direction: column;
423
- padding: 0;
424
- gap: 0;
425
- }
426
-
427
- /* ------------------------------------------------------------- viewport */
428
-
429
- /* An infinite pannable surface; the dot grid scrolls with the content
430
- (background-position/-size are set inline from the viewport state). A
431
- quiet sunken tray reads as the working surface under the wall. */
432
- .board-viewport {
433
- position: relative;
434
- /* The board's own floating controls stack inside it, under the page's overlays (the review rail). */
435
- isolation: isolate;
436
- flex: 1 1 auto;
437
- min-height: 0;
438
- overflow: hidden;
439
- touch-action: none;
440
- background: var(--dpk-dots), var(--dpk-paper-sunken);
441
- }
442
-
443
- .board-viewport--gesturing,
444
- .board-viewport--gesturing * {
445
- user-select: none;
446
- }
447
-
448
- .board-viewport--empty {
449
- display: grid;
450
- place-items: center;
451
- padding: 24px;
452
- }
453
-
454
- .board-viewport:focus-visible {
455
- outline: none;
456
- box-shadow: inset var(--dpk-focus);
457
- }
458
-
459
- .board-content {
460
- position: absolute;
461
- left: 0;
462
- top: 0;
463
- width: max-content;
464
- transform-origin: 0 0;
465
- will-change: transform;
466
- }
467
-
468
- /* The wall is a fixed-size canvas: bands and the arrow layer are placed inside
469
- it at explicit coordinates, so an arrow may span several bands. */
470
- .wall {
471
- position: relative;
472
- }
473
-
474
- .band {
475
- position: absolute;
476
- display: flex;
477
- align-items: flex-start;
478
- }
479
-
480
- .band-canvas {
481
- position: relative;
482
- flex: 0 0 auto;
483
- }
484
-
485
- /* ---------------------------------------------------------------- slices */
486
-
487
- /* One causal slice: its notes framed together, read left to right.
488
- The frame is also the drag handle for moving the whole slice. */
489
- .slice {
490
- position: absolute;
491
- z-index: 1;
492
- border: 1px solid var(--dpk-rule-strong);
493
- border-radius: var(--dpk-radius-lg);
494
- background: color-mix(in srgb, var(--dpk-paper-raised) 82%, transparent);
495
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
496
- cursor: grab;
497
- transition:
498
- border-color 160ms var(--dpk-ease),
499
- background 160ms var(--dpk-ease),
500
- box-shadow 160ms var(--dpk-ease);
501
- }
502
-
503
- .slice:hover {
504
- border-color: var(--dpk-rule-hover);
505
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
506
- }
507
-
508
- .slice--selected {
509
- border-color: var(--dpk-blue);
510
- background: color-mix(in srgb, var(--dpk-blue-soft) 60%, var(--dpk-paper-raised));
511
- box-shadow:
512
- var(--dpk-bevel),
513
- 0 0 0 2px var(--dpk-blue-soft),
514
- var(--dpk-shadow-sm);
515
- }
516
-
517
- /* While a connection drag is out: everywhere it may land lights up dashed… */
518
- .slice--candidate {
519
- border: 1.5px dashed color-mix(in srgb, var(--dpk-blue) 55%, transparent);
520
- }
521
-
522
- /* …and the slice under the cursor confirms the landing. */
523
- .slice--target {
524
- border: 1.5px solid var(--dpk-blue);
525
- background: color-mix(in srgb, var(--dpk-blue-soft) 55%, transparent);
526
- box-shadow:
527
- 0 0 0 3px var(--dpk-blue-soft),
528
- var(--dpk-shadow-sm);
529
- }
530
-
531
- /* The slice being carried by a move drag. */
532
- .slice--lifted {
533
- opacity: 0.45;
534
- border-style: dashed;
535
- cursor: grabbing;
536
- }
537
-
538
- /* Insertion bar on the side of the drop target the slice will land on. */
539
- .slice--insert-before::before,
540
- .slice--insert-after::after {
541
- content: '';
542
- position: absolute;
543
- top: -6px;
544
- bottom: -6px;
545
- width: 3px;
546
- border-radius: 2px;
547
- background: var(--dpk-blue);
548
- }
549
-
550
- .slice--insert-before::before {
551
- left: -10px;
552
- }
553
-
554
- .slice--insert-after::after {
555
- right: -10px;
556
- }
557
-
558
- /* Connection port on a slice's right edge: click continues, drag connects.
559
- Shown only for the hovered slice (hover is hit-tested by the element,
560
- with padding, so it stays up while the cursor crosses over to it). */
561
- .slice-port {
562
- position: absolute;
563
- z-index: 5;
564
- width: 26px;
565
- height: 26px;
566
- border: 1px solid var(--dpk-rule-strong);
567
- border-radius: 50%;
568
- background: var(--dpk-paper-raised);
569
- color: var(--dpk-ink-soft);
570
- font-size: 13px;
571
- line-height: 1;
572
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
573
- cursor: crosshair;
574
- opacity: 0;
575
- pointer-events: none;
576
- transition:
577
- opacity 120ms var(--dpk-ease),
578
- border-color 120ms var(--dpk-ease),
579
- color 120ms var(--dpk-ease),
580
- background 120ms var(--dpk-ease),
581
- transform 160ms var(--dpk-ease-spring);
582
- }
583
-
584
- .slice-port--on,
585
- .slice-port:focus-visible {
586
- opacity: 1;
587
- pointer-events: auto;
588
- }
589
-
590
- .slice-port:hover {
591
- border-color: var(--dpk-blue);
592
- background: var(--dpk-blue-soft);
593
- color: var(--dpk-blue);
594
- transform: scale(1.08);
595
- }
596
-
597
- /* Add-note chips under the hovered slice: the roles it is still missing. */
598
- .slice-chips {
599
- position: absolute;
600
- z-index: 6;
601
- display: flex;
602
- gap: 4px;
603
- padding: 2px 0;
604
- }
605
-
606
- .slice-chip {
607
- border: 1px dashed var(--dpk-rule-strong);
608
- border-radius: 999px;
609
- padding: 3px 9px;
610
- font-size: 10.5px;
611
- font-weight: 620;
612
- white-space: nowrap;
613
- color: var(--dpk-ink-soft);
614
- background: color-mix(in srgb, var(--dpk-paper-raised) 90%, transparent);
615
- box-shadow: var(--dpk-shadow-xs);
616
- cursor: pointer;
617
- transition:
618
- border-color 120ms var(--dpk-ease),
619
- color 120ms var(--dpk-ease),
620
- background 120ms var(--dpk-ease),
621
- transform 140ms var(--dpk-ease-spring);
622
- }
623
-
624
- .slice-chip:hover {
625
- border-color: var(--dpk-blue);
626
- border-style: solid;
627
- color: var(--dpk-blue);
628
- background: var(--dpk-blue-soft);
629
- transform: translateY(-1px);
630
- }
631
-
632
- /* ------------------------------------------------------ bounded contexts */
633
-
634
- .context-region[data-hue='0'],
635
- .context-label[data-hue='0'] {
636
- --ctx-rgb: 51, 102, 204;
637
- }
638
- .context-region[data-hue='1'],
639
- .context-label[data-hue='1'] {
640
- --ctx-rgb: 13, 148, 136;
641
- }
642
- .context-region[data-hue='2'],
643
- .context-label[data-hue='2'] {
644
- --ctx-rgb: 174, 110, 6;
645
- }
646
- .context-region[data-hue='3'],
647
- .context-label[data-hue='3'] {
648
- --ctx-rgb: 124, 58, 237;
649
- }
650
- .context-region[data-hue='4'],
651
- .context-label[data-hue='4'] {
652
- --ctx-rgb: 190, 50, 100;
653
- }
654
-
655
- .context-region {
656
- position: absolute;
657
- z-index: 0;
658
- border: 1.5px dashed rgba(var(--ctx-rgb), 0.36);
659
- border-radius: var(--dpk-radius-lg);
660
- background: linear-gradient(180deg, rgba(var(--ctx-rgb), 0.07), rgba(var(--ctx-rgb), 0.025));
661
- box-shadow: inset 0 1px 0 rgba(var(--ctx-rgb), 0.14);
662
- pointer-events: none;
663
- }
664
-
665
- /* The label rides the region's top edge and carries the rename/dissolve UI. */
666
- .context-label {
667
- position: absolute;
668
- z-index: 7;
669
- transform: translateY(-55%);
670
- display: flex;
671
- align-items: center;
672
- gap: 4px;
673
- }
674
-
675
- /* No wider than its region (the element sets the label's max-width); a long name ends in an ellipsis. */
676
- .context-label-name {
677
- min-width: 0;
678
- overflow: hidden;
679
- text-overflow: ellipsis;
680
- border: none;
681
- border-radius: 999px;
682
- padding: 3px 10px;
683
- font-family: var(--dpk-mono);
684
- font-size: 9.5px;
685
- font-weight: 650;
686
- letter-spacing: 0.13em;
687
- text-transform: uppercase;
688
- white-space: nowrap;
689
- color: #fff;
690
- background: linear-gradient(180deg, rgba(var(--ctx-rgb), 0.98), rgba(var(--ctx-rgb), 0.84));
691
- cursor: pointer;
692
- box-shadow:
693
- inset 0 1px 0 rgba(255, 255, 255, 0.28),
694
- 0 1px 2px rgba(var(--ctx-rgb), 0.3),
695
- var(--dpk-shadow-xs);
696
- transition: transform 140ms var(--dpk-ease-spring);
697
- }
698
-
699
- .context-label-name:hover {
700
- background: linear-gradient(180deg, rgba(var(--ctx-rgb), 1), rgba(var(--ctx-rgb), 0.92));
701
- transform: translateY(-1px);
702
- }
703
-
704
- .context-label-x {
705
- flex: none;
706
- width: 18px;
707
- height: 18px;
708
- border: none;
709
- border-radius: 50%;
710
- font-size: 9px;
711
- line-height: 1;
712
- color: rgba(var(--ctx-rgb), 0.9);
713
- background: color-mix(in srgb, var(--dpk-paper-raised) 92%, transparent);
714
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
715
- cursor: pointer;
716
- opacity: 0;
717
- transition:
718
- opacity 120ms var(--dpk-ease),
719
- transform 140ms var(--dpk-ease-spring);
720
- }
721
-
722
- .context-label-x:hover {
723
- transform: scale(1.1);
724
- }
725
-
726
- .context-label:hover .context-label-x,
727
- .context-label-x:focus-visible {
728
- opacity: 1;
729
- }
730
-
731
- /* ---------------------------------------------------------------- arrows */
732
-
733
- .links-layer {
734
- position: absolute;
735
- inset: 0;
736
- /* Causality strokes are annotations drawn over the wall. */
737
- z-index: 4;
738
- pointer-events: none;
739
- overflow: visible;
740
- }
741
-
742
- /* Stroke must come from a stylesheet, not a presentation attribute:
743
- a var() inside stroke="..." is not substituted and the line stays invisible. */
744
- .link-path {
745
- fill: none;
746
- stroke: var(--dpk-ink-soft);
747
- stroke-width: 1.75;
748
- stroke-linecap: round;
749
- stroke-linejoin: round;
750
- opacity: 0.65;
751
- }
752
-
753
- /* Invisible fat stroke on top of the line: a mistaken connection is easy to
754
- pick, and picking it never starts a wall gesture. */
755
- .link-hit {
756
- fill: none;
757
- stroke: transparent;
758
- stroke-width: 14;
759
- stroke-linecap: round;
760
- pointer-events: stroke;
761
- cursor: pointer;
762
- }
763
-
764
- .link-path.is-selected {
765
- stroke: var(--dpk-blue);
766
- stroke-width: 2.6;
767
- opacity: 1;
768
- }
769
-
770
- .link-label {
771
- font-family: var(--dpk-mono);
772
- font-size: 9px;
773
- font-weight: 620;
774
- letter-spacing: 0.06em;
775
- fill: var(--dpk-ink-soft);
776
- paint-order: stroke;
777
- stroke: var(--dpk-paper-sunken);
778
- stroke-width: 4;
779
- stroke-linejoin: round;
780
- }
781
-
782
- .links-layer marker path {
783
- fill: var(--dpk-ink-soft);
784
- opacity: 0.8;
785
- }
786
-
787
- /* --------------------------------------------------------------- gesture */
788
-
789
- /* Overlays live in viewport space, above the transformed content. */
790
- .gesture-layer {
791
- position: absolute;
792
- inset: 0;
793
- z-index: 30;
794
- width: 100%;
795
- height: 100%;
796
- pointer-events: none;
797
- overflow: visible;
798
- }
799
-
800
- .connect-line {
801
- fill: none;
802
- stroke: var(--dpk-blue);
803
- stroke-width: 2;
804
- stroke-linecap: round;
805
- stroke-dasharray: 6 4;
806
- }
807
-
808
- .connect-tip {
809
- fill: var(--dpk-blue);
810
- }
811
-
812
- .select-rect {
813
- position: absolute;
814
- z-index: 30;
815
- border: 1px solid var(--dpk-blue);
816
- background: color-mix(in srgb, var(--dpk-blue-soft) 40%, transparent);
817
- pointer-events: none;
818
- }
819
-
820
- /* ------------------------------------------------------------ floating UI */
821
-
822
- /* Keeps clear of the zoom control on the right: the hint's ellipsis gives way first. */
823
- .board-hud {
824
- position: absolute;
825
- left: 12px;
826
- bottom: 12px;
827
- z-index: 40;
828
- max-width: calc(100% - 200px);
829
- overflow: hidden;
830
- white-space: nowrap;
831
- display: flex;
832
- gap: 10px;
833
- align-items: center;
834
- padding: 6px 8px 6px 14px;
835
- border: 1px solid var(--dpk-rule);
836
- border-radius: 999px;
837
- font-family: var(--dpk-mono);
838
- font-size: 10px;
839
- letter-spacing: 0.05em;
840
- color: var(--dpk-ink-faint);
841
- background: var(--dpk-glass);
842
- backdrop-filter: blur(12px);
843
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
844
- pointer-events: none;
845
- animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
846
- }
847
-
848
- .board-hud-stat {
849
- padding-right: 10px;
850
- border-right: 1px solid var(--dpk-rule);
851
- font-variant-numeric: tabular-nums;
852
- }
853
-
854
- .board-hud-stat:last-of-type {
855
- padding-right: 0;
856
- border-right: 0;
857
- }
858
-
859
- .board-hint {
860
- overflow: hidden;
861
- text-overflow: ellipsis;
862
- color: var(--dpk-ink-faint);
863
- opacity: 0.8;
864
- letter-spacing: 0.02em;
865
- }
866
-
867
- /* A phone has no room beside the zoom control for the stats; the counts are in the review. */
868
- @media (max-width: 760px) {
869
- .board-hud {
870
- display: none;
871
- }
872
- }
873
-
874
- @keyframes dpk-hud-in {
875
- from {
876
- opacity: 0;
877
- transform: translateY(6px);
878
- }
879
- }
880
-
881
- /* Above the shell's hand-off dock while it floats in the same corner. */
882
- .board-zoom {
883
- position: absolute;
884
- right: 12px;
885
- /* Above the page's hand-off dock while it floats over this corner. */
886
- bottom: calc(12px + var(--dpk-dock-clearance, 0px));
887
- z-index: 40;
888
- display: flex;
889
- align-items: center;
890
- border: 1px solid var(--dpk-rule);
891
- border-radius: var(--dpk-radius);
892
- background: var(--dpk-glass);
893
- backdrop-filter: blur(12px);
894
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
895
- overflow: hidden;
896
- animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
897
- }
898
-
899
- .board-zoom button {
900
- border: none;
901
- background: transparent;
902
- padding: 6px 10px;
903
- font-size: 12px;
904
- line-height: 1;
905
- color: var(--dpk-ink-soft);
906
- cursor: pointer;
907
- transition:
908
- background 140ms var(--dpk-ease),
909
- color 140ms var(--dpk-ease);
910
- }
911
-
912
- .board-zoom button:hover {
913
- background: var(--dpk-blue-soft);
914
- color: var(--dpk-blue);
915
- }
916
-
917
- .board-zoom .board-zoom-pct {
918
- min-width: 48px;
919
- font-family: var(--dpk-mono);
920
- font-size: 10.5px;
921
- }
922
-
923
- .board-selection {
924
- position: absolute;
925
- left: 50%;
926
- bottom: 14px;
927
- transform: translateX(-50%);
928
- z-index: 45;
929
- display: flex;
930
- gap: 8px;
931
- align-items: center;
932
- padding: 8px 12px;
933
- border: 1px solid var(--dpk-rule-strong);
934
- border-radius: var(--dpk-radius);
935
- background: var(--dpk-glass);
936
- backdrop-filter: blur(12px);
937
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
938
- animation: dpk-hud-in 200ms var(--dpk-ease-spring) backwards;
939
- }
940
-
941
- .board-selection-count {
942
- font-family: var(--dpk-mono);
943
- font-size: 10.5px;
944
- color: var(--dpk-ink-soft);
945
- white-space: nowrap;
946
- }
947
-
948
- .board-selection-hint {
949
- font-size: 10.5px;
950
- color: var(--dpk-ink-faint);
951
- white-space: nowrap;
952
- }
953
-
954
- /* ----------------------------------------------------------------- empty */
955
-
956
- .empty {
957
- border: 1.5px dashed var(--dpk-rule-strong);
958
- border-radius: var(--dpk-radius-xl);
959
- padding: 28px 24px;
960
- background: var(--dpk-paper-raised);
961
- max-width: 560px;
962
- display: grid;
963
- gap: 10px;
964
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
965
- justify-items: start;
966
- animation: dpk-hud-in 220ms var(--dpk-ease) backwards;
967
- }
968
-
969
- /* --------------------------------------------------------------- pickers */
970
-
971
- .context-pop {
972
- min-width: 220px;
973
- }
974
-
975
- /* -------------------------------------------------------- append picker */
976
-
977
- /* The palette travels in --es-note-bg/-ink, so a chip previews what it adds. */
978
- .append-menu {
979
- min-width: 220px;
980
- }
981
-
982
- .append-menu .type-options {
983
- display: grid;
984
- grid-template-columns: 1fr 1fr;
985
- gap: 4px;
986
- }
987
-
988
- .type-chip {
989
- border: 1px solid var(--dpk-rule-strong);
990
- border-radius: var(--dpk-radius-xs);
991
- padding: 6px 8px;
992
- font-size: 11px;
993
- font-weight: 620;
994
- text-align: left;
995
- background: var(--es-note-bg, var(--dpk-paper-raised));
996
- color: var(--es-note-ink, var(--dpk-ink));
997
- box-shadow: var(--dpk-shadow-xs);
998
- cursor: pointer;
999
- transition:
1000
- transform 140ms var(--dpk-ease-spring),
1001
- box-shadow 140ms var(--dpk-ease);
1002
- }
1003
-
1004
- .type-chip:hover {
1005
- transform: translateY(-1px);
1006
- box-shadow: var(--dpk-shadow-sm);
1007
- }
1008
-
1009
- .link-add .dpk-select {
1010
- flex: 1 1 auto;
1011
- min-width: 0;
1012
- }
1013
- `,Mn={width:260,height:150},Nn={width:236,height:210},_n=64,Cn=48,On=["event","command","aggregate","actor","policy","readmodel","external"],An=1200,mt=5,zn={x:20,top:46,bottom:40};class ut extends Ie{static{this.styles=[Ie.styles,Ln,we]}definitionFor(e){return Fe(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}}}#e;#n=new $e(this);#o=new tn(this);constructor(){super(),this.mode=C,this.boardWidth=An,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.#e?.disconnect(),this.#e=void 0}firstUpdated(){typeof ResizeObserver>"u"||(this.#e=new ResizeObserver(e=>{const n=e[0]?.contentRect.width;n!==void 0&&n>0&&(this.boardWidth=n)}),this.#e.observe(this))}updated(){super.updated(),this.#c(this.viewport),this.mode.kind==="append"&&this.#t("#append-menu",this.mode.point,Nn),this.naming!==void 0&&this.#t("#context-pop",this.naming.point,Mn,"#context-name")}#t(e,n,o,i){const s=this.renderRoot.querySelector(e);if(!s||s.matches(":popover-open")||(this.#n.open(s,Nt(n.x,n.y),o),i===void 0))return;const r=this.renderRoot.querySelector(i);r?.focus(),r instanceof HTMLInputElement&&r.select()}#s(){return Math.max(Dn,this.boardWidth-96)}renderRegions(e){return{main:this.#r(e)}}#r(e){const n=O(this.locale);return k`
1014
- ${fn({m:n,context:e,mode:this.mode,maxRowWidth:this.#s(),pinHeights:this.#o.heights,viewport:this.viewport,gesture:this.gesture,hoverSliceId:this.hoverSliceId,selectedSliceIds:this.selectedSliceIds,selectedLinkIds:this.selectedLinkIds,handlers:{noteIntent:(o,i)=>this.#S(o,i),addFirst:()=>this.#R(e),attachNote:(o,i)=>this.#C(e,o,i),viewportPointerDown:o=>this.#k(o),viewportPointerMove:o=>this.#E(o),viewportPointerUp:o=>this.#y(e,o),viewportPointerCancel:()=>this.gesture=void 0,viewportPointerLeave:()=>{this.gesture===void 0&&(this.hoverSliceId=void 0)},viewportWheel:o=>this.#w(o),portPointerDown:(o,i)=>this.#b(o,i),slicePointerDown:(o,i)=>this.#v(o,i),zoomStep:o=>this.#$(o),zoomFit:()=>this.#T(),zoomReset:()=>this.#m(1/this.viewport.zoom),groupSelection:o=>{this.selectedSliceIds.length>0&&(this.naming={kind:"create-context",sliceIds:this.selectedSliceIds,point:o})},assignSelection:o=>this.#g(e,o),stripSelectionContext:()=>this.#g(e,null),clearSelection:()=>{this.selectedSliceIds=[],this.selectedLinkIds=[]},linkClick:(o,i)=>this.#A(o,i),deleteSelection:()=>this.#f(e),keyDown:o=>this.#z(e,o),renameContext:(o,i)=>this.naming={kind:"rename-context",contextId:o,point:i},dissolveContext:o=>e.dispatch(y.deleteContext(o))}})}
1015
- ${this.mode.kind==="append"?this.#P(e,this.mode.sliceId):T}
1016
- ${this.naming!==void 0?this.#D(e,this.naming):T}
1017
- `}#i(){return this.renderRoot.querySelector(".board-viewport")}#a(e){const n=this.#i()?.getBoundingClientRect();return n===void 0?{x:e.clientX,y:e.clientY}:{x:e.clientX-n.left,y:e.clientY-n.top}}#l(e){const n=this.#i();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)}}})}#h(e,n){const o=this.#i();o!==null&&(o.setPointerCapture(e.pointerId),this.gesture=n)}#b(e,n){if(n.button!==0)return;n.stopPropagation(),n.preventDefault();const o=this.#a(n);this.#h(n,{kind:"connect",pointerId:n.pointerId,fromSliceId:e,start:o,current:o,moved:!1})}#v(e,n){if(n.button!==0)return;n.stopPropagation(),n.preventDefault();const o=this.#a(n);this.#h(n,{kind:"move-slice",pointerId:n.pointerId,sliceId:e,start:o,current:o,moved:!1})}#k(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.#a(e);(this.mode.kind==="editing"||this.mode.kind==="append")&&(this.mode=C),this.selectedLinkIds=[],this.#h(e,{kind:"select",pointerId:e.pointerId,start:n,current:n,moved:!1})}#E(e){const n=this.gesture,o=this.#a(e);if(n===void 0){const i=me(this.#l(zn),o.x,o.y);i!==this.hoverSliceId&&(this.hoverSliceId=i);return}this.gesture=Qe(n,{pointerId:e.pointerId,point:o},this.#l(),mt)}#y(e,n){const o=this.gesture;if(o===void 0||n.pointerId!==o.pointerId)return;const i=Qe(o,{pointerId:n.pointerId,point:this.#a(n)},this.#l(),mt);if(this.gesture=void 0,i.kind==="connect"){i.moved?i.targetSliceId!==void 0&&this.#I(e,i.fromSliceId,i.targetSliceId):this.#M(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.#O(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=[...Ze(this.#l(),s)]}#w(e){e.preventDefault();const n=this.#a(e);this.#c(e.ctrlKey||e.metaKey?he(this.viewport,n.x,n.y,Math.exp(-e.deltaY*.01)):pe(this.viewport,-e.deltaX,-e.deltaY))}#m(e){const n=this.#i()?.getBoundingClientRect();this.#c(he(this.viewport,(n?.width??0)/2,(n?.height??0)/2,e))}#$(e){this.#m(e===1?1.2:1/1.2)}showTarget(e){this.updateComplete.then(()=>{const n=this.#i(),o=_t(this,W(e));if(n===null||o===null)return;const i=n.getBoundingClientRect(),s=o.getBoundingClientRect();if(i.width===0||i.height===0)return;const r={left:s.left-i.left,top:s.top-i.top,width:s.width,height:s.height};this.#c(Qt(this.viewport,r,i,Cn))})}#T(){const e=this.#i()?.getBoundingClientRect(),n=this.#u();e===void 0||n===void 0||this.#c(Ve(n,{width:e.width,height:e.height},48))}#u(){const e=this.renderRoot.querySelector(".wall");return e===null?void 0:{width:e.offsetWidth,height:e.offsetHeight}}#c(e){const n=this.#i()?.getBoundingClientRect(),o=this.#u(),i=n===void 0||o===void 0||o.width===0||n.width===0?e:qe(e,o,{width:n.width,height:n.height},_n),s=this.viewport;i.panX===s.panX&&i.panY===s.panY&&i.zoom===s.zoom||(this.viewport=i)}#S(e,n){const o=this.context();switch(n.kind){case"select":o.navigate({note:e});break;case"rename":o.dispatch(y.setElementName(e,n.name));break;case"comment":o.dispatch({type:"comment",target:`element:${e}`,payload:{body:n.body}});break;case"delete":o.dispatch(y.deleteElement(e)),o.navigation.note===e&&o.navigate({note:null});break;case"add-hotspot":this.#_(o,e);break}this.mode=tt(this.mode,e,n)}#p(e,n){return B(e).find(o=>o.id===n)}#d(e){return e===void 0?[]:[...e.notes,...e.pins.map(n=>n.note)].map(n=>n.id)}#I(e,n,o){if(n===o)return;const i=B(e.state),s=i.find(u=>u.id===n),r=i.find(u=>u.id===o),a=s&&r?De(s,r):void 0;if(s===void 0||r===void 0||a===void 0||e.state.links.some(u=>u.from===a.from&&u.to===a.to))return;const d=e.state.links.map(u=>u.id),l=e.state.elements.map(u=>u.id),p=U(s)?.id,m=p!==void 0&&i.indexOf(r)>i.indexOf(s)?Je(l,this.#d(r),[p],"after"):[];e.dispatchBatch([y.linkElements(z(`link-${a.from}`,d),a.from,a.to,{kind:"flow"}),...m.map(u=>y.moveElement(u.id,u.after))])}#L(e){const n=this.#i(),o=this.#l().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}}#M(e){const n=this.#L(e);n!==void 0&&(this.mode={kind:"append",sliceId:e,point:n})}#N(e,n,o){const i=this.#p(e.state,n),s=i?U(i):void 0;if(s===void 0){this.mode=C;return}const r=z(`new-${o}`,G(e.state)),a=e.state.links.map(l=>l.id);if(!e.dispatchBatch([y.addElement(r,o,O(this.locale).noteTypeLabel(o)),y.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}}#_(e,n){const o=z("new-hotspot",G(e.state)),i=e.state.links.map(r=>r.id);e.dispatchBatch([y.addElement(o,"hotspot",O(this.locale).noteTypeLabel("hotspot")),y.linkElements(z(`link-${o}`,i),o,n,{kind:"member"})]).ok&&(e.navigate({note:o}),this.mode={kind:"editing",noteId:o})}#C(e,n,o){const i=this.#p(e.state,n),s=i===void 0?void 0:Oe(i,o);if(s===void 0)return;const r=z(`new-${o}`,G(e.state)),[a,d]=s.incoming?[r,s.anchorId]:[s.anchorId,r],l=e.state.links.map(m=>m.id);e.dispatchBatch([y.addElement(r,o,O(this.locale).noteTypeLabel(o)),y.linkElements(z(`link-${a}`,l),a,d,{kind:"member"})]).ok&&(e.navigate({note:r}),this.mode={kind:"editing",noteId:r})}#O(e,n,o,i){const s=e.state,r=ue(s.elements.map(a=>a.id),this.#d(this.#p(s,n)),this.#d(this.#p(s,o)),i);e.dispatchBatch(r.map(a=>y.moveElement(a.id,a.after)))}#A(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.#i()?.focus()}#f(e){if(this.selectedLinkIds.length>0){const i=e.state.links.filter(s=>this.selectedLinkIds.includes(s.id));e.dispatchBatch(i.map(s=>y.unlinkElements(s.from,s.to))),this.selectedLinkIds=[];return}if(this.selectedSliceIds.length===0)return;const n=B(e.state),o=this.selectedSliceIds.flatMap(i=>this.#d(n.find(s=>s.id===i)));e.dispatchBatch(o.map(i=>y.deleteElement(i))),this.selectedSliceIds=[]}#z(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.#f(e);return}const o=e.navigation.note;o===void 0||D(e.state,o)===void 0||(e.dispatch(y.deleteElement(o)),e.navigate({note:null}))}#g(e,n){const o=B(e.state),i=this.selectedSliceIds.flatMap(r=>this.#d(o.find(a=>a.id===r)));e.dispatchBatch(i.map(r=>y.setElementContext(r,n))).ok&&(this.selectedSliceIds=[])}#x(e,n){const i=this.renderRoot.querySelector("#context-name")?.value.trim()??"";if(i==="")return;if(n.kind==="rename-context"){e.dispatch(y.setContextName(n.contextId,i)).ok&&(this.naming=void 0);return}const s=z("context",e.state.contexts.map(l=>l.id)),r=B(e.state),a=n.sliceIds.flatMap(l=>this.#d(r.find(p=>p.id===l)));e.dispatchBatch([y.addContext(s,i),...a.map(l=>y.setElementContext(l,s))]).ok&&(this.selectedSliceIds=[],this.naming=void 0)}#D(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">
1018
- <span class="dpk-label"> ${n.kind==="create-context"?o.newContextTitle:o.renameContextTitle} </span>
1019
- <input
1020
- id="context-name"
1021
- class="dpk-input"
1022
- type="text"
1023
- placeholder=${o.contextNamePlaceholder}
1024
- .value=${i}
1025
- @keydown=${s=>{s.key==="Enter"&&this.#x(e,n),s.key==="Escape"&&(this.naming=void 0)}}
1026
- />
1027
- <div class="pop-actions">
1028
- <button class="dpk-btn" type="button" data-dpk-text-discard @click=${()=>this.naming=void 0}>
1029
- ${o.cancel}
1030
- </button>
1031
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${()=>this.#x(e,n)}>
1032
- ${n.kind==="create-context"?o.create:o.save}
1033
- </button>
1034
- </div>
1035
- </div>`}#P(e,n){const o=O(this.locale),i=this.#p(e.state,n),s=i===void 0?void 0:U(i);return k`<div id="append-menu" class="comment-pop append-menu" popover="manual">
1036
- <span class="dpk-label">${s===void 0?o.appendMenuNext:o.appendMenuAfter(s.name)}</span>
1037
- <div class="type-options">
1038
- ${On.map(r=>k`<button
1039
- class="type-chip"
1040
- type="button"
1041
- data-type=${r}
1042
- style=${le(r)}
1043
- @click=${()=>this.#N(e,n,r)}
1044
- >
1045
- ${o.noteTypeLabel(r)}
1046
- </button>`)}
1047
- </div>
1048
- <div class="pop-actions">
1049
- <button class="dpk-btn" type="button" @click=${()=>this.mode=C}>${o.cancel}</button>
1050
- </div>
1051
- </div>`}#R(e){const n=z("new-event",G(e.state));if(!e.dispatch(y.addElement(n,"event",O(this.locale).noteTypeLabel("event"))).ok){this.mode=C;return}e.navigate({note:n}),this.mode={kind:"editing",noteId:n}}}const Dn=264,ft=()=>{Jt(),customElements.get("dpk-template-event-storming")||customElements.define("dpk-template-event-storming",ut)},Pn=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateEventStorming:ut,ES_IDLE:C,NOTE_TYPES:j,ZOOM_MAX:Ge,ZOOM_MIN:ce,allNoteIds:G,applyEventStormingAction:_e,attachAnchor:Oe,buildSlices:B,connectionEndpoints:De,constrainViewport:qe,defineEventStormingElement:ft,describeEventStormingAction:Be,dropSide:je,emptyEventStormingBase:Ne,eventStormingAction:y,eventStormingActions:w,eventStormingBaseSchema:Le,eventStormingCommentTargets:He,eventStormingDefinitionFor:Fe,eventStormingHasTarget:We,eventStormingMessages:O,eventStormingTargetLabel:Ye,eventStormingTitle:de,findContext:Y,findLink:re,findNote:D,fitViewport:Ve,hitRect:me,noteCardModeOf:et,panBy:pe,parseEventStormingBase:Me,planSliceBands:ze,rectsInBand:Ze,reduceNoteIntent:tt,resolveEventStormingNavigation:Ke,sameSlice:J,serializeEventStormingAction:Xe,sliceArrows:Ae,sliceMovePlan:ue,sliceMoveSteps:Je,sliceVoice:U,zoomAt:he},Symbol.toStringTag,{value:"Module"}));export{ft as d,Pn as i};