dev-process-kit 0.0.2 → 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.
Files changed (32) hide show
  1. package/README.md +10 -9
  2. package/dist/chunks/shared-B2K3LoOU.js +1016 -0
  3. package/dist/chunks/{shared-D6UXy-Qw.js → shared-BqW3KAJ4.js} +99 -46
  4. package/dist/chunks/{shared-DZlREPaN.js → shared-Byv6cc0r.js} +480 -238
  5. package/dist/chunks/{shared-D3EKtSkd.js → shared-CKG_SQh5.js} +1 -1
  6. package/dist/chunks/{shared-C4Y4jSXa.js → shared-CPAT0Cgk.js} +4 -2
  7. package/dist/chunks/shared-CwbzACTe.js +1874 -0
  8. package/dist/chunks/{shared-utv1engQ.js → shared-DBDgdVsd.js} +1 -1
  9. package/dist/chunks/shared-DMlMTd3c.js +1018 -0
  10. package/dist/chunks/shared-DaoPCw6-.js +556 -0
  11. package/dist/chunks/shared-DqB_TR20.js +1599 -0
  12. package/dist/chunks/shared-DsVxrO_3.js +609 -0
  13. package/dist/chunks/shared-iQIywbRc.js +676 -0
  14. package/dist/chunks/shared-xrCdgpNS.js +1 -0
  15. package/dist/components.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/templates/event-storming.js +1 -1
  18. package/dist/templates/example-mapping.js +1 -1
  19. package/dist/templates/grill.js +1 -1
  20. package/dist/templates/plain.js +1 -1
  21. package/dist/templates/prototype.js +1 -1
  22. package/dist/templates/slides.js +1 -1
  23. package/dist/templates/task-board.js +1 -0
  24. package/dist/templates/usm.js +1 -1
  25. package/package.json +3 -2
  26. package/dist/chunks/shared-BFAVBf4I.js +0 -1
  27. package/dist/chunks/shared-BXV4Dm_n.js +0 -522
  28. package/dist/chunks/shared-CQlssGTf.js +0 -692
  29. package/dist/chunks/shared-CcD4vDCE.js +0 -1461
  30. package/dist/chunks/shared-D2QreyJq.js +0 -926
  31. package/dist/chunks/shared-OdGbSUTa.js +0 -574
  32. package/dist/chunks/shared-TjJWiz7W.js +0 -546
