@schukai/monster 3.76.0 → 3.78.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/source/components/content/copy.mjs +475 -0
  4. package/source/components/content/style/copy.pcss +33 -0
  5. package/source/components/content/stylesheet/copy.mjs +31 -0
  6. package/source/components/datatable/change-button.mjs +1 -1
  7. package/source/components/datatable/columnbar.mjs +1 -1
  8. package/source/components/datatable/dataset.mjs +1 -1
  9. package/source/components/datatable/datasource/dom.mjs +1 -1
  10. package/source/components/datatable/datasource/rest.mjs +1 -1
  11. package/source/components/datatable/datasource.mjs +1 -1
  12. package/source/components/datatable/datatable.mjs +1 -1
  13. package/source/components/datatable/filter/date-range.mjs +1 -1
  14. package/source/components/datatable/filter/input.mjs +1 -1
  15. package/source/components/datatable/filter/range.mjs +1 -1
  16. package/source/components/datatable/filter/select.mjs +1 -1
  17. package/source/components/datatable/filter-button.mjs +1 -1
  18. package/source/components/datatable/filter.mjs +1 -1
  19. package/source/components/datatable/pagination.mjs +1 -1
  20. package/source/components/datatable/save-button.mjs +1 -1
  21. package/source/components/datatable/status.mjs +1 -1
  22. package/source/components/form/action-button.mjs +1 -1
  23. package/source/components/form/api-button.mjs +1 -1
  24. package/source/components/form/button-bar.mjs +1 -1
  25. package/source/components/form/button.mjs +1 -1
  26. package/source/components/form/confirm-button.mjs +1 -1
  27. package/source/components/form/context-error.mjs +2 -2
  28. package/source/components/form/context-help.mjs +1 -37
  29. package/source/components/form/field-set.mjs +31 -44
  30. package/source/components/form/message-state-button.mjs +1 -1
  31. package/source/components/form/popper-button.mjs +1 -1
  32. package/source/components/form/reload.mjs +1 -1
  33. package/source/components/form/select.mjs +1 -1
  34. package/source/components/form/shadow-reload.mjs +1 -1
  35. package/source/components/form/state-button.mjs +1 -1
  36. package/source/components/form/style/field-set.pcss +164 -70
  37. package/source/components/form/stylesheet/field-set.mjs +7 -14
  38. package/source/components/form/template.mjs +1 -1
  39. package/source/components/form/toggle-switch.mjs +321 -340
  40. package/source/components/form/tree-select.mjs +1 -1
  41. package/source/components/host/call-button.mjs +1 -1
  42. package/source/components/host/collapse.mjs +1 -1
  43. package/source/components/host/config-manager.mjs +1 -1
  44. package/source/components/host/host.mjs +1 -1
  45. package/source/components/host/overlay.mjs +1 -1
  46. package/source/components/host/toggle-button.mjs +1 -1
  47. package/source/components/host/viewer.mjs +1 -1
  48. package/source/components/layout/collapse.mjs +21 -21
  49. package/source/components/layout/details.mjs +11 -11
  50. package/source/components/layout/iframe.mjs +1 -1
  51. package/source/components/layout/panel.mjs +1 -1
  52. package/source/components/layout/popper.mjs +1 -1
  53. package/source/components/layout/slider.mjs +1 -1
  54. package/source/components/layout/split-panel.mjs +1 -1
  55. package/source/components/layout/tabs.mjs +1 -1
  56. package/source/components/layout/width-toggle.mjs +17 -9
  57. package/source/components/navigation/table-of-content.mjs +1 -1
  58. package/source/components/state/log.mjs +167 -153
  59. package/source/components/state/state.mjs +9 -33
  60. package/source/components/stylesheet/form.mjs +6 -13
@@ -12,26 +12,26 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import { instanceSymbol } from "../../constants.mjs";
16
- import { internalSymbol } from "../../constants.mjs";
17
- import { CustomControl } from "../../dom/customcontrol.mjs";
18
- import { Observer } from "../../types/observer.mjs";
19
- import { ProxyObserver } from "../../types/proxyobserver.mjs";
15
+ import {instanceSymbol} from "../../constants.mjs";
16
+ import {internalSymbol} from "../../constants.mjs";
17
+ import {CustomControl} from "../../dom/customcontrol.mjs";
18
+ import {Observer} from "../../types/observer.mjs";
19
+ import {ProxyObserver} from "../../types/proxyobserver.mjs";
20
20
 
