tinybase 4.3.23 → 4.3.24

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=j();return W((()=>l.current=d()),[d]),J(e,s,((...e)=>{l.current=k(r)?d():e[r],u([])}),[],o),l.current},J=(e,s,t,o=[],u=[],...d)=>{const l=[s,...u,...o,...d],n=W((()=>s?.["add"+e+r]?.(...u,t,...d)),l);G((()=>()=>s?.delListener(n)),l)},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);
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,c="Sorted"+i+d,x="Cell",C=x+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]??{}),f=e=>P(e,0),B=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 E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:W,useLayoutEffect:j,useRef:U,useState:z}=e,H=[],J={},K=[[],void 0,[]],N=(e,s,t=H)=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},X=(e,s,t,o=H,r)=>{const[,u]=z(),d=A((()=>s?.["get"+e]?.(...o)??t),[s,e,...o,t]),l=U();return W((()=>l.current=d()),[d]),Y(e,s,((...e)=>{l.current=k(r)?d():e[r],u([])}),[d,r],o),l.current},Y=(e,s,t,o=H,u=H,...d)=>j((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,e,...u,...o,...d]),Z=(e,s,t,o=H,r=L,u=H,...d)=>{const l=f(e);return A((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},$=(e,s,t=L,o=H,...r)=>{const u=f(e);return A((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},_=(e,s,t)=>{const o=O(e);return A((()=>o?.[s](t)),[o,s,t])},ee=e=>X(p,f(e),H),se=(e,s)=>X(I,f(s),H,[e]),te=(e,s,t,o=0,r,u)=>X(c,f(u),H,[e,s,t,o,r],6),oe=(e,s,t)=>X(C,f(t),H,[e,s]),re=(e,s,t,o)=>X(x,f(o),void 0,[e,s,t],4),ue=e=>X(R,f(e),H),de=(e,s)=>X(w,f(s),void 0,[e]),le=(e,s)=>X("Metric",B(s),void 0,[e]),ne=(e,s)=>X("SliceIds",M(s),H,[e]),pe=(e,s,t)=>X("Slice"+I,M(t),H,[e,s]),ie=(e,s,t)=>X("RemoteRowId",D(t),void 0,[e,s]),ae=(e,s,t)=>X("Local"+I,D(t),H,[e,s]),Ie=(e,s,t)=>X("Linked"+I,D(t),H,[e,s]),ce=(e,s)=>X(u+I,F(s),H,[e]),xe=(e,s,t,o=0,r,d)=>X(u+c,F(d),H,[e,s,t,o,r],6),Ce=(e,s,t)=>X(u+C,F(t),H,[e,s]),we=(e,s,t,o)=>X(u+x,F(o),void 0,[e,s,t]),be=e=>X("CheckpointIds",O(e),K),Re=(e,s)=>X("Checkpoint",O(s),void 0,[e]),ke=e=>_(e,"goBackward"),ge=e=>_(e,"goForward"),{PureComponent:he,Fragment:Le,createElement:me,useCallback:ye,useLayoutEffect:Se,useRef:Ve,useState:Te}=e,ve=(e,...s)=>k(e)?{}:e(...s),Pe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:qe}=e,fe=({tableId:e,store:s,rowComponent:t=Qe,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Fe(m(l,(u=>me(t,{...ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),Be=({queryId:e,queries:s,resultRowComponent:t=je,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Fe(m(d,(r=>me(t,{...ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Me=({relationshipId:e,relationships:s,rowComponent:t=Qe,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Pe(D(s),e),a=d(e,l,n);return Fe(m(a,(e=>me(t,{...ve(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},De=e=>({checkpoints:s,checkpointComponent:t=Ue,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Fe(m(e(be(d)),(e=>me(t,{...ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Fe=(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},Oe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Fe(t+(re(e,s,o,r)??t),void 0,u,o),Qe=({tableId:e,rowId:s,store:t,cellComponent:o=Oe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Fe(m(((e,s,t,o)=>{const r=oe(s,t,o);return e??r})(u,e,s,t),(u=>me(o,{...ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Ee=e=>fe(e,se(e.tableId,e.store)),Ae=({valueId:e,store:s,debugIds:o})=>Fe(t+(de(e,s)??t),void 0,o,e),Ge=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Qe,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=pe(e,s,l);return Fe(m(i,(e=>me(o,{...ve(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},We=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Fe(t+(we(e,s,o,r)??t),void 0,u,o),je=({queryId:e,rowId:s,queries:t,resultCellComponent:o=We,getResultCellComponentProps:r,separator:u,debugIds:d})=>Fe(m(Ce(e,s,t),(u=>me(o,{...ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ue=({checkpoints:e,checkpointId:s,debugIds:o})=>Fe(Re(s,e)??t,void 0,o,s),ze=De((e=>e[0])),He=De((e=>k(e[1])?[]:[e[1]])),Je=De((e=>e[2]));exports.BackwardCheckpointsView=ze,exports.CellView=Oe,exports.CheckpointView=Ue,exports.CurrentCheckpointView=He,exports.ForwardCheckpointsView=Je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ge,getSliceComponentProps:o,separator:r,debugIds:u})=>Fe(m(ne(e,s),(r=>me(t,{...ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Me(e,Ie,e.firstRowId),exports.LocalRowsView=e=>Me(e,ae,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Fe(le(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:c})=>{const x=e.useContext(T);return me(T.Provider,{value:qe((()=>[s??x[0],{...x[1],...t},o??x[2],{...x[3],...r},u??x[4],{...x[5],...d},l??x[6],{...x[7],...n},p??x[8],{...x[9],...i},a??x[10],{...x[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,x])},c)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Qe,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Pe(D(t),e),p=ie(e,s,d);return Fe(k(n)||k(p)?null:me(o,{...ve(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=We,exports.ResultRowView=je,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Be(r,xe(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>Be(e,ce(e.queryId,e.queries)),exports.RowView=Qe,exports.SliceView=Ge,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>fe(r,te(r.tableId,e,s,t,o,r.store)),exports.TableView=Ee,exports.TablesView=({store:e,tableComponent:s=Ee,getTableComponentProps:t,separator:o,debugIds:r})=>Fe(m(ee(e),(o=>me(s,{...ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Ae,exports.ValuesView=({store:e,valueComponent:s=Ae,getValueComponentProps:t,separator:o,debugIds:r})=>Fe(m(ue(e),(o=>me(s,{...ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=H,o,r=L,u=H,d=!0)=>{const l=f(o);return A((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=re,exports.useCellIds=oe,exports.useCellIdsListener=(e,s,t,o,r,u)=>Y(C,f(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>Y(x,f(d),o,r,[e,s,t],u),exports.useCheckpoint=Re,exports.useCheckpointIds=be,exports.useCheckpointIdsListener=(e,s,t)=>Y("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>Y("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>N(e,s,t),exports.useCreateIndexes=(e,s,t)=>N(e,s,t),exports.useCreateMetrics=(e,s,t)=>N(e,s,t),exports.useCreatePersister=(e,s,t=H,o,r=H,u,d=H)=>{const[,l]=z(),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)=>N(e,s,t),exports.useCreateRelationships=(e,s,t)=>N(e,s,t),exports.useCreateStore=(e,s=H)=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>$(r,x,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>$(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>$(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>$(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>$(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>$(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>Y("DidFinish"+E,f(t),e,s),exports.useGoBackwardCallback=ke,exports.useGoForwardCallback=ge,exports.useGoToCallback=(e,s=H,t,o=L,r=H)=>{const u=O(t);return A((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>X("IndexIds",M(e),H),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=Ie,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>Y("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=ae,exports.useLocalRowIdsListener=(e,s,t,o,r)=>Y("Local"+I,D(r),t,o,[e,s]),exports.useMetric=le,exports.useMetricIds=e=>X("MetricIds",B(e),H),exports.useMetricListener=(e,s,t,o)=>Y("Metric",B(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=B,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>X("QueryIds",F(e),H),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=be(s);return[!k(o),ge(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>X("RelationshipIds",D(e),H),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=ie,exports.useRemoteRowIdListener=(e,s,t,o,r)=>Y("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=we,exports.useResultCellIds=Ce,exports.useResultCellIdsListener=(e,s,t,o,r)=>Y(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>Y(u+x,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>X(u+i,F(t),J,[e,s]),exports.useResultRowCount=(e,s)=>X(u+a,F(s),0,[e]),exports.useResultRowCountListener=(e,s,t,o)=>Y(u+a,F(o),s,t,[e]),exports.useResultRowIds=ce,exports.useResultRowIdsListener=(e,s,t,o)=>Y(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>Y(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=xe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>Y(u+c,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>X(u+l,F(s),J,[e]),exports.useResultTableCellIds=(e,s)=>X(u+l+C,F(s),H,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>Y(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>Y(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>X(i,f(t),J,[e,s]),exports.useRowCount=(e,s)=>X(a,f(s),0,[e]),exports.useRowCountListener=(e,s,t,o,r)=>Y(a,f(r),s,t,[e],o),exports.useRowIds=se,exports.useRowIdsListener=(e,s,t,o,r)=>Y(I,f(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>Y(i,f(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>Z(u,x,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=H,t,o=L,r=H)=>{const u=O(t);return A((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)=>Z(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>Z(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>Z(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>Z(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>Z(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>Z(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>Z(t,b,e,s,o,r),exports.useSliceIds=ne,exports.useSliceIdsListener=(e,s,t,o)=>Y("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=pe,exports.useSliceRowIdsListener=(e,s,t,o,r)=>Y("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=te,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>Y(c,f(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>Y("Start"+E,f(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=f,exports.useTable=(e,s)=>X(l,f(s),J,[e]),exports.useTableCellIds=(e,s)=>X(l+C,f(s),H,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>Y(l+C,f(r),s,t,[e],o),exports.useTableIds=ee,exports.useTableIdsListener=(e,s,t,o)=>Y(p,f(o),e,s,H,t),exports.useTableListener=(e,s,t,o,r)=>Y(l,f(r),s,t,[e],o),exports.useTables=e=>X(n,f(e),J),exports.useTablesListener=(e,s,t,o)=>Y(n,f(o),e,s,H,t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=be(s);return[(u=o,!(0==u.length)),ke(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=de,exports.useValueIds=ue,exports.useValueIdsListener=(e,s,t,o)=>Y(R,f(o),e,s,H,t),exports.useValueListener=(e,s,t,o,r)=>Y(w,f(r),s,t,[e],o),exports.useValues=e=>X(b,f(e),J),exports.useValuesListener=(e,s,t,o)=>Y(b,f(o),e,s,H,t),exports.useWillFinishTransactionListener=(e,s,t)=>Y("WillFinish"+E,f(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=W();return G((()=>n.current=u()),[u]),J(e,s,((...e)=>{n.current=k(r)?u():e[r],l([])}),[],o),n.current},J=(e,s,t,o=[],l=[],...u)=>{const n=[s,...l,...o,...u],d=G((()=>{var o;return null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u)}),n);A((()=>()=>null==s?void 0:s.delListener(d)),n)},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);
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,useLayoutEffect:W,useRef:U,useState:z}=e,H=[],J={},K=[[],void 0,[]],N=(e,s,t=H)=>{const o=G((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},X=(e,s,t,o=H,r)=>{const[,l]=z(),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,e,...o,t]),n=U();return G((()=>n.current=u()),[u]),Y(e,s,((...e)=>{n.current=k(r)?u():e[r],l([])}),[u,r],o),n.current},Y=(e,s,t,o=H,l=H,...u)=>W((()=>{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,e,...l,...o,...u]),Z=(e,s,t,o=H,r=h,l=H,...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])},$=(e,s,t=h,o=H,...r)=>{const l=O(e);return E((()=>t(null==l?void 0:l["del"+s](...r))),[l,s,...o,...r])},_=(e,s,t)=>{const o=F(e);return E((()=>null==o?void 0:o[s](t)),[o,s,t])},ee=e=>X(i,O(e),H),se=(e,s)=>X(c,O(s),H,[e]),te=(e,s,t,o=0,r,l)=>X(I,O(l),H,[e,s,t,o,r],6),oe=(e,s,t)=>X(C,O(t),H,[e,s]),re=(e,s,t,o)=>X(x,O(o),void 0,[e,s,t],4),le=e=>X(R,O(e),H),ue=(e,s)=>X(b,O(s),void 0,[e]),ne=(e,s)=>X("Metric",q(s),void 0,[e]),de=(e,s)=>X("SliceIds",B(s),H,[e]),ie=(e,s,t)=>X("Slice"+c,B(t),H,[e,s]),pe=(e,s,t)=>X("RemoteRowId",M(t),void 0,[e,s]),ae=(e,s,t)=>X("Local"+c,M(t),H,[e,s]),ce=(e,s,t)=>X("Linked"+c,M(t),H,[e,s]),Ie=(e,s)=>X(l+c,D(s),H,[e]),xe=(e,s,t,o=0,r,u)=>X(l+I,D(u),H,[e,s,t,o,r],6),Ce=(e,s,t)=>X(l+C,D(t),H,[e,s]),be=(e,s,t,o)=>X(l+x,D(o),void 0,[e,s,t]),we=e=>X("CheckpointIds",F(e),K),Re=(e,s)=>X("Checkpoint",F(s),void 0,[e]),ke=e=>_(e,"goBackward"),ve=e=>_(e,"goForward"),{PureComponent:ge,Fragment:he,createElement:me,useCallback:ye,useLayoutEffect:Le,useRef:Se,useState:Ve}=e,fe=(e,...s)=>k(e)?{}:e(...s),Te=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Pe=Object.defineProperty,Oe=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,Fe=(e,s,t)=>s in e?Pe(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,je=(e,s)=>{for(var t in s||(s={}))Me.call(s,t)&&Fe(e,t,s[t]);if(Be)for(var t of Be(s))De.call(s,t)&&Fe(e,t,s[t]);return e},Qe=(e,s)=>Oe(e,qe(s)),Ee=(e,s)=>{var t={};for(var o in e)Me.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Be)for(var o of Be(e))s.indexOf(o)<0&&De.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Ae}=e,Ge=({tableId:e,store:s,rowComponent:t=Ke,getRowComponentProps:o,customCellIds:r,separator:l,debugIds:u},n)=>He(m(n,(l=>me(t,Qe(je({},fe(o,l)),{key:l,tableId:e,rowId:l,customCellIds:r,store:s,debugIds:u})))),l,u,e),We=({queryId:e,queries:s,resultRowComponent:t=$e,getResultRowComponentProps:o,separator:r,debugIds:l},u)=>He(m(u,(r=>me(t,Qe(je({},fe(o,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:l})))),r,l,e),Ue=({relationshipId:e,relationships:s,rowComponent:t=Ke,getRowComponentProps:o,separator:r,debugIds:l},u,n)=>{const[d,i,p]=Te(M(s),e),a=u(e,n,d);return He(m(a,(e=>me(t,Qe(je({},fe(o,e)),{key:e,tableId:p,rowId:e,store:i,debugIds:l})))),r,l,n)},ze=e=>({checkpoints:s,checkpointComponent:t=_e,getCheckpointComponentProps:o,separator:r,debugIds:l})=>{const u=F(s);return He(m(e(we(u)),(e=>me(t,Qe(je({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),r)},He=(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},Je=({tableId:e,rowId:s,cellId:o,store:r,debugIds:l})=>{var u;return He(t+(null!=(u=re(e,s,o,r))?u:t),void 0,l,o)},Ke=({tableId:e,rowId:s,store:t,cellComponent:o=Je,getCellComponentProps:r,customCellIds:l,separator:u,debugIds:n})=>He(m(((e,s,t,o)=>{const r=oe(s,t,o);return null!=e?e:r})(l,e,s,t),(l=>me(o,Qe(je({},fe(r,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),Ne=e=>Ge(e,se(e.tableId,e.store)),Xe=({valueId:e,store:s,debugIds:o})=>{var r;return He(t+(null!=(r=ue(e,s))?r:t),void 0,o,e)},Ye=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ke,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=ie(e,s,n);return He(m(p,(e=>me(o,Qe(je({},fe(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},Ze=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:l})=>{var u;return He(t+(null!=(u=be(e,s,o,r))?u:t),void 0,l,o)},$e=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ze,getResultCellComponentProps:r,separator:l,debugIds:u})=>He(m(Ce(e,s,t),(l=>me(o,Qe(je({},fe(r,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),_e=({checkpoints:e,checkpointId:s,debugIds:o})=>{var r;return He(null!=(r=Re(s,e))?r:t,void 0,o,s)},es=ze((e=>e[0])),ss=ze((e=>k(e[1])?[]:[e[1]])),ts=ze((e=>e[2]));exports.BackwardCheckpointsView=es,exports.CellView=Je,exports.CheckpointView=_e,exports.CurrentCheckpointView=ss,exports.ForwardCheckpointsView=ts,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ye,getSliceComponentProps:o,separator:r,debugIds:l})=>He(m(de(e,s),(r=>me(t,Qe(je({},fe(o,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:l})))),r,l,e),exports.LinkedRowsView=e=>Ue(e,ce,e.firstRowId),exports.LocalRowsView=e=>Ue(e,ae,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>{var r;return He(null!=(r=ne(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 me(V.Provider,{value:Ae((()=>[null!=s?s:x[0],je(je({},x[1]),t),null!=o?o:x[2],je(je({},x[3]),r),null!=l?l:x[4],je(je({},x[5]),u),null!=n?n:x[6],je(je({},x[7]),d),null!=i?i:x[8],je(je({},x[9]),p),null!=a?a:x[10],je(je({},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=Ke,getRowComponentProps:r,debugIds:l})=>{const[u,n,,d]=Te(M(t),e),i=pe(e,s,u);return He(k(d)||k(i)?null:me(o,Qe(je({},fe(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=Ze,exports.ResultRowView=$e,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=Ee(s,["cellId","descending","offset","limit"]);return We(u,xe(u.queryId,t,o,r,l,u.queries))},exports.ResultTableView=e=>We(e,Ie(e.queryId,e.queries)),exports.RowView=Ke,exports.SliceView=Ye,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=Ee(s,["cellId","descending","offset","limit"]);return Ge(u,te(u.tableId,t,o,r,l,u.store))},exports.TableView=Ne,exports.TablesView=({store:e,tableComponent:s=Ne,getTableComponentProps:t,separator:o,debugIds:r})=>He(m(ee(e),(o=>me(s,Qe(je({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:r})))),o),exports.ValueView=Xe,exports.ValuesView=({store:e,valueComponent:s=Xe,getValueComponentProps:t,separator:o,debugIds:r})=>He(m(le(e),(o=>me(s,Qe(je({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:r})))),o),exports.useAddRowCallback=(e,s,t=H,o,r=h,l=H,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=re,exports.useCellIds=oe,exports.useCellIdsListener=(e,s,t,o,r,l)=>Y(C,O(l),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,l,u)=>Y(x,O(u),o,r,[e,s,t],l),exports.useCheckpoint=Re,exports.useCheckpointIds=we,exports.useCheckpointIdsListener=(e,s,t)=>Y("CheckpointIds",F(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>Y("Checkpoint",F(o),s,t,[e]),exports.useCheckpoints=e=>f(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=F,exports.useCreateCheckpoints=(e,s,t)=>N(e,s,t),exports.useCreateIndexes=(e,s,t)=>N(e,s,t),exports.useCreateMetrics=(e,s,t)=>N(e,s,t),exports.useCreatePersister=(e,s,t=H,o,r=H,l,u=H)=>{const[,n]=z(),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)=>N(e,s,t),exports.useCreateRelationships=(e,s,t)=>N(e,s,t),exports.useCreateStore=(e,s=H)=>G(e,s),exports.useDelCellCallback=(e,s,t,o,r,l,u)=>$(r,x,l,u,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>$(t,p,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>$(s,n,t,o,e),exports.useDelTablesCallback=(e,s,t)=>$(e,d,s,t),exports.useDelValueCallback=(e,s,t,o)=>$(s,b,t,o,e),exports.useDelValuesCallback=(e,s,t)=>$(e,w,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>Y("DidFinish"+Q,O(t),e,s),exports.useGoBackwardCallback=ke,exports.useGoForwardCallback=ve,exports.useGoToCallback=(e,s=H,t,o=h,r=H)=>{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=>X("IndexIds",B(e),H),exports.useIndexes=e=>f(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=B,exports.useLinkedRowIds=ce,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>Y("Linked"+c,M(r),t,o,[e,s]),exports.useLocalRowIds=ae,exports.useLocalRowIdsListener=(e,s,t,o,r)=>Y("Local"+c,M(r),t,o,[e,s]),exports.useMetric=ne,exports.useMetricIds=e=>X("MetricIds",q(e),H),exports.useMetricListener=(e,s,t,o)=>Y("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=>X("QueryIds",D(e),H),exports.useRedoInformation=e=>{var s;const o=F(e),[,,[r]]=we(o);return[!k(r),ve(o),r,null!=(s=v(r,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>X("RelationshipIds",M(e),H),exports.useRelationships=e=>f(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=pe,exports.useRemoteRowIdListener=(e,s,t,o,r)=>Y("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=be,exports.useResultCellIds=Ce,exports.useResultCellIdsListener=(e,s,t,o,r)=>Y(l+C,D(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>Y(l+x,D(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>X(l+p,D(t),J,[e,s]),exports.useResultRowCount=(e,s)=>X(l+a,D(s),0,[e]),exports.useResultRowCountListener=(e,s,t,o)=>Y(l+a,D(o),s,t,[e]),exports.useResultRowIds=Ie,exports.useResultRowIdsListener=(e,s,t,o)=>Y(l+c,D(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>Y(l+p,D(r),t,o,[e,s]),exports.useResultSortedRowIds=xe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>Y(l+I,D(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>X(l+n,D(s),J,[e]),exports.useResultTableCellIds=(e,s)=>X(l+n+C,D(s),H,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>Y(l+n+C,D(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>Y(l+n,D(o),s,t,[e]),exports.useRow=(e,s,t)=>X(p,O(t),J,[e,s]),exports.useRowCount=(e,s)=>X(a,O(s),0,[e]),exports.useRowCountListener=(e,s,t,o,r)=>Y(a,O(r),s,t,[e],o),exports.useRowIds=se,exports.useRowIdsListener=(e,s,t,o,r)=>Y(c,O(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,l)=>Y(p,O(l),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,l,u,n)=>Z(l,x,o,r,u,n,e,s,t),exports.useSetCheckpointCallback=(e=h,s=H,t,o=h,r=H)=>{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)=>Z(r,"PartialRow",t,o,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>Z(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,l,u)=>Z(r,p,t,o,l,u,e,s),exports.useSetTableCallback=(e,s,t,o,r,l)=>Z(o,n,s,t,r,l,e),exports.useSetTablesCallback=(e,s,t,o,r)=>Z(t,d,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,l)=>Z(o,b,s,t,r,l,e),exports.useSetValuesCallback=(e,s,t,o,r)=>Z(t,w,e,s,o,r),exports.useSliceIds=de,exports.useSliceIdsListener=(e,s,t,o)=>Y("SliceIds",B(o),s,t,[e]),exports.useSliceRowIds=ie,exports.useSliceRowIdsListener=(e,s,t,o,r)=>Y("Slice"+c,B(r),t,o,[e,s]),exports.useSortedRowIds=te,exports.useSortedRowIdsListener=(e,s,t,o,r,l,u,n,d)=>Y(I,O(d),l,u,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>Y("Start"+Q,O(t),e,s),exports.useStore=e=>f(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=O,exports.useTable=(e,s)=>X(n,O(s),J,[e]),exports.useTableCellIds=(e,s)=>X(n+C,O(s),H,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>Y(n+C,O(r),s,t,[e],o),exports.useTableIds=ee,exports.useTableIdsListener=(e,s,t,o)=>Y(i,O(o),e,s,H,t),exports.useTableListener=(e,s,t,o,r)=>Y(n,O(r),s,t,[e],o),exports.useTables=e=>X(d,O(e),J),exports.useTablesListener=(e,s,t,o)=>Y(d,O(o),e,s,H,t),exports.useUndoInformation=e=>{var s;const o=F(e),[r,l]=we(o);return[(u=r,!(0==u.length)),ke(o),l,null!=(s=v(l,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t];var u},exports.useValue=ue,exports.useValueIds=le,exports.useValueIdsListener=(e,s,t,o)=>Y(R,O(o),e,s,H,t),exports.useValueListener=(e,s,t,o,r)=>Y(b,O(r),s,t,[e],o),exports.useValues=e=>X(w,O(e),J),exports.useValuesListener=(e,s,t,o)=>Y(w,O(o),e,s,H,t),exports.useWillFinishTransactionListener=(e,s,t)=>Y("WillFinish"+Q,O(t),e,s);
Binary file
@@ -81,10 +81,14 @@ const {
81
81
  useCallback: useCallback$1,
82
82
  useEffect,
83
83
  useMemo: useMemo$1,
84
+ useLayoutEffect: useLayoutEffect$1,
84
85
  useRef: useRef$1,
85
86
  useState: useState$1,
86
87
  } = React;
87
- const useCreate = (store, create, createDeps = []) => {
88
+ const EMPTY_ARRAY = [];
89
+ const EMPTY_OBJECT = {};
90
+ const DEFAULT_CHECKPOINT_IDS = [[], void 0, []];
91
+ const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
88
92
  const thing = useMemo$1(
89
93
  () => create(store),
90
94
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -97,14 +101,14 @@ const useListenable = (
97
101
  listenable,
98
102
  thing,
99
103
  defaulted,
100
- args = [],
104
+ args = EMPTY_ARRAY,
101
105
  getFromListenerArg,
102
106
  ) => {
103
107
  const [, rerender] = useState$1();
104
108
  const getResult = useCallback$1(
105
109
  () => thing?.[GET + listenable]?.(...args) ?? defaulted,
106
110
  /* eslint-disable-next-line react-hooks/exhaustive-deps */
107
- [thing, ...args],
111
+ [thing, listenable, ...args, defaulted],
108
112
  );
109
113
  const result = useRef$1();
110
114
  useMemo$1(() => (result.current = getResult()), [getResult]);
@@ -117,7 +121,7 @@ const useListenable = (
117
121
  : listenerArgs[getFromListenerArg];
118
122
  rerender([]);
119
123
  },
120
- [],
124
+ [getResult, getFromListenerArg],
121
125
  args,
122
126
  );
123
127
  return result.current;
@@ -126,30 +130,25 @@ const useListener = (
126
130
  listenable,
127
131
  thing,
128
132
  listener,
129
- listenerDeps = [],
130
- preArgs = [],
133
+ listenerDeps = EMPTY_ARRAY,
134
+ preArgs = EMPTY_ARRAY,
131
135
  ...postArgs
132
- ) => {
133
- const deps = [thing, ...preArgs, ...listenerDeps, ...postArgs];
134
- const listenerId = useMemo$1(
135
- () =>
136
- thing?.[ADD + listenable + LISTENER]?.(...preArgs, listener, ...postArgs),
137
- // eslint-disable-next-line react-hooks/exhaustive-deps
138
- deps,
139
- );
140
- useEffect(
141
- () => () => thing?.delListener(listenerId),
142
- // eslint-disable-next-line react-hooks/exhaustive-deps
143
- deps,
144
- );
145
- };
136
+ ) =>
137
+ useLayoutEffect$1(() => {
138
+ const listenerId = thing?.[ADD + listenable + LISTENER]?.(
139
+ ...preArgs,
140
+ listener,
141
+ ...postArgs,
142
+ );
143
+ return () => thing?.delListener(listenerId);
144
+ }, [thing, listenable, ...preArgs, ...listenerDeps, ...postArgs]);
146
145
  const useSetCallback = (
147
146
  storeOrStoreId,
148
147
  settable,
149
148
  get,
150
- getDeps = [],
149
+ getDeps = EMPTY_ARRAY,
151
150
  then = getUndefined,
152
- thenDeps = [],
151
+ thenDeps = EMPTY_ARRAY,
153
152
  ...args
154
153
  ) => {
155
154
  const store = useStoreOrStoreById(storeOrStoreId);
@@ -168,7 +167,7 @@ const useDel = (
168
167
  storeOrStoreId,
169
168
  deletable,
170
169
  then = getUndefined,
171
- thenDeps = [],
170
+ thenDeps = EMPTY_ARRAY,
172
171
  ...args
173
172
  ) => {
174
173
  const store = useStoreOrStoreById(storeOrStoreId);
@@ -188,26 +187,30 @@ const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
188
187
  [checkpoints, action, arg],
189
188
  );
190
189
  };
191
- const useCreateStore = (create, createDeps = []) =>
190
+ const useCreateStore = (create, createDeps = EMPTY_ARRAY) =>
192
191
  useMemo$1(create, createDeps);
193
192
  const useStoreIds = () => useThingIds(1);
194
193
  const useTables = (storeOrStoreId) =>
195
- useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), {});
194
+ useListenable(TABLES, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT);
196
195
  const useTableIds = (storeOrStoreId) =>
197
- useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), [], []);
196
+ useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY);
198
197
  const useTable = (tableId, storeOrStoreId) =>
199
- useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), {}, [tableId]);
198
+ useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT, [
199
+ tableId,
200
+ ]);
200
201
  const useTableCellIds = (tableId, storeOrStoreId) =>
201
202
  useListenable(
202
203
  TABLE + CELL_IDS,
203
204
  useStoreOrStoreById(storeOrStoreId),
204
- [],
205
+ EMPTY_ARRAY,
205
206
  [tableId],
206
207
  );
207
208
  const useRowCount = (tableId, storeOrStoreId) =>
208
- useListenable(ROW_COUNT, useStoreOrStoreById(storeOrStoreId), [], [tableId]);
209
+ useListenable(ROW_COUNT, useStoreOrStoreById(storeOrStoreId), 0, [tableId]);
209
210
  const useRowIds = (tableId, storeOrStoreId) =>
210
- useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), [], [tableId]);
211
+ useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY, [
212
+ tableId,
213
+ ]);
211
214
  const useSortedRowIds = (
212
215
  tableId,
213
216
  cellId,
@@ -219,19 +222,20 @@ const useSortedRowIds = (
219
222
  useListenable(
220
223
  SORTED_ROW_IDS,
221
224
  useStoreOrStoreById(storeOrStoreId),
222
- [],
225
+ EMPTY_ARRAY,
223
226
  [tableId, cellId, descending, offset, limit],
224
227
  6,
225
228
  );
226
229
  const useRow = (tableId, rowId, storeOrStoreId) =>
227
- useListenable(ROW, useStoreOrStoreById(storeOrStoreId), {}, [tableId, rowId]);
230
+ useListenable(ROW, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT, [
231
+ tableId,
232
+ rowId,
233
+ ]);
228
234
  const useCellIds = (tableId, rowId, storeOrStoreId) =>
229
- useListenable(
230
- CELL_IDS,
231
- useStoreOrStoreById(storeOrStoreId),
232
- [],
233
- [tableId, rowId],
234
- );
235
+ useListenable(CELL_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY, [
236
+ tableId,
237
+ rowId,
238
+ ]);
235
239
  const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
236
240
  useListenable(
237
241
  CELL,
@@ -241,9 +245,9 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
241
245
  4,
242
246
  );
243
247
  const useValues = (storeOrStoreId) =>
244
- useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), {});
248
+ useListenable(VALUES, useStoreOrStoreById(storeOrStoreId), EMPTY_OBJECT);
245
249
  const useValueIds = (storeOrStoreId) =>
246
- useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), [], []);
250
+ useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), EMPTY_ARRAY);
247
251
  const useValue = (valueId, storeOrStoreId) =>
248
252
  useListenable(VALUE, useStoreOrStoreById(storeOrStoreId), void 0, [valueId]);
249
253
  const useSetTablesCallback = (
@@ -300,10 +304,10 @@ const useSetRowCallback = (
300
304
  const useAddRowCallback = (
301
305
  tableId,
302
306
  getRow,
303
- getRowDeps = [],
307
+ getRowDeps = EMPTY_ARRAY,
304
308
  storeOrStoreId,
305
309
  then = getUndefined,
306
- thenDeps = [],
310
+ thenDeps = EMPTY_ARRAY,
307
311
  reuseRowIds = true,
308
312
  ) => {
309
313
  const store = useStoreOrStoreById(storeOrStoreId);
@@ -440,7 +444,7 @@ const useTablesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
440
444
  useStoreOrStoreById(storeOrStoreId),
441
445
  listener,
442
446
  listenerDeps,
443
- [],
447
+ EMPTY_ARRAY,
444
448
  mutator,
445
449
  );
446
450
  const useTableIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
@@ -449,7 +453,7 @@ const useTableIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
449
453
  useStoreOrStoreById(storeOrStoreId),
450
454
  listener,
451
455
  listenerDeps,
452
- [],
456
+ EMPTY_ARRAY,
453
457
  mutator,
454
458
  );
455
459
  const useTableListener = (
@@ -586,7 +590,7 @@ const useValuesListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
586
590
  useStoreOrStoreById(storeOrStoreId),
587
591
  listener,
588
592
  listenerDeps,
589
- [],
593
+ EMPTY_ARRAY,
590
594
  mutator,
591
595
  );
592
596
  const useValueIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
@@ -595,7 +599,7 @@ const useValueIdsListener = (listener, listenerDeps, mutator, storeOrStoreId) =>
595
599
  useStoreOrStoreById(storeOrStoreId),
596
600
  listener,
597
601
  listenerDeps,
598
- [],
602
+ EMPTY_ARRAY,
599
603
  mutator,
600
604
  );
601
605
  const useValueListener = (
@@ -646,7 +650,11 @@ const useCreateMetrics = (store, create, createDeps) =>
646
650
  useCreate(store, create, createDeps);
647
651
  const useMetricsIds = () => useThingIds(3);
648
652
  const useMetricIds = (metricsOrMetricsId) =>
649
- useListenable('MetricIds', useMetricsOrMetricsById(metricsOrMetricsId), []);
653
+ useListenable(
654
+ 'MetricIds',
655
+ useMetricsOrMetricsById(metricsOrMetricsId),
656
+ EMPTY_ARRAY,
657
+ );
650
658
  const useMetric = (metricId, metricsOrMetricsId) =>
651
659
  useListenable('Metric', useMetricsOrMetricsById(metricsOrMetricsId), void 0, [
652
660
  metricId,
@@ -671,16 +679,20 @@ const useSliceIds = (indexId, indexesOrIndexesId) =>
671
679
  useListenable(
672
680
  'SliceIds',
673
681
  useIndexesOrIndexesById(indexesOrIndexesId),
674
- [],
682
+ EMPTY_ARRAY,
675
683
  [indexId],
676
684
  );
677
685
  const useIndexIds = (indexesOrIndexesId) =>
678
- useListenable('IndexIds', useIndexesOrIndexesById(indexesOrIndexesId), []);
686
+ useListenable(
687
+ 'IndexIds',
688
+ useIndexesOrIndexesById(indexesOrIndexesId),
689
+ EMPTY_ARRAY,
690
+ );
679
691
  const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
680
692
  useListenable(
681
693
  'Slice' + ROW_IDS,
682
694
  useIndexesOrIndexesById(indexesOrIndexesId),
683
- [],
695
+ EMPTY_ARRAY,
684
696
  [indexId, sliceId],
685
697
  );
686
698
  const useSliceIdsListener = (
@@ -717,7 +729,7 @@ const useRelationshipIds = (relationshipsOrRelationshipsId) =>
717
729
  useListenable(
718
730
  'RelationshipIds',
719
731
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
720
- [],
732
+ EMPTY_ARRAY,
721
733
  );
722
734
  const useRemoteRowId = (
723
735
  relationshipId,
@@ -738,7 +750,7 @@ const useLocalRowIds = (
738
750
  useListenable(
739
751
  'Local' + ROW_IDS,
740
752
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
741
- [],
753
+ EMPTY_ARRAY,
742
754
  [relationshipId, remoteRowId],
743
755
  );
744
756
  const useLinkedRowIds = (
@@ -749,7 +761,7 @@ const useLinkedRowIds = (
749
761
  useListenable(
750
762
  'Linked' + ROW_IDS,
751
763
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
752
- [],
764
+ EMPTY_ARRAY,
753
765
  [relationshipId, firstRowId],
754
766
  );
755
767
  const useRemoteRowIdListener = (
@@ -798,33 +810,37 @@ const useCreateQueries = (store, create, createDeps) =>
798
810
  useCreate(store, create, createDeps);
799
811
  const useQueriesIds = () => useThingIds(9);
800
812
  const useQueryIds = (queriesOrQueriesId) =>
801
- useListenable('QueryIds', useQueriesOrQueriesById(queriesOrQueriesId), []);
813
+ useListenable(
814
+ 'QueryIds',
815
+ useQueriesOrQueriesById(queriesOrQueriesId),
816
+ EMPTY_ARRAY,
817
+ );
802
818
  const useResultTable = (queryId, queriesOrQueriesId) =>
803
819
  useListenable(
804
820
  RESULT + TABLE,
805
821
  useQueriesOrQueriesById(queriesOrQueriesId),
806
- {},
822
+ EMPTY_OBJECT,
807
823
  [queryId],
808
824
  );
809
825
  const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
810
826
  useListenable(
811
827
  RESULT + TABLE + CELL_IDS,
812
828
  useQueriesOrQueriesById(queriesOrQueriesId),
813
- [],
829
+ EMPTY_ARRAY,
814
830
  [queryId],
815
831
  );
816
832
  const useResultRowCount = (queryId, queriesOrQueriesId) =>
817
833
  useListenable(
818
834
  RESULT + ROW_COUNT,
819
835
  useQueriesOrQueriesById(queriesOrQueriesId),
820
- [],
836
+ 0,
821
837
  [queryId],
822
838
  );
823
839
  const useResultRowIds = (queryId, queriesOrQueriesId) =>
824
840
  useListenable(
825
841
  RESULT + ROW_IDS,
826
842
  useQueriesOrQueriesById(queriesOrQueriesId),
827
- [],
843
+ EMPTY_ARRAY,
828
844
  [queryId],
829
845
  );
830
846
  const useResultSortedRowIds = (
@@ -838,20 +854,22 @@ const useResultSortedRowIds = (
838
854
  useListenable(
839
855
  RESULT + SORTED_ROW_IDS,
840
856
  useQueriesOrQueriesById(queriesOrQueriesId),
841
- [],
857
+ EMPTY_ARRAY,
842
858
  [queryId, cellId, descending, offset, limit],
843
859
  6,
844
860
  );
845
861
  const useResultRow = (queryId, rowId, queriesOrQueriesId) =>
846
- useListenable(RESULT + ROW, useQueriesOrQueriesById(queriesOrQueriesId), {}, [
847
- queryId,
848
- rowId,
849
- ]);
862
+ useListenable(
863
+ RESULT + ROW,
864
+ useQueriesOrQueriesById(queriesOrQueriesId),
865
+ EMPTY_OBJECT,
866
+ [queryId, rowId],
867
+ );
850
868
  const useResultCellIds = (queryId, rowId, queriesOrQueriesId) =>
851
869
  useListenable(
852
870
  RESULT + CELL_IDS,
853
871
  useQueriesOrQueriesById(queriesOrQueriesId),
854
- [],
872
+ EMPTY_ARRAY,
855
873
  [queryId, rowId],
856
874
  );
857
875
  const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
@@ -980,7 +998,7 @@ const useCheckpointIds = (checkpointsOrCheckpointsId) =>
980
998
  useListenable(
981
999
  'CheckpointIds',
982
1000
  useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
983
- [[], void 0, []],
1001
+ DEFAULT_CHECKPOINT_IDS,
984
1002
  );
985
1003
  const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
986
1004
  useListenable(
@@ -991,10 +1009,10 @@ const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
991
1009
  );
992
1010
  const useSetCheckpointCallback = (
993
1011
  getCheckpoint = getUndefined,
994
- getCheckpointDeps = [],
1012
+ getCheckpointDeps = EMPTY_ARRAY,
995
1013
  checkpointsOrCheckpointsId,
996
1014
  then = getUndefined,
997
- thenDeps = [],
1015
+ thenDeps = EMPTY_ARRAY,
998
1016
  ) => {
999
1017
  const checkpoints = useCheckpointsOrCheckpointsById(
1000
1018
  checkpointsOrCheckpointsId,
@@ -1015,10 +1033,10 @@ const useGoForwardCallback = (checkpointsOrCheckpointsId) =>
1015
1033
  useCheckpointAction(checkpointsOrCheckpointsId, 'goForward');
1016
1034
  const useGoToCallback = (
1017
1035
  getCheckpointId,
1018
- getCheckpointIdDeps = [],
1036
+ getCheckpointIdDeps = EMPTY_ARRAY,
1019
1037
  checkpointsOrCheckpointsId,
1020
1038
  then = getUndefined,
1021
- thenDeps = [],
1039
+ thenDeps = EMPTY_ARRAY,
1022
1040
  ) => {
1023
1041
  const checkpoints = useCheckpointsOrCheckpointsById(
1024
1042
  checkpointsOrCheckpointsId,
@@ -1087,11 +1105,11 @@ const useCheckpointListener = (
1087
1105
  const useCreatePersister = (
1088
1106
  store,
1089
1107
  create,
1090
- createDeps = [],
1108
+ createDeps = EMPTY_ARRAY,
1091
1109
  then,
1092
- thenDeps = [],
1110
+ thenDeps = EMPTY_ARRAY,
1093
1111
  destroy,
1094
- destroyDeps = [],
1112
+ destroyDeps = EMPTY_ARRAY,
1095
1113
  ) => {
1096
1114
  const [, rerender] = useState$1();
1097
1115
  const persister = useMemo$1(
@@ -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=X();return U((()=>s.current=l()),[l]),_(e,t,((...e)=>{s.current=w(n)?l():e[n],d([])}),[],r),s.current},_=(e,t,o,r=[],n=[],...l)=>{const s=[t,...n,...r,...l],u=U((()=>{var r;return null==(r=null==t?void 0:t["add"+e+d])?void 0:r.call(t,...n,o,...l)}),s);N((()=>()=>null==t?void 0:t.delListener(u)),s)},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};
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",y=m+"s",C=m+s,w=e=>null==e,f=(e,t,o)=>w(e)?null==o?void 0:o():t(e),k=e=>o(e)==n,h=()=>{},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]:k(e)?((e,t)=>f(e,(e=>e[t])))(null!=(o=r[t+1])?o:{},e):e},L=(e,t)=>{const o=S(e,t);return w(e)||k(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),E=e=>S(e,2),M=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,useLayoutEffect:X,useRef:Y,useState:Z}=e,$=[],_={},ee=[[],void 0,[]],te=(e,t,o=$)=>{const r=U((()=>t(e)),[e,...o]);return N((()=>()=>r.destroy()),[r]),r},oe=(e,t,o,r=$,n)=>{const[,d]=Z(),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,e,...r,o]),s=Y();return U((()=>s.current=l()),[l]),re(e,t,((...e)=>{s.current=w(n)?l():e[n],d([])}),[l,n],r),s.current},re=(e,t,o,r=$,n=$,...l)=>X((()=>{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,e,...n,...r,...l]),ne=(e,t,o,r=$,n=h,d=$,...l)=>{const s=T(e);return K((e=>f(s,(r=>f(o(e,r),(e=>n(r["set"+t](...l,e),e)))))),[s,t,...r,...d,...l])},de=(e,t,o=h,r=$,...n)=>{const d=T(e);return K((()=>o(null==d?void 0:d["del"+t](...n))),[d,t,...r,...n])},le=(e,t,o)=>{const r=G(e);return K((()=>null==r?void 0:r[t](o)),[r,t,o])},se=(e,t=$)=>U(e,t),ue=()=>j(1),ie=e=>oe(i,T(e),_),ae=e=>oe(a,T(e),$),ce=(e,t)=>oe(u,T(t),_,[e]),Ie=(e,t)=>oe(u+g,T(t),$,[e]),pe=(e,t)=>oe(I,T(t),0,[e]),ve=(e,t)=>oe(p,T(t),$,[e]),be=(e,t,o,r=0,n,d)=>oe(v,T(d),$,[e,t,o,r,n],6),ge=(e,t,o)=>oe(c,T(o),_,[e,t]),me=(e,t,o)=>oe(g,T(o),$,[e,t]),ye=(e,t,o,r)=>oe(b,T(r),void 0,[e,t,o],4),Ce=e=>oe(y,T(e),_),we=e=>oe(C,T(e),$),fe=(e,t)=>oe(m,T(t),void 0,[e]),ke=(e,t,o,r,n)=>ne(o,i,e,t,r,n),he=(e,t,o,r,n,d)=>ne(r,u,t,o,n,d,e),Re=(e,t,o,r,n,d,l)=>ne(n,c,o,r,d,l,e,t),Pe=(e,t,o=$,r,n=h,d=$,l=!0)=>{const s=T(r);return K((o=>f(s,(r=>f(t(o,r),(t=>n(r.addRow(e,t,l),r,t)))))),[s,e,...o,...d,l])},xe=(e,t,o,r,n,d,l)=>ne(n,"PartialRow",o,r,d,l,e,t),qe=(e,t,o,r,n,d,l,s)=>ne(d,b,r,n,l,s,e,t,o),Oe=(e,t,o,r,n)=>ne(o,y,e,t,r,n),Se=(e,t,o,r,n)=>ne(o,"PartialValues",e,t,r,n),Le=(e,t,o,r,n,d)=>ne(r,m,t,o,n,d,e),je=(e,t,o)=>de(e,i,t,o),Be=(e,t,o,r)=>de(t,u,o,r,e),Te=(e,t,o,r,n)=>de(o,c,r,n,e,t),Ee=(e,t,o,r,n,d,l)=>de(n,b,d,l,e,t,o,r),Me=(e,t,o)=>de(e,y,t,o),Fe=(e,t,o,r)=>de(t,m,o,r,e),Ve=(e,t,o,r)=>re(i,T(r),e,t,$,o),Ae=(e,t,o,r)=>re(a,T(r),e,t,$,o),De=(e,t,o,r,n)=>re(u,T(n),t,o,[e],r),Qe=(e,t,o,r,n)=>re(u+g,T(n),t,o,[e],r),We=(e,t,o,r,n)=>re(I,T(n),t,o,[e],r),ze=(e,t,o,r,n)=>re(p,T(n),t,o,[e],r),Ge=(e,t,o,r,n,d,l,s,u)=>re(v,T(u),d,l,[e,t,o,r,n],s),He=(e,t,o,r,n,d)=>re(c,T(d),o,r,[e,t],n),Je=(e,t,o,r,n,d)=>re(g,T(d),o,r,[e,t],n),Ke=(e,t,o,r,n,d,l)=>re(b,T(l),r,n,[e,t,o],d),Ne=(e,t,o,r)=>re(y,T(r),e,t,$,o),Ue=(e,t,o,r)=>re(C,T(r),e,t,$,o),Xe=(e,t,o,r,n)=>re(m,T(n),t,o,[e],r),Ye=(e,t,o)=>re("Start"+J,T(o),e,t),Ze=(e,t,o)=>re("WillFinish"+J,T(o),e,t),$e=(e,t,o)=>re("DidFinish"+J,T(o),e,t),_e=(e,t,o)=>te(e,t,o),et=()=>j(3),tt=e=>oe("MetricIds",M(e),$),ot=(e,t)=>oe("Metric",M(t),void 0,[e]),rt=(e,t,o,r)=>re("Metric",M(r),t,o,[e]),nt=(e,t,o)=>te(e,t,o),dt=()=>j(5),lt=(e,t)=>oe("SliceIds",V(t),$,[e]),st=e=>oe("IndexIds",V(e),$),ut=(e,t,o)=>oe("Slice"+p,V(o),$,[e,t]),it=(e,t,o,r)=>re("SliceIds",V(r),t,o,[e]),at=(e,t,o,r,n)=>re("Slice"+p,V(n),o,r,[e,t]),ct=(e,t,o)=>te(e,t,o),It=()=>j(7),pt=e=>oe("RelationshipIds",D(e),$),vt=(e,t,o)=>oe("RemoteRowId",D(o),void 0,[e,t]),bt=(e,t,o)=>oe("Local"+p,D(o),$,[e,t]),gt=(e,t,o)=>oe("Linked"+p,D(o),$,[e,t]),mt=(e,t,o,r,n)=>re("RemoteRowId",D(n),o,r,[e,t]),yt=(e,t,o,r,n)=>re("Local"+p,D(n),o,r,[e,t]),Ct=(e,t,o,r,n)=>re("Linked"+p,D(n),o,r,[e,t]),wt=(e,t,o)=>te(e,t,o),ft=()=>j(9),kt=e=>oe("QueryIds",W(e),$),ht=(e,t)=>oe(l+u,W(t),_,[e]),Rt=(e,t)=>oe(l+u+g,W(t),$,[e]),Pt=(e,t)=>oe(l+I,W(t),0,[e]),xt=(e,t)=>oe(l+p,W(t),$,[e]),qt=(e,t,o,r=0,n,d)=>oe(l+v,W(d),$,[e,t,o,r,n],6),Ot=(e,t,o)=>oe(l+c,W(o),_,[e,t]),St=(e,t,o)=>oe(l+g,W(o),$,[e,t]),Lt=(e,t,o,r)=>oe(l+b,W(r),void 0,[e,t,o]),jt=(e,t,o,r)=>re(l+u,W(r),t,o,[e]),Bt=(e,t,o,r)=>re(l+u+g,W(r),t,o,[e]),Tt=(e,t,o,r)=>re(l+I,W(r),t,o,[e]),Et=(e,t,o,r)=>re(l+p,W(r),t,o,[e]),Mt=(e,t,o,r,n,d,s,u)=>re(l+v,W(u),d,s,[e,t,o,r,n]),Ft=(e,t,o,r,n)=>re(l+c,W(n),o,r,[e,t]),Vt=(e,t,o,r,n)=>re(l+g,W(n),o,r,[e,t]),At=(e,t,o,r,n,d)=>re(l+b,W(d),r,n,[e,t,o]),Dt=(e,t,o)=>te(e,t,o),Qt=()=>j(11),Wt=e=>oe("CheckpointIds",G(e),ee),zt=(e,t)=>oe("Checkpoint",G(t),void 0,[e]),Gt=(e=h,t=$,o,r=h,n=$)=>{const d=G(o);return K((t=>f(d,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[d,...t,...n])},Ht=e=>le(e,"goBackward"),Jt=e=>le(e,"goForward"),Kt=(e,t=$,o,r=h,n=$)=>{const d=G(o);return K((t=>f(d,(o=>f(e(t),(e=>r(o.goTo(e),e)))))),[d,...t,...n])},Nt=e=>{var t;const o=G(e),[n,d]=Wt(o);return[(l=n,!(0==l.length)),Ht(o),d,null!=(t=f(d,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r];var l},Ut=e=>{var t;const o=G(e),[,,[n]]=Wt(o);return[!w(n),Jt(o),n,null!=(t=f(n,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r]},Xt=(e,t,o)=>re("CheckpointIds",G(o),e,t),Yt=(e,t,o,r)=>re("Checkpoint",G(r),t,o,[e]),Zt=(e,t,o=$,r,n=$,d,l=$)=>{const[,s]=Z(),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:$t,Fragment:_t,createElement:eo,useCallback:to,useLayoutEffect:oo,useRef:ro,useState:no}=e,lo=(e,...t)=>w(e)?{}:e(...t),so=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var uo=Object.defineProperty,io=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,co=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,vo=(e,t,o)=>t in e?uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,bo=(e,t)=>{for(var o in t||(t={}))Io.call(t,o)&&vo(e,o,t[o]);if(co)for(var o of co(t))po.call(t,o)&&vo(e,o,t[o]);return e},go=(e,t)=>io(e,ao(t)),mo=(e,t)=>{var o={};for(var r in e)Io.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&co)for(var r of co(e))t.indexOf(r)<0&&po.call(e,r)&&(o[r]=e[r]);return o};const{useMemo:yo}=e,Co=({tableId:e,store:t,rowComponent:o=xo,getRowComponentProps:r,customCellIds:n,separator:d,debugIds:l},s)=>Ro(R(s,(d=>eo(o,go(bo({},lo(r,d)),{key:d,tableId:e,rowId:d,customCellIds:n,store:t,debugIds:l})))),d,l,e),wo=({queryId:e,queries:t,resultRowComponent:o=Do,getResultRowComponentProps:r,separator:n,debugIds:d},l)=>Ro(R(l,(n=>eo(o,go(bo({},lo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:d})))),n,d,e),fo=({relationshipId:e,relationships:t,rowComponent:o=xo,getRowComponentProps:r,separator:n,debugIds:d},l,s)=>{const[u,i,a]=so(D(t),e),c=l(e,s,u);return Ro(R(c,(e=>eo(o,go(bo({},lo(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:d})))),n,d,s)},ko=e=>({checkpoints:t,checkpointComponent:o=zo,getCheckpointComponentProps:r,separator:n,debugIds:d})=>{const l=G(t);return Ro(R(e(Wt(l)),(e=>eo(o,go(bo({},lo(r,e)),{key:e,checkpoints:l,checkpointId:e,debugIds:d})))),n)},ho=({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 eo(O.Provider,{value:yo((()=>[null!=e?e:v[0],bo(bo({},v[1]),o),null!=r?r:v[2],bo(bo({},v[3]),n),null!=d?d:v[4],bo(bo({},v[5]),l),null!=s?s:v[6],bo(bo({},v[7]),u),null!=i?i:v[8],bo(bo({},v[9]),a),null!=c?c:v[10],bo(bo({},v[11]),I)]),[e,o,r,n,d,l,s,u,i,a,c,I,v])},p)},Ro=(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},Po=({tableId:e,rowId:t,cellId:o,store:n,debugIds:d})=>{var l;return Ro(r+(null!=(l=ye(e,t,o,n))?l:r),void 0,d,o)},xo=({tableId:e,rowId:t,store:o,cellComponent:r=Po,getCellComponentProps:n,customCellIds:d,separator:l,debugIds:s})=>Ro(R(((e,t,o,r)=>{const n=me(t,o,r);return null!=e?e:n})(d,e,t,o),(d=>eo(r,go(bo({},lo(n,d)),{key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:s})))),l,s,t),qo=e=>Co(e,ve(e.tableId,e.store)),Oo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=mo(t,["cellId","descending","offset","limit"]);return Co(l,be(l.tableId,o,r,n,d,l.store))},So=({store:e,tableComponent:t=qo,getTableComponentProps:o,separator:r,debugIds:n})=>Ro(R(ae(e),(r=>eo(t,go(bo({},lo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),Lo=({valueId:e,store:t,debugIds:o})=>{var n;return Ro(r+(null!=(n=fe(e,t))?n:r),void 0,o,e)},jo=({store:e,valueComponent:t=Lo,getValueComponentProps:o,separator:r,debugIds:n})=>Ro(R(we(e),(r=>eo(t,go(bo({},lo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Bo=({metricId:e,metrics:t,debugIds:o})=>{var n;return Ro(null!=(n=ot(e,t))?n:r,void 0,o,e)},To=({indexId:e,sliceId:t,indexes:o,rowComponent:r=xo,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=ut(e,t,s);return Ro(R(a,(e=>eo(r,go(bo({},lo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:l})))),d,l,t)},Eo=({indexId:e,indexes:t,sliceComponent:o=To,getSliceComponentProps:r,separator:n,debugIds:d})=>Ro(R(lt(e,t),(n=>eo(o,go(bo({},lo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:d})))),n,d,e),Mo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=xo,getRowComponentProps:n,debugIds:d})=>{const[l,s,,u]=so(D(o),e),i=vt(e,t,l);return Ro(w(u)||w(i)?null:eo(r,go(bo({},lo(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:d})),void 0,d,t)},Fo=e=>fo(e,bt,e.remoteRowId),Vo=e=>fo(e,gt,e.firstRowId),Ao=({queryId:e,rowId:t,cellId:o,queries:n,debugIds:d})=>{var l;return Ro(r+(null!=(l=Lt(e,t,o,n))?l:r),void 0,d,o)},Do=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Ao,getResultCellComponentProps:n,separator:d,debugIds:l})=>Ro(R(St(e,t,o),(d=>eo(r,go(bo({},lo(n,d)),{key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:l})))),d,l,t),Qo=e=>wo(e,xt(e.queryId,e.queries)),Wo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=mo(t,["cellId","descending","offset","limit"]);return wo(l,qt(l.queryId,o,r,n,d,l.queries))},zo=({checkpoints:e,checkpointId:t,debugIds:o})=>{var n;return Ro(null!=(n=zt(t,e))?n:r,void 0,o,t)},Go=ko((e=>e[0])),Ho=ko((e=>w(e[1])?[]:[e[1]])),Jo=ko((e=>e[2]));export{Go as BackwardCheckpointsView,Po as CellView,zo as CheckpointView,Ho as CurrentCheckpointView,Jo as ForwardCheckpointsView,Eo as IndexView,Vo as LinkedRowsView,Fo as LocalRowsView,Bo as MetricView,ho as Provider,Mo as RemoteRowView,Ao as ResultCellView,Do as ResultRowView,Wo as ResultSortedTableView,Qo as ResultTableView,xo as RowView,To as SliceView,Oo as SortedTableView,qo as TableView,So as TablesView,Lo as ValueView,jo as ValuesView,Pe as useAddRowCallback,ye as useCell,me as useCellIds,Je as useCellIdsListener,Ke as useCellListener,zt as useCheckpoint,Wt as useCheckpointIds,Xt as useCheckpointIdsListener,Yt as useCheckpointListener,z as useCheckpoints,Qt as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Dt as useCreateCheckpoints,nt as useCreateIndexes,_e as useCreateMetrics,Zt as useCreatePersister,wt as useCreateQueries,ct as useCreateRelationships,se as useCreateStore,Ee as useDelCellCallback,Te as useDelRowCallback,Be as useDelTableCallback,je as useDelTablesCallback,Fe as useDelValueCallback,Me as useDelValuesCallback,$e as useDidFinishTransactionListener,Ht as useGoBackwardCallback,Jt as useGoForwardCallback,Kt as useGoToCallback,st as useIndexIds,F as useIndexes,dt as useIndexesIds,V as useIndexesOrIndexesById,gt as useLinkedRowIds,Ct as useLinkedRowIdsListener,bt as useLocalRowIds,yt as useLocalRowIdsListener,ot as useMetric,tt as useMetricIds,rt as useMetricListener,E as useMetrics,et as useMetricsIds,M as useMetricsOrMetricsById,Q as useQueries,ft as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ut as useRedoInformation,pt as useRelationshipIds,A as useRelationships,It as useRelationshipsIds,D as useRelationshipsOrRelationshipsById,vt as useRemoteRowId,mt as useRemoteRowIdListener,Lt as useResultCell,St as useResultCellIds,Vt as useResultCellIdsListener,At as useResultCellListener,Ot as useResultRow,Pt as useResultRowCount,Tt as useResultRowCountListener,xt as useResultRowIds,Et as useResultRowIdsListener,Ft as useResultRowListener,qt as useResultSortedRowIds,Mt as useResultSortedRowIdsListener,ht as useResultTable,Rt as useResultTableCellIds,Bt as useResultTableCellIdsListener,jt as useResultTableListener,ge as useRow,pe as useRowCount,We as useRowCountListener,ve as useRowIds,ze as useRowIdsListener,He as useRowListener,qe as useSetCellCallback,Gt as useSetCheckpointCallback,xe as useSetPartialRowCallback,Se as useSetPartialValuesCallback,Re as useSetRowCallback,he as useSetTableCallback,ke as useSetTablesCallback,Le as useSetValueCallback,Oe as useSetValuesCallback,lt as useSliceIds,it as useSliceIdsListener,ut as useSliceRowIds,at as useSliceRowIdsListener,be as useSortedRowIds,Ge as useSortedRowIdsListener,Ye as useStartTransactionListener,B as useStore,ue as useStoreIds,T as useStoreOrStoreById,ce as useTable,Ie as useTableCellIds,Qe as useTableCellIdsListener,ae as useTableIds,Ae as useTableIdsListener,De as useTableListener,ie as useTables,Ve as useTablesListener,Nt as useUndoInformation,fe as useValue,we as useValueIds,Ue as useValueIdsListener,Xe as useValueListener,Ce as useValues,Ne as useValuesListener,Ze as useWillFinishTransactionListener};
Binary file
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=X();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)=>{const I=[t,...r,...s,...n],i=U((()=>t?.["add"+e+d]?.(...r,o,...n)),I);N((()=>()=>t?.delListener(i)),I)},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};
1
+ import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",u="Ids",I="Table",i=I+"s",c=I+u,l="Row",a=l+"Count",p=l+u,g="Sorted"+l+u,b="Cell",C=b+u,m="Value",y=m+"s",k=m+u,w=e=>null==e,h=(e,t,o)=>w(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),f=Object.keys,{createContext:P,useContext:x}=e,S=P([]),L=(e,t)=>{const o=x(S);return w(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 w(e)||R(e)?o:e},T=e=>f(x(S)[e]??{}),M=e=>L(e,0),E=e=>B(e,0),F=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,useLayoutEffect:X,useRef:Y,useState:Z}=e,$=[],_={},ee=[[],void 0,[]],te=(e,t,o=$)=>{const s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},oe=(e,t,o,s=$,r)=>{const[,d]=Z(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,e,...s,o]),u=Y();return U((()=>u.current=n()),[n]),se(e,t,((...e)=>{u.current=w(r)?n():e[r],d([])}),[n,r],s),u.current},se=(e,t,o,s=$,r=$,...n)=>X((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,e,...r,...s,...n]),re=(e,t,o,s=$,r=v,d=$,...n)=>{const u=E(e);return K((e=>h(u,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[u,t,...s,...d,...n])},de=(e,t,o=v,s=$,...r)=>{const d=E(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},ne=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},ue=(e,t=$)=>U(e,t),Ie=()=>T(1),ie=e=>oe(i,E(e),_),ce=e=>oe(c,E(e),$),le=(e,t)=>oe(I,E(t),_,[e]),ae=(e,t)=>oe(I+C,E(t),$,[e]),pe=(e,t)=>oe(a,E(t),0,[e]),ge=(e,t)=>oe(p,E(t),$,[e]),be=(e,t,o,s=0,r,d)=>oe(g,E(d),$,[e,t,o,s,r],6),Ce=(e,t,o)=>oe(l,E(o),_,[e,t]),me=(e,t,o)=>oe(C,E(o),$,[e,t]),ye=(e,t,o,s)=>oe(b,E(s),void 0,[e,t,o],4),ke=e=>oe(y,E(e),_),we=e=>oe(k,E(e),$),he=(e,t)=>oe(m,E(t),void 0,[e]),Re=(e,t,o,s,r)=>re(o,i,e,t,s,r),ve=(e,t,o,s,r,d)=>re(s,I,t,o,r,d,e),qe=(e,t,o,s,r,d,n)=>re(r,l,o,s,d,n,e,t),fe=(e,t,o=$,s,r=v,d=$,n=!0)=>{const u=E(s);return K((o=>h(u,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[u,e,...o,...d,n])},Pe=(e,t,o,s,r,d,n)=>re(r,"PartialRow",o,s,d,n,e,t),xe=(e,t,o,s,r,d,n,u)=>re(d,b,s,r,n,u,e,t,o),Se=(e,t,o,s,r)=>re(o,y,e,t,s,r),Le=(e,t,o,s,r)=>re(o,"PartialValues",e,t,s,r),Be=(e,t,o,s,r,d)=>re(s,m,t,o,r,d,e),Te=(e,t,o)=>de(e,i,t,o),Me=(e,t,o,s)=>de(t,I,o,s,e),Ee=(e,t,o,s,r)=>de(o,l,s,r,e,t),Fe=(e,t,o,s,r,d,n)=>de(r,b,d,n,e,t,o,s),Ve=(e,t,o)=>de(e,y,t,o),Ae=(e,t,o,s)=>de(t,m,o,s,e),je=(e,t,o,s)=>se(i,E(s),e,t,$,o),De=(e,t,o,s)=>se(c,E(s),e,t,$,o),Oe=(e,t,o,s,r)=>se(I,E(r),t,o,[e],s),Qe=(e,t,o,s,r)=>se(I+C,E(r),t,o,[e],s),We=(e,t,o,s,r)=>se(a,E(r),t,o,[e],s),ze=(e,t,o,s,r)=>se(p,E(r),t,o,[e],s),Ge=(e,t,o,s,r,d,n,u,I)=>se(g,E(I),d,n,[e,t,o,s,r],u),He=(e,t,o,s,r,d)=>se(l,E(d),o,s,[e,t],r),Je=(e,t,o,s,r,d)=>se(C,E(d),o,s,[e,t],r),Ke=(e,t,o,s,r,d,n)=>se(b,E(n),s,r,[e,t,o],d),Ne=(e,t,o,s)=>se(y,E(s),e,t,$,o),Ue=(e,t,o,s)=>se(k,E(s),e,t,$,o),Xe=(e,t,o,s,r)=>se(m,E(r),t,o,[e],s),Ye=(e,t,o)=>se("Start"+J,E(o),e,t),Ze=(e,t,o)=>se("WillFinish"+J,E(o),e,t),$e=(e,t,o)=>se("DidFinish"+J,E(o),e,t),_e=(e,t,o)=>te(e,t,o),et=()=>T(3),tt=e=>oe("MetricIds",V(e),$),ot=(e,t)=>oe("Metric",V(t),void 0,[e]),st=(e,t,o,s)=>se("Metric",V(s),t,o,[e]),rt=(e,t,o)=>te(e,t,o),dt=()=>T(5),nt=(e,t)=>oe("SliceIds",j(t),$,[e]),ut=e=>oe("IndexIds",j(e),$),It=(e,t,o)=>oe("Slice"+p,j(o),$,[e,t]),it=(e,t,o,s)=>se("SliceIds",j(s),t,o,[e]),ct=(e,t,o,s,r)=>se("Slice"+p,j(r),o,s,[e,t]),lt=(e,t,o)=>te(e,t,o),at=()=>T(7),pt=e=>oe("RelationshipIds",O(e),$),gt=(e,t,o)=>oe("RemoteRowId",O(o),void 0,[e,t]),bt=(e,t,o)=>oe("Local"+p,O(o),$,[e,t]),Ct=(e,t,o)=>oe("Linked"+p,O(o),$,[e,t]),mt=(e,t,o,s,r)=>se("RemoteRowId",O(r),o,s,[e,t]),yt=(e,t,o,s,r)=>se("Local"+p,O(r),o,s,[e,t]),kt=(e,t,o,s,r)=>se("Linked"+p,O(r),o,s,[e,t]),wt=(e,t,o)=>te(e,t,o),ht=()=>T(9),Rt=e=>oe("QueryIds",W(e),$),vt=(e,t)=>oe(n+I,W(t),_,[e]),qt=(e,t)=>oe(n+I+C,W(t),$,[e]),ft=(e,t)=>oe(n+a,W(t),0,[e]),Pt=(e,t)=>oe(n+p,W(t),$,[e]),xt=(e,t,o,s=0,r,d)=>oe(n+g,W(d),$,[e,t,o,s,r],6),St=(e,t,o)=>oe(n+l,W(o),_,[e,t]),Lt=(e,t,o)=>oe(n+C,W(o),$,[e,t]),Bt=(e,t,o,s)=>oe(n+b,W(s),void 0,[e,t,o]),Tt=(e,t,o,s)=>se(n+I,W(s),t,o,[e]),Mt=(e,t,o,s)=>se(n+I+C,W(s),t,o,[e]),Et=(e,t,o,s)=>se(n+a,W(s),t,o,[e]),Ft=(e,t,o,s)=>se(n+p,W(s),t,o,[e]),Vt=(e,t,o,s,r,d,u,I)=>se(n+g,W(I),d,u,[e,t,o,s,r]),At=(e,t,o,s,r)=>se(n+l,W(r),o,s,[e,t]),jt=(e,t,o,s,r)=>se(n+C,W(r),o,s,[e,t]),Dt=(e,t,o,s,r,d)=>se(n+b,W(d),s,r,[e,t,o]),Ot=(e,t,o)=>te(e,t,o),Qt=()=>T(11),Wt=e=>oe("CheckpointIds",G(e),ee),zt=(e,t)=>oe("Checkpoint",G(t),void 0,[e]),Gt=(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])},Ht=e=>ne(e,"goBackward"),Jt=e=>ne(e,"goForward"),Kt=(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])},Nt=e=>{const t=G(e),[o,r]=Wt(t);return[(d=o,!(0==d.length)),Ht(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ut=e=>{const t=G(e),[,,[o]]=Wt(t);return[!w(o),Jt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Xt=(e,t,o)=>se("CheckpointIds",G(o),e,t),Yt=(e,t,o,s)=>se("Checkpoint",G(s),t,o,[e]),Zt=(e,t,o=$,s,r=$,d,n=$)=>{const[,u]=Z(),I=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{s&&(await s(I),u([]))})(),()=>{I?.destroy(),d?.(I)})),[I,...r,...n]),I},{PureComponent:$t,Fragment:_t,createElement:eo,useCallback:to,useLayoutEffect:oo,useRef:so,useState:ro}=e,no=(e,...t)=>w(e)?{}:e(...t),uo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:Io}=e,io=({tableId:e,store:t,rowComponent:o=Co,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>go(q(u,(d=>eo(o,{...no(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),co=({queryId:e,queries:t,resultRowComponent:o=Lo,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>go(q(n,(r=>eo(o,{...no(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),lo=({relationshipId:e,relationships:t,rowComponent:o=Co,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[I,i,c]=uo(O(t),e),l=n(e,u,I);return go(q(l,(e=>eo(o,{...no(s,e),key:e,tableId:c,rowId:e,store:i,debugIds:d}))),r,d,u)},ao=e=>({checkpoints:t,checkpointComponent:o=Mo,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return go(q(e(Wt(n)),(e=>eo(o,{...no(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},po=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:u,relationshipsById:I,queries:i,queriesById:c,checkpoints:l,checkpointsById:a,children:p})=>{const g=t(S);return eo(S.Provider,{value:Io((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},u??g[6],{...g[7],...I},i??g[8],{...g[9],...c},l??g[10],{...g[11],...a}]),[e,o,s,r,d,n,u,I,i,c,l,a,g])},p)},go=(e,t,o,s)=>{const r=w(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},bo=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>go(s+(ye(e,t,o,r)??s),void 0,d,o),Co=({tableId:e,rowId:t,store:o,cellComponent:s=bo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>go(q(((e,t,o,s)=>{const r=me(t,o,s);return e??r})(d,e,t,o),(d=>eo(s,{...no(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),mo=e=>io(e,ge(e.tableId,e.store)),yo=({cellId:e,descending:t,offset:o,limit:s,...r})=>io(r,be(r.tableId,e,t,o,s,r.store)),ko=({store:e,tableComponent:t=mo,getTableComponentProps:o,separator:s,debugIds:r})=>go(q(ce(e),(s=>eo(t,{...no(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),wo=({valueId:e,store:t,debugIds:o})=>go(s+(he(e,t)??s),void 0,o,e),ho=({store:e,valueComponent:t=wo,getValueComponentProps:o,separator:s,debugIds:r})=>go(q(we(e),(s=>eo(t,{...no(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),Ro=({metricId:e,metrics:t,debugIds:o})=>go(ot(e,t)??s,void 0,o,e),vo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=Co,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,I,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),c=It(e,t,u);return go(q(c,(e=>eo(s,{...no(r,e),key:e,tableId:i,rowId:e,store:I,debugIds:n}))),d,n,t)},qo=({indexId:e,indexes:t,sliceComponent:o=vo,getSliceComponentProps:s,separator:r,debugIds:d})=>go(q(nt(e,t),(r=>eo(o,{...no(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),fo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=Co,getRowComponentProps:r,debugIds:d})=>{const[n,u,,I]=uo(O(o),e),i=gt(e,t,n);return go(w(I)||w(i)?null:eo(s,{...no(r,i),key:i,tableId:I,rowId:i,store:u,debugIds:d}),void 0,d,t)},Po=e=>lo(e,bt,e.remoteRowId),xo=e=>lo(e,Ct,e.firstRowId),So=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>go(s+(Bt(e,t,o,r)??s),void 0,d,o),Lo=({queryId:e,rowId:t,queries:o,resultCellComponent:s=So,getResultCellComponentProps:r,separator:d,debugIds:n})=>go(q(Lt(e,t,o),(d=>eo(s,{...no(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),Bo=e=>co(e,Pt(e.queryId,e.queries)),To=({cellId:e,descending:t,offset:o,limit:s,...r})=>co(r,xt(r.queryId,e,t,o,s,r.queries)),Mo=({checkpoints:e,checkpointId:t,debugIds:o})=>go(zt(t,e)??s,void 0,o,t),Eo=ao((e=>e[0])),Fo=ao((e=>w(e[1])?[]:[e[1]])),Vo=ao((e=>e[2]));export{Eo as BackwardCheckpointsView,bo as CellView,Mo as CheckpointView,Fo as CurrentCheckpointView,Vo as ForwardCheckpointsView,qo as IndexView,xo as LinkedRowsView,Po as LocalRowsView,Ro as MetricView,po as Provider,fo as RemoteRowView,So as ResultCellView,Lo as ResultRowView,To as ResultSortedTableView,Bo as ResultTableView,Co as RowView,vo as SliceView,yo as SortedTableView,mo as TableView,ko as TablesView,wo as ValueView,ho as ValuesView,fe as useAddRowCallback,ye as useCell,me as useCellIds,Je as useCellIdsListener,Ke as useCellListener,zt as useCheckpoint,Wt as useCheckpointIds,Xt as useCheckpointIdsListener,Yt as useCheckpointListener,z as useCheckpoints,Qt as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Ot as useCreateCheckpoints,rt as useCreateIndexes,_e as useCreateMetrics,Zt as useCreatePersister,wt as useCreateQueries,lt as useCreateRelationships,ue as useCreateStore,Fe as useDelCellCallback,Ee as useDelRowCallback,Me as useDelTableCallback,Te as useDelTablesCallback,Ae as useDelValueCallback,Ve as useDelValuesCallback,$e as useDidFinishTransactionListener,Ht as useGoBackwardCallback,Jt as useGoForwardCallback,Kt as useGoToCallback,ut as useIndexIds,A as useIndexes,dt as useIndexesIds,j as useIndexesOrIndexesById,Ct as useLinkedRowIds,kt as useLinkedRowIdsListener,bt as useLocalRowIds,yt as useLocalRowIdsListener,ot as useMetric,tt as useMetricIds,st as useMetricListener,F as useMetrics,et as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,ht as useQueriesIds,W as useQueriesOrQueriesById,Rt as useQueryIds,Ut as useRedoInformation,pt as useRelationshipIds,D as useRelationships,at as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,gt as useRemoteRowId,mt as useRemoteRowIdListener,Bt as useResultCell,Lt as useResultCellIds,jt as useResultCellIdsListener,Dt as useResultCellListener,St as useResultRow,ft as useResultRowCount,Et as useResultRowCountListener,Pt as useResultRowIds,Ft as useResultRowIdsListener,At as useResultRowListener,xt as useResultSortedRowIds,Vt as useResultSortedRowIdsListener,vt as useResultTable,qt as useResultTableCellIds,Mt as useResultTableCellIdsListener,Tt as useResultTableListener,Ce as useRow,pe as useRowCount,We as useRowCountListener,ge as useRowIds,ze as useRowIdsListener,He as useRowListener,xe as useSetCellCallback,Gt as useSetCheckpointCallback,Pe as useSetPartialRowCallback,Le as useSetPartialValuesCallback,qe as useSetRowCallback,ve as useSetTableCallback,Re as useSetTablesCallback,Be as useSetValueCallback,Se as useSetValuesCallback,nt as useSliceIds,it as useSliceIdsListener,It as useSliceRowIds,ct as useSliceRowIdsListener,be as useSortedRowIds,Ge as useSortedRowIdsListener,Ye as useStartTransactionListener,M as useStore,Ie as useStoreIds,E as useStoreOrStoreById,le as useTable,ae as useTableCellIds,Qe as useTableCellIdsListener,ce as useTableIds,De as useTableIdsListener,Oe as useTableListener,ie as useTables,je as useTablesListener,Nt as useUndoInformation,he as useValue,we as useValueIds,Ue as useValueIdsListener,Xe as useValueListener,ke as useValues,Ne as useValuesListener,Ze 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=W();return U((()=>l.current=d()),[d]),K(e,s,((...e)=>{l.current=h(r)?d():e[r],u([])}),[],o),l.current},K=(e,s,t,o=[],r=[],...d)=>{const l=[s,...r,...o,...d],n=U((()=>s?.["add"+e+u]?.(...r,t,...d)),l);j((()=>()=>s?.delListener(n)),l)},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);
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,c="Row",I=c+"Count",C=c+l,p="Sorted"+c+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),E=e=>e.toLowerCase();E(u);const A="Transaction";E(A);const{useCallback:G,useEffect:j,useMemo:U,useLayoutEffect:W,useRef:z,useState:H}=s,J=[],K={},N=[[],void 0,[]],X=(e,s,t=J)=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},Y=(e,s,t,o=J,r)=>{const[,u]=H(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,e,...o,t]),l=z();return U((()=>l.current=d()),[d]),Z(e,s,((...e)=>{l.current=h(r)?d():e[r],u([])}),[d,r],o),l.current},Z=(e,s,t,o=J,r=J,...d)=>W((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,e,...r,...o,...d]),$=(e,s,t,o=J,r=y,u=J,...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])},_=(e,s,t=y,o=J,...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},ee=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},se=e=>Y(a,B(e),J),te=(e,s)=>Y(C,B(s),J,[e]),oe=(e,s,t,o=0,r,u)=>Y(p,B(u),J,[e,s,t,o,r],6),re=(e,s,t)=>Y(b,B(t),J,[e,s]),ue=(e,s,t,o)=>Y(w,B(o),void 0,[e,s,t],4),de=e=>Y(g,B(e),J),le=(e,s)=>Y(R,B(s),void 0,[e]),ne=(e,s)=>Y("Metric",M(s),void 0,[e]),ie=(e,s)=>Y("SliceIds",D(s),J,[e]),ae=(e,s,t)=>Y("Slice"+C,D(t),J,[e,s]),ce=(e,s,t)=>Y("RemoteRowId",F(t),void 0,[e,s]),Ie=(e,s,t)=>Y("Local"+C,F(t),J,[e,s]),Ce=(e,s,t)=>Y("Linked"+C,F(t),J,[e,s]),pe=(e,s)=>Y(d+C,O(s),J,[e]),we=(e,s,t,o=0,r,u)=>Y(d+p,O(u),J,[e,s,t,o,r],6),be=(e,s,t)=>Y(d+b,O(t),J,[e,s]),Re=(e,s,t,o)=>Y(d+w,O(o),void 0,[e,s,t]),ke=e=>Y("CheckpointIds",Q(e),N),ge=(e,s)=>Y("Checkpoint",Q(s),void 0,[e]),he=e=>ee(e,"goBackward"),me=e=>ee(e,"goForward"),{PureComponent:Le,Fragment:ye,createElement:Se,useCallback:Ve,useLayoutEffect:Te,useRef:fe,useState:xe}=s,ve=(e,...s)=>h(e)?{}:e(...s),Pe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:qe}=s,Be=({tableId:e,store:s,rowComponent:t=Ee,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Oe(S(l,(u=>Se(t,{...ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),Me=({queryId:e,queries:s,resultRowComponent:t=We,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Oe(S(d,(r=>Se(t,{...ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),De=({relationshipId:e,relationships:s,rowComponent:t=Ee,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Pe(F(s),e),c=d(e,l,n);return Oe(S(c,(e=>Se(t,{...ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},Fe=e=>({checkpoints:s,checkpointComponent:t=ze,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Oe(S(e(ke(d)),(e=>Se(t,{...ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Oe=(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},Qe=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Oe(o+(ue(e,s,t,r)??o),void 0,u,t),Ee=({tableId:e,rowId:s,store:t,cellComponent:o=Qe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Oe(S(((e,s,t,o)=>{const r=re(s,t,o);return e??r})(u,e,s,t),(u=>Se(o,{...ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Ae=e=>Be(e,te(e.tableId,e.store)),Ge=({valueId:e,store:s,debugIds:t})=>Oe(o+(le(e,s)??o),void 0,t,e),je=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ee,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=ae(e,s,l);return Oe(S(a,(e=>Se(o,{...ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ue=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Oe(o+(Re(e,s,t,r)??o),void 0,u,t),We=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ue,getResultCellComponentProps:r,separator:u,debugIds:d})=>Oe(S(be(e,s,t),(u=>Se(o,{...ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),ze=({checkpoints:e,checkpointId:s,debugIds:t})=>Oe(ge(s,e)??o,void 0,t,s),He=Fe((e=>e[0])),Je=Fe((e=>h(e[1])?[]:[e[1]])),Ke=Fe((e=>e[2]));e.BackwardCheckpointsView=He,e.CellView=Qe,e.CheckpointView=ze,e.CurrentCheckpointView=Je,e.ForwardCheckpointsView=Ke,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=je,getSliceComponentProps:o,separator:r,debugIds:u})=>Oe(S(ie(e,s),(r=>Se(t,{...ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>De(e,Ce,e.firstRowId),e.LocalRowsView=e=>De(e,Ie,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Oe(ne(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:c,checkpointsById:I,children:C})=>{const p=s.useContext(x);return Se(x.Provider,{value:qe((()=>[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},c??p[10],{...p[11],...I}]),[e,t,o,r,u,d,l,n,i,a,c,I,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ee,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Pe(F(t),e),i=ce(e,s,d);return Oe(h(n)||h(i)?null:Se(o,{...ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ue,e.ResultRowView=We,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Me(r,we(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>Me(e,pe(e.queryId,e.queries)),e.RowView=Ee,e.SliceView=je,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Be(r,oe(r.tableId,e,s,t,o,r.store)),e.TableView=Ae,e.TablesView=({store:e,tableComponent:s=Ae,getTableComponentProps:t,separator:o,debugIds:r})=>Oe(S(se(e),(o=>Se(s,{...ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Ge,e.ValuesView=({store:e,valueComponent:s=Ge,getValueComponentProps:t,separator:o,debugIds:r})=>Oe(S(de(e),(o=>Se(s,{...ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=J,o,r=y,u=J,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=ue,e.useCellIds=re,e.useCellIdsListener=(e,s,t,o,r,u)=>Z(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>Z(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=ge,e.useCheckpointIds=ke,e.useCheckpointIdsListener=(e,s,t)=>Z("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>Z("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>X(e,s,t),e.useCreateIndexes=(e,s,t)=>X(e,s,t),e.useCreateMetrics=(e,s,t)=>X(e,s,t),e.useCreatePersister=(e,s,t=J,o,r=J,u,d=J)=>{const[,l]=H(),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)=>X(e,s,t),e.useCreateRelationships=(e,s,t)=>X(e,s,t),e.useCreateStore=(e,s=J)=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>_(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>_(t,c,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>_(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>_(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>_(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>_(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Z("DidFinish"+A,B(t),e,s),e.useGoBackwardCallback=he,e.useGoForwardCallback=me,e.useGoToCallback=(e,s=J,t,o=y,r=J)=>{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=>Y("IndexIds",D(e),J),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=Ce,e.useLinkedRowIdsListener=(e,s,t,o,r)=>Z("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=Ie,e.useLocalRowIdsListener=(e,s,t,o,r)=>Z("Local"+C,F(r),t,o,[e,s]),e.useMetric=ne,e.useMetricIds=e=>Y("MetricIds",M(e),J),e.useMetricListener=(e,s,t,o)=>Z("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=>Y("QueryIds",O(e),J),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=ke(s);return[!h(t),me(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>Y("RelationshipIds",F(e),J),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=ce,e.useRemoteRowIdListener=(e,s,t,o,r)=>Z("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Re,e.useResultCellIds=be,e.useResultCellIdsListener=(e,s,t,o,r)=>Z(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>Z(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>Y(d+c,O(t),K,[e,s]),e.useResultRowCount=(e,s)=>Y(d+I,O(s),0,[e]),e.useResultRowCountListener=(e,s,t,o)=>Z(d+I,O(o),s,t,[e]),e.useResultRowIds=pe,e.useResultRowIdsListener=(e,s,t,o)=>Z(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>Z(d+c,O(r),t,o,[e,s]),e.useResultSortedRowIds=we,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>Z(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>Y(d+n,O(s),K,[e]),e.useResultTableCellIds=(e,s)=>Y(d+n+b,O(s),J,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>Z(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>Z(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>Y(c,B(t),K,[e,s]),e.useRowCount=(e,s)=>Y(I,B(s),0,[e]),e.useRowCountListener=(e,s,t,o,r)=>Z(I,B(r),s,t,[e],o),e.useRowIds=te,e.useRowIdsListener=(e,s,t,o,r)=>Z(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>Z(c,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>$(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=J,t,o=y,r=J)=>{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)=>$(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>$(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>$(r,c,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>$(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>$(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>$(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>$(t,k,e,s,o,r),e.useSliceIds=ie,e.useSliceIdsListener=(e,s,t,o)=>Z("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=ae,e.useSliceRowIdsListener=(e,s,t,o,r)=>Z("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=oe,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>Z(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>Z("Start"+A,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>Y(n,B(s),K,[e]),e.useTableCellIds=(e,s)=>Y(n+b,B(s),J,[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>Z(n+b,B(r),s,t,[e],o),e.useTableIds=se,e.useTableIdsListener=(e,s,t,o)=>Z(a,B(o),e,s,J,t),e.useTableListener=(e,s,t,o,r)=>Z(n,B(r),s,t,[e],o),e.useTables=e=>Y(i,B(e),K),e.useTablesListener=(e,s,t,o)=>Z(i,B(o),e,s,J,t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=ke(s);return[(u=t,!(0==u.length)),he(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=le,e.useValueIds=de,e.useValueIdsListener=(e,s,t,o)=>Z(g,B(o),e,s,J,t),e.useValueListener=(e,s,t,o,r)=>Z(R,B(r),s,t,[e],o),e.useValues=e=>Y(k,B(e),K),e.useValuesListener=(e,s,t,o)=>Z(k,B(o),e,s,J,t),e.useWillFinishTransactionListener=(e,s,t)=>Z("WillFinish"+A,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=W();return U((()=>n.current=u()),[u]),K(e,s,((...e)=>{n.current=g(l)?u():e[l],r([])}),[],o),n.current},K=(e,s,t,o=[],l=[],...u)=>{const n=[s,...l,...o,...u],d=U((()=>{var o;return null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u)}),n);G((()=>()=>null==s?void 0:s.delListener(d)),n)},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);
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,useLayoutEffect:W,useRef:z,useState:H}=s,J=[],K={},N=[[],void 0,[]],X=(e,s,t=J)=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},Y=(e,s,t,o=J,l)=>{const[,r]=H(),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,e,...o,t]),n=z();return U((()=>n.current=u()),[u]),Z(e,s,((...e)=>{n.current=g(l)?u():e[l],r([])}),[u,l],o),n.current},Z=(e,s,t,o=J,l=J,...u)=>W((()=>{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,e,...l,...o,...u]),$=(e,s,t,o=J,l=m,r=J,...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])},_=(e,s,t=m,o=J,...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},ee=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},se=e=>Y(a,q(e),J),te=(e,s)=>Y(p,q(s),J,[e]),oe=(e,s,t,o=0,l,r)=>Y(C,q(r),J,[e,s,t,o,l],6),le=(e,s,t)=>Y(w,q(t),J,[e,s]),re=(e,s,t,o)=>Y(b,q(o),void 0,[e,s,t],4),ue=e=>Y(v,q(e),J),ne=(e,s)=>Y(R,q(s),void 0,[e]),de=(e,s)=>Y("Metric",B(s),void 0,[e]),ie=(e,s)=>Y("SliceIds",M(s),J,[e]),ae=(e,s,t)=>Y("Slice"+p,M(t),J,[e,s]),ce=(e,s,t)=>Y("RemoteRowId",D(t),void 0,[e,s]),Ie=(e,s,t)=>Y("Local"+p,D(t),J,[e,s]),pe=(e,s,t)=>Y("Linked"+p,D(t),J,[e,s]),Ce=(e,s)=>Y(u+p,j(s),J,[e]),be=(e,s,t,o=0,l,r)=>Y(u+C,j(r),J,[e,s,t,o,l],6),we=(e,s,t)=>Y(u+w,j(t),J,[e,s]),Re=(e,s,t,o)=>Y(u+b,j(o),void 0,[e,s,t]),ke=e=>Y("CheckpointIds",F(e),N),ve=(e,s)=>Y("Checkpoint",F(s),void 0,[e]),ge=e=>ee(e,"goBackward"),he=e=>ee(e,"goForward"),{PureComponent:ye,Fragment:me,createElement:Le,useCallback:fe,useLayoutEffect:Se,useRef:Ve,useState:Te}=s,xe=(e,...s)=>g(e)?{}:e(...s),Pe=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Oe=Object.defineProperty,qe=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Fe=(e,s,t)=>s in e?Oe(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Qe=(e,s)=>{for(var t in s||(s={}))De.call(s,t)&&Fe(e,t,s[t]);if(Me)for(var t of Me(s))je.call(s,t)&&Fe(e,t,s[t]);return e},Ee=(e,s)=>qe(e,Be(s)),Ae=(e,s)=>{var t={};for(var o in e)De.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Me)for(var o of Me(e))s.indexOf(o)<0&&je.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Ge}=s,Ue=({tableId:e,store:s,rowComponent:t=Ne,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Je(L(n,(r=>Le(t,Ee(Qe({},xe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),We=({queryId:e,queries:s,resultRowComponent:t=_e,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Je(L(u,(l=>Le(t,Ee(Qe({},xe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),ze=({relationshipId:e,relationships:s,rowComponent:t=Ne,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Pe(D(s),e),c=u(e,n,d);return Je(L(c,(e=>Le(t,Ee(Qe({},xe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},He=e=>({checkpoints:s,checkpointComponent:t=es,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Je(L(e(ke(u)),(e=>Le(t,Ee(Qe({},xe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Je=(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},Ke=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Je(o+(null!=(u=re(e,s,t,l))?u:o),void 0,r,t)},Ne=({tableId:e,rowId:s,store:t,cellComponent:o=Ke,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Je(L(((e,s,t,o)=>{const l=le(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>Le(o,Ee(Qe({},xe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Xe=e=>Ue(e,te(e.tableId,e.store)),Ye=({valueId:e,store:s,debugIds:t})=>{var l;return Je(o+(null!=(l=ne(e,s))?l:o),void 0,t,e)},Ze=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ne,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=ae(e,s,n);return Je(L(a,(e=>Le(o,Ee(Qe({},xe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},$e=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Je(o+(null!=(u=Re(e,s,t,l))?u:o),void 0,r,t)},_e=({queryId:e,rowId:s,queries:t,resultCellComponent:o=$e,getResultCellComponentProps:l,separator:r,debugIds:u})=>Je(L(we(e,s,t),(r=>Le(o,Ee(Qe({},xe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),es=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Je(null!=(l=ve(s,e))?l:o,void 0,t,s)},ss=He((e=>e[0])),ts=He((e=>g(e[1])?[]:[e[1]])),os=He((e=>e[2]));e.BackwardCheckpointsView=ss,e.CellView=Ke,e.CheckpointView=es,e.CurrentCheckpointView=ts,e.ForwardCheckpointsView=os,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ze,getSliceComponentProps:o,separator:l,debugIds:r})=>Je(L(ie(e,s),(l=>Le(t,Ee(Qe({},xe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>ze(e,pe,e.firstRowId),e.LocalRowsView=e=>ze(e,Ie,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Je(null!=(l=de(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 Le(T.Provider,{value:Ge((()=>[null!=e?e:C[0],Qe(Qe({},C[1]),t),null!=o?o:C[2],Qe(Qe({},C[3]),l),null!=r?r:C[4],Qe(Qe({},C[5]),u),null!=n?n:C[6],Qe(Qe({},C[7]),d),null!=i?i:C[8],Qe(Qe({},C[9]),a),null!=c?c:C[10],Qe(Qe({},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=Ne,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Pe(D(t),e),i=ce(e,s,u);return Je(g(d)||g(i)?null:Le(o,Ee(Qe({},xe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=$e,e.ResultRowView=_e,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Ae(s,["cellId","descending","offset","limit"]);return We(u,be(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>We(e,Ce(e.queryId,e.queries)),e.RowView=Ne,e.SliceView=Ze,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Ae(s,["cellId","descending","offset","limit"]);return Ue(u,oe(u.tableId,t,o,l,r,u.store))},e.TableView=Xe,e.TablesView=({store:e,tableComponent:s=Xe,getTableComponentProps:t,separator:o,debugIds:l})=>Je(L(se(e),(o=>Le(s,Ee(Qe({},xe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Ye,e.ValuesView=({store:e,valueComponent:s=Ye,getValueComponentProps:t,separator:o,debugIds:l})=>Je(L(ue(e),(o=>Le(s,Ee(Qe({},xe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=J,o,l=m,r=J,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=re,e.useCellIds=le,e.useCellIdsListener=(e,s,t,o,l,r)=>Z(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>Z(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=ve,e.useCheckpointIds=ke,e.useCheckpointIdsListener=(e,s,t)=>Z("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>Z("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>X(e,s,t),e.useCreateIndexes=(e,s,t)=>X(e,s,t),e.useCreateMetrics=(e,s,t)=>X(e,s,t),e.useCreatePersister=(e,s,t=J,o,l=J,r,u=J)=>{const[,n]=H(),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)=>X(e,s,t),e.useCreateRelationships=(e,s,t)=>X(e,s,t),e.useCreateStore=(e,s=J)=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>_(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>_(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>_(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>_(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>_(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>_(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Z("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=ge,e.useGoForwardCallback=he,e.useGoToCallback=(e,s=J,t,o=m,l=J)=>{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=>Y("IndexIds",M(e),J),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=pe,e.useLinkedRowIdsListener=(e,s,t,o,l)=>Z("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=Ie,e.useLocalRowIdsListener=(e,s,t,o,l)=>Z("Local"+p,D(l),t,o,[e,s]),e.useMetric=de,e.useMetricIds=e=>Y("MetricIds",B(e),J),e.useMetricListener=(e,s,t,o)=>Z("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=>Y("QueryIds",j(e),J),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=ke(t);return[!g(l),he(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>Y("RelationshipIds",D(e),J),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ce,e.useRemoteRowIdListener=(e,s,t,o,l)=>Z("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=Re,e.useResultCellIds=we,e.useResultCellIdsListener=(e,s,t,o,l)=>Z(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>Z(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>Y(u+c,j(t),K,[e,s]),e.useResultRowCount=(e,s)=>Y(u+I,j(s),0,[e]),e.useResultRowCountListener=(e,s,t,o)=>Z(u+I,j(o),s,t,[e]),e.useResultRowIds=Ce,e.useResultRowIdsListener=(e,s,t,o)=>Z(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>Z(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=be,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>Z(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>Y(u+d,j(s),K,[e]),e.useResultTableCellIds=(e,s)=>Y(u+d+w,j(s),J,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>Z(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>Z(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>Y(c,q(t),K,[e,s]),e.useRowCount=(e,s)=>Y(I,q(s),0,[e]),e.useRowCountListener=(e,s,t,o,l)=>Z(I,q(l),s,t,[e],o),e.useRowIds=te,e.useRowIdsListener=(e,s,t,o,l)=>Z(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>Z(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>$(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=J,t,o=m,l=J)=>{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)=>$(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>$(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>$(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>$(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>$(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>$(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>$(t,k,e,s,o,l),e.useSliceIds=ie,e.useSliceIdsListener=(e,s,t,o)=>Z("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ae,e.useSliceRowIdsListener=(e,s,t,o,l)=>Z("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=oe,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>Z(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>Z("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>Y(d,q(s),K,[e]),e.useTableCellIds=(e,s)=>Y(d+w,q(s),J,[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>Z(d+w,q(l),s,t,[e],o),e.useTableIds=se,e.useTableIdsListener=(e,s,t,o)=>Z(a,q(o),e,s,J,t),e.useTableListener=(e,s,t,o,l)=>Z(d,q(l),s,t,[e],o),e.useTables=e=>Y(i,q(e),K),e.useTablesListener=(e,s,t,o)=>Z(i,q(o),e,s,J,t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=ke(t);return[(u=l,!(0==u.length)),ge(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=ne,e.useValueIds=ue,e.useValueIdsListener=(e,s,t,o)=>Z(v,q(o),e,s,J,t),e.useValueListener=(e,s,t,o,l)=>Z(R,q(l),s,t,[e],o),e.useValues=e=>Y(k,q(e),K),e.useValuesListener=(e,s,t,o)=>Z(k,q(o),e,s,J,t),e.useWillFinishTransactionListener=(e,s,t)=>Z("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.23",
3
+ "version": "4.3.24",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -223,21 +223,21 @@
223
223
  "@rollup/plugin-image": "^3.0.3",
224
224
  "@rollup/plugin-replace": "^5.0.5",
225
225
  "@rollup/plugin-terser": "^0.4.4",
226
- "@sqlite.org/sqlite-wasm": "^3.43.2-build1",
227
- "@types/asciichart": "^1.5.7",
228
- "@types/expect-puppeteer": "^5.0.5",
229
- "@types/http-server": "^0.12.3",
230
- "@types/jest": "^29.5.6",
231
- "@types/jest-environment-puppeteer": "^5.0.5",
232
- "@types/less": "^3.0.5",
233
- "@types/node": "^20.8.9",
226
+ "@sqlite.org/sqlite-wasm": "^3.44.0-build1",
227
+ "@types/asciichart": "^1.5.8",
228
+ "@types/expect-puppeteer": "^5.0.6",
229
+ "@types/http-server": "^0.12.4",
230
+ "@types/jest": "^29.5.7",
231
+ "@types/jest-environment-puppeteer": "^5.0.6",
232
+ "@types/less": "^3.0.6",
233
+ "@types/node": "^20.8.10",
234
234
  "@types/puppeteer": "^5.4.7",
235
- "@types/react": "^18.2.33",
235
+ "@types/react": "^18.2.36",
236
236
  "@types/react-dom": "^18.2.14",
237
237
  "@types/react-test-renderer": "^18.0.5",
238
- "@types/tmp": "^0.2.5",
239
- "@typescript-eslint/eslint-plugin": "^6.9.0",
240
- "@typescript-eslint/parser": "^6.9.0",
238
+ "@types/tmp": "^0.2.6",
239
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
240
+ "@typescript-eslint/parser": "^6.10.0",
241
241
  "@vlcn.io/crsqlite-wasm": "^0.15.2",
242
242
  "asciichart": "^1.5.25",
243
243
  "automerge-repo": "^0.1.0",
@@ -248,9 +248,9 @@
248
248
  "babel-preset-minify": "^0.5.2",
249
249
  "buffer-replace": "^1.0.0",
250
250
  "country-flag-emoji-json": "^2.0.0",
251
- "cspell": "^7.3.8",
251
+ "cspell": "^8.0.0",
252
252
  "esbuild": "^0.19.5",
253
- "eslint": "^8.52.0",
253
+ "eslint": "^8.53.0",
254
254
  "eslint-config-prettier": "^9.0.0",
255
255
  "eslint-plugin-jest": "^27.6.0",
256
256
  "eslint-plugin-jsdoc": "^46.8.2",
@@ -267,14 +267,14 @@
267
267
  "jest-fetch-mock": "^3.0.3",
268
268
  "jest-puppeteer": "^9.0.1",
269
269
  "less": "^4.2.0",
270
- "partykit": "^0.0.32",
271
- "partysocket": "^0.0.12",
270
+ "partykit": "^0.0.34",
271
+ "partysocket": "^0.0.14",
272
272
  "prettier": "^3.0.3",
273
273
  "puppeteer": "21.1.1",
274
274
  "react": "^18.2.0",
275
275
  "react-dom": "^18.2.0",
276
276
  "react-test-renderer": "^18.2.0",
277
- "rollup": "^4.1.5",
277
+ "rollup": "^4.3.0",
278
278
  "rollup-plugin-esbuild": "^6.1.0",
279
279
  "rollup-plugin-gzip": "^3.1.0",
280
280
  "rollup-plugin-preserve-shebang": "^1.0.1",
@@ -288,11 +288,11 @@
288
288
  "yjs": "^13.6.8"
289
289
  },
290
290
  "peerDependencies": {
291
- "@sqlite.org/sqlite-wasm": "^3.43.2-build1",
291
+ "@sqlite.org/sqlite-wasm": "^3.44.0-build1",
292
292
  "@vlcn.io/crsqlite-wasm": "^0.15.2",
293
293
  "automerge-repo": "^0.1.0",
294
- "partykit": "^0.0.32",
295
- "partysocket": "^0.0.12",
294
+ "partykit": "^0.0.34",
295
+ "partysocket": "^0.0.14",
296
296
  "prettier": "^3.0.3",
297
297
  "react": "^18.2.0",
298
298
  "react-dom": "^18.2.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.23" 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.24" 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.8kB</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.3kB</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.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible 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,888</td><td>1,888</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,044</td><td>2,044</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>816</td><td>816</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>697</td><td>697</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,403</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,318</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.8kB</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.3kB</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.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible 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,889</td><td>1,889</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,045</td><td>2,045</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>815</td><td>815</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>697</td><td>697</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,403</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,318</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>