nish-ui 1.7.0 → 1.9.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/README.md +15 -1
- package/dist/chart.js.map +1 -1
- package/dist/elements-charts.d.ts +53 -0
- package/dist/elements-charts.js +132 -0
- package/dist/elements-charts.js.map +1 -0
- package/dist/elements-data.d.ts +95 -0
- package/dist/elements-data.js +47 -0
- package/dist/elements-data.js.map +1 -0
- package/dist/elements-forms.d.ts +147 -0
- package/dist/elements-forms.js +92 -0
- package/dist/elements-forms.js.map +1 -0
- package/dist/elements.js +3 -3
- package/dist/elements.js.map +1 -1
- package/dist/files.json +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +54 -27
- package/dist/index.js.map +1 -1
- package/dist/nish-components.css +2598 -176
- package/dist/system-canvas.js.map +1 -1
- package/dist/theme.d.ts +3 -0
- package/dist/theme.global.js +16 -4
- package/dist/theme.global.js.map +1 -1
- package/dist/theme.js +13 -1
- package/dist/theme.js.map +1 -1
- package/package.json +30 -2
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
var ct=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var O=function(i,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},x=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ee,Ee,xe,re,He,oe,we,Y,ae,z,Ae,ut;var v={__proto__:null};v.enumerable=!0;Object.freeze(v);var Be=(z=class{constructor(e,t={}){if(ee.set(this,!1),Ee.set(this,!1),xe.set(this,!1),re.set(this,!1),He.set(this,Date.now()),oe.set(this,!1),we.set(this,void 0),Y.set(this,void 0),ae.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:n,cancelable:s,composed:r}=t;O(this,ee,!!s,"f"),O(this,Ee,!!n,"f"),O(this,xe,!!r,"f"),O(this,we,`${e}`,"f"),O(this,Y,null,"f"),O(this,ae,!1,"f")}initEvent(e,t,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){O(this,re,!0,"f")}get target(){return x(this,Y,"f")}get currentTarget(){return x(this,Y,"f")}get srcElement(){return x(this,Y,"f")}get type(){return x(this,we,"f")}get cancelable(){return x(this,ee,"f")}get defaultPrevented(){return x(this,ee,"f")&&x(this,re,"f")}get timeStamp(){return x(this,He,"f")}composedPath(){return x(this,ae,"f")?[x(this,Y,"f")]:[]}get returnValue(){return!x(this,ee,"f")||!x(this,re,"f")}get bubbles(){return x(this,Ee,"f")}get composed(){return x(this,xe,"f")}get eventPhase(){return x(this,ae,"f")?z.AT_TARGET:z.NONE}get cancelBubble(){return x(this,oe,"f")}set cancelBubble(e){e&&O(this,oe,!0,"f")}stopPropagation(){O(this,oe,!0,"f")}get isTrusted(){return!1}},ee=new WeakMap,Ee=new WeakMap,xe=new WeakMap,re=new WeakMap,He=new WeakMap,oe=new WeakMap,we=new WeakMap,Y=new WeakMap,ae=new WeakMap,z.NONE=0,z.CAPTURING_PHASE=1,z.AT_TARGET=2,z.BUBBLING_PHASE=3,z);Object.defineProperties(Be.prototype,{initEvent:v,stopImmediatePropagation:v,preventDefault:v,target:v,currentTarget:v,srcElement:v,type:v,cancelable:v,defaultPrevented:v,timeStamp:v,composedPath:v,returnValue:v,bubbles:v,composed:v,eventPhase:v,cancelBubble:v,stopPropagation:v,isTrusted:v});var dt=(ut=class extends Be{constructor(e,t={}){super(e,t),Ae.set(this,void 0),O(this,Ae,t?.detail??null,"f")}initCustomEvent(e,t,n,s){throw new Error("Method not implemented.")}get detail(){return x(this,Ae,"f")}},Ae=new WeakMap,ut);Object.defineProperties(dt.prototype,{detail:v});var I=Be,Fe=dt;var R;var Dn=(R=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},R.STYLE_RULE=1,R.CHARSET_RULE=2,R.IMPORT_RULE=3,R.MEDIA_RULE=4,R.FONT_FACE_RULE=5,R.PAGE_RULE=6,R.NAMESPACE_RULE=10,R.KEYFRAMES_RULE=7,R.KEYFRAME_RULE=8,R.SUPPORTS_RULE=12,R.COUNTER_STYLE_RULE=11,R.FONT_FEATURE_VALUES_RULE=14,R.MARGIN_RULE=9,R);globalThis.Event??=I;globalThis.CustomEvent??=Fe;var ze=Symbol(),pt=i=>typeof i=="boolean"?i:i?.capture??!1,H={__proto__:null};H.enumerable=!0;Object.freeze(H);var Re=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,n){if(t==null)return;let s=pt(n)?this.__captureEventListeners:this.__eventListeners,r=s.get(e);if(r===void 0)r=new Map,s.set(e,r);else if(r.has(t))return;let o=typeof n=="object"&&n?n:{};o.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,n)),r.set(t,o??{})}removeEventListener(e,t,n){if(t==null)return;let s=pt(n)?this.__captureEventListeners:this.__eventListeners,r=s.get(e);r!==void 0&&(r.delete(t),r.size||s.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let n=!1,s=!1,r=I.NONE,o=null,h=null,l=null,p=e.stopPropagation,m=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return o??h},...H},srcElement:{get(){return e.target},...H},currentTarget:{get(){return l},...H},eventPhase:{get(){return r},...H},composedPath:{value:()=>t,...H},stopPropagation:{value:()=>{n=!0,p.call(e)},...H},stopImmediatePropagation:{value:()=>{s=!0,m.call(e)},...H}});let c=(g,y,M)=>{typeof g=="function"?g(e):typeof g?.handleEvent=="function"&&g.handleEvent(e),y.once&&M.delete(g)},_=()=>(l=null,r=I.NONE,!e.defaultPrevented),b=t.slice().reverse();o=!this.__host||!e.composed?this:null;let A=g=>{for(h=this;h.__host&&g.includes(h.__host);)h=h.__host};for(let g of b){!o&&(!h||h===g.__host)&&A(b.slice(b.indexOf(g))),l=g,r=g===e.target?I.AT_TARGET:I.CAPTURING_PHASE;let y=g.__captureEventListeners.get(e.type);if(y){for(let[M,P]of y)if(c(M,P,y),s)return _()}if(n)return _()}let S=e.bubbles?t:[this];h=null;for(let g of S){!o&&(!h||g===h.__host)&&A(S.slice(0,S.indexOf(g)+1)),l=g,r=g===e.target?I.AT_TARGET:I.BUBBLING_PHASE;let y=g.__eventListeners.get(e.type);if(y){for(let[M,P]of y)if(c(M,P,y),s)return _()}if(n)return _()}return _()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,gt,un]}};var mt=new WeakMap,le=i=>{let e=mt.get(i);return e===void 0&&mt.set(i,e=new Map),e},he=class extends Re{getRootNode(e){return e?.composed?We:this.__host?.__shadowRoot??We}};var ft=class extends he{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var gt=new ft,We=gt;var _t=class extends he{constructor(e){if(super(),e!==ze)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Te,customElements:Ve,document:We,Document:ft,Element:bt,EventTarget:Re,HTMLElement:yt,Node:he,ShadowRoot:vt,window:this,Window:_t})}};var bt=class extends he{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(le(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){le(this).set(e,String(t))}removeAttribute(e){le(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return le(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new vt(ze,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new ct(this);return this.__internals=e,e}getAttribute(e){return le(this).get(e)??null}};var yt=class extends bt{},je=yt;var vt=class extends he{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new je,"localName",{get(){return"lit-server-root"}});function hn(){let i,e;return{promise:new Promise((n,s)=>{i=n,e=s}),resolve:i,reject:e}}var Te=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let n=this.__pendingWhenDefineds.get(e);return n||(n=hn(),this.__pendingWhenDefineds.set(e,n)),n.promise}},cn=Te;var Ve=new cn,un=new _t(ze);var ce=globalThis,Ce=ce.ShadowRoot&&(ce.ShadyCSS===void 0||ce.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,St=Symbol(),$t=new WeakMap,Me=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==St)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ce&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=$t.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&$t.set(t,e))}return e}toString(){return this.cssText}},Et=i=>new Me(typeof i=="string"?i:i+"",void 0,St);var xt=(i,e)=>{if(Ce)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),s=ce.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=t.cssText,i.appendChild(n)}},Ge=Ce||ce.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Et(t)})(i):i;var{is:dn,defineProperty:pn,getOwnPropertyDescriptor:mn,getOwnPropertyNames:fn,getOwnPropertySymbols:gn,getPrototypeOf:_n}=Object,de=globalThis;de.customElements??=Ve;var wt=de.trustedTypes,bn=wt?wt.emptyScript:"",yn=de.reactiveElementPolyfillSupport,ue=(i,e)=>i,Ke={toAttribute(i,e){switch(e){case Boolean:i=i?bn:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Rt=(i,e)=>!dn(i,e),At={attribute:!0,type:String,converter:Ke,reflect:!1,useDefault:!1,hasChanged:Rt};Symbol.metadata??=Symbol("metadata"),de.litPropertyMetadata??=new WeakMap;var B=class extends(globalThis.HTMLElement??je){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=At){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),s=this.getPropertyDescriptor(e,n,t);s!==void 0&&pn(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){let{get:s,set:r}=mn(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){let h=s?.call(this);r?.call(this,o),this.requestUpdate(e,h,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??At}static _$Ei(){if(this.hasOwnProperty(ue("elementProperties")))return;let e=_n(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ue("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ue("properties"))){let t=this.properties,n=[...fn(t),...gn(t)];for(let s of n)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,s]of t)this.elementProperties.set(n,s)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let s=this._$Eu(t,n);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let s of n)t.unshift(Ge(s))}else e!==void 0&&t.push(Ge(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(s!==void 0&&n.reflect===!0){let r=(n.converter?.toAttribute!==void 0?n.converter:Ke).toAttribute(t,n.type);this._$Em=e,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){let n=this.constructor,s=n._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let r=n.getPropertyOptions(s),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Ke;this._$Em=s;let h=o.fromAttribute(t,r.type);this[s]=h??this._$Ej?.get(s)??h,this._$Em=null}}requestUpdate(e,t,n,s=!1,r){if(e!==void 0){let o=this.constructor;if(s===!1&&(r=this[e]),n??=o.getPropertyOptions(e),!((n.hasChanged??Rt)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:s,wrapped:r},o){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[s,r]of n){let{wrapped:o}=r,h=this[s];o!==!0||this._$AL.has(s)||h===void 0||this.C(s,void 0,r,h)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};B.elementStyles=[],B.shadowRootOptions={mode:"open"},B[ue("elementProperties")]=new Map,B[ue("finalized")]=new Map,yn?.({ReactiveElement:B}),(de.reactiveElementVersions??=[]).push("2.1.2");var Le=globalThis,Tt=i=>i,Pe=Le.trustedTypes,Mt=Pe?Pe.createPolicy("lit-html",{createHTML:i=>i}):void 0,kt="$lit$",j=`lit$${Math.random().toFixed(9).slice(2)}$`,Ut="?"+j,vn=`<${Ut}>`,X=Le.document===void 0?{createTreeWalker:()=>({})}:document,me=()=>X.createComment(""),fe=i=>i===null||typeof i!="object"&&typeof i!="function",et=Array.isArray,$n=i=>et(i)||typeof i?.[Symbol.iterator]=="function",qe=`[
|
|
3
|
+
\f\r]`,pe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ct=/-->/g,Pt=/>/g,Z=RegExp(`>|${qe}(?:([^\\s"'>=/]+)(${qe}*=${qe}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Lt=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,tt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),w=tt(1),T=tt(2),_i=tt(3),Q=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ot=new WeakMap,J=X.createTreeWalker(X,129);function It(i,e){if(!et(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Mt!==void 0?Mt.createHTML(e):e}var Sn=(i,e)=>{let t=i.length-1,n=[],s,r=e===2?"<svg>":e===3?"<math>":"",o=pe;for(let h=0;h<t;h++){let l=i[h],p,m,c=-1,_=0;for(;_<l.length&&(o.lastIndex=_,m=o.exec(l),m!==null);)_=o.lastIndex,o===pe?m[1]==="!--"?o=Ct:m[1]!==void 0?o=Pt:m[2]!==void 0?(Dt.test(m[2])&&(s=RegExp("</"+m[2],"g")),o=Z):m[3]!==void 0&&(o=Z):o===Z?m[0]===">"?(o=s??pe,c=-1):m[1]===void 0?c=-2:(c=o.lastIndex-m[2].length,p=m[1],o=m[3]===void 0?Z:m[3]==='"'?Nt:Lt):o===Nt||o===Lt?o=Z:o===Ct||o===Pt?o=pe:(o=Z,s=void 0);let b=o===Z&&i[h+1].startsWith("/>")?" ":"";r+=o===pe?l+vn:c>=0?(n.push(p),l.slice(0,c)+kt+l.slice(c)+j+b):l+j+(c===-2?h:b)}return[It(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ge=class i{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,o=0,h=e.length-1,l=this.parts,[p,m]=Sn(e,t);if(this.el=i.createElement(p,n),J.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=J.nextNode())!==null&&l.length<h;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(kt)){let _=m[o++],b=s.getAttribute(c).split(j),A=/([.?@])?(.*)/.exec(_);l.push({type:1,index:r,name:A[2],strings:b,ctor:A[1]==="."?Ze:A[1]==="?"?Je:A[1]==="@"?Xe:ne}),s.removeAttribute(c)}else c.startsWith(j)&&(l.push({type:6,index:r}),s.removeAttribute(c));if(Dt.test(s.tagName)){let c=s.textContent.split(j),_=c.length-1;if(_>0){s.textContent=Pe?Pe.emptyScript:"";for(let b=0;b<_;b++)s.append(c[b],me()),J.nextNode(),l.push({type:2,index:++r});s.append(c[_],me())}}}else if(s.nodeType===8)if(s.data===Ut)l.push({type:2,index:r});else{let c=-1;for(;(c=s.data.indexOf(j,c+1))!==-1;)l.push({type:7,index:r}),c+=j.length-1}r++}}static createElement(e,t){let n=X.createElement("template");return n.innerHTML=e,n}};function te(i,e,t=i,n){if(e===Q)return e;let s=n!==void 0?t._$Co?.[n]:t._$Cl,r=fe(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),r===void 0?s=void 0:(s=new r(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=s:t._$Cl=s),s!==void 0&&(e=te(i,s._$AS(i,e.values),s,n)),e}var Ye=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,s=(e?.creationScope??X).importNode(t,!0);J.currentNode=s;let r=J.nextNode(),o=0,h=0,l=n[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new _e(r,r.nextSibling,this,e):l.type===1?p=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(p=new Qe(r,this,e)),this._$AV.push(p),l=n[++h]}o!==l?.index&&(r=J.nextNode(),o++)}return J.currentNode=X,s}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},_e=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=te(this,e,t),fe(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Q&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):$n(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&fe(this._$AH)?this._$AA.nextSibling.data=e:this.T(X.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ge.createElement(It(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(t);else{let r=new Ye(s,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Ot.get(e.strings);return t===void 0&&Ot.set(e.strings,t=new ge(e)),t}k(e){et(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,s=0;for(let r of e)s===t.length?t.push(n=new i(this.O(me()),this.O(me()),this,this.options)):n=t[s],n._$AI(r),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Tt(e).nextSibling;Tt(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=f}_$AI(e,t=this,n,s){let r=this.strings,o=!1;if(r===void 0)e=te(this,e,t,0),o=!fe(e)||e!==this._$AH&&e!==Q,o&&(this._$AH=e);else{let h=e,l,p;for(e=r[0],l=0;l<r.length-1;l++)p=te(this,h[n+l],t,l),p===Q&&(p=this._$AH[l]),o||=!fe(p)||p!==this._$AH[l],p===f?e=f:e!==f&&(e+=(p??"")+r[l+1]),this._$AH[l]=p}o&&!s&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ze=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},Je=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},Xe=class extends ne{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=te(this,e,t,0)??f)===Q)return;let n=this._$AH,s=e===f&&n!==f||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==f&&(n===f||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Qe=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){te(this,e)}};var En=Le.litHtmlPolyfillSupport;En?.(ge,_e),(Le.litHtmlVersions??=[]).push("3.3.3");var Ht=(i,e,t)=>{let n=t?.renderBefore??e,s=n._$litPart$;if(s===void 0){let r=t?.renderBefore??null;n._$litPart$=s=new _e(e.insertBefore(me(),r),r,void 0,t??{})}return s._$AI(i),s};var nt=globalThis,V=class extends B{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ht(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Q}};V._$litElement$=!0,V.finalized=!0,nt.litElementHydrateSupport?.({LitElement:V});var xn=nt.litElementPolyfillSupport;xn?.({LitElement:V});(nt.litElementVersions??=[]).push("4.2.2");var be=class extends V{createRenderRoot(){return this}};function ye(i,e){customElements.get(i)||customElements.define(i,e)}function st(i){return typeof i=="number"&&Number.isFinite(i)}function G(i,e,t){return i.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:t})}var it=[[1e12,"T"],[1e9,"B"],[1e6,"M"],[1e3,"k"]];function Bt(i,e){for(let t=0;t<it.length;t++){let[n,s]=it[t];if(!(i<n)){if(t>0&&Number((i/n).toFixed(e))>=1e3){let[r,o]=it[t-1];return G(i/r,0,e)+o}return G(i/n,0,e)+s}}return G(i,0,e)}function Ft(i,e){return Number(Math.abs(i).toFixed(e))===0}function wn(i){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:i,currencyDisplay:"narrowSymbol"}).formatToParts(0).find(t=>t.type==="currency")?.value??i}catch{return i+" "}}function An(i,e){let t=wn(e.currency??"USD");if(e.compact&&i>=1e3)return t+Bt(i,1);let n=e.cents??"auto",s=Math.round(i*100)%100!==0,r=n==="always"||n==="auto"&&(i<1e3||s);return t+(r?G(i,2,2):G(i,0,0))}function Wt(i,e={}){if(!st(i))return"\u2013";let t=An(Math.abs(i),e);return i<0&&Math.round(Math.abs(i)*100)>0?"\u2212"+t:t}function zt(i,e={}){if(!st(i))return"\u2013";let t=e.digits??1,n=e.fromRatio??!0?i*100:i,s=G(Math.abs(n),t,t)+"%";return Ft(n,t)?s:n<0?"\u2212"+s:e.signed?"+"+s:s}function jt(i,e={}){if(!st(i))return"\u2013";let t=i<0&&!Ft(i,e.digits??2)?"\u2212":"",n=Math.abs(i);return e.compact&&n>=1e3?t+Bt(n,e.digits??1):t+(e.digits===void 0?G(n,0,2):G(n,e.digits,e.digits))}function Vt(i){if(i==null)return null;let e;if(i instanceof Date)e=i;else if(typeof i=="number")e=new Date(i);else{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(i.trim());e=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):new Date(i)}return Number.isNaN(e.getTime())?null:e}var Li=new Intl.RelativeTimeFormat("en-US",{numeric:"auto"});function Ne(i){return i.replace(/[ ]/g," ")}function Gt(i,e="short"){let t=Vt(i);if(!t)return"\u2013";switch(e){case"medium":return Ne(t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}));case"long":return Ne(t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}));case"weekday":return`${t.toLocaleDateString("en-US",{weekday:"short"})} ${t.getMonth()+1}/${t.getDate()}`;default:return Ne(t.toLocaleDateString("en-US",{month:"short",day:"numeric"}))}}function Kt(i,e={}){let t=Vt(i);return t?Ne(t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:e.timeZone})):"\u2013"}var qt={ok:"var(--nish-ok-fill)",warn:"var(--nish-warn-fill)",loss:"var(--nish-loss-fill)",info:"var(--nish-info-fill)",accent:"var(--nish-accent)"};function F(i,e){return i&&Object.hasOwn(qt,i)?qt[i]:i&&/^chart-[1-8]$/.test(i)?`var(--nish-${i})`:`var(--nish-chart-${(Math.trunc(e)%8+8)%8+1})`}var k={grid:"var(--nish-line)",axis:"var(--nish-line-strong)",zero:"var(--nish-hi3)",text:"var(--nish-hi3)"},Rn=i=>Math.abs(i)>=1e3?i.toLocaleString("en-US",{maximumFractionDigits:0}):String(Math.round(i*100)/100);function ie(i,e=Rn){let t=(i??"").trim();if(!t)return e;let n=t.indexOf(":"),s=(n<0?t:t.slice(0,n)).toLowerCase(),r=n<0?"":t.slice(n+1).trim();switch(s){case"number":return o=>jt(o);case"percent":{let o=r!==""&&Number.isInteger(Number(r))&&Number(r)>=0&&Number(r)<=10?Number(r):1;return h=>zt(h,{digits:o})}case"currency":return o=>Wt(o,{currency:r||"USD"});case"date":{let o=r==="medium"||r==="long"||r==="weekday"?r:"short";return h=>Gt(h,o)}case"time":return o=>Kt(o);default:return e}}function rt(i,e,t){let n=Math.max(2,Math.floor(t));return Array.from({length:n},(s,r)=>i+(e-i)*r/(n-1))}function Zt(i,e){if(i===e){let n=Math.abs(i)*.05||1;return[i-n,e+n]}let t=(e-i)*.06;return[i-t,e+t]}function Jt(i,e){let t=0,n=i.length-1;for(;n-t>1;){let s=t+n>>1;i[s]<e?t=s:n=s}return Math.abs(i[t]-e)<=Math.abs(i[n]-e)?t:n}function K(i){if(i==null||i==="")return null;let e=typeof i=="number"?i:Number(i);return Number.isFinite(e)?e:null}function ot(i){if(!Array.isArray(i))return[];let e=[];return i.forEach((t,n)=>{if(Array.isArray(t)){let s=K(t[0]);s!==null&&e.push({x:s,y:K(t[1])})}else if(t&&typeof t=="object"){let s=t,r=K(s.x);r!==null&&e.push({x:r,y:K(s.y)})}else e.push({x:n,y:K(t)})}),e}function Xt(i){return Array.isArray(i)?i.map((e,t)=>{let n=e&&typeof e=="object"?e:{};return{label:typeof n.label=="string"&&n.label?n.label:`Series ${t+1}`,tone:typeof n.tone=="string"?n.tone:void 0,points:ot(n.points??n.data)}}):[]}function Qt(i){return Array.isArray(i)?i.map((e,t)=>{if(Array.isArray(e))return{label:String(e[0]??""),value:K(e[1])??0};if(e&&typeof e=="object"){let n=e;return{label:n.label==null?String(t+1):String(n.label),value:K(n.value)??0}}return{label:String(t+1),value:K(e)??0}}):[]}var ve={fromAttribute(i){if(!i)return[];try{let e=JSON.parse(i);return Array.isArray(e)?e:[]}catch{return[]}},toAttribute(i){try{return JSON.stringify(i)}catch{return""}}},q=class extends be{static properties={label:{type:String,reflect:!0},height:{type:Number,reflect:!0},tone:{type:String,reflect:!0},empty:{type:String,reflect:!0},yFormat:{type:String,attribute:"y-format",reflect:!0},xFormat:{type:String,attribute:"x-format",reflect:!0},width:{state:!0}};ro=null;themeObserver=null;constructor(){super(),this.label="",this.tone="",this.empty="",this.yFormat="",this.xFormat="",this.width=0}connectedCallback(){super.connectedCallback(),getComputedStyle(this).display==="inline"&&(this.style.display="block"),this.width=this.clientWidth,typeof ResizeObserver<"u"&&(this.ro=new ResizeObserver(()=>{this.clientWidth!==this.width&&(this.width=this.clientWidth)}),this.ro.observe(this)),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]})}disconnectedCallback(){super.disconnectedCallback(),this.ro?.disconnect(),this.ro=null,this.themeObserver?.disconnect(),this.themeObserver=null}get plotHeight(){return this.height>0?this.height:200}},Yt=0;function en(){return Yt+=1,`nish-chart-${Yt}`}var Oe="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";var tn=18,Tn=22,ke=class extends q{static properties={...q.properties,data:{converter:ve},xTicks:{type:String,attribute:"x-ticks",reflect:!0},showValues:{type:Boolean,attribute:"show-values",reflect:!0},selected:{state:!0},coarse:{state:!0}};mq=null;onCoarse=()=>{this.coarse=!!this.mq?.matches};constructor(){super(),this.data=[],this.height=140,this.xTicks="ends",this.showValues=!1,this.selected=null,this.coarse=!1}connectedCallback(){super.connectedCallback(),typeof window<"u"&&window.matchMedia&&(this.mq=window.matchMedia("(pointer: coarse)"),this.coarse=this.mq.matches,this.mq.addEventListener("change",this.onCoarse))}disconnectedCallback(){super.disconnectedCallback(),this.mq?.removeEventListener("change",this.onCoarse),this.mq=null}render(){let e=this.label,t=this.height>0?this.height:140,n=Qt(this.data),s=ie(this.yFormat),r=ie(this.xFormat,u=>String(u)),o=u=>this.xFormat&&u.trim()!==""&&Number.isFinite(Number(u))?r(Number(u)):u;if(!n.length)return w`<div class="nish-chart">
|
|
5
|
+
<div class="nish-empty" role="img" aria-label="${e}: no data" style="height:${t}px;box-sizing:border-box">${this.empty||"No data yet"}</div>
|
|
6
|
+
</div>`;let h=this.width,l=F(this.tone,0),p=n.map(u=>Number.isFinite(u.value)?u.value:0),m=Math.max(0,...p),c=Math.min(0,...p),_=m-c||1,b=Math.max(0,t-tn-Tn),A=tn+m/_*b,S=h/n.length,g=Math.max(1,S*.72),y=this.showValues,M=y||this.coarse,P=this.xTicks==="all",U=this.selected!=null&&this.selected<n.length?this.selected:null,L=u=>{let $=u.currentTarget.getBoundingClientRect(),C=Math.floor((u.clientX-$.left)/($.width||1)*n.length);this.selected=Math.min(n.length-1,Math.max(0,C))},se=u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();let $=u.key==="ArrowRight"?1:-1,C=this.selected;this.selected=C==null?$>0?0:n.length-1:Math.min(n.length-1,Math.max(0,C+$))}else u.key==="Escape"&&(this.selected=null)},$e=h>0?w`<svg
|
|
7
|
+
width=${h}
|
|
8
|
+
height=${t}
|
|
9
|
+
role="img"
|
|
10
|
+
tabindex="0"
|
|
11
|
+
aria-label=${e}
|
|
12
|
+
style="display:block;touch-action:pan-y"
|
|
13
|
+
@pointerdown=${L}
|
|
14
|
+
@pointermove=${u=>{(u.pointerType==="mouse"||u.buttons)&&L(u)}}
|
|
15
|
+
@pointerleave=${u=>{u.pointerType==="mouse"&&(this.selected=null)}}
|
|
16
|
+
@keydown=${se}
|
|
17
|
+
>
|
|
18
|
+
<line class="nish-chart-grid" x1="0" x2=${h} y1=${A} y2=${A} stroke=${k.grid} stroke-width="1"></line>
|
|
19
|
+
${p.map((u,$)=>{let C=Math.max(2,Math.abs(u)/_*b),W=u<0?A:A-C,N=$*S+(S-g)/2,D=U===$,Se=D||M&&(y||S>=26);return T`<g>
|
|
20
|
+
<rect x=${N} y=${W} width=${g} height=${C} rx="2" fill=${l} opacity=${U==null||D?1:.55}></rect>
|
|
21
|
+
${Se?T`<text class="nish-chart-axis" x=${N+g/2} y=${u<0?W+C+11:Math.max(11,W-4)} text-anchor="middle" font-size="11" fill=${k.text} style="font-variant-numeric:tabular-nums">${s(u)}</text>`:f}
|
|
22
|
+
</g>`})}
|
|
23
|
+
${n.map((u,$)=>{if(!(P||$===0||$===n.length-1))return f;let C=P?"middle":$===0?"start":"end",W=P?$*S+S/2:$===0?0:h;return T`<text class="nish-chart-axis" x=${W} y=${t-6} text-anchor=${C} font-size="11" fill=${k.text}>${o(u.label)}</text>`})}
|
|
24
|
+
</svg>`:f;return w`<div class="nish-chart" style="position:relative;width:100%">
|
|
25
|
+
${$e}
|
|
26
|
+
<div aria-live="polite" style="margin-top:4px;min-height:20px;font-size:14px;font-variant-numeric:tabular-nums;color:var(--nish-hi2)">${U!=null?`${o(n[U].label)}: ${s(p[U])}`:""}</div>
|
|
27
|
+
<table style=${Oe}>
|
|
28
|
+
<caption>${e}</caption>
|
|
29
|
+
<tbody>
|
|
30
|
+
${n.map((u,$)=>w`<tr><th scope="row">${o(u.label)}</th><td>${s(p[$])}</td></tr>`)}
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
33
|
+
</div>`}};ye("nish-bar-chart",ke);var Ue=10,Mn=24,Cn=12,Pn="position:absolute;top:4px;z-index:10;pointer-events:none;white-space:nowrap;padding:4px 8px;font-variant-numeric:tabular-nums;background:var(--nish-elevated);border:1px solid var(--nish-line-strong);border-radius:var(--nish-radius-sm);box-shadow:var(--nish-shadow-pop);color:var(--nish-hi);font-size:12px",De=class extends q{static properties={...q.properties,data:{converter:ve},series:{converter:ve},area:{type:Boolean,reflect:!0},baseline:{type:Number,reflect:!0},yTicks:{type:Number,attribute:"y-ticks",reflect:!0},xTicks:{type:Number,attribute:"x-ticks",reflect:!0},active:{state:!0}};fromKey=!1;listening=!1;gradId=en();constructor(){super(),this.data=[],this.series=[],this.area=!1,this.height=200,this.yTicks=4,this.xTicks=4,this.active=null}onDocPointerDown=e=>{this.contains(e.target)||(this.active=null)};disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}stopListening(){this.listening&&(document.removeEventListener("pointerdown",this.onDocPointerDown),this.listening=!1)}updated(){this.active!=null&&!this.listening?(document.addEventListener("pointerdown",this.onDocPointerDown),this.listening=!0):this.active==null&&this.stopListening()}lines(){let e=Xt(this.series);if(e.length)return e;let t=ot(this.data);return t.length?[{label:this.label,tone:this.tone||void 0,points:t}]:[]}moveTo(e,t,n,s,r,o,h){let l=t.getBoundingClientRect(),p=o+(e-l.left-s)/(r||1)*(h-o);this.active=Jt(n,p)}render(){let e=this.label,t=this.plotHeight,n=this.lines(),s=ie(this.yFormat),r=ie(this.xFormat),o=a=>a.y!=null&&Number.isFinite(a.y)&&Number.isFinite(a.x),h=new Set;for(let a of n)for(let d of a.points)o(d)&&h.add(d.x);let l=[...h].sort((a,d)=>a-d);if(!l.length)return w`<div class="nish-chart">
|
|
34
|
+
<div class="nish-empty" role="img" aria-label="${e}: no data" style="height:${t}px;box-sizing:border-box">${this.empty||"No data yet"}</div>
|
|
35
|
+
</div>`;let p=n.map(a=>new Map(a.points.filter(o).map(d=>[d.x,d.y]))),m=1/0,c=-1/0;for(let a of n)for(let d of a.points)o(d)&&(m=Math.min(m,d.y),c=Math.max(c,d.y));let _=this.baseline!=null&&Number.isFinite(this.baseline)?this.baseline:void 0;_!==void 0&&(m=Math.min(m,_),c=Math.max(c,_)),[m,c]=Zt(m,c);let b=l[0],A=l[l.length-1]===b?b+1:l[l.length-1],S=this.width,g=rt(m,c,this.yTicks||4).map(a=>({v:a,text:s(a)})),y=Math.ceil(Math.max(...g.map(a=>a.text.length))*6.6)+10,M=Math.max(0,S-y-Cn),P=Math.max(0,t-Ue-Mn),U=a=>y+(a-b)/(A-b)*M,L=a=>Ue+(1-(a-m)/(c-m))*P,se=Ue+P,$e=n.map(a=>{let d=[],E=[];for(let Ie of[...a.points].sort((an,ln)=>an.x-ln.x))o(Ie)?E.push([Number(U(Ie.x).toFixed(1)),Number(L(Ie.y).toFixed(1))]):(E.length&&d.push(E),E=[]);return E.length&&d.push(E),d}),u=a=>a.map(d=>`${d[0]},${d[1]}`).join(" "),$=Math.min(this.xTicks||4,Math.max(2,Math.floor(M/72))),C=rt(b,A,$),W=this.active!=null&&this.active<l.length?this.active:null,N=W!=null?l[W]:null,D=N!=null?U(N):0,Se=N!=null?n.map((a,d)=>({s:a,i:d,y:p[d].get(N)})).filter(a=>a.y!=null):[],nn=D<S/2,at=a=>{this.fromKey=!1,this.moveTo(a.clientX,a.currentTarget,l,y,M,b,A)},sn=a=>{if(a.key==="ArrowLeft"||a.key==="ArrowRight"){a.preventDefault(),this.fromKey=!0;let d=a.key==="ArrowRight"?1:-1,E=this.active;this.active=E==null?d>0?0:l.length-1:Math.min(l.length-1,Math.max(0,E+d))}else a.key==="Escape"&&(this.active=null)},lt=n[0],ht=F(lt?.tone,0),rn=S>0?w`<svg
|
|
36
|
+
width=${S}
|
|
37
|
+
height=${t}
|
|
38
|
+
role="img"
|
|
39
|
+
tabindex="0"
|
|
40
|
+
aria-label=${e}
|
|
41
|
+
style="display:block;touch-action:pan-y"
|
|
42
|
+
@pointerdown=${at}
|
|
43
|
+
@pointermove=${at}
|
|
44
|
+
@pointerleave=${a=>{a.pointerType==="mouse"&&(this.active=null)}}
|
|
45
|
+
@keydown=${sn}
|
|
46
|
+
@blur=${()=>{this.fromKey&&(this.active=null)}}
|
|
47
|
+
>
|
|
48
|
+
${this.area&<?T`<defs><linearGradient id=${this.gradId} x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color=${ht} stop-opacity="0.2"></stop><stop offset="100%" stop-color=${ht} stop-opacity="0"></stop></linearGradient></defs>`:f}
|
|
49
|
+
${g.map(a=>T`<g>
|
|
50
|
+
<line class="nish-chart-grid" x1=${y} x2=${y+M} y1=${L(a.v)} y2=${L(a.v)} stroke=${k.grid} stroke-width="1"></line>
|
|
51
|
+
<text class="nish-chart-axis" x=${y-6} y=${L(a.v)} text-anchor="end" dominant-baseline="middle" font-size="11" fill=${k.text} style="font-variant-numeric:tabular-nums">${a.text}</text>
|
|
52
|
+
</g>`)}
|
|
53
|
+
${C.map((a,d)=>T`<text class="nish-chart-axis" x=${U(a)} y=${t-6} text-anchor=${d===0?"start":d===C.length-1?"end":"middle"} font-size="11" fill=${k.text} style="font-variant-numeric:tabular-nums">${r(a)}</text>`)}
|
|
54
|
+
${_!==void 0?T`<line x1=${y} x2=${y+M} y1=${L(_)} y2=${L(_)} stroke=${k.zero} stroke-width="1" stroke-dasharray="4 4"></line>`:f}
|
|
55
|
+
${this.area?($e[0]??[]).map(a=>T`<polygon points="${a[0][0]},${se} ${u(a)} ${a[a.length-1][0]},${se}" fill="url(#${this.gradId})"></polygon>`):f}
|
|
56
|
+
${$e.map((a,d)=>a.map(E=>E.length===1?T`<circle cx=${E[0][0]} cy=${E[0][1]} r="2" fill=${F(n[d].tone,d)}></circle>`:T`<polyline points=${u(E)} fill="none" stroke=${F(n[d].tone,d)} stroke-width="2" stroke-linejoin="round" stroke-linecap="round"></polyline>`))}
|
|
57
|
+
${N!=null?T`<g pointer-events="none">
|
|
58
|
+
<line x1=${D} x2=${D} y1=${Ue} y2=${se} stroke=${k.axis} stroke-width="1"></line>
|
|
59
|
+
${Se.map(a=>T`<circle cx=${D} cy=${L(a.y)} r="4" fill=${F(a.s.tone,a.i)} stroke="var(--nish-surface)" stroke-width="2"></circle>`)}
|
|
60
|
+
</g>`:f}
|
|
61
|
+
</svg>`:f,on=N!=null&&S>0?w`<div class="nish-chart-tooltip" style="${Pn};${nn?`left:${D+10}px`:`right:${S-D+10}px`}">
|
|
62
|
+
<div style="color:var(--nish-hi3)">${r(N)}</div>
|
|
63
|
+
${Se.map(a=>w`<div style="display:flex;align-items:center;gap:6px">
|
|
64
|
+
<span aria-hidden="true" style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${F(a.s.tone,a.i)}"></span>
|
|
65
|
+
${n.length>1?w`<span style="color:var(--nish-hi3)">${a.s.label}</span>`:f}
|
|
66
|
+
<span style="font-weight:500">${s(a.y)}</span>
|
|
67
|
+
</div>`)}
|
|
68
|
+
</div>`:f;return w`<div class="nish-chart" style="position:relative;width:100%;user-select:none">
|
|
69
|
+
<div style="position:relative;height:${t}px">
|
|
70
|
+
${rn}${on}
|
|
71
|
+
<table style=${Oe}>
|
|
72
|
+
<caption>${e}</caption>
|
|
73
|
+
<thead>
|
|
74
|
+
<tr>
|
|
75
|
+
<th scope="col">x</th>
|
|
76
|
+
${n.map(a=>w`<th scope="col">${a.label}</th>`)}
|
|
77
|
+
</tr>
|
|
78
|
+
</thead>
|
|
79
|
+
<tbody>
|
|
80
|
+
${l.slice(0,200).map(a=>w`<tr>
|
|
81
|
+
<th scope="row">${r(a)}</th>
|
|
82
|
+
${n.map((d,E)=>w`<td>${p[E].has(a)?s(p[E].get(a)):""}</td>`)}
|
|
83
|
+
</tr>`)}
|
|
84
|
+
</tbody>
|
|
85
|
+
</table>
|
|
86
|
+
</div>
|
|
87
|
+
${n.length>1?w`<ul class="nish-legend" aria-label="Legend">
|
|
88
|
+
${n.map((a,d)=>w`<li class="nish-legend-item" style="--c: ${F(a.tone,d)}"><i class="nish-legend-swatch" aria-hidden="true"></i>${a.label}</li>`)}
|
|
89
|
+
</ul>`:f}
|
|
90
|
+
</div>`}};ye("nish-line-chart",De);export{ke as NishBarChart,be as NishElement,De as NishLineChart,ye as define};
|
|
91
|
+
/*! Bundled license information:
|
|
92
|
+
|
|
93
|
+
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
94
|
+
@lit-labs/ssr-dom-shim/lib/events.js:
|
|
95
|
+
(**
|
|
96
|
+
* @license
|
|
97
|
+
* Copyright 2023 Google LLC
|
|
98
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
99
|
+
*)
|
|
100
|
+
|
|
101
|
+
@lit-labs/ssr-dom-shim/lib/css.js:
|
|
102
|
+
@lit-labs/ssr-dom-shim/lib/observers.js:
|
|
103
|
+
(**
|
|
104
|
+
* @license
|
|
105
|
+
* Copyright 2024 Google LLC
|
|
106
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
107
|
+
*)
|
|
108
|
+
|
|
109
|
+
@lit-labs/ssr-dom-shim/index.js:
|
|
110
|
+
@lit/reactive-element/node/css-tag.js:
|
|
111
|
+
(**
|
|
112
|
+
* @license
|
|
113
|
+
* Copyright 2019 Google LLC
|
|
114
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
+
*)
|
|
116
|
+
|
|
117
|
+
lit-html/node/lit-html.js:
|
|
118
|
+
lit-element/lit-element.js:
|
|
119
|
+
(**
|
|
120
|
+
* @license
|
|
121
|
+
* Copyright 2017 Google LLC
|
|
122
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
123
|
+
*)
|
|
124
|
+
|
|
125
|
+
lit-html/node/is-server.js:
|
|
126
|
+
(**
|
|
127
|
+
* @license
|
|
128
|
+
* Copyright 2022 Google LLC
|
|
129
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
130
|
+
*)
|
|
131
|
+
*/
|
|
132
|
+
//# sourceMappingURL=elements-charts.js.map
|