@katlux/providers 0.1.0-beta.9 → 0.1.1-alpha.100

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/index.d.mts CHANGED
@@ -1,3 +1,36 @@
1
+ /**
2
+ * types.ts — Framework-agnostic hydration and platform abstraction contracts.
3
+ */
4
+ interface ISSRHydrationAdapter {
5
+ /**
6
+ * Retrieve pre-hydrated SSR state for a key. Returns null if not present.
7
+ */
8
+ getSSRData<T>(key: string, context?: any): T | null;
9
+ /**
10
+ * Execute fetcher with SSR serialization/caching if in an SSR environment,
11
+ * or simply await fetcher() in standalone/client environments.
12
+ */
13
+ fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
14
+ /**
15
+ * Invalidate or clear SSR cache for a key (e.g. after mutations).
16
+ */
17
+ clearSSRData?(key: string, context?: any): void;
18
+ /**
19
+ * Extract SSR hydration payload dictionary (for cache initialization).
20
+ */
21
+ getSSRPayload?(context?: any): Record<string, any> | null;
22
+ }
23
+ interface IPlatformRouter {
24
+ getRoute(): {
25
+ query: Record<string, any>;
26
+ path?: string;
27
+ } | null;
28
+ getRouter(): any;
29
+ onReady?(cb: () => void): void;
30
+ }
31
+
32
+ type TDataProviderListener<T = any> = (provider: T) => void;
33
+ type TUnsubscribe = () => void;
1
34
  declare enum EDataFilterOperator {
2
35
  Equal = "==",
3
36
  NotEqual = "!=",
@@ -35,12 +68,53 @@ interface IRequestOptions {
35
68
  cacheKey?: string;
36
69
  query?: Record<string, any>;
37
70
  deduplicate?: boolean;
71
+ context?: any;
72
+ /** @deprecated Use `context` instead */
38
73
  nuxtApp?: any;
39
74
  disableCache?: boolean;
75
+ queue?: boolean;
76
+ queueLabel?: string;
77
+ label?: string;
78
+ tags?: string[];
79
+ signal?: AbortSignal;
80
+ }
81
+ /** Queue persistence backend with automatic fallback: IndexedDB → LocalStorage → Memory */
82
+ declare enum EQueueStorage {
83
+ Memory = "Memory",
84
+ LocalStorage = "LocalStorage",
85
+ IndexedDB = "IndexedDB"
86
+ }
87
+ /** Status of an item currently in the pending queue */
88
+ type TQueueItemStatus = 'pending' | 'flushing';
89
+ /** A single mutation operation waiting to be sent */
90
+ interface IQueuedOperation {
91
+ id: string;
92
+ url: string;
93
+ method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
94
+ options: IRequestOptions;
95
+ tags: string[];
96
+ label?: string;
97
+ createdAt: number;
98
+ flushAttempts: number;
99
+ status: TQueueItemStatus;
100
+ }
101
+ /** An operation that failed permanently and was moved to the dead-letter store */
102
+ interface IDeadLetterItem extends IQueuedOperation {
103
+ failedAt: number;
104
+ lastError: string;
105
+ httpStatus?: number;
106
+ }
107
+ /** Options for flush operations */
108
+ interface IFlushOptions {
109
+ tag?: string;
40
110
  }
41
111
  interface IKDatatableAction {
42
112
  action: Function;
43
113
  label: string;
114
+ icon?: string;
115
+ iconOnly?: boolean;
116
+ type?: 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
117
+ visible?: Function;
44
118
  }
45
119
  type TDataRow = {
46
120
  [key: string]: any;
@@ -62,18 +136,23 @@ type TPageDataHandler = (currentPage: number, pageSize: number, filter: IDataFil
62
136
  disableCache?: boolean;
63
137
  }) => IDataResult | Promise<IDataResult>;
64
138
  interface IDataProviderOptions {
139
+ idKey?: string;
65
140
  filter?: IDataFilter;
66
141
  sortList?: IDataSort[];
67
142
  pageSize?: number;
68
143
  currentPage?: number;
69
144
  SSR?: boolean;
145
+ initialLoad?: boolean;
70
146
  cacheStrategy?: ECacheStrategy;
71
147
  cacheLifetime?: number;
72
148
  deduplicate?: boolean;
149
+ context?: any;
150
+ /** @deprecated Use `context` instead for framework-agnostic SSR context */
73
151
  nuxtApp?: any;
74
152
  urlPageParam?: string;
75
153
  refreshOnMutation?: boolean;
76
154
  }
155
+
77
156
  interface ITreeNode {
78
157
  data: TDataRow;
79
158
  id: string | number;
@@ -88,6 +167,7 @@ interface ITreeNodeStatic {
88
167
  parentId: string | number | null;
89
168
  depth: number;
90
169
  hasChildren: boolean;
170
+ childIds?: (string | number)[];
91
171
  }
92
172
  type TreePaginationMode = 'all' | 'root';
93
173
  interface ITreeDataProviderOptions extends IDataProviderOptions {
@@ -96,6 +176,19 @@ interface ITreeDataProviderOptions extends IDataProviderOptions {
96
176
  expandedByDefault?: boolean;
97
177
  paginateBy?: TreePaginationMode;
98
178
  }
179
+ /**
180
+ * Tree-specific page data handler that includes tree parameters
181
+ * Server handles tree building, visibility, and pagination
182
+ */
183
+ type TTreePageDataHandler = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], treeParams: {
184
+ expandedNodes: (string | number)[] | Set<string | number>;
185
+ parentKey: string;
186
+ idKey: string;
187
+ paginateBy: TreePaginationMode;
188
+ expandedByDefault: boolean;
189
+ }, options?: {
190
+ disableCache?: boolean;
191
+ }) => IDataResult | Promise<IDataResult>;
99
192
  interface KProductItemData {
100
193
  id: string | number;
101
194
  title: string;
@@ -112,1440 +205,74 @@ interface KProductRowAction {
112
205
  color?: 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark' | 'default';
113
206
  }
114
207
 
115
- type Prettify<T> = {
116
- [K in keyof T]: T[K];
117
- } & {};
118
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
119
- type LooseRequired<T> = {
120
- [P in keyof (T & Required<T>)]: T[P];
121
- };
122
- type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
123
-
124
- declare enum TrackOpTypes {
125
- GET = "get",
126
- HAS = "has",
127
- ITERATE = "iterate"
128
- }
129
- declare enum TriggerOpTypes {
130
- SET = "set",
131
- ADD = "add",
132
- DELETE = "delete",
133
- CLEAR = "clear"
134
- }
135
-
136
- type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
137
- declare const ShallowReactiveMarker: unique symbol;
138
- type Primitive = string | number | boolean | bigint | symbol | undefined | null;
139
- type Builtin = Primitive | Function | Date | Error | RegExp;
140
-
141
- type EffectScheduler = (...args: any[]) => any;
142
- type DebuggerEvent = {
143
- effect: Subscriber;
144
- } & DebuggerEventExtraInfo;
145
- type DebuggerEventExtraInfo = {
146
- target: object;
147
- type: TrackOpTypes | TriggerOpTypes;
148
- key: any;
149
- newValue?: any;
150
- oldValue?: any;
151
- oldTarget?: Map<any, any> | Set<any>;
152
- };
153
- interface DebuggerOptions {
154
- onTrack?: (event: DebuggerEvent) => void;
155
- onTrigger?: (event: DebuggerEvent) => void;
156
- }
157
- interface ReactiveEffectOptions extends DebuggerOptions {
158
- scheduler?: EffectScheduler;
159
- allowRecurse?: boolean;
160
- onStop?: () => void;
161
- }
162
- /**
163
- * Subscriber is a type that tracks (or subscribes to) a list of deps.
164
- */
165
- interface Subscriber extends DebuggerOptions {
166
- }
167
- declare class ReactiveEffect<T = any> implements Subscriber, ReactiveEffectOptions {
168
- fn: () => T;
169
- scheduler?: EffectScheduler;
170
- onStop?: () => void;
171
- onTrack?: (event: DebuggerEvent) => void;
172
- onTrigger?: (event: DebuggerEvent) => void;
173
- constructor(fn: () => T);
174
- pause(): void;
175
- resume(): void;
176
- run(): T;
177
- stop(): void;
178
- trigger(): void;
179
- get dirty(): boolean;
180
- }
181
- type ComputedGetter<T> = (oldValue?: T) => T;
182
- type ComputedSetter<T> = (newValue: T) => void;
183
- interface WritableComputedOptions<T, S = T> {
184
- get: ComputedGetter<T>;
185
- set: ComputedSetter<S>;
186
- }
187
-
188
- declare const RefSymbol: unique symbol;
189
- declare const RawSymbol: unique symbol;
190
- interface Ref<T = any, S = T> {
191
- get value(): T;
192
- set value(_: S);
193
- /**
194
- * Type differentiator only.
195
- * We need this to be in public d.ts but don't want it to show up in IDE
196
- * autocomplete, so we use a private Symbol instead.
197
- */
198
- [RefSymbol]: true;
199
- }
200
- declare const ShallowRefMarker: unique symbol;
201
- type ShallowRef<T = any, S = T> = Ref<T, S> & {
202
- [ShallowRefMarker]?: true;
203
- };
204
- /**
205
- * This is a special exported interface for other packages to declare
206
- * additional types that should bail out for ref unwrapping. For example
207
- * \@vue/runtime-dom can declare it like so in its d.ts:
208
- *
209
- * ``` ts
210
- * declare module '@vue/reactivity' {
211
- * export interface RefUnwrapBailTypes {
212
- * runtimeDOMBailTypes: Node | Window
213
- * }
214
- * }
215
- * ```
216
- */
217
- interface RefUnwrapBailTypes {
218
- }
219
- type ShallowUnwrapRef<T> = {
220
- [K in keyof T]: DistributeRef<T[K]>;
221
- };
222
- type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
223
- type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
224
- type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
225
- [RawSymbol]?: true;
226
- } ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
227
- [K in keyof T]: UnwrapRefSimple<T[K]>;
228
- } : T extends object & {
229
- [ShallowReactiveMarker]?: never;
230
- } ? {
231
- [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
232
- } : T;
233
- type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
234
- type OnCleanup = (cleanupFn: () => void) => void;
235
- type WatchStopHandle = () => void;
236
-
237
- type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
238
- type InternalSlots = {
239
- [name: string]: Slot | undefined;
240
- };
241
- type Slots = Readonly<InternalSlots>;
242
- declare const SlotSymbol: unique symbol;
243
- type SlotsType<T extends Record<string, any> = Record<string, any>> = {
244
- [SlotSymbol]?: T;
245
- };
246
- type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
247
- type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
248
- [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
249
- }>>;
250
- type RawSlots = {
251
- [name: string]: unknown;
252
- $stable?: boolean;
253
- };
254
-
255
- declare enum SchedulerJobFlags {
256
- QUEUED = 1,
257
- PRE = 2,
258
- /**
259
- * Indicates whether the effect is allowed to recursively trigger itself
260
- * when managed by the scheduler.
261
- *
262
- * By default, a job cannot trigger itself because some built-in method calls,
263
- * e.g. Array.prototype.push actually performs reads as well (#1740) which
264
- * can lead to confusing infinite loops.
265
- * The allowed cases are component update functions and watch callbacks.
266
- * Component update functions may update child component props, which in turn
267
- * trigger flush: "pre" watch callbacks that mutates state that the parent
268
- * relies on (#1801). Watch callbacks doesn't track its dependencies so if it
269
- * triggers itself again, it's likely intentional and it is the user's
270
- * responsibility to perform recursive state mutation that eventually
271
- * stabilizes (#1727).
272
- */
273
- ALLOW_RECURSE = 4,
274
- DISPOSED = 8
275
- }
276
- interface SchedulerJob extends Function {
277
- id?: number;
278
- /**
279
- * flags can technically be undefined, but it can still be used in bitwise
280
- * operations just like 0.
281
- */
282
- flags?: SchedulerJobFlags;
283
- /**
284
- * Attached by renderer.ts when setting up a component's render effect
285
- * Used to obtain component information when reporting max recursive updates.
286
- */
287
- i?: ComponentInternalInstance;
288
- }
289
- declare function nextTick(): Promise<void>;
290
- declare function nextTick<T, R>(this: T, fn: (this: T) => R | Promise<R>): Promise<R>;
291
-
292
- type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
293
- type ComponentObjectPropsOptions<P = Data> = {
294
- [K in keyof P]: Prop<P[K]> | null;
295
- };
296
- type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
297
- type DefaultFactory<T> = (props: Data) => T | null | undefined;
298
- interface PropOptions<T = any, D = T> {
299
- type?: PropType<T> | true | null;
300
- required?: boolean;
301
- default?: D | DefaultFactory<D> | null | undefined | object;
302
- validator?(value: unknown, props: Data): boolean;
303
- }
304
- type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
305
- type PropConstructor<T = any> = {
306
- new (...args: any[]): T & {};
307
- } | {
308
- (): T;
309
- } | PropMethod<T>;
310
- type PropMethod<T, TConstructor = any> = [T] extends [
311
- ((...args: any) => any) | undefined
312
- ] ? {
313
- new (): TConstructor;
314
- (): T;
315
- readonly prototype: TConstructor;
316
- } : never;
317
- type RequiredKeys<T> = {
318
- [K in keyof T]: T[K] extends {
319
- required: true;
320
- } | {
321
- default: any;
322
- } | BooleanConstructor | {
323
- type: BooleanConstructor;
324
- } ? T[K] extends {
325
- default: undefined | (() => undefined);
326
- } ? never : K : never;
327
- }[keyof T];
328
- type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
329
- type DefaultKeys<T> = {
330
- [K in keyof T]: T[K] extends {
331
- default: any;
332
- } | BooleanConstructor | {
333
- type: BooleanConstructor;
334
- } ? T[K] extends {
335
- type: BooleanConstructor;
336
- required: true;
337
- } ? never : K : never;
338
- }[keyof T];
339
- type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
340
- type: null | true;
341
- }] ? any : [T] extends [ObjectConstructor | {
342
- type: ObjectConstructor;
343
- }] ? Record<string, any> : [T] extends [BooleanConstructor | {
344
- type: BooleanConstructor;
345
- }] ? boolean : [T] extends [DateConstructor | {
346
- type: DateConstructor;
347
- }] ? Date : [T] extends [(infer U)[] | {
348
- type: (infer U)[];
349
- }] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? IfAny<V, V, D> : V : V : T;
350
- /**
351
- * Extract prop types from a runtime props options object.
352
- * The extracted types are **internal** - i.e. the resolved props received by
353
- * the component.
354
- * - Boolean props are always present
355
- * - Props with default values are always present
356
- *
357
- * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
358
- */
359
- type ExtractPropTypes<O> = {
360
- [K in keyof Pick<O, RequiredKeys<O>>]: O[K] extends {
361
- default: any;
362
- } ? Exclude<InferPropType<O[K]>, undefined> : InferPropType<O[K]>;
363
- } & {
364
- [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
365
- };
366
- type ExtractDefaultPropTypes<O> = O extends object ? {
367
- [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
368
- } : {};
369
-
370
- /**
371
- * Vue `<script setup>` compiler macro for declaring component props. The
372
- * expected argument is the same as the component `props` option.
373
- *
374
- * Example runtime declaration:
375
- * ```js
376
- * // using Array syntax
377
- * const props = defineProps(['foo', 'bar'])
378
- * // using Object syntax
379
- * const props = defineProps({
380
- * foo: String,
381
- * bar: {
382
- * type: Number,
383
- * required: true
384
- * }
385
- * })
386
- * ```
387
- *
388
- * Equivalent type-based declaration:
389
- * ```ts
390
- * // will be compiled into equivalent runtime declarations
391
- * const props = defineProps<{
392
- * foo?: string
393
- * bar: number
394
- * }>()
395
- * ```
396
- *
397
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
398
- *
399
- * This is only usable inside `<script setup>`, is compiled away in the
400
- * output and should **not** be actually called at runtime.
401
- */
402
- declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
403
- [key in PropNames]?: any;
404
- }>>;
405
- declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
406
- declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
407
- type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
408
- readonly [K in BKeys]-?: boolean;
409
- };
410
- type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
411
- /**
412
- * Vue `<script setup>` compiler macro for declaring a component's emitted
413
- * events. The expected argument is the same as the component `emits` option.
414
- *
415
- * Example runtime declaration:
416
- * ```js
417
- * const emit = defineEmits(['change', 'update'])
418
- * ```
419
- *
420
- * Example type-based declaration:
421
- * ```ts
422
- * const emit = defineEmits<{
423
- * // <eventName>: <expected arguments>
424
- * change: []
425
- * update: [value: number] // named tuple syntax
426
- * }>()
427
- *
428
- * emit('change')
429
- * emit('update', 1)
430
- * ```
431
- *
432
- * This is only usable inside `<script setup>`, is compiled away in the
433
- * output and should **not** be actually called at runtime.
434
- *
435
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
436
- */
437
- declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
438
- declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
439
- declare function defineEmits<T extends ComponentTypeEmits>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
440
- type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>;
441
- type RecordToUnion<T extends Record<string, any>> = T[keyof T];
442
- type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
443
- [K in keyof T]: (evt: K, ...args: T[K]) => void;
444
- }>>;
445
- /**
446
- * Vue `<script setup>` compiler macro for declaring a component's exposed
447
- * instance properties when it is accessed by a parent component via template
448
- * refs.
449
- *
450
- * `<script setup>` components are closed by default - i.e. variables inside
451
- * the `<script setup>` scope is not exposed to parent unless explicitly exposed
452
- * via `defineExpose`.
453
- *
454
- * This is only usable inside `<script setup>`, is compiled away in the
455
- * output and should **not** be actually called at runtime.
456
- *
457
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
458
- */
459
- declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
460
- /**
461
- * Vue `<script setup>` compiler macro for declaring a component's additional
462
- * options. This should be used only for options that cannot be expressed via
463
- * Composition API - e.g. `inheritAttrs`.
464
- *
465
- * @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
466
- */
467
- declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsBase<{}, RawBindings, D, C, M, Mixin, Extends, {}> & {
468
- /**
469
- * props should be defined via defineProps().
470
- */
471
- props?: never;
472
- /**
473
- * emits should be defined via defineEmits().
474
- */
475
- emits?: never;
476
- /**
477
- * expose should be defined via defineExpose().
478
- */
479
- expose?: never;
480
- /**
481
- * slots should be defined via defineSlots().
482
- */
483
- slots?: never;
484
- }): void;
485
- declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
486
- type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
487
- ModelRef<T, M, G, S>,
488
- Record<M, true | undefined>
489
- ];
490
- type DefineModelOptions<T = any, G = T, S = T> = {
491
- get?: (v: T) => G;
492
- set?: (v: S) => any;
493
- };
494
- /**
495
- * Vue `<script setup>` compiler macro for declaring a
496
- * two-way binding prop that can be consumed via `v-model` from the parent
497
- * component. This will declare a prop with the same name and a corresponding
498
- * `update:propName` event.
499
- *
500
- * If the first argument is a string, it will be used as the prop name;
501
- * Otherwise the prop name will default to "modelValue". In both cases, you
502
- * can also pass an additional object which will be used as the prop's options.
503
- *
504
- * The returned ref behaves differently depending on whether the parent
505
- * provided the corresponding v-model props or not:
506
- * - If yes, the returned ref's value will always be in sync with the parent
507
- * prop.
508
- * - If not, the returned ref will behave like a normal local ref.
509
- *
510
- * @example
511
- * ```ts
512
- * // default model (consumed via `v-model`)
513
- * const modelValue = defineModel<string>()
514
- * modelValue.value = "hello"
515
- *
516
- * // default model with options
517
- * const modelValue = defineModel<string>({ required: true })
518
- *
519
- * // with specified name (consumed via `v-model:count`)
520
- * const count = defineModel<number>('count')
521
- * count.value++
522
- *
523
- * // with specified name and default value
524
- * const count = defineModel<number>('count', { default: 0 })
525
- * ```
526
- */
527
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options: ({
528
- default: any;
529
- } | {
530
- required: true;
531
- }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
532
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
533
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options: ({
534
- default: any;
535
- } | {
536
- required: true;
537
- }) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
538
- declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
539
- type NotUndefined<T> = T extends undefined ? never : T;
540
- type MappedOmit<T, K extends keyof any> = {
541
- [P in keyof T as P extends K ? never : P]: T[P];
542
- };
543
- type InferDefaults<T> = {
544
- [K in keyof T]?: InferDefault<T, T[K]>;
545
- };
546
- type NativeType = null | undefined | number | string | boolean | symbol | Function;
547
- type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
548
- type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = T extends unknown ? Readonly<MappedOmit<T, keyof Defaults>> & {
549
- readonly [K in keyof Defaults as K extends keyof T ? K : never]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never;
550
- } & {
551
- readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
552
- } : never;
553
- /**
554
- * Vue `<script setup>` compiler macro for providing props default values when
555
- * using type-based `defineProps` declaration.
556
- *
557
- * Example usage:
558
- * ```ts
559
- * withDefaults(defineProps<{
560
- * size?: number
561
- * labels?: string[]
562
- * }>(), {
563
- * size: 3,
564
- * labels: () => ['default label']
565
- * })
566
- * ```
567
- *
568
- * This is only usable inside `<script setup>`, is compiled away in the output
569
- * and should **not** be actually called at runtime.
570
- *
571
- * @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
572
- */
573
- declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
574
-
575
- type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
576
- type EmitsOptions = ObjectEmitsOptions | string[];
577
- type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? {
578
- [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
579
- } : T extends ObjectEmitsOptions ? {
580
- [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never) => any;
581
- } : {};
582
- type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
583
- [K in keyof E]: (...args: E[K]) => any;
584
- } : E;
585
- type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
586
- [key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void;
587
- }[Event]>;
588
-
589
- /**
590
- Runtime helper for applying directives to a vnode. Example usage:
591
-
592
- const comp = resolveComponent('comp')
593
- const foo = resolveDirective('foo')
594
- const bar = resolveDirective('bar')
595
-
596
- return withDirectives(h(comp), [
597
- [foo, this.x],
598
- [bar, this.y]
599
- ])
600
- */
601
-
602
- interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg = any> {
603
- instance: ComponentPublicInstance | Record<string, any> | null;
604
- value: Value;
605
- oldValue: Value | null;
606
- arg?: Arg;
607
- modifiers: DirectiveModifiers<Modifiers>;
608
- dir: ObjectDirective<any, Value, Modifiers, Arg>;
609
- }
610
- type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg = any> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
611
- type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg = any> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
612
- interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> {
613
- created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
614
- beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
615
- mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
616
- beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
617
- updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
618
- beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
619
- unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
620
- getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
621
- deep?: boolean;
622
- }
623
- type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg = any> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
624
- type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
625
- type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
626
-
627
- /**
628
- * Custom properties added to component instances in any way and can be accessed through `this`
629
- *
630
- * @example
631
- * Here is an example of adding a property `$router` to every component instance:
632
- * ```ts
633
- * import { createApp } from 'vue'
634
- * import { Router, createRouter } from 'vue-router'
635
- *
636
- * declare module 'vue' {
637
- * interface ComponentCustomProperties {
638
- * $router: Router
639
- * }
640
- * }
641
- *
642
- * // effectively adding the router to every component instance
643
- * const app = createApp({})
644
- * const router = createRouter()
645
- * app.config.globalProperties.$router = router
646
- *
647
- * const vm = app.mount('#app')
648
- * // we can access the router from the instance
649
- * vm.$router.push('/')
650
- * ```
651
- */
652
- interface ComponentCustomProperties {
653
- }
654
- type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
655
- type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any, any, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
656
- type ExtractMixin<T> = {
657
- Mixin: MixinToOptionTypes<T>;
658
- }[T extends ComponentOptionsMixin ? 'Mixin' : never];
659
- type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
660
- type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
661
- type EnsureNonVoid<T> = T extends void ? {} : T;
662
- type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
663
- __isFragment?: never;
664
- __isTeleport?: never;
665
- __isSuspense?: never;
666
- new (...args: any[]): T;
667
- };
668
- /**
669
- * This is the same as `CreateComponentPublicInstance` but adds local components,
670
- * global directives, exposed, and provide inference.
671
- * It changes the arguments order so that we don't need to repeat mixin
672
- * inference everywhere internally, but it has to be a new type to avoid
673
- * breaking types that relies on previous arguments order (#10842)
674
- */
675
- type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl extends Element = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
676
- type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
677
- type ComponentPublicInstance<P = {}, // props type extracted from props option
678
- B = {}, // raw bindings returned from setup()
679
- D = {}, // return from data()
680
- C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = '', TypeRefs extends Data = {}, TypeEl extends Element = any> = {
681
- $: ComponentInternalInstance;
682
- $data: D;
683
- $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
684
- $attrs: Data;
685
- $refs: Data & TypeRefs;
686
- $slots: UnwrapSlotsType<S>;
687
- $root: ComponentPublicInstance | null;
688
- $parent: ComponentPublicInstance | null;
689
- $host: Element | null;
690
- $emit: EmitFn<E>;
691
- $el: TypeEl;
692
- $options: Options & MergedComponentOptionsOverride;
693
- $forceUpdate: () => void;
694
- $nextTick: typeof nextTick;
695
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
696
- } & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
697
-
698
- interface SuspenseProps {
699
- onResolve?: () => void;
700
- onPending?: () => void;
701
- onFallback?: () => void;
702
- timeout?: string | number;
703
- /**
704
- * Allow suspense to be captured by parent suspense
705
- *
706
- * @default false
707
- */
708
- suspensible?: boolean;
709
- }
710
- declare const SuspenseImpl: {
711
- name: string;
712
- __isSuspense: boolean;
713
- process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
714
- hydrate: typeof hydrateSuspense;
715
- normalize: typeof normalizeSuspenseChildren;
716
- };
717
- declare const Suspense: {
718
- __isSuspense: true;
719
- new (): {
720
- $props: VNodeProps & SuspenseProps;
721
- $slots: {
722
- default(): VNode[];
723
- fallback(): VNode[];
724
- };
725
- };
726
- };
727
- interface SuspenseBoundary {
728
- vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
729
- parent: SuspenseBoundary | null;
730
- parentComponent: ComponentInternalInstance | null;
731
- namespace: ElementNamespace;
732
- container: RendererElement;
733
- hiddenContainer: RendererElement;
734
- activeBranch: VNode | null;
735
- pendingBranch: VNode | null;
736
- deps: number;
737
- pendingId: number;
738
- timeout: number;
739
- isInFallback: boolean;
740
- isHydrating: boolean;
741
- isUnmounted: boolean;
742
- effects: Function[];
743
- resolve(force?: boolean, sync?: boolean): void;
744
- fallback(fallbackVNode: VNode): void;
745
- move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
746
- next(): RendererNode | null;
747
- registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
748
- unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
749
- }
750
- declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
751
- declare function normalizeSuspenseChildren(vnode: VNode): void;
752
-
753
- type Hook<T = () => void> = T | T[];
754
- interface BaseTransitionProps<HostElement = RendererElement> {
755
- mode?: 'in-out' | 'out-in' | 'default';
756
- appear?: boolean;
757
- persisted?: boolean;
758
- onBeforeEnter?: Hook<(el: HostElement) => void>;
759
- onEnter?: Hook<(el: HostElement, done: () => void) => void>;
760
- onAfterEnter?: Hook<(el: HostElement) => void>;
761
- onEnterCancelled?: Hook<(el: HostElement) => void>;
762
- onBeforeLeave?: Hook<(el: HostElement) => void>;
763
- onLeave?: Hook<(el: HostElement, done: () => void) => void>;
764
- onAfterLeave?: Hook<(el: HostElement) => void>;
765
- onLeaveCancelled?: Hook<(el: HostElement) => void>;
766
- onBeforeAppear?: Hook<(el: HostElement) => void>;
767
- onAppear?: Hook<(el: HostElement, done: () => void) => void>;
768
- onAfterAppear?: Hook<(el: HostElement) => void>;
769
- onAppearCancelled?: Hook<(el: HostElement) => void>;
770
- }
771
- interface TransitionHooks<HostElement = RendererElement> {
772
- mode: BaseTransitionProps['mode'];
773
- persisted: boolean;
774
- beforeEnter(el: HostElement): void;
775
- enter(el: HostElement): void;
776
- leave(el: HostElement, remove: () => void): void;
777
- clone(vnode: VNode): TransitionHooks<HostElement>;
778
- afterLeave?(): void;
779
- delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
780
- delayedLeave?(): void;
781
- }
782
- type ElementNamespace = 'svg' | 'mathml' | undefined;
783
- interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
784
- patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, parentComponent?: ComponentInternalInstance | null): void;
785
- insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
786
- remove(el: HostNode): void;
787
- createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
788
- [key: string]: any;
789
- }) | null): HostElement;
790
- createText(text: string): HostNode;
791
- createComment(text: string): HostNode;
792
- setText(node: HostNode, text: string): void;
793
- setElementText(node: HostElement, text: string): void;
794
- parentNode(node: HostNode): HostElement | null;
795
- nextSibling(node: HostNode): HostNode | null;
796
- querySelector?(selector: string): HostElement | null;
797
- setScopeId?(el: HostElement, id: string): void;
798
- cloneNode?(node: HostNode): HostNode;
799
- insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
800
- }
801
- interface RendererNode {
802
- [key: string | symbol]: any;
803
- }
804
- interface RendererElement extends RendererNode {
805
- }
806
- interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
807
- p: PatchFn;
808
- um: UnmountFn;
809
- r: RemoveFn;
810
- m: MoveFn;
811
- mt: MountComponentFn;
812
- mc: MountChildrenFn;
813
- pc: PatchChildrenFn;
814
- pbc: PatchBlockChildrenFn;
815
- n: NextFn;
816
- o: RendererOptions<HostNode, HostElement>;
817
- }
818
- type PatchFn = (n1: VNode | null, // null means this is a mount
819
- n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
820
- type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
821
- type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void;
822
- type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
823
- type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
824
- type NextFn = (vnode: VNode) => RendererNode | null;
825
- type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
826
- type RemoveFn = (vnode: VNode) => void;
827
- type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
828
- type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
829
- declare enum MoveType {
830
- ENTER = 0,
831
- LEAVE = 1,
832
- REORDER = 2
833
- }
834
-
835
- type MatchPattern = string | RegExp | (string | RegExp)[];
836
- interface KeepAliveProps {
837
- include?: MatchPattern;
838
- exclude?: MatchPattern;
839
- max?: number | string;
840
- }
841
- type DebuggerHook = (e: DebuggerEvent) => void;
842
- type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
843
-
844
- declare enum DeprecationTypes$1 {
845
- GLOBAL_MOUNT = "GLOBAL_MOUNT",
846
- GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
847
- GLOBAL_EXTEND = "GLOBAL_EXTEND",
848
- GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
849
- GLOBAL_SET = "GLOBAL_SET",
850
- GLOBAL_DELETE = "GLOBAL_DELETE",
851
- GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
852
- GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
853
- CONFIG_SILENT = "CONFIG_SILENT",
854
- CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
855
- CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
856
- CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
857
- CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
858
- CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
859
- CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
860
- INSTANCE_SET = "INSTANCE_SET",
861
- INSTANCE_DELETE = "INSTANCE_DELETE",
862
- INSTANCE_DESTROY = "INSTANCE_DESTROY",
863
- INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
864
- INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
865
- INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
866
- INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
867
- INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
868
- INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
869
- OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
870
- OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
871
- OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
872
- OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
873
- WATCH_ARRAY = "WATCH_ARRAY",
874
- PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
875
- V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
876
- CUSTOM_DIR = "CUSTOM_DIR",
877
- ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
878
- ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
879
- TRANSITION_CLASSES = "TRANSITION_CLASSES",
880
- TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
881
- COMPONENT_ASYNC = "COMPONENT_ASYNC",
882
- COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
883
- COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
884
- RENDER_FUNCTION = "RENDER_FUNCTION",
885
- FILTERS = "FILTERS",
886
- PRIVATE_APIS = "PRIVATE_APIS"
887
- }
888
- type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
889
- MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
890
- };
891
-
892
- /**
893
- * Interface for declaring custom options.
894
- *
895
- * @example
896
- * ```ts
897
- * declare module 'vue' {
898
- * interface ComponentCustomOptions {
899
- * beforeRouteUpdate?(
900
- * to: Route,
901
- * from: Route,
902
- * next: () => void
903
- * ): void
904
- * }
905
- * }
906
- * ```
907
- */
908
- interface ComponentCustomOptions {
909
- }
910
- type RenderFunction = () => VNodeChild;
911
- interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II, Provide>, ComponentInternalOptions, ComponentCustomOptions {
912
- setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
913
- name?: string;
914
- template?: string | object;
915
- render?: Function;
916
- components?: LC & Record<string, Component>;
917
- directives?: Directives & Record<string, Directive>;
918
- inheritAttrs?: boolean;
919
- emits?: (E | EE[]) & ThisType<void>;
920
- slots?: S;
921
- expose?: Exposed[];
922
- serverPrefetch?(): void | Promise<any>;
923
- compilerOptions?: RuntimeCompilerOptions;
924
- call?: (this: unknown, ...args: unknown[]) => never;
925
- __isFragment?: never;
926
- __isTeleport?: never;
927
- __isSuspense?: never;
928
- __defaults?: Defaults;
929
- }
930
- /**
931
- * Subset of compiler options that makes sense for the runtime.
932
- */
933
- interface RuntimeCompilerOptions {
934
- isCustomElement?: (tag: string) => boolean;
935
- whitespace?: 'preserve' | 'condense';
936
- comments?: boolean;
937
- delimiters?: [string, string];
938
- }
939
- type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
940
- type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
941
- type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
942
- interface MethodOptions {
943
- [key: string]: Function;
944
- }
945
- type ExtractComputedReturns<T extends any> = {
946
- [key in keyof T]: T[key] extends {
947
- get: (...args: any[]) => infer TReturn;
948
- } ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
949
- };
950
- type ObjectWatchOptionItem = {
951
- handler: WatchCallback | string;
952
- } & WatchOptions;
953
- type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
954
- type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
955
- type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
956
- type ComponentProvideOptions = ObjectProvideOptions | Function;
957
- type ObjectProvideOptions = Record<string | symbol, unknown>;
958
- type ComponentInjectOptions = string[] | ObjectInjectOptions;
959
- type ObjectInjectOptions = Record<string | symbol, string | symbol | {
960
- from?: string | symbol;
961
- default?: unknown;
962
- }>;
963
- type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
964
- [K in T[number]]?: unknown;
965
- } : T extends ObjectInjectOptions ? {
966
- [K in keyof T]?: unknown;
967
- } : never;
968
- interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string, Provide extends ComponentProvideOptions = ComponentProvideOptions> {
969
- compatConfig?: CompatConfig;
970
- [key: string]: any;
971
- data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
972
- computed?: C;
973
- methods?: M;
974
- watch?: ComponentWatchOptions;
975
- provide?: Provide;
976
- inject?: I | II[];
977
- filters?: Record<string, Function>;
978
- mixins?: Mixin[];
979
- extends?: Extends;
980
- beforeCreate?(): any;
981
- created?(): any;
982
- beforeMount?(): any;
983
- mounted?(): any;
984
- beforeUpdate?(): any;
985
- updated?(): any;
986
- activated?(): any;
987
- deactivated?(): any;
988
- /** @deprecated use `beforeUnmount` instead */
989
- beforeDestroy?(): any;
990
- beforeUnmount?(): any;
991
- /** @deprecated use `unmounted` instead */
992
- destroyed?(): any;
993
- unmounted?(): any;
994
- renderTracked?: DebuggerHook;
995
- renderTriggered?: DebuggerHook;
996
- errorCaptured?: ErrorCapturedHook;
997
- /**
998
- * runtime compile only
999
- * @deprecated use `compilerOptions.delimiters` instead.
1000
- */
1001
- delimiters?: [string, string];
1002
- /**
1003
- * #3468
1004
- *
1005
- * type-only, used to assist Mixin's type inference,
1006
- * TypeScript will try to simplify the inferred `Mixin` type,
1007
- * with the `__differentiator`, TypeScript won't be able to combine different mixins,
1008
- * because the `__differentiator` will be different
1009
- */
1010
- __differentiator?: keyof D | keyof C | keyof M;
1011
- }
1012
- type MergedHook<T = () => void> = T | T[];
1013
- type MergedComponentOptionsOverride = {
1014
- beforeCreate?: MergedHook;
1015
- created?: MergedHook;
1016
- beforeMount?: MergedHook;
1017
- mounted?: MergedHook;
1018
- beforeUpdate?: MergedHook;
1019
- updated?: MergedHook;
1020
- activated?: MergedHook;
1021
- deactivated?: MergedHook;
1022
- /** @deprecated use `beforeUnmount` instead */
1023
- beforeDestroy?: MergedHook;
1024
- beforeUnmount?: MergedHook;
1025
- /** @deprecated use `unmounted` instead */
1026
- destroyed?: MergedHook;
1027
- unmounted?: MergedHook;
1028
- renderTracked?: MergedHook<DebuggerHook>;
1029
- renderTriggered?: MergedHook<DebuggerHook>;
1030
- errorCaptured?: MergedHook<ErrorCapturedHook>;
1031
- };
1032
- type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
1033
- type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
1034
- P: P;
1035
- B: B;
1036
- D: D;
1037
- C: C;
1038
- M: M;
1039
- Defaults: Defaults;
1040
- };
1041
-
1042
- interface InjectionConstraint<T> {
1043
- }
1044
- type InjectionKey<T> = symbol & InjectionConstraint<T>;
1045
-
1046
- type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
1047
- type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
1048
- type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
1049
-
1050
- interface App<HostElement = any> {
1051
- version: string;
1052
- config: AppConfig;
1053
- use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: NoInfer<Options>): this;
1054
- use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
1055
- mixin(mixin: ComponentOptions): this;
1056
- component(name: string): Component | undefined;
1057
- component<T extends Component | DefineComponent>(name: string, component: T): this;
1058
- directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string): Directive<HostElement, Value, Modifiers, Arg> | undefined;
1059
- directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string, directive: Directive<HostElement, Value, Modifiers, Arg>): this;
1060
- mount(rootContainer: HostElement | string,
1061
- /**
1062
- * @internal
1063
- */
1064
- isHydrate?: boolean,
1065
- /**
1066
- * @internal
1067
- */
1068
- namespace?: boolean | ElementNamespace,
1069
- /**
1070
- * @internal
1071
- */
1072
- vnode?: VNode): ComponentPublicInstance;
1073
- unmount(): void;
1074
- onUnmount(cb: () => void): void;
1075
- provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
1076
- /**
1077
- * Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
1078
- * to variables provided via `app.provide()`.
1079
- *
1080
- * @param fn - function to run with the app as active instance
1081
- */
1082
- runWithContext<T>(fn: () => T): T;
1083
- _uid: number;
1084
- _component: ConcreteComponent;
1085
- _props: Data | null;
1086
- _container: HostElement | null;
1087
- _context: AppContext;
1088
- _instance: ComponentInternalInstance | null;
1089
- /**
1090
- * v2 compat only
1091
- */
1092
- filter?(name: string): Function | undefined;
1093
- filter?(name: string, filter: Function): this;
1094
- }
1095
- type OptionMergeFunction = (to: unknown, from: unknown) => any;
1096
- interface AppConfig {
1097
- readonly isNativeTag: (tag: string) => boolean;
1098
- performance: boolean;
1099
- optionMergeStrategies: Record<string, OptionMergeFunction>;
1100
- globalProperties: ComponentCustomProperties & Record<string, any>;
1101
- errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
1102
- warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
1103
- /**
1104
- * Options to pass to `@vue/compiler-dom`.
1105
- * Only supported in runtime compiler build.
1106
- */
1107
- compilerOptions: RuntimeCompilerOptions;
1108
- /**
1109
- * @deprecated use config.compilerOptions.isCustomElement
1110
- */
1111
- isCustomElement?: (tag: string) => boolean;
1112
- /**
1113
- * TODO document for 3.5
1114
- * Enable warnings for computed getters that recursively trigger itself.
1115
- */
1116
- warnRecursiveComputed?: boolean;
1117
- /**
1118
- * Whether to throw unhandled errors in production.
1119
- * Default is `false` to avoid crashing on any error (and only logs it)
1120
- * But in some cases, e.g. SSR, throwing might be more desirable.
1121
- */
1122
- throwUnhandledErrorInProduction?: boolean;
1123
- /**
1124
- * Prefix for all useId() calls within this app
1125
- */
1126
- idPrefix?: string;
1127
- }
1128
- interface AppContext {
1129
- app: App;
1130
- config: AppConfig;
1131
- mixins: ComponentOptions[];
1132
- components: Record<string, Component>;
1133
- directives: Record<string, Directive>;
1134
- provides: Record<string | symbol, any>;
1135
- }
1136
- type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
1137
- type ObjectPlugin<Options = any[]> = {
1138
- install: PluginInstallFunction<Options>;
1139
- };
1140
- type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
1141
- type Plugin<Options = any[], P extends unknown[] = Options extends unknown[] ? Options : [Options]> = FunctionPlugin<P> | ObjectPlugin<P>;
1142
-
1143
- type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
1144
- interface TeleportProps {
1145
- to: string | RendererElement | null | undefined;
1146
- disabled?: boolean;
1147
- defer?: boolean;
1148
- }
1149
- declare const TeleportImpl: {
1150
- name: string;
1151
- __isTeleport: boolean;
1152
- process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
1153
- remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
1154
- move: typeof moveTeleport;
1155
- hydrate: typeof hydrateTeleport;
1156
- };
1157
- declare enum TeleportMoveTypes {
1158
- TARGET_CHANGE = 0,
1159
- TOGGLE = 1,// enable / disable
1160
- REORDER = 2
1161
- }
1162
- declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
1163
- declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector, insert, createText }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
1164
- declare const Teleport: {
1165
- __isTeleport: true;
1166
- new (): {
1167
- $props: VNodeProps & TeleportProps;
1168
- $slots: {
1169
- default(): VNode[];
1170
- };
1171
- };
1172
- };
1173
-
1174
- declare const Fragment: {
1175
- __isFragment: true;
1176
- new (): {
1177
- $props: VNodeProps;
1178
- };
1179
- };
1180
- declare const Text: unique symbol;
1181
- declare const Comment: unique symbol;
1182
- declare const Static: unique symbol;
1183
- type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
1184
- type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
1185
- type VNodeNormalizedRefAtom = {
1186
- /**
1187
- * component instance
1188
- */
1189
- i: ComponentInternalInstance;
1190
- /**
1191
- * Actual ref
1192
- */
1193
- r: VNodeRef;
1194
- /**
1195
- * setup ref key
1196
- */
1197
- k?: string;
1198
- /**
1199
- * refInFor marker
1200
- */
1201
- f?: boolean;
1202
- };
1203
- type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
1204
- type VNodeMountHook = (vnode: VNode) => void;
1205
- type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
1206
- type VNodeProps = {
1207
- key?: PropertyKey;
1208
- ref?: VNodeRef;
1209
- ref_for?: boolean;
1210
- ref_key?: string;
1211
- onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
1212
- onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
1213
- onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
1214
- onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
1215
- onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
1216
- onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
1217
- };
1218
- type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
1219
- type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
1220
- type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
1221
- type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
1222
- interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
1223
- [key: string]: any;
1224
- }> {
1225
- type: VNodeTypes;
1226
- props: (VNodeProps & ExtraProps) | null;
1227
- key: PropertyKey | null;
1228
- ref: VNodeNormalizedRef | null;
1229
- /**
1230
- * SFC only. This is assigned on vnode creation using currentScopeId
1231
- * which is set alongside currentRenderingInstance.
1232
- */
1233
- scopeId: string | null;
1234
- children: VNodeNormalizedChildren;
1235
- component: ComponentInternalInstance | null;
1236
- dirs: DirectiveBinding[] | null;
1237
- transition: TransitionHooks<HostElement> | null;
1238
- el: HostNode | null;
1239
- placeholder: HostNode | null;
1240
- anchor: HostNode | null;
1241
- target: HostElement | null;
1242
- targetStart: HostNode | null;
1243
- targetAnchor: HostNode | null;
1244
- suspense: SuspenseBoundary | null;
1245
- shapeFlag: number;
1246
- patchFlag: number;
1247
- appContext: AppContext | null;
1248
- }
1249
-
1250
- type Data = Record<string, unknown>;
1251
- /**
1252
- * For extending allowed non-declared props on components in TSX
1253
- */
1254
- interface ComponentCustomProps {
1255
- }
1256
- /**
1257
- * For globally defined Directives
1258
- * Here is an example of adding a directive `VTooltip` as global directive:
1259
- *
1260
- * @example
1261
- * ```ts
1262
- * import VTooltip from 'v-tooltip'
1263
- *
1264
- * declare module '@vue/runtime-core' {
1265
- * interface GlobalDirectives {
1266
- * VTooltip
1267
- * }
1268
- * }
1269
- * ```
1270
- */
1271
- interface GlobalDirectives {
1272
- }
1273
- /**
1274
- * For globally defined Components
1275
- * Here is an example of adding a component `RouterView` as global component:
1276
- *
1277
- * @example
1278
- * ```ts
1279
- * import { RouterView } from 'vue-router'
1280
- *
1281
- * declare module '@vue/runtime-core' {
1282
- * interface GlobalComponents {
1283
- * RouterView
1284
- * }
1285
- * }
1286
- * ```
1287
- */
1288
- interface GlobalComponents {
1289
- Teleport: DefineComponent<TeleportProps>;
1290
- Suspense: DefineComponent<SuspenseProps>;
1291
- KeepAlive: DefineComponent<KeepAliveProps>;
1292
- BaseTransition: DefineComponent<BaseTransitionProps>;
1293
- }
1294
- /**
1295
- * Default allowed non-declared props on component in TSX
1296
- */
1297
- interface AllowedComponentProps {
1298
- class?: unknown;
1299
- style?: unknown;
1300
- }
1301
- interface ComponentInternalOptions {
1302
- /**
1303
- * Compat build only, for bailing out of certain compatibility behavior
1304
- */
1305
- __isBuiltIn?: boolean;
1306
- /**
1307
- * This one should be exposed so that devtools can make use of it
1308
- */
1309
- __file?: string;
1310
- /**
1311
- * name inferred from filename
1312
- */
1313
- __name?: string;
1314
- }
1315
- interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
1316
- (props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
1317
- props?: ComponentPropsOptions<P>;
1318
- emits?: EE | (keyof EE)[];
1319
- slots?: IfAny<S, Slots, SlotsType<S>>;
1320
- inheritAttrs?: boolean;
1321
- displayName?: string;
1322
- compatConfig?: CompatConfig;
1323
- }
1324
- /**
1325
- * Concrete component type matches its actual value: it's either an options
1326
- * object, or a function. Use this where the code expects to work with actual
1327
- * values, e.g. checking if its a function or not. This is mostly for internal
1328
- * implementation code.
1329
- */
1330
- type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, E, S>;
1331
- /**
1332
- * A type used in public APIs where a component type is expected.
1333
- * The constructor type is an artificial type returned by defineComponent().
1334
- */
1335
- type Component<PropsOrInstance = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<PropsOrInstance, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<PropsOrInstance>;
1336
-
1337
- type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
1338
- attrs: Data;
1339
- slots: UnwrapSlotsType<S>;
1340
- emit: EmitFn<E>;
1341
- expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
1342
- } : never;
1343
- /**
1344
- * We expose a subset of properties on the internal instance as they are
1345
- * useful for advanced external libraries and tools.
1346
- */
1347
- interface ComponentInternalInstance {
1348
- uid: number;
1349
- type: ConcreteComponent;
1350
- parent: ComponentInternalInstance | null;
1351
- root: ComponentInternalInstance;
1352
- appContext: AppContext;
1353
- /**
1354
- * Vnode representing this component in its parent's vdom tree
1355
- */
1356
- vnode: VNode;
1357
- /**
1358
- * Root vnode of this component's own vdom tree
1359
- */
1360
- subTree: VNode;
1361
- /**
1362
- * Render effect instance
1363
- */
1364
- effect: ReactiveEffect;
1365
- /**
1366
- * Force update render effect
1367
- */
1368
- update: () => void;
1369
- /**
1370
- * Render effect job to be passed to scheduler (checks if dirty)
1371
- */
1372
- job: SchedulerJob;
1373
- proxy: ComponentPublicInstance | null;
1374
- exposed: Record<string, any> | null;
1375
- exposeProxy: Record<string, any> | null;
1376
- data: Data;
1377
- props: Data;
1378
- attrs: Data;
1379
- slots: InternalSlots;
1380
- refs: Data;
1381
- emit: EmitFn;
1382
- isMounted: boolean;
1383
- isUnmounted: boolean;
1384
- isDeactivated: boolean;
1385
- }
1386
- interface WatchEffectOptions extends DebuggerOptions {
1387
- flush?: 'pre' | 'post' | 'sync';
1388
- }
1389
- interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
1390
- immediate?: Immediate;
1391
- deep?: boolean | number;
1392
- once?: boolean;
1393
- }
1394
-
1395
- declare module '@vue/reactivity' {
1396
- interface RefUnwrapBailTypes {
1397
- runtimeCoreBailTypes: VNode | {
1398
- $: ComponentInternalInstance;
1399
- };
1400
- }
1401
- }
1402
- // Note: this file is auto concatenated to the end of the bundled d.ts during
1403
- // build.
1404
-
1405
- declare module '@vue/runtime-core' {
1406
- export interface GlobalComponents {
1407
- Teleport: DefineComponent<TeleportProps>
1408
- Suspense: DefineComponent<SuspenseProps>
1409
- KeepAlive: DefineComponent<KeepAliveProps>
1410
- BaseTransition: DefineComponent<BaseTransitionProps>
1411
- }
1412
- }
1413
-
1414
- // Note: this file is auto concatenated to the end of the bundled d.ts during
1415
- // build.
1416
- type _defineProps = typeof defineProps
1417
- type _defineEmits = typeof defineEmits
1418
- type _defineExpose = typeof defineExpose
1419
- type _defineOptions = typeof defineOptions
1420
- type _defineSlots = typeof defineSlots
1421
- type _defineModel = typeof defineModel
1422
- type _withDefaults = typeof withDefaults
1423
-
1424
- declare global {
1425
- const defineProps: _defineProps
1426
- const defineEmits: _defineEmits
1427
- const defineExpose: _defineExpose
1428
- const defineOptions: _defineOptions
1429
- const defineSlots: _defineSlots
1430
- const defineModel: _defineModel
1431
- const withDefaults: _withDefaults
1432
- }
1433
-
1434
- declare const TRANSITION = "transition";
1435
- declare const ANIMATION = "animation";
1436
- type AnimationTypes = typeof TRANSITION | typeof ANIMATION;
1437
- interface TransitionProps extends BaseTransitionProps<Element> {
1438
- name?: string;
1439
- type?: AnimationTypes;
1440
- css?: boolean;
1441
- duration?: number | {
1442
- enter: number;
1443
- leave: number;
1444
- };
1445
- enterFromClass?: string;
1446
- enterActiveClass?: string;
1447
- enterToClass?: string;
1448
- appearFromClass?: string;
1449
- appearActiveClass?: string;
1450
- appearToClass?: string;
1451
- leaveFromClass?: string;
1452
- leaveActiveClass?: string;
1453
- leaveToClass?: string;
1454
- }
1455
-
1456
- type TransitionGroupProps = Omit<TransitionProps, 'mode'> & {
1457
- tag?: string;
1458
- moveClass?: string;
1459
- };
1460
-
1461
- declare const vShowOriginalDisplay: unique symbol;
1462
- declare const vShowHidden: unique symbol;
1463
- interface VShowElement extends HTMLElement {
1464
- [vShowOriginalDisplay]: string;
1465
- [vShowHidden]: boolean;
1466
- }
1467
- declare const vShow: ObjectDirective<VShowElement> & {
1468
- name: 'show';
1469
- };
1470
-
1471
- declare const systemModifiers: readonly ["ctrl", "shift", "alt", "meta"];
1472
- type SystemModifiers = (typeof systemModifiers)[number];
1473
- type CompatModifiers = keyof typeof keyNames;
1474
- type VOnModifiers = SystemModifiers | ModifierGuards | CompatModifiers;
1475
- type ModifierGuards = 'shift' | 'ctrl' | 'alt' | 'meta' | 'left' | 'right' | 'stop' | 'prevent' | 'self' | 'middle' | 'exact';
1476
- declare const keyNames: Record<'esc' | 'space' | 'up' | 'left' | 'right' | 'down' | 'delete', string>;
1477
- type VOnDirective = Directive<any, any, VOnModifiers>;
1478
-
1479
- type AssignerFn = (value: any) => void;
1480
- declare const assignKey: unique symbol;
1481
- type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
1482
- [assignKey]: AssignerFn;
1483
- _assigning?: boolean;
1484
- }, any, Modifiers>;
1485
- declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, 'trim' | 'number' | 'lazy'>;
1486
- declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
1487
- declare const vModelRadio: ModelDirective<HTMLInputElement>;
1488
- declare const vModelSelect: ModelDirective<HTMLSelectElement, 'number'>;
1489
- declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
1490
- type VModelDirective = typeof vModelText | typeof vModelCheckbox | typeof vModelSelect | typeof vModelRadio | typeof vModelDynamic;
1491
-
1492
- /**
1493
- * This is a stub implementation to prevent the need to use dom types.
1494
- *
1495
- * To enable proper types, add `"dom"` to `"lib"` in your `tsconfig.json`.
1496
- */
1497
- type DomType<T> = typeof globalThis extends {
1498
- window: unknown;
1499
- } ? T : never;
1500
- declare module '@vue/reactivity' {
1501
- interface RefUnwrapBailTypes {
1502
- runtimeDOMBailTypes: DomType<Node | Window>;
1503
- }
1504
- }
1505
- declare module '@vue/runtime-core' {
1506
- interface GlobalComponents {
1507
- Transition: DefineComponent<TransitionProps>;
1508
- TransitionGroup: DefineComponent<TransitionGroupProps>;
1509
- }
1510
- interface GlobalDirectives {
1511
- vShow: typeof vShow;
1512
- vOn: VOnDirective;
1513
- vBind: VModelDirective;
1514
- vIf: Directive<any, boolean>;
1515
- vOnce: Directive;
1516
- vSlot: Directive;
1517
- }
1518
- }
1519
-
1520
208
  declare abstract class ADataProvider {
1521
- filter: Ref<IDataFilter | null>;
1522
- sortList: Ref<IDataSort[]>;
1523
- currentPage: Ref<number>;
1524
- pageSize: Ref<number>;
1525
- pageData: Ref<TDataRow[]>;
1526
- rowCount: Ref<number>;
1527
- loading: Ref<Boolean>;
1528
- SSR: Ref<Boolean>;
1529
- deduplicate: Ref<Boolean>;
1530
- nuxtApp: any;
1531
- urlPageParam: Ref<string>;
1532
- selectedRows: Ref<any[]>;
1533
- selectAll: Ref<boolean>;
209
+ idKey: string;
210
+ pageData: TDataRow[];
211
+ rowCount: number;
212
+ loading: boolean;
213
+ initialLoad: boolean;
214
+ error: any;
215
+ SSR: boolean;
216
+ deduplicate: boolean;
217
+ context: any;
218
+ get nuxtApp(): any;
219
+ set nuxtApp(val: any);
220
+ urlPageParam: string;
221
+ selectedRows: any[];
222
+ selectAll: boolean;
223
+ protected _currentPage: number;
224
+ protected _pageSize: number;
225
+ protected _filter: IDataFilter | null;
226
+ protected _sortList: IDataSort[];
227
+ get currentPage(): number;
228
+ set currentPage(page: number);
229
+ get pageSize(): number;
230
+ set pageSize(size: number);
231
+ get filter(): IDataFilter | null;
232
+ set filter(f: IDataFilter | null);
233
+ get sortList(): IDataSort[];
234
+ set sortList(s: IDataSort[]);
235
+ private _listeners;
236
+ private _debouncedFilterLoad;
1534
237
  constructor(options?: IDataProviderOptions);
238
+ subscribe(listener: TDataProviderListener<this>): TUnsubscribe;
239
+ notify(): void;
240
+ getState(): {
241
+ pageData: TDataRow[];
242
+ rowCount: number;
243
+ currentPage: number;
244
+ pageSize: number;
245
+ loading: boolean;
246
+ initialLoad: boolean;
247
+ error: any;
248
+ filter: IDataFilter | null;
249
+ sortList: IDataSort[];
250
+ selectedRows: any[];
251
+ selectAll: boolean;
252
+ };
1535
253
  setFilter(filter: IDataFilter | null): void;
1536
254
  setSortList(sortList: IDataSort[]): void;
1537
255
  setCurrentPage(currentPage: number): void;
1538
256
  setPageSize(pageSize: number): void;
1539
- abstract loadPageData(): void;
257
+ setSelectedRows(rows: any[]): void;
258
+ setSelectAll(val: boolean): void;
259
+ abstract loadPageData(options?: {
260
+ disableCache?: boolean;
261
+ signal?: AbortSignal;
262
+ }): void | Promise<void>;
263
+ refresh(hardRefresh?: boolean): Promise<void>;
1540
264
  }
