@record-evolution/widget-switch 1.1.2 → 1.1.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.
@@ -9,7 +9,7 @@ var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, c = (t, e, r
9
9
  };
10
10
  let a = class extends u {
11
11
  constructor() {
12
- super(), this.dataSets = /* @__PURE__ */ new Map(), this.textActive = !0, this.version = "1.1.2", this.origWidth = 0, this.origHeight = 0, this.resizeObserver = new ResizeObserver(this.applyData.bind(this)), this.resizeObserver.observe(this);
12
+ super(), this.dataSets = /* @__PURE__ */ new Map(), this.textActive = !0, this.version = "1.1.3", this.origWidth = 0, this.origHeight = 0, this.resizeObserver = new ResizeObserver(this.applyData.bind(this)), this.resizeObserver.observe(this);
13
13
  }
14
14
  disconnectedCallback() {
15
15
  super.disconnectedCallback(), this.resizeObserver && this.resizeObserver.disconnect();
@@ -272,7 +272,7 @@ c([
272
272
  n()
273
273
  ], a.prototype, "themePrimaryColor", 2);
274
274
  a = c([
275
- b("widget-switch-1.1.2")
275
+ b("widget-switch-1.1.3")
276
276
  ], a);
277
277
  export {
278
278
  a as WidgetSwitch
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "IronFlock Widget widget-switch",
4
4
  "license": "MIT",
5
5
  "author": "Record Evolution GmbH",
6
- "version": "1.1.2",
6
+ "version": "1.1.3",
7
7
  "engines": {
8
8
  "node": ">=24.9.0",
9
9
  "npm": ">=10.0.2"
@@ -5,28 +5,37 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
+ /**
9
+ * The main heading displayed above the switch controls. Use to describe the control group (e.g., 'Light Controls', 'Pump Switches').
10
+ */
8
11
  export type Title = string;
12
+ /**
13
+ * Secondary text displayed below the title. Use for additional context like location, device group, or instructions.
14
+ */
9
15
  export type Subtitle = string;
10
16
  /**
11
- * The label for the switch.
17
+ * Display text identifying this switch. Should clearly describe what the switch controls (e.g., 'Main Power', 'Pump 1', 'Night Mode').
12
18
  */
13
19
  export type Label = string;
14
20
  /**
15
- * The value or list of values that represent the ON state. You can also use an expression like <4 or >33 to specify a numeric range. If a value matches an ON and an OFF state, the ON state will be used.
21
+ * Values that indicate the ON state. Can be: a single value ('1', 'true', 'ON'), comma-separated list ('1,true,ON'), or numeric expression ('<4' means values below 4 are ON, '>33' means values above 33 are ON). If a value matches both ON and OFF, ON takes precedence.
16
22
  */
17
23
  export type ONValues = string;
18
24
  /**
19
- * The value or list of values that represent the OFF state. You can also use an expression like <4 or >33 to specify a numeric range. If a value matches an ON and an OFF state, the ON state will be used.
25
+ * Values that indicate the OFF state. Can be: a single value ('0', 'false', 'OFF'), comma-separated list ('0,false,OFF'), or numeric expression ('<4' means values below 4 are OFF, '>33' means values above 33 are OFF). Values matching neither ON nor OFF show as UNKNOWN.
20
26
  */
21
27
  export type OFFValues = string;
22
28
  /**
23
- * Is not strictly required, but is strongly recommended to be connected to the backend column that represents the switch state. This keeps the switch visual state consistent with its physical state.
29
+ * The current state value from the backend, used to display the correct switch position. Strongly recommended to bind this to the actual device state column to keep the visual state synchronized with the physical device state.
24
30
  */
25
31
  export type SwitchState = string;
26
32
  /**
27
- * The action topic that is called at the selected app at the selected device when clicking the switch. The arguments will be True for 'ON' and False for 'OFF'. Refer to the documentation of the app for available topics to call.
33
+ * The specific command/topic sent to the app when the switch is clicked. Arguments sent are: True for turning ON, False for turning OFF. Refer to the app's documentation for available topics.
28
34
  */
29
35
  export type ActionAppTopic = string;
36
+ /**
37
+ * Array of switch configurations. Each entry creates a toggle switch with its own state mapping and optional device action binding.
38
+ */
30
39
  export type Switches = {
31
40
  label?: Label;
32
41
  stateMap?: StateMap;
@@ -38,6 +47,9 @@ export type Switches = {
38
47
  [k: string]: unknown;
39
48
  }[];
40
49
 
50
+ /**
51
+ * A toggle switch widget for displaying and controlling binary device states. Use this widget to show ON/OFF status indicators that can also trigger device actions when clicked. Supports configurable state mapping to interpret various data values as ON, OFF, or UNKNOWN states. When connected to a device action, clicking the switch sends commands to control physical devices or trigger backend operations. Multiple switches can be displayed in one widget. Ideal for IoT device control panels, smart home interfaces, equipment control dashboards, or any scenario requiring visual toggle controls with action capabilities.
52
+ */
41
53
  export interface InputData {
42
54
  title?: Title;
43
55
  subTitle?: Subtitle;
@@ -45,7 +57,7 @@ export interface InputData {
45
57
  [k: string]: unknown;
46
58
  }
47
59
  /**
48
- * Specify the values for the ON and OFF states. Any value that does not match to either an ON or OFF state will be considered as UNKNOWN.
60
+ * Defines how data values are interpreted as switch states. Configure which values represent ON and OFF. Values not matching either state display as UNKNOWN (neutral position).
49
61
  */
50
62
  export interface StateMap {
51
63
  on?: ONValues;
@@ -53,25 +65,34 @@ export interface StateMap {
53
65
  [k: string]: unknown;
54
66
  }
55
67
  /**
56
- * The device that should handle the click on the switch. The 'Device ID' column can be used here when using data driven mode.
68
+ * The device that receives commands when the switch is clicked. In data-driven mode, bind to a 'Device ID' column to dynamically target different devices per row.
57
69
  */
58
70
  export interface ActionDeviceTarget {
59
71
  [k: string]: unknown;
60
72
  }
61
73
  /**
62
- * The app that should handle the click on the switch.
74
+ * The application/service on the target device that handles the switch command. Select from available apps installed on the device.
63
75
  */
64
76
  export interface ActionApp {
65
77
  [k: string]: unknown;
66
78
  }
79
+ /**
80
+ * Visual styling options for the switch and its label.
81
+ */
67
82
  export interface Styling {
68
83
  labelColor?: LabelColor;
69
84
  valueColor?: ValueColor;
70
85
  [k: string]: unknown;
71
86
  }
87
+ /**
88
+ * Color of the switch label text.
89
+ */
72
90
  export interface LabelColor {
73
91
  [k: string]: unknown;
74
92
  }
93
+ /**
94
+ * Color of the state value text displayed with the switch.
95
+ */
75
96
  export interface ValueColor {
76
97
  [k: string]: unknown;
77
98
  }
@@ -1,19 +1,23 @@
1
1
  {
2
2
  "title": "InputData",
3
+ "description": "A toggle switch widget for displaying and controlling binary device states. Use this widget to show ON/OFF status indicators that can also trigger device actions when clicked. Supports configurable state mapping to interpret various data values as ON, OFF, or UNKNOWN states. When connected to a device action, clicking the switch sends commands to control physical devices or trigger backend operations. Multiple switches can be displayed in one widget. Ideal for IoT device control panels, smart home interfaces, equipment control dashboards, or any scenario requiring visual toggle controls with action capabilities.",
3
4
  "type": "object",
4
5
  "properties": {
5
6
  "title": {
6
7
  "title": "Title",
8
+ "description": "The main heading displayed above the switch controls. Use to describe the control group (e.g., 'Light Controls', 'Pump Switches').",
7
9
  "type": "string",
8
10
  "order": 1
9
11
  },
10
12
  "subTitle": {
11
13
  "title": "Subtitle",
14
+ "description": "Secondary text displayed below the title. Use for additional context like location, device group, or instructions.",
12
15
  "type": "string",
13
16
  "order": 2
14
17
  },
15
18
  "dataseries": {
16
19
  "title": "Switches",
20
+ "description": "Array of switch configurations. Each entry creates a toggle switch with its own state mapping and optional device action binding.",
17
21
  "type": "array",
18
22
  "order": 3,
19
23
  "items": {
@@ -21,26 +25,26 @@
21
25
  "properties": {
22
26
  "label": {
23
27
  "title": "Label",
24
- "description": "The label for the switch.",
28
+ "description": "Display text identifying this switch. Should clearly describe what the switch controls (e.g., 'Main Power', 'Pump 1', 'Night Mode').",
25
29
  "type": "string",
26
30
  "order": 1
27
31
  },
28
32
  "stateMap": {
29
33
  "title": "State Map",
30
- "description": "Specify the values for the ON and OFF states. Any value that does not match to either an ON or OFF state will be considered as UNKNOWN.",
34
+ "description": "Defines how data values are interpreted as switch states. Configure which values represent ON and OFF. Values not matching either state display as UNKNOWN (neutral position).",
31
35
  "type": "object",
32
36
  "required": true,
33
37
  "order": 2,
34
38
  "properties": {
35
39
  "on": {
36
40
  "title": "ON Values",
37
- "description": "The value or list of values that represent the ON state. You can also use an expression like <4 or >33 to specify a numeric range. If a value matches an ON and an OFF state, the ON state will be used.",
41
+ "description": "Values that indicate the ON state. Can be: a single value ('1', 'true', 'ON'), comma-separated list ('1,true,ON'), or numeric expression ('<4' means values below 4 are ON, '>33' means values above 33 are ON). If a value matches both ON and OFF, ON takes precedence.",
38
42
  "type": "string",
39
43
  "required": true
40
44
  },
41
45
  "off": {
42
46
  "title": "OFF Values",
43
- "description": "The value or list of values that represent the OFF state. You can also use an expression like <4 or >33 to specify a numeric range. If a value matches an ON and an OFF state, the ON state will be used.",
47
+ "description": "Values that indicate the OFF state. Can be: a single value ('0', 'false', 'OFF'), comma-separated list ('0,false,OFF'), or numeric expression ('<4' means values below 4 are OFF, '>33' means values above 33 are OFF). Values matching neither ON nor OFF show as UNKNOWN.",
44
48
  "type": "string",
45
49
  "required": true
46
50
  }
@@ -49,43 +53,45 @@
49
53
  "value": {
50
54
  "title": "Switch State",
51
55
  "type": "string",
52
- "description": "Is not strictly required, but is strongly recommended to be connected to the backend column that represents the switch state. This keeps the switch visual state consistent with its physical state.",
56
+ "description": "The current state value from the backend, used to display the correct switch position. Strongly recommended to bind this to the actual device state column to keep the visual state synchronized with the physical device state.",
53
57
  "required": false,
54
58
  "order": 3
55
59
  },
56
60
  "actionDevice": {
57
61
  "title": "Action Device Target",
58
- "description": "The device that should handle the click on the switch. The 'Device ID' column can be used here when using data driven mode.",
62
+ "description": "The device that receives commands when the switch is clicked. In data-driven mode, bind to a 'Device ID' column to dynamically target different devices per row.",
59
63
  "type": "actionDevice",
60
64
  "order": 4
61
65
  },
62
66
  "actionApp": {
63
67
  "title": "Action App",
64
- "description": "The app that should handle the click on the switch.",
68
+ "description": "The application/service on the target device that handles the switch command. Select from available apps installed on the device.",
65
69
  "dataDrivenDisabled": true,
66
70
  "type": "actionApp",
67
71
  "order": 5
68
72
  },
69
73
  "actionTopic": {
70
74
  "title": "Action App Topic",
71
- "description": "The action topic that is called at the selected app at the selected device when clicking the switch. The arguments will be True for 'ON' and False for 'OFF'. Refer to the documentation of the app for available topics to call.",
75
+ "description": "The specific command/topic sent to the app when the switch is clicked. Arguments sent are: True for turning ON, False for turning OFF. Refer to the app's documentation for available topics.",
72
76
  "type": "string",
73
77
  "order": 6
74
78
  },
75
79
  "styling": {
76
80
  "title": "Styling",
77
- "description": "",
81
+ "description": "Visual styling options for the switch and its label.",
78
82
  "type": "object",
79
83
  "order": 9,
80
84
  "properties": {
81
85
  "labelColor": {
82
86
  "title": "Label Color",
87
+ "description": "Color of the switch label text.",
83
88
  "type": "color",
84
89
  "color": true,
85
90
  "order": 4
86
91
  },
87
92
  "valueColor": {
88
93
  "title": "Value Color",
94
+ "description": "Color of the state value text displayed with the switch.",
89
95
  "type": "color",
90
96
  "color": true,
91
97
  "order": 5