21
- import { addAttributeToken } from "../../dom/attributes.mjs";
21
+ import {addAttributeToken} from "../../dom/attributes.mjs";
22
22
  import {
23
- assembleMethodSymbol,
24
- registerCustomElement,
25
- updaterTransformerMethodsSymbol,
23
+ assembleMethodSymbol,
24
+ registerCustomElement,
25
+ updaterTransformerMethodsSymbol,
26
26
  } from "../../dom/customelement.mjs";
27
- import { isObject, isFunction } from "../../types/is.mjs";
28
- import { ToggleSwitchStyleSheet } from "./stylesheet/toggle-switch.mjs";
27
+ import {isObject, isFunction} from "../../types/is.mjs";
28
+ import {ToggleSwitchStyleSheet} from "./stylesheet/toggle-switch.mjs";
29
29
  import {
30
- ATTRIBUTE_ERRORMESSAGE,
31
- ATTRIBUTE_ROLE,
30
+ ATTRIBUTE_ERRORMESSAGE,
31
+ ATTRIBUTE_ROLE,
32
32
  } from "../../dom/constants.mjs";
33
33
 
34
- export { ToggleSwitch };
34
+ export {ToggleSwitch};
35
35
 
36
36
  /**
37
37
  * @private
@@ -49,25 +49,6 @@ export const STATE_ON = "on";
49
49
  */
50
50
  export const STATE_OFF = "off";
51
51
 
52
- /**
53
- * This CustomControl creates a ToggleSwitch element
54
- *
55
- * <img src="./images/toggleswitch.png">
56
- *
57
- *
58
- * @startuml toggleswitch.png
59
- * skinparam monochrome true
60
- * skinparam shadowing false
61
- * HTMLElement <|-- CustomElement
62
- * CustomElement <|-- CustomControl
63
- * CustomControl <|-- ToggleSwitch
64
- * @enduml
65
- *
66
- * @copyright schukai GmbH
67
- * @memberOf Monster.Components.Form
68
- * @summary A simple toggle switch
69
- */
70
-
71
52
  /**
72
53
  * A simple toggle switch
73
54
  *
@@ -84,340 +65,340 @@ export const STATE_OFF = "off";
84
65
  * @fires monster-changed
85
66
  */
