tinybase 5.2.2 → 5.3.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.
- package/@types/ui-react/index.d.cts +159 -0
- package/@types/ui-react/index.d.ts +159 -0
- package/@types/ui-react/with-schemas/index.d.cts +92 -0
- package/@types/ui-react/with-schemas/index.d.ts +92 -0
- package/cjs/es6/min/ui-react/index.cjs +1 -1
- package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/ui-react/index.cjs +89 -29
- package/cjs/es6/ui-react/with-schemas/index.cjs +89 -29
- package/cjs/min/ui-react/index.cjs +1 -1
- package/cjs/min/ui-react/index.cjs.gz +0 -0
- package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/ui-react/index.cjs +63 -30
- package/cjs/ui-react/with-schemas/index.cjs +63 -30
- package/es6/min/ui-react/index.js +1 -1
- package/es6/min/ui-react/index.js.gz +0 -0
- package/es6/min/ui-react/with-schemas/index.js +1 -1
- package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/es6/ui-react/index.js +89 -29
- package/es6/ui-react/with-schemas/index.js +89 -29
- 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/package.json +1 -1
- package/readme.md +14 -14
- package/releases.md +24 -24
- package/ui-react/index.js +63 -30
- package/ui-react/with-schemas/index.js +63 -30
- package/umd/es6/min/ui-react/index.js +1 -1
- package/umd/es6/min/ui-react/index.js.gz +0 -0
- package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/es6/ui-react/index.js +90 -33
- package/umd/es6/ui-react/with-schemas/index.js +90 -33
- package/umd/min/ui-react/index.js +1 -1
- package/umd/min/ui-react/index.js.gz +0 -0
- package/umd/min/ui-react/with-schemas/index.js +1 -1
- package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/ui-react/index.js +65 -30
- package/umd/ui-react/with-schemas/index.js +65 -30
package/umd/ui-react/index.js
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
const arrayMap = (array, cb) => array.map(cb);
|
|
52
52
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
53
53
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
54
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
54
55
|
|
|
55
56
|
const object = Object;
|
|
56
57
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -116,33 +117,46 @@
|
|
|
116
117
|
? thing
|
|
117
118
|
: thingOrThingId;
|
|
118
119
|
};
|
|
120
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
121
|
+
const {12: addExtraThingById, 13: delExtraThingById} =
|
|
122
|
+
useContext$1(Context);
|
|
123
|
+
useEffect$1(() => {
|
|
124
|
+
addExtraThingById?.(offset, thingId, thing);
|
|
125
|
+
return () => delExtraThingById?.(offset, thingId);
|
|
126
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
127
|
+
};
|
|
119
128
|
const useThingIds = (offset) => objIds(useContext$1(Context)[offset] ?? {});
|
|
120
129
|
const useStore = (id) => useThing(id, 0);
|
|
121
130
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
122
131
|
useThingOrThingById(storeOrStoreId, 0);
|
|
123
|
-
const useProvideStore = (storeId, store) =>
|
|
124
|
-
|
|
125
|
-
useEffect$1(() => {
|
|
126
|
-
addExtraStore?.(storeId, store);
|
|
127
|
-
return () => delExtraStore?.(storeId);
|
|
128
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
129
|
-
};
|
|
132
|
+
const useProvideStore = (storeId, store) =>
|
|
133
|
+
useProvideThing(storeId, store, 0);
|
|
130
134
|
const useMetrics = (id) => useThing(id, 2);
|
|
131
135
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
132
136
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
137
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
138
|
+
useProvideThing(metricsId, metrics, 1);
|
|
133
139
|
const useIndexes = (id) => useThing(id, 4);
|
|
134
140
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
135
141
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
142
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
143
|
+
useProvideThing(indexesId, indexes, 2);
|
|
136
144
|
const useRelationships = (id) => useThing(id, 6);
|
|
137
145
|
const useRelationshipsOrRelationshipsById = (
|
|
138
146
|
relationshipsOrRelationshipsId,
|
|
139
147
|
) => useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
148
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
149
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
140
150
|
const useQueries = (id) => useThing(id, 8);
|
|
141
151
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
142
152
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
153
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
154
|
+
useProvideThing(queriesId, queries, 4);
|
|
143
155
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
144
156
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
145
157
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
158
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
159
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
146
160
|
|
|
147
161
|
const lower = (str) => str.toLowerCase();
|
|
148
162
|
lower(LISTENER);
|
|
@@ -1630,21 +1644,37 @@
|
|
|
1630
1644
|
children,
|
|
1631
1645
|
}) => {
|
|
1632
1646
|
const parentValue = useContext(Context);
|
|
1633
|
-
const [
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1647
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1648
|
+
{},
|
|
1649
|
+
{},
|
|
1650
|
+
{},
|
|
1651
|
+
{},
|
|
1652
|
+
{},
|
|
1653
|
+
{},
|
|
1654
|
+
]);
|
|
1655
|
+
const addExtraThingById = useCallback(
|
|
1656
|
+
(thingOffset, id, thing) =>
|
|
1657
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1658
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1659
|
+
? extraThingsById2
|
|
1660
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
1661
|
+
...extraThingsById2[thingOffset],
|
|
1662
|
+
[id]: thing,
|
|
1663
|
+
}),
|
|
1640
1664
|
),
|
|
1641
1665
|
[],
|
|
1642
1666
|
);
|
|
1643
|
-
const
|
|
1644
|
-
(id) =>
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1667
|
+
const delExtraThingById = useCallback(
|
|
1668
|
+
(thingOffset, id) =>
|
|
1669
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1670
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1671
|
+
? extraThingsById2
|
|
1672
|
+
: arrayWith(
|
|
1673
|
+
extraThingsById2,
|
|
1674
|
+
thingOffset,
|
|
1675
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1676
|
+
),
|
|
1677
|
+
),
|
|
1648
1678
|
[],
|
|
1649
1679
|
);
|
|
1650
1680
|
return /* @__PURE__ */ createElement(
|
|
@@ -1653,24 +1683,24 @@
|
|
|
1653
1683
|
value: useMemo(
|
|
1654
1684
|
() => [
|
|
1655
1685
|
store ?? parentValue[0],
|
|
1656
|
-
{...parentValue[1], ...storesById, ...
|
|
1686
|
+
{...parentValue[1], ...storesById, ...extraThingsById[0]},
|
|
1657
1687
|
metrics ?? parentValue[2],
|
|
1658
|
-
{...parentValue[3], ...metricsById},
|
|
1688
|
+
{...parentValue[3], ...metricsById, ...extraThingsById[1]},
|
|
1659
1689
|
indexes ?? parentValue[4],
|
|
1660
|
-
{...parentValue[5], ...indexesById},
|
|
1690
|
+
{...parentValue[5], ...indexesById, ...extraThingsById[2]},
|
|
1661
1691
|
relationships ?? parentValue[6],
|
|
1662
|
-
{...parentValue[7], ...relationshipsById},
|
|
1692
|
+
{...parentValue[7], ...relationshipsById, ...extraThingsById[3]},
|
|
1663
1693
|
queries ?? parentValue[8],
|
|
1664
|
-
{...parentValue[9], ...queriesById},
|
|
1694
|
+
{...parentValue[9], ...queriesById, ...extraThingsById[4]},
|
|
1665
1695
|
checkpoints ?? parentValue[10],
|
|
1666
|
-
{...parentValue[11], ...checkpointsById},
|
|
1667
|
-
|
|
1668
|
-
|
|
1696
|
+
{...parentValue[11], ...checkpointsById, ...extraThingsById[5]},
|
|
1697
|
+
addExtraThingById,
|
|
1698
|
+
delExtraThingById,
|
|
1669
1699
|
],
|
|
1670
1700
|
[
|
|
1671
1701
|
store,
|
|
1672
1702
|
storesById,
|
|
1673
|
-
|
|
1703
|
+
extraThingsById,
|
|
1674
1704
|
metrics,
|
|
1675
1705
|
metricsById,
|
|
1676
1706
|
indexes,
|
|
@@ -1682,8 +1712,8 @@
|
|
|
1682
1712
|
checkpoints,
|
|
1683
1713
|
checkpointsById,
|
|
1684
1714
|
parentValue,
|
|
1685
|
-
|
|
1686
|
-
|
|
1715
|
+
addExtraThingById,
|
|
1716
|
+
delExtraThingById,
|
|
1687
1717
|
],
|
|
1688
1718
|
),
|
|
1689
1719
|
},
|
|
@@ -2046,6 +2076,11 @@
|
|
|
2046
2076
|
exports.useMetrics = useMetrics;
|
|
2047
2077
|
exports.useMetricsIds = useMetricsIds;
|
|
2048
2078
|
exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
|
|
2079
|
+
exports.useProvideCheckpoints = useProvideCheckpoints;
|
|
2080
|
+
exports.useProvideIndexes = useProvideIndexes;
|
|
2081
|
+
exports.useProvideMetrics = useProvideMetrics;
|
|
2082
|
+
exports.useProvideQueries = useProvideQueries;
|
|
2083
|
+
exports.useProvideRelationships = useProvideRelationships;
|
|
2049
2084
|
exports.useProvideStore = useProvideStore;
|
|
2050
2085
|
exports.useQueries = useQueries;
|
|
2051
2086
|
exports.useQueriesIds = useQueriesIds;
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
const arrayMap = (array, cb) => array.map(cb);
|
|
52
52
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
53
53
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
54
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
54
55
|
|
|
55
56
|
const object = Object;
|
|
56
57
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -116,33 +117,46 @@
|
|
|
116
117
|
? thing
|
|
117
118
|
: thingOrThingId;
|
|
118
119
|
};
|
|
120
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
121
|
+
const {12: addExtraThingById, 13: delExtraThingById} =
|
|
122
|
+
useContext$1(Context);
|
|
123
|
+
useEffect$1(() => {
|
|
124
|
+
addExtraThingById?.(offset, thingId, thing);
|
|
125
|
+
return () => delExtraThingById?.(offset, thingId);
|
|
126
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
127
|
+
};
|
|
119
128
|
const useThingIds = (offset) => objIds(useContext$1(Context)[offset] ?? {});
|
|
120
129
|
const useStore = (id) => useThing(id, 0);
|
|
121
130
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
122
131
|
useThingOrThingById(storeOrStoreId, 0);
|
|
123
|
-
const useProvideStore = (storeId, store) =>
|
|
124
|
-
|
|
125
|
-
useEffect$1(() => {
|
|
126
|
-
addExtraStore?.(storeId, store);
|
|
127
|
-
return () => delExtraStore?.(storeId);
|
|
128
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
129
|
-
};
|
|
132
|
+
const useProvideStore = (storeId, store) =>
|
|
133
|
+
useProvideThing(storeId, store, 0);
|
|
130
134
|
const useMetrics = (id) => useThing(id, 2);
|
|
131
135
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
132
136
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
137
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
138
|
+
useProvideThing(metricsId, metrics, 1);
|
|
133
139
|
const useIndexes = (id) => useThing(id, 4);
|
|
134
140
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
135
141
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
142
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
143
|
+
useProvideThing(indexesId, indexes, 2);
|
|
136
144
|
const useRelationships = (id) => useThing(id, 6);
|
|
137
145
|
const useRelationshipsOrRelationshipsById = (
|
|
138
146
|
relationshipsOrRelationshipsId,
|
|
139
147
|
) => useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
148
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
149
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
140
150
|
const useQueries = (id) => useThing(id, 8);
|
|
141
151
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
142
152
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
153
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
154
|
+
useProvideThing(queriesId, queries, 4);
|
|
143
155
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
144
156
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
145
157
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
158
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
159
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
146
160
|
|
|
147
161
|
const lower = (str) => str.toLowerCase();
|
|
148
162
|
lower(LISTENER);
|
|
@@ -1630,21 +1644,37 @@
|
|
|
1630
1644
|
children,
|
|
1631
1645
|
}) => {
|
|
1632
1646
|
const parentValue = useContext(Context);
|
|
1633
|
-
const [
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1647
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1648
|
+
{},
|
|
1649
|
+
{},
|
|
1650
|
+
{},
|
|
1651
|
+
{},
|
|
1652
|
+
{},
|
|
1653
|
+
{},
|
|
1654
|
+
]);
|
|
1655
|
+
const addExtraThingById = useCallback(
|
|
1656
|
+
(thingOffset, id, thing) =>
|
|
1657
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1658
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1659
|
+
? extraThingsById2
|
|
1660
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
1661
|
+
...extraThingsById2[thingOffset],
|
|
1662
|
+
[id]: thing,
|
|
1663
|
+
}),
|
|
1640
1664
|
),
|
|
1641
1665
|
[],
|
|
1642
1666
|
);
|
|
1643
|
-
const
|
|
1644
|
-
(id) =>
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1667
|
+
const delExtraThingById = useCallback(
|
|
1668
|
+
(thingOffset, id) =>
|
|
1669
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1670
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1671
|
+
? extraThingsById2
|
|
1672
|
+
: arrayWith(
|
|
1673
|
+
extraThingsById2,
|
|
1674
|
+
thingOffset,
|
|
1675
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1676
|
+
),
|
|
1677
|
+
),
|
|
1648
1678
|
[],
|
|
1649
1679
|
);
|
|
1650
1680
|
return /* @__PURE__ */ createElement(
|
|
@@ -1653,24 +1683,24 @@
|
|
|
1653
1683
|
value: useMemo(
|
|
1654
1684
|
() => [
|
|
1655
1685
|
store ?? parentValue[0],
|
|
1656
|
-
{...parentValue[1], ...storesById, ...
|
|
1686
|
+
{...parentValue[1], ...storesById, ...extraThingsById[0]},
|
|
1657
1687
|
metrics ?? parentValue[2],
|
|
1658
|
-
{...parentValue[3], ...metricsById},
|
|
1688
|
+
{...parentValue[3], ...metricsById, ...extraThingsById[1]},
|
|
1659
1689
|
indexes ?? parentValue[4],
|
|
1660
|
-
{...parentValue[5], ...indexesById},
|
|
1690
|
+
{...parentValue[5], ...indexesById, ...extraThingsById[2]},
|
|
1661
1691
|
relationships ?? parentValue[6],
|
|
1662
|
-
{...parentValue[7], ...relationshipsById},
|
|
1692
|
+
{...parentValue[7], ...relationshipsById, ...extraThingsById[3]},
|
|
1663
1693
|
queries ?? parentValue[8],
|
|
1664
|
-
{...parentValue[9], ...queriesById},
|
|
1694
|
+
{...parentValue[9], ...queriesById, ...extraThingsById[4]},
|
|
1665
1695
|
checkpoints ?? parentValue[10],
|
|
1666
|
-
{...parentValue[11], ...checkpointsById},
|
|
1667
|
-
|
|
1668
|
-
|
|
1696
|
+
{...parentValue[11], ...checkpointsById, ...extraThingsById[5]},
|
|
1697
|
+
addExtraThingById,
|
|
1698
|
+
delExtraThingById,
|
|
1669
1699
|
],
|
|
1670
1700
|
[
|
|
1671
1701
|
store,
|
|
1672
1702
|
storesById,
|
|
1673
|
-
|
|
1703
|
+
extraThingsById,
|
|
1674
1704
|
metrics,
|
|
1675
1705
|
metricsById,
|
|
1676
1706
|
indexes,
|
|
@@ -1682,8 +1712,8 @@
|
|
|
1682
1712
|
checkpoints,
|
|
1683
1713
|
checkpointsById,
|
|
1684
1714
|
parentValue,
|
|
1685
|
-
|
|
1686
|
-
|
|
1715
|
+
addExtraThingById,
|
|
1716
|
+
delExtraThingById,
|
|
1687
1717
|
],
|
|
1688
1718
|
),
|
|
1689
1719
|
},
|
|
@@ -2046,6 +2076,11 @@
|
|
|
2046
2076
|
exports.useMetrics = useMetrics;
|
|
2047
2077
|
exports.useMetricsIds = useMetricsIds;
|
|
2048
2078
|
exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
|
|
2079
|
+
exports.useProvideCheckpoints = useProvideCheckpoints;
|
|
2080
|
+
exports.useProvideIndexes = useProvideIndexes;
|
|
2081
|
+
exports.useProvideMetrics = useProvideMetrics;
|
|
2082
|
+
exports.useProvideQueries = useProvideQueries;
|
|
2083
|
+
exports.useProvideRelationships = useProvideRelationships;
|
|
2049
2084
|
exports.useProvideStore = useProvideStore;
|
|
2050
2085
|
exports.useQueries = useQueries;
|
|
2051
2086
|
exports.useQueriesIds = useQueriesIds;
|