dev-process-kit 0.2.1 → 0.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +178 -60
  2. package/dist/boards.js +1 -0
  3. package/dist/chunks/shared-BX1EnRfr.js +1 -0
  4. package/dist/chunks/shared-C-M2Nfmu.js +686 -0
  5. package/dist/chunks/shared-Cas88qVh.js +2165 -0
  6. package/dist/chunks/{shared-DeXM1v86.js → shared-Cejw83eH.js} +21 -29
  7. package/dist/chunks/shared-CfVpKPRY.js +1844 -0
  8. package/dist/chunks/shared-CnPCm4bJ.js +31 -0
  9. package/dist/chunks/shared-D1iBuYZV.js +6208 -0
  10. package/dist/chunks/shared-D7VtCoY6.js +3586 -0
  11. package/dist/chunks/{shared-zZF1zU0o.js → shared-DHVDag3x.js} +25 -56
  12. package/dist/chunks/shared-DdpMqkAH.js +4928 -0
  13. package/dist/chunks/shared-EYOAbLSo.js +1 -0
  14. package/dist/chunks/shared-TrlnHjrJ.js +1 -0
  15. package/dist/chunks/shared-a9QCZpxj.js +574 -0
  16. package/dist/chunks/shared-df9XN7ns.js +904 -0
  17. package/dist/chunks/shared-dnY35u9q.js +2530 -0
  18. package/dist/chunks/shared-e9ia12Uz.js +1636 -0
  19. package/dist/chunks/shared-qk9TB_UM.js +705 -0
  20. package/dist/components.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/views/delegation-poker.js +1 -0
  23. package/dist/views/plain.js +1 -0
  24. package/dist/views/prototype.js +1 -0
  25. package/dist/views/slides.js +1 -0
  26. package/dist/views/task-board.js +1 -0
  27. package/dist/views/usm.js +1 -0
  28. package/package.json +8 -10
  29. package/dist/chunks/shared-B5lBiq5s.js +0 -1
  30. package/dist/chunks/shared-BjyoXjSO.js +0 -1
  31. package/dist/chunks/shared-C-d71uRP.js +0 -573
  32. package/dist/chunks/shared-C5n6LBUz.js +0 -1105
  33. package/dist/chunks/shared-CAWKGcWJ.js +0 -1053
  34. package/dist/chunks/shared-CdZhkPto.js +0 -1
  35. package/dist/chunks/shared-DB_C1Mdu.js +0 -1
  36. package/dist/chunks/shared-DDOpqbVL.js +0 -49
  37. package/dist/chunks/shared-DehzCTC2.js +0 -1616
  38. package/dist/chunks/shared-Dfj6O0K4.js +0 -2774
  39. package/dist/chunks/shared-DiFAX1_p.js +0 -3780
  40. package/dist/chunks/shared-DkPo0jX3.js +0 -4214
  41. package/dist/chunks/shared-GL2Z98Cz.js +0 -4206
  42. package/dist/chunks/shared-cMhjZGRs.js +0 -301
  43. package/dist/templates/delegation-poker.js +0 -1
  44. package/dist/templates/event-storming.js +0 -1
  45. package/dist/templates/example-mapping.js +0 -1
  46. package/dist/templates/plain.js +0 -1
  47. package/dist/templates/prototype.js +0 -1
  48. package/dist/templates/slides.js +0 -1
  49. package/dist/templates/task-board.js +0 -1
  50. package/dist/templates/usm.js +0 -1
  51. package/dist/templates/whiteboard.js +0 -1
