tinybase 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/index.d.cts +0 -2
- package/@types/index.d.ts +0 -2
- package/@types/persisters/persister-partykit-client/index.d.cts +2 -2
- package/@types/persisters/persister-partykit-client/index.d.ts +2 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +2 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +2 -2
- package/@types/with-schemas/index.d.cts +0 -2
- package/@types/with-schemas/index.d.ts +0 -2
- package/cjs/es6/min/ui-react/index.cjs +1 -1
- package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/ui-react/index.cjs +10 -1
- package/cjs/es6/ui-react/with-schemas/index.cjs +10 -1
- package/cjs/min/ui-react/index.cjs +1 -1
- package/cjs/min/ui-react/index.cjs.gz +0 -0
- package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/ui-react/index.cjs +10 -1
- package/cjs/ui-react/with-schemas/index.cjs +10 -1
- package/es6/min/ui-react/index.js +1 -1
- package/es6/min/ui-react/index.js.gz +0 -0
- package/es6/min/ui-react/with-schemas/index.js +1 -1
- package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/es6/ui-react/index.js +10 -1
- package/es6/ui-react/with-schemas/index.js +10 -1
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/package.json +2 -2
- package/readme.md +2 -2
- package/ui-react/index.js +10 -1
- package/ui-react/with-schemas/index.js +10 -1
- package/umd/es6/min/ui-react/index.js +1 -1
- package/umd/es6/min/ui-react/index.js.gz +0 -0
- package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/es6/ui-react/index.js +12 -1
- package/umd/es6/ui-react/with-schemas/index.js +12 -1
- package/umd/min/ui-react/index.js +1 -1
- package/umd/min/ui-react/index.js.gz +0 -0
- package/umd/min/ui-react/with-schemas/index.js +1 -1
- package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/ui-react/index.js +12 -1
- package/umd/ui-react/with-schemas/index.js +12 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",c=i+"s",a=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,x=()=>{},q=(e,t)=>e.every(t),S=(e,t)=>R(e)===R(t)&&q(e,((e,o)=>t[o]===e)),O=(e,t)=>e.map(t),L=Object,j=e=>L.getPrototypeOf(e),B=L.entries,E=e=>!w(e)&&k(j(e),(e=>e==L.prototype||w(j(e))),(()=>!0)),T=L.keys,M=(e,t)=>k(e,(e=>e[t])),F=(e,t)=>{const o=B(e);return R(o)===R(T(t))&&q(o,(([e,o])=>E(o)?!!E(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return w(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(e)||h(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:se,useEffect:de,useMemo:ue,useLayoutEffect:ie,useRef:ce,useState:ae,useSyncExternalStore:Ie}=e,pe=[],ve=[{},[],[pe,void 0,pe],void 0,!1,0],be=[F,S,([e,t,o],[r,n,l])=>t===n&&S(e,r)&&S(o,l)],ge=(e,t)=>e===t,ye=(e,t,o=pe)=>{const[,r]=ae(),[n,l]=ae();return de((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},me=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Ce=(e,t,r,n=pe)=>{const l=ce(ve[r]),s=se((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:ve[r];return(null!=(d=be[r])?d:ge)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=se((l=>me(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Ie(u,s)},fe=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),we=(e,t,o,r=pe,n=x,l=pe,...s)=>{const d=J(e);return se((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...ke(s,r,e),o),o)))))),[d,t,...r,...l,...he(s)])},ke=(e,t,o)=>O(e,(e=>P(e)?e(o,t):e)),he=e=>{return t=e=>!P(e),e.filter(t);var t},Pe=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((e=>o(null==l?void 0:l["del"+t](...ke(n,l,e)))),[l,t,...r,...he(n)])},Re=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},xe=(e,t=pe)=>ue(e,t),qe=(e,t=pe)=>ue(e,t),Se=()=>z(1),Oe=e=>Ce(c,J(e),4,[]),Le=e=>Ce(c,J(e),0),je=e=>Ce(a,J(e),1),Be=(e,t)=>Ce(i,J(t),4,[e]),Ee=(e,t)=>Ce(i,J(t),0,[e]),Te=(e,t)=>Ce(i+y,J(t),1,[e]),Me=(e,t,o)=>Ce(i+g,J(o),4,[e,t]),Fe=(e,t)=>Ce(p,J(t),5,[e]),Ve=(e,t)=>Ce(v,J(t),1,[e]),Ae=(e,t,o,r=0,n,l)=>Ce(b,J(l),1,[e,t,o,r,n]),De=(e,t,o)=>Ce(I,J(o),4,[e,t]),He=(e,t,o)=>Ce(I,J(o),0,[e,t]),Qe=(e,t,o)=>Ce(y,J(o),1,[e,t]),We=(e,t,o,r)=>Ce(g,J(r),4,[e,t,o]),ze=(e,t,o,r)=>Ce(g,J(r),3,[e,t,o]),Ge=e=>Ce(C,J(e),4,[]),Je=e=>Ce(C,J(e),0),Ke=e=>Ce(f,J(e),1),Ne=(e,t)=>Ce(m,J(t),4,[e]),Ue=(e,t)=>Ce(m,J(t),3,[e]),Xe=(e,t,o,r,n)=>we(o,c,e,t,r,n),Ye=(e,t,o,r,n,l)=>we(r,i,t,o,n,l,e),Ze=(e,t,o,r,n,l,s)=>we(n,I,o,r,l,s,e,t),$e=(e,t,o=pe,r,n=x,l=pe,s=!0)=>{const d=J(r);return se((o=>k(d,(r=>k(t(o,r),(t=>n(r.addRow(P(e)?e(o,r):e,t,s),r,t)))))),[d,e,...o,...l,s])},_e=(e,t,o,r,n,l,s)=>we(n,"PartialRow",o,r,l,s,e,t),et=(e,t,o,r,n,l,s,d)=>we(l,g,r,n,s,d,e,t,o),tt=(e,t,o,r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t),jt=(e,t,o)=>fe("WillFinish"+ne,J(o),e,t),Bt=(e,t,o)=>fe("DidFinish"+ne,J(o),e,t),Et=(e,t,o)=>ye(e,t,o),Tt=()=>z(3),Mt=e=>Ce("MetricIds",U(e),1),Ft=(e,t)=>Ce("Metric",U(t),3,[e]),Vt=(e,t,o,r)=>fe("Metric",U(r),t,o,[e]),At=(e,t,o)=>ye(e,t,o),Dt=()=>z(5),Ht=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Qt=e=>Ce("IndexIds",Y(e),1),Wt=(e,t,o)=>Ce("Slice"+v,Y(o),1,[e,t]),zt=(e,t,o,r)=>fe("SliceIds",Y(r),t,o,[e]),Gt=(e,t,o,r,n)=>fe("Slice"+v,Y(n),o,r,[e,t]),Jt=(e,t,o)=>ye(e,t,o),Kt=()=>z(7),Nt=e=>Ce("RelationshipIds",$(e),1),Ut=(e,t,o)=>Ce("RemoteRowId",$(o),3,[e,t]),Xt=(e,t,o)=>Ce("Local"+v,$(o),1,[e,t]),Yt=(e,t,o)=>Ce("Linked"+v,$(o),1,[e,t]),Zt=(e,t,o,r,n)=>fe("RemoteRowId",$(n),o,r,[e,t]),$t=(e,t,o,r,n)=>fe("Local"+v,$(n),o,r,[e,t]),_t=(e,t,o,r,n)=>fe("Linked"+v,$(n),o,r,[e,t]),eo=(e,t,o)=>ye(e,t,o),to=()=>z(9),oo=e=>Ce("QueryIds",ee(e),1),ro=(e,t)=>Ce(s+i,ee(t),0,[e]),no=(e,t)=>Ce(s+i+y,ee(t),1,[e]),lo=(e,t)=>Ce(s+p,ee(t),5,[e]),so=(e,t)=>Ce(s+v,ee(t),1,[e]),uo=(e,t,o,r=0,n,l)=>Ce(s+b,ee(l),1,[e,t,o,r,n]),io=(e,t,o)=>Ce(s+I,ee(o),0,[e,t]),co=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),ao=(e,t,o,r)=>Ce(s+g,ee(r),3,[e,t,o]),Io=(e,t,o,r)=>fe(s+i,ee(r),t,o,[e]),po=(e,t,o,r)=>fe(s+i+y,ee(r),t,o,[e]),vo=(e,t,o,r)=>fe(s+p,ee(r),t,o,[e]),bo=(e,t,o,r)=>fe(s+v,ee(r),t,o,[e]),go=(e,t,o,r,n,l,d,u)=>fe(s+b,ee(u),l,d,[e,t,o,r,n]),yo=(e,t,o,r,n)=>fe(s+I,ee(n),o,r,[e,t]),mo=(e,t,o,r,n)=>fe(s+y,ee(n),o,r,[e,t]),Co=(e,t,o,r,n,l)=>fe(s+g,ee(l),r,n,[e,t,o]),fo=(e,t,o)=>ye(e,t,o),wo=()=>z(11),ko=e=>Ce("CheckpointIds",oe(e),2),ho=(e,t)=>Ce("Checkpoint",oe(t),3,[e]),Po=(e=x,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Ro=e=>Re(e,"goBackward"),xo=e=>Re(e,"goForward"),qo=(e,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},So=e=>{var t;const r=oe(e),[n,l]=ko(r);return[(s=n,!(0==R(s))),Ro(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Oo=e=>{var t;const r=oe(e),[,,[n]]=ko(r);return[!w(n),xo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Lo=(e,t,o)=>fe("CheckpointIds",oe(o),e,t),jo=(e,t,o,r)=>fe("Checkpoint",oe(r),t,o,[e]),Bo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&le(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),de((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Eo=(e,t,o=pe,r,n=pe)=>{const[l,s]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),de((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:To,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>w(e)?{}:e(...t),Wo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var zo=Object.defineProperty,Go=Object.defineProperties,Jo=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,Xo=(e,t,o)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Yo=(e,t)=>{for(var o in t||(t={}))No.call(t,o)&&Xo(e,o,t[o]);if(Ko)for(var o of Ko(t))Uo.call(t,o)&&Xo(e,o,t[o]);return e},Zo=(e,t)=>Go(e,Jo(t)),$o=(e,t)=>{var o={};for(var r in e)No.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Ko)for(var r of Ko(e))t.indexOf(r)<0&&Uo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:_o,useContext:er,useMemo:tr,useState:or}=e,rr=({tableId:e,store:t,rowComponent:o=cr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>ur(O(d,(l=>Fo(o,Zo(Yo({},Qo(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),nr=({queryId:e,queries:t,resultRowComponent:o=hr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>ur(O(s,(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),lr=({relationshipId:e,relationships:t,rowComponent:o=cr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Wo($(t),e),a=s(e,d,u);return ur(O(a,(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},sr=e=>({checkpoints:t,checkpointComponent:o=xr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return ur(O(e(ko(s)),(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},dr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:I})=>{const p=er(H),[v,b]=or({}),g=_o(((e,t)=>b((o=>M(o,e)==t?o:Zo(Yo({},o),{[e]:t})))),[]),y=_o((e=>b((t=>Yo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Fo(H.Provider,{value:tr((()=>[null!=e?e:p[0],Yo(Yo(Yo({},p[1]),t),v),null!=o?o:p[2],Yo(Yo({},p[3]),r),null!=n?n:p[4],Yo(Yo({},p[5]),l),null!=s?s:p[6],Yo(Yo({},p[7]),d),null!=u?u:p[8],Yo(Yo({},p[9]),i),null!=c?c:p[10],Yo(Yo({},p[11]),a),g,y]),[e,t,v,o,r,n,l,s,d,u,i,c,a,p,g,y])},I)},ur=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ir=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ze(e,t,r,n))?s:o),void 0,l,r)},cr=({tableId:e,rowId:t,store:o,cellComponent:r=ir,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>ur(O(((e,t,o,r)=>{const n=Qe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ar=e=>rr(e,Ve(e.tableId,e.store)),Ir=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return rr(s,Ae(s.tableId,o,r,n,l,s.store))},pr=({store:e,tableComponent:t=ar,getTableComponentProps:o,separator:r,debugIds:n})=>ur(O(je(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),vr=({valueId:e,store:t,debugIds:r})=>{var n;return ur(o+(null!=(n=Ue(e,t))?n:o),void 0,r,e)},br=({store:e,valueComponent:t=vr,getValueComponentProps:o,separator:r,debugIds:n})=>ur(O(Ke(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),gr=({metricId:e,metrics:t,debugIds:r})=>{var n;return ur(null!=(n=Ft(e,t))?n:o,void 0,r,e)},yr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=cr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),c=Wt(e,t,d);return ur(O(c,(e=>Fo(r,Zo(Yo({},Qo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},mr=({indexId:e,indexes:t,sliceComponent:o=yr,getSliceComponentProps:r,separator:n,debugIds:l})=>ur(O(Ht(e,t),(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Cr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=cr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Wo($(o),e),i=Ut(e,t,s);return ur(w(u)||w(i)?null:Fo(r,Zo(Yo({},Qo(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},fr=e=>lr(e,Xt,e.remoteRowId),wr=e=>lr(e,Yt,e.firstRowId),kr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ao(e,t,r,n))?s:o),void 0,l,r)},hr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=kr,getResultCellComponentProps:n,separator:l,debugIds:s})=>ur(O(co(e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Pr=e=>nr(e,so(e.queryId,e.queries)),Rr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return nr(s,uo(s.queryId,o,r,n,l,s.queries))},xr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return ur(null!=(n=ho(t,e))?n:o,void 0,r,t)},qr=sr((e=>e[0])),Sr=sr((e=>w(e[1])?[]:[e[1]])),Or=sr((e=>e[2]));export{qr as BackwardCheckpointsView,ir as CellView,xr as CheckpointView,Sr as CurrentCheckpointView,Or as ForwardCheckpointsView,mr as IndexView,wr as LinkedRowsView,fr as LocalRowsView,gr as MetricView,dr as Provider,Cr as RemoteRowView,kr as ResultCellView,hr as ResultRowView,Rr as ResultSortedTableView,Pr as ResultTableView,cr as RowView,yr as SliceView,Ir as SortedTableView,ar as TableView,pr as TablesView,vr as ValueView,br as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,kt as useCellIdsListener,Pt as useCellListener,ho as useCheckpoint,ko as useCheckpointIds,Lo as useCheckpointIdsListener,jo as useCheckpointListener,te as useCheckpoints,wo as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Et as useCreateMetrics,Bo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,xe as useCreateStore,Eo as useCreateSynchronizer,dt as useDelCellCallback,st as useDelRowCallback,lt as useDelTableCallback,nt as useDelTablesCallback,it as useDelValueCallback,ut as useDelValuesCallback,Bt as useDidFinishTransactionListener,Ro as useGoBackwardCallback,xo as useGoForwardCallback,qo as useGoToCallback,We as useHasCell,ht as useHasCellListener,De as useHasRow,ft as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,pt as useHasTableListener,Oe as useHasTables,ct as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,Rt as useHasValuesListener,Qt as useIndexIds,X as useIndexes,Dt as useIndexesIds,Y as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,N as useMetrics,Tt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,to as useQueriesIds,ee as useQueriesOrQueriesById,oo as useQueryIds,Oo as useRedoInformation,Nt as useRelationshipIds,Z as useRelationships,Kt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,ao as useResultCell,co as useResultCellIds,mo as useResultCellIdsListener,Co as useResultCellListener,io as useResultRow,lo as useResultRowCount,vo as useResultRowCountListener,so as useResultRowIds,bo as useResultRowIdsListener,yo as useResultRowListener,uo as useResultSortedRowIds,go as useResultSortedRowIdsListener,ro as useResultTable,no as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Fe as useRowCount,yt as useRowCountListener,Ve as useRowIds,mt as useRowIdsListener,wt as useRowListener,et as useSetCellCallback,Po as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,rt as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,Ae as useSortedRowIds,Ct as useSortedRowIdsListener,Lt as useStartTransactionListener,G as useStore,Se as useStoreIds,J as useStoreOrStoreById,Ee as useTable,Te as useTableCellIds,bt as useTableCellIdsListener,je as useTableIds,It as useTableIdsListener,vt as useTableListener,Le as useTables,at as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,qt as useValueIdsListener,Ot as useValueListener,Je as useValues,xt as useValuesListener,jt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=globalThis,h=e=>null==e,k=(e,t,o)=>h(e)?null==o?void 0:o():t(e),P=e=>t(e)==r,R=e=>t(e)==n,x=e=>e.length,q=()=>{},S=(e,t)=>e.every(t),O=(e,t)=>x(e)===x(t)&&S(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),T=Object,j=e=>T.getPrototypeOf(e),B=T.entries,E=e=>!h(e)&&k(j(e),(e=>e==T.prototype||h(j(e))),(()=>!0)),M=T.keys,F=(e,t)=>k(e,(e=>e[t])),V=(e,t)=>{const o=B(e);return x(o)===x(M(t))&&S(o,(([e,o])=>E(o)?!!E(t[e])&&V(t[e],o):t[e]===o))},{createContext:A,useContext:D,useEffect:H}=e,Q=(z=()=>A([]),((e,t)=>t in e)(W=w,_="tinybase_uirc")||(W[_]=z()),W[_]);var W,_,z;const G=(e,t)=>{var o;const r=D(Q);return h(e)?r[t]:P(e)?F(null!=(o=r[t+1])?o:{},e):e},J=(e,t)=>{const o=G(e,t);return h(e)||P(e)?o:e},K=e=>{var t;return M(null!=(t=D(Q)[e])?t:{})},N=e=>G(e,0),U=e=>J(e,0),X=(e,t)=>{const{12:o,13:r}=D(Q);H((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},Y=e=>G(e,2),Z=e=>J(e,2),$=e=>G(e,4),ee=e=>J(e,4),te=e=>G(e,6),oe=e=>J(e,6),re=e=>G(e,8),ne=e=>J(e,8),le=e=>G(e,10),se=e=>J(e,10),de=e=>e.toLowerCase();de(l);const ue="Transaction";de(ue);var ie=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:ae,useEffect:ce,useMemo:Ie,useLayoutEffect:pe,useRef:ve,useState:be,useSyncExternalStore:ge}=e,ye=[],me=[{},[],[ye,void 0,ye],void 0,!1,0],Ce=[V,O,([e,t,o],[r,n,l])=>t===n&&O(e,r)&&O(o,l)],fe=(e,t)=>e===t,we=(e,t,o=ye)=>{const[,r]=be(),[n,l]=be();return ce((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},he=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},ke=(e,t,r,n=ye)=>{const l=ve(me[r]),s=ae((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:me[r];return(null!=(d=Ce[r])?d:fe)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=ae((l=>he(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return ge(u,s)},Pe=(e,t,o,r=ye,n=ye,...l)=>pe((()=>he(t,e,...n,o,...l)),[t,e,...n,...r,...l]),Re=(e,t,o,r=ye,n=q,l=ye,...s)=>{const d=U(e);return ae((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...xe(s,r,e),o),o)))))),[d,t,...r,...l,...qe(s)])},xe=(e,t,o)=>L(e,(e=>R(e)?e(o,t):e)),qe=e=>{return t=e=>!R(e),e.filter(t);var t},Se=(e,t,o=q,r=ye,...n)=>{const l=U(e);return ae((e=>o(null==l?void 0:l["del"+t](...xe(n,l,e)))),[l,t,...r,...qe(n)])},Oe=(e,t,o)=>{const r=se(e);return ae((()=>null==r?void 0:r[t](o)),[r,t,o])},Le=(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),1),Ht=(e,t)=>ke("Metric",Z(t),3,[e]),Qt=(e,t,o,r)=>Pe("Metric",Z(r),t,o,[e]),Wt=(e,t,o)=>we(e,t,o),_t=()=>K(5),zt=(e,t)=>ke("SliceIds",ee(t),1,[e]),Gt=e=>ke("IndexIds",ee(e),1),Jt=(e,t,o)=>ke("Slice"+v,ee(o),1,[e,t]),Kt=(e,t,o,r)=>Pe("SliceIds",ee(r),t,o,[e]),Nt=(e,t,o,r,n)=>Pe("Slice"+v,ee(n),o,r,[e,t]),Ut=(e,t,o)=>we(e,t,o),Xt=()=>K(7),Yt=e=>ke("RelationshipIds",oe(e),1),Zt=(e,t,o)=>ke("RemoteRowId",oe(o),3,[e,t]),$t=(e,t,o)=>ke("Local"+v,oe(o),1,[e,t]),eo=(e,t,o)=>ke("Linked"+v,oe(o),1,[e,t]),to=(e,t,o,r,n)=>Pe("RemoteRowId",oe(n),o,r,[e,t]),oo=(e,t,o,r,n)=>Pe("Local"+v,oe(n),o,r,[e,t]),ro=(e,t,o,r,n)=>Pe("Linked"+v,oe(n),o,r,[e,t]),no=(e,t,o)=>we(e,t,o),lo=()=>K(9),so=e=>ke("QueryIds",ne(e),1),uo=(e,t)=>ke(s+i,ne(t),0,[e]),io=(e,t)=>ke(s+i+y,ne(t),1,[e]),ao=(e,t)=>ke(s+p,ne(t),5,[e]),co=(e,t)=>ke(s+v,ne(t),1,[e]),Io=(e,t,o,r=0,n,l)=>ke(s+b,ne(l),1,[e,t,o,r,n]),po=(e,t,o)=>ke(s+I,ne(o),0,[e,t]),vo=(e,t,o)=>ke(s+y,ne(o),1,[e,t]),bo=(e,t,o,r)=>ke(s+g,ne(r),3,[e,t,o]),go=(e,t,o,r)=>Pe(s+i,ne(r),t,o,[e]),yo=(e,t,o,r)=>Pe(s+i+y,ne(r),t,o,[e]),mo=(e,t,o,r)=>Pe(s+p,ne(r),t,o,[e]),Co=(e,t,o,r)=>Pe(s+v,ne(r),t,o,[e]),fo=(e,t,o,r,n,l,d,u)=>Pe(s+b,ne(u),l,d,[e,t,o,r,n]),wo=(e,t,o,r,n)=>Pe(s+I,ne(n),o,r,[e,t]),ho=(e,t,o,r,n)=>Pe(s+y,ne(n),o,r,[e,t]),ko=(e,t,o,r,n,l)=>Pe(s+g,ne(l),r,n,[e,t,o]),Po=(e,t,o)=>we(e,t,o),Ro=()=>K(11),xo=e=>ke("CheckpointIds",se(e),2),qo=(e,t)=>ke("Checkpoint",se(t),3,[e]),So=(e=q,t=ye,o,r=q,n=ye)=>{const l=se(o);return ae((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Oo=e=>Oe(e,"goBackward"),Lo=e=>Oe(e,"goForward"),To=(e,t=ye,o,r=q,n=ye)=>{const l=se(o);return ae((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},jo=e=>{var t;const r=se(e),[n,l]=xo(r);return[(s=n,!(0==x(s))),Oo(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Bo=e=>{var t;const r=se(e),[,,[n]]=xo(r);return[!h(n),Lo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Eo=(e,t,o)=>Pe("CheckpointIds",se(o),e,t),Mo=(e,t,o,r)=>Pe("Checkpoint",se(r),t,o,[e]),Fo=(e,t,o=ye,r,n=ye,l,s=ye)=>{const[,d]=be(),[u,i]=be();return ce((()=>{ie(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&ie(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),ce((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Vo=(e,t,o=ye,r,n=ye)=>{const[l,s]=be();return ce((()=>{ie(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),ce((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Ao,Fragment:Do,createElement:Ho,useCallback:Qo,useLayoutEffect:Wo,useRef:_o,useState:zo}=e,Go=(e,...t)=>h(e)?{}:e(...t),Jo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Ko=Object.defineProperty,No=Object.defineProperties,Uo=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,$o=(e,t,o)=>t in e?Ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,er=(e,t)=>{for(var o in t||(t={}))Yo.call(t,o)&&$o(e,o,t[o]);if(Xo)for(var o of Xo(t))Zo.call(t,o)&&$o(e,o,t[o]);return e},tr=(e,t)=>No(e,Uo(t)),or=(e,t)=>{var o={};for(var r in e)Yo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Xo)for(var r of Xo(e))t.indexOf(r)<0&&Zo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:rr,useContext:nr,useMemo:lr,useState:sr}=e,dr=({tableId:e,store:t,rowComponent:o=vr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>Ir(L(d,(l=>Ho(o,tr(er({},Go(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),ur=({queryId:e,queries:t,resultRowComponent:o=qr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>Ir(L(s,(n=>Ho(o,tr(er({},Go(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),ir=({relationshipId:e,relationships:t,rowComponent:o=vr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=Jo(oe(t),e),c=s(e,d,u);return Ir(L(c,(e=>Ho(o,tr(er({},Go(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,d)},ar=e=>({checkpoints:t,checkpointComponent:o=Lr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=se(t);return Ir(L(e(xo(s)),(e=>Ho(o,tr(er({},Go(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},cr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=nr(Q),[v,b]=sr({}),g=rr(((e,t)=>b((o=>F(o,e)==t?o:tr(er({},o),{[e]:t})))),[]),y=rr((e=>b((t=>er({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Ho(Q.Provider,{value:lr((()=>[null!=e?e:p[0],er(er(er({},p[1]),t),v),null!=o?o:p[2],er(er({},p[3]),r),null!=n?n:p[4],er(er({},p[5]),l),null!=s?s:p[6],er(er({},p[7]),d),null!=u?u:p[8],er(er({},p[9]),i),null!=a?a:p[10],er(er({},p[11]),c),g,y]),[e,t,v,o,r,n,l,s,d,u,i,a,c,p,g,y])},I)},Ir=(e,t,o,r)=>{const n=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},pr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return Ir(o+(null!=(s=Ke(e,t,r,n))?s:o),void 0,l,r)},vr=({tableId:e,rowId:t,store:o,cellComponent:r=pr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>Ir(L(((e,t,o,r)=>{const n=Ge(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Ho(r,tr(er({},Go(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),br=e=>dr(e,Qe(e.tableId,e.store)),gr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=or(t,["cellId","descending","offset","limit"]);return dr(s,We(s.tableId,o,r,n,l,s.store))},yr=({store:e,tableComponent:t=br,getTableComponentProps:o,separator:r,debugIds:n})=>Ir(L(Me(e),(r=>Ho(t,tr(er({},Go(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),mr=({valueId:e,store:t,debugIds:r})=>{var n;return Ir(o+(null!=(n=Ze(e,t))?n:o),void 0,r,e)},Cr=({store:e,valueComponent:t=mr,getValueComponentProps:o,separator:r,debugIds:n})=>Ir(L(Xe(e),(r=>Ho(t,tr(er({},Go(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),fr=({metricId:e,metrics:t,debugIds:r})=>{var n;return Ir(null!=(n=Ht(e,t))?n:o,void 0,r,e)},wr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=vr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(ee(o),e),a=Jt(e,t,d);return Ir(L(a,(e=>Ho(r,tr(er({},Go(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},hr=({indexId:e,indexes:t,sliceComponent:o=wr,getSliceComponentProps:r,separator:n,debugIds:l})=>Ir(L(zt(e,t),(n=>Ho(o,tr(er({},Go(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),kr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=vr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Jo(oe(o),e),i=Zt(e,t,s);return Ir(h(u)||h(i)?null:Ho(r,tr(er({},Go(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},Pr=e=>ir(e,$t,e.remoteRowId),Rr=e=>ir(e,eo,e.firstRowId),xr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return Ir(o+(null!=(s=bo(e,t,r,n))?s:o),void 0,l,r)},qr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=xr,getResultCellComponentProps:n,separator:l,debugIds:s})=>Ir(L(vo(e,t,o),(l=>Ho(r,tr(er({},Go(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Sr=e=>ur(e,co(e.queryId,e.queries)),Or=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=or(t,["cellId","descending","offset","limit"]);return ur(s,Io(s.queryId,o,r,n,l,s.queries))},Lr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return Ir(null!=(n=qo(t,e))?n:o,void 0,r,t)},Tr=ar((e=>e[0])),jr=ar((e=>h(e[1])?[]:[e[1]])),Br=ar((e=>e[2]));export{Tr as BackwardCheckpointsView,pr as CellView,Lr as CheckpointView,jr as CurrentCheckpointView,Br as ForwardCheckpointsView,hr as IndexView,Rr as LinkedRowsView,Pr as LocalRowsView,fr as MetricView,cr as Provider,kr as RemoteRowView,xr as ResultCellView,qr as ResultRowView,Or as ResultSortedTableView,Sr as ResultTableView,vr as RowView,wr as SliceView,gr as SortedTableView,br as TableView,yr as TablesView,mr as ValueView,Cr as ValuesView,ot as useAddRowCallback,Ke as useCell,Ge as useCellIds,xt as useCellIdsListener,St as useCellListener,qo as useCheckpoint,xo as useCheckpointIds,Eo as useCheckpointIdsListener,Mo as useCheckpointListener,le as useCheckpoints,Ro as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,Po as useCreateCheckpoints,Wt as useCreateIndexes,Te as useCreateMergeableStore,Vt as useCreateMetrics,Fo as useCreatePersister,no as useCreateQueries,Ut as useCreateRelationships,Le as useCreateStore,Vo as useCreateSynchronizer,ct as useDelCellCallback,at as useDelRowCallback,it as useDelTableCallback,ut as useDelTablesCallback,pt as useDelValueCallback,It as useDelValuesCallback,Ft as useDidFinishTransactionListener,Oo as useGoBackwardCallback,Lo as useGoForwardCallback,To as useGoToCallback,Je as useHasCell,qt as useHasCellListener,_e as useHasRow,Pt as useHasRowListener,Fe as useHasTable,De as useHasTableCell,ft as useHasTableCellListener,yt as useHasTableListener,Be as useHasTables,vt as useHasTablesListener,Ye as useHasValue,jt as useHasValueListener,Ne as useHasValues,Ot as useHasValuesListener,Gt as useIndexIds,$ as useIndexes,_t as useIndexesIds,ee as useIndexesOrIndexesById,eo as useLinkedRowIds,ro as useLinkedRowIdsListener,$t as useLocalRowIds,oo as useLocalRowIdsListener,Ht as useMetric,Dt as useMetricIds,Qt as useMetricListener,Y as useMetrics,At as useMetricsIds,Z as useMetricsOrMetricsById,X as useProvideStore,re as useQueries,lo as useQueriesIds,ne as useQueriesOrQueriesById,so as useQueryIds,Bo as useRedoInformation,Yt as useRelationshipIds,te as useRelationships,Xt as useRelationshipsIds,oe as useRelationshipsOrRelationshipsById,Zt as useRemoteRowId,to as useRemoteRowIdListener,bo as useResultCell,vo as useResultCellIds,ho as useResultCellIdsListener,ko as useResultCellListener,po as useResultRow,ao as useResultRowCount,mo as useResultRowCountListener,co as useResultRowIds,Co as useResultRowIdsListener,wo as useResultRowListener,Io as useResultSortedRowIds,fo as useResultSortedRowIdsListener,uo as useResultTable,io as useResultTableCellIds,yo as useResultTableCellIdsListener,go as useResultTableListener,ze as useRow,He as useRowCount,wt as useRowCountListener,Qe as useRowIds,ht as useRowIdsListener,Rt as useRowListener,nt as useSetCellCallback,So as useSetCheckpointCallback,rt as useSetPartialRowCallback,st as useSetPartialValuesCallback,tt as useSetRowCallback,et as useSetTableCallback,$e as useSetTablesCallback,dt as useSetValueCallback,lt as useSetValuesCallback,zt as useSliceIds,Kt as useSliceIdsListener,Jt as useSliceRowIds,Nt as useSliceRowIdsListener,We as useSortedRowIds,kt as useSortedRowIdsListener,Et as useStartTransactionListener,N as useStore,je as useStoreIds,U as useStoreOrStoreById,Ve as useTable,Ae as useTableCellIds,Ct as useTableCellIdsListener,Me as useTableIds,gt as useTableIdsListener,mt as useTableListener,Ee as useTables,bt as useTablesListener,jo as useUndoInformation,Ze as useValue,Xe as useValueIds,Tt as useValueIdsListener,Bt as useValueListener,Ue as useValues,Lt as useValuesListener,Mt as useWillFinishTransactionListener};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",c=i+"s",a=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>t(e)==r,P=e=>t(e)==n,R=e=>e.length,x=()=>{},q=(e,t)=>e.every(t),S=(e,t)=>R(e)===R(t)&&q(e,((e,o)=>t[o]===e)),O=(e,t)=>e.map(t),L=Object,j=e=>L.getPrototypeOf(e),B=L.entries,E=e=>!w(e)&&k(j(e),(e=>e==L.prototype||w(j(e))),(()=>!0)),T=L.keys,M=(e,t)=>k(e,(e=>e[t])),F=(e,t)=>{const o=B(e);return R(o)===R(T(t))&&q(o,(([e,o])=>E(o)?!!E(t[e])&&F(t[e],o):t[e]===o))},{createContext:V,useContext:A,useEffect:D}=e,H=V([]),Q=(e,t)=>{var o;const r=A(H);return w(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return w(e)||h(e)?o:e},z=e=>{var t;return T(null!=(t=A(H)[e])?t:{})},G=e=>Q(e,0),J=e=>W(e,0),K=(e,t)=>{const{12:o,13:r}=A(H);D((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},N=e=>Q(e,2),U=e=>W(e,2),X=e=>Q(e,4),Y=e=>W(e,4),Z=e=>Q(e,6),$=e=>W(e,6),_=e=>Q(e,8),ee=e=>W(e,8),te=e=>Q(e,10),oe=e=>W(e,10),re=e=>e.toLowerCase();re(l);const ne="Transaction";re(ne);var le=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:se,useEffect:de,useMemo:ue,useLayoutEffect:ie,useRef:ce,useState:ae,useSyncExternalStore:Ie}=e,pe=[],ve=[{},[],[pe,void 0,pe],void 0,!1,0],be=[F,S,([e,t,o],[r,n,l])=>t===n&&S(e,r)&&S(o,l)],ge=(e,t)=>e===t,ye=(e,t,o=pe)=>{const[,r]=ae(),[n,l]=ae();return de((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},me=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},Ce=(e,t,r,n=pe)=>{const l=ce(ve[r]),s=se((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:ve[r];return(null!=(d=be[r])?d:ge)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=se((l=>me(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return Ie(u,s)},fe=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),we=(e,t,o,r=pe,n=x,l=pe,...s)=>{const d=J(e);return se((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...ke(s,r,e),o),o)))))),[d,t,...r,...l,...he(s)])},ke=(e,t,o)=>O(e,(e=>P(e)?e(o,t):e)),he=e=>{return t=e=>!P(e),e.filter(t);var t},Pe=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((e=>o(null==l?void 0:l["del"+t](...ke(n,l,e)))),[l,t,...r,...he(n)])},Re=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},xe=(e,t=pe)=>ue(e,t),qe=(e,t=pe)=>ue(e,t),Se=()=>z(1),Oe=e=>Ce(c,J(e),4,[]),Le=e=>Ce(c,J(e),0),je=e=>Ce(a,J(e),1),Be=(e,t)=>Ce(i,J(t),4,[e]),Ee=(e,t)=>Ce(i,J(t),0,[e]),Te=(e,t)=>Ce(i+y,J(t),1,[e]),Me=(e,t,o)=>Ce(i+g,J(o),4,[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e(a,J(r),e,t,pe,o),pt=(e,t,o,r,n)=>fe(d+i,J(n),t,o,[e],r),vt=(e,t,o,r,n)=>fe(i,J(n),t,o,[e],r),bt=(e,t,o,r,n)=>fe(i+y,J(n),t,o,[e],r),gt=(e,t,o,r,n,l)=>fe(d+i+g,J(l),o,r,[e,t],n),yt=(e,t,o,r,n)=>fe(p,J(n),t,o,[e],r),mt=(e,t,o,r,n)=>fe(v,J(n),t,o,[e],r),Ct=(e,t,o,r,n,l,s,d,u)=>fe(b,J(u),l,s,[e,t,o,r,n],d),ft=(e,t,o,r,n,l)=>fe(d+I,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l)=>fe(I,J(l),o,r,[e,t],n),kt=(e,t,o,r,n,l)=>fe(y,J(l),o,r,[e,t],n),ht=(e,t,o,r,n,l,s)=>fe(d+g,J(s),r,n,[e,t,o],l),Pt=(e,t,o,r,n,l,s)=>fe(g,J(s),r,n,[e,t,o],l),Rt=(e,t,o,r)=>fe(d+C,J(r),e,t,[],o),xt=(e,t,o,r)=>fe(C,J(r),e,t,pe,o),qt=(e,t,o,r)=>fe(f,J(r),e,t,pe,o),St=(e,t,o,r,n)=>fe(d+m,J(n),t,o,[e],r),Ot=(e,t,o,r,n)=>fe(m,J(n),t,o,[e],r),Lt=(e,t,o)=>fe("Start"+ne,J(o),e,t),jt=(e,t,o)=>fe("WillFinish"+ne,J(o),e,t),Bt=(e,t,o)=>fe("DidFinish"+ne,J(o),e,t),Et=(e,t,o)=>ye(e,t,o),Tt=()=>z(3),Mt=e=>Ce("MetricIds",U(e),1),Ft=(e,t)=>Ce("Metric",U(t),3,[e]),Vt=(e,t,o,r)=>fe("Metric",U(r),t,o,[e]),At=(e,t,o)=>ye(e,t,o),Dt=()=>z(5),Ht=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Qt=e=>Ce("IndexIds",Y(e),1),Wt=(e,t,o)=>Ce("Slice"+v,Y(o),1,[e,t]),zt=(e,t,o,r)=>fe("SliceIds",Y(r),t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ce("Checkpoint",oe(t),3,[e]),Po=(e=x,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Ro=e=>Re(e,"goBackward"),xo=e=>Re(e,"goForward"),qo=(e,t=pe,o,r=x,n=pe)=>{const l=oe(o);return se((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},So=e=>{var t;const r=oe(e),[n,l]=ko(r);return[(s=n,!(0==R(s))),Ro(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Oo=e=>{var t;const r=oe(e),[,,[n]]=ko(r);return[!w(n),xo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Lo=(e,t,o)=>fe("CheckpointIds",oe(o),e,t),jo=(e,t,o,r)=>fe("Checkpoint",oe(r),t,o,[e]),Bo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&le(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),de((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Eo=(e,t,o=pe,r,n=pe)=>{const[l,s]=ae();return de((()=>{le(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),de((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:To,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>w(e)?{}:e(...t),Wo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var zo=Object.defineProperty,Go=Object.defineProperties,Jo=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable,Xo=(e,t,o)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Yo=(e,t)=>{for(var o in t||(t={}))No.call(t,o)&&Xo(e,o,t[o]);if(Ko)for(var o of Ko(t))Uo.call(t,o)&&Xo(e,o,t[o]);return e},Zo=(e,t)=>Go(e,Jo(t)),$o=(e,t)=>{var o={};for(var r in e)No.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Ko)for(var r of Ko(e))t.indexOf(r)<0&&Uo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:_o,useContext:er,useMemo:tr,useState:or}=e,rr=({tableId:e,store:t,rowComponent:o=cr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>ur(O(d,(l=>Fo(o,Zo(Yo({},Qo(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),nr=({queryId:e,queries:t,resultRowComponent:o=hr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>ur(O(s,(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),lr=({relationshipId:e,relationships:t,rowComponent:o=cr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Wo($(t),e),a=s(e,d,u);return ur(O(a,(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},sr=e=>({checkpoints:t,checkpointComponent:o=xr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return ur(O(e(ko(s)),(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},dr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:I})=>{const p=er(H),[v,b]=or({}),g=_o(((e,t)=>b((o=>M(o,e)==t?o:Zo(Yo({},o),{[e]:t})))),[]),y=_o((e=>b((t=>Yo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Fo(H.Provider,{value:tr((()=>[null!=e?e:p[0],Yo(Yo(Yo({},p[1]),t),v),null!=o?o:p[2],Yo(Yo({},p[3]),r),null!=n?n:p[4],Yo(Yo({},p[5]),l),null!=s?s:p[6],Yo(Yo({},p[7]),d),null!=u?u:p[8],Yo(Yo({},p[9]),i),null!=c?c:p[10],Yo(Yo({},p[11]),a),g,y]),[e,t,v,o,r,n,l,s,d,u,i,c,a,p,g,y])},I)},ur=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ir=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ze(e,t,r,n))?s:o),void 0,l,r)},cr=({tableId:e,rowId:t,store:o,cellComponent:r=ir,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>ur(O(((e,t,o,r)=>{const n=Qe(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ar=e=>rr(e,Ve(e.tableId,e.store)),Ir=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return rr(s,Ae(s.tableId,o,r,n,l,s.store))},pr=({store:e,tableComponent:t=ar,getTableComponentProps:o,separator:r,debugIds:n})=>ur(O(je(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),vr=({valueId:e,store:t,debugIds:r})=>{var n;return ur(o+(null!=(n=Ue(e,t))?n:o),void 0,r,e)},br=({store:e,valueComponent:t=vr,getValueComponentProps:o,separator:r,debugIds:n})=>ur(O(Ke(e),(r=>Fo(t,Zo(Yo({},Qo(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),gr=({metricId:e,metrics:t,debugIds:r})=>{var n;return ur(null!=(n=Ft(e,t))?n:o,void 0,r,e)},yr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=cr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(Y(o),e),c=Wt(e,t,d);return ur(O(c,(e=>Fo(r,Zo(Yo({},Qo(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},mr=({indexId:e,indexes:t,sliceComponent:o=yr,getSliceComponentProps:r,separator:n,debugIds:l})=>ur(O(Ht(e,t),(n=>Fo(o,Zo(Yo({},Qo(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),Cr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=cr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Wo($(o),e),i=Ut(e,t,s);return ur(w(u)||w(i)?null:Fo(r,Zo(Yo({},Qo(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},fr=e=>lr(e,Xt,e.remoteRowId),wr=e=>lr(e,Yt,e.firstRowId),kr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return ur(o+(null!=(s=ao(e,t,r,n))?s:o),void 0,l,r)},hr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=kr,getResultCellComponentProps:n,separator:l,debugIds:s})=>ur(O(co(e,t,o),(l=>Fo(r,Zo(Yo({},Qo(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Pr=e=>nr(e,so(e.queryId,e.queries)),Rr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=$o(t,["cellId","descending","offset","limit"]);return nr(s,uo(s.queryId,o,r,n,l,s.queries))},xr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return ur(null!=(n=ho(t,e))?n:o,void 0,r,t)},qr=sr((e=>e[0])),Sr=sr((e=>w(e[1])?[]:[e[1]])),Or=sr((e=>e[2]));export{qr as BackwardCheckpointsView,ir as CellView,xr as CheckpointView,Sr as CurrentCheckpointView,Or as ForwardCheckpointsView,mr as IndexView,wr as LinkedRowsView,fr as LocalRowsView,gr as MetricView,dr as Provider,Cr as RemoteRowView,kr as ResultCellView,hr as ResultRowView,Rr as ResultSortedTableView,Pr as ResultTableView,cr as RowView,yr as SliceView,Ir as SortedTableView,ar as TableView,pr as TablesView,vr as ValueView,br as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,kt as useCellIdsListener,Pt as useCellListener,ho as useCheckpoint,ko as useCheckpointIds,Lo as useCheckpointIdsListener,jo as useCheckpointListener,te as useCheckpoints,wo as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Et as useCreateMetrics,Bo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,xe as useCreateStore,Eo as useCreateSynchronizer,dt as useDelCellCallback,st as useDelRowCallback,lt as useDelTableCallback,nt as useDelTablesCallback,it as useDelValueCallback,ut as useDelValuesCallback,Bt as useDidFinishTransactionListener,Ro as useGoBackwardCallback,xo as useGoForwardCallback,qo as useGoToCallback,We as useHasCell,ht as useHasCellListener,De as useHasRow,ft as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,pt as useHasTableListener,Oe as useHasTables,ct as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,Rt as useHasValuesListener,Qt as useIndexIds,X as useIndexes,Dt as useIndexesIds,Y as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,N as useMetrics,Tt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,to as useQueriesIds,ee as useQueriesOrQueriesById,oo as useQueryIds,Oo as useRedoInformation,Nt as useRelationshipIds,Z as useRelationships,Kt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,ao as useResultCell,co as useResultCellIds,mo as useResultCellIdsListener,Co as useResultCellListener,io as useResultRow,lo as useResultRowCount,vo as useResultRowCountListener,so as useResultRowIds,bo as useResultRowIdsListener,yo as useResultRowListener,uo as useResultSortedRowIds,go as useResultSortedRowIdsListener,ro as useResultTable,no as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Fe as useRowCount,yt as useRowCountListener,Ve as useRowIds,mt as useRowIdsListener,wt as useRowListener,et as useSetCellCallback,Po as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,rt as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,Ae as useSortedRowIds,Ct as useSortedRowIdsListener,Lt as useStartTransactionListener,G as useStore,Se as useStoreIds,J as useStoreOrStoreById,Ee as useTable,Te as useTableCellIds,bt as useTableCellIdsListener,je as useTableIds,It as useTableIdsListener,vt as useTableListener,Le as useTables,at as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,qt as useValueIdsListener,Ot as useValueListener,Je as useValues,xt as useValuesListener,jt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",r=t(o),n=t(t),l="Listener",s="Result",d="Has",u="Ids",i="Table",a=i+"s",c=i+u,I="Row",p=I+"Count",v=I+u,b="Sorted"+I+u,g="Cell",y=g+u,m="Value",C=m+"s",f=m+u,w=globalThis,h=e=>null==e,k=(e,t,o)=>h(e)?null==o?void 0:o():t(e),P=e=>t(e)==r,R=e=>t(e)==n,x=e=>e.length,q=()=>{},S=(e,t)=>e.every(t),O=(e,t)=>x(e)===x(t)&&S(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),T=Object,j=e=>T.getPrototypeOf(e),B=T.entries,E=e=>!h(e)&&k(j(e),(e=>e==T.prototype||h(j(e))),(()=>!0)),M=T.keys,F=(e,t)=>k(e,(e=>e[t])),V=(e,t)=>{const o=B(e);return x(o)===x(M(t))&&S(o,(([e,o])=>E(o)?!!E(t[e])&&V(t[e],o):t[e]===o))},{createContext:A,useContext:D,useEffect:H}=e,Q=(z=()=>A([]),((e,t)=>t in e)(W=w,_="tinybase_uirc")||(W[_]=z()),W[_]);var W,_,z;const G=(e,t)=>{var o;const r=D(Q);return h(e)?r[t]:P(e)?F(null!=(o=r[t+1])?o:{},e):e},J=(e,t)=>{const o=G(e,t);return h(e)||P(e)?o:e},K=e=>{var t;return M(null!=(t=D(Q)[e])?t:{})},N=e=>G(e,0),U=e=>J(e,0),X=(e,t)=>{const{12:o,13:r}=D(Q);H((()=>(null==o||o(e,t),()=>null==r?void 0:r(e))),[o,e,t,r])},Y=e=>G(e,2),Z=e=>J(e,2),$=e=>G(e,4),ee=e=>J(e,4),te=e=>G(e,6),oe=e=>J(e,6),re=e=>G(e,8),ne=e=>J(e,8),le=e=>G(e,10),se=e=>J(e,10),de=e=>e.toLowerCase();de(l);const ue="Transaction";de(ue);var ie=(e,t,o)=>new Promise(((r,n)=>{var l=e=>{try{d(o.next(e))}catch(e){n(e)}},s=e=>{try{d(o.throw(e))}catch(e){n(e)}},d=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,s);d((o=o.apply(e,t)).next())}));const{useCallback:ae,useEffect:ce,useMemo:Ie,useLayoutEffect:pe,useRef:ve,useState:be,useSyncExternalStore:ge}=e,ye=[],me=[{},[],[ye,void 0,ye],void 0,!1,0],Ce=[V,O,([e,t,o],[r,n,l])=>t===n&&O(e,r)&&O(o,l)],fe=(e,t)=>e===t,we=(e,t,o=ye)=>{const[,r]=be(),[n,l]=be();return ce((()=>{const o=e?t(e):void 0;return l(o),r([]),null==o?void 0:o.destroy}),[e,...o]),n},he=(e,t,...o)=>{var r;const n=null==(r=null==e?void 0:e["add"+t+l])?void 0:r.call(e,...o);return()=>null==e?void 0:e.delListener(n)},ke=(e,t,r,n=ye)=>{const l=ve(me[r]),s=ae((()=>{var o,s,d;const u=null!=(s=null==(o=null==t?void 0:t[(4==r?"has":"get")+e])?void 0:o.call(t,...n))?s:me[r];return(null!=(d=Ce[r])?d:fe)(u,l.current)?l.current:l.current=u}),[t,r,e,...n]),u=ae((l=>he(t,(4==r?d:o)+e,...n,l)),[t,r,e,...n]);return ge(u,s)},Pe=(e,t,o,r=ye,n=ye,...l)=>pe((()=>he(t,e,...n,o,...l)),[t,e,...n,...r,...l]),Re=(e,t,o,r=ye,n=q,l=ye,...s)=>{const d=U(e);return ae((e=>k(d,(r=>k(o(e,r),(o=>n(r["set"+t](...xe(s,r,e),o),o)))))),[d,t,...r,...l,...qe(s)])},xe=(e,t,o)=>L(e,(e=>R(e)?e(o,t):e)),qe=e=>{return t=e=>!R(e),e.filter(t);var t},Se=(e,t,o=q,r=ye,...n)=>{const l=U(e);return ae((e=>o(null==l?void 0:l["del"+t](...xe(n,l,e)))),[l,t,...r,...qe(n)])},Oe=(e,t,o)=>{const r=se(e);return ae((()=>null==r?void 0:r[t](o)),[r,t,o])},Le=(e,t=ye)=>Ie(e,t),Te=(e,t=ye)=>Ie(e,t),je=()=>K(1),Be=e=>ke(a,U(e),4,[]),Ee=e=>ke(a,U(e),0),Me=e=>ke(c,U(e),1),Fe=(e,t)=>ke(i,U(t),4,[e]),Ve=(e,t)=>ke(i,U(t),0,[e]),Ae=(e,t)=>ke(i+y,U(t),1,[e]),De=(e,t,o)=>ke(i+g,U(o),4,[e,t]),He=(e,t)=>ke(p,U(t),5,[e]),Qe=(e,t)=>ke(v,U(t),1,[e]),We=(e,t,o,r=0,n,l)=>ke(b,U(l),1,[e,t,o,r,n]),_e=(e,t,o)=>ke(I,U(o),4,[e,t]),ze=(e,t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ke("RemoteRowId",oe(o),3,[e,t]),$t=(e,t,o)=>ke("Local"+v,oe(o),1,[e,t]),eo=(e,t,o)=>ke("Linked"+v,oe(o),1,[e,t]),to=(e,t,o,r,n)=>Pe("RemoteRowId",oe(n),o,r,[e,t]),oo=(e,t,o,r,n)=>Pe("Local"+v,oe(n),o,r,[e,t]),ro=(e,t,o,r,n)=>Pe("Linked"+v,oe(n),o,r,[e,t]),no=(e,t,o)=>we(e,t,o),lo=()=>K(9),so=e=>ke("QueryIds",ne(e),1),uo=(e,t)=>ke(s+i,ne(t),0,[e]),io=(e,t)=>ke(s+i+y,ne(t),1,[e]),ao=(e,t)=>ke(s+p,ne(t),5,[e]),co=(e,t)=>ke(s+v,ne(t),1,[e]),Io=(e,t,o,r=0,n,l)=>ke(s+b,ne(l),1,[e,t,o,r,n]),po=(e,t,o)=>ke(s+I,ne(o),0,[e,t]),vo=(e,t,o)=>ke(s+y,ne(o),1,[e,t]),bo=(e,t,o,r)=>ke(s+g,ne(r),3,[e,t,o]),go=(e,t,o,r)=>Pe(s+i,ne(r),t,o,[e]),yo=(e,t,o,r)=>Pe(s+i+y,ne(r),t,o,[e]),mo=(e,t,o,r)=>Pe(s+p,ne(r),t,o,[e]),Co=(e,t,o,r)=>Pe(s+v,ne(r),t,o,[e]),fo=(e,t,o,r,n,l,d,u)=>Pe(s+b,ne(u),l,d,[e,t,o,r,n]),wo=(e,t,o,r,n)=>Pe(s+I,ne(n),o,r,[e,t]),ho=(e,t,o,r,n)=>Pe(s+y,ne(n),o,r,[e,t]),ko=(e,t,o,r,n,l)=>Pe(s+g,ne(l),r,n,[e,t,o]),Po=(e,t,o)=>we(e,t,o),Ro=()=>K(11),xo=e=>ke("CheckpointIds",se(e),2),qo=(e,t)=>ke("Checkpoint",se(t),3,[e]),So=(e=q,t=ye,o,r=q,n=ye)=>{const l=se(o);return ae((t=>k(l,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[l,...t,...n])},Oo=e=>Oe(e,"goBackward"),Lo=e=>Oe(e,"goForward"),To=(e,t=ye,o,r=q,n=ye)=>{const l=se(o);return ae((t=>k(l,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[l,...t,...n])},jo=e=>{var t;const r=se(e),[n,l]=xo(r);return[(s=n,!(0==x(s))),Oo(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},Bo=e=>{var t;const r=se(e),[,,[n]]=xo(r);return[!h(n),Lo(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},Eo=(e,t,o)=>Pe("CheckpointIds",se(o),e,t),Mo=(e,t,o,r)=>Pe("Checkpoint",se(r),t,o,[e]),Fo=(e,t,o=ye,r,n=ye,l,s=ye)=>{const[,d]=be(),[u,i]=be();return ce((()=>{ie(void 0,null,(function*(){const o=e?yield t(e):void 0;i(o),o&&r&&ie(void 0,null,(function*(){yield r(o),d([])}))}))}),[e,...o,...n]),ce((()=>()=>{u&&(u.destroy(),null==l||l(u))}),[u,...s]),u},Vo=(e,t,o=ye,r,n=ye)=>{const[l,s]=be();return ce((()=>{ie(void 0,null,(function*(){const o=e?yield t(e):void 0;s(o)}))}),[e,...o]),ce((()=>()=>{l&&(l.destroy(),null==r||r(l))}),[l,...n]),l},{PureComponent:Ao,Fragment:Do,createElement:Ho,useCallback:Qo,useLayoutEffect:Wo,useRef:_o,useState:zo}=e,Go=(e,...t)=>h(e)?{}:e(...t),Jo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Ko=Object.defineProperty,No=Object.defineProperties,Uo=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,$o=(e,t,o)=>t in e?Ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,er=(e,t)=>{for(var o in t||(t={}))Yo.call(t,o)&&$o(e,o,t[o]);if(Xo)for(var o of Xo(t))Zo.call(t,o)&&$o(e,o,t[o]);return e},tr=(e,t)=>No(e,Uo(t)),or=(e,t)=>{var o={};for(var r in e)Yo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Xo)for(var r of Xo(e))t.indexOf(r)<0&&Zo.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:rr,useContext:nr,useMemo:lr,useState:sr}=e,dr=({tableId:e,store:t,rowComponent:o=vr,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>Ir(L(d,(l=>Ho(o,tr(er({},Go(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),ur=({queryId:e,queries:t,resultRowComponent:o=qr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>Ir(L(s,(n=>Ho(o,tr(er({},Go(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),ir=({relationshipId:e,relationships:t,rowComponent:o=vr,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=Jo(oe(t),e),c=s(e,d,u);return Ir(L(c,(e=>Ho(o,tr(er({},Go(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:l})))),n,l,d)},ar=e=>({checkpoints:t,checkpointComponent:o=Lr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=se(t);return Ir(L(e(xo(s)),(e=>Ho(o,tr(er({},Go(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},cr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:n,indexesById:l,relationships:s,relationshipsById:d,queries:u,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=nr(Q),[v,b]=sr({}),g=rr(((e,t)=>b((o=>F(o,e)==t?o:tr(er({},o),{[e]:t})))),[]),y=rr((e=>b((t=>er({},((e,t)=>(delete e[t],e))(t,e))))),[]);return Ho(Q.Provider,{value:lr((()=>[null!=e?e:p[0],er(er(er({},p[1]),t),v),null!=o?o:p[2],er(er({},p[3]),r),null!=n?n:p[4],er(er({},p[5]),l),null!=s?s:p[6],er(er({},p[7]),d),null!=u?u:p[8],er(er({},p[9]),i),null!=a?a:p[10],er(er({},p[11]),c),g,y]),[e,t,v,o,r,n,l,s,d,u,i,a,c,p,g,y])},I)},Ir=(e,t,o,r)=>{const n=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},pr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return Ir(o+(null!=(s=Ke(e,t,r,n))?s:o),void 0,l,r)},vr=({tableId:e,rowId:t,store:o,cellComponent:r=pr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>Ir(L(((e,t,o,r)=>{const n=Ge(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>Ho(r,tr(er({},Go(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),br=e=>dr(e,Qe(e.tableId,e.store)),gr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=or(t,["cellId","descending","offset","limit"]);return dr(s,We(s.tableId,o,r,n,l,s.store))},yr=({store:e,tableComponent:t=br,getTableComponentProps:o,separator:r,debugIds:n})=>Ir(L(Me(e),(r=>Ho(t,tr(er({},Go(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),mr=({valueId:e,store:t,debugIds:r})=>{var n;return Ir(o+(null!=(n=Ze(e,t))?n:o),void 0,r,e)},Cr=({store:e,valueComponent:t=mr,getValueComponentProps:o,separator:r,debugIds:n})=>Ir(L(Xe(e),(r=>Ho(t,tr(er({},Go(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),fr=({metricId:e,metrics:t,debugIds:r})=>{var n;return Ir(null!=(n=Ht(e,t))?n:o,void 0,r,e)},wr=({indexId:e,sliceId:t,indexes:o,rowComponent:r=vr,getRowComponentProps:n,separator:l,debugIds:s})=>{const[d,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(ee(o),e),a=Jt(e,t,d);return Ir(L(a,(e=>Ho(r,tr(er({},Go(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},hr=({indexId:e,indexes:t,sliceComponent:o=wr,getSliceComponentProps:r,separator:n,debugIds:l})=>Ir(L(zt(e,t),(n=>Ho(o,tr(er({},Go(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),kr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=vr,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Jo(oe(o),e),i=Zt(e,t,s);return Ir(h(u)||h(i)?null:Ho(r,tr(er({},Go(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},Pr=e=>ir(e,$t,e.remoteRowId),Rr=e=>ir(e,eo,e.firstRowId),xr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return Ir(o+(null!=(s=bo(e,t,r,n))?s:o),void 0,l,r)},qr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=xr,getResultCellComponentProps:n,separator:l,debugIds:s})=>Ir(L(vo(e,t,o),(l=>Ho(r,tr(er({},Go(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),Sr=e=>ur(e,co(e.queryId,e.queries)),Or=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=or(t,["cellId","descending","offset","limit"]);return ur(s,Io(s.queryId,o,r,n,l,s.queries))},Lr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return Ir(null!=(n=qo(t,e))?n:o,void 0,r,t)},Tr=ar((e=>e[0])),jr=ar((e=>h(e[1])?[]:[e[1]])),Br=ar((e=>e[2]));export{Tr as BackwardCheckpointsView,pr as CellView,Lr as CheckpointView,jr as CurrentCheckpointView,Br as ForwardCheckpointsView,hr as IndexView,Rr as LinkedRowsView,Pr as LocalRowsView,fr as MetricView,cr as Provider,kr as RemoteRowView,xr as ResultCellView,qr as ResultRowView,Or as ResultSortedTableView,Sr as ResultTableView,vr as RowView,wr as SliceView,gr as SortedTableView,br as TableView,yr as TablesView,mr as ValueView,Cr as ValuesView,ot as useAddRowCallback,Ke as useCell,Ge as useCellIds,xt as useCellIdsListener,St as useCellListener,qo as useCheckpoint,xo as useCheckpointIds,Eo as useCheckpointIdsListener,Mo as useCheckpointListener,le as useCheckpoints,Ro as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,Po as useCreateCheckpoints,Wt as useCreateIndexes,Te as useCreateMergeableStore,Vt as useCreateMetrics,Fo as useCreatePersister,no as useCreateQueries,Ut as useCreateRelationships,Le as useCreateStore,Vo as useCreateSynchronizer,ct as useDelCellCallback,at as useDelRowCallback,it as useDelTableCallback,ut as useDelTablesCallback,pt as useDelValueCallback,It as useDelValuesCallback,Ft as useDidFinishTransactionListener,Oo as useGoBackwardCallback,Lo as useGoForwardCallback,To as useGoToCallback,Je as useHasCell,qt as useHasCellListener,_e as useHasRow,Pt as useHasRowListener,Fe as useHasTable,De as useHasTableCell,ft as useHasTableCellListener,yt as useHasTableListener,Be as useHasTables,vt as useHasTablesListener,Ye as useHasValue,jt as useHasValueListener,Ne as useHasValues,Ot as useHasValuesListener,Gt as useIndexIds,$ as useIndexes,_t as useIndexesIds,ee as useIndexesOrIndexesById,eo as useLinkedRowIds,ro as useLinkedRowIdsListener,$t as useLocalRowIds,oo as useLocalRowIdsListener,Ht as useMetric,Dt as useMetricIds,Qt as useMetricListener,Y as useMetrics,At as useMetricsIds,Z as useMetricsOrMetricsById,X as useProvideStore,re as useQueries,lo as useQueriesIds,ne as useQueriesOrQueriesById,so as useQueryIds,Bo as useRedoInformation,Yt as useRelationshipIds,te as useRelationships,Xt as useRelationshipsIds,oe as useRelationshipsOrRelationshipsById,Zt as useRemoteRowId,to as useRemoteRowIdListener,bo as useResultCell,vo as useResultCellIds,ho as useResultCellIdsListener,ko as useResultCellListener,po as useResultRow,ao as useResultRowCount,mo as useResultRowCountListener,co as useResultRowIds,Co as useResultRowIdsListener,wo as useResultRowListener,Io as useResultSortedRowIds,fo as useResultSortedRowIdsListener,uo as useResultTable,io as useResultTableCellIds,yo as useResultTableCellIdsListener,go as useResultTableListener,ze as useRow,He as useRowCount,wt as useRowCountListener,Qe as useRowIds,ht as useRowIdsListener,Rt as useRowListener,nt as useSetCellCallback,So as useSetCheckpointCallback,rt as useSetPartialRowCallback,st as useSetPartialValuesCallback,tt as useSetRowCallback,et as useSetTableCallback,$e as useSetTablesCallback,dt as useSetValueCallback,lt as useSetValuesCallback,zt as useSliceIds,Kt as useSliceIdsListener,Jt as useSliceRowIds,Nt as useSliceRowIdsListener,We as useSortedRowIds,kt as useSortedRowIdsListener,Et as useStartTransactionListener,N as useStore,je as useStoreIds,U as useStoreOrStoreById,Ve as useTable,Ae as useTableCellIds,Ct as useTableCellIdsListener,Me as useTableIds,gt as useTableIdsListener,mt as useTableListener,Ee as useTables,bt as useTablesListener,jo as useUndoInformation,Ze as useValue,Xe as useValueIds,Tt as useValueIdsListener,Bt as useValueListener,Ue as useValues,Lt as useValuesListener,Mt as useWillFinishTransactionListener};
|
|
Binary file
|
package/es6/ui-react/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
const getTypeOf = (thing) => typeof thing;
|
|
4
|
+
const TINYBASE = 'tinybase';
|
|
4
5
|
const EMPTY_STRING = '';
|
|
5
6
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
6
7
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -24,6 +25,7 @@ const VALUE = 'Value';
|
|
|
24
25
|
const VALUES = VALUE + 's';
|
|
25
26
|
const VALUE_IDS = VALUE + IDS;
|
|
26
27
|
|
|
28
|
+
const GLOBAL = globalThis;
|
|
27
29
|
const isUndefined = (thing) => thing == void 0;
|
|
28
30
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
29
31
|
isUndefined(value) ? (otherwise == null ? void 0 : otherwise()) : then(value);
|
|
@@ -57,6 +59,7 @@ const isObject = (obj) =>
|
|
|
57
59
|
);
|
|
58
60
|
const objIds = object.keys;
|
|
59
61
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
62
|
+
const objHas = (obj, id) => id in obj;
|
|
60
63
|
const objDel = (obj, id) => {
|
|
61
64
|
delete obj[id];
|
|
62
65
|
return obj;
|
|
@@ -75,9 +78,15 @@ const objIsEqual = (obj1, obj2) => {
|
|
|
75
78
|
)
|
|
76
79
|
);
|
|
77
80
|
};
|
|
81
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
82
|
+
if (!objHas(obj, id)) {
|
|
83
|
+
obj[id] = getDefaultValue();
|
|
84
|
+
}
|
|
85
|
+
return obj[id];
|
|
86
|
+
};
|
|
78
87
|
|
|
79
88
|
const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
|
|
80
|
-
const Context = createContext([]);
|
|
89
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
|
|
81
90
|
const useThing = (id, offset) => {
|
|
82
91
|
var _a;
|
|
83
92
|
const contextValue = useContext$1(Context);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
const getTypeOf = (thing) => typeof thing;
|
|
4
|
+
const TINYBASE = 'tinybase';
|
|
4
5
|
const EMPTY_STRING = '';
|
|
5
6
|
const STRING = getTypeOf(EMPTY_STRING);
|
|
6
7
|
const FUNCTION = getTypeOf(getTypeOf);
|
|
@@ -24,6 +25,7 @@ const VALUE = 'Value';
|
|
|
24
25
|
const VALUES = VALUE + 's';
|
|
25
26
|
const VALUE_IDS = VALUE + IDS;
|
|
26
27
|
|
|
28
|
+
const GLOBAL = globalThis;
|
|
27
29
|
const isUndefined = (thing) => thing == void 0;
|
|
28
30
|
const ifNotUndefined = (value, then, otherwise) =>
|
|
29
31
|
isUndefined(value) ? (otherwise == null ? void 0 : otherwise()) : then(value);
|
|
@@ -57,6 +59,7 @@ const isObject = (obj) =>
|
|
|
57
59
|
);
|
|
58
60
|
const objIds = object.keys;
|
|
59
61
|
const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
62
|
+
const objHas = (obj, id) => id in obj;
|
|
60
63
|
const objDel = (obj, id) => {
|
|
61
64
|
delete obj[id];
|
|
62
65
|
return obj;
|
|
@@ -75,9 +78,15 @@ const objIsEqual = (obj1, obj2) => {
|
|
|
75
78
|
)
|
|
76
79
|
);
|
|
77
80
|
};
|
|
81
|
+
const objEnsure = (obj, id, getDefaultValue) => {
|
|
82
|
+
if (!objHas(obj, id)) {
|
|
83
|
+
obj[id] = getDefaultValue();
|
|
84
|
+
}
|
|
85
|
+
return obj[id];
|
|
86
|
+
};
|
|
78
87
|
|
|
79
88
|
const {createContext, useContext: useContext$1, useEffect: useEffect$1} = React;
|
|
80
|
-
const Context = createContext([]);
|
|
89
|
+
const Context = objEnsure(GLOBAL, TINYBASE + '_uirc', () => createContext([]));
|
|
81
90
|
const useThing = (id, offset) => {
|
|
82
91
|
var _a;
|
|
83
92
|
const contextValue = useContext$1(Context);
|
package/min/ui-react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",i="Table",a=i+"s",l=i+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,C="Cell",m=C+c,y="Value",w=y+"s",k=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,v=e=>t(e)==r,q=e=>e.length,P=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>q(e)===q(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return q(o)===q(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:ie,useRef:ae,useState:le,useSyncExternalStore:Ie}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],Ce=(e,t)=>e===t,me=(e,t,o=pe)=>{const[,s]=le(),[r,d]=le();return ue((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},we=(e,t,s,r=pe)=>{const d=ae(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(be[s]??Ce)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return Ie(c,n)},ke=(e,t,o,s=pe,r=pe,...d)=>ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=P,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...Re(n,s,e),o),o)))))),[u,t,...s,...d,...fe(n)])},Re=(e,t,o)=>L(e,(e=>v(e)?e(o,t):e)),fe=e=>{return t=e=>!v(e),e.filter(t);var t},ve=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((e=>o(d?.["del"+t](...Re(r,d,e)))),[d,t,...s,...fe(r)])},qe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},Pe=(e,t=pe)=>ce(e,t),xe=(e,t=pe)=>ce(e,t),Se=()=>G(1),Le=e=>we(a,K(e),4,[]),Be=e=>we(a,K(e),0),Te=e=>we(l,K(e),1),Ee=(e,t)=>we(i,K(t),4,[e]),Me=(e,t)=>we(i,K(t),0,[e]),Fe=(e,t)=>we(i+m,K(t),1,[e]),Ve=(e,t,o)=>we(i+C,K(o),4,[e,t]),Ae=(e,t)=>we(p,K(t),5,[e]),Oe=(e,t)=>we(g,K(t),1,[e]),je=(e,t,o,s=0,r,d)=>we(b,K(d),1,[e,t,o,s,r]),De=(e,t,o)=>we(I,K(o),4,[e,t]),He=(e,t,o)=>we(I,K(o),0,[e,t]),Qe=(e,t,o)=>we(m,K(o),1,[e,t]),We=(e,t,o,s)=>we(C,K(s),4,[e,t,o]),ze=(e,t,o,s)=>we(C,K(s),3,[e,t,o]),Ge=e=>we(w,K(e),4,[]),Je=e=>we(w,K(e),0),Ke=e=>we(k,K(e),1),Ne=(e,t)=>we(y,K(t),4,[e]),Ue=(e,t)=>we(y,K(t),3,[e]),Xe=(e,t,o,s,r)=>he(o,a,e,t,s,r),Ye=(e,t,o,s,r,d)=>he(s,i,t,o,r,d,e),Ze=(e,t,o,s,r,d,n)=>he(r,I,o,s,d,n,e,t),$e=(e,t,o=pe,s,r=P,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(v(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},_e=(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>ke(u+y,K(r),t,o,[e],s),Lt=(e,t,o,s,r)=>ke(y,K(r),t,o,[e],s),Bt=(e,t,o)=>ke("Start"+de,K(o),e,t),Tt=(e,t,o)=>ke("WillFinish"+de,K(o),e,t),Et=(e,t,o)=>ke("DidFinish"+de,K(o),e,t),Mt=(e,t,o)=>me(e,t,o),Ft=()=>G(3),Vt=e=>we("MetricIds",X(e),1),At=(e,t)=>we("Metric",X(t),3,[e]),Ot=(e,t,o,s)=>ke("Metric",X(s),t,o,[e]),jt=(e,t,o)=>me(e,t,o),Dt=()=>G(5),Ht=(e,t)=>we("SliceIds",Z(t),1,[e]),Qt=e=>we("IndexIds",Z(e),1),Wt=(e,t,o)=>we("Slice"+g,Z(o),1,[e,t]),zt=(e,t,o,s)=>ke("SliceIds",Z(s),t,o,[e]),Gt=(e,t,o,s,r)=>ke("Slice"+g,Z(r),o,s,[e,t]),Jt=(e,t,o)=>me(e,t,o),Kt=()=>G(7),Nt=e=>we("RelationshipIds",_(e),1),Ut=(e,t,o)=>we("RemoteRowId",_(o),3,[e,t]),Xt=(e,t,o)=>we("Local"+g,_(o),1,[e,t]),Yt=(e,t,o)=>we("Linked"+g,_(o),1,[e,t]),Zt=(e,t,o,s,r)=>ke("RemoteRowId",_(r),o,s,[e,t]),$t=(e,t,o,s,r)=>ke("Local"+g,_(r),o,s,[e,t]),_t=(e,t,o,s,r)=>ke("Linked"+g,_(r),o,s,[e,t]),eo=(e,t,o)=>me(e,t,o),to=()=>G(9),oo=e=>we("QueryIds",te(e),1),so=(e,t)=>we(n+i,te(t),0,[e]),ro=(e,t)=>we(n+i+m,te(t),1,[e]),no=(e,t)=>we(n+p,te(t),5,[e]),uo=(e,t)=>we(n+g,te(t),1,[e]),co=(e,t,o,s=0,r,d)=>we(n+b,te(d),1,[e,t,o,s,r]),io=(e,t,o)=>we(n+I,te(o),0,[e,t]),ao=(e,t,o)=>we(n+m,te(o),1,[e,t]),lo=(e,t,o,s)=>we(n+C,te(s),3,[e,t,o]),Io=(e,t,o,s)=>ke(n+i,te(s),t,o,[e]),po=(e,t,o,s)=>ke(n+i+m,te(s),t,o,[e]),go=(e,t,o,s)=>ke(n+p,te(s),t,o,[e]),bo=(e,t,o,s)=>ke(n+g,te(s),t,o,[e]),Co=(e,t,o,s,r,d,u,c)=>ke(n+b,te(c),d,u,[e,t,o,s,r]),mo=(e,t,o,s,r)=>ke(n+I,te(r),o,s,[e,t]),yo=(e,t,o,s,r)=>ke(n+m,te(r),o,s,[e,t]),wo=(e,t,o,s,r,d)=>ke(n+C,te(d),s,r,[e,t,o]),ko=(e,t,o)=>me(e,t,o),ho=()=>G(11),Ro=e=>we("CheckpointIds",se(e),2),fo=(e,t)=>we("Checkpoint",se(t),3,[e]),vo=(e=P,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},qo=e=>qe(e,"goBackward"),Po=e=>qe(e,"goForward"),xo=(e,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},So=e=>{const t=se(e),[s,r]=Ro(t);return[(d=s,!(0==q(d))),qo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},Lo=e=>{const t=se(e),[,,[s]]=Ro(t);return[!h(s),Po(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},Bo=(e,t,o)=>ke("CheckpointIds",se(o),e,t),To=(e,t,o,s)=>ke("Checkpoint",se(s),t,o,[e]),Eo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,i]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;i(o),o&&s&&(async()=>{await s(o),u([])})()})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},Mo=(e,t,o=pe,s,r=pe)=>{const[d,n]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Fo,Fragment:Vo,createElement:Ao,useCallback:Oo,useLayoutEffect:jo,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>h(e)?{}:e(...t),Wo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:zo,useContext:Go,useMemo:Jo,useState:Ko}=e,No=({tableId:e,store:t,rowComponent:o=es,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>$o(L(u,(d=>Ao(o,{...Qo(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Uo=({queryId:e,queries:t,resultRowComponent:o=ps,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>$o(L(n,(r=>Ao(o,{...Qo(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Xo=({relationshipId:e,relationships:t,rowComponent:o=es,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,i,a]=Wo(_(t),e),l=n(e,u,c);return $o(L(l,(e=>Ao(o,{...Qo(s,e),key:e,tableId:a,rowId:e,store:i,debugIds:d}))),r,d,u)},Yo=e=>({checkpoints:t,checkpointComponent:o=Cs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return $o(L(e(Ro(n)),(e=>Ao(o,{...Qo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Zo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:i,checkpoints:a,checkpointsById:l,children:I})=>{const p=Go(Q),[g,b]=Ko({}),C=zo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=zo((e=>b((t=>({...A(t,e)})))),[]);return Ao(Q.Provider,{value:Jo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...i},a??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,i,a,l,p,C,m])},I)},$o=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},_o=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>$o(o+(ze(e,t,s,r)??o),void 0,d,s),es=({tableId:e,rowId:t,store:o,cellComponent:s=_o,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>$o(L(((e,t,o,s)=>{const r=Qe(t,o,s);return e??r})(d,e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),ts=e=>No(e,Oe(e.tableId,e.store)),os=({cellId:e,descending:t,offset:o,limit:s,...r})=>No(r,je(r.tableId,e,t,o,s,r.store)),ss=({store:e,tableComponent:t=ts,getTableComponentProps:o,separator:s,debugIds:r})=>$o(L(Te(e),(s=>Ao(t,{...Qo(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),rs=({valueId:e,store:t,debugIds:s})=>$o(o+(Ue(e,t)??o),void 0,s,e),ds=({store:e,valueComponent:t=rs,getValueComponentProps:o,separator:s,debugIds:r})=>$o(L(Ke(e),(s=>Ao(t,{...Qo(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ns=({metricId:e,metrics:t,debugIds:s})=>$o(At(e,t)??o,void 0,s,e),us=({indexId:e,sliceId:t,indexes:o,rowComponent:s=es,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),a=Wt(e,t,u);return $o(L(a,(e=>Ao(s,{...Qo(r,e),key:e,tableId:i,rowId:e,store:c,debugIds:n}))),d,n,t)},cs=({indexId:e,indexes:t,sliceComponent:o=us,getSliceComponentProps:s,separator:r,debugIds:d})=>$o(L(Ht(e,t),(r=>Ao(o,{...Qo(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),is=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=es,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Wo(_(o),e),i=Ut(e,t,n);return $o(h(c)||h(i)?null:Ao(s,{...Qo(r,i),key:i,tableId:c,rowId:i,store:u,debugIds:d}),void 0,d,t)},as=e=>Xo(e,Xt,e.remoteRowId),ls=e=>Xo(e,Yt,e.firstRowId),Is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>$o(o+(lo(e,t,s,r)??o),void 0,d,s),ps=({queryId:e,rowId:t,queries:o,resultCellComponent:s=Is,getResultCellComponentProps:r,separator:d,debugIds:n})=>$o(L(ao(e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),gs=e=>Uo(e,uo(e.queryId,e.queries)),bs=({cellId:e,descending:t,offset:o,limit:s,...r})=>Uo(r,co(r.queryId,e,t,o,s,r.queries)),Cs=({checkpoints:e,checkpointId:t,debugIds:s})=>$o(fo(t,e)??o,void 0,s,t),ms=Yo((e=>e[0])),ys=Yo((e=>h(e[1])?[]:[e[1]])),ws=Yo((e=>e[2]));export{ms as BackwardCheckpointsView,_o as CellView,Cs as CheckpointView,ys as CurrentCheckpointView,ws as ForwardCheckpointsView,cs as IndexView,ls as LinkedRowsView,as as LocalRowsView,ns as MetricView,Zo as Provider,is as RemoteRowView,Is as ResultCellView,ps as ResultRowView,bs as ResultSortedTableView,gs as ResultTableView,es as RowView,us as SliceView,os as SortedTableView,ts as TableView,ss as TablesView,rs as ValueView,ds as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,Rt as useCellIdsListener,vt as useCellListener,fo as useCheckpoint,Ro as useCheckpointIds,Bo as useCheckpointIdsListener,To as useCheckpointListener,oe as useCheckpoints,ho as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,ko as useCreateCheckpoints,jt as useCreateIndexes,xe as useCreateMergeableStore,Mt as useCreateMetrics,Eo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,Pe as useCreateStore,Mo as useCreateSynchronizer,ut as useDelCellCallback,nt as useDelRowCallback,dt as useDelTableCallback,rt as useDelTablesCallback,it as useDelValueCallback,ct as useDelValuesCallback,Et as useDidFinishTransactionListener,qo as useGoBackwardCallback,Po as useGoForwardCallback,xo as useGoToCallback,We as useHasCell,ft as useHasCellListener,De as useHasRow,kt as useHasRowListener,Ee as useHasTable,Ve as useHasTableCell,Ct as useHasTableCellListener,pt as useHasTableListener,Le as useHasTables,at as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,qt as useHasValuesListener,Qt as useIndexIds,Y as useIndexes,Dt as useIndexesIds,Z as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,At as useMetric,Vt as useMetricIds,Ot as useMetricListener,U as useMetrics,Ft as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,to as useQueriesIds,te as useQueriesOrQueriesById,oo as useQueryIds,Lo as useRedoInformation,Nt as useRelationshipIds,$ as useRelationships,Kt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,lo as useResultCell,ao as useResultCellIds,yo as useResultCellIdsListener,wo as useResultCellListener,io as useResultRow,no as useResultRowCount,go as useResultRowCountListener,uo as useResultRowIds,bo as useResultRowIdsListener,mo as useResultRowListener,co as useResultSortedRowIds,Co as useResultSortedRowIdsListener,so as useResultTable,ro as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Ae as useRowCount,mt as useRowCountListener,Oe as useRowIds,yt as useRowIdsListener,ht as useRowListener,et as useSetCellCallback,vo as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,st as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,je as useSortedRowIds,wt as useSortedRowIdsListener,Bt as useStartTransactionListener,J as useStore,Se as useStoreIds,K as useStoreOrStoreById,Me as useTable,Fe as useTableCellIds,bt as useTableCellIdsListener,Te as useTableIds,It as useTableIdsListener,gt as useTableListener,Be as useTables,lt as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,xt as useValueIdsListener,Lt as useValueListener,Je as useValues,Pt as useValuesListener,Tt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",i="Table",a=i+"s",l=i+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,C="Cell",m=C+c,y="Value",w=y+"s",k=y+c,h=globalThis,R=e=>null==e,v=(e,t,o)=>R(e)?o?.():t(e),f=e=>t(e)==s,q=e=>t(e)==r,P=e=>e.length,x=()=>{},S=(e,t)=>e.every(t),L=(e,t)=>P(e)===P(t)&&S(e,((e,o)=>t[o]===e)),T=(e,t)=>e.map(t),B=Object,E=e=>B.getPrototypeOf(e),M=B.entries,F=e=>!R(e)&&v(E(e),(e=>e==B.prototype||R(E(e))),(()=>!0)),V=B.keys,A=(e,t)=>v(e,(e=>e[t])),O=(e,t)=>(delete e[t],e),j=(e,t)=>{const o=M(e);return P(o)===P(V(t))&&S(o,(([e,o])=>F(o)?!!F(t[e])&&j(t[e],o):t[e]===o))},{createContext:D,useContext:H,useEffect:Q}=e,W=(G=()=>D([]),((e,t)=>t in e)(_=h,z="tinybase_uirc")||(_[z]=G()),_[z]);var _,z,G;const J=(e,t)=>{const o=H(W);return R(e)?o[t]:f(e)?A(o[t+1]??{},e):e},K=(e,t)=>{const o=J(e,t);return R(e)||f(e)?o:e},N=e=>V(H(W)[e]??{}),U=e=>J(e,0),X=e=>K(e,0),Y=(e,t)=>{const{12:o,13:s}=H(W);Q((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},Z=e=>J(e,2),$=e=>K(e,2),ee=e=>J(e,4),te=e=>K(e,4),oe=e=>J(e,6),se=e=>K(e,6),re=e=>J(e,8),de=e=>K(e,8),ne=e=>J(e,10),ue=e=>K(e,10),ce=e=>e.toLowerCase();ce(d);const ie="Transaction";ce(ie);const{useCallback:ae,useEffect:le,useMemo:Ie,useLayoutEffect:pe,useRef:ge,useState:be,useSyncExternalStore:Ce}=e,me=[],ye=[{},[],[me,void 0,me],void 0,!1,0],we=[j,L,([e,t,o],[s,r,d])=>t===r&&L(e,s)&&L(o,d)],ke=(e,t)=>e===t,he=(e,t,o=me)=>{const[,s]=be(),[r,d]=be();return le((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},Re=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ve=(e,t,s,r=me)=>{const d=ge(ye[s]),n=ae((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ye[s];return(we[s]??ke)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ae((d=>Re(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return Ce(c,n)},fe=(e,t,o,s=me,r=me,...d)=>pe((()=>Re(t,e,...r,o,...d)),[t,e,...r,...s,...d]),qe=(e,t,o,s=me,r=x,d=me,...n)=>{const u=X(e);return ae((e=>v(u,(s=>v(o(e,s),(o=>r(s["set"+t](...Pe(n,s,e),o),o)))))),[u,t,...s,...d,...xe(n)])},Pe=(e,t,o)=>T(e,(e=>q(e)?e(o,t):e)),xe=e=>{return t=e=>!q(e),e.filter(t);var t},Se=(e,t,o=x,s=me,...r)=>{const d=X(e);return ae((e=>o(d?.["del"+t](...Pe(r,d,e)))),[d,t,...s,...xe(r)])},Le=(e,t,o)=>{const s=ue(e);return ae((()=>s?.[t](o)),[s,t,o])},Te=(e,t=me)=>Ie(e,t),Be=(e,t=me)=>Ie(e,t),Ee=()=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,o)=>he(e,t,o),_t=()=>N(5),zt=(e,t)=>ve("SliceIds",te(t),1,[e]),Gt=e=>ve("IndexIds",te(e),1),Jt=(e,t,o)=>ve("Slice"+g,te(o),1,[e,t]),Kt=(e,t,o,s)=>fe("SliceIds",te(s),t,o,[e]),Nt=(e,t,o,s,r)=>fe("Slice"+g,te(r),o,s,[e,t]),Ut=(e,t,o)=>he(e,t,o),Xt=()=>N(7),Yt=e=>ve("RelationshipIds",se(e),1),Zt=(e,t,o)=>ve("RemoteRowId",se(o),3,[e,t]),$t=(e,t,o)=>ve("Local"+g,se(o),1,[e,t]),eo=(e,t,o)=>ve("Linked"+g,se(o),1,[e,t]),to=(e,t,o,s,r)=>fe("RemoteRowId",se(r),o,s,[e,t]),oo=(e,t,o,s,r)=>fe("Local"+g,se(r),o,s,[e,t]),so=(e,t,o,s,r)=>fe("Linked"+g,se(r),o,s,[e,t]),ro=(e,t,o)=>he(e,t,o),no=()=>N(9),uo=e=>ve("QueryIds",de(e),1),co=(e,t)=>ve(n+i,de(t),0,[e]),io=(e,t)=>ve(n+i+m,de(t),1,[e]),ao=(e,t)=>ve(n+p,de(t),5,[e]),lo=(e,t)=>ve(n+g,de(t),1,[e]),Io=(e,t,o,s=0,r,d)=>ve(n+b,de(d),1,[e,t,o,s,r]),po=(e,t,o)=>ve(n+I,de(o),0,[e,t]),go=(e,t,o)=>ve(n+m,de(o),1,[e,t]),bo=(e,t,o,s)=>ve(n+C,de(s),3,[e,t,o]),Co=(e,t,o,s)=>fe(n+i,de(s),t,o,[e]),mo=(e,t,o,s)=>fe(n+i+m,de(s),t,o,[e]),yo=(e,t,o,s)=>fe(n+p,de(s),t,o,[e]),wo=(e,t,o,s)=>fe(n+g,de(s),t,o,[e]),ko=(e,t,o,s,r,d,u,c)=>fe(n+b,de(c),d,u,[e,t,o,s,r]),ho=(e,t,o,s,r)=>fe(n+I,de(r),o,s,[e,t]),Ro=(e,t,o,s,r)=>fe(n+m,de(r),o,s,[e,t]),vo=(e,t,o,s,r,d)=>fe(n+C,de(d),s,r,[e,t,o]),fo=(e,t,o)=>he(e,t,o),qo=()=>N(11),Po=e=>ve("CheckpointIds",ue(e),2),xo=(e,t)=>ve("Checkpoint",ue(t),3,[e]),So=(e=x,t=me,o,s=x,r=me)=>{const d=ue(o);return ae((t=>v(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Lo=e=>Le(e,"goBackward"),To=e=>Le(e,"goForward"),Bo=(e,t=me,o,s=x,r=me)=>{const d=ue(o);return ae((t=>v(d,(o=>v(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Eo=e=>{const t=ue(e),[s,r]=Po(t);return[(d=s,!(0==P(d))),Lo(t),r,v(r,(e=>t?.getCheckpoint(e)))??o];var d},Mo=e=>{const t=ue(e),[,,[s]]=Po(t);return[!R(s),To(t),s,v(s,(e=>t?.getCheckpoint(e)))??o]},Fo=(e,t,o)=>fe("CheckpointIds",ue(o),e,t),Vo=(e,t,o,s)=>fe("Checkpoint",ue(s),t,o,[e]),Ao=(e,t,o=me,s,r=me,d,n=me)=>{const[,u]=be(),[c,i]=be();return le((()=>{(async()=>{const o=e?await t(e):void 0;i(o),o&&s&&(async()=>{await s(o),u([])})()})()}),[e,...o,...r]),le((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},Oo=(e,t,o=me,s,r=me)=>{const[d,n]=be();return le((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),le((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:jo,Fragment:Do,createElement:Ho,useCallback:Qo,useLayoutEffect:Wo,useRef:_o,useState:zo}=e,Go=(e,...t)=>R(e)?{}:e(...t),Jo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Ko,useContext:No,useMemo:Uo,useState:Xo}=e,Yo=({tableId:e,store:t,rowComponent:o=rs,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>os(T(u,(d=>Ho(o,{...Go(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Zo=({queryId:e,queries:t,resultRowComponent:o=ms,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>os(T(n,(r=>Ho(o,{...Go(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),$o=({relationshipId:e,relationships:t,rowComponent:o=rs,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,i,a]=Jo(se(t),e),l=n(e,u,c);return os(T(l,(e=>Ho(o,{...Go(s,e),key:e,tableId:a,rowId:e,store:i,debugIds:d}))),r,d,u)},es=e=>({checkpoints:t,checkpointComponent:o=ks,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=ue(t);return os(T(e(Po(n)),(e=>Ho(o,{...Go(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},ts=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:i,checkpoints:a,checkpointsById:l,children:I})=>{const p=No(W),[g,b]=Xo({}),C=Ko(((e,t)=>b((o=>A(o,e)==t?o:{...o,[e]:t}))),[]),m=Ko((e=>b((t=>({...O(t,e)})))),[]);return Ho(W.Provider,{value:Uo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...i},a??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,i,a,l,p,C,m])},I)},os=(e,t,o,s)=>{const r=R(t)||!Array.isArray(e)?e:T(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},ss=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>os(o+(Ke(e,t,s,r)??o),void 0,d,s),rs=({tableId:e,rowId:t,store:o,cellComponent:s=ss,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>os(T(((e,t,o,s)=>{const r=Ge(t,o,s);return e??r})(d,e,t,o),(d=>Ho(s,{...Go(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),ds=e=>Yo(e,Qe(e.tableId,e.store)),ns=({cellId:e,descending:t,offset:o,limit:s,...r})=>Yo(r,We(r.tableId,e,t,o,s,r.store)),us=({store:e,tableComponent:t=ds,getTableComponentProps:o,separator:s,debugIds:r})=>os(T(Ve(e),(s=>Ho(t,{...Go(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),cs=({valueId:e,store:t,debugIds:s})=>os(o+(Ze(e,t)??o),void 0,s,e),is=({store:e,valueComponent:t=cs,getValueComponentProps:o,separator:s,debugIds:r})=>os(T(Xe(e),(s=>Ho(t,{...Go(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),as=({metricId:e,metrics:t,debugIds:s})=>os(Ht(e,t)??o,void 0,s,e),ls=({indexId:e,sliceId:t,indexes:o,rowComponent:s=rs,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(te(o),e),a=Jt(e,t,u);return os(T(a,(e=>Ho(s,{...Go(r,e),key:e,tableId:i,rowId:e,store:c,debugIds:n}))),d,n,t)},Is=({indexId:e,indexes:t,sliceComponent:o=ls,getSliceComponentProps:s,separator:r,debugIds:d})=>os(T(zt(e,t),(r=>Ho(o,{...Go(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ps=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=rs,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Jo(se(o),e),i=Zt(e,t,n);return os(R(c)||R(i)?null:Ho(s,{...Go(r,i),key:i,tableId:c,rowId:i,store:u,debugIds:d}),void 0,d,t)},gs=e=>$o(e,$t,e.remoteRowId),bs=e=>$o(e,eo,e.firstRowId),Cs=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>os(o+(bo(e,t,s,r)??o),void 0,d,s),ms=({queryId:e,rowId:t,queries:o,resultCellComponent:s=Cs,getResultCellComponentProps:r,separator:d,debugIds:n})=>os(T(go(e,t,o),(d=>Ho(s,{...Go(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),ys=e=>Zo(e,lo(e.queryId,e.queries)),ws=({cellId:e,descending:t,offset:o,limit:s,...r})=>Zo(r,Io(r.queryId,e,t,o,s,r.queries)),ks=({checkpoints:e,checkpointId:t,debugIds:s})=>os(xo(t,e)??o,void 0,s,t),hs=es((e=>e[0])),Rs=es((e=>R(e[1])?[]:[e[1]])),vs=es((e=>e[2]));export{hs as BackwardCheckpointsView,ss as CellView,ks as CheckpointView,Rs as CurrentCheckpointView,vs as ForwardCheckpointsView,Is as IndexView,bs as LinkedRowsView,gs as LocalRowsView,as as MetricView,ts as Provider,ps as RemoteRowView,Cs as ResultCellView,ms as ResultRowView,ws as ResultSortedTableView,ys as ResultTableView,rs as RowView,ls as SliceView,ns as SortedTableView,ds as TableView,us as TablesView,cs as ValueView,is as ValuesView,ot as useAddRowCallback,Ke as useCell,Ge as useCellIds,Pt as useCellIdsListener,St as useCellListener,xo as useCheckpoint,Po as useCheckpointIds,Fo as useCheckpointIdsListener,Vo as useCheckpointListener,ne as useCheckpoints,qo as useCheckpointsIds,ue as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,Wt as useCreateIndexes,Be as useCreateMergeableStore,Ot as useCreateMetrics,Ao as useCreatePersister,ro as useCreateQueries,Ut as useCreateRelationships,Te as useCreateStore,Oo as useCreateSynchronizer,lt as useDelCellCallback,at as useDelRowCallback,it as useDelTableCallback,ct as useDelTablesCallback,pt as useDelValueCallback,It as useDelValuesCallback,At as useDidFinishTransactionListener,Lo as useGoBackwardCallback,To as useGoForwardCallback,Bo as useGoToCallback,Je as useHasCell,xt as useHasCellListener,_e as useHasRow,ft as useHasRowListener,Ae as useHasTable,De as useHasTableCell,kt as useHasTableCellListener,mt as useHasTableListener,Me as useHasTables,gt as useHasTablesListener,Ye as useHasValue,Et as useHasValueListener,Ne as useHasValues,Lt as useHasValuesListener,Gt as useIndexIds,ee as useIndexes,_t as useIndexesIds,te as useIndexesOrIndexesById,eo as useLinkedRowIds,so as useLinkedRowIdsListener,$t as useLocalRowIds,oo as useLocalRowIdsListener,Ht as useMetric,Dt as useMetricIds,Qt as useMetricListener,Z as useMetrics,jt as useMetricsIds,$ as useMetricsOrMetricsById,Y as useProvideStore,re as useQueries,no as useQueriesIds,de as useQueriesOrQueriesById,uo as useQueryIds,Mo as useRedoInformation,Yt as useRelationshipIds,oe as useRelationships,Xt as useRelationshipsIds,se as useRelationshipsOrRelationshipsById,Zt as useRemoteRowId,to as useRemoteRowIdListener,bo as useResultCell,go as useResultCellIds,Ro as useResultCellIdsListener,vo as useResultCellListener,po as useResultRow,ao as useResultRowCount,yo as useResultRowCountListener,lo as useResultRowIds,wo as useResultRowIdsListener,ho as useResultRowListener,Io as useResultSortedRowIds,ko as useResultSortedRowIdsListener,co as useResultTable,io as useResultTableCellIds,mo as useResultTableCellIdsListener,Co as useResultTableListener,ze as useRow,He as useRowCount,ht as useRowCountListener,Qe as useRowIds,Rt as useRowIdsListener,qt as useRowListener,rt as useSetCellCallback,So as useSetCheckpointCallback,st as useSetPartialRowCallback,nt as useSetPartialValuesCallback,tt as useSetRowCallback,et as useSetTableCallback,$e as useSetTablesCallback,ut as useSetValueCallback,dt as useSetValuesCallback,zt as useSliceIds,Kt as useSliceIdsListener,Jt as useSliceRowIds,Nt as useSliceRowIdsListener,We as useSortedRowIds,vt as useSortedRowIdsListener,Ft as useStartTransactionListener,U as useStore,Ee as useStoreIds,X as useStoreOrStoreById,Oe as useTable,je as useTableCellIds,wt as useTableCellIdsListener,Ve as useTableIds,Ct as useTableIdsListener,yt as useTableListener,Fe as useTables,bt as useTablesListener,Eo as useUndoInformation,Ze as useValue,Xe as useValueIds,Bt as useValueIdsListener,Mt as useValueListener,Ue as useValues,Tt as useValuesListener,Vt as useWillFinishTransactionListener};
|
package/min/ui-react/index.js.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",i="Table",a=i+"s",l=i+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,C="Cell",m=C+c,y="Value",w=y+"s",k=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,v=e=>t(e)==r,q=e=>e.length,P=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>q(e)===q(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return q(o)===q(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:ie,useRef:ae,useState:le,useSyncExternalStore:Ie}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],Ce=(e,t)=>e===t,me=(e,t,o=pe)=>{const[,s]=le(),[r,d]=le();return ue((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},we=(e,t,s,r=pe)=>{const d=ae(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(be[s]??Ce)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return Ie(c,n)},ke=(e,t,o,s=pe,r=pe,...d)=>ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=P,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...Re(n,s,e),o),o)))))),[u,t,...s,...d,...fe(n)])},Re=(e,t,o)=>L(e,(e=>v(e)?e(o,t):e)),fe=e=>{return t=e=>!v(e),e.filter(t);var t},ve=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((e=>o(d?.["del"+t](...Re(r,d,e)))),[d,t,...s,...fe(r)])},qe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},Pe=(e,t=pe)=>ce(e,t),xe=(e,t=pe)=>ce(e,t),Se=()=>G(1),Le=e=>we(a,K(e),4,[]),Be=e=>we(a,K(e),0),Te=e=>we(l,K(e),1),Ee=(e,t)=>we(i,K(t),4,[e]),Me=(e,t)=>we(i,K(t),0,[e]),Fe=(e,t)=>we(i+m,K(t),1,[e]),Ve=(e,t,o)=>we(i+C,K(o),4,[e,t]),Ae=(e,t)=>we(p,K(t),5,[e]),Oe=(e,t)=>we(g,K(t),1,[e]),je=(e,t,o,s=0,r,d)=>we(b,K(d),1,[e,t,o,s,r]),De=(e,t,o)=>we(I,K(o),4,[e,t]),He=(e,t,o)=>we(I,K(o),0,[e,t]),Qe=(e,t,o)=>we(m,K(o),1,[e,t]),We=(e,t,o,s)=>we(C,K(s),4,[e,t,o]),ze=(e,t,o,s)=>we(C,K(s),3,[e,t,o]),Ge=e=>we(w,K(e),4,[]),Je=e=>we(w,K(e),0),Ke=e=>we(k,K(e),1),Ne=(e,t)=>we(y,K(t),4,[e]),Ue=(e,t)=>we(y,K(t),3,[e]),Xe=(e,t,o,s,r)=>he(o,a,e,t,s,r),Ye=(e,t,o,s,r,d)=>he(s,i,t,o,r,d,e),Ze=(e,t,o,s,r,d,n)=>he(r,I,o,s,d,n,e,t),$e=(e,t,o=pe,s,r=P,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(v(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},_e=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),et=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),tt=(e,t,o,s,r)=>he(o,w,e,t,s,r),ot=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),st=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),rt=(e,t,o)=>ve(e,a,t,o),dt=(e,t,o,s)=>ve(t,i,o,s,e),nt=(e,t,o,s,r)=>ve(o,I,s,r,e,t),ut=(e,t,o,s,r,d,n)=>ve(r,C,d,n,e,t,o,s),ct=(e,t,o)=>ve(e,w,t,o),it=(e,t,o,s)=>ve(t,y,o,s,e),at=(e,t,o,s)=>ke(u+a,K(s),e,t,[],o),lt=(e,t,o,s)=>ke(a,K(s),e,t,pe,o),It=(e,t,o,s)=>ke(l,K(s),e,t,pe,o),pt=(e,t,o,s,r)=>ke(u+i,K(r),t,o,[e],s),gt=(e,t,o,s,r)=>ke(i,K(r),t,o,[e],s),bt=(e,t,o,s,r)=>ke(i+m,K(r),t,o,[e],s),Ct=(e,t,o,s,r,d)=>ke(u+i+C,K(d),o,s,[e,t],r),mt=(e,t,o,s,r)=>ke(p,K(r),t,o,[e],s),yt=(e,t,o,s,r)=>ke(g,K(r),t,o,[e],s),wt=(e,t,o,s,r,d,n,u,c)=>ke(b,K(c),d,n,[e,t,o,s,r],u),kt=(e,t,o,s,r,d)=>ke(u+I,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d)=>ke(I,K(d),o,s,[e,t],r),Rt=(e,t,o,s,r,d)=>ke(m,K(d),o,s,[e,t],r),ft=(e,t,o,s,r,d,n)=>ke(u+C,K(n),s,r,[e,t,o],d),vt=(e,t,o,s,r,d,n)=>ke(C,K(n),s,r,[e,t,o],d),qt=(e,t,o,s)=>ke(u+w,K(s),e,t,[],o),Pt=(e,t,o,s)=>ke(w,K(s),e,t,pe,o),xt=(e,t,o,s)=>ke(k,K(s),e,t,pe,o),St=(e,t,o,s,r)=>ke(u+y,K(r),t,o,[e],s),Lt=(e,t,o,s,r)=>ke(y,K(r),t,o,[e],s),Bt=(e,t,o)=>ke("Start"+de,K(o),e,t),Tt=(e,t,o)=>ke("WillFinish"+de,K(o),e,t),Et=(e,t,o)=>ke("DidFinish"+de,K(o),e,t),Mt=(e,t,o)=>me(e,t,o),Ft=()=>G(3),Vt=e=>we("MetricIds",X(e),1),At=(e,t)=>we("Metric",X(t),3,[e]),Ot=(e,t,o,s)=>ke("Metric",X(s),t,o,[e]),jt=(e,t,o)=>me(e,t,o),Dt=()=>G(5),Ht=(e,t)=>we("SliceIds",Z(t),1,[e]),Qt=e=>we("IndexIds",Z(e),1),Wt=(e,t,o)=>we("Slice"+g,Z(o),1,[e,t]),zt=(e,t,o,s)=>ke("SliceIds",Z(s),t,o,[e]),Gt=(e,t,o,s,r)=>ke("Slice"+g,Z(r),o,s,[e,t]),Jt=(e,t,o)=>me(e,t,o),Kt=()=>G(7),Nt=e=>we("RelationshipIds",_(e),1),Ut=(e,t,o)=>we("RemoteRowId",_(o),3,[e,t]),Xt=(e,t,o)=>we("Local"+g,_(o),1,[e,t]),Yt=(e,t,o)=>we("Linked"+g,_(o),1,[e,t]),Zt=(e,t,o,s,r)=>ke("RemoteRowId",_(r),o,s,[e,t]),$t=(e,t,o,s,r)=>ke("Local"+g,_(r),o,s,[e,t]),_t=(e,t,o,s,r)=>ke("Linked"+g,_(r),o,s,[e,t]),eo=(e,t,o)=>me(e,t,o),to=()=>G(9),oo=e=>we("QueryIds",te(e),1),so=(e,t)=>we(n+i,te(t),0,[e]),ro=(e,t)=>we(n+i+m,te(t),1,[e]),no=(e,t)=>we(n+p,te(t),5,[e]),uo=(e,t)=>we(n+g,te(t),1,[e]),co=(e,t,o,s=0,r,d)=>we(n+b,te(d),1,[e,t,o,s,r]),io=(e,t,o)=>we(n+I,te(o),0,[e,t]),ao=(e,t,o)=>we(n+m,te(o),1,[e,t]),lo=(e,t,o,s)=>we(n+C,te(s),3,[e,t,o]),Io=(e,t,o,s)=>ke(n+i,te(s),t,o,[e]),po=(e,t,o,s)=>ke(n+i+m,te(s),t,o,[e]),go=(e,t,o,s)=>ke(n+p,te(s),t,o,[e]),bo=(e,t,o,s)=>ke(n+g,te(s),t,o,[e]),Co=(e,t,o,s,r,d,u,c)=>ke(n+b,te(c),d,u,[e,t,o,s,r]),mo=(e,t,o,s,r)=>ke(n+I,te(r),o,s,[e,t]),yo=(e,t,o,s,r)=>ke(n+m,te(r),o,s,[e,t]),wo=(e,t,o,s,r,d)=>ke(n+C,te(d),s,r,[e,t,o]),ko=(e,t,o)=>me(e,t,o),ho=()=>G(11),Ro=e=>we("CheckpointIds",se(e),2),fo=(e,t)=>we("Checkpoint",se(t),3,[e]),vo=(e=P,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},qo=e=>qe(e,"goBackward"),Po=e=>qe(e,"goForward"),xo=(e,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},So=e=>{const t=se(e),[s,r]=Ro(t);return[(d=s,!(0==q(d))),qo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},Lo=e=>{const t=se(e),[,,[s]]=Ro(t);return[!h(s),Po(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},Bo=(e,t,o)=>ke("CheckpointIds",se(o),e,t),To=(e,t,o,s)=>ke("Checkpoint",se(s),t,o,[e]),Eo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,i]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;i(o),o&&s&&(async()=>{await s(o),u([])})()})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},Mo=(e,t,o=pe,s,r=pe)=>{const[d,n]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Fo,Fragment:Vo,createElement:Ao,useCallback:Oo,useLayoutEffect:jo,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>h(e)?{}:e(...t),Wo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:zo,useContext:Go,useMemo:Jo,useState:Ko}=e,No=({tableId:e,store:t,rowComponent:o=es,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>$o(L(u,(d=>Ao(o,{...Qo(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Uo=({queryId:e,queries:t,resultRowComponent:o=ps,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>$o(L(n,(r=>Ao(o,{...Qo(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Xo=({relationshipId:e,relationships:t,rowComponent:o=es,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,i,a]=Wo(_(t),e),l=n(e,u,c);return $o(L(l,(e=>Ao(o,{...Qo(s,e),key:e,tableId:a,rowId:e,store:i,debugIds:d}))),r,d,u)},Yo=e=>({checkpoints:t,checkpointComponent:o=Cs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return $o(L(e(Ro(n)),(e=>Ao(o,{...Qo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Zo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:i,checkpoints:a,checkpointsById:l,children:I})=>{const p=Go(Q),[g,b]=Ko({}),C=zo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=zo((e=>b((t=>({...A(t,e)})))),[]);return Ao(Q.Provider,{value:Jo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...i},a??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,i,a,l,p,C,m])},I)},$o=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},_o=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>$o(o+(ze(e,t,s,r)??o),void 0,d,s),es=({tableId:e,rowId:t,store:o,cellComponent:s=_o,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>$o(L(((e,t,o,s)=>{const r=Qe(t,o,s);return e??r})(d,e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),ts=e=>No(e,Oe(e.tableId,e.store)),os=({cellId:e,descending:t,offset:o,limit:s,...r})=>No(r,je(r.tableId,e,t,o,s,r.store)),ss=({store:e,tableComponent:t=ts,getTableComponentProps:o,separator:s,debugIds:r})=>$o(L(Te(e),(s=>Ao(t,{...Qo(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),rs=({valueId:e,store:t,debugIds:s})=>$o(o+(Ue(e,t)??o),void 0,s,e),ds=({store:e,valueComponent:t=rs,getValueComponentProps:o,separator:s,debugIds:r})=>$o(L(Ke(e),(s=>Ao(t,{...Qo(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ns=({metricId:e,metrics:t,debugIds:s})=>$o(At(e,t)??o,void 0,s,e),us=({indexId:e,sliceId:t,indexes:o,rowComponent:s=es,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),a=Wt(e,t,u);return $o(L(a,(e=>Ao(s,{...Qo(r,e),key:e,tableId:i,rowId:e,store:c,debugIds:n}))),d,n,t)},cs=({indexId:e,indexes:t,sliceComponent:o=us,getSliceComponentProps:s,separator:r,debugIds:d})=>$o(L(Ht(e,t),(r=>Ao(o,{...Qo(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),is=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=es,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Wo(_(o),e),i=Ut(e,t,n);return $o(h(c)||h(i)?null:Ao(s,{...Qo(r,i),key:i,tableId:c,rowId:i,store:u,debugIds:d}),void 0,d,t)},as=e=>Xo(e,Xt,e.remoteRowId),ls=e=>Xo(e,Yt,e.firstRowId),Is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>$o(o+(lo(e,t,s,r)??o),void 0,d,s),ps=({queryId:e,rowId:t,queries:o,resultCellComponent:s=Is,getResultCellComponentProps:r,separator:d,debugIds:n})=>$o(L(ao(e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),gs=e=>Uo(e,uo(e.queryId,e.queries)),bs=({cellId:e,descending:t,offset:o,limit:s,...r})=>Uo(r,co(r.queryId,e,t,o,s,r.queries)),Cs=({checkpoints:e,checkpointId:t,debugIds:s})=>$o(fo(t,e)??o,void 0,s,t),ms=Yo((e=>e[0])),ys=Yo((e=>h(e[1])?[]:[e[1]])),ws=Yo((e=>e[2]));export{ms as BackwardCheckpointsView,_o as CellView,Cs as CheckpointView,ys as CurrentCheckpointView,ws as ForwardCheckpointsView,cs as IndexView,ls as LinkedRowsView,as as LocalRowsView,ns as MetricView,Zo as Provider,is as RemoteRowView,Is as ResultCellView,ps as ResultRowView,bs as ResultSortedTableView,gs as ResultTableView,es as RowView,us as SliceView,os as SortedTableView,ts as TableView,ss as TablesView,rs as ValueView,ds as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,Rt as useCellIdsListener,vt as useCellListener,fo as useCheckpoint,Ro as useCheckpointIds,Bo as useCheckpointIdsListener,To as useCheckpointListener,oe as useCheckpoints,ho as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,ko as useCreateCheckpoints,jt as useCreateIndexes,xe as useCreateMergeableStore,Mt as useCreateMetrics,Eo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,Pe as useCreateStore,Mo as useCreateSynchronizer,ut as useDelCellCallback,nt as useDelRowCallback,dt as useDelTableCallback,rt as useDelTablesCallback,it as useDelValueCallback,ct as useDelValuesCallback,Et as useDidFinishTransactionListener,qo as useGoBackwardCallback,Po as useGoForwardCallback,xo as useGoToCallback,We as useHasCell,ft as useHasCellListener,De as useHasRow,kt as useHasRowListener,Ee as useHasTable,Ve as useHasTableCell,Ct as useHasTableCellListener,pt as useHasTableListener,Le as useHasTables,at as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,qt as useHasValuesListener,Qt as useIndexIds,Y as useIndexes,Dt as useIndexesIds,Z as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,At as useMetric,Vt as useMetricIds,Ot as useMetricListener,U as useMetrics,Ft as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,to as useQueriesIds,te as useQueriesOrQueriesById,oo as useQueryIds,Lo as useRedoInformation,Nt as useRelationshipIds,$ as useRelationships,Kt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,lo as useResultCell,ao as useResultCellIds,yo as useResultCellIdsListener,wo as useResultCellListener,io as useResultRow,no as useResultRowCount,go as useResultRowCountListener,uo as useResultRowIds,bo as useResultRowIdsListener,mo as useResultRowListener,co as useResultSortedRowIds,Co as useResultSortedRowIdsListener,so as useResultTable,ro as useResultTableCellIds,po as useResultTableCellIdsListener,Io as useResultTableListener,He as useRow,Ae as useRowCount,mt as useRowCountListener,Oe as useRowIds,yt as useRowIdsListener,ht as useRowListener,et as useSetCellCallback,vo as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,st as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,je as useSortedRowIds,wt as useSortedRowIdsListener,Bt as useStartTransactionListener,J as useStore,Se as useStoreIds,K as useStoreOrStoreById,Me as useTable,Fe as useTableCellIds,bt as useTableCellIdsListener,Te as useTableIds,It as useTableIdsListener,gt as useTableListener,Be as useTables,lt as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,xt as useValueIdsListener,Lt as useValueListener,Je as useValues,Pt as useValuesListener,Tt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",i="Table",a=i+"s",l=i+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,C="Cell",m=C+c,y="Value",w=y+"s",k=y+c,h=globalThis,R=e=>null==e,v=(e,t,o)=>R(e)?o?.():t(e),f=e=>t(e)==s,q=e=>t(e)==r,P=e=>e.length,x=()=>{},S=(e,t)=>e.every(t),L=(e,t)=>P(e)===P(t)&&S(e,((e,o)=>t[o]===e)),T=(e,t)=>e.map(t),B=Object,E=e=>B.getPrototypeOf(e),M=B.entries,F=e=>!R(e)&&v(E(e),(e=>e==B.prototype||R(E(e))),(()=>!0)),V=B.keys,A=(e,t)=>v(e,(e=>e[t])),O=(e,t)=>(delete e[t],e),j=(e,t)=>{const o=M(e);return P(o)===P(V(t))&&S(o,(([e,o])=>F(o)?!!F(t[e])&&j(t[e],o):t[e]===o))},{createContext:D,useContext:H,useEffect:Q}=e,W=(G=()=>D([]),((e,t)=>t in e)(_=h,z="tinybase_uirc")||(_[z]=G()),_[z]);var _,z,G;const J=(e,t)=>{const o=H(W);return R(e)?o[t]:f(e)?A(o[t+1]??{},e):e},K=(e,t)=>{const o=J(e,t);return R(e)||f(e)?o:e},N=e=>V(H(W)[e]??{}),U=e=>J(e,0),X=e=>K(e,0),Y=(e,t)=>{const{12:o,13:s}=H(W);Q((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},Z=e=>J(e,2),$=e=>K(e,2),ee=e=>J(e,4),te=e=>K(e,4),oe=e=>J(e,6),se=e=>K(e,6),re=e=>J(e,8),de=e=>K(e,8),ne=e=>J(e,10),ue=e=>K(e,10),ce=e=>e.toLowerCase();ce(d);const ie="Transaction";ce(ie);const{useCallback:ae,useEffect:le,useMemo:Ie,useLayoutEffect:pe,useRef:ge,useState:be,useSyncExternalStore:Ce}=e,me=[],ye=[{},[],[me,void 0,me],void 0,!1,0],we=[j,L,([e,t,o],[s,r,d])=>t===r&&L(e,s)&&L(o,d)],ke=(e,t)=>e===t,he=(e,t,o=me)=>{const[,s]=be(),[r,d]=be();return le((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},Re=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ve=(e,t,s,r=me)=>{const d=ge(ye[s]),n=ae((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ye[s];return(we[s]??ke)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ae((d=>Re(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return Ce(c,n)},fe=(e,t,o,s=me,r=me,...d)=>pe((()=>Re(t,e,...r,o,...d)),[t,e,...r,...s,...d]),qe=(e,t,o,s=me,r=x,d=me,...n)=>{const u=X(e);return ae((e=>v(u,(s=>v(o(e,s),(o=>r(s["set"+t](...Pe(n,s,e),o),o)))))),[u,t,...s,...d,...xe(n)])},Pe=(e,t,o)=>T(e,(e=>q(e)?e(o,t):e)),xe=e=>{return t=e=>!q(e),e.filter(t);var t},Se=(e,t,o=x,s=me,...r)=>{const d=X(e);return ae((e=>o(d?.["del"+t](...Pe(r,d,e)))),[d,t,...s,...xe(r)])},Le=(e,t,o)=>{const s=ue(e);return ae((()=>s?.[t](o)),[s,t,o])},Te=(e,t=me)=>Ie(e,t),Be=(e,t=me)=>Ie(e,t),Ee=()=>N(1),Me=e=>ve(a,X(e),4,[]),Fe=e=>ve(a,X(e),0),Ve=e=>ve(l,X(e),1),Ae=(e,t)=>ve(i,X(t),4,[e]),Oe=(e,t)=>ve(i,X(t),0,[e]),je=(e,t)=>ve(i+m,X(t),1,[e]),De=(e,t,o)=>ve(i+C,X(o),4,[e,t]),He=(e,t)=>ve(p,X(t),5,[e]),Qe=(e,t)=>ve(g,X(t),1,[e]),We=(e,t,o,s=0,r,d)=>ve(b,X(d),1,[e,t,o,s,r]),_e=(e,t,o)=>ve(I,X(o),4,[e,t]),ze=(e,t,o)=>ve(I,X(o),0,[e,t]),Ge=(e,t,o)=>ve(m,X(o),1,[e,t]),Je=(e,t,o,s)=>ve(C,X(s),4,[e,t,o]),Ke=(e,t,o,s)=>ve(C,X(s),3,[e,t,o]),Ne=e=>ve(w,X(e),4,[]),Ue=e=>ve(w,X(e),0),Xe=e=>ve(k,X(e),1),Ye=(e,t)=>ve(y,X(t),4,[e]),Ze=(e,t)=>ve(y,X(t),3,[e]),$e=(e,t,o,s,r)=>qe(o,a,e,t,s,r),et=(e,t,o,s,r,d)=>qe(s,i,t,o,r,d,e),tt=(e,t,o,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,o,s,r,d,n)=>fe(C,X(n),s,r,[e,t,o],d),Lt=(e,t,o,s)=>fe(u+w,X(s),e,t,[],o),Tt=(e,t,o,s)=>fe(w,X(s),e,t,me,o),Bt=(e,t,o,s)=>fe(k,X(s),e,t,me,o),Et=(e,t,o,s,r)=>fe(u+y,X(r),t,o,[e],s),Mt=(e,t,o,s,r)=>fe(y,X(r),t,o,[e],s),Ft=(e,t,o)=>fe("Start"+ie,X(o),e,t),Vt=(e,t,o)=>fe("WillFinish"+ie,X(o),e,t),At=(e,t,o)=>fe("DidFinish"+ie,X(o),e,t),Ot=(e,t,o)=>he(e,t,o),jt=()=>N(3),Dt=e=>ve("MetricIds",$(e),1),Ht=(e,t)=>ve("Metric",$(t),3,[e]),Qt=(e,t,o,s)=>fe("Metric",$(s),t,o,[e]),Wt=(e,t,o)=>he(e,t,o),_t=()=>N(5),zt=(e,t)=>ve("SliceIds",te(t),1,[e]),Gt=e=>ve("IndexIds",te(e),1),Jt=(e,t,o)=>ve("Slice"+g,te(o),1,[e,t]),Kt=(e,t,o,s)=>fe("SliceIds",te(s),t,o,[e]),Nt=(e,t,o,s,r)=>fe("Slice"+g,te(r),o,s,[e,t]),Ut=(e,t,o)=>he(e,t,o),Xt=()=>N(7),Yt=e=>ve("RelationshipIds",se(e),1),Zt=(e,t,o)=>ve("RemoteRowId",se(o),3,[e,t]),$t=(e,t,o)=>ve("Local"+g,se(o),1,[e,t]),eo=(e,t,o)=>ve("Linked"+g,se(o),1,[e,t]),to=(e,t,o,s,r)=>fe("RemoteRowId",se(r),o,s,[e,t]),oo=(e,t,o,s,r)=>fe("Local"+g,se(r),o,s,[e,t]),so=(e,t,o,s,r)=>fe("Linked"+g,se(r),o,s,[e,t]),ro=(e,t,o)=>he(e,t,o),no=()=>N(9),uo=e=>ve("QueryIds",de(e),1),co=(e,t)=>ve(n+i,de(t),0,[e]),io=(e,t)=>ve(n+i+m,de(t),1,[e]),ao=(e,t)=>ve(n+p,de(t),5,[e]),lo=(e,t)=>ve(n+g,de(t),1,[e]),Io=(e,t,o,s=0,r,d)=>ve(n+b,de(d),1,[e,t,o,s,r]),po=(e,t,o)=>ve(n+I,de(o),0,[e,t]),go=(e,t,o)=>ve(n+m,de(o),1,[e,t]),bo=(e,t,o,s)=>ve(n+C,de(s),3,[e,t,o]),Co=(e,t,o,s)=>fe(n+i,de(s),t,o,[e]),mo=(e,t,o,s)=>fe(n+i+m,de(s),t,o,[e]),yo=(e,t,o,s)=>fe(n+p,de(s),t,o,[e]),wo=(e,t,o,s)=>fe(n+g,de(s),t,o,[e]),ko=(e,t,o,s,r,d,u,c)=>fe(n+b,de(c),d,u,[e,t,o,s,r]),ho=(e,t,o,s,r)=>fe(n+I,de(r),o,s,[e,t]),Ro=(e,t,o,s,r)=>fe(n+m,de(r),o,s,[e,t]),vo=(e,t,o,s,r,d)=>fe(n+C,de(d),s,r,[e,t,o]),fo=(e,t,o)=>he(e,t,o),qo=()=>N(11),Po=e=>ve("CheckpointIds",ue(e),2),xo=(e,t)=>ve("Checkpoint",ue(t),3,[e]),So=(e=x,t=me,o,s=x,r=me)=>{const d=ue(o);return ae((t=>v(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Lo=e=>Le(e,"goBackward"),To=e=>Le(e,"goForward"),Bo=(e,t=me,o,s=x,r=me)=>{const d=ue(o);return ae((t=>v(d,(o=>v(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Eo=e=>{const t=ue(e),[s,r]=Po(t);return[(d=s,!(0==P(d))),Lo(t),r,v(r,(e=>t?.getCheckpoint(e)))??o];var d},Mo=e=>{const t=ue(e),[,,[s]]=Po(t);return[!R(s),To(t),s,v(s,(e=>t?.getCheckpoint(e)))??o]},Fo=(e,t,o)=>fe("CheckpointIds",ue(o),e,t),Vo=(e,t,o,s)=>fe("Checkpoint",ue(s),t,o,[e]),Ao=(e,t,o=me,s,r=me,d,n=me)=>{const[,u]=be(),[c,i]=be();return le((()=>{(async()=>{const o=e?await t(e):void 0;i(o),o&&s&&(async()=>{await s(o),u([])})()})()}),[e,...o,...r]),le((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},Oo=(e,t,o=me,s,r=me)=>{const[d,n]=be();return le((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),le((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:jo,Fragment:Do,createElement:Ho,useCallback:Qo,useLayoutEffect:Wo,useRef:_o,useState:zo}=e,Go=(e,...t)=>R(e)?{}:e(...t),Jo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Ko,useContext:No,useMemo:Uo,useState:Xo}=e,Yo=({tableId:e,store:t,rowComponent:o=rs,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>os(T(u,(d=>Ho(o,{...Go(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Zo=({queryId:e,queries:t,resultRowComponent:o=ms,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>os(T(n,(r=>Ho(o,{...Go(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),$o=({relationshipId:e,relationships:t,rowComponent:o=rs,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,i,a]=Jo(se(t),e),l=n(e,u,c);return os(T(l,(e=>Ho(o,{...Go(s,e),key:e,tableId:a,rowId:e,store:i,debugIds:d}))),r,d,u)},es=e=>({checkpoints:t,checkpointComponent:o=ks,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=ue(t);return os(T(e(Po(n)),(e=>Ho(o,{...Go(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},ts=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:i,checkpoints:a,checkpointsById:l,children:I})=>{const p=No(W),[g,b]=Xo({}),C=Ko(((e,t)=>b((o=>A(o,e)==t?o:{...o,[e]:t}))),[]),m=Ko((e=>b((t=>({...O(t,e)})))),[]);return Ho(W.Provider,{value:Uo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...i},a??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,i,a,l,p,C,m])},I)},os=(e,t,o,s)=>{const r=R(t)||!Array.isArray(e)?e:T(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},ss=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>os(o+(Ke(e,t,s,r)??o),void 0,d,s),rs=({tableId:e,rowId:t,store:o,cellComponent:s=ss,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>os(T(((e,t,o,s)=>{const r=Ge(t,o,s);return e??r})(d,e,t,o),(d=>Ho(s,{...Go(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),ds=e=>Yo(e,Qe(e.tableId,e.store)),ns=({cellId:e,descending:t,offset:o,limit:s,...r})=>Yo(r,We(r.tableId,e,t,o,s,r.store)),us=({store:e,tableComponent:t=ds,getTableComponentProps:o,separator:s,debugIds:r})=>os(T(Ve(e),(s=>Ho(t,{...Go(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),cs=({valueId:e,store:t,debugIds:s})=>os(o+(Ze(e,t)??o),void 0,s,e),is=({store:e,valueComponent:t=cs,getValueComponentProps:o,separator:s,debugIds:r})=>os(T(Xe(e),(s=>Ho(t,{...Go(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),as=({metricId:e,metrics:t,debugIds:s})=>os(Ht(e,t)??o,void 0,s,e),ls=({indexId:e,sliceId:t,indexes:o,rowComponent:s=rs,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(te(o),e),a=Jt(e,t,u);return os(T(a,(e=>Ho(s,{...Go(r,e),key:e,tableId:i,rowId:e,store:c,debugIds:n}))),d,n,t)},Is=({indexId:e,indexes:t,sliceComponent:o=ls,getSliceComponentProps:s,separator:r,debugIds:d})=>os(T(zt(e,t),(r=>Ho(o,{...Go(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ps=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=rs,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Jo(se(o),e),i=Zt(e,t,n);return os(R(c)||R(i)?null:Ho(s,{...Go(r,i),key:i,tableId:c,rowId:i,store:u,debugIds:d}),void 0,d,t)},gs=e=>$o(e,$t,e.remoteRowId),bs=e=>$o(e,eo,e.firstRowId),Cs=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>os(o+(bo(e,t,s,r)??o),void 0,d,s),ms=({queryId:e,rowId:t,queries:o,resultCellComponent:s=Cs,getResultCellComponentProps:r,separator:d,debugIds:n})=>os(T(go(e,t,o),(d=>Ho(s,{...Go(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),ys=e=>Zo(e,lo(e.queryId,e.queries)),ws=({cellId:e,descending:t,offset:o,limit:s,...r})=>Zo(r,Io(r.queryId,e,t,o,s,r.queries)),ks=({checkpoints:e,checkpointId:t,debugIds:s})=>os(xo(t,e)??o,void 0,s,t),hs=es((e=>e[0])),Rs=es((e=>R(e[1])?[]:[e[1]])),vs=es((e=>e[2]));export{hs as BackwardCheckpointsView,ss as CellView,ks as CheckpointView,Rs as CurrentCheckpointView,vs as ForwardCheckpointsView,Is as IndexView,bs as LinkedRowsView,gs as LocalRowsView,as as MetricView,ts as Provider,ps as RemoteRowView,Cs as ResultCellView,ms as ResultRowView,ws as ResultSortedTableView,ys as ResultTableView,rs as RowView,ls as SliceView,ns as SortedTableView,ds as TableView,us as TablesView,cs as ValueView,is as ValuesView,ot as useAddRowCallback,Ke as useCell,Ge as useCellIds,Pt as useCellIdsListener,St as useCellListener,xo as useCheckpoint,Po as useCheckpointIds,Fo as useCheckpointIdsListener,Vo as useCheckpointListener,ne as useCheckpoints,qo as useCheckpointsIds,ue as useCheckpointsOrCheckpointsById,fo as useCreateCheckpoints,Wt as useCreateIndexes,Be as useCreateMergeableStore,Ot as useCreateMetrics,Ao as useCreatePersister,ro as useCreateQueries,Ut as useCreateRelationships,Te as useCreateStore,Oo as useCreateSynchronizer,lt as useDelCellCallback,at as useDelRowCallback,it as useDelTableCallback,ct as useDelTablesCallback,pt as useDelValueCallback,It as useDelValuesCallback,At as useDidFinishTransactionListener,Lo as useGoBackwardCallback,To as useGoForwardCallback,Bo as useGoToCallback,Je as useHasCell,xt as useHasCellListener,_e as useHasRow,ft as useHasRowListener,Ae as useHasTable,De as useHasTableCell,kt as useHasTableCellListener,mt as useHasTableListener,Me as useHasTables,gt as useHasTablesListener,Ye as useHasValue,Et as useHasValueListener,Ne as useHasValues,Lt as useHasValuesListener,Gt as useIndexIds,ee as useIndexes,_t as useIndexesIds,te as useIndexesOrIndexesById,eo as useLinkedRowIds,so as useLinkedRowIdsListener,$t as useLocalRowIds,oo as useLocalRowIdsListener,Ht as useMetric,Dt as useMetricIds,Qt as useMetricListener,Z as useMetrics,jt as useMetricsIds,$ as useMetricsOrMetricsById,Y as useProvideStore,re as useQueries,no as useQueriesIds,de as useQueriesOrQueriesById,uo as useQueryIds,Mo as useRedoInformation,Yt as useRelationshipIds,oe as useRelationships,Xt as useRelationshipsIds,se as useRelationshipsOrRelationshipsById,Zt as useRemoteRowId,to as useRemoteRowIdListener,bo as useResultCell,go as useResultCellIds,Ro as useResultCellIdsListener,vo as useResultCellListener,po as useResultRow,ao as useResultRowCount,yo as useResultRowCountListener,lo as useResultRowIds,wo as useResultRowIdsListener,ho as useResultRowListener,Io as useResultSortedRowIds,ko as useResultSortedRowIdsListener,co as useResultTable,io as useResultTableCellIds,mo as useResultTableCellIdsListener,Co as useResultTableListener,ze as useRow,He as useRowCount,ht as useRowCountListener,Qe as useRowIds,Rt as useRowIdsListener,qt as useRowListener,rt as useSetCellCallback,So as useSetCheckpointCallback,st as useSetPartialRowCallback,nt as useSetPartialValuesCallback,tt as useSetRowCallback,et as useSetTableCallback,$e as useSetTablesCallback,ut as useSetValueCallback,dt as useSetValuesCallback,zt as useSliceIds,Kt as useSliceIdsListener,Jt as useSliceRowIds,Nt as useSliceRowIdsListener,We as useSortedRowIds,vt as useSortedRowIdsListener,Ft as useStartTransactionListener,U as useStore,Ee as useStoreIds,X as useStoreOrStoreById,Oe as useTable,je as useTableCellIds,wt as useTableCellIdsListener,Ve as useTableIds,Ct as useTableIdsListener,yt as useTableListener,Fe as useTables,bt as useTablesListener,Eo as useUndoInformation,Ze as useValue,Xe as useValueIds,Bt as useValueIdsListener,Mt as useValueListener,Ue as useValues,Tt as useValuesListener,Vt as useWillFinishTransactionListener};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@electric-sql/pglite": "^0.2.5",
|
|
25
25
|
"@libsql/client": "^0.10.0",
|
|
26
26
|
"@powersync/common": "^1.16.2",
|
|
27
|
-
"@sqlite.org/sqlite-wasm": "^3.46.1-
|
|
27
|
+
"@sqlite.org/sqlite-wasm": "^3.46.1-build3",
|
|
28
28
|
"@vlcn.io/crsqlite-wasm": "^0.16.0",
|
|
29
29
|
"electric-sql": "^0.12.1",
|
|
30
30
|
"expo": "^51.0.0",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-2"><em>NEW!</em> v5.2 release</a></p><p><span id="one-with">"The One With PostgreSQL!"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It's <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It's <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.4kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/postgresql.svg"> PostgreSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/pglite.svg"> PGlite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg"> Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg"> ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg"> Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg"> PowerSync</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.2.
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-2"><em>NEW!</em> v5.2 release</a></p><p><span id="one-with">"The One With PostgreSQL!"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It's <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It's <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.4kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/postgresql.svg"> PostgreSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/pglite.svg"> PGlite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg"> Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg"> ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg"> Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg"> PowerSync</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.2.1" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
import {createStore} from 'tinybase';
|
|
@@ -294,4 +294,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
294
294
|
};
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,224</td><td>2,224</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,400</td><td>2,400</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>958</td><td>958</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>858</td><td>858</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,339</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,971</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
|
|
297
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,224</td><td>2,224</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,400</td><td>2,400</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>958</td><td>958</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>858</td><td>858</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,339</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,979</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
|