@schukai/monster 3.75.0 → 3.77.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/CHANGELOG.md +33 -8
  2. package/package.json +1 -1
  3. package/source/components/datatable/change-button.mjs +1 -1
  4. package/source/components/datatable/columnbar.mjs +1 -1
  5. package/source/components/datatable/dataset.mjs +1 -1
  6. package/source/components/datatable/datasource/dom.mjs +1 -1
  7. package/source/components/datatable/datasource/rest.mjs +1 -1
  8. package/source/components/datatable/datasource.mjs +1 -1
  9. package/source/components/datatable/datatable.mjs +1 -1
  10. package/source/components/datatable/filter/date-range.mjs +1 -1
  11. package/source/components/datatable/filter/input.mjs +1 -1
  12. package/source/components/datatable/filter/range.mjs +1 -1
  13. package/source/components/datatable/filter/select.mjs +1 -1
  14. package/source/components/datatable/filter-button.mjs +1 -1
  15. package/source/components/datatable/filter.mjs +1 -1
  16. package/source/components/datatable/pagination.mjs +1 -1
  17. package/source/components/datatable/save-button.mjs +1 -1
  18. package/source/components/datatable/status.mjs +1 -1
  19. package/source/components/form/action-button.mjs +1 -1
  20. package/source/components/form/api-button.mjs +1 -1
  21. package/source/components/form/button-bar.mjs +1 -1
  22. package/source/components/form/button.mjs +1 -1
  23. package/source/components/form/confirm-button.mjs +1 -1
  24. package/source/components/form/context-error.mjs +2 -2
  25. package/source/components/form/context-help.mjs +1 -1
  26. package/source/components/form/field-set.mjs +31 -44
  27. package/source/components/form/message-state-button.mjs +1 -1
  28. package/source/components/form/popper-button.mjs +1 -1
  29. package/source/components/form/reload.mjs +1 -1
  30. package/source/components/form/select.mjs +1 -1
  31. package/source/components/form/shadow-reload.mjs +1 -1
  32. package/source/components/form/state-button.mjs +1 -1
  33. package/source/components/form/style/field-set.pcss +164 -70
  34. package/source/components/form/stylesheet/field-set.mjs +7 -14
  35. package/source/components/form/template.mjs +1 -1
  36. package/source/components/form/toggle-switch.mjs +321 -340
  37. package/source/components/form/tree-select.mjs +1 -1
  38. package/source/components/host/call-button.mjs +1 -1
  39. package/source/components/host/collapse.mjs +1 -1
  40. package/source/components/host/config-manager.mjs +1 -1
  41. package/source/components/host/host.mjs +1 -1
  42. package/source/components/host/overlay.mjs +1 -1
  43. package/source/components/host/toggle-button.mjs +1 -1
  44. package/source/components/host/viewer.mjs +1 -1
  45. package/source/components/layout/collapse.mjs +361 -395
  46. package/source/components/layout/details.mjs +20 -50
  47. package/source/components/layout/iframe.mjs +358 -0
  48. package/source/components/layout/panel.mjs +11 -26
  49. package/source/components/layout/popper.mjs +1 -1
  50. package/source/components/layout/slider.mjs +12 -12
  51. package/source/components/layout/split-panel.mjs +8 -40
  52. package/source/components/layout/style/iframe.pcss +39 -0
  53. package/source/components/layout/style/panel.pcss +10 -3
  54. package/source/components/layout/style/split-panel.pcss +2 -0
  55. package/source/components/layout/stylesheet/iframe.mjs +38 -0
  56. package/source/components/layout/stylesheet/panel.mjs +1 -1
  57. package/source/components/layout/tabs.mjs +7 -36
  58. package/source/components/layout/width-toggle.mjs +26 -39
  59. package/source/components/navigation/table-of-content.mjs +1 -1
  60. package/source/components/state/log.mjs +167 -153
  61. package/source/components/state/state.mjs +9 -33
  62. package/source/components/stylesheet/form.mjs +6 -13
  63. package/source/components/tree-menu/tree-menu.mjs +16 -12
  64. package/source/math/random.mjs +2 -3
  65. package/source/monster.mjs +2 -1
  66. package/test/cases/components/form/button.mjs +2 -1
  67. package/test/cases/components/form/confirm-button.mjs +1 -1
  68. package/test/cases/components/form/form.mjs +1 -1
  69. package/test/cases/components/form/reload.mjs +1 -1
  70. package/test/cases/components/form/select.mjs +1 -1
  71. package/test/cases/components/form/state-button.mjs +1 -1
  72. package/test/cases/components/form/template.mjs +1 -1
  73. package/test/cases/components/form/toggle-switch.mjs +1 -1
  74. package/test/cases/components/form/tree-select.mjs +1 -1
  75. package/test/cases/components/host/details.mjs +1 -1
  76. package/test/cases/components/host/host.mjs +1 -1
  77. package/test/cases/components/host/overlay.mjs +1 -1
  78. package/test/cases/components/layout/panel.mjs +1 -1
  79. package/test/cases/components/layout/slit-panel.mjs +1 -1
  80. package/test/cases/components/layout/tabs.mjs +1 -1
  81. package/test/cases/components/notify/message.mjs +1 -1
  82. package/test/cases/components/notify/notify.mjs +1 -1
  83. package/test/cases/dom/customcontrol.mjs +1 -1
  84. package/test/cases/dom/customelement-initfromscripthost.mjs +1 -1
  85. package/test/cases/dom/customelement.mjs +1 -1
  86. package/test/cases/dom/resource/data.mjs +1 -1
  87. package/test/cases/dom/resource/link/stylesheet.mjs +1 -1
  88. package/test/cases/dom/resource/link.mjs +1 -1
  89. package/test/cases/dom/resource/script.mjs +1 -1
  90. package/test/cases/dom/updater.mjs +1 -1
