@bazza-ui/react 0.1.0-canary.15 → 0.1.0-canary.17

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 (146) hide show
  1. package/dist/combobox/index.cjs +1 -1
  2. package/dist/combobox/index.cjs.map +1 -1
  3. package/dist/combobox/index.d.ts +842 -834
  4. package/dist/combobox/index.js +1 -1
  5. package/dist/combobox/index.js.map +1 -1
  6. package/dist/command-menu/index.cjs +1 -1
  7. package/dist/command-menu/index.cjs.map +1 -1
  8. package/dist/command-menu/index.d.ts +123 -96
  9. package/dist/command-menu/index.js +1 -1
  10. package/dist/command-menu/index.js.map +1 -1
  11. package/dist/context-menu/index.cjs +1 -1
  12. package/dist/context-menu/index.cjs.map +1 -1
  13. package/dist/context-menu/index.d.ts +701 -658
  14. package/dist/context-menu/index.js +1 -1
  15. package/dist/context-menu/index.js.map +1 -1
  16. package/dist/dropdown-menu/index.cjs +1 -1
  17. package/dist/dropdown-menu/index.cjs.map +1 -1
  18. package/dist/dropdown-menu/index.d.ts +723 -680
  19. package/dist/dropdown-menu/index.js +1 -1
  20. package/dist/dropdown-menu/index.js.map +1 -1
  21. package/dist/events-DDOsDu4X.d.ts +2091 -0
  22. package/dist/index-Cabqj7qI.d.ts +2003 -0
  23. package/dist/index-D8OrKThQ.d.ts +977 -0
  24. package/dist/internal/listbox/index.cjs +1 -2
  25. package/dist/internal/listbox/index.d.ts +2 -272
  26. package/dist/internal/listbox/index.js +1 -2
  27. package/dist/internal/popup-menu/index.cjs +1 -2
  28. package/dist/internal/popup-menu/index.d.ts +4 -238
  29. package/dist/internal/popup-menu/index.js +1 -2
  30. package/dist/items-CD2hw6-3.js +2 -0
  31. package/dist/items-CD2hw6-3.js.map +1 -0
  32. package/dist/items-DYDljwnt.cjs +2 -0
  33. package/dist/items-DYDljwnt.cjs.map +1 -0
  34. package/dist/{items-B6HeFO_8.d.cts → items-ceX--VIv.d.ts} +21 -19
  35. package/dist/kbd/index.cjs +1 -1
  36. package/dist/kbd/index.cjs.map +1 -1
  37. package/dist/kbd/index.d.ts +35 -35
  38. package/dist/kbd/index.js +1 -1
  39. package/dist/kbd/index.js.map +1 -1
  40. package/dist/listbox-CnwUlLZA.js +2 -0
  41. package/dist/listbox-CnwUlLZA.js.map +1 -0
  42. package/dist/listbox-DYvJTiF6.cjs +2 -0
  43. package/dist/listbox-DYvJTiF6.cjs.map +1 -0
  44. package/dist/loaders/index.cjs +1 -1
  45. package/dist/loaders/index.cjs.map +1 -1
  46. package/dist/loaders/index.d.ts +218 -188
  47. package/dist/loaders/index.js +1 -1
  48. package/dist/loaders/index.js.map +1 -1
  49. package/dist/merge-element-props-0mpNO7ZH.cjs +2 -0
  50. package/dist/merge-element-props-0mpNO7ZH.cjs.map +1 -0
  51. package/dist/merge-element-props-PxUvRHax.js +2 -0
  52. package/dist/merge-element-props-PxUvRHax.js.map +1 -0
  53. package/dist/platform-C-sxBTRa.cjs +2 -0
  54. package/dist/platform-C-sxBTRa.cjs.map +1 -0
  55. package/dist/platform-C4_cGUkS.js +2 -0
  56. package/dist/platform-C4_cGUkS.js.map +1 -0
  57. package/dist/popup-menu-BBAzAXIe.cjs +2 -0
  58. package/dist/popup-menu-BBAzAXIe.cjs.map +1 -0
  59. package/dist/popup-menu-HmBMJEZc.js +2 -0
  60. package/dist/popup-menu-HmBMJEZc.js.map +1 -0
  61. package/dist/resolve-state-props-C-zbhdXd.cjs +2 -0
  62. package/dist/resolve-state-props-C-zbhdXd.cjs.map +1 -0
  63. package/dist/resolve-state-props-D31kizRZ.js +2 -0
  64. package/dist/resolve-state-props-D31kizRZ.js.map +1 -0
  65. package/dist/rolldown-runtime-5lHFv1cW.cjs +1 -0
  66. package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
  67. package/dist/select/index.cjs +1 -1
  68. package/dist/select/index.cjs.map +1 -1
  69. package/dist/select/index.d.ts +835 -828
  70. package/dist/select/index.js +1 -1
  71. package/dist/select/index.js.map +1 -1
  72. package/dist/suggestion-menu/index.cjs +4 -0
  73. package/dist/suggestion-menu/index.cjs.map +1 -0
  74. package/dist/suggestion-menu/index.d.ts +359 -0
  75. package/dist/suggestion-menu/index.js +4 -0
  76. package/dist/suggestion-menu/index.js.map +1 -0
  77. package/dist/types-BbN28E3_.d.ts +50 -0
  78. package/dist/video-player/index.cjs +2 -2
  79. package/dist/video-player/index.cjs.map +1 -1
  80. package/dist/video-player/index.d.ts +964 -1000
  81. package/dist/video-player/index.js +2 -2
  82. package/dist/video-player/index.js.map +1 -1
  83. package/package.json +14 -5
  84. package/dist/ListboxStore-B8oTpM57.d.cts +0 -453
  85. package/dist/ListboxStore-CV5vPUUc.d.ts +0 -453
  86. package/dist/chunk-4C666HHU.js +0 -2
  87. package/dist/chunk-4C666HHU.js.map +0 -1
  88. package/dist/chunk-5T5B5SPR.cjs +0 -2
  89. package/dist/chunk-5T5B5SPR.cjs.map +0 -1
  90. package/dist/chunk-A4Z5BY7H.js +0 -2
  91. package/dist/chunk-A4Z5BY7H.js.map +0 -1
  92. package/dist/chunk-BEWVWSAW.cjs +0 -2
  93. package/dist/chunk-BEWVWSAW.cjs.map +0 -1
  94. package/dist/chunk-EDZTZHQ4.js +0 -2
  95. package/dist/chunk-EDZTZHQ4.js.map +0 -1
  96. package/dist/chunk-IT372NHF.js +0 -2
  97. package/dist/chunk-IT372NHF.js.map +0 -1
  98. package/dist/chunk-JFEVUUPC.cjs +0 -2
  99. package/dist/chunk-JFEVUUPC.cjs.map +0 -1
  100. package/dist/chunk-KO3DXT3Y.js +0 -2
  101. package/dist/chunk-KO3DXT3Y.js.map +0 -1
  102. package/dist/chunk-LXXK4S4Q.js +0 -2
  103. package/dist/chunk-LXXK4S4Q.js.map +0 -1
  104. package/dist/chunk-M4G6J7DP.cjs +0 -2
  105. package/dist/chunk-M4G6J7DP.cjs.map +0 -1
  106. package/dist/chunk-SCDHQZFI.cjs +0 -2
  107. package/dist/chunk-SCDHQZFI.cjs.map +0 -1
  108. package/dist/chunk-XMZZ62VJ.cjs +0 -2
  109. package/dist/chunk-XMZZ62VJ.cjs.map +0 -1
  110. package/dist/combobox/index.d.cts +0 -1066
  111. package/dist/command-menu/index.d.cts +0 -154
  112. package/dist/command-score-CTJ9NV6n.d.cts +0 -23
  113. package/dist/command-score-CTJ9NV6n.d.ts +0 -23
  114. package/dist/context-menu/index.d.cts +0 -696
  115. package/dist/dropdown-menu/index.d.cts +0 -723
  116. package/dist/events-BTHQ2OoH.d.ts +0 -1860
  117. package/dist/events-DVcrtGe3.d.cts +0 -1860
  118. package/dist/input-C95v6jB0.d.cts +0 -46
  119. package/dist/input-CYweYB_i.d.ts +0 -46
  120. package/dist/internal/listbox/index.cjs.map +0 -1
  121. package/dist/internal/listbox/index.d.cts +0 -272
  122. package/dist/internal/listbox/index.js.map +0 -1
  123. package/dist/internal/popup-menu/index.cjs.map +0 -1
  124. package/dist/internal/popup-menu/index.d.cts +0 -238
  125. package/dist/internal/popup-menu/index.js.map +0 -1
  126. package/dist/items-B6HeFO_8.d.ts +0 -37
  127. package/dist/kbd/index.d.cts +0 -61
  128. package/dist/loaders/index.d.cts +0 -363
  129. package/dist/loading-C6WZGUc3.d.cts +0 -29
  130. package/dist/loading-CC4n55sR.d.ts +0 -29
  131. package/dist/resolve-B-j0eW24.d.cts +0 -406
  132. package/dist/resolve-B1F-a3P1.d.ts +0 -406
  133. package/dist/scroll-arrow-BBoKckL_.d.cts +0 -544
  134. package/dist/scroll-arrow-fl3B5sVO.d.ts +0 -544
  135. package/dist/select/index.d.cts +0 -1005
  136. package/dist/separator-Dn15rte3.d.ts +0 -275
  137. package/dist/separator-NjsBVzek.d.cts +0 -275
  138. package/dist/surface-context-CGLDpMej.d.ts +0 -14
  139. package/dist/surface-context-CN4Lb_6F.d.cts +0 -14
  140. package/dist/type-guards-BHHzjRvZ.d.cts +0 -351
  141. package/dist/type-guards-C0e_GpeY.d.ts +0 -351
  142. package/dist/types-DT4FOOa2.d.cts +0 -51
  143. package/dist/types-DT4FOOa2.d.ts +0 -51
  144. package/dist/use-listbox-item-NzZuY34-.d.cts +0 -212
  145. package/dist/use-listbox-item-NzZuY34-.d.ts +0 -212
  146. package/dist/video-player/index.d.cts +0 -1391
