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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
5
|
const getTypeOf = (thing) => typeof thing;
|
|
6
|
+
const TINYBASE = 'tinybase';
|
|
6
7
|
const EMPTY_STRING = '';
|
|
7
8
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
8
9
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -26,6 +27,7 @@ const VALUE = 'Value';
|
|
|
26
27
|
const VALUES = VALUE + 's';
|
|
27
28
|
const VALUE_IDS = VALUE + IDS;
|
|
28
29
|
|
|
30
|
+
const GLOBAL = globalThis;
|
|
29
31
|
const isUndefined = (thing) => thing == void 0;
|
|
30
32
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
31
33
|
isUndefined(value) ? otherwise?.() : then(value);
|
|
@@ -42,6 +44,7 @@ const arrayIsEqual = (array1, array2) =>
|
|
|
42
44
|
const arrayMap = (array, cb) => array.map(cb);
|
|
43
45
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
44
46
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
47
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
45
48
|
|
|
46
49
|
const object = Object;
|
|
47
50
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -59,6 +62,7 @@ const isObject = (obj) =>
|
|
|
59
62
|
);
|
|
60
63
|
const objIds = object.keys;
|
|
61
64
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
65
|
+
const objHas = (obj, id) => id in obj;
|
|
62
66
|
const objDel = (obj, id) => {
|
|
63
67
|
delete obj[id];
|
|
64
68
|
return obj;
|
|
@@ -77,9 +81,15 @@ const objIsEqual = (obj1, obj2) => {
|
|
|
77
81
|
)
|
|
78
82
|
);
|
|
79
83
|
};
|
|
84
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
85
|
+
if (!objHas(obj, id)) {
|
|
86
|
+
obj[id] = getDefaultValue();
|
|
87
|
+
}
|
|
88
|
+
return obj[id];
|
|
89
|
+
};
|
|
80
90
|
|
|
81
91
|
const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
|
|
82
|
-
const Context = createContext([]);
|
|
92
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
|
|
83
93
|
const useThing = (id, offset) => {
|
|
84
94
|
const contextValue = useContext$1(Context);
|
|
85
95
|
return isUndefined(id)
|
|
@@ -94,32 +104,43 @@ const useThingOrThingById = (thingOrThingId, offset) => {
|
|
|
94
104
|
? thing
|
|
95
105
|
: thingOrThingId;
|
|
96
106
|
};
|
|
107
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
108
|
+
const {12: addExtraThingById, 13: delExtraThingById} = useContext$1(Context);
|
|
109
|
+
useEffect$1(() => {
|
|
110
|
+
addExtraThingById?.(offset, thingId, thing);
|
|
111
|
+
return () => delExtraThingById?.(offset, thingId);
|
|
112
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
113
|
+
};
|
|
97
114
|
const useThingIds = (offset) => objIds(useContext$1(Context)[offset] ?? {});
|
|
98
115
|
const useStore = (id) => useThing(id, 0);
|
|
99
116
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
100
117
|
useThingOrThingById(storeOrStoreId, 0);
|
|
101
|
-
const useProvideStore = (storeId, store) =>
|
|
102
|
-
const {12: addExtraStore, 13: delExtraStore} = useContext$1(Context);
|
|
103
|
-
useEffect$1(() => {
|
|
104
|
-
addExtraStore?.(storeId, store);
|
|
105
|
-
return () => delExtraStore?.(storeId);
|
|
106
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
107
|
-
};
|
|
118
|
+
const useProvideStore = (storeId, store) => useProvideThing(storeId, store, 0);
|
|
108
119
|
const useMetrics = (id) => useThing(id, 2);
|
|
109
120
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
110
121
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
122
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
123
|
+
useProvideThing(metricsId, metrics, 1);
|
|
111
124
|
const useIndexes = (id) => useThing(id, 4);
|
|
112
125
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
113
126
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
127
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
128
|
+
useProvideThing(indexesId, indexes, 2);
|
|
114
129
|
const useRelationships = (id) => useThing(id, 6);
|
|
115
130
|
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
116
131
|
useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
132
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
133
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
117
134
|
const useQueries = (id) => useThing(id, 8);
|
|
118
135
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
119
136
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
137
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
138
|
+
useProvideThing(queriesId, queries, 4);
|
|
120
139
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
121
140
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
122
141
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
142
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
143
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
123
144
|
|
|
124
145
|
const lower = (str) => str.toLowerCase();
|
|
125
146
|
lower(LISTENER);
|
|
@@ -1572,21 +1593,37 @@ const Provider = ({
|
|
|
1572
1593
|
children,
|
|
1573
1594
|
}) => {
|
|
1574
1595
|
const parentValue = useContext(Context);
|
|
1575
|
-
const [
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1596
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1597
|
+
{},
|
|
1598
|
+
{},
|
|
1599
|
+
{},
|
|
1600
|
+
{},
|
|
1601
|
+
{},
|
|
1602
|
+
{},
|
|
1603
|
+
]);
|
|
1604
|
+
const addExtraThingById = useCallback(
|
|
1605
|
+
(thingOffset, id, thing) =>
|
|
1606
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1607
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1608
|
+
? extraThingsById2
|
|
1609
|
+
: arrayWith(extraThingsById2, thingOffset, {
|
|
1610
|
+
...extraThingsById2[thingOffset],
|
|
1611
|
+
[id]: thing,
|
|
1612
|
+
}),
|
|
1582
1613
|
),
|
|
1583
1614
|
[],
|
|
1584
1615
|
);
|
|
1585
|
-
const
|
|
1586
|
-
(id) =>
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1616
|
+
const delExtraThingById = useCallback(
|
|
1617
|
+
(thingOffset, id) =>
|
|
1618
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1619
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1620
|
+
? extraThingsById2
|
|
1621
|
+
: arrayWith(
|
|
1622
|
+
extraThingsById2,
|
|
1623
|
+
thingOffset,
|
|
1624
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1625
|
+
),
|
|
1626
|
+
),
|
|
1590
1627
|
[],
|
|
1591
1628
|
);
|
|
1592
1629
|
return /* @__PURE__ */ createElement(
|
|
@@ -1595,24 +1632,24 @@ const Provider = ({
|
|
|
1595
1632
|
value: useMemo(
|
|
1596
1633
|
() => [
|
|
1597
1634
|
store ?? parentValue[0],
|
|
1598
|
-
{...parentValue[1], ...storesById, ...
|
|
1635
|
+
{...parentValue[1], ...storesById, ...extraThingsById[0]},
|
|
1599
1636
|
metrics ?? parentValue[2],
|
|
1600
|
-
{...parentValue[3], ...metricsById},
|
|
1637
|
+
{...parentValue[3], ...metricsById, ...extraThingsById[1]},
|
|
1601
1638
|
indexes ?? parentValue[4],
|
|
1602
|
-
{...parentValue[5], ...indexesById},
|
|
1639
|
+
{...parentValue[5], ...indexesById, ...extraThingsById[2]},
|
|
1603
1640
|
relationships ?? parentValue[6],
|
|
1604
|
-
{...parentValue[7], ...relationshipsById},
|
|
1641
|
+
{...parentValue[7], ...relationshipsById, ...extraThingsById[3]},
|
|
1605
1642
|
queries ?? parentValue[8],
|
|
1606
|
-
{...parentValue[9], ...queriesById},
|
|
1643
|
+
{...parentValue[9], ...queriesById, ...extraThingsById[4]},
|
|
1607
1644
|
checkpoints ?? parentValue[10],
|
|
1608
|
-
{...parentValue[11], ...checkpointsById},
|
|
1609
|
-
|
|
1610
|
-
|
|
1645
|
+
{...parentValue[11], ...checkpointsById, ...extraThingsById[5]},
|
|
1646
|
+
addExtraThingById,
|
|
1647
|
+
delExtraThingById,
|
|
1611
1648
|
],
|
|
1612
1649
|
[
|
|
1613
1650
|
store,
|
|
1614
1651
|
storesById,
|
|
1615
|
-
|
|
1652
|
+
extraThingsById,
|
|
1616
1653
|
metrics,
|
|
1617
1654
|
metricsById,
|
|
1618
1655
|
indexes,
|
|
@@ -1624,8 +1661,8 @@ const Provider = ({
|
|
|
1624
1661
|
checkpoints,
|
|
1625
1662
|
checkpointsById,
|
|
1626
1663
|
parentValue,
|
|
1627
|
-
|
|
1628
|
-
|
|
1664
|
+
addExtraThingById,
|
|
1665
|
+
delExtraThingById,
|
|
1629
1666
|
],
|
|
1630
1667
|
),
|
|
1631
1668
|
},
|
|
@@ -1980,6 +2017,11 @@ exports.useMetricListener = useMetricListener;
|
|
|
1980
2017
|
exports.useMetrics = useMetrics;
|
|
1981
2018
|
exports.useMetricsIds = useMetricsIds;
|
|
1982
2019
|
exports.useMetricsOrMetricsById = useMetricsOrMetricsById;
|
|
2020
|
+
exports.useProvideCheckpoints = useProvideCheckpoints;
|
|
2021
|
+
exports.useProvideIndexes = useProvideIndexes;
|
|
2022
|
+
exports.useProvideMetrics = useProvideMetrics;
|
|
2023
|
+
exports.useProvideQueries = useProvideQueries;
|
|
2024
|
+
exports.useProvideRelationships = useProvideRelationships;
|
|
1983
2025
|
exports.useProvideStore = useProvideStore;
|
|
1984
2026
|
exports.useQueries = useQueries;
|
|
1985
2027
|
exports.useQueriesIds = useQueriesIds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",c=i+"s",a=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,x=()=>{},q=(e,t)=>e.every(t),S=(e,t)=>R(e)===R(t)&&q(e,((e,o)=>t[o]===e)),O=(e,t)=>e.map(t),L=Object,j=e=>L.getPrototypeOf(e),B=L.entries,E=e=>!w(e)&&k(j(e),(e=>e==L.prototype||w(j(e))),(()=>!0)),T=L.keys,M=(e,t)=>k(e,(e=>e[t])),F=(e,t)=>{const o=B(e);return R(o)===R(T(t))&&q(o,(([e,o])=>E(o)?!!E(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return w(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(e)||h(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:se,useEffect:de,useMemo:ue,useLayoutEffect:ie,useRef:ce,useState:ae,useSyncExternalStore:Ie}=e,pe=[],ve=[{},[],[pe,void 0,pe],void 0,!1,0],be=[F,S,([e,t,o],[r,n,l])=>t===n&&S(e,r)&&S(o,l)],ge=(e,t)=>e===t,ye=(e,t,o=pe)=>{const[,r]=ae(),[n,l]=ae();return de((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},me=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Ce=(e,t,r,n=pe)=>{const l=ce(ve[r]),s=se((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:ve[r];return(null!=(d=be[r])?d:ge)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=se((l=>me(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Ie(u,s)},fe=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),we=(e,t,o,r=pe,n=x,l=pe,...s)=>{const d=J(e);return se((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...ke(s,r,e),o),o)))))),[d,t,...r,...l,...he(s)])},ke=(e,t,o)=>O(e,(e=>P(e)?e(o,t):e)),he=e=>{return t=e=>!P(e),e.filter(t);var t},Pe=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((e=>o(null==l?void 0:l["del"+t](...ke(n,l,e)))),[l,t,...r,...he(n)])},Re=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},xe=(e,t=pe)=>ue(e,t),qe=(e,t=pe)=>ue(e,t),Se=()=>z(1),Oe=e=>Ce(c,J(e),4,[]),Le=e=>Ce(c,J(e),0),je=e=>Ce(a,J(e),1),Be=(e,t)=>Ce(i,J(t),4,[e]),Ee=(e,t)=>Ce(i,J(t),0,[e]),Te=(e,t)=>Ce(i+y,J(t),1,[e]),Me=(e,t,o)=>Ce(i+g,J(o),4,[e,t]),Fe=(e,t)=>Ce(p,J(t),5,[e]),Ve=(e,t)=>Ce(v,J(t),1,[e]),Ae=(e,t,o,r=0,n,l)=>Ce(b,J(l),1,[e,t,o,r,n]),De=(e,t,o)=>Ce(I,J(o),4,[e,t]),He=(e,t,o)=>Ce(I,J(o),0,[e,t]),Qe=(e,t,o)=>Ce(y,J(o),1,[e,t]),We=(e,t,o,r)=>Ce(g,J(r),4,[e,t,o]),ze=(e,t,o,r)=>Ce(g,J(r),3,[e,t,o]),Ge=e=>Ce(C,J(e),4,[]),Je=e=>Ce(C,J(e),0),Ke=e=>Ce(f,J(e),1),Ne=(e,t)=>Ce(m,J(t),4,[e]),Ue=(e,t)=>Ce(m,J(t),3,[e]),Xe=(e,t,o,r,n)=>we(o,c,e,t,r,n),Ye=(e,t,o,r,n,l)=>we(r,i,t,o,n,l,e),Ze=(e,t,o,r,n,l,s)=>we(n,I,o,r,l,s,e,t),$e=(e,t,o=pe,r,n=x,l=pe,s=!0)=>{const d=J(r);return se((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},_e=(e,t,o,r,n,l,s)=>we(n,"PartialRow",o,r,l,s,e,t),et=(e,t,o,r,n,l,s,d)=>we(l,g,r,n,s,d,e,t,o),tt=(e,t,o,r,n)=>we(o,C,e,t,r,n),ot=(e,t,o,r,n)=>we(o,"PartialValues",e,t,r,n),rt=(e,t,o,r,n,l)=>we(r,m,t,o,n,l,e),nt=(e,t,o)=>Pe(e,c,t,o),lt=(e,t,o,r)=>Pe(t,i,o,r,e),st=(e,t,o,r,n)=>Pe(o,I,r,n,e,t),dt=(e,t,o,r,n,l,s)=>Pe(n,g,l,s,e,t,o,r),ut=(e,t,o)=>Pe(e,C,t,o),it=(e,t,o,r)=>Pe(t,m,o,r,e),ct=(e,t,o,r)=>fe(d+c,J(r),e,t,[],o),at=(e,t,o,r)=>fe(c,J(r),e,t,pe,o),It=(e,t,o,r)=>fe(a,J(r),e,t,pe,o),pt=(e,t,o,r,n)=>fe(d+i,J(n),t,o,[e],r),vt=(e,t,o,r,n)=>fe(i,J(n),t,o,[e],r),bt=(e,t,o,r,n)=>fe(i+y,J(n),t,o,[e],r),gt=(e,t,o,r,n,l)=>fe(d+i+g,J(l),o,r,[e,t],n),yt=(e,t,o,r,n)=>fe(p,J(n),t,o,[e],r),mt=(e,t,o,r,n)=>fe(v,J(n),t,o,[e],r),Ct=(e,t,o,r,n,l,s,d,u)=>fe(b,J(u),l,s,[e,t,o,r,n],d),ft=(e,t,o,r,n,l)=>fe(d+I,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l)=>fe(I,J(l),o,r,[e,t],n),kt=(e,t,o,r,n,l)=>fe(y,J(l),o,r,[e,t],n),ht=(e,t,o,r,n,l,s)=>fe(d+g,J(s),r,n,[e,t,o],l),Pt=(e,t,o,r,n,l,s)=>fe(g,J(s),r,n,[e,t,o],l),Rt=(e,t,o,r)=>fe(d+C,J(r),e,t,[],o),xt=(e,t,o,r)=>fe(C,J(r),e,t,pe,o),qt=(e,t,o,r)=>fe(f,J(r),e,t,pe,o),St=(e,t,o,r,n)=>fe(d+m,J(n),t,o,[e],r),Ot=(e,t,o,r,n)=>fe(m,J(n),t,o,[e],r),Lt=(e,t,o)=>fe("Start"+ne,J(o),e,t),jt=(e,t,o)=>fe("WillFinish"+ne,J(o),e,t),Bt=(e,t,o)=>fe("DidFinish"+ne,J(o),e,t),Et=(e,t,o)=>ye(e,t,o),Tt=()=>z(3),Mt=e=>Ce("MetricIds",U(e),1),Ft=(e,t)=>Ce("Metric",U(t),3,[e]),Vt=(e,t,o,r)=>fe("Metric",U(r),t,o,[e]),At=(e,t,o)=>ye(e,t,o),Dt=()=>z(5),Ht=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Qt=e=>Ce("IndexIds",Y(e),1),Wt=(e,t,o)=>Ce("Slice"+v,Y(o),1,[e,t]),zt=(e,t,o,r)=>fe("SliceIds",Y(r),t,o,[e]),Gt=(e,t,o,r,n)=>fe("Slice"+v,Y(n),o,r,[e,t]),Jt=(e,t,o)=>ye(e,t,o),Kt=()=>z(7),Nt=e=>Ce("RelationshipIds",$(e),1),Ut=(e,t,o)=>Ce("RemoteRowId",$(o),3,[e,t]),Xt=(e,t,o)=>Ce("Local"+v,$(o),1,[e,t]),Yt=(e,t,o)=>Ce("Linked"+v,$(o),1,[e,t]),Zt=(e,t,o,r,n)=>fe("RemoteRowId",$(n),o,r,[e,t]),$t=(e,t,o,r,n)=>fe("Local"+v,$(n),o,r,[e,t]),_t=(e,t,o,r,n)=>fe("Linked"+v,$(n),o,r,[e,t]),eo=(e,t,o)=>ye(e,t,o),to=()=>z(9),oo=e=>Ce("QueryIds",ee(e),1),ro=(e,t)=>Ce(s+i,ee(t),0,[e]),no=(e,t)=>Ce(s+i+y,ee(t),1,[e]),lo=(e,t)=>Ce(s+p,ee(t),5,[e]),so=(e,t)=>Ce(s+v,ee(t),1,[e]),uo=(e,t,o,r=0,n,l)=>Ce(s+b,ee(l),1,[e,t,o,r,n]),io=(e,t,o)=>Ce(s+I,ee(o),0,[e,t]),co=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),ao=(e,t,o,r)=>Ce(s+g,ee(r),3,[e,t,o]),Io=(e,t,o,r)=>fe(s+i,ee(r),t,o,[e]),po=(e,t,o,r)=>fe(s+i+y,ee(r),t,o,[e]),vo=(e,t,o,r)=>fe(s+p,ee(r),t,o,[e]),bo=(e,t,o,r)=>fe(s+v,ee(r),t,o,[e]),go=(e,t,o,r,n,l,d,u)=>fe(s+b,ee(u),l,d,[e,t,o,r,n]),yo=(e,t,o,r,n)=>fe(s+I,ee(n),o,r,[e,t]),mo=(e,t,o,r,n)=>fe(s+y,ee(n),o,r,[e,t]),Co=(e,t,o,r,n,l)=>fe(s+g,ee(l),r,n,[e,t,o]),fo=(e,t,o)=>ye(e,t,o),wo=()=>z(11),ko=e=>Ce("CheckpointIds",oe(e),2),ho=(e,t)=>Ce("Checkpoint",oe(t),3,[e]),Po=(e=x,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Ro=e=>Re(e,"goBackward"),xo=e=>Re(e,"goForward"),qo=(e,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},So=e=>{var t;const r=oe(e),[n,l]=ko(r);return[(s=n,!(0==R(s))),Ro(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Oo=e=>{var t;const r=oe(e),[,,[n]]=ko(r);return[!w(n),xo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Lo=(e,t,o)=>fe("CheckpointIds",oe(o),e,t),jo=(e,t,o,r)=>fe("Checkpoint",oe(r),t,o,[e]),Bo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&le(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),de((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Eo=(e,t,o=pe,r,n=pe)=>{const[l,s]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),de((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:To,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>w(e)?{}:e(...t),Wo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var zo=Object.defineProperty,Go=Object.defineProperties,Jo=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,Xo=(e,t,o)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Yo=(e,t)=>{for(var o in t||(t={}))No.call(t,o)&&Xo(e,o,t[o]);if(Ko)for(var o of Ko(t))Uo.call(t,o)&&Xo(e,o,t[o]);return e},Zo=(e,t)=>Go(e,Jo(t)),$o=(e,t)=>{var o={};for(var r in e)No.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Ko)for(var r of Ko(e))t.indexOf(r)<0&&Uo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:_o,useContext:er,useMemo:tr,useState:or}=e,rr=({tableId:e,store:t,rowComponent:o=cr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>ur(O(d,(l=>Fo(o,Zo(Yo({},Qo(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),nr=({queryId:e,queries:t,resultRowComponent:o=hr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>ur(O(s,(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),lr=({relationshipId:e,relationships:t,rowComponent:o=cr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Wo($(t),e),a=s(e,d,u);return ur(O(a,(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},sr=e=>({checkpoints:t,checkpointComponent:o=xr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return ur(O(e(ko(s)),(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},dr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:I})=>{const p=er(H),[v,b]=or({}),g=_o(((e,t)=>b((o=>M(o,e)==t?o:Zo(Yo({},o),{[e]:t})))),[]),y=_o((e=>b((t=>Yo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Fo(H.Provider,{value:tr((()=>[null!=e?e:p[0],Yo(Yo(Yo({},p[1]),t),v),null!=o?o:p[2],Yo(Yo({},p[3]),r),null!=n?n:p[4],Yo(Yo({},p[5]),l),null!=s?s:p[6],Yo(Yo({},p[7]),d),null!=u?u:p[8],Yo(Yo({},p[9]),i),null!=c?c:p[10],Yo(Yo({},p[11]),a),g,y]),[e,t,v,o,r,n,l,s,d,u,i,c,a,p,g,y])},I)},ur=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ir=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ze(e,t,r,n))?s:o),void 0,l,r)},cr=({tableId:e,rowId:t,store:o,cellComponent:r=ir,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>ur(O(((e,t,o,r)=>{const n=Qe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ar=e=>rr(e,Ve(e.tableId,e.store)),Ir=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return rr(s,Ae(s.tableId,o,r,n,l,s.store))},pr=({store:e,tableComponent:t=ar,getTableComponentProps:o,separator:r,debugIds:n})=>ur(O(je(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),vr=({valueId:e,store:t,debugIds:r})=>{var n;return ur(o+(null!=(n=Ue(e,t))?n:o),void 0,r,e)},br=({store:e,valueComponent:t=vr,getValueComponentProps:o,separator:r,debugIds:n})=>ur(O(Ke(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),gr=({metricId:e,metrics:t,debugIds:r})=>{var n;return ur(null!=(n=Ft(e,t))?n:o,void 0,r,e)},yr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=cr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),c=Wt(e,t,d);return ur(O(c,(e=>Fo(r,Zo(Yo({},Qo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},mr=({indexId:e,indexes:t,sliceComponent:o=yr,getSliceComponentProps:r,separator:n,debugIds:l})=>ur(O(Ht(e,t),(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Cr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=cr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Wo($(o),e),i=Ut(e,t,s);return ur(w(u)||w(i)?null:Fo(r,Zo(Yo({},Qo(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},fr=e=>lr(e,Xt,e.remoteRowId),wr=e=>lr(e,Yt,e.firstRowId),kr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ao(e,t,r,n))?s:o),void 0,l,r)},hr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=kr,getResultCellComponentProps:n,separator:l,debugIds:s})=>ur(O(co(e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Pr=e=>nr(e,so(e.queryId,e.queries)),Rr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return nr(s,uo(s.queryId,o,r,n,l,s.queries))},xr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return ur(null!=(n=ho(t,e))?n:o,void 0,r,t)},qr=sr((e=>e[0])),Sr=sr((e=>w(e[1])?[]:[e[1]])),Or=sr((e=>e[2]));export{qr as BackwardCheckpointsView,ir as CellView,xr as CheckpointView,Sr as CurrentCheckpointView,Or as ForwardCheckpointsView,mr as IndexView,wr as LinkedRowsView,fr as LocalRowsView,gr as MetricView,dr as Provider,Cr as RemoteRowView,kr as ResultCellView,hr as ResultRowView,Rr as ResultSortedTableView,Pr as ResultTableView,cr as RowView,yr as SliceView,Ir as SortedTableView,ar as TableView,pr as TablesView,vr as ValueView,br as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,kt as useCellIdsListener,Pt as useCellListener,ho as useCheckpoint,ko as useCheckpointIds,Lo as useCheckpointIdsListener,jo as useCheckpointListener,te as useCheckpoints,wo as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Et as useCreateMetrics,Bo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,xe as useCreateStore,Eo as useCreateSynchronizer,dt as useDelCellCallback,st as useDelRowCallback,lt as useDelTableCallback,nt as useDelTablesCallback,it as useDelValueCallback,ut as useDelValuesCallback,Bt as useDidFinishTransactionListener,Ro as useGoBackwardCallback,xo as useGoForwardCallback,qo as useGoToCallback,We as useHasCell,ht as useHasCellListener,De as useHasRow,ft as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,pt as useHasTableListener,Oe as useHasTables,ct as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,Rt as useHasValuesListener,Qt as useIndexIds,X as useIndexes,Dt as useIndexesIds,Y as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,N as useMetrics,Tt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,to as useQueriesIds,ee as useQueriesOrQueriesById,oo as useQueryIds,Oo as useRedoInformation,Nt as useRelationshipIds,Z as useRelationships,Kt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,ao as useResultCell,co as useResultCellIds,mo as useResultCellIdsListener,Co as useResultCellListener,io as useResultRow,lo as useResultRowCount,vo as useResultRowCountListener,so as useResultRowIds,bo as useResultRowIdsListener,yo as useResultRowListener,uo as useResultSortedRowIds,go as useResultSortedRowIdsListener,ro as useResultTable,no as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Fe as useRowCount,yt as useRowCountListener,Ve as useRowIds,mt as useRowIdsListener,wt as useRowListener,et as useSetCellCallback,Po as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,rt as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,Ae as useSortedRowIds,Ct as useSortedRowIdsListener,Lt as useStartTransactionListener,G as useStore,Se as useStoreIds,J as useStoreOrStoreById,Ee as useTable,Te as useTableCellIds,bt as useTableCellIdsListener,je as useTableIds,It as useTableIdsListener,vt as useTableListener,Le as useTables,at as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,qt as useValueIdsListener,Ot as useValueListener,Je as useValues,xt as useValuesListener,jt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=globalThis,h=e=>null==e,k=(e,t,o)=>h(e)?null==o?void 0:o():t(e),P=e=>t(e)==r,R=e=>t(e)==n,x=e=>e.length,q=()=>{},S=(e,t)=>e.every(t),O=(e,t)=>x(e)===x(t)&&S(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),T=(e,t,o)=>e.with(t,o),j=Object,B=e=>j.getPrototypeOf(e),E=j.entries,M=e=>!h(e)&&k(B(e),(e=>e==j.prototype||h(B(e))),(()=>!0)),F=j.keys,V=(e,t)=>k(e,(e=>e[t])),A=(e,t)=>t in e,D=(e,t)=>{const o=E(e);return x(o)===x(F(t))&&S(o,(([e,o])=>M(o)?!!M(t[e])&&D(t[e],o):t[e]===o))},{createContext:H,useContext:Q,useEffect:W}=e,_=(J=()=>H([]),A(z=w,G="tinybase_uirc")||(z[G]=J()),z[G]);var z,G,J;const K=(e,t)=>{var o;const r=Q(_);return h(e)?r[t]:P(e)?V(null!=(o=r[t+1])?o:{},e):e},N=(e,t)=>{const o=K(e,t);return h(e)||P(e)?o:e},U=(e,t,o)=>{const{12:r,13:n}=Q(_);W((()=>(null==r||r(o,e,t),()=>null==n?void 0:n(o,e))),[r,e,t,o,n])},X=e=>{var t;return F(null!=(t=Q(_)[e])?t:{})},Y=e=>K(e,0),Z=e=>N(e,0),$=(e,t)=>U(e,t,0),ee=e=>K(e,2),te=e=>N(e,2),oe=(e,t)=>U(e,t,1),re=e=>K(e,4),ne=e=>N(e,4),le=(e,t)=>U(e,t,2),se=e=>K(e,6),de=e=>N(e,6),ue=(e,t)=>U(e,t,3),ie=e=>K(e,8),ae=e=>N(e,8),ce=(e,t)=>U(e,t,4),Ie=e=>K(e,10),pe=e=>N(e,10),ve=(e,t)=>U(e,t,5),be=e=>e.toLowerCase();be(l);const ge="Transaction";be(ge);var ye=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:me,useEffect:Ce,useMemo:fe,useLayoutEffect:we,useRef:he,useState:ke,useSyncExternalStore:Pe}=e,Re=[],xe=[{},[],[Re,void 0,Re],void 0,!1,0],qe=[D,O,([e,t,o],[r,n,l])=>t===n&&O(e,r)&&O(o,l)],Se=(e,t)=>e===t,Oe=(e,t,o=Re)=>{const[,r]=ke(),[n,l]=ke();return Ce((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},Le=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Te=(e,t,r,n=Re)=>{const l=he(xe[r]),s=me((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:xe[r];return(null!=(d=qe[r])?d:Se)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=me((l=>Le(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Pe(u,s)},je=(e,t,o,r=Re,n=Re,...l)=>we((()=>Le(t,e,...n,o,...l)),[t,e,...n,...r,...l]),Be=(e,t,o,r=Re,n=q,l=Re,...s)=>{const d=Z(e);return me((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...Ee(s,r,e),o),o)))))),[d,t,...r,...l,...Me(s)])},Ee=(e,t,o)=>L(e,(e=>R(e)?e(o,t):e)),Me=e=>{return t=e=>!R(e),e.filter(t);var t},Fe=(e,t,o=q,r=Re,...n)=>{const l=Z(e);return me((e=>o(null==l?void 0:l["del"+t](...Ee(n,l,e)))),[l,t,...r,...Me(n)])},Ve=(e,t,o)=>{const r=pe(e);return me((()=>null==r?void 0:r[t](o)),[r,t,o])},Ae=(e,t=Re)=>fe(e,t),De=(e,t=Re)=>fe(e,t),He=()=>X(1),Qe=e=>Te(a,Z(e),4,[]),We=e=>Te(a,Z(e),0),_e=e=>Te(c,Z(e),1),ze=(e,t)=>Te(i,Z(t),4,[e]),Ge=(e,t)=>Te(i,Z(t),0,[e]),Je=(e,t)=>Te(i+y,Z(t),1,[e]),Ke=(e,t,o)=>Te(i+g,Z(o),4,[e,t]),Ne=(e,t)=>Te(p,Z(t),5,[e]),Ue=(e,t)=>Te(v,Z(t),1,[e]),Xe=(e,t,o,r=0,n,l)=>Te(b,Z(l),1,[e,t,o,r,n]),Ye=(e,t,o)=>Te(I,Z(o),4,[e,t]),Ze=(e,t,o)=>Te(I,Z(o),0,[e,t]),$e=(e,t,o)=>Te(y,Z(o),1,[e,t]),et=(e,t,o,r)=>Te(g,Z(r),4,[e,t,o]),tt=(e,t,o,r)=>Te(g,Z(r),3,[e,t,o]),ot=e=>Te(C,Z(e),4,[]),rt=e=>Te(C,Z(e),0),nt=e=>Te(f,Z(e),1),lt=(e,t)=>Te(m,Z(t),4,[e]),st=(e,t)=>Te(m,Z(t),3,[e]),dt=(e,t,o,r,n)=>Be(o,a,e,t,r,n),ut=(e,t,o,r,n,l)=>Be(r,i,t,o,n,l,e),it=(e,t,o,r,n,l,s)=>Be(n,I,o,r,l,s,e,t),at=(e,t,o=Re,r,n=q,l=Re,s=!0)=>{const d=Z(r);return me((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(R(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},ct=(e,t,o,r,n,l,s)=>Be(n,"PartialRow",o,r,l,s,e,t),It=(e,t,o,r,n,l,s,d)=>Be(l,g,r,n,s,d,e,t,o),pt=(e,t,o,r,n)=>Be(o,C,e,t,r,n),vt=(e,t,o,r,n)=>Be(o,"PartialValues",e,t,r,n),bt=(e,t,o,r,n,l)=>Be(r,m,t,o,n,l,e),gt=(e,t,o)=>Fe(e,a,t,o),yt=(e,t,o,r)=>Fe(t,i,o,r,e),mt=(e,t,o,r,n)=>Fe(o,I,r,n,e,t),Ct=(e,t,o,r,n,l,s)=>Fe(n,g,l,s,e,t,o,r),ft=(e,t,o)=>Fe(e,C,t,o),wt=(e,t,o,r)=>Fe(t,m,o,r,e),ht=(e,t,o,r)=>je(d+a,Z(r),e,t,[],o),kt=(e,t,o,r)=>je(a,Z(r),e,t,Re,o),Pt=(e,t,o,r)=>je(c,Z(r),e,t,Re,o),Rt=(e,t,o,r,n)=>je(d+i,Z(n),t,o,[e],r),xt=(e,t,o,r,n)=>je(i,Z(n),t,o,[e],r),qt=(e,t,o,r,n)=>je(i+y,Z(n),t,o,[e],r),St=(e,t,o,r,n,l)=>je(d+i+g,Z(l),o,r,[e,t],n),Ot=(e,t,o,r,n)=>je(p,Z(n),t,o,[e],r),Lt=(e,t,o,r,n)=>je(v,Z(n),t,o,[e],r),Tt=(e,t,o,r,n,l,s,d,u)=>je(b,Z(u),l,s,[e,t,o,r,n],d),jt=(e,t,o,r,n,l)=>je(d+I,Z(l),o,r,[e,t],n),Bt=(e,t,o,r,n,l)=>je(I,Z(l),o,r,[e,t],n),Et=(e,t,o,r,n,l)=>je(y,Z(l),o,r,[e,t],n),Mt=(e,t,o,r,n,l,s)=>je(d+g,Z(s),r,n,[e,t,o],l),Ft=(e,t,o,r,n,l,s)=>je(g,Z(s),r,n,[e,t,o],l),Vt=(e,t,o,r)=>je(d+C,Z(r),e,t,[],o),At=(e,t,o,r)=>je(C,Z(r),e,t,Re,o),Dt=(e,t,o,r)=>je(f,Z(r),e,t,Re,o),Ht=(e,t,o,r,n)=>je(d+m,Z(n),t,o,[e],r),Qt=(e,t,o,r,n)=>je(m,Z(n),t,o,[e],r),Wt=(e,t,o)=>je("Start"+ge,Z(o),e,t),_t=(e,t,o)=>je("WillFinish"+ge,Z(o),e,t),zt=(e,t,o)=>je("DidFinish"+ge,Z(o),e,t),Gt=(e,t,o)=>Oe(e,t,o),Jt=()=>X(3),Kt=e=>Te("MetricIds",te(e),1),Nt=(e,t)=>Te("Metric",te(t),3,[e]),Ut=(e,t,o,r)=>je("Metric",te(r),t,o,[e]),Xt=(e,t,o)=>Oe(e,t,o),Yt=()=>X(5),Zt=(e,t)=>Te("SliceIds",ne(t),1,[e]),$t=e=>Te("IndexIds",ne(e),1),eo=(e,t,o)=>Te("Slice"+v,ne(o),1,[e,t]),to=(e,t,o,r)=>je("SliceIds",ne(r),t,o,[e]),oo=(e,t,o,r,n)=>je("Slice"+v,ne(n),o,r,[e,t]),ro=(e,t,o)=>Oe(e,t,o),no=()=>X(7),lo=e=>Te("RelationshipIds",de(e),1),so=(e,t,o)=>Te("RemoteRowId",de(o),3,[e,t]),uo=(e,t,o)=>Te("Local"+v,de(o),1,[e,t]),io=(e,t,o)=>Te("Linked"+v,de(o),1,[e,t]),ao=(e,t,o,r,n)=>je("RemoteRowId",de(n),o,r,[e,t]),co=(e,t,o,r,n)=>je("Local"+v,de(n),o,r,[e,t]),Io=(e,t,o,r,n)=>je("Linked"+v,de(n),o,r,[e,t]),po=(e,t,o)=>Oe(e,t,o),vo=()=>X(9),bo=e=>Te("QueryIds",ae(e),1),go=(e,t)=>Te(s+i,ae(t),0,[e]),yo=(e,t)=>Te(s+i+y,ae(t),1,[e]),mo=(e,t)=>Te(s+p,ae(t),5,[e]),Co=(e,t)=>Te(s+v,ae(t),1,[e]),fo=(e,t,o,r=0,n,l)=>Te(s+b,ae(l),1,[e,t,o,r,n]),wo=(e,t,o)=>Te(s+I,ae(o),0,[e,t]),ho=(e,t,o)=>Te(s+y,ae(o),1,[e,t]),ko=(e,t,o,r)=>Te(s+g,ae(r),3,[e,t,o]),Po=(e,t,o,r)=>je(s+i,ae(r),t,o,[e]),Ro=(e,t,o,r)=>je(s+i+y,ae(r),t,o,[e]),xo=(e,t,o,r)=>je(s+p,ae(r),t,o,[e]),qo=(e,t,o,r)=>je(s+v,ae(r),t,o,[e]),So=(e,t,o,r,n,l,d,u)=>je(s+b,ae(u),l,d,[e,t,o,r,n]),Oo=(e,t,o,r,n)=>je(s+I,ae(n),o,r,[e,t]),Lo=(e,t,o,r,n)=>je(s+y,ae(n),o,r,[e,t]),To=(e,t,o,r,n,l)=>je(s+g,ae(l),r,n,[e,t,o]),jo=(e,t,o)=>Oe(e,t,o),Bo=()=>X(11),Eo=e=>Te("CheckpointIds",pe(e),2),Mo=(e,t)=>Te("Checkpoint",pe(t),3,[e]),Fo=(e=q,t=Re,o,r=q,n=Re)=>{const l=pe(o);return me((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Vo=e=>Ve(e,"goBackward"),Ao=e=>Ve(e,"goForward"),Do=(e,t=Re,o,r=q,n=Re)=>{const l=pe(o);return me((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},Ho=e=>{var t;const r=pe(e),[n,l]=Eo(r);return[(s=n,!(0==x(s))),Vo(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Qo=e=>{var t;const r=pe(e),[,,[n]]=Eo(r);return[!h(n),Ao(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Wo=(e,t,o)=>je("CheckpointIds",pe(o),e,t),_o=(e,t,o,r)=>je("Checkpoint",pe(r),t,o,[e]),zo=(e,t,o=Re,r,n=Re,l,s=Re)=>{const[,d]=ke(),[u,i]=ke();return Ce((()=>{ye(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&ye(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),Ce((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Go=(e,t,o=Re,r,n=Re)=>{const[l,s]=ke();return Ce((()=>{ye(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),Ce((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Jo,Fragment:Ko,createElement:No,useCallback:Uo,useLayoutEffect:Xo,useRef:Yo,useState:Zo}=e,$o=(e,...t)=>h(e)?{}:e(...t),er=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var tr=Object.defineProperty,or=Object.defineProperties,rr=Object.getOwnPropertyDescriptors,nr=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,dr=(e,t,o)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,ur=(e,t)=>{for(var o in t||(t={}))lr.call(t,o)&&dr(e,o,t[o]);if(nr)for(var o of nr(t))sr.call(t,o)&&dr(e,o,t[o]);return e},ir=(e,t)=>or(e,rr(t)),ar=(e,t)=>{var o={};for(var r in e)lr.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&nr)for(var r of nr(e))t.indexOf(r)<0&&sr.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:cr,useContext:Ir,useMemo:pr,useState:vr}=e,br=({tableId:e,store:t,rowComponent:o=hr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>fr(L(d,(l=>No(o,ir(ur({},$o(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),gr=({queryId:e,queries:t,resultRowComponent:o=Mr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>fr(L(s,(n=>No(o,ir(ur({},$o(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),yr=({relationshipId:e,relationships:t,rowComponent:o=hr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=er(de(t),e),c=s(e,d,u);return fr(L(c,(e=>No(o,ir(ur({},$o(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,d)},mr=e=>({checkpoints:t,checkpointComponent:o=Ar,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=pe(t);return fr(L(e(Eo(s)),(e=>No(o,ir(ur({},$o(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},Cr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=Ir(_),[v,b]=vr([{},{},{},{},{},{}]),g=cr(((e,t,o)=>b((r=>V(r[e],t)==o?r:T(r,e,ir(ur({},r[e]),{[t]:o}))))),[]),y=cr(((e,t)=>b((o=>A(o[e],t)?T(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return No(_.Provider,{value:pr((()=>[null!=e?e:p[0],ur(ur(ur({},p[1]),t),v[0]),null!=o?o:p[2],ur(ur(ur({},p[3]),r),v[1]),null!=n?n:p[4],ur(ur(ur({},p[5]),l),v[2]),null!=s?s:p[6],ur(ur(ur({},p[7]),d),v[3]),null!=u?u:p[8],ur(ur(ur({},p[9]),i),v[4]),null!=a?a:p[10],ur(ur(ur({},p[11]),c),v[5]),g,y]),[e,t,v,o,r,n,l,s,d,u,i,a,c,p,g,y])},I)},fr=(e,t,o,r)=>{const n=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},wr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return fr(o+(null!=(s=tt(e,t,r,n))?s:o),void 0,l,r)},hr=({tableId:e,rowId:t,store:o,cellComponent:r=wr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>fr(L(((e,t,o,r)=>{const n=$e(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>No(r,ir(ur({},$o(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),kr=e=>br(e,Ue(e.tableId,e.store)),Pr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=ar(t,["cellId","descending","offset","limit"]);return br(s,Xe(s.tableId,o,r,n,l,s.store))},Rr=({store:e,tableComponent:t=kr,getTableComponentProps:o,separator:r,debugIds:n})=>fr(L(_e(e),(r=>No(t,ir(ur({},$o(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),xr=({valueId:e,store:t,debugIds:r})=>{var n;return fr(o+(null!=(n=st(e,t))?n:o),void 0,r,e)},qr=({store:e,valueComponent:t=xr,getValueComponentProps:o,separator:r,debugIds:n})=>fr(L(nt(e),(r=>No(t,ir(ur({},$o(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Sr=({metricId:e,metrics:t,debugIds:r})=>{var n;return fr(null!=(n=Nt(e,t))?n:o,void 0,r,e)},Or=({indexId:e,sliceId:t,indexes:o,rowComponent:r=hr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(ne(o),e),a=eo(e,t,d);return fr(L(a,(e=>No(r,ir(ur({},$o(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},Lr=({indexId:e,indexes:t,sliceComponent:o=Or,getSliceComponentProps:r,separator:n,debugIds:l})=>fr(L(Zt(e,t),(n=>No(o,ir(ur({},$o(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Tr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=hr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=er(de(o),e),i=so(e,t,s);return fr(h(u)||h(i)?null:No(r,ir(ur({},$o(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},jr=e=>yr(e,uo,e.remoteRowId),Br=e=>yr(e,io,e.firstRowId),Er=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return fr(o+(null!=(s=ko(e,t,r,n))?s:o),void 0,l,r)},Mr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Er,getResultCellComponentProps:n,separator:l,debugIds:s})=>fr(L(ho(e,t,o),(l=>No(r,ir(ur({},$o(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Fr=e=>gr(e,Co(e.queryId,e.queries)),Vr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=ar(t,["cellId","descending","offset","limit"]);return gr(s,fo(s.queryId,o,r,n,l,s.queries))},Ar=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return fr(null!=(n=Mo(t,e))?n:o,void 0,r,t)},Dr=mr((e=>e[0])),Hr=mr((e=>h(e[1])?[]:[e[1]])),Qr=mr((e=>e[2]));export{Dr as BackwardCheckpointsView,wr as CellView,Ar as CheckpointView,Hr as CurrentCheckpointView,Qr as ForwardCheckpointsView,Lr as IndexView,Br as LinkedRowsView,jr as LocalRowsView,Sr as MetricView,Cr as Provider,Tr as RemoteRowView,Er as ResultCellView,Mr as ResultRowView,Vr as ResultSortedTableView,Fr as ResultTableView,hr as RowView,Or as SliceView,Pr as SortedTableView,kr as TableView,Rr as TablesView,xr as ValueView,qr as ValuesView,at as useAddRowCallback,tt as useCell,$e as useCellIds,Et as useCellIdsListener,Ft as useCellListener,Mo as useCheckpoint,Eo as useCheckpointIds,Wo as useCheckpointIdsListener,_o as useCheckpointListener,Ie as useCheckpoints,Bo as useCheckpointsIds,pe as useCheckpointsOrCheckpointsById,jo as useCreateCheckpoints,Xt as useCreateIndexes,De as useCreateMergeableStore,Gt as useCreateMetrics,zo as useCreatePersister,po as useCreateQueries,ro as useCreateRelationships,Ae as useCreateStore,Go as useCreateSynchronizer,Ct as useDelCellCallback,mt as useDelRowCallback,yt as useDelTableCallback,gt as useDelTablesCallback,wt as useDelValueCallback,ft as useDelValuesCallback,zt as useDidFinishTransactionListener,Vo as useGoBackwardCallback,Ao as useGoForwardCallback,Do as useGoToCallback,et as useHasCell,Mt as useHasCellListener,Ye as useHasRow,jt as useHasRowListener,ze as useHasTable,Ke as useHasTableCell,St as useHasTableCellListener,Rt as useHasTableListener,Qe as useHasTables,ht as useHasTablesListener,lt as useHasValue,Ht as useHasValueListener,ot as useHasValues,Vt as useHasValuesListener,$t as useIndexIds,re as useIndexes,Yt as useIndexesIds,ne as useIndexesOrIndexesById,io as useLinkedRowIds,Io as useLinkedRowIdsListener,uo as useLocalRowIds,co as useLocalRowIdsListener,Nt as useMetric,Kt as useMetricIds,Ut as useMetricListener,ee as useMetrics,Jt as useMetricsIds,te as useMetricsOrMetricsById,ve as useProvideCheckpoints,le as useProvideIndexes,oe as useProvideMetrics,ce as useProvideQueries,ue as useProvideRelationships,$ as useProvideStore,ie as useQueries,vo as useQueriesIds,ae as useQueriesOrQueriesById,bo as useQueryIds,Qo as useRedoInformation,lo as useRelationshipIds,se as useRelationships,no as useRelationshipsIds,de as useRelationshipsOrRelationshipsById,so as useRemoteRowId,ao as useRemoteRowIdListener,ko as useResultCell,ho as useResultCellIds,Lo as useResultCellIdsListener,To as useResultCellListener,wo as useResultRow,mo as useResultRowCount,xo as useResultRowCountListener,Co as useResultRowIds,qo as useResultRowIdsListener,Oo as useResultRowListener,fo as useResultSortedRowIds,So as useResultSortedRowIdsListener,go as useResultTable,yo as useResultTableCellIds,Ro as useResultTableCellIdsListener,Po as useResultTableListener,Ze as useRow,Ne as useRowCount,Ot as useRowCountListener,Ue as useRowIds,Lt as useRowIdsListener,Bt as useRowListener,It as useSetCellCallback,Fo as useSetCheckpointCallback,ct as useSetPartialRowCallback,vt as useSetPartialValuesCallback,it as useSetRowCallback,ut as useSetTableCallback,dt as useSetTablesCallback,bt as useSetValueCallback,pt as useSetValuesCallback,Zt as useSliceIds,to as useSliceIdsListener,eo as useSliceRowIds,oo as useSliceRowIdsListener,Xe as useSortedRowIds,Tt as useSortedRowIdsListener,Wt as useStartTransactionListener,Y as useStore,He as useStoreIds,Z as useStoreOrStoreById,Ge as useTable,Je as useTableCellIds,qt as useTableCellIdsListener,_e as useTableIds,Pt as useTableIdsListener,xt as useTableListener,We as useTables,kt as useTablesListener,Ho as useUndoInformation,st as useValue,nt as useValueIds,Dt as useValueIdsListener,Qt as useValueListener,rt as useValues,At as useValuesListener,_t as useWillFinishTransactionListener};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",c=i+"s",a=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,x=()=>{},q=(e,t)=>e.every(t),S=(e,t)=>R(e)===R(t)&&q(e,((e,o)=>t[o]===e)),O=(e,t)=>e.map(t),L=Object,j=e=>L.getPrototypeOf(e),B=L.entries,E=e=>!w(e)&&k(j(e),(e=>e==L.prototype||w(j(e))),(()=>!0)),T=L.keys,M=(e,t)=>k(e,(e=>e[t])),F=(e,t)=>{const o=B(e);return R(o)===R(T(t))&&q(o,(([e,o])=>E(o)?!!E(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return w(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(e)||h(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:se,useEffect:de,useMemo:ue,useLayoutEffect:ie,useRef:ce,useState:ae,useSyncExternalStore:Ie}=e,pe=[],ve=[{},[],[pe,void 0,pe],void 0,!1,0],be=[F,S,([e,t,o],[r,n,l])=>t===n&&S(e,r)&&S(o,l)],ge=(e,t)=>e===t,ye=(e,t,o=pe)=>{const[,r]=ae(),[n,l]=ae();return de((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},me=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Ce=(e,t,r,n=pe)=>{const l=ce(ve[r]),s=se((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:ve[r];return(null!=(d=be[r])?d:ge)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=se((l=>me(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Ie(u,s)},fe=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),we=(e,t,o,r=pe,n=x,l=pe,...s)=>{const d=J(e);return se((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...ke(s,r,e),o),o)))))),[d,t,...r,...l,...he(s)])},ke=(e,t,o)=>O(e,(e=>P(e)?e(o,t):e)),he=e=>{return t=e=>!P(e),e.filter(t);var t},Pe=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((e=>o(null==l?void 0:l["del"+t](...ke(n,l,e)))),[l,t,...r,...he(n)])},Re=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},xe=(e,t=pe)=>ue(e,t),qe=(e,t=pe)=>ue(e,t),Se=()=>z(1),Oe=e=>Ce(c,J(e),4,[]),Le=e=>Ce(c,J(e),0),je=e=>Ce(a,J(e),1),Be=(e,t)=>Ce(i,J(t),4,[e]),Ee=(e,t)=>Ce(i,J(t),0,[e]),Te=(e,t)=>Ce(i+y,J(t),1,[e]),Me=(e,t,o)=>Ce(i+g,J(o),4,[e,t]),Fe=(e,t)=>Ce(p,J(t),5,[e]),Ve=(e,t)=>Ce(v,J(t),1,[e]),Ae=(e,t,o,r=0,n,l)=>Ce(b,J(l),1,[e,t,o,r,n]),De=(e,t,o)=>Ce(I,J(o),4,[e,t]),He=(e,t,o)=>Ce(I,J(o),0,[e,t]),Qe=(e,t,o)=>Ce(y,J(o),1,[e,t]),We=(e,t,o,r)=>Ce(g,J(r),4,[e,t,o]),ze=(e,t,o,r)=>Ce(g,J(r),3,[e,t,o]),Ge=e=>Ce(C,J(e),4,[]),Je=e=>Ce(C,J(e),0),Ke=e=>Ce(f,J(e),1),Ne=(e,t)=>Ce(m,J(t),4,[e]),Ue=(e,t)=>Ce(m,J(t),3,[e]),Xe=(e,t,o,r,n)=>we(o,c,e,t,r,n),Ye=(e,t,o,r,n,l)=>we(r,i,t,o,n,l,e),Ze=(e,t,o,r,n,l,s)=>we(n,I,o,r,l,s,e,t),$e=(e,t,o=pe,r,n=x,l=pe,s=!0)=>{const d=J(r);return se((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},_e=(e,t,o,r,n,l,s)=>we(n,"PartialRow",o,r,l,s,e,t),et=(e,t,o,r,n,l,s,d)=>we(l,g,r,n,s,d,e,t,o),tt=(e,t,o,r,n)=>we(o,C,e,t,r,n),ot=(e,t,o,r,n)=>we(o,"PartialValues",e,t,r,n),rt=(e,t,o,r,n,l)=>we(r,m,t,o,n,l,e),nt=(e,t,o)=>Pe(e,c,t,o),lt=(e,t,o,r)=>Pe(t,i,o,r,e),st=(e,t,o,r,n)=>Pe(o,I,r,n,e,t),dt=(e,t,o,r,n,l,s)=>Pe(n,g,l,s,e,t,o,r),ut=(e,t,o)=>Pe(e,C,t,o),it=(e,t,o,r)=>Pe(t,m,o,r,e),ct=(e,t,o,r)=>fe(d+c,J(r),e,t,[],o),at=(e,t,o,r)=>fe(c,J(r),e,t,pe,o),It=(e,t,o,r)=>fe(a,J(r),e,t,pe,o),pt=(e,t,o,r,n)=>fe(d+i,J(n),t,o,[e],r),vt=(e,t,o,r,n)=>fe(i,J(n),t,o,[e],r),bt=(e,t,o,r,n)=>fe(i+y,J(n),t,o,[e],r),gt=(e,t,o,r,n,l)=>fe(d+i+g,J(l),o,r,[e,t],n),yt=(e,t,o,r,n)=>fe(p,J(n),t,o,[e],r),mt=(e,t,o,r,n)=>fe(v,J(n),t,o,[e],r),Ct=(e,t,o,r,n,l,s,d,u)=>fe(b,J(u),l,s,[e,t,o,r,n],d),ft=(e,t,o,r,n,l)=>fe(d+I,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l)=>fe(I,J(l),o,r,[e,t],n),kt=(e,t,o,r,n,l)=>fe(y,J(l),o,r,[e,t],n),ht=(e,t,o,r,n,l,s)=>fe(d+g,J(s),r,n,[e,t,o],l),Pt=(e,t,o,r,n,l,s)=>fe(g,J(s),r,n,[e,t,o],l),Rt=(e,t,o,r)=>fe(d+C,J(r),e,t,[],o),xt=(e,t,o,r)=>fe(C,J(r),e,t,pe,o),qt=(e,t,o,r)=>fe(f,J(r),e,t,pe,o),St=(e,t,o,r,n)=>fe(d+m,J(n),t,o,[e],r),Ot=(e,t,o,r,n)=>fe(m,J(n),t,o,[e],r),Lt=(e,t,o)=>fe("Start"+ne,J(o),e,t),jt=(e,t,o)=>fe("WillFinish"+ne,J(o),e,t),Bt=(e,t,o)=>fe("DidFinish"+ne,J(o),e,t),Et=(e,t,o)=>ye(e,t,o),Tt=()=>z(3),Mt=e=>Ce("MetricIds",U(e),1),Ft=(e,t)=>Ce("Metric",U(t),3,[e]),Vt=(e,t,o,r)=>fe("Metric",U(r),t,o,[e]),At=(e,t,o)=>ye(e,t,o),Dt=()=>z(5),Ht=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Qt=e=>Ce("IndexIds",Y(e),1),Wt=(e,t,o)=>Ce("Slice"+v,Y(o),1,[e,t]),zt=(e,t,o,r)=>fe("SliceIds",Y(r),t,o,[e]),Gt=(e,t,o,r,n)=>fe("Slice"+v,Y(n),o,r,[e,t]),Jt=(e,t,o)=>ye(e,t,o),Kt=()=>z(7),Nt=e=>Ce("RelationshipIds",$(e),1),Ut=(e,t,o)=>Ce("RemoteRowId",$(o),3,[e,t]),Xt=(e,t,o)=>Ce("Local"+v,$(o),1,[e,t]),Yt=(e,t,o)=>Ce("Linked"+v,$(o),1,[e,t]),Zt=(e,t,o,r,n)=>fe("RemoteRowId",$(n),o,r,[e,t]),$t=(e,t,o,r,n)=>fe("Local"+v,$(n),o,r,[e,t]),_t=(e,t,o,r,n)=>fe("Linked"+v,$(n),o,r,[e,t]),eo=(e,t,o)=>ye(e,t,o),to=()=>z(9),oo=e=>Ce("QueryIds",ee(e),1),ro=(e,t)=>Ce(s+i,ee(t),0,[e]),no=(e,t)=>Ce(s+i+y,ee(t),1,[e]),lo=(e,t)=>Ce(s+p,ee(t),5,[e]),so=(e,t)=>Ce(s+v,ee(t),1,[e]),uo=(e,t,o,r=0,n,l)=>Ce(s+b,ee(l),1,[e,t,o,r,n]),io=(e,t,o)=>Ce(s+I,ee(o),0,[e,t]),co=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),ao=(e,t,o,r)=>Ce(s+g,ee(r),3,[e,t,o]),Io=(e,t,o,r)=>fe(s+i,ee(r),t,o,[e]),po=(e,t,o,r)=>fe(s+i+y,ee(r),t,o,[e]),vo=(e,t,o,r)=>fe(s+p,ee(r),t,o,[e]),bo=(e,t,o,r)=>fe(s+v,ee(r),t,o,[e]),go=(e,t,o,r,n,l,d,u)=>fe(s+b,ee(u),l,d,[e,t,o,r,n]),yo=(e,t,o,r,n)=>fe(s+I,ee(n),o,r,[e,t]),mo=(e,t,o,r,n)=>fe(s+y,ee(n),o,r,[e,t]),Co=(e,t,o,r,n,l)=>fe(s+g,ee(l),r,n,[e,t,o]),fo=(e,t,o)=>ye(e,t,o),wo=()=>z(11),ko=e=>Ce("CheckpointIds",oe(e),2),ho=(e,t)=>Ce("Checkpoint",oe(t),3,[e]),Po=(e=x,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Ro=e=>Re(e,"goBackward"),xo=e=>Re(e,"goForward"),qo=(e,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},So=e=>{var t;const r=oe(e),[n,l]=ko(r);return[(s=n,!(0==R(s))),Ro(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Oo=e=>{var t;const r=oe(e),[,,[n]]=ko(r);return[!w(n),xo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Lo=(e,t,o)=>fe("CheckpointIds",oe(o),e,t),jo=(e,t,o,r)=>fe("Checkpoint",oe(r),t,o,[e]),Bo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&le(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),de((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Eo=(e,t,o=pe,r,n=pe)=>{const[l,s]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),de((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:To,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>w(e)?{}:e(...t),Wo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var zo=Object.defineProperty,Go=Object.defineProperties,Jo=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,Xo=(e,t,o)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Yo=(e,t)=>{for(var o in t||(t={}))No.call(t,o)&&Xo(e,o,t[o]);if(Ko)for(var o of Ko(t))Uo.call(t,o)&&Xo(e,o,t[o]);return e},Zo=(e,t)=>Go(e,Jo(t)),$o=(e,t)=>{var o={};for(var r in e)No.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Ko)for(var r of Ko(e))t.indexOf(r)<0&&Uo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:_o,useContext:er,useMemo:tr,useState:or}=e,rr=({tableId:e,store:t,rowComponent:o=cr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>ur(O(d,(l=>Fo(o,Zo(Yo({},Qo(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),nr=({queryId:e,queries:t,resultRowComponent:o=hr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>ur(O(s,(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),lr=({relationshipId:e,relationships:t,rowComponent:o=cr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Wo($(t),e),a=s(e,d,u);return ur(O(a,(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},sr=e=>({checkpoints:t,checkpointComponent:o=xr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return ur(O(e(ko(s)),(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},dr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:I})=>{const p=er(H),[v,b]=or({}),g=_o(((e,t)=>b((o=>M(o,e)==t?o:Zo(Yo({},o),{[e]:t})))),[]),y=_o((e=>b((t=>Yo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Fo(H.Provider,{value:tr((()=>[null!=e?e:p[0],Yo(Yo(Yo({},p[1]),t),v),null!=o?o:p[2],Yo(Yo({},p[3]),r),null!=n?n:p[4],Yo(Yo({},p[5]),l),null!=s?s:p[6],Yo(Yo({},p[7]),d),null!=u?u:p[8],Yo(Yo({},p[9]),i),null!=c?c:p[10],Yo(Yo({},p[11]),a),g,y]),[e,t,v,o,r,n,l,s,d,u,i,c,a,p,g,y])},I)},ur=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ir=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ze(e,t,r,n))?s:o),void 0,l,r)},cr=({tableId:e,rowId:t,store:o,cellComponent:r=ir,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>ur(O(((e,t,o,r)=>{const n=Qe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ar=e=>rr(e,Ve(e.tableId,e.store)),Ir=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return rr(s,Ae(s.tableId,o,r,n,l,s.store))},pr=({store:e,tableComponent:t=ar,getTableComponentProps:o,separator:r,debugIds:n})=>ur(O(je(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),vr=({valueId:e,store:t,debugIds:r})=>{var n;return ur(o+(null!=(n=Ue(e,t))?n:o),void 0,r,e)},br=({store:e,valueComponent:t=vr,getValueComponentProps:o,separator:r,debugIds:n})=>ur(O(Ke(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),gr=({metricId:e,metrics:t,debugIds:r})=>{var n;return ur(null!=(n=Ft(e,t))?n:o,void 0,r,e)},yr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=cr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),c=Wt(e,t,d);return ur(O(c,(e=>Fo(r,Zo(Yo({},Qo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},mr=({indexId:e,indexes:t,sliceComponent:o=yr,getSliceComponentProps:r,separator:n,debugIds:l})=>ur(O(Ht(e,t),(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Cr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=cr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Wo($(o),e),i=Ut(e,t,s);return ur(w(u)||w(i)?null:Fo(r,Zo(Yo({},Qo(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},fr=e=>lr(e,Xt,e.remoteRowId),wr=e=>lr(e,Yt,e.firstRowId),kr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ao(e,t,r,n))?s:o),void 0,l,r)},hr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=kr,getResultCellComponentProps:n,separator:l,debugIds:s})=>ur(O(co(e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Pr=e=>nr(e,so(e.queryId,e.queries)),Rr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return nr(s,uo(s.queryId,o,r,n,l,s.queries))},xr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return ur(null!=(n=ho(t,e))?n:o,void 0,r,t)},qr=sr((e=>e[0])),Sr=sr((e=>w(e[1])?[]:[e[1]])),Or=sr((e=>e[2]));export{qr as BackwardCheckpointsView,ir as CellView,xr as CheckpointView,Sr as CurrentCheckpointView,Or as ForwardCheckpointsView,mr as IndexView,wr as LinkedRowsView,fr as LocalRowsView,gr as MetricView,dr as Provider,Cr as RemoteRowView,kr as ResultCellView,hr as ResultRowView,Rr as ResultSortedTableView,Pr as ResultTableView,cr as RowView,yr as SliceView,Ir as SortedTableView,ar as TableView,pr as TablesView,vr as ValueView,br as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,kt as useCellIdsListener,Pt as useCellListener,ho as useCheckpoint,ko as useCheckpointIds,Lo as useCheckpointIdsListener,jo as useCheckpointListener,te as useCheckpoints,wo as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Et as useCreateMetrics,Bo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,xe as useCreateStore,Eo as useCreateSynchronizer,dt as useDelCellCallback,st as useDelRowCallback,lt as useDelTableCallback,nt as useDelTablesCallback,it as useDelValueCallback,ut as useDelValuesCallback,Bt as useDidFinishTransactionListener,Ro as useGoBackwardCallback,xo as useGoForwardCallback,qo as useGoToCallback,We as useHasCell,ht as useHasCellListener,De as useHasRow,ft as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,pt as useHasTableListener,Oe as useHasTables,ct as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,Rt as useHasValuesListener,Qt as useIndexIds,X as useIndexes,Dt as useIndexesIds,Y as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,N as useMetrics,Tt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,to as useQueriesIds,ee as useQueriesOrQueriesById,oo as useQueryIds,Oo as useRedoInformation,Nt as useRelationshipIds,Z as useRelationships,Kt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,ao as useResultCell,co as useResultCellIds,mo as useResultCellIdsListener,Co as useResultCellListener,io as useResultRow,lo as useResultRowCount,vo as useResultRowCountListener,so as useResultRowIds,bo as useResultRowIdsListener,yo as useResultRowListener,uo as useResultSortedRowIds,go as useResultSortedRowIdsListener,ro as useResultTable,no as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Fe as useRowCount,yt as useRowCountListener,Ve as useRowIds,mt as useRowIdsListener,wt as useRowListener,et as useSetCellCallback,Po as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,rt as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,Ae as useSortedRowIds,Ct as useSortedRowIdsListener,Lt as useStartTransactionListener,G as useStore,Se as useStoreIds,J as useStoreOrStoreById,Ee as useTable,Te as useTableCellIds,bt as useTableCellIdsListener,je as useTableIds,It as useTableIdsListener,vt as useTableListener,Le as useTables,at as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,qt as useValueIdsListener,Ot as useValueListener,Je as useValues,xt as useValuesListener,jt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=globalThis,h=e=>null==e,k=(e,t,o)=>h(e)?null==o?void 0:o():t(e),P=e=>t(e)==r,R=e=>t(e)==n,x=e=>e.length,q=()=>{},S=(e,t)=>e.every(t),O=(e,t)=>x(e)===x(t)&&S(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),T=(e,t,o)=>e.with(t,o),j=Object,B=e=>j.getPrototypeOf(e),E=j.entries,M=e=>!h(e)&&k(B(e),(e=>e==j.prototype||h(B(e))),(()=>!0)),F=j.keys,V=(e,t)=>k(e,(e=>e[t])),A=(e,t)=>t in e,D=(e,t)=>{const o=E(e);return x(o)===x(F(t))&&S(o,(([e,o])=>M(o)?!!M(t[e])&&D(t[e],o):t[e]===o))},{createContext:H,useContext:Q,useEffect:W}=e,_=(J=()=>H([]),A(z=w,G="tinybase_uirc")||(z[G]=J()),z[G]);var z,G,J;const K=(e,t)=>{var o;const r=Q(_);return h(e)?r[t]:P(e)?V(null!=(o=r[t+1])?o:{},e):e},N=(e,t)=>{const o=K(e,t);return h(e)||P(e)?o:e},U=(e,t,o)=>{const{12:r,13:n}=Q(_);W((()=>(null==r||r(o,e,t),()=>null==n?void 0:n(o,e))),[r,e,t,o,n])},X=e=>{var t;return F(null!=(t=Q(_)[e])?t:{})},Y=e=>K(e,0),Z=e=>N(e,0),$=(e,t)=>U(e,t,0),ee=e=>K(e,2),te=e=>N(e,2),oe=(e,t)=>U(e,t,1),re=e=>K(e,4),ne=e=>N(e,4),le=(e,t)=>U(e,t,2),se=e=>K(e,6),de=e=>N(e,6),ue=(e,t)=>U(e,t,3),ie=e=>K(e,8),ae=e=>N(e,8),ce=(e,t)=>U(e,t,4),Ie=e=>K(e,10),pe=e=>N(e,10),ve=(e,t)=>U(e,t,5),be=e=>e.toLowerCase();be(l);const ge="Transaction";be(ge);var ye=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:me,useEffect:Ce,useMemo:fe,useLayoutEffect:we,useRef:he,useState:ke,useSyncExternalStore:Pe}=e,Re=[],xe=[{},[],[Re,void 0,Re],void 0,!1,0],qe=[D,O,([e,t,o],[r,n,l])=>t===n&&O(e,r)&&O(o,l)],Se=(e,t)=>e===t,Oe=(e,t,o=Re)=>{const[,r]=ke(),[n,l]=ke();return Ce((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},Le=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Te=(e,t,r,n=Re)=>{const l=he(xe[r]),s=me((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:xe[r];return(null!=(d=qe[r])?d:Se)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=me((l=>Le(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Pe(u,s)},je=(e,t,o,r=Re,n=Re,...l)=>we((()=>Le(t,e,...n,o,...l)),[t,e,...n,...r,...l]),Be=(e,t,o,r=Re,n=q,l=Re,...s)=>{const d=Z(e);return me((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...Ee(s,r,e),o),o)))))),[d,t,...r,...l,...Me(s)])},Ee=(e,t,o)=>L(e,(e=>R(e)?e(o,t):e)),Me=e=>{return t=e=>!R(e),e.filter(t);var t},Fe=(e,t,o=q,r=Re,...n)=>{const l=Z(e);return me((e=>o(null==l?void 0:l["del"+t](...Ee(n,l,e)))),[l,t,...r,...Me(n)])},Ve=(e,t,o)=>{const r=pe(e);return me((()=>null==r?void 0:r[t](o)),[r,t,o])},Ae=(e,t=Re)=>fe(e,t),De=(e,t=Re)=>fe(e,t),He=()=>X(1),Qe=e=>Te(a,Z(e),4,[]),We=e=>Te(a,Z(e),0),_e=e=>Te(c,Z(e),1),ze=(e,t)=>Te(i,Z(t),4,[e]),Ge=(e,t)=>Te(i,Z(t),0,[e]),Je=(e,t)=>Te(i+y,Z(t),1,[e]),Ke=(e,t,o)=>Te(i+g,Z(o),4,[e,t]),Ne=(e,t)=>Te(p,Z(t),5,[e]),Ue=(e,t)=>Te(v,Z(t),1,[e]),Xe=(e,t,o,r=0,n,l)=>Te(b,Z(l),1,[e,t,o,r,n]),Ye=(e,t,o)=>Te(I,Z(o),4,[e,t]),Ze=(e,t,o)=>Te(I,Z(o),0,[e,t]),$e=(e,t,o)=>Te(y,Z(o),1,[e,t]),et=(e,t,o,r)=>Te(g,Z(r),4,[e,t,o]),tt=(e,t,o,r)=>Te(g,Z(r),3,[e,t,o]),ot=e=>Te(C,Z(e),4,[]),rt=e=>Te(C,Z(e),0),nt=e=>Te(f,Z(e),1),lt=(e,t)=>Te(m,Z(t),4,[e]),st=(e,t)=>Te(m,Z(t),3,[e]),dt=(e,t,o,r,n)=>Be(o,a,e,t,r,n),ut=(e,t,o,r,n,l)=>Be(r,i,t,o,n,l,e),it=(e,t,o,r,n,l,s)=>Be(n,I,o,r,l,s,e,t),at=(e,t,o=Re,r,n=q,l=Re,s=!0)=>{const d=Z(r);return me((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(R(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},ct=(e,t,o,r,n,l,s)=>Be(n,"PartialRow",o,r,l,s,e,t),It=(e,t,o,r,n,l,s,d)=>Be(l,g,r,n,s,d,e,t,o),pt=(e,t,o,r,n)=>Be(o,C,e,t,r,n),vt=(e,t,o,r,n)=>Be(o,"PartialValues",e,t,r,n),bt=(e,t,o,r,n,l)=>Be(r,m,t,o,n,l,e),gt=(e,t,o)=>Fe(e,a,t,o),yt=(e,t,o,r)=>Fe(t,i,o,r,e),mt=(e,t,o,r,n)=>Fe(o,I,r,n,e,t),Ct=(e,t,o,r,n,l,s)=>Fe(n,g,l,s,e,t,o,r),ft=(e,t,o)=>Fe(e,C,t,o),wt=(e,t,o,r)=>Fe(t,m,o,r,e),ht=(e,t,o,r)=>je(d+a,Z(r),e,t,[],o),kt=(e,t,o,r)=>je(a,Z(r),e,t,Re,o),Pt=(e,t,o,r)=>je(c,Z(r),e,t,Re,o),Rt=(e,t,o,r,n)=>je(d+i,Z(n),t,o,[e],r),xt=(e,t,o,r,n)=>je(i,Z(n),t,o,[e],r),qt=(e,t,o,r,n)=>je(i+y,Z(n),t,o,[e],r),St=(e,t,o,r,n,l)=>je(d+i+g,Z(l),o,r,[e,t],n),Ot=(e,t,o,r,n)=>je(p,Z(n),t,o,[e],r),Lt=(e,t,o,r,n)=>je(v,Z(n),t,o,[e],r),Tt=(e,t,o,r,n,l,s,d,u)=>je(b,Z(u),l,s,[e,t,o,r,n],d),jt=(e,t,o,r,n,l)=>je(d+I,Z(l),o,r,[e,t],n),Bt=(e,t,o,r,n,l)=>je(I,Z(l),o,r,[e,t],n),Et=(e,t,o,r,n,l)=>je(y,Z(l),o,r,[e,t],n),Mt=(e,t,o,r,n,l,s)=>je(d+g,Z(s),r,n,[e,t,o],l),Ft=(e,t,o,r,n,l,s)=>je(g,Z(s),r,n,[e,t,o],l),Vt=(e,t,o,r)=>je(d+C,Z(r),e,t,[],o),At=(e,t,o,r)=>je(C,Z(r),e,t,Re,o),Dt=(e,t,o,r)=>je(f,Z(r),e,t,Re,o),Ht=(e,t,o,r,n)=>je(d+m,Z(n),t,o,[e],r),Qt=(e,t,o,r,n)=>je(m,Z(n),t,o,[e],r),Wt=(e,t,o)=>je("Start"+ge,Z(o),e,t),_t=(e,t,o)=>je("WillFinish"+ge,Z(o),e,t),zt=(e,t,o)=>je("DidFinish"+ge,Z(o),e,t),Gt=(e,t,o)=>Oe(e,t,o),Jt=()=>X(3),Kt=e=>Te("MetricIds",te(e),1),Nt=(e,t)=>Te("Metric",te(t),3,[e]),Ut=(e,t,o,r)=>je("Metric",te(r),t,o,[e]),Xt=(e,t,o)=>Oe(e,t,o),Yt=()=>X(5),Zt=(e,t)=>Te("SliceIds",ne(t),1,[e]),$t=e=>Te("IndexIds",ne(e),1),eo=(e,t,o)=>Te("Slice"+v,ne(o),1,[e,t]),to=(e,t,o,r)=>je("SliceIds",ne(r),t,o,[e]),oo=(e,t,o,r,n)=>je("Slice"+v,ne(n),o,r,[e,t]),ro=(e,t,o)=>Oe(e,t,o),no=()=>X(7),lo=e=>Te("RelationshipIds",de(e),1),so=(e,t,o)=>Te("RemoteRowId",de(o),3,[e,t]),uo=(e,t,o)=>Te("Local"+v,de(o),1,[e,t]),io=(e,t,o)=>Te("Linked"+v,de(o),1,[e,t]),ao=(e,t,o,r,n)=>je("RemoteRowId",de(n),o,r,[e,t]),co=(e,t,o,r,n)=>je("Local"+v,de(n),o,r,[e,t]),Io=(e,t,o,r,n)=>je("Linked"+v,de(n),o,r,[e,t]),po=(e,t,o)=>Oe(e,t,o),vo=()=>X(9),bo=e=>Te("QueryIds",ae(e),1),go=(e,t)=>Te(s+i,ae(t),0,[e]),yo=(e,t)=>Te(s+i+y,ae(t),1,[e]),mo=(e,t)=>Te(s+p,ae(t),5,[e]),Co=(e,t)=>Te(s+v,ae(t),1,[e]),fo=(e,t,o,r=0,n,l)=>Te(s+b,ae(l),1,[e,t,o,r,n]),wo=(e,t,o)=>Te(s+I,ae(o),0,[e,t]),ho=(e,t,o)=>Te(s+y,ae(o),1,[e,t]),ko=(e,t,o,r)=>Te(s+g,ae(r),3,[e,t,o]),Po=(e,t,o,r)=>je(s+i,ae(r),t,o,[e]),Ro=(e,t,o,r)=>je(s+i+y,ae(r),t,o,[e]),xo=(e,t,o,r)=>je(s+p,ae(r),t,o,[e]),qo=(e,t,o,r)=>je(s+v,ae(r),t,o,[e]),So=(e,t,o,r,n,l,d,u)=>je(s+b,ae(u),l,d,[e,t,o,r,n]),Oo=(e,t,o,r,n)=>je(s+I,ae(n),o,r,[e,t]),Lo=(e,t,o,r,n)=>je(s+y,ae(n),o,r,[e,t]),To=(e,t,o,r,n,l)=>je(s+g,ae(l),r,n,[e,t,o]),jo=(e,t,o)=>Oe(e,t,o),Bo=()=>X(11),Eo=e=>Te("CheckpointIds",pe(e),2),Mo=(e,t)=>Te("Checkpoint",pe(t),3,[e]),Fo=(e=q,t=Re,o,r=q,n=Re)=>{const l=pe(o);return me((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Vo=e=>Ve(e,"goBackward"),Ao=e=>Ve(e,"goForward"),Do=(e,t=Re,o,r=q,n=Re)=>{const l=pe(o);return me((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},Ho=e=>{var t;const r=pe(e),[n,l]=Eo(r);return[(s=n,!(0==x(s))),Vo(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Qo=e=>{var t;const r=pe(e),[,,[n]]=Eo(r);return[!h(n),Ao(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Wo=(e,t,o)=>je("CheckpointIds",pe(o),e,t),_o=(e,t,o,r)=>je("Checkpoint",pe(r),t,o,[e]),zo=(e,t,o=Re,r,n=Re,l,s=Re)=>{const[,d]=ke(),[u,i]=ke();return Ce((()=>{ye(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&ye(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),Ce((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Go=(e,t,o=Re,r,n=Re)=>{const[l,s]=ke();return Ce((()=>{ye(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),Ce((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Jo,Fragment:Ko,createElement:No,useCallback:Uo,useLayoutEffect:Xo,useRef:Yo,useState:Zo}=e,$o=(e,...t)=>h(e)?{}:e(...t),er=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var tr=Object.defineProperty,or=Object.defineProperties,rr=Object.getOwnPropertyDescriptors,nr=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,dr=(e,t,o)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,ur=(e,t)=>{for(var o in t||(t={}))lr.call(t,o)&&dr(e,o,t[o]);if(nr)for(var o of nr(t))sr.call(t,o)&&dr(e,o,t[o]);return e},ir=(e,t)=>or(e,rr(t)),ar=(e,t)=>{var o={};for(var r in e)lr.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&nr)for(var r of nr(e))t.indexOf(r)<0&&sr.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:cr,useContext:Ir,useMemo:pr,useState:vr}=e,br=({tableId:e,store:t,rowComponent:o=hr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>fr(L(d,(l=>No(o,ir(ur({},$o(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),gr=({queryId:e,queries:t,resultRowComponent:o=Mr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>fr(L(s,(n=>No(o,ir(ur({},$o(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),yr=({relationshipId:e,relationships:t,rowComponent:o=hr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=er(de(t),e),c=s(e,d,u);return fr(L(c,(e=>No(o,ir(ur({},$o(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,d)},mr=e=>({checkpoints:t,checkpointComponent:o=Ar,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=pe(t);return fr(L(e(Eo(s)),(e=>No(o,ir(ur({},$o(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},Cr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=Ir(_),[v,b]=vr([{},{},{},{},{},{}]),g=cr(((e,t,o)=>b((r=>V(r[e],t)==o?r:T(r,e,ir(ur({},r[e]),{[t]:o}))))),[]),y=cr(((e,t)=>b((o=>A(o[e],t)?T(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return No(_.Provider,{value:pr((()=>[null!=e?e:p[0],ur(ur(ur({},p[1]),t),v[0]),null!=o?o:p[2],ur(ur(ur({},p[3]),r),v[1]),null!=n?n:p[4],ur(ur(ur({},p[5]),l),v[2]),null!=s?s:p[6],ur(ur(ur({},p[7]),d),v[3]),null!=u?u:p[8],ur(ur(ur({},p[9]),i),v[4]),null!=a?a:p[10],ur(ur(ur({},p[11]),c),v[5]),g,y]),[e,t,v,o,r,n,l,s,d,u,i,a,c,p,g,y])},I)},fr=(e,t,o,r)=>{const n=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},wr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return fr(o+(null!=(s=tt(e,t,r,n))?s:o),void 0,l,r)},hr=({tableId:e,rowId:t,store:o,cellComponent:r=wr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>fr(L(((e,t,o,r)=>{const n=$e(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>No(r,ir(ur({},$o(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),kr=e=>br(e,Ue(e.tableId,e.store)),Pr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=ar(t,["cellId","descending","offset","limit"]);return br(s,Xe(s.tableId,o,r,n,l,s.store))},Rr=({store:e,tableComponent:t=kr,getTableComponentProps:o,separator:r,debugIds:n})=>fr(L(_e(e),(r=>No(t,ir(ur({},$o(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),xr=({valueId:e,store:t,debugIds:r})=>{var n;return fr(o+(null!=(n=st(e,t))?n:o),void 0,r,e)},qr=({store:e,valueComponent:t=xr,getValueComponentProps:o,separator:r,debugIds:n})=>fr(L(nt(e),(r=>No(t,ir(ur({},$o(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Sr=({metricId:e,metrics:t,debugIds:r})=>{var n;return fr(null!=(n=Nt(e,t))?n:o,void 0,r,e)},Or=({indexId:e,sliceId:t,indexes:o,rowComponent:r=hr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(ne(o),e),a=eo(e,t,d);return fr(L(a,(e=>No(r,ir(ur({},$o(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},Lr=({indexId:e,indexes:t,sliceComponent:o=Or,getSliceComponentProps:r,separator:n,debugIds:l})=>fr(L(Zt(e,t),(n=>No(o,ir(ur({},$o(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Tr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=hr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=er(de(o),e),i=so(e,t,s);return fr(h(u)||h(i)?null:No(r,ir(ur({},$o(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},jr=e=>yr(e,uo,e.remoteRowId),Br=e=>yr(e,io,e.firstRowId),Er=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return fr(o+(null!=(s=ko(e,t,r,n))?s:o),void 0,l,r)},Mr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Er,getResultCellComponentProps:n,separator:l,debugIds:s})=>fr(L(ho(e,t,o),(l=>No(r,ir(ur({},$o(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Fr=e=>gr(e,Co(e.queryId,e.queries)),Vr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=ar(t,["cellId","descending","offset","limit"]);return gr(s,fo(s.queryId,o,r,n,l,s.queries))},Ar=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return fr(null!=(n=Mo(t,e))?n:o,void 0,r,t)},Dr=mr((e=>e[0])),Hr=mr((e=>h(e[1])?[]:[e[1]])),Qr=mr((e=>e[2]));export{Dr as BackwardCheckpointsView,wr as CellView,Ar as CheckpointView,Hr as CurrentCheckpointView,Qr as ForwardCheckpointsView,Lr as IndexView,Br as LinkedRowsView,jr as LocalRowsView,Sr as MetricView,Cr as Provider,Tr as RemoteRowView,Er as ResultCellView,Mr as ResultRowView,Vr as ResultSortedTableView,Fr as ResultTableView,hr as RowView,Or as SliceView,Pr as SortedTableView,kr as TableView,Rr as TablesView,xr as ValueView,qr as ValuesView,at as useAddRowCallback,tt as useCell,$e as useCellIds,Et as useCellIdsListener,Ft as useCellListener,Mo as useCheckpoint,Eo as useCheckpointIds,Wo as useCheckpointIdsListener,_o as useCheckpointListener,Ie as useCheckpoints,Bo as useCheckpointsIds,pe as useCheckpointsOrCheckpointsById,jo as useCreateCheckpoints,Xt as useCreateIndexes,De as useCreateMergeableStore,Gt as useCreateMetrics,zo as useCreatePersister,po as useCreateQueries,ro as useCreateRelationships,Ae as useCreateStore,Go as useCreateSynchronizer,Ct as useDelCellCallback,mt as useDelRowCallback,yt as useDelTableCallback,gt as useDelTablesCallback,wt as useDelValueCallback,ft as useDelValuesCallback,zt as useDidFinishTransactionListener,Vo as useGoBackwardCallback,Ao as useGoForwardCallback,Do as useGoToCallback,et as useHasCell,Mt as useHasCellListener,Ye as useHasRow,jt as useHasRowListener,ze as useHasTable,Ke as useHasTableCell,St as useHasTableCellListener,Rt as useHasTableListener,Qe as useHasTables,ht as useHasTablesListener,lt as useHasValue,Ht as useHasValueListener,ot as useHasValues,Vt as useHasValuesListener,$t as useIndexIds,re as useIndexes,Yt as useIndexesIds,ne as useIndexesOrIndexesById,io as useLinkedRowIds,Io as useLinkedRowIdsListener,uo as useLocalRowIds,co as useLocalRowIdsListener,Nt as useMetric,Kt as useMetricIds,Ut as useMetricListener,ee as useMetrics,Jt as useMetricsIds,te as useMetricsOrMetricsById,ve as useProvideCheckpoints,le as useProvideIndexes,oe as useProvideMetrics,ce as useProvideQueries,ue as useProvideRelationships,$ as useProvideStore,ie as useQueries,vo as useQueriesIds,ae as useQueriesOrQueriesById,bo as useQueryIds,Qo as useRedoInformation,lo as useRelationshipIds,se as useRelationships,no as useRelationshipsIds,de as useRelationshipsOrRelationshipsById,so as useRemoteRowId,ao as useRemoteRowIdListener,ko as useResultCell,ho as useResultCellIds,Lo as useResultCellIdsListener,To as useResultCellListener,wo as useResultRow,mo as useResultRowCount,xo as useResultRowCountListener,Co as useResultRowIds,qo as useResultRowIdsListener,Oo as useResultRowListener,fo as useResultSortedRowIds,So as useResultSortedRowIdsListener,go as useResultTable,yo as useResultTableCellIds,Ro as useResultTableCellIdsListener,Po as useResultTableListener,Ze as useRow,Ne as useRowCount,Ot as useRowCountListener,Ue as useRowIds,Lt as useRowIdsListener,Bt as useRowListener,It as useSetCellCallback,Fo as useSetCheckpointCallback,ct as useSetPartialRowCallback,vt as useSetPartialValuesCallback,it as useSetRowCallback,ut as useSetTableCallback,dt as useSetTablesCallback,bt as useSetValueCallback,pt as useSetValuesCallback,Zt as useSliceIds,to as useSliceIdsListener,eo as useSliceRowIds,oo as useSliceRowIdsListener,Xe as useSortedRowIds,Tt as useSortedRowIdsListener,Wt as useStartTransactionListener,Y as useStore,He as useStoreIds,Z as useStoreOrStoreById,Ge as useTable,Je as useTableCellIds,qt as useTableCellIdsListener,_e as useTableIds,Pt as useTableIdsListener,xt as useTableListener,We as useTables,kt as useTablesListener,Ho as useUndoInformation,st as useValue,nt as useValueIds,Dt as useValueIdsListener,Qt as useValueListener,rt as useValues,At as useValuesListener,_t as useWillFinishTransactionListener};
|
|
Binary file
|
package/es6/ui-react/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
const getTypeOf = (thing) => typeof thing;
|
|
4
|
+
const TINYBASE = 'tinybase';
|
|
4
5
|
const EMPTY_STRING = '';
|
|
5
6
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
6
7
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -24,6 +25,7 @@ const VALUE = 'Value';
|
|
|
24
25
|
const VALUES = VALUE + 's';
|
|
25
26
|
const VALUE_IDS = VALUE + IDS;
|
|
26
27
|
|
|
28
|
+
const GLOBAL = globalThis;
|
|
27
29
|
const isUndefined = (thing) => thing == void 0;
|
|
28
30
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
29
31
|
isUndefined(value) ? (otherwise == null ? void 0 : otherwise()) : then(value);
|
|
@@ -40,6 +42,7 @@ const arrayIsEqual = (array1, array2) =>
|
|
|
40
42
|
const arrayMap = (array, cb) => array.map(cb);
|
|
41
43
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
42
44
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
45
|
+
const arrayWith = (array, index, value) => array.with(index, value);
|
|
43
46
|
|
|
44
47
|
const object = Object;
|
|
45
48
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -57,6 +60,7 @@ const isObject = (obj) =>
|
|
|
57
60
|
);
|
|
58
61
|
const objIds = object.keys;
|
|
59
62
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
63
|
+
const objHas = (obj, id) => id in obj;
|
|
60
64
|
const objDel = (obj, id) => {
|
|
61
65
|
delete obj[id];
|
|
62
66
|
return obj;
|
|
@@ -75,9 +79,15 @@ const objIsEqual = (obj1, obj2) => {
|
|
|
75
79
|
)
|
|
76
80
|
);
|
|
77
81
|
};
|
|
82
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
83
|
+
if (!objHas(obj, id)) {
|
|
84
|
+
obj[id] = getDefaultValue();
|
|
85
|
+
}
|
|
86
|
+
return obj[id];
|
|
87
|
+
};
|
|
78
88
|
|
|
79
89
|
const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
|
|
80
|
-
const Context = createContext([]);
|
|
90
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
|
|
81
91
|
const useThing = (id, offset) => {
|
|
82
92
|
var _a;
|
|
83
93
|
const contextValue = useContext$1(Context);
|
|
@@ -93,6 +103,16 @@ const useThingOrThingById = (thingOrThingId, offset) => {
|
|
|
93
103
|
? thing
|
|
94
104
|
: thingOrThingId;
|
|
95
105
|
};
|
|
106
|
+
const useProvideThing = (thingId, thing, offset) => {
|
|
107
|
+
const {12: addExtraThingById, 13: delExtraThingById} = useContext$1(Context);
|
|
108
|
+
useEffect$1(() => {
|
|
109
|
+
addExtraThingById == null
|
|
110
|
+
? void 0
|
|
111
|
+
: addExtraThingById(offset, thingId, thing);
|
|
112
|
+
return () =>
|
|
113
|
+
delExtraThingById == null ? void 0 : delExtraThingById(offset, thingId);
|
|
114
|
+
}, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
|
|
115
|
+
};
|
|
96
116
|
const useThingIds = (offset) => {
|
|
97
117
|
var _a;
|
|
98
118
|
return objIds((_a = useContext$1(Context)[offset]) != null ? _a : {});
|
|
@@ -100,28 +120,32 @@ const useThingIds = (offset) => {
|
|
|
100
120
|
const useStore = (id) => useThing(id, 0);
|
|
101
121
|
const useStoreOrStoreById = (storeOrStoreId) =>
|
|
102
122
|
useThingOrThingById(storeOrStoreId, 0);
|
|
103
|
-
const useProvideStore = (storeId, store) =>
|
|
104
|
-
const {12: addExtraStore, 13: delExtraStore} = useContext$1(Context);
|
|
105
|
-
useEffect$1(() => {
|
|
106
|
-
addExtraStore == null ? void 0 : addExtraStore(storeId, store);
|
|
107
|
-
return () => (delExtraStore == null ? void 0 : delExtraStore(storeId));
|
|
108
|
-
}, [addExtraStore, storeId, store, delExtraStore]);
|
|
109
|
-
};
|
|
123
|
+
const useProvideStore = (storeId, store) => useProvideThing(storeId, store, 0);
|
|
110
124
|
const useMetrics = (id) => useThing(id, 2);
|
|
111
125
|
const useMetricsOrMetricsById = (metricsOrMetricsId) =>
|
|
112
126
|
useThingOrThingById(metricsOrMetricsId, 2);
|
|
127
|
+
const useProvideMetrics = (metricsId, metrics) =>
|
|
128
|
+
useProvideThing(metricsId, metrics, 1);
|
|
113
129
|
const useIndexes = (id) => useThing(id, 4);
|
|
114
130
|
const useIndexesOrIndexesById = (indexesOrIndexesId) =>
|
|
115
131
|
useThingOrThingById(indexesOrIndexesId, 4);
|
|
132
|
+
const useProvideIndexes = (indexesId, indexes) =>
|
|
133
|
+
useProvideThing(indexesId, indexes, 2);
|
|
116
134
|
const useRelationships = (id) => useThing(id, 6);
|
|
117
135
|
const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
|
|
118
136
|
useThingOrThingById(relationshipsOrRelationshipsId, 6);
|
|
137
|
+
const useProvideRelationships = (relationshipsId, relationships) =>
|
|
138
|
+
useProvideThing(relationshipsId, relationships, 3);
|
|
119
139
|
const useQueries = (id) => useThing(id, 8);
|
|
120
140
|
const useQueriesOrQueriesById = (queriesOrQueriesId) =>
|
|
121
141
|
useThingOrThingById(queriesOrQueriesId, 8);
|
|
142
|
+
const useProvideQueries = (queriesId, queries) =>
|
|
143
|
+
useProvideThing(queriesId, queries, 4);
|
|
122
144
|
const useCheckpoints = (id) => useThing(id, 10);
|
|
123
145
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
124
146
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
147
|
+
const useProvideCheckpoints = (checkpointsId, checkpoints) =>
|
|
148
|
+
useProvideThing(checkpointsId, checkpoints, 5);
|
|
125
149
|
|
|
126
150
|
const lower = (str) => str.toLowerCase();
|
|
127
151
|
lower(LISTENER);
|
|
@@ -1690,20 +1714,39 @@ const Provider = ({
|
|
|
1690
1714
|
children,
|
|
1691
1715
|
}) => {
|
|
1692
1716
|
const parentValue = useContext(Context);
|
|
1693
|
-
const [
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1717
|
+
const [extraThingsById, setExtraThingsById] = useState([
|
|
1718
|
+
{},
|
|
1719
|
+
{},
|
|
1720
|
+
{},
|
|
1721
|
+
{},
|
|
1722
|
+
{},
|
|
1723
|
+
{},
|
|
1724
|
+
]);
|
|
1725
|
+
const addExtraThingById = useCallback(
|
|
1726
|
+
(thingOffset, id, thing) =>
|
|
1727
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1728
|
+
objGet(extraThingsById2[thingOffset], id) == thing
|
|
1729
|
+
? extraThingsById2
|
|
1730
|
+
: arrayWith(
|
|
1731
|
+
extraThingsById2,
|
|
1732
|
+
thingOffset,
|
|
1733
|
+
__spreadProps(__spreadValues({}, extraThingsById2[thingOffset]), {
|
|
1734
|
+
[id]: thing,
|
|
1735
|
+
}),
|
|
1736
|
+
),
|
|
1700
1737
|
),
|
|
1701
1738
|
[],
|
|
1702
1739
|
);
|
|
1703
|
-
const
|
|
1704
|
-
(id) =>
|
|
1705
|
-
|
|
1706
|
-
|
|
1740
|
+
const delExtraThingById = useCallback(
|
|
1741
|
+
(thingOffset, id) =>
|
|
1742
|
+
setExtraThingsById((extraThingsById2) =>
|
|
1743
|
+
!objHas(extraThingsById2[thingOffset], id)
|
|
1744
|
+
? extraThingsById2
|
|
1745
|
+
: arrayWith(
|
|
1746
|
+
extraThingsById2,
|
|
1747
|
+
thingOffset,
|
|
1748
|
+
objDel(extraThingsById2[thingOffset], id),
|
|
1749
|
+
),
|
|
1707
1750
|
),
|
|
1708
1751
|
[],
|
|
1709
1752
|
);
|
|
@@ -1715,25 +1758,46 @@ const Provider = ({
|
|
|
1715
1758
|
store != null ? store : parentValue[0],
|
|
1716
1759
|
__spreadValues(
|
|
1717
1760
|
__spreadValues(__spreadValues({}, parentValue[1]), storesById),
|
|
1718
|
-
|
|
1761
|
+
extraThingsById[0],
|
|
1719
1762
|
),
|
|
1720
1763
|
metrics != null ? metrics : parentValue[2],
|
|
1721
|
-
__spreadValues(
|
|
1764
|
+
__spreadValues(
|
|
1765
|
+
__spreadValues(__spreadValues({}, parentValue[3]), metricsById),
|
|
1766
|
+
extraThingsById[1],
|
|
1767
|
+
),
|
|
1722
1768
|
indexes != null ? indexes : parentValue[4],
|
|
1723
|
-
__spreadValues(
|
|
1769
|
+
__spreadValues(
|
|
1770
|
+
__spreadValues(__spreadValues({}, parentValue[5]), indexesById),
|
|
1771
|
+
extraThingsById[2],
|
|
1772
|
+
),
|
|
1724
1773
|
relationships != null ? relationships : parentValue[6],
|
|
1725
|
-
__spreadValues(
|
|
1774
|
+
__spreadValues(
|
|
1775
|
+
__spreadValues(
|
|
1776
|
+
__spreadValues({}, parentValue[7]),
|
|
1777
|
+
relationshipsById,
|
|
1778
|
+
),
|
|
1779
|
+
extraThingsById[3],
|
|
1780
|
+
),
|
|
1726
1781
|
queries != null ? queries : parentValue[8],
|
|
1727
|
-
__spreadValues(
|
|
1782
|
+
__spreadValues(
|
|
1783
|
+
__spreadValues(__spreadValues({}, parentValue[9]), queriesById),
|
|
1784
|
+
extraThingsById[4],
|
|
1785
|
+
),
|
|
1728
1786
|
checkpoints != null ? checkpoints : parentValue[10],
|
|
1729
|
-
__spreadValues(
|
|
1730
|
-
|
|
1731
|
-
|
|
1787
|
+
__spreadValues(
|
|
1788
|
+
__spreadValues(
|
|
1789
|
+
__spreadValues({}, parentValue[11]),
|
|
1790
|
+
checkpointsById,
|
|
1791
|
+
),
|
|
1792
|
+
extraThingsById[5],
|
|
1793
|
+
),
|
|
1794
|
+
addExtraThingById,
|
|
1795
|
+
delExtraThingById,
|
|
1732
1796
|
],
|
|
1733
1797
|
[
|
|
1734
1798
|
store,
|
|
1735
1799
|
storesById,
|
|
1736
|
-
|
|
1800
|
+
extraThingsById,
|
|
1737
1801
|
metrics,
|
|
1738
1802
|
metricsById,
|
|
1739
1803
|
indexes,
|
|
@@ -1745,8 +1809,8 @@ const Provider = ({
|
|
|
1745
1809
|
checkpoints,
|
|
1746
1810
|
checkpointsById,
|
|
1747
1811
|
parentValue,
|
|
1748
|
-
|
|
1749
|
-
|
|
1812
|
+
addExtraThingById,
|
|
1813
|
+
delExtraThingById,
|
|
1750
1814
|
],
|
|
1751
1815
|
),
|
|
1752
1816
|
},
|
|
@@ -2161,6 +2225,11 @@ export {
|
|
|
2161
2225
|
useMetrics,
|
|
2162
2226
|
useMetricsIds,
|
|
2163
2227
|
useMetricsOrMetricsById,
|
|
2228
|
+
useProvideCheckpoints,
|
|
2229
|
+
useProvideIndexes,
|
|
2230
|
+
useProvideMetrics,
|
|
2231
|
+
useProvideQueries,
|
|
2232
|
+
useProvideRelationships,
|
|
2164
2233
|
useProvideStore,
|
|
2165
2234
|
useQueries,
|
|
2166
2235
|
useQueriesIds,
|