tinybase 9.1.0-beta.0 → 9.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/@types/_internal/store/with-schemas/index.d.ts +133 -2
  2. package/@types/common/index.d.ts +17 -2
  3. package/@types/common/with-schemas/index.d.ts +18 -2
  4. package/@types/indexes/index.d.ts +97 -0
  5. package/@types/indexes/with-schemas/index.d.ts +137 -0
  6. package/@types/store/index.d.ts +133 -25
  7. package/@types/store/with-schemas/index.d.ts +145 -51
  8. package/@types/ui-react/index.d.ts +48 -2
  9. package/@types/ui-react/with-schemas/index.d.ts +108 -34
  10. package/@types/ui-solid/index.d.ts +51 -2
  11. package/@types/ui-solid/with-schemas/index.d.ts +111 -34
  12. package/@types/ui-svelte/index.d.ts +84 -2
  13. package/@types/ui-svelte/with-schemas/index.d.ts +122 -25
  14. package/index.js +155 -38
  15. package/indexes/index.js +39 -0
  16. package/indexes/with-schemas/index.js +39 -0
  17. package/mergeable-store/index.js +116 -38
  18. package/mergeable-store/with-schemas/index.js +116 -38
  19. package/min/index.js +1 -1
  20. package/min/index.js.gz +0 -0
  21. package/min/indexes/index.js +1 -1
  22. package/min/indexes/index.js.gz +0 -0
  23. package/min/indexes/with-schemas/index.js +1 -1
  24. package/min/indexes/with-schemas/index.js.gz +0 -0
  25. package/min/mergeable-store/index.js +1 -1
  26. package/min/mergeable-store/index.js.gz +0 -0
  27. package/min/mergeable-store/with-schemas/index.js +1 -1
  28. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  29. package/min/omni/index.js +1 -1
  30. package/min/omni/index.js.gz +0 -0
  31. package/min/omni/with-schemas/index.js +1 -1
  32. package/min/omni/with-schemas/index.js.gz +0 -0
  33. package/min/store/index.js +1 -1
  34. package/min/store/index.js.gz +0 -0
  35. package/min/store/with-schemas/index.js +1 -1
  36. package/min/store/with-schemas/index.js.gz +0 -0
  37. package/min/ui-react/index.js +1 -1
  38. package/min/ui-react/index.js.gz +0 -0
  39. package/min/ui-react/with-schemas/index.js +1 -1
  40. package/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/min/ui-react-dom/index.js +1 -1
  42. package/min/ui-react-dom/index.js.gz +0 -0
  43. package/min/ui-react-dom/with-schemas/index.js +1 -1
  44. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  45. package/min/ui-react-dom-charts/index.js +1 -1
  46. package/min/ui-react-dom-charts/index.js.gz +0 -0
  47. package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
  48. package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
  49. package/min/ui-react-inspector/index.js +1 -1
  50. package/min/ui-react-inspector/index.js.gz +0 -0
  51. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  52. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  53. package/min/ui-solid/index.js +1 -1
  54. package/min/ui-solid/index.js.gz +0 -0
  55. package/min/ui-solid/with-schemas/index.js +1 -1
  56. package/min/ui-solid/with-schemas/index.js.gz +0 -0
  57. package/min/ui-solid-dom/index.js +1 -1
  58. package/min/ui-solid-dom/index.js.gz +0 -0
  59. package/min/ui-solid-dom/with-schemas/index.js +1 -1
  60. package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
  61. package/min/ui-solid-inspector/index.js +1 -1
  62. package/min/ui-solid-inspector/index.js.gz +0 -0
  63. package/min/ui-solid-inspector/with-schemas/index.js +1 -1
  64. package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
  65. package/min/ui-svelte/index.js +1 -1
  66. package/min/ui-svelte/index.js.gz +0 -0
  67. package/min/ui-svelte/with-schemas/index.js +1 -1
  68. package/min/ui-svelte/with-schemas/index.js.gz +0 -0
  69. package/min/ui-svelte-dom/index.js +1 -1
  70. package/min/ui-svelte-dom/index.js.gz +0 -0
  71. package/min/ui-svelte-dom/with-schemas/index.js +1 -1
  72. package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
  73. package/min/ui-svelte-inspector/index.js +1 -1
  74. package/min/ui-svelte-inspector/index.js.gz +0 -0
  75. package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
  76. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  77. package/min/with-schemas/index.js +1 -1
  78. package/min/with-schemas/index.js.gz +0 -0
  79. package/omni/index.js +155 -38
  80. package/omni/with-schemas/index.js +155 -38
  81. package/package.json +3 -3
  82. package/readme.md +14 -14
  83. package/releases.md +101 -60
  84. package/store/index.js +116 -38
  85. package/store/with-schemas/index.js +116 -38
  86. package/ui-react/index.js +52 -6
  87. package/ui-react/with-schemas/index.js +52 -6
  88. package/ui-react-dom/index.js +24 -4
  89. package/ui-react-dom/with-schemas/index.js +24 -4
  90. package/ui-react-dom-charts/index.js +24 -4
  91. package/ui-react-dom-charts/with-schemas/index.js +24 -4
  92. package/ui-react-inspector/index.js +140 -42
  93. package/ui-react-inspector/with-schemas/index.js +140 -42
  94. package/ui-solid/index.js +48 -2
  95. package/ui-solid/with-schemas/index.js +48 -2
  96. package/ui-solid-dom/index.js +17 -1
  97. package/ui-solid-dom/with-schemas/index.js +17 -1
  98. package/ui-solid-inspector/index.js +133 -39
  99. package/ui-solid-inspector/with-schemas/index.js +133 -39
  100. package/ui-svelte/index.js +91 -31
  101. package/ui-svelte/with-schemas/index.js +91 -31
  102. package/ui-svelte-dom/index.js +35 -14
  103. package/ui-svelte-dom/with-schemas/index.js +35 -14
  104. package/ui-svelte-inspector/index.js +151 -52
  105. package/ui-svelte-inspector/with-schemas/index.js +151 -52
  106. package/with-schemas/index.js +155 -38