@@ -1,119 +1,126 @@
1
- import * as React from 'react';
2
- import { N as NodeDef, ai as InitialQueryBehavior, ap as LoaderComponentProps, ar as QueryLoaderConfig, aF as StaticLoaderConfig, U as AsyncLoaderResult } from '../events-BTHQ2OoH.js';
3
- import '../types-DT4FOOa2.js';
4
-
1
+ import { J as InitialQueryBehavior, h as AsyncLoaderResult, it as QueryLoaderConfig, nt as NodeDef, tt as LoaderComponentProps, vt as StaticLoaderConfig } from "../events-DDOsDu4X.js";
2
+ import * as React from "react";
3
+ //#region src/loaders/swr.d.ts
5
4
  /**
6
5
  * SWR result shape (subset of SWRResponse).
7
6
  * This allows the adapter to work without requiring `swr` as a dependency.
8
7
  */
9
8
  interface SWRResult<TData, TError = Error> {
10
- data: TData | undefined;
11
- error: TError | undefined;
12
- isLoading?: boolean;
13
- isValidating: boolean;
14
- isPaused?: boolean;
15
- mutate: (...args: unknown[]) => unknown;
9
+ data: TData | undefined;
10
+ error: TError | undefined;
11
+ isLoading?: boolean;
12
+ isValidating: boolean;
13
+ isPaused?: boolean;
14
+ mutate: (...args: unknown[]) => unknown;
16
15
  }
17
16
  /**
18
17
  * Converts an SWR result to an AsyncLoaderResult.
19
18
  */
20
- declare function toAsyncLoaderResultFromSWR<TData, TError = Error>(result: SWRResult<TData, TError>): AsyncLoaderResult<TData, SWRResult<TData, TError>>;
19
+ export declare function toAsyncLoaderResultFromSWR<TData, TError = Error>(result: SWRResult<TData, TError>): AsyncLoaderResult<TData, SWRResult<TData, TError>>;
21
20
  /**
22
21
  * Props for creating a static SWR loader component.
23
22
  */
