tinybase 8.1.0-beta.1 → 8.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 (124) hide show
  1. package/@types/_internal/ui/index.d.ts +0 -0
  2. package/@types/_internal/ui/with-schemas/index.d.ts +47 -0
  3. package/@types/_internal/ui-react/with-schemas/index.d.ts +9 -31
  4. package/@types/omni/index.d.ts +0 -3
  5. package/@types/omni/with-schemas/index.d.ts +0 -3
  6. package/@types/ui-react/with-schemas/index.d.ts +10 -8
  7. package/@types/ui-react-dom/with-schemas/index.d.ts +6 -4
  8. package/@types/ui-svelte/index.d.ts +1458 -222
  9. package/@types/ui-svelte/with-schemas/index.d.ts +2482 -406
  10. package/checkpoints/index.js +4 -1
  11. package/checkpoints/with-schemas/index.js +4 -1
  12. package/common/index.js +4 -1
  13. package/common/with-schemas/index.js +4 -1
  14. package/index.js +4 -1
  15. package/indexes/index.js +4 -1
  16. package/indexes/with-schemas/index.js +4 -1
  17. package/mergeable-store/index.js +4 -1
  18. package/mergeable-store/with-schemas/index.js +4 -1
  19. package/metrics/index.js +4 -1
  20. package/metrics/with-schemas/index.js +4 -1
  21. package/min/omni/index.js +1 -1
  22. package/min/omni/index.js.gz +0 -0
  23. package/min/omni/with-schemas/index.js +1 -1
  24. package/min/omni/with-schemas/index.js.gz +0 -0
  25. package/min/ui-react/index.js +1 -1
  26. package/min/ui-react/index.js.gz +0 -0
  27. package/min/ui-react/with-schemas/index.js +1 -1
  28. package/min/ui-react/with-schemas/index.js.gz +0 -0
  29. package/min/ui-svelte/index.js +1 -1
  30. package/min/ui-svelte/index.js.gz +0 -0
  31. package/min/ui-svelte/with-schemas/index.js +1 -1
  32. package/min/ui-svelte/with-schemas/index.js.gz +0 -0
  33. package/omni/index.js +11 -4739
  34. package/omni/with-schemas/index.js +11 -4739
  35. package/package.json +8 -8
  36. package/persisters/index.js +4 -1
  37. package/persisters/persister-automerge/index.js +4 -1
  38. package/persisters/persister-automerge/with-schemas/index.js +4 -1
  39. package/persisters/persister-browser/index.js +4 -1
  40. package/persisters/persister-browser/with-schemas/index.js +4 -1
  41. package/persisters/persister-cr-sqlite-wasm/index.js +4 -1
  42. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +4 -1
  43. package/persisters/persister-durable-object-sql-storage/index.js +4 -1
  44. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +4 -1
  45. package/persisters/persister-durable-object-storage/index.js +4 -1
  46. package/persisters/persister-durable-object-storage/with-schemas/index.js +4 -1
  47. package/persisters/persister-electric-sql/index.js +4 -1
  48. package/persisters/persister-electric-sql/with-schemas/index.js +4 -1
  49. package/persisters/persister-expo-sqlite/index.js +4 -1
  50. package/persisters/persister-expo-sqlite/with-schemas/index.js +4 -1
  51. package/persisters/persister-file/index.js +4 -1
  52. package/persisters/persister-file/with-schemas/index.js +4 -1
  53. package/persisters/persister-indexed-db/index.js +4 -1
  54. package/persisters/persister-indexed-db/with-schemas/index.js +4 -1
  55. package/persisters/persister-libsql/index.js +4 -1
  56. package/persisters/persister-libsql/with-schemas/index.js +4 -1
  57. package/persisters/persister-partykit-client/index.js +4 -1
  58. package/persisters/persister-partykit-client/with-schemas/index.js +4 -1
  59. package/persisters/persister-partykit-server/index.js +4 -1
  60. package/persisters/persister-partykit-server/with-schemas/index.js +4 -1
  61. package/persisters/persister-pglite/index.js +4 -1
  62. package/persisters/persister-pglite/with-schemas/index.js +4 -1
  63. package/persisters/persister-postgres/index.js +4 -1
  64. package/persisters/persister-postgres/with-schemas/index.js +4 -1
  65. package/persisters/persister-powersync/index.js +4 -1
  66. package/persisters/persister-powersync/with-schemas/index.js +4 -1
  67. package/persisters/persister-react-native-mmkv/index.js +4 -1
  68. package/persisters/persister-react-native-mmkv/with-schemas/index.js +4 -1
  69. package/persisters/persister-react-native-sqlite/index.js +4 -1
  70. package/persisters/persister-react-native-sqlite/with-schemas/index.js +4 -1
  71. package/persisters/persister-remote/index.js +4 -1
  72. package/persisters/persister-remote/with-schemas/index.js +4 -1
  73. package/persisters/persister-sqlite-bun/index.js +4 -1
  74. package/persisters/persister-sqlite-bun/with-schemas/index.js +4 -1
  75. package/persisters/persister-sqlite-wasm/index.js +4 -1
  76. package/persisters/persister-sqlite-wasm/with-schemas/index.js +4 -1
  77. package/persisters/persister-sqlite3/index.js +4 -1
  78. package/persisters/persister-sqlite3/with-schemas/index.js +4 -1
  79. package/persisters/persister-yjs/index.js +4 -1
  80. package/persisters/persister-yjs/with-schemas/index.js +4 -1
  81. package/persisters/with-schemas/index.js +4 -1
  82. package/queries/index.js +4 -1
  83. package/queries/with-schemas/index.js +4 -1
  84. package/relationships/index.js +4 -1
  85. package/relationships/with-schemas/index.js +4 -1
  86. package/schematizers/index.js +4 -1
  87. package/schematizers/schematizer-arktype/index.js +4 -1
  88. package/schematizers/schematizer-arktype/with-schemas/index.js +4 -1
  89. package/schematizers/schematizer-effect/index.js +4 -1
  90. package/schematizers/schematizer-effect/with-schemas/index.js +4 -1
  91. package/schematizers/schematizer-typebox/index.js +4 -1
  92. package/schematizers/schematizer-typebox/with-schemas/index.js +4 -1
  93. package/schematizers/schematizer-valibot/index.js +4 -1
  94. package/schematizers/schematizer-valibot/with-schemas/index.js +4 -1
  95. package/schematizers/schematizer-yup/index.js +4 -1
  96. package/schematizers/schematizer-yup/with-schemas/index.js +4 -1
  97. package/schematizers/schematizer-zod/index.js +4 -1
  98. package/schematizers/schematizer-zod/with-schemas/index.js +4 -1
  99. package/schematizers/with-schemas/index.js +4 -1
  100. package/store/index.js +4 -1
  101. package/store/with-schemas/index.js +4 -1
  102. package/synchronizers/index.js +4 -1
  103. package/synchronizers/synchronizer-broadcast-channel/index.js +4 -1
  104. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +4 -1
  105. package/synchronizers/synchronizer-local/index.js +4 -1
  106. package/synchronizers/synchronizer-local/with-schemas/index.js +4 -1
  107. package/synchronizers/synchronizer-ws-client/index.js +4 -1
  108. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +4 -1
  109. package/synchronizers/synchronizer-ws-server/index.js +4 -1
  110. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -1
  111. package/synchronizers/synchronizer-ws-server-durable-object/index.js +4 -1
  112. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +4 -1
  113. package/synchronizers/synchronizer-ws-server-simple/index.js +4 -1
  114. package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +4 -1
  115. package/synchronizers/with-schemas/index.js +4 -1
  116. package/ui-react/index.js +100 -100
  117. package/ui-react/with-schemas/index.js +100 -100
  118. package/ui-react-dom/index.js +4 -1
  119. package/ui-react-dom/with-schemas/index.js +4 -1
  120. package/ui-react-inspector/index.js +4 -1
  121. package/ui-react-inspector/with-schemas/index.js +4 -1
  122. package/ui-svelte/index.js +1016 -347
  123. package/ui-svelte/with-schemas/index.js +1002 -333
  124. package/with-schemas/index.js +4 -1
