@schukai/monster 4.46.0 → 4.46.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.46.2] - 2025-11-19
6
+
7
+ ### Bug Fixes
8
+
9
+ - field-set-alignment should be changeable
10
+
11
+
12
+
13
+ ## [4.46.1] - 2025-11-18
14
+
15
+ ### Bug Fixes
16
+
17
+ - update doc
18
+ ### Changes
19
+
20
+ - update node
21
+
22
+
23
+
5
24
  ## [4.46.0] - 2025-11-18
6
25
 
7
26
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.46.0"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.46.2"}
@@ -15,14 +15,14 @@
15
15
  import { instanceSymbol } from "../../constants.mjs";
16
16
  import { addAttributeToken } from "../../dom/attributes.mjs";
17
17
  import {
18
- ATTRIBUTE_ERRORMESSAGE,
19
- ATTRIBUTE_ROLE,
18
+ ATTRIBUTE_ERRORMESSAGE,
19
+ ATTRIBUTE_ROLE,
20
20
  } from "../../dom/constants.mjs";
21
21
  import { CustomControl } from "../../dom/customcontrol.mjs";
22
22
  import {
23
- assembleMethodSymbol,
24
- getSlottedElements,
25
- registerCustomElement,
23
+ assembleMethodSymbol,
24
+ getSlottedElements,
25
+ registerCustomElement,
26
26
  } from "../../dom/customelement.mjs";
27
27
  import { isFunction } from "../../types/is.mjs";
28
28
  import { FieldSetStyleSheet } from "./stylesheet/field-set.mjs";
@@ -82,166 +82,168 @@ const extendedSwitchElementSymbol = Symbol("extendedSwitchElement");
82
82
  * @summary A field set control
83
83
  */
