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
package/ui-solid/index.js CHANGED
@@ -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,
@@ -1006,6 +1035,13 @@ const useIndexIds = (indexesOrIndexesId) =>
1006
1035
  useIndexesOrIndexesById(indexesOrIndexesId),
1007
1036
  1 /* Array */,
1008
1037
  );
1038
+ const useHasIndex = (indexId, indexesOrIndexesId) =>
1039
+ useListenable(
1040
+ INDEX,
1041
+ useIndexesOrIndexesById(indexesOrIndexesId),
1042
+ 6 /* Boolean */,
1043
+ [indexId],
1044
+ );
1009
1045
  const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1010
1046
  useListenable(
1011
1047
  SLICE + ROW_IDS,
@@ -1013,6 +1049,13 @@ const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1013
1049
  1 /* Array */,
1014
1050
  [indexId, sliceId],
1015
1051
  );
1052
+ const useHasSlice = (indexId, sliceId, indexesOrIndexesId) =>
1053
+ useListenable(
1054
+ SLICE,
1055
+ useIndexesOrIndexesById(indexesOrIndexesId),
1056
+ 6 /* Boolean */,
1057
+ [indexId, sliceId],
1058
+ );
1016
1059
  const useSliceIdsListener = (indexId, listener, indexesOrIndexesId) =>
1017
1060
  useListener(
1018
1061
  SLICE + IDS,
@@ -1985,6 +2028,7 @@ const SortedTableView = (props) =>
1985
2028
  () => props.descending,
1986
2029
  () => props.offset,
1987
2030
  () => props.limit,
2031
+ void 0,
1988
2032
  () => props.store,
1989
2033
  ),
1990
2034
  );
@@ -2126,8 +2170,10 @@ export {
2126
2170
  useGoToCallback,
2127
2171
  useHasCell,
2128
2172
  useHasCellListener,
2173
+ useHasIndex,
2129
2174
  useHasRow,
2130
2175
  useHasRowListener,
2176
+ useHasSlice,
2131
2177
  useHasTable,
2132
2178
  useHasTableCell,
2133
2179
  useHasTableCellListener,
@@ -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,
@@ -1006,6 +1035,13 @@ const useIndexIds = (indexesOrIndexesId) =>
1006
1035
  useIndexesOrIndexesById(indexesOrIndexesId),
1007
1036
  1 /* Array */,
1008
1037
  );
1038
+ const useHasIndex = (indexId, indexesOrIndexesId) =>
1039
+ useListenable(
1040
+ INDEX,
1041
+ useIndexesOrIndexesById(indexesOrIndexesId),
1042
+ 6 /* Boolean */,
1043
+ [indexId],
1044
+ );
1009
1045
  const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1010
1046
  useListenable(
1011
1047
  SLICE + ROW_IDS,
@@ -1013,6 +1049,13 @@ const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
1013
1049
  1 /* Array */,
1014
1050
  [indexId, sliceId],
1015
1051
  );
1052
+ const useHasSlice = (indexId, sliceId, indexesOrIndexesId) =>
1053
+ useListenable(
1054
+ SLICE,
1055
+ useIndexesOrIndexesById(indexesOrIndexesId),
1056
+ 6 /* Boolean */,
1057
+ [indexId, sliceId],
1058
+ );
1016
1059
  const useSliceIdsListener = (indexId, listener, indexesOrIndexesId) =>
1017
1060
  useListener(
1018
1061
  SLICE + IDS,
@@ -1985,6 +2028,7 @@ const SortedTableView = (props) =>
1985
2028
  () => props.descending,
1986
2029
  () => props.offset,
1987
2030
  () => props.limit,
2031
+ void 0,
1988
2032
  () => props.store,
1989
2033
  ),
1990
2034
  );
@@ -2126,8 +2170,10 @@ export {
2126
2170
  useGoToCallback,
2127
2171
  useHasCell,
2128
2172
  useHasCellListener,
2173
+ useHasIndex,
2129
2174
  useHasRow,
2130
2175
  useHasRowListener,
2176
+ useHasSlice,
2131
2177
  useHasTable,
2132
2178
  useHasTableCell,
2133
2179
  useHasTableCellListener,
@@ -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,