tinybase 5.3.0-beta.0 → 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/index.d.cts +0 -2
- package/@types/index.d.ts +0 -2
- package/@types/persisters/persister-partykit-client/index.d.cts +2 -2
- package/@types/persisters/persister-partykit-client/index.d.ts +2 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +2 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +2 -2
- 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/@types/with-schemas/index.d.cts +0 -2
- package/@types/with-schemas/index.d.ts +0 -2
- 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 +99 -30
- package/cjs/es6/ui-react/with-schemas/index.cjs +99 -30
- 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 +73 -31
- package/cjs/ui-react/with-schemas/index.cjs +73 -31
- 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 +99 -30
- package/es6/ui-react/with-schemas/index.js +99 -30
- 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 +2 -2
- package/readme.md +14 -14
- package/releases.md +24 -24
- package/ui-react/index.js +73 -31
- package/ui-react/with-schemas/index.js +73 -31
- 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 +102 -34
- package/umd/es6/ui-react/with-schemas/index.js +102 -34
- 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 +77 -31
- package/umd/ui-react/with-schemas/index.js +77 -31
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
const getTypeOf = (thing) => typeof thing;
|
|
13
|
+
const TINYBASE = 'tinybase';
|
|
13
14
|
const EMPTY_STRING = '';
|
|
14
15
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
15
16
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
const VALUES = VALUE + 's';
|
|
34
35
|
const VALUE_IDS = VALUE + IDS;
|
|
35
36
|
|
|
37
|
+
const GLOBAL = globalThis;
|
|
36
38
|
const isUndefined = (thing) => thing == void 0;
|
|
37
39
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
38
40
|
isUndefined(value)
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
const arrayMap = (array, cb) => array.map(cb);
|
|
54
56
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
55
57
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
58
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
56
59
|
|
|
57
60
|
const object = Object;
|
|
58
61
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
);
|
|
71
74
|
const objIds = object.keys;
|
|
72
75
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
76
|
+
const objHas = (obj, id) => id in obj;
|
|
73
77
|
const objDel = (obj, id) => {
|
|
74
78
|
delete obj[id];
|
|
75
79
|
return obj;
|
|
@@ -88,13 +92,21 @@
|
|
|
88
92
|
)
|
|
89
93
|
);
|
|
90
94
|
};
|
|
95
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
96
|
+
if (!objHas(obj, id)) {
|
|
97
|
+
obj[id] = getDefaultValue();
|
|
98
|
+
}
|
|
99
|
+
return obj[id];
|
|
100
|
+
};
|
|
91
101
|
|
|
92
102
|
const {
|
|
93
103
|
createContext,
|
|
94
104
|
useContext: useContext$1,
|
|
95
105
|
useEffect: useEffect$1,
|
|
96
106
|
} = React;
|
|
97
|
-
const Context =
|
|
107
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () =>
|
|
108
|
+
createContext([]),
|
|
109
|
+
);
|
|
98
110
|
const useThing = (id, offset) => {
|
|
99
111
|
var _a;
|
|
100
112
|
const contextValue = useContext$1(Context);
|
|
@@ -110,6 +122,17 @@
|
|
|
110
122
|
? thing
|
|
111
123
|
: thingOrThingId;
|
|
112
124
|
};
|
|
125
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
126
|
+
const {12: addExtraThingById, 13: delExtraThingById} =
|
|
127
|
+
useContext$1(Context);
|
|
128
|
+
useEffect$1(() => {
|
|
129
|
+
addExtraThingById == null
|
|
130
|
+
? void 0
|
|
131
|
+
: addExtraThingById(offset, thingId, thing);
|
|
132
|
+
return () =>
|
|
133
|
+
delExtraThingById == null ? void 0 : delExtraThingById(offset, thingId);
|
|
134
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
135
|
+
};
|
|
113
136
|
const useThingIds = (offset) => {
|
|
114
137
|
var _a;
|
|
115
138
|
return objIds((_a = useContext$1(Context)[offset]) != null ? _a : {});
|
|
@@ -117,29 +140,34 @@
|
|
|
117
140
|
const useStore = (id) => useThing(id, 0);
|
|
118
141
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
119
142
|
useThingOrThingById(storeOrStoreId, 0);
|
|
120
|
-
const useProvideStore = (storeId, store) =>
|
|
121
|
-
|
|
122
|
-
useEffect$1(() => {
|
|
123
|
-
addExtraStore == null ? void 0 : addExtraStore(storeId, store);
|
|
124
|
-
return () => (delExtraStore == null ? void 0 : delExtraStore(storeId));
|
|
125
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
126
|
-
};
|
|
143
|
+
const useProvideStore = (storeId, store) =>
|
|
144
|
+
useProvideThing(storeId, store, 0);
|
|
127
145
|
const useMetrics = (id) => useThing(id, 2);
|
|
128
146
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
129
147
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
148
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
149
|
+
useProvideThing(metricsId, metrics, 1);
|
|
130
150
|
const useIndexes = (id) => useThing(id, 4);
|
|
131
151
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
132
152
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
153
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
154
|
+
useProvideThing(indexesId, indexes, 2);
|
|
133
155
|
const useRelationships = (id) => useThing(id, 6);
|
|
134
156
|
const useRelationshipsOrRelationshipsById = (
|
|
135
157
|
relationshipsOrRelationshipsId,
|
|
136
158
|
) => useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
159
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
160
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
137
161
|
const useQueries = (id) => useThing(id, 8);
|
|
138
162
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
139
163
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
164
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
165
|
+
useProvideThing(queriesId, queries, 4);
|
|
140
166
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
141
167
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
142
168
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
169
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
170
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
143
171
|
|
|
144
172
|
const lower = (str) => str.toLowerCase();
|
|
145
173
|
lower(LISTENER);
|
|
@@ -1742,22 +1770,42 @@
|
|
|
1742
1770
|
children,
|
|
1743
1771
|
}) => {
|
|
1744
1772
|
const parentValue = useContext(Context);
|
|
1745
|
-
const [
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1773
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1774
|
+
{},
|
|
1775
|
+
{},
|
|
1776
|
+
{},
|
|
1777
|
+
{},
|
|
1778
|
+
{},
|
|
1779
|
+
{},
|
|
1780
|
+
]);
|
|
1781
|
+
const addExtraThingById = useCallback(
|
|
1782
|
+
(thingOffset, id, thing) =>
|
|
1783
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1784
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1785
|
+
? extraThingsById2
|
|
1786
|
+
: arrayWith(
|
|
1787
|
+
extraThingsById2,
|
|
1788
|
+
thingOffset,
|
|
1789
|
+
__spreadProps(
|
|
1790
|
+
__spreadValues({}, extraThingsById2[thingOffset]),
|
|
1791
|
+
{
|
|
1792
|
+
[id]: thing,
|
|
1793
|
+
},
|
|
1794
|
+
),
|
|
1795
|
+
),
|
|
1754
1796
|
),
|
|
1755
1797
|
[],
|
|
1756
1798
|
);
|
|
1757
|
-
const
|
|
1758
|
-
(id) =>
|
|
1759
|
-
|
|
1760
|
-
|
|
1799
|
+
const delExtraThingById = useCallback(
|
|
1800
|
+
(thingOffset, id) =>
|
|
1801
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1802
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1803
|
+
? extraThingsById2
|
|
1804
|
+
: arrayWith(
|
|
1805
|
+
extraThingsById2,
|
|
1806
|
+
thingOffset,
|
|
1807
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1808
|
+
),
|
|
1761
1809
|
),
|
|
1762
1810
|
[],
|
|
1763
1811
|
);
|
|
@@ -1769,31 +1817,46 @@
|
|
|
1769
1817
|
store != null ? store : parentValue[0],
|
|
1770
1818
|
__spreadValues(
|
|
1771
1819
|
__spreadValues(__spreadValues({}, parentValue[1]), storesById),
|
|
1772
|
-
|
|
1820
|
+
extraThingsById[0],
|
|
1773
1821
|
),
|
|
1774
1822
|
metrics != null ? metrics : parentValue[2],
|
|
1775
|
-
__spreadValues(
|
|
1823
|
+
__spreadValues(
|
|
1824
|
+
__spreadValues(__spreadValues({}, parentValue[3]), metricsById),
|
|
1825
|
+
extraThingsById[1],
|
|
1826
|
+
),
|
|
1776
1827
|
indexes != null ? indexes : parentValue[4],
|
|
1777
|
-
__spreadValues(
|
|
1828
|
+
__spreadValues(
|
|
1829
|
+
__spreadValues(__spreadValues({}, parentValue[5]), indexesById),
|
|
1830
|
+
extraThingsById[2],
|
|
1831
|
+
),
|
|
1778
1832
|
relationships != null ? relationships : parentValue[6],
|
|
1779
1833
|
__spreadValues(
|
|
1780
|
-
__spreadValues(
|
|
1781
|
-
|
|
1834
|
+
__spreadValues(
|
|
1835
|
+
__spreadValues({}, parentValue[7]),
|
|
1836
|
+
relationshipsById,
|
|
1837
|
+
),
|
|
1838
|
+
extraThingsById[3],
|
|
1782
1839
|
),
|
|
1783
1840
|
queries != null ? queries : parentValue[8],
|
|
1784
|
-
__spreadValues(
|
|
1841
|
+
__spreadValues(
|
|
1842
|
+
__spreadValues(__spreadValues({}, parentValue[9]), queriesById),
|
|
1843
|
+
extraThingsById[4],
|
|
1844
|
+
),
|
|
1785
1845
|
checkpoints != null ? checkpoints : parentValue[10],
|
|
1786
1846
|
__spreadValues(
|
|
1787
|
-
__spreadValues(
|
|
1788
|
-
|
|
1847
|
+
__spreadValues(
|
|
1848
|
+
__spreadValues({}, parentValue[11]),
|
|
1849
|
+
checkpointsById,
|
|
1850
|
+
),
|
|
1851
|
+
extraThingsById[5],
|
|
1789
1852
|
),
|
|
1790
|
-
|
|
1791
|
-
|
|
1853
|
+
addExtraThingById,
|
|
1854
|
+
delExtraThingById,
|
|
1792
1855
|
],
|
|
1793
1856
|
[
|
|
1794
1857
|
store,
|
|
1795
1858
|
storesById,
|
|
1796
|
-
|
|
1859
|
+
extraThingsById,
|
|
1797
1860
|
metrics,
|
|
1798
1861
|
metricsById,
|
|
1799
1862
|
indexes,
|
|
@@ -1805,8 +1868,8 @@
|
|
|
1805
1868
|
checkpoints,
|
|
1806
1869
|
checkpointsById,
|
|
1807
1870
|
parentValue,
|
|
1808
|
-
|
|
1809
|
-
|
|
1871
|
+
addExtraThingById,
|
|
1872
|
+
delExtraThingById,
|
|
1810
1873
|
],
|
|
1811
1874
|
),
|
|
1812
1875
|
},
|
|
@@ -2224,6 +2287,11 @@
|
|
|
2224
2287
|
exports.useMetrics = useMetrics;
|
|
2225
2288
|
exports.useMetricsIds = useMetricsIds;
|
|
2226
2289
|
exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
|
|
2290
|
+
exports.useProvideCheckpoints = useProvideCheckpoints;
|
|
2291
|
+
exports.useProvideIndexes = useProvideIndexes;
|
|
2292
|
+
exports.useProvideMetrics = useProvideMetrics;
|
|
2293
|
+
exports.useProvideQueries = useProvideQueries;
|
|
2294
|
+
exports.useProvideRelationships = useProvideRelationships;
|
|
2227
2295
|
exports.useProvideStore = useProvideStore;
|
|
2228
2296
|
exports.useQueries = useQueries;
|
|
2229
2297
|
exports.useQueriesIds = useQueriesIds;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
const getTypeOf = (thing) => typeof thing;
|
|
13
|
+
const TINYBASE = 'tinybase';
|
|
13
14
|
const EMPTY_STRING = '';
|
|
14
15
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
15
16
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
const VALUES = VALUE + 's';
|
|
34
35
|
const VALUE_IDS = VALUE + IDS;
|
|
35
36
|
|
|
37
|
+
const GLOBAL = globalThis;
|
|
36
38
|
const isUndefined = (thing) => thing == void 0;
|
|
37
39
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
38
40
|
isUndefined(value)
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
const arrayMap = (array, cb) => array.map(cb);
|
|
54
56
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
55
57
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
58
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
56
59
|
|
|
57
60
|
const object = Object;
|
|
58
61
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
);
|
|
71
74
|
const objIds = object.keys;
|
|
72
75
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
76
|
+
const objHas = (obj, id) => id in obj;
|
|
73
77
|
const objDel = (obj, id) => {
|
|
74
78
|
delete obj[id];
|
|
75
79
|
return obj;
|
|
@@ -88,13 +92,21 @@
|
|
|
88
92
|
)
|
|
89
93
|
);
|
|
90
94
|
};
|
|
95
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
96
|
+
if (!objHas(obj, id)) {
|
|
97
|
+
obj[id] = getDefaultValue();
|
|
98
|
+
}
|
|
99
|
+
return obj[id];
|
|
100
|
+
};
|
|
91
101
|
|
|
92
102
|
const {
|
|
93
103
|
createContext,
|
|
94
104
|
useContext: useContext$1,
|
|
95
105
|
useEffect: useEffect$1,
|
|
96
106
|
} = React;
|
|
97
|
-
const Context =
|
|
107
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () =>
|
|
108
|
+
createContext([]),
|
|
109
|
+
);
|
|
98
110
|
const useThing = (id, offset) => {
|
|
99
111
|
var _a;
|
|
100
112
|
const contextValue = useContext$1(Context);
|
|
@@ -110,6 +122,17 @@
|
|
|
110
122
|
? thing
|
|
111
123
|
: thingOrThingId;
|
|
112
124
|
};
|
|
125
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
126
|
+
const {12: addExtraThingById, 13: delExtraThingById} =
|
|
127
|
+
useContext$1(Context);
|
|
128
|
+
useEffect$1(() => {
|
|
129
|
+
addExtraThingById == null
|
|
130
|
+
? void 0
|
|
131
|
+
: addExtraThingById(offset, thingId, thing);
|
|
132
|
+
return () =>
|
|
133
|
+
delExtraThingById == null ? void 0 : delExtraThingById(offset, thingId);
|
|
134
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
135
|
+
};
|
|
113
136
|
const useThingIds = (offset) => {
|
|
114
137
|
var _a;
|
|
115
138
|
return objIds((_a = useContext$1(Context)[offset]) != null ? _a : {});
|
|
@@ -117,29 +140,34 @@
|
|
|
117
140
|
const useStore = (id) => useThing(id, 0);
|
|
118
141
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
119
142
|
useThingOrThingById(storeOrStoreId, 0);
|
|
120
|
-
const useProvideStore = (storeId, store) =>
|
|
121
|
-
|
|
122
|
-
useEffect$1(() => {
|
|
123
|
-
addExtraStore == null ? void 0 : addExtraStore(storeId, store);
|
|
124
|
-
return () => (delExtraStore == null ? void 0 : delExtraStore(storeId));
|
|
125
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
126
|
-
};
|
|
143
|
+
const useProvideStore = (storeId, store) =>
|
|
144
|
+
useProvideThing(storeId, store, 0);
|
|
127
145
|
const useMetrics = (id) => useThing(id, 2);
|
|
128
146
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
129
147
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
148
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
149
|
+
useProvideThing(metricsId, metrics, 1);
|
|
130
150
|
const useIndexes = (id) => useThing(id, 4);
|
|
131
151
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
132
152
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
153
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
154
|
+
useProvideThing(indexesId, indexes, 2);
|
|
133
155
|
const useRelationships = (id) => useThing(id, 6);
|
|
134
156
|
const useRelationshipsOrRelationshipsById = (
|
|
135
157
|
relationshipsOrRelationshipsId,
|
|
136
158
|
) => useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
159
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
160
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
137
161
|
const useQueries = (id) => useThing(id, 8);
|
|
138
162
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
139
163
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
164
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
165
|
+
useProvideThing(queriesId, queries, 4);
|
|
140
166
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
141
167
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
142
168
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
169
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
170
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
143
171
|
|
|
144
172
|
const lower = (str) => str.toLowerCase();
|
|
145
173
|
lower(LISTENER);
|
|
@@ -1742,22 +1770,42 @@
|
|
|
1742
1770
|
children,
|
|
1743
1771
|
}) => {
|
|
1744
1772
|
const parentValue = useContext(Context);
|
|
1745
|
-
const [
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1773
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1774
|
+
{},
|
|
1775
|
+
{},
|
|
1776
|
+
{},
|
|
1777
|
+
{},
|
|
1778
|
+
{},
|
|
1779
|
+
{},
|
|
1780
|
+
]);
|
|
1781
|
+
const addExtraThingById = useCallback(
|
|
1782
|
+
(thingOffset, id, thing) =>
|
|
1783
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1784
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1785
|
+
? extraThingsById2
|
|
1786
|
+
: arrayWith(
|
|
1787
|
+
extraThingsById2,
|
|
1788
|
+
thingOffset,
|
|
1789
|
+
__spreadProps(
|
|
1790
|
+
__spreadValues({}, extraThingsById2[thingOffset]),
|
|
1791
|
+
{
|
|
1792
|
+
[id]: thing,
|
|
1793
|
+
},
|
|
1794
|
+
),
|
|
1795
|
+
),
|
|
1754
1796
|
),
|
|
1755
1797
|
[],
|
|
1756
1798
|
);
|
|
1757
|
-
const
|
|
1758
|
-
(id) =>
|
|
1759
|
-
|
|
1760
|
-
|
|
1799
|
+
const delExtraThingById = useCallback(
|
|
1800
|
+
(thingOffset, id) =>
|
|
1801
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1802
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1803
|
+
? extraThingsById2
|
|
1804
|
+
: arrayWith(
|
|
1805
|
+
extraThingsById2,
|
|
1806
|
+
thingOffset,
|
|
1807
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1808
|
+
),
|
|
1761
1809
|
),
|
|
1762
1810
|
[],
|
|
1763
1811
|
);
|
|
@@ -1769,31 +1817,46 @@
|
|
|
1769
1817
|
store != null ? store : parentValue[0],
|
|
1770
1818
|
__spreadValues(
|
|
1771
1819
|
__spreadValues(__spreadValues({}, parentValue[1]), storesById),
|
|
1772
|
-
|
|
1820
|
+
extraThingsById[0],
|
|
1773
1821
|
),
|
|
1774
1822
|
metrics != null ? metrics : parentValue[2],
|
|
1775
|
-
__spreadValues(
|
|
1823
|
+
__spreadValues(
|
|
1824
|
+
__spreadValues(__spreadValues({}, parentValue[3]), metricsById),
|
|
1825
|
+
extraThingsById[1],
|
|
1826
|
+
),
|
|
1776
1827
|
indexes != null ? indexes : parentValue[4],
|
|
1777
|
-
__spreadValues(
|
|
1828
|
+
__spreadValues(
|
|
1829
|
+
__spreadValues(__spreadValues({}, parentValue[5]), indexesById),
|
|
1830
|
+
extraThingsById[2],
|
|
1831
|
+
),
|
|
1778
1832
|
relationships != null ? relationships : parentValue[6],
|
|
1779
1833
|
__spreadValues(
|
|
1780
|
-
__spreadValues(
|
|
1781
|
-
|
|
1834
|
+
__spreadValues(
|
|
1835
|
+
__spreadValues({}, parentValue[7]),
|
|
1836
|
+
relationshipsById,
|
|
1837
|
+
),
|
|
1838
|
+
extraThingsById[3],
|
|
1782
1839
|
),
|
|
1783
1840
|
queries != null ? queries : parentValue[8],
|
|
1784
|
-
__spreadValues(
|
|
1841
|
+
__spreadValues(
|
|
1842
|
+
__spreadValues(__spreadValues({}, parentValue[9]), queriesById),
|
|
1843
|
+
extraThingsById[4],
|
|
1844
|
+
),
|
|
1785
1845
|
checkpoints != null ? checkpoints : parentValue[10],
|
|
1786
1846
|
__spreadValues(
|
|
1787
|
-
__spreadValues(
|
|
1788
|
-
|
|
1847
|
+
__spreadValues(
|
|
1848
|
+
__spreadValues({}, parentValue[11]),
|
|
1849
|
+
checkpointsById,
|
|
1850
|
+
),
|
|
1851
|
+
extraThingsById[5],
|
|
1789
1852
|
),
|
|
1790
|
-
|
|
1791
|
-
|
|
1853
|
+
addExtraThingById,
|
|
1854
|
+
delExtraThingById,
|
|
1792
1855
|
],
|
|
1793
1856
|
[
|
|
1794
1857
|
store,
|
|
1795
1858
|
storesById,
|
|
1796
|
-
|
|
1859
|
+
extraThingsById,
|
|
1797
1860
|
metrics,
|
|
1798
1861
|
metricsById,
|
|
1799
1862
|
indexes,
|
|
@@ -1805,8 +1868,8 @@
|
|
|
1805
1868
|
checkpoints,
|
|
1806
1869
|
checkpointsById,
|
|
1807
1870
|
parentValue,
|
|
1808
|
-
|
|
1809
|
-
|
|
1871
|
+
addExtraThingById,
|
|
1872
|
+
delExtraThingById,
|
|
1810
1873
|
],
|
|
1811
1874
|
),
|
|
1812
1875
|
},
|
|
@@ -2224,6 +2287,11 @@
|
|
|
2224
2287
|
exports.useMetrics = useMetrics;
|
|
2225
2288
|
exports.useMetricsIds = useMetricsIds;
|
|
2226
2289
|
exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
|
|
2290
|
+
exports.useProvideCheckpoints = useProvideCheckpoints;
|
|
2291
|
+
exports.useProvideIndexes = useProvideIndexes;
|
|
2292
|
+
exports.useProvideMetrics = useProvideMetrics;
|
|
2293
|
+
exports.useProvideQueries = useProvideQueries;
|
|
2294
|
+
exports.useProvideRelationships = useProvideRelationships;
|
|
2227
2295
|
exports.useProvideStore = useProvideStore;
|
|
2228
2296
|
exports.useQueries = useQueries;
|
|
2229
2297
|
exports.useQueriesIds = useQueriesIds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",a="Ids",i="Table",c=i+"s",I=i+a,C="Row",p=C+"Count",b=C+a,w="Sorted"+C+a,R="Cell",k=R+a,g="Value",L=g+"s",h=g+a,y=e=>null==e,m=(e,s,t)=>y(e)?t?.():s(e),S=e=>t(e)==r,T=e=>t(e)==u,V=e=>e.length,f=()=>{},x=(e,s)=>e.every(s),v=(e,s)=>V(e)===V(s)&&x(e,((e,t)=>s[t]===e)),P=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!y(e)&&m(B(e),(e=>e==q.prototype||y(B(e))),(()=>!0)),D=q.keys,F=(e,s)=>m(e,(e=>e[s])),O=(e,s)=>(delete e[s],e),Q=(e,s)=>{const t=H(e);return V(t)===V(D(s))&&x(t,(([e,t])=>M(t)?!!M(s[e])&&Q(s[e],t):s[e]===t))},{createContext:E,useContext:A,useEffect:G}=s,j=E([]),U=(e,s)=>{const t=A(j);return y(e)?t[s]:S(e)?F(t[s+1]??{},e):e},W=(e,s)=>{const t=U(e,s);return y(e)||S(e)?t:e},z=e=>D(A(j)[e]??{}),J=e=>W(e,0),K=e=>W(e,2),N=e=>W(e,4),X=e=>W(e,6),Y=e=>W(e,8),Z=e=>W(e,10),$=e=>e.toLowerCase();$(l);const _="Transaction";$(_);const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:oe,useRef:re,useState:ue,useSyncExternalStore:le}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ae=[Q,v,([e,s,t],[o,r,u])=>s===r&&v(e,o)&&v(t,u)],ie=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,o]=ue(),[r,u]=ue();return se((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},Ie=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},Ce=(e,s,t,r=ne)=>{const u=re(de[t]),l=ee((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??de[t];return(ae[t]??ie)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=ee((u=>Ie(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]);return le(n,l)},pe=(e,s,t,o=ne,r=ne,...u)=>oe((()=>Ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),be=(e,s,t,o=ne,r=f,u=ne,...l)=>{const n=J(e);return ee((e=>m(n,(o=>m(t(e,o),(t=>r(o["set"+s](...we(l,o,e),t),t)))))),[n,s,...o,...u,...Re(l)])},we=(e,s,t)=>P(e,(e=>T(e)?e(t,s):e)),Re=e=>{return s=e=>!T(e),e.filter(s);var s},ke=(e,s,t=f,o=ne,...r)=>{const u=J(e);return ee((e=>t(u?.["del"+s](...we(r,u,e)))),[u,s,...o,...Re(r)])},ge=(e,s,t)=>{const o=Z(e);return ee((()=>o?.[s](t)),[o,s,t])},Le=e=>Ce(I,J(e),1),he=(e,s)=>Ce(b,J(s),1,[e]),ye=(e,s,t,o=0,r,u)=>Ce(w,J(u),1,[e,s,t,o,r]),me=(e,s,t)=>Ce(k,J(t),1,[e,s]),Se=(e,s,t,o)=>Ce(R,J(o),3,[e,s,t]),Te=e=>Ce(h,J(e),1),Ve=(e,s)=>Ce(g,J(s),3,[e]),fe=(e,s)=>Ce("Metric",K(s),3,[e]),xe=(e,s)=>Ce("SliceIds",N(s),1,[e]),ve=(e,s,t)=>Ce("Slice"+b,N(t),1,[e,s]),Pe=(e,s,t)=>Ce("RemoteRowId",X(t),3,[e,s]),qe=(e,s,t)=>Ce("Local"+b,X(t),1,[e,s]),Be=(e,s,t)=>Ce("Linked"+b,X(t),1,[e,s]),He=(e,s)=>Ce(n+b,Y(s),1,[e]),Me=(e,s,t,o=0,r,u)=>Ce(n+w,Y(u),1,[e,s,t,o,r]),De=(e,s,t)=>Ce(n+k,Y(t),1,[e,s]),Fe=(e,s,t,o)=>Ce(n+R,Y(o),3,[e,s,t]),Oe=e=>Ce("CheckpointIds",Z(e),2),Qe=(e,s)=>Ce("Checkpoint",Z(s),3,[e]),Ee=e=>ge(e,"goBackward"),Ae=e=>ge(e,"goForward"),{PureComponent:Ge,Fragment:je,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>y(e)?{}:e(...s),Xe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ye,useContext:Ze,useMemo:$e,useState:_e}=s,es=({tableId:e,store:s,rowComponent:t=ls,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>rs(P(n,(u=>Ue(t,{...Ne(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),ss=({queryId:e,queries:s,resultRowComponent:t=cs,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>rs(P(l,(r=>Ue(t,{...Ne(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),ts=({relationshipId:e,relationships:s,rowComponent:t=ls,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,a,i]=Xe(X(s),e),c=l(e,n,d);return rs(P(c,(e=>Ue(t,{...Ne(o,e),key:e,tableId:i,rowId:e,store:a,debugIds:u}))),r,u,n)},os=e=>({checkpoints:s,checkpointComponent:t=Is,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Z(s);return rs(P(e(Oe(l)),(e=>Ue(t,{...Ne(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},rs=(e,s,t,o)=>{const r=y(s)||!Array.isArray(e)?e:P(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},us=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>rs(o+(Se(e,s,t,r)??o),void 0,u,t),ls=({tableId:e,rowId:s,store:t,cellComponent:o=us,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>rs(P(((e,s,t,o)=>{const r=me(s,t,o);return e??r})(u,e,s,t),(u=>Ue(o,{...Ne(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),ns=e=>es(e,he(e.tableId,e.store)),ds=({valueId:e,store:s,debugIds:t})=>rs(o+(Ve(e,s)??o),void 0,t,e),as=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ls,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,a]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(N(t),e),i=ve(e,s,n);return rs(P(i,(e=>Ue(o,{...Ne(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:l}))),u,l,s)},is=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>rs(o+(Fe(e,s,t,r)??o),void 0,u,t),cs=({queryId:e,rowId:s,queries:t,resultCellComponent:o=is,getResultCellComponentProps:r,separator:u,debugIds:l})=>rs(P(De(e,s,t),(u=>Ue(o,{...Ne(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),Is=({checkpoints:e,checkpointId:s,debugIds:t})=>rs(Qe(s,e)??o,void 0,t,s),Cs=os((e=>e[0])),ps=os((e=>y(e[1])?[]:[e[1]])),bs=os((e=>e[2]));e.BackwardCheckpointsView=Cs,e.CellView=us,e.CheckpointView=Is,e.CurrentCheckpointView=ps,e.ForwardCheckpointsView=bs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=as,getSliceComponentProps:o,separator:r,debugIds:u})=>rs(P(xe(e,s),(r=>Ue(t,{...Ne(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>ts(e,Be,e.firstRowId),e.LocalRowsView=e=>ts(e,qe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>rs(fe(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:c,children:I})=>{const C=Ze(j),[p,b]=_e({}),w=Ye(((e,s)=>b((t=>F(t,e)==s?t:{...t,[e]:s}))),[]),R=Ye((e=>b((s=>({...O(s,e)})))),[]);return Ue(j.Provider,{value:$e((()=>[e??C[0],{...C[1],...s,...p},t??C[2],{...C[3],...o},r??C[4],{...C[5],...u},l??C[6],{...C[7],...n},d??C[8],{...C[9],...a},i??C[10],{...C[11],...c},w,R]),[e,s,p,t,o,r,u,l,n,d,a,i,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ls,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Xe(X(t),e),a=Pe(e,s,l);return rs(y(d)||y(a)?null:Ue(o,{...Ne(r,a),key:a,tableId:d,rowId:a,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=is,e.ResultRowView=cs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ss(r,Me(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ss(e,He(e.queryId,e.queries)),e.RowView=ls,e.SliceView=as,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>es(r,ye(r.tableId,e,s,t,o,r.store)),e.TableView=ns,e.TablesView=({store:e,tableComponent:s=ns,getTableComponentProps:t,separator:o,debugIds:r})=>rs(P(Le(e),(o=>Ue(s,{...Ne(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ds,e.ValuesView=({store:e,valueComponent:s=ds,getValueComponentProps:t,separator:o,debugIds:r})=>rs(P(Te(e),(o=>Ue(s,{...Ne(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=ne,o,r=f,u=ne,l=!0)=>{const n=J(o);return ee((t=>m(n,(o=>m(s(t,o),(s=>r(o.addRow(T(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=Se,e.useCellIds=me,e.useCellIdsListener=(e,s,t,o,r,u)=>pe(k,J(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>pe(R,J(l),o,r,[e,s,t],u),e.useCheckpoint=Qe,e.useCheckpointIds=Oe,e.useCheckpointIdsListener=(e,s,t)=>pe("CheckpointIds",Z(t),e,s),e.useCheckpointListener=(e,s,t,o)=>pe("Checkpoint",Z(o),s,t,[e]),e.useCheckpoints=e=>U(e,10),e.useCheckpointsIds=()=>z(11),e.useCheckpointsOrCheckpointsById=Z,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,o,r=ne,u,l=ne)=>{const[,n]=ue(),[d,a]=ue();return se((()=>{(async()=>{const t=e?await s(e):void 0;a(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),se((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,o,r=ne)=>{const[u,l]=ue();return se((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),se((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>ke(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>ke(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>ke(s,i,t,o,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>ke(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>ke(e,L,s,t),e.useDidFinishTransactionListener=(e,s,t)=>pe("DidFinish"+_,J(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Ae,e.useGoToCallback=(e,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>Ce(R,J(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>pe(d+R,J(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>Ce(C,J(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>pe(d+C,J(u),t,o,[e,s],r),e.useHasTable=(e,s)=>Ce(i,J(s),4,[e]),e.useHasTableCell=(e,s,t)=>Ce(i+R,J(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>pe(d+i+R,J(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>pe(d+i,J(r),s,t,[e],o),e.useHasTables=e=>Ce(c,J(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>pe(d+c,J(o),e,s,[],t),e.useHasValue=(e,s)=>Ce(g,J(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>pe(d+g,J(r),s,t,[e],o),e.useHasValues=e=>Ce(L,J(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>pe(d+L,J(o),e,s,[],t),e.useIndexIds=e=>Ce("IndexIds",N(e),1),e.useIndexes=e=>U(e,4),e.useIndexesIds=()=>z(5),e.useIndexesOrIndexesById=N,e.useLinkedRowIds=Be,e.useLinkedRowIdsListener=(e,s,t,o,r)=>pe("Linked"+b,X(r),t,o,[e,s]),e.useLocalRowIds=qe,e.useLocalRowIdsListener=(e,s,t,o,r)=>pe("Local"+b,X(r),t,o,[e,s]),e.useMetric=fe,e.useMetricIds=e=>Ce("MetricIds",K(e),1),e.useMetricListener=(e,s,t,o)=>pe("Metric",K(o),s,t,[e]),e.useMetrics=e=>U(e,2),e.useMetricsIds=()=>z(3),e.useMetricsOrMetricsById=K,e.useProvideStore=(e,s)=>{const{12:t,13:o}=A(j);G((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>U(e,8),e.useQueriesIds=()=>z(9),e.useQueriesOrQueriesById=Y,e.useQueryIds=e=>Ce("QueryIds",Y(e),1),e.useRedoInformation=e=>{const s=Z(e),[,,[t]]=Oe(s);return[!y(t),Ae(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>Ce("RelationshipIds",X(e),1),e.useRelationships=e=>U(e,6),e.useRelationshipsIds=()=>z(7),e.useRelationshipsOrRelationshipsById=X,e.useRemoteRowId=Pe,e.useRemoteRowIdListener=(e,s,t,o,r)=>pe("RemoteRowId",X(r),t,o,[e,s]),e.useResultCell=Fe,e.useResultCellIds=De,e.useResultCellIdsListener=(e,s,t,o,r)=>pe(n+k,Y(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>pe(n+R,Y(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>Ce(n+C,Y(t),0,[e,s]),e.useResultRowCount=(e,s)=>Ce(n+p,Y(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>pe(n+p,Y(o),s,t,[e]),e.useResultRowIds=He,e.useResultRowIdsListener=(e,s,t,o)=>pe(n+b,Y(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>pe(n+C,Y(r),t,o,[e,s]),e.useResultSortedRowIds=Me,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>pe(n+w,Y(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>Ce(n+i,Y(s),0,[e]),e.useResultTableCellIds=(e,s)=>Ce(n+i+k,Y(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>pe(n+i+k,Y(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>pe(n+i,Y(o),s,t,[e]),e.useRow=(e,s,t)=>Ce(C,J(t),0,[e,s]),e.useRowCount=(e,s)=>Ce(p,J(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>pe(p,J(r),s,t,[e],o),e.useRowIds=he,e.useRowIdsListener=(e,s,t,o,r)=>pe(b,J(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>pe(C,J(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>be(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=f,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>be(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>be(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>be(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>be(o,i,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>be(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>be(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>be(t,L,e,s,o,r),e.useSliceIds=xe,e.useSliceIdsListener=(e,s,t,o)=>pe("SliceIds",N(o),s,t,[e]),e.useSliceRowIds=ve,e.useSliceRowIdsListener=(e,s,t,o,r)=>pe("Slice"+b,N(r),t,o,[e,s]),e.useSortedRowIds=ye,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>pe(w,J(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>pe("Start"+_,J(t),e,s),e.useStore=e=>U(e,0),e.useStoreIds=()=>z(1),e.useStoreOrStoreById=J,e.useTable=(e,s)=>Ce(i,J(s),0,[e]),e.useTableCellIds=(e,s)=>Ce(i+k,J(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>pe(i+k,J(r),s,t,[e],o),e.useTableIds=Le,e.useTableIdsListener=(e,s,t,o)=>pe(I,J(o),e,s,ne,t),e.useTableListener=(e,s,t,o,r)=>pe(i,J(r),s,t,[e],o),e.useTables=e=>Ce(c,J(e),0),e.useTablesListener=(e,s,t,o)=>pe(c,J(o),e,s,ne,t),e.useUndoInformation=e=>{const s=Z(e),[t,r]=Oe(s);return[(u=t,!(0==V(u))),Ee(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Ve,e.useValueIds=Te,e.useValueIdsListener=(e,s,t,o)=>pe(h,J(o),e,s,ne,t),e.useValueListener=(e,s,t,o,r)=>pe(g,J(r),s,t,[e],o),e.useValues=e=>Ce(L,J(e),0),e.useValuesListener=(e,s,t,o)=>pe(L,J(o),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>pe("WillFinish"+_,J(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,C="Row",p=C+"Count",b=C+i,w="Sorted"+C+i,R="Cell",k=R+i,g="Value",h=g+"s",y=g+i,L=globalThis,m=e=>null==e,S=(e,s,t)=>m(e)?t?.():s(e),T=e=>t(e)==r,V=e=>t(e)==u,f=e=>e.length,v=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>f(e)===f(s)&&P(e,((e,t)=>s[t]===e)),q=(e,s)=>e.map(s),B=(e,s,t)=>e.with(s,t),M=Object,H=e=>M.getPrototypeOf(e),D=M.entries,F=e=>!m(e)&&S(H(e),(e=>e==M.prototype||m(H(e))),(()=>!0)),O=M.keys,Q=(e,s)=>S(e,(e=>e[s])),E=(e,s)=>s in e,A=(e,s)=>{const t=D(e);return f(t)===f(O(s))&&P(t,(([e,t])=>F(t)?!!F(s[e])&&A(s[e],t):s[e]===t))},{createContext:G,useContext:j,useEffect:U}=s,W=(J=()=>G([]),E(z=L,_="tinybase_uirc")||(z[_]=J()),z[_]);var z,_,J;const K=(e,s)=>{const t=j(W);return m(e)?t[s]:T(e)?Q(t[s+1]??{},e):e},N=(e,s)=>{const t=K(e,s);return m(e)||T(e)?t:e},X=(e,s,t)=>{const{12:o,13:r}=j(W);U((()=>(o?.(t,e,s),()=>r?.(t,e))),[o,e,s,t,r])},Y=e=>O(j(W)[e]??{}),Z=e=>N(e,0),$=e=>N(e,2),ee=e=>N(e,4),se=e=>N(e,6),te=e=>N(e,8),oe=e=>N(e,10),re=e=>e.toLowerCase();re(l);const ue="Transaction";re(ue);const{useCallback:le,useEffect:ne,useMemo:de,useLayoutEffect:ie,useRef:ae,useState:ce,useSyncExternalStore:Ie}=s,Ce=[],pe=[{},[],[Ce,void 0,Ce],void 0,!1,0],be=[A,x,([e,s,t],[o,r,u])=>s===r&&x(e,o)&&x(t,u)],we=(e,s)=>e===s,Re=(e,s,t=Ce)=>{const[,o]=ce(),[r,u]=ce();return ne((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},ke=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},ge=(e,s,t,r=Ce)=>{const u=ae(pe[t]),l=le((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??pe[t];return(be[t]??we)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=le((u=>ke(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]);return Ie(n,l)},he=(e,s,t,o=Ce,r=Ce,...u)=>ie((()=>ke(s,e,...r,t,...u)),[s,e,...r,...o,...u]),ye=(e,s,t,o=Ce,r=v,u=Ce,...l)=>{const n=Z(e);return le((e=>S(n,(o=>S(t(e,o),(t=>r(o["set"+s](...Le(l,o,e),t),t)))))),[n,s,...o,...u,...me(l)])},Le=(e,s,t)=>q(e,(e=>V(e)?e(t,s):e)),me=e=>{return s=e=>!V(e),e.filter(s);var s},Se=(e,s,t=v,o=Ce,...r)=>{const u=Z(e);return le((e=>t(u?.["del"+s](...Le(r,u,e)))),[u,s,...o,...me(r)])},Te=(e,s,t)=>{const o=oe(e);return le((()=>o?.[s](t)),[o,s,t])},Ve=e=>ge(I,Z(e),1),fe=(e,s)=>ge(b,Z(s),1,[e]),ve=(e,s,t,o=0,r,u)=>ge(w,Z(u),1,[e,s,t,o,r]),Pe=(e,s,t)=>ge(k,Z(t),1,[e,s]),xe=(e,s,t,o)=>ge(R,Z(o),3,[e,s,t]),qe=e=>ge(y,Z(e),1),Be=(e,s)=>ge(g,Z(s),3,[e]),Me=(e,s)=>ge("Metric",$(s),3,[e]),He=(e,s)=>ge("SliceIds",ee(s),1,[e]),De=(e,s,t)=>ge("Slice"+b,ee(t),1,[e,s]),Fe=(e,s,t)=>ge("RemoteRowId",se(t),3,[e,s]),Oe=(e,s,t)=>ge("Local"+b,se(t),1,[e,s]),Qe=(e,s,t)=>ge("Linked"+b,se(t),1,[e,s]),Ee=(e,s)=>ge(n+b,te(s),1,[e]),Ae=(e,s,t,o=0,r,u)=>ge(n+w,te(u),1,[e,s,t,o,r]),Ge=(e,s,t)=>ge(n+k,te(t),1,[e,s]),je=(e,s,t,o)=>ge(n+R,te(o),3,[e,s,t]),Ue=e=>ge("CheckpointIds",oe(e),2),We=(e,s)=>ge("Checkpoint",oe(s),3,[e]),ze=e=>Te(e,"goBackward"),_e=e=>Te(e,"goForward"),{PureComponent:Je,Fragment:Ke,createElement:Ne,useCallback:Xe,useLayoutEffect:Ye,useRef:Ze,useState:$e}=s,es=(e,...s)=>m(e)?{}:e(...s),ss=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:ts,useContext:os,useMemo:rs,useState:us}=s,ls=({tableId:e,store:s,rowComponent:t=Is,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>as(q(n,(u=>Ne(t,{...es(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),ns=({queryId:e,queries:s,resultRowComponent:t=Rs,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>as(q(l,(r=>Ne(t,{...es(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),ds=({relationshipId:e,relationships:s,rowComponent:t=Is,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,i,a]=ss(se(s),e),c=l(e,n,d);return as(q(c,(e=>Ne(t,{...es(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,n)},is=e=>({checkpoints:s,checkpointComponent:t=ks,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=oe(s);return as(q(e(Ue(l)),(e=>Ne(t,{...es(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},as=(e,s,t,o)=>{const r=m(s)||!Array.isArray(e)?e:q(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},cs=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>as(o+(xe(e,s,t,r)??o),void 0,u,t),Is=({tableId:e,rowId:s,store:t,cellComponent:o=cs,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>as(q(((e,s,t,o)=>{const r=Pe(s,t,o);return e??r})(u,e,s,t),(u=>Ne(o,{...es(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),Cs=e=>ls(e,fe(e.tableId,e.store)),ps=({valueId:e,store:s,debugIds:t})=>as(o+(Be(e,s)??o),void 0,t,e),bs=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Is,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(ee(t),e),a=De(e,s,n);return as(q(a,(e=>Ne(o,{...es(r,e),key:e,tableId:i,rowId:e,store:d,debugIds:l}))),u,l,s)},ws=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>as(o+(je(e,s,t,r)??o),void 0,u,t),Rs=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ws,getResultCellComponentProps:r,separator:u,debugIds:l})=>as(q(Ge(e,s,t),(u=>Ne(o,{...es(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),ks=({checkpoints:e,checkpointId:s,debugIds:t})=>as(We(s,e)??o,void 0,t,s),gs=is((e=>e[0])),hs=is((e=>m(e[1])?[]:[e[1]])),ys=is((e=>e[2]));e.BackwardCheckpointsView=gs,e.CellView=cs,e.CheckpointView=ks,e.CurrentCheckpointView=hs,e.ForwardCheckpointsView=ys,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=bs,getSliceComponentProps:o,separator:r,debugIds:u})=>as(q(He(e,s),(r=>Ne(t,{...es(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>ds(e,Qe,e.firstRowId),e.LocalRowsView=e=>ds(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>as(Me(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=os(W),[p,b]=us([{},{},{},{},{},{}]),w=ts(((e,s,t)=>b((o=>Q(o[e],s)==t?o:B(o,e,{...o[e],[s]:t})))),[]),R=ts(((e,s)=>b((t=>E(t[e],s)?B(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return Ne(W.Provider,{value:rs((()=>[e??C[0],{...C[1],...s,...p[0]},t??C[2],{...C[3],...o,...p[1]},r??C[4],{...C[5],...u,...p[2]},l??C[6],{...C[7],...n,...p[3]},d??C[8],{...C[9],...i,...p[4]},a??C[10],{...C[11],...c,...p[5]},w,R]),[e,s,p,t,o,r,u,l,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Is,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=ss(se(t),e),i=Fe(e,s,l);return as(m(d)||m(i)?null:Ne(o,{...es(r,i),key:i,tableId:d,rowId:i,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=ws,e.ResultRowView=Rs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ns(r,Ae(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ns(e,Ee(e.queryId,e.queries)),e.RowView=Is,e.SliceView=bs,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ls(r,ve(r.tableId,e,s,t,o,r.store)),e.TableView=Cs,e.TablesView=({store:e,tableComponent:s=Cs,getTableComponentProps:t,separator:o,debugIds:r})=>as(q(Ve(e),(o=>Ne(s,{...es(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ps,e.ValuesView=({store:e,valueComponent:s=ps,getValueComponentProps:t,separator:o,debugIds:r})=>as(q(qe(e),(o=>Ne(s,{...es(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=Ce,o,r=v,u=Ce,l=!0)=>{const n=Z(o);return le((t=>S(n,(o=>S(s(t,o),(s=>r(o.addRow(V(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=xe,e.useCellIds=Pe,e.useCellIdsListener=(e,s,t,o,r,u)=>he(k,Z(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>he(R,Z(l),o,r,[e,s,t],u),e.useCheckpoint=We,e.useCheckpointIds=Ue,e.useCheckpointIdsListener=(e,s,t)=>he("CheckpointIds",oe(t),e,s),e.useCheckpointListener=(e,s,t,o)=>he("Checkpoint",oe(o),s,t,[e]),e.useCheckpoints=e=>K(e,10),e.useCheckpointsIds=()=>Y(11),e.useCheckpointsOrCheckpointsById=oe,e.useCreateCheckpoints=(e,s,t)=>Re(e,s,t),e.useCreateIndexes=(e,s,t)=>Re(e,s,t),e.useCreateMergeableStore=(e,s=Ce)=>de(e,s),e.useCreateMetrics=(e,s,t)=>Re(e,s,t),e.useCreatePersister=(e,s,t=Ce,o,r=Ce,u,l=Ce)=>{const[,n]=ce(),[d,i]=ce();return ne((()=>{(async()=>{const t=e?await s(e):void 0;i(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),ne((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},e.useCreateQueries=(e,s,t)=>Re(e,s,t),e.useCreateRelationships=(e,s,t)=>Re(e,s,t),e.useCreateStore=(e,s=Ce)=>de(e,s),e.useCreateSynchronizer=(e,s,t=Ce,o,r=Ce)=>{const[u,l]=ce();return ne((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),ne((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>Se(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>Se(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>Se(s,a,t,o,e),e.useDelTablesCallback=(e,s,t)=>Se(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>Se(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>Se(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>he("DidFinish"+ue,Z(t),e,s),e.useGoBackwardCallback=ze,e.useGoForwardCallback=_e,e.useGoToCallback=(e,s=Ce,t,o=v,r=Ce)=>{const u=oe(t);return le((s=>S(u,(t=>S(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>ge(R,Z(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>he(d+R,Z(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>ge(C,Z(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>he(d+C,Z(u),t,o,[e,s],r),e.useHasTable=(e,s)=>ge(a,Z(s),4,[e]),e.useHasTableCell=(e,s,t)=>ge(a+R,Z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>he(d+a+R,Z(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>he(d+a,Z(r),s,t,[e],o),e.useHasTables=e=>ge(c,Z(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>he(d+c,Z(o),e,s,[],t),e.useHasValue=(e,s)=>ge(g,Z(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>he(d+g,Z(r),s,t,[e],o),e.useHasValues=e=>ge(h,Z(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>he(d+h,Z(o),e,s,[],t),e.useIndexIds=e=>ge("IndexIds",ee(e),1),e.useIndexes=e=>K(e,4),e.useIndexesIds=()=>Y(5),e.useIndexesOrIndexesById=ee,e.useLinkedRowIds=Qe,e.useLinkedRowIdsListener=(e,s,t,o,r)=>he("Linked"+b,se(r),t,o,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,o,r)=>he("Local"+b,se(r),t,o,[e,s]),e.useMetric=Me,e.useMetricIds=e=>ge("MetricIds",$(e),1),e.useMetricListener=(e,s,t,o)=>he("Metric",$(o),s,t,[e]),e.useMetrics=e=>K(e,2),e.useMetricsIds=()=>Y(3),e.useMetricsOrMetricsById=$,e.useProvideCheckpoints=(e,s)=>X(e,s,5),e.useProvideIndexes=(e,s)=>X(e,s,2),e.useProvideMetrics=(e,s)=>X(e,s,1),e.useProvideQueries=(e,s)=>X(e,s,4),e.useProvideRelationships=(e,s)=>X(e,s,3),e.useProvideStore=(e,s)=>X(e,s,0),e.useQueries=e=>K(e,8),e.useQueriesIds=()=>Y(9),e.useQueriesOrQueriesById=te,e.useQueryIds=e=>ge("QueryIds",te(e),1),e.useRedoInformation=e=>{const s=oe(e),[,,[t]]=Ue(s);return[!m(t),_e(s),t,S(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>ge("RelationshipIds",se(e),1),e.useRelationships=e=>K(e,6),e.useRelationshipsIds=()=>Y(7),e.useRelationshipsOrRelationshipsById=se,e.useRemoteRowId=Fe,e.useRemoteRowIdListener=(e,s,t,o,r)=>he("RemoteRowId",se(r),t,o,[e,s]),e.useResultCell=je,e.useResultCellIds=Ge,e.useResultCellIdsListener=(e,s,t,o,r)=>he(n+k,te(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>he(n+R,te(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>ge(n+C,te(t),0,[e,s]),e.useResultRowCount=(e,s)=>ge(n+p,te(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>he(n+p,te(o),s,t,[e]),e.useResultRowIds=Ee,e.useResultRowIdsListener=(e,s,t,o)=>he(n+b,te(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>he(n+C,te(r),t,o,[e,s]),e.useResultSortedRowIds=Ae,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>he(n+w,te(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>ge(n+a,te(s),0,[e]),e.useResultTableCellIds=(e,s)=>ge(n+a+k,te(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>he(n+a+k,te(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>he(n+a,te(o),s,t,[e]),e.useRow=(e,s,t)=>ge(C,Z(t),0,[e,s]),e.useRowCount=(e,s)=>ge(p,Z(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>he(p,Z(r),s,t,[e],o),e.useRowIds=fe,e.useRowIdsListener=(e,s,t,o,r)=>he(b,Z(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>he(C,Z(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>ye(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=v,s=Ce,t,o=v,r=Ce)=>{const u=oe(t);return le((s=>S(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>ye(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>ye(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>ye(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>ye(o,a,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>ye(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>ye(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>ye(t,h,e,s,o,r),e.useSliceIds=He,e.useSliceIdsListener=(e,s,t,o)=>he("SliceIds",ee(o),s,t,[e]),e.useSliceRowIds=De,e.useSliceRowIdsListener=(e,s,t,o,r)=>he("Slice"+b,ee(r),t,o,[e,s]),e.useSortedRowIds=ve,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>he(w,Z(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>he("Start"+ue,Z(t),e,s),e.useStore=e=>K(e,0),e.useStoreIds=()=>Y(1),e.useStoreOrStoreById=Z,e.useTable=(e,s)=>ge(a,Z(s),0,[e]),e.useTableCellIds=(e,s)=>ge(a+k,Z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>he(a+k,Z(r),s,t,[e],o),e.useTableIds=Ve,e.useTableIdsListener=(e,s,t,o)=>he(I,Z(o),e,s,Ce,t),e.useTableListener=(e,s,t,o,r)=>he(a,Z(r),s,t,[e],o),e.useTables=e=>ge(c,Z(e),0),e.useTablesListener=(e,s,t,o)=>he(c,Z(o),e,s,Ce,t),e.useUndoInformation=e=>{const s=oe(e),[t,r]=Ue(s);return[(u=t,!(0==f(u))),ze(s),r,S(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Be,e.useValueIds=qe,e.useValueIdsListener=(e,s,t,o)=>he(y,Z(o),e,s,Ce,t),e.useValueListener=(e,s,t,o,r)=>he(g,Z(r),s,t,[e],o),e.useValues=e=>ge(h,Z(e),0),e.useValuesListener=(e,s,t,o)=>he(h,Z(o),e,s,Ce,t),e.useWillFinishTransactionListener=(e,s,t)=>he("WillFinish"+ue,Z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",a="Ids",i="Table",c=i+"s",I=i+a,C="Row",p=C+"Count",b=C+a,w="Sorted"+C+a,R="Cell",k=R+a,g="Value",L=g+"s",h=g+a,y=e=>null==e,m=(e,s,t)=>y(e)?t?.():s(e),S=e=>t(e)==r,T=e=>t(e)==u,V=e=>e.length,f=()=>{},x=(e,s)=>e.every(s),v=(e,s)=>V(e)===V(s)&&x(e,((e,t)=>s[t]===e)),P=(e,s)=>e.map(s),q=Object,B=e=>q.getPrototypeOf(e),H=q.entries,M=e=>!y(e)&&m(B(e),(e=>e==q.prototype||y(B(e))),(()=>!0)),D=q.keys,F=(e,s)=>m(e,(e=>e[s])),O=(e,s)=>(delete e[s],e),Q=(e,s)=>{const t=H(e);return V(t)===V(D(s))&&x(t,(([e,t])=>M(t)?!!M(s[e])&&Q(s[e],t):s[e]===t))},{createContext:E,useContext:A,useEffect:G}=s,j=E([]),U=(e,s)=>{const t=A(j);return y(e)?t[s]:S(e)?F(t[s+1]??{},e):e},W=(e,s)=>{const t=U(e,s);return y(e)||S(e)?t:e},z=e=>D(A(j)[e]??{}),J=e=>W(e,0),K=e=>W(e,2),N=e=>W(e,4),X=e=>W(e,6),Y=e=>W(e,8),Z=e=>W(e,10),$=e=>e.toLowerCase();$(l);const _="Transaction";$(_);const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:oe,useRef:re,useState:ue,useSyncExternalStore:le}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ae=[Q,v,([e,s,t],[o,r,u])=>s===r&&v(e,o)&&v(t,u)],ie=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,o]=ue(),[r,u]=ue();return se((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},Ie=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},Ce=(e,s,t,r=ne)=>{const u=re(de[t]),l=ee((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??de[t];return(ae[t]??ie)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=ee((u=>Ie(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]);return le(n,l)},pe=(e,s,t,o=ne,r=ne,...u)=>oe((()=>Ie(s,e,...r,t,...u)),[s,e,...r,...o,...u]),be=(e,s,t,o=ne,r=f,u=ne,...l)=>{const n=J(e);return ee((e=>m(n,(o=>m(t(e,o),(t=>r(o["set"+s](...we(l,o,e),t),t)))))),[n,s,...o,...u,...Re(l)])},we=(e,s,t)=>P(e,(e=>T(e)?e(t,s):e)),Re=e=>{return s=e=>!T(e),e.filter(s);var s},ke=(e,s,t=f,o=ne,...r)=>{const u=J(e);return ee((e=>t(u?.["del"+s](...we(r,u,e)))),[u,s,...o,...Re(r)])},ge=(e,s,t)=>{const o=Z(e);return ee((()=>o?.[s](t)),[o,s,t])},Le=e=>Ce(I,J(e),1),he=(e,s)=>Ce(b,J(s),1,[e]),ye=(e,s,t,o=0,r,u)=>Ce(w,J(u),1,[e,s,t,o,r]),me=(e,s,t)=>Ce(k,J(t),1,[e,s]),Se=(e,s,t,o)=>Ce(R,J(o),3,[e,s,t]),Te=e=>Ce(h,J(e),1),Ve=(e,s)=>Ce(g,J(s),3,[e]),fe=(e,s)=>Ce("Metric",K(s),3,[e]),xe=(e,s)=>Ce("SliceIds",N(s),1,[e]),ve=(e,s,t)=>Ce("Slice"+b,N(t),1,[e,s]),Pe=(e,s,t)=>Ce("RemoteRowId",X(t),3,[e,s]),qe=(e,s,t)=>Ce("Local"+b,X(t),1,[e,s]),Be=(e,s,t)=>Ce("Linked"+b,X(t),1,[e,s]),He=(e,s)=>Ce(n+b,Y(s),1,[e]),Me=(e,s,t,o=0,r,u)=>Ce(n+w,Y(u),1,[e,s,t,o,r]),De=(e,s,t)=>Ce(n+k,Y(t),1,[e,s]),Fe=(e,s,t,o)=>Ce(n+R,Y(o),3,[e,s,t]),Oe=e=>Ce("CheckpointIds",Z(e),2),Qe=(e,s)=>Ce("Checkpoint",Z(s),3,[e]),Ee=e=>ge(e,"goBackward"),Ae=e=>ge(e,"goForward"),{PureComponent:Ge,Fragment:je,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>y(e)?{}:e(...s),Xe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Ye,useContext:Ze,useMemo:$e,useState:_e}=s,es=({tableId:e,store:s,rowComponent:t=ls,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>rs(P(n,(u=>Ue(t,{...Ne(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),ss=({queryId:e,queries:s,resultRowComponent:t=cs,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>rs(P(l,(r=>Ue(t,{...Ne(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),ts=({relationshipId:e,relationships:s,rowComponent:t=ls,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,a,i]=Xe(X(s),e),c=l(e,n,d);return rs(P(c,(e=>Ue(t,{...Ne(o,e),key:e,tableId:i,rowId:e,store:a,debugIds:u}))),r,u,n)},os=e=>({checkpoints:s,checkpointComponent:t=Is,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=Z(s);return rs(P(e(Oe(l)),(e=>Ue(t,{...Ne(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},rs=(e,s,t,o)=>{const r=y(s)||!Array.isArray(e)?e:P(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},us=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>rs(o+(Se(e,s,t,r)??o),void 0,u,t),ls=({tableId:e,rowId:s,store:t,cellComponent:o=us,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>rs(P(((e,s,t,o)=>{const r=me(s,t,o);return e??r})(u,e,s,t),(u=>Ue(o,{...Ne(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),ns=e=>es(e,he(e.tableId,e.store)),ds=({valueId:e,store:s,debugIds:t})=>rs(o+(Ve(e,s)??o),void 0,t,e),as=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ls,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,a]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(N(t),e),i=ve(e,s,n);return rs(P(i,(e=>Ue(o,{...Ne(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:l}))),u,l,s)},is=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>rs(o+(Fe(e,s,t,r)??o),void 0,u,t),cs=({queryId:e,rowId:s,queries:t,resultCellComponent:o=is,getResultCellComponentProps:r,separator:u,debugIds:l})=>rs(P(De(e,s,t),(u=>Ue(o,{...Ne(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),Is=({checkpoints:e,checkpointId:s,debugIds:t})=>rs(Qe(s,e)??o,void 0,t,s),Cs=os((e=>e[0])),ps=os((e=>y(e[1])?[]:[e[1]])),bs=os((e=>e[2]));e.BackwardCheckpointsView=Cs,e.CellView=us,e.CheckpointView=Is,e.CurrentCheckpointView=ps,e.ForwardCheckpointsView=bs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=as,getSliceComponentProps:o,separator:r,debugIds:u})=>rs(P(xe(e,s),(r=>Ue(t,{...Ne(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>ts(e,Be,e.firstRowId),e.LocalRowsView=e=>ts(e,qe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>rs(fe(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:a,checkpoints:i,checkpointsById:c,children:I})=>{const C=Ze(j),[p,b]=_e({}),w=Ye(((e,s)=>b((t=>F(t,e)==s?t:{...t,[e]:s}))),[]),R=Ye((e=>b((s=>({...O(s,e)})))),[]);return Ue(j.Provider,{value:$e((()=>[e??C[0],{...C[1],...s,...p},t??C[2],{...C[3],...o},r??C[4],{...C[5],...u},l??C[6],{...C[7],...n},d??C[8],{...C[9],...a},i??C[10],{...C[11],...c},w,R]),[e,s,p,t,o,r,u,l,n,d,a,i,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ls,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=Xe(X(t),e),a=Pe(e,s,l);return rs(y(d)||y(a)?null:Ue(o,{...Ne(r,a),key:a,tableId:d,rowId:a,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=is,e.ResultRowView=cs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ss(r,Me(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ss(e,He(e.queryId,e.queries)),e.RowView=ls,e.SliceView=as,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>es(r,ye(r.tableId,e,s,t,o,r.store)),e.TableView=ns,e.TablesView=({store:e,tableComponent:s=ns,getTableComponentProps:t,separator:o,debugIds:r})=>rs(P(Le(e),(o=>Ue(s,{...Ne(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ds,e.ValuesView=({store:e,valueComponent:s=ds,getValueComponentProps:t,separator:o,debugIds:r})=>rs(P(Te(e),(o=>Ue(s,{...Ne(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=ne,o,r=f,u=ne,l=!0)=>{const n=J(o);return ee((t=>m(n,(o=>m(s(t,o),(s=>r(o.addRow(T(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=Se,e.useCellIds=me,e.useCellIdsListener=(e,s,t,o,r,u)=>pe(k,J(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>pe(R,J(l),o,r,[e,s,t],u),e.useCheckpoint=Qe,e.useCheckpointIds=Oe,e.useCheckpointIdsListener=(e,s,t)=>pe("CheckpointIds",Z(t),e,s),e.useCheckpointListener=(e,s,t,o)=>pe("Checkpoint",Z(o),s,t,[e]),e.useCheckpoints=e=>U(e,10),e.useCheckpointsIds=()=>z(11),e.useCheckpointsOrCheckpointsById=Z,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,o,r=ne,u,l=ne)=>{const[,n]=ue(),[d,a]=ue();return se((()=>{(async()=>{const t=e?await s(e):void 0;a(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),se((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,o,r=ne)=>{const[u,l]=ue();return se((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),se((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>ke(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>ke(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>ke(s,i,t,o,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>ke(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>ke(e,L,s,t),e.useDidFinishTransactionListener=(e,s,t)=>pe("DidFinish"+_,J(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Ae,e.useGoToCallback=(e,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>Ce(R,J(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>pe(d+R,J(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>Ce(C,J(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>pe(d+C,J(u),t,o,[e,s],r),e.useHasTable=(e,s)=>Ce(i,J(s),4,[e]),e.useHasTableCell=(e,s,t)=>Ce(i+R,J(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>pe(d+i+R,J(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>pe(d+i,J(r),s,t,[e],o),e.useHasTables=e=>Ce(c,J(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>pe(d+c,J(o),e,s,[],t),e.useHasValue=(e,s)=>Ce(g,J(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>pe(d+g,J(r),s,t,[e],o),e.useHasValues=e=>Ce(L,J(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>pe(d+L,J(o),e,s,[],t),e.useIndexIds=e=>Ce("IndexIds",N(e),1),e.useIndexes=e=>U(e,4),e.useIndexesIds=()=>z(5),e.useIndexesOrIndexesById=N,e.useLinkedRowIds=Be,e.useLinkedRowIdsListener=(e,s,t,o,r)=>pe("Linked"+b,X(r),t,o,[e,s]),e.useLocalRowIds=qe,e.useLocalRowIdsListener=(e,s,t,o,r)=>pe("Local"+b,X(r),t,o,[e,s]),e.useMetric=fe,e.useMetricIds=e=>Ce("MetricIds",K(e),1),e.useMetricListener=(e,s,t,o)=>pe("Metric",K(o),s,t,[e]),e.useMetrics=e=>U(e,2),e.useMetricsIds=()=>z(3),e.useMetricsOrMetricsById=K,e.useProvideStore=(e,s)=>{const{12:t,13:o}=A(j);G((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>U(e,8),e.useQueriesIds=()=>z(9),e.useQueriesOrQueriesById=Y,e.useQueryIds=e=>Ce("QueryIds",Y(e),1),e.useRedoInformation=e=>{const s=Z(e),[,,[t]]=Oe(s);return[!y(t),Ae(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>Ce("RelationshipIds",X(e),1),e.useRelationships=e=>U(e,6),e.useRelationshipsIds=()=>z(7),e.useRelationshipsOrRelationshipsById=X,e.useRemoteRowId=Pe,e.useRemoteRowIdListener=(e,s,t,o,r)=>pe("RemoteRowId",X(r),t,o,[e,s]),e.useResultCell=Fe,e.useResultCellIds=De,e.useResultCellIdsListener=(e,s,t,o,r)=>pe(n+k,Y(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>pe(n+R,Y(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>Ce(n+C,Y(t),0,[e,s]),e.useResultRowCount=(e,s)=>Ce(n+p,Y(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>pe(n+p,Y(o),s,t,[e]),e.useResultRowIds=He,e.useResultRowIdsListener=(e,s,t,o)=>pe(n+b,Y(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>pe(n+C,Y(r),t,o,[e,s]),e.useResultSortedRowIds=Me,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>pe(n+w,Y(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>Ce(n+i,Y(s),0,[e]),e.useResultTableCellIds=(e,s)=>Ce(n+i+k,Y(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>pe(n+i+k,Y(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>pe(n+i,Y(o),s,t,[e]),e.useRow=(e,s,t)=>Ce(C,J(t),0,[e,s]),e.useRowCount=(e,s)=>Ce(p,J(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>pe(p,J(r),s,t,[e],o),e.useRowIds=he,e.useRowIdsListener=(e,s,t,o,r)=>pe(b,J(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>pe(C,J(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>be(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=f,s=ne,t,o=f,r=ne)=>{const u=Z(t);return ee((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>be(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>be(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>be(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>be(o,i,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>be(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>be(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>be(t,L,e,s,o,r),e.useSliceIds=xe,e.useSliceIdsListener=(e,s,t,o)=>pe("SliceIds",N(o),s,t,[e]),e.useSliceRowIds=ve,e.useSliceRowIdsListener=(e,s,t,o,r)=>pe("Slice"+b,N(r),t,o,[e,s]),e.useSortedRowIds=ye,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>pe(w,J(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>pe("Start"+_,J(t),e,s),e.useStore=e=>U(e,0),e.useStoreIds=()=>z(1),e.useStoreOrStoreById=J,e.useTable=(e,s)=>Ce(i,J(s),0,[e]),e.useTableCellIds=(e,s)=>Ce(i+k,J(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>pe(i+k,J(r),s,t,[e],o),e.useTableIds=Le,e.useTableIdsListener=(e,s,t,o)=>pe(I,J(o),e,s,ne,t),e.useTableListener=(e,s,t,o,r)=>pe(i,J(r),s,t,[e],o),e.useTables=e=>Ce(c,J(e),0),e.useTablesListener=(e,s,t,o)=>pe(c,J(o),e,s,ne,t),e.useUndoInformation=e=>{const s=Z(e),[t,r]=Oe(s);return[(u=t,!(0==V(u))),Ee(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Ve,e.useValueIds=Te,e.useValueIdsListener=(e,s,t,o)=>pe(h,J(o),e,s,ne,t),e.useValueListener=(e,s,t,o,r)=>pe(g,J(r),s,t,[e],o),e.useValues=e=>Ce(L,J(e),0),e.useValuesListener=(e,s,t,o)=>pe(L,J(o),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>pe("WillFinish"+_,J(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u=t(t),l="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,C="Row",p=C+"Count",b=C+i,w="Sorted"+C+i,R="Cell",k=R+i,g="Value",h=g+"s",y=g+i,L=globalThis,m=e=>null==e,S=(e,s,t)=>m(e)?t?.():s(e),T=e=>t(e)==r,V=e=>t(e)==u,f=e=>e.length,v=()=>{},P=(e,s)=>e.every(s),x=(e,s)=>f(e)===f(s)&&P(e,((e,t)=>s[t]===e)),q=(e,s)=>e.map(s),B=(e,s,t)=>e.with(s,t),M=Object,H=e=>M.getPrototypeOf(e),D=M.entries,F=e=>!m(e)&&S(H(e),(e=>e==M.prototype||m(H(e))),(()=>!0)),O=M.keys,Q=(e,s)=>S(e,(e=>e[s])),E=(e,s)=>s in e,A=(e,s)=>{const t=D(e);return f(t)===f(O(s))&&P(t,(([e,t])=>F(t)?!!F(s[e])&&A(s[e],t):s[e]===t))},{createContext:G,useContext:j,useEffect:U}=s,W=(J=()=>G([]),E(z=L,_="tinybase_uirc")||(z[_]=J()),z[_]);var z,_,J;const K=(e,s)=>{const t=j(W);return m(e)?t[s]:T(e)?Q(t[s+1]??{},e):e},N=(e,s)=>{const t=K(e,s);return m(e)||T(e)?t:e},X=(e,s,t)=>{const{12:o,13:r}=j(W);U((()=>(o?.(t,e,s),()=>r?.(t,e))),[o,e,s,t,r])},Y=e=>O(j(W)[e]??{}),Z=e=>N(e,0),$=e=>N(e,2),ee=e=>N(e,4),se=e=>N(e,6),te=e=>N(e,8),oe=e=>N(e,10),re=e=>e.toLowerCase();re(l);const ue="Transaction";re(ue);const{useCallback:le,useEffect:ne,useMemo:de,useLayoutEffect:ie,useRef:ae,useState:ce,useSyncExternalStore:Ie}=s,Ce=[],pe=[{},[],[Ce,void 0,Ce],void 0,!1,0],be=[A,x,([e,s,t],[o,r,u])=>s===r&&x(e,o)&&x(t,u)],we=(e,s)=>e===s,Re=(e,s,t=Ce)=>{const[,o]=ce(),[r,u]=ce();return ne((()=>{const t=e?s(e):void 0;return u(t),o([]),t?.destroy}),[e,...t]),r},ke=(e,s,...t)=>{const o=e?.["add"+s+l]?.(...t);return()=>e?.delListener(o)},ge=(e,s,t,r=Ce)=>{const u=ae(pe[t]),l=le((()=>{const o=s?.[(4==t?"has":"get")+e]?.(...r)??pe[t];return(be[t]??we)(o,u.current)?u.current:u.current=o}),[s,t,e,...r]),n=le((u=>ke(s,(4==t?d:o)+e,...r,u)),[s,t,e,...r]);return Ie(n,l)},he=(e,s,t,o=Ce,r=Ce,...u)=>ie((()=>ke(s,e,...r,t,...u)),[s,e,...r,...o,...u]),ye=(e,s,t,o=Ce,r=v,u=Ce,...l)=>{const n=Z(e);return le((e=>S(n,(o=>S(t(e,o),(t=>r(o["set"+s](...Le(l,o,e),t),t)))))),[n,s,...o,...u,...me(l)])},Le=(e,s,t)=>q(e,(e=>V(e)?e(t,s):e)),me=e=>{return s=e=>!V(e),e.filter(s);var s},Se=(e,s,t=v,o=Ce,...r)=>{const u=Z(e);return le((e=>t(u?.["del"+s](...Le(r,u,e)))),[u,s,...o,...me(r)])},Te=(e,s,t)=>{const o=oe(e);return le((()=>o?.[s](t)),[o,s,t])},Ve=e=>ge(I,Z(e),1),fe=(e,s)=>ge(b,Z(s),1,[e]),ve=(e,s,t,o=0,r,u)=>ge(w,Z(u),1,[e,s,t,o,r]),Pe=(e,s,t)=>ge(k,Z(t),1,[e,s]),xe=(e,s,t,o)=>ge(R,Z(o),3,[e,s,t]),qe=e=>ge(y,Z(e),1),Be=(e,s)=>ge(g,Z(s),3,[e]),Me=(e,s)=>ge("Metric",$(s),3,[e]),He=(e,s)=>ge("SliceIds",ee(s),1,[e]),De=(e,s,t)=>ge("Slice"+b,ee(t),1,[e,s]),Fe=(e,s,t)=>ge("RemoteRowId",se(t),3,[e,s]),Oe=(e,s,t)=>ge("Local"+b,se(t),1,[e,s]),Qe=(e,s,t)=>ge("Linked"+b,se(t),1,[e,s]),Ee=(e,s)=>ge(n+b,te(s),1,[e]),Ae=(e,s,t,o=0,r,u)=>ge(n+w,te(u),1,[e,s,t,o,r]),Ge=(e,s,t)=>ge(n+k,te(t),1,[e,s]),je=(e,s,t,o)=>ge(n+R,te(o),3,[e,s,t]),Ue=e=>ge("CheckpointIds",oe(e),2),We=(e,s)=>ge("Checkpoint",oe(s),3,[e]),ze=e=>Te(e,"goBackward"),_e=e=>Te(e,"goForward"),{PureComponent:Je,Fragment:Ke,createElement:Ne,useCallback:Xe,useLayoutEffect:Ye,useRef:Ze,useState:$e}=s,es=(e,...s)=>m(e)?{}:e(...s),ss=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:ts,useContext:os,useMemo:rs,useState:us}=s,ls=({tableId:e,store:s,rowComponent:t=Is,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},n)=>as(q(n,(u=>Ne(t,{...es(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),ns=({queryId:e,queries:s,resultRowComponent:t=Rs,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>as(q(l,(r=>Ne(t,{...es(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),ds=({relationshipId:e,relationships:s,rowComponent:t=Is,getRowComponentProps:o,separator:r,debugIds:u},l,n)=>{const[d,i,a]=ss(se(s),e),c=l(e,n,d);return as(q(c,(e=>Ne(t,{...es(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,n)},is=e=>({checkpoints:s,checkpointComponent:t=ks,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=oe(s);return as(q(e(Ue(l)),(e=>Ne(t,{...es(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},as=(e,s,t,o)=>{const r=m(s)||!Array.isArray(e)?e:q(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},cs=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>as(o+(xe(e,s,t,r)??o),void 0,u,t),Is=({tableId:e,rowId:s,store:t,cellComponent:o=cs,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:n})=>as(q(((e,s,t,o)=>{const r=Pe(s,t,o);return e??r})(u,e,s,t),(u=>Ne(o,{...es(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:n}))),l,n,s),Cs=e=>ls(e,fe(e.tableId,e.store)),ps=({valueId:e,store:s,debugIds:t})=>as(o+(Be(e,s)??o),void 0,t,e),bs=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Is,getRowComponentProps:r,separator:u,debugIds:l})=>{const[n,d,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(ee(t),e),a=De(e,s,n);return as(q(a,(e=>Ne(o,{...es(r,e),key:e,tableId:i,rowId:e,store:d,debugIds:l}))),u,l,s)},ws=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>as(o+(je(e,s,t,r)??o),void 0,u,t),Rs=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ws,getResultCellComponentProps:r,separator:u,debugIds:l})=>as(q(Ge(e,s,t),(u=>Ne(o,{...es(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),ks=({checkpoints:e,checkpointId:s,debugIds:t})=>as(We(s,e)??o,void 0,t,s),gs=is((e=>e[0])),hs=is((e=>m(e[1])?[]:[e[1]])),ys=is((e=>e[2]));e.BackwardCheckpointsView=gs,e.CellView=cs,e.CheckpointView=ks,e.CurrentCheckpointView=hs,e.ForwardCheckpointsView=ys,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=bs,getSliceComponentProps:o,separator:r,debugIds:u})=>as(q(He(e,s),(r=>Ne(t,{...es(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>ds(e,Qe,e.firstRowId),e.LocalRowsView=e=>ds(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>as(Me(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=os(W),[p,b]=us([{},{},{},{},{},{}]),w=ts(((e,s,t)=>b((o=>Q(o[e],s)==t?o:B(o,e,{...o[e],[s]:t})))),[]),R=ts(((e,s)=>b((t=>E(t[e],s)?B(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return Ne(W.Provider,{value:rs((()=>[e??C[0],{...C[1],...s,...p[0]},t??C[2],{...C[3],...o,...p[1]},r??C[4],{...C[5],...u,...p[2]},l??C[6],{...C[7],...n,...p[3]},d??C[8],{...C[9],...i,...p[4]},a??C[10],{...C[11],...c,...p[5]},w,R]),[e,s,p,t,o,r,u,l,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Is,getRowComponentProps:r,debugIds:u})=>{const[l,n,,d]=ss(se(t),e),i=Fe(e,s,l);return as(m(d)||m(i)?null:Ne(o,{...es(r,i),key:i,tableId:d,rowId:i,store:n,debugIds:u}),void 0,u,s)},e.ResultCellView=ws,e.ResultRowView=Rs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ns(r,Ae(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ns(e,Ee(e.queryId,e.queries)),e.RowView=Is,e.SliceView=bs,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ls(r,ve(r.tableId,e,s,t,o,r.store)),e.TableView=Cs,e.TablesView=({store:e,tableComponent:s=Cs,getTableComponentProps:t,separator:o,debugIds:r})=>as(q(Ve(e),(o=>Ne(s,{...es(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=ps,e.ValuesView=({store:e,valueComponent:s=ps,getValueComponentProps:t,separator:o,debugIds:r})=>as(q(qe(e),(o=>Ne(s,{...es(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=Ce,o,r=v,u=Ce,l=!0)=>{const n=Z(o);return le((t=>S(n,(o=>S(s(t,o),(s=>r(o.addRow(V(e)?e(t,o):e,s,l),o,s)))))),[n,e,...t,...u,l])},e.useCell=xe,e.useCellIds=Pe,e.useCellIdsListener=(e,s,t,o,r,u)=>he(k,Z(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,l)=>he(R,Z(l),o,r,[e,s,t],u),e.useCheckpoint=We,e.useCheckpointIds=Ue,e.useCheckpointIdsListener=(e,s,t)=>he("CheckpointIds",oe(t),e,s),e.useCheckpointListener=(e,s,t,o)=>he("Checkpoint",oe(o),s,t,[e]),e.useCheckpoints=e=>K(e,10),e.useCheckpointsIds=()=>Y(11),e.useCheckpointsOrCheckpointsById=oe,e.useCreateCheckpoints=(e,s,t)=>Re(e,s,t),e.useCreateIndexes=(e,s,t)=>Re(e,s,t),e.useCreateMergeableStore=(e,s=Ce)=>de(e,s),e.useCreateMetrics=(e,s,t)=>Re(e,s,t),e.useCreatePersister=(e,s,t=Ce,o,r=Ce,u,l=Ce)=>{const[,n]=ce(),[d,i]=ce();return ne((()=>{(async()=>{const t=e?await s(e):void 0;i(t),t&&o&&(async()=>{await o(t),n([])})()})()}),[e,...t,...r]),ne((()=>()=>{d&&(d.destroy(),u?.(d))}),[d,...l]),d},e.useCreateQueries=(e,s,t)=>Re(e,s,t),e.useCreateRelationships=(e,s,t)=>Re(e,s,t),e.useCreateStore=(e,s=Ce)=>de(e,s),e.useCreateSynchronizer=(e,s,t=Ce,o,r=Ce)=>{const[u,l]=ce();return ne((()=>{(async()=>{const t=e?await s(e):void 0;l(t)})()}),[e,...t]),ne((()=>()=>{u&&(u.destroy(),o?.(u))}),[u,...r]),u},e.useDelCellCallback=(e,s,t,o,r,u,l)=>Se(r,R,u,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>Se(t,C,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>Se(s,a,t,o,e),e.useDelTablesCallback=(e,s,t)=>Se(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>Se(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>Se(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>he("DidFinish"+ue,Z(t),e,s),e.useGoBackwardCallback=ze,e.useGoForwardCallback=_e,e.useGoToCallback=(e,s=Ce,t,o=v,r=Ce)=>{const u=oe(t);return le((s=>S(u,(t=>S(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useHasCell=(e,s,t,o)=>ge(R,Z(o),4,[e,s,t]),e.useHasCellListener=(e,s,t,o,r,u,l)=>he(d+R,Z(l),o,r,[e,s,t],u),e.useHasRow=(e,s,t)=>ge(C,Z(t),4,[e,s]),e.useHasRowListener=(e,s,t,o,r,u)=>he(d+C,Z(u),t,o,[e,s],r),e.useHasTable=(e,s)=>ge(a,Z(s),4,[e]),e.useHasTableCell=(e,s,t)=>ge(a+R,Z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,o,r,u)=>he(d+a+R,Z(u),t,o,[e,s],r),e.useHasTableListener=(e,s,t,o,r)=>he(d+a,Z(r),s,t,[e],o),e.useHasTables=e=>ge(c,Z(e),4,[]),e.useHasTablesListener=(e,s,t,o)=>he(d+c,Z(o),e,s,[],t),e.useHasValue=(e,s)=>ge(g,Z(s),4,[e]),e.useHasValueListener=(e,s,t,o,r)=>he(d+g,Z(r),s,t,[e],o),e.useHasValues=e=>ge(h,Z(e),4,[]),e.useHasValuesListener=(e,s,t,o)=>he(d+h,Z(o),e,s,[],t),e.useIndexIds=e=>ge("IndexIds",ee(e),1),e.useIndexes=e=>K(e,4),e.useIndexesIds=()=>Y(5),e.useIndexesOrIndexesById=ee,e.useLinkedRowIds=Qe,e.useLinkedRowIdsListener=(e,s,t,o,r)=>he("Linked"+b,se(r),t,o,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,o,r)=>he("Local"+b,se(r),t,o,[e,s]),e.useMetric=Me,e.useMetricIds=e=>ge("MetricIds",$(e),1),e.useMetricListener=(e,s,t,o)=>he("Metric",$(o),s,t,[e]),e.useMetrics=e=>K(e,2),e.useMetricsIds=()=>Y(3),e.useMetricsOrMetricsById=$,e.useProvideCheckpoints=(e,s)=>X(e,s,5),e.useProvideIndexes=(e,s)=>X(e,s,2),e.useProvideMetrics=(e,s)=>X(e,s,1),e.useProvideQueries=(e,s)=>X(e,s,4),e.useProvideRelationships=(e,s)=>X(e,s,3),e.useProvideStore=(e,s)=>X(e,s,0),e.useQueries=e=>K(e,8),e.useQueriesIds=()=>Y(9),e.useQueriesOrQueriesById=te,e.useQueryIds=e=>ge("QueryIds",te(e),1),e.useRedoInformation=e=>{const s=oe(e),[,,[t]]=Ue(s);return[!m(t),_e(s),t,S(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>ge("RelationshipIds",se(e),1),e.useRelationships=e=>K(e,6),e.useRelationshipsIds=()=>Y(7),e.useRelationshipsOrRelationshipsById=se,e.useRemoteRowId=Fe,e.useRemoteRowIdListener=(e,s,t,o,r)=>he("RemoteRowId",se(r),t,o,[e,s]),e.useResultCell=je,e.useResultCellIds=Ge,e.useResultCellIdsListener=(e,s,t,o,r)=>he(n+k,te(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>he(n+R,te(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>ge(n+C,te(t),0,[e,s]),e.useResultRowCount=(e,s)=>ge(n+p,te(s),5,[e]),e.useResultRowCountListener=(e,s,t,o)=>he(n+p,te(o),s,t,[e]),e.useResultRowIds=Ee,e.useResultRowIdsListener=(e,s,t,o)=>he(n+b,te(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>he(n+C,te(r),t,o,[e,s]),e.useResultSortedRowIds=Ae,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,d)=>he(n+w,te(d),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>ge(n+a,te(s),0,[e]),e.useResultTableCellIds=(e,s)=>ge(n+a+k,te(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>he(n+a+k,te(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>he(n+a,te(o),s,t,[e]),e.useRow=(e,s,t)=>ge(C,Z(t),0,[e,s]),e.useRowCount=(e,s)=>ge(p,Z(s),5,[e]),e.useRowCountListener=(e,s,t,o,r)=>he(p,Z(r),s,t,[e],o),e.useRowIds=fe,e.useRowIdsListener=(e,s,t,o,r)=>he(b,Z(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>he(C,Z(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,l,n)=>ye(u,R,o,r,l,n,e,s,t),e.useSetCheckpointCallback=(e=v,s=Ce,t,o=v,r=Ce)=>{const u=oe(t);return le((s=>S(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>ye(r,"PartialRow",t,o,u,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>ye(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,l)=>ye(r,C,t,o,u,l,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>ye(o,a,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>ye(t,c,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>ye(o,g,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>ye(t,h,e,s,o,r),e.useSliceIds=He,e.useSliceIdsListener=(e,s,t,o)=>he("SliceIds",ee(o),s,t,[e]),e.useSliceRowIds=De,e.useSliceRowIdsListener=(e,s,t,o,r)=>he("Slice"+b,ee(r),t,o,[e,s]),e.useSortedRowIds=ve,e.useSortedRowIdsListener=(e,s,t,o,r,u,l,n,d)=>he(w,Z(d),u,l,[e,s,t,o,r],n),e.useStartTransactionListener=(e,s,t)=>he("Start"+ue,Z(t),e,s),e.useStore=e=>K(e,0),e.useStoreIds=()=>Y(1),e.useStoreOrStoreById=Z,e.useTable=(e,s)=>ge(a,Z(s),0,[e]),e.useTableCellIds=(e,s)=>ge(a+k,Z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>he(a+k,Z(r),s,t,[e],o),e.useTableIds=Ve,e.useTableIdsListener=(e,s,t,o)=>he(I,Z(o),e,s,Ce,t),e.useTableListener=(e,s,t,o,r)=>he(a,Z(r),s,t,[e],o),e.useTables=e=>ge(c,Z(e),0),e.useTablesListener=(e,s,t,o)=>he(c,Z(o),e,s,Ce,t),e.useUndoInformation=e=>{const s=oe(e),[t,r]=Ue(s);return[(u=t,!(0==f(u))),ze(s),r,S(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=Be,e.useValueIds=qe,e.useValueIdsListener=(e,s,t,o)=>he(y,Z(o),e,s,Ce,t),e.useValueListener=(e,s,t,o,r)=>he(g,Z(r),s,t,[e],o),e.useValues=e=>ge(h,Z(e),0),e.useValuesListener=(e,s,t,o)=>he(h,Z(o),e,s,Ce,t),e.useWillFinishTransactionListener=(e,s,t)=>he("WillFinish"+ue,Z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|