24
23
  interface CreateSWRStaticLoaderProps {
25
- /** Hook that returns an SWR result. */
26
- useSWR: () => SWRResult<NodeDef[]>;
27
- /**
28
- * When to trigger the loader:
29
- * - 'eager': Load when root menu opens
30
- * - 'lazy': Load when submenu opens (default)
31
- */
32
- loadStrategy?: 'eager' | 'lazy';
24
+ /** Hook that returns an SWR result. */
25
+ useSWR: () => SWRResult<NodeDef[]>;
26
+ /**
27
+ * When to trigger the loader:
28
+ * - 'eager': Load when root menu opens
29
+ * - 'lazy': Load when submenu opens (default)
30
+ */
31
+ loadStrategy?: 'eager' | 'lazy';
33
32
  }
34
33
  /**
35
34
  * Creates a static loader configuration backed by SWR.
36
35
  */
37
- declare function createSWRStaticLoader(props: CreateSWRStaticLoaderProps): StaticLoaderConfig;
36
+ export declare function createSWRStaticLoader(props: CreateSWRStaticLoaderProps): StaticLoaderConfig;
38
37
  /**
39
38
  * Props for creating a query SWR loader component.
40
39
  */
41
40
  interface CreateSWRQueryLoaderProps {
42
- /**
43
- * Hook that returns an SWR result based on the search query.
44
- * `options.enabled` can be used to derive a `null` key and disable fetching.
45
- */
46
- useSWR: (query: string, options?: {
47
- enabled: boolean;
48
- }) => SWRResult<NodeDef[]>;
49
- /**
50
- * Minimum query length before fetching.
51
- * @default 1
52
- */
53
- minQueryLength?: number;
54
- /**
55
- * Initial query behavior before user input reaches minQueryLength.
56
- * Defaults to fetching with an empty query.
57
- */
58
- initialQueryBehavior?: InitialQueryBehavior | false;
59
- /**
60
- * @deprecated Use `initialQueryBehavior` instead.
61
- */
62
- initialQuery?: string;
63
- /**
64
- * When to trigger the loader:
65
- * - 'eager': Load when root menu opens (good for deep search)
66
- * - 'lazy': Load when submenu opens (default)
67
- * @default 'lazy'
68
- */
69
- loadStrategy?: 'eager' | 'lazy';
70
- /**
71
- * What to show when query is below minQueryLength.
72
- * @default 'empty'
73
- */
74
- belowMinBehavior?: 'empty' | 'placeholder';
75
- /**
76
- * Placeholder nodes shown when query is below minQueryLength.
77
- */
78
- placeholderNodes?: NodeDef[];
41
+ /**
42
+ * Hook that returns an SWR result based on the search query.
43
+ * `options.enabled` can be used to derive a `null` key and disable fetching.
44
+ */
45
+ useSWR: (query: string, options?: {
46
+ enabled: boolean;
47
+ }) => SWRResult<NodeDef[]>;
48
+ /**
49
+ * Minimum query length before fetching.
50
+ * @default 1
51
+ */
52
+ minQueryLength?: number;
53
+ /**
54
+ * Initial query behavior before user input reaches minQueryLength.
55
+ * Defaults to fetching with an empty query.
56
+ */
57
+ initialQueryBehavior?: InitialQueryBehavior | false;
58
+ /**
59
+ * @deprecated Use `initialQueryBehavior` instead.
60
+ */
61
+ initialQuery?: string;
62
+ /**
63
+ * When to trigger the loader:
64
+ * - 'eager': Load when root menu opens (good for deep search)
65
+ * - 'lazy': Load when submenu opens (default)
66
+ * @default 'lazy'
67
+ */
68
+ loadStrategy?: 'eager' | 'lazy';
69
+ /**
70
+ * What to show when query is below minQueryLength.
71
+ * @default 'empty'
72
+ */
73
+ belowMinBehavior?: 'empty' | 'placeholder';
74
+ /**
75
+ * Placeholder nodes shown when query is below minQueryLength.
76
+ */
77
+ placeholderNodes?: NodeDef[];
78
+ /**
79
+ * Milliseconds to wait after the search stops changing before passing it to
80
+ * the loader. While waiting, the loader counts as fetching, so the menu
81
+ * doesn't show "no results" or treat the search as finished too early.
82
+ * @default 0
83
+ */
84
+ debounce?: number;
79
85
  }
80
86
  /**
81
87
  * Creates a query loader configuration backed by SWR.
82
88
  */
83
- declare function createSWRQueryLoader(props: CreateSWRQueryLoaderProps): QueryLoaderConfig;
89
+ export declare function createSWRQueryLoader(props: CreateSWRQueryLoaderProps): QueryLoaderConfig;
84
90
  /**
85
91
  * Creates a loader component that wraps an SWR hook.
86
92
  */
87
- declare function createSWRLoaderComponent(useSWRFn: (query: string) => SWRResult<NodeDef[]>): React.FC<LoaderComponentProps>;
88
-
93
+ export declare function createSWRLoaderComponent(useSWRFn: (query: string) => SWRResult<NodeDef[]>): React.FC<LoaderComponentProps>;
94
+ //#endregion
95
+ //#region src/loaders/tanstack-query.d.ts
89
96
  /**
90
97
  * TanStack Query result shape (subset of UseQueryResult).
91
98
  * This allows the adapter to work without requiring @tanstack/react-query as a dependency.
92
99
  */
