@agnos-ui/core 0.7.0 → 0.8.0-next.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.
Files changed (88) hide show
  1. package/{accordion-Lp-LEbZ2.cjs → accordion-DTQj-TQ1.cjs} +16 -18
  2. package/{accordion-BGv150k9.js → accordion-hVi2XRk-.js} +12 -14
  3. package/{alert-DJ2l7bcA.js → alert-BSixS_cz.js} +1 -1
  4. package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
  5. package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
  6. package/{common-Banw3FYN.js → common-CuZAeECD.js} +2 -3
  7. package/components/accordion/accordion.d.ts +1 -1
  8. package/components/accordion/index.cjs +1 -1
  9. package/components/accordion/index.js +1 -1
  10. package/components/alert/common.d.ts +1 -1
  11. package/components/alert/index.cjs +1 -1
  12. package/components/alert/index.js +1 -1
  13. package/components/modal/index.cjs +1 -1
  14. package/components/modal/index.js +1 -1
  15. package/components/modal/modal.d.ts +2 -2
  16. package/components/pagination/index.cjs +1 -1
  17. package/components/pagination/index.js +1 -1
  18. package/components/progressbar/index.cjs +1 -1
  19. package/components/progressbar/index.js +1 -1
  20. package/components/rating/index.cjs +1 -1
  21. package/components/rating/index.js +1 -1
  22. package/components/select/index.cjs +1 -1
  23. package/components/select/index.js +1 -1
  24. package/components/slider/index.cjs +1 -1
  25. package/components/slider/index.js +1 -1
  26. package/components/slider/slider.d.ts +84 -9
  27. package/components/toast/index.cjs +1 -1
  28. package/components/toast/index.js +1 -1
  29. package/components/tree/index.cjs +1 -1
  30. package/components/tree/index.js +1 -1
  31. package/config.cjs +3 -3
  32. package/config.js +1 -1
  33. package/{directive-CKEccryv.js → dom-BB9jLllr.js} +115 -102
  34. package/{directive-DdlwGFtf.cjs → dom-CuBx1JPZ.cjs} +116 -103
  35. package/index.cjs +14 -11
  36. package/index.js +15 -12
  37. package/{modal-DDHcrykD.cjs → modal-B7bYoubx.cjs} +12 -14
  38. package/{modal-DP-4I7vf.js → modal-BQcw6bnM.js} +6 -8
  39. package/package.json +4 -1
  40. package/{pagination-CBysiPUs.cjs → pagination-5YARuB3V.cjs} +8 -8
  41. package/{pagination-DwDRot6q.js → pagination-BwaZEokc.js} +8 -8
  42. package/{progressbar-DghzCJ6_.cjs → progressbar-BpSrg4HG.cjs} +2 -2
  43. package/{progressbar-CGmNq0cS.js → progressbar-b_kXzGPc.js} +3 -3
  44. package/{promise-CY2U8bTP.js → promise-CBh_HbSK.js} +1 -1
  45. package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
  46. package/{rating-Da38uaZz.js → rating-B1JLZgIR.js} +8 -8
  47. package/{rating-DlfOuwuX.cjs → rating-C8tn9xTO.cjs} +9 -9
  48. package/{select-CAEPqdz1.js → select-Bb2RAVs0.js} +20 -20
  49. package/{select-LBVhNdrd.cjs → select-D1pBz4CM.cjs} +21 -21
  50. package/services/floatingUI.cjs +2 -2
  51. package/services/floatingUI.js +2 -2
  52. package/services/focustrack.cjs +1 -1
  53. package/services/focustrack.js +1 -1
  54. package/services/intersection.cjs +2 -2
  55. package/services/intersection.js +1 -1
  56. package/services/matchMedia.cjs +3 -2
  57. package/services/matchMedia.js +3 -2
  58. package/services/navManager.cjs +1 -1
  59. package/services/navManager.js +1 -1
  60. package/services/portal.cjs +1 -1
  61. package/services/portal.js +1 -1
  62. package/services/resizeObserver.cjs +3 -3
  63. package/services/resizeObserver.js +2 -2
  64. package/services/siblingsInert.cjs +4 -4
  65. package/services/siblingsInert.js +2 -2
  66. package/services/transitions/baseTransitions.cjs +7 -7
  67. package/services/transitions/baseTransitions.js +3 -3
  68. package/services/transitions/collapse.cjs +1 -1
  69. package/services/transitions/collapse.js +1 -1
  70. package/services/transitions/cssTransitions.cjs +4 -4
  71. package/services/transitions/cssTransitions.js +3 -3
  72. package/services/transitions/simpleClassTransition.cjs +1 -1
  73. package/services/transitions/simpleClassTransition.js +1 -1
  74. package/{slider-1OSwok7u.cjs → slider-B2JFXDLt.cjs} +125 -24
  75. package/{slider-6LI4-f5s.js → slider-C-BSdQ0b.js} +126 -25
  76. package/{toast-CpvsibAI.js → toast-Bw2QSzBX.js} +9 -8
  77. package/{toast-D_uSrRZL.cjs → toast-CaIcB2sD.cjs} +8 -7
  78. package/{tree-Bb5KFqXp.cjs → tree-D4t2SOql.cjs} +7 -7
  79. package/{tree-B2Mr8b31.js → tree-DWv0zwFJ.js} +8 -8
  80. package/utils/directive.cjs +2 -3
  81. package/utils/directive.d.ts +7 -5
  82. package/utils/directive.js +2 -3
  83. package/{func-Qd3cD9a3.cjs → utils/func.cjs} +1 -0
  84. package/{func-DR0n-ShK.js → utils/func.js} +2 -2
  85. package/utils/stores.cjs +13 -3
  86. package/utils/stores.d.ts +9 -0
  87. package/utils/stores.js +12 -2
  88. /package/utils/{internal/func.d.ts → func.d.ts} +0 -0
