tinybase 9.1.0-beta.0 → 9.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/@types/common/index.d.ts +17 -2
  2. package/@types/common/with-schemas/index.d.ts +18 -2
  3. package/@types/store/index.d.ts +37 -7
  4. package/@types/store/with-schemas/index.d.ts +38 -7
  5. package/@types/ui-react/index.d.ts +6 -2
  6. package/@types/ui-react/with-schemas/index.d.ts +7 -2
  7. package/@types/ui-solid/index.d.ts +9 -2
  8. package/@types/ui-solid/with-schemas/index.d.ts +10 -2
  9. package/@types/ui-svelte/index.d.ts +50 -2
  10. package/@types/ui-svelte/with-schemas/index.d.ts +88 -25
  11. package/index.js +34 -6
  12. package/mergeable-store/index.js +34 -6
  13. package/mergeable-store/with-schemas/index.js +34 -6
  14. package/min/index.js +1 -1
  15. package/min/index.js.gz +0 -0
  16. package/min/mergeable-store/index.js +1 -1
  17. package/min/mergeable-store/index.js.gz +0 -0
  18. package/min/mergeable-store/with-schemas/index.js +1 -1
  19. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  20. package/min/omni/index.js +1 -1
  21. package/min/omni/index.js.gz +0 -0
  22. package/min/omni/with-schemas/index.js +1 -1
  23. package/min/omni/with-schemas/index.js.gz +0 -0
  24. package/min/store/index.js +1 -1
  25. package/min/store/index.js.gz +0 -0
  26. package/min/store/with-schemas/index.js +1 -1
  27. package/min/store/with-schemas/index.js.gz +0 -0
  28. package/min/ui-react/index.js +1 -1
  29. package/min/ui-react/index.js.gz +0 -0
  30. package/min/ui-react/with-schemas/index.js +1 -1
  31. package/min/ui-react/with-schemas/index.js.gz +0 -0
  32. package/min/ui-react-dom/index.js +1 -1
  33. package/min/ui-react-dom/index.js.gz +0 -0
  34. package/min/ui-react-dom/with-schemas/index.js +1 -1
  35. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  36. package/min/ui-react-dom-charts/index.js +1 -1
  37. package/min/ui-react-dom-charts/index.js.gz +0 -0
  38. package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
  39. package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
  40. package/min/ui-react-inspector/index.js +1 -1
  41. package/min/ui-react-inspector/index.js.gz +0 -0
  42. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  43. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  44. package/min/ui-solid/index.js +1 -1
  45. package/min/ui-solid/index.js.gz +0 -0
  46. package/min/ui-solid/with-schemas/index.js +1 -1
  47. package/min/ui-solid/with-schemas/index.js.gz +0 -0
  48. package/min/ui-solid-dom/index.js +1 -1
  49. package/min/ui-solid-dom/index.js.gz +0 -0
  50. package/min/ui-solid-dom/with-schemas/index.js +1 -1
  51. package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
  52. package/min/ui-solid-inspector/index.js +1 -1
  53. package/min/ui-solid-inspector/index.js.gz +0 -0
  54. package/min/ui-solid-inspector/with-schemas/index.js +1 -1
  55. package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
  56. package/min/ui-svelte/index.js +1 -1
  57. package/min/ui-svelte/index.js.gz +0 -0
  58. package/min/ui-svelte/with-schemas/index.js +1 -1
  59. package/min/ui-svelte/with-schemas/index.js.gz +0 -0
  60. package/min/ui-svelte-dom/index.js +1 -1
  61. package/min/ui-svelte-dom/index.js.gz +0 -0
  62. package/min/ui-svelte-dom/with-schemas/index.js +1 -1
  63. package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
  64. package/min/ui-svelte-inspector/index.js +1 -1
  65. package/min/ui-svelte-inspector/index.js.gz +0 -0
  66. package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
  67. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  68. package/min/with-schemas/index.js +1 -1
  69. package/min/with-schemas/index.js.gz +0 -0
  70. package/omni/index.js +34 -6
  71. package/omni/with-schemas/index.js +34 -6
  72. package/package.json +3 -3
  73. package/releases.md +1 -1
  74. package/store/index.js +34 -6
  75. package/store/with-schemas/index.js +34 -6
  76. package/ui-react/index.js +36 -6
  77. package/ui-react/with-schemas/index.js +36 -6
  78. package/ui-react-dom/index.js +24 -4
  79. package/ui-react-dom/with-schemas/index.js +24 -4
  80. package/ui-react-dom-charts/index.js +24 -4
  81. package/ui-react-dom-charts/with-schemas/index.js +24 -4
  82. package/ui-react-inspector/index.js +58 -10
  83. package/ui-react-inspector/with-schemas/index.js +58 -10
  84. package/ui-solid/index.js +32 -2
  85. package/ui-solid/with-schemas/index.js +32 -2
  86. package/ui-solid-dom/index.js +17 -1
  87. package/ui-solid-dom/with-schemas/index.js +17 -1
  88. package/ui-solid-inspector/index.js +51 -7
  89. package/ui-solid-inspector/with-schemas/index.js +51 -7
  90. package/ui-svelte/index.js +73 -31
  91. package/ui-svelte/with-schemas/index.js +73 -31
  92. package/ui-svelte-dom/index.js +35 -14
  93. package/ui-svelte-dom/with-schemas/index.js +35 -14
  94. package/ui-svelte-inspector/index.js +69 -20
  95. package/ui-svelte-inspector/with-schemas/index.js +69 -20
  96. package/with-schemas/index.js +34 -6
