dev-process-kit 0.4.2 → 0.4.4

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 (38) hide show
  1. package/README.md +1 -0
  2. package/dist/boards.js +1 -1
  3. package/dist/chunks/shared-B3ddPOb7.js +1 -0
  4. package/dist/chunks/shared-BEcs-9nd.js +6077 -0
  5. package/dist/chunks/{shared-CHQBlCl0.js → shared-BIODquqM.js} +4 -4
  6. package/dist/chunks/{shared-D2fmf6zb.js → shared-BZ0Y7lDS.js} +41 -41
  7. package/dist/chunks/{shared-CMWEqwI3.js → shared-BncKaYRX.js} +1 -1
  8. package/dist/chunks/{shared-D1ZujbZA.js → shared-BqjrIOYm.js} +54 -54
  9. package/dist/chunks/shared-CaQMHNzp.js +3 -0
  10. package/dist/chunks/shared-Cd0znWBB.js +3545 -0
  11. package/dist/chunks/shared-Cuc_13rI.js +7378 -0
  12. package/dist/chunks/shared-D2yn0bY8.js +1883 -0
  13. package/dist/chunks/{shared-4JaCIu01.js → shared-D5_ZJTgh.js} +152 -46
  14. package/dist/chunks/shared-DDIKBRRU.js +1 -0
  15. package/dist/chunks/{shared-D0_BoWj3.js → shared-DbfVyq_3.js} +18 -18
  16. package/dist/chunks/{shared-D80rPPNF.js → shared-Dha4GwGq.js} +3 -3
  17. package/dist/chunks/shared-GVsZCCAa.js +4954 -0
  18. package/dist/chunks/{shared-C-ujfGnT.js → shared-IlpAgOtF.js} +1 -1
  19. package/dist/chunks/{shared-SjAP9bK0.js → shared-M5nBQyzE.js} +4 -4
  20. package/dist/chunks/{shared-DErYmK9C.js → shared-lNnnWUPH.js} +14 -14
  21. package/dist/components.js +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/sync.js +1 -1
  24. package/dist/views/delegation-poker.js +1 -1
  25. package/dist/views/plain.js +1 -1
  26. package/dist/views/prototype.js +1 -1
  27. package/dist/views/slides.js +1 -1
  28. package/dist/views/task-board.js +1 -1
  29. package/dist/views/usm.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunks/shared-CJZKj_HI.js +0 -3
  32. package/dist/chunks/shared-CsLKVrK7.js +0 -6912
  33. package/dist/chunks/shared-DPD_cXES.js +0 -1883
  34. package/dist/chunks/shared-HkbNG84_.js +0 -1
  35. package/dist/chunks/shared-JOvfFoxb.js +0 -3645
  36. package/dist/chunks/shared-KHA87RsJ.js +0 -3360
  37. package/dist/chunks/shared-_0Ev6y6i.js +0 -5357
  38. package/dist/chunks/shared-lVXxL9i3.js +0 -1
