@katlux/providers 0.1.0-beta.9 → 0.1.1-alpha.101
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/LICENSE +200 -21
- package/README.md +8 -3
- package/dist/index.cjs +3792 -4682
- package/dist/index.d.cts +743 -1554
- package/dist/index.d.mts +743 -1554
- package/dist/index.d.ts +743 -1554
- package/dist/index.mjs +3761 -4683
- package/package.json +6 -3
package/dist/index.d.cts
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,52 @@ interface IRequestOptions {
|
|
|
35
68
|
cacheKey?: string;
|
|
36
69
|
query?: Record<string, any>;
|
|
37
70
|
deduplicate?: boolean;
|
|
38
|
-
|
|
71
|
+
context?: any;
|
|
39
72
|
disableCache?: boolean;
|
|
73
|
+
queue?: boolean;
|
|
74
|
+
queueLabel?: string;
|
|
75
|
+
label?: string;
|
|
76
|
+
tags?: string[];
|
|
77
|
+
signal?: AbortSignal;
|
|
78
|
+
_generation?: number;
|
|
79
|
+
}
|
|
80
|
+
/** Queue persistence backend with automatic fallback: IndexedDB → LocalStorage → Memory */
|
|
81
|
+
declare enum EQueueStorage {
|
|
82
|
+
Memory = "Memory",
|
|
83
|
+
LocalStorage = "LocalStorage",
|
|
84
|
+
IndexedDB = "IndexedDB"
|
|
85
|
+
}
|
|
86
|
+
/** Status of an item currently in the pending queue */
|
|
87
|
+
type TQueueItemStatus = 'pending' | 'flushing';
|
|
88
|
+
/** A single mutation operation waiting to be sent */
|
|
89
|
+
interface IQueuedOperation {
|
|
90
|
+
id: string;
|
|
91
|
+
url: string;
|
|
92
|
+
method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
93
|
+
options: IRequestOptions;
|
|
94
|
+
tags: string[];
|
|
95
|
+
label?: string;
|
|
96
|
+
createdAt: number;
|
|
97
|
+
flushAttempts: number;
|
|
98
|
+
status: TQueueItemStatus;
|
|
99
|
+
}
|
|
100
|
+
/** An operation that failed permanently and was moved to the dead-letter store */
|
|
101
|
+
interface IDeadLetterItem extends IQueuedOperation {
|
|
102
|
+
failedAt: number;
|
|
103
|
+
lastError: string;
|
|
104
|
+
httpStatus?: number;
|
|
105
|
+
}
|
|
106
|
+
/** Options for flush operations */
|
|
107
|
+
interface IFlushOptions {
|
|
108
|
+
tag?: string;
|
|
40
109
|
}
|
|
41
110
|
interface IKDatatableAction {
|
|
42
111
|
action: Function;
|
|
43
112
|
label: string;
|
|
113
|
+
icon?: string;
|
|
114
|
+
iconOnly?: boolean;
|
|
115
|
+
type?: 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
|
|
116
|
+
visible?: Function;
|
|
44
117
|
}
|
|
45
118
|
type TDataRow = {
|
|
46
119
|
[key: string]: any;
|
|
@@ -48,54 +121,99 @@ type TDataRow = {
|
|
|
48
121
|
interface IDataFilter {
|
|
49
122
|
operator: EDataFilterOperator;
|
|
50
123
|
field: TDataRow | IDataFilter[];
|
|
51
|
-
active:
|
|
124
|
+
active: boolean;
|
|
52
125
|
}
|
|
53
126
|
interface IDataSort {
|
|
54
127
|
field: string;
|
|
55
128
|
direction: 'asc' | 'desc';
|
|
56
129
|
}
|
|
57
|
-
interface IDataResult {
|
|
130
|
+
interface IDataResult<TRow = TDataRow> {
|
|
58
131
|
rowCount: number;
|
|
59
|
-
rows:
|
|
132
|
+
rows: TRow[];
|
|
60
133
|
}
|
|
61
|
-
type TPageDataHandler = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], options?: {
|
|
134
|
+
type TPageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], options?: {
|
|
62
135
|
disableCache?: boolean;
|
|
63
|
-
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
|
|
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;
|
|
73
|
-
|
|
149
|
+
context?: any;
|
|
150
|
+
contextKey?: string;
|
|
74
151
|
urlPageParam?: string;
|
|
75
152
|
refreshOnMutation?: boolean;
|
|
76
153
|
}
|
|
77
|
-
|
|
78
|
-
|
|
154
|
+
|
|
155
|
+
interface ITreeNode<TRow = TDataRow> {
|
|
156
|
+
data: TRow;
|
|
79
157
|
id: string | number;
|
|
80
158
|
parentId: string | number | null;
|
|
81
159
|
depth: number;
|
|
82
160
|
hasChildren: boolean;
|
|
83
161
|
isExpanded: boolean;
|
|
84
162
|
}
|
|
85
|
-
interface ITreeNodeStatic {
|
|
86
|
-
data:
|
|
163
|
+
interface ITreeNodeStatic<TRow = TDataRow> {
|
|
164
|
+
data: TRow;
|
|
87
165
|
id: string | number;
|
|
88
166
|
parentId: string | number | null;
|
|
89
167
|
depth: number;
|
|
90
168
|
hasChildren: boolean;
|
|
169
|
+
childIds?: (string | number)[];
|
|
91
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* A row enriched with tree metadata by a tree data provider
|
|
173
|
+
*/
|
|
174
|
+
type TTreeRow<TRow = TDataRow> = TRow & {
|
|
175
|
+
id?: string | number;
|
|
176
|
+
__treeNode?: ITreeNode<TRow>;
|
|
177
|
+
depth?: number;
|
|
178
|
+
hasChildren?: boolean;
|
|
179
|
+
isExpanded?: boolean;
|
|
180
|
+
parentId?: string | number | null;
|
|
181
|
+
};
|
|
92
182
|
type TreePaginationMode = 'all' | 'root';
|
|
183
|
+
/**
|
|
184
|
+
* Interface describing a DataProvider with hierarchical tree capabilities
|
|
185
|
+
*/
|
|
186
|
+
interface ITreeDataProvider<TRow = TDataRow> {
|
|
187
|
+
toggleNode(id: string | number): void;
|
|
188
|
+
expandedNodes: Set<string | number> | {
|
|
189
|
+
value: Set<string | number>;
|
|
190
|
+
};
|
|
191
|
+
parentKey?: string;
|
|
192
|
+
expandedByDefault?: boolean;
|
|
193
|
+
paginateBy?: TreePaginationMode;
|
|
194
|
+
collapseAll?(): void;
|
|
195
|
+
expandAll?(): void;
|
|
196
|
+
isExpanded?(id: string | number): boolean;
|
|
197
|
+
}
|
|
93
198
|
interface ITreeDataProviderOptions extends IDataProviderOptions {
|
|
94
199
|
parentKey?: string;
|
|
95
200
|
idKey?: string;
|
|
96
201
|
expandedByDefault?: boolean;
|
|
97
202
|
paginateBy?: TreePaginationMode;
|
|
98
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Tree-specific page data handler that includes tree parameters
|
|
206
|
+
* Server handles tree building, visibility, and pagination
|
|
207
|
+
*/
|
|
208
|
+
type TTreePageDataHandler<TRow = TDataRow> = (currentPage: number, pageSize: number, filter: IDataFilter, sortList: IDataSort[], treeParams: {
|
|
209
|
+
expandedNodes: (string | number)[] | Set<string | number>;
|
|
210
|
+
parentKey: string;
|
|
211
|
+
idKey: string;
|
|
212
|
+
paginateBy: TreePaginationMode;
|
|
213
|
+
expandedByDefault: boolean;
|
|
214
|
+
}, options?: {
|
|
215
|
+
disableCache?: boolean;
|
|
216
|
+
}) => IDataResult<TRow> | Promise<IDataResult<TRow>>;
|
|
99
217
|
interface KProductItemData {
|
|
100
218
|
id: string | number;
|
|
101
219
|
title: string;
|
|
@@ -112,1477 +230,145 @@ interface KProductRowAction {
|
|
|
112
230
|
color?: 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark' | 'default';
|
|
113
231
|
}
|
|
114
232
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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;
|
|
233
|
+
declare abstract class ADataProvider<TRow = TDataRow> {
|
|
234
|
+
idKey: string;
|
|
235
|
+
pageData: TRow[];
|
|
236
|
+
protected _rowCount: number;
|
|
237
|
+
get rowCount(): number;
|
|
238
|
+
set rowCount(val: number);
|
|
239
|
+
protected _loading: boolean;
|
|
240
|
+
get loading(): boolean;
|
|
241
|
+
set loading(val: boolean);
|
|
242
|
+
protected _initialLoad: boolean;
|
|
243
|
+
get initialLoad(): boolean;
|
|
244
|
+
set initialLoad(val: boolean);
|
|
245
|
+
protected _error: any;
|
|
246
|
+
get error(): any;
|
|
247
|
+
set error(val: any);
|
|
248
|
+
SSR: boolean;
|
|
249
|
+
deduplicate: boolean;
|
|
250
|
+
context: any;
|
|
251
|
+
urlPageParam: string;
|
|
252
|
+
protected _selectedRows: TRow[];
|
|
253
|
+
get selectedRows(): TRow[];
|
|
254
|
+
set selectedRows(val: TRow[]);
|
|
255
|
+
protected _selectAll: boolean;
|
|
256
|
+
get selectAll(): boolean;
|
|
257
|
+
set selectAll(val: boolean);
|
|
258
|
+
protected _currentPage: number;
|
|
259
|
+
protected _pageSize: number;
|
|
260
|
+
protected _filter: IDataFilter | null;
|
|
261
|
+
protected _sortList: IDataSort[];
|
|
262
|
+
get currentPage(): number;
|
|
263
|
+
set currentPage(page: number);
|
|
264
|
+
get pageSize(): number;
|
|
265
|
+
set pageSize(size: number);
|
|
266
|
+
get filter(): IDataFilter | null;
|
|
267
|
+
set filter(f: IDataFilter | null);
|
|
268
|
+
get sortList(): IDataSort[];
|
|
269
|
+
set sortList(s: IDataSort[]);
|
|
270
|
+
private _listeners;
|
|
271
|
+
private _debouncedFilterLoad;
|
|
272
|
+
private _debouncedSortLoad;
|
|
273
|
+
constructor(options?: IDataProviderOptions);
|
|
274
|
+
private _batchDepth;
|
|
275
|
+
private _pendingNotify;
|
|
276
|
+
private _isNotifying;
|
|
1369
277
|
/**
|
|
1370
|
-
*
|
|
278
|
+
* Batches multiple state updates so notify() fires exactly once upon completion.
|
|
1371
279
|
*/
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
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;
|
|
280
|
+
batchUpdates<R>(fn: () => R): R;
|
|
281
|
+
subscribe(listener: TDataProviderListener<this>): TUnsubscribe;
|
|
282
|
+
notify(): void;
|
|
283
|
+
getState(): {
|
|
284
|
+
pageData: TRow[];
|
|
285
|
+
rowCount: number;
|
|
286
|
+
currentPage: number;
|
|
287
|
+
pageSize: number;
|
|
288
|
+
loading: boolean;
|
|
289
|
+
initialLoad: boolean;
|
|
290
|
+
error: any;
|
|
291
|
+
filter: IDataFilter | null;
|
|
292
|
+
sortList: IDataSort[];
|
|
293
|
+
selectedRows: TRow[];
|
|
294
|
+
selectAll: boolean;
|
|
1444
295
|
};
|
|
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
|
-
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>;
|
|
1534
|
-
constructor(options?: IDataProviderOptions);
|
|
1535
296
|
setFilter(filter: IDataFilter | null): void;
|
|
1536
|
-
setSortList(sortList: IDataSort[]): void;
|
|
297
|
+
setSortList(sortList: IDataSort[], immediate?: boolean): void;
|
|
1537
298
|
setCurrentPage(currentPage: number): void;
|
|
1538
299
|
setPageSize(pageSize: number): void;
|
|
1539
|
-
|
|
300
|
+
setSelectedRows(rows: TRow[]): void;
|
|
301
|
+
setSelectAll(val: boolean): void;
|
|
302
|
+
abstract loadPageData(options?: {
|
|
303
|
+
disableCache?: boolean;
|
|
304
|
+
signal?: AbortSignal;
|
|
305
|
+
}): void | Promise<void>;
|
|
306
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
307
|
+
cancelPending(): void;
|
|
1540
308
|
}
|
|
1541
309
|
|
|
1542
|
-
declare class CFlatClientDataProvider extends ADataProvider {
|
|
1543
|
-
allData:
|
|
1544
|
-
filteredData:
|
|
310
|
+
declare class CFlatClientDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
|
|
311
|
+
allData: TRow[];
|
|
312
|
+
filteredData: TRow[];
|
|
1545
313
|
constructor(options?: IDataProviderOptions);
|
|
1546
|
-
setData(data:
|
|
314
|
+
setData(data: TRow[]): void;
|
|
315
|
+
refreshData(options?: {
|
|
316
|
+
disableCache?: boolean;
|
|
317
|
+
}): Promise<void>;
|
|
318
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1547
319
|
loadPageData(): Promise<void>;
|
|
1548
|
-
refreshData(): void;
|
|
1549
320
|
}
|
|
1550
321
|
|
|
1551
322
|
declare abstract class ACacheProvider {
|
|
1552
323
|
constructor();
|
|
1553
|
-
abstract getKeyList(
|
|
1554
|
-
abstract get<T>(key: string,
|
|
1555
|
-
abstract set<T>(key: string, data: T, lifetime: number,
|
|
1556
|
-
abstract remove(key: string,
|
|
1557
|
-
abstract removeByPrefix(prefix: string,
|
|
1558
|
-
abstract getRemainingTime(key: string,
|
|
324
|
+
abstract getKeyList(context?: any): Array<string> | Promise<Array<string>>;
|
|
325
|
+
abstract get<T>(key: string, context?: any): Promise<T | null>;
|
|
326
|
+
abstract set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
327
|
+
abstract remove(key: string, context?: any): Promise<void>;
|
|
328
|
+
abstract removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
329
|
+
abstract getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1559
330
|
abstract cleanupExpired(): Promise<void>;
|
|
1560
331
|
}
|
|
1561
332
|
|
|
1562
333
|
declare class RequestProvider {
|
|
1563
334
|
cacheProvider: ACacheProvider | null;
|
|
335
|
+
cacheStrategy?: ECacheStrategy;
|
|
1564
336
|
cacheLifetime: number | null;
|
|
1565
337
|
deduplicate: boolean;
|
|
1566
338
|
cacheKey: string;
|
|
339
|
+
/** Registry tags — set via useRequestProvider() or manually */
|
|
340
|
+
tags: string[];
|
|
341
|
+
/** If true, non-GET requests are enqueued instead of sent immediately */
|
|
342
|
+
queue: boolean;
|
|
1567
343
|
private static requestQueue;
|
|
1568
344
|
private static executing;
|
|
1569
345
|
private static requestsInFlight;
|
|
346
|
+
private lastUrl?;
|
|
347
|
+
private lastOptions?;
|
|
348
|
+
private dataReceivedCallback?;
|
|
1570
349
|
constructor(provider?: ACacheProvider | ECacheStrategy, lifetime?: number, deduplicate?: boolean);
|
|
1571
350
|
setCacheProvider(provider?: ACacheProvider | ECacheStrategy): void;
|
|
1572
351
|
setCacheLifetime(lifetime: number): void;
|
|
1573
352
|
setDeduplicate(deduplicate: boolean): void;
|
|
353
|
+
onDataReceived(callback: (data: any, generation?: number) => void): void;
|
|
354
|
+
private invokeDataReceivedCallback;
|
|
355
|
+
hasLastUrl(): boolean;
|
|
356
|
+
refresh(hardRefresh?: boolean): Promise<any>;
|
|
357
|
+
private resolveContext;
|
|
358
|
+
private getInFlightMap;
|
|
1574
359
|
private getUniqueKey;
|
|
1575
360
|
registerRequest<T>(url: string, options?: IRequestOptions): Promise<T>;
|
|
1576
361
|
static executeAll(): void;
|
|
362
|
+
private isSameOriginUrl;
|
|
1577
363
|
request<T>(url: string, options?: IRequestOptions): Promise<T>;
|
|
1578
364
|
}
|
|
1579
365
|
|
|
1580
366
|
declare abstract class AAPIDataProvider {
|
|
1581
|
-
apiUrl:
|
|
1582
|
-
cacheStrategy:
|
|
1583
|
-
cacheLifetime:
|
|
367
|
+
apiUrl: string;
|
|
368
|
+
cacheStrategy: ECacheStrategy | null;
|
|
369
|
+
cacheLifetime: number;
|
|
1584
370
|
requestProvider: RequestProvider;
|
|
1585
|
-
refreshOnMutation:
|
|
371
|
+
refreshOnMutation: boolean | undefined;
|
|
1586
372
|
constructor(options?: IDataProviderOptions);
|
|
1587
373
|
abstract setAPIUrl(url: string): void;
|
|
1588
374
|
abstract create(item: any): Promise<void>;
|
|
@@ -1590,16 +376,17 @@ declare abstract class AAPIDataProvider {
|
|
|
1590
376
|
abstract delete(items: any[]): Promise<void>;
|
|
1591
377
|
}
|
|
1592
378
|
|
|
1593
|
-
declare class CAPIFlatClientDataProvider extends CFlatClientDataProvider implements AAPIDataProvider {
|
|
1594
|
-
apiUrl:
|
|
1595
|
-
contextKey:
|
|
1596
|
-
initialLoad: Ref<boolean>;
|
|
379
|
+
declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDataProvider<TRow> implements AAPIDataProvider {
|
|
380
|
+
apiUrl: string;
|
|
381
|
+
contextKey: string;
|
|
1597
382
|
requestProvider: RequestProvider;
|
|
1598
|
-
cacheStrategy:
|
|
1599
|
-
cacheLifetime:
|
|
1600
|
-
refreshOnMutation:
|
|
383
|
+
cacheStrategy: ECacheStrategy | null;
|
|
384
|
+
cacheLifetime: number;
|
|
385
|
+
refreshOnMutation: boolean | undefined;
|
|
1601
386
|
constructor(options?: IDataProviderOptions);
|
|
1602
387
|
setContextKey(key: string): void;
|
|
388
|
+
setCacheStrategy(strategy: ECacheStrategy): void;
|
|
389
|
+
setCacheLifetime(lifetime: number): void;
|
|
1603
390
|
refreshData(options?: {
|
|
1604
391
|
disableCache?: boolean;
|
|
1605
392
|
}): Promise<void>;
|
|
@@ -1609,89 +396,97 @@ declare class CAPIFlatClientDataProvider extends CFlatClientDataProvider impleme
|
|
|
1609
396
|
delete(items: any[]): Promise<void>;
|
|
1610
397
|
}
|
|
1611
398
|
|
|
1612
|
-
declare class CFlatServerDataProvider extends ADataProvider {
|
|
1613
|
-
pageDataHandler:
|
|
1614
|
-
contextKey:
|
|
1615
|
-
|
|
399
|
+
declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
|
|
400
|
+
pageDataHandler: TPageDataHandler<TRow>;
|
|
401
|
+
contextKey: string;
|
|
402
|
+
private latestRequestId;
|
|
403
|
+
private abortController;
|
|
1616
404
|
constructor(options?: IDataProviderOptions);
|
|
1617
405
|
setContextKey(key: string): void;
|
|
1618
|
-
setPageDataHandler(handler: TPageDataHandler): Promise<void>;
|
|
406
|
+
setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
|
|
1619
407
|
loadPageData(options?: {
|
|
1620
408
|
disableCache?: boolean;
|
|
409
|
+
signal?: AbortSignal;
|
|
1621
410
|
}): Promise<void>;
|
|
411
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1622
412
|
}
|
|
1623
413
|
|
|
1624
|
-
declare class CAPIFlatServerDataProvider extends CFlatServerDataProvider implements AAPIDataProvider {
|
|
1625
|
-
apiUrl:
|
|
414
|
+
declare class CAPIFlatServerDataProvider<TRow = TDataRow> extends CFlatServerDataProvider<TRow> implements AAPIDataProvider {
|
|
415
|
+
apiUrl: string;
|
|
1626
416
|
requestProvider: RequestProvider;
|
|
1627
|
-
cacheStrategy:
|
|
1628
|
-
cacheLifetime:
|
|
1629
|
-
refreshOnMutation:
|
|
417
|
+
cacheStrategy: ECacheStrategy | null;
|
|
418
|
+
cacheLifetime: number;
|
|
419
|
+
refreshOnMutation: boolean | undefined;
|
|
420
|
+
/** Incremented on every new request; stale onDataReceived callbacks are discarded. */
|
|
421
|
+
private _requestGeneration;
|
|
1630
422
|
constructor(options?: IDataProviderOptions);
|
|
423
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
424
|
+
refreshData(options?: {
|
|
425
|
+
disableCache?: boolean;
|
|
426
|
+
}): Promise<void>;
|
|
1631
427
|
setAPIUrl(url: string): Promise<void>;
|
|
1632
428
|
delete(items: any[]): Promise<void>;
|
|
429
|
+
create(item: any): Promise<void>;
|
|
430
|
+
update(item: any): Promise<void>;
|
|
1633
431
|
}
|
|
1634
432
|
|
|
1635
|
-
declare class CTreeClientDataProvider extends CFlatClientDataProvider {
|
|
433
|
+
declare class CTreeClientDataProvider<TRow extends TDataRow = TDataRow> extends CFlatClientDataProvider<TRow> implements ITreeDataProvider<TRow> {
|
|
1636
434
|
parentKey: string;
|
|
1637
435
|
idKey: string;
|
|
1638
436
|
expandedByDefault: boolean;
|
|
1639
437
|
paginateBy: TreePaginationMode;
|
|
1640
|
-
expandedNodes:
|
|
1641
|
-
private
|
|
1642
|
-
private
|
|
1643
|
-
private
|
|
438
|
+
expandedNodes: Set<string | number>;
|
|
439
|
+
private _staticNodesCache;
|
|
440
|
+
private _nodeMapCache;
|
|
441
|
+
private _sortedNodeIdsCache;
|
|
442
|
+
invalidateStaticCache(): void;
|
|
443
|
+
private get _staticNodes();
|
|
444
|
+
private get _nodeMap();
|
|
445
|
+
private get _sortedNodeIds();
|
|
1644
446
|
constructor(options?: ITreeDataProviderOptions);
|
|
447
|
+
setData(data: TRow[]): void;
|
|
1645
448
|
private buildStaticNodes;
|
|
1646
449
|
private computeSortedIds;
|
|
1647
|
-
private updatePageData;
|
|
1648
450
|
private isNodeVisible;
|
|
1649
451
|
private paginateNodes;
|
|
452
|
+
private updatePageData;
|
|
1650
453
|
loadPageData(): Promise<void>;
|
|
1651
|
-
get treeNodes(): ITreeNode[];
|
|
1652
|
-
get visibleRows(): ITreeNode[];
|
|
454
|
+
get treeNodes(): ITreeNode<TRow>[];
|
|
455
|
+
get visibleRows(): ITreeNode<TRow>[];
|
|
456
|
+
getAllNodes(): ITreeNode<TRow>[];
|
|
457
|
+
getFlatNodes(): ITreeNode<TRow>[];
|
|
1653
458
|
toggleNode(nodeId: string | number): void;
|
|
1654
459
|
expand(nodeId: string | number): void;
|
|
1655
460
|
collapse(nodeId: string | number): void;
|
|
461
|
+
expandNode(nodeId: string | number): void;
|
|
462
|
+
collapseNode(nodeId: string | number): void;
|
|
1656
463
|
expandAll(): void;
|
|
1657
464
|
collapseAll(): void;
|
|
1658
|
-
getNode(nodeId: string | number): ITreeNode | undefined;
|
|
1659
|
-
getChildren(nodeId: string | number): ITreeNode[];
|
|
1660
|
-
getParent(nodeId: string | number): ITreeNode | undefined;
|
|
465
|
+
getNode(nodeId: string | number): ITreeNode<TRow> | undefined;
|
|
466
|
+
getChildren(nodeId: string | number): ITreeNode<TRow>[];
|
|
467
|
+
getParent(nodeId: string | number): ITreeNode<TRow> | undefined;
|
|
1661
468
|
}
|
|
1662
469
|
|
|
1663
|
-
declare class CAPITreeClientDataProvider extends CTreeClientDataProvider implements AAPIDataProvider {
|
|
1664
|
-
apiUrl:
|
|
1665
|
-
contextKey:
|
|
1666
|
-
initialLoad: Ref<boolean>;
|
|
470
|
+
declare class CAPITreeClientDataProvider<TRow extends TDataRow = TDataRow> extends CTreeClientDataProvider<TRow> implements AAPIDataProvider {
|
|
471
|
+
apiUrl: string;
|
|
472
|
+
contextKey: string;
|
|
1667
473
|
requestProvider: RequestProvider;
|
|
1668
|
-
cacheStrategy:
|
|
1669
|
-
cacheLifetime:
|
|
1670
|
-
refreshOnMutation:
|
|
474
|
+
cacheStrategy: ECacheStrategy | null;
|
|
475
|
+
cacheLifetime: number;
|
|
476
|
+
refreshOnMutation: boolean | undefined;
|
|
1671
477
|
constructor(options?: ITreeDataProviderOptions);
|
|
1672
478
|
setContextKey(key: string): void;
|
|
479
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1673
480
|
refreshData(options?: {
|
|
1674
481
|
disableCache?: boolean;
|
|
1675
482
|
}): Promise<void>;
|
|
483
|
+
private _initialFetch;
|
|
1676
484
|
setAPIUrl(url: string): Promise<void>;
|
|
1677
485
|
create(item: any): Promise<void>;
|
|
1678
486
|
update(item: any): Promise<void>;
|
|
1679
487
|
delete(items: any[]): Promise<void>;
|
|
1680
488
|
}
|
|
1681
489
|
|
|
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
490
|
/**
|
|
1696
491
|
* Server-side Tree Data Provider
|
|
1697
492
|
*
|
|
@@ -1701,25 +496,28 @@ type TTreePageDataHandler = (currentPage: number, pageSize: number, filter: IDat
|
|
|
1701
496
|
* - Server returns already-paginated visible rows with __treeNode metadata
|
|
1702
497
|
* - No allData - server handles everything
|
|
1703
498
|
*/
|
|
1704
|
-
declare class CTreeServerDataProvider extends ADataProvider {
|
|
499
|
+
declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> implements ITreeDataProvider<TRow> {
|
|
1705
500
|
parentKey: string;
|
|
1706
501
|
idKey: string;
|
|
1707
502
|
expandedByDefault: boolean;
|
|
1708
503
|
paginateBy: TreePaginationMode;
|
|
1709
|
-
expandedNodes:
|
|
1710
|
-
pageDataHandler:
|
|
1711
|
-
contextKey:
|
|
1712
|
-
initialLoad: Ref<boolean>;
|
|
504
|
+
expandedNodes: Set<string | number>;
|
|
505
|
+
pageDataHandler: TTreePageDataHandler<TRow> | null;
|
|
506
|
+
contextKey: string;
|
|
1713
507
|
constructor(options?: ITreeDataProviderOptions);
|
|
1714
508
|
setContextKey(key: string): void;
|
|
1715
|
-
setPageDataHandler(handler: TTreePageDataHandler): Promise<void>;
|
|
509
|
+
setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
|
|
510
|
+
private latestRequestId;
|
|
511
|
+
private abortController;
|
|
1716
512
|
/**
|
|
1717
513
|
* Load page data from server
|
|
1718
514
|
* Server handles tree building, visibility, and pagination
|
|
1719
515
|
*/
|
|
1720
516
|
loadPageData(options?: {
|
|
1721
517
|
disableCache?: boolean;
|
|
518
|
+
signal?: AbortSignal;
|
|
1722
519
|
}): Promise<void>;
|
|
520
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
1723
521
|
toggleNode(nodeId: string | number): void;
|
|
1724
522
|
expand(nodeId: string | number): void;
|
|
1725
523
|
collapse(nodeId: string | number): void;
|
|
@@ -1735,30 +533,110 @@ declare class CTreeServerDataProvider extends ADataProvider {
|
|
|
1735
533
|
* - Request management (caching, deduplication)
|
|
1736
534
|
* - Automatic tree parameter serialization in query
|
|
1737
535
|
*/
|
|
1738
|
-
declare class CAPITreeServerDataProvider extends CTreeServerDataProvider implements AAPIDataProvider {
|
|
1739
|
-
apiUrl:
|
|
536
|
+
declare class CAPITreeServerDataProvider<TRow = TDataRow> extends CTreeServerDataProvider<TRow> implements AAPIDataProvider {
|
|
537
|
+
apiUrl: string;
|
|
1740
538
|
requestProvider: RequestProvider;
|
|
1741
|
-
cacheStrategy:
|
|
1742
|
-
cacheLifetime:
|
|
1743
|
-
refreshOnMutation:
|
|
539
|
+
cacheStrategy: ECacheStrategy | null;
|
|
540
|
+
cacheLifetime: number;
|
|
541
|
+
refreshOnMutation: boolean | undefined;
|
|
542
|
+
/** Incremented on every new request; stale onDataReceived callbacks are discarded. */
|
|
543
|
+
private _requestGeneration;
|
|
1744
544
|
constructor(options?: ITreeDataProviderOptions);
|
|
545
|
+
refresh(hardRefresh?: boolean): Promise<void>;
|
|
546
|
+
refreshData(options?: {
|
|
547
|
+
disableCache?: boolean;
|
|
548
|
+
}): Promise<void>;
|
|
1745
549
|
setAPIUrl(url: string): Promise<void>;
|
|
1746
550
|
delete(items: any[]): Promise<void>;
|
|
551
|
+
create(item: any): Promise<void>;
|
|
552
|
+
update(item: any): Promise<void>;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* KatluxIndexedDB
|
|
557
|
+
*
|
|
558
|
+
* Shared IndexedDB connection singleton for the entire @katlux/providers library.
|
|
559
|
+
* All IndexedDB consumers (CIndexedDBCache, RequestQueue) use this single connection,
|
|
560
|
+
* ensuring there is one database, one version number, and no versionchange conflicts.
|
|
561
|
+
*
|
|
562
|
+
* KatluxDB stores:
|
|
563
|
+
* cache — used by CIndexedDBCache
|
|
564
|
+
* queue — used by RequestQueue (pending operations)
|
|
565
|
+
* dead_letter — used by RequestQueue (permanently failed operations)
|
|
566
|
+
*/
|
|
567
|
+
type TKatluxStore = 'cache' | 'queue' | 'dead_letter' | (string & {});
|
|
568
|
+
declare class KatluxIndexedDB {
|
|
569
|
+
private static db;
|
|
570
|
+
private static openPromise;
|
|
571
|
+
private static currentVersion;
|
|
572
|
+
private static customStores;
|
|
573
|
+
static readonly DB_NAME = "KatluxDB";
|
|
574
|
+
static get DB_VERSION(): number;
|
|
575
|
+
/**
|
|
576
|
+
* Opens (or returns the existing) shared IDBDatabase connection.
|
|
577
|
+
* Safe to call multiple times — always resolves to the same instance.
|
|
578
|
+
*/
|
|
579
|
+
static open(): Promise<IDBDatabase>;
|
|
580
|
+
private static upgradeToVersion;
|
|
581
|
+
/**
|
|
582
|
+
* Dynamically ensures that an object store exists in the database.
|
|
583
|
+
* If not present, performs a database version bump and creates the store.
|
|
584
|
+
*/
|
|
585
|
+
static ensureStore(storeName: string): Promise<IDBDatabase>;
|
|
586
|
+
/**
|
|
587
|
+
* Returns a transaction-bound object store.
|
|
588
|
+
* Convenience wrapper used by CIndexedDBCache, QueueStorage adapters, etc.
|
|
589
|
+
*/
|
|
590
|
+
static getStore(storeName: TKatluxStore, mode: IDBTransactionMode): Promise<IDBObjectStore>;
|
|
591
|
+
/**
|
|
592
|
+
* For testing only — resets the singleton so tests can start fresh.
|
|
593
|
+
*/
|
|
594
|
+
static _reset(): void;
|
|
1747
595
|
}
|
|
1748
596
|
|
|
597
|
+
type CacheDriverLoader = () => Promise<{
|
|
598
|
+
getInstance: () => ACacheProvider;
|
|
599
|
+
}>;
|
|
1749
600
|
declare class CacheProviderFactory {
|
|
1750
|
-
static
|
|
601
|
+
private static instanceCache;
|
|
602
|
+
private static customDrivers;
|
|
603
|
+
private static readonly defaultLoaders;
|
|
604
|
+
/**
|
|
605
|
+
* Register a custom or pre-loaded cache provider driver
|
|
606
|
+
*/
|
|
607
|
+
static registerDriver(strategy: string, loaderOrClass: CacheDriverLoader | {
|
|
608
|
+
getInstance: () => ACacheProvider;
|
|
609
|
+
}): void;
|
|
610
|
+
/**
|
|
611
|
+
* Asynchronously load and return the cache provider singleton for a strategy.
|
|
612
|
+
*/
|
|
613
|
+
static getProvider(strategy: ECacheStrategy | string): Promise<ACacheProvider | null>;
|
|
614
|
+
/**
|
|
615
|
+
* Synchronously returns the cache provider if it was already loaded/instantiated,
|
|
616
|
+
* or undefined otherwise.
|
|
617
|
+
*/
|
|
618
|
+
static getProviderSync(strategy: ECacheStrategy | string): ACacheProvider | undefined;
|
|
619
|
+
/**
|
|
620
|
+
* Clear cached singleton instances (useful for testing or cache resets)
|
|
621
|
+
*/
|
|
622
|
+
static clearInstances(): void;
|
|
1751
623
|
}
|
|
1752
624
|
|
|
1753
625
|
declare class CSessionCache extends ACacheProvider {
|
|
1754
626
|
private static instance;
|
|
1755
627
|
static getInstance(): CSessionCache;
|
|
1756
|
-
|
|
628
|
+
static get storage(): Map<string, Map<string, ICacheEntry<any>>>;
|
|
1757
629
|
static getSnapshot(): Map<string, Map<string, ICacheEntry<any>>>;
|
|
630
|
+
static MAX_SERVER_SESSIONS: number;
|
|
631
|
+
/**
|
|
632
|
+
* Purges expired entries across all server sessions synchronously when the storage
|
|
633
|
+
* exceeds MAX_SERVER_SESSIONS. Avoids persistent background setInterval timers on Node.js/SSR.
|
|
634
|
+
*/
|
|
635
|
+
static purgeExpiredServerSessions(): void;
|
|
1758
636
|
private sessionIdCache;
|
|
1759
637
|
private sessionId;
|
|
1760
638
|
private readonly SESSION_ID_KEY;
|
|
1761
|
-
|
|
639
|
+
constructor();
|
|
1762
640
|
/**
|
|
1763
641
|
* Generate a UUID v4 sessionId
|
|
1764
642
|
*/
|
|
@@ -1767,12 +645,12 @@ declare class CSessionCache extends ACacheProvider {
|
|
|
1767
645
|
* Get or create sessionId
|
|
1768
646
|
*/
|
|
1769
647
|
private getSessionId;
|
|
1770
|
-
getKeyList(
|
|
1771
|
-
get<T>(key: string,
|
|
1772
|
-
set<T>(key: string, data: T, lifetime: number,
|
|
1773
|
-
remove(key: string,
|
|
1774
|
-
removeByPrefix(prefix: string,
|
|
1775
|
-
getRemainingTime(key: string,
|
|
648
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
649
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
650
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
651
|
+
remove(key: string, context?: any): Promise<void>;
|
|
652
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
653
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1776
654
|
cleanupExpired(): Promise<void>;
|
|
1777
655
|
}
|
|
1778
656
|
|
|
@@ -1780,12 +658,16 @@ declare class CCookieCache extends ACacheProvider {
|
|
|
1780
658
|
private static instance;
|
|
1781
659
|
static getInstance(): CCookieCache;
|
|
1782
660
|
type: string;
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
661
|
+
constructor();
|
|
662
|
+
private getCookieKey;
|
|
663
|
+
private parseKeyFromCookieName;
|
|
664
|
+
private isClient;
|
|
665
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
666
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
667
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
668
|
+
remove(key: string, context?: any): Promise<void>;
|
|
669
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
670
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1789
671
|
cleanupExpired(): Promise<void>;
|
|
1790
672
|
}
|
|
1791
673
|
|
|
@@ -1795,33 +677,29 @@ declare class CLocalStorageCache extends ACacheProvider {
|
|
|
1795
677
|
type: string;
|
|
1796
678
|
private constructor();
|
|
1797
679
|
private _hydrateFromPayload;
|
|
1798
|
-
getKeyList(
|
|
1799
|
-
get<T>(key: string,
|
|
1800
|
-
set<T>(key: string, data: T, lifetime: number,
|
|
1801
|
-
remove(key: string,
|
|
1802
|
-
removeByPrefix(prefix: string,
|
|
1803
|
-
getRemainingTime(key: string,
|
|
680
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
681
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
682
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
683
|
+
remove(key: string, context?: any): Promise<void>;
|
|
684
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
685
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1804
686
|
cleanupExpired(): Promise<void>;
|
|
1805
687
|
}
|
|
1806
688
|
|
|
1807
689
|
declare class CIndexedDBCache extends ACacheProvider {
|
|
1808
690
|
private static instance;
|
|
1809
|
-
static
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
private dbPromise;
|
|
1814
|
-
setStore(storeName?: string): void;
|
|
1815
|
-
private constructor();
|
|
691
|
+
private static instances;
|
|
692
|
+
readonly storeName: string;
|
|
693
|
+
static getInstance(storeName?: string): CIndexedDBCache;
|
|
694
|
+
constructor(storeName?: string);
|
|
1816
695
|
private _hydrateFromPayload;
|
|
1817
|
-
private openDB;
|
|
1818
696
|
private getStore;
|
|
1819
|
-
getKeyList(
|
|
1820
|
-
get<T>(key: string,
|
|
1821
|
-
set<T>(key: string, data: T, lifetime: number,
|
|
1822
|
-
remove(key: string,
|
|
1823
|
-
removeByPrefix(prefix: string,
|
|
1824
|
-
getRemainingTime(key: string,
|
|
697
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
698
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
699
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
700
|
+
remove(key: string, context?: any): Promise<void>;
|
|
701
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
702
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1825
703
|
cleanupExpired(): Promise<void>;
|
|
1826
704
|
}
|
|
1827
705
|
|
|
@@ -1832,12 +710,13 @@ declare class CMemoryCache extends ACacheProvider {
|
|
|
1832
710
|
static getInstance(): CMemoryCache;
|
|
1833
711
|
private constructor();
|
|
1834
712
|
private _hydrateFromPayload;
|
|
1835
|
-
getKeyList(
|
|
1836
|
-
get<T>(key: string,
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
713
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
714
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
715
|
+
private isServer;
|
|
716
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
717
|
+
remove(key: string, context?: any): Promise<void>;
|
|
718
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
719
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
1841
720
|
cleanupExpired(): Promise<void>;
|
|
1842
721
|
}
|
|
1843
722
|
|
|
@@ -1846,16 +725,326 @@ declare class CApplicationCache extends ACacheProvider {
|
|
|
1846
725
|
private static _storage;
|
|
1847
726
|
private static get storage();
|
|
1848
727
|
static getInstance(): CApplicationCache;
|
|
728
|
+
static readonly MAX_ENTRIES = 10000;
|
|
1849
729
|
static getSnapshot(): Map<string, ICacheEntry<any>>;
|
|
730
|
+
/**
|
|
731
|
+
* Purges expired entries when storage size reaches MAX_ENTRIES watermark.
|
|
732
|
+
* Avoids persistent background setInterval timers on Node.js/SSR.
|
|
733
|
+
*/
|
|
734
|
+
static purgeExpiredEntries(): void;
|
|
735
|
+
/**
|
|
736
|
+
* Clears all cached entries (used for test isolation).
|
|
737
|
+
*/
|
|
738
|
+
static clear(): void;
|
|
1850
739
|
private constructor();
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
740
|
+
private isServer;
|
|
741
|
+
getKeyList(context?: any): Promise<Array<string>>;
|
|
742
|
+
get<T>(key: string, context?: any): Promise<T | null>;
|
|
743
|
+
set<T>(key: string, data: T, lifetime: number, context?: any): Promise<void>;
|
|
744
|
+
remove(key: string, context?: any): Promise<void>;
|
|
745
|
+
removeByPrefix(prefix: string, context?: any): Promise<void>;
|
|
746
|
+
getRemainingTime(key: string, context?: any): Promise<number | null>;
|
|
747
|
+
cleanupExpired(context?: any): Promise<void>;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
interface IRegistryEntry {
|
|
751
|
+
provider: RequestProvider;
|
|
752
|
+
tags: string[];
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* RequestProviderRegistry
|
|
756
|
+
*
|
|
757
|
+
* Static singleton registry that maps RequestProvider instances to string tags.
|
|
758
|
+
* When a mutation completes on any tagged provider, the registry automatically
|
|
759
|
+
* calls refresh(true) on all GET-capable providers sharing any of those tags.
|
|
760
|
+
*
|
|
761
|
+
* Framework-agnostic — no Vue imports. Works in any JS environment.
|
|
762
|
+
*
|
|
763
|
+
* Usage:
|
|
764
|
+
* // Register (or use the useRequestProvider() Vue composable for auto-lifecycle)
|
|
765
|
+
* RequestProviderRegistry.register(myProvider, ['invoices', 'sales'])
|
|
766
|
+
*
|
|
767
|
+
* // Unregister manually (or automatically via useRequestProvider onUnmounted)
|
|
768
|
+
* RequestProviderRegistry.unregister(myProvider)
|
|
769
|
+
*
|
|
770
|
+
* // Manual targeted refresh
|
|
771
|
+
* await RequestProviderRegistry.refreshByTag('invoices', true)
|
|
772
|
+
*
|
|
773
|
+
* // Called internally by RequestProvider after a successful non-GET request
|
|
774
|
+
* await RequestProviderRegistry.notifyMutation(['invoices'])
|
|
775
|
+
*/
|
|
776
|
+
declare class RequestProviderRegistry {
|
|
777
|
+
private static entries;
|
|
778
|
+
/**
|
|
779
|
+
* Register a provider with one or more tags.
|
|
780
|
+
* If the provider is already registered, its tags are updated.
|
|
781
|
+
* In SSR (Node.js), registration is skipped to prevent process-global memory leaks
|
|
782
|
+
* and cross-user multi-tenant invalidation.
|
|
783
|
+
*/
|
|
784
|
+
static register(provider: RequestProvider, tags: string[]): void;
|
|
785
|
+
/**
|
|
786
|
+
* Unregister a provider from the registry.
|
|
787
|
+
* After this, the provider will no longer receive auto-refresh signals.
|
|
788
|
+
*/
|
|
789
|
+
static unregister(provider: RequestProvider): void;
|
|
790
|
+
/**
|
|
791
|
+
* Manually refresh all providers matching a specific tag.
|
|
792
|
+
*/
|
|
793
|
+
static refreshByTag(tag: string, hardRefresh?: boolean): Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Called internally by RequestProvider (after non-GET success) and by
|
|
796
|
+
* RequestQueue (after flush with at least one success).
|
|
797
|
+
*
|
|
798
|
+
* Finds all registered providers sharing any of the succeeded tags and
|
|
799
|
+
* calls refresh(true) once per unique provider (deduplication built in).
|
|
800
|
+
*/
|
|
801
|
+
static notifyMutation(succeededTags: string[]): Promise<void>;
|
|
802
|
+
/**
|
|
803
|
+
* Returns a copy of all registry entries.
|
|
804
|
+
* Useful for debugging and testing.
|
|
805
|
+
*/
|
|
806
|
+
static getEntries(): IRegistryEntry[];
|
|
807
|
+
/**
|
|
808
|
+
* Clears the entire registry.
|
|
809
|
+
* Use on app teardown (e.g., logout) or in tests.
|
|
810
|
+
*/
|
|
811
|
+
static clear(): void;
|
|
1858
812
|
}
|
|
1859
813
|
|
|
1860
|
-
|
|
1861
|
-
|
|
814
|
+
declare const SENSITIVE_HEADER_KEYS: string[];
|
|
815
|
+
/**
|
|
816
|
+
* RequestQueue
|
|
817
|
+
*
|
|
818
|
+
* Static class that manages the offline mutation queue and dead-letter store.
|
|
819
|
+
* Pure framework-agnostic TypeScript with subscription notifications.
|
|
820
|
+
*
|
|
821
|
+
* Design rules:
|
|
822
|
+
* - Stop-on-first-failure: flush halts when any item fails
|
|
823
|
+
* - No internal retry: the queue is the retry mechanism (items persist until flushed)
|
|
824
|
+
* - Partial refresh: registry refresh fires for succeeded tags only
|
|
825
|
+
* - Dead-letter is final: Katlux never auto-retries — app decides via retryOne() or discard()
|
|
826
|
+
*
|
|
827
|
+
* Usage:
|
|
828
|
+
* RequestQueue.setStorageBackend(EQueueStorage.IndexedDB)
|
|
829
|
+
* await RequestQueue.init() // call once at app startup
|
|
830
|
+
*
|
|
831
|
+
* // Hooks (set in app setup, not in components)
|
|
832
|
+
* RequestQueue.onDeadLetter((item, err) => toast.error(`Failed: ${item.label}`))
|
|
833
|
+
* RequestQueue.onFlushComplete((tags) => console.log('Synced tags:', tags))
|
|
834
|
+
* RequestQueue.onNetworkError((item) => toast.warn('Offline — will retry when back online'))
|
|
835
|
+
*
|
|
836
|
+
* // Flush when back online
|
|
837
|
+
* window.addEventListener('online', () => RequestQueue.flushAll())
|
|
838
|
+
*/
|
|
839
|
+
declare class RequestQueue {
|
|
840
|
+
static queue: IQueuedOperation[];
|
|
841
|
+
static deadLetterQueue: IDeadLetterItem[];
|
|
842
|
+
static isFlushing: boolean;
|
|
843
|
+
private static MAX_PAYLOAD_SIZE_BYTES;
|
|
844
|
+
private static MAX_QUEUE_SIZE;
|
|
845
|
+
private static MAX_DEAD_LETTER_SIZE;
|
|
846
|
+
static setMaxPayloadSize(bytes: number): void;
|
|
847
|
+
static setMaxQueueSize(limit: number): void;
|
|
848
|
+
static setMaxDeadLetterSize(limit: number): void;
|
|
849
|
+
/**
|
|
850
|
+
* Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
|
|
851
|
+
* request options to persistent storage (IndexedDB / LocalStorage).
|
|
852
|
+
* Sensitive credentials must never be stored in plaintext in browser storage, and are
|
|
853
|
+
* instead regenerated dynamically at execution time.
|
|
854
|
+
*/
|
|
855
|
+
private static sanitizeOptions;
|
|
856
|
+
private static _subscribers;
|
|
857
|
+
static subscribe(listener: () => void): () => void;
|
|
858
|
+
static notify(): void;
|
|
859
|
+
private static adapter;
|
|
860
|
+
private static initialized;
|
|
861
|
+
private static initPromise;
|
|
862
|
+
private static _onDeadLetter;
|
|
863
|
+
private static _onFlushComplete;
|
|
864
|
+
private static _onNetworkError;
|
|
865
|
+
/**
|
|
866
|
+
* Load persisted queue from storage into state.
|
|
867
|
+
* Call once at app startup, before any flush or enqueue operations.
|
|
868
|
+
*/
|
|
869
|
+
static init(): Promise<void>;
|
|
870
|
+
/**
|
|
871
|
+
* Set the storage backend. Call before init().
|
|
872
|
+
* Defaults to IndexedDB with fallback to LocalStorage → Memory.
|
|
873
|
+
*/
|
|
874
|
+
static setStorageBackend(backend: EQueueStorage): void;
|
|
875
|
+
static onDeadLetter(cb: (item: IDeadLetterItem, error: Error) => void): void;
|
|
876
|
+
static onFlushComplete(cb: (succeededTags: string[]) => void): void;
|
|
877
|
+
static onNetworkError(cb: (item: IQueuedOperation) => void): void;
|
|
878
|
+
/**
|
|
879
|
+
* Add an operation to the pending queue and persist it.
|
|
880
|
+
* Called internally by RequestProvider when queue: true.
|
|
881
|
+
* Returns the stable ID of the queued item.
|
|
882
|
+
*/
|
|
883
|
+
static enqueue(operation: Omit<IQueuedOperation, 'id' | 'createdAt' | 'flushAttempts' | 'status'>): Promise<string>;
|
|
884
|
+
static getQueue(tag?: string): IQueuedOperation[];
|
|
885
|
+
static getDeadLetterQueue(tag?: string): IDeadLetterItem[];
|
|
886
|
+
/**
|
|
887
|
+
* Flush queued items in FIFO order.
|
|
888
|
+
* Stops on first failure. Refreshes registry for succeeded tags only.
|
|
889
|
+
*/
|
|
890
|
+
static flushAll(options?: IFlushOptions): Promise<void>;
|
|
891
|
+
/**
|
|
892
|
+
* Flush a specific pending item by ID, independent of queue position.
|
|
893
|
+
* On success: triggers registry refresh for its own tags.
|
|
894
|
+
* On failure: moves to dead-letter independently.
|
|
895
|
+
*/
|
|
896
|
+
static flushOne(id: string): Promise<void>;
|
|
897
|
+
/**
|
|
898
|
+
* Move a dead-letter item back to the FRONT of the pending queue for retry.
|
|
899
|
+
* App should call flushAll() afterwards.
|
|
900
|
+
*/
|
|
901
|
+
static retryOne(id: string): Promise<void>;
|
|
902
|
+
/**
|
|
903
|
+
* Permanently remove an item from either the pending queue or dead-letter store.
|
|
904
|
+
*/
|
|
905
|
+
static discard(id: string): Promise<void>;
|
|
906
|
+
/**
|
|
907
|
+
* Reorder the pending queue by providing an ordered array of IDs.
|
|
908
|
+
* Fully permissive — causal ordering is the app's responsibility.
|
|
909
|
+
*/
|
|
910
|
+
static reorder(ids: string[]): void;
|
|
911
|
+
private static regenerateHeaders;
|
|
912
|
+
private static executeRequest;
|
|
913
|
+
private static moveToDeadLetter;
|
|
914
|
+
private static persistQueue;
|
|
915
|
+
private static persistDeadLetter;
|
|
916
|
+
/** For testing only */
|
|
917
|
+
static _reset(): void;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
interface IQueueStorageAdapter {
|
|
921
|
+
loadQueue(): Promise<IQueuedOperation[]>;
|
|
922
|
+
saveQueue(items: IQueuedOperation[]): Promise<void>;
|
|
923
|
+
loadDeadLetter(): Promise<IDeadLetterItem[]>;
|
|
924
|
+
saveDeadLetter(items: IDeadLetterItem[]): Promise<void>;
|
|
925
|
+
}
|
|
926
|
+
declare class QueueStorageFactory {
|
|
927
|
+
private static indexedDBAdapter;
|
|
928
|
+
private static localStorageAdapter;
|
|
929
|
+
private static memoryAdapter;
|
|
930
|
+
/**
|
|
931
|
+
* Returns an adapter for the requested backend.
|
|
932
|
+
* Falls back automatically if the requested backend is unavailable:
|
|
933
|
+
* IndexedDB → LocalStorage → Memory
|
|
934
|
+
*/
|
|
935
|
+
static getAdapter(backend: EQueueStorage): IQueueStorageAdapter;
|
|
936
|
+
static _reset(): void;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
declare const compareIn: (rowValue: any, filterValue: any) => boolean;
|
|
940
|
+
declare const compareEqual: (rowValue: any, filterValue: any) => boolean;
|
|
941
|
+
declare const compareValues: (rowValue: any, filterValue: any) => number;
|
|
942
|
+
declare const compareAnd: (row: TDataRow, nested: any) => boolean;
|
|
943
|
+
declare const compareOr: (row: TDataRow, nested: any) => boolean;
|
|
944
|
+
declare const applyOperator: (operator: string, rowValue: any, filterValue: any) => boolean;
|
|
945
|
+
declare const evaluateFilter: (filter: IDataFilter, row: TDataRow) => boolean;
|
|
946
|
+
declare const filterTreeData: (nodes: any[], filter: IDataFilter, options: {
|
|
947
|
+
idKey: string;
|
|
948
|
+
parentKey: string;
|
|
949
|
+
}) => {
|
|
950
|
+
visibleNodes: any[];
|
|
951
|
+
expandedNodes: Set<string | number>;
|
|
952
|
+
};
|
|
953
|
+
declare const filterData: (data: any[], filter: IDataFilter, options?: {
|
|
954
|
+
treeOptions?: {
|
|
955
|
+
idKey: string;
|
|
956
|
+
parentKey: string;
|
|
957
|
+
};
|
|
958
|
+
}) => {
|
|
959
|
+
results: any[];
|
|
960
|
+
expandedNodes?: Set<string | number>;
|
|
961
|
+
};
|
|
962
|
+
declare const useFilterLogic: () => {
|
|
963
|
+
evaluateFilter: (filter: IDataFilter, row: TDataRow) => boolean;
|
|
964
|
+
filterTreeData: (nodes: any[], filter: IDataFilter, options: {
|
|
965
|
+
idKey: string;
|
|
966
|
+
parentKey: string;
|
|
967
|
+
}) => {
|
|
968
|
+
visibleNodes: any[];
|
|
969
|
+
expandedNodes: Set<string | number>;
|
|
970
|
+
};
|
|
971
|
+
filterData: (data: any[], filter: IDataFilter, options?: {
|
|
972
|
+
treeOptions?: {
|
|
973
|
+
idKey: string;
|
|
974
|
+
parentKey: string;
|
|
975
|
+
};
|
|
976
|
+
}) => {
|
|
977
|
+
results: any[];
|
|
978
|
+
expandedNodes?: Set<string | number>;
|
|
979
|
+
};
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
declare const sortData: (sortList: IDataSort[], rows: TDataRow[]) => TDataRow[];
|
|
983
|
+
declare const useSortLogic: () => {
|
|
984
|
+
sortData: (sortList: IDataSort[], rows: TDataRow[]) => TDataRow[];
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
interface IDebouncedFunction<T extends (...args: any[]) => any> {
|
|
988
|
+
(...args: Parameters<T>): void;
|
|
989
|
+
cancel: () => void;
|
|
990
|
+
}
|
|
991
|
+
declare const useDebounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => IDebouncedFunction<T>;
|
|
992
|
+
declare const debounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => IDebouncedFunction<T>;
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* defaultAdapter.ts — Framework-agnostic default implementation of ISSRHydrationAdapter.
|
|
996
|
+
* Pure Vanilla JS / React / Node.js with zero framework dependencies.
|
|
997
|
+
*/
|
|
998
|
+
|
|
999
|
+
declare class DefaultHydrationAdapter implements ISSRHydrationAdapter {
|
|
1000
|
+
getSSRData<T>(key: string, context?: any): T | null;
|
|
1001
|
+
fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
|
|
1002
|
+
clearSSRData(key: string, context?: any): void;
|
|
1003
|
+
getSSRPayload(context?: any): Record<string, any> | null;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* index.ts — Framework-agnostic hydration and platform bridge.
|
|
1008
|
+
* Provides unified, safe methods for SSR hydration, routing, and lifecycle hooks.
|
|
1009
|
+
*/
|
|
1010
|
+
|
|
1011
|
+
declare function getHydrationAdapter(): ISSRHydrationAdapter;
|
|
1012
|
+
declare function setHydrationAdapter(adapter: ISSRHydrationAdapter): void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Retrieve SSR state for a key. Returns null if not found.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function getSSRData<T>(key: string, context?: any): T | null;
|
|
1017
|
+
/**
|
|
1018
|
+
* Execute fetcher with SSR caching/serialization or fallback directly.
|
|
1019
|
+
*/
|
|
1020
|
+
declare function fetchWithSSR<T>(key: string, fetcher: () => Promise<T>, context?: any): Promise<T | null>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Clear SSR data for a key.
|
|
1023
|
+
*/
|
|
1024
|
+
declare function clearSSRData(key: string, context?: any): void;
|
|
1025
|
+
/**
|
|
1026
|
+
* Extract SSR payload dictionary for hydration of memory/storage caches.
|
|
1027
|
+
*/
|
|
1028
|
+
declare function getSSRPayload(context?: any): Record<string, any> | null;
|
|
1029
|
+
/**
|
|
1030
|
+
* Safe platform app accessor.
|
|
1031
|
+
*/
|
|
1032
|
+
declare function getPlatformApp(): any;
|
|
1033
|
+
/**
|
|
1034
|
+
* Safe route accessor with browser URLSearchParams fallback for React/Vanilla.
|
|
1035
|
+
*/
|
|
1036
|
+
declare function getAppRoute(): {
|
|
1037
|
+
query: Record<string, any>;
|
|
1038
|
+
path?: string;
|
|
1039
|
+
} | null;
|
|
1040
|
+
/**
|
|
1041
|
+
* Safe router accessor with window.history fallback for React/Vanilla.
|
|
1042
|
+
*/
|
|
1043
|
+
declare function getAppRouter(): any;
|
|
1044
|
+
/**
|
|
1045
|
+
* Register a callback when platform hydration is ready or DOMContentLoaded.
|
|
1046
|
+
*/
|
|
1047
|
+
declare function onPlatformReady(cb: () => void): void;
|
|
1048
|
+
|
|
1049
|
+
export { AAPIDataProvider, ADataProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CCookieCache, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CLocalStorageCache, CMemoryCache, CSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, debounce, evaluateFilter, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getHydrationAdapter, getPlatformApp, getSSRData, getSSRPayload, onPlatformReady, setHydrationAdapter, sortData, useDebounce, useFilterLogic, useSortLogic };
|
|
1050
|
+
export type { CacheDriverLoader, ICacheEntry, IDataFilter, IDataProviderOptions, IDataResult, IDataSort, IDeadLetterItem, IDebouncedFunction, IFlushOptions, IKDatatableAction, IPlatformRouter, IQueueStorageAdapter, IQueuedOperation, IRequestOptions, ISSRHydrationAdapter, ITreeDataProvider, ITreeDataProviderOptions, ITreeNode, ITreeNodeStatic, KProductItemData, KProductRowAction, TDataProviderListener, TDataRow, TKatluxStore, TPageDataHandler, TQueueItemStatus, TTreePageDataHandler, TTreeRow, TUnsubscribe, TreePaginationMode };
|