@gnwebsoft/ui 4.0.0 → 4.0.1

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 (54) hide show
  1. package/dist/chunk-246MYJX6.js +479 -0
  2. package/dist/chunk-CE4CSA36.cjs +2262 -0
  3. package/dist/chunk-DJSMLHFO.js +140 -0
  4. package/dist/chunk-GHW77WIM.cjs +72 -0
  5. package/dist/chunk-L3QQX3BK.js +1596 -0
  6. package/dist/chunk-MULSVYFT.js +72 -0
  7. package/dist/chunk-MVPLBJRK.cjs +1 -1
  8. package/dist/chunk-NC3JINIM.cjs +1596 -0
  9. package/dist/chunk-R45OPW5A.js +2262 -0
  10. package/dist/chunk-UEBN47RB.cjs +140 -0
  11. package/dist/chunk-YUVXLOSA.cjs +479 -0
  12. package/dist/core/index.cjs +121 -0
  13. package/dist/core/index.js +121 -0
  14. package/dist/hooks/index.cjs +3 -3
  15. package/dist/hooks/index.js +1 -1
  16. package/dist/index.cjs +81 -7
  17. package/dist/index.js +126 -52
  18. package/dist/types/index.cjs +3 -3
  19. package/dist/types/index.js +1 -1
  20. package/dist/utils/index.cjs +3 -25
  21. package/dist/utils/index.js +3 -25
  22. package/dist/wrappers/index.cjs +4 -4
  23. package/dist/wrappers/index.js +16 -16
  24. package/package.json +22 -17
  25. package/dist/AsyncSelectPayload-B9-6l33R.d.cts +0 -10
  26. package/dist/AsyncSelectPayload-B9-6l33R.d.ts +0 -10
  27. package/dist/chunk-3OPVOWQK.js +0 -140
  28. package/dist/chunk-AEOF2TUF.cjs +0 -2273
  29. package/dist/chunk-ALHC7RLK.js +0 -575
  30. package/dist/chunk-BRRLB22L.js +0 -72
  31. package/dist/chunk-CHZU4PZB.js +0 -2273
  32. package/dist/chunk-EBRUE2WR.cjs +0 -493
  33. package/dist/chunk-HEHPKM4B.cjs +0 -140
  34. package/dist/chunk-K2EJ4YKO.cjs +0 -72
  35. package/dist/chunk-U6SDYCWF.js +0 -493
  36. package/dist/chunk-XY4U6A77.cjs +0 -575
  37. package/dist/components/index.cjs +0 -25
  38. package/dist/components/index.d.cts +0 -752
  39. package/dist/components/index.d.ts +0 -752
  40. package/dist/components/index.js +0 -25
  41. package/dist/enhanced-CDTkKUlj.d.ts +0 -134
  42. package/dist/enhanced-ZQoS03Cd.d.cts +0 -134
  43. package/dist/events-BcHVCLBz.d.cts +0 -77
  44. package/dist/events-BcHVCLBz.d.ts +0 -77
  45. package/dist/hooks/index.d.cts +0 -96
  46. package/dist/hooks/index.d.ts +0 -96
  47. package/dist/index.d.cts +0 -16
  48. package/dist/index.d.ts +0 -16
  49. package/dist/types/index.d.cts +0 -820
  50. package/dist/types/index.d.ts +0 -820
  51. package/dist/utils/index.d.cts +0 -683
  52. package/dist/utils/index.d.ts +0 -683
  53. package/dist/wrappers/index.d.cts +0 -1753
  54. package/dist/wrappers/index.d.ts +0 -1753
