@schukai/monster 4.86.0 → 4.88.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,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.88.0] - 2026-01-11
6
+
7
+ ### Add Features
8
+
9
+ - Enhance save-button functionality to support multiple document scopes [#371](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/371)
10
+
11
+
12
+
13
+ ## [4.87.0] - 2026-01-11
14
+
15
+ ### Add Features
16
+
17
+ - Add functionality for change events in text fields for issue [#371](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/371)
18
+
19
+
20
+
5
21
  ## [4.86.0] - 2026-01-10
6
22
 
7
23
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","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.86.0"}
1
+ {"author":"Volker Schukai","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.88.0"}
@@ -14,14 +14,24 @@
14
14
 
15
15
  import { instanceSymbol } from "../../constants.mjs";
16
16
  import { diff } from "../../data/diff.mjs";
17
- import { addAttributeToken } from "../../dom/attributes.mjs";
18
- import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
17
+ import {
18
+ addAttributeToken,
19
+ getLinkedObjects,
20
+ hasObjectLink,
21
+ } from "../../dom/attributes.mjs";
22
+ import {
23
+ ATTRIBUTE_ERRORMESSAGE,
24
+ customElementUpdaterLinkSymbol,
25
+ } from "../../dom/constants.mjs";
19
26
  import {
20
27
  assembleMethodSymbol,
21
28
  CustomElement,
22
29
  registerCustomElement,
23
30
  } from "../../dom/customelement.mjs";
24
- import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
31
+ import {
32
+ findElementWithSelectorUpwards,
33
+ getDocument,
34
+ } from "../../dom/util.mjs";
25
35
  import { isString, isArray } from "../../types/is.mjs";
26
36
  import { Observer } from "../../types/observer.mjs";
27
37
  import { TokenList } from "../../types/tokenlist.mjs";
@@ -346,8 +356,8 @@ function initEventHandler() {
346
356
  this[saveInFlightSymbol] = true;
347
357
  this[stateButtonElementSymbol].setOption("disabled", true);
348
358
 
349
- this[datasourceLinkedElementSymbol]
350
- .write()
359
+ flushLinkedForms.call(this)
360
+ .then(() => this[datasourceLinkedElementSymbol].write())
351
361
  .then(() => {
352
362
  this[originValuesSymbol] = null;
353
363
  this[originValuesSymbol] = clone(
@@ -378,6 +388,65 @@ function initEventHandler() {
378
388
  });
379
389
  }
380
390
 
391
+ /**
392
+ * @private
393
+ * @return {Promise<void>}
394
+ */
395
+ function flushLinkedForms() {
396
+ const datasource = this[datasourceLinkedElementSymbol];
397
+ if (!datasource) {
398
+ return Promise.resolve();
399
+ }
400
+
401
+ const roots = new Set();
402
+ const root = this.getRootNode?.();
403
+ if (root && typeof root.querySelectorAll === "function") {
404
+ roots.add(root);
405
+ }
406
+ const doc = getDocument();
407
+ if (doc && (!root || root !== doc)) {
408
+ roots.add(doc);
409
+ }
410
+
411
+ const forms = new Set();
412
+ for (const scope of roots) {
413
+ const nodes = scope.querySelectorAll?.("monster-form") || [];
414
+ for (const node of nodes) {
415
+ forms.add(node);
416
+ }
417
+ }
418
+
419
+ const writes = [];
420
+
421
+ for (const form of forms) {
422
+ if (!(form instanceof HTMLElement)) {
423
+ continue;
424
+ }
425
+ if (form[datasourceLinkedElementSymbol] !== datasource) {
426
+ continue;
427
+ }
428
+
429
+ if (hasObjectLink(form, customElementUpdaterLinkSymbol)) {
430
+ const updaters = getLinkedObjects(form, customElementUpdaterLinkSymbol);
431
+ for (const list of updaters) {
432
+ for (const updater of list) {
433
+ updater.retrieve();
434
+ }
435
+ }
436
+ }
437
+
438
+ if (typeof form.write === "function") {
439
+ writes.push(form.write());
440
+ }
441
+ }
442
+
443
+ if (writes.length === 0) {
444
+ return Promise.resolve();
445
+ }
446
+
447
+ return Promise.all(writes).then(() => {});
448
+ }
449
+
381
450
  /**
382
451
  * @private
383
452
  */