dev-process-kit 0.2.1 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -60
- package/dist/boards.js +1 -0
- package/dist/chunks/shared-BX1EnRfr.js +1 -0
- package/dist/chunks/shared-C-M2Nfmu.js +686 -0
- package/dist/chunks/shared-Cas88qVh.js +2165 -0
- package/dist/chunks/{shared-DeXM1v86.js → shared-Cejw83eH.js} +21 -29
- package/dist/chunks/shared-CfVpKPRY.js +1844 -0
- package/dist/chunks/shared-CnPCm4bJ.js +31 -0
- package/dist/chunks/shared-D1iBuYZV.js +6208 -0
- package/dist/chunks/shared-D7VtCoY6.js +3586 -0
- package/dist/chunks/{shared-zZF1zU0o.js → shared-DHVDag3x.js} +25 -56
- package/dist/chunks/shared-DdpMqkAH.js +4928 -0
- package/dist/chunks/shared-EYOAbLSo.js +1 -0
- package/dist/chunks/shared-TrlnHjrJ.js +1 -0
- package/dist/chunks/shared-a9QCZpxj.js +574 -0
- package/dist/chunks/shared-df9XN7ns.js +904 -0
- package/dist/chunks/shared-dnY35u9q.js +2530 -0
- package/dist/chunks/shared-e9ia12Uz.js +1636 -0
- package/dist/chunks/shared-qk9TB_UM.js +705 -0
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/views/delegation-poker.js +1 -0
- package/dist/views/plain.js +1 -0
- package/dist/views/prototype.js +1 -0
- package/dist/views/slides.js +1 -0
- package/dist/views/task-board.js +1 -0
- package/dist/views/usm.js +1 -0
- package/package.json +8 -10
- package/dist/chunks/shared-B5lBiq5s.js +0 -1
- package/dist/chunks/shared-BjyoXjSO.js +0 -1
- package/dist/chunks/shared-C-d71uRP.js +0 -573
- package/dist/chunks/shared-C5n6LBUz.js +0 -1105
- package/dist/chunks/shared-CAWKGcWJ.js +0 -1053
- package/dist/chunks/shared-CdZhkPto.js +0 -1
- package/dist/chunks/shared-DB_C1Mdu.js +0 -1
- package/dist/chunks/shared-DDOpqbVL.js +0 -49
- package/dist/chunks/shared-DehzCTC2.js +0 -1616
- package/dist/chunks/shared-Dfj6O0K4.js +0 -2774
- package/dist/chunks/shared-DiFAX1_p.js +0 -3780
- package/dist/chunks/shared-DkPo0jX3.js +0 -4214
- package/dist/chunks/shared-GL2Z98Cz.js +0 -4206
- package/dist/chunks/shared-cMhjZGRs.js +0 -301
- package/dist/templates/delegation-poker.js +0 -1
- package/dist/templates/event-storming.js +0 -1
- package/dist/templates/example-mapping.js +0 -1
- package/dist/templates/plain.js +0 -1
- package/dist/templates/prototype.js +0 -1
- package/dist/templates/slides.js +0 -1
- package/dist/templates/task-board.js +0 -1
- package/dist/templates/usm.js +0 -1
- package/dist/templates/whiteboard.js +0 -1
|
@@ -0,0 +1,2530 @@
|
|
|
1
|
+
import{aE as bt,ai as h,as as r,S as qs,aQ as G,a5 as D,ak as z,X as M,j as K,ah as T,al as R,b2 as Ps,H as Is,b3 as Xt,b4 as Os,b5 as Us,au as B,a9 as kt,aw as u,b6 as Yt,aa as w,aX as vt,a8 as Zt,aD as Jt,ac as b,aL as Fs,ad as dt,aO as Qt,az as st,aH as F,b7 as te,av as y,ax as $,a_ as xt,ay as E,aM as W,aB as at,aj as I,aC as ee,ab as V,aA as se,ag as yt,ar as ae,aY as Hs,aW as ne,b8 as _s,b9 as wt,ba as Bs,bb as ie,bc as ct,z as Ns,bd as re,aG as Ws,aZ as Gs,y as Ks,be as Vs,_ as Xs,$ as Ys}from"./shared-DdpMqkAH.js";import{o as N,r as Zs}from"./shared-TrlnHjrJ.js";import{e as Js}from"./shared-a9QCZpxj.js";import{a as oe,c as Qs}from"./shared-Cas88qVh.js";import{c as ta}from"./shared-qk9TB_UM.js";import{p as ea,i as sa,r as aa,c as na,a as le,b as de,d as ia,e as ra,f as oa,h as ce,g as la,j as $t,s as da,k as ca,l as pa,m as ha,n as ua,t as ma}from"./shared-C-M2Nfmu.js";import{B as ga,t as fa,v as ba,i as ka,k as va,j as xa}from"./shared-df9XN7ns.js";import{d as ya}from"./shared-CnPCm4bJ.js";class pt{#n;#t;#e=null;#s=null;#a=null;#i=null;#r=new Map;#o=null;constructor(t){this.#n=t,this.#t=new bt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#a=e,this.#i=s??null,this.#o=null,this.#n.requestUpdate()}close(){this.#e=null,this.#a=null,this.#i=null,this.#n.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#s!==this.#e;this.#s=this.#e,!(t===null||this.#a===null||this.#e===null)&&(this.#t.open(t,this.#a,{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=ea(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return r`${sa(e,aa(na(t.locale),s,n=>this.#l(e,t.submit,n)))}`}#l(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#n.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#n.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const Ct=(a,t,e,s)=>{if(a===null)return null;const n=qs(a),i=t.find(l=>l.value===n);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(n,i.label)}]}},ht=.08,pe=1.8,he=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...a.map(i=>i.x)),e=Math.min(...a.map(i=>i.y)),s=Math.max(...a.map(i=>i.x+i.width))-t,n=Math.max(...a.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-n*.1,width:s*1.2,height:n*1.2}},ue=(a,t)=>a+t/12,wa=(a,t)=>{if(a.length===0)return null;const e=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<e+t);return{x:Math.min(...s.map(n=>n.x)),y:e}},St=16,$a=.8,ut=(a,t,e,s,n)=>a==="start"?St-ue(t,e)*s:(n-e*s)/2-t*s,me=(a,t,e,s,n="center")=>{if(t.width===0||t.height===0)return{...a,x:0,y:0};const i=(l,d,o,g)=>{const p=o*a.scale,f=g*$a;if(p<=g){const S=ut(n,d,o,a.scale,g);return G(l,S-f,S+f)}return G(l,g-(d+o)*a.scale-f,-d*a.scale+f)};return{...a,x:i(a.x,t.x,t.width,e),y:i(a.y,t.y,t.height,s)}},Ca=(a,t,e,s,n,i,l="center")=>{const d=Math.abs(i)>Math.abs(n);if(d&&t.height*a.scale<=s)return null;const o=me({...a,x:a.x-n,y:a.y-i},t,e,s,l);return d&&o.y===a.y?null:o},Sa=a=>Math.exp(-a*.01),ge='button,[role="button"],a,input,textarea,select',Et=(a,t,e)=>{for(const s of a.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},Ea=a=>{const{canvas:t,world:e,onClearSelection:s,onView:n,align:i="center",sizeWorld:l=!0}=a;let d={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const g=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),p=()=>{const{width:c,height:m}=g();o=me(o,d,c,m,i),e.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/o.scale)),e.style.setProperty("--dpk-zoom-scale",String(o.scale)),n?.(o)},f=()=>{const{width:c,height:m}=g(),k=d.width/1.2||1,x=d.height/1.2||1,C=G(Math.min((c-24)/k,(m-40)/x),ht,1);o={scale:C,x:ut(i,d.x,d.width,C,c),y:ut(i,d.y,d.height,C,m)},p()},S=c=>{const{width:m,height:k}=g(),x=he([c]),C=x.width/1.2||1,L=x.height/1.2||1;o={...o,scale:G(Math.min((m-24)/C,(k-40)/L),ht,pe)},o={...o,x:(m-x.width*o.scale)/2-x.x*o.scale,y:(k-x.height*o.scale)/2-x.y*o.scale},p()},O=()=>{const{width:c}=g(),m=d.width/1.2||1,k=G((c-24)/m,ht,1);o={scale:k,x:(c-d.width*k)/2-d.x*k,y:16},p()},lt=c=>{const{width:m,height:k}=g(),x=(C,L,Kt,Vt)=>Vt!==void 0?St-Vt:L<=Kt?ut(i,C,L,1,Kt):St-ue(C,L);o={scale:1,x:x(d.x,d.width,m,c?.x),y:x(d.y,d.height,k,c?.y)},p()},_=(c,m=g().width/2,k=g().height/2)=>{const x=o.scale,C=G(x*c,ht,pe);C!==x&&(o={scale:C,x:m-(m-o.x)*C/x,y:k-(k-o.y)*C/x},p())},Q=c=>{if(Et(c,t,".diagram-zoom")!==null)return;const m=c.deltaMode===1?16:c.deltaMode===2?g().height:1;if(c.ctrlKey||c.metaKey){c.preventDefault();const L=t.getBoundingClientRect();_(Sa(c.deltaY),c.clientX-L.left,c.clientY-L.top);return}const{width:k,height:x}=g(),C=Ca(o,d,k,x,c.deltaX*m,c.deltaY*m,i);C!==null&&(c.preventDefault(),o=C,p())},q=new Map;let A=null,P=!1;const U=()=>{const c=[...q.values()],m=c[0];if(!m)return null;const k=c[1];return k?{x:(m.x+k.x)/2,y:(m.y+k.y)/2,distance:Math.hypot(k.x-m.x,k.y-m.y)}:{...m,distance:0}},tt=c=>{q.size===0&&(P=!1);const m=Et(c,t,ge);c.button!==0||c.pointerType!=="touch"&&m!==null||(q.set(c.pointerId,{x:c.clientX,y:c.clientY}),A=U(),m===null&&t.setPointerCapture(c.pointerId),c.pointerType!=="touch"&&m===null&&(c.preventDefault(),t.focus({preventScroll:!0})))},Ht=c=>{if(!q.has(c.pointerId)||A===null)return;q.set(c.pointerId,{x:c.clientX,y:c.clientY});const m=U();if(m===null)return;const k=m.x-A.x,x=m.y-A.y;if((Math.abs(k)+Math.abs(x)>1||Math.abs(m.distance-A.distance)>1)&&(P=!0),m.distance>0&&A.distance>0){const C=t.getBoundingClientRect();_(Math.pow(m.distance/A.distance,.45),A.x-C.left,A.y-C.top)}o={...o,x:o.x+k,y:o.y+x},p(),A=m,t.classList.toggle("is-panning",P)},et=c=>{q.delete(c.pointerId),A=U(),!(q.size>0)&&(t.classList.remove("is-panning"),c.type==="pointercancel"&&(P=!1))},_t=c=>{P&&(c.preventDefault(),c.stopPropagation()),et(c)},Bt=c=>{if(P){c.preventDefault(),c.stopPropagation(),P=!1;return}!(c.target instanceof Element)||Et(c,t,ge)!==null||s()},Nt=c=>{if(c.target!==t)return;const m=30;if(c.key==="+"||c.key==="=")_(1.1);else if(c.key==="-")_(1/1.1);else if(c.key==="0")f();else if(c.key==="Escape"){if(s()===!1)return}else if(c.key==="ArrowLeft"||c.key==="ArrowRight"||c.key==="ArrowUp"||c.key==="ArrowDown")o={...o,x:o.x+(c.key==="ArrowLeft"?m:c.key==="ArrowRight"?-m:0),y:o.y+(c.key==="ArrowUp"?m:c.key==="ArrowDown"?-m:0)},p();else return;c.preventDefault()},Wt=c=>{const m=c.target instanceof HTMLElement?c.target:null;if(m===null||!c.composedPath().includes(e))return;const k=m.getBoundingClientRect(),x=t.getBoundingClientRect();let C=0,L=0;k.left<x.left+12?C=x.left+12-k.left:k.right>x.right-12&&(C=x.right-12-k.right),k.top<x.top+12?L=x.top+12-k.top:k.bottom>x.bottom-40&&(L=x.bottom-40-k.bottom),!(C===0&&L===0)&&(o={...o,x:o.x+C,y:o.y+L},p())};t.addEventListener("wheel",Q,{passive:!1}),t.addEventListener("pointerdown",tt),t.addEventListener("pointermove",Ht),t.addEventListener("pointerup",_t),t.addEventListener("pointercancel",et),t.addEventListener("lostpointercapture",et),t.addEventListener("click",Bt,!0),t.addEventListener("keydown",Nt),t.addEventListener("focusin",Wt);const Gt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>p());return Gt?.observe(t),{setContent(c){d=he(c.width===0&&c.height===0?[]:[c]),l&&(e.style.width=`${c.width}px`,e.style.height=`${c.height}px`),p()},apply:p,fit:f,fitTo:S,fitWidth:O,reset:lt,zoom:_,view:()=>({...o}),destroy(){Gt?.disconnect(),t.removeEventListener("wheel",Q),t.removeEventListener("pointerdown",tt),t.removeEventListener("pointermove",Ht),t.removeEventListener("pointerup",_t),t.removeEventListener("pointercancel",et),t.removeEventListener("lostpointercapture",et),t.removeEventListener("click",Bt,!0),t.removeEventListener("keydown",Nt),t.removeEventListener("focusin",Wt)}}},za=["fit","fit-width","actual","none"];class Ta{#n;#t=null;#e=null;#s=!1;constructor(t,e){this.#n=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.#n.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=Ea({canvas:e,world:s,align:this.#n.align(),sizeWorld:!1,onClearSelection:()=>this.#n.onDismiss(),onView:n=>this.#n.onView(n)}),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.#n.elements()?.world;if(t===null||e===void 0)return;const s=this.#n.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const n=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:n,height:i}),!this.#s&&n>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#s=!0;const e=this.#n.initial(),s=za.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 Aa=(a,t,e)=>a.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),fe=160,zt=(a,t,e=fe)=>Math.max(e,Math.round(a+t)),Ma=(a,t,e,s=fe)=>{const n=e?96:24;return t==="ArrowDown"?zt(a,n,s):t==="ArrowUp"?zt(a,-n,s):null},be={kind:"idle"};class La{constructor(t,e){this.#e=null,this.#s=be,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const n=s.currentTarget;n instanceof Element&&n.setPointerCapture(s.pointerId),this.#s={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#n.requestUpdate()},pointermove:s=>{const n=this.#s;n.kind!=="dragging"||n.pointerId!==s.pointerId||this.#a(zt(n.startHeight,s.clientY-n.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const n=Ma(this.#e??this.#t(),s.key,s.shiftKey);n!==null&&(s.preventDefault(),this.#a(n))},dblclick:()=>this.#a(null)},this.#n=t,this.#t=e,t.addController(this)}#n;#t;#e;#s;hostConnected(){}get height(){return this.#e}get dragging(){return this.#s.kind==="dragging"}#a(t){t!==this.#e&&(this.#e=t,this.#n.requestUpdate())}#i(t){const e=this.#s;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#s=be,this.#n.requestUpdate())}}const Da=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 ke extends z{static{this.styles=[M,K,T`
|
|
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: 10px;
|
|
123
|
+
color: var(--dpk-ink-faint);
|
|
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: 10.5px;
|
|
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}}}#n=new R(this);#t=new Ta(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=Ra(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new La(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#s=0;#a=!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.#v),this.addEventListener("wheel",this.#g,{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.#s=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#m(),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.#a=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#a,e=this.#e.height;return r`
|
|
371
|
+
${this.maximized?r`<div class="placeholder" style="height:${this.#s}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?r`<span class="title" title=${this.heading}>${this.heading}</span>`:h}
|
|
382
|
+
${this.subject?r`<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():r`<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 Da(this.#n.locale)}#r(){return r`<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.#l():null,this.maximizable?this.#d():null,this.resizable&&!this.maximized?this.#h():null].filter(n=>n!==null);return r`<div class="controls" part="controls" role="toolbar" aria-label=${e.controls} ?hidden=${!t}>
|
|
398
|
+
<slot name="controls" @slotchange=${this.#u}></slot>
|
|
399
|
+
${s.map((n,i)=>r`${i>0||this.#a?r`<span class="separator"></span>`:h}${n}`)}
|
|
400
|
+
</div>`}#l(){const t=this.#i;return r`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
|
|
401
|
+
${Ps()}
|
|
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
|
+
${Is()}
|
|
414
|
+
</button>`}#d(){const t=this.maximized?this.#i.restore:this.#i.maximize;return r`<button
|
|
415
|
+
type="button"
|
|
416
|
+
class="maximize"
|
|
417
|
+
aria-label=${t}
|
|
418
|
+
title=${t}
|
|
419
|
+
aria-pressed=${this.maximized?"true":"false"}
|
|
420
|
+
@click=${()=>this.#c(!this.maximized)}
|
|
421
|
+
>
|
|
422
|
+
${this.maximized?Xt():Os()}
|
|
423
|
+
</button>`}#p(){const t=this.#i.restore;return r`<button
|
|
424
|
+
type="button"
|
|
425
|
+
class="exit-fullscreen"
|
|
426
|
+
aria-label=${t}
|
|
427
|
+
title=${t}
|
|
428
|
+
@click=${()=>this.#c(!1)}
|
|
429
|
+
>
|
|
430
|
+
${Xt()}
|
|
431
|
+
</button>`}#h(){const t=this.#i,e=this.#e.handlers;return r`<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
|
+
${Us()}
|
|
447
|
+
</div>`}#u=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#a&&this.requestUpdate()};#c(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#m(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#g=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(n=>{if(!(n instanceof Element))return[];const{overflowX:i,overflowY:l}=getComputedStyle(n);return[{overflowX:i,scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,overflowY:l,scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight}]});Aa(s,t.deltaX,t.deltaY)||t.preventDefault()};#v=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#c(!1))}}const Ra=a=>`${Math.round(a.scale*100)}%`,ve=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",ke)},ja=(a,t)=>a.active.includes(t)?{...a,active:a.active.filter(e=>e!==t)}:a.match==="single"?{...a,active:[t]}:{...a,active:[...a.active,t]},qa=(a,t)=>({match:t,active:t==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Pa=a=>({...a,active:[]}),Ia=a=>{const t=new Map;for(const e of a)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},Oa={nodes:new Map,edges:new Set},xe=(a,t,e,s)=>{const n=new Map,i=new Set,l=[{id:t,depth:0}],d=new Set([t]);for(const o of l)if(!(!s&&o.depth>=1))for(const g of a){const p=e==="outgoing"?g.from:g.to,f=e==="outgoing"?g.to:g.from;p===o.id&&(i.add(g.id),!d.has(f)&&(d.add(f),n.set(f,o.depth+1),l.push({id:f,depth:o.depth+1})))}return{nodes:n,edges:i}},Ua=(a,t)=>{const e=new Map(a.map(i=>[i,xe(t,i,"outgoing",!0).nodes])),s=new Set,n=[];for(const i of a){if(s.has(i))continue;const l=a.filter(d=>d===i||e.get(i)?.has(d)===!0&&e.get(d)?.has(i)===!0);for(const d of l)s.add(d);(l.length>1||t.some(d=>d.from===i&&d.to===i))&&n.push(l)}return n},Fa=a=>new Map(a.flatMap((t,e)=>t.map(s=>[s,e]))),Ha=(a,t)=>t.get(a.from)===t.get(a.to)&&t.has(a.from),_a=(a,t,e,s)=>{const n=t!==null&&t.kind===e&&t.id===a,i=e==="node"?s.nodes.has(a):s.edges.has(a),l=e==="node"?s.nodes.get(a)??null:null;return{selected:n,related:i&&!n,dimmed:t!==null&&!n&&!i,depth:l}},Ba=(...a)=>a.filter(t=>typeof t=="string"&&t!=="").join(" "),Na=a=>{const t=a[0]??{x:0,y:0},e=a.at(-1)??t;if(a.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(a.length===4){const i=a[1]??t,l=a[2]??e;return{x:i.x,y:(i.y+l.y)/2}}const s=a[2]??t,n=a[3]??e;return{x:(s.x+n.x)/2,y:s.y}},Wa=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"}}),Ga=["single","all","any"],ye=a=>a.startsWith(ga),Ka=a=>{const t=new Set,e=a.flatMap(s=>{const n=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return n.tag===""||t.has(n.tag)?[]:(t.add(n.tag),[n])});return[...e.filter(s=>ye(s.tag)),...e.filter(s=>!ye(s.tag))]},Va=Jt([b(),kt({tag:b(),count:Fs(dt())})]),Xa=kt({tags:w(vt()),active:u(Yt(Qt(w(vt())),null)),match:u(Yt(Qt(st(Ga)),null))}),we=a=>{const t=B(Xa,Array.isArray(a)?{tags:a}:a),e=t.tags.flatMap(n=>{const i=Zt(Va,n);return i.success?[i.output]:[]}),s=t.active?.filter(n=>typeof n=="string")??null;return{tags:e,active:s,match:t.match??null}},Ya=[["single","Single"],["all","AND"],["any","OR"]];class $e extends z{static{this.styles=[M,T`
|
|
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-faint);
|
|
486
|
+
font-size: 9.5px;
|
|
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-soft);
|
|
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: 10.5px;
|
|
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: var(--dpk-blue);
|
|
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: 9px;
|
|
550
|
+
opacity: 0.7;
|
|
551
|
+
font-variant-numeric: tabular-nums;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.dpk-tag-clear {
|
|
555
|
+
border: 0;
|
|
556
|
+
background: none;
|
|
557
|
+
padding: 4px 6px;
|
|
558
|
+
color: var(--dpk-ink-faint);
|
|
559
|
+
font-size: 10px;
|
|
560
|
+
cursor: pointer;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
button:focus-visible {
|
|
564
|
+
outline: none;
|
|
565
|
+
box-shadow: var(--dpk-focus);
|
|
566
|
+
}
|
|
567
|
+
`]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#n=new R(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=N(this,we,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 fa(t,this.#s)}render(){const t=Ka(this.tags);if(t.length===0)return h;const e=this.#e;return r`
|
|
568
|
+
<div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
|
|
569
|
+
<div class="diagram-match" role="group" aria-label=${e.tagMatch}>
|
|
570
|
+
${Ya.map(([s,n])=>r`
|
|
571
|
+
<button
|
|
572
|
+
type="button"
|
|
573
|
+
data-match=${s}
|
|
574
|
+
aria-pressed=${this.match===s?"true":"false"}
|
|
575
|
+
@click=${()=>this.#a(qa(this.#s,s))}
|
|
576
|
+
>
|
|
577
|
+
${n}
|
|
578
|
+
</button>
|
|
579
|
+
`)}
|
|
580
|
+
</div>
|
|
581
|
+
${F(t,s=>s.tag,s=>r`
|
|
582
|
+
<button
|
|
583
|
+
type="button"
|
|
584
|
+
class="dpk-tag"
|
|
585
|
+
data-tag=${s.tag}
|
|
586
|
+
aria-pressed=${this.active.includes(s.tag)?"true":"false"}
|
|
587
|
+
@click=${()=>this.#a(ja(this.#s,s.tag))}
|
|
588
|
+
>
|
|
589
|
+
<span class="dpk-tag-name" title=${s.tag}>${s.tag}</span>${s.count===null?h:r`<span class="dpk-tag-count">${s.count}</span>`}
|
|
590
|
+
</button>
|
|
591
|
+
`)}
|
|
592
|
+
${this.active.length>0?r`<button type="button" class="dpk-tag-clear" @click=${()=>this.#a(Pa(this.#s))}>
|
|
593
|
+
${e.clearTags}
|
|
594
|
+
</button>`:h}
|
|
595
|
+
</div>
|
|
596
|
+
`}get#e(){return Wa(this.#n.locale)}get#s(){return{active:this.active,match:this.match}}#a(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 Ce=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",$e)},Se=Symbol.for("dev-process-kit:atom-styles"),Ee=()=>{if(typeof document>"u"||Reflect.get(document,Se)===!0)return;Reflect.set(document,Se,!0),Js();const a=[te,oe].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(a.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...a];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${te.cssText}
|
|
597
|
+
${oe.cssText}`,document.head.append(t)},Za=D({en:{aria:"Line chart",empty:"No data to plot",invalid:a=>`Invalid chart data: ${a}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${a}`}}),Tt=["blue","green","amber","violet","accent","ink-faint"],ze=y({x:$(b(),E(1)),y:$(dt(),xt())}),Ja=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(Tt),"blue"),area:u(at(),!1)}),Qa=y({id:W,label:$(b(),E(1)),points:w(ze),tone:u(st(Tt),"ink-faint"),dashed:u(at(),!0)}),tn=y({x:$(b(),E(1)),label:$(b(),E(1)),tone:u(st(Tt),"accent")}),Te=y({label:u(b()),min:u($(dt(),xt())),max:u($(dt(),xt()))}),en=y({title:u(b(),""),caption:u(b(),""),series:u(w(Ja),[]),guides:u(w(Qa),[]),marks:u(w(tn),[]),xAxis:u(Te,{}),yAxis:u(Te,{})}),At=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},Ae=(a,t)=>{At(a.map(e=>e.x),`x in "${t}"`)},Me=a=>{const t=B(en,a);At(t.series.map(e=>e.id),"series id"),At(t.guides.map(e=>e.id),"guide id");for(const e of t.series)Ae(e.points,e.label);for(const e of t.guides)Ae(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},X={top:22,right:18,bottom:38,left:52},Mt=6,sn=a=>{const t=[],e=new Set;for(const s of[...a.series,...a.guides])for(const n of s.points)e.has(n.x)||(e.add(n.x),t.push(n.x));return t},an=a=>{const t=[...a.series,...a.guides].flatMap(l=>l.points.map(d=>d.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),n=a.yAxis.min??Math.min(0,e);let i=a.yAxis.max??s;if(i<=n&&(i=n+1),a.yAxis.max===void 0){const l=i-n;i+=l*.08}return{min:n,max:i}},Lt=a=>a.length===0?"":a.map((t,e)=>`${e===0?"M":"L"}${Y(t.x)} ${Y(t.y)}`).join(" "),nn=(a,t)=>a.length===0?null:`${Lt(a)} L${Y(a.at(-1)?.x??0)} ${Y(t)} L${Y(a[0]?.x??0)} ${Y(t)} Z`,Y=a=>Math.round(a*100)/100,Le=a=>Number.isInteger(a)?String(a):String(Math.round(a*10)/10),rn=(a,t)=>{const e=a/Math.max(1,t),s=10**Math.floor(Math.log10(e)),n=e/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s},on=(a,t,e)=>{const s=rn(t-a,4),n=Math.ceil(a/s)*s,i=[];for(let d=n;d<=t+s/1e3;d+=s)i.push({y:e(d),label:Le(d)});const l=e(a);return i.some(d=>Math.abs(d.y-l)<.01)||i.push({y:l,label:Le(a)}),i},ln=(a,t)=>{if(a.length===0)return[];if(a.length<=Mt)return a.map((s,n)=>({x:t(n),label:s}));const e=Array.from({length:Mt},(s,n)=>Math.round(n*(a.length-1)/(Mt-1)));return[...new Set(e)].map(s=>({x:t(s),label:a[s]??""}))},dn=(a,t=720,e=280)=>{const s=sn(a),n=an(a);if(s.length===0||n===null)return null;const i={left:X.left,top:X.top,width:t-X.left-X.right,height:e-X.top-X.bottom},l=new Map(s.map((f,S)=>[f,S])),d=f=>s.length===1?i.left+i.width/2:i.left+f/(s.length-1)*i.width,o=f=>i.top+(1-(f-n.min)/(n.max-n.min))*i.height,g=f=>f.flatMap(S=>{const O=l.get(S.x);return O===void 0?[]:[{x:d(O),y:o(S.y)}]}).sort((S,O)=>S.x-O.x),p=i.top+i.height;return{width:t,height:e,plot:i,series:a.series.map(f=>{const S=g(f.points);return{...f,nodes:S,path:Lt(S),areaPath:f.area?nn(S,p):null}}),guides:a.guides.map(f=>({...f,path:Lt(g(f.points))})),marks:a.marks.flatMap(f=>{const S=l.get(f.x);return S===void 0?[]:[{...f,x:d(S)}]}),xTicks:ln(s,d),yTicks:on(n.min,n.max,o)}},cn=T`
|
|
598
|
+
:host {
|
|
599
|
+
display: block;
|
|
600
|
+
min-width: 0;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.guide {
|
|
604
|
+
fill: none;
|
|
605
|
+
stroke: var(--tone, var(--dpk-ink-faint));
|
|
606
|
+
stroke-width: 1.25;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.guide[data-dashed] {
|
|
610
|
+
stroke-dasharray: 5 4;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.axis-label {
|
|
614
|
+
fill: var(--dpk-ink-faint);
|
|
615
|
+
font-family: var(--dpk-mono);
|
|
616
|
+
font-size: 10px;
|
|
617
|
+
}
|
|
618
|
+
`,H=a=>`--tone: var(--dpk-${a})`;class De extends z{static{this.styles=[Qs,cn]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#s=N(this,Me,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Me(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=Za(this.#n.locale),e=this.#t,s=e===null?null:dn(e);if(this.#e!==null)return this.#a(r`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#a(r`<p class="dpk-chart-empty">${t.empty}</p>`);const n=e.title===""?t.aria:e.title;return r`<section class="dpk-chart" aria-label=${n}>
|
|
619
|
+
${e.title===""&&e.caption===""?h:r`<header class="dpk-chart-head">
|
|
620
|
+
${e.title===""?h:r`<span class="dpk-chart-title">${e.title}</span>`}
|
|
621
|
+
${e.caption===""?h:r`<span class="dpk-chart-value">${e.caption}</span>`}
|
|
622
|
+
</header>`}
|
|
623
|
+
<div class="dpk-chart-plot">${this.#i(e,s,n)}</div>
|
|
624
|
+
${this.#d(e)}
|
|
625
|
+
</section>`}#a(t){return r`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:n,width:i,height:l}=e,d=n.top+n.height;return r`<svg viewBox="0 0 ${i} ${l}" role="img" aria-label=${s}>
|
|
626
|
+
<title>${s}</title>
|
|
627
|
+
<g class="dpk-chart-grid">
|
|
628
|
+
${e.yTicks.map(o=>I`<line x1=${n.left} x2=${n.left+n.width} y1=${o.y} y2=${o.y}></line>`)}
|
|
629
|
+
</g>
|
|
630
|
+
<g class="dpk-chart-axis">
|
|
631
|
+
<line x1=${n.left} x2=${n.left} y1=${n.top} y2=${d}></line>
|
|
632
|
+
<line x1=${n.left} x2=${n.left+n.width} y1=${d} y2=${d}></line>
|
|
633
|
+
</g>
|
|
634
|
+
${e.yTicks.map(o=>I`<text class="dpk-chart-tick" x=${n.left-8} y=${o.y+3} text-anchor="end">${o.label}</text>`)}
|
|
635
|
+
${e.xTicks.map(o=>I`<text class="dpk-chart-tick" x=${o.x} y=${d+16} text-anchor="middle">${o.label}</text>`)}
|
|
636
|
+
${t.xAxis.label===void 0?h:I`<text class="axis-label" x=${n.left+n.width/2} y=${l-3} text-anchor="middle">${t.xAxis.label}</text>`}
|
|
637
|
+
${t.yAxis.label===void 0?h:I`<text class="axis-label" x=${12} y=${n.top+n.height/2} text-anchor="middle" transform="rotate(-90 12 ${n.top+n.height/2})">${t.yAxis.label}</text>`}
|
|
638
|
+
${e.guides.map(o=>this.#o(o))}
|
|
639
|
+
${e.series.map(o=>this.#r(o))}
|
|
640
|
+
${e.marks.map(o=>this.#l(o,n.top,d))}
|
|
641
|
+
</svg>`}#r(t){return t.path===""?h:I`${t.areaPath===null?h:I`<path class="dpk-chart-area" d=${t.areaPath} style=${H(t.tone)}></path>`}
|
|
642
|
+
<path class="dpk-chart-line" d=${t.path} style=${H(t.tone)}></path>
|
|
643
|
+
${t.nodes.map(e=>I`<circle
|
|
644
|
+
class="dpk-chart-point"
|
|
645
|
+
cx=${e.x}
|
|
646
|
+
cy=${e.y}
|
|
647
|
+
r="2.5"
|
|
648
|
+
style=${H(t.tone)}
|
|
649
|
+
></circle>`)}`}#o(t){return t.path===""?h:I`<path
|
|
650
|
+
class="guide"
|
|
651
|
+
d=${t.path}
|
|
652
|
+
style=${H(t.tone)}
|
|
653
|
+
?data-dashed=${t.dashed}
|
|
654
|
+
></path>`}#l(t,e,s){return I`<line
|
|
655
|
+
class="dpk-chart-mark"
|
|
656
|
+
x1=${t.x}
|
|
657
|
+
x2=${t.x}
|
|
658
|
+
y1=${e}
|
|
659
|
+
y2=${s}
|
|
660
|
+
style=${H(t.tone)}
|
|
661
|
+
></line>
|
|
662
|
+
<text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${H(t.tone)}
|
|
663
|
+
>${t.label}</text
|
|
664
|
+
>`}#d(t){return t.series.length===0&&t.guides.length===0&&t.marks.length===0?h:r`<div class="dpk-chart-legend">
|
|
665
|
+
${t.series.map(e=>r`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${H(e.tone)}
|
|
666
|
+
>${e.label}</span
|
|
667
|
+
>`)}
|
|
668
|
+
${t.guides.map(e=>r`<span class="dpk-chart-key" data-variant="dashed" style=${H(e.tone)}>${e.label}</span>`)}
|
|
669
|
+
${t.marks.map(e=>r`<span class="dpk-chart-key" data-variant="mark" style=${H(e.tone)}>${e.label}</span>`)}
|
|
670
|
+
</div>`}}const Re=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",De)},pn=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===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:a=>`Comment on ${a}`,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:a=>`${a} \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:a=>`${a}\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"}}),j=$(b(),se(),E(1)),nt=y({id:W,text:j}),hn=ee("kind",[y({kind:V("proved"),assumptions:u(w(j))}),y({kind:V("bounded"),bound:j}),y({kind:V("incomplete"),gaps:u(w(j))}),y({kind:V("planned")})]),un=y({id:W,target:u(W),statement:j,subjects:u(w(nt)),premises:u(w(nt)),conclusions:$(w(nt),E(1,"a claim needs at least one conclusion")),examples:u(w(nt)),notClaimed:u(w(nt)),assurance:hn,source:u(y({tool:u(j),ref:j}))}),mn=y({id:W,name:j,meaning:j}),gn=y({id:W,name:j,code:u(j),summary:u(j)}),fn=y({targets:u(w(gn)),terms:u(w(mn)),claims:w(un)}),bn=()=>({targets:[],terms:[],claims:[]}),kn=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,vn=(a,t)=>{const e=[];let s=0;for(const n of a.matchAll(kn)){const i=(n[1]??"").trim(),l=t.get(i);if(l===void 0)throw new Error(`unknown term reference: [[${i}]]`);n.index>s&&e.push({kind:"text",text:a.slice(s,n.index)}),e.push({kind:"term",id:i,label:n[2]?.trim()||l}),s=n.index+n[0].length}return s<a.length&&e.push({kind:"text",text:a.slice(s)}),e},je=a=>a.map(t=>t.kind==="text"?t.text:t.label).join(""),xn=a=>[...new Set(a.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],mt=(a,t)=>{const e=new Set;for(const s of a){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},qe=a=>{const t=B(fn,a),e=t.targets??[],s=t.terms??[];mt(e.map(p=>p.id),"target"),mt(s.map(p=>p.id),"term"),mt(t.claims.map(p=>p.id),"claim");const n=new Map(s.map(p=>[p.id,p.name])),i=p=>vn(p,n),l=s.map(p=>({id:p.id,name:p.name,meaning:i(p.meaning)})),d=e.map(p=>({id:p.id,name:p.name,code:p.code??null,summary:p.summary===void 0?null:i(p.summary)})),o=new Set(d.map(p=>p.id)),g=t.claims.map(p=>{if(p.target!==void 0&&!o.has(p.target))throw new Error(`unknown target (in claim ${p.id}): ${p.target}`);const f=U=>(U??[]).map(tt=>({id:tt.id,text:i(tt.text)})),S=f(p.subjects),O=f(p.premises),lt=f(p.conclusions),_=f(p.examples),Q=f(p.notClaimed),q=[...S,...O,...lt,..._,...Q];mt(q.map(U=>U.id),`clause (in claim ${p.id})`);const A=yn(p.assurance,i),P=i(p.statement);return{id:p.id,target:p.target??null,statement:P,subjects:S,premises:O,conclusions:lt,examples:_,notClaimed:Q,assurance:A,source:p.source===void 0?null:{tool:p.source.tool??null,ref:p.source.ref},terms:xn([P,...q.map(U=>U.text),...wn(A)])}});return{targets:d,terms:l,claims:g}},yn=(a,t)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},wn=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},$n=a=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of a.claims)t[Pe(e.assurance)?"conditional":e.assurance.kind]+=1;return t},Pe=a=>a.kind==="proved"&&a.assumptions.length>0,Ie=a=>{const t=new Map(a.targets.map(s=>[s.id,s])),e=new Map;for(const s of a.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of a.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,n])=>({target:s===null?null:t.get(s)??null,claims:n}))},it=(a,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:a,items:t},Dt=(a,t)=>{switch(t.kind){case"proved":return Pe(t)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...it(a.assumptions,t.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...it("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...it(a.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...it(a.gaps,t.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...it("",[])}}},Cn=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},Sn=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Oe=32,Ue=a=>{const t=je(a.statement);return t.length<=Oe?t:`${t.slice(0,Oe).trimEnd()}\u2026`},En=a=>[{target:{kind:"claim",claim:a.id},label:Ue(a)},...Sn(a).map(t=>({target:{kind:"clause",claim:a.id,clause:t.id},label:`${Ue(a)} \u203A ${je(t.text)}`}))],zn=a=>Ie(a).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(En)]),Tn=[M,K,yt,T`
|
|
671
|
+
:host {
|
|
672
|
+
display: block;
|
|
673
|
+
container-type: inline-size;
|
|
674
|
+
color: var(--dpk-ink);
|
|
675
|
+
font-family: var(--dpk-body);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.spec {
|
|
679
|
+
display: grid;
|
|
680
|
+
gap: 14px;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/* ----------------------------------------------------------- toolbar */
|
|
684
|
+
|
|
685
|
+
.spec-toolbar {
|
|
686
|
+
display: flex;
|
|
687
|
+
flex-wrap: wrap;
|
|
688
|
+
align-items: baseline;
|
|
689
|
+
gap: 4px 10px;
|
|
690
|
+
padding: 0 2px 10px;
|
|
691
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.spec-title {
|
|
695
|
+
font-family: var(--dpk-display);
|
|
696
|
+
font-size: 14px;
|
|
697
|
+
font-weight: 650;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
.spec-subject {
|
|
701
|
+
color: var(--dpk-ink-soft);
|
|
702
|
+
font-size: 12.5px;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.spec-stats {
|
|
706
|
+
display: inline-flex;
|
|
707
|
+
flex-wrap: wrap;
|
|
708
|
+
align-items: center;
|
|
709
|
+
gap: 6px;
|
|
710
|
+
margin-left: auto;
|
|
711
|
+
color: var(--dpk-ink-faint);
|
|
712
|
+
font-size: 12px;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.spec-chip {
|
|
716
|
+
padding: 1px 8px;
|
|
717
|
+
border-radius: 999px;
|
|
718
|
+
font-weight: 600;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.spec-notice,
|
|
722
|
+
.spec-empty {
|
|
723
|
+
margin: 0;
|
|
724
|
+
padding: 14px;
|
|
725
|
+
border-radius: var(--dpk-radius);
|
|
726
|
+
font-size: 12.5px;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.spec-notice {
|
|
730
|
+
background: var(--dpk-danger-soft);
|
|
731
|
+
color: var(--dpk-danger);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
.spec-empty {
|
|
735
|
+
color: var(--dpk-ink-faint);
|
|
736
|
+
text-align: center;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/* ------------------------------------------------------------ tones */
|
|
740
|
+
|
|
741
|
+
[data-tone='sound'] {
|
|
742
|
+
--tone: var(--dpk-green);
|
|
743
|
+
--tone-soft: var(--dpk-green-soft);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
[data-tone='caveat'] {
|
|
747
|
+
--tone: var(--dpk-amber);
|
|
748
|
+
--tone-soft: var(--dpk-amber-soft);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
[data-tone='unsound'] {
|
|
752
|
+
--tone: var(--dpk-danger);
|
|
753
|
+
--tone-soft: var(--dpk-danger-soft);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
[data-tone='planned'] {
|
|
757
|
+
--tone: var(--dpk-blue);
|
|
758
|
+
--tone-soft: var(--dpk-blue-soft);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
.spec-chip,
|
|
762
|
+
.assurance-badge {
|
|
763
|
+
background: var(--tone-soft);
|
|
764
|
+
color: var(--tone);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/* ----------------------------------------------------------- targets */
|
|
768
|
+
|
|
769
|
+
.spec-groups {
|
|
770
|
+
display: grid;
|
|
771
|
+
gap: 28px;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.target-group {
|
|
775
|
+
display: grid;
|
|
776
|
+
gap: 12px;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
.target-head {
|
|
780
|
+
display: flex;
|
|
781
|
+
flex-wrap: wrap;
|
|
782
|
+
align-items: baseline;
|
|
783
|
+
gap: 4px 10px;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
.target-label {
|
|
787
|
+
color: var(--dpk-ink-faint);
|
|
788
|
+
font-size: 11.5px;
|
|
789
|
+
font-weight: 650;
|
|
790
|
+
letter-spacing: 0.04em;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
.target-name {
|
|
794
|
+
margin: 0;
|
|
795
|
+
font-family: var(--dpk-display);
|
|
796
|
+
font-size: 17px;
|
|
797
|
+
font-weight: 700;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.target-code {
|
|
801
|
+
padding: 1px 7px;
|
|
802
|
+
border: 1px solid var(--dpk-rule);
|
|
803
|
+
border-radius: var(--dpk-radius-sm);
|
|
804
|
+
background: var(--dpk-paper-sunken);
|
|
805
|
+
color: var(--dpk-ink-soft);
|
|
806
|
+
font-family: var(--dpk-mono);
|
|
807
|
+
font-size: 12px;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
.target-summary {
|
|
811
|
+
margin: -4px 0 0;
|
|
812
|
+
color: var(--dpk-ink-soft);
|
|
813
|
+
font-size: 13.5px;
|
|
814
|
+
line-height: 1.7;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/* ------------------------------------------------------------ claims */
|
|
818
|
+
|
|
819
|
+
.spec-claims {
|
|
820
|
+
display: grid;
|
|
821
|
+
gap: 8px;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
.claim {
|
|
825
|
+
padding: 10px 14px 10px 8px;
|
|
826
|
+
border: 1px solid var(--dpk-rule);
|
|
827
|
+
border-radius: var(--dpk-radius-lg);
|
|
828
|
+
background: var(--dpk-paper-raised);
|
|
829
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/* Folded, the head row is the whole card: the statement and how strongly it holds. */
|
|
833
|
+
.claim-head {
|
|
834
|
+
display: flex;
|
|
835
|
+
align-items: flex-start;
|
|
836
|
+
gap: 8px;
|
|
837
|
+
cursor: pointer;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/* Base look and sizing come from .dpk-icon-btn (src/core/theme); only the fold behavior is local. */
|
|
841
|
+
.claim-toggle {
|
|
842
|
+
flex: none;
|
|
843
|
+
margin-top: 1px;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
.claim-toggle svg {
|
|
847
|
+
transition: transform 120ms ease;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
.claim-toggle[aria-expanded='true'] svg {
|
|
851
|
+
transform: rotate(90deg);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.claim-body {
|
|
855
|
+
display: grid;
|
|
856
|
+
gap: 14px;
|
|
857
|
+
margin: 12px 0 6px 32px;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/* The badge explains itself in a tooltip, so it is a button that hover, focus or a tap opens. */
|
|
861
|
+
.assurance-badge {
|
|
862
|
+
flex: none;
|
|
863
|
+
margin-top: 2px;
|
|
864
|
+
padding: 2px 10px;
|
|
865
|
+
border: none;
|
|
866
|
+
border-radius: 999px;
|
|
867
|
+
font: inherit;
|
|
868
|
+
font-size: 11.5px;
|
|
869
|
+
font-weight: 650;
|
|
870
|
+
white-space: nowrap;
|
|
871
|
+
cursor: help;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.assurance-badge:focus-visible {
|
|
875
|
+
outline: 2px solid var(--tone);
|
|
876
|
+
outline-offset: 2px;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.claim-statement {
|
|
880
|
+
flex: 1;
|
|
881
|
+
margin: 0;
|
|
882
|
+
font-size: 14.5px;
|
|
883
|
+
line-height: 1.65;
|
|
884
|
+
font-weight: 500;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/* Subjects / premises / conclusions: the structure of the claim, one row per part. */
|
|
888
|
+
.claim-parts {
|
|
889
|
+
display: grid;
|
|
890
|
+
grid-template-columns: max-content 1fr;
|
|
891
|
+
margin: 0;
|
|
892
|
+
border: 1px solid var(--dpk-rule);
|
|
893
|
+
border-radius: var(--dpk-radius);
|
|
894
|
+
background: var(--dpk-paper-sunken);
|
|
895
|
+
overflow: hidden;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
.claim-part {
|
|
899
|
+
display: contents;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
.claim-part > dt,
|
|
903
|
+
.claim-part > dd {
|
|
904
|
+
margin: 0;
|
|
905
|
+
padding: 9px 12px;
|
|
906
|
+
border-top: 1px solid var(--dpk-rule);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
.claim-part:first-child > dt,
|
|
910
|
+
.claim-part:first-child > dd {
|
|
911
|
+
border-top: none;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
.claim-part > dt {
|
|
915
|
+
color: var(--dpk-ink-soft);
|
|
916
|
+
font-size: 11.5px;
|
|
917
|
+
font-weight: 650;
|
|
918
|
+
letter-spacing: 0.04em;
|
|
919
|
+
padding-top: 11px;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/* The conclusion is what the claim asserts: its label reads strongest. */
|
|
923
|
+
.claim-part[data-part='conclusions'] > dt {
|
|
924
|
+
color: var(--dpk-ink);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.claim-none {
|
|
928
|
+
margin: 0;
|
|
929
|
+
color: var(--dpk-ink-faint);
|
|
930
|
+
font-size: 13px;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
.clauses {
|
|
934
|
+
display: grid;
|
|
935
|
+
gap: 2px;
|
|
936
|
+
margin: 0;
|
|
937
|
+
padding: 0;
|
|
938
|
+
list-style: none;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
.clause {
|
|
942
|
+
position: relative;
|
|
943
|
+
display: flex;
|
|
944
|
+
align-items: flex-start;
|
|
945
|
+
gap: 6px;
|
|
946
|
+
min-height: 28px;
|
|
947
|
+
padding: 2px 0 2px 14px;
|
|
948
|
+
font-size: 13.5px;
|
|
949
|
+
line-height: 1.7;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
.clause::before {
|
|
953
|
+
content: '';
|
|
954
|
+
position: absolute;
|
|
955
|
+
left: 2px;
|
|
956
|
+
top: 0.95em;
|
|
957
|
+
width: 5px;
|
|
958
|
+
height: 5px;
|
|
959
|
+
border-radius: 50%;
|
|
960
|
+
background: var(--dpk-ink-faint);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.clause-text {
|
|
964
|
+
flex: 1;
|
|
965
|
+
min-width: 0;
|
|
966
|
+
overflow-wrap: anywhere;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/* ---------------------------------------------------------- assurance */
|
|
970
|
+
|
|
971
|
+
.assurance {
|
|
972
|
+
padding: 10px 14px;
|
|
973
|
+
border-radius: var(--dpk-radius);
|
|
974
|
+
background: var(--tone-soft);
|
|
975
|
+
font-size: 12.5px;
|
|
976
|
+
line-height: 1.6;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.assurance-label {
|
|
980
|
+
margin: 0;
|
|
981
|
+
color: var(--tone);
|
|
982
|
+
font-weight: 650;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
.assurance ul {
|
|
986
|
+
margin: 4px 0 0;
|
|
987
|
+
padding-left: 18px;
|
|
988
|
+
color: var(--dpk-ink);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/* ---------------------------------------------------- examples / not */
|
|
992
|
+
|
|
993
|
+
.claim-aside h5 {
|
|
994
|
+
margin: 0 0 2px;
|
|
995
|
+
color: var(--dpk-ink-soft);
|
|
996
|
+
font-size: 11.5px;
|
|
997
|
+
font-weight: 650;
|
|
998
|
+
letter-spacing: 0.04em;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
.claim-aside[data-part='not-claimed'] {
|
|
1002
|
+
padding: 10px 14px;
|
|
1003
|
+
border: 1px dashed var(--dpk-rule-strong);
|
|
1004
|
+
border-radius: var(--dpk-radius);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.claim-aside[data-part='not-claimed'] .clause::before {
|
|
1008
|
+
content: '×';
|
|
1009
|
+
left: 0;
|
|
1010
|
+
top: 0;
|
|
1011
|
+
width: auto;
|
|
1012
|
+
height: auto;
|
|
1013
|
+
border-radius: 0;
|
|
1014
|
+
background: none;
|
|
1015
|
+
color: var(--dpk-ink-faint);
|
|
1016
|
+
font-weight: 700;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.claim-aside[data-part='not-claimed'] .clause-text {
|
|
1020
|
+
color: var(--dpk-ink-soft);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/* ------------------------------------------------------------- footer */
|
|
1024
|
+
|
|
1025
|
+
.claim-foot {
|
|
1026
|
+
display: flex;
|
|
1027
|
+
flex-wrap: wrap;
|
|
1028
|
+
align-items: center;
|
|
1029
|
+
gap: 6px 8px;
|
|
1030
|
+
padding-top: 10px;
|
|
1031
|
+
border-top: 1px solid var(--dpk-rule);
|
|
1032
|
+
color: var(--dpk-ink-faint);
|
|
1033
|
+
font-size: 11.5px;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
.claim-foot-label {
|
|
1037
|
+
font-weight: 650;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.term-chip {
|
|
1041
|
+
padding: 1px 9px;
|
|
1042
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1043
|
+
border-radius: 999px;
|
|
1044
|
+
background: var(--dpk-paper);
|
|
1045
|
+
color: var(--dpk-ink-soft);
|
|
1046
|
+
font: inherit;
|
|
1047
|
+
cursor: help;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
.term-chip:is(:hover, :focus-visible) {
|
|
1051
|
+
border-color: var(--dpk-violet);
|
|
1052
|
+
color: var(--dpk-violet);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
.claim-source {
|
|
1056
|
+
margin-left: auto;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
.claim-source code {
|
|
1060
|
+
font-family: var(--dpk-mono);
|
|
1061
|
+
font-size: 11px;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/* -------------------------------------------------------------- terms */
|
|
1065
|
+
|
|
1066
|
+
.term {
|
|
1067
|
+
display: inline;
|
|
1068
|
+
padding: 0 1px;
|
|
1069
|
+
border: none;
|
|
1070
|
+
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
1071
|
+
background: none;
|
|
1072
|
+
color: inherit;
|
|
1073
|
+
font: inherit;
|
|
1074
|
+
font-weight: 600;
|
|
1075
|
+
cursor: help;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
.term:hover,
|
|
1079
|
+
.term:focus-visible {
|
|
1080
|
+
background: var(--dpk-violet-soft);
|
|
1081
|
+
outline: none;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/* ----------------------------------------------------------- tooltip */
|
|
1085
|
+
|
|
1086
|
+
/* Sized to its text: the popover helper sets a fixed width, which only !important overrides. */
|
|
1087
|
+
.spec-tip {
|
|
1088
|
+
box-sizing: border-box;
|
|
1089
|
+
position: fixed;
|
|
1090
|
+
inset: auto;
|
|
1091
|
+
width: max-content !important;
|
|
1092
|
+
max-width: min(300px, calc(100vw - 16px));
|
|
1093
|
+
margin: 0;
|
|
1094
|
+
padding: 8px 11px;
|
|
1095
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1096
|
+
border-radius: var(--dpk-radius);
|
|
1097
|
+
background: var(--dpk-paper-raised);
|
|
1098
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
1099
|
+
color: var(--dpk-ink);
|
|
1100
|
+
font-size: 12.5px;
|
|
1101
|
+
line-height: 1.6;
|
|
1102
|
+
pointer-events: none;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.spec-tip p {
|
|
1106
|
+
margin: 0;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.tip-title {
|
|
1110
|
+
color: var(--dpk-violet);
|
|
1111
|
+
font-weight: 650;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.spec-tip[data-tone] .tip-title {
|
|
1115
|
+
color: var(--tone);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
.term-static {
|
|
1119
|
+
border-bottom: 1.5px dotted var(--dpk-violet);
|
|
1120
|
+
font-weight: 600;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
@container (max-width: 520px) {
|
|
1124
|
+
.claim-parts {
|
|
1125
|
+
grid-template-columns: 1fr;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
.claim-part > dd {
|
|
1129
|
+
border-top: none;
|
|
1130
|
+
padding-top: 0;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/* ---------------------------------------------------------- comments */
|
|
1135
|
+
/* "Review comment" opens from the right-click menu (src/core/context-menu); the
|
|
1136
|
+
popover itself still renders here, anchored at the target's own element. */
|
|
1137
|
+
|
|
1138
|
+
.comment-target {
|
|
1139
|
+
font-size: 12px;
|
|
1140
|
+
overflow-wrap: anywhere;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
.comment-error {
|
|
1144
|
+
margin: 0;
|
|
1145
|
+
font-size: 11px;
|
|
1146
|
+
color: var(--dpk-accent);
|
|
1147
|
+
}
|
|
1148
|
+
`],Fe=a=>`claim-body-${a}`;class He extends z{static{this.styles=Tn}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#n=null;#t=new Map;#e=null;#s=null;#a="";#i=new Set;#r=null;#o=null;#l=new bt(this);#d=new pt(this);#p=new R(this,()=>{this.#a=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#a="",document.addEventListener("keydown",this.#$),document.addEventListener("pointerdown",this.#T),this.#s=N(this,qe,t=>{t.ok?this.#g(t.value):this.#v(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#$),document.removeEventListener("pointerdown",this.#T),this.#s?.(),this.#s=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#k(),this.#d.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,ae(this.#p.locale),(s,n)=>this.#h(s,n));return e===null?null:[e]}#h(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#d.open(t,s,e)}#u(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.#n===null)return[];const t=`${this.subject??this.heading??this.#c.heading} \xB7 ${this.id}`;return zn(this.#n).map(({target:e,label:s})=>({value:this.#f(e),label:s,group:t}))}get dataError(){return this.#e}get#c(){return pn(this.#p.locale)}#m(){return this.#n??bn()}#g(t){this.#n=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#v(t){this.#n=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#f(t){return`element:${[this.id,...Cn(t)].map(e=>encodeURIComponent(e)).join("/")}`}#k(){const t=JSON.stringify(this.commentTargets);t!==this.#a&&(this.#a=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#y(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===Fe(t)&&this.#b(s)}this.requestUpdate()}#S(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#y(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.#l.open(s,t,{width:300,height:240},{placement:"top-start"})}#x(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())}#$=t=>{t.key==="Escape"&&this.#b()};#T=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#b()};#A(t){const e=(n,i)=>{n.currentTarget instanceof HTMLElement&&i(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&e(n,i=>this.#x(t,i)),leave:n=>s(n)&&e(n,i=>this.#b(i)),show:n=>e(n,i=>this.#x(t,i)),hide:n=>e(n,i=>this.#b(i))}}render(){const t=this.#c,e=this.#m();return r`
|
|
1149
|
+
<section class="spec">
|
|
1150
|
+
<header class="spec-toolbar">
|
|
1151
|
+
<span class="spec-title">${this.heading??t.heading}</span>
|
|
1152
|
+
${this.subject?r`<span class="spec-subject">${this.subject}</span>`:h}
|
|
1153
|
+
<span class="spec-stats">${this.#L(e)}</span>
|
|
1154
|
+
</header>
|
|
1155
|
+
${this.#e===null?h:r`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
|
|
1156
|
+
${this.#e===null&&e.claims.length===0?r`<p class="spec-empty">${t.empty}</p>`:h}
|
|
1157
|
+
<div class="spec-groups">
|
|
1158
|
+
${F(Ie(e),s=>s.target?.id??"",s=>this.#D(s))}
|
|
1159
|
+
</div>
|
|
1160
|
+
</section>
|
|
1161
|
+
${this.#I()}
|
|
1162
|
+
${this.#d.render({locale:this.#p.locale,errorMessage:this.#c.sendFailed,submit:(s,n)=>this.#u(s,n)})}
|
|
1163
|
+
`}#L(t){const e=this.#c,s=$n(t),n=[{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 r`${e.claims(t.claims.length)}
|
|
1164
|
+
${n.map(i=>r`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#D(t){const e=r`<div class="spec-claims">
|
|
1165
|
+
${F(t.claims,n=>n.id,n=>this.#R(n))}
|
|
1166
|
+
</div>`,s=t.target;return s===null?e:r`<section class="target-group" data-target=${s.id}>
|
|
1167
|
+
<header class="target-head" data-dpk-target=${this.#f({kind:"target",target:s.id})}>
|
|
1168
|
+
<span class="target-label">${this.#c.target}</span>
|
|
1169
|
+
<h3 class="target-name">${s.name}</h3>
|
|
1170
|
+
${s.code===null?h:r`<code class="target-code">${s.code}</code>`}
|
|
1171
|
+
</header>
|
|
1172
|
+
${s.summary===null?h:r`<p class="target-summary">${this.#C(s.summary)}</p>`}
|
|
1173
|
+
${t.claims.length===0?r`<p class="spec-empty">${this.#c.noClaims}</p>`:e}
|
|
1174
|
+
</section>`}#R(t){const e=this.#c,s=Dt(e,t.assurance),n=this.#i.has(t.id),i=this.#A({kind:"assurance",claim:t.id}),l=Fe(t.id);return r`
|
|
1175
|
+
<article class="claim" data-claim=${t.id} data-tone=${s.tone}>
|
|
1176
|
+
<div
|
|
1177
|
+
class="claim-head"
|
|
1178
|
+
data-dpk-target=${this.#f({kind:"claim",claim:t.id})}
|
|
1179
|
+
@click=${d=>this.#S(d,t.id)}
|
|
1180
|
+
>
|
|
1181
|
+
<button
|
|
1182
|
+
type="button"
|
|
1183
|
+
class="dpk-icon-btn claim-toggle"
|
|
1184
|
+
aria-expanded=${n?"true":"false"}
|
|
1185
|
+
aria-controls=${n?l:h}
|
|
1186
|
+
aria-label=${n?e.hideDetails:e.showDetails}
|
|
1187
|
+
@click=${()=>this.#y(t.id)}
|
|
1188
|
+
>
|
|
1189
|
+
${Hs()}
|
|
1190
|
+
</button>
|
|
1191
|
+
<h4 class="claim-statement">${this.#C(t.statement)}</h4>
|
|
1192
|
+
<button
|
|
1193
|
+
type="button"
|
|
1194
|
+
class="assurance-badge"
|
|
1195
|
+
data-tone=${s.tone}
|
|
1196
|
+
@pointerenter=${i.enter}
|
|
1197
|
+
@pointerleave=${i.leave}
|
|
1198
|
+
@focus=${i.show}
|
|
1199
|
+
@blur=${i.hide}
|
|
1200
|
+
@click=${i.show}
|
|
1201
|
+
>
|
|
1202
|
+
${s.label}
|
|
1203
|
+
</button>
|
|
1204
|
+
</div>
|
|
1205
|
+
${n?this.#j(t,l):h}
|
|
1206
|
+
</article>
|
|
1207
|
+
`}#j(t,e){const s=this.#c,n=Dt(s,t.assurance);return r`<div class="claim-body" id=${e}>
|
|
1208
|
+
<dl class="claim-parts">
|
|
1209
|
+
${t.subjects.length===0?h:this.#E("subjects",s.subjects,t,t.subjects)}
|
|
1210
|
+
${t.premises.length===0?r`<div class="claim-part" data-part="premises">
|
|
1211
|
+
<dt>${s.premises}</dt>
|
|
1212
|
+
<dd><p class="claim-none">${s.noPremises}</p></dd>
|
|
1213
|
+
</div>`:this.#E("premises",s.premises,t,t.premises)}
|
|
1214
|
+
${this.#E("conclusions",s.conclusions,t,t.conclusions)}
|
|
1215
|
+
</dl>
|
|
1216
|
+
${n.itemsLabel===null?h:r`<div class="assurance" data-tone=${n.tone}>
|
|
1217
|
+
<p class="assurance-label">${n.itemsLabel}</p>
|
|
1218
|
+
<ul>
|
|
1219
|
+
${n.items.map(i=>r`<li>${this.#C(i)}</li>`)}
|
|
1220
|
+
</ul>
|
|
1221
|
+
</div>`}
|
|
1222
|
+
${t.examples.length===0?h:r`<section class="claim-aside" data-part="examples">
|
|
1223
|
+
<h5>${s.examples}</h5>
|
|
1224
|
+
${this.#z(t,t.examples)}
|
|
1225
|
+
</section>`}
|
|
1226
|
+
${t.notClaimed.length===0?h:r`<section class="claim-aside" data-part="not-claimed">
|
|
1227
|
+
<h5>${s.notClaimed}</h5>
|
|
1228
|
+
${this.#z(t,t.notClaimed)}
|
|
1229
|
+
</section>`}
|
|
1230
|
+
${this.#q(t)}
|
|
1231
|
+
</div>`}#E(t,e,s,n){return r`<div class="claim-part" data-part=${t}>
|
|
1232
|
+
<dt>${e}</dt>
|
|
1233
|
+
<dd>${this.#z(s,n)}</dd>
|
|
1234
|
+
</div>`}#z(t,e){return r`<ul class="clauses">
|
|
1235
|
+
${F(e,s=>s.id,s=>r`<li
|
|
1236
|
+
class="clause"
|
|
1237
|
+
data-clause=${s.id}
|
|
1238
|
+
data-dpk-target=${this.#f({kind:"clause",claim:t.id,clause:s.id})}
|
|
1239
|
+
>
|
|
1240
|
+
<span class="clause-text">${this.#C(s.text)}</span>
|
|
1241
|
+
</li>`)}
|
|
1242
|
+
</ul>`}#q(t){const e=this.#c,s=t.terms.flatMap(n=>this.#t.get(n)??[]);return s.length===0&&t.source===null?h:r`<footer class="claim-foot">
|
|
1243
|
+
${s.length===0?h:r`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(n=>this.#M("term-chip",n.id,n.name))}`}
|
|
1244
|
+
${t.source===null?h:r`<span class="claim-source"
|
|
1245
|
+
>${e.source}: ${t.source.tool===null?h:r`${t.source.tool} · `}<code
|
|
1246
|
+
>${t.source.ref}</code
|
|
1247
|
+
></span
|
|
1248
|
+
>`}
|
|
1249
|
+
</footer>`}#C(t){return r`${t.map(e=>e.kind==="text"?e.text:this.#M("term",e.id,e.label))}`}#P(t){return r`${t.map(e=>e.kind==="text"?e.text:r`<span class="term-static">${e.label}</span>`)}`}#M(t,e,s){const n=this.#A({kind:"term",term:e});return r`<button
|
|
1250
|
+
type="button"
|
|
1251
|
+
class=${t}
|
|
1252
|
+
data-term=${e}
|
|
1253
|
+
@pointerenter=${n.enter}
|
|
1254
|
+
@pointerleave=${n.leave}
|
|
1255
|
+
@focus=${n.show}
|
|
1256
|
+
@blur=${n.hide}
|
|
1257
|
+
@click=${n.show}
|
|
1258
|
+
>
|
|
1259
|
+
${s}
|
|
1260
|
+
</button>`}#I(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#O(t);return e===null?h:r`<div
|
|
1261
|
+
id="spec-tip"
|
|
1262
|
+
class="spec-tip"
|
|
1263
|
+
role="tooltip"
|
|
1264
|
+
popover="manual"
|
|
1265
|
+
data-tone=${e.tone??h}
|
|
1266
|
+
>
|
|
1267
|
+
<p class="tip-title">${e.title}</p>
|
|
1268
|
+
<p class="tip-body">${e.body}</p>
|
|
1269
|
+
</div>`}#O(t){if(t.kind==="term"){const n=this.#t.get(t.term);return n===void 0?null:{title:n.name,body:this.#P(n.meaning)}}const e=this.#n?.claims.find(n=>n.id===t.claim);if(e===void 0)return null;const s=Dt(this.#c,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const _e=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",He)},An=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"}}),Mn=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,Ln=a=>{const t=Mn.exec(a?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},Be=60,Dn=(a,t,e,s)=>{const n=[a,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return n===void 0?s:n.length>Be?`${n.slice(0,Be-1)}\u2026`:n},rt=a=>`${a.kind}:${a.id}`,Rn=a=>{const t=new Map;for(const e of a)t.set(rt(e),(t.get(rt(e))??0)+1);return a.filter(e=>t.get(rt(e))===1)},Ne=(a,t)=>`element:${[a,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,jn="[data-dpk-item]",qn="h1, h2, h3, h4, h5, h6, summary, caption, legend";class We extends z{static{this.styles=[M,K,yt,T`
|
|
1270
|
+
:host {
|
|
1271
|
+
position: relative;
|
|
1272
|
+
display: block;
|
|
1273
|
+
font-size: inherit;
|
|
1274
|
+
line-height: inherit;
|
|
1275
|
+
color: inherit;
|
|
1276
|
+
}
|
|
1277
|
+
.comment-error {
|
|
1278
|
+
margin: 0;
|
|
1279
|
+
font-size: 11px;
|
|
1280
|
+
color: var(--dpk-accent);
|
|
1281
|
+
}
|
|
1282
|
+
`]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=new pt(this);#e=new MutationObserver(()=>{this.#d()});#s=[];#a=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.#d()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#l.heading} \xB7 ${this.id}`;return this.#s.map(e=>({value:Ne(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#h()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=Ct(t.target,this.commentTargets,ae(this.#n.locale),(s,n)=>this.#r(s,n));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 r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:this.#l.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#l(){return An(this.#n.locale)}#d(){const t=[...this.querySelectorAll(jn)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const n=Ln(s.getAttribute("data-dpk-item"));if(n===null)return[];const i=s.querySelector(qn)?.textContent??null,l=Dn(s.getAttribute("data-dpk-label"),i,s.textContent,this.#l.untitled);return[{...n,label:l,element:s}]}),e=Rn(t);if(e.length<t.length){const s=new Set(e.map(rt)),n=[...new Set(t.map(rt).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,n)}this.#s=e,this.#p(),this.#h()}#p(){const t=new Set(this.#s.map(e=>e.element));for(const e of this.#a)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#s)e.element.setAttribute("data-dpk-target",Ne(this.id,e));this.#a=t}#h(){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 Ge=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",We)},Pn="dpk-extend-right-click-run",Rt=$(b(),E(1)),Z=$(b(),E(1)),In=y({kind:V("item"),id:Rt,label:Z,danger:u(at()),event:u(Z),detail:u(_s(b(),vt())),copy:u(Z)}),On=y({kind:V("submenu"),id:Rt,label:Z,entries:w(ne(()=>Ke))}),Ke=ne(()=>ee("kind",[In,On])),Un=y({id:Rt,heading:u(Z),entries:w(Ke)}),Fn=y({selector:$(b(),se(),E(1)),label:u(Z),groups:w(Un)}),Hn=y({targets:w(Fn)}),Ve=(a,t)=>{for(const e of a){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&Ve(e.entries,t)}},jt=a=>{const t=B(Hn,a),e=new Set;for(const s of t.targets)for(const n of s.groups){if(e.has(n.id))throw new Error(`duplicate id: ${n.id}`);e.add(n.id),Ve(n.entries,e)}return t},Xe="dpk-extend-right-click",qt=`[dev-process-kit] ${Xe}: `,_n="text",Bn=(a,t)=>{const e=Bs(a,a),s=e.indexOf(t);return s===-1?null:[a,...e.slice(0,s)]},Nn=(a,t)=>{const s=(t===_n?a.textContent:a.getAttribute(t))?.trim()??"";return s===""?null:s},Wn=(a,t,e)=>{try{return a.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${qt}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class Ye extends z{static{this.styles=T`
|
|
1283
|
+
:host {
|
|
1284
|
+
display: contents;
|
|
1285
|
+
}
|
|
1286
|
+
`}static{this.properties={config:{attribute:!1}}}#n=null;#t=null;#e=null;#s=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=N(this,jt,t=>{if(t.ok){this.#n=t.value,this.#t=null;return}this.#n=null,this.#t=t.error,console.warn(`${qt}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#a();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const n=Bn(s,this);if(n===null||n.some(d=>d.localName===Xe))return null;const i=this.#r(n,e);if(i===null)return null;const l=this.#o(i.target,i.element);return l.length===0?null:l}render(){return r`<slot></slot>`}#a(){return this.config===null?this.#n:(this.#s?.raw!==this.config&&(this.#s={raw:this.config,parsed:this.#i(this.config)}),this.#s.parsed)}#i(t){try{return jt(t)}catch(e){return console.warn(`${qt}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const n of t)for(const i of e.targets)if(Wn(n,i.selector,s))return{target:i,element:n};return null}#o(t,e){return t.groups.flatMap(s=>{const n=this.#l(s.entries,s,t,e);return n.length===0?[]:[s.heading===void 0?{id:s.id,entries:n}:{id:s.id,heading:s.heading,entries:n}]})}#l(t,e,s,n){return t.flatMap(i=>i.kind==="submenu"?this.#d(i,e,s,n):this.#p(i,e,s,n))}#d(t,e,s,n){const i=this.#l(t.entries,e,s,n);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,n){const i=t.copy===void 0?null:Nn(n,t.copy);if(t.copy!==void 0&&i===null)return[];const l=()=>{i!==null&&wt(i),!(i!==null&&t.event===void 0)&&this.#h(t,e,s,n)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:l,danger:!0}:{kind:"item",id:t.id,label:t.label,run:l}]}#h(t,e,s,n){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:n,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??Pn,{detail:i,bubbles:!0,composed:!0}))}}const Ze=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",Ye)},Gn=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 Je extends z{static{this.styles=[M,K,yt,T`
|
|
1287
|
+
:host {
|
|
1288
|
+
position: relative;
|
|
1289
|
+
display: inline-block;
|
|
1290
|
+
}
|
|
1291
|
+
.comment-error {
|
|
1292
|
+
margin: 0;
|
|
1293
|
+
font-size: 11px;
|
|
1294
|
+
color: var(--dpk-accent);
|
|
1295
|
+
/* A refusal lands under the composer it belongs to, rather than
|
|
1296
|
+
simply being there when the reader looks back. */
|
|
1297
|
+
animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
|
|
1298
|
+
}
|
|
1299
|
+
`]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#n=new R(this);#t=new pt(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 r`<slot></slot>${this.#t.render({locale:this.#n.locale,errorMessage:Gn(this.#n.locale).sendFailed,submit:(t,e)=>this.#s(t,e)})}`}#s(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const Qe=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",Je)},ts=(a,t)=>{const e=t===null?-1:a.indexOf(t);return e===-1?0:e},Kn=(a,t,e)=>{if(e===0)return null;switch(a){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}},Vn=":scope > [data-name]";let Xn=0;class es extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,T`
|
|
1300
|
+
:host {
|
|
1301
|
+
display: block;
|
|
1302
|
+
font-size: inherit;
|
|
1303
|
+
line-height: inherit;
|
|
1304
|
+
color: inherit;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
[role='tablist'] {
|
|
1308
|
+
position: relative;
|
|
1309
|
+
display: flex;
|
|
1310
|
+
gap: 2px;
|
|
1311
|
+
margin-bottom: 12px;
|
|
1312
|
+
padding: 3px;
|
|
1313
|
+
width: fit-content;
|
|
1314
|
+
max-width: 100%;
|
|
1315
|
+
overflow-x: auto;
|
|
1316
|
+
border-radius: var(--dpk-radius);
|
|
1317
|
+
background: var(--dpk-paper-sunken);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/*
|
|
1321
|
+
* The raised chip the reader picked, drawn once and slid between the
|
|
1322
|
+
* tabs instead of each tab painting its own: the selection is a thing
|
|
1323
|
+
* that moves, so the eye follows it. It is placed by the two custom
|
|
1324
|
+
* properties 'updated()' measures off the selected tab, and it is
|
|
1325
|
+
* absolutely positioned inside the padding box, which is what
|
|
1326
|
+
* 'offsetLeft' counts from too.
|
|
1327
|
+
*/
|
|
1328
|
+
.indicator {
|
|
1329
|
+
position: absolute;
|
|
1330
|
+
top: 3px;
|
|
1331
|
+
left: 0;
|
|
1332
|
+
z-index: 0;
|
|
1333
|
+
width: var(--dpk-tabs-indicator-w, 0px);
|
|
1334
|
+
height: calc(100% - 6px);
|
|
1335
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1336
|
+
border-radius: var(--dpk-radius-sm);
|
|
1337
|
+
background: var(--dpk-paper-raised);
|
|
1338
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1339
|
+
transform: translateX(var(--dpk-tabs-indicator-x, 0px));
|
|
1340
|
+
pointer-events: none;
|
|
1341
|
+
transition:
|
|
1342
|
+
transform var(--dpk-dur) var(--dpk-ease),
|
|
1343
|
+
width var(--dpk-dur) var(--dpk-ease);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
/* Before the first measurement there is nothing to slide, and nothing to
|
|
1347
|
+
slide it from: the indicator is hidden until the tablist says where. */
|
|
1348
|
+
[role='tablist']:not([data-ready]) .indicator {
|
|
1349
|
+
opacity: 0;
|
|
1350
|
+
transition: none;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
[role='tab'] {
|
|
1354
|
+
position: relative;
|
|
1355
|
+
z-index: 1;
|
|
1356
|
+
flex: none;
|
|
1357
|
+
padding: 5px 12px;
|
|
1358
|
+
border: 1px solid transparent;
|
|
1359
|
+
border-radius: var(--dpk-radius-sm);
|
|
1360
|
+
background: transparent;
|
|
1361
|
+
color: var(--dpk-ink-soft);
|
|
1362
|
+
font-size: 12.5px;
|
|
1363
|
+
font-weight: 550;
|
|
1364
|
+
cursor: pointer;
|
|
1365
|
+
transition:
|
|
1366
|
+
color var(--dpk-dur-fast) var(--dpk-ease),
|
|
1367
|
+
border-color var(--dpk-dur-fast) var(--dpk-ease);
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
[role='tab']:hover {
|
|
1371
|
+
color: var(--dpk-ink);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
[role='tab'][aria-selected='true'] {
|
|
1375
|
+
color: var(--dpk-ink);
|
|
1376
|
+
font-weight: 650;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
[role='tab']:focus-visible {
|
|
1380
|
+
outline: none;
|
|
1381
|
+
box-shadow: var(--dpk-focus);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
/*
|
|
1385
|
+
* The panel the reader just picked fades in under the strip. A slotted
|
|
1386
|
+
* panel that is not the current one is not rendered at all, so its
|
|
1387
|
+
* animation starts again when it is assigned back to the slot.
|
|
1388
|
+
*/
|
|
1389
|
+
::slotted([data-name]) {
|
|
1390
|
+
animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
|
|
1391
|
+
}
|
|
1392
|
+
`]}static{this.properties={selected:{type:String,reflect:!0}}}#n=`dpk-tabs-${++Xn}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#a()):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#s(){return[...this.querySelectorAll(Vn)]}render(){const t=this.#s,e=t.map(n=>n.dataset.name??""),s=ts(e,this.selected);return r`<div role="tablist" @keydown=${this.#r}>
|
|
1393
|
+
<span class="indicator" aria-hidden="true"></span>
|
|
1394
|
+
${F(e,(n,i)=>`${i}:${n}`,(n,i)=>r`<button
|
|
1395
|
+
type="button"
|
|
1396
|
+
role="tab"
|
|
1397
|
+
id="${this.#n}-tab-${i}"
|
|
1398
|
+
aria-selected=${i===s?"true":"false"}
|
|
1399
|
+
aria-controls="${this.#n}-panel"
|
|
1400
|
+
tabindex=${i===s?0:-1}
|
|
1401
|
+
@click=${()=>{this.#i(n)}}
|
|
1402
|
+
>
|
|
1403
|
+
${t[i]?.dataset.label??n}
|
|
1404
|
+
</button>`)}
|
|
1405
|
+
</div>
|
|
1406
|
+
<div role="tabpanel" id="${this.#n}-panel" aria-labelledby="${this.#n}-tab-${s}">
|
|
1407
|
+
<slot></slot>
|
|
1408
|
+
</div>`}updated(t){const e=this.#s,s=e.map(i=>i.dataset.name??""),n=e[ts(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...n===void 0?[]:[n]),this.#a()}#a(){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(l=>l.getAttribute("aria-selected")==="true"),n=Kn(t.key,s,e.length);if(n===null)return;t.preventDefault();const i=this.#s[n]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[n]?.focus()})}}const ss=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",es)},Yn=D({en:{heading:"Checklist",empty:"No items.",progress:(a,t)=>`${a} / ${t} done`,actionTitle:(a,t)=>`${t?"Checked":"Unchecked"}: ${a}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:a=>`Comment on ${a}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(a,t)=>`${a} / ${t} \u5B8C\u4E86`,actionTitle:(a,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${a}`,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:a=>`${a} \u306B\u30B3\u30E1\u30F3\u30C8`}}),as="SET_CHECKED",Zn=y({id:$(b(),ie(/^[A-Za-z0-9_-]+$/)),label:$(b(),E(1)),checked:u(at()),note:u(b())}),Jn=y({items:w(Zn)}),ns=()=>({items:[]}),is=a=>{const t=B(Jn,a),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}})}},Qn=kt({checked:at()}),ti=(a,t,e)=>{const s=new Map(t.items.map(l=>[l.id,l.checked])),n=new Map(s),i=e.map(l=>{if(l.type!==as)return{id:l.id,title:l.type,stale:"unsupported-action-type"};const d=ba(l.target.id),o=d?.[1]==="item"?d[2]:void 0,g=Zt(Qn,l.payload);if(o===void 0||!n.has(o)||!g.success)return{id:l.id,title:a.actionTitle(o??l.target.id,!0),stale:"target-missing"};n.set(o,g.output.checked);const p=t.items.find(f=>f.id===o)?.label??o;return{id:l.id,title:a.actionTitle(p,g.output.checked),tone:"update"}});return{data:{items:t.items.map(l=>{const d=n.get(l.id)??l.checked;return{...l,checked:d,changed:d!==s.get(l.id)}})},results:i}},ei=a=>({done:a.items.filter(t=>t.checked).length,total:a.items.length});class rs extends z{static{this.styles=[M,T`
|
|
1409
|
+
:host {
|
|
1410
|
+
display: block;
|
|
1411
|
+
color: var(--dpk-ink);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
.card {
|
|
1415
|
+
border: 1px solid var(--dpk-rule);
|
|
1416
|
+
border-radius: var(--dpk-radius-lg);
|
|
1417
|
+
background: var(--dpk-paper-raised);
|
|
1418
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
|
|
1419
|
+
padding: 14px 16px 12px;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
.head {
|
|
1423
|
+
display: flex;
|
|
1424
|
+
align-items: baseline;
|
|
1425
|
+
justify-content: space-between;
|
|
1426
|
+
gap: 12px;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
.heading {
|
|
1430
|
+
font-family: var(--dpk-display);
|
|
1431
|
+
font-size: 15px;
|
|
1432
|
+
font-weight: 650;
|
|
1433
|
+
letter-spacing: -0.01em;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
.count {
|
|
1437
|
+
font-family: var(--dpk-mono);
|
|
1438
|
+
font-size: 12.5px;
|
|
1439
|
+
font-variant-numeric: tabular-nums;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
.count-done {
|
|
1443
|
+
color: var(--dpk-ink);
|
|
1444
|
+
font-weight: 650;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
.count-total {
|
|
1448
|
+
color: var(--dpk-ink-soft);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
.track {
|
|
1452
|
+
height: 6px;
|
|
1453
|
+
margin: 10px 0 14px;
|
|
1454
|
+
border-radius: 999px;
|
|
1455
|
+
background: var(--dpk-paper-sunken);
|
|
1456
|
+
overflow: hidden;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.fill {
|
|
1460
|
+
height: 100%;
|
|
1461
|
+
border-radius: 999px;
|
|
1462
|
+
background: var(--dpk-accent);
|
|
1463
|
+
transition: width 0.3s var(--dpk-ease);
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
ul {
|
|
1467
|
+
display: grid;
|
|
1468
|
+
gap: 2px;
|
|
1469
|
+
margin: 0;
|
|
1470
|
+
padding: 0;
|
|
1471
|
+
list-style: none;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
li {
|
|
1475
|
+
display: grid;
|
|
1476
|
+
grid-template-columns: auto 1fr auto;
|
|
1477
|
+
align-items: center;
|
|
1478
|
+
gap: 10px;
|
|
1479
|
+
min-height: 36px;
|
|
1480
|
+
padding: 2px 8px;
|
|
1481
|
+
border-radius: var(--dpk-radius-sm);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
li:hover,
|
|
1485
|
+
li:focus-within,
|
|
1486
|
+
li:active {
|
|
1487
|
+
background: var(--dpk-paper-sunken);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
li[data-changed] {
|
|
1491
|
+
background: color-mix(in srgb, var(--dpk-blue-soft) 60%, transparent);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
.check {
|
|
1495
|
+
position: relative;
|
|
1496
|
+
display: inline-grid;
|
|
1497
|
+
place-items: center;
|
|
1498
|
+
width: 20px;
|
|
1499
|
+
height: 20px;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
.check-input {
|
|
1503
|
+
position: absolute;
|
|
1504
|
+
inset: 0;
|
|
1505
|
+
margin: 0;
|
|
1506
|
+
opacity: 0;
|
|
1507
|
+
cursor: pointer;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
.check-mark {
|
|
1511
|
+
display: inline-grid;
|
|
1512
|
+
place-items: center;
|
|
1513
|
+
width: 20px;
|
|
1514
|
+
height: 20px;
|
|
1515
|
+
border: 2px solid var(--dpk-rule-strong);
|
|
1516
|
+
border-radius: 50%;
|
|
1517
|
+
background: transparent;
|
|
1518
|
+
color: var(--dpk-accent-ink);
|
|
1519
|
+
pointer-events: none;
|
|
1520
|
+
transition:
|
|
1521
|
+
background 0.15s var(--dpk-ease),
|
|
1522
|
+
border-color 0.15s var(--dpk-ease);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.check-mark svg {
|
|
1526
|
+
width: 12px;
|
|
1527
|
+
height: 12px;
|
|
1528
|
+
opacity: 0;
|
|
1529
|
+
transform: scale(0.5);
|
|
1530
|
+
transition:
|
|
1531
|
+
opacity 0.15s var(--dpk-ease),
|
|
1532
|
+
transform 0.15s var(--dpk-ease-spring);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
.check-input:checked ~ .check-mark {
|
|
1536
|
+
border-color: var(--dpk-accent);
|
|
1537
|
+
background: var(--dpk-accent);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
.check-input:checked ~ .check-mark svg {
|
|
1541
|
+
opacity: 1;
|
|
1542
|
+
transform: scale(1);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
.check-input:focus-visible ~ .check-mark {
|
|
1546
|
+
box-shadow: var(--dpk-focus);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
label {
|
|
1550
|
+
display: grid;
|
|
1551
|
+
gap: 2px;
|
|
1552
|
+
cursor: pointer;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
[data-checked] .label {
|
|
1556
|
+
color: var(--dpk-ink-soft);
|
|
1557
|
+
text-decoration: line-through;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.note {
|
|
1561
|
+
color: var(--dpk-ink-soft);
|
|
1562
|
+
font-size: 12px;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
.comment {
|
|
1566
|
+
display: inline-grid;
|
|
1567
|
+
place-items: center;
|
|
1568
|
+
width: 24px;
|
|
1569
|
+
height: 24px;
|
|
1570
|
+
padding: 0;
|
|
1571
|
+
border: 0;
|
|
1572
|
+
border-radius: var(--dpk-radius-sm);
|
|
1573
|
+
background: transparent;
|
|
1574
|
+
color: var(--dpk-ink-soft);
|
|
1575
|
+
opacity: 0;
|
|
1576
|
+
cursor: pointer;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
li:hover .comment,
|
|
1580
|
+
li:focus-within .comment {
|
|
1581
|
+
opacity: 1;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
.comment:hover {
|
|
1585
|
+
color: var(--dpk-blue);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.comment:focus-visible {
|
|
1589
|
+
outline: none;
|
|
1590
|
+
box-shadow: var(--dpk-focus);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
.comment svg {
|
|
1594
|
+
width: 14px;
|
|
1595
|
+
height: 14px;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
.error,
|
|
1599
|
+
.empty {
|
|
1600
|
+
color: var(--dpk-ink-soft);
|
|
1601
|
+
font-size: 13px;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.error {
|
|
1605
|
+
color: var(--dpk-danger);
|
|
1606
|
+
}
|
|
1607
|
+
`]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;#a=ns();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=N(this,is,t=>{t.ok?(this.#e=t.value,this.#s=null):(this.#e=null,this.#s=t.error),this.#m(),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.#d} \xB7 ${this.id}`;return this.#a.items.map(e=>({value:this.#c(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#m()}get elementActionResults(){return this.#r}render(){const t=this.#l;if(this.#s!==null)return r`<p class="error">${this.#s}</p>`;const e=ei(this.#a),s=e.total===0?0:e.done/e.total,n=t.progress(e.done,e.total);return r`<div class="card">
|
|
1608
|
+
<div class="head">
|
|
1609
|
+
<span class="heading">${this.#d}</span>
|
|
1610
|
+
<span class="count" aria-label=${n}
|
|
1611
|
+
><span class="count-done">${e.done}</span><span class="count-total">/${e.total}</span></span
|
|
1612
|
+
>
|
|
1613
|
+
</div>
|
|
1614
|
+
<div
|
|
1615
|
+
class="track"
|
|
1616
|
+
role="progressbar"
|
|
1617
|
+
aria-valuemin="0"
|
|
1618
|
+
aria-valuemax=${e.total}
|
|
1619
|
+
aria-valuenow=${e.done}
|
|
1620
|
+
aria-valuetext=${n}
|
|
1621
|
+
>
|
|
1622
|
+
<div class="fill" style=${`width: ${s*100}%`}></div>
|
|
1623
|
+
</div>
|
|
1624
|
+
${this.#a.items.length===0?r`<p class="empty">${t.empty}</p>`:r`<ul>
|
|
1625
|
+
${F(this.#a.items,i=>i.id,i=>this.#p(t,i))}
|
|
1626
|
+
</ul>`}
|
|
1627
|
+
</div>`}get#l(){return Yn(this.#n.locale)}get#d(){return this.heading??this.#l.heading}#p(t,e){const s=`item-${e.id}`;return r`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
|
|
1628
|
+
<span class="check">
|
|
1629
|
+
<input
|
|
1630
|
+
id=${s}
|
|
1631
|
+
class="check-input"
|
|
1632
|
+
type="checkbox"
|
|
1633
|
+
.checked=${e.checked}
|
|
1634
|
+
@change=${n=>{n.currentTarget instanceof HTMLInputElement&&this.#h(e,n.currentTarget.checked)}}
|
|
1635
|
+
/>
|
|
1636
|
+
<span class="check-mark">${ct()}</span>
|
|
1637
|
+
</span>
|
|
1638
|
+
<label for=${s}>
|
|
1639
|
+
<span class="label">${e.label}</span>
|
|
1640
|
+
${e.note===null?h:r`<span class="note">${e.note}</span>`}
|
|
1641
|
+
${this.#o===e.id?r`<span class="error">${t.unrecorded}</span>`:h}
|
|
1642
|
+
</label>
|
|
1643
|
+
${this.id?r`<button
|
|
1644
|
+
class="comment"
|
|
1645
|
+
type="button"
|
|
1646
|
+
aria-label=${t.commentOn(e.label)}
|
|
1647
|
+
title=${t.commentOn(e.label)}
|
|
1648
|
+
@click=${()=>{this.#u(e.id)}}
|
|
1649
|
+
>
|
|
1650
|
+
${Ns()}
|
|
1651
|
+
</button>`:h}
|
|
1652
|
+
</li>`}#h(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:as,target:this.#c(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#u(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#c(t)},bubbles:!0,composed:!0}))}#c(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#m(){if(this.#e===null)this.#a=ns(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=ti(this.#l,this.#e,this.#i);this.#a=t.data,this.#r=t.results}this.requestUpdate()}}const os=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",rs)},v=(a,t,e)=>e===void 0?{kind:a,pattern:t}:{kind:a,pattern:t,next:e},ot=v(null,/\s+/y),Pt=v("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),It=v("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),si=["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"],ai={js:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),It,v("string",/`(?:\\[\s\S]|[^\\`])*`?/y),Pt,v("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),v("keyword",new RegExp(`(?:${si.join("|")})(?![\\w$])`,"y")),v("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),v(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[v("comment",/<!--[\s\S]*?(?:-->|$)/y),v("keyword",/&#?\w+;/y),v("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),v(null,/[^<&]+/y)],tag:[ot,v("tag",/\/?>/y,"text"),v("punct",/=/y),v("string",/"[^"]*"?|'[^']*'?/y),v("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ot,It,Pt,v("keyword",/@[\w-]+/y),v("punct",/[{}]/y),v("tag",/[^{};]+(?=\{)/y),v("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),v("number",/#[\da-f]{3,8}(?![\w-])/iy),v(null,/-?[A-Za-z_][\w-]*/y),v("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ot,v("comment",/\/\/[^\n]*/y),It,v("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),v("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ot,v("comment",/(?<!\S)#[^\n]*/y),Pt,v("keyword",/\$\{[^}\n]*\}?|\$\w+/y),v("attr",/(?<!\S)--?[\w-]+/y),v(null,/[^\s"'$#]+/y)]}}},ni={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"},ii=a=>a===null?null:ni[a.trim().toLowerCase()]??null,ls=(a,t,e)=>{const s=a.at(-1);t===null&&s!==void 0&&s.kind===null?a[a.length-1]={kind:t,text:s.text+e}:a.push({kind:t,text:e})},ds=(a,t)=>{const e=ii(t);if(e===null)return a===""?[]:[{kind:null,text:a}];const{start:s,rules:n}=ai[e],i=[];let l=s,d=0;for(;d<a.length;){const o=(n[l]??[]).find(g=>(g.pattern.lastIndex=d,g.pattern.test(a)&&g.pattern.lastIndex>d));if(o===void 0){ls(i,null,a.charAt(d)),d+=1;continue}ls(i,o.kind,a.slice(d,o.pattern.lastIndex)),d=o.pattern.lastIndex,l=o.next??l}return i},cs=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:a=>`Copy ${a}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:a=>`${a} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),ps=T`
|
|
1653
|
+
:host {
|
|
1654
|
+
display: block;
|
|
1655
|
+
overflow: hidden;
|
|
1656
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1657
|
+
border-radius: var(--dpk-radius);
|
|
1658
|
+
background: var(--dpk-paper-sunken);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.bar {
|
|
1662
|
+
display: flex;
|
|
1663
|
+
align-items: center;
|
|
1664
|
+
gap: 8px;
|
|
1665
|
+
min-height: 34px;
|
|
1666
|
+
padding: 0 6px 0 12px;
|
|
1667
|
+
border-bottom: 1px solid var(--dpk-rule);
|
|
1668
|
+
color: var(--dpk-ink-soft);
|
|
1669
|
+
font-family: var(--dpk-font-mono);
|
|
1670
|
+
font-size: 12px;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
.name {
|
|
1674
|
+
flex: 1;
|
|
1675
|
+
overflow: hidden;
|
|
1676
|
+
text-overflow: ellipsis;
|
|
1677
|
+
white-space: nowrap;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
.language {
|
|
1681
|
+
color: var(--dpk-ink-faint);
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
button {
|
|
1685
|
+
display: inline-flex;
|
|
1686
|
+
align-items: center;
|
|
1687
|
+
gap: 5px;
|
|
1688
|
+
height: 24px;
|
|
1689
|
+
padding: 0 8px;
|
|
1690
|
+
border: 0;
|
|
1691
|
+
border-radius: var(--dpk-radius-sm);
|
|
1692
|
+
background: transparent;
|
|
1693
|
+
color: inherit;
|
|
1694
|
+
font: inherit;
|
|
1695
|
+
cursor: pointer;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
button:hover {
|
|
1699
|
+
background: var(--dpk-paper-inset);
|
|
1700
|
+
color: var(--dpk-ink);
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
button:focus-visible {
|
|
1704
|
+
outline: none;
|
|
1705
|
+
box-shadow: var(--dpk-focus);
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
button[data-state='copied'] {
|
|
1709
|
+
color: var(--dpk-green);
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
button[data-state='failed'] {
|
|
1713
|
+
color: var(--dpk-danger);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
button svg {
|
|
1717
|
+
width: 13px;
|
|
1718
|
+
height: 13px;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
pre {
|
|
1722
|
+
margin: 0;
|
|
1723
|
+
padding: 12px 14px;
|
|
1724
|
+
overflow: auto;
|
|
1725
|
+
max-height: var(--dpk-code-max-height, 480px);
|
|
1726
|
+
color: var(--dpk-ink);
|
|
1727
|
+
font-family: var(--dpk-font-mono);
|
|
1728
|
+
font-size: 12.5px;
|
|
1729
|
+
line-height: 1.6;
|
|
1730
|
+
tab-size: 2;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
.comment {
|
|
1734
|
+
color: var(--dpk-code-comment, var(--dpk-ink-faint));
|
|
1735
|
+
font-style: italic;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
.string {
|
|
1739
|
+
color: var(--dpk-code-string, var(--dpk-green));
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
.number {
|
|
1743
|
+
color: var(--dpk-code-number, var(--dpk-amber));
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.keyword {
|
|
1747
|
+
color: var(--dpk-code-keyword, var(--dpk-violet));
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
.function {
|
|
1751
|
+
color: var(--dpk-code-function, var(--dpk-blue));
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
.tag {
|
|
1755
|
+
color: var(--dpk-code-tag, var(--dpk-accent-strong));
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
.attr {
|
|
1759
|
+
color: var(--dpk-code-attr, var(--dpk-blue));
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
.property {
|
|
1763
|
+
color: var(--dpk-code-property, var(--dpk-blue));
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
.punct {
|
|
1767
|
+
color: var(--dpk-code-punct, var(--dpk-ink-soft));
|
|
1768
|
+
}
|
|
1769
|
+
`,ri='script[type="text/plain"]';class hs extends z{static{this.styles=[M,ps]}static{this.properties={filename:{type:String},language:{type:String},code:{type:String}}}#n=new R(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e="idle";#s;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.#s)}get text(){const t=this.querySelector(ri)?.textContent??this.textContent??"";return Ot(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 r`<div class="bar">
|
|
1770
|
+
<span class="name">${e}</span>
|
|
1771
|
+
${this.language?r`<span class="language">${this.language}</span>`:h}
|
|
1772
|
+
<button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
|
|
1773
|
+
${this.#e==="copied"?ct():re()}<span aria-live="polite">${s}</span>
|
|
1774
|
+
</button>
|
|
1775
|
+
</div>
|
|
1776
|
+
<pre><code>${this.#a()}</code></pre>`}#a(){return ds(this.text,this.language).map(t=>t.kind===null?t.text:r`<span class=${t.kind}>${t.text}</span>`)}get#i(){return cs(this.#n.locale)}#r=async()=>{const t=await wt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const Ot=a=>{const t=a.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
|
|
1777
|
+
`),e=t.filter(n=>n.trim()!=="").map(n=>/^[ \t]*/.exec(n)?.[0].length??0),s=e.length===0?0:Math.min(...e);return t.map(n=>n.slice(s)).join(`
|
|
1778
|
+
`)},us=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",hs)},oi=D({en:{empty:"No code variants",invalid:a=>`Invalid code group: ${a}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:a=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${a}`}}),li=y({label:$(b(),E(1)),language:u(b(),""),code:$(b(),E(1))}),di=y({label:u(b(),""),variants:$(w(li),E(1))}),gt=a=>{const t=B(di,a),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},ci=T`
|
|
1779
|
+
:host {
|
|
1780
|
+
min-width: 0;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
.bar {
|
|
1784
|
+
padding-left: 10px;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
.name {
|
|
1788
|
+
flex: 0 1 auto;
|
|
1789
|
+
max-width: 45%;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
.tabs {
|
|
1793
|
+
display: flex;
|
|
1794
|
+
flex: 1;
|
|
1795
|
+
gap: 1px;
|
|
1796
|
+
min-width: 0;
|
|
1797
|
+
overflow-x: auto;
|
|
1798
|
+
scrollbar-width: none;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
.tabs::-webkit-scrollbar {
|
|
1802
|
+
display: none;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
.tabs button {
|
|
1806
|
+
height: 26px;
|
|
1807
|
+
padding: 0 8px;
|
|
1808
|
+
border-radius: 6px 6px 0 0;
|
|
1809
|
+
color: var(--dpk-ink-faint);
|
|
1810
|
+
font-size: 11.5px;
|
|
1811
|
+
font-weight: 600;
|
|
1812
|
+
white-space: nowrap;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
.tabs button:hover {
|
|
1816
|
+
background: var(--dpk-paper-inset);
|
|
1817
|
+
color: var(--dpk-ink);
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
.tabs button[aria-selected='true'] {
|
|
1821
|
+
background: var(--dpk-paper-raised);
|
|
1822
|
+
box-shadow: inset 0 -2px 0 var(--dpk-accent);
|
|
1823
|
+
color: var(--dpk-ink);
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
.tabs button:focus-visible {
|
|
1827
|
+
outline: none;
|
|
1828
|
+
box-shadow: var(--dpk-focus);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
pre[hidden] {
|
|
1832
|
+
display: none;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
.empty {
|
|
1836
|
+
margin: 0;
|
|
1837
|
+
padding: 12px 14px;
|
|
1838
|
+
color: var(--dpk-ink-faint);
|
|
1839
|
+
font-family: var(--dpk-font-mono);
|
|
1840
|
+
font-size: 12px;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
@media (max-width: 520px) {
|
|
1844
|
+
.name {
|
|
1845
|
+
display: none;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
`;class ms extends z{static{this.styles=[M,ps,ci]}static{this.properties={data:{attribute:!1}}}#n=new R(this);#t=null;#e=null;#s=0;#a="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=N(this,gt,t=>{this.#s=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=Zs(this,gt);t!==null&&(this.#r?.(),this.#r=null,this.#s=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=gt(this.data),this.#e=null,this.#s=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=cs(this.#n.locale),e=oi(this.#n.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,r`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,r`<p class="empty">${e.empty}</p>`);const n=Math.min(this.#s,s.variants.length-1),i=s.label===""?t.code:s.label,l=this.#a==="copied"?t.copied:this.#a==="failed"?t.copyFailed:t.copy;return r`<div class="bar">
|
|
1849
|
+
${s.label===""?h:r`<span class="name">${s.label}</span>`}
|
|
1850
|
+
<div class="tabs" role="tablist" aria-label=${i}>
|
|
1851
|
+
${s.variants.map((d,o)=>r`<button
|
|
1852
|
+
type="button"
|
|
1853
|
+
role="tab"
|
|
1854
|
+
id="code-group-tab-${o}"
|
|
1855
|
+
aria-controls="code-group-panel-${o}"
|
|
1856
|
+
aria-selected=${o===n}
|
|
1857
|
+
tabindex=${o===n?0:-1}
|
|
1858
|
+
@click=${()=>this.#l(o)}
|
|
1859
|
+
@keydown=${g=>this.#d(g,o)}
|
|
1860
|
+
>
|
|
1861
|
+
${d.label}
|
|
1862
|
+
</button>`)}
|
|
1863
|
+
</div>
|
|
1864
|
+
<button
|
|
1865
|
+
type="button"
|
|
1866
|
+
data-state=${this.#a}
|
|
1867
|
+
aria-label=${t.copyLabel(i)}
|
|
1868
|
+
@click=${()=>this.#h()}
|
|
1869
|
+
>
|
|
1870
|
+
${this.#a==="copied"?ct():re()}<span aria-live="polite">${l}</span>
|
|
1871
|
+
</button>
|
|
1872
|
+
</div>
|
|
1873
|
+
${s.variants.map((d,o)=>r`<pre
|
|
1874
|
+
role="tabpanel"
|
|
1875
|
+
id="code-group-panel-${o}"
|
|
1876
|
+
aria-labelledby="code-group-tab-${o}"
|
|
1877
|
+
?hidden=${o!==n}
|
|
1878
|
+
><code>${this.#p(d)}</code></pre>`)}`}#o(t,e){return r`<div class="bar"><span class="name">${t}</span></div>
|
|
1879
|
+
${e}`}#l(t){this.#t!==null&&(this.#s=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#a="idle",this.requestUpdate())}#d(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const n=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#l(n),this.renderRoot.querySelectorAll('[role="tab"]')[n]?.focus()}#p(t){const e=t.language===""?null:t.language;return ds(Ot(t.code),e).map(s=>s.kind===null?s.text:r`<span class=${s.kind}>${s.text}</span>`)}async#h(){const t=this.#t;if(t===null)return;const e=Math.min(this.#s,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const n=await wt(Ot(s.code));this.#a=n?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#a="idle",this.requestUpdate()},1600)}}const gs=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",ms)},pi=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:a=>`Profile: ${a}`,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:a=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${a}`,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"}}),ft=(a,t,e)=>{const s=le(t,e);if(s===null)return;const n=de(s);return a.find(i=>{const l=le(i.url,e);return l!==null&&de(l)===n})},hi=(a,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?ce(t.url):ft(a,t.page.url,t.page.url)?.title??ce(t.page.url),fs=a=>a===void 0||a.kind==="new-tab"?"":a.kind==="unreachable"?a.url:a.page.url,ui=(a,t,e,s)=>{const n=ia(t),i=n.history[n.index];return{tabs:t.tabs.map(l=>{const d=l.history[l.index];return{id:l.id,title:hi(a,d,e),url:fs(d),active:l.id===n.id}}),entry:i,url:fs(i),canBack:oa(t),canForward:ra(t),...s===null||s===""?{}:{profile:s}}},mi=a=>a.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),gi=":scope > [data-url]",fi=360,bs="https://page.example.com/";class ks extends z{static{this.shadowRootOptions={...z.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[M,la,T`
|
|
1880
|
+
:host {
|
|
1881
|
+
display: block;
|
|
1882
|
+
height: var(--dpk-browser-height, 460px);
|
|
1883
|
+
min-height: 240px;
|
|
1884
|
+
color: var(--dpk-ink);
|
|
1885
|
+
font-family: var(--dpk-body);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
:host([viewport='mobile']) {
|
|
1889
|
+
max-width: var(--dpk-browser-phone-width, 390px);
|
|
1890
|
+
height: var(--dpk-browser-height, 720px);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
.browser {
|
|
1894
|
+
box-sizing: border-box;
|
|
1895
|
+
height: 100%;
|
|
1896
|
+
border: 1px solid var(--dpk-rule);
|
|
1897
|
+
border-radius: var(--dpk-radius-lg);
|
|
1898
|
+
background: var(--dpk-paper-raised);
|
|
1899
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
1900
|
+
overflow: hidden;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/* The page is the product's own light surface, and scrolls under the chrome. */
|
|
1904
|
+
.browser-page {
|
|
1905
|
+
position: relative;
|
|
1906
|
+
display: flex;
|
|
1907
|
+
flex: 1 1 auto;
|
|
1908
|
+
flex-direction: column;
|
|
1909
|
+
min-height: 0;
|
|
1910
|
+
overflow: auto;
|
|
1911
|
+
color-scheme: light;
|
|
1912
|
+
background: #fff;
|
|
1913
|
+
color: #1f2430;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
::slotted(*) {
|
|
1917
|
+
flex: 1 0 auto;
|
|
1918
|
+
}
|
|
1919
|
+
`]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#n=new R(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e=null;#s=!1;#a=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.#k),this.addEventListener("auxclick",this.#k)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.removeEventListener("click",this.#k),this.removeEventListener("auxclick",this.#k),this.#a!==null&&clearTimeout(this.#a),this.#a=null}get#o(){return pi(this.#n.locale)}get#l(){return this.viewport==="mobile"}get#d(){return[...this.querySelectorAll(gi)]}get#p(){return this.#d.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#h(){const t=this.#e===null?void 0:$t(this.#e);return t?.kind==="page"?t.page.url:this.#p[0]?.url??bs}#u(t){if(t?.kind!=="page")return;const e=ft(this.#p,t.page.url,t.page.url);return e===void 0?void 0:this.#d.find(s=>s.dataset.url===e.url)}willUpdate(t){if(this.#e===null){const e=this.#p,s=(this.url===null?void 0:ft(e,this.url,bs))??e[0];s!==void 0&&(this.#e=da({url:s.url}));return}t.has("url")&&this.url!==null&&this.#g(this.url,!1)}render(){const t=this.#e;if(t===null)return r`<slot hidden></slot>`;const e=this.#o,s=this.#p,n=ui(s,t,e.newTab,this.profile),i={view:n,phone:this.#l,switcher:this.#s,shortcuts:n.entry?.kind==="new-tab"?mi(s):[],labels:e,send:d=>{this.#m(d)}},l=this.#u(n.entry);return r`<div
|
|
1920
|
+
class="browser"
|
|
1921
|
+
data-viewport=${this.#l?"mobile":"desktop"}
|
|
1922
|
+
?data-loading=${this.#a!==null}
|
|
1923
|
+
>
|
|
1924
|
+
${ca(i)}
|
|
1925
|
+
<div class="browser-page">
|
|
1926
|
+
${pa(i,l===void 0?void 0:r`<slot></slot>`)}
|
|
1927
|
+
</div>
|
|
1928
|
+
${ha(i)}
|
|
1929
|
+
</div>`}updated(){const t=this.#e===null?void 0:$t(this.#e),e=this.#u(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 n=this.#r===null;this.#r=s,n||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#c(t){if(this.#e===null)return;const e=ua(this.#e,t);e!==this.#e&&(this.#e=e,this.#f(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#m(t){switch(t.kind){case"reload":this.#v();return;case"address":this.#g(t.input,!1);return;case"back":case"forward":case"new-tab":this.#s=!1,this.#c({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#s=t.open,this.requestUpdate();return;case"activate":this.#s=!1,this.#i=t.focus===!0,this.#c({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#c({kind:"close-tab",id:t.id});return;case"visit":this.#c({kind:"visit",page:t.page});return;default:return}}#g(t,e){const s=this.#h,n=ft(this.#p,t,s),i=n===void 0?{kind:"unreachable",url:ma(t,s)}:{kind:"page",page:{url:n.url}};e!==!1?this.#c({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#c({kind:"visit",page:i.page}):this.#c({kind:"unreachable",url:i.url})}#v(){if(this.#a!==null||this.#e===null)return;const t=this.#u($t(this.#e));this.#a=setTimeout(()=>{if(this.#a=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()},fi),this.requestUpdate()}#f(){this.#a!==null&&(clearTimeout(this.#a),this.#a=null)}#k=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(d=>d instanceof HTMLAnchorElement&&this.contains(d)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const n=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",l=new URL(s,this.#h).href;this.#g(l,i||n?{background:n}:!1)}}const vs=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",ks)},bi=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:a=>`${a} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:a=>`Remove ${a}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:a=>`${a} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:a=>`${a} \u3092\u524A\u9664`}}),ki=y({value:$(b(),E(1)),label:$(b(),E(1)),description:u(b()),group:u(b()),avatar:u(b())}),vi=y({options:w(ki),value:u(Jt([b(),w(b())]))}),xs=a=>typeof a=="string"?a===""?[]:[a]:Array.isArray(a)?a.filter(t=>typeof t=="string"&&t!==""):[],ys=a=>{const t=B(vi,a),e=new Set;return{options:t.options.map(n=>{if(e.has(n.value))throw new Error(`duplicate option value: ${n.value}`);return e.add(n.value),{value:n.value,label:n.label,description:n.description??null,group:n.group??null,avatar:n.avatar??null}}),value:t.value===void 0?null:xs(t.value)}},Ut=(a,t)=>{const e=t.trim().toLowerCase();return e===""?a:a.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},xi=a=>{const t=[],e=new Map;for(const s of a){let n=e.get(s.group);n===void 0&&(n=[],e.set(s.group,n),t.push(s.group)),n.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},Ft=(a,t)=>t===0?-1:Math.min(Math.max(a,0),t-1),yi=(a,t,e)=>e===0?-1:a<0?t>0?0:e-1:(a+t+e)%e,wi=(a,t,e)=>e?a.includes(t)?a.filter(s=>s!==t):[...a,t]:[t],$i=(a,t)=>a.filter(e=>e!==t),Ci=(a,t)=>a.includes(t),Si=(a,t)=>a.length===t.length&&a.every((e,s)=>e===t[s]),Ei=(a,t)=>t.flatMap(e=>{const s=a.find(n=>n.value===e);return s?[s]:[]}),zi=(a,t)=>{const e=t[0];return e===void 0?null:a.find(s=>s.value===e)?.label??null},ws=a=>{const t=a.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},$s=["blue","green","amber","violet","accent","danger"],Cs=a=>{let t=0;for(let e=0;e<a.length;e+=1)t=t*31+a.charCodeAt(e)|0;return $s[Math.abs(t)%$s.length]??"blue"};let Ti=0;const Ai=".combo-control, .combo-listbox";class Ss extends z{static{this.styles=[M,T`
|
|
1930
|
+
:host {
|
|
1931
|
+
display: block;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
.field {
|
|
1935
|
+
display: flex;
|
|
1936
|
+
flex-direction: column;
|
|
1937
|
+
gap: 6px;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
.field-label {
|
|
1941
|
+
font-size: 11.5px;
|
|
1942
|
+
font-weight: 600;
|
|
1943
|
+
color: var(--dpk-ink-soft);
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
.combo-control {
|
|
1947
|
+
box-sizing: border-box;
|
|
1948
|
+
display: flex;
|
|
1949
|
+
flex-wrap: wrap;
|
|
1950
|
+
align-items: center;
|
|
1951
|
+
gap: 5px;
|
|
1952
|
+
min-height: var(--dpk-control-h);
|
|
1953
|
+
padding: 4px 6px 4px 10px;
|
|
1954
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
1955
|
+
border-radius: var(--dpk-radius-sm);
|
|
1956
|
+
background: var(--dpk-paper-raised);
|
|
1957
|
+
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
1958
|
+
cursor: text;
|
|
1959
|
+
transition:
|
|
1960
|
+
border-color 160ms var(--dpk-ease),
|
|
1961
|
+
box-shadow 160ms var(--dpk-ease);
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
.combo-control:focus-within {
|
|
1965
|
+
border-color: var(--dpk-blue);
|
|
1966
|
+
box-shadow: var(--dpk-focus);
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
.input {
|
|
1970
|
+
flex: 1 1 80px;
|
|
1971
|
+
min-width: 60px;
|
|
1972
|
+
margin: 2px 0;
|
|
1973
|
+
border: 0;
|
|
1974
|
+
background: transparent;
|
|
1975
|
+
color: var(--dpk-ink);
|
|
1976
|
+
font: inherit;
|
|
1977
|
+
font-size: 12.5px;
|
|
1978
|
+
outline: none;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
.input::placeholder {
|
|
1982
|
+
color: var(--dpk-ink-faint);
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
.chevron {
|
|
1986
|
+
flex: none;
|
|
1987
|
+
display: inline-flex;
|
|
1988
|
+
align-items: center;
|
|
1989
|
+
justify-content: center;
|
|
1990
|
+
width: 22px;
|
|
1991
|
+
height: 22px;
|
|
1992
|
+
border: 0;
|
|
1993
|
+
border-radius: var(--dpk-radius-xs);
|
|
1994
|
+
background: transparent;
|
|
1995
|
+
color: var(--dpk-ink-faint);
|
|
1996
|
+
cursor: pointer;
|
|
1997
|
+
transition: transform 160ms var(--dpk-ease);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
.chevron:hover {
|
|
2001
|
+
color: var(--dpk-ink);
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
.chevron[data-open='true'] {
|
|
2005
|
+
transform: rotate(180deg);
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
.chevron svg {
|
|
2009
|
+
display: block;
|
|
2010
|
+
width: 14px;
|
|
2011
|
+
height: 14px;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
.chip {
|
|
2015
|
+
display: inline-flex;
|
|
2016
|
+
align-items: center;
|
|
2017
|
+
gap: 5px;
|
|
2018
|
+
padding: 2px 6px 2px 2px;
|
|
2019
|
+
border-radius: 999px;
|
|
2020
|
+
background: var(--dpk-paper-inset);
|
|
2021
|
+
color: var(--dpk-ink);
|
|
2022
|
+
font-size: 11.5px;
|
|
2023
|
+
line-height: 1.4;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
.chip .avatar {
|
|
2027
|
+
width: 16px;
|
|
2028
|
+
height: 16px;
|
|
2029
|
+
font-size: 8px;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
.chip-remove {
|
|
2033
|
+
display: inline-flex;
|
|
2034
|
+
align-items: center;
|
|
2035
|
+
justify-content: center;
|
|
2036
|
+
width: 14px;
|
|
2037
|
+
height: 14px;
|
|
2038
|
+
padding: 0;
|
|
2039
|
+
border: 0;
|
|
2040
|
+
border-radius: 999px;
|
|
2041
|
+
background: transparent;
|
|
2042
|
+
color: var(--dpk-ink-faint);
|
|
2043
|
+
cursor: pointer;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
.chip-remove:hover {
|
|
2047
|
+
color: var(--dpk-danger);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
.chip-remove svg {
|
|
2051
|
+
display: block;
|
|
2052
|
+
width: 10px;
|
|
2053
|
+
height: 10px;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
.avatar {
|
|
2057
|
+
flex: none;
|
|
2058
|
+
display: inline-flex;
|
|
2059
|
+
align-items: center;
|
|
2060
|
+
justify-content: center;
|
|
2061
|
+
width: 22px;
|
|
2062
|
+
height: 22px;
|
|
2063
|
+
border-radius: 999px;
|
|
2064
|
+
font-family: var(--dpk-mono);
|
|
2065
|
+
font-size: 9.5px;
|
|
2066
|
+
font-weight: 650;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
.avatar[data-tone='blue'] {
|
|
2070
|
+
background: var(--dpk-blue-soft);
|
|
2071
|
+
color: var(--dpk-blue);
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
.avatar[data-tone='green'] {
|
|
2075
|
+
background: var(--dpk-green-soft);
|
|
2076
|
+
color: var(--dpk-green);
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
.avatar[data-tone='amber'] {
|
|
2080
|
+
background: var(--dpk-amber-soft);
|
|
2081
|
+
color: var(--dpk-amber);
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
.avatar[data-tone='violet'] {
|
|
2085
|
+
background: var(--dpk-violet-soft);
|
|
2086
|
+
color: var(--dpk-violet);
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
.avatar[data-tone='accent'] {
|
|
2090
|
+
background: var(--dpk-accent-soft);
|
|
2091
|
+
color: var(--dpk-accent);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
.avatar[data-tone='danger'] {
|
|
2095
|
+
background: var(--dpk-danger-soft);
|
|
2096
|
+
color: var(--dpk-danger);
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
.combo-listbox {
|
|
2100
|
+
box-sizing: border-box;
|
|
2101
|
+
position: fixed;
|
|
2102
|
+
inset: auto;
|
|
2103
|
+
margin: 0;
|
|
2104
|
+
padding: 0;
|
|
2105
|
+
display: flex;
|
|
2106
|
+
flex-direction: column;
|
|
2107
|
+
overflow: hidden;
|
|
2108
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
2109
|
+
border-radius: var(--dpk-radius-lg);
|
|
2110
|
+
background: var(--dpk-paper-raised);
|
|
2111
|
+
box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
|
|
2112
|
+
color: var(--dpk-ink);
|
|
2113
|
+
font-size: 12.5px;
|
|
2114
|
+
animation: dpk-combobox-pop-in 140ms var(--dpk-ease);
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
@keyframes dpk-combobox-pop-in {
|
|
2118
|
+
from {
|
|
2119
|
+
opacity: 0;
|
|
2120
|
+
transform: translateY(4px) scale(0.98);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
.options {
|
|
2125
|
+
flex: 1 1 auto;
|
|
2126
|
+
overflow-y: auto;
|
|
2127
|
+
padding: 6px 0;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
.group-heading {
|
|
2131
|
+
padding: 9px 12px 4px;
|
|
2132
|
+
font-family: var(--dpk-mono);
|
|
2133
|
+
font-size: 10px;
|
|
2134
|
+
font-weight: 650;
|
|
2135
|
+
letter-spacing: 0.09em;
|
|
2136
|
+
text-transform: uppercase;
|
|
2137
|
+
color: var(--dpk-ink-faint);
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
.option {
|
|
2141
|
+
display: flex;
|
|
2142
|
+
align-items: center;
|
|
2143
|
+
gap: 8px;
|
|
2144
|
+
padding: 6px 12px;
|
|
2145
|
+
cursor: pointer;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
.option:hover,
|
|
2149
|
+
.option[data-active='true'] {
|
|
2150
|
+
background: var(--dpk-paper-sunken);
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
.option-text {
|
|
2154
|
+
display: flex;
|
|
2155
|
+
align-items: baseline;
|
|
2156
|
+
gap: 6px;
|
|
2157
|
+
min-width: 0;
|
|
2158
|
+
flex: 1 1 auto;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
.option-name {
|
|
2162
|
+
flex: none;
|
|
2163
|
+
max-width: 60%;
|
|
2164
|
+
overflow: hidden;
|
|
2165
|
+
text-overflow: ellipsis;
|
|
2166
|
+
white-space: nowrap;
|
|
2167
|
+
color: var(--dpk-ink);
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
.option-desc {
|
|
2171
|
+
min-width: 0;
|
|
2172
|
+
overflow: hidden;
|
|
2173
|
+
text-overflow: ellipsis;
|
|
2174
|
+
white-space: nowrap;
|
|
2175
|
+
color: var(--dpk-ink-soft);
|
|
2176
|
+
font-size: 11.5px;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
.option-check {
|
|
2180
|
+
flex: none;
|
|
2181
|
+
display: flex;
|
|
2182
|
+
color: var(--dpk-blue);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.option-check svg {
|
|
2186
|
+
display: block;
|
|
2187
|
+
width: 14px;
|
|
2188
|
+
height: 14px;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
.empty {
|
|
2192
|
+
padding: 18px 12px;
|
|
2193
|
+
color: var(--dpk-ink-soft);
|
|
2194
|
+
font-size: 12px;
|
|
2195
|
+
text-align: center;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
.footer {
|
|
2199
|
+
flex: none;
|
|
2200
|
+
display: flex;
|
|
2201
|
+
align-items: center;
|
|
2202
|
+
justify-content: space-between;
|
|
2203
|
+
gap: 10px;
|
|
2204
|
+
padding: 7px 12px;
|
|
2205
|
+
border-top: 1px solid var(--dpk-rule);
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
.count {
|
|
2209
|
+
color: var(--dpk-ink-soft);
|
|
2210
|
+
font-size: 11px;
|
|
2211
|
+
font-variant-numeric: tabular-nums;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
.hints {
|
|
2215
|
+
display: flex;
|
|
2216
|
+
align-items: center;
|
|
2217
|
+
gap: 10px;
|
|
2218
|
+
color: var(--dpk-ink-faint);
|
|
2219
|
+
font-size: 10.5px;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
.hint {
|
|
2223
|
+
display: inline-flex;
|
|
2224
|
+
align-items: center;
|
|
2225
|
+
gap: 4px;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
.kbd {
|
|
2229
|
+
display: inline-flex;
|
|
2230
|
+
align-items: center;
|
|
2231
|
+
justify-content: center;
|
|
2232
|
+
min-width: 1.5em;
|
|
2233
|
+
height: 1.5em;
|
|
2234
|
+
padding: 0 4px;
|
|
2235
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
2236
|
+
border-bottom-width: 2px;
|
|
2237
|
+
border-radius: var(--dpk-radius-xs);
|
|
2238
|
+
background: var(--dpk-paper-raised);
|
|
2239
|
+
color: var(--dpk-ink-soft);
|
|
2240
|
+
font-family: var(--dpk-mono);
|
|
2241
|
+
font-size: 10px;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
.error {
|
|
2245
|
+
color: var(--dpk-danger);
|
|
2246
|
+
font-size: 12px;
|
|
2247
|
+
}
|
|
2248
|
+
`]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#n=`dpk-combobox-${++Ti}`;#t=new R(this);#e=new bt(this);#s=null;#a=[];#i=[];#r=null;#o=!1;#l=null;#d=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new Ws(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Ai)),ownsEscape:()=>this.#o,dismiss:()=>this.#b()})}connectedCallback(){super.connectedCallback(),this.#s=N(this,ys,t=>{t.ok?(this.#a=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#a=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=xs(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return r`<p class="error">${this.#r}</p>`;const e=this.#l??"",s=Ut(this.#a,e),n=Ft(this.#d,s.length),i=this.multiple?Ei(this.#a,this.#i):[],l=this.multiple?null:zi(this.#a,this.#i),d=this.multiple?this.#i.length===0:l===null,o=this.#l??(this.multiple?"":l??"");return r`
|
|
2249
|
+
<div class="field">
|
|
2250
|
+
${this.label?r`<label class="field-label" id=${this.#h}>${this.label}</label>`:h}
|
|
2251
|
+
<div class="combo-control">
|
|
2252
|
+
${this.multiple?F(i,g=>g.value,g=>this.#v(g,t)):h}
|
|
2253
|
+
<input
|
|
2254
|
+
class="input"
|
|
2255
|
+
type="text"
|
|
2256
|
+
role="combobox"
|
|
2257
|
+
autocomplete="off"
|
|
2258
|
+
spellcheck="false"
|
|
2259
|
+
aria-expanded=${this.#o?"true":"false"}
|
|
2260
|
+
aria-haspopup="listbox"
|
|
2261
|
+
aria-autocomplete="list"
|
|
2262
|
+
aria-controls=${this.#u}
|
|
2263
|
+
aria-labelledby=${this.label?this.#h:h}
|
|
2264
|
+
aria-activedescendant=${n>=0?this.#c(s[n]?.value??""):h}
|
|
2265
|
+
placeholder=${d?this.placeholder??"":""}
|
|
2266
|
+
.value=${o}
|
|
2267
|
+
@focus=${this.#f}
|
|
2268
|
+
@click=${this.#f}
|
|
2269
|
+
@input=${this.#k}
|
|
2270
|
+
@keydown=${this.#y}
|
|
2271
|
+
/>
|
|
2272
|
+
<button
|
|
2273
|
+
type="button"
|
|
2274
|
+
class="chevron"
|
|
2275
|
+
tabindex="-1"
|
|
2276
|
+
aria-hidden="true"
|
|
2277
|
+
data-open=${this.#o?"true":"false"}
|
|
2278
|
+
@mousedown=${g=>g.preventDefault()}
|
|
2279
|
+
@click=${this.#S}
|
|
2280
|
+
>
|
|
2281
|
+
${Gs()}
|
|
2282
|
+
</button>
|
|
2283
|
+
</div>
|
|
2284
|
+
</div>
|
|
2285
|
+
${this.#o?this.#m(s,n,t):h}
|
|
2286
|
+
`}updated(t){super.updated(t),this.#$()}get#p(){return bi(this.#t.locale)}get#h(){return`${this.#n}-label`}get#u(){return`${this.#n}-listbox`}#c(t){return`${this.#n}-option-${encodeURIComponent(t)}`}#m(t,e,s){const n=xi(t);return r`
|
|
2287
|
+
<div
|
|
2288
|
+
class="combo-listbox"
|
|
2289
|
+
popover="manual"
|
|
2290
|
+
role="listbox"
|
|
2291
|
+
id=${this.#u}
|
|
2292
|
+
aria-label=${this.label??s.listLabel}
|
|
2293
|
+
aria-multiselectable=${this.multiple?"true":"false"}
|
|
2294
|
+
>
|
|
2295
|
+
<div class="options">
|
|
2296
|
+
${t.length===0?r`<p class="empty">${s.empty}</p>`:n.map(i=>r`
|
|
2297
|
+
${i.group!==null?r`<div class="group-heading">${i.group}</div>`:h}
|
|
2298
|
+
${F(i.options,l=>l.value,l=>this.#g(l,t.indexOf(l)===e))}
|
|
2299
|
+
`)}
|
|
2300
|
+
</div>
|
|
2301
|
+
<div class="footer">
|
|
2302
|
+
<span class="count">${s.selectedCount(this.#i.length)}</span>
|
|
2303
|
+
<span class="hints">
|
|
2304
|
+
<span class="hint"><kbd class="kbd">↑</kbd><kbd class="kbd">↓</kbd> ${s.moveLabel}</span>
|
|
2305
|
+
<span class="hint"><kbd class="kbd">↵</kbd> ${s.toggleLabel}</span>
|
|
2306
|
+
</span>
|
|
2307
|
+
</div>
|
|
2308
|
+
</div>
|
|
2309
|
+
`}#g(t,e){const s=Ci(this.#i,t.value);return r`
|
|
2310
|
+
<div
|
|
2311
|
+
class="option"
|
|
2312
|
+
id=${this.#c(t.value)}
|
|
2313
|
+
role="option"
|
|
2314
|
+
aria-selected=${s?"true":"false"}
|
|
2315
|
+
data-active=${e?"true":"false"}
|
|
2316
|
+
@mousedown=${n=>n.preventDefault()}
|
|
2317
|
+
@click=${()=>this.#w(t.value)}
|
|
2318
|
+
>
|
|
2319
|
+
<span class="avatar" data-tone=${Cs(t.value)}>${t.avatar??ws(t.label)}</span>
|
|
2320
|
+
<span class="option-text">
|
|
2321
|
+
<span class="option-name">${t.label}</span>
|
|
2322
|
+
${t.description!==null?r`<span class="option-desc">${t.description}</span>`:h}
|
|
2323
|
+
</span>
|
|
2324
|
+
${s?r`<span class="option-check" aria-hidden="true">${ct()}</span>`:h}
|
|
2325
|
+
</div>
|
|
2326
|
+
`}#v(t,e){return r`
|
|
2327
|
+
<span class="chip">
|
|
2328
|
+
<span class="avatar" data-tone=${Cs(t.value)}>${t.avatar??ws(t.label)}</span>
|
|
2329
|
+
<span class="chip-label">${t.label}</span>
|
|
2330
|
+
<button
|
|
2331
|
+
type="button"
|
|
2332
|
+
class="chip-remove"
|
|
2333
|
+
tabindex="-1"
|
|
2334
|
+
aria-label=${e.removeChip(t.label)}
|
|
2335
|
+
@mousedown=${s=>s.preventDefault()}
|
|
2336
|
+
@click=${s=>{s.stopPropagation(),this.#x($i(this.#i,t.value))}}
|
|
2337
|
+
>
|
|
2338
|
+
${Ks()}
|
|
2339
|
+
</button>
|
|
2340
|
+
</span>
|
|
2341
|
+
`}#f=()=>{this.#o=!0,this.#d=-1,this.requestUpdate()};#k=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#l=t.currentTarget.value,this.#o=!0,this.#d=-1,this.requestUpdate())};#y=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=Ut(this.#a,this.#l??""),s=this.#o;this.#o=!0;const n=t.key==="ArrowDown"?1:-1;this.#d=s?yi(this.#d,n,e.length):-1,s||(this.#d=Ft(n>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=Ut(this.#a,this.#l??""),s=e[Ft(this.#d,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#l??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#x(this.#i.slice(0,-1))}};#S=()=>{this.#o?this.#b():(this.#o=!0,this.#d=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#x(wi(this.#i,t,this.multiple)),this.multiple?(this.#l="",this.#d=-1,this.requestUpdate()):this.#b()}#x(t){Si(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.#l=null,this.#d=-1,this.requestUpdate()}#$(){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 Es=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",Ss)};let J=null;const Mi=a=>{J!==null&&J!==a&&J.hide(),J=a},Li=a=>{J===a&&(J=null)};class zs extends z{static{this.styles=[M,K,T`
|
|
2342
|
+
:host {
|
|
2343
|
+
display: contents;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
/*
|
|
2347
|
+
* The one placement core imposes: bottom-center, clear of the hand-off
|
|
2348
|
+
* dock. A host that needs a different spot claims the bar from
|
|
2349
|
+
* somewhere else on screen instead — the contract is "claim it", not
|
|
2350
|
+
* "place it".
|
|
2351
|
+
*/
|
|
2352
|
+
.dpk-floatbar {
|
|
2353
|
+
left: 50%;
|
|
2354
|
+
bottom: calc(14px + var(--dpk-dock-clearance, 0px));
|
|
2355
|
+
transform: translateX(-50%);
|
|
2356
|
+
z-index: 45;
|
|
2357
|
+
}
|
|
2358
|
+
`]}static{this.properties={label:{type:String,reflect:!0}}}#n={hide:()=>this.#e(!1)};#t=!1;constructor(){super(),this.label=null}get open(){return this.#t}connectedCallback(){super.connectedCallback(),this.#e(!0),Mi(this.#n)}disconnectedCallback(){super.disconnectedCallback(),Li(this.#n)}render(){return r`
|
|
2359
|
+
<div
|
|
2360
|
+
class="dpk-floatbar"
|
|
2361
|
+
popover="manual"
|
|
2362
|
+
role="toolbar"
|
|
2363
|
+
aria-label=${this.label??h}
|
|
2364
|
+
@keydown=${this.#a}
|
|
2365
|
+
>
|
|
2366
|
+
<slot></slot>
|
|
2367
|
+
</div>
|
|
2368
|
+
`}updated(t){super.updated(t),this.#s()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#s(){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{}}#a=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const Ts=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",zs)};class As extends z{static{this.styles=[M,K]}#n=new Vs(this);ask(t){return this.#n.ask(t)}render(){return this.#n.render()}}const Ms=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",As)},Di=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"}}),Ri=["adopted","rejected","considered"],ji=y({id:$(b(),ie(/^[A-Za-z0-9_-]+$/)),status:st(Ri),label:u($(b(),E(1))),summary:u($(b(),E(1))),reason:u($(b(),E(1))),tradeoffs:u(w($(b(),E(1))))}),qi=y({options:w(ji)}),Pi=()=>({options:[]}),Ls=a=>{const t=B(qi,a),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??[]}})}},Ii=(a,t)=>{switch(t){case"adopted":return a.adopted;case"rejected":return a.rejected;case"considered":return a.considered}},Oi=(a,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:Ii(a,t.status),summary:t.summary,reason:t.reason===null?null:{label:a.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:a.tradeoffs,items:t.tradeoffs}}),Ui=(a,t)=>t.options.map(e=>Oi(a,e)),Fi=[M,ta,T`
|
|
2369
|
+
:host {
|
|
2370
|
+
display: block;
|
|
2371
|
+
color: var(--dpk-ink);
|
|
2372
|
+
font-family: var(--dpk-body);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
.alternatives {
|
|
2376
|
+
display: grid;
|
|
2377
|
+
gap: 10px;
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
/* A concise section label, quiet enough to sit above cards in a document. */
|
|
2381
|
+
.alternatives-label {
|
|
2382
|
+
margin: 0;
|
|
2383
|
+
padding: 0 2px;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
/* Cards wrap into columns once the page has room; one option takes the row. */
|
|
2387
|
+
.options {
|
|
2388
|
+
display: grid;
|
|
2389
|
+
grid-template-columns: repeat(auto-fit, minmax(min(216px, 100%), 1fr));
|
|
2390
|
+
gap: 8px;
|
|
2391
|
+
margin: 0;
|
|
2392
|
+
padding: 0;
|
|
2393
|
+
list-style: none;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
/* A grid item that stretches, so the cards in a row share their height. */
|
|
2397
|
+
.option {
|
|
2398
|
+
display: grid;
|
|
2399
|
+
min-width: 0;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
/*
|
|
2403
|
+
* The taken option: the card's own tone (a green hairline edge and a barely
|
|
2404
|
+
* green face), plus a ring outside the edge so the eye finds it in a row of
|
|
2405
|
+
* neutral cards. Weight and hue, not a bar down one side.
|
|
2406
|
+
*/
|
|
2407
|
+
.option[data-status='adopted'] .dpk-card {
|
|
2408
|
+
--dpk-card-tone: var(--dpk-green);
|
|
2409
|
+
box-shadow:
|
|
2410
|
+
0 0 0 2px color-mix(in oklab, var(--dpk-green) 26%, transparent),
|
|
2411
|
+
var(--dpk-bevel),
|
|
2412
|
+
0 10px 22px -14px color-mix(in oklab, var(--dpk-green) 60%, var(--dpk-shade-3));
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
/* ------------------------------------------------------------ status */
|
|
2416
|
+
|
|
2417
|
+
[data-tone='adopted'] {
|
|
2418
|
+
--tone: var(--dpk-green);
|
|
2419
|
+
--tone-soft: var(--dpk-green-soft);
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
[data-tone='rejected'] {
|
|
2423
|
+
--tone: var(--dpk-amber);
|
|
2424
|
+
--tone-soft: var(--dpk-amber-soft);
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
[data-tone='considered'] {
|
|
2428
|
+
--tone: var(--dpk-blue);
|
|
2429
|
+
--tone-soft: var(--dpk-blue-soft);
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
/* The chip's box comes from the card atom; only its tone is set here. */
|
|
2433
|
+
.status {
|
|
2434
|
+
background: var(--tone-soft);
|
|
2435
|
+
color: var(--tone);
|
|
2436
|
+
font-weight: 650;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/* -------------------------------------------------------------- body */
|
|
2440
|
+
|
|
2441
|
+
.option-summary {
|
|
2442
|
+
margin: 0;
|
|
2443
|
+
color: var(--dpk-ink-soft);
|
|
2444
|
+
font-size: 12.5px;
|
|
2445
|
+
line-height: 1.6;
|
|
2446
|
+
overflow-wrap: anywhere;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
.option-facts {
|
|
2450
|
+
display: grid;
|
|
2451
|
+
gap: 8px;
|
|
2452
|
+
margin: 0;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
.option-fact {
|
|
2456
|
+
display: grid;
|
|
2457
|
+
gap: 1px;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
.option-fact > dd {
|
|
2461
|
+
margin: 0;
|
|
2462
|
+
color: var(--dpk-ink-soft);
|
|
2463
|
+
font-size: 12.5px;
|
|
2464
|
+
line-height: 1.6;
|
|
2465
|
+
overflow-wrap: anywhere;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
.option-tradeoffs {
|
|
2469
|
+
display: grid;
|
|
2470
|
+
gap: 2px;
|
|
2471
|
+
margin: 0;
|
|
2472
|
+
padding-left: 16px;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
.option-tradeoffs > li::marker {
|
|
2476
|
+
color: var(--dpk-ink-faint);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/* ------------------------------------------------------- notice/empty */
|
|
2480
|
+
|
|
2481
|
+
.alternatives-notice,
|
|
2482
|
+
.alternatives-empty {
|
|
2483
|
+
margin: 0;
|
|
2484
|
+
padding: 12px 14px;
|
|
2485
|
+
border-radius: var(--dpk-radius);
|
|
2486
|
+
font-size: 12.5px;
|
|
2487
|
+
line-height: 1.6;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
.alternatives-notice {
|
|
2491
|
+
background: var(--dpk-danger-soft);
|
|
2492
|
+
color: var(--dpk-danger);
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
.alternatives-empty {
|
|
2496
|
+
color: var(--dpk-ink-faint);
|
|
2497
|
+
text-align: center;
|
|
2498
|
+
}
|
|
2499
|
+
`];class Ds extends z{static{this.styles=Fi}static{this.properties={data:{attribute:!1},heading:{type:String}}}#n=new R(this);#t=null;#e=null;#s=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=N(this,Ls,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.#s}get#a(){return Di(this.#n.locale)}#i(t){this.#e=t,this.#s=null,this.requestUpdate()}#r(t){this.#e=null,this.#s=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#a,e=this.heading??t.heading,s=Ui(t,this.#e??Pi());return r`<section class="alternatives">
|
|
2500
|
+
${e===""?h:r`<p class="alternatives-label dpk-label">${e}</p>`}
|
|
2501
|
+
${this.#s===null?h:r`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#s}</p>`}
|
|
2502
|
+
${this.#s===null&&s.length===0?r`<p class="alternatives-empty">${t.empty}</p>`:h}
|
|
2503
|
+
${s.length===0?h:r`<ul class="options">
|
|
2504
|
+
${F(s,n=>n.id,n=>this.#o(n))}
|
|
2505
|
+
</ul>`}
|
|
2506
|
+
</section>`}#o(t){const e=t.reason===null&&t.tradeoffs===null?h:r`<dl class="option-facts">
|
|
2507
|
+
${t.reason===null?h:r`<div class="option-fact">
|
|
2508
|
+
<dt class="dpk-label">${t.reason.label}</dt>
|
|
2509
|
+
<dd>${t.reason.text}</dd>
|
|
2510
|
+
</div>`}
|
|
2511
|
+
${t.tradeoffs===null?h:r`<div class="option-fact">
|
|
2512
|
+
<dt class="dpk-label">${t.tradeoffs.label}</dt>
|
|
2513
|
+
<dd>
|
|
2514
|
+
<ul class="option-tradeoffs">
|
|
2515
|
+
${t.tradeoffs.items.map(s=>r`<li>${s}</li>`)}
|
|
2516
|
+
</ul>
|
|
2517
|
+
</dd>
|
|
2518
|
+
</div>`}
|
|
2519
|
+
</dl>`;return r`<li class="option" data-status=${t.status} data-option=${t.id}>
|
|
2520
|
+
<article class="dpk-card">
|
|
2521
|
+
<div class="dpk-card-head">
|
|
2522
|
+
${t.key===null?h:r`<span class="dpk-card-key">${t.key}</span>`}
|
|
2523
|
+
<span class="dpk-card-title">${t.title}</span>
|
|
2524
|
+
<span class="dpk-card-meta">
|
|
2525
|
+
<span class="dpk-card-chip status" data-tone=${t.status}>${t.statusLabel}</span>
|
|
2526
|
+
</span>
|
|
2527
|
+
</div>
|
|
2528
|
+
${t.summary===null?h:r`<p class="option-summary">${t.summary}</p>`} ${e}
|
|
2529
|
+
</article>
|
|
2530
|
+
</li>`}}const Rs=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",Ds)},Hi=()=>{Xs(),Ys(),Re(),_e(),js()},js=()=>{Ee(),Ge(),Qe(),ka(),ss(),os(),va(),xa(),us(),gs(),Es(),ya(),ve(),Ce(),vs(),Ts(),Ms(),Ze(),Rs()};export{Na as $,ve as A,Ze as B,_e as C,Ds as D,Re as E,Ts as F,ss as G,Ce as H,Ls as I,is as J,gt as K,ys as L,jt as M,qe as N,we as O,js as P,pt as Q,Ct as R,Ia as S,Ba as T,Oa as U,_a as V,wa as W,xe as X,Ua as Y,Fa as Z,Ha as _,ks as a,rs as b,hs as c,ms as d,Ss as e,Je as f,We as g,As as h,ke as i,Ye as j,He as k,De as l,zs as m,es as n,$e as o,Rs as p,Ee as q,Hi as r,vs as s,os as t,us as u,gs as v,Es as w,Qe as x,Ge as y,Ms as z};
|