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