@desktalk/ui 0.1.0-alpha.2 → 0.1.0
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 +71 -19
- package/dist/desktalk-ui.js.map +3 -3
- package/dist/dt-button.d.ts.map +1 -1
- package/dist/dt-markdown-editor.d.ts +2 -1
- package/dist/dt-markdown-editor.d.ts.map +1 -1
- package/dist/index.js +70 -18
- package/dist/index.js.map +3 -3
- package/dist/lib/milkdown-loader.d.ts +5 -0
- package/dist/lib/milkdown-loader.d.ts.map +1 -1
- package/dist/milkdown.umd.js +269 -87
- package/dist/milkdown.umd.js.map +3 -3
- package/package.json +1 -1
package/dist/desktalk-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var DeskTalkUI=(()=>{var $=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)$(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _t(t))!xt.call(r,i)&&i!==e&&$(r,i,{get:()=>t[i],enumerable:!(n=ft(t,i))||n.enumerable});return r};var kt=r=>yt($({},"__esModule",{value:!0}),r);var Qt={};wt(Qt,{DtBadge:()=>k,DtButton:()=>C,DtCard:()=>f,DtChart:()=>M,DtColumn:()=>g,DtDivider:()=>E,DtGrid:()=>x,DtListView:()=>D,DtMarkdown:()=>
|
|
1
|
+
"use strict";var DeskTalkUI=(()=>{var $=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)$(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _t(t))!xt.call(r,i)&&i!==e&&$(r,i,{get:()=>t[i],enumerable:!(n=ft(t,i))||n.enumerable});return r};var kt=r=>yt($({},"__esModule",{value:!0}),r);var Qt={};wt(Qt,{DtBadge:()=>k,DtButton:()=>C,DtCard:()=>f,DtChart:()=>M,DtColumn:()=>g,DtDivider:()=>E,DtGrid:()=>x,DtListView:()=>D,DtMarkdown:()=>z,DtMarkdownEditor:()=>T,DtSelect:()=>_,DtStack:()=>w,DtStat:()=>y,DtTableView:()=>S,DtTooltip:()=>v});var W=`.dt-tooltip-popup {
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 2147483647;
|
|
4
4
|
padding: 6px 10px;
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
border-top: none;
|
|
108
108
|
border-bottom: none;
|
|
109
109
|
}
|
|
110
|
-
`;var Ct="dt-tooltip-popup",u=8,G=!1;function Et(){if(G)return;let r=document.createElement("style");r.setAttribute("data-dt-tooltip",""),r.textContent=W,document.head.appendChild(r),G=!0}var v=class extends HTMLElement{_popup=null;_showTimeout=null;_tooltipId="";_visible=!1;static get observedAttributes(){return["content","placement","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 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(){Et(),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=Ct,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,
|
|
110
|
+
`;var Ct="dt-tooltip-popup",u=8,G=!1;function Et(){if(G)return;let r=document.createElement("style");r.setAttribute("data-dt-tooltip",""),r.textContent=W,document.head.appendChild(r),G=!0}var v=class extends HTMLElement{_popup=null;_showTimeout=null;_tooltipId="";_visible=!1;static get observedAttributes(){return["content","placement","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 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(){Et(),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=Ct,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=this.placement;s==="top"&&e.top-n.height-u<0?s="bottom":s==="bottom"&&e.bottom+n.height+u>o?s="top":s==="left"&&e.left-n.width-u<0?s="right":s==="right"&&e.right+n.width+u>i&&(s="left"),t.setAttribute("data-actual-placement",s);let a,d;switch(s){case"top":d=e.left+e.width/2,a=e.top-n.height-u;break;case"bottom":d=e.left+e.width/2,a=e.bottom+u;break;case"left":d=e.left-n.width-u,a=e.top+e.height/2;break;case"right":d=e.right+u,a=e.top+e.height/2;break}t.style.left=`${d}px`,t.style.top=`${a}px`}};var j=`:host {
|
|
111
111
|
display: block;
|
|
112
112
|
margin-bottom: 12px;
|
|
113
113
|
}
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
.dt-select-trigger[aria-expanded='true'] .dt-select-chevron {
|
|
357
357
|
transform: rotate(180deg);
|
|
358
358
|
}
|
|
359
|
-
`;var Dt="dt-select-trigger",U="dt-select-label",At="dt-select-chevron",Mt="dt-select-menu",
|
|
359
|
+
`;var Dt="dt-select-trigger",U="dt-select-label",At="dt-select-chevron",Mt="dt-select-menu",zt="dt-select-option",Tt="dt-select-option--active",Y=!1;function Lt(){if(Y)return;let r=document.createElement("style");r.setAttribute("data-dt-select",""),r.textContent=q,document.head.appendChild(r),Y=!0}var _=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=K,t.appendChild(e);let n=document.createElement("button");n.type="button",n.className=Dt,n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-expanded","false");let i=document.createElement("span");i.className=U,n.appendChild(i);let o=document.createElement("span");o.className=At,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(){Lt(),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(`.${U}`),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=Mt,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)})}_close(){if(this._open){if(document.removeEventListener("mousedown",this._onOutsideClick),document.removeEventListener("keydown",this._onKeyDown),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()};_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=zt,n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e.value===this.value)),e.value===this.value&&n.classList.add(Tt);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 Z=`:host {
|
|
360
360
|
display: block;
|
|
361
361
|
margin-bottom: 12px;
|
|
362
362
|
}
|
|
@@ -619,7 +619,7 @@
|
|
|
619
619
|
.dt-stat-inner .trend.neutral {
|
|
620
620
|
color: var(--dt-text-muted);
|
|
621
621
|
}
|
|
622
|
-
`;var
|
|
622
|
+
`;var Pt="dt-stat-inner",y=class extends HTMLElement{static get observedAttributes(){return["label","value","description","size","variant","trend","trend-value"]}_container;_labelEl;_valueEl;_descEl;_trendEl;get label(){return this.getAttribute("label")}set label(t){t===null?this.removeAttribute("label"):this.setAttribute("label",t)}get value(){return this.getAttribute("value")}set value(t){t===null?this.removeAttribute("value"):this.setAttribute("value",t)}get description(){return this.getAttribute("description")}set description(t){t===null?this.removeAttribute("description"):this.setAttribute("description",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}get trend(){let t=this.getAttribute("trend");return t==="up"||t==="down"||t==="neutral"?t:null}set trend(t){t===null?this.removeAttribute("trend"):this.setAttribute("trend",t)}get trendValue(){return this.getAttribute("trend-value")}set trendValue(t){t===null?this.removeAttribute("trend-value"):this.setAttribute("trend-value",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=tt,t.appendChild(e),this._container=document.createElement("div"),this._container.className=Pt,this._labelEl=document.createElement("div"),this._labelEl.className="label",this._container.appendChild(this._labelEl),this._valueEl=document.createElement("div"),this._valueEl.className="value",this._container.appendChild(this._valueEl),this._descEl=document.createElement("div"),this._descEl.className="description",this._container.appendChild(this._descEl),this._trendEl=document.createElement("div"),this._trendEl.className="trend",this._container.appendChild(this._trendEl),t.appendChild(this._container),this._render()}attributeChangedCallback(t,e,n){(t==="label"||t==="value"||t==="description"||t==="size"||t==="variant"||t==="trend"||t==="trend-value")&&this._render()}_render(){this._labelEl.textContent=this.label??"",this._labelEl.style.display=this.label?"block":"none",this._valueEl.textContent=this.value??"",this._valueEl.style.display=this.value?"block":"none",this._descEl.textContent=this.description??"",this._descEl.style.display=this.description?"block":"none";let t=this.trend,e=this.trendValue;if(t&&e){this._trendEl.style.display="inline-flex",this._trendEl.className=`trend ${t==="up"?"positive":t==="down"?"negative":"neutral"}`;let n="";t==="up"?n="\u2191":t==="down"?n="\u2193":n="\u2192",this._trendEl.textContent=`${n} ${e}`}else this._trendEl.style.display="none"}};var et=`:host {
|
|
623
623
|
display: inline-flex;
|
|
624
624
|
vertical-align: middle;
|
|
625
625
|
}
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
padding: 3px 8px;
|
|
702
702
|
font-size: 0.75rem;
|
|
703
703
|
}
|
|
704
|
-
`;var
|
|
704
|
+
`;var Vt="dt-badge-inner",k=class extends HTMLElement{static get observedAttributes(){return["variant","size","text"]}_container;_slot;get variant(){let t=this.getAttribute("variant");return t==="success"||t==="danger"||t==="warning"||t==="info"||t==="default"||t==="neutral"?t:"accent"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get text(){return this.getAttribute("text")}set text(t){t===null?this.removeAttribute("text"):this.setAttribute("text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=et,t.appendChild(e),this._container=document.createElement("span"),this._container.className=Vt;let n=this.text;n!==null?this._container.textContent=n:(this._slot=document.createElement("slot"),this._container.appendChild(this._slot)),t.appendChild(this._container)}attributeChangedCallback(t,e,n){t==="text"&&this._render()}_render(){let t=this.text;t!==null&&(this._container.textContent=t)}};var nt=`:host {
|
|
705
705
|
display: inline-flex;
|
|
706
706
|
vertical-align: middle;
|
|
707
707
|
}
|
|
@@ -860,7 +860,7 @@
|
|
|
860
860
|
width: 1em;
|
|
861
861
|
height: 1em;
|
|
862
862
|
}
|
|
863
|
-
`;var It="dt-button-inner",C=class extends HTMLElement{static get observedAttributes(){return["variant","size","disabled","fullwidth","type"]}_button;_slot;get variant(){let t=this.getAttribute("variant");return t==="secondary"||t==="ghost"||t==="danger"?t:"primary"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get fullwidth(){return this.hasAttribute("fullwidth")}set fullwidth(t){t?this.setAttribute("fullwidth",""):this.removeAttribute("fullwidth")}get type(){let t=this.getAttribute("type");return t==="submit"||t==="reset"?t:"button"}set type(t){this.setAttribute("type",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=nt,t.appendChild(e),this._button=document.createElement("button"),this._button.className=It,this._button.type=this.type,this._button.disabled=this.disabled,this._slot=document.createElement("slot"),this._button.appendChild(this._slot),t.appendChild(this._button)}attributeChangedCallback(t,e,n){switch(t){case"disabled":this._button.disabled=this.disabled;break;case"type":this._button.type=this.type;break}}};var rt=`:host {
|
|
863
|
+
`;var It="dt-button-inner",C=class extends HTMLElement{static get observedAttributes(){return["variant","size","disabled","fullwidth","type"]}_button;_slot;get variant(){let t=this.getAttribute("variant");return t==="secondary"||t==="ghost"||t==="danger"?t:"primary"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get fullwidth(){return this.hasAttribute("fullwidth")}set fullwidth(t){t?this.setAttribute("fullwidth",""):this.removeAttribute("fullwidth")}get type(){let t=this.getAttribute("type");return t==="submit"||t==="reset"?t:"button"}set type(t){this.setAttribute("type",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=nt,t.appendChild(e),this._button=document.createElement("button"),this._button.className=It,this._button.type=this.type,this._button.disabled=this.disabled,this._slot=document.createElement("slot"),this._button.appendChild(this._slot),this._button.addEventListener("click",()=>{if(this.type==="submit"&&!this.disabled){let n=this.closest("form");n&&n.requestSubmit()}}),t.appendChild(this._button)}attributeChangedCallback(t,e,n){switch(t){case"disabled":this._button.disabled=this.disabled;break;case"type":this._button.type=this.type;break}}};var rt=`:host {
|
|
864
864
|
display: block;
|
|
865
865
|
}
|
|
866
866
|
|
|
@@ -1093,7 +1093,7 @@
|
|
|
1093
1093
|
letter-spacing: 0.08em;
|
|
1094
1094
|
font-size: 0.75rem;
|
|
1095
1095
|
}
|
|
1096
|
-
`;function Ft(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ot(r,t){let e=r.querySelectorAll("*");for(let n of e){let i=n.getAttribute("data-field");if(i){let
|
|
1096
|
+
`;function Ft(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ot(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=Ft(t[a]);d===null?n.removeAttribute(s):n.setAttribute(s,d)}}}function R(r,t){let e=r.content.cloneNode(!0);return Ot(e,t),e}var m=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)),c=Math.max(0,Math.floor(this._scrollTop/this._fixedSize)-this._overscan),l=Math.min(this._count,c+d+this._overscan*2),L=c*this._fixedSize,H=this._count*this._fixedSize,h=Math.max(0,H-L-(l-c)*this._fixedSize);return{start:c,end:l,paddingTop:L,paddingBottom:h,totalHeight:H}}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 Bt(r){return r&&typeof r=="object"?r:{value:r}}function $t(r){return r==="center"||r==="right"?r:"left"}var g=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 $t(this.getAttribute("align"))}connectedCallback(){this.hidden=!0}attributeChangedCallback(){this.dispatchEvent(new CustomEvent("dt-column-change",{bubbles:!0,composed:!0}))}},S=class extends HTMLElement{_rows=[];_columns=[];_virtualizer=new m({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=it,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 g).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=Bt(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(R(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 ot=`:host {
|
|
1097
1097
|
display: block;
|
|
1098
1098
|
min-height: 120px;
|
|
1099
1099
|
color: var(--dt-text);
|
|
@@ -1192,7 +1192,7 @@
|
|
|
1192
1192
|
letter-spacing: 0.08em;
|
|
1193
1193
|
font-size: 0.75rem;
|
|
1194
1194
|
}
|
|
1195
|
-
`;var
|
|
1195
|
+
`;var st=56;function Xt(r){return r&&typeof r=="object"?r:{value:r}}var D=class extends HTMLElement{_items=[];_selectedIndices=new Set;_renderItem=null;_virtualizer=new m({estimateSize:st,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=ot,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??st),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(R(i,Xt(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 at=`:host {
|
|
1196
1196
|
display: block;
|
|
1197
1197
|
min-height: 220px;
|
|
1198
1198
|
color: var(--dt-text);
|
|
@@ -1279,7 +1279,7 @@
|
|
|
1279
1279
|
.dt-chart__status[hidden] {
|
|
1280
1280
|
display: none;
|
|
1281
1281
|
}
|
|
1282
|
-
`;var
|
|
1282
|
+
`;var P=null;function dt(){return window.__DtChart?Promise.resolve(window.__DtChart):P||(P=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)}),P)}function A(r,t,e){return Math.min(e,Math.max(t,r))}function Jt(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function J(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(c=>`${c}${c}`).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 lt(s,a,d)}let e=r.trim().match(/^rgba?\((\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)(?:[,/\s]+[\d.]+)?\)$/i);if(e)return lt(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:A(Number(n[2]),0,100),l:A(Number(n[3]),0,100)}:null}function lt(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 Wt(r){let t=J(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:A(t.s-i*2,55,90),l:A(t.l+(i%2===0?0:6)-i,38,66)}))}function V(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function ct(r,t){if(!V(r)||!V(t))return t??r;let e={...r};for(let[n,i]of Object.entries(t)){let o=e[n];e[n]=V(o)&&V(i)?ct(o,i):i}return e}function Gt(r){return r==="top"||r==="bottom"||r==="left"||r==="right"?r:"none"}function jt(r){return r==="bar"||r==="line"||r==="area"||r==="pie"||r==="doughnut"||r==="radar"||r==="scatter"||r==="bubble"?r:"bar"}function qt(r){return r==="bar"||r==="line"||r==="area"||r==="scatter"||r==="bubble"}function Kt(r){return r.map(t=>t.trim()).filter(Boolean)}var M=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 jt(this.getAttribute("type"))}set type(t){this.setAttribute("type",t)}get legend(){return Gt(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 Kt(Jt(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=at,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=dt().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",c=Wt(i),l=this.type==="area"?"line":this.type,L={labels:e.labels??this.labels,datasets:e.datasets.map((h,bt)=>{let F=c[bt%c.length],p=h.color??b(F,1),O={label:h.label??"",data:h.data,backgroundColor:l==="line"||l==="radar"||l==="scatter"?b(F,l==="scatter"?.95:.24):p,borderColor:p,pointBackgroundColor:p,pointBorderColor:p,pointHoverBackgroundColor:p,pointRadius:this.type==="line"||this.type==="area"?3:4,pointHoverRadius:this.type==="line"||this.type==="area"?5:6,borderWidth:2,tension:l==="line"||this.type==="area"?.32:void 0,fill:this.type==="area"};return l==="pie"||l==="doughnut"?{...O,backgroundColor:Array.isArray(h.data)?h.data.map((vt,B)=>b(c[B%c.length],.86)):p,borderColor:Array.isArray(h.data)?h.data.map((vt,B)=>b(c[B%c.length],1)):p,borderWidth:1}:l==="scatter"||l==="bubble"?{...O,showLine:!1,backgroundColor:b(F,.78)}:O})},H={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:Ut(a,i,.35),borderWidth:1,titleColor:o,bodyColor:o,footerColor:s,titleFont:{family:d,size:11},bodyFont:{family:d,size:11},padding:10}},scales:qt(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}}}}:l==="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:l,data:L,options:ct(H,this._optionsOverride??{})}}_setStatus(t){if(!t){this._status.hidden=!0;return}this._status.hidden=!1,this._status.textContent=t}};function Ut(r,t,e){let n=J(r),i=J(t);if(!n||!i)return r;let o=A(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 ht=`:host {
|
|
1283
1283
|
display: block;
|
|
1284
1284
|
color: var(--dt-text);
|
|
1285
1285
|
font-family: var(--font-sans, 'Inter', sans-serif);
|
|
@@ -1457,7 +1457,7 @@
|
|
|
1457
1457
|
`);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
1458
|
`):t.map(i=>i.slice(n)).join(`
|
|
1459
1459
|
`)}function Zt(r){let t=pt(r);if((t.match(/(^|\n)(```|~~~)/g)??[]).length%2===0)return t;let n=t.includes("~~~")&&!t.includes("```")?"~~~":"```";return`${t}
|
|
1460
|
-
${n}`}var
|
|
1460
|
+
${n}`}var z=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=ht,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 Yt(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=ut().then(t=>(this._runtime=t,t))),this._loadPromise)}async _render(){let t=await this._ensureRuntime(),e=this.content;this.streaming&&(e=Zt(e)),this._body.innerHTML=t.render(e,{unsafeHtml:this.unsafeHtml}),this._caret.hidden=!this.streaming}};var mt=`:host {
|
|
1461
1461
|
display: block;
|
|
1462
1462
|
min-height: 240px;
|
|
1463
1463
|
color: var(--dt-text);
|
|
@@ -1564,6 +1564,34 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1564
1564
|
color: var(--dt-text);
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
|
+
.milkdown .ProseMirror.editor {
|
|
1568
|
+
padding: 0px 54px;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
.milkdown .ProseMirror.editor h1 {
|
|
1572
|
+
font-size: 36px;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
.milkdown .ProseMirror.editor h2 {
|
|
1576
|
+
font-size: 30px;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
.milkdown .ProseMirror.editor h3 {
|
|
1580
|
+
font-size: 24px;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
.milkdown .ProseMirror.editor h4 {
|
|
1584
|
+
font-size: 20px;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
.milkdown .ProseMirror.editor h5 {
|
|
1588
|
+
font-size: 16px;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
.milkdown .ProseMirror.editor h6 {
|
|
1592
|
+
font-size: 16px;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1567
1595
|
.milkdown .editor {
|
|
1568
1596
|
min-height: 100%;
|
|
1569
1597
|
padding: 16px 18px 20px;
|
|
@@ -1574,10 +1602,6 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1574
1602
|
line-height: 1.7;
|
|
1575
1603
|
}
|
|
1576
1604
|
|
|
1577
|
-
.milkdown .editor > :first-child {
|
|
1578
|
-
margin-top: 0;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
1605
|
.milkdown .editor h1,
|
|
1582
1606
|
.milkdown .editor h2,
|
|
1583
1607
|
.milkdown .editor h3,
|
|
@@ -1603,10 +1627,6 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1603
1627
|
font-size: 1.08rem;
|
|
1604
1628
|
}
|
|
1605
1629
|
|
|
1606
|
-
.milkdown .editor p {
|
|
1607
|
-
margin: 0.65em 0;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
1630
|
.milkdown .editor code {
|
|
1611
1631
|
padding: 2px 5px;
|
|
1612
1632
|
border-radius: 2px;
|
|
@@ -1663,6 +1683,38 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1663
1683
|
padding-left: 1.5rem;
|
|
1664
1684
|
}
|
|
1665
1685
|
|
|
1686
|
+
/* Runtime Milkdown styles are injected after this file, so use scoped CSS
|
|
1687
|
+
variables instead of direct property overrides. */
|
|
1688
|
+
.milkdown .milkdown-list-item-block {
|
|
1689
|
+
--crepe-color-outline: var(--dt-text-secondary);
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
.milkdown .milkdown-block-handle {
|
|
1693
|
+
--crepe-color-outline: var(--dt-text-muted);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
.milkdown .milkdown-block-handle .operation-item:hover {
|
|
1697
|
+
--crepe-color-outline: var(--dt-text-secondary);
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
.milkdown .milkdown-toolbar {
|
|
1701
|
+
--crepe-color-outline: var(--dt-text-muted);
|
|
1702
|
+
--crepe-color-hover: color-mix(
|
|
1703
|
+
in srgb,
|
|
1704
|
+
var(--dt-surface-hover) 88%,
|
|
1705
|
+
var(--dt-text-secondary) 12%
|
|
1706
|
+
);
|
|
1707
|
+
--crepe-color-selected: color-mix(in srgb, var(--dt-surface-active) 74%, var(--dt-accent) 26%);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
.milkdown .milkdown-toolbar .toolbar-item:hover {
|
|
1711
|
+
--crepe-color-outline: var(--dt-text-secondary);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
.milkdown .milkdown-toolbar .toolbar-item.active {
|
|
1715
|
+
--crepe-color-primary: var(--dt-accent);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1666
1718
|
.milkdown .editor img {
|
|
1667
1719
|
max-width: 100%;
|
|
1668
1720
|
border-radius: 2px;
|
|
@@ -1677,5 +1729,5 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
|
|
|
1677
1729
|
.milkdown .editor td {
|
|
1678
1730
|
border: 1px solid var(--dt-border);
|
|
1679
1731
|
}
|
|
1680
|
-
`;var N=null;function gt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):N||(N=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)}),N)}var
|
|
1732
|
+
`;var N=null;function gt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):N||(N=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)}),N)}var T=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=mt,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=gt().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",v);customElements.get("dt-card")||customElements.define("dt-card",f);customElements.get("dt-select")||customElements.define("dt-select",_);customElements.get("dt-grid")||customElements.define("dt-grid",x);customElements.get("dt-stack")||customElements.define("dt-stack",w);customElements.get("dt-stat")||customElements.define("dt-stat",y);customElements.get("dt-badge")||customElements.define("dt-badge",k);customElements.get("dt-button")||customElements.define("dt-button",C);customElements.get("dt-divider")||customElements.define("dt-divider",E);customElements.get("dt-list-view")||customElements.define("dt-list-view",D);customElements.get("dt-table-view")||customElements.define("dt-table-view",S);customElements.get("dt-column")||customElements.define("dt-column",g);customElements.get("dt-chart")||customElements.define("dt-chart",M);customElements.get("dt-markdown")||customElements.define("dt-markdown",z);customElements.get("dt-markdown-editor")||customElements.define("dt-markdown-editor",T);return kt(Qt);})();
|
|
1681
1733
|
//# sourceMappingURL=desktalk-ui.js.map
|