dev-process-kit 0.0.9 → 0.0.10

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.
Files changed (31) hide show
  1. package/README.md +1 -1
  2. package/dist/THIRD_PARTY_LICENSES.md +47 -0
  3. package/dist/chunks/shared-BQFDKhM1.js +2402 -0
  4. package/dist/chunks/{shared-BHGClRU3.js → shared-Bd9pmv5a.js} +6 -5
  5. package/dist/chunks/{shared-8lYUcRvS.js → shared-BdUyaZo-.js} +3 -3
  6. package/dist/chunks/{shared-U2T3astJ.js → shared-C2ytkQtn.js} +7 -7
  7. package/dist/chunks/{shared-p8037r6P.js → shared-CDUEK_Mh.js} +71 -48
  8. package/dist/chunks/{shared-D6Yx-euS.js → shared-CNbKTeSv.js} +2 -2
  9. package/dist/chunks/{shared-BIdQ89rB.js → shared-COrrbgIn.js} +1 -1
  10. package/dist/chunks/{shared-Dkx_2Lbf.js → shared-CQXKAPdi.js} +3 -3
  11. package/dist/chunks/{shared-Dn5j0MCU.js → shared-CmNWTIOz.js} +1 -1
  12. package/dist/chunks/{shared-BOFIcKZe.js → shared-DkFF4haI.js} +1 -1
  13. package/dist/chunks/shared-Dmq-C6h3.js +2239 -0
  14. package/dist/chunks/{shared-nW8tfMgg.js → shared-Ds5vLeFk.js} +2 -2
  15. package/dist/chunks/{shared-D4czF1TI.js → shared-FtbePk3S.js} +4 -4
  16. package/dist/chunks/{shared-SGSKyTNs.js → shared-qb0tjbw2.js} +2 -2
  17. package/dist/components.js +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/templates/delegation-poker.js +1 -1
  20. package/dist/templates/event-storming.js +1 -1
  21. package/dist/templates/example-mapping.js +1 -1
  22. package/dist/templates/grill.js +1 -1
  23. package/dist/templates/plain.js +1 -1
  24. package/dist/templates/prototype.js +1 -1
  25. package/dist/templates/slides.js +1 -1
  26. package/dist/templates/task-board.js +1 -1
  27. package/dist/templates/usm.js +1 -1
  28. package/dist/templates/whiteboard.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunks/shared-7qenhU4J.js +0 -2173
  31. package/dist/chunks/shared-Cia5FdOF.js +0 -1112