86
67
  class ToggleSwitch extends CustomControl {
87
- /**
88
- * To set the options via the html tag the attribute `data-monster-options` must be used.
89
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
90
- *
91
- * The individual configuration values can be found in the table.
92
- *
93
- * @property {string} value=current value of the element
94
- * @property {Boolean} disabled=disabled=false Disabled state
95
- * @property {Object} classes
96
- * @property {string} classes.on=specifies the class for the on state.
97
- * @property {string} classes.off=specifies the class for the off state.
98
- * @property {Object} values
99
- * @property {string} values.off=specifies the value of the element if it is not selected
100
- * @property {Object} labels
101
- * @property {string} labels.on=specifies the label for the on state.
102
- * @property {string} labels.off=specifies the label for the off state.
103
- * @property {string} actions
104
- * @property {string} actions.on=specifies the action for the on state.
105
- * @property {string} actions.off=specifies the action for the off state.
106
- * @property {Object} templates
107
- * @property {string} templates.main=specifies the main template used by the control.
108
- */
109
- get defaults() {
110
- return Object.assign({}, super.defaults, {
111
- value: null,
112
- disabled: false,
113
- classes: {
114
- on: "monster-theme-on",
115
- off: "monster-theme-off",
116
- handle: "monster-theme-primary-1",
117
- },
118
- values: {
119
- on: "on",
120
- off: "off",
121
- },
122
- labels: {
123
- "toggle-switch-on": "ON",
124
- "toggle-switch-off": "OFF",
125
- },
126
- templates: {
127
- main: getTemplate(),
128
- },
129
- actions: {
130
- on: () => {
131
- throw new Error("the on action is not defined");
132
- },
133
- off: () => {
134
- throw new Error("the off action is not defined");
135
- },
136
- },
137
- });
138
- }
139
-
140
- /**
141
- * @return {ToggleSwitch}
142
- */
143
- [assembleMethodSymbol]() {
144
- const self = this;
145
- super[assembleMethodSymbol]();
146
- initControlReferences.call(this);
147
- initEventHandler.call(this);
148
-
149
- /**
150
- * init value to off
151
- * if the value was not defined before inserting it into the HTML
152
- */
153
- if (self.getOption("value") === null) {
154
- self.setOption("value", self.getOption("values.off"));
155
- }
156
-
157
- /**
158
- * value from attribute
159
- */
160
- if (self.hasAttribute("value")) {
161
- self.setOption("value", self.getAttribute("value"));
162
- }
163
-
164
- /**
165
- * validate value
166
- */
167
- validateAndSetValue.call(self);
168
-
169
- if (this.state === STATE_ON) {
170
- toggleClassOn.call(self);
171
- } else {
172
- toggleClassOff.call(self);
173
- }
174
-
175
- /**
176
- * is called when options changed
177
- */
178
- self[internalSymbol].attachObserver(
179
- new Observer(function () {
180
- if (isObject(this) && this instanceof ProxyObserver) {
181
- validateAndSetValue.call(self);
182
- toggleClass.call(self);
183
- }
184
- }),
185
- );
186
-
187
- return this;
188
- }
189
-
190
- /**
191
- * updater transformer methods for pipe
192
- *
193
- * @return {function}
194
- */
195
- [updaterTransformerMethodsSymbol]() {
196
- return {
197
- "state-callback": (Wert) => {
198
- return this.state;
199
- },
200
- };
201
- }
202
-
203
- /**
204
- * @return [CSSStyleSheet]
205
- */
206
- static getCSSStyleSheet() {
207
- return [ToggleSwitchStyleSheet];
208
- }
209
-
210
- /**
211
- * toggle switch
212
- *
213
- * ```
214
- * e = document.querySelector('monster-toggle-switch');
215
- * e.click()
216
- * ```
217
- */
218
- click() {
219
- toggleValues.call(this);
220
- }
221
-
222
- /**
223
- * toggle switch on/off
224
- *
225
- * ```
226
- * e = document.querySelector('monster-toggle-switch');
227
- * e.toggle()
228
- * ```
229
- *
230
- * @return {ToggleSwitch}
231
- */
232
- toggle() {
233
- this.click();
234
- return this;
235
- }
236
-
237
- /**
238
- * toggle switch on
239
- *
240
- * ```
241
- * e = document.querySelector('monster-toggle-switch');
242
- * e.toggleOn()
243
- * ```
244
- *
245
- * @return {ToggleSwitch}
246
- */
247
- toggleOn() {
248
- this.setOption("value", this.getOption("values.on"));
249
- return this;
250
- }
251
-
252
- /**
253
- * toggle switch off
254
- *
255
- * ```
256
- * e = document.querySelector('monster-toggle-switch');
257
- * e.toggleOff()
258
- * ```
259
- *
260
- * @return {ToggleSwitch}
261
- */
262
- toggleOff() {
263
- this.setOption("value", this.getOption("values.off"));
264
- return this;
265
- }
266
-
267
- /**
268
- * returns the status of the element
269
- *
270
- * ```
271
- * e = document.querySelector('monster-toggle-switch');
272
- * console.log(e.state)
273
- * // ↦ off
274
- * ```
275
- *
276
- * @return {string}
277
- */
278
- get state() {
279
- return this.getOption("value") === this.getOption("values.on")
280
- ? STATE_ON
281
- : STATE_OFF;
282
- }
283
-
284
- /**
285
- * The current value of the Switch
286
- *
287
- * ```
288
- * e = document.querySelector('monster-toggle-switch');
289
- * console.log(e.value)
290
- * // ↦ on
291
- * ```
292
- *
293
- * @return {string}
294
- */
295
- get value() {
296
- return this.state === STATE_ON
297
- ? this.getOption("values.on")
298
- : this.getOption("values.off");
299
- }
300
-
301
- /**
302
- * Set value
303
- *
304
- * ```
305
- * e = document.querySelector('monster-toggle-switch');
306
- * e.value="on"
307
- * ```
308
- *
309
- * @property {string} value
310
- */
311
- set value(value) {
312
- this.setOption("value", value);
313
- }
314
-
315
- /**
316
- * This method is called by the `instanceof` operator.
317
- * @returns {symbol}
318
- */
319
- static get [instanceSymbol]() {
320
- return Symbol.for(
321
- "@schukai/monster/components/form/toggle-switch@@instance",
322
- );
323
- }
324
-
325
- static getTag() {
326
- return "monster-toggle-switch";
327
- }
68
+ /**
69
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
70
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
71
+ *
72
+ * The individual configuration values can be found in the table.
73
+ *
74
+ * @property {string} value=current value of the element
75
+ * @property {Boolean} disabled=disabled=false Disabled state
76
+ * @property {Object} classes
77
+ * @property {string} classes.on=specifies the class for the on state.
78
+ * @property {string} classes.off=specifies the class for the off state.
79
+ * @property {Object} values
80
+ * @property {string} values.off=specifies the value of the element if it is not selected
81
+ * @property {Object} labels
82
+ * @property {string} labels.on=specifies the label for the on state.
83
+ * @property {string} labels.off=specifies the label for the off state.
84
+ * @property {string} actions
85
+ * @property {string} actions.on=specifies the action for the on state.
86
+ * @property {string} actions.off=specifies the action for the off state.
87
+ * @property {Object} templates
88
+ * @property {string} templates.main=specifies the main template used by the control.
89
+ */
90
+ get defaults() {
91
+ return Object.assign({}, super.defaults, {
92
+ value: null,
93
+ disabled: false,
94
+ classes: {
95
+ on: "monster-theme-on",
96
+ off: "monster-theme-off",
97
+ handle: "monster-theme-primary-1",
98
+ },
99
+ values: {
100
+ on: "on",
101
+ off: "off",
102
+ },
103
+ labels: {
104
+ toggleSwitchOn: "",
105
+ toggleSwitchOff: "",
106
+ },
107
+ templates: {
108
+ main: getTemplate(),
109
+ },
110
+ actions: {
111
+ on: () => {
112
+ throw new Error("the on action is not defined");
113
+ },
114
+ off: () => {
115
+ throw new Error("the off action is not defined");
116
+ },
117
+ },
118
+ });
119
+ }
120
+
121
+ /**
122
+ * @return {ToggleSwitch}
123
+ */
124
+ [assembleMethodSymbol]() {
125
+ const self = this;
126
+ super[assembleMethodSymbol]();
127
+ initControlReferences.call(this);
128
+ initEventHandler.call(this);
129
+
130
+ /**
131
+ * init value to off
132
+ * if the value was not defined before inserting it into the HTML
133
+ */
134
+ if (self.getOption("value") === null) {
135
+ self.setOption("value", self.getOption("values.off"));
136
+ }
137
+
138
+ /**
139
+ * value from attribute
140
+ */
141
+ if (self.hasAttribute("value")) {
142
+ self.setOption("value", self.getAttribute("value"));
143
+ }
144
+
145
+ /**
146
+ * validate value
147
+ */
148
+ validateAndSetValue.call(self);
149
+
150
+ if (this.state === STATE_ON) {
151
+ toggleClassOn.call(self);
152
+ } else {
153
+ toggleClassOff.call(self);
154
+ }
155
+
156
+ /**
157
+ * is called when options changed
158
+ */
159
+ self[internalSymbol].attachObserver(
160
+ new Observer(function () {
161
+ if (isObject(this) && this instanceof ProxyObserver) {
162
+ validateAndSetValue.call(self);
163
+ toggleClass.call(self);
164
+ }
165
+ }),
166
+ );
167
+
168
+ return this;
169
+ }
170
+
171
+ /**
172
+ * updater transformer methods for pipe
173
+ *
174
+ * @return {function}
175
+ */
176
+ [updaterTransformerMethodsSymbol]() {
177
+ return {
178
+ "state-callback": (Wert) => {
179
+ return this.state;
180
+ },
181
+ };
182
+ }
183
+
184
+ /**
185
+ * @return [CSSStyleSheet]
186
+ */
187
+ static getCSSStyleSheet() {
188
+ return [ToggleSwitchStyleSheet];
189
+ }
190
+
191
+ /**
192
+ * toggle switch
193
+ *
194
+ * ```
195
+ * e = document.querySelector('monster-toggle-switch');
196
+ * e.click()
197
+ * ```
198
+ */
199
+ click() {
200
+ toggleValues.call(this);
201
+ }
202
+
203
+ /**
204
+ * toggle switch on/off
205
+ *
206
+ * ```
207
+ * e = document.querySelector('monster-toggle-switch');
208
+ * e.toggle()
209
+ * ```
210
+ *
211
+ * @return {ToggleSwitch}
212
+ */
213
+ toggle() {
214
+ this.click();
215
+ return this;
216
+ }
217
+
218
+ /**
219
+ * toggle switch on
220
+ *
221
+ * ```
222
+ * e = document.querySelector('monster-toggle-switch');
223
+ * e.toggleOn()
224
+ * ```
225
+ *
226
+ * @return {ToggleSwitch}
227
+ */
228
+ toggleOn() {
229
+ this.setOption("value", this.getOption("values.on"));
230
+ return this;
231
+ }
232
+
233
+ /**
234
+ * toggle switch off
235
+ *
236
+ * ```
237
+ * e = document.querySelector('monster-toggle-switch');
238
+ * e.toggleOff()
239
+ * ```
240
+ *
241
+ * @return {ToggleSwitch}
242
+ */
243
+ toggleOff() {
244
+ this.setOption("value", this.getOption("values.off"));
245
+ return this;
246
+ }
247
+
248
+ /**
249
+ * returns the status of the element
250
+ *
251
+ * ```
252
+ * e = document.querySelector('monster-toggle-switch');
253
+ * console.log(e.state)
254
+ * // ↦ off
255
+ * ```
256
+ *
257
+ * @return {string}
258
+ */
259
+ get state() {
260
+ return this.getOption("value") === this.getOption("values.on")
261
+ ? STATE_ON
262
+ : STATE_OFF;
263
+ }
264
+
265
+ /**
266
+ * The current value of the Switch
267
+ *
268
+ * ```
269
+ * e = document.querySelector('monster-toggle-switch');
270
+ * console.log(e.value)
271
+ * // ↦ on
272
+ * ```
273
+ *
274
+ * @return {string}
275
+ */
276
+ get value() {
277
+ return this.state === STATE_ON
278
+ ? this.getOption("values.on")
279
+ : this.getOption("values.off");
280
+ }
281
+
282
+ /**
283
+ * Set value
284
+ *
285
+ * ```
286
+ * e = document.querySelector('monster-toggle-switch');
287
+ * e.value="on"
288
+ * ```
289
+ *
290
+ * @property {string} value
291
+ */
292
+ set value(value) {
293
+ this.setOption("value", value);
294
+ }
295
+
296
+ /**
297
+ * This method is called by the `instanceof` operator.
298
+ * @returns {symbol}
299
+ */
300
+ static get [instanceSymbol]() {
301
+ return Symbol.for(
302
+ "@schukai/monster/components/form/toggle-switch@@instance",
303
+ );
304
+ }
305
+
306
+ static getTag() {
307
+ return "monster-toggle-switch";
308
+ }
328
309
  }