@@ -13,22 +13,22 @@
13
13
  */
14
14
 
15
15
  import {
16
- assembleMethodSymbol,
17
- CustomElement,
18
- getSlottedElements,
19
- registerCustomElement,
16
+ assembleMethodSymbol,
17
+ CustomElement,
18
+ getSlottedElements,
19
+ registerCustomElement,
20
20
  } from "../../dom/customelement.mjs";
21
- import { CollapseStyleSheet } from "./stylesheet/collapse.mjs";
22
- import { fireCustomEvent } from "../../dom/events.mjs";
23
- import { getDocument } from "../../dom/util.mjs";
24
- import { addAttributeToken } from "../../dom/attributes.mjs";
25
- import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
26
- import { Host } from "../host/host.mjs";
27
- import { generateUniqueConfigKey } from "../host/util.mjs";
28
- import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
29
- import { instanceSymbol } from "../../constants.mjs";
30
-
31
- export { Collapse, nameSymbol };
21
+ import {CollapseStyleSheet} from "./stylesheet/collapse.mjs";
22
+ import {fireCustomEvent} from "../../dom/events.mjs";
23
+ import {getDocument} from "../../dom/util.mjs";
24
+ import {addAttributeToken} from "../../dom/attributes.mjs";
25
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
26
+ import {Host} from "../host/host.mjs";
27
+ import {generateUniqueConfigKey} from "../host/util.mjs";
28
+ import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
29
+ import {instanceSymbol} from "../../constants.mjs";
30
+
31
+ export {Collapse, nameSymbol};
32
32
 
