tinybase 6.5.2 → 6.6.0
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.
- package/@types/ui-react-dom/index.d.ts +153 -20
- package/@types/ui-react-dom/with-schemas/index.d.ts +72 -20
- package/@types/ui-react-inspector/index.d.ts +7 -0
- package/@types/ui-react-inspector/with-schemas/index.d.ts +26 -1925
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/omni/index.js +2003 -1156
- package/omni/with-schemas/index.js +2003 -1156
- package/package.json +4 -4
- package/readme.md +2 -2
- package/ui-react/index.js +397 -368
- package/ui-react/with-schemas/index.js +397 -368
- package/ui-react-dom/index.js +873 -436
- package/ui-react-dom/with-schemas/index.js +873 -436
- package/ui-react-inspector/index.js +1717 -544
- package/ui-react-inspector/with-schemas/index.js +1717 -544
package/ui-react/index.js
CHANGED
|
@@ -124,17 +124,6 @@ const getIndexStoreTableId = (indexes, indexId) => [
|
|
|
124
124
|
indexes?.getTableId(indexId),
|
|
125
125
|
];
|
|
126
126
|
|
|
127
|
-
var Offsets = /* @__PURE__ */ ((Offsets2) => {
|
|
128
|
-
Offsets2[(Offsets2['Store'] = 0)] = 'Store';
|
|
129
|
-
Offsets2[(Offsets2['Metrics'] = 1)] = 'Metrics';
|
|
130
|
-
Offsets2[(Offsets2['Indexes'] = 2)] = 'Indexes';
|
|
131
|
-
Offsets2[(Offsets2['Relationships'] = 3)] = 'Relationships';
|
|
132
|
-
Offsets2[(Offsets2['Queries'] = 4)] = 'Queries';
|
|
133
|
-
Offsets2[(Offsets2['Checkpoints'] = 5)] = 'Checkpoints';
|
|
134
|
-
Offsets2[(Offsets2['Persister'] = 6)] = 'Persister';
|
|
135
|
-
Offsets2[(Offsets2['Synchronizer'] = 7)] = 'Synchronizer';
|
|
136
|
-
return Offsets2;
|
|
137
|
-
})(Offsets || {});
|
|
138
127
|
const TINYBASE_CONTEXT = TINYBASE + '_uirc';
|
|
139
128
|
const Context = GLOBAL[TINYBASE_CONTEXT]
|
|
140
129
|
? /* istanbul ignore next */
|
|
@@ -165,6 +154,165 @@ const useProvideThing = (thingId, thing, offset) => {
|
|
|
165
154
|
const useThingIds = (offset) =>
|
|
166
155
|
objIds(useContext(Context)[offset * 2 + 1] ?? {});
|
|
167
156
|
|
|
157
|
+
const OFFSET_STORE = 0;
|
|
158
|
+
const OFFSET_METRICS = 1;
|
|
159
|
+
const OFFSET_INDEXES = 2;
|
|
160
|
+
const OFFSET_RELATIONSHIPS = 3;
|
|
161
|
+
const OFFSET_QUERIES = 4;
|
|
162
|
+
const OFFSET_CHECKPOINTS = 5;
|
|
163
|
+
const OFFSET_PERSISTER = 6;
|
|
164
|
+
const OFFSET_SYNCHRONIZER = 7;
|
|
165
|
+
const mergeParentThings = (
|
|
166
|
+
offset,
|
|
167
|
+
parentValue,
|
|
168
|
+
defaultThing,
|
|
169
|
+
thingsById,
|
|
170
|
+
extraThingsById,
|
|
171
|
+
) => [
|
|
172
|
+
defaultThing ?? parentValue[offset * 2],
|
|
173
|
+
{
|
|
174
|
+
...parentValue[offset * 2 + 1],
|
|
175
|
+
...thingsById,
|
|
176
|
+
...extraThingsById[offset],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
const Provider = ({
|
|
180
|
+
store,
|
|
181
|
+
storesById,
|
|
182
|
+
metrics,
|
|
183
|
+
metricsById,
|
|
184
|
+
indexes,
|
|
185
|
+
indexesById,
|
|
186
|
+
relationships,
|
|
187
|
+
relationshipsById,
|
|
188
|
+
queries,
|
|
189
|
+
queriesById,
|
|
190
|
+
checkpoints,
|
|
191
|
+
checkpointsById,
|
|
192
|
+
persister,
|
|
193
|
+
persistersById,
|
|
194
|
+
synchronizer,
|
|
195
|
+
synchronizersById,
|
|
196
|
+
children,
|
|
197
|
+
}) => {
|
|
198
|
+
const parentValue = useContext(Context);
|
|
199
|
+
const [extraThingsById, setExtraThingsById] = useState(() =>
|
|
200
|
+
arrayNew(8, () => ({})),
|
|
201
|
+
);
|
|
202
|
+
const addExtraThingById = useCallback(
|
|
203
|
+
(thingOffset, id, thing) =>
|
|
204
|
+
setExtraThingsById((extraThingsById2) =>
|
|
205
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
206
|
+
? extraThingsById2
|
|
207
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
208
|
+
...extraThingsById2[thingOffset],
|
|
209
|
+
[id]: thing,
|
|
210
|
+
}),
|
|
211
|
+
),
|
|
212
|
+
[],
|
|
213
|
+
);
|
|
214
|
+
const delExtraThingById = useCallback(
|
|
215
|
+
(thingOffset, id) =>
|
|
216
|
+
setExtraThingsById((extraThingsById2) =>
|
|
217
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
218
|
+
? extraThingsById2
|
|
219
|
+
: arrayWith(
|
|
220
|
+
extraThingsById2,
|
|
221
|
+
thingOffset,
|
|
222
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
223
|
+
),
|
|
224
|
+
),
|
|
225
|
+
[],
|
|
226
|
+
);
|
|
227
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
228
|
+
value: useMemo(
|
|
229
|
+
() => [
|
|
230
|
+
...mergeParentThings(
|
|
231
|
+
OFFSET_STORE,
|
|
232
|
+
parentValue,
|
|
233
|
+
store,
|
|
234
|
+
storesById,
|
|
235
|
+
extraThingsById,
|
|
236
|
+
),
|
|
237
|
+
...mergeParentThings(
|
|
238
|
+
OFFSET_METRICS,
|
|
239
|
+
parentValue,
|
|
240
|
+
metrics,
|
|
241
|
+
metricsById,
|
|
242
|
+
extraThingsById,
|
|
243
|
+
),
|
|
244
|
+
...mergeParentThings(
|
|
245
|
+
OFFSET_INDEXES,
|
|
246
|
+
parentValue,
|
|
247
|
+
indexes,
|
|
248
|
+
indexesById,
|
|
249
|
+
extraThingsById,
|
|
250
|
+
),
|
|
251
|
+
...mergeParentThings(
|
|
252
|
+
OFFSET_RELATIONSHIPS,
|
|
253
|
+
parentValue,
|
|
254
|
+
relationships,
|
|
255
|
+
relationshipsById,
|
|
256
|
+
extraThingsById,
|
|
257
|
+
),
|
|
258
|
+
...mergeParentThings(
|
|
259
|
+
OFFSET_QUERIES,
|
|
260
|
+
parentValue,
|
|
261
|
+
queries,
|
|
262
|
+
queriesById,
|
|
263
|
+
extraThingsById,
|
|
264
|
+
),
|
|
265
|
+
...mergeParentThings(
|
|
266
|
+
OFFSET_CHECKPOINTS,
|
|
267
|
+
parentValue,
|
|
268
|
+
checkpoints,
|
|
269
|
+
checkpointsById,
|
|
270
|
+
extraThingsById,
|
|
271
|
+
),
|
|
272
|
+
...mergeParentThings(
|
|
273
|
+
OFFSET_PERSISTER,
|
|
274
|
+
parentValue,
|
|
275
|
+
persister,
|
|
276
|
+
persistersById,
|
|
277
|
+
extraThingsById,
|
|
278
|
+
),
|
|
279
|
+
...mergeParentThings(
|
|
280
|
+
OFFSET_SYNCHRONIZER,
|
|
281
|
+
parentValue,
|
|
282
|
+
synchronizer,
|
|
283
|
+
synchronizersById,
|
|
284
|
+
extraThingsById,
|
|
285
|
+
),
|
|
286
|
+
addExtraThingById,
|
|
287
|
+
delExtraThingById,
|
|
288
|
+
],
|
|
289
|
+
[
|
|
290
|
+
extraThingsById,
|
|
291
|
+
store,
|
|
292
|
+
storesById,
|
|
293
|
+
metrics,
|
|
294
|
+
metricsById,
|
|
295
|
+
indexes,
|
|
296
|
+
indexesById,
|
|
297
|
+
relationships,
|
|
298
|
+
relationshipsById,
|
|
299
|
+
queries,
|
|
300
|
+
queriesById,
|
|
301
|
+
checkpoints,
|
|
302
|
+
checkpointsById,
|
|
303
|
+
persister,
|
|
304
|
+
persistersById,
|
|
305
|
+
synchronizer,
|
|
306
|
+
synchronizersById,
|
|
307
|
+
parentValue,
|
|
308
|
+
addExtraThingById,
|
|
309
|
+
delExtraThingById,
|
|
310
|
+
],
|
|
311
|
+
),
|
|
312
|
+
children,
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
|
|
168
316
|
const EMPTY_ARRAY = [];
|
|
169
317
|
const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
|
|
170
318
|
const IS_EQUALS = [
|
|
@@ -329,13 +477,13 @@ const useSortedRowIdsListenerImpl = (
|
|
|
329
477
|
);
|
|
330
478
|
const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
331
479
|
useMemo(create, createDeps);
|
|
332
|
-
const useStoreIds = () => useThingIds(
|
|
333
|
-
const useStore = (id) => useThing(id,
|
|
334
|
-
const useStores = () => useThings(
|
|
480
|
+
const useStoreIds = () => useThingIds(OFFSET_STORE);
|
|
481
|
+
const useStore = (id) => useThing(id, OFFSET_STORE);
|
|
482
|
+
const useStores = () => useThings(OFFSET_STORE);
|
|
335
483
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
336
|
-
useThingOrThingById(storeOrStoreId,
|
|
484
|
+
useThingOrThingById(storeOrStoreId, OFFSET_STORE);
|
|
337
485
|
const useProvideStore = (storeId, store) =>
|
|
338
|
-
useProvideThing(storeId, store,
|
|
486
|
+
useProvideThing(storeId, store, OFFSET_STORE);
|
|
339
487
|
const useCreateMergeableStore = (create, createDeps = EMPTY_ARRAY) =>
|
|
340
488
|
useMemo(create, createDeps);
|
|
341
489
|
const useHasTables = (storeOrStoreId) =>
|
|
@@ -989,12 +1137,12 @@ const useDidFinishTransactionListener = (
|
|
|
989
1137
|
);
|
|
990
1138
|
const useCreateMetrics = (store, create, createDeps) =>
|
|
991
1139
|
useCreate(store, create, createDeps);
|
|
992
|
-
const useMetricsIds = () => useThingIds(
|
|
993
|
-
const useMetrics = (id) => useThing(id,
|
|
1140
|
+
const useMetricsIds = () => useThingIds(OFFSET_METRICS);
|
|
1141
|
+
const useMetrics = (id) => useThing(id, OFFSET_METRICS);
|
|
994
1142
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
995
|
-
useThingOrThingById(metricsOrMetricsId,
|
|
1143
|
+
useThingOrThingById(metricsOrMetricsId, OFFSET_METRICS);
|
|
996
1144
|
const useProvideMetrics = (metricsId, metrics) =>
|
|
997
|
-
useProvideThing(metricsId, metrics,
|
|
1145
|
+
useProvideThing(metricsId, metrics, OFFSET_METRICS);
|
|
998
1146
|
const useMetricIds = (metricsOrMetricsId) =>
|
|
999
1147
|
useListenable(
|
|
1000
1148
|
METRIC + IDS,
|
|
@@ -1023,12 +1171,12 @@ const useMetricListener = (
|
|
|
1023
1171
|
);
|
|
1024
1172
|
const useCreateIndexes = (store, create, createDeps) =>
|
|
1025
1173
|
useCreate(store, create, createDeps);
|
|
1026
|
-
const useIndexesIds = () => useThingIds(
|
|
1027
|
-
const useIndexes = (id) => useThing(id,
|
|
1174
|
+
const useIndexesIds = () => useThingIds(OFFSET_INDEXES);
|
|
1175
|
+
const useIndexes = (id) => useThing(id, OFFSET_INDEXES);
|
|
1028
1176
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
1029
|
-
useThingOrThingById(indexesOrIndexesId,
|
|
1177
|
+
useThingOrThingById(indexesOrIndexesId, OFFSET_INDEXES);
|
|
1030
1178
|
const useProvideIndexes = (indexesId, indexes) =>
|
|
1031
|
-
useProvideThing(indexesId, indexes,
|
|
1179
|
+
useProvideThing(indexesId, indexes, OFFSET_INDEXES);
|
|
1032
1180
|
const useSliceIds = (indexId, indexesOrIndexesId) =>
|
|
1033
1181
|
useListenable(
|
|
1034
1182
|
SLICE + IDS,
|
|
@@ -1078,12 +1226,12 @@ const useSliceRowIdsListener = (
|
|
|
1078
1226
|
);
|
|
1079
1227
|
const useCreateRelationships = (store, create, createDeps) =>
|
|
1080
1228
|
useCreate(store, create, createDeps);
|
|
1081
|
-
const useRelationshipsIds = () => useThingIds(
|
|
1082
|
-
const useRelationships = (id) => useThing(id,
|
|
1229
|
+
const useRelationshipsIds = () => useThingIds(OFFSET_RELATIONSHIPS);
|
|
1230
|
+
const useRelationships = (id) => useThing(id, OFFSET_RELATIONSHIPS);
|
|
1083
1231
|
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
1084
|
-
useThingOrThingById(relationshipsOrRelationshipsId,
|
|
1232
|
+
useThingOrThingById(relationshipsOrRelationshipsId, OFFSET_RELATIONSHIPS);
|
|
1085
1233
|
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
1086
|
-
useProvideThing(relationshipsId, relationships,
|
|
1234
|
+
useProvideThing(relationshipsId, relationships, OFFSET_RELATIONSHIPS);
|
|
1087
1235
|
const useRelationshipIds = (relationshipsOrRelationshipsId) =>
|
|
1088
1236
|
useListenable(
|
|
1089
1237
|
RELATIONSHIP + IDS,
|
|
@@ -1167,12 +1315,12 @@ const useLinkedRowIdsListener = (
|
|
|
1167
1315
|
);
|
|
1168
1316
|
const useCreateQueries = (store, create, createDeps) =>
|
|
1169
1317
|
useCreate(store, create, createDeps);
|
|
1170
|
-
const useQueriesIds = () => useThingIds(
|
|
1171
|
-
const useQueries = (id) => useThing(id,
|
|
1318
|
+
const useQueriesIds = () => useThingIds(OFFSET_QUERIES);
|
|
1319
|
+
const useQueries = (id) => useThing(id, OFFSET_QUERIES);
|
|
1172
1320
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
1173
|
-
useThingOrThingById(queriesOrQueriesId,
|
|
1321
|
+
useThingOrThingById(queriesOrQueriesId, OFFSET_QUERIES);
|
|
1174
1322
|
const useProvideQueries = (queriesId, queries) =>
|
|
1175
|
-
useProvideThing(queriesId, queries,
|
|
1323
|
+
useProvideThing(queriesId, queries, OFFSET_QUERIES);
|
|
1176
1324
|
const useQueryIds = (queriesOrQueriesId) =>
|
|
1177
1325
|
useListenable(
|
|
1178
1326
|
QUERY + IDS,
|
|
@@ -1356,12 +1504,12 @@ const useResultCellListener = (
|
|
|
1356
1504
|
);
|
|
1357
1505
|
const useCreateCheckpoints = (store, create, createDeps) =>
|
|
1358
1506
|
useCreate(store, create, createDeps);
|
|
1359
|
-
const useCheckpointsIds = () => useThingIds(
|
|
1360
|
-
const useCheckpoints = (id) => useThing(id,
|
|
1507
|
+
const useCheckpointsIds = () => useThingIds(OFFSET_CHECKPOINTS);
|
|
1508
|
+
const useCheckpoints = (id) => useThing(id, OFFSET_CHECKPOINTS);
|
|
1361
1509
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
1362
|
-
useThingOrThingById(checkpointsOrCheckpointsId,
|
|
1510
|
+
useThingOrThingById(checkpointsOrCheckpointsId, OFFSET_CHECKPOINTS);
|
|
1363
1511
|
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
1364
|
-
useProvideThing(checkpointsId, checkpoints,
|
|
1512
|
+
useProvideThing(checkpointsId, checkpoints, OFFSET_CHECKPOINTS);
|
|
1365
1513
|
const useCheckpointIds = (checkpointsOrCheckpointsId) =>
|
|
1366
1514
|
useListenable(
|
|
1367
1515
|
CHECKPOINT + IDS,
|
|
@@ -1509,12 +1657,12 @@ const useCreatePersister = (
|
|
|
1509
1657
|
);
|
|
1510
1658
|
return persister;
|
|
1511
1659
|
};
|
|
1512
|
-
const usePersisterIds = () => useThingIds(
|
|
1513
|
-
const usePersister = (id) => useThing(id,
|
|
1660
|
+
const usePersisterIds = () => useThingIds(OFFSET_PERSISTER);
|
|
1661
|
+
const usePersister = (id) => useThing(id, OFFSET_PERSISTER);
|
|
1514
1662
|
const usePersisterOrPersisterById = (persisterOrPersisterId) =>
|
|
1515
|
-
useThingOrThingById(persisterOrPersisterId,
|
|
1663
|
+
useThingOrThingById(persisterOrPersisterId, OFFSET_PERSISTER);
|
|
1516
1664
|
const useProvidePersister = (persisterId, persister) =>
|
|
1517
|
-
useProvideThing(persisterId, persister,
|
|
1665
|
+
useProvideThing(persisterId, persister, OFFSET_PERSISTER);
|
|
1518
1666
|
const usePersisterStatus = (persisterOrPersisterId) =>
|
|
1519
1667
|
useListenable(
|
|
1520
1668
|
STATUS,
|
|
@@ -1564,12 +1712,12 @@ const useCreateSynchronizer = (
|
|
|
1564
1712
|
);
|
|
1565
1713
|
return synchronizer;
|
|
1566
1714
|
};
|
|
1567
|
-
const useSynchronizerIds = () => useThingIds(
|
|
1568
|
-
const useSynchronizer = (id) => useThing(id,
|
|
1715
|
+
const useSynchronizerIds = () => useThingIds(OFFSET_SYNCHRONIZER);
|
|
1716
|
+
const useSynchronizer = (id) => useThing(id, OFFSET_SYNCHRONIZER);
|
|
1569
1717
|
const useSynchronizerOrSynchronizerById = (synchronizerOrSynchronizerId) =>
|
|
1570
|
-
useThingOrThingById(synchronizerOrSynchronizerId,
|
|
1718
|
+
useThingOrThingById(synchronizerOrSynchronizerId, OFFSET_SYNCHRONIZER);
|
|
1571
1719
|
const useProvideSynchronizer = (persisterId, persister) =>
|
|
1572
|
-
useProvideThing(persisterId, persister,
|
|
1720
|
+
useProvideThing(persisterId, persister, OFFSET_SYNCHRONIZER);
|
|
1573
1721
|
const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
1574
1722
|
useListenable(
|
|
1575
1723
|
STATUS,
|
|
@@ -1590,20 +1738,105 @@ const useSynchronizerStatusListener = (
|
|
|
1590
1738
|
[],
|
|
1591
1739
|
);
|
|
1592
1740
|
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1741
|
+
const wrap = (children, separator, encloseWithId, id) => {
|
|
1742
|
+
const separated =
|
|
1743
|
+
isUndefined(separator) || !isArray(children)
|
|
1744
|
+
? children
|
|
1745
|
+
: arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
|
|
1746
|
+
return encloseWithId ? [id, ':{', separated, '}'] : separated;
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1749
|
+
const CheckpointView = ({checkpoints, checkpointId, debugIds}) =>
|
|
1750
|
+
wrap(
|
|
1751
|
+
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
|
|
1752
|
+
void 0,
|
|
1753
|
+
debugIds,
|
|
1754
|
+
checkpointId,
|
|
1755
|
+
);
|
|
1756
|
+
|
|
1757
|
+
const ResultCellView = ({queryId, rowId, cellId, queries, debugIds}) =>
|
|
1758
|
+
wrap(
|
|
1759
|
+
EMPTY_STRING +
|
|
1760
|
+
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
|
|
1761
|
+
void 0,
|
|
1762
|
+
debugIds,
|
|
1763
|
+
cellId,
|
|
1764
|
+
);
|
|
1765
|
+
|
|
1766
|
+
const ResultRowView = ({
|
|
1767
|
+
queryId,
|
|
1768
|
+
rowId,
|
|
1769
|
+
queries,
|
|
1770
|
+
resultCellComponent: ResultCell = ResultCellView,
|
|
1771
|
+
getResultCellComponentProps,
|
|
1772
|
+
separator,
|
|
1773
|
+
debugIds,
|
|
1774
|
+
}) =>
|
|
1775
|
+
wrap(
|
|
1776
|
+
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) =>
|
|
1777
|
+
/* @__PURE__ */ jsx(
|
|
1778
|
+
ResultCell,
|
|
1779
|
+
{
|
|
1780
|
+
...getProps(getResultCellComponentProps, cellId),
|
|
1781
|
+
queryId,
|
|
1782
|
+
rowId,
|
|
1783
|
+
cellId,
|
|
1784
|
+
queries,
|
|
1785
|
+
debugIds,
|
|
1786
|
+
},
|
|
1787
|
+
cellId,
|
|
1788
|
+
),
|
|
1789
|
+
),
|
|
1790
|
+
separator,
|
|
1791
|
+
debugIds,
|
|
1792
|
+
rowId,
|
|
1793
|
+
);
|
|
1794
|
+
|
|
1795
|
+
const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
1796
|
+
wrap(
|
|
1797
|
+
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
|
|
1798
|
+
void 0,
|
|
1799
|
+
debugIds,
|
|
1800
|
+
cellId,
|
|
1801
|
+
);
|
|
1802
|
+
|
|
1803
|
+
const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
|
|
1804
|
+
const defaultCellIds = useCellIds(tableId, rowId, store);
|
|
1805
|
+
return customCellIds ?? defaultCellIds;
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
const RowView = ({
|
|
1809
|
+
tableId,
|
|
1810
|
+
rowId,
|
|
1811
|
+
store,
|
|
1812
|
+
cellComponent: Cell = CellView,
|
|
1813
|
+
getCellComponentProps,
|
|
1814
|
+
customCellIds,
|
|
1815
|
+
separator,
|
|
1816
|
+
debugIds,
|
|
1817
|
+
}) =>
|
|
1818
|
+
wrap(
|
|
1819
|
+
arrayMap(
|
|
1820
|
+
useCustomOrDefaultCellIds(customCellIds, tableId, rowId, store),
|
|
1821
|
+
(cellId) =>
|
|
1822
|
+
/* @__PURE__ */ jsx(
|
|
1823
|
+
Cell,
|
|
1824
|
+
{
|
|
1825
|
+
...getProps(getCellComponentProps, cellId),
|
|
1826
|
+
tableId,
|
|
1827
|
+
rowId,
|
|
1828
|
+
cellId,
|
|
1829
|
+
store,
|
|
1830
|
+
debugIds,
|
|
1831
|
+
},
|
|
1832
|
+
cellId,
|
|
1833
|
+
),
|
|
1834
|
+
),
|
|
1835
|
+
separator,
|
|
1836
|
+
debugIds,
|
|
1837
|
+
rowId,
|
|
1838
|
+
);
|
|
1839
|
+
|
|
1607
1840
|
const tableView = (
|
|
1608
1841
|
{
|
|
1609
1842
|
tableId,
|
|
@@ -1729,263 +1962,19 @@ const getUseCheckpointView =
|
|
|
1729
1962
|
separator,
|
|
1730
1963
|
);
|
|
1731
1964
|
};
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
persister,
|
|
1746
|
-
persistersById,
|
|
1747
|
-
synchronizer,
|
|
1748
|
-
synchronizersById,
|
|
1749
|
-
children,
|
|
1750
|
-
}) => {
|
|
1751
|
-
const parentValue = useContext(Context);
|
|
1752
|
-
const [extraThingsById, setExtraThingsById] = useState(() =>
|
|
1753
|
-
arrayNew(8, () => ({})),
|
|
1754
|
-
);
|
|
1755
|
-
const addExtraThingById = useCallback(
|
|
1756
|
-
(thingOffset, id, thing) =>
|
|
1757
|
-
setExtraThingsById((extraThingsById2) =>
|
|
1758
|
-
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1759
|
-
? extraThingsById2
|
|
1760
|
-
: arrayWith(extraThingsById2, thingOffset, {
|
|
1761
|
-
...extraThingsById2[thingOffset],
|
|
1762
|
-
[id]: thing,
|
|
1763
|
-
}),
|
|
1764
|
-
),
|
|
1765
|
-
[],
|
|
1766
|
-
);
|
|
1767
|
-
const delExtraThingById = useCallback(
|
|
1768
|
-
(thingOffset, id) =>
|
|
1769
|
-
setExtraThingsById((extraThingsById2) =>
|
|
1770
|
-
!objHas(extraThingsById2[thingOffset], id)
|
|
1771
|
-
? extraThingsById2
|
|
1772
|
-
: arrayWith(
|
|
1773
|
-
extraThingsById2,
|
|
1774
|
-
thingOffset,
|
|
1775
|
-
objDel(extraThingsById2[thingOffset], id),
|
|
1776
|
-
),
|
|
1777
|
-
),
|
|
1778
|
-
[],
|
|
1779
|
-
);
|
|
1780
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
1781
|
-
value: useMemo(
|
|
1782
|
-
() => [
|
|
1783
|
-
...mergeParentThings(
|
|
1784
|
-
0 /* Store */,
|
|
1785
|
-
parentValue,
|
|
1786
|
-
store,
|
|
1787
|
-
storesById,
|
|
1788
|
-
extraThingsById,
|
|
1789
|
-
),
|
|
1790
|
-
...mergeParentThings(
|
|
1791
|
-
1 /* Metrics */,
|
|
1792
|
-
parentValue,
|
|
1793
|
-
metrics,
|
|
1794
|
-
metricsById,
|
|
1795
|
-
extraThingsById,
|
|
1796
|
-
),
|
|
1797
|
-
...mergeParentThings(
|
|
1798
|
-
2 /* Indexes */,
|
|
1799
|
-
parentValue,
|
|
1800
|
-
indexes,
|
|
1801
|
-
indexesById,
|
|
1802
|
-
extraThingsById,
|
|
1803
|
-
),
|
|
1804
|
-
...mergeParentThings(
|
|
1805
|
-
3 /* Relationships */,
|
|
1806
|
-
parentValue,
|
|
1807
|
-
relationships,
|
|
1808
|
-
relationshipsById,
|
|
1809
|
-
extraThingsById,
|
|
1810
|
-
),
|
|
1811
|
-
...mergeParentThings(
|
|
1812
|
-
4 /* Queries */,
|
|
1813
|
-
parentValue,
|
|
1814
|
-
queries,
|
|
1815
|
-
queriesById,
|
|
1816
|
-
extraThingsById,
|
|
1817
|
-
),
|
|
1818
|
-
...mergeParentThings(
|
|
1819
|
-
5 /* Checkpoints */,
|
|
1820
|
-
parentValue,
|
|
1821
|
-
checkpoints,
|
|
1822
|
-
checkpointsById,
|
|
1823
|
-
extraThingsById,
|
|
1824
|
-
),
|
|
1825
|
-
...mergeParentThings(
|
|
1826
|
-
6 /* Persister */,
|
|
1827
|
-
parentValue,
|
|
1828
|
-
persister,
|
|
1829
|
-
persistersById,
|
|
1830
|
-
extraThingsById,
|
|
1831
|
-
),
|
|
1832
|
-
...mergeParentThings(
|
|
1833
|
-
7 /* Synchronizer */,
|
|
1834
|
-
parentValue,
|
|
1835
|
-
synchronizer,
|
|
1836
|
-
synchronizersById,
|
|
1837
|
-
extraThingsById,
|
|
1838
|
-
),
|
|
1839
|
-
addExtraThingById,
|
|
1840
|
-
delExtraThingById,
|
|
1841
|
-
],
|
|
1842
|
-
[
|
|
1843
|
-
extraThingsById,
|
|
1844
|
-
store,
|
|
1845
|
-
storesById,
|
|
1846
|
-
metrics,
|
|
1847
|
-
metricsById,
|
|
1848
|
-
indexes,
|
|
1849
|
-
indexesById,
|
|
1850
|
-
relationships,
|
|
1851
|
-
relationshipsById,
|
|
1852
|
-
queries,
|
|
1853
|
-
queriesById,
|
|
1854
|
-
checkpoints,
|
|
1855
|
-
checkpointsById,
|
|
1856
|
-
persister,
|
|
1857
|
-
persistersById,
|
|
1858
|
-
synchronizer,
|
|
1859
|
-
synchronizersById,
|
|
1860
|
-
parentValue,
|
|
1861
|
-
addExtraThingById,
|
|
1862
|
-
delExtraThingById,
|
|
1863
|
-
],
|
|
1864
|
-
),
|
|
1865
|
-
children,
|
|
1866
|
-
});
|
|
1867
|
-
};
|
|
1868
|
-
const wrap = (children, separator, encloseWithId, id) => {
|
|
1869
|
-
const separated =
|
|
1870
|
-
isUndefined(separator) || !isArray(children)
|
|
1871
|
-
? children
|
|
1872
|
-
: arrayMap(children, (child, c) => (c > 0 ? [separator, child] : child));
|
|
1873
|
-
return encloseWithId ? [id, ':{', separated, '}'] : separated;
|
|
1874
|
-
};
|
|
1875
|
-
const useCustomOrDefaultCellIds = (customCellIds, tableId, rowId, store) => {
|
|
1876
|
-
const defaultCellIds = useCellIds(tableId, rowId, store);
|
|
1877
|
-
return customCellIds ?? defaultCellIds;
|
|
1878
|
-
};
|
|
1879
|
-
const CellView = ({tableId, rowId, cellId, store, debugIds}) =>
|
|
1880
|
-
wrap(
|
|
1881
|
-
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
|
|
1882
|
-
void 0,
|
|
1883
|
-
debugIds,
|
|
1884
|
-
cellId,
|
|
1885
|
-
);
|
|
1886
|
-
const RowView = ({
|
|
1887
|
-
tableId,
|
|
1888
|
-
rowId,
|
|
1889
|
-
store,
|
|
1890
|
-
cellComponent: Cell = CellView,
|
|
1891
|
-
getCellComponentProps,
|
|
1892
|
-
customCellIds,
|
|
1893
|
-
separator,
|
|
1894
|
-
debugIds,
|
|
1895
|
-
}) =>
|
|
1896
|
-
wrap(
|
|
1897
|
-
arrayMap(
|
|
1898
|
-
useCustomOrDefaultCellIds(customCellIds, tableId, rowId, store),
|
|
1899
|
-
(cellId) =>
|
|
1900
|
-
/* @__PURE__ */ jsx(
|
|
1901
|
-
Cell,
|
|
1902
|
-
{
|
|
1903
|
-
...getProps(getCellComponentProps, cellId),
|
|
1904
|
-
tableId,
|
|
1905
|
-
rowId,
|
|
1906
|
-
cellId,
|
|
1907
|
-
store,
|
|
1908
|
-
debugIds,
|
|
1909
|
-
},
|
|
1910
|
-
cellId,
|
|
1911
|
-
),
|
|
1912
|
-
),
|
|
1913
|
-
separator,
|
|
1914
|
-
debugIds,
|
|
1915
|
-
rowId,
|
|
1916
|
-
);
|
|
1917
|
-
const TableView = (props) =>
|
|
1918
|
-
tableView(props, useRowIds(props.tableId, props.store));
|
|
1919
|
-
const SortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
1920
|
-
tableView(
|
|
1921
|
-
props,
|
|
1922
|
-
useSortedRowIds(
|
|
1923
|
-
props.tableId,
|
|
1924
|
-
cellId,
|
|
1925
|
-
descending,
|
|
1926
|
-
offset,
|
|
1927
|
-
limit,
|
|
1928
|
-
props.store,
|
|
1929
|
-
),
|
|
1930
|
-
);
|
|
1931
|
-
const TablesView = ({
|
|
1932
|
-
store,
|
|
1933
|
-
tableComponent: Table = TableView,
|
|
1934
|
-
getTableComponentProps,
|
|
1935
|
-
separator,
|
|
1936
|
-
debugIds,
|
|
1937
|
-
}) =>
|
|
1938
|
-
wrap(
|
|
1939
|
-
arrayMap(useTableIds(store), (tableId) =>
|
|
1940
|
-
/* @__PURE__ */ jsx(
|
|
1941
|
-
Table,
|
|
1942
|
-
{
|
|
1943
|
-
...getProps(getTableComponentProps, tableId),
|
|
1944
|
-
tableId,
|
|
1945
|
-
store,
|
|
1946
|
-
debugIds,
|
|
1947
|
-
},
|
|
1948
|
-
tableId,
|
|
1949
|
-
),
|
|
1950
|
-
),
|
|
1951
|
-
separator,
|
|
1952
|
-
);
|
|
1953
|
-
const ValueView = ({valueId, store, debugIds}) =>
|
|
1954
|
-
wrap(
|
|
1955
|
-
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
1956
|
-
void 0,
|
|
1957
|
-
debugIds,
|
|
1958
|
-
valueId,
|
|
1959
|
-
);
|
|
1960
|
-
const ValuesView = ({
|
|
1961
|
-
store,
|
|
1962
|
-
valueComponent: Value = ValueView,
|
|
1963
|
-
getValueComponentProps,
|
|
1964
|
-
separator,
|
|
1965
|
-
debugIds,
|
|
1966
|
-
}) =>
|
|
1967
|
-
wrap(
|
|
1968
|
-
arrayMap(useValueIds(store), (valueId) =>
|
|
1969
|
-
/* @__PURE__ */ jsx(
|
|
1970
|
-
Value,
|
|
1971
|
-
{
|
|
1972
|
-
...getProps(getValueComponentProps, valueId),
|
|
1973
|
-
valueId,
|
|
1974
|
-
store,
|
|
1975
|
-
debugIds,
|
|
1976
|
-
},
|
|
1977
|
-
valueId,
|
|
1978
|
-
),
|
|
1979
|
-
),
|
|
1980
|
-
separator,
|
|
1981
|
-
);
|
|
1982
|
-
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
1983
|
-
wrap(
|
|
1984
|
-
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
1985
|
-
void 0,
|
|
1986
|
-
debugIds,
|
|
1987
|
-
metricId,
|
|
1988
|
-
);
|
|
1965
|
+
|
|
1966
|
+
const BackwardCheckpointsView = getUseCheckpointView(
|
|
1967
|
+
(checkpointIds) => checkpointIds[0],
|
|
1968
|
+
);
|
|
1969
|
+
|
|
1970
|
+
const CurrentCheckpointView = getUseCheckpointView((checkpointIds) =>
|
|
1971
|
+
isUndefined(checkpointIds[1]) ? [] : [checkpointIds[1]],
|
|
1972
|
+
);
|
|
1973
|
+
|
|
1974
|
+
const ForwardCheckpointsView = getUseCheckpointView(
|
|
1975
|
+
(checkpointIds) => checkpointIds[2],
|
|
1976
|
+
);
|
|
1977
|
+
|
|
1989
1978
|
const SliceView = ({
|
|
1990
1979
|
indexId,
|
|
1991
1980
|
sliceId,
|
|
@@ -2019,6 +2008,7 @@ const SliceView = ({
|
|
|
2019
2008
|
sliceId,
|
|
2020
2009
|
);
|
|
2021
2010
|
};
|
|
2011
|
+
|
|
2022
2012
|
const IndexView = ({
|
|
2023
2013
|
indexId,
|
|
2024
2014
|
indexes,
|
|
@@ -2045,6 +2035,21 @@ const IndexView = ({
|
|
|
2045
2035
|
debugIds,
|
|
2046
2036
|
indexId,
|
|
2047
2037
|
);
|
|
2038
|
+
|
|
2039
|
+
const LinkedRowsView = (props) =>
|
|
2040
|
+
useComponentPerRow(props, useLinkedRowIds, props.firstRowId);
|
|
2041
|
+
|
|
2042
|
+
const LocalRowsView = (props) =>
|
|
2043
|
+
useComponentPerRow(props, useLocalRowIds, props.remoteRowId);
|
|
2044
|
+
|
|
2045
|
+
const MetricView = ({metricId, metrics, debugIds}) =>
|
|
2046
|
+
wrap(
|
|
2047
|
+
useMetric(metricId, metrics) ?? EMPTY_STRING,
|
|
2048
|
+
void 0,
|
|
2049
|
+
debugIds,
|
|
2050
|
+
metricId,
|
|
2051
|
+
);
|
|
2052
|
+
|
|
2048
2053
|
const RemoteRowView = ({
|
|
2049
2054
|
relationshipId,
|
|
2050
2055
|
localRowId,
|
|
@@ -2082,76 +2087,92 @@ const RemoteRowView = ({
|
|
|
2082
2087
|
localRowId,
|
|
2083
2088
|
);
|
|
2084
2089
|
};
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2090
|
+
|
|
2091
|
+
const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
2092
|
+
resultTableView(
|
|
2093
|
+
props,
|
|
2094
|
+
useResultSortedRowIds(
|
|
2095
|
+
props.queryId,
|
|
2096
|
+
cellId,
|
|
2097
|
+
descending,
|
|
2098
|
+
offset,
|
|
2099
|
+
limit,
|
|
2100
|
+
props.queries,
|
|
2101
|
+
),
|
|
2096
2102
|
);
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
+
|
|
2104
|
+
const ResultTableView = (props) =>
|
|
2105
|
+
resultTableView(props, useResultRowIds(props.queryId, props.queries));
|
|
2106
|
+
|
|
2107
|
+
const SortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
2108
|
+
tableView(
|
|
2109
|
+
props,
|
|
2110
|
+
useSortedRowIds(
|
|
2111
|
+
props.tableId,
|
|
2112
|
+
cellId,
|
|
2113
|
+
descending,
|
|
2114
|
+
offset,
|
|
2115
|
+
limit,
|
|
2116
|
+
props.store,
|
|
2117
|
+
),
|
|
2118
|
+
);
|
|
2119
|
+
|
|
2120
|
+
const TableView = (props) =>
|
|
2121
|
+
tableView(props, useRowIds(props.tableId, props.store));
|
|
2122
|
+
|
|
2123
|
+
const TablesView = ({
|
|
2124
|
+
store,
|
|
2125
|
+
tableComponent: Table = TableView,
|
|
2126
|
+
getTableComponentProps,
|
|
2103
2127
|
separator,
|
|
2104
2128
|
debugIds,
|
|
2105
2129
|
}) =>
|
|
2106
2130
|
wrap(
|
|
2107
|
-
arrayMap(
|
|
2131
|
+
arrayMap(useTableIds(store), (tableId) =>
|
|
2108
2132
|
/* @__PURE__ */ jsx(
|
|
2109
|
-
|
|
2133
|
+
Table,
|
|
2110
2134
|
{
|
|
2111
|
-
...getProps(
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
cellId,
|
|
2115
|
-
queries,
|
|
2135
|
+
...getProps(getTableComponentProps, tableId),
|
|
2136
|
+
tableId,
|
|
2137
|
+
store,
|
|
2116
2138
|
debugIds,
|
|
2117
2139
|
},
|
|
2118
|
-
|
|
2140
|
+
tableId,
|
|
2119
2141
|
),
|
|
2120
2142
|
),
|
|
2121
2143
|
separator,
|
|
2122
|
-
debugIds,
|
|
2123
|
-
rowId,
|
|
2124
|
-
);
|
|
2125
|
-
const ResultTableView = (props) =>
|
|
2126
|
-
resultTableView(props, useResultRowIds(props.queryId, props.queries));
|
|
2127
|
-
const ResultSortedTableView = ({cellId, descending, offset, limit, ...props}) =>
|
|
2128
|
-
resultTableView(
|
|
2129
|
-
props,
|
|
2130
|
-
useResultSortedRowIds(
|
|
2131
|
-
props.queryId,
|
|
2132
|
-
cellId,
|
|
2133
|
-
descending,
|
|
2134
|
-
offset,
|
|
2135
|
-
limit,
|
|
2136
|
-
props.queries,
|
|
2137
|
-
),
|
|
2138
2144
|
);
|
|
2139
|
-
|
|
2145
|
+
|
|
2146
|
+
const ValueView = ({valueId, store, debugIds}) =>
|
|
2140
2147
|
wrap(
|
|
2141
|
-
|
|
2148
|
+
EMPTY_STRING + (useValue(valueId, store) ?? EMPTY_STRING),
|
|
2142
2149
|
void 0,
|
|
2143
2150
|
debugIds,
|
|
2144
|
-
|
|
2151
|
+
valueId,
|
|
2152
|
+
);
|
|
2153
|
+
|
|
2154
|
+
const ValuesView = ({
|
|
2155
|
+
store,
|
|
2156
|
+
valueComponent: Value = ValueView,
|
|
2157
|
+
getValueComponentProps,
|
|
2158
|
+
separator,
|
|
2159
|
+
debugIds,
|
|
2160
|
+
}) =>
|
|
2161
|
+
wrap(
|
|
2162
|
+
arrayMap(useValueIds(store), (valueId) =>
|
|
2163
|
+
/* @__PURE__ */ jsx(
|
|
2164
|
+
Value,
|
|
2165
|
+
{
|
|
2166
|
+
...getProps(getValueComponentProps, valueId),
|
|
2167
|
+
valueId,
|
|
2168
|
+
store,
|
|
2169
|
+
debugIds,
|
|
2170
|
+
},
|
|
2171
|
+
valueId,
|
|
2172
|
+
),
|
|
2173
|
+
),
|
|
2174
|
+
separator,
|
|
2145
2175
|
);
|
|
2146
|
-
const BackwardCheckpointsView = getUseCheckpointView(
|
|
2147
|
-
(checkpointIds) => checkpointIds[0],
|
|
2148
|
-
);
|
|
2149
|
-
const CurrentCheckpointView = getUseCheckpointView((checkpointIds) =>
|
|
2150
|
-
isUndefined(checkpointIds[1]) ? [] : [checkpointIds[1]],
|
|
2151
|
-
);
|
|
2152
|
-
const ForwardCheckpointsView = getUseCheckpointView(
|
|
2153
|
-
(checkpointIds) => checkpointIds[2],
|
|
2154
|
-
);
|
|
2155
2176
|
|
|
2156
2177
|
export {
|
|
2157
2178
|
BackwardCheckpointsView,
|
|
@@ -2163,6 +2184,14 @@ export {
|
|
|
2163
2184
|
LinkedRowsView,
|
|
2164
2185
|
LocalRowsView,
|
|
2165
2186
|
MetricView,
|
|
2187
|
+
OFFSET_CHECKPOINTS,
|
|
2188
|
+
OFFSET_INDEXES,
|
|
2189
|
+
OFFSET_METRICS,
|
|
2190
|
+
OFFSET_PERSISTER,
|
|
2191
|
+
OFFSET_QUERIES,
|
|
2192
|
+
OFFSET_RELATIONSHIPS,
|
|
2193
|
+
OFFSET_STORE,
|
|
2194
|
+
OFFSET_SYNCHRONIZER,
|
|
2166
2195
|
Provider,
|
|
2167
2196
|
RemoteRowView,
|
|
2168
2197
|
ResultCellView,
|