93
100
  interface TanStackQueryResult<TData, TError = Error> {
94
- /** TanStack status (`pending` | `error` | `success`) */
95
- status?: 'pending' | 'error' | 'success';
96
- /** TanStack fetch status (`fetching` | `paused` | `idle`) */
97
- fetchStatus?: 'fetching' | 'paused' | 'idle';
98
- data: TData | undefined;
99
- error: TError | null | undefined;
100
- /** v5: true when first fetch is in-flight */
101
- isLoading?: boolean;
102
- /** v5: true when status is pending */
103
- isPending?: boolean;
104
- /** true when status is success */
105
- isSuccess?: boolean;
106
- /** true when status is error */
107
- isError?: boolean;
108
- /** true while any fetch is in-flight */
109
- isFetching?: boolean;
110
- /** true while background refetch is in-flight */
111
- isRefetching?: boolean;
112
- /** true when fetch is paused */
113
- isPaused?: boolean;
114
- /** true once query has fetched at least once */
115
- isFetched?: boolean;
116
- refetch: () => unknown;
101
+ /** TanStack status (`pending` | `error` | `success`) */
102
+ status?: 'pending' | 'error' | 'success';
103
+ /** TanStack fetch status (`fetching` | `paused` | `idle`) */
104
+ fetchStatus?: 'fetching' | 'paused' | 'idle';
105
+ data: TData | undefined;
106
+ error: TError | null | undefined;
107
+ /** v5: true when first fetch is in-flight */
108
+ isLoading?: boolean;
109
+ /** v5: true when status is pending */
110
+ isPending?: boolean;
111
+ /** true when status is success */
112
+ isSuccess?: boolean;
113
+ /** true when status is error */
114
+ isError?: boolean;
115
+ /** true while any fetch is in-flight */
116
+ isFetching?: boolean;
117
+ /** true while background refetch is in-flight */
118
+ isRefetching?: boolean;
119
+ /** true when fetch is paused */
120
+ isPaused?: boolean;
121
+ /** true once query has fetched at least once */
122
+ isFetched?: boolean;
123
+ refetch: () => unknown;
117
124
  }
118
125
  /**
119
126
  * Converts a TanStack Query result to an AsyncLoaderResult.
@@ -130,22 +137,22 @@ interface TanStackQueryResult<TData, TError = Error> {
130
137
  * }
131
138
  * ```
132
139
  */
133
- declare function toAsyncLoaderResult<TData, TError = Error>(result: TanStackQueryResult<TData, TError>): AsyncLoaderResult<TData, TanStackQueryResult<TData, TError>>;
140
+ export declare function toAsyncLoaderResult<TData, TError = Error>(result: TanStackQueryResult<TData, TError>): AsyncLoaderResult<TData, TanStackQueryResult<TData, TError>>;
134
141
  /**
135
142
  * Props for creating a static loader component.
136
143
  */
137
144
  interface CreateStaticLoaderProps {
138
- /**
139
- * Hook that returns a TanStack Query result.
140
- * This hook will be called inside the loader component.
141
- */
142
- useQuery: () => TanStackQueryResult<NodeDef[]>;
143
- /**
144
- * When to trigger the loader:
145
- * - 'eager': Load when root menu opens
146
- * - 'lazy': Load when submenu opens (default)
147
- */
148
- loadStrategy?: 'eager' | 'lazy';
145
+ /**
146
+ * Hook that returns a TanStack Query result.
147
+ * This hook will be called inside the loader component.
148
+ */
149
+ useQuery: () => TanStackQueryResult<NodeDef[]>;
150
+ /**
151
+ * When to trigger the loader:
152
+ * - 'eager': Load when root menu opens
153
+ * - 'lazy': Load when submenu opens (default)
154
+ */
155
+ loadStrategy?: 'eager' | 'lazy';
149
156
  }
150
157
  /**
151
158
  * Creates a static loader configuration for use with async menus.
@@ -173,48 +180,55 @@ interface CreateStaticLoaderProps {
173
180
  * }
174
181
  * ```
175
182
  */
176
- declare function createStaticLoader(props: CreateStaticLoaderProps): StaticLoaderConfig;
183
+ export declare function createStaticLoader(props: CreateStaticLoaderProps): StaticLoaderConfig;
177
184
  /**
178
185
  * Props for creating a query loader component.
179
186
  */
180
187
  interface CreateQueryLoaderProps {
181
- /**
182
- * Hook that returns a TanStack Query result based on the search query.
183
- * This hook will be called inside the loader component with the current query.
184
- */
185
- useQuery: (query: string, options?: {
186
- enabled: boolean;
187
- }) => TanStackQueryResult<NodeDef[]>;
188
- /**
189
- * Minimum query length before fetching.
190
- * @default 1
191
- */
192
- minQueryLength?: number;
193
- /**
194
- * Initial query behavior before user input reaches minQueryLength.
195
- * Defaults to fetching with an empty query.
196
- */
197
- initialQueryBehavior?: InitialQueryBehavior | false;
198
- /**
199
- * @deprecated Use `initialQueryBehavior` instead.
200
- */
201
- initialQuery?: string;
202
- /**
203
- * When to trigger the loader:
204
- * - 'eager': Load when root menu opens (good for deep search)
205
- * - 'lazy': Load when submenu opens (default)
206
- * @default 'lazy'
207
- */
208
- loadStrategy?: 'eager' | 'lazy';
209
- /**
210
- * What to show when query is below minQueryLength.
211
- * @default 'empty'
212
- */
213
- belowMinBehavior?: 'empty' | 'placeholder';
214
- /**
215
- * Placeholder nodes shown when query is below minQueryLength.
216
- */
217
- placeholderNodes?: NodeDef[];
188
+ /**
189
+ * Hook that returns a TanStack Query result based on the search query.
190
+ * This hook will be called inside the loader component with the current query.
191
+ */
192
+ useQuery: (query: string, options?: {
193
+ enabled: boolean;
194
+ }) => TanStackQueryResult<NodeDef[]>;
195
+ /**
196
+ * Minimum query length before fetching.
197
+ * @default 1
198
+ */
199
+ minQueryLength?: number;
200
+ /**
201
+ * Initial query behavior before user input reaches minQueryLength.
202
+ * Defaults to fetching with an empty query.
203
+ */
204
+ initialQueryBehavior?: InitialQueryBehavior | false;
205
+ /**
206
+ * @deprecated Use `initialQueryBehavior` instead.
207
+ */
208
+ initialQuery?: string;
209
+ /**
210
+ * When to trigger the loader:
211
+ * - 'eager': Load when root menu opens (good for deep search)
212
+ * - 'lazy': Load when submenu opens (default)
213
+ * @default 'lazy'
214
+ */
215
+ loadStrategy?: 'eager' | 'lazy';
216
+ /**
217
+ * What to show when query is below minQueryLength.
218
+ * @default 'empty'
219
+ */
220
+ belowMinBehavior?: 'empty' | 'placeholder';
221
+ /**
222
+ * Placeholder nodes shown when query is below minQueryLength.
223
+ */
224
+ placeholderNodes?: NodeDef[];
225
+ /**
226
+ * Milliseconds to wait after the search stops changing before passing it to
227
+ * the loader. While waiting, the loader counts as fetching, so the menu
228
+ * doesn't show "no results" or treat the search as finished too early.
229
+ * @default 0
230
+ */
231
+ debounce?: number;
218
232
  }