@@ -1,3360 +0,0 @@
1
- import{ai as Mt,a5 as h,ag as d,L as ce,ar as K,_ as D,a7 as z,O as T,i as B,a4 as M,a8 as P,aB as hn,A as pe,aC as he,aD as un,aE as mn,al as U,aF as ue,a6 as j,a3 as gt,af as Tt,aw as me,u as At,g as gn,z as fn,av as Lt,aG as bn,aH as ft,aI as ge,ak as kn,ax as vn,t as xn,aJ as yn,R as wn,S as $n}from"./shared-_0Ev6y6i.js";import{o as _,r as Cn}from"./shared-D4PPk0Dk.js";import{e as Sn}from"./shared-C-ujfGnT.js";import{a as fe,c as En}from"./shared-D1ZujbZA.js";import{c as zn}from"./shared-D0_BoWj3.js";import{m as W,o as Rt,k as g,I as be,D as ke,x as nt,h as $,u as Dt,s as Pt,A as ve,j as v,B as Mn,n as bt,q as w,v as C,H as Ot,w as E,C as G,g as at,z as xe,l as V,y as ye,G as we,J as Tn,K as $e}from"./shared-CJZKj_HI.js";import{p as An,i as Ln,r as Rn,c as Dn,a as Ce,b as Se,d as Pn,e as On,f as qn,h as Ee,g as In,j as qt,s as Un,k as jn,l as Nn,m as Fn,n as Hn,t as _n}from"./shared-4JaCIu01.js";import{B as Wn,t as Bn,v as ze,i as Gn,k as Kn,j as Vn}from"./shared-DErYmK9C.js";import{d as Jn}from"./shared-CMWEqwI3.js";class it{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new Mt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#s=e,this.#i=s??null,this.#o=null,this.#a.requestUpdate()}close(){this.#e=null,this.#s=null,this.#i=null,this.#a.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#n!==this.#e;this.#n=this.#e,!(t===null||this.#s===null||this.#e===null)&&(this.#t.open(t,this.#s,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}render(t){const e=this.#e;if(e===null)return h;const s=An(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return d`${Ln(e,Rn(Dn(t.locale),s,a=>this.#d(e,t.submit,a)))}`}#d(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#a.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#a.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const kt=(n,t,e,s)=>{if(n===null)return null;const a=ce(n),i=t.find(o=>o.value===a);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(a,i.label)}]}},vt=.08,Me=1.8,Te=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...n.map(i=>i.x)),e=Math.min(...n.map(i=>i.y)),s=Math.max(...n.map(i=>i.x+i.width))-t,a=Math.max(...n.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-a*.1,width:s*1.2,height:a*1.2}},Ae=(n,t)=>n+t/12,Zn=(n,t)=>{if(n.length===0)return null;const e=Math.min(...n.map(a=>a.y)),s=n.filter(a=>a.y<e+t);return{x:Math.min(...s.map(a=>a.x)),y:e}},It=16,Xn=.8,xt=(n,t,e,s,a)=>n==="start"?It-Ae(t,e)*s:(a-e*s)/2-t*s,Le=(n,t,e,s,a="center")=>{if(t.width===0||t.height===0)return{...n,x:0,y:0};const i=(o,r,l,u)=>{const c=l*n.scale,m=u*Xn;if(c<=u){const k=xt(a,r,l,n.scale,u);return K(o,k-m,k+m)}return K(o,u-(r+l)*n.scale-m,-r*n.scale+m)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Yn=(n,t,e,s,a,i,o="center")=>{const r=Math.abs(i)>Math.abs(a);if(r&&t.height*n.scale<=s)return null;const l=Le({...n,x:n.x-a,y:n.y-i},t,e,s,o);return r&&l.y===n.y?null:l},Qn=n=>Math.exp(-n*.01),Re='button,[role="button"],a,input,textarea,select',Ut=(n,t,e)=>{for(const s of n.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},ta=n=>{const{canvas:t,world:e,onClearSelection:s,onView:a,align:i="center",sizeWorld:o=!0}=n;let r={x:0,y:0,width:0,height:0},l={x:0,y:0,scale:1};const u=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),c=()=>{const{width:p,height:f}=u();l=Le(l,r,p,f,i),e.style.transform=`translate(${l.x}px, ${l.y}px) scale(${l.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/l.scale)),e.style.setProperty("--dpk-zoom-scale",String(l.scale)),a?.(l)},m=()=>{const{width:p,height:f}=u(),x=r.width/1.2||1,y=r.height/1.2||1,S=K(Math.min((p-24)/x,(f-40)/y),vt,1);l={scale:S,x:xt(i,r.x,r.width,S,p),y:xt(i,r.y,r.height,S,f)},c()},k=p=>{const{width:f,height:x}=u(),y=Te([p]),S=y.width/1.2||1,R=y.height/1.2||1;l={...l,scale:K(Math.min((f-24)/S,(x-40)/R),vt,Me)},l={...l,x:(f-y.width*l.scale)/2-y.x*l.scale,y:(x-y.height*l.scale)/2-y.y*l.scale},c()},L=()=>{const{width:p}=u(),f=r.width/1.2||1,x=K((p-24)/f,vt,1);l={scale:x,x:(p-r.width*x)/2-r.x*x,y:16},c()},mt=p=>{const{width:f,height:x}=u(),y=(S,R,le,de)=>de!==void 0?It-de:R<=le?xt(i,S,R,1,le):It-Ae(S,R);l={scale:1,x:y(r.x,r.width,f,p?.x),y:y(r.y,r.height,x,p?.y)},c()},H=(p,f=u().width/2,x=u().height/2)=>{const y=l.scale,S=K(y*p,vt,Me);S!==y&&(l={scale:S,x:f-(f-l.x)*S/y,y:x-(x-l.y)*S/y},c())},tt=p=>{if(Ut(p,t,".diagram-zoom")!==null)return;const f=p.deltaMode===1?16:p.deltaMode===2?u().height:1;if(p.ctrlKey||p.metaKey){p.preventDefault();const R=t.getBoundingClientRect();H(Qn(p.deltaY),p.clientX-R.left,p.clientY-R.top);return}const{width:x,height:y}=u(),S=Yn(l,r,x,y,p.deltaX*f,p.deltaY*f,i);S!==null&&(p.preventDefault(),l=S,c())},q=new Map;let A=null,I=!1;const N=()=>{const p=[...q.values()],f=p[0];if(!f)return null;const x=p[1];return x?{x:(f.x+x.x)/2,y:(f.y+x.y)/2,distance:Math.hypot(x.x-f.x,x.y-f.y)}:{...f,distance:0}},et=p=>{q.size===0&&(I=!1);const f=Ut(p,t,Re);p.button!==0||p.pointerType!=="touch"&&f!==null||(q.set(p.pointerId,{x:p.clientX,y:p.clientY}),A=N(),f===null&&t.setPointerCapture(p.pointerId),p.pointerType!=="touch"&&f===null&&(p.preventDefault(),t.focus({preventScroll:!0})))},se=p=>{if(!q.has(p.pointerId)||A===null)return;q.set(p.pointerId,{x:p.clientX,y:p.clientY});const f=N();if(f===null)return;const x=f.x-A.x,y=f.y-A.y;if((Math.abs(x)+Math.abs(y)>1||Math.abs(f.distance-A.distance)>1)&&(I=!0),f.distance>0&&A.distance>0){const S=t.getBoundingClientRect();H(Math.pow(f.distance/A.distance,.45),A.x-S.left,A.y-S.top)}l={...l,x:l.x+x,y:l.y+y},c(),A=f,t.classList.toggle("is-panning",I)},st=p=>{q.delete(p.pointerId),A=N(),!(q.size>0)&&(t.classList.remove("is-panning"),p.type==="pointercancel"&&(I=!1))},ne=p=>{I&&(p.preventDefault(),p.stopPropagation()),st(p)},ae=p=>{if(I){p.preventDefault(),p.stopPropagation(),I=!1;return}!(p.target instanceof Element)||Ut(p,t,Re)!==null||s()},ie=p=>{if(p.target!==t)return;const f=30;if(p.key==="+"||p.key==="=")H(1.1);else if(p.key==="-")H(1/1.1);else if(p.key==="0")m();else if(p.key==="Escape"){if(s()===!1)return}else if(p.key==="ArrowLeft"||p.key==="ArrowRight"||p.key==="ArrowUp"||p.key==="ArrowDown")l={...l,x:l.x+(p.key==="ArrowLeft"?f:p.key==="ArrowRight"?-f:0),y:l.y+(p.key==="ArrowUp"?f:p.key==="ArrowDown"?-f:0)},c();else return;p.preventDefault()},re=p=>{const f=p.target instanceof HTMLElement?p.target:null;if(f===null||!p.composedPath().includes(e))return;const x=f.getBoundingClientRect(),y=t.getBoundingClientRect();let S=0,R=0;x.left<y.left+12?S=y.left+12-x.left:x.right>y.right-12&&(S=y.right-12-x.right),x.top<y.top+12?R=y.top+12-x.top:x.bottom>y.bottom-40&&(R=y.bottom-40-x.bottom),!(S===0&&R===0)&&(l={...l,x:l.x+S,y:l.y+R},c())};t.addEventListener("wheel",tt,{passive:!1}),t.addEventListener("pointerdown",et),t.addEventListener("pointermove",se),t.addEventListener("pointerup",ne),t.addEventListener("pointercancel",st),t.addEventListener("lostpointercapture",st),t.addEventListener("click",ae,!0),t.addEventListener("keydown",ie),t.addEventListener("focusin",re);const oe=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>c());return oe?.observe(t),{setContent(p){r=Te(p.width===0&&p.height===0?[]:[p]),o&&(e.style.width=`${p.width}px`,e.style.height=`${p.height}px`),c()},apply:c,fit:m,fitTo:k,fitWidth:L,reset:mt,zoom:H,view:()=>({...l}),destroy(){oe?.disconnect(),t.removeEventListener("wheel",tt),t.removeEventListener("pointerdown",et),t.removeEventListener("pointermove",se),t.removeEventListener("pointerup",ne),t.removeEventListener("pointercancel",st),t.removeEventListener("lostpointercapture",st),t.removeEventListener("click",ae,!0),t.removeEventListener("keydown",ie),t.removeEventListener("focusin",re)}}},ea=["fit","fit-width","actual","none"];class sa{#a;#t=null;#e=null;#n=!1;constructor(t,e){this.#a=e,t.addController(this)}hostDisconnected(){this.detach()}get attached(){return this.#t!==null}get view(){return this.#t?.view()??{x:0,y:0,scale:1}}attach(){this.detach();const t=this.#a.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=ta({canvas:e,world:s,align:this.#a.align(),sizeWorld:!1,onClearSelection:()=>this.#a.onDismiss(),onView:a=>this.#a.onView(a)}),this.#e=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.sync()),this.#e?.observe(s),this.sync()}detach(){this.#t?.destroy(),this.#t=null,this.#e?.disconnect(),this.#e=null}sync(){const t=this.#t,e=this.#a.elements()?.world;if(t===null||e===void 0)return;const s=this.#a.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const a=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:a,height:i}),!this.#n&&a>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#n=!0;const e=this.#a.initial(),s=ea.includes(e)?e:"fit";s==="fit"?t.fit():s==="fit-width"?t.fitWidth():s==="actual"&&t.reset()}fit(){this.#t?.fit()}fitWidth(){this.#t?.fitWidth()}fitTo(t){this.#t?.fitTo(t)}reset(t){this.#t?.reset(t)}zoom(t){this.#t?.zoom(t)}apply(){this.#t?.apply()}}const na=(n,t,e)=>n.some(s=>Math.abs(t)>Math.abs(e)?s.overflowX!=="auto"&&s.overflowX!=="scroll"||s.scrollWidth<=s.clientWidth?!1:t>0?s.scrollLeft+s.clientWidth<s.scrollWidth-1:t<0&&s.scrollLeft>0:s.overflowY!=="auto"&&s.overflowY!=="scroll"||s.scrollHeight<=s.clientHeight?!1:e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:e<0&&s.scrollTop>0),De=160,jt=(n,t,e=De)=>Math.max(e,Math.round(n+t)),aa=(n,t,e,s=De)=>{const a=e?96:24;return t==="ArrowDown"?jt(n,a,s):t==="ArrowUp"?jt(n,-a,s):null},Pe={kind:"idle"};class ia{constructor(t,e){this.#e=null,this.#n=Pe,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const a=s.currentTarget;a instanceof Element&&a.setPointerCapture(s.pointerId),this.#n={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#a.requestUpdate()},pointermove:s=>{const a=this.#n;a.kind!=="dragging"||a.pointerId!==s.pointerId||this.#s(jt(a.startHeight,s.clientY-a.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const a=aa(this.#e??this.#t(),s.key,s.shiftKey);a!==null&&(s.preventDefault(),this.#s(a))},dblclick:()=>this.#s(null)},this.#a=t,this.#t=e,t.addController(this)}#a;#t;#e;#n;hostConnected(){}get height(){return this.#e}get dragging(){return this.#n.kind==="dragging"}#s(t){t!==this.#e&&(this.#e=t,this.#a.requestUpdate())}#i(t){const e=this.#n;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#n=Pe,this.#a.requestUpdate())}}const ra=D({en:{maximize:"Maximize",restore:"Restore size",controls:"View controls",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",canvas:"Canvas. Arrow keys pan, plus and minus zoom, 0 fits the view.",resize:"Resize the panel",resizeHint:"Drag or use the up and down arrows to resize. Double-click restores the height."},ja:{maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",controls:"\u8868\u793A\u306E\u64CD\u4F5C",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",canvas:"\u30AD\u30E3\u30F3\u30D0\u30B9\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",resize:"\u30D1\u30CD\u30EB\u306E\u9AD8\u3055\u3092\u5909\u3048\u308B",resizeHint:"\u30C9\u30E9\u30C3\u30B0\u3001\u307E\u305F\u306F\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9AD8\u3055\u3092\u5909\u3048\u308B\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306E\u9AD8\u3055\u306B\u623B\u3059\u3002"}});class Oe extends z{static{this.styles=[T,B,M`
2
- :host {
3
- display: block;
4
- color: var(--dpk-ink);
5
- /*
6
- * "align" is a reader-state attribute (fit alignment, "center" by
7
- * default), not markup; the UA stylesheet still maps the legacy
8
- * "align" content attribute to text-align through a bare
9
- * [align=center] selector that matches any element, tag name
10
- * aside. With no author rule of our own in the way, that is the
11
- * only declaration text-align gets, so it wins and every slotted
12
- * cell that does not set its own text-align inherits "center".
13
- * Inheriting here instead restores ordinary inheritance from
14
- * whatever this panel sits in.
15
- */
16
- text-align: inherit;
17
- }
18
-
19
- .panel {
20
- display: flex;
21
- flex-direction: column;
22
- /* Auto by default; a canvas inside needs a definite height to fill. */
23
- height: var(--dpk-dialog-panel-height, auto);
24
- min-height: var(--dpk-dialog-panel-min-height, 0);
25
- border: 1px solid var(--dpk-rule);
26
- border-radius: var(--dpk-radius-lg);
27
- background: var(--dpk-paper-raised);
28
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
29
- overflow: hidden;
30
- /*
31
- * The panel arrives as one surface: a short rise and fade over the slow
32
- * step, because it is the largest thing a page draws. It is a
33
- * transform only, so nothing beside it is laid out again.
34
- */
35
- animation: dpk-rise-in var(--dpk-dur-slow) var(--dpk-ease-out);
36
- }
37
-
38
- /*
39
- * Maximized: the panel covers the viewport. It is also a manual popover in
40
- * the top layer, so the UA popover box (fit-content, margin, border,
41
- * padding) is reset here. A resized panel leaves an inline height
42
- * behind, which only !important overrides.
43
- */
44
- .panel.is-maximized {
45
- position: fixed;
46
- /*
47
- * Not inset: 0 — the kit's own header sits above this panel in the
48
- * document, but this panel is a top-layer popover, which paints over
49
- * everything regardless of position in the document or z-index. The
50
- * header's real height (set by the page/template root as
51
- * --dpk-header-height; 0 with no such ancestor) keeps this panel's
52
- * box clear of it instead, so the header and its actions stay put
53
- * and clickable.
54
- */
55
- top: var(--dpk-header-height, 0px);
56
- right: 0;
57
- bottom: 0;
58
- left: 0;
59
- z-index: 2147483000;
60
- width: auto !important;
61
- height: auto !important;
62
- max-width: none;
63
- max-height: none;
64
- margin: 0;
65
- padding: 0;
66
- border: 0;
67
- border-radius: 0;
68
- color: var(--dpk-ink);
69
- background:
70
- radial-gradient(
71
- ellipse 900px 400px at 0% 0%,
72
- color-mix(in srgb, var(--dpk-accent) 4%, transparent),
73
- transparent 70%
74
- ),
75
- var(--dpk-paper-raised);
76
- box-shadow: none;
77
- /* Above the dock in the top layer, so nothing to clear. */
78
- --dpk-dock-overlap: 0px;
79
- /* Nothing behind a maximized panel is visible: no axis should chain past it. */
80
- overscroll-behavior: contain;
81
- /*
82
- * Maximizing is the same panel taking the viewport rather than a new
83
- * surface: it settles out of just-under-full size instead of rising,
84
- * which would read as a bounce. Restoring drops the class, and the
85
- * base '.panel' entrance above plays again — the way back out.
86
- */
87
- animation: dpk-scale-in var(--dpk-dur) var(--dpk-ease-out);
88
- }
89
-
90
- header {
91
- display: flex;
92
- align-items: center;
93
- gap: 10px;
94
- flex-wrap: wrap;
95
- flex-shrink: 0;
96
- min-height: 44px;
97
- padding: 8px 14px;
98
- border-bottom: 1px solid var(--dpk-rule);
99
- background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
100
- box-shadow: 0 1px 0 var(--dpk-highlight) inset;
101
- }
102
-
103
- .title {
104
- font-family: var(--dpk-display);
105
- font-size: 12.5px;
106
- font-weight: 660;
107
- letter-spacing: -0.015em;
108
- color: var(--dpk-ink);
109
- }
110
-
111
- /* A long heading or subject elides (the full text is its tooltip) instead of pushing the actions off. */
112
- .title,
113
- .subject {
114
- min-width: 0;
115
- max-width: 100%;
116
- overflow: hidden;
117
- text-overflow: ellipsis;
118
- white-space: nowrap;
119
- }
120
-
121
- .subject {
122
- font-size: 11px;
123
- color: var(--dpk-ink-soft);
124
- padding-left: 10px;
125
- border-left: 1px solid var(--dpk-rule-strong);
126
- }
127
-
128
- .actions {
129
- display: flex;
130
- align-items: center;
131
- gap: 6px;
132
- margin-left: auto;
133
- flex-wrap: wrap;
134
- }
135
-
136
- /* The body and the control menu floating over it. */
137
- .frame {
138
- position: relative;
139
- display: flex;
140
- flex-direction: column;
141
- flex: 1 1 auto;
142
- min-height: 0;
143
- }
144
-
145
- .body {
146
- display: flex;
147
- flex-direction: column;
148
- flex: 1;
149
- min-height: 0;
150
- padding: var(--dpk-dialog-panel-padding, 16px);
151
- overflow: auto;
152
- /*
153
- * The -x axis only: an edge swipe must never fall through to the
154
- * browser's back/forward navigation, but the vertical axis still
155
- * chains to the page so it keeps scrolling past an inline
156
- * (non-maximized) panel.
157
- */
158
- overscroll-behavior-x: contain;
159
- }
160
-
161
- :host([flush]) .body {
162
- padding: 0;
163
- overflow: hidden;
164
- }
165
-
166
- /* Scrolled to the end, the last of the body clears the control menu. */
167
- .frame[data-controls] > .body {
168
- padding-bottom: 56px;
169
- }
170
-
171
- /* A canvas: as tall as --dpk-canvas-height, or what is left of a sized panel. */
172
- :host([canvas]) .frame {
173
- flex: 1 1 var(--dpk-canvas-height, 420px);
174
- min-height: 220px;
175
- }
176
-
177
- .canvas {
178
- padding: 0;
179
- position: absolute;
180
- inset: 0;
181
- overflow: hidden;
182
- /* Same reasoning as .body: contain the horizontal edge only. */
183
- overscroll-behavior-x: contain;
184
- touch-action: none;
185
- cursor: grab;
186
- background: var(--dpk-dots), var(--dpk-paper-sunken);
187
- }
188
-
189
- .canvas:focus-visible {
190
- outline: none;
191
- box-shadow: inset var(--dpk-focus);
192
- }
193
-
194
- .canvas.is-panning {
195
- cursor: grabbing;
196
- }
197
-
198
- .world {
199
- position: absolute;
200
- inset: 0 auto auto 0;
201
- /* Content that lays out in flow measures itself; a given content box overrides this inline. */
202
- width: max-content;
203
- transform-origin: 0 0;
204
- }
205
-
206
- /* The control menu: a floating bar at the bottom, in the manner of a whiteboard's. */
207
- .controls {
208
- position: absolute;
209
- right: 12px;
210
- bottom: calc(12px + var(--dpk-dock-overlap, 0px));
211
- z-index: 4;
212
- display: flex;
213
- align-items: center;
214
- gap: 2px;
215
- padding: 3px;
216
- border: 1px solid var(--dpk-rule-strong);
217
- border-radius: var(--dpk-radius);
218
- background: var(--dpk-glass);
219
- backdrop-filter: blur(12px);
220
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
221
- /*
222
- * The menu comes up a step after the panel it floats on, so the eye
223
- * lands on the content first and the tools arrive once it is there.
224
- * Fade only: the panel's own rise already moves it.
225
- */
226
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
227
- animation-delay: var(--dpk-stagger);
228
- }
229
-
230
- .controls[hidden] {
231
- display: none;
232
- }
233
-
234
- /*
235
- * A corner twin of the bottom maximize control, shown only while
236
- * maximized: on a tall panel the bottom one can be a long pointer trip
237
- * away, and a top-right "exit full screen" is where readers expect one.
238
- * The bottom control stays too, for continuity with the non-maximized menu.
239
- */
240
- .exit-fullscreen {
241
- position: absolute;
242
- top: 12px;
243
- right: 12px;
244
- z-index: 5;
245
- display: inline-flex;
246
- align-items: center;
247
- justify-content: center;
248
- width: 30px;
249
- height: 30px;
250
- border: 1px solid var(--dpk-rule-strong);
251
- border-radius: var(--dpk-radius);
252
- background: var(--dpk-glass);
253
- backdrop-filter: blur(12px);
254
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
255
- color: var(--dpk-ink-soft);
256
- cursor: pointer;
257
- transition:
258
- background var(--dpk-dur-fast) var(--dpk-ease),
259
- color var(--dpk-dur-fast) var(--dpk-ease);
260
- /* It exists only while maximized, so it fades in with the transition. */
261
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease-out) backwards;
262
- animation-delay: calc(var(--dpk-stagger) * 2);
263
- }
264
-
265
- .exit-fullscreen svg {
266
- width: 14px;
267
- height: 14px;
268
- }
269
-
270
- .exit-fullscreen:hover {
271
- background: var(--dpk-paper-inset);
272
- color: var(--dpk-ink);
273
- }
274
-
275
- .exit-fullscreen:focus-visible {
276
- outline: none;
277
- box-shadow: var(--dpk-focus);
278
- }
279
-
280
- /*
281
- * Maximized, or with no maximize button to offer at all (a full-page
282
- * board's frame, which never sets "maximizable" — see the diagrams'
283
- * own "frameControls"), the menu has the whole viewport width to sit
284
- * in, so it moves off the corner and centers at the bottom instead.
285
- */
286
- .panel.is-maximized .controls,
287
- :host(:not([maximizable])) .controls {
288
- right: auto;
289
- left: 50%;
290
- transform: translateX(-50%);
291
- }
292
-
293
- .controls ::slotted(*) {
294
- flex: none;
295
- }
296
-
297
- .controls button,
298
- .grip {
299
- display: inline-flex;
300
- align-items: center;
301
- justify-content: center;
302
- min-width: 28px;
303
- height: 28px;
304
- padding: 0 7px;
305
- border: 0;
306
- border-radius: var(--dpk-radius-sm);
307
- background: transparent;
308
- color: var(--dpk-ink-soft);
309
- font-size: 11px;
310
- cursor: pointer;
311
- transition:
312
- background var(--dpk-dur-fast) var(--dpk-ease),
313
- color var(--dpk-dur-fast) var(--dpk-ease);
314
- }
315
-
316
- .controls button svg,
317
- .grip svg {
318
- width: 13px;
319
- height: 13px;
320
- }
321
-
322
- .controls button:hover,
323
- .grip:hover {
324
- background: var(--dpk-paper-inset);
325
- color: var(--dpk-ink);
326
- }
327
-
328
- .controls button:focus-visible,
329
- .grip:focus-visible {
330
- outline: none;
331
- box-shadow: var(--dpk-focus);
332
- }
333
-
334
- .controls button[aria-pressed='true'] {
335
- color: var(--dpk-accent);
336
- }
337
-
338
- .zoom-value {
339
- min-width: 46px;
340
- font-family: var(--dpk-mono);
341
- font-variant-numeric: tabular-nums;
342
- }
343
-
344
- .separator {
345
- width: 1px;
346
- height: 18px;
347
- margin: 0 3px;
348
- background: var(--dpk-rule);
349
- }
350
-
351
- .grip {
352
- cursor: ns-resize;
353
- touch-action: none;
354
- }
355
-
356
- .panel[data-resizing] {
357
- user-select: none;
358
- cursor: ns-resize;
359
- }
360
-
361
- .panel[data-resizing] .frame {
362
- pointer-events: none;
363
- }
364
-
365
- @media (max-width: 700px) {
366
- .subject {
367
- display: none;
368
- }
369
- }
370
- `]}static{this.properties={heading:{type:String},subject:{type:String},maximizable:{type:Boolean,reflect:!0},maximized:{type:Boolean,reflect:!0},resizable:{type:Boolean,reflect:!0},canvas:{type:Boolean,reflect:!0},contentWidth:{type:Number,attribute:"content-width"},contentHeight:{type:Number,attribute:"content-height"},initial:{type:String},align:{type:String},fitMode:{type:String,attribute:"fit-mode"},label:{type:String}}}#a=new P(this);#t=new sa(this,{elements:()=>{const t=this.renderRoot.querySelector(".canvas"),e=this.renderRoot.querySelector(".world");return this.canvas&&t&&e?{canvas:t,world:e}:null},align:()=>this.align,initial:()=>this.initial,contentSize:()=>this.contentWidth!==null&&this.contentHeight!==null?{width:this.contentWidth,height:this.contentHeight}:null,onDismiss:()=>!this.dispatchEvent(new CustomEvent("dpk-canvas-dismiss",{bubbles:!0,composed:!0,cancelable:!0})),onView:t=>{const e=this.renderRoot.querySelector(".zoom-value");e&&(e.textContent=oa(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new ia(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#n=0;#s=!1;constructor(){super(),this.heading=null,this.subject=null,this.maximizable=!1,this.maximized=!1,this.resizable=!1,this.canvas=!1,this.contentWidth=null,this.contentHeight=null,this.initial="fit",this.align="center",this.fitMode="all",this.label=null,this.addEventListener("keydown",this.#x),this.addEventListener("wheel",this.#f,{passive:!1})}get view(){return this.#t.view}fit(){this.#t.fit()}fitWidth(){this.#t.fitWidth()}fitTo(t){this.#t.fitTo(t)}reset(t){this.#t.reset(t)}zoom(t){this.#t.zoom(t)}apply(){this.#t.apply()}resetView(){this.#t.open()}willUpdate(t){t.has("maximized")&&this.maximized&&(this.#n=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#u(),t.has("canvas")&&this.canvas!==this.#t.attached||t.has("align")&&t.get("align")!==void 0&&this.canvas?this.canvas?this.#t.attach():this.#t.detach():(t.has("contentWidth")||t.has("contentHeight"))&&this.#t.sync()}render(){this.#s=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#s,e=this.#e.height;return d`
371
- ${this.maximized?d`<div class="placeholder" style="height:${this.#n}px"></div>`:h}
372
- <section
373
- class=${this.maximized?"panel is-maximized":"panel"}
374
- part="panel"
375
- popover=${this.maximized?"manual":h}
376
- style=${e===null||!this.resizable?h:`height: ${e}px`}
377
- ?data-resizing=${this.#e.dragging}
378
- >
379
- <header part="header">
380
- <slot name="heading">
381
- ${this.heading?d`<span class="title" title=${this.heading}>${this.heading}</span>`:h}
382
- ${this.subject?d`<span class="subject" title=${this.subject}>${this.subject}</span>`:h}
383
- </slot>
384
- <div class="actions"><slot name="actions"></slot></div>
385
- </header>
386
- <slot name="toolbar"></slot>
387
- <div class="frame" ?data-controls=${t&&!this.canvas}>
388
- ${this.canvas?this.#r():d`<div class="body" part="body"><slot></slot></div>`}
389
- ${this.#o(t)}
390
- ${this.maximized&&this.maximizable?this.#p():h}
391
- </div>
392
- <slot name="footer"></slot>
393
- </section>
394
- `}get#i(){return ra(this.#a.locale)}#r(){return d`<div class="body canvas" part="body canvas" tabindex="0" aria-label=${this.label??this.#i.canvas}>
395
- <div class="world" part="world"><slot></slot></div>
396
- <slot name="overlay"></slot>
397
- </div>`}#o(t){const e=this.#i,s=[this.canvas?this.#d():null,this.maximizable?this.#c():null,this.resizable&&!this.maximized?this.#m():null].filter(a=>a!==null);return d`<div class="controls" part="controls" role="toolbar" aria-label=${e.controls} ?hidden=${!t}>
398
- <slot name="controls" @slotchange=${this.#h}></slot>
399
- ${s.map((a,i)=>d`${i>0||this.#s?d`<span class="separator"></span>`:h}${a}`)}
400
- </div>`}#d(){const t=this.#i;return d`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
401
- ${hn()}
402
- </button>
403
- <button
404
- type="button"
405
- class="zoom-value"
406
- title=${t.fit}
407
- aria-label=${t.fit}
408
- @click=${()=>this.fitMode==="width"?this.fitWidth():this.fit()}
409
- >
410
- 100%
411
- </button>
412
- <button type="button" aria-label=${t.zoomIn} title=${t.zoomIn} @click=${()=>this.zoom(1.1)}>
413
- ${pe()}
414
- </button>`}#c(){const t=this.maximized?this.#i.restore:this.#i.maximize;return d`<button
415
- type="button"
416
- class="maximize"
417
- aria-label=${t}
418
- title=${t}
419
- aria-pressed=${this.maximized?"true":"false"}
420
- @click=${()=>this.#l(!this.maximized)}
421
- >
422
- ${this.maximized?he():un()}
423
- </button>`}#p(){const t=this.#i.restore;return d`<button
424
- type="button"
425
- class="exit-fullscreen"
426
- aria-label=${t}
427
- title=${t}
428
- @click=${()=>this.#l(!1)}
429
- >
430
- ${he()}
431
- </button>`}#m(){const t=this.#i,e=this.#e.handlers;return d`<div
432
- class="grip"
433
- part="grip"
434
- role="separator"
435
- tabindex="0"
436
- aria-orientation="horizontal"
437
- aria-label=${t.resize}
438
- title=${t.resizeHint}
439
- @pointerdown=${e.pointerdown}
440
- @pointermove=${e.pointermove}
441
- @pointerup=${e.pointerup}
442
- @pointercancel=${e.pointercancel}
443
- @keydown=${e.keydown}
444
- @dblclick=${e.dblclick}
445
- >
446
- ${mn()}
447
- </div>`}#h=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#s&&this.requestUpdate()};#l(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#u(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#f=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(a=>{if(!(a instanceof Element))return[];const{overflowX:i,overflowY:o}=getComputedStyle(a);return[{overflowX:i,scrollLeft:a.scrollLeft,scrollWidth:a.scrollWidth,clientWidth:a.clientWidth,overflowY:o,scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}]});na(s,t.deltaX,t.deltaY)||t.preventDefault()};#x=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#l(!1))}}const oa=n=>`${Math.round(n.scale*100)}%`,qe=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",Oe)},la=(n,t)=>n.active.includes(t)?{...n,active:n.active.filter(e=>e!==t)}:n.match==="single"?{...n,active:[t]}:{...n,active:[...n.active,t]},da=(n,t)=>({match:t,active:t==="single"&&n.active.length>1?n.active.slice(-1):n.active}),ca=n=>({...n,active:[]}),pa=n=>{const t=new Map;for(const e of n)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},ha={nodes:new Map,edges:new Set},Ie=(n,t,e,s)=>{const a=new Map,i=new Set,o=[{id:t,depth:0}],r=new Set([t]);for(const l of o)if(!(!s&&l.depth>=1))for(const u of n){const c=e==="outgoing"?u.from:u.to,m=e==="outgoing"?u.to:u.from;c===l.id&&(i.add(u.id),!r.has(m)&&(r.add(m),a.set(m,l.depth+1),o.push({id:m,depth:l.depth+1})))}return{nodes:a,edges:i}},ua=(n,t)=>{const e=new Map(n.map(i=>[i,Ie(t,i,"outgoing",!0).nodes])),s=new Set,a=[];for(const i of n){if(s.has(i))continue;const o=n.filter(r=>r===i||e.get(i)?.has(r)===!0&&e.get(r)?.has(i)===!0);for(const r of o)s.add(r);(o.length>1||t.some(r=>r.from===i&&r.to===i))&&a.push(o)}return a},ma=n=>new Map(n.flatMap((t,e)=>t.map(s=>[s,e]))),ga=(n,t)=>t.get(n.from)===t.get(n.to)&&t.has(n.from),fa=(n,t,e,s)=>{const a=t!==null&&t.kind===e&&t.id===n,i=e==="node"?s.nodes.has(n):s.edges.has(n),o=e==="node"?s.nodes.get(n)??null:null;return{selected:a,related:i&&!a,dimmed:t!==null&&!a&&!i,depth:o}},ba=(...n)=>n.filter(t=>typeof t=="string"&&t!=="").join(" "),ka=n=>{const t=n[0]??{x:0,y:0},e=n.at(-1)??t;if(n.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(n.length===4){const r=n[1]??t,l=n[2]??e;return{x:(r.x+l.x)/2,y:(r.y+l.y)/2}}let s=0,a=-1;for(let r=0;r+1<n.length;r++){const l=n[r],u=n[r+1],c=Math.abs(u.x-l.x)+Math.abs(u.y-l.y);c>a&&(a=c,s=r)}const i=n[s]??t,o=n[s+1]??e;return{x:(i.x+o.x)/2,y:(i.y+o.y)/2}},va=D({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear"},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664"}}),xa=["single","all","any"],Ue=n=>n.startsWith(Wn),ya=n=>{const t=new Set,e=n.flatMap(s=>{const a=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return a.tag===""||t.has(a.tag)?[]:(t.add(a.tag),[a])});return[...e.filter(s=>Ue(s.tag)),...e.filter(s=>!Ue(s.tag))]},wa=ve([v(),Rt({tag:v(),count:Mn(bt())})]),$a=Rt({tags:$(Dt()),active:g(be(ke($(Dt())),null)),match:g(be(ke(nt(xa)),null))}),je=n=>{const t=W($a,Array.isArray(n)?{tags:n}:n),e=t.tags.flatMap(a=>{const i=Pt(wa,a);return i.success?[i.output]:[]}),s=t.active?.filter(a=>typeof a=="string")??null;return{tags:e,active:s,match:t.match??null}},Ca=[["single","Single"],["all","AND"],["any","OR"]];class Ne extends z{static{this.styles=[T,M`
448
- :host {
449
- display: block;
450
- flex-shrink: 0;
451
- }
452
-
453
- .diagram-tags {
454
- display: flex;
455
- align-items: center;
456
- gap: 5px;
457
- flex-wrap: wrap;
458
- padding: 7px 12px;
459
- border-bottom: 1px solid var(--dpk-rule);
460
- background: var(--dpk-paper);
461
- }
462
-
463
- :host([bare]) .diagram-tags {
464
- padding: 0;
465
- border-bottom: 0;
466
- background: none;
467
- }
468
-
469
- .diagram-match {
470
- display: flex;
471
- gap: 2px;
472
- padding: 3px;
473
- margin-right: 6px;
474
- border: 1px solid var(--dpk-rule);
475
- border-radius: var(--dpk-radius-sm);
476
- background: var(--dpk-paper-sunken);
477
- box-shadow: inset 0 1px 2px var(--dpk-shade-1);
478
- }
479
-
480
- .diagram-match button {
481
- border: 0;
482
- border-radius: var(--dpk-radius-xs);
483
- padding: 4px 8px;
484
- background: transparent;
485
- color: var(--dpk-ink-soft);
486
- font-size: 11px;
487
- font-weight: 600;
488
- letter-spacing: 0.01em;
489
- cursor: pointer;
490
- transition:
491
- background 160ms var(--dpk-ease),
492
- color 160ms var(--dpk-ease),
493
- box-shadow 160ms var(--dpk-ease);
494
- }
495
-
496
- .diagram-match button:hover[aria-pressed='false'] {
497
- color: var(--dpk-ink);
498
- }
499
-
500
- .diagram-match button[aria-pressed='true'] {
501
- background: var(--dpk-paper-raised);
502
- color: var(--dpk-ink);
503
- font-weight: 650;
504
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
505
- }
506
-
507
- .dpk-tag {
508
- display: inline-flex;
509
- align-items: center;
510
- gap: 5px;
511
- max-width: 100%;
512
- padding: 4px 9px;
513
- border: 1px solid transparent;
514
- border-radius: var(--dpk-radius-xs);
515
- background: var(--dpk-paper-inset);
516
- color: var(--dpk-ink-soft);
517
- font-size: 11px;
518
- cursor: pointer;
519
- transition:
520
- background 140ms var(--dpk-ease),
521
- color 140ms var(--dpk-ease),
522
- border-color 140ms var(--dpk-ease),
523
- box-shadow 140ms var(--dpk-ease);
524
- }
525
-
526
- .dpk-tag:hover {
527
- background: var(--dpk-paper-sunken);
528
- color: var(--dpk-ink);
529
- }
530
-
531
- .dpk-tag[aria-pressed='true'] {
532
- border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
533
- background: var(--dpk-blue-soft);
534
- color: color-mix(in srgb, var(--dpk-blue) 78%, var(--dpk-ink));
535
- font-weight: 600;
536
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
537
- }
538
-
539
- .dpk-tag-name {
540
- min-width: 0;
541
- overflow: hidden;
542
- text-overflow: ellipsis;
543
- white-space: nowrap;
544
- }
545
-
546
- .dpk-tag-count {
547
- flex: none;
548
- font-family: var(--dpk-mono);
549
- font-size: 11px;
550
- font-variant-numeric: tabular-nums;
551
- }
552
-
553
- .dpk-tag-clear {
554
- border: 0;
555
- background: none;
556
- padding: 4px 6px;
557
- color: var(--dpk-ink-soft);
558
- font-size: 11px;
559
- cursor: pointer;
560
- }
561
-
562
- button:focus-visible {
563
- outline: none;
564
- box-shadow: var(--dpk-focus);
565
- }
566
- `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#a=new P(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=_(this,je,t=>{if(!t.ok){console.warn(`[dev-process-kit] ${this.localName}: ${t.error}`);return}this.tags=t.value.tags,t.value.active!==null&&(this.active=t.value.active),t.value.match!==null&&(this.match=t.value.match)})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}passes(t){return Bn(t,this.#n)}render(){const t=ya(this.tags);if(t.length===0)return h;const e=this.#e;return d`
567
- <div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
568
- <div class="diagram-match" role="group" aria-label=${e.tagMatch}>
569
- ${Ca.map(([s,a])=>d`
570
- <button
571
- type="button"
572
- data-match=${s}
573
- aria-pressed=${this.match===s?"true":"false"}
574
- @click=${()=>this.#s(da(this.#n,s))}
575
- >
576
- ${a}
577
- </button>
578
- `)}
579
- </div>
580
- ${U(t,s=>s.tag,s=>d`
581
- <button
582
- type="button"
583
- class="dpk-tag"
584
- data-tag=${s.tag}
585
- aria-pressed=${this.active.includes(s.tag)?"true":"false"}
586
- @click=${()=>this.#s(la(this.#n,s.tag))}
587
- >
588
- <span class="dpk-tag-name" title=${s.tag}>${s.tag}</span>${s.count===null?h:d`<span class="dpk-tag-count">${s.count}</span>`}
589
- </button>
590
- `)}
591
- ${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(ca(this.#n))}>
592
- ${e.clearTags}
593
- </button>`:h}
594
- </div>
595
- `}get#e(){return va(this.#a.locale)}get#n(){return{active:this.active,match:this.match}}#s(t){this.active=t.active,this.match=t.match,this.dispatchEvent(new CustomEvent("dpk-tag-filter-change",{detail:{active:t.active,match:t.match},bubbles:!0,composed:!0}))}}const Fe=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",Ne)},He=Symbol.for("dev-process-kit:atom-styles"),_e=()=>{if(typeof document>"u"||Reflect.get(document,He)===!0)return;Reflect.set(document,He,!0),Sn();const n=[ue,fe].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(n.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${ue.cssText}
596
- ${fe.cssText}`,document.head.append(t)},Sa=D({en:{aria:"Line chart",empty:"No data to plot",invalid:n=>`Invalid chart data: ${n}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${n}`}}),Nt=["blue","green","amber","violet","accent","ink-faint"],We=w({x:C(v(),E(1)),y:C(bt(),Ot())}),Ea=w({id:G,label:C(v(),E(1)),points:$(We),tone:g(nt(Nt),"blue"),area:g(at(),!1)}),za=w({id:G,label:C(v(),E(1)),points:$(We),tone:g(nt(Nt),"ink-faint"),dashed:g(at(),!0)}),Ma=w({x:C(v(),E(1)),label:C(v(),E(1)),tone:g(nt(Nt),"accent")}),Be=w({label:g(v()),min:g(C(bt(),Ot())),max:g(C(bt(),Ot()))}),Ta=w({title:g(v(),""),caption:g(v(),""),series:g($(Ea),[]),guides:g($(za),[]),marks:g($(Ma),[]),xAxis:g(Be,{}),yAxis:g(Be,{})}),Ft=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},Ge=(n,t)=>{Ft(n.map(e=>e.x),`x in "${t}"`)},Ke=n=>{const t=W(Ta,n);Ft(t.series.map(e=>e.id),"series id"),Ft(t.guides.map(e=>e.id),"guide id");for(const e of t.series)Ge(e.points,e.label);for(const e of t.guides)Ge(e.points,e.label);if(t.yAxis.min!==void 0&&t.yAxis.max!==void 0&&t.yAxis.min>=t.yAxis.max)throw new Error("yAxis.min must be less than yAxis.max");return t},J={top:22,right:18,bottom:38,left:52},Ht=6,Aa=n=>{const t=[],e=new Set;for(const s of[...n.series,...n.guides])for(const a of s.points)e.has(a.x)||(e.add(a.x),t.push(a.x));return t},La=n=>{const t=[...n.series,...n.guides].flatMap(o=>o.points.map(r=>r.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),a=n.yAxis.min??Math.min(0,e);let i=n.yAxis.max??s;if(i<=a&&(i=a+1),n.yAxis.max===void 0){const o=i-a;i+=o*.08}return{min:a,max:i}},_t=n=>n.length===0?"":n.map((t,e)=>`${e===0?"M":"L"}${Z(t.x)} ${Z(t.y)}`).join(" "),Ra=(n,t)=>n.length===0?null:`${_t(n)} L${Z(n.at(-1)?.x??0)} ${Z(t)} L${Z(n[0]?.x??0)} ${Z(t)} Z`,Z=n=>Math.round(n*100)/100,Ve=n=>Number.isInteger(n)?String(n):String(Math.round(n*10)/10),Da=(n,t)=>{const e=n/Math.max(1,t),s=10**Math.floor(Math.log10(e)),a=e/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s},Pa=(n,t,e)=>{const s=Da(t-n,4),a=Math.ceil(n/s)*s,i=[];for(let r=a;r<=t+s/1e3;r+=s)i.push({y:e(r),label:Ve(r)});const o=e(n);return i.some(r=>Math.abs(r.y-o)<.01)||i.push({y:o,label:Ve(n)}),i},Oa=(n,t)=>{if(n.length===0)return[];if(n.length<=Ht)return n.map((s,a)=>({x:t(a),label:s}));const e=Array.from({length:Ht},(s,a)=>Math.round(a*(n.length-1)/(Ht-1)));return[...new Set(e)].map(s=>({x:t(s),label:n[s]??""}))},qa=(n,t=720,e=280)=>{const s=Aa(n),a=La(n);if(s.length===0||a===null)return null;const i={left:J.left,top:J.top,width:t-J.left-J.right,height:e-J.top-J.bottom},o=new Map(s.map((m,k)=>[m,k])),r=m=>s.length===1?i.left+i.width/2:i.left+m/(s.length-1)*i.width,l=m=>i.top+(1-(m-a.min)/(a.max-a.min))*i.height,u=m=>m.flatMap(k=>{const L=o.get(k.x);return L===void 0?[]:[{x:r(L),y:l(k.y)}]}).sort((k,L)=>k.x-L.x),c=i.top+i.height;return{width:t,height:e,plot:i,series:n.series.map(m=>{const k=u(m.points);return{...m,nodes:k,path:_t(k),areaPath:m.area?Ra(k,c):null}}),guides:n.guides.map(m=>({...m,path:_t(u(m.points))})),marks:n.marks.flatMap(m=>{const k=o.get(m.x);return k===void 0?[]:[{...m,x:r(k)}]}),xTicks:Oa(s,r),yTicks:Pa(a.min,a.max,l)}},Ia=M`
597
- :host {
598
- display: block;
599
- min-width: 0;
600
- }
601
-
602
- .guide {
603
- fill: none;
604
- stroke: var(--tone, var(--dpk-ink-faint));
605
- stroke-width: 1.25;
606
- }
607
-
608
- .guide[data-dashed] {
609
- stroke-dasharray: 5 4;
610
- }
611
-
612
- .axis-label {
613
- fill: var(--dpk-ink-faint);
614
- font-family: var(--dpk-mono);
615
- font-size: 10px;
616
- }
617
- `,F=n=>`--tone: var(--dpk-${n})`;class Je extends z{static{this.styles=[En,Ia]}static{this.properties={data:{attribute:!1}}}#a=new P(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#n=_(this,Ke,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Ke(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Sa(this.#a.locale),e=this.#t,s=e===null?null:qa(e);if(this.#e!==null)return this.#s(d`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#s(d`<p class="dpk-chart-empty">${t.empty}</p>`);const a=e.title===""?t.aria:e.title;return d`<section class="dpk-chart" aria-label=${a}>
618
- ${e.title===""&&e.caption===""?h:d`<header class="dpk-chart-head">
619
- ${e.title===""?h:d`<span class="dpk-chart-title">${e.title}</span>`}
620
- ${e.caption===""?h:d`<span class="dpk-chart-value">${e.caption}</span>`}
621
- </header>`}
622
- <div class="dpk-chart-plot">${this.#i(e,s,a)}</div>
623
- ${this.#c(e)}
624
- </section>`}#s(t){return d`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:a,width:i,height:o}=e,r=a.top+a.height;return d`<svg viewBox="0 0 ${i} ${o}" role="img" aria-label=${s}>
625
- <title>${s}</title>
626
- <g class="dpk-chart-grid">
627
- ${e.yTicks.map(l=>j`<line x1=${a.left} x2=${a.left+a.width} y1=${l.y} y2=${l.y}></line>`)}
628
- </g>
629
- <g class="dpk-chart-axis">
630
- <line x1=${a.left} x2=${a.left} y1=${a.top} y2=${r}></line>
631
- <line x1=${a.left} x2=${a.left+a.width} y1=${r} y2=${r}></line>
632
- </g>
633
- ${e.yTicks.map(l=>j`<text class="dpk-chart-tick" x=${a.left-8} y=${l.y+3} text-anchor="end">${l.label}</text>`)}
634
- ${e.xTicks.map(l=>j`<text class="dpk-chart-tick" x=${l.x} y=${r+16} text-anchor="middle">${l.label}</text>`)}
635
- ${t.xAxis.label===void 0?h:j`<text class="axis-label" x=${a.left+a.width/2} y=${o-3} text-anchor="middle">${t.xAxis.label}</text>`}
636
- ${t.yAxis.label===void 0?h:j`<text class="axis-label" x=${12} y=${a.top+a.height/2} text-anchor="middle" transform="rotate(-90 12 ${a.top+a.height/2})">${t.yAxis.label}</text>`}
637
- ${e.guides.map(l=>this.#o(l))}
638
- ${e.series.map(l=>this.#r(l))}
639
- ${e.marks.map(l=>this.#d(l,a.top,r))}
640
- </svg>`}#r(t){return t.path===""?h:j`${t.areaPath===null?h:j`<path class="dpk-chart-area" d=${t.areaPath} style=${F(t.tone)}></path>`}
641
- <path class="dpk-chart-line" d=${t.path} style=${F(t.tone)}></path>
642
- ${t.nodes.map(e=>j`<circle
643
- class="dpk-chart-point"
644
- cx=${e.x}
645
- cy=${e.y}
646
- r="2.5"
647
- style=${F(t.tone)}
648
- ></circle>`)}`}#o(t){return t.path===""?h:j`<path
649
- class="guide"
650
- d=${t.path}
651
- style=${F(t.tone)}
652
- ?data-dashed=${t.dashed}
653
- ></path>`}#d(t,e,s){return j`<line
654
- class="dpk-chart-mark"
655
- x1=${t.x}
656
- x2=${t.x}
657
- y1=${e}
658
- y2=${s}
659
- style=${F(t.tone)}
660
- ></line>
661
- <text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${F(t.tone)}
662
- >${t.label}</text
663
- >`}#c(t){return t.series.length===0&&t.guides.length===0&&t.marks.length===0?h:d`<div class="dpk-chart-legend">
664
- ${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${F(e.tone)}
665
- >${e.label}</span
666
- >`)}
667
- ${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${F(e.tone)}>${e.label}</span>`)}
668
- ${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${F(e.tone)}>${e.label}</span>`)}
669
- </div>`}}const Ze=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",Je)},Ua=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:n=>`${n} ${n===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:n=>`Comment on ${n}`,sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:n=>`${n} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:n=>`${n}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),O=C(v(),ye(),E(1)),rt=w({id:G,text:O}),ja=xe("kind",[w({kind:V("proved"),assumptions:g($(O))}),w({kind:V("bounded"),bound:O}),w({kind:V("incomplete"),gaps:g($(O))}),w({kind:V("planned")})]),Na=w({id:G,target:g(G),statement:O,subjects:g($(rt)),premises:g($(rt)),conclusions:C($(rt),E(1,"a claim needs at least one conclusion")),examples:g($(rt)),notClaimed:g($(rt)),assurance:ja,source:g(w({tool:g(O),ref:O}))}),Fa=w({id:G,name:O,meaning:O}),Ha=w({id:G,name:O,code:g(O),summary:g(O)}),_a=w({targets:g($(Ha)),terms:g($(Fa)),claims:$(Na)}),Wa=()=>({targets:[],terms:[],claims:[]}),Ba=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,Ga=(n,t)=>{const e=[];let s=0;for(const a of n.matchAll(Ba)){const i=(a[1]??"").trim(),o=t.get(i);if(o===void 0)throw new Error(`unknown term reference: [[${i}]]`);a.index>s&&e.push({kind:"text",text:n.slice(s,a.index)}),e.push({kind:"term",id:i,label:a[2]?.trim()||o}),s=a.index+a[0].length}return s<n.length&&e.push({kind:"text",text:n.slice(s)}),e},Xe=n=>n.map(t=>t.kind==="text"?t.text:t.label).join(""),Ka=n=>[...new Set(n.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],yt=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},Ye=n=>{const t=W(_a,n),e=t.targets??[],s=t.terms??[];yt(e.map(c=>c.id),"target"),yt(s.map(c=>c.id),"term"),yt(t.claims.map(c=>c.id),"claim");const a=new Map(s.map(c=>[c.id,c.name])),i=c=>Ga(c,a),o=s.map(c=>({id:c.id,name:c.name,meaning:i(c.meaning)})),r=e.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:i(c.summary)})),l=new Set(r.map(c=>c.id)),u=t.claims.map(c=>{if(c.target!==void 0&&!l.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const m=N=>(N??[]).map(et=>({id:et.id,text:i(et.text)})),k=m(c.subjects),L=m(c.premises),mt=m(c.conclusions),H=m(c.examples),tt=m(c.notClaimed),q=[...k,...L,...mt,...H,...tt];yt(q.map(N=>N.id),`clause (in claim ${c.id})`);const A=Va(c.assurance,i),I=i(c.statement);return{id:c.id,target:c.target??null,statement:I,subjects:k,premises:L,conclusions:mt,examples:H,notClaimed:tt,assurance:A,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:Ka([I,...q.map(N=>N.text),...Ja(A)])}});return{targets:r,terms:o,claims:u}},Va=(n,t)=>{switch(n.kind){case"proved":return{kind:"proved",assumptions:(n.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(n.bound)};case"incomplete":return{kind:"incomplete",gaps:(n.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},Ja=n=>{switch(n.kind){case"proved":return n.assumptions;case"bounded":return[n.bound];case"incomplete":return n.gaps;case"planned":return[]}},Za=n=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of n.claims)t[Qe(e.assurance)?"conditional":e.assurance.kind]+=1;return t},Qe=n=>n.kind==="proved"&&n.assumptions.length>0,ts=n=>{const t=new Map(n.targets.map(s=>[s.id,s])),e=new Map;for(const s of n.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of n.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,a])=>({target:s===null?null:t.get(s)??null,claims:a}))},ot=(n,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:n,items:t},Wt=(n,t)=>{switch(t.kind){case"proved":return Qe(t)?{tone:"caveat",label:n.conditional,detail:n.conditionalDetail,...ot(n.assumptions,t.assumptions)}:{tone:"sound",label:n.proved,detail:n.provedDetail,...ot("",[])};case"bounded":return{tone:"caveat",label:n.bounded,detail:n.boundedDetail,...ot(n.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:n.incomplete,detail:n.incompleteDetail,...ot(n.gaps,t.gaps)};case"planned":return{tone:"planned",label:n.planned,detail:n.plannedDetail,...ot("",[])}}},Xa=n=>{switch(n.kind){case"target":return["target",n.target];case"claim":return["claim",n.claim];case"clause":return["clause",n.claim,n.clause]}},Ya=n=>[...n.subjects,...n.premises,...n.conclusions,...n.examples,...n.notClaimed],es=32,ss=n=>{const t=Xe(n.statement);return t.length<=es?t:`${t.slice(0,es).trimEnd()}\u2026`},Qa=n=>[{target:{kind:"claim",claim:n.id},label:ss(n)},...Ya(n).map(t=>({target:{kind:"clause",claim:n.id,clause:t.id},label:`${ss(n)} \u203A ${Xe(t.text)}`}))],ti=n=>ts(n).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(Qa)]),ei=[T,B,gt,M`
670
- :host {
671
- display: block;
672
- container-type: inline-size;
673
- color: var(--dpk-ink);
674
- font-family: var(--dpk-body);
675
- }
676
-
677
- .spec {
678
- display: grid;
679
- gap: 14px;
680
- }
681
-
682
- /* ----------------------------------------------------------- toolbar */
683
-
684
- .spec-toolbar {
685
- display: flex;
686
- flex-wrap: wrap;
687
- align-items: baseline;
688
- gap: 4px 10px;
689
- padding: 0 2px 10px;
690
- border-bottom: 1px solid var(--dpk-rule);
691
- }
692
-
693
- .spec-title {
694
- font-family: var(--dpk-display);
695
- font-size: 14px;
696
- font-weight: 650;
697
- }
698
-
699
- .spec-subject {
700
- color: var(--dpk-ink-soft);
701
- font-size: 12.5px;
702
- }
703
-
704
- .spec-stats {
705
- display: inline-flex;
706
- flex-wrap: wrap;
707
- align-items: center;
708
- gap: 6px;
709
- margin-left: auto;
710
- color: var(--dpk-ink-faint);
711
- font-size: 12px;
712
- }
713
-
714
- .spec-chip {
715
- padding: 1px 8px;
716
- border-radius: 999px;
717
- font-weight: 600;
718
- }
719
-
720
- .spec-notice,
721
- .spec-empty {
722
- margin: 0;
723
- padding: 14px;
724
- border-radius: var(--dpk-radius);
725
- font-size: 12.5px;
726
- }
727
-
728
- .spec-notice {
729
- background: var(--dpk-danger-soft);
730
- color: var(--dpk-danger);
731
- }
732
-
733
- .spec-empty {
734
- color: var(--dpk-ink-faint);
735
- text-align: center;
736
- }
737
-
738
- /* ------------------------------------------------------------ tones */
739
-
740
- [data-tone='sound'] {
741
- --tone: var(--dpk-green);
742
- --tone-soft: var(--dpk-green-soft);
743
- }
744
-
745
- [data-tone='caveat'] {
746
- --tone: var(--dpk-amber);
747
- --tone-soft: var(--dpk-amber-soft);
748
- }
749
-
750
- [data-tone='unsound'] {
751
- --tone: var(--dpk-danger);
752
- --tone-soft: var(--dpk-danger-soft);
753
- }
754
-
755
- [data-tone='planned'] {
756
- --tone: var(--dpk-blue);
757
- --tone-soft: var(--dpk-blue-soft);
758
- }
759
-
760
- .spec-chip,
761
- .assurance-badge {
762
- background: var(--tone-soft);
763
- color: var(--tone);
764
- }
765
-
766
- /* ----------------------------------------------------------- targets */
767
-
768
- .spec-groups {
769
- display: grid;
770
- gap: 28px;
771
- }
772
-
773
- .target-group {
774
- display: grid;
775
- gap: 12px;
776
- }
777
-
778
- .target-head {
779
- display: flex;
780
- flex-wrap: wrap;
781
- align-items: baseline;
782
- gap: 4px 10px;
783
- }
784
-
785
- .target-label {
786
- color: var(--dpk-ink-faint);
787
- font-size: 11.5px;
788
- font-weight: 650;
789
- letter-spacing: 0.04em;
790
- }
791
-
792
- .target-name {
793
- margin: 0;
794
- font-family: var(--dpk-display);
795
- font-size: 17px;
796
- font-weight: 700;
797
- }
798
-
799
- .target-code {
800
- padding: 1px 7px;
801
- border: 1px solid var(--dpk-rule);
802
- border-radius: var(--dpk-radius-sm);
803
- background: var(--dpk-paper-sunken);
804
- color: var(--dpk-ink-soft);
805
- font-family: var(--dpk-mono);
806
- font-size: 12px;
807
- }
808
-
809
- .target-summary {
810
- margin: -4px 0 0;
811
- color: var(--dpk-ink-soft);
812
- font-size: 13.5px;
813
- line-height: 1.7;
814
- }
815
-
816
- /* ------------------------------------------------------------ claims */
817
-
818
- .spec-claims {
819
- display: grid;
820
- gap: 8px;
821
- }
822
-
823
- .claim {
824
- padding: 10px 14px 10px 8px;
825
- border: 1px solid var(--dpk-rule);
826
- border-radius: var(--dpk-radius-lg);
827
- background: var(--dpk-paper-raised);
828
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
829
- }
830
-
831
- /* Folded, the head row is the whole card: the statement and how strongly it holds. */
832
- .claim-head {
833
- display: flex;
834
- align-items: flex-start;
835
- gap: 8px;
836
- cursor: pointer;
837
- }
838
-
839
- /* Base look and sizing come from .dpk-icon-btn (src/core/theme); only the fold behavior is local. */
840
- .claim-toggle {
841
- flex: none;
842
- margin-top: 1px;
843
- }
844
-
845
- .claim-toggle svg {
846
- transition: transform 120ms ease;
847
- }
848
-
849
- .claim-toggle[aria-expanded='true'] svg {
850
- transform: rotate(90deg);
851
- }
852
-
853
- .claim-body {
854
- display: grid;
855
- gap: 14px;
856
- margin: 12px 0 6px 32px;
857
- }
858
-
859
- /* The badge explains itself in a tooltip, so it is a button that hover, focus or a tap opens. */
860
- .assurance-badge {
861
- flex: none;
862
- margin-top: 2px;
863
- padding: 2px 10px;
864
- border: none;
865
- border-radius: 999px;
866
- font: inherit;
867
- font-size: 11.5px;
868
- font-weight: 650;
869
- white-space: nowrap;
870
- cursor: help;
871
- }
872
-
873
- .assurance-badge:focus-visible {
874
- outline: 2px solid var(--tone);
875
- outline-offset: 2px;
876
- }
877
-
878
- .claim-statement {
879
- flex: 1;
880
- margin: 0;
881
- font-size: 14.5px;
882
- line-height: 1.65;
883
- font-weight: 500;
884
- }
885
-
886
- /* Subjects / premises / conclusions: the structure of the claim, one row per part. */
887
- .claim-parts {
888
- display: grid;
889
- grid-template-columns: max-content 1fr;
890
- margin: 0;
891
- border: 1px solid var(--dpk-rule);
892
- border-radius: var(--dpk-radius);
893
- background: var(--dpk-paper-sunken);
894
- overflow: hidden;
895
- }
896
-
897
- .claim-part {
898
- display: contents;
899
- }
900
-
901
- .claim-part > dt,
902
- .claim-part > dd {
903
- margin: 0;
904
- padding: 9px 12px;
905
- border-top: 1px solid var(--dpk-rule);
906
- }
907
-
908
- .claim-part:first-child > dt,
909
- .claim-part:first-child > dd {
910
- border-top: none;
911
- }
912
-
913
- .claim-part > dt {
914
- color: var(--dpk-ink-soft);
915
- font-size: 11.5px;
916
- font-weight: 650;
917
- letter-spacing: 0.04em;
918
- padding-top: 11px;
919
- }
920
-
921
- /* The conclusion is what the claim asserts: its label reads strongest. */
922
- .claim-part[data-part='conclusions'] > dt {
923
- color: var(--dpk-ink);
924
- }
925
-
926
- .claim-none {
927
- margin: 0;
928
- color: var(--dpk-ink-faint);
929
- font-size: 13px;
930
- }
931
-
932
- .clauses {
933
- display: grid;
934
- gap: 2px;
935
- margin: 0;
936
- padding: 0;
937
- list-style: none;
938
- }
939
-
940
- .clause {
941
- position: relative;
942
- display: flex;
943
- align-items: flex-start;
944
- gap: 6px;
945
- min-height: 28px;
946
- padding: 2px 0 2px 14px;
947
- font-size: 13.5px;
948
- line-height: 1.7;
949
- }
950
-
951
- .clause::before {
952
- content: '';
953
- position: absolute;
954
- left: 2px;
955
- top: 0.95em;
956
- width: 5px;
957
- height: 5px;
958
- border-radius: 50%;
959
- background: var(--dpk-ink-faint);
960
- }
961
-
962
- .clause-text {
963
- flex: 1;
964
- min-width: 0;
965
- overflow-wrap: anywhere;
966
- }
967
-
968
- /* ---------------------------------------------------------- assurance */
969
-
970
- .assurance {
971
- padding: 10px 14px;
972
- border-radius: var(--dpk-radius);
973
- background: var(--tone-soft);
974
- font-size: 12.5px;
975
- line-height: 1.6;
976
- }
977
-
978
- .assurance-label {
979
- margin: 0;
980
- color: var(--tone);
981
- font-weight: 650;
982
- }
983
-
984
- .assurance ul {
985
- margin: 4px 0 0;
986
- padding-left: 18px;
987
- color: var(--dpk-ink);
988
- }
989
-
990
- /* ---------------------------------------------------- examples / not */
991
-
992
- .claim-aside h5 {
993
- margin: 0 0 2px;
994
- color: var(--dpk-ink-soft);
995
- font-size: 11.5px;
996
- font-weight: 650;
997
- letter-spacing: 0.04em;
998
- }
999
-
1000
- .claim-aside[data-part='not-claimed'] {
1001
- padding: 10px 14px;
1002
- border: 1px dashed var(--dpk-rule-strong);
1003
- border-radius: var(--dpk-radius);
1004
- }
1005
-
1006
- .claim-aside[data-part='not-claimed'] .clause::before {
1007
- content: '×';
1008
- left: 0;
1009
- top: 0;
1010
- width: auto;
1011
- height: auto;
1012
- border-radius: 0;
1013
- background: none;
1014
- color: var(--dpk-ink-faint);
1015
- font-weight: 700;
1016
- }
1017
-
1018
- .claim-aside[data-part='not-claimed'] .clause-text {
1019
- color: var(--dpk-ink-soft);
1020
- }
1021
-
1022
- /* ------------------------------------------------------------- footer */
1023
-
1024
- .claim-foot {
1025
- display: flex;
1026
- flex-wrap: wrap;
1027
- align-items: center;
1028
- gap: 6px 8px;
1029
- padding-top: 10px;
1030
- border-top: 1px solid var(--dpk-rule);
1031
- color: var(--dpk-ink-faint);
1032
- font-size: 11.5px;
1033
- }
1034
-
1035
- .claim-foot-label {
1036
- font-weight: 650;
1037
- }
1038
-
1039
- .term-chip {
1040
- padding: 1px 9px;
1041
- border: 1px solid var(--dpk-rule-strong);
1042
- border-radius: 999px;
1043
- background: var(--dpk-paper);
1044
- color: var(--dpk-ink-soft);
1045
- font: inherit;
1046
- cursor: help;
1047
- }
1048
-
1049
- .term-chip:is(:hover, :focus-visible) {
1050
- border-color: var(--dpk-violet);
1051
- color: var(--dpk-violet);
1052
- }
1053
-
1054
- .claim-source {
1055
- margin-left: auto;
1056
- }
1057
-
1058
- .claim-source code {
1059
- font-family: var(--dpk-mono);
1060
- font-size: 11px;
1061
- }
1062
-
1063
- /* -------------------------------------------------------------- terms */
1064
-
1065
- .term {
1066
- display: inline;
1067
- padding: 0 1px;
1068
- border: none;
1069
- border-bottom: 1.5px dotted var(--dpk-violet);
1070
- background: none;
1071
- color: inherit;
1072
- font: inherit;
1073
- font-weight: 600;
1074
- cursor: help;
1075
- }
1076
-
1077
- .term:hover,
1078
- .term:focus-visible {
1079
- background: var(--dpk-violet-soft);
1080
- outline: none;
1081
- }
1082
-
1083
- /* ----------------------------------------------------------- tooltip */
1084
-
1085
- /* Sized to its text: the popover helper sets a fixed width, which only !important overrides. */
1086
- .spec-tip {
1087
- box-sizing: border-box;
1088
- position: fixed;
1089
- inset: auto;
1090
- width: max-content !important;
1091
- max-width: min(300px, calc(100vw - 16px));
1092
- margin: 0;
1093
- padding: 8px 11px;
1094
- border: 1px solid var(--dpk-rule-strong);
1095
- border-radius: var(--dpk-radius);
1096
- background: var(--dpk-paper-raised);
1097
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
1098
- color: var(--dpk-ink);
1099
- font-size: 12.5px;
1100
- line-height: 1.6;
1101
- pointer-events: none;
1102
- }
1103
-
1104
- .spec-tip p {
1105
- margin: 0;
1106
- }
1107
-
1108
- .tip-title {
1109
- color: var(--dpk-violet);
1110
- font-weight: 650;
1111
- }
1112
-
1113
- .spec-tip[data-tone] .tip-title {
1114
- color: var(--tone);
1115
- }
1116
-
1117
- .term-static {
1118
- border-bottom: 1.5px dotted var(--dpk-violet);
1119
- font-weight: 600;
1120
- }
1121
-
1122
- @container (max-width: 520px) {
1123
- .claim-parts {
1124
- grid-template-columns: 1fr;
1125
- }
1126
-
1127
- .claim-part > dd {
1128
- border-top: none;
1129
- padding-top: 0;
1130
- }
1131
- }
1132
-
1133
- /* ---------------------------------------------------------- comments */
1134
- /* "Review comment" opens from the right-click menu (src/core/context-menu); the
1135
- popover itself still renders here, anchored at the target's own element. */
1136
-
1137
- .comment-target {
1138
- font-size: 12px;
1139
- overflow-wrap: anywhere;
1140
- }
1141
-
1142
- .comment-error {
1143
- margin: 0;
1144
- font-size: 11px;
1145
- color: var(--dpk-accent);
1146
- }
1147
- `],ns=n=>`claim-body-${n}`;class as extends z{static{this.styles=ei}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#a=null;#t=new Map;#e=null;#n=null;#s="";#i=new Set;#r=null;#o=null;#d=new Mt(this);#c=new it(this);#p=new P(this,()=>{this.#s=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#s="",document.addEventListener("keydown",this.#S),document.addEventListener("pointerdown",this.#M),this.#n=_(this,Ye,t=>{t.ok?this.#f(t.value):this.#x(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#S),document.removeEventListener("pointerdown",this.#M),this.#n?.(),this.#n=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#f(this.data)}updated(){this.#v(),this.#c.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=kt(t.target,this.commentTargets,Tt(this.#p.locale),(s,a)=>this.#m(s,a));return e===null?null:[e]}#m(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#c.open(t,s,e)}#h(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}get commentTargets(){if(!this.id||this.#a===null)return[];const t=`${this.subject??this.heading??this.#l.heading} \xB7 ${this.id}`;return ti(this.#a).map(({target:e,label:s})=>({value:this.#k(e),label:s,group:t}))}get dataError(){return this.#e}get#l(){return Ua(this.#p.locale)}#u(){return this.#a??Wa()}#f(t){this.#a=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#x(t){this.#a=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#k(t){return`element:${[this.id,...Xa(t)].map(e=>encodeURIComponent(e)).join("/")}`}#v(){const t=JSON.stringify(this.commentTargets);t!==this.#s&&(this.#s=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#g(t){const e=new Set(this.#i);if(e.delete(t)||e.add(t),this.#i=e,!e.has(t)){const s=this.#r?.anchor;s?.closest(".claim-body")?.id===ns(t)&&this.#b(s)}this.requestUpdate()}#z(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#g(e)}#w(){const t=this.#r?.anchor??null,e=this.#o!==t;e&&(this.#o?.removeAttribute("aria-describedby"),t?.setAttribute("aria-describedby","spec-tip")),this.#o=t;const s=this.renderRoot.querySelector(".spec-tip");!s||!t||!e||this.#d.open(s,t,{width:300,height:240},{placement:"top-start"})}#y(t,e){this.#r?.anchor!==e&&(this.#r={tip:t,anchor:e},this.requestUpdate())}#b(t){this.#r===null||t!==void 0&&this.#r.anchor!==t||(this.#r=null,this.requestUpdate())}#S=t=>{t.key==="Escape"&&this.#b()};#M=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#b()};#T(t){const e=(a,i)=>{a.currentTarget instanceof HTMLElement&&i(a.currentTarget)},s=a=>a.pointerType!=="touch";return{enter:a=>s(a)&&e(a,i=>this.#y(t,i)),leave:a=>s(a)&&e(a,i=>this.#b(i)),show:a=>e(a,i=>this.#y(t,i)),hide:a=>e(a,i=>this.#b(i))}}render(){const t=this.#l,e=this.#u();return d`
1148
- <section class="spec">
1149
- <header class="spec-toolbar">
1150
- <span class="spec-title">${this.heading??t.heading}</span>
1151
- ${this.subject?d`<span class="spec-subject">${this.subject}</span>`:h}
1152
- <span class="spec-stats">${this.#A(e)}</span>
1153
- </header>
1154
- ${this.#e===null?h:d`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
1155
- ${this.#e===null&&e.claims.length===0?d`<p class="spec-empty">${t.empty}</p>`:h}
1156
- <div class="spec-groups">
1157
- ${U(ts(e),s=>s.target?.id??"",s=>this.#L(s))}
1158
- </div>
1159
- </section>
1160
- ${this.#U()}
1161
- ${this.#c.render({locale:this.#p.locale,errorMessage:this.#l.sendFailed,submit:(s,a)=>this.#h(s,a)})}
1162
- `}#A(t){const e=this.#l,s=Za(t),a=[{tone:"unsound",label:e.incomplete,count:s.incomplete},{tone:"caveat",label:e.bounded,count:s.bounded},{tone:"caveat",label:e.conditional,count:s.conditional},{tone:"planned",label:e.planned,count:s.planned}].filter(i=>i.count>0);return d`${e.claims(t.claims.length)}
1163
- ${a.map(i=>d`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#L(t){const e=d`<div class="spec-claims">
1164
- ${U(t.claims,a=>a.id,a=>this.#P(a))}
1165
- </div>`,s=t.target;return s===null?e:d`<section class="target-group" data-target=${s.id}>
1166
- <header class="target-head" data-dpk-target=${this.#k({kind:"target",target:s.id})}>
1167
- <span class="target-label">${this.#l.target}</span>
1168
- <h3 class="target-name">${s.name}</h3>
1169
- ${s.code===null?h:d`<code class="target-code">${s.code}</code>`}
1170
- </header>
1171
- ${s.summary===null?h:d`<p class="target-summary">${this.#$(s.summary)}</p>`}
1172
- ${t.claims.length===0?d`<p class="spec-empty">${this.#l.noClaims}</p>`:e}
1173
- </section>`}#P(t){const e=this.#l,s=Wt(e,t.assurance),a=this.#i.has(t.id),i=this.#T({kind:"assurance",claim:t.id}),o=ns(t.id);return d`
1174
- <article class="claim" data-claim=${t.id} data-tone=${s.tone}>
1175
- <div
1176
- class="claim-head"
1177
- data-dpk-target=${this.#k({kind:"claim",claim:t.id})}
1178
- @click=${r=>this.#z(r,t.id)}
1179
- >
1180
- <button
1181
- type="button"
1182
- class="dpk-icon-btn claim-toggle"
1183
- aria-expanded=${a?"true":"false"}
1184
- aria-controls=${a?o:h}
1185
- aria-label=${a?e.hideDetails:e.showDetails}
1186
- @click=${()=>this.#g(t.id)}
1187
- >
1188
- ${me()}
1189
- </button>
1190
- <h4 class="claim-statement">${this.#$(t.statement)}</h4>
1191
- <button
1192
- type="button"
1193
- class="assurance-badge"
1194
- data-tone=${s.tone}
1195
- @pointerenter=${i.enter}
1196
- @pointerleave=${i.leave}
1197
- @focus=${i.show}
1198
- @blur=${i.hide}
1199
- @click=${i.show}
1200
- >
1201
- ${s.label}
1202
- </button>
1203
- </div>
1204
- ${a?this.#I(t,o):h}
1205
- </article>
1206
- `}#I(t,e){const s=this.#l,a=Wt(s,t.assurance);return d`<div class="claim-body" id=${e}>
1207
- <dl class="claim-parts">
1208
- ${t.subjects.length===0?h:this.#C("subjects",s.subjects,t,t.subjects)}
1209
- ${t.premises.length===0?d`<div class="claim-part" data-part="premises">
1210
- <dt>${s.premises}</dt>
1211
- <dd><p class="claim-none">${s.noPremises}</p></dd>
1212
- </div>`:this.#C("premises",s.premises,t,t.premises)}
1213
- ${this.#C("conclusions",s.conclusions,t,t.conclusions)}
1214
- </dl>
1215
- ${a.itemsLabel===null?h:d`<div class="assurance" data-tone=${a.tone}>
1216
- <p class="assurance-label">${a.itemsLabel}</p>
1217
- <ul>
1218
- ${a.items.map(i=>d`<li>${this.#$(i)}</li>`)}
1219
- </ul>
1220
- </div>`}
1221
- ${t.examples.length===0?h:d`<section class="claim-aside" data-part="examples">
1222
- <h5>${s.examples}</h5>
1223
- ${this.#E(t,t.examples)}
1224
- </section>`}
1225
- ${t.notClaimed.length===0?h:d`<section class="claim-aside" data-part="not-claimed">
1226
- <h5>${s.notClaimed}</h5>
1227
- ${this.#E(t,t.notClaimed)}
1228
- </section>`}
1229
- ${this.#R(t)}
1230
- </div>`}#C(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
1231
- <dt>${e}</dt>
1232
- <dd>${this.#E(s,a)}</dd>
1233
- </div>`}#E(t,e){return d`<ul class="clauses">
1234
- ${U(e,s=>s.id,s=>d`<li
1235
- class="clause"
1236
- data-clause=${s.id}
1237
- data-dpk-target=${this.#k({kind:"clause",claim:t.id,clause:s.id})}
1238
- >
1239
- <span class="clause-text">${this.#$(s.text)}</span>
1240
- </li>`)}
1241
- </ul>`}#R(t){const e=this.#l,s=t.terms.flatMap(a=>this.#t.get(a)??[]);return s.length===0&&t.source===null?h:d`<footer class="claim-foot">
1242
- ${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this.#D("term-chip",a.id,a.name))}`}
1243
- ${t.source===null?h:d`<span class="claim-source"
1244
- >${e.source}: ${t.source.tool===null?h:d`${t.source.tool} · `}<code
1245
- >${t.source.ref}</code
1246
- ></span
1247
- >`}
1248
- </footer>`}#$(t){return d`${t.map(e=>e.kind==="text"?e.text:this.#D("term",e.id,e.label))}`}#O(t){return d`${t.map(e=>e.kind==="text"?e.text:d`<span class="term-static">${e.label}</span>`)}`}#D(t,e,s){const a=this.#T({kind:"term",term:e});return d`<button
1249
- type="button"
1250
- class=${t}
1251
- data-term=${e}
1252
- @pointerenter=${a.enter}
1253
- @pointerleave=${a.leave}
1254
- @focus=${a.show}
1255
- @blur=${a.hide}
1256
- @click=${a.show}
1257
- >
1258
- ${s}
1259
- </button>`}#U(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#q(t);return e===null?h:d`<div
1260
- id="spec-tip"
1261
- class="spec-tip"
1262
- role="tooltip"
1263
- popover="manual"
1264
- data-tone=${e.tone??h}
1265
- >
1266
- <p class="tip-title">${e.title}</p>
1267
- <p class="tip-body">${e.body}</p>
1268
- </div>`}#q(t){if(t.kind==="term"){const a=this.#t.get(t.term);return a===void 0?null:{title:a.name,body:this.#O(a.meaning)}}const e=this.#a?.claims.find(a=>a.id===t.claim);if(e===void 0)return null;const s=Wt(this.#l,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const is=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",as)},si=D({en:{heading:"Diff",empty:"No changes.",dataError:"The diff could not be read:",summary:n=>`${n} ${n===1?"file":"files"} changed`,unified:"Unified",split:"Split",viewLabel:"Layout",added:"Added",deleted:"Deleted",renamed:"Renamed",copied:"Copied",modified:"Modified",binary:"Binary file not shown.",noContentChange:"No content changes.",modeChanged:(n,t)=>`File mode changed from ${n} to ${t}.`,noNewline:"No newline at end of file",collapse:n=>`Collapse ${n}`,expand:n=>`Expand ${n}`,commentOn:n=>`Comment on ${n}`,addOn:n=>`Comment on or suggest a change to ${n}`,composerTabs:"Comment or suggestion",comment:"Comment",addComment:"Add",threadOn:n=>`Comments on ${n}`,reply:"Reply",replyPlaceholder:"Reply\u2026",suggestChange:"Suggest change",suggestion:"Suggested change",suggest:"Suggest",cancel:"Cancel",suggestionLabel:"Suggested text",deleteLine:"Delete this line",unrecorded:"Could not record it. Place this inside a dpk-view-* element.",sendFailed:"Could not send. Place this inside a dpk-view-* element.",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`Suggested change: ${n}:${t}`,deletedLine:n=>`${n} (deleted)`},ja:{heading:"\u5DEE\u5206",empty:"\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u5DEE\u5206\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F:",summary:n=>`${n} \u30D5\u30A1\u30A4\u30EB\u3092\u5909\u66F4`,unified:"\u7D71\u5408",split:"\u5DE6\u53F3",viewLabel:"\u30EC\u30A4\u30A2\u30A6\u30C8",added:"\u8FFD\u52A0",deleted:"\u524A\u9664",renamed:"\u540D\u524D\u5909\u66F4",copied:"\u30B3\u30D4\u30FC",modified:"\u5909\u66F4",binary:"\u30D0\u30A4\u30CA\u30EA\u30D5\u30A1\u30A4\u30EB\u306F\u8868\u793A\u3057\u307E\u305B\u3093\u3002",noContentChange:"\u5185\u5BB9\u306E\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",modeChanged:(n,t)=>`\u30D5\u30A1\u30A4\u30EB\u30E2\u30FC\u30C9\u3092 ${n} \u304B\u3089 ${t} \u306B\u5909\u66F4\u3002`,noNewline:"\u30D5\u30A1\u30A4\u30EB\u672B\u5C3E\u306B\u6539\u884C\u304C\u3042\u308A\u307E\u305B\u3093",collapse:n=>`${n} \u3092\u6298\u308A\u305F\u305F\u3080`,expand:n=>`${n} \u3092\u5C55\u958B`,commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`,addOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8\u30FB\u5909\u66F4\u3092\u63D0\u6848`,composerTabs:"\u30B3\u30E1\u30F3\u30C8\u304B\u5909\u66F4\u306E\u63D0\u6848",comment:"\u30B3\u30E1\u30F3\u30C8",addComment:"\u8FFD\u52A0",threadOn:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,reply:"\u8FD4\u4FE1",replyPlaceholder:"\u8FD4\u4FE1\u3059\u308B\u2026",suggestChange:"\u5909\u66F4\u3092\u63D0\u6848",suggestion:"\u5909\u66F4\u306E\u63D0\u6848",suggest:"\u63D0\u6848",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",suggestionLabel:"\u63D0\u6848\u3059\u308B\u30C6\u30AD\u30B9\u30C8",deleteLine:"\u3053\u306E\u884C\u3092\u524A\u9664",unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`\u5909\u66F4\u306E\u63D0\u6848: ${n}:${t}`,deletedLine:n=>`${n}\uFF08\u524A\u9664\u884C\uFF09`}}),rs=()=>({files:[]}),lt=n=>n.newLine===null?`L${n.oldLine??0}`:`R${n.newLine}`,ni=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/,ai=n=>{const t=n.replace(/\r\n?/g,`
1269
- `).replace(/<\\\/script/gi,"<\/script").split(`
1270
- `),e=t.findIndex(o=>o.trim()!=="");if(e===-1)return[];let s=t.length-1;for(;s>e&&(t[s]??"").trim()==="";)s-=1;const a=t.slice(e,s+1),i=/^[ \t]*/.exec(a[0]??"")?.[0]??"";return i===""?a:a.map(o=>o.startsWith(i)?o.slice(i.length):o)},os=n=>{const t=[],e=new TextEncoder,s={n:`
1271
- `,t:" ",'"':'"',"\\":"\\",a:"\x07",b:"\b"};for(let a=1;a<n.length-1;a+=1){const i=n.charAt(a);if(i!=="\\"){t.push(...e.encode(i));continue}const o=/^[0-7]{3}/.exec(n.slice(a+1))?.[0];if(o!==void 0){t.push(Number.parseInt(o,8)),a+=3;continue}const r=n.charAt(a+1);t.push(...e.encode(s[r]??r)),a+=1}return new TextDecoder().decode(new Uint8Array(t))},dt=n=>{const t=n.trimEnd();if(t.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(t)?.[0];if(s!==void 0)return os(s)}const e=t.indexOf(" ");return e===-1?t:t.slice(0,e)},ct=(n,t)=>n.startsWith(t)?n.slice(t.length):n,ls=(n,t)=>{const e=dt(n);return e==="/dev/null"?null:ct(e,t)},ii=n=>{if(n.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(n)?.[0];if(s===void 0)return[null,null];const a=n.slice(s.length).trimStart();return[ct(os(s),"a/"),ct(dt(a),"b/")]}const t=(n.length-1)/2;if(Number.isInteger(t)&&n.charAt(t)===" "){const s=n.slice(0,t),a=n.slice(t+1);if(s.startsWith("a/")&&a.startsWith("b/")&&s.slice(2)===a.slice(2))return[s.slice(2),a.slice(2)]}const e=n.indexOf(" b/");return e===-1?[null,null]:[ct(n.slice(0,e),"a/"),ct(dt(n.slice(e+1)),"b/")]},ds=()=>({headerOld:null,headerNew:null,oldPath:void 0,newPath:void 0,status:null,binary:!1,oldMode:null,newMode:null,hunks:[],sawOld:!1,sawNew:!1,skipping:!1}),ri=n=>{const t=n.oldPath===void 0?n.headerOld:n.oldPath,e=n.newPath===void 0?n.headerNew:n.newPath,s=n.status??(t===null&&e!==null?"added":e===null?"deleted":"modified"),a=(s==="deleted"?t:e)??t??e;if(a===null)throw new Error("a file in the diff has no path");const i=n.hunks.map(r=>({oldStart:r.oldStart,oldCount:r.oldCount,newStart:r.newStart,newCount:r.newCount,section:r.section,lines:r.lines})),o=i.flatMap(r=>r.lines);return{path:a,oldPath:s==="added"?null:t,newPath:s==="deleted"?null:e,status:s,binary:n.binary,oldMode:n.oldMode,newMode:n.newMode,hunks:i,additions:o.filter(r=>r.kind==="add").length,deletions:o.filter(r=>r.kind==="del").length}},oi=(n,t)=>{const e=ni.exec(n);if(e===null)throw new Error(`line ${t}: unreadable hunk header "${n}"`);const[,s="0",a="1",i="0",o="1",r=""]=e,l={oldCount:Number(a),newCount:Number(o)};return{oldStart:Number(s),newStart:Number(i),...l,section:r.trim(),lines:[],oldLeft:l.oldCount,newLeft:l.newCount}},li=(n,t)=>{const e=t.charAt(0),s=e===" "||t===""?"context":e==="+"?"add":e==="-"?"del":null;if(s===null)return!1;const a=s==="add"?null:n.oldStart+(n.oldCount-n.oldLeft),i=s==="del"?null:n.newStart+(n.newCount-n.newLeft);return s!=="add"&&(n.oldLeft-=1),s!=="del"&&(n.newLeft-=1),n.lines.push({kind:s,text:t.slice(1),oldLine:a,newLine:i,noNewline:!1}),!0},cs=n=>{const t=n?.lines.at(-1);n!==void 0&&t!==void 0&&(n.lines[n.lines.length-1]={...t,noNewline:!0})},ps=n=>{const t=ai(n),e=[];let s=null,a=null;const i=()=>{s!==null&&e.push(ri(s)),s=null,a=null};for(const[r,l]of t.entries()){const u=r+1,c=a;if(c!==null){if(c.oldLeft>0||c.newLeft>0){if(l.startsWith("\\")){cs(c);continue}if(li(c,l))continue}else if(l.startsWith("\\")){cs(c);continue}a=null}if(l.startsWith("diff --git ")){i();const k=ds();[k.headerOld,k.headerNew]=ii(l.slice(11)),s=k;continue}if(l.startsWith("diff --cc ")||l.startsWith("diff --combined "))throw new Error(`line ${u}: combined (merge) diffs are not supported`);if(l.startsWith("--- ")&&(t[r+1]??"").startsWith("+++ ")){const k=s;(k===null||k.hunks.length>0||k.sawOld)&&(i(),s=ds()),s!==null&&(s.oldPath=ls(l.slice(4),"a/"),s.sawOld=!0);continue}const m=s;if(!(m===null||m.skipping)){if(l.startsWith("+++ ")&&m.hunks.length===0&&!m.sawNew){m.newPath=ls(l.slice(4),"b/"),m.sawNew=!0;continue}if(l.startsWith("@@ ")){const k=oi(l,u);m.hunks.push(k),a=k;continue}m.hunks.length>0||di(m,l)}}if(i(),e.length===0&&t.length>0)throw new Error("no file diff found (expected the output of git diff)");const o=new Set;for(const r of e){if(o.has(r.path))throw new Error(`the diff has ${r.path} twice`);o.add(r.path)}return{files:e}},di=(n,t)=>{const e=r=>t.startsWith(r)?t.slice(r.length):null,s=e("new file mode ");if(s!==null){n.status="added",n.newMode=s.trim();return}const a=e("deleted file mode ");if(a!==null){n.status="deleted",n.oldMode=a.trim();return}const i=e("old mode ");if(i!==null){n.oldMode=i.trim();return}const o=e("new mode ");if(o!==null){n.newMode=o.trim();return}for(const[r,l,u]of[["rename from ","old","renamed"],["rename to ","new","renamed"],["copy from ","old","copied"],["copy to ","new","copied"]]){const c=e(r);if(c!==null){n.status=u,l==="old"?n.oldPath=dt(c):n.newPath=dt(c);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},b=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},X=b(null,/\s+/y),Bt=b("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),wt=b("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),ci=["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","keyof","let","new","null","of","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","yield"],pi=["action","all","and","any","as","assume","bool","Bool","const","def","else","export","false","from","if","iff","implies","import","int","Int","match","module","Nat","nondet","not","or","pure","run","str","temporal","true","type","val","var"],hi={js:{start:"code",rules:{code:[X,b("comment",/\/\/[^\n]*/y),wt,b("string",/`(?:\\[\s\S]|[^\\`])*`?/y),Bt,b("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),b("keyword",new RegExp(`(?:${ci.join("|")})(?![\\w$])`,"y")),b("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),b(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[b("comment",/<!--[\s\S]*?(?:-->|$)/y),b("keyword",/&#?\w+;/y),b("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),b(null,/[^<&]+/y)],tag:[X,b("tag",/\/?>/y,"text"),b("punct",/=/y),b("string",/"[^"]*"?|'[^']*'?/y),b("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[X,wt,Bt,b("keyword",/@[\w-]+/y),b("punct",/[{}]/y),b("tag",/[^{};]+(?=\{)/y),b("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),b("number",/#[\da-f]{3,8}(?![\w-])/iy),b(null,/-?[A-Za-z_][\w-]*/y),b("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[X,b("comment",/\/\/[^\n]*/y),wt,b("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),b("string",/"(?:\\.|[^\\"\n])*"?/y),b("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),b("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[X,b("comment",/(?<!\S)#[^\n]*/y),Bt,b("keyword",/\$\{[^}\n]*\}?|\$\w+/y),b("attr",/(?<!\S)--?[\w-]+/y),b(null,/[^\s"'$#]+/y)]}},quint:{start:"code",rules:{code:[X,b("comment",/\/\/[^\n]*/y),wt,b("string",/"(?:\\.|[^\\"\n])*"?/y),b("number",/0x[\da-f_]+|\d[\d_]*/iy),b("keyword",new RegExp(`(?:${pi.join("|")})(?!\\w)`,"y")),b("function",/[A-Za-z_]\w*(?=\s*\()/y),b(null,/[A-Za-z_]\w*/y)]}}},ui={js:"js",javascript:"js",jsx:"js",mjs:"js",cjs:"js",ts:"js",typescript:"js",tsx:"js",mts:"js",html:"html",xml:"html",svg:"html",vue:"html",css:"css",json:"json",jsonc:"json",json5:"json",sh:"sh",bash:"sh",zsh:"sh",shell:"sh",console:"sh",quint:"quint",qnt:"quint"},mi=n=>n===null?null:ui[n.trim().toLowerCase()]??null,hs=(n,t,e)=>{const s=n.at(-1);t===null&&s!==void 0&&s.kind===null?n[n.length-1]={kind:t,text:s.text+e}:n.push({kind:t,text:e})},Gt=(n,t)=>{const e=mi(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=hi[e],i=[];let o=s,r=0;for(;r<n.length;){const l=(a[o]??[]).find(u=>(u.pattern.lastIndex=r,u.pattern.test(n)&&u.pattern.lastIndex>r));if(l===void 0){hs(i,null,n.charAt(r)),r+=1;continue}hs(i,l.kind,n.slice(r,l.pattern.lastIndex)),r=l.pattern.lastIndex,o=l.next??o}return i},gi=n=>n.kind==="file"?["file",n.path]:["line",n.path,n.line],us=n=>{const t=n.slice(n.lastIndexOf("/")+1),e=t.lastIndexOf(".");return e<=0?null:t.slice(e+1)},$t=/[\p{L}\p{N}_$]/u,fi=(n,t)=>{let e=t;for(;e>0&&$t.test(n.charAt(e-1))&&$t.test(n.charAt(e));)e-=1;return e},bi=(n,t)=>{let e=t;for(;e<n.length&&$t.test(n.charAt(e))&&$t.test(n.charAt(e-1));)e+=1;return e},ki=(n,t)=>{if(n===t)return null;const e=Math.min(n.length,t.length);let s=0;for(;s<e&&n.charAt(s)===t.charAt(s);)s+=1;let a=0;for(;a<e-s&&n.charAt(n.length-1-a)===t.charAt(t.length-1-a);)a+=1;if((n.slice(0,s).trim().length+n.slice(n.length-a).trim().length)*4<Math.max(n.trim().length,t.trim().length))return null;const o=r=>{const l=fi(r,s),u=bi(r,r.length-a);return[l,Math.max(l,u)]};return{before:o(n),after:o(t)}},vi=(n,t,e)=>{const s=[];let a=0;for(const i of Gt(n,t)){const o=a+i.text.length,r=e===null?[]:e.filter(u=>u>a&&u<o);let l=a;for(const u of[...r,o]){const c=i.text.slice(l-a,u-a),m=e!==null&&l>=e[0]&&u<=e[1]&&e[0]<e[1];c!==""&&s.push({kind:i.kind,text:c,changed:m}),l=u}a=o}return s},ms=n=>{const t=new Map;for(const e of n)if(e.kind!=="context")for(const[s,a]of e.dels.entries()){const i=e.adds[s];if(i===void 0)break;const o=ki(a.text,i.text);o!==null&&(t.set(a,o.before),t.set(i,o.after))}return t},gs=n=>{const t=[];let e=null;for(const s of n.lines){if(s.kind==="context"){e=null,t.push({kind:"context",line:s});continue}(e===null||s.kind==="del"&&e.adds.length>0)&&(e={kind:"change",dels:[],adds:[]},t.push(e)),(s.kind==="del"?e.dels:e.adds).push(s)}return t},pt=(n,t,e,s=!0)=>({line:n,id:lt(n),segments:vi(n.text,t,e.get(n)??null),target:s}),xi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=ms(gs(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:pt(a,t,s)}))]})},yi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=gs(e),a=ms(s),i=[{kind:"hunk",hunk:e}];for(const o of s){if(o.kind==="context"){i.push({kind:"pair",left:pt(o.line,t,a,!1),right:pt(o.line,t,a)});continue}for(let r=0;r<Math.max(o.dels.length,o.adds.length);r+=1){const l=o.dels[r],u=o.adds[r];i.push({kind:"pair",left:l===void 0?null:pt(l,t,a),right:u===void 0?null:pt(u,t,a)})}}return i})},fs=40,wi=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>fs?`${t.slice(0,fs-1)}\u2026`:t},$i=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),bs=(n,t,e)=>n.lineLabel(t,$i(n,lt(e)),wi(e.text)),Ci=(n,t)=>t.files.flatMap(e=>[{target:{kind:"file",path:e.path},label:e.path},...e.hunks.flatMap(s=>s.lines.map(a=>({target:{kind:"line",path:e.path,line:lt(a)},label:bs(n,e.path,a)})))]),Si=n=>({files:n.files.length,additions:n.files.reduce((t,e)=>t+e.additions,0),deletions:n.files.reduce((t,e)=>t+e.deletions,0)}),Ei=[T,B,gt,M`
1272
- :host {
1273
- display: block;
1274
- color: var(--dpk-ink);
1275
- font-family: var(--dpk-body);
1276
- --diff-add: color-mix(in srgb, var(--dpk-green) 11%, transparent);
1277
- --diff-add-strong: color-mix(in srgb, var(--dpk-green) 28%, transparent);
1278
- --diff-add-num: color-mix(in srgb, var(--dpk-green) 18%, transparent);
1279
- --diff-del: color-mix(in srgb, var(--dpk-danger) 10%, transparent);
1280
- --diff-del-strong: color-mix(in srgb, var(--dpk-danger) 26%, transparent);
1281
- --diff-del-num: color-mix(in srgb, var(--dpk-danger) 16%, transparent);
1282
- }
1283
-
1284
- .diff {
1285
- display: grid;
1286
- gap: 12px;
1287
- }
1288
-
1289
- /* ----------------------------------------------------------- toolbar */
1290
-
1291
- .toolbar {
1292
- display: flex;
1293
- flex-wrap: wrap;
1294
- align-items: center;
1295
- gap: 6px 12px;
1296
- padding: 0 2px 10px;
1297
- border-bottom: 1px solid var(--dpk-rule);
1298
- }
1299
-
1300
- .title {
1301
- font-family: var(--dpk-display);
1302
- font-size: 14px;
1303
- font-weight: 650;
1304
- }
1305
-
1306
- .summary {
1307
- display: inline-flex;
1308
- gap: 6px;
1309
- color: var(--dpk-ink-soft);
1310
- font-size: 12.5px;
1311
- }
1312
-
1313
- .stat-add {
1314
- color: var(--dpk-green);
1315
- font-weight: 600;
1316
- }
1317
-
1318
- .stat-del {
1319
- color: var(--dpk-danger);
1320
- font-weight: 600;
1321
- }
1322
-
1323
- .views {
1324
- display: inline-flex;
1325
- margin-left: auto;
1326
- padding: 2px;
1327
- border: 1px solid var(--dpk-rule);
1328
- border-radius: var(--dpk-radius-sm);
1329
- background: var(--dpk-paper-sunken);
1330
- }
1331
-
1332
- .views button {
1333
- padding: 2px 10px;
1334
- border: 0;
1335
- border-radius: var(--dpk-radius-xs);
1336
- background: transparent;
1337
- color: var(--dpk-ink-soft);
1338
- font: inherit;
1339
- font-size: 12px;
1340
- cursor: pointer;
1341
- }
1342
-
1343
- .views button[aria-pressed='true'] {
1344
- background: var(--dpk-paper-raised);
1345
- color: var(--dpk-ink);
1346
- font-weight: 600;
1347
- box-shadow: var(--dpk-shadow-xs);
1348
- }
1349
-
1350
- .views button:focus-visible {
1351
- outline: none;
1352
- box-shadow: var(--dpk-focus);
1353
- }
1354
-
1355
- .notice,
1356
- .empty {
1357
- margin: 0;
1358
- padding: 14px;
1359
- border-radius: var(--dpk-radius);
1360
- font-size: 12.5px;
1361
- }
1362
-
1363
- .notice {
1364
- background: var(--dpk-danger-soft);
1365
- color: var(--dpk-danger);
1366
- }
1367
-
1368
- .empty {
1369
- color: var(--dpk-ink-faint);
1370
- }
1371
-
1372
- /* -------------------------------------------------------------- file */
1373
-
1374
- .file {
1375
- overflow: hidden;
1376
- border: 1px solid var(--dpk-rule);
1377
- border-radius: var(--dpk-radius);
1378
- background: var(--dpk-paper-raised);
1379
- }
1380
-
1381
- .file-head {
1382
- display: flex;
1383
- align-items: center;
1384
- gap: 8px;
1385
- padding: 6px 8px;
1386
- background: var(--dpk-paper-sunken);
1387
- font-size: 12.5px;
1388
- }
1389
-
1390
- .file:has(.scroll, .file-note, .file-thread) .file-head {
1391
- border-bottom: 1px solid var(--dpk-rule);
1392
- }
1393
-
1394
- .toggle svg {
1395
- transition: transform var(--dpk-dur-fast) var(--dpk-ease);
1396
- }
1397
-
1398
- .toggle[aria-expanded='true'] svg {
1399
- transform: rotate(90deg);
1400
- }
1401
-
1402
- .status {
1403
- flex: none;
1404
- padding: 1px 7px;
1405
- border-radius: 999px;
1406
- background: var(--dpk-paper-inset);
1407
- color: var(--dpk-ink-soft);
1408
- font-size: 11px;
1409
- font-weight: 600;
1410
- }
1411
-
1412
- .status[data-status='added'] {
1413
- background: var(--dpk-green-soft);
1414
- color: var(--dpk-green);
1415
- }
1416
-
1417
- .status[data-status='deleted'] {
1418
- background: var(--dpk-danger-soft);
1419
- color: var(--dpk-danger);
1420
- }
1421
-
1422
- .status[data-status='renamed'],
1423
- .status[data-status='copied'] {
1424
- background: var(--dpk-blue-soft);
1425
- color: var(--dpk-blue);
1426
- }
1427
-
1428
- .path {
1429
- min-width: 0;
1430
- font-family: var(--dpk-mono);
1431
- font-weight: 600;
1432
- overflow-wrap: anywhere;
1433
- }
1434
-
1435
- .old-path {
1436
- color: var(--dpk-ink-faint);
1437
- font-weight: 400;
1438
- }
1439
-
1440
- .file-stat {
1441
- margin-left: auto;
1442
- font-size: 12px;
1443
- white-space: nowrap;
1444
- }
1445
-
1446
- .file-note {
1447
- margin: 0;
1448
- padding: 12px 14px;
1449
- color: var(--dpk-ink-faint);
1450
- font-size: 12.5px;
1451
- }
1452
-
1453
- /* ------------------------------------------------------------- lines */
1454
-
1455
- .scroll {
1456
- overflow-x: auto;
1457
- }
1458
-
1459
- .lines {
1460
- width: 100%;
1461
- border-collapse: collapse;
1462
- table-layout: fixed;
1463
- font-family: var(--dpk-mono);
1464
- font-size: 12.5px;
1465
- line-height: 1.55;
1466
- tab-size: 4;
1467
- }
1468
-
1469
- .col-num {
1470
- width: 4.5ch;
1471
- }
1472
-
1473
- .col-act {
1474
- width: 26px;
1475
- }
1476
-
1477
- .lines td {
1478
- padding: 0;
1479
- vertical-align: top;
1480
- }
1481
-
1482
- .num {
1483
- padding: 0 6px !important;
1484
- color: var(--dpk-ink-faint);
1485
- text-align: right;
1486
- user-select: none;
1487
- font-variant-numeric: tabular-nums;
1488
- }
1489
-
1490
- .code {
1491
- padding: 0 12px 0 0 !important;
1492
- }
1493
-
1494
- /* Only the line's own text keeps its spaces; the markup around it may be wrapped freely. */
1495
- .code .text,
1496
- .suggestion-line .text {
1497
- white-space: pre-wrap;
1498
- overflow-wrap: anywhere;
1499
- }
1500
-
1501
- .comment {
1502
- color: var(--dpk-code-comment, var(--dpk-ink-faint));
1503
- font-style: italic;
1504
- }
1505
-
1506
- .string {
1507
- color: var(--dpk-code-string, var(--dpk-green));
1508
- }
1509
-
1510
- .number {
1511
- color: var(--dpk-code-number, var(--dpk-amber));
1512
- }
1513
-
1514
- .keyword {
1515
- color: var(--dpk-code-keyword, var(--dpk-violet));
1516
- }
1517
-
1518
- .function {
1519
- color: var(--dpk-code-function, var(--dpk-blue));
1520
- }
1521
-
1522
- .tag {
1523
- color: var(--dpk-code-tag, var(--dpk-accent-strong));
1524
- }
1525
-
1526
- .attr {
1527
- color: var(--dpk-code-attr, var(--dpk-blue));
1528
- }
1529
-
1530
- .property {
1531
- color: var(--dpk-code-property, var(--dpk-blue));
1532
- }
1533
-
1534
- .punct {
1535
- color: var(--dpk-code-punct, var(--dpk-ink-soft));
1536
- }
1537
-
1538
- .sign {
1539
- display: inline-block;
1540
- width: 2ch;
1541
- color: var(--dpk-ink-faint);
1542
- text-align: center;
1543
- user-select: none;
1544
- }
1545
-
1546
- .line[data-kind='add'] td,
1547
- .lines td[data-kind='add'] {
1548
- background: var(--diff-add);
1549
- }
1550
-
1551
- .line[data-kind='add'] .num,
1552
- .lines .num[data-kind='add'],
1553
- .lines .act[data-kind='add'] {
1554
- background: var(--diff-add-num);
1555
- }
1556
-
1557
- .line[data-kind='del'] td,
1558
- .lines td[data-kind='del'] {
1559
- background: var(--diff-del);
1560
- }
1561
-
1562
- .line[data-kind='del'] .num,
1563
- .lines .num[data-kind='del'],
1564
- .lines .act[data-kind='del'] {
1565
- background: var(--diff-del-num);
1566
- }
1567
-
1568
- td[data-kind='add'] .sign,
1569
- .line[data-kind='add'] .sign {
1570
- color: var(--dpk-green);
1571
- }
1572
-
1573
- td[data-kind='del'] .sign,
1574
- .line[data-kind='del'] .sign {
1575
- color: var(--dpk-danger);
1576
- }
1577
-
1578
- td[data-kind='add'] [data-changed] {
1579
- border-radius: 2px;
1580
- background: var(--diff-add-strong);
1581
- }
1582
-
1583
- td[data-kind='del'] [data-changed] {
1584
- border-radius: 2px;
1585
- background: var(--diff-del-strong);
1586
- }
1587
-
1588
- td[data-blank] {
1589
- background: var(--dpk-paper-sunken);
1590
- }
1591
-
1592
- .no-newline {
1593
- margin-left: 4px;
1594
- color: var(--dpk-danger);
1595
- user-select: none;
1596
- }
1597
-
1598
- .hunk td {
1599
- padding: 3px 12px;
1600
- background: var(--dpk-blue-soft);
1601
- color: var(--dpk-ink-soft);
1602
- font-size: 12px;
1603
- }
1604
-
1605
- .hunk-section {
1606
- color: var(--dpk-ink-faint);
1607
- }
1608
-
1609
- /* Comments and suggestions on a line, shown while the row is pointed at or focused. */
1610
- .act {
1611
- white-space: nowrap;
1612
- }
1613
-
1614
- .line-actions {
1615
- display: inline-flex;
1616
- opacity: 0;
1617
- transition: opacity var(--dpk-dur-fast) var(--dpk-ease);
1618
- }
1619
-
1620
- tr:hover .line-actions,
1621
- .line-actions:focus-within,
1622
- .line-actions[data-open] {
1623
- opacity: 1;
1624
- }
1625
-
1626
- @media (hover: none) {
1627
- .line-actions {
1628
- opacity: 1;
1629
- }
1630
- }
1631
-
1632
- .line-btn {
1633
- display: inline-grid;
1634
- place-items: center;
1635
- width: 20px;
1636
- height: 20px;
1637
- padding: 0;
1638
- border: 0;
1639
- border-radius: var(--dpk-radius-xs);
1640
- background: transparent;
1641
- color: var(--dpk-blue);
1642
- cursor: pointer;
1643
- }
1644
-
1645
- .line-btn:hover {
1646
- background: var(--dpk-blue-soft);
1647
- }
1648
-
1649
- .line-btn:focus-visible {
1650
- outline: none;
1651
- box-shadow: var(--dpk-focus);
1652
- }
1653
-
1654
- .line-btn svg {
1655
- width: 13px;
1656
- height: 13px;
1657
- }
1658
-
1659
- /* ------------------------------------------------------- suggestions */
1660
-
1661
- .extra td {
1662
- padding: 6px 12px 8px;
1663
- border-block: 1px solid var(--dpk-rule);
1664
- background: var(--dpk-paper-sunken);
1665
- font-family: var(--dpk-body);
1666
- }
1667
-
1668
- .suggestion,
1669
- .composer {
1670
- display: grid;
1671
- gap: 6px;
1672
- max-width: 760px;
1673
- }
1674
-
1675
- .suggestion {
1676
- overflow: hidden;
1677
- border: 1px solid var(--dpk-rule-strong);
1678
- border-radius: var(--dpk-radius-sm);
1679
- background: var(--dpk-paper-raised);
1680
- gap: 0;
1681
- }
1682
-
1683
- .suggestion-head {
1684
- display: flex;
1685
- align-items: center;
1686
- gap: 6px;
1687
- margin: 0;
1688
- padding: 4px 10px;
1689
- border-bottom: 1px solid var(--dpk-rule);
1690
- color: var(--dpk-ink-soft);
1691
- font-size: 12px;
1692
- font-weight: 600;
1693
- }
1694
-
1695
- .suggestion-head svg {
1696
- width: 13px;
1697
- height: 13px;
1698
- }
1699
-
1700
- .suggestion-line {
1701
- padding: 0 10px 0 0;
1702
- font-family: var(--dpk-mono);
1703
- font-size: 12.5px;
1704
- line-height: 1.55;
1705
- }
1706
-
1707
- .suggestion-line[data-kind='add'] {
1708
- background: var(--diff-add);
1709
- }
1710
-
1711
- .suggestion-line[data-kind='del'] {
1712
- background: var(--diff-del);
1713
- }
1714
-
1715
- .suggestion-line[data-kind='add'] .sign {
1716
- color: var(--dpk-green);
1717
- }
1718
-
1719
- .suggestion-line[data-kind='del'] .sign {
1720
- color: var(--dpk-danger);
1721
- }
1722
-
1723
- .composer-head {
1724
- display: flex;
1725
- flex-wrap: wrap;
1726
- align-items: center;
1727
- gap: 4px 10px;
1728
- }
1729
-
1730
- .composer-tabs {
1731
- display: inline-flex;
1732
- padding: 2px;
1733
- border: 1px solid var(--dpk-rule);
1734
- border-radius: var(--dpk-radius-sm);
1735
- background: var(--dpk-paper-inset);
1736
- }
1737
-
1738
- .composer-tabs button {
1739
- padding: 2px 10px;
1740
- border: 0;
1741
- border-radius: var(--dpk-radius-xs);
1742
- background: transparent;
1743
- color: var(--dpk-ink-soft);
1744
- font: inherit;
1745
- font-size: 12px;
1746
- cursor: pointer;
1747
- }
1748
-
1749
- .composer-tabs button[aria-selected='true'] {
1750
- background: var(--dpk-paper-raised);
1751
- color: var(--dpk-ink);
1752
- font-weight: 600;
1753
- box-shadow: var(--dpk-shadow-xs);
1754
- }
1755
-
1756
- .composer-tabs button:focus-visible {
1757
- outline: none;
1758
- box-shadow: var(--dpk-focus);
1759
- }
1760
-
1761
- .composer-title {
1762
- font-size: 12px;
1763
- }
1764
-
1765
- .composer-target {
1766
- min-width: 0;
1767
- color: var(--dpk-ink-faint);
1768
- font-family: var(--dpk-mono);
1769
- font-size: 11.5px;
1770
- overflow-wrap: anywhere;
1771
- }
1772
-
1773
- .composer[data-tab='suggest'] textarea {
1774
- font-family: var(--dpk-mono);
1775
- font-size: 12.5px;
1776
- }
1777
-
1778
- .composer-error {
1779
- margin: 0;
1780
- color: var(--dpk-danger);
1781
- font-size: 12px;
1782
- }
1783
-
1784
- .composer-actions {
1785
- display: flex;
1786
- gap: 6px;
1787
- }
1788
-
1789
- /* ----------------------------------------------------------- threads */
1790
-
1791
- .file-thread {
1792
- padding: 8px 12px;
1793
- border-bottom: 1px solid var(--dpk-rule);
1794
- background: var(--dpk-paper-sunken);
1795
- }
1796
-
1797
- .thread {
1798
- display: grid;
1799
- max-width: 760px;
1800
- overflow: hidden;
1801
- border: 1px solid var(--dpk-rule-strong);
1802
- border-radius: var(--dpk-radius-sm);
1803
- background: var(--dpk-paper-raised);
1804
- }
1805
-
1806
- .thread-items {
1807
- margin: 0;
1808
- padding: 0;
1809
- list-style: none;
1810
- }
1811
-
1812
- .thread-item {
1813
- padding: 8px 12px;
1814
- }
1815
-
1816
- .thread-item + .thread-item {
1817
- border-top: 1px solid var(--dpk-rule);
1818
- }
1819
-
1820
- .thread-meta {
1821
- display: flex;
1822
- align-items: center;
1823
- gap: 6px;
1824
- margin: 0 0 2px;
1825
- color: var(--dpk-ink-faint);
1826
- font-size: 11.5px;
1827
- }
1828
-
1829
- .thread-meta svg {
1830
- width: 12px;
1831
- height: 12px;
1832
- }
1833
-
1834
- .thread-body {
1835
- margin: 0;
1836
- font-size: 13px;
1837
- line-height: 1.6;
1838
- white-space: pre-wrap;
1839
- overflow-wrap: anywhere;
1840
- }
1841
-
1842
- .thread-reply {
1843
- margin: 0;
1844
- padding: 8px 12px;
1845
- border: 0;
1846
- border-top: 1px solid var(--dpk-rule);
1847
- background: var(--dpk-paper-sunken);
1848
- color: var(--dpk-ink-faint);
1849
- font: inherit;
1850
- font-size: 12.5px;
1851
- text-align: left;
1852
- cursor: text;
1853
- }
1854
-
1855
- .thread-reply:hover {
1856
- color: var(--dpk-ink-soft);
1857
- }
1858
-
1859
- .thread-reply:focus-visible {
1860
- outline: none;
1861
- box-shadow: inset var(--dpk-focus);
1862
- }
1863
-
1864
- .thread-compose {
1865
- display: grid;
1866
- gap: 6px;
1867
- padding: 8px 12px;
1868
- border-top: 1px solid var(--dpk-rule);
1869
- }
1870
- `],Kt="SUGGEST_CHANGE",zi=w({text:v()}),Vt=(n,t)=>`${n}
1871
- ${t}`,Mi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines.map(l=>[Vt(o.path,lt(l)),l])))),a=new Map,i=e.map(o=>{if(o.type!==Kt)return{id:o.id,title:o.type,stale:"unsupported-action-type"};const r=ze(o.target.id),[,l,u,c]=r??[],m=n.suggestTitle(u??o.target.id,c?.startsWith("R")?c.slice(1):c??""),k=Pt(zi,o.payload);if(l!=="line"||u===void 0||c===void 0||!c.startsWith("R"))return{id:o.id,title:m,stale:"target-missing"};if(!k.success)return{id:o.id,title:m,stale:"constraint-violated"};const L=Vt(u,c);return s.has(L)?(a.set(L,[...a.get(L)??[],{action:o.id,text:k.output.text}]),{id:o.id,title:m,summary:k.output.text,tone:"update"}):{id:o.id,title:m,stale:"target-missing"}});return{byLine:a,results:i}},Ti='script[type="text/x-diff"], script[type="text/plain"]',Ct=n=>n.newLine!==null,ht=(n,t)=>`${n}#${t}`,St=n=>`${n}#reply`,ks=4,Jt=6;class vs extends z{static{this.styles=Ei}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},view:{type:String,reflect:!0},diff:{type:String,attribute:!1}}}#a=new P(this,()=>{this.#o="",this.#y()});#t=new it(this);#e=new MutationObserver(()=>{this.#w()});#n=null;#s=rs();#i=null;#r=new Map;#o="";#d=new Set;#c=[];#p=[];#m=new Map;#h=null;#l=new Map;#u=null;#f=null;#x=[];#k=new Map;#v=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.view="split",this.diff=""}connectedCallback(){super.connectedCallback(),this.#o="",this.#e.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.#w()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}willUpdate(t){t.has("diff")&&this.#w()}updated(){this.#S(),this.#t.sync(this.renderRoot.querySelector(".comment-pop"));const t=this.#f;this.#f=null;const e=t==="text"?".composer textarea":t==="tab"?'.composer [aria-selected="true"]':t==="reply"?".thread textarea":null;e!==null&&this.renderRoot.querySelector(e)?.focus({preventScroll:!0})}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#g.heading} \xB7 ${this.id}`;return[...this.#r].map(([e,s])=>({value:e,label:s,group:t}))}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#y()}get elementComments(){return this.#x}set elementComments(t){this.#x=t;const e=new Map;for(const s of t){const a=`element:${s.target.id}`;e.set(a,[...e.get(a)??[],s])}this.#k=e,this.requestUpdate()}get elementActionResults(){return this.#p}get files(){return this.#s.files}get dataError(){return this.#i}getContextMenuItems(t){const e=[],s=kt(t.target,this.commentTargets,Tt(this.#a.locale),(o,r)=>this.#T(o,r));s!==null&&e.push(s);const a=t.target===null?null:ce(t.target),i=a===null?null:this.#M(a);return i!==null&&Ct(i.line)&&e.push({id:"suggest-change",entries:[{kind:"item",id:"suggest-change",label:this.#g.suggestChange,run:()=>this.#L(i,"suggest")}]}),e.length===0?null:e}get#g(){return si(this.#a.locale)}get#z(){const t=this.querySelector(Ti);return t===null?this.diff:t.textContent??""}#w(){const t=this.#z;if(t!==this.#n){this.#n=t;try{this.#s=ps(t),this.#i=null}catch(e){this.#s=rs(),this.#i=e instanceof Error?e.message:String(e),console.error("[dev-process-kit] invalid diff:",this.#i)}this.#y()}}#y(){const t=this.#g;this.#r=new Map(Ci(t,this.#s).map(({target:s,label:a})=>[this.#b(s),a]));const e=Mi(t,this.#s,this.#c);this.#m=e.byLine,this.#p=e.results,this.requestUpdate()}#b(t){return`element:${[this.id,...gi(t)].map(e=>encodeURIComponent(e)).join("/")}`}#S(){const t=JSON.stringify(this.commentTargets);t!==this.#o&&(this.#o=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#M(t){if(!this.id)return null;for(const e of this.#s.files)for(const s of e.hunks)for(const a of s.lines)if(this.#b({kind:"line",path:e.path,line:lt(a)})===t)return{ref:t,path:e.path,line:a,label:bs(this.#g,e.path,a)};return null}#T(t,e){const s=this.#M(t);if(s!==null){this.#L(s,"comment");return}const a=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);a!==null&&this.#t.open(t,a,e)}#A(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}#L(t,e){this.#d.has(t.path)&&this.#q(t.path),this.#h={...t,tab:e==="suggest"&&!Ct(t.line)?"comment":e},this.#u=null,this.#f="text",this.requestUpdate()}#P(t,e){const s=this.#h;s===null||s.tab===t||!Ct(s.line)||(this.#h={...s,tab:t},this.#u=null,this.#f=e,this.requestUpdate())}#I(t){this.#v=t,this.#u=null,this.#f="reply",this.requestUpdate()}#C(t){const e=this.#v;if(e!==null){if(t){const s=new Map(this.#l);s.delete(St(e)),this.#l=s}this.#v=null,this.#u=null,this.requestUpdate()}}#E(t){const e=(this.#l.get(St(t))??"").trim();if(e!==""){if(!this.#A(t,e)){this.#u=St(t),this.requestUpdate();return}this.#C(!0)}}#R(t){const e=this.#h;if(e!==null){if(t){const s=new Map(this.#l);s.delete(ht(e.ref,"comment")),s.delete(ht(e.ref,"suggest")),this.#l=s}this.#h=null,this.#u=null,this.requestUpdate()}}#$(t){return this.#l.get(ht(t.ref,t.tab))??(t.tab==="suggest"?t.line.text:"")}#O(t){const e=this.#$(t);return t.tab==="suggest"?e!==t.line.text:e.trim()!==""}#D(){const t=this.#h;if(t===null||!this.#O(t))return;const e=this.#$(t);if(!(t.tab==="comment"?this.#A(t.ref,e.trim()):this.#U(t,e))){this.#u=ht(t.ref,t.tab),this.requestUpdate();return}this.#R(!0)}#U(t,e){return!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:Kt,target:t.ref,payload:{text:e}},bubbles:!0,composed:!0,cancelable:!0}))}#q(t){const e=new Set(this.#d);e.delete(t)||e.add(t),this.#d=e,this.requestUpdate()}#G(t){this.view=t}render(){const t=this.#g,e=Si(this.#s),s=this.view==="split"?"split":"unified";return d`
1872
- <section class="diff" data-view=${s}>
1873
- <header class="toolbar">
1874
- <span class="title">${this.heading??t.heading}</span>
1875
- <span class="summary">
1876
- ${t.summary(e.files)}
1877
- <span class="stat-add">+${e.additions}</span>
1878
- <span class="stat-del">−${e.deletions}</span>
1879
- </span>
1880
- <span class="views" role="group" aria-label=${t.viewLabel}>
1881
- ${["unified","split"].map(a=>d`<button
1882
- type="button"
1883
- aria-pressed=${s===a?"true":"false"}
1884
- @click=${()=>this.#G(a)}
1885
- >
1886
- ${t[a]}
1887
- </button>`)}
1888
- </span>
1889
- </header>
1890
- ${this.#i===null?h:d`<p class="notice" role="alert">${t.dataError}<br />${this.#i}</p>`}
1891
- ${this.#i===null&&e.files===0?d`<p class="empty">${t.empty}</p>`:h}
1892
- ${U(this.#s.files,a=>a.path,a=>this.#K(a,s))}
1893
- </section>
1894
- ${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#A(a,i)})}
1895
- `}#K(t,e){const s=this.#g,a=!this.#d.has(t.path),i=this.#b({kind:"file",path:t.path}),o=(t.status==="renamed"||t.status==="copied")&&t.oldPath!==null;return d`<section class="file" data-path=${t.path} data-status=${t.status}>
1896
- <header class="file-head" data-dpk-target=${this.id?i:h}>
1897
- <button
1898
- type="button"
1899
- class="dpk-icon-btn toggle"
1900
- data-size="sm"
1901
- aria-expanded=${a?"true":"false"}
1902
- aria-label=${a?s.collapse(t.path):s.expand(t.path)}
1903
- @click=${()=>this.#q(t.path)}
1904
- >
1905
- ${me()}
1906
- </button>
1907
- <span class="status" data-status=${t.status}>${s[t.status]}</span>
1908
- <span class="path"
1909
- >${o?d`<span class="old-path">${t.oldPath}</span> → `:h}${t.path}</span
1910
- >
1911
- <span class="file-stat"
1912
- ><span class="stat-add">+${t.additions}</span> <span class="stat-del">−${t.deletions}</span></span
1913
- >
1914
- ${this.id?this.#X(i,t.path):h}
1915
- </header>
1916
- ${a?this.#Y(i):h} ${a?this.#V(t,e):h}
1917
- </section>`}#V(t,e){const s=this.#g;if(t.binary)return d`<p class="file-note">${s.binary}</p>`;if(t.hunks.length===0){const a=t.oldMode!==null&&t.newMode!==null&&t.oldMode!==t.newMode?s.modeChanged(t.oldMode,t.newMode):s.noContentChange;return d`<p class="file-note">${a}</p>`}return d`<div class="scroll" data-dpk-check="off">
1918
- <table class="lines" data-view=${e}>
1919
- ${e==="split"?this.#Z(t):this.#J(t)}
1920
- </table>
1921
- </div>`}#J(t){return d`<colgroup>
1922
- <col class="col-num" />
1923
- <col class="col-num" />
1924
- <col class="col-act" />
1925
- <col />
1926
- </colgroup>
1927
- <tbody>
1928
- ${xi(t).map(e=>{if(e.kind==="hunk")return this.#H(e.hunk,ks);const{cell:s}=e,a=this.#j(t,s);return d`<tr
1929
- class="line"
1930
- data-kind=${s.line.kind}
1931
- data-line=${s.id}
1932
- data-dpk-target=${a??h}
1933
- >
1934
- <td class="num">${s.line.oldLine??""}</td>
1935
- <td class="num">${s.line.newLine??""}</td>
1936
- <td class="act">${this.#W(t,s,a)}</td>
1937
- ${this.#_(s)}
1938
- </tr>
1939
- ${this.#N(t,s,ks)}`})}
1940
- </tbody>`}#Z(t){return d`<colgroup>
1941
- <col class="col-num" />
1942
- <col class="col-act" />
1943
- <col class="col-half" />
1944
- <col class="col-num" />
1945
- <col class="col-act" />
1946
- <col class="col-half" />
1947
- </colgroup>
1948
- <tbody>
1949
- ${yi(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,Jt):d`<tr class="pair">
1950
- ${this.#F(t,e.left,"old")} ${this.#F(t,e.right,"new")}
1951
- </tr>
1952
- ${e.left!==null&&e.left.target?this.#N(t,e.left,Jt):h}
1953
- ${e.right===null?h:this.#N(t,e.right,Jt)}`)}
1954
- </tbody>`}#F(t,e,s){if(e===null)return d`<td class="num" data-blank></td>
1955
- <td class="act" data-blank></td>
1956
- <td class="code" data-blank></td>`;const a=this.#j(t,e),i=s==="old"?e.line.oldLine:e.line.newLine;return d`<td class="num" data-kind=${e.line.kind}>${i??""}</td>
1957
- <td class="act" data-kind=${e.line.kind}>${this.#W(t,e,a)}</td>
1958
- ${this.#_(e,a)}`}#H(t,e){const s=`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`;return d`<tr class="hunk">
1959
- <td colspan=${e}>
1960
- <span class="hunk-range">${s}</span
1961
- >${t.section===""?h:d` <span class="hunk-section">${t.section}</span>`}
1962
- </td>
1963
- </tr>`}#_(t,e){const s=t.line.kind==="add"?"+":t.line.kind==="del"?"-":" ";return d`<td class="code" data-kind=${t.line.kind} data-dpk-target=${e??h}>
1964
- <span class="sign" aria-hidden="true">${s}</span
1965
- ><span class="text"
1966
- >${t.segments.map(a=>a.kind===null&&!a.changed?a.text:d`<span class=${a.kind??h} ?data-changed=${a.changed}>${a.text}</span>`)}</span
1967
- >${t.line.noNewline?d`<span class="no-newline" title=${this.#g.noNewline} aria-label=${this.#g.noNewline}>⊘</span>`:h}
1968
- </td>`}#j(t,e){return!this.id||!e.target?null:this.#b({kind:"line",path:t.path,line:e.id})}#W(t,e,s){if(s===null)return h;const a=this.#r.get(s)??t.path,i=this.#h?.ref===s;return d`<span class="line-actions" ?data-open=${i}
1969
- ><button
1970
- type="button"
1971
- class="line-btn"
1972
- aria-label=${this.#g.addOn(a)}
1973
- aria-expanded=${i?"true":"false"}
1974
- title=${this.#g.addOn(a)}
1975
- @click=${()=>this.#L({ref:s,path:t.path,line:e.line,label:a},"comment")}
1976
- >
1977
- ${pe()}
1978
- </button></span
1979
- >`}#X(t,e){return d`<button
1980
- type="button"
1981
- class="dpk-icon-btn"
1982
- data-size="sm"
1983
- aria-label=${this.#g.commentOn(e)}
1984
- title=${this.#g.commentOn(e)}
1985
- @click=${()=>this.#T(t,e)}
1986
- >
1987
- ${At()}
1988
- </button>`}#N(t,e,s){const a=e.line.newLine===null?[]:this.#m.get(Vt(t.path,e.id))??[],i=this.#j(t,e),o=i===null?[]:this.#k.get(i)??[],r=i!==null&&this.#h?.ref===i?this.#h:null;return o.length===0&&a.length===0&&r===null?h:d`${i===null||o.length===0?h:d`<tr class="extra">
1989
- <td colspan=${s}>${this.#B(i,o)}</td>
1990
- </tr>`}${a.map(l=>d`<tr class="extra">
1991
- <td colspan=${s}>${this.#Q(e.line,l)}</td>
1992
- </tr>`)}${r===null?h:d`<tr class="extra">
1993
- <td colspan=${s}>${this.#tt(r)}</td>
1994
- </tr>`}`}#Y(t){const e=this.#k.get(t)??[];return!this.id||e.length===0?h:d`<div class="file-thread">${this.#B(t,e)}</div>`}#B(t,e){const s=this.#g,a=this.#r.get(t)??"",i=St(t),o=this.#l.get(i)??"",r=new Intl.DateTimeFormat(this.#a.locale,{dateStyle:"short",timeStyle:"short"});return d`<section class="thread" data-thread=${t} aria-label=${s.threadOn(a)}>
1995
- <ol class="thread-items">
1996
- ${e.map(l=>{const u=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
1997
- <p class="thread-meta">
1998
- ${At()}
1999
- ${Number.isNaN(u.getTime())?h:d`<time datetime=${l.createdAt}>${r.format(u)}</time>`}
2000
- </p>
2001
- <p class="thread-body">${gn(l)}</p>
2002
- </li>`})}
2003
- </ol>
2004
- ${this.#v===t?d`<div
2005
- class="thread-compose"
2006
- @keydown=${l=>{l.isComposing||(l.key==="Escape"?(l.preventDefault(),l.stopPropagation(),this.#C(!1)):l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),this.#E(t)))}}
2007
- >
2008
- <textarea
2009
- class="dpk-textarea"
2010
- rows="3"
2011
- aria-label=${s.reply}
2012
- data-dpk-text-key=${i}
2013
- .value=${o}
2014
- @input=${l=>{l.currentTarget instanceof HTMLTextAreaElement&&(this.#l=new Map(this.#l).set(i,l.currentTarget.value),this.#u=null,this.requestUpdate())}}
2015
- ></textarea>
2016
- ${this.#u===i?d`<p class="composer-error" role="alert">${s.sendFailed}</p>`:h}
2017
- <div class="composer-actions">
2018
- <button
2019
- class="dpk-btn dpk-btn--accent"
2020
- type="button"
2021
- ?disabled=${o.trim()===""}
2022
- @click=${()=>this.#E(t)}
2023
- >
2024
- ${s.reply}
2025
- </button>
2026
- <button
2027
- class="dpk-btn dpk-btn--ghost"
2028
- type="button"
2029
- data-dpk-text-discard
2030
- @click=${()=>this.#C(!0)}
2031
- >
2032
- ${s.cancel}
2033
- </button>
2034
- </div>
2035
- </div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#I(t)}>
2036
- ${s.replyPlaceholder}
2037
- </button>`}
2038
- </section>`}#Q(t,e){const s=e.text===""?[]:e.text.split(`
2039
- `);return d`<div class="suggestion" data-action=${e.action}>
2040
- <p class="suggestion-head">${fn()} ${this.#g.suggestion}</p>
2041
- <div class="suggestion-lines">
2042
- <div class="suggestion-line" data-kind="del">
2043
- <span class="sign">-</span><span class="text">${t.text}</span>
2044
- </div>
2045
- ${s.map(a=>d`<div class="suggestion-line" data-kind="add">
2046
- <span class="sign">+</span><span class="text">${a}</span>
2047
- </div>`)}
2048
- </div>
2049
- </div>`}#tt(t){const e=this.#g,s=this.#$(t),a=Math.min(12,Math.max(3,s.split(`
2050
- `).length+1)),i=ht(t.ref,t.tab),o=Ct(t.line)?d`<div
2051
- class="composer-tabs"
2052
- role="tablist"
2053
- aria-label=${e.composerTabs}
2054
- @keydown=${r=>{r.key!=="ArrowLeft"&&r.key!=="ArrowRight"||(r.preventDefault(),this.#P(t.tab==="comment"?"suggest":"comment","tab"))}}
2055
- >
2056
- ${["comment","suggest"].map(r=>d`<button
2057
- type="button"
2058
- role="tab"
2059
- aria-selected=${t.tab===r?"true":"false"}
2060
- tabindex=${t.tab===r?0:-1}
2061
- @click=${()=>this.#P(r,"text")}
2062
- >
2063
- ${r==="comment"?e.comment:e.suggestChange}
2064
- </button>`)}
2065
- </div>`:d`<strong class="composer-title">${e.comment}</strong>`;return d`<div
2066
- class="composer"
2067
- data-tab=${t.tab}
2068
- @keydown=${r=>{r.isComposing||(r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),this.#R(!1)):r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),this.#D()))}}
2069
- >
2070
- <div class="composer-head">${o}<span class="composer-target">${t.label}</span></div>
2071
- <textarea
2072
- class="dpk-textarea"
2073
- rows=${a}
2074
- spellcheck=${t.tab==="suggest"?"false":"true"}
2075
- aria-label=${t.tab==="suggest"?e.suggestionLabel:e.comment}
2076
- data-dpk-text-key=${i}
2077
- .value=${s}
2078
- @input=${r=>{r.currentTarget instanceof HTMLTextAreaElement&&(this.#l=new Map(this.#l).set(i,r.currentTarget.value),this.#u=null,this.requestUpdate())}}
2079
- ></textarea>
2080
- ${this.#u===i?d`<p class="composer-error" role="alert">${e.unrecorded}</p>`:h}
2081
- <div class="composer-actions">
2082
- <button
2083
- class="dpk-btn dpk-btn--accent"
2084
- type="button"
2085
- ?disabled=${!this.#O(t)}
2086
- @click=${()=>this.#D()}
2087
- >
2088
- ${t.tab==="suggest"?e.suggest:e.addComment}
2089
- </button>
2090
- <button
2091
- class="dpk-btn dpk-btn--ghost"
2092
- type="button"
2093
- data-dpk-text-discard
2094
- @click=${()=>this.#R(!0)}
2095
- >
2096
- ${e.cancel}
2097
- </button>
2098
- </div>
2099
- </div>`}}const xs=()=>{customElements.get("dpk-diff")||customElements.define("dpk-diff",vs)},Ai=D({en:{heading:"Content",untitled:"Untitled",sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u672C\u6587",untitled:"\u7121\u984C",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),Li=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,Ri=n=>{const t=Li.exec(n?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},ys=60,Di=(n,t,e,s)=>{const a=[n,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return a===void 0?s:a.length>ys?`${a.slice(0,ys-1)}\u2026`:a},ut=n=>`${n.kind}:${n.id}`,Pi=n=>{const t=new Map;for(const e of n)t.set(ut(e),(t.get(ut(e))??0)+1);return n.filter(e=>t.get(ut(e))===1)},ws=(n,t)=>`element:${[n,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,Oi="[data-dpk-item]",qi="h1, h2, h3, h4, h5, h6, summary, caption, legend";class $s extends z{static{this.styles=[T,B,gt,M`
2100
- :host {
2101
- position: relative;
2102
- display: block;
2103
- font-size: inherit;
2104
- line-height: inherit;
2105
- color: inherit;
2106
- }
2107
- .comment-error {
2108
- margin: 0;
2109
- font-size: 11px;
2110
- color: var(--dpk-accent);
2111
- }
2112
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new P(this);#t=new it(this);#e=new MutationObserver(()=>{this.#c()});#n=[];#s=new Set;#i="";constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#e.observe(this,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["data-dpk-item","data-dpk-label"]}),this.#c()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#d.heading} \xB7 ${this.id}`;return this.#n.map(e=>({value:ws(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#m()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=kt(t.target,this.commentTargets,Tt(this.#a.locale),(s,a)=>this.#r(s,a));return e===null?null:[e]}#r(t,e){const s=this.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#t.open(t,s,e)}#o(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}render(){return d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:this.#d.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#d(){return Ai(this.#a.locale)}#c(){const t=[...this.querySelectorAll(Oi)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const a=Ri(s.getAttribute("data-dpk-item"));if(a===null)return[];const i=s.querySelector(qi)?.textContent??null,o=Di(s.getAttribute("data-dpk-label"),i,s.textContent,this.#d.untitled);return[{...a,label:o,element:s}]}),e=Pi(t);if(e.length<t.length){const s=new Set(e.map(ut)),a=[...new Set(t.map(ut).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,a)}this.#n=e,this.#p(),this.#m()}#p(){const t=new Set(this.#n.map(e=>e.element));for(const e of this.#s)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#n)e.element.setAttribute("data-dpk-target",ws(this.id,e));this.#s=t}#m(){const t=JSON.stringify(this.commentTargets);t!==this.#i&&(this.#i=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}}const Cs=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",$s)},Ii="dpk-extend-right-click-run",Zt=C(v(),E(1)),Y=C(v(),E(1)),Ui=w({kind:V("item"),id:Zt,label:Y,danger:g(at()),event:g(Y),detail:g(Tn(v(),Dt())),copy:g(Y)}),ji=w({kind:V("submenu"),id:Zt,label:Y,entries:$(we(()=>Ss))}),Ss=we(()=>xe("kind",[Ui,ji])),Ni=w({id:Zt,heading:g(Y),entries:$(Ss)}),Fi=w({selector:C(v(),ye(),E(1)),label:g(Y),groups:$(Ni)}),Hi=w({targets:$(Fi)}),Es=(n,t)=>{for(const e of n){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&Es(e.entries,t)}},Xt=n=>{const t=W(Hi,n),e=new Set;for(const s of t.targets)for(const a of s.groups){if(e.has(a.id))throw new Error(`duplicate id: ${a.id}`);e.add(a.id),Es(a.entries,e)}return t},zs="dpk-extend-right-click",Yt=`[dev-process-kit] ${zs}: `,_i="text",Wi=(n,t)=>{const e=bn(n,n),s=e.indexOf(t);return s===-1?null:[n,...e.slice(0,s)]},Bi=(n,t)=>{const s=(t===_i?n.textContent:n.getAttribute(t))?.trim()??"";return s===""?null:s},Gi=(n,t,e)=>{try{return n.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${Yt}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class Ms extends z{static{this.styles=M`
2113
- :host {
2114
- display: contents;
2115
- }
2116
- `}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=_(this,Xt,t=>{if(t.ok){this.#a=t.value,this.#t=null;return}this.#a=null,this.#t=t.error,console.warn(`${Yt}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#s();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const a=Wi(s,this);if(a===null||a.some(r=>r.localName===zs))return null;const i=this.#r(a,e);if(i===null)return null;const o=this.#o(i.target,i.element);return o.length===0?null:o}render(){return d`<slot></slot>`}#s(){return this.config===null?this.#a:(this.#n?.raw!==this.config&&(this.#n={raw:this.config,parsed:this.#i(this.config)}),this.#n.parsed)}#i(t){try{return Xt(t)}catch(e){return console.warn(`${Yt}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const a of t)for(const i of e.targets)if(Gi(a,i.selector,s))return{target:i,element:a};return null}#o(t,e){return t.groups.flatMap(s=>{const a=this.#d(s.entries,s,t,e);return a.length===0?[]:[s.heading===void 0?{id:s.id,entries:a}:{id:s.id,heading:s.heading,entries:a}]})}#d(t,e,s,a){return t.flatMap(i=>i.kind==="submenu"?this.#c(i,e,s,a):this.#p(i,e,s,a))}#c(t,e,s,a){const i=this.#d(t.entries,e,s,a);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,a){const i=t.copy===void 0?null:Bi(a,t.copy);if(t.copy!==void 0&&i===null)return[];const o=()=>{i!==null&&Lt(i),!(i!==null&&t.event===void 0)&&this.#m(t,e,s,a)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:o,danger:!0}:{kind:"item",id:t.id,label:t.label,run:o}]}#m(t,e,s,a){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:a,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??Ii,{detail:i,bubbles:!0,composed:!0}))}}const Ts=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",Ms)},Ki=D({en:{sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}});class As extends z{static{this.styles=[T,B,gt,M`
2117
- :host {
2118
- position: relative;
2119
- display: inline-block;
2120
- }
2121
- .comment-error {
2122
- margin: 0;
2123
- font-size: 11px;
2124
- color: var(--dpk-accent);
2125
- /* A refusal lands under the composer it belongs to, rather than
2126
- simply being there when the reader looks back. */
2127
- animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
2128
- }
2129
- `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new P(this);#t=new it(this);constructor(){super(),this.target="",this.label=null,this.open=!1,this.addEventListener("click",this.#e)}#e=()=>{this.open=!0};get commentTargets(){return this.target.length===0?[]:[{value:this.target,label:this.label??this.target}]}willUpdate(t){t.has("target")&&(this.target.length===0?this.removeAttribute("data-dpk-target"):this.setAttribute("data-dpk-target",this.target)),t.has("open")&&(this.open&&!this.#t.isOpen?this.#t.open(this.target,this,this.label??void 0):!this.open&&this.#t.isOpen&&this.#t.close())}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop")),this.open!==this.#t.isOpen&&(this.open=this.#t.isOpen)}render(){return d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:Ki(this.#a.locale).sendFailed,submit:(t,e)=>this.#n(t,e)})}`}#n(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const Ls=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",As)},Rs=(n,t)=>{const e=t===null?-1:n.indexOf(t);return e===-1?0:e},Vi=(n,t,e)=>{if(e===0)return null;switch(n){case"ArrowRight":case"ArrowDown":return(t+1)%e;case"ArrowLeft":case"ArrowUp":return(t-1+e)%e;case"Home":return 0;case"End":return e-1;default:return null}},Ji=":scope > [data-name]";let Zi=0;class Ds extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[T,M`
2130
- :host {
2131
- display: block;
2132
- font-size: inherit;
2133
- line-height: inherit;
2134
- color: inherit;
2135
- }
2136
-
2137
- [role='tablist'] {
2138
- position: relative;
2139
- display: flex;
2140
- gap: 2px;
2141
- margin-bottom: 12px;
2142
- padding: 3px;
2143
- width: fit-content;
2144
- max-width: 100%;
2145
- overflow-x: auto;
2146
- border-radius: var(--dpk-radius);
2147
- background: var(--dpk-paper-sunken);
2148
- }
2149
-
2150
- /*
2151
- * The raised chip the reader picked, drawn once and slid between the
2152
- * tabs instead of each tab painting its own: the selection is a thing
2153
- * that moves, so the eye follows it. It is placed by the two custom
2154
- * properties 'updated()' measures off the selected tab, and it is
2155
- * absolutely positioned inside the padding box, which is what
2156
- * 'offsetLeft' counts from too.
2157
- */
2158
- .indicator {
2159
- position: absolute;
2160
- top: 3px;
2161
- left: 0;
2162
- z-index: 0;
2163
- width: var(--dpk-tabs-indicator-w, 0px);
2164
- height: calc(100% - 6px);
2165
- border: 1px solid var(--dpk-rule-strong);
2166
- border-radius: var(--dpk-radius-sm);
2167
- background: var(--dpk-paper-raised);
2168
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
2169
- transform: translateX(var(--dpk-tabs-indicator-x, 0px));
2170
- pointer-events: none;
2171
- transition:
2172
- transform var(--dpk-dur) var(--dpk-ease),
2173
- width var(--dpk-dur) var(--dpk-ease);
2174
- }
2175
-
2176
- /* Before the first measurement there is nothing to slide, and nothing to
2177
- slide it from: the indicator is hidden until the tablist says where. */
2178
- [role='tablist']:not([data-ready]) .indicator {
2179
- opacity: 0;
2180
- transition: none;
2181
- }
2182
-
2183
- [role='tab'] {
2184
- position: relative;
2185
- z-index: 1;
2186
- flex: none;
2187
- padding: 5px 12px;
2188
- border: 1px solid transparent;
2189
- border-radius: var(--dpk-radius-sm);
2190
- background: transparent;
2191
- color: var(--dpk-ink-soft);
2192
- font-size: 12.5px;
2193
- font-weight: 550;
2194
- cursor: pointer;
2195
- transition:
2196
- color var(--dpk-dur-fast) var(--dpk-ease),
2197
- border-color var(--dpk-dur-fast) var(--dpk-ease);
2198
- }
2199
-
2200
- [role='tab']:hover {
2201
- color: var(--dpk-ink);
2202
- }
2203
-
2204
- [role='tab'][aria-selected='true'] {
2205
- color: var(--dpk-ink);
2206
- font-weight: 650;
2207
- }
2208
-
2209
- [role='tab']:focus-visible {
2210
- outline: none;
2211
- box-shadow: var(--dpk-focus);
2212
- }
2213
-
2214
- /*
2215
- * The panel the reader just picked fades in under the strip. A slotted
2216
- * panel that is not the current one is not rendered at all, so its
2217
- * animation starts again when it is assigned back to the slot.
2218
- */
2219
- ::slotted([data-name]) {
2220
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
2221
- }
2222
- `]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++Zi}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#s()):null;constructor(){super(),this.selected=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-name"]}),this.#e?.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#e?.disconnect()}get#n(){return[...this.querySelectorAll(Ji)]}render(){const t=this.#n,e=t.map(a=>a.dataset.name??""),s=Rs(e,this.selected);return d`<div role="tablist" @keydown=${this.#r}>
2223
- <span class="indicator" aria-hidden="true"></span>
2224
- ${U(e,(a,i)=>`${i}:${a}`,(a,i)=>d`<button
2225
- type="button"
2226
- role="tab"
2227
- id="${this.#a}-tab-${i}"
2228
- aria-selected=${i===s?"true":"false"}
2229
- aria-controls="${this.#a}-panel"
2230
- tabindex=${i===s?0:-1}
2231
- @click=${()=>{this.#i(a)}}
2232
- >
2233
- ${t[i]?.dataset.label??a}
2234
- </button>`)}
2235
- </div>
2236
- <div role="tabpanel" id="${this.#a}-panel" aria-labelledby="${this.#a}-tab-${s}">
2237
- <slot></slot>
2238
- </div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[Rs(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...a===void 0?[]:[a]),this.#s()}#s(){const t=this.renderRoot.querySelector('[role="tablist"]'),e=this.renderRoot.querySelector('[role="tab"][aria-selected="true"]');t===null||e===null||(t.style.setProperty("--dpk-tabs-indicator-x",`${e.offsetLeft}px`),t.style.setProperty("--dpk-tabs-indicator-w",`${e.offsetWidth}px`),!(t.hasAttribute("data-ready")||typeof requestAnimationFrame!="function")&&requestAnimationFrame(()=>{t.setAttribute("data-ready","")}))}#i(t){t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("dpk-tab-change",{detail:{name:t},bubbles:!0,composed:!0})))}#r=t=>{const e=[...this.renderRoot.querySelectorAll('[role="tab"]')],s=e.findIndex(o=>o.getAttribute("aria-selected")==="true"),a=Vi(t.key,s,e.length);if(a===null)return;t.preventDefault();const i=this.#n[a]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[a]?.focus()})}}const Ps=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",Ds)},Xi=D({en:{heading:"Checklist",empty:"No items.",progress:(n,t)=>`${n} / ${t} done`,actionTitle:(n,t)=>`${t?"Checked":"Unchecked"}: ${n}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:n=>`Comment on ${n}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(n,t)=>`${n} / ${t} \u5B8C\u4E86`,actionTitle:(n,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${n}`,unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`}}),Os="SET_CHECKED",Yi=w({id:C(v(),$e(/^[A-Za-z0-9_-]+$/)),label:C(v(),E(1)),checked:g(at()),note:g(v())}),Qi=w({items:$(Yi)}),qs=()=>({items:[]}),Is=n=>{const t=W(Qi,n),e=new Set;return{items:t.items.map(s=>{if(e.has(s.id))throw new Error(`duplicate item id: ${s.id}`);return e.add(s.id),{id:s.id,label:s.label,checked:s.checked??!1,note:s.note??null,changed:!1}})}},tr=Rt({checked:at()}),er=(n,t,e)=>{const s=new Map(t.items.map(o=>[o.id,o.checked])),a=new Map(s),i=e.map(o=>{if(o.type!==Os)return{id:o.id,title:o.type,stale:"unsupported-action-type"};const r=ze(o.target.id),l=r?.[1]==="item"?r[2]:void 0,u=Pt(tr,o.payload);if(l===void 0||!a.has(l)||!u.success)return{id:o.id,title:n.actionTitle(l??o.target.id,!0),stale:"target-missing"};a.set(l,u.output.checked);const c=t.items.find(m=>m.id===l)?.label??l;return{id:o.id,title:n.actionTitle(c,u.output.checked),tone:"update"}});return{data:{items:t.items.map(o=>{const r=a.get(o.id)??o.checked;return{...o,checked:r,changed:r!==s.get(o.id)}})},results:i}},sr=n=>({done:n.items.filter(t=>t.checked).length,total:n.items.length});class Us extends z{static{this.styles=[T,M`
2239
- :host {
2240
- display: block;
2241
- color: var(--dpk-ink);
2242
- }
2243
-
2244
- .card {
2245
- border: 1px solid var(--dpk-rule);
2246
- border-radius: var(--dpk-radius-lg);
2247
- background: var(--dpk-paper-raised);
2248
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
2249
- padding: 14px 16px 12px;
2250
- }
2251
-
2252
- .head {
2253
- display: flex;
2254
- align-items: baseline;
2255
- justify-content: space-between;
2256
- gap: 12px;
2257
- }
2258
-
2259
- .heading {
2260
- font-family: var(--dpk-display);
2261
- font-size: 15px;
2262
- font-weight: 650;
2263
- letter-spacing: -0.01em;
2264
- }
2265
-
2266
- .count {
2267
- font-family: var(--dpk-mono);
2268
- font-size: 12.5px;
2269
- font-variant-numeric: tabular-nums;
2270
- }
2271
-
2272
- .count-done {
2273
- color: var(--dpk-ink);
2274
- font-weight: 650;
2275
- }
2276
-
2277
- .count-total {
2278
- color: var(--dpk-ink-soft);
2279
- }
2280
-
2281
- .track {
2282
- height: 6px;
2283
- margin: 10px 0 14px;
2284
- border-radius: 999px;
2285
- background: var(--dpk-paper-sunken);
2286
- overflow: hidden;
2287
- }
2288
-
2289
- .fill {
2290
- height: 100%;
2291
- border-radius: 999px;
2292
- background: var(--dpk-accent);
2293
- transition: width 0.3s var(--dpk-ease);
2294
- }
2295
-
2296
- ul {
2297
- display: grid;
2298
- gap: 2px;
2299
- margin: 0;
2300
- padding: 0;
2301
- list-style: none;
2302
- }
2303
-
2304
- li {
2305
- display: grid;
2306
- grid-template-columns: auto 1fr auto;
2307
- align-items: center;
2308
- gap: 10px;
2309
- min-height: 36px;
2310
- padding: 2px 8px;
2311
- border-radius: var(--dpk-radius-sm);
2312
- }
2313
-
2314
- li:hover,
2315
- li:focus-within,
2316
- li:active {
2317
- background: var(--dpk-paper-sunken);
2318
- }
2319
-
2320
- li[data-changed] {
2321
- background: color-mix(in srgb, var(--dpk-blue-soft) 60%, transparent);
2322
- }
2323
-
2324
- .check {
2325
- position: relative;
2326
- display: inline-grid;
2327
- place-items: center;
2328
- width: 20px;
2329
- height: 20px;
2330
- }
2331
-
2332
- .check-input {
2333
- position: absolute;
2334
- inset: 0;
2335
- margin: 0;
2336
- opacity: 0;
2337
- cursor: pointer;
2338
- }
2339
-
2340
- .check-mark {
2341
- display: inline-grid;
2342
- place-items: center;
2343
- width: 20px;
2344
- height: 20px;
2345
- border: 2px solid var(--dpk-rule-strong);
2346
- border-radius: 50%;
2347
- background: transparent;
2348
- color: var(--dpk-accent-ink);
2349
- pointer-events: none;
2350
- transition:
2351
- background 0.15s var(--dpk-ease),
2352
- border-color 0.15s var(--dpk-ease);
2353
- }
2354
-
2355
- .check-mark svg {
2356
- width: 12px;
2357
- height: 12px;
2358
- opacity: 0;
2359
- transform: scale(0.5);
2360
- transition:
2361
- opacity 0.15s var(--dpk-ease),
2362
- transform 0.15s var(--dpk-ease-spring);
2363
- }
2364
-
2365
- .check-input:checked ~ .check-mark {
2366
- border-color: var(--dpk-accent);
2367
- background: var(--dpk-accent);
2368
- }
2369
-
2370
- .check-input:checked ~ .check-mark svg {
2371
- opacity: 1;
2372
- transform: scale(1);
2373
- }
2374
-
2375
- .check-input:focus-visible ~ .check-mark {
2376
- box-shadow: var(--dpk-focus);
2377
- }
2378
-
2379
- label {
2380
- display: grid;
2381
- gap: 2px;
2382
- cursor: pointer;
2383
- }
2384
-
2385
- [data-checked] .label {
2386
- color: var(--dpk-ink-soft);
2387
- text-decoration: line-through;
2388
- }
2389
-
2390
- .note {
2391
- color: var(--dpk-ink-soft);
2392
- font-size: 12px;
2393
- }
2394
-
2395
- .comment {
2396
- display: inline-grid;
2397
- place-items: center;
2398
- width: 24px;
2399
- height: 24px;
2400
- padding: 0;
2401
- border: 0;
2402
- border-radius: var(--dpk-radius-sm);
2403
- background: transparent;
2404
- color: var(--dpk-ink-soft);
2405
- opacity: 0;
2406
- cursor: pointer;
2407
- }
2408
-
2409
- li:hover .comment,
2410
- li:focus-within .comment {
2411
- opacity: 1;
2412
- }
2413
-
2414
- .comment:hover {
2415
- color: var(--dpk-blue);
2416
- }
2417
-
2418
- .comment:focus-visible {
2419
- outline: none;
2420
- box-shadow: var(--dpk-focus);
2421
- }
2422
-
2423
- .comment svg {
2424
- width: 14px;
2425
- height: 14px;
2426
- }
2427
-
2428
- .error,
2429
- .empty {
2430
- color: var(--dpk-ink-soft);
2431
- font-size: 13px;
2432
- }
2433
-
2434
- .error {
2435
- color: var(--dpk-danger);
2436
- }
2437
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new P(this);#t=null;#e=null;#n=null;#s=qs();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=_(this,Is,t=>{t.ok?(this.#e=t.value,this.#n=null):(this.#e=null,this.#n=t.error),this.#u(),this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}get commentTargets(){if(!this.id)return[];const t=`${this.#c} \xB7 ${this.id}`;return this.#s.items.map(e=>({value:this.#l(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#u()}get elementActionResults(){return this.#r}render(){const t=this.#d;if(this.#n!==null)return d`<p class="error">${this.#n}</p>`;const e=sr(this.#s),s=e.total===0?0:e.done/e.total,a=t.progress(e.done,e.total);return d`<div class="card">
2438
- <div class="head">
2439
- <span class="heading">${this.#c}</span>
2440
- <span class="count" aria-label=${a}
2441
- ><span class="count-done">${e.done}</span><span class="count-total">/${e.total}</span></span
2442
- >
2443
- </div>
2444
- <div
2445
- class="track"
2446
- role="progressbar"
2447
- aria-valuemin="0"
2448
- aria-valuemax=${e.total}
2449
- aria-valuenow=${e.done}
2450
- aria-valuetext=${a}
2451
- >
2452
- <div class="fill" style=${`width: ${s*100}%`}></div>
2453
- </div>
2454
- ${this.#s.items.length===0?d`<p class="empty">${t.empty}</p>`:d`<ul>
2455
- ${U(this.#s.items,i=>i.id,i=>this.#p(t,i))}
2456
- </ul>`}
2457
- </div>`}get#d(){return Xi(this.#a.locale)}get#c(){return this.heading??this.#d.heading}#p(t,e){const s=`item-${e.id}`;return d`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
2458
- <span class="check">
2459
- <input
2460
- id=${s}
2461
- class="check-input"
2462
- type="checkbox"
2463
- .checked=${e.checked}
2464
- @change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#m(e,a.currentTarget.checked)}}
2465
- />
2466
- <span class="check-mark">${ft()}</span>
2467
- </span>
2468
- <label for=${s}>
2469
- <span class="label">${e.label}</span>
2470
- ${e.note===null?h:d`<span class="note">${e.note}</span>`}
2471
- ${this.#o===e.id?d`<span class="error">${t.unrecorded}</span>`:h}
2472
- </label>
2473
- ${this.id?d`<button
2474
- class="comment"
2475
- type="button"
2476
- aria-label=${t.commentOn(e.label)}
2477
- title=${t.commentOn(e.label)}
2478
- @click=${()=>{this.#h(e.id)}}
2479
- >
2480
- ${At()}
2481
- </button>`:h}
2482
- </li>`}#m(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:Os,target:this.#l(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#h(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#l(t)},bubbles:!0,composed:!0}))}#l(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#u(){if(this.#e===null)this.#s=qs(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=er(this.#d,this.#e,this.#i);this.#s=t.data,this.#r=t.results}this.requestUpdate()}}const js=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",Us)},Ns=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:n=>`Copy ${n}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:n=>`${n} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),Fs=M`
2483
- :host {
2484
- display: block;
2485
- overflow: hidden;
2486
- border: 1px solid var(--dpk-rule-strong);
2487
- border-radius: var(--dpk-radius);
2488
- background: var(--dpk-paper-sunken);
2489
- }
2490
-
2491
- .bar {
2492
- display: flex;
2493
- align-items: center;
2494
- gap: 8px;
2495
- min-height: 34px;
2496
- padding: 0 6px 0 12px;
2497
- border-bottom: 1px solid var(--dpk-rule);
2498
- color: var(--dpk-ink-soft);
2499
- font-family: var(--dpk-font-mono);
2500
- font-size: 12px;
2501
- }
2502
-
2503
- .name {
2504
- flex: 1;
2505
- overflow: hidden;
2506
- text-overflow: ellipsis;
2507
- white-space: nowrap;
2508
- }
2509
-
2510
- .language {
2511
- color: var(--dpk-ink-faint);
2512
- }
2513
-
2514
- button {
2515
- display: inline-flex;
2516
- align-items: center;
2517
- gap: 5px;
2518
- height: 24px;
2519
- padding: 0 8px;
2520
- border: 0;
2521
- border-radius: var(--dpk-radius-sm);
2522
- background: transparent;
2523
- color: inherit;
2524
- font: inherit;
2525
- cursor: pointer;
2526
- }
2527
-
2528
- button:hover {
2529
- background: var(--dpk-paper-inset);
2530
- color: var(--dpk-ink);
2531
- }
2532
-
2533
- button:focus-visible {
2534
- outline: none;
2535
- box-shadow: var(--dpk-focus);
2536
- }
2537
-
2538
- button[data-state='copied'] {
2539
- color: var(--dpk-green);
2540
- }
2541
-
2542
- button[data-state='failed'] {
2543
- color: var(--dpk-danger);
2544
- }
2545
-
2546
- button svg {
2547
- width: 13px;
2548
- height: 13px;
2549
- }
2550
-
2551
- pre {
2552
- margin: 0;
2553
- padding: 12px 14px;
2554
- overflow: auto;
2555
- max-height: var(--dpk-code-max-height, 480px);
2556
- color: var(--dpk-ink);
2557
- font-family: var(--dpk-font-mono);
2558
- font-size: 12.5px;
2559
- line-height: 1.6;
2560
- tab-size: 2;
2561
- }
2562
-
2563
- .comment {
2564
- color: var(--dpk-code-comment, var(--dpk-ink-faint));
2565
- font-style: italic;
2566
- }
2567
-
2568
- .string {
2569
- color: var(--dpk-code-string, var(--dpk-green));
2570
- }
2571
-
2572
- .number {
2573
- color: var(--dpk-code-number, var(--dpk-amber));
2574
- }
2575
-
2576
- .keyword {
2577
- color: var(--dpk-code-keyword, var(--dpk-violet));
2578
- }
2579
-
2580
- .function {
2581
- color: var(--dpk-code-function, var(--dpk-blue));
2582
- }
2583
-
2584
- .tag {
2585
- color: var(--dpk-code-tag, var(--dpk-accent-strong));
2586
- }
2587
-
2588
- .attr {
2589
- color: var(--dpk-code-attr, var(--dpk-blue));
2590
- }
2591
-
2592
- .property {
2593
- color: var(--dpk-code-property, var(--dpk-blue));
2594
- }
2595
-
2596
- .punct {
2597
- color: var(--dpk-code-punct, var(--dpk-ink-soft));
2598
- }
2599
- `,nr='script[type="text/plain"]';class Hs extends z{static{this.styles=[T,Fs]}static{this.properties={filename:{type:String},language:{type:String},code:{type:String}}}#a=new P(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e="idle";#n;constructor(){super(),this.filename=null,this.language=null,this.code=""}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),clearTimeout(this.#n)}get text(){const t=this.querySelector(nr)?.textContent??this.textContent??"";return Qt(t.trim()===""?this.code:t)}render(){const t=this.#i,e=this.filename??t.code,s=this.#e==="copied"?t.copied:this.#e==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
2600
- <span class="name">${e}</span>
2601
- ${this.language?d`<span class="language">${this.language}</span>`:h}
2602
- <button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
2603
- ${this.#e==="copied"?ft():ge()}<span aria-live="polite">${s}</span>
2604
- </button>
2605
- </div>
2606
- <pre><code>${this.#s()}</code></pre>`}#s(){return Gt(this.text,this.language).map(t=>t.kind===null?t.text:d`<span class=${t.kind}>${t.text}</span>`)}get#i(){return Ns(this.#a.locale)}#r=async()=>{const t=await Lt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const Qt=n=>{const t=n.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
2607
- `),e=t.filter(a=>a.trim()!=="").map(a=>/^[ \t]*/.exec(a)?.[0].length??0),s=e.length===0?0:Math.min(...e);return t.map(a=>a.slice(s)).join(`
2608
- `)},_s=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",Hs)},ar=D({en:{empty:"No code variants",invalid:n=>`Invalid code group: ${n}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${n}`}}),ir=w({label:C(v(),E(1)),language:g(v(),""),code:C(v(),E(1))}),rr=w({label:g(v(),""),variants:C($(ir),E(1))}),Et=n=>{const t=W(rr,n),e=new Set;for(const s of t.variants){if(e.has(s.label))throw new Error(`duplicate variant label: ${s.label}`);e.add(s.label)}return t},or=M`
2609
- :host {
2610
- min-width: 0;
2611
- }
2612
-
2613
- .bar {
2614
- padding-left: 10px;
2615
- }
2616
-
2617
- .name {
2618
- flex: 0 1 auto;
2619
- max-width: 45%;
2620
- }
2621
-
2622
- .tabs {
2623
- display: flex;
2624
- flex: 1;
2625
- gap: 1px;
2626
- min-width: 0;
2627
- overflow-x: auto;
2628
- scrollbar-width: none;
2629
- }
2630
-
2631
- .tabs::-webkit-scrollbar {
2632
- display: none;
2633
- }
2634
-
2635
- .tabs button {
2636
- height: 26px;
2637
- padding: 0 8px;
2638
- border-radius: 6px 6px 0 0;
2639
- color: var(--dpk-ink-faint);
2640
- font-size: 11.5px;
2641
- font-weight: 600;
2642
- white-space: nowrap;
2643
- }
2644
-
2645
- .tabs button:hover {
2646
- background: var(--dpk-paper-inset);
2647
- color: var(--dpk-ink);
2648
- }
2649
-
2650
- .tabs button[aria-selected='true'] {
2651
- background: var(--dpk-paper-raised);
2652
- box-shadow: inset 0 -2px 0 var(--dpk-accent);
2653
- color: var(--dpk-ink);
2654
- }
2655
-
2656
- .tabs button:focus-visible {
2657
- outline: none;
2658
- box-shadow: var(--dpk-focus);
2659
- }
2660
-
2661
- pre[hidden] {
2662
- display: none;
2663
- }
2664
-
2665
- .empty {
2666
- margin: 0;
2667
- padding: 12px 14px;
2668
- color: var(--dpk-ink-faint);
2669
- font-family: var(--dpk-font-mono);
2670
- font-size: 12px;
2671
- }
2672
-
2673
- @media (max-width: 520px) {
2674
- .name {
2675
- display: none;
2676
- }
2677
- }
2678
- `;class Ws extends z{static{this.styles=[T,Fs,or]}static{this.properties={data:{attribute:!1}}}#a=new P(this);#t=null;#e=null;#n=0;#s="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=_(this,Et,t=>{this.#n=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate())}),queueMicrotask(()=>{if(this.#t!==null||this.#e!==null)return;const t=Cn(this,Et);t!==null&&(this.#r?.(),this.#r=null,this.#n=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate()))})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.(),this.#r=null,clearTimeout(this.#i)}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Et(this.data),this.#e=null,this.#n=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Ns(this.#a.locale),e=ar(this.#a.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,d`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,d`<p class="empty">${e.empty}</p>`);const a=Math.min(this.#n,s.variants.length-1),i=s.label===""?t.code:s.label,o=this.#s==="copied"?t.copied:this.#s==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
2679
- ${s.label===""?h:d`<span class="name">${s.label}</span>`}
2680
- <div class="tabs" role="tablist" aria-label=${i}>
2681
- ${s.variants.map((r,l)=>d`<button
2682
- type="button"
2683
- role="tab"
2684
- id="code-group-tab-${l}"
2685
- aria-controls="code-group-panel-${l}"
2686
- aria-selected=${l===a}
2687
- tabindex=${l===a?0:-1}
2688
- @click=${()=>this.#d(l)}
2689
- @keydown=${u=>this.#c(u,l)}
2690
- >
2691
- ${r.label}
2692
- </button>`)}
2693
- </div>
2694
- <button
2695
- type="button"
2696
- data-state=${this.#s}
2697
- aria-label=${t.copyLabel(i)}
2698
- @click=${()=>this.#m()}
2699
- >
2700
- ${this.#s==="copied"?ft():ge()}<span aria-live="polite">${o}</span>
2701
- </button>
2702
- </div>
2703
- ${s.variants.map((r,l)=>d`<pre
2704
- role="tabpanel"
2705
- id="code-group-panel-${l}"
2706
- aria-labelledby="code-group-tab-${l}"
2707
- ?hidden=${l!==a}
2708
- ><code>${this.#p(r)}</code></pre>`)}`}#o(t,e){return d`<div class="bar"><span class="name">${t}</span></div>
2709
- ${e}`}#d(t){this.#t!==null&&(this.#n=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#s="idle",this.requestUpdate())}#c(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const a=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#d(a),this.renderRoot.querySelectorAll('[role="tab"]')[a]?.focus()}#p(t){const e=t.language===""?null:t.language;return Gt(Qt(t.code),e).map(s=>s.kind===null?s.text:d`<span class=${s.kind}>${s.text}</span>`)}async#m(){const t=this.#t;if(t===null)return;const e=Math.min(this.#n,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const a=await Lt(Qt(s.code));this.#s=a?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#s="idle",this.requestUpdate()},1600)}}const Bs=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",Ws)},lr=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:n=>`Profile: ${n}`,guest:"Guest",shortcuts:"Pages of this site",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page here has this address."},ja:{back:"\u623B\u308B",forward:"\u9032\u3080",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",address:"\u30A2\u30C9\u30EC\u30B9",tabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",profile:n=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${n}`,guest:"\u30B2\u30B9\u30C8",shortcuts:"\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}}),zt=(n,t,e)=>{const s=Ce(t,e);if(s===null)return;const a=Se(s);return n.find(i=>{const o=Ce(i.url,e);return o!==null&&Se(o)===a})},dr=(n,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?Ee(t.url):zt(n,t.page.url,t.page.url)?.title??Ee(t.page.url),Gs=n=>n===void 0||n.kind==="new-tab"?"":n.kind==="unreachable"?n.url:n.page.url,cr=(n,t,e,s)=>{const a=Pn(t),i=a.history[a.index];return{tabs:t.tabs.map(o=>{const r=o.history[o.index];return{id:o.id,title:dr(n,r,e),url:Gs(r),active:o.id===a.id}}),entry:i,url:Gs(i),canBack:qn(t),canForward:On(t),...s===null||s===""?{}:{profile:s}}},pr=n=>n.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),hr=":scope > [data-url]",ur=360,Ks="https://page.example.com/";class Vs extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[T,In,M`
2710
- :host {
2711
- display: block;
2712
- height: var(--dpk-browser-height, 460px);
2713
- min-height: 240px;
2714
- color: var(--dpk-ink);
2715
- font-family: var(--dpk-body);
2716
- }
2717
-
2718
- :host([viewport='mobile']) {
2719
- max-width: var(--dpk-browser-phone-width, 390px);
2720
- height: var(--dpk-browser-height, 720px);
2721
- }
2722
-
2723
- .browser {
2724
- box-sizing: border-box;
2725
- height: 100%;
2726
- border: 1px solid var(--dpk-rule);
2727
- border-radius: var(--dpk-radius-lg);
2728
- background: var(--dpk-paper-raised);
2729
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
2730
- overflow: hidden;
2731
- }
2732
-
2733
- /* The page is the product's own light surface, and scrolls under the chrome. */
2734
- .browser-page {
2735
- position: relative;
2736
- display: flex;
2737
- flex: 1 1 auto;
2738
- flex-direction: column;
2739
- min-height: 0;
2740
- overflow: auto;
2741
- color-scheme: light;
2742
- background: #fff;
2743
- color: #1f2430;
2744
- }
2745
-
2746
- ::slotted(*) {
2747
- flex: 1 0 auto;
2748
- }
2749
- `]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#a=new P(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e=null;#n=!1;#s=null;#i=!1;#r=null;constructor(){super(),this.url=null,this.viewport="desktop",this.profile=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-url","data-title"]}),this.addEventListener("click",this.#v),this.addEventListener("auxclick",this.#v)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.removeEventListener("click",this.#v),this.removeEventListener("auxclick",this.#v),this.#s!==null&&clearTimeout(this.#s),this.#s=null}get#o(){return lr(this.#a.locale)}get#d(){return this.viewport==="mobile"}get#c(){return[...this.querySelectorAll(hr)]}get#p(){return this.#c.map(t=>{const e=t.dataset.url??"",s=t.querySelector("h1, h2, h3")?.textContent?.trim();return{url:e,title:t.dataset.title??(s||e)}})}get#m(){const t=this.#e===null?void 0:qt(this.#e);return t?.kind==="page"?t.page.url:this.#p[0]?.url??Ks}#h(t){if(t?.kind!=="page")return;const e=zt(this.#p,t.page.url,t.page.url);return e===void 0?void 0:this.#c.find(s=>s.dataset.url===e.url)}willUpdate(t){if(this.#e===null){const e=this.#p,s=(this.url===null?void 0:zt(e,this.url,Ks))??e[0];s!==void 0&&(this.#e=Un({url:s.url}));return}t.has("url")&&this.url!==null&&this.#f(this.url,!1)}render(){const t=this.#e;if(t===null)return d`<slot hidden></slot>`;const e=this.#o,s=this.#p,a=cr(s,t,e.newTab,this.profile),i={view:a,phone:this.#d,switcher:this.#n,shortcuts:a.entry?.kind==="new-tab"?pr(s):[],labels:e,send:r=>{this.#u(r)}},o=this.#h(a.entry);return d`<div
2750
- class="browser"
2751
- data-viewport=${this.#d?"mobile":"desktop"}
2752
- ?data-loading=${this.#s!==null}
2753
- >
2754
- ${jn(i)}
2755
- <div class="browser-page">
2756
- ${Nn(i,o===void 0?void 0:d`<slot></slot>`)}
2757
- </div>
2758
- ${Fn(i)}
2759
- </div>`}updated(){const t=this.#e===null?void 0:qt(this.#e),e=this.#h(t);this.renderRoot.querySelector("slot")?.assign(...e===void 0?[]:[e]),this.#i&&(this.#i=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus());const s=t===void 0||t.kind==="new-tab"?"":t.kind==="page"?t.page.url:t.url;if(s===this.#r)return;const a=this.#r===null;this.#r=s,a||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#l(t){if(this.#e===null)return;const e=Hn(this.#e,t);e!==this.#e&&(this.#e=e,this.#k(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#u(t){switch(t.kind){case"reload":this.#x();return;case"address":this.#f(t.input,!1);return;case"back":case"forward":case"new-tab":this.#n=!1,this.#l({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#n=t.open,this.requestUpdate();return;case"activate":this.#n=!1,this.#i=t.focus===!0,this.#l({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#l({kind:"close-tab",id:t.id});return;case"visit":this.#l({kind:"visit",page:t.page});return;default:return}}#f(t,e){const s=this.#m,a=zt(this.#p,t,s),i=a===void 0?{kind:"unreachable",url:_n(t,s)}:{kind:"page",page:{url:a.url}};e!==!1?this.#l({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#l({kind:"visit",page:i.page}):this.#l({kind:"unreachable",url:i.url})}#x(){if(this.#s!==null||this.#e===null)return;const t=this.#h(qt(this.#e));this.#s=setTimeout(()=>{if(this.#s=null,t!==void 0){for(const e of t.querySelectorAll("form"))e.reset();for(const e of t.querySelectorAll("dialog"))e.close();t.scrollTop=0,t.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate()},ur),this.requestUpdate()}#k(){this.#s!==null&&(clearTimeout(this.#s),this.#s=null)}#v=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(r=>r instanceof HTMLAnchorElement&&this.contains(r)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const a=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",o=new URL(s,this.#m).href;this.#f(o,i||a?{background:a}:!1)}}const Js=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",Vs)},mr=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:n=>`${n} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:n=>`Remove ${n}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:n=>`${n} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:n=>`${n} \u3092\u524A\u9664`}}),gr=w({value:C(v(),E(1)),label:C(v(),E(1)),description:g(v()),group:g(v()),avatar:g(v())}),fr=w({options:$(gr),value:g(ve([v(),$(v())]))}),Zs=n=>typeof n=="string"?n===""?[]:[n]:Array.isArray(n)?n.filter(t=>typeof t=="string"&&t!==""):[],Xs=n=>{const t=W(fr,n),e=new Set;return{options:t.options.map(a=>{if(e.has(a.value))throw new Error(`duplicate option value: ${a.value}`);return e.add(a.value),{value:a.value,label:a.label,description:a.description??null,group:a.group??null,avatar:a.avatar??null}}),value:t.value===void 0?null:Zs(t.value)}},te=(n,t)=>{const e=t.trim().toLowerCase();return e===""?n:n.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},br=n=>{const t=[],e=new Map;for(const s of n){let a=e.get(s.group);a===void 0&&(a=[],e.set(s.group,a),t.push(s.group)),a.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},ee=(n,t)=>t===0?-1:Math.min(Math.max(n,0),t-1),kr=(n,t,e)=>e===0?-1:n<0?t>0?0:e-1:(n+t+e)%e,vr=(n,t,e)=>e?n.includes(t)?n.filter(s=>s!==t):[...n,t]:[t],xr=(n,t)=>n.filter(e=>e!==t),yr=(n,t)=>n.includes(t),wr=(n,t)=>n.length===t.length&&n.every((e,s)=>e===t[s]),$r=(n,t)=>t.flatMap(e=>{const s=n.find(a=>a.value===e);return s?[s]:[]}),Cr=(n,t)=>{const e=t[0];return e===void 0?null:n.find(s=>s.value===e)?.label??null},Ys=n=>{const t=n.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},Qs=["blue","green","amber","violet","accent","danger"],tn=n=>{let t=0;for(let e=0;e<n.length;e+=1)t=t*31+n.charCodeAt(e)|0;return Qs[Math.abs(t)%Qs.length]??"blue"};let Sr=0;const Er=".combo-control, .combo-listbox";class en extends z{static{this.styles=[T,M`
2760
- :host {
2761
- display: block;
2762
- }
2763
-
2764
- .field {
2765
- display: flex;
2766
- flex-direction: column;
2767
- gap: 6px;
2768
- }
2769
-
2770
- .field-label {
2771
- font-size: 11.5px;
2772
- font-weight: 600;
2773
- color: var(--dpk-ink-soft);
2774
- }
2775
-
2776
- .combo-control {
2777
- box-sizing: border-box;
2778
- display: flex;
2779
- flex-wrap: wrap;
2780
- align-items: center;
2781
- gap: 5px;
2782
- min-height: var(--dpk-control-h);
2783
- padding: 4px 6px 4px 10px;
2784
- border: 1px solid var(--dpk-rule-strong);
2785
- border-radius: var(--dpk-radius-sm);
2786
- background: var(--dpk-paper-raised);
2787
- box-shadow: inset 0 1px 2px var(--dpk-shade-1);
2788
- cursor: text;
2789
- transition:
2790
- border-color 160ms var(--dpk-ease),
2791
- box-shadow 160ms var(--dpk-ease);
2792
- }
2793
-
2794
- .combo-control:focus-within {
2795
- border-color: var(--dpk-blue);
2796
- box-shadow: var(--dpk-focus);
2797
- }
2798
-
2799
- .input {
2800
- flex: 1 1 80px;
2801
- min-width: 60px;
2802
- margin: 2px 0;
2803
- border: 0;
2804
- background: transparent;
2805
- color: var(--dpk-ink);
2806
- font: inherit;
2807
- font-size: 12.5px;
2808
- outline: none;
2809
- }
2810
-
2811
- .input::placeholder {
2812
- color: var(--dpk-ink-faint);
2813
- }
2814
-
2815
- .chevron {
2816
- flex: none;
2817
- display: inline-flex;
2818
- align-items: center;
2819
- justify-content: center;
2820
- width: 22px;
2821
- height: 22px;
2822
- border: 0;
2823
- border-radius: var(--dpk-radius-xs);
2824
- background: transparent;
2825
- color: var(--dpk-ink-faint);
2826
- cursor: pointer;
2827
- transition: transform 160ms var(--dpk-ease);
2828
- }
2829
-
2830
- .chevron:hover {
2831
- color: var(--dpk-ink);
2832
- }
2833
-
2834
- .chevron[data-open='true'] {
2835
- transform: rotate(180deg);
2836
- }
2837
-
2838
- .chevron svg {
2839
- display: block;
2840
- width: 14px;
2841
- height: 14px;
2842
- }
2843
-
2844
- .chip {
2845
- display: inline-flex;
2846
- align-items: center;
2847
- gap: 5px;
2848
- padding: 2px 6px 2px 2px;
2849
- border-radius: 999px;
2850
- background: var(--dpk-paper-inset);
2851
- color: var(--dpk-ink);
2852
- font-size: 11.5px;
2853
- line-height: 1.4;
2854
- }
2855
-
2856
- .chip .avatar {
2857
- width: 16px;
2858
- height: 16px;
2859
- font-size: 8px;
2860
- }
2861
-
2862
- .chip-remove {
2863
- display: inline-flex;
2864
- align-items: center;
2865
- justify-content: center;
2866
- width: 14px;
2867
- height: 14px;
2868
- padding: 0;
2869
- border: 0;
2870
- border-radius: 999px;
2871
- background: transparent;
2872
- color: var(--dpk-ink-faint);
2873
- cursor: pointer;
2874
- }
2875
-
2876
- .chip-remove:hover {
2877
- color: var(--dpk-danger);
2878
- }
2879
-
2880
- .chip-remove svg {
2881
- display: block;
2882
- width: 10px;
2883
- height: 10px;
2884
- }
2885
-
2886
- .avatar {
2887
- flex: none;
2888
- display: inline-flex;
2889
- align-items: center;
2890
- justify-content: center;
2891
- width: 22px;
2892
- height: 22px;
2893
- border-radius: 999px;
2894
- font-family: var(--dpk-mono);
2895
- font-size: 9.5px;
2896
- font-weight: 650;
2897
- }
2898
-
2899
- .avatar[data-tone='blue'] {
2900
- background: var(--dpk-blue-soft);
2901
- color: var(--dpk-blue);
2902
- }
2903
-
2904
- .avatar[data-tone='green'] {
2905
- background: var(--dpk-green-soft);
2906
- color: var(--dpk-green);
2907
- }
2908
-
2909
- .avatar[data-tone='amber'] {
2910
- background: var(--dpk-amber-soft);
2911
- color: var(--dpk-amber);
2912
- }
2913
-
2914
- .avatar[data-tone='violet'] {
2915
- background: var(--dpk-violet-soft);
2916
- color: var(--dpk-violet);
2917
- }
2918
-
2919
- .avatar[data-tone='accent'] {
2920
- background: var(--dpk-accent-soft);
2921
- color: var(--dpk-accent);
2922
- }
2923
-
2924
- .avatar[data-tone='danger'] {
2925
- background: var(--dpk-danger-soft);
2926
- color: var(--dpk-danger);
2927
- }
2928
-
2929
- .combo-listbox {
2930
- box-sizing: border-box;
2931
- position: fixed;
2932
- inset: auto;
2933
- margin: 0;
2934
- padding: 0;
2935
- display: flex;
2936
- flex-direction: column;
2937
- overflow: hidden;
2938
- border: 1px solid var(--dpk-rule-strong);
2939
- border-radius: var(--dpk-radius-lg);
2940
- background: var(--dpk-paper-raised);
2941
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
2942
- color: var(--dpk-ink);
2943
- font-size: 12.5px;
2944
- animation: dpk-combobox-pop-in 140ms var(--dpk-ease);
2945
- }
2946
-
2947
- @keyframes dpk-combobox-pop-in {
2948
- from {
2949
- opacity: 0;
2950
- transform: translateY(4px) scale(0.98);
2951
- }
2952
- }
2953
-
2954
- .options {
2955
- flex: 1 1 auto;
2956
- overflow-y: auto;
2957
- padding: 6px 0;
2958
- }
2959
-
2960
- .group-heading {
2961
- padding: 9px 12px 4px;
2962
- font-family: var(--dpk-mono);
2963
- font-size: 10px;
2964
- font-weight: 650;
2965
- letter-spacing: 0.09em;
2966
- text-transform: uppercase;
2967
- color: var(--dpk-ink-faint);
2968
- }
2969
-
2970
- .option {
2971
- display: flex;
2972
- align-items: center;
2973
- gap: 8px;
2974
- padding: 6px 12px;
2975
- cursor: pointer;
2976
- }
2977
-
2978
- .option:hover,
2979
- .option[data-active='true'] {
2980
- background: var(--dpk-paper-sunken);
2981
- }
2982
-
2983
- .option-text {
2984
- display: flex;
2985
- align-items: baseline;
2986
- gap: 6px;
2987
- min-width: 0;
2988
- flex: 1 1 auto;
2989
- }
2990
-
2991
- .option-name {
2992
- flex: none;
2993
- max-width: 60%;
2994
- overflow: hidden;
2995
- text-overflow: ellipsis;
2996
- white-space: nowrap;
2997
- color: var(--dpk-ink);
2998
- }
2999
-
3000
- .option-desc {
3001
- min-width: 0;
3002
- overflow: hidden;
3003
- text-overflow: ellipsis;
3004
- white-space: nowrap;
3005
- color: var(--dpk-ink-soft);
3006
- font-size: 11.5px;
3007
- }
3008
-
3009
- .option-check {
3010
- flex: none;
3011
- display: flex;
3012
- color: var(--dpk-blue);
3013
- }
3014
-
3015
- .option-check svg {
3016
- display: block;
3017
- width: 14px;
3018
- height: 14px;
3019
- }
3020
-
3021
- .empty {
3022
- padding: 18px 12px;
3023
- color: var(--dpk-ink-soft);
3024
- font-size: 12px;
3025
- text-align: center;
3026
- }
3027
-
3028
- .footer {
3029
- flex: none;
3030
- display: flex;
3031
- align-items: center;
3032
- justify-content: space-between;
3033
- gap: 10px;
3034
- padding: 7px 12px;
3035
- border-top: 1px solid var(--dpk-rule);
3036
- }
3037
-
3038
- .count {
3039
- color: var(--dpk-ink-soft);
3040
- font-size: 11px;
3041
- font-variant-numeric: tabular-nums;
3042
- }
3043
-
3044
- .hints {
3045
- display: flex;
3046
- align-items: center;
3047
- gap: 10px;
3048
- color: var(--dpk-ink-faint);
3049
- font-size: 10.5px;
3050
- }
3051
-
3052
- .hint {
3053
- display: inline-flex;
3054
- align-items: center;
3055
- gap: 4px;
3056
- }
3057
-
3058
- .kbd {
3059
- display: inline-flex;
3060
- align-items: center;
3061
- justify-content: center;
3062
- min-width: 1.5em;
3063
- height: 1.5em;
3064
- padding: 0 4px;
3065
- border: 1px solid var(--dpk-rule-strong);
3066
- border-bottom-width: 2px;
3067
- border-radius: var(--dpk-radius-xs);
3068
- background: var(--dpk-paper-raised);
3069
- color: var(--dpk-ink-soft);
3070
- font-family: var(--dpk-mono);
3071
- font-size: 10px;
3072
- }
3073
-
3074
- .error {
3075
- color: var(--dpk-danger);
3076
- font-size: 12px;
3077
- }
3078
- `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++Sr}`;#t=new P(this);#e=new Mt(this);#n=null;#s=[];#i=[];#r=null;#o=!1;#d=null;#c=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new kn(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Er)),ownsEscape:()=>this.#o,dismiss:()=>this.#b()})}connectedCallback(){super.connectedCallback(),this.#n=_(this,Xs,t=>{t.ok?(this.#s=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#s=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=Zs(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return d`<p class="error">${this.#r}</p>`;const e=this.#d??"",s=te(this.#s,e),a=ee(this.#c,s.length),i=this.multiple?$r(this.#s,this.#i):[],o=this.multiple?null:Cr(this.#s,this.#i),r=this.multiple?this.#i.length===0:o===null,l=this.#d??(this.multiple?"":o??"");return d`
3079
- <div class="field">
3080
- ${this.label?d`<label class="field-label" id=${this.#m}>${this.label}</label>`:h}
3081
- <div class="combo-control">
3082
- ${this.multiple?U(i,u=>u.value,u=>this.#x(u,t)):h}
3083
- <input
3084
- class="input"
3085
- type="text"
3086
- role="combobox"
3087
- autocomplete="off"
3088
- spellcheck="false"
3089
- aria-expanded=${this.#o?"true":"false"}
3090
- aria-haspopup="listbox"
3091
- aria-autocomplete="list"
3092
- aria-controls=${this.#h}
3093
- aria-labelledby=${this.label?this.#m:h}
3094
- aria-activedescendant=${a>=0?this.#l(s[a]?.value??""):h}
3095
- placeholder=${r?this.placeholder??"":""}
3096
- .value=${l}
3097
- @focus=${this.#k}
3098
- @click=${this.#k}
3099
- @input=${this.#v}
3100
- @keydown=${this.#g}
3101
- />
3102
- <button
3103
- type="button"
3104
- class="chevron"
3105
- tabindex="-1"
3106
- aria-hidden="true"
3107
- data-open=${this.#o?"true":"false"}
3108
- @mousedown=${u=>u.preventDefault()}
3109
- @click=${this.#z}
3110
- >
3111
- ${vn()}
3112
- </button>
3113
- </div>
3114
- </div>
3115
- ${this.#o?this.#u(s,a,t):h}
3116
- `}updated(t){super.updated(t),this.#S()}get#p(){return mr(this.#t.locale)}get#m(){return`${this.#a}-label`}get#h(){return`${this.#a}-listbox`}#l(t){return`${this.#a}-option-${encodeURIComponent(t)}`}#u(t,e,s){const a=br(t);return d`
3117
- <div
3118
- class="combo-listbox"
3119
- popover="manual"
3120
- role="listbox"
3121
- id=${this.#h}
3122
- aria-label=${this.label??s.listLabel}
3123
- aria-multiselectable=${this.multiple?"true":"false"}
3124
- >
3125
- <div class="options">
3126
- ${t.length===0?d`<p class="empty">${s.empty}</p>`:a.map(i=>d`
3127
- ${i.group!==null?d`<div class="group-heading">${i.group}</div>`:h}
3128
- ${U(i.options,o=>o.value,o=>this.#f(o,t.indexOf(o)===e))}
3129
- `)}
3130
- </div>
3131
- <div class="footer">
3132
- <span class="count">${s.selectedCount(this.#i.length)}</span>
3133
- <span class="hints">
3134
- <span class="hint"><kbd class="kbd">↑</kbd><kbd class="kbd">↓</kbd> ${s.moveLabel}</span>
3135
- <span class="hint"><kbd class="kbd">↵</kbd> ${s.toggleLabel}</span>
3136
- </span>
3137
- </div>
3138
- </div>
3139
- `}#f(t,e){const s=yr(this.#i,t.value);return d`
3140
- <div
3141
- class="option"
3142
- id=${this.#l(t.value)}
3143
- role="option"
3144
- aria-selected=${s?"true":"false"}
3145
- data-active=${e?"true":"false"}
3146
- @mousedown=${a=>a.preventDefault()}
3147
- @click=${()=>this.#w(t.value)}
3148
- >
3149
- <span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
3150
- <span class="option-text">
3151
- <span class="option-name">${t.label}</span>
3152
- ${t.description!==null?d`<span class="option-desc">${t.description}</span>`:h}
3153
- </span>
3154
- ${s?d`<span class="option-check" aria-hidden="true">${ft()}</span>`:h}
3155
- </div>
3156
- `}#x(t,e){return d`
3157
- <span class="chip">
3158
- <span class="avatar" data-tone=${tn(t.value)}>${t.avatar??Ys(t.label)}</span>
3159
- <span class="chip-label">${t.label}</span>
3160
- <button
3161
- type="button"
3162
- class="chip-remove"
3163
- tabindex="-1"
3164
- aria-label=${e.removeChip(t.label)}
3165
- @mousedown=${s=>s.preventDefault()}
3166
- @click=${s=>{s.stopPropagation(),this.#y(xr(this.#i,t.value))}}
3167
- >
3168
- ${xn()}
3169
- </button>
3170
- </span>
3171
- `}#k=()=>{this.#o=!0,this.#c=-1,this.requestUpdate()};#v=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#d=t.currentTarget.value,this.#o=!0,this.#c=-1,this.requestUpdate())};#g=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=te(this.#s,this.#d??""),s=this.#o;this.#o=!0;const a=t.key==="ArrowDown"?1:-1;this.#c=s?kr(this.#c,a,e.length):-1,s||(this.#c=ee(a>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=te(this.#s,this.#d??""),s=e[ee(this.#c,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#d??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#y(this.#i.slice(0,-1))}};#z=()=>{this.#o?this.#b():(this.#o=!0,this.#c=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#y(vr(this.#i,t,this.multiple)),this.multiple?(this.#d="",this.#c=-1,this.requestUpdate()):this.#b()}#y(t){wr(this.#i,t)||(this.#i=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-combobox-change",{detail:{value:this.multiple?t:t[0]??""},bubbles:!0,composed:!0})))}#b(){this.#o=!1,this.#d=null,this.#c=-1,this.requestUpdate()}#S(){const t=this.renderRoot.querySelector(".combo-listbox"),e=this.renderRoot.querySelector(".combo-control");!t||!e||this.#e.open(t,e,{width:e.offsetWidth,height:320},{placement:"bottom-start"})}}const sn=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",en)};let Q=null;const zr=n=>{Q!==null&&Q!==n&&Q.hide(),Q=n},Mr=n=>{Q===n&&(Q=null)};class nn extends z{static{this.styles=[T,B,M`
3172
- :host {
3173
- display: contents;
3174
- }
3175
-
3176
- /*
3177
- * The one placement core imposes: bottom-center, clear of the hand-off
3178
- * dock. A host that needs a different spot claims the bar from
3179
- * somewhere else on screen instead — the contract is "claim it", not
3180
- * "place it".
3181
- */
3182
- .dpk-floatbar {
3183
- left: 50%;
3184
- bottom: calc(14px + var(--dpk-dock-clearance, 0px));
3185
- transform: translateX(-50%);
3186
- z-index: 45;
3187
- }
3188
- `]}static{this.properties={label:{type:String,reflect:!0}}}#a={hide:()=>this.#e(!1)};#t=!1;constructor(){super(),this.label=null}get open(){return this.#t}connectedCallback(){super.connectedCallback(),this.#e(!0),zr(this.#a)}disconnectedCallback(){super.disconnectedCallback(),Mr(this.#a)}render(){return d`
3189
- <div
3190
- class="dpk-floatbar"
3191
- popover="manual"
3192
- role="toolbar"
3193
- aria-label=${this.label??h}
3194
- @keydown=${this.#s}
3195
- >
3196
- <slot></slot>
3197
- </div>
3198
- `}updated(t){super.updated(t),this.#n()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#n(){const t=this.renderRoot.querySelector(".dpk-floatbar");if(!t||typeof t.showPopover!="function")return;const e=t.matches(":popover-open");if(this.#t&&!e)try{t.showPopover()}catch{}else if(!this.#t&&e)try{t.hidePopover()}catch{}}#s=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const an=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",nn)};class rn extends z{static{this.styles=[T,B]}#a=new yn(this);ask(t){return this.#a.ask(t)}render(){return this.#a.render()}}const on=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",rn)},Tr=D({en:{heading:"Alternatives",empty:"No alternatives to compare.",dataError:"The alternatives could not be read.",reason:"Reason",tradeoffs:"Tradeoffs",adopted:"Adopted",rejected:"Rejected",considered:"Considered"},ja:{heading:"\u4EE3\u66FF\u6848",empty:"\u6BD4\u8F03\u3059\u308B\u4EE3\u66FF\u6848\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4EE3\u66FF\u6848\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",reason:"\u7406\u7531",tradeoffs:"\u30C8\u30EC\u30FC\u30C9\u30AA\u30D5",adopted:"\u63A1\u7528",rejected:"\u5374\u4E0B",considered:"\u691C\u8A0E"}}),Ar=["adopted","rejected","considered"],Lr=w({id:C(v(),$e(/^[A-Za-z0-9_-]+$/)),status:nt(Ar),label:g(C(v(),E(1))),summary:g(C(v(),E(1))),reason:g(C(v(),E(1))),tradeoffs:g($(C(v(),E(1))))}),Rr=w({options:$(Lr)}),Dr=()=>({options:[]}),ln=n=>{const t=W(Rr,n),e=new Set;return{options:t.options.map(s=>{if(e.has(s.id))throw new Error(`duplicate option id: ${s.id}`);return e.add(s.id),{id:s.id,status:s.status,label:s.label??s.id,summary:s.summary??null,reason:s.reason??null,tradeoffs:s.tradeoffs??[]}})}},Pr=(n,t)=>{switch(t){case"adopted":return n.adopted;case"rejected":return n.rejected;case"considered":return n.considered}},Or=(n,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:Pr(n,t.status),summary:t.summary,reason:t.reason===null?null:{label:n.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:n.tradeoffs,items:t.tradeoffs}}),qr=(n,t)=>t.options.map(e=>Or(n,e)),Ir=[T,zn,M`
3199
- :host {
3200
- display: block;
3201
- color: var(--dpk-ink);
3202
- font-family: var(--dpk-body);
3203
- }
3204
-
3205
- .alternatives {
3206
- display: grid;
3207
- gap: 10px;
3208
- }
3209
-
3210
- /* A concise section label, quiet enough to sit above cards in a document. */
3211
- .alternatives-label {
3212
- margin: 0;
3213
- padding: 0 2px;
3214
- }
3215
-
3216
- /* Cards wrap into columns once the page has room; one option takes the row. */
3217
- .options {
3218
- display: grid;
3219
- grid-template-columns: repeat(auto-fit, minmax(min(216px, 100%), 1fr));
3220
- gap: 8px;
3221
- margin: 0;
3222
- padding: 0;
3223
- list-style: none;
3224
- }
3225
-
3226
- /* A grid item that stretches, so the cards in a row share their height. */
3227
- .option {
3228
- display: grid;
3229
- min-width: 0;
3230
- }
3231
-
3232
- /*
3233
- * The taken option: the card's own tone (a green hairline edge and a barely
3234
- * green face), plus a ring outside the edge so the eye finds it in a row of
3235
- * neutral cards. Weight and hue, not a bar down one side.
3236
- */
3237
- .option[data-status='adopted'] .dpk-card {
3238
- --dpk-card-tone: var(--dpk-green);
3239
- box-shadow:
3240
- 0 0 0 2px color-mix(in oklab, var(--dpk-green) 26%, transparent),
3241
- var(--dpk-bevel),
3242
- 0 10px 22px -14px color-mix(in oklab, var(--dpk-green) 60%, var(--dpk-shade-3));
3243
- }
3244
-
3245
- /* ------------------------------------------------------------ status */
3246
-
3247
- [data-tone='adopted'] {
3248
- --tone: var(--dpk-green);
3249
- --tone-soft: var(--dpk-green-soft);
3250
- }
3251
-
3252
- [data-tone='rejected'] {
3253
- --tone: var(--dpk-amber);
3254
- --tone-soft: var(--dpk-amber-soft);
3255
- }
3256
-
3257
- [data-tone='considered'] {
3258
- --tone: var(--dpk-blue);
3259
- --tone-soft: var(--dpk-blue-soft);
3260
- }
3261
-
3262
- /* The chip's box comes from the card atom; only its tone is set here. */
3263
- .status {
3264
- background: var(--tone-soft);
3265
- color: var(--tone);
3266
- font-weight: 650;
3267
- }
3268
-
3269
- /* -------------------------------------------------------------- body */
3270
-
3271
- .option-summary {
3272
- margin: 0;
3273
- color: var(--dpk-ink-soft);
3274
- font-size: 12.5px;
3275
- line-height: 1.6;
3276
- overflow-wrap: anywhere;
3277
- }
3278
-
3279
- .option-facts {
3280
- display: grid;
3281
- gap: 8px;
3282
- margin: 0;
3283
- }
3284
-
3285
- .option-fact {
3286
- display: grid;
3287
- gap: 1px;
3288
- }
3289
-
3290
- .option-fact > dd {
3291
- margin: 0;
3292
- color: var(--dpk-ink-soft);
3293
- font-size: 12.5px;
3294
- line-height: 1.6;
3295
- overflow-wrap: anywhere;
3296
- }
3297
-
3298
- .option-tradeoffs {
3299
- display: grid;
3300
- gap: 2px;
3301
- margin: 0;
3302
- padding-left: 16px;
3303
- }
3304
-
3305
- .option-tradeoffs > li::marker {
3306
- color: var(--dpk-ink-faint);
3307
- }
3308
-
3309
- /* ------------------------------------------------------- notice/empty */
3310
-
3311
- .alternatives-notice,
3312
- .alternatives-empty {
3313
- margin: 0;
3314
- padding: 12px 14px;
3315
- border-radius: var(--dpk-radius);
3316
- font-size: 12.5px;
3317
- line-height: 1.6;
3318
- }
3319
-
3320
- .alternatives-notice {
3321
- background: var(--dpk-danger-soft);
3322
- color: var(--dpk-danger);
3323
- }
3324
-
3325
- .alternatives-empty {
3326
- color: var(--dpk-ink-faint);
3327
- text-align: center;
3328
- }
3329
- `];class dn extends z{static{this.styles=Ir}static{this.properties={data:{attribute:!1},heading:{type:String}}}#a=new P(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=_(this,ln,t=>{this.data===null&&(t.ok?this.#i(t.value):this.#r(t.error))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#i(this.data)}get dataError(){return this.#n}get#s(){return Tr(this.#a.locale)}#i(t){this.#e=t,this.#n=null,this.requestUpdate()}#r(t){this.#e=null,this.#n=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#s,e=this.heading??t.heading,s=qr(t,this.#e??Dr());return d`<section class="alternatives">
3330
- ${e===""?h:d`<p class="alternatives-label dpk-label">${e}</p>`}
3331
- ${this.#n===null?h:d`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#n}</p>`}
3332
- ${this.#n===null&&s.length===0?d`<p class="alternatives-empty">${t.empty}</p>`:h}
3333
- ${s.length===0?h:d`<ul class="options">
3334
- ${U(s,a=>a.id,a=>this.#o(a))}
3335
- </ul>`}
3336
- </section>`}#o(t){const e=t.reason===null&&t.tradeoffs===null?h:d`<dl class="option-facts">
3337
- ${t.reason===null?h:d`<div class="option-fact">
3338
- <dt class="dpk-label">${t.reason.label}</dt>
3339
- <dd>${t.reason.text}</dd>
3340
- </div>`}
3341
- ${t.tradeoffs===null?h:d`<div class="option-fact">
3342
- <dt class="dpk-label">${t.tradeoffs.label}</dt>
3343
- <dd>
3344
- <ul class="option-tradeoffs">
3345
- ${t.tradeoffs.items.map(s=>d`<li>${s}</li>`)}
3346
- </ul>
3347
- </dd>
3348
- </div>`}
3349
- </dl>`;return d`<li class="option" data-status=${t.status} data-option=${t.id}>
3350
- <article class="dpk-card">
3351
- <div class="dpk-card-head">
3352
- ${t.key===null?h:d`<span class="dpk-card-key">${t.key}</span>`}
3353
- <span class="dpk-card-title">${t.title}</span>
3354
- <span class="dpk-card-meta">
3355
- <span class="dpk-card-chip status" data-tone=${t.status}>${t.statusLabel}</span>
3356
- </span>
3357
- </div>
3358
- ${t.summary===null?h:d`<p class="option-summary">${t.summary}</p>`} ${e}
3359
- </article>
3360
- </li>`}}const cn=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",dn)},Ur=()=>{wn(),$n(),Ze(),is(),xs(),pn()},pn=()=>{_e(),Cs(),Ls(),Gn(),Ps(),js(),Kn(),Vn(),_s(),Bs(),sn(),Jn(),qe(),Fe(),Js(),an(),on(),Ts(),cn()};export{Ie as $,on as A,qe as B,xs as C,dn as D,Ts as E,is as F,Ze as G,an as H,Ps as I,Fe as J,ln as K,Is as L,Et as M,Xs as N,Xt as O,Ye as P,je as Q,ps as R,Kt as S,pn as T,it as U,kt as V,pa as W,ba as X,ha as Y,fa as Z,Zn as _,Vs as a,ua as a0,ma as a1,ga as a2,ka as a3,Us as b,Hs as c,Ws as d,en as e,As as f,$s as g,rn as h,Oe as i,vs as j,Ms as k,as as l,Je as m,nn as n,Ds as o,Ne as p,cn as q,Ur as r,_e as s,Js as t,js as u,_s as v,Bs as w,sn as x,Ls as y,Cs as z};