@schukai/monster 4.44.3 → 4.45.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.45.0] - 2025-11-02
6
+
7
+
8
+
5
9
  ## [4.44.3] - 2025-11-02
6
10
 
7
11
  ### 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.44.3"}
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.0"}
@@ -136,12 +136,29 @@ class LocaleSelect extends CustomElement {
136
136
 
137
137
  /**
138
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.
139
150
  */
140
151
  get defaults() {
141
152
  return Object.assign({}, super.defaults, {
142
153
  templates: {
143
154
  main: getTemplate(),
144
155
  },
156
+ features: {
157
+ resetCookie: true,
158
+ },
159
+ cookie: {
160
+ name: "language",
161
+ },
145
162
  labels: {
146
163
  "select-an-option": getLocalizedLabel(),
147
164
  },
@@ -257,6 +274,13 @@ function initEventHandler() {
257
274
  this[selectElementSymbol].addEventListener("change", (event) => {
258
275
  const selected = event.target?.value;
259
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
+
260
284
  window.location.href = selected;
261
285
  }
262
286
  });