dev-process-kit 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{shared-CirHYajF.js → shared-BJvnqK51.js} +1 -1
- package/dist/chunks/{shared-0MFKKPnB.js → shared-BS9TMOvt.js} +11 -11
- package/dist/chunks/{shared-Cd8A5TjZ.js → shared-BYoX4LxS.js} +174 -157
- package/dist/chunks/shared-B_nvELQt.js +572 -0
- package/dist/chunks/{shared-C1KQ5iU8.js → shared-Bp3FCPZj.js} +15 -21
- package/dist/chunks/shared-BtEAASxQ.js +1049 -0
- package/dist/chunks/shared-CBRj9Yll.js +2692 -0
- package/dist/chunks/{shared-DjmQsa0n.js → shared-CLabLKYD.js} +1 -1
- package/dist/chunks/{shared-B2YRwZ0P.js → shared-CRpGBd1Z.js} +139 -128
- package/dist/chunks/{shared-D7poXZ0z.js → shared-CVI7znpk.js} +6 -5
- package/dist/chunks/{shared-DklLt1Sc.js → shared-CeM-gXAw.js} +1 -1
- package/dist/chunks/{shared-CQG0dnvb.js → shared-D0PnnUir.js} +5 -4
- package/dist/chunks/shared-DsUcMhpJ.js +1104 -0
- package/dist/chunks/{shared-DrMSORn-.js → shared-m1HXI5YR.js} +176 -168
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-B4Mwapvi.js +0 -1043
- package/dist/chunks/shared-BDUe3aT-.js +0 -1
- package/dist/chunks/shared-CSC14I4g.js +0 -2370
- package/dist/chunks/shared-DO0pUSjw.js +0 -571
- package/dist/chunks/shared-DxAiavwJ.js +0 -1102
- package/dist/chunks/shared-aDPp8Vry.js +0 -1
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,af as C,ac as xe,R as O,a0 as me,V as we,a4 as s,a5 as F,a3 as p,ap as P,a2 as ye,T as G,aI as $e,aJ as Te}from"./shared-CSC14I4g.js";import{r as Se}from"./shared-BDUe3aT-.js";import{s as Re}from"./shared-D4K7KsfJ.js";import{c as B}from"./shared-ml5h7U5L.js";const Ae=N("kind",[f({kind:T("option"),optionId:v(c(),x(1))}),f({kind:T("free"),text:c()}),f({kind:T("clear")})]),E={ANSWER_QUESTION:ke("ANSWER_QUESTION","question",Ae)},H=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Ce=f({id:v(c(),x(1)),label:v(c(),x(1))}),M=f({id:v(c(),x(1)),ref:k(v(c(),x(1))),title:v(c(),x(1)),description:k(c()),note:k(c()),options:k(C(Ce),[]),freeText:k(ve(),!0)}),Ee=N("kind",[f({kind:T("option"),optionId:v(c(),x(1))}),f({kind:T("free"),text:c()})]),qe=f({...M.entries,answer:k(Ee)}),Ie=f({label:k(v(c(),x(1))),questions:C(qe)}),_=f({title:k(c(),""),questions:C(M),history:k(C(Ie),[])}),U=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},W=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Qe=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...W(t),answer:e}},j=t=>{const e=xe(_,t);return{title:e.title,questions:U(e.questions).map(W),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:U(r.questions).map(Qe)}))}},D=()=>({title:"",questions:[],answers:{},pastRounds:[]}),m=(t,e)=>t.questions.find(r=>r.id===e),ze=(t,e)=>m(t,e)?.ref??e,z=(t,e)=>{const r=m(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},S=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",q=(t,e)=>S(t,e)!=="",Y=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},V=t=>({total:t.questions.length,answered:t.questions.filter(e=>q(e,t.answers[e.id])).length}),I=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},K=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=m(t,e.target.id);if(!r)return null;const i=O(E.ANSWER_QUESTION,e);return i.kind==="clear"?I(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?I(t,r.id,{kind:"option",optionId:i.optionId}):null:I(t,r.id,{kind:"free",text:i.text})},R=me({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),J=t=>t.title===""?"Visually Grill":t.title,X=(t,e,r)=>{switch(r.type){case"question":return z(e,r.id);case"page":return t.wholePage;default:return r.id}},Le=(t,e,r)=>{const i=O(E.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=m(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},Z=(t,e,r,i)=>{let n;try{n=Le(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:X(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ee=t=>`${t.type} ${we(t.target)} ${JSON.stringify(t.payload)}`,te=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:z(e,r.id),group:t.questionGroup})),re=(t,e)=>{const r=e.question;if(r!==void 0&&m(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},ie=(t,e)=>{const r=e.question;return r!==void 0&&m(t,r)?r:t.questions[0]?.id??null},Ne=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!q(a,t.answers[a.id]))?.id??null},ne=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:Y(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Oe=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:S(t,i)!=="",summary:S(t,i),choices:ne(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ae=(t,e)=>{const r=ie(t,e);return{questions:t.questions.map(i=>Oe(i,t,r))}},oe=(t,e)=>{const r=V(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},se=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=se(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Pe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=S(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:ne(n,a),freeText:a?.kind==="free"?a.text:null}})}},le=(t,e)=>{switch(e.type){case"question":return m(t,e.id)!==void 0;case"page":return!0;default:return!1}},de=t=>{const e=R(t);return{name:"grill",label:"Visually Grill",parseBase:j,emptyBase:D,actions:E,apply:K,hasTarget:le,describe:(r,i,n)=>Z(e,r,i,n),serialize:ee,resolveNavigation:re,commentTargets:r=>te(e,r),title:J}},Ge=5,L=4,pe=8,Be=(t,e)=>{const r=e.badgeHeight,i=t.target.right+pe,n=t.target.left-pe,a=[];let o=0,l=i;for(let u=t.widths.length-1;u>=0;u-=1){const g=t.widths[u]??0;l!==i&&l-g<n&&(o+=1,l=i),a[u]={x:l-g,y:t.target.top-r/2-o*(r+L)},l-=g+Ge}return a},ce=(t,e)=>{const r=t.map(()=>[]),i=Re(t.map((a,o)=>({group:a,index:o})).filter(({group:a})=>a.gutter),[({group:a})=>a.target.top]);let n=Number.NEGATIVE_INFINITY;for(const{group:a,index:o}of i){let l=Math.max(a.target.top,n);r[o]=a.widths.map(u=>{const g={x:e.width-u,y:l};return l+=e.badgeHeight+L,g}),n=l}return{points:r,bottom:n-L}},He=(t,e)=>Math.max(0,ce(t,e).bottom),Me=(t,e)=>{const r=ce(t,e),i=Math.max(e.height,r.bottom);return t.map((n,a)=>(n.gutter?r.points[a]??[]:Be(n,e)).map((o,l)=>({x:B(o.x,0,Math.max(0,e.width-(n.widths[l]??0))),y:B(o.y,0,Math.max(0,i-e.badgeHeight))})))},A="data-grill-questions",_e=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},ge=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of _e(t))for(const l of o.querySelectorAll(`[${A}]`)){const u=l.getAttribute(A)??"";for(const g of u.split(/\s+/)){if(g==="")continue;const h=n.get(g);h&&a.push({index:a.length,target:l,questionId:h.id,ref:h.ref,title:h.title,answered:q(h,e.answers[h.id]),open:h.id===i})}}return a},ue=(t,e)=>{const r=t.getBoundingClientRect(),i=t.getRootNode(),n=i instanceof ShadowRoot?i.host:null,a=new Map;e.forEach((b,w)=>{const d=t.querySelector(`[data-label="${w}"]`);if(!d)return;const y=a.get(b.target)??[];y.push(d),a.set(b.target,y)});const o=[];for(const[b,w]of a){const d=b.getBoundingClientRect(),y=Ue(b,t),$=(d.width>0||d.height>0)&&d.bottom>r.top&&d.top<r.bottom&&d.right>r.left&&d.left<r.right&&d.bottom>y.top&&d.top<y.bottom;for(const Q of w)Q.dataset.visible=String($);$&&o.push({buttons:w,group:{target:{left:d.left-r.left,top:d.top-r.top,right:d.right-r.left,bottom:d.bottom-r.top},widths:w.map(Q=>Q.offsetWidth),gutter:n?.contains(b)===!0}})}const l=o[0]?.buttons[0]?.offsetHeight??0,u=o.map(({group:b})=>b),g={width:t.clientWidth,height:t.clientHeight,badgeHeight:l},h=He(u,g);t.parentElement&&(t.parentElement.style.minHeight=h>0?`${Math.ceil(h)}px`:"");const fe=Me(u,{...g,height:Math.max(g.height,h)});o.forEach(({buttons:b},w)=>{b.forEach((d,y)=>{const $=fe[w]?.[y];$&&(d.style.transform=`translate(${$.x}px, ${$.y}px)`)})})},Ue=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},We=(t,e,r)=>s`
|
|
1
|
+
import{p as ve,am as N,ae as f,aj as x,ak as m,ah as c,ao as T,af as k,ap as xe,ag as A,ad as me,R as O,a0 as we,V as F,a4 as s,a5 as P,a3 as p,aq as G,a2 as ye,T as B,aL as $e,aM as Te,aN as Se}from"./shared-CBRj9Yll.js";import{s as Re}from"./shared-D4K7KsfJ.js";import{c as H}from"./shared-ml5h7U5L.js";const qe=N("kind",[f({kind:T("option"),optionId:x(c(),m(1))}),f({kind:T("free"),text:c()}),f({kind:T("clear")})]),C={ANSWER_QUESTION:ve("ANSWER_QUESTION","question",qe)},M=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Ae=f({id:x(c(),m(1)),label:x(c(),m(1))}),_=f({id:x(c(),m(1)),ref:k(x(c(),m(1))),title:x(c(),m(1)),description:k(c()),note:k(c()),options:k(A(Ae),[]),freeText:k(xe(),!0)}),Ce=N("kind",[f({kind:T("option"),optionId:x(c(),m(1))}),f({kind:T("free"),text:c()})]),Ee=f({..._.entries,answer:k(Ce)}),Ie=f({label:k(x(c(),m(1))),questions:A(Ee)}),U=f({title:k(c(),""),questions:A(_),history:k(A(Ie),[])}),W=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},j=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Qe=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...j(t),answer:e}},D=t=>{const e=me(U,t);return{title:e.title,questions:W(e.questions).map(j),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:W(r.questions).map(Qe)}))}},Y=()=>({title:"",questions:[],answers:{},pastRounds:[]}),v=(t,e)=>t.questions.find(r=>r.id===e),ze=(t,e)=>v(t,e)?.ref??e,z=(t,e)=>{const r=v(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},S=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",E=(t,e)=>S(t,e)!=="",V=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},K=t=>({total:t.questions.length,answered:t.questions.filter(e=>E(e,t.answers[e.id])).length}),I=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},J=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=v(t,e.target.id);if(!r)return null;const i=O(C.ANSWER_QUESTION,e);return i.kind==="clear"?I(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?I(t,r.id,{kind:"option",optionId:i.optionId}):null:I(t,r.id,{kind:"free",text:i.text})},R=we({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),X=t=>t.title===""?"Visually Grill":t.title,Z=(t,e,r)=>{switch(r.type){case"question":return z(e,r.id);case"page":return t.wholePage;default:return r.id}},Le=(t,e,r)=>{const i=O(C.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=v(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},ee=(t,e,r,i)=>{let n;try{n=Le(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:Z(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},te=t=>`${t.type} ${F(t.target)} ${JSON.stringify(t.payload)}`,re=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:z(e,r.id),group:t.questionGroup})),ie=(t,e)=>{const r=e.question;if(r!==void 0&&v(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},ne=(t,e)=>{const r=e.question;return r!==void 0&&v(t,r)?r:t.questions[0]?.id??null},Ne=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!E(a,t.answers[a.id]))?.id??null},ae=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:V(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Oe=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:S(t,i)!=="",summary:S(t,i),choices:ae(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},oe=(t,e)=>{const r=ne(t,e);return{questions:t.questions.map(i=>Oe(i,t,r))}},se=(t,e)=>{const r=K(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},le=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=le(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Pe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=S(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:ae(n,a),freeText:a?.kind==="free"?a.text:null}})}},de=(t,e)=>{switch(e.type){case"question":return v(t,e.id)!==void 0;case"page":return!0;default:return!1}},pe=t=>{const e=R(t);return{name:"grill",label:"Visually Grill",parseBase:D,emptyBase:Y,actions:C,apply:J,hasTarget:de,describe:(r,i,n)=>ee(e,r,i,n),serialize:te,resolveNavigation:ie,navigationFor:(r,i)=>i.type==="question"&&v(r,i.id)?{question:i.id}:null,commentTargets:r=>re(e,r),title:X}},Ge=5,L=4,ce=8,Be=(t,e)=>{const r=e.badgeHeight,i=t.target.right+ce,n=t.target.left-ce,a=[];let o=0,l=i;for(let u=t.widths.length-1;u>=0;u-=1){const g=t.widths[u]??0;l!==i&&l-g<n&&(o+=1,l=i),a[u]={x:l-g,y:t.target.top-r/2-o*(r+L)},l-=g+Ge}return a},ge=(t,e)=>{const r=t.map(()=>[]),i=Re(t.map((a,o)=>({group:a,index:o})).filter(({group:a})=>a.gutter),[({group:a})=>a.target.top]);let n=Number.NEGATIVE_INFINITY;for(const{group:a,index:o}of i){let l=Math.max(a.target.top,n);r[o]=a.widths.map(u=>{const g={x:e.width-u,y:l};return l+=e.badgeHeight+L,g}),n=l}return{points:r,bottom:n-L}},He=(t,e)=>Math.max(0,ge(t,e).bottom),Me=(t,e)=>{const r=ge(t,e),i=Math.max(e.height,r.bottom);return t.map((n,a)=>(n.gutter?r.points[a]??[]:Be(n,e)).map((o,l)=>({x:H(o.x,0,Math.max(0,e.width-(n.widths[l]??0))),y:H(o.y,0,Math.max(0,i-e.badgeHeight))})))},q="data-grill-questions",_e=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},ue=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of _e(t))for(const l of o.querySelectorAll(`[${q}]`)){const u=l.getAttribute(q)??"";for(const g of u.split(/\s+/)){if(g==="")continue;const h=n.get(g);h&&a.push({index:a.length,target:l,questionId:h.id,ref:h.ref,title:h.title,answered:E(h,e.answers[h.id]),open:h.id===i})}}return a},he=(t,e)=>{const r=t.getBoundingClientRect(),i=t.getRootNode(),n=i instanceof ShadowRoot?i.host:null,a=new Map;e.forEach((b,w)=>{const d=t.querySelector(`[data-label="${w}"]`);if(!d)return;const y=a.get(b.target)??[];y.push(d),a.set(b.target,y)});const o=[];for(const[b,w]of a){const d=b.getBoundingClientRect(),y=Ue(b,t),$=(d.width>0||d.height>0)&&d.bottom>r.top&&d.top<r.bottom&&d.right>r.left&&d.left<r.right&&d.bottom>y.top&&d.top<y.bottom;for(const Q of w)Q.dataset.visible=String($);$&&o.push({buttons:w,group:{target:{left:d.left-r.left,top:d.top-r.top,right:d.right-r.left,bottom:d.bottom-r.top},widths:w.map(Q=>Q.offsetWidth),gutter:n?.contains(b)===!0}})}const l=o[0]?.buttons[0]?.offsetHeight??0,u=o.map(({group:b})=>b),g={width:t.clientWidth,height:t.clientHeight,badgeHeight:l},h=He(u,g);t.parentElement&&(t.parentElement.style.minHeight=h>0?`${Math.ceil(h)}px`:"");const ke=Me(u,{...g,height:Math.max(g.height,h)});o.forEach(({buttons:b},w)=>{b.forEach((d,y)=>{const $=ke[w]?.[y];$&&(d.style.transform=`translate(${$.x}px, ${$.y}px)`)})})},Ue=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},We=(t,e,r)=>s`
|
|
2
2
|
<div class="grill-list">
|
|
3
|
-
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:
|
|
3
|
+
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:P(e.questions,i=>i.id,i=>je(t,i,r))}
|
|
4
4
|
</div>
|
|
5
5
|
`,je=(t,e,r)=>s`
|
|
6
|
-
<section
|
|
6
|
+
<section
|
|
7
|
+
class="grill-question"
|
|
8
|
+
data-question=${e.id}
|
|
9
|
+
data-answered=${String(e.answered)}
|
|
10
|
+
data-dpk-target=${F({type:"question",id:e.id})}
|
|
11
|
+
>
|
|
7
12
|
<button
|
|
8
13
|
class="grill-heading"
|
|
9
14
|
type="button"
|
|
@@ -16,7 +21,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
16
21
|
<strong>${e.title}</strong>
|
|
17
22
|
${!e.open&&e.answered?s`<span class="grill-summary">${e.summary}</span>`:p}
|
|
18
23
|
</span>
|
|
19
|
-
<span class="grill-chevron" aria-hidden="true">${
|
|
24
|
+
<span class="grill-chevron" aria-hidden="true">${G()}</span>
|
|
20
25
|
</button>
|
|
21
26
|
${e.open?s`<div class="grill-body" id=${`grill-body-${e.id}`}>
|
|
22
27
|
${e.description?s`<p class="grill-description">${e.description}</p>`:p}
|
|
@@ -70,7 +75,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
70
75
|
`,Ye=(t,e)=>s`
|
|
71
76
|
<div class="grill-list">
|
|
72
77
|
<p class="grill-round-note">${t.pastRound(e.label)}</p>
|
|
73
|
-
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:
|
|
78
|
+
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:P(e.questions,r=>r.id,r=>Ve(r))}
|
|
74
79
|
</div>
|
|
75
80
|
`,Ve=t=>s`
|
|
76
81
|
<details
|
|
@@ -84,7 +89,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
84
89
|
<strong>${t.title}</strong>
|
|
85
90
|
<span class="grill-summary">${t.summary}</span>
|
|
86
91
|
</span>
|
|
87
|
-
<span class="grill-chevron" aria-hidden="true">${
|
|
92
|
+
<span class="grill-chevron" aria-hidden="true">${G()}</span>
|
|
88
93
|
</summary>
|
|
89
94
|
<div class="grill-body">
|
|
90
95
|
${t.description?s`<p class="grill-description">${t.description}</p>`:p}
|
|
@@ -99,17 +104,6 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
99
104
|
</div>
|
|
100
105
|
</details>
|
|
101
106
|
`,Ke=ye`
|
|
102
|
-
/*
|
|
103
|
-
* The rail and its hand-off only work inside a bounded shell. A page that gives
|
|
104
|
-
* the host no height (no \`height: 100%\` up the chain) would grow the shell to
|
|
105
|
-
* its content and scroll the whole document, carrying the rail and the copy
|
|
106
|
-
* button off screen; the viewport height is the fallback. A host with a height
|
|
107
|
-
* still wins: the shell's own min/max-height pin it to that.
|
|
108
|
-
*/
|
|
109
|
-
.dpk-shell {
|
|
110
|
-
height: 100dvh;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
107
|
/* The shell's sidebar is a right-hand rail (see \`sidebarLayout\`), keeping its scroll. */
|
|
114
108
|
.dpk-sidebar {
|
|
115
109
|
display: flex;
|
|
@@ -888,7 +882,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
888
882
|
outline: none;
|
|
889
883
|
box-shadow: var(--dpk-focus);
|
|
890
884
|
}
|
|
891
|
-
`;class
|
|
885
|
+
`;class be extends B{static{this.styles=[B.styles,Ke]}get sidebarLayout(){return{side:"right",defaultWidth:336,collapsible:!1}}definitionFor(e){return pe(e)}static{this.properties={tab:{state:!0},folded:{state:!0},round:{state:!0}}}#o=[];#s=!1;#a=null;#l=null;#r=null;#e="idle";#i=null;#n={kind:"idle"};constructor(){super(),this.tab="questions",this.folded=!1,this.round="current"}connectedCallback(){super.connectedCallback(),document.addEventListener("scroll",this.#t,!0),window.addEventListener("resize",this.#t),this.addEventListener("dpk-diagram-view",this.#t)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scroll",this.#t,!0),window.removeEventListener("resize",this.#t),this.removeEventListener("dpk-diagram-view",this.#t),this.#r?.disconnect(),this.#r=null,this.#d()}renderRegions(e){return this.#o=ue(this,e.state,e.navigation),{header:this.#b(e),main:this.#m(e,this.#o),sidebar:this.#f(e),sidebarHidden:this.folded}}updated(){super.updated(),this.#T(),this.#t(),this.#S();const e=this.#l;e!==null&&(this.#l=null,this.renderRoot.querySelector(`[data-free-text="${e}"]`)?.focus())}get integratedReview(){return!0}requestComment(e){this.tab="review",this.folded=!1,super.requestComment(e)}showTarget(e){e.type==="question"&&(this.tab="questions",this.folded=!1,this.round="current")}#p(e,r){this.tab="questions",this.folded=!1,this.round="current",this.#a=null,e.navigate({question:r})}#b(e){const r=R(this.locale),i=se(r,e.state),n=r.toggleLabel(this.folded?r.openPanel:r.closePanel,i.progress);return s`
|
|
892
886
|
<button
|
|
893
887
|
type="button"
|
|
894
888
|
class="grill-toggle"
|
|
@@ -900,7 +894,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
900
894
|
<span class="grill-toggle-glyph" aria-hidden="true">?</span>
|
|
901
895
|
<span class="grill-toggle-badge" aria-hidden="true">${i.answered} / ${i.total}</span>
|
|
902
896
|
</button>
|
|
903
|
-
`}#f(e){const r=R(this.locale),i=
|
|
897
|
+
`}#f(e){const r=R(this.locale),i=le(e.state,this.round),n=Fe(r,e.state,i),a=i==="current"?null:Pe(r,e.state,i);return s`
|
|
904
898
|
<div class="grill-panel">
|
|
905
899
|
<div class="grill-tabs" role="tablist" aria-label=${r.tabs}>
|
|
906
900
|
${["questions","review"].map(o=>o==="questions"&&n.length>0?this.#v(r,n):s`
|
|
@@ -928,7 +922,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
928
922
|
aria-labelledby="grill-tab-questions"
|
|
929
923
|
?hidden=${this.tab!=="questions"}
|
|
930
924
|
>
|
|
931
|
-
${a===null?We(r,
|
|
925
|
+
${a===null?We(r,oe(e.state,e.navigation),{open:o=>this.#p(e,o),answer:(o,l)=>this.#w(o,l),next:o=>this.#g(o)}):Ye(r,a)}
|
|
932
926
|
</div>
|
|
933
927
|
<div
|
|
934
928
|
class="grill-tab-panel"
|
|
@@ -1030,4 +1024,4 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
1030
1024
|
`)}
|
|
1031
1025
|
</div>
|
|
1032
1026
|
</div>
|
|
1033
|
-
`}#w(e,r){if(this.dispatch(
|
|
1027
|
+
`}#w(e,r){if(this.dispatch(M(e,r)).ok){if(r.kind==="option"){this.#g(e);return}r.kind==="free"&&r.text===""&&(this.#l=e)}}#g(e){const r=Ne(this.derivation.state,e);r!==null&&this.navigate({question:r})}async#u(){const e=this.api.exportBrief(),r=await Te(e);this.#d(),this.#e=r?"copied":"failed",this.#h()}async#y(){this.#d(),this.#n={kind:"pending"},this.requestUpdate();const e=await this.sendToClaude();this.#n=e.ok?{kind:"sent"}:{kind:"failed",reason:e.reason},e.ok?this.#h():this.requestUpdate()}#h(){this.requestUpdate(),this.#i=setTimeout(()=>{this.#i=null,this.#e="idle",this.#n={kind:"idle"},this.requestUpdate()},2400)}#d(){this.#i!==null&&clearTimeout(this.#i),this.#i=null,this.#e="idle",this.#n={kind:"idle"}}#$(){this.requestUpdate()}#T(){this.#r?.disconnect(),this.#r??=new MutationObserver(()=>{this.#$(),this.#t()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[q]});for(const e of this.querySelectorAll("*"))e===this||!e.shadowRoot||this.#r.observe(e.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[q]})}#t=()=>{this.#s||(this.#s=!0,requestAnimationFrame(()=>{this.#s=!1;const e=this.renderRoot.querySelector(".grill-labels");e&&he(e,this.#o)}))};#S(){const e=this.navigation.question??null;if(this.tab!=="questions"||this.round!=="current"||this.folded||e===null||e===this.#a)return;this.#a=e;const r=this.renderRoot.querySelector(`[data-question="${e}"]`),i=r?.closest(".grill-list");r&&i&&Se(i,r)}}const fe=()=>{customElements.get("dpk-template-grill")||customElements.define("dpk-template-grill",be)},Je=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateGrill:be,GRILL_QUESTIONS_ATTRIBUTE:q,answerCounts:K,answerQuestion:M,answerText:S,applyGrillAction:J,collectLabelBindings:ue,defineGrillElement:fe,describeGrillAction:ee,emptyGrillBase:Y,findQuestion:v,grillActions:C,grillBaseSchema:U,grillCommentTargets:re,grillDefinitionFor:pe,grillHasTarget:de,grillMessages:R,grillTargetLabel:Z,grillTitle:X,isAnswered:E,openQuestionId:ne,optionLetter:V,parseGrillBase:D,positionLabels:he,presentGrillHeader:se,presentGrillPanel:oe,questionLabel:z,questionRef:ze,resolveGrillNavigation:ie,serializeGrillAction:te,withAnswer:I},Symbol.toStringTag,{value:"Module"}));export{fe as d,Je as i};
|