tinybase 9.0.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 (111) 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-react-dom/index.d.ts +10 -10
  8. package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
  9. package/@types/ui-react-dom-charts/index.d.ts +7 -7
  10. package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
  11. package/@types/ui-react-inspector/index.d.ts +1 -1
  12. package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
  13. package/@types/ui-solid/index.d.ts +9 -2
  14. package/@types/ui-solid/with-schemas/index.d.ts +10 -2
  15. package/@types/ui-solid-dom/index.d.ts +10 -10
  16. package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
  17. package/@types/ui-solid-inspector/index.d.ts +1 -1
  18. package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
  19. package/@types/ui-svelte/index.d.ts +50 -2
  20. package/@types/ui-svelte/with-schemas/index.d.ts +88 -25
  21. package/@types/ui-svelte-dom/index.d.ts +10 -10
  22. package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
  23. package/@types/ui-svelte-inspector/index.d.ts +1 -1
  24. package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
  25. package/index.js +34 -6
  26. package/mergeable-store/index.js +34 -6
  27. package/mergeable-store/with-schemas/index.js +34 -6
  28. package/min/index.js +1 -1
  29. package/min/index.js.gz +0 -0
  30. package/min/mergeable-store/index.js +1 -1
  31. package/min/mergeable-store/index.js.gz +0 -0
  32. package/min/mergeable-store/with-schemas/index.js +1 -1
  33. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  34. package/min/omni/index.js +1 -1
  35. package/min/omni/index.js.gz +0 -0
  36. package/min/omni/with-schemas/index.js +1 -1
  37. package/min/omni/with-schemas/index.js.gz +0 -0
  38. package/min/store/index.js +1 -1
  39. package/min/store/index.js.gz +0 -0
  40. package/min/store/with-schemas/index.js +1 -1
  41. package/min/store/with-schemas/index.js.gz +0 -0
  42. package/min/ui-react/index.js +1 -1
  43. package/min/ui-react/index.js.gz +0 -0
  44. package/min/ui-react/with-schemas/index.js +1 -1
  45. package/min/ui-react/with-schemas/index.js.gz +0 -0
  46. package/min/ui-react-dom/index.js +1 -1
  47. package/min/ui-react-dom/index.js.gz +0 -0
  48. package/min/ui-react-dom/with-schemas/index.js +1 -1
  49. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  50. package/min/ui-react-dom-charts/index.js +1 -1
  51. package/min/ui-react-dom-charts/index.js.gz +0 -0
  52. package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
  53. package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
  54. package/min/ui-react-inspector/index.js +1 -1
  55. package/min/ui-react-inspector/index.js.gz +0 -0
  56. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  57. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  58. package/min/ui-solid/index.js +1 -1
  59. package/min/ui-solid/index.js.gz +0 -0
  60. package/min/ui-solid/with-schemas/index.js +1 -1
  61. package/min/ui-solid/with-schemas/index.js.gz +0 -0
  62. package/min/ui-solid-dom/index.js +1 -1
  63. package/min/ui-solid-dom/index.js.gz +0 -0
  64. package/min/ui-solid-dom/with-schemas/index.js +1 -1
  65. package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
  66. package/min/ui-solid-inspector/index.js +1 -1
  67. package/min/ui-solid-inspector/index.js.gz +0 -0
  68. package/min/ui-solid-inspector/with-schemas/index.js +1 -1
  69. package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
  70. package/min/ui-svelte/index.js +1 -1
  71. package/min/ui-svelte/index.js.gz +0 -0
  72. package/min/ui-svelte/with-schemas/index.js +1 -1
  73. package/min/ui-svelte/with-schemas/index.js.gz +0 -0
  74. package/min/ui-svelte-dom/index.js +1 -1
  75. package/min/ui-svelte-dom/index.js.gz +0 -0
  76. package/min/ui-svelte-dom/with-schemas/index.js +1 -1
  77. package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
  78. package/min/ui-svelte-inspector/index.js +1 -1
  79. package/min/ui-svelte-inspector/index.js.gz +0 -0
  80. package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
  81. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  82. package/min/with-schemas/index.js +1 -1
  83. package/min/with-schemas/index.js.gz +0 -0
  84. package/omni/index.js +34 -6
  85. package/omni/with-schemas/index.js +34 -6
  86. package/package.json +3 -3
  87. package/readme.md +14 -14
  88. package/releases.md +59 -59
  89. package/store/index.js +34 -6
  90. package/store/with-schemas/index.js +34 -6
  91. package/ui-react/index.js +36 -6
  92. package/ui-react/with-schemas/index.js +36 -6
  93. package/ui-react-dom/index.js +24 -4
  94. package/ui-react-dom/with-schemas/index.js +24 -4
  95. package/ui-react-dom-charts/index.js +24 -4
  96. package/ui-react-dom-charts/with-schemas/index.js +24 -4
  97. package/ui-react-inspector/index.js +58 -10
  98. package/ui-react-inspector/with-schemas/index.js +58 -10
  99. package/ui-solid/index.js +32 -2
  100. package/ui-solid/with-schemas/index.js +32 -2
  101. package/ui-solid-dom/index.js +17 -1
  102. package/ui-solid-dom/with-schemas/index.js +17 -1
  103. package/ui-solid-inspector/index.js +51 -7
  104. package/ui-solid-inspector/with-schemas/index.js +51 -7
  105. package/ui-svelte/index.js +73 -31
  106. package/ui-svelte/with-schemas/index.js +73 -31
  107. package/ui-svelte-dom/index.js +35 -14
  108. package/ui-svelte-dom/with-schemas/index.js +35 -14
  109. package/ui-svelte-inspector/index.js +69 -20
  110. package/ui-svelte-inspector/with-schemas/index.js +69 -20
  111. package/with-schemas/index.js +34 -6