84
84
  class FieldSet extends CustomControl {
85
- /**
86
- * This method is called by the `instanceof` operator.
87
- * @return {symbol}
88
- */
89
- static get [instanceSymbol]() {
90
- return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
91
- }
92
-
93
- /**
94
- * @return {Components.Form.FieldSet
95
- */
96
- [assembleMethodSymbol]() {
97
- super[assembleMethodSymbol]();
98
- initControlReferences.call(this);
99
- initEventHandler.call(this);
100
- updateExtendedFields.call(this);
101
- updateColumns.call(this);
102
- return this;
103
- }
104
-
105
- /**
106
- * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
107
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
108
- *
109
- * The individual configuration values can be found in the table.
110
- *
111
- * @property {Object} templates Template definitions
112
- * @property {string} templates.main Main template
113
- * @property {Object} labels Label definitions
114
- * @property {Object} actions Callbacks
115
- * @property {string} actions.click="throw Error" Callback when clicked
116
- * @property {Object} features Features
117
- * @property {boolean} features.multipleColumns=true Multiple columns
118
- * @property {Object} classes CSS classes
119
- * @property {boolean} disabled=false Disabled state
120
- */
121
- get defaults() {
122
- return Object.assign({}, super.defaults, {
123
- templates: {
124
- main: getTemplate(),
125
- },
126
- labels: getTranslations(),
127
- classes: {},
128
- disabled: false,
129
- features: {
130
- multipleColumns: true,
131
- },
132
- actions: {
133
- click: () => {},
134
- },
135
- value: null,
136
- });
137
- }
138
-
139
- /**
140
- *
141
- * @return {string}
142
- */
143
- static getTag() {
144
- return "monster-field-set";
145
- }
146
-
147
- /**
148
- *
149
- * @return {CSSStyleSheet[]}
150
- */
151
- static getCSSStyleSheet() {
152
- return [FieldSetStyleSheet, InvalidStyleSheet];
153
- }
154
-
155
- /**
156
- * The FieldSet.click() method simulates a click on the internal element.
157
- *
158
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
159
- */
160
- click() {
161
- if (this.getOption("disabled") === true) {
162
- return;
163
- }
164
-
165
- if (
166
- this[fieldSetElementSymbol] &&
167
- isFunction(this[fieldSetElementSymbol].click)
168
- ) {
169
- this[fieldSetElementSymbol].click();
170
- }
171
- }
172
-
173
- /**
174
- * The Button.focus() method sets focus on the internal element.
175
- *
176
- * @param {Object} options
177
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
178
- */
179
- focus(options) {
180
- if (this.getOption("disabled") === true) {
181
- return;
182
- }
183
-
184
- if (
185
- this[fieldSetElementSymbol] &&
186
- isFunction(this[fieldSetElementSymbol].focus)
187
- ) {
188
- this[fieldSetElementSymbol].focus(options);
189
- }
190
- }
191
-
192
- /**
193
- * The Button.blur() method removes focus from the internal element.
194
- */
195
- blur() {
196
- if (
197
- this[fieldSetElementSymbol] &&
198
- isFunction(this[fieldSetElementSymbol].blur)
199
- ) {
200
- this[fieldSetElementSymbol].blur();
201
- }
202
- }
203
-
204
- /**
205
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
206
- * @return {boolean}
207
- */
208
- static get formAssociated() {
209
- return true;
210
- }
211
-
212
- /**
213
- * The current value of the form control.
214
- *
215
- * ```js
216
- * e = document.querySelector('monster-field-set');
217
- * console.log(e.value)
218
- * ```
219
- *
220
- * @property {string}
221
- */
222
- get value() {
223
- return this.getOption("value");
224
- }
225
-
226
- /**
227
- * Set the value of the form control.
228
- *
229
- * ```
230
- * e = document.querySelector('monster-field-set');
231
- * e.value=1
232
- * ```
233
- *
234
- * @property {string} value
235
- * @throws {Error} unsupported type
236
- */
237
- set value(value) {
238
- this.setOption("value", value);
239
- try {
240
- this?.setFormValue(this.value);
241
- } catch (e) {
242
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
243
- }
244
- }
85
+ /**
86
+ * This method is called by the `instanceof` operator.
87
+ * @return {symbol}
88
+ */
89
+ static get [instanceSymbol]() {
90
+ return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
91
+ }
92
+
93
+ /**
94
+ * @return {Components.Form.FieldSet
95
+ */
96
+ [assembleMethodSymbol]() {
97
+ super[assembleMethodSymbol]();
98
+ initControlReferences.call(this);
99
+ initEventHandler.call(this);
100
+ updateExtendedFields.call(this);
101
+ updateColumns.call(this);
102
+ return this;
103
+ }
104
+
105
+ /**
106
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
107
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
108
+ *
109
+ * The individual configuration values can be found in the table.
110
+ *
111
+ * @property {Object} templates Template definitions
112
+ * @property {string} templates.main Main template
113
+ * @property {Object} labels Label definitions
114
+ * @property {Object} actions Callbacks
115
+ * @property {string} actions.click="throw Error" Callback when clicked
116
+ * @property {Object} features Features
117
+ * @property {boolean} features.multipleColumns=true Multiple columns
118
+ * @property {Object} classes CSS classes
119
+ * @property {boolean} disabled=false Disabled state
120
+ */
121
+ get defaults() {
122
+ return Object.assign({}, super.defaults, {
123
+ templates: {
124
+ main: getTemplate(),
125
+ },
126
+ labels: getTranslations(),
127
+ classes: {
128
+ content: "collapse-alignment",
129
+ },
130
+ disabled: false,
131
+ features: {
132
+ multipleColumns: true,
133
+ },
134
+ actions: {
135
+ click: () => {},
136
+ },
137
+ value: null,
138
+ });
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @return {string}
144
+ */
145
+ static getTag() {
146
+ return "monster-field-set";
147
+ }
148
+
149
+ /**
150
+ *
151
+ * @return {CSSStyleSheet[]}
152
+ */
153
+ static getCSSStyleSheet() {
154
+ return [FieldSetStyleSheet, InvalidStyleSheet];
155
+ }
156
+
157
+ /**
158
+ * The FieldSet.click() method simulates a click on the internal element.
159
+ *
160
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
161
+ */
162
+ click() {
163
+ if (this.getOption("disabled") === true) {
164
+ return;
165
+ }
166
+
167
+ if (
168
+ this[fieldSetElementSymbol] &&
169
+ isFunction(this[fieldSetElementSymbol].click)
170
+ ) {
171
+ this[fieldSetElementSymbol].click();
172
+ }
173
+ }
174
+
175
+ /**
176
+ * The Button.focus() method sets focus on the internal element.
177
+ *
178
+ * @param {Object} options
179
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
180
+ */
181
+ focus(options) {
182
+ if (this.getOption("disabled") === true) {
183
+ return;
184
+ }
185
+
186
+ if (
187
+ this[fieldSetElementSymbol] &&
188
+ isFunction(this[fieldSetElementSymbol].focus)
189
+ ) {
190
+ this[fieldSetElementSymbol].focus(options);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * The Button.blur() method removes focus from the internal element.
196
+ */
197
+ blur() {
198
+ if (
199
+ this[fieldSetElementSymbol] &&
200
+ isFunction(this[fieldSetElementSymbol].blur)
201
+ ) {
202
+ this[fieldSetElementSymbol].blur();
203
+ }
204
+ }
205
+
206
+ /**
207
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
208
+ * @return {boolean}
209
+ */
210
+ static get formAssociated() {
211
+ return true;
212
+ }
213
+
214
+ /**
215
+ * The current value of the form control.
216
+ *
217
+ * ```js
218
+ * e = document.querySelector('monster-field-set');
219
+ * console.log(e.value)
220
+ * ```
221
+ *
222
+ * @property {string}
223
+ */
224
+ get value() {
225
+ return this.getOption("value");
226
+ }
227
+
228
+ /**
229
+ * Set the value of the form control.
230
+ *
231
+ * ```
232
+ * e = document.querySelector('monster-field-set');
233
+ * e.value=1
234
+ * ```
235
+ *
236
+ * @property {string} value
237
+ * @throws {Error} unsupported type
238
+ */
239
+ set value(value) {
240
+ this.setOption("value", value);
241
+ try {
242
+ this?.setFormValue(this.value);
243
+ } catch (e) {
244
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
245
+ }
246
+ }
245
247
  }
246
248
 
247
249
  /**
@@ -249,97 +251,97 @@ class FieldSet extends CustomControl {
249
251
  * @returns {object}
250
252
  */
251
253
  function getTranslations() {
252
- const locale = getLocaleOfDocument();
253
- switch (locale.language) {
254
- case "de":
255
- return {
256
- toggleSwitchOn: "✔",
257
- toggleSwitchOff: "✖",
258
- toggleSwitchLabel: "Erweitern",
259
- title: "",
260
- };
261
- case "fr":
262
- return {
263
- toggleSwitchOn: "✔",
264
- toggleSwitchOff: "✖",
265
- toggleSwitchLabel: "Développer",
266
- title: "",
267
- };
268
- case "sp":
269
- return {
270
- toggleSwitchOn: "✔",
271
- toggleSwitchOff: "✖",
272
- toggleSwitchLabel: "Expandir",
273
- title: "",
274
- };
275
- case "it":
276
- return {
277
- toggleSwitchOn: "✔",
278
- toggleSwitchOff: "✖",
279
- toggleSwitchLabel: "Espandi",
280
- title: "",
281
- };
282
- case "pl":
283
- return {
284
- toggleSwitchOn: "✔",
285
- toggleSwitchOff: "✖",
286
- toggleSwitchLabel: "Rozwiń",
287
- title: "",
288
- };
289
- case "no":
290
- return {
291
- toggleSwitchOn: "✔",
292
- toggleSwitchOff: "✖",
293
- toggleSwitchLabel: "Utvid",
294
- title: "",
295
- };
296
- case "dk":
297
- return {
298
- toggleSwitchOn: "✔",
299
- toggleSwitchOff: "✖",
300
- toggleSwitchLabel: "Udvid",
301
- title: "",
302
- };
303
- case "sw":
304
- return {
305
- toggleSwitchOn: "✔",
306
- toggleSwitchOff: "✖",
307
- toggleSwitchLabel: "Expandera",
308
- title: "",
309
- };
310
- default:
311
- case "en":
312
- return {
313
- toggleSwitchOn: "✔",
314
- toggleSwitchOff: "✖",
315
- toggleSwitchLabel: "Expand",
316
- title: "",
317
- };
318
- }
254
+ const locale = getLocaleOfDocument();
255
+ switch (locale.language) {
256
+ case "de":
257
+ return {
258
+ toggleSwitchOn: "✔",
259
+ toggleSwitchOff: "✖",
260
+ toggleSwitchLabel: "Erweitern",
261
+ title: "",
262
+ };
263
+ case "fr":
264
+ return {
265
+ toggleSwitchOn: "✔",
266
+ toggleSwitchOff: "✖",
267
+ toggleSwitchLabel: "Développer",
268
+ title: "",
269
+ };
270
+ case "sp":
271
+ return {
272
+ toggleSwitchOn: "✔",
273
+ toggleSwitchOff: "✖",
274
+ toggleSwitchLabel: "Expandir",
275
+ title: "",
276
+ };
277
+ case "it":
278
+ return {
279
+ toggleSwitchOn: "✔",
280
+ toggleSwitchOff: "✖",
281
+ toggleSwitchLabel: "Espandi",
282
+ title: "",
283
+ };
284
+ case "pl":
285
+ return {
286
+ toggleSwitchOn: "✔",
287
+ toggleSwitchOff: "✖",
288
+ toggleSwitchLabel: "Rozwiń",
289
+ title: "",
290
+ };
291
+ case "no":
292
+ return {
293
+ toggleSwitchOn: "✔",
294
+ toggleSwitchOff: "✖",
295
+ toggleSwitchLabel: "Utvid",
296
+ title: "",
297
+ };
298
+ case "dk":
299
+ return {
300
+ toggleSwitchOn: "✔",
301
+ toggleSwitchOff: "✖",
302
+ toggleSwitchLabel: "Udvid",
303
+ title: "",
304
+ };
305
+ case "sw":
306
+ return {
307
+ toggleSwitchOn: "✔",
308
+ toggleSwitchOff: "✖",
309
+ toggleSwitchLabel: "Expandera",
310
+ title: "",
311
+ };
312
+ default:
313
+ case "en":
314
+ return {
315
+ toggleSwitchOn: "✔",
316
+ toggleSwitchOff: "✖",
317
+ toggleSwitchLabel: "Expand",
318
+ title: "",
319
+ };
320
+ }
319
321
  }
320
322
 
321
323
  /**
322
324
  * @private
323
325
  */
324
326
  function updateExtendedFields() {
325
- const nodes = getSlottedElements.call(this, "", "extended");
326
- if (nodes.size > 0) {
327
- this[extendedSwitchSymbol].classList.remove("hidden");
328
- } else {
329
- this[extendedSwitchSymbol].classList.add("hidden");
330
- }
327
+ const nodes = getSlottedElements.call(this, "", "extended");
328
+ if (nodes.size > 0) {
329
+ this[extendedSwitchSymbol].classList.remove("hidden");
330
+ } else {
331
+ this[extendedSwitchSymbol].classList.add("hidden");
332
+ }
331
333
  }
332
334
 
333
335
  /**
334
336
  * @private
335
337
  */
336
338
  function updateColumns() {
337
- if (this.getOption("features.multipleColumns") !== true) {
338
- this[fieldSetElementSymbol].classList.remove("multiple-columns");
339
- return;
340
- }
339
+ if (this.getOption("features.multipleColumns") !== true) {
340
+ this[fieldSetElementSymbol].classList.remove("multiple-columns");
341
+ return;
342
+ }
341
343
 
342
- this[fieldSetElementSymbol].classList.add("multiple-columns");
344
+ this[fieldSetElementSymbol].classList.add("multiple-columns");
343
345
  }
344
346
 
345
347
  /**
@@ -348,53 +350,53 @@ function updateColumns() {
348
350
  * @fires monster-field-set-clicked
349
351
  */
350
352
  function initEventHandler() {
351
- this[toggleSwitchElementSymbol].setOption(
352
- "labels.toggleSwitchOn",
353
- this.getOption("labels.toggleSwitchOn"),
354
- );
355
- this[toggleSwitchElementSymbol].setOption(
356
- "labels.toggleSwitchOff",
357
- this.getOption("labels.toggleSwitchOff"),
358
- );
359
-
360
- this[toggleSwitchElementSymbol].setOption("actions.on", () => {
361
- this[collapseElementSymbol].open();
362
- });
363
-
364
- this[toggleSwitchElementSymbol].setOption("actions.off", () => {
365
- this[collapseElementSymbol].close();
366
- });
367
-
368
- return this;
353
+ this[toggleSwitchElementSymbol].setOption(
354
+ "labels.toggleSwitchOn",
355
+ this.getOption("labels.toggleSwitchOn"),
356
+ );
357
+ this[toggleSwitchElementSymbol].setOption(
358
+ "labels.toggleSwitchOff",
359
+ this.getOption("labels.toggleSwitchOff"),
360
+ );
361
+
362
+ this[toggleSwitchElementSymbol].setOption("actions.on", () => {
363
+ this[collapseElementSymbol].open();
364
+ });
365
+
366
+ this[toggleSwitchElementSymbol].setOption("actions.off", () => {
367
+ this[collapseElementSymbol].close();
368
+ });
369
+
370
+ return this;
369
371
  }
370
372
 
371
373
  /**
372
374
  * @private
373
375
  */
374
376
  function initControlReferences() {
375
- this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
376
- `[${ATTRIBUTE_ROLE}="control"]`,
377
- );
377
+ this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
378
+ `[${ATTRIBUTE_ROLE}="control"]`,
379
+ );
378
380
 
379
- this[extendedSwitchElementSymbol] = this.shadowRoot.querySelector(
380
- `[${ATTRIBUTE_ROLE}="extended-switch"]`,
381
- );
381
+ this[extendedSwitchElementSymbol] = this.shadowRoot.querySelector(
382
+ `[${ATTRIBUTE_ROLE}="extended-switch"]`,
383
+ );
382
384
 
383
- this[collapseElementSymbol] = this.shadowRoot.querySelector(
384
- `[${ATTRIBUTE_ROLE}="collapse"]`,
385
- );
385
+ this[collapseElementSymbol] = this.shadowRoot.querySelector(
386
+ `[${ATTRIBUTE_ROLE}="collapse"]`,
387
+ );
386
388
 
387
- this[headerElementSymbol] = this.shadowRoot.querySelector(
388
- `[${ATTRIBUTE_ROLE}="header"]`,
389
- );
389
+ this[headerElementSymbol] = this.shadowRoot.querySelector(
390
+ `[${ATTRIBUTE_ROLE}="header"]`,
391
+ );
390
392
 
391
- this[extendedSwitchSymbol] = this.shadowRoot.querySelector(
392
- `[${ATTRIBUTE_ROLE}="extended-switch"]`,
393
- );
393
+ this[extendedSwitchSymbol] = this.shadowRoot.querySelector(
394
+ `[${ATTRIBUTE_ROLE}="extended-switch"]`,
395
+ );
394
396
 
395
- this[toggleSwitchElementSymbol] = this.shadowRoot.querySelector(
396
- `monster-toggle-switch`,
397
- );
397
+ this[toggleSwitchElementSymbol] = this.shadowRoot.querySelector(
398
+ `monster-toggle-switch`,
399
+ );
398
400
  }
399
401
 
400
402
  /**
@@ -402,8 +404,8 @@ function initControlReferences() {
402
404
  * @return {string}
403
405
  */
404
406
  function getTemplate() {
405
- // language=HTML
406
- return `
407
+ // language=HTML
408
+ return `
407
409
  <div data-monster-role="control" part="control">
408
410
  <div data-monster-role="header" part="header">
409
411
  <div data-monster-replace="path:labels.title" data-monster-role="title" part="title"></div>
@@ -413,7 +415,8 @@ function getTemplate() {
413
415
  </div>
414
416
  </div>
415
417
  <div data-monster-role="container" part="container">
416
- <div class="collapse-alignment" part="content">
418
+ <div data-monster-attributes="class path:classes.content"
419
+ part="content">
417
420
  <slot></slot>
418
421
  </div>
419
422
  <monster-collapse data-monster-role="collapse" part="collapse">