@desktalk/ui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/desktalk-ui.js +25 -22
- package/dist/desktalk-ui.js.map +4 -4
- package/dist/dt-select.d.ts +1 -0
- package/dist/dt-select.d.ts.map +1 -1
- package/dist/dt-tooltip.d.ts +5 -0
- package/dist/dt-tooltip.d.ts.map +1 -1
- package/dist/index.js +22 -19
- package/dist/index.js.map +4 -4
- package/dist/milkdown.umd.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +1 -0
package/dist/dt-select.d.ts
CHANGED
package/dist/dt-select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dt-select.d.ts","sourceRoot":"","sources":["../src/dt-select.ts"],"names":[],"mappings":"AAUA,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,QAAS,SAAQ,WAAW;IAEvC,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAM;IAGrB,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAID,IAAI,KAAK,IAAI,MAAM,CAElB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,EAEpB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IACD,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,EAE1B;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAMxB;IAED,IAAI,KAAK,IAAI,aAAa,CAIzB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,aAAa,EAE3B;IAID,IAAI,OAAO,IAAI,cAAc,EAAE,CAE9B;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,EAMhC;;IAkCD,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAK5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAiB5C,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,eAAe,CAOrB;IAEF,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"dt-select.d.ts","sourceRoot":"","sources":["../src/dt-select.ts"],"names":[],"mappings":"AAUA,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAaD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,QAAS,SAAQ,WAAW;IAEvC,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAM;IAGrB,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAID,IAAI,KAAK,IAAI,MAAM,CAElB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,EAEpB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IACD,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,EAE1B;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAMxB;IAED,IAAI,KAAK,IAAI,aAAa,CAIzB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,aAAa,EAE3B;IAID,IAAI,OAAO,IAAI,cAAc,EAAE,CAE9B;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,EAMhC;;IAkCD,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAK5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAiB5C,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,eAAe,CAOrB;IAEF,OAAO,CAAC,SAAS;IA6BjB,OAAO,CAAC,MAAM;IAmBd,OAAO,CAAC,eAAe,CAKrB;IAEF,OAAO,CAAC,aAAa,CAMnB;IAEF,OAAO,CAAC,UAAU,CAKhB;IAIF,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,SAAS;CAiClB"}
|
package/dist/dt-tooltip.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
+
type Align = 'left' | 'center' | 'right';
|
|
2
3
|
/**
|
|
3
4
|
* `<dt-tooltip>` — framework-agnostic tooltip web component.
|
|
4
5
|
*
|
|
@@ -8,6 +9,8 @@ type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
|
8
9
|
* ## Attributes
|
|
9
10
|
* - `content` — tooltip text (required)
|
|
10
11
|
* - `placement` — preferred side: top | bottom | left | right (default "top")
|
|
12
|
+
* - `align` — cross-axis alignment for top/bottom placements: left | center | right
|
|
13
|
+
* (default "center")
|
|
11
14
|
* - `delay` — show delay in milliseconds (default 0)
|
|
12
15
|
* - `disabled` — when present, tooltip is suppressed
|
|
13
16
|
*
|
|
@@ -28,6 +31,8 @@ export declare class DtTooltip extends HTMLElement {
|
|
|
28
31
|
set content(val: string);
|
|
29
32
|
get placement(): Placement;
|
|
30
33
|
set placement(val: Placement);
|
|
34
|
+
get align(): Align;
|
|
35
|
+
set align(val: Align);
|
|
31
36
|
get delay(): number;
|
|
32
37
|
set delay(val: number | string);
|
|
33
38
|
get disabled(): boolean;
|
package/dist/dt-tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dt-tooltip.d.ts","sourceRoot":"","sources":["../src/dt-tooltip.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dt-tooltip.d.ts","sourceRoot":"","sources":["../src/dt-tooltip.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AACrD,KAAK,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAezC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,WAAW;IAExC,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,YAAY,CAA8C;IAClE,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,QAAQ,CAAS;IAGzB,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAGD,IAAI,OAAO,IAAI,MAAM,CAEpB;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,EAEtB;IAED,IAAI,SAAS,IAAI,SAAS,CAIzB;IACD,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,EAE3B;IAED,IAAI,KAAK,IAAI,KAAK,CAIjB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,KAAK,EAEnB;IAED,IAAI,KAAK,IAAI,MAAM,CAGlB;IACD,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAE7B;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAMxB;;IAYD,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAQ5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAWvF,OAAO,CAAC,QAAQ,CAgBd;IAEF,OAAO,CAAC,QAAQ,CAEd;IAIF,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,KAAK;IAkBb,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,SAAS;CA6FlB"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var X=`.dt-tooltip-popup {
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 2147483647;
|
|
4
4
|
padding: 6px 10px;
|
|
@@ -41,13 +41,13 @@ var J=`.dt-tooltip-popup {
|
|
|
41
41
|
|
|
42
42
|
/* Arrow styling - tech/minimal */
|
|
43
43
|
.dt-tooltip-popup[data-actual-placement='top'] {
|
|
44
|
-
transform:
|
|
44
|
+
transform: none;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.dt-tooltip-popup[data-actual-placement='top']::before {
|
|
48
48
|
top: auto;
|
|
49
49
|
bottom: -4px;
|
|
50
|
-
left: 50
|
|
50
|
+
left: var(--dt-tooltip-arrow-left, 50%);
|
|
51
51
|
transform: translateX(-50%);
|
|
52
52
|
width: 0;
|
|
53
53
|
height: 0;
|
|
@@ -58,13 +58,13 @@ var J=`.dt-tooltip-popup {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.dt-tooltip-popup[data-actual-placement='bottom'] {
|
|
61
|
-
transform:
|
|
61
|
+
transform: none;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.dt-tooltip-popup[data-actual-placement='bottom']::before {
|
|
65
65
|
bottom: auto;
|
|
66
66
|
top: -4px;
|
|
67
|
-
left: 50
|
|
67
|
+
left: var(--dt-tooltip-arrow-left, 50%);
|
|
68
68
|
transform: translateX(-50%);
|
|
69
69
|
width: 0;
|
|
70
70
|
height: 0;
|
|
@@ -75,12 +75,12 @@ var J=`.dt-tooltip-popup {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.dt-tooltip-popup[data-actual-placement='left'] {
|
|
78
|
-
transform:
|
|
78
|
+
transform: none;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.dt-tooltip-popup[data-actual-placement='left']::before {
|
|
82
82
|
left: auto;
|
|
83
|
-
top: 50
|
|
83
|
+
top: var(--dt-tooltip-arrow-top, 50%);
|
|
84
84
|
right: -4px;
|
|
85
85
|
transform: translateY(-50%);
|
|
86
86
|
width: 0;
|
|
@@ -92,12 +92,12 @@ var J=`.dt-tooltip-popup {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.dt-tooltip-popup[data-actual-placement='right'] {
|
|
95
|
-
transform:
|
|
95
|
+
transform: none;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.dt-tooltip-popup[data-actual-placement='right']::before {
|
|
99
99
|
right: auto;
|
|
100
|
-
top: 50
|
|
100
|
+
top: var(--dt-tooltip-arrow-top, 50%);
|
|
101
101
|
left: -4px;
|
|
102
102
|
transform: translateY(-50%);
|
|
103
103
|
width: 0;
|
|
@@ -107,7 +107,7 @@ var J=`.dt-tooltip-popup {
|
|
|
107
107
|
border-top: none;
|
|
108
108
|
border-bottom: none;
|
|
109
109
|
}
|
|
110
|
-
`;var vt="dt-tooltip-popup",
|
|
110
|
+
`;var vt="dt-tooltip-popup",p=8,J=!1;function ft(){if(J)return;let r=document.createElement("style");r.setAttribute("data-dt-tooltip",""),r.textContent=X,document.head.appendChild(r),J=!0}var w=class extends HTMLElement{_popup=null;_showTimeout=null;_tooltipId="";_visible=!1;static get observedAttributes(){return["content","placement","align","delay","disabled"]}get content(){return this.getAttribute("content")??""}set content(t){this.setAttribute("content",t)}get placement(){let t=this.getAttribute("placement");return t==="bottom"||t==="left"||t==="right"?t:"top"}set placement(t){this.setAttribute("placement",t)}get align(){let t=this.getAttribute("align");return t==="left"||t==="right"?t:"center"}set align(t){this.setAttribute("align",t)}get delay(){let t=Number(this.getAttribute("delay"));return Number.isFinite(t)&&t>0?t:0}set delay(t){this.setAttribute("delay",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}constructor(){super();let t=this.attachShadow({mode:"open"});t.innerHTML="<slot></slot>",this._tooltipId=`dt-tip-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){ft(),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onEnter),this.addEventListener("focusout",this._onLeave)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onEnter),this.removeEventListener("focusout",this._onLeave),this._hide()}attributeChangedCallback(t,e,n){t==="disabled"&&this.disabled&&this._hide(),t==="content"&&this._popup&&(this._popup.textContent=this.content)}_onEnter=()=>{if(this.disabled||!this.content)return;this._showTimeout!==null&&clearTimeout(this._showTimeout);let t=()=>{this._createPopup(),this._position(),this._visible=!0};this.delay>0?this._showTimeout=setTimeout(t,this.delay):t()};_onLeave=()=>{this._hide()};_createPopup(){if(this._popup)return;let t=document.createElement("div");t.className=vt,t.id=this._tooltipId,t.setAttribute("role","tooltip"),t.textContent=this.content,document.body.appendChild(t),this._popup=t;let e=this._getTrigger();e&&e.setAttribute("aria-describedby",this._tooltipId)}_hide(){if(this._showTimeout!==null&&(clearTimeout(this._showTimeout),this._showTimeout=null),this._popup){let t=this._getTrigger();t&&t.removeAttribute("aria-describedby"),this._popup.remove(),this._popup=null,this._visible=!1}}_getTrigger(){let e=this.shadowRoot?.querySelector("slot")?.assignedElements();return e&&e.length>0?e[0]:null}_position(){let t=this._popup;if(!t)return;let e=this.getBoundingClientRect(),n=t.getBoundingClientRect(),i=window.innerWidth,o=window.innerHeight,s=8,a=this.placement;a==="top"&&e.top-n.height-p<0?a="bottom":a==="bottom"&&e.bottom+n.height+p>o?a="top":a==="left"&&e.left-n.width-p<0?a="right":a==="right"&&e.right+n.width+p>i&&(a="left"),t.setAttribute("data-actual-placement",a);let d,l,c=e.left+e.width/2,u=e.top+e.height/2;switch(a){case"top":c=this.align==="left"?e.left:this.align==="right"?e.right:e.left+e.width/2,l=this.align==="left"?e.left:this.align==="right"?e.right-n.width:e.left+e.width/2-n.width/2,d=e.top-n.height-p;break;case"bottom":c=this.align==="left"?e.left:this.align==="right"?e.right:e.left+e.width/2,l=this.align==="left"?e.left:this.align==="right"?e.right-n.width:e.left+e.width/2-n.width/2,d=e.bottom+p;break;case"left":l=e.left-n.width-p,d=e.top+e.height/2-n.height/2,u=e.top+e.height/2;break;case"right":l=e.right+p,d=e.top+e.height/2-n.height/2,u=e.top+e.height/2;break}a==="top"||a==="bottom"?(l=Math.max(s,Math.min(l,i-n.width-s)),t.style.setProperty("--dt-tooltip-arrow-left",`${Math.max(8,Math.min(c-l,n.width-8))}px`),t.style.removeProperty("--dt-tooltip-arrow-top")):(d=Math.max(s,Math.min(d,o-n.height-s)),t.style.setProperty("--dt-tooltip-arrow-top",`${Math.max(8,Math.min(u-d,n.height-8))}px`),t.style.removeProperty("--dt-tooltip-arrow-left")),t.style.left=`${l}px`,t.style.top=`${d}px`}};var G=`:host {
|
|
111
111
|
display: block;
|
|
112
112
|
margin-bottom: 12px;
|
|
113
113
|
}
|
|
@@ -183,7 +183,7 @@ var J=`.dt-tooltip-popup {
|
|
|
183
183
|
::slotted(p:last-child) {
|
|
184
184
|
margin-bottom: 0;
|
|
185
185
|
}
|
|
186
|
-
`;var _t="dt-card-inner",
|
|
186
|
+
`;var _t="dt-card-inner",x=class extends HTMLElement{static get observedAttributes(){return["variant"]}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=G,t.appendChild(e);let n=document.createElement("div");n.className=_t,n.innerHTML="<slot></slot>",t.appendChild(n)}};var j=`.dt-select-menu {
|
|
187
187
|
position: fixed;
|
|
188
188
|
z-index: 2147483646;
|
|
189
189
|
display: flex;
|
|
@@ -356,7 +356,7 @@ var J=`.dt-tooltip-popup {
|
|
|
356
356
|
.dt-select-trigger[aria-expanded='true'] .dt-select-chevron {
|
|
357
357
|
transform: rotate(180deg);
|
|
358
358
|
}
|
|
359
|
-
`;var
|
|
359
|
+
`;var wt="dt-select-trigger",K="dt-select-label",xt="dt-select-chevron",yt="dt-select-menu",kt="dt-select-option",Ct="dt-select-option--active",U=!1;function Et(){if(U)return;let r=document.createElement("style");r.setAttribute("data-dt-select",""),r.textContent=j,document.head.appendChild(r),U=!0}var y=class extends HTMLElement{_menu=null;_trigger=null;_options=[];_open=!1;_menuId="";static get observedAttributes(){return["value","placeholder","disabled","align"]}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}get placeholder(){return this.getAttribute("placeholder")??"Select\u2026"}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get align(){return this.getAttribute("align")==="right"?"right":"left"}set align(t){this.setAttribute("align",t)}get options(){return this._options}set options(t){this._options=t,this._updateLabel(),this._open&&this._renderMenuItems()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=q,t.appendChild(e);let n=document.createElement("button");n.type="button",n.className=wt,n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-expanded","false");let i=document.createElement("span");i.className=K,n.appendChild(i);let o=document.createElement("span");o.className=xt,o.setAttribute("aria-hidden","true"),o.textContent="\u25BE",n.appendChild(o),t.appendChild(n),this._trigger=n,this._menuId=`dt-sel-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){Et(),this._trigger.addEventListener("click",this._onTriggerClick),this._updateLabel()}disconnectedCallback(){this._trigger.removeEventListener("click",this._onTriggerClick),this._close()}attributeChangedCallback(t){t==="value"&&(this._updateLabel(),this._open&&this._renderMenuItems()),t==="placeholder"&&!this.value&&this._updateLabel(),t==="disabled"&&this.disabled&&this._close()}_updateLabel(){let t=this._trigger.querySelector(`.${K}`),e=this._options.find(n=>n.value===this.value);t.textContent=e?.label??this.placeholder}_onTriggerClick=()=>{this.disabled||(this._open?this._close():this._openMenu())};_openMenu(){if(this._open)return;let t=document.createElement("div");t.className=yt,t.id=this._menuId,t.setAttribute("role","listbox"),document.body.appendChild(t),this._menu=t,this._renderMenuItems(),this._position(),requestAnimationFrame(()=>{t.setAttribute("data-open","")}),this._open=!0,this._trigger.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{document.addEventListener("mousedown",this._onOutsideClick),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("blur",this._onWindowBlur)})}_close(){if(this._open){if(document.removeEventListener("mousedown",this._onOutsideClick),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("blur",this._onWindowBlur),this._menu){this._menu.removeAttribute("data-open");let t=this._menu;setTimeout(()=>t.remove(),140),this._menu=null}this._open=!1,this._trigger.setAttribute("aria-expanded","false")}}_onOutsideClick=t=>{let e=t.target;this._menu?.contains(e)||this.contains(e)||this._close()};_onWindowBlur=()=>{requestAnimationFrame(()=>{document.activeElement?.tagName==="IFRAME"&&this._close()})};_onKeyDown=t=>{t.key==="Escape"&&(this._close(),this._trigger.focus())};_renderMenuItems(){let t=this._menu;if(t){t.innerHTML="";for(let e of this._options){let n=document.createElement("button");n.type="button",n.className=kt,n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e.value===this.value)),e.value===this.value&&n.classList.add(Ct);let i=document.createElement("span");i.textContent=e.label,n.appendChild(i),n.addEventListener("click",()=>{this._selectValue(e.value)}),t.appendChild(n)}}}_selectValue(t){let e=this.value;this.value=t,this._updateLabel(),this._close(),t!==e&&this.dispatchEvent(new CustomEvent("dt-change",{detail:{value:t},bubbles:!0,composed:!0}))}_position(){let t=this._menu;if(!t)return;let e=this.getBoundingClientRect(),n=10,i=Math.max(e.width,240),o=e.bottom+n,s=t.scrollHeight||260,a=window.innerHeight;if(o+s>a&&e.top-s-n>0&&(o=e.top-s-n),t.style.minWidth=`${i}px`,this.align==="right"){let d=window.innerWidth;t.style.right=`${d-e.right}px`,t.style.left="auto"}else t.style.left=`${e.left}px`,t.style.right="auto";t.style.top=`${o}px`}};var Y=`:host {
|
|
360
360
|
display: block;
|
|
361
361
|
margin-bottom: 12px;
|
|
362
362
|
}
|
|
@@ -718,6 +718,9 @@ var J=`.dt-tooltip-popup {
|
|
|
718
718
|
font-weight: 600;
|
|
719
719
|
font-family: var(--font-ui, 'Work Sans', system-ui, sans-serif);
|
|
720
720
|
line-height: 1.2;
|
|
721
|
+
white-space: nowrap;
|
|
722
|
+
overflow: hidden;
|
|
723
|
+
text-overflow: ellipsis;
|
|
721
724
|
cursor: pointer;
|
|
722
725
|
transition: all 0.1s ease;
|
|
723
726
|
background: var(--dt-surface);
|
|
@@ -1093,7 +1096,7 @@ var J=`.dt-tooltip-popup {
|
|
|
1093
1096
|
letter-spacing: 0.08em;
|
|
1094
1097
|
font-size: 0.75rem;
|
|
1095
1098
|
}
|
|
1096
|
-
`;function Lt(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ht(r,t){let e=r.querySelectorAll("*");for(let n of e){let i=n.getAttribute("data-field");if(i){let o=t[i];n.textContent=o==null?"":String(o)}for(let o of n.getAttributeNames()){if(o==="data-field"||!o.startsWith("data-field-"))continue;let s=o.slice(11);if(!s)continue;let a=n.getAttribute(o);if(!a)continue;let d=Lt(t[a]);d===null?n.removeAttribute(s):n.setAttribute(s,d)}}}function M(r,t){let e=r.content.cloneNode(!0);return Ht(e,t),e}var
|
|
1099
|
+
`;function Lt(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ht(r,t){let e=r.querySelectorAll("*");for(let n of e){let i=n.getAttribute("data-field");if(i){let o=t[i];n.textContent=o==null?"":String(o)}for(let o of n.getAttributeNames()){if(o==="data-field"||!o.startsWith("data-field-"))continue;let s=o.slice(11);if(!s)continue;let a=n.getAttribute(o);if(!a)continue;let d=Lt(t[a]);d===null?n.removeAttribute(s):n.setAttribute(s,d)}}}function M(r,t){let e=r.content.cloneNode(!0);return Ht(e,t),e}var g=class{_count=0;_estimateSize=56;_overscan=5;_fixedSize=null;_viewportHeight=0;_scrollTop=0;_sizes=new Map;constructor(t={}){this._count=t.count??0,this._estimateSize=t.estimateSize??56,this._overscan=t.overscan??5,this._fixedSize=t.fixedSize??null}setCount(t){this._count=Math.max(0,t);for(let e of this._sizes.keys())e>=this._count&&this._sizes.delete(e)}setViewportHeight(t){this._viewportHeight=Math.max(0,t)}setScrollTop(t){this._scrollTop=Math.max(0,t)}setEstimateSize(t){this._estimateSize=Math.max(1,t)}setFixedSize(t){this._fixedSize=t&&t>0?t:null}resetMeasurements(){this._sizes.clear()}measure(t,e){if(this._fixedSize!==null||t<0||t>=this._count)return 0;let n=Math.max(1,Math.round(e)),i=this._sizes.get(t);return i===n?0:(this._sizes.set(t,n),this.getOffset(t+1)<=this._scrollTop?n-(i??this._estimateSize):0)}getOffset(t){if(t<=0)return 0;let e=Math.min(t,this._count);if(this._fixedSize!==null)return e*this._fixedSize;let n=0;for(let i=0;i<e;i+=1)n+=this._sizes.get(i)??this._estimateSize;return n}getTotalHeight(){return this.getOffset(this._count)}getRange(){if(this._count===0)return{start:0,end:0,paddingTop:0,paddingBottom:0,totalHeight:0};if(this._fixedSize!==null){let d=Math.max(1,Math.ceil(this._viewportHeight/this._fixedSize)),l=Math.max(0,Math.floor(this._scrollTop/this._fixedSize)-this._overscan),c=Math.min(this._count,l+d+this._overscan*2),u=l*this._fixedSize,_=this._count*this._fixedSize,h=Math.max(0,_-u-(c-l)*this._fixedSize);return{start:l,end:c,paddingTop:u,paddingBottom:h,totalHeight:_}}let t=0,e=0;for(;t<this._count;){let d=this._sizes.get(t)??this._estimateSize;if(e+d>this._scrollTop)break;e+=d,t+=1}t=Math.max(0,t-this._overscan);let n=this.getOffset(t),i=t,o=0;for(;i<this._count&&o<this._viewportHeight;)o+=this._sizes.get(i)??this._estimateSize,i+=1;i=Math.min(this._count,i+this._overscan);let s=this.getTotalHeight(),a=Math.max(0,s-this.getOffset(i));return{start:t,end:i,paddingTop:n,paddingBottom:a,totalHeight:s}}};function Rt(r){return r&&typeof r=="object"?r:{value:r}}function Pt(r){return r==="center"||r==="right"?r:"left"}var v=class extends HTMLElement{static get observedAttributes(){return["field","header","width","min-width","align"]}get field(){return this.getAttribute("field")??""}get header(){return this.getAttribute("header")??this.field}get width(){return this.getAttribute("width")??"auto"}get minWidth(){return this.getAttribute("min-width")??"0"}get align(){return Pt(this.getAttribute("align"))}connectedCallback(){this.hidden=!0}attributeChangedCallback(){this.dispatchEvent(new CustomEvent("dt-column-change",{bubbles:!0,composed:!0}))}},z=class extends HTMLElement{_rows=[];_columns=[];_virtualizer=new g({estimateSize:40,overscan:5,fixedSize:40});_root;_scroll;_header;_body;_canvas;_emptyState;_resizeObserver=null;_mutationObserver=null;_sortField=null;_sortDirection="asc";static get observedAttributes(){return["row-height","sortable","striped","bordered","empty-text"]}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._virtualizer.setCount(this._rows.length),this._render()}get rowHeight(){let t=Number(this.getAttribute("row-height")??"40");return Number.isFinite(t)&&t>0?t:40}set rowHeight(t){this.setAttribute("row-height",String(t))}get sortable(){return this.hasAttribute("sortable")}get emptyText(){return this.getAttribute("empty-text")??"No data"}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=rt,t.appendChild(e),this._root=document.createElement("div"),this._root.className="dt-table-view",this._scroll=document.createElement("div"),this._scroll.className="dt-table-scroll",this._scroll.addEventListener("scroll",this._onScroll,{passive:!0}),this._header=document.createElement("div"),this._header.className="dt-table-header",this._body=document.createElement("div"),this._body.className="dt-table-body",this._canvas=document.createElement("div"),this._canvas.className="dt-table-canvas",this._emptyState=document.createElement("div"),this._emptyState.className="dt-table-empty",this._body.append(this._canvas,this._emptyState),this._scroll.append(this._header,this._body),this._root.appendChild(this._scroll),t.appendChild(this._root)}connectedCallback(){this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight),this._syncColumns(),this._resizeObserver=new ResizeObserver(t=>{for(let e of t)if(e.target===this._scroll){let n=this._header.offsetHeight;this._virtualizer.setViewportHeight(Math.max(0,e.contentRect.height-n)),this._render()}}),this._resizeObserver.observe(this._scroll),this._mutationObserver=new MutationObserver(()=>{this._syncColumns(),this._render()}),this._mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["field","header","width","min-width","align"]}),this._virtualizer.setCount(this._rows.length),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight)),this._render()}disconnectedCallback(){this._scroll.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),this._resizeObserver=null,this._mutationObserver=null}attributeChangedCallback(t){t==="row-height"&&(this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight)),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._renderBody()};_syncColumns(){this._columns=Array.from(this.children).filter(t=>t instanceof v).map(t=>({field:t.field,header:t.header,width:t.width,minWidth:t.minWidth,align:t.align,template:Array.from(t.children).find(e=>e instanceof HTMLTemplateElement)??null})).filter(t=>t.field)}_render(){if(!this.isConnected)return;this._emptyState.textContent=this.emptyText;let t=this._columns.length>0?this._columns.map(e=>this._toGridColumn(e)).join(" "):"minmax(0, 1fr)";this._header.style.setProperty("--dt-table-columns",t),this._canvas.style.setProperty("--dt-table-columns",t),this._renderHeader(),this._renderBody()}_renderHeader(){let t=document.createDocumentFragment();for(let e of this._columns){let n=document.createElement("div");n.className="dt-table-header-cell",n.dataset.align=e.align,this.sortable&&(n.classList.add("dt-table-header-cell--sortable"),n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-label",`Sort by ${e.header}`),n.addEventListener("click",()=>this._requestSort(e.field)),n.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._requestSort(e.field))}));let i=document.createElement("span");if(i.className="dt-table-header-label",i.textContent=e.header,this.sortable){let o=document.createElement("span");o.className="dt-table-sort-indicator",this._sortField===e.field?o.textContent=this._sortDirection==="asc"?"\u25B2":"\u25BC":o.textContent="\u2195",i.appendChild(o)}n.appendChild(i),t.appendChild(n)}this._header.replaceChildren(t)}_renderBody(){if(this._rows.length===0||this._columns.length===0){this._emptyState.hidden=!1,this._canvas.replaceChildren(),this._body.style.height="140px",this._canvas.style.height="0px";return}this._emptyState.hidden=!0,this._virtualizer.setCount(this._rows.length),this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight));let t=this._virtualizer.getRange();this._body.style.height=`${Math.max(t.totalHeight,this._scroll.clientHeight-this._header.offsetHeight)}px`,this._canvas.style.height=`${t.totalHeight}px`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderRow(n));this._canvas.replaceChildren(e)}_renderRow(t){let e=this._rows[t],n=document.createElement("div");n.className="dt-table-row dt-table-row--clickable",n.style.top=`${this._virtualizer.getOffset(t)}px`,n.style.height=`${this.rowHeight}px`,n.style.setProperty("--dt-table-columns",this._header.style.getPropertyValue("--dt-table-columns")),n.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("dt-row-click",{detail:{row:e,index:t},bubbles:!0,composed:!0}))});let i=Rt(e);for(let o of this._columns){let s=document.createElement("div");if(s.className="dt-table-cell",s.dataset.align=o.align,o.template)s.appendChild(M(o.template,i));else{let a=i[o.field];s.textContent=a==null?"":String(a)}n.appendChild(s)}return n}_requestSort(t){this._sortField===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortField=t,this._sortDirection="asc"),this._renderHeader(),this.dispatchEvent(new CustomEvent("dt-sort",{detail:{field:t,direction:this._sortDirection},bubbles:!0,composed:!0}))}_toGridColumn(t){let e=/^\d+$/.test(t.minWidth)?`${t.minWidth}px`:t.minWidth;if(t.width==="auto")return`minmax(${e}, 1fr)`;let n=/^\d+$/.test(t.width)?`${t.width}px`:t.width;return`minmax(${e}, ${n})`}};var it=`:host {
|
|
1097
1100
|
display: block;
|
|
1098
1101
|
min-height: 120px;
|
|
1099
1102
|
color: var(--dt-text);
|
|
@@ -1192,7 +1195,7 @@ var J=`.dt-tooltip-popup {
|
|
|
1192
1195
|
letter-spacing: 0.08em;
|
|
1193
1196
|
font-size: 0.75rem;
|
|
1194
1197
|
}
|
|
1195
|
-
`;var ot=56;function Vt(r){return r&&typeof r=="object"?r:{value:r}}var T=class extends HTMLElement{_items=[];_selectedIndices=new Set;_renderItem=null;_virtualizer=new
|
|
1198
|
+
`;var ot=56;function Vt(r){return r&&typeof r=="object"?r:{value:r}}var T=class extends HTMLElement{_items=[];_selectedIndices=new Set;_renderItem=null;_virtualizer=new g({estimateSize:ot,overscan:5});_viewport;_spacer;_itemsLayer;_emptyState;_resizeObserver=null;_itemResizeObserver=null;static get observedAttributes(){return["item-height","dividers","selectable","empty-text"]}get items(){return this._items}set items(t){this._items=Array.isArray(t)?t:[],this._selectedIndices=new Set([...this._selectedIndices].filter(e=>e<this._items.length)),this._virtualizer.setCount(this._items.length),this._syncSizingMode(!0),this._render()}get selectedItems(){return[...this._selectedIndices].sort((t,e)=>t-e).map(t=>this._items[t])}get renderItem(){return this._renderItem}set renderItem(t){this._renderItem=typeof t=="function"?t:null,this._render()}get itemHeight(){let t=this.getAttribute("item-height");if(!t)return null;let e=Number(t);return Number.isFinite(e)&&e>0?e:null}set itemHeight(t){if(t===null||t<=0){this.removeAttribute("item-height");return}this.setAttribute("item-height",String(t))}get selectable(){let t=this.getAttribute("selectable");return t==="single"||t==="multi"?t:"none"}set selectable(t){this.setAttribute("selectable",t)}get emptyText(){return this.getAttribute("empty-text")??"No items"}set emptyText(t){this.setAttribute("empty-text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=it,t.appendChild(e),this._viewport=document.createElement("div"),this._viewport.className="dt-list-view",this._viewport.addEventListener("scroll",this._onScroll,{passive:!0}),this._spacer=document.createElement("div"),this._spacer.className="dt-list-spacer",this._itemsLayer=document.createElement("div"),this._itemsLayer.className="dt-list-items",this._emptyState=document.createElement("div"),this._emptyState.className="dt-list-empty",this._spacer.append(this._itemsLayer,this._emptyState),this._viewport.appendChild(this._spacer),t.appendChild(this._viewport)}connectedCallback(){this._resizeObserver=new ResizeObserver(t=>{for(let e of t)e.target===this._viewport&&(this._virtualizer.setViewportHeight(e.contentRect.height),this._render())}),this._resizeObserver.observe(this._viewport),this._itemResizeObserver=new ResizeObserver(t=>{let e=0;for(let n of t){let i=n.target,o=Number(i.dataset.index);Number.isFinite(o)&&(e+=this._virtualizer.measure(o,n.contentRect.height))}e!==0&&(this._viewport.scrollTop+=e),t.length>0&&this._render()}),this._virtualizer.setCount(this._items.length),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._syncSizingMode(!1),this._render()}disconnectedCallback(){this._viewport.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._itemResizeObserver?.disconnect(),this._resizeObserver=null,this._itemResizeObserver=null}attributeChangedCallback(t){t==="item-height"&&this._syncSizingMode(!0),t==="selectable"&&this.selectable==="none"&&this._selectedIndices.size>0&&(this._selectedIndices.clear(),this._emitSelectionChange()),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(this._viewport.scrollTop),this._render()};_syncSizingMode(t){let e=this.itemHeight;this._virtualizer.setFixedSize(e),this._virtualizer.setEstimateSize(e??ot),t&&this._virtualizer.resetMeasurements()}_render(){if(!this.isConnected)return;if(this._emptyState.textContent=this.emptyText,this._emptyState.hidden=this._items.length>0,this._items.length===0){this._itemsLayer.replaceChildren(),this._spacer.style.height="100%";return}this._virtualizer.setScrollTop(this._viewport.scrollTop),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._virtualizer.setCount(this._items.length);let t=this._virtualizer.getRange();this._spacer.style.height=`${Math.max(t.totalHeight,this._viewport.clientHeight)}px`,this._itemsLayer.style.transform=`translateY(${t.paddingTop}px)`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderVisibleItem(n));this._itemsLayer.replaceChildren(e)}_renderVisibleItem(t){let e=this._items[t],n=document.createElement("div");if(n.className="dt-list-item",n.dataset.index=String(t),this.selectable!=="none"&&(n.classList.add("dt-list-item--interactive"),n.setAttribute("role","option"),n.setAttribute("aria-selected",String(this._selectedIndices.has(t))),n.tabIndex=0),this._selectedIndices.has(t)&&n.classList.add("dt-list-item--selected"),this.itemHeight!==null&&(n.style.minHeight=`${this.itemHeight}px`),this._renderItem)this._renderItem(e,n,t);else{let i=this._getTemplate();i?n.appendChild(M(i,Vt(e))):n.textContent=String(e??"")}return n.addEventListener("click",()=>this._handleItemClick(t)),n.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._handleItemClick(t))}),this.itemHeight===null&&this._itemResizeObserver?.observe(n),n}_handleItemClick(t){let e=this._items[t],n=this.selectable;n==="single"?(this._selectedIndices=new Set([t]),this._emitSelectionChange(),this._render()):n==="multi"&&(this._selectedIndices.has(t)?this._selectedIndices.delete(t):this._selectedIndices.add(t),this._emitSelectionChange(),this._render()),this.dispatchEvent(new CustomEvent("dt-item-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("dt-selection-change",{detail:{selected:this.selectedItems},bubbles:!0,composed:!0}))}_getTemplate(){for(let t of Array.from(this.children))if(t instanceof HTMLTemplateElement)return t;return null}};var st=`:host {
|
|
1196
1199
|
display: block;
|
|
1197
1200
|
min-height: 220px;
|
|
1198
1201
|
color: var(--dt-text);
|
|
@@ -1279,7 +1282,7 @@ var J=`.dt-tooltip-popup {
|
|
|
1279
1282
|
.dt-chart__status[hidden] {
|
|
1280
1283
|
display: none;
|
|
1281
1284
|
}
|
|
1282
|
-
`;var L=null;function at(){return window.__DtChart?Promise.resolve(window.__DtChart):L||(L=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/chart.umd.js",e.async=!0,e.dataset.dtChart="true",e.onload=()=>{if(window.__DtChart){r(window.__DtChart);return}t(new Error("Chart runtime loaded without a __DtChart export."))},e.onerror=()=>t(new Error("Failed to load the Chart.js runtime bundle.")),document.head.appendChild(e)}),L)}function
|
|
1285
|
+
`;var L=null;function at(){return window.__DtChart?Promise.resolve(window.__DtChart):L||(L=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/chart.umd.js",e.async=!0,e.dataset.dtChart="true",e.onload=()=>{if(window.__DtChart){r(window.__DtChart);return}t(new Error("Chart runtime loaded without a __DtChart export."))},e.onerror=()=>t(new Error("Failed to load the Chart.js runtime bundle.")),document.head.appendChild(e)}),L)}function f(r,t,e){return Math.min(e,Math.max(t,r))}function It(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function W(r){let t=r.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(t){let i=t[1],o=i.length===3?i.split("").map(l=>`${l}${l}`).join(""):i,s=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,d=parseInt(o.slice(4,6),16)/255;return dt(s,a,d)}let e=r.trim().match(/^rgba?\((\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)(?:[,/\s]+[\d.]+)?\)$/i);if(e)return dt(Number(e[1])/255,Number(e[2])/255,Number(e[3])/255);let n=r.trim().match(/^hsla?\(([-\d.]+)(?:deg)?[,\s]+([\d.]+)%[,\s]+([\d.]+)%(?:[,/\s]+[\d.]+)?\)$/i);return n?{h:(Number(n[1])%360+360)%360,s:f(Number(n[2]),0,100),l:f(Number(n[3]),0,100)}:null}function dt(r,t,e){let n=Math.max(r,t,e),i=Math.min(r,t,e),o=n-i,s=0,a=(n+i)/2,d=o===0?0:o/(1-Math.abs(2*a-1));if(o!==0)switch(n){case r:s=60*((t-e)/o%6);break;case t:s=60*((e-r)/o+2);break;default:s=60*((r-t)/o+4);break}return{h:(s+360)%360,s:Math.round(d*100),l:Math.round(a*100)}}function b(r,t=1){return`hsla(${Math.round(r.h)} ${Math.round(r.s)}% ${Math.round(r.l)}% / ${t})`}function Nt(r){let t=W(r)??{h:185,s:88,l:56};return[0,32,68,118,164,212,258,304].map((n,i)=>({h:(t.h+n)%360,s:f(t.s-i*2,55,90),l:f(t.l+(i%2===0?0:6)-i,38,66)}))}function H(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function lt(r,t){if(!H(r)||!H(t))return t??r;let e={...r};for(let[n,i]of Object.entries(t)){let o=e[n];e[n]=H(o)&&H(i)?lt(o,i):i}return e}function Ft(r){return r==="top"||r==="bottom"||r==="left"||r==="right"?r:"none"}function Ot(r){return r==="bar"||r==="line"||r==="area"||r==="pie"||r==="doughnut"||r==="radar"||r==="scatter"||r==="bubble"?r:"bar"}function Bt(r){return r==="bar"||r==="line"||r==="area"||r==="scatter"||r==="bubble"}function $t(r){return r.map(t=>t.trim()).filter(Boolean)}var R=class extends HTMLElement{_canvas;_status;_runtime=null;_loadPromise=null;_chart=null;_renderedType=null;_dataInput=null;_optionsOverride=null;_syncFrame=0;static get observedAttributes(){return["type","legend","stacked","labels"]}get type(){return Ot(this.getAttribute("type"))}set type(t){this.setAttribute("type",t)}get legend(){return Ft(this.getAttribute("legend"))}set legend(t){this.setAttribute("legend",t)}get stacked(){return this.hasAttribute("stacked")}set stacked(t){this.toggleAttribute("stacked",t)}get labels(){return $t(It(this.getAttribute("labels")))}set labels(t){this.setAttribute("labels",t.join(","))}get data(){return this._dataInput}set data(t){this._dataInput=t?structuredClone(t):null,this._scheduleSync()}get options(){return this._optionsOverride}set options(t){this._optionsOverride=t?structuredClone(t):null,this._renderChart()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=st,t.appendChild(e);let n=document.createElement("div");n.className="dt-chart",this._canvas=document.createElement("canvas"),this._canvas.className="dt-chart__canvas",this._status=document.createElement("div"),this._status.className="dt-chart__status",this._status.textContent="Loading chart",n.append(this._canvas,this._status),t.appendChild(n)}connectedCallback(){this._canvas.addEventListener("click",this._handleCanvasClick),this._ensureRuntime().then(()=>this._renderChart()),this._scheduleSync()}disconnectedCallback(){this._canvas.removeEventListener("click",this._handleCanvasClick),this._syncFrame!==0&&(cancelAnimationFrame(this._syncFrame),this._syncFrame=0),this._chart?.destroy(),this._chart=null,this._renderedType=null}attributeChangedCallback(){this._scheduleSync()}_handleCanvasClick=t=>{if(!this._chart)return;let n=this._chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!0)[0];if(!n)return;let i=Array.isArray(this._chart.data.labels)?this._chart.data.labels[n.index]??null:null,o=this._chart.data.datasets[n.datasetIndex],s=Array.isArray(o?.data)?o.data[n.index]:void 0;this.dispatchEvent(new CustomEvent("dt-chart-click",{bubbles:!0,composed:!0,detail:{label:i,datasetIndex:n.datasetIndex,index:n.index,value:s}}))};_scheduleSync(){this._syncFrame===0&&(this._syncFrame=requestAnimationFrame(()=>{this._syncFrame=0,this._syncFromCurrentSource()}))}_syncFromCurrentSource(){this._renderChart()}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=at().then(t=>(this._runtime=t,t))),this._loadPromise)}async _renderChart(){let t=this._dataInput;if(!t){this._setStatus("Waiting for data");return}let e=await this._ensureRuntime(),n=this._buildConfig(e,t),i=n.type;!this._chart||this._renderedType!==i?(this._chart?.destroy(),this._chart=new e.Chart(this._canvas,n),this._renderedType=i):(this._chart.data=n.data,this._chart.options=n.options,this._chart.update()),this._setStatus(t.datasets.length>0?null:"Waiting for data")}_buildConfig(t,e){let n=getComputedStyle(this),i=n.getPropertyValue("--dt-accent").trim()||"#42d4ff",o=n.getPropertyValue("--dt-text").trim()||"#d6ebff",s=n.getPropertyValue("--dt-text-muted").trim()||"#7b93a6",a=n.getPropertyValue("--dt-border").trim()||"rgba(123, 147, 166, 0.3)",d=n.getPropertyValue("--font-mono").trim()||"'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",l=Nt(i),c=this.type==="area"?"line":this.type,u={labels:e.labels??this.labels,datasets:e.datasets.map((h,gt)=>{let F=l[gt%l.length],m=h.color??b(F,1),O={label:h.label??"",data:h.data,backgroundColor:c==="line"||c==="radar"||c==="scatter"?b(F,c==="scatter"?.95:.24):m,borderColor:m,pointBackgroundColor:m,pointBorderColor:m,pointHoverBackgroundColor:m,pointRadius:this.type==="line"||this.type==="area"?3:4,pointHoverRadius:this.type==="line"||this.type==="area"?5:6,borderWidth:2,tension:c==="line"||this.type==="area"?.32:void 0,fill:this.type==="area"};return c==="pie"||c==="doughnut"?{...O,backgroundColor:Array.isArray(h.data)?h.data.map((bt,B)=>b(l[B%l.length],.86)):m,borderColor:Array.isArray(h.data)?h.data.map((bt,B)=>b(l[B%l.length],1)):m,borderWidth:1}:c==="scatter"||c==="bubble"?{...O,showLine:!1,backgroundColor:b(F,.78)}:O})},_={responsive:!0,maintainAspectRatio:!1,animation:{duration:320},interaction:{mode:"nearest",intersect:!0},plugins:{legend:{display:this.legend!=="none",position:this.legend==="none"?"top":this.legend,labels:{color:o,boxWidth:12,boxHeight:12,padding:14,font:{family:d,size:11}}},tooltip:{backgroundColor:"rgba(10, 18, 24, 0.92)",borderColor:Wt(a,i,.35),borderWidth:1,titleColor:o,bodyColor:o,footerColor:s,titleFont:{family:d,size:11},bodyFont:{family:d,size:11},padding:10}},scales:Bt(this.type)?{x:{stacked:this.stacked,grid:{display:!1,color:a},border:{color:a},ticks:{color:s,font:{family:d,size:11}}},y:{stacked:this.stacked,beginAtZero:!0,grid:{display:!1,color:a},border:{color:a},ticks:{color:s,font:{family:d,size:11}}}}:c==="radar"?{r:{angleLines:{color:a},grid:{color:a},pointLabels:{color:s,font:{family:d,size:11}},ticks:{color:s,backdropColor:"transparent",font:{family:d,size:10}}}}:void 0};return{type:c,data:u,options:lt(_,this._optionsOverride??{})}}_setStatus(t){if(!t){this._status.hidden=!0;return}this._status.hidden=!1,this._status.textContent=t}};function Wt(r,t,e){let n=W(r),i=W(t);if(!n||!i)return r;let o=f(e,0,1),s=((i.h-n.h)%360+540)%360-180;return b({h:(n.h+s*o+360)%360,s:n.s+(i.s-n.s)*o,l:n.l+(i.l-n.l)*o})}var ct=`:host {
|
|
1283
1286
|
display: block;
|
|
1284
1287
|
color: var(--dt-text);
|
|
1285
1288
|
font-family: var(--font-sans, 'Inter', sans-serif);
|
|
@@ -1453,11 +1456,11 @@ var J=`.dt-tooltip-popup {
|
|
|
1453
1456
|
}
|
|
1454
1457
|
`;var P=null;function ht(){return window.__DtMarked?Promise.resolve(window.__DtMarked):P||(P=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/marked.js",e.async=!0,e.dataset.dtMarked="true",e.onload=()=>{if(window.__DtMarked){r(window.__DtMarked);return}t(new Error("Marked runtime loaded without a __DtMarked export."))},e.onerror=()=>t(new Error("Failed to load the marked runtime bundle.")),document.head.appendChild(e)}),P)}function ut(r){return r.replaceAll(`\r
|
|
1455
1458
|
`,`
|
|
1456
|
-
`)}function
|
|
1459
|
+
`)}function Xt(r){let t=ut(r).split(`
|
|
1457
1460
|
`);for(;t.length>0&&t[0].trim()==="";)t.shift();for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();let e=t.filter(i=>i.trim()!=="").map(i=>i.match(/^\s*/)?.[0].length??0),n=e.length>0?Math.min(...e):0;return n===0?t.join(`
|
|
1458
1461
|
`):t.map(i=>i.slice(n)).join(`
|
|
1459
|
-
`)}function
|
|
1460
|
-
${n}`}var V=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtime=null;_loadPromise=null;_observer=null;_renderFrame=0;static get observedAttributes(){return["streaming","unsafe-html"]}get content(){return this._contentOverride??this._readInlineMarkdown()}set content(t){this._contentOverride=String(t??""),this._scheduleRender()}get streaming(){return this.hasAttribute("streaming")}set streaming(t){this.toggleAttribute("streaming",t)}get unsafeHtml(){return this.hasAttribute("unsafe-html")}set unsafeHtml(t){this.toggleAttribute("unsafe-html",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=ct,t.appendChild(e),this._body=document.createElement("div"),this._body.className="dt-markdown",this._body.addEventListener("click",this._onLinkClick),this._caret=document.createElement("span"),this._caret.className="dt-markdown__caret",this._caret.textContent="\u258C",this._caret.hidden=!0,t.append(this._body,this._caret)}connectedCallback(){this._observer||(this._observer=new MutationObserver(()=>{this._contentOverride===null&&this._scheduleRender()}),this._observer.observe(this,{childList:!0,characterData:!0,subtree:!0})),this._ensureRuntime(),this._scheduleRender()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._renderFrame!==0&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=0)}attributeChangedCallback(){this._scheduleRender()}_onLinkClick=t=>{let n=t.composedPath().find(i=>i instanceof HTMLAnchorElement);n&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("dt-link-click",{bubbles:!0,composed:!0,detail:{href:n.getAttribute("href")??"#"}})))};_readInlineMarkdown(){return
|
|
1462
|
+
`)}function Jt(r){let t=ut(r);if((t.match(/(^|\n)(```|~~~)/g)??[]).length%2===0)return t;let n=t.includes("~~~")&&!t.includes("```")?"~~~":"```";return`${t}
|
|
1463
|
+
${n}`}var V=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtime=null;_loadPromise=null;_observer=null;_renderFrame=0;static get observedAttributes(){return["streaming","unsafe-html"]}get content(){return this._contentOverride??this._readInlineMarkdown()}set content(t){this._contentOverride=String(t??""),this._scheduleRender()}get streaming(){return this.hasAttribute("streaming")}set streaming(t){this.toggleAttribute("streaming",t)}get unsafeHtml(){return this.hasAttribute("unsafe-html")}set unsafeHtml(t){this.toggleAttribute("unsafe-html",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=ct,t.appendChild(e),this._body=document.createElement("div"),this._body.className="dt-markdown",this._body.addEventListener("click",this._onLinkClick),this._caret=document.createElement("span"),this._caret.className="dt-markdown__caret",this._caret.textContent="\u258C",this._caret.hidden=!0,t.append(this._body,this._caret)}connectedCallback(){this._observer||(this._observer=new MutationObserver(()=>{this._contentOverride===null&&this._scheduleRender()}),this._observer.observe(this,{childList:!0,characterData:!0,subtree:!0})),this._ensureRuntime(),this._scheduleRender()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._renderFrame!==0&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=0)}attributeChangedCallback(){this._scheduleRender()}_onLinkClick=t=>{let n=t.composedPath().find(i=>i instanceof HTMLAnchorElement);n&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("dt-link-click",{bubbles:!0,composed:!0,detail:{href:n.getAttribute("href")??"#"}})))};_readInlineMarkdown(){return Xt(this.textContent??"")}_scheduleRender(){this._renderFrame===0&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=0,this._render()}))}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=ht().then(t=>(this._runtime=t,t))),this._loadPromise)}async _render(){let t=await this._ensureRuntime(),e=this.content;this.streaming&&(e=Jt(e)),this._body.innerHTML=t.render(e,{unsafeHtml:this.unsafeHtml}),this._caret.hidden=!this.streaming}};var pt=`:host {
|
|
1461
1464
|
display: block;
|
|
1462
1465
|
min-height: 240px;
|
|
1463
1466
|
color: var(--dt-text);
|
|
@@ -1729,5 +1732,5 @@ ${n}`}var V=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1729
1732
|
.milkdown .editor td {
|
|
1730
1733
|
border: 1px solid var(--dt-border);
|
|
1731
1734
|
}
|
|
1732
|
-
`;var I=null;function mt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):I||(I=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/milkdown.umd.js",e.async=!0,e.dataset.dtMilkdown="true",e.onload=()=>{if(window.__DtMilkdown){r(window.__DtMilkdown);return}t(new Error("Milkdown runtime loaded without a __DtMilkdown export."))},e.onerror=()=>t(new Error("Failed to load the Milkdown runtime bundle.")),document.head.appendChild(e)}),I)}var N=class extends HTMLElement{_shadow;_runtimeStyleAnchor;_surface;_content;_status;_runtime=null;_loadPromise=null;_editor=null;_pendingValue="";_changeTimer=null;_setupToken=0;_suppressNextChange=!1;static get observedAttributes(){return["placeholder","readonly"]}get placeholder(){return this.getAttribute("placeholder")??""}set placeholder(t){this.setAttribute("placeholder",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",t)}get value(){return this._editor&&(this._pendingValue=this._editor.getMarkdown()),this._pendingValue}set value(t){let e=String(t??"");this._pendingValue=e,this._editor&&this._runtime&&this._editor.getMarkdown()!==e&&(this._suppressNextChange=!0,this._editor.editor.action(this._runtime.replaceAll(e)))}constructor(){super();let t=this.attachShadow({mode:"open"});this._shadow=t;let e=document.createElement("style");e.textContent=pt,t.appendChild(e),this._runtimeStyleAnchor=document.createComment("runtime-styles"),t.appendChild(this._runtimeStyleAnchor),this._surface=document.createElement("div"),this._surface.className="dt-markdown-editor",this._content=document.createElement("div"),this._content.className="dt-markdown-editor__surface";let n=document.createElement("div");n.className="dt-markdown-editor__content",this._content.appendChild(n),this._status=document.createElement("div"),this._status.className="dt-markdown-editor__status",this._status.textContent="Loading editor",this._surface.append(this._content,this._status),t.appendChild(this._surface)}connectedCallback(){this._initializeEditor()}disconnectedCallback(){this._setupToken+=1,this._clearChangeTimer(),this._destroyEditor()}attributeChangedCallback(t){if(t==="readonly"){this._editor?.setReadonly(this.readonly);return}t==="placeholder"&&this.isConnected&&this._initializeEditor(!0)}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=mt().then(t=>{this._runtime=t;let e=this._runtimeStyleAnchor;for(let n of t.cssEntries){let i=document.createElement("style");i.dataset.css=n.name,i.textContent=n.css,e.parentNode.insertBefore(i,e.nextSibling)}return t})),this._loadPromise)}async _initializeEditor(t=!1){let e=++this._setupToken;if(this._setStatus("Loading editor"),t)await this._destroyEditor();else if(this._editor){this._setStatus(null);return}try{let n=await this._ensureRuntime();if(!this.isConnected||e!==this._setupToken)return;this._content.replaceChildren();let i=document.createElement("div");i.className="dt-markdown-editor__content",this._content.appendChild(i);let o=new n.Crepe({root:i,defaultValue:this._pendingValue,features:{[n.Crepe.Feature.CodeMirror]:!1,[n.Crepe.Feature.ImageBlock]:!1,[n.Crepe.Feature.Latex]:!1},featureConfigs:{[n.Crepe.Feature.Placeholder]:{text:this.placeholder,mode:"doc"}}});if(o.on(s=>{s.markdownUpdated((a,d)=>{if(this._pendingValue=d,this._suppressNextChange){this._suppressNextChange=!1;return}this._queueChange(d)}),s.focus(()=>{this.dispatchEvent(new CustomEvent("dt-focus",{bubbles:!0,composed:!0}))}),s.blur(()=>{this.dispatchEvent(new CustomEvent("dt-blur",{bubbles:!0,composed:!0}))})}),await o.create(),!this.isConnected||e!==this._setupToken){await o.destroy();return}this._editor=o,this._editor.setReadonly(this.readonly),this._pendingValue=this._editor.getMarkdown(),this._setStatus(null)}catch{e===this._setupToken&&this._setStatus("Failed to load editor")}}async _destroyEditor(){let t=this._editor;if(this._editor=null,!!t)try{await t.destroy()}catch{}}_queueChange(t){this._clearChangeTimer(),this._changeTimer=setTimeout(()=>{this._changeTimer=null,this.dispatchEvent(new CustomEvent("dt-change",{bubbles:!0,composed:!0,detail:{value:t}}))},300)}_clearChangeTimer(){this._changeTimer&&(clearTimeout(this._changeTimer),this._changeTimer=null)}_setStatus(t){if(t){this._status.hidden=!1,this._status.textContent=t;return}this._status.hidden=!0}};customElements.get("dt-tooltip")||customElements.define("dt-tooltip",
|
|
1735
|
+
`;var I=null;function mt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):I||(I=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/milkdown.umd.js",e.async=!0,e.dataset.dtMilkdown="true",e.onload=()=>{if(window.__DtMilkdown){r(window.__DtMilkdown);return}t(new Error("Milkdown runtime loaded without a __DtMilkdown export."))},e.onerror=()=>t(new Error("Failed to load the Milkdown runtime bundle.")),document.head.appendChild(e)}),I)}var N=class extends HTMLElement{_shadow;_runtimeStyleAnchor;_surface;_content;_status;_runtime=null;_loadPromise=null;_editor=null;_pendingValue="";_changeTimer=null;_setupToken=0;_suppressNextChange=!1;static get observedAttributes(){return["placeholder","readonly"]}get placeholder(){return this.getAttribute("placeholder")??""}set placeholder(t){this.setAttribute("placeholder",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",t)}get value(){return this._editor&&(this._pendingValue=this._editor.getMarkdown()),this._pendingValue}set value(t){let e=String(t??"");this._pendingValue=e,this._editor&&this._runtime&&this._editor.getMarkdown()!==e&&(this._suppressNextChange=!0,this._editor.editor.action(this._runtime.replaceAll(e)))}constructor(){super();let t=this.attachShadow({mode:"open"});this._shadow=t;let e=document.createElement("style");e.textContent=pt,t.appendChild(e),this._runtimeStyleAnchor=document.createComment("runtime-styles"),t.appendChild(this._runtimeStyleAnchor),this._surface=document.createElement("div"),this._surface.className="dt-markdown-editor",this._content=document.createElement("div"),this._content.className="dt-markdown-editor__surface";let n=document.createElement("div");n.className="dt-markdown-editor__content",this._content.appendChild(n),this._status=document.createElement("div"),this._status.className="dt-markdown-editor__status",this._status.textContent="Loading editor",this._surface.append(this._content,this._status),t.appendChild(this._surface)}connectedCallback(){this._initializeEditor()}disconnectedCallback(){this._setupToken+=1,this._clearChangeTimer(),this._destroyEditor()}attributeChangedCallback(t){if(t==="readonly"){this._editor?.setReadonly(this.readonly);return}t==="placeholder"&&this.isConnected&&this._initializeEditor(!0)}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=mt().then(t=>{this._runtime=t;let e=this._runtimeStyleAnchor;for(let n of t.cssEntries){let i=document.createElement("style");i.dataset.css=n.name,i.textContent=n.css,e.parentNode.insertBefore(i,e.nextSibling)}return t})),this._loadPromise)}async _initializeEditor(t=!1){let e=++this._setupToken;if(this._setStatus("Loading editor"),t)await this._destroyEditor();else if(this._editor){this._setStatus(null);return}try{let n=await this._ensureRuntime();if(!this.isConnected||e!==this._setupToken)return;this._content.replaceChildren();let i=document.createElement("div");i.className="dt-markdown-editor__content",this._content.appendChild(i);let o=new n.Crepe({root:i,defaultValue:this._pendingValue,features:{[n.Crepe.Feature.CodeMirror]:!1,[n.Crepe.Feature.ImageBlock]:!1,[n.Crepe.Feature.Latex]:!1},featureConfigs:{[n.Crepe.Feature.Placeholder]:{text:this.placeholder,mode:"doc"}}});if(o.on(s=>{s.markdownUpdated((a,d)=>{if(this._pendingValue=d,this._suppressNextChange){this._suppressNextChange=!1;return}this._queueChange(d)}),s.focus(()=>{this.dispatchEvent(new CustomEvent("dt-focus",{bubbles:!0,composed:!0}))}),s.blur(()=>{this.dispatchEvent(new CustomEvent("dt-blur",{bubbles:!0,composed:!0}))})}),await o.create(),!this.isConnected||e!==this._setupToken){await o.destroy();return}this._editor=o,this._editor.setReadonly(this.readonly),this._pendingValue=this._editor.getMarkdown(),this._setStatus(null)}catch{e===this._setupToken&&this._setStatus("Failed to load editor")}}async _destroyEditor(){let t=this._editor;if(this._editor=null,!!t)try{await t.destroy()}catch{}}_queueChange(t){this._clearChangeTimer(),this._changeTimer=setTimeout(()=>{this._changeTimer=null,this.dispatchEvent(new CustomEvent("dt-change",{bubbles:!0,composed:!0,detail:{value:t}}))},300)}_clearChangeTimer(){this._changeTimer&&(clearTimeout(this._changeTimer),this._changeTimer=null)}_setStatus(t){if(t){this._status.hidden=!1,this._status.textContent=t;return}this._status.hidden=!0}};customElements.get("dt-tooltip")||customElements.define("dt-tooltip",w);customElements.get("dt-card")||customElements.define("dt-card",x);customElements.get("dt-select")||customElements.define("dt-select",y);customElements.get("dt-grid")||customElements.define("dt-grid",k);customElements.get("dt-stack")||customElements.define("dt-stack",C);customElements.get("dt-stat")||customElements.define("dt-stat",E);customElements.get("dt-badge")||customElements.define("dt-badge",S);customElements.get("dt-button")||customElements.define("dt-button",D);customElements.get("dt-divider")||customElements.define("dt-divider",A);customElements.get("dt-list-view")||customElements.define("dt-list-view",T);customElements.get("dt-table-view")||customElements.define("dt-table-view",z);customElements.get("dt-column")||customElements.define("dt-column",v);customElements.get("dt-chart")||customElements.define("dt-chart",R);customElements.get("dt-markdown")||customElements.define("dt-markdown",V);customElements.get("dt-markdown-editor")||customElements.define("dt-markdown-editor",N);export{S as DtBadge,D as DtButton,x as DtCard,R as DtChart,v as DtColumn,A as DtDivider,k as DtGrid,T as DtListView,V as DtMarkdown,N as DtMarkdownEditor,y as DtSelect,C as DtStack,E as DtStat,z as DtTableView,w as DtTooltip};
|
|
1733
1736
|
//# sourceMappingURL=index.js.map
|