@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,16 @@
|
|
|
1
|
+
import type { Directive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the arguments for a portal directive.
|
|
4
|
+
*/
|
|
5
|
+
export type PortalDirectiveArg = {
|
|
6
|
+
container?: HTMLElement | null | undefined;
|
|
7
|
+
insertBefore?: HTMLElement | null | undefined;
|
|
8
|
+
} | null | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a portal directive, allowing to attach content to any element.
|
|
11
|
+
*
|
|
12
|
+
* @param content - the content of the portal
|
|
13
|
+
* @param newArg - {@link PortalDirectiveArg} args
|
|
14
|
+
* @returns the portal directive
|
|
15
|
+
*/
|
|
16
|
+
export declare const portal: Directive<PortalDirectiveArg>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { d as browserDirective } from "../directive-Bsreu2z1.js";
|
|
2
|
+
const portal = browserDirective(
|
|
3
|
+
(content, newArg) => {
|
|
4
|
+
let arg;
|
|
5
|
+
let replaceComment;
|
|
6
|
+
const removeReplaceComment = () => {
|
|
7
|
+
if (replaceComment) {
|
|
8
|
+
replaceComment.parentNode?.replaceChild(content, replaceComment);
|
|
9
|
+
replaceComment = null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const update = (newArg2) => {
|
|
13
|
+
if (newArg2 !== arg && (newArg2?.container !== arg?.container || newArg2?.insertBefore !== arg?.insertBefore)) {
|
|
14
|
+
arg = newArg2;
|
|
15
|
+
const container = arg?.container ?? arg?.insertBefore?.parentElement;
|
|
16
|
+
if (container) {
|
|
17
|
+
const insertBefore = arg?.insertBefore ?? null;
|
|
18
|
+
const moveNeeded = content.parentElement !== container || content.nextSibling !== insertBefore;
|
|
19
|
+
if (moveNeeded) {
|
|
20
|
+
if (!replaceComment) {
|
|
21
|
+
replaceComment = content.parentNode?.insertBefore(content.ownerDocument.createComment("portal"), content);
|
|
22
|
+
}
|
|
23
|
+
container.insertBefore(content, insertBefore);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
removeReplaceComment();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
update(newArg);
|
|
31
|
+
return {
|
|
32
|
+
update,
|
|
33
|
+
destroy: () => {
|
|
34
|
+
removeReplaceComment();
|
|
35
|
+
content.parentNode?.removeChild(content);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
export {
|
|
41
|
+
portal
|
|
42
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
+
const utils_directive = require("../directive-DCaXmRe_.cjs");
|
|
5
|
+
const utils_func = require("../utils/func.cjs");
|
|
6
|
+
const createResizeObserverMap = () => {
|
|
7
|
+
const { elements$, directive } = utils_directive.createBrowserStoreArrayDirective();
|
|
8
|
+
const dimensionsMap$ = tansu.derived(
|
|
9
|
+
elements$,
|
|
10
|
+
(elements, set) => {
|
|
11
|
+
const dimensionsMap = /* @__PURE__ */ new Map();
|
|
12
|
+
if (elements.length === 0) {
|
|
13
|
+
set(dimensionsMap);
|
|
14
|
+
return utils_func.noop;
|
|
15
|
+
}
|
|
16
|
+
const observer = new ResizeObserver((entries) => {
|
|
17
|
+
entries.forEach((entry) => dimensionsMap.set(entry.target, entry));
|
|
18
|
+
set(dimensionsMap);
|
|
19
|
+
});
|
|
20
|
+
elements.forEach((element) => observer.observe(element));
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
},
|
|
23
|
+
/* @__PURE__ */ new Map()
|
|
24
|
+
);
|
|
25
|
+
return { dimensionsMap$, directive };
|
|
26
|
+
};
|
|
27
|
+
const createResizeObserver = () => {
|
|
28
|
+
const { dimensionsMap$, directive: arrayDirective } = createResizeObserverMap();
|
|
29
|
+
let firstElement = null;
|
|
30
|
+
const directive = utils_directive.browserDirective((element) => {
|
|
31
|
+
if (firstElement === null) {
|
|
32
|
+
firstElement = element;
|
|
33
|
+
} else {
|
|
34
|
+
console.error(
|
|
35
|
+
"createResizeObserver directive can only be applied to a single element. Use createResizeObserverMap for multiple elements."
|
|
36
|
+
);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const result = arrayDirective(element);
|
|
40
|
+
if (!result) return;
|
|
41
|
+
const originalDestroy = result.destroy;
|
|
42
|
+
return {
|
|
43
|
+
...result,
|
|
44
|
+
destroy: () => {
|
|
45
|
+
firstElement = null;
|
|
46
|
+
originalDestroy?.();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const dimensions$ = tansu.derived(dimensionsMap$, (map) => firstElement ? map.get(firstElement) : void 0, void 0);
|
|
51
|
+
return { dimensions$, directive };
|
|
52
|
+
};
|
|
53
|
+
exports.createResizeObserver = createResizeObserver;
|
|
54
|
+
exports.createResizeObserverMap = createResizeObserverMap;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
2
|
+
import type { Directive, SSRHTMLElement } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a resize observer that can be applied to multiple elements
|
|
5
|
+
* @returns An object containing the store with the dimensions map of observed elements (ResizeObserverEntry), the directive to be applied to the html element to be observed
|
|
6
|
+
*/
|
|
7
|
+
export declare const createResizeObserverMap: () => {
|
|
8
|
+
dimensionsMap$: ReadableSignal<Map<HTMLElement, ResizeObserverEntry>>;
|
|
9
|
+
directive: Directive<void, SSRHTMLElement>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Create a resize observer object for a single element
|
|
13
|
+
* @returns An object containing the store with the dimensions of observed element (ResizeObserverEntry), the directive to be applied to the html element to be observed
|
|
14
|
+
*/
|
|
15
|
+
export declare const createResizeObserver: () => {
|
|
16
|
+
dimensions$: ReadableSignal<ResizeObserverEntry | undefined>;
|
|
17
|
+
directive: Directive<void, SSRHTMLElement>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { derived } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { h as createBrowserStoreArrayDirective, d as browserDirective } from "../directive-Bsreu2z1.js";
|
|
3
|
+
import { noop } from "../utils/func.js";
|
|
4
|
+
const createResizeObserverMap = () => {
|
|
5
|
+
const { elements$, directive } = createBrowserStoreArrayDirective();
|
|
6
|
+
const dimensionsMap$ = derived(
|
|
7
|
+
elements$,
|
|
8
|
+
(elements, set) => {
|
|
9
|
+
const dimensionsMap = /* @__PURE__ */ new Map();
|
|
10
|
+
if (elements.length === 0) {
|
|
11
|
+
set(dimensionsMap);
|
|
12
|
+
return noop;
|
|
13
|
+
}
|
|
14
|
+
const observer = new ResizeObserver((entries) => {
|
|
15
|
+
entries.forEach((entry) => dimensionsMap.set(entry.target, entry));
|
|
16
|
+
set(dimensionsMap);
|
|
17
|
+
});
|
|
18
|
+
elements.forEach((element) => observer.observe(element));
|
|
19
|
+
return () => observer.disconnect();
|
|
20
|
+
},
|
|
21
|
+
/* @__PURE__ */ new Map()
|
|
22
|
+
);
|
|
23
|
+
return { dimensionsMap$, directive };
|
|
24
|
+
};
|
|
25
|
+
const createResizeObserver = () => {
|
|
26
|
+
const { dimensionsMap$, directive: arrayDirective } = createResizeObserverMap();
|
|
27
|
+
let firstElement = null;
|
|
28
|
+
const directive = browserDirective((element) => {
|
|
29
|
+
if (firstElement === null) {
|
|
30
|
+
firstElement = element;
|
|
31
|
+
} else {
|
|
32
|
+
console.error(
|
|
33
|
+
"createResizeObserver directive can only be applied to a single element. Use createResizeObserverMap for multiple elements."
|
|
34
|
+
);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const result = arrayDirective(element);
|
|
38
|
+
if (!result) return;
|
|
39
|
+
const originalDestroy = result.destroy;
|
|
40
|
+
return {
|
|
41
|
+
...result,
|
|
42
|
+
destroy: () => {
|
|
43
|
+
firstElement = null;
|
|
44
|
+
originalDestroy?.();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const dimensions$ = derived(dimensionsMap$, (map) => firstElement ? map.get(firstElement) : void 0, void 0);
|
|
49
|
+
return { dimensions$, directive };
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
createResizeObserver,
|
|
53
|
+
createResizeObserverMap
|
|
54
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
+
const utils_directive = require("../directive-DCaXmRe_.cjs");
|
|
5
|
+
const utils_func = require("../utils/func.cjs");
|
|
6
|
+
const ignoreInertAttributeName = "data-agnos-ignore-inert";
|
|
7
|
+
const applyInertToSiblingsRecursively = (element) => {
|
|
8
|
+
const inertValues = /* @__PURE__ */ new Map();
|
|
9
|
+
const recursiveHelper = (element2) => {
|
|
10
|
+
const parent = element2.parentElement;
|
|
11
|
+
if (parent && element2 !== document.body) {
|
|
12
|
+
Array.from(parent.children).forEach((sibling) => {
|
|
13
|
+
if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
|
|
14
|
+
inertValues.set(sibling, sibling.hasAttribute("inert"));
|
|
15
|
+
sibling.toggleAttribute("inert", true);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
recursiveHelper(parent);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
recursiveHelper(element);
|
|
22
|
+
return () => inertValues.forEach((value, element2) => {
|
|
23
|
+
element2.toggleAttribute("inert", value);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
let internalRevert = utils_func.noop;
|
|
27
|
+
const setSiblingsInert = (element) => {
|
|
28
|
+
internalRevert();
|
|
29
|
+
internalRevert = element ? applyInertToSiblingsRecursively(element) : utils_func.noop;
|
|
30
|
+
};
|
|
31
|
+
const { directive: storeArrayDirective, elements$ } = utils_directive.createConditionalBrowserStoreArrayDirective();
|
|
32
|
+
const lastTrackedElement$ = tansu.computed(
|
|
33
|
+
() => {
|
|
34
|
+
const elements = elements$();
|
|
35
|
+
return elements[elements.length - 1];
|
|
36
|
+
},
|
|
37
|
+
{ equal: Object.is }
|
|
38
|
+
);
|
|
39
|
+
const updateInertState$ = tansu.computed(() => setSiblingsInert(lastTrackedElement$()));
|
|
40
|
+
const siblingsInert = utils_directive.mergeDirectives(
|
|
41
|
+
storeArrayDirective,
|
|
42
|
+
utils_directive.directiveSubscribe(updateInertState$)
|
|
43
|
+
);
|
|
44
|
+
exports.siblingsInert = siblingsInert;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Directive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Directive to manage focus trapping by setting the `inert` attribute on sibling elements.
|
|
4
|
+
* This is useful for modal dialogs or overlays where interaction should be limited to a specific subtree.
|
|
5
|
+
*
|
|
6
|
+
* - Recursively traverses up the DOM tree.
|
|
7
|
+
* - Sets `inert` on all siblings except the target element and `<script>` tags.
|
|
8
|
+
* - Use `data-agnos-ignore-inert` to avoid inert attribute for a specified element.
|
|
9
|
+
*
|
|
10
|
+
* Takes boolean or undefined as value:
|
|
11
|
+
* - `true` or `undefined`: Apply inert to siblings.
|
|
12
|
+
* - `false`: Do not apply inert to siblings.
|
|
13
|
+
*
|
|
14
|
+
* Automatically reverts when the target element changes or is removed.
|
|
15
|
+
*/
|
|
16
|
+
export declare const siblingsInert: Directive<boolean | undefined>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { j as createConditionalBrowserStoreArrayDirective, s as mergeDirectives, o as directiveSubscribe } from "../directive-Bsreu2z1.js";
|
|
3
|
+
import { noop } from "../utils/func.js";
|
|
4
|
+
const ignoreInertAttributeName = "data-agnos-ignore-inert";
|
|
5
|
+
const applyInertToSiblingsRecursively = (element) => {
|
|
6
|
+
const inertValues = /* @__PURE__ */ new Map();
|
|
7
|
+
const recursiveHelper = (element2) => {
|
|
8
|
+
const parent = element2.parentElement;
|
|
9
|
+
if (parent && element2 !== document.body) {
|
|
10
|
+
Array.from(parent.children).forEach((sibling) => {
|
|
11
|
+
if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
|
|
12
|
+
inertValues.set(sibling, sibling.hasAttribute("inert"));
|
|
13
|
+
sibling.toggleAttribute("inert", true);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
recursiveHelper(parent);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
recursiveHelper(element);
|
|
20
|
+
return () => inertValues.forEach((value, element2) => {
|
|
21
|
+
element2.toggleAttribute("inert", value);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
let internalRevert = noop;
|
|
25
|
+
const setSiblingsInert = (element) => {
|
|
26
|
+
internalRevert();
|
|
27
|
+
internalRevert = element ? applyInertToSiblingsRecursively(element) : noop;
|
|
28
|
+
};
|
|
29
|
+
const { directive: storeArrayDirective, elements$ } = createConditionalBrowserStoreArrayDirective();
|
|
30
|
+
const lastTrackedElement$ = computed(
|
|
31
|
+
() => {
|
|
32
|
+
const elements = elements$();
|
|
33
|
+
return elements[elements.length - 1];
|
|
34
|
+
},
|
|
35
|
+
{ equal: Object.is }
|
|
36
|
+
);
|
|
37
|
+
const updateInertState$ = computed(() => setSiblingsInert(lastTrackedElement$()));
|
|
38
|
+
const siblingsInert = mergeDirectives(
|
|
39
|
+
storeArrayDirective,
|
|
40
|
+
directiveSubscribe(updateInertState$)
|
|
41
|
+
);
|
|
42
|
+
export {
|
|
43
|
+
siblingsInert
|
|
44
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
+
const utils_writables = require("../../writables-Dt68gADJ.cjs");
|
|
5
|
+
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
|
+
const utils_func = require("../../utils/func.cjs");
|
|
7
|
+
const utils_stores = require("../../utils/stores.cjs");
|
|
8
|
+
const utils_directive = require("../../directive-DCaXmRe_.cjs");
|
|
9
|
+
const neverEndingPromise = new Promise(utils_func.noop);
|
|
10
|
+
const noAnimation = (element, direction) => {
|
|
11
|
+
element.style.display = direction === "show" ? "" : "none";
|
|
12
|
+
};
|
|
13
|
+
const defaultValues = {
|
|
14
|
+
animated: true,
|
|
15
|
+
animatedOnInit: false,
|
|
16
|
+
initDone: null,
|
|
17
|
+
visible: true,
|
|
18
|
+
transition: noAnimation,
|
|
19
|
+
onShown: utils_func.noop,
|
|
20
|
+
onHidden: utils_func.noop,
|
|
21
|
+
onVisibleChange: utils_func.noop
|
|
22
|
+
};
|
|
23
|
+
const configValidator = {
|
|
24
|
+
animated: utils_writables.typeBoolean,
|
|
25
|
+
animatedOnInit: utils_writables.typeBoolean,
|
|
26
|
+
visible: utils_writables.typeBoolean,
|
|
27
|
+
transition: utils_writables.typeFunction,
|
|
28
|
+
onShown: utils_writables.typeFunction,
|
|
29
|
+
onHidden: utils_writables.typeFunction,
|
|
30
|
+
onVisibleChange: utils_writables.typeFunction,
|
|
31
|
+
initDone: utils_writables.typeBooleanOrNull
|
|
32
|
+
};
|
|
33
|
+
const createTransition = (config) => {
|
|
34
|
+
const [
|
|
35
|
+
{
|
|
36
|
+
animated$,
|
|
37
|
+
initDone$,
|
|
38
|
+
visible$: requestedVisible$,
|
|
39
|
+
transition$,
|
|
40
|
+
onShown$,
|
|
41
|
+
onHidden$,
|
|
42
|
+
onVisibleChange$,
|
|
43
|
+
animatedOnInit$
|
|
44
|
+
},
|
|
45
|
+
patch
|
|
46
|
+
] = utils_stores.writablesForProps(defaultValues, config, configValidator);
|
|
47
|
+
const { element$, directive: storeDirective } = utils_directive.createStoreDirective();
|
|
48
|
+
const elementPresent$ = tansu.computed(() => !!element$());
|
|
49
|
+
const visible$ = utils_stores.bindableDerived(onVisibleChange$, [requestedVisible$], ([visible]) => visible);
|
|
50
|
+
const currentTransition$ = tansu.writable(
|
|
51
|
+
null
|
|
52
|
+
);
|
|
53
|
+
const stop = () => {
|
|
54
|
+
let context;
|
|
55
|
+
currentTransition$.update((currentTransition) => {
|
|
56
|
+
currentTransition?.abort.abort();
|
|
57
|
+
context = currentTransition?.context;
|
|
58
|
+
return null;
|
|
59
|
+
});
|
|
60
|
+
return context;
|
|
61
|
+
};
|
|
62
|
+
const runTransition = (visible, animated, element, transitionFn) => tansu.batch(() => {
|
|
63
|
+
const abort = new AbortController();
|
|
64
|
+
const signal = abort.signal;
|
|
65
|
+
const context = stop() ?? {};
|
|
66
|
+
const { promise: promise$1, resolve } = promise.promiseWithResolve();
|
|
67
|
+
const currentTransition = {
|
|
68
|
+
abort,
|
|
69
|
+
animated,
|
|
70
|
+
visible,
|
|
71
|
+
context,
|
|
72
|
+
element,
|
|
73
|
+
transitionFn,
|
|
74
|
+
promise: promise$1
|
|
75
|
+
};
|
|
76
|
+
currentTransition$.set(currentTransition);
|
|
77
|
+
resolve(
|
|
78
|
+
(async () => {
|
|
79
|
+
try {
|
|
80
|
+
await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
|
|
81
|
+
} finally {
|
|
82
|
+
if (signal.aborted) {
|
|
83
|
+
await neverEndingPromise;
|
|
84
|
+
} else {
|
|
85
|
+
currentTransition$.set(null);
|
|
86
|
+
(visible ? onShown$ : onHidden$)()?.();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})()
|
|
90
|
+
);
|
|
91
|
+
return currentTransition;
|
|
92
|
+
});
|
|
93
|
+
const effectiveAnimation$ = tansu.computed(() => initDone$() ? animated$() : animatedOnInit$());
|
|
94
|
+
const animationFromToggle$ = tansu.writable(null);
|
|
95
|
+
let previousElement;
|
|
96
|
+
let previousVisible = requestedVisible$();
|
|
97
|
+
let pendingTransition = null;
|
|
98
|
+
const visibleAction$ = tansu.derived(
|
|
99
|
+
[visible$, element$, effectiveAnimation$, animationFromToggle$, transition$, currentTransition$],
|
|
100
|
+
([visible, element, animated, animationFromToggle, transition, currentTransition]) => {
|
|
101
|
+
const elementChanged = previousElement !== element;
|
|
102
|
+
previousElement = element;
|
|
103
|
+
const visibleChanged = previousVisible !== visible;
|
|
104
|
+
previousVisible = visible;
|
|
105
|
+
if (element) {
|
|
106
|
+
if (initDone$() == null) {
|
|
107
|
+
initDone$.set(true);
|
|
108
|
+
}
|
|
109
|
+
const interruptAnimation = animationFromToggle != null && currentTransition && currentTransition.animated != animationFromToggle;
|
|
110
|
+
if (elementChanged || visibleChanged || interruptAnimation) {
|
|
111
|
+
if (visibleChanged || animationFromToggle != null) {
|
|
112
|
+
pendingTransition = null;
|
|
113
|
+
}
|
|
114
|
+
const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
|
|
115
|
+
currentTransition = runTransition(visible, animate, element, transition);
|
|
116
|
+
pendingTransition?.resolve(currentTransition.promise);
|
|
117
|
+
pendingTransition = null;
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
if (elementChanged) {
|
|
121
|
+
stop();
|
|
122
|
+
currentTransition = null;
|
|
123
|
+
}
|
|
124
|
+
if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
|
|
125
|
+
pendingTransition = visible && animationFromToggle != null ? {
|
|
126
|
+
// toggle was called to display the element, but the element is not yet in the DOM
|
|
127
|
+
// let's keep the animation setting from toggle and provide the promise for the end of toggle
|
|
128
|
+
animated: animationFromToggle,
|
|
129
|
+
...promise.promiseWithResolve()
|
|
130
|
+
} : null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return pendingTransition?.promise ?? currentTransition?.promise;
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
let lastToggle = {};
|
|
137
|
+
const toggle = async (visible = !requestedVisible$(), animated = effectiveAnimation$()) => {
|
|
138
|
+
const currentToggle = {};
|
|
139
|
+
lastToggle = currentToggle;
|
|
140
|
+
try {
|
|
141
|
+
await tansu.batch(() => {
|
|
142
|
+
try {
|
|
143
|
+
animationFromToggle$.set(animated);
|
|
144
|
+
requestedVisible$.set(visible);
|
|
145
|
+
return visibleAction$();
|
|
146
|
+
} finally {
|
|
147
|
+
animationFromToggle$.set(null);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} finally {
|
|
151
|
+
if (lastToggle !== currentToggle) {
|
|
152
|
+
await neverEndingPromise;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const transitioning$ = tansu.computed(() => {
|
|
157
|
+
if (elementPresent$()) {
|
|
158
|
+
void visibleAction$();
|
|
159
|
+
}
|
|
160
|
+
return !!currentTransition$();
|
|
161
|
+
});
|
|
162
|
+
const shown$ = tansu.computed(() => !transitioning$() && visible$() && elementPresent$());
|
|
163
|
+
const hidden$ = tansu.computed(() => !transitioning$() && !visible$());
|
|
164
|
+
const directive = utils_directive.mergeDirectives(storeDirective, utils_directive.directiveSubscribe(visibleAction$));
|
|
165
|
+
return {
|
|
166
|
+
...utils_stores.stateStores({
|
|
167
|
+
visible$,
|
|
168
|
+
element$,
|
|
169
|
+
elementPresent$,
|
|
170
|
+
transitioning$,
|
|
171
|
+
shown$,
|
|
172
|
+
hidden$
|
|
173
|
+
}),
|
|
174
|
+
patch,
|
|
175
|
+
directives: {
|
|
176
|
+
directive
|
|
177
|
+
},
|
|
178
|
+
api: {
|
|
179
|
+
show: toggle.bind(null, true),
|
|
180
|
+
hide: toggle.bind(null, false),
|
|
181
|
+
toggle
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
exports.createTransition = createTransition;
|
|
186
|
+
exports.noAnimation = noAnimation;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { Directive, PropsConfig, SSRHTMLElement, Widget } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Function that implements a transition.
|
|
4
|
+
*/
|
|
5
|
+
export type TransitionFn = (
|
|
6
|
+
/**
|
|
7
|
+
* Element on which the transition should be applied.
|
|
8
|
+
*/
|
|
9
|
+
element: SSRHTMLElement,
|
|
10
|
+
/**
|
|
11
|
+
* Whether the element should be shown or hidden.
|
|
12
|
+
*/
|
|
13
|
+
direction: 'show' | 'hide',
|
|
14
|
+
/**
|
|
15
|
+
* Whether the transition should be animated.
|
|
16
|
+
*/
|
|
17
|
+
animated: boolean,
|
|
18
|
+
/**
|
|
19
|
+
* Signal allowing to stop the transition while running.
|
|
20
|
+
*/
|
|
21
|
+
signal: AbortSignal,
|
|
22
|
+
/**
|
|
23
|
+
* Context of the current transition. It is reused between calls if the previous transition was stopped while running on the same element.
|
|
24
|
+
*/
|
|
25
|
+
context: object) => Promise<void> | void;
|
|
26
|
+
/**
|
|
27
|
+
* Properties for configuring a transition.
|
|
28
|
+
*/
|
|
29
|
+
export interface TransitionProps {
|
|
30
|
+
/**
|
|
31
|
+
* Transition to be called.
|
|
32
|
+
*/
|
|
33
|
+
transition: TransitionFn;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the element should be visible when the transition is completed.
|
|
36
|
+
*/
|
|
37
|
+
visible: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the transition should be animated.
|
|
40
|
+
*/
|
|
41
|
+
animated: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If the element is initially visible, whether the element should be animated when first displayed.
|
|
44
|
+
*/
|
|
45
|
+
animatedOnInit: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether initialization is finished. It determines which setting between {@link TransitionProps.animated}
|
|
48
|
+
* and {@link TransitionProps.animatedOnInit} is used to enable or disable animations.
|
|
49
|
+
* @remarks
|
|
50
|
+
* If it is `true`, initialization is considered finished, and {@link TransitionProps.animatedOnInit} is no longer used.
|
|
51
|
+
* Otherwise, initialization is considered unfinished and {@link TransitionProps.animatedOnInit} is used instead of {@link TransitionProps.animated}.
|
|
52
|
+
* If it is `null`, it will be set to `true` automatically when the directive is called with a DOM element.
|
|
53
|
+
* If it is `false`, it will not be updated automatically.
|
|
54
|
+
*/
|
|
55
|
+
initDone: boolean | null;
|
|
56
|
+
/**
|
|
57
|
+
* Function to be called when the transition is completed and the element is visible.
|
|
58
|
+
*/
|
|
59
|
+
onShown: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Function to be called when the transition is completed and the element is not visible.
|
|
62
|
+
*/
|
|
63
|
+
onHidden: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Function to be called when the visible property changes.
|
|
66
|
+
*
|
|
67
|
+
* @param visible - new value of the visible property
|
|
68
|
+
*/
|
|
69
|
+
onVisibleChange: (visible: boolean) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Transition state.
|
|
73
|
+
*/
|
|
74
|
+
export interface TransitionState {
|
|
75
|
+
/**
|
|
76
|
+
* Whether the element is visible or will be visible when the transition is completed.
|
|
77
|
+
*/
|
|
78
|
+
visible: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the element to be animated is present in the DOM.
|
|
81
|
+
*/
|
|
82
|
+
elementPresent: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Reference to the DOM element.
|
|
85
|
+
*/
|
|
86
|
+
element: HTMLElement | null;
|
|
87
|
+
/**
|
|
88
|
+
* Whether a transition is currently running.
|
|
89
|
+
*/
|
|
90
|
+
transitioning: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Equals: {@link TransitionState.visible | visible} && ! {@link TransitionState.transitioning | transitioning}
|
|
93
|
+
*/
|
|
94
|
+
shown: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Equals: ! {@link TransitionState.visible | visible} && ! {@link TransitionState.transitioning | transitioning}
|
|
97
|
+
*/
|
|
98
|
+
hidden: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Interface representing the API for managing transitions of an element.
|
|
102
|
+
*/
|
|
103
|
+
export interface TransitionApi {
|
|
104
|
+
/**
|
|
105
|
+
* Runs the transition to show the element. It is equivalent to {@link TransitionApi.toggle | toggle} with true as the first parameter.
|
|
106
|
+
*
|
|
107
|
+
* @param animated - whether the transition should be animated. If the parameter is not defined, the {@link TransitionProps.animated | animated } property is used.
|
|
108
|
+
*
|
|
109
|
+
* @returns A promise that is fulfilled when the transition is completed. If the transition is canceled, or if the same transition was
|
|
110
|
+
* already running, the promise never completes.
|
|
111
|
+
*/
|
|
112
|
+
show: (animated?: boolean) => Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Runs the transition to hide the element. It is equivalent to {@link TransitionApi.toggle | toggle} with false as the first parameter.
|
|
115
|
+
*
|
|
116
|
+
* @param animated - whether the transition should be animated. If the parameter is not defined, the {@link TransitionProps.animated | animated } property is used.
|
|
117
|
+
*
|
|
118
|
+
* @returns A promise that is fulfilled when the transition is completed. If the transition is canceled, or if the same transition was
|
|
119
|
+
* already running, the promise never completes.
|
|
120
|
+
*/
|
|
121
|
+
hide: (animated?: boolean) => Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Runs the transition to show or hide the element depending on the first parameter.
|
|
124
|
+
*
|
|
125
|
+
* @param visible - whether the element should be made visible or not. If the parameter is not defined, the opposite of the current {@link TransitionProps.visible | visible } property is used.
|
|
126
|
+
* @param animated - whether the transition should be animated. If the parameter is not defined, the {@link TransitionProps.animated | animated } property is used.
|
|
127
|
+
*
|
|
128
|
+
* @returns A promise that is fulfilled when the transition is completed. If the transition is canceled, or if the same transition was
|
|
129
|
+
* already running, the promise never completes.
|
|
130
|
+
*/
|
|
131
|
+
toggle: (visible?: boolean, animated?: boolean) => Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Interface representing transition directives.
|
|
135
|
+
*/
|
|
136
|
+
export interface TransitionDirectives {
|
|
137
|
+
/**
|
|
138
|
+
* the transition directive
|
|
139
|
+
*/
|
|
140
|
+
directive: Directive;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Represents a widget that handles transitions.
|
|
144
|
+
*
|
|
145
|
+
* @template TransitionProps - The properties required for the transition.
|
|
146
|
+
* @template TransitionState - The state management for the transition.
|
|
147
|
+
* @template TransitionApi - The API interface for the transition.
|
|
148
|
+
* @template TransitionDirectives - The directives used in the transition.
|
|
149
|
+
*/
|
|
150
|
+
export type TransitionWidget = Widget<TransitionProps, TransitionState, TransitionApi, TransitionDirectives>;
|
|
151
|
+
/**
|
|
152
|
+
* A transition to show / hide an element without any animated. It uses the HTML `display` attribute.
|
|
153
|
+
*
|
|
154
|
+
* @param element - the element to animate
|
|
155
|
+
* @param direction - the direction
|
|
156
|
+
*/
|
|
157
|
+
export declare const noAnimation: TransitionFn;
|
|
158
|
+
/**
|
|
159
|
+
* Create a transition widget.
|
|
160
|
+
*
|
|
161
|
+
* The widget will include a patch function, stores to track the animation states and a directive to apply the animation to an element.
|
|
162
|
+
*
|
|
163
|
+
* @param config - the props config of the transition
|
|
164
|
+
* @returns the transition widget
|
|
165
|
+
*/
|
|
166
|
+
export declare const createTransition: (config?: PropsConfig<TransitionProps>) => TransitionWidget;
|