dev-process-kit 0.0.2-beta.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +22 -9
  2. package/dist/chunks/shared-B2K3LoOU.js +1016 -0
  3. package/dist/chunks/shared-BqW3KAJ4.js +613 -0
  4. package/dist/chunks/shared-Byv6cc0r.js +2779 -0
  5. package/dist/chunks/{shared-CmM4cgd6.js → shared-CKG_SQh5.js} +1 -1
  6. package/dist/chunks/shared-CPAT0Cgk.js +29 -0
  7. package/dist/chunks/shared-CwbzACTe.js +1874 -0
  8. package/dist/chunks/shared-DBDgdVsd.js +1 -0
  9. package/dist/chunks/shared-DMlMTd3c.js +1018 -0
  10. package/dist/chunks/shared-DaoPCw6-.js +556 -0
  11. package/dist/chunks/shared-DqB_TR20.js +1599 -0
  12. package/dist/chunks/shared-DsVxrO_3.js +609 -0
  13. package/dist/chunks/shared-iQIywbRc.js +676 -0
  14. package/dist/chunks/shared-xrCdgpNS.js +1 -0
  15. package/dist/components.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/templates/event-storming.js +1 -1
  18. package/dist/templates/example-mapping.js +1 -1
  19. package/dist/templates/grill.js +1 -1
  20. package/dist/templates/plain.js +1 -1
  21. package/dist/templates/prototype.js +1 -1
  22. package/dist/templates/slides.js +1 -0
  23. package/dist/templates/task-board.js +1 -0
  24. package/dist/templates/usm.js +1 -1
  25. package/package.json +4 -2
  26. package/dist/chunks/shared-5C6fORCL.js +0 -1404
  27. package/dist/chunks/shared-B1lFGiYZ.js +0 -1
  28. package/dist/chunks/shared-BEjjbZ0X.js +0 -2543
  29. package/dist/chunks/shared-BFAVBf4I.js +0 -1
  30. package/dist/chunks/shared-BybvAQye.js +0 -579
  31. package/dist/chunks/shared-DKxAm7wL.js +0 -27
  32. package/dist/chunks/shared-DgusMFKr.js +0 -1
  33. package/dist/chunks/shared-Dx0MEuAf.js +0 -921
  34. package/dist/chunks/shared-RclF4vSf.js +0 -692
  35. package/dist/chunks/shared-ao1beBgL.js +0 -544
  36. package/dist/chunks/shared-eiZoh1aF.js +0 -521