@@ -1,1112 +0,0 @@
1
- import{aI as Q,ab as qe,aJ as He,ac as C,ad as V,ae as N,ay as g,af as c,aw as P,ah as E,ai as S,ag as M,aK as Fe,p as f,aq as y,v as H,av as L,P as Ke,e as Je,a0 as Xe,h as ve,N as Ze,V as Y,U as Qe,R as w,a4 as u,a3 as b,aC as he,a5 as et,z as tt,aB as me,l as it,A as ge,aa as rt,a9 as at,a2 as ot,T as ye,a1 as st,C as nt}from"./shared-7qenhU4J.js";import{p as dt,r as pt,P as lt,c as ct,b as ut}from"./shared-BHGClRU3.js";import{i as fe}from"./shared-BIdQ89rB.js";const be=["browser","native","mail","plain"],we=["mobile","tablet","desktop","fluid"],vt=["tabs","side-by-side"],ht=C({from:g(c()),to:g(c()),cc:g(c()),subject:g(c()),date:g(c())}),ee={id:P,kind:V(M(be),"browser"),viewport:V(M(we),"fluid"),label:g(c()),url:g(c()),mail:g(ht)},mt=E(C(ee),Fe(e=>e.mail===void 0||e.kind==="mail",'a preview `mail` envelope needs `"kind": "mail"`')),gt=C({id:P,name:E(c(),S(1)),description:g(c()),title:g(E(c(),S(1))),actor:g(E(c(),S(1))),situation:g(E(c(),S(1))),layout:g(M(vt)),previews:V(N(mt),[])}),yt=C({id:P,name:E(c(),S(1)),description:g(c()),actor:g(E(c(),S(1))),steps:V(N(gt),[])}),ft=C({id:P,name:E(c(),S(1)),description:g(c()),actor:g(E(c(),S(1))),stories:V(N(yt),[])}),ke=C({title:g(c()),baseUrl:g(c()),activities:V(N(ft),[])}),bt=e=>{const t=new Set,i=new Set;for(const r of e.activities){if(i.has(r.id))return`duplicate activity id "${r.id}"`;i.add(r.id);const a=new Set;for(const o of r.stories){if(a.has(o.id))return`duplicate story id "${o.id}" in activity "${r.id}"`;a.add(o.id);const s=new Set;for(const n of o.steps){if(s.has(n.id))return`duplicate step id "${n.id}" in story "${o.id}"`;s.add(n.id);for(const d of n.previews){if(t.has(d.id))return`duplicate preview id "${d.id}": preview ids are global, they name a light DOM slot`;t.add(d.id)}}}}return null},z="ui",xe=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},te=e=>{const t=e.indexOf("/");if(t<=0)return;const i=e.slice(0,t);if(!He(P,i))return;const r=e.slice(t+1),a=/ "([^"]*)"$/.exec(r),o=(a?r.slice(0,a.index):r).trim();if(o!=="")return a?.[1]===void 0?{previewId:i,selector:o}:{previewId:i,selector:o,text:a[1]}},Ee=e=>{const t=qe(ke,e),i=bt(t);if(i!==null)throw new Error(i);return t},Se=()=>({activities:[]}),A=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},R=(e,t)=>`${e}.${t}`,x=(e,t)=>{if(t===void 0)return;const i=Q(t,2);if(i){const[a,o]=i;if(a===void 0||o===void 0)return;const s=e.activities.find(d=>d.id===a),n=s?.stories.find(d=>d.id===o);return s&&n?{activity:s,story:n}:void 0}if(t.includes("."))return;const r=e.activities.flatMap(a=>a.stories.filter(o=>o.id===t).map(o=>({activity:a,story:o})));return r.length===1?r[0]:void 0},Te=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},W=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,F=(e,t,i)=>`${e.id}.${t.id}.${i.id}`,k=(e,t)=>{if(t===void 0)return;const i=Q(t,3);if(i){const[a,o,s]=i;if(a===void 0||o===void 0||s===void 0)return;const n=e.activities.find(l=>l.id===a),d=n?.stories.find(l=>l.id===o),v=d?d.steps.findIndex(l=>l.id===s):-1,p=d&&v>=0?d.steps[v]:void 0;return n&&d&&p?{activity:n,story:d,step:p,stepIndex:v}:void 0}if(t.includes("."))return;const r=U(e).filter(a=>a.step.id===t);return r.length===1?r[0]:void 0},T=(e,t)=>{if(t===void 0)return;const i=Q(t,4);if(i){const[r,a,o,s]=i;if(r===void 0||a===void 0||o===void 0||s===void 0)return;const n=k(e,`${r}.${a}.${o}`),d=n?.step.previews.find(v=>v.id===s);return n&&d?{location:n,preview:d}:void 0}if(!t.includes("."))for(const r of e.activities)for(const a of r.stories)for(const[o,s]of a.steps.entries()){const n=s.previews.find(d=>d.id===t);if(n)return{location:{activity:r,story:a,step:s,stepIndex:o},preview:n}}},U=e=>e.activities.flatMap(t=>t.stories.flatMap(i=>i.steps.map((r,a)=>({activity:t,story:i,step:r,stepIndex:a})))),$e=e=>U(e).map(t=>t.step.id),m={SET_ACTIVITY_NAME:f("SET_ACTIVITY_NAME","activity",y({name:E(c(),S(1))})),SET_ACTIVITY_DESCRIPTION:f("SET_ACTIVITY_DESCRIPTION","activity",y({description:c()})),SET_STORY_NAME:f("SET_STORY_NAME","story",y({name:E(c(),S(1))})),SET_STORY_DESCRIPTION:f("SET_STORY_DESCRIPTION","story",y({description:c()})),SET_STEP_NAME:f("SET_STEP_NAME","step",y({name:E(c(),S(1))})),SET_STEP_DESCRIPTION:f("SET_STEP_DESCRIPTION","step",y({description:c()})),SET_PREVIEW_KIND:f("SET_PREVIEW_KIND","preview",y({kind:M(be)})),SET_PREVIEW_VIEWPORT:f("SET_PREVIEW_VIEWPORT","preview",y({viewport:M(we)})),SET_PREVIEW_LABEL:f("SET_PREVIEW_LABEL","preview",y({label:c()})),REORDER_ACTIVITY:f("REORDER_ACTIVITY","activity",y({after:L(c())}),{mode:"sequence"}),REORDER_STORY:f("REORDER_STORY","story",y({after:L(c())}),{mode:"sequence"}),REORDER_STEP:f("REORDER_STEP","step",y({after:L(c())}),{mode:"sequence"}),MOVE_STORY:f("MOVE_STORY","story",y({toActivity:E(c(),S(1)),after:L(c())}),{mode:"sequence"}),MOVE_STEP:f("MOVE_STEP","step",y({toStory:E(c(),S(1)),after:L(c())}),{mode:"sequence"}),ADD_ACTIVITY:f("ADD_ACTIVITY","page",y({id:P,name:E(c(),S(1)),description:g(c())}),{dedupeKey:H}),ADD_STORY:f("ADD_STORY","activity",y({id:P,name:E(c(),S(1)),description:g(c())}),{dedupeKey:H}),ADD_STEP:f("ADD_STEP","story",y({id:P,name:E(c(),S(1)),description:g(c()),previews:g(N(y(ee)))}),{dedupeKey:H}),ADD_PREVIEW:f("ADD_PREVIEW","step",y(ee),{dedupeKey:H}),DELETE_ACTIVITY:f("DELETE_ACTIVITY","activity",y({})),DELETE_STORY:f("DELETE_STORY","story",y({})),DELETE_STEP:f("DELETE_STEP","step",y({})),DELETE_PREVIEW:f("DELETE_PREVIEW","preview",y({}))},G={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,i)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:i}}),moveStory:(e,t,i)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:i}}),addActivity:(e,t,i)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...i===void 0?{}:{description:i}}}),addStory:(e,t,i,r)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:i,...r===void 0?{}:{description:r}}}),addStep:(e,t,i,r)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:i,...r===void 0?{}:{previews:r}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}})},Ie=(e,t)=>{const i=Ke(m,t);if(i===null)return null;const r=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":return D(e,r,a=>({...a,name:i.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return D(e,r,a=>({...a,description:i.payload.description}));case"SET_STORY_NAME":return O(e,r,a=>({...a,name:i.payload.name}));case"SET_STORY_DESCRIPTION":return O(e,r,a=>({...a,description:i.payload.description}));case"SET_STEP_NAME":return j(e,r,a=>({...a,name:i.payload.name}));case"SET_STEP_DESCRIPTION":return j(e,r,a=>({...a,description:i.payload.description}));case"SET_PREVIEW_KIND":return re(e,r,a=>({...a,kind:i.payload.kind}));case"SET_PREVIEW_VIEWPORT":return re(e,r,a=>({...a,viewport:i.payload.viewport}));case"SET_PREVIEW_LABEL":return re(e,r,a=>({...a,label:i.payload.label}));case"REORDER_ACTIVITY":{const{after:a}=i.payload,o=B(e.activities,r,a);return o===null?null:{...e,activities:o}}case"REORDER_STORY":{const{after:a}=i.payload,o=x(e,r);if(!o)return null;const s=a===null?null:x(e,a);if(a!==null&&(!s||s.activity!==o.activity))return null;const n=B(o.activity.stories,o.story.id,s?.story.id??null);return n===null?null:D(e,o.activity.id,d=>({...d,stories:n}))}case"REORDER_STEP":{const{after:a}=i.payload,o=k(e,r);if(!o)return null;const s=a===null?null:k(e,a);if(a!==null&&(!s||s.story!==o.story))return null;const n=B(o.story.steps,o.step.id,s?.step.id??null);return n===null?null:O(e,R(o.activity.id,o.story.id),d=>({...d,steps:n}))}case"MOVE_STORY":{const{toActivity:a,after:o}=i.payload,s=x(e,r);if(!s)return null;const n=e.activities.find(l=>l.id===a);if(!n)return null;const d=o===null?null:x(e,o);if(o!==null&&(!d||d.activity!==n))return null;const v=d?.story.id??null;if(s.activity.id===a){const l=B(s.activity.stories,s.story.id,v);return l===null?null:D(e,a,h=>({...h,stories:l}))}if(n.stories.some(l=>l.id===s.story.id))return null;const p=ae(n.stories,s.story,v);return ie(e,l=>l.id===s.activity.id?{...l,stories:l.stories.filter(h=>h.id!==Te(r))}:l.id===a?{...l,stories:p}:l)}case"MOVE_STEP":{const{toStory:a,after:o}=i.payload,s=k(e,r);if(!s)return null;const n=x(e,a);if(!n)return null;const d=o===null?null:k(e,o);if(o!==null&&(!d||d.story!==n.story))return null;const v=d?.step.id??null;if(s.story===n.story){const l=B(s.story.steps,s.step.id,v);return l===null?null:O(e,a,h=>({...h,steps:l}))}if(n.story.steps.some(l=>l.id===s.step.id))return null;const p=ae(n.story.steps,s.step,v);return ie(e,l=>({...l,stories:l.stories.map(h=>h===s.story?{...h,steps:h.steps.filter($=>$.id!==Te(r))}:h===n.story?{...h,steps:p}:h)}))}case"ADD_ACTIVITY":{const a=i.payload;if(e.activities.some(s=>s.id===a.id))return e;const o={id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description},stories:[]};return{...e,activities:[...e.activities,o]}}case"ADD_STORY":{const a=i.payload,o=e.activities.find(n=>n.id===r);if(!o)return null;if(o.stories.some(n=>n.id===a.id))return e;const s={id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description},steps:[]};return D(e,r,n=>({...n,stories:[...n.stories,s]}))}case"ADD_STEP":{const a=i.payload,o=x(e,r)?.story;if(!o)return null;if(o.steps.some(d=>d.id===a.id))return e;const s=(a.previews??[]).map(d=>d.id);if(new Set(s).size!==s.length||s.some(d=>T(e,d)))return null;const n={id:a.id,name:a.name,...a.description===void 0?{}:{description:a.description},previews:a.previews??[]};return O(e,r,d=>({...d,steps:[...d.steps,n]}))}case"ADD_PREVIEW":{const a=i.payload,o=k(e,r)?.step;return o?o.previews.some(s=>s.id===a.id)?e:T(e,a.id)?null:j(e,r,s=>({...s,previews:[...s.previews,a]})):null}case"DELETE_ACTIVITY":{const a=r;return e.activities.some(o=>o.id===a)?{...e,activities:e.activities.filter(o=>o.id!==a)}:null}case"DELETE_STORY":{const a=x(e,r);return a?D(e,a.activity.id,o=>({...o,stories:o.stories.filter(s=>s.id!==a.story.id)})):null}case"DELETE_STEP":{const a=k(e,r);return a?O(e,R(a.activity.id,a.story.id),o=>({...o,steps:o.steps.filter(s=>s.id!==a.step.id)})):null}case"DELETE_PREVIEW":{const a=T(e,r);return a?j(e,W(a.location),o=>({...o,previews:o.previews.filter(s=>s.id!==a.preview.id)})):null}default:return Je(i)}},ie=(e,t)=>({...e,activities:e.activities.map(t)}),D=(e,t,i)=>{const r=t;return e.activities.some(a=>a.id===r)?ie(e,a=>a.id===r?i(a):a):null},O=(e,t,i)=>{const r=x(e,t);if(!r)return null;const a=r.story.id;return D(e,r.activity.id,o=>({...o,stories:o.stories.map(s=>s.id===a?i(s):s)}))},j=(e,t,i)=>{const r=k(e,t);if(!r)return null;const a=r.step.id;return O(e,R(r.activity.id,r.story.id),o=>({...o,steps:o.steps.map(s=>s.id===a?i(s):s)}))},re=(e,t,i)=>{const r=T(e,t);if(!r)return null;const a=r.preview.id;return j(e,W(r.location),o=>({...o,previews:o.previews.map(s=>s.id===a?i(s):s)}))},B=(e,t,i)=>{const r=e.findIndex(s=>s.id===t);if(r<0||i!==null&&!e.some(s=>s.id===i))return null;if(t===i)return[...e];const a=e[r];if(a===void 0)return null;const o=e.filter(s=>s.id!==t);return ae(o,a,i)},ae=(e,t,i)=>{const r=[...e],a=i===null?-1:r.findIndex(o=>o.id===i);return r.splice(a+1,0,t),r},oe=Xe({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one screen / one experience state. Add a Step to the base JSON, and a Preview will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,maximize:"Maximize",restore:"Restore size",maximizeHint:"Show the preview alone across the tab \xB7 Esc to restore",situation:"Situation",uiComment:"Comment on UI",uiCommentHint:"Click any part of the preview to comment on it \xB7 Esc to finish",uiCommentPin:(e,t)=>`Comment ${e}: ${t}`,mailFrom:"From",mailTo:"To",mailCc:"Cc",mailDate:"Date"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = 1 \u753B\u9762 / 1 \u4F53\u9A13\u72B6\u614B\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B Preview \u304C\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",maximizeHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u30BF\u30D6\u3044\u3063\u3071\u3044\u306B\u8868\u793A \xB7 Esc \u3067\u623B\u308B",situation:"\u72B6\u6CC1",uiComment:"UI \u306B\u30B3\u30E1\u30F3\u30C8",uiCommentHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30B3\u30E1\u30F3\u30C8 \xB7 Esc \u3067\u7D42\u4E86",uiCommentPin:(e,t)=>`\u30B3\u30E1\u30F3\u30C8 ${e}: ${t}`,mailFrom:"\u5DEE\u51FA\u4EBA",mailTo:"\u5B9B\u5148",mailCc:"Cc",mailDate:"\u65E5\u6642"}}),q=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,wt=e=>({SET_ACTIVITY_NAME:(t,i)=>({title:e.renameActivity,tone:"update",body:q(A(i,t.target.id)?.name,w(m.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,i)=>({title:e.updateActivityDescription,tone:"update",body:se(A(i,t.target.id)?.description,w(m.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,i)=>({title:e.renameStory,tone:"update",body:q(x(i,t.target.id)?.story.name,w(m.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,i)=>({title:e.updateStoryDescription,tone:"update",body:se(x(i,t.target.id)?.story.description,w(m.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,i)=>({title:e.renameStep,tone:"update",body:q(k(i,t.target.id)?.step.name,w(m.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,i)=>({title:e.updateStepDescription,tone:"update",body:se(k(i,t.target.id)?.step.description,w(m.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,i)=>({title:e.changePreviewKind,tone:"update",body:q(T(i,t.target.id)?.preview.kind,w(m.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,i)=>({title:e.changePreviewViewport,tone:"update",body:q(T(i,t.target.id)?.preview.viewport,w(m.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${w(m.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>ne(e,e.activityGroup,w(m.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>ne(e,e.storyGroup,w(m.REORDER_STORY,t).after),REORDER_STEP:t=>ne(e,e.stepGroup,w(m.REORDER_STEP,t).after),MOVE_STORY:(t,i)=>({title:e.moveStory,tone:"move",body:`\u2192 ${A(i,w(m.MOVE_STORY,t).toActivity)?.name??w(m.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,i)=>({title:e.moveStep,tone:"move",body:`\u2192 ${x(i,w(m.MOVE_STEP,t).toStory)?.story.name??w(m.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>K(e,e.activityGroup,w(m.ADD_ACTIVITY,t).name),ADD_STORY:t=>K(e,e.storyGroup,w(m.ADD_STORY,t).name),ADD_STEP:t=>K(e,e.stepGroup,w(m.ADD_STEP,t).name),ADD_PREVIEW:t=>K(e,e.previewGroup,w(m.ADD_PREVIEW,t).label??w(m.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,i)=>J(e,A(i,t.target.id)?.name),DELETE_STORY:(t,i)=>J(e,x(i,t.target.id)?.story.name),DELETE_STEP:(t,i)=>J(e,k(i,t.target.id)?.step.name),DELETE_PREVIEW:(t,i)=>J(e,T(i,t.target.id)?.preview.label)}),se=(e,t)=>{const i=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${i}"`:`"${kt(e)}" \u2192 "${i}"`},kt=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,ne=(e,t,i)=>({title:e.reorderTitle(t),tone:"move",body:i===null?e.toFront:e.afterName(i)}),K=(e,t,i)=>({title:e.addTitle(t),tone:"create",body:`+ "${i}"`}),J=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),_e=(e,t,i,r)=>{const a=wt(e),o=Object.hasOwn(a,t.type)?a[t.type]:void 0,s=o?o(t,r??i):{title:t.type,tone:"meta"};return{title:s.title,targetLabel:Re(e,i,t.target),tone:s.tone,...s.body===void 0?{}:{summary:s.body}}},Ae=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,Re=(e,t,i)=>{switch(i.type){case"activity":{const r=A(t,i.id);return r?e.targetLabel(e.activityGroup,r.name):e.targetMissing(e.activityGroup,i.id)}case"story":{const r=x(t,i.id)?.story;return r?e.targetLabel(e.storyGroup,r.name):e.targetMissing(e.storyGroup,i.id)}case"step":{const r=k(t,i.id)?.step;return r?e.targetLabel(e.stepGroup,r.name):e.targetMissing(e.stepGroup,i.id)}case"preview":{const r=T(t,i.id)?.preview;return r?e.targetLabel(e.previewGroup,r.label??r.id):e.targetMissing(e.previewGroup,i.id)}case"page":return e.targetLabel(e.pageGroup,le(t));case z:{const r=te(i.id),a=r?T(t,r.previewId)?.preview:void 0;return r&&a?e.targetLabel(e.uiGroup,Pe(a,r)):e.targetMissing(e.uiGroup,i.id)}default:return e.targetLabel(i.type,i.id)}},Pe=(e,t)=>{const i=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${i}`},De=(e,t)=>{const i=[];for(const r of e){if(r.target.type!==z)continue;const a=te(r.target.id);!a||!t.includes(a.previewId)||i.push({id:r.id,previewId:a.previewId,selector:a.selector,number:i.length+1,body:ve(r)})}return i},xt=(e,t)=>De(e,t).length,Et=(e,t)=>{if(t.url)return t.url;const i=e.baseUrl?.trim(),r=Qe(e.title??"");return`${(i?i.startsWith("http")?i:`https://${i}`:`https://${r==="item"?"page":r}.example.com`).replace(/\/+$/,"")}/${t.id}`},de=(e,t)=>{if(e.layout==="side-by-side")return{layout:"side-by-side",shown:e.previews,tabs:[]};const i=e.previews.find(r=>r.id===t.preview)??e.previews[0];return{layout:"tabs",shown:i?[i]:[],tabs:e.previews.length>1?e.previews:[],...i?{activeId:i.id}:{}}},St=["activity","story","step","preview"],Tt=(e,t,i)=>{switch(t){case"activity":return A(e,i)!==void 0;case"story":return x(e,i)!==void 0||e.activities.some(r=>r.stories.some(a=>a.id===i));case"step":return k(e,i)!==void 0||U(e).some(r=>r.step.id===i);case"preview":return T(e,i)!==void 0;default:return!1}},$t=(e,t)=>{let i;if(t.navigate!==null)i=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const o=t.href?.trim()??"";if(o===""||o==="#"||o.toLowerCase().startsWith("javascript:"))return"no-destination";if(!o.startsWith("#"))return null;i=o}const r=Ze(i),a=St.filter(o=>r[o]!==void 0);return a.length===0?t.navigate===null?null:"unknown-target":a.every(o=>Tt(e,o,r[o]??""))?null:"unknown-target"},It=(e,t)=>{const i=t.mail??{},r=[{label:e.mailFrom,value:i.from},{label:e.mailTo,value:i.to},{label:e.mailCc,value:i.cc},{label:e.mailDate,value:i.date}].flatMap(s=>s.value===void 0||s.value.trim()===""?[]:[{label:s.label,value:s.value}]),a=i.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||i.from?.trim(),o=a?Array.from(a)[0]?.toUpperCase():void 0;return{...i.subject===void 0||i.subject.trim()===""?{}:{subject:i.subject},...a?{sender:a}:{},...o===void 0?{}:{initial:o},rows:r}},Oe=(e,t)=>{const i=[];for(const r of t.activities){i.push({value:Y({type:"activity",id:r.id}),label:r.name,group:e.activityGroup});for(const a of r.stories){i.push({value:Y({type:"story",id:R(r.id,a.id)}),label:`${r.name} \u203A ${a.name}`,group:e.storyGroup});for(const o of a.steps)i.push({value:Y({type:"step",id:F(r,a,o)}),label:`${a.name} \u203A ${o.name}`,group:e.stepGroup})}}return i},_t=(e,t,i)=>{const r=k(t,i.step);return r?{value:Y({type:"step",id:W(r)}),label:r.step.name,group:e.stepGroup}:null},pe=(e,t)=>{const i=k(e,t.step);if(i)return{kind:"step",...i};const r=A(e,t.activity),a=r?.stories.find(o=>o.id===t.story||R(r.id,o.id)===t.story);return r&&a?{kind:"story",activity:r,story:a}:void 0},Ce=e=>{const{activity:t,story:i,step:r}=e,a=r.actor??i.actor??t.actor,o=r.title??r.name;return a===void 0?{title:o}:{actor:a,title:o}},At=(e,t)=>{const i=t.actor??e.actor;return i===void 0?{title:t.name}:{actor:i,title:t.name}},le=e=>e.title??"UX Prototype",Ve=(e,t)=>{const i=A(e,t.activity),r=t.story,a=i?.stories.find(I=>I.id===r||R(i.id,I.id)===r),o=a&&i?{activity:i,story:a}:x(e,r),s=t.step,d=(o&&s?k(e,`${R(o.activity.id,o.story.id)}.${s}`):void 0)??k(e,s),v=d?.activity??o?.activity??i??e.activities[0],p=d?.story??(o&&o.activity===v?o.story:void 0)??v?.stories[0],l=d?.step??p?.steps[0],h={...t};v?h.activity=v.id:delete h.activity,p&&v?h.story=x(e,p.id)?p.id:R(v.id,p.id):delete h.story,l&&p&&v?h.step=k(e,l.id)?l.id:F(v,p,l):delete h.step;const $=l?.layout==="side-by-side"?void 0:l&&t.preview&&l.previews.some(I=>I.id===t.preview)?t.preview:l?.previews[0]?.id;return $?h.preview=$:delete h.preview,h},Rt=(e,t)=>{switch(t.type){case"activity":return A(e,t.id)!==void 0;case"story":return x(e,t.id)!==void 0;case"step":return k(e,t.id)!==void 0;case"preview":return T(e,t.id)!==void 0;case"page":return!0;case z:{const i=te(t.id);return i!==void 0&&T(e,i.previewId)!==void 0}default:return!1}},Ne=e=>{const t=oe(e);return{name:"prototype",label:"UX Prototype",parseBase:Ee,emptyBase:Se,actions:m,apply:Ie,hasTarget:Rt,canonicalTarget:(i,r)=>{if(r.type==="step"){const a=k(i,r.id);return a?{...r,id:W(a)}:r}if(r.type==="story"){const a=x(i,r.id);return a?{...r,id:R(a.activity.id,a.story.id)}:r}if(r.type==="preview"){const a=T(i,r.id);return a?{...r,id:a.preview.id}:r}return r},describe:(i,r,a)=>_e(t,i,r,a),serialize:Ae,resolveNavigation:Ve,navigationHierarchy:["activity","story","step","preview"],commentTargets:(i,r)=>Oe(t,i),currentTarget:(i,r)=>_t(t,i,r),title:le}},Pt='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',Me=/^-?[A-Za-z_][\w-]*$/,Le=40,Dt=(e,t)=>{const i=e.closest(Pt);return i!==null&&i!==t&&t.contains(i)?i:e},X=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const i=Array.from(t);return i.length>Le?`${i.slice(0,Le).join("")}\u2026`:t},Ot=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return X(t);const i=e.tagName.toLowerCase();return X(i==="input"||i==="textarea"||i==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":i==="img"?e.getAttribute("alt")??"":e.textContent??"")},Ct=e=>{const t=e.getAttribute("id");if(t&&Me.test(t))return`#${t}`;const i=e.tagName.toLowerCase(),r=Array.from(e.classList).filter(n=>Me.test(n)).slice(0,2).map(n=>`.${n}`).join(""),a=e.parentElement,o=a?Array.from(a.children).filter(n=>n.tagName===e.tagName):[],s=o.length>1?`:nth-of-type(${o.indexOf(e)+1})`:"";return`${i}${r}${s}`},Vt=(e,t,i)=>{try{const r=e.querySelectorAll(t);return r.length===1&&r[0]===i}catch{return!1}},Nt=(e,t)=>{const i=[];let r=e;for(;r!==null&&r!==t;){const o=Ct(r);if(i.unshift(o),o.startsWith("#")||Vt(t,i.join(" > "),e))break;r=r.parentElement}const a=Ot(e);return{selector:i.length===0?":scope":i.join(" > "),tag:e.tagName.toLowerCase(),...a===void 0?{}:{text:a}}},Mt=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},Ye=(e,t)=>{const{state:i,navigation:r}=e,a=pe(i,r);if(!a)return u`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`;const{activity:o,story:s}=a,n=s.steps,d=a.kind==="step"?a.step:void 0,v=a.kind==="step"?W(a):void 0;return u`
2
- <div class="nav">
3
- <div class="field">
4
- <span class="dpk-label">Activity</span>
5
- <select
6
- class="dpk-select"
7
- aria-label="Activity"
8
- @change=${he(p=>e.navigate({activity:p,story:null,step:null}))}
9
- >
10
- ${i.activities.map(p=>u`<option value=${p.id} ?selected=${p.id===o.id}>${p.name}</option>`)}
11
- </select>
12
- </div>
13
- <div class="field">
14
- <span class="dpk-label">User Story</span>
15
- <select
16
- class="dpk-select"
17
- aria-label="User Story"
18
- @change=${he(p=>e.navigate({activity:o.id,story:p,step:null}))}
19
- >
20
- ${o.stories.map(p=>u`<option value=${p.id} ?selected=${p.id===s.id}>${p.name}</option>`)}
21
- </select>
22
- </div>
23
- <div class="steps-head">
24
- <span class="dpk-label">Step</span>
25
- <span class="dpk-label">${n.length}</span>
26
- </div>
27
- <ol class="steps">
28
- ${et(n,p=>F(o,s,p),(p,l)=>{const h=F(o,s,p),$=e.commentCount({type:"step",id:h})+xt(e.comments,p.previews.map(I=>I.id));return u`
29
- <li class="step-row" data-current=${String(p.id===d?.id)}>
30
- <a class="step-link" href=${e.hashFor({activity:o.id,story:s.id,step:p.id})}>
31
- <span class="step-index">${String(l+1).padStart(2,"0")}</span>
32
- <span class="step-name">${p.name}</span>
33
- ${$>0?u`<span class="step-note">${$}</span>`:b}
34
- </a>
35
- <span class="row-tools">
36
- <button
37
- class="dpk-icon-btn"
38
- type="button"
39
- aria-label=${t.deleteStepAria}
40
- @click=${()=>e.dispatch(G.deleteStep(h))}
41
- >
42
- ${tt()}
43
- </button>
44
- </span>
45
- </li>
46
- `})}
47
- </ol>
48
- <button class="dpk-btn" type="button" @click=${()=>Lt(e,t,R(o.id,s.id))}>
49
- ${t.addStepButton}
50
- </button>
51
- ${d?fe(v,u`<div class="detail">
52
- <div class="detail-row">
53
- <span class="dpk-label">${t.stepNameLabel}</span>
54
- <span class="detail-value">
55
- <dpk-component-inline-edit
56
- .value=${d.name}
57
- .label=${t.stepNameLabel}
58
- @dpk-commit=${me(p=>e.dispatch(G.setStepName(v??d.id,p)))}
59
- ></dpk-component-inline-edit>
60
- </span>
61
- </div>
62
- <div class="detail-row">
63
- <span class="dpk-label">${t.descriptionLabel}</span>
64
- <span class="detail-value">
65
- <dpk-component-inline-edit
66
- multiline
67
- .value=${d.description??""}
68
- .placeholder=${t.descriptionPlaceholder}
69
- .label=${t.descriptionLabel}
70
- @dpk-commit=${me(p=>e.dispatch(G.setStepDescription(v??d.id,p)))}
71
- ></dpk-component-inline-edit>
72
- </span>
73
- </div>
74
- </div>`):b}
75
- </div>
76
- `},Lt=(e,t,i)=>{const r=it("new-step",$e(e.state));e.dispatch(G.addStep(i,r,t.newStepName)).ok&&e.navigate({story:i,step:r})},Yt=(e,t)=>{const i=t.mode.kind!=="off";return u`<button
77
- class=${i?"dpk-btn dpk-btn--accent ui-comment-toggle":"dpk-btn ui-comment-toggle"}
78
- type="button"
79
- aria-pressed=${i?"true":"false"}
80
- title=${e.uiCommentHint}
81
- @click=${()=>t.send({kind:"toggle"})}
82
- >
83
- ${ge()} ${e.uiComment}
84
- </button>`},zt=(e,t)=>t.mode.kind==="off"?b:u`<p class="ui-comment-hint" role="status">${ge()} ${e.uiCommentHint}</p>`,Wt=(e,t)=>t.mode.kind==="off"?b:u`<div class="ui-layer" aria-hidden="true">
85
- <div class="ui-box ui-hover" hidden></div>
86
- <div class="ui-box ui-picked" hidden></div>
87
- ${t.pins.map(i=>u`<span
88
- class="ui-pin"
89
- hidden
90
- data-preview=${i.previewId}
91
- data-selector=${i.selector}
92
- title=${e.uiCommentPin(i.number,i.body)}
93
- >${i.number}</span
94
- >`)}
95
- </div>`,Ut=e=>{const t=e.mode;if(t.kind!=="composing")return b;const i=dt(t.body,e.notes,e.targetLabel===void 0?{}:{label:e.targetLabel});return u`${fe(`${t.target.previewId}/${t.target.selector}`,pt(e.composer,i,r=>{r.kind==="input"?e.send({kind:"input",body:r.body}):r.kind==="comment"?e.submit(r.body):e.send({kind:"dismiss"})}))}`},ze={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},We={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},Ue=(e,t,i)=>{const{state:r,navigation:a}=e,o=pe(r,a),s=o?.kind==="step"?o:void 0,n=s?de(s.step,a):void 0,d=Ft(r,n?.shown.map(_=>_.id)??[]);if(o?.kind==="story"){const{activity:_,story:Z}=o;return u`
96
- <div class="stage">
97
- <section class="stage-story">
98
- ${Ge(t,At(_,Z))}
99
- ${Z.description?u`<p class="story-description">${Z.description}</p>`:b}
100
- <p class="stage-empty">${t.storyWithoutSteps}</p>
101
- </section>
102
- ${d}
103
- </div>
104
- `}if(!s)return u`
105
- <div class="stage">
106
- <p class="stage-empty">
107
- ${t.noStepBefore}<strong>Activity › UserStory › Step › Preview</strong>${t.noStepAfter}
108
- </p>
109
- ${d}
110
- </div>
111
- `;const{layout:v,shown:p,tabs:l,activeId:h}=n??de(s.step,a),$=i.uiComment,I=i.maximized;return u`
112
- ${I===null?b:u`<div class="stage-placeholder" style=${`height:${I.height}px`}></div>`}
113
- <div
114
- class=${I===null?"stage":"stage is-maximized"}
115
- data-ui-comment=${$.mode.kind}
116
- popover=${I===null?b:"manual"}
117
- @wheel=${I===null?b:{handleEvent:i.onMaximizedWheel,passive:!1}}
118
- >
119
- <div class="stage-bar">
120
- ${Ge(t,Ce(s))}
121
- <div class="stage-tools">
122
- ${l.length>0?jt(e,l,h):b}
123
- ${p.length>0?Yt(t,$):b}
124
- ${p.length>0?Bt(t,I!==null,i.onToggleMaximize):b}
125
- </div>
126
- </div>
127
- ${s.step.situation===void 0?b:Gt(t,s.step.situation)}
128
- ${zt(t,$)}
129
- <div
130
- class="canvas"
131
- data-layout=${v}
132
- @click=${{handleEvent:i.canvasEvents.click,capture:!0}}
133
- @pointermove=${{handleEvent:i.canvasEvents.pointermove,capture:!0}}
134
- @pointerleave=${i.canvasEvents.pointerleave}
135
- @scroll=${{handleEvent:i.canvasEvents.scroll,capture:!0}}
136
- >
137
- ${v==="side-by-side"?u`<div class="panes">
138
- ${p.map(_=>u`<div class="pane" data-viewport=${_.viewport}>
139
- ${_.label===void 0?b:u`<span class="pane-label">${_.label}</span>`}
140
- ${ce(e,t,_,i.hasPreviewContent(_.id))}
141
- </div>`)}
142
- </div>`:p.map(_=>ce(e,t,_,i.hasPreviewContent(_.id)))}
143
- ${p.length===0?u`<p class="dpk-label">${t.noPreviewMetadata}</p>`:b}
144
- ${Wt(t,$)}
145
- </div>
146
- ${Ut($)} ${d}
147
- </div>
148
- `},Ge=(e,t)=>u`<div class="page-head">
149
- ${t.actor===void 0?b:u`<span class="page-actor" role="note" aria-label=${e.pageActor(t.actor)}>
150
- <svg viewBox="0 0 16 16" aria-hidden="true">
151
- <circle cx="8" cy="5.2" r="2.7" />
152
- <path d="M2.8 14c.5-3 2.6-4.6 5.2-4.6s4.7 1.6 5.2 4.6Z" />
153
- </svg>
154
- ${t.actor}
155
- </span>`}
156
- <h2 class="page-title">${t.title}</h2>
157
- </div>`,Gt=(e,t)=>u`<aside class="situation">
158
- <span class="situation-label">${e.situation}</span>
159
- <p class="situation-text">${t}</p>
160
- </aside>`,jt=(e,t,i)=>u`<div class="tabs" role="tablist">
161
- ${t.map(r=>u`<a
162
- class="tab"
163
- role="tab"
164
- data-current=${String(r.id===i)}
165
- aria-selected=${r.id===i?"true":"false"}
166
- href=${e.hashFor({preview:r.id})}
167
- >${r.label??r.viewport}</a
168
- >`)}
169
- </div>`,Bt=(e,t,i)=>u`<button
170
- class="dpk-btn stage-maximize"
171
- type="button"
172
- aria-pressed=${t?"true":"false"}
173
- title=${e.maximizeHint}
174
- @click=${i}
175
- >
176
- ${t?u`${rt()} ${e.restore}`:u`${at()} ${e.maximize}`}
177
- </button>`,ce=(e,t,i,r)=>u`
178
- <figure
179
- class="frame"
180
- data-kind=${i.kind}
181
- data-viewport=${i.viewport}
182
- ?data-empty=${!r}
183
- style=${`--frame-width:${ze[i.viewport]};--frame-min-height:${We[i.viewport]}`}
184
- >
185
- ${i.kind==="browser"?u`<div class="chrome">
186
- <span class="dots"><i></i><i></i><i></i></span>
187
- <span class="url">${Et(e.state,i)}</span>
188
- </div>`:i.kind==="mail"?qt(It(t,i)):b}
189
- <div class="viewport">
190
- ${i.kind==="native"?Ht():b}
191
- <slot name=${`preview:${i.id}`}></slot>
192
- ${r?b:u`<div class="frame-placeholder">
193
- <span class="dpk-label">light dom preview</span>
194
- <code>&lt;div slot="preview" data-preview-id="${i.id}"&gt;</code>
195
- </div>`}
196
- </div>
197
- </figure>
198
- `,qt=e=>u`<header class="mail-head">
199
- ${e.subject===void 0?b:u`<h3 class="mail-subject">${e.subject}</h3>`}
200
- <div class="mail-envelope">
201
- ${e.initial===void 0?b:u`<span class="mail-avatar" aria-hidden="true">${e.initial}</span>`}
202
- <dl class="mail-meta">
203
- ${e.rows.map(t=>u`<div class="mail-row">
204
- <dt>${t.label}</dt>
205
- <dd>${t.value}</dd>
206
- </div>`)}
207
- </dl>
208
- </div>
209
- </header>`,Ht=()=>u`<div class="status-bar">
210
- <span class="status-time">9:41</span>
211
- <span class="punch-hole" aria-hidden="true"></span>
212
- <svg class="status-wifi" viewBox="0 0 16 12" aria-hidden="true">
213
- <path d="M8 9.2a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" />
214
- <path
215
- d="M4.7 7.4a4.8 4.8 0 0 1 6.6 0"
216
- fill="none"
217
- stroke="currentColor"
218
- stroke-width="1.5"
219
- stroke-linecap="round"
220
- />
221
- <path
222
- d="M2.1 4.7a8.4 8.4 0 0 1 11.8 0"
223
- fill="none"
224
- stroke="currentColor"
225
- stroke-width="1.5"
226
- stroke-linecap="round"
227
- />
228
- </svg>
229
- </div>`,Ft=(e,t)=>{const i=U(e).flatMap(r=>r.step.previews.filter(a=>!t.includes(a.id)));return i.length===0?u`${b}`:u`<div class="parked" aria-hidden="true">
230
- ${i.map(r=>u`<slot name=${`preview:${r.id}`}></slot>`)}
231
- </div>`},Kt=ot`
232
- :host {
233
- --dpk-prototype-accent: var(--dpk-blue);
234
- }
235
-
236
- /* ---------------------------------------------------------------- sidebar */
237
-
238
- .nav {
239
- display: grid;
240
- gap: 14px;
241
- align-content: start;
242
- min-width: 188px;
243
- }
244
-
245
- .field {
246
- display: grid;
247
- gap: 5px;
248
- }
249
-
250
- .steps-head {
251
- display: flex;
252
- align-items: baseline;
253
- justify-content: space-between;
254
- padding-bottom: 5px;
255
- border-bottom: 1px solid var(--dpk-rule);
256
- }
257
-
258
- .steps {
259
- list-style: none;
260
- margin: 0;
261
- padding: 0;
262
- display: grid;
263
- gap: 2px;
264
- max-height: 38vh;
265
- overflow: auto;
266
- }
267
-
268
- .step-row {
269
- position: relative;
270
- display: flex;
271
- align-items: center;
272
- gap: 4px;
273
- padding: 0 4px 0 9px;
274
- border-radius: var(--dpk-radius-sm);
275
- transition:
276
- background 140ms ease,
277
- box-shadow 140ms ease;
278
- }
279
-
280
- .step-row:hover {
281
- background: var(--dpk-paper-inset);
282
- }
283
-
284
- .step-row[data-current='true'] {
285
- background: linear-gradient(
286
- 180deg,
287
- color-mix(in srgb, var(--dpk-prototype-accent) 10%, var(--dpk-paper-raised)),
288
- color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised))
289
- );
290
- box-shadow:
291
- inset 0 0 0 1px color-mix(in srgb, var(--dpk-prototype-accent) 22%, transparent),
292
- var(--dpk-shadow-xs);
293
- }
294
-
295
- .step-row[data-current='true']::before {
296
- content: '';
297
- position: absolute;
298
- left: 0;
299
- top: 8px;
300
- bottom: 8px;
301
- width: 3px;
302
- border-radius: var(--dpk-radius-xs);
303
- background: linear-gradient(180deg, var(--dpk-blue), var(--dpk-blue-strong));
304
- box-shadow: 0 0 8px color-mix(in srgb, var(--dpk-prototype-accent) 45%, transparent);
305
- }
306
-
307
- .step-link {
308
- display: flex;
309
- flex: 1;
310
- min-width: 0;
311
- align-items: center;
312
- gap: 7px;
313
- padding: 7px 0;
314
- text-decoration: none;
315
- color: var(--dpk-ink-soft);
316
- font-size: 12.5px;
317
- font-weight: 460;
318
- }
319
-
320
- .step-row[data-current='true'] .step-link {
321
- color: var(--dpk-ink);
322
- font-weight: 550;
323
- }
324
-
325
- .step-index {
326
- flex: 0 0 auto;
327
- min-width: 17px;
328
- padding: 1px 4px;
329
- border-radius: var(--dpk-radius-xs);
330
- background: var(--dpk-paper-inset);
331
- font-family: var(--dpk-mono);
332
- font-size: 9.5px;
333
- font-variant-numeric: tabular-nums;
334
- text-align: center;
335
- color: var(--dpk-ink-faint);
336
- transition:
337
- background 140ms ease,
338
- color 140ms ease;
339
- }
340
-
341
- .step-row[data-current='true'] .step-index {
342
- background: linear-gradient(180deg, var(--dpk-blue), var(--dpk-blue-strong));
343
- color: #fff;
344
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
345
- }
346
-
347
- .step-name {
348
- min-width: 0;
349
- overflow: hidden;
350
- white-space: nowrap;
351
- text-overflow: ellipsis;
352
- }
353
-
354
- .step-note {
355
- margin-left: auto;
356
- min-width: 16px;
357
- padding: 1px 5px;
358
- border-radius: 999px;
359
- background: var(--dpk-accent);
360
- color: var(--dpk-accent-ink);
361
- font-family: var(--dpk-mono);
362
- font-size: 9px;
363
- font-variant-numeric: tabular-nums;
364
- text-align: center;
365
- }
366
-
367
- .row-tools {
368
- display: flex;
369
- gap: 0;
370
- opacity: 0;
371
- transition: opacity 120ms ease;
372
- }
373
-
374
- .step-row:hover .row-tools,
375
- .step-row[data-current='true'] .row-tools {
376
- opacity: 1;
377
- }
378
-
379
- .detail {
380
- display: grid;
381
- gap: 12px;
382
- padding: 12px 12px 14px;
383
- border: 1px solid var(--dpk-rule);
384
- border-radius: var(--dpk-radius);
385
- background: var(--dpk-paper-raised);
386
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
387
- }
388
-
389
- .detail-row {
390
- display: grid;
391
- gap: 4px;
392
- }
393
-
394
- .detail-value {
395
- font-size: 12.5px;
396
- color: var(--dpk-ink-soft);
397
- }
398
-
399
- .nav-empty {
400
- font-size: 12px;
401
- line-height: 1.6;
402
- color: var(--dpk-ink-faint);
403
- }
404
-
405
- /* ------------------------------------------------------------------ stage */
406
-
407
- .stage {
408
- display: grid;
409
- /* One column no wider than the main area: a wide row of panes scrolls inside the canvas. */
410
- grid-template-columns: minmax(0, 1fr);
411
- gap: 14px;
412
- width: 100%;
413
- min-width: 0;
414
- }
415
-
416
- .stage-bar {
417
- display: flex;
418
- align-items: center;
419
- justify-content: space-between;
420
- gap: 10px 16px;
421
- min-width: 0;
422
- flex-wrap: wrap;
423
- }
424
-
425
- /* ------------------------------------------------------------- page head */
426
-
427
- .page-head {
428
- display: flex;
429
- align-items: center;
430
- gap: 12px;
431
- min-width: 0;
432
- animation: dpk-page-head-in 260ms var(--dpk-ease) backwards;
433
- }
434
-
435
- @keyframes dpk-page-head-in {
436
- from {
437
- opacity: 0;
438
- transform: translateY(4px);
439
- }
440
- }
441
-
442
- .page-actor {
443
- display: inline-flex;
444
- flex: none;
445
- align-items: center;
446
- gap: 6px;
447
- height: 26px;
448
- padding: 0 11px 0 8px;
449
- border-radius: 999px;
450
- background: linear-gradient(
451
- 180deg,
452
- color-mix(in srgb, var(--dpk-blue) 16%, var(--dpk-paper-raised)),
453
- color-mix(in srgb, var(--dpk-blue) 9%, var(--dpk-paper-raised))
454
- );
455
- box-shadow:
456
- var(--dpk-bevel),
457
- inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 32%, transparent),
458
- var(--dpk-shadow-xs);
459
- color: var(--dpk-blue);
460
- font-size: 12px;
461
- font-weight: 650;
462
- letter-spacing: 0.01em;
463
- white-space: nowrap;
464
- }
465
-
466
- .page-actor svg {
467
- width: 13px;
468
- height: 13px;
469
- fill: currentColor;
470
- opacity: 0.9;
471
- }
472
-
473
- .page-title {
474
- margin: 0;
475
- min-width: 0;
476
- overflow: hidden;
477
- font-size: 19px;
478
- font-weight: 700;
479
- line-height: 1.3;
480
- letter-spacing: -0.02em;
481
- color: var(--dpk-ink);
482
- text-overflow: ellipsis;
483
- white-space: nowrap;
484
- }
485
-
486
- .stage-tools {
487
- display: flex;
488
- align-items: center;
489
- gap: 8px;
490
- margin-left: auto;
491
- }
492
-
493
- .stage-maximize svg {
494
- width: 13px;
495
- height: 13px;
496
- }
497
-
498
- .tabs {
499
- display: inline-flex;
500
- gap: 2px;
501
- padding: 3px;
502
- border: 1px solid var(--dpk-rule);
503
- border-radius: 999px;
504
- background: var(--dpk-paper-sunken);
505
- box-shadow: inset 0 1px 2px rgba(20, 28, 44, 0.04);
506
- }
507
-
508
- .tab {
509
- padding: 4px 14px;
510
- border-radius: 999px;
511
- font-size: 12px;
512
- font-weight: 500;
513
- text-decoration: none;
514
- color: var(--dpk-ink-soft);
515
- white-space: nowrap;
516
- transition:
517
- background 120ms ease,
518
- color 120ms ease;
519
- }
520
-
521
- .tab:hover {
522
- color: var(--dpk-ink);
523
- background: var(--dpk-paper-raised);
524
- }
525
-
526
- .tab[data-current='true'] {
527
- background: var(--dpk-paper-raised);
528
- color: var(--dpk-ink);
529
- font-weight: 600;
530
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
531
- }
532
-
533
- .stage-empty {
534
- max-width: 62ch;
535
- padding: 16px 18px;
536
- border: 1px dashed var(--dpk-rule-strong);
537
- border-radius: var(--dpk-radius-lg);
538
- background: var(--dpk-paper-sunken);
539
- font-size: 13px;
540
- line-height: 1.7;
541
- color: var(--dpk-ink-soft);
542
- }
543
-
544
- /* A story that has no steps yet: its heading, what it is for, and why no frame. */
545
- .stage-story {
546
- display: grid;
547
- gap: 12px;
548
- justify-items: start;
549
- }
550
-
551
- .story-description {
552
- max-width: 62ch;
553
- margin: 0;
554
- font-size: 14px;
555
- line-height: 1.7;
556
- color: var(--dpk-ink);
557
- white-space: pre-wrap;
558
- }
559
-
560
- /* -------------------------------------------------------------- situation */
561
-
562
- /*
563
- * What is going on around the previews: a stage direction, read before them.
564
- * The band spans the stage at any width (a maximized stage too); only the
565
- * text keeps a readable line length.
566
- */
567
- .situation {
568
- display: flex;
569
- align-items: baseline;
570
- gap: 10px;
571
- margin: -4px 0 -2px;
572
- padding: 8px 14px 8px 10px;
573
- border: 1px solid color-mix(in srgb, var(--dpk-prototype-accent) 16%, var(--dpk-rule));
574
- border-radius: var(--dpk-radius);
575
- background: color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised));
576
- box-shadow: var(--dpk-bevel);
577
- }
578
-
579
- .situation-label {
580
- flex: none;
581
- padding: 2px 8px;
582
- border-radius: 999px;
583
- background: color-mix(in srgb, var(--dpk-prototype-accent) 13%, transparent);
584
- font-size: 10.5px;
585
- font-weight: 650;
586
- letter-spacing: 0.06em;
587
- color: var(--dpk-prototype-accent);
588
- }
589
-
590
- .situation-text {
591
- max-width: 90ch;
592
- margin: 0;
593
- min-width: 0;
594
- font-size: 13px;
595
- line-height: 1.65;
596
- color: var(--dpk-ink);
597
- white-space: pre-line;
598
- }
599
-
600
- /* ----------------------------------------------------------------- canvas */
601
-
602
- /*
603
- * The work surface the frame sits on: a quiet dot lattice that reads as a
604
- * canvas rather than empty page background, giving the frame somewhere to
605
- * cast its shadow.
606
- */
607
- .canvas {
608
- display: flex;
609
- justify-content: center;
610
- padding: 30px;
611
- border: 1px solid var(--dpk-rule);
612
- border-radius: var(--dpk-radius-xl);
613
- background: var(--dpk-dots), var(--dpk-paper-sunken);
614
- box-shadow: inset 0 1px 3px var(--dpk-shade-1);
615
- }
616
-
617
- /* ---------------------------------------------------------- comment on UI */
618
-
619
- .ui-comment-toggle svg,
620
- .ui-comment-hint svg {
621
- width: 14px;
622
- height: 14px;
623
- }
624
-
625
- .ui-comment-toggle {
626
- display: inline-flex;
627
- align-items: center;
628
- gap: 6px;
629
- }
630
-
631
- .ui-comment-hint {
632
- display: flex;
633
- align-items: center;
634
- gap: 8px;
635
- margin: -4px 0 -2px;
636
- padding: 7px 12px;
637
- border-radius: var(--dpk-radius);
638
- background: var(--dpk-accent-soft);
639
- color: var(--dpk-accent-strong, var(--dpk-accent));
640
- font-size: 12.5px;
641
- font-weight: 550;
642
- }
643
-
644
- .canvas {
645
- position: relative;
646
- }
647
-
648
- .stage:not([data-ui-comment='off']) .canvas ::slotted(*) {
649
- cursor: crosshair;
650
- }
651
-
652
- /* Positioned against the canvas by the element, which measures the author's markup. */
653
- .ui-layer {
654
- display: contents;
655
- }
656
-
657
- .ui-box {
658
- position: absolute;
659
- z-index: 2;
660
- box-sizing: border-box;
661
- border-radius: 4px;
662
- pointer-events: none;
663
- }
664
-
665
- .ui-hover {
666
- outline: 2px solid var(--dpk-accent);
667
- outline-offset: 1px;
668
- background: color-mix(in srgb, var(--dpk-accent) 8%, transparent);
669
- }
670
-
671
- .ui-picked {
672
- outline: 2px solid var(--dpk-accent);
673
- outline-offset: 2px;
674
- background: color-mix(in srgb, var(--dpk-accent) 14%, transparent);
675
- box-shadow: 0 0 0 6px color-mix(in srgb, var(--dpk-accent) 18%, transparent);
676
- }
677
-
678
- .ui-pin {
679
- position: absolute;
680
- z-index: 3;
681
- display: grid;
682
- place-items: center;
683
- min-width: 20px;
684
- height: 20px;
685
- padding: 0 5px;
686
- box-sizing: border-box;
687
- transform: translate(-50%, -50%);
688
- border: 2px solid var(--dpk-paper-raised);
689
- border-radius: 999px 999px 999px 2px;
690
- background: var(--dpk-accent);
691
- color: var(--dpk-accent-ink);
692
- box-shadow: var(--dpk-shadow-sm);
693
- font-family: var(--dpk-mono);
694
- font-size: 10px;
695
- font-weight: 700;
696
- pointer-events: auto;
697
- }
698
-
699
- .ui-box[hidden],
700
- .ui-pin[hidden] {
701
- display: none;
702
- }
703
-
704
- /*
705
- * Side by side: what the user sees together, in one row. A fixed viewport
706
- * keeps its width as long as the row allows it, a fluid one takes the rest;
707
- * a row wider than the canvas scrolls sideways instead of squeezing a device.
708
- */
709
- .panes {
710
- display: flex;
711
- align-items: flex-start;
712
- justify-content: safe center;
713
- gap: 28px;
714
- width: 100%;
715
- min-width: 0;
716
- overflow-x: auto;
717
- padding-bottom: 4px;
718
- }
719
-
720
- /* A device shrinks at most to a width its layout still reads at, then the row scrolls. */
721
- .pane {
722
- display: grid;
723
- gap: 8px;
724
- flex: 0 1 var(--pane-width);
725
- min-width: min(var(--pane-width), 720px);
726
- }
727
-
728
- .pane[data-viewport='mobile'] {
729
- --pane-width: 390px;
730
- }
731
-
732
- .pane[data-viewport='tablet'] {
733
- --pane-width: 834px;
734
- }
735
-
736
- .pane[data-viewport='desktop'] {
737
- --pane-width: 1180px;
738
- }
739
-
740
- .pane[data-viewport='fluid'] {
741
- flex: 1 1 0;
742
- min-width: 240px;
743
- }
744
-
745
- .pane .frame {
746
- width: 100%;
747
- }
748
-
749
- .pane-label {
750
- justify-self: start;
751
- padding: 2px 9px;
752
- border-radius: 999px;
753
- background: var(--dpk-paper-raised);
754
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
755
- font-size: 11.5px;
756
- font-weight: 600;
757
- color: var(--dpk-ink-soft);
758
- }
759
-
760
- /*
761
- * Maximized: the stage covers the tab — the page head, the tabs and the canvas
762
- * alone. It is also a manual popover in the top layer, so the UA popover box
763
- * (fit-content, margin, border, padding, colors) is reset here. The canvas
764
- * scrolls instead of the page, and a browser preview is at least as tall as
765
- * the tab allows; a phone keeps its device shape. Whatever sits above the
766
- * canvas (the situation, the comment-on-UI hint) keeps its own height, and the
767
- * canvas takes the rest.
768
- */
769
- .stage.is-maximized {
770
- position: fixed;
771
- inset: 0;
772
- z-index: 2147483000;
773
- display: flex;
774
- flex-direction: column;
775
- width: auto;
776
- height: auto;
777
- max-width: none;
778
- max-height: none;
779
- margin: 0;
780
- padding: 16px 20px 20px;
781
- border: 0;
782
- color: var(--dpk-ink);
783
- background: var(--dpk-paper);
784
- overflow: hidden;
785
- }
786
-
787
- .stage.is-maximized > * {
788
- flex: none;
789
- }
790
-
791
- .stage.is-maximized > .canvas {
792
- flex: 1 1 0;
793
- min-height: 0;
794
- align-items: flex-start;
795
- overflow: auto;
796
- overscroll-behavior: contain;
797
- }
798
-
799
- .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) {
800
- display: flex;
801
- flex-direction: column;
802
- min-height: 100%;
803
- }
804
-
805
- .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) .viewport {
806
- flex: 1 0 auto;
807
- }
808
-
809
- /* ------------------------------------------------------------------ frame */
810
-
811
- .frame {
812
- width: min(var(--frame-width), 100%);
813
- max-width: 100%;
814
- margin: 0;
815
- border: 1px solid var(--dpk-rule);
816
- border-radius: var(--dpk-radius-lg);
817
- background: var(--dpk-paper-raised);
818
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
819
- overflow: hidden;
820
- transition: box-shadow 200ms var(--dpk-ease);
821
- }
822
-
823
- .chrome {
824
- display: flex;
825
- align-items: center;
826
- gap: 8px;
827
- padding: 8px 14px;
828
- background: linear-gradient(
829
- 180deg,
830
- color-mix(in srgb, var(--dpk-paper-raised) 88%, transparent),
831
- color-mix(in srgb, var(--dpk-paper-inset) 88%, transparent)
832
- );
833
- backdrop-filter: blur(10px);
834
- border-bottom: 1px solid var(--dpk-rule);
835
- box-shadow: inset 0 1px 0 var(--dpk-highlight);
836
- }
837
-
838
- .dots {
839
- display: inline-flex;
840
- gap: 5px;
841
- }
842
-
843
- .dots i {
844
- width: 10px;
845
- height: 10px;
846
- border-radius: 50%;
847
- background: var(--dpk-rule-strong);
848
- }
849
-
850
- .dots i:nth-child(1) {
851
- background: #ff5f57;
852
- }
853
-
854
- .dots i:nth-child(2) {
855
- background: #febc2e;
856
- }
857
-
858
- .dots i:nth-child(3) {
859
- background: #28c840;
860
- }
861
-
862
- .chrome .url {
863
- flex: 1;
864
- min-width: 0;
865
- padding: 4px 14px;
866
- border: 1px solid var(--dpk-rule);
867
- border-radius: var(--dpk-radius-sm);
868
- background: var(--dpk-paper-raised);
869
- box-shadow: inset 0 1px 2px rgba(20, 28, 44, 0.04);
870
- font-family: var(--dpk-mono);
871
- font-size: 10.5px;
872
- color: var(--dpk-ink-faint);
873
- overflow: hidden;
874
- white-space: nowrap;
875
- text-overflow: ellipsis;
876
- }
877
-
878
- /*
879
- * Native previews are recognised by their device shape: a slim bezel, a status
880
- * bar with a punch-hole camera, and a home indicator. No address bar.
881
- */
882
- .frame[data-kind='native'] {
883
- padding: 10px;
884
- border-color: #22262e;
885
- border-radius: 28px;
886
- background: linear-gradient(160deg, #2e3440, #1a1d24);
887
- box-shadow:
888
- var(--dpk-shadow-lg),
889
- inset 0 1px 0 rgba(255, 255, 255, 0.06);
890
- }
891
-
892
- .frame[data-kind='native'] .viewport {
893
- overflow: hidden;
894
- border-radius: 18px;
895
- }
896
-
897
- /* A phone is portrait: derive the screen height from its width (~1:2.05)
898
- instead of reusing the browser preview heights. */
899
- .frame[data-kind='native'][data-viewport='mobile'] .viewport {
900
- min-height: calc((var(--frame-width, 390px) - 16px) * 2.05);
901
- }
902
-
903
- /*
904
- * A mail preview reads as one opened message in a mail client: the subject,
905
- * the sender's avatar and the envelope rows, then the body (the light DOM).
906
- */
907
- .mail-head {
908
- display: grid;
909
- gap: 12px;
910
- padding: 18px 22px 14px;
911
- border-bottom: 1px solid #e3e6ec;
912
- background: #fff;
913
- color: #1f2430;
914
- color-scheme: light;
915
- }
916
-
917
- .mail-subject {
918
- margin: 0;
919
- font-size: 18px;
920
- font-weight: 650;
921
- line-height: 1.35;
922
- letter-spacing: -0.01em;
923
- }
924
-
925
- .mail-envelope {
926
- display: flex;
927
- align-items: flex-start;
928
- gap: 12px;
929
- min-width: 0;
930
- }
931
-
932
- .mail-avatar {
933
- display: inline-grid;
934
- flex: none;
935
- place-items: center;
936
- width: 34px;
937
- height: 34px;
938
- border-radius: 50%;
939
- background: linear-gradient(160deg, #6b8af5, #3f5fd8);
940
- color: #fff;
941
- font-size: 14px;
942
- font-weight: 650;
943
- }
944
-
945
- .mail-meta {
946
- display: grid;
947
- gap: 2px;
948
- min-width: 0;
949
- margin: 0;
950
- font-size: 12px;
951
- line-height: 1.5;
952
- }
953
-
954
- .mail-row {
955
- display: flex;
956
- gap: 8px;
957
- min-width: 0;
958
- }
959
-
960
- .mail-row dt {
961
- flex: none;
962
- min-width: 3.5em;
963
- color: #7a8294;
964
- }
965
-
966
- .mail-row dd {
967
- min-width: 0;
968
- margin: 0;
969
- overflow-wrap: anywhere;
970
- color: #1f2430;
971
- }
972
-
973
- .mail-row:first-child dd {
974
- font-weight: 600;
975
- }
976
-
977
- /*
978
- * A plain preview is not a screen: no chrome, no bezel, no frame of its own.
979
- * The light DOM draws the whole object (a memo, a FAX, a paper form) and the
980
- * canvas is its desk, so it is as tall as its content.
981
- */
982
- .frame[data-kind='plain'] {
983
- border: none;
984
- border-radius: 0;
985
- background: transparent;
986
- box-shadow: none;
987
- overflow: visible;
988
- }
989
-
990
- .frame[data-kind='plain'] .viewport {
991
- min-height: 0;
992
- background: transparent;
993
- }
994
-
995
- .frame[data-kind='plain'][data-empty] .viewport {
996
- min-height: 180px;
997
- }
998
-
999
- .status-bar {
1000
- position: relative;
1001
- display: flex;
1002
- flex: 0 0 auto;
1003
- align-items: center;
1004
- justify-content: space-between;
1005
- height: 30px;
1006
- padding: 0 12px;
1007
- background: #0c0e13;
1008
- color: #e9edf4;
1009
- font-size: 11.5px;
1010
- font-weight: 550;
1011
- font-variant-numeric: tabular-nums;
1012
- }
1013
-
1014
- .status-time {
1015
- letter-spacing: 0.02em;
1016
- }
1017
-
1018
- .punch-hole {
1019
- position: absolute;
1020
- top: 50%;
1021
- left: 50%;
1022
- width: 10px;
1023
- height: 10px;
1024
- transform: translate(-50%, -50%);
1025
- border-radius: 50%;
1026
- background: #04060a;
1027
- box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
1028
- }
1029
-
1030
- .status-wifi {
1031
- width: 15px;
1032
- height: 12px;
1033
- fill: currentColor;
1034
- color: #e9edf4;
1035
- }
1036
-
1037
- /* Home indicator. */
1038
- .frame[data-kind='native'] .viewport::after {
1039
- content: '';
1040
- position: absolute;
1041
- bottom: 8px;
1042
- left: 50%;
1043
- width: 88px;
1044
- height: 4px;
1045
- transform: translateX(-50%);
1046
- border-radius: 999px;
1047
- background: rgba(138, 146, 160, 0.55);
1048
- }
1049
-
1050
- /*
1051
- * The preview is never scrolled on its own: it shows everything it contains and
1052
- * the page scrolls as a whole. The flex column keeps a short mock filling
1053
- * the frame's minimum height without pinning a maximum.
1054
- */
1055
- .viewport {
1056
- position: relative;
1057
- display: flex;
1058
- flex-direction: column;
1059
- width: 100%;
1060
- min-height: var(--frame-min-height, 480px);
1061
- /* A preview is the product's screen, not the kit's chrome: it stays light in a dark theme. */
1062
- color-scheme: light;
1063
- background: #fff;
1064
- }
1065
-
1066
- /*
1067
- * The author's wrapper becomes the frame's filling layer: a one-cell grid makes
1068
- * its height definite, so a mock that asks for height:100% fills the frame
1069
- * instead of collapsing to its content.
1070
- */
1071
- /*
1072
- * The author's wrapper is a stretch row: a mock fills a short frame and grows
1073
- * the frame when its own content is taller. Stretching (rather than a
1074
- * percentage height) is what makes the fill reliable.
1075
- */
1076
- /* Only the viewport carries the minimum height; the wrapper grows to fill it. */
1077
- .viewport ::slotted(*) {
1078
- display: grid;
1079
- flex: 1 0 auto;
1080
- min-width: 0;
1081
- }
1082
-
1083
- .frame-placeholder {
1084
- position: absolute;
1085
- inset: 12px;
1086
- display: grid;
1087
- align-content: center;
1088
- justify-items: center;
1089
- gap: 8px;
1090
- padding: 12px;
1091
- text-align: center;
1092
- color: var(--dpk-ink-faint);
1093
- border: 1px dashed var(--dpk-rule-strong);
1094
- border-radius: var(--dpk-radius);
1095
- background: var(--dpk-dots), var(--dpk-paper-sunken);
1096
- }
1097
-
1098
- .frame-placeholder code {
1099
- padding: 3px 7px;
1100
- border: 1px solid var(--dpk-rule);
1101
- border-radius: var(--dpk-radius-xs);
1102
- background: var(--dpk-paper-raised);
1103
- font-family: var(--dpk-mono);
1104
- font-size: 10px;
1105
- }
1106
-
1107
- .parked {
1108
- display: none;
1109
- }
1110
- `,ue={kind:"off"},Jt=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking"}:ue;case"exit":return ue;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:""};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking"};default:return e}},Xt={width:300,height:300};class je extends ye{static{this.styles=[ye.styles,st,Kt]}#e=ue;#a=!1;#t=null;#o=[];#m=new lt(this);#p=!1;#i=null;#s=null;definitionFor(t){return Ne(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#c),window.addEventListener("resize",this.#n)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#c),window.removeEventListener("resize",this.#n)}renderRegions(t){const i=oe(this.locale),r=pe(t.state,t.navigation);return this.#o=r?.kind==="step"?de(r.step,t.navigation).shown.map(a=>a.id):[],{sidebar:Ye(t,i),main:Ue(t,i,{hasPreviewContent:a=>this.#T(a),maximized:this.#i,onToggleMaximize:()=>this.#h(this.#i===null),onMaximizedWheel:this.#S,uiComment:this.#g(t),canvasEvents:{click:this.#f,pointermove:this.#b,pointerleave:this.#w,scroll:this.#n}})}}updated(){super.updated(),this.#x();const t=this.#e;if(t.kind==="composing"&&!this.#o.includes(t.target.previewId)){this.#r({kind:"dismiss"});return}this.#E(),this.#u();const i=t.kind==="composing"&&!this.#a;if(this.#a=t.kind==="composing",t.kind!=="composing"||this.#t===null)return;const r=this.renderRoot.querySelector(".comment-pop");r&&(this.#m.open(r,this.#t,Xt,{placement:"right-start"}),i&&r.querySelector("textarea")?.focus({preventScroll:!0}))}#g(t){const i=this.#e,r=i.kind==="composing"?i.target:void 0,a=r?T(t.state,r.previewId)?.preview:void 0,o=r?xe(r):void 0;return{mode:i,pins:i.kind==="off"?[]:De(t.comments,this.#o),...r&&a?{targetLabel:Pe(a,r)}:{},notes:t.comments.filter(s=>s.target.type===z&&s.target.id===o).map(s=>ve(s)),composer:ct(this.locale),send:s=>this.#r(s),submit:s=>this.#y(s)}}#r(t){const i=Jt(this.#e,t);i!==this.#e&&(this.#e=i,i.kind!=="composing"&&(this.#t=null),this.requestUpdate())}#y(t){const i=this.#e;if(i.kind!=="composing")return;this.dispatch({type:nt,target:{type:z,id:xe(i.target)},payload:{body:t}}).ok&&this.#r({kind:"submitted"})}#l(t){const i=t.composedPath(),r=i.find(d=>d instanceof Element&&d.parentElement===this&&d.hasAttribute("data-preview-id")),a=r?.getAttribute("data-preview-id"),o=i[0];if(!r||!a||!(o instanceof Element)||!r.contains(o))return null;const s=Dt(o,r),n=Nt(s,r);return{element:s,target:{previewId:a,selector:n.selector,...n.text===void 0?{}:{text:n.text}}}}#f=t=>{if(this.#e.kind==="off")return;const i=this.#l(t);i&&(t.preventDefault(),t.stopPropagation(),this.#t=i.element,this.#r({kind:"pick",target:i.target}))};#b=t=>{if(this.#e.kind==="off")return;const i=this.#l(t);this.#d(".ui-hover",i?.element??null)};#w=()=>{this.#d(".ui-hover",null)};#c=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#r({kind:"exit"}):this.#h(!1))};#n=()=>{this.#e.kind!=="off"&&this.#u()};#u(){if(this.#e.kind==="off")return;this.#d(".ui-picked",this.#t);const t=this.renderRoot.querySelector(".canvas");if(t)for(const i of this.renderRoot.querySelectorAll(".ui-pin")){const r=this.#k(i.dataset.preview??""),o=(r?Mt(r,i.dataset.selector??""):null)?.getBoundingClientRect();if(!o||o.width===0&&o.height===0){i.hidden=!0;continue}const s=this.#v(t);i.hidden=!1,i.style.left=`${o.right-s.left}px`,i.style.top=`${o.top-s.top}px`}}#d(t,i){const r=this.renderRoot.querySelector(t),a=this.renderRoot.querySelector(".canvas");if(!r||!a)return;const o=i?.getBoundingClientRect();if(!o){r.hidden=!0;return}const s=this.#v(a);r.hidden=!1,r.style.left=`${o.left-s.left}px`,r.style.top=`${o.top-s.top}px`,r.style.width=`${o.width}px`,r.style.height=`${o.height}px`}#v(t){const i=t.getBoundingClientRect();return{left:i.left+t.clientLeft-t.scrollLeft,top:i.top+t.clientTop-t.scrollTop}}#k(t){return Array.from(this.children).find(i=>i.getAttribute("data-preview-id")===t)}#x(){if(this.#p||this.renderRoot.querySelector(".stage")===null)return;this.#p=!0;const t=this.derivation.state,i=[];for(const r of Array.from(this.children)){const a=r.getAttribute("data-preview-id");if(a!==null)for(const o of r.querySelectorAll("a, [data-dpk-navigate]")){const s=$t(t,{href:o.getAttribute("href"),navigate:o.getAttribute("data-dpk-navigate")});if(s===null)continue;const n=(o.textContent??"").replace(/\s+/g," ").trim().slice(0,40),d=o.getAttribute("data-dpk-navigate")??o.getAttribute("href")??"(no href)";i.push(` ${a}: <${o.tagName.toLowerCase()}> "${n}" \u2192 ${d} (${s})`)}}i.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: ${i.length} link(s) in the previews lead nowhere. Point each at the step it leads to (data-dpk-navigate="step=\u2026") or the user story it serves (data-dpk-navigate="story=\u2026"):
1111
- `+i.join(`
1112
- `))}#h(t){if(t===(this.#i!==null))return;const i=this.renderRoot.querySelector(".stage");this.#i=t?{height:i?.offsetHeight??0}:null,this.#s=null,t&&this.#e.kind==="composing"&&(ut(this.renderRoot.querySelector(".comment-pop")),this.#a=!1),this.requestUpdate()}#E(){const t=this.renderRoot.querySelector(".stage");if(!(this.#i===null||!t||typeof t.showPopover!="function")&&t!==this.#s){this.#s=t;try{t.showPopover()}catch{}}}#S=t=>{const i=this.renderRoot.querySelector(".canvas");(i===null||!t.composedPath().includes(i))&&t.preventDefault()};#T(t){return Array.from(this.querySelectorAll("[data-preview-id]")).some(i=>i.getAttribute("data-preview-id")===t)}}const Be=()=>{customElements.get("dpk-template-prototype")||customElements.define("dpk-template-prototype",je)},Zt=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePrototype:je,VIEWPORT_MIN_HEIGHT:We,VIEWPORT_WIDTH:ze,allStepIds:$e,applyPrototypeAction:Ie,definePrototypeElement:Be,describePrototypeAction:_e,emptyPrototypeBase:Se,findActivity:A,findPreview:T,findStep:k,findStory:x,flattenSteps:U,parsePrototypeBase:Ee,prototypeAction:G,prototypeActions:m,prototypeBaseSchema:ke,prototypeCommentTargets:Oe,prototypeDefinitionFor:Ne,prototypeMessages:oe,prototypePageHeading:Ce,prototypeTargetLabel:Re,prototypeTitle:le,renderFrame:ce,renderNav:Ye,renderStage:Ue,resolvePrototypeNavigation:Ve,serializePrototypeAction:Ae},Symbol.toStringTag,{value:"Module"}));export{Be as d,Zt as i};