@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.
Files changed (32) hide show
  1. package/dist/components/breadcrumb/CoarBreadcrumb.vue.d.ts +11 -0
  2. package/dist/components/breadcrumb/CoarBreadcrumb.vue.d.ts.map +1 -1
  3. package/dist/components/breadcrumb/index.d.ts +1 -0
  4. package/dist/components/breadcrumb/index.d.ts.map +1 -1
  5. package/dist/components/icon/core-icons.d.ts +8 -0
  6. package/dist/components/icon/core-icons.d.ts.map +1 -1
  7. package/dist/components/sidebar/CoarSidebarDivider.vue.d.ts.map +1 -1
  8. package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts +19 -0
  9. package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts.map +1 -1
  10. package/dist/components/tooltip/vTooltip.d.ts +15 -0
  11. package/dist/components/tooltip/vTooltip.d.ts.map +1 -1
  12. package/dist/components/tree/CoarTree.vue.d.ts +70 -0
  13. package/dist/components/tree/CoarTree.vue.d.ts.map +1 -0
  14. package/dist/components/tree/CoarTreeNode.vue.d.ts +51 -0
  15. package/dist/components/tree/CoarTreeNode.vue.d.ts.map +1 -0
  16. package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts +9 -0
  17. package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts.map +1 -0
  18. package/dist/components/tree/index.d.ts +8 -0
  19. package/dist/components/tree/index.d.ts.map +1 -0
  20. package/dist/components/tree/tree-builder.d.ts +124 -0
  21. package/dist/components/tree/tree-builder.d.ts.map +1 -0
  22. package/dist/components/tree/tree-dnd.d.ts +31 -0
  23. package/dist/components/tree/tree-dnd.d.ts.map +1 -0
  24. package/dist/components/tree/tree-types.d.ts +131 -0
  25. package/dist/components/tree/tree-types.d.ts.map +1 -0
  26. package/dist/components/tree/useTree.d.ts +6 -0
  27. package/dist/components/tree/useTree.d.ts.map +1 -0
  28. package/dist/index.css +1 -1
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3441 -2504
  32. package/package.json +2 -2
