@record-evolution/widget-scada 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "REWidget widget-SCADA",
4
4
  "license": "MIT",
5
5
  "author": "widget-SCADA",
6
- "version": "1.0.2",
6
+ "version": "1.0.3",
7
7
  "engines": {
8
8
  "node": ">=24.9.0",
9
9
  "npm": ">=10.0.2"
@@ -25,6 +25,9 @@ export class WidgetScada extends LitElement {
25
25
  @property({ type: Object })
26
26
  theme?: Theme
27
27
 
28
+ @property({ type: String })
29
+ baseUrl?: string
30
+
28
31
  @state() private svgContent: string = ''
29
32
  @state() private metadata?: SymbolMetadata
30
33
  @state() private themeBgColor?: string
@@ -96,12 +99,18 @@ export class WidgetScada extends LitElement {
96
99
  }
97
100
 
98
101
  private getSymbolUrl(symbolId: string): string {
102
+ if (this.baseUrl) {
103
+ const base = this.baseUrl.endsWith('/') ? this.baseUrl.slice(0, -1) : this.baseUrl
104
+ return base + '/scada_symbols/' + symbolId + '.svg'
105
+ }
99
106
  // Build URL at runtime without triggering Vite's static asset analysis
100
107
  // import.meta.url points to the module's own URL
101
108
  const base = import.meta.url
102
109
  const segments = base.split('/')
103
110
  segments.pop() // remove current filename
104
- segments.pop() // go up from src/
111
+ if (segments[segments.length - 1] === 'src') {
112
+ segments.pop() // go up from src/ (dev mode only)
113
+ }
105
114
  return segments.join('/') + '/scada_symbols/' + symbolId + '.svg'
106
115
  }
107
116