@@ -1,521 +0,0 @@
1
- import{q as u,al as m,v as A,as as I,ar as b,ab as d,ad as f,ae as x,aq as v,a7 as qe,a8 as L,a9 as N,aa as w,P as Ue,f as Pe,V as O,R as E,m as Qe,$ as J,a4 as Ce,k as Xe,_ as Ye,a0 as k,a1 as h,A as Ve,K as ze,i as Be,a2 as V,T as W}from"./shared-5C6fORCL.js";import{s as z,D as Ke}from"./shared-BFAVBf4I.js";import{P as je,r as Fe,p as He}from"./shared-DKxAm7wL.js";import{o as Je}from"./shared-DgusMFKr.js";const c={SET_STORY_NAME:u("SET_STORY_NAME","story",m({name:f(d(),x(1))})),SET_STORY_DESCRIPTION:u("SET_STORY_DESCRIPTION","story",m({description:d()})),REORDER_STORY:u("REORDER_STORY","story",m({after:v(d())}),{mode:"sequence"}),ADD_STORY:u("ADD_STORY","page",m({id:I,name:f(d(),x(1)),description:b(d())}),{dedupeKey:A}),DELETE_STORY:u("DELETE_STORY","story",m({})),SET_RULE_NAME:u("SET_RULE_NAME","rule",m({name:f(d(),x(1))})),SET_RULE_DESCRIPTION:u("SET_RULE_DESCRIPTION","rule",m({description:d()})),MOVE_RULE:u("MOVE_RULE","rule",m({storyId:f(d(),x(1)),after:v(d())}),{mode:"sequence"}),REORDER_RULE:u("REORDER_RULE","rule",m({after:v(d())}),{mode:"sequence"}),ADD_RULE:u("ADD_RULE","story",m({id:I,name:f(d(),x(1)),description:b(d())}),{dedupeKey:A}),DELETE_RULE:u("DELETE_RULE","rule",m({})),SET_EXAMPLE_NAME:u("SET_EXAMPLE_NAME","example",m({name:f(d(),x(1))})),SET_EXAMPLE_DESCRIPTION:u("SET_EXAMPLE_DESCRIPTION","example",m({description:d()})),MOVE_EXAMPLE:u("MOVE_EXAMPLE","example",m({ruleId:f(d(),x(1)),after:v(d())}),{mode:"sequence"}),REORDER_EXAMPLE:u("REORDER_EXAMPLE","example",m({after:v(d())}),{mode:"sequence"}),ADD_EXAMPLE:u("ADD_EXAMPLE","rule",m({id:I,name:f(d(),x(1)),description:b(d())}),{dedupeKey:A}),DELETE_EXAMPLE:u("DELETE_EXAMPLE","example",m({})),SET_QUESTION_NAME:u("SET_QUESTION_NAME","question",m({name:f(d(),x(1))})),SET_QUESTION_DESCRIPTION:u("SET_QUESTION_DESCRIPTION","question",m({description:d()})),MOVE_QUESTION:u("MOVE_QUESTION","question",m({ruleId:f(d(),x(1)),after:v(d())}),{mode:"sequence"}),REORDER_QUESTION:u("REORDER_QUESTION","question",m({after:v(d())}),{mode:"sequence"}),ADD_QUESTION:u("ADD_QUESTION","rule",m({id:I,name:f(d(),x(1)),description:b(d())}),{dedupeKey:A}),DELETE_QUESTION:u("DELETE_QUESTION","question",m({}))},$={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:{}})},We=L({id:I,name:f(d(),x(1)),description:b(d())}),Ze=L({id:I,storyId:f(d(),x(1)),name:f(d(),x(1)),description:b(d())}),Z=L({id:I,ruleId:f(d(),x(1)),name:f(d(),x(1)),description:b(d())}),G=L({title:b(d()),stories:N(w(We),[]),rules:N(w(Ze),[]),examples:N(w(Z),[]),questions:N(w(Z),[])}),ee=e=>{const t=qe(G,e),r=new Set,n=(i,s)=>{if(r.has(s))throw new Error(`duplicate id "${s}" in ${i}`);r.add(s)},a=new Set(t.stories.map(i=>i.id));for(const i of t.stories)n("stories",i.id);for(const i of t.rules)if(n("rules",i.id),!a.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(n("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(n("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},te=()=>({stories:[],rules:[],examples:[],questions:[]}),Ge=e=>({...e,rules:z(e.rules,["storyId"]),examples:z(e.examples,["ruleId"]),questions:z(e.questions,["ruleId"])}),S=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},g=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},_=(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)},q=(e,t)=>{if(t===void 0)return;const r=S(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const n=g(e,t);if(n)return{kind:"rule",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const a=_(e,t);if(a)return{kind:"example",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},re=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),ae=(e,t)=>e.questions.filter(r=>r.ruleId===t),et=(e,t)=>{if(S(e,t))return t;const r=g(e,t);if(r)return r.storyId;const n=_(e,t)?.ruleId??R(e,t)?.ruleId;return n===void 0?void 0:g(e,n)?.storyId},oe=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)],ie=(e,t)=>g(e,t)?.storyId,tt=(e,t)=>{const r=_(e,t);return r?ie(e,r.ruleId):void 0},se=(e,t)=>{const r=Ue(c,t);if(r===null)return null;const n=r.target.id;switch(r.type){case"SET_STORY_NAME":return de(e,n,a=>({...a,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return de(e,n,a=>({...a,description:r.payload.description}));case"REORDER_STORY":{const a=me(e.stories,n,r.payload.after);return a===null?null:{...e,stories:a}}case"ADD_STORY":{const a=r.payload;return e.stories.some(o=>o.id===a.id)?e:U(e,a.id)?null:{...e,stories:[...e.stories,{id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===n))return null;const a=new Set(e.rules.filter(o=>o.storyId===n).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==n),rules:e.rules.filter(o=>o.storyId!==n),examples:e.examples.filter(o=>!a.has(o.ruleId)),questions:e.questions.filter(o=>!a.has(o.ruleId))}}case"SET_RULE_NAME":return le(e,n,a=>({...a,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return le(e,n,a=>({...a,description:r.payload.description}));case"MOVE_RULE":{const a=r.payload,o=g(e,n);if(!o||!e.stories.some(s=>s.id===a.storyId))return null;const i=e.rules.filter(s=>s.storyId===a.storyId&&s.id!==n);return a.after!==null&&!i.some(s=>s.id===a.after)?null:{...e,rules:ue(e.rules,{...o,storyId:a.storyId},a.after)}}case"REORDER_RULE":{const a=g(e,n);if(!a)return null;const o=e.rules.filter(i=>i.storyId===a.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:ue(e.rules,a,r.payload.after)}}case"ADD_RULE":{const a=r.payload,o=S(e,n);return o?e.rules.some(i=>i.id===a.id)?e:U(e,a.id)?null:{...e,rules:[...e.rules,{id:a.id,storyId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_RULE":return g(e,n)?{...e,rules:e.rules.filter(a=>a.id!==n),examples:e.examples.filter(a=>a.ruleId!==n),questions:e.questions.filter(a=>a.ruleId!==n)}:null;case"SET_EXAMPLE_NAME":return pe(e,n,a=>({...a,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return pe(e,n,a=>({...a,description:r.payload.description}));case"MOVE_EXAMPLE":{const a=r.payload,o=_(e,n);if(!o||!g(e,a.ruleId))return null;const i=e.examples.filter(s=>s.ruleId===a.ruleId&&s.id!==n);return a.after!==null&&!i.some(s=>s.id===a.after)?null:{...e,examples:P(e.examples,{...o,ruleId:a.ruleId},a.after)}}case"REORDER_EXAMPLE":{const a=_(e,n);if(!a)return null;const o=e.examples.filter(i=>i.ruleId===a.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:P(e.examples,a,r.payload.after)}}case"ADD_EXAMPLE":{const a=r.payload,o=g(e,n);return o?e.examples.some(i=>i.id===a.id)?e:U(e,a.id)?null:{...e,examples:[...e.examples,{id:a.id,ruleId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_EXAMPLE":return _(e,n)?{...e,examples:e.examples.filter(a=>a.id!==n)}:null;case"SET_QUESTION_NAME":return ce(e,n,a=>({...a,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,n,a=>({...a,description:r.payload.description}));case"MOVE_QUESTION":{const a=r.payload,o=R(e,n);if(!o||!g(e,a.ruleId))return null;const i=e.questions.filter(s=>s.ruleId===a.ruleId&&s.id!==n);return a.after!==null&&!i.some(s=>s.id===a.after)?null:{...e,questions:P(e.questions,{...o,ruleId:a.ruleId},a.after)}}case"REORDER_QUESTION":{const a=R(e,n);if(!a)return null;const o=e.questions.filter(i=>i.ruleId===a.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:P(e.questions,a,r.payload.after)}}case"ADD_QUESTION":{const a=r.payload,o=g(e,n);return o?e.questions.some(i=>i.id===a.id)?e:U(e,a.id)?null:{...e,questions:[...e.questions,{id:a.id,ruleId:o.id,name:a.name,...a.description===void 0?{}:{description:a.description}}]}:null}case"DELETE_QUESTION":return R(e,n)?{...e,questions:e.questions.filter(a=>a.id!==n)}:null;default:return Pe(r)}},U=(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),de=(e,t,r)=>e.stories.some(n=>n.id===t)?{...e,stories:e.stories.map(n=>n.id===t?r(n):n)}:null,le=(e,t,r)=>e.rules.some(n=>n.id===t)?{...e,rules:e.rules.map(n=>n.id===t?r(n):n)}:null,pe=(e,t,r)=>e.examples.some(n=>n.id===t)?{...e,examples:e.examples.map(n=>n.id===t?r(n):n)}:null,ce=(e,t,r)=>e.questions.some(n=>n.id===t)?{...e,questions:e.questions.map(n=>n.id===t?r(n):n)}:null,ue=(e,t,r)=>{const n=e.filter(p=>p.id!==t.id),a=n.filter(p=>p.storyId===t.storyId),o=r===null?[t,...a]:B(a,t,r),i=n.findIndex(p=>p.storyId===t.storyId),s=new Set(a.map(p=>p.id)),l=n.filter(p=>!s.has(p.id)),y=i<0?l.length:Math.min(i,l.length);return[...l.slice(0,y),...o,...l.slice(y)]},P=(e,t,r)=>{const n=e.filter(p=>p.id!==t.id),a=n.filter(p=>p.ruleId===t.ruleId),o=r===null?[t,...a]:B(a,t,r),i=n.findIndex(p=>p.ruleId===t.ruleId),s=new Set(a.map(p=>p.id)),l=n.filter(p=>!s.has(p.id)),y=i<0?l.length:Math.min(i,l.length);return[...l.slice(0,y),...o,...l.slice(y)]},me=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const n=e.find(o=>o.id===t);if(n===void 0)return null;const a=e.filter(o=>o.id!==t);return B(a,n,r)},B=(e,t,r)=>{const n=[...e],a=r===null?-1:n.findIndex(o=>o.id===r);return n.splice(a+1,0,t),n},Q=(e,t)=>{const r=typeof t=="string"?t:"",n=typeof e=="string"?e:void 0;return n===void 0?`\u2192 \u300C${r}\u300D`:`\u300C${n}\u300D\u2192\u300C${r}\u300D`},rt={SET_STORY_NAME:(e,t)=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",tone:"update",body:Q(S(t,e.target.id)?.name,E(c.SET_STORY_NAME,e).name??"")}),SET_STORY_DESCRIPTION:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",tone:"update",body:`\u2192 \u300C${String(E(c.SET_STORY_DESCRIPTION,e).description??"").slice(0,90)}\u300D`}),REORDER_STORY:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:C(E(c.REORDER_STORY,e).after)}),ADD_STORY:e=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${E(c.ADD_STORY,e).name??""}\u300D`}),DELETE_STORY:(e,t)=>({title:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${S(t,e.target.id)?.name??e.target.id}\u300D`}),SET_RULE_NAME:(e,t)=>({title:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",tone:"update",body:Q(g(t,e.target.id)?.name,E(c.SET_RULE_NAME,e).name??"")}),SET_RULE_DESCRIPTION:e=>({title:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",tone:"update",body:`\u2192 \u300C${String(E(c.SET_RULE_DESCRIPTION,e).description??"").slice(0,90)}\u300D`}),MOVE_RULE:(e,t)=>({title:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",tone:"move",body:`\u2192 ${S(t,String(E(c.MOVE_RULE,e).storyId))?.name??String(E(c.MOVE_RULE,e).storyId??"")}`}),REORDER_RULE:e=>({title:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:C(E(c.REORDER_RULE,e).after)}),ADD_RULE:e=>({title:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${E(c.ADD_RULE,e).name??""}\u300D`}),DELETE_RULE:(e,t)=>({title:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${g(t,e.target.id)?.name??e.target.id}\u300D`}),SET_EXAMPLE_NAME:(e,t)=>({title:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",tone:"update",body:Q(_(t,e.target.id)?.name,E(c.SET_EXAMPLE_NAME,e).name??"")}),SET_EXAMPLE_DESCRIPTION:e=>({title:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",tone:"update",body:`\u2192 \u300C${String(E(c.SET_EXAMPLE_DESCRIPTION,e).description??"").slice(0,90)}\u300D`}),MOVE_EXAMPLE:(e,t)=>({title:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",tone:"move",body:`\u2192 ${g(t,String(E(c.MOVE_EXAMPLE,e).ruleId))?.name??String(E(c.MOVE_EXAMPLE,e).ruleId??"")}`}),REORDER_EXAMPLE:e=>({title:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:C(E(c.REORDER_EXAMPLE,e).after)}),ADD_EXAMPLE:e=>({title:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${E(c.ADD_EXAMPLE,e).name??""}\u300D`}),DELETE_EXAMPLE:(e,t)=>({title:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${_(t,e.target.id)?.name??e.target.id}\u300D`}),SET_QUESTION_NAME:(e,t)=>({title:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",tone:"update",body:Q(R(t,e.target.id)?.name,E(c.SET_QUESTION_NAME,e).name??"")}),SET_QUESTION_DESCRIPTION:e=>({title:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",tone:"update",body:`\u2192 \u300C${String(E(c.SET_QUESTION_DESCRIPTION,e).description??"").slice(0,90)}\u300D`}),MOVE_QUESTION:(e,t)=>({title:"\u8CEA\u554F\u3092\u79FB\u52D5",tone:"move",body:`\u2192 ${g(t,String(E(c.MOVE_QUESTION,e).ruleId))?.name??String(E(c.MOVE_QUESTION,e).ruleId??"")}`}),REORDER_QUESTION:e=>({title:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",tone:"move",body:C(E(c.REORDER_QUESTION,e).after)}),ADD_QUESTION:e=>({title:"\u8CEA\u554F\u3092\u8FFD\u52A0",tone:"create",body:`+ \u300C${E(c.ADD_QUESTION,e).name??""}\u300D`}),DELETE_QUESTION:(e,t)=>({title:"\u8CEA\u554F\u3092\u524A\u9664",tone:"delete",body:`\u2212 \u300C${R(t,e.target.id)?.name??e.target.id}\u300D`})},C=e=>e==null?"\u2192 \u5148\u982D\u3078":`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,Ee=(e,t,r)=>{let n;try{const a=rt[e.type];n=a?a(e,r??t):{title:e.type,tone:"meta"}}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:ye(t,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ge=e=>`${e.type} ${O(e.target)} ${JSON.stringify(e.payload)}`,nt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},ye=(e,t)=>{try{switch(t.type){case"story":{const r=S(e,t.id);return r?`\u30B9\u30C8\u30FC\u30EA\u30FC \xB7 ${r.name}`:`\u30B9\u30C8\u30FC\u30EA\u30FC \xB7 ${t.id} (missing)`}case"rule":{const r=g(e,t.id);return r?`\u30EB\u30FC\u30EB \xB7 ${r.name}`:`\u30EB\u30FC\u30EB \xB7 ${t.id} (missing)`}case"example":{const r=_(e,t.id);return r?`\u5177\u4F53\u4F8B \xB7 ${r.name}`:`\u5177\u4F53\u4F8B \xB7 ${t.id} (missing)`}case"question":{const r=R(e,t.id);return r?`\u8CEA\u554F \xB7 ${r.name}`:`\u8CEA\u554F \xB7 ${t.id} (missing)`}case"page":return`\u30DE\u30C3\u30D7 \xB7 ${K(e)}`;default:return`${t.type} \xB7 ${t.id}`}}catch{return`${t.type} \xB7 ${t.id}`}},fe=(e,t)=>{const r=[{value:"page:example-mapping",label:"\u30DE\u30C3\u30D7\u5168\u4F53",group:"\u30DE\u30C3\u30D7"}];for(const n of e.stories)r.push({value:O({type:"story",id:n.id}),label:n.name,group:"\u30B9\u30C8\u30FC\u30EA\u30FC"});for(const n of e.rules){const a=S(e,n.storyId);r.push({value:O({type:"rule",id:n.id}),label:a?`${a.name} \u203A ${n.name}`:n.name,group:"\u30EB\u30FC\u30EB"})}for(const n of e.examples){const a=g(e,n.ruleId);r.push({value:O({type:"example",id:n.id}),label:a?`${a.name} \u203A ${n.name}`:n.name,group:"\u5177\u4F53\u4F8B"})}for(const n of e.questions){const a=g(e,n.ruleId);r.push({value:O({type:"question",id:n.id}),label:a?`${a.name} \u203A ${n.name}`:n.name,group:"\u8CEA\u554F"})}return r},xe=(e,t)=>{const r=q(e,t.card);return r?{value:O({type:r.kind,id:r.id}),label:r.name,group:nt[r.kind]}:null},at=4,ot={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"},he=(e,t)=>{const r=e.rules.filter(l=>l.storyId===t),n=new Set(r.map(l=>l.id)),a=e.examples.filter(l=>n.has(l.ruleId)),o=e.questions.filter(l=>n.has(l.ruleId)).length,i=r.some(l=>!a.some(y=>y.ruleId===l.id)),s=r.length===0?"empty":o>0?"open-questions":r.length>at?"too-big":i?"thin":"ready";return{rules:r.length,examples:a.length,questions:o,readiness:s,label:ot[s]}},K=e=>e.title??"Example Mapping",Se=(e,t)=>{const r=q(e,t.card),n={...t};return r?n.card=r.id:delete n.card,n},_e=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return q(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},Re={name:"example-mapping",label:"Example Mapping",parseBase:ee,emptyBase:te,actions:c,apply:se,canonicalState:Ge,hasTarget:_e,describe:Ee,serialize:ge,resolveNavigation:Se,commentTargets:(e,t)=>fe(e),currentTarget:(e,t)=>xe(e,t),title:K},X=(e,t,r)=>{const n=Qe(t,oe(e.state));return e.dispatch(r(n)).ok?(e.navigate({card:n}),n):null},it=e=>X(e,"new-story",t=>$.addStory(t,"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC")),st=(e,t)=>X(e,"new-rule",r=>$.addRule(t,r,"\u65B0\u3057\u3044\u30EB\u30FC\u30EB")),dt=(e,t)=>X(e,"new-example",r=>$.addExample(t,r,"\u65B0\u3057\u3044\u5177\u4F53\u4F8B")),lt=(e,t)=>X(e,"new-question",r=>$.addQuestion(t,r,"\u65B0\u3057\u3044\u8CEA\u554F")),pt={width:300,height:260},be=["story","rule","example","question"],j={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},Te={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"}},D=e=>{const{bg:t,ink:r}=Te[e];return`--em-card-bg:${t};--em-card-ink:${r}`},ct=J`
2
- :host {
3
- position: relative;
4
- display: flex;
5
- flex-direction: column;
6
- gap: 6px;
7
- box-sizing: border-box;
8
- min-height: 76px;
9
- padding: 17px 11px 11px;
10
- border-radius: 3px;
11
- background: var(--em-card-bg, var(--dpk-paper-raised));
12
- color: var(--em-card-ink, var(--dpk-ink));
13
- box-shadow:
14
- 0 1px 2px rgba(30, 24, 10, 0.14),
15
- 0 5px 10px -4px rgba(30, 24, 10, 0.24);
16
- cursor: grab;
17
- transform: rotate(var(--em-tilt, 0deg));
18
- transition:
19
- transform 180ms ease,
20
- box-shadow 180ms ease,
21
- opacity 180ms ease;
22
- }
23
-
24
- :host(:hover) {
25
- z-index: 6;
26
- transform: rotate(0deg) translateY(-2px);
27
- box-shadow:
28
- 0 2px 4px rgba(30, 24, 10, 0.16),
29
- 0 12px 22px -6px rgba(30, 24, 10, 0.3);
30
- }
31
-
32
- :host([focused]) {
33
- z-index: 5;
34
- outline: 2px solid var(--dpk-blue);
35
- outline-offset: 2px;
36
- transform: rotate(0deg);
37
- }
38
-
39
- :host([data-mode='editing']),
40
- :host([data-mode='commenting']) {
41
- z-index: 7;
42
- transform: rotate(0deg);
43
- }
44
-
45
- :host([dragging]) {
46
- opacity: 0.4;
47
- }
48
-
49
- :host([data-kind='story']) {
50
- min-height: 68px;
51
- padding: 19px 14px 13px;
52
- }
53
-
54
- /* Small, faint, top-left: readable when looked for, quiet when not. */
55
- .card-kind {
56
- position: absolute;
57
- top: 5px;
58
- left: 8px;
59
- font-family: var(--dpk-mono);
60
- font-size: 8px;
61
- font-weight: 600;
62
- letter-spacing: 0.12em;
63
- opacity: 0.5;
64
- }
65
-
66
- .card-name {
67
- min-width: 0;
68
- font-size: 13px;
69
- font-weight: 680;
70
- line-height: 1.35;
71
- letter-spacing: -0.01em;
72
- overflow-wrap: anywhere;
73
- cursor: text;
74
- }
75
-
76
- :host([data-kind='story']) .card-name {
77
- font-size: 15.5px;
78
- line-height: 1.3;
79
- }
80
-
81
- .card-text {
82
- font-size: 11.5px;
83
- line-height: 1.5;
84
- opacity: 0.72;
85
- white-space: pre-wrap;
86
- }
87
-
88
- /* Comments already left: a corner flag, readable without hover. */
89
- .card-flag {
90
- position: absolute;
91
- top: -7px;
92
- right: -7px;
93
- min-width: 17px;
94
- height: 17px;
95
- padding: 0 4px;
96
- box-sizing: border-box;
97
- border-radius: 999px;
98
- background: var(--dpk-accent);
99
- color: var(--dpk-accent-ink);
100
- font-family: var(--dpk-mono);
101
- font-size: 9.5px;
102
- font-weight: 650;
103
- line-height: 17px;
104
- text-align: center;
105
- box-shadow: 0 1px 4px rgba(217, 73, 32, 0.35);
106
- }
107
-
108
- /* A side rail of round buttons that fades in on hover, like Event Storming:
109
- nothing crosses the card's face. */
110
- .card-tools {
111
- position: absolute;
112
- top: 9px;
113
- right: -11px;
114
- z-index: 8;
115
- display: flex;
116
- flex-direction: column;
117
- gap: 3px;
118
- opacity: 0;
119
- pointer-events: none;
120
- transition: opacity 140ms ease;
121
- }
122
-
123
- :host(:hover) .card-tools,
124
- :host([data-mode='commenting']) .card-tools,
125
- .card-tools:focus-within {
126
- opacity: 1;
127
- pointer-events: auto;
128
- }
129
-
130
- .card-tools .dpk-icon-btn {
131
- width: 22px;
132
- height: 22px;
133
- border: 1px solid var(--dpk-rule);
134
- border-radius: 50%;
135
- background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
136
- box-shadow: var(--dpk-shadow-xs);
137
- }
138
- `;class ut extends Ce{static{this.styles=[Xe,ct,Ye]}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}}}#e="";#a=new je(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.#r({kind:"select"})),this.addEventListener("focusin",()=>this.draggable=!1),this.addEventListener("focusout",()=>this.draggable=!0)}updated(t){if(t.has("card")&&this.card){const{bg:a,ink:o}=Te[this.card.kind];this.setAttribute("data-kind",this.card.kind),this.style.setProperty("--em-card-bg",a),this.style.setProperty("--em-card-ink",o)}if(t.has("tilt")&&this.style.setProperty("--em-tilt",`${this.tilt}deg`),t.has("mode")&&(this.mode!=="commenting"&&(this.#e=""),this.mode==="editing"&&this.renderRoot.querySelector("dpk-component-inline-edit")?.startEditing()),this.mode!=="commenting")return;const r=this.renderRoot.querySelector(".comment-pop"),n=this.renderRoot.querySelector('[data-role="comment"]');r&&n&&this.#a.open(r,n,pt)}render(){const t=this.card;if(!t)return k;const r=j[t.kind];return h`
139
- <div class="card-kind">${r}</div>
140
- <dpk-component-inline-edit
141
- class="card-name"
142
- ?wrap=${!0}
143
- ?seamless=${!0}
144
- .value=${t.name}
145
- .label=${`${r}\u540D`}
146
- @dpk-commit=${Je(n=>this.#r({kind:"rename",name:n}))}
147
- ></dpk-component-inline-edit>
148
- ${t.description?h`<div class="card-text">${t.description}</div>`:k}
149
- ${this.notes.length>0?h`<span class="card-flag">${this.notes.length}</span>`:k}
150
- <div class="card-tools">
151
- <button
152
- class="dpk-icon-btn"
153
- type="button"
154
- data-role="comment"
155
- aria-label="コメント"
156
- data-active=${String(this.mode==="commenting")}
157
- @click=${this.#n({kind:"toggle-comment"})}
158
- >
159
- ${Ve()}
160
- </button>
161
- <button
162
- class="dpk-icon-btn"
163
- type="button"
164
- data-role="delete"
165
- aria-label="削除"
166
- @click=${this.#n({kind:"delete"})}
167
- >
168
- ${ze()}
169
- </button>
170
- </div>
171
- ${this.mode==="commenting"?this.#t(t):k}
172
- `}#t(t){return Fe(He(this.#e,this.notes.map(Be),{label:t.name}),r=>{r.kind==="input"?(this.#e=r.body,this.requestUpdate()):this.#r(r)})}#n(t){return r=>{r.stopPropagation(),this.#r(t)}}#r(t){this.onIntent?.(t)}}const mt=()=>{customElements.get("dpk-internal-example-mapping-card")||customElements.define("dpk-internal-example-mapping-card",ut)},M=(e,t,r)=>{const n=e.at(-1)??null;if(t===null||r==="end")return n;const a=e.indexOf(t);return a<0?n:r==="after"?t:a===0?null:e.at(a-1)??null},Ie=(e,t,r,n)=>{if(!S(e,t))return null;const a=e.stories.filter(o=>o.id!==t).map(o=>o.id);return{type:"REORDER_STORY",target:{type:"story",id:t},payload:{after:M(a,r,n)}}},ve=(e,t,r,n,a)=>{if(!S(e,t)||!g(e,r))return null;const o=e.rules.filter(i=>i.storyId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_RULE",target:{type:"rule",id:r},payload:{storyId:t,after:M(o,n,a)}}},Oe=(e,t,r,n,a)=>{if(!g(e,t)||!_(e,r))return null;const o=e.examples.filter(i=>i.ruleId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_EXAMPLE",target:{type:"example",id:r},payload:{ruleId:t,after:M(o,n,a)}}},De=(e,t,r,n,a)=>{if(!g(e,t)||!R(e,r))return null;const o=e.questions.filter(i=>i.ruleId===t&&i.id!==r).map(i=>i.id);return{type:"MOVE_QUESTION",target:{type:"question",id:r},payload:{ruleId:t,after:M(o,n,a)}}},Y={kind:"idle"},F=(e,t)=>e.kind!=="idle"&&e.cardId===t,ke=(e,t)=>F(e,t)&&(e.kind==="editing"||e.kind==="commenting")?e.kind:"view",$e=(e,t,r)=>{switch(r.kind){case"toggle-comment":return e.kind==="commenting"&&e.cardId===t?Y:{kind:"commenting",cardId:t};case"rename":case"comment":case"dismiss":case"delete":return F(e,t)?Y:e;case"select":return e}},Et=(e,t)=>{if(e==="story")return 0;let r=0;for(const n of t)r=r*31+n.charCodeAt(0)|0;return(Math.abs(r)%5-2)*.45},gt=()=>h`<ul class="legend" aria-label="カードの種類">
173
- ${be.map(e=>h`<li><span class="legend-swatch" style=${D(e)}></span>${j[e]}</li>`)}
174
- </ul>`,yt=e=>{const{context:t,handlers:r}=e;return t.state.stories.length===0?h`
175
- <div class="empty">
176
- <h2>ストーリーがまだありません</h2>
177
- <p>
178
- ストーリー(黄)を1枚置き、その下に受け入れ条件となるルール(青)を並べます。
179
- ルールごとに、上の欄へ具体例(緑)を、下の欄へ答えの出ない論点を質問(赤)として積みます。
180
- </p>
181
- <button class="dpk-btn dpk-btn--accent" type="button" @click=${r.addStory}>+ 最初のストーリー</button>
182
- </div>
183
- `:h`
184
- <div class="board" data-testid="example-mapping-board">
185
- ${V(t.state.stories,n=>n.id,n=>ft(e,n))}
186
- <button class="add-story" type="button" @click=${r.addStory}>+ ストーリー</button>
187
- </div>
188
- `},H=(e,t,r)=>{const{context:n,mode:a,drag:o,handlers:i}=e,s=n.comments.filter(y=>y.target.type===t&&y.target.id===r.id),l=o.source({type:t,id:r.id});return h`<dpk-internal-example-mapping-card
189
- data-card=${r.id}
190
- data-card-kind=${t}
191
- draggable="true"
192
- .card=${{kind:t,id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}}}
193
- .notes=${s}
194
- .tilt=${Et(t,r.id)}
195
- .mode=${ke(a,r.id)}
196
- .onIntent=${y=>i.cardIntent(r.id,t,y)}
197
- ?focused=${n.navigation.card===r.id}
198
- ?dragging=${o.isDragging(t,r.id)}
199
- @dragstart=${l.dragstart}
200
- @dragend=${l.dragend}
201
- ></dpk-internal-example-mapping-card>`},ft=(e,t)=>{const{context:r,drag:n,handlers:a}=e,o=he(r.state,t.id),i=`story:${t.id}`,s=n.target({key:i,accepts:"story",hovered:Le(".story-section","story"),onDrop:a.dropStory}),l=`rules:${t.id}`,y=n.target({key:l,accepts:"rule",hovered:Le(".rule-col","rule"),onDrop:p=>a.dropRule(t.id,p)});return h`
202
- <section
203
- class="story-section"
204
- data-story=${t.id}
205
- data-drop=${String(n.isOver(i))}
206
- @dragenter=${s.dragenter}
207
- @dragover=${s.dragover}
208
- @dragleave=${s.dragleave}
209
- @drop=${s.drop}
210
- >
211
- <header class="story-row">
212
- <div class="story-slot">${H(e,"story",t)}</div>
213
- <div class="story-meta">
214
- <span class="readiness" data-readiness=${o.readiness}>${o.label}</span>
215
- <span class="tally"><i class="tally-dot" style=${D("rule")}></i>ルール ${o.rules}</span>
216
- <span class="tally"
217
- ><i class="tally-dot" style=${D("example")}></i>具体例 ${o.examples}</span
218
- >
219
- <span class="tally"
220
- ><i class="tally-dot" style=${D("question")}></i>質問 ${o.questions}</span
221
- >
222
- </div>
223
- </header>
224
- <div
225
- class="rules-row"
226
- data-testid=${`rules-${t.id}`}
227
- data-drop=${String(n.isOver(l))}
228
- @dragenter=${y.dragenter}
229
- @dragover=${y.dragover}
230
- @dragleave=${y.dragleave}
231
- @drop=${y.drop}
232
- >
233
- ${V(re(r.state,t.id),p=>p.id,p=>xt(e,p))}
234
- <button class="add-rule" type="button" @click=${()=>a.addRule(t.id)}>
235
- <span class="add-plus">+</span>ルール
236
- </button>
237
- </div>
238
- </section>
239
- `},xt=(e,t)=>{const{drag:r}=e;return h`
240
- <div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
241
- ${H(e,"rule",t)} ${Me(e,t.id,"example")}
242
- ${Me(e,t.id,"question")}
243
- </div>
244
- `},ht={example:{testid:"examples",label:"\u5177\u4F53\u4F8B",empty:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",add:"\uFF0B \u5177\u4F53\u4F8B"},question:{testid:"questions",label:"\u8CEA\u554F",empty:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",add:"\uFF0B \u8CEA\u554F"}},Me=(e,t,r)=>{const{context:n,drag:a,handlers:o}=e,i=ht[r],s=`${i.testid}:${t}`,l=r==="example"?a.target({key:s,accepts:"example",hovered:Ae("example"),onDrop:T=>o.dropExample(t,T)}):a.target({key:s,accepts:"question",hovered:Ae("question"),onDrop:T=>o.dropQuestion(t,T)}),y=r==="example"?ne(n.state,t):ae(n.state,t),p=r==="example"?o.addExample:o.addQuestion;return h`<div
245
- class="card-area card-area--${r}"
246
- data-testid=${`${i.testid}-${t}`}
247
- data-drop=${String(a.isOver(s))}
248
- @dragenter=${l.dragenter}
249
- @dragover=${l.dragover}
250
- @dragleave=${l.dragleave}
251
- @drop=${l.drop}
252
- >
253
- <h3 class="area-label"><i class="tally-dot" style=${D(r)}></i>${i.label}</h3>
254
- ${V(y,T=>T.id,T=>H(e,r,T))}
255
- ${y.length===0?h`<p class="stack-hint">${i.empty}</p>`:k}
256
- <button class="add-card add-${r}" type="button" @click=${()=>p(t)}>${i.add}</button>
257
- </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}},Le=(e,t)=>r=>{const n=r.target instanceof Element?r.target.closest(e):null;return n?{id:n.getAttribute(`data-${t}`),element:n}:null},St=J`
258
- /* ------------------------------------------------------------ legend */
259
-
260
- .legend {
261
- display: flex;
262
- flex-wrap: wrap;
263
- gap: 4px 14px;
264
- margin: 0;
265
- padding: 0;
266
- list-style: none;
267
- font-size: 11.5px;
268
- color: var(--dpk-ink-soft);
269
- }
270
-
271
- .legend li {
272
- display: inline-flex;
273
- align-items: center;
274
- gap: 6px;
275
- }
276
-
277
- .legend-swatch {
278
- width: 14px;
279
- height: 11px;
280
- border-radius: 2px;
281
- background: var(--em-card-bg);
282
- box-shadow: 0 1px 2px rgba(30, 24, 10, 0.18);
283
- }
284
-
285
- /* ------------------------------------------------------------- board */
286
-
287
- .board {
288
- display: grid;
289
- gap: 22px;
290
- align-content: start;
291
- }
292
-
293
- .story-section {
294
- display: grid;
295
- gap: 18px;
296
- min-width: 0;
297
- padding: 20px 22px 24px;
298
- border: 1px solid var(--dpk-rule);
299
- border-radius: var(--dpk-radius-lg);
300
- background:
301
- radial-gradient(circle, var(--dpk-rule) 1px, transparent 1.2px) 0 0 / 18px 18px,
302
- var(--dpk-paper-raised);
303
- box-shadow: var(--dpk-shadow);
304
- transition: outline-color 150ms ease;
305
- }
306
-
307
- .story-section[data-drop='true'] {
308
- outline: 2px dashed var(--dpk-blue);
309
- outline-offset: 4px;
310
- }
311
-
312
- /* The story heads the table: one wide card, with where it stands beside it. */
313
- .story-row {
314
- display: flex;
315
- flex-wrap: wrap;
316
- align-items: center;
317
- gap: 14px 20px;
318
- }
319
-
320
- .story-slot {
321
- width: min(420px, 100%);
322
- }
323
-
324
- .story-meta {
325
- display: flex;
326
- flex-wrap: wrap;
327
- align-items: center;
328
- gap: 6px;
329
- }
330
-
331
- .readiness {
332
- padding: 4px 11px;
333
- border-radius: 999px;
334
- font-size: 11.5px;
335
- font-weight: 650;
336
- background: var(--dpk-paper-sunken);
337
- color: var(--dpk-ink-soft);
338
- }
339
-
340
- .readiness[data-readiness='ready'] {
341
- background: var(--dpk-green-soft);
342
- color: var(--dpk-green);
343
- }
344
-
345
- .readiness[data-readiness='open-questions'],
346
- .readiness[data-readiness='too-big'] {
347
- background: var(--dpk-danger-soft);
348
- color: var(--dpk-danger);
349
- }
350
-
351
- .readiness[data-readiness='thin'] {
352
- background: var(--dpk-amber-soft);
353
- color: var(--dpk-amber);
354
- }
355
-
356
- .tally {
357
- display: inline-flex;
358
- align-items: center;
359
- gap: 5px;
360
- padding: 3px 9px;
361
- border: 1px solid var(--dpk-rule);
362
- border-radius: 999px;
363
- background: var(--dpk-paper-raised);
364
- font-family: var(--dpk-mono);
365
- font-size: 10.5px;
366
- font-variant-numeric: tabular-nums;
367
- color: var(--dpk-ink-soft);
368
- }
369
-
370
- .tally-dot {
371
- width: 8px;
372
- height: 8px;
373
- border-radius: 2px;
374
- background: var(--em-card-bg);
375
- }
376
-
377
- /* ------------------------------------------------- rules and examples */
378
-
379
- /* Rules side by side under the story; the row scrolls, never the page. */
380
- .rules-row {
381
- display: flex;
382
- align-items: flex-start;
383
- gap: 14px;
384
- min-width: 0;
385
- overflow-x: auto;
386
- padding: 4px 4px 16px;
387
- border-radius: var(--dpk-radius);
388
- }
389
-
390
- .rules-row[data-drop='true'] {
391
- background: var(--dpk-blue-soft);
392
- }
393
-
394
- /* A rule and its examples read as one lane: a soft tint, no side border. */
395
- .rule-col {
396
- flex: 0 0 204px;
397
- display: grid;
398
- gap: 16px;
399
- align-content: start;
400
- padding: 10px 10px 14px;
401
- border-radius: var(--dpk-radius-lg);
402
- background: linear-gradient(180deg, rgba(51, 102, 204, 0.09), rgba(51, 102, 204, 0.03) 70%, transparent);
403
- }
404
-
405
- .rule-col[data-dragging] {
406
- opacity: 0.45;
407
- }
408
-
409
- /* Examples on top, questions below: two areas, each its own drop target. */
410
- .card-area {
411
- display: grid;
412
- gap: 12px;
413
- align-content: start;
414
- min-height: 44px;
415
- padding: 8px 8px 10px;
416
- border-radius: var(--dpk-radius);
417
- }
418
-
419
- .card-area--example {
420
- background: var(--dpk-green-soft);
421
- }
422
-
423
- .card-area--question {
424
- background: var(--dpk-danger-soft);
425
- }
426
-
427
- .card-area--question dpk-internal-example-mapping-card {
428
- min-height: 56px;
429
- }
430
-
431
- .card-area[data-drop='true'] {
432
- outline: 2px dashed var(--dpk-blue);
433
- outline-offset: 2px;
434
- }
435
-
436
- .area-label {
437
- display: flex;
438
- align-items: center;
439
- gap: 6px;
440
- margin: 0;
441
- font-size: 10.5px;
442
- font-weight: 600;
443
- letter-spacing: 0.04em;
444
- color: var(--dpk-ink-soft);
445
- }
446
-
447
- .stack-hint {
448
- margin: 0;
449
- font-size: 11px;
450
- color: var(--dpk-ink-faint);
451
- text-align: center;
452
- }
453
-
454
- /* -------------------------------------------------------- add buttons */
455
-
456
- .add-card,
457
- .add-rule,
458
- .add-story {
459
- border: 1px dashed var(--dpk-rule-strong);
460
- border-radius: var(--dpk-radius-sm);
461
- background: color-mix(in srgb, var(--dpk-paper-raised) 60%, transparent);
462
- color: var(--dpk-ink-faint);
463
- font: inherit;
464
- font-size: 11.5px;
465
- cursor: pointer;
466
- transition:
467
- background 140ms ease,
468
- border-color 140ms ease,
469
- color 140ms ease;
470
- }
471
-
472
- .add-card {
473
- padding: 6px 8px;
474
- }
475
-
476
- .add-rule {
477
- flex: 0 0 120px;
478
- display: grid;
479
- place-items: center;
480
- align-content: center;
481
- gap: 2px;
482
- min-height: 96px;
483
- }
484
-
485
- .add-plus {
486
- font-size: 18px;
487
- line-height: 1;
488
- }
489
-
490
- .add-story {
491
- justify-self: start;
492
- padding: 10px 18px;
493
- font-size: 12.5px;
494
- }
495
-
496
- .add-card:hover,
497
- .add-rule:hover,
498
- .add-story:hover {
499
- border-color: var(--dpk-blue);
500
- background: var(--dpk-blue-soft);
501
- color: var(--dpk-blue);
502
- }
503
-
504
- .empty {
505
- display: grid;
506
- gap: 10px;
507
- max-width: 620px;
508
- padding: 28px 24px;
509
- border: 1px dashed var(--dpk-rule-strong);
510
- border-radius: var(--dpk-radius-lg);
511
- background: var(--dpk-paper-raised);
512
- }
513
-
514
- .empty p {
515
- margin: 0;
516
- color: var(--dpk-ink-soft);
517
- line-height: 1.7;
518
- }
519
- `,_t={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},Rt={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class Ne extends W{constructor(){super(),this.definition=Re,this.#e=new Ke(this),this.mode=Y}static{this.styles=[W.styles,St]}static{this.properties={mode:{state:!0}}}#e;renderRegions(t){return{header:gt(),main:this.#a(t)}}#a(t){return h`
520
- ${yt({context:t,mode:this.mode,drag:this.#e,handlers:{cardIntent:(r,n,a)=>this.#n(r,n,a),addStory:()=>this.#t(it(t)),addRule:r=>this.#t(st(t,r)),addExample:r=>this.#t(dt(t,r)),addQuestion:r=>this.#t(lt(t,r)),dropStory:r=>this.#r(r),dropRule:(r,n)=>this.#o(r,n),dropExample:(r,n)=>this.#s(r,n),dropQuestion:(r,n)=>this.#d(r,n)}})}
521
- `}#t(t){t!==null&&(this.mode={kind:"editing",cardId:t})}#n(t,r,n){const a=this.context();switch(n.kind){case"select":a.navigate({card:t});break;case"rename":a.dispatch({type:_t[r],target:{type:r,id:t},payload:{name:n.name}});break;case"comment":a.dispatch({type:"comment",target:`${r}:${t}`,payload:{body:n.body}});break;case"delete":a.dispatch({type:Rt[r],target:{type:r,id:t},payload:{}}),a.navigation.card===t&&a.navigate({card:null});break}this.mode=$e(this.mode,t,n)}#r(t){const r=this.context(),n=Ie(r.state,t.item.id,t.hoveredId,t.place);n&&r.dispatch(n)}#o(t,r){const n=this.context(),a=this.#i(r.hoveredId,r.event.clientX,r.place),o=ve(n.state,t,r.item.id,r.hoveredId,a);o&&n.dispatch(o)}#i(t,r,n){if(t===null)return n;const a=this.renderRoot.querySelector(`.rule-col[data-rule="${t}"]`);if(!a)return n;const o=a.getBoundingClientRect();return r<=o.left+o.width/2?"before":"after"}#s(t,r){const n=this.context(),a=Oe(n.state,t,r.item.id,r.hoveredId,r.place);a&&n.dispatch(a)}#d(t,r){const n=this.context(),a=De(n.state,t,r.item.id,r.hoveredId,r.place);a&&n.dispatch(a)}}const we=()=>{mt(),customElements.get("dpk-template-example-mapping")||customElements.define("dpk-template-example-mapping",Ne)},bt=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:be,CARD_KIND_LABELS:j,DpkTemplateExampleMapping:Ne,IDLE_MODE:Y,allMappingIds:oe,applyExampleMappingAction:se,cardModeOf:ke,cardPaletteStyle:D,defineExampleMappingElement:we,describeExampleMappingAction:Ee,dropAfter:M,emptyExampleMappingBase:te,exampleMappingAction:$,exampleMappingActions:c,exampleMappingBaseSchema:G,exampleMappingCommentTargets:fe,exampleMappingCurrentTarget:xe,exampleMappingDefinition:Re,exampleMappingHasTarget:_e,exampleMappingTargetLabel:ye,exampleMappingTitle:K,examplesOfRule:ne,findCard:q,findExample:_,findQuestion:R,findRule:g,findStory:S,modeConcerns:F,parseExampleMappingBase:ee,presentStorySummary:he,questionsOfRule:ae,reduceCardIntent:$e,reorderById:me,resolveExampleDrop:Oe,resolveExampleMappingNavigation:Se,resolveQuestionDrop:De,resolveRuleDrop:ve,resolveStoryDrop:Ie,rulesOfStory:re,serializeExampleMappingAction:ge,storyIdOfCard:et,storyIdOfExample:tt,storyIdOfRule:ie},Symbol.toStringTag,{value:"Module"}));export{we as d,bt as i};