tinybase 4.1.0-beta.1 → 4.1.0-beta.3

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 (219) hide show
  1. package/bin/cli.js +1 -1
  2. package/lib/checkpoints.js +1 -1
  3. package/lib/checkpoints.js.gz +0 -0
  4. package/lib/cjs/checkpoints.cjs +1 -1
  5. package/lib/cjs/checkpoints.cjs.gz +0 -0
  6. package/lib/cjs/indexes.cjs +1 -1
  7. package/lib/cjs/indexes.cjs.gz +0 -0
  8. package/lib/cjs/metrics.cjs +1 -1
  9. package/lib/cjs/metrics.cjs.gz +0 -0
  10. package/lib/cjs/persisters/persister-browser.cjs +1 -1
  11. package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
  12. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  13. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  14. package/lib/cjs/persisters/persister-file.cjs +1 -1
  15. package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
  16. package/lib/cjs/persisters/persister-remote.cjs +1 -1
  17. package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
  18. package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
  19. package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  20. package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
  21. package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
  22. package/lib/cjs/queries.cjs +1 -1
  23. package/lib/cjs/queries.cjs.gz +0 -0
  24. package/lib/cjs/relationships.cjs +1 -1
  25. package/lib/cjs/relationships.cjs.gz +0 -0
  26. package/lib/cjs/store.cjs +1 -1
  27. package/lib/cjs/store.cjs.gz +0 -0
  28. package/lib/cjs/tinybase.cjs +1 -1
  29. package/lib/cjs/tinybase.cjs.gz +0 -0
  30. package/lib/cjs/tools.cjs +1 -1
  31. package/lib/cjs/tools.cjs.gz +0 -0
  32. package/lib/cjs/ui-react-dom.cjs +1 -1
  33. package/lib/cjs/ui-react-dom.cjs.gz +0 -0
  34. package/lib/cjs/ui-react.cjs +1 -1
  35. package/lib/cjs/ui-react.cjs.gz +0 -0
  36. package/lib/cjs-es6/checkpoints.cjs +1 -1
  37. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  38. package/lib/cjs-es6/indexes.cjs +1 -1
  39. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  40. package/lib/cjs-es6/metrics.cjs +1 -1
  41. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  42. package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
  43. package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
  44. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  45. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  46. package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
  47. package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
  48. package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
  49. package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
  50. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
  51. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  52. package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
  53. package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
  54. package/lib/cjs-es6/queries.cjs +1 -1
  55. package/lib/cjs-es6/queries.cjs.gz +0 -0
  56. package/lib/cjs-es6/relationships.cjs +1 -1
  57. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  58. package/lib/cjs-es6/store.cjs +1 -1
  59. package/lib/cjs-es6/store.cjs.gz +0 -0
  60. package/lib/cjs-es6/tinybase.cjs +1 -1
  61. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  62. package/lib/cjs-es6/tools.cjs +1 -1
  63. package/lib/cjs-es6/tools.cjs.gz +0 -0
  64. package/lib/cjs-es6/ui-react-dom.cjs +1 -1
  65. package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
  66. package/lib/cjs-es6/ui-react.cjs +1 -1
  67. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  68. package/lib/debug/checkpoints.js +6 -6
  69. package/lib/debug/indexes.js +7 -7
  70. package/lib/debug/metrics.js +12 -12
  71. package/lib/debug/persisters/persister-browser.js +10 -19
  72. package/lib/debug/persisters/persister-cr-sqlite-wasm.js +6 -15
  73. package/lib/debug/persisters/persister-file.js +10 -19
  74. package/lib/debug/persisters/persister-remote.js +10 -19
  75. package/lib/debug/persisters/persister-sqlite-wasm.js +6 -15
  76. package/lib/debug/persisters/persister-sqlite3.js +6 -15
  77. package/lib/debug/persisters.js +4 -4
  78. package/lib/debug/queries.js +1 -0
  79. package/lib/debug/relationships.js +7 -7
  80. package/lib/debug/store.js +16 -24
  81. package/lib/debug/tinybase.js +21 -28
  82. package/lib/debug/tools.js +14 -13
  83. package/lib/debug/ui-react-dom.js +253 -33
  84. package/lib/debug/ui-react.js +26 -4
  85. package/lib/es6/checkpoints.js +1 -1
  86. package/lib/es6/checkpoints.js.gz +0 -0
  87. package/lib/es6/indexes.js +1 -1
  88. package/lib/es6/indexes.js.gz +0 -0
  89. package/lib/es6/metrics.js +1 -1
  90. package/lib/es6/metrics.js.gz +0 -0
  91. package/lib/es6/persisters/persister-browser.js +1 -1
  92. package/lib/es6/persisters/persister-browser.js.gz +0 -0
  93. package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  94. package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  95. package/lib/es6/persisters/persister-file.js +1 -1
  96. package/lib/es6/persisters/persister-file.js.gz +0 -0
  97. package/lib/es6/persisters/persister-remote.js +1 -1
  98. package/lib/es6/persisters/persister-remote.js.gz +0 -0
  99. package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
  100. package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  101. package/lib/es6/persisters/persister-sqlite3.js +1 -1
  102. package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
  103. package/lib/es6/queries.js +1 -1
  104. package/lib/es6/queries.js.gz +0 -0
  105. package/lib/es6/relationships.js +1 -1
  106. package/lib/es6/relationships.js.gz +0 -0
  107. package/lib/es6/store.js +1 -1
  108. package/lib/es6/store.js.gz +0 -0
  109. package/lib/es6/tinybase.js +1 -1
  110. package/lib/es6/tinybase.js.gz +0 -0
  111. package/lib/es6/tools.js +1 -1
  112. package/lib/es6/tools.js.gz +0 -0
  113. package/lib/es6/ui-react-dom.js +1 -1
  114. package/lib/es6/ui-react-dom.js.gz +0 -0
  115. package/lib/es6/ui-react.js +1 -1
  116. package/lib/es6/ui-react.js.gz +0 -0
  117. package/lib/indexes.js +1 -1
  118. package/lib/indexes.js.gz +0 -0
  119. package/lib/metrics.js +1 -1
  120. package/lib/metrics.js.gz +0 -0
  121. package/lib/persisters/persister-browser.js +1 -1
  122. package/lib/persisters/persister-browser.js.gz +0 -0
  123. package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
  124. package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  125. package/lib/persisters/persister-file.js +1 -1
  126. package/lib/persisters/persister-file.js.gz +0 -0
  127. package/lib/persisters/persister-remote.js +1 -1
  128. package/lib/persisters/persister-remote.js.gz +0 -0
  129. package/lib/persisters/persister-sqlite-wasm.js +1 -1
  130. package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
  131. package/lib/persisters/persister-sqlite3.js +1 -1
  132. package/lib/persisters/persister-sqlite3.js.gz +0 -0
  133. package/lib/queries.js +1 -1
  134. package/lib/queries.js.gz +0 -0
  135. package/lib/relationships.js +1 -1
  136. package/lib/relationships.js.gz +0 -0
  137. package/lib/store.js +1 -1
  138. package/lib/store.js.gz +0 -0
  139. package/lib/tinybase.js +1 -1
  140. package/lib/tinybase.js.gz +0 -0
  141. package/lib/tools.js +1 -1
  142. package/lib/tools.js.gz +0 -0
  143. package/lib/types/queries.d.ts +167 -0
  144. package/lib/types/ui-react-dom.d.ts +568 -70
  145. package/lib/types/ui-react.d.ts +269 -58
  146. package/lib/types/with-schemas/internal/ui-react.d.ts +32 -22
  147. package/lib/types/with-schemas/queries.d.ts +185 -0
  148. package/lib/types/with-schemas/ui-react-dom.d.ts +647 -93
  149. package/lib/types/with-schemas/ui-react.d.ts +281 -50
  150. package/lib/ui-react-dom.js +1 -1
  151. package/lib/ui-react-dom.js.gz +0 -0
  152. package/lib/ui-react.js +1 -1
  153. package/lib/ui-react.js.gz +0 -0
  154. package/lib/umd/checkpoints.js +1 -1
  155. package/lib/umd/checkpoints.js.gz +0 -0
  156. package/lib/umd/indexes.js +1 -1
  157. package/lib/umd/indexes.js.gz +0 -0
  158. package/lib/umd/metrics.js +1 -1
  159. package/lib/umd/metrics.js.gz +0 -0
  160. package/lib/umd/persisters/persister-browser.js +1 -1
  161. package/lib/umd/persisters/persister-browser.js.gz +0 -0
  162. package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
  163. package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  164. package/lib/umd/persisters/persister-file.js +1 -1
  165. package/lib/umd/persisters/persister-file.js.gz +0 -0
  166. package/lib/umd/persisters/persister-remote.js +1 -1
  167. package/lib/umd/persisters/persister-remote.js.gz +0 -0
  168. package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
  169. package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
  170. package/lib/umd/persisters/persister-sqlite3.js +1 -1
  171. package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
  172. package/lib/umd/queries.js +1 -1
  173. package/lib/umd/queries.js.gz +0 -0
  174. package/lib/umd/relationships.js +1 -1
  175. package/lib/umd/relationships.js.gz +0 -0
  176. package/lib/umd/store.js +1 -1
  177. package/lib/umd/store.js.gz +0 -0
  178. package/lib/umd/tinybase.js +1 -1
  179. package/lib/umd/tinybase.js.gz +0 -0
  180. package/lib/umd/tools.js +1 -1
  181. package/lib/umd/tools.js.gz +0 -0
  182. package/lib/umd/ui-react-dom.js +1 -1
  183. package/lib/umd/ui-react-dom.js.gz +0 -0
  184. package/lib/umd/ui-react.js +1 -1
  185. package/lib/umd/ui-react.js.gz +0 -0
  186. package/lib/umd-es6/checkpoints.js +1 -1
  187. package/lib/umd-es6/checkpoints.js.gz +0 -0
  188. package/lib/umd-es6/indexes.js +1 -1
  189. package/lib/umd-es6/indexes.js.gz +0 -0
  190. package/lib/umd-es6/metrics.js +1 -1
  191. package/lib/umd-es6/metrics.js.gz +0 -0
  192. package/lib/umd-es6/persisters/persister-browser.js +1 -1
  193. package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
  194. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  195. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  196. package/lib/umd-es6/persisters/persister-file.js +1 -1
  197. package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
  198. package/lib/umd-es6/persisters/persister-remote.js +1 -1
  199. package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
  200. package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
  201. package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  202. package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
  203. package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
  204. package/lib/umd-es6/queries.js +1 -1
  205. package/lib/umd-es6/queries.js.gz +0 -0
  206. package/lib/umd-es6/relationships.js +1 -1
  207. package/lib/umd-es6/relationships.js.gz +0 -0
  208. package/lib/umd-es6/store.js +1 -1
  209. package/lib/umd-es6/store.js.gz +0 -0
  210. package/lib/umd-es6/tinybase.js +1 -1
  211. package/lib/umd-es6/tinybase.js.gz +0 -0
  212. package/lib/umd-es6/tools.js +1 -1
  213. package/lib/umd-es6/tools.js.gz +0 -0
  214. package/lib/umd-es6/ui-react-dom.js +1 -1
  215. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  216. package/lib/umd-es6/ui-react.js +1 -1
  217. package/lib/umd-es6/ui-react.js.gz +0 -0
  218. package/package.json +17 -17
  219. package/readme.md +2 -2
