tinybase 3.0.2 → 3.0.3

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