329
310
 
330
311
  /**
331
312
  * @private
332
313
  */
333
314
  function initControlReferences() {
334
- this[switchElementSymbol] = this.shadowRoot.querySelector(
335
- `[${ATTRIBUTE_ROLE}=switch]`,
336
- );
315
+ this[switchElementSymbol] = this.shadowRoot.querySelector(
316
+ `[${ATTRIBUTE_ROLE}=switch]`,
317
+ );
337
318
  }
338
319
 
339
320
  /**
340
321
  * @private
341
322
  */
342
323
  function toggleClassOn() {
343
- this[switchElementSymbol].classList.remove(this.getOption("classes.off")); // change color
344
- this[switchElementSymbol].classList.add(this.getOption("classes.on")); // change color
324
+ this[switchElementSymbol].classList.remove(this.getOption("classes.off")); // change color
325
+ this[switchElementSymbol].classList.add(this.getOption("classes.on")); // change color
345
326
  }
346
327
 
347
328
  /**
348
329
  * @private
349
330
  */
350
331
  function toggleClassOff() {
351
- this[switchElementSymbol].classList.remove(this.getOption("classes.on")); // change color
352
- this[switchElementSymbol].classList.add(this.getOption("classes.off")); // change color
332
+ this[switchElementSymbol].classList.remove(this.getOption("classes.on")); // change color
333
+ this[switchElementSymbol].classList.add(this.getOption("classes.off")); // change color
353
334
  }