33
33
  /**
34
34
  * @private
@@ -80,330 +80,296 @@ const detailsDecoElementSymbol = Symbol("detailsDecoElement");
80
80
  const nameSymbol = Symbol("name");
81
81
 
82
82
  /**
83
- * The Collapse component is used to show the details.
83
+ * A Collapse component
84
84
  *
85
- * <img src="./images/collapse.png">
85
+ * @fragments /fragments/components/layout/collapse/
86
86
  *
87
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
88
- *
89
- * You can create this control either by specifying the HTML tag <monster-collapse />` directly in the HTML or using
90
- * Javascript via the `document.createElement('monster-collapse');` method.
91
- *
92
- * ```html
93
- * <monster-collapse></monster-collapse>
94
- * ```
95
- *
96
- * Or you can create this CustomControl directly in Javascript:
97
- *
98
- * ```js
99
- * import '@schukai/monster/source/components/host/collapse.mjs';
100
- * document.createElement('monster-collapse');
101
- * ```
102
- *
103
- * The Body should have a class "hidden" to ensure that the styles are applied correctly.
104
- *
105
- * ```css
106
- * body.hidden {
107
- * visibility: hidden;
108
- * }
109
- * ```
110
- *
111
- * @startuml collapse.png
112
- * skinparam monochrome true
113
- * skinparam shadowing false
114
- * HTMLElement <|-- CustomElement
115
- * CustomElement <|-- Collapse
116
- * @enduml
87
+ * @example /examples/components/layout/collapse-simple
117
88
  *
89
+ * @since 3.74.0
118
90
  * @copyright schukai GmbH
119
- * @memberOf Monster.Components.Host
120
- * @summary A simple collapse component
121
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-before-open
122
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-open
123
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-before-close
124
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-closed
125
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-adjust-height
91
+ * @summary A simple collapse component.
126
92
  */