219
233
  /**
220
234
  * Creates a query loader configuration for use with async menus.
@@ -241,7 +255,7 @@ interface CreateQueryLoaderProps {
241
255
  * }
242
256
  * ```
243
257
  */
244
- declare function createQueryLoader(props: CreateQueryLoaderProps): QueryLoaderConfig;
258
+ export declare function createQueryLoader(props: CreateQueryLoaderProps): QueryLoaderConfig;
245
259
  /**
246
260
  * Creates a loader component that wraps a TanStack Query hook.
247
261
  * This is a lower-level utility for custom loader implementations.
@@ -256,22 +270,23 @@ declare function createQueryLoader(props: CreateQueryLoaderProps): QueryLoaderCo
256
270
  * )
257
271
  * ```
258
272
  */
259
- declare function createLoaderComponent(useQueryFn: (query: string) => TanStackQueryResult<NodeDef[]>): React.FC<LoaderComponentProps>;
260
-
273
+ export declare function createLoaderComponent(useQueryFn: (query: string) => TanStackQueryResult<NodeDef[]>): React.FC<LoaderComponentProps>;
274
+ //#endregion
275
+ //#region src/loaders/vanilla.d.ts
261
276
  /**
262
277
  * Props for creating a static loader with vanilla fetch.
263
278
  */
264
279
  interface CreateVanillaStaticLoaderProps {
265
- /**
266
- * Async function that fetches the menu items.
267
- */
268
- fetcher: () => Promise<NodeDef[]>;
269
- /**
270
- * When to trigger the loader:
271
- * - 'eager': Load when root menu opens
272
- * - 'lazy': Load when submenu opens (default)
273
- */
274
- loadStrategy?: 'eager' | 'lazy';
280
+ /**
281
+ * Async function that fetches the menu items.
282
+ */
283
+ fetcher: () => Promise<NodeDef[]>;
284
+ /**
285
+ * When to trigger the loader:
286
+ * - 'eager': Load when root menu opens
287
+ * - 'lazy': Load when submenu opens (default)
288
+ */
289
+ loadStrategy?: 'eager' | 'lazy';
275
290
  }
276
291
  /**
277
292
  * Creates a static loader configuration using plain fetch/promises.
@@ -292,49 +307,63 @@ interface CreateVanillaStaticLoaderProps {
292
307
  * })
293
308
  * ```
294
309
  */
295
- declare function createVanillaStaticLoader(props: CreateVanillaStaticLoaderProps): StaticLoaderConfig;
310
+ export declare function createVanillaStaticLoader(props: CreateVanillaStaticLoaderProps): StaticLoaderConfig;
296
311
  /**
297
312
  * Props for creating a query loader with vanilla fetch.
298
313
  */
299
314
  interface CreateVanillaQueryLoaderProps {
300
- /**
301
- * Async function that fetches menu items based on the search query.
302
- * Receives an optional `signal` that is aborted when a newer query is issued,
303
- * allowing you to cancel in-flight requests (e.g. pass it to `fetch()`).
304
- */
305
- fetcher: (query: string, options?: {
306
- signal?: AbortSignal;
307
- }) => Promise<NodeDef[]>;
308
- /**
309
- * Minimum query length before fetching.
310
- * @default 1
311
- */
312
- minQueryLength?: number;
313
- /**
314
- * Initial query behavior before user input reaches minQueryLength.
315
- * Defaults to fetching with an empty query.
316
- */
317
- initialQueryBehavior?: InitialQueryBehavior | false;
318
- /**
319
- * @deprecated Use `initialQueryBehavior` instead.
320
- */
321
- initialQuery?: string;
322
- /**
323
- * When to trigger the loader:
324
- * - 'eager': Load when root menu opens (good for deep search)
325
- * - 'lazy': Load when submenu opens (default)
326
- * @default 'lazy'
327
- */
328
- loadStrategy?: 'eager' | 'lazy';
329
- /**
330
- * What to show when query is below minQueryLength.
331
- * @default 'empty'
332
- */
333
- belowMinBehavior?: 'empty' | 'placeholder';
334
- /**
335
- * Placeholder nodes shown when query is below minQueryLength.
336
- */
337
- placeholderNodes?: NodeDef[];
315
+ /**
316
+ * Async function that fetches menu items based on the search query.
317
+ * Receives an optional `signal` that is aborted when a newer query is issued,
318
+ * allowing you to cancel in-flight requests (e.g. pass it to `fetch()`).
319
+ */
320
+ fetcher: (query: string, options?: {
321
+ signal?: AbortSignal;
322
+ }) => Promise<NodeDef[]>;
323
+ /**
324
+ * Minimum query length before fetching.
325
+ * @default 1
326
+ */
327
+ minQueryLength?: number;
328
+ /**
329
+ * Initial query behavior before user input reaches minQueryLength.
330
+ * Defaults to fetching with an empty query.
331
+ */
332
+ initialQueryBehavior?: InitialQueryBehavior | false;
333
+ /**
334
+ * @deprecated Use `initialQueryBehavior` instead.
335
+ */
336
+ initialQuery?: string;
337
+ /**
338
+ * When to trigger the loader:
339
+ * - 'eager': Load when root menu opens (good for deep search)
340
+ * - 'lazy': Load when submenu opens (default)
341
+ * @default 'lazy'
342
+ */
343
+ loadStrategy?: 'eager' | 'lazy';
344
+ /**
345
+ * What to show when query is below minQueryLength.
346
+ * @default 'empty'
347
+ */
348
+ belowMinBehavior?: 'empty' | 'placeholder';
349
+ /**
350
+ * Placeholder nodes shown when query is below minQueryLength.
351
+ */
352
+ placeholderNodes?: NodeDef[];
353
+ /**
354
+ * Milliseconds to wait after the search stops changing before passing it to
355
+ * the loader. While waiting, the loader counts as fetching, so the menu
356
+ * doesn't show "no results" or treat the search as finished too early.
357
+ * @default 0
358
+ */
359
+ debounce?: number;
360
+ /**
361
+ * Keep showing the last results while the next search loads, instead of
362
+ * clearing them on every change of the search. The refetch is reported as a
363
+ * background load, so `Loading` doesn't flash. Named after SWR's option.
364
+ * @default false
365
+ */
366
+ keepPreviousData?: boolean;
338
367
  }
