File tree Expand file tree Collapse file tree 3 files changed +4
-0
lines changed
Expand file tree Collapse file tree 3 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,7 @@ Service data can be dynamically constructed using JavaScript code. Below is the
253253| `hass` | Home Assistant [hass](https://home-assistant.io/developers/development_hass_object/) object |
254254| `element` | current SVG element |
255255| `elements` | current SVG elements |
256+ | `svg` | Root `<svg>` element for the current floorplan page (use for scoped `querySelector(...)`) |
256257
257258| Functions | Description |
258259| ------------------------ | ------------------------------------------------------------------------------------------- |
Original file line number Diff line number Diff line change @@ -1715,6 +1715,7 @@ export class FloorplanElement extends LitElement {
17151715 this . svgElements ,
17161716 this . functions ,
17171717 svgElementInfo ,
1718+ this . svg ,
17181719 ruleInfo
17191720 ) ;
17201721 } catch ( err ) {
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export class EvalHelper {
4545 svgElements ?: { [ elementId : string ] : SVGGraphicsElement } ,
4646 functions ?: unknown ,
4747 svgElementInfo ?: FloorplanSvgElementInfo ,
48+ svg ?: SVGGraphicsElement ,
4849 ruleInfo ?: FloorplanRuleInfo
4950 ) : unknown {
5051 this . expression = expression . trim ( ) ;
@@ -97,6 +98,7 @@ export class EvalHelper {
9798 this . interpreter . import ( 'hass' , hass ) ;
9899 this . interpreter . import ( 'element' , svgElement ) ;
99100 this . interpreter . import ( 'elements' , svgElements ) ;
101+ this . interpreter . import ( 'svg' , svg ) ; // Provide direct access to the root <svg> element for rule scripts
100102
101103 // Let the user call "action" function (to call our service call-handler)
102104 this . interpreter . import ( 'action' ,
You can’t perform that action at this time.
0 commit comments