@@ -1,100 +1,6 @@
1
- import { readable, writable, asReadable, batch } from "@amadeus-it-group/tansu";
2
1
  import { BROWSER } from "esm-env";
3
- import { n as noop } from "./func-DR0n-ShK.js";
4
- import { toReadableStore } from "./utils/stores.js";
5
- const computeCommonAncestor = (elements) => {
6
- const length = elements.length;
7
- if (length === 0) return null;
8
- let ancestor = elements[0];
9
- for (let i = 1; i < length && ancestor; i++) {
10
- const element = elements[i];
11
- while (ancestor) {
12
- if (ancestor === element) {
13
- break;
14
- }
15
- const comparison = ancestor.compareDocumentPosition(element);
16
- if (comparison & Node.DOCUMENT_POSITION_CONTAINED_BY) {
17
- break;
18
- } else if (comparison & Node.DOCUMENT_POSITION_CONTAINS) {
19
- ancestor = element;
20
- break;
21
- } else if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) {
22
- return null;
23
- }
24
- ancestor = ancestor.parentElement;
25
- }
26
- }
27
- return ancestor;
28
- };
29
- const reflow = BROWSER ? (element = document.body) => {
30
- if (isBrowserHTMLElement(element)) {
31
- element.getBoundingClientRect();
32
- }
33
- } : noop;
34
- const addClasses = (element, classes) => {
35
- if (classes && classes.length > 0) {
36
- element.classList.add(...classes);
37
- }
38
- };
39
- const removeClasses = (element, classes) => {
40
- if (classes && classes.length > 0) {
41
- element.classList.remove(...classes);
42
- }
43
- };
44
- function addEvent(element, type, fn, options) {
45
- element.addEventListener(type, fn, options);
46
- return function() {
47
- element.removeEventListener(type, fn, options);
48
- };
49
- }
50
- let idCount = 0;
51
- const generateId = () => `auId-${idCount++}`;
52
- const notEmpty = (value) => value != null && value !== false;
53
- function classNamesSubscribe(node, classNames$) {
54
- let currentClassNames = /* @__PURE__ */ new Set();
55
- return classNames$.subscribe((newClassName) => {
56
- const classNames = new Set(`${newClassName ?? ""}`.split(" "));
57
- classNames.delete("");
58
- const classList = node.classList;
59
- for (const className of currentClassNames) {
60
- if (!classNames.has(className)) {
61
- classList.remove(className);
62
- }
63
- }
64
- if (classNames.size > 0) {
65
- classList.add(...classNames);
66
- }
67
- currentClassNames = classNames;
68
- });
69
- }
70
- function attributeSubscribe(node, attributeName, value$) {
71
- return value$.subscribe((value) => {
72
- if (notEmpty(value)) {
73
- node.setAttribute(attributeName, "" + (value === true ? attributeName : value));
74
- } else {
75
- node.removeAttribute(attributeName);
76
- }
77
- });
78
- }
79
- function bindAttribute(node, attributeName, value$) {
80
- const isClass = attributeName === "class";
81
- return isClass ? classNamesSubscribe(node, value$) : attributeSubscribe(node, attributeName, value$);
82
- }
83
- function bindStyle(node, styleName, value$) {
84
- return value$.subscribe((value) => {
85
- const style = node.style;
86
- style[styleName] = "" + (notEmpty(value) ? value : "");
87
- });
88
- }
89
- function bindClassName(node, className, value$) {
90
- const unsubscribe = value$.subscribe((isPresent) => {
91
- node.classList.toggle(className, isPresent);
92
- });
93
- return () => {
94
- unsubscribe();
95
- node.classList.remove(className);
96
- };
97
- }
2
+ import { noop } from "./utils/func.js";
3
+ import { readable, writable, asReadable, batch, computed } from "@amadeus-it-group/tansu";
98
4
  const ssrHTMLElementAttributesAndStyle = Symbol("attributesAndStyle");
