dev-process-kit 0.0.18 → 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/README.md +1 -1
- package/dist/chunks/shared-Ae8HmujL.js +49 -0
- package/dist/chunks/{shared-DEjjuQMh.js → shared-BCmqTEeQ.js} +9 -7
- package/dist/chunks/shared-BkM7jfZs.js +1104 -0
- package/dist/chunks/shared-Bo8OdTee.js +4206 -0
- package/dist/chunks/shared-C-7mxPbV.js +301 -0
- package/dist/chunks/shared-C-Os1zsf.js +572 -0
- package/dist/chunks/{shared-CWKqlSx3.js → shared-C02b6b2m.js} +1 -1
- package/dist/chunks/shared-CjW1DhGL.js +1 -0
- package/dist/chunks/{shared-8NAMqG0U.js → shared-DJruxrrR.js} +32 -50
- package/dist/chunks/{shared-DzxR5Yzc.js → shared-DLdJfSN-.js} +1 -1
- package/dist/chunks/{shared-CUPe-wfx.js → shared-DYKbMmHn.js} +8 -8
- package/dist/chunks/{shared-DRvgJdY6.js → shared-DbBoZvUP.js} +173 -203
- package/dist/chunks/shared-DbnPOaXf.js +4210 -0
- package/dist/chunks/shared-DnJBtKmH.js +3769 -0
- package/dist/chunks/shared-v63w_5VP.js +2774 -0
- 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 -2
- package/dist/chunks/shared-B00JP4in.js +0 -572
- package/dist/chunks/shared-BtN-8ibq.js +0 -30
- package/dist/chunks/shared-C6QYWD8M.js +0 -2560
- package/dist/chunks/shared-CpTDkEui.js +0 -3751
- package/dist/chunks/shared-CtHWU02m.js +0 -1
- package/dist/chunks/shared-D4K7KsfJ.js +0 -1
- package/dist/chunks/shared-DWY93NpU.js +0 -3598
- package/dist/chunks/shared-DXaIVZ_z.js +0 -2766
- package/dist/chunks/shared-Ezic-gbC.js +0 -1104
- package/dist/chunks/shared-IQ2sflGo.js +0 -1027
- package/dist/chunks/shared-ml5h7U5L.js +0 -1
- package/dist/templates/grill.js +0 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{a0 as _,
|
|
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>
|
|
5
5
|
<span class="dpk-label">${i.slides.length}</span>
|
|
6
6
|
</div>
|
|
7
7
|
<ol class="outline-list">
|
|
8
|
-
${x(i.slides,o=>o.id,(o,a)=>{const g=o.id===
|
|
8
|
+
${x(i.slides,o=>o.id,(o,a)=>{const g=o.id===n,b=t.commentCount({type:"slide",id:o.id});return l`
|
|
9
9
|
<li class="outline-row" data-current=${String(g)} data-layout=${o.layout}>
|
|
10
|
-
<a href=${t.hashFor({slide:o.id})} aria-current=${g?"page":
|
|
10
|
+
<a href=${t.hashFor({slide:o.id})} aria-current=${g?"page":d}>
|
|
11
11
|
<span class="outline-index">${String(a+1).padStart(2,"0")}</span>
|
|
12
12
|
<span class="outline-title">${o.title}</span>
|
|
13
|
-
${b>0?
|
|
13
|
+
${b>0?l`<span class="outline-note">${b}</span>`:d}
|
|
14
14
|
</a>
|
|
15
15
|
</li>
|
|
16
16
|
`})}
|
|
17
17
|
</ol>
|
|
18
18
|
</nav>
|
|
19
|
-
`},
|
|
19
|
+
`},se=(t,e,i)=>{const s=H(t.state,t.navigation);if(s===null)return l`<div class="deck">
|
|
20
20
|
<p class="deck-empty">${e.noSlidesBefore}<code>slides</code>${e.noSlidesAfter}</p>
|
|
21
|
-
</div>`;const{slide:
|
|
21
|
+
</div>`;const{slide:n,index:o,total:a}=s;return l`
|
|
22
22
|
<div class="deck">
|
|
23
|
-
<div class="stage">${
|
|
23
|
+
<div class="stage">${ne(n,o)}</div>
|
|
24
24
|
<div class="deck-bar">
|
|
25
25
|
<div class="deck-move">
|
|
26
26
|
<button
|
|
@@ -28,7 +28,7 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
28
28
|
type="button"
|
|
29
29
|
aria-label=${e.previous}
|
|
30
30
|
title=${e.previous}
|
|
31
|
-
?disabled=${
|
|
31
|
+
?disabled=${s.previous===void 0}
|
|
32
32
|
@click=${()=>i.onStep("previous")}
|
|
33
33
|
>
|
|
34
34
|
${J()}
|
|
@@ -41,7 +41,7 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
41
41
|
type="button"
|
|
42
42
|
aria-label=${e.next}
|
|
43
43
|
title=${e.next}
|
|
44
|
-
?disabled=${
|
|
44
|
+
?disabled=${s.next===void 0}
|
|
45
45
|
@click=${()=>i.onStep("next")}
|
|
46
46
|
>
|
|
47
47
|
${V()}
|
|
@@ -50,19 +50,19 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
50
50
|
<div class="deck-progress" aria-hidden="true">
|
|
51
51
|
<span style=${`width:${(o+1)/a*100}%`}></span>
|
|
52
52
|
</div>
|
|
53
|
-
${i.canFullscreen?
|
|
53
|
+
${i.canFullscreen?l`<button
|
|
54
54
|
class="dpk-btn deck-fullscreen"
|
|
55
55
|
type="button"
|
|
56
56
|
title=${e.fullscreenHint}
|
|
57
57
|
@click=${i.onFullscreen}
|
|
58
58
|
>
|
|
59
59
|
${W()} ${e.fullscreen}
|
|
60
|
-
</button>`:
|
|
60
|
+
</button>`:d}
|
|
61
61
|
</div>
|
|
62
|
-
${ae(e,
|
|
63
|
-
${oe(t.state,
|
|
62
|
+
${ae(e,n,ee(t.comments,n.id),i)}
|
|
63
|
+
${oe(t.state,n.id)}
|
|
64
64
|
</div>
|
|
65
|
-
`},
|
|
65
|
+
`},ne=(t,e)=>l`
|
|
66
66
|
<article
|
|
67
67
|
class="slide"
|
|
68
68
|
data-layout=${t.layout}
|
|
@@ -72,25 +72,25 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
72
72
|
>
|
|
73
73
|
<div class="slide-content">
|
|
74
74
|
<h2 class="slide-title">${t.title}</h2>
|
|
75
|
-
${t.subtitle===""?l
|
|
76
|
-
${t.points.length===0?l
|
|
77
|
-
${t.points.map(i=>
|
|
75
|
+
${t.subtitle===""?d:l`<p class="slide-subtitle">${t.subtitle}</p>`}
|
|
76
|
+
${t.points.length===0?d:l`<ul class="slide-points">
|
|
77
|
+
${t.points.map(i=>l`<li>${i}</li>`)}
|
|
78
78
|
</ul>`}
|
|
79
79
|
<div class="slide-body"><slot name=${`preview:${t.id}`}></slot></div>
|
|
80
80
|
</div>
|
|
81
81
|
<span class="slide-number" aria-hidden="true">${e+1}</span>
|
|
82
82
|
</article>
|
|
83
|
-
`,ae=(t,e,i,
|
|
83
|
+
`,ae=(t,e,i,s)=>{const n=s.draftFor(e.id),o=n.trim()!=="";return l`
|
|
84
84
|
<section class="slide-comments" aria-label=${t.commentOnSlide}>
|
|
85
|
-
${i.length===0?l
|
|
86
|
-
${x(i,a=>a.id,a=>
|
|
85
|
+
${i.length===0?d:l`<ul class="slide-comment-list">
|
|
86
|
+
${x(i,a=>a.id,a=>l`<li>
|
|
87
87
|
<span class="slide-comment-body">${a.body}</span>
|
|
88
88
|
<button
|
|
89
89
|
class="dpk-icon-btn slide-comment-delete"
|
|
90
90
|
type="button"
|
|
91
91
|
aria-label=${t.deleteComment}
|
|
92
92
|
title=${t.deleteComment}
|
|
93
|
-
@click=${()=>
|
|
93
|
+
@click=${()=>s.onDeleteComment(a.id)}
|
|
94
94
|
>
|
|
95
95
|
${Q()}
|
|
96
96
|
</button>
|
|
@@ -101,16 +101,16 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
101
101
|
class="dpk-textarea slide-comment-input"
|
|
102
102
|
aria-label=${t.commentOnSlide}
|
|
103
103
|
placeholder=${t.commentPlaceholder}
|
|
104
|
-
.value=${
|
|
105
|
-
@input=${a=>{a.currentTarget instanceof HTMLTextAreaElement&&
|
|
106
|
-
@keydown=${a=>{a.isComposing||a.key!=="Enter"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),o&&
|
|
104
|
+
.value=${n}
|
|
105
|
+
@input=${a=>{a.currentTarget instanceof HTMLTextAreaElement&&s.onDraft(e.id,a.currentTarget.value)}}
|
|
106
|
+
@keydown=${a=>{a.isComposing||a.key!=="Enter"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),o&&s.onComment(e.id))}}
|
|
107
107
|
></textarea>
|
|
108
108
|
<div class="slide-comment-actions">
|
|
109
109
|
<button
|
|
110
110
|
class="dpk-btn dpk-btn--accent slide-comment-submit"
|
|
111
111
|
type="button"
|
|
112
112
|
?disabled=${!o}
|
|
113
|
-
@click=${()=>
|
|
113
|
+
@click=${()=>s.onComment(e.id)}
|
|
114
114
|
>
|
|
115
115
|
${t.addComment}
|
|
116
116
|
</button>
|
|
@@ -118,9 +118,9 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
118
118
|
</div>
|
|
119
119
|
</div>
|
|
120
120
|
</section>
|
|
121
|
-
`},oe=(t,e)=>{const i=t.slides.filter(
|
|
122
|
-
${i.map(
|
|
123
|
-
</div>`},
|
|
121
|
+
`},oe=(t,e)=>{const i=t.slides.filter(s=>s.id!==e);return i.length===0?d:l`<div class="parked" aria-hidden="true">
|
|
122
|
+
${i.map(s=>l`<slot name=${`preview:${s.id}`}></slot>`)}
|
|
123
|
+
</div>`},le=X`
|
|
124
124
|
/* ------------------------------------------------------------ outline */
|
|
125
125
|
|
|
126
126
|
.outline-head {
|
|
@@ -143,23 +143,11 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
143
143
|
position: relative;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.outline-row::before {
|
|
147
|
-
content: '';
|
|
148
|
-
position: absolute;
|
|
149
|
-
left: 0;
|
|
150
|
-
top: 6px;
|
|
151
|
-
bottom: 6px;
|
|
152
|
-
width: 3px;
|
|
153
|
-
border-radius: var(--dpk-radius-xs);
|
|
154
|
-
background: transparent;
|
|
155
|
-
transition: background 140ms var(--dpk-ease);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
146
|
.outline-row a {
|
|
159
147
|
display: flex;
|
|
160
148
|
align-items: baseline;
|
|
161
149
|
gap: 10px;
|
|
162
|
-
padding: 7px 8px
|
|
150
|
+
padding: 7px 8px;
|
|
163
151
|
border-radius: var(--dpk-radius-sm);
|
|
164
152
|
color: var(--dpk-ink-soft);
|
|
165
153
|
font-size: 13px;
|
|
@@ -181,11 +169,6 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
181
169
|
box-shadow: var(--dpk-focus);
|
|
182
170
|
}
|
|
183
171
|
|
|
184
|
-
.outline-row[data-current='true']::before {
|
|
185
|
-
background: linear-gradient(180deg, var(--dpk-accent-bright), var(--dpk-accent-strong));
|
|
186
|
-
box-shadow: 0 0 8px color-mix(in srgb, var(--dpk-accent) 45%, transparent);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
172
|
.outline-row[data-current='true'] a {
|
|
190
173
|
background: color-mix(in srgb, var(--dpk-accent) 8%, var(--dpk-paper-raised));
|
|
191
174
|
color: var(--dpk-ink);
|
|
@@ -523,9 +506,8 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
523
506
|
display: flex;
|
|
524
507
|
align-items: flex-start;
|
|
525
508
|
gap: 8px;
|
|
526
|
-
padding: 6px 6px 6px
|
|
527
|
-
border-
|
|
528
|
-
border-radius: 0 var(--dpk-radius-sm) var(--dpk-radius-sm) 0;
|
|
509
|
+
padding: 6px 6px 6px 10px;
|
|
510
|
+
border-radius: var(--dpk-radius-sm);
|
|
529
511
|
background: var(--dpk-paper-sunken);
|
|
530
512
|
font-size: 13px;
|
|
531
513
|
line-height: 1.55;
|
|
@@ -619,4 +601,4 @@ import{a0 as _,ad as N,ae as f,af as c,ag as k,ah as p,aA as R,aj as G,ak as Y,a
|
|
|
619
601
|
transition: none;
|
|
620
602
|
}
|
|
621
603
|
}
|
|
622
|
-
`,
|
|
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,
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ad as se,ai as le,ae as v,af as w,ag as E,aA as D,aB as l,ah as p,aj as A,ak as L,p as b,au as f,v as ce,P as pe,e as R,a0 as ue,V as B,R as $,aC as ge,aD as me,a3 as c,A as ve,a4 as s,a5 as be,aE as he,K as ke,aF as ye,aG as fe,a2 as $e,T as z,l as xe}from"./shared-DXaIVZ_z.js";const h=[1,2,3,4,5,6,7],k=le(h,"a delegation level is an integer from 1 to 7"),y=A(p(),L(1)),we=v({player:y,level:k,reason:l(p())}),K=v({title:l(p()),parties:l(v({delegator:l(y),delegate:l(y)})),players:w(E(v({id:D,name:y})),[]),decisions:w(E(v({id:D,name:y,description:l(p()),cards:w(E(we),[]),agreed:l(k)})),[])}),M=e=>{const a=se(K,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},F=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},j=(e,a)=>e.players.find(r=>r.id===a),T=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:b("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:b("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:b("ADD_DECISION","page",f({id:D,name:A(p(),L(1)),description:l(p())}),{dedupeKey:ce}),SET_DECISION_NAME:b("SET_DECISION_NAME","decision",f({name:A(p(),L(1))})),DELETE_DECISION:b("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},V=(e,a)=>{const r=pe(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return C(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return C(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:T(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return C(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return R(r)}},C=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,G={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},Y={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Ee={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},De={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ae={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Le={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},S=ue({en:{levelName:e=>G[e],levelPhrase:(e,a,r)=>Ee[e](a,r),levelLabel:e=>`${e} ${G[e]}`,statusLabel:e=>Ae[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>De[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Le[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),_=e=>e==="strict"?"strict":"lax",P=(e,a)=>e==="strict"&&a.yours!==void 0,q=(e,a,r)=>e==="lax"?{kind:"play"}:P(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},N=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),H=e=>e.yours!==void 0||e.agreed!==void 0,Te=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:j(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Ce=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Se=(e,a,r,o)=>{const t=Te(e,a,o),i=H(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Ce(o,t),hidden:H(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:P(r,o),cells:h.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...ne})=>ne),yours:o.yours===d,agreed:o.agreed===d}))}},I=(e,a,r)=>{const{delegator:o,delegate:t}=N(e,a);return{levels:h.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Se(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},J=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},_e=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),U={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:J(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:J(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:_e(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},W=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(U,a.type)?U[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:X(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},Q=e=>`${e.type} ${B(e.target)} ${JSON.stringify(e.payload)}`,X=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${O(a)}`;default:return`${r.type} \xB7 ${r.id}`}},Z=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:B({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],O=e=>e.title??"Delegation Poker",ee=(e,a)=>a,ae=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},re=e=>{const a=S(e);return{name:"delegation-poker",label:"Delegation Poker",parseBase:M,emptyBase:F,actions:g,apply:V,hasTarget:ae,describe:(r,o,t)=>W(a,r,o,t),serialize:Q,resolveNavigation:ee,commentTargets:(r,o)=>Z(a,r),title:O}},oe="dev-process-kit:delegation-poker:skip-strict-confirm",te=e=>e===!0?!0:null,Pe=e=>{const a=e?ge(te):me(te);return{read:()=>a.read(oe)===!0,remember:()=>a.write(oe,!0)}},Ne=(e,a,r,o)=>s`
|
|
1
|
+
import{aj as se,ae as le,af as v,ag as w,ah as E,aG as D,aH as l,ai as p,ak as A,al as L,p as b,au as f,w as ce,P as pe,e as R,a0 as ue,V as B,R as $,aI as ge,aJ as me,a3 as c,B as ve,a4 as s,a5 as be,aK as he,K as ke,aL as ye,aM as fe,a2 as $e,T as z,l as xe}from"./shared-DnJBtKmH.js";const h=[1,2,3,4,5,6,7],k=se(h,"a delegation level is an integer from 1 to 7"),y=A(p(),L(1)),we=v({player:y,level:k,reason:l(p())}),K=v({title:l(p()),parties:l(v({delegator:l(y),delegate:l(y)})),players:w(E(v({id:D,name:y})),[]),decisions:w(E(v({id:D,name:y,description:l(p()),cards:w(E(we),[]),agreed:l(k)})),[])}),M=e=>{const a=le(K,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},j=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},F=(e,a)=>e.players.find(r=>r.id===a),T=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:b("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:b("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:b("ADD_DECISION","page",f({id:D,name:A(p(),L(1)),description:l(p())}),{dedupeKey:ce}),SET_DECISION_NAME:b("SET_DECISION_NAME","decision",f({name:A(p(),L(1))})),DELETE_DECISION:b("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},V=(e,a)=>{const r=pe(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return C(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return C(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:T(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return C(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return R(r)}},C=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,G={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},H={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Ee={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},De={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ae={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Le={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},S=ue({en:{levelName:e=>G[e],levelPhrase:(e,a,r)=>Ee[e](a,r),levelLabel:e=>`${e} ${G[e]}`,statusLabel:e=>Ae[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>H[e],levelPhrase:(e,a,r)=>De[e](a,r),levelLabel:e=>`${e} ${H[e]}`,statusLabel:e=>Le[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),_=e=>e==="strict"?"strict":"lax",P=(e,a)=>e==="strict"&&a.yours!==void 0,Y=(e,a,r)=>e==="lax"?{kind:"play"}:P(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),q=e=>e.yours!==void 0||e.agreed!==void 0,Te=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:F(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Ce=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Se=(e,a,r,o)=>{const t=Te(e,a,o),i=q(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Ce(o,t),hidden:q(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:P(r,o),cells:h.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...ne})=>ne),yours:o.yours===d,agreed:o.agreed===d}))}},N=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:h.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Se(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},J=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},_e=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),U={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:J(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:J(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:_e(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},W=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(U,a.type)?U[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:X(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},Q=e=>`${e.type} ${B(e.target)} ${JSON.stringify(e.payload)}`,X=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${O(a)}`;default:return`${r.type} \xB7 ${r.id}`}},Z=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:B({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],O=e=>e.title??"Delegation Poker",ee=(e,a)=>a,ae=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},re=e=>{const a=S(e);return{name:"delegation-poker",label:"Delegation Poker",parseBase:M,emptyBase:j,actions:g,apply:V,hasTarget:ae,describe:(r,o,t)=>W(a,r,o,t),serialize:Q,resolveNavigation:ee,commentTargets:(r,o)=>Z(a,r),title:O}},oe="dev-process-kit:delegation-poker:skip-strict-confirm",te=e=>e===!0?!0:null,Pe=e=>{const a=e?ge(te):me(te);return{read:()=>a.read(oe)===!0,remember:()=>a.write(oe,!0)}},Ie=(e,a,r,o)=>s`
|
|
2
2
|
<button
|
|
3
3
|
class="dpk-icon-btn"
|
|
4
4
|
type="button"
|
|
@@ -9,7 +9,7 @@ import{ad as se,ai as le,ae as v,af as w,ag as E,aA as D,aB as l,ah as p,aj as A
|
|
|
9
9
|
>
|
|
10
10
|
${ve()} ${r>0?s`<span class="dpk-icon-badge">${r}</span>`:c}
|
|
11
11
|
</button>
|
|
12
|
-
`,
|
|
12
|
+
`,Ne=e=>{const{context:a,m:r,mode:o}=e,{progress:t}=N(r,a.state,o),{delegator:i,delegate:d}=I(r,a.state);return s`<div class="summary">
|
|
13
13
|
<span class="summary-chip" title=${`${r.partiesLabel}
|
|
14
14
|
${i} \u2192 ${d}`}
|
|
15
15
|
>${i} → ${d}</span
|
|
@@ -26,7 +26,7 @@ ${i} \u2192 ${d}`}
|
|
|
26
26
|
<button class="dpk-btn dpk-btn--accent" type="button" data-testid="add-decision" @click=${a.addDecision}>
|
|
27
27
|
${r.firstDecision}
|
|
28
28
|
</button>
|
|
29
|
-
</div>`},Re=e=>{const{context:a,handlers:r,m:o,mode:t}=e,i=
|
|
29
|
+
</div>`},Re=e=>{const{context:a,handlers:r,m:o,mode:t}=e,i=N(o,a.state,t);return s`<section class="board-panel" aria-labelledby="dp-board-title">
|
|
30
30
|
<header class="board-head">
|
|
31
31
|
<h2 id="dp-board-title">${o.board}</h2>
|
|
32
32
|
<p class="board-hint">${o.boardHint(t)}</p>
|
|
@@ -71,7 +71,7 @@ ${i} \u2192 ${d}`}
|
|
|
71
71
|
@dpk-commit=${he(n=>t.rename(r.id,n))}
|
|
72
72
|
></dpk-component-inline-edit>
|
|
73
73
|
<span class="row-tools">
|
|
74
|
-
${
|
|
74
|
+
${Ie(d,i.commentButton,o.commentCount(d),t)}
|
|
75
75
|
<button
|
|
76
76
|
class="dpk-icon-btn"
|
|
77
77
|
type="button"
|
|
@@ -92,7 +92,7 @@ ${i} \u2192 ${d}`}
|
|
|
92
92
|
</div>
|
|
93
93
|
</div>
|
|
94
94
|
${r.cells.map(n=>Me(e,r,a,n))}
|
|
95
|
-
<div class="cell-agree" role="cell">${
|
|
95
|
+
<div class="cell-agree" role="cell">${je(e,a,r)}</div>
|
|
96
96
|
</div>`},Me=(e,a,r,o)=>{const{handlers:t,m:i}=e,d=r.find(n=>n.level===o.level)?.label??String(o.level);return s`<div class="cell" role="cell" data-level=${o.level} ?data-agreed=${o.agreed}>
|
|
97
97
|
<button
|
|
98
98
|
class="cell-play"
|
|
@@ -111,7 +111,7 @@ ${i} \u2192 ${d}`}
|
|
|
111
111
|
>${n.label}</span
|
|
112
112
|
>`)}
|
|
113
113
|
</button>
|
|
114
|
-
</div>`},
|
|
114
|
+
</div>`},je=(e,a,r)=>{const{handlers:o,m:t}=e;return s`<select
|
|
115
115
|
class="dpk-select agree-select"
|
|
116
116
|
data-testid="agree"
|
|
117
117
|
aria-label=${t.agreeLabel(r.name)}
|
|
@@ -119,7 +119,7 @@ ${i} \u2192 ${d}`}
|
|
|
119
119
|
>
|
|
120
120
|
${r.agreed===void 0?s`<option value="" disabled selected>${t.notAgreed}</option>`:c}
|
|
121
121
|
${a.map(i=>s`<option value=${i.level} ?selected=${i.level===r.agreed}>${i.label}</option>`)}
|
|
122
|
-
</select>`},
|
|
122
|
+
</select>`},Fe=(e,a,r)=>a===null?c:s`<div class="confirm-backdrop" @click=${r.cancel}>
|
|
123
123
|
<div
|
|
124
124
|
class="confirm"
|
|
125
125
|
role="alertdialog"
|
|
@@ -607,4 +607,4 @@ ${i} \u2192 ${d}`}
|
|
|
607
607
|
.empty .dpk-btn {
|
|
608
608
|
justify-self: start;
|
|
609
609
|
}
|
|
610
|
-
`;class ie extends z{static{this.styles=[z.styles,Ve]}static{this.properties={mode:{type:String},pending:{state:!0},skipConfirm:{state:!0}}}#a=null;#e=null;constructor(){super(),this.mode=null,this.pending=null,this.skipConfirm=!1}connectedCallback(){super.connectedCallback(),this.#a=Pe(this.storage!=="off"&&this.storage!=="memory"),this.skipConfirm=this.#a.read()}definitionFor(a){return re(a)}renderRegions(a){const r=S(this.locale),o=this.#r(a,r),t={context:a,handlers:o,m:r,mode:_(this.mode)},i=a.state.decisions.length===0?Oe(t):Re(t);return{header:
|
|
610
|
+
`;class ie extends z{static{this.styles=[z.styles,Ve]}static{this.properties={mode:{type:String},pending:{state:!0},skipConfirm:{state:!0}}}#a=null;#e=null;constructor(){super(),this.mode=null,this.pending=null,this.skipConfirm=!1}connectedCallback(){super.connectedCallback(),this.#a=Pe(this.storage!=="off"&&this.storage!=="memory"),this.skipConfirm=this.#a.read()}definitionFor(a){return re(a)}renderRegions(a){const r=S(this.locale),o=this.#r(a,r),t={context:a,handlers:o,m:r,mode:_(this.mode)},i=a.state.decisions.length===0?Oe(t):Re(t);return{header:Ne(t),main:s`${i}${Fe(r,this.pending,this.#o(a))}`}}updated(){super.updated();const a=this.#e;if(a!==null){if(this.#e=null,a==="dialog"){this.renderRoot.querySelector('[data-testid="confirm-play-ok"]')?.focus();return}this.renderRoot.querySelector(`[data-decision="${a.decisionId}"] .cell-play[data-level="${a.level}"]`)?.focus()}}#r(a,r){return{play:(o,t)=>{const i=a.state.decisions.find(n=>n.id===o);if(i===void 0)return;const d=Y(_(this.mode),i,this.skipConfirm);switch(d.kind){case"play":a.dispatch(m.playCard(o,t));return;case"confirm":this.pending={decisionId:o,decisionName:i.name,level:t,skip:!1},this.#e="dialog";return;case"locked":return;default:R(d)}},agree:(o,t)=>{a.dispatch(m.agreeLevel(o,t))},addDecision:()=>{const o=xe("decision",T(a.state));a.dispatch(m.addDecision(o,r.newDecision))},rename:(o,t)=>{a.dispatch(m.setDecisionName(o,t))},deleteDecision:o=>{a.dispatch(m.deleteDecision(o))},comment:o=>this.requestComment(o)}}#o(a){const r=o=>{this.pending=null,this.#e={decisionId:o.decisionId,level:o.level}};return{toggleSkip:o=>{this.pending!==null&&(this.pending={...this.pending,skip:o})},confirm:()=>{const o=this.pending;o!==null&&(o.skip&&(this.#a?.remember(),this.skipConfirm=!0),a.dispatch(m.playCard(o.decisionId,o.level)),r(o))},cancel:()=>{this.pending!==null&&r(this.pending)}}}}const de=()=>{customElements.get("dpk-template-delegation-poker")||customElements.define("dpk-template-delegation-poker",ie)},Ge=Object.freeze(Object.defineProperty({__proto__:null,DELEGATION_LEVELS:h,DELEGATION_POKER_PAGE:x,DpkTemplateDelegationPoker:ie,allDelegationPokerIds:T,applyDelegationPokerAction:V,defineDelegationPokerElement:de,delegationLevelSchema:k,delegationParties:I,delegationPokerAction:m,delegationPokerActions:g,delegationPokerBaseSchema:K,delegationPokerCommentTargets:Z,delegationPokerDefinitionFor:re,delegationPokerHasTarget:ae,delegationPokerMessages:S,delegationPokerTargetLabel:X,delegationPokerTitle:O,describeDelegationPokerAction:W,emptyDelegationPokerBase:j,findDecision:u,findPlayer:F,isLocked:P,parseDelegationPokerBase:M,parsePlayMode:_,playIntent:Y,presentBoard:N,resolveDelegationPokerNavigation:ee,serializeDelegationPokerAction:Q},Symbol.toStringTag,{value:"Module"}));export{de as d,Ge as i};
|