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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.1.61",
7
+ "version": "0.1.62",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,6 +1,5 @@
1
1
  import type { NuanceColor } from '@nui/types';
2
- import type { AsyncData, NuxtError } from '#app';
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
- * Required pass instance of `useFetch`/`useAsyncData` with `{ immediate: false }`
15
- * Root path will be queried immediate with path `/`
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) => AsyncData<TreeItem[] | undefined, FetchError<any> | NuxtError | undefined | null>;
34
+ export type TreeLoader = (path: string) => TreeLoaderResult;
18
35
  export type TreeItemType = 'file' | 'directory';
19
36
  export interface TreeItem {
20
37
  /** @IconifyIcon */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "A UI Library for Modern Web Apps, powered by Vue.",
5
5
  "repository": {
6
6
  "type": "git",