pxd 0.1.4 → 0.1.7
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/dist/components/_internal/dismiss-container.d.vue.ts +2 -2
- package/dist/components/_internal/dismiss-container.vue +1 -1
- package/dist/components/_internal/mention-editor.d.vue.ts +3 -4
- package/dist/components/_internal/mention-editor.vue +7 -5
- package/dist/components/_internal/tree-node.d.vue.ts +10 -1
- package/dist/components/_internal/tree-node.vue +32 -12
- package/dist/components/active-graph/index.d.vue.ts +1 -1
- package/dist/components/active-graph/index.vue +4 -18
- package/dist/components/active-graph/types.d.ts +1 -1
- package/dist/components/approval-card/index.d.vue.ts +2 -2
- package/dist/components/approval-card/index.vue +8 -4
- package/dist/components/approval-card/types.d.ts +1 -1
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +1 -1
- package/dist/components/backtop/index.d.vue.ts +1 -1
- package/dist/components/badge/index.vue +4 -2
- package/dist/components/badge/types.d.ts +7 -2
- package/dist/components/browser/index.vue +1 -1
- package/dist/components/bubble/index.d.vue.ts +1 -1
- package/dist/components/bubble/index.vue +35 -14
- package/dist/components/bubble/types.d.ts +2 -1
- package/dist/components/bubble-group/index.d.vue.ts +10 -3
- package/dist/components/bubble-group/index.vue +41 -8
- package/dist/components/bubble-group/types.d.ts +5 -4
- package/dist/components/button/index.d.vue.ts +1 -1
- package/dist/components/button/index.vue +4 -4
- package/dist/components/calendar/index.d.vue.ts +2 -2
- package/dist/components/calendar/index.vue +3 -3
- package/dist/components/calendar/types.d.ts +1 -1
- package/dist/components/checkbox/index.d.vue.ts +2 -2
- package/dist/components/checkbox/index.vue +3 -3
- package/dist/components/checkbox/types.d.ts +1 -1
- package/dist/components/checkbox-group/index.d.vue.ts +2 -2
- package/dist/components/checkbox-group/index.vue +2 -2
- package/dist/components/checkbox-group/types.d.ts +1 -1
- package/dist/components/checkerboard/index.d.vue.ts +3 -1
- package/dist/components/checkerboard/index.vue +13 -2
- package/dist/components/checkerboard/types.d.ts +1 -0
- package/dist/components/choicebox/index.d.vue.ts +2 -2
- package/dist/components/choicebox/index.vue +2 -2
- package/dist/components/choicebox/types.d.ts +1 -1
- package/dist/components/choicebox-item/index.vue +1 -1
- package/dist/components/code-block/index.d.vue.ts +7 -3
- package/dist/components/code-block/index.vue +268 -72
- package/dist/components/code-block/types.d.ts +33 -14
- package/dist/components/collapse/index.d.vue.ts +3 -1
- package/dist/components/collapse/index.vue +37 -41
- package/dist/components/collapse/types.d.ts +3 -1
- package/dist/components/collapse-group/index.vue +3 -3
- package/dist/components/color-selector/index.d.vue.ts +2 -2
- package/dist/components/color-selector/index.vue +2 -2
- package/dist/components/color-selector/types.d.ts +1 -1
- package/dist/components/command-menu/index.d.vue.ts +3 -3
- package/dist/components/command-menu/index.vue +2 -2
- package/dist/components/command-menu/types.d.ts +1 -1
- package/dist/components/confirm-popover/index.d.vue.ts +2 -2
- package/dist/components/confirm-popover/index.vue +10 -15
- package/dist/components/confirm-popover/types.d.ts +6 -7
- package/dist/components/context-usage/index.d.vue.ts +6 -0
- package/dist/components/context-usage/index.vue +120 -0
- package/dist/components/context-usage/types.d.ts +13 -0
- package/dist/components/copy-button/index.vue +17 -9
- package/dist/components/copy-button/types.d.ts +3 -1
- package/dist/components/countdown/index.vue +1 -1
- package/dist/components/date-picker/index.d.vue.ts +13 -3
- package/dist/components/date-picker/index.vue +6 -4
- package/dist/components/date-picker/types.d.ts +1 -1
- package/dist/components/description/index.vue +1 -1
- package/dist/components/description/types.d.ts +3 -1
- package/dist/components/drawer/index.d.vue.ts +5 -5
- package/dist/components/drawer/index.vue +13 -13
- package/dist/components/drawer/types.d.ts +2 -2
- package/dist/components/effort-slider/index.d.vue.ts +2 -2
- package/dist/components/effort-slider/index.vue +63 -17
- package/dist/components/effort-slider/types.d.ts +3 -1
- package/dist/components/ellipsis-text/index.d.vue.ts +3 -3
- package/dist/components/ellipsis-text/index.vue +5 -5
- package/dist/components/ellipsis-text/types.d.ts +4 -2
- package/dist/components/empty-state/index.vue +1 -1
- package/dist/components/empty-state/types.d.ts +3 -1
- package/dist/components/feedback-bar/index.d.vue.ts +4 -4
- package/dist/components/feedback-bar/index.vue +4 -4
- package/dist/components/feedback-bar/types.d.ts +2 -2
- package/dist/components/gauge/index.vue +75 -79
- package/dist/components/gauge/types.d.ts +2 -0
- package/dist/components/hint/index.vue +2 -3
- package/dist/components/hold-button/index.d.vue.ts +4 -4
- package/dist/components/hold-button/index.vue +86 -75
- package/dist/components/hue-text/index.vue +2 -2
- package/dist/components/hue-text/types.d.ts +3 -1
- package/dist/components/image-preview/index.d.vue.ts +2 -0
- package/dist/components/image-preview/index.vue +156 -131
- package/dist/components/image-preview/types.d.ts +18 -18
- package/dist/components/index.d.ts +132 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input/index.d.vue.ts +2 -2
- package/dist/components/input/index.vue +2 -2
- package/dist/components/input/types.d.ts +1 -1
- package/dist/components/kbd/index.vue +1 -1
- package/dist/components/link-button/index.d.vue.ts +1 -1
- package/dist/components/link-button/index.vue +1 -1
- package/dist/components/link-button/types.d.ts +1 -1
- package/dist/components/list/index.d.vue.ts +3 -3
- package/dist/components/list/index.vue +4 -4
- package/dist/components/list/types.d.ts +1 -1
- package/dist/components/list-group/index.vue +1 -1
- package/dist/components/{_internal/loading-mask.d.vue.ts → loading-mask/index.d.vue.ts} +2 -4
- package/dist/components/{_internal/loading-mask.vue → loading-mask/index.vue} +1 -1
- package/dist/components/loading-mask/types.d.ts +3 -0
- package/dist/components/marching-ants/index.d.vue.ts +1 -1
- package/dist/components/marquee/index.d.vue.ts +3 -3
- package/dist/components/marquee/index.vue +1 -1
- package/dist/components/marquee/types.d.ts +2 -2
- package/dist/components/mention/index.d.vue.ts +6 -4
- package/dist/components/mention/index.vue +6 -2
- package/dist/components/mention/types.d.ts +1 -1
- package/dist/components/menu/index.d.vue.ts +5 -3
- package/dist/components/menu/index.vue +6 -2
- package/dist/components/menu/types.d.ts +1 -1
- package/dist/components/message/index.d.vue.ts +1 -1
- package/dist/components/modal/index.d.vue.ts +4 -4
- package/dist/components/modal/index.vue +13 -13
- package/dist/components/modal/types.d.ts +2 -2
- package/dist/components/more-button/index.d.vue.ts +4 -4
- package/dist/components/more-button/index.vue +4 -4
- package/dist/components/more-button/types.d.ts +3 -3
- package/dist/components/note/index.vue +1 -1
- package/dist/components/note/types.d.ts +1 -1
- package/dist/components/number-input/index.d.vue.ts +2 -2
- package/dist/components/number-input/index.vue +2 -2
- package/dist/components/number-input/types.d.ts +1 -1
- package/dist/components/overlay/index.d.vue.ts +2 -2
- package/dist/components/overlay/index.vue +4 -4
- package/dist/components/overlay/types.d.ts +1 -1
- package/dist/components/page-number/index.d.vue.ts +3 -3
- package/dist/components/page-number/index.vue +3 -3
- package/dist/components/page-number/types.d.ts +1 -1
- package/dist/components/pagination/index.vue +2 -2
- package/dist/components/pin-input/index.d.vue.ts +4 -4
- package/dist/components/pin-input/index.vue +3 -3
- package/dist/components/pin-input/types.d.ts +1 -1
- package/dist/components/placeholder/index.vue +3 -3
- package/dist/components/placeholder/types.d.ts +1 -1
- package/dist/components/popover/index.vue +73 -36
- package/dist/components/popover/types.d.ts +1 -2
- package/dist/components/questionnaire/index.d.vue.ts +1 -0
- package/dist/components/questionnaire/index.vue +92 -87
- package/dist/components/questionnaire/types.d.ts +1 -3
- package/dist/components/radio/index.d.vue.ts +2 -2
- package/dist/components/radio/index.vue +3 -3
- package/dist/components/radio/types.d.ts +1 -1
- package/dist/components/radio-group/index.d.vue.ts +2 -2
- package/dist/components/radio-group/index.vue +2 -2
- package/dist/components/radio-group/types.d.ts +1 -1
- package/dist/components/rating/index.d.vue.ts +3 -3
- package/dist/components/rating/index.vue +2 -2
- package/dist/components/rating/types.d.ts +1 -1
- package/dist/components/reactions/index.d.vue.ts +34 -0
- package/dist/components/reactions/index.vue +143 -0
- package/dist/components/reactions/types.d.ts +23 -0
- package/dist/components/reasoning/index.d.vue.ts +2 -0
- package/dist/components/reasoning/index.vue +49 -30
- package/dist/components/reasoning/types.d.ts +9 -0
- package/dist/components/resizable/index.d.vue.ts +2 -2
- package/dist/components/resizable/index.vue +3 -3
- package/dist/components/resizable/types.d.ts +1 -1
- package/dist/components/reveal/index.d.vue.ts +1 -1
- package/dist/components/rolling-number/index.vue +1 -1
- package/dist/components/scroll-text/index.d.vue.ts +1 -1
- package/dist/components/scroll-text/index.vue +2 -2
- package/dist/components/scroll-text/types.d.ts +2 -2
- package/dist/components/scrollable/index.d.vue.ts +3 -2
- package/dist/components/scrollable/types.d.ts +0 -15
- package/dist/components/search-input/index.d.vue.ts +5 -5
- package/dist/components/search-input/index.vue +1 -1
- package/dist/components/select/index.d.vue.ts +10 -6
- package/dist/components/select/index.vue +15 -8
- package/dist/components/select/types.d.ts +1 -1
- package/dist/components/shimmer-text/index.d.vue.ts +1 -1
- package/dist/components/shimmer-text/index.vue +1 -1
- package/dist/components/shimmer-text/types.d.ts +1 -1
- package/dist/components/skeleton/index.d.vue.ts +1 -1
- package/dist/components/slider/index.d.vue.ts +2 -3
- package/dist/components/slider/index.vue +17 -6
- package/dist/components/slider/types.d.ts +2 -1
- package/dist/components/snippet/index.vue +1 -5
- package/dist/components/snippet/types.d.ts +6 -2
- package/dist/components/spinner-dots/types.d.ts +1 -1
- package/dist/components/split-button/index.d.vue.ts +5 -3
- package/dist/components/split-button/index.vue +6 -2
- package/dist/components/split-button/types.d.ts +1 -1
- package/dist/components/steps/index.d.vue.ts +2 -2
- package/dist/components/steps/index.vue +2 -2
- package/dist/components/steps/types.d.ts +1 -1
- package/dist/components/stick-to-bottom/index.vue +3 -6
- package/dist/components/swipe-cell/index.d.vue.ts +2 -2
- package/dist/components/swipe-cell/index.vue +3 -3
- package/dist/components/swipe-cell/types.d.ts +1 -1
- package/dist/components/switch/index.d.vue.ts +2 -2
- package/dist/components/switch/index.vue +2 -2
- package/dist/components/switch/types.d.ts +1 -1
- package/dist/components/switch-item/index.vue +2 -2
- package/dist/components/tabs/index.d.vue.ts +2 -2
- package/dist/components/tabs/index.vue +3 -3
- package/dist/components/tabs/types.d.ts +1 -1
- package/dist/components/text/index.vue +1 -1
- package/dist/components/text/types.d.ts +1 -1
- package/dist/components/textarea/index.d.vue.ts +2 -2
- package/dist/components/textarea/index.vue +2 -2
- package/dist/components/textarea/types.d.ts +1 -1
- package/dist/components/theme-switcher/index.d.vue.ts +2 -3
- package/dist/components/theme-switcher/index.vue +7 -7
- package/dist/components/time-picker/index.d.vue.ts +13 -3
- package/dist/components/time-picker/index.vue +10 -8
- package/dist/components/time-picker/types.d.ts +1 -1
- package/dist/components/timeline-item/index.d.vue.ts +0 -1
- package/dist/components/timeline-item/index.vue +20 -4
- package/dist/components/timeline-item/types.d.ts +2 -2
- package/dist/components/toc/index.d.vue.ts +4 -1
- package/dist/components/toc/index.vue +65 -8
- package/dist/components/toc/types.d.ts +10 -1
- package/dist/components/todo-list/index.d.vue.ts +4 -13
- package/dist/components/todo-list/index.vue +122 -133
- package/dist/components/todo-list/types.d.ts +5 -4
- package/dist/components/toggle/index.d.vue.ts +4 -4
- package/dist/components/toggle/index.vue +4 -4
- package/dist/components/toggle/types.d.ts +6 -6
- package/dist/components/toggle-button/index.d.vue.ts +2 -2
- package/dist/components/toggle-button/index.vue +2 -2
- package/dist/components/toggle-button/types.d.ts +1 -1
- package/dist/components/toggle-button-group/index.d.vue.ts +2 -2
- package/dist/components/toggle-button-group/index.vue +2 -2
- package/dist/components/toggle-button-group/types.d.ts +1 -1
- package/dist/components/tool-call/index.d.vue.ts +2 -0
- package/dist/components/tool-call/index.vue +139 -133
- package/dist/components/tool-call/types.d.ts +6 -1
- package/dist/components/tooltip/index.d.vue.ts +1 -1
- package/dist/components/tooltip/index.vue +1 -0
- package/dist/components/tour/index.d.vue.ts +4 -4
- package/dist/components/tour/index.vue +4 -4
- package/dist/components/tour/types.d.ts +5 -5
- package/dist/components/tree/index.d.vue.ts +27 -18
- package/dist/components/tree/index.vue +95 -27
- package/dist/components/tree/types.d.ts +18 -17
- package/dist/components/virtual-list/index.d.vue.ts +5 -4
- package/dist/components/virtual-list/index.vue +5 -4
- package/dist/components/virtual-list/types.d.ts +10 -8
- package/dist/composables/_internal/use-code-highlight.js +3 -1
- package/dist/composables/_internal/use-details-collapse.d.ts +7 -0
- package/dist/composables/_internal/use-details-collapse.js +68 -0
- package/dist/composables/_internal/use-list-selection.d.ts +1 -1
- package/dist/composables/_internal/use-list-selection.js +2 -2
- package/dist/composables/_internal/use-model-value.d.ts +1 -1
- package/dist/composables/_internal/use-model-value.js +1 -1
- package/dist/composables/_internal/use-tailwind-variant.js +1 -1
- package/dist/composables/_internal/use-tree.d.ts +32 -6
- package/dist/composables/_internal/use-tree.js +89 -54
- package/dist/composables/use-color-scheme.d.ts +1 -1
- package/dist/composables/use-color-scheme.js +7 -3
- package/dist/composables/use-countdown.d.ts +1 -1
- package/dist/composables/use-countdown.js +9 -9
- package/dist/composables/use-loading-bar.js +4 -0
- package/dist/composables/use-stick-to-bottom.d.ts +5 -0
- package/dist/composables/use-stick-to-bottom.js +45 -31
- package/dist/composables/use-virtual-list.d.ts +21 -1
- package/dist/composables/use-virtual-list.js +30 -9
- package/dist/constants/tooltip-variants.d.ts +2 -2
- package/dist/constants/tooltip-variants.js +3 -3
- package/dist/contexts/collapse.d.ts +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +12 -7
- package/package.json +10 -11
- package/volar.d.ts +3 -0
- package/dist/components/bubble-group/types.js +0 -0
- package/dist/components/virtual-list/types.js +0 -0
- package/dist/composables/_internal/use-collapse-motion.d.ts +0 -6
- package/dist/composables/_internal/use-collapse-motion.js +0 -85
- package/dist/utils/_internal/cn-tables.d.ts +0 -27
- package/dist/utils/_internal/cn-tables.js +0 -131
- package/dist/utils/cn.d.ts +0 -1
- package/dist/utils/cn.js +0 -3
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import type { TreeDropPosition, TreeDropTarget,
|
|
1
|
+
import type { TreeDropPosition, TreeDropTarget, TreeFieldNames, TreeFilterFn, TreeMoveDetail, TreeModelValue, TreeOption, TreeOptions, TreeRemoteFilterFn, TreeSelectableFn } from '../../components/tree/types';
|
|
2
2
|
import type { ComponentValue } from '../../types/shared/props';
|
|
3
3
|
import type { MaybeElementRef } from '../../types/shared/utils';
|
|
4
4
|
import type { ComputedRef, MaybeRefOrGetter, ShallowRef } from 'vue';
|
|
5
|
+
export interface TreeFlatNode {
|
|
6
|
+
key: ComponentValue;
|
|
7
|
+
node: TreeOption;
|
|
8
|
+
depth: number;
|
|
9
|
+
index: number;
|
|
10
|
+
parentValue?: ComponentValue;
|
|
11
|
+
hasChildren: boolean;
|
|
12
|
+
expanded: boolean;
|
|
13
|
+
}
|
|
5
14
|
export interface TreeNodeMeta {
|
|
6
15
|
node: TreeOptions[number];
|
|
7
16
|
children: TreeNodeMeta[];
|
|
@@ -14,17 +23,32 @@ export interface TreeIndex {
|
|
|
14
23
|
list: TreeNodeMeta[];
|
|
15
24
|
byValue: Map<ComponentValue, TreeNodeMeta>;
|
|
16
25
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
26
|
+
export interface ResolvedTreeFieldNames {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
children: string;
|
|
30
|
+
disabled: string;
|
|
31
|
+
isLeaf: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function resolveTreeFieldNames(fieldNames: TreeFieldNames | undefined): ResolvedTreeFieldNames;
|
|
34
|
+
export declare function createTreeIndex(data: readonly TreeOption[], fieldNames?: TreeFieldNames): TreeIndex;
|
|
35
|
+
export declare function useTreeIndex(data: MaybeRefOrGetter<readonly TreeOption[]>, fieldNames: MaybeRefOrGetter<TreeFieldNames | undefined>): ComputedRef<TreeIndex>;
|
|
19
36
|
/** Children in `data` win over a cached request, and an untouched node keeps its identity. */
|
|
20
|
-
export declare function graftLoadedChildren(data:
|
|
37
|
+
export declare function graftLoadedChildren(data: readonly TreeOption[], loaded: Map<ComponentValue, TreeOptions>, fieldNames?: TreeFieldNames): readonly TreeOption[];
|
|
38
|
+
/** Only a non-empty array marks a parent: `children: []` is a leaf unless `isLeaf` says otherwise. */
|
|
39
|
+
export declare function hasTreeChildren(node: TreeOption, fieldNames?: TreeFieldNames): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* `isLeaf` first, then the data, then a lazy node still waiting. `loadable` means a request would
|
|
42
|
+
* start now, so a node whose request resolved with nothing becomes a leaf.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isTreeLeaf(node: TreeOption, fieldNames: TreeFieldNames | undefined, loadable: boolean): boolean;
|
|
21
45
|
export interface TreeMatched {
|
|
22
46
|
/** Every hit plus its ancestors: ancestor-closed, so the row walk can prune whole subtrees. */
|
|
23
47
|
visible: ReadonlySet<ComponentValue>;
|
|
24
48
|
/** The hits alone. */
|
|
25
49
|
exact: ReadonlySet<ComponentValue>;
|
|
26
50
|
}
|
|
27
|
-
export declare function useTreeMatched(index: MaybeRefOrGetter<TreeIndex>, query: MaybeRefOrGetter<string>, filter: MaybeRefOrGetter<TreeFilterFn | undefined>): ComputedRef<TreeMatched>;
|
|
51
|
+
export declare function useTreeMatched(index: MaybeRefOrGetter<TreeIndex>, query: MaybeRefOrGetter<string>, filter: MaybeRefOrGetter<TreeFilterFn | undefined>, fieldNames?: MaybeRefOrGetter<TreeFieldNames | undefined>): ComputedRef<TreeMatched>;
|
|
28
52
|
export interface UseTreeSearchOptions {
|
|
29
53
|
query: MaybeRefOrGetter<string>;
|
|
30
54
|
remoteFilter?: MaybeRefOrGetter<TreeRemoteFilterFn | undefined>;
|
|
@@ -46,6 +70,7 @@ export interface UseTreeRowsOptions {
|
|
|
46
70
|
exactMatched?: MaybeRefOrGetter<ReadonlySet<ComponentValue> | undefined>;
|
|
47
71
|
matchesOnly?: MaybeRefOrGetter<boolean | undefined>;
|
|
48
72
|
canLoad?: MaybeRefOrGetter<((value: ComponentValue) => boolean) | undefined>;
|
|
73
|
+
fieldNames?: MaybeRefOrGetter<TreeFieldNames | undefined>;
|
|
49
74
|
}
|
|
50
75
|
/**
|
|
51
76
|
* Selection state is deliberately absent: it changes on every click, and putting it here would
|
|
@@ -58,6 +83,7 @@ export interface UseTreeSelectionOptions {
|
|
|
58
83
|
multiple: MaybeRefOrGetter<boolean>;
|
|
59
84
|
checkStrictly?: MaybeRefOrGetter<boolean | undefined>;
|
|
60
85
|
selectable?: MaybeRefOrGetter<TreeSelectableFn | undefined>;
|
|
86
|
+
fieldNames?: MaybeRefOrGetter<TreeFieldNames | undefined>;
|
|
61
87
|
}
|
|
62
88
|
export interface TreeToggleResult {
|
|
63
89
|
value: TreeModelValue;
|
|
@@ -82,7 +108,7 @@ export interface TreeMoveResult {
|
|
|
82
108
|
* The node is detached before the target is looked up, which rejects the whole family of invalid
|
|
83
109
|
* drops for free: it and its descendant are no longer in the tree to be found.
|
|
84
110
|
*/
|
|
85
|
-
export declare function moveTreeNode(data:
|
|
111
|
+
export declare function moveTreeNode(data: readonly TreeOption[], fieldNames: TreeFieldNames | undefined, value: ComponentValue, target: TreeDropTarget): TreeMoveResult | undefined;
|
|
86
112
|
export interface UseTreeDragOptions {
|
|
87
113
|
container: MaybeElementRef<HTMLElement>;
|
|
88
114
|
rows: MaybeRefOrGetter<TreeFlatNode[]>;
|
|
@@ -4,17 +4,28 @@ import { isCompositionKeydown } from "../../utils/event.js";
|
|
|
4
4
|
import { isFuzzyMatch } from "../../utils/fuzzy-match.js";
|
|
5
5
|
import { toValue } from "../../utils/helper.js";
|
|
6
6
|
import { debounce } from "../../utils/timing.js";
|
|
7
|
-
export function
|
|
7
|
+
export function resolveTreeFieldNames(fieldNames) {
|
|
8
|
+
return {
|
|
9
|
+
value: fieldNames?.value ?? "value",
|
|
10
|
+
label: fieldNames?.label ?? "label",
|
|
11
|
+
children: fieldNames?.children ?? "children",
|
|
12
|
+
disabled: fieldNames?.disabled ?? "disabled",
|
|
13
|
+
isLeaf: fieldNames?.isLeaf ?? "isLeaf"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function createTreeIndex(data, fieldNames) {
|
|
17
|
+
const fields = resolveTreeFieldNames(fieldNames);
|
|
8
18
|
const list = [];
|
|
9
19
|
const byValue = /* @__PURE__ */ new Map();
|
|
10
20
|
function visit(node, parentValue, depth) {
|
|
11
21
|
const meta = { node, children: [], parentValue, depth, end: 0 };
|
|
22
|
+
const value = node[fields.value];
|
|
12
23
|
list.push(meta);
|
|
13
|
-
byValue.set(
|
|
14
|
-
const children = node[
|
|
24
|
+
byValue.set(value, meta);
|
|
25
|
+
const children = node[fields.children];
|
|
15
26
|
if (Array.isArray(children)) {
|
|
16
27
|
for (const child of children) {
|
|
17
|
-
meta.children.push(visit(child,
|
|
28
|
+
meta.children.push(visit(child, value, depth + 1));
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
31
|
meta.end = list.length;
|
|
@@ -25,31 +36,33 @@ export function createTreeIndex(data, childrenField) {
|
|
|
25
36
|
}
|
|
26
37
|
return { list, byValue };
|
|
27
38
|
}
|
|
28
|
-
export function useTreeIndex(data,
|
|
29
|
-
return computed(() => createTreeIndex(toValue(data) ?? [], toValue(
|
|
39
|
+
export function useTreeIndex(data, fieldNames) {
|
|
40
|
+
return computed(() => createTreeIndex(toValue(data) ?? [], toValue(fieldNames)));
|
|
30
41
|
}
|
|
31
|
-
function graftNode(node, loaded,
|
|
32
|
-
const own = node[
|
|
42
|
+
function graftNode(node, loaded, fields) {
|
|
43
|
+
const own = node[fields.children];
|
|
33
44
|
const fromData = Array.isArray(own) && own.length > 0;
|
|
34
|
-
const
|
|
45
|
+
const value = node[fields.value];
|
|
46
|
+
const source = fromData ? own : loaded.get(value) ?? [];
|
|
35
47
|
const children = [];
|
|
36
|
-
let changed = !fromData && loaded.has(
|
|
48
|
+
let changed = !fromData && loaded.has(value);
|
|
37
49
|
for (const child of source) {
|
|
38
|
-
const grafted = graftNode(child, loaded,
|
|
50
|
+
const grafted = graftNode(child, loaded, fields);
|
|
39
51
|
if (grafted !== child) {
|
|
40
52
|
changed = true;
|
|
41
53
|
}
|
|
42
54
|
children.push(grafted);
|
|
43
55
|
}
|
|
44
|
-
return changed ? { ...node, [
|
|
56
|
+
return changed ? { ...node, [fields.children]: children } : node;
|
|
45
57
|
}
|
|
46
|
-
export function graftLoadedChildren(data, loaded,
|
|
58
|
+
export function graftLoadedChildren(data, loaded, fieldNames) {
|
|
47
59
|
if (loaded.size === 0) {
|
|
48
60
|
return data;
|
|
49
61
|
}
|
|
62
|
+
const fields = resolveTreeFieldNames(fieldNames);
|
|
50
63
|
let changed = false;
|
|
51
64
|
const next = data.map((node) => {
|
|
52
|
-
const grafted = graftNode(node, loaded,
|
|
65
|
+
const grafted = graftNode(node, loaded, fields);
|
|
53
66
|
if (grafted !== node) {
|
|
54
67
|
changed = true;
|
|
55
68
|
}
|
|
@@ -57,10 +70,22 @@ export function graftLoadedChildren(data, loaded, childrenField) {
|
|
|
57
70
|
});
|
|
58
71
|
return changed ? next : data;
|
|
59
72
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
73
|
+
export function hasTreeChildren(node, fieldNames) {
|
|
74
|
+
const children = node[resolveTreeFieldNames(fieldNames).children];
|
|
75
|
+
return Array.isArray(children) && children.length > 0;
|
|
62
76
|
}
|
|
63
|
-
export function
|
|
77
|
+
export function isTreeLeaf(node, fieldNames, loadable) {
|
|
78
|
+
const fields = resolveTreeFieldNames(fieldNames);
|
|
79
|
+
const isLeaf = node[fields.isLeaf];
|
|
80
|
+
if (isLeaf !== void 0) {
|
|
81
|
+
return isLeaf;
|
|
82
|
+
}
|
|
83
|
+
return !hasTreeChildren(node, fields) && !loadable;
|
|
84
|
+
}
|
|
85
|
+
function defaultFilter(node, query, fields) {
|
|
86
|
+
return isFuzzyMatch(String(node[fields.label] ?? ""), query, node.keywords);
|
|
87
|
+
}
|
|
88
|
+
export function useTreeMatched(index, query, filter, fieldNames) {
|
|
64
89
|
return computed(() => {
|
|
65
90
|
const visible = /* @__PURE__ */ new Set();
|
|
66
91
|
const exact = /* @__PURE__ */ new Set();
|
|
@@ -68,14 +93,15 @@ export function useTreeMatched(index, query, filter) {
|
|
|
68
93
|
if (!needle) {
|
|
69
94
|
return { visible, exact };
|
|
70
95
|
}
|
|
71
|
-
const
|
|
96
|
+
const fields = resolveTreeFieldNames(toValue(fieldNames));
|
|
97
|
+
const match = toValue(filter) ?? ((node) => defaultFilter(node, needle, fields));
|
|
72
98
|
const { list, byValue } = toValue(index);
|
|
73
99
|
for (const meta of list) {
|
|
74
100
|
if (!match(meta.node, needle)) {
|
|
75
101
|
continue;
|
|
76
102
|
}
|
|
77
|
-
exact.add(meta.node.value);
|
|
78
|
-
visible.add(meta.node.value);
|
|
103
|
+
exact.add(meta.node[fields.value]);
|
|
104
|
+
visible.add(meta.node[fields.value]);
|
|
79
105
|
let parentValue = meta.parentValue;
|
|
80
106
|
while (parentValue !== void 0 && !visible.has(parentValue)) {
|
|
81
107
|
visible.add(parentValue);
|
|
@@ -147,15 +173,16 @@ export function useTreeRows(index, options) {
|
|
|
147
173
|
const matchesOnly = searching && toValue(options.matchesOnly) === true;
|
|
148
174
|
const exact = toValue(options.exactMatched) ?? matched;
|
|
149
175
|
const canLoad = toValue(options.canLoad);
|
|
176
|
+
const fields = resolveTreeFieldNames(toValue(options.fieldNames));
|
|
150
177
|
const rows = [];
|
|
151
178
|
let cursor = 0;
|
|
152
179
|
while (cursor < list.length) {
|
|
153
180
|
const meta = list[cursor];
|
|
154
|
-
if (searching && !matched.has(meta.node.value)) {
|
|
181
|
+
if (searching && !matched.has(meta.node[fields.value])) {
|
|
155
182
|
cursor = meta.end;
|
|
156
183
|
continue;
|
|
157
184
|
}
|
|
158
|
-
const value = meta.node.value;
|
|
185
|
+
const value = meta.node[fields.value];
|
|
159
186
|
if (matchesOnly && !exact.has(value)) {
|
|
160
187
|
cursor++;
|
|
161
188
|
continue;
|
|
@@ -166,7 +193,7 @@ export function useTreeRows(index, options) {
|
|
|
166
193
|
depth: matchesOnly ? 0 : meta.depth,
|
|
167
194
|
index: rows.length,
|
|
168
195
|
parentValue: matchesOnly ? void 0 : meta.parentValue,
|
|
169
|
-
hasChildren: meta.
|
|
196
|
+
hasChildren: !isTreeLeaf(meta.node, fields, canLoad?.(value) === true),
|
|
170
197
|
expanded: expanded.has(value)
|
|
171
198
|
});
|
|
172
199
|
cursor++;
|
|
@@ -190,12 +217,13 @@ function collect(modelValue) {
|
|
|
190
217
|
}
|
|
191
218
|
return modelValue == null ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([modelValue]);
|
|
192
219
|
}
|
|
193
|
-
function derive(list, selected, selectable) {
|
|
220
|
+
function derive(list, selected, selectable, fields) {
|
|
194
221
|
const checked = /* @__PURE__ */ new Set();
|
|
195
222
|
const indeterminate = /* @__PURE__ */ new Set();
|
|
196
223
|
const stats = /* @__PURE__ */ new Map();
|
|
197
224
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
198
225
|
const meta = list[i];
|
|
226
|
+
const value = meta.node[fields.value];
|
|
199
227
|
let total = 0;
|
|
200
228
|
let hit = 0;
|
|
201
229
|
for (const child of meta.children) {
|
|
@@ -204,11 +232,11 @@ function derive(list, selected, selectable) {
|
|
|
204
232
|
hit += childStat?.hit ?? 0;
|
|
205
233
|
}
|
|
206
234
|
const takes = selectable(meta);
|
|
207
|
-
const isChecked = total > 0 ? hit === total : selected.has(
|
|
208
|
-
if (isChecked && (takes || selected.has(
|
|
209
|
-
checked.add(
|
|
235
|
+
const isChecked = total > 0 ? hit === total : selected.has(value);
|
|
236
|
+
if (isChecked && (takes || selected.has(value))) {
|
|
237
|
+
checked.add(value);
|
|
210
238
|
} else if (hit > 0) {
|
|
211
|
-
indeterminate.add(
|
|
239
|
+
indeterminate.add(value);
|
|
212
240
|
}
|
|
213
241
|
stats.set(meta, {
|
|
214
242
|
total: total + (takes ? 1 : 0),
|
|
@@ -221,8 +249,11 @@ export function useTreeSelection(options) {
|
|
|
221
249
|
const selected = computed(() => collect(toValue(options.modelValue)));
|
|
222
250
|
let anchor;
|
|
223
251
|
let current;
|
|
252
|
+
function fields() {
|
|
253
|
+
return resolveTreeFieldNames(toValue(options.fieldNames));
|
|
254
|
+
}
|
|
224
255
|
function selectable(meta) {
|
|
225
|
-
return meta.node.disabled !== true && toValue(options.selectable)?.(meta.node) !== false;
|
|
256
|
+
return meta.node[fields().disabled] !== true && toValue(options.selectable)?.(meta.node) !== false;
|
|
226
257
|
}
|
|
227
258
|
function isSelectable(value) {
|
|
228
259
|
const meta = toValue(options.index).byValue.get(value);
|
|
@@ -232,12 +263,13 @@ export function useTreeSelection(options) {
|
|
|
232
263
|
if (!toValue(options.multiple) || toValue(options.checkStrictly)) {
|
|
233
264
|
return { checked: selected.value, indeterminate: /* @__PURE__ */ new Set() };
|
|
234
265
|
}
|
|
235
|
-
return derive(toValue(options.index).list, selected.value, selectable);
|
|
266
|
+
return derive(toValue(options.index).list, selected.value, selectable, fields());
|
|
236
267
|
});
|
|
237
268
|
function toToggleResult(list, result) {
|
|
269
|
+
const names = fields();
|
|
238
270
|
return {
|
|
239
|
-
value: list.filter((item) => result.checked.has(item.node.value)).map((item) => item.node.value),
|
|
240
|
-
halfCheckedValues: list.filter((item) => result.indeterminate.has(item.node.value)).map((item) => item.node.value)
|
|
271
|
+
value: list.filter((item) => result.checked.has(item.node[names.value])).map((item) => item.node[names.value]),
|
|
272
|
+
halfCheckedValues: list.filter((item) => result.indeterminate.has(item.node[names.value])).map((item) => item.node[names.value])
|
|
241
273
|
};
|
|
242
274
|
}
|
|
243
275
|
function toggle(value) {
|
|
@@ -263,18 +295,19 @@ export function useTreeSelection(options) {
|
|
|
263
295
|
}
|
|
264
296
|
return toToggleResult(list, { checked: next, indeterminate: /* @__PURE__ */ new Set() });
|
|
265
297
|
}
|
|
298
|
+
const names = fields();
|
|
266
299
|
for (let i = list.indexOf(meta); i < meta.end; i++) {
|
|
267
300
|
const item = list[i];
|
|
268
301
|
if (!selectable(item)) {
|
|
269
302
|
continue;
|
|
270
303
|
}
|
|
271
304
|
if (willCheck) {
|
|
272
|
-
next.add(item.node.value);
|
|
305
|
+
next.add(item.node[names.value]);
|
|
273
306
|
} else {
|
|
274
|
-
next.delete(item.node.value);
|
|
307
|
+
next.delete(item.node[names.value]);
|
|
275
308
|
}
|
|
276
309
|
}
|
|
277
|
-
return toToggleResult(list, derive(list, next, selectable));
|
|
310
|
+
return toToggleResult(list, derive(list, next, selectable, names));
|
|
278
311
|
}
|
|
279
312
|
function span(from, to) {
|
|
280
313
|
const { list } = toValue(options.index);
|
|
@@ -291,16 +324,17 @@ export function useTreeSelection(options) {
|
|
|
291
324
|
return toggle(value);
|
|
292
325
|
}
|
|
293
326
|
const next = new Set(selected.value);
|
|
327
|
+
const names = fields();
|
|
294
328
|
for (const item of span(from, reached ?? to)) {
|
|
295
|
-
next.delete(item.node.value);
|
|
329
|
+
next.delete(item.node[names.value]);
|
|
296
330
|
}
|
|
297
331
|
for (const item of span(from, to)) {
|
|
298
332
|
if (selectable(item)) {
|
|
299
|
-
next.add(item.node.value);
|
|
333
|
+
next.add(item.node[names.value]);
|
|
300
334
|
}
|
|
301
335
|
}
|
|
302
336
|
current = value;
|
|
303
|
-
return toValue(options.checkStrictly) ? toToggleResult(list, { checked: next, indeterminate: /* @__PURE__ */ new Set() }) : toToggleResult(list, derive(list, next, selectable));
|
|
337
|
+
return toValue(options.checkStrictly) ? toToggleResult(list, { checked: next, indeterminate: /* @__PURE__ */ new Set() }) : toToggleResult(list, derive(list, next, selectable, names));
|
|
304
338
|
}
|
|
305
339
|
return {
|
|
306
340
|
checked: computed(() => state.value.checked),
|
|
@@ -325,8 +359,8 @@ export function isTreeDescendant(index, ancestorValue, value) {
|
|
|
325
359
|
}
|
|
326
360
|
return false;
|
|
327
361
|
}
|
|
328
|
-
function removeNode(list,
|
|
329
|
-
const at = list.findIndex((node) => node.value === value);
|
|
362
|
+
function removeNode(list, fields, value, parentValue) {
|
|
363
|
+
const at = list.findIndex((node) => node[fields.value] === value);
|
|
330
364
|
if (at !== -1) {
|
|
331
365
|
return {
|
|
332
366
|
list: [...list.slice(0, at), ...list.slice(at + 1)],
|
|
@@ -336,55 +370,56 @@ function removeNode(list, childrenField, value, parentValue) {
|
|
|
336
370
|
};
|
|
337
371
|
}
|
|
338
372
|
for (let i = 0; i < list.length; i++) {
|
|
339
|
-
const children = list[i][
|
|
373
|
+
const children = list[i][fields.children];
|
|
340
374
|
if (!Array.isArray(children)) {
|
|
341
375
|
continue;
|
|
342
376
|
}
|
|
343
|
-
const result = removeNode(children,
|
|
377
|
+
const result = removeNode(children, fields, value, list[i][fields.value]);
|
|
344
378
|
if (!result) {
|
|
345
379
|
continue;
|
|
346
380
|
}
|
|
347
381
|
const next = [...list];
|
|
348
|
-
next[i] = { ...list[i], [
|
|
382
|
+
next[i] = { ...list[i], [fields.children]: result.list };
|
|
349
383
|
return { ...result, list: next };
|
|
350
384
|
}
|
|
351
385
|
return void 0;
|
|
352
386
|
}
|
|
353
|
-
function insertNode(list,
|
|
354
|
-
const at = list.findIndex((item) => item.value === target.targetValue);
|
|
387
|
+
function insertNode(list, fields, target, node, parentValue) {
|
|
388
|
+
const at = list.findIndex((item) => item[fields.value] === target.targetValue);
|
|
355
389
|
if (at !== -1) {
|
|
356
390
|
const next = [...list];
|
|
357
391
|
if (target.position === "inside") {
|
|
358
|
-
const raw = next[at][
|
|
392
|
+
const raw = next[at][fields.children];
|
|
359
393
|
const children = Array.isArray(raw) ? raw : [];
|
|
360
|
-
next[at] = { ...next[at], [
|
|
361
|
-
return { list: next, parentValue: next[at].value, index: children.length };
|
|
394
|
+
next[at] = { ...next[at], [fields.children]: [...children, node] };
|
|
395
|
+
return { list: next, parentValue: next[at][fields.value], index: children.length };
|
|
362
396
|
}
|
|
363
397
|
const index = target.position === "after" ? at + 1 : at;
|
|
364
398
|
next.splice(index, 0, node);
|
|
365
399
|
return { list: next, parentValue, index };
|
|
366
400
|
}
|
|
367
401
|
for (let i = 0; i < list.length; i++) {
|
|
368
|
-
const children = list[i][
|
|
402
|
+
const children = list[i][fields.children];
|
|
369
403
|
if (!Array.isArray(children)) {
|
|
370
404
|
continue;
|
|
371
405
|
}
|
|
372
|
-
const result = insertNode(children,
|
|
406
|
+
const result = insertNode(children, fields, target, node, list[i][fields.value]);
|
|
373
407
|
if (!result) {
|
|
374
408
|
continue;
|
|
375
409
|
}
|
|
376
410
|
const next = [...list];
|
|
377
|
-
next[i] = { ...list[i], [
|
|
411
|
+
next[i] = { ...list[i], [fields.children]: result.list };
|
|
378
412
|
return { ...result, list: next };
|
|
379
413
|
}
|
|
380
414
|
return void 0;
|
|
381
415
|
}
|
|
382
|
-
export function moveTreeNode(data,
|
|
383
|
-
const
|
|
416
|
+
export function moveTreeNode(data, fieldNames, value, target) {
|
|
417
|
+
const fields = resolveTreeFieldNames(fieldNames);
|
|
418
|
+
const removal = removeNode(data, fields, value);
|
|
384
419
|
if (!removal) {
|
|
385
420
|
return void 0;
|
|
386
421
|
}
|
|
387
|
-
const insertion = insertNode(removal.list,
|
|
422
|
+
const insertion = insertNode(removal.list, fields, target, removal.node);
|
|
388
423
|
if (!insertion) {
|
|
389
424
|
return void 0;
|
|
390
425
|
}
|
|
@@ -4,8 +4,9 @@ import { getUniqueId } from "../utils/helper.js";
|
|
|
4
4
|
import { isServer } from "../utils/is.js";
|
|
5
5
|
import { PRESET_MEDIA_QUERIES, useMediaQuery } from "./use-media-query.js";
|
|
6
6
|
const SCHEME_CYCLE = {
|
|
7
|
-
auto: "
|
|
8
|
-
|
|
7
|
+
auto: "inverted",
|
|
8
|
+
inverted: "auto",
|
|
9
|
+
light: "auto",
|
|
9
10
|
dark: "auto"
|
|
10
11
|
};
|
|
11
12
|
export function useColorScheme(options = {}) {
|
|
@@ -23,6 +24,9 @@ export function useColorScheme(options = {}) {
|
|
|
23
24
|
if (colorScheme.value === "light") {
|
|
24
25
|
return false;
|
|
25
26
|
}
|
|
27
|
+
if (colorScheme.value === "inverted") {
|
|
28
|
+
return !preferredDark.value;
|
|
29
|
+
}
|
|
26
30
|
return preferredDark.value;
|
|
27
31
|
});
|
|
28
32
|
function updateStorages() {
|
|
@@ -83,7 +87,7 @@ export function useColorScheme(options = {}) {
|
|
|
83
87
|
}
|
|
84
88
|
if (!isServer()) {
|
|
85
89
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
86
|
-
if (stored === "dark" || stored === "light" || stored === "auto") {
|
|
90
|
+
if (stored === "dark" || stored === "light" || stored === "inverted" || stored === "auto") {
|
|
87
91
|
colorScheme.value = stored;
|
|
88
92
|
updateStorages();
|
|
89
93
|
}
|
|
@@ -14,18 +14,18 @@ export function useCountdown(props, emits) {
|
|
|
14
14
|
const end = formatTime(endTime) - Date.now();
|
|
15
15
|
return Math.max(0, end);
|
|
16
16
|
}
|
|
17
|
-
if (props.
|
|
17
|
+
if (props.inverted && [void 0, 0].includes(durations)) {
|
|
18
18
|
return Infinity;
|
|
19
19
|
}
|
|
20
20
|
return Math.max(0, formatTime(durations ?? 0));
|
|
21
21
|
});
|
|
22
|
-
const isInfiniteCountup = computed(() => props.
|
|
22
|
+
const isInfiniteCountup = computed(() => props.inverted && totalDuration.value === Infinity);
|
|
23
23
|
function formatTime(time = 0) {
|
|
24
24
|
return props.millisecond ? Math.round(time) : Math.round(time * 1e3);
|
|
25
25
|
}
|
|
26
26
|
function getCurrent(now) {
|
|
27
|
-
const rawCurrent = props.
|
|
28
|
-
if (props.intuitive && !props.
|
|
27
|
+
const rawCurrent = props.inverted ? now - startTimestamp : totalDuration.value + startTimestamp - now;
|
|
28
|
+
if (props.intuitive && !props.inverted && rawCurrent > 0) {
|
|
29
29
|
const seconds = Math.ceil(rawCurrent / 1e3);
|
|
30
30
|
return Math.max(0, seconds * 1e3);
|
|
31
31
|
}
|
|
@@ -33,7 +33,7 @@ export function useCountdown(props, emits) {
|
|
|
33
33
|
}
|
|
34
34
|
function setCurrent() {
|
|
35
35
|
const startAtValue = formatTime(props.startAt);
|
|
36
|
-
if (props.
|
|
36
|
+
if (props.inverted) {
|
|
37
37
|
timeRef.value = isInfiniteCountup.value ? startAtValue : Math.min(startAtValue, totalDuration.value);
|
|
38
38
|
} else {
|
|
39
39
|
const rawTime = Math.max(0, totalDuration.value - startAtValue);
|
|
@@ -46,7 +46,7 @@ export function useCountdown(props, emits) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
function shouldFinish(current) {
|
|
49
|
-
if (!props.
|
|
49
|
+
if (!props.inverted) {
|
|
50
50
|
if (props.intuitive) {
|
|
51
51
|
const actualCurrent = totalDuration.value + startTimestamp - performance.now();
|
|
52
52
|
return actualCurrent <= 0;
|
|
@@ -56,7 +56,7 @@ export function useCountdown(props, emits) {
|
|
|
56
56
|
return !isInfiniteCountup.value && current >= totalDuration.value;
|
|
57
57
|
}
|
|
58
58
|
function finish() {
|
|
59
|
-
timeRef.value = props.
|
|
59
|
+
timeRef.value = props.inverted ? totalDuration.value : 0;
|
|
60
60
|
isFinished = true;
|
|
61
61
|
emits("finish");
|
|
62
62
|
}
|
|
@@ -91,7 +91,7 @@ export function useCountdown(props, emits) {
|
|
|
91
91
|
finish();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (props.
|
|
94
|
+
if (props.inverted) {
|
|
95
95
|
timeRef.value = isInfiniteCountup.value ? current : Math.min(current, totalDuration.value);
|
|
96
96
|
} else {
|
|
97
97
|
timeRef.value = Math.max(0, current);
|
|
@@ -105,7 +105,7 @@ export function useCountdown(props, emits) {
|
|
|
105
105
|
emits("change", isActive);
|
|
106
106
|
if (isActive) {
|
|
107
107
|
if (isPaused) {
|
|
108
|
-
const elapsed = props.
|
|
108
|
+
const elapsed = props.inverted ? timeRef.value : totalDuration.value - timeRef.value;
|
|
109
109
|
startTimestamp = performance.now() - elapsed;
|
|
110
110
|
} else {
|
|
111
111
|
startTimestamp = performance.now() - formatTime(props.startAt);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { isServer } from "../utils/is.js";
|
|
1
2
|
export const UPDATE_LOADING_BAR_EVENT_NAME = "#update-loading-bar";
|
|
2
3
|
export function useLoadingBar(options) {
|
|
4
|
+
if (isServer()) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
3
7
|
window.dispatchEvent(new CustomEvent(UPDATE_LOADING_BAR_EVENT_NAME, { detail: options }));
|
|
4
8
|
}
|
|
5
9
|
useLoadingBar.start = function(group = "default") {
|
|
@@ -28,5 +28,10 @@ export interface UseStickToBottomReturn {
|
|
|
28
28
|
*
|
|
29
29
|
* Auto-scroll is always instant to avoid smooth-animation races that
|
|
30
30
|
* break continuous follow in chat-style lists.
|
|
31
|
+
*
|
|
32
|
+
* Only an upward scroll breaks follow. Every other scroll event is either
|
|
33
|
+
* this composable's own stick or a browser adjustment (scroll anchoring,
|
|
34
|
+
* focus scrolling), and re-measuring the live distance there would latch
|
|
35
|
+
* `isAtBottom` off mid-stream — so it may only promote the state back on.
|
|
31
36
|
*/
|
|
32
37
|
export declare function useStickToBottom(container: MaybeRefOrGetter<Nullable<HTMLElement>>, content?: MaybeRefOrGetter<Nullable<HTMLElement>>, options?: UseStickToBottomOptions): UseStickToBottomReturn;
|