@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/dist/widget-scada.js +116 -111
- package/dist/widget-scada.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-scada.ts +10 -1
package/package.json
CHANGED
package/src/widget-scada.ts
CHANGED
|
@@ -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.
|
|
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
|
|