tinybase 4.3.18 → 4.3.20

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.
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",u="Result",d="Ids",l="Table",n=l+"s",p=l+d,i="Row",a=i+"Count",I=i+d,x="Sorted"+i+d,c="Cell",C=c+d,w="Value",b=w+"s",R=w+d,k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),h=e=>s(e)==o,L=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:S,useContext:V}=e,T=S([]),v=(e,s)=>{const t=V(T);return k(e)?t[s]:h(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return k(e)||h(e)?t:e},q=e=>y(V(T)[e]??{}),B=e=>P(e,0),f=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),F=e=>P(e,8),O=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const A="Transaction";Q(A);const{useCallback:E,useEffect:G,useMemo:W,useRef:j,useState:U}=e,z=(e,s,t=[])=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,u]=U(),d=E((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=U(d),n=j(l);return W((()=>n.current=d()),[d]),J(e,s,((...e)=>{n.current=k(r)?d():e[r],u([])}),[],o),n.current},J=(e,s,t,o=[],u=[],...d)=>G((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,...u,...o,...d]),K=(e,s,t,o=[],r=L,u=[],...d)=>{const l=B(e);return E((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},N=(e,s,t=L,o=[],...r)=>{const u=B(e);return E((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},X=(e,s,t)=>{const o=O(e);return E((()=>o?.[s](t)),[o,s,t])},Y=e=>H(p,B(e),[],[]),Z=(e,s)=>H(I,B(s),[],[e]),$=(e,s,t,o=0,r,u)=>H(x,B(u),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,B(t),[],[e,s]),ee=(e,s,t,o)=>H(c,B(o),void 0,[e,s,t],4),se=e=>H(R,B(e),[],[]),te=(e,s)=>H(w,B(s),void 0,[e]),oe=(e,s)=>H("Metric",f(s),void 0,[e]),re=(e,s)=>H("SliceIds",M(s),[],[e]),ue=(e,s,t)=>H("Slice"+I,M(t),[],[e,s]),de=(e,s,t)=>H("RemoteRowId",D(t),void 0,[e,s]),le=(e,s,t)=>H("Local"+I,D(t),[],[e,s]),ne=(e,s,t)=>H("Linked"+I,D(t),[],[e,s]),pe=(e,s)=>H(u+I,F(s),[],[e]),ie=(e,s,t,o=0,r,d)=>H(u+x,F(d),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(u+C,F(t),[],[e,s]),Ie=(e,s,t,o)=>H(u+c,F(o),void 0,[e,s,t]),xe=e=>H("CheckpointIds",O(e),[[],void 0,[]]),ce=(e,s)=>H("Checkpoint",O(s),void 0,[e]),Ce=e=>X(e,"goBackward"),we=e=>X(e,"goForward"),{PureComponent:be,Fragment:Re,createElement:ke,useCallback:ge,useLayoutEffect:he,useRef:Le,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=e,Te=({tableId:e,store:s,rowComponent:t=Me,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(m(l,(u=>ke(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ae,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(m(d,(r=>ke(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=Me,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Se(D(s),e),a=d(e,l,n);return Be(m(a,(e=>ke(t,{...ye(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ee,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Be(m(e(xe(d)),(e=>ke(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Be(t+(ee(e,s,o,r)??t),void 0,u,o),Me=({tableId:e,rowId:s,store:t,cellComponent:o=fe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(m(((e,s,t,o)=>{const r=_(s,t,o);return e??r})(u,e,s,t),(u=>ke(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),De=e=>Te(e,Z(e.tableId,e.store)),Fe=({valueId:e,store:s,debugIds:o})=>Be(t+(te(e,s)??t),void 0,o,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Me,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=ue(e,s,l);return Be(m(i,(e=>ke(o,{...ye(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Be(t+(Ie(e,s,o,r)??t),void 0,u,o),Ae=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(m(ae(e,s,t),(u=>ke(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ee=({checkpoints:e,checkpointId:s,debugIds:o})=>Be(ce(s,e)??t,void 0,o,s),Ge=qe((e=>e[0])),We=qe((e=>k(e[1])?[]:[e[1]])),je=qe((e=>e[2]));exports.BackwardCheckpointsView=Ge,exports.CellView=fe,exports.CheckpointView=Ee,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(m(re(e,s),(r=>ke(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Pe(e,ne,e.firstRowId),exports.LocalRowsView=e=>Pe(e,le,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Be(oe(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:p,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(T);return ke(T.Provider,{value:Ve((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...n},p??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Me,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Se(D(t),e),p=de(e,s,d);return Be(k(n)||k(p)?null:ke(o,{...ye(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Qe,exports.ResultRowView=Ae,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,ie(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ve(e,pe(e.queryId,e.queries)),exports.RowView=Me,exports.SliceView=Oe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,$(r.tableId,e,s,t,o,r.store)),exports.TableView=De,exports.TablesView=({store:e,tableComponent:s=De,getTableComponentProps:t,separator:o,debugIds:r})=>Be(m(Y(e),(o=>ke(s,{...ye(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Fe,exports.ValuesView=({store:e,valueComponent:s=Fe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(m(se(e),(o=>ke(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=L,u=[],d=!0)=>{const l=B(o);return E((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,u)=>J(C,B(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>J(c,B(d),o,r,[e,s,t],u),exports.useCheckpoint=ce,exports.useCheckpointIds=xe,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=U(),d=W((()=>s(e)),[e,...t]);return G((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d?.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>N(r,c,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+A,B(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=we,exports.useGoToCallback=(e,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>H("IndexIds",M(e),[]),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=ne,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=le,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+I,D(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",f(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",f(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=f,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>H("QueryIds",F(e),[]),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=xe(s);return[!k(o),we(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>H("RelationshipIds",D(e),[]),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=de,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=Ie,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>J(u+c,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(u+i,F(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(u+a,F(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(u+a,F(o),s,t,[e]),exports.useResultRowIds=pe,exports.useResultRowIdsListener=(e,s,t,o)=>J(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=ie,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>J(u+x,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(u+l,F(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(u+l+C,F(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>H(i,B(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,B(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,B(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(I,B(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>J(i,B(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>K(u,c,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>K(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>K(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>K(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>K(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,b,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=ue,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>J(x,B(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>J("Start"+A,B(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=B,exports.useTable=(e,s)=>H(l,B(s),{},[e]),exports.useTableCellIds=(e,s)=>H(l+C,B(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(l+C,B(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(p,B(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(l,B(r),s,t,[e],o),exports.useTables=e=>H(n,B(e),{}),exports.useTablesListener=(e,s,t,o)=>J(n,B(o),e,s,[],t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=xe(s);return[(u=o,!(0==u.length)),Ce(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,B(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(w,B(r),s,t,[e],o),exports.useValues=e=>H(b,B(e),{}),exports.useValuesListener=(e,s,t,o)=>J(b,B(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+A,B(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",u="Result",d="Ids",l="Table",n=l+"s",p=l+d,i="Row",a=i+"Count",I=i+d,x="Sorted"+i+d,c="Cell",C=c+d,w="Value",b=w+"s",R=w+d,k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),h=e=>s(e)==o,L=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:S,useContext:V}=e,T=S([]),v=(e,s)=>{const t=V(T);return k(e)?t[s]:h(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return k(e)||h(e)?t:e},q=e=>y(V(T)[e]??{}),B=e=>P(e,0),f=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),F=e=>P(e,8),O=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const A="Transaction";Q(A);const{useCallback:E,useEffect:G,useMemo:W,useRef:j,useState:U}=e,z=(e,s,t=[])=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,u]=U(),d=E((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=U(d),n=j(l);return W((()=>n.current=d()),[d]),J(e,s,((...e)=>{n.current=k(r)?d():e[r],u([])}),[],o),n.current},J=(e,s,t,o=[],u=[],...d)=>G((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,...u,...o,...d]),K=(e,s,t,o=[],r=L,u=[],...d)=>{const l=B(e);return E((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},N=(e,s,t=L,o=[],...r)=>{const u=B(e);return E((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},X=(e,s,t)=>{const o=O(e);return E((()=>o?.[s](t)),[o,s,t])},Y=e=>H(p,B(e),[],[]),Z=(e,s)=>H(I,B(s),[],[e]),$=(e,s,t,o=0,r,u)=>H(x,B(u),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,B(t),[],[e,s]),ee=(e,s,t,o)=>H(c,B(o),void 0,[e,s,t],4),se=e=>H(R,B(e),[],[]),te=(e,s)=>H(w,B(s),void 0,[e]),oe=(e,s)=>H("Metric",f(s),void 0,[e]),re=(e,s)=>H("SliceIds",M(s),[],[e]),ue=(e,s,t)=>H("Slice"+I,M(t),[],[e,s]),de=(e,s,t)=>H("RemoteRowId",D(t),void 0,[e,s]),le=(e,s,t)=>H("Local"+I,D(t),[],[e,s]),ne=(e,s,t)=>H("Linked"+I,D(t),[],[e,s]),pe=(e,s)=>H(u+I,F(s),[],[e]),ie=(e,s,t,o=0,r,d)=>H(u+x,F(d),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(u+C,F(t),[],[e,s]),Ie=(e,s,t,o)=>H(u+c,F(o),void 0,[e,s,t]),xe=e=>H("CheckpointIds",O(e),[[],void 0,[]]),ce=(e,s)=>H("Checkpoint",O(s),void 0,[e]),Ce=e=>X(e,"goBackward"),we=e=>X(e,"goForward"),{PureComponent:be,Fragment:Re,createElement:ke,useCallback:ge,useLayoutEffect:he,useRef:Le,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=e,Te=({tableId:e,store:s,rowComponent:t=Me,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(m(l,(u=>ke(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ae,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(m(d,(r=>ke(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=Me,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Se(D(s),e),a=d(e,l,n);return Be(m(a,(e=>ke(t,{...ye(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ee,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Be(m(e(xe(d)),(e=>ke(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Be(t+(ee(e,s,o,r)??t),void 0,u,o),Me=({tableId:e,rowId:s,store:t,cellComponent:o=fe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(m(((e,s,t,o)=>{const r=_(s,t,o);return e??r})(u,e,s,t),(u=>ke(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),De=e=>Te(e,Z(e.tableId,e.store)),Fe=({valueId:e,store:s,debugIds:o})=>Be(t+(te(e,s)??t),void 0,o,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Me,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=ue(e,s,l);return Be(m(i,(e=>ke(o,{...ye(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Be(t+(Ie(e,s,o,r)??t),void 0,u,o),Ae=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(m(ae(e,s,t),(u=>ke(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ee=({checkpoints:e,checkpointId:s,debugIds:o})=>Be(ce(s,e)??t,void 0,o,s),Ge=qe((e=>e[0])),We=qe((e=>k(e[1])?[]:[e[1]])),je=qe((e=>e[2]));exports.BackwardCheckpointsView=Ge,exports.CellView=fe,exports.CheckpointView=Ee,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(m(re(e,s),(r=>ke(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Pe(e,ne,e.firstRowId),exports.LocalRowsView=e=>Pe(e,le,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Be(oe(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:p,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(T);return ke(T.Provider,{value:Ve((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...n},p??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Me,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Se(D(t),e),p=de(e,s,d);return Be(k(n)||k(p)?null:ke(o,{...ye(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Qe,exports.ResultRowView=Ae,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,ie(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ve(e,pe(e.queryId,e.queries)),exports.RowView=Me,exports.SliceView=Oe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,$(r.tableId,e,s,t,o,r.store)),exports.TableView=De,exports.TablesView=({store:e,tableComponent:s=De,getTableComponentProps:t,separator:o,debugIds:r})=>Be(m(Y(e),(o=>ke(s,{...ye(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Fe,exports.ValuesView=({store:e,valueComponent:s=Fe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(m(se(e),(o=>ke(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=L,u=[],d=!0)=>{const l=B(o);return E((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,u)=>J(C,B(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>J(c,B(d),o,r,[e,s,t],u),exports.useCheckpoint=ce,exports.useCheckpointIds=xe,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[],u,d=[])=>{const[,l]=U(),n=W((()=>s(e)),[e,...t]);return G((()=>((async()=>{o&&(await o(n),l([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...d]),n},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>N(r,c,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+A,B(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=we,exports.useGoToCallback=(e,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>H("IndexIds",M(e),[]),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=ne,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=le,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+I,D(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",f(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",f(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=f,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>H("QueryIds",F(e),[]),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=xe(s);return[!k(o),we(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>H("RelationshipIds",D(e),[]),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=de,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=Ie,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>J(u+c,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(u+i,F(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(u+a,F(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(u+a,F(o),s,t,[e]),exports.useResultRowIds=pe,exports.useResultRowIdsListener=(e,s,t,o)=>J(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=ie,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>J(u+x,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(u+l,F(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(u+l+C,F(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>H(i,B(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,B(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,B(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(I,B(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>J(i,B(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>K(u,c,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>K(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>K(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>K(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>K(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,b,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=ue,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>J(x,B(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>J("Start"+A,B(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=B,exports.useTable=(e,s)=>H(l,B(s),{},[e]),exports.useTableCellIds=(e,s)=>H(l+C,B(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(l+C,B(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(p,B(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(l,B(r),s,t,[e],o),exports.useTables=e=>H(n,B(e),{}),exports.useTablesListener=(e,s,t,o)=>J(n,B(o),e,s,[],t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=xe(s);return[(u=o,!(0==u.length)),Ce(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,B(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(w,B(r),s,t,[e],o),exports.useValues=e=>H(b,B(e),{}),exports.useValuesListener=(e,s,t,o)=>J(b,B(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+A,B(t),e,s);
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",l="Result",u="Ids",n="Table",d=n+"s",i=n+u,p="Row",a=p+"Count",c=p+u,I="Sorted"+p+u,x="Cell",C=x+u,b="Value",w=b+"s",R=b+u,k=e=>null==e,v=(e,s,t)=>k(e)?null==t?void 0:t():s(e),g=e=>s(e)==o,h=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:L,useContext:S}=e,V=L([]),f=(e,s)=>{var t;const o=S(V);return k(e)?o[s]:g(e)?((e,s)=>v(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},T=(e,s)=>{const t=f(e,s);return k(e)||g(e)?t:e},P=e=>{var s;return y(null!=(s=S(V)[e])?s:{})},O=e=>T(e,0),q=e=>T(e,2),B=e=>T(e,4),M=e=>T(e,6),D=e=>T(e,8),F=e=>T(e,10),j=e=>e.toLowerCase();j(r);const Q="Transaction";j(Q);const{useCallback:E,useEffect:A,useMemo:G,useRef:W,useState:U}=e,z=(e,s,t=[])=>{const o=G((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,l]=U(),u=E((()=>{var r,l;return null!=(l=null==(r=null==s?void 0:s["get"+e])?void 0:r.call(s,...o))?l:t}),[s,...o]),[n]=U(u),d=W(n);return G((()=>d.current=u()),[u]),J(e,s,((...e)=>{d.current=k(r)?u():e[r],l([])}),[],o),d.current},J=(e,s,t,o=[],l=[],...u)=>A((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),K=(e,s,t,o=[],r=h,l=[],...u)=>{const n=O(e);return E((e=>v(n,(o=>v(t(e,o),(e=>r(o["set"+s](...u,e),e)))))),[n,s,...o,...l,...u])},N=(e,s,t=h,o=[],...r)=>{const l=O(e);return E((()=>t(null==l?void 0:l["del"+s](...r))),[l,s,...o,...r])},X=(e,s,t)=>{const o=F(e);return E((()=>null==o?void 0:o[s](t)),[o,s,t])},Y=e=>H(i,O(e),[],[]),Z=(e,s)=>H(c,O(s),[],[e]),$=(e,s,t,o=0,r,l)=>H(I,O(l),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,O(t),[],[e,s]),ee=(e,s,t,o)=>H(x,O(o),void 0,[e,s,t],4),se=e=>H(R,O(e),[],[]),te=(e,s)=>H(b,O(s),void 0,[e]),oe=(e,s)=>H("Metric",q(s),void 0,[e]),re=(e,s)=>H("SliceIds",B(s),[],[e]),le=(e,s,t)=>H("Slice"+c,B(t),[],[e,s]),ue=(e,s,t)=>H("RemoteRowId",M(t),void 0,[e,s]),ne=(e,s,t)=>H("Local"+c,M(t),[],[e,s]),de=(e,s,t)=>H("Linked"+c,M(t),[],[e,s]),ie=(e,s)=>H(l+c,D(s),[],[e]),pe=(e,s,t,o=0,r,u)=>H(l+I,D(u),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(l+C,D(t),[],[e,s]),ce=(e,s,t,o)=>H(l+x,D(o),void 0,[e,s,t]),Ie=e=>H("CheckpointIds",F(e),[[],void 0,[]]),xe=(e,s)=>H("Checkpoint",F(s),void 0,[e]),Ce=e=>X(e,"goBackward"),be=e=>X(e,"goForward"),{PureComponent:we,Fragment:Re,createElement:ke,useCallback:ve,useLayoutEffect:ge,useRef:he,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Le=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Se=Object.defineProperty,Ve=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,qe=(e,s,t)=>s in e?Se(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Be=(e,s)=>{for(var t in s||(s={}))Pe.call(s,t)&&qe(e,t,s[t]);if(Te)for(var t of Te(s))Oe.call(s,t)&&qe(e,t,s[t]);return e},Me=(e,s)=>Ve(e,fe(s)),De=(e,s)=>{var t={};for(var o in e)Pe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Te)for(var o of Te(e))s.indexOf(o)<0&&Oe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=e,je=({tableId:e,store:s,rowComponent:t=Ue,getRowComponentProps:o,customCellIds:r,separator:l,debugIds:u},n)=>Ge(m(n,(l=>ke(t,Me(Be({},ye(o,l)),{key:l,tableId:e,rowId:l,customCellIds:r,store:s,debugIds:u})))),l,u,e),Qe=({queryId:e,queries:s,resultRowComponent:t=Ne,getResultRowComponentProps:o,separator:r,debugIds:l},u)=>Ge(m(u,(r=>ke(t,Me(Be({},ye(o,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:l})))),r,l,e),Ee=({relationshipId:e,relationships:s,rowComponent:t=Ue,getRowComponentProps:o,separator:r,debugIds:l},u,n)=>{const[d,i,p]=Le(M(s),e),a=u(e,n,d);return Ge(m(a,(e=>ke(t,Me(Be({},ye(o,e)),{key:e,tableId:p,rowId:e,store:i,debugIds:l})))),r,l,n)},Ae=e=>({checkpoints:s,checkpointComponent:t=Xe,getCheckpointComponentProps:o,separator:r,debugIds:l})=>{const u=F(s);return Ge(m(e(Ie(u)),(e=>ke(t,Me(Be({},ye(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),r)},Ge=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},We=({tableId:e,rowId:s,cellId:o,store:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ee(e,s,o,r))?u:t),void 0,l,o)},Ue=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:r,customCellIds:l,separator:u,debugIds:n})=>Ge(m(((e,s,t,o)=>{const r=_(s,t,o);return null!=e?e:r})(l,e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),ze=e=>je(e,Z(e.tableId,e.store)),He=({valueId:e,store:s,debugIds:o})=>{var r;return Ge(t+(null!=(r=te(e,s))?r:t),void 0,o,e)},Je=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ue,getRowComponentProps:r,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),p=le(e,s,n);return Ge(m(p,(e=>ke(o,Me(Be({},ye(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},Ke=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ce(e,s,o,r))?u:t),void 0,l,o)},Ne=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ke,getResultCellComponentProps:r,separator:l,debugIds:u})=>Ge(m(ae(e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),Xe=({checkpoints:e,checkpointId:s,debugIds:o})=>{var r;return Ge(null!=(r=xe(s,e))?r:t,void 0,o,s)},Ye=Ae((e=>e[0])),Ze=Ae((e=>k(e[1])?[]:[e[1]])),$e=Ae((e=>e[2]));exports.BackwardCheckpointsView=Ye,exports.CellView=We,exports.CheckpointView=Xe,exports.CurrentCheckpointView=Ze,exports.ForwardCheckpointsView=$e,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Je,getSliceComponentProps:o,separator:r,debugIds:l})=>Ge(m(re(e,s),(r=>ke(t,Me(Be({},ye(o,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:l})))),r,l,e),exports.LinkedRowsView=e=>Ee(e,de,e.firstRowId),exports.LocalRowsView=e=>Ee(e,ne,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>{var r;return Ge(null!=(r=oe(e,s))?r:t,void 0,o,e)},exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:l,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:p,checkpoints:a,checkpointsById:c,children:I})=>{const x=e.useContext(V);return ke(V.Provider,{value:Fe((()=>[null!=s?s:x[0],Be(Be({},x[1]),t),null!=o?o:x[2],Be(Be({},x[3]),r),null!=l?l:x[4],Be(Be({},x[5]),u),null!=n?n:x[6],Be(Be({},x[7]),d),null!=i?i:x[8],Be(Be({},x[9]),p),null!=a?a:x[10],Be(Be({},x[11]),c)]),[s,t,o,r,l,u,n,d,i,p,a,c,x])},I)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ue,getRowComponentProps:r,debugIds:l})=>{const[u,n,,d]=Le(M(t),e),i=ue(e,s,u);return Ge(k(d)||k(i)?null:ke(o,Me(Be({},ye(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=Ke,exports.ResultRowView=Ne,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return Qe(u,pe(u.queryId,t,o,r,l,u.queries))},exports.ResultTableView=e=>Qe(e,ie(e.queryId,e.queries)),exports.RowView=Ue,exports.SliceView=Je,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return je(u,$(u.tableId,t,o,r,l,u.store))},exports.TableView=ze,exports.TablesView=({store:e,tableComponent:s=ze,getTableComponentProps:t,separator:o,debugIds:r})=>Ge(m(Y(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,tableId:o,store:e,debugIds:r})))),o),exports.ValueView=He,exports.ValuesView=({store:e,valueComponent:s=He,getValueComponentProps:t,separator:o,debugIds:r})=>Ge(m(se(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,valueId:o,store:e,debugIds:r})))),o),exports.useAddRowCallback=(e,s,t=[],o,r=h,l=[],u=!0)=>{const n=O(o);return E((t=>v(n,(o=>v(s(t,o),(s=>r(o.addRow(e,s,u),o,s)))))),[n,e,...t,...l,u])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,l)=>J(C,O(l),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,l,u)=>J(x,O(u),o,r,[e,s,t],l),exports.useCheckpoint=xe,exports.useCheckpointIds=Ie,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",F(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",F(o),s,t,[e]),exports.useCheckpoints=e=>f(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=F,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,l]=U(),u=G((()=>s(e)),[e,...t]);return A((()=>{var e;return e=function*(){yield null==o?void 0:o(u),l(1)},new Promise(((s,t)=>{var o=s=>{try{l(e.next(s))}catch(e){t(e)}},r=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,r);l((e=e.apply(void 0,null)).next())})),()=>{null==u||u.destroy()}}),[u,...r]),u},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>G(e,s),exports.useDelCellCallback=(e,s,t,o,r,l,u)=>N(r,x,l,u,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,p,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,n,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,d,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,b,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,w,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+Q,O(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=be,exports.useGoToCallback=(e,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>v(e(s),(e=>o(t.goTo(e),e)))))),[l,...s,...r])},exports.useIndexIds=e=>H("IndexIds",B(e),[]),exports.useIndexes=e=>f(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=B,exports.useLinkedRowIds=de,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+c,M(r),t,o,[e,s]),exports.useLocalRowIds=ne,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+c,M(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",q(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",q(o),s,t,[e]),exports.useMetrics=e=>f(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=q,exports.useQueries=e=>f(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=D,exports.useQueryIds=e=>H("QueryIds",D(e),[]),exports.useRedoInformation=e=>{var s;const o=F(e),[,,[r]]=Ie(o);return[!k(r),be(o),r,null!=(s=v(r,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>H("RelationshipIds",M(e),[]),exports.useRelationships=e=>f(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=ue,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ce,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(l+C,D(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>J(l+x,D(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(l+p,D(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(l+a,D(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(l+a,D(o),s,t,[e]),exports.useResultRowIds=ie,exports.useResultRowIdsListener=(e,s,t,o)=>J(l+c,D(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(l+p,D(r),t,o,[e,s]),exports.useResultSortedRowIds=pe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>J(l+I,D(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(l+n,D(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(l+n+C,D(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(l+n+C,D(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(l+n,D(o),s,t,[e]),exports.useRow=(e,s,t)=>H(p,O(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,O(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,O(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(c,O(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,l)=>J(p,O(l),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,l,u,n)=>K(l,x,o,r,u,n,e,s,t),exports.useSetCheckpointCallback=(e=h,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[l,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,l,u)=>K(r,"PartialRow",t,o,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,l,u)=>K(r,p,t,o,l,u,e,s),exports.useSetTableCallback=(e,s,t,o,r,l)=>K(o,n,s,t,r,l,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,d,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,l)=>K(o,b,s,t,r,l,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,w,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",B(o),s,t,[e]),exports.useSliceRowIds=le,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+c,B(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,l,u,n,d)=>J(I,O(d),l,u,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>J("Start"+Q,O(t),e,s),exports.useStore=e=>f(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=O,exports.useTable=(e,s)=>H(n,O(s),{},[e]),exports.useTableCellIds=(e,s)=>H(n+C,O(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(n+C,O(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(i,O(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(n,O(r),s,t,[e],o),exports.useTables=e=>H(d,O(e),{}),exports.useTablesListener=(e,s,t,o)=>J(d,O(o),e,s,[],t),exports.useUndoInformation=e=>{var s;const o=F(e),[r,l]=Ie(o);return[(u=r,!(0==u.length)),Ce(o),l,null!=(s=v(l,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,O(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(b,O(r),s,t,[e],o),exports.useValues=e=>H(w,O(e),{}),exports.useValuesListener=(e,s,t,o)=>J(w,O(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+Q,O(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",l="Result",u="Ids",n="Table",d=n+"s",i=n+u,p="Row",a=p+"Count",c=p+u,I="Sorted"+p+u,x="Cell",C=x+u,b="Value",w=b+"s",R=b+u,k=e=>null==e,v=(e,s,t)=>k(e)?null==t?void 0:t():s(e),g=e=>s(e)==o,h=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:L,useContext:S}=e,V=L([]),f=(e,s)=>{var t;const o=S(V);return k(e)?o[s]:g(e)?((e,s)=>v(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},T=(e,s)=>{const t=f(e,s);return k(e)||g(e)?t:e},P=e=>{var s;return y(null!=(s=S(V)[e])?s:{})},O=e=>T(e,0),q=e=>T(e,2),B=e=>T(e,4),M=e=>T(e,6),D=e=>T(e,8),F=e=>T(e,10),j=e=>e.toLowerCase();j(r);const Q="Transaction";j(Q);const{useCallback:E,useEffect:A,useMemo:G,useRef:W,useState:U}=e,z=(e,s,t=[])=>{const o=G((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,l]=U(),u=E((()=>{var r,l;return null!=(l=null==(r=null==s?void 0:s["get"+e])?void 0:r.call(s,...o))?l:t}),[s,...o]),[n]=U(u),d=W(n);return G((()=>d.current=u()),[u]),J(e,s,((...e)=>{d.current=k(r)?u():e[r],l([])}),[],o),d.current},J=(e,s,t,o=[],l=[],...u)=>A((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),K=(e,s,t,o=[],r=h,l=[],...u)=>{const n=O(e);return E((e=>v(n,(o=>v(t(e,o),(e=>r(o["set"+s](...u,e),e)))))),[n,s,...o,...l,...u])},N=(e,s,t=h,o=[],...r)=>{const l=O(e);return E((()=>t(null==l?void 0:l["del"+s](...r))),[l,s,...o,...r])},X=(e,s,t)=>{const o=F(e);return E((()=>null==o?void 0:o[s](t)),[o,s,t])},Y=e=>H(i,O(e),[],[]),Z=(e,s)=>H(c,O(s),[],[e]),$=(e,s,t,o=0,r,l)=>H(I,O(l),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,O(t),[],[e,s]),ee=(e,s,t,o)=>H(x,O(o),void 0,[e,s,t],4),se=e=>H(R,O(e),[],[]),te=(e,s)=>H(b,O(s),void 0,[e]),oe=(e,s)=>H("Metric",q(s),void 0,[e]),re=(e,s)=>H("SliceIds",B(s),[],[e]),le=(e,s,t)=>H("Slice"+c,B(t),[],[e,s]),ue=(e,s,t)=>H("RemoteRowId",M(t),void 0,[e,s]),ne=(e,s,t)=>H("Local"+c,M(t),[],[e,s]),de=(e,s,t)=>H("Linked"+c,M(t),[],[e,s]),ie=(e,s)=>H(l+c,D(s),[],[e]),pe=(e,s,t,o=0,r,u)=>H(l+I,D(u),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(l+C,D(t),[],[e,s]),ce=(e,s,t,o)=>H(l+x,D(o),void 0,[e,s,t]),Ie=e=>H("CheckpointIds",F(e),[[],void 0,[]]),xe=(e,s)=>H("Checkpoint",F(s),void 0,[e]),Ce=e=>X(e,"goBackward"),be=e=>X(e,"goForward"),{PureComponent:we,Fragment:Re,createElement:ke,useCallback:ve,useLayoutEffect:ge,useRef:he,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Le=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Se=Object.defineProperty,Ve=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,qe=(e,s,t)=>s in e?Se(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Be=(e,s)=>{for(var t in s||(s={}))Pe.call(s,t)&&qe(e,t,s[t]);if(Te)for(var t of Te(s))Oe.call(s,t)&&qe(e,t,s[t]);return e},Me=(e,s)=>Ve(e,fe(s)),De=(e,s)=>{var t={};for(var o in e)Pe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Te)for(var o of Te(e))s.indexOf(o)<0&&Oe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=e,je=({tableId:e,store:s,rowComponent:t=Ue,getRowComponentProps:o,customCellIds:r,separator:l,debugIds:u},n)=>Ge(m(n,(l=>ke(t,Me(Be({},ye(o,l)),{key:l,tableId:e,rowId:l,customCellIds:r,store:s,debugIds:u})))),l,u,e),Qe=({queryId:e,queries:s,resultRowComponent:t=Ne,getResultRowComponentProps:o,separator:r,debugIds:l},u)=>Ge(m(u,(r=>ke(t,Me(Be({},ye(o,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:l})))),r,l,e),Ee=({relationshipId:e,relationships:s,rowComponent:t=Ue,getRowComponentProps:o,separator:r,debugIds:l},u,n)=>{const[d,i,p]=Le(M(s),e),a=u(e,n,d);return Ge(m(a,(e=>ke(t,Me(Be({},ye(o,e)),{key:e,tableId:p,rowId:e,store:i,debugIds:l})))),r,l,n)},Ae=e=>({checkpoints:s,checkpointComponent:t=Xe,getCheckpointComponentProps:o,separator:r,debugIds:l})=>{const u=F(s);return Ge(m(e(Ie(u)),(e=>ke(t,Me(Be({},ye(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),r)},Ge=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},We=({tableId:e,rowId:s,cellId:o,store:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ee(e,s,o,r))?u:t),void 0,l,o)},Ue=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:r,customCellIds:l,separator:u,debugIds:n})=>Ge(m(((e,s,t,o)=>{const r=_(s,t,o);return null!=e?e:r})(l,e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),ze=e=>je(e,Z(e.tableId,e.store)),He=({valueId:e,store:s,debugIds:o})=>{var r;return Ge(t+(null!=(r=te(e,s))?r:t),void 0,o,e)},Je=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ue,getRowComponentProps:r,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),p=le(e,s,n);return Ge(m(p,(e=>ke(o,Me(Be({},ye(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},Ke=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ce(e,s,o,r))?u:t),void 0,l,o)},Ne=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ke,getResultCellComponentProps:r,separator:l,debugIds:u})=>Ge(m(ae(e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),Xe=({checkpoints:e,checkpointId:s,debugIds:o})=>{var r;return Ge(null!=(r=xe(s,e))?r:t,void 0,o,s)},Ye=Ae((e=>e[0])),Ze=Ae((e=>k(e[1])?[]:[e[1]])),$e=Ae((e=>e[2]));exports.BackwardCheckpointsView=Ye,exports.CellView=We,exports.CheckpointView=Xe,exports.CurrentCheckpointView=Ze,exports.ForwardCheckpointsView=$e,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Je,getSliceComponentProps:o,separator:r,debugIds:l})=>Ge(m(re(e,s),(r=>ke(t,Me(Be({},ye(o,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:l})))),r,l,e),exports.LinkedRowsView=e=>Ee(e,de,e.firstRowId),exports.LocalRowsView=e=>Ee(e,ne,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>{var r;return Ge(null!=(r=oe(e,s))?r:t,void 0,o,e)},exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:l,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:p,checkpoints:a,checkpointsById:c,children:I})=>{const x=e.useContext(V);return ke(V.Provider,{value:Fe((()=>[null!=s?s:x[0],Be(Be({},x[1]),t),null!=o?o:x[2],Be(Be({},x[3]),r),null!=l?l:x[4],Be(Be({},x[5]),u),null!=n?n:x[6],Be(Be({},x[7]),d),null!=i?i:x[8],Be(Be({},x[9]),p),null!=a?a:x[10],Be(Be({},x[11]),c)]),[s,t,o,r,l,u,n,d,i,p,a,c,x])},I)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ue,getRowComponentProps:r,debugIds:l})=>{const[u,n,,d]=Le(M(t),e),i=ue(e,s,u);return Ge(k(d)||k(i)?null:ke(o,Me(Be({},ye(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=Ke,exports.ResultRowView=Ne,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return Qe(u,pe(u.queryId,t,o,r,l,u.queries))},exports.ResultTableView=e=>Qe(e,ie(e.queryId,e.queries)),exports.RowView=Ue,exports.SliceView=Je,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return je(u,$(u.tableId,t,o,r,l,u.store))},exports.TableView=ze,exports.TablesView=({store:e,tableComponent:s=ze,getTableComponentProps:t,separator:o,debugIds:r})=>Ge(m(Y(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,tableId:o,store:e,debugIds:r})))),o),exports.ValueView=He,exports.ValuesView=({store:e,valueComponent:s=He,getValueComponentProps:t,separator:o,debugIds:r})=>Ge(m(se(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,valueId:o,store:e,debugIds:r})))),o),exports.useAddRowCallback=(e,s,t=[],o,r=h,l=[],u=!0)=>{const n=O(o);return E((t=>v(n,(o=>v(s(t,o),(s=>r(o.addRow(e,s,u),o,s)))))),[n,e,...t,...l,u])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,l)=>J(C,O(l),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,l,u)=>J(x,O(u),o,r,[e,s,t],l),exports.useCheckpoint=xe,exports.useCheckpointIds=Ie,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",F(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",F(o),s,t,[e]),exports.useCheckpoints=e=>f(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=F,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[],l,u=[])=>{const[,n]=U(),d=G((()=>s(e)),[e,...t]);return A((()=>{var e;return e=function*(){o&&(yield o(d),n([]))},new Promise(((s,t)=>{var o=s=>{try{l(e.next(s))}catch(e){t(e)}},r=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,r);l((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==l||l(d)}}),[d,...r,...u]),d},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>G(e,s),exports.useDelCellCallback=(e,s,t,o,r,l,u)=>N(r,x,l,u,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,p,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,n,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,d,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,b,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,w,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+Q,O(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=be,exports.useGoToCallback=(e,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>v(e(s),(e=>o(t.goTo(e),e)))))),[l,...s,...r])},exports.useIndexIds=e=>H("IndexIds",B(e),[]),exports.useIndexes=e=>f(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=B,exports.useLinkedRowIds=de,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+c,M(r),t,o,[e,s]),exports.useLocalRowIds=ne,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+c,M(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",q(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",q(o),s,t,[e]),exports.useMetrics=e=>f(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=q,exports.useQueries=e=>f(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=D,exports.useQueryIds=e=>H("QueryIds",D(e),[]),exports.useRedoInformation=e=>{var s;const o=F(e),[,,[r]]=Ie(o);return[!k(r),be(o),r,null!=(s=v(r,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>H("RelationshipIds",M(e),[]),exports.useRelationships=e=>f(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=ue,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ce,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(l+C,D(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>J(l+x,D(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(l+p,D(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(l+a,D(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(l+a,D(o),s,t,[e]),exports.useResultRowIds=ie,exports.useResultRowIdsListener=(e,s,t,o)=>J(l+c,D(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(l+p,D(r),t,o,[e,s]),exports.useResultSortedRowIds=pe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>J(l+I,D(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(l+n,D(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(l+n+C,D(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(l+n+C,D(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(l+n,D(o),s,t,[e]),exports.useRow=(e,s,t)=>H(p,O(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,O(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,O(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(c,O(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,l)=>J(p,O(l),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,l,u,n)=>K(l,x,o,r,u,n,e,s,t),exports.useSetCheckpointCallback=(e=h,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[l,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,l,u)=>K(r,"PartialRow",t,o,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,l,u)=>K(r,p,t,o,l,u,e,s),exports.useSetTableCallback=(e,s,t,o,r,l)=>K(o,n,s,t,r,l,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,d,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,l)=>K(o,b,s,t,r,l,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,w,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",B(o),s,t,[e]),exports.useSliceRowIds=le,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+c,B(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,l,u,n,d)=>J(I,O(d),l,u,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>J("Start"+Q,O(t),e,s),exports.useStore=e=>f(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=O,exports.useTable=(e,s)=>H(n,O(s),{},[e]),exports.useTableCellIds=(e,s)=>H(n+C,O(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(n+C,O(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(i,O(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(n,O(r),s,t,[e],o),exports.useTables=e=>H(d,O(e),{}),exports.useTablesListener=(e,s,t,o)=>J(d,O(o),e,s,[],t),exports.useUndoInformation=e=>{var s;const o=F(e),[r,l]=Ie(o);return[(u=r,!(0==u.length)),Ce(o),l,null!=(s=v(l,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,O(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(b,O(r),s,t,[e],o),exports.useValues=e=>H(w,O(e),{}),exports.useValuesListener=(e,s,t,o)=>J(w,O(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+Q,O(t),e,s);
Binary file
@@ -1086,8 +1086,10 @@ const useCreatePersister = (
1086
1086
  createDeps = [],
1087
1087
  then,
1088
1088
  thenDeps = [],
1089
+ destroy,
1090
+ destroyDeps = [],
1089
1091
  ) => {
1090
- const [, setDone] = useState$1();
1092
+ const [, rerender] = useState$1();
1091
1093
  const persister = useMemo$1(
1092
1094
  () => create(store),
1093
1095
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1096,16 +1098,18 @@ const useCreatePersister = (
1096
1098
  useEffect(
1097
1099
  () => {
1098
1100
  (async () => {
1099
- await then?.(persister);
1100
- setDone(1);
1101
- return;
1101
+ if (then) {
1102
+ await then(persister);
1103
+ rerender([]);
1104
+ }
1102
1105
  })();
1103
1106
  return () => {
1104
1107
  persister?.destroy();
1108
+ destroy?.(persister);
1105
1109
  };
1106
1110
  },
1107
1111
  // eslint-disable-next-line react-hooks/exhaustive-deps
1108
- [persister, ...thenDeps],
1112
+ [persister, ...thenDeps, ...destroyDeps],
1109
1113
  );
1110
1114
  return persister;
1111
1115
  };
@@ -1 +1 @@
1
- import e,{useContext as t}from"react";const o=e=>typeof e,r="",n=o(r),d="Listener",l="Result",s="Ids",u="Table",i=u+"s",a=u+s,c="Row",I=c+"Count",p=c+s,v="Sorted"+c+s,b="Cell",g=b+s,m="Value",C=m+"s",y=m+s,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>o(e)==n,f=()=>{},R=(e,t)=>e.map(t),P=Object.keys,{createContext:x,useContext:q}=e,O=x([]),S=(e,t)=>{var o;const r=q(O);return w(e)?r[t]:h(e)?((e,t)=>k(e,(e=>e[t])))(null!=(o=r[t+1])?o:{},e):e},L=(e,t)=>{const o=S(e,t);return w(e)||h(e)?o:e},j=e=>{var t;return P(null!=(t=q(O)[e])?t:{})},B=e=>S(e,0),T=e=>L(e,0),M=e=>S(e,2),E=e=>L(e,2),F=e=>S(e,4),V=e=>L(e,4),A=e=>S(e,6),D=e=>L(e,6),Q=e=>S(e,8),W=e=>L(e,8),z=e=>S(e,10),G=e=>L(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const r=U((()=>t(e)),[e,...o]);return N((()=>()=>r.destroy()),[r]),r},$=(e,t,o,r=[],n)=>{const[,d]=Y(),l=K((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t["get"+e])?void 0:n.call(t,...r))?d:o}),[t,...r]),[s]=Y(l),u=X(s);return U((()=>u.current=l()),[l]),_(e,t,((...e)=>{u.current=w(n)?l():e[n],d([])}),[],r),u.current},_=(e,t,o,r=[],n=[],...l)=>N((()=>{var r;const s=null==(r=null==t?void 0:t["add"+e+d])?void 0:r.call(t,...n,o,...l);return()=>null==t?void 0:t.delListener(s)}),[t,...n,...r,...l]),ee=(e,t,o,r=[],n=f,d=[],...l)=>{const s=T(e);return K((e=>k(s,(r=>k(o(e,r),(e=>n(r["set"+t](...l,e),e)))))),[s,t,...r,...d,...l])},te=(e,t,o=f,r=[],...n)=>{const d=T(e);return K((()=>o(null==d?void 0:d["del"+t](...n))),[d,t,...r,...n])},oe=(e,t,o)=>{const r=G(e);return K((()=>null==r?void 0:r[t](o)),[r,t,o])},re=(e,t=[])=>U(e,t),ne=()=>j(1),de=e=>$(i,T(e),{}),le=e=>$(a,T(e),[],[]),se=(e,t)=>$(u,T(t),{},[e]),ue=(e,t)=>$(u+g,T(t),[],[e]),ie=(e,t)=>$(I,T(t),[],[e]),ae=(e,t)=>$(p,T(t),[],[e]),ce=(e,t,o,r=0,n,d)=>$(v,T(d),[],[e,t,o,r,n],6),Ie=(e,t,o)=>$(c,T(o),{},[e,t]),pe=(e,t,o)=>$(g,T(o),[],[e,t]),ve=(e,t,o,r)=>$(b,T(r),void 0,[e,t,o],4),be=e=>$(C,T(e),{}),ge=e=>$(y,T(e),[],[]),me=(e,t)=>$(m,T(t),void 0,[e]),Ce=(e,t,o,r,n)=>ee(o,i,e,t,r,n),ye=(e,t,o,r,n,d)=>ee(r,u,t,o,n,d,e),we=(e,t,o,r,n,d,l)=>ee(n,c,o,r,d,l,e,t),ke=(e,t,o=[],r,n=f,d=[],l=!0)=>{const s=T(r);return K((o=>k(s,(r=>k(t(o,r),(t=>n(r.addRow(e,t,l),r,t)))))),[s,e,...o,...d,l])},he=(e,t,o,r,n,d,l)=>ee(n,"PartialRow",o,r,d,l,e,t),fe=(e,t,o,r,n,d,l,s)=>ee(d,b,r,n,l,s,e,t,o),Re=(e,t,o,r,n)=>ee(o,C,e,t,r,n),Pe=(e,t,o,r,n)=>ee(o,"PartialValues",e,t,r,n),xe=(e,t,o,r,n,d)=>ee(r,m,t,o,n,d,e),qe=(e,t,o)=>te(e,i,t,o),Oe=(e,t,o,r)=>te(t,u,o,r,e),Se=(e,t,o,r,n)=>te(o,c,r,n,e,t),Le=(e,t,o,r,n,d,l)=>te(n,b,d,l,e,t,o,r),je=(e,t,o)=>te(e,C,t,o),Be=(e,t,o,r)=>te(t,m,o,r,e),Te=(e,t,o,r)=>_(i,T(r),e,t,[],o),Me=(e,t,o,r)=>_(a,T(r),e,t,[],o),Ee=(e,t,o,r,n)=>_(u,T(n),t,o,[e],r),Fe=(e,t,o,r,n)=>_(u+g,T(n),t,o,[e],r),Ve=(e,t,o,r,n)=>_(I,T(n),t,o,[e],r),Ae=(e,t,o,r,n)=>_(p,T(n),t,o,[e],r),De=(e,t,o,r,n,d,l,s,u)=>_(v,T(u),d,l,[e,t,o,r,n],s),Qe=(e,t,o,r,n,d)=>_(c,T(d),o,r,[e,t],n),We=(e,t,o,r,n,d)=>_(g,T(d),o,r,[e,t],n),ze=(e,t,o,r,n,d,l)=>_(b,T(l),r,n,[e,t,o],d),Ge=(e,t,o,r)=>_(C,T(r),e,t,[],o),He=(e,t,o,r)=>_(y,T(r),e,t,[],o),Je=(e,t,o,r,n)=>_(m,T(n),t,o,[e],r),Ke=(e,t,o)=>_("Start"+J,T(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,T(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,T(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>j(3),Ze=e=>$("MetricIds",E(e),[]),$e=(e,t)=>$("Metric",E(t),void 0,[e]),_e=(e,t,o,r)=>_("Metric",E(r),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>j(5),ot=(e,t)=>$("SliceIds",V(t),[],[e]),rt=e=>$("IndexIds",V(e),[]),nt=(e,t,o)=>$("Slice"+p,V(o),[],[e,t]),dt=(e,t,o,r)=>_("SliceIds",V(r),t,o,[e]),lt=(e,t,o,r,n)=>_("Slice"+p,V(n),o,r,[e,t]),st=(e,t,o)=>Z(e,t,o),ut=()=>j(7),it=e=>$("RelationshipIds",D(e),[]),at=(e,t,o)=>$("RemoteRowId",D(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,D(o),[],[e,t]),It=(e,t,o)=>$("Linked"+p,D(o),[],[e,t]),pt=(e,t,o,r,n)=>_("RemoteRowId",D(n),o,r,[e,t]),vt=(e,t,o,r,n)=>_("Local"+p,D(n),o,r,[e,t]),bt=(e,t,o,r,n)=>_("Linked"+p,D(n),o,r,[e,t]),gt=(e,t,o)=>Z(e,t,o),mt=()=>j(9),Ct=e=>$("QueryIds",W(e),[]),yt=(e,t)=>$(l+u,W(t),{},[e]),wt=(e,t)=>$(l+u+g,W(t),[],[e]),kt=(e,t)=>$(l+I,W(t),[],[e]),ht=(e,t)=>$(l+p,W(t),[],[e]),ft=(e,t,o,r=0,n,d)=>$(l+v,W(d),[],[e,t,o,r,n],6),Rt=(e,t,o)=>$(l+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(l+g,W(o),[],[e,t]),xt=(e,t,o,r)=>$(l+b,W(r),void 0,[e,t,o]),qt=(e,t,o,r)=>_(l+u,W(r),t,o,[e]),Ot=(e,t,o,r)=>_(l+u+g,W(r),t,o,[e]),St=(e,t,o,r)=>_(l+I,W(r),t,o,[e]),Lt=(e,t,o,r)=>_(l+p,W(r),t,o,[e]),jt=(e,t,o,r,n,d,s,u)=>_(l+v,W(u),d,s,[e,t,o,r,n]),Bt=(e,t,o,r,n)=>_(l+c,W(n),o,r,[e,t]),Tt=(e,t,o,r,n)=>_(l+g,W(n),o,r,[e,t]),Mt=(e,t,o,r,n,d)=>_(l+b,W(d),r,n,[e,t,o]),Et=(e,t,o)=>Z(e,t,o),Ft=()=>j(11),Vt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),At=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Dt=(e=f,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[d,...t,...n])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[d,...t,...n])},Gt=e=>{var t;const o=G(e),[n,d]=Vt(o);return[(l=n,!(0==l.length)),Qt(o),d,null!=(t=k(d,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r];var l},Ht=e=>{var t;const o=G(e),[,,[n]]=Vt(o);return[!w(n),Wt(o),n,null!=(t=k(n,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,r)=>_("Checkpoint",G(r),t,o,[e]),Nt=(e,t,o=[],r,n=[])=>{const[,d]=Y(),l=U((()=>t(e)),[e,...o]);return N((()=>{var e;return e=function*(){yield null==r?void 0:r(l),d(1)},new Promise(((t,o)=>{var r=t=>{try{d(e.next(t))}catch(e){o(e)}},n=t=>{try{d(e.throw(t))}catch(e){o(e)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);d((e=e.apply(void 0,null)).next())})),()=>{null==l||l.destroy()}}),[l,...n]),l},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>w(e)?{}:e(...t),oo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var ro=Object.defineProperty,no=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,ao=(e,t,o)=>t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,co=(e,t)=>{for(var o in t||(t={}))uo.call(t,o)&&ao(e,o,t[o]);if(so)for(var o of so(t))io.call(t,o)&&ao(e,o,t[o]);return e},Io=(e,t)=>no(e,lo(t)),po=(e,t)=>{var o={};for(var r in e)uo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&so)for(var r of so(e))t.indexOf(r)<0&&io.call(e,r)&&(o[r]=e[r]);return o};const{useMemo:vo}=e,bo=({tableId:e,store:t,rowComponent:o=ho,getRowComponentProps:r,customCellIds:n,separator:d,debugIds:l},s)=>wo(R(s,(d=>Yt(o,Io(co({},to(r,d)),{key:d,tableId:e,rowId:d,customCellIds:n,store:t,debugIds:l})))),d,l,e),go=({queryId:e,queries:t,resultRowComponent:o=Eo,getResultRowComponentProps:r,separator:n,debugIds:d},l)=>wo(R(l,(n=>Yt(o,Io(co({},to(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:d})))),n,d,e),mo=({relationshipId:e,relationships:t,rowComponent:o=ho,getRowComponentProps:r,separator:n,debugIds:d},l,s)=>{const[u,i,a]=oo(D(t),e),c=l(e,s,u);return wo(R(c,(e=>Yt(o,Io(co({},to(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:d})))),n,d,s)},Co=e=>({checkpoints:t,checkpointComponent:o=Ao,getCheckpointComponentProps:r,separator:n,debugIds:d})=>{const l=G(t);return wo(R(e(Vt(l)),(e=>Yt(o,Io(co({},to(r,e)),{key:e,checkpoints:l,checkpointId:e,debugIds:d})))),n)},yo=({store:e,storesById:o,metrics:r,metricsById:n,indexes:d,indexesById:l,relationships:s,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const v=t(O);return Yt(O.Provider,{value:vo((()=>[null!=e?e:v[0],co(co({},v[1]),o),null!=r?r:v[2],co(co({},v[3]),n),null!=d?d:v[4],co(co({},v[5]),l),null!=s?s:v[6],co(co({},v[7]),u),null!=i?i:v[8],co(co({},v[9]),a),null!=c?c:v[10],co(co({},v[11]),I)]),[e,o,r,n,d,l,s,u,i,a,c,I,v])},p)},wo=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:R(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ko=({tableId:e,rowId:t,cellId:o,store:n,debugIds:d})=>{var l;return wo(r+(null!=(l=ve(e,t,o,n))?l:r),void 0,d,o)},ho=({tableId:e,rowId:t,store:o,cellComponent:r=ko,getCellComponentProps:n,customCellIds:d,separator:l,debugIds:s})=>wo(R(((e,t,o,r)=>{const n=pe(t,o,r);return null!=e?e:n})(d,e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:s})))),l,s,t),fo=e=>bo(e,ae(e.tableId,e.store)),Ro=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return bo(l,ce(l.tableId,o,r,n,d,l.store))},Po=({store:e,tableComponent:t=fo,getTableComponentProps:o,separator:r,debugIds:n})=>wo(R(le(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),xo=({valueId:e,store:t,debugIds:o})=>{var n;return wo(r+(null!=(n=me(e,t))?n:r),void 0,o,e)},qo=({store:e,valueComponent:t=xo,getValueComponentProps:o,separator:r,debugIds:n})=>wo(R(ge(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Oo=({metricId:e,metrics:t,debugIds:o})=>{var n;return wo(null!=(n=$e(e,t))?n:r,void 0,o,e)},So=({indexId:e,sliceId:t,indexes:o,rowComponent:r=ho,getRowComponentProps:n,separator:d,debugIds:l})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(V(o),e),a=nt(e,t,s);return wo(R(a,(e=>Yt(r,Io(co({},to(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:l})))),d,l,t)},Lo=({indexId:e,indexes:t,sliceComponent:o=So,getSliceComponentProps:r,separator:n,debugIds:d})=>wo(R(ot(e,t),(n=>Yt(o,Io(co({},to(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:d})))),n,d,e),jo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=ho,getRowComponentProps:n,debugIds:d})=>{const[l,s,,u]=oo(D(o),e),i=at(e,t,l);return wo(w(u)||w(i)?null:Yt(r,Io(co({},to(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:d})),void 0,d,t)},Bo=e=>mo(e,ct,e.remoteRowId),To=e=>mo(e,It,e.firstRowId),Mo=({queryId:e,rowId:t,cellId:o,queries:n,debugIds:d})=>{var l;return wo(r+(null!=(l=xt(e,t,o,n))?l:r),void 0,d,o)},Eo=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Mo,getResultCellComponentProps:n,separator:d,debugIds:l})=>wo(R(Pt(e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:l})))),d,l,t),Fo=e=>go(e,ht(e.queryId,e.queries)),Vo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return go(l,ft(l.queryId,o,r,n,d,l.queries))},Ao=({checkpoints:e,checkpointId:t,debugIds:o})=>{var n;return wo(null!=(n=At(t,e))?n:r,void 0,o,t)},Do=Co((e=>e[0])),Qo=Co((e=>w(e[1])?[]:[e[1]])),Wo=Co((e=>e[2]));export{Do as BackwardCheckpointsView,ko as CellView,Ao as CheckpointView,Qo as CurrentCheckpointView,Wo as ForwardCheckpointsView,Lo as IndexView,To as LinkedRowsView,Bo as LocalRowsView,Oo as MetricView,yo as Provider,jo as RemoteRowView,Mo as ResultCellView,Eo as ResultRowView,Vo as ResultSortedTableView,Fo as ResultTableView,ho as RowView,So as SliceView,Ro as SortedTableView,fo as TableView,Po as TablesView,xo as ValueView,qo as ValuesView,ke as useAddRowCallback,ve as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,At as useCheckpoint,Vt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,Ft as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Et as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,gt as useCreateQueries,st as useCreateRelationships,re as useCreateStore,Le as useDelCellCallback,Se as useDelRowCallback,Oe as useDelTableCallback,qe as useDelTablesCallback,Be as useDelValueCallback,je as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,rt as useIndexIds,F as useIndexes,tt as useIndexesIds,V as useIndexesOrIndexesById,It as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,vt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,M as useMetrics,Ye as useMetricsIds,E as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,Ct as useQueryIds,Ht as useRedoInformation,it as useRelationshipIds,A as useRelationships,ut as useRelationshipsIds,D as useRelationshipsOrRelationshipsById,at as useRemoteRowId,pt as useRemoteRowIdListener,xt as useResultCell,Pt as useResultCellIds,Tt as useResultCellIdsListener,Mt as useResultCellListener,Rt as useResultRow,kt as useResultRowCount,St as useResultRowCountListener,ht as useResultRowIds,Lt as useResultRowIdsListener,Bt as useResultRowListener,ft as useResultSortedRowIds,jt as useResultSortedRowIdsListener,yt as useResultTable,wt as useResultTableCellIds,Ot as useResultTableCellIdsListener,qt as useResultTableListener,Ie as useRow,ie as useRowCount,Ve as useRowCountListener,ae as useRowIds,Ae as useRowIdsListener,Qe as useRowListener,fe as useSetCellCallback,Dt as useSetCheckpointCallback,he as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,we as useSetRowCallback,ye as useSetTableCallback,Ce as useSetTablesCallback,xe as useSetValueCallback,Re as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,nt as useSliceRowIds,lt as useSliceRowIdsListener,ce as useSortedRowIds,De as useSortedRowIdsListener,Ke as useStartTransactionListener,B as useStore,ne as useStoreIds,T as useStoreOrStoreById,se as useTable,ue as useTableCellIds,Fe as useTableCellIdsListener,le as useTableIds,Me as useTableIdsListener,Ee as useTableListener,de as useTables,Te as useTablesListener,Gt as useUndoInformation,me as useValue,ge as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
1
+ import e,{useContext as t}from"react";const o=e=>typeof e,r="",n=o(r),d="Listener",l="Result",s="Ids",u="Table",i=u+"s",a=u+s,c="Row",I=c+"Count",p=c+s,v="Sorted"+c+s,b="Cell",g=b+s,m="Value",C=m+"s",y=m+s,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>o(e)==n,f=()=>{},R=(e,t)=>e.map(t),P=Object.keys,{createContext:x,useContext:q}=e,O=x([]),S=(e,t)=>{var o;const r=q(O);return w(e)?r[t]:h(e)?((e,t)=>k(e,(e=>e[t])))(null!=(o=r[t+1])?o:{},e):e},L=(e,t)=>{const o=S(e,t);return w(e)||h(e)?o:e},j=e=>{var t;return P(null!=(t=q(O)[e])?t:{})},B=e=>S(e,0),T=e=>L(e,0),M=e=>S(e,2),E=e=>L(e,2),F=e=>S(e,4),V=e=>L(e,4),A=e=>S(e,6),D=e=>L(e,6),Q=e=>S(e,8),W=e=>L(e,8),z=e=>S(e,10),G=e=>L(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const r=U((()=>t(e)),[e,...o]);return N((()=>()=>r.destroy()),[r]),r},$=(e,t,o,r=[],n)=>{const[,d]=Y(),l=K((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t["get"+e])?void 0:n.call(t,...r))?d:o}),[t,...r]),[s]=Y(l),u=X(s);return U((()=>u.current=l()),[l]),_(e,t,((...e)=>{u.current=w(n)?l():e[n],d([])}),[],r),u.current},_=(e,t,o,r=[],n=[],...l)=>N((()=>{var r;const s=null==(r=null==t?void 0:t["add"+e+d])?void 0:r.call(t,...n,o,...l);return()=>null==t?void 0:t.delListener(s)}),[t,...n,...r,...l]),ee=(e,t,o,r=[],n=f,d=[],...l)=>{const s=T(e);return K((e=>k(s,(r=>k(o(e,r),(e=>n(r["set"+t](...l,e),e)))))),[s,t,...r,...d,...l])},te=(e,t,o=f,r=[],...n)=>{const d=T(e);return K((()=>o(null==d?void 0:d["del"+t](...n))),[d,t,...r,...n])},oe=(e,t,o)=>{const r=G(e);return K((()=>null==r?void 0:r[t](o)),[r,t,o])},re=(e,t=[])=>U(e,t),ne=()=>j(1),de=e=>$(i,T(e),{}),le=e=>$(a,T(e),[],[]),se=(e,t)=>$(u,T(t),{},[e]),ue=(e,t)=>$(u+g,T(t),[],[e]),ie=(e,t)=>$(I,T(t),[],[e]),ae=(e,t)=>$(p,T(t),[],[e]),ce=(e,t,o,r=0,n,d)=>$(v,T(d),[],[e,t,o,r,n],6),Ie=(e,t,o)=>$(c,T(o),{},[e,t]),pe=(e,t,o)=>$(g,T(o),[],[e,t]),ve=(e,t,o,r)=>$(b,T(r),void 0,[e,t,o],4),be=e=>$(C,T(e),{}),ge=e=>$(y,T(e),[],[]),me=(e,t)=>$(m,T(t),void 0,[e]),Ce=(e,t,o,r,n)=>ee(o,i,e,t,r,n),ye=(e,t,o,r,n,d)=>ee(r,u,t,o,n,d,e),we=(e,t,o,r,n,d,l)=>ee(n,c,o,r,d,l,e,t),ke=(e,t,o=[],r,n=f,d=[],l=!0)=>{const s=T(r);return K((o=>k(s,(r=>k(t(o,r),(t=>n(r.addRow(e,t,l),r,t)))))),[s,e,...o,...d,l])},he=(e,t,o,r,n,d,l)=>ee(n,"PartialRow",o,r,d,l,e,t),fe=(e,t,o,r,n,d,l,s)=>ee(d,b,r,n,l,s,e,t,o),Re=(e,t,o,r,n)=>ee(o,C,e,t,r,n),Pe=(e,t,o,r,n)=>ee(o,"PartialValues",e,t,r,n),xe=(e,t,o,r,n,d)=>ee(r,m,t,o,n,d,e),qe=(e,t,o)=>te(e,i,t,o),Oe=(e,t,o,r)=>te(t,u,o,r,e),Se=(e,t,o,r,n)=>te(o,c,r,n,e,t),Le=(e,t,o,r,n,d,l)=>te(n,b,d,l,e,t,o,r),je=(e,t,o)=>te(e,C,t,o),Be=(e,t,o,r)=>te(t,m,o,r,e),Te=(e,t,o,r)=>_(i,T(r),e,t,[],o),Me=(e,t,o,r)=>_(a,T(r),e,t,[],o),Ee=(e,t,o,r,n)=>_(u,T(n),t,o,[e],r),Fe=(e,t,o,r,n)=>_(u+g,T(n),t,o,[e],r),Ve=(e,t,o,r,n)=>_(I,T(n),t,o,[e],r),Ae=(e,t,o,r,n)=>_(p,T(n),t,o,[e],r),De=(e,t,o,r,n,d,l,s,u)=>_(v,T(u),d,l,[e,t,o,r,n],s),Qe=(e,t,o,r,n,d)=>_(c,T(d),o,r,[e,t],n),We=(e,t,o,r,n,d)=>_(g,T(d),o,r,[e,t],n),ze=(e,t,o,r,n,d,l)=>_(b,T(l),r,n,[e,t,o],d),Ge=(e,t,o,r)=>_(C,T(r),e,t,[],o),He=(e,t,o,r)=>_(y,T(r),e,t,[],o),Je=(e,t,o,r,n)=>_(m,T(n),t,o,[e],r),Ke=(e,t,o)=>_("Start"+J,T(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,T(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,T(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>j(3),Ze=e=>$("MetricIds",E(e),[]),$e=(e,t)=>$("Metric",E(t),void 0,[e]),_e=(e,t,o,r)=>_("Metric",E(r),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>j(5),ot=(e,t)=>$("SliceIds",V(t),[],[e]),rt=e=>$("IndexIds",V(e),[]),nt=(e,t,o)=>$("Slice"+p,V(o),[],[e,t]),dt=(e,t,o,r)=>_("SliceIds",V(r),t,o,[e]),lt=(e,t,o,r,n)=>_("Slice"+p,V(n),o,r,[e,t]),st=(e,t,o)=>Z(e,t,o),ut=()=>j(7),it=e=>$("RelationshipIds",D(e),[]),at=(e,t,o)=>$("RemoteRowId",D(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,D(o),[],[e,t]),It=(e,t,o)=>$("Linked"+p,D(o),[],[e,t]),pt=(e,t,o,r,n)=>_("RemoteRowId",D(n),o,r,[e,t]),vt=(e,t,o,r,n)=>_("Local"+p,D(n),o,r,[e,t]),bt=(e,t,o,r,n)=>_("Linked"+p,D(n),o,r,[e,t]),gt=(e,t,o)=>Z(e,t,o),mt=()=>j(9),Ct=e=>$("QueryIds",W(e),[]),yt=(e,t)=>$(l+u,W(t),{},[e]),wt=(e,t)=>$(l+u+g,W(t),[],[e]),kt=(e,t)=>$(l+I,W(t),[],[e]),ht=(e,t)=>$(l+p,W(t),[],[e]),ft=(e,t,o,r=0,n,d)=>$(l+v,W(d),[],[e,t,o,r,n],6),Rt=(e,t,o)=>$(l+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(l+g,W(o),[],[e,t]),xt=(e,t,o,r)=>$(l+b,W(r),void 0,[e,t,o]),qt=(e,t,o,r)=>_(l+u,W(r),t,o,[e]),Ot=(e,t,o,r)=>_(l+u+g,W(r),t,o,[e]),St=(e,t,o,r)=>_(l+I,W(r),t,o,[e]),Lt=(e,t,o,r)=>_(l+p,W(r),t,o,[e]),jt=(e,t,o,r,n,d,s,u)=>_(l+v,W(u),d,s,[e,t,o,r,n]),Bt=(e,t,o,r,n)=>_(l+c,W(n),o,r,[e,t]),Tt=(e,t,o,r,n)=>_(l+g,W(n),o,r,[e,t]),Mt=(e,t,o,r,n,d)=>_(l+b,W(d),r,n,[e,t,o]),Et=(e,t,o)=>Z(e,t,o),Ft=()=>j(11),Vt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),At=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Dt=(e=f,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[d,...t,...n])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[d,...t,...n])},Gt=e=>{var t;const o=G(e),[n,d]=Vt(o);return[(l=n,!(0==l.length)),Qt(o),d,null!=(t=k(d,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r];var l},Ht=e=>{var t;const o=G(e),[,,[n]]=Vt(o);return[!w(n),Wt(o),n,null!=(t=k(n,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,r)=>_("Checkpoint",G(r),t,o,[e]),Nt=(e,t,o=[],r,n=[],d,l=[])=>{const[,s]=Y(),u=U((()=>t(e)),[e,...o]);return N((()=>{var e;return e=function*(){r&&(yield r(u),s([]))},new Promise(((t,o)=>{var r=t=>{try{d(e.next(t))}catch(e){o(e)}},n=t=>{try{d(e.throw(t))}catch(e){o(e)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);d((e=e.apply(void 0,null)).next())})),()=>{null==u||u.destroy(),null==d||d(u)}}),[u,...n,...l]),u},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>w(e)?{}:e(...t),oo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var ro=Object.defineProperty,no=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,ao=(e,t,o)=>t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,co=(e,t)=>{for(var o in t||(t={}))uo.call(t,o)&&ao(e,o,t[o]);if(so)for(var o of so(t))io.call(t,o)&&ao(e,o,t[o]);return e},Io=(e,t)=>no(e,lo(t)),po=(e,t)=>{var o={};for(var r in e)uo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&so)for(var r of so(e))t.indexOf(r)<0&&io.call(e,r)&&(o[r]=e[r]);return o};const{useMemo:vo}=e,bo=({tableId:e,store:t,rowComponent:o=ho,getRowComponentProps:r,customCellIds:n,separator:d,debugIds:l},s)=>wo(R(s,(d=>Yt(o,Io(co({},to(r,d)),{key:d,tableId:e,rowId:d,customCellIds:n,store:t,debugIds:l})))),d,l,e),go=({queryId:e,queries:t,resultRowComponent:o=Eo,getResultRowComponentProps:r,separator:n,debugIds:d},l)=>wo(R(l,(n=>Yt(o,Io(co({},to(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:d})))),n,d,e),mo=({relationshipId:e,relationships:t,rowComponent:o=ho,getRowComponentProps:r,separator:n,debugIds:d},l,s)=>{const[u,i,a]=oo(D(t),e),c=l(e,s,u);return wo(R(c,(e=>Yt(o,Io(co({},to(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:d})))),n,d,s)},Co=e=>({checkpoints:t,checkpointComponent:o=Ao,getCheckpointComponentProps:r,separator:n,debugIds:d})=>{const l=G(t);return wo(R(e(Vt(l)),(e=>Yt(o,Io(co({},to(r,e)),{key:e,checkpoints:l,checkpointId:e,debugIds:d})))),n)},yo=({store:e,storesById:o,metrics:r,metricsById:n,indexes:d,indexesById:l,relationships:s,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const v=t(O);return Yt(O.Provider,{value:vo((()=>[null!=e?e:v[0],co(co({},v[1]),o),null!=r?r:v[2],co(co({},v[3]),n),null!=d?d:v[4],co(co({},v[5]),l),null!=s?s:v[6],co(co({},v[7]),u),null!=i?i:v[8],co(co({},v[9]),a),null!=c?c:v[10],co(co({},v[11]),I)]),[e,o,r,n,d,l,s,u,i,a,c,I,v])},p)},wo=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:R(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ko=({tableId:e,rowId:t,cellId:o,store:n,debugIds:d})=>{var l;return wo(r+(null!=(l=ve(e,t,o,n))?l:r),void 0,d,o)},ho=({tableId:e,rowId:t,store:o,cellComponent:r=ko,getCellComponentProps:n,customCellIds:d,separator:l,debugIds:s})=>wo(R(((e,t,o,r)=>{const n=pe(t,o,r);return null!=e?e:n})(d,e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:s})))),l,s,t),fo=e=>bo(e,ae(e.tableId,e.store)),Ro=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return bo(l,ce(l.tableId,o,r,n,d,l.store))},Po=({store:e,tableComponent:t=fo,getTableComponentProps:o,separator:r,debugIds:n})=>wo(R(le(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),xo=({valueId:e,store:t,debugIds:o})=>{var n;return wo(r+(null!=(n=me(e,t))?n:r),void 0,o,e)},qo=({store:e,valueComponent:t=xo,getValueComponentProps:o,separator:r,debugIds:n})=>wo(R(ge(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Oo=({metricId:e,metrics:t,debugIds:o})=>{var n;return wo(null!=(n=$e(e,t))?n:r,void 0,o,e)},So=({indexId:e,sliceId:t,indexes:o,rowComponent:r=ho,getRowComponentProps:n,separator:d,debugIds:l})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(V(o),e),a=nt(e,t,s);return wo(R(a,(e=>Yt(r,Io(co({},to(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:l})))),d,l,t)},Lo=({indexId:e,indexes:t,sliceComponent:o=So,getSliceComponentProps:r,separator:n,debugIds:d})=>wo(R(ot(e,t),(n=>Yt(o,Io(co({},to(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:d})))),n,d,e),jo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=ho,getRowComponentProps:n,debugIds:d})=>{const[l,s,,u]=oo(D(o),e),i=at(e,t,l);return wo(w(u)||w(i)?null:Yt(r,Io(co({},to(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:d})),void 0,d,t)},Bo=e=>mo(e,ct,e.remoteRowId),To=e=>mo(e,It,e.firstRowId),Mo=({queryId:e,rowId:t,cellId:o,queries:n,debugIds:d})=>{var l;return wo(r+(null!=(l=xt(e,t,o,n))?l:r),void 0,d,o)},Eo=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Mo,getResultCellComponentProps:n,separator:d,debugIds:l})=>wo(R(Pt(e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:l})))),d,l,t),Fo=e=>go(e,ht(e.queryId,e.queries)),Vo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return go(l,ft(l.queryId,o,r,n,d,l.queries))},Ao=({checkpoints:e,checkpointId:t,debugIds:o})=>{var n;return wo(null!=(n=At(t,e))?n:r,void 0,o,t)},Do=Co((e=>e[0])),Qo=Co((e=>w(e[1])?[]:[e[1]])),Wo=Co((e=>e[2]));export{Do as BackwardCheckpointsView,ko as CellView,Ao as CheckpointView,Qo as CurrentCheckpointView,Wo as ForwardCheckpointsView,Lo as IndexView,To as LinkedRowsView,Bo as LocalRowsView,Oo as MetricView,yo as Provider,jo as RemoteRowView,Mo as ResultCellView,Eo as ResultRowView,Vo as ResultSortedTableView,Fo as ResultTableView,ho as RowView,So as SliceView,Ro as SortedTableView,fo as TableView,Po as TablesView,xo as ValueView,qo as ValuesView,ke as useAddRowCallback,ve as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,At as useCheckpoint,Vt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,Ft as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Et as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,gt as useCreateQueries,st as useCreateRelationships,re as useCreateStore,Le as useDelCellCallback,Se as useDelRowCallback,Oe as useDelTableCallback,qe as useDelTablesCallback,Be as useDelValueCallback,je as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,rt as useIndexIds,F as useIndexes,tt as useIndexesIds,V as useIndexesOrIndexesById,It as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,vt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,M as useMetrics,Ye as useMetricsIds,E as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,Ct as useQueryIds,Ht as useRedoInformation,it as useRelationshipIds,A as useRelationships,ut as useRelationshipsIds,D as useRelationshipsOrRelationshipsById,at as useRemoteRowId,pt as useRemoteRowIdListener,xt as useResultCell,Pt as useResultCellIds,Tt as useResultCellIdsListener,Mt as useResultCellListener,Rt as useResultRow,kt as useResultRowCount,St as useResultRowCountListener,ht as useResultRowIds,Lt as useResultRowIdsListener,Bt as useResultRowListener,ft as useResultSortedRowIds,jt as useResultSortedRowIdsListener,yt as useResultTable,wt as useResultTableCellIds,Ot as useResultTableCellIdsListener,qt as useResultTableListener,Ie as useRow,ie as useRowCount,Ve as useRowCountListener,ae as useRowIds,Ae as useRowIdsListener,Qe as useRowListener,fe as useSetCellCallback,Dt as useSetCheckpointCallback,he as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,we as useSetRowCallback,ye as useSetTableCallback,Ce as useSetTablesCallback,xe as useSetValueCallback,Re as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,nt as useSliceRowIds,lt as useSliceRowIdsListener,ce as useSortedRowIds,De as useSortedRowIdsListener,Ke as useStartTransactionListener,B as useStore,ne as useStoreIds,T as useStoreOrStoreById,se as useTable,ue as useTableCellIds,Fe as useTableCellIdsListener,le as useTableIds,Me as useTableIdsListener,Ee as useTableListener,de as useTables,Te as useTablesListener,Gt as useUndoInformation,me as useValue,ge as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
Binary file
@@ -8896,6 +8896,13 @@ export function useCheckpointListener(
8896
8896
  * collaboration features. As a result, the `then` callback may also get passed
8897
8897
  * undefined, which you should handle accordingly.
8898
8898
  *
8899
+ * Since v4.3.19, a `destroy` function can be provided which will be called
8900
+ * after an old Persister is destroyed due to a change in the `createDeps`
8901
+ * dependencies that causes a new one to be created. Use this to clean up any
8902
+ * underlying storage objects that you set up during the `then` function, for
8903
+ * example. If this callback itself contains additional dependencies, you can
8904
+ * provide them in an array in the seventh parameter.
8905
+ *
8899
8906
  * This hook ensures the Persister object is destroyed whenever a new one is
8900
8907
  * created or the component is unmounted.
8901
8908
  * @param store A reference to the Store for which to create a new Persister
@@ -8910,6 +8917,11 @@ export function useCheckpointListener(
8910
8917
  * @param thenDeps An optional array of dependencies for the `then` callback,
8911
8918
  * which, if any change, result in its rerun. This parameter defaults to an
8912
8919
  * empty array.
8920
+ * @param destroy An optional callback whenever the Persister is destroyed due
8921
+ * to a change in the `createDeps` dependencies.
8922
+ * @param destroyDeps An optional array of dependencies for the `destroy`
8923
+ * callback, which, if any change, result in `destroy` and `then` being rerun.
8924
+ * This parameter defaults to an empty array.
8913
8925
  * @returns A reference to the Persister.
8914
8926
  * @example
8915
8927
  * This example creates a Persister at the top level of a React application.
@@ -8957,7 +8969,8 @@ export function useCheckpointListener(
8957
8969
  * This example creates a Persister at the top level of a React application. The
8958
8970
  * App component is rendered twice, each with a different top-level prop. The
8959
8971
  * useCreatePersister hook takes the `sessionKey` prop as a dependency, and so
8960
- * the Persister object is created again on the second render.
8972
+ * the Persister object is created again on the second render. The first is
8973
+ * destroyed and the `destroy` parameter is called for it.
8961
8974
  *
8962
8975
  * ```jsx
8963
8976
  * const App = ({sessionKey}) => {
@@ -8971,8 +8984,12 @@ export function useCheckpointListener(
8971
8984
  * [sessionKey],
8972
8985
  * async (persister) => {
8973
8986
  * await persister.startAutoLoad();
8974
- * await persister.startAutoSave();
8975
8987
  * },
8988
+ * [],
8989
+ * (persister) =>
8990
+ * console.log(
8991
+ * `Persister destroyed for session key ${persister.getStorageName()}`,
8992
+ * ),
8976
8993
  * );
8977
8994
  * return <span>{JSON.stringify(useTables(store))}</span>;
8978
8995
  * };
@@ -8997,12 +9014,14 @@ export function useCheckpointListener(
8997
9014
  *
8998
9015
  * root.render(<App sessionKey="cujoStore" />); // !act
8999
9016
  * // -> 'Persister created for session key cujoStore'
9017
+ * // -> 'Persister destroyed for session key fidoStore'
9000
9018
  *
9001
9019
  * // ... // !act
9002
9020
  * console.log(app.innerHTML);
9003
9021
  * // -> '<span>{\"pets\":{\"cujo\":{\"species\":\"dog\"}}}</span>'
9004
9022
  *
9005
9023
  * root.unmount(); // !act
9024
+ * // -> 'Persister destroyed for session key cujoStore'
9006
9025
  * ```
9007
9026
  * @category Persister hooks
9008
9027
  */
@@ -9014,6 +9033,8 @@ export function useCreatePersister<
9014
9033
  createDeps?: React.DependencyList,
9015
9034
  then?: (persister: PersisterOrUndefined) => Promise<void>,
9016
9035
  thenDeps?: React.DependencyList,
9036
+ destroy?: (persister: PersisterOrUndefined) => void,
9037
+ destroyDeps?: React.DependencyList,
9017
9038
  ): PersisterOrUndefined;
9018
9039
 
9019
9040
  /**
@@ -10122,6 +10122,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10122
10122
  * createDeps?: React.DependencyList,
10123
10123
  * then?: (persister: PersisterOrUndefined) => Promise<void>,
10124
10124
  * thenDeps?: React.DependencyList,
10125
+ * destroy?: (persister: PersisterOrUndefined) => void,
10126
+ * destroyDeps?: React.DependencyList,
10125
10127
  * ): PersisterOrUndefined;
10126
10128
  * ```
10127
10129
  *
@@ -10153,6 +10155,13 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10153
10155
  * collaboration features. As a result, the `then` callback may also get passed
10154
10156
  * undefined, which you should handle accordingly.
10155
10157
  *
10158
+ * Since v4.3.19, a `destroy` function can be provided which will be called
10159
+ * after an old Persister is destroyed due to a change in the `createDeps`
10160
+ * dependencies that causes a new one to be created. Use this to clean up any
10161
+ * underlying storage objects that you set up during the `then` function, for
10162
+ * example. If this callback itself contains additional dependencies, you can
10163
+ * provide them in an array in the seventh parameter.
10164
+ *
10156
10165
  * This hook ensures the Persister object is destroyed whenever a new one is
10157
10166
  * created or the component is unmounted.
10158
10167
  * @param store A reference to the Store for which to create a new Persister
@@ -10167,6 +10176,11 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10167
10176
  * @param thenDeps An optional array of dependencies for the `then` callback,
10168
10177
  * which, if any change, result in its rerun. This parameter defaults to an
10169
10178
  * empty array.
10179
+ * @param destroy An optional callback whenever the Persister is destroyed due
10180
+ * to a change in the `createDeps` dependencies.
10181
+ * @param destroyDeps An optional array of dependencies for the `destroy`
10182
+ * callback, which, if any change, result in `destroy` and `then` being rerun.
10183
+ * This parameter defaults to an empty array.
10170
10184
  * @returns A reference to the Persister.
10171
10185
  * @example
10172
10186
  * This example creates a Persister at the top level of a React application.
@@ -10214,7 +10228,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10214
10228
  * This example creates a Persister at the top level of a React application. The
10215
10229
  * App component is rendered twice, each with a different top-level prop. The
10216
10230
  * useCreatePersister hook takes the `sessionKey` prop as a dependency, and so
10217
- * the Persister object is created again on the second render.
10231
+ * the Persister object is created again on the second render. The first is
10232
+ * destroyed and the `destroy` parameter is called for it.
10218
10233
  *
10219
10234
  * ```jsx
10220
10235
  * const App = ({sessionKey}) => {
@@ -10228,8 +10243,12 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10228
10243
  * [sessionKey],
10229
10244
  * async (persister) => {
10230
10245
  * await persister.startAutoLoad();
10231
- * await persister.startAutoSave();
10232
10246
  * },
10247
+ * [],
10248
+ * (persister) =>
10249
+ * console.log(
10250
+ * `Persister destroyed for session key ${persister.getStorageName()}`,
10251
+ * ),
10233
10252
  * );
10234
10253
  * return <span>{JSON.stringify(useTables(store))}</span>;
10235
10254
  * };
@@ -10254,12 +10273,14 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10254
10273
  *
10255
10274
  * root.render(<App sessionKey="cujoStore" />); // !act
10256
10275
  * // -> 'Persister created for session key cujoStore'
10276
+ * // -> 'Persister destroyed for session key fidoStore'
10257
10277
  *
10258
10278
  * // ... // !act
10259
10279
  * console.log(app.innerHTML);
10260
10280
  * // -> '<span>{\"pets\":{\"cujo\":{\"species\":\"dog\"}}}</span>'
10261
10281
  *
10262
10282
  * root.unmount(); // !act
10283
+ * // -> 'Persister destroyed for session key cujoStore'
10263
10284
  * ```
10264
10285
  * @category Persister hooks
10265
10286
  */
@@ -10271,6 +10292,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
10271
10292
  createDeps?: React.DependencyList,
10272
10293
  then?: (persister?: PersisterOrUndefined) => Promise<void>,
10273
10294
  thenDeps?: React.DependencyList,
10295
+ destroy?: (persister: PersisterOrUndefined) => void,
10296
+ destroyDeps?: React.DependencyList,
10274
10297
  ) => PersisterOrUndefined;
10275
10298
 
10276
10299
  /**
package/lib/ui-react.js CHANGED
@@ -1 +1 @@
1
- import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",I="Ids",i="Table",u=i+"s",l=i+I,c="Row",a=c+"Count",p=c+I,g="Sorted"+c+I,b="Cell",C=b+I,m="Value",k=m+"s",w=m+I,y=e=>null==e,h=(e,t,o)=>y(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),P=Object.keys,{createContext:f,useContext:x}=e,S=f([]),L=(e,t)=>{const o=x(S);return y(e)?o[t]:R(e)?((e,t)=>h(e,(e=>e[t])))(o[t+1]??{},e):e},B=(e,t)=>{const o=L(e,t);return y(e)||R(e)?o:e},T=e=>P(x(S)[e]??{}),M=e=>L(e,0),F=e=>B(e,0),E=e=>L(e,2),V=e=>B(e,2),A=e=>L(e,4),j=e=>B(e,4),D=e=>L(e,6),O=e=>B(e,6),Q=e=>L(e,8),W=e=>B(e,8),z=e=>L(e,10),G=e=>B(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},$=(e,t,o,s=[],r)=>{const[,d]=Y(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=Y(n),i=X(I);return U((()=>i.current=n()),[n]),_(e,t,((...e)=>{i.current=y(r)?n():e[r],d([])}),[],s),i.current},_=(e,t,o,s=[],r=[],...n)=>N((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,...r,...s,...n]),ee=(e,t,o,s=[],r=v,d=[],...n)=>{const I=F(e);return K((e=>h(I,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},te=(e,t,o=v,s=[],...r)=>{const d=F(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},oe=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},se=(e,t=[])=>U(e,t),re=()=>T(1),de=e=>$(u,F(e),{}),ne=e=>$(l,F(e),[],[]),Ie=(e,t)=>$(i,F(t),{},[e]),ie=(e,t)=>$(i+C,F(t),[],[e]),ue=(e,t)=>$(a,F(t),[],[e]),le=(e,t)=>$(p,F(t),[],[e]),ce=(e,t,o,s=0,r,d)=>$(g,F(d),[],[e,t,o,s,r],6),ae=(e,t,o)=>$(c,F(o),{},[e,t]),pe=(e,t,o)=>$(C,F(o),[],[e,t]),ge=(e,t,o,s)=>$(b,F(s),void 0,[e,t,o],4),be=e=>$(k,F(e),{}),Ce=e=>$(w,F(e),[],[]),me=(e,t)=>$(m,F(t),void 0,[e]),ke=(e,t,o,s,r)=>ee(o,u,e,t,s,r),we=(e,t,o,s,r,d)=>ee(s,i,t,o,r,d,e),ye=(e,t,o,s,r,d,n)=>ee(r,c,o,s,d,n,e,t),he=(e,t,o=[],s,r=v,d=[],n=!0)=>{const I=F(s);return K((o=>h(I,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},Re=(e,t,o,s,r,d,n)=>ee(r,"PartialRow",o,s,d,n,e,t),ve=(e,t,o,s,r,d,n,I)=>ee(d,b,s,r,n,I,e,t,o),qe=(e,t,o,s,r)=>ee(o,k,e,t,s,r),Pe=(e,t,o,s,r)=>ee(o,"PartialValues",e,t,s,r),fe=(e,t,o,s,r,d)=>ee(s,m,t,o,r,d,e),xe=(e,t,o)=>te(e,u,t,o),Se=(e,t,o,s)=>te(t,i,o,s,e),Le=(e,t,o,s,r)=>te(o,c,s,r,e,t),Be=(e,t,o,s,r,d,n)=>te(r,b,d,n,e,t,o,s),Te=(e,t,o)=>te(e,k,t,o),Me=(e,t,o,s)=>te(t,m,o,s,e),Fe=(e,t,o,s)=>_(u,F(s),e,t,[],o),Ee=(e,t,o,s)=>_(l,F(s),e,t,[],o),Ve=(e,t,o,s,r)=>_(i,F(r),t,o,[e],s),Ae=(e,t,o,s,r)=>_(i+C,F(r),t,o,[e],s),je=(e,t,o,s,r)=>_(a,F(r),t,o,[e],s),De=(e,t,o,s,r)=>_(p,F(r),t,o,[e],s),Oe=(e,t,o,s,r,d,n,I,i)=>_(g,F(i),d,n,[e,t,o,s,r],I),Qe=(e,t,o,s,r,d)=>_(c,F(d),o,s,[e,t],r),We=(e,t,o,s,r,d)=>_(C,F(d),o,s,[e,t],r),ze=(e,t,o,s,r,d,n)=>_(b,F(n),s,r,[e,t,o],d),Ge=(e,t,o,s)=>_(k,F(s),e,t,[],o),He=(e,t,o,s)=>_(w,F(s),e,t,[],o),Je=(e,t,o,s,r)=>_(m,F(r),t,o,[e],s),Ke=(e,t,o)=>_("Start"+J,F(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,F(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,F(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>T(3),Ze=e=>$("MetricIds",V(e),[]),$e=(e,t)=>$("Metric",V(t),void 0,[e]),_e=(e,t,o,s)=>_("Metric",V(s),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>T(5),ot=(e,t)=>$("SliceIds",j(t),[],[e]),st=e=>$("IndexIds",j(e),[]),rt=(e,t,o)=>$("Slice"+p,j(o),[],[e,t]),dt=(e,t,o,s)=>_("SliceIds",j(s),t,o,[e]),nt=(e,t,o,s,r)=>_("Slice"+p,j(r),o,s,[e,t]),It=(e,t,o)=>Z(e,t,o),it=()=>T(7),ut=e=>$("RelationshipIds",O(e),[]),lt=(e,t,o)=>$("RemoteRowId",O(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,O(o),[],[e,t]),at=(e,t,o)=>$("Linked"+p,O(o),[],[e,t]),pt=(e,t,o,s,r)=>_("RemoteRowId",O(r),o,s,[e,t]),gt=(e,t,o,s,r)=>_("Local"+p,O(r),o,s,[e,t]),bt=(e,t,o,s,r)=>_("Linked"+p,O(r),o,s,[e,t]),Ct=(e,t,o)=>Z(e,t,o),mt=()=>T(9),kt=e=>$("QueryIds",W(e),[]),wt=(e,t)=>$(n+i,W(t),{},[e]),yt=(e,t)=>$(n+i+C,W(t),[],[e]),ht=(e,t)=>$(n+a,W(t),[],[e]),Rt=(e,t)=>$(n+p,W(t),[],[e]),vt=(e,t,o,s=0,r,d)=>$(n+g,W(d),[],[e,t,o,s,r],6),qt=(e,t,o)=>$(n+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(n+C,W(o),[],[e,t]),ft=(e,t,o,s)=>$(n+b,W(s),void 0,[e,t,o]),xt=(e,t,o,s)=>_(n+i,W(s),t,o,[e]),St=(e,t,o,s)=>_(n+i+C,W(s),t,o,[e]),Lt=(e,t,o,s)=>_(n+a,W(s),t,o,[e]),Bt=(e,t,o,s)=>_(n+p,W(s),t,o,[e]),Tt=(e,t,o,s,r,d,I,i)=>_(n+g,W(i),d,I,[e,t,o,s,r]),Mt=(e,t,o,s,r)=>_(n+c,W(r),o,s,[e,t]),Ft=(e,t,o,s,r)=>_(n+C,W(r),o,s,[e,t]),Et=(e,t,o,s,r,d)=>_(n+b,W(d),s,r,[e,t,o]),Vt=(e,t,o)=>Z(e,t,o),At=()=>T(11),jt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),Dt=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Ot=(e=v,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>h(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Gt=e=>{const t=G(e),[o,r]=jt(t);return[(d=o,!(0==d.length)),Qt(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ht=e=>{const t=G(e),[,,[o]]=jt(t);return[!y(o),Wt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,s)=>_("Checkpoint",G(s),t,o,[e]),Nt=(e,t,o=[],s,r=[])=>{const[,d]=Y(),n=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{await(s?.(n)),d(1)})(),()=>{n?.destroy()})),[n,...r]),n},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>y(e)?{}:e(...t),oo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:so}=e,ro=({tableId:e,store:t,rowComponent:o=ao,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>lo(q(I,(d=>Yt(o,{...to(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),no=({queryId:e,queries:t,resultRowComponent:o=Po,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>lo(q(n,(r=>Yt(o,{...to(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Io=({relationshipId:e,relationships:t,rowComponent:o=ao,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[i,u,l]=oo(O(t),e),c=n(e,I,i);return lo(q(c,(e=>Yt(o,{...to(s,e),key:e,tableId:l,rowId:e,store:u,debugIds:d}))),r,d,I)},io=e=>({checkpoints:t,checkpointComponent:o=So,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return lo(q(e(jt(n)),(e=>Yt(o,{...to(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},uo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:i,queries:u,queriesById:l,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(S);return Yt(S.Provider,{value:so((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...i},u??g[8],{...g[9],...l},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,i,u,l,c,a,g])},p)},lo=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},co=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>lo(s+(ge(e,t,o,r)??s),void 0,d,o),ao=({tableId:e,rowId:t,store:o,cellComponent:s=co,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>lo(q(((e,t,o,s)=>{const r=pe(t,o,s);return e??r})(d,e,t,o),(d=>Yt(s,{...to(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),po=e=>ro(e,le(e.tableId,e.store)),go=({cellId:e,descending:t,offset:o,limit:s,...r})=>ro(r,ce(r.tableId,e,t,o,s,r.store)),bo=({store:e,tableComponent:t=po,getTableComponentProps:o,separator:s,debugIds:r})=>lo(q(ne(e),(s=>Yt(t,{...to(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Co=({valueId:e,store:t,debugIds:o})=>lo(s+(me(e,t)??s),void 0,o,e),mo=({store:e,valueComponent:t=Co,getValueComponentProps:o,separator:s,debugIds:r})=>lo(q(Ce(e),(s=>Yt(t,{...to(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ko=({metricId:e,metrics:t,debugIds:o})=>lo($e(e,t)??s,void 0,o,e),wo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=ao,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,i,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),l=rt(e,t,I);return lo(q(l,(e=>Yt(s,{...to(r,e),key:e,tableId:u,rowId:e,store:i,debugIds:n}))),d,n,t)},yo=({indexId:e,indexes:t,sliceComponent:o=wo,getSliceComponentProps:s,separator:r,debugIds:d})=>lo(q(ot(e,t),(r=>Yt(o,{...to(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ho=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=ao,getRowComponentProps:r,debugIds:d})=>{const[n,I,,i]=oo(O(o),e),u=lt(e,t,n);return lo(y(i)||y(u)?null:Yt(s,{...to(r,u),key:u,tableId:i,rowId:u,store:I,debugIds:d}),void 0,d,t)},Ro=e=>Io(e,ct,e.remoteRowId),vo=e=>Io(e,at,e.firstRowId),qo=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>lo(s+(ft(e,t,o,r)??s),void 0,d,o),Po=({queryId:e,rowId:t,queries:o,resultCellComponent:s=qo,getResultCellComponentProps:r,separator:d,debugIds:n})=>lo(q(Pt(e,t,o),(d=>Yt(s,{...to(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),fo=e=>no(e,Rt(e.queryId,e.queries)),xo=({cellId:e,descending:t,offset:o,limit:s,...r})=>no(r,vt(r.queryId,e,t,o,s,r.queries)),So=({checkpoints:e,checkpointId:t,debugIds:o})=>lo(Dt(t,e)??s,void 0,o,t),Lo=io((e=>e[0])),Bo=io((e=>y(e[1])?[]:[e[1]])),To=io((e=>e[2]));export{Lo as BackwardCheckpointsView,co as CellView,So as CheckpointView,Bo as CurrentCheckpointView,To as ForwardCheckpointsView,yo as IndexView,vo as LinkedRowsView,Ro as LocalRowsView,ko as MetricView,uo as Provider,ho as RemoteRowView,qo as ResultCellView,Po as ResultRowView,xo as ResultSortedTableView,fo as ResultTableView,ao as RowView,wo as SliceView,go as SortedTableView,po as TableView,bo as TablesView,Co as ValueView,mo as ValuesView,he as useAddRowCallback,ge as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,Dt as useCheckpoint,jt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,At as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Vt as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,Ct as useCreateQueries,It as useCreateRelationships,se as useCreateStore,Be as useDelCellCallback,Le as useDelRowCallback,Se as useDelTableCallback,xe as useDelTablesCallback,Me as useDelValueCallback,Te as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,st as useIndexIds,A as useIndexes,tt as useIndexesIds,j as useIndexesOrIndexesById,at as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,gt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,E as useMetrics,Ye as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ht as useRedoInformation,ut as useRelationshipIds,D as useRelationships,it as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,lt as useRemoteRowId,pt as useRemoteRowIdListener,ft as useResultCell,Pt as useResultCellIds,Ft as useResultCellIdsListener,Et as useResultCellListener,qt as useResultRow,ht as useResultRowCount,Lt as useResultRowCountListener,Rt as useResultRowIds,Bt as useResultRowIdsListener,Mt as useResultRowListener,vt as useResultSortedRowIds,Tt as useResultSortedRowIdsListener,wt as useResultTable,yt as useResultTableCellIds,St as useResultTableCellIdsListener,xt as useResultTableListener,ae as useRow,ue as useRowCount,je as useRowCountListener,le as useRowIds,De as useRowIdsListener,Qe as useRowListener,ve as useSetCellCallback,Ot as useSetCheckpointCallback,Re as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,ye as useSetRowCallback,we as useSetTableCallback,ke as useSetTablesCallback,fe as useSetValueCallback,qe as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,rt as useSliceRowIds,nt as useSliceRowIdsListener,ce as useSortedRowIds,Oe as useSortedRowIdsListener,Ke as useStartTransactionListener,M as useStore,re as useStoreIds,F as useStoreOrStoreById,Ie as useTable,ie as useTableCellIds,Ae as useTableCellIdsListener,ne as useTableIds,Ee as useTableIdsListener,Ve as useTableListener,de as useTables,Fe as useTablesListener,Gt as useUndoInformation,me as useValue,Ce as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
1
+ import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",I="Ids",i="Table",u=i+"s",l=i+I,c="Row",a=c+"Count",p=c+I,g="Sorted"+c+I,b="Cell",C=b+I,m="Value",k=m+"s",w=m+I,y=e=>null==e,h=(e,t,o)=>y(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),P=Object.keys,{createContext:f,useContext:x}=e,S=f([]),L=(e,t)=>{const o=x(S);return y(e)?o[t]:R(e)?((e,t)=>h(e,(e=>e[t])))(o[t+1]??{},e):e},B=(e,t)=>{const o=L(e,t);return y(e)||R(e)?o:e},T=e=>P(x(S)[e]??{}),M=e=>L(e,0),F=e=>B(e,0),E=e=>L(e,2),V=e=>B(e,2),A=e=>L(e,4),j=e=>B(e,4),D=e=>L(e,6),O=e=>B(e,6),Q=e=>L(e,8),W=e=>B(e,8),z=e=>L(e,10),G=e=>B(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},$=(e,t,o,s=[],r)=>{const[,d]=Y(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=Y(n),i=X(I);return U((()=>i.current=n()),[n]),_(e,t,((...e)=>{i.current=y(r)?n():e[r],d([])}),[],s),i.current},_=(e,t,o,s=[],r=[],...n)=>N((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,...r,...s,...n]),ee=(e,t,o,s=[],r=v,d=[],...n)=>{const I=F(e);return K((e=>h(I,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},te=(e,t,o=v,s=[],...r)=>{const d=F(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},oe=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},se=(e,t=[])=>U(e,t),re=()=>T(1),de=e=>$(u,F(e),{}),ne=e=>$(l,F(e),[],[]),Ie=(e,t)=>$(i,F(t),{},[e]),ie=(e,t)=>$(i+C,F(t),[],[e]),ue=(e,t)=>$(a,F(t),[],[e]),le=(e,t)=>$(p,F(t),[],[e]),ce=(e,t,o,s=0,r,d)=>$(g,F(d),[],[e,t,o,s,r],6),ae=(e,t,o)=>$(c,F(o),{},[e,t]),pe=(e,t,o)=>$(C,F(o),[],[e,t]),ge=(e,t,o,s)=>$(b,F(s),void 0,[e,t,o],4),be=e=>$(k,F(e),{}),Ce=e=>$(w,F(e),[],[]),me=(e,t)=>$(m,F(t),void 0,[e]),ke=(e,t,o,s,r)=>ee(o,u,e,t,s,r),we=(e,t,o,s,r,d)=>ee(s,i,t,o,r,d,e),ye=(e,t,o,s,r,d,n)=>ee(r,c,o,s,d,n,e,t),he=(e,t,o=[],s,r=v,d=[],n=!0)=>{const I=F(s);return K((o=>h(I,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},Re=(e,t,o,s,r,d,n)=>ee(r,"PartialRow",o,s,d,n,e,t),ve=(e,t,o,s,r,d,n,I)=>ee(d,b,s,r,n,I,e,t,o),qe=(e,t,o,s,r)=>ee(o,k,e,t,s,r),Pe=(e,t,o,s,r)=>ee(o,"PartialValues",e,t,s,r),fe=(e,t,o,s,r,d)=>ee(s,m,t,o,r,d,e),xe=(e,t,o)=>te(e,u,t,o),Se=(e,t,o,s)=>te(t,i,o,s,e),Le=(e,t,o,s,r)=>te(o,c,s,r,e,t),Be=(e,t,o,s,r,d,n)=>te(r,b,d,n,e,t,o,s),Te=(e,t,o)=>te(e,k,t,o),Me=(e,t,o,s)=>te(t,m,o,s,e),Fe=(e,t,o,s)=>_(u,F(s),e,t,[],o),Ee=(e,t,o,s)=>_(l,F(s),e,t,[],o),Ve=(e,t,o,s,r)=>_(i,F(r),t,o,[e],s),Ae=(e,t,o,s,r)=>_(i+C,F(r),t,o,[e],s),je=(e,t,o,s,r)=>_(a,F(r),t,o,[e],s),De=(e,t,o,s,r)=>_(p,F(r),t,o,[e],s),Oe=(e,t,o,s,r,d,n,I,i)=>_(g,F(i),d,n,[e,t,o,s,r],I),Qe=(e,t,o,s,r,d)=>_(c,F(d),o,s,[e,t],r),We=(e,t,o,s,r,d)=>_(C,F(d),o,s,[e,t],r),ze=(e,t,o,s,r,d,n)=>_(b,F(n),s,r,[e,t,o],d),Ge=(e,t,o,s)=>_(k,F(s),e,t,[],o),He=(e,t,o,s)=>_(w,F(s),e,t,[],o),Je=(e,t,o,s,r)=>_(m,F(r),t,o,[e],s),Ke=(e,t,o)=>_("Start"+J,F(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,F(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,F(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>T(3),Ze=e=>$("MetricIds",V(e),[]),$e=(e,t)=>$("Metric",V(t),void 0,[e]),_e=(e,t,o,s)=>_("Metric",V(s),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>T(5),ot=(e,t)=>$("SliceIds",j(t),[],[e]),st=e=>$("IndexIds",j(e),[]),rt=(e,t,o)=>$("Slice"+p,j(o),[],[e,t]),dt=(e,t,o,s)=>_("SliceIds",j(s),t,o,[e]),nt=(e,t,o,s,r)=>_("Slice"+p,j(r),o,s,[e,t]),It=(e,t,o)=>Z(e,t,o),it=()=>T(7),ut=e=>$("RelationshipIds",O(e),[]),lt=(e,t,o)=>$("RemoteRowId",O(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,O(o),[],[e,t]),at=(e,t,o)=>$("Linked"+p,O(o),[],[e,t]),pt=(e,t,o,s,r)=>_("RemoteRowId",O(r),o,s,[e,t]),gt=(e,t,o,s,r)=>_("Local"+p,O(r),o,s,[e,t]),bt=(e,t,o,s,r)=>_("Linked"+p,O(r),o,s,[e,t]),Ct=(e,t,o)=>Z(e,t,o),mt=()=>T(9),kt=e=>$("QueryIds",W(e),[]),wt=(e,t)=>$(n+i,W(t),{},[e]),yt=(e,t)=>$(n+i+C,W(t),[],[e]),ht=(e,t)=>$(n+a,W(t),[],[e]),Rt=(e,t)=>$(n+p,W(t),[],[e]),vt=(e,t,o,s=0,r,d)=>$(n+g,W(d),[],[e,t,o,s,r],6),qt=(e,t,o)=>$(n+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(n+C,W(o),[],[e,t]),ft=(e,t,o,s)=>$(n+b,W(s),void 0,[e,t,o]),xt=(e,t,o,s)=>_(n+i,W(s),t,o,[e]),St=(e,t,o,s)=>_(n+i+C,W(s),t,o,[e]),Lt=(e,t,o,s)=>_(n+a,W(s),t,o,[e]),Bt=(e,t,o,s)=>_(n+p,W(s),t,o,[e]),Tt=(e,t,o,s,r,d,I,i)=>_(n+g,W(i),d,I,[e,t,o,s,r]),Mt=(e,t,o,s,r)=>_(n+c,W(r),o,s,[e,t]),Ft=(e,t,o,s,r)=>_(n+C,W(r),o,s,[e,t]),Et=(e,t,o,s,r,d)=>_(n+b,W(d),s,r,[e,t,o]),Vt=(e,t,o)=>Z(e,t,o),At=()=>T(11),jt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),Dt=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Ot=(e=v,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>h(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Gt=e=>{const t=G(e),[o,r]=jt(t);return[(d=o,!(0==d.length)),Qt(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ht=e=>{const t=G(e),[,,[o]]=jt(t);return[!y(o),Wt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,s)=>_("Checkpoint",G(s),t,o,[e]),Nt=(e,t,o=[],s,r=[],d,n=[])=>{const[,I]=Y(),i=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{s&&(await s(i),I([]))})(),()=>{i?.destroy(),d?.(i)})),[i,...r,...n]),i},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>y(e)?{}:e(...t),oo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:so}=e,ro=({tableId:e,store:t,rowComponent:o=ao,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>lo(q(I,(d=>Yt(o,{...to(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),no=({queryId:e,queries:t,resultRowComponent:o=Po,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>lo(q(n,(r=>Yt(o,{...to(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Io=({relationshipId:e,relationships:t,rowComponent:o=ao,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[i,u,l]=oo(O(t),e),c=n(e,I,i);return lo(q(c,(e=>Yt(o,{...to(s,e),key:e,tableId:l,rowId:e,store:u,debugIds:d}))),r,d,I)},io=e=>({checkpoints:t,checkpointComponent:o=So,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return lo(q(e(jt(n)),(e=>Yt(o,{...to(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},uo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:i,queries:u,queriesById:l,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(S);return Yt(S.Provider,{value:so((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...i},u??g[8],{...g[9],...l},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,i,u,l,c,a,g])},p)},lo=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},co=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>lo(s+(ge(e,t,o,r)??s),void 0,d,o),ao=({tableId:e,rowId:t,store:o,cellComponent:s=co,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>lo(q(((e,t,o,s)=>{const r=pe(t,o,s);return e??r})(d,e,t,o),(d=>Yt(s,{...to(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),po=e=>ro(e,le(e.tableId,e.store)),go=({cellId:e,descending:t,offset:o,limit:s,...r})=>ro(r,ce(r.tableId,e,t,o,s,r.store)),bo=({store:e,tableComponent:t=po,getTableComponentProps:o,separator:s,debugIds:r})=>lo(q(ne(e),(s=>Yt(t,{...to(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Co=({valueId:e,store:t,debugIds:o})=>lo(s+(me(e,t)??s),void 0,o,e),mo=({store:e,valueComponent:t=Co,getValueComponentProps:o,separator:s,debugIds:r})=>lo(q(Ce(e),(s=>Yt(t,{...to(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ko=({metricId:e,metrics:t,debugIds:o})=>lo($e(e,t)??s,void 0,o,e),wo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=ao,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,i,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),l=rt(e,t,I);return lo(q(l,(e=>Yt(s,{...to(r,e),key:e,tableId:u,rowId:e,store:i,debugIds:n}))),d,n,t)},yo=({indexId:e,indexes:t,sliceComponent:o=wo,getSliceComponentProps:s,separator:r,debugIds:d})=>lo(q(ot(e,t),(r=>Yt(o,{...to(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ho=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=ao,getRowComponentProps:r,debugIds:d})=>{const[n,I,,i]=oo(O(o),e),u=lt(e,t,n);return lo(y(i)||y(u)?null:Yt(s,{...to(r,u),key:u,tableId:i,rowId:u,store:I,debugIds:d}),void 0,d,t)},Ro=e=>Io(e,ct,e.remoteRowId),vo=e=>Io(e,at,e.firstRowId),qo=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>lo(s+(ft(e,t,o,r)??s),void 0,d,o),Po=({queryId:e,rowId:t,queries:o,resultCellComponent:s=qo,getResultCellComponentProps:r,separator:d,debugIds:n})=>lo(q(Pt(e,t,o),(d=>Yt(s,{...to(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),fo=e=>no(e,Rt(e.queryId,e.queries)),xo=({cellId:e,descending:t,offset:o,limit:s,...r})=>no(r,vt(r.queryId,e,t,o,s,r.queries)),So=({checkpoints:e,checkpointId:t,debugIds:o})=>lo(Dt(t,e)??s,void 0,o,t),Lo=io((e=>e[0])),Bo=io((e=>y(e[1])?[]:[e[1]])),To=io((e=>e[2]));export{Lo as BackwardCheckpointsView,co as CellView,So as CheckpointView,Bo as CurrentCheckpointView,To as ForwardCheckpointsView,yo as IndexView,vo as LinkedRowsView,Ro as LocalRowsView,ko as MetricView,uo as Provider,ho as RemoteRowView,qo as ResultCellView,Po as ResultRowView,xo as ResultSortedTableView,fo as ResultTableView,ao as RowView,wo as SliceView,go as SortedTableView,po as TableView,bo as TablesView,Co as ValueView,mo as ValuesView,he as useAddRowCallback,ge as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,Dt as useCheckpoint,jt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,At as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Vt as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,Ct as useCreateQueries,It as useCreateRelationships,se as useCreateStore,Be as useDelCellCallback,Le as useDelRowCallback,Se as useDelTableCallback,xe as useDelTablesCallback,Me as useDelValueCallback,Te as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,st as useIndexIds,A as useIndexes,tt as useIndexesIds,j as useIndexesOrIndexesById,at as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,gt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,E as useMetrics,Ye as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ht as useRedoInformation,ut as useRelationshipIds,D as useRelationships,it as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,lt as useRemoteRowId,pt as useRemoteRowIdListener,ft as useResultCell,Pt as useResultCellIds,Ft as useResultCellIdsListener,Et as useResultCellListener,qt as useResultRow,ht as useResultRowCount,Lt as useResultRowCountListener,Rt as useResultRowIds,Bt as useResultRowIdsListener,Mt as useResultRowListener,vt as useResultSortedRowIds,Tt as useResultSortedRowIdsListener,wt as useResultTable,yt as useResultTableCellIds,St as useResultTableCellIdsListener,xt as useResultTableListener,ae as useRow,ue as useRowCount,je as useRowCountListener,le as useRowIds,De as useRowIdsListener,Qe as useRowListener,ve as useSetCellCallback,Ot as useSetCheckpointCallback,Re as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,ye as useSetRowCallback,we as useSetTableCallback,ke as useSetTablesCallback,fe as useSetValueCallback,qe as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,rt as useSliceRowIds,nt as useSliceRowIdsListener,ce as useSortedRowIds,Oe as useSortedRowIdsListener,Ke as useStartTransactionListener,M as useStore,re as useStoreIds,F as useStoreOrStoreById,Ie as useTable,ie as useTableCellIds,Ae as useTableCellIdsListener,ne as useTableIds,Ee as useTableIdsListener,Ve as useTableListener,de as useTables,Fe as useTablesListener,Gt as useUndoInformation,me as useValue,Ce as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u="Listener",d="Result",l="Ids",n="Table",i=n+"s",a=n+l,I="Row",c=I+"Count",C=I+l,p="Sorted"+I+l,w="Cell",b=w+l,R="Value",k=R+"s",g=R+l,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),L=e=>t(e)==r,y=()=>{},S=(e,s)=>e.map(s),V=Object.keys,{createContext:T,useContext:f}=s,x=T([]),v=(e,s)=>{const t=f(x);return h(e)?t[s]:L(e)?((e,s)=>m(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return h(e)||L(e)?t:e},q=e=>V(f(x)[e]??{}),B=e=>P(e,0),M=e=>P(e,2),D=e=>P(e,4),F=e=>P(e,6),O=e=>P(e,8),Q=e=>P(e,10),A=e=>e.toLowerCase();A(u);const E="Transaction";A(E);const{useCallback:G,useEffect:j,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],r)=>{const[,u]=z(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=z(d),n=W(l);return U((()=>n.current=d()),[d]),K(e,s,((...e)=>{n.current=h(r)?d():e[r],u([])}),[],o),n.current},K=(e,s,t,o=[],r=[],...d)=>j((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,...r,...o,...d]),N=(e,s,t,o=[],r=y,u=[],...d)=>{const l=B(e);return G((e=>m(l,(o=>m(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},X=(e,s,t=y,o=[],...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Y=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},Z=e=>J(a,B(e),[],[]),$=(e,s)=>J(C,B(s),[],[e]),_=(e,s,t,o=0,r,u)=>J(p,B(u),[],[e,s,t,o,r],6),ee=(e,s,t)=>J(b,B(t),[],[e,s]),se=(e,s,t,o)=>J(w,B(o),void 0,[e,s,t],4),te=e=>J(g,B(e),[],[]),oe=(e,s)=>J(R,B(s),void 0,[e]),re=(e,s)=>J("Metric",M(s),void 0,[e]),ue=(e,s)=>J("SliceIds",D(s),[],[e]),de=(e,s,t)=>J("Slice"+C,D(t),[],[e,s]),le=(e,s,t)=>J("RemoteRowId",F(t),void 0,[e,s]),ne=(e,s,t)=>J("Local"+C,F(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+C,F(t),[],[e,s]),ae=(e,s)=>J(d+C,O(s),[],[e]),Ie=(e,s,t,o=0,r,u)=>J(d+p,O(u),[],[e,s,t,o,r],6),ce=(e,s,t)=>J(d+b,O(t),[],[e,s]),Ce=(e,s,t,o)=>J(d+w,O(o),void 0,[e,s,t]),pe=e=>J("CheckpointIds",Q(e),[[],void 0,[]]),we=(e,s)=>J("Checkpoint",Q(s),void 0,[e]),be=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ge,createElement:he,useCallback:me,useLayoutEffect:Le,useRef:ye,useState:Se}=s,Ve=(e,...s)=>h(e)?{}:e(...s),Te=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:fe}=s,xe=({tableId:e,store:s,rowComponent:t=De,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(S(l,(u=>he(t,{...Ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ee,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(S(d,(r=>he(t,{...Ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=De,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Te(F(s),e),I=d(e,l,n);return Be(S(I,(e=>he(t,{...Ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ge,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Be(S(e(pe(d)),(e=>he(t,{...Ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Me=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Be(o+(se(e,s,t,r)??o),void 0,u,t),De=({tableId:e,rowId:s,store:t,cellComponent:o=Me,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(S(((e,s,t,o)=>{const r=ee(s,t,o);return e??r})(u,e,s,t),(u=>he(o,{...Ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Fe=e=>xe(e,$(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>Be(o+(oe(e,s)??o),void 0,t,e),Qe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=De,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=de(e,s,l);return Be(S(a,(e=>he(o,{...Ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ae=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Be(o+(Ce(e,s,t,r)??o),void 0,u,t),Ee=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ae,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(S(ce(e,s,t),(u=>he(o,{...Ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ge=({checkpoints:e,checkpointId:s,debugIds:t})=>Be(we(s,e)??o,void 0,t,s),je=qe((e=>e[0])),Ue=qe((e=>h(e[1])?[]:[e[1]])),We=qe((e=>e[2]));e.BackwardCheckpointsView=je,e.CellView=Me,e.CheckpointView=Ge,e.CurrentCheckpointView=Ue,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Qe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(S(ue(e,s),(r=>he(t,{...Ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>Pe(e,ie,e.firstRowId),e.LocalRowsView=e=>Pe(e,ne,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Be(re(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(x);return he(x.Provider,{value:fe((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=De,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Te(F(t),e),i=le(e,s,d);return Be(h(n)||h(i)?null:he(o,{...Ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ae,e.ResultRowView=Ee,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,Ie(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ve(e,ae(e.queryId,e.queries)),e.RowView=De,e.SliceView=Qe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>xe(r,_(r.tableId,e,s,t,o,r.store)),e.TableView=Fe,e.TablesView=({store:e,tableComponent:s=Fe,getTableComponentProps:t,separator:o,debugIds:r})=>Be(S(Z(e),(o=>he(s,{...Ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(S(te(e),(o=>he(s,{...Ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=B(o);return G((t=>m(l,(o=>m(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,r,u)=>K(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>K(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=we,e.useCheckpointIds=pe,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=z(),d=U((()=>s(e)),[e,...t]);return j((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d?.destroy()})),[d,...r]),d},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>X(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>X(t,I,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,B(t),e,s),e.useGoBackwardCallback=be,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>J("IndexIds",D(e),[]),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,r)=>K("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=ne,e.useLocalRowIdsListener=(e,s,t,o,r)=>K("Local"+C,F(r),t,o,[e,s]),e.useMetric=re,e.useMetricIds=e=>J("MetricIds",M(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",M(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useMetricsIds=()=>q(3),e.useMetricsOrMetricsById=M,e.useQueries=e=>v(e,8),e.useQueriesIds=()=>q(9),e.useQueriesOrQueriesById=O,e.useQueryIds=e=>J("QueryIds",O(e),[]),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=pe(s);return[!h(t),Re(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>J("RelationshipIds",F(e),[]),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,r)=>K("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Ce,e.useResultCellIds=ce,e.useResultCellIdsListener=(e,s,t,o,r)=>K(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>K(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>J(d+I,O(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(d+c,O(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(d+c,O(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>K(d+I,O(r),t,o,[e,s]),e.useResultSortedRowIds=Ie,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>K(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>J(d+n,O(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(d+n+b,O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>J(I,B(t),{},[e,s]),e.useRowCount=(e,s)=>J(c,B(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>K(c,B(r),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,r)=>K(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>K(I,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>N(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>N(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>N(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>N(r,I,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>N(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>N(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>N(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>N(t,k,e,s,o,r),e.useSliceIds=ue,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=de,e.useSliceRowIdsListener=(e,s,t,o,r)=>K("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>K(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>J(n,B(s),{},[e]),e.useTableCellIds=(e,s)=>J(n+b,B(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>K(n+b,B(r),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,B(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>K(n,B(r),s,t,[e],o),e.useTables=e=>J(i,B(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,B(o),e,s,[],t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=pe(s);return[(u=t,!(0==u.length)),be(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(g,B(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>K(R,B(r),s,t,[e],o),e.useValues=e=>J(k,B(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,B(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,B(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u="Listener",d="Result",l="Ids",n="Table",i=n+"s",a=n+l,I="Row",c=I+"Count",C=I+l,p="Sorted"+I+l,w="Cell",b=w+l,R="Value",k=R+"s",g=R+l,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),L=e=>t(e)==r,y=()=>{},S=(e,s)=>e.map(s),V=Object.keys,{createContext:T,useContext:f}=s,x=T([]),v=(e,s)=>{const t=f(x);return h(e)?t[s]:L(e)?((e,s)=>m(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return h(e)||L(e)?t:e},q=e=>V(f(x)[e]??{}),B=e=>P(e,0),M=e=>P(e,2),D=e=>P(e,4),F=e=>P(e,6),O=e=>P(e,8),Q=e=>P(e,10),A=e=>e.toLowerCase();A(u);const E="Transaction";A(E);const{useCallback:G,useEffect:j,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],r)=>{const[,u]=z(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=z(d),n=W(l);return U((()=>n.current=d()),[d]),K(e,s,((...e)=>{n.current=h(r)?d():e[r],u([])}),[],o),n.current},K=(e,s,t,o=[],r=[],...d)=>j((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,...r,...o,...d]),N=(e,s,t,o=[],r=y,u=[],...d)=>{const l=B(e);return G((e=>m(l,(o=>m(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},X=(e,s,t=y,o=[],...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Y=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},Z=e=>J(a,B(e),[],[]),$=(e,s)=>J(C,B(s),[],[e]),_=(e,s,t,o=0,r,u)=>J(p,B(u),[],[e,s,t,o,r],6),ee=(e,s,t)=>J(b,B(t),[],[e,s]),se=(e,s,t,o)=>J(w,B(o),void 0,[e,s,t],4),te=e=>J(g,B(e),[],[]),oe=(e,s)=>J(R,B(s),void 0,[e]),re=(e,s)=>J("Metric",M(s),void 0,[e]),ue=(e,s)=>J("SliceIds",D(s),[],[e]),de=(e,s,t)=>J("Slice"+C,D(t),[],[e,s]),le=(e,s,t)=>J("RemoteRowId",F(t),void 0,[e,s]),ne=(e,s,t)=>J("Local"+C,F(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+C,F(t),[],[e,s]),ae=(e,s)=>J(d+C,O(s),[],[e]),Ie=(e,s,t,o=0,r,u)=>J(d+p,O(u),[],[e,s,t,o,r],6),ce=(e,s,t)=>J(d+b,O(t),[],[e,s]),Ce=(e,s,t,o)=>J(d+w,O(o),void 0,[e,s,t]),pe=e=>J("CheckpointIds",Q(e),[[],void 0,[]]),we=(e,s)=>J("Checkpoint",Q(s),void 0,[e]),be=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ge,createElement:he,useCallback:me,useLayoutEffect:Le,useRef:ye,useState:Se}=s,Ve=(e,...s)=>h(e)?{}:e(...s),Te=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:fe}=s,xe=({tableId:e,store:s,rowComponent:t=De,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(S(l,(u=>he(t,{...Ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ee,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(S(d,(r=>he(t,{...Ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=De,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Te(F(s),e),I=d(e,l,n);return Be(S(I,(e=>he(t,{...Ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ge,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Be(S(e(pe(d)),(e=>he(t,{...Ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Me=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Be(o+(se(e,s,t,r)??o),void 0,u,t),De=({tableId:e,rowId:s,store:t,cellComponent:o=Me,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(S(((e,s,t,o)=>{const r=ee(s,t,o);return e??r})(u,e,s,t),(u=>he(o,{...Ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Fe=e=>xe(e,$(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>Be(o+(oe(e,s)??o),void 0,t,e),Qe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=De,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=de(e,s,l);return Be(S(a,(e=>he(o,{...Ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ae=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Be(o+(Ce(e,s,t,r)??o),void 0,u,t),Ee=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ae,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(S(ce(e,s,t),(u=>he(o,{...Ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ge=({checkpoints:e,checkpointId:s,debugIds:t})=>Be(we(s,e)??o,void 0,t,s),je=qe((e=>e[0])),Ue=qe((e=>h(e[1])?[]:[e[1]])),We=qe((e=>e[2]));e.BackwardCheckpointsView=je,e.CellView=Me,e.CheckpointView=Ge,e.CurrentCheckpointView=Ue,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Qe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(S(ue(e,s),(r=>he(t,{...Ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>Pe(e,ie,e.firstRowId),e.LocalRowsView=e=>Pe(e,ne,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Be(re(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(x);return he(x.Provider,{value:fe((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=De,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Te(F(t),e),i=le(e,s,d);return Be(h(n)||h(i)?null:he(o,{...Ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ae,e.ResultRowView=Ee,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,Ie(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ve(e,ae(e.queryId,e.queries)),e.RowView=De,e.SliceView=Qe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>xe(r,_(r.tableId,e,s,t,o,r.store)),e.TableView=Fe,e.TablesView=({store:e,tableComponent:s=Fe,getTableComponentProps:t,separator:o,debugIds:r})=>Be(S(Z(e),(o=>he(s,{...Ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(S(te(e),(o=>he(s,{...Ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=B(o);return G((t=>m(l,(o=>m(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,r,u)=>K(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>K(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=we,e.useCheckpointIds=pe,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[],u,d=[])=>{const[,l]=z(),n=U((()=>s(e)),[e,...t]);return j((()=>((async()=>{o&&(await o(n),l([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...d]),n},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>X(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>X(t,I,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,B(t),e,s),e.useGoBackwardCallback=be,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>J("IndexIds",D(e),[]),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,r)=>K("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=ne,e.useLocalRowIdsListener=(e,s,t,o,r)=>K("Local"+C,F(r),t,o,[e,s]),e.useMetric=re,e.useMetricIds=e=>J("MetricIds",M(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",M(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useMetricsIds=()=>q(3),e.useMetricsOrMetricsById=M,e.useQueries=e=>v(e,8),e.useQueriesIds=()=>q(9),e.useQueriesOrQueriesById=O,e.useQueryIds=e=>J("QueryIds",O(e),[]),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=pe(s);return[!h(t),Re(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>J("RelationshipIds",F(e),[]),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,r)=>K("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Ce,e.useResultCellIds=ce,e.useResultCellIdsListener=(e,s,t,o,r)=>K(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>K(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>J(d+I,O(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(d+c,O(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(d+c,O(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>K(d+I,O(r),t,o,[e,s]),e.useResultSortedRowIds=Ie,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>K(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>J(d+n,O(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(d+n+b,O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>J(I,B(t),{},[e,s]),e.useRowCount=(e,s)=>J(c,B(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>K(c,B(r),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,r)=>K(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>K(I,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>N(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>N(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>N(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>N(r,I,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>N(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>N(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>N(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>N(t,k,e,s,o,r),e.useSliceIds=ue,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=de,e.useSliceRowIdsListener=(e,s,t,o,r)=>K("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>K(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>J(n,B(s),{},[e]),e.useTableCellIds=(e,s)=>J(n+b,B(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>K(n+b,B(r),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,B(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>K(n,B(r),s,t,[e],o),e.useTables=e=>J(i,B(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,B(o),e,s,[],t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=pe(s);return[(u=t,!(0==u.length)),be(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(g,B(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>K(R,B(r),s,t,[e],o),e.useValues=e=>J(k,B(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,B(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,B(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{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]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=z(),u=U((()=>s(e)),[e,...t]);return G((()=>{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())})),()=>{null==u||u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==u.length)),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{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]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[],r,u=[])=>{const[,n]=z(),d=U((()=>s(e)),[e,...t]);return G((()=>{var e;return e=function*(){o&&(yield o(d),n([]))},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())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...l,...u]),d},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==u.length)),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "4.3.18",
3
+ "version": "4.3.20",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -180,6 +180,7 @@
180
180
  ]
181
181
  }
182
182
  },
183
+ "main": "./lib/tinybase.js",
183
184
  "react-native": "./lib/tinybase.js",
184
185
  "browser": {
185
186
  "fs": false
@@ -230,7 +231,7 @@
230
231
  "@types/less": "^3.0.5",
231
232
  "@types/node": "^20.8.7",
232
233
  "@types/puppeteer": "^5.4.7",
233
- "@types/react": "^18.2.30",
234
+ "@types/react": "^18.2.31",
234
235
  "@types/react-dom": "^18.2.14",
235
236
  "@types/react-test-renderer": "^18.0.5",
236
237
  "@types/tmp": "^0.2.5",
@@ -248,9 +249,9 @@
248
249
  "country-flag-emoji-json": "^2.0.0",
249
250
  "cspell": "^7.3.8",
250
251
  "esbuild": "^0.19.5",
251
- "eslint": "^8.51.0",
252
+ "eslint": "^8.52.0",
252
253
  "eslint-config-prettier": "^9.0.0",
253
- "eslint-plugin-jest": "^27.4.2",
254
+ "eslint-plugin-jest": "^27.4.3",
254
255
  "eslint-plugin-jsdoc": "^46.8.2",
255
256
  "eslint-plugin-react": "7.33.2",
256
257
  "eslint-plugin-react-hooks": "^4.6.0",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-3"><em>NEW!</em> v4.3 release</a> <span id="one-with">&quot;The One With PartyKit&quot;</span></p><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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">4.8kB - 9.2kB</a>, zero dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">Tinybase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.3.18" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-3"><em>NEW!</em> v4.3 release</a> <span id="one-with">&quot;The One With PartyKit&quot;</span></p><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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">4.8kB - 9.2kB</a>, zero dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">Tinybase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.3.20" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  const store = createStore()
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
247
247
  };
248
248
  ```
249
249
 
250
- <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&#x27;ll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged 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.8kB</td><td>11.4kB</td><td>48.6kB</td><td>220.1kB</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>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>127.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.4kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.2kB</td><td>43.5kB</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>9.2kB</td><td>22.6kB</td><td>97.6kB</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 for you to get your TinyBase-powered app 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,883</td><td>1,883</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,038</td><td>2,038</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>812</td><td>812</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>692</td><td>692</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,401</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,302</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><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 id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>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 as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
250
+ <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&#x27;ll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged 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.8kB</td><td>11.4kB</td><td>48.6kB</td><td>220.1kB</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>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>127.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.4kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.2kB</td><td>43.5kB</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>9.2kB</td><td>22.6kB</td><td>97.6kB</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 for you to get your TinyBase-powered app 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,884</td><td>1,884</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,039</td><td>2,039</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>812</td><td>812</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>695</td><td>695</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,402</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,316</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><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 id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>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 as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>