tinybase 4.1.0-beta.0 → 4.1.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 (74) hide show
  1. package/lib/cjs/queries.cjs +1 -1
  2. package/lib/cjs/queries.cjs.gz +0 -0
  3. package/lib/cjs/tinybase.cjs +1 -1
  4. package/lib/cjs/tinybase.cjs.gz +0 -0
  5. package/lib/cjs/tools.cjs +1 -1
  6. package/lib/cjs/tools.cjs.gz +0 -0
  7. package/lib/cjs/ui-react-dom.cjs +1 -0
  8. package/lib/cjs/ui-react-dom.cjs.gz +0 -0
  9. package/lib/cjs/ui-react.cjs +1 -1
  10. package/lib/cjs/ui-react.cjs.gz +0 -0
  11. package/lib/cjs-es6/queries.cjs +1 -1
  12. package/lib/cjs-es6/queries.cjs.gz +0 -0
  13. package/lib/cjs-es6/tinybase.cjs +1 -1
  14. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  15. package/lib/cjs-es6/tools.cjs +1 -1
  16. package/lib/cjs-es6/tools.cjs.gz +0 -0
  17. package/lib/cjs-es6/ui-react-dom.cjs +1 -0
  18. package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
  19. package/lib/cjs-es6/ui-react.cjs +1 -1
  20. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  21. package/lib/debug/queries.js +1 -0
  22. package/lib/debug/tinybase.js +1 -0
  23. package/lib/debug/tools.js +25 -4
  24. package/lib/debug/ui-react-dom.js +292 -0
  25. package/lib/debug/ui-react.js +43 -13
  26. package/lib/es6/queries.js +1 -1
  27. package/lib/es6/queries.js.gz +0 -0
  28. package/lib/es6/tinybase.js +1 -1
  29. package/lib/es6/tinybase.js.gz +0 -0
  30. package/lib/es6/tools.js +1 -1
  31. package/lib/es6/tools.js.gz +0 -0
  32. package/lib/es6/ui-react-dom.js +1 -0
  33. package/lib/es6/ui-react-dom.js.gz +0 -0
  34. package/lib/es6/ui-react.js +1 -1
  35. package/lib/es6/ui-react.js.gz +0 -0
  36. package/lib/queries.js +1 -1
  37. package/lib/queries.js.gz +0 -0
  38. package/lib/tinybase.js +1 -1
  39. package/lib/tinybase.js.gz +0 -0
  40. package/lib/tools.js +1 -1
  41. package/lib/tools.js.gz +0 -0
  42. package/lib/types/queries.d.ts +67 -0
  43. package/lib/types/ui-react-dom.d.ts +916 -0
  44. package/lib/types/ui-react.d.ts +328 -76
  45. package/lib/types/with-schemas/internal/ui-react.d.ts +23 -8
  46. package/lib/types/with-schemas/queries.d.ts +76 -0
  47. package/lib/types/with-schemas/ui-react-dom.d.ts +993 -0
  48. package/lib/types/with-schemas/ui-react.d.ts +325 -68
  49. package/lib/ui-react-dom.js +1 -0
  50. package/lib/ui-react-dom.js.gz +0 -0
  51. package/lib/ui-react.js +1 -1
  52. package/lib/ui-react.js.gz +0 -0
  53. package/lib/umd/queries.js +1 -1
  54. package/lib/umd/queries.js.gz +0 -0
  55. package/lib/umd/tinybase.js +1 -1
  56. package/lib/umd/tinybase.js.gz +0 -0
  57. package/lib/umd/tools.js +1 -1
  58. package/lib/umd/tools.js.gz +0 -0
  59. package/lib/umd/ui-react-dom.js +1 -0
  60. package/lib/umd/ui-react-dom.js.gz +0 -0
  61. package/lib/umd/ui-react.js +1 -1
  62. package/lib/umd/ui-react.js.gz +0 -0
  63. package/lib/umd-es6/queries.js +1 -1
  64. package/lib/umd-es6/queries.js.gz +0 -0
  65. package/lib/umd-es6/tinybase.js +1 -1
  66. package/lib/umd-es6/tinybase.js.gz +0 -0
  67. package/lib/umd-es6/tools.js +1 -1
  68. package/lib/umd-es6/tools.js.gz +0 -0
  69. package/lib/umd-es6/ui-react-dom.js +1 -0
  70. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  71. package/lib/umd-es6/ui-react.js +1 -1
  72. package/lib/umd-es6/ui-react.js.gz +0 -0
  73. package/package.json +33 -29
  74. package/readme.md +41 -24
@@ -69,6 +69,7 @@ import {
69
69
  ResultCellListener,
70
70
  ResultRowIdsListener,
71
71
  ResultRowListener,
72
+ ResultTableCellIdsListener,
72
73
  ResultTableListener,
73
74
  } from './queries.d';
74
75
  import {Persister} from './persisters.d';
@@ -5273,7 +5274,7 @@ export function useQueries(id?: Id): Queries | undefined;
5273
5274
 