@@ -467,13 +467,25 @@ const useSortedRowIdsImpl = (
467
467
  descending,
468
468
  offset,
469
469
  limit,
470
+ sorter,
470
471
  storeOrStoreId,
471
472
  ) =>
472
473
  useListenable(
473
474
  SORTED_ROW_IDS,
474
475
  useStoreOrStoreById(storeOrStoreId),
475
476
  1 /* Array */,
476
- [tableId, cellId, descending, offset, limit],
477
+ isUndefined(sorter)
478
+ ? [tableId, cellId, descending, offset, limit]
479
+ : [
480
+ () => ({
481
+ tableId: getThing(tableId),
482
+ cellId: getThing(cellId),
483
+ descending: getThing(descending) ?? false,
484
+ offset: getThing(offset) ?? 0,
485
+ limit: getThing(limit),
486
+ sorter: getThing(sorter),
487
+ }),
488
+ ],
477
489
  );
478
490
  const useSortedRowIdsListenerImpl = (
479
491
  tableId,
@@ -481,6 +493,7 @@ const useSortedRowIdsListenerImpl = (
481
493
  descending,
482
494
  offset,
483
495
  limit,
496
+ sorter,
484
497
  listener,
485
498
  mutator,
486
499
  storeOrStoreId,
@@ -489,7 +502,18 @@ const useSortedRowIdsListenerImpl = (
489
502
  SORTED_ROW_IDS,
490
503
  useStoreOrStoreById(storeOrStoreId),
491
504
  listener,
492
- [tableId, cellId, descending, offset, limit],
505
+ isUndefined(sorter)
506
+ ? [tableId, cellId, descending, offset, limit]
507
+ : [
508
+ () => ({
509
+ tableId: getThing(tableId),
510
+ cellId: getThing(cellId),
511
+ descending: getThing(descending),
512
+ offset: getThing(offset),
513
+ limit: getThing(limit),
514
+ sorter: getThing(sorter),
515
+ }),
516
+ ],
493
517
  mutator,
494
518
  );
495
519
  const useCreateStore = (create) => {
@@ -565,6 +589,7 @@ const useSortedRowIds = (
565
589
  descending,
566
590
  offset,
567
591
  limit,
592
+ sorter,
568
593
  storeOrStoreId,
569
594
  ) =>
570
595
  isObject(tableIdOrArgs)
@@ -574,6 +599,7 @@ const useSortedRowIds = (
574
599
  tableIdOrArgs.descending ?? false,
575
600
  tableIdOrArgs.offset ?? 0,
576
601
  tableIdOrArgs.limit,
602
+ () => tableIdOrArgs.sorter,
577
603
  cellIdOrStoreOrStoreId,
578
604
  )
579
605
  : useSortedRowIdsImpl(
@@ -582,6 +608,7 @@ const useSortedRowIds = (
582
608
  descending,
583
609
  offset,
584
610
  limit,
611
+ isUndefined(sorter) ? void 0 : () => sorter,
585
612
  storeOrStoreId,
586
613
  );
587
614
  const useHasRow = (tableId, rowId, storeOrStoreId) =>
@@ -830,6 +857,7 @@ const useSortedRowIdsListener = (
830
857
  tableIdOrArgs.descending ?? false,
831
858
  tableIdOrArgs.offset ?? 0,
832
859
  tableIdOrArgs.limit,
860
+ () => tableIdOrArgs.sorter,
833
861
  cellIdOrListener,
834
862
  descendingOrMutator,
835
863
  offsetOrStoreOrStoreId,
@@ -840,6 +868,7 @@ const useSortedRowIdsListener = (
840
868
  descendingOrMutator ?? false,
841
869
  offsetOrStoreOrStoreId ?? 0,
842
870
  limit,
871
+ void 0,
843
872
  listener,
844
873
  mutator,
845
874
  storeOrStoreId,
@@ -1985,6 +2014,7 @@ const SortedTableView = (props) =>
1985
2014
  () => props.descending,
1986
2015
  () => props.offset,
1987
2016
  () => props.limit,
2017
+ void 0,
1988
2018
  () => props.store,
1989
2019
  ),
1990
2020
  );
@@ -300,13 +300,25 @@ const useSortedRowIdsImpl = (
300
300
  descending,
301
301
  offset,
302
302
  limit,
303
+ sorter,
303
304
  storeOrStoreId,
304
305
  ) =>
305
306
  useListenable(
306
307
  SORTED_ROW_IDS,
307
308
  useStoreOrStoreById(storeOrStoreId),
308
309
  1 /* Array */,
309
- [tableId, cellId, descending, offset, limit],
310
+ isUndefined(sorter)
311
+ ? [tableId, cellId, descending, offset, limit]
312
+ : [
313
+ () => ({
314
+ tableId: getThing(tableId),
315
+ cellId: getThing(cellId),
316
+ descending: getThing(descending) ?? false,
317
+ offset: getThing(offset) ?? 0,
318
+ limit: getThing(limit),
319
+ sorter: getThing(sorter),
320
+ }),
321
+ ],
310
322
  );
311
323
  const useStoreOrStoreById = (storeOrStoreId) =>
312
324
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
@@ -334,6 +346,7 @@ const useSortedRowIds = (
334
346
  descending,
335
347
  offset,
336
348
  limit,
349
+ sorter,
337
350
  storeOrStoreId,
338
351
  ) =>
339
352
  isObject(tableIdOrArgs)
@@ -343,6 +356,7 @@ const useSortedRowIds = (
343
356
  tableIdOrArgs.descending ?? false,
344
357
  tableIdOrArgs.offset ?? 0,
345
358
  tableIdOrArgs.limit,
359
+ () => tableIdOrArgs.sorter,
346
360
  cellIdOrStoreOrStoreId,
347
361
  )
348
362
  : useSortedRowIdsImpl(
@@ -351,6 +365,7 @@ const useSortedRowIds = (
351
365
  descending,
352
366
  offset,
353
367
  limit,
368
+ isUndefined(sorter) ? void 0 : () => sorter,
354
369
  storeOrStoreId,
355
370
  );
356
371
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -1420,6 +1435,7 @@ const SortedTableInHtmlTable = (props) => {
1420
1435
  () => sortAndOffset()[1],
1421
1436
  () => sortAndOffset()[2],
1422
1437
  () => props.limit,
1438
+ void 0,
1423
1439
  () => props.store,
1424
1440
  ),
1425
1441
  props.extraCellsBefore,
@@ -300,13 +300,25 @@ const useSortedRowIdsImpl = (
300
300
  descending,
301
301
  offset,
302
302
  limit,
303
+ sorter,
303
304
  storeOrStoreId,
304
305
  ) =>
305
306
  useListenable(
306
307
  SORTED_ROW_IDS,
307
308
  useStoreOrStoreById(storeOrStoreId),
308
309
  1 /* Array */,
309
- [tableId, cellId, descending, offset, limit],
310
+ isUndefined(sorter)
311
+ ? [tableId, cellId, descending, offset, limit]
312
+ : [
313
+ () => ({
314
+ tableId: getThing(tableId),
315
+ cellId: getThing(cellId),
316
+ descending: getThing(descending) ?? false,
317
+ offset: getThing(offset) ?? 0,
318
+ limit: getThing(limit),
319
+ sorter: getThing(sorter),
320
+ }),
321
+ ],
310
322
  );
311
323
  const useStoreOrStoreById = (storeOrStoreId) =>
312
324
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
@@ -334,6 +346,7 @@ const useSortedRowIds = (
334
346
  descending,
335
347
  offset,
336
348
  limit,
349
+ sorter,
337
350
  storeOrStoreId,
338
351
  ) =>
339
352
  isObject(tableIdOrArgs)
@@ -343,6 +356,7 @@ const useSortedRowIds = (
343
356
  tableIdOrArgs.descending ?? false,
344
357
  tableIdOrArgs.offset ?? 0,
345
358
  tableIdOrArgs.limit,
359
+ () => tableIdOrArgs.sorter,
346
360
  cellIdOrStoreOrStoreId,
347
361
  )
348
362
  : useSortedRowIdsImpl(
@@ -351,6 +365,7 @@ const useSortedRowIds = (
351
365
  descending,
352
366
  offset,
353
367
  limit,
368
+ isUndefined(sorter) ? void 0 : () => sorter,
354
369
  storeOrStoreId,
355
370
  );
356
371
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -1420,6 +1435,7 @@ const SortedTableInHtmlTable = (props) => {
1420
1435
  () => sortAndOffset()[1],
1421
1436
  () => sortAndOffset()[2],
1422
1437
  () => props.limit,
1438
+ void 0,
1423
1439
  () => props.store,
1424
1440
  ),
1425
1441
  props.extraCellsBefore,
@@ -2176,13 +2176,36 @@ const createStore = () => {
2176
2176
  listener,
2177
2177
  mutator,
2178
2178
  ) => {
2179
- let sortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2179
+ const [descending, offset, limit, sorter] = otherArgs;
2180
+ let sortedRowIds = getSortedRowIds(
2181
+ tableId,
2182
+ cellId,
2183
+ descending,
2184
+ offset,
2185
+ limit,
2186
+ sorter,
2187
+ );
2180
2188
  return addListener(
2181
2189
  () => {
2182
- const newSortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2190
+ const newSortedRowIds = getSortedRowIds(
2191
+ tableId,
2192
+ cellId,
2193
+ descending,
2194
+ offset,
2195
+ limit,
2196
+ sorter,
2197
+ );
2183
2198
  if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
2184
2199
  sortedRowIds = newSortedRowIds;
2185
- listener(store, tableId, cellId, ...otherArgs, sortedRowIds);
2200
+ listener(
2201
+ store,
2202
+ tableId,
2203
+ cellId,
2204
+ descending,
2205
+ offset,
2206
+ limit,
2207
+ sortedRowIds,
2208
+ );
2186
2209
  }
2187
2210
  },
2188
2211
  sortedRowIdsListeners[mutator ? 1 : 0],
@@ -2236,6 +2259,7 @@ const createStore = () => {
2236
2259
  descending,
2237
2260
  offset = 0,
2238
2261
  limit,
2262
+ sorter = defaultSorter,
2239
2263
  ) =>
2240
2264
  isObject(tableIdOrArgs)
2241
2265
  ? getSortedRowIds(
@@ -2244,16 +2268,19 @@ const createStore = () => {
2244
2268
  tableIdOrArgs.descending,
2245
2269
  tableIdOrArgs.offset,
2246
2270
  tableIdOrArgs.limit,
2271
+ tableIdOrArgs.sorter,
2247
2272
  )
2248
2273
  : arrayMap(
2249
2274
  slice(
2250
2275
  arraySort(
2251
2276
  mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
2252
- isUndefined(cellId) ? rowId : mapGet(row, id(cellId)),
2277
+ isUndefined(cellId)
2278
+ ? rowId
2279
+ : decodeIfJson(mapGet(row, id(cellId))),
2253
2280
  rowId,
2254
2281
  ]),
2255
2282
  ([cell1], [cell2]) =>
2256
- defaultSorter(cell1, cell2) * (descending ? -1 : 1),
2283
+ sorter(cell1, cell2) * (descending ? -1 : 1),
2257
2284
  ),
2258
2285
  offset,
2259
2286
  isUndefined(limit) ? limit : offset + limit,
@@ -2731,6 +2758,7 @@ const createStore = () => {
2731
2758
  tableIdOrArgs.descending ?? false,
2732
2759
  tableIdOrArgs.offset ?? 0,
2733
2760
  tableIdOrArgs.limit,
2761
+ tableIdOrArgs.sorter,
2734
2762
  ],
2735
2763
  cellIdOrListener,
2736
2764
  descendingOrMutator,
@@ -2738,7 +2766,7 @@ const createStore = () => {
2738
2766
  : addSortedRowIdsListenerImpl(
2739
2767
  tableIdOrArgs,
2740
2768
  cellIdOrListener,
2741
- [descendingOrMutator, offset, limit],
2769
+ [descendingOrMutator, offset, limit, void 0],
2742
2770
  listener,
2743
2771
  mutator,
2744
2772
  );
@@ -3145,13 +3173,25 @@ const useSortedRowIdsImpl = (
3145
3173
  descending,
3146
3174
  offset,
3147
3175
  limit,
3176
+ sorter,
3148
3177
  storeOrStoreId,
3149
3178
  ) =>
3150
3179
  useListenable(
3151
3180
  SORTED_ROW_IDS,
3152
3181
  useStoreOrStoreById(storeOrStoreId),
3153
3182
  1 /* Array */,
3154
- [tableId, cellId, descending, offset, limit],
3183
+ isUndefined(sorter)
3184
+ ? [tableId, cellId, descending, offset, limit]
3185
+ : [
3186
+ () => ({
3187
+ tableId: getThing(tableId),
3188
+ cellId: getThing(cellId),
3189
+ descending: getThing(descending) ?? false,
3190
+ offset: getThing(offset) ?? 0,
3191
+ limit: getThing(limit),
3192
+ sorter: getThing(sorter),
3193
+ }),
3194
+ ],
3155
3195
  );
3156
3196
  const useStoreOrStoreById = (storeOrStoreId) =>
3157
3197
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
@@ -3179,6 +3219,7 @@ const useSortedRowIds = (
3179
3219
  descending,
3180
3220
  offset,
3181
3221
  limit,
3222
+ sorter,
3182
3223
  storeOrStoreId,
3183
3224
  ) =>
3184
3225
  isObject(tableIdOrArgs)
@@ -3188,6 +3229,7 @@ const useSortedRowIds = (
3188
3229
  tableIdOrArgs.descending ?? false,
3189
3230
  tableIdOrArgs.offset ?? 0,
3190
3231
  tableIdOrArgs.limit,
3232
+ () => tableIdOrArgs.sorter,
3191
3233
  cellIdOrStoreOrStoreId,
3192
3234
  )
3193
3235
  : useSortedRowIdsImpl(
@@ -3196,6 +3238,7 @@ const useSortedRowIds = (
3196
3238
  descending,
3197
3239
  offset,
3198
3240
  limit,
3241
+ isUndefined(sorter) ? void 0 : () => sorter,
3199
3242
  storeOrStoreId,
3200
3243
  );
3201
3244
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -4197,6 +4240,7 @@ const SortedTableInHtmlTable = (props) => {
4197
4240
  () => sortAndOffset()[1],
4198
4241
  () => sortAndOffset()[2],
4199
4242
  () => props.limit,
4243
+ void 0,
4200
4244
  () => props.store,
4201
4245
  ),
4202
4246
  props.extraCellsBefore,
@@ -2176,13 +2176,36 @@ const createStore = () => {
2176
2176
  listener,
2177
2177
  mutator,
2178
2178
  ) => {
2179
- let sortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2179
+ const [descending, offset, limit, sorter] = otherArgs;
2180
+ let sortedRowIds = getSortedRowIds(
2181
+ tableId,
2182
+ cellId,
2183
+ descending,
2184
+ offset,
2185
+ limit,
2186
+ sorter,
2187
+ );
2180
2188
  return addListener(
2181
2189
  () => {
2182
- const newSortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2190
+ const newSortedRowIds = getSortedRowIds(
2191
+ tableId,
2192
+ cellId,
2193
+ descending,
2194
+ offset,
2195
+ limit,
2196
+ sorter,
2197
+ );
2183
2198
  if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
2184
2199
  sortedRowIds = newSortedRowIds;
2185
- listener(store, tableId, cellId, ...otherArgs, sortedRowIds);
2200
+ listener(
2201
+ store,
2202
+ tableId,
2203
+ cellId,
2204
+ descending,
2205
+ offset,
2206
+ limit,
2207
+ sortedRowIds,
2208
+ );
2186
2209
  }
2187
2210
  },
2188
2211
  sortedRowIdsListeners[mutator ? 1 : 0],
@@ -2236,6 +2259,7 @@ const createStore = () => {
2236
2259
  descending,
2237
2260
  offset = 0,
2238
2261
  limit,
2262
+ sorter = defaultSorter,
2239
2263
  ) =>
2240
2264
  isObject(tableIdOrArgs)
2241
2265
  ? getSortedRowIds(
@@ -2244,16 +2268,19 @@ const createStore = () => {
2244
2268
  tableIdOrArgs.descending,
2245
2269
  tableIdOrArgs.offset,
2246
2270
  tableIdOrArgs.limit,
2271
+ tableIdOrArgs.sorter,
2247
2272
  )
2248
2273
  : arrayMap(
2249
2274
  slice(
2250
2275
  arraySort(
2251
2276
  mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
2252
- isUndefined(cellId) ? rowId : mapGet(row, id(cellId)),
2277
+ isUndefined(cellId)
2278
+ ? rowId
2279
+ : decodeIfJson(mapGet(row, id(cellId))),
2253
2280
  rowId,
2254
2281
  ]),
2255
2282
  ([cell1], [cell2]) =>
2256
- defaultSorter(cell1, cell2) * (descending ? -1 : 1),
2283
+ sorter(cell1, cell2) * (descending ? -1 : 1),
2257
2284
  ),
2258
2285
  offset,
2259
2286
  isUndefined(limit) ? limit : offset + limit,
@@ -2731,6 +2758,7 @@ const createStore = () => {
2731
2758
  tableIdOrArgs.descending ?? false,
2732
2759
  tableIdOrArgs.offset ?? 0,
2733
2760
  tableIdOrArgs.limit,
2761
+ tableIdOrArgs.sorter,
2734
2762
  ],
2735
2763
  cellIdOrListener,
2736
2764
  descendingOrMutator,
@@ -2738,7 +2766,7 @@ const createStore = () => {
2738
2766
  : addSortedRowIdsListenerImpl(
2739
2767
  tableIdOrArgs,
2740
2768
  cellIdOrListener,
2741
- [descendingOrMutator, offset, limit],
2769
+ [descendingOrMutator, offset, limit, void 0],
2742
2770
  listener,
2743
2771
  mutator,
2744
2772
  );
@@ -3145,13 +3173,25 @@ const useSortedRowIdsImpl = (
3145
3173
  descending,
3146
3174
  offset,
3147
3175
  limit,
3176
+ sorter,
3148
3177
  storeOrStoreId,
3149
3178
  ) =>
3150
3179
  useListenable(
3151
3180
  SORTED_ROW_IDS,
3152
3181
  useStoreOrStoreById(storeOrStoreId),
3153
3182
  1 /* Array */,
3154
- [tableId, cellId, descending, offset, limit],
3183
+ isUndefined(sorter)
3184
+ ? [tableId, cellId, descending, offset, limit]
3185
+ : [
3186
+ () => ({
3187
+ tableId: getThing(tableId),
3188
+ cellId: getThing(cellId),
3189
+ descending: getThing(descending) ?? false,
3190
+ offset: getThing(offset) ?? 0,
3191
+ limit: getThing(limit),
3192
+ sorter: getThing(sorter),
3193
+ }),
3194
+ ],
3155
3195
  );
3156
3196
  const useStoreOrStoreById = (storeOrStoreId) =>
3157
3197
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
@@ -3179,6 +3219,7 @@ const useSortedRowIds = (
3179
3219
  descending,
3180
3220
  offset,
3181
3221
  limit,
3222
+ sorter,
3182
3223
  storeOrStoreId,
3183
3224
  ) =>
3184
3225
  isObject(tableIdOrArgs)
@@ -3188,6 +3229,7 @@ const useSortedRowIds = (
3188
3229
  tableIdOrArgs.descending ?? false,
3189
3230
  tableIdOrArgs.offset ?? 0,
3190
3231
  tableIdOrArgs.limit,
3232
+ () => tableIdOrArgs.sorter,
3191
3233
  cellIdOrStoreOrStoreId,
3192
3234
  )
3193
3235
  : useSortedRowIdsImpl(
@@ -3196,6 +3238,7 @@ const useSortedRowIds = (
3196
3238
  descending,
3197
3239
  offset,
3198
3240
  limit,
3241
+ isUndefined(sorter) ? void 0 : () => sorter,
3199
3242
  storeOrStoreId,
3200
3243
  );
3201
3244
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -4197,6 +4240,7 @@ const SortedTableInHtmlTable = (props) => {
4197
4240
  () => sortAndOffset()[1],
4198
4241
  () => sortAndOffset()[2],
4199
4242
  () => props.limit,
4243
+ void 0,
4200
4244
  () => props.store,
4201
4245
  ),
4202
4246
  props.extraCellsBefore,
@@ -49,12 +49,25 @@ const GLOBAL = globalThis;
49
49
  const isNullish = (thing) => thing == null;
50
50
  const isUndefined = (thing) => thing === void 0;
51
51
  const hasWindow = () => !isUndefined(GLOBAL.window);
52
+ const ifNotNullish = getIfNotFunction(isNullish);
52
53
  const ifNotUndefined = getIfNotFunction(isUndefined);
53
54
  const isString = (thing) => getTypeOf(thing) == STRING;
54
55
  const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
55
56
  const noop = () => {};
56
57
 
57
58
  const object = Object;
59
+ const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
60
+ const isObject = (obj) =>
61
+ !isNullish(obj) &&
62
+ ifNotNullish(
63
+ getPrototypeOf(obj),
64
+ (objPrototype) =>
65
+ objPrototype == object.prototype ||
66
+ isNullish(getPrototypeOf(objPrototype)),
67
+
68
+ /* istanbul ignore next */
69
+ () => true,
70
+ );
58
71
  const objIds = object.keys;
59
72
  const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
60
73
 
@@ -250,25 +263,45 @@ const getRowIds = (tableId, storeOrStoreId) =>
250
263
  ]);
251
264
 
252
265
  const getSortedRowIds = (
253
- tableId,
254
- cellId,
266
+ tableIdOrArgs,
267
+ cellIdOrStoreOrStoreId,
255
268
  descending = false,
256
269
  offset = 0,
257
270
  limit,
271
+ sorter,
258
272
  storeOrStoreId,
259
273
  ) =>
260
- createListenable(
261
- resolveStore(storeOrStoreId),
262
- SORTED_ROW_IDS,
263
- EMPTY_ARR,
264
- () => [
265
- maybeGet(tableId),
266
- maybeGet(cellId),
267
- maybeGet(descending),
268
- maybeGet(offset),
269
- maybeGet(limit),
270
- ],
271
- );
274
+ isObject(tableIdOrArgs)
275
+ ? createListenable(
276
+ resolveStore(cellIdOrStoreOrStoreId),
277
+ SORTED_ROW_IDS,
278
+ EMPTY_ARR,
279
+ () => [tableIdOrArgs],
280
+ )
281
+ : createListenable(
282
+ resolveStore(storeOrStoreId),
283
+ SORTED_ROW_IDS,
284
+ EMPTY_ARR,
285
+ () =>
286
+ isUndefined(sorter)
287
+ ? [
288
+ maybeGet(tableIdOrArgs),
289
+ maybeGet(cellIdOrStoreOrStoreId),
290
+ maybeGet(descending),
291
+ maybeGet(offset),
292
+ maybeGet(limit),
293
+ ]
294
+ : [
295
+ {
296
+ tableId: maybeGet(tableIdOrArgs),
297
+ cellId: maybeGet(cellIdOrStoreOrStoreId),
298
+ descending: maybeGet(descending) ?? false,
299
+ offset: maybeGet(offset) ?? 0,
300
+ limit: maybeGet(limit),
301
+ sorter,
302
+ },
303
+ ],
304
+ );
272
305
 
273
306
  const hasRow = (tableId, rowId, storeOrStoreId) =>
274
307
  createListenable(
@@ -820,28 +853,36 @@ const onRowIds = (tableId, listener, mutator, storeOrStoreId) =>
820
853
  );
821
854
 
822
855
  const onSortedRowIds = (
823
- tableId,
824
- cellId,
825
- descending,
826
- offset,
856
+ tableIdOrArgs,
857
+ cellIdOrListener,
858
+ descendingOrMutator,
859
+ offsetOrStoreOrStoreId,
827
860
  limit,
828
861
  listener,
829
862
  mutator,
830
863
  storeOrStoreId,
831
864
  ) =>
832
- addListenerEffect(
833
- resolveStore(storeOrStoreId),
834
- SORTED_ROW_IDS,
835
- listener,
836
- () => [
837
- maybeGet(tableId),
838
- maybeGet(cellId),
839
- maybeGet(descending),
840
- maybeGet(offset),
841
- maybeGet(limit),
842
- ],
843
- mutator,
844
- );
865
+ isObject(tableIdOrArgs)
866
+ ? addListenerEffect(
867
+ resolveStore(offsetOrStoreOrStoreId),
868
+ SORTED_ROW_IDS,
869
+ cellIdOrListener,
870
+ () => [tableIdOrArgs],
871
+ descendingOrMutator,
872
+ )
873
+ : addListenerEffect(
874
+ resolveStore(storeOrStoreId),
875
+ SORTED_ROW_IDS,
876
+ listener,
877
+ () => [
878
+ maybeGet(tableIdOrArgs),
879
+ maybeGet(cellIdOrListener),
880
+ maybeGet(descendingOrMutator),
881
+ maybeGet(offsetOrStoreOrStoreId),
882
+ maybeGet(limit),
883
+ ],
884
+ mutator,
885
+ );
845
886
 
846
887
  const onHasRow = (tableId, rowId, listener, mutator, storeOrStoreId) =>
847
888
  addListenerEffect(
@@ -2263,6 +2304,7 @@ function SortedTableView($$anchor, $$props) {
2263
2304
  () => $$props.descending ?? false,
2264
2305
  () => $$props.offset ?? 0,
2265
2306
  () => $$props.limit,
2307
+ undefined,
2266
2308
  () => $$props.store,
2267
2309
  );
2268
2310