@agnos-ui/core 0.7.1 → 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.
- package/{accordion-CJxsVQtv.cjs → accordion-DTQj-TQ1.cjs} +16 -18
- package/{accordion-D0oG0wQD.js → accordion-hVi2XRk-.js} +12 -14
- package/{alert-DJ2l7bcA.js → alert-BSixS_cz.js} +1 -1
- package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
- package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
- package/{common-Banw3FYN.js → common-CuZAeECD.js} +2 -3
- package/components/accordion/accordion.d.ts +1 -1
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/common.d.ts +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.d.ts +2 -2
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +64 -0
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/config.cjs +3 -3
- package/config.js +1 -1
- package/{directive-DrDJkTS5.js → dom-BB9jLllr.js} +99 -101
- package/{directive-BtOvPrmt.cjs → dom-CuBx1JPZ.cjs} +100 -102
- package/index.cjs +14 -11
- package/index.js +15 -12
- package/{modal-DtzgRa5j.cjs → modal-B7bYoubx.cjs} +12 -14
- package/{modal-Qr4sHBFG.js → modal-BQcw6bnM.js} +6 -8
- package/package.json +1 -1
- package/{pagination-ETXueztI.cjs → pagination-5YARuB3V.cjs} +8 -8
- package/{pagination-BigQwc8I.js → pagination-BwaZEokc.js} +8 -8
- package/{progressbar-BSgE9udi.cjs → progressbar-BpSrg4HG.cjs} +2 -2
- package/{progressbar-arTsTc5c.js → progressbar-b_kXzGPc.js} +3 -3
- package/{promise-CY2U8bTP.js → promise-CBh_HbSK.js} +1 -1
- package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
- package/{rating-CGv-KO_P.js → rating-B1JLZgIR.js} +8 -8
- package/{rating-BV6lk1US.cjs → rating-C8tn9xTO.cjs} +9 -9
- package/{select-C5DIoZrO.js → select-Bb2RAVs0.js} +20 -20
- package/{select-C6gwSGbr.cjs → select-D1pBz4CM.cjs} +21 -21
- package/services/floatingUI.cjs +2 -2
- package/services/floatingUI.js +2 -2
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/intersection.cjs +2 -2
- package/services/intersection.js +1 -1
- package/services/matchMedia.cjs +3 -2
- package/services/matchMedia.js +3 -2
- package/services/navManager.cjs +1 -1
- package/services/navManager.js +1 -1
- package/services/portal.cjs +1 -1
- package/services/portal.js +1 -1
- package/services/resizeObserver.cjs +3 -3
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +4 -4
- package/services/siblingsInert.js +2 -2
- package/services/transitions/baseTransitions.cjs +7 -7
- package/services/transitions/baseTransitions.js +3 -3
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +4 -4
- package/services/transitions/cssTransitions.js +3 -3
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-CkYsilwM.cjs → slider-B2JFXDLt.cjs} +109 -14
- package/{slider-DtQrcvim.js → slider-C-BSdQ0b.js} +110 -15
- package/{toast-4f-ZdK1Y.js → toast-Bw2QSzBX.js} +9 -8
- package/{toast-Vku2ZxoN.cjs → toast-CaIcB2sD.cjs} +8 -7
- package/{tree-BaSMyGyv.cjs → tree-D4t2SOql.cjs} +7 -7
- package/{tree-DVsZP8ze.js → tree-DWv0zwFJ.js} +8 -8
- package/utils/directive.cjs +2 -3
- package/utils/directive.d.ts +3 -3
- package/utils/directive.js +2 -3
- package/{func-Qd3cD9a3.cjs → utils/func.cjs} +1 -0
- package/{func-DR0n-ShK.js → utils/func.js} +2 -2
- package/utils/stores.cjs +13 -3
- package/utils/stores.d.ts +9 -0
- package/utils/stores.js +12 -2
- /package/utils/{internal/func.d.ts → func.d.ts} +0 -0
|
@@ -1,100 +1,6 @@
|
|
|
1
|
-
import { readable, writable, asReadable, batch, computed } from "@amadeus-it-group/tansu";
|
|
2
1
|
import { BROWSER } from "esm-env";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 = () => {
|
|
@@ -165,8 +71,7 @@ const browserDirective = BROWSER ? (directive) => (node, args) => {
|
|
|
165
71
|
}
|
|
166
72
|
} : (
|
|
167
73
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
168
|
-
(directive) =>
|
|
169
|
-
}
|
|
74
|
+
(directive) => noop
|
|
170
75
|
);
|
|
171
76
|
const bindDirective = (directive, directiveArg$) => (element) => {
|
|
172
77
|
let firstTime = true;
|
|
@@ -350,16 +255,16 @@ const createAttributesDirective = (propsFn) => (node, args) => {
|
|
|
350
255
|
}
|
|
351
256
|
for (const [attributeName, value] of Object.entries(attributes ?? {})) {
|
|
352
257
|
if (value != null) {
|
|
353
|
-
unsubscribers.push(bindAttribute(node, attributeName,
|
|
258
|
+
unsubscribers.push(bindAttribute(node, attributeName, value));
|
|
354
259
|
}
|
|
355
260
|
}
|
|
356
261
|
for (const [styleName, value] of Object.entries(styles ?? {})) {
|
|
357
262
|
if (value) {
|
|
358
|
-
unsubscribers.push(bindStyle(node, styleName,
|
|
263
|
+
unsubscribers.push(bindStyle(node, styleName, value));
|
|
359
264
|
}
|
|
360
265
|
}
|
|
361
266
|
for (const [className, value] of Object.entries(classNames ?? {})) {
|
|
362
|
-
unsubscribers.push(bindClassName(node, className,
|
|
267
|
+
unsubscribers.push(bindClassName(node, className, value));
|
|
363
268
|
}
|
|
364
269
|
return {
|
|
365
270
|
update: (args2) => args$.set(args2),
|
|
@@ -396,6 +301,99 @@ function directiveAttributes(...directives) {
|
|
|
396
301
|
return attributes;
|
|
397
302
|
}
|
|
398
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
|
+
}
|
|
399
397
|
export {
|
|
400
398
|
bindDirective as a,
|
|
401
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
|
|
5
|
-
const
|
|
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 = () => {
|
|
@@ -166,8 +72,7 @@ const browserDirective = esmEnv.BROWSER ? (directive) => (node, args) => {
|
|
|
166
72
|
}
|
|
167
73
|
} : (
|
|
168
74
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
169
|
-
(directive) =>
|
|
170
|
-
}
|
|
75
|
+
(directive) => utils_func.noop
|
|
171
76
|
);
|
|
172
77
|
const bindDirective = (directive, directiveArg$) => (element) => {
|
|
173
78
|
let firstTime = true;
|
|
@@ -205,7 +110,7 @@ const mapDirectiveArg = (directive, fn) => (node, arg) => {
|
|
|
205
110
|
};
|
|
206
111
|
};
|
|
207
112
|
const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
|
|
208
|
-
const unsubscribe = store.subscribe(
|
|
113
|
+
const unsubscribe = store.subscribe(utils_func.noop);
|
|
209
114
|
return {
|
|
210
115
|
destroy: async () => {
|
|
211
116
|
if (asyncUnsubscribe) {
|
|
@@ -351,16 +256,16 @@ const createAttributesDirective = (propsFn) => (node, args) => {
|
|
|
351
256
|
}
|
|
352
257
|
for (const [attributeName, value] of Object.entries(attributes ?? {})) {
|
|
353
258
|
if (value != null) {
|
|
354
|
-
unsubscribers.push(bindAttribute(node, attributeName,
|
|
259
|
+
unsubscribers.push(bindAttribute(node, attributeName, value));
|
|
355
260
|
}
|
|
356
261
|
}
|
|
357
262
|
for (const [styleName, value] of Object.entries(styles ?? {})) {
|
|
358
263
|
if (value) {
|
|
359
|
-
unsubscribers.push(bindStyle(node, styleName,
|
|
264
|
+
unsubscribers.push(bindStyle(node, styleName, value));
|
|
360
265
|
}
|
|
361
266
|
}
|
|
362
267
|
for (const [className, value] of Object.entries(classNames ?? {})) {
|
|
363
|
-
unsubscribers.push(bindClassName(node, className,
|
|
268
|
+
unsubscribers.push(bindClassName(node, className, value));
|
|
364
269
|
}
|
|
365
270
|
return {
|
|
366
271
|
update: (args2) => args$.set(args2),
|
|
@@ -397,6 +302,99 @@ function directiveAttributes(...directives) {
|
|
|
397
302
|
return attributes;
|
|
398
303
|
}
|
|
399
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
|
+
}
|
|
400
398
|
exports.addClasses = addClasses;
|
|
401
399
|
exports.addEvent = addEvent;
|
|
402
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-
|
|
5
|
-
const alert = require("./alert-
|
|
6
|
-
const modal = require("./modal-
|
|
7
|
-
const pagination = require("./pagination-
|
|
8
|
-
const progressbar = require("./progressbar-
|
|
9
|
-
const rating = require("./rating-
|
|
10
|
-
const select = require("./select-
|
|
11
|
-
const slider = require("./slider-
|
|
12
|
-
const toast = require("./toast-
|
|
13
|
-
const tree = require("./tree-
|
|
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("./
|
|
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-
|
|
3
|
-
import { c as c2, g as g2 } from "./alert-
|
|
4
|
-
import { c as c3, g as g3, a as a2, m } from "./modal-
|
|
5
|
-
import { c as c4, g as g4 } from "./pagination-
|
|
6
|
-
import { c as c5, g as g5 } from "./progressbar-
|
|
7
|
-
import { c as c6, g as g6 } from "./rating-
|
|
8
|
-
import { c as c7, g as g7 } from "./select-
|
|
9
|
-
import { c as c8, g as g8 } from "./slider-
|
|
10
|
-
import { c as c9, g as g9 } from "./toast-
|
|
11
|
-
import { c as c10, g as g10 } from "./tree-
|
|
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 "./
|
|
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,
|
|
@@ -3,9 +3,9 @@ const tansu = require("@amadeus-it-group/tansu");
|
|
|
3
3
|
const utils_writables = require("./writables-BPAJvaL_.cjs");
|
|
4
4
|
const utils_stores = require("./utils/stores.cjs");
|
|
5
5
|
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
6
|
-
const promise = require("./promise-
|
|
7
|
-
const
|
|
8
|
-
const utils_directive = require("./
|
|
6
|
+
const promise = require("./promise-CxCD3NYv.cjs");
|
|
7
|
+
const utils_func = require("./utils/func.cjs");
|
|
8
|
+
const utils_directive = require("./dom-CuBx1JPZ.cjs");
|
|
9
9
|
const services_portal = require("./services/portal.cjs");
|
|
10
10
|
const services_siblingsInert = require("./services/siblingsInert.cjs");
|
|
11
11
|
const internalRemoveScrollbars = () => {
|
|
@@ -25,14 +25,14 @@ const internalRemoveScrollbars = () => {
|
|
|
25
25
|
bodyStyle.overflow = overflow;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
let internalRevert =
|
|
28
|
+
let internalRevert = utils_func.noop;
|
|
29
29
|
const removeScrollbars = () => {
|
|
30
30
|
internalRevert();
|
|
31
31
|
internalRevert = internalRemoveScrollbars();
|
|
32
32
|
};
|
|
33
33
|
const revertScrollbars = () => {
|
|
34
34
|
internalRevert();
|
|
35
|
-
internalRevert =
|
|
35
|
+
internalRevert = utils_func.noop;
|
|
36
36
|
};
|
|
37
37
|
const modalOutsideClick = Symbol();
|
|
38
38
|
const modalCloseButtonClick = Symbol();
|
|
@@ -41,18 +41,16 @@ const defaultConfig = {
|
|
|
41
41
|
ariaCloseButtonLabel: "Close",
|
|
42
42
|
backdrop: true,
|
|
43
43
|
backdropClass: "",
|
|
44
|
-
backdropTransition:
|
|
45
|
-
},
|
|
44
|
+
backdropTransition: utils_func.noop,
|
|
46
45
|
closeButton: true,
|
|
47
46
|
closeOnOutsideClick: true,
|
|
48
47
|
container: typeof window !== "undefined" ? document.body : null,
|
|
49
48
|
className: "",
|
|
50
|
-
modalTransition:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
onShown: func.noop,
|
|
49
|
+
modalTransition: utils_func.noop,
|
|
50
|
+
onBeforeClose: utils_func.noop,
|
|
51
|
+
onVisibleChange: utils_func.noop,
|
|
52
|
+
onHidden: utils_func.noop,
|
|
53
|
+
onShown: utils_func.noop,
|
|
56
54
|
visible: false
|
|
57
55
|
};
|
|
58
56
|
const configValidator = {
|
|
@@ -175,7 +173,7 @@ function createModal(config$) {
|
|
|
175
173
|
});
|
|
176
174
|
const closeButtonDirective = utils_directive.createAttributesDirective(() => ({
|
|
177
175
|
attributes: {
|
|
178
|
-
type: "button",
|
|
176
|
+
type: tansu.readable("button"),
|
|
179
177
|
"aria-label": ariaCloseButtonLabel$
|
|
180
178
|
},
|
|
181
179
|
events: {
|
|
@@ -2,9 +2,9 @@ import { computed, readable } from "@amadeus-it-group/tansu";
|
|
|
2
2
|
import { c as typeBoolean, e as typeString, f as typeFunction, g as typeHTMLElementOrNull } from "./writables-DCiBdIBK.js";
|
|
3
3
|
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
4
4
|
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
5
|
-
import { d as promiseFromStore } from "./promise-
|
|
6
|
-
import {
|
|
7
|
-
import { r as registrationArray, a as bindDirective, k as mergeDirectives, d as directiveSubscribe, b as browserDirective, n as createAttributesDirective } from "./
|
|
5
|
+
import { d as promiseFromStore } from "./promise-CBh_HbSK.js";
|
|
6
|
+
import { noop } from "./utils/func.js";
|
|
7
|
+
import { r as registrationArray, a as bindDirective, k as mergeDirectives, d as directiveSubscribe, b as browserDirective, n as createAttributesDirective } from "./dom-BB9jLllr.js";
|
|
8
8
|
import { portal } from "./services/portal.js";
|
|
9
9
|
import { siblingsInert } from "./services/siblingsInert.js";
|
|
10
10
|
const internalRemoveScrollbars = () => {
|
|
@@ -40,14 +40,12 @@ const defaultConfig = {
|
|
|
40
40
|
ariaCloseButtonLabel: "Close",
|
|
41
41
|
backdrop: true,
|
|
42
42
|
backdropClass: "",
|
|
43
|
-
backdropTransition:
|
|
44
|
-
},
|
|
43
|
+
backdropTransition: noop,
|
|
45
44
|
closeButton: true,
|
|
46
45
|
closeOnOutsideClick: true,
|
|
47
46
|
container: typeof window !== "undefined" ? document.body : null,
|
|
48
47
|
className: "",
|
|
49
|
-
modalTransition:
|
|
50
|
-
},
|
|
48
|
+
modalTransition: noop,
|
|
51
49
|
onBeforeClose: noop,
|
|
52
50
|
onVisibleChange: noop,
|
|
53
51
|
onHidden: noop,
|
|
@@ -174,7 +172,7 @@ function createModal(config$) {
|
|
|
174
172
|
});
|
|
175
173
|
const closeButtonDirective = createAttributesDirective(() => ({
|
|
176
174
|
attributes: {
|
|
177
|
-
type: "button",
|
|
175
|
+
type: readable("button"),
|
|
178
176
|
"aria-label": ariaCloseButtonLabel$
|
|
179
177
|
},
|
|
180
178
|
events: {
|