v-float 0.2.1 → 0.4.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/README.md +189 -83
- package/dist/composables/interactions/index.d.ts +2 -1
- package/dist/composables/interactions/index.d.ts.map +1 -1
- package/dist/composables/interactions/polygon.d.ts +12 -2
- package/dist/composables/interactions/polygon.d.ts.map +1 -1
- package/dist/composables/interactions/use-click.d.ts +78 -10
- package/dist/composables/interactions/use-click.d.ts.map +1 -1
- package/dist/composables/interactions/use-client-point.d.ts +1 -1
- package/dist/composables/interactions/use-client-point.d.ts.map +1 -1
- package/dist/composables/interactions/use-escape-key.d.ts +24 -0
- package/dist/composables/interactions/use-escape-key.d.ts.map +1 -0
- package/dist/composables/interactions/use-focus.d.ts +28 -3
- package/dist/composables/interactions/use-focus.d.ts.map +1 -1
- package/dist/composables/interactions/use-hover.d.ts +21 -3
- package/dist/composables/interactions/use-hover.d.ts.map +1 -1
- package/dist/composables/interactions/utils/browser-detection.d.ts +23 -0
- package/dist/composables/interactions/utils/browser-detection.d.ts.map +1 -0
- package/dist/composables/interactions/utils/element-detection.d.ts +53 -0
- package/dist/composables/interactions/utils/element-detection.d.ts.map +1 -0
- package/dist/composables/interactions/utils/event-utils.d.ts +30 -0
- package/dist/composables/interactions/utils/event-utils.d.ts.map +1 -0
- package/dist/composables/interactions/utils/index.d.ts +11 -0
- package/dist/composables/interactions/utils/index.d.ts.map +1 -0
- package/dist/composables/interactions/utils/tree-context.d.ts +32 -0
- package/dist/composables/interactions/utils/tree-context.d.ts.map +1 -0
- package/dist/composables/middlewares/index.d.ts +0 -1
- package/dist/composables/middlewares/index.d.ts.map +1 -1
- package/dist/composables/use-arrow.d.ts +10 -3
- package/dist/composables/use-arrow.d.ts.map +1 -1
- package/dist/composables/use-floating-tree.d.ts +13 -13
- package/dist/composables/use-floating-tree.d.ts.map +1 -1
- package/dist/composables/use-floating.d.ts +7 -0
- package/dist/composables/use-floating.d.ts.map +1 -1
- package/dist/composables/use-tree.d.ts.map +1 -1
- package/dist/v-float.es.js +1343 -1176
- package/dist/v-float.umd.js +1 -1
- package/package.json +31 -24
- package/dist/composables/interactions/use-dismiss.d.ts +0 -68
- package/dist/composables/interactions/use-dismiss.d.ts.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Browser environment detection utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for detecting browser types, platforms, and
|
|
5
|
+
* environment-specific polyfills for focus-visible behavior.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the user agent is on a Mac.
|
|
9
|
+
* @returns True if running on macOS
|
|
10
|
+
*/
|
|
11
|
+
export declare function isMac(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the browser is Safari.
|
|
14
|
+
* @returns True if the browser is Safari
|
|
15
|
+
*/
|
|
16
|
+
export declare function isSafari(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A simple utility to check if an element matches `:focus-visible`.
|
|
19
|
+
* @param element - The element to check
|
|
20
|
+
* @returns True if the element matches :focus-visible
|
|
21
|
+
*/
|
|
22
|
+
export declare function matchesFocusVisible(element: Element): boolean;
|
|
23
|
+
//# sourceMappingURL=browser-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-detection.d.ts","sourceRoot":"","sources":["../../../../src/composables/interactions/utils/browser-detection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAGlC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG7D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { VirtualElement } from '@floating-ui/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the pointer type is mouse-like (mouse or pen).
|
|
4
|
+
* @param pointerType - The pointer type string.
|
|
5
|
+
* @param strict - If true, only considers "mouse".
|
|
6
|
+
* @returns True if the pointer type is mouse-like.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isMouseLikePointerType(pointerType: string | undefined, strict?: boolean): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the element is an input, textarea, or contenteditable element.
|
|
11
|
+
* @param element - The element to check.
|
|
12
|
+
* @returns True if the element is typeable.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isTypeableElement(element: Element | null): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the event target is a button-like element.
|
|
17
|
+
* @param event - The KeyboardEvent.
|
|
18
|
+
* @returns True if the target is a button.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isButtonTarget(event: KeyboardEvent): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the Space key press should be ignored for the given element.
|
|
23
|
+
* @param element - The element to check.
|
|
24
|
+
* @returns True if Space should be ignored.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSpaceIgnored(element: Element | null): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if the value is an HTML element.
|
|
29
|
+
* @param node - The value to check.
|
|
30
|
+
* @returns True if the value is an HTML element.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isHTMLElement(node: unknown | null): node is HTMLElement;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the value is a VirtualElement.
|
|
35
|
+
* @param el - The value to check.
|
|
36
|
+
* @returns True if the value is a VirtualElement.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isVirtualElement(el: unknown): el is VirtualElement;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if the event target is within the given element.
|
|
41
|
+
* @param event - The event to check.
|
|
42
|
+
* @param element - The element to check containment against.
|
|
43
|
+
* @returns True if the event target is within the element.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isEventTargetWithin(event: Event, element: Element | null | undefined): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a click event occurred on a scrollbar.
|
|
48
|
+
* @param event - The mouse event.
|
|
49
|
+
* @param target - The target HTML element.
|
|
50
|
+
* @returns True if the click was on a scrollbar.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isClickOnScrollbar(event: MouseEvent, target: HTMLElement): boolean;
|
|
53
|
+
//# sourceMappingURL=element-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-detection.d.ts","sourceRoot":"","sources":["../../../../src/composables/interactions/utils/element-detection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAIjG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAQlE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAS5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,IAAI,WAAW,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,cAAc,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAQ9F;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CA0BlF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Event handling and timing utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for event handling, timing operations,
|
|
5
|
+
* and DOM element containment checks.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Simple element containment wrapper.
|
|
9
|
+
* @param el - The container element
|
|
10
|
+
* @param target - The target element to check
|
|
11
|
+
* @returns True if the container contains the target
|
|
12
|
+
*/
|
|
13
|
+
export declare function contains(el: HTMLElement, target: Element | null): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Event target extraction utility.
|
|
16
|
+
* @param event - The mouse or touch event
|
|
17
|
+
* @returns The event target as an Element or null
|
|
18
|
+
*/
|
|
19
|
+
export declare function getTarget(event: MouseEvent | TouchEvent): Element | null;
|
|
20
|
+
/**
|
|
21
|
+
* Safe performance timing that handles environments without performance API.
|
|
22
|
+
* @returns Current timestamp in milliseconds
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCurrentTime(): number;
|
|
25
|
+
/**
|
|
26
|
+
* Centralized timeout management to prevent memory leaks.
|
|
27
|
+
* @param timeoutId - The timeout ID to clear
|
|
28
|
+
*/
|
|
29
|
+
export declare function clearTimeoutIfSet(timeoutId: number): void;
|
|
30
|
+
//# sourceMappingURL=event-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-utils.d.ts","sourceRoot":"","sources":["../../../../src/composables/interactions/utils/event-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,IAAI,CAExE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAIzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Centralized utility functions for interaction composables
|
|
3
|
+
*
|
|
4
|
+
* This module exports shared helper functions to eliminate code duplication
|
|
5
|
+
* across use-click, use-focus, use-hover, use-client-point, and polygon composables.
|
|
6
|
+
*/
|
|
7
|
+
export { isTreeNode, getContextFromParameter, isTargetWithinElement, findDescendantContainingTarget, } from './tree-context';
|
|
8
|
+
export { isMouseLikePointerType, isTypeableElement, isButtonTarget, isSpaceIgnored, isHTMLElement, isVirtualElement, isEventTargetWithin, isClickOnScrollbar, } from './element-detection';
|
|
9
|
+
export { isMac, isSafari, matchesFocusVisible, } from './browser-detection';
|
|
10
|
+
export { contains, getTarget, getCurrentTime, clearTimeoutIfSet, } from './event-utils';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/composables/interactions/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,KAAK,EACL,QAAQ,EACR,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,cAAc,EACd,iBAAiB,GAClB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FloatingContext } from '../..';
|
|
2
|
+
import { TreeNode } from '../../use-tree';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to determine if the context parameter is a TreeNode.
|
|
5
|
+
* @param context - The context parameter to check
|
|
6
|
+
* @returns True if the context is a TreeNode
|
|
7
|
+
*/
|
|
8
|
+
export declare function isTreeNode(context: FloatingContext | TreeNode<FloatingContext>): context is TreeNode<FloatingContext>;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts floating context and tree context from the parameter.
|
|
11
|
+
* @param context - Either a FloatingContext or TreeNode<FloatingContext>
|
|
12
|
+
* @returns Object containing both floating context and optional tree context
|
|
13
|
+
*/
|
|
14
|
+
export declare function getContextFromParameter(context: FloatingContext | TreeNode<FloatingContext>): {
|
|
15
|
+
floatingContext: FloatingContext;
|
|
16
|
+
treeContext: TreeNode<FloatingContext> | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a target node is within an anchor or floating element, handling VirtualElement.
|
|
20
|
+
* @param target - The target node to check
|
|
21
|
+
* @param element - The element to check containment against (can be VirtualElement or null)
|
|
22
|
+
* @returns True if the target is within the element
|
|
23
|
+
*/
|
|
24
|
+
export declare function isTargetWithinElement(target: Node, element: any): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Finds a descendant node that contains the target element.
|
|
27
|
+
* @param node - The parent node to search from
|
|
28
|
+
* @param target - The target element to find
|
|
29
|
+
* @returns The descendant node containing the target, or null
|
|
30
|
+
*/
|
|
31
|
+
export declare function findDescendantContainingTarget(node: TreeNode<FloatingContext>, target: Node): TreeNode<FloatingContext> | null;
|
|
32
|
+
//# sourceMappingURL=tree-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-context.d.ts","sourceRoot":"","sources":["../../../../src/composables/interactions/utils/tree-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,GACnD,OAAO,IAAI,QAAQ,CAAC,eAAe,CAAC,CAStC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,GAAG;IAC7F,eAAe,EAAE,eAAe,CAAA;IAChC,WAAW,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;CAC9C,CAWA;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAkBzE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,EAC/B,MAAM,EAAE,IAAI,GACX,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAgBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/middlewares/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Padding } from '@floating-ui/dom';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
3
|
import { FloatingContext } from './use-floating';
|
|
3
4
|
/**
|
|
4
5
|
* Return value of the useArrow composable
|
|
@@ -33,6 +34,10 @@ export interface UseArrowOptions {
|
|
|
33
34
|
* @default '-4px'
|
|
34
35
|
*/
|
|
35
36
|
offset?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Padding around arrow element
|
|
39
|
+
*/
|
|
40
|
+
padding?: Padding;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* Composable for computing arrow position styles for floating elements
|
|
@@ -40,14 +45,16 @@ export interface UseArrowOptions {
|
|
|
40
45
|
* This composable calculates the position and styles for an arrow element
|
|
41
46
|
* based on the placement and middleware data from a floating element.
|
|
42
47
|
*
|
|
48
|
+
* @param arrowEl - A ref to the arrow HTML element
|
|
43
49
|
* @param context - The floating context containing middleware data and placement information
|
|
44
50
|
* @param options - Optional configuration for the arrow, e.g., offset
|
|
45
51
|
* @returns Computed arrow positions and CSS styles
|
|
46
52
|
*
|
|
47
53
|
* @example
|
|
48
54
|
* ```ts
|
|
49
|
-
* const
|
|
55
|
+
* const arrowRef = ref<HTMLElement | null>(null)
|
|
56
|
+
* const { arrowStyles } = useArrow(arrowRef, floatingContext, { offset: "-10px" })
|
|
50
57
|
* ```
|
|
51
58
|
*/
|
|
52
|
-
export declare function useArrow(context: FloatingContext, options?: UseArrowOptions): UseArrowReturn;
|
|
59
|
+
export declare function useArrow(arrowEl: Ref<HTMLElement | null>, context: FloatingContext, options?: UseArrowOptions): UseArrowReturn;
|
|
53
60
|
//# sourceMappingURL=use-arrow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-arrow.d.ts","sourceRoot":"","sources":["../../src/composables/use-arrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"use-arrow.d.ts","sourceRoot":"","sources":["../../src/composables/use-arrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAMrD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAE3B;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAE3B;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EAChC,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAyDhB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { AnchorElement, FloatingContext, FloatingElement, UseFloatingOptions } from './use-floating';
|
|
2
3
|
import { TreeNode, TreeOptions } from './use-tree';
|
|
3
4
|
/**
|
|
4
5
|
* Configuration options for the floating tree
|
|
@@ -7,22 +8,15 @@ export interface FloatingTreeOptions extends TreeOptions {
|
|
|
7
8
|
}
|
|
8
9
|
export interface UseFloatingTreeReturn {
|
|
9
10
|
readonly nodeMap: Readonly<Map<string, TreeNode<FloatingContext>>>;
|
|
10
|
-
readonly root:
|
|
11
|
+
readonly root: TreeNode<FloatingContext>;
|
|
11
12
|
findNodeById: (nodeId: string) => TreeNode<FloatingContext> | null;
|
|
12
13
|
moveNode: (nodeId: string, newParentId: string | null) => boolean;
|
|
13
14
|
dispose: () => void;
|
|
14
|
-
addNode: (
|
|
15
|
+
addNode: (anchorEl: Ref<AnchorElement>, floatingEl: Ref<FloatingElement>, options?: UseFloatingOptions) => TreeNode<FloatingContext> | null;
|
|
15
16
|
removeNode: (nodeId: string, deleteStrategy?: "orphan" | "recursive") => boolean;
|
|
16
17
|
traverse: (mode: "dfs" | "bfs", startNode?: TreeNode<FloatingContext>) => TreeNode<FloatingContext>[];
|
|
17
|
-
/**
|
|
18
|
-
* Checks if a given node is the topmost open node in the tree hierarchy.
|
|
19
|
-
* A node is considered topmost if it's open and none of its ancestors are open.
|
|
20
|
-
*
|
|
21
|
-
* @param nodeId - The ID of the node to check.
|
|
22
|
-
* @returns True if the node is open and no ancestors are open, false otherwise.
|
|
23
|
-
*/
|
|
24
|
-
isTopmost: (nodeId: string) => boolean;
|
|
25
18
|
getAllOpenNodes: () => TreeNode<FloatingContext>[];
|
|
19
|
+
getTopmostOpenNode: () => TreeNode<FloatingContext> | null;
|
|
26
20
|
/**
|
|
27
21
|
* Executes a provided function once for each tree node that matches the specified relationship.
|
|
28
22
|
* This is a flexible iteration method that can target nodes based on their relationship to a target node.
|
|
@@ -41,8 +35,14 @@ export interface UseFloatingTreeReturn {
|
|
|
41
35
|
*/
|
|
42
36
|
type NodeRelationship = "ancestors-only" | "siblings-only" | "descendants-only" | "children-only" | "self-and-ancestors" | "self-and-children" | "self-and-descendants" | "self-and-siblings" | "self-ancestors-and-children" | "full-branch" | "all-except-branch";
|
|
43
37
|
/**
|
|
44
|
-
*
|
|
38
|
+
* Creates and manages a hierarchical tree of floating elements.
|
|
39
|
+
*
|
|
40
|
+
* @param anchorEl - The anchor element for the root floating context
|
|
41
|
+
* @param floatingEl - The floating element for the root floating context
|
|
42
|
+
* @param options - Options for the root floating context
|
|
43
|
+
* @param treeOptions - Options for tree behavior
|
|
44
|
+
* @returns UseFloatingTreeReturn with tree management methods and root context
|
|
45
45
|
*/
|
|
46
|
-
export declare function useFloatingTree(
|
|
46
|
+
export declare function useFloatingTree(anchorEl: Ref<AnchorElement>, floatingEl: Ref<FloatingElement>, options?: UseFloatingOptions, treeOptions?: FloatingTreeOptions): UseFloatingTreeReturn;
|
|
47
47
|
export {};
|
|
48
48
|
//# sourceMappingURL=use-floating-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-floating-tree.d.ts","sourceRoot":"","sources":["../../src/composables/use-floating-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"use-floating-tree.d.ts","sourceRoot":"","sources":["../../src/composables/use-floating-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAMlE;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;CAAG;AAE3D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;IAClE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAA;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;IAClE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAA;IACjE,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,EAAE,CACP,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,EAC5B,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,EAChC,OAAO,CAAC,EAAE,kBAAkB,KACzB,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;IACrC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,QAAQ,GAAG,WAAW,KAAK,OAAO,CAAA;IAChF,QAAQ,EAAE,CACR,IAAI,EAAE,KAAK,GAAG,KAAK,EACnB,SAAS,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,KAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA;IAChC,eAAe,EAAE,MAAM,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA;IAClD,kBAAkB,EAAE,MAAM,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;IAC1D;;;;;;;OAOG;IACH,OAAO,EAAE,CACP,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,IAAI,EACnD,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,gBAAgB,CAAA;QAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;KAC1B,KACE,IAAI,CAAA;CACV;AAED;;GAEG;AACH,KAAK,gBAAgB,GACjB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,6BAA6B,GAC7B,aAAa,GACb,mBAAmB,CAAA;AAqBvB;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,EAC5B,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,EAChC,OAAO,GAAE,kBAAuB,EAChC,WAAW,GAAE,mBAAwB,GACpC,qBAAqB,CA+LvB"}
|
|
@@ -69,6 +69,12 @@ export interface UseFloatingOptions {
|
|
|
69
69
|
* @default false
|
|
70
70
|
*/
|
|
71
71
|
open?: Ref<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Parent node ID for tree hierarchy.
|
|
74
|
+
* Used when adding nodes to floating trees.
|
|
75
|
+
* @default null
|
|
76
|
+
*/
|
|
77
|
+
parentId?: string | null;
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Context object returned by useFloating containing all necessary data and methods
|
|
@@ -112,6 +118,7 @@ export interface FloatingContext {
|
|
|
112
118
|
refs: {
|
|
113
119
|
anchorEl: Ref<AnchorElement>;
|
|
114
120
|
floatingEl: Ref<FloatingElement>;
|
|
121
|
+
arrowEl: Ref<HTMLElement | null>;
|
|
115
122
|
};
|
|
116
123
|
/**
|
|
117
124
|
* Whether the floating element is open
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-floating.d.ts","sourceRoot":"","sources":["../../src/composables/use-floating.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACf,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"use-floating.d.ts","sourceRoot":"","sources":["../../src/composables/use-floating.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACf,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAiBhD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,cAAc,GAAG,IAAI,CAAA;AAE/D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,IAAI,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAA;IAElB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,GAAG;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G;IACH,MAAM,EAAE,MAAM,IAAI,CAAA;IAElB;;OAEG;IACH,IAAI,EAAE;QACJ,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;QAC5B,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,CAAA;QAChC,OAAO,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;KACjC,CAAA;IAED;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAE5B;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACjC;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,EAC5B,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,EAChC,OAAO,GAAE,kBAAuB,GAC/B,eAAe,CAwJjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["../../src/composables/use-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["../../src/composables/use-tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAA+B,MAAM,KAAK,CAAA;AAM3D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAE1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;CACxC;AAQD;;;GAGG;AACH,qBAAa,QAAQ,CAAC,CAAC;;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;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