@@ -1,522 +0,0 @@
1
- import{q as m,an as E,v as A,au as D,at as b,ad as s,af as x,ag as f,as as I,a9 as Ue,aa as w,ab as q,ac as N,P as Pe,f as Qe,_ as Ce,V as O,R as g,m as Xe,a0 as H,a5 as Ye,k as Be,$ as Ve,a6 as ze,a1 as $,av as Ke,a2 as h,A as Fe,K as je,i as Je,a3 as z,T as Z}from"./shared-CcD4vDCE.js";import{s as K,D as We}from"./shared-BFAVBf4I.js";import{P as He,r as Ze,p as Ge,c as et}from"./shared-C4Y4jSXa.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),f(1))})),SET_STORY_DESCRIPTION:m("SET_STORY_DESCRIPTION","story",E({description:s()})),REORDER_STORY:m("REORDER_STORY","story",E({after:I(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:D,name:x(s(),f(1)),description:b(s())}),{dedupeKey:A}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),f(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),f(1)),after:I(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:I(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:D,name:x(s(),f(1)),description:b(s())}),{dedupeKey:A}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),f(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),f(1)),after:I(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:I(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:D,name:x(s(),f(1)),description:b(s())}),{dedupeKey:A}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),f(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),f(1)),after:I(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:I(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:D,name:x(s(),f(1)),description:b(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},L={setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),addStory:(e,t)=>({type:"ADD_STORY",target:{type:"page",id:"example-mapping"},payload:{id:e,name:t}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),setRuleName:(e,t)=>({type:"SET_RULE_NAME",target:{type:"rule",id:e},payload:{name:t}}),setRuleDescription:(e,t)=>({type:"SET_RULE_DESCRIPTION",target:{type:"rule",id:e},payload:{description:t}}),moveRule:(e,t,r)=>({type:"MOVE_RULE",target:{type:"rule",id:e},payload:{storyId:t,after:r}}),reorderRule:(e,t)=>({type:"REORDER_RULE",target:{type:"rule",id:e},payload:{after:t}}),addRule:(e,t,r)=>({type:"ADD_RULE",target:{type:"story",id:e},payload:{id:t,name:r}}),deleteRule:e=>({type:"DELETE_RULE",target:{type:"rule",id:e},payload:{}}),setExampleName:(e,t)=>({type:"SET_EXAMPLE_NAME",target:{type:"example",id:e},payload:{name:t}}),setExampleDescription:(e,t)=>({type:"SET_EXAMPLE_DESCRIPTION",target:{type:"example",id:e},payload:{description:t}}),moveExample:(e,t,r)=>({type:"MOVE_EXAMPLE",target:{type:"example",id:e},payload:{ruleId:t,after:r}}),reorderExample:(e,t)=>({type:"REORDER_EXAMPLE",target:{type:"example",id:e},payload:{after:t}}),addExample:(e,t,r)=>({type:"ADD_EXAMPLE",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteExample:e=>({type:"DELETE_EXAMPLE",target:{type:"example",id:e},payload:{}}),setQuestionName:(e,t)=>({type:"SET_QUESTION_NAME",target:{type:"question",id:e},payload:{name:t}}),setQuestionDescription:(e,t)=>({type:"SET_QUESTION_DESCRIPTION",target:{type:"question",id:e},payload:{description:t}}),moveQuestion:(e,t,r)=>({type:"MOVE_QUESTION",target:{type:"question",id:e},payload:{ruleId:t,after:r}}),reorderQuestion:(e,t)=>({type:"REORDER_QUESTION",target:{type:"question",id:e},payload:{after:t}}),addQuestion:(e,t,r)=>({type:"ADD_QUESTION",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteQuestion:e=>({type:"DELETE_QUESTION",target:{type:"question",id:e},payload:{}})},tt=w({id:D,name:x(s(),f(1)),description:b(s())}),rt=w({id:D,storyId:x(s(),f(1)),name:x(s(),f(1)),description:b(s())}),G=w({id:D,ruleId:x(s(),f(1)),name:x(s(),f(1)),description:b(s())}),ee=w({title:b(s()),stories:q(N(tt),[]),rules:q(N(rt),[]),examples:q(N(G),[]),questions:q(N(G),[])}),te=e=>{const t=Ue(ee,e),r=new Set,n=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},a=new Set(t.stories.map(i=>i.id));for(const i of t.stories)n("stories",i.id);for(const i of t.rules)if(n("rules",i.id),!a.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(n("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(n("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},re=()=>({stories:[],rules:[],examples:[],questions:[]}),nt=e=>({...e,rules:K(e.rules,["storyId"]),examples:K(e.examples,["ruleId"]),questions:K(e.questions,["ruleId"])}),T=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},y=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},R=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},S=(e,t)=>{if(t!==void 0)return e.questions.find(r=>r.id===t)},U=(e,t)=>{if(t===void 0)return;const r=T(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const n=y(e,t);if(n)return{kind:"rule",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const a=R(e,t);if(a)return{kind:"example",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const o=S(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ne=(e,t)=>e.rules.filter(r=>r.storyId===t),ae=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),at=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const n=R(e,t)?.ruleId??S(e,t)?.ruleId;return n===void 0?void 0:y(e,n)?.storyId},ie=e=>[...e.stories.map(t=>t.id),...e.rules.map(t=>t.id),...e.examples.map(t=>t.id),...e.questions.map(t=>t.id)],de=(e,t)=>y(e,t)?.storyId,ot=(e,t)=>{const r=R(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const n=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,n,a=>({...a,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,n,a=>({...a,description:r.payload.description}));case"REORDER_STORY":{const a=Ee(e.stories,n,r.payload.after);return a===null?null:{...e,stories:a}}case"ADD_STORY":{const a=r.payload;return e.stories.some(o=>o.id===a.id)?e:P(e,a.id)?null:{...e,stories:[...e.stories,{id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===n))return null;const a=new Set(e.rules.filter(o=>o.storyId===n).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==n),rules:e.rules.filter(o=>o.storyId!==n),examples:e.examples.filter(o=>!a.has(o.ruleId)),questions:e.questions.filter(o=>!a.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,n,a=>({...a,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,n,a=>({...a,description:r.payload.description}));case"MOVE_RULE":{const a=r.payload,o=y(e,n);if(!o||!e.stories.some(d=>d.id===a.storyId))return null;const i=e.rules.filter(d=>d.storyId===a.storyId&&d.id!==n);return a.after!==null&&!i.some(d=>d.id===a.after)?null:{...e,rules:me(e.rules,{...o,storyId:a.storyId},a.after)}}case"REORDER_RULE":{const a=y(e,n);if(!a)return null;const o=e.rules.filter(i=>i.storyId===a.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,a,r.payload.after)}}case"ADD_RULE":{const a=r.payload,o=T(e,n);return o?e.rules.some(i=>i.id===a.id)?e:P(e,a.id)?null:{...e,rules:[...e.rules,{id:a.id,storyId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_RULE":return y(e,n)?{...e,rules:e.rules.filter(a=>a.id!==n),examples:e.examples.filter(a=>a.ruleId!==n),questions:e.questions.filter(a=>a.ruleId!==n)}:null;case"SET_EXAMPLE_NAME":return ue(e,n,a=>({...a,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,n,a=>({...a,description:r.payload.description}));case"MOVE_EXAMPLE":{const a=r.payload,o=R(e,n);if(!o||!y(e,a.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===a.ruleId&&d.id!==n);return a.after!==null&&!i.some(d=>d.id===a.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:a.ruleId},a.after)}}case"REORDER_EXAMPLE":{const a=R(e,n);if(!a)return null;const o=e.examples.filter(i=>i.ruleId===a.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,a,r.payload.after)}}case"ADD_EXAMPLE":{const a=r.payload,o=y(e,n);return o?e.examples.some(i=>i.id===a.id)?e:P(e,a.id)?null:{...e,examples:[...e.examples,{id:a.id,ruleId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_EXAMPLE":return R(e,n)?{...e,examples:e.examples.filter(a=>a.id!==n)}:null;case"SET_QUESTION_NAME":return ce(e,n,a=>({...a,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,n,a=>({...a,description:r.payload.description}));case"MOVE_QUESTION":{const a=r.payload,o=S(e,n);if(!o||!y(e,a.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===a.ruleId&&d.id!==n);return a.after!==null&&!i.some(d=>d.id===a.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:a.ruleId},a.after)}}case"REORDER_QUESTION":{const a=S(e,n);if(!a)return null;const o=e.questions.filter(i=>i.ruleId===a.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,a,r.payload.after)}}case"ADD_QUESTION":{const a=r.payload,o=y(e,n);return o?e.questions.some(i=>i.id===a.id)?e:P(e,a.id)?null:{...e,questions:[...e.questions,{id:a.id,ruleId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_QUESTION":return S(e,n)?{...e,questions:e.questions.filter(a=>a.id!==n)}:null;default:return Qe(r)}},P=(e,t)=>e.stories.some(r=>r.id===t)||e.rules.some(r=>r.id===t)||e.examples.some(r=>r.id===t)||e.questions.some(r=>r.id===t),le=(e,t,r)=>e.stories.some(n=>n.id===t)?{...e,stories:e.stories.map(n=>n.id===t?r(n):n)}:null,pe=(e,t,r)=>e.rules.some(n=>n.id===t)?{...e,rules:e.rules.map(n=>n.id===t?r(n):n)}:null,ue=(e,t,r)=>e.examples.some(n=>n.id===t)?{...e,examples:e.examples.map(n=>n.id===t?r(n):n)}:null,ce=(e,t,r)=>e.questions.some(n=>n.id===t)?{...e,questions:e.questions.map(n=>n.id===t?r(n):n)}:null,me=(e,t,r)=>{const n=e.filter(l=>l.id!==t.id),a=n.filter(l=>l.storyId===t.storyId),o=r===null?[t,...a]:F(a,t,r),i=n.findIndex(l=>l.storyId===t.storyId),d=new Set(a.map(l=>l.id)),c=n.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Q=(e,t,r)=>{const n=e.filter(l=>l.id!==t.id),a=n.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...a]:F(a,t,r),i=n.findIndex(l=>l.ruleId===t.ruleId),d=new Set(a.map(l=>l.id)),c=n.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Ee=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const n=e.find(o=>o.id===t);if(n===void 0)return null;const a=e.filter(o=>o.id!==t);return F(a,n,r)},F=(e,t,r)=>{const n=[...e],a=r===null?-1:n.findIndex(o=>o.id===r);return n.splice(a+1,0,t),n},it={story:"Story",rule:"Rule",example:"Example",question:"Question"},dt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},st={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},lt={empty:"\u30EB\u30FC\u30EB\u672A\u6574\u7406","open-questions":"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u3042\u308A","too-big":"\u5206\u5272\u3092\u691C\u8A0E",thin:"\u5177\u4F53\u4F8B\u306E\u7121\u3044\u30EB\u30FC\u30EB\u3042\u308A",ready:"\u5408\u610F\u3067\u304D\u305D\u3046"},C=Ce({en:{kindLabel:e=>it[e],readinessLabel:e=>st[e],map:"Map",cardKinds:"Card kinds",noStoriesTitle:"No stories yet",noStoriesBody:"Place one story (yellow), then line up the rules (blue) that accept it beneath it. For each rule, stack examples (green) in the top area and open questions (red) in the bottom area.",firstStory:"+ First story",addStoryButton:"+ Story",noExamples:"No examples yet",noQuestions:"No open questions",commentButton:"Comment",deleteButton:"Delete",nameField:e=>`${e} name`,newStory:"New story",newRule:"New rule",newExample:"New example",newQuestion:"New question",storyRenamedTitle:"Renamed the story",storyDescriptionUpdatedTitle:"Updated the story\u2019s description",storyReorderedTitle:"Reordered the story",storyAddedTitle:"Added a story",storyDeletedTitle:"Deleted the story",ruleRenamedTitle:"Renamed the rule",ruleDescriptionUpdatedTitle:"Updated the rule\u2019s description",ruleMovedTitle:"Moved the rule",ruleReorderedTitle:"Reordered the rule",ruleAddedTitle:"Added a rule",ruleDeletedTitle:"Deleted the rule",exampleRenamedTitle:"Renamed the example",exampleDescriptionUpdatedTitle:"Updated the example\u2019s description",exampleMovedTitle:"Moved the example",exampleReorderedTitle:"Reordered the example",exampleAddedTitle:"Added an example",exampleDeletedTitle:"Deleted the example",questionRenamedTitle:"Renamed the question",questionDescriptionUpdatedTitle:"Updated the question\u2019s description",questionMovedTitle:"Moved the question",questionReorderedTitle:"Reordered the question",questionAddedTitle:"Added a question",questionDeletedTitle:"Deleted the question",arrowTo:e=>`\u2192 \u201C${e}\u201D`,arrowFrom:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,toTop:"\u2192 To the top",afterPlacement:e=>`\u2192 After \u201C${e}\u201D`,wholeMap:"Whole map"},ja:{kindLabel:e=>dt[e],readinessLabel:e=>lt[e],map:"\u30DE\u30C3\u30D7",cardKinds:"\u30AB\u30FC\u30C9\u306E\u7A2E\u985E",noStoriesTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noStoriesBody:"\u30B9\u30C8\u30FC\u30EA\u30FC\uFF08\u9EC4\uFF09\u30921\u679A\u7F6E\u304D\u3001\u305D\u306E\u4E0B\u306B\u53D7\u3051\u5165\u308C\u6761\u4EF6\u3068\u306A\u308B\u30EB\u30FC\u30EB\uFF08\u9752\uFF09\u3092\u4E26\u3079\u307E\u3059\u3002\u30EB\u30FC\u30EB\u3054\u3068\u306B\u3001\u4E0A\u306E\u6B04\u3078\u5177\u4F53\u4F8B\uFF08\u7DD1\uFF09\u3092\u3001\u4E0B\u306E\u6B04\u3078\u7B54\u3048\u306E\u51FA\u306A\u3044\u8AD6\u70B9\u3092\u8CEA\u554F\uFF08\u8D64\uFF09\u3068\u3057\u3066\u7A4D\u307F\u307E\u3059\u3002",firstStory:"+ \u6700\u521D\u306E\u30B9\u30C8\u30FC\u30EA\u30FC",addStoryButton:"+ \u30B9\u30C8\u30FC\u30EA\u30FC",noExamples:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noQuestions:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",nameField:e=>`${e}\u540D`,newStory:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",newRule:"\u65B0\u3057\u3044\u30EB\u30FC\u30EB",newExample:"\u65B0\u3057\u3044\u5177\u4F53\u4F8B",newQuestion:"\u65B0\u3057\u3044\u8CEA\u554F",storyRenamedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",storyDescriptionUpdatedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",storyReorderedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",storyAddedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",storyDeletedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",ruleRenamedTitle:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",ruleDescriptionUpdatedTitle:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",ruleMovedTitle:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",ruleReorderedTitle:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",ruleAddedTitle:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",ruleDeletedTitle:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",exampleRenamedTitle:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",exampleDescriptionUpdatedTitle:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",exampleMovedTitle:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",exampleReorderedTitle:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",exampleAddedTitle:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",exampleDeletedTitle:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",questionRenamedTitle:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",questionDescriptionUpdatedTitle:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",questionMovedTitle:"\u8CEA\u554F\u3092\u79FB\u52D5",questionReorderedTitle:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",questionAddedTitle:"\u8CEA\u554F\u3092\u8FFD\u52A0",questionDeletedTitle:"\u8CEA\u554F\u3092\u524A\u9664",arrowTo:e=>`\u2192 \u300C${e}\u300D`,arrowFrom:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,toTop:"\u2192 \u5148\u982D\u3078",afterPlacement:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53"}}),X=(e,t,r)=>{const n=typeof r=="string"?r:"",a=typeof t=="string"?t:void 0;return a===void 0?e.arrowTo(n):e.arrowFrom(a,n)},pt={SET_STORY_NAME:(e,t,r)=>({title:e.storyRenamedTitle,tone:"update",body:X(e,T(r,t.target.id)?.name,g(u.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.storyDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),REORDER_STORY:(e,t)=>({title:e.storyReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.storyAddedTitle,tone:"create",body:e.added(String(g(u.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,r)=>({title:e.storyDeletedTitle,tone:"delete",body:e.deleted(T(r,t.target.id)?.name??t.target.id)}),SET_RULE_NAME:(e,t,r)=>({title:e.ruleRenamedTitle,tone:"update",body:X(e,y(r,t.target.id)?.name,g(u.SET_RULE_NAME,t).name??"")}),SET_RULE_DESCRIPTION:(e,t)=>({title:e.ruleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_RULE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_RULE:(e,t,r)=>({title:e.ruleMovedTitle,tone:"move",body:e.arrowTo(T(r,String(g(u.MOVE_RULE,t).storyId))?.name??String(g(u.MOVE_RULE,t).storyId??""))}),REORDER_RULE:(e,t)=>({title:e.ruleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_RULE,t).after)}),ADD_RULE:(e,t)=>({title:e.ruleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_RULE,t).name??""))}),DELETE_RULE:(e,t,r)=>({title:e.ruleDeletedTitle,tone:"delete",body:e.deleted(y(r,t.target.id)?.name??t.target.id)}),SET_EXAMPLE_NAME:(e,t,r)=>({title:e.exampleRenamedTitle,tone:"update",body:X(e,R(r,t.target.id)?.name,g(u.SET_EXAMPLE_NAME,t).name??"")}),SET_EXAMPLE_DESCRIPTION:(e,t)=>({title:e.exampleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_EXAMPLE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_EXAMPLE:(e,t,r)=>({title:e.exampleMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_EXAMPLE,t).ruleId))?.name??String(g(u.MOVE_EXAMPLE,t).ruleId??""))}),REORDER_EXAMPLE:(e,t)=>({title:e.exampleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_EXAMPLE,t).after)}),ADD_EXAMPLE:(e,t)=>({title:e.exampleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_EXAMPLE,t).name??""))}),DELETE_EXAMPLE:(e,t,r)=>({title:e.exampleDeletedTitle,tone:"delete",body:e.deleted(R(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,S(r,t.target.id)?.name,g(u.SET_QUESTION_NAME,t).name??"")}),SET_QUESTION_DESCRIPTION:(e,t)=>({title:e.questionDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_QUESTION_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_QUESTION:(e,t,r)=>({title:e.questionMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_QUESTION,t).ruleId))?.name??String(g(u.MOVE_QUESTION,t).ruleId??""))}),REORDER_QUESTION:(e,t)=>({title:e.questionReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_QUESTION,t).after)}),ADD_QUESTION:(e,t)=>({title:e.questionAddedTitle,tone:"create",body:e.added(String(g(u.ADD_QUESTION,t).name??""))}),DELETE_QUESTION:(e,t,r)=>({title:e.questionDeletedTitle,tone:"delete",body:e.deleted(S(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,n)=>{let a;try{const o=pt[t.type];a=o?o(e,t,n??r):{title:t.type,tone:"meta"}}catch{a={title:t.type,tone:"meta"}}return{title:a.title,targetLabel:xe(e,r,t.target),tone:a.tone,...a.body===void 0?{}:{summary:a.body}}},ye=e=>`${e.type} ${O(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const n=T(t,r.id);return n?`${e.kindLabel("story")} \xB7 ${n.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const n=y(t,r.id);return n?`${e.kindLabel("rule")} \xB7 ${n.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const n=R(t,r.id);return n?`${e.kindLabel("example")} \xB7 ${n.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const n=S(t,r.id);return n?`${e.kindLabel("question")} \xB7 ${n.name}`:`${e.kindLabel("question")} \xB7 ${r.id} (missing)`}case"page":return`${e.map} \xB7 ${j(t)}`;default:return`${r.type} \xB7 ${r.id}`}}catch{return`${r.type} \xB7 ${r.id}`}},fe=(e,t,r)=>{const n=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const a of t.stories)n.push({value:O({type:"story",id:a.id}),label:a.name,group:e.kindLabel("story")});for(const a of t.rules){const o=T(t,a.storyId);n.push({value:O({type:"rule",id:a.id}),label:o?`${o.name} \u203A ${a.name}`:a.name,group:e.kindLabel("rule")})}for(const a of t.examples){const o=y(t,a.ruleId);n.push({value:O({type:"example",id:a.id}),label:o?`${o.name} \u203A ${a.name}`:a.name,group:e.kindLabel("example")})}for(const a of t.questions){const o=y(t,a.ruleId);n.push({value:O({type:"question",id:a.id}),label:o?`${o.name} \u203A ${a.name}`:a.name,group:e.kindLabel("question")})}return n},he=(e,t,r)=>{const n=U(t,r.card);return n?{value:O({type:n.kind,id:n.id}),label:n.name,group:e.kindLabel(n.kind)}:null},ut=4,Te=(e,t,r)=>{const n=t.rules.filter(p=>p.storyId===r),a=new Set(n.map(p=>p.id)),o=t.examples.filter(p=>a.has(p.ruleId)),i=t.questions.filter(p=>a.has(p.ruleId)).length,d=n.some(p=>!o.some(l=>l.ruleId===p.id)),c=n.length===0?"empty":i>0?"open-questions":n.length>ut?"too-big":d?"thin":"ready";return{rules:n.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",Re=(e,t)=>{const r=U(e,t.card),n={...t};return r?n.card=r.id:delete n.card,n},Se=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return U(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},be=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:nt,hasTarget:Se,describe:(r,n,a)=>ge(t,r,n,a),serialize:ye,resolveNavigation:Re,commentTargets:(r,n)=>fe(t,r),currentTarget:(r,n)=>he(t,r,n),title:j}},B=(e,t,r)=>{const n=Xe(t,ie(e.state));return e.dispatch(r(n)).ok?(e.navigate({card:n}),n):null},ct=(e,t)=>B(e,"new-story",r=>L.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",n=>L.addRule(r,n,t.newRule)),Et=(e,t,r)=>B(e,"new-example",n=>L.addExample(r,n,t.newExample)),gt=(e,t,r)=>B(e,"new-question",n=>L.addQuestion(r,n,t.newQuestion)),yt={width:300,height:260},_e=["story","rule","example","question"],ve={story:{bg:"linear-gradient(178deg, #fff3a6, #fde77a)",ink:"#4a3a06"},rule:{bg:"linear-gradient(178deg, #a3d1f5, #7cb8ea)",ink:"#0e2c4b"},example:{bg:"linear-gradient(178deg, #c9eb95, #a8dc63)",ink:"#22380a"},question:{bg:"linear-gradient(178deg, #fbc6d9, #f4a0c0)",ink:"#4b1029"}},k=e=>{const{bg:t,ink:r}=ve[e];return`--em-card-bg:${t};--em-card-ink:${r}`},xt=H`
2
- :host {
3
- position: relative;
4
- display: flex;
5
- flex-direction: column;
6
- gap: 6px;
7
- box-sizing: border-box;
8
- min-height: 76px;
9
- padding: 17px 11px 11px;
10
- border-radius: 3px;
11
- background: var(--em-card-bg, var(--dpk-paper-raised));
12
- color: var(--em-card-ink, var(--dpk-ink));
13
- box-shadow:
14
- 0 1px 2px rgba(30, 24, 10, 0.14),
15
- 0 5px 10px -4px rgba(30, 24, 10, 0.24);
16
- cursor: grab;
17
- transform: rotate(var(--em-tilt, 0deg));
18
- transition:
19
- transform 180ms ease,
20
- box-shadow 180ms ease,
21
- opacity 180ms ease;
22
- }
23
-
24
- :host(:hover) {
25
- z-index: 6;
26
- transform: rotate(0deg) translateY(-2px);
27
- box-shadow:
28
- 0 2px 4px rgba(30, 24, 10, 0.16),
29
- 0 12px 22px -6px rgba(30, 24, 10, 0.3);
30
- }
31
-
32
- :host([focused]) {
33
- z-index: 5;
34
- outline: 2px solid var(--dpk-blue);
35
- outline-offset: 2px;
36
- transform: rotate(0deg);
37
- }
38
-
39
- :host([data-mode='editing']),
40
- :host([data-mode='commenting']) {
41
- z-index: 7;
42
- transform: rotate(0deg);
43
- }
44
-
45
- :host([dragging]) {
46
- opacity: 0.4;
47
- }
48
-
49
- :host([data-kind='story']) {
50
- min-height: 68px;
51
- padding: 19px 14px 13px;
52
- }
53
-
54
- /* Small, faint, top-left: readable when looked for, quiet when not. */
55
- .card-kind {
56
- position: absolute;
57
- top: 5px;
58
- left: 8px;
59
- font-family: var(--dpk-mono);
60
- font-size: 8px;
61
- font-weight: 600;
62
- letter-spacing: 0.12em;
63
- opacity: 0.5;
64
- }
65
-
66
- .card-name {
67
- min-width: 0;
68
- font-size: 13px;
69
- font-weight: 680;
70
- line-height: 1.35;
71
- letter-spacing: -0.01em;
72
- overflow-wrap: anywhere;
73
- cursor: text;
74
- }
75
-
76
- :host([data-kind='story']) .card-name {
77
- font-size: 15.5px;
78
- line-height: 1.3;
79
- }
80
-
81
- .card-text {
82
- font-size: 11.5px;
83
- line-height: 1.5;
84
- opacity: 0.72;
85
- white-space: pre-wrap;
86
- }
87
-
88
- /* Comments already left: a corner flag, readable without hover. */
89
- .card-flag {
90
- position: absolute;
91
- top: -7px;
92
- right: -7px;
93
- min-width: 17px;
94
- height: 17px;
95
- padding: 0 4px;
96
- box-sizing: border-box;
97
- border-radius: 999px;
98
- background: var(--dpk-accent);
99
- color: var(--dpk-accent-ink);
100
- font-family: var(--dpk-mono);
101
- font-size: 9.5px;
102
- font-weight: 650;
103
- line-height: 17px;
104
- text-align: center;
105
- box-shadow: 0 1px 4px rgba(217, 73, 32, 0.35);
106
- }
107
-
108
- /* A side rail of round buttons that fades in on hover, like Event Storming:
109
- nothing crosses the card's face. */
110
- .card-tools {
111
- position: absolute;
112
- top: 9px;
113
- right: -11px;
114
- z-index: 8;
115
- display: flex;
116
- flex-direction: column;
117
- gap: 3px;
118
- opacity: 0;
119
- pointer-events: none;
120
- transition: opacity 140ms ease;
121
- }
122
-
123
- :host(:hover) .card-tools,
124
- :host([data-mode='commenting']) .card-tools,
125
- .card-tools:focus-within {
126
- opacity: 1;
127
- pointer-events: auto;
128
- }
129
-
130
- .card-tools .dpk-icon-btn {
131
- width: 22px;
132
- height: 22px;
133
- border: 1px solid var(--dpk-rule);
134
- border-radius: 50%;
135
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
136
- box-shadow: var(--dpk-shadow-xs);
137
- }
138
- `;class ft extends Ye{static{this.styles=[Be,xt,Ve]}static{this.properties={card:{attribute:!1},notes:{attribute:!1},tilt:{attribute:!1},mode:{type:String,reflect:!0,attribute:"data-mode"},focused:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},onIntent:{attribute:!1}}}#r="";#a=new He(this);#e=new ze(this);constructor(){super(),this.card=null,this.notes=[],this.tilt=0,this.mode="view",this.focused=!1,this.dragging=!1,this.onIntent=null,this.addEventListener("click",()=>this.#t({kind:"select"})),this.addEventListener("focusin",()=>this.draggable=!1),this.addEventListener("focusout",()=>this.draggable=!0)}updated(t){if(t.has("card")&&this.card){const{bg:a,ink:o}=ve[this.card.kind];this.setAttribute("data-kind",this.card.kind),this.style.setProperty("--em-card-bg",a),this.style.setProperty("--em-card-ink",o)}if(t.has("tilt")&&this.style.setProperty("--em-tilt",`${this.tilt}deg`),t.has("mode")&&(this.mode!=="commenting"&&(this.#r=""),this.mode==="editing"&&this.renderRoot.querySelector("dpk-component-inline-edit")?.startEditing()),this.mode!=="commenting")return;const r=this.renderRoot.querySelector(".comment-pop"),n=this.renderRoot.querySelector('[data-role="comment"]');r&&n&&this.#a.open(r,n,yt)}render(){const t=this.card;if(!t)return $;const r=C(this.#e.locale),n=r.kindLabel(t.kind);return h`
139
- <div class="card-kind">${n}</div>
140
- <dpk-component-inline-edit
141
- class="card-name"
142
- ?wrap=${!0}
143
- ?seamless=${!0}
144
- .value=${t.name}
145
- .label=${r.nameField(n)}
146
- @dpk-commit=${Ke(a=>this.#t({kind:"rename",name:a}))}
147
- ></dpk-component-inline-edit>
148
- ${t.description?h`<div class="card-text">${t.description}</div>`:$}
149
- ${this.notes.length>0?h`<span class="card-flag">${this.notes.length}</span>`:$}
150
- <div class="card-tools">
151
- <button
152
- class="dpk-icon-btn"
153
- type="button"
154
- data-role="comment"
155
- aria-label=${r.commentButton}
156
- data-active=${String(this.mode==="commenting")}
157
- @click=${this.#n({kind:"toggle-comment"})}
158
- >
159
- ${Fe()}
160
- </button>
161
- <button
162
- class="dpk-icon-btn"
163
- type="button"
164
- data-role="delete"
165
- aria-label=${r.deleteButton}
166
- @click=${this.#n({kind:"delete"})}
167
- >
168
- ${je()}
169
- </button>
170
- </div>
171
- ${this.mode==="commenting"?this.#o(t):$}
172
- `}#o(t){return Ze(et(this.#e.locale),Ge(this.#r,this.notes.map(Je),{label:t.name}),r=>{r.kind==="input"?(this.#r=r.body,this.requestUpdate()):this.#t(r)})}#n(t){return r=>{r.stopPropagation(),this.#t(t)}}#t(t){this.onIntent?.(t)}}const ht=()=>{customElements.get("dpk-internal-example-mapping-card")||customElements.define("dpk-internal-example-mapping-card",ft)},M=(e,t,r)=>{const n=e.at(-1)??null;if(t===null||r==="end")return n;const a=e.indexOf(t);return a<0?n:r==="after"?t:a===0?null:e.at(a-1)??null},De=(e,t,r,n)=>{if(!T(e,t))return null;const a=e.stories.filter(o=>o.id!==t).map(o=>o.id);return{type:"REORDER_STORY",target:{type:"story",id:t},payload:{after:M(a,r,n)}}},Ie=(e,t,r,n,a)=>{if(!T(e,t)||!y(e,r))return null;const o=e.rules.filter(i=>i.storyId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_RULE",target:{type:"rule",id:r},payload:{storyId:t,after:M(o,n,a)}}},Oe=(e,t,r,n,a)=>{if(!y(e,t)||!R(e,r))return null;const o=e.examples.filter(i=>i.ruleId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_EXAMPLE",target:{type:"example",id:r},payload:{ruleId:t,after:M(o,n,a)}}},ke=(e,t,r,n,a)=>{if(!y(e,t)||!S(e,r))return null;const o=e.questions.filter(i=>i.ruleId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_QUESTION",target:{type:"question",id:r},payload:{ruleId:t,after:M(o,n,a)}}},V={kind:"idle"},J=(e,t)=>e.kind!=="idle"&&e.cardId===t,$e=(e,t)=>J(e,t)&&(e.kind==="editing"||e.kind==="commenting")?e.kind:"view",Le=(e,t,r)=>{switch(r.kind){case"toggle-comment":return e.kind==="commenting"&&e.cardId===t?V:{kind:"commenting",cardId:t};case"rename":case"comment":case"dismiss":case"delete":return J(e,t)?V:e;case"select":return e}},Tt=(e,t)=>{if(e==="story")return 0;let r=0;for(const n of t)r=r*31+n.charCodeAt(0)|0;return(Math.abs(r)%5-2)*.45},Rt=e=>h`<ul class="legend" aria-label=${e.cardKinds}>
173
- ${_e.map(t=>h`<li><span class="legend-swatch" style=${k(t)}></span>${e.kindLabel(t)}</li>`)}
174
- </ul>`,St=e=>{const{context:t,handlers:r,m:n}=e;return t.state.stories.length===0?h`
175
- <div class="empty">
176
- <h2>${n.noStoriesTitle}</h2>
177
- <p>${n.noStoriesBody}</p>
178
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${r.addStory}>${n.firstStory}</button>
179
- </div>
180
- `:h`
181
- <div class="board" data-testid="example-mapping-board">
182
- ${z(t.state.stories,a=>a.id,a=>bt(e,a))}
183
- <button class="add-story" type="button" @click=${r.addStory}>${n.addStoryButton}</button>
184
- </div>
185
- `},W=(e,t,r)=>{const{context:n,mode:a,drag:o,handlers:i}=e,d=n.comments.filter(p=>p.target.type===t&&p.target.id===r.id),c=o.source({type:t,id:r.id});return h`<dpk-internal-example-mapping-card
186
- data-card=${r.id}
187
- data-card-kind=${t}
188
- draggable="true"
189
- .card=${{kind:t,id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}}}
190
- .notes=${d}
191
- .tilt=${Tt(t,r.id)}
192
- .mode=${$e(a,r.id)}
193
- .onIntent=${p=>i.cardIntent(r.id,t,p)}
194
- ?focused=${n.navigation.card===r.id}
195
- ?dragging=${o.isDragging(t,r.id)}
196
- @dragstart=${c.dragstart}
197
- @dragend=${c.dragend}
198
- ></dpk-internal-example-mapping-card>`},bt=(e,t)=>{const{context:r,drag:n,handlers:a,m:o}=e,i=Te(o,r.state,t.id),d=`story:${t.id}`,c=n.target({key:d,accepts:"story",hovered:we(".story-section","story"),onDrop:a.dropStory}),p=`rules:${t.id}`,l=n.target({key:p,accepts:"rule",hovered:we(".rule-col","rule"),onDrop:_=>a.dropRule(t.id,_)});return h`
199
- <section
200
- class="story-section"
201
- data-story=${t.id}
202
- data-drop=${String(n.isOver(d))}
203
- @dragenter=${c.dragenter}
204
- @dragover=${c.dragover}
205
- @dragleave=${c.dragleave}
206
- @drop=${c.drop}
207
- >
208
- <header class="story-row">
209
- <div class="story-slot">${W(e,"story",t)}</div>
210
- <div class="story-meta">
211
- <span class="readiness" data-readiness=${i.readiness}>${i.label}</span>
212
- <span class="tally"
213
- ><i class="tally-dot" style=${k("rule")}></i>${o.kindLabel("rule")} ${i.rules}</span
214
- >
215
- <span class="tally"
216
- ><i class="tally-dot" style=${k("example")}></i>${o.kindLabel("example")}
217
- ${i.examples}</span
218
- >
219
- <span class="tally"
220
- ><i class="tally-dot" style=${k("question")}></i>${o.kindLabel("question")}
221
- ${i.questions}</span
222
- >
223
- </div>
224
- </header>
225
- <div
226
- class="rules-row"
227
- data-testid=${`rules-${t.id}`}
228
- data-drop=${String(n.isOver(p))}
229
- @dragenter=${l.dragenter}
230
- @dragover=${l.dragover}
231
- @dragleave=${l.dragleave}
232
- @drop=${l.drop}
233
- >
234
- ${z(ne(r.state,t.id),_=>_.id,_=>_t(e,_))}
235
- <button class="add-rule" type="button" @click=${()=>a.addRule(t.id)}>
236
- <span class="add-plus">+</span>${o.kindLabel("rule")}
237
- </button>
238
- </div>
239
- </section>
240
- `},_t=(e,t)=>{const{drag:r}=e;return h`
241
- <div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
242
- ${W(e,"rule",t)} ${Me(e,t.id,"example")}
243
- ${Me(e,t.id,"question")}
244
- </div>
245
- `},vt={example:"examples",question:"questions"},Dt=(e,t)=>({testid:vt[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),Me=(e,t,r)=>{const{context:n,drag:a,handlers:o,m:i}=e,d=Dt(i,r),c=`${d.testid}:${t}`,p=r==="example"?a.target({key:c,accepts:"example",hovered:Ae("example"),onDrop:v=>o.dropExample(t,v)}):a.target({key:c,accepts:"question",hovered:Ae("question"),onDrop:v=>o.dropQuestion(t,v)}),l=r==="example"?ae(n.state,t):oe(n.state,t),_=r==="example"?o.addExample:o.addQuestion;return h`<div
246
- class="card-area card-area--${r}"
247
- data-testid=${`${d.testid}-${t}`}
248
- data-drop=${String(a.isOver(c))}
249
- @dragenter=${p.dragenter}
250
- @dragover=${p.dragover}
251
- @dragleave=${p.dragleave}
252
- @drop=${p.drop}
253
- >
254
- <h3 class="area-label"><i class="tally-dot" style=${k(r)}></i>${d.label}</h3>
255
- ${z(l,v=>v.id,v=>W(e,r,v))}
256
- ${l.length===0?h`<p class="stack-hint">${d.empty}</p>`:$}
257
- <button class="add-card add-${r}" type="button" @click=${()=>_(t)}>${d.add}</button>
258
- </div>`},Ae=e=>t=>{const r=t.target instanceof Element?t.target.closest("dpk-internal-example-mapping-card"):null;return!r||r.getAttribute("data-card-kind")!==e?null:{id:r.getAttribute("data-card"),element:r}},we=(e,t)=>r=>{const n=r.target instanceof Element?r.target.closest(e):null;return n?{id:n.getAttribute(`data-${t}`),element:n}:null},It=H`
259
- /* ------------------------------------------------------------ legend */
260
-
261
- .legend {
262
- display: flex;
263
- flex-wrap: wrap;
264
- gap: 4px 14px;
265
- margin: 0;
266
- padding: 0;
267
- list-style: none;
268
- font-size: 11.5px;
269
- color: var(--dpk-ink-soft);
270
- }
271
-
272
- .legend li {
273
- display: inline-flex;
274
- align-items: center;
275
- gap: 6px;
276
- }
277
-
278
- .legend-swatch {
279
- width: 14px;
280
- height: 11px;
281
- border-radius: 2px;
282
- background: var(--em-card-bg);
283
- box-shadow: 0 1px 2px rgba(30, 24, 10, 0.18);
284
- }
285
-
286
- /* ------------------------------------------------------------- board */
287
-
288
- .board {
289
- display: grid;
290
- gap: 22px;
291
- align-content: start;
292
- }
293
-
294
- .story-section {
295
- display: grid;
296
- gap: 18px;
297
- min-width: 0;
298
- padding: 20px 22px 24px;
299
- border: 1px solid var(--dpk-rule);
300
- border-radius: var(--dpk-radius-lg);
301
- background:
302
- radial-gradient(circle, var(--dpk-rule) 1px, transparent 1.2px) 0 0 / 18px 18px,
303
- var(--dpk-paper-raised);
304
- box-shadow: var(--dpk-shadow);
305
- transition: outline-color 150ms ease;
306
- }
307
-
308
- .story-section[data-drop='true'] {
309
- outline: 2px dashed var(--dpk-blue);
310
- outline-offset: 4px;
311
- }
312
-
313
- /* The story heads the table: one wide card, with where it stands beside it. */
314
- .story-row {
315
- display: flex;
316
- flex-wrap: wrap;
317
- align-items: center;
318
- gap: 14px 20px;
319
- }
320
-
321
- .story-slot {
322
- width: min(420px, 100%);
323
- }
324
-
325
- .story-meta {
326
- display: flex;
327
- flex-wrap: wrap;
328
- align-items: center;
329
- gap: 6px;
330
- }
331
-
332
- .readiness {
333
- padding: 4px 11px;
334
- border-radius: 999px;
335
- font-size: 11.5px;
336
- font-weight: 650;
337
- background: var(--dpk-paper-sunken);
338
- color: var(--dpk-ink-soft);
339
- }
340
-
341
- .readiness[data-readiness='ready'] {
342
- background: var(--dpk-green-soft);
343
- color: var(--dpk-green);
344
- }
345
-
346
- .readiness[data-readiness='open-questions'],
347
- .readiness[data-readiness='too-big'] {
348
- background: var(--dpk-danger-soft);
349
- color: var(--dpk-danger);
350
- }
351
-
352
- .readiness[data-readiness='thin'] {
353
- background: var(--dpk-amber-soft);
354
- color: var(--dpk-amber);
355
- }
356
-
357
- .tally {
358
- display: inline-flex;
359
- align-items: center;
360
- gap: 5px;
361
- padding: 3px 9px;
362
- border: 1px solid var(--dpk-rule);
363
- border-radius: 999px;
364
- background: var(--dpk-paper-raised);
365
- font-family: var(--dpk-mono);
366
- font-size: 10.5px;
367
- font-variant-numeric: tabular-nums;
368
- color: var(--dpk-ink-soft);
369
- }
370
-
371
- .tally-dot {
372
- width: 8px;
373
- height: 8px;
374
- border-radius: 2px;
375
- background: var(--em-card-bg);
376
- }
377
-
378
- /* ------------------------------------------------- rules and examples */
379
-
380
- /* Rules side by side under the story; the row scrolls, never the page. */
381
- .rules-row {
382
- display: flex;
383
- align-items: flex-start;
384
- gap: 14px;
385
- min-width: 0;
386
- overflow-x: auto;
387
- padding: 4px 4px 16px;
388
- border-radius: var(--dpk-radius);
389
- }
390
-
391
- .rules-row[data-drop='true'] {
392
- background: var(--dpk-blue-soft);
393
- }
394
-
395
- /* A rule and its examples read as one lane: a soft tint, no side border. */
396
- .rule-col {
397
- flex: 0 0 204px;
398
- display: grid;
399
- gap: 16px;
400
- align-content: start;
401
- padding: 10px 10px 14px;
402
- border-radius: var(--dpk-radius-lg);
403
- background: linear-gradient(180deg, rgba(51, 102, 204, 0.09), rgba(51, 102, 204, 0.03) 70%, transparent);
404
- }
405
-
406
- .rule-col[data-dragging] {
407
- opacity: 0.45;
408
- }
409
-
410
- /* Examples on top, questions below: two areas, each its own drop target. */
411
- .card-area {
412
- display: grid;
413
- gap: 12px;
414
- align-content: start;
415
- min-height: 44px;
416
- padding: 8px 8px 10px;
417
- border-radius: var(--dpk-radius);
418
- }
419
-
420
- .card-area--example {
421
- background: var(--dpk-green-soft);
422
- }
423
-
424
- .card-area--question {
425
- background: var(--dpk-danger-soft);
426
- }
427
-
428
- .card-area--question dpk-internal-example-mapping-card {
429
- min-height: 56px;
430
- }
431
-
432
- .card-area[data-drop='true'] {
433
- outline: 2px dashed var(--dpk-blue);
434
- outline-offset: 2px;
435
- }
436
-
437
- .area-label {
438
- display: flex;
439
- align-items: center;
440
- gap: 6px;
441
- margin: 0;
442
- font-size: 10.5px;
443
- font-weight: 600;
444
- letter-spacing: 0.04em;
445
- color: var(--dpk-ink-soft);
446
- }
447
-
448
- .stack-hint {
449
- margin: 0;
450
- font-size: 11px;
451
- color: var(--dpk-ink-faint);
452
- text-align: center;
453
- }
454
-
455
- /* -------------------------------------------------------- add buttons */
456
-
457
- .add-card,
458
- .add-rule,
459
- .add-story {
460
- border: 1px dashed var(--dpk-rule-strong);
461
- border-radius: var(--dpk-radius-sm);
462
- background: color-mix(in srgb, var(--dpk-paper-raised) 60%, transparent);
463
- color: var(--dpk-ink-faint);
464
- font: inherit;
465
- font-size: 11.5px;
466
- cursor: pointer;
467
- transition:
468
- background 140ms ease,
469
- border-color 140ms ease,
470
- color 140ms ease;
471
- }
472
-
473
- .add-card {
474
- padding: 6px 8px;
475
- }
476
-
477
- .add-rule {
478
- flex: 0 0 120px;
479
- display: grid;
480
- place-items: center;
481
- align-content: center;
482
- gap: 2px;
483
- min-height: 96px;
484
- }
485
-
486
- .add-plus {
487
- font-size: 18px;
488
- line-height: 1;
489
- }
490
-
491
- .add-story {
492
- justify-self: start;
493
- padding: 10px 18px;
494
- font-size: 12.5px;
495
- }
496
-
497
- .add-card:hover,
498
- .add-rule:hover,
499
- .add-story:hover {
500
- border-color: var(--dpk-blue);
501
- background: var(--dpk-blue-soft);
502
- color: var(--dpk-blue);
503
- }
504
-
505
- .empty {
506
- display: grid;
507
- gap: 10px;
508
- max-width: 620px;
509
- padding: 28px 24px;
510
- border: 1px dashed var(--dpk-rule-strong);
511
- border-radius: var(--dpk-radius-lg);
512
- background: var(--dpk-paper-raised);
513
- }
514
-
515
- .empty p {
516
- margin: 0;
517
- color: var(--dpk-ink-soft);
518
- line-height: 1.7;
519
- }
520
- `,Ot={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},kt={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class qe extends Z{static{this.styles=[Z.styles,It]}definitionFor(t){return be(t)}static{this.properties={mode:{state:!0}}}#r=new We(this);constructor(){super(),this.mode=V}renderRegions(t){const r=C(this.locale);return{header:Rt(r),main:this.#a(t,r)}}#a(t,r){return h`
521
- ${St({context:t,mode:this.mode,drag:this.#r,m:r,handlers:{cardIntent:(n,a,o)=>this.#o(n,a,o),addStory:()=>this.#e(ct(t,r)),addRule:n=>this.#e(mt(t,r,n)),addExample:n=>this.#e(Et(t,r,n)),addQuestion:n=>this.#e(gt(t,r,n)),dropStory:n=>this.#n(n),dropRule:(n,a)=>this.#t(n,a),dropExample:(n,a)=>this.#d(n,a),dropQuestion:(n,a)=>this.#s(n,a)}})}
522
- `}#e(t){t!==null&&(this.mode={kind:"editing",cardId:t})}#o(t,r,n){const a=this.context();switch(n.kind){case"select":a.navigate({card:t});break;case"rename":a.dispatch({type:Ot[r],target:{type:r,id:t},payload:{name:n.name}});break;case"comment":a.dispatch({type:"comment",target:`${r}:${t}`,payload:{body:n.body}});break;case"delete":a.dispatch({type:kt[r],target:{type:r,id:t},payload:{}}),a.navigation.card===t&&a.navigate({card:null});break}this.mode=Le(this.mode,t,n)}#n(t){const r=this.context(),n=De(r.state,t.item.id,t.hoveredId,t.place);n&&r.dispatch(n)}#t(t,r){const n=this.context(),a=this.#i(r.hoveredId,r.event.clientX,r.place),o=Ie(n.state,t,r.item.id,r.hoveredId,a);o&&n.dispatch(o)}#i(t,r,n){if(t===null)return n;const a=this.renderRoot.querySelector(`.rule-col[data-rule="${t}"]`);if(!a)return n;const o=a.getBoundingClientRect();return r<=o.left+o.width/2?"before":"after"}#d(t,r){const n=this.context(),a=Oe(n.state,t,r.item.id,r.hoveredId,r.place);a&&n.dispatch(a)}#s(t,r){const n=this.context(),a=ke(n.state,t,r.item.id,r.hoveredId,r.place);a&&n.dispatch(a)}}const Ne=()=>{ht(),customElements.get("dpk-template-example-mapping")||customElements.define("dpk-template-example-mapping",qe)},$t=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:_e,DpkTemplateExampleMapping:qe,IDLE_MODE:V,allMappingIds:ie,applyExampleMappingAction:se,cardModeOf:$e,cardPaletteStyle:k,defineExampleMappingElement:Ne,describeExampleMappingAction:ge,dropAfter:M,emptyExampleMappingBase:re,exampleMappingAction:L,exampleMappingActions:u,exampleMappingBaseSchema:ee,exampleMappingCommentTargets:fe,exampleMappingCurrentTarget:he,exampleMappingDefinitionFor:be,exampleMappingHasTarget:Se,exampleMappingMessages:C,exampleMappingTargetLabel:xe,exampleMappingTitle:j,examplesOfRule:ae,findCard:U,findExample:R,findQuestion:S,findRule:y,findStory:T,modeConcerns:J,parseExampleMappingBase:te,presentStorySummary:Te,questionsOfRule:oe,reduceCardIntent:Le,reorderById:Ee,resolveExampleDrop:Oe,resolveExampleMappingNavigation:Re,resolveQuestionDrop:ke,resolveRuleDrop:Ie,resolveStoryDrop:De,rulesOfStory:ne,serializeExampleMappingAction:ye,storyIdOfCard:at,storyIdOfExample:ot,storyIdOfRule:de},Symbol.toStringTag,{value:"Module"}));export{Ne as d,$t as i};