@schukai/monster 4.79.1 → 4.80.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,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.80.0] - 2026-01-07
6
+
7
+ ### Add Features
8
+
9
+ - Enhance DataTable datasource element handling
10
+
11
+
12
+
5
13
  ## [4.79.1] - 2026-01-07
6
14
 
7
15
  ### Bug Fixes
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.79.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.80.0"}
@@ -67,7 +67,11 @@ import {
67
67
  } from "./util.mjs";
68
68
  import "./columnbar.mjs";
69
69
  import "./filter-button.mjs";
70
- import { findElementWithSelectorUpwards, getWindow } from "../../dom/util.mjs";
70
+ import {
71
+ findElementWithSelectorUpwards,
72
+ getWindow,
73
+ waitForCustomElement,
74
+ } from "../../dom/util.mjs";
71
75
 
72
76
  import { getDocumentTranslations } from "../../i18n/translations.mjs";
73
77
  import "../state/state.mjs";
@@ -410,23 +414,31 @@ class DataTable extends CustomElement {
410
414
  if (isString(selector)) {
411
415
  const element = findElementWithSelectorUpwards(this, selector);
412
416
  if (element === null) {
413
- throw new Error("the selector must match exactly one element");
414
- }
415
-
416
- if (!isInstance(element, Datasource)) {
417
- throw new TypeError("the element must be a datasource");
417
+ addErrorAttribute(
418
+ this,
419
+ "the selector must match exactly one element",
420
+ );
421
+ return;
418
422
  }
419
423
 
420
- this[datasourceLinkedElementSymbol] = element;
421
-
422
- queueMicrotask(() => {
423
- handleDataSourceChanges.call(this, true);
424
- if (element && "datasource" in element) {
425
- element.datasource.attachObserver(
426
- new Observer(handleDataSourceChanges.bind(this)),
427
- );
428
- }
429
- });
424
+ waitForCustomElement(element, {
425
+ readyCheck: (el) => isInstance(el, Datasource),
426
+ })
427
+ .then((readyElement) => {
428
+ this[datasourceLinkedElementSymbol] = readyElement;
429
+
430
+ queueMicrotask(() => {
431
+ handleDataSourceChanges.call(this, true);
432
+ if (readyElement && "datasource" in readyElement) {
433
+ readyElement.datasource.attachObserver(
434
+ new Observer(handleDataSourceChanges.bind(this)),
435
+ );
436
+ }
437
+ });
438
+ })
439
+ .catch((error) => {
440
+ addErrorAttribute(this, error);
441
+ });
430
442
  }
431
443
  });
432
444