tinybase 8.0.0 → 8.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/ui-svelte/index.d.ts +2248 -0
- package/@types/ui-svelte/with-schemas/index.d.ts +1552 -0
- package/min/ui-svelte/index.js +1 -0
- package/min/ui-svelte/index.js.gz +0 -0
- package/min/ui-svelte/with-schemas/index.js +1 -0
- package/min/ui-svelte/with-schemas/index.js.gz +0 -0
- package/package.json +42 -2
- package/readme.md +3 -3
- package/releases.md +27 -1
- package/ui-svelte/index.js +2015 -0
- package/ui-svelte/with-schemas/index.js +2015 -0
|
@@ -0,0 +1,1552 @@
|
|
|
1
|
+
import type {Component, Snippet} from 'svelte';
|
|
2
|
+
import type {
|
|
3
|
+
AllCellIdFromSchema,
|
|
4
|
+
CellIdFromSchema,
|
|
5
|
+
DefaultedValueFromSchema,
|
|
6
|
+
NoInfer,
|
|
7
|
+
TableIdFromSchema,
|
|
8
|
+
ValueIdFromSchema,
|
|
9
|
+
} from '../../_internal/store/with-schemas/index.d.ts';
|
|
10
|
+
import type {
|
|
11
|
+
CheckpointIds,
|
|
12
|
+
Checkpoints,
|
|
13
|
+
} from '../../checkpoints/with-schemas/index.d.ts';
|
|
14
|
+
import type {Id, Ids} from '../../common/with-schemas/index.d.ts';
|
|
15
|
+
import type {Indexes} from '../../indexes/with-schemas/index.d.ts';
|
|
16
|
+
import type {Metrics} from '../../metrics/with-schemas/index.d.ts';
|
|
17
|
+
import type {
|
|
18
|
+
AnyPersister,
|
|
19
|
+
Status,
|
|
20
|
+
} from '../../persisters/with-schemas/index.d.ts';
|
|
21
|
+
import type {
|
|
22
|
+
Queries,
|
|
23
|
+
ResultCell,
|
|
24
|
+
ResultRow,
|
|
25
|
+
ResultTable,
|
|
26
|
+
} from '../../queries/with-schemas/index.d.ts';
|
|
27
|
+
import type {Relationships} from '../../relationships/with-schemas/index.d.ts';
|
|
28
|
+
import type {
|
|
29
|
+
Cell,
|
|
30
|
+
CellOrUndefined,
|
|
31
|
+
OptionalSchemas,
|
|
32
|
+
Row,
|
|
33
|
+
Store,
|
|
34
|
+
Table,
|
|
35
|
+
Tables,
|
|
36
|
+
Value,
|
|
37
|
+
Values,
|
|
38
|
+
} from '../../store/with-schemas/index.d.ts';
|
|
39
|
+
import type {Synchronizer} from '../../synchronizers/with-schemas/index.d.ts';
|
|
40
|
+
|
|
41
|
+
export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
42
|
+
/**
|
|
43
|
+
* The R type represents a value that can be provided either as a plain value
|
|
44
|
+
* or as a reactive getter function.
|
|
45
|
+
*
|
|
46
|
+
* When a getter function is provided to a hook, the hook's internal `$effect`
|
|
47
|
+
* will re-run whenever the getter's reactive dependencies change. This is the
|
|
48
|
+
* mechanism that makes Svelte 5 props reactive in hooks.
|
|
49
|
+
* @category Identity
|
|
50
|
+
* @since v8.1.0
|
|
51
|
+
*/
|
|
52
|
+
R: <T>(t: T) => T | (() => T);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The ProviderProps type describes the props of the Provider component.
|
|
56
|
+
* @category Props
|
|
57
|
+
* @since v8.1.0
|
|
58
|
+
*/
|
|
59
|
+
ProviderProps: {
|
|
60
|
+
readonly store?: Store<Schemas>;
|
|
61
|
+
readonly storesById?: {readonly [id: Id]: Store<Schemas>};
|
|
62
|
+
readonly metrics?: Metrics<Schemas>;
|
|
63
|
+
readonly metricsById?: {readonly [id: Id]: Metrics<Schemas>};
|
|
64
|
+
readonly indexes?: Indexes<Schemas>;
|
|
65
|
+
readonly indexesById?: {readonly [id: Id]: Indexes<Schemas>};
|
|
66
|
+
readonly relationships?: Relationships<Schemas>;
|
|
67
|
+
readonly relationshipsById?: {readonly [id: Id]: Relationships<Schemas>};
|
|
68
|
+
readonly queries?: Queries<Schemas>;
|
|
69
|
+
readonly queriesById?: {readonly [id: Id]: Queries<Schemas>};
|
|
70
|
+
readonly checkpoints?: Checkpoints<Schemas>;
|
|
71
|
+
readonly checkpointsById?: {readonly [id: Id]: Checkpoints<Schemas>};
|
|
72
|
+
readonly persister?: AnyPersister<Schemas>;
|
|
73
|
+
readonly persistersById?: {readonly [id: Id]: AnyPersister<Schemas>};
|
|
74
|
+
readonly synchronizer?: Synchronizer<Schemas>;
|
|
75
|
+
readonly synchronizersById?: {readonly [id: Id]: Synchronizer<Schemas>};
|
|
76
|
+
readonly children: Snippet;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The Provider component wraps part of an application to make TinyBase objects
|
|
81
|
+
* available throughout its component subtree via Svelte context.
|
|
82
|
+
*
|
|
83
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
84
|
+
*
|
|
85
|
+
* ```ts override
|
|
86
|
+
* export declare const Provider: Component<ProviderProps>;
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* Store objects, Metrics, Indexes, Relationships, Queries, Checkpoints,
|
|
90
|
+
* Persisters, and Synchronizers can all be provided both as single defaults and
|
|
91
|
+
* as named instances in a `*ById` map.
|
|
92
|
+
* @param props The props for this component.
|
|
93
|
+
* @example
|
|
94
|
+
* This example creates a Provider context with a default Store.
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* // In a .svelte file:
|
|
98
|
+
* // <Provider store={createStore()}>
|
|
99
|
+
* // <App />
|
|
100
|
+
* // </Provider>
|
|
101
|
+
* ```
|
|
102
|
+
* @category Component
|
|
103
|
+
* @since v8.1.0
|
|
104
|
+
*/
|
|
105
|
+
Provider: Component<{
|
|
106
|
+
readonly store?: Store<Schemas>;
|
|
107
|
+
readonly storesById?: {readonly [id: Id]: Store<Schemas>};
|
|
108
|
+
readonly metrics?: Metrics<Schemas>;
|
|
109
|
+
readonly metricsById?: {readonly [id: Id]: Metrics<Schemas>};
|
|
110
|
+
readonly indexes?: Indexes<Schemas>;
|
|
111
|
+
readonly indexesById?: {readonly [id: Id]: Indexes<Schemas>};
|
|
112
|
+
readonly relationships?: Relationships<Schemas>;
|
|
113
|
+
readonly relationshipsById?: {readonly [id: Id]: Relationships<Schemas>};
|
|
114
|
+
readonly queries?: Queries<Schemas>;
|
|
115
|
+
readonly queriesById?: {readonly [id: Id]: Queries<Schemas>};
|
|
116
|
+
readonly checkpoints?: Checkpoints<Schemas>;
|
|
117
|
+
readonly checkpointsById?: {readonly [id: Id]: Checkpoints<Schemas>};
|
|
118
|
+
readonly persister?: AnyPersister<Schemas>;
|
|
119
|
+
readonly persistersById?: {readonly [id: Id]: AnyPersister<Schemas>};
|
|
120
|
+
readonly synchronizer?: Synchronizer<Schemas>;
|
|
121
|
+
readonly synchronizersById?: {readonly [id: Id]: Synchronizer<Schemas>};
|
|
122
|
+
readonly children: Snippet;
|
|
123
|
+
}>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The CellView component renders the value of a single Cell in a given Row in
|
|
127
|
+
* a given Table, and registers a listener so that any changes to that result
|
|
128
|
+
* will cause a re-render.
|
|
129
|
+
* @param props The props for this component.
|
|
130
|
+
* @returns A rendering of the Cell, or nothing if not present.
|
|
131
|
+
* @category Component
|
|
132
|
+
* @since v8.1.0
|
|
133
|
+
*/
|
|
134
|
+
CellView: Component<{
|
|
135
|
+
readonly tableId: TableIdFromSchema<Schemas[0]>;
|
|
136
|
+
readonly rowId: Id;
|
|
137
|
+
readonly cellId: AllCellIdFromSchema<Schemas[0]>;
|
|
138
|
+
readonly store?: Store<Schemas> | Id;
|
|
139
|
+
readonly debugIds?: boolean;
|
|
140
|
+
}>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The ValueView component renders the value of a single Value in a Store, and
|
|
144
|
+
* registers a listener so that any changes to that result will cause a
|
|
145
|
+
* re-render.
|
|
146
|
+
* @param props The props for this component.
|
|
147
|
+
* @returns A rendering of the Value, or nothing if not present.
|
|
148
|
+
* @category Component
|
|
149
|
+
* @since v8.1.0
|
|
150
|
+
*/
|
|
151
|
+
ValueView: Component<{
|
|
152
|
+
readonly valueId: ValueIdFromSchema<Schemas[1]>;
|
|
153
|
+
readonly store?: Store<Schemas> | Id;
|
|
154
|
+
readonly debugIds?: boolean;
|
|
155
|
+
}>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The RowView component renders the contents of a single Row in a given Table,
|
|
159
|
+
* and registers a listener so that any changes to that result will cause a
|
|
160
|
+
* re-render.
|
|
161
|
+
* @param props The props for this component.
|
|
162
|
+
* @returns A rendering of the Row, or nothing if not present.
|
|
163
|
+
* @category Component
|
|
164
|
+
* @since v8.1.0
|
|
165
|
+
*/
|
|
166
|
+
RowView: Component<{
|
|
167
|
+
readonly tableId: TableIdFromSchema<Schemas[0]>;
|
|
168
|
+
readonly rowId: Id;
|
|
169
|
+
readonly store?: Store<Schemas> | Id;
|
|
170
|
+
readonly customCellIds?: Ids;
|
|
171
|
+
readonly separator?: Snippet<[]>;
|
|
172
|
+
readonly debugIds?: boolean;
|
|
173
|
+
readonly cell?: Snippet<[cellId: AllCellIdFromSchema<Schemas[0]>]>;
|
|
174
|
+
}>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The TableView component renders the contents of a single Table, and
|
|
178
|
+
* registers a listener so that any changes to that result will cause a
|
|
179
|
+
* re-render.
|
|
180
|
+
* @param props The props for this component.
|
|
181
|
+
* @returns A rendering of the Table.
|
|
182
|
+
* @category Component
|
|
183
|
+
* @since v8.1.0
|
|
184
|
+
*/
|
|
185
|
+
TableView: Component<{
|
|
186
|
+
readonly tableId: TableIdFromSchema<Schemas[0]>;
|
|
187
|
+
readonly store?: Store<Schemas> | Id;
|
|
188
|
+
readonly customCellIds?: Ids;
|
|
189
|
+
readonly separator?: Snippet<[]>;
|
|
190
|
+
readonly debugIds?: boolean;
|
|
191
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
192
|
+
}>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The SortedTableView component renders the contents of a single Table in a
|
|
196
|
+
* sorted order, and registers a listener so that any changes to that result
|
|
197
|
+
* will cause a re-render.
|
|
198
|
+
* @param props The props for this component.
|
|
199
|
+
* @returns A rendering of the sorted Table.
|
|
200
|
+
* @category Component
|
|
201
|
+
* @since v8.1.0
|
|
202
|
+
*/
|
|
203
|
+
SortedTableView: Component<{
|
|
204
|
+
readonly tableId: TableIdFromSchema<Schemas[0]>;
|
|
205
|
+
readonly cellId?: AllCellIdFromSchema<Schemas[0]>;
|
|
206
|
+
readonly descending?: boolean;
|
|
207
|
+
readonly offset?: number;
|
|
208
|
+
readonly limit?: number;
|
|
209
|
+
readonly store?: Store<Schemas> | Id;
|
|
210
|
+
readonly customCellIds?: Ids;
|
|
211
|
+
readonly separator?: Snippet<[]>;
|
|
212
|
+
readonly debugIds?: boolean;
|
|
213
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
214
|
+
}>;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The TablesView component renders the contents of all Tables in a Store, and
|
|
218
|
+
* registers a listener so that any changes to that result will cause a
|
|
219
|
+
* re-render.
|
|
220
|
+
* @param props The props for this component.
|
|
221
|
+
* @returns A rendering of all Tables.
|
|
222
|
+
* @category Component
|
|
223
|
+
* @since v8.1.0
|
|
224
|
+
*/
|
|
225
|
+
TablesView: Component<{
|
|
226
|
+
readonly store?: Store<Schemas> | Id;
|
|
227
|
+
readonly separator?: Snippet<[]>;
|
|
228
|
+
readonly debugIds?: boolean;
|
|
229
|
+
readonly table?: Snippet<[tableId: TableIdFromSchema<Schemas[0]>]>;
|
|
230
|
+
}>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The ValuesView component renders all Values in a Store, and registers a
|
|
234
|
+
* listener so that any changes to that result will cause a re-render.
|
|
235
|
+
* @param props The props for this component.
|
|
236
|
+
* @returns A rendering of all Values.
|
|
237
|
+
* @category Component
|
|
238
|
+
* @since v8.1.0
|
|
239
|
+
*/
|
|
240
|
+
ValuesView: Component<{
|
|
241
|
+
readonly store?: Store<Schemas> | Id;
|
|
242
|
+
readonly separator?: Snippet<[]>;
|
|
243
|
+
readonly debugIds?: boolean;
|
|
244
|
+
readonly value?: Snippet<[valueId: ValueIdFromSchema<Schemas[1]>]>;
|
|
245
|
+
}>;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The MetricView component renders the value of a named Metric in a Metrics
|
|
249
|
+
* object, and registers a listener so that any changes to that result will
|
|
250
|
+
* cause a re-render.
|
|
251
|
+
* @param props The props for this component.
|
|
252
|
+
* @returns A rendering of the Metric value.
|
|
253
|
+
* @category Component
|
|
254
|
+
* @since v8.1.0
|
|
255
|
+
*/
|
|
256
|
+
MetricView: Component<{
|
|
257
|
+
readonly metricId: Id;
|
|
258
|
+
readonly metrics?: Metrics<Schemas> | Id;
|
|
259
|
+
readonly debugIds?: boolean;
|
|
260
|
+
}>;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The IndexView component renders the slices in a named Index, and registers a
|
|
264
|
+
* listener so that any changes to that result will cause a re-render.
|
|
265
|
+
* @param props The props for this component.
|
|
266
|
+
* @returns A rendering of the slices.
|
|
267
|
+
* @category Component
|
|
268
|
+
* @since v8.1.0
|
|
269
|
+
*/
|
|
270
|
+
IndexView: Component<{
|
|
271
|
+
readonly indexId: Id;
|
|
272
|
+
readonly indexes?: Indexes<Schemas> | Id;
|
|
273
|
+
readonly separator?: Snippet<[]>;
|
|
274
|
+
readonly debugIds?: boolean;
|
|
275
|
+
readonly slice?: Snippet<[sliceId: Id]>;
|
|
276
|
+
}>;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* The SliceView component renders the Row Ids in a named Slice in an Index,
|
|
280
|
+
* and registers a listener so that any changes to that result will cause a
|
|
281
|
+
* re-render.
|
|
282
|
+
* @param props The props for this component.
|
|
283
|
+
* @returns A rendering of the Rows in the Slice.
|
|
284
|
+
* @category Component
|
|
285
|
+
* @since v8.1.0
|
|
286
|
+
*/
|
|
287
|
+
SliceView: Component<{
|
|
288
|
+
readonly indexId: Id;
|
|
289
|
+
readonly sliceId: Id;
|
|
290
|
+
readonly indexes?: Indexes<Schemas> | Id;
|
|
291
|
+
readonly separator?: Snippet<[]>;
|
|
292
|
+
readonly debugIds?: boolean;
|
|
293
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
294
|
+
}>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* The RemoteRowView component renders the remote Row Id for a given local Row
|
|
298
|
+
* in a Relationship, and registers a listener so that any changes to that
|
|
299
|
+
* result will cause a re-render.
|
|
300
|
+
* @param props The props for this component.
|
|
301
|
+
* @returns A rendering of the remote Row.
|
|
302
|
+
* @category Component
|
|
303
|
+
* @since v8.1.0
|
|
304
|
+
*/
|
|
305
|
+
RemoteRowView: Component<{
|
|
306
|
+
readonly relationshipId: Id;
|
|
307
|
+
readonly localRowId: Id;
|
|
308
|
+
readonly relationships?: Relationships<Schemas> | Id;
|
|
309
|
+
readonly debugIds?: boolean;
|
|
310
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
311
|
+
}>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The LocalRowsView component renders the local Row Ids for a given remote Row
|
|
315
|
+
* in a Relationship, and registers a listener so that any changes to that
|
|
316
|
+
* result will cause a re-render.
|
|
317
|
+
* @param props The props for this component.
|
|
318
|
+
* @returns A rendering of the local Row Ids.
|
|
319
|
+
* @category Component
|
|
320
|
+
* @since v8.1.0
|
|
321
|
+
*/
|
|
322
|
+
LocalRowsView: Component<{
|
|
323
|
+
readonly relationshipId: Id;
|
|
324
|
+
readonly remoteRowId: Id;
|
|
325
|
+
readonly relationships?: Relationships<Schemas> | Id;
|
|
326
|
+
readonly separator?: Snippet<[]>;
|
|
327
|
+
readonly debugIds?: boolean;
|
|
328
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
329
|
+
}>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The LinkedRowsView component renders the Rows in a linked list Relationship,
|
|
333
|
+
* and registers a listener so that any changes to that result will cause a
|
|
334
|
+
* re-render.
|
|
335
|
+
* @param props The props for this component.
|
|
336
|
+
* @returns A rendering of the linked Row Ids.
|
|
337
|
+
* @category Component
|
|
338
|
+
* @since v8.1.0
|
|
339
|
+
*/
|
|
340
|
+
LinkedRowsView: Component<{
|
|
341
|
+
readonly relationshipId: Id;
|
|
342
|
+
readonly firstRowId: Id;
|
|
343
|
+
readonly relationships?: Relationships<Schemas> | Id;
|
|
344
|
+
readonly separator?: Snippet<[]>;
|
|
345
|
+
readonly debugIds?: boolean;
|
|
346
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
347
|
+
}>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The ResultCellView component renders the value of a single Cell in a given
|
|
351
|
+
* Result Row in a given Result Table of a Queries object, and registers a
|
|
352
|
+
* listener so that any changes to that result will cause a re-render.
|
|
353
|
+
* @param props The props for this component.
|
|
354
|
+
* @returns A rendering of the result Cell.
|
|
355
|
+
* @category Component
|
|
356
|
+
* @since v8.1.0
|
|
357
|
+
*/
|
|
358
|
+
ResultCellView: Component<{
|
|
359
|
+
readonly queryId: Id;
|
|
360
|
+
readonly rowId: Id;
|
|
361
|
+
readonly cellId: Id;
|
|
362
|
+
readonly queries?: Queries<Schemas> | Id;
|
|
363
|
+
readonly debugIds?: boolean;
|
|
364
|
+
}>;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* The ResultRowView component renders the contents of a single Result Row in a
|
|
368
|
+
* given Result Table, and registers a listener so that any changes to that
|
|
369
|
+
* result will cause a re-render.
|
|
370
|
+
* @param props The props for this component.
|
|
371
|
+
* @returns A rendering of the result Row.
|
|
372
|
+
* @category Component
|
|
373
|
+
* @since v8.1.0
|
|
374
|
+
*/
|
|
375
|
+
ResultRowView: Component<{
|
|
376
|
+
readonly queryId: Id;
|
|
377
|
+
readonly rowId: Id;
|
|
378
|
+
readonly queries?: Queries<Schemas> | Id;
|
|
379
|
+
readonly separator?: Snippet<[]>;
|
|
380
|
+
readonly debugIds?: boolean;
|
|
381
|
+
readonly cell?: Snippet<[cellId: Id]>;
|
|
382
|
+
}>;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* The ResultTableView component renders the contents of a single Result Table
|
|
386
|
+
* in a Queries object, and registers a listener so that any changes to that
|
|
387
|
+
* result will cause a re-render.
|
|
388
|
+
* @param props The props for this component.
|
|
389
|
+
* @returns A rendering of the result Table.
|
|
390
|
+
* @category Component
|
|
391
|
+
* @since v8.1.0
|
|
392
|
+
*/
|
|
393
|
+
ResultTableView: Component<{
|
|
394
|
+
readonly queryId: Id;
|
|
395
|
+
readonly queries?: Queries<Schemas> | Id;
|
|
396
|
+
readonly separator?: Snippet<[]>;
|
|
397
|
+
readonly debugIds?: boolean;
|
|
398
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
399
|
+
}>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The ResultSortedTableView component renders the contents of a single sorted
|
|
403
|
+
* Result Table in a Queries object, and registers a listener so that any
|
|
404
|
+
* changes to that result will cause a re-render.
|
|
405
|
+
* @param props The props for this component.
|
|
406
|
+
* @returns A rendering of the sorted result Table.
|
|
407
|
+
* @category Component
|
|
408
|
+
* @since v8.1.0
|
|
409
|
+
*/
|
|
410
|
+
ResultSortedTableView: Component<{
|
|
411
|
+
readonly queryId: Id;
|
|
412
|
+
readonly cellId?: Id;
|
|
413
|
+
readonly descending?: boolean;
|
|
414
|
+
readonly offset?: number;
|
|
415
|
+
readonly limit?: number;
|
|
416
|
+
readonly queries?: Queries<Schemas> | Id;
|
|
417
|
+
readonly separator?: Snippet<[]>;
|
|
418
|
+
readonly debugIds?: boolean;
|
|
419
|
+
readonly row?: Snippet<[rowId: Id]>;
|
|
420
|
+
}>;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* The CheckpointView component renders the label of a checkpoint in a
|
|
424
|
+
* Checkpoints object, and registers a listener so that any changes to that
|
|
425
|
+
* result will cause a re-render.
|
|
426
|
+
* @param props The props for this component.
|
|
427
|
+
* @returns A rendering of the checkpoint label.
|
|
428
|
+
* @category Component
|
|
429
|
+
* @since v8.1.0
|
|
430
|
+
*/
|
|
431
|
+
CheckpointView: Component<{
|
|
432
|
+
readonly checkpointId: Id;
|
|
433
|
+
readonly checkpoints?: Checkpoints<Schemas> | Id;
|
|
434
|
+
readonly debugIds?: boolean;
|
|
435
|
+
}>;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* The BackwardCheckpointsView component renders the list of checkpoint Ids that
|
|
439
|
+
* represent backward checkpoints in a Checkpoints object, and registers a
|
|
440
|
+
* listener so that any changes to that result will cause a re-render.
|
|
441
|
+
* @param props The props for this component.
|
|
442
|
+
* @returns A rendering of the backward checkpoint Ids.
|
|
443
|
+
* @category Component
|
|
444
|
+
* @since v8.1.0
|
|
445
|
+
*/
|
|
446
|
+
BackwardCheckpointsView: Component<{
|
|
447
|
+
readonly checkpoints?: Checkpoints<Schemas> | Id;
|
|
448
|
+
readonly separator?: Snippet<[]>;
|
|
449
|
+
readonly debugIds?: boolean;
|
|
450
|
+
readonly checkpoint?: Snippet<[checkpointId: Id]>;
|
|
451
|
+
}>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* The ForwardCheckpointsView component renders the list of checkpoint Ids that
|
|
455
|
+
* represent forward checkpoints in a Checkpoints object, and registers a
|
|
456
|
+
* listener so that any changes to that result will cause a re-render.
|
|
457
|
+
* @param props The props for this component.
|
|
458
|
+
* @returns A rendering of the forward checkpoint Ids.
|
|
459
|
+
* @category Component
|
|
460
|
+
* @since v8.1.0
|
|
461
|
+
*/
|
|
462
|
+
ForwardCheckpointsView: Component<{
|
|
463
|
+
readonly checkpoints?: Checkpoints<Schemas> | Id;
|
|
464
|
+
readonly separator?: Snippet<[]>;
|
|
465
|
+
readonly debugIds?: boolean;
|
|
466
|
+
readonly checkpoint?: Snippet<[checkpointId: Id]>;
|
|
467
|
+
}>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* The CurrentCheckpointView component renders the current checkpoint in a
|
|
471
|
+
* Checkpoints object, and registers a listener so that any changes to that
|
|
472
|
+
* result will cause a re-render.
|
|
473
|
+
* @param props The props for this component.
|
|
474
|
+
* @returns A rendering of the current checkpoint.
|
|
475
|
+
* @category Component
|
|
476
|
+
* @since v8.1.0
|
|
477
|
+
*/
|
|
478
|
+
CurrentCheckpointView: Component<{
|
|
479
|
+
readonly checkpoints?: Checkpoints<Schemas> | Id;
|
|
480
|
+
readonly debugIds?: boolean;
|
|
481
|
+
readonly checkpoint?: Snippet<[checkpointId: Id]>;
|
|
482
|
+
}>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* The useHasTables hook returns a reactive object indicating whether any Tables
|
|
486
|
+
* exist in the Store, and registers a listener so that any changes to that
|
|
487
|
+
* result will update `.current`.
|
|
488
|
+
* @param storeOrStoreId The Store to use, or its Id in a Provider context.
|
|
489
|
+
* @returns A reactive object with a `current` boolean property.
|
|
490
|
+
* @category Hook
|
|
491
|
+
* @since v8.1.0
|
|
492
|
+
*/
|
|
493
|
+
useHasTables: (
|
|
494
|
+
storeOrStoreId?:
|
|
495
|
+
| Store<Schemas>
|
|
496
|
+
| Id
|
|
497
|
+
| (() => Store<Schemas> | Id | undefined),
|
|
498
|
+
) => {
|
|
499
|
+
readonly current: boolean;
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* The useTables hook returns a reactive object reflecting the Tables in the
|
|
504
|
+
* Store, and registers a listener so that any changes to those Tables will
|
|
505
|
+
* update `.current`.
|
|
506
|
+
* @param storeOrStoreId The Store to use, or its Id in a Provider context.
|
|
507
|
+
* @returns A reactive object with a `current` Tables property.
|
|
508
|
+
* @category Hook
|
|
509
|
+
* @since v8.1.0
|
|
510
|
+
*/
|
|
511
|
+
useTables: (
|
|
512
|
+
storeOrStoreId?:
|
|
513
|
+
| Store<Schemas>
|
|
514
|
+
| Id
|
|
515
|
+
| (() => Store<Schemas> | Id | undefined),
|
|
516
|
+
) => {
|
|
517
|
+
readonly current: Tables<Schemas[0]>;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* The useTableIds hook returns a reactive object reflecting the Ids of the
|
|
522
|
+
* Tables in a Store, and registers a listener so that any changes to those Ids
|
|
523
|
+
* will update `.current`.
|
|
524
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
525
|
+
* @returns A reactive object with a `current` Ids property.
|
|
526
|
+
* @category Hook
|
|
527
|
+
* @since v8.1.0
|
|
528
|
+
*/
|
|
529
|
+
useTableIds: (storeOrStoreId?: Store<Schemas> | Id) => {
|
|
530
|
+
readonly current: TableIdFromSchema<Schemas[0]>[];
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* The useHasTable hook returns a reactive object indicating whether a Table
|
|
535
|
+
* exists in the Store, and registers a listener so that any changes to that
|
|
536
|
+
* result will update `.current`.
|
|
537
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
538
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
539
|
+
* @returns A reactive object with a `current` boolean property.
|
|
540
|
+
* @category Hook
|
|
541
|
+
* @since v8.1.0
|
|
542
|
+
*/
|
|
543
|
+
useHasTable: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
544
|
+
tableId: TableId | (() => TableId),
|
|
545
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
546
|
+
) => {readonly current: boolean};
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* The useTable hook returns a reactive object reflecting a Table in a Store,
|
|
550
|
+
* and registers a listener so that any changes to that Table will update
|
|
551
|
+
* `.current`.
|
|
552
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
553
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
554
|
+
* @returns A reactive object with a `current` Table property.
|
|
555
|
+
* @category Hook
|
|
556
|
+
* @since v8.1.0
|
|
557
|
+
*/
|
|
558
|
+
useTable: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
559
|
+
tableId: TableId | (() => TableId),
|
|
560
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
561
|
+
) => {readonly current: Table<Schemas[0], TableId>};
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* The useTableCellIds hook returns a reactive object reflecting the Ids of all
|
|
565
|
+
* Cells used across a Table, and registers a listener so that any changes to
|
|
566
|
+
* those Ids will update `.current`.
|
|
567
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
568
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
569
|
+
* @returns A reactive object with a `current` Ids property.
|
|
570
|
+
* @category Hook
|
|
571
|
+
* @since v8.1.0
|
|
572
|
+
*/
|
|
573
|
+
useTableCellIds: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
574
|
+
tableId: TableId | (() => TableId),
|
|
575
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
576
|
+
) => {readonly current: CellIdFromSchema<Schemas[0], TableId>[]};
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* The useHasTableCell hook returns a reactive object indicating whether a
|
|
580
|
+
* particular Cell is used anywhere in a Table, and registers a listener so
|
|
581
|
+
* that any changes to that result will update `.current`.
|
|
582
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
583
|
+
* @param cellId The Id of the Cell (or a getter returning it).
|
|
584
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
585
|
+
* @returns A reactive object with a `current` boolean property.
|
|
586
|
+
* @category Hook
|
|
587
|
+
* @since v8.1.0
|
|
588
|
+
*/
|
|
589
|
+
useHasTableCell: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
590
|
+
tableId: TableId | (() => TableId),
|
|
591
|
+
cellId:
|
|
592
|
+
| CellIdFromSchema<Schemas[0], TableId>
|
|
593
|
+
| (() => CellIdFromSchema<Schemas[0], TableId>),
|
|
594
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
595
|
+
) => {readonly current: boolean};
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* The useRowCount hook returns a reactive object reflecting the number of Rows
|
|
599
|
+
* in a Table, and registers a listener so that any changes will update
|
|
600
|
+
* `.current`.
|
|
601
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
602
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
603
|
+
* @returns A reactive object with a `current` number property.
|
|
604
|
+
* @category Hook
|
|
605
|
+
* @since v8.1.0
|
|
606
|
+
*/
|
|
607
|
+
useRowCount: (
|
|
608
|
+
tableId:
|
|
609
|
+
| TableIdFromSchema<Schemas[0]>
|
|
610
|
+
| (() => TableIdFromSchema<Schemas[0]>),
|
|
611
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
612
|
+
) => {readonly current: number};
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* The useRowIds hook returns a reactive object reflecting the Ids of the Rows
|
|
616
|
+
* in a Table, and registers a listener so that any changes will update
|
|
617
|
+
* `.current`.
|
|
618
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
619
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
620
|
+
* @returns A reactive object with a `current` Ids property.
|
|
621
|
+
* @category Hook
|
|
622
|
+
* @since v8.1.0
|
|
623
|
+
*/
|
|
624
|
+
useRowIds: (
|
|
625
|
+
tableId:
|
|
626
|
+
| TableIdFromSchema<Schemas[0]>
|
|
627
|
+
| (() => TableIdFromSchema<Schemas[0]>),
|
|
628
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
629
|
+
) => {readonly current: Ids};
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* The useSortedRowIds hook returns a reactive object reflecting the sorted Row
|
|
633
|
+
* Ids in a Table, and registers a listener so that any changes will update
|
|
634
|
+
* `.current`.
|
|
635
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
636
|
+
* @param cellId The Id of the Cell to sort by (or a getter returning it).
|
|
637
|
+
* @param descending Whether to sort descending (or a getter returning it).
|
|
638
|
+
* @param offset The starting Row offset (or a getter returning it).
|
|
639
|
+
* @param limit The maximum number of Rows to return (or a getter returning it).
|
|
640
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
641
|
+
* @returns A reactive object with a `current` Ids property.
|
|
642
|
+
* @category Hook
|
|
643
|
+
* @since v8.1.0
|
|
644
|
+
*/
|
|
645
|
+
useSortedRowIds: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
646
|
+
tableId: TableId | (() => TableId),
|
|
647
|
+
cellId?:
|
|
648
|
+
| CellIdFromSchema<Schemas[0], TableId>
|
|
649
|
+
| (() => CellIdFromSchema<Schemas[0], TableId>)
|
|
650
|
+
| undefined,
|
|
651
|
+
descending?: boolean | (() => boolean),
|
|
652
|
+
offset?: number | (() => number),
|
|
653
|
+
limit?: number | (() => number) | undefined,
|
|
654
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
655
|
+
) => {readonly current: Ids};
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* The useHasRow hook returns a reactive object indicating whether a Row exists
|
|
659
|
+
* in a Table, and registers a listener so that any changes to that result will
|
|
660
|
+
* update `.current`.
|
|
661
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
662
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
663
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
664
|
+
* @returns A reactive object with a `current` boolean property.
|
|
665
|
+
* @category Hook
|
|
666
|
+
* @since v8.1.0
|
|
667
|
+
*/
|
|
668
|
+
useHasRow: (
|
|
669
|
+
tableId:
|
|
670
|
+
| TableIdFromSchema<Schemas[0]>
|
|
671
|
+
| (() => TableIdFromSchema<Schemas[0]>),
|
|
672
|
+
rowId: Id | (() => Id),
|
|
673
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
674
|
+
) => {readonly current: boolean};
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* The useRow hook returns a reactive object reflecting a Row in a Table, and
|
|
678
|
+
* registers a listener so that any changes to that Row will update `.current`.
|
|
679
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
680
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
681
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
682
|
+
* @returns A reactive object with a `current` Row property.
|
|
683
|
+
* @category Hook
|
|
684
|
+
* @since v8.1.0
|
|
685
|
+
*/
|
|
686
|
+
useRow: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
687
|
+
tableId: TableId | (() => TableId),
|
|
688
|
+
rowId: Id | (() => Id),
|
|
689
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
690
|
+
) => {readonly current: Row<Schemas[0], TableId>};
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* The useCellIds hook returns a reactive object reflecting the Ids of the
|
|
694
|
+
* Cells in a Row, and registers a listener so that any changes will update
|
|
695
|
+
* `.current`.
|
|
696
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
697
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
698
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
699
|
+
* @returns A reactive object with a `current` Ids property.
|
|
700
|
+
* @category Hook
|
|
701
|
+
* @since v8.1.0
|
|
702
|
+
*/
|
|
703
|
+
useCellIds: <TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
704
|
+
tableId: TableId | (() => TableId),
|
|
705
|
+
rowId: Id | (() => Id),
|
|
706
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
707
|
+
) => {readonly current: CellIdFromSchema<Schemas[0], TableId>[]};
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* The useHasCell hook returns a reactive object indicating whether a Cell
|
|
711
|
+
* exists in a Row in a Table, and registers a listener so that any changes to
|
|
712
|
+
* that result will update `.current`.
|
|
713
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
714
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
715
|
+
* @param cellId The Id of the Cell (or a getter returning it).
|
|
716
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
717
|
+
* @returns A reactive object with a `current` boolean property.
|
|
718
|
+
* @category Hook
|
|
719
|
+
* @since v8.1.0
|
|
720
|
+
*/
|
|
721
|
+
useHasCell: <
|
|
722
|
+
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
723
|
+
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
724
|
+
>(
|
|
725
|
+
tableId: TableId | (() => TableId),
|
|
726
|
+
rowId: Id | (() => Id),
|
|
727
|
+
cellId: CellId | (() => CellId),
|
|
728
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
729
|
+
) => {readonly current: boolean};
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* The useCell hook returns a reactive object reflecting the value of a Cell in
|
|
733
|
+
* a Row in a Table, and registers a listener so that any changes to that Cell
|
|
734
|
+
* will update `.current`.
|
|
735
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
736
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
737
|
+
* @param cellId The Id of the Cell (or a getter returning it).
|
|
738
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
739
|
+
* @returns A reactive object with a `current` CellOrUndefined property.
|
|
740
|
+
* @example
|
|
741
|
+
* This example uses the useCell hook to display a Cell value reactively.
|
|
742
|
+
*
|
|
743
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
744
|
+
*
|
|
745
|
+
* ```ts override
|
|
746
|
+
* useCell(
|
|
747
|
+
* tableId: R<Id>,
|
|
748
|
+
* rowId: R<Id>,
|
|
749
|
+
* cellId: R<Id>,
|
|
750
|
+
* storeOrStoreId?: R<Store | Id | undefined>,
|
|
751
|
+
* ): {readonly current: CellOrUndefined};
|
|
752
|
+
* ```
|
|
753
|
+
*
|
|
754
|
+
* ```ts
|
|
755
|
+
* // In a .svelte file:
|
|
756
|
+
* // const store = createStore().setCell('pets', 'cat', 'name', 'Fido');
|
|
757
|
+
* // const name = useCell('pets', 'cat', 'name', store);
|
|
758
|
+
* // $: console.log(name.current); // 'Fido'
|
|
759
|
+
* ```
|
|
760
|
+
* @category Hook
|
|
761
|
+
* @since v8.1.0
|
|
762
|
+
*/
|
|
763
|
+
useCell: <
|
|
764
|
+
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
765
|
+
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
766
|
+
>(
|
|
767
|
+
tableId: TableId | (() => TableId),
|
|
768
|
+
rowId: Id | (() => Id),
|
|
769
|
+
cellId: CellId | (() => CellId),
|
|
770
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
771
|
+
) => {
|
|
772
|
+
readonly current: NoInfer<CellOrUndefined<Schemas[0], TableId, CellId>>;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* The useCellState hook returns a reactive object reflecting the value of a
|
|
777
|
+
* Cell, with a settable `current` property that writes back to the Store.
|
|
778
|
+
* @param tableId The Id of the Table (or a getter returning it).
|
|
779
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
780
|
+
* @param cellId The Id of the Cell (or a getter returning it).
|
|
781
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
782
|
+
* @returns A reactive object with gettable and settable `current`.
|
|
783
|
+
* @category Hook
|
|
784
|
+
* @since v8.1.0
|
|
785
|
+
*/
|
|
786
|
+
useCellState: <
|
|
787
|
+
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
788
|
+
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
789
|
+
>(
|
|
790
|
+
tableId: TableId | (() => TableId),
|
|
791
|
+
rowId: Id | (() => Id),
|
|
792
|
+
cellId: CellId | (() => CellId),
|
|
793
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
794
|
+
) => {
|
|
795
|
+
get current(): NoInfer<CellOrUndefined<Schemas[0], TableId, CellId>>;
|
|
796
|
+
set current(v: Cell<Schemas[0], TableId, CellId>);
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* The useHasValues hook returns a reactive object indicating whether any Values
|
|
801
|
+
* exist in the Store, and registers a listener so that any changes to that
|
|
802
|
+
* result will update `.current`.
|
|
803
|
+
* @param storeOrStoreId The Store to use, or its Id in a Provider context.
|
|
804
|
+
* @returns A reactive object with a `current` boolean property.
|
|
805
|
+
* @category Hook
|
|
806
|
+
* @since v8.1.0
|
|
807
|
+
*/
|
|
808
|
+
useHasValues: (
|
|
809
|
+
storeOrStoreId?:
|
|
810
|
+
| Store<Schemas>
|
|
811
|
+
| Id
|
|
812
|
+
| (() => Store<Schemas> | Id | undefined),
|
|
813
|
+
) => {
|
|
814
|
+
readonly current: boolean;
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* The useValues hook returns a reactive object reflecting the Values in the
|
|
819
|
+
* Store, and registers a listener so that any changes will update `.current`.
|
|
820
|
+
* @param storeOrStoreId The Store to use, or its Id in a Provider context.
|
|
821
|
+
* @returns A reactive object with a `current` Values property.
|
|
822
|
+
* @category Hook
|
|
823
|
+
* @since v8.1.0
|
|
824
|
+
*/
|
|
825
|
+
useValues: (
|
|
826
|
+
storeOrStoreId?:
|
|
827
|
+
| Store<Schemas>
|
|
828
|
+
| Id
|
|
829
|
+
| (() => Store<Schemas> | Id | undefined),
|
|
830
|
+
) => {
|
|
831
|
+
readonly current: Values<Schemas[1]>;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* The useValueIds hook returns a reactive object reflecting the Ids of the
|
|
836
|
+
* Values in a Store, and registers a listener so that any changes will update
|
|
837
|
+
* `.current`.
|
|
838
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
839
|
+
* @returns A reactive object with a `current` Ids property.
|
|
840
|
+
* @category Hook
|
|
841
|
+
* @since v8.1.0
|
|
842
|
+
*/
|
|
843
|
+
useValueIds: (storeOrStoreId?: Store<Schemas> | Id) => {
|
|
844
|
+
readonly current: ValueIdFromSchema<Schemas[1]>[];
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* The useHasValue hook returns a reactive object indicating whether a Value
|
|
849
|
+
* exists in the Store, and registers a listener so that any changes to that
|
|
850
|
+
* result will update `.current`.
|
|
851
|
+
* @param valueId The Id of the Value (or a getter returning it).
|
|
852
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
853
|
+
* @returns A reactive object with a `current` boolean property.
|
|
854
|
+
* @category Hook
|
|
855
|
+
* @since v8.1.0
|
|
856
|
+
*/
|
|
857
|
+
useHasValue: <ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
858
|
+
valueId: ValueId | (() => ValueId),
|
|
859
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
860
|
+
) => {readonly current: boolean};
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* The useValue hook returns a reactive object reflecting the value of a Value
|
|
864
|
+
* in a Store, and registers a listener so that any changes to that Value will
|
|
865
|
+
* update `.current`.
|
|
866
|
+
* @param valueId The Id of the Value (or a getter returning it).
|
|
867
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
868
|
+
* @returns A reactive object with a `current` ValueOrUndefined property.
|
|
869
|
+
* @category Hook
|
|
870
|
+
* @since v8.1.0
|
|
871
|
+
*/
|
|
872
|
+
useValue: <ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
873
|
+
valueId: ValueId | (() => ValueId),
|
|
874
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
875
|
+
) => {
|
|
876
|
+
readonly current: NoInfer<DefaultedValueFromSchema<Schemas[1], ValueId>>;
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* The useValueState hook returns a reactive object reflecting the value of a
|
|
881
|
+
* Value, with a settable `current` property that writes back to the Store.
|
|
882
|
+
* @param valueId The Id of the Value (or a getter returning it).
|
|
883
|
+
* @param storeOrStoreId The Store to use (plain value or getter), or its Id.
|
|
884
|
+
* @returns A reactive object with gettable and settable `current`.
|
|
885
|
+
* @category Hook
|
|
886
|
+
* @since v8.1.0
|
|
887
|
+
*/
|
|
888
|
+
useValueState: <ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
889
|
+
valueId: ValueId | (() => ValueId),
|
|
890
|
+
storeOrStoreId?: Store<Schemas> | Id,
|
|
891
|
+
) => {
|
|
892
|
+
get current(): NoInfer<DefaultedValueFromSchema<Schemas[1], ValueId>>;
|
|
893
|
+
set current(v: Value<Schemas[1], ValueId>);
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* The useStore hook returns the default Store from the current Provider context
|
|
898
|
+
* (or a named Store if an Id is provided).
|
|
899
|
+
* @param id An optional Id of a named Store in the Provider context.
|
|
900
|
+
* @returns The Store, or `undefined` if not found.
|
|
901
|
+
* @category Hook
|
|
902
|
+
* @since v8.1.0
|
|
903
|
+
*/
|
|
904
|
+
useStore: (id?: Id) => Store<Schemas> | undefined;
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* The useStoreIds hook returns a reactive object with the Ids of all Stores
|
|
908
|
+
* registered in the current Provider context.
|
|
909
|
+
* @returns A reactive object with a `current` Ids property.
|
|
910
|
+
* @category Hook
|
|
911
|
+
* @since v8.1.0
|
|
912
|
+
*/
|
|
913
|
+
useStoreIds: () => {readonly current: Ids};
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* The useMetrics hook returns the default Metrics object from the current
|
|
917
|
+
* Provider context (or a named one if an Id is provided).
|
|
918
|
+
* @param id An optional Id of a named Metrics object in the Provider context.
|
|
919
|
+
* @returns The Metrics object, or `undefined` if not found.
|
|
920
|
+
* @category Hook
|
|
921
|
+
* @since v8.1.0
|
|
922
|
+
*/
|
|
923
|
+
useMetrics: (id?: Id) => Metrics<Schemas> | undefined;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* The useMetricsIds hook returns a reactive object with the Ids of all Metrics
|
|
927
|
+
* objects registered in the current Provider context.
|
|
928
|
+
* @returns A reactive object with a `current` Ids property.
|
|
929
|
+
* @category Hook
|
|
930
|
+
* @since v8.1.0
|
|
931
|
+
*/
|
|
932
|
+
useMetricsIds: () => {readonly current: Ids};
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* The useMetricIds hook returns a reactive object reflecting the Ids of the
|
|
936
|
+
* Metrics in a Metrics object, and registers a listener so that any changes
|
|
937
|
+
* will update `.current`.
|
|
938
|
+
* @param metricsOrMetricsId The Metrics object to use, or its Id.
|
|
939
|
+
* @returns A reactive object with a `current` Ids property.
|
|
940
|
+
* @category Hook
|
|
941
|
+
* @since v8.1.0
|
|
942
|
+
*/
|
|
943
|
+
useMetricIds: (
|
|
944
|
+
metricsOrMetricsId?:
|
|
945
|
+
| Metrics<Schemas>
|
|
946
|
+
| Id
|
|
947
|
+
| (() => Metrics<Schemas> | Id | undefined),
|
|
948
|
+
) => {
|
|
949
|
+
readonly current: Ids;
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* The useMetric hook returns a reactive object reflecting the value of a named
|
|
954
|
+
* Metric in a Metrics object, and registers a listener so that any changes to
|
|
955
|
+
* that Metric will update `.current`.
|
|
956
|
+
* @param metricId The Id of the Metric (or a getter returning it).
|
|
957
|
+
* @param metricsOrMetricsId The Metrics object to use (plain or getter), or
|
|
958
|
+
* its Id.
|
|
959
|
+
* @returns A reactive object with a `current` number | undefined property.
|
|
960
|
+
* @category Hook
|
|
961
|
+
* @since v8.1.0
|
|
962
|
+
*/
|
|
963
|
+
useMetric: (
|
|
964
|
+
metricId: Id | (() => Id),
|
|
965
|
+
metricsOrMetricsId?: Metrics<Schemas> | Id,
|
|
966
|
+
) => {readonly current: number | undefined};
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* The useIndexes hook returns the default Indexes object from the current
|
|
970
|
+
* Provider context (or a named one if an Id is provided).
|
|
971
|
+
* @param id An optional Id of a named Indexes object in the Provider context.
|
|
972
|
+
* @returns The Indexes object, or `undefined` if not found.
|
|
973
|
+
* @category Hook
|
|
974
|
+
* @since v8.1.0
|
|
975
|
+
*/
|
|
976
|
+
useIndexes: (id?: Id) => Indexes<Schemas> | undefined;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* The useIndexesIds hook returns a reactive object with the Ids of all Indexes
|
|
980
|
+
* objects registered in the current Provider context.
|
|
981
|
+
* @returns A reactive object with a `current` Ids property.
|
|
982
|
+
* @category Hook
|
|
983
|
+
* @since v8.1.0
|
|
984
|
+
*/
|
|
985
|
+
useIndexesIds: () => {readonly current: Ids};
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* The useIndexIds hook returns a reactive object reflecting the Ids of the
|
|
989
|
+
* Indexes in an Indexes object, and registers a listener so that any changes
|
|
990
|
+
* will update `.current`.
|
|
991
|
+
* @param indexesOrIndexesId The Indexes object to use, or its Id.
|
|
992
|
+
* @returns A reactive object with a `current` Ids property.
|
|
993
|
+
* @category Hook
|
|
994
|
+
* @since v8.1.0
|
|
995
|
+
*/
|
|
996
|
+
useIndexIds: (
|
|
997
|
+
indexesOrIndexesId?:
|
|
998
|
+
| Indexes<Schemas>
|
|
999
|
+
| Id
|
|
1000
|
+
| (() => Indexes<Schemas> | Id | undefined),
|
|
1001
|
+
) => {
|
|
1002
|
+
readonly current: Ids;
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* The useSliceIds hook returns a reactive object reflecting the Ids of the
|
|
1007
|
+
* Slices in an Index, and registers a listener so that any changes will update
|
|
1008
|
+
* `.current`.
|
|
1009
|
+
* @param indexId The Id of the Index (or a getter returning it).
|
|
1010
|
+
* @param indexesOrIndexesId The Indexes object to use (plain or getter), or
|
|
1011
|
+
* its Id.
|
|
1012
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1013
|
+
* @category Hook
|
|
1014
|
+
* @since v8.1.0
|
|
1015
|
+
*/
|
|
1016
|
+
useSliceIds: (
|
|
1017
|
+
indexId: Id | (() => Id),
|
|
1018
|
+
indexesOrIndexesId?: Indexes<Schemas> | Id,
|
|
1019
|
+
) => {readonly current: Ids};
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* The useSliceRowIds hook returns a reactive object reflecting the Ids of the
|
|
1023
|
+
* Rows in a Slice, and registers a listener so that any changes will update
|
|
1024
|
+
* `.current`.
|
|
1025
|
+
* @param indexId The Id of the Index (or a getter returning it).
|
|
1026
|
+
* @param sliceId The Id of the Slice (or a getter returning it).
|
|
1027
|
+
* @param indexesOrIndexesId The Indexes object to use (plain or getter), or
|
|
1028
|
+
* its Id.
|
|
1029
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1030
|
+
* @category Hook
|
|
1031
|
+
* @since v8.1.0
|
|
1032
|
+
*/
|
|
1033
|
+
useSliceRowIds: (
|
|
1034
|
+
indexId: Id | (() => Id),
|
|
1035
|
+
sliceId: Id | (() => Id),
|
|
1036
|
+
indexesOrIndexesId?: Indexes<Schemas> | Id,
|
|
1037
|
+
) => {readonly current: Ids};
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* The useQueries hook returns the default Queries object from the current
|
|
1041
|
+
* Provider context (or a named one if an Id is provided).
|
|
1042
|
+
* @param id An optional Id of a named Queries object in the Provider context.
|
|
1043
|
+
* @returns The Queries object, or `undefined` if not found.
|
|
1044
|
+
* @category Hook
|
|
1045
|
+
* @since v8.1.0
|
|
1046
|
+
*/
|
|
1047
|
+
useQueries: (id?: Id) => Queries<Schemas> | undefined;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* The useQueriesIds hook returns a reactive object with the Ids of all Queries
|
|
1051
|
+
* objects registered in the current Provider context.
|
|
1052
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1053
|
+
* @category Hook
|
|
1054
|
+
* @since v8.1.0
|
|
1055
|
+
*/
|
|
1056
|
+
useQueriesIds: () => {readonly current: Ids};
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* The useQueryIds hook returns a reactive object reflecting the Ids of the
|
|
1060
|
+
* Queries in a Queries object, and registers a listener so that any changes
|
|
1061
|
+
* will update `.current`.
|
|
1062
|
+
* @param queriesOrQueriesId The Queries object to use, or its Id.
|
|
1063
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1064
|
+
* @category Hook
|
|
1065
|
+
* @since v8.1.0
|
|
1066
|
+
*/
|
|
1067
|
+
useQueryIds: (
|
|
1068
|
+
queriesOrQueriesId?:
|
|
1069
|
+
| Queries<Schemas>
|
|
1070
|
+
| Id
|
|
1071
|
+
| (() => Queries<Schemas> | Id | undefined),
|
|
1072
|
+
) => {
|
|
1073
|
+
readonly current: Ids;
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* The useResultTable hook returns a reactive object reflecting a result Table
|
|
1078
|
+
* in a Queries object, and registers a listener so that any changes to that
|
|
1079
|
+
* result will update `.current`.
|
|
1080
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1081
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1082
|
+
* its Id.
|
|
1083
|
+
* @returns A reactive object with a `current` Table property.
|
|
1084
|
+
* @category Hook
|
|
1085
|
+
* @since v8.1.0
|
|
1086
|
+
*/
|
|
1087
|
+
useResultTable: (
|
|
1088
|
+
queryId: Id | (() => Id),
|
|
1089
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1090
|
+
) => {readonly current: ResultTable};
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* The useResultTableCellIds hook returns a reactive object reflecting the Ids
|
|
1094
|
+
* of all Cells used across a result Table, and registers a listener so that
|
|
1095
|
+
* any changes will update `.current`.
|
|
1096
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1097
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1098
|
+
* its Id.
|
|
1099
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1100
|
+
* @category Hook
|
|
1101
|
+
* @since v8.1.0
|
|
1102
|
+
*/
|
|
1103
|
+
useResultTableCellIds: (
|
|
1104
|
+
queryId: Id | (() => Id),
|
|
1105
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1106
|
+
) => {readonly current: Ids};
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* The useResultRowCount hook returns a reactive object reflecting the number of
|
|
1110
|
+
* Rows in a result Table, and registers a listener so that any changes will
|
|
1111
|
+
* update `.current`.
|
|
1112
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1113
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1114
|
+
* its Id.
|
|
1115
|
+
* @returns A reactive object with a `current` number property.
|
|
1116
|
+
* @category Hook
|
|
1117
|
+
* @since v8.1.0
|
|
1118
|
+
*/
|
|
1119
|
+
useResultRowCount: (
|
|
1120
|
+
queryId: Id | (() => Id),
|
|
1121
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1122
|
+
) => {readonly current: number};
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* The useResultRowIds hook returns a reactive object reflecting the Ids of the
|
|
1126
|
+
* Rows in a result Table, and registers a listener so that any changes will
|
|
1127
|
+
* update `.current`.
|
|
1128
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1129
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1130
|
+
* its Id.
|
|
1131
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1132
|
+
* @category Hook
|
|
1133
|
+
* @since v8.1.0
|
|
1134
|
+
*/
|
|
1135
|
+
useResultRowIds: (
|
|
1136
|
+
queryId: Id | (() => Id),
|
|
1137
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1138
|
+
) => {readonly current: Ids};
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* The useResultSortedRowIds hook returns a reactive object reflecting the
|
|
1142
|
+
* sorted Row Ids in a result Table, and registers a listener so that any
|
|
1143
|
+
* changes will update `.current`.
|
|
1144
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1145
|
+
* @param cellId The Id of the Cell to sort by (or a getter returning it).
|
|
1146
|
+
* @param descending Whether to sort descending (or a getter returning it).
|
|
1147
|
+
* @param offset The starting Row offset (or a getter returning it).
|
|
1148
|
+
* @param limit The maximum number of Rows (or a getter returning it).
|
|
1149
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1150
|
+
* its Id.
|
|
1151
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1152
|
+
* @category Hook
|
|
1153
|
+
* @since v8.1.0
|
|
1154
|
+
*/
|
|
1155
|
+
useResultSortedRowIds: (
|
|
1156
|
+
queryId: Id | (() => Id),
|
|
1157
|
+
cellId?: Id | (() => Id) | undefined,
|
|
1158
|
+
descending?: boolean | (() => boolean),
|
|
1159
|
+
offset?: number | (() => number),
|
|
1160
|
+
limit?: number | (() => number) | undefined,
|
|
1161
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1162
|
+
) => {readonly current: Ids};
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* The useResultRow hook returns a reactive object reflecting a result Row in a
|
|
1166
|
+
* result Table, and registers a listener so that any changes will update
|
|
1167
|
+
* `.current`.
|
|
1168
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1169
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
1170
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1171
|
+
* its Id.
|
|
1172
|
+
* @returns A reactive object with a `current` Row property.
|
|
1173
|
+
* @category Hook
|
|
1174
|
+
* @since v8.1.0
|
|
1175
|
+
*/
|
|
1176
|
+
useResultRow: (
|
|
1177
|
+
queryId: Id | (() => Id),
|
|
1178
|
+
rowId: Id | (() => Id),
|
|
1179
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1180
|
+
) => {readonly current: ResultRow};
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* The useResultCellIds hook returns a reactive object reflecting the Ids of the
|
|
1184
|
+
* Cells in a result Row, and registers a listener so that any changes will
|
|
1185
|
+
* update `.current`.
|
|
1186
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1187
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
1188
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1189
|
+
* its Id.
|
|
1190
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1191
|
+
* @category Hook
|
|
1192
|
+
* @since v8.1.0
|
|
1193
|
+
*/
|
|
1194
|
+
useResultCellIds: (
|
|
1195
|
+
queryId: Id | (() => Id),
|
|
1196
|
+
rowId: Id | (() => Id),
|
|
1197
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1198
|
+
) => {readonly current: Ids};
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* The useResultCell hook returns a reactive object reflecting the value of a
|
|
1202
|
+
* Cell in a result Row, and registers a listener so that any changes will
|
|
1203
|
+
* update `.current`.
|
|
1204
|
+
* @param queryId The Id of the Query (or a getter returning it).
|
|
1205
|
+
* @param rowId The Id of the Row (or a getter returning it).
|
|
1206
|
+
* @param cellId The Id of the Cell (or a getter returning it).
|
|
1207
|
+
* @param queriesOrQueriesId The Queries object to use (plain or getter), or
|
|
1208
|
+
* its Id.
|
|
1209
|
+
* @returns A reactive object with a `current` Cell | undefined property.
|
|
1210
|
+
* @category Hook
|
|
1211
|
+
* @since v8.1.0
|
|
1212
|
+
*/
|
|
1213
|
+
useResultCell: (
|
|
1214
|
+
queryId: Id | (() => Id),
|
|
1215
|
+
rowId: Id | (() => Id),
|
|
1216
|
+
cellId: Id | (() => Id),
|
|
1217
|
+
queriesOrQueriesId?: Queries<Schemas> | Id,
|
|
1218
|
+
) => {readonly current: ResultCell | undefined};
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* The useRelationships hook returns the default Relationships object from the
|
|
1222
|
+
* current Provider context (or a named one if an Id is provided).
|
|
1223
|
+
* @param id An optional Id of a named Relationships object in the Provider
|
|
1224
|
+
* context.
|
|
1225
|
+
* @returns The Relationships object, or `undefined` if not found.
|
|
1226
|
+
* @category Hook
|
|
1227
|
+
* @since v8.1.0
|
|
1228
|
+
*/
|
|
1229
|
+
useRelationships: (id?: Id) => Relationships<Schemas> | undefined;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* The useRelationshipsIds hook returns a reactive object with the Ids of all
|
|
1233
|
+
* Relationships objects registered in the current Provider context.
|
|
1234
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1235
|
+
* @category Hook
|
|
1236
|
+
* @since v8.1.0
|
|
1237
|
+
*/
|
|
1238
|
+
useRelationshipsIds: () => {readonly current: Ids};
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* The useRelationshipIds hook returns a reactive object reflecting the Ids of
|
|
1242
|
+
* the Relationships in a Relationships object, and registers a listener so
|
|
1243
|
+
* that any changes will update `.current`.
|
|
1244
|
+
* @param relationshipsOrRelationshipsId The Relationships object to use, or
|
|
1245
|
+
* its Id.
|
|
1246
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1247
|
+
* @category Hook
|
|
1248
|
+
* @since v8.1.0
|
|
1249
|
+
*/
|
|
1250
|
+
useRelationshipIds: (
|
|
1251
|
+
relationshipsOrRelationshipsId?:
|
|
1252
|
+
| Relationships<Schemas>
|
|
1253
|
+
| Id
|
|
1254
|
+
| (() => Relationships<Schemas> | Id | undefined),
|
|
1255
|
+
) => {readonly current: Ids};
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* The useRemoteRowId hook returns a reactive object reflecting the remote Row
|
|
1259
|
+
* Id for a given local Row in a Relationship, and registers a listener so that
|
|
1260
|
+
* any changes will update `.current`.
|
|
1261
|
+
* @param relationshipId The Id of the Relationship (or a getter returning it).
|
|
1262
|
+
* @param localRowId The Id of the local Row (or a getter returning it).
|
|
1263
|
+
* @param relationshipsOrRelationshipsId The Relationships object to use (plain
|
|
1264
|
+
* or getter), or its Id.
|
|
1265
|
+
* @returns A reactive object with a `current` Id | undefined property.
|
|
1266
|
+
* @category Hook
|
|
1267
|
+
* @since v8.1.0
|
|
1268
|
+
*/
|
|
1269
|
+
useRemoteRowId: (
|
|
1270
|
+
relationshipId: Id | (() => Id),
|
|
1271
|
+
localRowId: Id | (() => Id),
|
|
1272
|
+
relationshipsOrRelationshipsId?: Relationships<Schemas> | Id,
|
|
1273
|
+
) => {readonly current: Id | undefined};
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* The useLocalRowIds hook returns a reactive object reflecting the local Row
|
|
1277
|
+
* Ids for a given remote Row in a Relationship, and registers a listener so
|
|
1278
|
+
* that any changes will update `.current`.
|
|
1279
|
+
* @param relationshipId The Id of the Relationship (or a getter returning it).
|
|
1280
|
+
* @param remoteRowId The Id of the remote Row (or a getter returning it).
|
|
1281
|
+
* @param relationshipsOrRelationshipsId The Relationships object to use (plain
|
|
1282
|
+
* or getter), or its Id.
|
|
1283
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1284
|
+
* @category Hook
|
|
1285
|
+
* @since v8.1.0
|
|
1286
|
+
*/
|
|
1287
|
+
useLocalRowIds: (
|
|
1288
|
+
relationshipId: Id | (() => Id),
|
|
1289
|
+
remoteRowId: Id | (() => Id),
|
|
1290
|
+
relationshipsOrRelationshipsId?: Relationships<Schemas> | Id,
|
|
1291
|
+
) => {readonly current: Ids};
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* The useLinkedRowIds hook returns a reactive object reflecting the linked Row
|
|
1295
|
+
* Ids in a Relationship, and registers a listener so that any changes will
|
|
1296
|
+
* update `.current`.
|
|
1297
|
+
* @param relationshipId The Id of the Relationship (or a getter returning it).
|
|
1298
|
+
* @param firstRowId The Id of the first Row (or a getter returning it).
|
|
1299
|
+
* @param relationshipsOrRelationshipsId The Relationships object to use (plain
|
|
1300
|
+
* or getter), or its Id.
|
|
1301
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1302
|
+
* @category Hook
|
|
1303
|
+
* @since v8.1.0
|
|
1304
|
+
*/
|
|
1305
|
+
useLinkedRowIds: (
|
|
1306
|
+
relationshipId: Id | (() => Id),
|
|
1307
|
+
firstRowId: Id | (() => Id),
|
|
1308
|
+
relationshipsOrRelationshipsId?: Relationships<Schemas> | Id,
|
|
1309
|
+
) => {readonly current: Ids};
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* The useCheckpoints hook returns the default Checkpoints object from the
|
|
1313
|
+
* current Provider context (or a named one if an Id is provided).
|
|
1314
|
+
* @param id An optional Id of a named Checkpoints object in the Provider
|
|
1315
|
+
* context.
|
|
1316
|
+
* @returns The Checkpoints object, or `undefined` if not found.
|
|
1317
|
+
* @category Hook
|
|
1318
|
+
* @since v8.1.0
|
|
1319
|
+
*/
|
|
1320
|
+
useCheckpoints: (id?: Id) => Checkpoints<Schemas> | undefined;
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* The useCheckpointsIds hook returns a reactive object with the Ids of all
|
|
1324
|
+
* Checkpoints objects registered in the current Provider context.
|
|
1325
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1326
|
+
* @category Hook
|
|
1327
|
+
* @since v8.1.0
|
|
1328
|
+
*/
|
|
1329
|
+
useCheckpointsIds: () => {readonly current: Ids};
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* The useCheckpointIds hook returns a reactive object reflecting the
|
|
1333
|
+
* CheckpointIds (backward, current, forward) in a Checkpoints object, and
|
|
1334
|
+
* registers a listener so that any changes will update `.current`.
|
|
1335
|
+
* @param checkpointsOrCheckpointsId The Checkpoints object to use (plain or
|
|
1336
|
+
* getter), or its Id.
|
|
1337
|
+
* @returns A reactive object with a `current` CheckpointIds property.
|
|
1338
|
+
* @category Hook
|
|
1339
|
+
* @since v8.1.0
|
|
1340
|
+
*/
|
|
1341
|
+
useCheckpointIds: (
|
|
1342
|
+
checkpointsOrCheckpointsId?: Checkpoints<Schemas> | Id,
|
|
1343
|
+
) => {readonly current: CheckpointIds};
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* The useCheckpoint hook returns a reactive object reflecting the label of a
|
|
1347
|
+
* checkpoint, and registers a listener so that any changes will update
|
|
1348
|
+
* `.current`.
|
|
1349
|
+
* @param checkpointId The Id of the checkpoint (or a getter returning it).
|
|
1350
|
+
* @param checkpointsOrCheckpointsId The Checkpoints object to use (plain or
|
|
1351
|
+
* getter), or its Id.
|
|
1352
|
+
* @returns A reactive object with a `current` string | undefined property.
|
|
1353
|
+
* @category Hook
|
|
1354
|
+
* @since v8.1.0
|
|
1355
|
+
*/
|
|
1356
|
+
useCheckpoint: (
|
|
1357
|
+
checkpointId: Id | (() => Id),
|
|
1358
|
+
checkpointsOrCheckpointsId?: Checkpoints<Schemas> | Id,
|
|
1359
|
+
) => {readonly current: string | undefined};
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* The useGoBackwardCallback hook returns a callback function that, when called,
|
|
1363
|
+
* moves the Checkpoints object backward to the previous checkpoint.
|
|
1364
|
+
* @param checkpointsOrCheckpointsId The Checkpoints object to use, or its Id.
|
|
1365
|
+
* @returns A callback function.
|
|
1366
|
+
* @category Hook
|
|
1367
|
+
* @since v8.1.0
|
|
1368
|
+
*/
|
|
1369
|
+
useGoBackwardCallback: (
|
|
1370
|
+
checkpointsOrCheckpointsId?:
|
|
1371
|
+
| Checkpoints<Schemas>
|
|
1372
|
+
| Id
|
|
1373
|
+
| (() => Checkpoints<Schemas> | Id | undefined),
|
|
1374
|
+
) => () => void;
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* The useGoForwardCallback hook returns a callback function that, when called,
|
|
1378
|
+
* moves the Checkpoints object forward to the next checkpoint.
|
|
1379
|
+
* @param checkpointsOrCheckpointsId The Checkpoints object to use, or its Id.
|
|
1380
|
+
* @returns A callback function.
|
|
1381
|
+
* @category Hook
|
|
1382
|
+
* @since v8.1.0
|
|
1383
|
+
*/
|
|
1384
|
+
useGoForwardCallback: (
|
|
1385
|
+
checkpointsOrCheckpointsId?:
|
|
1386
|
+
| Checkpoints<Schemas>
|
|
1387
|
+
| Id
|
|
1388
|
+
| (() => Checkpoints<Schemas> | Id | undefined),
|
|
1389
|
+
) => () => void;
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* The usePersister hook returns the default Persister from the current Provider
|
|
1393
|
+
* context (or a named one if an Id is provided).
|
|
1394
|
+
* @param id An optional Id of a named Persister in the Provider context.
|
|
1395
|
+
* @returns The Persister, or `undefined` if not found.
|
|
1396
|
+
* @category Hook
|
|
1397
|
+
* @since v8.1.0
|
|
1398
|
+
*/
|
|
1399
|
+
usePersister: (id?: Id) => AnyPersister<Schemas> | undefined;
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* The usePersisterIds hook returns a reactive object with the Ids of all
|
|
1403
|
+
* Persisters registered in the current Provider context.
|
|
1404
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1405
|
+
* @category Hook
|
|
1406
|
+
* @since v8.1.0
|
|
1407
|
+
*/
|
|
1408
|
+
usePersisterIds: () => {readonly current: Ids};
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* The usePersisterStatus hook returns a reactive object reflecting the status
|
|
1412
|
+
* of a Persister, and registers a listener so that any changes will update
|
|
1413
|
+
* `.current`.
|
|
1414
|
+
* @param persisterOrPersisterId The Persister to use, or its Id.
|
|
1415
|
+
* @returns A reactive object with a `current` Status property.
|
|
1416
|
+
* @category Hook
|
|
1417
|
+
* @since v8.1.0
|
|
1418
|
+
*/
|
|
1419
|
+
usePersisterStatus: (persisterOrPersisterId?: AnyPersister<Schemas> | Id) => {
|
|
1420
|
+
readonly current: Status;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* The useSynchronizer hook returns the default Synchronizer from the current
|
|
1425
|
+
* Provider context (or a named one if an Id is provided).
|
|
1426
|
+
* @param id An optional Id of a named Synchronizer in the Provider context.
|
|
1427
|
+
* @returns The Synchronizer, or `undefined` if not found.
|
|
1428
|
+
* @category Hook
|
|
1429
|
+
* @since v8.1.0
|
|
1430
|
+
*/
|
|
1431
|
+
useSynchronizer: (id?: Id) => Synchronizer<Schemas> | undefined;
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* The useSynchronizerIds hook returns a reactive object with the Ids of all
|
|
1435
|
+
* Synchronizers registered in the current Provider context.
|
|
1436
|
+
* @returns A reactive object with a `current` Ids property.
|
|
1437
|
+
* @category Hook
|
|
1438
|
+
* @since v8.1.0
|
|
1439
|
+
*/
|
|
1440
|
+
useSynchronizerIds: () => {readonly current: Ids};
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* The useSynchronizerStatus hook returns a reactive object reflecting the
|
|
1444
|
+
* status of a Synchronizer, and registers a listener so that any changes will
|
|
1445
|
+
* update `.current`.
|
|
1446
|
+
* @param synchronizerOrSynchronizerId The Synchronizer to use, or its Id.
|
|
1447
|
+
* @returns A reactive object with a `current` Status property.
|
|
1448
|
+
* @category Hook
|
|
1449
|
+
* @since v8.1.0
|
|
1450
|
+
*/
|
|
1451
|
+
useSynchronizerStatus: (
|
|
1452
|
+
synchronizerOrSynchronizerId?: Synchronizer<Schemas> | Id,
|
|
1453
|
+
) => {readonly current: Status};
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* The provideStore function registers a Store with a given Id into the current
|
|
1457
|
+
* Provider context, making it available to all descendant components.
|
|
1458
|
+
*
|
|
1459
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
1460
|
+
*
|
|
1461
|
+
* ```ts override
|
|
1462
|
+
* provideStore(storeId: Id, store: Store): void;
|
|
1463
|
+
* ```
|
|
1464
|
+
*
|
|
1465
|
+
* This function must be called inside a Svelte component's `<script>` block
|
|
1466
|
+
* that is a descendant of a Provider component.
|
|
1467
|
+
* @param storeId The Id to register the Store under.
|
|
1468
|
+
* @param store The Store to register.
|
|
1469
|
+
* @category Provider
|
|
1470
|
+
* @since v8.1.0
|
|
1471
|
+
*/
|
|
1472
|
+
provideStore: (storeId: Id, store: Store<Schemas>) => void;
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* The provideMetrics function registers a Metrics object with a given Id into
|
|
1476
|
+
* the current Provider context.
|
|
1477
|
+
* @param metricsId The Id to register the Metrics object under.
|
|
1478
|
+
* @param metrics The Metrics object to register.
|
|
1479
|
+
* @category Provider
|
|
1480
|
+
* @since v8.1.0
|
|
1481
|
+
*/
|
|
1482
|
+
provideMetrics: (metricsId: Id, metrics: Metrics<Schemas>) => void;
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* The provideIndexes function registers an Indexes object with a given Id into
|
|
1486
|
+
* the current Provider context.
|
|
1487
|
+
* @param indexesId The Id to register the Indexes object under.
|
|
1488
|
+
* @param indexes The Indexes object to register.
|
|
1489
|
+
* @category Provider
|
|
1490
|
+
* @since v8.1.0
|
|
1491
|
+
*/
|
|
1492
|
+
provideIndexes: (indexesId: Id, indexes: Indexes<Schemas>) => void;
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* The provideRelationships function registers a Relationships object with a
|
|
1496
|
+
* given Id into the current Provider context.
|
|
1497
|
+
* @param relationshipsId The Id to register the Relationships object under.
|
|
1498
|
+
* @param relationships The Relationships object to register.
|
|
1499
|
+
* @category Provider
|
|
1500
|
+
* @since v8.1.0
|
|
1501
|
+
*/
|
|
1502
|
+
provideRelationships: (
|
|
1503
|
+
relationshipsId: Id,
|
|
1504
|
+
relationships: Relationships<Schemas>,
|
|
1505
|
+
) => void;
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* The provideQueries function registers a Queries object with a given Id into
|
|
1509
|
+
* the current Provider context.
|
|
1510
|
+
* @param queriesId The Id to register the Queries object under.
|
|
1511
|
+
* @param queries The Queries object to register.
|
|
1512
|
+
* @category Provider
|
|
1513
|
+
* @since v8.1.0
|
|
1514
|
+
*/
|
|
1515
|
+
provideQueries: (queriesId: Id, queries: Queries<Schemas>) => void;
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* The provideCheckpoints function registers a Checkpoints object with a given
|
|
1519
|
+
* Id into the current Provider context.
|
|
1520
|
+
* @param checkpointsId The Id to register the Checkpoints object under.
|
|
1521
|
+
* @param checkpoints The Checkpoints object to register.
|
|
1522
|
+
* @category Provider
|
|
1523
|
+
* @since v8.1.0
|
|
1524
|
+
*/
|
|
1525
|
+
provideCheckpoints: (
|
|
1526
|
+
checkpointsId: Id,
|
|
1527
|
+
checkpoints: Checkpoints<Schemas>,
|
|
1528
|
+
) => void;
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* The providePersister function registers a Persister with a given Id into the
|
|
1532
|
+
* current Provider context.
|
|
1533
|
+
* @param persisterId The Id to register the Persister under.
|
|
1534
|
+
* @param persister The Persister to register.
|
|
1535
|
+
* @category Provider
|
|
1536
|
+
* @since v8.1.0
|
|
1537
|
+
*/
|
|
1538
|
+
providePersister: (persisterId: Id, persister: AnyPersister<Schemas>) => void;
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* The provideSynchronizer function registers a Synchronizer with a given Id
|
|
1542
|
+
* into the current Provider context.
|
|
1543
|
+
* @param synchronizerId The Id to register the Synchronizer under.
|
|
1544
|
+
* @param synchronizer The Synchronizer to register.
|
|
1545
|
+
* @category Provider
|
|
1546
|
+
* @since v8.1.0
|
|
1547
|
+
*/
|
|
1548
|
+
provideSynchronizer: (
|
|
1549
|
+
synchronizerId: Id,
|
|
1550
|
+
synchronizer: Synchronizer<Schemas>,
|
|
1551
|
+
) => void;
|
|
1552
|
+
};
|