339
368
  /**
340
369
  * Creates a query loader configuration using plain fetch/promises.
@@ -358,6 +387,7 @@ interface CreateVanillaQueryLoaderProps {
358
387
  * })
359
388
  * ```
360
389
  */
361
- declare function createVanillaQueryLoader(props: CreateVanillaQueryLoaderProps): QueryLoaderConfig;
362
-
363
- export { type CreateQueryLoaderProps, type CreateSWRQueryLoaderProps, type CreateSWRStaticLoaderProps, type CreateStaticLoaderProps, type CreateVanillaQueryLoaderProps, type CreateVanillaStaticLoaderProps, type SWRResult, type TanStackQueryResult, createLoaderComponent, createQueryLoader, createSWRLoaderComponent, createSWRQueryLoader, createSWRStaticLoader, createStaticLoader, createVanillaQueryLoader, createVanillaStaticLoader, toAsyncLoaderResult, toAsyncLoaderResultFromSWR };
390
+ export declare function createVanillaQueryLoader(props: CreateVanillaQueryLoaderProps): QueryLoaderConfig;
391
+ //#endregion
392
+ export type { CreateQueryLoaderProps, CreateSWRQueryLoaderProps, CreateSWRStaticLoaderProps, CreateStaticLoaderProps, CreateVanillaQueryLoaderProps, CreateVanillaStaticLoaderProps, SWRResult, TanStackQueryResult };
393
+ //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-4C666HHU.js";import{Fragment as S,jsx as R}from"react/jsx-runtime";function A(e){return e==null?null:e instanceof Error?e:new Error(String(e))}function p(e){let o=A(e.error),a=e.data!==void 0,n=e.isPaused?"paused":e.isValidating?"fetching":"idle",r=n==="fetching",t=e.isLoading??(r&&!a&&o==null),c=r&&!t,s=o?"error":a?"success":t||r?"pending":"idle",i=t?"initial":c?"background":"none";return{data:e.data,raw:e,source:"swr",error:o,status:s,fetchStatus:n,loadingPhase:i,isLoading:t,isFetching:r,isInitialLoading:t,isRefetching:c,isPending:s==="pending",isSuccess:s==="success",isError:s==="error",isPaused:n==="paused",hasData:a,hasFetched:a||o!=null||t||c,refetch:()=>e.mutate()}}function T(e){let{useSWR:o,loadStrategy:a}=e;return{type:"static",Loader:({children:r})=>{let t=o();return R(S,{children:r(p(t))})},loadStrategy:a}}function D(e){let{useSWR:o,minQueryLength:a=1,initialQueryBehavior:n,initialQuery:r,loadStrategy:t,belowMinBehavior:c="empty",placeholderNodes:s}=e,i=n!==void 0?n:r!==void 0?{value:r,loadWhen:"needed"}:{value:"",loadWhen:"needed"};return{type:"query",Loader:({query:l,enabled:f,children:h})=>{let y=f??(l.length>=a||i!==!1),g=o(l,{enabled:y});return R(S,{children:h(p(g))})},minQueryLength:a,initialQueryBehavior:i,initialQuery:r,loadStrategy:t,belowMinBehavior:c,placeholderNodes:s}}function E(e){return function({query:a,children:n}){let r=e(a);return R(S,{children:n(p(r))})}}import{Fragment as Q,jsx as F}from"react/jsx-runtime";function v(e){return e==null?null:e instanceof Error?e:new Error(String(e))}function L(e){let o=e.data!==void 0,a=e.fetchStatus?e.fetchStatus:e.isPaused?"paused":e.isFetching||e.isLoading?"fetching":"idle",n=a==="fetching",r=e.status?e.status:e.isError?"error":e.isSuccess||o?"success":e.isPending||e.isLoading||n?"pending":"idle",t=e.isPending??r==="pending",c=e.isSuccess??r==="success",s=e.isError??r==="error",i=e.isLoading??(t&&n),u=e.isRefetching??(n&&!i),l=e.isPaused??a==="paused",f=e.isFetched??(c||s||i||u),h=i?"initial":u?"background":"none";return{data:e.data,raw:e,source:"tanstack-query",error:v(e.error),status:r,fetchStatus:a,loadingPhase:h,isLoading:i,isFetching:n,isInitialLoading:i,isRefetching:u,isPending:t,isSuccess:c,isError:s,isPaused:l,hasData:o,hasFetched:f,refetch:e.refetch}}function W(e){let{useQuery:o,loadStrategy:a}=e;return{type:"static",Loader:({children:r})=>{let t=o();return F(Q,{children:r(L(t))})},loadStrategy:a}}function B(e){let{useQuery:o,minQueryLength:a=1,initialQueryBehavior:n,initialQuery:r,loadStrategy:t,belowMinBehavior:c="empty",placeholderNodes:s}=e,i=n!==void 0?n:r!==void 0?{value:r,loadWhen:"needed"}:{value:"",loadWhen:"needed"};return{type:"query",Loader:({query:l,enabled:f,children:h})=>{let y=f??(l.length>=a||i!==!1),g=o(l,{enabled:y});return F(Q,{children:h(L(g))})},minQueryLength:a,initialQueryBehavior:i,initialQuery:r,loadStrategy:t,belowMinBehavior:c,placeholderNodes:s}}function N(e){return function({query:a,children:n}){let r=e(a);return F(Q,{children:n(L(r))})}}import*as d from"react";import{Fragment as P,jsx as b}from"react/jsx-runtime";function m(e){return e==null?null:e instanceof Error?e:new Error(String(e))}function k(e){return e.error?"error":e.data!==void 0?"success":e.isFetching?"pending":"idle"}function C(e,o){let a=k(e),n=e.isFetching?"fetching":"idle",r=e.isFetching&&!e.hasFetched,t=e.isFetching&&e.hasFetched,c=r?"initial":t?"background":"none";return{data:e.data,source:"vanilla",error:e.error,status:a,fetchStatus:n,loadingPhase:c,isLoading:r,isFetching:e.isFetching,isInitialLoading:r,isRefetching:t,isPending:a==="pending",isSuccess:a==="success",isError:a==="error",isPaused:!1,hasData:e.data!==void 0,hasFetched:e.hasFetched,refetch:o}}function w(e,o){let{enabled:a=!0}=o??{},[n,r]=d.useState(()=>({data:void 0,error:null,isFetching:a,hasFetched:!1})),t=d.useRef(e);t.current=e;let c=d.useCallback(()=>{r(s=>({...s,isFetching:!0,error:null})),t.current().then(s=>{r({data:s,error:null,isFetching:!1,hasFetched:!0})}).catch(s=>{r(i=>({...i,error:m(s),isFetching:!1,hasFetched:!0}))})},[]);return d.useEffect(()=>{if(a){c();return}r(s=>({...s,isFetching:!1}))},[a,c]),d.useMemo(()=>C(n,c),[n,c])}function I(e,o,a){let{enabled:n=!0}=a??{},[r,t]=d.useState(()=>({data:void 0,error:null,isFetching:n,hasFetched:!1})),c=d.useRef(e);c.current=e,d.useEffect(()=>{if(!n){t({data:void 0,error:null,isFetching:!1,hasFetched:!1});return}let i=new AbortController;return t({data:void 0,error:null,isFetching:!0,hasFetched:!1}),c.current(o,{signal:i.signal}).then(u=>{i.signal.aborted||t({data:u,error:null,isFetching:!1,hasFetched:!0})}).catch(u=>{i.signal.aborted||t({data:void 0,error:m(u),isFetching:!1,hasFetched:!0})}),()=>{i.abort()}},[n,o]);let s=d.useCallback(()=>{t(i=>({...i,isFetching:!0,error:null})),c.current(o).then(i=>{t({data:i,error:null,isFetching:!1,hasFetched:!0})}).catch(i=>{t(u=>({...u,error:m(i),isFetching:!1,hasFetched:!0}))})},[o]);return d.useMemo(()=>C(r,s),[r,s])}function V(e){let{fetcher:o,loadStrategy:a}=e;return{type:"static",Loader:({children:r})=>{let t=w(o);return b(P,{children:r(t)})},loadStrategy:a}}function x(e){let{fetcher:o,minQueryLength:a=1,initialQueryBehavior:n,initialQuery:r,loadStrategy:t,belowMinBehavior:c="empty",placeholderNodes:s}=e,i=n!==void 0?n:r!==void 0?{value:r,loadWhen:"needed"}:{value:"",loadWhen:"needed"};return{type:"query",Loader:({query:l,enabled:f,children:h})=>{let y=f??(l.length>=a||i!==!1),g=I(o,l,{enabled:y});return b(P,{children:h(g)})},minQueryLength:a,initialQueryBehavior:i,initialQuery:r,loadStrategy:t,belowMinBehavior:c,placeholderNodes:s}}export{N as createLoaderComponent,B as createQueryLoader,E as createSWRLoaderComponent,D as createSWRQueryLoader,T as createSWRStaticLoader,W as createStaticLoader,x as createVanillaQueryLoader,V as createVanillaStaticLoader,L as toAsyncLoaderResult,p as toAsyncLoaderResultFromSWR};
1
+ import*as e from"react";import{Fragment as t,jsx as n}from"react/jsx-runtime";function r(e){return e==null?null:e instanceof Error?e:Error(String(e))}function i(e){let t=r(e.error),n=e.data!==void 0,i=e.isPaused?`paused`:e.isValidating?`fetching`:`idle`,a=i===`fetching`,o=e.isLoading??(a&&!n&&t==null),s=a&&!o,c=t?`error`:n?`success`:o||a?`pending`:`idle`,l=o?`initial`:s?`background`:`none`;return{data:e.data,raw:e,source:`swr`,error:t,status:c,fetchStatus:i,loadingPhase:l,isLoading:o,isFetching:a,isInitialLoading:o,isRefetching:s,isPending:c===`pending`,isSuccess:c===`success`,isError:c===`error`,isPaused:i===`paused`,hasData:n,hasFetched:n||t!=null||o||s,refetch:()=>e.mutate()}}function a(e){let{useSWR:r,loadStrategy:a}=e;return{type:`static`,Loader:({children:e})=>{let a=r();return/* @__PURE__ */ n(t,{children:e(i(a))})},loadStrategy:a}}function o(e){let{useSWR:r,minQueryLength:a=1,initialQueryBehavior:o,initialQuery:s,loadStrategy:c,belowMinBehavior:l=`empty`,placeholderNodes:u,debounce:d}=e,f=o===void 0?s===void 0?{value:``,loadWhen:`needed`}:{value:s,loadWhen:`needed`}:o;return{type:`query`,Loader:({query:e,enabled:o,children:s})=>{let c=o??(e.length>=a||f!==!1),l=r(e,{enabled:c});return/* @__PURE__ */ n(t,{children:s(i(l))})},minQueryLength:a,initialQueryBehavior:f,initialQuery:s,loadStrategy:c,belowMinBehavior:l,placeholderNodes:u,debounce:d}}function s(e){return function({query:r,children:a}){let o=e(r);return/* @__PURE__ */ n(t,{children:a(i(o))})}}function c(e){return e==null?null:e instanceof Error?e:Error(String(e))}function l(e){let t=e.data!==void 0,n=e.fetchStatus?e.fetchStatus:e.isPaused?`paused`:e.isFetching||e.isLoading?`fetching`:`idle`,r=n===`fetching`,i=e.status?e.status:e.isError?`error`:e.isSuccess||t?`success`:e.isPending||e.isLoading||r?`pending`:`idle`,a=e.isPending??i===`pending`,o=e.isSuccess??i===`success`,s=e.isError??i===`error`,l=e.isLoading??(a&&r),u=e.isRefetching??(r&&!l),d=e.isPaused??n===`paused`,f=e.isFetched??(o||s||l||u),p=l?`initial`:u?`background`:`none`;return{data:e.data,raw:e,source:`tanstack-query`,error:c(e.error),status:i,fetchStatus:n,loadingPhase:p,isLoading:l,isFetching:r,isInitialLoading:l,isRefetching:u,isPending:a,isSuccess:o,isError:s,isPaused:d,hasData:t,hasFetched:f,refetch:e.refetch}}function u(e){let{useQuery:r,loadStrategy:i}=e;return{type:`static`,Loader:({children:e})=>{let i=r();return/* @__PURE__ */ n(t,{children:e(l(i))})},loadStrategy:i}}function d(e){let{useQuery:r,minQueryLength:i=1,initialQueryBehavior:a,initialQuery:o,loadStrategy:s,belowMinBehavior:c=`empty`,placeholderNodes:u,debounce:d}=e,f=a===void 0?o===void 0?{value:``,loadWhen:`needed`}:{value:o,loadWhen:`needed`}:a;return{type:`query`,Loader:({query:e,enabled:a,children:o})=>{let s=a??(e.length>=i||f!==!1),c=r(e,{enabled:s});return/* @__PURE__ */ n(t,{children:o(l(c))})},minQueryLength:i,initialQueryBehavior:f,initialQuery:o,loadStrategy:s,belowMinBehavior:c,placeholderNodes:u,debounce:d}}function f(e){return function({query:r,children:i}){let a=e(r);return/* @__PURE__ */ n(t,{children:i(l(a))})}}function p(e){return e==null?null:e instanceof Error?e:Error(String(e))}function m(e){return e.error?`error`:e.data===void 0?e.isFetching?`pending`:`idle`:`success`}function h(e,t){let n=m(e),r=e.isFetching?`fetching`:`idle`,i=e.isFetching&&!e.hasFetched,a=e.isFetching&&e.hasFetched,o=i?`initial`:a?`background`:`none`;return{data:e.data,source:`vanilla`,error:e.error,status:n,fetchStatus:r,loadingPhase:o,isLoading:i,isFetching:e.isFetching,isInitialLoading:i,isRefetching:a,isPending:n===`pending`,isSuccess:n===`success`,isError:n===`error`,isPaused:!1,hasData:e.data!==void 0,hasFetched:e.hasFetched,refetch:t}}function g(t,n){let{enabled:r=!0}=n??{},[i,a]=e.useState(()=>({data:void 0,error:null,isFetching:r,hasFetched:!1})),o=e.useRef(t);o.current=t;let s=e.useCallback(()=>{a(e=>({...e,isFetching:!0,error:null})),o.current().then(e=>{a({data:e,error:null,isFetching:!1,hasFetched:!0})}).catch(e=>{a(t=>({...t,error:p(e),isFetching:!1,hasFetched:!0}))})},[]);return e.useEffect(()=>{if(r){s();return}a(e=>({...e,isFetching:!1}))},[r,s]),e.useMemo(()=>h(i,s),[i,s])}function _(t,n,r){let{enabled:i=!0,keepPreviousData:a=!1}=r??{},[o,s]=e.useState(()=>({data:void 0,error:null,isFetching:i,hasFetched:!1,query:n})),c=e.useRef(t);c.current=t;let l=e.useRef(n);l.current=n,e.useEffect(()=>{if(!i){s({data:void 0,error:null,isFetching:!1,hasFetched:!1,query:n});return}let e=new AbortController;return s(e=>a&&e.data!==void 0?{...e,error:null,isFetching:!0,query:n}:{data:void 0,error:null,isFetching:!0,hasFetched:!1,query:n}),c.current(n,{signal:e.signal}).then(t=>{e.signal.aborted||s({data:t,error:null,isFetching:!1,hasFetched:!0,query:n})}).catch(t=>{e.signal.aborted||s({data:void 0,error:p(t),isFetching:!1,hasFetched:!0,query:n})}),()=>{e.abort()}},[i,n,a]);let u=e.useCallback(()=>{s(e=>({...e,isFetching:!0,error:null})),c.current(n).then(e=>{l.current===n&&s({data:e,error:null,isFetching:!1,hasFetched:!0,query:n})}).catch(e=>{l.current===n&&s(t=>({...t,error:p(e),isFetching:!1,hasFetched:!0,query:n}))})},[n]),d=e.useMemo(()=>!i||o.query===n?o:a&&o.data!==void 0?{...o,error:null,isFetching:!0}:{data:void 0,error:null,isFetching:!0,hasFetched:!1},[o,i,n,a]);return e.useMemo(()=>h(d,u),[d,u])}function v(e){let{fetcher:r,loadStrategy:i}=e;return{type:`static`,Loader:({children:e})=>{let i=g(r);return/* @__PURE__ */ n(t,{children:e(i)})},loadStrategy:i}}function y(e){let{fetcher:r,minQueryLength:i=1,initialQueryBehavior:a,initialQuery:o,loadStrategy:s,belowMinBehavior:c=`empty`,placeholderNodes:l,debounce:u,keepPreviousData:d=!1}=e,f=a===void 0?o===void 0?{value:``,loadWhen:`needed`}:{value:o,loadWhen:`needed`}:a;return{type:`query`,Loader:({query:e,enabled:a,children:o})=>{let s=a??(e.length>=i||f!==!1),c=_(r,e,{enabled:s,keepPreviousData:d});return/* @__PURE__ */ n(t,{children:o(c)})},minQueryLength:i,initialQueryBehavior:f,initialQuery:o,loadStrategy:s,belowMinBehavior:c,placeholderNodes:l,debounce:u}}export{f as createLoaderComponent,d as createQueryLoader,s as createSWRLoaderComponent,o as createSWRQueryLoader,a as createSWRStaticLoader,u as createStaticLoader,y as createVanillaQueryLoader,v as createVanillaStaticLoader,l as toAsyncLoaderResult,i as toAsyncLoaderResultFromSWR};
2
2
  //# sourceMappingURL=index.js.map