99
5
  const spaceRegExp = /\s+/;
100
6
  const ssrHTMLElement = () => {
@@ -138,6 +44,19 @@ const ssrHTMLElement = () => {
138
44
  }
139
45
  };
140
46
  };
47
+ function r(e) {
48
+ var t, f, n = "";
49
+ if ("string" == typeof e || "number" == typeof e) n += e;
50
+ else if ("object" == typeof e) if (Array.isArray(e)) {
51
+ var o = e.length;
52
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
53
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
54
+ return n;
55
+ }
56
+ function clsx() {
57
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
58
+ return n;
59
+ }
141
60
  const isBrowserHTMLElement = BROWSER ? (element) => {
142
61
  var _a;
143
62
  const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
@@ -152,8 +71,7 @@ const browserDirective = BROWSER ? (directive) => (node, args) => {
152
71
  }
153
72
  } : (
154
73
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
155
- (directive) => () => {
156
- }
74
+ (directive) => noop
157
75
  );
158
76
  const bindDirective = (directive, directiveArg$) => (element) => {
159
77
  let firstTime = true;
@@ -337,16 +255,16 @@ const createAttributesDirective = (propsFn) => (node, args) => {
337
255
  }
338
256
  for (const [attributeName, value] of Object.entries(attributes ?? {})) {
339
257
  if (value != null) {
340
- unsubscribers.push(bindAttribute(node, attributeName, toReadableStore(value)));
258
+ unsubscribers.push(bindAttribute(node, attributeName, value));
341
259
  }
342
260
  }
343
261
  for (const [styleName, value] of Object.entries(styles ?? {})) {
344
262
  if (value) {
345
- unsubscribers.push(bindStyle(node, styleName, toReadableStore(value)));
263
+ unsubscribers.push(bindStyle(node, styleName, value));
346
264
  }
347
265
  }
348
266
  for (const [className, value] of Object.entries(classNames ?? {})) {
349
- unsubscribers.push(bindClassName(node, className, toReadableStore(value)));
267
+ unsubscribers.push(bindClassName(node, className, value));
350
268
  }
351
269
  return {
352
270
  update: (args2) => args$.set(args2),
@@ -368,7 +286,9 @@ const attributesData = (...directives) => {
368
286
  });
369
287
  }
370
288
  };