354
335
 
355
336
  /**
356
337
  * @private
357
338
  */
358
339
  function toggleClass() {
359
- if (this.getOption("value") === this.getOption("values.on")) {
360
- toggleClassOn.call(this);
361
- } else {
362
- toggleClassOff.call(this);
363
- }
340
+ if (this.getOption("value") === this.getOption("values.on")) {
341
+ toggleClassOn.call(this);
342
+ } else {
343
+ toggleClassOff.call(this);
344
+ }
364
345
  }
365
346
 
366
347
  /**
367
348
  * @private
368
349
  */
369
350
  function toggleValues() {
370
- if (this.getOption("disabled") === true) {
371
- return;
372
- }
351
+ if (this.getOption("disabled") === true) {
352
+ return;
353
+ }
373
354
 
374
- let callback, value;
355
+ let callback, value;
375
356
 
376
- if (this.getOption("value") === this.getOption("values.on")) {
377
- value = this.getOption("values.off");
378
- callback = this.getOption("actions.off");
379
- } else {
380
- value = this.getOption("values.on");
381
- callback = this.getOption("actions.on");
382
- }
357
+ if (this.getOption("value") === this.getOption("values.on")) {
358
+ value = this.getOption("values.off");
359
+ callback = this.getOption("actions.off");
360
+ } else {
361
+ value = this.getOption("values.on");
362
+ callback = this.getOption("actions.on");
363
+ }
383
364
 
384
- this.setOption("value", value);
385
- this?.setFormValue(value);
365
+ this.setOption("value", value);
366
+ this?.setFormValue(value);
386
367
 
387
- if (isFunction(callback)) {
388
- callback.call(this);
389
- }
368
+ if (isFunction(callback)) {
369
+ callback.call(this);
370
+ }
390
371
 
391
- this.setOption("state", this.state);
372
+ this.setOption("state", this.state);
392
373
  }
