@schukai/monster 4.23.2 → 4.23.4

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,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.23.4] - 2025-06-24
6
+
7
+ ### Bug Fixes
8
+
9
+ - Prevent default behavior on tab change and close events
10
+
11
+
12
+
13
+ ## [4.23.3] - 2025-06-22
14
+
15
+ ### Bug Fixes
16
+
17
+ - Update import paths and clean up save-button functionality
18
+
19
+
20
+
5
21
  ## [4.23.2] - 2025-06-22
6
22
 
7
23
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@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.23.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@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.23.4"}
@@ -12,7 +12,7 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import { instanceSymbol, internalSymbol } from "../../constants.mjs";
15
+ import { instanceSymbol } from "../../constants.mjs";
16
16
  import { diff } from "../../data/diff.mjs";
17
17
  import { addAttributeToken } from "../../dom/attributes.mjs";
18
18
  import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
@@ -287,72 +287,6 @@ class SaveButton extends CustomElement {
287
287
  );
288
288
  }
289
289
 
290
- /**
291
- * Sets the state of the button which affects its visual appearance
292
- *
293
- * @param {string} state - The state to set (e.g. 'success', 'error', 'loading')
294
- * @param {number} timeout - Optional timeout in milliseconds after which state is removed
295
- * @return {SaveButton} Returns the button instance for chaining
296
- * @throws {TypeError} When state is not a string or timeout is not a number
297
- */
298
- setState(state, timeout) {
299
- return this[stateButtonElementSymbol].setState(state, timeout);
300
- }
301
-
302
- /**
303
- *
304
- * @return {SaveButton}
305
- */
306
- removeState() {
307
- return this[stateButtonElementSymbol].removeState();
308
- }
309
-
310
- /**
311
- * @return {string}
312
- */
313
- getState() {
314
- return this[stateButtonElementSymbol].getState();
315
- }
316
-
317
- /**
318
- * Sets the message content to be displayed in the popup overlay
319
- *
320
- * @param {string|HTMLElement} message - The message content as string or HTML element
321
- * @param {string} title - Optional title to show above the message
322
- * @param {string} icon - Optional icon HTML to display next to the title
323
- * @return {SaveButton} Returns the button instance for chaining
324
- * @throws {TypeError} When message is empty or invalid type
325
- */
326
- setMessage(message, title, icon) {
327
- return this[stateButtonElementSymbol].setMessage(message, title, icon);
328
- }
329
-
330
- /**
331
- * Clears the message content displayed in the popup overlay.
332
- * @returns {*|SaveButton}
333
- */
334
- clearMessage() {
335
- return this[stateButtonElementSymbol].clearMessage();
336
- }
337
-
338
- /**
339
- * Displays a message on the button element for a specified duration.
340
- *
341
- * @param {number} timeout - The time, in milliseconds, for which the message should be displayed.
342
- * @return {Promise<void>} A promise that resolves when the message display action is completed.
343
- */
344
- showMessage(timeout) {
345
- return this[stateButtonElementSymbol].showMessage(timeout);
346
- }
347
-
348
- /**
349
- * Hides the message displayed on the button element.
350
- * @returns {*|MessageStateButton}
351
- */
352
- hideMessage() {
353
- return this[stateButtonElementSymbol].hideMessage();
354
- }
355
-
356
290
  /**
357
291
  *
358
292
  * @return [CSSStyleSheet]
@@ -500,7 +434,7 @@ function getTemplate() {
500
434
  return `
501
435
  <div data-monster-role="control" part="control"
502
436
  data-monster-attributes="disabled path:disabled | if:true">
503
- <monster-message-state-button data-monster-role="state-button">save</monster-message-state-button>
437
+ <monster-state-button data-monster-role="state-button"></monster-state-button>
504
438
  <div data-monster-attributes="disabled path:disabled | if:true, class path:classes.badge"
505
439
  data-monster-role="badge"
506
440
  data-monster-replace="path:changes"></div>
@@ -309,7 +309,7 @@ class MessageStateButton extends Popper {
309
309
 
310
310
  /**
311
311
  * Programmatically triggers a click event on the button
312
- * Will not trigger if button is disabled
312
+ * Will not trigger if the button is disabled
313
313
  *
314
314
  * @since 3.27.0
315
315
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
@@ -361,6 +361,10 @@ class MessageStateButton extends Popper {
361
361
  }
362
362
  }
363
363
 
364
+ /**
365
+ * @private
366
+ * @param mode
367
+ */
364
368
  function initEventHandlerByMode(mode) {
365
369
  switch (mode) {
366
370
  case "manual":
@@ -802,6 +802,7 @@ function initEventHandler() {
802
802
  * @param {Event} event
803
803
  */
804
804
  this[changeTabEventHandler] = (event) => {
805
+ event.preventDefault();
805
806
  const element = findTargetElementFromEvent(event, ATTRIBUTE_ROLE, "button");
806
807
 
807
808
  if (element instanceof HTMLButtonElement && element.disabled !== true) {
@@ -813,6 +814,7 @@ function initEventHandler() {
813
814
  * @param {Event} event
814
815
  */
815
816
  this[closeEventHandler] = (event) => {
817
+ event.preventDefault();
816
818
  const path = event.composedPath();
817
819
 
818
820
  for (const [, element] of Object.entries(path)) {