371
- const classDirective = createAttributesDirective((className) => ({ attributes: { class: className } }));
289
+ const classDirective = createAttributesDirective((className$) => ({
290
+ attributes: { class: computed(() => clsx(className$())) }
291
+ }));
372
292
  function directiveAttributes(...directives) {
373
293
  const { attributes, classNames, style } = attributesData(...directives);
374
294
  if (classNames.length) {
@@ -381,6 +301,99 @@ function directiveAttributes(...directives) {
381
301
  return attributes;
382
302
  }
383
303
  const ssrAttributes = BROWSER ? () => ({}) : directiveAttributes;
304
+ const computeCommonAncestor = (elements) => {
305
+ const length = elements.length;
306
+ if (length === 0) return null;
307
+ let ancestor = elements[0];
308
+ for (let i = 1; i < length && ancestor; i++) {
309
+ const element = elements[i];
310
+ while (ancestor) {
311
+ if (ancestor === element) {
312
+ break;
313
+ }
314
+ const comparison = ancestor.compareDocumentPosition(element);
315
+ if (comparison & Node.DOCUMENT_POSITION_CONTAINED_BY) {
316
+ break;
317
+ } else if (comparison & Node.DOCUMENT_POSITION_CONTAINS) {
318
+ ancestor = element;
319
+ break;
320
+ } else if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) {
321
+ return null;
322
+ }
323
+ ancestor = ancestor.parentElement;
324
+ }
325
+ }
326
+ return ancestor;
327
+ };
328
+ const reflow = BROWSER ? (element = document.body) => {
329
+ if (isBrowserHTMLElement(element)) {
330
+ element.getBoundingClientRect();
331
+ }
332
+ } : noop;
333
+ const addClasses = (element, classes) => {
334
+ if (classes && classes.length > 0) {
335
+ element.classList.add(...classes);
336
+ }
337
+ };
338
+ const removeClasses = (element, classes) => {
339
+ if (classes && classes.length > 0) {
340
+ element.classList.remove(...classes);
341
+ }
342
+ };
343
+ function addEvent(element, type, fn, options) {
344
+ element.addEventListener(type, fn, options);
345
+ return function() {
346
+ element.removeEventListener(type, fn, options);
347
+ };
348
+ }
349
+ let idCount = 0;
350
+ const generateId = () => `auId-${idCount++}`;
351
+ const notEmpty = (value) => value != null && value !== false;
352
+ function classNamesSubscribe(node, classNames$) {
353
+ let currentClassNames = /* @__PURE__ */ new Set();
354
+ return classNames$.subscribe((newClassName) => {
355
+ const classNames = new Set(`${newClassName ?? ""}`.split(" "));
356
+ classNames.delete("");
357
+ const classList = node.classList;
358
+ for (const className of currentClassNames) {
359
+ if (!classNames.has(className)) {
360
+ classList.remove(className);
361
+ }
362
+ }
363
+ if (classNames.size > 0) {
364
+ classList.add(...classNames);
365
+ }
366
+ currentClassNames = classNames;
367
+ });
368
+ }
369
+ function attributeSubscribe(node, attributeName, value$) {
370
+ return value$.subscribe((value) => {
371
+ if (notEmpty(value)) {
372
+ node.setAttribute(attributeName, "" + (value === true ? attributeName : value));
373
+ } else {
374
+ node.removeAttribute(attributeName);
375
+ }
376
+ });
377
+ }
378
+ function bindAttribute(node, attributeName, value$) {
379
+ const isClass = attributeName === "class";
380
+ return isClass ? classNamesSubscribe(node, value$) : attributeSubscribe(node, attributeName, value$);
381
+ }
382
+ function bindStyle(node, styleName, value$) {
383
+ return value$.subscribe((value) => {
384
+ const style = node.style;
385
+ style[styleName] = "" + (notEmpty(value) ? value : "");
386
+ });
387
+ }
388
+ function bindClassName(node, className, value$) {
389
+ const unsubscribe = value$.subscribe((isPresent) => {
390
+ node.classList.toggle(className, isPresent);
391
+ });
392
+ return () => {
393
+ unsubscribe();
394
+ node.classList.remove(className);
395
+ };
396
+ }
384
397
  export {
385
398
  bindDirective as a,
386
399
  browserDirective as b,
@@ -1,101 +1,7 @@
1
1
  "use strict";
2
- const tansu = require("@amadeus-it-group/tansu");
3
2
  const esmEnv = require("esm-env");
4
- const func = require("./func-Qd3cD9a3.cjs");
5
- const utils_stores = require("./utils/stores.cjs");
6
- const computeCommonAncestor = (elements) => {
7
- const length = elements.length;
8
- if (length === 0) return null;
9
- let ancestor = elements[0];
10
- for (let i = 1; i < length && ancestor; i++) {
11
- const element = elements[i];
12
- while (ancestor) {
13
- if (ancestor === element) {
14
- break;
15
- }
16
- const comparison = ancestor.compareDocumentPosition(element);
17
- if (comparison & Node.DOCUMENT_POSITION_CONTAINED_BY) {
18
- break;
19
- } else if (comparison & Node.DOCUMENT_POSITION_CONTAINS) {
20
- ancestor = element;
21
- break;
22
- } else if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) {
23
- return null;
24
- }
25
- ancestor = ancestor.parentElement;
26
- }
27
- }
28
- return ancestor;
29
- };
30
- const reflow = esmEnv.BROWSER ? (element = document.body) => {
31
- if (isBrowserHTMLElement(element)) {
32
- element.getBoundingClientRect();
33
- }
34
- } : func.noop;
35
- const addClasses = (element, classes) => {
36
- if (classes && classes.length > 0) {
37
- element.classList.add(...classes);
38
- }
39
- };
40
- const removeClasses = (element, classes) => {
41
- if (classes && classes.length > 0) {
42
- element.classList.remove(...classes);
43
- }
44
- };
45
- function addEvent(element, type, fn, options) {
46
- element.addEventListener(type, fn, options);
47
- return function() {
48
- element.removeEventListener(type, fn, options);
49
- };
50
- }
51
- let idCount = 0;
52
- const generateId = () => `auId-${idCount++}`;
53
- const notEmpty = (value) => value != null && value !== false;
54
- function classNamesSubscribe(node, classNames$) {
55
- let currentClassNames = /* @__PURE__ */ new Set();
56
- return classNames$.subscribe((newClassName) => {
57
- const classNames = new Set(`${newClassName ?? ""}`.split(" "));
58
- classNames.delete("");
59
- const classList = node.classList;
60
- for (const className of currentClassNames) {
61
- if (!classNames.has(className)) {
62
- classList.remove(className);
63
- }
64
- }
65
- if (classNames.size > 0) {
66
- classList.add(...classNames);
67
- }
68
- currentClassNames = classNames;
69
- });
70
- }
71
- function attributeSubscribe(node, attributeName, value$) {
72
- return value$.subscribe((value) => {
73
- if (notEmpty(value)) {
74
- node.setAttribute(attributeName, "" + (value === true ? attributeName : value));
75
- } else {
76
- node.removeAttribute(attributeName);
77
- }
78
- });
79
- }
80
- function bindAttribute(node, attributeName, value$) {
81
- const isClass = attributeName === "class";
82
- return isClass ? classNamesSubscribe(node, value$) : attributeSubscribe(node, attributeName, value$);
83
- }
84
- function bindStyle(node, styleName, value$) {
85
- return value$.subscribe((value) => {
86
- const style = node.style;
87
- style[styleName] = "" + (notEmpty(value) ? value : "");
88
- });
89
- }
90
- function bindClassName(node, className, value$) {
91
- const unsubscribe = value$.subscribe((isPresent) => {
92
- node.classList.toggle(className, isPresent);
93
- });
94
- return () => {
95
- unsubscribe();
96
- node.classList.remove(className);
97
- };
98
- }
3
+ const utils_func = require("./utils/func.cjs");
4
+ const tansu = require("@amadeus-it-group/tansu");
99
5
  const ssrHTMLElementAttributesAndStyle = Symbol("attributesAndStyle");
100
6
  const spaceRegExp = /\s+/;
101
7
  const ssrHTMLElement = () => {
@@ -139,6 +45,19 @@ const ssrHTMLElement = () => {
139
45
  }
140
46
  };
141
47
  };
