tinybase 8.2.0-beta.0 → 8.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/@types/persisters/index.d.ts +1 -1
  2. package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +6 -6
  3. package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +6 -6
  4. package/@types/persisters/persister-durable-object-storage/index.d.ts +2 -2
  5. package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.ts +2 -2
  6. package/@types/persisters/persister-electric-sql/index.d.ts +3 -3
  7. package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +3 -3
  8. package/@types/persisters/persister-expo-sqlite/index.d.ts +3 -3
  9. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +3 -3
  10. package/@types/persisters/persister-file/index.d.ts +1 -1
  11. package/@types/persisters/persister-file/with-schemas/index.d.ts +1 -1
  12. package/@types/persisters/persister-libsql/index.d.ts +3 -3
  13. package/@types/persisters/persister-libsql/with-schemas/index.d.ts +3 -3
  14. package/@types/persisters/persister-partykit-client/index.d.ts +2 -2
  15. package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +2 -2
  16. package/@types/persisters/persister-powersync/index.d.ts +3 -3
  17. package/@types/persisters/persister-powersync/with-schemas/index.d.ts +3 -3
  18. package/@types/persisters/persister-react-native-mmkv/index.d.ts +2 -2
  19. package/@types/persisters/persister-react-native-mmkv/with-schemas/index.d.ts +2 -2
  20. package/@types/persisters/persister-react-native-sqlite/index.d.ts +3 -3
  21. package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +3 -3
  22. package/@types/persisters/persister-remote/index.d.ts +1 -1
  23. package/@types/persisters/persister-remote/with-schemas/index.d.ts +1 -1
  24. package/@types/persisters/with-schemas/index.d.ts +1 -1
  25. package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +7 -7
  26. package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +7 -7
  27. package/@types/ui-react/index.d.ts +3 -3
  28. package/@types/ui-react/with-schemas/index.d.ts +3 -3
  29. package/@types/ui-react-dom/index.d.ts +52 -13
  30. package/@types/ui-react-dom/with-schemas/index.d.ts +52 -13
  31. package/@types/ui-react-inspector/index.d.ts +7 -4
  32. package/@types/ui-react-inspector/with-schemas/index.d.ts +7 -4
  33. package/@types/ui-svelte-dom/index.d.ts +2139 -0
  34. package/@types/ui-svelte-dom/with-schemas/index.d.ts +2186 -0
  35. package/@types/ui-svelte-inspector/index.d.ts +73 -0
  36. package/@types/ui-svelte-inspector/with-schemas/index.d.ts +73 -0
  37. package/agents.md +23 -12
  38. package/min/ui-react-inspector/index.js +1 -1
  39. package/min/ui-react-inspector/index.js.gz +0 -0
  40. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  41. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  42. package/min/ui-svelte-dom/index.js +1 -0
  43. package/min/ui-svelte-dom/index.js.gz +0 -0
  44. package/min/ui-svelte-dom/with-schemas/index.js +1 -0
  45. package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
  46. package/min/ui-svelte-inspector/index.js +1 -0
  47. package/min/ui-svelte-inspector/index.js.gz +0 -0
  48. package/min/ui-svelte-inspector/with-schemas/index.js +1 -0
  49. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  50. package/package.json +85 -13
  51. package/readme.md +14 -14
  52. package/releases.md +101 -67
  53. package/ui-react-inspector/index.js +4676 -4657
  54. package/ui-react-inspector/with-schemas/index.js +4676 -4657
  55. package/ui-svelte/index.js +1 -1
  56. package/ui-svelte/with-schemas/index.js +1 -1
  57. package/ui-svelte-dom/index.js +2441 -0
  58. package/ui-svelte-dom/with-schemas/index.js +2441 -0
  59. package/ui-svelte-inspector/index.js +7680 -0
  60. package/ui-svelte-inspector/with-schemas/index.js +7680 -0