@@ -536,33 +536,56 @@ const useSortedRowIdsImpl = (
536
536
  descending,
537
537
  offset,
538
538
  limit,
539
+ sorter,
539
540
  storeOrStoreId,
540
- ) =>
541
- useListenable(
541
+ ) => {
542
+ const sortedRowIdsArgs = useMemo(
543
+ () => ({
544
+ tableId,
545
+ cellId,
546
+ descending: descending ?? false,
547
+ offset: offset ?? 0,
548
+ limit,
549
+ sorter,
550
+ }),
551
+ [tableId, cellId, descending, offset, limit, sorter],
552
+ );
553
+ return useListenable(
542
554
  SORTED_ROW_IDS,
543
555
  useStoreOrStoreById(storeOrStoreId),
544
556
  1 /* Array */,
545
- [tableId, cellId, descending, offset, limit],
557
+ isUndefined(sorter)
558
+ ? [tableId, cellId, descending, offset, limit]
559
+ : [sortedRowIdsArgs],
546
560
  );
561
+ };
547
562
  const useSortedRowIdsListenerImpl = (
548
563
  tableId,
549
564
  cellId,
550
565
  descending,
551
566
  offset,
552
567
  limit,
568
+ sorter,
553
569
  listener,
554
570
  listenerDeps,
555
571
  mutator,
556
572
  storeOrStoreId,
557
- ) =>
573
+ ) => {
574
+ const sortedRowIdsArgs = useMemo(
575
+ () => ({tableId, cellId, descending, offset, limit, sorter}),
576
+ [tableId, cellId, descending, offset, limit, sorter],
577
+ );
558
578
  useListener(
559
579
  SORTED_ROW_IDS,
560
580
  useStoreOrStoreById(storeOrStoreId),
561
581
  listener,
562
582
  listenerDeps,
563
- [tableId, cellId, descending, offset, limit],
583
+ isUndefined(sorter)
584
+ ? [tableId, cellId, descending, offset, limit]
585
+ : [sortedRowIdsArgs],
564
586
  mutator,
565
587
  );
588
+ };
566
589
  const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
567
590
  useMemo(create, createDeps);
568
591
  const useStoreIds = () => useThingIds(OFFSET_STORE);
@@ -632,6 +655,7 @@ const useSortedRowIds = (
632
655
  descending,
633
656
  offset,
634
657
  limit,
658
+ sorterOrStoreOrStoreId,
635
659
  storeOrStoreId,
636
660
  ) =>
