nuance-ui 0.1.61 → 0.1.62
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/module.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { NuanceColor } from '@nui/types';
|
|
2
|
-
import type {
|
|
3
|
-
import type { FetchError } from 'ofetch';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
4
3
|
export interface TreeModels {
|
|
5
4
|
active: string | null;
|
|
6
5
|
tree: TreeItem[];
|
|
@@ -10,11 +9,29 @@ export interface TreeModels {
|
|
|
10
9
|
export interface TreeEmits {
|
|
11
10
|
delete: [path: string[]];
|
|
12
11
|
}
|
|
12
|
+
export interface TreeLoaderResult {
|
|
13
|
+
data: Ref<TreeItem[] | undefined>;
|
|
14
|
+
pending: Ref<boolean>;
|
|
15
|
+
execute: () => Promise<unknown>;
|
|
16
|
+
}
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Root path will be queried
|
|
18
|
+
* Returns an object with `data`, `pending`, and `execute` fields.
|
|
19
|
+
* Root path will be queried immediately with path `/`.
|
|
20
|
+
*
|
|
21
|
+
* @example Nuxt
|
|
22
|
+
* ```ts
|
|
23
|
+
* const loadBranch = (path: string) => useAsyncData(path, () => $fetch(`/api/tree${path}`), { immediate: false })
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example vue-query
|
|
27
|
+
* ```ts
|
|
28
|
+
* const loadBranch = (path: string) => {
|
|
29
|
+
* const { data, isPending, refetch } = useQuery({ queryKey: ['tree', path], queryFn: () => fetchTree(path) })
|
|
30
|
+
* return { data, pending: isPending, execute: refetch }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
16
33
|
*/
|
|
17
|
-
export type TreeLoader = (path: string) =>
|
|
34
|
+
export type TreeLoader = (path: string) => TreeLoaderResult;
|
|
18
35
|
export type TreeItemType = 'file' | 'directory';
|
|
19
36
|
export interface TreeItem {
|
|
20
37
|
/** @IconifyIcon */
|