@agnos-ui/core 0.9.3 → 0.10.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-CoM4efp-.js → accordion-CcirvrjR.js} +10 -15
- package/{accordion-cR5JqWJ8.cjs → accordion-yD-czBna.cjs} +10 -15
- package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
- package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
- package/{collapse-DwXz2kNw.js → collapse-BV4kD3j9.js} +2 -2
- package/{collapse-DRp53EuG.cjs → collapse-gLiT080Y.cjs} +2 -2
- package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
- package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/carousel/index.cjs +10 -23
- package/components/carousel/index.js +10 -23
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +222 -0
- package/components/drawer/index.cjs +5 -0
- package/components/drawer/index.d.ts +1 -0
- package/components/drawer/index.js +5 -0
- package/components/modal/index.cjs +2 -1
- package/components/modal/index.js +2 -1
- package/components/modal/modal.d.ts +5 -0
- 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/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 +2 -2
- package/config.d.ts +5 -0
- package/config.js +2 -2
- package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
- package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
- package/drawer-D5SO73ew.js +251 -0
- package/drawer-DP7UPojk.cjs +250 -0
- package/index.cjs +19 -13
- package/index.d.ts +1 -0
- package/index.js +36 -30
- package/isFocusable-Ckwus82R.js +32 -0
- package/isFocusable-DfzDLeAN.cjs +31 -0
- package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
- package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
- package/package.json +1 -1
- package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
- package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
- package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
- package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
- package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
- package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
- package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
- package/scrollbars-CT87iv_6.cjs +30 -0
- package/scrollbars-CcxSrnCx.js +31 -0
- package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
- package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
- package/services/extendWidget.cjs +2 -2
- package/services/extendWidget.js +2 -2
- package/services/floatingUI.cjs +8 -29
- package/services/floatingUI.js +9 -30
- package/services/focusElement.cjs +46 -0
- package/services/focusElement.d.ts +9 -0
- package/services/focusElement.js +46 -0
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/matchMedia.cjs +1 -1
- package/services/matchMedia.js +1 -1
- package/services/navManager.cjs +7 -37
- package/services/navManager.js +6 -36
- package/services/portal.cjs +7 -10
- package/services/portal.js +7 -10
- package/services/resizeObserver.cjs +2 -2
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +9 -8
- package/services/siblingsInert.d.ts +13 -3
- package/services/siblingsInert.js +9 -8
- package/services/transitions/baseTransitions.cjs +9 -10
- package/services/transitions/baseTransitions.js +10 -11
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
- package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
- package/toaster-UDglac7x.cjs +187 -0
- package/toaster-_p1GTtHI.js +188 -0
- package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
- package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
- package/utils/directive.cjs +3 -1
- package/utils/directive.d.ts +47 -0
- package/utils/directive.js +14 -12
- package/utils/stores.cjs +8 -9
- package/utils/stores.js +8 -9
- package/utils/writables.cjs +1 -1
- package/utils/writables.js +1 -1
- package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
- package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
- package/toaster-Cayg6Lbq.cjs +0 -209
- package/toaster-XfzHDqz_.js +0 -210
|
@@ -11,6 +11,11 @@ export declare const modalOutsideClick: unique symbol;
|
|
|
11
11
|
* and returned by the {@link ModalApi.open|open} method, when the modal is closed by a click on the close button.
|
|
12
12
|
*/
|
|
13
13
|
export declare const modalCloseButtonClick: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* Value present in the {@link ModalBeforeCloseEvent.result|result} property of the {@link ModalProps.onBeforeClose|onBeforeClose} event
|
|
16
|
+
* and returned by the {@link ModalApi.open|open} method, when the modal is closed by pressing the Escape key.
|
|
17
|
+
*/
|
|
18
|
+
export declare const modalCloseEscape: unique symbol;
|
|
14
19
|
/**
|
|
15
20
|
* Properties of the modal widget that are also in the state of the modal.
|
|
16
21
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const pagination = require("../../pagination-
|
|
3
|
+
const pagination = require("../../pagination-DvZ2rLsz.cjs");
|
|
4
4
|
exports.createPagination = pagination.createPagination;
|
|
5
5
|
exports.getPaginationDefaultConfig = pagination.getPaginationDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const progressbar = require("../../progressbar-
|
|
3
|
+
const progressbar = require("../../progressbar-i9xfAxb7.cjs");
|
|
4
4
|
exports.createProgressbar = progressbar.createProgressbar;
|
|
5
5
|
exports.getProgressbarDefaultConfig = progressbar.getProgressbarDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const rating = require("../../rating-
|
|
3
|
+
const rating = require("../../rating-DmG4oUkr.cjs");
|
|
4
4
|
exports.createRating = rating.createRating;
|
|
5
5
|
exports.getRatingDefaultConfig = rating.getRatingDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const select = require("../../select-
|
|
3
|
+
const select = require("../../select-MFjAnIt7.cjs");
|
|
4
4
|
exports.createSelect = select.createSelect;
|
|
5
5
|
exports.getSelectDefaultConfig = select.getSelectDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const slider = require("../../slider-
|
|
3
|
+
const slider = require("../../slider-Dl4Trh32.cjs");
|
|
4
4
|
exports.createSlider = slider.createSlider;
|
|
5
5
|
exports.getSliderDefaultConfig = slider.getSliderDefaultConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toaster = require("../../toaster-
|
|
3
|
+
const toaster = require("../../toaster-UDglac7x.cjs");
|
|
4
4
|
exports.Toaster = toaster.Toaster;
|
|
5
5
|
exports.createToast = toaster.createToast;
|
|
6
6
|
exports.defaultToasterProps = toaster.defaultToasterProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const tree = require("../../tree-
|
|
3
|
+
const tree = require("../../tree-rGHtmCnS.cjs");
|
|
4
4
|
exports.createTree = tree.createTree;
|
|
5
5
|
exports.getTreeDefaultConfig = tree.getTreeDefaultConfig;
|
package/components/tree/index.js
CHANGED
package/config.cjs
CHANGED
|
@@ -21,9 +21,9 @@ const mergeInto = (destination, source, levels = Infinity) => {
|
|
|
21
21
|
};
|
|
22
22
|
const createWidgetsConfig = (parent$, adaptParentConfig = utils_func.identity) => {
|
|
23
23
|
const own$ = tansu.writable({});
|
|
24
|
-
const adaptedParent$ = adaptParentConfig === utils_func.identity ? parent$ : tansu.computed(() => adaptParentConfig(mergeInto({}, parent
|
|
24
|
+
const adaptedParent$ = adaptParentConfig === utils_func.identity ? parent$ : tansu.computed(() => adaptParentConfig(mergeInto({}, parent$?.(), 2)));
|
|
25
25
|
return tansu.asWritable(
|
|
26
|
-
tansu.computed(() => mergeInto(mergeInto({}, adaptedParent
|
|
26
|
+
tansu.computed(() => mergeInto(mergeInto({}, adaptedParent$?.(), 2), own$(), 2)),
|
|
27
27
|
{
|
|
28
28
|
...own$,
|
|
29
29
|
own$,
|
package/config.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { ToastProps } from './components/toast/toast';
|
|
|
11
11
|
import type { TreeProps } from './components/tree/tree';
|
|
12
12
|
import type { CarouselProps } from './components/carousel';
|
|
13
13
|
import type { CollapseProps } from './components/collapse';
|
|
14
|
+
import type { DrawerProps } from './components/drawer/drawer';
|
|
14
15
|
/**
|
|
15
16
|
* A utility type that makes all properties of an object type `T` optional,
|
|
16
17
|
* and also makes all properties of the nested objects within `T` optional.
|
|
@@ -114,4 +115,8 @@ export type WidgetsConfig = {
|
|
|
114
115
|
* collapse widget config
|
|
115
116
|
*/
|
|
116
117
|
collapse: CollapseProps;
|
|
118
|
+
/**
|
|
119
|
+
* drawer widget config
|
|
120
|
+
*/
|
|
121
|
+
drawer: DrawerProps;
|
|
117
122
|
};
|
package/config.js
CHANGED
|
@@ -19,9 +19,9 @@ const mergeInto = (destination, source, levels = Infinity) => {
|
|
|
19
19
|
};
|
|
20
20
|
const createWidgetsConfig = (parent$, adaptParentConfig = identity) => {
|
|
21
21
|
const own$ = writable({});
|
|
22
|
-
const adaptedParent$ = adaptParentConfig === identity ? parent$ : computed(() => adaptParentConfig(mergeInto({}, parent
|
|
22
|
+
const adaptedParent$ = adaptParentConfig === identity ? parent$ : computed(() => adaptParentConfig(mergeInto({}, parent$?.(), 2)));
|
|
23
23
|
return asWritable(
|
|
24
|
-
computed(() => mergeInto(mergeInto({}, adaptedParent
|
|
24
|
+
computed(() => mergeInto(mergeInto({}, adaptedParent$?.(), 2), own$(), 2)),
|
|
25
25
|
{
|
|
26
26
|
...own$,
|
|
27
27
|
own$,
|
|
@@ -57,13 +57,12 @@ function clsx() {
|
|
|
57
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
58
|
return n;
|
|
59
59
|
}
|
|
60
|
-
const isBrowserHTMLElement = BROWSER ? (element) => {
|
|
61
|
-
|
|
62
|
-
const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
|
|
60
|
+
const isBrowserHTMLElement = BROWSER ? ((element) => {
|
|
61
|
+
const contentWindow = element?.ownerDocument?.defaultView ?? window;
|
|
63
62
|
return element instanceof contentWindow.HTMLElement;
|
|
64
|
-
} : (
|
|
63
|
+
}) : (
|
|
65
64
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
66
|
-
(element) => false
|
|
65
|
+
((element) => false)
|
|
67
66
|
);
|
|
68
67
|
const browserDirective = BROWSER ? (directive) => (node, args) => {
|
|
69
68
|
if (isBrowserHTMLElement(node)) {
|
|
@@ -71,24 +70,22 @@ const browserDirective = BROWSER ? (directive) => (node, args) => {
|
|
|
71
70
|
}
|
|
72
71
|
} : (
|
|
73
72
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
-
(directive) => noop
|
|
73
|
+
((directive) => noop)
|
|
75
74
|
);
|
|
76
75
|
const bindDirective = (directive, directiveArg$) => (element) => {
|
|
77
76
|
let firstTime = true;
|
|
78
77
|
let instance;
|
|
79
78
|
const unsubscribe = directiveArg$.subscribe((value) => {
|
|
80
|
-
var _a;
|
|
81
79
|
if (firstTime) {
|
|
82
80
|
firstTime = false;
|
|
83
81
|
instance = directive(element, value);
|
|
84
82
|
} else {
|
|
85
|
-
|
|
83
|
+
instance?.update?.(value);
|
|
86
84
|
}
|
|
87
85
|
});
|
|
88
86
|
return {
|
|
89
87
|
destroy() {
|
|
90
|
-
|
|
91
|
-
(_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
88
|
+
instance?.destroy?.();
|
|
92
89
|
unsubscribe();
|
|
93
90
|
}
|
|
94
91
|
};
|
|
@@ -99,13 +96,9 @@ const mapDirectiveArg = (directive, fn) => (node, arg) => {
|
|
|
99
96
|
const instance = directive(node, fn(arg));
|
|
100
97
|
return {
|
|
101
98
|
update: (arg2) => {
|
|
102
|
-
|
|
103
|
-
(_a = instance == null ? void 0 : instance.update) == null ? void 0 : _a.call(instance, fn(arg2));
|
|
99
|
+
instance?.update?.(fn(arg2));
|
|
104
100
|
},
|
|
105
|
-
destroy: () =>
|
|
106
|
-
var _a;
|
|
107
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
108
|
-
}
|
|
101
|
+
destroy: () => instance?.destroy?.()
|
|
109
102
|
};
|
|
110
103
|
};
|
|
111
104
|
const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
|
|
@@ -154,17 +147,45 @@ const registrationArray = () => {
|
|
|
154
147
|
}
|
|
155
148
|
});
|
|
156
149
|
};
|
|
157
|
-
const
|
|
150
|
+
const createConditionalStoreArrayDirective = () => {
|
|
158
151
|
const elements$ = registrationArray();
|
|
159
152
|
return {
|
|
160
153
|
elements$: asReadable(elements$),
|
|
161
|
-
directive: (element) =>
|
|
154
|
+
directive: (element, enabled = true) => {
|
|
155
|
+
let destroyElements;
|
|
156
|
+
const update = (newEnabled = true) => {
|
|
157
|
+
if (!!newEnabled != !!destroyElements) {
|
|
158
|
+
if (newEnabled) {
|
|
159
|
+
destroyElements = elements$.register(element);
|
|
160
|
+
} else {
|
|
161
|
+
destroyElements?.();
|
|
162
|
+
destroyElements = void 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
update(enabled);
|
|
167
|
+
return {
|
|
168
|
+
destroy: () => update(false),
|
|
169
|
+
update
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const createStoreArrayDirective = () => {
|
|
175
|
+
const { directive, elements$ } = createConditionalStoreArrayDirective();
|
|
176
|
+
return {
|
|
177
|
+
directive: bindDirectiveNoArg(directive),
|
|
178
|
+
elements$
|
|
162
179
|
};
|
|
163
180
|
};
|
|
164
181
|
const createBrowserStoreArrayDirective = () => {
|
|
165
182
|
const { directive, elements$ } = createStoreArrayDirective();
|
|
166
183
|
return { directive: browserDirective(directive), elements$ };
|
|
167
184
|
};
|
|
185
|
+
const createConditionalBrowserStoreArrayDirective = () => {
|
|
186
|
+
const { directive, elements$ } = createConditionalStoreArrayDirective();
|
|
187
|
+
return { directive: browserDirective(directive), elements$ };
|
|
188
|
+
};
|
|
168
189
|
const createStoreDirective = () => {
|
|
169
190
|
const element$ = writable(null, equalOption);
|
|
170
191
|
return {
|
|
@@ -195,16 +216,10 @@ const mergeDirectives = (...args) => (element, arg) => {
|
|
|
195
216
|
const instances = batch(() => args.map((directive) => directive(element, arg)));
|
|
196
217
|
return {
|
|
197
218
|
update(arg2) {
|
|
198
|
-
batch(() => instances.forEach((instance) =>
|
|
199
|
-
var _a;
|
|
200
|
-
return (_a = instance == null ? void 0 : instance.update) == null ? void 0 : _a.call(instance, arg2);
|
|
201
|
-
}));
|
|
219
|
+
batch(() => instances.forEach((instance) => instance?.update?.(arg2)));
|
|
202
220
|
},
|
|
203
221
|
destroy() {
|
|
204
|
-
batch(() => instances.reverse().forEach((instance) =>
|
|
205
|
-
var _a;
|
|
206
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
207
|
-
}));
|
|
222
|
+
batch(() => instances.reverse().forEach((instance) => instance?.destroy?.()));
|
|
208
223
|
}
|
|
209
224
|
};
|
|
210
225
|
};
|
|
@@ -212,27 +227,23 @@ const multiDirective = (element, directives) => {
|
|
|
212
227
|
const instances = [];
|
|
213
228
|
const update = (directives2) => batch(() => {
|
|
214
229
|
directives2.forEach((directiveWithArg, index) => {
|
|
215
|
-
var _a, _b, _c, _d;
|
|
216
230
|
const [directive, arg] = Array.isArray(directiveWithArg) ? directiveWithArg : [directiveWithArg, void 0];
|
|
217
231
|
const oldInstance = instances[index];
|
|
218
232
|
if (oldInstance) {
|
|
219
233
|
if (oldInstance.directive === directive) {
|
|
220
234
|
if (oldInstance.arg !== arg) {
|
|
221
|
-
|
|
235
|
+
oldInstance.instance?.update?.(arg);
|
|
222
236
|
oldInstance.arg = arg;
|
|
223
237
|
}
|
|
224
238
|
return;
|
|
225
239
|
}
|
|
226
|
-
|
|
240
|
+
oldInstance.instance?.destroy?.();
|
|
227
241
|
}
|
|
228
242
|
const instance = directive(element, arg);
|
|
229
243
|
instances[index] = { directive, instance, arg };
|
|
230
244
|
});
|
|
231
245
|
const extraInstances = instances.splice(directives2.length);
|
|
232
|
-
extraInstances.reverse().forEach(({ instance }) =>
|
|
233
|
-
var _a;
|
|
234
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
235
|
-
});
|
|
246
|
+
extraInstances.reverse().forEach(({ instance }) => instance?.destroy?.());
|
|
236
247
|
});
|
|
237
248
|
update(directives);
|
|
238
249
|
return {
|
|
@@ -280,10 +291,7 @@ const attributesData = (...directives) => {
|
|
|
280
291
|
}
|
|
281
292
|
return element[ssrHTMLElementAttributesAndStyle]();
|
|
282
293
|
} finally {
|
|
283
|
-
instances.forEach((instance) =>
|
|
284
|
-
var _a;
|
|
285
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
286
|
-
});
|
|
294
|
+
instances.forEach((instance) => instance?.destroy?.());
|
|
287
295
|
}
|
|
288
296
|
};
|
|
289
297
|
const classDirective = createAttributesDirective((className$) => ({
|
|
@@ -395,29 +403,31 @@ function bindClassName(node, className, value$) {
|
|
|
395
403
|
};
|
|
396
404
|
}
|
|
397
405
|
export {
|
|
406
|
+
computeCommonAncestor as A,
|
|
398
407
|
bindDirective as a,
|
|
399
408
|
browserDirective as b,
|
|
400
409
|
bindDirectiveNoArg as c,
|
|
401
410
|
directiveSubscribe as d,
|
|
402
411
|
directiveUpdate as e,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
412
|
+
createConditionalStoreArrayDirective as f,
|
|
413
|
+
createStoreArrayDirective as g,
|
|
414
|
+
createBrowserStoreArrayDirective as h,
|
|
406
415
|
isBrowserHTMLElement as i,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
416
|
+
createConditionalBrowserStoreArrayDirective as j,
|
|
417
|
+
createStoreDirective as k,
|
|
418
|
+
createBrowserStoreDirective as l,
|
|
410
419
|
mapDirectiveArg as m,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
mergeDirectives as n,
|
|
421
|
+
multiDirective as o,
|
|
422
|
+
createAttributesDirective as p,
|
|
423
|
+
attributesData as q,
|
|
415
424
|
registrationArray as r,
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
425
|
+
classDirective as s,
|
|
426
|
+
directiveAttributes as t,
|
|
427
|
+
ssrAttributes as u,
|
|
428
|
+
generateId as v,
|
|
429
|
+
addEvent as w,
|
|
430
|
+
removeClasses as x,
|
|
431
|
+
addClasses as y,
|
|
432
|
+
reflow as z
|
|
423
433
|
};
|
|
@@ -58,13 +58,12 @@ function clsx() {
|
|
|
58
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
59
|
return n;
|
|
60
60
|
}
|
|
61
|
-
const isBrowserHTMLElement = esmEnv.BROWSER ? (element) => {
|
|
62
|
-
|
|
63
|
-
const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
|
|
61
|
+
const isBrowserHTMLElement = esmEnv.BROWSER ? ((element) => {
|
|
62
|
+
const contentWindow = element?.ownerDocument?.defaultView ?? window;
|
|
64
63
|
return element instanceof contentWindow.HTMLElement;
|
|
65
|
-
} : (
|
|
64
|
+
}) : (
|
|
66
65
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
|
-
(element) => false
|
|
66
|
+
((element) => false)
|
|
68
67
|
);
|
|
69
68
|
const browserDirective = esmEnv.BROWSER ? (directive) => (node, args) => {
|
|
70
69
|
if (isBrowserHTMLElement(node)) {
|
|
@@ -72,24 +71,22 @@ const browserDirective = esmEnv.BROWSER ? (directive) => (node, args) => {
|
|
|
72
71
|
}
|
|
73
72
|
} : (
|
|
74
73
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
|
-
(directive) => utils_func.noop
|
|
74
|
+
((directive) => utils_func.noop)
|
|
76
75
|
);
|
|
77
76
|
const bindDirective = (directive, directiveArg$) => (element) => {
|
|
78
77
|
let firstTime = true;
|
|
79
78
|
let instance;
|
|
80
79
|
const unsubscribe = directiveArg$.subscribe((value) => {
|
|
81
|
-
var _a;
|
|
82
80
|
if (firstTime) {
|
|
83
81
|
firstTime = false;
|
|
84
82
|
instance = directive(element, value);
|
|
85
83
|
} else {
|
|
86
|
-
|
|
84
|
+
instance?.update?.(value);
|
|
87
85
|
}
|
|
88
86
|
});
|
|
89
87
|
return {
|
|
90
88
|
destroy() {
|
|
91
|
-
|
|
92
|
-
(_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
89
|
+
instance?.destroy?.();
|
|
93
90
|
unsubscribe();
|
|
94
91
|
}
|
|
95
92
|
};
|
|
@@ -100,13 +97,9 @@ const mapDirectiveArg = (directive, fn) => (node, arg) => {
|
|
|
100
97
|
const instance = directive(node, fn(arg));
|
|
101
98
|
return {
|
|
102
99
|
update: (arg2) => {
|
|
103
|
-
|
|
104
|
-
(_a = instance == null ? void 0 : instance.update) == null ? void 0 : _a.call(instance, fn(arg2));
|
|
100
|
+
instance?.update?.(fn(arg2));
|
|
105
101
|
},
|
|
106
|
-
destroy: () =>
|
|
107
|
-
var _a;
|
|
108
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
109
|
-
}
|
|
102
|
+
destroy: () => instance?.destroy?.()
|
|
110
103
|
};
|
|
111
104
|
};
|
|
112
105
|
const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
|
|
@@ -155,17 +148,45 @@ const registrationArray = () => {
|
|
|
155
148
|
}
|
|
156
149
|
});
|
|
157
150
|
};
|
|
158
|
-
const
|
|
151
|
+
const createConditionalStoreArrayDirective = () => {
|
|
159
152
|
const elements$ = registrationArray();
|
|
160
153
|
return {
|
|
161
154
|
elements$: tansu.asReadable(elements$),
|
|
162
|
-
directive: (element) =>
|
|
155
|
+
directive: (element, enabled = true) => {
|
|
156
|
+
let destroyElements;
|
|
157
|
+
const update = (newEnabled = true) => {
|
|
158
|
+
if (!!newEnabled != !!destroyElements) {
|
|
159
|
+
if (newEnabled) {
|
|
160
|
+
destroyElements = elements$.register(element);
|
|
161
|
+
} else {
|
|
162
|
+
destroyElements?.();
|
|
163
|
+
destroyElements = void 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
update(enabled);
|
|
168
|
+
return {
|
|
169
|
+
destroy: () => update(false),
|
|
170
|
+
update
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
const createStoreArrayDirective = () => {
|
|
176
|
+
const { directive, elements$ } = createConditionalStoreArrayDirective();
|
|
177
|
+
return {
|
|
178
|
+
directive: bindDirectiveNoArg(directive),
|
|
179
|
+
elements$
|
|
163
180
|
};
|
|
164
181
|
};
|
|
165
182
|
const createBrowserStoreArrayDirective = () => {
|
|
166
183
|
const { directive, elements$ } = createStoreArrayDirective();
|
|
167
184
|
return { directive: browserDirective(directive), elements$ };
|
|
168
185
|
};
|
|
186
|
+
const createConditionalBrowserStoreArrayDirective = () => {
|
|
187
|
+
const { directive, elements$ } = createConditionalStoreArrayDirective();
|
|
188
|
+
return { directive: browserDirective(directive), elements$ };
|
|
189
|
+
};
|
|
169
190
|
const createStoreDirective = () => {
|
|
170
191
|
const element$ = tansu.writable(null, equalOption);
|
|
171
192
|
return {
|
|
@@ -196,16 +217,10 @@ const mergeDirectives = (...args) => (element, arg) => {
|
|
|
196
217
|
const instances = tansu.batch(() => args.map((directive) => directive(element, arg)));
|
|
197
218
|
return {
|
|
198
219
|
update(arg2) {
|
|
199
|
-
tansu.batch(() => instances.forEach((instance) =>
|
|
200
|
-
var _a;
|
|
201
|
-
return (_a = instance == null ? void 0 : instance.update) == null ? void 0 : _a.call(instance, arg2);
|
|
202
|
-
}));
|
|
220
|
+
tansu.batch(() => instances.forEach((instance) => instance?.update?.(arg2)));
|
|
203
221
|
},
|
|
204
222
|
destroy() {
|
|
205
|
-
tansu.batch(() => instances.reverse().forEach((instance) =>
|
|
206
|
-
var _a;
|
|
207
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
208
|
-
}));
|
|
223
|
+
tansu.batch(() => instances.reverse().forEach((instance) => instance?.destroy?.()));
|
|
209
224
|
}
|
|
210
225
|
};
|
|
211
226
|
};
|
|
@@ -213,27 +228,23 @@ const multiDirective = (element, directives) => {
|
|
|
213
228
|
const instances = [];
|
|
214
229
|
const update = (directives2) => tansu.batch(() => {
|
|
215
230
|
directives2.forEach((directiveWithArg, index) => {
|
|
216
|
-
var _a, _b, _c, _d;
|
|
217
231
|
const [directive, arg] = Array.isArray(directiveWithArg) ? directiveWithArg : [directiveWithArg, void 0];
|
|
218
232
|
const oldInstance = instances[index];
|
|
219
233
|
if (oldInstance) {
|
|
220
234
|
if (oldInstance.directive === directive) {
|
|
221
235
|
if (oldInstance.arg !== arg) {
|
|
222
|
-
|
|
236
|
+
oldInstance.instance?.update?.(arg);
|
|
223
237
|
oldInstance.arg = arg;
|
|
224
238
|
}
|
|
225
239
|
return;
|
|
226
240
|
}
|
|
227
|
-
|
|
241
|
+
oldInstance.instance?.destroy?.();
|
|
228
242
|
}
|
|
229
243
|
const instance = directive(element, arg);
|
|
230
244
|
instances[index] = { directive, instance, arg };
|
|
231
245
|
});
|
|
232
246
|
const extraInstances = instances.splice(directives2.length);
|
|
233
|
-
extraInstances.reverse().forEach(({ instance }) =>
|
|
234
|
-
var _a;
|
|
235
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
236
|
-
});
|
|
247
|
+
extraInstances.reverse().forEach(({ instance }) => instance?.destroy?.());
|
|
237
248
|
});
|
|
238
249
|
update(directives);
|
|
239
250
|
return {
|
|
@@ -281,10 +292,7 @@ const attributesData = (...directives) => {
|
|
|
281
292
|
}
|
|
282
293
|
return element[ssrHTMLElementAttributesAndStyle]();
|
|
283
294
|
} finally {
|
|
284
|
-
instances.forEach((instance) =>
|
|
285
|
-
var _a;
|
|
286
|
-
return (_a = instance == null ? void 0 : instance.destroy) == null ? void 0 : _a.call(instance);
|
|
287
|
-
});
|
|
295
|
+
instances.forEach((instance) => instance?.destroy?.());
|
|
288
296
|
}
|
|
289
297
|
};
|
|
290
298
|
const classDirective = createAttributesDirective((className$) => ({
|
|
@@ -406,6 +414,8 @@ exports.computeCommonAncestor = computeCommonAncestor;
|
|
|
406
414
|
exports.createAttributesDirective = createAttributesDirective;
|
|
407
415
|
exports.createBrowserStoreArrayDirective = createBrowserStoreArrayDirective;
|
|
408
416
|
exports.createBrowserStoreDirective = createBrowserStoreDirective;
|
|
417
|
+
exports.createConditionalBrowserStoreArrayDirective = createConditionalBrowserStoreArrayDirective;
|
|
418
|
+
exports.createConditionalStoreArrayDirective = createConditionalStoreArrayDirective;
|
|
409
419
|
exports.createStoreArrayDirective = createStoreArrayDirective;
|
|
410
420
|
exports.createStoreDirective = createStoreDirective;
|
|
411
421
|
exports.directiveAttributes = directiveAttributes;
|