@cocoar/vue-ui 2.2.1 → 2.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/dist/components/breadcrumb/CoarBreadcrumb.vue.d.ts +11 -0
- package/dist/components/breadcrumb/CoarBreadcrumb.vue.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.d.ts +1 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/icon/core-icons.d.ts +8 -0
- package/dist/components/icon/core-icons.d.ts.map +1 -1
- package/dist/components/sidebar/CoarSidebarDivider.vue.d.ts.map +1 -1
- package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts +19 -0
- package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts.map +1 -1
- package/dist/components/tooltip/vTooltip.d.ts +15 -0
- package/dist/components/tooltip/vTooltip.d.ts.map +1 -1
- package/dist/components/tree/CoarTree.vue.d.ts +70 -0
- package/dist/components/tree/CoarTree.vue.d.ts.map +1 -0
- package/dist/components/tree/CoarTreeNode.vue.d.ts +51 -0
- package/dist/components/tree/CoarTreeNode.vue.d.ts.map +1 -0
- package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts +9 -0
- package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +8 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/tree-builder.d.ts +124 -0
- package/dist/components/tree/tree-builder.d.ts.map +1 -0
- package/dist/components/tree/tree-dnd.d.ts +31 -0
- package/dist/components/tree/tree-dnd.d.ts.map +1 -0
- package/dist/components/tree/tree-types.d.ts +131 -0
- package/dist/components/tree/tree-types.d.ts.map +1 -0
- package/dist/components/tree/useTree.d.ts +6 -0
- package/dist/components/tree/useTree.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3441 -2504
- package/package.json +2 -2
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
export type CoarBreadcrumbSize = 'm' | 's';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
/** Separator character between breadcrumb items. */
|
|
3
4
|
separator?: string;
|
|
4
5
|
/** Accessible label for the nav landmark. Localizable. */
|
|
5
6
|
ariaLabel?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Visual density. `'m'` (default, 14 px) is the primary-navigation size.
|
|
9
|
+
* `'s'` (13 px) is for secondary chrome — file-explorer paths, settings
|
|
10
|
+
* trails, anywhere the breadcrumb sits above other content as
|
|
11
|
+
* orientation rather than the main interactive surface. Drives the
|
|
12
|
+
* `--coar-breadcrumb-font-size` token only; spacing + colors stay
|
|
13
|
+
* unchanged so both sizes feel consistent in the same UI.
|
|
14
|
+
*/
|
|
15
|
+
size?: CoarBreadcrumbSize;
|
|
6
16
|
};
|
|
7
17
|
declare function __VLS_template(): {
|
|
8
18
|
attrs: Partial<{}>;
|
|
@@ -14,6 +24,7 @@ declare function __VLS_template(): {
|
|
|
14
24
|
};
|
|
15
25
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
26
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
27
|
+
size: CoarBreadcrumbSize;
|
|
17
28
|
ariaLabel: string;
|
|
18
29
|
separator: string;
|
|
19
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoarBreadcrumb.vue.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/CoarBreadcrumb.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoarBreadcrumb.vue.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/CoarBreadcrumb.vue"],"names":[],"mappings":"AAqEA,MAAM,MAAM,kBAAkB,GAAG,GAAG,GAAG,GAAG,CAAC;AAE3C,KAAK,WAAW,GAAG;IACf,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAYJ,iBAAS,cAAc;WAmCT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;UAhEV,kBAAkB;eATb,MAAM;eAFN,MAAM;qFAmFpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -45,6 +45,7 @@ export declare const CORE_ICONS: {
|
|
|
45
45
|
copy: string;
|
|
46
46
|
database: string;
|
|
47
47
|
download: string;
|
|
48
|
+
'ellipsis-vertical': string;
|
|
48
49
|
ellipsis: string;
|
|
49
50
|
eraser: string;
|
|
50
51
|
'external-link': string;
|
|
@@ -56,9 +57,11 @@ export declare const CORE_ICONS: {
|
|
|
56
57
|
folder: string;
|
|
57
58
|
globe: string;
|
|
58
59
|
'grip-vertical': string;
|
|
60
|
+
hand: string;
|
|
59
61
|
hash: string;
|
|
60
62
|
heading: string;
|
|
61
63
|
heart: string;
|
|
64
|
+
highlighter: string;
|
|
62
65
|
home: string;
|
|
63
66
|
image: string;
|
|
64
67
|
'indent-decrease': string;
|
|
@@ -85,6 +88,8 @@ export declare const CORE_ICONS: {
|
|
|
85
88
|
moon: string;
|
|
86
89
|
'more-horizontal': string;
|
|
87
90
|
'more-vertical': string;
|
|
91
|
+
'mouse-pointer-2': string;
|
|
92
|
+
'move-horizontal': string;
|
|
88
93
|
'move-left': string;
|
|
89
94
|
'move-right': string;
|
|
90
95
|
palette: string;
|
|
@@ -97,6 +102,8 @@ export declare const CORE_ICONS: {
|
|
|
97
102
|
'qr-code': string;
|
|
98
103
|
'redo-2': string;
|
|
99
104
|
'refresh-cw': string;
|
|
105
|
+
'rotate-ccw': string;
|
|
106
|
+
'rotate-cw': string;
|
|
100
107
|
rows: string;
|
|
101
108
|
save: string;
|
|
102
109
|
'scan-line': string;
|
|
@@ -120,6 +127,7 @@ export declare const CORE_ICONS: {
|
|
|
120
127
|
'text-quote': string;
|
|
121
128
|
'trash-2': string;
|
|
122
129
|
'triangle-alert': string;
|
|
130
|
+
type: string;
|
|
123
131
|
'undo-2': string;
|
|
124
132
|
unlink: string;
|
|
125
133
|
unlock: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-icons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/core-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"core-icons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/core-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgItB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoarSidebarDivider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/CoarSidebarDivider.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CoarSidebarDivider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/CoarSidebarDivider.vue"],"names":[],"mappings":";AA+HA,wBAMG"}
|
|
@@ -11,6 +11,21 @@ type __VLS_Props = {
|
|
|
11
11
|
iconOnly?: boolean;
|
|
12
12
|
/** Open flyout on hover instead of click. Only applies to mode="flyout". */
|
|
13
13
|
openOnHover?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Split-trigger mode: clicking the trigger emits `triggerClick` instead
|
|
16
|
+
* of toggling the panel. The flyout opens only via hover (`openOnHover`)
|
|
17
|
+
* or programmatically via `v-model:open`. Use when the trigger represents
|
|
18
|
+
* a primary action (e.g. "activate marker tool") and the panel offers
|
|
19
|
+
* secondary configuration (stroke width, color). Only meaningful with
|
|
20
|
+
* `mode="flyout"`; ignored for `mode="expand"`.
|
|
21
|
+
*/
|
|
22
|
+
splitTrigger?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Visual "selected" state for the trigger — matches `CoarSidebarItem`'s
|
|
25
|
+
* `active` prop styling. Typically driven by the consumer to indicate
|
|
26
|
+
* that the tool this group represents is currently the active one.
|
|
27
|
+
*/
|
|
28
|
+
active?: boolean;
|
|
14
29
|
};
|
|
15
30
|
type __VLS_PublicProps = {
|
|
16
31
|
'open'?: boolean;
|
|
@@ -28,14 +43,18 @@ declare function __VLS_template(): {
|
|
|
28
43
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
44
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
45
|
"update:open": (value: boolean) => any;
|
|
46
|
+
triggerClick: (event: MouseEvent) => any;
|
|
31
47
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
32
48
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
49
|
+
onTriggerClick?: ((event: MouseEvent) => any) | undefined;
|
|
33
50
|
}>, {
|
|
34
51
|
disabled: boolean;
|
|
35
52
|
mode: "expand" | "flyout";
|
|
36
53
|
icon: string;
|
|
54
|
+
active: boolean;
|
|
37
55
|
iconOnly: boolean;
|
|
38
56
|
openOnHover: boolean;
|
|
57
|
+
splitTrigger: boolean;
|
|
39
58
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
40
59
|
triggerRef: HTMLDivElement;
|
|
41
60
|
}, HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoarSidebarGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/CoarSidebarGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoarSidebarGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/CoarSidebarGroup.vue"],"names":[],"mappings":"AA+4BA,KAAK,WAAW,GAAG;IACf,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAuRJ,KAAK,iBAAiB,GAAG;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WAuJT,OAAO,IAA6B;;yBAXpB,GAAG;;;;;;EAgBhC;AA4BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;cA7eN,OAAO;UAEX,QAAQ,GAAG,QAAQ;UAJnB,MAAM;YAuBJ,OAAO;cAjBL,OAAO;iBAEJ,OAAO;kBASN,OAAO;;;kBAwexB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -13,6 +13,21 @@ export interface TooltipOptions {
|
|
|
13
13
|
openDelay?: number;
|
|
14
14
|
/** Close delay in ms. Default: 0 */
|
|
15
15
|
closeDelay?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Only show the tooltip when text is actually truncated.
|
|
18
|
+
*
|
|
19
|
+
* - `true` — check the trigger element itself
|
|
20
|
+
* (`el.scrollWidth > el.clientWidth`).
|
|
21
|
+
* - `string` — treat as a CSS selector on the trigger element and check
|
|
22
|
+
* that descendant's overflow instead. Use this when the tooltip is on a
|
|
23
|
+
* wrapper (so the hover area covers the whole row, including icons) but
|
|
24
|
+
* only the label inside is what gets truncated.
|
|
25
|
+
* - `function` — custom predicate, called with the trigger element on
|
|
26
|
+
* every hover/focus, returning `true` if the tooltip should show.
|
|
27
|
+
*
|
|
28
|
+
* Checked lazily — no `ResizeObserver` overhead. Default: false.
|
|
29
|
+
*/
|
|
30
|
+
onlyOnOverflow?: boolean | string | ((triggerEl: HTMLElement) => boolean);
|
|
16
31
|
}
|
|
17
32
|
type OpenReason = 'hover' | 'focus';
|
|
18
33
|
interface TooltipState {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/vTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAyB,MAAM,KAAK,CAAC;AAGrG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,0BAA0B,CAAC;AAGtE,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/vTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAyB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EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACrC;AAMD;;;;;GAKG;AACH,KAAK,mBAAmB,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AA0N9E,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAErD;AACD,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAED,eAAO,MAAM,QAAQ,EAAE,SAAS,CAAC,WAAW,EAAE,mBAAmB,CAkHhE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CoarTreeDropPosition, CoarTreeFilesDropEvent, CoarTreeNodeMoveEvent, CoarTreeNodeSlotProps, CoarTreeRenameEvent, CoarTreeVirtualizeProp } from './tree-types';
|
|
2
|
+
import { TreeBuilder } from './tree-builder';
|
|
3
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly "onUpdate:expanded"?: ((value: Set<string>) => any) | undefined;
|
|
6
|
+
readonly "onUpdate:selected"?: ((value: string | null) => any) | undefined;
|
|
7
|
+
readonly onActivate?: ((node: T) => any) | undefined;
|
|
8
|
+
readonly "onFiles-drop"?: ((payload: CoarTreeFilesDropEvent<T>) => any) | undefined;
|
|
9
|
+
readonly "onNode-move"?: ((payload: CoarTreeNodeMoveEvent<T>) => any) | undefined;
|
|
10
|
+
readonly onRename?: ((payload: CoarTreeRenameEvent<T>) => any) | undefined;
|
|
11
|
+
readonly "onRename-cancel"?: ((node: T) => any) | undefined;
|
|
12
|
+
readonly "onContext-menu"?: ((node: T | null, ev: MouseEvent) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:expanded" | "onUpdate:selected" | "onActivate" | "onFiles-drop" | "onNode-move" | "onRename" | "onRename-cancel" | "onContext-menu"> & ({
|
|
14
|
+
expanded?: Set<string>;
|
|
15
|
+
selected?: string | null;
|
|
16
|
+
} & {
|
|
17
|
+
/** Fluent builder from `useTree()`. When set, the other config props are ignored. */
|
|
18
|
+
builder?: TreeBuilder<T>;
|
|
19
|
+
nodes?: readonly T[];
|
|
20
|
+
getId?: (node: T) => string;
|
|
21
|
+
getChildren?: (node: T) => readonly T[] | null | undefined;
|
|
22
|
+
getLabel?: (node: T) => string;
|
|
23
|
+
isExpandable?: (node: T) => boolean;
|
|
24
|
+
draggable?: boolean | ((node: T) => boolean);
|
|
25
|
+
canDrop?: (source: T, target: T | null, position: CoarTreeDropPosition) => boolean;
|
|
26
|
+
acceptsFiles?: boolean;
|
|
27
|
+
autoExpandDelay?: number;
|
|
28
|
+
virtualize?: CoarTreeVirtualizeProp;
|
|
29
|
+
/**
|
|
30
|
+
* Opt into the built-in inline rename UI. With this on, `api.startRename(id)`
|
|
31
|
+
* + `@rename` work and `<CoarTreeNodeLabel>` swaps to an `<input>` while the
|
|
32
|
+
* row is renaming. Without it the rename context isn't provided and the
|
|
33
|
+
* label component stays a plain `<span>` (back-compat for existing consumers).
|
|
34
|
+
*/
|
|
35
|
+
renamable?: boolean;
|
|
36
|
+
}) & Partial<{}>> & import('vue').PublicProps;
|
|
37
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
38
|
+
focusNode(id: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Enter inline-rename mode on `id`. No-op if `:renamable` isn't set or
|
|
41
|
+
* the id isn't in the visible-row list. Use from context menu items,
|
|
42
|
+
* keyboard shortcuts, etc. The rename input mounts + auto-focuses on
|
|
43
|
+
* the next frame.
|
|
44
|
+
*/
|
|
45
|
+
startRename: (id: string) => void;
|
|
46
|
+
}>): void;
|
|
47
|
+
attrs: any;
|
|
48
|
+
slots: Readonly<{
|
|
49
|
+
default(props: CoarTreeNodeSlotProps<T>): unknown;
|
|
50
|
+
empty(): unknown;
|
|
51
|
+
}> & {
|
|
52
|
+
default(props: CoarTreeNodeSlotProps<T>): unknown;
|
|
53
|
+
empty(): unknown;
|
|
54
|
+
};
|
|
55
|
+
emit: {
|
|
56
|
+
(e: "activate", node: T): void;
|
|
57
|
+
(e: "context-menu", node: T | null, ev: MouseEvent): void;
|
|
58
|
+
(e: "files-drop", payload: CoarTreeFilesDropEvent<T>): void;
|
|
59
|
+
(e: "node-move", payload: CoarTreeNodeMoveEvent<T>): void;
|
|
60
|
+
(e: "rename", payload: CoarTreeRenameEvent<T>): void;
|
|
61
|
+
(e: "rename-cancel", node: T): void;
|
|
62
|
+
} & (((evt: "update:expanded", value: Set<string>) => void) & ((evt: "update:selected", value: string | null) => void));
|
|
63
|
+
}>) => import('vue').VNode & {
|
|
64
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_PrettifyLocal<T> = {
|
|
68
|
+
[K in keyof T]: T[K];
|
|
69
|
+
} & {};
|
|
70
|
+
//# sourceMappingURL=CoarTree.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTree.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTree.vue"],"names":[],"mappings":"AA8gCA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EAExB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAA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AAU,QAAQ,CAAC,GAAG,IAAI;YAC1B,cAAc,QAAQ,CAAC,GAAG,IAAI,MAAM,UAAU,GAAG,IAAI;YACrD,YAAY,WAAW,sBAAsB,CAAC,CAAC,CAAC,GAAG,IAAI;YACvD,WAAW,WAAW,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI;YACrD,QAAQ,WAAW,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI;YAChD,eAAe,QAAQ,CAAC,GAAG,IAAI;2HAyiCM;EAEvC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAlmCzE,wBAkmC4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CoarTreeDropPosition } from './tree-types';
|
|
2
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly "onRow-click"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
5
|
+
readonly "onRow-dblclick"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
6
|
+
readonly "onRow-context-menu"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
7
|
+
readonly "onRow-dragstart"?: ((node: T, ev: DragEvent) => any) | undefined;
|
|
8
|
+
readonly "onChevron-click"?: ((node: T) => any) | undefined;
|
|
9
|
+
readonly "onRow-dragend"?: ((node: T) => any) | undefined;
|
|
10
|
+
readonly "onRow-dragleave"?: ((node: T, ev: DragEvent) => any) | undefined;
|
|
11
|
+
readonly "onRow-dragover"?: ((node: T, el: HTMLElement, ev: DragEvent) => any) | undefined;
|
|
12
|
+
readonly "onRow-drop"?: ((node: T, el: HTMLElement, ev: DragEvent) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onRow-click" | "onRow-dblclick" | "onRow-context-menu" | "onRow-dragstart" | "onChevron-click" | "onRow-dragend" | "onRow-dragleave" | "onRow-dragover" | "onRow-drop"> & {
|
|
14
|
+
node: T;
|
|
15
|
+
nodeId: string;
|
|
16
|
+
depth: number;
|
|
17
|
+
isExpandable: boolean;
|
|
18
|
+
isExpanded: boolean;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
isFocused: boolean;
|
|
21
|
+
isRenaming: boolean;
|
|
22
|
+
draggable: boolean;
|
|
23
|
+
posInSet: number;
|
|
24
|
+
setSize: number;
|
|
25
|
+
/** Drop-position indicator when an internal drag is over this row. */
|
|
26
|
+
dropIndicator: CoarTreeDropPosition | null;
|
|
27
|
+
/** Whole-row highlight when an OS file drag is over this folder. */
|
|
28
|
+
fileDropActive: boolean;
|
|
29
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
30
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
31
|
+
attrs: any;
|
|
32
|
+
slots: {};
|
|
33
|
+
emit: {
|
|
34
|
+
(e: "row-click", node: T, ev: MouseEvent): void;
|
|
35
|
+
(e: "row-dblclick", node: T, ev: MouseEvent): void;
|
|
36
|
+
(e: "row-context-menu", node: T, ev: MouseEvent): void;
|
|
37
|
+
(e: "chevron-click", node: T): void;
|
|
38
|
+
(e: "row-dragstart", node: T, ev: DragEvent): void;
|
|
39
|
+
(e: "row-dragend", node: T): void;
|
|
40
|
+
(e: "row-dragover", node: T, el: HTMLElement, ev: DragEvent): void;
|
|
41
|
+
(e: "row-dragleave", node: T, ev: DragEvent): void;
|
|
42
|
+
(e: "row-drop", node: T, el: HTMLElement, ev: DragEvent): void;
|
|
43
|
+
};
|
|
44
|
+
}>) => import('vue').VNode & {
|
|
45
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
46
|
+
};
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_PrettifyLocal<T> = {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} & {};
|
|
51
|
+
//# sourceMappingURL=CoarTreeNode.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTreeNode.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTreeNode.vue"],"names":[],"mappings":"AAkOA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;yBAEL,CAAC,EACjB,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAuNO,mBAAmB,CAAC;;;;;;;;;;;cArNpB,CAAC;gBACC,MAAM;eACP,MAAM;sBACC,OAAO;oBACT,OAAO;oBACP,OAAO;mBACR,OAAO;oBACN,OAAO;mBACR,OAAO;kBACR,MAAM;iBACP,MAAM;QACf,sEAAsE;uBACvD,oBAAoB,GAAG,IAAI;QAC1C,oEAAoE;wBACpD,OAAO;mBAuMqE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YA/LL,WAAW,QAAQ,CAAC,MAAM,UAAU,GAAG,IAAI;YAC3C,cAAc,QAAQ,CAAC,MAAM,UAAU,GAAG,IAAI;YAC9C,kBAAkB,QAAQ,CAAC,MAAM,UAAU,GAAG,IAAI;YAClD,eAAe,QAAQ,CAAC,GAAG,IAAI;YAC/B,eAAe,QAAQ,CAAC,MAAM,SAAS,GAAG,IAAI;YAC9C,aAAa,QAAQ,CAAC,GAAG,IAAI;YAC7B,cAAc,QAAQ,CAAC,MAAM,WAAW,MAAM,SAAS,GAAG,IAAI;YAC9D,eAAe,QAAQ,CAAC,MAAM,SAAS,GAAG,IAAI;YAC9C,UAAU,QAAQ,CAAC,MAAM,WAAW,MAAM,SAAS,GAAG,IAAI;;EA2L5D,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAlOzE,wBAkO4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** What to render when not renaming — typically the node's name. */
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
6
|
+
inputEl: HTMLInputElement;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=CoarTreeNodeLabel.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTreeNodeLabel.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTreeNodeLabel.vue"],"names":[],"mappings":"AAsHA,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;;;;AAyGF,wBAOG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as CoarTree } from './CoarTree.vue';
|
|
2
|
+
export { default as CoarTreeNodeLabel } from './CoarTreeNodeLabel.vue';
|
|
3
|
+
export type { CoarTreeDropPosition, CoarTreeFilesDropEvent, CoarTreeNodeMoveEvent, CoarTreeNodeSlotProps, CoarTreeRenameContext, CoarTreeRenameEvent, CoarTreeMenuItem, CoarTreeMenuEntry, } from './tree-types';
|
|
4
|
+
export { COAR_TREE_DRAG_MIME, COAR_TREE_RENAME_KEY, COAR_TREE_ROW_ID_KEY } from './tree-types';
|
|
5
|
+
export { useTree } from './useTree';
|
|
6
|
+
export { TreeBuilder } from './tree-builder';
|
|
7
|
+
export type { TreeApi, TreeBuilderState } from './tree-builder';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { CoarTreeDropPosition, CoarTreeFilesDropEvent, CoarTreeMenuEntry, CoarTreeNodeMoveEvent, CoarTreeVirtualizeProp } from './tree-types';
|
|
3
|
+
/**
|
|
4
|
+
* Internal mutable state owned by the builder. Held as `shallowReactive` so
|
|
5
|
+
* mid-session mutations (e.g. `builder.draggable(true)` after mount) trigger
|
|
6
|
+
* the component to re-evaluate.
|
|
7
|
+
*/
|
|
8
|
+
export interface TreeBuilderState<T> {
|
|
9
|
+
nodes: MaybeRefOrGetter<readonly T[]>;
|
|
10
|
+
getId: (n: T) => string;
|
|
11
|
+
getChildren?: (n: T) => readonly T[] | null | undefined;
|
|
12
|
+
getLabel?: (n: T) => string;
|
|
13
|
+
isExpandable?: (n: T) => boolean;
|
|
14
|
+
draggable: MaybeRefOrGetter<boolean | ((n: T) => boolean)>;
|
|
15
|
+
canDrop?: (s: T, t: T | null, p: CoarTreeDropPosition) => boolean;
|
|
16
|
+
acceptsFiles: MaybeRefOrGetter<boolean>;
|
|
17
|
+
autoExpandDelay: MaybeRefOrGetter<number>;
|
|
18
|
+
virtualize: MaybeRefOrGetter<CoarTreeVirtualizeProp>;
|
|
19
|
+
expanded: Ref<Set<string>>;
|
|
20
|
+
selected: Ref<string | null>;
|
|
21
|
+
onActivate?: (node: T) => void;
|
|
22
|
+
onNodeMove?: (e: CoarTreeNodeMoveEvent<T>) => void;
|
|
23
|
+
onFilesDrop?: (e: CoarTreeFilesDropEvent<T>) => void;
|
|
24
|
+
/** Declarative menus — `<CoarTree>` renders the menu itself when these are set. */
|
|
25
|
+
folderMenu?: (folder: T) => readonly CoarTreeMenuEntry[];
|
|
26
|
+
leafMenu?: (leaf: T) => readonly CoarTreeMenuEntry[];
|
|
27
|
+
viewportMenu?: () => readonly CoarTreeMenuEntry[];
|
|
28
|
+
/** Event variants — escape hatch. If set, the declarative menu for the same target is bypassed. */
|
|
29
|
+
onFolderContextMenu?: (folder: T, ev: MouseEvent) => void;
|
|
30
|
+
onLeafContextMenu?: (leaf: T, ev: MouseEvent) => void;
|
|
31
|
+
onViewportContextMenu?: (ev: MouseEvent) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Public, narrow imperative interface returned by `useTree().api`. Keeps
|
|
35
|
+
* component refs out of consumer code: you call `api.focusNode('x')` instead
|
|
36
|
+
* of digging into a template ref. Readonly refs (`selectedId`, `expandedIds`)
|
|
37
|
+
* mirror the builder state so consumers can `watch()` them without owning
|
|
38
|
+
* the writable refs themselves.
|
|
39
|
+
*/
|
|
40
|
+
export interface TreeApi {
|
|
41
|
+
/** Programmatically move focus + selection to a node. No-op until `<CoarTree>` is mounted. */
|
|
42
|
+
focusNode(id: string): void;
|
|
43
|
+
/** Selected node id (read-only). */
|
|
44
|
+
readonly selectedId: Ref<string | null>;
|
|
45
|
+
/** Currently expanded ids (read-only). */
|
|
46
|
+
readonly expandedIds: Ref<Set<string>>;
|
|
47
|
+
}
|
|
48
|
+
export declare class TreeBuilder<T> {
|
|
49
|
+
readonly state: TreeBuilderState<T>;
|
|
50
|
+
readonly api: TreeApi;
|
|
51
|
+
private _focusNodeImpl;
|
|
52
|
+
private constructor();
|
|
53
|
+
/** Factory — keeps construction sites consistent across call sites. */
|
|
54
|
+
static create<T>(): TreeBuilder<T>;
|
|
55
|
+
/** Root nodes. Accepts a `Ref`, getter, or plain array. */
|
|
56
|
+
nodes(source: MaybeRefOrGetter<readonly T[]>): this;
|
|
57
|
+
getId(fn: (n: T) => string): this;
|
|
58
|
+
getChildren(fn: (n: T) => readonly T[] | null | undefined): this;
|
|
59
|
+
/** Label extractor — used by type-ahead keyboard navigation. */
|
|
60
|
+
getLabel(fn: (n: T) => string): this;
|
|
61
|
+
/**
|
|
62
|
+
* Override the default "branch if `getChildren` returns an array" rule.
|
|
63
|
+
* Useful for lazy-loaded folders that should render as expandable even
|
|
64
|
+
* before their children are fetched.
|
|
65
|
+
*/
|
|
66
|
+
isExpandable(fn: (n: T) => boolean): this;
|
|
67
|
+
/** Enable internal drag-to-reorder. Accepts a per-node predicate. */
|
|
68
|
+
draggable(d: MaybeRefOrGetter<boolean | ((n: T) => boolean)>): this;
|
|
69
|
+
canDrop(fn: (source: T, target: T | null, position: CoarTreeDropPosition) => boolean): this;
|
|
70
|
+
acceptsFiles(b: MaybeRefOrGetter<boolean>): this;
|
|
71
|
+
autoExpandDelay(ms: MaybeRefOrGetter<number>): this;
|
|
72
|
+
/**
|
|
73
|
+
* Enable virtualization. Pass `true` for defaults (itemSize: 28, overscan: 5)
|
|
74
|
+
* or an object for custom row height / overscan. Required for trees with
|
|
75
|
+
* hundreds+ of visible rows; pure overhead for small trees.
|
|
76
|
+
*
|
|
77
|
+
* When virtualized, the tree owns its scroll container — give it an explicit
|
|
78
|
+
* height (or put it in a sized flex/grid cell) so the viewport is measurable.
|
|
79
|
+
*/
|
|
80
|
+
virtualize(v: MaybeRefOrGetter<CoarTreeVirtualizeProp>): this;
|
|
81
|
+
/**
|
|
82
|
+
* Bind the set of expanded folder ids. Must be a writable `Ref` — `api`
|
|
83
|
+
* and folder toggles need to write back. Getters are rejected at runtime
|
|
84
|
+
* because they would silently lose writes.
|
|
85
|
+
*/
|
|
86
|
+
expanded(r: Ref<Set<string>>): this;
|
|
87
|
+
/** Bind the selected-node id. Must be a writable `Ref<string | null>`. */
|
|
88
|
+
selected(r: Ref<string | null>): this;
|
|
89
|
+
/** Fires on double-click or Enter on the focused row. */
|
|
90
|
+
onActivate(h: (node: T) => void): this;
|
|
91
|
+
/** Fires after an internal drag-drop completes. The consumer mutates the tree. */
|
|
92
|
+
onNodeMove(h: (e: CoarTreeNodeMoveEvent<T>) => void): this;
|
|
93
|
+
/** Fires when OS files are dropped onto a folder or the empty background. */
|
|
94
|
+
onFilesDrop(h: (e: CoarTreeFilesDropEvent<T>) => void): this;
|
|
95
|
+
/**
|
|
96
|
+
* Items shown when right-clicking a folder row. When set (and the
|
|
97
|
+
* `onFolderContextMenu` escape hatch is NOT set), `<CoarTree>` renders a
|
|
98
|
+
* `<CoarContextMenu>` itself — no extra markup needed in your template.
|
|
99
|
+
*
|
|
100
|
+
* Pass an array of `{ label, icon?, danger?, disabled?, onClick }` entries
|
|
101
|
+
* or the literal string `'divider'`.
|
|
102
|
+
*/
|
|
103
|
+
folderMenu(fn: (folder: T) => readonly CoarTreeMenuEntry[]): this;
|
|
104
|
+
/** Same as {@link folderMenu} but for leaf (non-folder) nodes. */
|
|
105
|
+
leafMenu(fn: (leaf: T) => readonly CoarTreeMenuEntry[]): this;
|
|
106
|
+
/**
|
|
107
|
+
* Items shown when right-clicking the empty background of the tree pane.
|
|
108
|
+
* No node argument — there isn't one.
|
|
109
|
+
*/
|
|
110
|
+
viewportMenu(fn: () => readonly CoarTreeMenuEntry[]): this;
|
|
111
|
+
/**
|
|
112
|
+
* Raw `contextmenu` event for folder rows. Overrides {@link folderMenu} —
|
|
113
|
+
* use when you want a fully custom popover (e.g. with form inputs, async
|
|
114
|
+
* sub-menus, or a third-party menu library).
|
|
115
|
+
*/
|
|
116
|
+
onFolderContextMenu(h: (folder: T, ev: MouseEvent) => void): this;
|
|
117
|
+
/** Same as {@link onFolderContextMenu} for leaf rows. Overrides {@link leafMenu}. */
|
|
118
|
+
onLeafContextMenu(h: (leaf: T, ev: MouseEvent) => void): this;
|
|
119
|
+
/** Same as {@link onFolderContextMenu} for the empty background. Overrides {@link viewportMenu}. */
|
|
120
|
+
onViewportContextMenu(h: (ev: MouseEvent) => void): this;
|
|
121
|
+
/** @internal — `<CoarTree>` registers its focus impl on mount. */
|
|
122
|
+
_setFocusNodeImpl(fn: ((id: string) => void) | null): void;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=tree-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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AC,KAAK,IAAI,GAAG,IAAI;IAKtC,kFAAkF;IAClF,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAK1D,6EAA6E;IAC7E,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAO5D;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,SAAS,iBAAiB,EAAE,GAAG,IAAI;IAKjE,kEAAkE;IAClE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,iBAAiB,EAAE,GAAG,IAAI;IAK7D;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,SAAS,iBAAiB,EAAE,GAAG,IAAI;IAO1D;;;;OAIG;IACH,mBAAmB,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAKjE,qFAAqF;IACrF,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAK7D,oGAAoG;IACpG,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAOxD,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;CAG3D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CoarTreeDropPosition } from './tree-types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute where a drop should land relative to a row given the cursor's Y
|
|
4
|
+
* position within that row's bounding box.
|
|
5
|
+
*
|
|
6
|
+
* Default thresholds:
|
|
7
|
+
* - Top 25% of the row → `'before'`
|
|
8
|
+
* - Bottom 25% of the row → `'after'`
|
|
9
|
+
* - Middle 50% → `'inside'` (only if the target is expandable; otherwise
|
|
10
|
+
* clamped to whichever band is closer)
|
|
11
|
+
*
|
|
12
|
+
* For leaf nodes the `'inside'` band is suppressed because dropping into a
|
|
13
|
+
* leaf doesn't make sense. We split the row 50/50 between before/after in
|
|
14
|
+
* that case so the user never gets a "dead zone".
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeDropPosition(event: {
|
|
17
|
+
clientY: number;
|
|
18
|
+
}, rect: {
|
|
19
|
+
top: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, opts: {
|
|
22
|
+
expandable: boolean;
|
|
23
|
+
}): CoarTreeDropPosition;
|
|
24
|
+
/**
|
|
25
|
+
* Detect whether a DataTransfer represents a drag of OS files (vs. an internal
|
|
26
|
+
* tree-node drag). `types` is the only DataTransfer field reliably readable
|
|
27
|
+
* during `dragover` — `getData()` returns an empty string on most browsers
|
|
28
|
+
* until `drop` for security reasons.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isFileDrag(dt: DataTransfer | null): boolean;
|
|
31
|
+
//# sourceMappingURL=tree-dnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-dnd.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-dnd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAC1B,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACrC,IAAI,EAAE;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,GAC5B,oBAAoB,CAWtB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAE3D"}
|