dev-process-kit 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boards.js +1 -1
- package/dist/chunks/{shared-Dd8JfvQe.js → shared-8-7i0SJv.js} +16 -16
- package/dist/chunks/shared-B3gYWxeF.js +1 -0
- package/dist/chunks/{shared-ubG0-RQ-.js → shared-BAlmAjut.js} +2 -2
- package/dist/chunks/{shared-CF2_VP2x.js → shared-C9Mo56gs.js} +13 -13
- package/dist/chunks/{shared-2OsWmhrI.js → shared-CLrs15X7.js} +1 -1
- package/dist/chunks/{shared-Dn92ukYW.js → shared-CMe6_Sdn.js} +1 -1
- package/dist/chunks/shared-CVEzSR4J.js +3 -0
- package/dist/chunks/{shared-Dql0ZVdC.js → shared-CkaifYF3.js} +9 -9
- package/dist/chunks/{shared-Be43xweD.js → shared-ComyWGLL.js} +2 -2
- package/dist/chunks/{shared-CeCpFPDQ.js → shared-D-lFQPYy.js} +37 -37
- package/dist/chunks/{shared-B8ZhyjWv.js → shared-D7lvvzdN.js} +444 -316
- package/dist/chunks/shared-DIYD6Tuj.js +1 -0
- package/dist/chunks/{shared-DJtGS7Ct.js → shared-DTIEx3lM.js} +22 -22
- package/dist/chunks/{shared-DIEJ9E2G.js → shared-DpOLnWXG.js} +62 -62
- package/dist/chunks/{shared-C0M3Ib7z.js → shared-DstEY0ER.js} +1 -1
- package/dist/chunks/{shared-egtdNQhY.js → shared-DvpWdbzP.js} +20 -20
- package/dist/chunks/shared-MI4Xe0aq.js +1868 -0
- package/dist/chunks/{shared-BXywwm1a.js → shared-ZjHQZcxc.js} +397 -373
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sync.js +1 -0
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +2 -1
- package/dist/chunks/shared-B57TT0rn.js +0 -1
- package/dist/chunks/shared-C89fKgKG.js +0 -1868
- package/dist/chunks/shared-LHG2FbnK.js +0 -1
package/dist/boards.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,d as s,a as r}from"./chunks/shared-
|
|
1
|
+
import{s as e,d as s,a as r}from"./chunks/shared-D7lvvzdN.js";import{C as t,b as o,D as n,E as i,v as d,M as m,V as p,W as c,c as f,e as g,f as l,g as D,h as E,i as S,j as B,k as y,l as A,m as h,n as M,o as u,p as C,q as k,r as v,t as T,u as b,w as N,x as O,y as w,z as R,A as I,B as K,F as P,G as _,H as x,I as V,J as q,K as G,L as W,N as j,O as F}from"./chunks/shared-D7lvvzdN.js";import{r as a}from"./chunks/shared-ZjHQZcxc.js";import{B as H,a as L,b as Y,D as z,c as U,d as J,e as Q,f as X,g as Z,h as $,i as aa,j as ea,k as sa,l as ra,m as ta,n as oa,o as na,p as ia,q as da,s as ma,t as pa,u as ca,v as fa,w as ga,x as la,y as Da}from"./chunks/shared-ZjHQZcxc.js";import{r as Ea}from"./chunks/shared-DpOLnWXG.js";import{S as Sa,a as Ba,b as ya,d as Aa,c as ha,e as Ma,p as ua,f as Ca,t as ka}from"./chunks/shared-CVEzSR4J.js";e({entry:"boards.js",url:import.meta.url,views:[],register:()=>{Ea(),a(),s(),r()}});export{H as BoardCanvasChromeElement,L as BoardCanvasElement,Y as BoardChromeBase,t as COMMENT_ACTION,o as COMMENT_DESCRIPTOR,z as DpkBoardArchitectureMap,U as DpkBoardDependencyGraph,J as DpkBoardErDiagram,Q as DpkBoardEventStorming,X as DpkBoardExampleMapping,Z as DpkBoardKanban,$ as DpkBoardMindMap,aa as DpkBoardSequenceDiagram,ea as DpkBoardStateDiagram,sa as DpkBoardWhiteboard,n as DraftController,i as EMPTY_NAVIGATION,d as FRAMEWORK_VERSION,m as MemoryDraftStorage,Sa as SYNC_PROTOCOL,Ba as SYNC_REQUEST_EVENT,p as ViewElement,c as WebStorageDraftStorage,f as appendAction,ya as assertNever,g as buildAgentBrief,l as commentActionSchema,D as commentBody,E as commentTargetKey,S as controls,B as createActionId,y as createEntityId,A as dedupeKeyOf,h as defaultStorage,M as defaultStorageKey,Aa as defineAction,ra as defineArchitectureMap,ta as defineDependencyGraph,oa as defineErDiagram,na as defineEventStorming,ia as defineExampleMapping,da as defineKanban,ma as defineMindMap,pa as defineSequenceDiagram,ca as defineStateDiagram,fa as defineWhiteboard,u as derive,ga as diagramMessages,la as diagramStyles,ha as draftActionEnvelopeSchema,Ma as entityDedupeKey,C as formatHash,k as iconArrowDown,v as iconArrowUp,T as iconClose,b as iconComment,N as iconGrip,O as iconLink,w as iconMove,R as iconPencil,I as iconPlus,K as iconTrash,Da as isActionPayload,P as liveActions,_ as parseHash,x as parseTargetRef,ua as parseViewAction,V as patchNavigation,Ca as payloadFor,a as registerBoardElements,q as serializeDraft,G as slugify,W as targetRef,ka as targetSchema,j as toTarget,F as tokens};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag as l,aQ as It,al as b,B as X,aj as At,b3 as Lt,r as Ot,q as Bt,w as J,u as qt,k as Mt}from"./shared-D7lvvzdN.js";import{o as Ut}from"./shared-D4PPk0Dk.js";import{m as _t,s as A,q as C,o as L,k as w,J as Q,v as y,w as k,j as g,A as O,h as T,n as Z,R as B,g as Nt,x as tt}from"./shared-CVEzSR4J.js";const zt={active:[],match:"single"},Pt=(s,t)=>t.active.length===0?!0:t.match==="all"?t.active.every(e=>s.includes(e)):t.active.some(e=>s.includes(e)),q=s=>{try{return s.split("/").map(t=>decodeURIComponent(t))}catch{return null}},et="BC:",jt=s=>`${et}${s}`,$={kind:"idle"},M="text/plain",Ht=s=>`${s.type}:${s.id}`,rt=(s,t)=>{const e=(s??"").trim();if(e.length===0)return null;const r=e.indexOf(":");if(r<0)return{type:t,id:e};const a=e.slice(0,r),i=e.slice(r+1);return a.length===0||i.length===0?null:{type:a,id:i}},st=(s,t)=>t<=s.top+s.height/2?"before":"after";class Ft{#e;#r=$;#n;constructor(t){this.#e=t,t.addController(this)}hostDisconnected(){this.reset()}get state(){return this.#r}get item(){return this.#r.kind==="dragging"?this.#r.item:null}isDragging(t,e){const r=this.item;return r!==null&&r.type===t&&r.id===e}isOver(t){return this.#r.kind!=="idle"&&this.#r.over===t}reset(){clearTimeout(this.#n),this.#n=void 0,this.#t($)}source(t){return{dragstart:e=>{e.dataTransfer&&(e.dataTransfer.setData(M,Ht(t)),e.dataTransfer.effectAllowed="move"),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=void 0,this.#t({kind:"dragging",item:t,over:null})},0)},dragend:()=>this.reset()}}target(t){return{dragenter:r=>{this.#i(t.accepts)&&(r.preventDefault(),this.#a(t.key))},dragover:r=>{this.#i(t.accepts)&&(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),this.#a(t.key))},dragleave:()=>{this.isOver(t.key)&&this.#a(null)},drop:r=>{r.preventDefault();const a=rt(r.dataTransfer?.getData(M),t.accepts)??this.item;if(this.#t($),!a||a.type!==t.accepts)return;const i=t.hovered?.(r)??null;t.onDrop({item:{type:t.accepts,id:a.id},hoveredId:i?.id??null,place:i?st(i.element.getBoundingClientRect(),r.clientY):"end",event:r})}}}combine(t,e){const r=()=>{const a=this.item!==null;return e.flatMap(([i,o])=>a||i===t?[o]:[])};return{dragenter:a=>r().forEach(i=>i.dragenter(a)),dragover:a=>r().forEach(i=>i.dragover(a)),dragleave:()=>e.forEach(([,a])=>a.dragleave()),drop:a=>{const i=rt(a.dataTransfer?.getData(M),t)?.type??this.item?.type,o=e.find(([n])=>n===i)?.[1];if(o){o.drop(a);return}a.preventDefault(),this.#t($)}}}#i(t){const e=this.item;return e===null||e.type===t}#a(t){const e=this.#r;if(e.kind==="dragging"){e.over!==t&&this.#t({...e,over:t});return}if(t===null){e.kind==="receiving"&&this.#t($);return}(e.kind==="idle"||e.over!==t)&&this.#t({kind:"receiving",over:t})}#t(t){this.#r!==t&&(this.#r=t,this.#e.requestUpdate())}}const R=(s,t,e,r)=>{const i=s.filter(c=>c!==t).at(-1)??null;if(e===null||r==="end")return i;const o=s.indexOf(t),n=s.indexOf(e);if(n<0)return i;const d=c=>c<=0?null:s.at(c-1)??null;return o>=0?o<n?e:d(n):r==="after"?e:d(n)},at=(s,t)=>new Intl.DateTimeFormat(s,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)),Kt=G({en:{heading:"Comments",commentsOn:s=>`Comments on \u201C${s}\u201D`,commentCountAria:s=>`${s} comment${s===1?"":"s"}`,empty:"No comments yet.",add:"Add comment",cancel:"Cancel",deleteComment:"Delete comment",sendFailed:"Could not save the comment.",commentDate:s=>at("en-US",s)},ja:{heading:"\u30B3\u30E1\u30F3\u30C8",commentsOn:s=>`\u300C${s}\u300D\u306E\u30B3\u30E1\u30F3\u30C8`,commentCountAria:s=>`\u30B3\u30E1\u30F3\u30C8 ${s} \u4EF6`,empty:"\u30B3\u30E1\u30F3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",add:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",deleteComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",sendFailed:"\u30B3\u30E1\u30F3\u30C8\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentDate:s=>at("ja-JP",s)}}),Wt=E`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -111,7 +111,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
111
111
|
gap: 6px;
|
|
112
112
|
justify-content: flex-end;
|
|
113
113
|
}
|
|
114
|
-
`;class it extends D{static{this.styles=[I,
|
|
114
|
+
`;class it extends D{static{this.styles=[I,Y,Et,Wt]}static{this.properties={comments:{attribute:!1},label:{type:String},inline:{type:Boolean,reflect:!0},draftKey:{type:String,attribute:"draft-key"},open:{state:!0}}}#e=!1;#r=!1;#n=new V(this);#i=new Dt(this);constructor(){super(),this.comments=[],this.label=null,this.inline=!1,this.draftKey=null,this.open=!1}willUpdate(t){t.has("comments")&&(this.#e=!1)}updated(){if(this.inline)return;const t=this.renderRoot.querySelector(".thread-pop"),e=this.renderRoot.querySelector(".thread-trigger"),r=!this.#r&&this.open;this.#r=this.open,!(!t||!e)&&(this.#i.open(t,e,{width:320,height:360},{placement:"bottom-end"}),r&&t.querySelector("textarea")?.focus({preventScroll:!0}))}render(){return this.inline?this.#s():l`${this.#g()}${this.open?this.#m():p}`}get#a(){return Kt(this.#n.locale)}#t(){return this.label?this.#a.commentsOn(this.label):this.#a.heading}#g(){const t=this.#a,e=this.comments.length,r=this.#t(),a=e>0?`${r} (${t.commentCountAria(e)})`:r;return l`<button
|
|
115
115
|
class="thread-trigger"
|
|
116
116
|
type="button"
|
|
117
117
|
aria-haspopup="dialog"
|
|
@@ -147,7 +147,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
147
147
|
title=${t.deleteComment}
|
|
148
148
|
@click=${()=>{this.#l(e.id)}}
|
|
149
149
|
>
|
|
150
|
-
${
|
|
150
|
+
${X()}
|
|
151
151
|
</button>
|
|
152
152
|
</li>`)}
|
|
153
153
|
</ol>`}
|
|
@@ -175,7 +175,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
175
175
|
<button class="dpk-btn dpk-btn--accent" type="submit">${t.add}</button>
|
|
176
176
|
</div>
|
|
177
177
|
</form>
|
|
178
|
-
`}#o(t){const e=t.querySelector("textarea"),r=e?.value.trim()??"";if(!e||r==="")return;const a=!this.dispatchEvent(new CustomEvent("dpk-thread-comment-add",{detail:{body:r},bubbles:!0,composed:!0,cancelable:!0}));this.#e=!a,a&&(e.value=""),this.requestUpdate()}#l(t){this.dispatchEvent(new CustomEvent("dpk-thread-comment-delete",{detail:{id:t},bubbles:!0,composed:!0,cancelable:!0}))}}const Gt=()=>{customElements.get("dpk-comment-thread")||customElements.define("dpk-comment-thread",it)},
|
|
178
|
+
`}#o(t){const e=t.querySelector("textarea"),r=e?.value.trim()??"";if(!e||r==="")return;const a=!this.dispatchEvent(new CustomEvent("dpk-thread-comment-add",{detail:{body:r},bubbles:!0,composed:!0,cancelable:!0}));this.#e=!a,a&&(e.value=""),this.requestUpdate()}#l(t){this.dispatchEvent(new CustomEvent("dpk-thread-comment-delete",{detail:{id:t},bubbles:!0,composed:!0,cancelable:!0}))}}const Gt=()=>{customElements.get("dpk-comment-thread")||customElements.define("dpk-comment-thread",it)},Yt=G({en:{heading:"Table",empty:"No rows.",notRecorded:"Could not record it. Place this inside a dpk-view-* element.",filterPlaceholder:"Filter\u2026",filterAriaLabel:"Filter rows",groupByLabel:"Group by",groupByNone:"None",sortAscending:"Sorted ascending",sortDescending:"Sorted descending",sortButtonAriaLabel:s=>`Sort by ${s}`,addRowButton:"+ Row",deleteRowAriaLabel:s=>`Delete ${s}`,commentAriaLabel:s=>`Comment on ${s}`,rowCount:(s,t)=>s===t?`${t} row`:`${s} / ${t} row`,addRowTitle:"Add row",addRowSummary:s=>`Added ${s}`,setCellTitle:"Edit cell",setCellSummary:(s,t)=>`${s}: ${t}`,deleteRowTitle:"Delete row",deleteRowSummary:s=>`Removed ${s}`,reorderRowTitle:"Reorder row",reorderRowSummary:s=>`Moved ${s}`},ja:{heading:"\u30C6\u30FC\u30D6\u30EB",empty:"\u884C\u304C\u3042\u308A\u307E\u305B\u3093\u3002",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",filterPlaceholder:"\u7D5E\u308A\u8FBC\u307F\u2026",filterAriaLabel:"\u884C\u3092\u7D5E\u308A\u8FBC\u3080",groupByLabel:"\u30B0\u30EB\u30FC\u30D7\u5316",groupByNone:"\u306A\u3057",sortAscending:"\u6607\u9806\u3067\u4E26\u3079\u66FF\u3048",sortDescending:"\u964D\u9806\u3067\u4E26\u3079\u66FF\u3048",sortButtonAriaLabel:s=>`${s} \u3067\u4E26\u3079\u66FF\u3048`,addRowButton:"\uFF0B \u884C",deleteRowAriaLabel:s=>`${s} \u3092\u524A\u9664`,commentAriaLabel:s=>`${s} \u306B\u30B3\u30E1\u30F3\u30C8`,rowCount:(s,t)=>s===t?`${t} \u884C`:`${s} / ${t} \u884C`,addRowTitle:"\u884C\u3092\u8FFD\u52A0",addRowSummary:s=>`${s} \u3092\u8FFD\u52A0`,setCellTitle:"\u30BB\u30EB\u3092\u7DE8\u96C6",setCellSummary:(s,t)=>`${s}: ${t}`,deleteRowTitle:"\u884C\u3092\u524A\u9664",deleteRowSummary:s=>`${s} \u3092\u524A\u9664`,reorderRowTitle:"\u884C\u3092\u4E26\u3079\u66FF\u3048",reorderRowSummary:s=>`${s} \u3092\u79FB\u52D5`}}),Vt=["gray","blue","green","amber","violet","red"],Xt=["text","number","tag","status","person"],ot=()=>({columns:[],rows:[]}),Jt=C({id:y(g(),k(1)),label:y(g(),k(1)),type:tt(Xt),sortable:w(Nt())}),nt=C({label:g(),tone:tt(Vt)}),Qt=O([g(),Z(),B(),T(g()),nt]),Zt=C({id:y(g(),k(1)),cells:w(Q(g(),Qt),{}),questions:w(g())}),te=C({columns:T(Jt),rows:w(T(Zt),[])}),U=(s,t)=>{switch(s.type){case"text":if(t==null)return{type:"text",value:null};if(typeof t=="string")return{type:"text",value:t};break;case"number":if(t==null)return{type:"number",value:null};if(typeof t=="number")return{type:"number",value:t};break;case"person":if(t==null)return{type:"person",value:null};if(typeof t=="string")return{type:"person",value:t};break;case"tag":if(t===void 0)return{type:"tag",value:[]};if(Array.isArray(t))return{type:"tag",value:t};break;case"status":if(t==null)return{type:"status",value:null};if(typeof t=="object"&&!Array.isArray(t)&&"tone"in t)return{type:"status",value:t};break}throw new Error(`cell for column "${s.id}" does not match its type "${s.type}"`)},dt=s=>{const t=_t(te,s),e=new Set,r=t.columns.map(n=>{if(e.has(n.id))throw new Error(`duplicate column id: ${n.id}`);return e.add(n.id),{id:n.id,label:n.label,type:n.type,sortable:n.sortable??!0}}),a=new Map(r.map(n=>[n.id,n])),i=new Set,o=t.rows.map(n=>{if(i.has(n.id))throw new Error(`duplicate row id: ${n.id}`);i.add(n.id);for(const c of Object.keys(n.cells))if(!a.has(c))throw new Error(`row "${n.id}" has a cell for unknown column "${c}"`);const d={};for(const c of r)d[c.id]=U(c,n.cells[c.id]);return n.questions===void 0?{id:n.id,cells:d}:{id:n.id,cells:d,questions:n.questions}});return{columns:r,rows:o}},ee={sort:null,groupBy:null,filter:""},_=s=>{switch(s.type){case"text":case"person":return s.value??"";case"number":return s.value===null?"":String(s.value);case"tag":return s.value.join(" ");case"status":return s.value?.label??""}},lt=s=>s.type==="number"?s.value??-1/0:_(s).toLowerCase(),re=(s,t)=>{const e=t.trim().toLowerCase();return e===""?!0:Object.values(s.cells).some(r=>_(r).toLowerCase().includes(e))},se=(s,t)=>{const e=s.rows.filter(d=>re(d,t.filter)),r=t.sort,a=r===null?e:[...e].sort((d,c)=>{const h=lt(d.cells[r.column]??{type:"text",value:null}),u=lt(c.cells[r.column]??{type:"text",value:null}),f=h<u?-1:h>u?1:0;return r.direction==="asc"?f:-f});if(t.groupBy===null)return[{key:"",label:"",rows:a}];const i=t.groupBy,o=[],n=new Map;for(const d of a){const c=d.cells[i],h=c===void 0?"":_(c),u=h===""?"\0empty":h;n.has(u)||(o.push(u),n.set(u,[])),n.get(u)?.push(d)}return o.map(d=>({key:d,label:d==="\0empty"?"":d,rows:n.get(d)??[]}))},ct="ADD_ROW",N="SET_CELL",ut="DELETE_ROW",ht="REORDER_ROW",pt=s=>`element:${encodeURIComponent(s)}/table/rows`,x=(s,t)=>`element:${encodeURIComponent(s)}/row/${encodeURIComponent(t)}`,z=s=>{const t=q(s);return t?.length===3&&t[1]==="row"?t[2]??null:null},ae=s=>{const t=q(s);return t?.length===3&&t[1]==="table"&&t[2]==="rows"},gt=O([g(),Z(),B(),T(g()),nt]),ie=L({id:y(g(),k(1)),cells:w(Q(g(),gt),{})}),oe=L({column:y(g(),k(1)),value:gt}),ne=L({before:O([g(),B()])}),de=(s,t,e)=>{let r=[...t.rows];const a=o=>r.findIndex(n=>n.id===o),i=e.map(o=>{if(o.type===ct){if(!ae(o.target.id))return{id:o.id,title:s.addRowTitle,stale:"target-missing"};const n=A(ie,o.payload);if(!n.success||a(n.output.id)>=0)return{id:o.id,title:s.addRowTitle,stale:"constraint-violated"};const d={};for(const c of t.columns)d[c.id]=U(c,n.output.cells[c.id]);return r=[...r,{id:n.output.id,cells:d}],{id:o.id,title:s.addRowTitle,summary:s.addRowSummary(n.output.id),tone:"create"}}if(o.type===N){const n=z(o.target.id),d=n===null?-1:a(n),c=A(oe,o.payload),h=d<0?void 0:r[d];if(h===void 0||!c.success)return{id:o.id,title:s.setCellTitle,stale:"target-missing"};const u=t.columns.find(m=>m.id===c.output.column);if(u===void 0)return{id:o.id,title:s.setCellTitle,stale:"constraint-violated"};let f;try{f=U(u,c.output.value)}catch{return{id:o.id,title:s.setCellTitle,stale:"constraint-violated"}}return r=r.map((m,v)=>v===d?{...m,cells:{...m.cells,[u.id]:f}}:m),{id:o.id,title:s.setCellTitle,summary:s.setCellSummary(h.id,u.label),tone:"update"}}if(o.type===ut){const n=z(o.target.id),d=n===null?-1:a(n);if(d<0)return{id:o.id,title:s.deleteRowTitle,stale:"target-missing"};const c=r[d];return r=r.filter((h,u)=>u!==d),{id:o.id,title:s.deleteRowTitle,summary:s.deleteRowSummary(c?.id??""),tone:"delete"}}if(o.type===ht){const n=z(o.target.id),d=n===null?-1:a(n),c=A(ne,o.payload);if(d<0||!c.success)return{id:o.id,title:s.reorderRowTitle,stale:"target-missing"};const h=c.output.before,u=h===null?r.length:a(h);if(h!==null&&(u<0||h===n))return{id:o.id,title:s.reorderRowTitle,stale:"constraint-violated"};const f=r[d];if(f===void 0)return{id:o.id,title:s.reorderRowTitle,stale:"target-missing"};const m=r.filter((W,St)=>St!==d),v=h===null?m.length:m.findIndex(W=>W.id===h);return r=v<0?[...m,f]:[...m.slice(0,v),f,...m.slice(v)],{id:o.id,title:s.reorderRowTitle,summary:s.reorderRowSummary(f.id),tone:"move"}}return{id:o.id,title:o.type,stale:"unsupported-action-type"}});return{data:{columns:t.columns,rows:r},results:i}},le=E`
|
|
179
179
|
:host {
|
|
180
180
|
display: block;
|
|
181
181
|
color: var(--dpk-ink);
|
|
@@ -470,7 +470,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
470
470
|
.error {
|
|
471
471
|
color: var(--dpk-danger);
|
|
472
472
|
}
|
|
473
|
-
`,ce=(...s)=>s.filter(t=>typeof t=="string"&&t.length>0).join(" ");class mt extends D{static{this.styles=[I,
|
|
473
|
+
`,ce=(...s)=>s.filter(t=>typeof t=="string"&&t.length>0).join(" ");class mt extends D{static{this.styles=[I,Y,le]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},readonly:{type:Boolean,reflect:!0},data:{attribute:!1}}}#e=new V(this);#r=new At(this);#n=null;#i=null;#a=null;#t=ot();#g=[];#m=[];#s=ee;#o=null;#l=null;#c=null;#d=null;#f=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.readonly=!1,this.data=null}connectedCallback(){super.connectedCallback(),this.#n=Ut(this,dt,t=>{this.data===null&&(t.ok?(this.#i=t.value,this.#a=null):(this.#i=null,this.#a=t.error),this.#B(),this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}willUpdate(t){t.has("data")&&this.data!==null&&(this.#i=this.data,this.#a=null,this.#B())}get commentTargets(){if(!this.id)return[];const t=`${this.#h} \xB7 ${this.id}`;return[{value:pt(this.id),label:this.#h,group:t},...this.#t.rows.map(e=>({value:x(this.id,e.id),label:this.#w(e),group:t}))]}get elementActions(){return this.#g}set elementActions(t){this.#g=t,this.#B()}get elementActionResults(){return this.#m}get selection(){return this.#o}render(){const t=this.#u;if(this.#a!==null)return l`<p class="error">${this.#a}</p>`;const e=se(this.#t,this.#s),r=this.#t.rows.length,a=e.reduce((o,n)=>o+n.rows.length,0),i=this.#p();return l`
|
|
474
474
|
<div class="head">
|
|
475
475
|
<span class="heading">${this.#h}</span>
|
|
476
476
|
<span class="count">${t.rowCount(a,r)}</span>
|
|
@@ -482,7 +482,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
482
482
|
placeholder=${t.filterPlaceholder}
|
|
483
483
|
aria-label=${t.filterAriaLabel}
|
|
484
484
|
.value=${this.#s.filter}
|
|
485
|
-
@input=${
|
|
485
|
+
@input=${Lt(o=>{this.#s={...this.#s,filter:o},this.requestUpdate()})}
|
|
486
486
|
/>
|
|
487
487
|
${this.#t.columns.length===0?p:l`<label class="group-by">
|
|
488
488
|
<span>${t.groupByLabel}</span>
|
|
@@ -503,7 +503,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
503
503
|
${e.map(o=>this.#D(t,o,i))}
|
|
504
504
|
</table>
|
|
505
505
|
</div>`}
|
|
506
|
-
`}get#u(){return
|
|
506
|
+
`}get#u(){return Yt(this.#e.locale)}get#h(){return this.heading??this.#u.heading}#p(){return!this.readonly&&this.id.length>0&&this.#s.sort===null&&this.#s.groupBy===null}#b(t,e){if(!e.sortable)return l`<th>${e.label}</th>`;const r=this.#s.sort,a=r?.column===e.id;return l`<th>
|
|
507
507
|
<button
|
|
508
508
|
type="button"
|
|
509
509
|
class="sort"
|
|
@@ -512,7 +512,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
512
512
|
@click=${()=>this.#x(e.id)}
|
|
513
513
|
>
|
|
514
514
|
<span>${e.label}</span>
|
|
515
|
-
${a?l`<span class="sort-icon">${r?.direction==="asc"?
|
|
515
|
+
${a?l`<span class="sort-icon">${r?.direction==="asc"?Ot():Bt()}</span>`:p}
|
|
516
516
|
</button>
|
|
517
517
|
</th>`}#x(t){const e=this.#s.sort;if(e?.column===t&&e.direction==="desc")this.#s={...this.#s,sort:null};else{const r=e?.column===t&&e.direction==="asc"?"desc":"asc";this.#s={...this.#s,sort:{column:t,direction:r}}}this.requestUpdate()}#D(t,e,r){const a=this.#t.columns.length+1+(r?1:0);return l`<tbody
|
|
518
518
|
@dragover=${i=>this.#U(i,r)}
|
|
@@ -540,7 +540,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
540
540
|
@dragstart=${i=>this.#E(i,e.id)}
|
|
541
541
|
@dragend=${()=>this.#q()}
|
|
542
542
|
>
|
|
543
|
-
${
|
|
543
|
+
${J()}
|
|
544
544
|
</td>`:p}
|
|
545
545
|
${this.#t.columns.map(i=>this.#I(e,i))}
|
|
546
546
|
<td class="row-actions">
|
|
@@ -549,9 +549,9 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
549
549
|
class="comment"
|
|
550
550
|
aria-label=${t.commentAriaLabel(this.#w(e))}
|
|
551
551
|
title=${t.commentAriaLabel(this.#w(e))}
|
|
552
|
-
@click=${i=>{i.stopPropagation(),this.#
|
|
552
|
+
@click=${i=>{i.stopPropagation(),this.#O(e.id)}}
|
|
553
553
|
>
|
|
554
|
-
${
|
|
554
|
+
${qt()}
|
|
555
555
|
</button>`:p}
|
|
556
556
|
${!this.readonly&&this.id?l`<button
|
|
557
557
|
type="button"
|
|
@@ -560,7 +560,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
560
560
|
title=${t.deleteRowAriaLabel(this.#w(e))}
|
|
561
561
|
@click=${i=>{i.stopPropagation(),this.#S(e)}}
|
|
562
562
|
>
|
|
563
|
-
${
|
|
563
|
+
${X()}
|
|
564
564
|
</button>`:p}
|
|
565
565
|
</td>
|
|
566
566
|
</tr>`}#I(t,e){const r=t.cells[e.id];if(r===void 0)return l`<td></td>`;switch(r.type){case"text":return this.#$(t,e,r.value??"");case"number":return this.#$(t,e,r.value===null?"":String(r.value));case"tag":return l`<td>
|
|
@@ -575,7 +575,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
575
575
|
@keydown=${i=>this.#T(i)}
|
|
576
576
|
@blur=${i=>this.#A(t,e,i)}
|
|
577
577
|
/>
|
|
578
|
-
</td>`:l`<td @dblclick=${()=>this.#C(t.id,e.id)}>${r}</td>`}#C(t,e){this.#l={row:t,column:e},this.requestUpdate(),this.updateComplete.then(()=>{const r=this.renderRoot.querySelector(".cell-input");r?.focus(),r?.select()})}#T(t){t.isComposing||(t.key==="Escape"?(t.preventDefault(),this.#l=null,this.requestUpdate()):t.key==="Enter"&&t.currentTarget instanceof HTMLInputElement&&(t.preventDefault(),t.currentTarget.blur()))}#A(t,e,r){if(!(r.target instanceof HTMLInputElement))return;this.#l=null;const a=r.target.value;if(e.type==="number"){const i=a.trim()===""?null:Number(a);if(i!==null&&Number.isNaN(i)){this.requestUpdate();return}this.#y(N,x(this.id,t.id),{column:e.id,value:i})}else this.#y(N,x(this.id,t.id),{column:e.id,value:a});this.requestUpdate()}#R(){if(!this.id)return;const t=new Set(this.#t.rows.map(a=>a.id)),e=
|
|
578
|
+
</td>`:l`<td @dblclick=${()=>this.#C(t.id,e.id)}>${r}</td>`}#C(t,e){this.#l={row:t,column:e},this.requestUpdate(),this.updateComplete.then(()=>{const r=this.renderRoot.querySelector(".cell-input");r?.focus(),r?.select()})}#T(t){t.isComposing||(t.key==="Escape"?(t.preventDefault(),this.#l=null,this.requestUpdate()):t.key==="Enter"&&t.currentTarget instanceof HTMLInputElement&&(t.preventDefault(),t.currentTarget.blur()))}#A(t,e,r){if(!(r.target instanceof HTMLInputElement))return;this.#l=null;const a=r.target.value;if(e.type==="number"){const i=a.trim()===""?null:Number(a);if(i!==null&&Number.isNaN(i)){this.requestUpdate();return}this.#y(N,x(this.id,t.id),{column:e.id,value:i})}else this.#y(N,x(this.id,t.id),{column:e.id,value:a});this.requestUpdate()}#R(){if(!this.id)return;const t=new Set(this.#t.rows.map(a=>a.id)),e=Mt("row",t),r=this.#y(ct,pt(this.id),{id:e,cells:{}});this.#f=r?null:"row",r&&(this.#o=e),this.requestUpdate()}#S(t){this.id&&(this.#y(ut,x(this.id,t.id),{}),this.#o===t.id&&(this.#o=null))}#v(t){this.#o=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-table-select",{detail:{id:t},bubbles:!0,composed:!0}))}#L(t,e){t.target===t.currentTarget&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#v(e))}#O(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:x(this.id,t)},bubbles:!0,composed:!0}))}#E(t,e){this.#p()&&(this.#c=e,t.dataTransfer?.setData("text/plain",e))}#U(t,e){if(!e||this.#c===null)return;t.preventDefault();const r=this.#M(t);r!==this.#d&&(this.#d=r,this.requestUpdate())}#_(t,e){const r=this.#c;if(!e||r===null||!this.id)return;t.preventDefault();const a=this.#M(t);if(this.#q(),a===r)return;const i=this.#t.rows,o=i.findIndex(d=>d.id===r),n=a===null?i.length:i.findIndex(d=>d.id===a);o===n||o+1===n||this.#y(ht,x(this.id,r),{before:a})}#q(){this.#c===null&&this.#d===null||(this.#c=null,this.#d=null,this.requestUpdate())}#M(t){const e=t.currentTarget;return(e instanceof HTMLElement?[...e.querySelectorAll("[data-row]")]:[]).find(i=>{if(i.dataset.row===this.#c)return!1;const o=i.getBoundingClientRect();return t.clientY<o.top+o.height/2})?.dataset.row??null}#w(t){for(const e of this.#t.columns){const r=t.cells[e.id];if(r?.type==="text"&&r.value||r?.type==="person"&&r.value)return r.value}return t.id}#N(t){const e=t.questions?.trim();return e===void 0||e===""?p:e}#y(t,e,r){const a=new CustomEvent("dpk-element-action",{detail:{type:t,target:e,payload:r},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(a),a.defaultPrevented}#B(){if(this.#i===null)this.#t=ot(),this.#m=this.#g.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=de(this.#u,this.#i,this.#g);this.#t=t.data,this.#m=t.results}this.#o!==null&&!this.#t.rows.some(t=>t.id===this.#o)&&(this.#o=null),this.requestUpdate()}}const ue=()=>{customElements.get("dpk-table")||customElements.define("dpk-table",mt)},ft=(s,t)=>{const e=Math.max(s.left,t.left),r=Math.max(s.top,t.top),a=Math.min(s.left+s.width,t.left+t.width),i=Math.min(s.top+s.height,t.top+t.height);return a>e&&i>r?{left:e,top:r,width:a-e,height:i-r}:null},he=(s,t)=>{const e=t.flatMap(d=>{const c=ft(s,d);return c?[c]:[]});if(!e[0])return null;const a=Math.min(...e.map(d=>d.left)),i=Math.min(...e.map(d=>d.top)),o=Math.max(...e.map(d=>d.left+d.width)),n=Math.max(...e.map(d=>d.top+d.height));return{box:{left:a,top:i,width:o-a,height:n-i},parts:t.map(d=>ft(s,d)?{left:d.left-a,top:d.top-i,width:d.width,height:d.height}:null)}},pe=(s,t,e)=>{const r=s.dataTransfer;if(!r)return;const a=he(e.getBoundingClientRect(),t.map(d=>d.getBoundingClientRect()));if(!a)return;const{box:i}=a,o=document.createElement("div");o.style.cssText=["position: fixed",`left: ${i.left}px`,`top: ${i.top}px`,`width: ${i.width}px`,`height: ${i.height}px`,"overflow: hidden","pointer-events: none","z-index: 2147483647",`background: ${getComputedStyle(e).backgroundColor}`].join("; ");for(const[d,c]of t.entries()){const h=a.parts[d],u=S(c);!h||!(u instanceof HTMLElement)||(u.style.position="absolute",u.style.left=`${h.left}px`,u.style.top=`${h.top}px`,u.style.width=`${h.width}px`,u.style.height=`${h.height}px`,u.style.margin="0",u.style.boxSizing="border-box",o.append(u))}const n=e.getRootNode();(n instanceof ShadowRoot?n:document.body).append(o),r.setDragImage(o,s.clientX-i.left,s.clientY-i.top),setTimeout(()=>o.remove(),0)},S=s=>{if(s instanceof Element&&s.shadowRoot)return ge(s,s.shadowRoot);const t=s.cloneNode(!1);t instanceof Element&&t.removeAttribute("id");for(const e of s.childNodes)t.appendChild(S(e));return t},ge=(s,t)=>{const e=document.createElement("span");for(const o of s.attributes)o.name!=="id"&&e.setAttribute(o.name,o.value);const r=getComputedStyle(s),a=s.getBoundingClientRect();e.style.display=r.display==="inline"?"inline-block":r.display,e.style.width=`${a.width}px`,e.style.height=`${a.height}px`,e.style.boxSizing="border-box",e.style.flex="none",e.style.verticalAlign=r.verticalAlign;const i=e.attachShadow({mode:"open"});"adoptedStyleSheets"in t&&(i.adoptedStyleSheets=t.adoptedStyleSheets);for(const o of t.childNodes)i.appendChild(S(o));for(const o of s.childNodes)e.appendChild(S(o));return e},bt=s=>s.some(t=>(t.subColumns?.length??0)>0),xt=s=>Math.max(s.subColumns?.length??1,1),vt=s=>{const t=s.subColumns??[];return t.length===0?[{columnId:s.id}]:t.map(e=>({columnId:s.id,subColumnId:e.id}))},P=s=>s.flatMap(vt),me=(s,t)=>t.subColumnId===void 0?s.draggable!==!1:(s.subColumns??[]).find(e=>e.id===t.subColumnId)?.draggable!==!1,j=(s,t)=>{const e=s.subColumns??[];return[e[0]?.id===t?"first":"",e.at(-1)?.id===t?"last":""].filter(r=>r!=="").join(" ")},wt="corner",yt="corner-sub",H=s=>`row-head:${s}`,F=s=>`col-head:${s}`,K=(s,t)=>`sub-head:${s}:${t}`,kt=(s,t)=>t.subColumnId===void 0?`cell:${s}:${t.columnId}`:`cell:${s}:${t.columnId}:${t.subColumnId}`,$t="dpk-matrix-reorder-row",Ct="dpk-matrix-reorder-column",Tt="dpk-matrix-reorder-sub-column",fe=E`
|
|
579
579
|
:host {
|
|
580
580
|
display: block;
|
|
581
581
|
--dpk-matrix-row-head-width: 140px;
|
|
@@ -804,7 +804,7 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
804
804
|
.matrix-sub-head:is([data-col-drop='column'], [data-col-drop='subColumn']) {
|
|
805
805
|
background-image: linear-gradient(var(--dpk-blue-soft), var(--dpk-blue-soft));
|
|
806
806
|
}
|
|
807
|
-
`;class Rt extends D{static{this.styles=[I,fe]}static{this.properties={rows:{attribute:!1},columns:{attribute:!1}}}#e=null;#r=null;constructor(){super(),this.rows=[],this.columns=[]}willUpdate(t){!t.has("rows")&&!t.has("columns")||this.#e&&!this.#n()&&(this.#e=null,this.#r=null)}#n(){const t=this.#e;return t?t.kind==="row"?this.rows.some(r=>r.id===t.id):t.kind==="column"?this.columns.some(r=>r.id===t.id):(this.columns.find(r=>r.id===t.columnId)?.subColumns??[]).some(r=>r.id===t.id):!0}updated(){this.#i()}#i(){for(const t of this.rows)this.#a(H(t.id),t.draggable!==!1);for(const t of this.columns){this.#a(F(t.id),t.draggable!==!1);for(const e of t.subColumns??[])this.#a(K(t.id,e.id),e.draggable!==!1)}}#a(t,e){const r=this.renderRoot.querySelector(`slot[name="${t}"]`);if(r instanceof HTMLSlotElement)for(const a of r.assignedElements({flatten:!0}))a instanceof HTMLElement&&(a.draggable=e)}#t(t){return t?l`<span class="matrix-grip" aria-hidden="true">${
|
|
807
|
+
`;class Rt extends D{static{this.styles=[I,fe]}static{this.properties={rows:{attribute:!1},columns:{attribute:!1}}}#e=null;#r=null;constructor(){super(),this.rows=[],this.columns=[]}willUpdate(t){!t.has("rows")&&!t.has("columns")||this.#e&&!this.#n()&&(this.#e=null,this.#r=null)}#n(){const t=this.#e;return t?t.kind==="row"?this.rows.some(r=>r.id===t.id):t.kind==="column"?this.columns.some(r=>r.id===t.id):(this.columns.find(r=>r.id===t.columnId)?.subColumns??[]).some(r=>r.id===t.id):!0}updated(){this.#i()}#i(){for(const t of this.rows)this.#a(H(t.id),t.draggable!==!1);for(const t of this.columns){this.#a(F(t.id),t.draggable!==!1);for(const e of t.subColumns??[])this.#a(K(t.id,e.id),e.draggable!==!1)}}#a(t,e){const r=this.renderRoot.querySelector(`slot[name="${t}"]`);if(r instanceof HTMLSlotElement)for(const a of r.assignedElements({flatten:!0}))a instanceof HTMLElement&&(a.draggable=e)}#t(t){return t?l`<span class="matrix-grip" aria-hidden="true">${J()}</span>`:""}render(){const t=bt(this.columns),e=P(this.columns).length;return l`
|
|
808
808
|
<div class="matrix-scroll">
|
|
809
809
|
<div class="matrix-grid" style=${`--matrix-cols:${e}`}>
|
|
810
810
|
<div class="matrix-head">
|
|
@@ -897,8 +897,8 @@ import{a5 as G,ah as E,ak as D,X as I,j as X,ag as Et,al as Y,aE as Dt,ai as p,a
|
|
|
897
897
|
@dragenter=${r=>this.#v(r,e)}
|
|
898
898
|
@dragover=${r=>this.#v(r,e)}
|
|
899
899
|
@dragleave=${()=>this.#L(e)}
|
|
900
|
-
@drop=${r=>this.#
|
|
900
|
+
@drop=${r=>this.#O(r,e)}
|
|
901
901
|
>
|
|
902
902
|
<slot name=${kt(t.id,e)}></slot>
|
|
903
903
|
</div>
|
|
904
|
-
`}#c(t){if(t.subColumnId===void 0)return"";const e=this.columns.find(r=>r.id===t.columnId);return e?j(e,t.subColumnId):""}#d(t){const e=this.#e;return e?e.kind==="column"?e.id===t.columnId:e.kind==="subColumn"?e.columnId===t.columnId&&e.id===t.subColumnId:!1:!1}#f(t){return this.#r===`column:${t.columnId}`?"column":t.subColumnId!==void 0&&this.#r===`sub:${t.columnId}:${t.subColumnId}`?"subColumn":"none"}#u(t){this.#r!==t&&(this.#r=t,this.requestUpdate())}#h(t){this.#r===t&&(this.#r=null,this.requestUpdate())}#p(){this.#e===null&&this.#r===null||(this.#e=null,this.#r=null,this.requestUpdate())}#b(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))}#x(t){const e=t.currentTarget;return e instanceof Element?st(e.getBoundingClientRect(),t.clientY):"end"}#D(t,e){if(e.draggable===!1)return;this.#e={kind:"row",id:e.id},t.dataTransfer?.setData("text/plain",`row:${e.id}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const a=(t.currentTarget instanceof Element?t.currentTarget:null)?.closest(".matrix-row");if(a&&t.dataTransfer){const i=a.getBoundingClientRect();t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top)}this.requestUpdate()}#k(t,e){e.draggable===!1||this.#e?.kind!=="row"||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`row:${e.id}`))}#I(t,e){const r=this.#e;if(e.draggable===!1||r?.kind!=="row")return;t.preventDefault();const a=this.#x(t),i=R(this.rows.map(o=>o.id),r.id,e.id,a);this.#p(),this.#b($t,{rowId:r.id,after:i})}#$(t,e){e.draggable!==!1&&(this.#e={kind:"column",id:e.id},t.dataTransfer?.setData("text/plain",`column:${e.id}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),this.#E(t,r=>r.getAttribute("data-column")===e.id),this.requestUpdate())}#C(t,e){e.draggable===!1||this.#e?.kind!=="column"||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`column:${e.id}`))}#T(t,e){const r=this.#e;if(e.draggable===!1||r?.kind!=="column")return;t.preventDefault();const a=this.#x(t),i=R(this.columns.map(o=>o.id),r.id,e.id,a);this.#p(),this.#b(Ct,{columnId:r.id,after:i})}#A(t,e,r){(e.subColumns??[]).find(i=>i.id===r)?.draggable!==!1&&(this.#e={kind:"subColumn",columnId:e.id,id:r},t.dataTransfer?.setData("text/plain",`sub-column:${e.id}:${r}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),this.#E(t,i=>i.getAttribute("data-column")===e.id&&i.getAttribute("data-sub-column")===r),this.requestUpdate())}#R(t,e,r){const a=this.#e;a?.kind!=="subColumn"||a.columnId!==e.id||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`sub:${e.id}:${r}`))}#S(t,e,r){const a=this.#e;if(a?.kind!=="subColumn"||a.columnId!==e.id)return;t.preventDefault();const i=this.#x(t),o=(e.subColumns??[]).map(d=>d.id),n=R(o,a.id,r,i);this.#p(),this.#b(Tt,{columnId:e.id,subColumnId:a.id,after:n})}#v(t,e){const r=this.#e;if(r){if(r.kind==="column"){t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`column:${e.columnId}`);return}r.kind==="subColumn"&&e.subColumnId!==void 0&&r.columnId===e.columnId&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`sub:${e.columnId}:${e.subColumnId}`))}}#L(t){this.#h(`column:${t.columnId}`),t.subColumnId!==void 0&&this.#h(`sub:${t.columnId}:${t.subColumnId}`)}#
|
|
904
|
+
`}#c(t){if(t.subColumnId===void 0)return"";const e=this.columns.find(r=>r.id===t.columnId);return e?j(e,t.subColumnId):""}#d(t){const e=this.#e;return e?e.kind==="column"?e.id===t.columnId:e.kind==="subColumn"?e.columnId===t.columnId&&e.id===t.subColumnId:!1:!1}#f(t){return this.#r===`column:${t.columnId}`?"column":t.subColumnId!==void 0&&this.#r===`sub:${t.columnId}:${t.subColumnId}`?"subColumn":"none"}#u(t){this.#r!==t&&(this.#r=t,this.requestUpdate())}#h(t){this.#r===t&&(this.#r=null,this.requestUpdate())}#p(){this.#e===null&&this.#r===null||(this.#e=null,this.#r=null,this.requestUpdate())}#b(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))}#x(t){const e=t.currentTarget;return e instanceof Element?st(e.getBoundingClientRect(),t.clientY):"end"}#D(t,e){if(e.draggable===!1)return;this.#e={kind:"row",id:e.id},t.dataTransfer?.setData("text/plain",`row:${e.id}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const a=(t.currentTarget instanceof Element?t.currentTarget:null)?.closest(".matrix-row");if(a&&t.dataTransfer){const i=a.getBoundingClientRect();t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top)}this.requestUpdate()}#k(t,e){e.draggable===!1||this.#e?.kind!=="row"||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`row:${e.id}`))}#I(t,e){const r=this.#e;if(e.draggable===!1||r?.kind!=="row")return;t.preventDefault();const a=this.#x(t),i=R(this.rows.map(o=>o.id),r.id,e.id,a);this.#p(),this.#b($t,{rowId:r.id,after:i})}#$(t,e){e.draggable!==!1&&(this.#e={kind:"column",id:e.id},t.dataTransfer?.setData("text/plain",`column:${e.id}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),this.#E(t,r=>r.getAttribute("data-column")===e.id),this.requestUpdate())}#C(t,e){e.draggable===!1||this.#e?.kind!=="column"||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`column:${e.id}`))}#T(t,e){const r=this.#e;if(e.draggable===!1||r?.kind!=="column")return;t.preventDefault();const a=this.#x(t),i=R(this.columns.map(o=>o.id),r.id,e.id,a);this.#p(),this.#b(Ct,{columnId:r.id,after:i})}#A(t,e,r){(e.subColumns??[]).find(i=>i.id===r)?.draggable!==!1&&(this.#e={kind:"subColumn",columnId:e.id,id:r},t.dataTransfer?.setData("text/plain",`sub-column:${e.id}:${r}`),t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),this.#E(t,i=>i.getAttribute("data-column")===e.id&&i.getAttribute("data-sub-column")===r),this.requestUpdate())}#R(t,e,r){const a=this.#e;a?.kind!=="subColumn"||a.columnId!==e.id||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`sub:${e.id}:${r}`))}#S(t,e,r){const a=this.#e;if(a?.kind!=="subColumn"||a.columnId!==e.id)return;t.preventDefault();const i=this.#x(t),o=(e.subColumns??[]).map(d=>d.id),n=R(o,a.id,r,i);this.#p(),this.#b(Tt,{columnId:e.id,subColumnId:a.id,after:n})}#v(t,e){const r=this.#e;if(r){if(r.kind==="column"){t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`column:${e.columnId}`);return}r.kind==="subColumn"&&e.subColumnId!==void 0&&r.columnId===e.columnId&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.#u(`sub:${e.columnId}:${e.subColumnId}`))}}#L(t){this.#h(`column:${t.columnId}`),t.subColumnId!==void 0&&this.#h(`sub:${t.columnId}:${t.subColumnId}`)}#O(t,e){const r=this.#e;if(r){if(r.kind==="column"){const a=this.columns.find(i=>i.id===e.columnId);a&&this.#T(t,a);return}if(r.kind==="subColumn"&&e.subColumnId!==void 0&&r.columnId===e.columnId){const a=this.columns.find(i=>i.id===e.columnId);a&&this.#S(t,a,e.subColumnId)}}}#E(t,e){const r=this.renderRoot.querySelector(".matrix-scroll");if(!r)return;const a=[...r.querySelectorAll("[data-column]")].filter(e),i=a.filter(n=>n.classList.contains("matrix-col-head")||n.classList.contains("matrix-sub-head")),o=a.filter(n=>!i.includes(n));pe(t,[...o,...i],r)}}const be=()=>{customElements.get("dpk-matrix")||customElements.define("dpk-matrix",Rt)};export{et as B,wt as C,it as D,zt as E,Ct as M,yt as a,Rt as b,mt as c,$t as d,Tt as e,P as f,kt as g,F as h,Gt as i,be as j,ue as k,bt as l,me as m,vt as n,j as o,dt as p,K as q,H as r,xt as s,Pt as t,jt as u,q as v,R as w,Ft as x};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as S,L as T,V as _}from"./shared-D7lvvzdN.js";import{m as j,q as a,k as o,h as k,j as l,C as B,v as E,w as $}from"./shared-CVEzSR4J.js";const r=S({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=a({id:B,title:E(l(),$(1))}),c=a({title:o(l(),""),sections:o(k(x),[])}),p=t=>{const e=j(c,t),i=new Set;for(const n of e.sections){if(i.has(n.id))throw new Error(`duplicate section id: ${n.id}`);i.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),s=(t,e)=>t.sections.find(i=>i.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,i)=>{switch(i.type){case"section":return s(e,i.id)?.title??i.id;case"page":return t.wholePage;default:return i.id}},g=(t,e,i)=>({title:e.type,targetLabel:u(t,i,e.target),tone:"meta"}),f=t=>`${t.type} ${T(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(i=>({value:`section:${i.id}`,label:i.title,group:t.sectionGroup})),w=(t,e)=>e,y=(t,e)=>{switch(e.type){case"section":return s(t,e.id)!==void 0;case"page":return!0;default:return!1}},P=t=>{const e=r(t);return{kind:"view",name:"plain",label:"Plain",addable:!1,parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:y,describe:(i,n)=>g(e,i,n),serialize:f,resolveNavigation:w,commentTargets:i=>h(e,i),title:m}};class b extends _{definitionFor(e){return P(e)}renderRegions(e){return{}}}const v=()=>{customElements.get("dpk-view-plain")||customElements.define("dpk-view-plain",b)},L=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPlain:b,definePlainElement:v,describePlainAction:g,emptyPlainBase:d,findSection:s,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:P,plainHasTarget:y,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:w,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{v as d,L as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as d,a7 as p,O as f,i as b,a4 as v,a8 as m,aj as k,ag as a}from"./shared-D7lvvzdN.js";import{o as g}from"./shared-D4PPk0Dk.js";import{m as y,q as o,k as q,j as l,h as C,v as n,w as r}from"./shared-CVEzSR4J.js";const h=d({en:{fallbackLabel:"Select",required:"Choose one."},ja:{fallbackLabel:"\u9078\u629E",required:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}}),S=o({value:n(l(),r(1)),label:n(l(),r(1))}),w=o({options:C(S),value:q(l())}),c=i=>{const e=y(w,i),t=new Set;for(const s of e.options){if(t.has(s.value))throw new Error(`duplicate option value: ${s.value}`);t.add(s.value)}return{options:e.options,value:e.value??null}};class u extends p{static{this.formAssociated=!0}static{this.styles=[f,b,v`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -23,7 +23,7 @@ import{a5 as d,au as p,av as a,aw as f,ac as l,aa as b,ax as o,ay as n,ak as v,X
|
|
|
23
23
|
color: var(--dpk-danger);
|
|
24
24
|
font-size: 12px;
|
|
25
25
|
}
|
|
26
|
-
`]}static{this.properties={label:{type:String},placeholder:{type:String},name:{type:String,reflect:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},block:{type:Boolean,reflect:!0}}}#n=new
|
|
26
|
+
`]}static{this.properties={label:{type:String},placeholder:{type:String},name:{type:String,reflect:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},block:{type:Boolean,reflect:!0}}}#n=new m(this);#h=new k(this);#l=typeof this.attachInternals=="function"?this.attachInternals():null;#i=null;#a=[];#o=null;#e="";#r="";#t=null;constructor(){super(),this.label=null,this.placeholder=null,this.name=null,this.required=!1,this.disabled=!1,this.block=!1}connectedCallback(){super.connectedCallback(),this.#i=g(this,c,e=>{this.#o===null&&(e.ok?(this.#a=e.value.options,this.#t=null,e.value.value!==null&&(this.#e=e.value.value,this.#r=e.value.value)):(this.#a=[],this.#t=e.error),this.#s(),this.requestUpdate())})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.(),this.#i=null}updated(){this.#c()}get value(){return this.#e}set value(e){const t=e??"";t!==this.#e&&(this.#e=t,this.#s(),this.requestUpdate())}get options(){return this.#o??this.#a}set options(e){this.#o=e??null,this.#t=null,this.requestUpdate()}get form(){return this.#l?.form??null}formResetCallback(){this.#e=this.#r,this.#s(),this.requestUpdate()}formStateRestoreCallback(e,t){typeof e=="string"&&(this.#e=e,this.#s(),this.requestUpdate())}#s(){this.#l?.setFormValue?.(this.#e===""?null:this.#e)}#c(){if(this.required&&this.#e===""){const e=this.renderRoot.querySelector(".dpk-rich-select")??void 0;this.#l?.setValidity?.({valueMissing:!0},h(this.#n.locale).required,e)}else this.#l?.setValidity?.({})}render(){if(this.#t!==null)return a`<p class="error">${this.#t}</p>`;const e=this.getAttribute("aria-label")??this.label??h(this.#n.locale).fallbackLabel,t=this.#h.render({options:this.options,value:this.#e,onChange:s=>this.#u(s),ariaLabel:e,placeholder:this.placeholder??void 0,disabled:this.disabled});return this.label===null?t:a`
|
|
27
27
|
<div class="field">
|
|
28
28
|
<span class="field-label">${this.label}</span>
|
|
29
29
|
${t}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{az as se,au as le,av as v,aw as E,aa as D,aN as ce,aM as A,aL as l,ac as c,ax as L,ay as S,p as b,a9 as f,t as pe,N as ue,e as B,a5 as ge,S as z,P as $,bf as me,a7 as ve,a6 as be,ai as p,z as he,as as s,aH as ye,aP as ke,I as fe,bg as $e,ah as xe,V as M,bh as we,l as Ee}from"./shared-B8ZhyjWv.js";import{o as De}from"./shared-LHG2FbnK.js";const h=[1,2,3,4,5,6,7],y=se(h,"a delegation level is an integer from 1 to 7"),k=L(c(),S(1)),Ae=v({player:k,level:y,reason:l(c())}),q=v({title:l(c()),parties:l(v({delegator:l(k),delegate:l(k)})),players:E(D(v({id:A,name:k})),[]),decisions:E(D(v({id:A,name:k,description:l(c()),cards:E(D(Ae),[]),agreed:l(y),questions:ce})),[])}),V=e=>{const a=le(q,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},K=()=>({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),C=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:y})),AGREE_LEVEL:b("AGREE_LEVEL","decision",f({level:y})),ADD_DECISION:b("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:pe}),SET_DECISION_NAME:b("SET_DECISION_NAME","decision",f({name:L(c(),S(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:{}})},j=(e,a)=>{const r=ue(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(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:C(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 T(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 B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,H={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"},Le={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`},Se={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`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>H[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${H[e]}`,statusLabel:e=>Ce[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)=>Se[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Te[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"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,G=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(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}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:h.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(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=>Ne(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}}},U=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),W={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:U(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:U(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:Ie(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)})},Q=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(W,a.type)?W[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:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},X=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(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 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:j,hasTarget:re,describe:(r,o,t)=>Q(a,r,o,t),serialize:X,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):be(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
1
|
+
import{x as se,m as le,q as v,k as E,h as D,C as A,B as l,j as c,v as L,w as S,d as h,o as f,e as ce,p as pe,b as B,f as $}from"./shared-CVEzSR4J.js";import{ap as ue,_ as ge,L as z,aK as me,a0 as ve,$ as he,a5 as p,u as be,ag as s,al as ke,aq as ye,B as fe,aL as $e,a4 as xe,V as q,aM as we,k as Ee}from"./shared-D7lvvzdN.js";import{o as De}from"./shared-DIYD6Tuj.js";const b=[1,2,3,4,5,6,7],k=se(b,"a delegation level is an integer from 1 to 7"),y=L(c(),S(1)),Ae=v({player:y,level:k,reason:l(c())}),M=v({title:l(c()),parties:l(v({delegator:l(y),delegate:l(y)})),players:E(D(v({id:A,name:y})),[]),decisions:E(D(v({id:A,name:y,description:l(c()),cards:E(D(Ae),[]),agreed:l(k),questions:ue})),[])}),V=e=>{const a=le(M,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},K=()=>({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),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:h("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:h("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:h("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:ce}),SET_DECISION_NAME:h("SET_DECISION_NAME","decision",f({name:L(c(),S(1))})),DELETE_DECISION:h("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:{}})},F=(e,a)=>{const r=pe(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(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:C(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 T(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 B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,Y={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},G={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"},Le={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`},Se={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`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Ce[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=>G[e],levelPhrase:(e,a,r)=>Se[e](a,r),levelLabel:e=>`${e} ${G[e]}`,statusLabel:e=>Te[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"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,H=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(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}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:b.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:b.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Ne(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}}},U=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),W={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:U(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:U(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:Ie(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)})},Q=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(W,a.type)?W[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:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},X=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(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 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:F,hasTarget:re,describe:(r,o,t)=>Q(a,r,o,t),serialize:X,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):he(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
2
2
|
<button
|
|
3
3
|
class="dpk-icon-btn"
|
|
4
4
|
type="button"
|
|
@@ -7,7 +7,7 @@ import{az as se,au as le,av as v,aw as E,aa as D,aN as ce,aM as A,aL as l,ac as
|
|
|
7
7
|
title=${a}
|
|
8
8
|
@click=${()=>o.comment(e)}
|
|
9
9
|
>
|
|
10
|
-
${
|
|
10
|
+
${be()} ${r>0?s`<span class="dpk-icon-badge">${r}</span>`:p}
|
|
11
11
|
</button>
|
|
12
12
|
`,Be=e=>{const{context:a,m:r,mode:o}=e,{progress:t}=O(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}
|
|
@@ -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>`},
|
|
29
|
+
</div>`},qe=e=>{const{context:a,handlers:r,m:o,mode:t}=e,i=O(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>
|
|
@@ -39,14 +39,14 @@ ${i} \u2192 ${d}`}
|
|
|
39
39
|
<span class="cell-agree" role="columnheader">${o.agreeColumn}</span>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
|
-
<div class="board-scroll" role="rowgroup" @scroll=${
|
|
43
|
-
${
|
|
42
|
+
<div class="board-scroll" role="rowgroup" @scroll=${Me}>
|
|
43
|
+
${ke(i.rows,d=>d.id,d=>Ke(e,i.levels,d))}
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
<button class="add-decision" type="button" data-testid="add-decision" @click=${r.addDecision}>
|
|
47
47
|
${o.addDecision}
|
|
48
48
|
</button>
|
|
49
|
-
</section>`},
|
|
49
|
+
</section>`},Me=e=>{const a=e.currentTarget;if(!(a instanceof HTMLElement))return;const r=a.previousElementSibling;r instanceof HTMLElement&&(r.scrollLeft=a.scrollLeft)},Ve=e=>s`<span
|
|
50
50
|
class="cell cell--head"
|
|
51
51
|
role="columnheader"
|
|
52
52
|
data-level=${e.level}
|
|
@@ -68,7 +68,7 @@ ${i} \u2192 ${d}`}
|
|
|
68
68
|
class="row-name"
|
|
69
69
|
.value=${r.name}
|
|
70
70
|
.label=${i.decisionNameLabel}
|
|
71
|
-
@dpk-commit=${
|
|
71
|
+
@dpk-commit=${ye(n=>t.rename(r.id,n))}
|
|
72
72
|
></dpk-inline-edit>
|
|
73
73
|
<span class="row-tools">
|
|
74
74
|
${Re(d,i.commentButton,o.commentCount(d),t)}
|
|
@@ -91,9 +91,9 @@ ${i} \u2192 ${d}`}
|
|
|
91
91
|
${r.hidden>0?s`<small>${i.hiddenCards(r.hidden)}</small>`:p}
|
|
92
92
|
</div>
|
|
93
93
|
</div>
|
|
94
|
-
${r.cells.map(n=>
|
|
95
|
-
<div class="cell-agree" role="cell">${
|
|
96
|
-
</div>`},
|
|
94
|
+
${r.cells.map(n=>je(e,r,a,n))}
|
|
95
|
+
<div class="cell-agree" role="cell">${Fe(e,a,r)}</div>
|
|
96
|
+
</div>`},je=(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"
|
|
99
99
|
type="button"
|
|
@@ -111,7 +111,7 @@ ${i} \u2192 ${d}`}
|
|
|
111
111
|
>${n.label}</span
|
|
112
112
|
>`)}
|
|
113
113
|
</button>
|
|
114
|
-
</div>`},
|
|
114
|
+
</div>`},Fe=(e,a,r)=>{const{handlers:o,m:t,agreeSelects:i}=e;return i.get(r.id).render({options:a.map(d=>({value:String(d.level),label:d.label})),value:r.agreed===void 0?"":String(r.agreed),onChange:d=>{const n=b.find(w=>String(w)===d);n!==void 0&&n!==r.agreed&&o.agree(r.id,n)},ariaLabel:t.agreeLabel(r.name),placeholder:t.notAgreed,className:"agree-select"})},Ye=(e,a,r)=>a===null?p:s`<div class="confirm-backdrop" @click=${r.cancel}>
|
|
115
115
|
<div
|
|
116
116
|
class="confirm"
|
|
117
117
|
role="alertdialog"
|
|
@@ -143,7 +143,7 @@ ${i} \u2192 ${d}`}
|
|
|
143
143
|
</button>
|
|
144
144
|
</div>
|
|
145
145
|
</div>
|
|
146
|
-
</div>`,
|
|
146
|
+
</div>`,Ge=xe`
|
|
147
147
|
[data-level='1'] {
|
|
148
148
|
--lv: var(--dpk-blue);
|
|
149
149
|
}
|
|
@@ -599,4 +599,4 @@ ${i} \u2192 ${d}`}
|
|
|
599
599
|
.empty .dpk-btn {
|
|
600
600
|
justify-self: start;
|
|
601
601
|
}
|
|
602
|
-
`;class de extends
|
|
602
|
+
`;class de extends q{static{this.styles=[q.styles,Ge]}static{this.properties={mode:{type:String},pending:{state:!0},skipConfirm:{state:!0}}}#a=null;#e=null;#r=new we(this);constructor(){super(),this.mode=null,this.pending=null,this.skipConfirm=!1}connectedCallback(){super.connectedCallback(),this.#a=Oe(this.storage!=="off"&&this.storage!=="memory"),this.skipConfirm=this.#a.read()}definitionFor(a){return oe(a)}renderRegions(a){const r=_(this.locale),o=this.#o(a,r),t={context:a,handlers:o,m:r,mode:P(this.mode),agreeSelects:this.#r},i=a.state.decisions.length===0?ze(t):qe(t);return{header:Be(t),main:s`${i}${Ye(r,this.pending,this.#t(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()}}#o(a,r){return{play:(o,t)=>{const i=a.state.decisions.find(n=>n.id===o);if(i===void 0)return;const d=H(P(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:B(d)}},agree:(o,t)=>{a.dispatch(m.agreeLevel(o,t))},addDecision:()=>{const o=Ee("decision",C(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)}}#t(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 ne=()=>{customElements.get("dpk-view-delegation-poker")||customElements.define("dpk-view-delegation-poker",de)},He=Object.freeze(Object.defineProperty({__proto__:null,DELEGATION_LEVELS:b,DELEGATION_POKER_PAGE:x,DpkViewDelegationPoker:de,allDelegationPokerIds:C,applyDelegationPokerAction:F,defineDelegationPokerElement:ne,delegationLevelSchema:k,delegationParties:I,delegationPokerAction:m,delegationPokerActions:g,delegationPokerBaseSchema:M,delegationPokerCommentTargets:ee,delegationPokerDefinitionFor:oe,delegationPokerHasTarget:re,delegationPokerMessages:_,delegationPokerTargetLabel:Z,delegationPokerTitle:R,describeDelegationPokerAction:Q,emptyDelegationPokerBase:K,findDecision:u,findPlayer:j,isLocked:N,parseDelegationPokerBase:V,parsePlayMode:P,playIntent:H,presentBoard:O,resolveDelegationPokerNavigation:ae,serializeDelegationPokerAction:X},Symbol.toStringTag,{value:"Module"}));export{ne as d,He as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a4 as e}from"./shared-D7lvvzdN.js";const r=e`
|
|
2
2
|
/* ------------------------------------------------------------ count */
|
|
3
3
|
|
|
4
4
|
/* How many: a small rounded mono figure, beside a tab or a heading. data-size='sm' is quieter. */
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const he={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function A(n){return he}let ve;function me(n){return ve?.get(n)}let de;function ke(n){return de?.get(n)}let be;function ge(n,t){return be?.get(n)?.get(t)}function S(n){const t=typeof n;return t==="string"?`"${n}"`:t==="number"||t==="bigint"||t==="boolean"?`${n}`:t==="object"||t==="function"?(n&&Object.getPrototypeOf(n)?.constructor?.name)??"null":t}function l(n,t,e,s,i){const r=i&&"input"in i?i.input:e.value,u=i?.expected??n.expects??null,c=i?.received??S(r),o={kind:n.kind,type:n.type,input:r,expected:u,received:c,message:`Invalid ${t}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:n.requirement,path:i?.path,issues:i?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},a=n.kind==="schema",p=i?.message??n.message??ge(n.reference,o.lang)??(a?ke(o.lang):null)??s.message??me(o.lang);p!==void 0&&(o.message=typeof p=="function"?p(o):p),a&&(e.typed=!1),e.issues?e.issues.push(o):e.issues=[o]}function xe(n,t){return n===t||Number.isNaN(n)&&Number.isNaN(t)}function Se(n,t){return Object.prototype.hasOwnProperty.call(n,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function P(n,t){const e=[...new Set(n)];return e.length>1?`(${e.join(` ${t} `)})`:e[0]??"never"}function f(n){return n["~standard"]={version:1,vendor:"valibot",validate:t=>n["~run"]({value:t},A())},n}function Ee(n){if(n.path){let t="";for(const e of n.path)if(typeof e.key=="string"||typeof e.key=="number")t?t+=`.${e.key}`:t+=e.key;else return null;return t}return null}var _e=class extends Error{constructor(n){super(n[0].message),this.name="ValiError",this.issues=n}};const Oe=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,je=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;function M(n,t){return{kind:"validation",type:"check",reference:M,async:!1,expects:null,requirement:n,message:t,"~run"(e,s){return e.typed&&!this.requirement(e.value)&&l(this,"input",e,s),e}}}function F(n){return{kind:"validation",type:"finite",reference:F,async:!1,expects:null,requirement:Number.isFinite,message:n,"~run"(t,e){return t.typed&&!this.requirement(t.value)&&l(this,"finite",t,e),t}}}function U(n,t){const e=S(n);return{kind:"validation",type:"includes",reference:U,async:!1,expects:e,requirement:n,message:t,"~run"(s,i){return s.typed&&!s.value.includes(this.requirement)&&l(this,"content",s,i,{received:`!${e}`}),s}}}function C(n){return{kind:"validation",type:"integer",reference:C,async:!1,expects:null,requirement:Number.isInteger,message:n,"~run"(t,e){return t.typed&&!this.requirement(t.value)&&l(this,"integer",t,e),t}}}function G(n){return{kind:"validation",type:"iso_date",reference:G,async:!1,expects:null,requirement:Oe,message:n,"~run"(t,e){return t.typed&&!this.requirement.test(t.value)&&l(this,"date",t,e),t}}}function z(n){return{kind:"validation",type:"iso_timestamp",reference:z,async:!1,expects:null,requirement:je,message:n,"~run"(t,e){return t.typed&&!this.requirement.test(t.value)&&l(this,"timestamp",t,e),t}}}function v(n,t){return{kind:"validation",type:"min_length",reference:v,async:!1,expects:`>=${n}`,requirement:n,message:t,"~run"(e,s){return e.typed&&e.value.length<this.requirement&&l(this,"length",e,s,{received:`${e.value.length}`}),e}}}function J(n,t){return{kind:"validation",type:"min_value",reference:J,async:!1,expects:`>=${n instanceof Date?n.toJSON():S(n)}`,requirement:n,message:t,"~run"(e,s){return e.typed&&!(e.value>=this.requirement)&&l(this,"value",e,s,{received:e.value instanceof Date?e.value.toJSON():S(e.value)}),e}}}function I(n,t){return{kind:"validation",type:"regex",reference:I,async:!1,expects:`${n}`,requirement:n,message:t,"~run"(e,s){return e.typed&&!this.requirement.test(e.value)&&l(this,"format",e,s),e}}}function Y(){return{kind:"transformation",type:"trim",reference:Y,async:!1,"~run"(n){return n.value=n.value.trim(),n}}}function X(n){return{kind:"validation",type:"url",reference:X,async:!1,expects:null,requirement(t){try{return URL.canParse?URL.canParse(t):(new URL(t),!0)}catch{return!1}},message:n,"~run"(t,e){return t.typed&&!this.requirement(t.value)&&l(this,"URL",t,e),t}}}const Z={abortEarly:!0};function T(n,t,e){return typeof n.fallback=="function"?n.fallback(t,e):n.fallback}function B(n,t){return f({...n,fallback:t,"~run"(e,s){const i=n["~run"](e,s);return i.issues?{typed:!0,value:T(this,i,s)}:i}})}function w(n,t,e){return typeof n.default=="function"?n.default(t,e):n.default}function De(n,t){return!n["~run"]({value:t},Z).issues}function Q(){return f({kind:"schema",type:"any",reference:Q,expects:"any",async:!1,"~run"(n){return n.typed=!0,n}})}function N(n,t){return f({kind:"schema",type:"array",reference:N,expects:"Array",async:!1,item:n,message:t,"~run"(e,s){const i=e.value;if(Array.isArray(i)){e.typed=!0,e.value=[];for(let r=0;r<i.length;r++){const u=i[r],c=this.item["~run"]({value:u},s);if(c.issues){const o={type:"array",origin:"value",input:i,key:r,value:u};for(const a of c.issues)a.path?a.path.unshift(o):a.path=[o],e.issues?.push(a);if(e.issues||(e.issues=c.issues),s.abortEarly){e.typed=!1;break}}c.typed||(e.typed=!1),e.value.push(c.value)}}else l(this,"type",e,s);return e}})}function H(n){return f({kind:"schema",type:"boolean",reference:H,expects:"boolean",async:!1,message:n,"~run"(t,e){return typeof t.value=="boolean"?t.typed=!0:l(this,"type",t,e),t}})}function _(n,t){return f({kind:"schema",type:"exact_optional",reference:_,expects:n.expects,async:!1,wrapped:n,default:t,"~run"(e,s){return this.wrapped["~run"](e,s)}})}function W(n){return f({kind:"schema",type:"function",reference:W,expects:"Function",async:!1,message:n,"~run"(t,e){return typeof t.value=="function"?t.typed=!0:l(this,"type",t,e),t}})}function ee(n){return f({kind:"schema",type:"lazy",reference:ee,expects:"unknown",async:!1,getter:n,"~run"(t,e){return this.getter(t.value)["~run"](t,e)}})}function b(n,t){return f({kind:"schema",type:"literal",reference:b,expects:S(n),async:!1,literal:n,message:t,"~run"(e,s){return xe(e.value,this.literal)?e.typed=!0:l(this,"type",e,s),e}})}function ne(n){return f({kind:"schema",type:"null",reference:ne,expects:"null",async:!1,message:n,"~run"(t,e){return t.value===null?t.typed=!0:l(this,"type",t,e),t}})}function te(n,t){return f({kind:"schema",type:"nullable",reference:te,expects:`(${n.expects} | null)`,async:!1,wrapped:n,default:t,"~run"(e,s){return e.value===null&&(this.default!==void 0&&(e.value=w(this,e,s)),e.value===null)?(e.typed=!0,e):this.wrapped["~run"](e,s)}})}function se(n){return f({kind:"schema",type:"number",reference:se,expects:"number",async:!1,message:n,"~run"(t,e){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:l(this,"type",t,e),t}})}function h(n,t){return f({kind:"schema",type:"object",reference:h,expects:"Object",async:!1,entries:n,message:t,"~run"(e,s){const i=e.value;if(i&&typeof i=="object"){e.typed=!0,e.value={};for(const r in this.entries){const u=this.entries[r];if(r in i||(u.type==="exact_optional"||u.type==="optional"||u.type==="nullish")&&u.default!==void 0){const c=r in i?i[r]:w(u),o=u["~run"]({value:c},s);if(o.issues){const a={type:"object",origin:"value",input:i,key:r,value:c};for(const p of o.issues)p.path?p.path.unshift(a):p.path=[a],e.issues?.push(p);if(e.issues||(e.issues=o.issues),s.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(u.fallback!==void 0)e.value[r]=T(u);else if(u.type!=="exact_optional"&&u.type!=="optional"&&u.type!=="nullish"&&(l(this,"key",e,s,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]}),s.abortEarly))break}}else l(this,"type",e,s);return e}})}function q(n,t){return f({kind:"schema",type:"optional",reference:q,expects:`(${n.expects} | undefined)`,async:!1,wrapped:n,default:t,"~run"(e,s){return e.value===void 0&&(this.default!==void 0&&(e.value=w(this,e,s)),e.value===void 0)?(e.typed=!0,e):this.wrapped["~run"](e,s)}})}function re(n,t){return f({kind:"schema",type:"picklist",reference:re,expects:P(n.map(S),"|"),async:!1,options:n,message:t,"~run"(e,s){return this.options.includes(e.value)?e.typed=!0:l(this,"type",e,s),e}})}function ie(n,t,e){return f({kind:"schema",type:"record",reference:ie,expects:"Object",async:!1,key:n,value:t,message:e,"~run"(s,i){const r=s.value;if(r&&typeof r=="object"){s.typed=!0,s.value={};for(const u in r)if(Se(r,u)){const c=r[u],o=this.key["~run"]({value:u},i);if(o.issues){const p={type:"object",origin:"key",input:r,key:u,value:c};for(const k of o.issues)k.path=[p],s.issues?.push(k);if(s.issues||(s.issues=o.issues),i.abortEarly){s.typed=!1;break}}const a=this.value["~run"]({value:c},i);if(a.issues){const p={type:"object",origin:"value",input:r,key:u,value:c};for(const k of a.issues)k.path?k.path.unshift(p):k.path=[p],s.issues?.push(k);if(s.issues||(s.issues=a.issues),i.abortEarly){s.typed=!1;break}}(!o.typed||!a.typed)&&(s.typed=!1),o.typed&&(s.value[o.value]=a.value)}}else l(this,"type",s,i);return s}})}function ue(n,t){return f({kind:"schema",type:"strict_object",reference:ue,expects:"Object",async:!1,entries:n,message:t,"~run"(e,s){const i=e.value;if(i&&typeof i=="object"){e.typed=!0,e.value={};for(const r in this.entries){const u=this.entries[r];if(r in i||(u.type==="exact_optional"||u.type==="optional"||u.type==="nullish")&&u.default!==void 0){const c=r in i?i[r]:w(u),o=u["~run"]({value:c},s);if(o.issues){const a={type:"object",origin:"value",input:i,key:r,value:c};for(const p of o.issues)p.path?p.path.unshift(a):p.path=[a],e.issues?.push(p);if(e.issues||(e.issues=o.issues),s.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(u.fallback!==void 0)e.value[r]=T(u);else if(u.type!=="exact_optional"&&u.type!=="optional"&&u.type!=="nullish"&&(l(this,"key",e,s,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]}),s.abortEarly))break}if(!e.issues||!s.abortEarly){for(const r in i)if(!Object.prototype.hasOwnProperty.call(this.entries,r)){l(this,"key",e,s,{input:r,expected:"never",path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]});break}}}else l(this,"type",e,s);return e}})}function y(n){return f({kind:"schema",type:"string",reference:y,expects:"string",async:!1,message:n,"~run"(t,e){return typeof t.value=="string"?t.typed=!0:l(this,"type",t,e),t}})}function oe(n){let t;if(n)for(const e of n)if(t)for(const s of e.issues)t.push(s);else t=e.issues;return t}function ce(n,t){return f({kind:"schema",type:"union",reference:ce,expects:P(n.map(e=>e.expects),"|"),async:!1,options:n,message:t,"~run"(e,s){let i,r,u;for(const c of this.options){const o=c["~run"]({value:e.value},s);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{i=o;break}else u?u.push(o):u=[o]}if(i)return i;if(r){if(r.length===1)return r[0];l(this,"type",e,s,{issues:oe(r)}),e.typed=!0}else{if(u?.length===1)return u[0];l(this,"type",e,s,{issues:oe(u)})}return e}})}function E(){return f({kind:"schema",type:"unknown",reference:E,expects:"unknown",async:!1,"~run"(n){return n.typed=!0,n}})}function O(n,t,e){return f({kind:"schema",type:"variant",reference:O,expects:"Object",async:!1,key:n,options:t,message:e,"~run"(s,i){const r=s.value;if(r&&typeof r=="object"){let u,c=0,o=this.key,a=[];const p=(k,$)=>{for(const x of k.options){if(x.type==="variant")p(x,new Set($).add(x.key));else{let K=!0,j=0;for(const d of $){const D=x.entries[d];if(d in r?D["~run"]({typed:!1,value:r[d]},Z).issues:D.type!=="exact_optional"&&D.type!=="optional"&&D.type!=="nullish"){K=!1,o!==d&&(c<j||c===j&&d in r&&!(o in r))&&(c=j,o=d,a=[]),o===d&&a.push(x.entries[d].expects);break}j++}if(K){const d=x["~run"]({value:r},i);(!u||!u.typed&&d.typed)&&(u=d)}}if(u&&!u.issues)break}};if(p(this,new Set([this.key])),u)return u;l(this,"type",s,i,{input:r[o],expected:P(a,"|"),path:[{type:"object",origin:"value",input:r,key:o,value:r[o]}]})}else l(this,"type",s,i);return s}})}function we(n,t,e){const s=n["~run"]({value:t},A());if(s.issues)throw new _e(s.issues);return s.value}function m(...n){return f({...n[0],pipe:n,"~run"(t,e){for(const s of n)if(s.kind!=="metadata"){if(t.issues&&(s.kind==="schema"||s.kind==="transformation")){t.typed=!1;break}(!t.issues||!e.abortEarly&&!e.abortPipeEarly)&&(t=s["~run"](t,e))}return t}})}function g(n,t,e){const s=n["~run"]({value:t},A());return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}function Ne(n){let t="";for(const e of n){t&&(t+=`
|
|
2
|
+
`),t+=`\xD7 ${e.message}`;const s=Ee(e);s&&(t+=`
|
|
3
|
+
\u2192 at ${s}`)}return t}const R=h({type:m(y(),v(1)),id:m(y(),v(1))}),Ae=m(y(),v(1),I(/^[A-Za-z0-9_-]+$/,'ids may only contain letters, digits, "_" and "-" (a "." builds a path)')),Pe=(n,t)=>{if(t===1)return n.includes(".")?null:[n];const e=n.split(".");return e.length===t&&e.every(s=>s.length>0)?e:null},L=h({id:m(y(),v(1)),type:m(y(),v(1)),target:R,payload:E(),note:_(y()),createdAt:m(y(),v(1))}),Ie=(n,t,e,s={})=>{const i=h({id:m(y(),v(1)),type:b(n),target:R,payload:e,note:_(y()),createdAt:m(y(),v(1))}),r=u=>{const c=g(L,u);if(!c.success||c.output.type!==n)return null;const o=g(e,u.payload);return o.success?{id:c.output.id,type:n,target:c.output.target,payload:o.output,...c.output.note===void 0?{}:{note:c.output.note},createdAt:c.output.createdAt}:null};return{schema:i,mode:s.mode??"patch",targetType:t,actionType:n,payloadSchema:e,parse:r,...s.dedupeKey?{dedupeKey:s.dedupeKey}:{}}},Te=(n,t)=>{const e=le(n,t.type);if(e===void 0)return null;const s=e.parse(t);return s===null?null:s},qe=(n,t)=>{const e=g(n.payloadSchema,t.payload);if(!e.success)throw new Error(`invalid payload for action "${t.type}"`);return e.output},le=(n,t)=>Object.hasOwn(n,t)?n[t]:void 0,Re=n=>{throw new Error(`unhandled action: ${JSON.stringify(n)}`)},Le=h({id:m(y(),v(1))}),Ve=n=>{const t=g(Le,n.payload);return`${n.type}|${t.success?t.output.id:JSON.stringify(n.payload)}`},$e="dpk-sync-request",Ke=1,Me=(n,t)=>ae(n)===ae(t),ae=n=>{switch(n.kind){case"append":return`append:${n.action.id}`;case"remove":return`remove:${n.id}`;case"clear":return`clear:${n.upTo}`}},Fe=h({id:m(y(),v(1)),name:_(y())}),V=y(),Ue=m(y(),v(1)),Ce=h({kind:b("snapshot"),cursor:V,actions:N(E())}),Ge=h({kind:b("ops"),cursor:V,ops:N(E())}),ze=O("kind",[Ce,Ge]),Je=h({kind:b("append"),action:E()}),pe=h({kind:b("remove"),id:Ue}),fe=h({kind:b("clear"),upTo:V}),Ye=O("kind",[Je,pe,fe]),Xe=O("kind",[h({kind:b("append"),action:L}),pe,fe]),Ze=h({author:B(q(Fe),void 0)}),Be=(n,t)=>{const e=g(ze,n);if(!e.success)return null;const s=e.output;return s.kind==="snapshot"?{kind:"snapshot",cursor:s.cursor,entries:s.actions.flatMap(i=>{const r=ye(i,t);return r===null?[]:[r]})}:{kind:"ops",cursor:s.cursor,ops:s.ops.flatMap(i=>{const r=g(Ye,i);if(!r.success)return[];if(r.output.kind!=="append")return[r.output];const u=ye(r.output.action,t);return u===null?[]:[{kind:"append",entry:u}]})}},ye=(n,t)=>{const e=t(n);if(e===null)return null;const s=g(Ze,n);return{action:e,author:s.success?s.output.author:void 0}},Qe=n=>Array.isArray(n)?n.flatMap(t=>{const e=g(Xe,t);return e.success?[e.output]:[]}):[];export{ce as A,_ as B,Ae as C,te as D,J as E,C as F,ee as G,F as H,B as I,ie as J,I as K,M as L,z as M,Pe as N,De as O,G as P,X as Q,ne as R,Ke as S,Ne as T,U,le as V,Me as W,Be as X,Q as Y,$e as a,Re as b,L as c,Ie as d,Ve as e,qe as f,H as g,N as h,W as i,y as j,q as k,b as l,we as m,se as n,h as o,Te as p,ue as q,Qe as r,g as s,R as t,E as u,m as v,v as w,re as x,Y as y,O as z};
|