127
93
  class Collapse extends CustomElement {
128
- /**
129
- * This method is called by the `instanceof` operator.
130
- * @returns {symbol}
131
- */
132
- static get [instanceSymbol]() {
133
- return Symbol.for("@schukai/monster/components/layout/collapse@@instance");
134
- }
135
-
136
- /**
137
- *
138
- */
139
- constructor() {
140
- super();
141
- // the name is only used for the host config and the event name
142
- this[nameSymbol] = "collapse";
143
- }
144
-
145
- /**
146
- * To set the options via the html tag the attribute `data-monster-options` must be used.
147
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
148
- *
149
- * The individual configuration values can be found in the table.
150
- *
151
- * @property {Object} templates Template definitions
152
- * @property {string} templates.main Main template
153
- * @property {Object} classes CSS classes
154
- * @property {string} classes.container CSS class for the container
155
- * @property {Object} features Feature configuration
156
- * @property {boolean} features.accordion Enable accordion mode
157
- * @property {boolean} features.persistState Enable persist state (Host and Config-Manager required)
158
- * @property {boolean} features.useScrollValues Use scroll values (scrollHeight) instead of clientHeight for the height calculation
159
- * @property {boolean} openByDefault Open the details by default
160
- */
161
- get defaults() {
162
- return Object.assign({}, super.defaults, {
163
- templates: {
164
- main: getTemplate(),
165
- },
166
- classes: {
167
- container: "padding",
168
- },
169
- features: {
170
- accordion: true,
171
- persistState: true,
172
- useScrollValues: false,
173
- },
174
- openByDefault: false,
175
- });
176
- }
177
-
178
- /**
179
- *
180
- * @returns {Monster.Components.Host.Collapse}
181
- */
182
- [assembleMethodSymbol]() {
183
- super[assembleMethodSymbol]();
184
- initControlReferences.call(this);
185
- initStateFromHostConfig.call(this);
186
- initResizeObserver.call(this);
187
- initEventHandler.call(this);
188
-
189
- if (this.getOption("openByDefault")) {
190
- this.open();
191
- }
192
- }
193
-
194
- /**
195
- *
196
- */
197
- connectedCallback() {
198
- super.connectedCallback();
199
- updateResizeObserverObservation.call(this);
200
- // this[resizeObserverSymbol].observe(getDocument().body);
201
- }
202
-
203
- /**
204
- *
205
- */
206
- disconnectedCallback() {
207
- super.disconnectedCallback();
208
- //this[resizeObserverSymbol].disconnect();
209
- }
210
-
211
- /**
212
- *
213
- * @returns {Monster.Components.Host.Collapse}
214
- */
215
- toggle() {
216
- if (this[detailsElementSymbol].classList.contains("active")) {
217
- this.close();
218
- } else {
219
- this.open();
220
- }
221
- return this;
222
- }
223
-
224
- /**
225
- *
226
- * @returns {boolean}
227
- */
228
- isClosed() {
229
- return !this[detailsElementSymbol].classList.contains("active");
230
- }
231
-
232
- /**
233
- *
234
- * @returns {boolean}
235
- */
236
- isOpen() {
237
- return !this.isClosed();
238
- }
239
-
240
- /**
241
- *
242
- * @returns {Monster.Components.Host.Collapse}
243
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-before-open
244
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-open
245
- */
246
- open() {
247
- let node;
248
- if (this[detailsElementSymbol].classList.contains("active")) {
249
- return this;
250
- }
251
-
252
- fireCustomEvent(this, "monster-" + this[nameSymbol] + "-before-open", {});
253
-
254
- adjustHeight.call(this);
255
- this[detailsElementSymbol].classList.add("active");
256
-
257
- if (this.getOption("features.accordion") === true) {
258
- node = this;
259
- while (node.nextElementSibling instanceof Collapse) {
260
- node = node.nextElementSibling;
261
- node.close();
262
- }
263
-
264
- node = this;
265
- while (node.previousElementSibling instanceof Collapse) {
266
- node = node.previousElementSibling;
267
- node.close();
268
- }
269
- }
270
-
271
- setTimeout(() => {
272
- setTimeout(() => {
273
- updateStateConfig.call(this);
274
- fireCustomEvent(this, "monster-" + this[nameSymbol] + "-open", {});
275
- setTimeout(() => {
276
- this[controlElementSymbol].classList.remove("overflow-hidden");
277
- }, 500);
278
- }, 0);
279
- }, 0);
280
-
281
- return this;
282
- }
283
-
284
- /**
285
- *
286
- * @returns {Monster.Components.Host.Collapse}
287
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-before-close
288
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-closed
289
- */
290
- close() {
291
- if (!this[detailsElementSymbol].classList.contains("active")) {
292
- return this;
293
- }
294
-
295
- fireCustomEvent(this, "monster-" + this[nameSymbol] + "-before-close", {});
296
- this[controlElementSymbol].classList.add("overflow-hidden");
297
-
298
- setTimeout(() => {
299
- this[detailsElementSymbol].classList.remove("active");
300
- setTimeout(() => {
301
- updateStateConfig.call(this);
302
- fireCustomEvent(this, "monster-" + this[nameSymbol] + "-closed", {});
303
- }, 0);
304
- }, 0);
305
-
306
- return this;
307
- }
308
-
309
- /**
310
- *
311
- * @return {string}
312
- */
313
- static getTag() {
314
- return "monster-collapse";
315
- }
316
-
317
- /**
318
- * @return {Array<CSSStyleSheet>}
319
- */
320
- static getCSSStyleSheet() {
321
- return [CollapseStyleSheet];
322
- }
323
-
324
- /**
325
- * This method is called when the element is inserted into a document, including into a shadow tree.
326
- * @return {Monster.Components.Host.Collapse}
327
- * @fires Monster.Components.Host.Collapse.event:monster-collapse-adjust-height
328
- */
329
- adjustHeight() {
330
- adjustHeight.call(this);
331
- return this;
332
- }
94
+ /**
95
+ * This method is called by the `instanceof` operator.
96
+ * @returns {symbol}
97
+ */
98
+ static get [instanceSymbol]() {
99
+ return Symbol.for("@schukai/monster/components/layout/collapse@@instance");
100
+ }
101
+
102
+ /**
103
+ *
104
+ */
105
+ constructor() {
106
+ super();
107
+ // the name is only used for the host config and the event name
108
+ this[nameSymbol] = "collapse";
109
+ }
110
+
111
+ /**
112
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
113
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
114
+ *
115
+ * The individual configuration values can be found in the table.
116
+ *
117
+ * @property {Object} templates Template definitions
118
+ * @property {string} templates.main Main template
119
+ * @property {Object} classes CSS classes
120
+ * @property {string} classes.container CSS class for the container
121
+ * @property {Object} features Feature configuration
122
+ * @property {boolean} features.accordion Enable accordion mode
123
+ * @property {boolean} features.persistState Enable persist state (Host and Config-Manager required)
124
+ * @property {boolean} features.useScrollValues Use scroll values (scrollHeight) instead of clientHeight for the height calculation
125
+ * @property {boolean} openByDefault Open the details by default
126
+ */
127
+ get defaults() {
128
+ return Object.assign({}, super.defaults, {
129
+ templates: {
130
+ main: getTemplate(),
131
+ },
132
+ classes: {
133
+ container: "padding",
134
+ },
135
+ features: {
136
+ accordion: true,
137
+ persistState: true,
138
+ useScrollValues: false,
139
+ },
140
+ openByDefault: false,
141
+ });
142
+ }
143
+
144
+ /**
145
+ *
146
+ * @returns {void}
147
+ */
148
+ [assembleMethodSymbol]() {
149
+ super[assembleMethodSymbol]();
150
+ initControlReferences.call(this);
151
+ initStateFromHostConfig.call(this);
152
+ initResizeObserver.call(this);
153
+ initEventHandler.call(this);
154
+
155
+ if (this.getOption("openByDefault")) {
156
+ this.open();
157
+ }
158
+ }
159
+
160
+ /**
161
+ * @returns {void}
162
+ */
163
+ connectedCallback() {
164
+ super.connectedCallback();
165
+ updateResizeObserverObservation.call(this);
166
+ }
167
+
168
+ /**
169
+ * @returns {void}
170
+ */
171
+ disconnectedCallback() {
172
+ super.disconnectedCallback();
173
+ }
174
+
175
+ /**
176
+ * @returns {Collapse}
177
+ */
178
+ toggle() {
179
+ if (this[detailsElementSymbol].classList.contains("active")) {
180
+ this.close();
181
+ } else {
182
+ this.open();
183
+ }
184
+ return this;
185
+ }
186
+
187
+ /**
188
+ * @returns {boolean}
189
+ */
190
+ isClosed() {
191
+ return !this[detailsElementSymbol].classList.contains("active");
192
+ }
193
+
194
+ /**
195
+ * @returns {boolean}
196
+ */
197
+ isOpen() {
198
+ return !this.isClosed();
199
+ }
200
+
201
+ /**
202
+ * Open the collapse
203
+ * @returns {Collapse}
204
+ * @fires event:monster-collapse-before-open
205
+ * @fires event:monster-collapse-open
206
+ */
207
+ open() {
208
+ let node;
209
+ if (this[detailsElementSymbol].classList.contains("active")) {
210
+ return this;
211
+ }
212
+
213
+ fireCustomEvent(this, "monster-" + this[nameSymbol] + "-before-open", {});
214
+
215
+ adjustHeight.call(this);
216
+ this[detailsElementSymbol].classList.add("active");
217
+
218
+ if (this.getOption("features.accordion") === true) {
219
+ node = this;
220
+ while (node.nextElementSibling instanceof Collapse) {
221
+ node = node.nextElementSibling;
222
+ node.close();
223
+ }
224
+
225
+ node = this;
226
+ while (node.previousElementSibling instanceof Collapse) {
227
+ node = node.previousElementSibling;
228
+ node.close();
229
+ }
230
+ }
231
+
232
+ setTimeout(() => {
233
+ setTimeout(() => {
234
+ updateStateConfig.call(this);
235
+ fireCustomEvent(this, "monster-" + this[nameSymbol] + "-open", {});
236
+ setTimeout(() => {
237
+ this[controlElementSymbol].classList.remove("overflow-hidden");
238
+ }, 500);
239
+ }, 0);
240
+ }, 0);
241
+
242
+ return this;
243
+ }
244
+
245
+ /**
246
+ * Close the collapse
247
+ * @returns {Collapse}
248
+ * @fires event:monster-collapse-before-close
249
+ * @fires event:monster-collapse-closed
250
+ */
251
+ close() {
252
+ if (!this[detailsElementSymbol].classList.contains("active")) {
253
+ return this;
254
+ }
255
+
256
+ fireCustomEvent(this, "monster-" + this[nameSymbol] + "-before-close", {});
257
+ this[controlElementSymbol].classList.add("overflow-hidden");
258
+
259
+ setTimeout(() => {
260
+ this[detailsElementSymbol].classList.remove("active");
261
+ setTimeout(() => {
262
+ updateStateConfig.call(this);
263
+ fireCustomEvent(this, "monster-" + this[nameSymbol] + "-closed", {});
264
+ }, 0);
265
+ }, 0);
266
+
267
+ return this;
268
+ }
269
+
270
+ /**
271
+ * @return {string}
272
+ */
273
+ static getTag() {
274
+ return "monster-collapse";
275
+ }
276
+
277
+ /**
278
+ * @return {Array<CSSStyleSheet>}
279
+ */
280
+ static getCSSStyleSheet() {
281
+ return [CollapseStyleSheet];
282
+ }
283
+
284
+ /**
285
+ * This method is called when the element is inserted into a document, including into a shadow tree.
286
+ * @return {Collapse}
287
+ * @fires event:monster-collapse-adjust-height
288
+ */
289
+ adjustHeight() {
290
+ adjustHeight.call(this);
291
+ return this;
292
+ }
333
293
  }
