@schukai/monster 4.45.5 → 4.46.1

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,28 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.46.1] - 2025-11-18
6
+
7
+ ### Bug Fixes
8
+
9
+ - update doc
10
+ ### Changes
11
+
12
+ - update node
13
+
14
+
15
+
16
+ ## [4.46.0] - 2025-11-18
17
+
18
+ ### Add Features
19
+
20
+ - Improve Callback API for Advanced Validation & Flow Control [#342](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/342)
21
+ ### Changes
22
+
23
+ - update css
24
+
25
+
26
+
5
27
  ## [4.45.5] - 2025-11-04
6
28
 
7
29
  ### Bug Fixes
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.45.5"}
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.1"}
@@ -13,8 +13,8 @@ import { instanceSymbol } from "../../constants.mjs";
13
13
  import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
14
14
  import { CustomElement } from "../../dom/customelement.mjs";
15
15
  import {
16
- assembleMethodSymbol,
17
- registerCustomElement,
16
+ assembleMethodSymbol,
17
+ registerCustomElement,
18
18
  } from "../../dom/customelement.mjs";
19
19
  import { isFunction, isObject, isArray } from "../../types/is.mjs";
20
20
  import { LocalePickerStyleSheet } from "./stylesheet/locale-picker.mjs";
@@ -43,63 +43,63 @@ const detectedLanguagesSymbol = Symbol("detectedLanguages");
43
43
  * @return {string}
44
44
  */
45
45
  function getLocalizedLabel() {
46
- const lang = document.documentElement.lang || navigator.language || "en";
47
- switch (lang.split("-")[0]) {
48
- case "de":
49
- return "Sprache wählen";
50
- case "fr":
51
- return "Sélectionnez une langue";
52
- case "es":
53
- return "Seleccione un idioma";
54
- case "it":
55
- return "Seleziona una lingua";
56
- case "pt":
57
- return "Selecione um idioma";
58
- case "nl":
59
- return "Selecteer een taal";
60
- case "pl":
61
- return "Wybierz język";
62
- case "ru":
63
- return "Выберите язык";
64
- case "cs":
65
- return "Vyberte jazyk";
66
- case "sk":
67
- return "Vyberte jazyk";
68
- case "bg":
69
- return "Изберете език";
70
- case "hr":
71
- return "Odaberite jezik";
72
- case "fi":
73
- return "Valitse kieli";
74
- case "sv":
75
- return "Välj ett språk";
76
- case "el":
77
- return "Επιλέξτε γλώσσα";
78
- case "hu":
79
- return "Válasszon egy nyelvet";
80
- case "ro":
81
- return "Selectați o limbă";
82
- case "da":
83
- return "Vælg et sprog";
84
- case "no":
85
- return "Velg et språk";
86
- case "hi":
87
- return "एक भाषा चुनें";
88
- case "bn":
89
- return "একটি ভাষা নির্বাচন করুন";
90
- case "ta":
91
- return "ஒரு மொழியைத் தேர்ந்தெடுக்கவும்";
92
- case "te":
93
- return "భాషను ఎంచుకోండి";
94
- case "mr":
95
- return "एक भाषा निवडा";
96
- case "zh":
97
- return "选择一种语言";
98
- case "ja":
99
- return "言語を選択してください";
100
- default:
101
- return "Select a language";
102
- }
46
+ const lang = document.documentElement.lang || navigator.language || "en";
47
+ switch (lang.split("-")[0]) {
48
+ case "de":
49
+ return "Sprache wählen";
50
+ case "fr":
51
+ return "Sélectionnez une langue";
52
+ case "es":
53
+ return "Seleccione un idioma";
54
+ case "it":
55
+ return "Seleziona una lingua";
56
+ case "pt":
57
+ return "Selecione um idioma";
58
+ case "nl":
59
+ return "Selecteer een taal";
60
+ case "pl":
61
+ return "Wybierz język";
62
+ case "ru":
63
+ return "Выберите язык";
64
+ case "cs":
65
+ return "Vyberte jazyk";
66
+ case "sk":
67
+ return "Vyberte jazyk";
68
+ case "bg":
69
+ return "Изберете език";
70
+ case "hr":
71
+ return "Odaberite jezik";
72
+ case "fi":
73
+ return "Valitse kieli";
74
+ case "sv":
75
+ return "Välj ett språk";
76
+ case "el":
77
+ return "Επιλέξτε γλώσσα";
78
+ case "hu":
79
+ return "Válasszon egy nyelvet";
80
+ case "ro":
81
+ return "Selectați o limbă";
82
+ case "da":
83
+ return "Vælg et sprog";
84
+ case "no":
85
+ return "Velg et språk";
86
+ case "hi":
87
+ return "एक भाषा चुनें";
88
+ case "bn":
89
+ return "একটি ভাষা নির্বাচন করুন";
90
+ case "ta":
91
+ return "ஒரு மொழியைத் தேர்ந்தெடுக்கவும்";
92
+ case "te":
93
+ return "భాషను ఎంచుకోండి";
94
+ case "mr":
95
+ return "एक भाषा निवडा";
96
+ case "zh":
97
+ return "选择一种语言";
98
+ case "ja":
99
+ return "言語を選択してください";
100
+ default:
101
+ return "Select a language";
102
+ }
103
103
  }
104
104
 
105
105
  /**
@@ -112,109 +112,109 @@ function getLocalizedLabel() {
112
112
  * @summary A simple language switcher as a select.
113
113
  */
114
114
  class LocaleSelect extends CustomElement {
115
- /**
116
- * Used by the instanceof operator.
117
- * @returns {symbol}
118
- */
119
- static get [instanceSymbol]() {
120
- return Symbol.for(
121
- "@schukai/monster/components/accessibility/local-selector@@instance",
122
- );
123
- }
115
+ /**
116
+ * Used by the instanceof operator.
117
+ * @returns {symbol}
118
+ */
119
+ static get [instanceSymbol]() {
120
+ return Symbol.for(
121
+ "@schukai/monster/components/accessibility/local-selector@@instance",
122
+ );
123
+ }
124
124
 
125
- /**
126
- * Initializes the component.
127
- * @return {LocaleSelect}
128
- */
129
- [assembleMethodSymbol]() {
130
- super[assembleMethodSymbol]();
131
- initControlReferences.call(this);
132
- initSelectOptions.call(this);
133
- initEventHandler.call(this);
134
- return this;
135
- }
125
+ /**
126
+ * Initializes the component.
127
+ * @return {LocaleSelect}
128
+ */
129
+ [assembleMethodSymbol]() {
130
+ super[assembleMethodSymbol]();
131
+ initControlReferences.call(this);
132
+ initSelectOptions.call(this);
133
+ initEventHandler.call(this);
134
+ return this;
135
+ }
136
136
 
137
- /**
138
- * Default options
139
- *
140
- * @properties {Object} templates - Templates for the component.
141
- * @properties {string} templates.main - Main template.
142
- * @properties {Object} features - Feature toggles.
143
- * @properties {boolean} features.resetCookie - Whether to show a reset cookie button.
144
- * @properties {Object} cookie - Cookie settings.
145
- * @properties {string} cookie.name - Name of the cookie to store the selected language.
146
- * @properties {Object} labels - Localized labels.
147
- * @properties {string} labels["select-an-option"] - Label for the select option.
148
- * @properties {Object} callbacks - Callback functions.
149
- * @properties {boolean} disabled - Whether the component is disabled.
150
- */
151
- get defaults() {
152
- return Object.assign({}, super.defaults, {
153
- templates: {
154
- main: getTemplate(),
155
- },
156
- features: {
157
- resetCookie: true,
158
- },
159
- cookie: {
160
- name: "language",
161
- },
162
- labels: {
163
- "select-an-option": getLocalizedLabel(),
164
- },
165
- callbacks: {},
166
- disabled: false,
167
- });
168
- }
137
+ /**
138
+ * Default options
139
+ *
140
+ * @properties {Object} templates - Templates for the component.
141
+ * @properties {string} templates.main - Main template.
142
+ * @properties {Object} features - Feature toggles.
143
+ * @properties {boolean} features.resetCookie - Whether to show a reset cookie button.
144
+ * @properties {Object} cookie - Cookie settings.
145
+ * @properties {string} cookie.name - Name of the cookie to store the selected language.
146
+ * @properties {Object} labels - Localized labels.
147
+ * @properties {string} labels["select-an-option"] - Label for the select option.
148
+ * @properties {Object} callbacks - Callback functions.
149
+ * @properties {boolean} disabled - Whether the component is disabled.
150
+ */
151
+ get defaults() {
152
+ return Object.assign({}, super.defaults, {
153
+ templates: {
154
+ main: getTemplate(),
155
+ },
156
+ features: {
157
+ resetCookie: true,
158
+ },
159
+ cookie: {
160
+ name: "language",
161
+ },
162
+ labels: {
163
+ "select-an-option": getLocalizedLabel(),
164
+ },
165
+ callbacks: {},
166
+ disabled: false,
167
+ });
168
+ }
169
169
 
170
- /**
171
- * connectedCallback
172
- */
173
- connectedCallback() {
174
- super.connectedCallback();
175
- this[detectedLanguagesSymbol] = detectUserLanguagePreference();
176
- initSelectOptions.call(this);
177
- }
170
+ /**
171
+ * connectedCallback
172
+ */
173
+ connectedCallback() {
174
+ super.connectedCallback();
175
+ this[detectedLanguagesSymbol] = detectUserLanguagePreference();
176
+ initSelectOptions.call(this);
177
+ }
178
178
 
179
- /**
180
- * @return {string}
181
- */
182
- static getTag() {
183
- return "monster-locale-select";
184
- }
179
+ /**
180
+ * @return {string}
181
+ */
182
+ static getTag() {
183
+ return "monster-locale-select";
184
+ }
185
185
 
186
- /**
187
- * @return {CSSStyleSheet[]}
188
- */
189
- static getCSSStyleSheet() {
190
- return [LocalePickerStyleSheet];
191
- }
186
+ /**
187
+ * @return {CSSStyleSheet[]}
188
+ */
189
+ static getCSSStyleSheet() {
190
+ return [LocalePickerStyleSheet];
191
+ }
192
192
 
193
- /**
194
- * Export parts from monster-select to make them available for styling outside.
195
- */
196
- static get exportparts() {
197
- // The parts from monster-select, as defined in source/components/form/select.mjs:
198
- return [
199
- "control",
200
- "container",
201
- "popper",
202
- "option",
203
- "option-label",
204
- "option-control",
205
- "badge",
206
- "badge-label",
207
- "remove-badge",
208
- "summary",
209
- "status-or-remove-badges",
210
- "remote-info",
211
- "no-options",
212
- "selection",
213
- "inline-filter",
214
- "popper-filter",
215
- "content",
216
- ].join(",");
217
- }
193
+ /**
194
+ * Export parts from monster-select to make them available for styling outside.
195
+ */
196
+ static get exportparts() {
197
+ // The parts from monster-select, as defined in source/components/form/select.mjs:
198
+ return [
199
+ "control",
200
+ "container",
201
+ "popper",
202
+ "option",
203
+ "option-label",
204
+ "option-control",
205
+ "badge",
206
+ "badge-label",
207
+ "remove-badge",
208
+ "summary",
209
+ "status-or-remove-badges",
210
+ "remote-info",
211
+ "no-options",
212
+ "selection",
213
+ "inline-filter",
214
+ "popper-filter",
215
+ "content",
216
+ ].join(",");
217
+ }
218
218
  }
219
219
 
220
220
  /**
@@ -222,9 +222,9 @@ class LocaleSelect extends CustomElement {
222
222
  * @private
223
223
  */
224
224
  function initControlReferences() {
225
- this[selectElementSymbol] = this.shadowRoot.querySelector(
226
- `[${ATTRIBUTE_ROLE}="select"]`,
227
- );
225
+ this[selectElementSymbol] = this.shadowRoot.querySelector(
226
+ `[${ATTRIBUTE_ROLE}="select"]`,
227
+ );
228
228
  }
229
229
 
230
230
  /**
@@ -232,36 +232,36 @@ function initControlReferences() {
232
232
  * @private
233
233
  */
234
234
  function initSelectOptions() {
235
- const detected =
236
- this[detectedLanguagesSymbol] || detectUserLanguagePreference();
235
+ const detected =
236
+ this[detectedLanguagesSymbol] || detectUserLanguagePreference();
237
237
 
238
- let options = [];
239
- if (Array.isArray(detected.available)) {
240
- const currentLang = detected.current;
241
- options = detected.available.filter(
242
- (lang) => lang.baseLang !== currentLang && lang.fullLang !== currentLang,
243
- );
244
- } else if (Array.isArray(detected.allOfferable)) {
245
- options = detected.allOfferable;
246
- }
238
+ let options = [];
239
+ if (Array.isArray(detected.available)) {
240
+ const currentLang = detected.current;
241
+ options = detected.available.filter(
242
+ (lang) => lang.baseLang !== currentLang && lang.fullLang !== currentLang,
243
+ );
244
+ } else if (Array.isArray(detected.allOfferable)) {
245
+ options = detected.allOfferable;
246
+ }
247
247
 
248
- options = detected.allOfferable;
248
+ options = detected.allOfferable;
249
249
 
250
- if (Array.isArray(options)) {
251
- options = options.filter(
252
- (lang) => lang.baseLang !== "x-default" && lang.fullLang !== "x-default",
253
- );
254
- }
250
+ if (Array.isArray(options)) {
251
+ options = options.filter(
252
+ (lang) => lang.baseLang !== "x-default" && lang.fullLang !== "x-default",
253
+ );
254
+ }
255
255
 
256
- if (this[selectElementSymbol] && isArray(options)) {
257
- this[selectElementSymbol].setOption("mapping.labelTemplate", "${label}");
258
- this[selectElementSymbol].setOption("mapping.valueTemplate", "${href}");
259
- this[selectElementSymbol].setOption(
260
- "labels.select-an-option",
261
- this.getOption("labels.select-an-option"),
262
- );
263
- this[selectElementSymbol].importOptions(options);
264
- }
256
+ if (this[selectElementSymbol] && isArray(options)) {
257
+ this[selectElementSymbol].setOption("mapping.labelTemplate", "${label}");
258
+ this[selectElementSymbol].setOption("mapping.valueTemplate", "${href}");
259
+ this[selectElementSymbol].setOption(
260
+ "labels.select-an-option",
261
+ this.getOption("labels.select-an-option"),
262
+ );
263
+ this[selectElementSymbol].importOptions(options);
264
+ }
265
265
  }
266
266
 
267
267
  /**
@@ -269,21 +269,21 @@ function initSelectOptions() {
269
269
  * @private
270
270
  */
271
271
  function initEventHandler() {
272
- if (!this[selectElementSymbol]) return;
272
+ if (!this[selectElementSymbol]) return;
273
273
 
274
- this[selectElementSymbol].addEventListener("change", (event) => {
275
- const selected = event.target?.value;
276
- if (selected) {
277
- if (
278
- this.getOption("features.resetCookie") &&
279
- this.getOption("cookie.name")
280
- ) {
281
- document.cookie = `${this.getOption("cookie.name")}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
282
- }
274
+ this[selectElementSymbol].addEventListener("change", (event) => {
275
+ const selected = event.target?.value;
276
+ if (selected) {
277
+ if (
278
+ this.getOption("features.resetCookie") &&
279
+ this.getOption("cookie.name")
280
+ ) {
281
+ document.cookie = `${this.getOption("cookie.name")}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
282
+ }
283
283
 
284
- window.location.href = selected;
285
- }
286
- });
284
+ window.location.href = selected;
285
+ }
286
+ });
287
287
  }
288
288
 
289
289
  /**
@@ -292,8 +292,8 @@ function initEventHandler() {
292
292
  * @return {string}
293
293
  */
294
294
  function getTemplate() {
295
- // language=HTML
296
- return `
295
+ // language=HTML
296
+ return `
297
297
  <monster-select exportparts="control,container,popper,option,option-label,option-control,badge,badge-label,remove-badge,summary,status-or-remove-badges,remote-info,no-options,selection,inline-filter,popper-filter,content" data-monster-role="select"></monster-select>
298
298
  `;
299
299
  }