@design-factory/angular 21.0.3 → 21.1.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/drawer/README.md +54 -0
- package/fesm2022/design-factory-angular-drawer.mjs +202 -67
- package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
- package/fesm2022/design-factory-angular-internals.mjs +439 -17
- package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
- package/fesm2022/design-factory-angular-sidenav.mjs +223 -210
- package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
- package/fesm2022/design-factory-angular-theme.mjs +198 -0
- package/fesm2022/design-factory-angular-theme.mjs.map +1 -0
- package/fesm2022/design-factory-angular-topnav.mjs +1538 -0
- package/fesm2022/design-factory-angular-topnav.mjs.map +1 -0
- package/node_modules/@agnos-ui/core/README.md +5 -0
- package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +314 -0
- package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +315 -0
- package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +9 -0
- package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +10 -0
- package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +94 -0
- package/node_modules/@agnos-ui/core/collapse-CP79atna.js +95 -0
- package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +73 -0
- package/node_modules/@agnos-ui/core/common-DFyZvkII.js +74 -0
- package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +333 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.cjs +7 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.js +7 -0
- package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +37 -0
- package/node_modules/@agnos-ui/core/components/alert/common.d.ts +138 -0
- package/node_modules/@agnos-ui/core/components/alert/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/alert/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/alert/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +247 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.cjs +292 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.js +292 -0
- package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +135 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/commonProps.d.ts +11 -0
- package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +279 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/modal/index.cjs +8 -0
- package/node_modules/@agnos-ui/core/components/modal/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/modal/index.js +8 -0
- package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +245 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +313 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +91 -0
- package/node_modules/@agnos-ui/core/components/rating/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/rating/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/rating/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +191 -0
- package/node_modules/@agnos-ui/core/components/slider/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/slider/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/slider/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +25 -0
- package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +383 -0
- package/node_modules/@agnos-ui/core/components/toast/index.cjs +7 -0
- package/node_modules/@agnos-ui/core/components/toast/index.d.ts +2 -0
- package/node_modules/@agnos-ui/core/components/toast/index.js +7 -0
- package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +66 -0
- package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +128 -0
- package/node_modules/@agnos-ui/core/components/tree/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/tree/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/tree/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +143 -0
- package/node_modules/@agnos-ui/core/config.cjs +36 -0
- package/node_modules/@agnos-ui/core/config.d.ts +117 -0
- package/node_modules/@agnos-ui/core/config.js +36 -0
- package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +523 -0
- package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +522 -0
- package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +328 -0
- package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +329 -0
- package/node_modules/@agnos-ui/core/index.cjs +134 -0
- package/node_modules/@agnos-ui/core/index.d.ts +29 -0
- package/node_modules/@agnos-ui/core/index.js +134 -0
- package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +32 -0
- package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +31 -0
- package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +252 -0
- package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +253 -0
- package/node_modules/@agnos-ui/core/package.json +57 -0
- package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +255 -0
- package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +254 -0
- package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +86 -0
- package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +87 -0
- package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +118 -0
- package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +119 -0
- package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +184 -0
- package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +183 -0
- package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +30 -0
- package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +31 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.cjs +41 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +31 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.js +41 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.cjs +111 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +76 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.js +111 -0
- package/node_modules/@agnos-ui/core/services/focusElement.cjs +46 -0
- package/node_modules/@agnos-ui/core/services/focusElement.d.ts +9 -0
- package/node_modules/@agnos-ui/core/services/focusElement.js +46 -0
- package/node_modules/@agnos-ui/core/services/focustrack.cjs +47 -0
- package/node_modules/@agnos-ui/core/services/focustrack.d.ts +40 -0
- package/node_modules/@agnos-ui/core/services/focustrack.js +47 -0
- package/node_modules/@agnos-ui/core/services/hash.cjs +15 -0
- package/node_modules/@agnos-ui/core/services/hash.d.ts +3 -0
- package/node_modules/@agnos-ui/core/services/hash.js +15 -0
- package/node_modules/@agnos-ui/core/services/intersection.cjs +53 -0
- package/node_modules/@agnos-ui/core/services/intersection.d.ts +30 -0
- package/node_modules/@agnos-ui/core/services/intersection.js +53 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.cjs +14 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +8 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.js +14 -0
- package/node_modules/@agnos-ui/core/services/navManager.cjs +166 -0
- package/node_modules/@agnos-ui/core/services/navManager.d.ts +144 -0
- package/node_modules/@agnos-ui/core/services/navManager.js +166 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +60 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +42 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +60 -0
- package/node_modules/@agnos-ui/core/services/portal.cjs +42 -0
- package/node_modules/@agnos-ui/core/services/portal.d.ts +16 -0
- package/node_modules/@agnos-ui/core/services/portal.js +42 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +54 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +18 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.js +54 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +44 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +16 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.js +44 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +186 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +166 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +186 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +40 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +49 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.js +40 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +32 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +25 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +32 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +37 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +47 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +37 -0
- package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +807 -0
- package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +808 -0
- package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +4 -0
- package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +3 -0
- package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +190 -0
- package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +191 -0
- package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +228 -0
- package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +229 -0
- package/node_modules/@agnos-ui/core/types.cjs +6 -0
- package/node_modules/@agnos-ui/core/types.d.ts +246 -0
- package/node_modules/@agnos-ui/core/types.js +6 -0
- package/node_modules/@agnos-ui/core/utils/directive.cjs +28 -0
- package/node_modules/@agnos-ui/core/utils/directive.d.ts +352 -0
- package/node_modules/@agnos-ui/core/utils/directive.js +28 -0
- package/node_modules/@agnos-ui/core/utils/func.cjs +7 -0
- package/node_modules/@agnos-ui/core/utils/func.d.ts +11 -0
- package/node_modules/@agnos-ui/core/utils/func.js +7 -0
- package/node_modules/@agnos-ui/core/utils/id.cjs +5 -0
- package/node_modules/@agnos-ui/core/utils/id.d.ts +6 -0
- package/node_modules/@agnos-ui/core/utils/id.js +5 -0
- package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +10 -0
- package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +57 -0
- package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +75 -0
- package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +9 -0
- package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +5 -0
- package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +98 -0
- package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +8 -0
- package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +16 -0
- package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +17 -0
- package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +7 -0
- package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +54 -0
- package/node_modules/@agnos-ui/core/utils/stores.cjs +172 -0
- package/node_modules/@agnos-ui/core/utils/stores.d.ts +224 -0
- package/node_modules/@agnos-ui/core/utils/stores.js +172 -0
- package/node_modules/@agnos-ui/core/utils/widget.cjs +8 -0
- package/node_modules/@agnos-ui/core/utils/widget.d.ts +11 -0
- package/node_modules/@agnos-ui/core/utils/widget.js +8 -0
- package/node_modules/@agnos-ui/core/utils/writables.cjs +16 -0
- package/node_modules/@agnos-ui/core/utils/writables.d.ts +95 -0
- package/node_modules/@agnos-ui/core/utils/writables.js +16 -0
- package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +103 -0
- package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +102 -0
- package/package.json +25 -6
- package/schematics/collection.json +1 -1
- package/types/design-factory-angular-drawer.d.ts +71 -13
- package/types/design-factory-angular-internals.d.ts +220 -31
- package/types/design-factory-angular-sidenav.d.ts +15 -7
- package/types/design-factory-angular-theme.d.ts +122 -0
- package/types/design-factory-angular-topnav.d.ts +435 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { d as typeBooleanOrNull, e as typeFunction, b as typeBoolean } from "../../writables-DYGjj5T3.js";
|
|
3
|
+
import { d as promiseWithResolve } from "../../promise-D-RZVPuv.js";
|
|
4
|
+
import { noop } from "../../utils/func.js";
|
|
5
|
+
import { writablesForProps, bindableDerived, stateStores } from "../../utils/stores.js";
|
|
6
|
+
import { m as createStoreDirective, s as mergeDirectives, o as directiveSubscribe } from "../../directive-Bsreu2z1.js";
|
|
7
|
+
const neverEndingPromise = new Promise(noop);
|
|
8
|
+
const noAnimation = (element, direction) => {
|
|
9
|
+
element.style.display = direction === "show" ? "" : "none";
|
|
10
|
+
};
|
|
11
|
+
const defaultValues = {
|
|
12
|
+
animated: true,
|
|
13
|
+
animatedOnInit: false,
|
|
14
|
+
initDone: null,
|
|
15
|
+
visible: true,
|
|
16
|
+
transition: noAnimation,
|
|
17
|
+
onShown: noop,
|
|
18
|
+
onHidden: noop,
|
|
19
|
+
onVisibleChange: noop
|
|
20
|
+
};
|
|
21
|
+
const configValidator = {
|
|
22
|
+
animated: typeBoolean,
|
|
23
|
+
animatedOnInit: typeBoolean,
|
|
24
|
+
visible: typeBoolean,
|
|
25
|
+
transition: typeFunction,
|
|
26
|
+
onShown: typeFunction,
|
|
27
|
+
onHidden: typeFunction,
|
|
28
|
+
onVisibleChange: typeFunction,
|
|
29
|
+
initDone: typeBooleanOrNull
|
|
30
|
+
};
|
|
31
|
+
const createTransition = (config) => {
|
|
32
|
+
const [
|
|
33
|
+
{
|
|
34
|
+
animated$,
|
|
35
|
+
initDone$,
|
|
36
|
+
visible$: requestedVisible$,
|
|
37
|
+
transition$,
|
|
38
|
+
onShown$,
|
|
39
|
+
onHidden$,
|
|
40
|
+
onVisibleChange$,
|
|
41
|
+
animatedOnInit$
|
|
42
|
+
},
|
|
43
|
+
patch
|
|
44
|
+
] = writablesForProps(defaultValues, config, configValidator);
|
|
45
|
+
const { element$, directive: storeDirective } = createStoreDirective();
|
|
46
|
+
const elementPresent$ = computed(() => !!element$());
|
|
47
|
+
const visible$ = bindableDerived(onVisibleChange$, [requestedVisible$], ([visible]) => visible);
|
|
48
|
+
const currentTransition$ = writable(
|
|
49
|
+
null
|
|
50
|
+
);
|
|
51
|
+
const stop = () => {
|
|
52
|
+
let context;
|
|
53
|
+
currentTransition$.update((currentTransition) => {
|
|
54
|
+
currentTransition?.abort.abort();
|
|
55
|
+
context = currentTransition?.context;
|
|
56
|
+
return null;
|
|
57
|
+
});
|
|
58
|
+
return context;
|
|
59
|
+
};
|
|
60
|
+
const runTransition = (visible, animated, element, transitionFn) => batch(() => {
|
|
61
|
+
const abort = new AbortController();
|
|
62
|
+
const signal = abort.signal;
|
|
63
|
+
const context = stop() ?? {};
|
|
64
|
+
const { promise, resolve } = promiseWithResolve();
|
|
65
|
+
const currentTransition = {
|
|
66
|
+
abort,
|
|
67
|
+
animated,
|
|
68
|
+
visible,
|
|
69
|
+
context,
|
|
70
|
+
element,
|
|
71
|
+
transitionFn,
|
|
72
|
+
promise
|
|
73
|
+
};
|
|
74
|
+
currentTransition$.set(currentTransition);
|
|
75
|
+
resolve(
|
|
76
|
+
(async () => {
|
|
77
|
+
try {
|
|
78
|
+
await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
|
|
79
|
+
} finally {
|
|
80
|
+
if (signal.aborted) {
|
|
81
|
+
await neverEndingPromise;
|
|
82
|
+
} else {
|
|
83
|
+
currentTransition$.set(null);
|
|
84
|
+
(visible ? onShown$ : onHidden$)()?.();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})()
|
|
88
|
+
);
|
|
89
|
+
return currentTransition;
|
|
90
|
+
});
|
|
91
|
+
const effectiveAnimation$ = computed(() => initDone$() ? animated$() : animatedOnInit$());
|
|
92
|
+
const animationFromToggle$ = writable(null);
|
|
93
|
+
let previousElement;
|
|
94
|
+
let previousVisible = requestedVisible$();
|
|
95
|
+
let pendingTransition = null;
|
|
96
|
+
const visibleAction$ = derived(
|
|
97
|
+
[visible$, element$, effectiveAnimation$, animationFromToggle$, transition$, currentTransition$],
|
|
98
|
+
([visible, element, animated, animationFromToggle, transition, currentTransition]) => {
|
|
99
|
+
const elementChanged = previousElement !== element;
|
|
100
|
+
previousElement = element;
|
|
101
|
+
const visibleChanged = previousVisible !== visible;
|
|
102
|
+
previousVisible = visible;
|
|
103
|
+
if (element) {
|
|
104
|
+
if (initDone$() == null) {
|
|
105
|
+
initDone$.set(true);
|
|
106
|
+
}
|
|
107
|
+
const interruptAnimation = animationFromToggle != null && currentTransition && currentTransition.animated != animationFromToggle;
|
|
108
|
+
if (elementChanged || visibleChanged || interruptAnimation) {
|
|
109
|
+
if (visibleChanged || animationFromToggle != null) {
|
|
110
|
+
pendingTransition = null;
|
|
111
|
+
}
|
|
112
|
+
const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
|
|
113
|
+
currentTransition = runTransition(visible, animate, element, transition);
|
|
114
|
+
pendingTransition?.resolve(currentTransition.promise);
|
|
115
|
+
pendingTransition = null;
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
if (elementChanged) {
|
|
119
|
+
stop();
|
|
120
|
+
currentTransition = null;
|
|
121
|
+
}
|
|
122
|
+
if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
|
|
123
|
+
pendingTransition = visible && animationFromToggle != null ? {
|
|
124
|
+
// toggle was called to display the element, but the element is not yet in the DOM
|
|
125
|
+
// let's keep the animation setting from toggle and provide the promise for the end of toggle
|
|
126
|
+
animated: animationFromToggle,
|
|
127
|
+
...promiseWithResolve()
|
|
128
|
+
} : null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return pendingTransition?.promise ?? currentTransition?.promise;
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
let lastToggle = {};
|
|
135
|
+
const toggle = async (visible = !requestedVisible$(), animated = effectiveAnimation$()) => {
|
|
136
|
+
const currentToggle = {};
|
|
137
|
+
lastToggle = currentToggle;
|
|
138
|
+
try {
|
|
139
|
+
await batch(() => {
|
|
140
|
+
try {
|
|
141
|
+
animationFromToggle$.set(animated);
|
|
142
|
+
requestedVisible$.set(visible);
|
|
143
|
+
return visibleAction$();
|
|
144
|
+
} finally {
|
|
145
|
+
animationFromToggle$.set(null);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
} finally {
|
|
149
|
+
if (lastToggle !== currentToggle) {
|
|
150
|
+
await neverEndingPromise;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const transitioning$ = computed(() => {
|
|
155
|
+
if (elementPresent$()) {
|
|
156
|
+
void visibleAction$();
|
|
157
|
+
}
|
|
158
|
+
return !!currentTransition$();
|
|
159
|
+
});
|
|
160
|
+
const shown$ = computed(() => !transitioning$() && visible$() && elementPresent$());
|
|
161
|
+
const hidden$ = computed(() => !transitioning$() && !visible$());
|
|
162
|
+
const directive = mergeDirectives(storeDirective, directiveSubscribe(visibleAction$));
|
|
163
|
+
return {
|
|
164
|
+
...stateStores({
|
|
165
|
+
visible$,
|
|
166
|
+
element$,
|
|
167
|
+
elementPresent$,
|
|
168
|
+
transitioning$,
|
|
169
|
+
shown$,
|
|
170
|
+
hidden$
|
|
171
|
+
}),
|
|
172
|
+
patch,
|
|
173
|
+
directives: {
|
|
174
|
+
directive
|
|
175
|
+
},
|
|
176
|
+
api: {
|
|
177
|
+
show: toggle.bind(null, true),
|
|
178
|
+
hide: toggle.bind(null, false),
|
|
179
|
+
toggle
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export {
|
|
184
|
+
createTransition,
|
|
185
|
+
noAnimation
|
|
186
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const utils_directive = require("../../directive-DCaXmRe_.cjs");
|
|
4
|
+
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
5
|
+
const createCollapseTransition = ({
|
|
6
|
+
dimension = "height",
|
|
7
|
+
showClasses,
|
|
8
|
+
hideClasses,
|
|
9
|
+
animationPendingClasses
|
|
10
|
+
} = {}) => services_transitions_cssTransitions.createCSSTransition((element, direction, animated, context) => {
|
|
11
|
+
if (animated && utils_directive.isBrowserHTMLElement(element)) {
|
|
12
|
+
let { maxSize, minSize } = context;
|
|
13
|
+
utils_directive.removeClasses(element, animationPendingClasses);
|
|
14
|
+
utils_directive.removeClasses(element, hideClasses);
|
|
15
|
+
utils_directive.addClasses(element, showClasses);
|
|
16
|
+
maxSize = element.getBoundingClientRect()[dimension] + "px";
|
|
17
|
+
context.maxSize = maxSize;
|
|
18
|
+
utils_directive.removeClasses(element, animationPendingClasses);
|
|
19
|
+
utils_directive.removeClasses(element, showClasses);
|
|
20
|
+
utils_directive.addClasses(element, hideClasses);
|
|
21
|
+
minSize = element.getBoundingClientRect()[dimension] + "px";
|
|
22
|
+
context.minSize = minSize;
|
|
23
|
+
utils_directive.removeClasses(element, showClasses);
|
|
24
|
+
utils_directive.removeClasses(element, hideClasses);
|
|
25
|
+
const values = direction === "show" ? [minSize, maxSize] : [maxSize, minSize];
|
|
26
|
+
element.style[dimension] = values[0];
|
|
27
|
+
utils_directive.reflow(element);
|
|
28
|
+
utils_directive.addClasses(element, animationPendingClasses);
|
|
29
|
+
utils_directive.reflow(element);
|
|
30
|
+
element.style[dimension] = values[1];
|
|
31
|
+
} else {
|
|
32
|
+
utils_directive.removeClasses(element, direction === "show" ? hideClasses : showClasses);
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
utils_directive.removeClasses(element, animationPendingClasses);
|
|
36
|
+
utils_directive.addClasses(element, direction === "show" ? showClasses : hideClasses);
|
|
37
|
+
element.style[dimension] = "";
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
exports.createCollapseTransition = createCollapseTransition;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TransitionFn } from './baseTransitions';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the context for a collapsible element.
|
|
4
|
+
*/
|
|
5
|
+
export interface CollapseContext {
|
|
6
|
+
/**
|
|
7
|
+
* the maximum size of the collapseable content.
|
|
8
|
+
*/
|
|
9
|
+
maxSize?: string;
|
|
10
|
+
/**
|
|
11
|
+
* the minimum size of the collapseable content
|
|
12
|
+
*/
|
|
13
|
+
minSize?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration options for the collapse transition.
|
|
17
|
+
*/
|
|
18
|
+
export interface CollapseConfig {
|
|
19
|
+
/**
|
|
20
|
+
* the direction in which the collapsing is performed
|
|
21
|
+
*/
|
|
22
|
+
dimension?: 'width' | 'height';
|
|
23
|
+
/**
|
|
24
|
+
* the list of classes to add to the collapsable element when shown
|
|
25
|
+
*/
|
|
26
|
+
showClasses?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* the list of classes to add to the collapsable element when collapsed
|
|
29
|
+
*/
|
|
30
|
+
hideClasses?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* the list of classes to add to the collapsable element while transitioning
|
|
33
|
+
*/
|
|
34
|
+
animationPendingClasses?: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a collapse transition.
|
|
38
|
+
*
|
|
39
|
+
* The transition attaches / removes classes during the different states of the collapse transition.
|
|
40
|
+
* It also updates the dimension value when reaching a non-pending state.
|
|
41
|
+
*
|
|
42
|
+
* @param config - the collapse config
|
|
43
|
+
* @param config.dimension - the dimension, `height` or `width`, on which the collapse applies
|
|
44
|
+
* @param config.showClasses - the classes to attach when the element is fully visible
|
|
45
|
+
* @param config.hideClasses - the classes to attach when the element is fully collapsed
|
|
46
|
+
* @param config.animationPendingClasses - the classes to attach when the transition is pending
|
|
47
|
+
* @returns the collapse transition
|
|
48
|
+
*/
|
|
49
|
+
export declare const createCollapseTransition: ({ dimension, showClasses, hideClasses, animationPendingClasses }?: CollapseConfig) => TransitionFn;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { q as isBrowserHTMLElement, x as removeClasses, y as addClasses, z as reflow } from "../../directive-Bsreu2z1.js";
|
|
2
|
+
import { createCSSTransition } from "./cssTransitions.js";
|
|
3
|
+
const createCollapseTransition = ({
|
|
4
|
+
dimension = "height",
|
|
5
|
+
showClasses,
|
|
6
|
+
hideClasses,
|
|
7
|
+
animationPendingClasses
|
|
8
|
+
} = {}) => createCSSTransition((element, direction, animated, context) => {
|
|
9
|
+
if (animated && isBrowserHTMLElement(element)) {
|
|
10
|
+
let { maxSize, minSize } = context;
|
|
11
|
+
removeClasses(element, animationPendingClasses);
|
|
12
|
+
removeClasses(element, hideClasses);
|
|
13
|
+
addClasses(element, showClasses);
|
|
14
|
+
maxSize = element.getBoundingClientRect()[dimension] + "px";
|
|
15
|
+
context.maxSize = maxSize;
|
|
16
|
+
removeClasses(element, animationPendingClasses);
|
|
17
|
+
removeClasses(element, showClasses);
|
|
18
|
+
addClasses(element, hideClasses);
|
|
19
|
+
minSize = element.getBoundingClientRect()[dimension] + "px";
|
|
20
|
+
context.minSize = minSize;
|
|
21
|
+
removeClasses(element, showClasses);
|
|
22
|
+
removeClasses(element, hideClasses);
|
|
23
|
+
const values = direction === "show" ? [minSize, maxSize] : [maxSize, minSize];
|
|
24
|
+
element.style[dimension] = values[0];
|
|
25
|
+
reflow(element);
|
|
26
|
+
addClasses(element, animationPendingClasses);
|
|
27
|
+
reflow(element);
|
|
28
|
+
element.style[dimension] = values[1];
|
|
29
|
+
} else {
|
|
30
|
+
removeClasses(element, direction === "show" ? hideClasses : showClasses);
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
removeClasses(element, animationPendingClasses);
|
|
34
|
+
addClasses(element, direction === "show" ? showClasses : hideClasses);
|
|
35
|
+
element.style[dimension] = "";
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
createCollapseTransition
|
|
40
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const utils_directive = require("../../directive-DCaXmRe_.cjs");
|
|
4
|
+
const utils_func = require("../../utils/func.cjs");
|
|
5
|
+
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
|
+
function hasTransition(element) {
|
|
7
|
+
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
8
|
+
}
|
|
9
|
+
function getTransitionDurationMs(element) {
|
|
10
|
+
const { transitionDelay, transitionDuration } = window.getComputedStyle(element);
|
|
11
|
+
const transitionDelaySec = parseFloat(transitionDelay);
|
|
12
|
+
const transitionDurationSec = parseFloat(transitionDuration);
|
|
13
|
+
return (transitionDelaySec + transitionDurationSec) * 1e3;
|
|
14
|
+
}
|
|
15
|
+
const createCSSTransition = (start) => async (element, direction, animated, signal, context) => {
|
|
16
|
+
const endFn = start(element, direction, animated, context) ?? utils_func.noop;
|
|
17
|
+
if (utils_directive.isBrowserHTMLElement(element) && animated && hasTransition(element)) {
|
|
18
|
+
const abort = promise.promiseFromEvent(signal, "abort");
|
|
19
|
+
const transitionEnd = promise.promiseFromEvent(element, "transitionend");
|
|
20
|
+
const timer = promise.promiseFromTimeout(getTransitionDurationMs(element));
|
|
21
|
+
await Promise.race([abort.promise, transitionEnd.promise, timer.promise]);
|
|
22
|
+
abort.unsubscribe();
|
|
23
|
+
transitionEnd.unsubscribe();
|
|
24
|
+
timer.unsubscribe();
|
|
25
|
+
}
|
|
26
|
+
if (!signal.aborted) {
|
|
27
|
+
endFn();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.createCSSTransition = createCSSTransition;
|
|
31
|
+
exports.getTransitionDurationMs = getTransitionDurationMs;
|
|
32
|
+
exports.hasTransition = hasTransition;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SSRHTMLElement } from '../../types';
|
|
2
|
+
import type { TransitionFn } from './baseTransitions';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the provided html element has a transition
|
|
5
|
+
* @param element - the html element
|
|
6
|
+
* @returns true if the element has a transition
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasTransition(element: HTMLElement): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve the transition duration of the provided html element in milli seconds
|
|
11
|
+
* @param element - the html element
|
|
12
|
+
* @returns transition duration in milli seconds
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTransitionDurationMs(element: HTMLElement): number;
|
|
15
|
+
/**
|
|
16
|
+
* Defines a function type for CSS transitions.
|
|
17
|
+
*/
|
|
18
|
+
export type CSSTransitionFn = (element: SSRHTMLElement, direction: 'show' | 'hide', animated: boolean, context: object) => void | (() => void);
|
|
19
|
+
/**
|
|
20
|
+
* Create a simple css transition.
|
|
21
|
+
*
|
|
22
|
+
* @param start - a function that creates the css animation and returns a clean-up function
|
|
23
|
+
* @returns the css transition
|
|
24
|
+
*/
|
|
25
|
+
export declare const createCSSTransition: (start: CSSTransitionFn) => TransitionFn;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { q as isBrowserHTMLElement } from "../../directive-Bsreu2z1.js";
|
|
2
|
+
import { noop } from "../../utils/func.js";
|
|
3
|
+
import { b as promiseFromEvent, c as promiseFromTimeout } from "../../promise-D-RZVPuv.js";
|
|
4
|
+
function hasTransition(element) {
|
|
5
|
+
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
6
|
+
}
|
|
7
|
+
function getTransitionDurationMs(element) {
|
|
8
|
+
const { transitionDelay, transitionDuration } = window.getComputedStyle(element);
|
|
9
|
+
const transitionDelaySec = parseFloat(transitionDelay);
|
|
10
|
+
const transitionDurationSec = parseFloat(transitionDuration);
|
|
11
|
+
return (transitionDelaySec + transitionDurationSec) * 1e3;
|
|
12
|
+
}
|
|
13
|
+
const createCSSTransition = (start) => async (element, direction, animated, signal, context) => {
|
|
14
|
+
const endFn = start(element, direction, animated, context) ?? noop;
|
|
15
|
+
if (isBrowserHTMLElement(element) && animated && hasTransition(element)) {
|
|
16
|
+
const abort = promiseFromEvent(signal, "abort");
|
|
17
|
+
const transitionEnd = promiseFromEvent(element, "transitionend");
|
|
18
|
+
const timer = promiseFromTimeout(getTransitionDurationMs(element));
|
|
19
|
+
await Promise.race([abort.promise, transitionEnd.promise, timer.promise]);
|
|
20
|
+
abort.unsubscribe();
|
|
21
|
+
transitionEnd.unsubscribe();
|
|
22
|
+
timer.unsubscribe();
|
|
23
|
+
}
|
|
24
|
+
if (!signal.aborted) {
|
|
25
|
+
endFn();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
createCSSTransition,
|
|
30
|
+
getTransitionDurationMs,
|
|
31
|
+
hasTransition
|
|
32
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
4
|
+
const utils_directive = require("../../directive-DCaXmRe_.cjs");
|
|
5
|
+
const createSimpleClassTransition = (config) => {
|
|
6
|
+
const {
|
|
7
|
+
animationPendingClasses,
|
|
8
|
+
animationPendingShowClasses,
|
|
9
|
+
animationPendingHideClasses,
|
|
10
|
+
showClasses,
|
|
11
|
+
hideClasses
|
|
12
|
+
} = config;
|
|
13
|
+
return services_transitions_cssTransitions.createCSSTransition((element, direction, animated, context) => {
|
|
14
|
+
utils_directive.removeClasses(element, showClasses);
|
|
15
|
+
utils_directive.removeClasses(element, hideClasses);
|
|
16
|
+
if (animated) {
|
|
17
|
+
utils_directive.removeClasses(element, direction === "show" ? animationPendingHideClasses : animationPendingShowClasses);
|
|
18
|
+
if (!context.started) {
|
|
19
|
+
context.started = true;
|
|
20
|
+
const classes = direction === "show" ? hideClasses : showClasses;
|
|
21
|
+
utils_directive.addClasses(element, classes);
|
|
22
|
+
utils_directive.reflow(element);
|
|
23
|
+
utils_directive.removeClasses(element, classes);
|
|
24
|
+
}
|
|
25
|
+
utils_directive.addClasses(element, animationPendingClasses);
|
|
26
|
+
utils_directive.reflow(element);
|
|
27
|
+
utils_directive.addClasses(element, direction === "show" ? animationPendingShowClasses : animationPendingHideClasses);
|
|
28
|
+
}
|
|
29
|
+
return () => {
|
|
30
|
+
utils_directive.removeClasses(element, animationPendingClasses);
|
|
31
|
+
utils_directive.removeClasses(element, animationPendingShowClasses);
|
|
32
|
+
utils_directive.removeClasses(element, animationPendingHideClasses);
|
|
33
|
+
utils_directive.addClasses(element, direction === "show" ? showClasses : hideClasses);
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.createSimpleClassTransition = createSimpleClassTransition;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TransitionFn } from './baseTransitions';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration interface for simple class-based transitions.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimpleClassTransitionConfig {
|
|
6
|
+
/**
|
|
7
|
+
* a list of classes to add to the collapsable element while transitioning
|
|
8
|
+
*/
|
|
9
|
+
animationPendingClasses?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* a list of classes to add to the collapsable element while transitioning towards the show state
|
|
12
|
+
*/
|
|
13
|
+
animationPendingShowClasses?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* a list of classes to add to the collapsable element while transitioning towards the hide state
|
|
16
|
+
*/
|
|
17
|
+
animationPendingHideClasses?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* the list of classes to add to the element when shown
|
|
20
|
+
*/
|
|
21
|
+
showClasses?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* the list of classes to add to the element when hidden
|
|
24
|
+
*/
|
|
25
|
+
hideClasses?: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents the context for a simple class transition.
|
|
29
|
+
*/
|
|
30
|
+
export interface SimpleClassTransitionContext {
|
|
31
|
+
/**
|
|
32
|
+
* `true` is the transition has started
|
|
33
|
+
*/
|
|
34
|
+
started?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a transition based on css classes to attach.
|
|
38
|
+
*
|
|
39
|
+
* The config includes the classes that will be attached / removed depending on the transition state.
|
|
40
|
+
* `animationPendingClasses` are the classes attached when the transition is in a pending state
|
|
41
|
+
* `animationPendingShowClasses` and `animationPendingHideClasses` are attached when transitioning towards one direction
|
|
42
|
+
* `showClasses` and `hideClasses` are attached when the transition has reached the show or hide state respectively
|
|
43
|
+
*
|
|
44
|
+
* @param config - the transition config
|
|
45
|
+
* @returns the simple class transition
|
|
46
|
+
*/
|
|
47
|
+
export declare const createSimpleClassTransition: (config: SimpleClassTransitionConfig) => TransitionFn;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createCSSTransition } from "./cssTransitions.js";
|
|
2
|
+
import { x as removeClasses, y as addClasses, z as reflow } from "../../directive-Bsreu2z1.js";
|
|
3
|
+
const createSimpleClassTransition = (config) => {
|
|
4
|
+
const {
|
|
5
|
+
animationPendingClasses,
|
|
6
|
+
animationPendingShowClasses,
|
|
7
|
+
animationPendingHideClasses,
|
|
8
|
+
showClasses,
|
|
9
|
+
hideClasses
|
|
10
|
+
} = config;
|
|
11
|
+
return createCSSTransition((element, direction, animated, context) => {
|
|
12
|
+
removeClasses(element, showClasses);
|
|
13
|
+
removeClasses(element, hideClasses);
|
|
14
|
+
if (animated) {
|
|
15
|
+
removeClasses(element, direction === "show" ? animationPendingHideClasses : animationPendingShowClasses);
|
|
16
|
+
if (!context.started) {
|
|
17
|
+
context.started = true;
|
|
18
|
+
const classes = direction === "show" ? hideClasses : showClasses;
|
|
19
|
+
addClasses(element, classes);
|
|
20
|
+
reflow(element);
|
|
21
|
+
removeClasses(element, classes);
|
|
22
|
+
}
|
|
23
|
+
addClasses(element, animationPendingClasses);
|
|
24
|
+
reflow(element);
|
|
25
|
+
addClasses(element, direction === "show" ? animationPendingShowClasses : animationPendingHideClasses);
|
|
26
|
+
}
|
|
27
|
+
return () => {
|
|
28
|
+
removeClasses(element, animationPendingClasses);
|
|
29
|
+
removeClasses(element, animationPendingShowClasses);
|
|
30
|
+
removeClasses(element, animationPendingHideClasses);
|
|
31
|
+
addClasses(element, direction === "show" ? showClasses : hideClasses);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
createSimpleClassTransition
|
|
37
|
+
};
|