334
294
 
295
+ /**
296
+ * @private
297
+ * @returns {void}
298
+ * @fires event:monster-collapse-adjust-height
299
+ */
335
300
  function adjustHeight() {
336
- let height = 0;
337
-
338
- if (this[detailsContainerElementSymbol]) {
339
- if (this.getOption("features.useScrollValues")) {
340
- height += this[detailsContainerElementSymbol].scrollHeight;
341
- } else {
342
- height += this[detailsContainerElementSymbol].clientHeight;
343
- }
344
- }
345
-
346
- if (this[detailsDecoElementSymbol]) {
347
- if (this.getOption("features.useScrollValues")) {
348
- height += this[detailsDecoElementSymbol].scrollHeight;
349
- } else {
350
- height += this[detailsDecoElementSymbol].clientHeight + 1;
351
- }
352
- }
353
-
354
- if (height === 0) {
355
- if (this.getOption("features.useScrollValues")) {
356
- height = this[detailsElementSymbol].scrollHeight;
357
- } else {
358
- height = this[detailsElementSymbol].clientHeight;
359
- }
360
-
361
- if (height === 0) {
362
- height = "auto";
363
- }
364
- } else {
365
- height += "px";
366
- }
367
-
368
- this[detailsElementSymbol].style.setProperty(
369
- "--monster-height",
370
- height,
371
- "important",
372
- );
373
- fireCustomEvent(this, "monster-" + this[nameSymbol] + "-adjust-height", {});
301
+ let height = 0;
302
+
303
+ if (this[detailsContainerElementSymbol]) {
304
+ if (this.getOption("features.useScrollValues")) {
305
+ height += this[detailsContainerElementSymbol].scrollHeight;
306
+ } else {
307
+ height += this[detailsContainerElementSymbol].clientHeight;
308
+ }
309
+ }
310
+
311
+ if (this[detailsDecoElementSymbol]) {
312
+ if (this.getOption("features.useScrollValues")) {
313
+ height += this[detailsDecoElementSymbol].scrollHeight;
314
+ } else {
315
+ height += this[detailsDecoElementSymbol].clientHeight + 1;
316
+ }
317
+ }
318
+
319
+ if (height === 0) {
320
+ if (this.getOption("features.useScrollValues")) {
321
+ height = this[detailsElementSymbol].scrollHeight;
322
+ } else {
323
+ height = this[detailsElementSymbol].clientHeight;
324
+ }
325
+
326
+ if (height === 0) {
327
+ height = "auto";
328
+ }
329
+ } else {
330
+ height += "px";
331
+ }
332
+
333
+ this[detailsElementSymbol].style.setProperty(
334
+ "--monster-height",
335
+ height,
336
+ "important",
337
+ );
338
+
339
+ fireCustomEvent(this, "monster-" + this[nameSymbol] + "-adjust-height", {});
374
340
  }
