fix: select native variables by datatype and explain rejected links
This commit is contained in:
1 parent
4967dd7950
commit
8c6b23bd22
29 files changed
+2031
-1790
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -3433,7 +3433,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Wo);function de(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function No(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function xf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var vc;function wc(){let r=new URL("./nextfloor-editor.js?v=96b927b088d6",new URL(import.meta.url)).href;return vc??=import(r),vc}var kf=.25,yc=r=>Math.round(r*1e3)/1e3,xc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Oo(r,e,t,n,i){let o=xc(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Sf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ue(ee(o,t),n))<.02&&Math.abs(ue(ee(a,t),n))<.02}))}var Lo=(r,e)=>Math.abs((r-e+540)%360-180);function kc(r,e,t,n=kf){let i=xc(r,e.x,e.z);if(!i)return null;let o=i.points,s=pt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Be(ee(c,l));if(d<.3)return;let m=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ue(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=Sf(r,i,l,h)?t/2:0,b=ue(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Lo(e.rotation,R.rotation)<Lo(e.rotation,z.rotation)?R:z);if(Lo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:yc(e.x-h[0]*M),z:yc(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Yr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Jr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function Sc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function $c(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Mc(r,e,t,n){return Jr(r,e,(i,o)=>{[i.x,i.z]=Oo(o,i.x,i.z,t,n)})}function Ac(r,e,t,n){let i=r.settings.wall_interior??.12;return Yr(r,e,(o,s)=>{[o.x,o.z]=Oo(s,o.x,o.z,t,n);let a=kc(s,o,i);a&&Object.assign(o,a)})}var Bo=(r,e)=>((r+e)%360+360)%360,Ec=r=>Number.parseFloat(r.replace(",",".")),Nn=(r,e)=>Math.round(r*10**e)/10**e;function Vo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Ec(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Wo);function de(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function No(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function xf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var vc;function wc(){let r=new URL("./nextfloor-editor.js?v=6e0c936122ba",new URL(import.meta.url)).href;return vc??=import(r),vc}var kf=.25,yc=r=>Math.round(r*1e3)/1e3,xc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Oo(r,e,t,n,i){let o=xc(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Sf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ue(ee(o,t),n))<.02&&Math.abs(ue(ee(a,t),n))<.02}))}var Lo=(r,e)=>Math.abs((r-e+540)%360-180);function kc(r,e,t,n=kf){let i=xc(r,e.x,e.z);if(!i)return null;let o=i.points,s=pt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Be(ee(c,l));if(d<.3)return;let m=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ue(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=Sf(r,i,l,h)?t/2:0,b=ue(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Lo(e.rotation,R.rotation)<Lo(e.rotation,z.rotation)?R:z);if(Lo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:yc(e.x-h[0]*M),z:yc(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Yr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Jr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function Sc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function $c(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Mc(r,e,t,n){return Jr(r,e,(i,o)=>{[i.x,i.z]=Oo(o,i.x,i.z,t,n)})}function Ac(r,e,t,n){let i=r.settings.wall_interior??.12;return Yr(r,e,(o,s)=>{[o.x,o.z]=Oo(s,o.x,o.z,t,n);let a=kc(s,o,i);a&&Object.assign(o,a)})}var Bo=(r,e)=>((r+e)%360+360)%360,Ec=r=>Number.parseFloat(r.replace(",",".")),Nn=(r,e)=>Math.round(r*10**e)/10**e;function Vo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Ec(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Nn(r.value,2))} @change=${i} />
|
||||
</label>`}var zc=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Rc=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function $f(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Vo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=Nn(l,3))}),o=Vs(n)?p`${Vo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ae(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Nn(s,3))})}
|
||||
|
||||
Reference in new issue
Block a user