tinybase 3.0.1 → 3.0.3
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/lib/cjs/checkpoints.cjs +1 -0
- package/lib/cjs/checkpoints.cjs.gz +0 -0
- package/lib/cjs/checkpoints.d.ts +959 -0
- package/lib/cjs/common.cjs +1 -0
- package/lib/cjs/common.cjs.gz +0 -0
- package/lib/cjs/common.d.ts +115 -0
- package/lib/cjs/indexes.cjs +1 -0
- package/lib/cjs/indexes.cjs.gz +0 -0
- package/lib/cjs/indexes.d.ts +966 -0
- package/lib/cjs/metrics.cjs +1 -0
- package/lib/cjs/metrics.cjs.gz +0 -0
- package/lib/cjs/metrics.d.ts +827 -0
- package/lib/cjs/persisters.cjs +1 -0
- package/lib/cjs/persisters.cjs.gz +0 -0
- package/lib/cjs/persisters.d.ts +727 -0
- package/lib/cjs/queries.cjs +1 -0
- package/lib/cjs/queries.cjs.gz +0 -0
- package/lib/cjs/queries.d.ts +3024 -0
- package/lib/cjs/relationships.cjs +1 -0
- package/lib/cjs/relationships.cjs.gz +0 -0
- package/lib/cjs/relationships.d.ts +1201 -0
- package/lib/cjs/store.cjs +1 -0
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/store.d.ts +5244 -0
- package/lib/cjs/tinybase.cjs +1 -0
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tinybase.d.ts +14 -0
- package/lib/cjs/tools.cjs +1 -0
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/tools.d.ts +512 -0
- package/lib/cjs/ui-react.cjs +1 -0
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs/ui-react.d.ts +10921 -0
- package/lib/cjs-es6/checkpoints.cjs +1 -0
- package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
- package/lib/cjs-es6/checkpoints.d.ts +959 -0
- package/lib/cjs-es6/common.cjs +1 -0
- package/lib/cjs-es6/common.cjs.gz +0 -0
- package/lib/cjs-es6/common.d.ts +115 -0
- package/lib/cjs-es6/indexes.cjs +1 -0
- package/lib/cjs-es6/indexes.cjs.gz +0 -0
- package/lib/cjs-es6/indexes.d.ts +966 -0
- package/lib/cjs-es6/metrics.cjs +1 -0
- package/lib/cjs-es6/metrics.cjs.gz +0 -0
- package/lib/cjs-es6/metrics.d.ts +827 -0
- package/lib/cjs-es6/persisters.cjs +1 -0
- package/lib/cjs-es6/persisters.cjs.gz +0 -0
- package/lib/cjs-es6/persisters.d.ts +727 -0
- package/lib/cjs-es6/queries.cjs +1 -0
- package/lib/cjs-es6/queries.cjs.gz +0 -0
- package/lib/cjs-es6/queries.d.ts +3024 -0
- package/lib/cjs-es6/relationships.cjs +1 -0
- package/lib/cjs-es6/relationships.cjs.gz +0 -0
- package/lib/cjs-es6/relationships.d.ts +1201 -0
- package/lib/cjs-es6/store.cjs +1 -0
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/store.d.ts +5244 -0
- package/lib/cjs-es6/tinybase.cjs +1 -0
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.d.ts +14 -0
- package/lib/cjs-es6/tools.cjs +1 -0
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/tools.d.ts +512 -0
- package/lib/cjs-es6/ui-react.cjs +1 -0
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.d.ts +10921 -0
- package/lib/debug/ui-react.js +22 -21
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +30 -22
- package/readme.md +1 -1
package/lib/debug/ui-react.js
CHANGED
|
@@ -34,17 +34,18 @@ const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
|
34
34
|
const {createContext, useContext} = React;
|
|
35
35
|
const Context = createContext([]);
|
|
36
36
|
const useThing = (id, offset) => {
|
|
37
|
-
const
|
|
37
|
+
const contextValue = useContext(Context);
|
|
38
38
|
return isUndefined(id)
|
|
39
|
-
?
|
|
40
|
-
:
|
|
39
|
+
? contextValue[offset]
|
|
40
|
+
: isString(id)
|
|
41
|
+
? objGet(contextValue[offset + 1], id)
|
|
42
|
+
: id;
|
|
41
43
|
};
|
|
42
44
|
const useThingOrThingId = (thingOrThingId, offset) => {
|
|
43
45
|
const thing = useThing(thingOrThingId, offset);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return thingOrThingId;
|
|
46
|
+
return isUndefined(thingOrThingId) || isString(thingOrThingId)
|
|
47
|
+
? thing
|
|
48
|
+
: thingOrThingId;
|
|
48
49
|
};
|
|
49
50
|
const useStore = (id) => useThing(id, 0);
|
|
50
51
|
const useMetrics = (id) => useThing(id, 2);
|
|
@@ -1084,24 +1085,24 @@ const Provider = ({
|
|
|
1084
1085
|
checkpointsById,
|
|
1085
1086
|
children,
|
|
1086
1087
|
}) => {
|
|
1087
|
-
const
|
|
1088
|
+
const parentValue = useContext$1(Context);
|
|
1088
1089
|
return /* @__PURE__ */ createElement(
|
|
1089
1090
|
Context.Provider,
|
|
1090
1091
|
{
|
|
1091
1092
|
value: useMemo(
|
|
1092
1093
|
() => [
|
|
1093
|
-
store ??
|
|
1094
|
-
{...
|
|
1095
|
-
metrics ??
|
|
1096
|
-
{...
|
|
1097
|
-
indexes ??
|
|
1098
|
-
{...
|
|
1099
|
-
relationships ??
|
|
1100
|
-
{...
|
|
1101
|
-
queries ??
|
|
1102
|
-
{...
|
|
1103
|
-
checkpoints ??
|
|
1104
|
-
{...
|
|
1094
|
+
store ?? parentValue[0],
|
|
1095
|
+
{...parentValue[1], ...storesById},
|
|
1096
|
+
metrics ?? parentValue[2],
|
|
1097
|
+
{...parentValue[3], ...metricsById},
|
|
1098
|
+
indexes ?? parentValue[4],
|
|
1099
|
+
{...parentValue[5], ...indexesById},
|
|
1100
|
+
relationships ?? parentValue[6],
|
|
1101
|
+
{...parentValue[7], ...relationshipsById},
|
|
1102
|
+
queries ?? parentValue[8],
|
|
1103
|
+
{...parentValue[9], ...queriesById},
|
|
1104
|
+
checkpoints ?? parentValue[10],
|
|
1105
|
+
{...parentValue[11], ...checkpointsById},
|
|
1105
1106
|
],
|
|
1106
1107
|
[
|
|
1107
1108
|
store,
|
|
@@ -1116,7 +1117,7 @@ const Provider = ({
|
|
|
1116
1117
|
queriesById,
|
|
1117
1118
|
checkpoints,
|
|
1118
1119
|
checkpointsById,
|
|
1119
|
-
|
|
1120
|
+
parentValue,
|
|
1120
1121
|
],
|
|
1121
1122
|
),
|
|
1122
1123
|
},
|
package/lib/es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as o}from"react";const t=e=>typeof e,r=t(""),l=(e,o)=>e.map(o),d=e=>null==e,s=(e,o,t)=>d(e)?null==t?void 0:t():o(e),n=()=>{},{createContext:u,useContext:a}=e,i=u([]),I=(e,o)=>{const t=a(i);return d(e)?t[o]:((e,o)=>s(e,(e=>e[o])))(t[o+1],e)},c=(e,o)=>{const l=I(e,o);return d(e)||(e=>t(e)==r)(e)?l:e},p=e=>I(e,0),b=e=>I(e,2),v=e=>I(e,4),g=e=>I(e,6),w=e=>I(e,8),R=e=>I(e,10),C=e=>c(e,0),m=e=>c(e,2),y=e=>c(e,4),k=e=>c(e,6),h=e=>c(e,8),f=e=>c(e,10),{useCallback:P,useEffect:T,useMemo:q,useRef:x,useState:S}=e,V=(e,o,t=[])=>{const r=q((()=>o(e)),[e,...t]);return T((()=>()=>r.destroy()),[r]),r},O=(e,o,t,r=[],l)=>{const[,s]=S(),n=P((()=>{var l,d;return null!=(d=null==(l=null==o?void 0:o["get"+e])?void 0:l.call(o,...r))?d:t}),[o,...r]),[u]=S(n),a=x(u);return q((()=>a.current=n()),[n]),B(e,o,((...e)=>{a.current=d(l)?n():e[l],s([])}),[],r),a.current},B=(e,o,t,r=[],l=[],...d)=>T((()=>{var r;const s=null==(r=null==o?void 0:o["add"+e+"Listener"])?void 0:r.call(o,...l,t,...d);return()=>null==o?void 0:o.delListener(s)}),[o,...l,...r,...d]),L=(e,o,t,r=[],l=n,d=[],...u)=>{const a=C(e);return P((e=>s(a,(r=>s(t(e,r),(e=>l(r["set"+o](...u,e),e)))))),[a,o,...r,...d,...u])},j=(e,o,t=n,r=[],...l)=>{const d=C(e);return P((()=>t(null==d?void 0:d["del"+o](...l))),[d,o,...r,...l])},M=(e,o,t)=>{const r=f(e);return P((()=>null==r?void 0:r[o](t)),[r,o,t])},E=(e,o=[])=>q(e,o),A=e=>O("Tables",C(e),{}),D=e=>O("TableIds",C(e),[],[]),F=(e,o)=>O("Table",C(o),{},[e]),z=(e,o)=>O("RowIds",C(o),[],[e]),G=(e,o,t,r=0,l,d)=>O("SortedRowIds",C(d),[],[e,o,t,r,l],6),H=(e,o,t)=>O("Row",C(t),{},[e,o]),J=(e,o,t)=>O("CellIds",C(t),[],[e,o]),K=(e,o,t,r)=>O("Cell",C(r),void 0,[e,o,t],4),N=e=>O("Values",C(e),{}),Q=e=>O("ValueIds",C(e),[],[]),U=(e,o)=>O("Value",C(o),void 0,[e]),W=(e,o,t,r,l)=>L(t,"Tables",e,o,r,l),X=(e,o,t,r,l,d)=>L(r,"Table",o,t,l,d,e),Y=(e,o,t,r,l,d,s)=>L(l,"Row",t,r,d,s,e,o),Z=(e,o,t=[],r,l=n,d=[])=>{const u=C(r);return P((t=>s(u,(r=>s(o(t,r),(o=>l(r.addRow(e,o),r,o)))))),[u,e,...t,...d])},$=(e,o,t,r,l,d,s)=>L(l,"PartialRow",t,r,d,s,e,o),_=(e,o,t,r,l,d,s,n)=>L(d,"Cell",r,l,s,n,e,o,t),ee=(e,o,t,r,l)=>L(t,"Values",e,o,r,l),oe=(e,o,t,r,l)=>L(t,"PartialValues",e,o,r,l),te=(e,o,t,r,l,d)=>L(r,"Value",o,t,l,d,e),re=(e,o,t)=>j(e,"Tables",o,t),le=(e,o,t,r)=>j(o,"Table",t,r,e),de=(e,o,t,r,l)=>j(t,"Row",r,l,e,o),se=(e,o,t,r,l,d,s)=>j(l,"Cell",d,s,e,o,t,r),ne=(e,o,t)=>j(e,"Values",o,t),ue=(e,o,t,r)=>j(o,"Value",t,r,e),ae=(e,o,t,r)=>B("Tables",C(r),e,o,[],t),ie=(e,o,t,r)=>B("TableIds",C(r),e,o,[],t),Ie=(e,o,t,r,l)=>B("Table",C(l),o,t,[e],r),ce=(e,o,t,r,l)=>B("RowIds",C(l),o,t,[e],r),pe=(e,o,t,r,l,d,s,n,u)=>B("SortedRowIds",C(u),d,s,[e,o,t,r,l],n),be=(e,o,t,r,l,d)=>B("Row",C(d),t,r,[e,o],l),ve=(e,o,t,r,l,d)=>B("CellIds",C(d),t,r,[e,o],l),ge=(e,o,t,r,l,d,s)=>B("Cell",C(s),r,l,[e,o,t],d),we=(e,o,t,r)=>B("Values",C(r),e,o,[],t),Re=(e,o,t,r)=>B("ValueIds",C(r),e,o,[],t),Ce=(e,o,t,r,l)=>B("Value",C(l),o,t,[e],r),me=(e,o,t)=>V(e,o,t),ye=(e,o)=>O("Metric",m(o),void 0,[e]),ke=(e,o,t,r)=>B("Metric",m(r),o,t,[e]),he=(e,o,t)=>V(e,o,t),fe=(e,o)=>O("SliceIds",y(o),[],[e]),Pe=(e,o,t)=>O("SliceRowIds",y(t),[],[e,o]),Te=(e,o,t,r)=>B("SliceIds",y(r),o,t,[e]),qe=(e,o,t,r,l)=>B("SliceRowIds",y(l),t,r,[e,o]),xe=(e,o,t)=>V(e,o,t),Se=(e,o,t)=>O("RemoteRowId",k(t),void 0,[e,o]),Ve=(e,o,t)=>O("LocalRowIds",k(t),[],[e,o]),Oe=(e,o,t)=>O("LinkedRowIds",k(t),[],[e,o]),Be=(e,o,t,r,l)=>B("RemoteRowId",k(l),t,r,[e,o]),Le=(e,o,t,r,l)=>B("LocalRowIds",k(l),t,r,[e,o]),je=(e,o,t,r,l)=>B("LinkedRowIds",k(l),t,r,[e,o]),Me=(e,o,t)=>V(e,o,t),Ee=(e,o)=>O("ResultTable",h(o),{},[e]),Ae=(e,o)=>O("ResultRowIds",h(o),[],[e]),De=(e,o,t,r=0,l,d)=>O("ResultSortedRowIds",h(d),[],[e,o,t,r,l],6),Fe=(e,o,t)=>O("ResultRow",h(t),{},[e,o]),ze=(e,o,t)=>O("ResultCellIds",h(t),[],[e,o]),Ge=(e,o,t,r)=>O("ResultCell",h(r),void 0,[e,o,t]),He=(e,o,t,r)=>B("ResultTable",h(r),o,t,[e]),Je=(e,o,t,r)=>B("ResultRowIds",h(r),o,t,[e]),Ke=(e,o,t,r,l,d,s,n)=>B("ResultSortedRowIds",h(n),d,s,[e,o,t,r,l]),Ne=(e,o,t,r,l)=>B("ResultRow",h(l),t,r,[e,o]),Qe=(e,o,t,r,l)=>B("ResultCellIds",h(l),t,r,[e,o]),Ue=(e,o,t,r,l,d)=>B("ResultCell",h(d),r,l,[e,o,t]),We=(e,o,t)=>V(e,o,t),Xe=e=>O("CheckpointIds",f(e),[[],void 0,[]]),Ye=(e,o)=>O("Checkpoint",f(o),void 0,[e]),Ze=(e=n,o=[],t,r=n,l=[])=>{const d=f(t);return P((o=>s(d,(t=>{const l=e(o);r(t.addCheckpoint(l),t,l)}))),[d,...o,...l])},$e=e=>M(e,"goBackward"),_e=e=>M(e,"goForward"),eo=(e,o=[],t,r=n,l=[])=>{const d=f(t);return P((o=>s(d,(t=>s(e(o),(e=>r(t.goTo(e),e)))))),[d,...o,...l])},oo=e=>{var o;const t=f(e),[r,l]=Xe(t);return[(d=r,!(0==(e=>e.length)(d))),$e(t),l,null!=(o=s(l,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""];var d},to=e=>{var o;const t=f(e),[,,[r]]=Xe(t);return[!d(r),_e(t),r,null!=(o=s(r,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""]},ro=(e,o,t)=>B("CheckpointIds",f(t),e,o),lo=(e,o,t,r)=>B("Checkpoint",f(r),o,t,[e]),so=(e,o,t=[],r,l=[])=>{const[,d]=S(),s=q((()=>o(e)),[e,...t]);return T((()=>{var e;return e=function*(){yield null==r?void 0:r(s),d(1)},new Promise(((o,t)=>{var r=o=>{try{d(e.next(o))}catch(e){t(e)}},l=o=>{try{d(e.throw(o))}catch(e){t(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,l);d((e=e.apply(void 0,null)).next())})),()=>{s.destroy()}}),[s,...l]),s};var no=Object.defineProperty,uo=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,io=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,po=(e,o,t)=>o in e?no(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,bo=(e,o)=>{for(var t in o||(o={}))Io.call(o,t)&&po(e,t,o[t]);if(io)for(var t of io(o))co.call(o,t)&&po(e,t,o[t]);return e},vo=(e,o)=>uo(e,ao(o)),go=(e,o)=>{var t={};for(var r in e)Io.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&io)for(var r of io(e))o.indexOf(r)<0&&co.call(e,r)&&(t[r]=e[r]);return t};const{createElement:wo,useMemo:Ro}=e,Co=({tableId:e,store:o,rowComponent:t=xo,getRowComponentProps:r,separator:d,debugIds:s},n)=>To(l(n,(l=>wo(t,vo(bo({},fo(r,l)),{key:l,tableId:e,rowId:l,store:o,debugIds:s})))),d,s,e),mo=({queryId:e,queries:o,resultRowComponent:t=Go,getResultRowComponentProps:r,separator:d,debugIds:s},n)=>To(l(n,(l=>wo(t,vo(bo({},fo(r,l)),{key:l,queryId:e,rowId:l,queries:o,debugIds:s})))),d,s,e),yo=e=>{const o=k(e);return[o,null==o?void 0:o.getStore()]},ko=({relationshipId:e,relationships:o,rowComponent:t=xo,getRowComponentProps:r,separator:d,debugIds:s},n,u)=>{const[a,i]=yo(o),I=null==a?void 0:a.getLocalTableId(e),c=n(e,u,a);return To(l(c,(e=>wo(t,vo(bo({},fo(r,e)),{key:e,tableId:I,rowId:e,store:i,debugIds:s})))),d,s,u)},ho=e=>({checkpoints:o,checkpointComponent:t=Ko,getCheckpointComponentProps:r,separator:d,debugIds:s})=>{const n=f(o);return To(l(e(Xe(n)),(e=>wo(t,vo(bo({},fo(r,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:s})))),d)},fo=(e,o)=>d(e)?{}:e(o),Po=({store:e,storesById:t,metrics:r,metricsById:l,indexes:d,indexesById:s,relationships:n,relationshipsById:u,queries:a,queriesById:I,checkpoints:c,checkpointsById:p,children:b})=>{const v=o(i);return wo(i.Provider,{value:Ro((()=>[null!=e?e:v[0],bo(bo({},v[1]),t),null!=r?r:v[2],bo(bo({},v[3]),l),null!=d?d:v[4],bo(bo({},v[5]),s),null!=n?n:v[6],bo(bo({},v[7]),u),null!=a?a:v[8],bo(bo({},v[9]),I),null!=c?c:v[10],bo(bo({},v[11]),p)]),[e,t,r,l,d,s,n,u,a,I,c,p,v])},b)},To=(e,o,t,r)=>{const s=d(o)||!Array.isArray(e)?e:l(e,((e,t)=>t>0?[o,e]:e));return t?[r,":{",s,"}"]:s},qo=({tableId:e,rowId:o,cellId:t,store:r,debugIds:l})=>{var d;return To(""+(null!=(d=K(e,o,t,r))?d:""),void 0,l,t)},xo=({tableId:e,rowId:o,store:t,cellComponent:r=qo,getCellComponentProps:d,separator:s,debugIds:n})=>To(l(J(e,o,t),(l=>wo(r,vo(bo({},fo(d,l)),{key:l,tableId:e,rowId:o,cellId:l,store:t,debugIds:n})))),s,n,o),So=e=>Co(e,z(e.tableId,e.store)),Vo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=go(o,["cellId","descending","offset","limit"]);return Co(s,G(s.tableId,t,r,l,d,s.store))},Oo=({store:e,tableComponent:o=So,getTableComponentProps:t,separator:r,debugIds:d})=>To(l(D(e),(r=>wo(o,vo(bo({},fo(t,r)),{key:r,tableId:r,store:e,debugIds:d})))),r),Bo=({valueId:e,store:o,debugIds:t})=>{var r;return To(""+(null!=(r=U(e,o))?r:""),void 0,t,e)},Lo=({store:e,valueComponent:o=Bo,getValueComponentProps:t,separator:r,debugIds:d})=>To(l(Q(e),(r=>wo(o,vo(bo({},fo(t,r)),{key:r,valueId:r,store:e,debugIds:d})))),r),jo=({metricId:e,metrics:o,debugIds:t})=>{var r;return To(null!=(r=ye(e,o))?r:"",void 0,t,e)},Mo=({indexId:e,sliceId:o,indexes:t,rowComponent:r=xo,getRowComponentProps:d,separator:s,debugIds:n})=>{const u=y(t),a=null==u?void 0:u.getStore(),i=null==u?void 0:u.getTableId(e),I=Pe(e,o,u);return To(l(I,(e=>wo(r,vo(bo({},fo(d,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:n})))),s,n,o)},Eo=({indexId:e,indexes:o,sliceComponent:t=Mo,getSliceComponentProps:r,separator:d,debugIds:s})=>To(l(fe(e,o),(l=>wo(t,vo(bo({},fo(r,l)),{key:l,indexId:e,sliceId:l,indexes:o,debugIds:s})))),d,s,e),Ao=({relationshipId:e,localRowId:o,relationships:t,rowComponent:r=xo,getRowComponentProps:l,debugIds:s})=>{const[n,u]=yo(t),a=null==n?void 0:n.getRemoteTableId(e),i=Se(e,o,n);return To(d(a)||d(i)?null:wo(r,vo(bo({},fo(l,i)),{key:i,tableId:a,rowId:i,store:u,debugIds:s})),void 0,s,o)},Do=e=>ko(e,Ve,e.remoteRowId),Fo=e=>ko(e,Oe,e.firstRowId),zo=({queryId:e,rowId:o,cellId:t,queries:r,debugIds:l})=>{var d;return To(""+(null!=(d=Ge(e,o,t,r))?d:""),void 0,l,t)},Go=({queryId:e,rowId:o,queries:t,resultCellComponent:r=zo,getResultCellComponentProps:d,separator:s,debugIds:n})=>To(l(ze(e,o,t),(l=>wo(r,vo(bo({},fo(d,l)),{key:l,queryId:e,rowId:o,cellId:l,queries:t,debugIds:n})))),s,n,o),Ho=e=>mo(e,Ae(e.queryId,e.queries)),Jo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=go(o,["cellId","descending","offset","limit"]);return mo(s,De(s.queryId,t,r,l,d,s.queries))},Ko=({checkpoints:e,checkpointId:o,debugIds:t})=>{var r;return To(null!=(r=Ye(o,e))?r:"",void 0,t,o)},No=ho((e=>e[0])),Qo=ho((e=>d(e[1])?[]:[e[1]])),Uo=ho((e=>e[2]));export{No as BackwardCheckpointsView,qo as CellView,Ko as CheckpointView,Qo as CurrentCheckpointView,Uo as ForwardCheckpointsView,Eo as IndexView,Fo as LinkedRowsView,Do as LocalRowsView,jo as MetricView,Po as Provider,Ao as RemoteRowView,zo as ResultCellView,Go as ResultRowView,Jo as ResultSortedTableView,Ho as ResultTableView,xo as RowView,Mo as SliceView,Vo as SortedTableView,So as TableView,Oo as TablesView,Bo as ValueView,Lo as ValuesView,Co as tableView,Z as useAddRowCallback,K as useCell,J as useCellIds,ve as useCellIdsListener,ge as useCellListener,Ye as useCheckpoint,Xe as useCheckpointIds,ro as useCheckpointIdsListener,lo as useCheckpointListener,R as useCheckpoints,We as useCreateCheckpoints,he as useCreateIndexes,me as useCreateMetrics,so as useCreatePersister,Me as useCreateQueries,xe as useCreateRelationships,E as useCreateStore,se as useDelCellCallback,de as useDelRowCallback,le as useDelTableCallback,re as useDelTablesCallback,ue as useDelValueCallback,ne as useDelValuesCallback,$e as useGoBackwardCallback,_e as useGoForwardCallback,eo as useGoToCallback,v as useIndexes,Oe as useLinkedRowIds,je as useLinkedRowIdsListener,Ve as useLocalRowIds,Le as useLocalRowIdsListener,ye as useMetric,ke as useMetricListener,b as useMetrics,w as useQueries,to as useRedoInformation,g as useRelationships,Se as useRemoteRowId,Be as useRemoteRowIdListener,Ge as useResultCell,ze as useResultCellIds,Qe as useResultCellIdsListener,Ue as useResultCellListener,Fe as useResultRow,Ae as useResultRowIds,Je as useResultRowIdsListener,Ne as useResultRowListener,De as useResultSortedRowIds,Ke as useResultSortedRowIdsListener,Ee as useResultTable,He as useResultTableListener,H as useRow,z as useRowIds,ce as useRowIdsListener,be as useRowListener,_ as useSetCellCallback,Ze as useSetCheckpointCallback,$ as useSetPartialRowCallback,oe as useSetPartialValuesCallback,Y as useSetRowCallback,X as useSetTableCallback,W as useSetTablesCallback,te as useSetValueCallback,ee as useSetValuesCallback,fe as useSliceIds,Te as useSliceIdsListener,Pe as useSliceRowIds,qe as useSliceRowIdsListener,G as useSortedRowIds,pe as useSortedRowIdsListener,p as useStore,F as useTable,D as useTableIds,ie as useTableIdsListener,Ie as useTableListener,A as useTables,ae as useTablesListener,oo as useUndoInformation,U as useValue,Q as useValueIds,Re as useValueIdsListener,Ce as useValueListener,N as useValues,we as useValuesListener};
|
|
1
|
+
import e,{useContext as o}from"react";const t=e=>typeof e,r=t(""),l=(e,o)=>e.map(o),d=e=>null==e,s=(e,o,t)=>d(e)?null==t?void 0:t():o(e),n=e=>t(e)==r,u=()=>{},{createContext:a,useContext:i}=e,I=a([]),c=(e,o)=>{const t=i(I);return d(e)?t[o]:n(e)?((e,o)=>s(e,(e=>e[o])))(t[o+1],e):e},p=(e,o)=>{const t=c(e,o);return d(e)||n(e)?t:e},b=e=>c(e,0),v=e=>c(e,2),g=e=>c(e,4),w=e=>c(e,6),R=e=>c(e,8),C=e=>c(e,10),m=e=>p(e,0),y=e=>p(e,2),k=e=>p(e,4),h=e=>p(e,6),f=e=>p(e,8),P=e=>p(e,10),{useCallback:T,useEffect:q,useMemo:x,useRef:S,useState:V}=e,O=(e,o,t=[])=>{const r=x((()=>o(e)),[e,...t]);return q((()=>()=>r.destroy()),[r]),r},B=(e,o,t,r=[],l)=>{const[,s]=V(),n=T((()=>{var l,d;return null!=(d=null==(l=null==o?void 0:o["get"+e])?void 0:l.call(o,...r))?d:t}),[o,...r]),[u]=V(n),a=S(u);return x((()=>a.current=n()),[n]),L(e,o,((...e)=>{a.current=d(l)?n():e[l],s([])}),[],r),a.current},L=(e,o,t,r=[],l=[],...d)=>q((()=>{var r;const s=null==(r=null==o?void 0:o["add"+e+"Listener"])?void 0:r.call(o,...l,t,...d);return()=>null==o?void 0:o.delListener(s)}),[o,...l,...r,...d]),j=(e,o,t,r=[],l=u,d=[],...n)=>{const a=m(e);return T((e=>s(a,(r=>s(t(e,r),(e=>l(r["set"+o](...n,e),e)))))),[a,o,...r,...d,...n])},M=(e,o,t=u,r=[],...l)=>{const d=m(e);return T((()=>t(null==d?void 0:d["del"+o](...l))),[d,o,...r,...l])},E=(e,o,t)=>{const r=P(e);return T((()=>null==r?void 0:r[o](t)),[r,o,t])},A=(e,o=[])=>x(e,o),D=e=>B("Tables",m(e),{}),F=e=>B("TableIds",m(e),[],[]),z=(e,o)=>B("Table",m(o),{},[e]),G=(e,o)=>B("RowIds",m(o),[],[e]),H=(e,o,t,r=0,l,d)=>B("SortedRowIds",m(d),[],[e,o,t,r,l],6),J=(e,o,t)=>B("Row",m(t),{},[e,o]),K=(e,o,t)=>B("CellIds",m(t),[],[e,o]),N=(e,o,t,r)=>B("Cell",m(r),void 0,[e,o,t],4),Q=e=>B("Values",m(e),{}),U=e=>B("ValueIds",m(e),[],[]),W=(e,o)=>B("Value",m(o),void 0,[e]),X=(e,o,t,r,l)=>j(t,"Tables",e,o,r,l),Y=(e,o,t,r,l,d)=>j(r,"Table",o,t,l,d,e),Z=(e,o,t,r,l,d,s)=>j(l,"Row",t,r,d,s,e,o),$=(e,o,t=[],r,l=u,d=[])=>{const n=m(r);return T((t=>s(n,(r=>s(o(t,r),(o=>l(r.addRow(e,o),r,o)))))),[n,e,...t,...d])},_=(e,o,t,r,l,d,s)=>j(l,"PartialRow",t,r,d,s,e,o),ee=(e,o,t,r,l,d,s,n)=>j(d,"Cell",r,l,s,n,e,o,t),oe=(e,o,t,r,l)=>j(t,"Values",e,o,r,l),te=(e,o,t,r,l)=>j(t,"PartialValues",e,o,r,l),re=(e,o,t,r,l,d)=>j(r,"Value",o,t,l,d,e),le=(e,o,t)=>M(e,"Tables",o,t),de=(e,o,t,r)=>M(o,"Table",t,r,e),se=(e,o,t,r,l)=>M(t,"Row",r,l,e,o),ne=(e,o,t,r,l,d,s)=>M(l,"Cell",d,s,e,o,t,r),ue=(e,o,t)=>M(e,"Values",o,t),ae=(e,o,t,r)=>M(o,"Value",t,r,e),ie=(e,o,t,r)=>L("Tables",m(r),e,o,[],t),Ie=(e,o,t,r)=>L("TableIds",m(r),e,o,[],t),ce=(e,o,t,r,l)=>L("Table",m(l),o,t,[e],r),pe=(e,o,t,r,l)=>L("RowIds",m(l),o,t,[e],r),be=(e,o,t,r,l,d,s,n,u)=>L("SortedRowIds",m(u),d,s,[e,o,t,r,l],n),ve=(e,o,t,r,l,d)=>L("Row",m(d),t,r,[e,o],l),ge=(e,o,t,r,l,d)=>L("CellIds",m(d),t,r,[e,o],l),we=(e,o,t,r,l,d,s)=>L("Cell",m(s),r,l,[e,o,t],d),Re=(e,o,t,r)=>L("Values",m(r),e,o,[],t),Ce=(e,o,t,r)=>L("ValueIds",m(r),e,o,[],t),me=(e,o,t,r,l)=>L("Value",m(l),o,t,[e],r),ye=(e,o,t)=>O(e,o,t),ke=(e,o)=>B("Metric",y(o),void 0,[e]),he=(e,o,t,r)=>L("Metric",y(r),o,t,[e]),fe=(e,o,t)=>O(e,o,t),Pe=(e,o)=>B("SliceIds",k(o),[],[e]),Te=(e,o,t)=>B("SliceRowIds",k(t),[],[e,o]),qe=(e,o,t,r)=>L("SliceIds",k(r),o,t,[e]),xe=(e,o,t,r,l)=>L("SliceRowIds",k(l),t,r,[e,o]),Se=(e,o,t)=>O(e,o,t),Ve=(e,o,t)=>B("RemoteRowId",h(t),void 0,[e,o]),Oe=(e,o,t)=>B("LocalRowIds",h(t),[],[e,o]),Be=(e,o,t)=>B("LinkedRowIds",h(t),[],[e,o]),Le=(e,o,t,r,l)=>L("RemoteRowId",h(l),t,r,[e,o]),je=(e,o,t,r,l)=>L("LocalRowIds",h(l),t,r,[e,o]),Me=(e,o,t,r,l)=>L("LinkedRowIds",h(l),t,r,[e,o]),Ee=(e,o,t)=>O(e,o,t),Ae=(e,o)=>B("ResultTable",f(o),{},[e]),De=(e,o)=>B("ResultRowIds",f(o),[],[e]),Fe=(e,o,t,r=0,l,d)=>B("ResultSortedRowIds",f(d),[],[e,o,t,r,l],6),ze=(e,o,t)=>B("ResultRow",f(t),{},[e,o]),Ge=(e,o,t)=>B("ResultCellIds",f(t),[],[e,o]),He=(e,o,t,r)=>B("ResultCell",f(r),void 0,[e,o,t]),Je=(e,o,t,r)=>L("ResultTable",f(r),o,t,[e]),Ke=(e,o,t,r)=>L("ResultRowIds",f(r),o,t,[e]),Ne=(e,o,t,r,l,d,s,n)=>L("ResultSortedRowIds",f(n),d,s,[e,o,t,r,l]),Qe=(e,o,t,r,l)=>L("ResultRow",f(l),t,r,[e,o]),Ue=(e,o,t,r,l)=>L("ResultCellIds",f(l),t,r,[e,o]),We=(e,o,t,r,l,d)=>L("ResultCell",f(d),r,l,[e,o,t]),Xe=(e,o,t)=>O(e,o,t),Ye=e=>B("CheckpointIds",P(e),[[],void 0,[]]),Ze=(e,o)=>B("Checkpoint",P(o),void 0,[e]),$e=(e=u,o=[],t,r=u,l=[])=>{const d=P(t);return T((o=>s(d,(t=>{const l=e(o);r(t.addCheckpoint(l),t,l)}))),[d,...o,...l])},_e=e=>E(e,"goBackward"),eo=e=>E(e,"goForward"),oo=(e,o=[],t,r=u,l=[])=>{const d=P(t);return T((o=>s(d,(t=>s(e(o),(e=>r(t.goTo(e),e)))))),[d,...o,...l])},to=e=>{var o;const t=P(e),[r,l]=Ye(t);return[(d=r,!(0==(e=>e.length)(d))),_e(t),l,null!=(o=s(l,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""];var d},ro=e=>{var o;const t=P(e),[,,[r]]=Ye(t);return[!d(r),eo(t),r,null!=(o=s(r,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""]},lo=(e,o,t)=>L("CheckpointIds",P(t),e,o),so=(e,o,t,r)=>L("Checkpoint",P(r),o,t,[e]),no=(e,o,t=[],r,l=[])=>{const[,d]=V(),s=x((()=>o(e)),[e,...t]);return q((()=>{var e;return e=function*(){yield null==r?void 0:r(s),d(1)},new Promise(((o,t)=>{var r=o=>{try{d(e.next(o))}catch(e){t(e)}},l=o=>{try{d(e.throw(o))}catch(e){t(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,l);d((e=e.apply(void 0,null)).next())})),()=>{s.destroy()}}),[s,...l]),s};var uo=Object.defineProperty,ao=Object.defineProperties,io=Object.getOwnPropertyDescriptors,Io=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,bo=(e,o,t)=>o in e?uo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,vo=(e,o)=>{for(var t in o||(o={}))co.call(o,t)&&bo(e,t,o[t]);if(Io)for(var t of Io(o))po.call(o,t)&&bo(e,t,o[t]);return e},go=(e,o)=>ao(e,io(o)),wo=(e,o)=>{var t={};for(var r in e)co.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&Io)for(var r of Io(e))o.indexOf(r)<0&&po.call(e,r)&&(t[r]=e[r]);return t};const{createElement:Ro,useMemo:Co}=e,mo=({tableId:e,store:o,rowComponent:t=So,getRowComponentProps:r,separator:d,debugIds:s},n)=>qo(l(n,(l=>Ro(t,go(vo({},Po(r,l)),{key:l,tableId:e,rowId:l,store:o,debugIds:s})))),d,s,e),yo=({queryId:e,queries:o,resultRowComponent:t=Ho,getResultRowComponentProps:r,separator:d,debugIds:s},n)=>qo(l(n,(l=>Ro(t,go(vo({},Po(r,l)),{key:l,queryId:e,rowId:l,queries:o,debugIds:s})))),d,s,e),ko=e=>{const o=h(e);return[o,null==o?void 0:o.getStore()]},ho=({relationshipId:e,relationships:o,rowComponent:t=So,getRowComponentProps:r,separator:d,debugIds:s},n,u)=>{const[a,i]=ko(o),I=null==a?void 0:a.getLocalTableId(e),c=n(e,u,a);return qo(l(c,(e=>Ro(t,go(vo({},Po(r,e)),{key:e,tableId:I,rowId:e,store:i,debugIds:s})))),d,s,u)},fo=e=>({checkpoints:o,checkpointComponent:t=No,getCheckpointComponentProps:r,separator:d,debugIds:s})=>{const n=P(o);return qo(l(e(Ye(n)),(e=>Ro(t,go(vo({},Po(r,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:s})))),d)},Po=(e,o)=>d(e)?{}:e(o),To=({store:e,storesById:t,metrics:r,metricsById:l,indexes:d,indexesById:s,relationships:n,relationshipsById:u,queries:a,queriesById:i,checkpoints:c,checkpointsById:p,children:b})=>{const v=o(I);return Ro(I.Provider,{value:Co((()=>[null!=e?e:v[0],vo(vo({},v[1]),t),null!=r?r:v[2],vo(vo({},v[3]),l),null!=d?d:v[4],vo(vo({},v[5]),s),null!=n?n:v[6],vo(vo({},v[7]),u),null!=a?a:v[8],vo(vo({},v[9]),i),null!=c?c:v[10],vo(vo({},v[11]),p)]),[e,t,r,l,d,s,n,u,a,i,c,p,v])},b)},qo=(e,o,t,r)=>{const s=d(o)||!Array.isArray(e)?e:l(e,((e,t)=>t>0?[o,e]:e));return t?[r,":{",s,"}"]:s},xo=({tableId:e,rowId:o,cellId:t,store:r,debugIds:l})=>{var d;return qo(""+(null!=(d=N(e,o,t,r))?d:""),void 0,l,t)},So=({tableId:e,rowId:o,store:t,cellComponent:r=xo,getCellComponentProps:d,separator:s,debugIds:n})=>qo(l(K(e,o,t),(l=>Ro(r,go(vo({},Po(d,l)),{key:l,tableId:e,rowId:o,cellId:l,store:t,debugIds:n})))),s,n,o),Vo=e=>mo(e,G(e.tableId,e.store)),Oo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=wo(o,["cellId","descending","offset","limit"]);return mo(s,H(s.tableId,t,r,l,d,s.store))},Bo=({store:e,tableComponent:o=Vo,getTableComponentProps:t,separator:r,debugIds:d})=>qo(l(F(e),(r=>Ro(o,go(vo({},Po(t,r)),{key:r,tableId:r,store:e,debugIds:d})))),r),Lo=({valueId:e,store:o,debugIds:t})=>{var r;return qo(""+(null!=(r=W(e,o))?r:""),void 0,t,e)},jo=({store:e,valueComponent:o=Lo,getValueComponentProps:t,separator:r,debugIds:d})=>qo(l(U(e),(r=>Ro(o,go(vo({},Po(t,r)),{key:r,valueId:r,store:e,debugIds:d})))),r),Mo=({metricId:e,metrics:o,debugIds:t})=>{var r;return qo(null!=(r=ke(e,o))?r:"",void 0,t,e)},Eo=({indexId:e,sliceId:o,indexes:t,rowComponent:r=So,getRowComponentProps:d,separator:s,debugIds:n})=>{const u=k(t),a=null==u?void 0:u.getStore(),i=null==u?void 0:u.getTableId(e),I=Te(e,o,u);return qo(l(I,(e=>Ro(r,go(vo({},Po(d,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:n})))),s,n,o)},Ao=({indexId:e,indexes:o,sliceComponent:t=Eo,getSliceComponentProps:r,separator:d,debugIds:s})=>qo(l(Pe(e,o),(l=>Ro(t,go(vo({},Po(r,l)),{key:l,indexId:e,sliceId:l,indexes:o,debugIds:s})))),d,s,e),Do=({relationshipId:e,localRowId:o,relationships:t,rowComponent:r=So,getRowComponentProps:l,debugIds:s})=>{const[n,u]=ko(t),a=null==n?void 0:n.getRemoteTableId(e),i=Ve(e,o,n);return qo(d(a)||d(i)?null:Ro(r,go(vo({},Po(l,i)),{key:i,tableId:a,rowId:i,store:u,debugIds:s})),void 0,s,o)},Fo=e=>ho(e,Oe,e.remoteRowId),zo=e=>ho(e,Be,e.firstRowId),Go=({queryId:e,rowId:o,cellId:t,queries:r,debugIds:l})=>{var d;return qo(""+(null!=(d=He(e,o,t,r))?d:""),void 0,l,t)},Ho=({queryId:e,rowId:o,queries:t,resultCellComponent:r=Go,getResultCellComponentProps:d,separator:s,debugIds:n})=>qo(l(Ge(e,o,t),(l=>Ro(r,go(vo({},Po(d,l)),{key:l,queryId:e,rowId:o,cellId:l,queries:t,debugIds:n})))),s,n,o),Jo=e=>yo(e,De(e.queryId,e.queries)),Ko=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=wo(o,["cellId","descending","offset","limit"]);return yo(s,Fe(s.queryId,t,r,l,d,s.queries))},No=({checkpoints:e,checkpointId:o,debugIds:t})=>{var r;return qo(null!=(r=Ze(o,e))?r:"",void 0,t,o)},Qo=fo((e=>e[0])),Uo=fo((e=>d(e[1])?[]:[e[1]])),Wo=fo((e=>e[2]));export{Qo as BackwardCheckpointsView,xo as CellView,No as CheckpointView,Uo as CurrentCheckpointView,Wo as ForwardCheckpointsView,Ao as IndexView,zo as LinkedRowsView,Fo as LocalRowsView,Mo as MetricView,To as Provider,Do as RemoteRowView,Go as ResultCellView,Ho as ResultRowView,Ko as ResultSortedTableView,Jo as ResultTableView,So as RowView,Eo as SliceView,Oo as SortedTableView,Vo as TableView,Bo as TablesView,Lo as ValueView,jo as ValuesView,mo as tableView,$ as useAddRowCallback,N as useCell,K as useCellIds,ge as useCellIdsListener,we as useCellListener,Ze as useCheckpoint,Ye as useCheckpointIds,lo as useCheckpointIdsListener,so as useCheckpointListener,C as useCheckpoints,Xe as useCreateCheckpoints,fe as useCreateIndexes,ye as useCreateMetrics,no as useCreatePersister,Ee as useCreateQueries,Se as useCreateRelationships,A as useCreateStore,ne as useDelCellCallback,se as useDelRowCallback,de as useDelTableCallback,le as useDelTablesCallback,ae as useDelValueCallback,ue as useDelValuesCallback,_e as useGoBackwardCallback,eo as useGoForwardCallback,oo as useGoToCallback,g as useIndexes,Be as useLinkedRowIds,Me as useLinkedRowIdsListener,Oe as useLocalRowIds,je as useLocalRowIdsListener,ke as useMetric,he as useMetricListener,v as useMetrics,R as useQueries,ro as useRedoInformation,w as useRelationships,Ve as useRemoteRowId,Le as useRemoteRowIdListener,He as useResultCell,Ge as useResultCellIds,Ue as useResultCellIdsListener,We as useResultCellListener,ze as useResultRow,De as useResultRowIds,Ke as useResultRowIdsListener,Qe as useResultRowListener,Fe as useResultSortedRowIds,Ne as useResultSortedRowIdsListener,Ae as useResultTable,Je as useResultTableListener,J as useRow,G as useRowIds,pe as useRowIdsListener,ve as useRowListener,ee as useSetCellCallback,$e as useSetCheckpointCallback,_ as useSetPartialRowCallback,te as useSetPartialValuesCallback,Z as useSetRowCallback,Y as useSetTableCallback,X as useSetTablesCallback,re as useSetValueCallback,oe as useSetValuesCallback,Pe as useSliceIds,qe as useSliceIdsListener,Te as useSliceRowIds,xe as useSliceRowIdsListener,H as useSortedRowIds,be as useSortedRowIdsListener,b as useStore,z as useTable,F as useTableIds,Ie as useTableIdsListener,ce as useTableListener,D as useTables,ie as useTablesListener,to as useUndoInformation,W as useValue,U as useValueIds,Ce as useValueIdsListener,me as useValueListener,Q as useValues,Re as useValuesListener};
|
package/lib/es6/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as o}from"react";const t=e=>typeof e,s=t(""),d=(e,o)=>e.map(o),r=e=>null==e,n=(e,o,t)=>r(e)?t?.():o(e),l=()=>{},{createContext:I,useContext:u}=e,a=I([]),i=(e,o)=>{const t=u(a);return r(e)?t[o]:((e,o)=>n(e,(e=>e[o])))(t[o+1],e)},c=(e,o)=>{const d=i(e,o);return r(e)||(e=>t(e)==s)(e)?d:e},p=e=>i(e,0),b=e=>i(e,2),g=e=>i(e,4),w=e=>i(e,6),R=e=>i(e,8),C=e=>i(e,10),m=e=>c(e,0),k=e=>c(e,2),y=e=>c(e,4),h=e=>c(e,6),v=e=>c(e,8),T=e=>c(e,10),{useCallback:q,useEffect:P,useMemo:x,useRef:S,useState:V}=e,f=(e,o,t=[])=>{const s=x((()=>o(e)),[e,...t]);return P((()=>()=>s.destroy()),[s]),s},B=(e,o,t,s=[],d)=>{const[,n]=V(),l=q((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[I]=V(l),u=S(I);return x((()=>u.current=l()),[l]),L(e,o,((...e)=>{u.current=r(d)?l():e[d],n([])}),[],s),u.current},L=(e,o,t,s=[],d=[],...r)=>P((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),M=(e,o,t,s=[],d=l,r=[],...I)=>{const u=m(e);return q((e=>n(u,(s=>n(t(e,s),(e=>d(s["set"+o](...I,e),e)))))),[u,o,...s,...r,...I])},A=(e,o,t=l,s=[],...d)=>{const r=m(e);return q((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},E=(e,o,t)=>{const s=T(e);return q((()=>s?.[o](t)),[s,o,t])},F=(e,o=[])=>x(e,o),j=e=>B("Tables",m(e),{}),z=e=>B("TableIds",m(e),[],[]),D=(e,o)=>B("Table",m(o),{},[e]),G=(e,o)=>B("RowIds",m(o),[],[e]),H=(e,o,t,s=0,d,r)=>B("SortedRowIds",m(r),[],[e,o,t,s,d],6),J=(e,o,t)=>B("Row",m(t),{},[e,o]),K=(e,o,t)=>B("CellIds",m(t),[],[e,o]),N=(e,o,t,s)=>B("Cell",m(s),void 0,[e,o,t],4),O=e=>B("Values",m(e),{}),Q=e=>B("ValueIds",m(e),[],[]),U=(e,o)=>B("Value",m(o),void 0,[e]),W=(e,o,t,s,d)=>M(t,"Tables",e,o,s,d),X=(e,o,t,s,d,r)=>M(s,"Table",o,t,d,r,e),Y=(e,o,t,s,d,r,n)=>M(d,"Row",t,s,r,n,e,o),Z=(e,o,t=[],s,d=l,r=[])=>{const I=m(s);return q((t=>n(I,(s=>n(o(t,s),(o=>d(s.addRow(e,o),s,o)))))),[I,e,...t,...r])},$=(e,o,t,s,d,r,n)=>M(d,"PartialRow",t,s,r,n,e,o),_=(e,o,t,s,d,r,n,l)=>M(r,"Cell",s,d,n,l,e,o,t),ee=(e,o,t,s,d)=>M(t,"Values",e,o,s,d),oe=(e,o,t,s,d)=>M(t,"PartialValues",e,o,s,d),te=(e,o,t,s,d,r)=>M(s,"Value",o,t,d,r,e),se=(e,o,t)=>A(e,"Tables",o,t),de=(e,o,t,s)=>A(o,"Table",t,s,e),re=(e,o,t,s,d)=>A(t,"Row",s,d,e,o),ne=(e,o,t,s,d,r,n)=>A(d,"Cell",r,n,e,o,t,s),le=(e,o,t)=>A(e,"Values",o,t),Ie=(e,o,t,s)=>A(o,"Value",t,s,e),ue=(e,o,t,s)=>L("Tables",m(s),e,o,[],t),ae=(e,o,t,s)=>L("TableIds",m(s),e,o,[],t),ie=(e,o,t,s,d)=>L("Table",m(d),o,t,[e],s),ce=(e,o,t,s,d)=>L("RowIds",m(d),o,t,[e],s),pe=(e,o,t,s,d,r,n,l,I)=>L("SortedRowIds",m(I),r,n,[e,o,t,s,d],l),be=(e,o,t,s,d,r)=>L("Row",m(r),t,s,[e,o],d),ge=(e,o,t,s,d,r)=>L("CellIds",m(r),t,s,[e,o],d),we=(e,o,t,s,d,r,n)=>L("Cell",m(n),s,d,[e,o,t],r),Re=(e,o,t,s)=>L("Values",m(s),e,o,[],t),Ce=(e,o,t,s)=>L("ValueIds",m(s),e,o,[],t),me=(e,o,t,s,d)=>L("Value",m(d),o,t,[e],s),ke=(e,o,t)=>f(e,o,t),ye=(e,o)=>B("Metric",k(o),void 0,[e]),he=(e,o,t,s)=>L("Metric",k(s),o,t,[e]),ve=(e,o,t)=>f(e,o,t),Te=(e,o)=>B("SliceIds",y(o),[],[e]),qe=(e,o,t)=>B("SliceRowIds",y(t),[],[e,o]),Pe=(e,o,t,s)=>L("SliceIds",y(s),o,t,[e]),xe=(e,o,t,s,d)=>L("SliceRowIds",y(d),t,s,[e,o]),Se=(e,o,t)=>f(e,o,t),Ve=(e,o,t)=>B("RemoteRowId",h(t),void 0,[e,o]),fe=(e,o,t)=>B("LocalRowIds",h(t),[],[e,o]),Be=(e,o,t)=>B("LinkedRowIds",h(t),[],[e,o]),Le=(e,o,t,s,d)=>L("RemoteRowId",h(d),t,s,[e,o]),Me=(e,o,t,s,d)=>L("LocalRowIds",h(d),t,s,[e,o]),Ae=(e,o,t,s,d)=>L("LinkedRowIds",h(d),t,s,[e,o]),Ee=(e,o,t)=>f(e,o,t),Fe=(e,o)=>B("ResultTable",v(o),{},[e]),je=(e,o)=>B("ResultRowIds",v(o),[],[e]),ze=(e,o,t,s=0,d,r)=>B("ResultSortedRowIds",v(r),[],[e,o,t,s,d],6),De=(e,o,t)=>B("ResultRow",v(t),{},[e,o]),Ge=(e,o,t)=>B("ResultCellIds",v(t),[],[e,o]),He=(e,o,t,s)=>B("ResultCell",v(s),void 0,[e,o,t]),Je=(e,o,t,s)=>L("ResultTable",v(s),o,t,[e]),Ke=(e,o,t,s)=>L("ResultRowIds",v(s),o,t,[e]),Ne=(e,o,t,s,d,r,n,l)=>L("ResultSortedRowIds",v(l),r,n,[e,o,t,s,d]),Oe=(e,o,t,s,d)=>L("ResultRow",v(d),t,s,[e,o]),Qe=(e,o,t,s,d)=>L("ResultCellIds",v(d),t,s,[e,o]),Ue=(e,o,t,s,d,r)=>L("ResultCell",v(r),s,d,[e,o,t]),We=(e,o,t)=>f(e,o,t),Xe=e=>B("CheckpointIds",T(e),[[],void 0,[]]),Ye=(e,o)=>B("Checkpoint",T(o),void 0,[e]),Ze=(e=l,o=[],t,s=l,d=[])=>{const r=T(t);return q((o=>n(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},$e=e=>E(e,"goBackward"),_e=e=>E(e,"goForward"),eo=(e,o=[],t,s=l,d=[])=>{const r=T(t);return q((o=>n(r,(t=>n(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},oo=e=>{const o=T(e),[t,s]=Xe(o);return[(d=t,!(0==(e=>e.length)(d))),$e(o),s,n(s,(e=>o?.getCheckpoint(e)))??""];var d},to=e=>{const o=T(e),[,,[t]]=Xe(o);return[!r(t),_e(o),t,n(t,(e=>o?.getCheckpoint(e)))??""]},so=(e,o,t)=>L("CheckpointIds",T(t),e,o),ro=(e,o,t,s)=>L("Checkpoint",T(s),o,t,[e]),no=(e,o,t=[],s,d=[])=>{const[,r]=V(),n=x((()=>o(e)),[e,...t]);return P((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:lo,useMemo:Io}=e,uo=({tableId:e,store:o,rowComponent:t=Co,getRowComponentProps:s,separator:r,debugIds:n},l)=>wo(d(l,(d=>lo(t,{...bo(s,d),key:d,tableId:e,rowId:d,store:o,debugIds:n}))),r,n,e),ao=({queryId:e,queries:o,resultRowComponent:t=Bo,getResultRowComponentProps:s,separator:r,debugIds:n},l)=>wo(d(l,(d=>lo(t,{...bo(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:n}))),r,n,e),io=e=>{const o=h(e);return[o,o?.getStore()]},co=({relationshipId:e,relationships:o,rowComponent:t=Co,getRowComponentProps:s,separator:r,debugIds:n},l,I)=>{const[u,a]=io(o),i=u?.getLocalTableId(e),c=l(e,I,u);return wo(d(c,(e=>lo(t,{...bo(s,e),key:e,tableId:i,rowId:e,store:a,debugIds:n}))),r,n,I)},po=e=>({checkpoints:o,checkpointComponent:t=Ao,getCheckpointComponentProps:s,separator:r,debugIds:n})=>{const l=T(o);return wo(d(e(Xe(l)),(e=>lo(t,{...bo(s,e),key:e,checkpoints:l,checkpointId:e,debugIds:n}))),r)},bo=(e,o)=>r(e)?{}:e(o),go=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:i,checkpoints:c,checkpointsById:p,children:b})=>{const g=o(a);return lo(a.Provider,{value:Io((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...i},c??g[10],{...g[11],...p}]),[e,t,s,d,r,n,l,I,u,i,c,p,g])},b)},wo=(e,o,t,s)=>{const n=r(o)||!Array.isArray(e)?e:d(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",n,"}"]:n},Ro=({tableId:e,rowId:o,cellId:t,store:s,debugIds:d})=>wo(""+(N(e,o,t,s)??""),void 0,d,t),Co=({tableId:e,rowId:o,store:t,cellComponent:s=Ro,getCellComponentProps:r,separator:n,debugIds:l})=>wo(d(K(e,o,t),(d=>lo(s,{...bo(r,d),key:d,tableId:e,rowId:o,cellId:d,store:t,debugIds:l}))),n,l,o),mo=e=>uo(e,G(e.tableId,e.store)),ko=({cellId:e,descending:o,offset:t,limit:s,...d})=>uo(d,H(d.tableId,e,o,t,s,d.store)),yo=({store:e,tableComponent:o=mo,getTableComponentProps:t,separator:s,debugIds:r})=>wo(d(z(e),(s=>lo(o,{...bo(t,s),key:s,tableId:s,store:e,debugIds:r}))),s),ho=({valueId:e,store:o,debugIds:t})=>wo(""+(U(e,o)??""),void 0,t,e),vo=({store:e,valueComponent:o=ho,getValueComponentProps:t,separator:s,debugIds:r})=>wo(d(Q(e),(s=>lo(o,{...bo(t,s),key:s,valueId:s,store:e,debugIds:r}))),s),To=({metricId:e,metrics:o,debugIds:t})=>wo(ye(e,o)??"",void 0,t,e),qo=({indexId:e,sliceId:o,indexes:t,rowComponent:s=Co,getRowComponentProps:r,separator:n,debugIds:l})=>{const I=y(t),u=I?.getStore(),a=I?.getTableId(e),i=qe(e,o,I);return wo(d(i,(e=>lo(s,{...bo(r,e),key:e,tableId:a,rowId:e,store:u,debugIds:l}))),n,l,o)},Po=({indexId:e,indexes:o,sliceComponent:t=qo,getSliceComponentProps:s,separator:r,debugIds:n})=>wo(d(Te(e,o),(d=>lo(t,{...bo(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:n}))),r,n,e),xo=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=Co,getRowComponentProps:d,debugIds:n})=>{const[l,I]=io(t),u=l?.getRemoteTableId(e),a=Ve(e,o,l);return wo(r(u)||r(a)?null:lo(s,{...bo(d,a),key:a,tableId:u,rowId:a,store:I,debugIds:n}),void 0,n,o)},So=e=>co(e,fe,e.remoteRowId),Vo=e=>co(e,Be,e.firstRowId),fo=({queryId:e,rowId:o,cellId:t,queries:s,debugIds:d})=>wo(""+(He(e,o,t,s)??""),void 0,d,t),Bo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=fo,getResultCellComponentProps:r,separator:n,debugIds:l})=>wo(d(Ge(e,o,t),(d=>lo(s,{...bo(r,d),key:d,queryId:e,rowId:o,cellId:d,queries:t,debugIds:l}))),n,l,o),Lo=e=>ao(e,je(e.queryId,e.queries)),Mo=({cellId:e,descending:o,offset:t,limit:s,...d})=>ao(d,ze(d.queryId,e,o,t,s,d.queries)),Ao=({checkpoints:e,checkpointId:o,debugIds:t})=>wo(Ye(o,e)??"",void 0,t,o),Eo=po((e=>e[0])),Fo=po((e=>r(e[1])?[]:[e[1]])),jo=po((e=>e[2]));export{Eo as BackwardCheckpointsView,Ro as CellView,Ao as CheckpointView,Fo as CurrentCheckpointView,jo as ForwardCheckpointsView,Po as IndexView,Vo as LinkedRowsView,So as LocalRowsView,To as MetricView,go as Provider,xo as RemoteRowView,fo as ResultCellView,Bo as ResultRowView,Mo as ResultSortedTableView,Lo as ResultTableView,Co as RowView,qo as SliceView,ko as SortedTableView,mo as TableView,yo as TablesView,ho as ValueView,vo as ValuesView,uo as tableView,Z as useAddRowCallback,N as useCell,K as useCellIds,ge as useCellIdsListener,we as useCellListener,Ye as useCheckpoint,Xe as useCheckpointIds,so as useCheckpointIdsListener,ro as useCheckpointListener,C as useCheckpoints,We as useCreateCheckpoints,ve as useCreateIndexes,ke as useCreateMetrics,no as useCreatePersister,Ee as useCreateQueries,Se as useCreateRelationships,F as useCreateStore,ne as useDelCellCallback,re as useDelRowCallback,de as useDelTableCallback,se as useDelTablesCallback,Ie as useDelValueCallback,le as useDelValuesCallback,$e as useGoBackwardCallback,_e as useGoForwardCallback,eo as useGoToCallback,g as useIndexes,Be as useLinkedRowIds,Ae as useLinkedRowIdsListener,fe as useLocalRowIds,Me as useLocalRowIdsListener,ye as useMetric,he as useMetricListener,b as useMetrics,R as useQueries,to as useRedoInformation,w as useRelationships,Ve as useRemoteRowId,Le as useRemoteRowIdListener,He as useResultCell,Ge as useResultCellIds,Qe as useResultCellIdsListener,Ue as useResultCellListener,De as useResultRow,je as useResultRowIds,Ke as useResultRowIdsListener,Oe as useResultRowListener,ze as useResultSortedRowIds,Ne as useResultSortedRowIdsListener,Fe as useResultTable,Je as useResultTableListener,J as useRow,G as useRowIds,ce as useRowIdsListener,be as useRowListener,_ as useSetCellCallback,Ze as useSetCheckpointCallback,$ as useSetPartialRowCallback,oe as useSetPartialValuesCallback,Y as useSetRowCallback,X as useSetTableCallback,W as useSetTablesCallback,te as useSetValueCallback,ee as useSetValuesCallback,Te as useSliceIds,Pe as useSliceIdsListener,qe as useSliceRowIds,xe as useSliceRowIdsListener,H as useSortedRowIds,pe as useSortedRowIdsListener,p as useStore,D as useTable,z as useTableIds,ae as useTableIdsListener,ie as useTableListener,j as useTables,ue as useTablesListener,oo as useUndoInformation,U as useValue,Q as useValueIds,Ce as useValueIdsListener,me as useValueListener,O as useValues,Re as useValuesListener};
|
|
1
|
+
import e,{useContext as o}from"react";const t=e=>typeof e,s=t(""),d=(e,o)=>e.map(o),r=e=>null==e,n=(e,o,t)=>r(e)?t?.():o(e),l=e=>t(e)==s,I=()=>{},{createContext:u,useContext:a}=e,i=u([]),c=(e,o)=>{const t=a(i);return r(e)?t[o]:l(e)?((e,o)=>n(e,(e=>e[o])))(t[o+1],e):e},p=(e,o)=>{const t=c(e,o);return r(e)||l(e)?t:e},b=e=>c(e,0),g=e=>c(e,2),w=e=>c(e,4),R=e=>c(e,6),C=e=>c(e,8),m=e=>c(e,10),k=e=>p(e,0),y=e=>p(e,2),h=e=>p(e,4),v=e=>p(e,6),T=e=>p(e,8),q=e=>p(e,10),{useCallback:P,useEffect:x,useMemo:S,useRef:V,useState:f}=e,B=(e,o,t=[])=>{const s=S((()=>o(e)),[e,...t]);return x((()=>()=>s.destroy()),[s]),s},L=(e,o,t,s=[],d)=>{const[,n]=f(),l=P((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[I]=f(l),u=V(I);return S((()=>u.current=l()),[l]),M(e,o,((...e)=>{u.current=r(d)?l():e[d],n([])}),[],s),u.current},M=(e,o,t,s=[],d=[],...r)=>x((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),A=(e,o,t,s=[],d=I,r=[],...l)=>{const u=k(e);return P((e=>n(u,(s=>n(t(e,s),(e=>d(s["set"+o](...l,e),e)))))),[u,o,...s,...r,...l])},E=(e,o,t=I,s=[],...d)=>{const r=k(e);return P((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},F=(e,o,t)=>{const s=q(e);return P((()=>s?.[o](t)),[s,o,t])},j=(e,o=[])=>S(e,o),z=e=>L("Tables",k(e),{}),D=e=>L("TableIds",k(e),[],[]),G=(e,o)=>L("Table",k(o),{},[e]),H=(e,o)=>L("RowIds",k(o),[],[e]),J=(e,o,t,s=0,d,r)=>L("SortedRowIds",k(r),[],[e,o,t,s,d],6),K=(e,o,t)=>L("Row",k(t),{},[e,o]),N=(e,o,t)=>L("CellIds",k(t),[],[e,o]),O=(e,o,t,s)=>L("Cell",k(s),void 0,[e,o,t],4),Q=e=>L("Values",k(e),{}),U=e=>L("ValueIds",k(e),[],[]),W=(e,o)=>L("Value",k(o),void 0,[e]),X=(e,o,t,s,d)=>A(t,"Tables",e,o,s,d),Y=(e,o,t,s,d,r)=>A(s,"Table",o,t,d,r,e),Z=(e,o,t,s,d,r,n)=>A(d,"Row",t,s,r,n,e,o),$=(e,o,t=[],s,d=I,r=[])=>{const l=k(s);return P((t=>n(l,(s=>n(o(t,s),(o=>d(s.addRow(e,o),s,o)))))),[l,e,...t,...r])},_=(e,o,t,s,d,r,n)=>A(d,"PartialRow",t,s,r,n,e,o),ee=(e,o,t,s,d,r,n,l)=>A(r,"Cell",s,d,n,l,e,o,t),oe=(e,o,t,s,d)=>A(t,"Values",e,o,s,d),te=(e,o,t,s,d)=>A(t,"PartialValues",e,o,s,d),se=(e,o,t,s,d,r)=>A(s,"Value",o,t,d,r,e),de=(e,o,t)=>E(e,"Tables",o,t),re=(e,o,t,s)=>E(o,"Table",t,s,e),ne=(e,o,t,s,d)=>E(t,"Row",s,d,e,o),le=(e,o,t,s,d,r,n)=>E(d,"Cell",r,n,e,o,t,s),Ie=(e,o,t)=>E(e,"Values",o,t),ue=(e,o,t,s)=>E(o,"Value",t,s,e),ae=(e,o,t,s)=>M("Tables",k(s),e,o,[],t),ie=(e,o,t,s)=>M("TableIds",k(s),e,o,[],t),ce=(e,o,t,s,d)=>M("Table",k(d),o,t,[e],s),pe=(e,o,t,s,d)=>M("RowIds",k(d),o,t,[e],s),be=(e,o,t,s,d,r,n,l,I)=>M("SortedRowIds",k(I),r,n,[e,o,t,s,d],l),ge=(e,o,t,s,d,r)=>M("Row",k(r),t,s,[e,o],d),we=(e,o,t,s,d,r)=>M("CellIds",k(r),t,s,[e,o],d),Re=(e,o,t,s,d,r,n)=>M("Cell",k(n),s,d,[e,o,t],r),Ce=(e,o,t,s)=>M("Values",k(s),e,o,[],t),me=(e,o,t,s)=>M("ValueIds",k(s),e,o,[],t),ke=(e,o,t,s,d)=>M("Value",k(d),o,t,[e],s),ye=(e,o,t)=>B(e,o,t),he=(e,o)=>L("Metric",y(o),void 0,[e]),ve=(e,o,t,s)=>M("Metric",y(s),o,t,[e]),Te=(e,o,t)=>B(e,o,t),qe=(e,o)=>L("SliceIds",h(o),[],[e]),Pe=(e,o,t)=>L("SliceRowIds",h(t),[],[e,o]),xe=(e,o,t,s)=>M("SliceIds",h(s),o,t,[e]),Se=(e,o,t,s,d)=>M("SliceRowIds",h(d),t,s,[e,o]),Ve=(e,o,t)=>B(e,o,t),fe=(e,o,t)=>L("RemoteRowId",v(t),void 0,[e,o]),Be=(e,o,t)=>L("LocalRowIds",v(t),[],[e,o]),Le=(e,o,t)=>L("LinkedRowIds",v(t),[],[e,o]),Me=(e,o,t,s,d)=>M("RemoteRowId",v(d),t,s,[e,o]),Ae=(e,o,t,s,d)=>M("LocalRowIds",v(d),t,s,[e,o]),Ee=(e,o,t,s,d)=>M("LinkedRowIds",v(d),t,s,[e,o]),Fe=(e,o,t)=>B(e,o,t),je=(e,o)=>L("ResultTable",T(o),{},[e]),ze=(e,o)=>L("ResultRowIds",T(o),[],[e]),De=(e,o,t,s=0,d,r)=>L("ResultSortedRowIds",T(r),[],[e,o,t,s,d],6),Ge=(e,o,t)=>L("ResultRow",T(t),{},[e,o]),He=(e,o,t)=>L("ResultCellIds",T(t),[],[e,o]),Je=(e,o,t,s)=>L("ResultCell",T(s),void 0,[e,o,t]),Ke=(e,o,t,s)=>M("ResultTable",T(s),o,t,[e]),Ne=(e,o,t,s)=>M("ResultRowIds",T(s),o,t,[e]),Oe=(e,o,t,s,d,r,n,l)=>M("ResultSortedRowIds",T(l),r,n,[e,o,t,s,d]),Qe=(e,o,t,s,d)=>M("ResultRow",T(d),t,s,[e,o]),Ue=(e,o,t,s,d)=>M("ResultCellIds",T(d),t,s,[e,o]),We=(e,o,t,s,d,r)=>M("ResultCell",T(r),s,d,[e,o,t]),Xe=(e,o,t)=>B(e,o,t),Ye=e=>L("CheckpointIds",q(e),[[],void 0,[]]),Ze=(e,o)=>L("Checkpoint",q(o),void 0,[e]),$e=(e=I,o=[],t,s=I,d=[])=>{const r=q(t);return P((o=>n(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},_e=e=>F(e,"goBackward"),eo=e=>F(e,"goForward"),oo=(e,o=[],t,s=I,d=[])=>{const r=q(t);return P((o=>n(r,(t=>n(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},to=e=>{const o=q(e),[t,s]=Ye(o);return[(d=t,!(0==(e=>e.length)(d))),_e(o),s,n(s,(e=>o?.getCheckpoint(e)))??""];var d},so=e=>{const o=q(e),[,,[t]]=Ye(o);return[!r(t),eo(o),t,n(t,(e=>o?.getCheckpoint(e)))??""]},ro=(e,o,t)=>M("CheckpointIds",q(t),e,o),no=(e,o,t,s)=>M("Checkpoint",q(s),o,t,[e]),lo=(e,o,t=[],s,d=[])=>{const[,r]=f(),n=S((()=>o(e)),[e,...t]);return x((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:Io,useMemo:uo}=e,ao=({tableId:e,store:o,rowComponent:t=mo,getRowComponentProps:s,separator:r,debugIds:n},l)=>Ro(d(l,(d=>Io(t,{...go(s,d),key:d,tableId:e,rowId:d,store:o,debugIds:n}))),r,n,e),io=({queryId:e,queries:o,resultRowComponent:t=Lo,getResultRowComponentProps:s,separator:r,debugIds:n},l)=>Ro(d(l,(d=>Io(t,{...go(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:n}))),r,n,e),co=e=>{const o=v(e);return[o,o?.getStore()]},po=({relationshipId:e,relationships:o,rowComponent:t=mo,getRowComponentProps:s,separator:r,debugIds:n},l,I)=>{const[u,a]=co(o),i=u?.getLocalTableId(e),c=l(e,I,u);return Ro(d(c,(e=>Io(t,{...go(s,e),key:e,tableId:i,rowId:e,store:a,debugIds:n}))),r,n,I)},bo=e=>({checkpoints:o,checkpointComponent:t=Eo,getCheckpointComponentProps:s,separator:r,debugIds:n})=>{const l=q(o);return Ro(d(e(Ye(l)),(e=>Io(t,{...go(s,e),key:e,checkpoints:l,checkpointId:e,debugIds:n}))),r)},go=(e,o)=>r(e)?{}:e(o),wo=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:a,checkpoints:c,checkpointsById:p,children:b})=>{const g=o(i);return Io(i.Provider,{value:uo((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...a},c??g[10],{...g[11],...p}]),[e,t,s,d,r,n,l,I,u,a,c,p,g])},b)},Ro=(e,o,t,s)=>{const n=r(o)||!Array.isArray(e)?e:d(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",n,"}"]:n},Co=({tableId:e,rowId:o,cellId:t,store:s,debugIds:d})=>Ro(""+(O(e,o,t,s)??""),void 0,d,t),mo=({tableId:e,rowId:o,store:t,cellComponent:s=Co,getCellComponentProps:r,separator:n,debugIds:l})=>Ro(d(N(e,o,t),(d=>Io(s,{...go(r,d),key:d,tableId:e,rowId:o,cellId:d,store:t,debugIds:l}))),n,l,o),ko=e=>ao(e,H(e.tableId,e.store)),yo=({cellId:e,descending:o,offset:t,limit:s,...d})=>ao(d,J(d.tableId,e,o,t,s,d.store)),ho=({store:e,tableComponent:o=ko,getTableComponentProps:t,separator:s,debugIds:r})=>Ro(d(D(e),(s=>Io(o,{...go(t,s),key:s,tableId:s,store:e,debugIds:r}))),s),vo=({valueId:e,store:o,debugIds:t})=>Ro(""+(W(e,o)??""),void 0,t,e),To=({store:e,valueComponent:o=vo,getValueComponentProps:t,separator:s,debugIds:r})=>Ro(d(U(e),(s=>Io(o,{...go(t,s),key:s,valueId:s,store:e,debugIds:r}))),s),qo=({metricId:e,metrics:o,debugIds:t})=>Ro(he(e,o)??"",void 0,t,e),Po=({indexId:e,sliceId:o,indexes:t,rowComponent:s=mo,getRowComponentProps:r,separator:n,debugIds:l})=>{const I=h(t),u=I?.getStore(),a=I?.getTableId(e),i=Pe(e,o,I);return Ro(d(i,(e=>Io(s,{...go(r,e),key:e,tableId:a,rowId:e,store:u,debugIds:l}))),n,l,o)},xo=({indexId:e,indexes:o,sliceComponent:t=Po,getSliceComponentProps:s,separator:r,debugIds:n})=>Ro(d(qe(e,o),(d=>Io(t,{...go(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:n}))),r,n,e),So=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=mo,getRowComponentProps:d,debugIds:n})=>{const[l,I]=co(t),u=l?.getRemoteTableId(e),a=fe(e,o,l);return Ro(r(u)||r(a)?null:Io(s,{...go(d,a),key:a,tableId:u,rowId:a,store:I,debugIds:n}),void 0,n,o)},Vo=e=>po(e,Be,e.remoteRowId),fo=e=>po(e,Le,e.firstRowId),Bo=({queryId:e,rowId:o,cellId:t,queries:s,debugIds:d})=>Ro(""+(Je(e,o,t,s)??""),void 0,d,t),Lo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=Bo,getResultCellComponentProps:r,separator:n,debugIds:l})=>Ro(d(He(e,o,t),(d=>Io(s,{...go(r,d),key:d,queryId:e,rowId:o,cellId:d,queries:t,debugIds:l}))),n,l,o),Mo=e=>io(e,ze(e.queryId,e.queries)),Ao=({cellId:e,descending:o,offset:t,limit:s,...d})=>io(d,De(d.queryId,e,o,t,s,d.queries)),Eo=({checkpoints:e,checkpointId:o,debugIds:t})=>Ro(Ze(o,e)??"",void 0,t,o),Fo=bo((e=>e[0])),jo=bo((e=>r(e[1])?[]:[e[1]])),zo=bo((e=>e[2]));export{Fo as BackwardCheckpointsView,Co as CellView,Eo as CheckpointView,jo as CurrentCheckpointView,zo as ForwardCheckpointsView,xo as IndexView,fo as LinkedRowsView,Vo as LocalRowsView,qo as MetricView,wo as Provider,So as RemoteRowView,Bo as ResultCellView,Lo as ResultRowView,Ao as ResultSortedTableView,Mo as ResultTableView,mo as RowView,Po as SliceView,yo as SortedTableView,ko as TableView,ho as TablesView,vo as ValueView,To as ValuesView,ao as tableView,$ as useAddRowCallback,O as useCell,N as useCellIds,we as useCellIdsListener,Re as useCellListener,Ze as useCheckpoint,Ye as useCheckpointIds,ro as useCheckpointIdsListener,no as useCheckpointListener,m as useCheckpoints,Xe as useCreateCheckpoints,Te as useCreateIndexes,ye as useCreateMetrics,lo as useCreatePersister,Fe as useCreateQueries,Ve as useCreateRelationships,j as useCreateStore,le as useDelCellCallback,ne as useDelRowCallback,re as useDelTableCallback,de as useDelTablesCallback,ue as useDelValueCallback,Ie as useDelValuesCallback,_e as useGoBackwardCallback,eo as useGoForwardCallback,oo as useGoToCallback,w as useIndexes,Le as useLinkedRowIds,Ee as useLinkedRowIdsListener,Be as useLocalRowIds,Ae as useLocalRowIdsListener,he as useMetric,ve as useMetricListener,g as useMetrics,C as useQueries,so as useRedoInformation,R as useRelationships,fe as useRemoteRowId,Me as useRemoteRowIdListener,Je as useResultCell,He as useResultCellIds,Ue as useResultCellIdsListener,We as useResultCellListener,Ge as useResultRow,ze as useResultRowIds,Ne as useResultRowIdsListener,Qe as useResultRowListener,De as useResultSortedRowIds,Oe as useResultSortedRowIdsListener,je as useResultTable,Ke as useResultTableListener,K as useRow,H as useRowIds,pe as useRowIdsListener,ge as useRowListener,ee as useSetCellCallback,$e as useSetCheckpointCallback,_ as useSetPartialRowCallback,te as useSetPartialValuesCallback,Z as useSetRowCallback,Y as useSetTableCallback,X as useSetTablesCallback,se as useSetValueCallback,oe as useSetValuesCallback,qe as useSliceIds,xe as useSliceIdsListener,Pe as useSliceRowIds,Se as useSliceRowIdsListener,J as useSortedRowIds,be as useSortedRowIdsListener,b as useStore,G as useTable,D as useTableIds,ie as useTableIdsListener,ce as useTableListener,z as useTables,ae as useTablesListener,to as useUndoInformation,W as useValue,U as useValueIds,me as useValueIdsListener,ke as useValueListener,Q as useValues,Ce as useValuesListener};
|
package/lib/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Tables",d="TableIds",u="Table",n="RowIds",i="SortedRowIds",a="Row",I="CellIds",c="Cell",w="Values",R="ValueIds",C="Value",b=(e,s)=>e.map(s),p=e=>null==e,k=(e,s,t)=>p(e)?t?.():s(e),g=()=>{},{createContext:m,useContext:h}=s,V=m([]),L=(e,s)=>{const t=h(V);return p(e)?t[s]:((e,s)=>k(e,(e=>e[s])))(t[s+1],e)},y=(e,s)=>{const o=L(e,s);return p(e)||(e=>t(e)==l)(e)?o:e},S=e=>y(e,0),T=e=>y(e,2),f=e=>y(e,4),v=e=>y(e,6),P=e=>y(e,8),q=e=>y(e,10),{useCallback:x,useEffect:B,useMemo:M,useRef:D,useState:A}=s,F=(e,s,t=[])=>{const o=M((()=>s(e)),[e,...t]);return B((()=>()=>o.destroy()),[o]),o},G=(e,s,t,o=[],l)=>{const[,r]=A(),d=x((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[u]=A(d),n=D(u);return M((()=>n.current=d()),[d]),E(e,s,((...e)=>{n.current=p(l)?d():e[l],r([])}),[],o),n.current},E=(e,s,t,o=[],l=[],...r)=>B((()=>{const o=s?.["add"+e+"Listener"]?.(...l,t,...r);return()=>s?.delListener(o)}),[s,...l,...o,...r]),Q=(e,s,t,o=[],l=g,r=[],...d)=>{const u=S(e);return x((e=>k(u,(o=>k(t(e,o),(e=>l(o["set"+s](...d,e),e)))))),[u,s,...o,...r,...d])},U=(e,s,t=g,o=[],...l)=>{const r=S(e);return x((()=>t(r?.["del"+s](...l))),[r,s,...o,...l])},j=(e,s,t)=>{const o=q(e);return x((()=>o?.[s](t)),[o,s,t])},z=e=>G(d,S(e),[],[]),H=(e,s)=>G(n,S(s),[],[e]),J=(e,s,t,o=0,l,r)=>G(i,S(r),[],[e,s,t,o,l],6),K=(e,s,t)=>G(I,S(t),[],[e,s]),N=(e,s,t,o)=>G(c,S(o),void 0,[e,s,t],4),O=e=>G(R,S(e),[],[]),W=(e,s)=>G(C,S(s),void 0,[e]),X=(e,s)=>G("Metric",T(s),void 0,[e]),Y=(e,s)=>G("SliceIds",f(s),[],[e]),Z=(e,s,t)=>G("SliceRowIds",f(t),[],[e,s]),$=(e,s,t)=>G("RemoteRowId",v(t),void 0,[e,s]),_=(e,s,t)=>G("LocalRowIds",v(t),[],[e,s]),ee=(e,s,t)=>G("LinkedRowIds",v(t),[],[e,s]),se=(e,s)=>G("ResultRowIds",P(s),[],[e]),te=(e,s,t,o=0,l,r)=>G("ResultSortedRowIds",P(r),[],[e,s,t,o,l],6),oe=(e,s,t)=>G("ResultCellIds",P(t),[],[e,s]),le=(e,s,t,o)=>G("ResultCell",P(o),void 0,[e,s,t]),re=e=>G("CheckpointIds",q(e),[[],void 0,[]]),de=(e,s)=>G("Checkpoint",q(s),void 0,[e]),ue=e=>j(e,"goBackward"),ne=e=>j(e,"goForward"),{createElement:ie,useMemo:ae}=s,Ie=({tableId:e,store:s,rowComponent:t=ge,getRowComponentProps:o,separator:l,debugIds:r},d)=>pe(b(d,(l=>ie(t,{...be(o,l),key:l,tableId:e,rowId:l,store:s,debugIds:r}))),l,r,e),ce=({queryId:e,queries:s,resultRowComponent:t=ye,getResultRowComponentProps:o,separator:l,debugIds:r},d)=>pe(b(d,(l=>ie(t,{...be(o,l),key:l,queryId:e,rowId:l,queries:s,debugIds:r}))),l,r,e),we=e=>{const s=v(e);return[s,s?.getStore()]},Re=({relationshipId:e,relationships:s,rowComponent:t=ge,getRowComponentProps:o,separator:l,debugIds:r},d,u)=>{const[n,i]=we(s),a=n?.getLocalTableId(e),I=d(e,u,n);return pe(b(I,(e=>ie(t,{...be(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),l,r,u)},Ce=e=>({checkpoints:s,checkpointComponent:t=Se,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const d=q(s);return pe(b(e(re(d)),(e=>ie(t,{...be(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:r}))),l)},be=(e,s)=>p(e)?{}:e(s),pe=(e,s,t,o)=>{const l=p(s)||!Array.isArray(e)?e:b(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},ke=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>pe(o+(N(e,s,t,l)??o),void 0,r,t),ge=({tableId:e,rowId:s,store:t,cellComponent:o=ke,getCellComponentProps:l,separator:r,debugIds:d})=>pe(b(K(e,s,t),(r=>ie(o,{...be(l,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d}))),r,d,s),me=e=>Ie(e,H(e.tableId,e.store)),he=({valueId:e,store:s,debugIds:t})=>pe(o+(W(e,s)??o),void 0,t,e),Ve=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ge,getRowComponentProps:l,separator:r,debugIds:d})=>{const u=f(t),n=u?.getStore(),i=u?.getTableId(e),a=Z(e,s,u);return pe(b(a,(e=>ie(o,{...be(l,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),r,d,s)},Le=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>pe(o+(le(e,s,t,l)??o),void 0,r,t),ye=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Le,getResultCellComponentProps:l,separator:r,debugIds:d})=>pe(b(oe(e,s,t),(r=>ie(o,{...be(l,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:d}))),r,d,s),Se=({checkpoints:e,checkpointId:s,debugIds:t})=>pe(de(s,e)??o,void 0,t,s),Te=Ce((e=>e[0])),fe=Ce((e=>p(e[1])?[]:[e[1]])),ve=Ce((e=>e[2]));e.BackwardCheckpointsView=Te,e.CellView=ke,e.CheckpointView=Se,e.CurrentCheckpointView=fe,e.ForwardCheckpointsView=ve,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ve,getSliceComponentProps:o,separator:l,debugIds:r})=>pe(b(Y(e,s),(l=>ie(t,{...be(o,l),key:l,indexId:e,sliceId:l,indexes:s,debugIds:r}))),l,r,e),e.LinkedRowsView=e=>Re(e,ee,e.firstRowId),e.LocalRowsView=e=>Re(e,_,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>pe(X(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:d,relationships:u,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:w})=>{const R=s.useContext(V);return ie(V.Provider,{value:ae((()=>[e??R[0],{...R[1],...t},o??R[2],{...R[3],...l},r??R[4],{...R[5],...d},u??R[6],{...R[7],...n},i??R[8],{...R[9],...a},I??R[10],{...R[11],...c}]),[e,t,o,l,r,d,u,n,i,a,I,c,R])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ge,getRowComponentProps:l,debugIds:r})=>{const[d,u]=we(t),n=d?.getRemoteTableId(e),i=$(e,s,d);return pe(p(n)||p(i)?null:ie(o,{...be(l,i),key:i,tableId:n,rowId:i,store:u,debugIds:r}),void 0,r,s)},e.ResultCellView=Le,e.ResultRowView=ye,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>ce(l,te(l.queryId,e,s,t,o,l.queries)),e.ResultTableView=e=>ce(e,se(e.queryId,e.queries)),e.RowView=ge,e.SliceView=Ve,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>Ie(l,J(l.tableId,e,s,t,o,l.store)),e.TableView=me,e.TablesView=({store:e,tableComponent:s=me,getTableComponentProps:t,separator:o,debugIds:l})=>pe(b(z(e),(o=>ie(s,{...be(t,o),key:o,tableId:o,store:e,debugIds:l}))),o),e.ValueView=he,e.ValuesView=({store:e,valueComponent:s=he,getValueComponentProps:t,separator:o,debugIds:l})=>pe(b(O(e),(o=>ie(s,{...be(t,o),key:o,valueId:o,store:e,debugIds:l}))),o),e.tableView=Ie,e.useAddRowCallback=(e,s,t=[],o,l=g,r=[])=>{const d=S(o);return x((t=>k(d,(o=>k(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[d,e,...t,...r])},e.useCell=N,e.useCellIds=K,e.useCellIdsListener=(e,s,t,o,l,r)=>E(I,S(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,d)=>E(c,S(d),o,l,[e,s,t],r),e.useCheckpoint=de,e.useCheckpointIds=re,e.useCheckpointIdsListener=(e,s,t)=>E("CheckpointIds",q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>E("Checkpoint",q(o),s,t,[e]),e.useCheckpoints=e=>L(e,10),e.useCreateCheckpoints=(e,s,t)=>F(e,s,t),e.useCreateIndexes=(e,s,t)=>F(e,s,t),e.useCreateMetrics=(e,s,t)=>F(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=A(),d=M((()=>s(e)),[e,...t]);return B((()=>((async()=>{await(o?.(d)),r(1)})(),()=>{d.destroy()})),[d,...l]),d},e.useCreateQueries=(e,s,t)=>F(e,s,t),e.useCreateRelationships=(e,s,t)=>F(e,s,t),e.useCreateStore=(e,s=[])=>M(e,s),e.useDelCellCallback=(e,s,t,o,l,r,d)=>U(l,c,r,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>U(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>U(s,u,t,o,e),e.useDelTablesCallback=(e,s,t)=>U(e,r,s,t),e.useDelValueCallback=(e,s,t,o)=>U(s,C,t,o,e),e.useDelValuesCallback=(e,s,t)=>U(e,w,s,t),e.useGoBackwardCallback=ue,e.useGoForwardCallback=ne,e.useGoToCallback=(e,s=[],t,o=g,l=[])=>{const r=q(t);return x((s=>k(r,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>L(e,4),e.useLinkedRowIds=ee,e.useLinkedRowIdsListener=(e,s,t,o,l)=>E("LinkedRowIds",v(l),t,o,[e,s]),e.useLocalRowIds=_,e.useLocalRowIdsListener=(e,s,t,o,l)=>E("LocalRowIds",v(l),t,o,[e,s]),e.useMetric=X,e.useMetricListener=(e,s,t,o)=>E("Metric",T(o),s,t,[e]),e.useMetrics=e=>L(e,2),e.useQueries=e=>L(e,8),e.useRedoInformation=e=>{const s=q(e),[,,[t]]=re(s);return[!p(t),ne(s),t,k(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationships=e=>L(e,6),e.useRemoteRowId=$,e.useRemoteRowIdListener=(e,s,t,o,l)=>E("RemoteRowId",v(l),t,o,[e,s]),e.useResultCell=le,e.useResultCellIds=oe,e.useResultCellIdsListener=(e,s,t,o,l)=>E("ResultCellIds",P(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>E("ResultCell",P(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>G("ResultRow",P(t),{},[e,s]),e.useResultRowIds=se,e.useResultRowIdsListener=(e,s,t,o)=>E("ResultRowIds",P(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>E("ResultRow",P(l),t,o,[e,s]),e.useResultSortedRowIds=te,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,d,u)=>E("ResultSortedRowIds",P(u),r,d,[e,s,t,o,l]),e.useResultTable=(e,s)=>G("ResultTable",P(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>E("ResultTable",P(o),s,t,[e]),e.useRow=(e,s,t)=>G(a,S(t),{},[e,s]),e.useRowIds=H,e.useRowIdsListener=(e,s,t,o,l)=>E(n,S(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>E(a,S(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,d,u)=>Q(r,c,o,l,d,u,e,s,t),e.useSetCheckpointCallback=(e=g,s=[],t,o=g,l=[])=>{const r=q(t);return x((s=>k(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,d)=>Q(l,"PartialRow",t,o,r,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>Q(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,d)=>Q(l,a,t,o,r,d,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>Q(o,u,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>Q(t,r,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>Q(o,C,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>Q(t,w,e,s,o,l),e.useSliceIds=Y,e.useSliceIdsListener=(e,s,t,o)=>E("SliceIds",f(o),s,t,[e]),e.useSliceRowIds=Z,e.useSliceRowIdsListener=(e,s,t,o,l)=>E("SliceRowIds",f(l),t,o,[e,s]),e.useSortedRowIds=J,e.useSortedRowIdsListener=(e,s,t,o,l,r,d,u,n)=>E(i,S(n),r,d,[e,s,t,o,l],u),e.useStore=e=>L(e,0),e.useTable=(e,s)=>G(u,S(s),{},[e]),e.useTableIds=z,e.useTableIdsListener=(e,s,t,o)=>E(d,S(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>E(u,S(l),s,t,[e],o),e.useTables=e=>G(r,S(e),{}),e.useTablesListener=(e,s,t,o)=>E(r,S(o),e,s,[],t),e.useUndoInformation=e=>{const s=q(e),[t,l]=re(s);return[(r=t,!(0==(e=>e.length)(r))),ue(s),l,k(l,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=W,e.useValueIds=O,e.useValueIdsListener=(e,s,t,o)=>E(R,S(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>E(C,S(l),s,t,[e],o),e.useValues=e=>G(w,S(e),{}),e.useValuesListener=(e,s,t,o)=>E(w,S(o),e,s,[],t)},"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="",l=t(o),r="Tables",d="TableIds",u="Table",n="RowIds",i="SortedRowIds",a="Row",I="CellIds",c="Cell",w="Values",R="ValueIds",C="Value",b=(e,s)=>e.map(s),p=e=>null==e,k=(e,s,t)=>p(e)?t?.():s(e),g=e=>t(e)==l,m=()=>{},{createContext:h,useContext:V}=s,L=h([]),y=(e,s)=>{const t=V(L);return p(e)?t[s]:g(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1],e):e},S=(e,s)=>{const t=y(e,s);return p(e)||g(e)?t:e},T=e=>S(e,0),f=e=>S(e,2),v=e=>S(e,4),P=e=>S(e,6),q=e=>S(e,8),x=e=>S(e,10),{useCallback:B,useEffect:M,useMemo:D,useRef:A,useState:F}=s,G=(e,s,t=[])=>{const o=D((()=>s(e)),[e,...t]);return M((()=>()=>o.destroy()),[o]),o},E=(e,s,t,o=[],l)=>{const[,r]=F(),d=B((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[u]=F(d),n=A(u);return D((()=>n.current=d()),[d]),Q(e,s,((...e)=>{n.current=p(l)?d():e[l],r([])}),[],o),n.current},Q=(e,s,t,o=[],l=[],...r)=>M((()=>{const o=s?.["add"+e+"Listener"]?.(...l,t,...r);return()=>s?.delListener(o)}),[s,...l,...o,...r]),U=(e,s,t,o=[],l=m,r=[],...d)=>{const u=T(e);return B((e=>k(u,(o=>k(t(e,o),(e=>l(o["set"+s](...d,e),e)))))),[u,s,...o,...r,...d])},j=(e,s,t=m,o=[],...l)=>{const r=T(e);return B((()=>t(r?.["del"+s](...l))),[r,s,...o,...l])},z=(e,s,t)=>{const o=x(e);return B((()=>o?.[s](t)),[o,s,t])},H=e=>E(d,T(e),[],[]),J=(e,s)=>E(n,T(s),[],[e]),K=(e,s,t,o=0,l,r)=>E(i,T(r),[],[e,s,t,o,l],6),N=(e,s,t)=>E(I,T(t),[],[e,s]),O=(e,s,t,o)=>E(c,T(o),void 0,[e,s,t],4),W=e=>E(R,T(e),[],[]),X=(e,s)=>E(C,T(s),void 0,[e]),Y=(e,s)=>E("Metric",f(s),void 0,[e]),Z=(e,s)=>E("SliceIds",v(s),[],[e]),$=(e,s,t)=>E("SliceRowIds",v(t),[],[e,s]),_=(e,s,t)=>E("RemoteRowId",P(t),void 0,[e,s]),ee=(e,s,t)=>E("LocalRowIds",P(t),[],[e,s]),se=(e,s,t)=>E("LinkedRowIds",P(t),[],[e,s]),te=(e,s)=>E("ResultRowIds",q(s),[],[e]),oe=(e,s,t,o=0,l,r)=>E("ResultSortedRowIds",q(r),[],[e,s,t,o,l],6),le=(e,s,t)=>E("ResultCellIds",q(t),[],[e,s]),re=(e,s,t,o)=>E("ResultCell",q(o),void 0,[e,s,t]),de=e=>E("CheckpointIds",x(e),[[],void 0,[]]),ue=(e,s)=>E("Checkpoint",x(s),void 0,[e]),ne=e=>z(e,"goBackward"),ie=e=>z(e,"goForward"),{createElement:ae,useMemo:Ie}=s,ce=({tableId:e,store:s,rowComponent:t=me,getRowComponentProps:o,separator:l,debugIds:r},d)=>ke(b(d,(l=>ae(t,{...pe(o,l),key:l,tableId:e,rowId:l,store:s,debugIds:r}))),l,r,e),we=({queryId:e,queries:s,resultRowComponent:t=Se,getResultRowComponentProps:o,separator:l,debugIds:r},d)=>ke(b(d,(l=>ae(t,{...pe(o,l),key:l,queryId:e,rowId:l,queries:s,debugIds:r}))),l,r,e),Re=e=>{const s=P(e);return[s,s?.getStore()]},Ce=({relationshipId:e,relationships:s,rowComponent:t=me,getRowComponentProps:o,separator:l,debugIds:r},d,u)=>{const[n,i]=Re(s),a=n?.getLocalTableId(e),I=d(e,u,n);return ke(b(I,(e=>ae(t,{...pe(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),l,r,u)},be=e=>({checkpoints:s,checkpointComponent:t=Te,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const d=x(s);return ke(b(e(de(d)),(e=>ae(t,{...pe(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:r}))),l)},pe=(e,s)=>p(e)?{}:e(s),ke=(e,s,t,o)=>{const l=p(s)||!Array.isArray(e)?e:b(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},ge=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>ke(o+(O(e,s,t,l)??o),void 0,r,t),me=({tableId:e,rowId:s,store:t,cellComponent:o=ge,getCellComponentProps:l,separator:r,debugIds:d})=>ke(b(N(e,s,t),(r=>ae(o,{...pe(l,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d}))),r,d,s),he=e=>ce(e,J(e.tableId,e.store)),Ve=({valueId:e,store:s,debugIds:t})=>ke(o+(X(e,s)??o),void 0,t,e),Le=({indexId:e,sliceId:s,indexes:t,rowComponent:o=me,getRowComponentProps:l,separator:r,debugIds:d})=>{const u=v(t),n=u?.getStore(),i=u?.getTableId(e),a=$(e,s,u);return ke(b(a,(e=>ae(o,{...pe(l,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),r,d,s)},ye=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>ke(o+(re(e,s,t,l)??o),void 0,r,t),Se=({queryId:e,rowId:s,queries:t,resultCellComponent:o=ye,getResultCellComponentProps:l,separator:r,debugIds:d})=>ke(b(le(e,s,t),(r=>ae(o,{...pe(l,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:d}))),r,d,s),Te=({checkpoints:e,checkpointId:s,debugIds:t})=>ke(ue(s,e)??o,void 0,t,s),fe=be((e=>e[0])),ve=be((e=>p(e[1])?[]:[e[1]])),Pe=be((e=>e[2]));e.BackwardCheckpointsView=fe,e.CellView=ge,e.CheckpointView=Te,e.CurrentCheckpointView=ve,e.ForwardCheckpointsView=Pe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Le,getSliceComponentProps:o,separator:l,debugIds:r})=>ke(b(Z(e,s),(l=>ae(t,{...pe(o,l),key:l,indexId:e,sliceId:l,indexes:s,debugIds:r}))),l,r,e),e.LinkedRowsView=e=>Ce(e,se,e.firstRowId),e.LocalRowsView=e=>Ce(e,ee,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ke(Y(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:d,relationships:u,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:w})=>{const R=s.useContext(L);return ae(L.Provider,{value:Ie((()=>[e??R[0],{...R[1],...t},o??R[2],{...R[3],...l},r??R[4],{...R[5],...d},u??R[6],{...R[7],...n},i??R[8],{...R[9],...a},I??R[10],{...R[11],...c}]),[e,t,o,l,r,d,u,n,i,a,I,c,R])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=me,getRowComponentProps:l,debugIds:r})=>{const[d,u]=Re(t),n=d?.getRemoteTableId(e),i=_(e,s,d);return ke(p(n)||p(i)?null:ae(o,{...pe(l,i),key:i,tableId:n,rowId:i,store:u,debugIds:r}),void 0,r,s)},e.ResultCellView=ye,e.ResultRowView=Se,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>we(l,oe(l.queryId,e,s,t,o,l.queries)),e.ResultTableView=e=>we(e,te(e.queryId,e.queries)),e.RowView=me,e.SliceView=Le,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>ce(l,K(l.tableId,e,s,t,o,l.store)),e.TableView=he,e.TablesView=({store:e,tableComponent:s=he,getTableComponentProps:t,separator:o,debugIds:l})=>ke(b(H(e),(o=>ae(s,{...pe(t,o),key:o,tableId:o,store:e,debugIds:l}))),o),e.ValueView=Ve,e.ValuesView=({store:e,valueComponent:s=Ve,getValueComponentProps:t,separator:o,debugIds:l})=>ke(b(W(e),(o=>ae(s,{...pe(t,o),key:o,valueId:o,store:e,debugIds:l}))),o),e.tableView=ce,e.useAddRowCallback=(e,s,t=[],o,l=m,r=[])=>{const d=T(o);return B((t=>k(d,(o=>k(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[d,e,...t,...r])},e.useCell=O,e.useCellIds=N,e.useCellIdsListener=(e,s,t,o,l,r)=>Q(I,T(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,d)=>Q(c,T(d),o,l,[e,s,t],r),e.useCheckpoint=ue,e.useCheckpointIds=de,e.useCheckpointIdsListener=(e,s,t)=>Q("CheckpointIds",x(t),e,s),e.useCheckpointListener=(e,s,t,o)=>Q("Checkpoint",x(o),s,t,[e]),e.useCheckpoints=e=>y(e,10),e.useCreateCheckpoints=(e,s,t)=>G(e,s,t),e.useCreateIndexes=(e,s,t)=>G(e,s,t),e.useCreateMetrics=(e,s,t)=>G(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=F(),d=D((()=>s(e)),[e,...t]);return M((()=>((async()=>{await(o?.(d)),r(1)})(),()=>{d.destroy()})),[d,...l]),d},e.useCreateQueries=(e,s,t)=>G(e,s,t),e.useCreateRelationships=(e,s,t)=>G(e,s,t),e.useCreateStore=(e,s=[])=>D(e,s),e.useDelCellCallback=(e,s,t,o,l,r,d)=>j(l,c,r,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>j(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>j(s,u,t,o,e),e.useDelTablesCallback=(e,s,t)=>j(e,r,s,t),e.useDelValueCallback=(e,s,t,o)=>j(s,C,t,o,e),e.useDelValuesCallback=(e,s,t)=>j(e,w,s,t),e.useGoBackwardCallback=ne,e.useGoForwardCallback=ie,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=x(t);return B((s=>k(r,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>y(e,4),e.useLinkedRowIds=se,e.useLinkedRowIdsListener=(e,s,t,o,l)=>Q("LinkedRowIds",P(l),t,o,[e,s]),e.useLocalRowIds=ee,e.useLocalRowIdsListener=(e,s,t,o,l)=>Q("LocalRowIds",P(l),t,o,[e,s]),e.useMetric=Y,e.useMetricListener=(e,s,t,o)=>Q("Metric",f(o),s,t,[e]),e.useMetrics=e=>y(e,2),e.useQueries=e=>y(e,8),e.useRedoInformation=e=>{const s=x(e),[,,[t]]=de(s);return[!p(t),ie(s),t,k(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationships=e=>y(e,6),e.useRemoteRowId=_,e.useRemoteRowIdListener=(e,s,t,o,l)=>Q("RemoteRowId",P(l),t,o,[e,s]),e.useResultCell=re,e.useResultCellIds=le,e.useResultCellIdsListener=(e,s,t,o,l)=>Q("ResultCellIds",q(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>Q("ResultCell",q(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>E("ResultRow",q(t),{},[e,s]),e.useResultRowIds=te,e.useResultRowIdsListener=(e,s,t,o)=>Q("ResultRowIds",q(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>Q("ResultRow",q(l),t,o,[e,s]),e.useResultSortedRowIds=oe,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,d,u)=>Q("ResultSortedRowIds",q(u),r,d,[e,s,t,o,l]),e.useResultTable=(e,s)=>E("ResultTable",q(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>Q("ResultTable",q(o),s,t,[e]),e.useRow=(e,s,t)=>E(a,T(t),{},[e,s]),e.useRowIds=J,e.useRowIdsListener=(e,s,t,o,l)=>Q(n,T(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>Q(a,T(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,d,u)=>U(r,c,o,l,d,u,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=x(t);return B((s=>k(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,d)=>U(l,"PartialRow",t,o,r,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>U(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,d)=>U(l,a,t,o,r,d,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>U(o,u,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>U(t,r,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>U(o,C,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>U(t,w,e,s,o,l),e.useSliceIds=Z,e.useSliceIdsListener=(e,s,t,o)=>Q("SliceIds",v(o),s,t,[e]),e.useSliceRowIds=$,e.useSliceRowIdsListener=(e,s,t,o,l)=>Q("SliceRowIds",v(l),t,o,[e,s]),e.useSortedRowIds=K,e.useSortedRowIdsListener=(e,s,t,o,l,r,d,u,n)=>Q(i,T(n),r,d,[e,s,t,o,l],u),e.useStore=e=>y(e,0),e.useTable=(e,s)=>E(u,T(s),{},[e]),e.useTableIds=H,e.useTableIdsListener=(e,s,t,o)=>Q(d,T(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>Q(u,T(l),s,t,[e],o),e.useTables=e=>E(r,T(e),{}),e.useTablesListener=(e,s,t,o)=>Q(r,T(o),e,s,[],t),e.useUndoInformation=e=>{const s=x(e),[t,l]=de(s);return[(r=t,!(0==(e=>e.length)(r))),ne(s),l,k(l,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=X,e.useValueIds=W,e.useValueIdsListener=(e,s,t,o)=>Q(R,T(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>Q(C,T(l),s,t,[e],o),e.useValues=e=>E(w,T(e),{}),e.useValuesListener=(e,s,t,o)=>Q(w,T(o),e,s,[],t)},"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);
|
package/lib/umd/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Tables",u="TableIds",d="Table",n="RowIds",i="SortedRowIds",a="Row",c="CellIds",I="Cell",w="Values",p="ValueIds",b="Value",R=(e,s)=>e.map(s),C=e=>null==e,k=(e,s,t)=>C(e)?null==t?void 0:t():s(e),v=()=>{},{createContext:g,useContext:m}=s,y=g([]),h=(e,s)=>{const t=m(y);return C(e)?t[s]:((e,s)=>k(e,(e=>e[s])))(t[s+1],e)},f=(e,s)=>{const o=h(e,s);return C(e)||(e=>t(e)==l)(e)?o:e},V=e=>f(e,0),L=e=>f(e,2),S=e=>f(e,4),T=e=>f(e,6),P=e=>f(e,8),x=e=>f(e,10),{useCallback:q,useEffect:O,useMemo:B,useRef:M,useState:j}=s,D=(e,s,t=[])=>{const o=B((()=>s(e)),[e,...t]);return O((()=>()=>o.destroy()),[o]),o},A=(e,s,t,o=[],l)=>{const[,r]=j(),u=q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[d]=j(u),n=M(d);return B((()=>n.current=u()),[u]),E(e,s,((...e)=>{n.current=C(l)?u():e[l],r([])}),[],o),n.current},E=(e,s,t,o=[],l=[],...r)=>O((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),F=(e,s,t,o=[],l=v,r=[],...u)=>{const d=V(e);return q((e=>k(d,(o=>k(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[d,s,...o,...r,...u])},G=(e,s,t=v,o=[],...l)=>{const r=V(e);return q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Q=(e,s,t)=>{const o=x(e);return q((()=>null==o?void 0:o[s](t)),[o,s,t])},U=e=>A(u,V(e),[],[]),z=(e,s)=>A(n,V(s),[],[e]),H=(e,s,t,o=0,l,r)=>A(i,V(r),[],[e,s,t,o,l],6),J=(e,s,t)=>A(c,V(t),[],[e,s]),K=(e,s,t,o)=>A(I,V(o),void 0,[e,s,t],4),N=e=>A(p,V(e),[],[]),W=(e,s)=>A(b,V(s),void 0,[e]),X=(e,s)=>A("Metric",L(s),void 0,[e]),Y=(e,s)=>A("SliceIds",S(s),[],[e]),Z=(e,s,t)=>A("SliceRowIds",S(t),[],[e,s]),$=(e,s,t)=>A("RemoteRowId",T(t),void 0,[e,s]),_=(e,s,t)=>A("LocalRowIds",T(t),[],[e,s]),ee=(e,s,t)=>A("LinkedRowIds",T(t),[],[e,s]),se=(e,s)=>A("ResultRowIds",P(s),[],[e]),te=(e,s,t,o=0,l,r)=>A("ResultSortedRowIds",P(r),[],[e,s,t,o,l],6),oe=(e,s,t)=>A("ResultCellIds",P(t),[],[e,s]),le=(e,s,t,o)=>A("ResultCell",P(o),void 0,[e,s,t]),re=e=>A("CheckpointIds",x(e),[[],void 0,[]]),ue=(e,s)=>A("Checkpoint",x(s),void 0,[e]),de=e=>Q(e,"goBackward"),ne=e=>Q(e,"goForward");var ie=Object.defineProperty,ae=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,Ie=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,be=(e,s,t)=>s in e?ie(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Re=(e,s)=>{for(var t in s||(s={}))we.call(s,t)&&be(e,t,s[t]);if(Ie)for(var t of Ie(s))pe.call(s,t)&&be(e,t,s[t]);return e},Ce=(e,s)=>ae(e,ce(s)),ke=(e,s)=>{var t={};for(var o in e)we.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Ie)for(var o of Ie(e))s.indexOf(o)<0&&pe.call(e,o)&&(t[o]=e[o]);return t};const{createElement:ve,useMemo:ge}=s,me=({tableId:e,store:s,rowComponent:t=Pe,getRowComponentProps:o,separator:l,debugIds:r},u)=>Se(R(u,(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),ye=({queryId:e,queries:s,resultRowComponent:t=Me,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Se(R(u,(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),he=e=>{const s=T(e);return[s,null==s?void 0:s.getStore()]},fe=({relationshipId:e,relationships:s,rowComponent:t=Pe,getRowComponentProps:o,separator:l,debugIds:r},u,d)=>{const[n,i]=he(s),a=null==n?void 0:n.getLocalTableId(e),c=u(e,d,n);return Se(R(c,(e=>ve(t,Ce(Re({},Le(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,d)},Ve=e=>({checkpoints:s,checkpointComponent:t=je,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=x(s);return Se(R(e(re(u)),(e=>ve(t,Ce(Re({},Le(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Le=(e,s)=>C(e)?{}:e(s),Se=(e,s,t,o)=>{const l=C(s)||!Array.isArray(e)?e:R(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Te=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Se(o+(null!=(u=K(e,s,t,l))?u:o),void 0,r,t)},Pe=({tableId:e,rowId:s,store:t,cellComponent:o=Te,getCellComponentProps:l,separator:r,debugIds:u})=>Se(R(J(e,s,t),(r=>ve(o,Ce(Re({},Le(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:u})))),r,u,s),xe=e=>me(e,z(e.tableId,e.store)),qe=({valueId:e,store:s,debugIds:t})=>{var l;return Se(o+(null!=(l=W(e,s))?l:o),void 0,t,e)},Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Pe,getRowComponentProps:l,separator:r,debugIds:u})=>{const d=S(t),n=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=Z(e,s,d);return Se(R(a,(e=>ve(o,Ce(Re({},Le(l,e)),{key:e,tableId:i,rowId:e,store:n,debugIds:u})))),r,u,s)},Be=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Se(o+(null!=(u=le(e,s,t,l))?u:o),void 0,r,t)},Me=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Be,getResultCellComponentProps:l,separator:r,debugIds:u})=>Se(R(oe(e,s,t),(r=>ve(o,Ce(Re({},Le(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),je=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Se(null!=(l=ue(s,e))?l:o,void 0,t,s)},De=Ve((e=>e[0])),Ae=Ve((e=>C(e[1])?[]:[e[1]])),Ee=Ve((e=>e[2]));e.BackwardCheckpointsView=De,e.CellView=Te,e.CheckpointView=je,e.CurrentCheckpointView=Ae,e.ForwardCheckpointsView=Ee,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:l,debugIds:r})=>Se(R(Y(e,s),(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>fe(e,ee,e.firstRowId),e.LocalRowsView=e=>fe(e,_,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Se(null!=(l=X(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:d,relationshipsById:n,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const p=s.useContext(y);return ve(y.Provider,{value:ge((()=>[null!=e?e:p[0],Re(Re({},p[1]),t),null!=o?o:p[2],Re(Re({},p[3]),l),null!=r?r:p[4],Re(Re({},p[5]),u),null!=d?d:p[6],Re(Re({},p[7]),n),null!=i?i:p[8],Re(Re({},p[9]),a),null!=c?c:p[10],Re(Re({},p[11]),I)]),[e,t,o,l,r,u,d,n,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Pe,getRowComponentProps:l,debugIds:r})=>{const[u,d]=he(t),n=null==u?void 0:u.getRemoteTableId(e),i=$(e,s,u);return Se(C(n)||C(i)?null:ve(o,Ce(Re({},Le(l,i)),{key:i,tableId:n,rowId:i,store:d,debugIds:r})),void 0,r,s)},e.ResultCellView=Be,e.ResultRowView=Me,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ke(s,["cellId","descending","offset","limit"]);return ye(u,te(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>ye(e,se(e.queryId,e.queries)),e.RowView=Pe,e.SliceView=Oe,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ke(s,["cellId","descending","offset","limit"]);return me(u,H(u.tableId,t,o,l,r,u.store))},e.TableView=xe,e.TablesView=({store:e,tableComponent:s=xe,getTableComponentProps:t,separator:o,debugIds:l})=>Se(R(U(e),(o=>ve(s,Ce(Re({},Le(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=qe,e.ValuesView=({store:e,valueComponent:s=qe,getValueComponentProps:t,separator:o,debugIds:l})=>Se(R(N(e),(o=>ve(s,Ce(Re({},Le(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.tableView=me,e.useAddRowCallback=(e,s,t=[],o,l=v,r=[])=>{const u=V(o);return q((t=>k(u,(o=>k(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[u,e,...t,...r])},e.useCell=K,e.useCellIds=J,e.useCellIdsListener=(e,s,t,o,l,r)=>E(c,V(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>E(I,V(u),o,l,[e,s,t],r),e.useCheckpoint=ue,e.useCheckpointIds=re,e.useCheckpointIdsListener=(e,s,t)=>E("CheckpointIds",x(t),e,s),e.useCheckpointListener=(e,s,t,o)=>E("Checkpoint",x(o),s,t,[e]),e.useCheckpoints=e=>h(e,10),e.useCreateCheckpoints=(e,s,t)=>D(e,s,t),e.useCreateIndexes=(e,s,t)=>D(e,s,t),e.useCreateMetrics=(e,s,t)=>D(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=j(),u=B((()=>s(e)),[e,...t]);return O((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>D(e,s,t),e.useCreateRelationships=(e,s,t)=>D(e,s,t),e.useCreateStore=(e,s=[])=>B(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>G(l,I,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>G(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>G(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>G(e,r,s,t),e.useDelValueCallback=(e,s,t,o)=>G(s,b,t,o,e),e.useDelValuesCallback=(e,s,t)=>G(e,w,s,t),e.useGoBackwardCallback=de,e.useGoForwardCallback=ne,e.useGoToCallback=(e,s=[],t,o=v,l=[])=>{const r=x(t);return q((s=>k(r,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>h(e,4),e.useLinkedRowIds=ee,e.useLinkedRowIdsListener=(e,s,t,o,l)=>E("LinkedRowIds",T(l),t,o,[e,s]),e.useLocalRowIds=_,e.useLocalRowIdsListener=(e,s,t,o,l)=>E("LocalRowIds",T(l),t,o,[e,s]),e.useMetric=X,e.useMetricListener=(e,s,t,o)=>E("Metric",L(o),s,t,[e]),e.useMetrics=e=>h(e,2),e.useQueries=e=>h(e,8),e.useRedoInformation=e=>{var s;const t=x(e),[,,[l]]=re(t);return[!C(l),ne(t),l,null!=(s=k(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>h(e,6),e.useRemoteRowId=$,e.useRemoteRowIdListener=(e,s,t,o,l)=>E("RemoteRowId",T(l),t,o,[e,s]),e.useResultCell=le,e.useResultCellIds=oe,e.useResultCellIdsListener=(e,s,t,o,l)=>E("ResultCellIds",P(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>E("ResultCell",P(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>A("ResultRow",P(t),{},[e,s]),e.useResultRowIds=se,e.useResultRowIdsListener=(e,s,t,o)=>E("ResultRowIds",P(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>E("ResultRow",P(l),t,o,[e,s]),e.useResultSortedRowIds=te,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,u,d)=>E("ResultSortedRowIds",P(d),r,u,[e,s,t,o,l]),e.useResultTable=(e,s)=>A("ResultTable",P(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>E("ResultTable",P(o),s,t,[e]),e.useRow=(e,s,t)=>A(a,V(t),{},[e,s]),e.useRowIds=z,e.useRowIdsListener=(e,s,t,o,l)=>E(n,V(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>E(a,V(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,d)=>F(r,I,o,l,u,d,e,s,t),e.useSetCheckpointCallback=(e=v,s=[],t,o=v,l=[])=>{const r=x(t);return q((s=>k(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>F(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>F(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>F(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>F(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>F(t,r,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>F(o,b,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>F(t,w,e,s,o,l),e.useSliceIds=Y,e.useSliceIdsListener=(e,s,t,o)=>E("SliceIds",S(o),s,t,[e]),e.useSliceRowIds=Z,e.useSliceRowIdsListener=(e,s,t,o,l)=>E("SliceRowIds",S(l),t,o,[e,s]),e.useSortedRowIds=H,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,d,n)=>E(i,V(n),r,u,[e,s,t,o,l],d),e.useStore=e=>h(e,0),e.useTable=(e,s)=>A(d,V(s),{},[e]),e.useTableIds=U,e.useTableIdsListener=(e,s,t,o)=>E(u,V(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>E(d,V(l),s,t,[e],o),e.useTables=e=>A(r,V(e),{}),e.useTablesListener=(e,s,t,o)=>E(r,V(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=x(e),[l,r]=re(t);return[(u=l,!(0==(e=>e.length)(u))),de(t),r,null!=(s=k(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=W,e.useValueIds=N,e.useValueIdsListener=(e,s,t,o)=>E(p,V(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>E(b,V(l),s,t,[e],o),e.useValues=e=>A(w,V(e),{}),e.useValuesListener=(e,s,t,o)=>E(w,V(o),e,s,[],t)},"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="",l=t(o),r="Tables",u="TableIds",d="Table",n="RowIds",i="SortedRowIds",a="Row",c="CellIds",I="Cell",w="Values",p="ValueIds",b="Value",R=(e,s)=>e.map(s),C=e=>null==e,k=(e,s,t)=>C(e)?null==t?void 0:t():s(e),v=e=>t(e)==l,g=()=>{},{createContext:m,useContext:y}=s,h=m([]),f=(e,s)=>{const t=y(h);return C(e)?t[s]:v(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1],e):e},V=(e,s)=>{const t=f(e,s);return C(e)||v(e)?t:e},L=e=>V(e,0),S=e=>V(e,2),T=e=>V(e,4),P=e=>V(e,6),x=e=>V(e,8),q=e=>V(e,10),{useCallback:O,useEffect:B,useMemo:M,useRef:j,useState:D}=s,A=(e,s,t=[])=>{const o=M((()=>s(e)),[e,...t]);return B((()=>()=>o.destroy()),[o]),o},E=(e,s,t,o=[],l)=>{const[,r]=D(),u=O((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[d]=D(u),n=j(d);return M((()=>n.current=u()),[u]),F(e,s,((...e)=>{n.current=C(l)?u():e[l],r([])}),[],o),n.current},F=(e,s,t,o=[],l=[],...r)=>B((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),G=(e,s,t,o=[],l=g,r=[],...u)=>{const d=L(e);return O((e=>k(d,(o=>k(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[d,s,...o,...r,...u])},Q=(e,s,t=g,o=[],...l)=>{const r=L(e);return O((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},U=(e,s,t)=>{const o=q(e);return O((()=>null==o?void 0:o[s](t)),[o,s,t])},z=e=>E(u,L(e),[],[]),H=(e,s)=>E(n,L(s),[],[e]),J=(e,s,t,o=0,l,r)=>E(i,L(r),[],[e,s,t,o,l],6),K=(e,s,t)=>E(c,L(t),[],[e,s]),N=(e,s,t,o)=>E(I,L(o),void 0,[e,s,t],4),W=e=>E(p,L(e),[],[]),X=(e,s)=>E(b,L(s),void 0,[e]),Y=(e,s)=>E("Metric",S(s),void 0,[e]),Z=(e,s)=>E("SliceIds",T(s),[],[e]),$=(e,s,t)=>E("SliceRowIds",T(t),[],[e,s]),_=(e,s,t)=>E("RemoteRowId",P(t),void 0,[e,s]),ee=(e,s,t)=>E("LocalRowIds",P(t),[],[e,s]),se=(e,s,t)=>E("LinkedRowIds",P(t),[],[e,s]),te=(e,s)=>E("ResultRowIds",x(s),[],[e]),oe=(e,s,t,o=0,l,r)=>E("ResultSortedRowIds",x(r),[],[e,s,t,o,l],6),le=(e,s,t)=>E("ResultCellIds",x(t),[],[e,s]),re=(e,s,t,o)=>E("ResultCell",x(o),void 0,[e,s,t]),ue=e=>E("CheckpointIds",q(e),[[],void 0,[]]),de=(e,s)=>E("Checkpoint",q(s),void 0,[e]),ne=e=>U(e,"goBackward"),ie=e=>U(e,"goForward");var ae=Object.defineProperty,ce=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,Re=(e,s,t)=>s in e?ae(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Ce=(e,s)=>{for(var t in s||(s={}))pe.call(s,t)&&Re(e,t,s[t]);if(we)for(var t of we(s))be.call(s,t)&&Re(e,t,s[t]);return e},ke=(e,s)=>ce(e,Ie(s)),ve=(e,s)=>{var t={};for(var o in e)pe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&we)for(var o of we(e))s.indexOf(o)<0&&be.call(e,o)&&(t[o]=e[o]);return t};const{createElement:ge,useMemo:me}=s,ye=({tableId:e,store:s,rowComponent:t=xe,getRowComponentProps:o,separator:l,debugIds:r},u)=>Te(R(u,(l=>ge(t,ke(Ce({},Se(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),he=({queryId:e,queries:s,resultRowComponent:t=je,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Te(R(u,(l=>ge(t,ke(Ce({},Se(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),fe=e=>{const s=P(e);return[s,null==s?void 0:s.getStore()]},Ve=({relationshipId:e,relationships:s,rowComponent:t=xe,getRowComponentProps:o,separator:l,debugIds:r},u,d)=>{const[n,i]=fe(s),a=null==n?void 0:n.getLocalTableId(e),c=u(e,d,n);return Te(R(c,(e=>ge(t,ke(Ce({},Se(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,d)},Le=e=>({checkpoints:s,checkpointComponent:t=De,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=q(s);return Te(R(e(ue(u)),(e=>ge(t,ke(Ce({},Se(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Se=(e,s)=>C(e)?{}:e(s),Te=(e,s,t,o)=>{const l=C(s)||!Array.isArray(e)?e:R(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Pe=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Te(o+(null!=(u=N(e,s,t,l))?u:o),void 0,r,t)},xe=({tableId:e,rowId:s,store:t,cellComponent:o=Pe,getCellComponentProps:l,separator:r,debugIds:u})=>Te(R(K(e,s,t),(r=>ge(o,ke(Ce({},Se(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:u})))),r,u,s),qe=e=>ye(e,H(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>{var l;return Te(o+(null!=(l=X(e,s))?l:o),void 0,t,e)},Be=({indexId:e,sliceId:s,indexes:t,rowComponent:o=xe,getRowComponentProps:l,separator:r,debugIds:u})=>{const d=T(t),n=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=$(e,s,d);return Te(R(a,(e=>ge(o,ke(Ce({},Se(l,e)),{key:e,tableId:i,rowId:e,store:n,debugIds:u})))),r,u,s)},Me=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Te(o+(null!=(u=re(e,s,t,l))?u:o),void 0,r,t)},je=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Me,getResultCellComponentProps:l,separator:r,debugIds:u})=>Te(R(le(e,s,t),(r=>ge(o,ke(Ce({},Se(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),De=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Te(null!=(l=de(s,e))?l:o,void 0,t,s)},Ae=Le((e=>e[0])),Ee=Le((e=>C(e[1])?[]:[e[1]])),Fe=Le((e=>e[2]));e.BackwardCheckpointsView=Ae,e.CellView=Pe,e.CheckpointView=De,e.CurrentCheckpointView=Ee,e.ForwardCheckpointsView=Fe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Be,getSliceComponentProps:o,separator:l,debugIds:r})=>Te(R(Z(e,s),(l=>ge(t,ke(Ce({},Se(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ve(e,se,e.firstRowId),e.LocalRowsView=e=>Ve(e,ee,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Te(null!=(l=Y(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:d,relationshipsById:n,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const p=s.useContext(h);return ge(h.Provider,{value:me((()=>[null!=e?e:p[0],Ce(Ce({},p[1]),t),null!=o?o:p[2],Ce(Ce({},p[3]),l),null!=r?r:p[4],Ce(Ce({},p[5]),u),null!=d?d:p[6],Ce(Ce({},p[7]),n),null!=i?i:p[8],Ce(Ce({},p[9]),a),null!=c?c:p[10],Ce(Ce({},p[11]),I)]),[e,t,o,l,r,u,d,n,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=xe,getRowComponentProps:l,debugIds:r})=>{const[u,d]=fe(t),n=null==u?void 0:u.getRemoteTableId(e),i=_(e,s,u);return Te(C(n)||C(i)?null:ge(o,ke(Ce({},Se(l,i)),{key:i,tableId:n,rowId:i,store:d,debugIds:r})),void 0,r,s)},e.ResultCellView=Me,e.ResultRowView=je,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ve(s,["cellId","descending","offset","limit"]);return he(u,oe(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>he(e,te(e.queryId,e.queries)),e.RowView=xe,e.SliceView=Be,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ve(s,["cellId","descending","offset","limit"]);return ye(u,J(u.tableId,t,o,l,r,u.store))},e.TableView=qe,e.TablesView=({store:e,tableComponent:s=qe,getTableComponentProps:t,separator:o,debugIds:l})=>Te(R(z(e),(o=>ge(s,ke(Ce({},Se(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:l})=>Te(R(W(e),(o=>ge(s,ke(Ce({},Se(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.tableView=ye,e.useAddRowCallback=(e,s,t=[],o,l=g,r=[])=>{const u=L(o);return O((t=>k(u,(o=>k(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[u,e,...t,...r])},e.useCell=N,e.useCellIds=K,e.useCellIdsListener=(e,s,t,o,l,r)=>F(c,L(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>F(I,L(u),o,l,[e,s,t],r),e.useCheckpoint=de,e.useCheckpointIds=ue,e.useCheckpointIdsListener=(e,s,t)=>F("CheckpointIds",q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>F("Checkpoint",q(o),s,t,[e]),e.useCheckpoints=e=>f(e,10),e.useCreateCheckpoints=(e,s,t)=>A(e,s,t),e.useCreateIndexes=(e,s,t)=>A(e,s,t),e.useCreateMetrics=(e,s,t)=>A(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=D(),u=M((()=>s(e)),[e,...t]);return B((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>A(e,s,t),e.useCreateRelationships=(e,s,t)=>A(e,s,t),e.useCreateStore=(e,s=[])=>M(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>Q(l,I,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>Q(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>Q(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>Q(e,r,s,t),e.useDelValueCallback=(e,s,t,o)=>Q(s,b,t,o,e),e.useDelValuesCallback=(e,s,t)=>Q(e,w,s,t),e.useGoBackwardCallback=ne,e.useGoForwardCallback=ie,e.useGoToCallback=(e,s=[],t,o=g,l=[])=>{const r=q(t);return O((s=>k(r,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>f(e,4),e.useLinkedRowIds=se,e.useLinkedRowIdsListener=(e,s,t,o,l)=>F("LinkedRowIds",P(l),t,o,[e,s]),e.useLocalRowIds=ee,e.useLocalRowIdsListener=(e,s,t,o,l)=>F("LocalRowIds",P(l),t,o,[e,s]),e.useMetric=Y,e.useMetricListener=(e,s,t,o)=>F("Metric",S(o),s,t,[e]),e.useMetrics=e=>f(e,2),e.useQueries=e=>f(e,8),e.useRedoInformation=e=>{var s;const t=q(e),[,,[l]]=ue(t);return[!C(l),ie(t),l,null!=(s=k(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>f(e,6),e.useRemoteRowId=_,e.useRemoteRowIdListener=(e,s,t,o,l)=>F("RemoteRowId",P(l),t,o,[e,s]),e.useResultCell=re,e.useResultCellIds=le,e.useResultCellIdsListener=(e,s,t,o,l)=>F("ResultCellIds",x(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>F("ResultCell",x(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>E("ResultRow",x(t),{},[e,s]),e.useResultRowIds=te,e.useResultRowIdsListener=(e,s,t,o)=>F("ResultRowIds",x(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>F("ResultRow",x(l),t,o,[e,s]),e.useResultSortedRowIds=oe,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,u,d)=>F("ResultSortedRowIds",x(d),r,u,[e,s,t,o,l]),e.useResultTable=(e,s)=>E("ResultTable",x(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>F("ResultTable",x(o),s,t,[e]),e.useRow=(e,s,t)=>E(a,L(t),{},[e,s]),e.useRowIds=H,e.useRowIdsListener=(e,s,t,o,l)=>F(n,L(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>F(a,L(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,d)=>G(r,I,o,l,u,d,e,s,t),e.useSetCheckpointCallback=(e=g,s=[],t,o=g,l=[])=>{const r=q(t);return O((s=>k(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>G(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>G(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>G(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>G(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>G(t,r,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>G(o,b,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>G(t,w,e,s,o,l),e.useSliceIds=Z,e.useSliceIdsListener=(e,s,t,o)=>F("SliceIds",T(o),s,t,[e]),e.useSliceRowIds=$,e.useSliceRowIdsListener=(e,s,t,o,l)=>F("SliceRowIds",T(l),t,o,[e,s]),e.useSortedRowIds=J,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,d,n)=>F(i,L(n),r,u,[e,s,t,o,l],d),e.useStore=e=>f(e,0),e.useTable=(e,s)=>E(d,L(s),{},[e]),e.useTableIds=z,e.useTableIdsListener=(e,s,t,o)=>F(u,L(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>F(d,L(l),s,t,[e],o),e.useTables=e=>E(r,L(e),{}),e.useTablesListener=(e,s,t,o)=>F(r,L(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=q(e),[l,r]=ue(t);return[(u=l,!(0==(e=>e.length)(u))),ne(t),r,null!=(s=k(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=X,e.useValueIds=W,e.useValueIdsListener=(e,s,t,o)=>F(p,L(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>F(b,L(l),s,t,[e],o),e.useValues=e=>E(w,L(e),{}),e.useValuesListener=(e,s,t,o)=>F(w,L(o),e,s,[],t)},"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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
".": "./lib/tinybase.js",
|
|
23
23
|
"./package.json": "./package.json",
|
|
24
|
+
"./es6": "./lib/es6/tinybase.js",
|
|
25
|
+
"./debug": "./lib/debug/tinybase.js",
|
|
26
|
+
"./cjs": "./lib/cjs/tinybase.cjs",
|
|
27
|
+
"./cjs-es6": "./lib/cjs-es6/tinybase.cjs",
|
|
28
|
+
"./umd": "./lib/umd/tinybase.js",
|
|
29
|
+
"./umd-es6": "./lib/umd-es6/tinybase.js",
|
|
30
|
+
"./cjs/*": "./lib/cjs/*.cjs",
|
|
31
|
+
"./cjs-es6/*": "./lib/cjs-es6/*.cjs",
|
|
24
32
|
"./*": "./lib/*.js"
|
|
25
33
|
},
|
|
26
34
|
"bin": {
|
|
@@ -63,62 +71,62 @@
|
|
|
63
71
|
"publishPackage": "gulp publishPackage"
|
|
64
72
|
},
|
|
65
73
|
"devDependencies": {
|
|
66
|
-
"@babel/cli": "^7.
|
|
67
|
-
"@babel/core": "^7.
|
|
74
|
+
"@babel/cli": "^7.21.0",
|
|
75
|
+
"@babel/core": "^7.21.0",
|
|
68
76
|
"@babel/preset-env": "^7.20.2",
|
|
69
77
|
"@babel/preset-react": "^7.18.6",
|
|
70
|
-
"@babel/preset-typescript": "^7.
|
|
78
|
+
"@babel/preset-typescript": "^7.21.0",
|
|
71
79
|
"@rollup/plugin-replace": "^5.0.2",
|
|
72
80
|
"@rollup/plugin-terser": "^0.4.0",
|
|
73
81
|
"@types/asciichart": "^1.5.6",
|
|
74
|
-
"@types/expect-puppeteer": "^5.0.
|
|
82
|
+
"@types/expect-puppeteer": "^5.0.3",
|
|
75
83
|
"@types/http-server": "^0.12.1",
|
|
76
84
|
"@types/jest": "^29.4.0",
|
|
77
85
|
"@types/jest-environment-puppeteer": "^5.0.3",
|
|
78
86
|
"@types/less": "^3.0.3",
|
|
79
|
-
"@types/node": "^18.
|
|
87
|
+
"@types/node": "^18.14.1",
|
|
80
88
|
"@types/puppeteer": "^5.4.7",
|
|
81
|
-
"@types/react": "^18.0.
|
|
82
|
-
"@types/react-dom": "^18.0.
|
|
89
|
+
"@types/react": "^18.0.28",
|
|
90
|
+
"@types/react-dom": "^18.0.11",
|
|
83
91
|
"@types/react-test-renderer": "^18.0.0",
|
|
84
92
|
"@types/tmp": "^0.2.3",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
86
|
-
"@typescript-eslint/parser": "^5.
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
94
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
87
95
|
"asciichart": "^1.5.25",
|
|
88
96
|
"babel-eslint": "^10.1.0",
|
|
89
|
-
"babel-jest": "^29.4.
|
|
97
|
+
"babel-jest": "^29.4.3",
|
|
90
98
|
"babel-preset-minify": "^0.5.2",
|
|
91
99
|
"buffer-replace": "^1.0.0",
|
|
92
100
|
"country-flag-emoji-json": "^2.0.0",
|
|
93
|
-
"cspell": "^6.
|
|
94
|
-
"esbuild": "^0.17.
|
|
95
|
-
"eslint": "^8.
|
|
101
|
+
"cspell": "^6.26.3",
|
|
102
|
+
"esbuild": "^0.17.10",
|
|
103
|
+
"eslint": "^8.34.0",
|
|
96
104
|
"eslint-config-prettier": "^8.6.0",
|
|
97
105
|
"eslint-plugin-jest": "^27.2.1",
|
|
98
|
-
"eslint-plugin-jsdoc": "^
|
|
106
|
+
"eslint-plugin-jsdoc": "^40.0.0",
|
|
99
107
|
"eslint-plugin-react": "^7.32.2",
|
|
100
108
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
101
109
|
"gulp": "^4.0.2",
|
|
102
110
|
"gulp-gzip": "^1.4.2",
|
|
103
111
|
"http-server": "^14.1.1",
|
|
104
|
-
"jest": "^29.4.
|
|
105
|
-
"jest-environment-jsdom": "^29.4.
|
|
112
|
+
"jest": "^29.4.3",
|
|
113
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
106
114
|
"jest-fetch-mock": "^3.0.3",
|
|
107
|
-
"jest-puppeteer": "^
|
|
115
|
+
"jest-puppeteer": "^7.0.1",
|
|
108
116
|
"less": "^4.1.3",
|
|
109
|
-
"prettier": "^2.8.
|
|
110
|
-
"puppeteer": "^
|
|
117
|
+
"prettier": "^2.8.4",
|
|
118
|
+
"puppeteer": "^19.7.2",
|
|
111
119
|
"react": "^18.2.0",
|
|
112
120
|
"react-dom": "^18.2.0",
|
|
113
121
|
"react-test-renderer": "^18.2.0",
|
|
114
|
-
"rollup": "^3.
|
|
122
|
+
"rollup": "^3.17.2",
|
|
115
123
|
"rollup-plugin-esbuild": "^5.0.0",
|
|
116
124
|
"rollup-plugin-gzip": "^3.1.0",
|
|
117
125
|
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
118
126
|
"rollup-plugin-prettier": "^3.0.0",
|
|
119
127
|
"tinydocs": "^0.1.23",
|
|
120
128
|
"tmp": "^0.2.1",
|
|
121
|
-
"ts-unused-exports": "^9.0.
|
|
129
|
+
"ts-unused-exports": "^9.0.4",
|
|
122
130
|
"typescript": "4.9.5"
|
|
123
131
|
},
|
|
124
132
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -266,4 +266,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
266
266
|
};
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.2kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>8.7kB</em>.</p><p>The <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>5.4kB</em>, and everything is fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.2kB</td><td>10.0kB</td><td>43.9kB</td><td>184.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.8kB</td><td>29.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.6kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.6kB</td><td>5.5kB</td><td>24.9kB</td><td>106.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.0kB</td><td>12.5kB</td><td>33.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.7kB</td><td>5.2kB</td><td>27.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.7kB</td><td>21.1kB</td><td>92.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,
|
|
269
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.2kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>8.7kB</em>.</p><p>The <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>5.4kB</em>, and everything is fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.2kB</td><td>10.0kB</td><td>43.9kB</td><td>184.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.8kB</td><td>29.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.6kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.6kB</td><td>5.5kB</td><td>24.9kB</td><td>106.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.0kB</td><td>12.5kB</td><td>33.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.7kB</td><td>5.2kB</td><td>27.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.7kB</td><td>21.1kB</td><td>92.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,792</td><td>1,792</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,930</td><td>1,930</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>768</td><td>768</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>630</td><td>630</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">2,581</td></tr><tr><th class="right">Assertions</th><td colspan="3">12,421</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussion">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/3.0.3">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>
|