375
341
 
376
342
  function updateResizeObserverObservation() {
377
- this[resizeObserverSymbol].disconnect();
343
+ this[resizeObserverSymbol].disconnect();
378
344
 
379
- const slottedNodes = getSlottedElements.call(this);
380
- slottedNodes.forEach((node) => {
381
- this[resizeObserverSymbol].observe(node);
382
- });
345
+ const slottedNodes = getSlottedElements.call(this);
346
+ slottedNodes.forEach((node) => {
347
+ this[resizeObserverSymbol].observe(node);
348
+ });
383
349
 
384
- if (this[detailsContainerElementSymbol]) {
385
- this[resizeObserverSymbol].observe(this[detailsContainerElementSymbol]);
386
- }
350
+ if (this[detailsContainerElementSymbol]) {
351
+ this[resizeObserverSymbol].observe(this[detailsContainerElementSymbol]);
352
+ }
387
353
 
388
- this.adjustHeight();
354
+ this.adjustHeight();
389
355
  }
390
356
 
391
357
  /**
392
358
  * @private
393
359
  */
394
360
  function initEventHandler() {
395
- if (!this.shadowRoot) {
396
- throw new Error("no shadow-root is defined");
397
- }
361
+ if (!this.shadowRoot) {
362
+ throw new Error("no shadow-root is defined");
363
+ }
398
364
 
399
- initSlotChangedHandler.call(this);
400
- return this;
365
+ initSlotChangedHandler.call(this);
366
+ return this;
401
367
  }
