dev-process-kit 0.0.8 → 0.0.9

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 (34) hide show
  1. package/README.md +1 -0
  2. package/dist/chunks/shared-7qenhU4J.js +2173 -0
  3. package/dist/chunks/{shared-Dn4XK7mS.js → shared-8lYUcRvS.js} +25 -15
  4. package/dist/chunks/shared-BHGClRU3.js +29 -0
  5. package/dist/chunks/{shared-DNk3phV5.js → shared-BIdQ89rB.js} +1 -1
  6. package/dist/chunks/{shared-BTlCV660.js → shared-BOFIcKZe.js} +8 -8
  7. package/dist/chunks/shared-Cia5FdOF.js +1112 -0
  8. package/dist/chunks/shared-D4czF1TI.js +1252 -0
  9. package/dist/chunks/{shared-DEdm-PCj.js → shared-D6Yx-euS.js} +2 -2
  10. package/dist/chunks/{shared-CwwZhA40.js → shared-Dkx_2Lbf.js} +336 -268
  11. package/dist/chunks/shared-Dn5j0MCU.js +1 -0
  12. package/dist/chunks/{shared-CupreHTH.js → shared-SGSKyTNs.js} +7 -7
  13. package/dist/chunks/shared-U2T3astJ.js +1094 -0
  14. package/dist/chunks/shared-nW8tfMgg.js +556 -0
  15. package/dist/chunks/{shared-CaLe76va.js → shared-p8037r6P.js} +2 -2
  16. package/dist/components.js +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/templates/delegation-poker.js +1 -1
  19. package/dist/templates/event-storming.js +1 -1
  20. package/dist/templates/example-mapping.js +1 -1
  21. package/dist/templates/grill.js +1 -1
  22. package/dist/templates/plain.js +1 -1
  23. package/dist/templates/prototype.js +1 -1
  24. package/dist/templates/slides.js +1 -1
  25. package/dist/templates/task-board.js +1 -1
  26. package/dist/templates/usm.js +1 -1
  27. package/dist/templates/whiteboard.js +1 -0
  28. package/package.json +3 -2
  29. package/dist/chunks/shared-1AA-0t4O.js +0 -29
  30. package/dist/chunks/shared-BAePwoKi.js +0 -679
  31. package/dist/chunks/shared-BYZoeQ97.js +0 -1963
  32. package/dist/chunks/shared-CSV1HkB2.js +0 -1
  33. package/dist/chunks/shared-Csmm_KdH.js +0 -761
  34. package/dist/chunks/shared-VNSWugEg.js +0 -556
