dev-process-kit 0.1.0 → 0.2.0
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/dist/chunks/{shared-k9bZPE_p.js → shared-Ae8HmujL.js} +1 -1
- package/dist/chunks/{shared-XXW1oBnj.js → shared-BCmqTEeQ.js} +9 -9
- package/dist/chunks/{shared-BZK_cqqQ.js → shared-BkM7jfZs.js} +43 -43
- package/dist/chunks/shared-Bo8OdTee.js +4206 -0
- package/dist/chunks/shared-C-7mxPbV.js +301 -0
- package/dist/chunks/{shared-BqvHpTHr.js → shared-C-Os1zsf.js} +12 -12
- package/dist/chunks/{shared-D6pr-dx0.js → shared-C02b6b2m.js} +1 -1
- package/dist/chunks/{shared-CqjOqXJ3.js → shared-DJruxrrR.js} +2 -2
- package/dist/chunks/{shared-BqL8W-G6.js → shared-DLdJfSN-.js} +1 -1
- package/dist/chunks/{shared-gytWODMC.js → shared-DYKbMmHn.js} +8 -8
- package/dist/chunks/{shared-DRzfRsiJ.js → shared-DbBoZvUP.js} +16 -16
- package/dist/chunks/{shared-D1W4I3eq.js → shared-DbnPOaXf.js} +387 -320
- package/dist/chunks/{shared-BDka-8DG.js → shared-DnJBtKmH.js} +246 -197
- package/dist/chunks/{shared-BWk3i0ft.js → shared-v63w_5VP.js} +1 -1
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-Bhrkz9uX.js +0 -3595
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import{p as I,au as M,ak as E,al as N,ai as $,bk as V,bl as G,bm as k,bn as W,C as J,bo as D,bp as T,V as R,bq as S,br as q,bs as m,bt as y,bu as K,bv as j,ae as Y,P as _,bw as Z,ag as Q,a0 as X,aZ as u,a2 as ee,T as te,bx as ae,aa as ie,ax as se,by as oe,bz as P,bA as w,a3 as v,J as ne,a4 as f,bB as re,bC as de,bD as pe,bE as le,A as ce,bF as he}from"./shared-DnJBtKmH.js";const be=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]],ue=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1"}]],ge=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}]],me=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"}],["path",{d:"M15 5.764v15"}],["path",{d:"M9 3.236v15"}]],fe=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"}],["path",{d:"M10 19v-3.96 3.15"}],["path",{d:"M7 19h5"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2"}]],ve=[["path",{d:"m18 13-.654-4.736a4 4 0 00-2.756-3.266l-9.163-2.9a2 2 0 00-2.017.493l-.82.819a2 2 0 00-.492 2.017l2.9 9.163a4 4 0 003.266 2.756L13 18"}],["path",{d:"M18.648 12.352a1.205 1.205 0 011.704 0l1.296 1.296a1.205 1.205 0 010 1.704l-6.296 6.296a1.205 1.205 0 01-1.704 0l-1.296-1.296a1.205 1.205 0 010-1.704z"}],["path",{d:"m3 3 6.586 6.586"}],["circle",{cx:"11",cy:"11",r:"2"}]],ke=[["path",{d:"M2 3h20"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3"}],["path",{d:"m7 21 5-5 5 5"}]],ye=[["path",{d:"M12 18v4"}],["path",{d:"M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5"}]],xe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M8 7v7"}],["path",{d:"M12 7v4"}],["path",{d:"M16 7v9"}]],Ae=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5"}]],H=E($(),V(G)),x={ADD_BOARD:I("ADD_BOARD","page",M({board:H,template:E($(),N(1)),label:E($(),N(1))}),{mode:"append"}),REMOVE_BOARD:I("REMOVE_BOARD","page",M({board:H}),{mode:"append"})},$e="## How to apply",we=(r,e)=>{const t=new Map;for(const o of e){const l=k(o.target)?.board;if(l===void 0||W(o))continue;const p=t.get(l)??{changes:0,comments:0};o.type===J?p.comments+=1:p.changes+=1,t.set(l,p)}return[`## Boards (${r.length})`,"","This page is a `<dpk-page>` holding several templates as boards. Every target ending in `@<board>` belongs to that board: apply it to the `dpk-template-*` child with that `board` attribute, against its own base JSON and action vocabulary, with the qualifier removed. `page:page` is the page as a whole.","",'`ADD_BOARD` on `page:page` asks for a new child `<dpk-template-<template> board="<board>" label="<label>">` whose base JSON is built from the actions on `@<board>`; `REMOVE_BOARD` asks to take that child out, with everything the draft says about it.',"",...r.map(o=>{const l=t.get(o.id)??{changes:0,comments:0};return`- \`${o.id}\` \u2014 ${o.label} (\`${o.definition.name}\`): ${l.changes} change(s), ${l.comments} comment(s)`}),""]},Be=(r,e)=>{const t=r.indexOf($e),o=`${e.join(`
|
|
2
|
+
`)}
|
|
3
|
+
`;return t<0?`${r}
|
|
4
|
+
${o}`:`${r.slice(0,t)}${o}${r.slice(t)}`},Oe=M({title:Q($())}),Me={schema:Z(),mode:"append",targetType:"unknown"},Ee="page",De=(r,e)=>{if(!e.has(r))return r;let t=2;for(;e.has(`${r}-${t}`);)t+=1;return`${r}-${t}`},Te=r=>{const e=r.messages,t=a=>r.catalog().find(s=>s.name===a),o=(a,s)=>{const i=a.layout.find(c=>c.id===s);if(i===void 0||!Object.hasOwn(a.boards,s))return;const n=r.boards().find(c=>c.id===s)?.definition??t(i.template);return n===void 0?void 0:{id:s,label:i.label,definition:n}},l=a=>a.layout.flatMap(s=>{const i=o(a,s.id);return i===void 0?[]:[i]}),p=(a,s)=>{const i=k(s);return i===null?null:{...i,spec:o(a,i.board)}},d=(a,s)=>({...a,target:s}),h=(a,s,i)=>({...a,boards:{...a.boards,[s]:i}}),g=(a,s)=>{const i=l(a);return i.find(n=>n.id===s[m])??i[0]},A=(a,s)=>({title:a.type==="comment"?e.comment:a.type,targetLabel:s,tone:a.type==="comment"?"comment":"meta"}),C=a=>{const s=r.base();return{title:a,layout:s.layout,boards:s.boards}},F=(a,s)=>{const i=_(x,s);if(i===null)return null;const{board:n}=i.payload,c=a.layout.some(b=>b.id===n);if(i.type==="ADD_BOARD"){const b=t(i.payload.template);if(c||b===void 0)return null;const z=b.emptyBase();return{...a,layout:[...a.layout,{id:n,template:b.name,label:i.payload.label}],boards:{...a.boards,[n]:z}}}return c?{...a,layout:a.layout.filter(b=>b.id!==n),boards:Object.fromEntries(Object.entries(a.boards).filter(([b])=>b!==n))}:null},U=a=>{const s=_(x,a);if(s===null)return A(a,e.wholePage);if(s.type==="ADD_BOARD"){const n=t(s.payload.template)?.label??s.payload.template;return{title:e.boardAdded,targetLabel:`${s.payload.label} (${n})`,tone:"create"}}const i=r.base().layout.find(n=>n.id===s.payload.board)?.label;return{title:e.boardRemoved,targetLabel:i??s.payload.board,tone:"delete"}};return{name:Ee,label:e.label,parseBase:a=>C(Y(Oe,a).title??e.untitled),emptyBase:()=>C(e.untitled),get actions(){return Object.fromEntries([...r.boards().flatMap(a=>Object.entries(a.definition.actions)),...Object.entries(x)])},actionFor:(a,s)=>{if(s===void 0||y(s))return j(x,a);const i=k(s);if(i===null)return;const n=r.boards().find(c=>c.id===i.board);return n===void 0?Me:j(n.definition.actions,a)},apply:(a,s)=>{if(y(s.target))return F(a,s);const i=p(a,s.target);if(i?.spec===void 0)return null;const n=i.spec.definition.apply(a.boards[i.board],d(s,i.target));return n===null?null:h(a,i.board,n)},canonicalState:a=>({...a,boards:Object.fromEntries(Object.entries(a.boards).map(([s,i])=>{const n=o(a,s)?.definition;return[s,n?.canonicalState?n.canonicalState(i):i]}))}),canonicalTarget:(a,s)=>{const i=p(a,s),n=i?.spec?.definition;return i===null||n?.canonicalTarget===void 0?s:K(n.canonicalTarget(a.boards[i.board],i.target),i.board)},hasTarget:(a,s)=>{if(y(s))return!0;const i=p(a,s);return i?.spec===void 0?!1:i.spec.definition.hasTarget(a.boards[i.board],i.target)},pageTargetExists:(a,s)=>y(s)||p(a,s)?.spec!==void 0,describe:(a,s,i)=>{if(y(a.target))return a.type==="comment"?A(a,e.wholePage):U(a);const n=p(s,a.target);if(n===null)return A(a,R(a.target));if(n.spec===void 0)return A(a,e.missingBoard(n.board));const c=n.spec.definition.describe(d(a,n.target),s.boards[n.board],i?.boards[n.board]);return{...c,targetLabel:`${n.spec.label} \u203A ${c.targetLabel}`}},serialize:a=>{const s=k(a.target),i=s===null?void 0:r.boards().find(n=>n.id===s.board);return s===null||i===void 0?`${a.type} ${R(a.target)} ${JSON.stringify(a.payload)}`:`${i.definition.serialize(d(a,s.target))} @${s.board}`},resolveNavigation:(a,s)=>{const i=g(a,s),n=i===void 0?{}:{[m]:i.id};for(const c of l(a)){const b=c.definition.resolveNavigation(a.boards[c.id],D(s,c.id));Object.assign(n,q(c.id,b))}return n},navigationFor:(a,s)=>{const i=p(a,s);if(i?.spec===void 0)return null;const n=i.spec.definition.navigationFor?.(a.boards[i.board],i.target)??null;return{[m]:i.board,...q(i.board,n??{})}},commentTargets:(a,s)=>[{value:R(S),label:e.wholePage,group:e.pageGroup},...l(a).flatMap(i=>i.definition.commentTargets(a.boards[i.id],D(s,i.id)).map(n=>({value:T(n.value,i.id),label:n.label,group:n.group===void 0?i.label:`${i.label} \xB7 ${n.group}`})))],currentTarget:(a,s)=>{const i=g(a,s);if(i===void 0)return null;const n=i.definition.currentTarget?.(a.boards[i.id],D(s,i.id));return n==null?{value:T(`page:${i.definition.name}`,i.id),label:i.label}:{...n,value:T(n.value,i.id),label:`${i.label} \u203A ${n.label}`}},title:a=>a.title}},B=X({en:{label:"Page",wholePage:"Whole page",boards:"Boards",pageGroup:"Page",comment:"Comment",missingBoard:r=>`Board "${r}" (no longer on the page)`,untitled:"Untitled page",addBoard:"Add a board",removeBoard:r=>`Remove board "${r}"`,boardAdded:"Board added",boardRemoved:"Board removed"},ja:{label:"\u30DA\u30FC\u30B8",wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",boards:"\u30DC\u30FC\u30C9",pageGroup:"\u30DA\u30FC\u30B8",comment:"\u30B3\u30E1\u30F3\u30C8",missingBoard:r=>`\u30DC\u30FC\u30C9\u300C${r}\u300D\uFF08\u30DA\u30FC\u30B8\u304B\u3089\u7121\u304F\u306A\u308A\u307E\u3057\u305F\uFF09`,untitled:"\u7121\u984C\u306E\u30DA\u30FC\u30B8",addBoard:"\u30DC\u30FC\u30C9\u3092\u8FFD\u52A0",removeBoard:r=>`\u30DC\u30FC\u30C9\u300C${r}\u300D\u3092\u524A\u9664`,boardAdded:"\u30DC\u30FC\u30C9\u3092\u8FFD\u52A0",boardRemoved:"\u30DC\u30FC\u30C9\u3092\u524A\u9664"}}),Re=r=>r instanceof HTMLElement&&"definition"in r&&"api"in r&&he(r)!==null,Se=r=>typeof r=="object"&&r!==null&&"name"in r&&"emptyBase"in r,L=(r,e)=>r.flatMap(t=>{const o=k(t.target);return o?.board===e?[{...t,target:o.target}]:[]}),_e=r=>{try{return r.matches(":popover-open")}catch{return!1}},Pe=u(ue),O="dpk-page-add-menu",Ce={width:260,height:420},Ie=ee`
|
|
5
|
+
.dpk-main {
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dpk-main-body {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: 1 1 0%;
|
|
12
|
+
min-height: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
animation: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dpk-page {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
21
|
+
min-width: 0;
|
|
22
|
+
min-height: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dpk-page-rail {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
padding: 6px 4px;
|
|
31
|
+
border-right: 1px solid var(--dpk-rule);
|
|
32
|
+
background: var(--dpk-paper-sunken);
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dpk-page-tabs {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dpk-page-tab-item {
|
|
43
|
+
position: relative;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dpk-page-tab {
|
|
47
|
+
position: relative;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 3px;
|
|
52
|
+
width: 52px;
|
|
53
|
+
padding: 6px 2px 5px;
|
|
54
|
+
border: 1px solid transparent;
|
|
55
|
+
border-radius: var(--dpk-radius);
|
|
56
|
+
background: transparent;
|
|
57
|
+
color: var(--dpk-ink-soft);
|
|
58
|
+
font: 600 10px / 1.2 var(--dpk-body);
|
|
59
|
+
overflow-wrap: anywhere;
|
|
60
|
+
text-align: center;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
transition:
|
|
63
|
+
background 160ms var(--dpk-ease),
|
|
64
|
+
color 160ms var(--dpk-ease);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dpk-page-tab-icon {
|
|
68
|
+
display: grid;
|
|
69
|
+
place-items: center;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dpk-page-tab-icon svg {
|
|
73
|
+
width: 22px;
|
|
74
|
+
height: 22px;
|
|
75
|
+
stroke-width: 1.75;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dpk-page-tab:hover {
|
|
79
|
+
background: var(--dpk-paper-raised);
|
|
80
|
+
color: var(--dpk-ink);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dpk-page-tab[aria-selected='true'] {
|
|
84
|
+
border-color: var(--dpk-rule-strong);
|
|
85
|
+
background: var(--dpk-paper-raised);
|
|
86
|
+
color: var(--dpk-accent);
|
|
87
|
+
box-shadow: var(--dpk-shadow-xs);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dpk-page-tab:focus-visible,
|
|
91
|
+
.dpk-page-tab-remove:focus-visible,
|
|
92
|
+
.dpk-page-add:focus-visible {
|
|
93
|
+
outline: 2px solid var(--dpk-focus);
|
|
94
|
+
outline-offset: 2px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.dpk-page-tab-count {
|
|
98
|
+
position: absolute;
|
|
99
|
+
top: -3px;
|
|
100
|
+
right: -3px;
|
|
101
|
+
min-width: 16px;
|
|
102
|
+
height: 16px;
|
|
103
|
+
padding: 0 4px;
|
|
104
|
+
border: 2px solid var(--dpk-paper-sunken);
|
|
105
|
+
border-radius: 999px;
|
|
106
|
+
background: var(--dpk-accent);
|
|
107
|
+
color: var(--dpk-accent-ink);
|
|
108
|
+
font-size: 9px;
|
|
109
|
+
line-height: 12px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Shown on the board under the pointer or keyboard focus, opposite its count. */
|
|
113
|
+
.dpk-page-tab-remove {
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: -3px;
|
|
116
|
+
left: -3px;
|
|
117
|
+
display: grid;
|
|
118
|
+
place-items: center;
|
|
119
|
+
width: 18px;
|
|
120
|
+
height: 18px;
|
|
121
|
+
padding: 0;
|
|
122
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
123
|
+
border-radius: 999px;
|
|
124
|
+
background: var(--dpk-paper-raised);
|
|
125
|
+
color: var(--dpk-ink-soft);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
opacity: 0;
|
|
128
|
+
transition: opacity 120ms var(--dpk-ease);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dpk-page-tab-remove svg {
|
|
132
|
+
width: 11px;
|
|
133
|
+
height: 11px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.dpk-page-tab-remove:hover {
|
|
137
|
+
color: var(--dpk-danger, var(--dpk-ink));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.dpk-page-tab-item:hover > .dpk-page-tab-remove,
|
|
141
|
+
.dpk-page-tab-item:focus-within > .dpk-page-tab-remove {
|
|
142
|
+
opacity: 1;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.dpk-page-add {
|
|
146
|
+
display: grid;
|
|
147
|
+
place-items: center;
|
|
148
|
+
width: 32px;
|
|
149
|
+
height: 32px;
|
|
150
|
+
margin-top: 2px;
|
|
151
|
+
padding: 0;
|
|
152
|
+
border: 1px dashed var(--dpk-rule-strong);
|
|
153
|
+
border-radius: var(--dpk-radius);
|
|
154
|
+
background: transparent;
|
|
155
|
+
color: var(--dpk-ink-soft);
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.dpk-page-add:hover,
|
|
160
|
+
.dpk-page-add[aria-expanded='true'] {
|
|
161
|
+
border-style: solid;
|
|
162
|
+
background: var(--dpk-paper-raised);
|
|
163
|
+
color: var(--dpk-ink);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.dpk-page-add svg {
|
|
167
|
+
width: 16px;
|
|
168
|
+
height: 16px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.dpk-page-add-option .dpk-settings-check svg {
|
|
172
|
+
width: 16px;
|
|
173
|
+
height: 16px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* The header reads "title / board ⚙": the title keeps its width and the board follows it. */
|
|
177
|
+
.dpk-title {
|
|
178
|
+
flex: 0 1 auto;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.dpk-header-slot {
|
|
182
|
+
flex: 1 1 0%;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.dpk-page-heading {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 6px;
|
|
189
|
+
min-width: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.dpk-page-crumb {
|
|
193
|
+
display: inline-flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: 6px;
|
|
196
|
+
min-width: 0;
|
|
197
|
+
color: var(--dpk-ink-soft);
|
|
198
|
+
font-size: 13px;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
white-space: nowrap;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.dpk-page-crumb::before {
|
|
204
|
+
content: '/';
|
|
205
|
+
color: var(--dpk-rule-strong);
|
|
206
|
+
font-weight: 400;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.dpk-page-crumb svg {
|
|
210
|
+
width: 15px;
|
|
211
|
+
height: 15px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.dpk-page-boards {
|
|
215
|
+
display: grid;
|
|
216
|
+
min-width: 0;
|
|
217
|
+
min-height: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
::slotted(*) {
|
|
221
|
+
min-width: 0;
|
|
222
|
+
min-height: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Important: the page's own CSS often gives a template display: block. */
|
|
226
|
+
::slotted([hidden]) {
|
|
227
|
+
display: none !important;
|
|
228
|
+
}
|
|
229
|
+
`;class Ne extends te{static{this.styles=[ae,Ie]}#s=!1;#a=!1;#o="";#n=new WeakMap;#i=new WeakMap;#b=new Map;#u;#t=!1;#k=new ie(this);constructor(){super(),new se(this,{open:()=>this.#t,closesOn:e=>!e.some(t=>t instanceof Element&&(t.id===O||t.matches(".dpk-page-add"))),ownsEscape:()=>!0,dismiss:()=>this.#h(!1)})}boardTemplates(){return[]}definitionFor(e){return Te({boards:()=>this.#y(),base:()=>this.#d(),catalog:()=>this.#p(),messages:B(e)})}connectedCallback(){super.connectedCallback(),this.api.ready.then(()=>{this.#a=!0,this.#o=this.#m(this.#r()),this.requestUpdate()})}get[oe](){if(this.#a)return this.#u??={locale:()=>this.locale,theme:()=>this.dataset.theme,navigation:()=>this.navigation,boardIds:()=>new Set(this.#e().map(e=>e.board??"")),dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),editComment:(e,t)=>this.editComment(e,t),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,t)=>this.navigate(e,t),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)},this.#u}#e(){return Array.from(this.children).filter(Re)}#r(){return this.#e().filter(e=>!e.hasAttribute(P))}#g(e){return e.getAttribute("label")??e.definition.label}#d(){const e=this.#r();return{layout:e.map(t=>({id:t.board??"",template:t.definition.name,label:this.#g(t)})),boards:Object.fromEntries(e.map(t=>[t.board??"",t.api.base]))}}#m(e){return e.map(t=>t.board??"").join(" ")}#y(){return this.#e().map(e=>({id:e.board??"",label:this.#g(e),definition:e.definition}))}#p(){const e=this.locale,t=this.#b.get(e);if(t!==void 0)return t;const o=this.boardTemplates(),l=o.flatMap(({name:p})=>{const d=`dpk-template-${p}`;if(customElements.get(d)===void 0)return[];const h=document.createElement(d);h.setAttribute("lang",e);const g="definition"in h?h.definition:void 0;return Se(g)?[g]:[]});return l.length===o.length&&this.#b.set(e,l),l}#l(e){return this.#e().find(t=>t.board===e.id)?.definition??this.#p().find(t=>t.name===e.template)}#c(e){return this.boardTemplates().find(t=>t.name===e)?.icon??Pe}pendingStart(){return this.#s?null:this.#f().then(()=>{this.#s=!0;for(const e of this.#e())this.#i.set(e,!0)})}#f(){const e=new Set(Array.from(this.children).filter(t=>t.hasAttribute(w)).map(t=>t.localName));return Promise.all(Array.from(e,t=>customElements.whenDefined(t))).then(()=>Promise.all(this.#e().map(t=>t.api.ready))).then(()=>{})}#x(){this.#a&&this.#f().then(()=>{const e=this.#m(this.#r());e!==this.#o&&(this.#o=e,this.#n=new WeakMap,this.controller.setBase({...this.controller.base,...this.#d()}))})}scriptOf(e){return this.querySelector(`:scope > ${e}`)}hasSidebarContent(){return!1}hasFooterContent(){return this.querySelector(':scope > [slot="footer"]')!==null}buildBrief(e){const t=e.state.layout.flatMap(o=>{const l=this.#l(o);return l===void 0?[]:[{id:o.id,label:o.label,definition:l}]});return Be(super.buildBrief(e),we(t,e.actions))}templateIdentity(){const e=this.#a?this.#v(this.api.state,this.navigation):void 0;return(e===void 0?void 0:this.#l(e))??super.templateIdentity()}#v(e,t){return e.layout.find(o=>o.id===t[m])}renderRegions(e){const t=B(this.locale),o=e.state.layout,l=this.#v(e.state,e.navigation),p=this.#p();return{sidebarHidden:!0,header:l===void 0?v:this.#A(e,l),main:f`<div class="dpk-page">
|
|
230
|
+
<nav class="dpk-page-rail" aria-label=${t.boards}>
|
|
231
|
+
<div
|
|
232
|
+
class="dpk-page-tabs"
|
|
233
|
+
role="tablist"
|
|
234
|
+
aria-orientation="vertical"
|
|
235
|
+
@keydown=${d=>this.#M(d,o)}
|
|
236
|
+
>
|
|
237
|
+
${o.map(d=>this.#$(d,d.id===l?.id,L(e.actions,d.id).length,o.length))}
|
|
238
|
+
</div>
|
|
239
|
+
${p.length===0?v:f`<button
|
|
240
|
+
class="dpk-page-add"
|
|
241
|
+
type="button"
|
|
242
|
+
aria-label=${t.addBoard}
|
|
243
|
+
title=${t.addBoard}
|
|
244
|
+
aria-haspopup="menu"
|
|
245
|
+
aria-controls=${O}
|
|
246
|
+
aria-expanded=${this.#t?"true":"false"}
|
|
247
|
+
@click=${()=>this.#h(!this.#t)}
|
|
248
|
+
>
|
|
249
|
+
${ne()}
|
|
250
|
+
</button>`}
|
|
251
|
+
${this.#t?this.#w(p):v}
|
|
252
|
+
</nav>
|
|
253
|
+
<div class="dpk-page-boards"><slot @slotchange=${()=>this.#x()}></slot></div>
|
|
254
|
+
</div>`}}#A(e,t){const o=this.#e().find(g=>g.board===t.id),l=o?.definition.settings?.(e.state.boards[t.id]),p=o!==void 0&&l!==void 0&&l.items.length>0,d=re(this.locale),h={toggle:()=>{this.settingsOpen=!this.settingsOpen},flip:g=>{o?.api.dispatch(g)}};return f`<div class="dpk-page-heading ${de}">
|
|
255
|
+
<span class="dpk-page-crumb">${this.#c(t.template)()} ${t.label}</span>
|
|
256
|
+
${p?pe(this.settingsOpen,d,h):v}
|
|
257
|
+
${p&&this.settingsOpen?le(l,d,h):v}
|
|
258
|
+
</div>`}#$(e,t,o,l){const p=B(this.locale),d=this.#l(e)?.label??e.template;return f`<div class="dpk-page-tab-item" role="presentation">
|
|
259
|
+
<button
|
|
260
|
+
class="dpk-page-tab"
|
|
261
|
+
type="button"
|
|
262
|
+
role="tab"
|
|
263
|
+
data-board=${e.id}
|
|
264
|
+
aria-selected=${t?"true":"false"}
|
|
265
|
+
tabindex=${t?0:-1}
|
|
266
|
+
title=${`${e.label} \xB7 ${d}`}
|
|
267
|
+
@click=${()=>this.navigate({[m]:e.id})}
|
|
268
|
+
>
|
|
269
|
+
<span class="dpk-page-tab-icon">${this.#c(e.template)()}</span>
|
|
270
|
+
<span class="dpk-page-tab-label">${e.label}</span>
|
|
271
|
+
${o>0?f`<span class="dpk-page-tab-count">${o}</span>`:v}
|
|
272
|
+
</button>
|
|
273
|
+
${l>1?f`<button
|
|
274
|
+
class="dpk-page-tab-remove"
|
|
275
|
+
type="button"
|
|
276
|
+
data-board=${e.id}
|
|
277
|
+
tabindex="-1"
|
|
278
|
+
aria-label=${p.removeBoard(e.label)}
|
|
279
|
+
title=${p.removeBoard(e.label)}
|
|
280
|
+
@click=${()=>this.#O(e.id)}
|
|
281
|
+
>
|
|
282
|
+
${ce()}
|
|
283
|
+
</button>`:v}
|
|
284
|
+
</div>`}#w(e){const t=B(this.locale);return f`<div
|
|
285
|
+
id=${O}
|
|
286
|
+
class="dpk-settings dpk-page-add-menu"
|
|
287
|
+
popover="manual"
|
|
288
|
+
role="menu"
|
|
289
|
+
aria-label=${t.addBoard}
|
|
290
|
+
>
|
|
291
|
+
${e.map(o=>f`<button
|
|
292
|
+
class="dpk-settings-option dpk-page-add-option"
|
|
293
|
+
type="button"
|
|
294
|
+
role="menuitem"
|
|
295
|
+
data-template=${o.name}
|
|
296
|
+
@click=${()=>this.#B(o)}
|
|
297
|
+
>
|
|
298
|
+
<span class="dpk-settings-check" aria-hidden="true">${this.#c(o.name)()}</span>
|
|
299
|
+
<span class="dpk-settings-text"><span class="dpk-settings-name">${o.label}</span></span>
|
|
300
|
+
</button>`)}
|
|
301
|
+
</div>`}#h(e){this.#t!==e&&(this.#t=e,this.requestUpdate())}#B(e){this.#h(!1);const t=new Set([...this.api.state.layout.map(p=>p.id),...Array.from(this.children,p=>p.getAttribute(w)??"")]),o=De(e.name,t);this.dispatch({type:"ADD_BOARD",target:S,payload:{board:o,template:e.name,label:e.label}}).ok&&this.navigate({[m]:o})}#O(e){const t=this.controller.actions,o=t.find(p=>{if(!y(p.target))return!1;const d=_(x,p);return d?.type==="ADD_BOARD"&&d.payload.board===e}),l=this.#d().layout.some(p=>p.id===e);if(o===void 0||l){this.dispatch({type:"REMOVE_BOARD",target:S,payload:{board:e}});return}for(const p of t)k(p.target)?.board===e&&this.removeAction(p.id);this.removeAction(o.id)}#M(e,t){const o=t.findIndex(h=>h.id===this.navigation[m]),l=t.length-1,p=e.key==="ArrowDown"?Math.min(l,o+1):e.key==="ArrowUp"?Math.max(0,o-1):e.key==="Home"?0:e.key==="End"?l:null,d=p===null?void 0:t[p];d!==void 0&&(e.preventDefault(),this.navigate({[m]:d.id}),this.updateComplete.then(()=>this.renderRoot.querySelector(`.dpk-page-tab[data-board="${d.id}"]`)?.focus()))}updated(){super.updated(),this.#E(),this.#D()}#E(){const e=this.renderRoot.querySelector(`#${O}`),t=this.renderRoot.querySelector(".dpk-page-add");!e||!t||_e(e)||this.#k.open(e,t,Ce,{placement:"right-end"})}#D(){if(!this.#s)return;const e=this.api.state.layout,t=new Set(e.map(d=>d.id));for(const d of this.#e())d.hasAttribute(P)&&!t.has(d.board??"")&&d.remove();const o=new Set(Array.from(this.children,d=>d.getAttribute(w)));for(const d of e)o.has(d.id)||this.#T(d);const l=this.controller.actions,p=this.navigation[m];for(const d of this.#e()){const h=d.board??"";d.hidden=h!==p||!t.has(h),this.#R(d)&&(this.#n.get(d)!==l&&(this.#n.set(d,l),d.controller.replaceActions(L(l,h))),d.requestUpdate())}}#T(e){const t=`dpk-template-${e.template}`;if(customElements.get(t)===void 0)return;const o=document.createElement(t);o.setAttribute(w,e.id),o.setAttribute("label",e.label),o.setAttribute(P,""),o.hidden=!0,this.append(o)}#R(e){const t=this.#i.get(e);return t!==void 0?t:(this.#i.set(e,!1),e.api.ready.then(()=>{this.#i.set(e,!0),this.requestUpdate()}),!1)}}const qe=[{name:"usm",icon:u(me)},{name:"event-storming",icon:u(Ae)},{name:"example-mapping",icon:u(ge)},{name:"prototype",icon:u(fe)},{name:"task-board",icon:u(xe)},{name:"delegation-poker",icon:u(ye)},{name:"whiteboard",icon:u(ve)},{name:"slides",icon:u(ke)},{name:"plain",icon:u(be)}];class je extends Ne{boardTemplates(){return qe}}const He=()=>{customElements.get("dpk-page")||customElements.define("dpk-page",je)};export{He as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM as z,ae as Ue,af as M,ag as q,ah as N,P as Pe,e as Qe,a0 as Ce,V as I,R as g,l as Xe,a2 as H,a9 as Ye,j as Be,a1 as Ve,aa as ze,ab as Fe,a3 as $,aF as Ke,a4 as f,A as je,K as Je,h as We,a5 as F,T as Z}from"./shared-BDka-8DG.js";import{r as U,D as He}from"./shared-B5lBiq5s.js";import{r as Ze,p as Ge,c as et}from"./shared-k9bZPE_p.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),h(1))})),SET_STORY_DESCRIPTION:m("SET_STORY_DESCRIPTION","story",E({description:s()})),REORDER_STORY:m("REORDER_STORY","story",E({after:D(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),h(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:D(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),h(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:D(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),h(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:D(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},w={setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),addStory:(e,t)=>({type:"ADD_STORY",target:{type:"page",id:"example-mapping"},payload:{id:e,name:t}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),setRuleName:(e,t)=>({type:"SET_RULE_NAME",target:{type:"rule",id:e},payload:{name:t}}),setRuleDescription:(e,t)=>({type:"SET_RULE_DESCRIPTION",target:{type:"rule",id:e},payload:{description:t}}),moveRule:(e,t,r)=>({type:"MOVE_RULE",target:{type:"rule",id:e},payload:{storyId:t,after:r}}),reorderRule:(e,t)=>({type:"REORDER_RULE",target:{type:"rule",id:e},payload:{after:t}}),addRule:(e,t,r)=>({type:"ADD_RULE",target:{type:"story",id:e},payload:{id:t,name:r}}),deleteRule:e=>({type:"DELETE_RULE",target:{type:"rule",id:e},payload:{}}),setExampleName:(e,t)=>({type:"SET_EXAMPLE_NAME",target:{type:"example",id:e},payload:{name:t}}),setExampleDescription:(e,t)=>({type:"SET_EXAMPLE_DESCRIPTION",target:{type:"example",id:e},payload:{description:t}}),moveExample:(e,t,r)=>({type:"MOVE_EXAMPLE",target:{type:"example",id:e},payload:{ruleId:t,after:r}}),reorderExample:(e,t)=>({type:"REORDER_EXAMPLE",target:{type:"example",id:e},payload:{after:t}}),addExample:(e,t,r)=>({type:"ADD_EXAMPLE",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteExample:e=>({type:"DELETE_EXAMPLE",target:{type:"example",id:e},payload:{}}),setQuestionName:(e,t)=>({type:"SET_QUESTION_NAME",target:{type:"question",id:e},payload:{name:t}}),setQuestionDescription:(e,t)=>({type:"SET_QUESTION_DESCRIPTION",target:{type:"question",id:e},payload:{description:t}}),moveQuestion:(e,t,r)=>({type:"MOVE_QUESTION",target:{type:"question",id:e},payload:{ruleId:t,after:r}}),reorderQuestion:(e,t)=>({type:"REORDER_QUESTION",target:{type:"question",id:e},payload:{after:t}}),addQuestion:(e,t,r)=>({type:"ADD_QUESTION",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteQuestion:e=>({type:"DELETE_QUESTION",target:{type:"question",id:e},payload:{}})},tt=M({id:k,name:x(s(),h(1)),description:S(s())}),rt=M({id:k,storyId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),G=M({id:k,ruleId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),ee=M({title:S(s()),stories:q(N(tt),[]),rules:q(N(rt),[]),examples:q(N(G),[]),questions:q(N(G),[])}),te=e=>{const t=Ue(ee,e),r=new Set,a=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},n=new Set(t.stories.map(i=>i.id));for(const i of t.stories)a("stories",i.id);for(const i of t.rules)if(a("rules",i.id),!n.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(a("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(a("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},re=()=>({stories:[],rules:[],examples:[],questions:[]}),at=e=>({...e,rules:z(e.rules,["storyId"]),examples:z(e.examples,["ruleId"]),questions:z(e.questions,["ruleId"])}),T=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},y=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},b=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},R=(e,t)=>{if(t!==void 0)return e.questions.find(r=>r.id===t)},L=(e,t)=>{if(t===void 0)return;const r=T(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const a=y(e,t);if(a)return{kind:"rule",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const n=b(e,t);if(n)return{kind:"example",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ae=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),nt=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const a=b(e,t)?.ruleId??R(e,t)?.ruleId;return a===void 0?void 0:y(e,a)?.storyId},ie=e=>[...e.stories.map(t=>t.id),...e.rules.map(t=>t.id),...e.examples.map(t=>t.id),...e.questions.map(t=>t.id)],de=(e,t)=>y(e,t)?.storyId,ot=(e,t)=>{const r=b(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=Ee(e.stories,a,r.payload.after);return n===null?null:{...e,stories:n}}case"ADD_STORY":{const n=r.payload;return e.stories.some(o=>o.id===n.id)?e:P(e,n.id)?null:{...e,stories:[...e.stories,{id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===a))return null;const n=new Set(e.rules.filter(o=>o.storyId===a).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==a),rules:e.rules.filter(o=>o.storyId!==a),examples:e.examples.filter(o=>!n.has(o.ruleId)),questions:e.questions.filter(o=>!n.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"MOVE_RULE":{const n=r.payload,o=y(e,a);if(!o||!e.stories.some(d=>d.id===n.storyId))return null;const i=e.rules.filter(d=>d.storyId===n.storyId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,rules:me(e.rules,{...o,storyId:n.storyId},n.after)}}case"REORDER_RULE":{const n=y(e,a);if(!n)return null;const o=e.rules.filter(i=>i.storyId===n.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,n,r.payload.after)}}case"ADD_RULE":{const n=r.payload,o=T(e,a);return o?e.rules.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,rules:[...e.rules,{id:n.id,storyId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_RULE":return y(e,a)?{...e,rules:e.rules.filter(n=>n.id!==a),examples:e.examples.filter(n=>n.ruleId!==a),questions:e.questions.filter(n=>n.ruleId!==a)}:null;case"SET_EXAMPLE_NAME":return ue(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,a,n=>({...n,description:r.payload.description}));case"MOVE_EXAMPLE":{const n=r.payload,o=b(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_EXAMPLE":{const n=b(e,a);if(!n)return null;const o=e.examples.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,n,r.payload.after)}}case"ADD_EXAMPLE":{const n=r.payload,o=y(e,a);return o?e.examples.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,examples:[...e.examples,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_EXAMPLE":return b(e,a)?{...e,examples:e.examples.filter(n=>n.id!==a)}:null;case"SET_QUESTION_NAME":return ce(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,a,n=>({...n,description:r.payload.description}));case"MOVE_QUESTION":{const n=r.payload,o=R(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_QUESTION":{const n=R(e,a);if(!n)return null;const o=e.questions.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,n,r.payload.after)}}case"ADD_QUESTION":{const n=r.payload,o=y(e,a);return o?e.questions.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,questions:[...e.questions,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_QUESTION":return R(e,a)?{...e,questions:e.questions.filter(n=>n.id!==a)}:null;default:return Qe(r)}},P=(e,t)=>e.stories.some(r=>r.id===t)||e.rules.some(r=>r.id===t)||e.examples.some(r=>r.id===t)||e.questions.some(r=>r.id===t),le=(e,t,r)=>e.stories.some(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,pe=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.storyId===t.storyId),o=r===null?[t,...n]:K(n,t,r),i=a.findIndex(l=>l.storyId===t.storyId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Q=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...n]:K(n,t,r),i=a.findIndex(l=>l.ruleId===t.ruleId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Ee=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const a=e.find(o=>o.id===t);if(a===void 0)return null;const n=e.filter(o=>o.id!==t);return K(n,a,r)},K=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},it={story:"Story",rule:"Rule",example:"Example",question:"Question"},dt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},st={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},lt={empty:"\u30EB\u30FC\u30EB\u672A\u6574\u7406","open-questions":"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u3042\u308A","too-big":"\u5206\u5272\u3092\u691C\u8A0E",thin:"\u5177\u4F53\u4F8B\u306E\u7121\u3044\u30EB\u30FC\u30EB\u3042\u308A",ready:"\u5408\u610F\u3067\u304D\u305D\u3046"},C=Ce({en:{kindLabel:e=>it[e],readinessLabel:e=>st[e],map:"Map",cardKinds:"Card kinds",noStoriesTitle:"No stories yet",noStoriesBody:"Place one story (yellow), then line up the rules (blue) that accept it beneath it. For each rule, stack examples (green) in the top area and open questions (red) in the bottom area.",firstStory:"+ First story",addStoryButton:"+ Story",noExamples:"No examples yet",noQuestions:"No open questions",commentButton:"Comment",deleteButton:"Delete",nameField:e=>`${e} name`,newStory:"New story",newRule:"New rule",newExample:"New example",newQuestion:"New question",storyRenamedTitle:"Renamed the story",storyDescriptionUpdatedTitle:"Updated the story\u2019s description",storyReorderedTitle:"Reordered the story",storyAddedTitle:"Added a story",storyDeletedTitle:"Deleted the story",ruleRenamedTitle:"Renamed the rule",ruleDescriptionUpdatedTitle:"Updated the rule\u2019s description",ruleMovedTitle:"Moved the rule",ruleReorderedTitle:"Reordered the rule",ruleAddedTitle:"Added a rule",ruleDeletedTitle:"Deleted the rule",exampleRenamedTitle:"Renamed the example",exampleDescriptionUpdatedTitle:"Updated the example\u2019s description",exampleMovedTitle:"Moved the example",exampleReorderedTitle:"Reordered the example",exampleAddedTitle:"Added an example",exampleDeletedTitle:"Deleted the example",questionRenamedTitle:"Renamed the question",questionDescriptionUpdatedTitle:"Updated the question\u2019s description",questionMovedTitle:"Moved the question",questionReorderedTitle:"Reordered the question",questionAddedTitle:"Added a question",questionDeletedTitle:"Deleted the question",arrowTo:e=>`\u2192 \u201C${e}\u201D`,arrowFrom:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,toTop:"\u2192 To the top",afterPlacement:e=>`\u2192 After \u201C${e}\u201D`,wholeMap:"Whole map"},ja:{kindLabel:e=>dt[e],readinessLabel:e=>lt[e],map:"\u30DE\u30C3\u30D7",cardKinds:"\u30AB\u30FC\u30C9\u306E\u7A2E\u985E",noStoriesTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noStoriesBody:"\u30B9\u30C8\u30FC\u30EA\u30FC\uFF08\u9EC4\uFF09\u30921\u679A\u7F6E\u304D\u3001\u305D\u306E\u4E0B\u306B\u53D7\u3051\u5165\u308C\u6761\u4EF6\u3068\u306A\u308B\u30EB\u30FC\u30EB\uFF08\u9752\uFF09\u3092\u4E26\u3079\u307E\u3059\u3002\u30EB\u30FC\u30EB\u3054\u3068\u306B\u3001\u4E0A\u306E\u6B04\u3078\u5177\u4F53\u4F8B\uFF08\u7DD1\uFF09\u3092\u3001\u4E0B\u306E\u6B04\u3078\u7B54\u3048\u306E\u51FA\u306A\u3044\u8AD6\u70B9\u3092\u8CEA\u554F\uFF08\u8D64\uFF09\u3068\u3057\u3066\u7A4D\u307F\u307E\u3059\u3002",firstStory:"+ \u6700\u521D\u306E\u30B9\u30C8\u30FC\u30EA\u30FC",addStoryButton:"+ \u30B9\u30C8\u30FC\u30EA\u30FC",noExamples:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noQuestions:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",nameField:e=>`${e}\u540D`,newStory:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",newRule:"\u65B0\u3057\u3044\u30EB\u30FC\u30EB",newExample:"\u65B0\u3057\u3044\u5177\u4F53\u4F8B",newQuestion:"\u65B0\u3057\u3044\u8CEA\u554F",storyRenamedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",storyDescriptionUpdatedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",storyReorderedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",storyAddedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",storyDeletedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",ruleRenamedTitle:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",ruleDescriptionUpdatedTitle:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",ruleMovedTitle:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",ruleReorderedTitle:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",ruleAddedTitle:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",ruleDeletedTitle:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",exampleRenamedTitle:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",exampleDescriptionUpdatedTitle:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",exampleMovedTitle:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",exampleReorderedTitle:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",exampleAddedTitle:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",exampleDeletedTitle:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",questionRenamedTitle:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",questionDescriptionUpdatedTitle:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",questionMovedTitle:"\u8CEA\u554F\u3092\u79FB\u52D5",questionReorderedTitle:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",questionAddedTitle:"\u8CEA\u554F\u3092\u8FFD\u52A0",questionDeletedTitle:"\u8CEA\u554F\u3092\u524A\u9664",arrowTo:e=>`\u2192 \u300C${e}\u300D`,arrowFrom:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,toTop:"\u2192 \u5148\u982D\u3078",afterPlacement:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53"}}),X=(e,t,r)=>{const a=typeof r=="string"?r:"",n=typeof t=="string"?t:void 0;return n===void 0?e.arrowTo(a):e.arrowFrom(n,a)},pt={SET_STORY_NAME:(e,t,r)=>({title:e.storyRenamedTitle,tone:"update",body:X(e,T(r,t.target.id)?.name,g(u.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.storyDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),REORDER_STORY:(e,t)=>({title:e.storyReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.storyAddedTitle,tone:"create",body:e.added(String(g(u.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,r)=>({title:e.storyDeletedTitle,tone:"delete",body:e.deleted(T(r,t.target.id)?.name??t.target.id)}),SET_RULE_NAME:(e,t,r)=>({title:e.ruleRenamedTitle,tone:"update",body:X(e,y(r,t.target.id)?.name,g(u.SET_RULE_NAME,t).name??"")}),SET_RULE_DESCRIPTION:(e,t)=>({title:e.ruleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_RULE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_RULE:(e,t,r)=>({title:e.ruleMovedTitle,tone:"move",body:e.arrowTo(T(r,String(g(u.MOVE_RULE,t).storyId))?.name??String(g(u.MOVE_RULE,t).storyId??""))}),REORDER_RULE:(e,t)=>({title:e.ruleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_RULE,t).after)}),ADD_RULE:(e,t)=>({title:e.ruleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_RULE,t).name??""))}),DELETE_RULE:(e,t,r)=>({title:e.ruleDeletedTitle,tone:"delete",body:e.deleted(y(r,t.target.id)?.name??t.target.id)}),SET_EXAMPLE_NAME:(e,t,r)=>({title:e.exampleRenamedTitle,tone:"update",body:X(e,b(r,t.target.id)?.name,g(u.SET_EXAMPLE_NAME,t).name??"")}),SET_EXAMPLE_DESCRIPTION:(e,t)=>({title:e.exampleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_EXAMPLE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_EXAMPLE:(e,t,r)=>({title:e.exampleMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_EXAMPLE,t).ruleId))?.name??String(g(u.MOVE_EXAMPLE,t).ruleId??""))}),REORDER_EXAMPLE:(e,t)=>({title:e.exampleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_EXAMPLE,t).after)}),ADD_EXAMPLE:(e,t)=>({title:e.exampleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_EXAMPLE,t).name??""))}),DELETE_EXAMPLE:(e,t,r)=>({title:e.exampleDeletedTitle,tone:"delete",body:e.deleted(b(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,R(r,t.target.id)?.name,g(u.SET_QUESTION_NAME,t).name??"")}),SET_QUESTION_DESCRIPTION:(e,t)=>({title:e.questionDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_QUESTION_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_QUESTION:(e,t,r)=>({title:e.questionMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_QUESTION,t).ruleId))?.name??String(g(u.MOVE_QUESTION,t).ruleId??""))}),REORDER_QUESTION:(e,t)=>({title:e.questionReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_QUESTION,t).after)}),ADD_QUESTION:(e,t)=>({title:e.questionAddedTitle,tone:"create",body:e.added(String(g(u.ADD_QUESTION,t).name??""))}),DELETE_QUESTION:(e,t,r)=>({title:e.questionDeletedTitle,tone:"delete",body:e.deleted(R(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,a)=>{let n;try{const o=pt[t.type];n=o?o(e,t,a??r):{title:t.type,tone:"meta"}}catch{n={title:t.type,tone:"meta"}}return{title:n.title,targetLabel:xe(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ye=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const a=T(t,r.id);return a?`${e.kindLabel("story")} \xB7 ${a.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const a=y(t,r.id);return a?`${e.kindLabel("rule")} \xB7 ${a.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const a=b(t,r.id);return a?`${e.kindLabel("example")} \xB7 ${a.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const a=R(t,r.id);return a?`${e.kindLabel("question")} \xB7 ${a.name}`:`${e.kindLabel("question")} \xB7 ${r.id} (missing)`}case"page":return`${e.map} \xB7 ${j(t)}`;default:return`${r.type} \xB7 ${r.id}`}}catch{return`${r.type} \xB7 ${r.id}`}},he=(e,t,r)=>{const a=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const n of t.stories)a.push({value:I({type:"story",id:n.id}),label:n.name,group:e.kindLabel("story")});for(const n of t.rules){const o=T(t,n.storyId);a.push({value:I({type:"rule",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("rule")})}for(const n of t.examples){const o=y(t,n.ruleId);a.push({value:I({type:"example",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("example")})}for(const n of t.questions){const o=y(t,n.ruleId);a.push({value:I({type:"question",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("question")})}return a},fe=(e,t,r)=>{const a=L(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},ut=4,Te=(e,t,r)=>{const a=t.rules.filter(p=>p.storyId===r),n=new Set(a.map(p=>p.id)),o=t.examples.filter(p=>n.has(p.ruleId)),i=t.questions.filter(p=>n.has(p.ruleId)).length,d=a.some(p=>!o.some(l=>l.ruleId===p.id)),c=a.length===0?"empty":i>0?"open-questions":a.length>ut?"too-big":d?"thin":"ready";return{rules:a.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",be=(e,t)=>{const r=L(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Re=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return L(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},Se=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:at,hasTarget:Re,describe:(r,a,n)=>ge(t,r,a,n),serialize:ye,resolveNavigation:be,navigationFor:(r,a)=>L(r,a.id)?.kind===a.type?{card:a.id}:null,commentTargets:(r,a)=>he(t,r),currentTarget:(r,a)=>fe(t,r,a),title:j}},B=(e,t,r)=>{const a=Xe(t,ie(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},ct=(e,t)=>B(e,"new-story",r=>w.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>w.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>w.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>w.addQuestion(r,a,t.newQuestion)),yt={width:300,height:260},ve=["story","rule","example","question"],_e={story:{bg:"linear-gradient(178deg, #fff3a6, #fde77a)",ink:"#4a3a06"},rule:{bg:"linear-gradient(178deg, #a3d1f5, #7cb8ea)",ink:"#0e2c4b"},example:{bg:"linear-gradient(178deg, #c9eb95, #a8dc63)",ink:"#22380a"},question:{bg:"linear-gradient(178deg, #fbc6d9, #f4a0c0)",ink:"#4b1029"}},O=e=>{const{bg:t,ink:r}=_e[e];return`--em-card-bg:${t};--em-card-ink:${r}`},xt=H`
|
|
1
|
+
import{p as m,au as E,w as A,aG as k,aH as S,ai as s,ak as x,al as h,aD as D,aR as z,ae as Ue,af as M,ag as q,ah as N,P as Pe,e as Qe,a0 as Ce,V as I,R as g,l as Xe,a2 as W,a9 as Ye,j as Be,a1 as Ve,aa as ze,ab as Ke,a3 as $,aK as Fe,a4 as f,B as je,K as Je,h as He,a5 as K,T as G}from"./shared-DnJBtKmH.js";import{r as U,D as We}from"./shared-B5lBiq5s.js";import{r as Ge,p as Ze,c as et}from"./shared-Ae8HmujL.js";const u={SET_STORY_NAME:m("SET_STORY_NAME","story",E({name:x(s(),h(1))})),SET_STORY_DESCRIPTION:m("SET_STORY_DESCRIPTION","story",E({description:s()})),REORDER_STORY:m("REORDER_STORY","story",E({after:D(s())}),{mode:"sequence"}),ADD_STORY:m("ADD_STORY","page",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_STORY:m("DELETE_STORY","story",E({})),SET_RULE_NAME:m("SET_RULE_NAME","rule",E({name:x(s(),h(1))})),SET_RULE_DESCRIPTION:m("SET_RULE_DESCRIPTION","rule",E({description:s()})),MOVE_RULE:m("MOVE_RULE","rule",E({storyId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_RULE:m("REORDER_RULE","rule",E({after:D(s())}),{mode:"sequence"}),ADD_RULE:m("ADD_RULE","story",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_RULE:m("DELETE_RULE","rule",E({})),SET_EXAMPLE_NAME:m("SET_EXAMPLE_NAME","example",E({name:x(s(),h(1))})),SET_EXAMPLE_DESCRIPTION:m("SET_EXAMPLE_DESCRIPTION","example",E({description:s()})),MOVE_EXAMPLE:m("MOVE_EXAMPLE","example",E({ruleId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_EXAMPLE:m("REORDER_EXAMPLE","example",E({after:D(s())}),{mode:"sequence"}),ADD_EXAMPLE:m("ADD_EXAMPLE","rule",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_EXAMPLE:m("DELETE_EXAMPLE","example",E({})),SET_QUESTION_NAME:m("SET_QUESTION_NAME","question",E({name:x(s(),h(1))})),SET_QUESTION_DESCRIPTION:m("SET_QUESTION_DESCRIPTION","question",E({description:s()})),MOVE_QUESTION:m("MOVE_QUESTION","question",E({ruleId:x(s(),h(1)),after:D(s())}),{mode:"sequence"}),REORDER_QUESTION:m("REORDER_QUESTION","question",E({after:D(s())}),{mode:"sequence"}),ADD_QUESTION:m("ADD_QUESTION","rule",E({id:k,name:x(s(),h(1)),description:S(s())}),{dedupeKey:A}),DELETE_QUESTION:m("DELETE_QUESTION","question",E({}))},w={setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),addStory:(e,t)=>({type:"ADD_STORY",target:{type:"page",id:"example-mapping"},payload:{id:e,name:t}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),setRuleName:(e,t)=>({type:"SET_RULE_NAME",target:{type:"rule",id:e},payload:{name:t}}),setRuleDescription:(e,t)=>({type:"SET_RULE_DESCRIPTION",target:{type:"rule",id:e},payload:{description:t}}),moveRule:(e,t,r)=>({type:"MOVE_RULE",target:{type:"rule",id:e},payload:{storyId:t,after:r}}),reorderRule:(e,t)=>({type:"REORDER_RULE",target:{type:"rule",id:e},payload:{after:t}}),addRule:(e,t,r)=>({type:"ADD_RULE",target:{type:"story",id:e},payload:{id:t,name:r}}),deleteRule:e=>({type:"DELETE_RULE",target:{type:"rule",id:e},payload:{}}),setExampleName:(e,t)=>({type:"SET_EXAMPLE_NAME",target:{type:"example",id:e},payload:{name:t}}),setExampleDescription:(e,t)=>({type:"SET_EXAMPLE_DESCRIPTION",target:{type:"example",id:e},payload:{description:t}}),moveExample:(e,t,r)=>({type:"MOVE_EXAMPLE",target:{type:"example",id:e},payload:{ruleId:t,after:r}}),reorderExample:(e,t)=>({type:"REORDER_EXAMPLE",target:{type:"example",id:e},payload:{after:t}}),addExample:(e,t,r)=>({type:"ADD_EXAMPLE",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteExample:e=>({type:"DELETE_EXAMPLE",target:{type:"example",id:e},payload:{}}),setQuestionName:(e,t)=>({type:"SET_QUESTION_NAME",target:{type:"question",id:e},payload:{name:t}}),setQuestionDescription:(e,t)=>({type:"SET_QUESTION_DESCRIPTION",target:{type:"question",id:e},payload:{description:t}}),moveQuestion:(e,t,r)=>({type:"MOVE_QUESTION",target:{type:"question",id:e},payload:{ruleId:t,after:r}}),reorderQuestion:(e,t)=>({type:"REORDER_QUESTION",target:{type:"question",id:e},payload:{after:t}}),addQuestion:(e,t,r)=>({type:"ADD_QUESTION",target:{type:"rule",id:e},payload:{id:t,name:r}}),deleteQuestion:e=>({type:"DELETE_QUESTION",target:{type:"question",id:e},payload:{}})},tt=M({id:k,name:x(s(),h(1)),description:S(s())}),rt=M({id:k,storyId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),Z=M({id:k,ruleId:x(s(),h(1)),name:x(s(),h(1)),description:S(s())}),ee=M({title:S(s()),stories:q(N(tt),[]),rules:q(N(rt),[]),examples:q(N(Z),[]),questions:q(N(Z),[])}),te=e=>{const t=Ue(ee,e),r=new Set,a=(i,d)=>{if(r.has(d))throw new Error(`duplicate id "${d}" in ${i}`);r.add(d)},n=new Set(t.stories.map(i=>i.id));for(const i of t.stories)a("stories",i.id);for(const i of t.rules)if(a("rules",i.id),!n.has(i.storyId))throw new Error(`rule "${i.id}" references unknown storyId "${i.storyId}"`);const o=new Map(t.rules.map(i=>[i.id,i]));for(const i of t.examples)if(a("examples",i.id),!o.has(i.ruleId))throw new Error(`example "${i.id}" references unknown ruleId "${i.ruleId}"`);for(const i of t.questions)if(a("questions",i.id),!o.has(i.ruleId))throw new Error(`question "${i.id}" references unknown ruleId "${i.ruleId}"`);return t},re=()=>({stories:[],rules:[],examples:[],questions:[]}),at=e=>({...e,rules:z(e.rules,["storyId"]),examples:z(e.examples,["ruleId"]),questions:z(e.questions,["ruleId"])}),T=(e,t)=>{if(t!==void 0)return e.stories.find(r=>r.id===t)},y=(e,t)=>{if(t!==void 0)return e.rules.find(r=>r.id===t)},b=(e,t)=>{if(t!==void 0)return e.examples.find(r=>r.id===t)},R=(e,t)=>{if(t!==void 0)return e.questions.find(r=>r.id===t)},L=(e,t)=>{if(t===void 0)return;const r=T(e,t);if(r)return{kind:"story",id:r.id,name:r.name,...r.description===void 0?{}:{description:r.description}};const a=y(e,t);if(a)return{kind:"rule",id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description}};const n=b(e,t);if(n)return{kind:"example",id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}};const o=R(e,t);if(o)return{kind:"question",id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description}}},ae=(e,t)=>e.rules.filter(r=>r.storyId===t),ne=(e,t)=>e.examples.filter(r=>r.ruleId===t),oe=(e,t)=>e.questions.filter(r=>r.ruleId===t),nt=(e,t)=>{if(T(e,t))return t;const r=y(e,t);if(r)return r.storyId;const a=b(e,t)?.ruleId??R(e,t)?.ruleId;return a===void 0?void 0:y(e,a)?.storyId},ie=e=>[...e.stories.map(t=>t.id),...e.rules.map(t=>t.id),...e.examples.map(t=>t.id),...e.questions.map(t=>t.id)],de=(e,t)=>y(e,t)?.storyId,ot=(e,t)=>{const r=b(e,t);return r?de(e,r.ruleId):void 0},se=(e,t)=>{const r=Pe(u,t);if(r===null)return null;const a=r.target.id;switch(r.type){case"SET_STORY_NAME":return le(e,a,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return le(e,a,n=>({...n,description:r.payload.description}));case"REORDER_STORY":{const n=Ee(e.stories,a,r.payload.after);return n===null?null:{...e,stories:n}}case"ADD_STORY":{const n=r.payload;return e.stories.some(o=>o.id===n.id)?e:P(e,n.id)?null:{...e,stories:[...e.stories,{id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}}case"DELETE_STORY":{if(!e.stories.some(o=>o.id===a))return null;const n=new Set(e.rules.filter(o=>o.storyId===a).map(o=>o.id));return{...e,stories:e.stories.filter(o=>o.id!==a),rules:e.rules.filter(o=>o.storyId!==a),examples:e.examples.filter(o=>!n.has(o.ruleId)),questions:e.questions.filter(o=>!n.has(o.ruleId))}}case"SET_RULE_NAME":return pe(e,a,n=>({...n,name:r.payload.name}));case"SET_RULE_DESCRIPTION":return pe(e,a,n=>({...n,description:r.payload.description}));case"MOVE_RULE":{const n=r.payload,o=y(e,a);if(!o||!e.stories.some(d=>d.id===n.storyId))return null;const i=e.rules.filter(d=>d.storyId===n.storyId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,rules:me(e.rules,{...o,storyId:n.storyId},n.after)}}case"REORDER_RULE":{const n=y(e,a);if(!n)return null;const o=e.rules.filter(i=>i.storyId===n.storyId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,rules:me(e.rules,n,r.payload.after)}}case"ADD_RULE":{const n=r.payload,o=T(e,a);return o?e.rules.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,rules:[...e.rules,{id:n.id,storyId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_RULE":return y(e,a)?{...e,rules:e.rules.filter(n=>n.id!==a),examples:e.examples.filter(n=>n.ruleId!==a),questions:e.questions.filter(n=>n.ruleId!==a)}:null;case"SET_EXAMPLE_NAME":return ue(e,a,n=>({...n,name:r.payload.name}));case"SET_EXAMPLE_DESCRIPTION":return ue(e,a,n=>({...n,description:r.payload.description}));case"MOVE_EXAMPLE":{const n=r.payload,o=b(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.examples.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,examples:Q(e.examples,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_EXAMPLE":{const n=b(e,a);if(!n)return null;const o=e.examples.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,examples:Q(e.examples,n,r.payload.after)}}case"ADD_EXAMPLE":{const n=r.payload,o=y(e,a);return o?e.examples.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,examples:[...e.examples,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_EXAMPLE":return b(e,a)?{...e,examples:e.examples.filter(n=>n.id!==a)}:null;case"SET_QUESTION_NAME":return ce(e,a,n=>({...n,name:r.payload.name}));case"SET_QUESTION_DESCRIPTION":return ce(e,a,n=>({...n,description:r.payload.description}));case"MOVE_QUESTION":{const n=r.payload,o=R(e,a);if(!o||!y(e,n.ruleId))return null;const i=e.questions.filter(d=>d.ruleId===n.ruleId&&d.id!==a);return n.after!==null&&!i.some(d=>d.id===n.after)?null:{...e,questions:Q(e.questions,{...o,ruleId:n.ruleId},n.after)}}case"REORDER_QUESTION":{const n=R(e,a);if(!n)return null;const o=e.questions.filter(i=>i.ruleId===n.ruleId);return r.payload.after!==null&&!o.some(i=>i.id===r.payload.after)?null:{...e,questions:Q(e.questions,n,r.payload.after)}}case"ADD_QUESTION":{const n=r.payload,o=y(e,a);return o?e.questions.some(i=>i.id===n.id)?e:P(e,n.id)?null:{...e,questions:[...e.questions,{id:n.id,ruleId:o.id,name:n.name,...n.description===void 0?{}:{description:n.description}}]}:null}case"DELETE_QUESTION":return R(e,a)?{...e,questions:e.questions.filter(n=>n.id!==a)}:null;default:return Qe(r)}},P=(e,t)=>e.stories.some(r=>r.id===t)||e.rules.some(r=>r.id===t)||e.examples.some(r=>r.id===t)||e.questions.some(r=>r.id===t),le=(e,t,r)=>e.stories.some(a=>a.id===t)?{...e,stories:e.stories.map(a=>a.id===t?r(a):a)}:null,pe=(e,t,r)=>e.rules.some(a=>a.id===t)?{...e,rules:e.rules.map(a=>a.id===t?r(a):a)}:null,ue=(e,t,r)=>e.examples.some(a=>a.id===t)?{...e,examples:e.examples.map(a=>a.id===t?r(a):a)}:null,ce=(e,t,r)=>e.questions.some(a=>a.id===t)?{...e,questions:e.questions.map(a=>a.id===t?r(a):a)}:null,me=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.storyId===t.storyId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.storyId===t.storyId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Q=(e,t,r)=>{const a=e.filter(l=>l.id!==t.id),n=a.filter(l=>l.ruleId===t.ruleId),o=r===null?[t,...n]:F(n,t,r),i=a.findIndex(l=>l.ruleId===t.ruleId),d=new Set(n.map(l=>l.id)),c=a.filter(l=>!d.has(l.id)),p=i<0?c.length:Math.min(i,c.length);return[...c.slice(0,p),...o,...c.slice(p)]},Ee=(e,t,r)=>{if(!e.some(o=>o.id===t)||r!==null&&!e.some(o=>o.id===r))return null;if(r===t)return[...e];const a=e.find(o=>o.id===t);if(a===void 0)return null;const n=e.filter(o=>o.id!==t);return F(n,a,r)},F=(e,t,r)=>{const a=[...e],n=r===null?-1:a.findIndex(o=>o.id===r);return a.splice(n+1,0,t),a},it={story:"Story",rule:"Rule",example:"Example",question:"Question"},dt={story:"\u30B9\u30C8\u30FC\u30EA\u30FC",rule:"\u30EB\u30FC\u30EB",example:"\u5177\u4F53\u4F8B",question:"\u8CEA\u554F"},st={empty:"No rules yet","open-questions":"Open questions","too-big":"Consider splitting",thin:"A rule has no example",ready:"Looks ready"},lt={empty:"\u30EB\u30FC\u30EB\u672A\u6574\u7406","open-questions":"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u3042\u308A","too-big":"\u5206\u5272\u3092\u691C\u8A0E",thin:"\u5177\u4F53\u4F8B\u306E\u7121\u3044\u30EB\u30FC\u30EB\u3042\u308A",ready:"\u5408\u610F\u3067\u304D\u305D\u3046"},C=Ce({en:{kindLabel:e=>it[e],readinessLabel:e=>st[e],map:"Map",cardKinds:"Card kinds",noStoriesTitle:"No stories yet",noStoriesBody:"Place one story (yellow), then line up the rules (blue) that accept it beneath it. For each rule, stack examples (green) in the top area and open questions (red) in the bottom area.",firstStory:"+ First story",addStoryButton:"+ Story",noExamples:"No examples yet",noQuestions:"No open questions",commentButton:"Comment",deleteButton:"Delete",nameField:e=>`${e} name`,newStory:"New story",newRule:"New rule",newExample:"New example",newQuestion:"New question",storyRenamedTitle:"Renamed the story",storyDescriptionUpdatedTitle:"Updated the story\u2019s description",storyReorderedTitle:"Reordered the story",storyAddedTitle:"Added a story",storyDeletedTitle:"Deleted the story",ruleRenamedTitle:"Renamed the rule",ruleDescriptionUpdatedTitle:"Updated the rule\u2019s description",ruleMovedTitle:"Moved the rule",ruleReorderedTitle:"Reordered the rule",ruleAddedTitle:"Added a rule",ruleDeletedTitle:"Deleted the rule",exampleRenamedTitle:"Renamed the example",exampleDescriptionUpdatedTitle:"Updated the example\u2019s description",exampleMovedTitle:"Moved the example",exampleReorderedTitle:"Reordered the example",exampleAddedTitle:"Added an example",exampleDeletedTitle:"Deleted the example",questionRenamedTitle:"Renamed the question",questionDescriptionUpdatedTitle:"Updated the question\u2019s description",questionMovedTitle:"Moved the question",questionReorderedTitle:"Reordered the question",questionAddedTitle:"Added a question",questionDeletedTitle:"Deleted the question",arrowTo:e=>`\u2192 \u201C${e}\u201D`,arrowFrom:(e,t)=>`\u201C${e}\u201D \u2192 \u201C${t}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,toTop:"\u2192 To the top",afterPlacement:e=>`\u2192 After \u201C${e}\u201D`,wholeMap:"Whole map"},ja:{kindLabel:e=>dt[e],readinessLabel:e=>lt[e],map:"\u30DE\u30C3\u30D7",cardKinds:"\u30AB\u30FC\u30C9\u306E\u7A2E\u985E",noStoriesTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noStoriesBody:"\u30B9\u30C8\u30FC\u30EA\u30FC\uFF08\u9EC4\uFF09\u30921\u679A\u7F6E\u304D\u3001\u305D\u306E\u4E0B\u306B\u53D7\u3051\u5165\u308C\u6761\u4EF6\u3068\u306A\u308B\u30EB\u30FC\u30EB\uFF08\u9752\uFF09\u3092\u4E26\u3079\u307E\u3059\u3002\u30EB\u30FC\u30EB\u3054\u3068\u306B\u3001\u4E0A\u306E\u6B04\u3078\u5177\u4F53\u4F8B\uFF08\u7DD1\uFF09\u3092\u3001\u4E0B\u306E\u6B04\u3078\u7B54\u3048\u306E\u51FA\u306A\u3044\u8AD6\u70B9\u3092\u8CEA\u554F\uFF08\u8D64\uFF09\u3068\u3057\u3066\u7A4D\u307F\u307E\u3059\u3002",firstStory:"+ \u6700\u521D\u306E\u30B9\u30C8\u30FC\u30EA\u30FC",addStoryButton:"+ \u30B9\u30C8\u30FC\u30EA\u30FC",noExamples:"\u5177\u4F53\u4F8B\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noQuestions:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",nameField:e=>`${e}\u540D`,newStory:"\u65B0\u3057\u3044\u30B9\u30C8\u30FC\u30EA\u30FC",newRule:"\u65B0\u3057\u3044\u30EB\u30FC\u30EB",newExample:"\u65B0\u3057\u3044\u5177\u4F53\u4F8B",newQuestion:"\u65B0\u3057\u3044\u8CEA\u554F",storyRenamedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u540D\u3092\u5909\u66F4",storyDescriptionUpdatedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u8AAC\u660E\u3092\u66F4\u65B0",storyReorderedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u306E\u9806\u5E8F\u3092\u5909\u66F4",storyAddedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u8FFD\u52A0",storyDeletedTitle:"\u30B9\u30C8\u30FC\u30EA\u30FC\u3092\u524A\u9664",ruleRenamedTitle:"\u30EB\u30FC\u30EB\u540D\u3092\u5909\u66F4",ruleDescriptionUpdatedTitle:"\u30EB\u30FC\u30EB\u306E\u8AAC\u660E\u3092\u66F4\u65B0",ruleMovedTitle:"\u30EB\u30FC\u30EB\u3092\u79FB\u52D5",ruleReorderedTitle:"\u30EB\u30FC\u30EB\u306E\u9806\u5E8F\u3092\u5909\u66F4",ruleAddedTitle:"\u30EB\u30FC\u30EB\u3092\u8FFD\u52A0",ruleDeletedTitle:"\u30EB\u30FC\u30EB\u3092\u524A\u9664",exampleRenamedTitle:"\u5177\u4F53\u4F8B\u540D\u3092\u5909\u66F4",exampleDescriptionUpdatedTitle:"\u5177\u4F53\u4F8B\u306E\u8AAC\u660E\u3092\u66F4\u65B0",exampleMovedTitle:"\u5177\u4F53\u4F8B\u3092\u79FB\u52D5",exampleReorderedTitle:"\u5177\u4F53\u4F8B\u306E\u9806\u5E8F\u3092\u5909\u66F4",exampleAddedTitle:"\u5177\u4F53\u4F8B\u3092\u8FFD\u52A0",exampleDeletedTitle:"\u5177\u4F53\u4F8B\u3092\u524A\u9664",questionRenamedTitle:"\u8CEA\u554F\u540D\u3092\u5909\u66F4",questionDescriptionUpdatedTitle:"\u8CEA\u554F\u306E\u8AAC\u660E\u3092\u66F4\u65B0",questionMovedTitle:"\u8CEA\u554F\u3092\u79FB\u52D5",questionReorderedTitle:"\u8CEA\u554F\u306E\u9806\u5E8F\u3092\u5909\u66F4",questionAddedTitle:"\u8CEA\u554F\u3092\u8FFD\u52A0",questionDeletedTitle:"\u8CEA\u554F\u3092\u524A\u9664",arrowTo:e=>`\u2192 \u300C${e}\u300D`,arrowFrom:(e,t)=>`\u300C${e}\u300D\u2192\u300C${t}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,toTop:"\u2192 \u5148\u982D\u3078",afterPlacement:e=>`\u2192 \u300C${e}\u300D\u306E\u76F4\u5F8C\u3078`,wholeMap:"\u30DE\u30C3\u30D7\u5168\u4F53"}}),X=(e,t,r)=>{const a=typeof r=="string"?r:"",n=typeof t=="string"?t:void 0;return n===void 0?e.arrowTo(a):e.arrowFrom(n,a)},pt={SET_STORY_NAME:(e,t,r)=>({title:e.storyRenamedTitle,tone:"update",body:X(e,T(r,t.target.id)?.name,g(u.SET_STORY_NAME,t).name??"")}),SET_STORY_DESCRIPTION:(e,t)=>({title:e.storyDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_STORY_DESCRIPTION,t).description??"").slice(0,90))}),REORDER_STORY:(e,t)=>({title:e.storyReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_STORY,t).after)}),ADD_STORY:(e,t)=>({title:e.storyAddedTitle,tone:"create",body:e.added(String(g(u.ADD_STORY,t).name??""))}),DELETE_STORY:(e,t,r)=>({title:e.storyDeletedTitle,tone:"delete",body:e.deleted(T(r,t.target.id)?.name??t.target.id)}),SET_RULE_NAME:(e,t,r)=>({title:e.ruleRenamedTitle,tone:"update",body:X(e,y(r,t.target.id)?.name,g(u.SET_RULE_NAME,t).name??"")}),SET_RULE_DESCRIPTION:(e,t)=>({title:e.ruleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_RULE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_RULE:(e,t,r)=>({title:e.ruleMovedTitle,tone:"move",body:e.arrowTo(T(r,String(g(u.MOVE_RULE,t).storyId))?.name??String(g(u.MOVE_RULE,t).storyId??""))}),REORDER_RULE:(e,t)=>({title:e.ruleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_RULE,t).after)}),ADD_RULE:(e,t)=>({title:e.ruleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_RULE,t).name??""))}),DELETE_RULE:(e,t,r)=>({title:e.ruleDeletedTitle,tone:"delete",body:e.deleted(y(r,t.target.id)?.name??t.target.id)}),SET_EXAMPLE_NAME:(e,t,r)=>({title:e.exampleRenamedTitle,tone:"update",body:X(e,b(r,t.target.id)?.name,g(u.SET_EXAMPLE_NAME,t).name??"")}),SET_EXAMPLE_DESCRIPTION:(e,t)=>({title:e.exampleDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_EXAMPLE_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_EXAMPLE:(e,t,r)=>({title:e.exampleMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_EXAMPLE,t).ruleId))?.name??String(g(u.MOVE_EXAMPLE,t).ruleId??""))}),REORDER_EXAMPLE:(e,t)=>({title:e.exampleReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_EXAMPLE,t).after)}),ADD_EXAMPLE:(e,t)=>({title:e.exampleAddedTitle,tone:"create",body:e.added(String(g(u.ADD_EXAMPLE,t).name??""))}),DELETE_EXAMPLE:(e,t,r)=>({title:e.exampleDeletedTitle,tone:"delete",body:e.deleted(b(r,t.target.id)?.name??t.target.id)}),SET_QUESTION_NAME:(e,t,r)=>({title:e.questionRenamedTitle,tone:"update",body:X(e,R(r,t.target.id)?.name,g(u.SET_QUESTION_NAME,t).name??"")}),SET_QUESTION_DESCRIPTION:(e,t)=>({title:e.questionDescriptionUpdatedTitle,tone:"update",body:e.arrowTo(String(g(u.SET_QUESTION_DESCRIPTION,t).description??"").slice(0,90))}),MOVE_QUESTION:(e,t,r)=>({title:e.questionMovedTitle,tone:"move",body:e.arrowTo(y(r,String(g(u.MOVE_QUESTION,t).ruleId))?.name??String(g(u.MOVE_QUESTION,t).ruleId??""))}),REORDER_QUESTION:(e,t)=>({title:e.questionReorderedTitle,tone:"move",body:Y(e,g(u.REORDER_QUESTION,t).after)}),ADD_QUESTION:(e,t)=>({title:e.questionAddedTitle,tone:"create",body:e.added(String(g(u.ADD_QUESTION,t).name??""))}),DELETE_QUESTION:(e,t,r)=>({title:e.questionDeletedTitle,tone:"delete",body:e.deleted(R(r,t.target.id)?.name??t.target.id)})},Y=(e,t)=>t==null?e.toTop:e.afterPlacement(t),ge=(e,t,r,a)=>{let n;try{const o=pt[t.type];n=o?o(e,t,a??r):{title:t.type,tone:"meta"}}catch{n={title:t.type,tone:"meta"}}return{title:n.title,targetLabel:xe(e,r,t.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ye=e=>`${e.type} ${I(e.target)} ${JSON.stringify(e.payload)}`,xe=(e,t,r)=>{try{switch(r.type){case"story":{const a=T(t,r.id);return a?`${e.kindLabel("story")} \xB7 ${a.name}`:`${e.kindLabel("story")} \xB7 ${r.id} (missing)`}case"rule":{const a=y(t,r.id);return a?`${e.kindLabel("rule")} \xB7 ${a.name}`:`${e.kindLabel("rule")} \xB7 ${r.id} (missing)`}case"example":{const a=b(t,r.id);return a?`${e.kindLabel("example")} \xB7 ${a.name}`:`${e.kindLabel("example")} \xB7 ${r.id} (missing)`}case"question":{const a=R(t,r.id);return a?`${e.kindLabel("question")} \xB7 ${a.name}`:`${e.kindLabel("question")} \xB7 ${r.id} (missing)`}case"page":return`${e.map} \xB7 ${j(t)}`;default:return`${r.type} \xB7 ${r.id}`}}catch{return`${r.type} \xB7 ${r.id}`}},he=(e,t,r)=>{const a=[{value:"page:example-mapping",label:e.wholeMap,group:e.map}];for(const n of t.stories)a.push({value:I({type:"story",id:n.id}),label:n.name,group:e.kindLabel("story")});for(const n of t.rules){const o=T(t,n.storyId);a.push({value:I({type:"rule",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("rule")})}for(const n of t.examples){const o=y(t,n.ruleId);a.push({value:I({type:"example",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("example")})}for(const n of t.questions){const o=y(t,n.ruleId);a.push({value:I({type:"question",id:n.id}),label:o?`${o.name} \u203A ${n.name}`:n.name,group:e.kindLabel("question")})}return a},fe=(e,t,r)=>{const a=L(t,r.card);return a?{value:I({type:a.kind,id:a.id}),label:a.name,group:e.kindLabel(a.kind)}:null},ut=4,Te=(e,t,r)=>{const a=t.rules.filter(p=>p.storyId===r),n=new Set(a.map(p=>p.id)),o=t.examples.filter(p=>n.has(p.ruleId)),i=t.questions.filter(p=>n.has(p.ruleId)).length,d=a.some(p=>!o.some(l=>l.ruleId===p.id)),c=a.length===0?"empty":i>0?"open-questions":a.length>ut?"too-big":d?"thin":"ready";return{rules:a.length,examples:o.length,questions:i,readiness:c,label:e.readinessLabel(c)}},j=e=>e.title??"Example Mapping",be=(e,t)=>{const r=L(e,t.card),a={...t};return r?a.card=r.id:delete a.card,a},Re=(e,t)=>{switch(t.type){case"story":case"rule":case"example":case"question":return L(e,t.id)?.kind===t.type;case"page":return!0;default:return!1}},Se=e=>{const t=C(e);return{name:"example-mapping",label:"Example Mapping",parseBase:te,emptyBase:re,actions:u,apply:se,canonicalState:at,hasTarget:Re,describe:(r,a,n)=>ge(t,r,a,n),serialize:ye,resolveNavigation:be,navigationFor:(r,a)=>L(r,a.id)?.kind===a.type?{card:a.id}:null,commentTargets:(r,a)=>he(t,r),currentTarget:(r,a)=>fe(t,r,a),title:j}},B=(e,t,r)=>{const a=Xe(t,ie(e.state));return e.dispatch(r(a)).ok?(e.navigate({card:a}),a):null},ct=(e,t)=>B(e,"new-story",r=>w.addStory(r,t.newStory)),mt=(e,t,r)=>B(e,"new-rule",a=>w.addRule(r,a,t.newRule)),Et=(e,t,r)=>B(e,"new-example",a=>w.addExample(r,a,t.newExample)),gt=(e,t,r)=>B(e,"new-question",a=>w.addQuestion(r,a,t.newQuestion)),yt={width:300,height:260},ve=["story","rule","example","question"],_e={story:{bg:"linear-gradient(178deg, #fff3a6, #fde77a)",ink:"#4a3a06"},rule:{bg:"linear-gradient(178deg, #a3d1f5, #7cb8ea)",ink:"#0e2c4b"},example:{bg:"linear-gradient(178deg, #c9eb95, #a8dc63)",ink:"#22380a"},question:{bg:"linear-gradient(178deg, #fbc6d9, #f4a0c0)",ink:"#4b1029"}},O=e=>{const{bg:t,ink:r}=_e[e];return`--em-card-bg:${t};--em-card-ink:${r}`},xt=W`
|
|
2
2
|
:host {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: flex;
|
|
@@ -134,7 +134,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
134
134
|
background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
|
|
135
135
|
box-shadow: var(--dpk-shadow-xs);
|
|
136
136
|
}
|
|
137
|
-
`;class ht extends Ye{static{this.styles=[Be,xt,Ve]}static{this.properties={card:{attribute:!1},notes:{attribute:!1},tilt:{attribute:!1},mode:{type:String,reflect:!0,attribute:"data-mode"},focused:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},onIntent:{attribute:!1}}}#r="";#n=new ze(this);#e=new
|
|
137
|
+
`;class ht extends Ye{static{this.styles=[Be,xt,Ve]}static{this.properties={card:{attribute:!1},notes:{attribute:!1},tilt:{attribute:!1},mode:{type:String,reflect:!0,attribute:"data-mode"},focused:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},onIntent:{attribute:!1}}}#r="";#n=new ze(this);#e=new Ke(this);constructor(){super(),this.card=null,this.notes=[],this.tilt=0,this.mode="view",this.focused=!1,this.dragging=!1,this.onIntent=null,this.addEventListener("click",()=>this.#t({kind:"select"})),this.addEventListener("focusin",()=>this.draggable=!1),this.addEventListener("focusout",()=>this.draggable=!0)}updated(t){if(t.has("card")&&this.card){const{bg:n,ink:o}=_e[this.card.kind];this.setAttribute("data-kind",this.card.kind),this.style.setProperty("--em-card-bg",n),this.style.setProperty("--em-card-ink",o)}if(t.has("tilt")&&this.style.setProperty("--em-tilt",`${this.tilt}deg`),t.has("mode")&&(this.mode!=="commenting"&&(this.#r=""),this.mode==="editing"&&this.renderRoot.querySelector("dpk-component-inline-edit")?.startEditing()),this.mode!=="commenting")return;const r=this.renderRoot.querySelector(".comment-pop"),a=this.renderRoot.querySelector('[data-role="comment"]');r&&a&&this.#n.open(r,a,yt)}render(){const t=this.card;if(!t)return $;const r=C(this.#e.locale),a=r.kindLabel(t.kind);return f`
|
|
138
138
|
<div class="card-kind">${a}</div>
|
|
139
139
|
<dpk-component-inline-edit
|
|
140
140
|
class="card-name"
|
|
@@ -142,7 +142,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
142
142
|
?seamless=${!0}
|
|
143
143
|
.value=${t.name}
|
|
144
144
|
.label=${r.nameField(a)}
|
|
145
|
-
@dpk-commit=${
|
|
145
|
+
@dpk-commit=${Fe(n=>this.#t({kind:"rename",name:n}))}
|
|
146
146
|
></dpk-component-inline-edit>
|
|
147
147
|
${t.description?f`<div class="card-text">${t.description}</div>`:$}
|
|
148
148
|
${this.notes.length>0?f`<span class="card-flag">${this.notes.length}</span>`:$}
|
|
@@ -168,7 +168,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
168
168
|
</button>
|
|
169
169
|
</div>
|
|
170
170
|
${this.mode==="commenting"?this.#o(t):$}
|
|
171
|
-
`}#o(t){return
|
|
171
|
+
`}#o(t){return Ge(et(this.#e.locale),Ze(this.#r,this.notes.map(He),{label:t.name,key:`card:${t.id}`}),r=>{r.kind==="input"?(this.#r=r.body,this.requestUpdate()):r.kind!=="choose"&&this.#t(r)})}#a(t){return r=>{r.stopPropagation(),this.#t(t)}}#t(t){this.onIntent?.(t)}}const ft=()=>{customElements.get("dpk-internal-example-mapping-card")||customElements.define("dpk-internal-example-mapping-card",ht)},Tt=(e,t,r)=>{const a=e.at(-1)??null;if(t===null||r==="end")return a;const n=e.indexOf(t);return n<0?a:r==="after"?t:n===0?null:e.at(n-1)??null},ke=(e,t,r,a)=>{if(!T(e,t))return null;const n=e.stories.map(o=>o.id);return{type:"REORDER_STORY",target:{type:"story",id:t},payload:{after:U(n,t,r,a)}}},De=(e,t,r,a,n)=>{if(!T(e,t)||!y(e,r))return null;const o=e.rules.filter(i=>i.storyId===t).map(i=>i.id);return{type:"MOVE_RULE",target:{type:"rule",id:r},payload:{storyId:t,after:U(o,r,a,n)}}},Ie=(e,t,r,a,n)=>{if(!y(e,t)||!b(e,r))return null;const o=e.examples.filter(i=>i.ruleId===t).map(i=>i.id);return{type:"MOVE_EXAMPLE",target:{type:"example",id:r},payload:{ruleId:t,after:U(o,r,a,n)}}},Oe=(e,t,r,a,n)=>{if(!y(e,t)||!R(e,r))return null;const o=e.questions.filter(i=>i.ruleId===t).map(i=>i.id);return{type:"MOVE_QUESTION",target:{type:"question",id:r},payload:{ruleId:t,after:U(o,r,a,n)}}},V={kind:"idle"},J=(e,t)=>e.kind!=="idle"&&e.cardId===t,$e=(e,t)=>J(e,t)&&(e.kind==="editing"||e.kind==="commenting")?e.kind:"view",we=(e,t,r)=>{switch(r.kind){case"toggle-comment":return e.kind==="commenting"&&e.cardId===t?V:{kind:"commenting",cardId:t};case"rename":case"comment":case"dismiss":case"delete":return J(e,t)?V:e;case"select":return e}},bt=(e,t)=>{if(e==="story")return 0;let r=0;for(const a of t)r=r*31+a.charCodeAt(0)|0;return(Math.abs(r)%5-2)*.45},Rt=e=>f`<ul class="legend" aria-label=${e.cardKinds}>
|
|
172
172
|
${ve.map(t=>f`<li><span class="legend-swatch" style=${O(t)}></span>${e.kindLabel(t)}</li>`)}
|
|
173
173
|
</ul>`,St=e=>{const{context:t,handlers:r,m:a}=e;return t.state.stories.length===0?f`
|
|
174
174
|
<div class="empty">
|
|
@@ -178,10 +178,10 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
178
178
|
</div>
|
|
179
179
|
`:f`
|
|
180
180
|
<div class="board" data-testid="example-mapping-board">
|
|
181
|
-
${
|
|
181
|
+
${K(t.state.stories,n=>n.id,n=>vt(e,n))}
|
|
182
182
|
<button class="add-story" type="button" @click=${r.addStory}>${a.addStoryButton}</button>
|
|
183
183
|
</div>
|
|
184
|
-
`},
|
|
184
|
+
`},H=(e,t,r)=>{const{context:a,mode:n,drag:o,handlers:i}=e,d=a.comments.filter(p=>p.target.type===t&&p.target.id===r.id),c=o.source({type:t,id:r.id});return f`<dpk-internal-example-mapping-card
|
|
185
185
|
data-card=${r.id}
|
|
186
186
|
data-card-kind=${t}
|
|
187
187
|
data-dpk-target=${I({type:t,id:r.id})}
|
|
@@ -206,7 +206,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
206
206
|
@drop=${c.drop}
|
|
207
207
|
>
|
|
208
208
|
<header class="story-row">
|
|
209
|
-
<div class="story-slot">${
|
|
209
|
+
<div class="story-slot">${H(e,"story",t)}</div>
|
|
210
210
|
<div class="story-meta">
|
|
211
211
|
<span class="readiness" data-readiness=${i.readiness}>${i.label}</span>
|
|
212
212
|
<span class="tally"
|
|
@@ -231,7 +231,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
231
231
|
@dragleave=${l.dragleave}
|
|
232
232
|
@drop=${l.drop}
|
|
233
233
|
>
|
|
234
|
-
${
|
|
234
|
+
${K(ae(r.state,t.id),v=>v.id,v=>_t(e,v))}
|
|
235
235
|
<button class="add-rule" type="button" @click=${()=>n.addRule(t.id)}>
|
|
236
236
|
<span class="add-plus">+</span>${o.kindLabel("rule")}
|
|
237
237
|
</button>
|
|
@@ -239,7 +239,7 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
239
239
|
</section>
|
|
240
240
|
`},_t=(e,t)=>{const{drag:r}=e;return f`
|
|
241
241
|
<div class="rule-col" data-rule=${t.id} ?data-dragging=${r.isDragging("rule",t.id)}>
|
|
242
|
-
${
|
|
242
|
+
${H(e,"rule",t)} ${Le(e,t.id,"example")}
|
|
243
243
|
${Le(e,t.id,"question")}
|
|
244
244
|
</div>
|
|
245
245
|
`},kt={example:"examples",question:"questions"},Dt=(e,t)=>({testid:kt[t],label:e.kindLabel(t),empty:t==="example"?e.noExamples:e.noQuestions,add:`+ ${e.kindLabel(t)}`}),Le=(e,t,r)=>{const{context:a,drag:n,handlers:o,m:i}=e,d=Dt(i,r),c=`${d.testid}:${t}`,p=r==="example"?n.target({key:c,accepts:"example",hovered:Ae("example"),onDrop:_=>o.dropExample(t,_)}):n.target({key:c,accepts:"question",hovered:Ae("question"),onDrop:_=>o.dropQuestion(t,_)}),l=r==="example"?ne(a.state,t):oe(a.state,t),v=r==="example"?o.addExample:o.addQuestion;return f`<div
|
|
@@ -252,10 +252,10 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
252
252
|
@drop=${p.drop}
|
|
253
253
|
>
|
|
254
254
|
<h3 class="area-label"><i class="tally-dot" style=${O(r)}></i>${d.label}</h3>
|
|
255
|
-
${
|
|
255
|
+
${K(l,_=>_.id,_=>H(e,r,_))}
|
|
256
256
|
${l.length===0?f`<p class="stack-hint">${d.empty}</p>`:$}
|
|
257
257
|
<button class="add-card add-${r}" type="button" @click=${()=>v(t)}>${d.add}</button>
|
|
258
|
-
</div>`},Ae=e=>t=>{const r=t.target instanceof Element?t.target.closest("dpk-internal-example-mapping-card"):null;return!r||r.getAttribute("data-card-kind")!==e?null:{id:r.getAttribute("data-card"),element:r}},Me=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},It=
|
|
258
|
+
</div>`},Ae=e=>t=>{const r=t.target instanceof Element?t.target.closest("dpk-internal-example-mapping-card"):null;return!r||r.getAttribute("data-card-kind")!==e?null:{id:r.getAttribute("data-card"),element:r}},Me=(e,t)=>r=>{const a=r.target instanceof Element?r.target.closest(e):null;return a?{id:a.getAttribute(`data-${t}`),element:a}:null},It=W`
|
|
259
259
|
/* ------------------------------------------------------------ legend */
|
|
260
260
|
|
|
261
261
|
.legend {
|
|
@@ -567,6 +567,6 @@ import{p as m,av as E,v as A,aB as k,aC as S,ai as s,ak as x,al as h,ay as D,aM
|
|
|
567
567
|
color: var(--dpk-ink-soft);
|
|
568
568
|
line-height: 1.7;
|
|
569
569
|
}
|
|
570
|
-
`,Ot={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},$t={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class qe extends
|
|
570
|
+
`,Ot={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},$t={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"};class qe extends G{static{this.styles=[G.styles,It]}definitionFor(t){return Se(t)}static{this.properties={mode:{state:!0}}}#r=new We(this);constructor(){super(),this.mode=V}renderRegions(t){const r=C(this.locale);return{header:Rt(r),main:this.#n(t,r)}}#n(t,r){return f`
|
|
571
571
|
${St({context:t,mode:this.mode,drag:this.#r,m:r,handlers:{cardIntent:(a,n,o)=>this.#o(a,n,o),addStory:()=>this.#e(ct(t,r)),addRule:a=>this.#e(mt(t,r,a)),addExample:a=>this.#e(Et(t,r,a)),addQuestion:a=>this.#e(gt(t,r,a)),dropStory:a=>this.#a(a),dropRule:(a,n)=>this.#t(a,n),dropExample:(a,n)=>this.#d(a,n),dropQuestion:(a,n)=>this.#s(a,n)}})}
|
|
572
572
|
`}#e(t){t!==null&&(this.mode={kind:"editing",cardId:t})}#o(t,r,a){const n=this.context();switch(a.kind){case"select":n.navigate({card:t});break;case"rename":n.dispatch({type:Ot[r],target:{type:r,id:t},payload:{name:a.name}});break;case"comment":n.dispatch({type:"comment",target:`${r}:${t}`,payload:{body:a.body}});break;case"delete":n.dispatch({type:$t[r],target:{type:r,id:t},payload:{}}),n.navigation.card===t&&n.navigate({card:null});break}this.mode=we(this.mode,t,a)}#a(t){const r=this.context(),a=ke(r.state,t.item.id,t.hoveredId,t.place);a&&r.dispatch(a)}#t(t,r){const a=this.context(),n=this.#i(r.hoveredId,r.event.clientX,r.place),o=De(a.state,t,r.item.id,r.hoveredId,n);o&&a.dispatch(o)}#i(t,r,a){if(t===null)return a;const n=this.renderRoot.querySelector(`.rule-col[data-rule="${t}"]`);if(!n)return a;const o=n.getBoundingClientRect();return r<=o.left+o.width/2?"before":"after"}#d(t,r){const a=this.context(),n=Ie(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}#s(t,r){const a=this.context(),n=Oe(a.state,t,r.item.id,r.hoveredId,r.place);n&&a.dispatch(n)}}const Ne=()=>{ft(),customElements.get("dpk-template-example-mapping")||customElements.define("dpk-template-example-mapping",qe)},wt=Object.freeze(Object.defineProperty({__proto__:null,CARD_KINDS:ve,DpkTemplateExampleMapping:qe,IDLE_MODE:V,allMappingIds:ie,applyExampleMappingAction:se,cardModeOf:$e,cardPaletteStyle:O,defineExampleMappingElement:Ne,describeExampleMappingAction:ge,dropAfter:Tt,emptyExampleMappingBase:re,exampleMappingAction:w,exampleMappingActions:u,exampleMappingBaseSchema:ee,exampleMappingCommentTargets:he,exampleMappingCurrentTarget:fe,exampleMappingDefinitionFor:Se,exampleMappingHasTarget:Re,exampleMappingMessages:C,exampleMappingTargetLabel:xe,exampleMappingTitle:j,examplesOfRule:ne,findCard:L,findExample:b,findQuestion:R,findRule:y,findStory:T,modeConcerns:J,parseExampleMappingBase:te,presentStorySummary:Te,questionsOfRule:oe,reduceCardIntent:we,reorderById:Ee,resolveExampleDrop:Ie,resolveExampleMappingNavigation:be,resolveQuestionDrop:Oe,resolveRuleDrop:De,resolveStoryDrop:ke,rulesOfStory:ae,serializeExampleMappingAction:ye,storyIdOfCard:nt,storyIdOfExample:ot,storyIdOfRule:de},Symbol.toStringTag,{value:"Module"}));export{Ne as d,wt as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b5 as t,b6 as a,a3 as i,b7 as n}from"./shared-DnJBtKmH.js";const o=t(class extends a{constructor(){super(...arguments),this.key=i}render(s,e){return this.key=s,e}update(s,[e,r]){return e!==this.key&&(n(s),this.key=e),r}});export{o as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a0 as _,ae as N,af as f,ag as c,ah as k,ai as p,
|
|
1
|
+
import{a0 as _,ae as N,af as f,ag as c,ah as k,ai as p,aG as G,ak as R,al as Y,aj as I,V as u,C as v,h as U,a5 as x,a3 as d,a4 as l,b8 as J,ar as V,ac as W,A as Q,a2 as X,T as w}from"./shared-DnJBtKmH.js";const m=_({en:{wholeDeck:"Whole deck",slideGroup:"Slide",outline:"Slides",previous:"Previous slide",next:"Next slide",position:(t,e)=>`Slide ${t} of ${e}`,commentOnSlide:"Comment on this slide",commentPlaceholder:"A question, or what should change (passed to the agent)",addComment:"Add comment",deleteComment:"Delete this comment",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"Full screen",fullscreenHint:"\u2190 \u2192 to move \xB7 Esc to leave",noSlidesBefore:"There are no slides yet. Add them to ",noSlidesAfter:" in the base data."},ja:{wholeDeck:"\u30C7\u30C3\u30AD\u5168\u4F53",slideGroup:"\u30B9\u30E9\u30A4\u30C9",outline:"\u30B9\u30E9\u30A4\u30C9",previous:"\u524D\u306E\u30B9\u30E9\u30A4\u30C9",next:"\u6B21\u306E\u30B9\u30E9\u30A4\u30C9",position:(t,e)=>`${e} \u679A\u4E2D ${t} \u679A\u76EE`,commentOnSlide:"\u3053\u306E\u30B9\u30E9\u30A4\u30C9\u306B\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u8CEA\u554F\u3084\u3001\u5909\u3048\u3066\u307B\u3057\u3044\u3053\u3068\uFF08Agent \u306B\u6E21\u308B\uFF09",addComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",deleteComment:"\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",submitHint:"\u2318 / Ctrl + Enter",fullscreen:"\u5168\u753B\u9762\u8868\u793A",fullscreenHint:"\u2190 \u2192 \u3067\u79FB\u52D5 \xB7 Esc \u3067\u623B\u308B",noSlidesBefore:"\u30B9\u30E9\u30A4\u30C9\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base data \u306E ",noSlidesAfter:" \u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),y=["title","section","content"],Z=f({id:G,layout:c(I(y),"content"),title:R(p(),Y(1)),subtitle:c(p(),""),points:c(k(p()),[])}),$=f({title:c(p(),""),slides:c(k(Z),[])}),S=t=>{const e=N($,t),i=new Set;for(const s of e.slides){if(i.has(s.id))throw new Error(`duplicate slide id: ${s.id}`);i.add(s.id)}return{title:e.title,slides:e.slides}},C=()=>({title:"",slides:[]}),r=(t,e)=>e===void 0?-1:t.slides.findIndex(i=>i.id===e),T=(t,e)=>t.slides[r(t,e)],q=t=>t.title===""?"Slides":t.title,h=(t,e)=>`${e+1}. ${t.title}`,E=(t,e,i)=>{switch(i.type){case"slide":{const s=r(e,i.id),n=e.slides[s];return n===void 0?i.id:h(n,s)}case"page":return t.wholeDeck;default:return i.id}},A=(t,e,i)=>({title:e.type,targetLabel:E(t,i,e.target),tone:"meta"}),z=t=>`${t.type} ${u(t.target)} ${JSON.stringify(t.payload)}`,D=(t,e)=>e.slides.map((i,s)=>({value:u({type:"slide",id:i.id}),label:h(i,s),group:t.slideGroup})),M=(t,e,i)=>{const s=r(e,i.slide),n=e.slides[s];return n===void 0?null:{value:u({type:"slide",id:n.id}),label:h(n,s),group:t.slideGroup}},F=(t,e)=>{const i=t.slides[r(t,e.slide)]??t.slides[0],s={...e};return i?s.slide=i.id:delete s.slide,s},H=(t,e)=>{const i=r(t,e.slide),s=i===-1?0:i,n=t.slides[s];return n===void 0?null:{slide:n,index:s,total:t.slides.length,previous:t.slides[s-1],next:t.slides[s+1]}},ee=(t,e)=>t.filter(i=>i.type===v&&i.target.type==="slide"&&i.target.id===e).map(i=>({id:i.id,body:U(i)})).filter(i=>i.body!==""),L=(t,e)=>{switch(e.type){case"slide":return T(t,e.id)!==void 0;case"page":return!0;default:return!1}},O=t=>{const e=m(t);return{name:"slides",label:"Slides",parseBase:S,emptyBase:C,actions:{},apply:()=>null,hasTarget:L,describe:(i,s)=>A(e,i,s),serialize:z,resolveNavigation:F,navigationFor:(i,s)=>s.type==="slide"?{slide:s.id}:null,commentTargets:i=>D(e,i),currentTarget:(i,s)=>M(e,i,s),title:q}},te={ArrowRight:"next",PageDown:"next",ArrowLeft:"previous",PageUp:"previous",Home:"first",End:"last"},P=t=>t.altKey===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0?null:te[t.key]??null,j=(t,e,i)=>{const s=t.slides.length-1;if(s<0)return;const n=Math.max(r(t,e),0),o={next:Math.min(n+1,s),previous:Math.max(n-1,0),first:0,last:s}[i];return t.slides[o]?.id},ie=(t,e)=>{const{state:i,navigation:s}=t,n=s.slide;return l`
|
|
2
2
|
<nav class="outline" aria-label=${e.outline}>
|
|
3
3
|
<div class="outline-head">
|
|
4
4
|
<span class="dpk-label">${e.outline}</span>
|
|
@@ -601,4 +601,4 @@ import{a0 as _,ae as N,af as f,ag as c,ah as k,ai as p,aB as R,ak as G,al as Y,a
|
|
|
601
601
|
transition: none;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
`,de='input, textarea, select, [contenteditable]:not([contenteditable="false"])',re=t=>t instanceof HTMLElement&&(t.isContentEditable||t.matches(de));class B extends w{static{this.styles=[w.styles,le]}#e=new Map;#t={slide:"",count:0};definitionFor(e){return O(e)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.#n)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#n)}renderRegions(e){const i=m(this.locale);return{sidebar:ie(e,i),sidebarHidden:e.state.slides.length===0,main:se(e,i,{canFullscreen:document.fullscreenEnabled===!0,draftFor:s=>this.#e.get(s)??"",onStep:s=>this.#i(s),onFullscreen:()=>this.#l(),onDraft:(s,n)=>this.#s(s,n),onComment:s=>this.#o(s),onDeleteComment:s=>this.removeAction(s)})}}updated(){super.updated(),this.#a()}#a(){const e=this.renderRoot.querySelector(".slide-comment-list"),i={slide:this.navigation.slide??"",count:e?.childElementCount??0},s=this.#t;this.#t=i,!(e===null||i.slide===s.slide&&i.count<=s.count)&&(e.scrollTop=e.scrollHeight)}#i(e){const i=j(this.derivation.state,this.navigation.slide,e);i!==void 0&&this.navigate({slide:i})}#s(e,i){const s=new Map(this.#e);i===""?s.delete(e):s.set(e,i),this.#e=s,this.requestUpdate()}#o(e){const i=(this.#e.get(e)??"").trim();if(i==="")return;this.dispatch({type:v,target:{type:"slide",id:e},payload:{body:i}}).ok&&this.#s(e,"")}#l(){const e=this.renderRoot.querySelector(".stage");!(e instanceof HTMLElement)||document.fullscreenElement!==null||e.requestFullscreen().catch(()=>{})}#n=e=>{if(e.defaultPrevented)return;const i=P(e);i===null||e.composedPath().some(re)||(e.preventDefault(),this.#i(i))}}const K=()=>{customElements.get("dpk-template-slides")||customElements.define("dpk-template-slides",B)},ce=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateSlides:B,SLIDE_LAYOUTS:y,defineSlidesElement:K,describeSlidesAction:
|
|
604
|
+
`,de='input, textarea, select, [contenteditable]:not([contenteditable="false"])',re=t=>t instanceof HTMLElement&&(t.isContentEditable||t.matches(de));class B extends w{static{this.styles=[w.styles,le]}#e=new Map;#t={slide:"",count:0};definitionFor(e){return O(e)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.#n)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#n)}renderRegions(e){const i=m(this.locale);return{sidebar:ie(e,i),sidebarHidden:e.state.slides.length===0,main:se(e,i,{canFullscreen:document.fullscreenEnabled===!0,draftFor:s=>this.#e.get(s)??"",onStep:s=>this.#i(s),onFullscreen:()=>this.#l(),onDraft:(s,n)=>this.#s(s,n),onComment:s=>this.#o(s),onDeleteComment:s=>this.removeAction(s)})}}updated(){super.updated(),this.#a()}#a(){const e=this.renderRoot.querySelector(".slide-comment-list"),i={slide:this.navigation.slide??"",count:e?.childElementCount??0},s=this.#t;this.#t=i,!(e===null||i.slide===s.slide&&i.count<=s.count)&&(e.scrollTop=e.scrollHeight)}#i(e){const i=j(this.derivation.state,this.navigation.slide,e);i!==void 0&&this.navigate({slide:i})}#s(e,i){const s=new Map(this.#e);i===""?s.delete(e):s.set(e,i),this.#e=s,this.requestUpdate()}#o(e){const i=(this.#e.get(e)??"").trim();if(i==="")return;this.dispatch({type:v,target:{type:"slide",id:e},payload:{body:i}}).ok&&this.#s(e,"")}#l(){const e=this.renderRoot.querySelector(".stage");!(e instanceof HTMLElement)||document.fullscreenElement!==null||e.requestFullscreen().catch(()=>{})}#n=e=>{if(e.defaultPrevented)return;const i=P(e);i===null||e.composedPath().some(re)||(e.preventDefault(),this.#i(i))}}const K=()=>{customElements.get("dpk-template-slides")||customElements.define("dpk-template-slides",B)},ce=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateSlides:B,SLIDE_LAYOUTS:y,defineSlidesElement:K,describeSlidesAction:A,emptySlidesBase:C,findSlide:T,findSlideIndex:r,parseSlidesBase:S,resolveSlidesNavigation:F,serializeSlidesAction:z,slideKeyStep:P,slidePosition:H,slidesBaseSchema:$,slidesCommentTargets:D,slidesCurrentTarget:M,slidesDefinitionFor:O,slidesHasTarget:L,slidesMessages:m,slidesTargetLabel:E,slidesTitle:q,stepSlide:j},Symbol.toStringTag,{value:"Module"}));export{K as d,ce as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as w,ae as v,af as s,ag as o,ah as
|
|
1
|
+
import{a0 as w,ae as v,af as s,ag as o,ah as _,ai as l,aG as B,ak as E,al as $,V as j,T as k}from"./shared-DnJBtKmH.js";const r=w({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=s({id:B,title:E(l(),$(1))}),c=s({title:o(l(),""),sections:o(_(x),[])}),p=t=>{const e=v(c,t),a=new Set;for(const n of e.sections){if(a.has(n.id))throw new Error(`duplicate section id: ${n.id}`);a.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),i=(t,e)=>t.sections.find(a=>a.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,a)=>{switch(a.type){case"section":return i(e,a.id)?.title??a.id;case"page":return t.wholePage;default:return a.id}},g=(t,e,a)=>({title:e.type,targetLabel:u(t,a,e.target),tone:"meta"}),f=t=>`${t.type} ${j(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(a=>({value:`section:${a.id}`,label:a.title,group:t.sectionGroup})),y=(t,e)=>e,P=(t,e)=>{switch(e.type){case"section":return i(t,e.id)!==void 0;case"page":return!0;default:return!1}},b=t=>{const e=r(t);return{name:"plain",label:"Plain",parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:P,describe:(a,n)=>g(e,a,n),serialize:f,resolveNavigation:y,commentTargets:a=>h(e,a),title:m}};class T extends k{definitionFor(e){return b(e)}renderRegions(e){return{}}}const S=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",T)},G=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:T,definePlainElement:S,describePlainAction:g,emptyPlainBase:d,findSection:i,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:b,plainHasTarget:P,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{S as d,G as i};
|