1541
265
 
1542
266
  declare class CFlatClientDataProvider extends ADataProvider {
1543
- allData: Ref<TDataRow[]>;
1544
- filteredData: Ref<TDataRow[]>;
267
+ allData: TDataRow[];
268
+ filteredData: TDataRow[];
1545
269
  constructor(options?: IDataProviderOptions);
1546
270
  setData(data: TDataRow[]): void;
271
+ refreshData(options?: {
272
+ disableCache?: boolean;
273
+ }): Promise<void>;
274
+ refresh(hardRefresh?: boolean): Promise<void>;
1547
275
  loadPageData(): Promise<void>;
1548
- refreshData(): void;
1549
276
  }
1550
277
 
1551
278
  declare abstract class ACacheProvider {
@@ -1561,16 +288,27 @@ declare abstract class ACacheProvider {
1561
288
 
1562
289
  declare class RequestProvider {
1563
290
  cacheProvider: ACacheProvider | null;
291
+ cacheStrategy?: ECacheStrategy;
1564
292
  cacheLifetime: number | null;
1565
293
  deduplicate: boolean;
1566
294
  cacheKey: string;
295
+ /** Registry tags — set via useRequestProvider() or manually */
296
+ tags: string[];
297
+ /** If true, non-GET requests are enqueued instead of sent immediately */
298
+ queue: boolean;
1567
299
  private static requestQueue;
1568
300
  private static executing;
1569
301
  private static requestsInFlight;
302
+ private lastUrl?;
303
+ private lastOptions?;
304
+ private dataReceivedCallback?;
1570
305
  constructor(provider?: ACacheProvider | ECacheStrategy, lifetime?: number, deduplicate?: boolean);
1571
306
  setCacheProvider(provider?: ACacheProvider | ECacheStrategy): void;
1572
307
  setCacheLifetime(lifetime: number): void;
1573
308
  setDeduplicate(deduplicate: boolean): void;
309
+ onDataReceived(callback: (data: any) => void): void;
310
+ hasLastUrl(): boolean;
311
+ refresh(hardRefresh?: boolean): Promise<any>;
1574
312
  private getUniqueKey;
1575
313
  registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
1576
314
  static executeAll(): void;
@@ -1578,11 +316,11 @@ declare class RequestProvider {
1578
316
  }
1579
317
 
1580
318
  declare abstract class AAPIDataProvider {
1581
- apiUrl: Ref<string>;
1582
- cacheStrategy: Ref<ECacheStrategy | null>;
1583
- cacheLifetime: Ref<number>;
319
+ apiUrl: string;
320
+ cacheStrategy: ECacheStrategy | null;
321
+ cacheLifetime: number;
1584
322
  requestProvider: RequestProvider;
1585
- refreshOnMutation: Ref<boolean | undefined>;
323
+ refreshOnMutation: boolean | undefined;
1586
324
  constructor(options?: IDataProviderOptions);
1587
325
  abstract setAPIUrl(url: string): void;
1588
326
  abstract create(item: any): Promise<void>;
@@ -1591,18 +329,19 @@ declare abstract class AAPIDataProvider {
1591
329
  }
1592
330
 
1593
331
  declare class CAPIFlatClientDataProvider extends CFlatClientDataProvider implements AAPIDataProvider {
1594
- apiUrl: Ref<string>;
1595
- contextKey: Ref<string>;
1596
- initialLoad: Ref<boolean>;
332
+ apiUrl: string;
333
+ contextKey: string;
1597
334
  requestProvider: RequestProvider;
1598
- cacheStrategy: Ref<ECacheStrategy | null>;
1599
- cacheLifetime: Ref<number>;
1600
- refreshOnMutation: Ref<boolean | undefined>;
335
+ cacheStrategy: ECacheStrategy | null;
336
+ cacheLifetime: number;
337
+ refreshOnMutation: boolean | undefined;
1601
338
  constructor(options?: IDataProviderOptions);
1602
339
  setContextKey(key: string): void;
340
+ refresh(hardRefresh?: boolean): Promise<void>;
1603
341
  refreshData(options?: {
1604
342
  disableCache?: boolean;
1605
343
  }): Promise<void>;
344
+ private _initialFetch;
1606
345
  setAPIUrl(url: string): Promise<void>;
1607
346
  create(item: any): Promise<void>;
1608
347
  update(item: any): Promise<void>;
@@ -1610,26 +349,35 @@ declare class CAPIFlatClientDataProvider extends CFlatClientDataProvider impleme
1610
349
  }
1611
350
 
1612
351
  declare class CFlatServerDataProvider extends ADataProvider {
1613
- pageDataHandler: Ref<TPageDataHandler>;
1614
- contextKey: Ref<string>;
1615
- initialLoad: Ref<boolean>;
352
+ pageDataHandler: TPageDataHandler;
353
+ contextKey: string;
354
+ private latestRequestId;
355
+ private abortController;
1616
356
  constructor(options?: IDataProviderOptions);
1617
357
  setContextKey(key: string): void;
1618
358
  setPageDataHandler(handler: TPageDataHandler): Promise<void>;
1619
359
  loadPageData(options?: {
1620
360
  disableCache?: boolean;
361
+ signal?: AbortSignal;
1621
362
  }): Promise<void>;
363
+ refresh(hardRefresh?: boolean): Promise<void>;
1622
364
  }
1623
365
 
1624
366
  declare class CAPIFlatServerDataProvider extends CFlatServerDataProvider implements AAPIDataProvider {
1625
- apiUrl: Ref<string>;
367
+ apiUrl: string;
1626
368
  requestProvider: RequestProvider;
1627
- cacheStrategy: Ref<ECacheStrategy | null>;
1628
- cacheLifetime: Ref<number>;
1629
- refreshOnMutation: Ref<boolean | undefined>;
369
+ cacheStrategy: ECacheStrategy | null;
370
+ cacheLifetime: number;
371
+ refreshOnMutation: boolean | undefined;
1630
372
  constructor(options?: IDataProviderOptions);
373
+ refresh(hardRefresh?: boolean): Promise<void>;
374
+ refreshData(options?: {
375
+ disableCache?: boolean;
376
+ }): Promise<void>;
1631
377
  setAPIUrl(url: string): Promise<void>;
1632
378
  delete(items: any[]): Promise<void>;
379
+ create(item: any): Promise<void>;
380
+ update(item: any): Promise<void>;
1633
381
  }
1634
382
 
1635
383
  declare class CTreeClientDataProvider extends CFlatClientDataProvider {
@@ -1637,22 +385,31 @@ declare class CTreeClientDataProvider extends CFlatClientDataProvider {
1637
385
  idKey: string;
1638
386
  expandedByDefault: boolean;
1639
387
  paginateBy: TreePaginationMode;
1640
- expandedNodes: Ref<Set<string | number>>;
1641
- private _staticNodes;
1642
- private _nodeMap;
1643
- private _sortedNodeIds;
388
+ expandedNodes: Set<string | number>;
389
+ private _staticNodesCache;
390
+ private _nodeMapCache;
391
+ private _sortedNodeIdsCache;
392
+ invalidateStaticCache(): void;
393
+ private get _staticNodes();
394
+ private get _nodeMap();
395
+ private get _sortedNodeIds();
1644
396
  constructor(options?: ITreeDataProviderOptions);
397
+ setData(data: TDataRow[]): void;
1645
398
  private buildStaticNodes;
1646
399
  private computeSortedIds;
1647
- private updatePageData;
1648
400
  private isNodeVisible;
1649
401
  private paginateNodes;
402
+ private updatePageData;
1650
403
  loadPageData(): Promise<void>;
1651
404
  get treeNodes(): ITreeNode[];
1652
405
  get visibleRows(): ITreeNode[];
406
+ getAllNodes(): ITreeNode[];
407
+ getFlatNodes(): ITreeNode[];
1653
408
  toggleNode(nodeId: string | number): void;
1654
409
  expand(nodeId: string | number): void;
1655
410
  collapse(nodeId: string | number): void;
411
+ expandNode(nodeId: string | number): void;
412
+ collapseNode(nodeId: string | number): void;
1656
413
  expandAll(): void;
1657
414
  collapseAll(): void;
1658
415
  getNode(nodeId: string | number): ITreeNode | undefined;
@@ -1661,37 +418,25 @@ declare class CTreeClientDataProvider extends CFlatClientDataProvider {
1661
418
  }
1662
419
 
1663
420
  declare class CAPITreeClientDataProvider extends CTreeClientDataProvider implements AAPIDataProvider {
1664
- apiUrl: Ref<string>;
1665
- contextKey: Ref<string>;
1666
- initialLoad: Ref<boolean>;
421
+ apiUrl: string;
422
+ contextKey: string;
1667
423
  requestProvider: RequestProvider;
1668
- cacheStrategy: Ref<ECacheStrategy | null>;
1669
- cacheLifetime: Ref<number>;
1670
- refreshOnMutation: Ref<boolean | undefined>;
424
+ cacheStrategy: ECacheStrategy | null;
425
+ cacheLifetime: number;
426
+ refreshOnMutation: boolean | undefined;
1671
427
  constructor(options?: ITreeDataProviderOptions);
1672
428
  setContextKey(key: string): void;
429
+ refresh(hardRefresh?: boolean): Promise<void>;
1673
430
  refreshData(options?: {
1674
431
  disableCache?: boolean;
1675
432
  }): Promise<void>;
433
+ private _initialFetch;
1676
434
  setAPIUrl(url: string): Promise<void>;
1677
435
  create(item: any): Promise<void>;
1678
436
  update(item: any): Promise<void>;
1679
437
  delete(items: any[]): Promise<void>;
1680
438
  }
1681
439
 
1682
- /**
1683
- * Tree-specific page data handler that includes tree parameters
1684
- * Server handles tree building, visibility, and pagination
1685
- */
1686
- type TTreePageDataHandler = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], treeParams: {
1687
- expandedNodes: (string | number)[];
1688
- parentKey: string;
1689
- idKey: string;
1690
- paginateBy: TreePaginationMode;
1691
- expandedByDefault: boolean;
1692
- }, options?: {
1693
- disableCache?: boolean;
1694
- }) => IDataResult | Promise<IDataResult>;
1695
440
  /**
1696
441
  * Server-side Tree Data Provider
1697
442
  *
@@ -1706,20 +451,23 @@ declare class CTreeServerDataProvider extends ADataProvider {
1706
451
  idKey: string;
1707
452
  expandedByDefault: boolean;
1708
453
  paginateBy: TreePaginationMode;
1709
- expandedNodes: Ref<Set<string | number>>;
1710
- pageDataHandler: Ref<TTreePageDataHandler | null>;
1711
- contextKey: Ref<string>;
1712
- initialLoad: Ref<boolean>;
454
+ expandedNodes: Set<string | number>;
455
+ pageDataHandler: TTreePageDataHandler | null;
456
+ contextKey: string;
1713
457
  constructor(options?: ITreeDataProviderOptions);
1714
458
  setContextKey(key: string): void;
1715
459
  setPageDataHandler(handler: TTreePageDataHandler): Promise<void>;
460
+ private latestRequestId;
461
+ private abortController;
1716
462
  /**
1717
463
  * Load page data from server
1718
464
  * Server handles tree building, visibility, and pagination
1719
465
  */
1720
466
  loadPageData(options?: {
1721
467
  disableCache?: boolean;
468
+ signal?: AbortSignal;
1722
469
  }): Promise<void>;
470
+ refresh(hardRefresh?: boolean): Promise<void>;
1723
471
  toggleNode(nodeId: string | number): void;
1724
472
  expand(nodeId: string | number): void;
1725
473
  collapse(nodeId: string | number): void;
@@ -1736,29 +484,102 @@ declare class CTreeServerDataProvider extends ADataProvider {
1736
484
  * - Automatic tree parameter serialization in query
1737
485
  */
1738
486
  declare class CAPITreeServerDataProvider extends CTreeServerDataProvider implements AAPIDataProvider {
1739
- apiUrl: Ref<string>;
487
+ apiUrl: string;
1740
488
  requestProvider: RequestProvider;
1741
- cacheStrategy: Ref<ECacheStrategy | null>;
1742
- cacheLifetime: Ref<number>;
1743
- refreshOnMutation: Ref<boolean | undefined>;
489
+ cacheStrategy: ECacheStrategy | null;
490
+ cacheLifetime: number;
491
+ refreshOnMutation: boolean | undefined;
1744
492
  constructor(options?: ITreeDataProviderOptions);
493
+ refresh(hardRefresh?: boolean): Promise<void>;
494
+ refreshData(options?: {
495
+ disableCache?: boolean;
496
+ }): Promise<void>;
1745
497
  setAPIUrl(url: string): Promise<void>;
1746
498
  delete(items: any[]): Promise<void>;
499
+ create(item: any): Promise<void>;
500
+ update(item: any): Promise<void>;
501
+ }
502
+
503
+ /**
504
+ * KatluxIndexedDB
505
+ *
506
+ * Shared IndexedDB connection singleton for the entire @katlux/providers library.
507
+ * All IndexedDB consumers (CIndexedDBCache, RequestQueue) use this single connection,
508
+ * ensuring there is one database, one version number, and no versionchange conflicts.
509
+ *
510
+ * KatluxDB stores:
511
+ * cache — used by CIndexedDBCache
512
+ * queue — used by RequestQueue (pending operations)
513
+ * dead_letter — used by RequestQueue (permanently failed operations)
514
+ */
515
+ type TKatluxStore = 'cache' | 'queue' | 'dead_letter' | (string & {});
516
+ declare class KatluxIndexedDB {
517
+ private static db;
518
+ private static openPromise;
519
+ private static currentVersion;
520
+ private static customStores;
521
+ static readonly DB_NAME = "KatluxDB";
522
+ static get DB_VERSION(): number;
523
+ /**
524
+ * Opens (or returns the existing) shared IDBDatabase connection.
525
+ * Safe to call multiple times — always resolves to the same instance.
526
+ */
527
+ static open(): Promise<IDBDatabase>;
528
+ /**
529
+ * Dynamically ensures that an object store exists in the database.
530
+ * If not present, performs a database version bump and creates the store.
531
+ */
532
+ static ensureStore(storeName: string): Promise<IDBDatabase>;
533
+ /**
534
+ * Returns a transaction-bound object store.
535
+ * Convenience wrapper used by CIndexedDBCache, QueueStorage adapters, etc.
536
+ */
537
+ static getStore(storeName: TKatluxStore, mode: IDBTransactionMode): Promise<IDBObjectStore>;
538
+ /**
539
+ * For testing only — resets the singleton so tests can start fresh.
540
+ */
541
+ static _reset(): void;
1747
542
  }
1748
543
 
544
+ type CacheDriverLoader = () => Promise<{
545
+ getInstance: () => ACacheProvider;
546
+ }>;
1749
547
  declare class CacheProviderFactory {
1750
- static getProvider(strategy: ECacheStrategy): ACacheProvider | null;
548
+ private static instanceCache;
549
+ private static customDrivers;
550
+ private static readonly defaultLoaders;
551
+ /**
552
+ * Register a custom or pre-loaded cache provider driver
553
+ */
554
+ static registerDriver(strategy: string, loaderOrClass: CacheDriverLoader | {
555
+ getInstance: () => ACacheProvider;
556
+ }): void;
557
+ /**
558
+ * Asynchronously load and return the cache provider singleton for a strategy.
559
+ */
560
+ static getProvider(strategy: ECacheStrategy | string): Promise<ACacheProvider | null>;
561
+ /**
562
+ * Synchronously returns the cache provider if it was already loaded/instantiated,
563
+ * or undefined otherwise.
564
+ */
565
+ static getProviderSync(strategy: ECacheStrategy | string): ACacheProvider | undefined;
566
+ /**
567
+ * Clear cached singleton instances (useful for testing or cache resets)
568
+ */
569
+ static clearInstances(): void;
1751
570
  }
1752
571
 
1753
572
  declare class CSessionCache extends ACacheProvider {
1754
573
  private static instance;
1755
574
  static getInstance(): CSessionCache;
1756
- private static get storage();
575
+ static get storage(): Map<string, Map<string, ICacheEntry<any>>>;
1757
576
  static getSnapshot(): Map<string, Map<string, ICacheEntry<any>>>;
577
+ private static cleanupTimer;
578
+ private static initCleanupTimer;
1758
579
  private sessionIdCache;
1759
580
  private sessionId;
1760
581
  private readonly SESSION_ID_KEY;
1761
- private constructor();
582
+ constructor();
1762
583
  /**
1763
584
  * Generate a UUID v4 sessionId
1764
585
  */
@@ -1780,11 +601,15 @@ declare class CCookieCache extends ACacheProvider {
1780
601
  private static instance;
1781
602
  static getInstance(): CCookieCache;
1782
603
  type: string;
1783
- private constructor();
604
+ constructor();
605
+ private getCookieKey;
606
+ private parseKeyFromCookieName;
607
+ private isClient;
1784
608
  getKeyList(nuxtApp?: any): Promise<Array<string>>;
1785
609
  get<T>(key: string, nuxtApp?: any): Promise<T | null>;
1786
610
  set<T>(key: string, data: T, lifetime: number, nuxtApp?: any): Promise<void>;
1787
611
  remove(key: string, nuxtApp?: any): Promise<void>;
612
+ removeByPrefix(prefix: string, nuxtApp?: any): Promise<void>;
1788
613
  getRemainingTime(key: string, nuxtApp?: any): Promise<number | null>;
1789
614
  cleanupExpired(): Promise<void>;
1790
615
  }
@@ -1807,14 +632,8 @@ declare class CLocalStorageCache extends ACacheProvider {
1807
632
  declare class CIndexedDBCache extends ACacheProvider {
1808
633
  private static instance;
1809
634
  static getInstance(): CIndexedDBCache;
1810
- private dbName;
1811
- private storeName;
1812
- private version;
1813
- private dbPromise;
1814
- setStore(storeName?: string): void;
1815
635
  private constructor();
1816
636
  private _hydrateFromPayload;
1817
- private openDB;
1818
637
  private getStore;
1819
638
  getKeyList(nuxtApp?: any): Promise<Array<string>>;
1820
639
  get<T>(key: string, nuxtApp?: any): Promise<T | null>;
@@ -1857,5 +676,298 @@ declare class CApplicationCache extends ACacheProvider {
1857
676
  cleanupExpired(): Promise<void>;
1858
677
  }
1859
678
 
1860
- export { AAPIDataProvider, ADataProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CCookieCache, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CLocalStorageCache, CMemoryCache, CSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CacheProviderFactory, ECacheStrategy, EDataFilterOperator, RequestProvider };
1861
- export type { ICacheEntry, IDataFilter, IDataProviderOptions, IDataResult, IDataSort, IKDatatableAction, IRequestOptions, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, KProductItemData, KProductRowAction, TDataRow, TPageDataHandler, TreePaginationMode };
679
+ interface IRegistryEntry {
680
+ provider: RequestProvider;
681
+ tags: string[];
682
+ }
683
+ /**
684
+ * RequestProviderRegistry
685
+ *
686
+ * Static singleton registry that maps RequestProvider instances to string tags.
687
+ * When a mutation completes on any tagged provider, the registry automatically
688
+ * calls refresh(true) on all GET-capable providers sharing any of those tags.
689
+ *
690
+ * Framework-agnostic — no Vue imports. Works in any JS environment.
691
+ *
692
+ * Usage:
693
+ * // Register (or use the useRequestProvider() Vue composable for auto-lifecycle)
694
+ * RequestProviderRegistry.register(myProvider, ['invoices', 'sales'])
695
+ *
696
+ * // Unregister manually (or automatically via useRequestProvider onUnmounted)
697
+ * RequestProviderRegistry.unregister(myProvider)
698
+ *
699
+ * // Manual targeted refresh
700
+ * await RequestProviderRegistry.refreshByTag('invoices', true)
701
+ *
702
+ * // Called internally by RequestProvider after a successful non-GET request
703
+ * await RequestProviderRegistry.notifyMutation(['invoices'])
704
+ */
705
+ declare class RequestProviderRegistry {
706
+ private static entries;
707
+ /**
708
+ * Register a provider with one or more tags.
709
+ * If the provider is already registered, its tags are updated.
710
+ */
711
+ static register(provider: RequestProvider, tags: string[]): void;
712
+ /**
713
+ * Unregister a provider from the registry.
714
+ * After this, the provider will no longer receive auto-refresh signals.
715
+ */
716
+ static unregister(provider: RequestProvider): void;
717
+ /**
718
+ * Manually refresh all providers matching a specific tag.
719
+ */
720
+ static refreshByTag(tag: string, hardRefresh?: boolean): Promise<void>;
721
+ /**
722
+ * Called internally by RequestProvider (after non-GET success) and by
723
+ * RequestQueue (after flush with at least one success).
724
+ *
725
+ * Finds all registered providers sharing any of the succeeded tags and
726
+ * calls refresh(true) once per unique provider (deduplication built in).
727
+ */
728
+ static notifyMutation(succeededTags: string[]): Promise<void>;
729
+ /**
730
+ * Returns a copy of all registry entries.
731
+ * Useful for debugging and testing.
732
+ */
733
+ static getEntries(): IRegistryEntry[];
734
+ /**
735
+ * Clears the entire registry.
736
+ * Use on app teardown (e.g., logout) or in tests.
737
+ */
738
+ static clear(): void;
739
+ }
740
+
741
+ /**
742
+ * RequestQueue
743
+ *
744
+ * Static class that manages the offline mutation queue and dead-letter store.
745
+ * Pure framework-agnostic TypeScript with subscription notifications.
746
+ *
747
+ * Design rules:
748
+ * - Stop-on-first-failure: flush halts when any item fails
749
+ * - No internal retry: the queue is the retry mechanism (items persist until flushed)
750
+ * - Partial refresh: registry refresh fires for succeeded tags only
751
+ * - Dead-letter is final: Katlux never auto-retries — app decides via retryOne() or discard()
752
+ *
753
+ * Usage:
754
+ * RequestQueue.setStorageBackend(EQueueStorage.IndexedDB)
755
+ * await RequestQueue.init() // call once at app startup
756
+ *
757
+ * // Hooks (set in app setup, not in components)
758
+ * RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
759
+ * RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
760
+ * RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
761
+ *
762
+ * // Flush when back online
763
+ * window.addEventListener('online', () => RequestQueue.flushAll())
764
+ */
765
+ declare class RequestQueue {
766
+ static queue: IQueuedOperation[];
767
+ static deadLetterQueue: IDeadLetterItem[];
768
+ static isFlushing: boolean;
769
+ private static _subscribers;
770
+ static subscribe(listener: () => void): () => void;
771
+ static notify(): void;
772
+ private static adapter;
773
+ private static initialized;
774
+ private static _onDeadLetter;
775
+ private static _onFlushComplete;
776
+ private static _onNetworkError;
777
+ /**
778
+ * Load persisted queue from storage into state.
779
+ * Call once at app startup, before any flush or enqueue operations.
780
+ */
781
+ static init(): Promise<void>;
782
+ /**
783
+ * Set the storage backend. Call before init().
784
+ * Defaults to IndexedDB with fallback to LocalStorage → Memory.
785
+ */
786
+ static setStorageBackend(backend: EQueueStorage): void;
787
+ static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
788
+ static onFlushComplete(cb: (succeededTags: string[]) => void): void;
789
+ static onNetworkError(cb: (item: IQueuedOperation) => void): void;
790
+ /**
791
+ * Add an operation to the pending queue and persist it.
792
+ * Called internally by RequestProvider when queue: true.
793
+ * Returns the stable ID of the queued item.
794
+ */
795
+ static enqueue(operation: Omit<IQueuedOperation, 'id' | 'createdAt' | 'flushAttempts' | 'status'>): Promise<string>;
796
+ static getQueue(tag?: string): IQueuedOperation[];
797
+ static getDeadLetterQueue(tag?: string): IDeadLetterItem[];
798
+ /**
799
+ * Flush queued items in FIFO order.
800
+ * Stops on first failure. Refreshes registry for succeeded tags only.
801
+ */
802
+ static flushAll(options?: IFlushOptions): Promise<void>;
803
+ /**
804
+ * Flush a specific pending item by ID, independent of queue position.
805
+ * On success: triggers registry refresh for its own tags.
806
+ * On failure: moves to dead-letter independently.
807
+ */
808
+ static flushOne(id: string): Promise<void>;
809
+ /**
810
+ * Move a dead-letter item back to the FRONT of the pending queue for retry.
811
+ * App should call flushAll() afterwards.
812
+ */
813
+ static retryOne(id: string): Promise<void>;
814
+ /**
815
+ * Permanently remove an item from either the pending queue or dead-letter store.
816
+ */
817
+ static discard(id: string): Promise<void>;
818
+ /**
819
+ * Reorder the pending queue by providing an ordered array of IDs.
820
+ * Fully permissive — causal ordering is the app's responsibility.
821
+ */
822
+ static reorder(ids: string[]): void;
823
+ private static executeRequest;
824
+ private static moveToDeadLetter;
825
+ private static persistQueue;
826
+ private static persistDeadLetter;
827
+ /** For testing only */
828
+ static _reset(): void;
829
+ }
830
+
831
+ interface IQueueStorageAdapter {
832
+ loadQueue(): Promise<IQueuedOperation[]>;
833
+ saveQueue(items: IQueuedOperation[]): Promise<void>;
834
+ loadDeadLetter(): Promise<IDeadLetterItem[]>;
835
+ saveDeadLetter(items: IDeadLetterItem[]): Promise<void>;
836
+ }
837
+ declare class QueueStorageFactory {
838
+ private static indexedDBAdapter;
839
+ private static localStorageAdapter;
840
+ private static memoryAdapter;
841
+ /**
842
+ * Returns an adapter for the requested backend.
843
+ * Falls back automatically if the requested backend is unavailable:
844
+ * IndexedDB → LocalStorage → Memory
845
+ */
846
+ static getAdapter(backend: EQueueStorage): IQueueStorageAdapter;
847
+ static _reset(): void;
848
+ }
849
+
850
+ declare const compareIn: (rowValue: any, filterValue: any) => boolean;
851
+ declare const compareEqual: (rowValue: any, filterValue: any) => boolean;
852
+ declare const compareValues: (rowValue: any, filterValue: any) => number;
853
+ declare const compareAnd: (row: TDataRow, nested: any) => boolean;
854
+ declare const compareOr: (row: TDataRow, nested: any) => boolean;
855
+ declare const applyOperator: (operator: string, rowValue: any, filterValue: any) => boolean;
856
+ declare const evaluateFilter: (filter: IDataFilter, row: TDataRow) => boolean;
857
+ declare const filterTreeData: (nodes: any[], filter: IDataFilter, options: {
858
+ idKey: string;
859
+ parentKey: string;
860
+ }) => {
861
+ visibleNodes: any[];
862
+ expandedNodes: Set<string | number>;
863
+ };
864
+ declare const filterData: (data: any[], filter: IDataFilter, options?: {
865
+ treeOptions?: {
866
+ idKey: string;
867
+ parentKey: string;
868
+ };
869
+ }) => {
870
+ results: any[];
871
+ expandedNodes?: Set<string | number>;
872
+ };
873
+ declare const useFilterLogic: () => {
874
+ evaluateFilter: (filter: IDataFilter, row: TDataRow) => boolean;
875
+ filterTreeData: (nodes: any[], filter: IDataFilter, options: {
876
+ idKey: string;
877
+ parentKey: string;
878
+ }) => {
879
+ visibleNodes: any[];
880
+ expandedNodes: Set<string | number>;
881
+ };
882
+ filterData: (data: any[], filter: IDataFilter, options?: {
883
+ treeOptions?: {
884
+ idKey: string;
885
+ parentKey: string;
886
+ };
887
+ }) => {
888
+ results: any[];
889
+ expandedNodes?: Set<string | number>;
890
+ };
891
+ };
892
+
893
+ declare const sortData: (sortList: IDataSort[], rows: TDataRow[]) => TDataRow[];
894
+ declare const useSortLogic: () => {
895
+ sortData: (sortList: IDataSort[], rows: TDataRow[]) => TDataRow[];
896
+ };
897
+
898
+ /**
899
+ * Universal debounce utility
900
+ */
901
+ declare const useDebounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => ((...args: Parameters<T>) => void);
902
+ declare const debounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => ((...args: Parameters<T>) => void);
903
+
904
+ /**
905
+ * defaultAdapter.ts — Framework-agnostic default implementation of ISSRHydrationAdapter.
906
+ * Pure Vanilla JS / React / Node.js with zero framework dependencies.
907
+ */
908
+
909
+ declare class DefaultHydrationAdapter implements ISSRHydrationAdapter {
910
+ getSSRData<T>(key: string, context?: any): T | null;
911
+ fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
912
+ clearSSRData(key: string, context?: any): void;
913
+ getSSRPayload(context?: any): Record<string, any> | null;
914
+ }
915
+
916
+ /**
917
+ * nuxtAdapter.ts — Nuxt 3 implementation of ISSRHydrationAdapter.
918
+ * Bridges to Nuxt 3's useNuxtData, useAsyncData, and useNuxtApp when running in Nuxt.
919
+ */
920
+
921
+ declare class NuxtHydrationAdapter implements ISSRHydrationAdapter {
922
+ private fallback;
923
+ getSSRData<T>(key: string, context?: any): T | null;
924
+ fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
925
+ clearSSRData(key: string, context?: any): void;
926
+ getSSRPayload(context?: any): Record<string, any> | null;
927
+ }
928
+
929
+ /**
930
+ * index.ts — Framework-agnostic hydration and platform bridge.
931
+ * Provides unified, safe methods for SSR hydration, routing, and lifecycle hooks.
932
+ */
933
+
934
+ declare function getHydrationAdapter(): ISSRHydrationAdapter;
935
+ declare function setHydrationAdapter(adapter: ISSRHydrationAdapter): void;
936
+ /**
937
+ * Retrieve SSR state for a key. Returns null if not found.
938
+ */
939
+ declare function getSSRData<T>(key: string, context?: any): T | null;
940
+ /**
941
+ * Execute fetcher with SSR caching/serialization or fallback directly.
942
+ */
943
+ declare function fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
944
+ /**
945
+ * Clear SSR data for a key.
946
+ */
947
+ declare function clearSSRData(key: string, context?: any): void;
948
+ /**
949
+ * Extract SSR payload dictionary for hydration of memory/storage caches.
950
+ */
951
+ declare function getSSRPayload(context?: any): Record<string, any> | null;
952
+ /**
953
+ * Safe platform app accessor.
954
+ */
955
+ declare function getPlatformApp(): any;
956
+ /**
957
+ * Safe route accessor with browser URLSearchParams fallback for React/Vanilla.
958
+ */
959
+ declare function getAppRoute(): {
960
+ query: Record<string, any>;
961
+ path?: string;
962
+ } | null;
963
+ /**
964
+ * Safe router accessor with window.history fallback for React/Vanilla.
965
+ */
966
+ declare function getAppRouter(): any;
967
+ /**
968
+ * Register a callback when platform hydration is ready or DOMContentLoaded.
969
+ */
970
+ declare function onPlatformReady(cb: () => void): void;
971
+
972
+ export { AAPIDataProvider, ADataProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CCookieCache, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CLocalStorageCache, CMemoryCache, CSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, NuxtHydrationAdapter, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, applyOperator, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, debounce, evaluateFilter, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getHydrationAdapter, getPlatformApp, getSSRData, getSSRPayload, onPlatformReady, setHydrationAdapter, sortData, useDebounce, useFilterLogic, useSortLogic };
973
+ export type { CacheDriverLoader, ICacheEntry, IDataFilter, IDataProviderOptions, IDataResult, IDataSort, IDeadLetterItem, IFlushOptions, IKDatatableAction, IPlatformRouter, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, KProductItemData, KProductRowAction, TDataProviderListener, TDataRow, TKatluxStore, TPageDataHandler, TQueueItemStatus, TTreePageDataHandler, TUnsubscribe, TreePaginationMode };