Compare commits
7
Commits
aa42a1003b
...
symcon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dde3f4027b | ||
|
|
9374ac9e35 | ||
|
|
0cc4b35995 | ||
|
|
5090c400c2 | ||
|
|
e0ea779fcc | ||
|
|
8965a649d2 | ||
|
|
f58e0125cd |
No files matched your search
+196
-196
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var Y=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nt=Symbol(),_t=new WeakMap,D=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==nt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(G&&t===void 0){let i=n!==void 0&&n.length===1;i&&(t=_t.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&_t.set(n,t))}return t}toString(){return this.cssText}},wt=r=>new D(typeof r=="string"?r:r+"",void 0,nt),y=(r,...t)=>{let n=r.length===1?r[0]:t.reduce((i,e,o)=>i+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+r[o+1],r[0]);return new D(n,r,nt)},St=(r,t)=>{if(G)r.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let i=document.createElement("style"),e=Y.litNonce;e!==void 0&&i.setAttribute("nonce",e),i.textContent=n.cssText,r.appendChild(i)}},it=G?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let n="";for(let i of t.cssRules)n+=i.cssText;return wt(n)})(r):r;var{is:Jt,defineProperty:Xt,getOwnPropertyDescriptor:Yt,getOwnPropertyNames:Gt,getOwnPropertySymbols:Qt,getPrototypeOf:te}=Object,Q=globalThis,At=Q.trustedTypes,ee=At?At.emptyScript:"",ne=Q.reactiveElementPolyfillSupport,V=(r,t)=>r,rt={toAttribute(r,t){switch(t){case Boolean:r=r?ee:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let n=r;switch(t){case Boolean:n=r!==null;break;case Number:n=r===null?null:Number(r);break;case Object:case Array:try{n=JSON.parse(r)}catch{n=null}}return n}},Ht=(r,t)=>!Jt(r,t),Et={attribute:!0,type:String,converter:rt,reflect:!1,useDefault:!1,hasChanged:Ht};Symbol.metadata??=Symbol("metadata"),Q.litPropertyMetadata??=new WeakMap;var w=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,n=Et){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let i=Symbol(),e=this.getPropertyDescriptor(t,i,n);e!==void 0&&Xt(this.prototype,t,e)}}static getPropertyDescriptor(t,n,i){let{get:e,set:o}=Yt(this.prototype,t)??{get(){return this[n]},set(s){this[n]=s}};return{get:e,set(s){let c=e?.call(this);o?.call(this,s),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Et}static _$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;let t=te(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){let n=this.properties,i=[...Gt(n),...Qt(n)];for(let e of i)this.createProperty(e,n[e])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[i,e]of n)this.elementProperties.set(i,e)}this._$Eh=new Map;for(let[n,i]of this.elementProperties){let e=this._$Eu(n,i);e!==void 0&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let e of i)n.unshift(it(e))}else t!==void 0&&n.push(it(t));return n}static _$Eu(t,n){let i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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,n=this.constructor.elementProperties;for(let i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return St(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,n,i){this._$AK(t,i)}_$ET(t,n){let i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:rt).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(e):this.setAttriLine truncated
|
||||
\f\r]`,j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rt=/-->/g,Nt=/>/g,k=RegExp(`>|${ot}(?:([^\\s"'>=/]+)(${ot}*=${ot}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Pt=/'/g,Mt=/"/g,zt=/^(?:script|style|textarea|title)$/i,pt=r=>(t,...n)=>({_$litType$:r,strings:t,values:n}),d=pt(1),ye=pt(2),ve=pt(3),N=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Tt=new WeakMap,C=R.createTreeWalker(R,129);function Ut(r,t){if(!ht(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ct!==void 0?Ct.createHTML(t):t}var oe=(r,t)=>{let n=r.length-1,i=[],e,o=t===2?"<svg>":t===3?"<math>":"",s=j;for(let c=0;c<n;c++){let l=r[c],h,p,u=-1,m=0;for(;m<l.length&&(s.lastIndex=m,p=s.exec(l),p!==null);)m=s.lastIndex,s===j?p[1]==="!--"?s=Rt:p[1]!==void 0?s=Nt:p[2]!==void 0?(zt.test(p[2])&&(e=RegExp("</"+p[2],"g")),s=k):p[3]!==void 0&&(s=k):s===k?p[0]===">"?(s=e??j,u=-1):p[1]===void 0?u=-2:(u=s.lastIndex-p[2].length,h=p[1],s=p[3]===void 0?k:p[3]==='"'?Mt:Pt):s===Mt||s===Pt?s=k:s===Rt||s===Nt?s=j:(s=k,e=void 0);let $=s===k&&r[c+1].startsWith("/>")?" ":"";o+=s===j?l+ie:u>=0?(i.push(h),l.slice(0,u)+Ot+l.slice(u)+A+$):l+A+(u===-2?c:$)}return[Ut(r,o+(r[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},K=class r{constructor({strings:t,_$litType$:n},i){let e;this.parts=[];let o=0,s=0,c=t.length-1,l=this.parts,[h,p]=oe(t,n);if(this.el=r.createElement(h,i),C.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(e=C.nextNode())!==null&&l.length<c;){if(e.nodeType===1){if(e.hasAttributes())for(let u of e.getAttributeNames())if(u.endsWith(Ot)){let m=p[s++],$=e.getAttribute(u).split(A),_=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:_[2],strings:$,ctor:_[1]==="."?at:_[1]==="?"?lt:_[1]==="@"?ct:M}),e.removeAttribute(u)}else u.startsWith(A)&&(l.push({type:6,index:o}),e.removeAttribute(u));if(zt.test(e.tagName)){let u=e.textContent.split(A),m=u.length-1;if(m>0){e.textContent=tt?tt.emptyScript:"";for(let $=0;$<m;$++)e.append(u[$],B()),C.nextNode(),l.push({type:2,index:++o});e.append(u[m],B())}}}else if(e.nodeType===8)if(e.data===Ft)l.push({type:2,index:o});else{let u=-1;for(;(u=e.data.indexOf(A,u+1))!==-1;)l.push({type:7,index:o}),u+=A.length-1}o++}}static createElement(t,n){let i=R.createElement("template");return i.innerHTML=t,i}};function P(r,t,n=r,i){if(t===N)return t;let e=i!==void 0?n._$Co?.[i]:n._$Cl,o=I(t)?void 0:t._$litDirective$;return e?.constructor!==o&&(e?._$AO?.(!1),o===void 0?e=void 0:(e=new o(r),e._$AT(r,n,i)),i!==void 0?(n._$Co??=[])[i]=e:n._$Cl=e),e!==void 0&&(t=P(r,e._$AS(r,t.values),e,i)),t}var st=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:i}=this._$AD,e=(t?.creationScope??R).importNode(n,!0);C.currentNode=e;let o=C.nextNode(),s=0,c=0,l=i[0];for(;l!==void 0;){if(s===l.index){let h;l.type===2?h=new W(o,o.nextSibling,this,t):l.type===1?h=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(h=new ut(o,this,t)),this._$AV.push(h),l=i[++c]}s!==l?.index&&(o=C.nextNode(),s++)}return C.currentNode=R,e}p(t){let n=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}},W=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,i,e){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=P(this,t,n),I(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==N&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):re(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!==a&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(R.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:i}=t,e=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=K.createElement(Ut(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===e)this._$AH.p(n);else{let o=new st(e,this),s=o.u(this.options);o.p(n),this.T(s),this._$AH=o}}_$AC(t){let n=Tt.get(t.strings);return n===void 0&&Tt.set(t.strings,n=new K(t)),n}k(t){ht(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,i,e=0;for(let o of t)e===n.length?n.push(i=new r(this.O(B()),this.O(B()),this,this.options)):i=n[e],i._$AI(o),e++;e<n.length&&(this._$AR(i&&i._$AB.nextSibling,e),n.length=e)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let i=kt(t).nextSibling;kt(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,e,o){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=e,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=Line truncated
|
||||
var G=globalThis,Q=G.ShadowRoot&&(G.ShadyCSS===void 0||G.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,it=Symbol(),wt=new WeakMap,j=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==it)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(Q&&t===void 0){let i=n!==void 0&&n.length===1;i&&(t=wt.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&wt.set(n,t))}return t}toString(){return this.cssText}},At=r=>new j(typeof r=="string"?r:r+"",void 0,it),y=(r,...t)=>{let n=r.length===1?r[0]:t.reduce((i,e,s)=>i+(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)+r[s+1],r[0]);return new j(n,r,it)},St=(r,t)=>{if(Q)r.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let i=document.createElement("style"),e=G.litNonce;e!==void 0&&i.setAttribute("nonce",e),i.textContent=n.cssText,r.appendChild(i)}},rt=Q?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let n="";for(let i of t.cssRules)n+=i.cssText;return At(n)})(r):r;var{is:Xt,defineProperty:Yt,getOwnPropertyDescriptor:Gt,getOwnPropertyNames:Qt,getOwnPropertySymbols:te,getPrototypeOf:ee}=Object,tt=globalThis,Et=tt.trustedTypes,ne=Et?Et.emptyScript:"",ie=tt.reactiveElementPolyfillSupport,B=(r,t)=>r,st={toAttribute(r,t){switch(t){case Boolean:r=r?ne:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let n=r;switch(t){case Boolean:n=r!==null;break;case Number:n=r===null?null:Number(r);break;case Object:case Array:try{n=JSON.parse(r)}catch{n=null}}return n}},kt=(r,t)=>!Xt(r,t),Ht={attribute:!0,type:String,converter:st,reflect:!1,useDefault:!1,hasChanged:kt};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=new WeakMap;var w=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,n=Ht){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let i=Symbol(),e=this.getPropertyDescriptor(t,i,n);e!==void 0&&Yt(this.prototype,t,e)}}static getPropertyDescriptor(t,n,i){let{get:e,set:s}=Gt(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:e,set(o){let c=e?.call(this);s?.call(this,o),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ht}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;let t=ee(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){let n=this.properties,i=[...Qt(n),...te(n)];for(let e of i)this.createProperty(e,n[e])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[i,e]of n)this.elementProperties.set(i,e)}this._$Eh=new Map;for(let[n,i]of this.elementProperties){let e=this._$Eu(n,i);e!==void 0&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let e of i)n.unshift(rt(e))}else t!==void 0&&n.push(rt(t));return n}static _$Eu(t,n){let i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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,n=this.constructor.elementProperties;for(let i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return St(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,n,i){this._$AK(t,i)}_$ET(t,n){let i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void 0&&i.reflect===!0){let s=(i.converter?.toAttribute!==void 0?i.converter:st).toAttribute(n,i.type);this._$Em=t,s==null?this.removeAttribute(e):this.setALine truncated
|
||||
\f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Nt=/-->/g,Pt=/>/g,k=RegExp(`>|${ot}(?:([^\\s"'>=/]+)(${ot}*=${ot}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Mt=/'/g,Tt=/"/g,Ut=/^(?:script|style|textarea|title)$/i,ft=r=>(t,...n)=>({_$litType$:r,strings:t,values:n}),d=ft(1),ve=ft(2),xe=ft(3),N=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Ot=new WeakMap,C=R.createTreeWalker(R,129);function Lt(r,t){if(!pt(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rt!==void 0?Rt.createHTML(t):t}var oe=(r,t)=>{let n=r.length-1,i=[],e,s=t===2?"<svg>":t===3?"<math>":"",o=I;for(let c=0;c<n;c++){let l=r[c],h,p,u=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===I?p[1]==="!--"?o=Nt:p[1]!==void 0?o=Pt:p[2]!==void 0?(Ut.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=k):p[3]!==void 0&&(o=k):o===k?p[0]===">"?(o=e??I,u=-1):p[1]===void 0?u=-2:(u=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?k:p[3]==='"'?Tt:Mt):o===Tt||o===Mt?o=k:o===Nt||o===Pt?o=I:(o=k,e=void 0);let $=o===k&&r[c+1].startsWith("/>")?" ":"";s+=o===I?l+re:u>=0?(i.push(h),l.slice(0,u)+Ft+l.slice(u)+S+$):l+S+(u===-2?c:$)}return[Lt(r,s+(r[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},q=class r{constructor({strings:t,_$litType$:n},i){let e;this.parts=[];let s=0,o=0,c=t.length-1,l=this.parts,[h,p]=oe(t,n);if(this.el=r.createElement(h,i),C.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(e=C.nextNode())!==null&&l.length<c;){if(e.nodeType===1){if(e.hasAttributes())for(let u of e.getAttributeNames())if(u.endsWith(Ft)){let g=p[o++],$=e.getAttribute(u).split(S),_=/([.?@])?(.*)/.exec(g);l.push({type:1,index:s,name:_[2],strings:$,ctor:_[1]==="."?lt:_[1]==="?"?ct:_[1]==="@"?ut:T}),e.removeAttribute(u)}else u.startsWith(S)&&(l.push({type:6,index:s}),e.removeAttribute(u));if(Ut.test(e.tagName)){let u=e.textContent.split(S),g=u.length-1;if(g>0){e.textContent=et?et.emptyScript:"";for(let $=0;$<g;$++)e.append(u[$],K()),C.nextNode(),l.push({type:2,index:++s});e.append(u[g],K())}}}else if(e.nodeType===8)if(e.data===zt)l.push({type:2,index:s});else{let u=-1;for(;(u=e.data.indexOf(S,u+1))!==-1;)l.push({type:7,index:s}),u+=S.length-1}s++}}static createElement(t,n){let i=R.createElement("template");return i.innerHTML=t,i}};function M(r,t,n=r,i){if(t===N)return t;let e=i!==void 0?n._$Co?.[i]:n._$Cl,s=W(t)?void 0:t._$litDirective$;return e?.constructor!==s&&(e?._$AO?.(!1),s===void 0?e=void 0:(e=new s(r),e._$AT(r,n,i)),i!==void 0?(n._$Co??=[])[i]=e:n._$Cl=e),e!==void 0&&(t=M(r,e._$AS(r,t.values),e,i)),t}var at=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:i}=this._$AD,e=(t?.creationScope??R).importNode(n,!0);C.currentNode=e;let s=C.nextNode(),o=0,c=0,l=i[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new Z(s,s.nextSibling,this,t):l.type===1?h=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(h=new dt(s,this,t)),this._$AV.push(h),l=i[++c]}o!==l?.index&&(s=C.nextNode(),o++)}return C.currentNode=R,e}p(t){let n=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}},Z=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,i,e){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=M(this,t,n),W(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==N&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):se(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!==a&&W(this._$AH)?this._$AA.nextSibling.data=t:this.T(R.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:i}=t,e=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=q.createElement(Lt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===e)this._$AH.p(n);else{let s=new at(e,this),o=s.u(this.options);s.p(n),this.T(o),this._$AH=s}}_$AC(t){let n=Ot.get(t.strings);return n===void 0&&Ot.set(t.strings,n=new q(t)),n}k(t){pt(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,i,e=0;for(let s of t)e===n.length?n.push(i=new r(this.O(K()),this.O(K()),this,this.options)):i=n[e],i._$AI(s),e++;e<n.length&&(this._$AR(i&&i._$AB.nextSibling,e),n.length=e)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let i=Ct(t).nextSibling;Ct(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,e,s){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=e,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -29,7 +29,7 @@ var Y=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,Ve=y`
|
||||
`,je=y`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -40,7 +40,7 @@ var Y=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,je=y`
|
||||
`,Be=y`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
@@ -203,32 +203,33 @@ var Y=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function gt(r,t){let n=new Set;return t.flatMap(i=>{let e=String(r?.states[i]?.attributes.symcon_source_entity||i),o=r?.states[e]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||n.has(s)?[]:(n.add(s),[e])})}var Vt,bt=class extends v{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Vt??=import(n).catch(e=>{throw Vt=void 0,e}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!gt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return d`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
|
||||
`;function bt(r,t){let n=new Set;return t.flatMap(i=>{let e=String(r?.states[i]?.attributes.symcon_source_entity||i),s=r?.states[e]?.attributes,o=Number(s?.symcon_id);return!o||!s?.symcon_archive||n.has(o)?[]:(n.add(o),[e])})}var jt,yt=class extends v{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(jt??=import(n).catch(e=>{throw jt=void 0,e}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!bt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return d`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?d`<span role="alert">${this.error}</span>`:a}`}static styles=y`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",bt);function X(r,t,n=""){let i=gt(r,t);return i.length?d`<nf-trend-button .hass=${r} .ids=${i} .label=${n}></nf-trend-button>`:a}var pe={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},Bt=r=>r.name||pe[r.type],It=r=>r.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[r.kind],Kt=(r,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":g(t.mode_entity)&&b(r.states[t.mode_entity])===null?"Betriebsart \u2013":Number(g(t.mode_entity)?b(r.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",et=(r,t,n)=>[f(r,"Vorlauf",t),f(r,"R\xFCcklauf",n)].filter(i=>i!==null),yt=(r,t,n)=>{let i=E(r,t),e=E(r,n);return i===null||e===null?a:d`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(i-e).toLocaleString(r.language,{maximumFractionDigits:1})} K</b></div>`};function Wt(r,t){let n=F(t),i=t.type==="freshwater_station"?[]:et(r,n.flow,n.return);if(t.type==="buffer_tank"&&i.unshift(...[...n.sensors??[]].sort((e,o)=>o.level-e.level).flatMap(e=>{let o=f(r,e.name||"F\xFChler",e.entity);return o?[o]:[]})),t.type==="freshwater_station"){let e=f(r,"Zirkulation",n.circulation_temperature);e&&i.push(e)}for(let e of t.values??[]){let o=f(r,e.label||String(e.entity&&r.states[e.entity]?.attributes.friendly_name||"Wert"),e.entity);o&&i.push({...o,icon:e.icon})}return i}function qt(r,t){return[...et(r,t.flow,t.return),...[["Kaltwasser",t.cold_water],["Trinkwarmwasser",t.hot_water],["Pumpenleistung",t.power]].flatMap(([n,i])=>{let e=f(r,n,i);return e?[e]:[]})]}var vt=(r,t)=>`K${t+1} \xB7 ${r.name||`Station ${t+1}`}`,H=(r,t)=>d`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?d`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${X(r,[t.id],t.label)}</b></div>`;function L(r,t,n){let i=S(r,n);return i.id?d`<div class="reading" data-source=${i.id}><span>${t}<small>${i.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${i.running===null?"#888":i.running?"#6fe1a2":"#465361"}`}></i>${U(r.states[i.id])}${X(r,[i.id],t)}</b></div>`:a}var Zt=y`
|
||||
</button>${this.error?d`<span role="alert">${this.error}</span>`:a}`}static styles=y`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",yt);function D(r,t,n=""){let i=bt(r,t);return i.length?d`<nf-trend-button .hass=${r} .ids=${i} .label=${n}></nf-trend-button>`:a}var fe={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},It=r=>r.name||fe[r.type],Kt=r=>r.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[r.kind],Wt=(r,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":f(t.mode_entity)&&b(r.states[t.mode_entity])===null?"Betriebsart \u2013":Number(f(t.mode_entity)?b(r.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",nt=(r,t,n)=>[m(r,"Vorlauf",t),m(r,"R\xFCcklauf",n)].filter(i=>i!==null),vt=(r,t,n)=>{let i=E(r,t),e=E(r,n);return i===null||e===null?a:d`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(i-e).toLocaleString(r.language,{maximumFractionDigits:1})} K</b></div>`};function qt(r,t){let n=z(t),i=t.type==="freshwater_station"?[]:nt(r,n.flow,n.return);if(t.type==="buffer_tank"&&i.unshift(...[...n.sensors??[]].sort((e,s)=>s.level-e.level).flatMap(e=>{let s=m(r,e.name||"F\xFChler",e.entity);return s?[s]:[]})),t.type==="freshwater_station"){let e=m(r,"Zirkulation",n.circulation_temperature);e&&i.push(e)}for(let e of t.values??[]){let s=m(r,e.label||String(e.entity&&r.states[e.entity]?.attributes.friendly_name||"Wert"),e.entity);s&&i.push({...s,icon:e.icon})}return i}function Zt(r,t){return[...nt(r,t.flow,t.return),...[["Kaltwasser",t.cold_water],["Trinkwarmwasser",t.hot_water],["Pumpenleistung",t.power]].flatMap(([n,i])=>{let e=m(r,n,i);return e?[e]:[]})]}var xt=(r,t)=>`K${t+1} \xB7 ${r.name||`Station ${t+1}`}`,H=(r,t)=>d`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?d`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${D(r,[t.id],t.label)}</b></div>`,P=(r,t,n="Status")=>{let i=m(r,n,t);return i?d`<div class="reading status-reading" data-source=${i.id}><span>${n}</span><b><span class="status-text" title=${i.text}>${i.text}</span>${D(r,[i.id],n)}</b></div>`:a};function V(r,t,n){let i=A(r,n);return i.id?d`<div class="reading" data-source=${i.id}><span>${t}<small>${i.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${i.running===null?"#888":i.running?"#6fe1a2":"#465361"}`}></i>${L(r.states[i.id])}${D(r,[i.id],t)}</b></div>`:a}var Jt=y`
|
||||
:host{display:block;color:var(--nf-text);font:12px/1.4 system-ui,sans-serif;min-width:170px;max-width:300px}
|
||||
button{font:inherit;color:inherit;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:7px;padding:5px 8px;cursor:pointer}button:disabled,input:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}
|
||||
.title{display:block;width:100%;padding:0 0 5px;border:0;background:none;font-weight:600;text-align:left;white-space:normal}.content{max-height:250px;overflow:auto;overscroll-behavior:contain}.circuit{border-top:1px solid var(--nf-line);padding:5px 0}.circuit-name{font-size:11px;font-weight:600;margin-bottom:3px}.reading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:22px}.reading>span{color:var(--nf-muted);white-space:normal}.reading b{display:flex;align-items:center;justify-content:flex-end;white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.reading small{font-size:9px;margin-left:5px;opacity:.75}.delta{font-size:10px}.lamp{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;margin-right:5px}.empty{color:var(--nf-muted);font-size:11px;white-space:normal;margin:5px 0}nf-trend-button{margin-left:3px}
|
||||
.status-reading{grid-template-columns:auto minmax(0,1fr)}.status-reading b{min-width:0}.status-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.circuit-name small,h3 small{font-size:10px;color:var(--nf-muted);font-weight:normal;margin-left:5px}
|
||||
ha-icon{--mdc-icon-size:13px;width:13px;height:13px;vertical-align:middle}
|
||||
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);border:1px solid var(--nf-line);border-radius:14px;box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui,sans-serif}dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--nf-line)}h2{font-size:17px;margin:0}.body{padding:12px 18px;max-height:calc(100dvh - 120px);overflow:auto;overscroll-behavior:contain}h3{font-size:13px;margin:12px 0 7px}fieldset{min-width:0;margin:8px 0;padding:10px;border:1px solid var(--nf-line);border-radius:9px}legend{font-size:12px;color:var(--nf-muted)}.command{display:flex;align-items:center;gap:12px;margin-top:8px}.command input[type=range]{flex:1;min-width:0;accent-color:var(--nf-accent)}.command input[type=number]{width:90px;box-sizing:border-box;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:6px;color:inherit;padding:5px}.command output{font-variant-numeric:tabular-nums;min-width:45px;text-align:right}.error{color:#ff9b9b}.readonly{color:var(--nf-muted);font-size:11px;margin:4px 0}.body .reading{padding:4px 0}.body .circuit{padding-bottom:12px}
|
||||
`,xt=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=F(this.item),n=Wt(this.hass,this.item),i=this.item.type==="freshwater_station"?O(this.item):[];return d`<button class="title" @click=${()=>jt(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${Bt(this.item)} ⚙</button><div class="content">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit"><div class="circuit-name">${It(e)} <small>${Kt(this.hass,e)}</small></div>${q(e)?L(this.hass,"Pumpe",e.pump):a}${Z(e)?L(this.hass,"Ventil",e.valve):a}${et(this.hass,e.flow,e.return).map(o=>H(this.hass,o))}${f(this.hass,"Leistung",e.power)?H(this.hass,f(this.hass,"Leistung",e.power)):a}</section>`):a}
|
||||
${i.length>1?d`<small class="cascade-count">Kaskade · ${i.length} Stationen</small>${i.map((e,o)=>{let s=S(this.hass,e.pump),c=f(this.hass,"Trinkwarmwasser",e.hot_water)||f(this.hass,"Vorlauf",e.flow);return d`<div class="station-summary" data-station=${e.id}><button class="station-name" @click=${()=>jt(this.hass,this.item,this.readOnly,e.id)}><i class="lamp" title=${`Pumpe: ${s.id?U(this.hass.states[s.id]):"\u2013"}`} style=${`background:${s.running===null?"#888":s.running?"#6fe1a2":"#a82638"}`}></i>${vt(e,o)}</button><b>${c?.text||"\u2013"}</b>${c?X(this.hass,[c.id],`${vt(e,o)} \xB7 ${c.label}`):a}</div>`})}`:i.map(e=>d`<section class="circuit">${qt(this.hass,e).map(o=>H(this.hass,o))}${L(this.hass,"Ladepumpe",e.pump)}${T(e)?L(this.hass,"Kaskadenventil",e.valve):a}</section>`)}
|
||||
${n.map(e=>H(this.hass,e))}${this.item.type==="freshwater_station"?L(this.hass,"Zirkulationspumpe",t.circulation):a}
|
||||
${this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"&&!n.length?d`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
|
||||
</div>`}static styles=[mt,Zt,y`.cascade-count{color:var(--nf-muted)}.station-summary{display:grid;grid-template-columns:minmax(0,1fr) auto 18px;align-items:center;gap:6px;width:100%;padding:5px 0;font-size:11px}.station-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;background:none;border:0;text-align:left}.station-summary b{white-space:nowrap;font-variant-numeric:tabular-nums}`]},$t=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},focusStation:{attribute:!1},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal(),this.focusStation&&this.shadowRoot.querySelector(`[data-station="${CSS.escape(this.focusStation)}"]`)?.scrollIntoView({block:"start"})}async send(t,n){let i=this.hass.states[t];if(!(this.readOnly||!i?.attributes.symcon_has_action||b(i)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(e){this.error=e instanceof Error?e.message:String(e)}finally{this.pending=new Set([...this.pending].filter(e=>e!==t))}}}control(t,n){if(!g(n?.command)&&!g(n?.feedback))return a;let i=g(n?.command)?n.command:null,e=i?this.hass.states[i]:void 0,o=e?.attributes,s=b(e),c=!!i&&!!o?.symcon_has_action&&s!==null&&!this.readOnly&&!this.pending.has(i),l=Number(o?.symcon_min??0),h=Number(o?.symcon_max??100),p=Number(o?.symcon_step||(o?.symcon_variable_type===1?1:.1)),u=z(e),m=$=>{let _=$.target;i&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(i,_.valueAsNumber)};return d`<fieldset data-control=${t}><legend>${t}</legend>${L(this.hass,t,n)}
|
||||
${i?d`<div class="reading"><span>Befehl / Sollwert</span><b>${U(e)}${X(this.hass,[i],`${t} \xB7 Sollwert`)}</b></div>
|
||||
${o?.symcon_variable_type===0?d`<div class="command"><button data-command=${i} ?disabled=${!c} @click=${()=>{this.send(i,!J(e))}}>${J(e)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(o?.symcon_variable_type))?d`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${i} min=${l} max=${h} step=${p} .value=${String(u??l)} ?disabled=${!c} @change=${m}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${h} step=${p} .value=${u===null?"":String(u)} ?disabled=${!c} @change=${m}/></div>`:a}
|
||||
${this.readOnly?d`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:o?.symcon_has_action?a:d`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
|
||||
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=F(this.item),n=Wt(this.hass,this.item),i=this.item.type==="freshwater_station"?O(this.item):[];return d`<dialog @close=${()=>{this.remove(),x===this&&(x=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${Bt(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit" data-circuit=${e.id}><h3>${It(e)} <small>${Kt(this.hass,e)}</small></h3>${q(e)?this.control("Pumpe",e.pump):a}${Z(e)?this.control("Ventil",e.valve):a}${et(this.hass,e.flow,e.return).map(o=>H(this.hass,o))}${yt(this.hass,e.flow,e.return)}${f(this.hass,"Pumpenleistung",e.power)?H(this.hass,f(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
|
||||
${i.map((e,o)=>d`<details class="freshwater-unit" data-station=${e.id} ?open=${o===0||this.focusStation===e.id}><summary>${vt(e,o)}</summary>${qt(this.hass,e).map(s=>H(this.hass,s))}${yt(this.hass,e.flow,e.return)}${this.control("Ladepumpe",e.pump)}${T(e)?this.control("Kaskadenventil",e.valve):a}</details>`)}
|
||||
${n.map(e=>H(this.hass,e))}${this.item.type==="buffer_tank"?yt(this.hass,t.flow,t.return):a}
|
||||
`,$t=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=z(this.item),n=qt(this.hass,this.item),i=this.item.type==="freshwater_station"?F(this.item):[];return d`<button class="title" @click=${()=>Bt(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${It(this.item)} ⚙</button><div class="content">${P(this.hass,t.status,"Anlagenstatus")}
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit"><div class="circuit-name">${Kt(e)} <small>${Wt(this.hass,e)}</small></div>${P(this.hass,e.status)}${J(e)?V(this.hass,"Pumpe",e.pump):a}${X(e)?V(this.hass,"Ventil",e.valve):a}${nt(this.hass,e.flow,e.return).map(s=>H(this.hass,s))}${m(this.hass,"Leistung",e.power)?H(this.hass,m(this.hass,"Leistung",e.power)):a}</section>`):a}
|
||||
${i.length>1?d`<small class="cascade-count">Kaskade · ${i.length} Stationen</small>${i.map((e,s)=>{let o=A(this.hass,e.pump),c=m(this.hass,"Trinkwarmwasser",e.hot_water)||m(this.hass,"Vorlauf",e.flow);return d`<div class="station-summary" data-station=${e.id}><button class="station-name" @click=${()=>Bt(this.hass,this.item,this.readOnly,e.id)}><i class="lamp" title=${`Pumpe: ${o.id?L(this.hass.states[o.id]):"\u2013"}`} style=${`background:${o.running===null?"#888":o.running?"#6fe1a2":"#a82638"}`}></i>${xt(e,s)}</button><b>${c?.text||"\u2013"}</b>${c?D(this.hass,[c.id],`${xt(e,s)} \xB7 ${c.label}`):a}${P(this.hass,e.status)}</div>`})}`:i.map(e=>d`<section class="circuit">${P(this.hass,e.status)}${Zt(this.hass,e).map(s=>H(this.hass,s))}${V(this.hass,"Ladepumpe",e.pump)}${O(e)?V(this.hass,"Kaskadenventil",e.valve):a}</section>`)}
|
||||
${n.map(e=>H(this.hass,e))}${this.item.type==="freshwater_station"?V(this.hass,"Zirkulationspumpe",t.circulation):a}
|
||||
${this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"&&!n.length&&!f(t.status)?d`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
|
||||
</div>`}static styles=[gt,Jt,y`.cascade-count{color:var(--nf-muted)}.station-summary{display:grid;grid-template-columns:minmax(0,1fr) auto 18px;align-items:center;gap:6px;width:100%;padding:5px 0;font-size:11px}.station-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;background:none;border:0;text-align:left}.station-summary>.status-reading{grid-column:1/-1}.station-summary b{white-space:nowrap;font-variant-numeric:tabular-nums}`]},_t=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},focusStation:{attribute:!1},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal(),this.focusStation&&this.shadowRoot.querySelector(`[data-station="${CSS.escape(this.focusStation)}"]`)?.scrollIntoView({block:"start"})}async send(t,n){let i=this.hass.states[t];if(!(this.readOnly||!i?.attributes.symcon_has_action||b(i)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(e){this.error=e instanceof Error?e.message:String(e)}finally{this.pending=new Set([...this.pending].filter(e=>e!==t))}}}control(t,n){if(!f(n?.command)&&!f(n?.feedback))return a;let i=f(n?.command)?n.command:null,e=i?this.hass.states[i]:void 0,s=e?.attributes,o=b(e),c=!!i&&!!s?.symcon_has_action&&o!==null&&!this.readOnly&&!this.pending.has(i),l=Number(s?.symcon_min??0),h=Number(s?.symcon_max??100),p=Number(s?.symcon_step||(s?.symcon_variable_type===1?1:.1)),u=U(e),g=$=>{let _=$.target;i&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(i,_.valueAsNumber)};return d`<fieldset data-control=${t}><legend>${t}</legend>${V(this.hass,t,n)}
|
||||
${i?d`<div class="reading"><span>Befehl / Sollwert</span><b>${L(e)}${D(this.hass,[i],`${t} \xB7 Sollwert`)}</b></div>
|
||||
${s?.symcon_variable_type===0?d`<div class="command"><button data-command=${i} ?disabled=${!c} @click=${()=>{this.send(i,!Y(e))}}>${Y(e)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(s?.symcon_variable_type))?d`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${i} min=${l} max=${h} step=${p} .value=${String(u??l)} ?disabled=${!c} @change=${g}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${h} step=${p} .value=${u===null?"":String(u)} ?disabled=${!c} @change=${g}/></div>`:a}
|
||||
${this.readOnly?d`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:s?.symcon_has_action?a:d`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
|
||||
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=z(this.item),n=qt(this.hass,this.item),i=this.item.type==="freshwater_station"?F(this.item):[];return d`<dialog @close=${()=>{this.remove(),x===this&&(x=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${It(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">${P(this.hass,t.status,"Anlagenstatus")}
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit" data-circuit=${e.id}><h3>${Kt(e)} <small>${Wt(this.hass,e)}</small></h3>${P(this.hass,e.status)}${J(e)?this.control("Pumpe",e.pump):a}${X(e)?this.control("Ventil",e.valve):a}${nt(this.hass,e.flow,e.return).map(s=>H(this.hass,s))}${vt(this.hass,e.flow,e.return)}${m(this.hass,"Pumpenleistung",e.power)?H(this.hass,m(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
|
||||
${i.map((e,s)=>d`<details class="freshwater-unit" data-station=${e.id} ?open=${s===0||this.focusStation===e.id}><summary>${xt(e,s)}</summary>${P(this.hass,e.status)}${Zt(this.hass,e).map(o=>H(this.hass,o))}${vt(this.hass,e.flow,e.return)}${this.control("Ladepumpe",e.pump)}${O(e)?this.control("Kaskadenventil",e.valve):a}</details>`)}
|
||||
${n.map(e=>H(this.hass,e))}${this.item.type==="buffer_tank"?vt(this.hass,t.flow,t.return):a}
|
||||
${this.item.type==="freshwater_station"?this.control("Zirkulationspumpe",t.circulation):a}
|
||||
${!n.length&&this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"?d`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
|
||||
${!n.length&&!f(t.status)&&this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"?d`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
|
||||
${this.error?d`<p class="error" role="alert">${this.error}</p>`:a}
|
||||
</div></dialog>`}static styles=[mt,Zt,y`:host{max-width:none;min-width:0}.freshwater-unit{border-bottom:1px solid var(--nf-line);padding:8px 0}.freshwater-unit>summary{cursor:pointer;font-weight:600;padding:4px 0}`]},x=null;function en(){x?.remove(),x=null}async function jt(r,t,n=!1,i){x?.remove();let e=document.createElement("nf-hydronic-dialog");x=e,Object.assign(e,{hass:r,item:t,readOnly:n,focusStation:i}),document.body.append(e),await e.show()}function nn(r,t,n=!1){if(!x)return;let i=t.floors.flatMap(e=>e.furniture).find(e=>e.id===x.item.id);if(!i||!Dt(i.type)){x.remove(),x=null;return}Object.assign(x,{hass:r,item:i,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",xt);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",$t);export{en as closeHydronic,he as hydronicVisual,jt as openHydronic,nn as refreshHydronic};
|
||||
</div></dialog>`}static styles=[gt,Jt,y`:host{max-width:none;min-width:0}.freshwater-unit{border-bottom:1px solid var(--nf-line);padding:8px 0}.freshwater-unit>summary{cursor:pointer;font-weight:600;padding:4px 0}`]},x=null;function nn(){x?.remove(),x=null}async function Bt(r,t,n=!1,i){x?.remove();let e=document.createElement("nf-hydronic-dialog");x=e,Object.assign(e,{hass:r,item:t,readOnly:n,focusStation:i}),document.body.append(e),await e.show()}function rn(r,t,n=!1){if(!x)return;let i=t.floors.flatMap(e=>e.furniture).find(e=>e.id===x.item.id);if(!i||!Vt(i.type)){x.remove(),x=null;return}Object.assign(x,{hass:r,item:i,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",$t);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",_t);export{nn as closeHydronic,pe as hydronicVisual,Bt as openHydronic,rn as refreshHydronic};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"caption": "Designer in der Konsole öffnen",
|
||||
"caption": "Designer im Browser öffnen",
|
||||
"onClick": "echo NFSC_OpenDesigner($id);",
|
||||
"link": true
|
||||
},
|
||||
@@ -25,7 +25,7 @@
|
||||
"caption": "Alle Anmeldungen beenden und Designer öffnen",
|
||||
"onClick": "echo NFSC_RotateAccessToken($id);",
|
||||
"link": true,
|
||||
"confirm": "Alle Benutzer dieser Instanz werden abgemeldet. Der Konsolen-Designer wird anschließend neu geöffnet. Fortfahren?"
|
||||
"confirm": "Alle Benutzer dieser Instanz werden abgemeldet. Der Designer wird anschließend im Browser neu geöffnet. Fortfahren?"
|
||||
}
|
||||
],
|
||||
"status": [
|
||||
|
||||
@@ -32,11 +32,52 @@ trait NextFloorPermissions
|
||||
|
||||
private function planKey(string $kind, array $floor, string $id): string { return $kind . ':' . rawurlencode((string) $floor['id']) . ':' . rawurlencode($id); }
|
||||
|
||||
/** Keep existing grants on uniquely identified rooms/devices when an admin moves them to another floor. */
|
||||
private function migrateMovedPlanGrants(array $before, array $after): void
|
||||
{
|
||||
$index = function (array $plan): array {
|
||||
$result = [];
|
||||
foreach ($plan['floors'] ?? [] as $floor) foreach (['rooms', 'furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $item) {
|
||||
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
|
||||
if ($id === '') continue;
|
||||
$kind = $group === 'rooms' ? 'room' : $group;
|
||||
$result[$kind . ':' . $id][] = $this->planKey($kind, $floor, $id);
|
||||
}
|
||||
return $result;
|
||||
};
|
||||
$old = $index($before); $new = $index($after); $moves = [];
|
||||
foreach ($old as $id => $keys) if (count($keys) === 1 && count($new[$id] ?? []) === 1 && $keys[0] !== $new[$id][0]) $moves[$keys[0]] = $new[$id][0];
|
||||
if ($moves === []) return;
|
||||
$accounts = $this->accounts(); $changed = false;
|
||||
foreach ($accounts as &$account) foreach (['rooms', 'devices'] as $group) {
|
||||
$rows = [];
|
||||
foreach ($account[$group] ?? [] as $row) {
|
||||
$target = (string) $row['target'];
|
||||
if (isset($moves[$target])) { $target = $moves[$target]; $changed = true; }
|
||||
$level = $row['access'] === 'control' || ($rows[$target]['access'] ?? '') === 'control' ? 'control' : 'view';
|
||||
$rows[$target] = ['target' => $target, 'access' => $level];
|
||||
}
|
||||
$account[$group] = array_values($rows);
|
||||
}
|
||||
unset($account);
|
||||
if ($changed) { $this->writeJsonAttribute('Accounts', $accounts); $this->requestScope = null; }
|
||||
}
|
||||
|
||||
private function accessCatalog(): array
|
||||
{
|
||||
$rooms = []; $devices = [];
|
||||
foreach ($this->building()['floors'] ?? [] as $floor) {
|
||||
$prefix = (string) ($floor['name'] ?? 'Etage') . ' / ';
|
||||
$building = $this->building();
|
||||
$topology = $building['topology'] ?? [];
|
||||
$find = static function (string $group, ?string $id) use ($topology): array {
|
||||
foreach ($topology[$group] ?? [] as $row) if ($row['id'] === $id) return $row;
|
||||
return [];
|
||||
};
|
||||
foreach ($building['floors'] ?? [] as $floor) {
|
||||
$group = $find('buildings', $floor['outdoor_building_id'] ?? $floor['building_id'] ?? null);
|
||||
$branch = $find('branches', $floor['outdoor_branch_id'] ?? $group['branch_id'] ?? null);
|
||||
$location = $find('locations', $floor['outdoor_location_id'] ?? $branch['location_id'] ?? null);
|
||||
$parts = [$location['name'] ?? '', $branch['name'] ?? '', $group['name'] ?? '', $floor['name'] ?? 'Etage'];
|
||||
$prefix = implode(' / ', array_filter($parts, static fn(string $v): bool => $v !== '')) . ' / ';
|
||||
foreach ($floor['rooms'] ?? [] as $room) $rooms[] = ['caption' => $prefix . ($room['name'] ?? $room['id']), 'value' => $this->planKey('room', $floor, (string) $room['id'])];
|
||||
foreach (['furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $item) {
|
||||
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
|
||||
|
||||
@@ -12,17 +12,17 @@ trait NextFloorUsers
|
||||
$account = $this->accounts()[$id] ?? [];
|
||||
$catalog = $this->accessCatalog();
|
||||
$level = ['type' => 'Select', 'options' => [['caption' => 'Nur ansehen', 'value' => 'view'], ['caption' => 'Ansehen und bedienen', 'value' => 'control']]];
|
||||
$grants = static function (string $name, string $caption, array $options, array $values) use ($level): array {
|
||||
foreach ($values as $v) if (!in_array($v['target'], array_column($options, 'value'), true)) $options[] = ['caption' => '(Nicht mehr im Plan) ' . $v['target'], 'value' => $v['target']];
|
||||
$grants = function (string $name, string $caption, array $options, array $values): array {
|
||||
return ['type' => 'List', 'name' => $name, 'caption' => $caption, 'rowCount' => 5, 'add' => true, 'delete' => true, 'values' => $values,
|
||||
'columns' => [['name' => 'target', 'caption' => 'Freigabe', 'width' => 'auto', 'add' => '', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Bitte auswählen', 'value' => ''], ...$options]]],
|
||||
['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]];
|
||||
'columns' => $this->planGrantColumns($options, $values)];
|
||||
};
|
||||
$userForm = ['type' => 'ExpansionPanel', 'caption' => 'Benutzer und Zugriffsrechte', 'expanded' => true, 'items' => [
|
||||
['type' => 'ValidationTextBox', 'caption' => 'Direkter Zugang (an die Symcon-Adresse anhängen)', 'value' => '/hook/' . $this->hookPath() . '/', 'enabled' => false],
|
||||
['type' => 'Button', 'caption' => 'Anmeldeseite öffnen', 'link' => true, 'onClick' => 'echo NFSC_OpenLogin($id);'],
|
||||
['type' => 'Select', 'name' => 'AccountSelect', 'caption' => 'Benutzer auswählen', 'value' => $id, 'options' => $this->accountOptions(), 'onChange' => 'NFSC_SelectAccessUser($id, $AccountSelect);'],
|
||||
['type' => 'ValidationTextBox', 'name' => 'AccountName', 'caption' => 'Benutzername', 'value' => $account['name'] ?? ''],
|
||||
['type' => 'PasswordTextBox', 'name' => 'AccountPassword', 'caption' => 'Neues Passwort (leer = bestehendes behalten)', 'value' => ''],
|
||||
['type' => 'Button', 'name' => 'AccountReset', 'caption' => 'Passwort zurücksetzen', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_ResetUserPassword($id, $AccountSelect, $AccountPassword);'],
|
||||
['type' => 'CheckBox', 'name' => 'AccountEnabled', 'caption' => 'Zugang aktiv', 'value' => $account['enabled'] ?? true],
|
||||
['type' => 'Select', 'name' => 'AccountRole', 'caption' => 'Rolle', 'value' => $account['role'] ?? 'user', 'options' => [['caption' => 'Benutzer · Ansicht und freigegebene Bedienung', 'value' => 'user'], ['caption' => 'Admin · vollständiger Zugriff und Editor', 'value' => 'admin']]],
|
||||
['type' => 'CheckBox', 'name' => 'AccountViewAll', 'caption' => 'Alle Zustände ansehen', 'value' => $account['view_all'] ?? false],
|
||||
@@ -32,12 +32,17 @@ trait NextFloorUsers
|
||||
['type' => 'List', 'name' => 'AccountObjects', 'caption' => 'Weitere Symcon-Geräte / Datenpunkte (optional)', 'rowCount' => 4, 'add' => true, 'delete' => true, 'values' => $account['objects'] ?? [],
|
||||
'columns' => [['name' => 'target', 'caption' => 'Objekt aus dem Objektbaum', 'width' => 'auto', 'add' => 0, 'edit' => ['type' => 'SelectObject']],
|
||||
['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]],
|
||||
['type' => 'PasswordTextBox', 'name' => 'AccountPassword', 'caption' => 'Neues Passwort (leer = bestehendes behalten)', 'value' => ''],
|
||||
['type' => 'Button', 'caption' => 'Benutzer speichern', 'onClick' => 'echo NFSC_SaveAccessUser($id, $AccountSelect, $AccountName, $AccountRole, $AccountEnabled, $AccountViewAll, $AccountControlAll, json_encode($AccountRooms), json_encode($AccountDevices), json_encode($AccountObjects), $AccountPassword);'],
|
||||
['type' => 'Button', 'name' => 'AccountReset', 'caption' => 'Passwort zurücksetzen', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_ResetUserPassword($id, $AccountSelect, $AccountPassword);'],
|
||||
['type' => 'Button', 'caption' => 'Benutzer speichern', 'onClick' => [
|
||||
// Native List variables implement iteration/ArrayAccess; direct JSON encoding does not serialize their rows.
|
||||
'$rooms = []; foreach ($AccountRooms as $row) { $rooms[] = ["target" => $row["target"], "access" => $row["access"]]; }',
|
||||
'$devices = []; foreach ($AccountDevices as $row) { $devices[] = ["target" => $row["target"], "access" => $row["access"]]; }',
|
||||
'$objects = []; foreach ($AccountObjects as $row) { $objects[] = ["target" => $row["target"], "access" => $row["access"]]; }',
|
||||
'echo NFSC_SaveAccessUser($id, $AccountSelect, $AccountName, $AccountRole, $AccountEnabled, $AccountViewAll, $AccountControlAll, json_encode($rooms), json_encode($devices), json_encode($objects), $AccountPassword);',
|
||||
]],
|
||||
['type' => 'Button', 'name' => 'AccountRevoke', 'caption' => 'Benutzer abmelden', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_RevokeUserSessions($id, $AccountSelect);'],
|
||||
['type' => 'Button', 'name' => 'AccountDelete', 'caption' => 'Benutzer löschen', 'enabled' => $id !== '', 'confirm' => 'Diesen NextFloor-Benutzer einschließlich seiner Zugänge löschen?', 'onClick' => 'echo NFSC_DeleteAccessUser($id, $AccountSelect);'],
|
||||
['type' => 'PopupButton', 'caption' => 'ⓘ Rechte und Passwörter', 'popup' => ['caption' => 'Zugriffsrechte', 'items' => [
|
||||
['type' => 'Label', 'caption' => 'Die Auswahl eines Benutzers lädt dessen Einstellungen und alle drei Freigabetabellen. Änderungen werden erst durch Benutzer speichern übernommen; beim Wechsel werden nicht gespeicherte Eingaben verworfen. Das Passwortfeld wird bei jedem Wechsel geleert.'],
|
||||
['type' => 'Label', 'caption' => 'Admins dürfen den Editor und alle Geräte verwenden. Die Benutzerverwaltung bleibt ausschließlich in der Symcon-Konfiguration.'],
|
||||
['type' => 'Label', 'caption' => 'Alle Zustände ansehen ohne weitere Bedienfreigabe ist ein Zugang nur zum Lesen. Einzelne Raum- und Gerätefreigaben ergänzen diese Grundrechte. Ohne Freigabe bleibt das Gebäude sichtbar, seine Zustände werden nicht übertragen.'],
|
||||
['type' => 'Label', 'caption' => 'Eine Raumfreigabe umfasst seine verknüpften Werte, Geräte im Raum und die zugeordneten Bereichskategorien. Gerätefreigaben gelten für deren verknüpfte Datenpunkte. Bei automatischen Gerätezuordnungen die benötigten Symcon-Objekte zusätzlich auswählen oder feste Verknüpfungen im Editor setzen.'],
|
||||
@@ -57,15 +62,26 @@ trait NextFloorUsers
|
||||
return $options;
|
||||
}
|
||||
|
||||
private function planGrantColumns(array $options, array $values): array
|
||||
{
|
||||
foreach ($values as $v) if (!in_array($v['target'], array_column($options, 'value'), true)) $options[] = ['caption' => '(Nicht mehr im Plan) ' . $v['target'], 'value' => $v['target']];
|
||||
return [['name' => 'target', 'caption' => 'Freigabe', 'width' => 'auto', 'add' => '', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Bitte auswählen', 'value' => ''], ...$options]]],
|
||||
['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Nur ansehen', 'value' => 'view'], ['caption' => 'Ansehen und bedienen', 'value' => 'control']]]]];
|
||||
}
|
||||
|
||||
public function SelectAccessUser(string $UserID): void
|
||||
{
|
||||
$a = $this->accounts()[$UserID] ?? [];
|
||||
if (!$a) $UserID = '';
|
||||
$this->WriteAttributeString('SelectedAccount', $UserID);
|
||||
$catalog = $this->accessCatalog();
|
||||
$this->UpdateFormField('AccountSelect', 'options', json_encode($this->accountOptions()));
|
||||
foreach (['AccountSelect' => $UserID, 'AccountName' => $a['name'] ?? '', 'AccountEnabled' => $a['enabled'] ?? true,
|
||||
'AccountRole' => $a['role'] ?? 'user', 'AccountViewAll' => $a['view_all'] ?? false, 'AccountControlAll' => $a['control_all'] ?? false, 'AccountPassword' => ''] as $name => $value) $this->UpdateFormField($name, 'value', $value);
|
||||
foreach (['AccountRooms' => 'rooms', 'AccountDevices' => 'devices', 'AccountObjects' => 'objects'] as $name => $key) $this->UpdateFormField($name, 'values', json_encode($a[$key] ?? []));
|
||||
foreach (['AccountRooms' => 'rooms', 'AccountDevices' => 'devices', 'AccountObjects' => 'objects'] as $name => $key) {
|
||||
if ($key !== 'objects') $this->UpdateFormField($name, 'columns', json_encode($this->planGrantColumns($catalog[$key], $a[$key] ?? [])));
|
||||
$this->UpdateFormField($name, 'values', json_encode($a[$key] ?? []));
|
||||
}
|
||||
foreach (['AccountReset', 'AccountRevoke', 'AccountDelete'] as $name) $this->UpdateFormField($name, 'enabled', $UserID !== '');
|
||||
}
|
||||
|
||||
|
||||
+10
-7
@@ -10,7 +10,7 @@ require_once __DIR__ . '/libs/Permissions.php';
|
||||
* NextFloor for IP-Symcon.
|
||||
*
|
||||
* One visualization instance owns a floor-plan project. Its protected WebHook serves the designer as
|
||||
* a console tab and the same viewer in an HTML-SDK tile iframe. Admins receive the native object tree;
|
||||
* a browser tab and the same viewer in an HTML-SDK tile iframe. Admins receive the native object tree;
|
||||
* user sessions receive only authorized live bindings. Object selections always use named choices.
|
||||
*/
|
||||
class NextFloor extends IPSModuleStrict
|
||||
@@ -88,7 +88,7 @@ class NextFloor extends IPSModuleStrict
|
||||
return 'WebHook registriert: /hook/' . $this->hookPath() . '. Jetzt den Designer öffnen.';
|
||||
}
|
||||
|
||||
/** URL returned to the console form. It opens in a console tab, as IPSView does. */
|
||||
/** Browser link returned to the console form; link: does not create a native Pro Console tab. */
|
||||
public function OpenDesigner(): string
|
||||
{
|
||||
$this->requireWebHook();
|
||||
@@ -712,11 +712,14 @@ class NextFloor extends IPSModuleStrict
|
||||
if (strlen($encoded) > self::MAX_BUILDING_BYTES) {
|
||||
throw new InvalidArgumentException('building_too_large');
|
||||
}
|
||||
$this->WriteAttributeString('Building', $encoded);
|
||||
$revision = $this->ReadAttributeInteger('BuildingRevision') + 1;
|
||||
$this->WriteAttributeInteger('BuildingRevision', $revision);
|
||||
$this->UpdateVisualizationValue(json_encode(['building_revision' => $revision]));
|
||||
return $revision;
|
||||
return $this->accessLock(function () use ($building, $encoded): int {
|
||||
$this->migrateMovedPlanGrants($this->building(), $building);
|
||||
$this->WriteAttributeString('Building', $encoded);
|
||||
$revision = $this->ReadAttributeInteger('BuildingRevision') + 1;
|
||||
$this->WriteAttributeInteger('BuildingRevision', $revision);
|
||||
$this->UpdateVisualizationValue(json_encode(['building_revision' => $revision]));
|
||||
return $revision;
|
||||
});
|
||||
}
|
||||
|
||||
private function imageGet(string $imageID): array
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# NextFloor für IP-Symcon 9.0
|
||||
|
||||
Dieses Verzeichnis ist eine vollständige IP-Symcon-Bibliothek. Der gleiche NextFloor-Designer
|
||||
läuft damit in zwei Symcon-Oberflächen:
|
||||
Dieses Verzeichnis ist eine vollständige IP-Symcon-Bibliothek. NextFloor lässt sich
|
||||
über den Designer und die Kachel-Visualisierung verwenden:
|
||||
|
||||
- **Designer:** Die Instanzkonfiguration öffnet den Designer per geschütztem WebHook in einem
|
||||
eigenen Konsolen-/Browser-Tab – derselbe Ansatz, den auch IPSView für seinen Designer nutzt.
|
||||
Browser-Tab. Auch die installierte Pro-Konsole öffnet diesen Link im Standardbrowser.
|
||||
IPSViews interner Designer-Tab ist speziell in Symcons Konsole integriert; die öffentliche
|
||||
Modulschnittstelle von Symcon 9.0 bietet diesen Tab nicht für eigene Web-Oberflächen an.
|
||||
- **Kachel-Visualisierung:** Die NextFloor-Instanz kann direkt in der Tile-Visualisierung als
|
||||
HTML-SDK-Kachel abgelegt werden. Sie zeigt die 3D-Ansicht samt Bedienung.
|
||||
|
||||
@@ -16,9 +18,70 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
||||
|
||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
||||
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||
Nach der Aktualisierung auf **0.3.0 / Build 34** die Konsole neu laden. Unter
|
||||
Nach der Aktualisierung auf **0.4.3 / Build 41** die Konsole neu laden. Unter
|
||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||
|
||||
## Hierarchie und Etagen
|
||||
|
||||
Im Editor oben **Hierarchie** öffnen. Bei einem bisherigen Plan dort auf
|
||||
**Hierarchie einrichten** klicken.
|
||||
Bestehende Stockwerke werden einem ersten Ort, einer Niederlassung und einem Gebäude
|
||||
zugeordnet; ihre IDs, Geometrie, Datenpunkte und Benutzerfreigaben bleiben erhalten.
|
||||
Im separaten Dialog Orte, Niederlassungen und Gebäude benennen und weitere anlegen.
|
||||
Die drei Listen zeigen jeweils die Einträge der ausgewählten übergeordneten Ebene.
|
||||
Beispiel: **Urbach / Zentrale / RAS19 / EG / IT**.
|
||||
|
||||
- Oben im Editor unter **Ansicht** einen **Ort**, eine **Niederlassung** oder ein
|
||||
**Gebäude** auswählen. Ort und Niederlassung zeigen eine Gesamtübersicht ihrer
|
||||
untergeordneten Pläne, auch in der 3D-Hälfte. Die Knöpfe darunter öffnen die nächste
|
||||
Ebene. Eine Gesamtübersicht wählt keine Etage automatisch zur Bearbeitung aus.
|
||||
Bei Auswahl eines Gebäudes erscheinen darunter nur seine Etagen und sein Außenplan.
|
||||
**+ Etage** legt ein Stockwerk in genau diesem Gebäude an, mit eigener Höhenfolge.
|
||||
Ein Gebäudewechsel ändert keine Zuordnung und erzeugt keine Etage. Ein leeres
|
||||
Gebäude bleibt auch nach einem Neuladen der Daten ausgewählt und leer.
|
||||
- Die rechte Leiste bleibt für Etagen-, Raum- und Geräteeigenschaften verfügbar.
|
||||
Im ausgewählten Raum über **Bereich (Symcon)** die vorhandene Bereichskategorie
|
||||
verknüpfen; Räume derselben Kategorie werden in der Raumliste zusammengefasst.
|
||||
Der Raum gehört über seine Etage zum Gebäude. Die Auswahl verändert weder den
|
||||
Symcon-Objektbaum noch den Raumnamen; dafür gibt es **Bereichsnamen übernehmen**.
|
||||
- Zum Verschieben zuerst die betreffende Etage öffnen und oben
|
||||
**Ausgewählte Etage verschieben…** wählen. Der Dialog nennt ihren vollständigen
|
||||
Pfad. Erst die Schaltfläche **Etage „…“ verschieben** übernimmt das Zielgebäude;
|
||||
eine bloße Zielauswahl oder das Schließen des Dialogs ändert nichts.
|
||||
- Für einen einzelnen Raum rechts **Raum verschieben…** öffnen. Zielgebäude und
|
||||
Zieletage auswählen, bei Bedarf die vorgeschlagene Position X/Z anpassen und erst
|
||||
dann **Raum „…“ verschieben** drücken. Raumdaten, Datenpunktverknüpfungen,
|
||||
Türen/Fenster, enthaltene Möbel, platzierte Geräte und Notizen ziehen mit um.
|
||||
Der Dialog meldet Konflikte mit bereits vorhandenen Gerätekennungen. Vorhandene
|
||||
Benutzerfreigaben folgen eindeutig identifizierbaren Räumen und Geräten, auch
|
||||
beim Rückgängigmachen; Ansicht bleibt Ansicht und Bedienung bleibt Bedienung.
|
||||
- Pro **Ort**, **Niederlassung** und **Gebäude** im Hierarchiedialog über
|
||||
**Außenplan anlegen** einen eigenen Außenplan erstellen und im Editor wie
|
||||
gewohnt Außenflächen, Geräte und Möbel platzieren.
|
||||
Jeder Außenplan gehört direkt zur jeweiligen Ebene und erscheint dort auch in
|
||||
der linken Navigation mit einer passenden Vorschau. Das Außen-Popup berücksichtigt
|
||||
auch bisher auf untergeordneten Gebäudestockwerken platzierte Außen-Datenpunkte,
|
||||
ohne Werte benachbarter Niederlassungen oder Gebäude einzumischen.
|
||||
- Die linke Navigation in Designer und Kachel folgt der Topologie. Die kleinen
|
||||
Pfadknöpfe führen zu den übergeordneten Ebenen zurück. Die Vorschaubilder zeigen
|
||||
nur die Stockwerke des Eintrags; Raumvorschauen werden auf den Raum zugeschnitten.
|
||||
- Die obere Raumleiste erscheint erst bei Auswahl eines Stockwerks. In Orts-,
|
||||
Niederlassungs-, Gebäude- und Außenansichten bleibt sie ausgeblendet.
|
||||
- Die rechte Verbrauchsübersicht folgt derselben Auswahl: **Ort → Niederlassungen**,
|
||||
**Niederlassung → Gebäude**, **Gebäude → Stockwerke**, **Stockwerk → Bereiche**.
|
||||
Oben stehen jeweils die Leistungen und Verbräuche der ausgewählten Gruppe.
|
||||
Einträge öffnen die entsprechende Ebene. Eigene Außenpläne mit Zählern erscheinen
|
||||
separat unter ihrem jeweiligen Besitzer. Alle fünf Medien, eigene Stockwerkszähler,
|
||||
getrennte Verbrauchszeiträume, Trendknöpfe und „Err:“-Teilsummen bleiben erhalten.
|
||||
- Stockwerksstapel und automatische Dächer werden pro Gebäude dargestellt.
|
||||
Planpositionen bleiben unverändert. Bei Bedarf ein Gebäude über **Verschieben**
|
||||
mit **Alle Stockwerke dieses Gebäudes mitnehmen** im gemeinsamen Grundriss anordnen.
|
||||
|
||||
Auch die Freigabe-Auswahl in der Symcon-Benutzerverwaltung zeigt die vollständigen
|
||||
Pfade. Die Rechte bleiben an die bisherigen Stockwerks-, Raum- und Geräte-IDs gebunden.
|
||||
Leere Gruppen können entfernt werden; Gruppen mit untergeordneten Einträgen sind geschützt.
|
||||
Pläne ohne eingerichtete Topologie behalten ihre bisherige Navigation.
|
||||
|
||||
### Für die Entwicklung
|
||||
|
||||
IP-Symcon erwartet `library.json` im Wurzelverzeichnis eines Repositories. Das eigentliche
|
||||
@@ -41,6 +104,15 @@ Danach in IP-Symcon unter **Kerninstanzen → Modules** den Git-Link des Forks h
|
||||
im Zahnrad des Eintrags den Branch `symcon` wählen. Anschließend steht **NextFloor** bei
|
||||
„Instanz hinzufügen“ zur Verfügung.
|
||||
|
||||
### Status von Heizkreisen und Frischwasserstationen
|
||||
|
||||
Im Editor lässt sich je Heizkreis und je FriWa-Station unter **Status (optional)** eine
|
||||
Variable aus dem Symcon-Objektbaum auswählen. **Anlagenstatus (optional)** ergänzt einen
|
||||
gemeinsamen Status für das gesamte Gerät. Integer-Variablen zeigen den in Symcon
|
||||
hinterlegten Aliastext; Namen und Pfade begrenzen die Auswahl nicht. Die Statuswerte
|
||||
erscheinen in der schwebenden 3D-Kachel und im Detailfenster, bei Kaskaden je Station.
|
||||
Nicht verknüpfte Statuszeilen bleiben ausgeblendet. Die Anzeige ist schreibgeschützt.
|
||||
|
||||
Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
||||
`frontend` mit `npm run build` erzeugt beziehungsweise kopiert und gehören daher in den Branch.
|
||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
||||
@@ -56,8 +128,16 @@ Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mj
|
||||
Sie ist dauerhaft und enthält kein Zugangs-Token. Die Adresse steht außerdem
|
||||
im Formular: `/hook/nextfloor/<Instanz-ID>/` an der Symcon-Serveradresse.
|
||||
|
||||
Das Passwortfeld steht direkt unter dem Benutzernamen. Beim Benutzerwechsel werden
|
||||
Rolle, Schalter und alle drei Freigabetabellen mit den gespeicherten Werten dieses
|
||||
Benutzers neu befüllt; das Passwortfeld wird geleert. Die Auswahl **Neuen Benutzer
|
||||
anlegen** leert die Tabellen. Änderungen werden erst mit **Benutzer speichern**
|
||||
übernommen; ein Wechsel verwirft noch nicht gespeicherte Eingaben. Seit 0.3.2 werden
|
||||
die nativen Formularlisten zeilenweise übertragen, auch wenn sie leer sind oder
|
||||
gerade keine Zeile ausgewählt ist.
|
||||
|
||||
Die Konten gehören zur jeweiligen NextFloor-Instanz. Die Benutzerverwaltung
|
||||
bleibt ausschließlich in der Symcon-Konfiguration. **Designer in der Konsole
|
||||
bleibt ausschließlich in der Symcon-Konfiguration. **Designer im Browser
|
||||
öffnen** ermöglicht dem Symcon-Administrator weiterhin den vollständigen Zugang,
|
||||
auch wenn kein NextFloor-Admin mehr angemeldet ist oder alle Konten gesperrt sind.
|
||||
Der dabei erzeugte Konsolen-Link gilt 90 Sekunden und kann einmal verwendet werden.
|
||||
@@ -562,7 +642,7 @@ Nach dem Update den Designer neu laden, damit die neue Übertragung auf beiden S
|
||||
### Update bei „Hook not found“
|
||||
|
||||
Das vollständige Modul auf 0.2.1 aktualisieren und die NextFloor-Instanzkonfiguration
|
||||
neu öffnen. Einmal **„WebHook reparieren“**, anschließend **„Designer in der Konsole öffnen“**
|
||||
neu öffnen. Einmal **„WebHook reparieren“**, anschließend **„Designer im Browser öffnen“**
|
||||
anklicken. Der Eintrag gehört unter **WebHook Control → Hooks (Intern)**; ein eigener
|
||||
PHP-Skript-Hook unter „Benutzerdefiniert“ ist nicht erforderlich. Die bestehende Instanz
|
||||
nicht neu anlegen, da ihr Plan in ihren Attributen gespeichert ist.
|
||||
@@ -591,7 +671,7 @@ nicht neu anlegen, da ihr Plan in ihren Attributen gespeichert ist.
|
||||
## Einrichtung
|
||||
|
||||
1. Eine **NextFloor**-Instanz anlegen.
|
||||
2. In ihrer Konfiguration auf **„Designer in der Konsole öffnen“** klicken und den Grundriss
|
||||
2. In ihrer Konfiguration auf **„Designer im Browser öffnen“** klicken und den Grundriss
|
||||
anlegen.
|
||||
3. Für die Anzeige in der Tile-Visualisierung die Instanz wie jede andere Visualisierungs-
|
||||
Instanz als Kachel hinzufügen.
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
"compatibility": {
|
||||
"version": "9.0"
|
||||
},
|
||||
"version": "0.3.0",
|
||||
"build": 34,
|
||||
"date": 1794787200
|
||||
"version": "0.4.3",
|
||||
"build": 41,
|
||||
"date": 1795046400
|
||||
}
|
||||
@@ -77,6 +77,13 @@ $extended['floors'][0]['furniture'][0]['temp_entity2'] = 'sensor.104';
|
||||
$fixture['attributes']['Building'] = json_encode($extended);
|
||||
$as('device');
|
||||
check($method('allowedEntity', 'sensor.104', false), 'Additional temperature bindings belong to an explicitly granted device');
|
||||
$extended['floors'][0]['furniture'][0]['hydronic'] = ['status' => 'cover.104', 'circuits' => [['id' => 'c1', 'status' => 'cover.105']], 'stations' => [['id' => 's1', 'status' => 'cover.204']]];
|
||||
$fixture['attributes']['Building'] = json_encode($extended);
|
||||
$as('device');
|
||||
foreach ([104, 105, 204] as $id) check($method('allowedEntity', 'sensor.' . $id, false), 'A granted device includes its plant, circuit and station status');
|
||||
$as('empty');
|
||||
$hiddenHydronic = $method('visibleBuilding')['floors'][0]['furniture'][0]['hydronic'];
|
||||
check($hiddenHydronic['status'] === 'none' && $hiddenHydronic['circuits'][0]['status'] === 'none' && $hiddenHydronic['stations'][0]['status'] === 'none', 'Unauthorized hydronic statuses remain private');
|
||||
$fixture['attributes']['Building'] = json_encode(fixtureBuilding());
|
||||
|
||||
$as('operator');
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require __DIR__ . '/support/access-runtime.php';
|
||||
$module = new AccessFixtureModule(); initializeAccessFixture($module);
|
||||
$method = static fn(string $name, mixed ...$args): mixed => (new ReflectionMethod($module, $name))->invoke($module, ...$args);
|
||||
$as = static function (string $name) use ($module, $method): void {
|
||||
foreach ($method('accounts') as $id => $a) if ($a['name'] === $name) {
|
||||
(new ReflectionProperty(NextFloor::class, 'requestUser'))->setValue($module, [...$a, 'id' => $id, 'session_id' => 'fixture-' . $name, 'csrf' => 'fixture']);
|
||||
(new ReflectionProperty(NextFloor::class, 'requestScope'))->setValue($module, null); return;
|
||||
}
|
||||
};
|
||||
$before = $method('building'); $after = $before;
|
||||
$source = &$after['floors'][0];
|
||||
$target = [...$source, 'id' => 'og', 'name' => 'Obergeschoss', 'elevation' => 3, 'rooms' => [], 'furniture' => [], 'placements' => []];
|
||||
$target['rooms'][] = array_shift($source['rooms']);
|
||||
$target['furniture'][] = array_shift($source['furniture']);
|
||||
$target['placements'][] = array_shift($source['placements']);
|
||||
unset($source); $after['floors'][] = $target;
|
||||
$as('admin'); $method('saveBuilding', $after);
|
||||
$accounts = array_column($method('accounts'), null, 'name');
|
||||
check($accounts['office']['rooms'] === [['target' => 'room:og:office2', 'access' => 'control']], 'Room control rights follow the moved room');
|
||||
check($accounts['officeview']['rooms'] === [['target' => 'room:og:office2', 'access' => 'view']], 'Readonly room rights stay readonly');
|
||||
check($accounts['device']['devices'] === [['target' => 'furniture:og:wallbox', 'access' => 'control']], 'Explicit device rights follow its unique identity');
|
||||
check($accounts['empty']['rooms'] === [] && $accounts['empty']['devices'] === [], 'Moving cannot create a new grant');
|
||||
$as('office'); $tree = $method('visibleTree', $method('objectTree'));
|
||||
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
|
||||
check($ids === [101, 102, 103, 104, 105], 'The moved room still exposes exactly its original native variables');
|
||||
$as('device'); $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'light.102']]);
|
||||
$as('admin'); $method('saveBuilding', $before);
|
||||
$accounts = array_column($method('accounts'), null, 'name');
|
||||
check($accounts['office']['rooms'][0]['target'] === 'room:eg:office2', 'Undo restores the original grant key');
|
||||
check($accounts['device']['devices'][0]['target'] === 'furniture:eg:wallbox', 'Undo also restores the explicit device key');
|
||||
|
||||
// An ambiguous ID may be a duplicate rather than a move; never guess and widen its grant.
|
||||
$ambiguous = $after; $ambiguous['floors'][0]['furniture'][] = $target['furniture'][0];
|
||||
$method('saveBuilding', $ambiguous);
|
||||
$accounts = array_column($method('accounts'), null, 'name');
|
||||
check($accounts['device']['devices'][0]['target'] === 'furniture:eg:wallbox', 'Duplicate identities never trigger automatic grant migration');
|
||||
echo "OK: room/device grants follow unique floor moves and undo, preserve view/control levels and native visibility, reject ambiguous identities and create no grants\n";
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require __DIR__ . '/support/access-runtime.php';
|
||||
$module = new AccessFixtureModule(); initializeAccessFixture($module);
|
||||
$method = static fn(string $name, mixed ...$args): mixed => (new ReflectionMethod($module, $name))->invoke($module, ...$args);
|
||||
$accounts = $method('accounts');
|
||||
$as = static function (string $name) use ($module, $accounts): void {
|
||||
foreach ($accounts as $id => $a) if ($a['name'] === $name) {
|
||||
(new ReflectionProperty(NextFloor::class, 'requestUser'))->setValue($module, [...$a, 'id' => $id, 'session_id' => 'fixture-' . $name, 'csrf' => 'fixture']);
|
||||
(new ReflectionProperty(NextFloor::class, 'requestScope'))->setValue($module, null); return;
|
||||
}
|
||||
};
|
||||
$b = fixtureBuilding();
|
||||
$b['topology'] = ['locations' => [['id' => 'urbach', 'name' => 'Urbach'], ['id' => 'ulm', 'name' => 'Ulm']],
|
||||
'branches' => [['id' => 'hq', 'name' => 'Zentrale', 'location_id' => 'urbach'], ['id' => 'south', 'name' => 'Süd', 'location_id' => 'ulm']],
|
||||
'buildings' => [['id' => 'ras19', 'name' => 'RAS19', 'branch_id' => 'hq'], ['id' => 'ulm1', 'name' => 'RAS19', 'branch_id' => 'south']]];
|
||||
$b['floors'][0]['building_id'] = 'ras19';
|
||||
$outside = ['id' => 'garden', 'name' => 'Außen', 'building_id' => null, 'outdoor_location_id' => 'urbach', 'elevation' => 0, 'height' => 2.5,
|
||||
'rooms' => [], 'openings' => [], 'placements' => [], 'outdoor' => [], 'furniture' => [['id' => 'garden-meter', 'type' => 'wallbox', 'name' => 'Gartengerät', 'entity' => 'sensor.203', 'x' => 1, 'z' => 2]]];
|
||||
$b['floors'][] = $outside;
|
||||
$b['floors'][] = [...$outside, 'id' => 'branch-garden', 'outdoor_location_id' => null, 'outdoor_branch_id' => 'hq', 'furniture' => [[...$outside['furniture'][0], 'id' => 'branch-meter', 'name' => 'Hofgerät']]];
|
||||
$b['floors'][] = [...$outside, 'id' => 'building-garden', 'outdoor_location_id' => null, 'outdoor_building_id' => 'ras19', 'furniture' => [[...$outside['furniture'][0], 'id' => 'building-meter', 'name' => 'Terrassengerät']]];
|
||||
$as('admin'); $method('authorizeApi', 'building/save', ['building' => $b]); $method('saveBuilding', $b);
|
||||
check($method('building')['topology'] === $b['topology'], 'The complete hierarchy persists without changing native links');
|
||||
$form = $module->GetConfigurationForm();
|
||||
check(str_contains($form, 'Urbach / Zentrale / RAS19 / Erdgeschoss / Büro 2'), 'Room choices include their complete topology path');
|
||||
check(str_contains($form, 'Urbach / Außen / Gartengerät'), 'Outdoor device grants belong to the location path');
|
||||
check(str_contains($form, 'Urbach / Zentrale / Außen / Hofgerät'), 'Branch outdoor device grants use their own full path');
|
||||
check(str_contains($form, 'Urbach / Zentrale / RAS19 / Außen / Terrassengerät'), 'Building outdoor device grants use their own full path');
|
||||
|
||||
$as('office');
|
||||
$tree = $method('visibleTree', $method('objectTree'));
|
||||
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
|
||||
check($ids === [101, 102, 103, 104, 105], 'Existing room rights keep their stable key and do not grant outdoor/other-location values');
|
||||
$visible = $method('visibleBuilding');
|
||||
check($visible['topology'] === $b['topology'], 'Users retain the complete logical topology, like the building geometry');
|
||||
check($visible['floors'][1]['furniture'][0]['entity'] === 'none', 'Unapproved outdoor status is still filtered server-side');
|
||||
$as('empty');
|
||||
check($method('visibleTree', $method('objectTree'))['variables'] === [], 'Adding topology cannot grant access to an empty account');
|
||||
echo "OK: persisted five-level topology with location/branch/building outdoors; complete grant choice paths; unchanged room keys; scoped state and native permissions\n";
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require __DIR__ . '/support/access-runtime.php';
|
||||
$module = new AccessFixtureModule(); initializeAccessFixture($module);
|
||||
$method = static fn(string $name, mixed ...$args): mixed => (new ReflectionMethod($module, $name))->invoke($module, ...$args);
|
||||
|
||||
// Like a native List variable, this object is iterable/array-accessible but does not JSON-encode its rows.
|
||||
final class NativeFormList implements IteratorAggregate, ArrayAccess
|
||||
{
|
||||
public function __construct(private array $rows) {}
|
||||
public function getIterator(): Traversable { foreach ($this->rows as $row) yield new ArrayObject($row); }
|
||||
public function offsetExists(mixed $offset): bool { return isset($this->rows[$offset]); }
|
||||
public function offsetGet(mixed $offset): mixed { return $this->rows[$offset] ?? null; }
|
||||
public function offsetSet(mixed $offset, mixed $value): void { throw new LogicException('Readonly fixture'); }
|
||||
public function offsetUnset(mixed $offset): void { throw new LogicException('Readonly fixture'); }
|
||||
}
|
||||
function NFSC_SaveAccessUser(int $id, string $user, string $name, string $role, bool $enabled, bool $view, bool $control, string $rooms, string $devices, string $objects, string $password): string
|
||||
{
|
||||
global $module;
|
||||
return $module->SaveAccessUser($user, $name, $role, $enabled, $view, $control, $rooms, $devices, $objects, $password);
|
||||
}
|
||||
function NFSC_SelectAccessUser(int $id, string $user): void { global $module; $module->SelectAccessUser($user); }
|
||||
function formItems(): array
|
||||
{
|
||||
global $module;
|
||||
$form = json_decode($module->GetConfigurationForm(), true, 512, JSON_THROW_ON_ERROR);
|
||||
return array_values(array_filter($form['actions'], static fn(array $a): bool => ($a['type'] ?? '') === 'ExpansionPanel'))[0]['items'];
|
||||
}
|
||||
function clickSave(string $script, array $fields): string
|
||||
{
|
||||
extract($fields);
|
||||
$id = 12345;
|
||||
ob_start();
|
||||
try { eval($script); return (string) ob_get_contents(); }
|
||||
finally { ob_end_clean(); }
|
||||
}
|
||||
$items = formItems();
|
||||
$names = array_column($items, 'name');
|
||||
check(array_search('AccountPassword', $names, true) === array_search('AccountName', $names, true) + 1, 'Password belongs directly below the user name');
|
||||
$save = array_values(array_filter($items, static fn(array $item): bool => ($item['caption'] ?? '') === 'Benutzer speichern'))[0]['onClick'];
|
||||
$script = is_array($save) ? implode("\n", $save) : $save;
|
||||
$fields = ['AccountSelect' => '', 'AccountName' => 'form-empty', 'AccountRole' => 'user', 'AccountEnabled' => true,
|
||||
'AccountViewAll' => true, 'AccountControlAll' => false, 'AccountPassword' => 'form-test-password',
|
||||
'AccountRooms' => new NativeFormList([]), 'AccountDevices' => new NativeFormList([]), 'AccountObjects' => new NativeFormList([])];
|
||||
check(json_encode($fields['AccountRooms']) === '{}', 'Fixture reproduces the unsupported direct List serialization');
|
||||
check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'The actual save button accepts empty native form lists');
|
||||
$emptyID = $module->fields['AccountSelect']['value'];
|
||||
$empty = $method('accounts')[$emptyID];
|
||||
check($empty['rooms'] === [] && $empty['devices'] === [] && $empty['objects'] === [], 'Empty tables remain empty');
|
||||
|
||||
$rooms = [['target' => 'room:eg:office2', 'access' => 'view'], ['target' => 'room:old:removed', 'access' => 'control']];
|
||||
$devices = [['target' => 'furniture:eg:wallbox', 'access' => 'control']];
|
||||
$objects = [['target' => 900, 'access' => 'view'], ['target' => 104, 'access' => 'view']];
|
||||
$fields = [...$fields, 'AccountName' => 'form-scoped', 'AccountViewAll' => false,
|
||||
'AccountRooms' => new NativeFormList($rooms), 'AccountDevices' => new NativeFormList($devices), 'AccountObjects' => new NativeFormList($objects)];
|
||||
check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'The actual save button serializes every row, including rows that are not selected');
|
||||
$scopedID = $module->fields['AccountSelect']['value'];
|
||||
$scoped = $method('accounts')[$scopedID];
|
||||
check($scoped['rooms'] === $rooms && $scoped['devices'] === $devices && $scoped['objects'] === $objects, 'All three grant tables retain exact per-user rights');
|
||||
|
||||
$change = array_values(array_filter($items, static fn(array $item): bool => ($item['name'] ?? '') === 'AccountSelect'))[0]['onChange'];
|
||||
$select = static function (string $selected) use ($change): void { $id = 12345; $AccountSelect = $selected; eval($change); };
|
||||
$select($emptyID);
|
||||
foreach (['AccountRooms', 'AccountDevices', 'AccountObjects'] as $name) check(json_decode($module->fields[$name]['values'], true) === [], 'Switching to an unrestricted reader clears the previous grants');
|
||||
check($module->fields['AccountName']['value'] === 'form-empty' && $module->fields['AccountPassword']['value'] === '', 'User changes load the right name and clear the password field');
|
||||
check(!in_array('room:old:removed', array_column(json_decode($module->fields['AccountRooms']['columns'], true)[0]['edit']['options'], 'value'), true), 'Stale target choices do not leak into another user');
|
||||
$select($scopedID);
|
||||
foreach (['AccountRooms' => $rooms, 'AccountDevices' => $devices, 'AccountObjects' => $objects] as $name => $expected) check(json_decode($module->fields[$name]['values'], true) === $expected, 'Each table restores the selected user');
|
||||
check(in_array('room:old:removed', array_column(json_decode($module->fields['AccountRooms']['columns'], true)[0]['edit']['options'], 'value'), true), 'Previously linked missing plan targets remain visible when switching users');
|
||||
$fields = [...$fields, 'AccountSelect' => $scopedID, 'AccountPassword' => ''];
|
||||
check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'Saving an existing user permits an empty password');
|
||||
check(password_verify('form-test-password', $method('accounts')[$scopedID]['password']), 'Empty password preserves the previous hash');
|
||||
check(str_starts_with(clickSave($script, [...$fields, 'AccountSelect' => '', 'AccountName' => 'no-password']), 'Für neue Benutzer'), 'New accounts still require a password');
|
||||
$select('');
|
||||
foreach (['AccountRooms', 'AccountDevices', 'AccountObjects'] as $name) check(json_decode($module->fields[$name]['values'], true) === [], 'New user selection resets every grant table');
|
||||
check(!$module->fields['AccountReset']['enabled'] && !$module->fields['AccountDelete']['enabled'], 'New user selection disables existing-account operations');
|
||||
check($module->SaveAccessUser($emptyID, 'form-empty', 'user', true, true, false, '{"target":"room:eg:office2","access":"control"}', '[]', '[]', '') === 'Ungültige Freigabeliste.', 'A selected row cannot be mistaken for the complete grants list');
|
||||
|
||||
$form = json_decode($module->GetConfigurationForm(), true);
|
||||
check($form['actions'][1]['caption'] === 'Designer im Browser öffnen' && $form['actions'][1]['link'] === true, 'The browser link does not promise a native Pro Console tab');
|
||||
echo "OK: real form save with opaque iterable Lists; empty/multiple grants; user-switch reload/reset and missing-target choices; password position and preservation; honest browser action\n";
|
||||
Reference in new issue
Block a user