637
661
  useSortedRowIdsImpl(
@@ -642,6 +666,7 @@ const useSortedRowIds = (
642
666
  tableIdOrArgs.descending ?? false,
643
667
  tableIdOrArgs.offset ?? 0,
644
668
  tableIdOrArgs.limit,
669
+ tableIdOrArgs.sorter,
645
670
  cellIdOrStoreOrStoreId,
646
671
  ]
647
672
  : [
@@ -650,7 +675,10 @@ const useSortedRowIds = (
650
675
  descending,
651
676
  offset,
652
677
  limit,
653
- storeOrStoreId,
678
+ isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
679
+ isFunction(sorterOrStoreOrStoreId)
680
+ ? storeOrStoreId
681
+ : sorterOrStoreOrStoreId,
654
682
  ]),
655
683
  );
656
684
  const useHasRow = (tableId, rowId, storeOrStoreId) =>
@@ -1057,6 +1085,7 @@ const useSortedRowIdsListener = (
1057
1085
  tableIdOrArgs.descending ?? false,
1058
1086
  tableIdOrArgs.offset ?? 0,
1059
1087
  tableIdOrArgs.limit,
1088
+ tableIdOrArgs.sorter,
1060
1089
  cellIdOrListener,
1061
1090
  descendingOrListenerDeps,
1062
1091
  offsetOrMutator,
@@ -1068,6 +1097,7 @@ const useSortedRowIdsListener = (
1068
1097
  descendingOrListenerDeps,
1069
1098
  offsetOrMutator,
1070
1099
  limitOrStoreOrStoreId,
1100
+ void 0,
1071
1101
  listener,
1072
1102
  listenerDeps,
1073
1103
  mutator,
@@ -1302,6 +1332,13 @@ const useIndexIds = (indexesOrIndexesId) =>
1302
1332
  useIndexesOrIndexesById(indexesOrIndexesId),
1303
1333
  1 /* Array */,
1304
1334
  );
1335
+ const useHasIndex = (indexId, indexesOrIndexesId) =>
1336
+ useListenable(
1337
+ INDEX,
1338
+ useIndexesOrIndexesById(indexesOrIndexesId),
1339
+ 6 /* Boolean */,
1340
+ [indexId],
1341
+ );
1305
1342
  const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1306
1343
  useListenable(
1307
1344
  SLICE + ROW_IDS,
@@ -1309,6 +1346,13 @@ const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1309
1346
  1 /* Array */,
1310
1347
  [indexId, sliceId],
1311
1348
  );
1349
+ const useHasSlice = (indexId, sliceId, indexesOrIndexesId) =>
1350
+ useListenable(
1351
+ SLICE,
1352
+ useIndexesOrIndexesById(indexesOrIndexesId),
1353
+ 6 /* Boolean */,
1354
+ [indexId, sliceId],
1355
+ );
1312
1356
  const useSliceIdsListener = (
1313
1357
  indexId,
1314
1358
  listener,
@@ -2431,8 +2475,10 @@ export {
2431
2475
  useGoToCallback,
2432
2476
  useHasCell,
2433
2477
  useHasCellListener,
2478
+ useHasIndex,
2434
2479
  useHasRow,
2435
2480
  useHasRowListener,
2481
+ useHasSlice,
2436
2482
  useHasTable,
2437
2483
  useHasTableCell,
2438
2484
  useHasTableCellListener,
@@ -312,14 +312,29 @@ const useSortedRowIdsImpl = (
312
312
  descending,
313
313
  offset,
314
314
  limit,
315
+ sorter,
315
316
  storeOrStoreId,
316
- ) =>
317
- useListenable(
317
+ ) => {
318
+ const sortedRowIdsArgs = useMemo(
319
+ () => ({
320
+ tableId,
321
+ cellId,
322
+ descending: descending ?? false,
323
+ offset: offset ?? 0,
324
+ limit,
325
+ sorter,
326
+ }),
327
+ [tableId, cellId, descending, offset, limit, sorter],
328
+ );
329
+ return useListenable(
318
330
  SORTED_ROW_IDS,
319
331
  useStoreOrStoreById(storeOrStoreId),
320
332
  1 /* Array */,
321
- [tableId, cellId, descending, offset, limit],
333
+ isUndefined(sorter)
334
+ ? [tableId, cellId, descending, offset, limit]
335
+ : [sortedRowIdsArgs],
322
336
  );
337
+ };
323
338
  const useStoreOrStoreById = (storeOrStoreId) =>
324
339
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
325
340
  const useTableCellIds = (tableId, storeOrStoreId) =>
@@ -346,6 +361,7 @@ const useSortedRowIds = (
346
361
  descending,
347
362
  offset,
348
363
  limit,
364
+ sorterOrStoreOrStoreId,
349
365
  storeOrStoreId,
350
366
  ) =>
351
367
  useSortedRowIdsImpl(
@@ -356,6 +372,7 @@ const useSortedRowIds = (
356
372
  tableIdOrArgs.descending ?? false,
357
373
  tableIdOrArgs.offset ?? 0,
358
374
  tableIdOrArgs.limit,
375
+ tableIdOrArgs.sorter,
359
376
  cellIdOrStoreOrStoreId,
360
377
  ]
361
378
  : [
@@ -364,7 +381,10 @@ const useSortedRowIds = (
364
381
  descending,
365
382
  offset,
366
383
  limit,
367
- storeOrStoreId,
384
+ isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
385
+ isFunction(sorterOrStoreOrStoreId)
386
+ ? storeOrStoreId
387
+ : sorterOrStoreOrStoreId,
368
388
  ]),
369
389
  );
370
390
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -312,14 +312,29 @@ const useSortedRowIdsImpl = (
312
312
  descending,
313
313
  offset,
314
314
  limit,
315
+ sorter,
315
316
  storeOrStoreId,
316
- ) =>
317
- useListenable(
317
+ ) => {
318
+ const sortedRowIdsArgs = useMemo(
319
+ () => ({
320
+ tableId,
321
+ cellId,
322
+ descending: descending ?? false,
323
+ offset: offset ?? 0,
324
+ limit,
325
+ sorter,
326
+ }),
327
+ [tableId, cellId, descending, offset, limit, sorter],
328
+ );
329
+ return useListenable(
318
330
  SORTED_ROW_IDS,
319
331
  useStoreOrStoreById(storeOrStoreId),
320
332
  1 /* Array */,
321
- [tableId, cellId, descending, offset, limit],
333
+ isUndefined(sorter)
334
+ ? [tableId, cellId, descending, offset, limit]
335
+ : [sortedRowIdsArgs],
322
336
  );
337
+ };
323
338
  const useStoreOrStoreById = (storeOrStoreId) =>
324
339
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
325
340
  const useTableCellIds = (tableId, storeOrStoreId) =>
@@ -346,6 +361,7 @@ const useSortedRowIds = (
346
361
  descending,
347
362
  offset,
348
363
  limit,
364
+ sorterOrStoreOrStoreId,
349
365
  storeOrStoreId,
350
366
  ) =>
351
367
  useSortedRowIdsImpl(
@@ -356,6 +372,7 @@ const useSortedRowIds = (
356
372
  tableIdOrArgs.descending ?? false,
357
373
  tableIdOrArgs.offset ?? 0,
358
374
  tableIdOrArgs.limit,
375
+ tableIdOrArgs.sorter,
359
376
  cellIdOrStoreOrStoreId,
360
377
  ]
361
378
  : [
@@ -364,7 +381,10 @@ const useSortedRowIds = (
364
381
  descending,
365
382
  offset,
366
383
  limit,
367
- storeOrStoreId,
384
+ isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
385
+ isFunction(sorterOrStoreOrStoreId)
386
+ ? storeOrStoreId
387
+ : sorterOrStoreOrStoreId,
368
388
  ]),
369
389
  );
370
390
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
@@ -917,14 +917,29 @@ const useSortedRowIdsImpl = (
917
917
  descending,
918
918
  offset,
919
919
  limit,
920
+ sorter,
920
921
  storeOrStoreId,
921
- ) =>
922
- useListenable(
922
+ ) => {
923
+ const sortedRowIdsArgs = useMemo(
924
+ () => ({
925
+ tableId,
926
+ cellId,
927
+ descending: descending ?? false,
928
+ offset: offset ?? 0,
929
+ limit,
930
+ sorter,
931
+ }),
932
+ [tableId, cellId, descending, offset, limit, sorter],
933
+ );
934
+ return useListenable(
923
935
  SORTED_ROW_IDS,
924
936
  useStoreOrStoreById(storeOrStoreId),
925
937
  1 /* Array */,
926
- [tableId, cellId, descending, offset, limit],
938
+ isUndefined(sorter)
939
+ ? [tableId, cellId, descending, offset, limit]
940
+ : [sortedRowIdsArgs],
927
941
  );
942
+ };
928
943
  const useStoreOrStoreById = (storeOrStoreId) =>
929
944
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
930
945
  const useSortedRowIds = (
@@ -933,6 +948,7 @@ const useSortedRowIds = (
933
948
  descending,
934
949
  offset,
935
950
  limit,
951
+ sorterOrStoreOrStoreId,
936
952
  storeOrStoreId,
937
953
  ) =>
938
954
  useSortedRowIdsImpl(
@@ -943,6 +959,7 @@ const useSortedRowIds = (
943
959
  tableIdOrArgs.descending ?? false,
944
960
  tableIdOrArgs.offset ?? 0,
945
961
  tableIdOrArgs.limit,
962
+ tableIdOrArgs.sorter,
946
963
  cellIdOrStoreOrStoreId,
947
964
  ]
948
965
  : [
@@ -951,7 +968,10 @@ const useSortedRowIds = (
951
968
  descending,
952
969
  offset,
953
970
  limit,
954
- storeOrStoreId,
971
+ isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
972
+ isFunction(sorterOrStoreOrStoreId)
973
+ ? storeOrStoreId
974
+ : sorterOrStoreOrStoreId,
955
975
  ]),
956
976
  );
957
977
  const useCellListener = (
@@ -917,14 +917,29 @@ const useSortedRowIdsImpl = (
917
917
  descending,
918
918
  offset,
919
919
  limit,
920
+ sorter,
920
921
  storeOrStoreId,
921
- ) =>
922
- useListenable(
922
+ ) => {
923
+ const sortedRowIdsArgs = useMemo(
924
+ () => ({
925
+ tableId,
926
+ cellId,
927
+ descending: descending ?? false,
928
+ offset: offset ?? 0,
929
+ limit,
930
+ sorter,
931
+ }),
932
+ [tableId, cellId, descending, offset, limit, sorter],
933
+ );
934
+ return useListenable(
923
935
  SORTED_ROW_IDS,
924
936
  useStoreOrStoreById(storeOrStoreId),
925
937
  1 /* Array */,
926
- [tableId, cellId, descending, offset, limit],
938
+ isUndefined(sorter)
939
+ ? [tableId, cellId, descending, offset, limit]
940
+ : [sortedRowIdsArgs],
927
941
  );
942
+ };
928
943
  const useStoreOrStoreById = (storeOrStoreId) =>
929
944
  useThingOrThingById(storeOrStoreId, OFFSET_STORE);
930
945
  const useSortedRowIds = (
@@ -933,6 +948,7 @@ const useSortedRowIds = (
933
948
  descending,
934
949
  offset,
935
950
  limit,
951
+ sorterOrStoreOrStoreId,
936
952
  storeOrStoreId,
937
953
  ) =>
938
954
  useSortedRowIdsImpl(
@@ -943,6 +959,7 @@ const useSortedRowIds = (
943
959
  tableIdOrArgs.descending ?? false,
944
960
  tableIdOrArgs.offset ?? 0,
945
961
  tableIdOrArgs.limit,
962
+ tableIdOrArgs.sorter,
946
963
  cellIdOrStoreOrStoreId,
947
964
  ]
948
965
  : [
@@ -951,7 +968,10 @@ const useSortedRowIds = (
951
968
  descending,
952
969
  offset,
953
970
  limit,
954
- storeOrStoreId,
971
+ isFunction(sorterOrStoreOrStoreId) ? sorterOrStoreOrStoreId : void 0,
972
+ isFunction(sorterOrStoreOrStoreId)
973
+ ? storeOrStoreId
974
+ : sorterOrStoreOrStoreId,
955
975
  ]),
956
976
  );
957
977
  const useCellListener = (