48
+ function r(e) {
49
+ var t, f, n = "";
50
+ if ("string" == typeof e || "number" == typeof e) n += e;
51
+ else if ("object" == typeof e) if (Array.isArray(e)) {
52
+ var o = e.length;
53
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
54
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
55
+ return n;
56
+ }
57
+ function clsx() {
58
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
59
+ return n;
60
+ }
142
61
  const isBrowserHTMLElement = esmEnv.BROWSER ? (element) => {
143
62
  var _a;
144
63
  const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
@@ -153,8 +72,7 @@ const browserDirective = esmEnv.BROWSER ? (directive) => (node, args) => {
153
72
  }
154
73
  } : (
155
74
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
- (directive) => () => {
157
- }
75
+ (directive) => utils_func.noop
158
76
  );
159
77
  const bindDirective = (directive, directiveArg$) => (element) => {
160
78
  let firstTime = true;
@@ -192,7 +110,7 @@ const mapDirectiveArg = (directive, fn) => (node, arg) => {
192
110
  };
193
111
  };
194
112
  const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
195
- const unsubscribe = store.subscribe(func.noop);
113
+ const unsubscribe = store.subscribe(utils_func.noop);
196
114
  return {
197
115
  destroy: async () => {
198
116
  if (asyncUnsubscribe) {
@@ -338,16 +256,16 @@ const createAttributesDirective = (propsFn) => (node, args) => {
338
256
  }
339
257
  for (const [attributeName, value] of Object.entries(attributes ?? {})) {
340
258
  if (value != null) {
341
- unsubscribers.push(bindAttribute(node, attributeName, utils_stores.toReadableStore(value)));
259
+ unsubscribers.push(bindAttribute(node, attributeName, value));
342
260
  }
343
261
  }
344
262
  for (const [styleName, value] of Object.entries(styles ?? {})) {
345
263
  if (value) {
346
- unsubscribers.push(bindStyle(node, styleName, utils_stores.toReadableStore(value)));
264
+ unsubscribers.push(bindStyle(node, styleName, value));
347
265
  }
348
266
  }
349
267
  for (const [className, value] of Object.entries(classNames ?? {})) {
350
- unsubscribers.push(bindClassName(node, className, utils_stores.toReadableStore(value)));
268
+ unsubscribers.push(bindClassName(node, className, value));
351
269
  }
352
270
  return {
353
271
  update: (args2) => args$.set(args2),
@@ -369,7 +287,9 @@ const attributesData = (...directives) => {
369
287
  });
370
288
  }
371
289
  };
372
- const classDirective = createAttributesDirective((className) => ({ attributes: { class: className } }));
290
+ const classDirective = createAttributesDirective((className$) => ({
291
+ attributes: { class: tansu.computed(() => clsx(className$())) }
292
+ }));
373
293
  function directiveAttributes(...directives) {
374
294
  const { attributes, classNames, style } = attributesData(...directives);
375
295
  if (classNames.length) {
@@ -382,6 +302,99 @@ function directiveAttributes(...directives) {
382
302
  return attributes;
383
303
  }
384
304
  const ssrAttributes = esmEnv.BROWSER ? () => ({}) : directiveAttributes;
305
+ const computeCommonAncestor = (elements) => {
306
+ const length = elements.length;
307
+ if (length === 0) return null;
308
+ let ancestor = elements[0];
309
+ for (let i = 1; i < length && ancestor; i++) {
310
+ const element = elements[i];
311
+ while (ancestor) {
312
+ if (ancestor === element) {
313
+ break;
314
+ }
315
+ const comparison = ancestor.compareDocumentPosition(element);
316
+ if (comparison & Node.DOCUMENT_POSITION_CONTAINED_BY) {
317
+ break;
318
+ } else if (comparison & Node.DOCUMENT_POSITION_CONTAINS) {
319
+ ancestor = element;
320
+ break;
321
+ } else if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) {
322
+ return null;
323
+ }
324
+ ancestor = ancestor.parentElement;
325
+ }
326
+ }
327
+ return ancestor;
328
+ };
329
+ const reflow = esmEnv.BROWSER ? (element = document.body) => {
330
+ if (isBrowserHTMLElement(element)) {
331
+ element.getBoundingClientRect();
332
+ }
333
+ } : utils_func.noop;
334
+ const addClasses = (element, classes) => {
335
+ if (classes && classes.length > 0) {
336
+ element.classList.add(...classes);
337
+ }
338
+ };
339
+ const removeClasses = (element, classes) => {
340
+ if (classes && classes.length > 0) {
341
+ element.classList.remove(...classes);
342
+ }
343
+ };
344
+ function addEvent(element, type, fn, options) {
345
+ element.addEventListener(type, fn, options);
346
+ return function() {
347
+ element.removeEventListener(type, fn, options);
348
+ };
349
+ }
350
+ let idCount = 0;
351
+ const generateId = () => `auId-${idCount++}`;
352
+ const notEmpty = (value) => value != null && value !== false;
353
+ function classNamesSubscribe(node, classNames$) {
354
+ let currentClassNames = /* @__PURE__ */ new Set();
355
+ return classNames$.subscribe((newClassName) => {
356
+ const classNames = new Set(`${newClassName ?? ""}`.split(" "));
357
+ classNames.delete("");
358
+ const classList = node.classList;
359
+ for (const className of currentClassNames) {
360
+ if (!classNames.has(className)) {
361
+ classList.remove(className);
362
+ }
363
+ }
364
+ if (classNames.size > 0) {
365
+ classList.add(...classNames);
366
+ }
367
+ currentClassNames = classNames;
368
+ });
369
+ }
370
+ function attributeSubscribe(node, attributeName, value$) {
371
+ return value$.subscribe((value) => {
372
+ if (notEmpty(value)) {
373
+ node.setAttribute(attributeName, "" + (value === true ? attributeName : value));
374
+ } else {
375
+ node.removeAttribute(attributeName);
376
+ }
377
+ });
378
+ }
379
+ function bindAttribute(node, attributeName, value$) {
380
+ const isClass = attributeName === "class";
381
+ return isClass ? classNamesSubscribe(node, value$) : attributeSubscribe(node, attributeName, value$);
382
+ }
383
+ function bindStyle(node, styleName, value$) {
384
+ return value$.subscribe((value) => {
385
+ const style = node.style;
386
+ style[styleName] = "" + (notEmpty(value) ? value : "");
387
+ });
388
+ }
389
+ function bindClassName(node, className, value$) {
390
+ const unsubscribe = value$.subscribe((isPresent) => {
391
+ node.classList.toggle(className, isPresent);
392
+ });
393
+ return () => {
394
+ unsubscribe();
395
+ node.classList.remove(className);
396
+ };
397
+ }
385
398
  exports.addClasses = addClasses;
386
399
  exports.addEvent = addEvent;
387
400
  exports.attributesData = attributesData;
package/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("./types.cjs");
4
- const accordion = require("./accordion-Lp-LEbZ2.cjs");
5
- const alert = require("./alert-Bq101evB.cjs");
6
- const modal = require("./modal-DDHcrykD.cjs");
7
- const pagination = require("./pagination-CBysiPUs.cjs");
8
- const progressbar = require("./progressbar-DghzCJ6_.cjs");
9
- const rating = require("./rating-DlfOuwuX.cjs");
10
- const select = require("./select-LBVhNdrd.cjs");
11
- const slider = require("./slider-1OSwok7u.cjs");
12
- const toast = require("./toast-D_uSrRZL.cjs");
13
- const tree = require("./tree-Bb5KFqXp.cjs");
4
+ const accordion = require("./accordion-DTQj-TQ1.cjs");
5
+ const alert = require("./alert-BrVkxOnA.cjs");
6
+ const modal = require("./modal-B7bYoubx.cjs");
7
+ const pagination = require("./pagination-5YARuB3V.cjs");
8
+ const progressbar = require("./progressbar-BpSrg4HG.cjs");
9
+ const rating = require("./rating-C8tn9xTO.cjs");
10
+ const select = require("./select-D1pBz4CM.cjs");
11
+ const slider = require("./slider-B2JFXDLt.cjs");
12
+ const toast = require("./toast-CaIcB2sD.cjs");
13
+ const tree = require("./tree-D4t2SOql.cjs");
14
14
  const config = require("./config.cjs");
15
15
  const services_extendWidget = require("./services/extendWidget.cjs");
16
16
  const services_floatingUI = require("./services/floatingUI.cjs");
@@ -25,7 +25,7 @@ const services_hash = require("./services/hash.cjs");
25
25
  const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
26
26
  const services_transitions_cssTransitions = require("./services/transitions/cssTransitions.cjs");
27
27
  const services_transitions_simpleClassTransition = require("./services/transitions/simpleClassTransition.cjs");
28
- const utils_directive = require("./directive-DdlwGFtf.cjs");
28
+ const utils_directive = require("./dom-CuBx1JPZ.cjs");
29
29
  const utils_stores = require("./utils/stores.cjs");
30
30
  const utils_writables = require("./writables-BPAJvaL_.cjs");
31
31
  exports.INVALID_VALUE = types.INVALID_VALUE;
@@ -96,13 +96,16 @@ exports.ssrAttributes = utils_directive.ssrAttributes;
96
96
  exports.bindableDerived = utils_stores.bindableDerived;
97
97
  exports.bindableProp = utils_stores.bindableProp;
98
98
  exports.createPatch = utils_stores.createPatch;
99
+ exports.false$ = utils_stores.false$;
99
100
  exports.findChangedProperties = utils_stores.findChangedProperties;
101
+ exports.idWithDefault = utils_stores.idWithDefault;
100
102
  exports.isStore = utils_stores.isStore;
101
103
  exports.mergeConfigStores = utils_stores.mergeConfigStores;
102
104
  exports.normalizeConfigStores = utils_stores.normalizeConfigStores;
103
105
  exports.stateStores = utils_stores.stateStores;
104
106
  exports.toReadableStore = utils_stores.toReadableStore;
105
107
  exports.toWritableStore = utils_stores.toWritableStore;
108
+ exports.true$ = utils_stores.true$;
106
109
  exports.writableWithDefault = utils_stores.writableWithDefault;
107
110
  exports.writablesForProps = utils_stores.writablesForProps;
108
111
  exports.writablesWithDefault = utils_stores.writablesWithDefault;
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { INVALID_VALUE } from "./types.js";
2
- import { a, c, f, g } from "./accordion-BGv150k9.js";
3
- import { c as c2, g as g2 } from "./alert-DJ2l7bcA.js";
4
- import { c as c3, g as g3, a as a2, m } from "./modal-DP-4I7vf.js";
5
- import { c as c4, g as g4 } from "./pagination-DwDRot6q.js";
6
- import { c as c5, g as g5 } from "./progressbar-CGmNq0cS.js";
7
- import { c as c6, g as g6 } from "./rating-Da38uaZz.js";
8
- import { c as c7, g as g7 } from "./select-CAEPqdz1.js";
9
- import { c as c8, g as g8 } from "./slider-6LI4-f5s.js";
10
- import { c as c9, g as g9 } from "./toast-CpvsibAI.js";
11
- import { c as c10, g as g10 } from "./tree-B2Mr8b31.js";
2
+ import { a, c, f, g } from "./accordion-hVi2XRk-.js";
3
+ import { c as c2, g as g2 } from "./alert-BSixS_cz.js";
4
+ import { c as c3, g as g3, a as a2, m } from "./modal-BQcw6bnM.js";
5
+ import { c as c4, g as g4 } from "./pagination-BwaZEokc.js";
6
+ import { c as c5, g as g5 } from "./progressbar-b_kXzGPc.js";
7
+ import { c as c6, g as g6 } from "./rating-B1JLZgIR.js";
8
+ import { c as c7, g as g7 } from "./select-Bb2RAVs0.js";
9
+ import { c as c8, g as g8 } from "./slider-C-BSdQ0b.js";
10
+ import { c as c9, g as g9 } from "./toast-Bw2QSzBX.js";
11
+ import { c as c10, g as g10 } from "./tree-DWv0zwFJ.js";
12
12
  import { createWidgetsConfig, mergeInto } from "./config.js";
13
13
  import { extendWidgetProps } from "./services/extendWidget.js";
14
14
  import { createFloatingUI } from "./services/floatingUI.js";
@@ -23,8 +23,8 @@ import { hash$ } from "./services/hash.js";
23
23
  import { createTransition, noAnimation } from "./services/transitions/baseTransitions.js";
24
24
  import { createCSSTransition, getTransitionDurationMs, hasTransition } from "./services/transitions/cssTransitions.js";
25
25
  import { createSimpleClassTransition } from "./services/transitions/simpleClassTransition.js";
26
- import { o, a as a3, c as c11, b, p, n, g as g11, j, f as f2, h, q, d, e, i, m as m2, k, l, r, s } from "./directive-CKEccryv.js";
27
- import { bindableDerived, bindableProp, createPatch, findChangedProperties, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
26
+ import { o, a as a3, c as c11, b, p, n, g as g11, j, f as f2, h, q, d, e, i, m as m2, k, l, r, s } from "./dom-BB9jLllr.js";
27
+ import { bindableDerived, bindableProp, createPatch, false$, findChangedProperties, idWithDefault, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, true$, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
28
28
  import { i as i2, t, h as h2, c as c12, d as d2, f as f3, g as g12, a as a4, b as b2, e as e2 } from "./writables-DCiBdIBK.js";
29
29
  export {
30
30
  INVALID_VALUE,
@@ -69,6 +69,7 @@ export {
69
69
  e as directiveUpdate,
70
70
  extendWidgetProps,
71
71
  f as factoryCreateAccordion,
72
+ false$,
72
73
  findChangedProperties,
73
74
  g as getAccordionDefaultConfig,
74
75
  g2 as getAlertDefaultConfig,
@@ -84,6 +85,7 @@ export {
84
85
  g10 as getTreeDefaultConfig,
85
86
  hasTransition,
86
87
  hash$,
88
+ idWithDefault,
87
89
  i as isBrowserHTMLElement,
88
90
  isInternalInputNavigation,
89
91
  isStore,
@@ -104,6 +106,7 @@ export {
104
106
  t as testToNormalizeValue,
105
107
  toReadableStore,
106
108
  toWritableStore,
109
+ true$,
107
110
  h2 as typeArray,
108
111
  c12 as typeBoolean,
109
112
  d2 as typeBooleanOrNull,