402
368
 
403
369
  function initSlotChangedHandler() {
404
- this[detailsSlotElementSymbol].addEventListener("slotchange", () => {
405
- updateResizeObserverObservation.call(this);
406
- });
370
+ this[detailsSlotElementSymbol].addEventListener("slotchange", () => {
371
+ updateResizeObserverObservation.call(this);
372
+ });
407
373
  }
408
374
 
409
375
  /**
@@ -412,23 +378,23 @@ function initSlotChangedHandler() {
412
378
  * @throws {Error} no shadow-root is defined
413
379
  */
414
380
  function initControlReferences() {
415
- if (!this.shadowRoot) {
416
- throw new Error("no shadow-root is defined");
417
- }
418
-
419
- this[controlElementSymbol] = this.shadowRoot.querySelector(
420
- "[data-monster-role=control]",
421
- );
422
- this[detailsElementSymbol] = this.shadowRoot.querySelector(
423
- "[data-monster-role=detail]",
424
- );
425
- this[detailsSlotElementSymbol] = this.shadowRoot.querySelector("slot");
426
- this[detailsContainerElementSymbol] = this.shadowRoot.querySelector(
427
- "[data-monster-role=container]",
428
- );
429
- this[detailsDecoElementSymbol] = this.shadowRoot.querySelector(
430
- "[data-monster-role=deco]",
431
- );
381
+ if (!this.shadowRoot) {
382
+ throw new Error("no shadow-root is defined");
383
+ }
384
+
385
+ this[controlElementSymbol] = this.shadowRoot.querySelector(
386
+ "[data-monster-role=control]",
387
+ );
388
+ this[detailsElementSymbol] = this.shadowRoot.querySelector(
389
+ "[data-monster-role=detail]",
390
+ );
391
+ this[detailsSlotElementSymbol] = this.shadowRoot.querySelector("slot");
392
+ this[detailsContainerElementSymbol] = this.shadowRoot.querySelector(
393
+ "[data-monster-role=container]",
394
+ );
395
+ this[detailsDecoElementSymbol] = this.shadowRoot.querySelector(
396
+ "[data-monster-role=deco]",
397
+ );
432
398
  }
433
399
 
434
400
  /**
@@ -436,34 +402,34 @@ function initControlReferences() {
436
402
  * @returns {string}
437
403
  */
438
404
  function getConfigKey() {
439
- return generateUniqueConfigKey(this[nameSymbol], this.id, "state");
405
+ return generateUniqueConfigKey(this[nameSymbol], this.id, "state");
440
406
  }
441
407
 
442
408
  /**
443
409
  * @private
444
410
  */