@@ -1,683 +0,0 @@
1
- import { PostModel, ApiResponse, ListResponse, JsonObject, RequestOptions, ValidationErrors } from '../types/index.cjs';
2
- import { PickerValidDate } from '@mui/x-date-pickers';
3
- import { useLocalizationContext } from '@mui/x-date-pickers/internals';
4
- import * as react_hook_form from 'react-hook-form';
5
- import { FieldValues, UseFormSetError, Control, DeepPartialSkipArrayKey, Path, PathValue } from 'react-hook-form';
6
- import { z } from 'zod';
7
- import '@mui/x-data-grid';
8
- import '../AsyncSelectPayload-B9-6l33R.cjs';
9
- import '../events-BcHVCLBz.cjs';
10
- import 'react';
11
-
12
- declare class api {
13
- static filter<T, TFilter>(url: string, postModel: PostModel<TFilter>): Promise<ApiResponse<ListResponse<T>>>;
14
- static post<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
15
- static get<T>(url: string): Promise<ApiResponse<T>>;
16
- static delete<T>(url: string): Promise<ApiResponse<T>>;
17
- static put<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
18
- static fetch(url: string, options?: RequestInit): Promise<Response>;
19
- static tempFetch<T>(url: string, options?: RequestOptions): Promise<ApiResponse<T>>;
20
- static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
21
- }
22
-
23
- declare class api2 {
24
- static filter<T, TFilter>(url: string, postModel: PostModel<TFilter>): Promise<ApiResponse<ListResponse<T>>>;
25
- static post<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
26
- static get<T>(url: string): Promise<ApiResponse<T>>;
27
- static delete<T>(url: string): Promise<ApiResponse<T>>;
28
- static put<T>(url: string, body?: JsonObject): Promise<ApiResponse<T>>;
29
- static fetch(url: string, options?: RequestInit): Promise<Response>;
30
- static tempFetch<T>(url: string, options?: RequestOptions): Promise<ApiResponse<T>>;
31
- static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
32
- }
33
-
34
- /**
35
- * Recursively flattens an object into a flat structure with dot-notation keys.
36
- *
37
- * This utility function takes a nested object and converts it into a flat object
38
- * where nested properties are represented using dot notation. It handles both
39
- * nested objects and arrays, preserving all levels of the original structure
40
- * as separate keys in the result.
41
- *
42
- * @example
43
- * Basic object flattening:
44
- * ```tsx
45
- * const nested = {
46
- * user: {
47
- * name: 'John',
48
- * address: {
49
- * city: 'New York',
50
- * zip: '10001'
51
- * }
52
- * }
53
- * };
54
- *
55
- * const flattened = flattenObjectKeys(nested);
56
- * // Result:
57
- * // {
58
- * // 'user': { name: 'John', address: { city: 'New York', zip: '10001' } },
59
- * // 'user.name': 'John',
60
- * // 'user.address': { city: 'New York', zip: '10001' },
61
- * // 'user.address.city': 'New York',
62
- * // 'user.address.zip': '10001'
63
- * // }
64
- * ```
65
- *
66
- * @example
67
- * Array handling:
68
- * ```tsx
69
- * const withArrays = {
70
- * items: [
71
- * { id: 1, name: 'Item 1' },
72
- * { id: 2, name: 'Item 2' }
73
- * ]
74
- * };
75
- *
76
- * const flattened = flattenObjectKeys(withArrays);
77
- * // Result includes:
78
- * // {
79
- * // 'items': [...],
80
- * // 'items.0': { id: 1, name: 'Item 1' },
81
- * // 'items.0.id': 1,
82
- * // 'items.0.name': 'Item 1',
83
- * // 'items.1': { id: 2, name: 'Item 2' },
84
- * // 'items.1.id': 2,
85
- * // 'items.1.name': 'Item 2'
86
- * // }
87
- * ```
88
- *
89
- * @param obj - The object to flatten
90
- * @param prefix - Internal parameter for building key paths (used in recursion)
91
- * @returns A flat object with dot-notation keys representing the original structure
92
- *
93
- * @public
94
- */
95
- declare const flattenObjectKeys: (obj: unknown, prefix?: string) => Record<string, unknown>;
96
-
97
- declare function getTimezone<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: TDate): string | null;
98
-
99
- /**
100
- * Configuration options for the handleServerErrors function.
101
- *
102
- * @template TFieldValues - The form values type
103
- *
104
- * @public
105
- */
106
- interface HandleServerErrorsType<TFieldValues extends FieldValues = FieldValues> {
107
- /**
108
- * Server validation errors object containing field-specific error messages
109
- * @example { email: 'Email is already taken', password: ['Too short', 'Must contain numbers'] }
110
- */
111
- errors?: ValidationErrors;
112
- /**
113
- * The setError function from react-hook-form for setting field errors
114
- */
115
- setError: UseFormSetError<TFieldValues>;
116
- }
117
- /**
118
- * Processes server validation errors and applies them to react-hook-form fields.
119
- *
120
- * This utility function takes validation errors from a server response and automatically
121
- * applies them to the corresponding form fields using react-hook-form's setError function.
122
- * It supports various error formats including strings, arrays of strings, and boolean flags.
123
- *
124
- * The function uses object flattening to handle nested error structures and ensures
125
- * that only valid field paths are processed.
126
- *
127
- * @example
128
- * Basic usage with server response:
129
- * ```tsx
130
- * const { setError } = useForm();
131
- *
132
- * try {
133
- * await submitForm(data);
134
- * } catch (error) {
135
- * handleServerErrors({
136
- * errors: error.response.data.errors,
137
- * setError
138
- * });
139
- * }
140
- * ```
141
- *
142
- * @example
143
- * With different error formats:
144
- * ```tsx
145
- * const serverErrors = {
146
- * email: 'Email is already taken',
147
- * password: ['Too short', 'Must contain numbers'],
148
- * terms: true // Boolean flag indicating invalid
149
- * };
150
- *
151
- * handleServerErrors({ errors: serverErrors, setError });
152
- * // Results in:
153
- * // - email field shows: "Email is already taken"
154
- * // - password field shows: "Too short Must contain numbers"
155
- * // - terms field shows: "Field is not valid."
156
- * ```
157
- *
158
- * @template TFieldValues - The form values type
159
- *
160
- * @param args - Configuration object containing errors and setError function
161
- *
162
- * @public
163
- */
164
- declare const handleServerErrors: <TFieldValues extends FieldValues = FieldValues>(args: HandleServerErrorsType<TFieldValues>) => void;
165
-
166
- /**
167
- * Type-safe property existence checker that acts as a type guard.
168
- *
169
- * Checks if a given property exists on an object and narrows the TypeScript type
170
- * to include that property. This is useful for safely accessing properties on
171
- * objects of unknown structure while maintaining type safety.
172
- *
173
- * @template X - The type of the object being checked
174
- * @template Y - The type of the property key (extends PropertyKey)
175
- *
176
- * @param obj - The object to check for the property
177
- * @param prop - The property key to check for existence
178
- *
179
- * @returns A type predicate indicating whether the property exists on the object.
180
- * If true, the object type is narrowed to include the specified property.
181
- *
182
- * @example
183
- * ```typescript
184
- * const data: unknown = { name: "John", age: 30 };
185
- *
186
- * if (propertyExists(data, "name")) {
187
- * // TypeScript now knows data has a 'name' property
188
- * console.log(data.name); // Type-safe access
189
- * }
190
- *
191
- * // Check for nested property existence
192
- * if (propertyExists(obj, "user") && propertyExists(obj.user, "id")) {
193
- * console.log(obj.user.id); // Safe nested access
194
- * }
195
- * ```
196
- *
197
- * @since 2.18.45
198
- */
199
- declare function propertyExists<X, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
200
-
201
- declare function readValueAsDate<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: string | null | TDate): TDate | null;
202
-
203
- declare const removeLeadingTrailingSlashes: (route: string) => string;
204
-
205
- declare const schemaTools: {
206
- date: ({ message }?: {
207
- message?: string;
208
- }) => z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodTransform<string | null, string>>;
209
- nullableDate: ({ message }?: {
210
- message?: string;
211
- }) => z.ZodPipe<z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodTransform<string | null, string>>, z.ZodTransform<string | null, string | null>>;
212
- dateRange: ({ message }?: {
213
- message?: string;
214
- }) => z.ZodObject<{
215
- start: z.ZodCoercedDate<unknown>;
216
- end: z.ZodCoercedDate<unknown>;
217
- }, z.core.$strip>;
218
- requiredString: ({ message, min, max }?: {
219
- message?: string;
220
- min?: number;
221
- max?: number;
222
- }) => z.ZodString;
223
- email: ({ message }?: {
224
- message?: string;
225
- }) => z.ZodString;
226
- url: ({ message }?: {
227
- message?: string;
228
- }) => z.ZodString;
229
- phone: ({ message }?: {
230
- message?: string;
231
- }) => z.ZodString;
232
- alphanumeric: ({ message }?: {
233
- message?: string;
234
- }) => z.ZodString;
235
- slug: ({ message }?: {
236
- message?: string;
237
- }) => z.ZodString;
238
- positiveNumber: ({ message, min, max }?: {
239
- message?: string;
240
- min?: number;
241
- max?: number;
242
- }) => z.ZodNumber;
243
- nonNegativeNumber: ({ message, max }?: {
244
- message?: string;
245
- max?: number;
246
- }) => z.ZodNumber;
247
- integer: ({ message, min, max }?: {
248
- message?: string;
249
- min?: number;
250
- max?: number;
251
- }) => z.ZodNumber;
252
- percentage: ({ message }?: {
253
- message?: string;
254
- }) => z.ZodNumber;
255
- nonEmptyArray: <T>(schema: z.ZodSchema<T>, { message }?: {
256
- message?: string;
257
- }) => z.ZodArray<z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>>;
258
- uniqueArray: <T>(schema: z.ZodSchema<T>, { message }?: {
259
- message?: string;
260
- }) => z.ZodArray<z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>>;
261
- requiredBoolean: ({ message }?: {
262
- message?: string;
263
- }) => z.ZodBoolean;
264
- nonEmptyObject: <T extends Record<string, unknown>>(schema: z.ZodSchema<T>, { message }?: {
265
- message?: string;
266
- }) => z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>;
267
- fileSize: ({ maxSize, message }: {
268
- maxSize: number;
269
- message?: string;
270
- }) => z.ZodCustom<File, File>;
271
- fileType: ({ allowedTypes, message }: {
272
- allowedTypes: string[];
273
- message?: string;
274
- }) => z.ZodCustom<File, File>;
275
- conditional: <T, U>(condition: (data: T) => boolean, trueSchema: z.ZodSchema<U>, falseSchema: z.ZodSchema<U>) => z.ZodUnion<readonly [z.ZodType<U, unknown, z.core.$ZodTypeInternals<U, unknown>>, z.ZodType<U, unknown, z.core.$ZodTypeInternals<U, unknown>>]>;
276
- transform: {
277
- toLowerCase: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
278
- toUpperCase: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
279
- trim: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
280
- toNumber: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
281
- toBoolean: z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>;
282
- parseJson: <T>(schema: z.ZodSchema<T>) => z.ZodPipe<z.ZodString, z.ZodTransform<Awaited<T>, string>>;
283
- };
284
- };
285
-
286
- /**
287
- * Core watch functions for React Hook Form
288
- * These are the primary building blocks for form watching
289
- */
290
- /**
291
- * Utility type to ensure array elements are all Path<T>
292
- */
293
- type PathArray<T extends FieldValues> = ReadonlyArray<Path<T>>;
294
- /**
295
- * Hook to watch entire form - returns all form values
296
- */
297
- declare const useWatchForm: <TFieldValues extends FieldValues>(control: Control<TFieldValues>) => DeepPartialSkipArrayKey<TFieldValues>;
298
- /**
299
- * Hook to watch single field by path - supports any nested path
300
- */
301
- declare const useWatchField: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(control: Control<TFieldValues>, name: TName) => PathValue<TFieldValues, TName>;
302
- /**
303
- * Hook to watch multiple fields by paths - returns array of values
304
- */
305
- declare const useWatchFields: <TFieldValues extends FieldValues, TNames extends ReadonlyArray<Path<TFieldValues>>>(control: Control<TFieldValues>, names: TNames) => Array<PathValue<TFieldValues, TNames[number]>>;
306
-
307
- /**
308
- * Utility watch functions for React Hook Form
309
- * Enhanced functionality for specific use cases
310
- */
311
- /**
312
- * Watch field with transformation/selector
313
- */
314
- declare const useWatchTransform: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>, TOutput>(control: Control<TFieldValues>, name: TName, transform: (value: PathValue<TFieldValues, TName>) => TOutput) => TOutput;
315
- /**
316
- * Watch field with default fallback value
317
- */
318
- declare const useWatchDefault: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(control: Control<TFieldValues>, name: TName, defaultValue: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
319
- /**
320
- * Watch field as boolean with guaranteed boolean return
321
- */
322
- declare const useWatchBoolean: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(control: Control<TFieldValues>, name: TName, defaultValue?: boolean) => boolean;
323
- /**
324
- * Watch multiple fields and return an object with field paths as keys
325
- */
326
- declare const useWatchBatch: <TFieldValues extends FieldValues, TFields extends ReadonlyArray<Path<TFieldValues>>>(control: Control<TFieldValues>, fields: TFields) => { [K in TFields[number]]: PathValue<TFieldValues, K>; };
327
- /**
328
- * Watch field conditionally based on boolean flag
329
- */
330
- declare const useWatchConditional: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(control: Control<TFieldValues>, name: TName, shouldWatch: boolean, fallback?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName> | undefined;
331
- /**
332
- * Watch field with debounced updates
333
- */
334
- declare const useWatchDebounced: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(control: Control<TFieldValues>, name: TName, delay?: number) => PathValue<TFieldValues, TName>;
335
- /**
336
- * Watch field with memoized selector function
337
- */
338
- declare const useWatchSelector: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>, TOutput>(control: Control<TFieldValues>, name: TName, selector: (value: PathValue<TFieldValues, TName>) => TOutput, deps?: React.DependencyList) => TOutput;
339
-
340
- /**
341
- * Organized utilities by use case
342
- * Provides a convenient object-based API for all watch functions
343
- */
344
- declare const typedWatch: {
345
- /** Watch entire form */
346
- readonly form: <TFieldValues extends react_hook_form.FieldValues>(control: react_hook_form.Control<TFieldValues>) => react_hook_form.DeepPartialSkipArrayKey<TFieldValues>;
347
- /** Watch single field */
348
- readonly field: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>>(control: react_hook_form.Control<TFieldValues>, name: TName) => react_hook_form.PathValue<TFieldValues, TName>;
349
- /** Watch multiple fields */
350
- readonly fields: <TFieldValues extends react_hook_form.FieldValues, TNames extends ReadonlyArray<react_hook_form.Path<TFieldValues>>>(control: react_hook_form.Control<TFieldValues>, names: TNames) => Array<react_hook_form.PathValue<TFieldValues, TNames[number]>>;
351
- /** Watch with transformation */
352
- readonly transform: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>, TOutput>(control: react_hook_form.Control<TFieldValues>, name: TName, transform: (value: react_hook_form.PathValue<TFieldValues, TName>) => TOutput) => TOutput;
353
- /** Watch with default value */
354
- readonly withDefault: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>>(control: react_hook_form.Control<TFieldValues>, name: TName, defaultValue: react_hook_form.PathValue<TFieldValues, TName>) => react_hook_form.PathValue<TFieldValues, TName>;
355
- /** Watch as boolean */
356
- readonly boolean: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>>(control: react_hook_form.Control<TFieldValues>, name: TName, defaultValue?: boolean) => boolean;
357
- /** Watch multiple with custom keys */
358
- readonly batch: <TFieldValues extends react_hook_form.FieldValues, TFields extends ReadonlyArray<react_hook_form.Path<TFieldValues>>>(control: react_hook_form.Control<TFieldValues>, fields: TFields) => { [K in TFields[number]]: react_hook_form.PathValue<TFieldValues, K>; };
359
- /** Watch conditionally */
360
- readonly conditional: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>>(control: react_hook_form.Control<TFieldValues>, name: TName, shouldWatch: boolean, fallback?: react_hook_form.PathValue<TFieldValues, TName>) => react_hook_form.PathValue<TFieldValues, TName> | undefined;
361
- /** Watch with debouncing */
362
- readonly debounced: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>>(control: react_hook_form.Control<TFieldValues>, name: TName, delay?: number) => react_hook_form.PathValue<TFieldValues, TName>;
363
- /** Watch with selector */
364
- readonly selector: <TFieldValues extends react_hook_form.FieldValues, TName extends react_hook_form.Path<TFieldValues>, TOutput>(control: react_hook_form.Control<TFieldValues>, name: TName, selector: (value: react_hook_form.PathValue<TFieldValues, TName>) => TOutput, deps?: React.DependencyList) => TOutput;
365
- };
366
-
367
- /**
368
- * Type guard utilities for runtime type checking
369
- *
370
- * @packageDocumentation
371
- */
372
- /**
373
- * Type guard to check if a value is a non-null object (excluding arrays)
374
- *
375
- * @param value - The value to check
376
- * @returns True if the value is a plain object
377
- *
378
- * @example
379
- * ```typescript
380
- * if (isRecord(value)) {
381
- * // value is Record<string, unknown>
382
- * const keys = Object.keys(value);
383
- * }
384
- * ```
385
- *
386
- * @public
387
- */
388
- declare function isRecord(value: unknown): value is Record<string, unknown>;
389
- /**
390
- * Type guard to check if an object has a specific property
391
- *
392
- * @param obj - The object to check
393
- * @param key - The property key to look for
394
- * @returns True if the object has the property
395
- *
396
- * @example
397
- * ```typescript
398
- * if (hasProperty(obj, 'name')) {
399
- * // obj is Record<'name', unknown>
400
- * console.log(obj.name);
401
- * }
402
- * ```
403
- *
404
- * @public
405
- */
406
- declare function hasProperty<K extends PropertyKey>(obj: unknown, key: K): obj is Record<K, unknown>;
407
- /**
408
- * Type guard to check if a value is a non-empty string
409
- *
410
- * @param value - The value to check
411
- * @returns True if the value is a non-empty string
412
- *
413
- * @example
414
- * ```typescript
415
- * if (isNonEmptyString(value)) {
416
- * // value is string with length > 0
417
- * console.log(value.toUpperCase());
418
- * }
419
- * ```
420
- *
421
- * @public
422
- */
423
- declare function isNonEmptyString(value: unknown): value is string;
424
- /**
425
- * Type guard to check if a value is a valid array
426
- *
427
- * @param value - The value to check
428
- * @returns True if the value is an array
429
- *
430
- * @example
431
- * ```typescript
432
- * if (isArray(value)) {
433
- * // value is unknown[]
434
- * value.forEach(item => console.log(item));
435
- * }
436
- * ```
437
- *
438
- * @public
439
- */
440
- declare function isArray<T = unknown>(value: unknown): value is T[];
441
- /**
442
- * Type guard to check if a value is a non-empty array
443
- *
444
- * @param value - The value to check
445
- * @returns True if the value is a non-empty array
446
- *
447
- * @example
448
- * ```typescript
449
- * if (isNonEmptyArray(items)) {
450
- * // items is [T, ...T[]] - guaranteed to have at least one element
451
- * const first = items[0]; // Safe access
452
- * }
453
- * ```
454
- *
455
- * @public
456
- */
457
- declare function isNonEmptyArray<T>(value: unknown): value is [T, ...T[]];
458
- /**
459
- * Type guard to check if a value is a function
460
- *
461
- * @param value - The value to check
462
- * @returns True if the value is a function
463
- *
464
- * @example
465
- * ```typescript
466
- * if (isFunction(callback)) {
467
- * // callback is (...args: unknown[]) => unknown
468
- * callback();
469
- * }
470
- * ```
471
- *
472
- * @public
473
- */
474
- declare function isFunction(value: unknown): value is (...args: readonly unknown[]) => unknown;
475
- /**
476
- * Type guard to check if a value is a string
477
- *
478
- * @param value - The value to check
479
- * @returns True if the value is a string (including empty string)
480
- *
481
- * @example
482
- * ```typescript
483
- * if (isString(value)) {
484
- * // value is string
485
- * console.log(value.length);
486
- * }
487
- * ```
488
- *
489
- * @public
490
- */
491
- declare function isString(value: unknown): value is string;
492
- /**
493
- * Type guard to check if a value is a number (excluding NaN)
494
- *
495
- * @param value - The value to check
496
- * @returns True if the value is a valid number
497
- *
498
- * @example
499
- * ```typescript
500
- * if (isNumber(value)) {
501
- * // value is number (not NaN)
502
- * const doubled = value * 2;
503
- * }
504
- * ```
505
- *
506
- * @public
507
- */
508
- declare function isNumber(value: unknown): value is number;
509
- /**
510
- * Type guard to check if a value is a boolean
511
- *
512
- * @param value - The value to check
513
- * @returns True if the value is a boolean
514
- *
515
- * @example
516
- * ```typescript
517
- * if (isBoolean(value)) {
518
- * // value is boolean
519
- * console.log(!value);
520
- * }
521
- * ```
522
- *
523
- * @public
524
- */
525
- declare function isBoolean(value: unknown): value is boolean;
526
- /**
527
- * Type guard to check if a value is null
528
- *
529
- * @param value - The value to check
530
- * @returns True if the value is null
531
- *
532
- * @example
533
- * ```typescript
534
- * if (isNull(value)) {
535
- * // value is null
536
- * return defaultValue;
537
- * }
538
- * ```
539
- *
540
- * @public
541
- */
542
- declare function isNull(value: unknown): value is null;
543
- /**
544
- * Type guard to check if a value is undefined
545
- *
546
- * @param value - The value to check
547
- * @returns True if the value is undefined
548
- *
549
- * @example
550
- * ```typescript
551
- * if (isUndefined(value)) {
552
- * // value is undefined
553
- * return defaultValue;
554
- * }
555
- * ```
556
- *
557
- * @public
558
- */
559
- declare function isUndefined(value: unknown): value is undefined;
560
- /**
561
- * Type guard to check if a value is null or undefined
562
- *
563
- * @param value - The value to check
564
- * @returns True if the value is nullish
565
- *
566
- * @example
567
- * ```typescript
568
- * if (isNullish(value)) {
569
- * // value is null | undefined
570
- * return defaultValue;
571
- * }
572
- *
573
- * if (!isNullish(value)) {
574
- * // value is NonNullable<typeof value>
575
- * console.log(value);
576
- * }
577
- * ```
578
- *
579
- * @public
580
- */
581
- declare function isNullish(value: unknown): value is null | undefined;
582
- /**
583
- * Type guard to check if a value is defined (not null or undefined)
584
- *
585
- * @param value - The value to check
586
- * @returns True if the value is not null or undefined
587
- *
588
- * @example
589
- * ```typescript
590
- * const filtered = items.filter(isDefined);
591
- * // filtered has type: NonNullable<T>[]
592
- * ```
593
- *
594
- * @public
595
- */
596
- declare function isDefined<T>(value: T): value is NonNullable<T>;
597
- /**
598
- * Type guard to check if a value is a Date object
599
- *
600
- * @param value - The value to check
601
- * @returns True if the value is a Date
602
- *
603
- * @example
604
- * ```typescript
605
- * if (isDate(value)) {
606
- * // value is Date
607
- * console.log(value.toISOString());
608
- * }
609
- * ```
610
- *
611
- * @public
612
- */
613
- declare function isDate(value: unknown): value is Date;
614
- /**
615
- * Type guard to check if a value is a Promise
616
- *
617
- * @param value - The value to check
618
- * @returns True if the value is a Promise
619
- *
620
- * @example
621
- * ```typescript
622
- * if (isPromise(value)) {
623
- * // value is Promise<unknown>
624
- * const result = await value;
625
- * }
626
- * ```
627
- *
628
- * @public
629
- */
630
- declare function isPromise(value: unknown): value is Promise<unknown>;
631
- /**
632
- * Type guard to check if an error is an Error instance
633
- *
634
- * @param error - The error to check
635
- * @returns True if the error is an Error instance
636
- *
637
- * @example
638
- * ```typescript
639
- * try {
640
- * // ...
641
- * } catch (error) {
642
- * if (isError(error)) {
643
- * // error is Error
644
- * console.error(error.message);
645
- * }
646
- * }
647
- * ```
648
- *
649
- * @public
650
- */
651
- declare function isError(error: unknown): error is Error;
652
- /**
653
- * Type guard to check if a value matches a specific type using a validator function
654
- *
655
- * @param value - The value to check
656
- * @param validator - Function that returns true if value matches the type
657
- * @returns True if the value matches the type
658
- *
659
- * @example
660
- * ```typescript
661
- * interface User {
662
- * id: string;
663
- * name: string;
664
- * }
665
- *
666
- * const isUser = (value: unknown): value is User =>
667
- * isRecord(value) &&
668
- * hasProperty(value, 'id') &&
669
- * hasProperty(value, 'name') &&
670
- * isString(value.id) &&
671
- * isString(value.name);
672
- *
673
- * if (isUser(data)) {
674
- * // data is User
675
- * console.log(data.name);
676
- * }
677
- * ```
678
- *
679
- * @public
680
- */
681
- declare function matches<T>(value: unknown, validator: (value: unknown) => value is T): value is T;
682
-
683
- export { type PathArray, api, api2, flattenObjectKeys, getTimezone, handleServerErrors, hasProperty, isArray, isBoolean, isDate, isDefined, isError, isFunction, isNonEmptyArray, isNonEmptyString, isNull, isNullish, isNumber, isPromise, isRecord, isString, isUndefined, matches, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools, typedWatch, useWatchBatch, useWatchBoolean, useWatchConditional, useWatchDebounced, useWatchDefault, useWatchField, useWatchFields, useWatchForm, useWatchSelector, useWatchTransform };