package/omni/index.js CHANGED
@@ -2206,13 +2206,36 @@ const createStore = () => {
2206
2206
  listener,
2207
2207
  mutator,
2208
2208
  ) => {
2209
- let sortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2209
+ const [descending, offset, limit, sorter] = otherArgs;
2210
+ let sortedRowIds = getSortedRowIds(
2211
+ tableId,
2212
+ cellId,
2213
+ descending,
2214
+ offset,
2215
+ limit,
2216
+ sorter,
2217
+ );
2210
2218
  return addListener(
2211
2219
  () => {
2212
- const newSortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2220
+ const newSortedRowIds = getSortedRowIds(
2221
+ tableId,
2222
+ cellId,
2223
+ descending,
2224
+ offset,
2225
+ limit,
2226
+ sorter,
2227
+ );
2213
2228
  if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
2214
2229
  sortedRowIds = newSortedRowIds;
2215
- listener(store, tableId, cellId, ...otherArgs, sortedRowIds);
2230
+ listener(
2231
+ store,
2232
+ tableId,
2233
+ cellId,
2234
+ descending,
2235
+ offset,
2236
+ limit,
2237
+ sortedRowIds,
2238
+ );
2216
2239
  }
2217
2240
  },
2218
2241
  sortedRowIdsListeners[mutator ? 1 : 0],
@@ -2266,6 +2289,7 @@ const createStore = () => {
2266
2289
  descending,
2267
2290
  offset = 0,
2268
2291
  limit,
2292
+ sorter = defaultSorter,
2269
2293
  ) =>
2270
2294
  isObject(tableIdOrArgs)
2271
2295
  ? getSortedRowIds(
@@ -2274,16 +2298,19 @@ const createStore = () => {
2274
2298
  tableIdOrArgs.descending,
2275
2299
  tableIdOrArgs.offset,
2276
2300
  tableIdOrArgs.limit,
2301
+ tableIdOrArgs.sorter,
2277
2302
  )
2278
2303
  : arrayMap(
2279
2304
  slice(
2280
2305
  arraySort(
2281
2306
  mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
2282
- isUndefined(cellId) ? rowId : mapGet(row, id(cellId)),
2307
+ isUndefined(cellId)
2308
+ ? rowId
2309
+ : decodeIfJson(mapGet(row, id(cellId))),
2283
2310
  rowId,
2284
2311
  ]),
2285
2312
  ([cell1], [cell2]) =>
2286
- defaultSorter(cell1, cell2) * (descending ? -1 : 1),
2313
+ sorter(cell1, cell2) * (descending ? -1 : 1),
2287
2314
  ),
2288
2315
  offset,
2289
2316
  isUndefined(limit) ? limit : offset + limit,
@@ -2761,6 +2788,7 @@ const createStore = () => {
2761
2788
  tableIdOrArgs.descending ?? false,
2762
2789
  tableIdOrArgs.offset ?? 0,
2763
2790
  tableIdOrArgs.limit,
2791
+ tableIdOrArgs.sorter,
2764
2792
  ],
2765
2793
  cellIdOrListener,
2766
2794
  descendingOrMutator,
@@ -2768,7 +2796,7 @@ const createStore = () => {
2768
2796
  : addSortedRowIdsListenerImpl(
2769
2797
  tableIdOrArgs,
2770
2798
  cellIdOrListener,
2771
- [descendingOrMutator, offset, limit],
2799
+ [descendingOrMutator, offset, limit, void 0],
2772
2800
  listener,
2773
2801
  mutator,
2774
2802
  );
@@ -2206,13 +2206,36 @@ const createStore = () => {
2206
2206
  listener,
2207
2207
  mutator,
2208
2208
  ) => {
2209
- let sortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2209
+ const [descending, offset, limit, sorter] = otherArgs;
2210
+ let sortedRowIds = getSortedRowIds(
2211
+ tableId,
2212
+ cellId,
2213
+ descending,
2214
+ offset,
2215
+ limit,
2216
+ sorter,
2217
+ );
2210
2218
  return addListener(
2211
2219
  () => {
2212
- const newSortedRowIds = getSortedRowIds(tableId, cellId, ...otherArgs);
2220
+ const newSortedRowIds = getSortedRowIds(
2221
+ tableId,
2222
+ cellId,
2223
+ descending,
2224
+ offset,
2225
+ limit,
2226
+ sorter,
2227
+ );
2213
2228
  if (!arrayIsEqual(newSortedRowIds, sortedRowIds)) {
2214
2229
  sortedRowIds = newSortedRowIds;
2215
- listener(store, tableId, cellId, ...otherArgs, sortedRowIds);
2230
+ listener(
2231
+ store,
2232
+ tableId,
2233
+ cellId,
2234
+ descending,
2235
+ offset,
2236
+ limit,
2237
+ sortedRowIds,
2238
+ );
2216
2239
  }
2217
2240
  },
2218
2241
  sortedRowIdsListeners[mutator ? 1 : 0],
@@ -2266,6 +2289,7 @@ const createStore = () => {
2266
2289
  descending,
2267
2290
  offset = 0,
2268
2291
  limit,
2292
+ sorter = defaultSorter,
2269
2293
  ) =>
2270
2294
  isObject(tableIdOrArgs)
2271
2295
  ? getSortedRowIds(
@@ -2274,16 +2298,19 @@ const createStore = () => {
2274
2298
  tableIdOrArgs.descending,
2275
2299
  tableIdOrArgs.offset,
2276
2300
  tableIdOrArgs.limit,
2301
+ tableIdOrArgs.sorter,
2277
2302
  )
2278
2303
  : arrayMap(
2279
2304
  slice(
2280
2305
  arraySort(
2281
2306
  mapMap(mapGet(tablesMap, id(tableIdOrArgs)), (row, rowId) => [
2282
- isUndefined(cellId) ? rowId : mapGet(row, id(cellId)),
2307
+ isUndefined(cellId)
2308
+ ? rowId
2309
+ : decodeIfJson(mapGet(row, id(cellId))),
2283
2310
  rowId,
2284
2311
  ]),
2285
2312
  ([cell1], [cell2]) =>
2286
- defaultSorter(cell1, cell2) * (descending ? -1 : 1),
2313
+ sorter(cell1, cell2) * (descending ? -1 : 1),
2287
2314
  ),
2288
2315
  offset,
2289
2316
  isUndefined(limit) ? limit : offset + limit,
@@ -2761,6 +2788,7 @@ const createStore = () => {
2761
2788
  tableIdOrArgs.descending ?? false,
2762
2789
  tableIdOrArgs.offset ?? 0,
2763
2790
  tableIdOrArgs.limit,
2791
+ tableIdOrArgs.sorter,
2764
2792
  ],
2765
2793
  cellIdOrListener,
2766
2794
  descendingOrMutator,
@@ -2768,7 +2796,7 @@ const createStore = () => {
2768
2796
  : addSortedRowIdsListenerImpl(
2769
2797
  tableIdOrArgs,
2770
2798
  cellIdOrListener,
2771
- [descendingOrMutator, offset, limit],
2799
+ [descendingOrMutator, offset, limit, void 0],
2772
2800
  listener,
2773
2801
  mutator,
2774
2802
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "9.0.0",
3
+ "version": "9.1.0-beta.1",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "sideEffects": false,
25
25
  "peerDependencies": {
26
26
  "@automerge/automerge-repo": "^2.5.6",
27
- "@cloudflare/workers-types": "^5.20260703.1",
27
+ "@cloudflare/workers-types": "^5.20260704.1",
28
28
  "@electric-sql/pglite": "^0.5.4",
29
29
  "@libsql/client": "^0.17.4",
30
30
  "@powersync/common": "^1.57.0",
@@ -35,7 +35,7 @@
35
35
  "bun": "^1.3.14",
36
36
  "effect": "^3.21.4",
37
37
  "electric-sql": "^0.12.1",
38
- "expo": "^57.0.1",
38
+ "expo": "^57.0.2",
39
39
  "expo-sqlite": "^57.0.0",
40
40
  "partykit": "^0.0.115",
41
41
  "partysocket": "^1.3.0",