package/ui-react/index.js CHANGED
@@ -42,7 +42,10 @@ const QUERY = 'Query';
42
42
  const CHECKPOINT = 'Checkpoint';
43
43
 
44
44
  const getIfNotFunction = (predicate) => (value, then, otherwise) =>
45
- predicate(value) ? otherwise?.() : then(value);
45
+ predicate(value)
46
+ ? /* istanbul ignore next */
47
+ otherwise?.()
48
+ : then(value);
46
49
  const GLOBAL = globalThis;
47
50
  const isNullish = (thing) => thing == null;
48
51
  const isUndefined = (thing) => thing === void 0;
@@ -1925,30 +1928,29 @@ const useSynchronizerStatusListener = (
1925
1928
  [],
1926
1929
  );
1927
1930
 
1928
- const wrap = (children, separator, encloseWithId, id) => {
1931
+ const Wrap = ({children, separator, debugIds, id}) => {
1929
1932
  const separated =
1930
1933
  isUndefined(separator) || !isArray(children)
1931
1934
  ? children
1932
1935
  : arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
1933
- return encloseWithId ? [id, ':{', separated, '}'] : separated;
1936
+ return debugIds && !isUndefined(id) ? [id, ':{', separated, '}'] : separated;
1934
1937
  };
1935
1938
 
1936
1939
  const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
1937
- wrap(
1938
- useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
1939
- void 0,
1940
+ /* @__PURE__ */ jsx(Wrap, {
1940
1941
  debugIds,
1941
- checkpointId,
1942
- );
1942
+ id: checkpointId,
1943
+ children: useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
1944
+ });
1943
1945
 
1944
1946
  const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
1945
- wrap(
1946
- EMPTY_STRING +
1947
- (useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
1948
- void 0,
1947
+ /* @__PURE__ */ jsx(Wrap, {
1949
1948
  debugIds,
1950
- cellId,
1951
- );
1949
+ id: cellId,
1950
+ children:
1951
+ EMPTY_STRING +
1952
+ (useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
1953
+ });
1952
1954
 
1953
1955
  const ResultRowView = ({
1954
1956
  queryId,
@@ -1959,8 +1961,11 @@ const ResultRowView = ({
1959
1961
  separator,
1960
1962
  debugIds,
1961
1963
  }) =>
1962
- wrap(
1963
- arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
1964
+ /* @__PURE__ */ jsx(Wrap, {
1965
+ separator,
1966
+ debugIds,
1967
+ id: rowId,
1968
+ children: arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
1964
1969
  /* @__PURE__ */ jsx(
1965
1970
  ResultCell,
1966
1971
  {
@@ -1974,18 +1979,15 @@ const ResultRowView = ({
1974
1979
  cellId,
1975
1980
  ),
1976
1981
  ),
1977
- separator,
1978
- debugIds,
1979
- rowId,
1980
- );
1982
+ });
1981
1983
 
1982
1984
  const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
1983
- wrap(
1984
- EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
1985
- void 0,
1985
+ /* @__PURE__ */ jsx(Wrap, {
1986
1986
  debugIds,
1987
- cellId,
1988
- );
1987
+ id: cellId,
1988
+ children:
1989
+ EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
1990
+ });
1989
1991
 
1990
1992
  const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
1991
1993
  const defaultCellIds = useCellIds(tableId, rowId, store);
@@ -2002,8 +2004,11 @@ const RowView = ({
2002
2004
  separator,
2003
2005
  debugIds,
2004
2006
  }) =>
2005
- wrap(
2006
- arrayMap(
2007
+ /* @__PURE__ */ jsx(Wrap, {
2008
+ separator,
2009
+ debugIds,
2010
+ id: rowId,
2011
+ children: arrayMap(
2007
2012
  useCustomOrDefaultCellIds(customCellIds, tableId, rowId, store),
2008
2013
  (cellId) =>
2009
2014
  /* @__PURE__ */ jsx(
@@ -2019,10 +2024,7 @@ const RowView = ({
2019
2024
  cellId,
2020
2025
  ),
2021
2026
  ),
2022
- separator,
2023
- debugIds,
2024
- rowId,
2025
- );
2027
+ });
2026
2028
 
2027
2029
  const tableView = (
2028
2030
  {
@@ -2036,8 +2038,11 @@ const tableView = (
2036
2038
  },
2037
2039
  rowIds,
2038
2040
  ) =>
2039
- wrap(
2040
- arrayMap(rowIds, (rowId) =>
2041
+ /* @__PURE__ */ jsx(Wrap, {
2042
+ separator,
2043
+ debugIds,
2044
+ id: tableId,
2045
+ children: arrayMap(rowIds, (rowId) =>
2041
2046
  /* @__PURE__ */ jsx(
2042
2047
  Row,
2043
2048
  {
@@ -2051,10 +2056,7 @@ const tableView = (
2051
2056
  rowId,
2052
2057
  ),
2053
2058
  ),
2054
- separator,
2055
- debugIds,
2056
- tableId,
2057
- );
2059
+ });
2058
2060
  const resultTableView = (
2059
2061
  {
2060
2062
  queryId,
@@ -2066,8 +2068,11 @@ const resultTableView = (
2066
2068
  },
2067
2069
  rowIds,
2068
2070
  ) =>
2069
- wrap(
2070
- arrayMap(rowIds, (rowId) =>
2071
+ /* @__PURE__ */ jsx(Wrap, {
2072
+ separator,
2073
+ debugIds,
2074
+ id: queryId,
2075
+ children: arrayMap(rowIds, (rowId) =>
2071
2076
  /* @__PURE__ */ jsx(
2072
2077
  ResultRow,
2073
2078
  {
@@ -2080,10 +2085,7 @@ const resultTableView = (
2080
2085
  rowId,
2081
2086
  ),
2082
2087
  ),
2083
- separator,
2084
- debugIds,
2085
- queryId,
2086
- );
2088
+ });
2087
2089
  const useComponentPerRow = (
2088
2090
  {
2089
2091
  relationshipId,
@@ -2102,8 +2104,11 @@ const useComponentPerRow = (
2102
2104
  relationshipId,
2103
2105
  );
2104
2106
  const rowIds = getRowIdsHook(relationshipId, rowId, resolvedRelationships);
2105
- return wrap(
2106
- arrayMap(rowIds, (rowId2) =>
2107
+ return /* @__PURE__ */ jsx(Wrap, {
2108
+ separator,
2109
+ debugIds,
2110
+ id: rowId,
2111
+ children: arrayMap(rowIds, (rowId2) =>
2107
2112
  /* @__PURE__ */ jsx(
2108
2113
  Row,
2109
2114
  {
@@ -2116,10 +2121,7 @@ const useComponentPerRow = (
2116
2121
  rowId2,
2117
2122
  ),
2118
2123
  ),
2119
- separator,
2120
- debugIds,
2121
- rowId,
2122
- );
2124
+ });
2123
2125
  };
2124
2126
  const getUseCheckpointView =
2125
2127
  (getCheckpoints) =>
@@ -2131,8 +2133,9 @@ const getUseCheckpointView =
2131
2133
  debugIds,
2132
2134
  }) => {
2133
2135
  const resolvedCheckpoints = useCheckpointsOrCheckpointsById(checkpoints);
2134
- return wrap(
2135
- arrayMap(
2136
+ return /* @__PURE__ */ jsx(Wrap, {
2137
+ separator,
2138
+ children: arrayMap(
2136
2139
  getCheckpoints(useCheckpointIds(resolvedCheckpoints)),
2137
2140
  (checkpointId) =>
2138
2141
  /* @__PURE__ */ jsx(
@@ -2146,8 +2149,7 @@ const getUseCheckpointView =
2146
2149
  checkpointId,
2147
2150
  ),
2148
2151
  ),
2149
- separator,
2150
- );
2152
+ });
2151
2153
  };
2152
2154
 
2153
2155
  const BackwardCheckpointsView = getUseCheckpointView(
@@ -2176,8 +2178,11 @@ const SliceView = ({
2176
2178
  indexId,
2177
2179
  );
2178
2180
  const rowIds = useSliceRowIds(indexId, sliceId, resolvedIndexes);
2179
- return wrap(
2180
- arrayMap(rowIds, (rowId) =>
2181
+ return /* @__PURE__ */ jsx(Wrap, {
2182
+ separator,
2183
+ debugIds,
2184
+ id: sliceId,
2185
+ children: arrayMap(rowIds, (rowId) =>
2181
2186
  /* @__PURE__ */ jsx(
2182
2187
  Row,
2183
2188
  {
@@ -2190,10 +2195,7 @@ const SliceView = ({
2190
2195
  rowId,
2191
2196
  ),
2192
2197
  ),
2193
- separator,
2194
- debugIds,
2195
- sliceId,
2196
- );
2198
+ });
2197
2199
  };
2198
2200
 
2199
2201
  const IndexView = ({
@@ -2204,8 +2206,11 @@ const IndexView = ({
2204
2206
  separator,
2205
2207
  debugIds,
2206
2208
  }) =>
2207
- wrap(
2208
- arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
2209
+ /* @__PURE__ */ jsx(Wrap, {
2210
+ separator,
2211
+ debugIds,
2212
+ id: indexId,
2213
+ children: arrayMap(useSliceIds(indexId, indexes), (sliceId) =>
2209
2214
  /* @__PURE__ */ jsx(
2210
2215
  Slice,
2211
2216
  {
@@ -2218,10 +2223,7 @@ const IndexView = ({
2218
2223
  sliceId,
2219
2224
  ),
2220
2225
  ),
2221
- separator,
2222
- debugIds,
2223
- indexId,
2224
- );
2226
+ });
2225
2227
 
2226
2228
  const LinkedRowsView = (props) =>
2227
2229
  useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
@@ -2230,12 +2232,11 @@ const LocalRowsView = (props) =>
2230
2232
  useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
2231
2233
 
2232
2234
  const MetricView = ({metricId, metrics, debugIds}) =>
2233
- wrap(
2234
- useMetric(metricId, metrics) ?? EMPTY_STRING,
2235
- void 0,
2235
+ /* @__PURE__ */ jsx(Wrap, {
2236
2236
  debugIds,
2237
- metricId,
2238
- );
2237
+ id: metricId,
2238
+ children: useMetric(metricId, metrics) ?? EMPTY_STRING,
2239
+ });
2239
2240
 
2240
2241
  const RemoteRowView = ({
2241
2242
  relationshipId,
@@ -2255,24 +2256,24 @@ const RemoteRowView = ({
2255
2256
  localRowId,
2256
2257
  resolvedRelationships,
2257
2258
  );
2258
- return wrap(
2259
- isUndefined(remoteTableId) || isUndefined(rowId)
2260
- ? null
2261
- : /* @__PURE__ */ jsx(
2262
- Row,
2263
- {
2264
- ...getProps(getRowComponentProps, rowId),
2265
- tableId: remoteTableId,
2266
- rowId,
2267
- store,
2268
- debugIds,
2269
- },
2270
- rowId,
2271
- ),
2272
- void 0,
2259
+ return /* @__PURE__ */ jsx(Wrap, {
2273
2260
  debugIds,
2274
- localRowId,
2275
- );
2261
+ id: localRowId,
2262
+ children:
2263
+ isUndefined(remoteTableId) || isUndefined(rowId)
2264
+ ? null
2265
+ : /* @__PURE__ */ jsx(
2266
+ Row,
2267
+ {
2268
+ ...getProps(getRowComponentProps, rowId),
2269
+ tableId: remoteTableId,
2270
+ rowId,
2271
+ store,
2272
+ debugIds,
2273
+ },
2274
+ rowId,
2275
+ ),
2276
+ });
2276
2277
  };
2277
2278
 
2278
2279
  const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
@@ -2314,8 +2315,9 @@ const TablesView = ({
2314
2315
  separator,
2315
2316
  debugIds,
2316
2317
  }) =>
2317
- wrap(
2318
- arrayMap(useTableIds(store), (tableId) =>
2318
+ /* @__PURE__ */ jsx(Wrap, {
2319
+ separator,
2320
+ children: arrayMap(useTableIds(store), (tableId) =>
2319
2321
  /* @__PURE__ */ jsx(
2320
2322
  Table,
2321
2323
  {
@@ -2327,16 +2329,14 @@ const TablesView = ({
2327
2329
  tableId,
2328
2330
  ),
2329
2331
  ),
2330
- separator,
2331
- );
2332
+ });
2332
2333
 
2333
2334
  const ValueView = ({valueId, store, debugIds}) =>
2334
- wrap(
2335
- EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
2336
- void 0,
2335
+ /* @__PURE__ */ jsx(Wrap, {
2337
2336
  debugIds,
2338
- valueId,
2339
- );
2337
+ id: valueId,
2338
+ children: EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
2339
+ });
2340
2340
 
2341
2341
  const ValuesView = ({
2342
2342
  store,
@@ -2345,8 +2345,9 @@ const ValuesView = ({
2345
2345
  separator,
2346
2346
  debugIds,
2347
2347
  }) =>
2348
- wrap(
2349
- arrayMap(useValueIds(store), (valueId) =>
2348
+ /* @__PURE__ */ jsx(Wrap, {
2349
+ separator,
2350
+ children: arrayMap(useValueIds(store), (valueId) =>
2350
2351
  /* @__PURE__ */ jsx(
2351
2352
  Value,
2352
2353
  {
@@ -2358,8 +2359,7 @@ const ValuesView = ({
2358
2359
  valueId,
2359
2360
  ),
2360
2361
  ),
2361
- separator,
2362
- );
2362
+ });
2363
2363
 
2364
2364
  export {
2365
2365
  BackwardCheckpointsView,