@design-factory/core 21.1.0 → 22.0.0-next.1
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-D9ba0XYq.js → accordion-DUFLBQkV.js} +90 -28
- package/alert-Db6cG6JE.js +125 -0
- package/{collapse-Bn8iHKrd.js → collapse-D8Jo56k9.js} +2 -2
- package/{common-DFyZvkII.js → common-CP4amR0Z.js} +2 -2
- package/components/accordion/accordion.d.ts +80 -22
- package/components/accordion/index.js +1 -1
- package/components/alert/alert.d.ts +77 -8
- package/components/alert/common.d.ts +9 -9
- package/components/alert/index.js +2 -3
- package/components/carousel/index.js +2 -2
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +13 -0
- package/components/drawer/index.js +1 -1
- package/components/dropdown/dropdown.d.ts +110 -0
- package/components/dropdown/index.d.ts +1 -0
- package/components/dropdown/index.js +5 -0
- package/components/modal/index.js +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.js +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +23 -4
- package/components/toast/index.js +1 -1
- package/components/tooltip/index.d.ts +1 -0
- package/components/tooltip/index.js +174 -0
- package/components/tooltip/tooltip.d.ts +63 -0
- package/components/tree/index.js +1 -1
- package/{directive-CNNSo5Yn.js → directive-CMT2vEDg.js} +7 -4
- package/{drawer-CoBXUPyv.js → drawer-D4xSbhcT.js} +19 -5
- package/dropdown-Bjj2ql6d.js +246 -0
- package/index.d.ts +3 -1
- package/index.js +45 -39
- package/isFocusable-C2iRr0zh.js +72 -0
- package/{modal-BH9nrwVz.js → modal-CQWh2Sm5.js} +3 -3
- package/package.json +1 -1
- package/{pagination-BQWusWXN.js → pagination-DIRcpdRE.js} +2 -2
- package/{progressbar-S1pNn5rM.js → progressbar-Bth8r3Qu.js} +2 -2
- package/{promise-D-RZVPuv.js → promise-CkIc0KKt.js} +3 -3
- package/{rating-DWgGgwk3.js → rating-DLsgFSyB.js} +2 -2
- package/services/extendWidget.d.ts +1 -1
- package/services/focusElement.js +2 -2
- package/services/focustrack.js +2 -2
- package/services/matchMedia.js +1 -1
- package/services/mousetrack.d.ts +34 -0
- package/services/mousetrack.js +41 -0
- package/services/navManager.js +2 -2
- package/services/pointerdownPosition.js +1 -1
- package/services/portal.js +1 -1
- package/services/positioning.d.ts +101 -0
- package/services/positioning.js +104 -0
- package/services/resizeObserver.js +1 -1
- package/services/siblingsInert.js +1 -1
- package/services/transitions/baseTransitions.js +8 -8
- package/services/transitions/collapse.d.ts +4 -0
- package/services/transitions/collapse.js +23 -19
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-Br_Qiopx.js → slider-tH5g55yQ.js} +132 -97
- package/{toaster-BUBzFeJM.js → toaster-BS9qeRLF.js} +3 -3
- package/{tree-vD7ZkV8Z.js → tree-DW6iLxdw.js} +2 -2
- package/types.d.ts +8 -1
- package/utils/debounceSignal.d.ts +11 -0
- package/utils/debounceSignal.js +18 -0
- package/utils/directive.js +1 -1
- package/utils/edgeState.d.ts +23 -0
- package/utils/edgeState.js +43 -0
- package/utils/internal/isFocusable.d.ts +40 -0
- package/utils/stores.d.ts +2 -16
- package/utils/stores.js +5 -24
- package/utils/writables.d.ts +27 -13
- package/utils/writables.js +12 -11
- package/{writables-DYGjj5T3.js → writables-_7BriMb2.js} +37 -12
- package/accordion-B0vs8JWM.cjs +0 -314
- package/alert-AhaliJ17.cjs +0 -9
- package/alert-Cb9FhbFQ.js +0 -10
- package/collapse-BnWw4Hnc.cjs +0 -94
- package/common-B5jS-Ih_.cjs +0 -73
- package/components/accordion/index.cjs +0 -7
- package/components/alert/index.cjs +0 -5
- package/components/carousel/index.cjs +0 -292
- package/components/collapse/index.cjs +0 -5
- package/components/drawer/index.cjs +0 -5
- package/components/modal/index.cjs +0 -8
- package/components/pagination/index.cjs +0 -5
- package/components/progressbar/index.cjs +0 -5
- package/components/rating/index.cjs +0 -5
- package/components/slider/index.cjs +0 -5
- package/components/toast/index.cjs +0 -7
- package/components/tree/index.cjs +0 -5
- package/config.cjs +0 -36
- package/directive-DyTodNPd.cjs +0 -523
- package/drawer-Ca_ktkEs.cjs +0 -328
- package/index.cjs +0 -134
- package/isFocusable-Ckwus82R.js +0 -32
- package/isFocusable-DfzDLeAN.cjs +0 -31
- package/modal-Dxdw2Pkv.cjs +0 -252
- package/pagination-BLVa1UsZ.cjs +0 -254
- package/progressbar-RopgvVeA.cjs +0 -86
- package/promise-CxCD3NYv.cjs +0 -118
- package/rating-DZ3OQgtt.cjs +0 -183
- package/scrollbars-f651ntzz.cjs +0 -33
- package/services/extendWidget.cjs +0 -41
- package/services/floatingUI.cjs +0 -111
- package/services/floatingUI.d.ts +0 -76
- package/services/floatingUI.js +0 -111
- package/services/focusElement.cjs +0 -46
- package/services/focustrack.cjs +0 -47
- package/services/hash.cjs +0 -15
- package/services/intersection.cjs +0 -53
- package/services/matchMedia.cjs +0 -14
- package/services/navManager.cjs +0 -166
- package/services/pointerdownPosition.cjs +0 -60
- package/services/portal.cjs +0 -42
- package/services/resizeObserver.cjs +0 -54
- package/services/siblingsInert.cjs +0 -44
- package/services/transitions/baseTransitions.cjs +0 -186
- package/services/transitions/collapse.cjs +0 -40
- package/services/transitions/cssTransitions.cjs +0 -32
- package/services/transitions/simpleClassTransition.cjs +0 -37
- package/slider-pgDq1V5r.cjs +0 -807
- package/textDirection-zqcZ5-eK.cjs +0 -3
- package/toaster-Dlube4Ya.cjs +0 -161
- package/tree-Chcy4ulJ.cjs +0 -228
- package/types.cjs +0 -6
- package/utils/directive.cjs +0 -28
- package/utils/func.cjs +0 -7
- package/utils/id.cjs +0 -5
- package/utils/stores.cjs +0 -172
- package/utils/widget.cjs +0 -8
- package/utils/writables.cjs +0 -16
- package/writables-Dt68gADJ.cjs +0 -102
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, writable, readable } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { INVALID_VALUE } from "./types.js";
|
|
3
|
-
import { g as createAttributesDirective } from "./directive-
|
|
4
|
-
import {
|
|
3
|
+
import { g as createAttributesDirective } from "./directive-CMT2vEDg.js";
|
|
4
|
+
import { k as typeString, f as typeFunction, d as typeBoolean, h as typeNumber, m as clamp, n as isNumber } from "./writables-_7BriMb2.js";
|
|
5
5
|
import { noop } from "./utils/func.js";
|
|
6
6
|
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
7
7
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
@@ -28,4 +28,4 @@ export type ExtendWidgetInterfaces<Interfaces, ExtraInterfaces> = Interfaces & E
|
|
|
28
28
|
* @param overrideDefaults - object overriding some default props of the widget to extend
|
|
29
29
|
* @returns widget factory with the extra props
|
|
30
30
|
*/
|
|
31
|
-
export declare const extendWidgetProps: <W extends Widget, ExtraProps extends object, ExtraDirectives extends object = object>(factory: WidgetFactory<W>, extraPropsDefaults: ExtraProps, extraPropsConfig?: ConfigValidator<ExtraProps>, overrideDefaults?: Partial<
|
|
31
|
+
export declare const extendWidgetProps: <W extends Widget, ExtraProps extends object, ExtraDirectives extends object = object>(factory: WidgetFactory<W>, extraPropsDefaults: ExtraProps, extraPropsConfig?: ConfigValidator<ExtraProps>, overrideDefaults?: Partial<WidgetProps<W>>) => WidgetFactory<ExtendWidgetProps<W, ExtraProps, ExtraDirectives>>;
|
package/services/focusElement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as browserDirective } from "../directive-
|
|
2
|
-
import { i as isFocusable } from "../isFocusable-
|
|
1
|
+
import { d as browserDirective } from "../directive-CMT2vEDg.js";
|
|
2
|
+
import { i as isFocusable } from "../isFocusable-C2iRr0zh.js";
|
|
3
3
|
const stack = [];
|
|
4
4
|
let stackProcessPlanned = false;
|
|
5
5
|
const processStack = () => {
|
package/services/focustrack.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { readable, computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { h as createBrowserStoreArrayDirective } from "../directive-
|
|
2
|
+
import { h as createBrowserStoreArrayDirective } from "../directive-CMT2vEDg.js";
|
|
3
3
|
import { BROWSER } from "esm-env";
|
|
4
4
|
const evtFocusIn = "focusin";
|
|
5
5
|
const evtFocusOut = "focusout";
|
|
6
6
|
const activeElement$ = !BROWSER ? readable(null) : readable(null, {
|
|
7
7
|
onUse({ set }) {
|
|
8
8
|
function setActiveElement() {
|
|
9
|
-
set(document.activeElement);
|
|
9
|
+
set(document.hasFocus() ? document.activeElement : null);
|
|
10
10
|
}
|
|
11
11
|
setActiveElement();
|
|
12
12
|
const container = document.documentElement;
|
package/services/matchMedia.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readable } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { BROWSER } from "esm-env";
|
|
3
|
-
import { w as addEvent } from "../directive-
|
|
3
|
+
import { w as addEvent } from "../directive-CMT2vEDg.js";
|
|
4
4
|
import { false$ } from "../utils/stores.js";
|
|
5
5
|
const createMatchMedia = (query) => BROWSER ? readable(false, {
|
|
6
6
|
onUse({ set }) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
2
|
+
import type { Directive } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a mouse tracking service that monitors whether the mouse is inside
|
|
5
|
+
* one or more DOM elements.
|
|
6
|
+
*/
|
|
7
|
+
export interface HasMouseInside {
|
|
8
|
+
/**
|
|
9
|
+
* A directive to apply to DOM elements that should be tracked.
|
|
10
|
+
* When applied to an element, it listens for `mouseenter` and `mouseleave` events
|
|
11
|
+
* and updates the internal tracking state accordingly.
|
|
12
|
+
* The directive can be applied to multiple elements simultaneously.
|
|
13
|
+
*/
|
|
14
|
+
directive: Directive;
|
|
15
|
+
/**
|
|
16
|
+
* A readable signal that emits `true` when the mouse is inside any of the tracked elements,
|
|
17
|
+
* and `false` otherwise.
|
|
18
|
+
*/
|
|
19
|
+
hasMouseInside$: ReadableSignal<boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a mouse tracking service that monitors whether the mouse is inside
|
|
23
|
+
* one or more DOM elements.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* The returned {@link HasMouseInside.directive | directive} can be applied to multiple DOM elements.
|
|
27
|
+
* The {@link HasMouseInside.hasMouseInside$ | hasMouseInside$} signal aggregates the mouse state
|
|
28
|
+
* across all registered elements and returns `true` if the mouse is inside any of them.
|
|
29
|
+
*
|
|
30
|
+
* In a non-browser environment (SSR), the directive is a no-op and the signal always returns `false`.
|
|
31
|
+
*
|
|
32
|
+
* @returns A {@link HasMouseInside} object containing the directive and the reactive signal.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createHasMouseInside(): HasMouseInside;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { computed, writable } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { u as registrationArray, d as browserDirective } from "../directive-CMT2vEDg.js";
|
|
3
|
+
const evtMouseEnter = "mouseenter";
|
|
4
|
+
const evtMouseLeave = "mouseleave";
|
|
5
|
+
function createHasMouseInside() {
|
|
6
|
+
const mouseInsideSignals$ = registrationArray();
|
|
7
|
+
const directive = browserDirective((element) => {
|
|
8
|
+
const mouseInside$ = writable(false);
|
|
9
|
+
const unregister = mouseInsideSignals$.register(mouseInside$);
|
|
10
|
+
function onMouseEnter() {
|
|
11
|
+
mouseInside$.set(true);
|
|
12
|
+
}
|
|
13
|
+
function onMouseLeave() {
|
|
14
|
+
mouseInside$.set(false);
|
|
15
|
+
}
|
|
16
|
+
element.addEventListener(evtMouseEnter, onMouseEnter);
|
|
17
|
+
element.addEventListener(evtMouseLeave, onMouseLeave);
|
|
18
|
+
return {
|
|
19
|
+
destroy() {
|
|
20
|
+
element.removeEventListener(evtMouseEnter, onMouseEnter);
|
|
21
|
+
element.removeEventListener(evtMouseLeave, onMouseLeave);
|
|
22
|
+
unregister();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
const hasMouseInside$ = computed(() => {
|
|
27
|
+
for (const mouseInside$ of mouseInsideSignals$()) {
|
|
28
|
+
if (mouseInside$()) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
directive,
|
|
36
|
+
hasMouseInside$
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
createHasMouseInside
|
|
41
|
+
};
|
package/services/navManager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writable, computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { u as registrationArray, A as computeCommonAncestor, d as browserDirective } from "../directive-
|
|
3
|
-
import { i as isFocusable } from "../isFocusable-
|
|
2
|
+
import { u as registrationArray, A as computeCommonAncestor, d as browserDirective } from "../directive-CMT2vEDg.js";
|
|
3
|
+
import { i as isFocusable } from "../isFocusable-C2iRr0zh.js";
|
|
4
4
|
import { g as getTextDirection } from "../textDirection-cNgt24LJ.js";
|
|
5
5
|
const compareDomOrder = (element1, element2) => {
|
|
6
6
|
if (element1 === element2) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as browserDirective, w as addEvent } from "../directive-
|
|
1
|
+
import { d as browserDirective, w as addEvent } from "../directive-CMT2vEDg.js";
|
|
2
2
|
import { noop } from "../utils/func.js";
|
|
3
3
|
const createPointerdownPositionDirective = (onStart) => browserDirective((element, arg) => {
|
|
4
4
|
let activePointerId = null;
|
package/services/portal.js
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Strategy } from '@floating-ui/dom';
|
|
2
|
+
import type { Directive, PickRequired, PropsConfig, SSRHTMLElement, Widget, WritableWithDefaultOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the possible placement values for a floating element relative to its reference element.
|
|
5
|
+
*
|
|
6
|
+
* Standard placements (`top`, `bottom`, `left`, `right`) position the floating element on the corresponding side.
|
|
7
|
+
* Compound placements (e.g. `top-start`, `bottom-end`) add alignment along the cross axis.
|
|
8
|
+
*
|
|
9
|
+
* The `start` and `end` placements are RTL-aware: `start` resolves to `left` in LTR and `right` in RTL,
|
|
10
|
+
* while `end` resolves to `right` in LTR and `left` in RTL.
|
|
11
|
+
*/
|
|
12
|
+
export type Placement = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'start' | 'end' | 'start-start' | 'start-end' | 'end-start' | 'end-end';
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes a single placement value, ensuring it is one of the allowed placements defined in the `Placement` type.
|
|
15
|
+
*/
|
|
16
|
+
export declare const typePlacement: PickRequired<WritableWithDefaultOptions<Placement>, 'normalizeValue'>;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes an array of placements, allowing the input to be either a space-separated string or an array of strings.
|
|
19
|
+
*/
|
|
20
|
+
export declare const typePlacementArray: PickRequired<WritableWithDefaultOptions<Placement[]>, 'normalizeValue' | 'equal'>;
|
|
21
|
+
/**
|
|
22
|
+
* Interface representing the properties for configuring the positioning service.
|
|
23
|
+
*/
|
|
24
|
+
export interface PositioningProps {
|
|
25
|
+
/**
|
|
26
|
+
* List of placements, in order of preference.
|
|
27
|
+
* The first placement is used as the primary position, and the remaining ones serve as fallbacks
|
|
28
|
+
* when the primary placement does not fit within the available space.
|
|
29
|
+
*
|
|
30
|
+
* Placements starting with `start` or `end` are automatically converted to `left`/`right`
|
|
31
|
+
* based on the text direction (LTR or RTL) of the reference element.
|
|
32
|
+
*/
|
|
33
|
+
placement: Placement[];
|
|
34
|
+
/**
|
|
35
|
+
* The distance in pixels between the reference and floating elements. This offset is applied along the main axis of the placement.
|
|
36
|
+
* For example, if the placement is `top`, the offset will be applied vertically, creating space between the top of the reference element and the bottom of the floating element.
|
|
37
|
+
*/
|
|
38
|
+
offset?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The CSS `position` strategy used for the floating element.
|
|
41
|
+
* - `'fixed'`: the floating element uses `position: fixed`.
|
|
42
|
+
* - `'absolute'`: the floating element uses `position: absolute`.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue `'fixed'`
|
|
45
|
+
*/
|
|
46
|
+
strategy?: Strategy;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents the state of the positioning service.
|
|
50
|
+
*/
|
|
51
|
+
export interface PositioningState {
|
|
52
|
+
/**
|
|
53
|
+
* The final chosen placement of the floating element, after evaluating available space
|
|
54
|
+
* and applying the flip middleware. Undefined until both reference and floating elements are attached.
|
|
55
|
+
*/
|
|
56
|
+
placement: Placement | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Indicates whether the reference element is hidden (clipped).
|
|
59
|
+
* The floating element should be consequently hidden as well in this case.
|
|
60
|
+
*/
|
|
61
|
+
referenceHidden: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Interface representing the directives used by the positioning service.
|
|
65
|
+
*/
|
|
66
|
+
export interface PositioningDirectives {
|
|
67
|
+
/**
|
|
68
|
+
* Directive to attach to the reference element.
|
|
69
|
+
* The reference element serves as the anchor from which the floating element is positioned.
|
|
70
|
+
* It is also used to determine the text direction (LTR/RTL) for resolving `start`/`end` placements.
|
|
71
|
+
*/
|
|
72
|
+
referenceDirective: Directive<void, SSRHTMLElement>;
|
|
73
|
+
/**
|
|
74
|
+
* Directive to attach to the floating element.
|
|
75
|
+
* The floating element is the one whose position is computed relative to the reference element.
|
|
76
|
+
* Its `position`, `top`, and `left` CSS properties are automatically set
|
|
77
|
+
* (`position` matches the configured `strategy`, defaulting to `'fixed'`),
|
|
78
|
+
* so consumers should not override `position` from their own stylesheets.
|
|
79
|
+
*/
|
|
80
|
+
floatingDirective: Directive<void, SSRHTMLElement>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Represents the type returned by the {@link createPositioning} function.
|
|
84
|
+
*
|
|
85
|
+
* This type defines the structure and behavior of the positioning widget.
|
|
86
|
+
*/
|
|
87
|
+
export type Positioning = Widget<PositioningProps, PositioningState, object, PositioningDirectives>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a positioning service that manages the placement of a floating element relative to a reference element.
|
|
90
|
+
*
|
|
91
|
+
* This service wraps Floating UI and provides RTL-aware placement resolution. Placements prefixed with `start` or `end`
|
|
92
|
+
* are automatically converted to `left` or `right` based on the text direction of the reference element.
|
|
93
|
+
* The flip middleware is used to fall back to alternative placements when the preferred one does not fit.
|
|
94
|
+
*
|
|
95
|
+
* The returned service includes the patch method to update properties, stores to track state, and directives to apply
|
|
96
|
+
* to the reference, floating, and arrow DOM elements.
|
|
97
|
+
*
|
|
98
|
+
* @param propsConfig - the props config for the positioning service
|
|
99
|
+
* @returns the positioning service
|
|
100
|
+
*/
|
|
101
|
+
export declare const createPositioning: (propsConfig?: PropsConfig<PositioningProps>) => Positioning;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { computed, derived } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { hide, offset, flip, autoUpdate, computePosition } from "@floating-ui/dom";
|
|
3
|
+
import { i as createBrowserStoreDirective, s as mergeDirectives, g as createAttributesDirective } from "../directive-CMT2vEDg.js";
|
|
4
|
+
import { a as promiseStoreToValueStore } from "../promise-CkIc0KKt.js";
|
|
5
|
+
import { g as getTextDirection } from "../textDirection-cNgt24LJ.js";
|
|
6
|
+
import { writablesForProps, stateStores } from "../utils/stores.js";
|
|
7
|
+
import { c as createTypeEnum, a as createTypeStringSpacedArray } from "../writables-_7BriMb2.js";
|
|
8
|
+
const typePlacement = createTypeEnum([
|
|
9
|
+
"top",
|
|
10
|
+
"bottom",
|
|
11
|
+
"left",
|
|
12
|
+
"right",
|
|
13
|
+
"top-start",
|
|
14
|
+
"top-end",
|
|
15
|
+
"bottom-start",
|
|
16
|
+
"bottom-end",
|
|
17
|
+
"left-start",
|
|
18
|
+
"left-end",
|
|
19
|
+
"right-start",
|
|
20
|
+
"right-end",
|
|
21
|
+
"start",
|
|
22
|
+
"end",
|
|
23
|
+
"start-start",
|
|
24
|
+
"start-end",
|
|
25
|
+
"end-start",
|
|
26
|
+
"end-end"
|
|
27
|
+
]);
|
|
28
|
+
const typePlacementArray = createTypeStringSpacedArray(typePlacement.normalizeValue);
|
|
29
|
+
const defaultConfig = {
|
|
30
|
+
placement: ["top"],
|
|
31
|
+
offset: 4,
|
|
32
|
+
strategy: "fixed"
|
|
33
|
+
};
|
|
34
|
+
const createPositioning = (propsConfig) => {
|
|
35
|
+
const [{ placement$: placementProp$, offset$, strategy$ }, patch] = writablesForProps(defaultConfig, propsConfig);
|
|
36
|
+
const { directive: referenceDirective, element$: referenceElement$ } = createBrowserStoreDirective();
|
|
37
|
+
const { directive: floatingDirective, element$: floatingElement$ } = createBrowserStoreDirective();
|
|
38
|
+
const isRtl$ = computed(() => {
|
|
39
|
+
const referenceElement = referenceElement$();
|
|
40
|
+
return referenceElement ? getTextDirection(referenceElement) === "rtl" : false;
|
|
41
|
+
});
|
|
42
|
+
const placementsArray$ = computed(
|
|
43
|
+
() => placementProp$().map((p) => {
|
|
44
|
+
return p.replace(/^(start|end)\b/, (match) => {
|
|
45
|
+
if (match === "start") {
|
|
46
|
+
return isRtl$() ? "right" : "left";
|
|
47
|
+
} else {
|
|
48
|
+
return isRtl$() ? "left" : "right";
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
const computePositionOptions$ = computed(() => {
|
|
54
|
+
const placements = placementsArray$();
|
|
55
|
+
return {
|
|
56
|
+
placement: placements[0],
|
|
57
|
+
strategy: strategy$(),
|
|
58
|
+
middleware: [hide(), offset({ mainAxis: offset$() }), flip({ fallbackPlacements: placements.slice(1) })]
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const promisePosition$ = derived(
|
|
62
|
+
[floatingElement$, referenceElement$, computePositionOptions$],
|
|
63
|
+
([floatingElement, referenceElement, computePositionOptions], set) => {
|
|
64
|
+
if (floatingElement && referenceElement) {
|
|
65
|
+
const clean = autoUpdate(referenceElement, floatingElement, () => {
|
|
66
|
+
set(computePosition(referenceElement, floatingElement, computePositionOptions));
|
|
67
|
+
});
|
|
68
|
+
return () => {
|
|
69
|
+
set(null);
|
|
70
|
+
clean();
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
},
|
|
75
|
+
null
|
|
76
|
+
);
|
|
77
|
+
const position$ = promiseStoreToValueStore(promisePosition$, null);
|
|
78
|
+
const placement$ = computed(() => position$()?.placement);
|
|
79
|
+
const referenceHidden$ = computed(() => position$()?.middlewareData.hide?.referenceHidden ?? false);
|
|
80
|
+
const floatingStyleDirective = createAttributesDirective(() => ({
|
|
81
|
+
styles: {
|
|
82
|
+
position: strategy$,
|
|
83
|
+
left: computed(() => `${position$()?.x ?? 0}px`),
|
|
84
|
+
top: computed(() => `${position$()?.y ?? 0}px`)
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
return {
|
|
88
|
+
patch,
|
|
89
|
+
...stateStores({
|
|
90
|
+
placement$,
|
|
91
|
+
referenceHidden$
|
|
92
|
+
}),
|
|
93
|
+
directives: {
|
|
94
|
+
referenceDirective,
|
|
95
|
+
floatingDirective: mergeDirectives(floatingDirective, floatingStyleDirective)
|
|
96
|
+
},
|
|
97
|
+
api: {}
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
createPositioning,
|
|
102
|
+
typePlacement,
|
|
103
|
+
typePlacementArray
|
|
104
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { derived } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { h as createBrowserStoreArrayDirective, d as browserDirective } from "../directive-
|
|
2
|
+
import { h as createBrowserStoreArrayDirective, d as browserDirective } from "../directive-CMT2vEDg.js";
|
|
3
3
|
import { noop } from "../utils/func.js";
|
|
4
4
|
const createResizeObserverMap = () => {
|
|
5
5
|
const { elements$, directive } = createBrowserStoreArrayDirective();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { j as createConditionalBrowserStoreArrayDirective, s as mergeDirectives, o as directiveSubscribe } from "../directive-
|
|
2
|
+
import { j as createConditionalBrowserStoreArrayDirective, s as mergeDirectives, o as directiveSubscribe } from "../directive-CMT2vEDg.js";
|
|
3
3
|
import { noop } from "../utils/func.js";
|
|
4
4
|
const ignoreInertAttributeName = "data-agnos-ignore-inert";
|
|
5
5
|
const applyInertToSiblingsRecursively = (element) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { e as typeBooleanOrNull, f as typeFunction, d as typeBoolean } from "../../writables-_7BriMb2.js";
|
|
3
|
+
import { b as promiseWithResolve } from "../../promise-CkIc0KKt.js";
|
|
4
4
|
import { noop } from "../../utils/func.js";
|
|
5
|
-
import { writablesForProps,
|
|
6
|
-
import { m as createStoreDirective, s as mergeDirectives, o as directiveSubscribe } from "../../directive-
|
|
5
|
+
import { writablesForProps, bindableProp, stateStores } from "../../utils/stores.js";
|
|
6
|
+
import { m as createStoreDirective, s as mergeDirectives, o as directiveSubscribe } from "../../directive-CMT2vEDg.js";
|
|
7
7
|
const neverEndingPromise = new Promise(noop);
|
|
8
8
|
const noAnimation = (element, direction) => {
|
|
9
9
|
element.style.display = direction === "show" ? "" : "none";
|
|
@@ -44,7 +44,7 @@ const createTransition = (config) => {
|
|
|
44
44
|
] = writablesForProps(defaultValues, config, configValidator);
|
|
45
45
|
const { element$, directive: storeDirective } = createStoreDirective();
|
|
46
46
|
const elementPresent$ = computed(() => !!element$());
|
|
47
|
-
const visible$ =
|
|
47
|
+
const visible$ = bindableProp(requestedVisible$, onVisibleChange$);
|
|
48
48
|
const currentTransition$ = writable(
|
|
49
49
|
null
|
|
50
50
|
);
|
|
@@ -91,7 +91,7 @@ const createTransition = (config) => {
|
|
|
91
91
|
const effectiveAnimation$ = computed(() => initDone$() ? animated$() : animatedOnInit$());
|
|
92
92
|
const animationFromToggle$ = writable(null);
|
|
93
93
|
let previousElement;
|
|
94
|
-
let previousVisible =
|
|
94
|
+
let previousVisible = visible$();
|
|
95
95
|
let pendingTransition = null;
|
|
96
96
|
const visibleAction$ = derived(
|
|
97
97
|
[visible$, element$, effectiveAnimation$, animationFromToggle$, transition$, currentTransition$],
|
|
@@ -132,14 +132,14 @@ const createTransition = (config) => {
|
|
|
132
132
|
}
|
|
133
133
|
);
|
|
134
134
|
let lastToggle = {};
|
|
135
|
-
const toggle = async (visible = !
|
|
135
|
+
const toggle = async (visible = !visible$(), animated = effectiveAnimation$()) => {
|
|
136
136
|
const currentToggle = {};
|
|
137
137
|
lastToggle = currentToggle;
|
|
138
138
|
try {
|
|
139
139
|
await batch(() => {
|
|
140
140
|
try {
|
|
141
141
|
animationFromToggle$.set(animated);
|
|
142
|
-
|
|
142
|
+
visible$.set(visible);
|
|
143
143
|
return visibleAction$();
|
|
144
144
|
} finally {
|
|
145
145
|
animationFromToggle$.set(null);
|
|
@@ -3,6 +3,10 @@ import type { TransitionFn } from './baseTransitions';
|
|
|
3
3
|
* Represents the context for a collapsible element.
|
|
4
4
|
*/
|
|
5
5
|
export interface CollapseContext {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the previous transition using this context was interrupted.
|
|
8
|
+
*/
|
|
9
|
+
interrupted?: boolean;
|
|
6
10
|
/**
|
|
7
11
|
* the maximum size of the collapseable content.
|
|
8
12
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as isBrowserHTMLElement, x as removeClasses, y as addClasses, z as reflow } from "../../directive-
|
|
1
|
+
import { q as isBrowserHTMLElement, x as removeClasses, y as addClasses, z as reflow } from "../../directive-CMT2vEDg.js";
|
|
2
2
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
3
3
|
const createCollapseTransition = ({
|
|
4
4
|
dimension = "height",
|
|
@@ -7,25 +7,29 @@ const createCollapseTransition = ({
|
|
|
7
7
|
animationPendingClasses
|
|
8
8
|
} = {}) => createCSSTransition((element, direction, animated, context) => {
|
|
9
9
|
if (animated && isBrowserHTMLElement(element)) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const interrupted = context.interrupted;
|
|
11
|
+
if (!context.maxSize || !context.minSize) {
|
|
12
|
+
element.style[dimension] = "";
|
|
13
|
+
removeClasses(element, animationPendingClasses);
|
|
14
|
+
removeClasses(element, hideClasses);
|
|
15
|
+
addClasses(element, showClasses);
|
|
16
|
+
context.maxSize = element.getBoundingClientRect()[dimension] + "px";
|
|
17
|
+
removeClasses(element, animationPendingClasses);
|
|
18
|
+
removeClasses(element, showClasses);
|
|
19
|
+
addClasses(element, hideClasses);
|
|
20
|
+
context.minSize = element.getBoundingClientRect()[dimension] + "px";
|
|
21
|
+
removeClasses(element, showClasses);
|
|
22
|
+
removeClasses(element, hideClasses);
|
|
23
|
+
}
|
|
24
|
+
const values = direction === "show" ? [context.minSize, context.maxSize] : [context.maxSize, context.minSize];
|
|
25
|
+
if (!interrupted) {
|
|
26
|
+
element.style[dimension] = values[0];
|
|
27
|
+
reflow(element);
|
|
28
|
+
addClasses(element, animationPendingClasses);
|
|
29
|
+
reflow(element);
|
|
30
|
+
}
|
|
28
31
|
element.style[dimension] = values[1];
|
|
32
|
+
context.interrupted = true;
|
|
29
33
|
} else {
|
|
30
34
|
removeClasses(element, direction === "show" ? hideClasses : showClasses);
|
|
31
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { q as isBrowserHTMLElement } from "../../directive-
|
|
1
|
+
import { q as isBrowserHTMLElement } from "../../directive-CMT2vEDg.js";
|
|
2
2
|
import { noop } from "../../utils/func.js";
|
|
3
|
-
import {
|
|
3
|
+
import { c as promiseFromEvent, d as promiseFromTimeout } from "../../promise-CkIc0KKt.js";
|
|
4
4
|
function hasTransition(element) {
|
|
5
5
|
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
2
|
-
import { x as removeClasses, y as addClasses, z as reflow } from "../../directive-
|
|
2
|
+
import { x as removeClasses, y as addClasses, z as reflow } from "../../directive-CMT2vEDg.js";
|
|
3
3
|
const createSimpleClassTransition = (config) => {
|
|
4
4
|
const {
|
|
5
5
|
animationPendingClasses,
|