@@ -1,573 +0,0 @@
1
- import{p as m,au as E,w as M,aG as k,aI as S,ai as s,ak as x,al as h,aD as D,aU as z,ae as Pe,af as A,ag as q,ah as N,aH as K,P as Qe,e as Ce,a0 as Xe,V as I,R as g,l as Ye,a2 as G,a9 as Be,j as Ve,a1 as ze,aa as Ke,ab as Fe,a3 as $,aM as je,a4 as f,B as Je,K as He,h as We,a5 as F,aR as Ge,T as Z}from"./shared-DiFAX1_p.js";import{r as U,D as Ze}from"./shared-B5lBiq5s.js";import{r as et,p as tt,c as rt}from"./shared-DDOpqbVL.js";import{o as at}from"./shared-BjyoXjSO.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:M}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),h(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:M}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),h(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:M}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),h(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),h(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(),h(1)),description:S(s())}),{dedupeKey:M}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},w={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:{}})},nt=A({id:k,name:x(s(),h(1)),description:S(s()),questions:K}),ot=A({id:k,storyId:x(s(),h(1)),name:x(s(),h(1)),description:S(s()),questions:K}),ee=A({id:k,ruleId:x(s(),h(1)),name:x(s(),h(1)),description:S(s()),questions:K}),te=A({title:S(s()),stories:q(N(nt),[]),rules:q(N(ot),[]),examples:q(N(ee),[]),questions:q(N(ee),[])}),re=e=>{const t=Pe(te,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},ae=()=>({stories:[],rules:[],examples:[],questions:[]}),it=e=>({...e,rules:z(e.rules,["storyId"]),examples:z(e.examples,["ruleId"]),questions:z(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)},L=(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}}},ne=(e,t)=>e.rules.filter(r=>r.storyId===t),oe=(e,t)=>e.examples.filter(r=>r.ruleId===t),ie=(e,t)=>e.questions.filter(r=>r.ruleId===t),dt=(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},de=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)],se=(e,t)=>y(e,t)?.storyId,st=(e,t)=>{const r=b(e,t);return r?se(e,r.ruleId):void 0},le=(e,t)=>{const r=Qe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=ge(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 ue(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return ue(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:Ee(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:Ee(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 ce(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ce(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 me(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return me(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 Ce(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),pe=(e,t,r)=>e.stories.some(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,Ee=(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]:j(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]:j(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)]},ge=(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 j(n,a,r)},j=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},lt={story:"Story",rule:"Rule",example:"Example",question:"Question"},pt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},ut={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},ct={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=Xe({en:{kindLabel:e=>lt[e],readinessLabel:e=>ut[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=>pt[e],readinessLabel:e=>ct[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)},mt={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),ye=(e,t,r,a)=>{let n;try{const o=mt[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:he(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},xe=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,he=(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},Te=(e,t,r)=>{const a=L(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},Et=4,be=(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>Et?"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",Re=(e,t)=>{const r=L(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Se=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return L(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},ve=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:re,emptyBase:ae,actions:u,apply:le,canonicalState:it,hasTarget:Se,describe:(r,a,n)=>ye(t,r,a,n),serialize:xe,resolveNavigation:Re,navigationFor:(r,a)=>L(r,a.id)?.kind===a.type?{card:a.id}:null,commentTargets:(r,a)=>fe(t,r),currentTarget:(r,a)=>Te(t,r,a),title:J}},B=(e,t,r)=>{const a=Ye(t,de(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},gt=(e,t)=>B(e,"new-story",r=>w.addStory(r,t.newStory)),yt=(e,t,r)=>B(e,"new-rule",a=>w.addRule(r,a,t.newRule)),xt=(e,t,r)=>B(e,"new-example",a=>w.addExample(r,a,t.newExample)),ht=(e,t,r)=>B(e,"new-question",a=>w.addQuestion(r,a,t.newQuestion)),ft={width:300,height:260},_e=["story","rule","example","question"],ke={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}=ke[e];return`--em-card-bg:${t};--em-card-ink:${r}`},Tt=G`
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
- overflow-wrap: anywhere;
85
- }
86
-
87
- /* Comments already left: a corner flag, readable without hover. */
88
- .card-flag {
89
- position: absolute;
90
- top: -7px;
91
- right: -7px;
92
- min-width: 17px;
93
- height: 17px;
94
- padding: 0 4px;
95
- box-sizing: border-box;
96
- border-radius: 999px;
97
- background: var(--dpk-accent);
98
- color: var(--dpk-accent-ink);
99
- font-family: var(--dpk-mono);
100
- font-size: 9.5px;
101
- font-weight: 650;
102
- line-height: 17px;
103
- text-align: center;
104
- box-shadow: 0 1px 4px color-mix(in srgb, var(--dpk-accent) 35%, transparent);
105
- }
106
-
107
- /* A side rail of round buttons that fades in on hover, like Event Storming:
108
- nothing crosses the card's face. */
109
- .card-tools {
110
- position: absolute;
111
- top: 9px;
112
- right: -11px;
113
- z-index: 8;
114
- display: flex;
115
- flex-direction: column;
116
- gap: 3px;
117
- opacity: 0;
118
- pointer-events: none;
119
- transition: opacity 140ms var(--dpk-ease);
120
- }
121
-
122
- :host(:hover) .card-tools,
123
- :host([data-mode='commenting']) .card-tools,
124
- .card-tools:focus-within {
125
- opacity: 1;
126
- pointer-events: auto;
127
- }
128
-
129
- .card-tools .dpk-icon-btn {
130
- width: 22px;
131
- height: 22px;
132
- border: 1px solid var(--dpk-rule);
133
- border-radius: 50%;
134
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
135
- box-shadow: var(--dpk-shadow-xs);
136
- }
137
- `;class bt extends Be{static{this.styles=[Ve,Tt,ze]}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 Ke(this);#e=new Fe(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}=ke[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,ft)}render(){const t=this.card;if(!t)return $;const r=C(this.#e.locale),a=r.kindLabel(t.kind);return f`
138
- <div class="card-kind">${a}</div>
139
- <dpk-component-inline-edit
140
- class="card-name"
141
- ?wrap=${!0}
142
- ?seamless=${!0}
143
- .value=${t.name}
144
- .label=${r.nameField(a)}
145
- @dpk-commit=${je(n=>this.#t({kind:"rename",name:n}))}
146
- ></dpk-component-inline-edit>
147
- ${t.description?f`<div class="card-text">${t.description}</div>`:$}
148
- ${this.notes.length>0?f`<span class="card-flag">${this.notes.length}</span>`:$}
149
- <div class="card-tools">
150
- <button
151
- class="dpk-icon-btn"
152
- type="button"
153
- data-role="comment"
154
- aria-label=${r.commentButton}
155
- data-active=${String(this.mode==="commenting")}
156
- @click=${this.#a({kind:"toggle-comment"})}
157
- >
158
- ${Je()}
159
- </button>
160
- <button
161
- class="dpk-icon-btn"
162
- type="button"
163
- data-role="delete"
164
- aria-label=${r.deleteButton}
165
- @click=${this.#a({kind:"delete"})}
166
- >
167
- ${He()}
168
- </button>
169
- </div>
170
- ${this.mode==="commenting"?this.#o(t):$}
171
- `}#o(t){return et(rt(this.#e.locale),tt(this.#r,this.notes.map(We),{label:t.name,key:`card:${t.id}`}),r=>{r.kind==="input"?(this.#r=r.body,this.requestUpdate()):r.kind!=="choose"&&this.#t(r)})}#a(t){return r=>{r.stopPropagation(),this.#t(t)}}#t(t){this.onIntent?.(t)}}const Rt=()=>{customElements.get("dpk-internal-example-mapping-card")||customElements.define("dpk-internal-example-mapping-card",bt)},St=(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},De=(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:U(n,t,r,a)}}},Ie=(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:U(o,r,a,n)}}},Oe=(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:U(o,r,a,n)}}},$e=(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:U(o,r,a,n)}}},V={kind:"idle"},H=(e,t)=>e.kind!=="idle"&&e.cardId===t,we=(e,t)=>H(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 H(e,t)?V:e;case"select":return e}},vt=(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},_t=e=>f`<ul class="legend" aria-label=${e.cardKinds}>
172
- ${_e.map(t=>f`<li><span class="legend-swatch" style=${O(t)}></span>${e.kindLabel(t)}</li>`)}
173
- </ul>`,kt=e=>{const{context:t,handlers:r,m:a}=e;return t.state.stories.length===0?f`
174
- <div class="empty">
175
- <h2>${a.noStoriesTitle}</h2>
176
- <p>${a.noStoriesBody}</p>
177
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${r.addStory}>${a.firstStory}</button>
178
- </div>
179
- `:f`
180
- <div class="board" data-testid="example-mapping-board">
181
- ${F(t.state.stories,n=>n.id,n=>Dt(e,n))}
182
- <button class="add-story" type="button" @click=${r.addStory}>${a.addStoryButton}</button>
183
- </div>
184
- `},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 f`<dpk-internal-example-mapping-card
185
- data-card=${r.id}
186
- data-card-kind=${t}
187
- data-dpk-target=${I({type:t,id:r.id})}
188
- data-grill-questions=${at(Ge(r.questions))}
189
- draggable="true"
190
- .card=${{kind:t,id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}}}
191
- .notes=${d}
192
- .tilt=${vt(t,r.id)}
193
- .mode=${we(n,r.id)}
194
- .onIntent=${p=>i.cardIntent(r.id,t,p)}
195
- ?focused=${a.navigation.card===r.id}
196
- ?dragging=${o.isDragging(t,r.id)}
197
- @dragstart=${c.dragstart}
198
- @dragend=${c.dragend}
199
- ></dpk-internal-example-mapping-card>`},Dt=(e,t)=>{const{context:r,drag:a,handlers:n,m:o}=e,i=be(o,r.state,t.id),d=`story:${t.id}`,c=a.target({key:d,accepts:"story",hovered:qe(".story-section","story"),onDrop:n.dropStory}),p=`rules:${t.id}`,l=a.target({key:p,accepts:"rule",hovered:qe(".rule-col","rule"),onDrop:v=>n.dropRule(t.id,v)});return f`
200
- <section
201
- class="story-section"
202
- data-story=${t.id}
203
- data-drop=${String(a.isOver(d))}
204
- @dragenter=${c.dragenter}
205
- @dragover=${c.dragover}
206
- @dragleave=${c.dragleave}
207
- @drop=${c.drop}
208
- >
209
- <header class="story-row">
210
- <div class="story-slot">${W(e,"story",t)}</div>
211
- <div class="story-meta">
212
- <span class="readiness" data-readiness=${i.readiness}>${i.label}</span>
213
- <span class="tally"
214
- ><i class="tally-dot" style=${O("rule")}></i>${o.kindLabel("rule")} ${i.rules}</span
215
- >
216
- <span class="tally"
217
- ><i class="tally-dot" style=${O("example")}></i>${o.kindLabel("example")}
218
- ${i.examples}</span
219
- >
220
- <span class="tally"
221
- ><i class="tally-dot" style=${O("question")}></i>${o.kindLabel("question")}
222
- ${i.questions}</span
223
- >
224
- </div>
225
- </header>
226
- <div
227
- class="rules-row"
228
- data-testid=${`rules-${t.id}`}
229
- data-drop=${String(a.isOver(p))}
230
- @dragenter=${l.dragenter}
231
- @dragover=${l.dragover}
232
- @dragleave=${l.dragleave}
233
- @drop=${l.drop}
234
- >
235
- ${F(ne(r.state,t.id),v=>v.id,v=>It(e,v))}
236
- <button class="add-rule" type="button" @click=${()=>n.addRule(t.id)}>
237
- <span class="add-plus">+</span>${o.kindLabel("rule")}
238
- </button>
239
- </div>
240
- </section>
241
- `},It=(e,t)=>{const{drag:r}=e;return f`
242
- <div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
243
- ${W(e,"rule",t)} ${Me(e,t.id,"example")}
244
- ${Me(e,t.id,"question")}
245
- </div>
246
- `},Ot={example:"examples",question:"questions"},$t=(e,t)=>({testid:Ot[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),Me=(e,t,r)=>{const{context:a,drag:n,handlers:o,m:i}=e,d=$t(i,r),c=`${d.testid}:${t}`,p=r==="example"?n.target({key:c,accepts:"example",hovered:Ae("example"),onDrop:_=>o.dropExample(t,_)}):n.target({key:c,accepts:"question",hovered:Ae("question"),onDrop:_=>o.dropQuestion(t,_)}),l=r==="example"?oe(a.state,t):ie(a.state,t),v=r==="example"?o.addExample:o.addQuestion;return f`<div
247
- class="card-area card-area--${r}"
248
- data-testid=${`${d.testid}-${t}`}
249
- data-drop=${String(n.isOver(c))}
250
- @dragenter=${p.dragenter}
251
- @dragover=${p.dragover}
252
- @dragleave=${p.dragleave}
253
- @drop=${p.drop}
254
- >
255
- <h3 class="area-label"><i class="tally-dot" style=${O(r)}></i>${d.label}</h3>
256
- ${F(l,_=>_.id,_=>W(e,r,_))}
257
- ${l.length===0?f`<p class="stack-hint">${d.empty}</p>`:$}
258
- <button class="add-card add-${r}" type="button" @click=${()=>v(t)}>${d.add}</button>
259
- </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}},qe=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},wt=G`
260
- /* ------------------------------------------------------------ legend */
261
-
262
- .legend {
263
- display: flex;
264
- flex-wrap: wrap;
265
- gap: 6px;
266
- margin: 0;
267
- padding: 0;
268
- list-style: none;
269
- font-size: 11.5px;
270
- color: var(--dpk-ink-soft);
271
- }
272
-
273
- /* Each entry reads as a small raised chip, matching the pill vocabulary
274
- used for the readiness / tally summary next to it. */
275
- .legend li {
276
- display: inline-flex;
277
- align-items: center;
278
- gap: 6px;
279
- padding: 4px 10px 4px 6px;
280
- border: 1px solid var(--dpk-rule);
281
- border-radius: 999px;
282
- background: var(--dpk-paper-raised);
283
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
284
- white-space: nowrap;
285
- }
286
-
287
- .legend-swatch {
288
- width: 14px;
289
- height: 11px;
290
- border-radius: 2px;
291
- background: var(--em-card-bg);
292
- box-shadow: var(--dpk-shadow-xs);
293
- }
294
-
295
- /* ------------------------------------------------------------- board */
296
-
297
- .board {
298
- display: grid;
299
- gap: 22px;
300
- align-content: start;
301
- }
302
-
303
- .story-section {
304
- position: relative;
305
- display: grid;
306
- gap: 18px;
307
- min-width: 0;
308
- padding: 20px 22px 24px;
309
- border: 1px solid var(--dpk-rule);
310
- border-radius: var(--dpk-radius-lg);
311
- background:
312
- radial-gradient(circle, var(--dpk-rule) 1px, transparent 1.2px) 0 0 / 18px 18px,
313
- var(--dpk-paper-raised);
314
- box-shadow: var(--dpk-shadow);
315
- transition: outline-color 150ms ease;
316
- }
317
-
318
- /* A quiet top edge marks the section as one grouped unit, echoing the
319
- activity band accent used elsewhere in the kit. */
320
- .story-section::before {
321
- content: '';
322
- position: absolute;
323
- top: 0;
324
- left: 0;
325
- right: 0;
326
- height: 2px;
327
- border-radius: var(--dpk-radius-lg) var(--dpk-radius-lg) 0 0;
328
- background: color-mix(in srgb, var(--dpk-accent) 45%, transparent);
329
- }
330
-
331
- .story-section[data-drop='true'] {
332
- outline: 2px dashed var(--dpk-blue);
333
- outline-offset: 4px;
334
- }
335
-
336
- /* The story heads the table: one wide card, with where it stands beside it. */
337
- .story-row {
338
- display: flex;
339
- flex-wrap: wrap;
340
- align-items: center;
341
- gap: 14px 20px;
342
- }
343
-
344
- .story-slot {
345
- width: min(420px, 100%);
346
- }
347
-
348
- .story-meta {
349
- display: flex;
350
- flex-wrap: wrap;
351
- align-items: center;
352
- gap: 6px;
353
- }
354
-
355
- .readiness {
356
- padding: 4px 11px;
357
- border-radius: 999px;
358
- font-size: 11.5px;
359
- font-weight: 650;
360
- background: var(--dpk-paper-sunken);
361
- color: var(--dpk-ink-soft);
362
- box-shadow: var(--dpk-shadow-xs);
363
- }
364
-
365
- .readiness[data-readiness='ready'] {
366
- background: var(--dpk-green-soft);
367
- color: var(--dpk-green);
368
- }
369
-
370
- .readiness[data-readiness='open-questions'],
371
- .readiness[data-readiness='too-big'] {
372
- background: var(--dpk-danger-soft);
373
- color: var(--dpk-danger);
374
- }
375
-
376
- .readiness[data-readiness='thin'] {
377
- background: var(--dpk-amber-soft);
378
- color: var(--dpk-amber);
379
- }
380
-
381
- .tally {
382
- display: inline-flex;
383
- align-items: center;
384
- gap: 5px;
385
- padding: 3px 9px;
386
- border: 1px solid var(--dpk-rule);
387
- border-radius: 999px;
388
- background: var(--dpk-paper-raised);
389
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
390
- font-family: var(--dpk-mono);
391
- font-size: 10.5px;
392
- font-variant-numeric: tabular-nums;
393
- color: var(--dpk-ink-soft);
394
- }
395
-
396
- .tally-dot {
397
- width: 8px;
398
- height: 8px;
399
- border-radius: 2px;
400
- background: var(--em-card-bg);
401
- }
402
-
403
- /* ------------------------------------------------- rules and examples */
404
-
405
- /* Rules side by side under the story; the row scrolls, never the page. */
406
- .rules-row {
407
- display: flex;
408
- align-items: flex-start;
409
- gap: 14px;
410
- min-width: 0;
411
- overflow-x: auto;
412
- padding: 4px 4px 16px;
413
- border-radius: var(--dpk-radius);
414
- }
415
-
416
- /* A fade pinned to the row's right edge says more rules are a scroll away;
417
- scrolled to the end, it rests on the empty room after the last one. */
418
- .rules-row::after {
419
- content: '';
420
- position: sticky;
421
- right: -4px;
422
- flex: 0 0 36px;
423
- align-self: stretch;
424
- margin-left: -14px;
425
- background: linear-gradient(90deg, transparent, var(--dpk-paper-raised));
426
- pointer-events: none;
427
- }
428
-
429
- .rules-row[data-drop='true'] {
430
- background: var(--dpk-blue-soft);
431
- }
432
-
433
- /* A rule and its examples read as one lane: a soft tint plus a quiet ring,
434
- so the grouping reads even where the tint thins out lower down. */
435
- .rule-col {
436
- position: relative;
437
- flex: 0 0 204px;
438
- display: grid;
439
- gap: 16px;
440
- align-content: start;
441
- padding: 10px 10px 14px;
442
- border-radius: var(--dpk-radius-lg);
443
- background: linear-gradient(
444
- 180deg,
445
- color-mix(in srgb, var(--dpk-blue) 9%, transparent),
446
- color-mix(in srgb, var(--dpk-blue) 3%, transparent) 70%,
447
- transparent
448
- );
449
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 18%, transparent);
450
- }
451
-
452
- .rule-col[data-dragging] {
453
- opacity: 0.45;
454
- }
455
-
456
- /* Examples on top, questions below: two areas, each its own drop target. */
457
- .card-area {
458
- display: grid;
459
- gap: 12px;
460
- align-content: start;
461
- min-height: 44px;
462
- padding: 8px 8px 10px;
463
- border-radius: var(--dpk-radius);
464
- box-shadow: inset 0 1px 3px var(--dpk-shade-1);
465
- }
466
-
467
- .card-area--example {
468
- background: var(--dpk-green-soft);
469
- }
470
-
471
- .card-area--question {
472
- background: var(--dpk-danger-soft);
473
- }
474
-
475
- .card-area--question dpk-internal-example-mapping-card {
476
- min-height: 56px;
477
- }
478
-
479
- .card-area[data-drop='true'] {
480
- outline: 2px dashed var(--dpk-blue);
481
- outline-offset: 2px;
482
- }
483
-
484
- .area-label {
485
- display: flex;
486
- align-items: center;
487
- gap: 6px;
488
- margin: 0;
489
- font-size: 10.5px;
490
- font-weight: 600;
491
- letter-spacing: 0.04em;
492
- color: var(--dpk-ink-soft);
493
- }
494
-
495
- .stack-hint {
496
- margin: 0;
497
- font-size: 11px;
498
- color: var(--dpk-ink-faint);
499
- text-align: center;
500
- }
501
-
502
- /* -------------------------------------------------------- add buttons */
503
-
504
- .add-card,
505
- .add-rule,
506
- .add-story {
507
- border: 1px dashed var(--dpk-rule-strong);
508
- border-radius: var(--dpk-radius-sm);
509
- background: color-mix(in srgb, var(--dpk-paper-raised) 60%, transparent);
510
- color: var(--dpk-ink-faint);
511
- font: inherit;
512
- font-size: 11.5px;
513
- cursor: pointer;
514
- transition:
515
- background 140ms var(--dpk-ease),
516
- border-color 140ms var(--dpk-ease),
517
- color 140ms var(--dpk-ease),
518
- transform 140ms var(--dpk-ease);
519
- }
520
-
521
- .add-card {
522
- padding: 6px 8px;
523
- }
524
-
525
- .add-rule {
526
- flex: 0 0 120px;
527
- display: grid;
528
- place-items: center;
529
- align-content: center;
530
- gap: 2px;
531
- min-height: 96px;
532
- }
533
-
534
- .add-plus {
535
- font-size: 18px;
536
- line-height: 1;
537
- }
538
-
539
- .add-story {
540
- justify-self: start;
541
- padding: 10px 18px;
542
- font-size: 12.5px;
543
- }
544
-
545
- .add-card:hover,
546
- .add-rule:hover,
547
- .add-story:hover {
548
- border-color: var(--dpk-blue);
549
- background: var(--dpk-blue-soft);
550
- color: var(--dpk-blue);
551
- transform: translateY(-1px);
552
- }
553
-
554
- /* The empty state is the working canvas before anything is on it: same
555
- dot-grid ground as the other templates' boards. */
556
- .empty {
557
- display: grid;
558
- gap: 10px;
559
- max-width: 620px;
560
- padding: 28px 24px;
561
- border: 1px dashed var(--dpk-rule-strong);
562
- border-radius: var(--dpk-radius-lg);
563
- background: var(--dpk-dots), var(--dpk-paper-sunken);
564
- }
565
-
566
- .empty p {
567
- margin: 0;
568
- color: var(--dpk-ink-soft);
569
- line-height: 1.7;
570
- }
571
- `,Lt={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},Mt={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class Ne extends Z{static{this.styles=[Z.styles,wt]}definitionFor(t){return ve(t)}static{this.properties={mode:{state:!0}}}#r=new Ze(this);constructor(){super(),this.mode=V}renderRegions(t){const r=C(this.locale);return{header:_t(r),main:this.#n(t,r)}}#n(t,r){return f`
572
- ${kt({context:t,mode:this.mode,drag:this.#r,m:r,handlers:{cardIntent:(a,n,o)=>this.#o(a,n,o),addStory:()=>this.#e(gt(t,r)),addRule:a=>this.#e(yt(t,r,a)),addExample:a=>this.#e(xt(t,r,a)),addQuestion:a=>this.#e(ht(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)}})}
573
- `}#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:Lt[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:Mt[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=De(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=Ie(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=Oe(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}#s(t,r){const a=this.context(),n=$e(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}}const Ue=()=>{Rt(),customElements.get("dpk-template-example-mapping")||customElements.define("dpk-template-example-mapping",Ne)},At=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:_e,DpkTemplateExampleMapping:Ne,IDLE_MODE:V,allMappingIds:de,applyExampleMappingAction:le,cardModeOf:we,cardPaletteStyle:O,defineExampleMappingElement:Ue,describeExampleMappingAction:ye,dropAfter:St,emptyExampleMappingBase:ae,exampleMappingAction:w,exampleMappingActions:u,exampleMappingBaseSchema:te,exampleMappingCommentTargets:fe,exampleMappingCurrentTarget:Te,exampleMappingDefinitionFor:ve,exampleMappingHasTarget:Se,exampleMappingMessages:C,exampleMappingTargetLabel:he,exampleMappingTitle:J,examplesOfRule:oe,findCard:L,findExample:b,findQuestion:R,findRule:y,findStory:T,modeConcerns:H,parseExampleMappingBase:re,presentStorySummary:be,questionsOfRule:ie,reduceCardIntent:Le,reorderById:ge,resolveExampleDrop:Oe,resolveExampleMappingNavigation:Re,resolveQuestionDrop:$e,resolveRuleDrop:Ie,resolveStoryDrop:De,rulesOfStory:ne,serializeExampleMappingAction:xe,storyIdOfCard:dt,storyIdOfExample:st,storyIdOfRule:se},Symbol.toStringTag,{value:"Module"}));export{Ue as d,At as i};