@@ -0,0 +1,2186 @@
1
+ /**
2
+ * The ui-svelte-dom module of the TinyBase project provides components to make
3
+ * it easy to create web-based reactive apps with Store objects.
4
+ *
5
+ * The components in this module use the Svelte DOM runtime and so are not
6
+ * appropriate for environments like Svelte-native-like (although those in the
7
+ * lower-level ui-svelte module are).
8
+ * @see UI Components (Svelte) demos
9
+ * @packageDocumentation
10
+ * @module ui-svelte-dom
11
+ * @since v4.1.0
12
+ */
13
+ import type {Component} from 'svelte';
14
+ import type {
15
+ CellIdFromSchema,
16
+ TableIdFromSchema,
17
+ } from '../../_internal/store/with-schemas/index.d.ts';
18
+ import type {
19
+ CellProps,
20
+ CellPropsForTableIdAndCellId,
21
+ ResultCellProps,
22
+ RowProps,
23
+ ValueProps,
24
+ } from '../../_internal/ui-react/with-schemas/index.d.ts';
25
+ import type {
26
+ IndexesOrIndexesId,
27
+ QueriesOrQueriesId,
28
+ RelationshipsOrRelationshipsId,
29
+ StoreOrStoreId,
30
+ } from '../../_internal/ui/with-schemas/index.d.ts';
31
+ import type {Id, Ids} from '../../common/with-schemas/index.d.ts';
32
+ import type {NoSchemas} from '../../store/index.d.ts';
33
+ import type {OptionalSchemas} from '../../store/with-schemas/index.d.ts';
34
+
35
+ /**
36
+ * The CustomCell object is used to configure custom cell rendering in an HTML
37
+ * table.
38
+ * @category Configuration
39
+ * @since v4.1.0
40
+ */
41
+ export type CustomCell<
42
+ Schemas extends OptionalSchemas,
43
+ TableId extends TableIdFromSchema<Schemas[0]>,
44
+ CellId extends CellIdFromSchema<Schemas[0], TableId>,
45
+ > = {
46
+ /**
47
+ * An optional string that will be used as the label at the top of the table
48
+ * column for this Cell.
49
+ * @category Prop
50
+ * @since v4.1.0
51
+ */
52
+ label?: string;
53
+ /**
54
+ * An optional custom component for rendering each Cell in the Table (to
55
+ * override the default CellView component).
56
+ * @category Prop
57
+ * @since v4.1.0
58
+ */
59
+ component?: Component<CellPropsForTableIdAndCellId<Schemas, TableId, CellId>>;
60
+ /**
61
+ * An optional function for generating extra props for each custom Cell
62
+ * component based on Row and Cell Id.
63
+ * @category Prop
64
+ * @since v4.1.0
65
+ */
66
+ getComponentProps?: (rowId: Id, cellId: CellId) => {[prop: string]: any};
67
+ };
68
+
69
+ /**
70
+ * The CustomResultCell object is used to configure custom cell rendering for
71
+ * query results in an HTML table.
72
+ * @category Configuration
73
+ * @since v4.1.0
74
+ */
75
+ export type CustomResultCell<Schemas extends OptionalSchemas> = {
76
+ /**
77
+ * An optional string that will be used as the label at the top of the table
78
+ * column for this Cell.
79
+ * @category Prop
80
+ * @since v4.1.0
81
+ */
82
+ label?: string;
83
+ /**
84
+ * An optional custom component for rendering each Cell in the ResultTable (to
85
+ * override the default ResultCellView component).
86
+ * @category Prop
87
+ * @since v4.1.0
88
+ */
89
+ component?: Component<ResultCellProps<Schemas>>;
90
+ /**
91
+ * An optional function for generating extra props for each custom Cell
92
+ * component based on Row and Cell Id.
93
+ * @category Prop
94
+ * @since v4.1.0
95
+ */
96
+ getComponentProps?: (rowId: Id, cellId: Id) => {[prop: string]: any};
97
+ };
98
+
99
+ /**
100
+ * The ExtraRowCell object is used to configure the rendering of extra cells in
101
+ * an HTML table that's displaying a ResultTable or Table - before or after the
102
+ * regular data cells.
103
+ * @category Configuration
104
+ * @since v6.6.0
105
+ */
106
+ export type ExtraRowCell<
107
+ Schemas extends OptionalSchemas,
108
+ TableId extends TableIdFromSchema<Schemas[0]>,
109
+ > = {
110
+ /**
111
+ * A string that will be used as the label at the top of the column for this
112
+ * Cell.
113
+ * @category Prop
114
+ * @since v6.6.0
115
+ */
116
+ label: string;
117
+ /**
118
+ * A custom component for rendering each extra Cell in the table, and which
119
+ * will be passed props for the Row with which it is placed.
120
+ * @category Prop
121
+ * @since v6.6.0
122
+ */
123
+ component: Component<RowProps<Schemas, TableId>>;
124
+ };
125
+
126
+ /**
127
+ * The ExtraValueCell object is used to configure the rendering of extra cells
128
+ * in an HTML table that's displaying Values - before or after the regular data
129
+ * cells.
130
+ * @category Configuration
131
+ * @since v6.6.0
132
+ */
133
+ export type ExtraValueCell<Schemas extends OptionalSchemas> = {
134
+ /**
135
+ * A string that will be used as the label at the top of the column for this
136
+ * Cell.
137
+ * @category Prop
138
+ * @since v6.6.0
139
+ */
140
+ label: string;
141
+ /**
142
+ * A custom component for rendering each extra Cell in the table, and which
143
+ * will be passed props for the Value with which it is placed.
144
+ * @category Prop
145
+ * @since v6.6.0
146
+ */
147
+ component: Component<ValueProps<Schemas>>;
148
+ };
149
+
150
+ /**
151
+ * HtmlTableProps props are used for components that will render in an HTML
152
+ * table, such as the TableInHtmlTable component or SortedTableInHtmlTable
153
+ * component.
154
+ * @category Props
155
+ * @since v4.1.0
156
+ */
157
+ export type HtmlTableProps = {
158
+ /**
159
+ * A string className to use on the root of the resulting element.
160
+ * @category Prop
161
+ * @since v4.1.0
162
+ */
163
+ readonly className?: string;
164
+ /**
165
+ * Whether a header row should be rendered at the top of the table, defaulting
166
+ * to `true`.
167
+ * @category Prop
168
+ * @since v4.1.0
169
+ */
170
+ readonly headerRow?: boolean;
171
+ /**
172
+ * Whether an Id column should be rendered on the left of the table,
173
+ * defaulting to `true`.
174
+ * @category Prop
175
+ * @since v4.1.0
176
+ */
177
+ readonly idColumn?: boolean;
178
+ };
179
+
180
+ /**
181
+ * TableInHtmlTableProps props are used for components that will render a Table
182
+ * in an HTML table, such as the TableInHtmlTable component.
183
+ * @category Props
184
+ * @since v4.1.0
185
+ */
186
+ export type TableInHtmlTableProps<
187
+ Schemas extends OptionalSchemas,
188
+ TableIds extends TableIdFromSchema<Schemas[0]> = TableIdFromSchema<
189
+ Schemas[0]
190
+ >,
191
+ > = TableIds extends infer TableId
192
+ ? TableId extends TableIdFromSchema<Schemas[0]>
193
+ ? {
194
+ /**
195
+ * The Id of the Table in the Store to be rendered.
196
+ * @category Prop
197
+ * @since v4.1.0
198
+ */
199
+ readonly tableId: TableId;
200
+ /**
201
+ * The Store to be accessed: omit for the default context Store, provide an Id
202
+ * for a named context Store, or provide an explicit reference.
203
+ * @category Prop
204
+ * @since v4.1.0
205
+ */
206
+ readonly store?: StoreOrStoreId<Schemas>;
207
+ /**
208
+ * Whether the Cells should be editable. This affects the default CellView
209
+ * component (to use the EditableCellView component instead) but of course
210
+ * will not affect custom Cell components if you have set them.
211
+ * @category Prop
212
+ * @since v4.1.0
213
+ */
214
+ readonly editable?: boolean;
215
+ /**
216
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
217
+ * Table's Cells in a given order. This can also be an object with the desired
218
+ * Cell Ids as keys, and with a value that can either be a string label to
219
+ * show in the column header, or a CustomCell object to further configure the
220
+ * column.
221
+ * @category Prop
222
+ * @since v4.1.0
223
+ */
224
+ readonly customCells?:
225
+ | CellIdFromSchema<Schemas[0], TableId>[]
226
+ | {
227
+ [CellId in CellIdFromSchema<Schemas[0], TableId>]?:
228
+ | string
229
+ | CustomCell<Schemas, TableId, CellId>;
230
+ };
231
+ }
232
+ : never
233
+ : never;
234
+
235
+ /**
236
+ * SortedTableInHtmlTableProps props are used for components that will render a
237
+ * sorted Table in an HTML table, such as the SortedTableInHtmlTable component.
238
+ * @category Props
239
+ * @since v4.1.0
240
+ */
241
+ export type SortedTableInHtmlTableProps<
242
+ Schemas extends OptionalSchemas,
243
+ TableIds extends TableIdFromSchema<Schemas[0]> = TableIdFromSchema<
244
+ Schemas[0]
245
+ >,
246
+ > = TableIds extends infer TableId
247
+ ? TableId extends TableIdFromSchema<Schemas[0]>
248
+ ? {
249
+ /**
250
+ * The Id of the Table in the Store to be rendered.
251
+ * @category Prop
252
+ * @since v4.1.0
253
+ */
254
+ readonly tableId: TableId;
255
+ /**
256
+ * The Id of the Cell whose values are used for the sorting. If omitted, the
257
+ * view will sort the Row Id itself.
258
+ * @category Prop
259
+ * @since v4.1.0
260
+ */
261
+ readonly cellId?: CellIdFromSchema<Schemas[0], TableId>;
262
+ /**
263
+ * Whether the sorting should be in descending order.
264
+ * @category Prop
265
+ * @since v4.1.0
266
+ */
267
+ readonly descending?: boolean;
268
+ /**
269
+ * The number of Row Ids to skip for pagination purposes.
270
+ * @category Prop
271
+ * @since v4.1.0
272
+ */
273
+ readonly offset?: number;
274
+ /**
275
+ * The maximum number of Row Ids to return.
276
+ * @category Prop
277
+ * @since v4.1.0
278
+ */
279
+ readonly limit?: number;
280
+ /**
281
+ * The Store to be accessed: omit for the default context Store, provide an Id
282
+ * for a named context Store, or provide an explicit reference.
283
+ * @category Prop
284
+ * @since v4.1.0
285
+ */
286
+ readonly store?: StoreOrStoreId<Schemas>;
287
+ /**
288
+ * Whether the Cells should be editable. This affects the default CellView
289
+ * component (to use the EditableCellView component instead) but of course
290
+ * will not affect custom Cell components if you have set them.
291
+ * @category Prop
292
+ * @since v4.1.0
293
+ */
294
+ readonly editable?: boolean;
295
+ /**
296
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
297
+ * Table's Cells in a given order. This can also be an object with the desired
298
+ * Cell Ids as keys, and with a value that can either be a string label to
299
+ * show in the column header, or a CustomCell object to further configure the
300
+ * column.
301
+ * @category Prop
302
+ * @since v4.1.0
303
+ */
304
+ readonly customCells?:
305
+ | CellIdFromSchema<Schemas[0], TableId>[]
306
+ | {
307
+ [CellId in CellIdFromSchema<Schemas[0], TableId>]?:
308
+ | string
309
+ | CustomCell<Schemas, TableId, CellId>;
310
+ };
311
+ /**
312
+ * Whether the table should be interactive such that clicking a header changes
313
+ * the sorting and/or direction.
314
+ * @category Prop
315
+ * @since v4.1.0
316
+ */
317
+ readonly sortOnClick?: boolean;
318
+ /**
319
+ * Either `true` to show the default SortedTablePaginator for the Table, or
320
+ * provide your own paginator component that takes SortedTablePaginatorProps.
321
+ * @category Prop
322
+ * @since v4.1.0
323
+ */
324
+ readonly paginator?: boolean | Component<SortedTablePaginatorProps>;
325
+ /**
326
+ * A function that is called whenever the sorting or pagination of the Table
327
+ * is changed by the user, invoked with the sorted Cell Id, whether descending
328
+ * or not, and the offset of the pagination.
329
+ * @category Prop
330
+ * @since v4.1.0
331
+ */
332
+ readonly onChange?: (
333
+ sortAndOffset: [
334
+ cellId: CellIdFromSchema<Schemas[0], TableId> | undefined,
335
+ descending: boolean,
336
+ offset: number,
337
+ ],
338
+ ) => void;
339
+ }
340
+ : never
341
+ : never;
342
+
343
+ /**
344
+ * ValuesInHtmlTableProps props are used for components that will render Values
345
+ * in an HTML table, such as the ValuesInHtmlTable component.
346
+ * @category Props
347
+ * @since v4.1.0
348
+ */
349
+ export type ValuesInHtmlTableProps<Schemas extends OptionalSchemas> = {
350
+ /**
351
+ * The Store to be accessed: omit for the default context Store, provide an Id
352
+ * for a named context Store, or provide an explicit reference.
353
+ * @category Prop
354
+ * @since v4.1.0
355
+ */
356
+ readonly store?: StoreOrStoreId<Schemas>;
357
+ /**
358
+ * Whether the Values should be editable. This affects the default ValueView
359
+ * component (to use the EditableValueView component instead) but of course
360
+ * will not affect a custom valueComponent if you have set one.
361
+ * @category Prop
362
+ * @since v4.1.0
363
+ */
364
+ readonly editable?: boolean;
365
+ /**
366
+ * A custom component for rendering each Value in the Store (to override the
367
+ * default ValueView component).
368
+ * @category Prop
369
+ * @since v4.1.0
370
+ */
371
+ readonly valueComponent?: Component<ValueProps<Schemas>>;
372
+ /**
373
+ * A function for generating extra props for each custom Value component based
374
+ * on its Id.
375
+ * @category Prop
376
+ * @since v4.1.0
377
+ */
378
+ readonly getValueComponentProps?: (valueId: Id) => {[prop: string]: any};
379
+ };
380
+
381
+ /**
382
+ * SliceInHtmlTableProps props are used for components that will render an Index
383
+ * Slice in an HTML table, such as the SliceInHtmlTable component.
384
+ * @category Props
385
+ * @since v4.1.0
386
+ */
387
+ export type SliceInHtmlTableProps<Schemas extends OptionalSchemas> = {
388
+ /**
389
+ * The Id of the Index in the Indexes object.
390
+ * @category Prop
391
+ * @since v4.1.0
392
+ */
393
+ readonly indexId: Id;
394
+ /**
395
+ * The Id of the Slice in the Index to be rendered.
396
+ * @category Prop
397
+ * @since v4.1.0
398
+ */
399
+ readonly sliceId: Id;
400
+ /**
401
+ * The Indexes object to be accessed: omit for the default context Indexes
402
+ * object, provide an Id for a named context Indexes object, or provide an
403
+ * explicit reference.
404
+ * @category Prop
405
+ * @since v4.1.0
406
+ */
407
+ readonly indexes?: IndexesOrIndexesId<Schemas>;
408
+ /**
409
+ * Whether the Cells should be editable. This affects the default CellView
410
+ * component (to use the EditableCellView component instead) but of course
411
+ * will not affect custom Cell components if you have set them.
412
+ * @category Prop
413
+ * @since v4.1.0
414
+ */
415
+ readonly editable?: boolean;
416
+ /**
417
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
418
+ * Slice's Cells in a given order. This can also be an object with the desired
419
+ * Cell Ids as keys, and with a value that can either be a string label to
420
+ * show in the column header, or a CustomCell object to further configure the
421
+ * column.
422
+ * @category Prop
423
+ * @since v4.1.0
424
+ */
425
+ readonly customCells?:
426
+ | Ids
427
+ | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
428
+ };
429
+
430
+ /**
431
+ * RelationshipInHtmlTableProps props are used for components that will render
432
+ * the contents of the two Tables linked by a Relationship as an HTML table,
433
+ * such as the RelationshipInHtmlTable component.
434
+ *
435
+ * Note the use of dotted 'tableId.cellId' string pairs when specifying custom
436
+ * rendering for the cells in this table, since Cells from both the
437
+ * relationship's 'local' and 'remote' Table objects can be rendered and need to
438
+ * be distinguished.
439
+ * @category Props
440
+ * @since v4.1.0
441
+ */
442
+ export type RelationshipInHtmlTableProps<Schemas extends OptionalSchemas> = {
443
+ /**
444
+ * The Id of the relationship in the Relationships object for which the
445
+ * relationship Table Rows will be rendered.
446
+ * @category Prop
447
+ * @since v4.1.0
448
+ */
449
+ readonly relationshipId: Id;
450
+ /**
451
+ * The Relationships object to be accessed: omit for the default context
452
+ * Relationships object, provide an Id for a named context Relationships
453
+ * object, or provide an explicit reference.
454
+ * @category Prop
455
+ * @since v4.1.0
456
+ */
457
+ readonly relationships?: RelationshipsOrRelationshipsId<Schemas>;
458
+ /**
459
+ * Whether the Cells should be editable. This affects the default CellView
460
+ * component (to use the EditableCellView component instead) but of course
461
+ * will not affect custom Cell components if you have set them.
462
+ * @category Prop
463
+ * @since v4.1.0
464
+ */
465
+ readonly editable?: boolean;
466
+ /**
467
+ * An optional list of dotted 'tableId.cellId' string pairs to use for
468
+ * rendering a prescribed set of the relationship Tables' Cells in a given
469
+ * order. This can also be an object with the desired 'tableId.cellId' string
470
+ * pairs as keys, and with a value that can either be a string label to show
471
+ * in the column header, or a CustomCell object to further configure the
472
+ * column.
473
+ * @category Prop
474
+ * @since v4.1.0
475
+ */
476
+ readonly customCells?:
477
+ | Ids
478
+ | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
479
+ };
480
+
481
+ /**
482
+ * ResultTableInHtmlTableProps props are used for components that will render a
483
+ * ResultTable in an HTML table, such as the ResultTableInHtmlTable component.
484
+ * @category Props
485
+ * @since v4.1.0
486
+ */
487
+ export type ResultTableInHtmlTableProps<Schemas extends OptionalSchemas> = {
488
+ /**
489
+ * The Id of the query in the Queries object for which the ResultTable will be
490
+ * rendered.
491
+ * @category Prop
492
+ * @since v4.1.0
493
+ */
494
+ readonly queryId: Id;
495
+ /**
496
+ * The Queries object to be accessed: omit for the default context Queries
497
+ * object, provide an Id for a named context Queries object, or provide an
498
+ * explicit reference.
499
+ * @category Prop
500
+ * @since v4.1.0
501
+ */
502
+ readonly queries?: QueriesOrQueriesId<Schemas>;
503
+ /**
504
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
505
+ * ResultTable's Cells in a given order. This can also be an object with the
506
+ * desired Cell Ids as keys, and with a value that can either be a string
507
+ * label to show in the column header, or a ResultCustomCell object to further
508
+ * configure the column.
509
+ * @category Prop
510
+ * @since v4.1.0
511
+ */
512
+ readonly customCells?:
513
+ | Ids
514
+ | {[cellId: Id]: string | CustomResultCell<Schemas>};
515
+ };
516
+
517
+ /**
518
+ * ResultSortedTableInHtmlTableProps props are used for components that will
519
+ * render a sorted Table in an HTML table, such as the SortedTableInHtmlTable
520
+ * component.
521
+ * @category Props
522
+ * @since v4.1.0
523
+ */
524
+ export type ResultSortedTableInHtmlTableProps<Schemas extends OptionalSchemas> =
525
+ {
526
+ /**
527
+ * The Id of the query in the Queries object for which the ResultTable will be
528
+ * rendered.
529
+ * @category Prop
530
+ * @since v4.1.0
531
+ */
532
+ readonly queryId: Id;
533
+ /**
534
+ * The Id of the Cell whose values are used for the sorting. If omitted, the
535
+ * view will sort the Row Id itself.
536
+ * @category Prop
537
+ * @since v4.1.0
538
+ */
539
+ readonly cellId?: Id;
540
+ /**
541
+ * Whether the sorting should be in descending order.
542
+ * @category Prop
543
+ * @since v4.1.0
544
+ */
545
+ readonly descending?: boolean;
546
+ /**
547
+ * The number of Row Ids to skip for pagination purposes.
548
+ * @category Prop
549
+ * @since v4.1.0
550
+ */
551
+ readonly offset?: number;
552
+ /**
553
+ * The maximum number of Row Ids to return.
554
+ * @category Prop
555
+ * @since v4.1.0
556
+ */
557
+ readonly limit?: number;
558
+ /**
559
+ * The Queries object to be accessed: omit for the default context Queries
560
+ * object, provide an Id for a named context Queries object, or provide an
561
+ * explicit reference.
562
+ * @category Prop
563
+ * @since v4.1.0
564
+ */
565
+ readonly queries?: QueriesOrQueriesId<Schemas>;
566
+ /**
567
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
568
+ * ResultTable's Cells in a given order. This can also be an object with the
569
+ * desired Cell Ids as keys, and with a value that can either be a string
570
+ * label to show in the column header, or a ResultCustomCell object to further
571
+ * configure the column.
572
+ * @category Prop
573
+ * @since v4.1.0
574
+ */
575
+ readonly customCells?:
576
+ | Ids
577
+ | {[cellId: Id]: string | CustomResultCell<Schemas>};
578
+ /**
579
+ * Whether the table should be interactive such that clicking a header changes
580
+ * the sorting and/or direction.
581
+ * @category Prop
582
+ * @since v4.1.0
583
+ */
584
+ readonly sortOnClick?: boolean;
585
+ /**
586
+ * Either `true` to show the default SortedTablePaginator for the ResultTable,
587
+ * or provide your own paginator component that takes
588
+ * SortedTablePaginatorProps.
589
+ * @category Prop
590
+ * @since v4.1.0
591
+ */
592
+ readonly paginator?: boolean | Component<SortedTablePaginatorProps>;
593
+ /**
594
+ * A function that is called whenever the sorting or pagination of the
595
+ * ResultTable is changed by the user, invoked with the sorted Cell Id,
596
+ * whether descending or not, and the offset of the pagination.
597
+ * @category Prop
598
+ * @since v4.1.0
599
+ */
600
+ readonly onChange?: (
601
+ sortAndOffset: [
602
+ cellId: Id | undefined,
603
+ descending: boolean,
604
+ offset: number,
605
+ ],
606
+ ) => void;
607
+ };
608
+
609
+ /**
610
+ * SortedTablePaginatorProps props are used for components that will be used as
611
+ * a table paginator, such as the SortedTablePaginator component.
612
+ * @category Props
613
+ * @since v4.1.0
614
+ */
615
+ export type SortedTablePaginatorProps = {
616
+ /**
617
+ * An event that will fire when the offset is updated, called with the new
618
+ * offset.
619
+ * @category Prop
620
+ * @since v4.1.0
621
+ */
622
+ readonly onChange: (offset: number) => void;
623
+ /**
624
+ * The number of Row Ids to skip for pagination.
625
+ * @category Prop
626
+ * @since v4.1.0
627
+ */
628
+ readonly offset?: number;
629
+ /**
630
+ * The maximum number of Row Ids being returned.
631
+ * @category Prop
632
+ * @since v4.1.0
633
+ */
634
+ readonly limit?: number;
635
+ /**
636
+ * The total number of Row Ids in the paginated table.
637
+ * @category Prop
638
+ * @since v4.1.0
639
+ */
640
+ readonly total: number;
641
+ /**
642
+ * A noun to use in the pagination label for a single row, defaulting to
643
+ * 'row'.
644
+ * @category Prop
645
+ * @since v4.1.0
646
+ */
647
+ readonly singular?: string;
648
+ /**
649
+ * A noun to use in the pagination label for multiple rows, defaulting to the
650
+ * value of the singular noun suffixed with the letter 's'.
651
+ * @category Prop
652
+ * @since v4.1.0
653
+ */
654
+ readonly plural?: string;
655
+ };
656
+
657
+ export type WithSchemas<Schemas extends OptionalSchemas> = {
658
+ /**
659
+ * The TableInHtmlTable component renders the contents of a single Table in a
660
+ * Store as an HTML <table> element, and registers a listener so that any
661
+ * changes to that result will cause a re-render.
662
+ *
663
+ * This has schema-based typing. The following is a simplified representation:
664
+ *
665
+ * ```ts override
666
+ * export const TableInHtmlTable: Component<
667
+ * TableInHtmlTableProps & HtmlTableProps
668
+ * >;
669
+ * ```
670
+ *
671
+ * See the <TableInHtmlTable /> (Svelte) demo for this component in action:
672
+ *
673
+ * ![TableInHtmlTable example](/shots/tableinhtmltable-svelte-demo.png
674
+ * "TableInHtmlTable example")
675
+ *
676
+ * The component's props identify which Table to render based on Table Id, and
677
+ * Store (which is either the default context Store, a named context Store, or
678
+ * by explicit reference).
679
+ *
680
+ * This component renders a Table by iterating over its Row objects. By default
681
+ * the Cells are in turn rendered with the CellView component, but you can
682
+ * override this behavior by providing a `component` for each Cell in the
683
+ * `customCells` prop. You can pass additional props to that custom component
684
+ * with the `getComponentProps` callback. See the CustomCell type for more
685
+ * details.
686
+ *
687
+ * This component uses the useRowIds hook under the covers, which means that any
688
+ * changes to the structure of the Table will cause a re-render.
689
+ *
690
+ * You can use the `headerRow` and `idColumn` props to control whether the Ids
691
+ * appear in a <th> element at the top of the table, and the start of each row.
692
+ * @param props The props for this component.
693
+ * @returns A rendering of the Table in a <table> element.
694
+ * @example
695
+ * This example creates a Provider context into which a default Store is
696
+ * provided. The TableInHtmlTable component within it then renders the Table in
697
+ * a <table> element with a CSS class.
698
+ *
699
+ * ```svelte file=App.svelte
700
+ * <script>
701
+ * import {Provider} from 'tinybase/ui-svelte';
702
+ * import {TableInHtmlTable} from 'tinybase/ui-svelte-dom';
703
+ *
704
+ * export let store;
705
+ * </script>
706
+ *
707
+ * <Provider {store}>
708
+ * <TableInHtmlTable tableId="pets" className="table" />
709
+ * </Provider>
710
+ * ```
711
+ *
712
+ * ```ts
713
+ * import {flushSync, mount} from 'svelte';
714
+ * import {createStore} from 'tinybase';
715
+ * import App from './App.svelte';
716
+ *
717
+ * const store = createStore().setTable('pets', {
718
+ * fido: {species: 'dog'},
719
+ * felix: {species: 'cat'},
720
+ * });
721
+ * const app = document.body.appendChild(document.createElement('div'));
722
+ * flushSync(() => mount(App, {target: app, props: {store}}));
723
+ * console.log(app.innerHTML);
724
+ * // ->
725
+ * `
726
+ * <table class="table">
727
+ * <thead>
728
+ * <tr>
729
+ * <th>Id</th>
730
+ * <th>species</th>
731
+ * </tr>
732
+ * </thead>
733
+ * <tbody>
734
+ * <tr>
735
+ * <th title="fido">fido</th>
736
+ * <td>dog</td>
737
+ * </tr>
738
+ * <tr>
739
+ * <th title="felix">felix</th>
740
+ * <td>cat</td>
741
+ * </tr>
742
+ * </tbody>
743
+ * </table>
744
+ * `;
745
+ * ```
746
+ * @example
747
+ * This example creates a Provider context into which a default Store is
748
+ * provided. The TableInHtmlTable component within it then renders the Table
749
+ * with a custom component and a custom props callback for the `species` Cell.
750
+ * The header row at the top of the table and the Id column at the start of
751
+ * each row is removed.
752
+ *
753
+ * ```svelte file=FormattedCellView.svelte
754
+ * <script>
755
+ * import {CellView} from 'tinybase/ui-svelte';
756
+ *
757
+ * export let tableId;
758
+ * export let rowId;
759
+ * export let cellId;
760
+ * export let bold = false;
761
+ * </script>
762
+ *
763
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<CellView
764
+ * {tableId}
765
+ * {rowId}
766
+ * {cellId}
767
+ * />
768
+ * ```
769
+ *
770
+ * ```svelte file=App.svelte
771
+ * <script>
772
+ * import {Provider} from 'tinybase/ui-svelte';
773
+ * import {TableInHtmlTable} from 'tinybase/ui-svelte-dom';
774
+ * import FormattedCellView from './FormattedCellView.svelte';
775
+ *
776
+ * export let store;
777
+ *
778
+ * const customCells = {
779
+ * species: {
780
+ * component: FormattedCellView,
781
+ * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
782
+ * },
783
+ * };
784
+ * </script>
785
+ *
786
+ * <Provider {store}>
787
+ * <TableInHtmlTable
788
+ * tableId="pets"
789
+ * {customCells}
790
+ * headerRow={false}
791
+ * idColumn={false}
792
+ * />
793
+ * </Provider>
794
+ * ```
795
+ *
796
+ * ```ts
797
+ * import {flushSync, mount} from 'svelte';
798
+ * import {createStore} from 'tinybase';
799
+ * import App from './App.svelte';
800
+ *
801
+ * const store = createStore().setTable('pets', {
802
+ * fido: {species: 'dog'},
803
+ * felix: {species: 'cat'},
804
+ * });
805
+ * const app = document.body.appendChild(document.createElement('div'));
806
+ * flushSync(() => mount(App, {target: app, props: {store}}));
807
+ * console.log(app.innerHTML);
808
+ * // ->
809
+ * `
810
+ * <table>
811
+ * <tbody>
812
+ * <tr>
813
+ * <td><b>fido</b>:dog</td>
814
+ * </tr>
815
+ * <tr>
816
+ * <td>felix:cat</td>
817
+ * </tr>
818
+ * </tbody>
819
+ * </table>
820
+ * `;
821
+ * ```
822
+ * @category Store components
823
+ * @since v4.1.0
824
+ */
825
+ TableInHtmlTable: Component<TableInHtmlTableProps<Schemas> & HtmlTableProps>;
826
+
827
+ /**
828
+ * The SortedTableInHtmlTable component renders the contents of a single sorted
829
+ * Table in a Store, as an HTML <table> element, and registers a listener so
830
+ * that any changes to that result will cause a re-render.
831
+ *
832
+ * This has schema-based typing. The following is a simplified representation:
833
+ *
834
+ * ```ts override
835
+ * export const SortedTableInHtmlTable: Component<
836
+ * SortedTableInHtmlTableProps & HtmlTableProps
837
+ * >;
838
+ * ```
839
+ *
840
+ * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
841
+ * action:
842
+ *
843
+ * ![SortedTableInHtmlTable example](
844
+ * /shots/sortedtableinhtmltable-svelte-demo.png
845
+ * "SortedTableInHtmlTable example")
846
+ *
847
+ * The component's props identify which Table to render based on Table Id, and
848
+ * Store (which is either the default context Store, a named context Store, or
849
+ * by explicit reference). It also takes a Cell Id to sort by and a boolean to
850
+ * indicate that the sorting should be in descending order. The `offset` and
851
+ * `limit` props are used to paginate results, but default to `0` and
852
+ * `undefined` to return all available Row Ids if not specified.
853
+ *
854
+ * This component renders a ResultTable by iterating over its Row objects, in
855
+ * the order dictated by the sort parameters. By default the Cells are in turn
856
+ * rendered with the CellView component, but you can override this behavior by
857
+ * providing a `component` for each Cell in the `customCells` prop. You can pass
858
+ * additional props to that custom component with the `getComponentProps`
859
+ * callback. See the CustomCell type for more details.
860
+ *
861
+ * This component uses the useSortedRowIds hook under the covers, which means
862
+ * that any changes to the structure or sorting of the Table will cause a
863
+ * re-render.
864
+ *
865
+ * You can use the `headerRow` and `idColumn` props to control whether the Ids
866
+ * appear in a <th> element at the top of the table, and the start of each row.
867
+ *
868
+ * The `sortOnClick` prop makes the table's sorting interactive such that the
869
+ * user can click on a column heading to sort by that column. The style classes
870
+ * `sorted` and `ascending` (or `descending`) are added so that you can provide
871
+ * hints to the user how the sorting is being applied.
872
+ *
873
+ * Provide a paginator component for the Table with the `paginator` prop. Set to
874
+ * `true` to use the default SortedTablePaginator, or provide your own component
875
+ * that accepts SortedTablePaginatorProps.
876
+ *
877
+ * Finally, the `onChange` prop lets you listen to a user's changes to the
878
+ * Table's sorting or pagination.
879
+ * @param props The props for this component.
880
+ * @returns A rendering of the Table in a <table> element.
881
+ * @example
882
+ * This example creates a Provider context into which a default Store is
883
+ * provided. The SortedTableInHtmlTable component within it then renders the
884
+ * Table in a <table> element with a CSS class.
885
+ *
886
+ * ```svelte file=App.svelte
887
+ * <script>
888
+ * import {Provider} from 'tinybase/ui-svelte';
889
+ * import {SortedTableInHtmlTable} from 'tinybase/ui-svelte-dom';
890
+ *
891
+ * export let store;
892
+ * </script>
893
+ *
894
+ * <Provider {store}>
895
+ * <SortedTableInHtmlTable
896
+ * tableId="pets"
897
+ * cellId="species"
898
+ * className="table"
899
+ * />
900
+ * </Provider>
901
+ * ```
902
+ *
903
+ * ```ts
904
+ * import {flushSync, mount} from 'svelte';
905
+ * import {createStore} from 'tinybase';
906
+ * import App from './App.svelte';
907
+ *
908
+ * const store = createStore().setTables({
909
+ * pets: {
910
+ * fido: {species: 'dog'},
911
+ * felix: {species: 'cat'},
912
+ * },
913
+ * });
914
+ * const app = document.body.appendChild(document.createElement('div'));
915
+ * flushSync(() => mount(App, {target: app, props: {store}}));
916
+ * console.log(app.innerHTML);
917
+ * // ->
918
+ * `
919
+ * <table class="table">
920
+ * <thead>
921
+ * <tr>
922
+ * <th>Id</th>
923
+ * <th class="sorted ascending">↑ species</th>
924
+ * </tr>
925
+ * </thead>
926
+ * <tbody>
927
+ * <tr>
928
+ * <th title="felix">felix</th>
929
+ * <td>cat</td>
930
+ * </tr>
931
+ * <tr>
932
+ * <th title="fido">fido</th>
933
+ * <td>dog</td>
934
+ * </tr>
935
+ * </tbody>
936
+ * </table>
937
+ * `;
938
+ * ```
939
+ * @example
940
+ * This example creates a Provider context into which a default Store is
941
+ * provided. The SortedTableInHtmlTable component within it then renders the
942
+ * Table with a custom component and a custom props callback for the `species`
943
+ * Cell. The header row at the top of the table and the Id column at the start
944
+ * of each row is removed.
945
+ *
946
+ * ```svelte file=FormattedCellView.svelte
947
+ * <script>
948
+ * import {CellView} from 'tinybase/ui-svelte';
949
+ *
950
+ * export let tableId;
951
+ * export let rowId;
952
+ * export let cellId;
953
+ * export let bold = false;
954
+ * </script>
955
+ *
956
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<CellView
957
+ * {tableId}
958
+ * {rowId}
959
+ * {cellId}
960
+ * />
961
+ * ```
962
+ *
963
+ * ```svelte file=App.svelte
964
+ * <script>
965
+ * import {Provider} from 'tinybase/ui-svelte';
966
+ * import {SortedTableInHtmlTable} from 'tinybase/ui-svelte-dom';
967
+ * import FormattedCellView from './FormattedCellView.svelte';
968
+ *
969
+ * export let store;
970
+ *
971
+ * const customCells = {
972
+ * species: {
973
+ * component: FormattedCellView,
974
+ * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
975
+ * },
976
+ * };
977
+ * </script>
978
+ *
979
+ * <Provider {store}>
980
+ * <SortedTableInHtmlTable
981
+ * tableId="pets"
982
+ * cellId="species"
983
+ * {customCells}
984
+ * headerRow={false}
985
+ * idColumn={false}
986
+ * />
987
+ * </Provider>
988
+ * ```
989
+ *
990
+ * ```ts
991
+ * import {flushSync, mount} from 'svelte';
992
+ * import {createStore} from 'tinybase';
993
+ * import App from './App.svelte';
994
+ *
995
+ * const store = createStore().setTables({
996
+ * pets: {
997
+ * fido: {species: 'dog'},
998
+ * felix: {species: 'cat'},
999
+ * },
1000
+ * });
1001
+ * const app = document.body.appendChild(document.createElement('div'));
1002
+ * flushSync(() => mount(App, {target: app, props: {store}}));
1003
+ * console.log(app.innerHTML);
1004
+ * // ->
1005
+ * `
1006
+ * <table>
1007
+ * <tbody>
1008
+ * <tr>
1009
+ * <td>felix:cat</td>
1010
+ * </tr>
1011
+ * <tr>
1012
+ * <td><b>fido</b>:dog</td>
1013
+ * </tr>
1014
+ * </tbody>
1015
+ * </table>
1016
+ * `;
1017
+ * ```
1018
+ * @category Store components
1019
+ * @since v4.1.0
1020
+ */
1021
+ SortedTableInHtmlTable: Component<
1022
+ SortedTableInHtmlTableProps<Schemas> & HtmlTableProps
1023
+ >;
1024
+
1025
+ /**
1026
+ * The ValuesInHtmlTable component renders the keyed value contents of a Store
1027
+ * as an HTML <table> element, and registers a listener so that any changes to
1028
+ * that result will cause a re-render.
1029
+ *
1030
+ * This has schema-based typing. The following is a simplified representation:
1031
+ *
1032
+ * ```ts override
1033
+ * export const ValuesInHtmlTable: Component<
1034
+ * ValuesInHtmlTableProps & HtmlTableProps
1035
+ * >;
1036
+ * ```
1037
+ *
1038
+ * See the <ValuesInHtmlTable /> (Svelte) demo for this component in action:
1039
+ *
1040
+ * ![ValuesInHtmlTable example](/shots/valuesinhtmltable-svelte-demo.png
1041
+ * "ValuesInHtmlTable example")
1042
+ *
1043
+ * The component's props identify which Row to render based on Table Id, Row Id,
1044
+ * and Store (which is either the default context Store, a named context Store,
1045
+ * or an explicit reference).
1046
+ *
1047
+ * This component renders a Store by iterating over its Value objects. By
1048
+ * default the Values are in turn rendered with the ValueView component, but you
1049
+ * can override this behavior by providing a `valueComponent` prop, a custom
1050
+ * component of your own that will render a Value based on ValueProps. You can
1051
+ * also pass additional props to your custom component with the
1052
+ * `getValueComponentProps` callback prop.
1053
+ *
1054
+ * This component uses the useValueIds hook under the covers, which means that
1055
+ * any changes to the structure of the Values in the Store will cause a
1056
+ * re-render.
1057
+ *
1058
+ * You can use the `headerRow` and `idColumn` props to control whether labels
1059
+ * and Ids appear in a <th> element at the top of the table, and the start of
1060
+ * each row.
1061
+ * @param props The props for this component.
1062
+ * @returns A rendering of the Values in a <table> element.
1063
+ * @example
1064
+ * This example creates a Provider context into which a default Store is
1065
+ * provided. The ValuesInHtmlTable component within it then renders the Values
1066
+ * in a <table> element with a CSS class.
1067
+ *
1068
+ * ```svelte file=App.svelte
1069
+ * <script>
1070
+ * import {Provider} from 'tinybase/ui-svelte';
1071
+ * import {ValuesInHtmlTable} from 'tinybase/ui-svelte-dom';
1072
+ *
1073
+ * export let store;
1074
+ * </script>
1075
+ *
1076
+ * <Provider {store}>
1077
+ * <ValuesInHtmlTable className="values" />
1078
+ * </Provider>
1079
+ * ```
1080
+ *
1081
+ * ```ts
1082
+ * import {flushSync, mount} from 'svelte';
1083
+ * import {createStore} from 'tinybase';
1084
+ * import App from './App.svelte';
1085
+ *
1086
+ * const store = createStore().setValues({open: true, employees: 3});
1087
+ * const app = document.body.appendChild(document.createElement('div'));
1088
+ * flushSync(() => mount(App, {target: app, props: {store}}));
1089
+ * console.log(app.innerHTML);
1090
+ * // ->
1091
+ * `
1092
+ * <table class="values">
1093
+ * <thead>
1094
+ * <tr>
1095
+ * <th>Id</th>
1096
+ * <th>Value</th>
1097
+ * </tr>
1098
+ * </thead>
1099
+ * <tbody>
1100
+ * <tr>
1101
+ * <th title="open">open</th>
1102
+ * <td>true</td>
1103
+ * </tr>
1104
+ * <tr>
1105
+ * <th title="employees">employees</th>
1106
+ * <td>3</td>
1107
+ * </tr>
1108
+ * </tbody>
1109
+ * </table>
1110
+ * `;
1111
+ * ```
1112
+ * @example
1113
+ * This example creates a Provider context into which a default Store is
1114
+ * provided. The ValuesInHtmlTable component within it then renders the Values
1115
+ * with a custom component and a custom props callback. The header row at the
1116
+ * top of the table and the Id column at the start of each row is removed.
1117
+ *
1118
+ * ```svelte file=FormattedValueView.svelte
1119
+ * <script>
1120
+ * import {ValueView} from 'tinybase/ui-svelte';
1121
+ *
1122
+ * export let valueId;
1123
+ * export let bold = false;
1124
+ * </script>
1125
+ *
1126
+ * {#if bold}<b>{valueId}</b>{:else}{valueId}{/if}: <ValueView {valueId} />
1127
+ * ```
1128
+ *
1129
+ * ```svelte file=App.svelte
1130
+ * <script>
1131
+ * import {Provider} from 'tinybase/ui-svelte';
1132
+ * import {ValuesInHtmlTable} from 'tinybase/ui-svelte-dom';
1133
+ * import FormattedValueView from './FormattedValueView.svelte';
1134
+ *
1135
+ * export let store;
1136
+ *
1137
+ * const getBoldProp = (valueId) => ({bold: valueId == 'open'});
1138
+ * </script>
1139
+ *
1140
+ * <Provider {store}>
1141
+ * <ValuesInHtmlTable
1142
+ * valueComponent={FormattedValueView}
1143
+ * getValueComponentProps={getBoldProp}
1144
+ * headerRow={false}
1145
+ * idColumn={false}
1146
+ * />
1147
+ * </Provider>
1148
+ * ```
1149
+ *
1150
+ * ```ts
1151
+ * import {flushSync, mount} from 'svelte';
1152
+ * import {createStore} from 'tinybase';
1153
+ * import App from './App.svelte';
1154
+ *
1155
+ * const store = createStore().setValues({open: true, employees: 3});
1156
+ * const app = document.body.appendChild(document.createElement('div'));
1157
+ * flushSync(() => mount(App, {target: app, props: {store}}));
1158
+ * console.log(app.innerHTML);
1159
+ * // ->
1160
+ * `
1161
+ * <table>
1162
+ * <tbody>
1163
+ * <tr><td><b>open</b>: true</td></tr>
1164
+ * <tr><td>employees: 3</td></tr>
1165
+ * </tbody>
1166
+ * </table>
1167
+ * `;
1168
+ * ```
1169
+ * @category Store components
1170
+ * @since v4.1.0
1171
+ */
1172
+ ValuesInHtmlTable: Component<
1173
+ ValuesInHtmlTableProps<Schemas> & HtmlTableProps
1174
+ >;
1175
+
1176
+ /**
1177
+ * The SliceInHtmlTable component renders the contents of a Slice as an HTML
1178
+ * <table> element, and registers a listener so that any changes to that result
1179
+ * will cause a re-render.
1180
+ *
1181
+ * This has schema-based typing. The following is a simplified representation:
1182
+ *
1183
+ * ```ts override
1184
+ * export const SliceInHtmlTable: Component<
1185
+ * SliceInHtmlTableProps & HtmlTableProps
1186
+ * >;
1187
+ * ```
1188
+ *
1189
+ * See the <SliceInHtmlTable /> (Svelte) demo for this component in action:
1190
+ *
1191
+ * ![SliceInHtmlTable example](/shots/sliceinhtmltable-svelte-demo.png
1192
+ * "SliceInHtmlTable example")
1193
+ *
1194
+ * The component's props identify which Slice to render based on Index Id, Slice
1195
+ * Id, and Indexes object (which is either the default context Indexes object, a
1196
+ * named context Indexes object, or an explicit reference).
1197
+ *
1198
+ * This component renders a Slice by iterating over its Row objects. By default
1199
+ * the Cells are in turn rendered with the CellView component, but you can
1200
+ * override this behavior by providing a `component` for each Cell in the
1201
+ * `customCells` prop. You can pass additional props to that custom component
1202
+ * with the `getComponentProps` callback. See the CustomCell type for more
1203
+ * details.
1204
+ *
1205
+ * This component uses the useSliceRowIds hook under the covers, which means
1206
+ * that any changes to the structure of the Slice will cause a re-render.
1207
+ *
1208
+ * You can use the `headerRow` and `idColumn` props to control whether labels
1209
+ * and Ids appear in a <th> element at the top of the table, and the start of
1210
+ * each row.
1211
+ * @param props The props for this component.
1212
+ * @returns A rendering of the Slice in a <table> element.
1213
+ * @example
1214
+ * This example creates a Provider context into which a default Indexes object
1215
+ * is provided. The SliceInHtmlTable component within it then renders the Slice
1216
+ * in a <table> element with a CSS class.
1217
+ *
1218
+ * ```svelte file=App.svelte
1219
+ * <script>
1220
+ * import {Provider} from 'tinybase/ui-svelte';
1221
+ * import {SliceInHtmlTable} from 'tinybase/ui-svelte-dom';
1222
+ *
1223
+ * export let indexes;
1224
+ * </script>
1225
+ *
1226
+ * <Provider {indexes}>
1227
+ * <SliceInHtmlTable indexId="bySpecies" sliceId="dog" className="slice" />
1228
+ * </Provider>
1229
+ * ```
1230
+ *
1231
+ * ```ts
1232
+ * import {flushSync, mount} from 'svelte';
1233
+ * import {createIndexes, createStore} from 'tinybase';
1234
+ * import App from './App.svelte';
1235
+ *
1236
+ * const store = createStore().setTable('pets', {
1237
+ * fido: {species: 'dog'},
1238
+ * felix: {species: 'cat'},
1239
+ * cujo: {species: 'dog'},
1240
+ * });
1241
+ * const indexes = createIndexes(store);
1242
+ * indexes.setIndexDefinition('bySpecies', 'pets', 'species');
1243
+ * const app = document.body.appendChild(document.createElement('div'));
1244
+ * flushSync(() => mount(App, {target: app, props: {indexes}}));
1245
+ * console.log(app.innerHTML);
1246
+ * // ->
1247
+ * `
1248
+ * <table class="slice">
1249
+ * <thead>
1250
+ * <tr>
1251
+ * <th>Id</th>
1252
+ * <th>species</th>
1253
+ * </tr>
1254
+ * </thead>
1255
+ * <tbody>
1256
+ * <tr>
1257
+ * <th title="fido">fido</th>
1258
+ * <td>dog</td>
1259
+ * </tr>
1260
+ * <tr>
1261
+ * <th title="cujo">cujo</th>
1262
+ * <td>dog</td>
1263
+ * </tr>
1264
+ * </tbody>
1265
+ * </table>
1266
+ * `;
1267
+ * ```
1268
+ * @example
1269
+ * This example creates a Provider context into which a default Indexes object
1270
+ * is provided. The SliceInHtmlTable component within it then renders the Slice
1271
+ * with a custom component and a custom props callback for the `species` Cell.
1272
+ * The header row at the top of the table and the Id column at the start of
1273
+ * each row is removed.
1274
+ *
1275
+ * ```svelte file=FormattedCellView.svelte
1276
+ * <script>
1277
+ * import {CellView} from 'tinybase/ui-svelte';
1278
+ *
1279
+ * export let tableId;
1280
+ * export let rowId;
1281
+ * export let cellId;
1282
+ * export let bold = false;
1283
+ * </script>
1284
+ *
1285
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<CellView
1286
+ * {tableId}
1287
+ * {rowId}
1288
+ * {cellId}
1289
+ * />
1290
+ * ```
1291
+ *
1292
+ * ```svelte file=App.svelte
1293
+ * <script>
1294
+ * import {Provider} from 'tinybase/ui-svelte';
1295
+ * import {SliceInHtmlTable} from 'tinybase/ui-svelte-dom';
1296
+ * import FormattedCellView from './FormattedCellView.svelte';
1297
+ *
1298
+ * export let indexes;
1299
+ *
1300
+ * const customCells = {
1301
+ * species: {
1302
+ * component: FormattedCellView,
1303
+ * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1304
+ * },
1305
+ * };
1306
+ * </script>
1307
+ *
1308
+ * <Provider {indexes}>
1309
+ * <SliceInHtmlTable
1310
+ * indexId="bySpecies"
1311
+ * sliceId="dog"
1312
+ * {customCells}
1313
+ * headerRow={false}
1314
+ * idColumn={false}
1315
+ * />
1316
+ * </Provider>
1317
+ * ```
1318
+ *
1319
+ * ```ts
1320
+ * import {flushSync, mount} from 'svelte';
1321
+ * import {createIndexes, createStore} from 'tinybase';
1322
+ * import App from './App.svelte';
1323
+ *
1324
+ * const store = createStore().setTable('pets', {
1325
+ * fido: {species: 'dog', color: 'brown'},
1326
+ * felix: {species: 'cat'},
1327
+ * cujo: {species: 'dog'},
1328
+ * });
1329
+ * const indexes = createIndexes(store);
1330
+ * indexes.setIndexDefinition('bySpecies', 'pets', 'species');
1331
+ * const app = document.body.appendChild(document.createElement('div'));
1332
+ * flushSync(() => mount(App, {target: app, props: {indexes}}));
1333
+ * console.log(app.innerHTML);
1334
+ * // ->
1335
+ * `
1336
+ * <table>
1337
+ * <tbody>
1338
+ * <tr>
1339
+ * <td><b>fido</b>:</td>
1340
+ * </tr>
1341
+ * <tr>
1342
+ * <td>cujo:</td>
1343
+ * </tr>
1344
+ * </tbody>
1345
+ * </table>
1346
+ * `;
1347
+ * ```
1348
+ * @category Other components
1349
+ * @since v4.1.0
1350
+ */
1351
+ SliceInHtmlTable: Component<SliceInHtmlTableProps<Schemas> & HtmlTableProps>;
1352
+
1353
+ /**
1354
+ * The RelationshipInHtmlTable component renders the contents of the two Tables
1355
+ * linked by a Relationship as an HTML <table> element, and registers a listener
1356
+ * so that any changes to that result will cause a re-render.
1357
+ *
1358
+ * This has schema-based typing. The following is a simplified representation:
1359
+ *
1360
+ * ```ts override
1361
+ * export const RelationshipInHtmlTable: Component<
1362
+ * RelationshipInHtmlTableProps & HtmlTableProps
1363
+ * >;
1364
+ * ```
1365
+ *
1366
+ * See the <RelationshipInHtmlTable /> (Svelte) demo for this component in
1367
+ * action:
1368
+ *
1369
+ * ![RelationshipInHtmlTable example](
1370
+ * /shots/relationshipinhtmltable-svelte-demo.png
1371
+ * "RelationshipInHtmlTable example")
1372
+ *
1373
+ * The component's props identify which Relationship to render based on
1374
+ * Relationship Id and Relationships object (which is either the default context
1375
+ * Relationships object, a named context Relationships object, or an explicit
1376
+ * reference).
1377
+ *
1378
+ * This component renders the two Table objects by iterating over their related
1379
+ * Row objects. By default the Cells are in turn rendered with the CellView
1380
+ * component, but you can override this behavior by providing a `component` for
1381
+ * each Cell in the `customCells` prop. You can pass additional props to that
1382
+ * custom component with the `getComponentProps` callback. See the CustomCell
1383
+ * type for more details.
1384
+ *
1385
+ * Note the use of dotted 'tableId.cellId' string pairs when specifying custom
1386
+ * rendering for the cells in this table, since Cells from both the
1387
+ * relationship's 'local' and 'remote' Table objects can be rendered and need to
1388
+ * be distinguished.
1389
+ *
1390
+ * This component uses the useRowIds and useRemoteRowId hooks under the covers,
1391
+ * which means that any changes to the structure of either Table resulting in a
1392
+ * change to the relationship will cause a re-render.
1393
+ *
1394
+ * You can use the `headerRow` and `idColumn` props to control whether labels
1395
+ * and Ids appear in a <th> element at the top of the table, and the start of
1396
+ * each row.
1397
+ * @param props The props for this component.
1398
+ * @returns A rendering of the two Tables linked by a Relationship in a
1399
+ * <table> element.
1400
+ * @example
1401
+ * This example creates a Provider context into which a default Relationships
1402
+ * object is provided. The RelationshipInHtmlTable component within it then
1403
+ * renders the two Tables linked by a relationship in a <table> element with a
1404
+ * CSS class. Note the dotted pairs that are used as column headings.
1405
+ *
1406
+ * ```svelte file=App.svelte
1407
+ * <script>
1408
+ * import {Provider} from 'tinybase/ui-svelte';
1409
+ * import {RelationshipInHtmlTable} from 'tinybase/ui-svelte-dom';
1410
+ *
1411
+ * export let relationships;
1412
+ * </script>
1413
+ *
1414
+ * <Provider {relationships}>
1415
+ * <RelationshipInHtmlTable
1416
+ * relationshipId="petSpecies"
1417
+ * className="relationship"
1418
+ * />
1419
+ * </Provider>
1420
+ * ```
1421
+ *
1422
+ * ```ts
1423
+ * import {flushSync, mount} from 'svelte';
1424
+ * import {createRelationships, createStore} from 'tinybase';
1425
+ * import App from './App.svelte';
1426
+ *
1427
+ * const relationships = createRelationships(
1428
+ * createStore()
1429
+ * .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
1430
+ * .setTable('species', {wolf: {price: 10}, dog: {price: 5}}),
1431
+ * ).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
1432
+ * const app = document.body.appendChild(document.createElement('div'));
1433
+ * flushSync(() => mount(App, {target: app, props: {relationships}}));
1434
+ * console.log(app.innerHTML);
1435
+ * // ->
1436
+ * `
1437
+ * <table class="relationship">
1438
+ * <thead>
1439
+ * <tr>
1440
+ * <th>pets.Id</th>
1441
+ * <th>species.Id</th>
1442
+ * <th>pets.species</th>
1443
+ * <th>species.price</th>
1444
+ * </tr>
1445
+ * </thead>
1446
+ * <tbody>
1447
+ * <tr>
1448
+ * <th title="fido">fido</th>
1449
+ * <th title="dog">dog</th>
1450
+ * <td>dog</td>
1451
+ * <td>5</td>
1452
+ * </tr>
1453
+ * <tr>
1454
+ * <th title="cujo">cujo</th>
1455
+ * <th title="dog">dog</th>
1456
+ * <td>dog</td>
1457
+ * <td>5</td>
1458
+ * </tr>
1459
+ * </tbody>
1460
+ * </table>
1461
+ * `;
1462
+ * ```
1463
+ * @example
1464
+ * This example creates a Provider context into which a default Relationships
1465
+ * object is provided. The RelationshipInHtmlTable component within it then
1466
+ * renders the two Tables linked by a relationship with a custom component and
1467
+ * a custom props callback for the `species.price` Cell. The header row at the
1468
+ * top of the table and the Id column at the start of each row is removed.
1469
+ *
1470
+ * ```svelte file=FormattedCellView.svelte
1471
+ * <script>
1472
+ * import {CellView} from 'tinybase/ui-svelte';
1473
+ *
1474
+ * export let tableId;
1475
+ * export let rowId;
1476
+ * export let cellId;
1477
+ * export let store;
1478
+ * export let bold = false;
1479
+ * </script>
1480
+ *
1481
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<CellView
1482
+ * {tableId}
1483
+ * {rowId}
1484
+ * {cellId}
1485
+ * {store}
1486
+ * />
1487
+ * ```
1488
+ *
1489
+ * ```svelte file=App.svelte
1490
+ * <script>
1491
+ * import {Provider} from 'tinybase/ui-svelte';
1492
+ * import {RelationshipInHtmlTable} from 'tinybase/ui-svelte-dom';
1493
+ * import FormattedCellView from './FormattedCellView.svelte';
1494
+ *
1495
+ * export let relationships;
1496
+ *
1497
+ * const customCells = {
1498
+ * 'species.price': {
1499
+ * component: FormattedCellView,
1500
+ * getComponentProps: (rowId) => ({bold: rowId == 'dog'}),
1501
+ * },
1502
+ * };
1503
+ * </script>
1504
+ *
1505
+ * <Provider {relationships}>
1506
+ * <RelationshipInHtmlTable
1507
+ * relationshipId="petSpecies"
1508
+ * {customCells}
1509
+ * idColumn={false}
1510
+ * headerRow={false}
1511
+ * />
1512
+ * </Provider>
1513
+ * ```
1514
+ *
1515
+ * ```ts
1516
+ * import {flushSync, mount} from 'svelte';
1517
+ * import {createRelationships, createStore} from 'tinybase';
1518
+ * import App from './App.svelte';
1519
+ *
1520
+ * const relationships = createRelationships(
1521
+ * createStore()
1522
+ * .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'wolf'}})
1523
+ * .setTable('species', {wolf: {price: 10}, dog: {price: 5}}),
1524
+ * ).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
1525
+ * const app = document.body.appendChild(document.createElement('div'));
1526
+ * flushSync(() => mount(App, {target: app, props: {relationships}}));
1527
+ * console.log(app.innerHTML);
1528
+ * // ->
1529
+ * `
1530
+ * <table>
1531
+ * <tbody>
1532
+ * <tr>
1533
+ * <td><b>dog</b>:5</td>
1534
+ * </tr>
1535
+ * <tr>
1536
+ * <td>wolf:10</td>
1537
+ * </tr>
1538
+ * </tbody>
1539
+ * </table>
1540
+ * `;
1541
+ * ```
1542
+ * @category Other components
1543
+ * @since v4.1.0
1544
+ */
1545
+ RelationshipInHtmlTable: Component<
1546
+ RelationshipInHtmlTableProps<Schemas> & HtmlTableProps
1547
+ >;
1548
+
1549
+ /**
1550
+ * The ResultTableInHtmlTable component renders the contents of a single query's
1551
+ * ResultTable in a Queries object as an HTML <table> element, and registers a
1552
+ * listener so that any changes to that result will cause a re-render.
1553
+ *
1554
+ * This has schema-based typing. The following is a simplified representation:
1555
+ *
1556
+ * ```ts override
1557
+ * export const ResultTableInHtmlTable: Component<
1558
+ * ResultTableInHtmlTableProps & HtmlTableProps
1559
+ * >;
1560
+ * ```
1561
+ *
1562
+ * See the <ResultTableInHtmlTable /> (Svelte) demo for this component in
1563
+ * action:
1564
+ *
1565
+ * ![ResultTableInHtmlTable example](
1566
+ * /shots/resulttableinhtmltable-svelte-demo.png
1567
+ * "ResultTableInHtmlTable example")
1568
+ *
1569
+ * The component's props identify which ResultTable to render based on query Id,
1570
+ * and Queries object (which is either the default context Queries object, a
1571
+ * named context Queries object, or by explicit reference).
1572
+ *
1573
+ * This component renders a ResultTable by iterating over its Row objects. By
1574
+ * default the Cells are in turn rendered with the CellView component, but you
1575
+ * can override this behavior by providing a `component` for each Cell in the
1576
+ * `customCells` prop. You can pass additional props to that custom component
1577
+ * with the `getComponentProps` callback. See the ResultCustomCell type for more
1578
+ * details.
1579
+ *
1580
+ * This component uses the useRowIds hook under the covers, which means that any
1581
+ * changes to the structure of the Table will cause a re-render.
1582
+ *
1583
+ * You can use the `headerRow` and `idColumn` props to control whether the Ids
1584
+ * appear in a <th> element at the top of the table, and the start of each row.
1585
+ * @param props The props for this component.
1586
+ * @returns A rendering of the ResultTable in a <table> element.
1587
+ * @example
1588
+ * This example creates a Provider context into which a default Queries object
1589
+ * is provided. The ResultTableInHtmlTable component within it then renders the
1590
+ * ResultTable in a <table> element with a CSS class.
1591
+ *
1592
+ * ```svelte file=App.svelte
1593
+ * <script>
1594
+ * import {Provider} from 'tinybase/ui-svelte';
1595
+ * import {ResultTableInHtmlTable} from 'tinybase/ui-svelte-dom';
1596
+ *
1597
+ * export let queries;
1598
+ * </script>
1599
+ *
1600
+ * <Provider {queries}>
1601
+ * <ResultTableInHtmlTable queryId="petColors" className="table" />
1602
+ * </Provider>
1603
+ * ```
1604
+ *
1605
+ * ```ts
1606
+ * import {flushSync, mount} from 'svelte';
1607
+ * import {createQueries, createStore} from 'tinybase';
1608
+ * import App from './App.svelte';
1609
+ *
1610
+ * const queries = createQueries(
1611
+ * createStore().setTable('pets', {
1612
+ * fido: {species: 'dog', color: 'brown'},
1613
+ * felix: {species: 'cat', color: 'black'},
1614
+ * }),
1615
+ * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1616
+ * const app = document.body.appendChild(document.createElement('div'));
1617
+ * flushSync(() => mount(App, {target: app, props: {queries}}));
1618
+ * console.log(app.innerHTML);
1619
+ * // ->
1620
+ * `
1621
+ * <table class="table">
1622
+ * <thead>
1623
+ * <tr>
1624
+ * <th>Id</th>
1625
+ * <th>color</th>
1626
+ * </tr>
1627
+ * </thead>
1628
+ * <tbody>
1629
+ * <tr>
1630
+ * <th title="fido">fido</th>
1631
+ * <td>brown</td>
1632
+ * </tr>
1633
+ * <tr>
1634
+ * <th title="felix">felix</th>
1635
+ * <td>black</td>
1636
+ * </tr>
1637
+ * </tbody>
1638
+ * </table>
1639
+ * `;
1640
+ * ```
1641
+ * @example
1642
+ * This example creates a Provider context into which a default Queries object
1643
+ * is provided. The ResultTableInHtmlTable component within it then renders the
1644
+ * ResultTable with a custom component and a custom props callback for the
1645
+ * `color` Cell. The header row at the top of the table and the Id column at
1646
+ * the start of each row is removed.
1647
+ *
1648
+ * ```svelte file=FormattedResultCellView.svelte
1649
+ * <script>
1650
+ * import {ResultCellView} from 'tinybase/ui-svelte';
1651
+ *
1652
+ * export let queryId;
1653
+ * export let rowId;
1654
+ * export let cellId;
1655
+ * export let bold = false;
1656
+ * </script>
1657
+ *
1658
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<ResultCellView
1659
+ * {queryId}
1660
+ * {rowId}
1661
+ * {cellId}
1662
+ * />
1663
+ * ```
1664
+ *
1665
+ * ```svelte file=App.svelte
1666
+ * <script>
1667
+ * import {Provider} from 'tinybase/ui-svelte';
1668
+ * import {ResultTableInHtmlTable} from 'tinybase/ui-svelte-dom';
1669
+ * import FormattedResultCellView from './FormattedResultCellView.svelte';
1670
+ *
1671
+ * export let queries;
1672
+ *
1673
+ * const customCells = {
1674
+ * color: {
1675
+ * component: FormattedResultCellView,
1676
+ * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1677
+ * },
1678
+ * };
1679
+ * </script>
1680
+ *
1681
+ * <Provider {queries}>
1682
+ * <ResultTableInHtmlTable
1683
+ * queryId="petColors"
1684
+ * {customCells}
1685
+ * headerRow={false}
1686
+ * idColumn={false}
1687
+ * />
1688
+ * </Provider>
1689
+ * ```
1690
+ *
1691
+ * ```ts
1692
+ * import {flushSync, mount} from 'svelte';
1693
+ * import {createQueries, createStore} from 'tinybase';
1694
+ * import App from './App.svelte';
1695
+ *
1696
+ * const queries = createQueries(
1697
+ * createStore().setTable('pets', {
1698
+ * fido: {species: 'dog', color: 'brown'},
1699
+ * felix: {species: 'cat', color: 'black'},
1700
+ * }),
1701
+ * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1702
+ * const app = document.body.appendChild(document.createElement('div'));
1703
+ * flushSync(() => mount(App, {target: app, props: {queries}}));
1704
+ * console.log(app.innerHTML);
1705
+ * // ->
1706
+ * `
1707
+ * <table>
1708
+ * <tbody>
1709
+ * <tr>
1710
+ * <td><b>fido</b>:brown</td>
1711
+ * </tr>
1712
+ * <tr>
1713
+ * <td>felix:black</td>
1714
+ * </tr>
1715
+ * </tbody>
1716
+ * </table>
1717
+ * `;
1718
+ * ```
1719
+ * @category Queries components
1720
+ * @since v4.1.0
1721
+ */
1722
+ ResultTableInHtmlTable: Component<
1723
+ ResultTableInHtmlTableProps<Schemas> & HtmlTableProps
1724
+ >;
1725
+
1726
+ /**
1727
+ * The SortedTableInHtmlTable component renders the contents of a single query's
1728
+ * sorted ResultTable in a Queries object as an HTML <table> element, and
1729
+ * registers a listener so that any changes to that result will cause a
1730
+ * re-render.
1731
+ *
1732
+ * This has schema-based typing. The following is a simplified representation:
1733
+ *
1734
+ * ```ts override
1735
+ * export const ResultSortedTableInHtmlTable: Component<
1736
+ * ResultSortedTableInHtmlTableProps & HtmlTableProps
1737
+ * >;
1738
+ * ```
1739
+ *
1740
+ * See the <ResultSortedTableInHtmlTable /> (Svelte) demo for this component in
1741
+ * action:
1742
+ *
1743
+ * ![ResultSortedTableInHtmlTable example](
1744
+ * /shots/resultsortedtableinhtmltable-svelte-demo.png
1745
+ * "ResultSortedTableInHtmlTable example")
1746
+ *
1747
+ * The component's props identify which ResultTable to render based on query Id,
1748
+ * and Queries object (which is either the default context Queries object, a
1749
+ * named context Queries object, or by explicit reference). It also takes a Cell
1750
+ * Id to sort by and a boolean to indicate that the sorting should be in
1751
+ * descending order. The `offset` and `limit` props are used to paginate
1752
+ * results, but default to `0` and `undefined` to return all available Row Ids
1753
+ * if not specified.
1754
+ *
1755
+ * This component renders a ResultTable by iterating over its Row objects, in
1756
+ * the order dictated by the sort parameters. By default the Cells are in turn
1757
+ * rendered with the CellView component, but you can override this behavior by
1758
+ * providing a `component` for each Cell in the `customCells` prop. You can pass
1759
+ * additional props to that custom component with the `getComponentProps`
1760
+ * callback. See the ResultCustomCell type for more details.
1761
+ *
1762
+ * This component uses the useSortedRowIds hook under the covers, which means
1763
+ * that any changes to the structure or sorting of the ResultTable will cause a
1764
+ * re-render.
1765
+ *
1766
+ * You can use the `headerRow` and `idColumn` props to control whether the Ids
1767
+ * appear in a <th> element at the top of the table, and the start of each row.
1768
+ *
1769
+ * The `sortOnClick` prop makes the table's sorting interactive such that the
1770
+ * user can click on a column heading to sort by that column. The style classes
1771
+ * `sorted` and `ascending` (or `descending`) are added so that you can provide
1772
+ * hints to the user how the sorting is being applied.
1773
+ *
1774
+ * Provide a paginator component for the ResultTable with the `paginator` prop.
1775
+ * Set to `true` to use the default SortedTablePaginator, or provide your own
1776
+ * component that accepts SortedTablePaginatorProps.
1777
+ *
1778
+ * Finally, the `onChange` prop lets you listen to a user's changes to the
1779
+ * ResultTable's sorting or pagination.
1780
+ * @param props The props for this component.
1781
+ * @returns A rendering of the ResultTable in a <table> element.
1782
+ * @example
1783
+ * This example creates a Provider context into which a default Queries object
1784
+ * is provided. The ResultSortedTableInHtmlTable component within it then
1785
+ * renders the ResultTable in a <table> element with a CSS class.
1786
+ *
1787
+ * ```svelte file=App.svelte
1788
+ * <script>
1789
+ * import {Provider} from 'tinybase/ui-svelte';
1790
+ * import {ResultSortedTableInHtmlTable} from 'tinybase/ui-svelte-dom';
1791
+ *
1792
+ * export let queries;
1793
+ * </script>
1794
+ *
1795
+ * <Provider {queries}>
1796
+ * <ResultSortedTableInHtmlTable
1797
+ * queryId="petColors"
1798
+ * cellId="color"
1799
+ * className="table"
1800
+ * />
1801
+ * </Provider>
1802
+ * ```
1803
+ *
1804
+ * ```ts
1805
+ * import {flushSync, mount} from 'svelte';
1806
+ * import {createQueries, createStore} from 'tinybase';
1807
+ * import App from './App.svelte';
1808
+ *
1809
+ * const queries = createQueries(
1810
+ * createStore().setTable('pets', {
1811
+ * fido: {species: 'dog', color: 'brown'},
1812
+ * felix: {species: 'cat', color: 'black'},
1813
+ * }),
1814
+ * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1815
+ * const app = document.body.appendChild(document.createElement('div'));
1816
+ * flushSync(() => mount(App, {target: app, props: {queries}}));
1817
+ * console.log(app.innerHTML);
1818
+ * // ->
1819
+ * `
1820
+ * <table class="table">
1821
+ * <thead>
1822
+ * <tr>
1823
+ * <th>Id</th>
1824
+ * <th class="sorted ascending">↑ color</th>
1825
+ * </tr>
1826
+ * </thead>
1827
+ * <tbody>
1828
+ * <tr>
1829
+ * <th title="felix">felix</th>
1830
+ * <td>black</td>
1831
+ * </tr>
1832
+ * <tr>
1833
+ * <th title="fido">fido</th>
1834
+ * <td>brown</td>
1835
+ * </tr>
1836
+ * </tbody>
1837
+ * </table>
1838
+ * `;
1839
+ * ```
1840
+ * @example
1841
+ * This example creates a Provider context into which a default Queries object
1842
+ * is provided. The ResultSortedTableInHtmlTable component within it then
1843
+ * renders the ResultTable with a custom component and a custom props callback
1844
+ * for the `color` Cell. The header row at the top of the table and the Id
1845
+ * column at the start of each row is removed.
1846
+ *
1847
+ * ```svelte file=FormattedResultCellView.svelte
1848
+ * <script>
1849
+ * import {ResultCellView} from 'tinybase/ui-svelte';
1850
+ *
1851
+ * export let queryId;
1852
+ * export let rowId;
1853
+ * export let cellId;
1854
+ * export let bold = false;
1855
+ * </script>
1856
+ *
1857
+ * {#if bold}<b>{rowId}</b>{:else}{rowId}{/if}:<ResultCellView
1858
+ * {queryId}
1859
+ * {rowId}
1860
+ * {cellId}
1861
+ * />
1862
+ * ```
1863
+ *
1864
+ * ```svelte file=App.svelte
1865
+ * <script>
1866
+ * import {Provider} from 'tinybase/ui-svelte';
1867
+ * import {ResultSortedTableInHtmlTable} from 'tinybase/ui-svelte-dom';
1868
+ * import FormattedResultCellView from './FormattedResultCellView.svelte';
1869
+ *
1870
+ * export let queries;
1871
+ *
1872
+ * const customCells = {
1873
+ * color: {
1874
+ * component: FormattedResultCellView,
1875
+ * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1876
+ * },
1877
+ * };
1878
+ * </script>
1879
+ *
1880
+ * <Provider {queries}>
1881
+ * <ResultSortedTableInHtmlTable
1882
+ * queryId="petColors"
1883
+ * cellId="color"
1884
+ * {customCells}
1885
+ * headerRow={false}
1886
+ * idColumn={false}
1887
+ * />
1888
+ * </Provider>
1889
+ * ```
1890
+ *
1891
+ * ```ts
1892
+ * import {flushSync, mount} from 'svelte';
1893
+ * import {createQueries, createStore} from 'tinybase';
1894
+ * import App from './App.svelte';
1895
+ *
1896
+ * const queries = createQueries(
1897
+ * createStore().setTable('pets', {
1898
+ * fido: {species: 'dog', color: 'brown'},
1899
+ * felix: {species: 'cat', color: 'black'},
1900
+ * }),
1901
+ * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1902
+ * const app = document.body.appendChild(document.createElement('div'));
1903
+ * flushSync(() => mount(App, {target: app, props: {queries}}));
1904
+ * console.log(app.innerHTML);
1905
+ * // ->
1906
+ * `
1907
+ * <table>
1908
+ * <tbody>
1909
+ * <tr>
1910
+ * <td>felix:black</td>
1911
+ * </tr>
1912
+ * <tr>
1913
+ * <td><b>fido</b>:brown</td>
1914
+ * </tr>
1915
+ * </tbody>
1916
+ * </table>
1917
+ * `;
1918
+ * ```
1919
+ * @category Queries components
1920
+ * @since v4.1.0
1921
+ */
1922
+ ResultSortedTableInHtmlTable: Component<
1923
+ ResultSortedTableInHtmlTableProps<Schemas> & HtmlTableProps
1924
+ >;
1925
+
1926
+ /**
1927
+ * The EditableCellView component renders the value of a single Cell in a way
1928
+ * that can be edited in a web browser, and registers a listener so that any
1929
+ * changes to that result will cause a re-render.
1930
+ *
1931
+ * This has schema-based typing. The following is a simplified representation:
1932
+ *
1933
+ * ```ts override
1934
+ * export const EditableCellView: Component<
1935
+ * CellViewProps & {readonly className?: string; readonly showType?: boolean}
1936
+ * >;
1937
+ * ```
1938
+ *
1939
+ * See the <EditableCellView /> (Svelte) demo for this component in action:
1940
+ *
1941
+ * ![EditableCellView example](/shots/editablecellview-svelte-demo.png
1942
+ * "EditableCellView example")
1943
+ *
1944
+ * The component's props identify which Cell to render based on Table Id, Row
1945
+ * Id, Cell Id, and Store (which is either the default context Store, a named
1946
+ * context Store, or an explicit reference).
1947
+ *
1948
+ * A Cell contains a string, number, boolean, object or array (since v8.0) so
1949
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
1950
+ * button lets the user cycle through the types.
1951
+ *
1952
+ * Set the `showType` prop to false to remove the ability for the user to see or
1953
+ * change the Cell type. They will also not be able to change the type if there
1954
+ * is a TablesSchema applied to the Store.
1955
+ *
1956
+ * This component uses the useCell hook under the covers, which means that any
1957
+ * changes to the specified Cell outside of this component will cause a
1958
+ * re-render.
1959
+ *
1960
+ * You can provide a custom className prop which well be used on the root of the
1961
+ * resulting element. If omitted the element's class will be `editableCell`. The
1962
+ * debugIds prop has no effect on this component.
1963
+ * @param props The props for this component.
1964
+ * @returns An editable rendering of the Cell.
1965
+ * @example
1966
+ * This example creates a Provider context into which a default Store is
1967
+ * provided. The EditableCellView component within it then renders an editable
1968
+ * Cell.
1969
+ *
1970
+ * ```svelte file=App.svelte
1971
+ * <script>
1972
+ * import {Provider} from 'tinybase/ui-svelte';
1973
+ * import {EditableCellView} from 'tinybase/ui-svelte-dom';
1974
+ *
1975
+ * export let store;
1976
+ * </script>
1977
+ *
1978
+ * <Provider {store}>
1979
+ * <EditableCellView tableId="pets" rowId="fido" cellId="color" />
1980
+ * </Provider>
1981
+ * ```
1982
+ *
1983
+ * ```ts
1984
+ * import {flushSync, mount} from 'svelte';
1985
+ * import {createStore} from 'tinybase';
1986
+ * import App from './App.svelte';
1987
+ *
1988
+ * const store = createStore().setCell('pets', 'fido', 'color', 'brown');
1989
+ * const app = document.body.appendChild(document.createElement('div'));
1990
+ * flushSync(() => mount(App, {target: app, props: {store}}));
1991
+ * console.log(app.innerHTML);
1992
+ * // ->
1993
+ * `
1994
+ * <div class="editableCell">
1995
+ * <button title="string" class="string">string</button>
1996
+ * <input value="brown">
1997
+ * </div>
1998
+ * `;
1999
+ * ```
2000
+ * @category Store components
2001
+ * @since v4.1.0
2002
+ */
2003
+ EditableCellView: Component<
2004
+ CellProps<Schemas> & {
2005
+ className?: string;
2006
+ readonly showType?: boolean;
2007
+ }
2008
+ >;
2009
+
2010
+ /**
2011
+ * The EditableValueView component renders the value of a single Value in a way
2012
+ * that can be edited in a web browser, and registers a listener so that any
2013
+ * changes to that result will cause a re-render.
2014
+ *
2015
+ * This has schema-based typing. The following is a simplified representation:
2016
+ *
2017
+ * ```ts override
2018
+ * export const EditableValueView: Component<
2019
+ * ValueViewProps & {
2020
+ * readonly className?: string;
2021
+ * readonly showType?: boolean;
2022
+ * }
2023
+ * >;
2024
+ * ```
2025
+ *
2026
+ * See the <EditableValueView /> (Svelte) demo for this component in action:
2027
+ *
2028
+ * ![EditableValueView example](/shots/editablevalueview-svelte-demo.png
2029
+ * "EditableValueView example")
2030
+ *
2031
+ * The component's props identify which Value to render based on Table Id, Row
2032
+ * Id, Value Id, and Store (which is either the default context Store, a named
2033
+ * context Store, or an explicit reference).
2034
+ *
2035
+ * A Value contains a string, number, boolean, object or array (since v8.0) so
2036
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
2037
+ * button lets the user cycle through the types.
2038
+ *
2039
+ * Set the `showType` prop to false to remove the ability for the user to see or
2040
+ * change the Value type. They will also not be able to change the type if there
2041
+ * is a ValuesSchema applied to the Store.
2042
+ *
2043
+ * This component uses the useValue hook under the covers, which means that any
2044
+ * changes to the specified Value outside of this component will cause a
2045
+ * re-render.
2046
+ *
2047
+ * You can provide a custom className prop which well be used on the root of the
2048
+ * resulting element. If omitted the element's class will be `editableValue`.
2049
+ * The debugIds prop has no effect on this component.
2050
+ * @param props The props for this component.
2051
+ * @returns An editable rendering of the Value.
2052
+ * @example
2053
+ * This example creates a Provider context into which a default Store is
2054
+ * provided. The EditableValueView component within it then renders an editable
2055
+ * Value.
2056
+ *
2057
+ * ```svelte file=App.svelte
2058
+ * <script>
2059
+ * import {Provider} from 'tinybase/ui-svelte';
2060
+ * import {EditableValueView} from 'tinybase/ui-svelte-dom';
2061
+ *
2062
+ * export let store;
2063
+ * </script>
2064
+ *
2065
+ * <Provider {store}>
2066
+ * <EditableValueView valueId="employees" />
2067
+ * </Provider>
2068
+ * ```
2069
+ *
2070
+ * ```ts
2071
+ * import {flushSync, mount} from 'svelte';
2072
+ * import {createStore} from 'tinybase';
2073
+ * import App from './App.svelte';
2074
+ *
2075
+ * const store = createStore().setValue('employees', 3);
2076
+ * const app = document.body.appendChild(document.createElement('div'));
2077
+ * flushSync(() => mount(App, {target: app, props: {store}}));
2078
+ * console.log(app.innerHTML);
2079
+ * // ->
2080
+ * `
2081
+ * <div class="editableValue">
2082
+ * <button title="number" class="number">number</button>
2083
+ * <input type="number" value="3">
2084
+ * </div>
2085
+ * `;
2086
+ * ```
2087
+ * @category Store components
2088
+ * @since v4.1.0
2089
+ */
2090
+ EditableValueView: Component<
2091
+ ValueProps<Schemas> & {
2092
+ className?: string;
2093
+ readonly showType?: boolean;
2094
+ }
2095
+ >;
2096
+
2097
+ /**
2098
+ * The SortedTablePaginator component renders a paginator for a sorted table.
2099
+ *
2100
+ * See the <SortedTableInHtmlTable /> (Svelte) demo for this component in
2101
+ * action:
2102
+ *
2103
+ * ![SortedTablePaginator example](/shots/sortedtablepaginator-svelte-demo.png
2104
+ * "SortedTablePaginator example")
2105
+ *
2106
+ * The component displays 'previous' and 'next' buttons for paging through the
2107
+ * Table if there are more Row Ids than fit in each page. The component will
2108
+ * also display a label that shows which Row Ids are being displayed.
2109
+ *
2110
+ * The component's props identify initial pagination settings, and it will fire
2111
+ * an event when the pagination changes.
2112
+ * @param props The props for this component.
2113
+ * @returns The rendering of a paginator control with a label, and next and
2114
+ * previous buttons, where appropriate.
2115
+ * @example
2116
+ * This example creates a Provider context into which a default Store is
2117
+ * provided. The SortedTableInHtmlTable component within it then renders the
2118
+ * Table in a <table> element with a SortedTablePaginator (the default).
2119
+ *
2120
+ * ```svelte file=App.svelte
2121
+ * <script>
2122
+ * import {Provider} from 'tinybase/ui-svelte';
2123
+ * import {SortedTableInHtmlTable} from 'tinybase/ui-svelte-dom';
2124
+ *
2125
+ * export let store;
2126
+ * </script>
2127
+ *
2128
+ * <Provider {store}>
2129
+ * <SortedTableInHtmlTable
2130
+ * tableId="pets"
2131
+ * cellId="species"
2132
+ * limit={2}
2133
+ * paginator={true}
2134
+ * />
2135
+ * </Provider>
2136
+ * ```
2137
+ *
2138
+ * ```ts
2139
+ * import {flushSync, mount} from 'svelte';
2140
+ * import {createStore} from 'tinybase';
2141
+ * import App from './App.svelte';
2142
+ *
2143
+ * const store = createStore().setTables({
2144
+ * pets: {
2145
+ * fido: {species: 'dog'},
2146
+ * felix: {species: 'cat'},
2147
+ * cujo: {species: 'wolf'},
2148
+ * lowly: {species: 'worm'},
2149
+ * polly: {species: 'parrot'},
2150
+ * },
2151
+ * });
2152
+ * const app = document.body.appendChild(document.createElement('div'));
2153
+ * flushSync(() => mount(App, {target: app, props: {store}}));
2154
+ * console.log(app.innerHTML);
2155
+ * // ->
2156
+ * `
2157
+ * <table>
2158
+ * <caption>
2159
+ * <button class="previous" disabled="">←</button>
2160
+ * <button class="next">→</button>
2161
+ * 1 to 2 of 5 rows
2162
+ * </caption>
2163
+ * <thead>
2164
+ * <tr>
2165
+ * <th>Id</th>
2166
+ * <th class="sorted ascending">↑ species</th>
2167
+ * </tr>
2168
+ * </thead>
2169
+ * <tbody>
2170
+ * <tr>
2171
+ * <th title="felix">felix</th>
2172
+ * <td>cat</td>
2173
+ * </tr>
2174
+ * <tr>
2175
+ * <th title="fido">fido</th>
2176
+ * <td>dog</td>
2177
+ * </tr>
2178
+ * </tbody>
2179
+ * </table>
2180
+ * `;
2181
+ * ```
2182
+ * @category Store components
2183
+ * @since v4.1.0
2184
+ */
2185
+ SortedTablePaginator: Component<SortedTablePaginatorProps>;
2186
+ };