@@ -112,6 +112,7 @@ import {
112
112
  ResultRowIdsListener,
113
113
  ResultRowListener,
114
114
  ResultTable,
115
+ ResultTableCellIdsListener,
115
116
  ResultTableListener,
116
117
  } from './queries.d';
117
118
  import {Persister} from './persisters.d';
@@ -6099,7 +6100,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6099
6100
 
6100
6101
  /**
6101
6102
  * The useResultTable hook returns an object containing the entire data of the
6102
- * result Table of the given query, and registers a listener so that any changes
6103
+ * ResultTable of the given query, and registers a listener so that any changes
6103
6104
  * to that result will cause a re-render.
6104
6105
  *
6105
6106
  * This has schema-based typing. The following is a simplified representation:
@@ -6125,7 +6126,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6125
6126
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
6126
6127
  * default context Queries object, provide an Id for a named context Queries
6127
6128
  * object, or provide an explicit reference.
6128
- * @returns An object containing the entire data of the result Table.
6129
+ * @returns An object containing the entire data of the ResultTable.
6129
6130
  * @example
6130
6131
  * This example creates a Queries object outside the application, which is used
6131
6132
  * in the useTable hook by reference. A change to the data in the query
@@ -6226,7 +6227,145 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6226
6227
  ) => ResultTable;
6227
6228
 
6228
6229
  /**
6229
- * The useResultRowIds hook returns the Ids of every Row in the result Table of
6230
+ * The useResultTableCellIds hook returns the Ids of every Cell used across the
6231
+ * whole ResultTable of the given query, and registers a listener so that any
6232
+ * changes to those Ids will cause a re-render.
6233
+ *
6234
+ * This has schema-based typing. The following is a simplified representation:
6235
+ *
6236
+ * ```ts override
6237
+ * useResultTableCellIds(
6238
+ * queryId: Id,
6239
+ * queriesOrQueriesId?: QueriesOrQueriesId,
6240
+ * ): Ids;
6241
+ * ```
6242
+ *
6243
+ * A Provider component is used to wrap part of an application in a context, and
6244
+ * it can contain a default Queries object or a set of Queries objects named by
6245
+ * Id. The useResultTableCellIds hook lets you indicate which Queries object to
6246
+ * get data for: omit the final optional final parameter for the default context
6247
+ * Queries object, provide an Id for a named context Queries object, or provide
6248
+ * a Queries object explicitly by reference.
6249
+ *
6250
+ * When first rendered, this hook will create a listener so that changes to the
6251
+ * result Cell Ids will cause a re-render. When the component containing this
6252
+ * hook is unmounted, the listener will be automatically removed.
6253
+ * @param queryId The Id of the query.
6254
+ * @param queriesOrQueriesId The Queries object to be accessed: omit for the
6255
+ * default context Queries object, provide an Id for a named context Queries
6256
+ * object, or provide an explicit reference. See the
6257
+ * addResultTableCellIdsListener method for more details.
6258
+ * @returns An array of the Ids of every Cell in the result of the query.
6259
+ * @example
6260
+ * This example creates a Queries object outside the application, which is used
6261
+ * in the useResultTableCellIds hook by reference. A change to the data in the
6262
+ * query re-renders the component.
6263
+ *
6264
+ * ```jsx
6265
+ * const store = createStore().setTable('pets', {
6266
+ * fido: {species: 'dog', color: 'brown'},
6267
+ * felix: {species: 'cat', color: 'black'},
6268
+ * cujo: {species: 'dog', color: 'black'},
6269
+ * });
6270
+ * const queries = createQueries(store).setQueryDefinition(
6271
+ * 'dogColorsAndLegs',
6272
+ * 'pets',
6273
+ * ({select, where}) => {
6274
+ * select('color');
6275
+ * select('legs');
6276
+ * where('species', 'dog');
6277
+ * },
6278
+ * );
6279
+ * const App = () => (
6280
+ * <span>
6281
+ * {JSON.stringify(useResultTableCellIds('dogColorsAndLegs', queries))}
6282
+ * </span>
6283
+ * );
6284
+ *
6285
+ * const app = document.createElement('div');
6286
+ * ReactDOMClient.createRoot(app).render(<App />); // !act
6287
+ * console.log(app.innerHTML);
6288
+ * // -> '<span>["color"]</span>'
6289
+ *
6290
+ * store.setCell('pets', 'cujo', 'legs', 4); // !act
6291
+ * console.log(app.innerHTML);
6292
+ * // -> '<span>["color","legs"]</span>'
6293
+ * ```
6294
+ * @example
6295
+ * This example creates a Provider context into which a default Queries object
6296
+ * is provided. A component within it then uses the useResultTableCellIds hook.
6297
+ *
6298
+ * ```jsx
6299
+ * const App = ({queries}) => (
6300
+ * <Provider queries={queries}>
6301
+ * <Pane />
6302
+ * </Provider>
6303
+ * );
6304
+ * const Pane = () => (
6305
+ * <span>{JSON.stringify(useResultTableCellIds('dogColorsAndLegs'))}</span>
6306
+ * );
6307
+ *
6308
+ * const queries = createQueries(
6309
+ * createStore().setTable('pets', {
6310
+ * fido: {species: 'dog', color: 'brown'},
6311
+ * felix: {species: 'cat', color: 'black'},
6312
+ * cujo: {species: 'dog', color: 'black', legs: 4},
6313
+ * }),
6314
+ * ).setQueryDefinition('dogColorsAndLegs', 'pets', ({select, where}) => {
6315
+ * select('color');
6316
+ * select('legs');
6317
+ * where('species', 'dog');
6318
+ * });
6319
+ * const app = document.createElement('div');
6320
+ * ReactDOMClient.createRoot(app).render(<App queries={queries} />); // !act
6321
+ * console.log(app.innerHTML);
6322
+ * // -> '<span>["color","legs"]</span>'
6323
+ * ```
6324
+ * @example
6325
+ * This example creates a Provider context into which a Queries object is
6326
+ * provided, named by Id. A component within it then uses the
6327
+ * useResultTableCellIds hook.
6328
+ *
6329
+ * ```jsx
6330
+ * const App = ({queries}) => (
6331
+ * <Provider queriesById={{petQueries: queries}}>
6332
+ * <Pane />
6333
+ * </Provider>
6334
+ * );
6335
+ * const Pane = () => (
6336
+ * <span>
6337
+ * {JSON.stringify(
6338
+ * useResultTableCellIds('dogColorsAndLegs', 'petQueries'),
6339
+ * )}
6340
+ * </span>
6341
+ * );
6342
+ *
6343
+ * const queries = createQueries(
6344
+ * createStore().setTable('pets', {
6345
+ * fido: {species: 'dog', color: 'brown'},
6346
+ * felix: {species: 'cat', color: 'black'},
6347
+ * cujo: {species: 'dog', color: 'black', legs: 4},
6348
+ * }),
6349
+ * ).setQueryDefinition('dogColorsAndLegs', 'pets', ({select, where}) => {
6350
+ * select('color');
6351
+ * select('legs');
6352
+ * where('species', 'dog');
6353
+ * });
6354
+ * const app = document.createElement('div');
6355
+ * ReactDOMClient.createRoot(app).render(<App queries={queries} />); // !act
6356
+ * console.log(app.innerHTML);
6357
+ * // -> '<span>["color","legs"]</span>'
6358
+ * ```
6359
+ * @category Queries hooks
6360
+ * @since v4.1.0
6361
+ */
6362
+ useResultTableCellIds: (
6363
+ queryId: Id,
6364
+ queriesOrQueriesId?: QueriesOrQueriesId<Schemas>,
6365
+ ) => Ids;
6366
+
6367
+ /**
6368
+ * The useResultRowIds hook returns the Ids of every Row in the ResultTable of
6230
6369
  * the given query, and registers a listener so that any changes to those Ids
6231
6370
  * will cause a re-render.
6232
6371
  *
@@ -6356,7 +6495,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6356
6495
 
6357
6496
  /**
6358
6497
  * The useResultSortedRowIds hook returns the sorted (and optionally, paginated)
6359
- * Ids of every Row in the result Table of the given query, and registers a
6498
+ * Ids of every Row in the ResultTable of the given query, and registers a
6360
6499
  * listener so that any changes to those Ids will cause a re-render.
6361
6500
  *
6362
6501
  * This has schema-based typing. The following is a simplified representation:
@@ -6520,9 +6659,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6520
6659
  ) => Ids;
6521
6660
 
6522
6661
  /**
6523
- * The useResultRow hook returns an object containing the data of a
6524
- * single Row in the result Table of the given query, and registers a listener
6525
- * so that any changes to that Row will cause a re-render.
6662
+ * The useResultRow hook returns an object containing the data of a single Row
6663
+ * in the ResultTable of the given query, and registers a listener so that any
6664
+ * changes to that Row will cause a re-render.
6526
6665
  *
6527
6666
  * This has schema-based typing. The following is a simplified representation:
6528
6667
  *
@@ -6545,11 +6684,11 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6545
6684
  * result Row will cause a re-render. When the component containing this hook is
6546
6685
  * unmounted, the listener will be automatically removed.
6547
6686
  * @param queryId The Id of the query.
6548
- * @param rowId The Id of the Row in the result Table.
6687
+ * @param rowId The Id of the Row in the ResultTable.
6549
6688
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
6550
6689
  * default context Queries object, provide an Id for a named context Queries
6551
6690
  * object, or provide an explicit reference.
6552
- * @returns An object containing the entire data of the Row in the result Table
6691
+ * @returns An object containing the entire data of the Row in the ResultTable
6553
6692
  * of the query.
6554
6693
  * @example
6555
6694
  * This example creates a Queries object outside the application, which is used
@@ -6655,7 +6794,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6655
6794
 
6656
6795
  /**
6657
6796
  * The useResultCellIds hook returns the Ids of every Cell in a given Row in the
6658
- * result Table of the given query, and registers a listener so that any changes
6797
+ * ResultTable of the given query, and registers a listener so that any changes
6659
6798
  * to those Ids will cause a re-render.
6660
6799
  *
6661
6800
  * This has schema-based typing. The following is a simplified representation:
@@ -6679,7 +6818,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6679
6818
  * result Cell Ids will cause a re-render. When the component containing this
6680
6819
  * hook is unmounted, the listener will be automatically removed.
6681
6820
  * @param queryId The Id of the query.
6682
- * @param rowId The Id of the Row in the result Table.
6821
+ * @param rowId The Id of the Row in the ResultTable.
6683
6822
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
6684
6823
  * default context Queries object, provide an Id for a named context Queries
6685
6824
  * object, or provide an explicit reference.
@@ -6795,7 +6934,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6795
6934
 
6796
6935
  /**
6797
6936
  * The useResultCell hook returns the value of a single Cell in a given Row in
6798
- * the result Table of the given query, and registers a listener so that any
6937
+ * the ResultTable of the given query, and registers a listener so that any
6799
6938
  * changes to that value will cause a re-render.
6800
6939
  *
6801
6940
  * This has schema-based typing. The following is a simplified representation:
@@ -6820,7 +6959,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6820
6959
  * result Cell will cause a re-render. When the component containing this hook
6821
6960
  * is unmounted, the listener will be automatically removed.
6822
6961
  * @param queryId The Id of the query.
6823
- * @param rowId The Id of the Row in the result Table.
6962
+ * @param rowId The Id of the Row in the ResultTable.
6824
6963
  * @param cellId The Id of the Cell in the Row.
6825
6964
  * @param queriesOrQueriesId The Queries object to be accessed: omit for the
6826
6965
  * default context Queries object, provide an Id for a named context Queries
@@ -6933,7 +7072,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6933
7072
 
6934
7073
  /**
6935
7074
  * The useResultTableListener hook registers a listener function with a Queries
6936
- * object that will be called whenever data in a result Table changes.
7075
+ * object that will be called whenever data in a ResultTable changes.
6937
7076
  *
6938
7077
  * This has schema-based typing. The following is a simplified representation:
6939
7078
  *
@@ -6950,8 +7089,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6950
7089
  * own specific listener to do more than simply tracking the value (which is
6951
7090
  * more easily done with the useResultTable hook).
6952
7091
  *
6953
- * You can either listen to a single result Table (by specifying a query Id as
6954
- * the method's first parameter) or changes to any result Table (by providing a
7092
+ * You can either listen to a single ResultTable (by specifying a query Id as
7093
+ * the method's first parameter) or changes to any ResultTable (by providing a
6955
7094
  * `null` wildcard).
6956
7095
  *
6957
7096
  * Unlike the addResultTableListener method, which returns a listener Id and
@@ -6961,7 +7100,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
6961
7100
  * Queries object will be deleted.
6962
7101
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
6963
7102
  * @param listener The function that will be called whenever data in the
6964
- * matching result Table changes.
7103
+ * matching ResultTable changes.
6965
7104
  * @param listenerDeps An optional array of dependencies for the `listener`
6966
7105
  * function, which, if any change, result in the re-registration of the
6967
7106
  * listener. This parameter defaults to an empty array.
@@ -7019,9 +7158,101 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7019
7158
  queriesOrQueriesId?: QueriesOrQueriesId<Schemas>,
7020
7159
  ) => void;
7021
7160
 
7161
+ /**
7162
+ * The useResultTableCellIdsListener hook registers a listener function with a
7163
+ * Queries object that will be called whenever the Cell Ids that appear anywhere
7164
+ * in a ResultTable change.
7165
+ *
7166
+ * This has schema-based typing. The following is a simplified representation:
7167
+ *
7168
+ * ```ts override
7169
+ * useResultTableCellIdsListener(
7170
+ * queryId: IdOrNull,
7171
+ * listener: ResultTableCellIdsListener,
7172
+ * listenerDeps?: React.DependencyList,
7173
+ * queriesOrQueriesId?: QueriesOrQueriesId,
7174
+ * ): void;
7175
+ * ```
7176
+ *
7177
+ * This hook is useful for situations where a component needs to register its
7178
+ * own specific listener to do more than simply tracking the value (which is
7179
+ * more easily done with the useResultTableCellIds hook).
7180
+ *
7181
+ * You can either listen to a single ResultTable (by specifying a query Id as
7182
+ * the method's first parameter) or changes to any ResultTable (by providing a
7183
+ * `null` wildcard).
7184
+ *
7185
+ * Unlike the addResultTableCellIdsListener method, which returns a listener Id
7186
+ * and requires you to remove it manually, the useResultTableCellIdsListener
7187
+ * hook manages this lifecycle for you: when the listener changes (per its
7188
+ * `listenerDeps` dependencies) or the component unmounts, the listener on the
7189
+ * underlying Queries object will be deleted.
7190
+ * @param queryId The Id of the query to listen to, or `null` as a wildcard.
7191
+ * @param listener The function that will be called whenever the Cell Ids that
7192
+ * appear anywhere in the ResultTable change.
7193
+ * @param listenerDeps An optional array of dependencies for the `listener`
7194
+ * function, which, if any change, result in the re-registration of the
7195
+ * listener. This parameter defaults to an empty array.
7196
+ * @param queriesOrQueriesId The Queries object to register the listener with:
7197
+ * omit for the default context Queries object, provide an Id for a named
7198
+ * context Queries object, or provide an explicit reference.
7199
+ * @example
7200
+ * This example uses the useResultTableCellIdsListener hook to create a listener
7201
+ * that is scoped to a single component. When the component is unmounted, the
7202
+ * listener is removed from the Queries object.
7203
+ *
7204
+ * ```jsx
7205
+ * const App = ({queries}) => (
7206
+ * <Provider queries={queries}>
7207
+ * <Pane />
7208
+ * </Provider>
7209
+ * );
7210
+ * const Pane = () => {
7211
+ * useResultTableCellIdsListener('petColorsAndLegs', () =>
7212
+ * console.log('Result Cell Ids changed'),
7213
+ * );
7214
+ * return <span>App</span>;
7215
+ * };
7216
+ *
7217
+ * const store = createStore().setTable('pets', {
7218
+ * fido: {species: 'dog', color: 'brown'},
7219
+ * felix: {species: 'cat', color: 'black'},
7220
+ * cujo: {species: 'dog', color: 'black'},
7221
+ * });
7222
+ * const queries = createQueries(store).setQueryDefinition(
7223
+ * 'petColorsAndLegs',
7224
+ * 'pets',
7225
+ * ({select}) => {
7226
+ * select('color');
7227
+ * select('legs');
7228
+ * },
7229
+ * );
7230
+ * const app = document.createElement('div');
7231
+ * const root = ReactDOMClient.createRoot(app);
7232
+ * root.render(<App queries={queries} />); // !act
7233
+ * console.log(queries.getListenerStats().tableCellIds);
7234
+ * // -> 1
7235
+ *
7236
+ * store.setCell('pets', 'cujo', 'legs', 4); // !act
7237
+ * // -> 'Result Cell Ids changed'
7238
+ *
7239
+ * root.unmount(); // !act
7240
+ * console.log(queries.getListenerStats().tableCellIds);
7241
+ * // -> 0
7242
+ * ```
7243
+ * @category Queries hooks
7244
+ * @since v4.1.0
7245
+ */
7246
+ useResultTableCellIdsListener: (
7247
+ queryId: IdOrNull,
7248
+ listener: ResultTableCellIdsListener<Schemas>,
7249
+ listenerDeps?: React.DependencyList,
7250
+ queriesOrQueriesId?: QueriesOrQueriesId<Schemas>,
7251
+ ) => void;
7252
+
7022
7253
  /**
7023
7254
  * The useResultRowIdsListener hook registers a listener function with a Queries
7024
- * object that will be called whenever the Row Ids in a result Table change.
7255
+ * object that will be called whenever the Row Ids in a ResultTable change.
7025
7256
  *
7026
7257
  * This has schema-based typing. The following is a simplified representation:
7027
7258
  *
@@ -7038,8 +7269,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7038
7269
  * own specific listener to do more than simply tracking the value (which is
7039
7270
  * more easily done with the useResultRowIds hook).
7040
7271
  *
7041
- * You can either listen to a single result Table (by specifying a query Id as
7042
- * the method's first parameter) or changes to any result Table (by providing a
7272
+ * You can either listen to a single ResultTable (by specifying a query Id as
7273
+ * the method's first parameter) or changes to any ResultTable (by providing a
7043
7274
  * `null` wildcard).
7044
7275
  *
7045
7276
  * Unlike the addResultRowIdsListener method, which returns a listener Id and
@@ -7049,7 +7280,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7049
7280
  * Queries object will be deleted.
7050
7281
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
7051
7282
  * @param listener The function that will be called whenever the Row Ids in the
7052
- * matching result Table change.
7283
+ * matching ResultTable change.
7053
7284
  * @param listenerDeps An optional array of dependencies for the `listener`
7054
7285
  * function, which, if any change, result in the re-registration of the
7055
7286
  * listener. This parameter defaults to an empty array.
@@ -7110,7 +7341,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7110
7341
  /**
7111
7342
  * The useResultSortedRowIdsListener hook registers a listener function with a
7112
7343
  * Queries object that will be called whenever the sorted (and optionally,
7113
- * paginated) Row Ids in a result Table change.
7344
+ * paginated) Row Ids in a ResultTable change.
7114
7345
  *
7115
7346
  * This has schema-based typing. The following is a simplified representation:
7116
7347
  *
@@ -7143,7 +7374,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7143
7374
  * @param offset The number of Row Ids to skip for pagination purposes, if any.
7144
7375
  * @param limit The maximum number of Row Ids to return, or `undefined` for all.
7145
7376
  * @param listener The function that will be called whenever the Row Ids in the
7146
- * matching result Table change.
7377
+ * matching ResultTable change.
7147
7378
  * @param listenerDeps An optional array of dependencies for the `listener`
7148
7379
  * function, which, if any change, result in the re-registration of the
7149
7380
  * listener. This parameter defaults to an empty array.
@@ -7340,7 +7571,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7340
7571
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
7341
7572
  * @param rowId The Id of the result Row to listen to, or `null` as a wildcard.
7342
7573
  * @param listener The function that will be called whenever the Row Ids in the
7343
- * matching result Table change.
7574
+ * matching ResultTable change.
7344
7575
  * @param listenerDeps An optional array of dependencies for the `listener`
7345
7576
  * function, which, if any change, result in the re-registration of the
7346
7577
  * listener. This parameter defaults to an empty array.
@@ -8723,7 +8954,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8723
8954
 
8724
8955
  /**
8725
8956
  * ResultTableProps props are used for components that refer to a single query
8726
- * result Table, such as the ResultTableView component.
8957
+ * ResultTable, such as the ResultTableView component.
8727
8958
  * @category Props
8728
8959
  * @since v2.0.0
8729
8960
  */