5274
5275
  /**
5275
5276
  * The useResultTable hook returns an object containing the entire data of the
5276
- * result Table of the given query, and registers a listener so that any changes
5277
+ * ResultTable of the given query, and registers a listener so that any changes
5277
5278
  * to that result will cause a re-render.
5278
5279
  *
5279
5280
  * A Provider component is used to wrap part of an application in a context, and
@@ -5290,7 +5291,7 @@ export function useQueries(id?: Id): Queries | undefined;
5290
5291
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
5291
5292
  * default context Queries object, provide an Id for a named context Queries
5292
5293
  * object, or provide an explicit reference.
5293
- * @returns An object containing the entire data of the result Table.
5294
+ * @returns An object containing the entire data of the ResultTable.
5294
5295
  * @example
5295
5296
  * This example creates a Queries object outside the application, which is used
5296
5297
  * in the useTable hook by reference. A change to the data in the query
@@ -5391,7 +5392,136 @@ export function useResultTable(
5391
5392
  ): Table;
5392
5393
 
5393
5394
  /**
5394
- * The useResultRowIds hook returns the Ids of every Row in the result Table of
5395
+ * The useResultTableCellIds hook returns the Ids of every Cell used across the
5396
+ * whole ResultTable of the given query, and registers a listener so that any
5397
+ * changes to those Ids will cause a re-render.
5398
+ *
5399
+ * A Provider component is used to wrap part of an application in a context, and
5400
+ * it can contain a default Queries object or a set of Queries objects named by
5401
+ * Id. The useResultTableCellIds hook lets you indicate which Queries object to
5402
+ * get data for: omit the final optional final parameter for the default context
5403
+ * Queries object, provide an Id for a named context Queries object, or provide
5404
+ * a Queries object explicitly by reference.
5405
+ *
5406
+ * When first rendered, this hook will create a listener so that changes to the
5407
+ * result Cell Ids will cause a re-render. When the component containing this
5408
+ * hook is unmounted, the listener will be automatically removed.
5409
+ * @param queryId The Id of the query.
5410
+ * @param queriesOrQueriesId The Queries object to be accessed: omit for the
5411
+ * default context Queries object, provide an Id for a named context Queries
5412
+ * object, or provide an explicit reference. See the
5413
+ * addResultTableCellIdsListener method for more details.
5414
+ * @returns An array of the Ids of every Cell in the result of the query.
5415
+ * @example
5416
+ * This example creates a Queries object outside the application, which is used
5417
+ * in the useResultTableCellIds hook by reference. A change to the data in the
5418
+ * query re-renders the component.
5419
+ *
5420
+ * ```jsx
5421
+ * const store = createStore().setTable('pets', {
5422
+ * fido: {species: 'dog', color: 'brown'},
5423
+ * felix: {species: 'cat', color: 'black'},
5424
+ * cujo: {species: 'dog', color: 'black'},
5425
+ * });
5426
+ * const queries = createQueries(store).setQueryDefinition(
5427
+ * 'dogColorsAndLegs',
5428
+ * 'pets',
5429
+ * ({select, where}) => {
5430
+ * select('color');
5431
+ * select('legs');
5432
+ * where('species', 'dog');
5433
+ * },
5434
+ * );
5435
+ * const App = () => (
5436
+ * <span>
5437
+ * {JSON.stringify(useResultTableCellIds('dogColorsAndLegs', queries))}
5438
+ * </span>
5439
+ * );
5440
+ *
5441
+ * const app = document.createElement('div');
5442
+ * ReactDOMClient.createRoot(app).render(<App />); // !act
5443
+ * console.log(app.innerHTML);
5444
+ * // -> '<span>["color"]</span>'
5445
+ *
5446
+ * store.setCell('pets', 'cujo', 'legs', 4); // !act
5447
+ * console.log(app.innerHTML);
5448
+ * // -> '<span>["color","legs"]</span>'
5449
+ * ```
5450
+ * @example
5451
+ * This example creates a Provider context into which a default Queries object
5452
+ * is provided. A component within it then uses the useResultTableCellIds hook.
5453
+ *
5454
+ * ```jsx
5455
+ * const App = ({queries}) => (
5456
+ * <Provider queries={queries}>
5457
+ * <Pane />
5458
+ * </Provider>
5459
+ * );
5460
+ * const Pane = () => (
5461
+ * <span>{JSON.stringify(useResultTableCellIds('dogColorsAndLegs'))}</span>
5462
+ * );
5463
+ *
5464
+ * const queries = createQueries(
5465
+ * createStore().setTable('pets', {
5466
+ * fido: {species: 'dog', color: 'brown'},
5467
+ * felix: {species: 'cat', color: 'black'},
5468
+ * cujo: {species: 'dog', color: 'black', legs: 4},
5469
+ * }),
5470
+ * ).setQueryDefinition('dogColorsAndLegs', 'pets', ({select, where}) => {
5471
+ * select('color');
5472
+ * select('legs');
5473
+ * where('species', 'dog');
5474
+ * });
5475
+ * const app = document.createElement('div');
5476
+ * ReactDOMClient.createRoot(app).render(<App queries={queries} />); // !act
5477
+ * console.log(app.innerHTML);
5478
+ * // -> '<span>["color","legs"]</span>'
5479
+ * ```
5480
+ * @example
5481
+ * This example creates a Provider context into which a Queries object is
5482
+ * provided, named by Id. A component within it then uses the
5483
+ * useResultTableCellIds hook.
5484
+ *
5485
+ * ```jsx
5486
+ * const App = ({queries}) => (
5487
+ * <Provider queriesById={{petQueries: queries}}>
5488
+ * <Pane />
5489
+ * </Provider>
5490
+ * );
5491
+ * const Pane = () => (
5492
+ * <span>
5493
+ * {JSON.stringify(
5494
+ * useResultTableCellIds('dogColorsAndLegs', 'petQueries'),
5495
+ * )}
5496
+ * </span>
5497
+ * );
5498
+ *
5499
+ * const queries = createQueries(
5500
+ * createStore().setTable('pets', {
5501
+ * fido: {species: 'dog', color: 'brown'},
5502
+ * felix: {species: 'cat', color: 'black'},
5503
+ * cujo: {species: 'dog', color: 'black', legs: 4},
5504
+ * }),
5505
+ * ).setQueryDefinition('dogColorsAndLegs', 'pets', ({select, where}) => {
5506
+ * select('color');
5507
+ * select('legs');
5508
+ * where('species', 'dog');
5509
+ * });
5510
+ * const app = document.createElement('div');
5511
+ * ReactDOMClient.createRoot(app).render(<App queries={queries} />); // !act
5512
+ * console.log(app.innerHTML);
5513
+ * // -> '<span>["color","legs"]</span>'
5514
+ * ```
5515
+ * @category Queries hooks
5516
+ * @since v4.1.0
5517
+ */
5518
+ export function useResultTableCellIds(
5519
+ queryId: Id,
5520
+ queriesOrQueriesId?: QueriesOrQueriesId,
5521
+ ): Ids;
5522
+
5523
+ /**
5524
+ * The useResultRowIds hook returns the Ids of every Row in the ResultTable of
5395
5525
  * the given query, and registers a listener so that any changes to those Ids
5396
5526
  * will cause a re-render.
5397
5527
  *
@@ -5512,7 +5642,7 @@ export function useResultRowIds(
5512
5642
 
5513
5643
  /**
5514
5644
  * The useResultSortedRowIds hook returns the sorted (and optionally, paginated)
5515
- * Ids of every Row in the result Table of the given query, and registers a
5645
+ * Ids of every Row in the ResultTable of the given query, and registers a
5516
5646
  * listener so that any changes to those Ids will cause a re-render.
5517
5647
  *
5518
5648
  * A Provider component is used to wrap part of an application in a context, and
@@ -5663,9 +5793,9 @@ export function useResultSortedRowIds(
5663
5793
  ): Ids;
5664
5794
 
5665
5795
  /**
5666
- * The useResultRow hook returns an object containing the data of a
5667
- * single Row in the result Table of the given query, and registers a listener
5668
- * so that any changes to that Row will cause a re-render.
5796
+ * The useResultRow hook returns an object containing the data of a single Row
5797
+ * in the ResultTable of the given query, and registers a listener so that any
5798
+ * changes to that Row will cause a re-render.
5669
5799
  *
5670
5800
  * A Provider component is used to wrap part of an application in a context, and
5671
5801
  * it can contain a default Queries object or a set of Queries objects named by
@@ -5678,11 +5808,11 @@ export function useResultSortedRowIds(
5678
5808
  * result Row will cause a re-render. When the component containing this hook is
5679
5809
  * unmounted, the listener will be automatically removed.
5680
5810
  * @param queryId The Id of the query.
5681
- * @param rowId The Id of the Row in the result Table.
5811
+ * @param rowId The Id of the Row in the ResultTable.
5682
5812
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
5683
5813
  * default context Queries object, provide an Id for a named context Queries
5684
5814
  * object, or provide an explicit reference.
5685
- * @returns An object containing the entire data of the Row in the result Table
5815
+ * @returns An object containing the entire data of the Row in the ResultTable
5686
5816
  * of the query.
5687
5817
  * @example
5688
5818
  * This example creates a Queries object outside the application, which is used
@@ -5788,7 +5918,7 @@ export function useResultRow(
5788
5918
 
5789
5919
  /**
5790
5920
  * The useResultCellIds hook returns the Ids of every Cell in a given Row in the
5791
- * result Table of the given query, and registers a listener so that any changes
5921
+ * ResultTable of the given query, and registers a listener so that any changes
5792
5922
  * to those Ids will cause a re-render.
5793
5923
  *
5794
5924
  * A Provider component is used to wrap part of an application in a context, and
@@ -5802,7 +5932,7 @@ export function useResultRow(
5802
5932
  * result Cell Ids will cause a re-render. When the component containing this
5803
5933
  * hook is unmounted, the listener will be automatically removed.
5804
5934
  * @param queryId The Id of the query.
5805
- * @param rowId The Id of the Row in the result Table.
5935
+ * @param rowId The Id of the Row in the ResultTable.
5806
5936
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
5807
5937
  * default context Queries object, provide an Id for a named context Queries
5808
5938
  * object, or provide an explicit reference.
@@ -5918,7 +6048,7 @@ export function useResultCellIds(
5918
6048
 
5919
6049
  /**
5920
6050
  * The useResultCell hook returns the value of a single Cell in a given Row in
5921
- * the result Table of the given query, and registers a listener so that any
6051
+ * the ResultTable of the given query, and registers a listener so that any
5922
6052
  * changes to that value will cause a re-render.
5923
6053
  *
5924
6054
  * A Provider component is used to wrap part of an application in a context, and
@@ -5932,7 +6062,7 @@ export function useResultCellIds(
5932
6062
  * result Cell will cause a re-render. When the component containing this hook
5933
6063
  * is unmounted, the listener will be automatically removed.
5934
6064
  * @param queryId The Id of the query.
5935
- * @param rowId The Id of the Row in the result Table.
6065
+ * @param rowId The Id of the Row in the ResultTable.
5936
6066
  * @param cellId The Id of the Cell in the Row.
5937
6067
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
5938
6068
  * default context Queries object, provide an Id for a named context Queries
@@ -6045,14 +6175,14 @@ export function useResultCell(
6045
6175
 
6046
6176
  /**
6047
6177
  * The useResultTableListener hook registers a listener function with a Queries
6048
- * object that will be called whenever data in a result Table changes.
6178
+ * object that will be called whenever data in a ResultTable changes.
6049
6179
  *
6050
6180
  * This hook is useful for situations where a component needs to register its
6051
6181
  * own specific listener to do more than simply tracking the value (which is
6052
6182
  * more easily done with the useResultTable hook).
6053
6183
  *
6054
- * You can either listen to a single result Table (by specifying a query Id as
6055
- * the method's first parameter) or changes to any result Table (by providing a
6184
+ * You can either listen to a single ResultTable (by specifying a query Id as
6185
+ * the method's first parameter) or changes to any ResultTable (by providing a
6056
6186
  * `null` wildcard).
6057
6187
  *
6058
6188
  * Unlike the addResultTableListener method, which returns a listener Id and
@@ -6062,7 +6192,7 @@ export function useResultCell(
6062
6192
  * Queries object will be deleted.
6063
6193
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
6064
6194
  * @param listener The function that will be called whenever data in the
6065
- * matching result Table changes.
6195
+ * matching ResultTable changes.
6066
6196
  * @param listenerDeps An optional array of dependencies for the `listener`
6067
6197
  * function, which, if any change, result in the re-registration of the
6068
6198
  * listener. This parameter defaults to an empty array.
@@ -6120,16 +6250,97 @@ export function useResultTableListener(
6120
6250
  queriesOrQueriesId?: QueriesOrQueriesId,
6121
6251
  ): void;
6122
6252
 
6253
+ /**
6254
+ * The useResultTableCellIdsListener hook registers a listener function with a
6255
+ * Queries object that will be called whenever the Cell Ids that appear anywhere
6256
+ * in a ResultTable change.
6257
+ *
6258
+ * This hook is useful for situations where a component needs to register its
6259
+ * own specific listener to do more than simply tracking the value (which is
6260
+ * more easily done with the useResultTableCellIds hook).
6261
+ *
6262
+ * You can either listen to a single ResultTable (by specifying a query Id as
6263
+ * the method's first parameter) or changes to any ResultTable (by providing a
6264
+ * `null` wildcard).
6265
+ *
6266
+ * Unlike the addResultTableCellIdsListener method, which returns a listener Id
6267
+ * and requires you to remove it manually, the useResultTableCellIdsListener
6268
+ * hook manages this lifecycle for you: when the listener changes (per its
6269
+ * `listenerDeps` dependencies) or the component unmounts, the listener on the
6270
+ * underlying Queries object will be deleted.
6271
+ * @param queryId The Id of the query to listen to, or `null` as a wildcard.
6272
+ * @param listener The function that will be called whenever the Cell Ids that
6273
+ * appear anywhere in the ResultTable change.
6274
+ * @param listenerDeps An optional array of dependencies for the `listener`
6275
+ * function, which, if any change, result in the re-registration of the
6276
+ * listener. This parameter defaults to an empty array.
6277
+ * @param queriesOrQueriesId The Queries object to register the listener with:
6278
+ * omit for the default context Queries object, provide an Id for a named
6279
+ * context Queries object, or provide an explicit reference.
6280
+ * @example
6281
+ * This example uses the useResultTableCellIdsListener hook to create a listener
6282
+ * that is scoped to a single component. When the component is unmounted, the
6283
+ * listener is removed from the Queries object.
6284
+ *
6285
+ * ```jsx
6286
+ * const App = ({queries}) => (
6287
+ * <Provider queries={queries}>
6288
+ * <Pane />
6289
+ * </Provider>
6290
+ * );
6291
+ * const Pane = () => {
6292
+ * useResultTableCellIdsListener('petColorsAndLegs', () =>
6293
+ * console.log('Result Cell Ids changed'),
6294
+ * );
6295
+ * return <span>App</span>;
6296
+ * };
6297
+ *
6298
+ * const store = createStore().setTable('pets', {
6299
+ * fido: {species: 'dog', color: 'brown'},
6300
+ * felix: {species: 'cat', color: 'black'},
6301
+ * cujo: {species: 'dog', color: 'black'},
6302
+ * });
6303
+ * const queries = createQueries(store).setQueryDefinition(
6304
+ * 'petColorsAndLegs',
6305
+ * 'pets',
6306
+ * ({select}) => {
6307
+ * select('color');
6308
+ * select('legs');
6309
+ * },
6310
+ * );
6311
+ * const app = document.createElement('div');
6312
+ * const root = ReactDOMClient.createRoot(app);
6313
+ * root.render(<App queries={queries} />); // !act
6314
+ * console.log(queries.getListenerStats().tableCellIds);
6315
+ * // -> 1
6316
+ *
6317
+ * store.setCell('pets', 'cujo', 'legs', 4); // !act
6318
+ * // -> 'Result Cell Ids changed'
6319
+ *
6320
+ * root.unmount(); // !act
6321
+ * console.log(queries.getListenerStats().tableCellIds);
6322
+ * // -> 0
6323
+ * ```
6324
+ * @category Queries hooks
6325
+ * @since v4.1.0
6326
+ */
6327
+ export function useResultTableCellIdsListener(
6328
+ queryId: IdOrNull,
6329
+ listener: ResultTableCellIdsListener,
6330
+ listenerDeps?: React.DependencyList,
6331
+ queriesOrQueriesId?: QueriesOrQueriesId,
6332
+ ): void;
6333
+
6123
6334
  /**
6124
6335
  * The useResultRowIdsListener hook registers a listener function with a Queries
6125
- * object that will be called whenever the Row Ids in a result Table change.
6336
+ * object that will be called whenever the Row Ids in a ResultTable change.
6126
6337
  *
6127
6338
  * This hook is useful for situations where a component needs to register its
6128
6339
  * own specific listener to do more than simply tracking the value (which is
6129
6340
  * more easily done with the useResultRowIds hook).
6130
6341
  *
6131
- * You can either listen to a single result Table (by specifying a query Id as
6132
- * the method's first parameter) or changes to any result Table (by providing a
6342
+ * You can either listen to a single ResultTable (by specifying a query Id as
6343
+ * the method's first parameter) or changes to any ResultTable (by providing a
6133
6344
  * `null` wildcard).
6134
6345
  *
6135
6346
  * Unlike the addResultRowIdsListener method, which returns a listener Id and
@@ -6139,7 +6350,7 @@ export function useResultTableListener(
6139
6350
  * Queries object will be deleted.
6140
6351
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
6141
6352
  * @param listener The function that will be called whenever the Row Ids in the
6142
- * matching result Table change.
6353
+ * matching ResultTable change.
6143
6354
  * @param listenerDeps An optional array of dependencies for the `listener`
6144
6355
  * function, which, if any change, result in the re-registration of the
6145
6356
  * listener. This parameter defaults to an empty array.
@@ -6200,7 +6411,7 @@ export function useResultRowIdsListener(
6200
6411
  /**
6201
6412
  * The useResultSortedRowIdsListener hook registers a listener function with a
6202
6413
  * Queries object that will be called whenever the sorted (and optionally,
6203
- * paginated) Row Ids in a result Table change.
6414
+ * paginated) Row Ids in a ResultTable change.
6204
6415
  *
6205
6416
  * This hook is useful for situations where a component needs to register its
6206
6417
  * own specific listener to do more than simply tracking the value (which is
@@ -6218,7 +6429,7 @@ export function useResultRowIdsListener(
6218
6429
  * @param offset The number of Row Ids to skip for pagination purposes, if any.
6219
6430
  * @param limit The maximum number of Row Ids to return, or `undefined` for all.
6220
6431
  * @param listener The function that will be called whenever the Row Ids in the
6221
- * matching result Table change.
6432
+ * matching ResultTable change.
6222
6433
  * @param listenerDeps An optional array of dependencies for the `listener`
6223
6434
  * function, which, if any change, result in the re-registration of the
6224
6435
  * listener. This parameter defaults to an empty array.
@@ -6391,7 +6602,7 @@ export function useResultRowListener(
6391
6602
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
6392
6603
  * @param rowId The Id of the result Row to listen to, or `null` as a wildcard.
6393
6604
  * @param listener The function that will be called whenever the Row Ids in the
6394
- * matching result Table change.
6605
+ * matching ResultTable change.
6395
6606
  * @param listenerDeps An optional array of dependencies for the `listener`
6396
6607
  * function, which, if any change, result in the re-registration of the
6397
6608
  * listener. This parameter defaults to an empty array.
@@ -7593,6 +7804,11 @@ export type TableProps = {
7593
7804
  * on its Id.
7594
7805
  */
