tinybase 4.5.4 → 4.5.5

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",l="Has",d="has",n="Ids",p="Table",a=p+"s",i=p+n,x="Row",I=x+"Count",c=x+n,C="Sorted"+x+n,b="Cell",w=b+n,R="Value",k=R+"s",L=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?t?.():s(e),m=e=>s(e)==o,y=()=>{},V=(e,s)=>e.map(s),S=Object.keys,T=(e,s)=>h(e,(e=>e[s])),v=(e,s)=>(delete e[s],e),{createContext:P,useContext:f,useEffect:q}=e,B=P([]),H=(e,s)=>{const t=f(B);return g(e)?t[s]:m(e)?T(t[s+1]??{},e):e},M=(e,s)=>{const t=H(e,s);return g(e)||m(e)?t:e},D=e=>S(f(B)[e]??{}),F=e=>M(e,0),O=e=>M(e,2),Q=e=>M(e,4),E=e=>M(e,6),A=e=>M(e,8),G=e=>M(e,10),W=e=>e.toLowerCase();W(r);const j="Transaction";W(j);const{useCallback:U,useEffect:z,useMemo:J,useLayoutEffect:K,useRef:N,useState:X}=e,Y=[],Z={},$=[[],void 0,[]],_=(e,s,t=Y)=>{const o=J((()=>s(e)),[e,...t]);return z((()=>()=>o.destroy()),[o]),o},ee=(e,s,t,o=Y,r,u="get",l="")=>{const[,d]=X(),n=U((()=>s?.[u+e]?.(...o)??t),[s,e,...o,t]),p=N();return J((()=>p.current=n()),[n]),se(l+e,s,((...e)=>{p.current=g(r)?n():e[r],d([])}),[n,r],o),p.current},se=(e,s,t,o=Y,u=Y,...l)=>K((()=>{const o=s?.["add"+e+r]?.(...u,t,...l);return()=>s?.delListener(o)}),[s,e,...u,...o,...l]),te=(e,s,t,o=Y,r=y,u=Y,...l)=>{const d=F(e);return U((e=>h(d,(o=>h(t(e,o),(e=>r(o["set"+s](...l,e),e)))))),[d,s,...o,...u,...l])},oe=(e,s,t=y,o=Y,...r)=>{const u=F(e);return U((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},re=(e,s,t)=>{const o=G(e);return U((()=>o?.[s](t)),[o,s,t])},ue=e=>ee(i,F(e),Y),le=(e,s)=>ee(c,F(s),Y,[e]),de=(e,s,t,o=0,r,u)=>ee(C,F(u),Y,[e,s,t,o,r],6),ne=(e,s,t)=>ee(w,F(t),Y,[e,s]),pe=(e,s,t,o)=>ee(b,F(o),void 0,[e,s,t],4),ae=e=>ee(L,F(e),Y),ie=(e,s)=>ee(R,F(s),void 0,[e]),xe=(e,s)=>ee("Metric",O(s),void 0,[e]),Ie=(e,s)=>ee("SliceIds",Q(s),Y,[e]),ce=(e,s,t)=>ee("Slice"+c,Q(t),Y,[e,s]),Ce=(e,s,t)=>ee("RemoteRowId",E(t),void 0,[e,s]),be=(e,s,t)=>ee("Local"+c,E(t),Y,[e,s]),we=(e,s,t)=>ee("Linked"+c,E(t),Y,[e,s]),Re=(e,s)=>ee(u+c,A(s),Y,[e]),ke=(e,s,t,o=0,r,l)=>ee(u+C,A(l),Y,[e,s,t,o,r],6),Le=(e,s,t)=>ee(u+w,A(t),Y,[e,s]),ge=(e,s,t,o)=>ee(u+b,A(o),void 0,[e,s,t]),he=e=>ee("CheckpointIds",G(e),$),me=(e,s)=>ee("Checkpoint",G(s),void 0,[e]),ye=e=>re(e,"goBackward"),Ve=e=>re(e,"goForward"),{PureComponent:Se,Fragment:Te,createElement:ve,useCallback:Pe,useLayoutEffect:fe,useRef:qe,useState:Be}=e,He=(e,...s)=>g(e)?{}:e(...s),Me=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:De,useContext:Fe,useMemo:Oe,useState:Qe}=e,Ee=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},d)=>je(V(d,(u=>ve(t,{...He(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),Ae=({queryId:e,queries:s,resultRowComponent:t=Ye,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>je(V(l,(r=>ve(t,{...He(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Ge=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:r,debugIds:u},l,d)=>{const[n,p,a]=Me(E(s),e),i=l(e,d,n);return je(V(i,(e=>ve(t,{...He(o,e),key:e,tableId:a,rowId:e,store:p,debugIds:u}))),r,u,d)},We=e=>({checkpoints:s,checkpointComponent:t=Ze,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=G(s);return je(V(e(he(l)),(e=>ve(t,{...He(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},je=(e,s,t,o)=>{const r=g(s)||!Array.isArray(e)?e:V(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Ue=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>je(t+(pe(e,s,o,r)??t),void 0,u,o),ze=({tableId:e,rowId:s,store:t,cellComponent:o=Ue,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:d})=>je(V(((e,s,t,o)=>{const r=ne(s,t,o);return e??r})(u,e,s,t),(u=>ve(o,{...He(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:d}))),l,d,s),Je=e=>Ee(e,le(e.tableId,e.store)),Ke=({valueId:e,store:s,debugIds:o})=>je(t+(ie(e,s)??t),void 0,o,e),Ne=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:r,separator:u,debugIds:l})=>{const[d,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(Q(t),e),a=ce(e,s,d);return je(V(a,(e=>ve(o,{...He(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:l}))),u,l,s)},Xe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>je(t+(ge(e,s,o,r)??t),void 0,u,o),Ye=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Xe,getResultCellComponentProps:r,separator:u,debugIds:l})=>je(V(Le(e,s,t),(u=>ve(o,{...He(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),Ze=({checkpoints:e,checkpointId:s,debugIds:o})=>je(me(s,e)??t,void 0,o,s),$e=We((e=>e[0])),_e=We((e=>g(e[1])?[]:[e[1]])),es=We((e=>e[2]));exports.BackwardCheckpointsView=$e,exports.CellView=Ue,exports.CheckpointView=Ze,exports.CurrentCheckpointView=_e,exports.ForwardCheckpointsView=es,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ne,getSliceComponentProps:o,separator:r,debugIds:u})=>je(V(Ie(e,s),(r=>ve(t,{...He(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Ge(e,we,e.firstRowId),exports.LocalRowsView=e=>Ge(e,be,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>je(xe(e,s)??t,void 0,o,e),exports.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:d,queries:n,queriesById:p,checkpoints:a,checkpointsById:i,children:x})=>{const I=Fe(B),[c,C]=Qe({}),b=De(((e,s)=>C((t=>T(t,e)==s?t:{...t,[e]:s}))),[]),w=De((e=>C((s=>({...v(s,e)})))),[]);return ve(B.Provider,{value:Oe((()=>[e??I[0],{...I[1],...s,...c},t??I[2],{...I[3],...o},r??I[4],{...I[5],...u},l??I[6],{...I[7],...d},n??I[8],{...I[9],...p},a??I[10],{...I[11],...i},b,w]),[e,s,c,t,o,r,u,l,d,n,p,a,i,I,b,w])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:r,debugIds:u})=>{const[l,d,,n]=Me(E(t),e),p=Ce(e,s,l);return je(g(n)||g(p)?null:ve(o,{...He(r,p),key:p,tableId:n,rowId:p,store:d,debugIds:u}),void 0,u,s)},exports.ResultCellView=Xe,exports.ResultRowView=Ye,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ae(r,ke(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>Ae(e,Re(e.queryId,e.queries)),exports.RowView=ze,exports.SliceView=Ne,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ee(r,de(r.tableId,e,s,t,o,r.store)),exports.TableView=Je,exports.TablesView=({store:e,tableComponent:s=Je,getTableComponentProps:t,separator:o,debugIds:r})=>je(V(ue(e),(o=>ve(s,{...He(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Ke,exports.ValuesView=({store:e,valueComponent:s=Ke,getValueComponentProps:t,separator:o,debugIds:r})=>je(V(ae(e),(o=>ve(s,{...He(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=Y,o,r=y,u=Y,l=!0)=>{const d=F(o);return U((t=>h(d,(o=>h(s(t,o),(s=>r(o.addRow(e,s,l),o,s)))))),[d,e,...t,...u,l])},exports.useCell=pe,exports.useCellIds=ne,exports.useCellIdsListener=(e,s,t,o,r,u)=>se(w,F(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,l)=>se(b,F(l),o,r,[e,s,t],u),exports.useCheckpoint=me,exports.useCheckpointIds=he,exports.useCheckpointIdsListener=(e,s,t)=>se("CheckpointIds",G(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>se("Checkpoint",G(o),s,t,[e]),exports.useCheckpoints=e=>H(e,10),exports.useCheckpointsIds=()=>D(11),exports.useCheckpointsOrCheckpointsById=G,exports.useCreateCheckpoints=(e,s,t)=>_(e,s,t),exports.useCreateIndexes=(e,s,t)=>_(e,s,t),exports.useCreateMetrics=(e,s,t)=>_(e,s,t),exports.useCreatePersister=(e,s,t=Y,o,r=Y,u,l=Y)=>{const[,d]=X(),n=J((()=>s(e)),[e,...t]);return z((()=>((async()=>{o&&(await o(n),d([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...l]),n},exports.useCreateQueries=(e,s,t)=>_(e,s,t),exports.useCreateRelationships=(e,s,t)=>_(e,s,t),exports.useCreateStore=(e,s=Y)=>J(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,l)=>oe(r,b,u,l,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>oe(t,x,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>oe(s,p,t,o,e),exports.useDelTablesCallback=(e,s,t)=>oe(e,a,s,t),exports.useDelValueCallback=(e,s,t,o)=>oe(s,R,t,o,e),exports.useDelValuesCallback=(e,s,t)=>oe(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>se("DidFinish"+j,F(t),e,s),exports.useGoBackwardCallback=ye,exports.useGoForwardCallback=Ve,exports.useGoToCallback=(e,s=Y,t,o=y,r=Y)=>{const u=G(t);return U((s=>h(u,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useHasCell=(e,s,t,o)=>ee(b,F(o),!1,[e,s,t],4,d,l),exports.useHasCellListener=(e,s,t,o,r,u,d)=>se(l+b,F(d),o,r,[e,s,t],u),exports.useHasRow=(e,s,t)=>ee(x,F(t),!1,[e,s],3,d,l),exports.useHasRowListener=(e,s,t,o,r,u)=>se(l+x,F(u),t,o,[e,s],r),exports.useHasTable=(e,s)=>ee(p,F(s),!1,[e],2,d,l),exports.useHasTableCell=(e,s,t)=>ee(p+b,F(t),!1,[e,s],3,d,l),exports.useHasTableCellListener=(e,s,t,o,r,u)=>se(l+p+b,F(u),t,o,[e,s],r),exports.useHasTableListener=(e,s,t,o,r)=>se(l+p,F(r),s,t,[e],o),exports.useHasTables=e=>ee(a,F(e),!1,[],1,d,l),exports.useHasTablesListener=(e,s,t,o)=>se(l+a,F(o),e,s,[],t),exports.useHasValue=(e,s)=>ee(R,F(s),!1,[e],2,d,l),exports.useHasValueListener=(e,s,t,o,r)=>se(l+R,F(r),s,t,[e],o),exports.useHasValues=e=>ee(k,F(e),!1,[],1,d,l),exports.useHasValuesListener=(e,s,t,o)=>se(l+k,F(o),e,s,[],t),exports.useIndexIds=e=>ee("IndexIds",Q(e),Y),exports.useIndexes=e=>H(e,4),exports.useIndexesIds=()=>D(5),exports.useIndexesOrIndexesById=Q,exports.useLinkedRowIds=we,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>se("Linked"+c,E(r),t,o,[e,s]),exports.useLocalRowIds=be,exports.useLocalRowIdsListener=(e,s,t,o,r)=>se("Local"+c,E(r),t,o,[e,s]),exports.useMetric=xe,exports.useMetricIds=e=>ee("MetricIds",O(e),Y),exports.useMetricListener=(e,s,t,o)=>se("Metric",O(o),s,t,[e]),exports.useMetrics=e=>H(e,2),exports.useMetricsIds=()=>D(3),exports.useMetricsOrMetricsById=O,exports.useProvideStore=(e,s)=>{const{12:t,13:o}=f(B);q((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},exports.useQueries=e=>H(e,8),exports.useQueriesIds=()=>D(9),exports.useQueriesOrQueriesById=A,exports.useQueryIds=e=>ee("QueryIds",A(e),Y),exports.useRedoInformation=e=>{const s=G(e),[,,[o]]=he(s);return[!g(o),Ve(s),o,h(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>ee("RelationshipIds",E(e),Y),exports.useRelationships=e=>H(e,6),exports.useRelationshipsIds=()=>D(7),exports.useRelationshipsOrRelationshipsById=E,exports.useRemoteRowId=Ce,exports.useRemoteRowIdListener=(e,s,t,o,r)=>se("RemoteRowId",E(r),t,o,[e,s]),exports.useResultCell=ge,exports.useResultCellIds=Le,exports.useResultCellIdsListener=(e,s,t,o,r)=>se(u+w,A(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,l)=>se(u+b,A(l),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>ee(u+x,A(t),Z,[e,s]),exports.useResultRowCount=(e,s)=>ee(u+I,A(s),0,[e]),exports.useResultRowCountListener=(e,s,t,o)=>se(u+I,A(o),s,t,[e]),exports.useResultRowIds=Re,exports.useResultRowIdsListener=(e,s,t,o)=>se(u+c,A(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>se(u+x,A(r),t,o,[e,s]),exports.useResultSortedRowIds=ke,exports.useResultSortedRowIdsListener=(e,s,t,o,r,l,d,n)=>se(u+C,A(n),l,d,[e,s,t,o,r]),exports.useResultTable=(e,s)=>ee(u+p,A(s),Z,[e]),exports.useResultTableCellIds=(e,s)=>ee(u+p+w,A(s),Y,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>se(u+p+w,A(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>se(u+p,A(o),s,t,[e]),exports.useRow=(e,s,t)=>ee(x,F(t),Z,[e,s]),exports.useRowCount=(e,s)=>ee(I,F(s),0,[e]),exports.useRowCountListener=(e,s,t,o,r)=>se(I,F(r),s,t,[e],o),exports.useRowIds=le,exports.useRowIdsListener=(e,s,t,o,r)=>se(c,F(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>se(x,F(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,l,d)=>te(u,b,o,r,l,d,e,s,t),exports.useSetCheckpointCallback=(e=y,s=Y,t,o=y,r=Y)=>{const u=G(t);return U((s=>h(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>te(r,"PartialRow",t,o,u,l,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>te(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,l)=>te(r,x,t,o,u,l,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>te(o,p,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>te(t,a,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>te(o,R,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>te(t,k,e,s,o,r),exports.useSliceIds=Ie,exports.useSliceIdsListener=(e,s,t,o)=>se("SliceIds",Q(o),s,t,[e]),exports.useSliceRowIds=ce,exports.useSliceRowIdsListener=(e,s,t,o,r)=>se("Slice"+c,Q(r),t,o,[e,s]),exports.useSortedRowIds=de,exports.useSortedRowIdsListener=(e,s,t,o,r,u,l,d,n)=>se(C,F(n),u,l,[e,s,t,o,r],d),exports.useStartTransactionListener=(e,s,t)=>se("Start"+j,F(t),e,s),exports.useStore=e=>H(e,0),exports.useStoreIds=()=>D(1),exports.useStoreOrStoreById=F,exports.useTable=(e,s)=>ee(p,F(s),Z,[e]),exports.useTableCellIds=(e,s)=>ee(p+w,F(s),Y,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>se(p+w,F(r),s,t,[e],o),exports.useTableIds=ue,exports.useTableIdsListener=(e,s,t,o)=>se(i,F(o),e,s,Y,t),exports.useTableListener=(e,s,t,o,r)=>se(p,F(r),s,t,[e],o),exports.useTables=e=>ee(a,F(e),Z),exports.useTablesListener=(e,s,t,o)=>se(a,F(o),e,s,Y,t),exports.useUndoInformation=e=>{const s=G(e),[o,r]=he(s);return[(u=o,!(0==u.length)),ye(s),r,h(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=ie,exports.useValueIds=ae,exports.useValueIdsListener=(e,s,t,o)=>se(L,F(o),e,s,Y,t),exports.useValueListener=(e,s,t,o,r)=>se(R,F(r),s,t,[e],o),exports.useValues=e=>ee(k,F(e),Z),exports.useValuesListener=(e,s,t,o)=>se(k,F(o),e,s,Y,t),exports.useWillFinishTransactionListener=(e,s,t)=>se("WillFinish"+j,F(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r=s(s),u="Listener",l="Result",d="Has",n="has",p="Ids",a="Table",i=a+"s",x=a+p,I="Row",c=I+"Count",C=I+p,b="Sorted"+I+p,w="Cell",R=w+p,k="Value",L=k+"s",g=k+p,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),y=e=>s(e)==o,V=e=>s(e)==r,S=()=>{},T=(e,s)=>e.map(s),v=Object.keys,P=(e,s)=>m(e,(e=>e[s])),f=(e,s)=>(delete e[s],e),{createContext:q,useContext:B,useEffect:H}=e,M=q([]),D=(e,s)=>{const t=B(M);return h(e)?t[s]:y(e)?P(t[s+1]??{},e):e},F=(e,s)=>{const t=D(e,s);return h(e)||y(e)?t:e},O=e=>v(B(M)[e]??{}),Q=e=>F(e,0),E=e=>F(e,2),A=e=>F(e,4),G=e=>F(e,6),W=e=>F(e,8),j=e=>F(e,10),U=e=>e.toLowerCase();U(u);const z="Transaction";U(z);const{useCallback:J,useEffect:K,useMemo:N,useLayoutEffect:X,useRef:Y,useState:Z}=e,$=[],_={},ee=[[],void 0,[]],se=(e,s,t=$)=>{const o=N((()=>s(e)),[e,...t]);return K((()=>()=>o.destroy()),[o]),o},te=(e,s,t,o=$,r,u="get",l="")=>{const[,d]=Z(),n=J((()=>s?.[u+e]?.(...o)??t),[s,e,...o,t]),p=Y();return N((()=>p.current=n()),[n]),oe(l+e,s,((...e)=>{p.current=h(r)?n():e[r],d([])}),[n,r],o),p.current},oe=(e,s,t,o=$,r=$,...l)=>X((()=>{const o=s?.["add"+e+u]?.(...r,t,...l);return()=>s?.delListener(o)}),[s,e,...r,...o,...l]),re=(e,s,t,o=$,r=S,u=$,...l)=>{const d=Q(e);return J((e=>m(d,(o=>m(t(e,o),(t=>r(o["set"+s](...T(l,(s=>V(s)?s(e,o):s)),t),t)))))),[d,s,...o,...u,...l])},ue=(e,s,t=S,o=$,...r)=>{const u=Q(e);return J((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},le=(e,s,t)=>{const o=j(e);return J((()=>o?.[s](t)),[o,s,t])},de=e=>te(x,Q(e),$),ne=(e,s)=>te(C,Q(s),$,[e]),pe=(e,s,t,o=0,r,u)=>te(b,Q(u),$,[e,s,t,o,r],6),ae=(e,s,t)=>te(R,Q(t),$,[e,s]),ie=(e,s,t,o)=>te(w,Q(o),void 0,[e,s,t],4),xe=e=>te(g,Q(e),$),Ie=(e,s)=>te(k,Q(s),void 0,[e]),ce=(e,s)=>te("Metric",E(s),void 0,[e]),Ce=(e,s)=>te("SliceIds",A(s),$,[e]),be=(e,s,t)=>te("Slice"+C,A(t),$,[e,s]),we=(e,s,t)=>te("RemoteRowId",G(t),void 0,[e,s]),Re=(e,s,t)=>te("Local"+C,G(t),$,[e,s]),ke=(e,s,t)=>te("Linked"+C,G(t),$,[e,s]),Le=(e,s)=>te(l+C,W(s),$,[e]),ge=(e,s,t,o=0,r,u)=>te(l+b,W(u),$,[e,s,t,o,r],6),he=(e,s,t)=>te(l+R,W(t),$,[e,s]),me=(e,s,t,o)=>te(l+w,W(o),void 0,[e,s,t]),ye=e=>te("CheckpointIds",j(e),ee),Ve=(e,s)=>te("Checkpoint",j(s),void 0,[e]),Se=e=>le(e,"goBackward"),Te=e=>le(e,"goForward"),{PureComponent:ve,Fragment:Pe,createElement:fe,useCallback:qe,useLayoutEffect:Be,useRef:He,useState:Me}=e,De=(e,...s)=>h(e)?{}:e(...s),Fe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Oe,useContext:Qe,useMemo:Ee,useState:Ae}=e,Ge=({tableId:e,store:s,rowComponent:t=Ke,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:l},d)=>ze(T(d,(u=>fe(t,{...De(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:l}))),u,l,e),We=({queryId:e,queries:s,resultRowComponent:t=$e,getResultRowComponentProps:o,separator:r,debugIds:u},l)=>ze(T(l,(r=>fe(t,{...De(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),je=({relationshipId:e,relationships:s,rowComponent:t=Ke,getRowComponentProps:o,separator:r,debugIds:u},l,d)=>{const[n,p,a]=Fe(G(s),e),i=l(e,d,n);return ze(T(i,(e=>fe(t,{...De(o,e),key:e,tableId:a,rowId:e,store:p,debugIds:u}))),r,u,d)},Ue=e=>({checkpoints:s,checkpointComponent:t=_e,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const l=j(s);return ze(T(e(ye(l)),(e=>fe(t,{...De(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:u}))),r)},ze=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:T(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Je=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>ze(t+(ie(e,s,o,r)??t),void 0,u,o),Ke=({tableId:e,rowId:s,store:t,cellComponent:o=Je,getCellComponentProps:r,customCellIds:u,separator:l,debugIds:d})=>ze(T(((e,s,t,o)=>{const r=ae(s,t,o);return e??r})(u,e,s,t),(u=>fe(o,{...De(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:d}))),l,d,s),Ne=e=>Ge(e,ne(e.tableId,e.store)),Xe=({valueId:e,store:s,debugIds:o})=>ze(t+(Ie(e,s)??t),void 0,o,e),Ye=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ke,getRowComponentProps:r,separator:u,debugIds:l})=>{const[d,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(A(t),e),a=be(e,s,d);return ze(T(a,(e=>fe(o,{...De(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:l}))),u,l,s)},Ze=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>ze(t+(me(e,s,o,r)??t),void 0,u,o),$e=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ze,getResultCellComponentProps:r,separator:u,debugIds:l})=>ze(T(he(e,s,t),(u=>fe(o,{...De(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:l}))),u,l,s),_e=({checkpoints:e,checkpointId:s,debugIds:o})=>ze(Ve(s,e)??t,void 0,o,s),es=Ue((e=>e[0])),ss=Ue((e=>h(e[1])?[]:[e[1]])),ts=Ue((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:u})=>ze(T(Ce(e,s),(r=>fe(t,{...De(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>je(e,ke,e.firstRowId),exports.LocalRowsView=e=>je(e,Re,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>ze(ce(e,s)??t,void 0,o,e),exports.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:r,indexesById:u,relationships:l,relationshipsById:d,queries:n,queriesById:p,checkpoints:a,checkpointsById:i,children:x})=>{const I=Qe(M),[c,C]=Ae({}),b=Oe(((e,s)=>C((t=>P(t,e)==s?t:{...t,[e]:s}))),[]),w=Oe((e=>C((s=>({...f(s,e)})))),[]);return fe(M.Provider,{value:Ee((()=>[e??I[0],{...I[1],...s,...c},t??I[2],{...I[3],...o},r??I[4],{...I[5],...u},l??I[6],{...I[7],...d},n??I[8],{...I[9],...p},a??I[10],{...I[11],...i},b,w]),[e,s,c,t,o,r,u,l,d,n,p,a,i,I,b,w])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ke,getRowComponentProps:r,debugIds:u})=>{const[l,d,,n]=Fe(G(t),e),p=we(e,s,l);return ze(h(n)||h(p)?null:fe(o,{...De(r,p),key:p,tableId:n,rowId:p,store:d,debugIds:u}),void 0,u,s)},exports.ResultCellView=Ze,exports.ResultRowView=$e,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>We(r,ge(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>We(e,Le(e.queryId,e.queries)),exports.RowView=Ke,exports.SliceView=Ye,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ge(r,pe(r.tableId,e,s,t,o,r.store)),exports.TableView=Ne,exports.TablesView=({store:e,tableComponent:s=Ne,getTableComponentProps:t,separator:o,debugIds:r})=>ze(T(de(e),(o=>fe(s,{...De(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})=>ze(T(xe(e),(o=>fe(s,{...De(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=$,o,r=S,u=$,l=!0)=>{const d=Q(o);return J((t=>m(d,(o=>m(s(t,o),(s=>r(o.addRow(V(e)?e(t,o):e,s,l),o,s)))))),[d,e,...t,...u,l])},exports.useCell=ie,exports.useCellIds=ae,exports.useCellIdsListener=(e,s,t,o,r,u)=>oe(R,Q(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,l)=>oe(w,Q(l),o,r,[e,s,t],u),exports.useCheckpoint=Ve,exports.useCheckpointIds=ye,exports.useCheckpointIdsListener=(e,s,t)=>oe("CheckpointIds",j(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>oe("Checkpoint",j(o),s,t,[e]),exports.useCheckpoints=e=>D(e,10),exports.useCheckpointsIds=()=>O(11),exports.useCheckpointsOrCheckpointsById=j,exports.useCreateCheckpoints=(e,s,t)=>se(e,s,t),exports.useCreateIndexes=(e,s,t)=>se(e,s,t),exports.useCreateMetrics=(e,s,t)=>se(e,s,t),exports.useCreatePersister=(e,s,t=$,o,r=$,u,l=$)=>{const[,d]=Z(),n=N((()=>s(e)),[e,...t]);return K((()=>((async()=>{o&&(await o(n),d([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...l]),n},exports.useCreateQueries=(e,s,t)=>se(e,s,t),exports.useCreateRelationships=(e,s,t)=>se(e,s,t),exports.useCreateStore=(e,s=$)=>N(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,l)=>ue(r,w,u,l,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>ue(t,I,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>ue(s,a,t,o,e),exports.useDelTablesCallback=(e,s,t)=>ue(e,i,s,t),exports.useDelValueCallback=(e,s,t,o)=>ue(s,k,t,o,e),exports.useDelValuesCallback=(e,s,t)=>ue(e,L,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>oe("DidFinish"+z,Q(t),e,s),exports.useGoBackwardCallback=Se,exports.useGoForwardCallback=Te,exports.useGoToCallback=(e,s=$,t,o=S,r=$)=>{const u=j(t);return J((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useHasCell=(e,s,t,o)=>te(w,Q(o),!1,[e,s,t],4,n,d),exports.useHasCellListener=(e,s,t,o,r,u,l)=>oe(d+w,Q(l),o,r,[e,s,t],u),exports.useHasRow=(e,s,t)=>te(I,Q(t),!1,[e,s],3,n,d),exports.useHasRowListener=(e,s,t,o,r,u)=>oe(d+I,Q(u),t,o,[e,s],r),exports.useHasTable=(e,s)=>te(a,Q(s),!1,[e],2,n,d),exports.useHasTableCell=(e,s,t)=>te(a+w,Q(t),!1,[e,s],3,n,d),exports.useHasTableCellListener=(e,s,t,o,r,u)=>oe(d+a+w,Q(u),t,o,[e,s],r),exports.useHasTableListener=(e,s,t,o,r)=>oe(d+a,Q(r),s,t,[e],o),exports.useHasTables=e=>te(i,Q(e),!1,[],1,n,d),exports.useHasTablesListener=(e,s,t,o)=>oe(d+i,Q(o),e,s,[],t),exports.useHasValue=(e,s)=>te(k,Q(s),!1,[e],2,n,d),exports.useHasValueListener=(e,s,t,o,r)=>oe(d+k,Q(r),s,t,[e],o),exports.useHasValues=e=>te(L,Q(e),!1,[],1,n,d),exports.useHasValuesListener=(e,s,t,o)=>oe(d+L,Q(o),e,s,[],t),exports.useIndexIds=e=>te("IndexIds",A(e),$),exports.useIndexes=e=>D(e,4),exports.useIndexesIds=()=>O(5),exports.useIndexesOrIndexesById=A,exports.useLinkedRowIds=ke,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>oe("Linked"+C,G(r),t,o,[e,s]),exports.useLocalRowIds=Re,exports.useLocalRowIdsListener=(e,s,t,o,r)=>oe("Local"+C,G(r),t,o,[e,s]),exports.useMetric=ce,exports.useMetricIds=e=>te("MetricIds",E(e),$),exports.useMetricListener=(e,s,t,o)=>oe("Metric",E(o),s,t,[e]),exports.useMetrics=e=>D(e,2),exports.useMetricsIds=()=>O(3),exports.useMetricsOrMetricsById=E,exports.useProvideStore=(e,s)=>{const{12:t,13:o}=B(M);H((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},exports.useQueries=e=>D(e,8),exports.useQueriesIds=()=>O(9),exports.useQueriesOrQueriesById=W,exports.useQueryIds=e=>te("QueryIds",W(e),$),exports.useRedoInformation=e=>{const s=j(e),[,,[o]]=ye(s);return[!h(o),Te(s),o,m(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>te("RelationshipIds",G(e),$),exports.useRelationships=e=>D(e,6),exports.useRelationshipsIds=()=>O(7),exports.useRelationshipsOrRelationshipsById=G,exports.useRemoteRowId=we,exports.useRemoteRowIdListener=(e,s,t,o,r)=>oe("RemoteRowId",G(r),t,o,[e,s]),exports.useResultCell=me,exports.useResultCellIds=he,exports.useResultCellIdsListener=(e,s,t,o,r)=>oe(l+R,W(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>oe(l+w,W(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>te(l+I,W(t),_,[e,s]),exports.useResultRowCount=(e,s)=>te(l+c,W(s),0,[e]),exports.useResultRowCountListener=(e,s,t,o)=>oe(l+c,W(o),s,t,[e]),exports.useResultRowIds=Le,exports.useResultRowIdsListener=(e,s,t,o)=>oe(l+C,W(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>oe(l+I,W(r),t,o,[e,s]),exports.useResultSortedRowIds=ge,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,d,n)=>oe(l+b,W(n),u,d,[e,s,t,o,r]),exports.useResultTable=(e,s)=>te(l+a,W(s),_,[e]),exports.useResultTableCellIds=(e,s)=>te(l+a+R,W(s),$,[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>oe(l+a+R,W(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>oe(l+a,W(o),s,t,[e]),exports.useRow=(e,s,t)=>te(I,Q(t),_,[e,s]),exports.useRowCount=(e,s)=>te(c,Q(s),0,[e]),exports.useRowCountListener=(e,s,t,o,r)=>oe(c,Q(r),s,t,[e],o),exports.useRowIds=ne,exports.useRowIdsListener=(e,s,t,o,r)=>oe(C,Q(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>oe(I,Q(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,l,d)=>re(u,w,o,r,l,d,e,s,t),exports.useSetCheckpointCallback=(e=S,s=$,t,o=S,r=$)=>{const u=j(t);return J((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,l)=>re(r,"PartialRow",t,o,u,l,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>re(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,l)=>re(r,I,t,o,u,l,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>re(o,a,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>re(t,i,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>re(o,k,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>re(t,L,e,s,o,r),exports.useSliceIds=Ce,exports.useSliceIdsListener=(e,s,t,o)=>oe("SliceIds",A(o),s,t,[e]),exports.useSliceRowIds=be,exports.useSliceRowIdsListener=(e,s,t,o,r)=>oe("Slice"+C,A(r),t,o,[e,s]),exports.useSortedRowIds=pe,exports.useSortedRowIdsListener=(e,s,t,o,r,u,l,d,n)=>oe(b,Q(n),u,l,[e,s,t,o,r],d),exports.useStartTransactionListener=(e,s,t)=>oe("Start"+z,Q(t),e,s),exports.useStore=e=>D(e,0),exports.useStoreIds=()=>O(1),exports.useStoreOrStoreById=Q,exports.useTable=(e,s)=>te(a,Q(s),_,[e]),exports.useTableCellIds=(e,s)=>te(a+R,Q(s),$,[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>oe(a+R,Q(r),s,t,[e],o),exports.useTableIds=de,exports.useTableIdsListener=(e,s,t,o)=>oe(x,Q(o),e,s,$,t),exports.useTableListener=(e,s,t,o,r)=>oe(a,Q(r),s,t,[e],o),exports.useTables=e=>te(i,Q(e),_),exports.useTablesListener=(e,s,t,o)=>oe(i,Q(o),e,s,$,t),exports.useUndoInformation=e=>{const s=j(e),[o,r]=ye(s);return[(u=o,!(0==u.length)),Se(s),r,m(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=Ie,exports.useValueIds=xe,exports.useValueIdsListener=(e,s,t,o)=>oe(g,Q(o),e,s,$,t),exports.useValueListener=(e,s,t,o,r)=>oe(k,Q(r),s,t,[e],o),exports.useValues=e=>te(L,Q(e),_),exports.useValuesListener=(e,s,t,o)=>oe(L,Q(o),e,s,$,t),exports.useWillFinishTransactionListener=(e,s,t)=>oe("WillFinish"+z,Q(t),e,s);
Binary file
@@ -1 +1 @@
1
- "use strict";var e=require("react");const s=e=>typeof e,t="",r=s(t),o="Listener",l="Result",u="Has",n="has",d="Ids",i="Table",a=i+"s",p=i+d,c="Row",x=c+"Count",I=c+d,C="Sorted"+c+d,b="Cell",w=b+d,R="Value",k=R+"s",v=R+d,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),L=e=>s(e)==r,m=()=>{},y=(e,s)=>e.map(s),V=Object.keys,S=(e,s)=>h(e,(e=>e[s])),{createContext:T,useContext:f,useEffect:P}=e,O=T([]),q=(e,s)=>{var t;const r=f(O);return g(e)?r[s]:L(e)?S(null!=(t=r[s+1])?t:{},e):e},B=(e,s)=>{const t=q(e,s);return g(e)||L(e)?t:e},H=e=>{var s;return V(null!=(s=f(O)[e])?s:{})},M=e=>B(e,0),D=e=>B(e,2),F=e=>B(e,4),j=e=>B(e,6),Q=e=>B(e,8),E=e=>B(e,10),A=e=>e.toLowerCase();A(o);const G="Transaction";A(G);const{useCallback:W,useEffect:U,useMemo:z,useLayoutEffect:J,useRef:K,useState:N}=e,X=[],Y={},Z=[[],void 0,[]],$=(e,s,t=X)=>{const r=z((()=>s(e)),[e,...t]);return U((()=>()=>r.destroy()),[r]),r},_=(e,s,t,r=X,o,l="get",u="")=>{const[,n]=N(),d=W((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[l+e])?void 0:o.call(s,...r))?u:t}),[s,e,...r,t]),i=K();return z((()=>i.current=d()),[d]),ee(u+e,s,((...e)=>{i.current=g(o)?d():e[o],n([])}),[d,o],r),i.current},ee=(e,s,t,r=X,l=X,...u)=>J((()=>{var r;const n=null==(r=null==s?void 0:s["add"+e+o])?void 0:r.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,e,...l,...r,...u]),se=(e,s,t,r=X,o=m,l=X,...u)=>{const n=M(e);return W((e=>h(n,(r=>h(t(e,r),(e=>o(r["set"+s](...u,e),e)))))),[n,s,...r,...l,...u])},te=(e,s,t=m,r=X,...o)=>{const l=M(e);return W((()=>t(null==l?void 0:l["del"+s](...o))),[l,s,...r,...o])},re=(e,s,t)=>{const r=E(e);return W((()=>null==r?void 0:r[s](t)),[r,s,t])},oe=e=>_(p,M(e),X),le=(e,s)=>_(I,M(s),X,[e]),ue=(e,s,t,r=0,o,l)=>_(C,M(l),X,[e,s,t,r,o],6),ne=(e,s,t)=>_(w,M(t),X,[e,s]),de=(e,s,t,r)=>_(b,M(r),void 0,[e,s,t],4),ie=e=>_(v,M(e),X),ae=(e,s)=>_(R,M(s),void 0,[e]),pe=(e,s)=>_("Metric",D(s),void 0,[e]),ce=(e,s)=>_("SliceIds",F(s),X,[e]),xe=(e,s,t)=>_("Slice"+I,F(t),X,[e,s]),Ie=(e,s,t)=>_("RemoteRowId",j(t),void 0,[e,s]),Ce=(e,s,t)=>_("Local"+I,j(t),X,[e,s]),be=(e,s,t)=>_("Linked"+I,j(t),X,[e,s]),we=(e,s)=>_(l+I,Q(s),X,[e]),Re=(e,s,t,r=0,o,u)=>_(l+C,Q(u),X,[e,s,t,r,o],6),ke=(e,s,t)=>_(l+w,Q(t),X,[e,s]),ve=(e,s,t,r)=>_(l+b,Q(r),void 0,[e,s,t]),ge=e=>_("CheckpointIds",E(e),Z),he=(e,s)=>_("Checkpoint",E(s),void 0,[e]),Le=e=>re(e,"goBackward"),me=e=>re(e,"goForward"),{PureComponent:ye,Fragment:Ve,createElement:Se,useCallback:Te,useLayoutEffect:fe,useRef:Pe,useState:Oe}=e,qe=(e,...s)=>g(e)?{}:e(...s),Be=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var He=Object.defineProperty,Me=Object.defineProperties,De=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,Ee=(e,s,t)=>s in e?He(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Ae=(e,s)=>{for(var t in s||(s={}))je.call(s,t)&&Ee(e,t,s[t]);if(Fe)for(var t of Fe(s))Qe.call(s,t)&&Ee(e,t,s[t]);return e},Ge=(e,s)=>Me(e,De(s)),We=(e,s)=>{var t={};for(var r in e)je.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&Fe)for(var r of Fe(e))s.indexOf(r)<0&&Qe.call(e,r)&&(t[r]=e[r]);return t};const{useCallback:Ue,useContext:ze,useMemo:Je,useState:Ke}=e,Ne=({tableId:e,store:s,rowComponent:t=es,getRowComponentProps:r,customCellIds:o,separator:l,debugIds:u},n)=>$e(y(n,(l=>Se(t,Ge(Ae({},qe(r,l)),{key:l,tableId:e,rowId:l,customCellIds:o,store:s,debugIds:u})))),l,u,e),Xe=({queryId:e,queries:s,resultRowComponent:t=ls,getResultRowComponentProps:r,separator:o,debugIds:l},u)=>$e(y(u,(o=>Se(t,Ge(Ae({},qe(r,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:l})))),o,l,e),Ye=({relationshipId:e,relationships:s,rowComponent:t=es,getRowComponentProps:r,separator:o,debugIds:l},u,n)=>{const[d,i,a]=Be(j(s),e),p=u(e,n,d);return $e(y(p,(e=>Se(t,Ge(Ae({},qe(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),o,l,n)},Ze=e=>({checkpoints:s,checkpointComponent:t=us,getCheckpointComponentProps:r,separator:o,debugIds:l})=>{const u=E(s);return $e(y(e(ge(u)),(e=>Se(t,Ge(Ae({},qe(r,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),o)},$e=(e,s,t,r)=>{const o=g(s)||!Array.isArray(e)?e:y(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},_e=({tableId:e,rowId:s,cellId:r,store:o,debugIds:l})=>{var u;return $e(t+(null!=(u=de(e,s,r,o))?u:t),void 0,l,r)},es=({tableId:e,rowId:s,store:t,cellComponent:r=_e,getCellComponentProps:o,customCellIds:l,separator:u,debugIds:n})=>$e(y(((e,s,t,r)=>{const o=ne(s,t,r);return null!=e?e:o})(l,e,s,t),(l=>Se(r,Ge(Ae({},qe(o,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),ss=e=>Ne(e,le(e.tableId,e.store)),ts=({valueId:e,store:s,debugIds:r})=>{var o;return $e(t+(null!=(o=ae(e,s))?o:t),void 0,r,e)},rs=({indexId:e,sliceId:s,indexes:t,rowComponent:r=es,getRowComponentProps:o,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(F(t),e),a=xe(e,s,n);return $e(y(a,(e=>Se(r,Ge(Ae({},qe(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},os=({queryId:e,rowId:s,cellId:r,queries:o,debugIds:l})=>{var u;return $e(t+(null!=(u=ve(e,s,r,o))?u:t),void 0,l,r)},ls=({queryId:e,rowId:s,queries:t,resultCellComponent:r=os,getResultCellComponentProps:o,separator:l,debugIds:u})=>$e(y(ke(e,s,t),(l=>Se(r,Ge(Ae({},qe(o,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),us=({checkpoints:e,checkpointId:s,debugIds:r})=>{var o;return $e(null!=(o=he(s,e))?o:t,void 0,r,s)},ns=Ze((e=>e[0])),ds=Ze((e=>g(e[1])?[]:[e[1]])),is=Ze((e=>e[2]));exports.BackwardCheckpointsView=ns,exports.CellView=_e,exports.CheckpointView=us,exports.CurrentCheckpointView=ds,exports.ForwardCheckpointsView=is,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=rs,getSliceComponentProps:r,separator:o,debugIds:l})=>$e(y(ce(e,s),(o=>Se(t,Ge(Ae({},qe(r,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:l})))),o,l,e),exports.LinkedRowsView=e=>Ye(e,be,e.firstRowId),exports.LocalRowsView=e=>Ye(e,Ce,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:r})=>{var o;return $e(null!=(o=pe(e,s))?o:t,void 0,r,e)},exports.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:l,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:p,children:c})=>{const x=ze(O),[I,C]=Ke({}),b=Ue(((e,s)=>C((t=>S(t,e)==s?t:Ge(Ae({},t),{[e]:s})))),[]),w=Ue((e=>C((s=>Ae({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Se(O.Provider,{value:Je((()=>[null!=e?e:x[0],Ae(Ae(Ae({},x[1]),s),I),null!=t?t:x[2],Ae(Ae({},x[3]),r),null!=o?o:x[4],Ae(Ae({},x[5]),l),null!=u?u:x[6],Ae(Ae({},x[7]),n),null!=d?d:x[8],Ae(Ae({},x[9]),i),null!=a?a:x[10],Ae(Ae({},x[11]),p),b,w]),[e,s,I,t,r,o,l,u,n,d,i,a,p,x,b,w])},c)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=es,getRowComponentProps:o,debugIds:l})=>{const[u,n,,d]=Be(j(t),e),i=Ie(e,s,u);return $e(g(d)||g(i)?null:Se(r,Ge(Ae({},qe(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=os,exports.ResultRowView=ls,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=We(s,["cellId","descending","offset","limit"]);return Xe(u,Re(u.queryId,t,r,o,l,u.queries))},exports.ResultTableView=e=>Xe(e,we(e.queryId,e.queries)),exports.RowView=es,exports.SliceView=rs,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=We(s,["cellId","descending","offset","limit"]);return Ne(u,ue(u.tableId,t,r,o,l,u.store))},exports.TableView=ss,exports.TablesView=({store:e,tableComponent:s=ss,getTableComponentProps:t,separator:r,debugIds:o})=>$e(y(oe(e),(r=>Se(s,Ge(Ae({},qe(t,r)),{key:r,tableId:r,store:e,debugIds:o})))),r),exports.ValueView=ts,exports.ValuesView=({store:e,valueComponent:s=ts,getValueComponentProps:t,separator:r,debugIds:o})=>$e(y(ie(e),(r=>Se(s,Ge(Ae({},qe(t,r)),{key:r,valueId:r,store:e,debugIds:o})))),r),exports.useAddRowCallback=(e,s,t=X,r,o=m,l=X,u=!0)=>{const n=M(r);return W((t=>h(n,(r=>h(s(t,r),(s=>o(r.addRow(e,s,u),r,s)))))),[n,e,...t,...l,u])},exports.useCell=de,exports.useCellIds=ne,exports.useCellIdsListener=(e,s,t,r,o,l)=>ee(w,M(l),t,r,[e,s],o),exports.useCellListener=(e,s,t,r,o,l,u)=>ee(b,M(u),r,o,[e,s,t],l),exports.useCheckpoint=he,exports.useCheckpointIds=ge,exports.useCheckpointIdsListener=(e,s,t)=>ee("CheckpointIds",E(t),e,s),exports.useCheckpointListener=(e,s,t,r)=>ee("Checkpoint",E(r),s,t,[e]),exports.useCheckpoints=e=>q(e,10),exports.useCheckpointsIds=()=>H(11),exports.useCheckpointsOrCheckpointsById=E,exports.useCreateCheckpoints=(e,s,t)=>$(e,s,t),exports.useCreateIndexes=(e,s,t)=>$(e,s,t),exports.useCreateMetrics=(e,s,t)=>$(e,s,t),exports.useCreatePersister=(e,s,t=X,r,o=X,l,u=X)=>{const[,n]=N(),d=z((()=>s(e)),[e,...t]);return U((()=>{var e;return e=function*(){r&&(yield r(d),n([]))},new Promise(((s,t)=>{var r=s=>{try{l(e.next(s))}catch(e){t(e)}},o=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(r,o);l((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==l||l(d)}}),[d,...o,...u]),d},exports.useCreateQueries=(e,s,t)=>$(e,s,t),exports.useCreateRelationships=(e,s,t)=>$(e,s,t),exports.useCreateStore=(e,s=X)=>z(e,s),exports.useDelCellCallback=(e,s,t,r,o,l,u)=>te(o,b,l,u,e,s,t,r),exports.useDelRowCallback=(e,s,t,r,o)=>te(t,c,r,o,e,s),exports.useDelTableCallback=(e,s,t,r)=>te(s,i,t,r,e),exports.useDelTablesCallback=(e,s,t)=>te(e,a,s,t),exports.useDelValueCallback=(e,s,t,r)=>te(s,R,t,r,e),exports.useDelValuesCallback=(e,s,t)=>te(e,k,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>ee("DidFinish"+G,M(t),e,s),exports.useGoBackwardCallback=Le,exports.useGoForwardCallback=me,exports.useGoToCallback=(e,s=X,t,r=m,o=X)=>{const l=E(t);return W((s=>h(l,(t=>h(e(s),(e=>r(t.goTo(e),e)))))),[l,...s,...o])},exports.useHasCell=(e,s,t,r)=>_(b,M(r),!1,[e,s,t],4,n,u),exports.useHasCellListener=(e,s,t,r,o,l,n)=>ee(u+b,M(n),r,o,[e,s,t],l),exports.useHasRow=(e,s,t)=>_(c,M(t),!1,[e,s],3,n,u),exports.useHasRowListener=(e,s,t,r,o,l)=>ee(u+c,M(l),t,r,[e,s],o),exports.useHasTable=(e,s)=>_(i,M(s),!1,[e],2,n,u),exports.useHasTableCell=(e,s,t)=>_(i+b,M(t),!1,[e,s],3,n,u),exports.useHasTableCellListener=(e,s,t,r,o,l)=>ee(u+i+b,M(l),t,r,[e,s],o),exports.useHasTableListener=(e,s,t,r,o)=>ee(u+i,M(o),s,t,[e],r),exports.useHasTables=e=>_(a,M(e),!1,[],1,n,u),exports.useHasTablesListener=(e,s,t,r)=>ee(u+a,M(r),e,s,[],t),exports.useHasValue=(e,s)=>_(R,M(s),!1,[e],2,n,u),exports.useHasValueListener=(e,s,t,r,o)=>ee(u+R,M(o),s,t,[e],r),exports.useHasValues=e=>_(k,M(e),!1,[],1,n,u),exports.useHasValuesListener=(e,s,t,r)=>ee(u+k,M(r),e,s,[],t),exports.useIndexIds=e=>_("IndexIds",F(e),X),exports.useIndexes=e=>q(e,4),exports.useIndexesIds=()=>H(5),exports.useIndexesOrIndexesById=F,exports.useLinkedRowIds=be,exports.useLinkedRowIdsListener=(e,s,t,r,o)=>ee("Linked"+I,j(o),t,r,[e,s]),exports.useLocalRowIds=Ce,exports.useLocalRowIdsListener=(e,s,t,r,o)=>ee("Local"+I,j(o),t,r,[e,s]),exports.useMetric=pe,exports.useMetricIds=e=>_("MetricIds",D(e),X),exports.useMetricListener=(e,s,t,r)=>ee("Metric",D(r),s,t,[e]),exports.useMetrics=e=>q(e,2),exports.useMetricsIds=()=>H(3),exports.useMetricsOrMetricsById=D,exports.useProvideStore=(e,s)=>{const{12:t,13:r}=f(O);P((()=>(null==t||t(e,s),()=>null==r?void 0:r(e))),[t,e,s,r])},exports.useQueries=e=>q(e,8),exports.useQueriesIds=()=>H(9),exports.useQueriesOrQueriesById=Q,exports.useQueryIds=e=>_("QueryIds",Q(e),X),exports.useRedoInformation=e=>{var s;const r=E(e),[,,[o]]=ge(r);return[!g(o),me(r),o,null!=(s=h(o,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>_("RelationshipIds",j(e),X),exports.useRelationships=e=>q(e,6),exports.useRelationshipsIds=()=>H(7),exports.useRelationshipsOrRelationshipsById=j,exports.useRemoteRowId=Ie,exports.useRemoteRowIdListener=(e,s,t,r,o)=>ee("RemoteRowId",j(o),t,r,[e,s]),exports.useResultCell=ve,exports.useResultCellIds=ke,exports.useResultCellIdsListener=(e,s,t,r,o)=>ee(l+w,Q(o),t,r,[e,s]),exports.useResultCellListener=(e,s,t,r,o,u)=>ee(l+b,Q(u),r,o,[e,s,t]),exports.useResultRow=(e,s,t)=>_(l+c,Q(t),Y,[e,s]),exports.useResultRowCount=(e,s)=>_(l+x,Q(s),0,[e]),exports.useResultRowCountListener=(e,s,t,r)=>ee(l+x,Q(r),s,t,[e]),exports.useResultRowIds=we,exports.useResultRowIdsListener=(e,s,t,r)=>ee(l+I,Q(r),s,t,[e]),exports.useResultRowListener=(e,s,t,r,o)=>ee(l+c,Q(o),t,r,[e,s]),exports.useResultSortedRowIds=Re,exports.useResultSortedRowIdsListener=(e,s,t,r,o,u,n,d)=>ee(l+C,Q(d),u,n,[e,s,t,r,o]),exports.useResultTable=(e,s)=>_(l+i,Q(s),Y,[e]),exports.useResultTableCellIds=(e,s)=>_(l+i+w,Q(s),X,[e]),exports.useResultTableCellIdsListener=(e,s,t,r)=>ee(l+i+w,Q(r),s,t,[e]),exports.useResultTableListener=(e,s,t,r)=>ee(l+i,Q(r),s,t,[e]),exports.useRow=(e,s,t)=>_(c,M(t),Y,[e,s]),exports.useRowCount=(e,s)=>_(x,M(s),0,[e]),exports.useRowCountListener=(e,s,t,r,o)=>ee(x,M(o),s,t,[e],r),exports.useRowIds=le,exports.useRowIdsListener=(e,s,t,r,o)=>ee(I,M(o),s,t,[e],r),exports.useRowListener=(e,s,t,r,o,l)=>ee(c,M(l),t,r,[e,s],o),exports.useSetCellCallback=(e,s,t,r,o,l,u,n)=>se(l,b,r,o,u,n,e,s,t),exports.useSetCheckpointCallback=(e=m,s=X,t,r=m,o=X)=>{const l=E(t);return W((s=>h(l,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[l,...s,...o])},exports.useSetPartialRowCallback=(e,s,t,r,o,l,u)=>se(o,"PartialRow",t,r,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,r,o)=>se(t,"PartialValues",e,s,r,o),exports.useSetRowCallback=(e,s,t,r,o,l,u)=>se(o,c,t,r,l,u,e,s),exports.useSetTableCallback=(e,s,t,r,o,l)=>se(r,i,s,t,o,l,e),exports.useSetTablesCallback=(e,s,t,r,o)=>se(t,a,e,s,r,o),exports.useSetValueCallback=(e,s,t,r,o,l)=>se(r,R,s,t,o,l,e),exports.useSetValuesCallback=(e,s,t,r,o)=>se(t,k,e,s,r,o),exports.useSliceIds=ce,exports.useSliceIdsListener=(e,s,t,r)=>ee("SliceIds",F(r),s,t,[e]),exports.useSliceRowIds=xe,exports.useSliceRowIdsListener=(e,s,t,r,o)=>ee("Slice"+I,F(o),t,r,[e,s]),exports.useSortedRowIds=ue,exports.useSortedRowIdsListener=(e,s,t,r,o,l,u,n,d)=>ee(C,M(d),l,u,[e,s,t,r,o],n),exports.useStartTransactionListener=(e,s,t)=>ee("Start"+G,M(t),e,s),exports.useStore=e=>q(e,0),exports.useStoreIds=()=>H(1),exports.useStoreOrStoreById=M,exports.useTable=(e,s)=>_(i,M(s),Y,[e]),exports.useTableCellIds=(e,s)=>_(i+w,M(s),X,[e]),exports.useTableCellIdsListener=(e,s,t,r,o)=>ee(i+w,M(o),s,t,[e],r),exports.useTableIds=oe,exports.useTableIdsListener=(e,s,t,r)=>ee(p,M(r),e,s,X,t),exports.useTableListener=(e,s,t,r,o)=>ee(i,M(o),s,t,[e],r),exports.useTables=e=>_(a,M(e),Y),exports.useTablesListener=(e,s,t,r)=>ee(a,M(r),e,s,X,t),exports.useUndoInformation=e=>{var s;const r=E(e),[o,l]=ge(r);return[(u=o,!(0==u.length)),Le(r),l,null!=(s=h(l,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t];var u},exports.useValue=ae,exports.useValueIds=ie,exports.useValueIdsListener=(e,s,t,r)=>ee(v,M(r),e,s,X,t),exports.useValueListener=(e,s,t,r,o)=>ee(R,M(o),s,t,[e],r),exports.useValues=e=>_(k,M(e),Y),exports.useValuesListener=(e,s,t,r)=>ee(k,M(r),e,s,X,t),exports.useWillFinishTransactionListener=(e,s,t)=>ee("WillFinish"+G,M(t),e,s);
1
+ "use strict";var e=require("react");const s=e=>typeof e,t="",r=s(t),o=s(s),l="Listener",u="Result",n="Has",d="has",i="Ids",a="Table",p=a+"s",c=a+i,x="Row",I=x+"Count",C=x+i,b="Sorted"+x+i,w="Cell",R=w+i,k="Value",v=k+"s",g=k+i,h=e=>null==e,L=(e,s,t)=>h(e)?null==t?void 0:t():s(e),m=e=>s(e)==r,y=e=>s(e)==o,V=()=>{},S=(e,s)=>e.map(s),T=Object.keys,f=(e,s)=>L(e,(e=>e[s])),{createContext:P,useContext:O,useEffect:q}=e,B=P([]),H=(e,s)=>{var t;const r=O(B);return h(e)?r[s]:m(e)?f(null!=(t=r[s+1])?t:{},e):e},M=(e,s)=>{const t=H(e,s);return h(e)||m(e)?t:e},D=e=>{var s;return T(null!=(s=O(B)[e])?s:{})},F=e=>M(e,0),j=e=>M(e,2),Q=e=>M(e,4),E=e=>M(e,6),A=e=>M(e,8),G=e=>M(e,10),W=e=>e.toLowerCase();W(l);const U="Transaction";W(U);const{useCallback:z,useEffect:J,useMemo:K,useLayoutEffect:N,useRef:X,useState:Y}=e,Z=[],$={},_=[[],void 0,[]],ee=(e,s,t=Z)=>{const r=K((()=>s(e)),[e,...t]);return J((()=>()=>r.destroy()),[r]),r},se=(e,s,t,r=Z,o,l="get",u="")=>{const[,n]=Y(),d=z((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[l+e])?void 0:o.call(s,...r))?u:t}),[s,e,...r,t]),i=X();return K((()=>i.current=d()),[d]),te(u+e,s,((...e)=>{i.current=h(o)?d():e[o],n([])}),[d,o],r),i.current},te=(e,s,t,r=Z,o=Z,...u)=>N((()=>{var r;const n=null==(r=null==s?void 0:s["add"+e+l])?void 0:r.call(s,...o,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,e,...o,...r,...u]),re=(e,s,t,r=Z,o=V,l=Z,...u)=>{const n=F(e);return z((e=>L(n,(r=>L(t(e,r),(t=>o(r["set"+s](...S(u,(s=>y(s)?s(e,r):s)),t),t)))))),[n,s,...r,...l,...u])},oe=(e,s,t=V,r=Z,...o)=>{const l=F(e);return z((()=>t(null==l?void 0:l["del"+s](...o))),[l,s,...r,...o])},le=(e,s,t)=>{const r=G(e);return z((()=>null==r?void 0:r[s](t)),[r,s,t])},ue=e=>se(c,F(e),Z),ne=(e,s)=>se(C,F(s),Z,[e]),de=(e,s,t,r=0,o,l)=>se(b,F(l),Z,[e,s,t,r,o],6),ie=(e,s,t)=>se(R,F(t),Z,[e,s]),ae=(e,s,t,r)=>se(w,F(r),void 0,[e,s,t],4),pe=e=>se(g,F(e),Z),ce=(e,s)=>se(k,F(s),void 0,[e]),xe=(e,s)=>se("Metric",j(s),void 0,[e]),Ie=(e,s)=>se("SliceIds",Q(s),Z,[e]),Ce=(e,s,t)=>se("Slice"+C,Q(t),Z,[e,s]),be=(e,s,t)=>se("RemoteRowId",E(t),void 0,[e,s]),we=(e,s,t)=>se("Local"+C,E(t),Z,[e,s]),Re=(e,s,t)=>se("Linked"+C,E(t),Z,[e,s]),ke=(e,s)=>se(u+C,A(s),Z,[e]),ve=(e,s,t,r=0,o,l)=>se(u+b,A(l),Z,[e,s,t,r,o],6),ge=(e,s,t)=>se(u+R,A(t),Z,[e,s]),he=(e,s,t,r)=>se(u+w,A(r),void 0,[e,s,t]),Le=e=>se("CheckpointIds",G(e),_),me=(e,s)=>se("Checkpoint",G(s),void 0,[e]),ye=e=>le(e,"goBackward"),Ve=e=>le(e,"goForward"),{PureComponent:Se,Fragment:Te,createElement:fe,useCallback:Pe,useLayoutEffect:Oe,useRef:qe,useState:Be}=e,He=(e,...s)=>h(e)?{}:e(...s),Me=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var De=Object.defineProperty,Fe=Object.defineProperties,je=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Ge=(e,s,t)=>s in e?De(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,We=(e,s)=>{for(var t in s||(s={}))Ee.call(s,t)&&Ge(e,t,s[t]);if(Qe)for(var t of Qe(s))Ae.call(s,t)&&Ge(e,t,s[t]);return e},Ue=(e,s)=>Fe(e,je(s)),ze=(e,s)=>{var t={};for(var r in e)Ee.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&Qe)for(var r of Qe(e))s.indexOf(r)<0&&Ae.call(e,r)&&(t[r]=e[r]);return t};const{useCallback:Je,useContext:Ke,useMemo:Ne,useState:Xe}=e,Ye=({tableId:e,store:s,rowComponent:t=ts,getRowComponentProps:r,customCellIds:o,separator:l,debugIds:u},n)=>es(S(n,(l=>fe(t,Ue(We({},He(r,l)),{key:l,tableId:e,rowId:l,customCellIds:o,store:s,debugIds:u})))),l,u,e),Ze=({queryId:e,queries:s,resultRowComponent:t=ns,getResultRowComponentProps:r,separator:o,debugIds:l},u)=>es(S(u,(o=>fe(t,Ue(We({},He(r,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:l})))),o,l,e),$e=({relationshipId:e,relationships:s,rowComponent:t=ts,getRowComponentProps:r,separator:o,debugIds:l},u,n)=>{const[d,i,a]=Me(E(s),e),p=u(e,n,d);return es(S(p,(e=>fe(t,Ue(We({},He(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),o,l,n)},_e=e=>({checkpoints:s,checkpointComponent:t=ds,getCheckpointComponentProps:r,separator:o,debugIds:l})=>{const u=G(s);return es(S(e(Le(u)),(e=>fe(t,Ue(We({},He(r,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),o)},es=(e,s,t,r)=>{const o=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},ss=({tableId:e,rowId:s,cellId:r,store:o,debugIds:l})=>{var u;return es(t+(null!=(u=ae(e,s,r,o))?u:t),void 0,l,r)},ts=({tableId:e,rowId:s,store:t,cellComponent:r=ss,getCellComponentProps:o,customCellIds:l,separator:u,debugIds:n})=>es(S(((e,s,t,r)=>{const o=ie(s,t,r);return null!=e?e:o})(l,e,s,t),(l=>fe(r,Ue(We({},He(o,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),rs=e=>Ye(e,ne(e.tableId,e.store)),os=({valueId:e,store:s,debugIds:r})=>{var o;return es(t+(null!=(o=ce(e,s))?o:t),void 0,r,e)},ls=({indexId:e,sliceId:s,indexes:t,rowComponent:r=ts,getRowComponentProps:o,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(Q(t),e),a=Ce(e,s,n);return es(S(a,(e=>fe(r,Ue(We({},He(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},us=({queryId:e,rowId:s,cellId:r,queries:o,debugIds:l})=>{var u;return es(t+(null!=(u=he(e,s,r,o))?u:t),void 0,l,r)},ns=({queryId:e,rowId:s,queries:t,resultCellComponent:r=us,getResultCellComponentProps:o,separator:l,debugIds:u})=>es(S(ge(e,s,t),(l=>fe(r,Ue(We({},He(o,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),ds=({checkpoints:e,checkpointId:s,debugIds:r})=>{var o;return es(null!=(o=me(s,e))?o:t,void 0,r,s)},is=_e((e=>e[0])),as=_e((e=>h(e[1])?[]:[e[1]])),ps=_e((e=>e[2]));exports.BackwardCheckpointsView=is,exports.CellView=ss,exports.CheckpointView=ds,exports.CurrentCheckpointView=as,exports.ForwardCheckpointsView=ps,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=ls,getSliceComponentProps:r,separator:o,debugIds:l})=>es(S(Ie(e,s),(o=>fe(t,Ue(We({},He(r,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:l})))),o,l,e),exports.LinkedRowsView=e=>$e(e,Re,e.firstRowId),exports.LocalRowsView=e=>$e(e,we,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:r})=>{var o;return es(null!=(o=xe(e,s))?o:t,void 0,r,e)},exports.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:l,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:p,children:c})=>{const x=Ke(B),[I,C]=Xe({}),b=Je(((e,s)=>C((t=>f(t,e)==s?t:Ue(We({},t),{[e]:s})))),[]),w=Je((e=>C((s=>We({},((e,s)=>(delete e[s],e))(s,e))))),[]);return fe(B.Provider,{value:Ne((()=>[null!=e?e:x[0],We(We(We({},x[1]),s),I),null!=t?t:x[2],We(We({},x[3]),r),null!=o?o:x[4],We(We({},x[5]),l),null!=u?u:x[6],We(We({},x[7]),n),null!=d?d:x[8],We(We({},x[9]),i),null!=a?a:x[10],We(We({},x[11]),p),b,w]),[e,s,I,t,r,o,l,u,n,d,i,a,p,x,b,w])},c)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=ts,getRowComponentProps:o,debugIds:l})=>{const[u,n,,d]=Me(E(t),e),i=be(e,s,u);return es(h(d)||h(i)?null:fe(r,Ue(We({},He(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=us,exports.ResultRowView=ns,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ze(s,["cellId","descending","offset","limit"]);return Ze(u,ve(u.queryId,t,r,o,l,u.queries))},exports.ResultTableView=e=>Ze(e,ke(e.queryId,e.queries)),exports.RowView=ts,exports.SliceView=ls,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:r,offset:o,limit:l}=s,u=ze(s,["cellId","descending","offset","limit"]);return Ye(u,de(u.tableId,t,r,o,l,u.store))},exports.TableView=rs,exports.TablesView=({store:e,tableComponent:s=rs,getTableComponentProps:t,separator:r,debugIds:o})=>es(S(ue(e),(r=>fe(s,Ue(We({},He(t,r)),{key:r,tableId:r,store:e,debugIds:o})))),r),exports.ValueView=os,exports.ValuesView=({store:e,valueComponent:s=os,getValueComponentProps:t,separator:r,debugIds:o})=>es(S(pe(e),(r=>fe(s,Ue(We({},He(t,r)),{key:r,valueId:r,store:e,debugIds:o})))),r),exports.useAddRowCallback=(e,s,t=Z,r,o=V,l=Z,u=!0)=>{const n=F(r);return z((t=>L(n,(r=>L(s(t,r),(s=>o(r.addRow(y(e)?e(t,r):e,s,u),r,s)))))),[n,e,...t,...l,u])},exports.useCell=ae,exports.useCellIds=ie,exports.useCellIdsListener=(e,s,t,r,o,l)=>te(R,F(l),t,r,[e,s],o),exports.useCellListener=(e,s,t,r,o,l,u)=>te(w,F(u),r,o,[e,s,t],l),exports.useCheckpoint=me,exports.useCheckpointIds=Le,exports.useCheckpointIdsListener=(e,s,t)=>te("CheckpointIds",G(t),e,s),exports.useCheckpointListener=(e,s,t,r)=>te("Checkpoint",G(r),s,t,[e]),exports.useCheckpoints=e=>H(e,10),exports.useCheckpointsIds=()=>D(11),exports.useCheckpointsOrCheckpointsById=G,exports.useCreateCheckpoints=(e,s,t)=>ee(e,s,t),exports.useCreateIndexes=(e,s,t)=>ee(e,s,t),exports.useCreateMetrics=(e,s,t)=>ee(e,s,t),exports.useCreatePersister=(e,s,t=Z,r,o=Z,l,u=Z)=>{const[,n]=Y(),d=K((()=>s(e)),[e,...t]);return J((()=>{var e;return e=function*(){r&&(yield r(d),n([]))},new Promise(((s,t)=>{var r=s=>{try{l(e.next(s))}catch(e){t(e)}},o=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(r,o);l((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==l||l(d)}}),[d,...o,...u]),d},exports.useCreateQueries=(e,s,t)=>ee(e,s,t),exports.useCreateRelationships=(e,s,t)=>ee(e,s,t),exports.useCreateStore=(e,s=Z)=>K(e,s),exports.useDelCellCallback=(e,s,t,r,o,l,u)=>oe(o,w,l,u,e,s,t,r),exports.useDelRowCallback=(e,s,t,r,o)=>oe(t,x,r,o,e,s),exports.useDelTableCallback=(e,s,t,r)=>oe(s,a,t,r,e),exports.useDelTablesCallback=(e,s,t)=>oe(e,p,s,t),exports.useDelValueCallback=(e,s,t,r)=>oe(s,k,t,r,e),exports.useDelValuesCallback=(e,s,t)=>oe(e,v,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>te("DidFinish"+U,F(t),e,s),exports.useGoBackwardCallback=ye,exports.useGoForwardCallback=Ve,exports.useGoToCallback=(e,s=Z,t,r=V,o=Z)=>{const l=G(t);return z((s=>L(l,(t=>L(e(s),(e=>r(t.goTo(e),e)))))),[l,...s,...o])},exports.useHasCell=(e,s,t,r)=>se(w,F(r),!1,[e,s,t],4,d,n),exports.useHasCellListener=(e,s,t,r,o,l,u)=>te(n+w,F(u),r,o,[e,s,t],l),exports.useHasRow=(e,s,t)=>se(x,F(t),!1,[e,s],3,d,n),exports.useHasRowListener=(e,s,t,r,o,l)=>te(n+x,F(l),t,r,[e,s],o),exports.useHasTable=(e,s)=>se(a,F(s),!1,[e],2,d,n),exports.useHasTableCell=(e,s,t)=>se(a+w,F(t),!1,[e,s],3,d,n),exports.useHasTableCellListener=(e,s,t,r,o,l)=>te(n+a+w,F(l),t,r,[e,s],o),exports.useHasTableListener=(e,s,t,r,o)=>te(n+a,F(o),s,t,[e],r),exports.useHasTables=e=>se(p,F(e),!1,[],1,d,n),exports.useHasTablesListener=(e,s,t,r)=>te(n+p,F(r),e,s,[],t),exports.useHasValue=(e,s)=>se(k,F(s),!1,[e],2,d,n),exports.useHasValueListener=(e,s,t,r,o)=>te(n+k,F(o),s,t,[e],r),exports.useHasValues=e=>se(v,F(e),!1,[],1,d,n),exports.useHasValuesListener=(e,s,t,r)=>te(n+v,F(r),e,s,[],t),exports.useIndexIds=e=>se("IndexIds",Q(e),Z),exports.useIndexes=e=>H(e,4),exports.useIndexesIds=()=>D(5),exports.useIndexesOrIndexesById=Q,exports.useLinkedRowIds=Re,exports.useLinkedRowIdsListener=(e,s,t,r,o)=>te("Linked"+C,E(o),t,r,[e,s]),exports.useLocalRowIds=we,exports.useLocalRowIdsListener=(e,s,t,r,o)=>te("Local"+C,E(o),t,r,[e,s]),exports.useMetric=xe,exports.useMetricIds=e=>se("MetricIds",j(e),Z),exports.useMetricListener=(e,s,t,r)=>te("Metric",j(r),s,t,[e]),exports.useMetrics=e=>H(e,2),exports.useMetricsIds=()=>D(3),exports.useMetricsOrMetricsById=j,exports.useProvideStore=(e,s)=>{const{12:t,13:r}=O(B);q((()=>(null==t||t(e,s),()=>null==r?void 0:r(e))),[t,e,s,r])},exports.useQueries=e=>H(e,8),exports.useQueriesIds=()=>D(9),exports.useQueriesOrQueriesById=A,exports.useQueryIds=e=>se("QueryIds",A(e),Z),exports.useRedoInformation=e=>{var s;const r=G(e),[,,[o]]=Le(r);return[!h(o),Ve(r),o,null!=(s=L(o,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>se("RelationshipIds",E(e),Z),exports.useRelationships=e=>H(e,6),exports.useRelationshipsIds=()=>D(7),exports.useRelationshipsOrRelationshipsById=E,exports.useRemoteRowId=be,exports.useRemoteRowIdListener=(e,s,t,r,o)=>te("RemoteRowId",E(o),t,r,[e,s]),exports.useResultCell=he,exports.useResultCellIds=ge,exports.useResultCellIdsListener=(e,s,t,r,o)=>te(u+R,A(o),t,r,[e,s]),exports.useResultCellListener=(e,s,t,r,o,l)=>te(u+w,A(l),r,o,[e,s,t]),exports.useResultRow=(e,s,t)=>se(u+x,A(t),$,[e,s]),exports.useResultRowCount=(e,s)=>se(u+I,A(s),0,[e]),exports.useResultRowCountListener=(e,s,t,r)=>te(u+I,A(r),s,t,[e]),exports.useResultRowIds=ke,exports.useResultRowIdsListener=(e,s,t,r)=>te(u+C,A(r),s,t,[e]),exports.useResultRowListener=(e,s,t,r,o)=>te(u+x,A(o),t,r,[e,s]),exports.useResultSortedRowIds=ve,exports.useResultSortedRowIdsListener=(e,s,t,r,o,l,n,d)=>te(u+b,A(d),l,n,[e,s,t,r,o]),exports.useResultTable=(e,s)=>se(u+a,A(s),$,[e]),exports.useResultTableCellIds=(e,s)=>se(u+a+R,A(s),Z,[e]),exports.useResultTableCellIdsListener=(e,s,t,r)=>te(u+a+R,A(r),s,t,[e]),exports.useResultTableListener=(e,s,t,r)=>te(u+a,A(r),s,t,[e]),exports.useRow=(e,s,t)=>se(x,F(t),$,[e,s]),exports.useRowCount=(e,s)=>se(I,F(s),0,[e]),exports.useRowCountListener=(e,s,t,r,o)=>te(I,F(o),s,t,[e],r),exports.useRowIds=ne,exports.useRowIdsListener=(e,s,t,r,o)=>te(C,F(o),s,t,[e],r),exports.useRowListener=(e,s,t,r,o,l)=>te(x,F(l),t,r,[e,s],o),exports.useSetCellCallback=(e,s,t,r,o,l,u,n)=>re(l,w,r,o,u,n,e,s,t),exports.useSetCheckpointCallback=(e=V,s=Z,t,r=V,o=Z)=>{const l=G(t);return z((s=>L(l,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[l,...s,...o])},exports.useSetPartialRowCallback=(e,s,t,r,o,l,u)=>re(o,"PartialRow",t,r,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,r,o)=>re(t,"PartialValues",e,s,r,o),exports.useSetRowCallback=(e,s,t,r,o,l,u)=>re(o,x,t,r,l,u,e,s),exports.useSetTableCallback=(e,s,t,r,o,l)=>re(r,a,s,t,o,l,e),exports.useSetTablesCallback=(e,s,t,r,o)=>re(t,p,e,s,r,o),exports.useSetValueCallback=(e,s,t,r,o,l)=>re(r,k,s,t,o,l,e),exports.useSetValuesCallback=(e,s,t,r,o)=>re(t,v,e,s,r,o),exports.useSliceIds=Ie,exports.useSliceIdsListener=(e,s,t,r)=>te("SliceIds",Q(r),s,t,[e]),exports.useSliceRowIds=Ce,exports.useSliceRowIdsListener=(e,s,t,r,o)=>te("Slice"+C,Q(o),t,r,[e,s]),exports.useSortedRowIds=de,exports.useSortedRowIdsListener=(e,s,t,r,o,l,u,n,d)=>te(b,F(d),l,u,[e,s,t,r,o],n),exports.useStartTransactionListener=(e,s,t)=>te("Start"+U,F(t),e,s),exports.useStore=e=>H(e,0),exports.useStoreIds=()=>D(1),exports.useStoreOrStoreById=F,exports.useTable=(e,s)=>se(a,F(s),$,[e]),exports.useTableCellIds=(e,s)=>se(a+R,F(s),Z,[e]),exports.useTableCellIdsListener=(e,s,t,r,o)=>te(a+R,F(o),s,t,[e],r),exports.useTableIds=ue,exports.useTableIdsListener=(e,s,t,r)=>te(c,F(r),e,s,Z,t),exports.useTableListener=(e,s,t,r,o)=>te(a,F(o),s,t,[e],r),exports.useTables=e=>se(p,F(e),$),exports.useTablesListener=(e,s,t,r)=>te(p,F(r),e,s,Z,t),exports.useUndoInformation=e=>{var s;const r=G(e),[o,l]=Le(r);return[(u=o,!(0==u.length)),ye(r),l,null!=(s=L(l,(e=>null==r?void 0:r.getCheckpoint(e))))?s:t];var u},exports.useValue=ce,exports.useValueIds=pe,exports.useValueIdsListener=(e,s,t,r)=>te(g,F(r),e,s,Z,t),exports.useValueListener=(e,s,t,r,o)=>te(k,F(o),s,t,[e],r),exports.useValues=e=>se(v,F(e),$),exports.useValuesListener=(e,s,t,r)=>te(v,F(r),e,s,Z,t),exports.useWillFinishTransactionListener=(e,s,t)=>te("WillFinish"+U,F(t),e,s);
Binary file
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  const getTypeOf = (thing) => typeof thing;
4
4
  const EMPTY_STRING = '';
5
5
  const STRING = getTypeOf(EMPTY_STRING);
6
+ const FUNCTION = getTypeOf(getTypeOf);
6
7
  const LISTENER = 'Listener';
7
8
  const RESULT = 'Result';
8
9
  const GET = 'get';
@@ -27,6 +28,7 @@ const isUndefined = (thing) => thing == void 0;
27
28
  const ifNotUndefined = (value, then, otherwise) =>
28
29
  isUndefined(value) ? otherwise?.() : then(value);
29
30
  const isString = (thing) => getTypeOf(thing) == STRING;
31
+ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
30
32
  const isArray = (thing) => Array.isArray(thing);
31
33
  const size = (arrayOrString) => arrayOrString.length;
32
34
  const getUndefined = () => void 0;
@@ -171,7 +173,15 @@ const useSetCallback = (
171
173
  (parameter) =>
172
174
  ifNotUndefined(store, (store2) =>
173
175
  ifNotUndefined(get(parameter, store2), (thing) =>
174
- then(store2['set' + settable](...args, thing), thing),
176
+ then(
177
+ store2['set' + settable](
178
+ ...arrayMap(args, (arg) =>
179
+ isFunction(arg) ? arg(parameter, store2) : arg,
180
+ ),
181
+ thing,
182
+ ),
183
+ thing,
184
+ ),
175
185
  ),
176
186
  ),
177
187
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -400,7 +410,15 @@ const useAddRowCallback = (
400
410
  (parameter) =>
401
411
  ifNotUndefined(store, (store2) =>
402
412
  ifNotUndefined(getRow(parameter, store2), (row) =>
403
- then(store2.addRow(tableId, row, reuseRowIds), store2, row),
413
+ then(
414
+ store2.addRow(
415
+ isFunction(tableId) ? tableId(parameter, store2) : tableId,
416
+ row,
417
+ reuseRowIds,
418
+ ),
419
+ store2,
420
+ row,
421
+ ),
404
422
  ),
405
423
  ),
406
424
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",r=t(o),n="Listener",l="Result",d="Has",s="has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",m=g+u,C="Value",y=C+"s",w=C+u,f=e=>null==e,k=(e,t,o)=>f(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,R=()=>{},P=(e,t)=>e.map(t),x=Object.keys,q=(e,t)=>k(e,(e=>e[t])),{createContext:S,useContext:O,useEffect:L}=e,j=S([]),B=(e,t)=>{var o;const r=O(j);return f(e)?r[t]:h(e)?q(null!=(o=r[t+1])?o:{},e):e},T=(e,t)=>{const o=B(e,t);return f(e)||h(e)?o:e},E=e=>{var t;return x(null!=(t=O(j)[e])?t:{})},M=e=>B(e,0),F=e=>T(e,0),V=(e,t)=>{const{12:o,13:r}=O(j);L((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},A=e=>B(e,2),D=e=>T(e,2),H=e=>B(e,4),Q=e=>T(e,4),W=e=>B(e,6),z=e=>T(e,6),G=e=>B(e,8),J=e=>T(e,8),K=e=>B(e,10),N=e=>T(e,10),U=e=>e.toLowerCase();U(n);const X="Transaction";U(X);const{useCallback:Y,useEffect:Z,useMemo:$,useLayoutEffect:_,useRef:ee,useState:te}=e,oe=[],re={},ne=[[],void 0,[]],le=(e,t,o=oe)=>{const r=$((()=>t(e)),[e,...o]);return Z((()=>()=>r.destroy()),[r]),r},de=(e,t,o,r=oe,n,l="get",d="")=>{const[,s]=te(),u=Y((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t[l+e])?void 0:n.call(t,...r))?d:o}),[t,e,...r,o]),i=ee();return $((()=>i.current=u()),[u]),se(d+e,t,((...e)=>{i.current=f(n)?u():e[n],s([])}),[u,n],r),i.current},se=(e,t,o,r=oe,l=oe,...d)=>_((()=>{var r;const s=null==(r=null==t?void 0:t["add"+e+n])?void 0:r.call(t,...l,o,...d);return()=>null==t?void 0:t.delListener(s)}),[t,e,...l,...r,...d]),ue=(e,t,o,r=oe,n=R,l=oe,...d)=>{const s=F(e);return Y((e=>k(s,(r=>k(o(e,r),(e=>n(r["set"+t](...d,e),e)))))),[s,t,...r,...l,...d])},ie=(e,t,o=R,r=oe,...n)=>{const l=F(e);return Y((()=>o(null==l?void 0:l["del"+t](...n))),[l,t,...r,...n])},ae=(e,t,o)=>{const r=N(e);return Y((()=>null==r?void 0:r[t](o)),[r,t,o])},ce=(e,t=oe)=>$(e,t),Ie=()=>E(1),pe=e=>de(a,F(e),!1,[],1,s,d),ve=e=>de(a,F(e),re),be=e=>de(c,F(e),oe),ge=(e,t)=>de(i,F(t),!1,[e],2,s,d),me=(e,t)=>de(i,F(t),re,[e]),Ce=(e,t)=>de(i+m,F(t),oe,[e]),ye=(e,t,o)=>de(i+g,F(o),!1,[e,t],3,s,d),we=(e,t)=>de(p,F(t),0,[e]),fe=(e,t)=>de(v,F(t),oe,[e]),ke=(e,t,o,r=0,n,l)=>de(b,F(l),oe,[e,t,o,r,n],6),he=(e,t,o)=>de(I,F(o),!1,[e,t],3,s,d),Re=(e,t,o)=>de(I,F(o),re,[e,t]),Pe=(e,t,o)=>de(m,F(o),oe,[e,t]),xe=(e,t,o,r)=>de(g,F(r),!1,[e,t,o],4,s,d),qe=(e,t,o,r)=>de(g,F(r),void 0,[e,t,o],4),Se=e=>de(y,F(e),!1,[],1,s,d),Oe=e=>de(y,F(e),re),Le=e=>de(w,F(e),oe),je=(e,t)=>de(C,F(t),!1,[e],2,s,d),Be=(e,t)=>de(C,F(t),void 0,[e]),Te=(e,t,o,r,n)=>ue(o,a,e,t,r,n),Ee=(e,t,o,r,n,l)=>ue(r,i,t,o,n,l,e),Me=(e,t,o,r,n,l,d)=>ue(n,I,o,r,l,d,e,t),Fe=(e,t,o=oe,r,n=R,l=oe,d=!0)=>{const s=F(r);return Y((o=>k(s,(r=>k(t(o,r),(t=>n(r.addRow(e,t,d),r,t)))))),[s,e,...o,...l,d])},Ve=(e,t,o,r,n,l,d)=>ue(n,"PartialRow",o,r,l,d,e,t),Ae=(e,t,o,r,n,l,d,s)=>ue(l,g,r,n,d,s,e,t,o),De=(e,t,o,r,n)=>ue(o,y,e,t,r,n),He=(e,t,o,r,n)=>ue(o,"PartialValues",e,t,r,n),Qe=(e,t,o,r,n,l)=>ue(r,C,t,o,n,l,e),We=(e,t,o)=>ie(e,a,t,o),ze=(e,t,o,r)=>ie(t,i,o,r,e),Ge=(e,t,o,r,n)=>ie(o,I,r,n,e,t),Je=(e,t,o,r,n,l,d)=>ie(n,g,l,d,e,t,o,r),Ke=(e,t,o)=>ie(e,y,t,o),Ne=(e,t,o,r)=>ie(t,C,o,r,e),Ue=(e,t,o,r)=>se(d+a,F(r),e,t,[],o),Xe=(e,t,o,r)=>se(a,F(r),e,t,oe,o),Ye=(e,t,o,r)=>se(c,F(r),e,t,oe,o),Ze=(e,t,o,r,n)=>se(d+i,F(n),t,o,[e],r),$e=(e,t,o,r,n)=>se(i,F(n),t,o,[e],r),_e=(e,t,o,r,n)=>se(i+m,F(n),t,o,[e],r),et=(e,t,o,r,n,l)=>se(d+i+g,F(l),o,r,[e,t],n),tt=(e,t,o,r,n)=>se(p,F(n),t,o,[e],r),ot=(e,t,o,r,n)=>se(v,F(n),t,o,[e],r),rt=(e,t,o,r,n,l,d,s,u)=>se(b,F(u),l,d,[e,t,o,r,n],s),nt=(e,t,o,r,n,l)=>se(d+I,F(l),o,r,[e,t],n),lt=(e,t,o,r,n,l)=>se(I,F(l),o,r,[e,t],n),dt=(e,t,o,r,n,l)=>se(m,F(l),o,r,[e,t],n),st=(e,t,o,r,n,l,s)=>se(d+g,F(s),r,n,[e,t,o],l),ut=(e,t,o,r,n,l,d)=>se(g,F(d),r,n,[e,t,o],l),it=(e,t,o,r)=>se(d+y,F(r),e,t,[],o),at=(e,t,o,r)=>se(y,F(r),e,t,oe,o),ct=(e,t,o,r)=>se(w,F(r),e,t,oe,o),It=(e,t,o,r,n)=>se(d+C,F(n),t,o,[e],r),pt=(e,t,o,r,n)=>se(C,F(n),t,o,[e],r),vt=(e,t,o)=>se("Start"+X,F(o),e,t),bt=(e,t,o)=>se("WillFinish"+X,F(o),e,t),gt=(e,t,o)=>se("DidFinish"+X,F(o),e,t),mt=(e,t,o)=>le(e,t,o),Ct=()=>E(3),yt=e=>de("MetricIds",D(e),oe),wt=(e,t)=>de("Metric",D(t),void 0,[e]),ft=(e,t,o,r)=>se("Metric",D(r),t,o,[e]),kt=(e,t,o)=>le(e,t,o),ht=()=>E(5),Rt=(e,t)=>de("SliceIds",Q(t),oe,[e]),Pt=e=>de("IndexIds",Q(e),oe),xt=(e,t,o)=>de("Slice"+v,Q(o),oe,[e,t]),qt=(e,t,o,r)=>se("SliceIds",Q(r),t,o,[e]),St=(e,t,o,r,n)=>se("Slice"+v,Q(n),o,r,[e,t]),Ot=(e,t,o)=>le(e,t,o),Lt=()=>E(7),jt=e=>de("RelationshipIds",z(e),oe),Bt=(e,t,o)=>de("RemoteRowId",z(o),void 0,[e,t]),Tt=(e,t,o)=>de("Local"+v,z(o),oe,[e,t]),Et=(e,t,o)=>de("Linked"+v,z(o),oe,[e,t]),Mt=(e,t,o,r,n)=>se("RemoteRowId",z(n),o,r,[e,t]),Ft=(e,t,o,r,n)=>se("Local"+v,z(n),o,r,[e,t]),Vt=(e,t,o,r,n)=>se("Linked"+v,z(n),o,r,[e,t]),At=(e,t,o)=>le(e,t,o),Dt=()=>E(9),Ht=e=>de("QueryIds",J(e),oe),Qt=(e,t)=>de(l+i,J(t),re,[e]),Wt=(e,t)=>de(l+i+m,J(t),oe,[e]),zt=(e,t)=>de(l+p,J(t),0,[e]),Gt=(e,t)=>de(l+v,J(t),oe,[e]),Jt=(e,t,o,r=0,n,d)=>de(l+b,J(d),oe,[e,t,o,r,n],6),Kt=(e,t,o)=>de(l+I,J(o),re,[e,t]),Nt=(e,t,o)=>de(l+m,J(o),oe,[e,t]),Ut=(e,t,o,r)=>de(l+g,J(r),void 0,[e,t,o]),Xt=(e,t,o,r)=>se(l+i,J(r),t,o,[e]),Yt=(e,t,o,r)=>se(l+i+m,J(r),t,o,[e]),Zt=(e,t,o,r)=>se(l+p,J(r),t,o,[e]),$t=(e,t,o,r)=>se(l+v,J(r),t,o,[e]),_t=(e,t,o,r,n,d,s,u)=>se(l+b,J(u),d,s,[e,t,o,r,n]),eo=(e,t,o,r,n)=>se(l+I,J(n),o,r,[e,t]),to=(e,t,o,r,n)=>se(l+m,J(n),o,r,[e,t]),oo=(e,t,o,r,n,d)=>se(l+g,J(d),r,n,[e,t,o]),ro=(e,t,o)=>le(e,t,o),no=()=>E(11),lo=e=>de("CheckpointIds",N(e),ne),so=(e,t)=>de("Checkpoint",N(t),void 0,[e]),uo=(e=R,t=oe,o,r=R,n=oe)=>{const l=N(o);return Y((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},io=e=>ae(e,"goBackward"),ao=e=>ae(e,"goForward"),co=(e,t=oe,o,r=R,n=oe)=>{const l=N(o);return Y((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},Io=e=>{var t;const r=N(e),[n,l]=lo(r);return[(d=n,!(0==d.length)),io(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var d},po=e=>{var t;const r=N(e),[,,[n]]=lo(r);return[!f(n),ao(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},vo=(e,t,o)=>se("CheckpointIds",N(o),e,t),bo=(e,t,o,r)=>se("Checkpoint",N(r),t,o,[e]),go=(e,t,o=oe,r,n=oe,l,d=oe)=>{const[,s]=te(),u=$((()=>t(e)),[e,...o]);return Z((()=>{var e;return e=function*(){r&&(yield r(u),s([]))},new Promise(((t,o)=>{var r=t=>{try{l(e.next(t))}catch(e){o(e)}},n=t=>{try{l(e.throw(t))}catch(e){o(e)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);l((e=e.apply(void 0,null)).next())})),()=>{null==u||u.destroy(),null==l||l(u)}}),[u,...n,...d]),u},{PureComponent:mo,Fragment:Co,createElement:yo,useCallback:wo,useLayoutEffect:fo,useRef:ko,useState:ho}=e,Ro=(e,...t)=>f(e)?{}:e(...t),Po=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var xo=Object.defineProperty,qo=Object.defineProperties,So=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Lo=Object.prototype.hasOwnProperty,jo=Object.prototype.propertyIsEnumerable,Bo=(e,t,o)=>t in e?xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,To=(e,t)=>{for(var o in t||(t={}))Lo.call(t,o)&&Bo(e,o,t[o]);if(Oo)for(var o of Oo(t))jo.call(t,o)&&Bo(e,o,t[o]);return e},Eo=(e,t)=>qo(e,So(t)),Mo=(e,t)=>{var o={};for(var r in e)Lo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Oo)for(var r of Oo(e))t.indexOf(r)<0&&jo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:Fo,useContext:Vo,useMemo:Ao,useState:Do}=e,Ho=({tableId:e,store:t,rowComponent:o=No,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:d},s)=>Jo(P(s,(l=>yo(o,Eo(To({},Ro(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:d})))),l,d,e),Qo=({queryId:e,queries:t,resultRowComponent:o=dr,getResultRowComponentProps:r,separator:n,debugIds:l},d)=>Jo(P(d,(n=>yo(o,Eo(To({},Ro(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),Wo=({relationshipId:e,relationships:t,rowComponent:o=No,getRowComponentProps:r,separator:n,debugIds:l},d,s)=>{const[u,i,a]=Po(z(t),e),c=d(e,s,u);return Jo(P(c,(e=>yo(o,Eo(To({},Ro(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,s)},zo=e=>({checkpoints:t,checkpointComponent:o=ir,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const d=N(t);return Jo(P(e(lo(d)),(e=>yo(o,Eo(To({},Ro(r,e)),{key:e,checkpoints:d,checkpointId:e,debugIds:l})))),n)},Go=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:d,relationshipsById:s,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=Vo(j),[v,b]=Do({}),g=Fo(((e,t)=>b((o=>q(o,e)==t?o:Eo(To({},o),{[e]:t})))),[]),m=Fo((e=>b((t=>To({},((e,t)=>(delete e[t],e))(t,e))))),[]);return yo(j.Provider,{value:Ao((()=>[null!=e?e:p[0],To(To(To({},p[1]),t),v),null!=o?o:p[2],To(To({},p[3]),r),null!=n?n:p[4],To(To({},p[5]),l),null!=d?d:p[6],To(To({},p[7]),s),null!=u?u:p[8],To(To({},p[9]),i),null!=a?a:p[10],To(To({},p[11]),c),g,m]),[e,t,v,o,r,n,l,d,s,u,i,a,c,p,g,m])},I)},Jo=(e,t,o,r)=>{const n=f(t)||!Array.isArray(e)?e:P(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},Ko=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var d;return Jo(o+(null!=(d=qe(e,t,r,n))?d:o),void 0,l,r)},No=({tableId:e,rowId:t,store:o,cellComponent:r=Ko,getCellComponentProps:n,customCellIds:l,separator:d,debugIds:s})=>Jo(P(((e,t,o,r)=>{const n=Pe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>yo(r,Eo(To({},Ro(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:s})))),d,s,t),Uo=e=>Ho(e,fe(e.tableId,e.store)),Xo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,d=Mo(t,["cellId","descending","offset","limit"]);return Ho(d,ke(d.tableId,o,r,n,l,d.store))},Yo=({store:e,tableComponent:t=Uo,getTableComponentProps:o,separator:r,debugIds:n})=>Jo(P(be(e),(r=>yo(t,Eo(To({},Ro(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),Zo=({valueId:e,store:t,debugIds:r})=>{var n;return Jo(o+(null!=(n=Be(e,t))?n:o),void 0,r,e)},$o=({store:e,valueComponent:t=Zo,getValueComponentProps:o,separator:r,debugIds:n})=>Jo(P(Le(e),(r=>yo(t,Eo(To({},Ro(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),_o=({metricId:e,metrics:t,debugIds:r})=>{var n;return Jo(null!=(n=wt(e,t))?n:o,void 0,r,e)},er=({indexId:e,sliceId:t,indexes:o,rowComponent:r=No,getRowComponentProps:n,separator:l,debugIds:d})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Q(o),e),a=xt(e,t,s);return Jo(P(a,(e=>yo(r,Eo(To({},Ro(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:d})))),l,d,t)},tr=({indexId:e,indexes:t,sliceComponent:o=er,getSliceComponentProps:r,separator:n,debugIds:l})=>Jo(P(Rt(e,t),(n=>yo(o,Eo(To({},Ro(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),or=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=No,getRowComponentProps:n,debugIds:l})=>{const[d,s,,u]=Po(z(o),e),i=Bt(e,t,d);return Jo(f(u)||f(i)?null:yo(r,Eo(To({},Ro(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:l})),void 0,l,t)},rr=e=>Wo(e,Tt,e.remoteRowId),nr=e=>Wo(e,Et,e.firstRowId),lr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var d;return Jo(o+(null!=(d=Ut(e,t,r,n))?d:o),void 0,l,r)},dr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=lr,getResultCellComponentProps:n,separator:l,debugIds:d})=>Jo(P(Nt(e,t,o),(l=>yo(r,Eo(To({},Ro(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:d})))),l,d,t),sr=e=>Qo(e,Gt(e.queryId,e.queries)),ur=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,d=Mo(t,["cellId","descending","offset","limit"]);return Qo(d,Jt(d.queryId,o,r,n,l,d.queries))},ir=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return Jo(null!=(n=so(t,e))?n:o,void 0,r,t)},ar=zo((e=>e[0])),cr=zo((e=>f(e[1])?[]:[e[1]])),Ir=zo((e=>e[2]));export{ar as BackwardCheckpointsView,Ko as CellView,ir as CheckpointView,cr as CurrentCheckpointView,Ir as ForwardCheckpointsView,tr as IndexView,nr as LinkedRowsView,rr as LocalRowsView,_o as MetricView,Go as Provider,or as RemoteRowView,lr as ResultCellView,dr as ResultRowView,ur as ResultSortedTableView,sr as ResultTableView,No as RowView,er as SliceView,Xo as SortedTableView,Uo as TableView,Yo as TablesView,Zo as ValueView,$o as ValuesView,Fe as useAddRowCallback,qe as useCell,Pe as useCellIds,dt as useCellIdsListener,ut as useCellListener,so as useCheckpoint,lo as useCheckpointIds,vo as useCheckpointIdsListener,bo as useCheckpointListener,K as useCheckpoints,no as useCheckpointsIds,N as useCheckpointsOrCheckpointsById,ro as useCreateCheckpoints,kt as useCreateIndexes,mt as useCreateMetrics,go as useCreatePersister,At as useCreateQueries,Ot as useCreateRelationships,ce as useCreateStore,Je as useDelCellCallback,Ge as useDelRowCallback,ze as useDelTableCallback,We as useDelTablesCallback,Ne as useDelValueCallback,Ke as useDelValuesCallback,gt as useDidFinishTransactionListener,io as useGoBackwardCallback,ao as useGoForwardCallback,co as useGoToCallback,xe as useHasCell,st as useHasCellListener,he as useHasRow,nt as useHasRowListener,ge as useHasTable,ye as useHasTableCell,et as useHasTableCellListener,Ze as useHasTableListener,pe as useHasTables,Ue as useHasTablesListener,je as useHasValue,It as useHasValueListener,Se as useHasValues,it as useHasValuesListener,Pt as useIndexIds,H as useIndexes,ht as useIndexesIds,Q as useIndexesOrIndexesById,Et as useLinkedRowIds,Vt as useLinkedRowIdsListener,Tt as useLocalRowIds,Ft as useLocalRowIdsListener,wt as useMetric,yt as useMetricIds,ft as useMetricListener,A as useMetrics,Ct as useMetricsIds,D as useMetricsOrMetricsById,V as useProvideStore,G as useQueries,Dt as useQueriesIds,J as useQueriesOrQueriesById,Ht as useQueryIds,po as useRedoInformation,jt as useRelationshipIds,W as useRelationships,Lt as useRelationshipsIds,z as useRelationshipsOrRelationshipsById,Bt as useRemoteRowId,Mt as useRemoteRowIdListener,Ut as useResultCell,Nt as useResultCellIds,to as useResultCellIdsListener,oo as useResultCellListener,Kt as useResultRow,zt as useResultRowCount,Zt as useResultRowCountListener,Gt as useResultRowIds,$t as useResultRowIdsListener,eo as useResultRowListener,Jt as useResultSortedRowIds,_t as useResultSortedRowIdsListener,Qt as useResultTable,Wt as useResultTableCellIds,Yt as useResultTableCellIdsListener,Xt as useResultTableListener,Re as useRow,we as useRowCount,tt as useRowCountListener,fe as useRowIds,ot as useRowIdsListener,lt as useRowListener,Ae as useSetCellCallback,uo as useSetCheckpointCallback,Ve as useSetPartialRowCallback,He as useSetPartialValuesCallback,Me as useSetRowCallback,Ee as useSetTableCallback,Te as useSetTablesCallback,Qe as useSetValueCallback,De as useSetValuesCallback,Rt as useSliceIds,qt as useSliceIdsListener,xt as useSliceRowIds,St as useSliceRowIdsListener,ke as useSortedRowIds,rt as useSortedRowIdsListener,vt as useStartTransactionListener,M as useStore,Ie as useStoreIds,F as useStoreOrStoreById,me as useTable,Ce as useTableCellIds,_e as useTableCellIdsListener,be as useTableIds,Ye as useTableIdsListener,$e as useTableListener,ve as useTables,Xe as useTablesListener,Io as useUndoInformation,Be as useValue,Le as useValueIds,ct as useValueIdsListener,pt as useValueListener,Oe as useValues,at as useValuesListener,bt as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",d="Result",s="Has",u="has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",v=p+"Count",b=p+i,g="Sorted"+p+i,m="Cell",C=m+i,y="Value",w=y+"s",f=y+i,k=e=>null==e,h=(e,t,o)=>k(e)?null==o?void 0:o():t(e),R=e=>t(e)==r,P=e=>t(e)==n,x=()=>{},q=(e,t)=>e.map(t),S=Object.keys,O=(e,t)=>h(e,(e=>e[t])),{createContext:L,useContext:j,useEffect:B}=e,T=L([]),E=(e,t)=>{var o;const r=j(T);return k(e)?r[t]:R(e)?O(null!=(o=r[t+1])?o:{},e):e},M=(e,t)=>{const o=E(e,t);return k(e)||R(e)?o:e},F=e=>{var t;return S(null!=(t=j(T)[e])?t:{})},V=e=>E(e,0),A=e=>M(e,0),D=(e,t)=>{const{12:o,13:r}=j(T);B((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},H=e=>E(e,2),Q=e=>M(e,2),W=e=>E(e,4),z=e=>M(e,4),G=e=>E(e,6),J=e=>M(e,6),K=e=>E(e,8),N=e=>M(e,8),U=e=>E(e,10),X=e=>M(e,10),Y=e=>e.toLowerCase();Y(l);const Z="Transaction";Y(Z);const{useCallback:$,useEffect:_,useMemo:ee,useLayoutEffect:te,useRef:oe,useState:re}=e,ne=[],le={},de=[[],void 0,[]],se=(e,t,o=ne)=>{const r=ee((()=>t(e)),[e,...o]);return _((()=>()=>r.destroy()),[r]),r},ue=(e,t,o,r=ne,n,l="get",d="")=>{const[,s]=re(),u=$((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t[l+e])?void 0:n.call(t,...r))?d:o}),[t,e,...r,o]),i=oe();return ee((()=>i.current=u()),[u]),ie(d+e,t,((...e)=>{i.current=k(n)?u():e[n],s([])}),[u,n],r),i.current},ie=(e,t,o,r=ne,n=ne,...d)=>te((()=>{var r;const s=null==(r=null==t?void 0:t["add"+e+l])?void 0:r.call(t,...n,o,...d);return()=>null==t?void 0:t.delListener(s)}),[t,e,...n,...r,...d]),ae=(e,t,o,r=ne,n=x,l=ne,...d)=>{const s=A(e);return $((e=>h(s,(r=>h(o(e,r),(o=>n(r["set"+t](...q(d,(t=>P(t)?t(e,r):t)),o),o)))))),[s,t,...r,...l,...d])},ce=(e,t,o=x,r=ne,...n)=>{const l=A(e);return $((()=>o(null==l?void 0:l["del"+t](...n))),[l,t,...r,...n])},Ie=(e,t,o)=>{const r=X(e);return $((()=>null==r?void 0:r[t](o)),[r,t,o])},pe=(e,t=ne)=>ee(e,t),ve=()=>F(1),be=e=>ue(c,A(e),!1,[],1,u,s),ge=e=>ue(c,A(e),le),me=e=>ue(I,A(e),ne),Ce=(e,t)=>ue(a,A(t),!1,[e],2,u,s),ye=(e,t)=>ue(a,A(t),le,[e]),we=(e,t)=>ue(a+C,A(t),ne,[e]),fe=(e,t,o)=>ue(a+m,A(o),!1,[e,t],3,u,s),ke=(e,t)=>ue(v,A(t),0,[e]),he=(e,t)=>ue(b,A(t),ne,[e]),Re=(e,t,o,r=0,n,l)=>ue(g,A(l),ne,[e,t,o,r,n],6),Pe=(e,t,o)=>ue(p,A(o),!1,[e,t],3,u,s),xe=(e,t,o)=>ue(p,A(o),le,[e,t]),qe=(e,t,o)=>ue(C,A(o),ne,[e,t]),Se=(e,t,o,r)=>ue(m,A(r),!1,[e,t,o],4,u,s),Oe=(e,t,o,r)=>ue(m,A(r),void 0,[e,t,o],4),Le=e=>ue(w,A(e),!1,[],1,u,s),je=e=>ue(w,A(e),le),Be=e=>ue(f,A(e),ne),Te=(e,t)=>ue(y,A(t),!1,[e],2,u,s),Ee=(e,t)=>ue(y,A(t),void 0,[e]),Me=(e,t,o,r,n)=>ae(o,c,e,t,r,n),Fe=(e,t,o,r,n,l)=>ae(r,a,t,o,n,l,e),Ve=(e,t,o,r,n,l,d)=>ae(n,p,o,r,l,d,e,t),Ae=(e,t,o=ne,r,n=x,l=ne,d=!0)=>{const s=A(r);return $((o=>h(s,(r=>h(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,d),r,t)))))),[s,e,...o,...l,d])},De=(e,t,o,r,n,l,d)=>ae(n,"PartialRow",o,r,l,d,e,t),He=(e,t,o,r,n,l,d,s)=>ae(l,m,r,n,d,s,e,t,o),Qe=(e,t,o,r,n)=>ae(o,w,e,t,r,n),We=(e,t,o,r,n)=>ae(o,"PartialValues",e,t,r,n),ze=(e,t,o,r,n,l)=>ae(r,y,t,o,n,l,e),Ge=(e,t,o)=>ce(e,c,t,o),Je=(e,t,o,r)=>ce(t,a,o,r,e),Ke=(e,t,o,r,n)=>ce(o,p,r,n,e,t),Ne=(e,t,o,r,n,l,d)=>ce(n,m,l,d,e,t,o,r),Ue=(e,t,o)=>ce(e,w,t,o),Xe=(e,t,o,r)=>ce(t,y,o,r,e),Ye=(e,t,o,r)=>ie(s+c,A(r),e,t,[],o),Ze=(e,t,o,r)=>ie(c,A(r),e,t,ne,o),$e=(e,t,o,r)=>ie(I,A(r),e,t,ne,o),_e=(e,t,o,r,n)=>ie(s+a,A(n),t,o,[e],r),et=(e,t,o,r,n)=>ie(a,A(n),t,o,[e],r),tt=(e,t,o,r,n)=>ie(a+C,A(n),t,o,[e],r),ot=(e,t,o,r,n,l)=>ie(s+a+m,A(l),o,r,[e,t],n),rt=(e,t,o,r,n)=>ie(v,A(n),t,o,[e],r),nt=(e,t,o,r,n)=>ie(b,A(n),t,o,[e],r),lt=(e,t,o,r,n,l,d,s,u)=>ie(g,A(u),l,d,[e,t,o,r,n],s),dt=(e,t,o,r,n,l)=>ie(s+p,A(l),o,r,[e,t],n),st=(e,t,o,r,n,l)=>ie(p,A(l),o,r,[e,t],n),ut=(e,t,o,r,n,l)=>ie(C,A(l),o,r,[e,t],n),it=(e,t,o,r,n,l,d)=>ie(s+m,A(d),r,n,[e,t,o],l),at=(e,t,o,r,n,l,d)=>ie(m,A(d),r,n,[e,t,o],l),ct=(e,t,o,r)=>ie(s+w,A(r),e,t,[],o),It=(e,t,o,r)=>ie(w,A(r),e,t,ne,o),pt=(e,t,o,r)=>ie(f,A(r),e,t,ne,o),vt=(e,t,o,r,n)=>ie(s+y,A(n),t,o,[e],r),bt=(e,t,o,r,n)=>ie(y,A(n),t,o,[e],r),gt=(e,t,o)=>ie("Start"+Z,A(o),e,t),mt=(e,t,o)=>ie("WillFinish"+Z,A(o),e,t),Ct=(e,t,o)=>ie("DidFinish"+Z,A(o),e,t),yt=(e,t,o)=>se(e,t,o),wt=()=>F(3),ft=e=>ue("MetricIds",Q(e),ne),kt=(e,t)=>ue("Metric",Q(t),void 0,[e]),ht=(e,t,o,r)=>ie("Metric",Q(r),t,o,[e]),Rt=(e,t,o)=>se(e,t,o),Pt=()=>F(5),xt=(e,t)=>ue("SliceIds",z(t),ne,[e]),qt=e=>ue("IndexIds",z(e),ne),St=(e,t,o)=>ue("Slice"+b,z(o),ne,[e,t]),Ot=(e,t,o,r)=>ie("SliceIds",z(r),t,o,[e]),Lt=(e,t,o,r,n)=>ie("Slice"+b,z(n),o,r,[e,t]),jt=(e,t,o)=>se(e,t,o),Bt=()=>F(7),Tt=e=>ue("RelationshipIds",J(e),ne),Et=(e,t,o)=>ue("RemoteRowId",J(o),void 0,[e,t]),Mt=(e,t,o)=>ue("Local"+b,J(o),ne,[e,t]),Ft=(e,t,o)=>ue("Linked"+b,J(o),ne,[e,t]),Vt=(e,t,o,r,n)=>ie("RemoteRowId",J(n),o,r,[e,t]),At=(e,t,o,r,n)=>ie("Local"+b,J(n),o,r,[e,t]),Dt=(e,t,o,r,n)=>ie("Linked"+b,J(n),o,r,[e,t]),Ht=(e,t,o)=>se(e,t,o),Qt=()=>F(9),Wt=e=>ue("QueryIds",N(e),ne),zt=(e,t)=>ue(d+a,N(t),le,[e]),Gt=(e,t)=>ue(d+a+C,N(t),ne,[e]),Jt=(e,t)=>ue(d+v,N(t),0,[e]),Kt=(e,t)=>ue(d+b,N(t),ne,[e]),Nt=(e,t,o,r=0,n,l)=>ue(d+g,N(l),ne,[e,t,o,r,n],6),Ut=(e,t,o)=>ue(d+p,N(o),le,[e,t]),Xt=(e,t,o)=>ue(d+C,N(o),ne,[e,t]),Yt=(e,t,o,r)=>ue(d+m,N(r),void 0,[e,t,o]),Zt=(e,t,o,r)=>ie(d+a,N(r),t,o,[e]),$t=(e,t,o,r)=>ie(d+a+C,N(r),t,o,[e]),_t=(e,t,o,r)=>ie(d+v,N(r),t,o,[e]),eo=(e,t,o,r)=>ie(d+b,N(r),t,o,[e]),to=(e,t,o,r,n,l,s,u)=>ie(d+g,N(u),l,s,[e,t,o,r,n]),oo=(e,t,o,r,n)=>ie(d+p,N(n),o,r,[e,t]),ro=(e,t,o,r,n)=>ie(d+C,N(n),o,r,[e,t]),no=(e,t,o,r,n,l)=>ie(d+m,N(l),r,n,[e,t,o]),lo=(e,t,o)=>se(e,t,o),so=()=>F(11),uo=e=>ue("CheckpointIds",X(e),de),io=(e,t)=>ue("Checkpoint",X(t),void 0,[e]),ao=(e=x,t=ne,o,r=x,n=ne)=>{const l=X(o);return $((t=>h(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},co=e=>Ie(e,"goBackward"),Io=e=>Ie(e,"goForward"),po=(e,t=ne,o,r=x,n=ne)=>{const l=X(o);return $((t=>h(l,(o=>h(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},vo=e=>{var t;const r=X(e),[n,l]=uo(r);return[(d=n,!(0==d.length)),co(r),l,null!=(t=h(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var d},bo=e=>{var t;const r=X(e),[,,[n]]=uo(r);return[!k(n),Io(r),n,null!=(t=h(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},go=(e,t,o)=>ie("CheckpointIds",X(o),e,t),mo=(e,t,o,r)=>ie("Checkpoint",X(r),t,o,[e]),Co=(e,t,o=ne,r,n=ne,l,d=ne)=>{const[,s]=re(),u=ee((()=>t(e)),[e,...o]);return _((()=>{var e;return e=function*(){r&&(yield r(u),s([]))},new Promise(((t,o)=>{var r=t=>{try{l(e.next(t))}catch(e){o(e)}},n=t=>{try{l(e.throw(t))}catch(e){o(e)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);l((e=e.apply(void 0,null)).next())})),()=>{null==u||u.destroy(),null==l||l(u)}}),[u,...n,...d]),u},{PureComponent:yo,Fragment:wo,createElement:fo,useCallback:ko,useLayoutEffect:ho,useRef:Ro,useState:Po}=e,xo=(e,...t)=>k(e)?{}:e(...t),qo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var So=Object.defineProperty,Oo=Object.defineProperties,Lo=Object.getOwnPropertyDescriptors,jo=Object.getOwnPropertySymbols,Bo=Object.prototype.hasOwnProperty,To=Object.prototype.propertyIsEnumerable,Eo=(e,t,o)=>t in e?So(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Mo=(e,t)=>{for(var o in t||(t={}))Bo.call(t,o)&&Eo(e,o,t[o]);if(jo)for(var o of jo(t))To.call(t,o)&&Eo(e,o,t[o]);return e},Fo=(e,t)=>Oo(e,Lo(t)),Vo=(e,t)=>{var o={};for(var r in e)Bo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&jo)for(var r of jo(e))t.indexOf(r)<0&&To.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:Ao,useContext:Do,useMemo:Ho,useState:Qo}=e,Wo=({tableId:e,store:t,rowComponent:o=Xo,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:d},s)=>No(q(s,(l=>fo(o,Fo(Mo({},xo(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:d})))),l,d,e),zo=({queryId:e,queries:t,resultRowComponent:o=ur,getResultRowComponentProps:r,separator:n,debugIds:l},d)=>No(q(d,(n=>fo(o,Fo(Mo({},xo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),Go=({relationshipId:e,relationships:t,rowComponent:o=Xo,getRowComponentProps:r,separator:n,debugIds:l},d,s)=>{const[u,i,a]=qo(J(t),e),c=d(e,s,u);return No(q(c,(e=>fo(o,Fo(Mo({},xo(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,s)},Jo=e=>({checkpoints:t,checkpointComponent:o=cr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const d=X(t);return No(q(e(uo(d)),(e=>fo(o,Fo(Mo({},xo(r,e)),{key:e,checkpoints:d,checkpointId:e,debugIds:l})))),n)},Ko=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:d,relationshipsById:s,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=Do(T),[v,b]=Qo({}),g=Ao(((e,t)=>b((o=>O(o,e)==t?o:Fo(Mo({},o),{[e]:t})))),[]),m=Ao((e=>b((t=>Mo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return fo(T.Provider,{value:Ho((()=>[null!=e?e:p[0],Mo(Mo(Mo({},p[1]),t),v),null!=o?o:p[2],Mo(Mo({},p[3]),r),null!=n?n:p[4],Mo(Mo({},p[5]),l),null!=d?d:p[6],Mo(Mo({},p[7]),s),null!=u?u:p[8],Mo(Mo({},p[9]),i),null!=a?a:p[10],Mo(Mo({},p[11]),c),g,m]),[e,t,v,o,r,n,l,d,s,u,i,a,c,p,g,m])},I)},No=(e,t,o,r)=>{const n=k(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},Uo=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var d;return No(o+(null!=(d=Oe(e,t,r,n))?d:o),void 0,l,r)},Xo=({tableId:e,rowId:t,store:o,cellComponent:r=Uo,getCellComponentProps:n,customCellIds:l,separator:d,debugIds:s})=>No(q(((e,t,o,r)=>{const n=qe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>fo(r,Fo(Mo({},xo(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:s})))),d,s,t),Yo=e=>Wo(e,he(e.tableId,e.store)),Zo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,d=Vo(t,["cellId","descending","offset","limit"]);return Wo(d,Re(d.tableId,o,r,n,l,d.store))},$o=({store:e,tableComponent:t=Yo,getTableComponentProps:o,separator:r,debugIds:n})=>No(q(me(e),(r=>fo(t,Fo(Mo({},xo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),_o=({valueId:e,store:t,debugIds:r})=>{var n;return No(o+(null!=(n=Ee(e,t))?n:o),void 0,r,e)},er=({store:e,valueComponent:t=_o,getValueComponentProps:o,separator:r,debugIds:n})=>No(q(Be(e),(r=>fo(t,Fo(Mo({},xo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),tr=({metricId:e,metrics:t,debugIds:r})=>{var n;return No(null!=(n=kt(e,t))?n:o,void 0,r,e)},or=({indexId:e,sliceId:t,indexes:o,rowComponent:r=Xo,getRowComponentProps:n,separator:l,debugIds:d})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(z(o),e),a=St(e,t,s);return No(q(a,(e=>fo(r,Fo(Mo({},xo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:d})))),l,d,t)},rr=({indexId:e,indexes:t,sliceComponent:o=or,getSliceComponentProps:r,separator:n,debugIds:l})=>No(q(xt(e,t),(n=>fo(o,Fo(Mo({},xo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),nr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=Xo,getRowComponentProps:n,debugIds:l})=>{const[d,s,,u]=qo(J(o),e),i=Et(e,t,d);return No(k(u)||k(i)?null:fo(r,Fo(Mo({},xo(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:l})),void 0,l,t)},lr=e=>Go(e,Mt,e.remoteRowId),dr=e=>Go(e,Ft,e.firstRowId),sr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var d;return No(o+(null!=(d=Yt(e,t,r,n))?d:o),void 0,l,r)},ur=({queryId:e,rowId:t,queries:o,resultCellComponent:r=sr,getResultCellComponentProps:n,separator:l,debugIds:d})=>No(q(Xt(e,t,o),(l=>fo(r,Fo(Mo({},xo(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:d})))),l,d,t),ir=e=>zo(e,Kt(e.queryId,e.queries)),ar=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,d=Vo(t,["cellId","descending","offset","limit"]);return zo(d,Nt(d.queryId,o,r,n,l,d.queries))},cr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return No(null!=(n=io(t,e))?n:o,void 0,r,t)},Ir=Jo((e=>e[0])),pr=Jo((e=>k(e[1])?[]:[e[1]])),vr=Jo((e=>e[2]));export{Ir as BackwardCheckpointsView,Uo as CellView,cr as CheckpointView,pr as CurrentCheckpointView,vr as ForwardCheckpointsView,rr as IndexView,dr as LinkedRowsView,lr as LocalRowsView,tr as MetricView,Ko as Provider,nr as RemoteRowView,sr as ResultCellView,ur as ResultRowView,ar as ResultSortedTableView,ir as ResultTableView,Xo as RowView,or as SliceView,Zo as SortedTableView,Yo as TableView,$o as TablesView,_o as ValueView,er as ValuesView,Ae as useAddRowCallback,Oe as useCell,qe as useCellIds,ut as useCellIdsListener,at as useCellListener,io as useCheckpoint,uo as useCheckpointIds,go as useCheckpointIdsListener,mo as useCheckpointListener,U as useCheckpoints,so as useCheckpointsIds,X as useCheckpointsOrCheckpointsById,lo as useCreateCheckpoints,Rt as useCreateIndexes,yt as useCreateMetrics,Co as useCreatePersister,Ht as useCreateQueries,jt as useCreateRelationships,pe as useCreateStore,Ne as useDelCellCallback,Ke as useDelRowCallback,Je as useDelTableCallback,Ge as useDelTablesCallback,Xe as useDelValueCallback,Ue as useDelValuesCallback,Ct as useDidFinishTransactionListener,co as useGoBackwardCallback,Io as useGoForwardCallback,po as useGoToCallback,Se as useHasCell,it as useHasCellListener,Pe as useHasRow,dt as useHasRowListener,Ce as useHasTable,fe as useHasTableCell,ot as useHasTableCellListener,_e as useHasTableListener,be as useHasTables,Ye as useHasTablesListener,Te as useHasValue,vt as useHasValueListener,Le as useHasValues,ct as useHasValuesListener,qt as useIndexIds,W as useIndexes,Pt as useIndexesIds,z as useIndexesOrIndexesById,Ft as useLinkedRowIds,Dt as useLinkedRowIdsListener,Mt as useLocalRowIds,At as useLocalRowIdsListener,kt as useMetric,ft as useMetricIds,ht as useMetricListener,H as useMetrics,wt as useMetricsIds,Q as useMetricsOrMetricsById,D as useProvideStore,K as useQueries,Qt as useQueriesIds,N as useQueriesOrQueriesById,Wt as useQueryIds,bo as useRedoInformation,Tt as useRelationshipIds,G as useRelationships,Bt as useRelationshipsIds,J as useRelationshipsOrRelationshipsById,Et as useRemoteRowId,Vt as useRemoteRowIdListener,Yt as useResultCell,Xt as useResultCellIds,ro as useResultCellIdsListener,no as useResultCellListener,Ut as useResultRow,Jt as useResultRowCount,_t as useResultRowCountListener,Kt as useResultRowIds,eo as useResultRowIdsListener,oo as useResultRowListener,Nt as useResultSortedRowIds,to as useResultSortedRowIdsListener,zt as useResultTable,Gt as useResultTableCellIds,$t as useResultTableCellIdsListener,Zt as useResultTableListener,xe as useRow,ke as useRowCount,rt as useRowCountListener,he as useRowIds,nt as useRowIdsListener,st as useRowListener,He as useSetCellCallback,ao as useSetCheckpointCallback,De as useSetPartialRowCallback,We as useSetPartialValuesCallback,Ve as useSetRowCallback,Fe as useSetTableCallback,Me as useSetTablesCallback,ze as useSetValueCallback,Qe as useSetValuesCallback,xt as useSliceIds,Ot as useSliceIdsListener,St as useSliceRowIds,Lt as useSliceRowIdsListener,Re as useSortedRowIds,lt as useSortedRowIdsListener,gt as useStartTransactionListener,V as useStore,ve as useStoreIds,A as useStoreOrStoreById,ye as useTable,we as useTableCellIds,tt as useTableCellIdsListener,me as useTableIds,$e as useTableIdsListener,et as useTableListener,ge as useTables,Ze as useTablesListener,vo as useUndoInformation,Ee as useValue,Be as useValueIds,pt as useValueIdsListener,bt as useValueListener,je as useValues,It as useValuesListener,mt as useWillFinishTransactionListener};
Binary file
@@ -204,6 +204,17 @@ export type CheckpointsOrCheckpointsId = Checkpoints | Id;
204
204
  */
205
205
  export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
206
206
 
207
+ /**
208
+ * The GetId type describes a function which, when passed a parameter, will
209
+ * return an Id.
210
+ *
211
+ * This type is used in hooks that create callbacks - like the
212
+ * useSetTableCallback hook or useSetRowCallback hook - so that the Id arguments
213
+ * of the object to set can also be dependent on the event or parameter
214
+ * provided (as well as the object itself being set).
215
+ */
216
+ export type GetId<Parameter> = (parameter: Parameter, store: Store) => Id;
217
+
207
218
  /**
208
219
  * The useCreateStore hook is used to create a Store within a React application
209
220
  * with convenient memoization.
@@ -2279,13 +2290,15 @@ export function useSetTablesCallback<Parameter>(
2279
2290
  * The Store to which the callback will make the mutation (indicated by the
2280
2291
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2281
2292
  * dependency for the callback.
2282
- * @param tableId The Id of the Table in the Store to set.
2293
+ * @param tableId The Id of the Table in the Store to set, or a GetId function
2294
+ * that will return it.
2283
2295
  * @param getTable A function which returns the Table object that will be used
2284
2296
  * to update the Store, based on the parameter the callback will receive (and
2285
2297
  * which is most likely a DOM event).
2286
2298
  * @param getTableDeps An optional array of dependencies for the `getTable`
2287
2299
  * function, which, if any change, result in the regeneration of the callback.
2288
- * This parameter defaults to an empty array.
2300
+ * This parameter defaults to an empty array. Also use this to indicate the
2301
+ * dependencies of a GetId functions if used as the tableId argument.
2289
2302
  * @param storeOrStoreId The Store to be updated: omit for the default context
2290
2303
  * Store, provide an Id for a named context Store, or provide an explicit
2291
2304
  * reference.
@@ -2332,7 +2345,7 @@ export function useSetTablesCallback<Parameter>(
2332
2345
  * @category Store hooks
2333
2346
  */
2334
2347
  export function useSetTableCallback<Parameter>(
2335
- tableId: Id,
2348
+ tableId: Id | GetId<Parameter>,
2336
2349
  getTable: (parameter: Parameter, store: Store) => Table,
2337
2350
  getTableDeps?: React.DependencyList,
2338
2351
  storeOrStoreId?: StoreOrStoreId,
@@ -2364,14 +2377,18 @@ export function useSetTableCallback<Parameter>(
2364
2377
  * The Store to which the callback will make the mutation (indicated by the
2365
2378
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2366
2379
  * dependency for the callback.
2367
- * @param tableId The Id of the Table in the Store.
2368
- * @param rowId The Id of the Row in the Table to set.
2380
+ * @param tableId The Id of the Table in the Store, or a GetId function that
2381
+ * will return it.
2382
+ * @param rowId The Id of the Row in the Table to set, or a GetId function that
2383
+ * will return it.
2369
2384
  * @param getRow A function which returns the Row object that will be used to
2370
2385
  * update the Store, based on the parameter the callback will receive (and which
2371
2386
  * is most likely a DOM event).
2372
2387
  * @param getRowDeps An optional array of dependencies for the `getRow`
2373
2388
  * function, which, if any change, result in the regeneration of the callback.
2374
- * This parameter defaults to an empty array.
2389
+ * This parameter defaults to an empty array. Also use this to indicate the
2390
+ * dependencies of any GetId functions if used as the tableId or rowId
2391
+ * arguments.
2375
2392
  * @param storeOrStoreId The Store to be updated: omit for the default context
2376
2393
  * Store, provide an Id for a named context Store, or provide an explicit
2377
2394
  * reference.
@@ -2419,8 +2436,8 @@ export function useSetTableCallback<Parameter>(
2419
2436
  * @category Store hooks
2420
2437
  */
2421
2438
  export function useSetRowCallback<Parameter>(
2422
- tableId: Id,
2423
- rowId: Id,
2439
+ tableId: Id | GetId<Parameter>,
2440
+ rowId: Id | GetId<Parameter>,
2424
2441
  getRow: (parameter: Parameter, store: Store) => Row,
2425
2442
  getRowDeps?: React.DependencyList,
2426
2443
  storeOrStoreId?: StoreOrStoreId,
@@ -2459,13 +2476,15 @@ export function useSetRowCallback<Parameter>(
2459
2476
  * specify `reuseRowIds` to be `false`, then the Id will be a monotonically
2460
2477
  * increasing string representation of an increasing integer, regardless of any
2461
2478
  * you may have previously deleted.
2462
- * @param tableId The Id of the Table in the Store.
2479
+ * @param tableId The Id of the Table in the Store, or a GetId function
2480
+ * that will return it.
2463
2481
  * @param getRow A function which returns the Row object that will be used to
2464
2482
  * update the Store, based on the parameter the callback will receive (and which
2465
2483
  * is most likely a DOM event).
2466
2484
  * @param getRowDeps An optional array of dependencies for the `getRow`
2467
2485
  * function, which, if any change, result in the regeneration of the callback.
2468
- * This parameter defaults to an empty array.
2486
+ * This parameter defaults to an empty array. Also use this to indicate the
2487
+ * dependencies of a GetId functions if used as the tableId argument.
2469
2488
  * @param storeOrStoreId The Store to be updated: omit for the default context
2470
2489
  * Store, provide an Id for a named context Store, or provide an explicit
2471
2490
  * reference.
@@ -2514,7 +2533,7 @@ export function useSetRowCallback<Parameter>(
2514
2533
  * @category Store hooks
2515
2534
  */
2516
2535
  export function useAddRowCallback<Parameter>(
2517
- tableId: Id,
2536
+ tableId: Id | GetId<Parameter>,
2518
2537
  getRow: (parameter: Parameter, store: Store) => Row,
2519
2538
  getRowDeps?: React.DependencyList,
2520
2539
  storeOrStoreId?: StoreOrStoreId,
@@ -2548,14 +2567,18 @@ export function useAddRowCallback<Parameter>(
2548
2567
  * The Store to which the callback will make the mutation (indicated by the
2549
2568
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2550
2569
  * dependency for the callback.
2551
- * @param tableId The Id of the Table in the Store.
2552
- * @param rowId The Id of the Row in the Table to set.
2570
+ * @param tableId The Id of the Table in the Store, or a GetId function that
2571
+ * will return it.
2572
+ * @param rowId The Id of the Row in the Table to set, or a GetId function that
2573
+ * will return it.
2553
2574
  * @param getPartialRow A function which returns the partial Row object that
2554
2575
  * will be used to update the Store, based on the parameter the callback will
2555
2576
  * receive (and which is most likely a DOM event).
2556
2577
  * @param getPartialRowDeps An optional array of dependencies for the `getRow`
2557
2578
  * function, which, if any change, result in the regeneration of the callback.
2558
- * This parameter defaults to an empty array.
2579
+ * This parameter defaults to an empty array. Also use this to indicate the
2580
+ * dependencies of any GetId functions if used as the tableId, rowId, or cellId
2581
+ * arguments.
2559
2582
  * @param storeOrStoreId The Store to be updated: omit for the default context
2560
2583
  * Store, provide an Id for a named context Store, or provide an explicit
2561
2584
  * reference.
@@ -2604,8 +2627,8 @@ export function useAddRowCallback<Parameter>(
2604
2627
  * @category Store hooks
2605
2628
  */
2606
2629
  export function useSetPartialRowCallback<Parameter>(
2607
- tableId: Id,
2608
- rowId: Id,
2630
+ tableId: Id | GetId<Parameter>,
2631
+ rowId: Id | GetId<Parameter>,
2609
2632
  getPartialRow: (parameter: Parameter, store: Store) => Row,
2610
2633
  getPartialRowDeps?: React.DependencyList,
2611
2634
  storeOrStoreId?: StoreOrStoreId,
@@ -2637,15 +2660,20 @@ export function useSetPartialRowCallback<Parameter>(
2637
2660
  * The Store to which the callback will make the mutation (indicated by the
2638
2661
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2639
2662
  * dependency for the callback.
2640
- * @param tableId The Id of the Table in the Store.
2641
- * @param rowId The Id of the Row in the Table.
2642
- * @param cellId The Id of the Cell in the Row to set.
2663
+ * @param tableId The Id of the Table in the Store, or a GetId function that
2664
+ * will return it.
2665
+ * @param rowId The Id of the Row in the Table, or a GetId function that will
2666
+ * return it.
2667
+ * @param cellId The Id of the Cell in the Row to set, or a GetId function that
2668
+ * will return it.
2643
2669
  * @param getCell A function which returns the Cell value that will be used to
2644
2670
  * update the Store, or a MapCell function to update it, based on the parameter
2645
2671
  * the callback will receive (and which is most likely a DOM event).
2646
2672
  * @param getCellDeps An optional array of dependencies for the `getCell`
2647
2673
  * function, which, if any change, result in the regeneration of the callback.
2648
- * This parameter defaults to an empty array.
2674
+ * This parameter defaults to an empty array. Also use this to indicate the
2675
+ * dependencies of any GetId functions if used as the tableId, rowId, or cellId
2676
+ * arguments.
2649
2677
  * @param storeOrStoreId The Store to be updated: omit for the default context
2650
2678
  * Store, provide an Id for a named context Store, or provide an explicit
2651
2679
  * reference.
@@ -2731,9 +2759,9 @@ export function useSetPartialRowCallback<Parameter>(
2731
2759
  * @category Store hooks
2732
2760
  */
2733
2761
  export function useSetCellCallback<Parameter>(
2734
- tableId: Id,
2735
- rowId: Id,
2736
- cellId: Id,
2762
+ tableId: Id | GetId<Parameter>,
2763
+ rowId: Id | GetId<Parameter>,
2764
+ cellId: Id | GetId<Parameter>,
2737
2765
  getCell: (parameter: Parameter, store: Store) => Cell | MapCell,
2738
2766
  getCellDeps?: React.DependencyList,
2739
2767
  storeOrStoreId?: StoreOrStoreId,
@@ -2933,13 +2961,15 @@ export function useSetPartialValuesCallback<Parameter>(
2933
2961
  * The Store to which the callback will make the mutation (indicated by the
2934
2962
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2935
2963
  * dependency for the callback.
2936
- * @param valueId The Id of the Value in the Store to set.
2964
+ * @param valueId The Id of the Value in the Store to set, or a GetId function
2965
+ * that will return it.
2937
2966
  * @param getValue A function which returns the Value object that will be used
2938
2967
  * to update the Store, based on the parameter the callback will receive (and
2939
2968
  * which is most likely a DOM event).
2940
2969
  * @param getValueDeps An optional array of dependencies for the `getValue`
2941
2970
  * function, which, if any change, result in the regeneration of the callback.
2942
- * This parameter defaults to an empty array.
2971
+ * This parameter defaults to an empty array. Also use this to indicate the
2972
+ * dependencies of a GetId function if used as the valueId argument.
2943
2973
  * @param storeOrStoreId The Store to be updated: omit for the default context
2944
2974
  * Store, provide an Id for a named context Store, or provide an explicit
2945
2975
  * reference.
@@ -2987,7 +3017,7 @@ export function useSetPartialValuesCallback<Parameter>(
2987
3017
  * @since v3.0.0
2988
3018
  */
2989
3019
  export function useSetValueCallback<Parameter>(
2990
- valueId: Id,
3020
+ valueId: Id | GetId<Parameter>,
2991
3021
  getValue: (parameter: Parameter, store: Store) => Value | MapValue,
2992
3022
  getValueDeps?: React.DependencyList,
2993
3023
  storeOrStoreId?: StoreOrStoreId,
@@ -32,6 +32,11 @@ type CheckpointsOrCheckpointsId<Schemas extends OptionalSchemas> =
32
32
 
33
33
  type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
34
34
 
35
+ type GetId<Schemas extends OptionalSchemas, Parameter, Id> = (
36
+ parameter: Parameter,
37
+ store: Store<Schemas>,
38
+ ) => Id;
39
+
35
40
  type ExtraProps = {[propName: string]: any};
36
41
 
37
42
  type TablesProps<Schemas extends OptionalSchemas> = {
@@ -39,6 +39,7 @@ import {
39
39
  CurrentCheckpointProps,
40
40
  ExtraProps,
41
41
  ForwardCheckpointsProps,
42
+ GetId,
42
43
  IndexProps,
43
44
  IndexesOrIndexesId,
44
45
  LinkedRowsProps,
@@ -2575,7 +2576,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2575
2576
  *
2576
2577
  * ```ts override
2577
2578
  * useSetTableCallback<Parameter>(
2578
- * tableId: Id,
2579
+ * tableId: Id | GetId<Parameter>,
2579
2580
  * getTable: (parameter: Parameter, store: Store) => Table,
2580
2581
  * getTableDeps?: React.DependencyList,
2581
2582
  * storeOrStoreId?: StoreOrStoreId,
@@ -2604,13 +2605,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2604
2605
  * The Store to which the callback will make the mutation (indicated by the
2605
2606
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2606
2607
  * dependency for the callback.
2607
- * @param tableId The Id of the Table in the Store to set.
2608
+ * @param tableId The Id of the Table in the Store to set, or a GetId function
2609
+ * that will return it.
2608
2610
  * @param getTable A function which returns the Table object that will be used
2609
2611
  * to update the Store, based on the parameter the callback will receive (and
2610
2612
  * which is most likely a DOM event).
2611
2613
  * @param getTableDeps An optional array of dependencies for the `getTable`
2612
2614
  * function, which, if any change, result in the regeneration of the callback.
2613
- * This parameter defaults to an empty array.
2615
+ * This parameter defaults to an empty array. Also use this to indicate the
2616
+ * dependencies of a GetId functions if used as the tableId argument.
2614
2617
  * @param storeOrStoreId The Store to be updated: omit for the default context
2615
2618
  * Store, provide an Id for a named context Store, or provide an explicit
2616
2619
  * reference.
@@ -2661,7 +2664,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2661
2664
  TableId extends TableIdFromSchema<Schemas[0]>,
2662
2665
  SetTable = Table<Schemas[0], TableId, true>,
2663
2666
  >(
2664
- tableId: TableId,
2667
+ tableId: TableId | GetId<Schemas, Parameter, TableId>,
2665
2668
  getTable: (
2666
2669
  parameter: Parameter,
2667
2670
  store: Store<Schemas>,
@@ -2680,8 +2683,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2680
2683
  *
2681
2684
  * ```ts override
2682
2685
  * useSetRowCallback<Parameter>(
2683
- * tableId: Id,
2684
- * rowId: Id,
2686
+ * tableId: Id | GetId<Parameter>,
2687
+ * rowId: Id | GetId<Parameter>,
2685
2688
  * getRow: (parameter: Parameter, store: Store) => Row,
2686
2689
  * getRowDeps?: React.DependencyList,
2687
2690
  * storeOrStoreId?: StoreOrStoreId,
@@ -2710,14 +2713,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2710
2713
  * The Store to which the callback will make the mutation (indicated by the
2711
2714
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2712
2715
  * dependency for the callback.
2713
- * @param tableId The Id of the Table in the Store.
2714
- * @param rowId The Id of the Row in the Table to set.
2716
+ * @param tableId The Id of the Table in the Store, or a GetId function that
2717
+ * will return it.
2718
+ * @param rowId The Id of the Row in the Table to set, or a GetId function that
2719
+ * will return it.
2715
2720
  * @param getRow A function which returns the Row object that will be used to
2716
2721
  * update the Store, based on the parameter the callback will receive (and which
2717
2722
  * is most likely a DOM event).
2718
2723
  * @param getRowDeps An optional array of dependencies for the `getRow`
2719
2724
  * function, which, if any change, result in the regeneration of the callback.
2720
- * This parameter defaults to an empty array.
2725
+ * This parameter defaults to an empty array. Also use this to indicate the
2726
+ * dependencies of any GetId functions if used as the tableId or rowId
2727
+ * arguments.
2721
2728
  * @param storeOrStoreId The Store to be updated: omit for the default context
2722
2729
  * Store, provide an Id for a named context Store, or provide an explicit
2723
2730
  * reference.
@@ -2769,8 +2776,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2769
2776
  TableId extends TableIdFromSchema<Schemas[0]>,
2770
2777
  SetRow = Row<Schemas[0], TableId, true>,
2771
2778
  >(
2772
- tableId: TableId,
2773
- rowId: Id,
2779
+ tableId: TableId | GetId<Schemas, Parameter, TableId>,
2780
+ rowId: Id | GetId<Schemas, Parameter, Id>,
2774
2781
  getRow: (parameter: Parameter, store: Store<Schemas>) => NoInfer<SetRow>,
2775
2782
  getRowDeps?: React.DependencyList,
2776
2783
  storeOrStoreId?: StoreOrStoreId<Schemas>,
@@ -2786,7 +2793,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2786
2793
  *
2787
2794
  * ```ts override
2788
2795
  * useAddRowCallback<Parameter>(
2789
- * tableId: Id,
2796
+ * tableId: Id | GetId<Parameter>,
2790
2797
  * getRow: (parameter: Parameter, store: Store) => Row,
2791
2798
  * getRowDeps?: React.DependencyList,
2792
2799
  * storeOrStoreId?: StoreOrStoreId,
@@ -2823,13 +2830,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2823
2830
  * specify `reuseRowIds` to be `false`, then the Id will be a monotonically
2824
2831
  * increasing string representation of an increasing integer, regardless of any
2825
2832
  * you may have previously deleted.
2826
- * @param tableId The Id of the Table in the Store.
2833
+ * @param tableId The Id of the Table in the Store, or a GetId function
2834
+ * that will return it.
2827
2835
  * @param getRow A function which returns the Row object that will be used to
2828
2836
  * update the Store, based on the parameter the callback will receive (and which
2829
2837
  * is most likely a DOM event).
2830
2838
  * @param getRowDeps An optional array of dependencies for the `getRow`
2831
2839
  * function, which, if any change, result in the regeneration of the callback.
2832
- * This parameter defaults to an empty array.
2840
+ * This parameter defaults to an empty array. Also use this to indicate the
2841
+ * dependencies of a GetId functions if used as the tableId argument.
2833
2842
  * @param storeOrStoreId The Store to be updated: omit for the default context
2834
2843
  * Store, provide an Id for a named context Store, or provide an explicit
2835
2844
  * reference.
@@ -2882,7 +2891,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2882
2891
  TableId extends TableIdFromSchema<Schemas[0]>,
2883
2892
  AddRow = Row<Schemas[0], TableId, true>,
2884
2893
  >(
2885
- tableId: TableId,
2894
+ tableId: TableId | GetId<Schemas, Parameter, TableId>,
2886
2895
  getRow: (parameter: Parameter, store: Store<Schemas>) => NoInfer<AddRow>,
2887
2896
  getRowDeps?: React.DependencyList,
2888
2897
  storeOrStoreId?: StoreOrStoreId<Schemas>,
@@ -2900,8 +2909,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2900
2909
  *
2901
2910
  * ```ts override
2902
2911
  * useSetPartialRowCallback<Parameter>(
2903
- * tableId: Id,
2904
- * rowId: Id,
2912
+ * tableId: Id | GetId<Parameter>,
2913
+ * rowId: Id | GetId<Parameter>,
2905
2914
  * getPartialRow: (parameter: Parameter, store: Store) => Row,
2906
2915
  * getPartialRowDeps?: React.DependencyList,
2907
2916
  * storeOrStoreId?: StoreOrStoreId,
@@ -2930,14 +2939,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2930
2939
  * The Store to which the callback will make the mutation (indicated by the
2931
2940
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
2932
2941
  * dependency for the callback.
2933
- * @param tableId The Id of the Table in the Store.
2934
- * @param rowId The Id of the Row in the Table to set.
2942
+ * @param tableId The Id of the Table in the Store, or a GetId function that
2943
+ * will return it.
2944
+ * @param rowId The Id of the Row in the Table to set, or a GetId function that
2945
+ * will return it.
2935
2946
  * @param getPartialRow A function which returns the partial Row object that
2936
2947
  * will be used to update the Store, based on the parameter the callback will
2937
2948
  * receive (and which is most likely a DOM event).
2938
2949
  * @param getPartialRowDeps An optional array of dependencies for the `getRow`
2939
2950
  * function, which, if any change, result in the regeneration of the callback.
2940
- * This parameter defaults to an empty array.
2951
+ * This parameter defaults to an empty array. Also use this to indicate the
2952
+ * dependencies of any GetId functions if used as the tableId, rowId, or cellId
2953
+ * arguments.
2941
2954
  * @param storeOrStoreId The Store to be updated: omit for the default context
2942
2955
  * Store, provide an Id for a named context Store, or provide an explicit
2943
2956
  * reference.
@@ -2990,8 +3003,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2990
3003
  TableId extends TableIdFromSchema<Schemas[0]>,
2991
3004
  SetPartialRow = Row<Schemas[0], TableId, true>,
2992
3005
  >(
2993
- tableId: TableId,
2994
- rowId: Id,
3006
+ tableId: TableId | GetId<Schemas, Parameter, TableId>,
3007
+ rowId: Id | GetId<Schemas, Parameter, Id>,
2995
3008
  getPartialRow: (
2996
3009
  parameter: Parameter,
2997
3010
  store: Store<Schemas>,
@@ -3010,9 +3023,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3010
3023
  *
3011
3024
  * ```ts override
3012
3025
  * useSetCellCallback<Parameter>(
3013
- * tableId: Id,
3014
- * rowId: Id,
3015
- * cellId: Id,
3026
+ * tableId: Id | GetId<Parameter>,
3027
+ * rowId: Id | GetId<Parameter>,
3028
+ * cellId: Id | GetId<Parameter>,
3016
3029
  * getCell: (parameter: Parameter, store: Store) => Cell | MapCell,
3017
3030
  * getCellDeps?: React.DependencyList,
3018
3031
  * storeOrStoreId?: StoreOrStoreId,
@@ -3041,15 +3054,20 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3041
3054
  * The Store to which the callback will make the mutation (indicated by the
3042
3055
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
3043
3056
  * dependency for the callback.
3044
- * @param tableId The Id of the Table in the Store.
3045
- * @param rowId The Id of the Row in the Table.
3046
- * @param cellId The Id of the Cell in the Row to set.
3057
+ * @param tableId The Id of the Table in the Store, or a GetId function that
3058
+ * will return it.
3059
+ * @param rowId The Id of the Row in the Table, or a GetId function that will
3060
+ * return it.
3061
+ * @param cellId The Id of the Cell in the Row to set, or a GetId function that
3062
+ * will return it.
3047
3063
  * @param getCell A function which returns the Cell value that will be used to
3048
3064
  * update the Store, or a MapCell function to update it, based on the parameter
3049
3065
  * the callback will receive (and which is most likely a DOM event).
3050
3066
  * @param getCellDeps An optional array of dependencies for the `getCell`
3051
3067
  * function, which, if any change, result in the regeneration of the callback.
3052
- * This parameter defaults to an empty array.
3068
+ * This parameter defaults to an empty array. Also use this to indicate the
3069
+ * dependencies of any GetId functions if used as the tableId, rowId, or cellId
3070
+ * arguments.
3053
3071
  * @param storeOrStoreId The Store to be updated: omit for the default context
3054
3072
  * Store, provide an Id for a named context Store, or provide an explicit
3055
3073
  * reference.
@@ -3142,9 +3160,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3142
3160
  | Cell<Schemas[0], TableId, CellId>
3143
3161
  | MapCell<Schemas[0], TableId, CellId>,
3144
3162
  >(
3145
- tableId: TableId,
3146
- rowId: Id,
3147
- cellId: CellId,
3163
+ tableId: TableId | GetId<Schemas, Parameter, TableId>,
3164
+ rowId: Id | GetId<Schemas, Parameter, Id>,
3165
+ cellId: CellId | GetId<Schemas, Parameter, CellId>,
3148
3166
  getCell: (
3149
3167
  parameter: Parameter,
3150
3168
  store: Store<Schemas>,
@@ -3364,7 +3382,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3364
3382
  *
3365
3383
  * ```ts override
3366
3384
  * useSetValueCallback<Parameter>(
3367
- * valueId: Id,
3385
+ * valueId: Id | GetId<Parameter>,
3368
3386
  * getValue: (parameter: Parameter, store: Store) => Value | MapValue,
3369
3387
  * getValueDeps?: React.DependencyList,
3370
3388
  * storeOrStoreId?: StoreOrStoreId,
@@ -3393,13 +3411,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3393
3411
  * The Store to which the callback will make the mutation (indicated by the
3394
3412
  * hook's `storeOrStoreId` parameter) is always automatically used as a hook
3395
3413
  * dependency for the callback.
3396
- * @param valueId The Id of the Value in the Store to set.
3414
+ * @param valueId The Id of the Value in the Store to set, or a GetId function
3415
+ * that will return it.
3397
3416
  * @param getValue A function which returns the Value object that will be used
3398
3417
  * to update the Store, based on the parameter the callback will receive (and
3399
3418
  * which is most likely a DOM event).
3400
3419
  * @param getValueDeps An optional array of dependencies for the `getValue`
3401
3420
  * function, which, if any change, result in the regeneration of the callback.
3402
- * This parameter defaults to an empty array.
3421
+ * This parameter defaults to an empty array. Also use this to indicate the
3422
+ * dependencies of a GetId function if used as the valueId argument.
3403
3423
  * @param storeOrStoreId The Store to be updated: omit for the default context
3404
3424
  * Store, provide an Id for a named context Store, or provide an explicit
3405
3425
  * reference.
@@ -3451,7 +3471,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3451
3471
  ValueId extends ValueIdFromSchema<Schemas[1]>,
3452
3472
  SetOrMapValue = Value<Schemas[1], ValueId> | MapValue<Schemas[1], ValueId>,
3453
3473
  >(
3454
- valueId: ValueId,
3474
+ valueId: ValueId | GetId<Schemas, Parameter, ValueId>,
3455
3475
  getValue: (
3456
3476
  parameter: Parameter,
3457
3477
  store: Store<Schemas>,
package/lib/ui-react.js CHANGED
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",s=t(o),r="Listener",d="Result",n="Has",u="has",I="Ids",i="Table",c=i+"s",l=i+I,a="Row",p=a+"Count",g=a+I,b="Sorted"+a+I,C="Cell",m=C+I,k="Value",y=k+"s",w=k+I,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),v=e=>t(e)==s,f=()=>{},q=(e,t)=>e.map(t),P=Object.keys,x=(e,t)=>R(e,(e=>e[t])),S=(e,t)=>(delete e[t],e),{createContext:L,useContext:B,useEffect:T}=e,E=L([]),M=(e,t)=>{const o=B(E);return h(e)?o[t]:v(e)?x(o[t+1]??{},e):e},F=(e,t)=>{const o=M(e,t);return h(e)||v(e)?o:e},V=e=>P(B(E)[e]??{}),A=e=>M(e,0),j=e=>F(e,0),D=(e,t)=>{const{12:o,13:s}=B(E);T((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},H=e=>M(e,2),O=e=>F(e,2),Q=e=>M(e,4),W=e=>F(e,4),z=e=>M(e,6),G=e=>F(e,6),J=e=>M(e,8),K=e=>F(e,8),N=e=>M(e,10),U=e=>F(e,10),X=e=>e.toLowerCase();X(r);const Y="Transaction";X(Y);const{useCallback:Z,useEffect:$,useMemo:_,useLayoutEffect:ee,useRef:te,useState:oe}=e,se=[],re={},de=[[],void 0,[]],ne=(e,t,o=se)=>{const s=_((()=>t(e)),[e,...o]);return $((()=>()=>s.destroy()),[s]),s},ue=(e,t,o,s=se,r,d="get",n="")=>{const[,u]=oe(),I=Z((()=>t?.[d+e]?.(...s)??o),[t,e,...s,o]),i=te();return _((()=>i.current=I()),[I]),Ie(n+e,t,((...e)=>{i.current=h(r)?I():e[r],u([])}),[I,r],s),i.current},Ie=(e,t,o,s=se,d=se,...n)=>ee((()=>{const s=t?.["add"+e+r]?.(...d,o,...n);return()=>t?.delListener(s)}),[t,e,...d,...s,...n]),ie=(e,t,o,s=se,r=f,d=se,...n)=>{const u=j(e);return Z((e=>R(u,(s=>R(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[u,t,...s,...d,...n])},ce=(e,t,o=f,s=se,...r)=>{const d=j(e);return Z((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},le=(e,t,o)=>{const s=U(e);return Z((()=>s?.[t](o)),[s,t,o])},ae=(e,t=se)=>_(e,t),pe=()=>V(1),ge=e=>ue(c,j(e),!1,[],1,u,n),be=e=>ue(c,j(e),re),Ce=e=>ue(l,j(e),se),me=(e,t)=>ue(i,j(t),!1,[e],2,u,n),ke=(e,t)=>ue(i,j(t),re,[e]),ye=(e,t)=>ue(i+m,j(t),se,[e]),we=(e,t,o)=>ue(i+C,j(o),!1,[e,t],3,u,n),he=(e,t)=>ue(p,j(t),0,[e]),Re=(e,t)=>ue(g,j(t),se,[e]),ve=(e,t,o,s=0,r,d)=>ue(b,j(d),se,[e,t,o,s,r],6),fe=(e,t,o)=>ue(a,j(o),!1,[e,t],3,u,n),qe=(e,t,o)=>ue(a,j(o),re,[e,t]),Pe=(e,t,o)=>ue(m,j(o),se,[e,t]),xe=(e,t,o,s)=>ue(C,j(s),!1,[e,t,o],4,u,n),Se=(e,t,o,s)=>ue(C,j(s),void 0,[e,t,o],4),Le=e=>ue(y,j(e),!1,[],1,u,n),Be=e=>ue(y,j(e),re),Te=e=>ue(w,j(e),se),Ee=(e,t)=>ue(k,j(t),!1,[e],2,u,n),Me=(e,t)=>ue(k,j(t),void 0,[e]),Fe=(e,t,o,s,r)=>ie(o,c,e,t,s,r),Ve=(e,t,o,s,r,d)=>ie(s,i,t,o,r,d,e),Ae=(e,t,o,s,r,d,n)=>ie(r,a,o,s,d,n,e,t),je=(e,t,o=se,s,r=f,d=se,n=!0)=>{const u=j(s);return Z((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[u,e,...o,...d,n])},De=(e,t,o,s,r,d,n)=>ie(r,"PartialRow",o,s,d,n,e,t),He=(e,t,o,s,r,d,n,u)=>ie(d,C,s,r,n,u,e,t,o),Oe=(e,t,o,s,r)=>ie(o,y,e,t,s,r),Qe=(e,t,o,s,r)=>ie(o,"PartialValues",e,t,s,r),We=(e,t,o,s,r,d)=>ie(s,k,t,o,r,d,e),ze=(e,t,o)=>ce(e,c,t,o),Ge=(e,t,o,s)=>ce(t,i,o,s,e),Je=(e,t,o,s,r)=>ce(o,a,s,r,e,t),Ke=(e,t,o,s,r,d,n)=>ce(r,C,d,n,e,t,o,s),Ne=(e,t,o)=>ce(e,y,t,o),Ue=(e,t,o,s)=>ce(t,k,o,s,e),Xe=(e,t,o,s)=>Ie(n+c,j(s),e,t,[],o),Ye=(e,t,o,s)=>Ie(c,j(s),e,t,se,o),Ze=(e,t,o,s)=>Ie(l,j(s),e,t,se,o),$e=(e,t,o,s,r)=>Ie(n+i,j(r),t,o,[e],s),_e=(e,t,o,s,r)=>Ie(i,j(r),t,o,[e],s),et=(e,t,o,s,r)=>Ie(i+m,j(r),t,o,[e],s),tt=(e,t,o,s,r,d)=>Ie(n+i+C,j(d),o,s,[e,t],r),ot=(e,t,o,s,r)=>Ie(p,j(r),t,o,[e],s),st=(e,t,o,s,r)=>Ie(g,j(r),t,o,[e],s),rt=(e,t,o,s,r,d,n,u,I)=>Ie(b,j(I),d,n,[e,t,o,s,r],u),dt=(e,t,o,s,r,d)=>Ie(n+a,j(d),o,s,[e,t],r),nt=(e,t,o,s,r,d)=>Ie(a,j(d),o,s,[e,t],r),ut=(e,t,o,s,r,d)=>Ie(m,j(d),o,s,[e,t],r),It=(e,t,o,s,r,d,u)=>Ie(n+C,j(u),s,r,[e,t,o],d),it=(e,t,o,s,r,d,n)=>Ie(C,j(n),s,r,[e,t,o],d),ct=(e,t,o,s)=>Ie(n+y,j(s),e,t,[],o),lt=(e,t,o,s)=>Ie(y,j(s),e,t,se,o),at=(e,t,o,s)=>Ie(w,j(s),e,t,se,o),pt=(e,t,o,s,r)=>Ie(n+k,j(r),t,o,[e],s),gt=(e,t,o,s,r)=>Ie(k,j(r),t,o,[e],s),bt=(e,t,o)=>Ie("Start"+Y,j(o),e,t),Ct=(e,t,o)=>Ie("WillFinish"+Y,j(o),e,t),mt=(e,t,o)=>Ie("DidFinish"+Y,j(o),e,t),kt=(e,t,o)=>ne(e,t,o),yt=()=>V(3),wt=e=>ue("MetricIds",O(e),se),ht=(e,t)=>ue("Metric",O(t),void 0,[e]),Rt=(e,t,o,s)=>Ie("Metric",O(s),t,o,[e]),vt=(e,t,o)=>ne(e,t,o),ft=()=>V(5),qt=(e,t)=>ue("SliceIds",W(t),se,[e]),Pt=e=>ue("IndexIds",W(e),se),xt=(e,t,o)=>ue("Slice"+g,W(o),se,[e,t]),St=(e,t,o,s)=>Ie("SliceIds",W(s),t,o,[e]),Lt=(e,t,o,s,r)=>Ie("Slice"+g,W(r),o,s,[e,t]),Bt=(e,t,o)=>ne(e,t,o),Tt=()=>V(7),Et=e=>ue("RelationshipIds",G(e),se),Mt=(e,t,o)=>ue("RemoteRowId",G(o),void 0,[e,t]),Ft=(e,t,o)=>ue("Local"+g,G(o),se,[e,t]),Vt=(e,t,o)=>ue("Linked"+g,G(o),se,[e,t]),At=(e,t,o,s,r)=>Ie("RemoteRowId",G(r),o,s,[e,t]),jt=(e,t,o,s,r)=>Ie("Local"+g,G(r),o,s,[e,t]),Dt=(e,t,o,s,r)=>Ie("Linked"+g,G(r),o,s,[e,t]),Ht=(e,t,o)=>ne(e,t,o),Ot=()=>V(9),Qt=e=>ue("QueryIds",K(e),se),Wt=(e,t)=>ue(d+i,K(t),re,[e]),zt=(e,t)=>ue(d+i+m,K(t),se,[e]),Gt=(e,t)=>ue(d+p,K(t),0,[e]),Jt=(e,t)=>ue(d+g,K(t),se,[e]),Kt=(e,t,o,s=0,r,n)=>ue(d+b,K(n),se,[e,t,o,s,r],6),Nt=(e,t,o)=>ue(d+a,K(o),re,[e,t]),Ut=(e,t,o)=>ue(d+m,K(o),se,[e,t]),Xt=(e,t,o,s)=>ue(d+C,K(s),void 0,[e,t,o]),Yt=(e,t,o,s)=>Ie(d+i,K(s),t,o,[e]),Zt=(e,t,o,s)=>Ie(d+i+m,K(s),t,o,[e]),$t=(e,t,o,s)=>Ie(d+p,K(s),t,o,[e]),_t=(e,t,o,s)=>Ie(d+g,K(s),t,o,[e]),eo=(e,t,o,s,r,n,u,I)=>Ie(d+b,K(I),n,u,[e,t,o,s,r]),to=(e,t,o,s,r)=>Ie(d+a,K(r),o,s,[e,t]),oo=(e,t,o,s,r)=>Ie(d+m,K(r),o,s,[e,t]),so=(e,t,o,s,r,n)=>Ie(d+C,K(n),s,r,[e,t,o]),ro=(e,t,o)=>ne(e,t,o),no=()=>V(11),uo=e=>ue("CheckpointIds",U(e),de),Io=(e,t)=>ue("Checkpoint",U(t),void 0,[e]),io=(e=f,t=se,o,s=f,r=se)=>{const d=U(o);return Z((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},co=e=>le(e,"goBackward"),lo=e=>le(e,"goForward"),ao=(e,t=se,o,s=f,r=se)=>{const d=U(o);return Z((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},po=e=>{const t=U(e),[s,r]=uo(t);return[(d=s,!(0==d.length)),co(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},go=e=>{const t=U(e),[,,[s]]=uo(t);return[!h(s),lo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},bo=(e,t,o)=>Ie("CheckpointIds",U(o),e,t),Co=(e,t,o,s)=>Ie("Checkpoint",U(s),t,o,[e]),mo=(e,t,o=se,s,r=se,d,n=se)=>{const[,u]=oe(),I=_((()=>t(e)),[e,...o]);return $((()=>((async()=>{s&&(await s(I),u([]))})(),()=>{I?.destroy(),d?.(I)})),[I,...r,...n]),I},{PureComponent:ko,Fragment:yo,createElement:wo,useCallback:ho,useLayoutEffect:Ro,useRef:vo,useState:fo}=e,qo=(e,...t)=>h(e)?{}:e(...t),Po=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:xo,useContext:So,useMemo:Lo,useState:Bo}=e,To=({tableId:e,store:t,rowComponent:o=Do,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Ao(q(u,(d=>wo(o,{...qo(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Eo=({queryId:e,queries:t,resultRowComponent:o=Zo,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Ao(q(n,(r=>wo(o,{...qo(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Mo=({relationshipId:e,relationships:t,rowComponent:o=Do,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[I,i,c]=Po(G(t),e),l=n(e,u,I);return Ao(q(l,(e=>wo(o,{...qo(s,e),key:e,tableId:c,rowId:e,store:i,debugIds:d}))),r,d,u)},Fo=e=>({checkpoints:t,checkpointComponent:o=es,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=U(t);return Ao(q(e(uo(n)),(e=>wo(o,{...qo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Vo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:I,queriesById:i,checkpoints:c,checkpointsById:l,children:a})=>{const p=So(E),[g,b]=Bo({}),C=xo(((e,t)=>b((o=>x(o,e)==t?o:{...o,[e]:t}))),[]),m=xo((e=>b((t=>({...S(t,e)})))),[]);return wo(E.Provider,{value:Lo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},I??p[8],{...p[9],...i},c??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,I,i,c,l,p,C,m])},a)},Ao=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},jo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Ao(o+(Se(e,t,s,r)??o),void 0,d,s),Do=({tableId:e,rowId:t,store:o,cellComponent:s=jo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Ao(q(((e,t,o,s)=>{const r=Pe(t,o,s);return e??r})(d,e,t,o),(d=>wo(s,{...qo(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),Ho=e=>To(e,Re(e.tableId,e.store)),Oo=({cellId:e,descending:t,offset:o,limit:s,...r})=>To(r,ve(r.tableId,e,t,o,s,r.store)),Qo=({store:e,tableComponent:t=Ho,getTableComponentProps:o,separator:s,debugIds:r})=>Ao(q(Ce(e),(s=>wo(t,{...qo(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Wo=({valueId:e,store:t,debugIds:s})=>Ao(o+(Me(e,t)??o),void 0,s,e),zo=({store:e,valueComponent:t=Wo,getValueComponentProps:o,separator:s,debugIds:r})=>Ao(q(Te(e),(s=>wo(t,{...qo(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),Go=({metricId:e,metrics:t,debugIds:s})=>Ao(ht(e,t)??o,void 0,s,e),Jo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=Do,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,I,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(W(o),e),c=xt(e,t,u);return Ao(q(c,(e=>wo(s,{...qo(r,e),key:e,tableId:i,rowId:e,store:I,debugIds:n}))),d,n,t)},Ko=({indexId:e,indexes:t,sliceComponent:o=Jo,getSliceComponentProps:s,separator:r,debugIds:d})=>Ao(q(qt(e,t),(r=>wo(o,{...qo(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),No=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=Do,getRowComponentProps:r,debugIds:d})=>{const[n,u,,I]=Po(G(o),e),i=Mt(e,t,n);return Ao(h(I)||h(i)?null:wo(s,{...qo(r,i),key:i,tableId:I,rowId:i,store:u,debugIds:d}),void 0,d,t)},Uo=e=>Mo(e,Ft,e.remoteRowId),Xo=e=>Mo(e,Vt,e.firstRowId),Yo=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Ao(o+(Xt(e,t,s,r)??o),void 0,d,s),Zo=({queryId:e,rowId:t,queries:o,resultCellComponent:s=Yo,getResultCellComponentProps:r,separator:d,debugIds:n})=>Ao(q(Ut(e,t,o),(d=>wo(s,{...qo(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),$o=e=>Eo(e,Jt(e.queryId,e.queries)),_o=({cellId:e,descending:t,offset:o,limit:s,...r})=>Eo(r,Kt(r.queryId,e,t,o,s,r.queries)),es=({checkpoints:e,checkpointId:t,debugIds:s})=>Ao(Io(t,e)??o,void 0,s,t),ts=Fo((e=>e[0])),os=Fo((e=>h(e[1])?[]:[e[1]])),ss=Fo((e=>e[2]));export{ts as BackwardCheckpointsView,jo as CellView,es as CheckpointView,os as CurrentCheckpointView,ss as ForwardCheckpointsView,Ko as IndexView,Xo as LinkedRowsView,Uo as LocalRowsView,Go as MetricView,Vo as Provider,No as RemoteRowView,Yo as ResultCellView,Zo as ResultRowView,_o as ResultSortedTableView,$o as ResultTableView,Do as RowView,Jo as SliceView,Oo as SortedTableView,Ho as TableView,Qo as TablesView,Wo as ValueView,zo as ValuesView,je as useAddRowCallback,Se as useCell,Pe as useCellIds,ut as useCellIdsListener,it as useCellListener,Io as useCheckpoint,uo as useCheckpointIds,bo as useCheckpointIdsListener,Co as useCheckpointListener,N as useCheckpoints,no as useCheckpointsIds,U as useCheckpointsOrCheckpointsById,ro as useCreateCheckpoints,vt as useCreateIndexes,kt as useCreateMetrics,mo as useCreatePersister,Ht as useCreateQueries,Bt as useCreateRelationships,ae as useCreateStore,Ke as useDelCellCallback,Je as useDelRowCallback,Ge as useDelTableCallback,ze as useDelTablesCallback,Ue as useDelValueCallback,Ne as useDelValuesCallback,mt as useDidFinishTransactionListener,co as useGoBackwardCallback,lo as useGoForwardCallback,ao as useGoToCallback,xe as useHasCell,It as useHasCellListener,fe as useHasRow,dt as useHasRowListener,me as useHasTable,we as useHasTableCell,tt as useHasTableCellListener,$e as useHasTableListener,ge as useHasTables,Xe as useHasTablesListener,Ee as useHasValue,pt as useHasValueListener,Le as useHasValues,ct as useHasValuesListener,Pt as useIndexIds,Q as useIndexes,ft as useIndexesIds,W as useIndexesOrIndexesById,Vt as useLinkedRowIds,Dt as useLinkedRowIdsListener,Ft as useLocalRowIds,jt as useLocalRowIdsListener,ht as useMetric,wt as useMetricIds,Rt as useMetricListener,H as useMetrics,yt as useMetricsIds,O as useMetricsOrMetricsById,D as useProvideStore,J as useQueries,Ot as useQueriesIds,K as useQueriesOrQueriesById,Qt as useQueryIds,go as useRedoInformation,Et as useRelationshipIds,z as useRelationships,Tt as useRelationshipsIds,G as useRelationshipsOrRelationshipsById,Mt as useRemoteRowId,At as useRemoteRowIdListener,Xt as useResultCell,Ut as useResultCellIds,oo as useResultCellIdsListener,so as useResultCellListener,Nt as useResultRow,Gt as useResultRowCount,$t as useResultRowCountListener,Jt as useResultRowIds,_t as useResultRowIdsListener,to as useResultRowListener,Kt as useResultSortedRowIds,eo as useResultSortedRowIdsListener,Wt as useResultTable,zt as useResultTableCellIds,Zt as useResultTableCellIdsListener,Yt as useResultTableListener,qe as useRow,he as useRowCount,ot as useRowCountListener,Re as useRowIds,st as useRowIdsListener,nt as useRowListener,He as useSetCellCallback,io as useSetCheckpointCallback,De as useSetPartialRowCallback,Qe as useSetPartialValuesCallback,Ae as useSetRowCallback,Ve as useSetTableCallback,Fe as useSetTablesCallback,We as useSetValueCallback,Oe as useSetValuesCallback,qt as useSliceIds,St as useSliceIdsListener,xt as useSliceRowIds,Lt as useSliceRowIdsListener,ve as useSortedRowIds,rt as useSortedRowIdsListener,bt as useStartTransactionListener,A as useStore,pe as useStoreIds,j as useStoreOrStoreById,ke as useTable,ye as useTableCellIds,et as useTableCellIdsListener,Ce as useTableIds,Ze as useTableIdsListener,_e as useTableListener,be as useTables,Ye as useTablesListener,po as useUndoInformation,Me as useValue,Te as useValueIds,at as useValueIdsListener,gt as useValueListener,Be as useValues,lt as useValuesListener,Ct as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",I="has",i="Ids",c="Table",l=c+"s",a=c+i,p="Row",g=p+"Count",b=p+i,C="Sorted"+p+i,m="Cell",k=m+i,y="Value",w=y+"s",h=y+i,R=e=>null==e,v=(e,t,o)=>R(e)?o?.():t(e),f=e=>t(e)==s,q=e=>t(e)==r,P=()=>{},x=(e,t)=>e.map(t),S=Object.keys,L=(e,t)=>v(e,(e=>e[t])),B=(e,t)=>(delete e[t],e),{createContext:T,useContext:E,useEffect:M}=e,F=T([]),V=(e,t)=>{const o=E(F);return R(e)?o[t]:f(e)?L(o[t+1]??{},e):e},A=(e,t)=>{const o=V(e,t);return R(e)||f(e)?o:e},j=e=>S(E(F)[e]??{}),D=e=>V(e,0),H=e=>A(e,0),O=(e,t)=>{const{12:o,13:s}=E(F);M((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},Q=e=>V(e,2),W=e=>A(e,2),z=e=>V(e,4),G=e=>A(e,4),J=e=>V(e,6),K=e=>A(e,6),N=e=>V(e,8),U=e=>A(e,8),X=e=>V(e,10),Y=e=>A(e,10),Z=e=>e.toLowerCase();Z(d);const $="Transaction";Z($);const{useCallback:_,useEffect:ee,useMemo:te,useLayoutEffect:oe,useRef:se,useState:re}=e,de=[],ne={},ue=[[],void 0,[]],Ie=(e,t,o=de)=>{const s=te((()=>t(e)),[e,...o]);return ee((()=>()=>s.destroy()),[s]),s},ie=(e,t,o,s=de,r,d="get",n="")=>{const[,u]=re(),I=_((()=>t?.[d+e]?.(...s)??o),[t,e,...s,o]),i=se();return te((()=>i.current=I()),[I]),ce(n+e,t,((...e)=>{i.current=R(r)?I():e[r],u([])}),[I,r],s),i.current},ce=(e,t,o,s=de,r=de,...n)=>oe((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,e,...r,...s,...n]),le=(e,t,o,s=de,r=P,d=de,...n)=>{const u=H(e);return _((e=>v(u,(s=>v(o(e,s),(o=>r(s["set"+t](...x(n,(t=>q(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},ae=(e,t,o=P,s=de,...r)=>{const d=H(e);return _((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},pe=(e,t,o)=>{const s=Y(e);return _((()=>s?.[t](o)),[s,t,o])},ge=(e,t=de)=>te(e,t),be=()=>j(1),Ce=e=>ie(l,H(e),!1,[],1,I,u),me=e=>ie(l,H(e),ne),ke=e=>ie(a,H(e),de),ye=(e,t)=>ie(c,H(t),!1,[e],2,I,u),we=(e,t)=>ie(c,H(t),ne,[e]),he=(e,t)=>ie(c+k,H(t),de,[e]),Re=(e,t,o)=>ie(c+m,H(o),!1,[e,t],3,I,u),ve=(e,t)=>ie(g,H(t),0,[e]),fe=(e,t)=>ie(b,H(t),de,[e]),qe=(e,t,o,s=0,r,d)=>ie(C,H(d),de,[e,t,o,s,r],6),Pe=(e,t,o)=>ie(p,H(o),!1,[e,t],3,I,u),xe=(e,t,o)=>ie(p,H(o),ne,[e,t]),Se=(e,t,o)=>ie(k,H(o),de,[e,t]),Le=(e,t,o,s)=>ie(m,H(s),!1,[e,t,o],4,I,u),Be=(e,t,o,s)=>ie(m,H(s),void 0,[e,t,o],4),Te=e=>ie(w,H(e),!1,[],1,I,u),Ee=e=>ie(w,H(e),ne),Me=e=>ie(h,H(e),de),Fe=(e,t)=>ie(y,H(t),!1,[e],2,I,u),Ve=(e,t)=>ie(y,H(t),void 0,[e]),Ae=(e,t,o,s,r)=>le(o,l,e,t,s,r),je=(e,t,o,s,r,d)=>le(s,c,t,o,r,d,e),De=(e,t,o,s,r,d,n)=>le(r,p,o,s,d,n,e,t),He=(e,t,o=de,s,r=P,d=de,n=!0)=>{const u=H(s);return _((o=>v(u,(s=>v(t(o,s),(t=>r(s.addRow(q(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},Oe=(e,t,o,s,r,d,n)=>le(r,"PartialRow",o,s,d,n,e,t),Qe=(e,t,o,s,r,d,n,u)=>le(d,m,s,r,n,u,e,t,o),We=(e,t,o,s,r)=>le(o,w,e,t,s,r),ze=(e,t,o,s,r)=>le(o,"PartialValues",e,t,s,r),Ge=(e,t,o,s,r,d)=>le(s,y,t,o,r,d,e),Je=(e,t,o)=>ae(e,l,t,o),Ke=(e,t,o,s)=>ae(t,c,o,s,e),Ne=(e,t,o,s,r)=>ae(o,p,s,r,e,t),Ue=(e,t,o,s,r,d,n)=>ae(r,m,d,n,e,t,o,s),Xe=(e,t,o)=>ae(e,w,t,o),Ye=(e,t,o,s)=>ae(t,y,o,s,e),Ze=(e,t,o,s)=>ce(u+l,H(s),e,t,[],o),$e=(e,t,o,s)=>ce(l,H(s),e,t,de,o),_e=(e,t,o,s)=>ce(a,H(s),e,t,de,o),et=(e,t,o,s,r)=>ce(u+c,H(r),t,o,[e],s),tt=(e,t,o,s,r)=>ce(c,H(r),t,o,[e],s),ot=(e,t,o,s,r)=>ce(c+k,H(r),t,o,[e],s),st=(e,t,o,s,r,d)=>ce(u+c+m,H(d),o,s,[e,t],r),rt=(e,t,o,s,r)=>ce(g,H(r),t,o,[e],s),dt=(e,t,o,s,r)=>ce(b,H(r),t,o,[e],s),nt=(e,t,o,s,r,d,n,u,I)=>ce(C,H(I),d,n,[e,t,o,s,r],u),ut=(e,t,o,s,r,d)=>ce(u+p,H(d),o,s,[e,t],r),It=(e,t,o,s,r,d)=>ce(p,H(d),o,s,[e,t],r),it=(e,t,o,s,r,d)=>ce(k,H(d),o,s,[e,t],r),ct=(e,t,o,s,r,d,n)=>ce(u+m,H(n),s,r,[e,t,o],d),lt=(e,t,o,s,r,d,n)=>ce(m,H(n),s,r,[e,t,o],d),at=(e,t,o,s)=>ce(u+w,H(s),e,t,[],o),pt=(e,t,o,s)=>ce(w,H(s),e,t,de,o),gt=(e,t,o,s)=>ce(h,H(s),e,t,de,o),bt=(e,t,o,s,r)=>ce(u+y,H(r),t,o,[e],s),Ct=(e,t,o,s,r)=>ce(y,H(r),t,o,[e],s),mt=(e,t,o)=>ce("Start"+$,H(o),e,t),kt=(e,t,o)=>ce("WillFinish"+$,H(o),e,t),yt=(e,t,o)=>ce("DidFinish"+$,H(o),e,t),wt=(e,t,o)=>Ie(e,t,o),ht=()=>j(3),Rt=e=>ie("MetricIds",W(e),de),vt=(e,t)=>ie("Metric",W(t),void 0,[e]),ft=(e,t,o,s)=>ce("Metric",W(s),t,o,[e]),qt=(e,t,o)=>Ie(e,t,o),Pt=()=>j(5),xt=(e,t)=>ie("SliceIds",G(t),de,[e]),St=e=>ie("IndexIds",G(e),de),Lt=(e,t,o)=>ie("Slice"+b,G(o),de,[e,t]),Bt=(e,t,o,s)=>ce("SliceIds",G(s),t,o,[e]),Tt=(e,t,o,s,r)=>ce("Slice"+b,G(r),o,s,[e,t]),Et=(e,t,o)=>Ie(e,t,o),Mt=()=>j(7),Ft=e=>ie("RelationshipIds",K(e),de),Vt=(e,t,o)=>ie("RemoteRowId",K(o),void 0,[e,t]),At=(e,t,o)=>ie("Local"+b,K(o),de,[e,t]),jt=(e,t,o)=>ie("Linked"+b,K(o),de,[e,t]),Dt=(e,t,o,s,r)=>ce("RemoteRowId",K(r),o,s,[e,t]),Ht=(e,t,o,s,r)=>ce("Local"+b,K(r),o,s,[e,t]),Ot=(e,t,o,s,r)=>ce("Linked"+b,K(r),o,s,[e,t]),Qt=(e,t,o)=>Ie(e,t,o),Wt=()=>j(9),zt=e=>ie("QueryIds",U(e),de),Gt=(e,t)=>ie(n+c,U(t),ne,[e]),Jt=(e,t)=>ie(n+c+k,U(t),de,[e]),Kt=(e,t)=>ie(n+g,U(t),0,[e]),Nt=(e,t)=>ie(n+b,U(t),de,[e]),Ut=(e,t,o,s=0,r,d)=>ie(n+C,U(d),de,[e,t,o,s,r],6),Xt=(e,t,o)=>ie(n+p,U(o),ne,[e,t]),Yt=(e,t,o)=>ie(n+k,U(o),de,[e,t]),Zt=(e,t,o,s)=>ie(n+m,U(s),void 0,[e,t,o]),$t=(e,t,o,s)=>ce(n+c,U(s),t,o,[e]),_t=(e,t,o,s)=>ce(n+c+k,U(s),t,o,[e]),eo=(e,t,o,s)=>ce(n+g,U(s),t,o,[e]),to=(e,t,o,s)=>ce(n+b,U(s),t,o,[e]),oo=(e,t,o,s,r,d,u,I)=>ce(n+C,U(I),d,u,[e,t,o,s,r]),so=(e,t,o,s,r)=>ce(n+p,U(r),o,s,[e,t]),ro=(e,t,o,s,r)=>ce(n+k,U(r),o,s,[e,t]),no=(e,t,o,s,r,d)=>ce(n+m,U(d),s,r,[e,t,o]),uo=(e,t,o)=>Ie(e,t,o),Io=()=>j(11),io=e=>ie("CheckpointIds",Y(e),ue),co=(e,t)=>ie("Checkpoint",Y(t),void 0,[e]),lo=(e=P,t=de,o,s=P,r=de)=>{const d=Y(o);return _((t=>v(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},ao=e=>pe(e,"goBackward"),po=e=>pe(e,"goForward"),go=(e,t=de,o,s=P,r=de)=>{const d=Y(o);return _((t=>v(d,(o=>v(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},bo=e=>{const t=Y(e),[s,r]=io(t);return[(d=s,!(0==d.length)),ao(t),r,v(r,(e=>t?.getCheckpoint(e)))??o];var d},Co=e=>{const t=Y(e),[,,[s]]=io(t);return[!R(s),po(t),s,v(s,(e=>t?.getCheckpoint(e)))??o]},mo=(e,t,o)=>ce("CheckpointIds",Y(o),e,t),ko=(e,t,o,s)=>ce("Checkpoint",Y(s),t,o,[e]),yo=(e,t,o=de,s,r=de,d,n=de)=>{const[,u]=re(),I=te((()=>t(e)),[e,...o]);return ee((()=>((async()=>{s&&(await s(I),u([]))})(),()=>{I?.destroy(),d?.(I)})),[I,...r,...n]),I},{PureComponent:wo,Fragment:ho,createElement:Ro,useCallback:vo,useLayoutEffect:fo,useRef:qo,useState:Po}=e,xo=(e,...t)=>R(e)?{}:e(...t),So=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Lo,useContext:Bo,useMemo:To,useState:Eo}=e,Mo=({tableId:e,store:t,rowComponent:o=Oo,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Do(x(u,(d=>Ro(o,{...xo(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Fo=({queryId:e,queries:t,resultRowComponent:o=_o,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Do(x(n,(r=>Ro(o,{...xo(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Vo=({relationshipId:e,relationships:t,rowComponent:o=Oo,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[I,i,c]=So(K(t),e),l=n(e,u,I);return Do(x(l,(e=>Ro(o,{...xo(s,e),key:e,tableId:c,rowId:e,store:i,debugIds:d}))),r,d,u)},Ao=e=>({checkpoints:t,checkpointComponent:o=os,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=Y(t);return Do(x(e(io(n)),(e=>Ro(o,{...xo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},jo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:I,queriesById:i,checkpoints:c,checkpointsById:l,children:a})=>{const p=Bo(F),[g,b]=Eo({}),C=Lo(((e,t)=>b((o=>L(o,e)==t?o:{...o,[e]:t}))),[]),m=Lo((e=>b((t=>({...B(t,e)})))),[]);return Ro(F.Provider,{value:To((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},I??p[8],{...p[9],...i},c??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,I,i,c,l,p,C,m])},a)},Do=(e,t,o,s)=>{const r=R(t)||!Array.isArray(e)?e:x(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},Ho=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Do(o+(Be(e,t,s,r)??o),void 0,d,s),Oo=({tableId:e,rowId:t,store:o,cellComponent:s=Ho,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Do(x(((e,t,o,s)=>{const r=Se(t,o,s);return e??r})(d,e,t,o),(d=>Ro(s,{...xo(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),Qo=e=>Mo(e,fe(e.tableId,e.store)),Wo=({cellId:e,descending:t,offset:o,limit:s,...r})=>Mo(r,qe(r.tableId,e,t,o,s,r.store)),zo=({store:e,tableComponent:t=Qo,getTableComponentProps:o,separator:s,debugIds:r})=>Do(x(ke(e),(s=>Ro(t,{...xo(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Go=({valueId:e,store:t,debugIds:s})=>Do(o+(Ve(e,t)??o),void 0,s,e),Jo=({store:e,valueComponent:t=Go,getValueComponentProps:o,separator:s,debugIds:r})=>Do(x(Me(e),(s=>Ro(t,{...xo(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),Ko=({metricId:e,metrics:t,debugIds:s})=>Do(vt(e,t)??o,void 0,s,e),No=({indexId:e,sliceId:t,indexes:o,rowComponent:s=Oo,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,I,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(G(o),e),c=Lt(e,t,u);return Do(x(c,(e=>Ro(s,{...xo(r,e),key:e,tableId:i,rowId:e,store:I,debugIds:n}))),d,n,t)},Uo=({indexId:e,indexes:t,sliceComponent:o=No,getSliceComponentProps:s,separator:r,debugIds:d})=>Do(x(xt(e,t),(r=>Ro(o,{...xo(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),Xo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=Oo,getRowComponentProps:r,debugIds:d})=>{const[n,u,,I]=So(K(o),e),i=Vt(e,t,n);return Do(R(I)||R(i)?null:Ro(s,{...xo(r,i),key:i,tableId:I,rowId:i,store:u,debugIds:d}),void 0,d,t)},Yo=e=>Vo(e,At,e.remoteRowId),Zo=e=>Vo(e,jt,e.firstRowId),$o=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Do(o+(Zt(e,t,s,r)??o),void 0,d,s),_o=({queryId:e,rowId:t,queries:o,resultCellComponent:s=$o,getResultCellComponentProps:r,separator:d,debugIds:n})=>Do(x(Yt(e,t,o),(d=>Ro(s,{...xo(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),es=e=>Fo(e,Nt(e.queryId,e.queries)),ts=({cellId:e,descending:t,offset:o,limit:s,...r})=>Fo(r,Ut(r.queryId,e,t,o,s,r.queries)),os=({checkpoints:e,checkpointId:t,debugIds:s})=>Do(co(t,e)??o,void 0,s,t),ss=Ao((e=>e[0])),rs=Ao((e=>R(e[1])?[]:[e[1]])),ds=Ao((e=>e[2]));export{ss as BackwardCheckpointsView,Ho as CellView,os as CheckpointView,rs as CurrentCheckpointView,ds as ForwardCheckpointsView,Uo as IndexView,Zo as LinkedRowsView,Yo as LocalRowsView,Ko as MetricView,jo as Provider,Xo as RemoteRowView,$o as ResultCellView,_o as ResultRowView,ts as ResultSortedTableView,es as ResultTableView,Oo as RowView,No as SliceView,Wo as SortedTableView,Qo as TableView,zo as TablesView,Go as ValueView,Jo as ValuesView,He as useAddRowCallback,Be as useCell,Se as useCellIds,it as useCellIdsListener,lt as useCellListener,co as useCheckpoint,io as useCheckpointIds,mo as useCheckpointIdsListener,ko as useCheckpointListener,X as useCheckpoints,Io as useCheckpointsIds,Y as useCheckpointsOrCheckpointsById,uo as useCreateCheckpoints,qt as useCreateIndexes,wt as useCreateMetrics,yo as useCreatePersister,Qt as useCreateQueries,Et as useCreateRelationships,ge as useCreateStore,Ue as useDelCellCallback,Ne as useDelRowCallback,Ke as useDelTableCallback,Je as useDelTablesCallback,Ye as useDelValueCallback,Xe as useDelValuesCallback,yt as useDidFinishTransactionListener,ao as useGoBackwardCallback,po as useGoForwardCallback,go as useGoToCallback,Le as useHasCell,ct as useHasCellListener,Pe as useHasRow,ut as useHasRowListener,ye as useHasTable,Re as useHasTableCell,st as useHasTableCellListener,et as useHasTableListener,Ce as useHasTables,Ze as useHasTablesListener,Fe as useHasValue,bt as useHasValueListener,Te as useHasValues,at as useHasValuesListener,St as useIndexIds,z as useIndexes,Pt as useIndexesIds,G as useIndexesOrIndexesById,jt as useLinkedRowIds,Ot as useLinkedRowIdsListener,At as useLocalRowIds,Ht as useLocalRowIdsListener,vt as useMetric,Rt as useMetricIds,ft as useMetricListener,Q as useMetrics,ht as useMetricsIds,W as useMetricsOrMetricsById,O as useProvideStore,N as useQueries,Wt as useQueriesIds,U as useQueriesOrQueriesById,zt as useQueryIds,Co as useRedoInformation,Ft as useRelationshipIds,J as useRelationships,Mt as useRelationshipsIds,K as useRelationshipsOrRelationshipsById,Vt as useRemoteRowId,Dt as useRemoteRowIdListener,Zt as useResultCell,Yt as useResultCellIds,ro as useResultCellIdsListener,no as useResultCellListener,Xt as useResultRow,Kt as useResultRowCount,eo as useResultRowCountListener,Nt as useResultRowIds,to as useResultRowIdsListener,so as useResultRowListener,Ut as useResultSortedRowIds,oo as useResultSortedRowIdsListener,Gt as useResultTable,Jt as useResultTableCellIds,_t as useResultTableCellIdsListener,$t as useResultTableListener,xe as useRow,ve as useRowCount,rt as useRowCountListener,fe as useRowIds,dt as useRowIdsListener,It as useRowListener,Qe as useSetCellCallback,lo as useSetCheckpointCallback,Oe as useSetPartialRowCallback,ze as useSetPartialValuesCallback,De as useSetRowCallback,je as useSetTableCallback,Ae as useSetTablesCallback,Ge as useSetValueCallback,We as useSetValuesCallback,xt as useSliceIds,Bt as useSliceIdsListener,Lt as useSliceRowIds,Tt as useSliceRowIdsListener,qe as useSortedRowIds,nt as useSortedRowIdsListener,mt as useStartTransactionListener,D as useStore,be as useStoreIds,H as useStoreOrStoreById,we as useTable,he as useTableCellIds,ot as useTableCellIdsListener,ke as useTableIds,_e as useTableIdsListener,tt as useTableListener,me as useTables,$e as useTablesListener,bo as useUndoInformation,Ve as useValue,Me as useValueIds,gt as useValueIdsListener,Ct as useValueListener,Ee as useValues,pt as useValuesListener,kt as useWillFinishTransactionListener};
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",u=t(o),r="Listener",l="Result",d="Has",n="has",i="Ids",a="Table",c=a+"s",I=a+i,C="Row",b=C+"Count",p=C+i,w="Sorted"+C+i,R="Cell",k=R+i,g="Value",L=g+"s",h=g+i,m=e=>null==e,y=(e,s,t)=>m(e)?t?.():s(e),T=e=>t(e)==u,V=()=>{},S=(e,s)=>e.map(s),f=Object.keys,v=(e,s)=>y(e,(e=>e[s])),x=(e,s)=>(delete e[s],e),{createContext:P,useContext:q,useEffect:B}=s,H=P([]),M=(e,s)=>{const t=q(H);return m(e)?t[s]:T(e)?v(t[s+1]??{},e):e},D=(e,s)=>{const t=M(e,s);return m(e)||T(e)?t:e},F=e=>f(q(H)[e]??{}),O=e=>D(e,0),Q=e=>D(e,2),E=e=>D(e,4),A=e=>D(e,6),G=e=>D(e,8),j=e=>D(e,10),U=e=>e.toLowerCase();U(r);const W="Transaction";U(W);const{useCallback:z,useEffect:J,useMemo:K,useLayoutEffect:N,useRef:X,useState:Y}=s,Z=[],$={},_=[[],void 0,[]],ee=(e,s,t=Z)=>{const o=K((()=>s(e)),[e,...t]);return J((()=>()=>o.destroy()),[o]),o},se=(e,s,t,o=Z,u,r="get",l="")=>{const[,d]=Y(),n=z((()=>s?.[r+e]?.(...o)??t),[s,e,...o,t]),i=X();return K((()=>i.current=n()),[n]),te(l+e,s,((...e)=>{i.current=m(u)?n():e[u],d([])}),[n,u],o),i.current},te=(e,s,t,o=Z,u=Z,...l)=>N((()=>{const o=s?.["add"+e+r]?.(...u,t,...l);return()=>s?.delListener(o)}),[s,e,...u,...o,...l]),oe=(e,s,t,o=Z,u=V,r=Z,...l)=>{const d=O(e);return z((e=>y(d,(o=>y(t(e,o),(e=>u(o["set"+s](...l,e),e)))))),[d,s,...o,...r,...l])},ue=(e,s,t=V,o=Z,...u)=>{const r=O(e);return z((()=>t(r?.["del"+s](...u))),[r,s,...o,...u])},re=(e,s,t)=>{const o=j(e);return z((()=>o?.[s](t)),[o,s,t])},le=e=>se(I,O(e),Z),de=(e,s)=>se(p,O(s),Z,[e]),ne=(e,s,t,o=0,u,r)=>se(w,O(r),Z,[e,s,t,o,u],6),ie=(e,s,t)=>se(k,O(t),Z,[e,s]),ae=(e,s,t,o)=>se(R,O(o),void 0,[e,s,t],4),ce=e=>se(h,O(e),Z),Ie=(e,s)=>se(g,O(s),void 0,[e]),Ce=(e,s)=>se("Metric",Q(s),void 0,[e]),be=(e,s)=>se("SliceIds",E(s),Z,[e]),pe=(e,s,t)=>se("Slice"+p,E(t),Z,[e,s]),we=(e,s,t)=>se("RemoteRowId",A(t),void 0,[e,s]),Re=(e,s,t)=>se("Local"+p,A(t),Z,[e,s]),ke=(e,s,t)=>se("Linked"+p,A(t),Z,[e,s]),ge=(e,s)=>se(l+p,G(s),Z,[e]),Le=(e,s,t,o=0,u,r)=>se(l+w,G(r),Z,[e,s,t,o,u],6),he=(e,s,t)=>se(l+k,G(t),Z,[e,s]),me=(e,s,t,o)=>se(l+R,G(o),void 0,[e,s,t]),ye=e=>se("CheckpointIds",j(e),_),Te=(e,s)=>se("Checkpoint",j(s),void 0,[e]),Ve=e=>re(e,"goBackward"),Se=e=>re(e,"goForward"),{PureComponent:fe,Fragment:ve,createElement:xe,useCallback:Pe,useLayoutEffect:qe,useRef:Be,useState:He}=s,Me=(e,...s)=>m(e)?{}:e(...s),De=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Fe,useContext:Oe,useMemo:Qe,useState:Ee}=s,Ae=({tableId:e,store:s,rowComponent:t=Je,getRowComponentProps:o,customCellIds:u,separator:r,debugIds:l},d)=>We(S(d,(r=>xe(t,{...Me(o,r),key:r,tableId:e,rowId:r,customCellIds:u,store:s,debugIds:l}))),r,l,e),Ge=({queryId:e,queries:s,resultRowComponent:t=Ze,getResultRowComponentProps:o,separator:u,debugIds:r},l)=>We(S(l,(u=>xe(t,{...Me(o,u),key:u,queryId:e,rowId:u,queries:s,debugIds:r}))),u,r,e),je=({relationshipId:e,relationships:s,rowComponent:t=Je,getRowComponentProps:o,separator:u,debugIds:r},l,d)=>{const[n,i,a]=De(A(s),e),c=l(e,d,n);return We(S(c,(e=>xe(t,{...Me(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),u,r,d)},Ue=e=>({checkpoints:s,checkpointComponent:t=$e,getCheckpointComponentProps:o,separator:u,debugIds:r})=>{const l=j(s);return We(S(e(ye(l)),(e=>xe(t,{...Me(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:r}))),u)},We=(e,s,t,o)=>{const u=m(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",u,"}"]:u},ze=({tableId:e,rowId:s,cellId:t,store:u,debugIds:r})=>We(o+(ae(e,s,t,u)??o),void 0,r,t),Je=({tableId:e,rowId:s,store:t,cellComponent:o=ze,getCellComponentProps:u,customCellIds:r,separator:l,debugIds:d})=>We(S(((e,s,t,o)=>{const u=ie(s,t,o);return e??u})(r,e,s,t),(r=>xe(o,{...Me(u,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d}))),l,d,s),Ke=e=>Ae(e,de(e.tableId,e.store)),Ne=({valueId:e,store:s,debugIds:t})=>We(o+(Ie(e,s)??o),void 0,t,e),Xe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Je,getRowComponentProps:u,separator:r,debugIds:l})=>{const[d,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(E(t),e),a=pe(e,s,d);return We(S(a,(e=>xe(o,{...Me(u,e),key:e,tableId:i,rowId:e,store:n,debugIds:l}))),r,l,s)},Ye=({queryId:e,rowId:s,cellId:t,queries:u,debugIds:r})=>We(o+(me(e,s,t,u)??o),void 0,r,t),Ze=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ye,getResultCellComponentProps:u,separator:r,debugIds:l})=>We(S(he(e,s,t),(r=>xe(o,{...Me(u,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:l}))),r,l,s),$e=({checkpoints:e,checkpointId:s,debugIds:t})=>We(Te(s,e)??o,void 0,t,s),_e=Ue((e=>e[0])),es=Ue((e=>m(e[1])?[]:[e[1]])),ss=Ue((e=>e[2]));e.BackwardCheckpointsView=_e,e.CellView=ze,e.CheckpointView=$e,e.CurrentCheckpointView=es,e.ForwardCheckpointsView=ss,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Xe,getSliceComponentProps:o,separator:u,debugIds:r})=>We(S(be(e,s),(u=>xe(t,{...Me(o,u),key:u,indexId:e,sliceId:u,indexes:s,debugIds:r}))),u,r,e),e.LinkedRowsView=e=>je(e,ke,e.firstRowId),e.LocalRowsView=e=>je(e,Re,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>We(Ce(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:u,indexesById:r,relationships:l,relationshipsById:d,queries:n,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Oe(H),[b,p]=Ee({}),w=Fe(((e,s)=>p((t=>v(t,e)==s?t:{...t,[e]:s}))),[]),R=Fe((e=>p((s=>({...x(s,e)})))),[]);return xe(H.Provider,{value:Qe((()=>[e??C[0],{...C[1],...s,...b},t??C[2],{...C[3],...o},u??C[4],{...C[5],...r},l??C[6],{...C[7],...d},n??C[8],{...C[9],...i},a??C[10],{...C[11],...c},w,R]),[e,s,b,t,o,u,r,l,d,n,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Je,getRowComponentProps:u,debugIds:r})=>{const[l,d,,n]=De(A(t),e),i=we(e,s,l);return We(m(n)||m(i)?null:xe(o,{...Me(u,i),key:i,tableId:n,rowId:i,store:d,debugIds:r}),void 0,r,s)},e.ResultCellView=Ye,e.ResultRowView=Ze,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...u})=>Ge(u,Le(u.queryId,e,s,t,o,u.queries)),e.ResultTableView=e=>Ge(e,ge(e.queryId,e.queries)),e.RowView=Je,e.SliceView=Xe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...u})=>Ae(u,ne(u.tableId,e,s,t,o,u.store)),e.TableView=Ke,e.TablesView=({store:e,tableComponent:s=Ke,getTableComponentProps:t,separator:o,debugIds:u})=>We(S(le(e),(o=>xe(s,{...Me(t,o),key:o,tableId:o,store:e,debugIds:u}))),o),e.ValueView=Ne,e.ValuesView=({store:e,valueComponent:s=Ne,getValueComponentProps:t,separator:o,debugIds:u})=>We(S(ce(e),(o=>xe(s,{...Me(t,o),key:o,valueId:o,store:e,debugIds:u}))),o),e.useAddRowCallback=(e,s,t=Z,o,u=V,r=Z,l=!0)=>{const d=O(o);return z((t=>y(d,(o=>y(s(t,o),(s=>u(o.addRow(e,s,l),o,s)))))),[d,e,...t,...r,l])},e.useCell=ae,e.useCellIds=ie,e.useCellIdsListener=(e,s,t,o,u,r)=>te(k,O(r),t,o,[e,s],u),e.useCellListener=(e,s,t,o,u,r,l)=>te(R,O(l),o,u,[e,s,t],r),e.useCheckpoint=Te,e.useCheckpointIds=ye,e.useCheckpointIdsListener=(e,s,t)=>te("CheckpointIds",j(t),e,s),e.useCheckpointListener=(e,s,t,o)=>te("Checkpoint",j(o),s,t,[e]),e.useCheckpoints=e=>M(e,10),e.useCheckpointsIds=()=>F(11),e.useCheckpointsOrCheckpointsById=j,e.useCreateCheckpoints=(e,s,t)=>ee(e,s,t),e.useCreateIndexes=(e,s,t)=>ee(e,s,t),e.useCreateMetrics=(e,s,t)=>ee(e,s,t),e.useCreatePersister=(e,s,t=Z,o,u=Z,r,l=Z)=>{const[,d]=Y(),n=K((()=>s(e)),[e,...t]);return J((()=>((async()=>{o&&(await o(n),d([]))})(),()=>{n?.destroy(),r?.(n)})),[n,...u,...l]),n},e.useCreateQueries=(e,s,t)=>ee(e,s,t),e.useCreateRelationships=(e,s,t)=>ee(e,s,t),e.useCreateStore=(e,s=Z)=>K(e,s),e.useDelCellCallback=(e,s,t,o,u,r,l)=>ue(u,R,r,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,u)=>ue(t,C,o,u,e,s),e.useDelTableCallback=(e,s,t,o)=>ue(s,a,t,o,e),e.useDelTablesCallback=(e,s,t)=>ue(e,c,s,t),e.useDelValueCallback=(e,s,t,o)=>ue(s,g,t,o,e),e.useDelValuesCallback=(e,s,t)=>ue(e,L,s,t),e.useDidFinishTransactionListener=(e,s,t)=>te("DidFinish"+W,O(t),e,s),e.useGoBackwardCallback=Ve,e.useGoForwardCallback=Se,e.useGoToCallback=(e,s=Z,t,o=V,u=Z)=>{const r=j(t);return z((s=>y(r,(t=>y(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...u])},e.useHasCell=(e,s,t,o)=>se(R,O(o),!1,[e,s,t],4,n,d),e.useHasCellListener=(e,s,t,o,u,r,l)=>te(d+R,O(l),o,u,[e,s,t],r),e.useHasRow=(e,s,t)=>se(C,O(t),!1,[e,s],3,n,d),e.useHasRowListener=(e,s,t,o,u,r)=>te(d+C,O(r),t,o,[e,s],u),e.useHasTable=(e,s)=>se(a,O(s),!1,[e],2,n,d),e.useHasTableCell=(e,s,t)=>se(a+R,O(t),!1,[e,s],3,n,d),e.useHasTableCellListener=(e,s,t,o,u,r)=>te(d+a+R,O(r),t,o,[e,s],u),e.useHasTableListener=(e,s,t,o,u)=>te(d+a,O(u),s,t,[e],o),e.useHasTables=e=>se(c,O(e),!1,[],1,n,d),e.useHasTablesListener=(e,s,t,o)=>te(d+c,O(o),e,s,[],t),e.useHasValue=(e,s)=>se(g,O(s),!1,[e],2,n,d),e.useHasValueListener=(e,s,t,o,u)=>te(d+g,O(u),s,t,[e],o),e.useHasValues=e=>se(L,O(e),!1,[],1,n,d),e.useHasValuesListener=(e,s,t,o)=>te(d+L,O(o),e,s,[],t),e.useIndexIds=e=>se("IndexIds",E(e),Z),e.useIndexes=e=>M(e,4),e.useIndexesIds=()=>F(5),e.useIndexesOrIndexesById=E,e.useLinkedRowIds=ke,e.useLinkedRowIdsListener=(e,s,t,o,u)=>te("Linked"+p,A(u),t,o,[e,s]),e.useLocalRowIds=Re,e.useLocalRowIdsListener=(e,s,t,o,u)=>te("Local"+p,A(u),t,o,[e,s]),e.useMetric=Ce,e.useMetricIds=e=>se("MetricIds",Q(e),Z),e.useMetricListener=(e,s,t,o)=>te("Metric",Q(o),s,t,[e]),e.useMetrics=e=>M(e,2),e.useMetricsIds=()=>F(3),e.useMetricsOrMetricsById=Q,e.useProvideStore=(e,s)=>{const{12:t,13:o}=q(H);B((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>M(e,8),e.useQueriesIds=()=>F(9),e.useQueriesOrQueriesById=G,e.useQueryIds=e=>se("QueryIds",G(e),Z),e.useRedoInformation=e=>{const s=j(e),[,,[t]]=ye(s);return[!m(t),Se(s),t,y(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>se("RelationshipIds",A(e),Z),e.useRelationships=e=>M(e,6),e.useRelationshipsIds=()=>F(7),e.useRelationshipsOrRelationshipsById=A,e.useRemoteRowId=we,e.useRemoteRowIdListener=(e,s,t,o,u)=>te("RemoteRowId",A(u),t,o,[e,s]),e.useResultCell=me,e.useResultCellIds=he,e.useResultCellIdsListener=(e,s,t,o,u)=>te(l+k,G(u),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,u,r)=>te(l+R,G(r),o,u,[e,s,t]),e.useResultRow=(e,s,t)=>se(l+C,G(t),$,[e,s]),e.useResultRowCount=(e,s)=>se(l+b,G(s),0,[e]),e.useResultRowCountListener=(e,s,t,o)=>te(l+b,G(o),s,t,[e]),e.useResultRowIds=ge,e.useResultRowIdsListener=(e,s,t,o)=>te(l+p,G(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,u)=>te(l+C,G(u),t,o,[e,s]),e.useResultSortedRowIds=Le,e.useResultSortedRowIdsListener=(e,s,t,o,u,r,d,n)=>te(l+w,G(n),r,d,[e,s,t,o,u]),e.useResultTable=(e,s)=>se(l+a,G(s),$,[e]),e.useResultTableCellIds=(e,s)=>se(l+a+k,G(s),Z,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>te(l+a+k,G(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>te(l+a,G(o),s,t,[e]),e.useRow=(e,s,t)=>se(C,O(t),$,[e,s]),e.useRowCount=(e,s)=>se(b,O(s),0,[e]),e.useRowCountListener=(e,s,t,o,u)=>te(b,O(u),s,t,[e],o),e.useRowIds=de,e.useRowIdsListener=(e,s,t,o,u)=>te(p,O(u),s,t,[e],o),e.useRowListener=(e,s,t,o,u,r)=>te(C,O(r),t,o,[e,s],u),e.useSetCellCallback=(e,s,t,o,u,r,l,d)=>oe(r,R,o,u,l,d,e,s,t),e.useSetCheckpointCallback=(e=V,s=Z,t,o=V,u=Z)=>{const r=j(t);return z((s=>y(r,(t=>{const u=e(s);o(t.addCheckpoint(u),t,u)}))),[r,...s,...u])},e.useSetPartialRowCallback=(e,s,t,o,u,r,l)=>oe(u,"PartialRow",t,o,r,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,u)=>oe(t,"PartialValues",e,s,o,u),e.useSetRowCallback=(e,s,t,o,u,r,l)=>oe(u,C,t,o,r,l,e,s),e.useSetTableCallback=(e,s,t,o,u,r)=>oe(o,a,s,t,u,r,e),e.useSetTablesCallback=(e,s,t,o,u)=>oe(t,c,e,s,o,u),e.useSetValueCallback=(e,s,t,o,u,r)=>oe(o,g,s,t,u,r,e),e.useSetValuesCallback=(e,s,t,o,u)=>oe(t,L,e,s,o,u),e.useSliceIds=be,e.useSliceIdsListener=(e,s,t,o)=>te("SliceIds",E(o),s,t,[e]),e.useSliceRowIds=pe,e.useSliceRowIdsListener=(e,s,t,o,u)=>te("Slice"+p,E(u),t,o,[e,s]),e.useSortedRowIds=ne,e.useSortedRowIdsListener=(e,s,t,o,u,r,l,d,n)=>te(w,O(n),r,l,[e,s,t,o,u],d),e.useStartTransactionListener=(e,s,t)=>te("Start"+W,O(t),e,s),e.useStore=e=>M(e,0),e.useStoreIds=()=>F(1),e.useStoreOrStoreById=O,e.useTable=(e,s)=>se(a,O(s),$,[e]),e.useTableCellIds=(e,s)=>se(a+k,O(s),Z,[e]),e.useTableCellIdsListener=(e,s,t,o,u)=>te(a+k,O(u),s,t,[e],o),e.useTableIds=le,e.useTableIdsListener=(e,s,t,o)=>te(I,O(o),e,s,Z,t),e.useTableListener=(e,s,t,o,u)=>te(a,O(u),s,t,[e],o),e.useTables=e=>se(c,O(e),$),e.useTablesListener=(e,s,t,o)=>te(c,O(o),e,s,Z,t),e.useUndoInformation=e=>{const s=j(e),[t,u]=ye(s);return[(r=t,!(0==r.length)),Ve(s),u,y(u,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=Ie,e.useValueIds=ce,e.useValueIdsListener=(e,s,t,o)=>te(h,O(o),e,s,Z,t),e.useValueListener=(e,s,t,o,u)=>te(g,O(u),s,t,[e],o),e.useValues=e=>se(L,O(e),$),e.useValuesListener=(e,s,t,o)=>te(L,O(o),e,s,Z,t),e.useWillFinishTransactionListener=(e,s,t)=>te("WillFinish"+W,O(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="",u=t(o),r=t(t),l="Listener",d="Result",n="Has",i="has",a="Ids",c="Table",I=c+"s",C=c+a,b="Row",p=b+"Count",w=b+a,R="Sorted"+b+a,k="Cell",g=k+a,L="Value",h=L+"s",m=L+a,y=e=>null==e,T=(e,s,t)=>y(e)?t?.():s(e),V=e=>t(e)==u,S=e=>t(e)==r,f=()=>{},v=(e,s)=>e.map(s),x=Object.keys,P=(e,s)=>T(e,(e=>e[s])),q=(e,s)=>(delete e[s],e),{createContext:B,useContext:H,useEffect:M}=s,D=B([]),F=(e,s)=>{const t=H(D);return y(e)?t[s]:V(e)?P(t[s+1]??{},e):e},O=(e,s)=>{const t=F(e,s);return y(e)||V(e)?t:e},Q=e=>x(H(D)[e]??{}),E=e=>O(e,0),A=e=>O(e,2),G=e=>O(e,4),j=e=>O(e,6),U=e=>O(e,8),W=e=>O(e,10),z=e=>e.toLowerCase();z(l);const J="Transaction";z(J);const{useCallback:K,useEffect:N,useMemo:X,useLayoutEffect:Y,useRef:Z,useState:$}=s,_=[],ee={},se=[[],void 0,[]],te=(e,s,t=_)=>{const o=X((()=>s(e)),[e,...t]);return N((()=>()=>o.destroy()),[o]),o},oe=(e,s,t,o=_,u,r="get",l="")=>{const[,d]=$(),n=K((()=>s?.[r+e]?.(...o)??t),[s,e,...o,t]),i=Z();return X((()=>i.current=n()),[n]),ue(l+e,s,((...e)=>{i.current=y(u)?n():e[u],d([])}),[n,u],o),i.current},ue=(e,s,t,o=_,u=_,...r)=>Y((()=>{const o=s?.["add"+e+l]?.(...u,t,...r);return()=>s?.delListener(o)}),[s,e,...u,...o,...r]),re=(e,s,t,o=_,u=f,r=_,...l)=>{const d=E(e);return K((e=>T(d,(o=>T(t(e,o),(t=>u(o["set"+s](...v(l,(s=>S(s)?s(e,o):s)),t),t)))))),[d,s,...o,...r,...l])},le=(e,s,t=f,o=_,...u)=>{const r=E(e);return K((()=>t(r?.["del"+s](...u))),[r,s,...o,...u])},de=(e,s,t)=>{const o=W(e);return K((()=>o?.[s](t)),[o,s,t])},ne=e=>oe(C,E(e),_),ie=(e,s)=>oe(w,E(s),_,[e]),ae=(e,s,t,o=0,u,r)=>oe(R,E(r),_,[e,s,t,o,u],6),ce=(e,s,t)=>oe(g,E(t),_,[e,s]),Ie=(e,s,t,o)=>oe(k,E(o),void 0,[e,s,t],4),Ce=e=>oe(m,E(e),_),be=(e,s)=>oe(L,E(s),void 0,[e]),pe=(e,s)=>oe("Metric",A(s),void 0,[e]),we=(e,s)=>oe("SliceIds",G(s),_,[e]),Re=(e,s,t)=>oe("Slice"+w,G(t),_,[e,s]),ke=(e,s,t)=>oe("RemoteRowId",j(t),void 0,[e,s]),ge=(e,s,t)=>oe("Local"+w,j(t),_,[e,s]),Le=(e,s,t)=>oe("Linked"+w,j(t),_,[e,s]),he=(e,s)=>oe(d+w,U(s),_,[e]),me=(e,s,t,o=0,u,r)=>oe(d+R,U(r),_,[e,s,t,o,u],6),ye=(e,s,t)=>oe(d+g,U(t),_,[e,s]),Te=(e,s,t,o)=>oe(d+k,U(o),void 0,[e,s,t]),Ve=e=>oe("CheckpointIds",W(e),se),Se=(e,s)=>oe("Checkpoint",W(s),void 0,[e]),fe=e=>de(e,"goBackward"),ve=e=>de(e,"goForward"),{PureComponent:xe,Fragment:Pe,createElement:qe,useCallback:Be,useLayoutEffect:He,useRef:Me,useState:De}=s,Fe=(e,...s)=>y(e)?{}:e(...s),Oe=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:Qe,useContext:Ee,useMemo:Ae,useState:Ge}=s,je=({tableId:e,store:s,rowComponent:t=Ne,getRowComponentProps:o,customCellIds:u,separator:r,debugIds:l},d)=>Je(v(d,(r=>qe(t,{...Fe(o,r),key:r,tableId:e,rowId:r,customCellIds:u,store:s,debugIds:l}))),r,l,e),Ue=({queryId:e,queries:s,resultRowComponent:t=_e,getResultRowComponentProps:o,separator:u,debugIds:r},l)=>Je(v(l,(u=>qe(t,{...Fe(o,u),key:u,queryId:e,rowId:u,queries:s,debugIds:r}))),u,r,e),We=({relationshipId:e,relationships:s,rowComponent:t=Ne,getRowComponentProps:o,separator:u,debugIds:r},l,d)=>{const[n,i,a]=Oe(j(s),e),c=l(e,d,n);return Je(v(c,(e=>qe(t,{...Fe(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),u,r,d)},ze=e=>({checkpoints:s,checkpointComponent:t=es,getCheckpointComponentProps:o,separator:u,debugIds:r})=>{const l=W(s);return Je(v(e(Ve(l)),(e=>qe(t,{...Fe(o,e),key:e,checkpoints:l,checkpointId:e,debugIds:r}))),u)},Je=(e,s,t,o)=>{const u=y(s)||!Array.isArray(e)?e:v(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",u,"}"]:u},Ke=({tableId:e,rowId:s,cellId:t,store:u,debugIds:r})=>Je(o+(Ie(e,s,t,u)??o),void 0,r,t),Ne=({tableId:e,rowId:s,store:t,cellComponent:o=Ke,getCellComponentProps:u,customCellIds:r,separator:l,debugIds:d})=>Je(v(((e,s,t,o)=>{const u=ce(s,t,o);return e??u})(r,e,s,t),(r=>qe(o,{...Fe(u,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d}))),l,d,s),Xe=e=>je(e,ie(e.tableId,e.store)),Ye=({valueId:e,store:s,debugIds:t})=>Je(o+(be(e,s)??o),void 0,t,e),Ze=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ne,getRowComponentProps:u,separator:r,debugIds:l})=>{const[d,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(G(t),e),a=Re(e,s,d);return Je(v(a,(e=>qe(o,{...Fe(u,e),key:e,tableId:i,rowId:e,store:n,debugIds:l}))),r,l,s)},$e=({queryId:e,rowId:s,cellId:t,queries:u,debugIds:r})=>Je(o+(Te(e,s,t,u)??o),void 0,r,t),_e=({queryId:e,rowId:s,queries:t,resultCellComponent:o=$e,getResultCellComponentProps:u,separator:r,debugIds:l})=>Je(v(ye(e,s,t),(r=>qe(o,{...Fe(u,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:l}))),r,l,s),es=({checkpoints:e,checkpointId:s,debugIds:t})=>Je(Se(s,e)??o,void 0,t,s),ss=ze((e=>e[0])),ts=ze((e=>y(e[1])?[]:[e[1]])),os=ze((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:u,debugIds:r})=>Je(v(we(e,s),(u=>qe(t,{...Fe(o,u),key:u,indexId:e,sliceId:u,indexes:s,debugIds:r}))),u,r,e),e.LinkedRowsView=e=>We(e,Le,e.firstRowId),e.LocalRowsView=e=>We(e,ge,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Je(pe(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:o,indexes:u,indexesById:r,relationships:l,relationshipsById:d,queries:n,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Ee(D),[b,p]=Ge({}),w=Qe(((e,s)=>p((t=>P(t,e)==s?t:{...t,[e]:s}))),[]),R=Qe((e=>p((s=>({...q(s,e)})))),[]);return qe(D.Provider,{value:Ae((()=>[e??C[0],{...C[1],...s,...b},t??C[2],{...C[3],...o},u??C[4],{...C[5],...r},l??C[6],{...C[7],...d},n??C[8],{...C[9],...i},a??C[10],{...C[11],...c},w,R]),[e,s,b,t,o,u,r,l,d,n,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ne,getRowComponentProps:u,debugIds:r})=>{const[l,d,,n]=Oe(j(t),e),i=ke(e,s,l);return Je(y(n)||y(i)?null:qe(o,{...Fe(u,i),key:i,tableId:n,rowId:i,store:d,debugIds:r}),void 0,r,s)},e.ResultCellView=$e,e.ResultRowView=_e,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...u})=>Ue(u,me(u.queryId,e,s,t,o,u.queries)),e.ResultTableView=e=>Ue(e,he(e.queryId,e.queries)),e.RowView=Ne,e.SliceView=Ze,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...u})=>je(u,ae(u.tableId,e,s,t,o,u.store)),e.TableView=Xe,e.TablesView=({store:e,tableComponent:s=Xe,getTableComponentProps:t,separator:o,debugIds:u})=>Je(v(ne(e),(o=>qe(s,{...Fe(t,o),key:o,tableId:o,store:e,debugIds:u}))),o),e.ValueView=Ye,e.ValuesView=({store:e,valueComponent:s=Ye,getValueComponentProps:t,separator:o,debugIds:u})=>Je(v(Ce(e),(o=>qe(s,{...Fe(t,o),key:o,valueId:o,store:e,debugIds:u}))),o),e.useAddRowCallback=(e,s,t=_,o,u=f,r=_,l=!0)=>{const d=E(o);return K((t=>T(d,(o=>T(s(t,o),(s=>u(o.addRow(S(e)?e(t,o):e,s,l),o,s)))))),[d,e,...t,...r,l])},e.useCell=Ie,e.useCellIds=ce,e.useCellIdsListener=(e,s,t,o,u,r)=>ue(g,E(r),t,o,[e,s],u),e.useCellListener=(e,s,t,o,u,r,l)=>ue(k,E(l),o,u,[e,s,t],r),e.useCheckpoint=Se,e.useCheckpointIds=Ve,e.useCheckpointIdsListener=(e,s,t)=>ue("CheckpointIds",W(t),e,s),e.useCheckpointListener=(e,s,t,o)=>ue("Checkpoint",W(o),s,t,[e]),e.useCheckpoints=e=>F(e,10),e.useCheckpointsIds=()=>Q(11),e.useCheckpointsOrCheckpointsById=W,e.useCreateCheckpoints=(e,s,t)=>te(e,s,t),e.useCreateIndexes=(e,s,t)=>te(e,s,t),e.useCreateMetrics=(e,s,t)=>te(e,s,t),e.useCreatePersister=(e,s,t=_,o,u=_,r,l=_)=>{const[,d]=$(),n=X((()=>s(e)),[e,...t]);return N((()=>((async()=>{o&&(await o(n),d([]))})(),()=>{n?.destroy(),r?.(n)})),[n,...u,...l]),n},e.useCreateQueries=(e,s,t)=>te(e,s,t),e.useCreateRelationships=(e,s,t)=>te(e,s,t),e.useCreateStore=(e,s=_)=>X(e,s),e.useDelCellCallback=(e,s,t,o,u,r,l)=>le(u,k,r,l,e,s,t,o),e.useDelRowCallback=(e,s,t,o,u)=>le(t,b,o,u,e,s),e.useDelTableCallback=(e,s,t,o)=>le(s,c,t,o,e),e.useDelTablesCallback=(e,s,t)=>le(e,I,s,t),e.useDelValueCallback=(e,s,t,o)=>le(s,L,t,o,e),e.useDelValuesCallback=(e,s,t)=>le(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>ue("DidFinish"+J,E(t),e,s),e.useGoBackwardCallback=fe,e.useGoForwardCallback=ve,e.useGoToCallback=(e,s=_,t,o=f,u=_)=>{const r=W(t);return K((s=>T(r,(t=>T(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...u])},e.useHasCell=(e,s,t,o)=>oe(k,E(o),!1,[e,s,t],4,i,n),e.useHasCellListener=(e,s,t,o,u,r,l)=>ue(n+k,E(l),o,u,[e,s,t],r),e.useHasRow=(e,s,t)=>oe(b,E(t),!1,[e,s],3,i,n),e.useHasRowListener=(e,s,t,o,u,r)=>ue(n+b,E(r),t,o,[e,s],u),e.useHasTable=(e,s)=>oe(c,E(s),!1,[e],2,i,n),e.useHasTableCell=(e,s,t)=>oe(c+k,E(t),!1,[e,s],3,i,n),e.useHasTableCellListener=(e,s,t,o,u,r)=>ue(n+c+k,E(r),t,o,[e,s],u),e.useHasTableListener=(e,s,t,o,u)=>ue(n+c,E(u),s,t,[e],o),e.useHasTables=e=>oe(I,E(e),!1,[],1,i,n),e.useHasTablesListener=(e,s,t,o)=>ue(n+I,E(o),e,s,[],t),e.useHasValue=(e,s)=>oe(L,E(s),!1,[e],2,i,n),e.useHasValueListener=(e,s,t,o,u)=>ue(n+L,E(u),s,t,[e],o),e.useHasValues=e=>oe(h,E(e),!1,[],1,i,n),e.useHasValuesListener=(e,s,t,o)=>ue(n+h,E(o),e,s,[],t),e.useIndexIds=e=>oe("IndexIds",G(e),_),e.useIndexes=e=>F(e,4),e.useIndexesIds=()=>Q(5),e.useIndexesOrIndexesById=G,e.useLinkedRowIds=Le,e.useLinkedRowIdsListener=(e,s,t,o,u)=>ue("Linked"+w,j(u),t,o,[e,s]),e.useLocalRowIds=ge,e.useLocalRowIdsListener=(e,s,t,o,u)=>ue("Local"+w,j(u),t,o,[e,s]),e.useMetric=pe,e.useMetricIds=e=>oe("MetricIds",A(e),_),e.useMetricListener=(e,s,t,o)=>ue("Metric",A(o),s,t,[e]),e.useMetrics=e=>F(e,2),e.useMetricsIds=()=>Q(3),e.useMetricsOrMetricsById=A,e.useProvideStore=(e,s)=>{const{12:t,13:o}=H(D);M((()=>(t?.(e,s),()=>o?.(e))),[t,e,s,o])},e.useQueries=e=>F(e,8),e.useQueriesIds=()=>Q(9),e.useQueriesOrQueriesById=U,e.useQueryIds=e=>oe("QueryIds",U(e),_),e.useRedoInformation=e=>{const s=W(e),[,,[t]]=Ve(s);return[!y(t),ve(s),t,T(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>oe("RelationshipIds",j(e),_),e.useRelationships=e=>F(e,6),e.useRelationshipsIds=()=>Q(7),e.useRelationshipsOrRelationshipsById=j,e.useRemoteRowId=ke,e.useRemoteRowIdListener=(e,s,t,o,u)=>ue("RemoteRowId",j(u),t,o,[e,s]),e.useResultCell=Te,e.useResultCellIds=ye,e.useResultCellIdsListener=(e,s,t,o,u)=>ue(d+g,U(u),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,u,r)=>ue(d+k,U(r),o,u,[e,s,t]),e.useResultRow=(e,s,t)=>oe(d+b,U(t),ee,[e,s]),e.useResultRowCount=(e,s)=>oe(d+p,U(s),0,[e]),e.useResultRowCountListener=(e,s,t,o)=>ue(d+p,U(o),s,t,[e]),e.useResultRowIds=he,e.useResultRowIdsListener=(e,s,t,o)=>ue(d+w,U(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,u)=>ue(d+b,U(u),t,o,[e,s]),e.useResultSortedRowIds=me,e.useResultSortedRowIdsListener=(e,s,t,o,u,r,l,n)=>ue(d+R,U(n),r,l,[e,s,t,o,u]),e.useResultTable=(e,s)=>oe(d+c,U(s),ee,[e]),e.useResultTableCellIds=(e,s)=>oe(d+c+g,U(s),_,[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>ue(d+c+g,U(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>ue(d+c,U(o),s,t,[e]),e.useRow=(e,s,t)=>oe(b,E(t),ee,[e,s]),e.useRowCount=(e,s)=>oe(p,E(s),0,[e]),e.useRowCountListener=(e,s,t,o,u)=>ue(p,E(u),s,t,[e],o),e.useRowIds=ie,e.useRowIdsListener=(e,s,t,o,u)=>ue(w,E(u),s,t,[e],o),e.useRowListener=(e,s,t,o,u,r)=>ue(b,E(r),t,o,[e,s],u),e.useSetCellCallback=(e,s,t,o,u,r,l,d)=>re(r,k,o,u,l,d,e,s,t),e.useSetCheckpointCallback=(e=f,s=_,t,o=f,u=_)=>{const r=W(t);return K((s=>T(r,(t=>{const u=e(s);o(t.addCheckpoint(u),t,u)}))),[r,...s,...u])},e.useSetPartialRowCallback=(e,s,t,o,u,r,l)=>re(u,"PartialRow",t,o,r,l,e,s),e.useSetPartialValuesCallback=(e,s,t,o,u)=>re(t,"PartialValues",e,s,o,u),e.useSetRowCallback=(e,s,t,o,u,r,l)=>re(u,b,t,o,r,l,e,s),e.useSetTableCallback=(e,s,t,o,u,r)=>re(o,c,s,t,u,r,e),e.useSetTablesCallback=(e,s,t,o,u)=>re(t,I,e,s,o,u),e.useSetValueCallback=(e,s,t,o,u,r)=>re(o,L,s,t,u,r,e),e.useSetValuesCallback=(e,s,t,o,u)=>re(t,h,e,s,o,u),e.useSliceIds=we,e.useSliceIdsListener=(e,s,t,o)=>ue("SliceIds",G(o),s,t,[e]),e.useSliceRowIds=Re,e.useSliceRowIdsListener=(e,s,t,o,u)=>ue("Slice"+w,G(u),t,o,[e,s]),e.useSortedRowIds=ae,e.useSortedRowIdsListener=(e,s,t,o,u,r,l,d,n)=>ue(R,E(n),r,l,[e,s,t,o,u],d),e.useStartTransactionListener=(e,s,t)=>ue("Start"+J,E(t),e,s),e.useStore=e=>F(e,0),e.useStoreIds=()=>Q(1),e.useStoreOrStoreById=E,e.useTable=(e,s)=>oe(c,E(s),ee,[e]),e.useTableCellIds=(e,s)=>oe(c+g,E(s),_,[e]),e.useTableCellIdsListener=(e,s,t,o,u)=>ue(c+g,E(u),s,t,[e],o),e.useTableIds=ne,e.useTableIdsListener=(e,s,t,o)=>ue(C,E(o),e,s,_,t),e.useTableListener=(e,s,t,o,u)=>ue(c,E(u),s,t,[e],o),e.useTables=e=>oe(I,E(e),ee),e.useTablesListener=(e,s,t,o)=>ue(I,E(o),e,s,_,t),e.useUndoInformation=e=>{const s=W(e),[t,u]=Ve(s);return[(r=t,!(0==r.length)),fe(s),u,T(u,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=be,e.useValueIds=Ce,e.useValueIdsListener=(e,s,t,o)=>ue(m,E(o),e,s,_,t),e.useValueListener=(e,s,t,o,u)=>ue(L,E(u),s,t,[e],o),e.useValues=e=>oe(h,E(e),ee),e.useValuesListener=(e,s,t,o)=>ue(h,E(o),e,s,_,t),e.useWillFinishTransactionListener=(e,s,t)=>ue("WillFinish"+J,E(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,l="",o=t(l),r="Listener",u="Result",n="Has",d="has",i="Ids",a="Table",c=a+"s",I=a+i,C="Row",p=C+"Count",b=C+i,w="Sorted"+C+i,R="Cell",k=R+i,v="Value",g=v+"s",h=v+i,y=e=>null==e,m=(e,s,t)=>y(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=()=>{},T=(e,s)=>e.map(s),V=Object.keys,S=(e,s)=>m(e,(e=>e[s])),{createContext:P,useContext:x,useEffect:O}=s,q=P([]),B=(e,s)=>{var t;const l=x(q);return y(e)?l[s]:L(e)?S(null!=(t=l[s+1])?t:{},e):e},H=(e,s)=>{const t=B(e,s);return y(e)||L(e)?t:e},M=e=>{var s;return V(null!=(s=x(q)[e])?s:{})},D=e=>H(e,0),j=e=>H(e,2),F=e=>H(e,4),Q=e=>H(e,6),E=e=>H(e,8),A=e=>H(e,10),G=e=>e.toLowerCase();G(r);const U="Transaction";G(U);const{useCallback:W,useEffect:z,useMemo:J,useLayoutEffect:K,useRef:N,useState:X}=s,Y=[],Z={},$=[[],void 0,[]],_=(e,s,t=Y)=>{const l=J((()=>s(e)),[e,...t]);return z((()=>()=>l.destroy()),[l]),l},ee=(e,s,t,l=Y,o,r="get",u="")=>{const[,n]=X(),d=W((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[r+e])?void 0:o.call(s,...l))?u:t}),[s,e,...l,t]),i=N();return J((()=>i.current=d()),[d]),se(u+e,s,((...e)=>{i.current=y(o)?d():e[o],n([])}),[d,o],l),i.current},se=(e,s,t,l=Y,o=Y,...u)=>K((()=>{var l;const n=null==(l=null==s?void 0:s["add"+e+r])?void 0:l.call(s,...o,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,e,...o,...l,...u]),te=(e,s,t,l=Y,o=f,r=Y,...u)=>{const n=D(e);return W((e=>m(n,(l=>m(t(e,l),(e=>o(l["set"+s](...u,e),e)))))),[n,s,...l,...r,...u])},le=(e,s,t=f,l=Y,...o)=>{const r=D(e);return W((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},oe=(e,s,t)=>{const l=A(e);return W((()=>null==l?void 0:l[s](t)),[l,s,t])},re=e=>ee(I,D(e),Y),ue=(e,s)=>ee(b,D(s),Y,[e]),ne=(e,s,t,l=0,o,r)=>ee(w,D(r),Y,[e,s,t,l,o],6),de=(e,s,t)=>ee(k,D(t),Y,[e,s]),ie=(e,s,t,l)=>ee(R,D(l),void 0,[e,s,t],4),ae=e=>ee(h,D(e),Y),ce=(e,s)=>ee(v,D(s),void 0,[e]),Ie=(e,s)=>ee("Metric",j(s),void 0,[e]),Ce=(e,s)=>ee("SliceIds",F(s),Y,[e]),pe=(e,s,t)=>ee("Slice"+b,F(t),Y,[e,s]),be=(e,s,t)=>ee("RemoteRowId",Q(t),void 0,[e,s]),we=(e,s,t)=>ee("Local"+b,Q(t),Y,[e,s]),Re=(e,s,t)=>ee("Linked"+b,Q(t),Y,[e,s]),ke=(e,s)=>ee(u+b,E(s),Y,[e]),ve=(e,s,t,l=0,o,r)=>ee(u+w,E(r),Y,[e,s,t,l,o],6),ge=(e,s,t)=>ee(u+k,E(t),Y,[e,s]),he=(e,s,t,l)=>ee(u+R,E(l),void 0,[e,s,t]),ye=e=>ee("CheckpointIds",A(e),$),me=(e,s)=>ee("Checkpoint",A(s),void 0,[e]),Le=e=>oe(e,"goBackward"),fe=e=>oe(e,"goForward"),{PureComponent:Te,Fragment:Ve,createElement:Se,useCallback:Pe,useLayoutEffect:xe,useRef:Oe,useState:qe}=s,Be=(e,...s)=>y(e)?{}:e(...s),He=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Me=Object.defineProperty,De=Object.defineProperties,je=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Ae=(e,s,t)=>s in e?Me(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Ge=(e,s)=>{for(var t in s||(s={}))Qe.call(s,t)&&Ae(e,t,s[t]);if(Fe)for(var t of Fe(s))Ee.call(s,t)&&Ae(e,t,s[t]);return e},Ue=(e,s)=>De(e,je(s)),We=(e,s)=>{var t={};for(var l in e)Qe.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Fe)for(var l of Fe(e))s.indexOf(l)<0&&Ee.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:ze,useContext:Je,useMemo:Ke,useState:Ne}=s,Xe=({tableId:e,store:s,rowComponent:t=ss,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>_e(T(n,(r=>Se(t,Ue(Ge({},Be(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),Ye=({queryId:e,queries:s,resultRowComponent:t=us,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>_e(T(u,(o=>Se(t,Ue(Ge({},Be(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Ze=({relationshipId:e,relationships:s,rowComponent:t=ss,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=He(Q(s),e),c=u(e,n,d);return _e(T(c,(e=>Se(t,Ue(Ge({},Be(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},$e=e=>({checkpoints:s,checkpointComponent:t=ns,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=A(s);return _e(T(e(ye(u)),(e=>Se(t,Ue(Ge({},Be(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},_e=(e,s,t,l)=>{const o=y(s)||!Array.isArray(e)?e:T(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},es=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return _e(l+(null!=(u=ie(e,s,t,o))?u:l),void 0,r,t)},ss=({tableId:e,rowId:s,store:t,cellComponent:l=es,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>_e(T(((e,s,t,l)=>{const o=de(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Se(l,Ue(Ge({},Be(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),ts=e=>Xe(e,ue(e.tableId,e.store)),ls=({valueId:e,store:s,debugIds:t})=>{var o;return _e(l+(null!=(o=ce(e,s))?o:l),void 0,t,e)},os=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ss,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(F(t),e),a=pe(e,s,n);return _e(T(a,(e=>Se(l,Ue(Ge({},Be(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},rs=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return _e(l+(null!=(u=he(e,s,t,o))?u:l),void 0,r,t)},us=({queryId:e,rowId:s,queries:t,resultCellComponent:l=rs,getResultCellComponentProps:o,separator:r,debugIds:u})=>_e(T(ge(e,s,t),(r=>Se(l,Ue(Ge({},Be(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),ns=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return _e(null!=(o=me(s,e))?o:l,void 0,t,s)},ds=$e((e=>e[0])),is=$e((e=>y(e[1])?[]:[e[1]])),as=$e((e=>e[2]));e.BackwardCheckpointsView=ds,e.CellView=es,e.CheckpointView=ns,e.CurrentCheckpointView=is,e.ForwardCheckpointsView=as,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=os,getSliceComponentProps:l,separator:o,debugIds:r})=>_e(T(Ce(e,s),(o=>Se(t,Ue(Ge({},Be(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Ze(e,Re,e.firstRowId),e.LocalRowsView=e=>Ze(e,we,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return _e(null!=(o=Ie(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Je(q),[p,b]=Ne({}),w=ze(((e,s)=>b((t=>S(t,e)==s?t:Ue(Ge({},t),{[e]:s})))),[]),R=ze((e=>b((s=>Ge({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Se(q.Provider,{value:Ke((()=>[null!=e?e:C[0],Ge(Ge(Ge({},C[1]),s),p),null!=t?t:C[2],Ge(Ge({},C[3]),l),null!=o?o:C[4],Ge(Ge({},C[5]),r),null!=u?u:C[6],Ge(Ge({},C[7]),n),null!=d?d:C[8],Ge(Ge({},C[9]),i),null!=a?a:C[10],Ge(Ge({},C[11]),c),w,R]),[e,s,p,t,l,o,r,u,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ss,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=He(Q(t),e),i=be(e,s,u);return _e(y(d)||y(i)?null:Se(l,Ue(Ge({},Be(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=rs,e.ResultRowView=us,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=We(s,["cellId","descending","offset","limit"]);return Ye(u,ve(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>Ye(e,ke(e.queryId,e.queries)),e.RowView=ss,e.SliceView=os,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=We(s,["cellId","descending","offset","limit"]);return Xe(u,ne(u.tableId,t,l,o,r,u.store))},e.TableView=ts,e.TablesView=({store:e,tableComponent:s=ts,getTableComponentProps:t,separator:l,debugIds:o})=>_e(T(re(e),(l=>Se(s,Ue(Ge({},Be(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ls,e.ValuesView=({store:e,valueComponent:s=ls,getValueComponentProps:t,separator:l,debugIds:o})=>_e(T(ae(e),(l=>Se(s,Ue(Ge({},Be(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=Y,l,o=f,r=Y,u=!0)=>{const n=D(l);return W((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=ie,e.useCellIds=de,e.useCellIdsListener=(e,s,t,l,o,r)=>se(k,D(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>se(R,D(u),l,o,[e,s,t],r),e.useCheckpoint=me,e.useCheckpointIds=ye,e.useCheckpointIdsListener=(e,s,t)=>se("CheckpointIds",A(t),e,s),e.useCheckpointListener=(e,s,t,l)=>se("Checkpoint",A(l),s,t,[e]),e.useCheckpoints=e=>B(e,10),e.useCheckpointsIds=()=>M(11),e.useCheckpointsOrCheckpointsById=A,e.useCreateCheckpoints=(e,s,t)=>_(e,s,t),e.useCreateIndexes=(e,s,t)=>_(e,s,t),e.useCreateMetrics=(e,s,t)=>_(e,s,t),e.useCreatePersister=(e,s,t=Y,l,o=Y,r,u=Y)=>{const[,n]=X(),d=J((()=>s(e)),[e,...t]);return z((()=>{var e;return e=function*(){l&&(yield l(d),n([]))},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...o,...u]),d},e.useCreateQueries=(e,s,t)=>_(e,s,t),e.useCreateRelationships=(e,s,t)=>_(e,s,t),e.useCreateStore=(e,s=Y)=>J(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>le(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>le(t,C,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>le(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>le(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>le(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>le(e,g,s,t),e.useDidFinishTransactionListener=(e,s,t)=>se("DidFinish"+U,D(t),e,s),e.useGoBackwardCallback=Le,e.useGoForwardCallback=fe,e.useGoToCallback=(e,s=Y,t,l=f,o=Y)=>{const r=A(t);return W((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>ee(R,D(l),!1,[e,s,t],4,d,n),e.useHasCellListener=(e,s,t,l,o,r,u)=>se(n+R,D(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>ee(C,D(t),!1,[e,s],3,d,n),e.useHasRowListener=(e,s,t,l,o,r)=>se(n+C,D(r),t,l,[e,s],o),e.useHasTable=(e,s)=>ee(a,D(s),!1,[e],2,d,n),e.useHasTableCell=(e,s,t)=>ee(a+R,D(t),!1,[e,s],3,d,n),e.useHasTableCellListener=(e,s,t,l,o,r)=>se(n+a+R,D(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>se(n+a,D(o),s,t,[e],l),e.useHasTables=e=>ee(c,D(e),!1,[],1,d,n),e.useHasTablesListener=(e,s,t,l)=>se(n+c,D(l),e,s,[],t),e.useHasValue=(e,s)=>ee(v,D(s),!1,[e],2,d,n),e.useHasValueListener=(e,s,t,l,o)=>se(n+v,D(o),s,t,[e],l),e.useHasValues=e=>ee(g,D(e),!1,[],1,d,n),e.useHasValuesListener=(e,s,t,l)=>se(n+g,D(l),e,s,[],t),e.useIndexIds=e=>ee("IndexIds",F(e),Y),e.useIndexes=e=>B(e,4),e.useIndexesIds=()=>M(5),e.useIndexesOrIndexesById=F,e.useLinkedRowIds=Re,e.useLinkedRowIdsListener=(e,s,t,l,o)=>se("Linked"+b,Q(o),t,l,[e,s]),e.useLocalRowIds=we,e.useLocalRowIdsListener=(e,s,t,l,o)=>se("Local"+b,Q(o),t,l,[e,s]),e.useMetric=Ie,e.useMetricIds=e=>ee("MetricIds",j(e),Y),e.useMetricListener=(e,s,t,l)=>se("Metric",j(l),s,t,[e]),e.useMetrics=e=>B(e,2),e.useMetricsIds=()=>M(3),e.useMetricsOrMetricsById=j,e.useProvideStore=(e,s)=>{const{12:t,13:l}=x(q);O((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>B(e,8),e.useQueriesIds=()=>M(9),e.useQueriesOrQueriesById=E,e.useQueryIds=e=>ee("QueryIds",E(e),Y),e.useRedoInformation=e=>{var s;const t=A(e),[,,[o]]=ye(t);return[!y(o),fe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>ee("RelationshipIds",Q(e),Y),e.useRelationships=e=>B(e,6),e.useRelationshipsIds=()=>M(7),e.useRelationshipsOrRelationshipsById=Q,e.useRemoteRowId=be,e.useRemoteRowIdListener=(e,s,t,l,o)=>se("RemoteRowId",Q(o),t,l,[e,s]),e.useResultCell=he,e.useResultCellIds=ge,e.useResultCellIdsListener=(e,s,t,l,o)=>se(u+k,E(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>se(u+R,E(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>ee(u+C,E(t),Z,[e,s]),e.useResultRowCount=(e,s)=>ee(u+p,E(s),0,[e]),e.useResultRowCountListener=(e,s,t,l)=>se(u+p,E(l),s,t,[e]),e.useResultRowIds=ke,e.useResultRowIdsListener=(e,s,t,l)=>se(u+b,E(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>se(u+C,E(o),t,l,[e,s]),e.useResultSortedRowIds=ve,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,n,d)=>se(u+w,E(d),r,n,[e,s,t,l,o]),e.useResultTable=(e,s)=>ee(u+a,E(s),Z,[e]),e.useResultTableCellIds=(e,s)=>ee(u+a+k,E(s),Y,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>se(u+a+k,E(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>se(u+a,E(l),s,t,[e]),e.useRow=(e,s,t)=>ee(C,D(t),Z,[e,s]),e.useRowCount=(e,s)=>ee(p,D(s),0,[e]),e.useRowCountListener=(e,s,t,l,o)=>se(p,D(o),s,t,[e],l),e.useRowIds=ue,e.useRowIdsListener=(e,s,t,l,o)=>se(b,D(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>se(C,D(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>te(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=f,s=Y,t,l=f,o=Y)=>{const r=A(t);return W((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>te(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>te(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>te(o,C,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>te(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>te(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>te(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>te(t,g,e,s,l,o),e.useSliceIds=Ce,e.useSliceIdsListener=(e,s,t,l)=>se("SliceIds",F(l),s,t,[e]),e.useSliceRowIds=pe,e.useSliceRowIdsListener=(e,s,t,l,o)=>se("Slice"+b,F(o),t,l,[e,s]),e.useSortedRowIds=ne,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>se(w,D(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>se("Start"+U,D(t),e,s),e.useStore=e=>B(e,0),e.useStoreIds=()=>M(1),e.useStoreOrStoreById=D,e.useTable=(e,s)=>ee(a,D(s),Z,[e]),e.useTableCellIds=(e,s)=>ee(a+k,D(s),Y,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>se(a+k,D(o),s,t,[e],l),e.useTableIds=re,e.useTableIdsListener=(e,s,t,l)=>se(I,D(l),e,s,Y,t),e.useTableListener=(e,s,t,l,o)=>se(a,D(o),s,t,[e],l),e.useTables=e=>ee(c,D(e),Z),e.useTablesListener=(e,s,t,l)=>se(c,D(l),e,s,Y,t),e.useUndoInformation=e=>{var s;const t=A(e),[o,r]=ye(t);return[(u=o,!(0==u.length)),Le(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=ce,e.useValueIds=ae,e.useValueIdsListener=(e,s,t,l)=>se(h,D(l),e,s,Y,t),e.useValueListener=(e,s,t,l,o)=>se(v,D(o),s,t,[e],l),e.useValues=e=>ee(g,D(e),Z),e.useValuesListener=(e,s,t,l)=>se(g,D(l),e,s,Y,t),e.useWillFinishTransactionListener=(e,s,t)=>se("WillFinish"+U,D(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,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="has",a="Ids",c="Table",I=c+"s",C=c+a,p="Row",b=p+"Count",w=p+a,R="Sorted"+p+a,k="Cell",v=k+a,g="Value",h=g+"s",y=g+a,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,T=e=>t(e)==r,V=()=>{},S=(e,s)=>e.map(s),P=Object.keys,x=(e,s)=>L(e,(e=>e[s])),{createContext:O,useContext:q,useEffect:B}=s,H=O([]),M=(e,s)=>{var t;const l=q(H);return m(e)?l[s]:f(e)?x(null!=(t=l[s+1])?t:{},e):e},D=(e,s)=>{const t=M(e,s);return m(e)||f(e)?t:e},j=e=>{var s;return P(null!=(s=q(H)[e])?s:{})},F=e=>D(e,0),Q=e=>D(e,2),E=e=>D(e,4),A=e=>D(e,6),G=e=>D(e,8),U=e=>D(e,10),W=e=>e.toLowerCase();W(u);const z="Transaction";W(z);const{useCallback:J,useEffect:K,useMemo:N,useLayoutEffect:X,useRef:Y,useState:Z}=s,$=[],_={},ee=[[],void 0,[]],se=(e,s,t=$)=>{const l=N((()=>s(e)),[e,...t]);return K((()=>()=>l.destroy()),[l]),l},te=(e,s,t,l=$,o,r="get",u="")=>{const[,n]=Z(),d=J((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[r+e])?void 0:o.call(s,...l))?u:t}),[s,e,...l,t]),i=Y();return N((()=>i.current=d()),[d]),le(u+e,s,((...e)=>{i.current=m(o)?d():e[o],n([])}),[d,o],l),i.current},le=(e,s,t,l=$,o=$,...r)=>X((()=>{var l;const n=null==(l=null==s?void 0:s["add"+e+u])?void 0:l.call(s,...o,t,...r);return()=>null==s?void 0:s.delListener(n)}),[s,e,...o,...l,...r]),oe=(e,s,t,l=$,o=V,r=$,...u)=>{const n=F(e);return J((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...S(u,(s=>T(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},re=(e,s,t=V,l=$,...o)=>{const r=F(e);return J((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},ue=(e,s,t)=>{const l=U(e);return J((()=>null==l?void 0:l[s](t)),[l,s,t])},ne=e=>te(C,F(e),$),de=(e,s)=>te(w,F(s),$,[e]),ie=(e,s,t,l=0,o,r)=>te(R,F(r),$,[e,s,t,l,o],6),ae=(e,s,t)=>te(v,F(t),$,[e,s]),ce=(e,s,t,l)=>te(k,F(l),void 0,[e,s,t],4),Ie=e=>te(y,F(e),$),Ce=(e,s)=>te(g,F(s),void 0,[e]),pe=(e,s)=>te("Metric",Q(s),void 0,[e]),be=(e,s)=>te("SliceIds",E(s),$,[e]),we=(e,s,t)=>te("Slice"+w,E(t),$,[e,s]),Re=(e,s,t)=>te("RemoteRowId",A(t),void 0,[e,s]),ke=(e,s,t)=>te("Local"+w,A(t),$,[e,s]),ve=(e,s,t)=>te("Linked"+w,A(t),$,[e,s]),ge=(e,s)=>te(n+w,G(s),$,[e]),he=(e,s,t,l=0,o,r)=>te(n+R,G(r),$,[e,s,t,l,o],6),ye=(e,s,t)=>te(n+v,G(t),$,[e,s]),me=(e,s,t,l)=>te(n+k,G(l),void 0,[e,s,t]),Le=e=>te("CheckpointIds",U(e),ee),fe=(e,s)=>te("Checkpoint",U(s),void 0,[e]),Te=e=>ue(e,"goBackward"),Ve=e=>ue(e,"goForward"),{PureComponent:Se,Fragment:Pe,createElement:xe,useCallback:Oe,useLayoutEffect:qe,useRef:Be,useState:He}=s,Me=(e,...s)=>m(e)?{}:e(...s),De=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var je=Object.defineProperty,Fe=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ue=(e,s,t)=>s in e?je(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,We=(e,s)=>{for(var t in s||(s={}))Ae.call(s,t)&&Ue(e,t,s[t]);if(Ee)for(var t of Ee(s))Ge.call(s,t)&&Ue(e,t,s[t]);return e},ze=(e,s)=>Fe(e,Qe(s)),Je=(e,s)=>{var t={};for(var l in e)Ae.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ee)for(var l of Ee(e))s.indexOf(l)<0&&Ge.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:Ke,useContext:Ne,useMemo:Xe,useState:Ye}=s,Ze=({tableId:e,store:s,rowComponent:t=ls,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>ss(S(n,(r=>xe(t,ze(We({},Me(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),$e=({queryId:e,queries:s,resultRowComponent:t=ds,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>ss(S(u,(o=>xe(t,ze(We({},Me(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),_e=({relationshipId:e,relationships:s,rowComponent:t=ls,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=De(A(s),e),c=u(e,n,d);return ss(S(c,(e=>xe(t,ze(We({},Me(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},es=e=>({checkpoints:s,checkpointComponent:t=is,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=U(s);return ss(S(e(Le(u)),(e=>xe(t,ze(We({},Me(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},ss=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},ts=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return ss(l+(null!=(u=ce(e,s,t,o))?u:l),void 0,r,t)},ls=({tableId:e,rowId:s,store:t,cellComponent:l=ts,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>ss(S(((e,s,t,l)=>{const o=ae(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),os=e=>Ze(e,de(e.tableId,e.store)),rs=({valueId:e,store:s,debugIds:t})=>{var o;return ss(l+(null!=(o=Ce(e,s))?o:l),void 0,t,e)},us=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ls,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(E(t),e),a=we(e,s,n);return ss(S(a,(e=>xe(l,ze(We({},Me(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ns=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return ss(l+(null!=(u=me(e,s,t,o))?u:l),void 0,r,t)},ds=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ns,getResultCellComponentProps:o,separator:r,debugIds:u})=>ss(S(ye(e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),is=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return ss(null!=(o=fe(s,e))?o:l,void 0,t,s)},as=es((e=>e[0])),cs=es((e=>m(e[1])?[]:[e[1]])),Is=es((e=>e[2]));e.BackwardCheckpointsView=as,e.CellView=ts,e.CheckpointView=is,e.CurrentCheckpointView=cs,e.ForwardCheckpointsView=Is,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=us,getSliceComponentProps:l,separator:o,debugIds:r})=>ss(S(be(e,s),(o=>xe(t,ze(We({},Me(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>_e(e,ve,e.firstRowId),e.LocalRowsView=e=>_e(e,ke,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return ss(null!=(o=pe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Ne(H),[p,b]=Ye({}),w=Ke(((e,s)=>b((t=>x(t,e)==s?t:ze(We({},t),{[e]:s})))),[]),R=Ke((e=>b((s=>We({},((e,s)=>(delete e[s],e))(s,e))))),[]);return xe(H.Provider,{value:Xe((()=>[null!=e?e:C[0],We(We(We({},C[1]),s),p),null!=t?t:C[2],We(We({},C[3]),l),null!=o?o:C[4],We(We({},C[5]),r),null!=u?u:C[6],We(We({},C[7]),n),null!=d?d:C[8],We(We({},C[9]),i),null!=a?a:C[10],We(We({},C[11]),c),w,R]),[e,s,p,t,l,o,r,u,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ls,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=De(A(t),e),i=Re(e,s,u);return ss(m(d)||m(i)?null:xe(l,ze(We({},Me(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ns,e.ResultRowView=ds,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return $e(u,he(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>$e(e,ge(e.queryId,e.queries)),e.RowView=ls,e.SliceView=us,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return Ze(u,ie(u.tableId,t,l,o,r,u.store))},e.TableView=os,e.TablesView=({store:e,tableComponent:s=os,getTableComponentProps:t,separator:l,debugIds:o})=>ss(S(ne(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=rs,e.ValuesView=({store:e,valueComponent:s=rs,getValueComponentProps:t,separator:l,debugIds:o})=>ss(S(Ie(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=$,l,o=V,r=$,u=!0)=>{const n=F(l);return J((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(T(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=ce,e.useCellIds=ae,e.useCellIdsListener=(e,s,t,l,o,r)=>le(v,F(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>le(k,F(u),l,o,[e,s,t],r),e.useCheckpoint=fe,e.useCheckpointIds=Le,e.useCheckpointIdsListener=(e,s,t)=>le("CheckpointIds",U(t),e,s),e.useCheckpointListener=(e,s,t,l)=>le("Checkpoint",U(l),s,t,[e]),e.useCheckpoints=e=>M(e,10),e.useCheckpointsIds=()=>j(11),e.useCheckpointsOrCheckpointsById=U,e.useCreateCheckpoints=(e,s,t)=>se(e,s,t),e.useCreateIndexes=(e,s,t)=>se(e,s,t),e.useCreateMetrics=(e,s,t)=>se(e,s,t),e.useCreatePersister=(e,s,t=$,l,o=$,r,u=$)=>{const[,n]=Z(),d=N((()=>s(e)),[e,...t]);return K((()=>{var e;return e=function*(){l&&(yield l(d),n([]))},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...o,...u]),d},e.useCreateQueries=(e,s,t)=>se(e,s,t),e.useCreateRelationships=(e,s,t)=>se(e,s,t),e.useCreateStore=(e,s=$)=>N(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>re(o,k,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>re(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>re(s,c,t,l,e),e.useDelTablesCallback=(e,s,t)=>re(e,I,s,t),e.useDelValueCallback=(e,s,t,l)=>re(s,g,t,l,e),e.useDelValuesCallback=(e,s,t)=>re(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>le("DidFinish"+z,F(t),e,s),e.useGoBackwardCallback=Te,e.useGoForwardCallback=Ve,e.useGoToCallback=(e,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>te(k,F(l),!1,[e,s,t],4,i,d),e.useHasCellListener=(e,s,t,l,o,r,u)=>le(d+k,F(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>te(p,F(t),!1,[e,s],3,i,d),e.useHasRowListener=(e,s,t,l,o,r)=>le(d+p,F(r),t,l,[e,s],o),e.useHasTable=(e,s)=>te(c,F(s),!1,[e],2,i,d),e.useHasTableCell=(e,s,t)=>te(c+k,F(t),!1,[e,s],3,i,d),e.useHasTableCellListener=(e,s,t,l,o,r)=>le(d+c+k,F(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>le(d+c,F(o),s,t,[e],l),e.useHasTables=e=>te(I,F(e),!1,[],1,i,d),e.useHasTablesListener=(e,s,t,l)=>le(d+I,F(l),e,s,[],t),e.useHasValue=(e,s)=>te(g,F(s),!1,[e],2,i,d),e.useHasValueListener=(e,s,t,l,o)=>le(d+g,F(o),s,t,[e],l),e.useHasValues=e=>te(h,F(e),!1,[],1,i,d),e.useHasValuesListener=(e,s,t,l)=>le(d+h,F(l),e,s,[],t),e.useIndexIds=e=>te("IndexIds",E(e),$),e.useIndexes=e=>M(e,4),e.useIndexesIds=()=>j(5),e.useIndexesOrIndexesById=E,e.useLinkedRowIds=ve,e.useLinkedRowIdsListener=(e,s,t,l,o)=>le("Linked"+w,A(o),t,l,[e,s]),e.useLocalRowIds=ke,e.useLocalRowIdsListener=(e,s,t,l,o)=>le("Local"+w,A(o),t,l,[e,s]),e.useMetric=pe,e.useMetricIds=e=>te("MetricIds",Q(e),$),e.useMetricListener=(e,s,t,l)=>le("Metric",Q(l),s,t,[e]),e.useMetrics=e=>M(e,2),e.useMetricsIds=()=>j(3),e.useMetricsOrMetricsById=Q,e.useProvideStore=(e,s)=>{const{12:t,13:l}=q(H);B((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>M(e,8),e.useQueriesIds=()=>j(9),e.useQueriesOrQueriesById=G,e.useQueryIds=e=>te("QueryIds",G(e),$),e.useRedoInformation=e=>{var s;const t=U(e),[,,[o]]=Le(t);return[!m(o),Ve(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>te("RelationshipIds",A(e),$),e.useRelationships=e=>M(e,6),e.useRelationshipsIds=()=>j(7),e.useRelationshipsOrRelationshipsById=A,e.useRemoteRowId=Re,e.useRemoteRowIdListener=(e,s,t,l,o)=>le("RemoteRowId",A(o),t,l,[e,s]),e.useResultCell=me,e.useResultCellIds=ye,e.useResultCellIdsListener=(e,s,t,l,o)=>le(n+v,G(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>le(n+k,G(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>te(n+p,G(t),_,[e,s]),e.useResultRowCount=(e,s)=>te(n+b,G(s),0,[e]),e.useResultRowCountListener=(e,s,t,l)=>le(n+b,G(l),s,t,[e]),e.useResultRowIds=ge,e.useResultRowIdsListener=(e,s,t,l)=>le(n+w,G(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>le(n+p,G(o),t,l,[e,s]),e.useResultSortedRowIds=he,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>le(n+R,G(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>te(n+c,G(s),_,[e]),e.useResultTableCellIds=(e,s)=>te(n+c+v,G(s),$,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>le(n+c+v,G(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>le(n+c,G(l),s,t,[e]),e.useRow=(e,s,t)=>te(p,F(t),_,[e,s]),e.useRowCount=(e,s)=>te(b,F(s),0,[e]),e.useRowCountListener=(e,s,t,l,o)=>le(b,F(o),s,t,[e],l),e.useRowIds=de,e.useRowIdsListener=(e,s,t,l,o)=>le(w,F(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>le(p,F(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>oe(r,k,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>oe(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>oe(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>oe(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>oe(l,c,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>oe(t,I,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>oe(l,g,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>oe(t,h,e,s,l,o),e.useSliceIds=be,e.useSliceIdsListener=(e,s,t,l)=>le("SliceIds",E(l),s,t,[e]),e.useSliceRowIds=we,e.useSliceRowIdsListener=(e,s,t,l,o)=>le("Slice"+w,E(o),t,l,[e,s]),e.useSortedRowIds=ie,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>le(R,F(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>le("Start"+z,F(t),e,s),e.useStore=e=>M(e,0),e.useStoreIds=()=>j(1),e.useStoreOrStoreById=F,e.useTable=(e,s)=>te(c,F(s),_,[e]),e.useTableCellIds=(e,s)=>te(c+v,F(s),$,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>le(c+v,F(o),s,t,[e],l),e.useTableIds=ne,e.useTableIdsListener=(e,s,t,l)=>le(C,F(l),e,s,$,t),e.useTableListener=(e,s,t,l,o)=>le(c,F(o),s,t,[e],l),e.useTables=e=>te(I,F(e),_),e.useTablesListener=(e,s,t,l)=>le(I,F(l),e,s,$,t),e.useUndoInformation=e=>{var s;const t=U(e),[o,r]=Le(t);return[(u=o,!(0==u.length)),Te(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Ce,e.useValueIds=Ie,e.useValueIdsListener=(e,s,t,l)=>le(y,F(l),e,s,$,t),e.useValueListener=(e,s,t,l,o)=>le(g,F(o),s,t,[e],l),e.useValues=e=>te(h,F(e),_),e.useValuesListener=(e,s,t,l)=>le(h,F(l),e,s,$,t),e.useWillFinishTransactionListener=(e,s,t)=>le("WillFinish"+z,F(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.5.4",
3
+ "version": "4.5.5",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -230,14 +230,14 @@
230
230
  "@types/jest": "^29.5.10",
231
231
  "@types/jest-environment-puppeteer": "^5.0.6",
232
232
  "@types/less": "^3.0.6",
233
- "@types/node": "^20.10.2",
233
+ "@types/node": "^20.10.3",
234
234
  "@types/puppeteer": "^5.4.7",
235
- "@types/react": "^18.2.41",
235
+ "@types/react": "^18.2.42",
236
236
  "@types/react-dom": "^18.2.17",
237
237
  "@types/react-test-renderer": "^18.0.7",
238
238
  "@types/tmp": "^0.2.6",
239
- "@typescript-eslint/eslint-plugin": "^6.13.1",
240
- "@typescript-eslint/parser": "^6.13.1",
239
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
240
+ "@typescript-eslint/parser": "^6.13.2",
241
241
  "@vlcn.io/crsqlite-wasm": "^0.15.2",
242
242
  "asciichart": "^1.5.25",
243
243
  "automerge-repo": "^0.1.0",
@@ -248,7 +248,7 @@
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": "^8.1.0",
251
+ "cspell": "^8.1.2",
252
252
  "esbuild": "^0.19.8",
253
253
  "eslint": "^8.55.0",
254
254
  "eslint-config-prettier": "^9.1.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-5"><em>NEW!</em> v4.5 release</a> <span id="one-with">&quot;The One With Expo SQLite Next&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">5.0kB - 9.4kB</a>, no 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/expo.svg">Expo SQLite</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.5.4" 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-5"><em>NEW!</em> v4.5 release</a> <span id="one-with">&quot;The One With Expo SQLite Next&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">5.0kB - 9.4kB</a>, no 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/expo.svg">Expo SQLite</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.5.5" 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>5.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.3kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</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>5.0kB</td><td>12.0kB</td><td>51.6kB</td><td>252.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>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>126.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.7kB</td><td>35.1kB</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.6kB</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.4kB</td><td>23.2kB</td><td>100.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,965</td><td>1,965</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,123</td><td>2,123</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>846</td><td>846</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>715</td><td>715</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,781</td></tr><tr><th class="right">Assertions</th><td colspan="3">17,870</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>5.0kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>4.3kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>11.1kB</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>5.0kB</td><td>12.0kB</td><td>51.6kB</td><td>252.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>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>126.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.7kB</td><td>35.1kB</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.6kB</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.4kB</td><td>23.2kB</td><td>100.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,968</td><td>1,968</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,127</td><td>2,127</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>848</td><td>848</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>719</td><td>719</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,787</td></tr><tr><th class="right">Assertions</th><td colspan="3">17,909</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>