@@ -8731,7 +8962,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8731
8962
 
8732
8963
  /**
8733
8964
  * ResultSortedTableProps props are used for components that refer to a single
8734
- * sorted query result Table, such as the ResultSortedTableView component.
8965
+ * sorted query ResultTable, such as the ResultSortedTableView component.
8735
8966
  * @category Props
8736
8967
  * @since v2.0.0
8737
8968
  */
@@ -8739,7 +8970,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8739
8970
 
8740
8971
  /**
8741
8972
  * ResultRowProps props are used for components that refer to a single Row in a
8742
- * query result Table, such as the ResultRowView component.
8973
+ * query ResultTable, such as the ResultRowView component.
8743
8974
  * @category Props
8744
8975
  * @since v2.0.0
8745
8976
  */
@@ -8747,7 +8978,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8747
8978
 
8748
8979
  /**
8749
8980
  * ResultRowProps props are used for components that refer to a single Cell in a
8750
- * Row of a result Table, such as the ResultCellView component.
8981
+ * Row of a ResultTable, such as the ResultCellView component.
8751
8982
  * @category Props
8752
8983
  * @since v2.0.0
8753
8984
  */
@@ -10516,7 +10747,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10516
10747
 
10517
10748
  /**
10518
10749
  * The ResultCellView component renders the value of a single Cell in a given
10519
- * Row, in a given query's result Table, and registers a listener so that any
10750
+ * Row, in a given query's ResultTable, and registers a listener so that any
10520
10751
  * changes to that result will cause a re-render.
10521
10752
  *
10522
10753
  * This has schema-based typing. The following is a simplified representation:
@@ -10644,7 +10875,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10644
10875
 
10645
10876
  /**
10646
10877
  * The ResultRowView component renders the contents of a single Row in a given
10647
- * query's result Table, and registers a listener so that any changes to that
10878
+ * query's ResultTable, and registers a listener so that any changes to that
10648
10879
  * result will cause a re-render.
10649
10880
  *
10650
10881
  * This has schema-based typing. The following is a simplified representation:
@@ -10796,7 +11027,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10796
11027
 
10797
11028
  /**
10798
11029
  * The ResultSortedTableView component renders the contents of a single query's
10799
- * sorted result Table in a Queries object, and registers a listener so that any
11030
+ * sorted ResultTable in a Queries object, and registers a listener so that any
10800
11031
  * changes to that result will cause a re-render.
10801
11032
  *
10802
11033
  * This has schema-based typing. The following is a simplified representation:
@@ -10807,15 +11038,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10807
11038
  * ): ComponentReturnType;
10808
11039
  * ```
10809
11040
  *
10810
- * The component's props identify which Table to render based on query Id, and
10811
- * Queries object (which is either the default context Queries object, a named
10812
- * context Queries object, or by explicit reference). It also takes a Cell Id to
10813
- * sort by and a boolean to indicate that the sorting should be in descending
10814
- * order. The `offset` and `limit` props are used to paginate results, but
10815
- * default to `0` and `undefined` to return all available Row Ids if not
10816
- * specified.
11041
+ * The component's props identify which ResultTable to render based on query Id,
11042
+ * and Queries object (which is either the default context Queries object, a
11043
+ * named context Queries object, or by explicit reference). It also takes a Cell
11044
+ * Id to sort by and a boolean to indicate that the sorting should be in
11045
+ * descending order. The `offset` and `limit` props are used to paginate
11046
+ * results, but default to `0` and `undefined` to return all available Row Ids
11047
+ * if not specified.
10817
11048
  *
10818
- * This component renders a result Table by iterating over its Row objects, in
11049
+ * This component renders a ResultTable by iterating over its Row objects, in
10819
11050
  * the order dictated by the sort parameters. By default these are in turn
10820
11051
  * rendered with the ResultRowView component, but you can override this behavior
10821
11052
  * by providing a `resultRowComponent` prop, a custom component of your own that
@@ -10823,10 +11054,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10823
11054
  * to your custom component with the `getResultRowComponentProps` callback prop.
10824
11055
  *
10825
11056
  * This component uses the useResultSortedRowIds hook under the covers, which
10826
- * means that any changes to the structure or sorting of the result Table will
11057
+ * means that any changes to the structure or sorting of the ResultTable will
10827
11058
  * cause a re-render.
10828
11059
  * @param props The props for this component.
10829
- * @returns A rendering of the result Table, or nothing, if not present.
11060
+ * @returns A rendering of the ResultTable, or nothing, if not present.
10830
11061
  * @example
10831
11062
  * This example creates a Queries object outside the application, which is used
10832
11063
  * in the ResultSortedTableView component by reference. A change to the data in
@@ -10942,9 +11173,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10942
11173
  ) => ComponentReturnType;
10943
11174
 
10944
11175
  /**
10945
- * The ResultTableView component renders the contents of a single query's result
10946
- * Table in a Queries object, and registers a listener so that any changes to
10947
- * that result will cause a re-render.
11176
+ * The ResultTableView component renders the contents of a single query's
11177
+ * ResultTable in a Queries object, and registers a listener so that any changes
11178
+ * to that result will cause a re-render.
10948
11179
  *
10949
11180
  * This has schema-based typing. The following is a simplified representation:
10950
11181
  *
@@ -10952,11 +11183,11 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10952
11183
  * ResultTableView(props: ResultTableProps): ComponentReturnType;
10953
11184
  * ```
10954
11185
  *
10955
- * The component's props identify which Table to render based on query Id, and
10956
- * Queries object (which is either the default context Queries object, a named
10957
- * context Queries object, or by explicit reference).
11186
+ * The component's props identify which ResultTable to render based on query Id,
11187
+ * and Queries object (which is either the default context Queries object, a
11188
+ * named context Queries object, or by explicit reference).
10958
11189
  *
10959
- * This component renders a result Table by iterating over its Row objects. By
11190
+ * This component renders a ResultTable by iterating over its Row objects. By
10960
11191
  * default these are in turn rendered with the ResultRowView component, but you
10961
11192
  * can override this behavior by providing a `resultRowComponent` prop, a custom
10962
11193
  * component of your own that will render a Row based on ResultRowProps. You can
@@ -10964,9 +11195,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10964
11195
  * `getResultRowComponentProps` callback prop.
10965
11196
  *
10966
11197
  * This component uses the useResultRowIds hook under the covers, which means
10967
- * that any changes to the structure of the result Table will cause a re-render.
11198
+ * that any changes to the structure of the ResultTable will cause a re-render.
10968
11199
  * @param props The props for this component.
10969
- * @returns A rendering of the result Table, or nothing, if not present.
11200
+ * @returns A rendering of the ResultTable, or nothing, if not present.
10970
11201
  * @example
10971
11202
  * This example creates a Queries object outside the application, which is used
10972
11203
  * in the ResultTableView component by reference. A change to the data in the
@@ -1 +1 @@
1
- import{useRowIds as l,useSortedRowIds as e,useValueIds as t,ValueView as o,useTableCellIds as n,CellView as r}from"./ui-react";import s from"react";const a=(l,e)=>l.map(e),d=l=>null==l,{createContext:u,useContext:c}=s;u([]);const i=(l,...e)=>d(l)?{}:l(...e),{createElement:m,useCallback:C,useState:I}=s,b=(l,e,t)=>{const o=C(l,e);return t?o:void 0},k=(l,e)=>d(l)||l[0]!=e?void 0:`sorted ${l[1]?"de":"a"}scending`,h=({cellId:l,sorting:e,label:t=l??"",onClick:o})=>m("th",{onClick:b((()=>o?.(l)),[o,l],!d(o)),className:k(e,l)},t),p=({tableId:l,rowIds:e,store:t,cellComponent:o=r,getCellComponentProps:s,className:d,headerRow:u,idColumn:c,customCellIds:C,sorting:I,onHeaderThClick:b})=>{const k=n(l,t),p=C??k;return m("table",{className:d},!1===u?null:m("thead",null,m("tr",null,!1===c?null:m(h,{sorting:I,label:"Id",onClick:b}),a(p,(l=>m(h,{key:l,cellId:l,sorting:I,onClick:b}))))),m("tbody",null,a(e,(e=>m("tr",{key:e},!1===c?null:m("th",null,e),a(p,(n=>m("td",{key:n},m(o,{...i(s,e,n),tableId:l,rowId:e,cellId:n,store:t})))))))))},g=({tableId:e,store:t,...o})=>m(p,{...o,tableId:e,store:t,rowIds:l(e,t)}),w=({tableId:l,cellId:t,descending:o,offset:n,limit:r,store:s,sortOnClick:a,...d})=>{const[u,c]=I([t,!!o]),i=b((l=>c([l,l==u[0]&&!u[1]])),[u],a);return m(p,{...d,tableId:l,store:s,rowIds:e(l,...u,n,r,s),sorting:u,onHeaderThClick:i})},y=({store:l,valueComponent:e=o,getValueComponentProps:n,className:r,headerRow:s,idColumn:d})=>m("table",{className:r},!1===s?null:m("thead",null,m("tr",null,!1===d?null:m("th",null,"Id"),m("th",null,"Value"))),m("tbody",null,a(t(l),(t=>m("tr",{key:t},!1===d?null:m("th",null,t),m("td",null,m(e,{...i(n,t),valueId:t,store:l})))))));export{w as SortedTableInHtmlTable,g as TableInHtmlTable,y as ValuesInHtmlTable};
1
+ import{CellView as e,useRowIds as l,useTableCellIds as t,useSortedRowIds as n,useValueIds as r,ValueView as o,ResultCellView as s,useResultRowIds as a,useResultTableCellIds as d,useResultSortedRowIds as u,useCell as i,useSetCellCallback as c,useValue as C,useSetValueCallback as I}from"./ui-react";import m from"react";const b=e=>typeof e,h=b(""),g=b(!0),y=b(0),p="Value",k="currentTarget",f="value",N=isFinite,T=e=>null==e,v=(e,l,t,n)=>e==h?l:e==y?t:n,Q=(e,l)=>e.map(l),w=Object,q=(e=[])=>w.fromEntries(e),O=(e,l)=>Q(w.entries(e),(([e,t])=>l(t,e))),{createContext:x,useContext:H}=m;x([]);const A=(e,...l)=>T(e)?{}:e(...l),{createElement:E,useCallback:P,useMemo:R,useState:V}=m,j="editable",F=(e,l,t)=>{const n=P(e,l);return t?n:void 0},M=(e,l)=>T(e)||e[0]!=l?void 0:`sorted ${e[1]?"de":"a"}scending`,S=({cellId:e,sorting:l,label:t=e??"",onClick:n})=>E("th",{onClick:F((()=>n?.(e)),[n,e],!T(n)),className:M(l,e)},t),$=({className:e,headerRow:l,idColumn:t,customCells:n,storeTableIdOrQueriesQueryId:r,defaultCellComponent:o,rowIds:s,defaultCellIds:a,sorting:d,onHeaderThClick:u})=>{const i=R((()=>{const e=n??a;return q(O(Array.isArray(e)?q(Q(e,(e=>[e,e]))):e,((e,l)=>{return[l,{label:l,...(t=e,b(t)==h?{label:e}:e)}];var t})))}),[n,a]);return E("table",{className:e},!1===l?null:E("thead",null,E("tr",null,!1===t?null:E(S,{sorting:d,label:"Id",onClick:u}),O(i,(({label:e},l)=>E(S,{key:l,cellId:l,label:e,sorting:d,onClick:u}))))),E("tbody",null,Q(s,(e=>E("tr",{key:e},!1===t?null:E("th",null,e),O(i,(({component:l=o,getComponentProps:t},n)=>E("td",{key:n},E(l,{...A(t,e,n),...r,rowId:e,cellId:n})))))))))},z=({thing:e,onThingChange:l,className:t})=>{const[n,r]=V(),[o,s]=V(),[a,d]=V(),[u,i]=V(),[c,C]=V();o!==e&&(r((e=>{const l=b(e);return(e=>e==h||e==g)(l)||l==y&&N(e)?l:void 0})(e)),s(e),d(e+""),i(Number(e)||0),C(!!e));const I=P(((e,t)=>{t(e),s(e),l(e)}),[l]);return E("div",{className:t},E("button",{type:"button",className:n,onClick:P((()=>{const e=v(n,y,g,h),t=v(e,a,u,c);r(e),s(t),l(t)}),[l,a,u,c,n])},n),v(n,E("input",{key:n,value:a,onChange:P((e=>I(e[k][f]+"",d)),[I])}),E("input",{key:n,type:"number",value:u,onChange:P((e=>I(Number(e[k][f]||0),i)),[I])}),E("input",{key:n,type:"checkbox",checked:c,onChange:P((e=>I(!!e[k].checked,C)),[I])})))},B=({tableId:n,store:r,editable:o,...s})=>E($,{...s,storeTableIdOrQueriesQueryId:R((()=>({store:r,tableId:n})),[r,n]),defaultCellComponent:o?L:e,rowIds:l(n,r),defaultCellIds:t(n,r)}),D=({tableId:l,cellId:r,descending:o,offset:s,limit:a,store:d,editable:u,sortOnClick:i,...c})=>{const[C,I]=V([r,!!o]),m=F((e=>I([e,e==C[0]&&!C[1]])),[C],i);return E($,{...c,storeTableIdOrQueriesQueryId:R((()=>({store:d,tableId:l})),[d,l]),defaultCellComponent:u?L:e,rowIds:n(l,...C,s,a,d),defaultCellIds:t(l,d),sorting:C,onHeaderThClick:m})},G=({store:e,editable:l=!1,valueComponent:t=(l?U:o),getValueComponentProps:n,className:s,headerRow:a,idColumn:d})=>E("table",{className:s},!1===a?null:E("thead",null,E("tr",null,!1===d?null:E("th",null,"Id"),E("th",null,p))),E("tbody",null,Q(r(e),(l=>E("tr",{key:l},!1===d?null:E("th",null,l),E("td",null,E(t,{...A(n,l),valueId:l,store:e}))))))),J=({queryId:e,queries:l,...t})=>E($,{...t,storeTableIdOrQueriesQueryId:R((()=>({queries:l,queryId:e})),[l,e]),defaultCellComponent:s,rowIds:a(e,l),defaultCellIds:d(e,l)}),K=({queryId:e,cellId:l,descending:t,offset:n,limit:r,queries:o,sortOnClick:a,...i})=>{const[c,C]=V([l,!!t]),I=F((e=>C([e,e==c[0]&&!c[1]])),[c],a);return E($,{...i,storeTableIdOrQueriesQueryId:R((()=>({queries:o,queryId:e})),[o,e]),defaultCellComponent:s,rowIds:u(e,...c,n,r,o),defaultCellIds:d(e,o),sorting:c,onHeaderThClick:I})},L=({tableId:e,rowId:l,cellId:t,store:n,className:r})=>E(z,{thing:i(e,l,t,n),onThingChange:c(e,l,t,(e=>e),[],n),className:r??j+"Cell"}),U=({valueId:e,store:l,className:t})=>E(z,{thing:C(e,l),onThingChange:I(e,(e=>e),[],l),className:t??j+p});export{L as EditableCellView,U as EditableValueView,K as ResultSortedTableInHtmlTable,J as ResultTableInHtmlTable,D as SortedTableInHtmlTable,B as TableInHtmlTable,G as ValuesInHtmlTable};
Binary file
package/lib/ui-react.js CHANGED
@@ -1 +1 @@
1
- import e,{useContext as o}from"react";const t=e=>typeof e,s="",d=t(s),r="Ids",n="Table",l=n+"s",I=n+r,u="Row",i=u+r,c="Sorted"+u+r,a="Cell",p=a+r,g="Value",b=g+"s",C=g+r,w=(e,o)=>e.map(o),R=e=>null==e,m=(e,o,t)=>R(e)?t?.():o(e),k=e=>t(e)==d,y=()=>{},{createContext:h,useContext:v}=e,q=h([]),P=(e,o)=>{const t=v(q);return R(e)?t[o]:k(e)?((e,o)=>m(e,(e=>e[o])))(t[o+1],e):e},x=(e,o)=>{const t=P(e,o);return R(e)||k(e)?t:e},S=(e,...o)=>R(e)?{}:e(...o),f=e=>P(e,0),T=e=>P(e,2),B=e=>P(e,4),L=e=>P(e,6),M=e=>P(e,8),V=e=>P(e,10),A=e=>x(e,0),E=e=>x(e,2),F=e=>x(e,4),j=e=>x(e,6),z=e=>x(e,8),D=e=>x(e,10),{useCallback:G,useEffect:H,useMemo:J,useRef:K,useState:N}=e,O=(e,o,t=[])=>{const s=J((()=>o(e)),[e,...t]);return H((()=>()=>s.destroy()),[s]),s},Q=(e,o,t,s=[],d)=>{const[,r]=N(),n=G((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[l]=N(n),I=K(l);return J((()=>I.current=n()),[n]),U(e,o,((...e)=>{I.current=R(d)?n():e[d],r([])}),[],s),I.current},U=(e,o,t,s=[],d=[],...r)=>H((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),W=(e,o,t,s=[],d=y,r=[],...n)=>{const l=A(e);return G((e=>m(l,(s=>m(t(e,s),(e=>d(s["set"+o](...n,e),e)))))),[l,o,...s,...r,...n])},X=(e,o,t=y,s=[],...d)=>{const r=A(e);return G((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},Y=(e,o,t)=>{const s=D(e);return G((()=>s?.[o](t)),[s,o,t])},Z=(e,o=[])=>J(e,o),$=e=>Q(l,A(e),{}),_=e=>Q(I,A(e),[],[]),ee=(e,o)=>Q(n,A(o),{},[e]),oe=(e,o)=>Q(n+p,A(o),[],[e]),te=(e,o)=>Q(i,A(o),[],[e]),se=(e,o,t,s=0,d,r)=>Q(c,A(r),[],[e,o,t,s,d],6),de=(e,o,t)=>Q(u,A(t),{},[e,o]),re=(e,o,t)=>Q(p,A(t),[],[e,o]),ne=(e,o,t,s)=>Q(a,A(s),void 0,[e,o,t],4),le=e=>Q(b,A(e),{}),Ie=e=>Q(C,A(e),[],[]),ue=(e,o)=>Q(g,A(o),void 0,[e]),ie=(e,o,t,s,d)=>W(t,l,e,o,s,d),ce=(e,o,t,s,d,r)=>W(s,n,o,t,d,r,e),ae=(e,o,t,s,d,r,n)=>W(d,u,t,s,r,n,e,o),pe=(e,o,t=[],s,d=y,r=[],n=!0)=>{const l=A(s);return G((t=>m(l,(s=>m(o(t,s),(o=>d(s.addRow(e,o,n),s,o)))))),[l,e,...t,...r,n])},ge=(e,o,t,s,d,r,n)=>W(d,"PartialRow",t,s,r,n,e,o),be=(e,o,t,s,d,r,n,l)=>W(r,a,s,d,n,l,e,o,t),Ce=(e,o,t,s,d)=>W(t,b,e,o,s,d),we=(e,o,t,s,d)=>W(t,"PartialValues",e,o,s,d),Re=(e,o,t,s,d,r)=>W(s,g,o,t,d,r,e),me=(e,o,t)=>X(e,l,o,t),ke=(e,o,t,s)=>X(o,n,t,s,e),ye=(e,o,t,s,d)=>X(t,u,s,d,e,o),he=(e,o,t,s,d,r,n)=>X(d,a,r,n,e,o,t,s),ve=(e,o,t)=>X(e,b,o,t),qe=(e,o,t,s)=>X(o,g,t,s,e),Pe=(e,o,t,s)=>U(l,A(s),e,o,[],t),xe=(e,o,t,s)=>U(I,A(s),e,o,[],t),Se=(e,o,t,s,d)=>U(n,A(d),o,t,[e],s),fe=(e,o,t,s,d)=>U(n+p,A(d),o,t,[e],s),Te=(e,o,t,s,d)=>U(i,A(d),o,t,[e],s),Be=(e,o,t,s,d,r,n,l,I)=>U(c,A(I),r,n,[e,o,t,s,d],l),Le=(e,o,t,s,d,r)=>U(u,A(r),t,s,[e,o],d),Me=(e,o,t,s,d,r)=>U(p,A(r),t,s,[e,o],d),Ve=(e,o,t,s,d,r,n)=>U(a,A(n),s,d,[e,o,t],r),Ae=(e,o,t,s)=>U(b,A(s),e,o,[],t),Ee=(e,o,t,s)=>U(C,A(s),e,o,[],t),Fe=(e,o,t,s,d)=>U(g,A(d),o,t,[e],s),je=(e,o,t)=>O(e,o,t),ze=(e,o)=>Q("Metric",E(o),void 0,[e]),De=(e,o,t,s)=>U("Metric",E(s),o,t,[e]),Ge=(e,o,t)=>O(e,o,t),He=(e,o)=>Q("SliceIds",F(o),[],[e]),Je=(e,o,t)=>Q("SliceRowIds",F(t),[],[e,o]),Ke=(e,o,t,s)=>U("SliceIds",F(s),o,t,[e]),Ne=(e,o,t,s,d)=>U("SliceRowIds",F(d),t,s,[e,o]),Oe=(e,o,t)=>O(e,o,t),Qe=(e,o,t)=>Q("RemoteRowId",j(t),void 0,[e,o]),Ue=(e,o,t)=>Q("LocalRowIds",j(t),[],[e,o]),We=(e,o,t)=>Q("LinkedRowIds",j(t),[],[e,o]),Xe=(e,o,t,s,d)=>U("RemoteRowId",j(d),t,s,[e,o]),Ye=(e,o,t,s,d)=>U("LocalRowIds",j(d),t,s,[e,o]),Ze=(e,o,t,s,d)=>U("LinkedRowIds",j(d),t,s,[e,o]),$e=(e,o,t)=>O(e,o,t),_e=(e,o)=>Q("ResultTable",z(o),{},[e]),eo=(e,o)=>Q("ResultRowIds",z(o),[],[e]),oo=(e,o,t,s=0,d,r)=>Q("ResultSortedRowIds",z(r),[],[e,o,t,s,d],6),to=(e,o,t)=>Q("ResultRow",z(t),{},[e,o]),so=(e,o,t)=>Q("ResultCellIds",z(t),[],[e,o]),ro=(e,o,t,s)=>Q("ResultCell",z(s),void 0,[e,o,t]),no=(e,o,t,s)=>U("ResultTable",z(s),o,t,[e]),lo=(e,o,t,s)=>U("ResultRowIds",z(s),o,t,[e]),Io=(e,o,t,s,d,r,n,l)=>U("ResultSortedRowIds",z(l),r,n,[e,o,t,s,d]),uo=(e,o,t,s,d)=>U("ResultRow",z(d),t,s,[e,o]),io=(e,o,t,s,d)=>U("ResultCellIds",z(d),t,s,[e,o]),co=(e,o,t,s,d,r)=>U("ResultCell",z(r),s,d,[e,o,t]),ao=(e,o,t)=>O(e,o,t),po=e=>Q("CheckpointIds",D(e),[[],void 0,[]]),go=(e,o)=>Q("Checkpoint",D(o),void 0,[e]),bo=(e=y,o=[],t,s=y,d=[])=>{const r=D(t);return G((o=>m(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},Co=e=>Y(e,"goBackward"),wo=e=>Y(e,"goForward"),Ro=(e,o=[],t,s=y,d=[])=>{const r=D(t);return G((o=>m(r,(t=>m(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},mo=e=>{const o=D(e),[t,d]=po(o);return[(r=t,!(0==(e=>e.length)(r))),Co(o),d,m(d,(e=>o?.getCheckpoint(e)))??s];var r},ko=e=>{const o=D(e),[,,[t]]=po(o);return[!R(t),wo(o),t,m(t,(e=>o?.getCheckpoint(e)))??s]},yo=(e,o,t)=>U("CheckpointIds",D(t),e,o),ho=(e,o,t,s)=>U("Checkpoint",D(s),o,t,[e]),vo=(e,o,t=[],s,d=[])=>{const[,r]=N(),n=J((()=>o(e)),[e,...t]);return H((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:qo,useMemo:Po}=e,xo=({tableId:e,store:o,rowComponent:t=Ao,getRowComponentProps:s,customCellIds:d,separator:r,debugIds:n},l)=>Mo(w(l,(r=>qo(t,{...S(s,r),key:r,tableId:e,rowId:r,customCellIds:d,store:o,debugIds:n}))),r,n,e),So=({queryId:e,queries:o,resultRowComponent:t=Uo,getResultRowComponentProps:s,separator:d,debugIds:r},n)=>Mo(w(n,(d=>qo(t,{...S(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:r}))),d,r,e),fo=e=>{const o=j(e);return[o,o?.getStore()]},To=({relationshipId:e,relationships:o,rowComponent:t=Ao,getRowComponentProps:s,separator:d,debugIds:r},n,l)=>{const[I,u]=fo(o),i=I?.getLocalTableId(e),c=n(e,l,I);return Mo(w(c,(e=>qo(t,{...S(s,e),key:e,tableId:i,rowId:e,store:u,debugIds:r}))),d,r,l)},Bo=e=>({checkpoints:o,checkpointComponent:t=Yo,getCheckpointComponentProps:s,separator:d,debugIds:r})=>{const n=D(o);return Mo(w(e(po(n)),(e=>qo(t,{...S(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:r}))),d)},Lo=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:p})=>{const g=o(q);return qo(q.Provider,{value:Po((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...i},c??g[10],{...g[11],...a}]),[e,t,s,d,r,n,l,I,u,i,c,a,g])},p)},Mo=(e,o,t,s)=>{const d=R(o)||!Array.isArray(e)?e:w(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",d,"}"]:d},Vo=({tableId:e,rowId:o,cellId:t,store:d,debugIds:r})=>Mo(s+(ne(e,o,t,d)??s),void 0,r,t),Ao=({tableId:e,rowId:o,store:t,cellComponent:s=Vo,getCellComponentProps:d,customCellIds:r,separator:n,debugIds:l})=>Mo(w(((e,o,t,s)=>{const d=re(o,t,s);return e??d})(r,e,o,t),(r=>qo(s,{...S(d,r),key:r,tableId:e,rowId:o,cellId:r,store:t,debugIds:l}))),n,l,o),Eo=e=>xo(e,te(e.tableId,e.store)),Fo=({cellId:e,descending:o,offset:t,limit:s,...d})=>xo(d,se(d.tableId,e,o,t,s,d.store)),jo=({store:e,tableComponent:o=Eo,getTableComponentProps:t,separator:s,debugIds:d})=>Mo(w(_(e),(s=>qo(o,{...S(t,s),key:s,tableId:s,store:e,debugIds:d}))),s),zo=({valueId:e,store:o,debugIds:t})=>Mo(s+(ue(e,o)??s),void 0,t,e),Do=({store:e,valueComponent:o=zo,getValueComponentProps:t,separator:s,debugIds:d})=>Mo(w(Ie(e),(s=>qo(o,{...S(t,s),key:s,valueId:s,store:e,debugIds:d}))),s),Go=({metricId:e,metrics:o,debugIds:t})=>Mo(ze(e,o)??s,void 0,t,e),Ho=({indexId:e,sliceId:o,indexes:t,rowComponent:s=Ao,getRowComponentProps:d,separator:r,debugIds:n})=>{const l=F(t),I=l?.getStore(),u=l?.getTableId(e),i=Je(e,o,l);return Mo(w(i,(e=>qo(s,{...S(d,e),key:e,tableId:u,rowId:e,store:I,debugIds:n}))),r,n,o)},Jo=({indexId:e,indexes:o,sliceComponent:t=Ho,getSliceComponentProps:s,separator:d,debugIds:r})=>Mo(w(He(e,o),(d=>qo(t,{...S(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:r}))),d,r,e),Ko=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=Ao,getRowComponentProps:d,debugIds:r})=>{const[n,l]=fo(t),I=n?.getRemoteTableId(e),u=Qe(e,o,n);return Mo(R(I)||R(u)?null:qo(s,{...S(d,u),key:u,tableId:I,rowId:u,store:l,debugIds:r}),void 0,r,o)},No=e=>To(e,Ue,e.remoteRowId),Oo=e=>To(e,We,e.firstRowId),Qo=({queryId:e,rowId:o,cellId:t,queries:d,debugIds:r})=>Mo(s+(ro(e,o,t,d)??s),void 0,r,t),Uo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=Qo,getResultCellComponentProps:d,separator:r,debugIds:n})=>Mo(w(so(e,o,t),(r=>qo(s,{...S(d,r),key:r,queryId:e,rowId:o,cellId:r,queries:t,debugIds:n}))),r,n,o),Wo=e=>So(e,eo(e.queryId,e.queries)),Xo=({cellId:e,descending:o,offset:t,limit:s,...d})=>So(d,oo(d.queryId,e,o,t,s,d.queries)),Yo=({checkpoints:e,checkpointId:o,debugIds:t})=>Mo(go(o,e)??s,void 0,t,o),Zo=Bo((e=>e[0])),$o=Bo((e=>R(e[1])?[]:[e[1]])),_o=Bo((e=>e[2]));export{Zo as BackwardCheckpointsView,Vo as CellView,Yo as CheckpointView,$o as CurrentCheckpointView,_o as ForwardCheckpointsView,Jo as IndexView,Oo as LinkedRowsView,No as LocalRowsView,Go as MetricView,Lo as Provider,Ko as RemoteRowView,Qo as ResultCellView,Uo as ResultRowView,Xo as ResultSortedTableView,Wo as ResultTableView,Ao as RowView,Ho as SliceView,Fo as SortedTableView,Eo as TableView,jo as TablesView,zo as ValueView,Do as ValuesView,pe as useAddRowCallback,ne as useCell,re as useCellIds,Me as useCellIdsListener,Ve as useCellListener,go as useCheckpoint,po as useCheckpointIds,yo as useCheckpointIdsListener,ho as useCheckpointListener,V as useCheckpoints,ao as useCreateCheckpoints,Ge as useCreateIndexes,je as useCreateMetrics,vo as useCreatePersister,$e as useCreateQueries,Oe as useCreateRelationships,Z as useCreateStore,he as useDelCellCallback,ye as useDelRowCallback,ke as useDelTableCallback,me as useDelTablesCallback,qe as useDelValueCallback,ve as useDelValuesCallback,Co as useGoBackwardCallback,wo as useGoForwardCallback,Ro as useGoToCallback,B as useIndexes,We as useLinkedRowIds,Ze as useLinkedRowIdsListener,Ue as useLocalRowIds,Ye as useLocalRowIdsListener,ze as useMetric,De as useMetricListener,T as useMetrics,M as useQueries,ko as useRedoInformation,L as useRelationships,Qe as useRemoteRowId,Xe as useRemoteRowIdListener,ro as useResultCell,so as useResultCellIds,io as useResultCellIdsListener,co as useResultCellListener,to as useResultRow,eo as useResultRowIds,lo as useResultRowIdsListener,uo as useResultRowListener,oo as useResultSortedRowIds,Io as useResultSortedRowIdsListener,_e as useResultTable,no as useResultTableListener,de as useRow,te as useRowIds,Te as useRowIdsListener,Le as useRowListener,be as useSetCellCallback,bo as useSetCheckpointCallback,ge as useSetPartialRowCallback,we as useSetPartialValuesCallback,ae as useSetRowCallback,ce as useSetTableCallback,ie as useSetTablesCallback,Re as useSetValueCallback,Ce as useSetValuesCallback,He as useSliceIds,Ke as useSliceIdsListener,Je as useSliceRowIds,Ne as useSliceRowIdsListener,se as useSortedRowIds,Be as useSortedRowIdsListener,f as useStore,ee as useTable,oe as useTableCellIds,fe as useTableCellIdsListener,_ as useTableIds,xe as useTableIdsListener,Se as useTableListener,$ as useTables,Pe as useTablesListener,mo as useUndoInformation,ue as useValue,Ie as useValueIds,Ee as useValueIdsListener,Fe as useValueListener,le as useValues,Ae as useValuesListener};
1
+ import e,{useContext as o}from"react";const t=e=>typeof e,s="",d=t(s),r="Ids",n="Table",l=n+"s",I=n+r,u="Row",i=u+r,c="Sorted"+u+r,a="Cell",p=a+r,g="Value",b=g+"s",C=g+r,R=e=>null==e,w=(e,o,t)=>R(e)?t?.():o(e),m=e=>t(e)==d,k=()=>{},y=(e,o)=>e.map(o),{createContext:h,useContext:v}=e,q=h([]),P=(e,o)=>{const t=v(q);return R(e)?t[o]:m(e)?((e,o)=>w(e,(e=>e[o])))(t[o+1],e):e},x=(e,o)=>{const t=P(e,o);return R(e)||m(e)?t:e},S=(e,...o)=>R(e)?{}:e(...o),f=e=>P(e,0),T=e=>P(e,2),B=e=>P(e,4),L=e=>P(e,6),M=e=>P(e,8),V=e=>P(e,10),A=e=>x(e,0),E=e=>x(e,2),F=e=>x(e,4),j=e=>x(e,6),z=e=>x(e,8),D=e=>x(e,10),{useCallback:G,useEffect:H,useMemo:J,useRef:K,useState:N}=e,O=(e,o,t=[])=>{const s=J((()=>o(e)),[e,...t]);return H((()=>()=>s.destroy()),[s]),s},Q=(e,o,t,s=[],d)=>{const[,r]=N(),n=G((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[l]=N(n),I=K(l);return J((()=>I.current=n()),[n]),U(e,o,((...e)=>{I.current=R(d)?n():e[d],r([])}),[],s),I.current},U=(e,o,t,s=[],d=[],...r)=>H((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),W=(e,o,t,s=[],d=k,r=[],...n)=>{const l=A(e);return G((e=>w(l,(s=>w(t(e,s),(e=>d(s["set"+o](...n,e),e)))))),[l,o,...s,...r,...n])},X=(e,o,t=k,s=[],...d)=>{const r=A(e);return G((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},Y=(e,o,t)=>{const s=D(e);return G((()=>s?.[o](t)),[s,o,t])},Z=(e,o=[])=>J(e,o),$=e=>Q(l,A(e),{}),_=e=>Q(I,A(e),[],[]),ee=(e,o)=>Q(n,A(o),{},[e]),oe=(e,o)=>Q(n+p,A(o),[],[e]),te=(e,o)=>Q(i,A(o),[],[e]),se=(e,o,t,s=0,d,r)=>Q(c,A(r),[],[e,o,t,s,d],6),de=(e,o,t)=>Q(u,A(t),{},[e,o]),re=(e,o,t)=>Q(p,A(t),[],[e,o]),ne=(e,o,t,s)=>Q(a,A(s),void 0,[e,o,t],4),le=e=>Q(b,A(e),{}),Ie=e=>Q(C,A(e),[],[]),ue=(e,o)=>Q(g,A(o),void 0,[e]),ie=(e,o,t,s,d)=>W(t,l,e,o,s,d),ce=(e,o,t,s,d,r)=>W(s,n,o,t,d,r,e),ae=(e,o,t,s,d,r,n)=>W(d,u,t,s,r,n,e,o),pe=(e,o,t=[],s,d=k,r=[],n=!0)=>{const l=A(s);return G((t=>w(l,(s=>w(o(t,s),(o=>d(s.addRow(e,o,n),s,o)))))),[l,e,...t,...r,n])},ge=(e,o,t,s,d,r,n)=>W(d,"PartialRow",t,s,r,n,e,o),be=(e,o,t,s,d,r,n,l)=>W(r,a,s,d,n,l,e,o,t),Ce=(e,o,t,s,d)=>W(t,b,e,o,s,d),Re=(e,o,t,s,d)=>W(t,"PartialValues",e,o,s,d),we=(e,o,t,s,d,r)=>W(s,g,o,t,d,r,e),me=(e,o,t)=>X(e,l,o,t),ke=(e,o,t,s)=>X(o,n,t,s,e),ye=(e,o,t,s,d)=>X(t,u,s,d,e,o),he=(e,o,t,s,d,r,n)=>X(d,a,r,n,e,o,t,s),ve=(e,o,t)=>X(e,b,o,t),qe=(e,o,t,s)=>X(o,g,t,s,e),Pe=(e,o,t,s)=>U(l,A(s),e,o,[],t),xe=(e,o,t,s)=>U(I,A(s),e,o,[],t),Se=(e,o,t,s,d)=>U(n,A(d),o,t,[e],s),fe=(e,o,t,s,d)=>U(n+p,A(d),o,t,[e],s),Te=(e,o,t,s,d)=>U(i,A(d),o,t,[e],s),Be=(e,o,t,s,d,r,n,l,I)=>U(c,A(I),r,n,[e,o,t,s,d],l),Le=(e,o,t,s,d,r)=>U(u,A(r),t,s,[e,o],d),Me=(e,o,t,s,d,r)=>U(p,A(r),t,s,[e,o],d),Ve=(e,o,t,s,d,r,n)=>U(a,A(n),s,d,[e,o,t],r),Ae=(e,o,t,s)=>U(b,A(s),e,o,[],t),Ee=(e,o,t,s)=>U(C,A(s),e,o,[],t),Fe=(e,o,t,s,d)=>U(g,A(d),o,t,[e],s),je=(e,o,t)=>O(e,o,t),ze=(e,o)=>Q("Metric",E(o),void 0,[e]),De=(e,o,t,s)=>U("Metric",E(s),o,t,[e]),Ge=(e,o,t)=>O(e,o,t),He=(e,o)=>Q("SliceIds",F(o),[],[e]),Je=(e,o,t)=>Q("SliceRowIds",F(t),[],[e,o]),Ke=(e,o,t,s)=>U("SliceIds",F(s),o,t,[e]),Ne=(e,o,t,s,d)=>U("SliceRowIds",F(d),t,s,[e,o]),Oe=(e,o,t)=>O(e,o,t),Qe=(e,o,t)=>Q("RemoteRowId",j(t),void 0,[e,o]),Ue=(e,o,t)=>Q("LocalRowIds",j(t),[],[e,o]),We=(e,o,t)=>Q("LinkedRowIds",j(t),[],[e,o]),Xe=(e,o,t,s,d)=>U("RemoteRowId",j(d),t,s,[e,o]),Ye=(e,o,t,s,d)=>U("LocalRowIds",j(d),t,s,[e,o]),Ze=(e,o,t,s,d)=>U("LinkedRowIds",j(d),t,s,[e,o]),$e=(e,o,t)=>O(e,o,t),_e=(e,o)=>Q("ResultTable",z(o),{},[e]),eo=(e,o)=>Q("ResultRowIds",z(o),[],[e]),oo=(e,o)=>Q("ResultTableCellIds",z(o),[],[e]),to=(e,o,t,s=0,d,r)=>Q("ResultSortedRowIds",z(r),[],[e,o,t,s,d],6),so=(e,o,t)=>Q("ResultRow",z(t),{},[e,o]),ro=(e,o,t)=>Q("ResultCellIds",z(t),[],[e,o]),no=(e,o,t,s)=>Q("ResultCell",z(s),void 0,[e,o,t]),lo=(e,o,t,s)=>U("ResultTable",z(s),o,t,[e]),Io=(e,o,t,s)=>U("ResultTableCellIds",z(s),o,t,[e]),uo=(e,o,t,s)=>U("ResultRowIds",z(s),o,t,[e]),io=(e,o,t,s,d,r,n,l)=>U("ResultSortedRowIds",z(l),r,n,[e,o,t,s,d]),co=(e,o,t,s,d)=>U("ResultRow",z(d),t,s,[e,o]),ao=(e,o,t,s,d)=>U("ResultCellIds",z(d),t,s,[e,o]),po=(e,o,t,s,d,r)=>U("ResultCell",z(r),s,d,[e,o,t]),go=(e,o,t)=>O(e,o,t),bo=e=>Q("CheckpointIds",D(e),[[],void 0,[]]),Co=(e,o)=>Q("Checkpoint",D(o),void 0,[e]),Ro=(e=k,o=[],t,s=k,d=[])=>{const r=D(t);return G((o=>w(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},wo=e=>Y(e,"goBackward"),mo=e=>Y(e,"goForward"),ko=(e,o=[],t,s=k,d=[])=>{const r=D(t);return G((o=>w(r,(t=>w(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},yo=e=>{const o=D(e),[t,d]=bo(o);return[(r=t,!(0==(e=>e.length)(r))),wo(o),d,w(d,(e=>o?.getCheckpoint(e)))??s];var r},ho=e=>{const o=D(e),[,,[t]]=bo(o);return[!R(t),mo(o),t,w(t,(e=>o?.getCheckpoint(e)))??s]},vo=(e,o,t)=>U("CheckpointIds",D(t),e,o),qo=(e,o,t,s)=>U("Checkpoint",D(s),o,t,[e]),Po=(e,o,t=[],s,d=[])=>{const[,r]=N(),n=J((()=>o(e)),[e,...t]);return H((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:xo,useMemo:So}=e,fo=({tableId:e,store:o,rowComponent:t=Fo,getRowComponentProps:s,customCellIds:d,separator:r,debugIds:n},l)=>Ao(y(l,(r=>xo(t,{...S(s,r),key:r,tableId:e,rowId:r,customCellIds:d,store:o,debugIds:n}))),r,n,e),To=({queryId:e,queries:o,resultRowComponent:t=Xo,getResultRowComponentProps:s,separator:d,debugIds:r},n)=>Ao(y(n,(d=>xo(t,{...S(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:r}))),d,r,e),Bo=e=>{const o=j(e);return[o,o?.getStore()]},Lo=({relationshipId:e,relationships:o,rowComponent:t=Fo,getRowComponentProps:s,separator:d,debugIds:r},n,l)=>{const[I,u]=Bo(o),i=I?.getLocalTableId(e),c=n(e,l,I);return Ao(y(c,(e=>xo(t,{...S(s,e),key:e,tableId:i,rowId:e,store:u,debugIds:r}))),d,r,l)},Mo=e=>({checkpoints:o,checkpointComponent:t=$o,getCheckpointComponentProps:s,separator:d,debugIds:r})=>{const n=D(o);return Ao(y(e(bo(n)),(e=>xo(t,{...S(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:r}))),d)},Vo=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:p})=>{const g=o(q);return xo(q.Provider,{value:So((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...i},c??g[10],{...g[11],...a}]),[e,t,s,d,r,n,l,I,u,i,c,a,g])},p)},Ao=(e,o,t,s)=>{const d=R(o)||!Array.isArray(e)?e:y(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",d,"}"]:d},Eo=({tableId:e,rowId:o,cellId:t,store:d,debugIds:r})=>Ao(s+(ne(e,o,t,d)??s),void 0,r,t),Fo=({tableId:e,rowId:o,store:t,cellComponent:s=Eo,getCellComponentProps:d,customCellIds:r,separator:n,debugIds:l})=>Ao(y(((e,o,t,s)=>{const d=re(o,t,s);return e??d})(r,e,o,t),(r=>xo(s,{...S(d,r),key:r,tableId:e,rowId:o,cellId:r,store:t,debugIds:l}))),n,l,o),jo=e=>fo(e,te(e.tableId,e.store)),zo=({cellId:e,descending:o,offset:t,limit:s,...d})=>fo(d,se(d.tableId,e,o,t,s,d.store)),Do=({store:e,tableComponent:o=jo,getTableComponentProps:t,separator:s,debugIds:d})=>Ao(y(_(e),(s=>xo(o,{...S(t,s),key:s,tableId:s,store:e,debugIds:d}))),s),Go=({valueId:e,store:o,debugIds:t})=>Ao(s+(ue(e,o)??s),void 0,t,e),Ho=({store:e,valueComponent:o=Go,getValueComponentProps:t,separator:s,debugIds:d})=>Ao(y(Ie(e),(s=>xo(o,{...S(t,s),key:s,valueId:s,store:e,debugIds:d}))),s),Jo=({metricId:e,metrics:o,debugIds:t})=>Ao(ze(e,o)??s,void 0,t,e),Ko=({indexId:e,sliceId:o,indexes:t,rowComponent:s=Fo,getRowComponentProps:d,separator:r,debugIds:n})=>{const l=F(t),I=l?.getStore(),u=l?.getTableId(e),i=Je(e,o,l);return Ao(y(i,(e=>xo(s,{...S(d,e),key:e,tableId:u,rowId:e,store:I,debugIds:n}))),r,n,o)},No=({indexId:e,indexes:o,sliceComponent:t=Ko,getSliceComponentProps:s,separator:d,debugIds:r})=>Ao(y(He(e,o),(d=>xo(t,{...S(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:r}))),d,r,e),Oo=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=Fo,getRowComponentProps:d,debugIds:r})=>{const[n,l]=Bo(t),I=n?.getRemoteTableId(e),u=Qe(e,o,n);return Ao(R(I)||R(u)?null:xo(s,{...S(d,u),key:u,tableId:I,rowId:u,store:l,debugIds:r}),void 0,r,o)},Qo=e=>Lo(e,Ue,e.remoteRowId),Uo=e=>Lo(e,We,e.firstRowId),Wo=({queryId:e,rowId:o,cellId:t,queries:d,debugIds:r})=>Ao(s+(no(e,o,t,d)??s),void 0,r,t),Xo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=Wo,getResultCellComponentProps:d,separator:r,debugIds:n})=>Ao(y(ro(e,o,t),(r=>xo(s,{...S(d,r),key:r,queryId:e,rowId:o,cellId:r,queries:t,debugIds:n}))),r,n,o),Yo=e=>To(e,eo(e.queryId,e.queries)),Zo=({cellId:e,descending:o,offset:t,limit:s,...d})=>To(d,to(d.queryId,e,o,t,s,d.queries)),$o=({checkpoints:e,checkpointId:o,debugIds:t})=>Ao(Co(o,e)??s,void 0,t,o),_o=Mo((e=>e[0])),et=Mo((e=>R(e[1])?[]:[e[1]])),ot=Mo((e=>e[2]));export{_o as BackwardCheckpointsView,Eo as CellView,$o as CheckpointView,et as CurrentCheckpointView,ot as ForwardCheckpointsView,No as IndexView,Uo as LinkedRowsView,Qo as LocalRowsView,Jo as MetricView,Vo as Provider,Oo as RemoteRowView,Wo as ResultCellView,Xo as ResultRowView,Zo as ResultSortedTableView,Yo as ResultTableView,Fo as RowView,Ko as SliceView,zo as SortedTableView,jo as TableView,Do as TablesView,Go as ValueView,Ho as ValuesView,pe as useAddRowCallback,ne as useCell,re as useCellIds,Me as useCellIdsListener,Ve as useCellListener,Co as useCheckpoint,bo as useCheckpointIds,vo as useCheckpointIdsListener,qo as useCheckpointListener,V as useCheckpoints,go as useCreateCheckpoints,Ge as useCreateIndexes,je as useCreateMetrics,Po as useCreatePersister,$e as useCreateQueries,Oe as useCreateRelationships,Z as useCreateStore,he as useDelCellCallback,ye as useDelRowCallback,ke as useDelTableCallback,me as useDelTablesCallback,qe as useDelValueCallback,ve as useDelValuesCallback,wo as useGoBackwardCallback,mo as useGoForwardCallback,ko as useGoToCallback,B as useIndexes,We as useLinkedRowIds,Ze as useLinkedRowIdsListener,Ue as useLocalRowIds,Ye as useLocalRowIdsListener,ze as useMetric,De as useMetricListener,T as useMetrics,M as useQueries,ho as useRedoInformation,L as useRelationships,Qe as useRemoteRowId,Xe as useRemoteRowIdListener,no as useResultCell,ro as useResultCellIds,ao as useResultCellIdsListener,po as useResultCellListener,so as useResultRow,eo as useResultRowIds,uo as useResultRowIdsListener,co as useResultRowListener,to as useResultSortedRowIds,io as useResultSortedRowIdsListener,_e as useResultTable,oo as useResultTableCellIds,Io as useResultTableCellIdsListener,lo as useResultTableListener,de as useRow,te as useRowIds,Te as useRowIdsListener,Le as useRowListener,be as useSetCellCallback,Ro as useSetCheckpointCallback,ge as useSetPartialRowCallback,Re as useSetPartialValuesCallback,ae as useSetRowCallback,ce as useSetTableCallback,ie as useSetTablesCallback,we as useSetValueCallback,Ce as useSetValuesCallback,He as useSliceIds,Ke as useSliceIdsListener,Je as useSliceRowIds,Ne as useSliceRowIdsListener,se as useSortedRowIds,Be as useSortedRowIdsListener,f as useStore,ee as useTable,oe as useTableCellIds,fe as useTableCellIdsListener,_ as useTableIds,xe as useTableIdsListener,Se as useTableListener,$ as useTables,Pe as useTablesListener,yo as useUndoInformation,ue as useValue,Ie as useValueIds,Ee as useValueIdsListener,Fe as useValueListener,le as useValues,Ae as useValuesListener};
Binary file