dev-process-kit 0.0.2-beta.0 → 0.0.2
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.
- package/README.md +32 -9
- package/dist/chunks/shared-BXV4Dm_n.js +522 -0
- package/dist/chunks/shared-C4Y4jSXa.js +27 -0
- package/dist/chunks/shared-CQlssGTf.js +692 -0
- package/dist/chunks/shared-CcD4vDCE.js +1461 -0
- package/dist/chunks/shared-D2QreyJq.js +926 -0
- package/dist/chunks/{shared-x8nRepee.js → shared-D3EKtSkd.js} +1 -1
- package/dist/chunks/shared-D6UXy-Qw.js +560 -0
- package/dist/chunks/shared-DZlREPaN.js +2537 -0
- package/dist/chunks/shared-OdGbSUTa.js +574 -0
- package/dist/chunks/shared-TjJWiz7W.js +546 -0
- package/dist/chunks/shared-utv1engQ.js +1 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -0
- package/dist/templates/usm.js +1 -1
- package/package.json +3 -2
- package/dist/chunks/shared-2miVckpm.js +0 -1
- package/dist/chunks/shared-BnsfTwLd.js +0 -544
- package/dist/chunks/shared-BynqvHTb.js +0 -2543
- package/dist/chunks/shared-ChB7-2Gr.js +0 -521
- package/dist/chunks/shared-CmlaxilP.js +0 -27
- package/dist/chunks/shared-CqIMLfTL.js +0 -921
- package/dist/chunks/shared-DNlbjLwV.js +0 -1
- package/dist/chunks/shared-DoMzW1K-.js +0 -577
- package/dist/chunks/shared-DyXC39rU.js +0 -629
- package/dist/chunks/shared-z875TnWr.js +0 -1322
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
import{q as u,al as m,v as A,as as I,ar as R,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 $,a1 as h,A as Ve,K as ze,i as Be,a2 as V,T as W}from"./shared-z875TnWr.js";import{s as z,D as Ke}from"./shared-BFAVBf4I.js";import{P as je,r as Fe,p as He}from"./shared-CmlaxilP.js";import{o as Je}from"./shared-2miVckpm.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:R(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:R(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:R(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:R(d())}),{dedupeKey:A}),DELETE_QUESTION:u("DELETE_QUESTION","question",m({}))},k={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:R(d())}),Ze=L({id:I,storyId:f(d(),x(1)),name:f(d(),x(1)),description:R(d())}),Z=L({id:I,ruleId:f(d(),x(1)),name:f(d(),x(1)),description:R(d())}),G=L({title:R(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)},b=(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=b(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??b(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=b(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=b(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 b(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(b(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${b(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=b(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}},be={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=>k.addStory(t,"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC")),st=(e,t)=>X(e,"new-rule",r=>k.addRule(t,r,"\u65B0\u3057\u3044\u30EB\u30FC\u30EB")),dt=(e,t)=>X(e,"new-example",r=>k.addExample(t,r,"\u65B0\u3057\u3044\u5177\u4F53\u4F8B")),lt=(e,t)=>X(e,"new-question",r=>k.addQuestion(t,r,"\u65B0\u3057\u3044\u8CEA\u554F")),pt={width:300,height:260},Re=["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 $;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>`:$}
|
|
149
|
-
${this.notes.length>0?h`<span class="card-flag">${this.notes.length}</span>`:$}
|
|
150
|
-
<div class="card-tools">
|
|
151
|
-
<button
|
|
152
|
-
class="dpk-icon-btn"
|
|
153
|
-
type="button"
|
|
154
|
-
data-role="comment"
|
|
155
|
-
aria-label="コメント"
|
|
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):$}
|
|
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)||!b(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,$e=(e,t)=>F(e,t)&&(e.kind==="editing"||e.kind==="commenting")?e.kind:"view",ke=(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
|
-
${Re.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=${$e(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>`:$}
|
|
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, rgba(20, 28, 44, 0.07) 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: rgba(214, 53, 80, 0.1);
|
|
348
|
-
color: #b81c33;
|
|
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: rgba(74, 163, 94, 0.08);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.card-area--question {
|
|
424
|
-
background: rgba(214, 53, 80, 0.06);
|
|
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: rgba(255, 255, 255, 0.6);
|
|
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"},bt={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class Ne extends W{constructor(){super(),this.definition=be,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:bt[r],target:{type:r,id:t},payload:{}}),a.navigation.card===t&&a.navigate({card:null});break}this.mode=ke(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)},Rt=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:Re,CARD_KIND_LABELS:j,DpkTemplateExampleMapping:Ne,IDLE_MODE:Y,allMappingIds:oe,applyExampleMappingAction:se,cardModeOf:$e,cardPaletteStyle:D,defineExampleMappingElement:we,describeExampleMappingAction:Ee,dropAfter:M,emptyExampleMappingBase:te,exampleMappingAction:k,exampleMappingActions:c,exampleMappingBaseSchema:G,exampleMappingCommentTargets:fe,exampleMappingCurrentTarget:xe,exampleMappingDefinition:be,exampleMappingHasTarget:_e,exampleMappingTargetLabel:ye,exampleMappingTitle:K,examplesOfRule:ne,findCard:q,findExample:_,findQuestion:b,findRule:g,findStory:S,modeConcerns:F,parseExampleMappingBase:ee,presentStorySummary:he,questionsOfRule:ae,reduceCardIntent:ke,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,Rt as i};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import{a0 as lt,a1 as K}from"./shared-z875TnWr.js";const I=Math.min,S=Math.max,Q=Math.round,Z=Math.floor,$=t=>({x:t,y:t}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"};function Nt(t,e,o){return S(t,I(e,o))}function U(t,e){return typeof t=="function"?t(e):t}function _(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function xt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}function k(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vt(t){return xt(k(t))}function Vt(t,e,o){o===void 0&&(o=!1);const n=Y(t),i=vt(t),s=bt(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function _t(t){const e=tt(t);return[at(t),e,at(e)]}function at(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Rt=["left","right"],Ct=["right","left"],Ht=["top","bottom"],Bt=["bottom","top"];function zt(t,e,o){switch(t){case"top":case"bottom":return o?e?Ct:Rt:e?Rt:Ct;case"left":case"right":return e?Ht:Bt;default:return[]}}function It(t,e,o,n){const i=Y(t);let s=zt(_(t),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(at)))),s}function tt(t){const e=_(t);return Wt[e]+t.slice(e.length)}function Xt(t){var e,o,n,i;return{top:(e=t.top)!=null?e:0,right:(o=t.right)!=null?o:0,bottom:(n=t.bottom)!=null?n:0,left:(i=t.left)!=null?i:0}}function jt(t){return typeof t!="number"?Xt(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function At(t,e,o){let{reference:n,floating:i}=t;const s=k(e),r=vt(e),c=bt(r),l=_(e),a=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[c]/2-i[c]/2;let d;switch(l){case"top":d={x:f,y:n.y-i.height};break;case"bottom":d={x:f,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:u};break;case"left":d={x:n.x-i.width,y:u};break;default:d={x:n.x,y:n.y}}const p=Y(e);return p&&(d[r]+=h*(p==="end"?1:-1)*(o&&a?-1:1)),d}async function qt(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:d=0}=U(e,t),p=jt(d),w=c[h?u==="floating"?"reference":"floating":u],m=et(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),y=u==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},C=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:x,strategy:l}):y);return{top:(m.top-C.top+p.top)/b.y,bottom:(C.bottom-m.bottom+p.bottom)/b.y,left:(m.left-C.left+p.left)/b.x,right:(C.right-m.right+p.right)/b.x}}const Kt=50,Ut=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=r.detectOverflow?r:{...r,detectOverflow:qt},l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=At(a,n,l),h=n,d=0;const p={};for(let g=0;g<s.length;g++){const w=s[g];if(!w)continue;const{name:m,fn:y}=w,{x,y:b,data:C,reset:v}=await y({x:f,y:u,initialPlacement:n,placement:h,strategy:i,middlewareData:p,rects:a,platform:c,elements:{reference:t,floating:e}});f=x??f,u=b??u,p[m]={...p[m],...C},v&&d<Kt&&(d++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(a=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=At(a,h,l)),g=-1)}return{x:f,y:u,placement:h,strategy:i,middlewareData:p}},Yt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...w}=U(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=_(i),y=k(c),x=_(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=h||(x||!g?[tt(c)]:_t(c)),v=p!=="none";!h&&v&&C.push(...It(c,g,p,b));const P=[c,...C],T=await l.detectOverflow(e,w),W=[];let O=((n=s.flip)==null?void 0:n.overflows)||[];if(f&&W.push(T[m]),u){const N=Vt(i,r,b);W.push(T[N[0]],T[N[1]])}if(O=[...O,{placement:i,overflows:W}],!W.every(N=>N<=0)){var gt,wt;const N=(((gt=s.flip)==null?void 0:gt.index)||0)+1,ct=P[N];if(ct&&(!(u==="alignment"?y!==k(ct):!1)||O.every(A=>k(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:N,overflows:O},reset:{placement:ct}};let q=(wt=O.filter(V=>V.overflows[0]<=0).sort((V,A)=>V.overflows[1]-A.overflows[1])[0])==null?void 0:wt.placement;if(!q)switch(d){case"bestFit":{var yt;const V=(yt=O.filter(A=>{if(v){const M=k(A.placement);return M===y||M==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(M=>M>0).reduce((M,Ft)=>M+Ft,0)]).sort((A,M)=>A[1]-M[1])[0])==null?void 0:yt[0];V&&(q=V);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}},Gt=new Set(["left","top"]);async function Jt(t,e){const{placement:o,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=_(o),c=Y(o),l=k(o)==="y",a=Gt.has(r)?-1:1,f=s&&l?-1:1,u=U(e,t);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),l?{x:d*f,y:h*a}:{x:h*a,y:d*f}}const Qt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=e,l=await Jt(e,t);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},Zt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...a}=U(t,e),f={x:o,y:n},u=await s.detectOverflow(e,a),h=k(i),d=xt(h);let p=f[d],g=f[h];const w=(y,x)=>Nt(x+u[y==="y"?"top":"left"],x,x-u[y==="y"?"bottom":"right"]);r&&(p=w(d,p)),c&&(g=w(h,g));const m=l.fn({...e,[d]:p,[h]:g});return{...m,data:{x:m.x-o,y:m.y-n,enabled:{[d]:r,[h]:c}}}}}},te=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:o,rects:n,platform:i,elements:s}=e,{apply:r=()=>{},...c}=U(t,e),l=await i.detectOverflow(e,c),a=_(o),f=Y(o),u=k(o)==="y",{width:h,height:d}=n.floating;let p,g;a==="top"||a==="bottom"?(p=a,g=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=a,p=f==="end"?"top":"bottom");const w=d-l.top-l.bottom,m=h-l.left-l.right,y=I(d-l[p],w),x=I(h-l[g],m),b=e.middlewareData.shift,C=!b;let v=y,P=x;b!=null&&b.enabled.x&&(P=m),b!=null&&b.enabled.y&&(v=w),C&&!f&&(u?P=h-2*S(l.left,l.right):v=d-2*S(l.top,l.bottom)),await r({...e,availableWidth:P,availableHeight:v});const T=await i.getDimensions(s.floating);return h!==T.width||d!==T.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function X(t){return Ot(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function D(t){var e;return(e=(Ot(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ot(t){return nt()?t instanceof Node||t instanceof R(t).Node:!1}function L(t){return nt()?t instanceof Element||t instanceof R(t).Element:!1}function F(t){return nt()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!nt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=E(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&i!=="inline"&&i!=="contents"}function ee(t){return/^(table|td|th)$/.test(X(t))}function it(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const ne=/transform|translate|scale|rotate|perspective|filter/,oe=/paint|layout|strict|content/,H=t=>!!t&&t!=="none";let ft;function ut(t){const e=L(t)?E(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!dt()&&(H(e.backdropFilter)||H(e.filter))||ne.test(e.willChange||"")||oe.test(e.contain||"")}function ie(t){let e=B(t);for(;F(e)&&!G(e);){if(ut(e))return e;if(it(e))return null;e=B(e)}return null}function dt(){return ft==null&&(ft=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ft}function G(t){return/^(html|body|#document)$/.test(X(t))}function E(t){return R(t).getComputedStyle(t)}function st(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(X(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||D(t);return Lt(e)?e.host:e}function Et(t){const e=B(t);return G(e)?(t.ownerDocument||t).body:F(e)&&ot(e)?e:Et(e)}function J(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=Et(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),r=R(i);if(s){const c=ht(r);return e.concat(r,r.visualViewport||[],ot(i)?i:[],c&&o?J(c):[])}else return e.concat(i,J(i,[],o))}function ht(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tt(t){const e=E(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=F(t),s=i?t.offsetWidth:o,r=i?t.offsetHeight:n,c=Q(o)!==s||Q(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function pt(t){return L(t)?t:t.contextElement}function j(t){const e=pt(t);if(!F(e))return $(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:s}=Tt(e);let r=(s?Q(o.width):o.width)/n,c=(s?Q(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const se=$(0);function St(t){const e=R(t);return!dt()||!e.visualViewport?se:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function re(t,e,o){return e===void 0&&(e=!1),!!o&&e&&o===R(t)}function z(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),s=pt(t);let r=$(1);e&&(n?L(n)&&(r=j(n)):r=j(t));const c=re(s,o,n)?St(s):$(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,f=i.width/r.x,u=i.height/r.y;if(s&&n){const h=R(s),d=L(n)?R(n):n;let p=h,g=ht(p);for(;g&&d!==p;){const w=j(g),m=g.getBoundingClientRect(),y=E(g),x=m.left+(g.clientLeft+parseFloat(y.paddingLeft))*w.x,b=m.top+(g.clientTop+parseFloat(y.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,u*=w.y,l+=x,a+=b,p=R(g),g=ht(p)}}return et({width:f,height:u,x:l,y:a})}function rt(t,e){const o=st(t).scrollLeft;return e?e.left+o:z(D(t)).left+o}function $t(t,e){const o=t.getBoundingClientRect(),n=o.left+e.scrollLeft-rt(t,o),i=o.top+e.scrollTop;return{x:n,y:i}}function ce(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const s=i==="fixed",r=D(n),c=e?it(e.floating):!1;if(n===r||c&&s)return o;let l={scrollLeft:0,scrollTop:0},a=$(1);const f=$(0),u=F(n);if((u||!s)&&((X(n)!=="body"||ot(r))&&(l=st(n)),u)){const d=z(n);a=j(n),f.x=d.x+n.clientLeft,f.y=d.y+n.clientTop}const h=r&&!u&&!s?$t(r,l):$(0);return{width:o.width*a.x,height:o.height*a.y,x:o.x*a.x-l.scrollLeft*a.x+f.x+h.x,y:o.y*a.y-l.scrollTop*a.y+f.y+h.y}}function le(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function ae(t){const e=st(t),o=t.ownerDocument.body,n=S(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=S(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-e.scrollLeft+rt(t);const r=-e.scrollTop;return E(o).direction==="rtl"&&(s+=S(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:s,y:r}}const fe=25;function ue(t,e,o){o===void 0&&(o="viewport");const n=o==="layoutViewport",i=R(t),s=D(t),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,f=0;if(r){const h=!dt()||e==="fixed";n?h||(a=-r.offsetLeft,f=-r.offsetTop):(c=r.width,l=r.height,h&&(a=r.offsetLeft,f=r.offsetTop))}if(rt(s)<=0){const h=s.ownerDocument,d=h.body,p=getComputedStyle(d),g=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,w=Math.abs(s.clientWidth-d.clientWidth-g),m=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;m<=fe&&(c-=m)}return{width:c,height:l,x:a,y:f}}function de(t,e){const o=z(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,s=j(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,a=n*s.y;return{width:r,height:c,x:l,y:a}}function kt(t,e,o){let n;if(e==="viewport"||e==="layoutViewport")n=ue(t,o,e);else if(e==="document")n=ae(D(t));else if(L(e))n=de(e,o);else{const i=St(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return et(n)}function he(t,e){const o=e.get(t);if(o)return o;let n=J(t,[],!1).filter(c=>L(c)&&X(c)!=="body"),i=null;const s=E(t).position==="fixed";let r=s?B(t):t;for(;L(r)&&!G(r);){const c=E(r),l=ut(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?n=n.filter(u=>u!==r):i=c,r=B(r)}return e.set(t,n),n}function pe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const r=[...o==="clippingAncestors"?it(e)?[]:he(e,this._c):[].concat(o),n],c=kt(e,r[0],i);let l=c.top,a=c.right,f=c.bottom,u=c.left;for(let h=1;h<r.length;h++){const d=kt(e,r[h],i);l=S(d.top,l),a=I(d.right,a),f=I(d.bottom,f),u=S(d.left,u)}return{width:a-u,height:f-l,x:u,y:l}}function me(t){const{width:e,height:o}=Tt(t);return{width:e,height:o}}function ge(t,e,o){const n=F(e),i=D(e),s=o==="fixed",r=z(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=$(0);if((n||!s)&&((X(e)!=="body"||ot(i))&&(c=st(e)),n)){const h=z(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!n&&i&&(l.x=rt(i));const a=i&&!n&&!s?$t(i,c):$(0),f=r.left+c.scrollLeft-l.x-a.x,u=r.top+c.scrollTop-l.y-a.y;return{x:f,y:u,width:r.width,height:r.height}}function mt(t){return E(t).position==="static"}function Dt(t,e){if(!F(t)||E(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return D(t)===o&&(o=o.ownerDocument.body),o}function Pt(t,e){const o=R(t);if(it(t))return o;if(!F(t)){let i=B(t);for(;i&&!G(i);){if(L(i)&&!mt(i))return i;i=B(i)}return o}let n=Dt(t,e);for(;n&&ee(n)&&mt(n);)n=Dt(n,e);return n&&G(n)&&mt(n)&&!ut(n)?o:n||ie(t)||o}const we=async function(t){const e=this.getOffsetParent||Pt,o=this.getDimensions,n=await o(t.floating);return{reference:ge(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ye(t){return E(t).direction==="rtl"}const xe={convertOffsetParentRelativeRectToViewportRelativeRect:ce,getDocumentElement:D,getClippingRect:pe,getOffsetParent:Pt,getElementRects:we,getClientRects:le,getDimensions:me,getScale:j,isElement:L,isRTL:ye};function Mt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function be(t,e,o){let n=null,i;const s=D(t);function r(){var f;clearTimeout(i),(f=n)==null||f.disconnect(),n=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),r();const h=t.getBoundingClientRect(),{left:d,top:p,width:g,height:w}=h;if(f||e(),!g||!w)return;const m=Z(p),y=Z(s.clientWidth-(d+g)),x=Z(s.clientHeight-(p+w)),b=Z(d),v={rootMargin:-m+"px "+-y+"px "+-x+"px "+-b+"px",threshold:S(0,I(1,u))||1};let P=!0;function T(W){const O=W[0].intersectionRatio;if(!Mt(h,t.getBoundingClientRect()))return c();if(O!==u){if(!P)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}P=!1}try{n=new IntersectionObserver(T,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(T,v)}n.observe(t)}const l=R(t),a=()=>c(o);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function ve(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,a=pt(t),f=i||s?[...a?J(a):[],...e?J(e):[]]:[];f.forEach(m=>{i&&m.addEventListener("scroll",o),s&&m.addEventListener("resize",o)});const u=a&&c?be(a,o,s):null;let h=-1,d=null;r&&(d=new ResizeObserver(m=>{let[y]=m;y&&y.target===a&&d&&e&&(d.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),o()}),a&&!l&&d.observe(a),e&&d.observe(e));let p,g=l?z(t):null;l&&w();function w(){const m=z(t);g&&!Mt(g,m)&&o(),g=m,p=requestAnimationFrame(w)}return o(),()=>{var m;f.forEach(y=>{i&&y.removeEventListener("scroll",o),s&&y.removeEventListener("resize",o)}),u?.(),(m=d)==null||m.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const Re=Qt,Ce=Zt,Ae=Yt,Oe=te,Le=(t,e,o)=>{const n=new Map,i=o??{},s={...xe,...i.platform,_c:n};return Ut(t,e,{...i,platform:s})},Ee=(t,e)=>({top:e,bottom:e,right:t}),Te=(t,e,o,n={})=>{if(typeof t.showPopover!="function")return()=>{};try{t.showPopover()}catch{return()=>{}}let i=!0,s=0;const r=e instanceof Element?e:{getBoundingClientRect:()=>({x:e.right,y:e.top,left:e.right,right:e.right,top:e.top,bottom:e.bottom,width:0,height:e.bottom-e.top})};t.style.width=`${o.width}px`,t.style.maxHeight=`${o.height}px`;const l=ve(r,t,()=>{const a=++s;Le(r,t,{strategy:"fixed",placement:n.placement??"bottom-end",middleware:[Re(8),Ae({padding:8,fallbackAxisSideDirection:"end"}),Ce({padding:8}),Oe({padding:8,apply:({availableWidth:f,availableHeight:u})=>{!i||a!==s||(t.style.width=`${Math.max(0,Math.min(o.width,f))}px`,t.style.maxHeight=`${Math.max(0,Math.min(o.height,u))}px`)}})]}).then(({x:f,y:u})=>{!i||a!==s||!t.isConnected||(t.style.left=`${f}px`,t.style.top=`${u}px`)}).catch(()=>{})},{animationFrame:n.trackTransform??!1,elementResize:typeof ResizeObserver<"u",layoutShift:typeof IntersectionObserver<"u"});return()=>{i=!1,l()}};class Se{#e;#t=new Map;constructor(e){this.#e=e,e.addController(this)}hostConnected(){this.#e.requestUpdate()}hostUpdated(){for(const[e,o]of this.#t)e.isConnected||(o(),this.#t.delete(e))}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}open(e,o,n,i){this.#t.get(e)?.(),this.#t.set(e,Te(e,o,n,i))}}const $e=(t,e,o={})=>({body:t,notes:e,submission:t.trim()||null,label:o.label??null,error:o.error??null}),ke=(t,e)=>{const o=()=>{t.submission!==null&&e({kind:"comment",body:t.submission})};return K`<div
|
|
2
|
-
class="comment-pop"
|
|
3
|
-
popover="manual"
|
|
4
|
-
role="dialog"
|
|
5
|
-
aria-label=${t.label?`${t.label}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`:"\u30B3\u30E1\u30F3\u30C8"}
|
|
6
|
-
@click=${n=>n.stopPropagation()}
|
|
7
|
-
@keydown=${n=>{n.isComposing||n.key!=="Escape"||(n.preventDefault(),n.stopPropagation(),e({kind:"dismiss"}))}}
|
|
8
|
-
>
|
|
9
|
-
${t.label?K`<strong class="comment-target">${t.label}</strong>`:lt}
|
|
10
|
-
${t.error?K`<p class="comment-error" role="alert">${t.error}</p>`:lt}
|
|
11
|
-
${t.notes.length?K`<ul class="comment-list">
|
|
12
|
-
${t.notes.map(n=>K`<li>${n}</li>`)}
|
|
13
|
-
</ul>`:lt}
|
|
14
|
-
<textarea
|
|
15
|
-
class="dpk-textarea"
|
|
16
|
-
aria-label="コメント"
|
|
17
|
-
.value=${t.body}
|
|
18
|
-
@input=${n=>{n.currentTarget instanceof HTMLTextAreaElement&&e({kind:"input",body:n.currentTarget.value})}}
|
|
19
|
-
@keydown=${n=>{n.isComposing||n.key==="Enter"&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),o())}}
|
|
20
|
-
></textarea>
|
|
21
|
-
<div class="pop-actions">
|
|
22
|
-
<button class="dpk-btn dpk-btn--accent" type="button" ?disabled=${t.submission===null} @click=${o}>
|
|
23
|
-
送信
|
|
24
|
-
</button>
|
|
25
|
-
<button class="dpk-btn" type="button" @click=${()=>e({kind:"dismiss"})}>キャンセル</button>
|
|
26
|
-
</div>
|
|
27
|
-
</div>`};export{Se as P,Ee as a,$e as p,ke as r};
|