393
374
 
394
375
  /**
395
376
  * @private
396
377
  */
397
378
  function validateAndSetValue() {
398
- const value = this.getOption("value");
399
-
400
- const validatedValues = [];
401
- validatedValues.push(this.getOption("values.on"));
402
- validatedValues.push(this.getOption("values.off"));
403
-
404
- if (validatedValues.includes(value) === false) {
405
- addAttributeToken(
406
- this,
407
- ATTRIBUTE_ERRORMESSAGE,
408
- 'The value "' +
409
- value +
410
- '" must be "' +
411
- this.getOption("values.on") +
412
- '" or "' +
413
- this.getOption("values.off"),
414
- );
415
- this.setOption("disabled", true);
416
- this.formDisabledCallback(true);
417
- } else {
418
- this.setOption("disabled", false);
419
- this.formDisabledCallback(false);
420
- }
379
+ const value = this.getOption("value");
380
+
381
+ const validatedValues = [];
382
+ validatedValues.push(this.getOption("values.on"));
383
+ validatedValues.push(this.getOption("values.off"));
384
+
385
+ if (validatedValues.includes(value) === false) {
386
+ addAttributeToken(
387
+ this,
388
+ ATTRIBUTE_ERRORMESSAGE,
389
+ 'The value "' +
390
+ value +
391
+ '" must be "' +
392
+ this.getOption("values.on") +
393
+ '" or "' +
394
+ this.getOption("values.off"),
395
+ );
396
+ this.setOption("disabled", true);
397
+ this.formDisabledCallback(true);
398
+ } else {
399
+ this.setOption("disabled", false);
400
+ this.formDisabledCallback(false);
401
+ }
421
402
  }
422
403
 
423
404
  /**
@@ -425,16 +406,16 @@ function validateAndSetValue() {
425
406
  * @return {initEventHandler}
426
407
  */
427
408
  function initEventHandler() {
428
- const self = this;
429
- self.addEventListener("keyup", function (event) {
430
- if (event.code === "Space") {
431
- self[switchElementSymbol].click();
432
- }
433
- });
434
- self.addEventListener("click", function (event) {
435
- toggleValues.call(self);
436
- });
437
- return this;
409
+ const self = this;
410
+ self.addEventListener("keyup", function (event) {
411
+ if (event.code === "Space") {
412
+ self[switchElementSymbol].click();
413
+ }
414
+ });
415
+ self.addEventListener("click", function (event) {
416
+ toggleValues.call(self);
417
+ });
418
+ return this;
438
419
  }
439
420
 
440
421
  /**
@@ -442,13 +423,13 @@ function initEventHandler() {
442
423
  * @return {string}
443
424
  */
444
425
  function getTemplate() {
445
- // language=HTML
446
- return `
426
+ // language=HTML
427
+ return `
447
428
  <div data-monster-role="control" part="control" tabindex="0">
448
429
  <div class="switch" data-monster-role="switch"
449
430
  data-monster-attributes="data-monster-state path:value | call:state-callback">
450
- <div class="label on" data-monster-replace="path:labels.toggle-switch-on"></div>
451
- <div class="label off" data-monster-replace="path:labels.toggle-switch-off"></div>
431
+ <div class="label on" data-monster-replace="path:labels.toggleSwitchOn"></div>
432
+ <div class="label off" data-monster-replace="path:labels.toggleSwitchOff"></div>
452
433
  <div data-monster-attributes="class path:classes.handle | suffix:\\ switch-slider"></div>
453
434
  </div>
454
435
  </div>`;