@@ -1,556 +0,0 @@
1
- import{q as m,an as E,v as A,at as k,av as S,ad as s,af as x,ag as f,as as D,a9 as Ue,aa as w,ab as M,ac as q,P as Pe,f as Qe,_ as Ce,V as I,R as g,m as Xe,a0 as H,a5 as Ye,k as Be,$ as Ve,a6 as ze,a1 as $,ay as Ke,a2 as h,A as Fe,K as je,i as Je,a3 as z,T as Z}from"./shared-BYZoeQ97.js";import{s as K,r as N,D as We}from"./shared-xrCdgpNS.js";import{P as He,r as Ze,p as Ge,c as et}from"./shared-1AA-0t4O.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:D(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:k,name:x(s(),f(1)),description:S(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:D(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:D(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:k,name:x(s(),f(1)),description:S(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:D(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:D(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:k,name:x(s(),f(1)),description:S(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:D(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:D(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:k,name:x(s(),f(1)),description:S(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:k,name:x(s(),f(1)),description:S(s())}),rt=w({id:k,storyId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),G=w({id:k,ruleId:x(s(),f(1)),name:x(s(),f(1)),description:S(s())}),ee=w({title:S(s()),stories:M(q(tt),[]),rules:M(q(rt),[]),examples:M(q(G),[]),questions:M(q(G),[])}),te=e=>{const t=Ue(ee,e),r=new Set,a=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},n=new Set(t.stories.map(i=>i.id));for(const i of t.stories)a("stories",i.id);for(const i of t.rules)if(a("rules",i.id),!n.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(a("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(a("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:[]}),at=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)},b=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},R=(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 a=y(e,t);if(a)return{kind:"rule",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const n=b(e,t);if(n)return{kind:"example",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ae=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),nt=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const a=b(e,t)?.ruleId??R(e,t)?.ruleId;return a===void 0?void 0:y(e,a)?.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=b(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=Ee(e.stories,a,r.payload.after);return n===null?null:{...e,stories:n}}case"ADD_STORY":{const n=r.payload;return e.stories.some(o=>o.id===n.id)?e:P(e,n.id)?null:{...e,stories:[...e.stories,{id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===a))return null;const n=new Set(e.rules.filter(o=>o.storyId===a).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==a),rules:e.rules.filter(o=>o.storyId!==a),examples:e.examples.filter(o=>!n.has(o.ruleId)),questions:e.questions.filter(o=>!n.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"MOVE_RULE":{const n=r.payload,o=y(e,a);if(!o||!e.stories.some(d=>d.id===n.storyId))return null;const i=e.rules.filter(d=>d.storyId===n.storyId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,rules:me(e.rules,{...o,storyId:n.storyId},n.after)}}case"REORDER_RULE":{const n=y(e,a);if(!n)return null;const o=e.rules.filter(i=>i.storyId===n.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,n,r.payload.after)}}case"ADD_RULE":{const n=r.payload,o=T(e,a);return o?e.rules.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,rules:[...e.rules,{id:n.id,storyId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_RULE":return y(e,a)?{...e,rules:e.rules.filter(n=>n.id!==a),examples:e.examples.filter(n=>n.ruleId!==a),questions:e.questions.filter(n=>n.ruleId!==a)}:null;case"SET_EXAMPLE_NAME":return ue(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,a,n=>({...n,description:r.payload.description}));case"MOVE_EXAMPLE":{const n=r.payload,o=b(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_EXAMPLE":{const n=b(e,a);if(!n)return null;const o=e.examples.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,n,r.payload.after)}}case"ADD_EXAMPLE":{const n=r.payload,o=y(e,a);return o?e.examples.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,examples:[...e.examples,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_EXAMPLE":return b(e,a)?{...e,examples:e.examples.filter(n=>n.id!==a)}:null;case"SET_QUESTION_NAME":return ce(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,a,n=>({...n,description:r.payload.description}));case"MOVE_QUESTION":{const n=r.payload,o=R(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_QUESTION":{const n=R(e,a);if(!n)return null;const o=e.questions.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,n,r.payload.after)}}case"ADD_QUESTION":{const n=r.payload,o=y(e,a);return o?e.questions.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,questions:[...e.questions,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_QUESTION":return R(e,a)?{...e,questions:e.questions.filter(n=>n.id!==a)}: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(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,pe=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.storyId===t.storyId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.storyId===t.storyId),d=new Set(n.map(l=>l.id)),c=a.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 a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.ruleId===t.ruleId),d=new Set(n.map(l=>l.id)),c=a.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 a=e.find(o=>o.id===t);if(a===void 0)return null;const n=e.filter(o=>o.id!==t);return F(n,a,r)},F=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},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 a=typeof r=="string"?r:"",n=typeof t=="string"?t:void 0;return n===void 0?e.arrowTo(a):e.arrowFrom(n,a)},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,b(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(b(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,R(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(R(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,a)=>{let n;try{const o=pt[t.type];n=o?o(e,t,a??r):{title:t.type,tone:"meta"}}catch{n={title:t.type,tone:"meta"}}return{title:n.title,targetLabel:xe(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ye=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const a=T(t,r.id);return a?`${e.kindLabel("story")} \xB7 ${a.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const a=y(t,r.id);return a?`${e.kindLabel("rule")} \xB7 ${a.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const a=b(t,r.id);return a?`${e.kindLabel("example")} \xB7 ${a.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const a=R(t,r.id);return a?`${e.kindLabel("question")} \xB7 ${a.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 a=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const n of t.stories)a.push({value:I({type:"story",id:n.id}),label:n.name,group:e.kindLabel("story")});for(const n of t.rules){const o=T(t,n.storyId);a.push({value:I({type:"rule",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("rule")})}for(const n of t.examples){const o=y(t,n.ruleId);a.push({value:I({type:"example",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("example")})}for(const n of t.questions){const o=y(t,n.ruleId);a.push({value:I({type:"question",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("question")})}return a},he=(e,t,r)=>{const a=U(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},ut=4,Te=(e,t,r)=>{const a=t.rules.filter(p=>p.storyId===r),n=new Set(a.map(p=>p.id)),o=t.examples.filter(p=>n.has(p.ruleId)),i=t.questions.filter(p=>n.has(p.ruleId)).length,d=a.some(p=>!o.some(l=>l.ruleId===p.id)),c=a.length===0?"empty":i>0?"open-questions":a.length>ut?"too-big":d?"thin":"ready";return{rules:a.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",be=(e,t)=>{const r=U(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Re=(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}},Se=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:at,hasTarget:Re,describe:(r,a,n)=>ge(t,r,a,n),serialize:ye,resolveNavigation:be,commentTargets:(r,a)=>fe(t,r),currentTarget:(r,a)=>he(t,r,a),title:j}},B=(e,t,r)=>{const a=Xe(t,ie(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},ct=(e,t)=>B(e,"new-story",r=>L.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>L.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>L.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>L.addQuestion(r,a,t.newQuestion)),yt={width:300,height:260},ve=["story","rule","example","question"],_e={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"}},O=e=>{const{bg:t,ink:r}=_e[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: var(--dpk-bevel), var(--dpk-shadow-sm);
14
- cursor: grab;
15
- transform: rotate(var(--em-tilt, 0deg));
16
- transition:
17
- transform 180ms var(--dpk-ease),
18
- box-shadow 180ms var(--dpk-ease),
19
- opacity 180ms var(--dpk-ease);
20
- }
21
-
22
- :host(:hover) {
23
- z-index: 6;
24
- transform: rotate(0deg) translateY(-2px);
25
- box-shadow: var(--dpk-bevel), var(--dpk-shadow);
26
- }
27
-
28
- :host([focused]) {
29
- z-index: 5;
30
- transform: rotate(0deg);
31
- box-shadow:
32
- var(--dpk-bevel),
33
- var(--dpk-shadow),
34
- 0 0 0 2px color-mix(in srgb, var(--dpk-blue) 30%, transparent);
35
- }
36
-
37
- :host([data-mode='editing']),
38
- :host([data-mode='commenting']) {
39
- z-index: 7;
40
- transform: rotate(0deg);
41
- }
42
-
43
- :host([dragging]) {
44
- opacity: 0.4;
45
- }
46
-
47
- :host([data-kind='story']) {
48
- min-height: 68px;
49
- padding: 19px 14px 13px;
50
- }
51
-
52
- /* Small, faint, top-left: readable when looked for, quiet when not. */
53
- .card-kind {
54
- position: absolute;
55
- top: 5px;
56
- left: 8px;
57
- font-family: var(--dpk-mono);
58
- font-size: 8px;
59
- font-weight: 600;
60
- letter-spacing: 0.12em;
61
- opacity: 0.5;
62
- }
63
-
64
- .card-name {
65
- min-width: 0;
66
- font-size: 13px;
67
- font-weight: 680;
68
- line-height: 1.35;
69
- letter-spacing: -0.01em;
70
- overflow-wrap: anywhere;
71
- cursor: text;
72
- }
73
-
74
- :host([data-kind='story']) .card-name {
75
- font-size: 15.5px;
76
- line-height: 1.3;
77
- }
78
-
79
- .card-text {
80
- font-size: 11.5px;
81
- line-height: 1.5;
82
- opacity: 0.72;
83
- white-space: pre-wrap;
84
- }
85
-
86
- /* Comments already left: a corner flag, readable without hover. */
87
- .card-flag {
88
- position: absolute;
89
- top: -7px;
90
- right: -7px;
91
- min-width: 17px;
92
- height: 17px;
93
- padding: 0 4px;
94
- box-sizing: border-box;
95
- border-radius: 999px;
96
- background: var(--dpk-accent);
97
- color: var(--dpk-accent-ink);
98
- font-family: var(--dpk-mono);
99
- font-size: 9.5px;
100
- font-weight: 650;
101
- line-height: 17px;
102
- text-align: center;
103
- box-shadow: 0 1px 4px color-mix(in srgb, var(--dpk-accent) 35%, transparent);
104
- }
105
-
106
- /* A side rail of round buttons that fades in on hover, like Event Storming:
107
- nothing crosses the card's face. */
108
- .card-tools {
109
- position: absolute;
110
- top: 9px;
111
- right: -11px;
112
- z-index: 8;
113
- display: flex;
114
- flex-direction: column;
115
- gap: 3px;
116
- opacity: 0;
117
- pointer-events: none;
118
- transition: opacity 140ms var(--dpk-ease);
119
- }
120
-
121
- :host(:hover) .card-tools,
122
- :host([data-mode='commenting']) .card-tools,
123
- .card-tools:focus-within {
124
- opacity: 1;
125
- pointer-events: auto;
126
- }
127
-
128
- .card-tools .dpk-icon-btn {
129
- width: 22px;
130
- height: 22px;
131
- border: 1px solid var(--dpk-rule);
132
- border-radius: 50%;
133
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
134
- box-shadow: var(--dpk-shadow-xs);
135
- }
136
- `;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="";#n=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:n,ink:o}=_e[this.card.kind];this.setAttribute("data-kind",this.card.kind),this.style.setProperty("--em-card-bg",n),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"),a=this.renderRoot.querySelector('[data-role="comment"]');r&&a&&this.#n.open(r,a,yt)}render(){const t=this.card;if(!t)return $;const r=C(this.#e.locale),a=r.kindLabel(t.kind);return h`
137
- <div class="card-kind">${a}</div>
138
- <dpk-component-inline-edit
139
- class="card-name"
140
- ?wrap=${!0}
141
- ?seamless=${!0}
142
- .value=${t.name}
143
- .label=${r.nameField(a)}
144
- @dpk-commit=${Ke(n=>this.#t({kind:"rename",name:n}))}
145
- ></dpk-component-inline-edit>
146
- ${t.description?h`<div class="card-text">${t.description}</div>`:$}
147
- ${this.notes.length>0?h`<span class="card-flag">${this.notes.length}</span>`:$}
148
- <div class="card-tools">
149
- <button
150
- class="dpk-icon-btn"
151
- type="button"
152
- data-role="comment"
153
- aria-label=${r.commentButton}
154
- data-active=${String(this.mode==="commenting")}
155
- @click=${this.#a({kind:"toggle-comment"})}
156
- >
157
- ${Fe()}
158
- </button>
159
- <button
160
- class="dpk-icon-btn"
161
- type="button"
162
- data-role="delete"
163
- aria-label=${r.deleteButton}
164
- @click=${this.#a({kind:"delete"})}
165
- >
166
- ${je()}
167
- </button>
168
- </div>
169
- ${this.mode==="commenting"?this.#o(t):$}
170
- `}#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)})}#a(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)},Tt=(e,t,r)=>{const a=e.at(-1)??null;if(t===null||r==="end")return a;const n=e.indexOf(t);return n<0?a:r==="after"?t:n===0?null:e.at(n-1)??null},ke=(e,t,r,a)=>{if(!T(e,t))return null;const n=e.stories.map(o=>o.id);return{type:"REORDER_STORY",target:{type:"story",id:t},payload:{after:N(n,t,r,a)}}},De=(e,t,r,a,n)=>{if(!T(e,t)||!y(e,r))return null;const o=e.rules.filter(i=>i.storyId===t).map(i=>i.id);return{type:"MOVE_RULE",target:{type:"rule",id:r},payload:{storyId:t,after:N(o,r,a,n)}}},Ie=(e,t,r,a,n)=>{if(!y(e,t)||!b(e,r))return null;const o=e.examples.filter(i=>i.ruleId===t).map(i=>i.id);return{type:"MOVE_EXAMPLE",target:{type:"example",id:r},payload:{ruleId:t,after:N(o,r,a,n)}}},Oe=(e,t,r,a,n)=>{if(!y(e,t)||!R(e,r))return null;const o=e.questions.filter(i=>i.ruleId===t).map(i=>i.id);return{type:"MOVE_QUESTION",target:{type:"question",id:r},payload:{ruleId:t,after:N(o,r,a,n)}}},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}},bt=(e,t)=>{if(e==="story")return 0;let r=0;for(const a of t)r=r*31+a.charCodeAt(0)|0;return(Math.abs(r)%5-2)*.45},Rt=e=>h`<ul class="legend" aria-label=${e.cardKinds}>
171
- ${ve.map(t=>h`<li><span class="legend-swatch" style=${O(t)}></span>${e.kindLabel(t)}</li>`)}
172
- </ul>`,St=e=>{const{context:t,handlers:r,m:a}=e;return t.state.stories.length===0?h`
173
- <div class="empty">
174
- <h2>${a.noStoriesTitle}</h2>
175
- <p>${a.noStoriesBody}</p>
176
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${r.addStory}>${a.firstStory}</button>
177
- </div>
178
- `:h`
179
- <div class="board" data-testid="example-mapping-board">
180
- ${z(t.state.stories,n=>n.id,n=>vt(e,n))}
181
- <button class="add-story" type="button" @click=${r.addStory}>${a.addStoryButton}</button>
182
- </div>
183
- `},W=(e,t,r)=>{const{context:a,mode:n,drag:o,handlers:i}=e,d=a.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
184
- data-card=${r.id}
185
- data-card-kind=${t}
186
- draggable="true"
187
- .card=${{kind:t,id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}}}
188
- .notes=${d}
189
- .tilt=${bt(t,r.id)}
190
- .mode=${$e(n,r.id)}
191
- .onIntent=${p=>i.cardIntent(r.id,t,p)}
192
- ?focused=${a.navigation.card===r.id}
193
- ?dragging=${o.isDragging(t,r.id)}
194
- @dragstart=${c.dragstart}
195
- @dragend=${c.dragend}
196
- ></dpk-internal-example-mapping-card>`},vt=(e,t)=>{const{context:r,drag:a,handlers:n,m:o}=e,i=Te(o,r.state,t.id),d=`story:${t.id}`,c=a.target({key:d,accepts:"story",hovered:Me(".story-section","story"),onDrop:n.dropStory}),p=`rules:${t.id}`,l=a.target({key:p,accepts:"rule",hovered:Me(".rule-col","rule"),onDrop:v=>n.dropRule(t.id,v)});return h`
197
- <section
198
- class="story-section"
199
- data-story=${t.id}
200
- data-drop=${String(a.isOver(d))}
201
- @dragenter=${c.dragenter}
202
- @dragover=${c.dragover}
203
- @dragleave=${c.dragleave}
204
- @drop=${c.drop}
205
- >
206
- <header class="story-row">
207
- <div class="story-slot">${W(e,"story",t)}</div>
208
- <div class="story-meta">
209
- <span class="readiness" data-readiness=${i.readiness}>${i.label}</span>
210
- <span class="tally"
211
- ><i class="tally-dot" style=${O("rule")}></i>${o.kindLabel("rule")} ${i.rules}</span
212
- >
213
- <span class="tally"
214
- ><i class="tally-dot" style=${O("example")}></i>${o.kindLabel("example")}
215
- ${i.examples}</span
216
- >
217
- <span class="tally"
218
- ><i class="tally-dot" style=${O("question")}></i>${o.kindLabel("question")}
219
- ${i.questions}</span
220
- >
221
- </div>
222
- </header>
223
- <div
224
- class="rules-row"
225
- data-testid=${`rules-${t.id}`}
226
- data-drop=${String(a.isOver(p))}
227
- @dragenter=${l.dragenter}
228
- @dragover=${l.dragover}
229
- @dragleave=${l.dragleave}
230
- @drop=${l.drop}
231
- >
232
- ${z(ae(r.state,t.id),v=>v.id,v=>_t(e,v))}
233
- <button class="add-rule" type="button" @click=${()=>n.addRule(t.id)}>
234
- <span class="add-plus">+</span>${o.kindLabel("rule")}
235
- </button>
236
- </div>
237
- </section>
238
- `},_t=(e,t)=>{const{drag:r}=e;return h`
239
- <div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
240
- ${W(e,"rule",t)} ${Ae(e,t.id,"example")}
241
- ${Ae(e,t.id,"question")}
242
- </div>
243
- `},kt={example:"examples",question:"questions"},Dt=(e,t)=>({testid:kt[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),Ae=(e,t,r)=>{const{context:a,drag:n,handlers:o,m:i}=e,d=Dt(i,r),c=`${d.testid}:${t}`,p=r==="example"?n.target({key:c,accepts:"example",hovered:we("example"),onDrop:_=>o.dropExample(t,_)}):n.target({key:c,accepts:"question",hovered:we("question"),onDrop:_=>o.dropQuestion(t,_)}),l=r==="example"?ne(a.state,t):oe(a.state,t),v=r==="example"?o.addExample:o.addQuestion;return h`<div
244
- class="card-area card-area--${r}"
245
- data-testid=${`${d.testid}-${t}`}
246
- data-drop=${String(n.isOver(c))}
247
- @dragenter=${p.dragenter}
248
- @dragover=${p.dragover}
249
- @dragleave=${p.dragleave}
250
- @drop=${p.drop}
251
- >
252
- <h3 class="area-label"><i class="tally-dot" style=${O(r)}></i>${d.label}</h3>
253
- ${z(l,_=>_.id,_=>W(e,r,_))}
254
- ${l.length===0?h`<p class="stack-hint">${d.empty}</p>`:$}
255
- <button class="add-card add-${r}" type="button" @click=${()=>v(t)}>${d.add}</button>
256
- </div>`},we=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}},Me=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},It=H`
257
- /* ------------------------------------------------------------ legend */
258
-
259
- .legend {
260
- display: flex;
261
- flex-wrap: wrap;
262
- gap: 6px;
263
- margin: 0;
264
- padding: 0;
265
- list-style: none;
266
- font-size: 11.5px;
267
- color: var(--dpk-ink-soft);
268
- }
269
-
270
- /* Each entry reads as a small raised chip, matching the pill vocabulary
271
- used for the readiness / tally summary next to it. */
272
- .legend li {
273
- display: inline-flex;
274
- align-items: center;
275
- gap: 6px;
276
- padding: 4px 10px 4px 6px;
277
- border: 1px solid var(--dpk-rule);
278
- border-radius: 999px;
279
- background: var(--dpk-paper-raised);
280
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
281
- }
282
-
283
- .legend-swatch {
284
- width: 14px;
285
- height: 11px;
286
- border-radius: 2px;
287
- background: var(--em-card-bg);
288
- box-shadow: var(--dpk-shadow-xs);
289
- }
290
-
291
- /* ------------------------------------------------------------- board */
292
-
293
- .board {
294
- display: grid;
295
- gap: 22px;
296
- align-content: start;
297
- }
298
-
299
- .story-section {
300
- position: relative;
301
- display: grid;
302
- gap: 18px;
303
- min-width: 0;
304
- padding: 20px 22px 24px;
305
- border: 1px solid var(--dpk-rule);
306
- border-radius: var(--dpk-radius-lg);
307
- background:
308
- radial-gradient(circle, var(--dpk-rule) 1px, transparent 1.2px) 0 0 / 18px 18px,
309
- var(--dpk-paper-raised);
310
- box-shadow: var(--dpk-shadow);
311
- transition: outline-color 150ms ease;
312
- }
313
-
314
- /* A quiet top edge marks the section as one grouped unit, echoing the
315
- activity band accent used elsewhere in the kit. */
316
- .story-section::before {
317
- content: '';
318
- position: absolute;
319
- top: 0;
320
- left: 0;
321
- right: 0;
322
- height: 2px;
323
- border-radius: var(--dpk-radius-lg) var(--dpk-radius-lg) 0 0;
324
- background: color-mix(in srgb, var(--dpk-accent) 45%, transparent);
325
- }
326
-
327
- .story-section[data-drop='true'] {
328
- outline: 2px dashed var(--dpk-blue);
329
- outline-offset: 4px;
330
- }
331
-
332
- /* The story heads the table: one wide card, with where it stands beside it. */
333
- .story-row {
334
- display: flex;
335
- flex-wrap: wrap;
336
- align-items: center;
337
- gap: 14px 20px;
338
- }
339
-
340
- .story-slot {
341
- width: min(420px, 100%);
342
- }
343
-
344
- .story-meta {
345
- display: flex;
346
- flex-wrap: wrap;
347
- align-items: center;
348
- gap: 6px;
349
- }
350
-
351
- .readiness {
352
- padding: 4px 11px;
353
- border-radius: 999px;
354
- font-size: 11.5px;
355
- font-weight: 650;
356
- background: var(--dpk-paper-sunken);
357
- color: var(--dpk-ink-soft);
358
- box-shadow: var(--dpk-shadow-xs);
359
- }
360
-
361
- .readiness[data-readiness='ready'] {
362
- background: var(--dpk-green-soft);
363
- color: var(--dpk-green);
364
- }
365
-
366
- .readiness[data-readiness='open-questions'],
367
- .readiness[data-readiness='too-big'] {
368
- background: var(--dpk-danger-soft);
369
- color: var(--dpk-danger);
370
- }
371
-
372
- .readiness[data-readiness='thin'] {
373
- background: var(--dpk-amber-soft);
374
- color: var(--dpk-amber);
375
- }
376
-
377
- .tally {
378
- display: inline-flex;
379
- align-items: center;
380
- gap: 5px;
381
- padding: 3px 9px;
382
- border: 1px solid var(--dpk-rule);
383
- border-radius: 999px;
384
- background: var(--dpk-paper-raised);
385
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
386
- font-family: var(--dpk-mono);
387
- font-size: 10.5px;
388
- font-variant-numeric: tabular-nums;
389
- color: var(--dpk-ink-soft);
390
- }
391
-
392
- .tally-dot {
393
- width: 8px;
394
- height: 8px;
395
- border-radius: 2px;
396
- background: var(--em-card-bg);
397
- }
398
-
399
- /* ------------------------------------------------- rules and examples */
400
-
401
- /* Rules side by side under the story; the row scrolls, never the page. */
402
- .rules-row {
403
- display: flex;
404
- align-items: flex-start;
405
- gap: 14px;
406
- min-width: 0;
407
- overflow-x: auto;
408
- padding: 4px 4px 16px;
409
- border-radius: var(--dpk-radius);
410
- }
411
-
412
- .rules-row[data-drop='true'] {
413
- background: var(--dpk-blue-soft);
414
- }
415
-
416
- /* A rule and its examples read as one lane: a soft tint plus a quiet left
417
- accent, so the grouping reads even where the tint thins out lower down. */
418
- .rule-col {
419
- position: relative;
420
- flex: 0 0 204px;
421
- display: grid;
422
- gap: 16px;
423
- align-content: start;
424
- padding: 10px 10px 14px;
425
- border-radius: var(--dpk-radius-lg);
426
- background: linear-gradient(
427
- 180deg,
428
- color-mix(in srgb, var(--dpk-blue) 9%, transparent),
429
- color-mix(in srgb, var(--dpk-blue) 3%, transparent) 70%,
430
- transparent
431
- );
432
- box-shadow: inset 2px 0 0 color-mix(in srgb, var(--dpk-blue) 40%, transparent);
433
- }
434
-
435
- .rule-col[data-dragging] {
436
- opacity: 0.45;
437
- }
438
-
439
- /* Examples on top, questions below: two areas, each its own drop target. */
440
- .card-area {
441
- display: grid;
442
- gap: 12px;
443
- align-content: start;
444
- min-height: 44px;
445
- padding: 8px 8px 10px;
446
- border-radius: var(--dpk-radius);
447
- box-shadow: inset 0 1px 3px var(--dpk-shade-1);
448
- }
449
-
450
- .card-area--example {
451
- background: var(--dpk-green-soft);
452
- }
453
-
454
- .card-area--question {
455
- background: var(--dpk-danger-soft);
456
- }
457
-
458
- .card-area--question dpk-internal-example-mapping-card {
459
- min-height: 56px;
460
- }
461
-
462
- .card-area[data-drop='true'] {
463
- outline: 2px dashed var(--dpk-blue);
464
- outline-offset: 2px;
465
- }
466
-
467
- .area-label {
468
- display: flex;
469
- align-items: center;
470
- gap: 6px;
471
- margin: 0;
472
- font-size: 10.5px;
473
- font-weight: 600;
474
- letter-spacing: 0.04em;
475
- color: var(--dpk-ink-soft);
476
- }
477
-
478
- .stack-hint {
479
- margin: 0;
480
- font-size: 11px;
481
- color: var(--dpk-ink-faint);
482
- text-align: center;
483
- }
484
-
485
- /* -------------------------------------------------------- add buttons */
486
-
487
- .add-card,
488
- .add-rule,
489
- .add-story {
490
- border: 1px dashed var(--dpk-rule-strong);
491
- border-radius: var(--dpk-radius-sm);
492
- background: color-mix(in srgb, var(--dpk-paper-raised) 60%, transparent);
493
- color: var(--dpk-ink-faint);
494
- font: inherit;
495
- font-size: 11.5px;
496
- cursor: pointer;
497
- transition:
498
- background 140ms var(--dpk-ease),
499
- border-color 140ms var(--dpk-ease),
500
- color 140ms var(--dpk-ease),
501
- transform 140ms var(--dpk-ease);
502
- }
503
-
504
- .add-card {
505
- padding: 6px 8px;
506
- }
507
-
508
- .add-rule {
509
- flex: 0 0 120px;
510
- display: grid;
511
- place-items: center;
512
- align-content: center;
513
- gap: 2px;
514
- min-height: 96px;
515
- }
516
-
517
- .add-plus {
518
- font-size: 18px;
519
- line-height: 1;
520
- }
521
-
522
- .add-story {
523
- justify-self: start;
524
- padding: 10px 18px;
525
- font-size: 12.5px;
526
- }
527
-
528
- .add-card:hover,
529
- .add-rule:hover,
530
- .add-story:hover {
531
- border-color: var(--dpk-blue);
532
- background: var(--dpk-blue-soft);
533
- color: var(--dpk-blue);
534
- transform: translateY(-1px);
535
- }
536
-
537
- /* The empty state is the working canvas before anything is on it: same
538
- dot-grid ground as the other templates' boards. */
539
- .empty {
540
- display: grid;
541
- gap: 10px;
542
- max-width: 620px;
543
- padding: 28px 24px;
544
- border: 1px dashed var(--dpk-rule-strong);
545
- border-radius: var(--dpk-radius-lg);
546
- background: var(--dpk-dots), var(--dpk-paper-sunken);
547
- }
548
-
549
- .empty p {
550
- margin: 0;
551
- color: var(--dpk-ink-soft);
552
- line-height: 1.7;
553
- }
554
- `,Ot={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},$t={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 Se(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.#n(t,r)}}#n(t,r){return h`
555
- ${St({context:t,mode:this.mode,drag:this.#r,m:r,handlers:{cardIntent:(a,n,o)=>this.#o(a,n,o),addStory:()=>this.#e(ct(t,r)),addRule:a=>this.#e(mt(t,r,a)),addExample:a=>this.#e(Et(t,r,a)),addQuestion:a=>this.#e(gt(t,r,a)),dropStory:a=>this.#a(a),dropRule:(a,n)=>this.#t(a,n),dropExample:(a,n)=>this.#d(a,n),dropQuestion:(a,n)=>this.#s(a,n)}})}
556
- `}#e(t){t!==null&&(this.mode={kind:"editing",cardId:t})}#o(t,r,a){const n=this.context();switch(a.kind){case"select":n.navigate({card:t});break;case"rename":n.dispatch({type:Ot[r],target:{type:r,id:t},payload:{name:a.name}});break;case"comment":n.dispatch({type:"comment",target:`${r}:${t}`,payload:{body:a.body}});break;case"delete":n.dispatch({type:$t[r],target:{type:r,id:t},payload:{}}),n.navigation.card===t&&n.navigate({card:null});break}this.mode=Le(this.mode,t,a)}#a(t){const r=this.context(),a=ke(r.state,t.item.id,t.hoveredId,t.place);a&&r.dispatch(a)}#t(t,r){const a=this.context(),n=this.#i(r.hoveredId,r.event.clientX,r.place),o=De(a.state,t,r.item.id,r.hoveredId,n);o&&a.dispatch(o)}#i(t,r,a){if(t===null)return a;const n=this.renderRoot.querySelector(`.rule-col[data-rule="${t}"]`);if(!n)return a;const o=n.getBoundingClientRect();return r<=o.left+o.width/2?"before":"after"}#d(t,r){const a=this.context(),n=Ie(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}#s(t,r){const a=this.context(),n=Oe(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}}const Ne=()=>{ht(),customElements.get("dpk-template-example-mapping")||customElements.define("dpk-template-example-mapping",qe)},Lt=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:ve,DpkTemplateExampleMapping:qe,IDLE_MODE:V,allMappingIds:ie,applyExampleMappingAction:se,cardModeOf:$e,cardPaletteStyle:O,defineExampleMappingElement:Ne,describeExampleMappingAction:ge,dropAfter:Tt,emptyExampleMappingBase:re,exampleMappingAction:L,exampleMappingActions:u,exampleMappingBaseSchema:ee,exampleMappingCommentTargets:fe,exampleMappingCurrentTarget:he,exampleMappingDefinitionFor:Se,exampleMappingHasTarget:Re,exampleMappingMessages:C,exampleMappingTargetLabel:xe,exampleMappingTitle:j,examplesOfRule:ne,findCard:U,findExample:b,findQuestion:R,findRule:y,findStory:T,modeConcerns:J,parseExampleMappingBase:te,presentStorySummary:Te,questionsOfRule:oe,reduceCardIntent:Le,reorderById:Ee,resolveExampleDrop:Ie,resolveExampleMappingNavigation:be,resolveQuestionDrop:Oe,resolveRuleDrop:De,resolveStoryDrop:ke,rulesOfStory:ae,serializeExampleMappingAction:ye,storyIdOfCard:nt,storyIdOfExample:ot,storyIdOfRule:de},Symbol.toStringTag,{value:"Module"}));export{Ne as d,Lt as i};