445
411
  function updateStateConfig() {
446
- if (!this.getOption("features.persistState")) {
447
- return;
448
- }
449
-
450
- if (!this[detailsElementSymbol]) {
451
- return;
452
- }
453
-
454
- const document = getDocument();
455
- const host = document.querySelector("monster-host");
456
- if (!(host && this.id)) {
457
- return;
458
- }
459
-
460
- const configKey = getConfigKey.call(this);
461
-
462
- try {
463
- host.setConfig(configKey, this.isOpen());
464
- } catch (error) {
465
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, String(error));
466
- }
412
+ if (!this.getOption("features.persistState")) {
413
+ return;
414
+ }
415
+
416
+ if (!this[detailsElementSymbol]) {
417
+ return;
418
+ }
419
+
420
+ const document = getDocument();
421
+ const host = document.querySelector("monster-host");
422
+ if (!(host && this.id)) {
423
+ return;
424
+ }
425
+
426
+ const configKey = getConfigKey.call(this);
427
+
428
+ try {
429
+ host.setConfig(configKey, this.isOpen());
430
+ } catch (error) {
431
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, String(error));
432
+ }
467
433
  }
468
434
 
469
435
  /**
@@ -471,55 +437,55 @@ function updateStateConfig() {
471
437
  * @returns {Promise}
472
438
  */
473
439
  function initStateFromHostConfig() {
474
- if (!this.getOption("features.persistState")) {
475
- return Promise.resolve({});
476
- }
477
-
478
- const document = getDocument();
479
- const host = document.querySelector("monster-host");
480
-
481
- if (!(host && this.id)) {
482
- return Promise.resolve({});
483
- }
484
-
485
- const configKey = getConfigKey.call(this);
486
- return host
487
- .getConfig(configKey)
488
- .then((state) => {
489
- if (state === true) {
490
- this.open();
491
- } else {
492
- this.close();
493
- }
494
- })
495
- .catch((error) => {
496
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
497
- });
440
+ if (!this.getOption("features.persistState")) {
441
+ return Promise.resolve({});
442
+ }
443
+
444
+ const document = getDocument();
445
+ const host = document.querySelector("monster-host");
446
+
447
+ if (!(host && this.id)) {
448
+ return Promise.resolve({});
449
+ }
450
+
451
+ const configKey = getConfigKey.call(this);
452
+ return host
453
+ .getConfig(configKey)
454
+ .then((state) => {
455
+ if (state === true) {
456
+ this.open();
457
+ } else {
458
+ this.close();
459
+ }
460
+ })
461
+ .catch((error) => {
462
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
463
+ });
498
464
  }
499
465
 
500
466
  /**
501
467
  * @private
502
468
  */
503
469
  function initResizeObserver() {
504
- // against flickering
505
- this[resizeObserverSymbol] = new ResizeObserver((entries) => {
506
- if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
507
- try {
508
- this[timerCallbackSymbol].touch();
509
- return;
510
- } catch (e) {
511
- delete this[timerCallbackSymbol];
512
- }
513
- }
514
-
515
- this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
516
- checkAndRearrangeContent.call(this);
517
- });
518
- });
470
+ // against flickering
471
+ this[resizeObserverSymbol] = new ResizeObserver((entries) => {
472
+ if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
473
+ try {
474
+ this[timerCallbackSymbol].touch();
475
+ return;
476
+ } catch (e) {
477
+ delete this[timerCallbackSymbol];
478
+ }
479
+ }
480
+
481
+ this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
482
+ checkAndRearrangeContent.call(this);
483
+ });
484
+ });
519
485
  }
520
486
 
521
487
  function checkAndRearrangeContent() {
522
- this.adjustHeight();
488
+ this.adjustHeight();
523
489
  }
524
490
 
525
491
  /**
@@ -527,8 +493,8 @@ function checkAndRearrangeContent() {
527
493
  * @return {string}
528
494
  */
529
495
  function getTemplate() {
530
- // language=HTML
531
- return `
496
+ // language=HTML
497
+ return `
532
498
  <div data-monster-role="control" part="control" class="overflow-hidden">
533
499
  <div data-monster-role="detail">
534
500
  <div data-monster-attributes="class path:classes.container" part="container"