7595
7806
  readonly getRowComponentProps?: (rowId: Id) => ExtraProps;
7807
+ /**
7808
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
7809
+ * Table's Cells in a given order.
7810
+ */
7811
+ readonly customCellIds?: Ids;
7596
7812
  /**
7597
7813
  * A component or string to separate each Row component.
7598
7814
  */
@@ -7647,6 +7863,11 @@ export type SortedTableProps = {
7647
7863
  * on its Id.
7648
7864
  */
7649
7865
  readonly getRowComponentProps?: (rowId: Id) => ExtraProps;
7866
+ /**
7867
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
7868
+ * sorted Table's Cells in a given order.
7869
+ */
7870
+ readonly customCellIds?: Ids;
7650
7871
  /**
7651
7872
  * A component or string to separate each Row component.
7652
7873
  */
@@ -7687,6 +7908,11 @@ export type RowProps = {
7687
7908
  * on its Id.
7688
7909
  */
7689
7910
  readonly getCellComponentProps?: (cellId: Id) => ExtraProps;
7911
+ /**
7912
+ * An optional list of Cell Ids to use for rendering a prescribed set of the
7913
+ * Row's Cells in a given order.
7914
+ */
7915
+ readonly customCellIds?: Ids;
7690
7916
  /**
7691
7917
  * A component or string to separate each Cell component.
7692
7918
  */
@@ -8007,14 +8233,14 @@ export type LinkedRowsProps = {
8007
8233
 
8008
8234
  /**
8009
8235
  * ResultTableProps props are used for components that refer to a single query
8010
- * result Table, such as the ResultTableView component.
8236
+ * ResultTable, such as the ResultTableView component.
8011
8237
  * @category Props
8012
8238
  * @since v2.0.0
8013
8239
  */
8014
8240
  export type ResultTableProps = {
8015
8241
  /**
8016
- * The Id of the query in the Queries object for which the result Table will
8017
- * be rendered.
8242
+ * The Id of the query in the Queries object for which the ResultTable will be
8243
+ * rendered.
8018
8244
  */
8019
8245
  readonly queryId: Id;
8020
8246
  /**
@@ -8046,13 +8272,13 @@ export type ResultTableProps = {
8046
8272
 
8047
8273
  /**
8048
8274
  * ResultSortedTableProps props are used for components that refer to a single
8049
- * sorted query result Table, such as the ResultSortedTableView component.
8275
+ * sorted query ResultTable, such as the ResultSortedTableView component.
8050
8276
  * @category Props
8051
8277
  * @since v2.0.0
8052
8278
  */
8053
8279
  export type ResultSortedTableProps = {
8054
8280
  /**
8055
- * The Id of the query in the Queries object for which the sorted result Table
8281
+ * The Id of the query in the Queries object for which the sorted ResultTable
8056
8282
  * will be rendered.
8057
8283
  */
8058
8284
  readonly queryId: Id;
@@ -8102,18 +8328,18 @@ export type ResultSortedTableProps = {
8102
8328
 
8103
8329
  /**
8104
8330
  * ResultRowProps props are used for components that refer to a single Row in a
8105
- * query result Table, such as the ResultRowView component.
8331
+ * query ResultTable, such as the ResultRowView component.
8106
8332
  * @category Props
8107
8333
  * @since v2.0.0
8108
8334
  */
8109
8335
  export type ResultRowProps = {
8110
8336
  /**
8111
- * The Id of the query in the Queries object for which the result Table will
8112
- * be rendered.
8337
+ * The Id of the query in the Queries object for which the ResultTable will be
8338
+ * rendered.
8113
8339
  */
8114
8340
  readonly queryId: Id;
8115
8341
  /**
8116
- * The Id of the Row in the result Table to be rendered.
8342
+ * The Id of the Row in the ResultTable to be rendered.
8117
8343
  */
8118
8344
  readonly rowId: Id;
8119
8345
  /**
@@ -8145,14 +8371,14 @@ export type ResultRowProps = {
8145
8371
 
8146
8372
  /**
8147
8373
  * ResultRowProps props are used for components that refer to a single Cell in a
8148
- * Row of a result Table, such as the ResultCellView component.
8374
+ * Row of a ResultTable, such as the ResultCellView component.
8149
8375
  * @category Props
8150
8376
  * @since v2.0.0
8151
8377
  */
8152
8378
  export type ResultCellProps = {
8153
8379
  /**
8154
- * The Id of the query in the Queries object for which the result Table will
8155
- * be rendered.
8380
+ * The Id of the query in the Queries object for which the ResultTable will be
8381
+ * rendered.
8156
8382
  */
8157
8383
  readonly queryId: Id;
8158
8384
  /**
@@ -8582,8 +8808,10 @@ export function CellView(props: CellProps): ComponentReturnType;
8582
8808
  * You can create your own RowView-like component to customize the way that a
8583
8809
  * Row is rendered: see the TableView component for more details.
8584
8810
  *
8585
- * This component uses the useCellIds hook under the covers, which means that
8586
- * any changes to the structure of the Row will cause a re-render.
8811
+ * Since v4.1.0, you can use the `customCellIds` prop if you want to render a
8812
+ * prescribed set of the Row's Cells in a given order. Otherwise, this component
8813
+ * uses the useCellIds hook under the covers, which means that any changes to
8814
+ * the structure of the Row will cause a re-render.
8587
8815
  * @param props The props for this component.
8588
8816
  * @returns A rendering of the Row, or nothing, if not present.
8589
8817
  * @example
@@ -8610,8 +8838,8 @@ export function CellView(props: CellProps): ComponentReturnType;
8610
8838
  * ```
8611
8839
  * @example
8612
8840
  * This example creates a Provider context into which a default Store is
8613
- * provided. The RowView component within it then renders the Row (with Ids for
8614
- * readability).
8841
+ * provided. The RowView component within it then renders the Row for a custom
8842
+ * set of Cell Ids (and rendered with Ids for readability).
8615
8843
  *
8616
8844
  * ```jsx
8617
8845
  * const App = ({store}) => (
@@ -8619,20 +8847,27 @@ export function CellView(props: CellProps): ComponentReturnType;
8619
8847
  * <Pane />
8620
8848
  * </Provider>
8621
8849
  * );
8850
+ * const customCellIds = ['color', 'species'];
8622
8851
  * const Pane = () => (
8623
8852
  * <div>
8624
- * <RowView tableId="pets" rowId="fido" debugIds={true} />
8853
+ * <RowView
8854
+ * tableId="pets"
8855
+ * rowId="fido"
8856
+ * customCellIds={customCellIds}
8857
+ * debugIds={true}
8858
+ * />
8625
8859
  * </div>
8626
8860
  * );
8627
8861
  *
8628
8862
  * const store = createStore().setRow('pets', 'fido', {
8629
8863
  * species: 'dog',
8630
8864
  * color: 'walnut',
8865
+ * legs: 4,
8631
8866
  * });
8632
8867
  * const app = document.createElement('div');
8633
8868
  * ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
8634
8869
  * console.log(app.innerHTML);
8635
- * // -> '<div>fido:{species:{dog}color:{walnut}}</div>'
8870
+ * // -> '<div>fido:{color:{walnut}species:{dog}}</div>'
8636
8871
  * ```
8637
8872
  * @example
8638
8873
  * This example creates a Provider context into which a default Store is
@@ -8698,6 +8933,9 @@ export function RowView(props: RowProps): ComponentReturnType;
8698
8933
  * This component uses the useSortedRowIds hook under the covers, which means
8699
8934
  * that any changes to the structure or sorting of the Table will cause a
8700
8935
  * re-render.
8936
+ *
8937
+ * Since v4.1.0, you can use the `customCellIds` prop if you want to render a
8938
+ * prescribed set of the Table's Cells in a given order for each Row.
8701
8939
  * @param props The props for this component.
8702
8940
  * @returns A rendering of the Table, or nothing, if not present.
8703
8941
  * @example
@@ -8734,8 +8972,8 @@ export function RowView(props: RowProps): ComponentReturnType;
8734
8972
  * ```
8735
8973
  * @example
8736
8974
  * This example creates a Provider context into which a default Store is
8737
- * provided. The SortedTableView component within it then renders the Table
8738
- * (with Ids for readability).
8975
+ * provided. The SortedTableView component within it then renders the Table for
8976
+ * a custom set of Cell Ids (and rendered with Ids for readability).
8739
8977
  *
8740
8978
  * ```jsx
8741
8979
  * const App = ({store}) => (
@@ -8743,16 +8981,22 @@ export function RowView(props: RowProps): ComponentReturnType;
8743
8981
  * <Pane />
8744
8982
  * </Provider>
8745
8983
  * );
8984
+ * const customCellIds = ['species'];
8746
8985
  * const Pane = () => (
8747
8986
  * <div>
8748
- * <SortedTableView tableId="pets" cellId="species" debugIds={true} />
8987
+ * <SortedTableView
8988
+ * tableId="pets"
8989
+ * cellId="species"
8990
+ * customCellIds={customCellIds}
8991
+ * debugIds={true}
8992
+ * />
8749
8993
  * </div>
8750
8994
  * );
8751
8995
  *
8752
8996
  * const store = createStore().setTables({
8753
8997
  * pets: {
8754
- * fido: {species: 'dog'},
8755
- * felix: {species: 'cat'},
8998
+ * fido: {color: 'black', species: 'dog'},
8999
+ * felix: {color: 'brown', species: 'cat'},
8756
9000
  * },
8757
9001
  * });
8758
9002
  * const app = document.createElement('div');
@@ -8825,6 +9069,9 @@ export function SortedTableView(props: SortedTableProps): ComponentReturnType;
8825
9069
  *
8826
9070
  * This component uses the useRowIds hook under the covers, which means that any
8827
9071
  * changes to the structure of the Table will cause a re-render.
9072
+ *
9073
+ * Since v4.1.0, you can use the `customCellIds` prop if you want to render a
9074
+ * prescribed set of the Table's Cells in a given order for each Row.
8828
9075
  * @param props The props for this component.
8829
9076
  * @returns A rendering of the Table, or nothing, if not present.
8830
9077
  * @example
@@ -8851,8 +9098,8 @@ export function SortedTableView(props: SortedTableProps): ComponentReturnType;
8851
9098
  * ```
8852
9099
  * @example
8853
9100
  * This example creates a Provider context into which a default Store is
8854
- * provided. The TableView component within it then renders the Table (with Ids
8855
- * for readability).
9101
+ * provided. The TableView component within it then renders the Table for a
9102
+ * custom set of Cell Ids (and rendered with Ids for readability).
8856
9103
  *
8857
9104
  * ```jsx
8858
9105
  * const App = ({store}) => (
@@ -8860,15 +9107,20 @@ export function SortedTableView(props: SortedTableProps): ComponentReturnType;
8860
9107
  * <Pane />
8861
9108
  * </Provider>
8862
9109
  * );
9110
+ * const customCellIds = ['species'];
8863
9111
  * const Pane = () => (
8864
9112
  * <div>
8865
- * <TableView tableId="pets" debugIds={true} />
9113
+ * <TableView
9114
+ * tableId="pets"
9115
+ * customCellIds={customCellIds}
9116
+ * debugIds={true}
9117
+ * />
8866
9118
  * </div>
8867
9119
  * );
8868
9120
  *
8869
9121
  * const store = createStore().setTable('pets', {
8870
- * fido: {species: 'dog'},
8871
- * felix: {species: 'cat'},
9122
+ * fido: {color: 'black', species: 'dog'},
9123
+ * felix: {color: 'brown', species: 'cat'},
8872
9124
  * });
8873
9125
  * const app = document.createElement('div');
8874
9126
  * ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
@@ -9128,8 +9380,8 @@ export function ValueView(props: ValueProps): ComponentReturnType;
9128
9380
  * also pass additional props to your custom component with the
9129
9381
  * `getValueComponentProps` callback prop.
9130
9382
  *
9131
- * This component uses the useTableIds hook under the covers, which means that
9132
- * any changes to the structure of the Store will cause a re-render.
9383
+ * This component uses the useValueIds hook under the covers, which means that
9384
+ * any changes to the Values in the Store will cause a re-render.
9133
9385
  *
9134
9386
  * This component uses the useValueIds hook under the covers, which means that
9135
9387
  * any changes to the Store's Values will cause a re-render.
@@ -9975,7 +10227,7 @@ export function LinkedRowsView(props: LinkedRowsProps): ComponentReturnType;
9975
10227
 
9976
10228
  /**
9977
10229
  * The ResultCellView component renders the value of a single Cell in a given
9978
- * Row, in a given query's result Table, and registers a listener so that any
10230
+ * Row, in a given query's ResultTable, and registers a listener so that any
9979
10231
  * changes to that result will cause a re-render.
9980
10232
  *
9981
10233
  * The component's props identify which Cell to render based on query Id, Row
@@ -10097,7 +10349,7 @@ export function ResultCellView(props: ResultCellProps): ComponentReturnType;
10097
10349
 
10098
10350
  /**
10099
10351
  * The ResultRowView component renders the contents of a single Row in a given
10100
- * query's result Table, and registers a listener so that any changes to that
10352
+ * query's ResultTable, and registers a listener so that any changes to that
10101
10353
  * result will cause a re-render.
10102
10354
  *
10103
10355
  * The component's props identify which Row to render based on query Id, Row Id,
@@ -10243,18 +10495,18 @@ export function ResultRowView(props: ResultRowProps): ComponentReturnType;
10243
10495
 
10244
10496
  /**
10245
10497
  * The ResultSortedTableView component renders the contents of a single query's
10246
- * sorted result Table in a Queries object, and registers a listener so that any
10498
+ * sorted ResultTable in a Queries object, and registers a listener so that any
10247
10499
  * changes to that result will cause a re-render.
10248
10500
  *
10249
- * The component's props identify which Table to render based on query Id, and
10250
- * Queries object (which is either the default context Queries object, a named
10251
- * context Queries object, or by explicit reference). It also takes a Cell Id to
10252
- * sort by and a boolean to indicate that the sorting should be in descending
10253
- * order. The `offset` and `limit` props are used to paginate results, but
10254
- * default to `0` and `undefined` to return all available Row Ids if not
10255
- * specified.
10501
+ * The component's props identify which ResultTable to render based on query Id,
10502
+ * and Queries object (which is either the default context Queries object, a
10503
+ * named context Queries object, or by explicit reference). It also takes a Cell
10504
+ * Id to sort by and a boolean to indicate that the sorting should be in
10505
+ * descending order. The `offset` and `limit` props are used to paginate
10506
+ * results, but default to `0` and `undefined` to return all available Row Ids
10507
+ * if not specified.
10256
10508
  *
10257
- * This component renders a result Table by iterating over its Row objects, in
10509
+ * This component renders a ResultTable by iterating over its Row objects, in
10258
10510
  * the order dictated by the sort parameters. By default these are in turn
10259
10511
  * rendered with the ResultRowView component, but you can override this behavior
10260
10512
  * by providing a `resultRowComponent` prop, a custom component of your own that
@@ -10262,10 +10514,10 @@ export function ResultRowView(props: ResultRowProps): ComponentReturnType;
10262
10514
  * to your custom component with the `getResultRowComponentProps` callback prop.
10263
10515
  *
10264
10516
  * This component uses the useResultSortedRowIds hook under the covers, which
10265
- * means that any changes to the structure or sorting of the result Table will
10517
+ * means that any changes to the structure or sorting of the ResultTable will
10266
10518
  * cause a re-render.
10267
10519
  * @param props The props for this component.
10268
- * @returns A rendering of the result Table, or nothing, if not present.
10520
+ * @returns A rendering of the ResultTable, or nothing, if not present.
10269
10521
  * @example
10270
10522
  * This example creates a Queries object outside the application, which is used
10271
10523
  * in the ResultSortedTableView component by reference. A change to the data in
@@ -10381,15 +10633,15 @@ export function ResultSortedTableView(
10381
10633
  ): ComponentReturnType;
10382
10634
 
10383
10635
  /**
10384
- * The ResultTableView component renders the contents of a single query's result
10385
- * Table in a Queries object, and registers a listener so that any changes to
10386
- * that result will cause a re-render.
10636
+ * The ResultTableView component renders the contents of a single query's
10637
+ * ResultTable in a Queries object, and registers a listener so that any changes
10638
+ * to that result will cause a re-render.
10387
10639
  *
10388
- * The component's props identify which Table to render based on query Id, and
10389
- * Queries object (which is either the default context Queries object, a named
10390
- * context Queries object, or by explicit reference).
10640
+ * The component's props identify which ResultTable to render based on query Id,
10641
+ * and Queries object (which is either the default context Queries object, a
10642
+ * named context Queries object, or by explicit reference).
10391
10643
  *
10392
- * This component renders a result Table by iterating over its Row objects. By
10644
+ * This component renders a ResultTable by iterating over its Row objects. By
10393
10645
  * default these are in turn rendered with the ResultRowView component, but you
10394
10646
  * can override this behavior by providing a `resultRowComponent` prop, a custom
10395
10647
  * component of your own that will render a Row based on ResultRowProps. You can
@@ -10397,9 +10649,9 @@ export function ResultSortedTableView(
10397
10649
  * `getResultRowComponentProps` callback prop.
10398
10650
  *
10399
10651
  * This component uses the useResultRowIds hook under the covers, which means
10400
- * that any changes to the structure of the result Table will cause a re-render.
10652
+ * that any changes to the structure of the ResultTable will cause a re-render.
10401
10653
  * @param props The props for this component.
10402
- * @returns A rendering of the result Table, or nothing, if not present.
10654
+ * @returns A rendering of the ResultTable, or nothing, if not present.
10403
10655
  * @example
10404
10656
  * This example creates a Queries object outside the application, which is used
10405
10657
  * in the ResultTableView component by reference. A change to the data in the