@@ -0,0 +1,131 @@
1
+ import { InjectionKey, Ref, Slot } from 'vue';
2
+ /**
3
+ * Public types for `<CoarTree>`.
4
+ *
5
+ * The tree is generic over the consumer's node type `T` — identity, children and
6
+ * label are extracted via prop functions rather than imposed by a fixed shape.
7
+ * This lets the same tree render file systems, navigation hierarchies, settings
8
+ * trees, org charts, etc. without forcing a common base type.
9
+ */
10
+ /** Where a drop lands relative to a target node. */
11
+ export type CoarTreeDropPosition = 'before' | 'inside' | 'after';
12
+ /** Payload for {@link CoarTreeEmits.node-move}. */
13
+ export interface CoarTreeNodeMoveEvent<T> {
14
+ /** Node being moved. */
15
+ source: T;
16
+ /**
17
+ * Sibling / parent the drop is relative to. `null` means the drop landed on
18
+ * the empty tree-pane background — typically interpreted as "move to root".
19
+ */
20
+ target: T | null;
21
+ /** Where the drop landed relative to `target`. With `target: null` only `'inside'` is meaningful. */
22
+ position: CoarTreeDropPosition;
23
+ }
24
+ /** Payload for {@link CoarTreeEmits.files-drop}. */
25
+ export interface CoarTreeFilesDropEvent<T> {
26
+ /** Files from the OS drag-drop. */
27
+ files: FileList;
28
+ /** Folder the drop landed on, or `null` for the tree background (root). */
29
+ target: T | null;
30
+ }
31
+ /** Context exposed to the default slot for rendering a row body. */
32
+ export interface CoarTreeNodeSlotProps<T> {
33
+ node: T;
34
+ /** Nesting depth — 0 for root nodes. */
35
+ depth: number;
36
+ isExpanded: boolean;
37
+ isSelected: boolean;
38
+ isFocused: boolean;
39
+ isExpandable: boolean;
40
+ /**
41
+ * True while THIS row is in inline-rename mode (only meaningful when
42
+ * `<CoarTree :renamable>` is on). Useful for hiding hover-actions etc.
43
+ * while the user is typing the new name.
44
+ */
45
+ isRenaming: boolean;
46
+ }
47
+ /** Payload for {@link CoarTreeEmits.rename}. */
48
+ export interface CoarTreeRenameEvent<T> {
49
+ node: T;
50
+ newName: string;
51
+ }
52
+ /**
53
+ * Custom MIME type used to encode an internal node drag in `DataTransfer`.
54
+ * Lets `dragover` distinguish internal moves from OS-file drags without
55
+ * relying on `getData()` (which is unavailable during dragover).
56
+ */
57
+ export declare const COAR_TREE_DRAG_MIME = "application/x-coar-tree-node";
58
+ /**
59
+ * Internal injection key — `<CoarTree>` provides its row-rendering slot here so
60
+ * the recursive `<CoarTreeNode>` can render it without passing the slot down
61
+ * through prop drilling (Vue's `Slot<T>` type doesn't compose cleanly with
62
+ * `defineSlots`-typed slots in generic components).
63
+ */
64
+ export declare const COAR_TREE_NODE_SLOT_KEY: InjectionKey<Slot<CoarTreeNodeSlotProps<any>>>;
65
+ /**
66
+ * Internal injection key — `<CoarTreeNode>` provides its row id so
67
+ * `<CoarTreeNodeLabel>` (and any future row-scoped helper) can read it
68
+ * without explicit prop wiring from the consumer.
69
+ */
70
+ export declare const COAR_TREE_ROW_ID_KEY: InjectionKey<string>;
71
+ /**
72
+ * The rename machinery `<CoarTree :renamable>` provides to descendants.
73
+ * `<CoarTreeNodeLabel>` consumes this; consumers normally never see it
74
+ * directly — they just drop `<CoarTreeNodeLabel :node :label>` into the
75
+ * default slot.
76
+ */
77
+ export interface CoarTreeRenameContext {
78
+ /** Id of the row currently in rename mode, or `null` if none. */
79
+ readonly renamingId: Readonly<Ref<string | null>>;
80
+ /** Two-way buffer for the input — `v-model` it on the rename input. */
81
+ readonly buffer: Ref<string>;
82
+ /** Commit the current buffer. Tree emits `@rename` then clears state. */
83
+ commit: () => void;
84
+ /** Drop the buffer, leave the original name as-is. */
85
+ cancel: () => void;
86
+ /** Wired to the rename input's `@focus`. Starts the blur grace timer. */
87
+ onFocus: () => void;
88
+ /** Wired to the rename input's `@blur`. Commits after the grace period. */
89
+ onBlur: () => void;
90
+ }
91
+ export declare const COAR_TREE_RENAME_KEY: InjectionKey<CoarTreeRenameContext>;
92
+ /**
93
+ * One entry in a builder-driven context menu. `'divider'` is the only string
94
+ * literal allowed — everything else is an object with `label` + `onClick`.
95
+ */
96
+ export type CoarTreeMenuEntry = CoarTreeMenuItem | 'divider';
97
+ /**
98
+ * Options for `<CoarTree :virtualize>` / `builder.virtualize(...)`.
99
+ *
100
+ * `useVirtualList` is a *fixed-known-size* virtualizer (no DOM auto-measure),
101
+ * so the consumer must declare row heights up front. The default of 28px
102
+ * matches the standard row layout (13px text + 6px vertical padding); change
103
+ * `itemSize` to match if the slot adds extra padding or multi-line content.
104
+ */
105
+ export interface CoarTreeVirtualOptions {
106
+ /**
107
+ * Row height in pixels. Either a constant, or a function returning the
108
+ * height for the visible-row at the given index. Default: 28.
109
+ */
110
+ itemSize?: number | ((index: number) => number);
111
+ /** Rows rendered above/below the viewport as a scroll buffer. Default: 5. */
112
+ overscan?: number;
113
+ }
114
+ /**
115
+ * Prop shorthand: pass `true` to enable virtualization with defaults, an
116
+ * object to customize, or omit / `false` to disable.
117
+ */
118
+ export type CoarTreeVirtualizeProp = boolean | CoarTreeVirtualOptions;
119
+ export interface CoarTreeMenuItem {
120
+ /** Visible label. Required (use `disabled: true` if the item is a placeholder). */
121
+ label: string;
122
+ /** Optional icon name — passed through to `<CoarMenuItem :icon>`. */
123
+ icon?: string;
124
+ /** Marks the item as destructive (red text on hover). */
125
+ danger?: boolean;
126
+ /** Grays the item out and disables clicks. */
127
+ disabled?: boolean;
128
+ /** Invoked on click. The tree closes the menu automatically afterwards. */
129
+ onClick: () => void;
130
+ }
131
+ //# sourceMappingURL=tree-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-types.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,mDAAmD;AACnD,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,wBAAwB;IACxB,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,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E;IACzE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,sDAAsD;IACtD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,qBAAqB,CACzC,CAAC;AAM7B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAM7D;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAChD,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,sBAAsB,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
@@ -0,0 +1,6 @@
1
+ import { TreeBuilder, TreeApi } from './tree-builder';
2
+ export declare function useTree<T>(): {
3
+ builder: TreeBuilder<T>;
4
+ api: TreeApi;
5
+ };
6
+ //# sourceMappingURL=useTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTree.d.ts","sourceRoot":"","sources":["../../../src/components/tree/useTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE3D,wBAAgB,OAAO,CAAC,CAAC,KAAK;IAC5B,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC;CACd,CAGA"}