355 lines
44 KiB
JavaScript
355 lines
44 KiB
JavaScript
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||
var j=globalThis,B=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),ct=new WeakMap,P=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(B&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ct.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ct.set(i,t))}return t}toString(){return this.cssText}},pt=s=>new P(typeof s=="string"?s:s+"",void 0,K),w=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new P(i,s,K)},ut=(s,t)=>{if(B)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=j.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},Y=B?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return pt(i)})(s):s;var{is:Lt,defineProperty:Ot,getOwnPropertyDescriptor:Dt,getOwnPropertyNames:Nt,getOwnPropertySymbols:Ut,getPrototypeOf:It}=Object,V=globalThis,ft=V.trustedTypes,jt=ft?ft.emptyScript:"",Bt=V.reactiveElementPolyfillSupport,L=(s,t)=>s,J={toAttribute(s,t){switch(t){case Boolean:s=s?jt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},mt=(s,t)=>!Lt(s,t),gt={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:mt};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=gt){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ot(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Dt(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let d=e?.call(this);n?.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(L("elementProperties")))return;let t=It(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(L("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(L("properties"))){let i=this.properties,r=[...Nt(i),...Ut(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(Y(e))}else t!==void 0&&i.push(Y(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:J).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(t,i){let r=this.constructor,e=r._$Eh.get(t);if(e!==void 0&&this._$Em!==e){let n=r.getPropertyOptions(e),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:J;this._$Em=e;let d=o.fromAttribute(i,n.type);this[e]=d??this._$Ej?.get(e)??d,this._$Em=null}}requestUpdate(t,i,r,e=!1,n){if(t!==void 0){let o=this.constructor;if(e===!1&&(n=this[t]),r??=o.getPropertyOptions(t),!((r.hasChanged??mt)(n,i)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,i,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,i,{useDefault:r,reflect:e,wrapped:n},o){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??i??this[t]),n!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(i=void 0),this._$AL.set(t,i)),e===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,n]of this._$Ep)this[e]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[e,n]of r){let{wrapped:o}=n,d=this[e];o!==!0||this._$AL.has(e)||d===void 0||this.C(e,void 0,n,d)}}let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(i)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(i)}willUpdate(t){}_$AE(t){this._$EO?.forEach(i=>i.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(i=>this._$ET(i,this[i])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[L("elementProperties")]=new Map,_[L("finalized")]=new Map,Bt?.({ReactiveElement:_}),(V.reactiveElementVersions??=[]).push("2.1.2");var rt=globalThis,bt=s=>s,W=rt.trustedTypes,vt=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,St="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+S,Vt=`<${At}>`,M=document,D=()=>M.createComment(""),N=s=>s===null||typeof s!="object"&&typeof s!="function",nt=Array.isArray,Wt=s=>nt(s)||typeof s?.[Symbol.iterator]=="function",G=`[
|
||
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,$t=/>/g,E=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
||
\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,st=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),v=st(1),A=st(2),Xt=st(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),_t=new WeakMap,k=M.createTreeWalker(M,129);function kt(s,t){if(!nt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return vt!==void 0?vt.createHTML(t):t}var qt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"<svg>":t===3?"<math>":"",o=O;for(let d=0;d<i;d++){let l=s[d],h,p,c=-1,b=0;for(;b<l.length&&(o.lastIndex=b,p=o.exec(l),p!==null);)b=o.lastIndex,o===O?p[1]==="!--"?o=xt:p[1]!==void 0?o=$t:p[2]!==void 0?(Et.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=e??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?E:p[3]==='"'?wt:yt):o===wt||o===yt?o=E:o===xt||o===$t?o=O:(o=E,e=void 0);let m=o===E&&s[d+1].startsWith("/>")?" ":"";n+=o===O?l+Vt:c>=0?(r.push(h),l.slice(0,c)+St+l.slice(c)+S+m):l+S+(c===-2?d:m)}return[kt(s,n+(s[i]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},U=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,d=t.length-1,l=this.parts,[h,p]=qt(t,i);if(this.el=s.createElement(h,r),k.currentNode=this.el.content,i===2||i===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(e=k.nextNode())!==null&&l.length<d;){if(e.nodeType===1){if(e.hasAttributes())for(let c of e.getAttributeNames())if(c.endsWith(St)){let b=p[o++],m=e.getAttribute(c).split(S),y=/([.?@])?(.*)/.exec(b);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Q:y[1]==="?"?tt:y[1]==="@"?et:R}),e.removeAttribute(c)}else c.startsWith(S)&&(l.push({type:6,index:n}),e.removeAttribute(c));if(Et.test(e.tagName)){let c=e.textContent.split(S),b=c.length-1;if(b>0){e.textContent=W?W.emptyScript:"";for(let m=0;m<b;m++)e.append(c[m],D()),k.nextNode(),l.push({type:2,index:++n});e.append(c[b],D())}}}else if(e.nodeType===8)if(e.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=e.data.indexOf(S,c+1))!==-1;)l.push({type:7,index:n}),c+=S.length-1}n++}}static createElement(t,i){let r=M.createElement("template");return r.innerHTML=t,r}};function H(s,t,i=s,r){if(t===T)return t;let e=r!==void 0?i._$Co?.[r]:i._$Cl,n=N(t)?void 0:t._$litDirective$;return e?.constructor!==n&&(e?._$AO?.(!1),n===void 0?e=void 0:(e=new n(s),e._$AT(s,i,r)),r!==void 0?(i._$Co??=[])[r]=e:i._$Cl=e),e!==void 0&&(t=H(s,e._$AS(s,t.values),e,r)),t}var X=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:r}=this._$AD,e=(t?.creationScope??M).importNode(i,!0);k.currentNode=e;let n=k.nextNode(),o=0,d=0,l=r[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new I(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new it(n,this,t)),this._$AV.push(h),l=r[++d]}o!==l?.index&&(n=k.nextNode(),o++)}return k.currentNode=M,e}p(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},I=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,r,e){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=H(this,t,i),N(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Wt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:r}=t,e=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=U.createElement(kt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===e)this._$AH.p(i);else{let n=new X(e,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(t){let i=_t.get(t.strings);return i===void 0&&_t.set(t.strings,i=new U(t)),i}k(t){nt(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,e=0;for(let n of t)e===i.length?i.push(r=new s(this.O(D()),this.O(D()),this,this.options)):r=i[e],r._$AI(n),e++;e<i.length&&(this._$AR(r&&r._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t!==this._$AB;){let r=bt(t).nextSibling;bt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},R=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,r,e,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,i=this,r,e){let n=this.strings,o=!1;if(n===void 0)t=H(this,t,i,0),o=!N(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else{let d=t,l,h;for(t=n[0],l=0;l<n.length-1;l++)h=H(this,d[r+l],i,l),h===T&&(h=this._$AH[l]),o||=!N(h)||h!==this._$AH[l],h===u?t=u:t!==u&&(t+=(h??"")+n[l+1]),this._$AH[l]=h}o&&!e&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Q=class extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},tt=class extends R{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},et=class extends R{constructor(t,i,r,e,n){super(t,i,r,e,n),this.type=5}_$AI(t,i=this){if((t=H(this,t,i,0)??u)===T)return;let r=this._$AH,e=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==u&&(r===u||e);e&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},it=class{constructor(t,i,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){H(this,t)}};var Zt=rt.litHtmlPolyfillSupport;Zt?.(U,I),(rt.litHtmlVersions??=[]).push("3.3.3");var Mt=(s,t,i)=>{let r=i?.renderBefore??t,e=r._$litPart$;if(e===void 0){let n=i?.renderBefore??null;r._$litPart$=e=new I(t.insertBefore(D(),n),n,void 0,i??{})}return e._$AI(s),e};var ot=globalThis,$=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Mt(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return T}};$._$litElement$=!0,$.finalized=!0,ot.litElementHydrateSupport?.({LitElement:$});var Ft=ot.litElementPolyfillSupport;Ft?.({LitElement:$});(ot.litElementVersions??=[]).push("4.2.2");var q=w`
|
||
:host {
|
||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||
--nf-accent: var(--primary-color, #03a9f4);
|
||
--nf-accent-text: var(--text-primary-color, #ffffff);
|
||
--nf-surface: var(--ha-card-background, var(--card-background-color, #1c1c1c));
|
||
--nf-bg: var(--primary-background-color, #111111);
|
||
--nf-bg2: var(--secondary-background-color, #1c1c1c);
|
||
/* floating bars and cards over the 3D view: the card colour, a little see-through */
|
||
--nf-chrome: color-mix(in srgb, var(--nf-surface) var(--nf-chrome-mix, 84%), transparent);
|
||
--nf-chrome-solid: var(--nf-surface);
|
||
--nf-line: var(--divider-color, rgba(255, 255, 255, 0.12));
|
||
/* quiet fills for buttons and fields, and the tonal accent of an active control */
|
||
--nf-fill: color-mix(in srgb, var(--nf-text) 7%, transparent);
|
||
--nf-fill-strong: color-mix(in srgb, var(--nf-text) 13%, transparent);
|
||
--nf-tonal: color-mix(in srgb, var(--nf-accent) 20%, transparent);
|
||
--nf-soft: var(--info-color, #4a90e2);
|
||
--nf-warm: var(--state-light-active-color, #ffa726);
|
||
--nf-danger: var(--error-color, #db4437);
|
||
--nf-good: var(--success-color, #43a047);
|
||
--nf-radius: var(--ha-card-border-radius, 12px);
|
||
--nf-shadow: var(--ha-card-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 20px rgba(0, 0, 0, 0.2));
|
||
--nf-font: var(--primary-font-family, Roboto, "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
|
||
--nf-title-font: var(--nf-font);
|
||
font-family: var(--nf-font);
|
||
color: var(--nf-text);
|
||
}
|
||
`,pe=w`
|
||
:host([readable]) {
|
||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||
--nf-chrome-mix: 97%;
|
||
}
|
||
:host([readable]) nf-room-panel,
|
||
:host([readable]) .nf-nav,
|
||
:host([readable]) .nf-overlay {
|
||
zoom: 1.2;
|
||
}
|
||
`,ue=w`
|
||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||
.nf-seg {
|
||
display: inline-flex;
|
||
padding: 4px;
|
||
gap: 2px;
|
||
border-radius: 999px;
|
||
background: var(--nf-chrome);
|
||
box-shadow: var(--nf-shadow);
|
||
backdrop-filter: blur(10px);
|
||
}
|
||
.nf-seg button,
|
||
.nf-chip {
|
||
font: inherit;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
border: none;
|
||
background: none;
|
||
color: var(--nf-muted);
|
||
padding: 7px 14px;
|
||
border-radius: 999px;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
min-height: 36px;
|
||
transition:
|
||
background 0.15s,
|
||
color 0.15s;
|
||
}
|
||
.nf-seg button:hover:not(:disabled),
|
||
.nf-chip:hover {
|
||
background: var(--nf-fill);
|
||
color: var(--nf-text);
|
||
}
|
||
/* on a small stage (a small window, a zoomed browser, a dashboard column) the switches at the bottom take less room */
|
||
@container nf ((max-width: 1360px) or (max-height: 640px)) {
|
||
:is(.nf-overlay, .nf-card-controls) .nf-seg {
|
||
padding: 3px;
|
||
}
|
||
:is(.nf-overlay, .nf-card-controls) :is(.nf-seg button, .nf-chip) {
|
||
font-size: 12.5px;
|
||
padding: 5px 10px;
|
||
}
|
||
}
|
||
.nf-time-slider {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
padding: 4px 10px;
|
||
}
|
||
.nf-time-slider input {
|
||
width: 160px;
|
||
accent-color: var(--nf-accent);
|
||
}
|
||
.nf-seg button[aria-pressed="true"],
|
||
.nf-chip[aria-pressed="true"] {
|
||
background: color-mix(in srgb, var(--nf-accent) 24%, var(--nf-chrome-solid));
|
||
color: var(--nf-accent);
|
||
font-weight: 600;
|
||
}
|
||
.nf-seg button:disabled {
|
||
opacity: 0.4;
|
||
cursor: default;
|
||
}
|
||
/* a single pill, like the chips of the Mushroom cards */
|
||
.nf-chip {
|
||
background: var(--nf-chrome);
|
||
color: var(--nf-text);
|
||
box-shadow: var(--nf-shadow);
|
||
backdrop-filter: blur(10px);
|
||
}
|
||
|
||
button:focus-visible,
|
||
input:focus-visible,
|
||
select:focus-visible {
|
||
outline: 2px solid var(--nf-accent);
|
||
outline-offset: 2px;
|
||
}
|
||
/* the round icon badge every row and card starts with */
|
||
.nf-ico {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex: none;
|
||
width: 38px;
|
||
height: 38px;
|
||
border-radius: 50%;
|
||
background: var(--nf-tonal);
|
||
color: var(--nf-accent);
|
||
--mdc-icon-size: 20px;
|
||
}
|
||
.nf-ico.nf-warm {
|
||
background: color-mix(in srgb, var(--nf-warm) 22%, transparent);
|
||
color: var(--nf-warm);
|
||
}
|
||
.nf-ico.nf-off {
|
||
background: var(--nf-fill);
|
||
color: var(--nf-muted);
|
||
}
|
||
.nf-btn {
|
||
font: inherit;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
border: none;
|
||
background: var(--nf-fill);
|
||
color: var(--nf-text);
|
||
border-radius: var(--nf-radius);
|
||
padding: 7px 14px;
|
||
cursor: pointer;
|
||
min-height: 36px;
|
||
transition: background 0.15s;
|
||
}
|
||
.nf-btn:hover {
|
||
background: var(--nf-fill-strong);
|
||
}
|
||
.nf-btn.nf-danger {
|
||
color: var(--nf-danger);
|
||
}
|
||
.nf-btn.nf-primary {
|
||
background: var(--nf-accent);
|
||
color: var(--nf-accent-text);
|
||
}
|
||
.nf-btn.nf-primary:hover {
|
||
background: color-mix(in srgb, var(--nf-accent) 88%, var(--nf-text));
|
||
}
|
||
.nf-field {
|
||
display: grid;
|
||
gap: 4px;
|
||
font-size: 12px;
|
||
color: var(--nf-muted);
|
||
}
|
||
.nf-field input,
|
||
.nf-field select,
|
||
.nf-field textarea {
|
||
font: inherit;
|
||
font-size: 14px;
|
||
color: var(--nf-text);
|
||
background: var(--nf-fill);
|
||
border: none;
|
||
border-bottom: 1px solid var(--nf-line);
|
||
border-radius: 10px 10px 4px 4px;
|
||
padding: 8px 10px;
|
||
min-width: 0;
|
||
}
|
||
.nf-field input:focus,
|
||
.nf-field select:focus,
|
||
.nf-field textarea:focus {
|
||
border-bottom-color: var(--nf-accent);
|
||
}
|
||
.nf-field input[type="range"] {
|
||
padding: 0;
|
||
accent-color: var(--nf-accent);
|
||
}
|
||
.nf-field select option {
|
||
background: var(--nf-chrome-solid);
|
||
color: var(--nf-text);
|
||
}
|
||
/* fingers need 40 px */
|
||
@media (pointer: coarse) {
|
||
.nf-seg button,
|
||
.nf-chip,
|
||
.nf-btn {
|
||
min-height: 40px;
|
||
}
|
||
}
|
||
`;var Tt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function zt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function at(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Ct(s,t,i,r){let e=h=>h.trim()&&Number.isFinite(Number(h.replace(",",".")))?Number(h.replace(",",".")):null,n=e(t),o=e(i),d=n??s.reduce((h,p)=>Math.min(h,p),r||!s.length?0:1/0),l=o??s.reduce((h,p)=>Math.max(h,p),r?0:s.length?-1/0:1);if(d===l&&(n===null&&!r&&(d-=Math.max(1,Math.abs(d)*.05)),o===null&&(l+=Math.max(1,Math.abs(l)*.05))),d>=l)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[d,l]}function Ht(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r
|
||
`)}var lt=class extends ${static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return v`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${()=>this.dialog?.showModal()}>ⓘ</button>
|
||
<dialog aria-label="Information" @keydown=${t=>t.stopPropagation()} @click=${t=>{if(t.target!==t.currentTarget)return;let i=this.dialog.getBoundingClientRect();(t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom)&&this.dialog?.close()}}>
|
||
<header><b>Information</b><button class="close" type="button" aria-label="Schließen" @click=${()=>this.dialog?.close()}>×</button></header>
|
||
<p>${this.text}</p>
|
||
</dialog>`}static styles=[q,w`
|
||
:host { display:inline-block; margin:4px 0; vertical-align:middle; }
|
||
button { font:inherit; cursor:pointer; color:var(--nf-muted); background:transparent; border:1px solid var(--nf-line); border-radius:50%; pointer-events:auto; }
|
||
.info { width:26px; height:26px; padding:0; font-size:18px; line-height:24px; }
|
||
button:hover { color:var(--nf-accent); }
|
||
button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||
dialog { box-sizing:border-box; width:min(560px,calc(100vw - 32px)); max-height:80vh; max-height:80dvh; overflow:auto; padding:18px 22px; border:1px solid var(--nf-line); border-radius:14px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; box-shadow:var(--nf-shadow); pointer-events:auto; }
|
||
dialog::backdrop { background:#050b16a6; }
|
||
header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; }
|
||
.close { width:30px; height:30px; padding:0; font-size:23px; }
|
||
p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; }
|
||
`]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",lt);var Rt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],z=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),ht=class extends ${static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},plotHeight:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;resize=()=>{this.plotHeight=Math.round(Math.min(600,Math.max(220,window.innerHeight*(window.innerWidth<600?.52:.65))))};constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.plotHeight=400,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.resize(),window.addEventListener("resize",this.resize),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect(),window.removeEventListener("resize",this.resize)}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;o<this.ids.length&&t===this.request;o+=3){let d=this.ids.slice(o,o+3);(await Promise.allSettled(d.map(h=>this.hass.callWS({type:"nextfloor/archive/trend",entity_id:h,start:i,end:r,aggregation:this.resolution})))).forEach((h,p)=>h.status==="fulfilled"?e.push(h.value):n.push(`${z(this.hass,d[p])}: ${Pt(h.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return Rt[this.ids.indexOf(t)%Rt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))])),i=URL.createObjectURL(new Blob([Ht(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(a=>a.points.flatMap(f=>{let g=this.value(f);return g===null?[]:this.band&&!a.counter?[g,f.min??g,f.max??g]:[g]}));if(!r.length)return v`<p class="note">Keine numerischen Archivwerte in diesem Zeitraum.</p>`;let e,n;try{[e,n]=Ct(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(a=>a.type===0)||this.chartStyle==="auto"&&t.some(a=>a.counter&&a.aggregation!=="raw"))}catch(a){return v`<p role="alert">${Pt(a)}</p>`}let o=new Set(this.selected().filter(a=>a.type!==3).map(a=>this.unit(a.entity_id))).size,d=Math.max(200,Math.round(this.plotHeight/Math.max(1,Math.min(o,2)))),l=64,h=this.width-16,p=14,c=d-32,b=a=>l+(a-this.from)/(this.to-this.from)*(h-l),m=a=>c-(a-e)/(n-e)*(c-p),y=(a,f=this.field)=>Number(f==="v"?a.v:a[f]??a.v),Z=(a,f=this.field)=>{let g=a.points.filter(C=>typeof C.v=="number"),x=this.chartStyle==="step"||this.chartStyle==="auto"&&a.type===0;return g.map((C,dt)=>`${dt?x?`H${b(C.t).toFixed(1)}V`:"L":"M"}${x&&dt?m(y(C,f)).toFixed(1):`${b(C.t).toFixed(1)},${m(y(C,f)).toFixed(1)}`}`).join("")+(g.length?x?`H${h}`:a.aggregation==="raw"?`L${h},${m(y(g[g.length-1],f)).toFixed(1)}`:"":"")},F=this.width<480?2:5;return v`<section class="chart-group"><h3>${i||"Wert"}</h3><svg class="plot" viewBox=${`0 0 ${this.width} ${d}`} role="img" aria-label=${`Trend ${i}`} @wheel=${a=>{a.preventDefault(),this.zoom(a.deltaY>0?1.5:1/1.5,this.ratio(a))}}
|
||
@pointerdown=${a=>{this.drag=this.ratio(a),a.currentTarget.setPointerCapture(a.pointerId)}}
|
||
@pointerup=${a=>{if(this.drag===null)return;let f=this.drag,g=this.ratio(a);if(this.drag=null,Math.abs(f-g)>.02){let x=this.to-this.from;this.range(this.from+x*Math.min(f,g),this.from+x*Math.max(f,g))}}}
|
||
@pointercancel=${()=>{this.drag=null}} @pointermove=${a=>{this.hover=this.from+(this.to-this.from)*this.ratio(a)}}>
|
||
<defs><clipPath id="plot-clip"><rect x=${l} y=${p} width=${h-l} height=${c-p}/></clipPath></defs>
|
||
${[0,1,2,3,4].map(a=>{let f=e+(n-e)*a/4;return A`<line class="grid" x1=${l} x2=${h} y1=${m(f)} y2=${m(f)}/><text x=${l-7} y=${m(f)+4} text-anchor="end">${this.number(f)}</text>`})}
|
||
${Array.from({length:F},(a,f)=>{let g=this.from+(this.to-this.from)*f/(F-1);return A`<text x=${b(g)} y=${d-8} text-anchor=${f===0?"start":f===F-1?"end":"middle"}>${new Date(g*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}</text>`})}
|
||
<g clip-path="url(#plot-clip)">${t.map(a=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&a.counter&&a.aggregation!=="raw",g=this.color(a.entity_id);return f?a.points.filter(x=>this.value(x)!==null).map(x=>A`<rect fill=${g} opacity=".65" x=${b(x.t)} y=${Math.min(m(this.value(x)),m(0))} width=${Math.max(1,Math.min(h,b(x.t+Math.max(1,x.d)))-b(x.t)-1)} height=${Math.max(1,Math.abs(m(this.value(x))-m(0)))}/>`):A`${this.band&&a.aggregation!=="raw"&&!a.counter?A`<path d=${Z(a,"min")} fill="none" stroke=${g} opacity=".3"/><path d=${Z(a,"max")} fill="none" stroke=${g} opacity=".3"/>`:u}<path d=${Z(a)} fill="none" stroke=${g} stroke-width="2" vector-effect="non-scaling-stroke"/>${a.points.length===1?A`<circle cx=${b(a.points[0].t)} cy=${m(y(a.points[0]))} r="3" fill=${g}/>`:u}`})}${this.hover!==null?A`<line x1=${b(this.hover)} x2=${b(this.hover)} y1=${p} y2=${c} stroke="currentColor" stroke-dasharray="3 4" opacity=".5"/>`:u}</g>
|
||
</svg></section>`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return v`<div class="table"><table><thead><tr><th>Zeit</th><th>Variable</th><th>Wert</th></tr></thead><tbody>${i.slice(e*100,(e+1)*100).map(n=>v`<tr><td>${this.stamp(n.t)}</td><td>${z(this.hass,n.id)}</td><td>${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}</td></tr>`)}</tbody></table></div><div class="actions"><button ?disabled=${!e} @click=${()=>{this.page=e-1}}>Zurück</button><span>${e+1} / ${r}</span><button ?disabled=${e>=r-1} @click=${()=>{this.page=e+1}}>Weiter</button></div>`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return v`<dialog aria-label="Variablentrend" @close=${()=>this.remove()} @keydown=${e=>{e.stopPropagation();let n=this.renderRoot.querySelector(".settings");e.key==="Escape"&&n?.open&&(e.preventDefault(),n.open=!1)}} @click=${e=>{let n=this.renderRoot.querySelector(".settings");n?.open&&!e.composedPath().includes(n)&&(n.open=!1)}}>
|
||
<header><div><h2>${this.label||"Variablentrend"}</h2><span class="range">${new Date(this.from*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})} – ${new Date(this.to*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})}</span></div><button aria-label="Schließen" @click=${()=>this.renderRoot.querySelector("dialog")?.close()}>×</button></header>
|
||
<div class="body"><div class="toolbar"><div class="presets">${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>v`<button aria-pressed=${this.to-this.from===n} @click=${()=>{let o=Math.floor(Date.now()/1e3);this.range(o-Number(n),o)}}>${e}</button>`)}</div>
|
||
<div class="navigation"><button aria-label="Vorheriger Zeitraum" title="Vorheriger Zeitraum" @click=${()=>this.range(this.from-(this.to-this.from),this.from)}>←</button><button aria-label="Nächster Zeitraum" title="Nächster Zeitraum" @click=${()=>this.range(this.to,this.to+(this.to-this.from))}>→</button><button aria-label="Hineinzoomen" title="Hineinzoomen" @click=${()=>this.zoom(.5)}>+</button><button aria-label="Herauszoomen" title="Herauszoomen" @click=${()=>this.zoom(2)}>−</button><button aria-label="Aktualisieren" title="Aktualisieren" aria-busy=${this.loading} @click=${()=>{this.load()}} ?disabled=${this.loading}>↻</button></div>
|
||
<label class="live-toggle" title="Alle 30 Sekunden aktualisieren"><input type="checkbox" .checked=${this.live} @change=${e=>{this.live=e.target.checked}}/> Live</label>
|
||
<details class="settings"><summary aria-label="Trend-Einstellungen" title="Zeitraum, Auflösung und Darstellung">⚙︎</summary><div class="settings-panel">
|
||
<form @submit=${e=>{e.preventDefault(),this.load()}}><div class="fields time-fields">
|
||
<label>Von<input type="datetime-local" .value=${at(this.from)} @change=${e=>{this.from=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||
<label>Bis<input type="datetime-local" .value=${at(this.to)} @change=${e=>{this.to=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||
<label>Auflösung<select .value=${this.resolution} @change=${e=>{this.resolution=e.target.value,this.load()}}>${Object.entries(Tt).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||
<button type="submit" ?disabled=${this.loading}>${this.loading?"L\xE4dt \u2026":"Anzeigen"}</button>
|
||
</div></form>
|
||
<div class="display-settings"><b class="group-title">Darstellung und Wertebereich</b><div class="fields display-fields">
|
||
<label>Darstellung<select .value=${this.chartStyle} @change=${e=>{this.chartStyle=e.target.value}}>${Object.entries({auto:"Automatisch",line:"Linie",step:"Stufen",bar:"Balken",table:"Tabelle"}).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||
<label>Aggregierter Wert<select .value=${this.field} @change=${e=>{this.field=e.target.value}}><option value="v">Mittelwert / Verbrauch</option><option value="min">Minimum</option><option value="max">Maximum</option></select></label>
|
||
<label>Y-Minimum<input type="number" step="any" placeholder="Automatisch" .value=${this.min} @input=${e=>{this.min=e.target.value}}/></label>
|
||
<label>Y-Maximum<input type="number" step="any" placeholder="Automatisch" .value=${this.max} @input=${e=>{this.max=e.target.value}}/></label>
|
||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${e=>{this.zero=e.target.checked}}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${e=>{this.band=e.target.checked}}/> Min/Max anzeigen</label></div></div>
|
||
<div class="actions"><button @click=${()=>this.exportCsv()} ?disabled=${!t.length}>CSV</button>
|
||
<nf-help-popup .text=${"Zeitraum und Aufl\xF6sung lesen die originalen Symcon-Archivdaten. Rohdaten zeigen gespeicherte \xC4nderungen; ein zuvor bekannter Wert wird zum Beginn fortgef\xFChrt. Bei Z\xE4hlern sind aggregierte Werte der Verbrauch pro Intervall, bei Messwerten der Mittelwert. Mehrere Variablen werden einzeln dargestellt; unterschiedliche Einheiten erhalten eigene Diagramme. Zoomen: +/\u2212, Mausrad oder im Diagramm einen Zeitraum ziehen. Eigene Y-Grenzen gelten f\xFCr alle Diagramme. Begrenzte Rohdatenabfragen werden gekennzeichnet; w\xE4hle dann einen k\xFCrzeren Zeitraum oder eine Aggregation."}></nf-help-popup>
|
||
</div></div></details></div>
|
||
<div class="legend">${this.ids.map(e=>v`<label title=${String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))}><input type="checkbox" .checked=${!this.hiddenSeries.has(e)} @change=${n=>{let o=new Set(this.hiddenSeries);n.target.checked?o.delete(e):o.add(e),this.hiddenSeries=o,this.requestUpdate()}}/><i style=${`background:${this.color(e)}`}></i>${z(this.hass,e)}</label>`)}</div>
|
||
${this.errors.map(e=>v`<p class="error" role="alert">${e}</p>`)}${this.loading?v`<p class="note" role="status">Archivwerte werden geladen …</p>`:u}
|
||
${t.filter(e=>e.truncated).map(e=>v`<p class="error" role="status">${z(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||
${t.some(e=>e.counter&&e.aggregation!=="raw")?v`<p class="note">Zähler: Verbrauch pro Intervall</p>`:u}
|
||
<div class="charts" style=${`min-height:${this.plotHeight}px`}>
|
||
${this.chartStyle==="table"||i?this.table(t):[...new Set(t.filter(e=>e.type!==3).map(e=>this.unit(e.entity_id)))].map(e=>this.plot(t.filter(n=>n.type!==3&&this.unit(n.entity_id)===e),e))}
|
||
${t.some(e=>e.type===3)&&!i&&this.chartStyle!=="table"?this.table(t.filter(e=>e.type===3)):u}
|
||
${!this.loading&&t.length&&t.every(e=>!e.points.length)?v`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>`:u}
|
||
</div>
|
||
<div class="cursor"><b>${r}</b>${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,d=e.points.length;for(;o<d;){let l=o+d>>>1;e.points[l].t<=this.hover?o=l+1:d=l}n=e.points[o-1]}return v`<span style=${`color:${this.color(e.entity_id)}`}>${z(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}</span>`})}</div>
|
||
</div>
|
||
</dialog>`}static styles=[q,w`
|
||
:host { font:13px/1.4 system-ui,sans-serif; color:var(--nf-text); }
|
||
dialog { box-sizing:border-box; width:min(1080px,calc(100vw - 24px)); max-height:92vh; max-height:92dvh; padding:0; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome-solid,#1c1c1c); color:inherit; box-shadow:var(--nf-shadow); overflow:auto; }
|
||
dialog::backdrop { background:#050b16a8; }
|
||
header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-bottom:1px solid var(--nf-line); position:sticky; top:0; z-index:3; background:var(--nf-chrome-solid,#1c1c1c); }
|
||
header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 14px; min-width:0; }
|
||
h2 { font-size:15px; margin:0; }
|
||
.range { font-size:11px; color:var(--nf-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||
header button { width:26px; height:26px; font-size:19px; padding:0; flex-shrink:0; }
|
||
.body { padding:8px 12px; }
|
||
.toolbar { position:relative; display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; margin-bottom:6px; }
|
||
.presets,.navigation { display:flex; align-items:center; gap:3px; }
|
||
button,input,select { box-sizing:border-box; color:var(--nf-text); font:inherit; }
|
||
button,select,input:not([type=checkbox]),summary { border:1px solid var(--nf-line); border-radius:5px; padding:4px 7px; background:var(--nf-fill,#292929); min-width:0; }
|
||
button { cursor:pointer; font-size:12px; }
|
||
button:disabled { opacity:.45; }
|
||
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||
.toolbar button,.toolbar summary { height:26px; }
|
||
.navigation button { width:26px; padding:0; font-size:16px; }
|
||
.presets button { padding:3px 6px; font-size:11px; }
|
||
.presets button[aria-pressed=true],.settings[open]>summary { border-color:var(--nf-accent); background:color-mix(in srgb,var(--nf-accent) 16%,var(--nf-fill)); }
|
||
.live-toggle { display:flex; align-items:center; gap:3px; font-size:11px; white-space:nowrap; }
|
||
input[type=checkbox] { margin:0; }
|
||
.settings { margin-left:auto; }
|
||
.settings:not([open])>.settings-panel { display:none; }
|
||
summary { display:flex; align-items:center; justify-content:center; width:28px; padding:0; list-style:none; font-size:17px; cursor:pointer; }
|
||
summary::-webkit-details-marker { display:none; }
|
||
.settings-panel { position:absolute; z-index:2; top:calc(100% + 5px); right:0; box-sizing:border-box; width:min(620px,100%); max-height:min(62vh,480px); overflow:auto; padding:10px 12px; border:1px solid var(--nf-line); border-radius:8px; background:var(--nf-chrome-solid,#1c1c1c); box-shadow:var(--nf-shadow); }
|
||
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:7px 10px; margin:0 0 10px; }
|
||
.fields label { display:grid; gap:3px; color:var(--nf-muted); font-size:11px; }
|
||
.fields input,.fields select { height:28px; width:100%; font-size:12px; }
|
||
.time-fields button { justify-self:start; }
|
||
.display-settings { padding-top:8px; border-top:1px solid var(--nf-line); }
|
||
.group-title { display:block; margin-bottom:6px; font-size:12px; }
|
||
.actions,.checks,.legend,.cursor { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; }
|
||
.checks { margin:0 0 6px; }
|
||
.checks label,.legend label { display:flex; align-items:center; gap:4px; font-size:11px; }
|
||
.legend { margin:4px 0 0; }
|
||
.legend i { display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0; }
|
||
.legend label { max-width:100%; overflow-wrap:anywhere; }
|
||
.plot { display:block; width:100%; touch-action:none; user-select:none; }
|
||
.plot text { fill:var(--nf-muted); font:11px system-ui; }
|
||
.grid { stroke:var(--nf-line); }
|
||
h3 { font-size:11px; color:var(--nf-muted); margin:3px 0 0; }
|
||
.chart-group { margin-bottom:4px; }
|
||
.cursor { font-size:11px; align-items:baseline; border-top:1px solid var(--nf-line); padding-top:6px; }
|
||
.cursor>b { color:var(--nf-muted); font-weight:normal; }
|
||
.cursor span { overflow-wrap:anywhere; }
|
||
.note,.error { font-size:12px; margin:6px 0; }
|
||
.note { color:var(--nf-muted); }
|
||
.error { color:#ffa5a5; }
|
||
.table { overflow:auto; max-height:60vh; margin:8px 0; }
|
||
table { width:100%; border-collapse:collapse; font-size:12px; }
|
||
td,th { text-align:left; padding:5px; border-bottom:1px solid var(--nf-line); overflow-wrap:anywhere; }
|
||
td:first-child { white-space:nowrap; }
|
||
th { position:sticky; top:0; background:var(--nf-chrome-solid,#1c1c1c); }
|
||
@media(max-width:500px) {
|
||
header { padding:7px 9px; }
|
||
header>div { display:grid; gap:1px; }
|
||
h2 { font-size:14px; }
|
||
.body { padding:7px 9px; }
|
||
.toolbar { gap:4px 6px; }
|
||
.presets { gap:2px; }
|
||
.presets button { padding:3px 5px; }
|
||
.settings-panel { padding:9px; }
|
||
input[type=datetime-local] { font-size:11px; padding:3px; }
|
||
}
|
||
`]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",ht);async function _e(s,t,i){let r=zt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{ht as NfTrendDialog,_e as openTrend};
|
||
/*! Bundled license information:
|
||
|
||
@lit/reactive-element/css-tag.js:
|
||
(**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*)
|
||
|
||
@lit/reactive-element/reactive-element.js:
|
||
lit-html/lit-html.js:
|
||
lit-element/lit-element.js:
|
||
(**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*)
|
||
|
||
lit-html/is-server.js:
|
||
(**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*)
|
||
*/
|