@record-evolution/widget-scada 1.0.10 → 1.0.11

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/README.md CHANGED
@@ -1,54 +1,127 @@
1
- # \<widget-SCADA>
1
+ # \<widget-scada>
2
2
 
3
- This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
3
+ Draws **one** industrial SCADA symbol — a tank, pipe, valve, pump, meter, breaker, panel — and
4
+ animates it from live values: fill level, flow direction, running or stopped, opened or closed,
5
+ warning, critical, leak. A process diagram is several of these widgets side by side, one per
6
+ component.
4
7
 
5
- ## Installation
8
+ The symbols come from the [ThingsBoard](https://github.com/thingsboard/thingsboard) SCADA library:
9
+ 160 symbols in 12 categories, 132 of them clickable (a click sends a command to a device).
10
+
11
+ ## Installation & Usage
6
12
 
7
13
  ```bash
8
14
  npm i @record-evolution/widget-scada
9
15
  ```
10
16
 
11
- ## Usage
12
-
13
17
  ```html
14
18
  <script type="module">
15
- import '@record-evolution/widget-scada/widget-scada.js'
19
+ import '@record-evolution/widget-scada'
16
20
  </script>
17
21
 
18
- <widget-scada-0.0.1></widget-scada-0.0.1>
22
+ <widget-scada-1.0.10></widget-scada-1.0.10>
23
+
24
+ <script type="module">
25
+ const widget = document.querySelector('widget-scada-1.0.10')
26
+ widget.inputData = { symbol: 'centrifugal-pump', bindings: { running: true } }
27
+ widget.theme = { theme_name: 'light', theme_object: {} }
28
+ widget.addEventListener('action-submit', (e) => console.log(e.detail))
29
+ </script>
19
30
  ```
20
31
 
21
- ## Expected data format
32
+ The element tag carries the package version (the build substitutes `versionplaceholder`), so several
33
+ widget versions can coexist on one page. `demo/index.html` derives the tag from `package.json`, so
34
+ keep the two in sync when you bump.
22
35
 
23
- Please take a look at the src/default-data.json to see what data is expected to make the widget show content.
36
+ ## Configuration (`inputData`)
24
37
 
25
- The following format represents the available data :
38
+ `symbol` picks the SVG; everything else configures that one symbol:
26
39
 
27
- ```js
28
- data: {
29
- settings: {
30
- title: string,
31
- subTitle: string,
32
- minGauge: number,
33
- maxGauge: number,
34
- style: {
35
- needleColor: string,
36
- sections: number,
37
- backgroundColor: string[]
38
- }
39
- }
40
- gaugeValue: Number
40
+ ```json
41
+ {
42
+ "symbol": "left-analog-water-level-meter",
43
+ "bindings": { "running": true, "warning": false, "value": 10, "fullValue": 100 },
44
+ "styling": {},
45
+ "actions": {},
46
+ "showIcon": true,
47
+ "label": true,
48
+ "labelText": "Water",
49
+ "icon": "water",
50
+ "iconSize": 14
41
51
  }
42
52
  ```
43
53
 
44
- ## SCADA Symbols
54
+ | Group | What it is |
55
+ | ----------------------- | ----------------------------------------------------------------------------------- |
56
+ | `symbol` | Symbol id, one of the 160 in `scada_symbols/` — listed in `src/symbol-catalog.json` |
57
+ | `bindings.*` | The live booleans and numbers the symbol animates on. The only data-bindable group |
58
+ | `styling.*` | Colors, fonts and sizes. Literal values only |
59
+ | `actions.*` | Device, app and topic a click is sent to. Only meaningful on a clickable symbol |
60
+ | top-level display props | Per-symbol switches and texts (`showIcon`, `labelText`, connectors, thresholds, …) |
61
+
62
+ `src/definition-schema.json` is an **inverted union**: every property of every symbol lives in one
63
+ flat schema, each gated by a `condition` listing the symbols it applies to. A key belonging to a
64
+ different symbol than the selected one is therefore not an error — it is ignored at render time, and
65
+ the dashboard editor strips it. `src/default-data.json` holds the demo configuration.
45
66
 
46
- The SVG SCADA symbols in `scada_symbols/` are taken from the [ThingsBoard](https://github.com/thingsboard/thingsboard) project and are licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). See [scada_symbols/LICENSE](scada_symbols/LICENSE) for details.
67
+ ## Generated files
47
68
 
48
- ## Local Demo
69
+ | File | Generator | Source |
70
+ | ---------------------------- | --------------------------------- | ------------------------------------------------------------- |
71
+ | `src/definition-schema.json` | `npm run schema` | The SVGs' `<tb:metadata>` plus `scripts/schema-curation.json` |
72
+ | `src/definition-schema.d.ts` | `npm run types` | `json2ts` over the schema |
73
+ | `src/symbol-catalog.json` | `npm run catalog` | Per-symbol summary for the AI widget builder |
74
+ | `scada_symbols/index.json` | `node scripts/generate-index.mjs` | Category index over the symbol SVGs |
75
+
76
+ All four are committed, and `npm run release` regenerates them and refuses to release when the
77
+ result differs from what is checked in.
78
+
79
+ ### Never hand-edit `definition-schema.json`
80
+
81
+ It is generated, so an edit made in the file is lost on the next run. Anything the generator cannot
82
+ derive from the SVG metadata — the AI selection hints, the curated symbol order and labels, the
83
+ hand-written property descriptions, the per-symbol reading the union schema has to choose between
84
+ (`label` is a `switch` on 9 symbols and a `text` field on 4) — belongs in
85
+ **`scripts/schema-curation.json`**, which the generator applies as its last step.
49
86
 
50
87
  ```bash
51
- npm start
88
+ npm run schema -- --check # report drift, write nothing, exit 1 when the committed schema is behind
89
+ npm run schema # rewrite the schema, but only when the content actually changed
52
90
  ```
53
91
 
54
- To run a local development server that serves the basic demo located in `demo/index.html`
92
+ `--check` is also the quick way to see what an edit to an SVG's metadata would do to the schema.
93
+
94
+ ## Symbol catalog
95
+
96
+ `src/symbol-catalog.json` is what the platform's AI widget builder reads instead of the 233 KB
97
+ schema — per symbol: label, category, description, search tags, natural grid size, aspect ratio,
98
+ clickability, and the bindings it supports with their types. It is served from the published
99
+ package:
100
+
101
+ ```
102
+ https://cdn.jsdelivr.net/npm/@record-evolution/widget-scada@<version>/src/symbol-catalog.json
103
+ ```
104
+
105
+ ## Development
106
+
107
+ ```bash
108
+ npm start # vite dev server serving demo/index.html
109
+ npm run link # develop against the local RESWARM frontend (npm run unlink to undo)
110
+ ```
111
+
112
+ ## Release
113
+
114
+ ```bash
115
+ npm run release # patch — release:minor / release:major for the others
116
+ ```
117
+
118
+ `preversion` runs `scripts/release-preflight.sh` (on `main`, clean tree, in sync with origin,
119
+ generators up to date, build passes); npm then bumps and tags; `postversion` pushes and waits for
120
+ the publishing workflow, since publishing happens in CI rather than from a laptop.
121
+
122
+ ## SCADA Symbols
123
+
124
+ The SVG SCADA symbols in `scada_symbols/` are taken from the
125
+ [ThingsBoard](https://github.com/thingsboard/thingsboard) project and are licensed under the
126
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). See
127
+ [scada_symbols/LICENSE](scada_symbols/LICENSE) for details.
@@ -1178,7 +1178,7 @@ var de = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, v = (n, t,
1178
1178
  };
1179
1179
  let y = class extends P {
1180
1180
  constructor() {
1181
- super(), this.svgContent = "", this.version = "1.0.10", this.svgModules = /* @__PURE__ */ new Map(), this.actionCleanups = [], this.resizeObserver = new ResizeObserver(() => this.requestUpdate()), this.resizeObserver.observe(this);
1181
+ super(), this.svgContent = "", this.version = "1.0.11", this.svgModules = /* @__PURE__ */ new Map(), this.actionCleanups = [], this.resizeObserver = new ResizeObserver(() => this.requestUpdate()), this.resizeObserver.observe(this);
1182
1182
  }
1183
1183
  disconnectedCallback() {
1184
1184
  super.disconnectedCallback(), this.resizeObserver?.disconnect(), this.cleanupActions();
@@ -1354,7 +1354,7 @@ v([
1354
1354
  Yt(".svg-container")
1355
1355
  ], y.prototype, "svgContainer", 2);
1356
1356
  y = v([
1357
- Wt("widget-scada-1.0.10")
1357
+ Wt("widget-scada-1.0.11")
1358
1358
  ], y);
1359
1359
  export {
1360
1360
  y as WidgetScada
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.10",
6
+ "version": "1.0.11",
7
7
  "engines": {
8
8
  "node": ">=24.9.0",
9
9
  "npm": ">=10.0.2"
@@ -25,9 +25,14 @@
25
25
  "watch": "vite build --watch",
26
26
  "link": "npm run build && npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-scada",
27
27
  "unlink": "npm unlink --global && cd ../RESWARM/frontend && npm unlink @record-evolution/widget-scada && npm i @record-evolution/widget-scada",
28
+ "schema": "node scripts/generate-schema.mjs",
28
29
  "types": "cat src/definition-schema.json | json2ts --style.tabWidth=4 > src/definition-schema.d.ts",
29
30
  "catalog": "node scripts/generate-catalog.mjs",
30
- "release": "npm run build && npm run types && npm run catalog && npm version patch --tag-version-prefix='' && git push && git push --tag && npm run build"
31
+ "preversion": "sh scripts/release-preflight.sh",
32
+ "postversion": "git push --follow-tags && sh scripts/release-verify.sh",
33
+ "release": "npm version patch",
34
+ "release:minor": "npm version minor",
35
+ "release:major": "npm version major"
31
36
  },
32
37
  "dependencies": {
33
38
  "lit": "^3.3.3",
@@ -50,14 +55,14 @@
50
55
  },
51
56
  "repository": {
52
57
  "type": "git",
53
- "url": "git+https://github.com/RecordEvolution/widget-SCADA.git"
58
+ "url": "git+https://github.com/RecordEvolution/widget-scada.git"
54
59
  },
55
60
  "keywords": [
56
61
  "widget",
57
62
  "scada"
58
63
  ],
59
64
  "bugs": {
60
- "url": "https://github.com/RecordEvolution/widget-SCADA/issues"
65
+ "url": "https://github.com/RecordEvolution/widget-scada/issues"
61
66
  },
62
- "homepage": "https://github.com/RecordEvolution/widget-SCADA#readme"
67
+ "homepage": "https://github.com/RecordEvolution/widget-scada#readme"
63
68
  }