tinybase 5.0.1 → 5.0.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.
Files changed (42) hide show
  1. package/@types/ui-react/index.d.cts +62 -45
  2. package/@types/ui-react/index.d.ts +62 -45
  3. package/@types/ui-react/with-schemas/index.d.cts +83 -59
  4. package/@types/ui-react/with-schemas/index.d.ts +83 -59
  5. package/cjs/es6/min/ui-react/index.cjs +1 -1
  6. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  7. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  8. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  9. package/cjs/es6/ui-react/index.cjs +13 -6
  10. package/cjs/es6/ui-react/with-schemas/index.cjs +13 -6
  11. package/cjs/min/ui-react/index.cjs +1 -1
  12. package/cjs/min/ui-react/index.cjs.gz +0 -0
  13. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  14. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  15. package/cjs/ui-react/index.cjs +11 -6
  16. package/cjs/ui-react/with-schemas/index.cjs +11 -6
  17. package/es6/min/ui-react/index.js +1 -1
  18. package/es6/min/ui-react/index.js.gz +0 -0
  19. package/es6/min/ui-react/with-schemas/index.js +1 -1
  20. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  21. package/es6/ui-react/index.js +13 -6
  22. package/es6/ui-react/with-schemas/index.js +13 -6
  23. package/min/ui-react/index.js +1 -1
  24. package/min/ui-react/index.js.gz +0 -0
  25. package/min/ui-react/with-schemas/index.js +1 -1
  26. package/min/ui-react/with-schemas/index.js.gz +0 -0
  27. package/package.json +1 -1
  28. package/readme.md +2 -2
  29. package/ui-react/index.js +11 -6
  30. package/ui-react/with-schemas/index.js +11 -6
  31. package/umd/es6/min/ui-react/index.js +1 -1
  32. package/umd/es6/min/ui-react/index.js.gz +0 -0
  33. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  34. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  35. package/umd/es6/ui-react/index.js +16 -6
  36. package/umd/es6/ui-react/with-schemas/index.js +16 -6
  37. package/umd/min/ui-react/index.js +1 -1
  38. package/umd/min/ui-react/index.js.gz +0 -0
  39. package/umd/min/ui-react/with-schemas/index.js +1 -1
  40. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/umd/ui-react/index.js +12 -6
  42. package/umd/ui-react/with-schemas/index.js +12 -6
@@ -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",w=m+u,f=e=>null==e,k=(e,t,o)=>f(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=>!f(e)&&k(j(e),(e=>e==L.prototype||f(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 f(e)?r[t]:h(e)?M(null!=(o=r[t+1])?o:{},e):e},W=(e,t)=>{const o=Q(e,t);return f(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)},we=(e,t,o,r=pe,n=pe,...l)=>ie((()=>me(t,e,...n,o,...l)),[t,e,...n,...r,...l]),fe=(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](...O(s,(t=>P(t)?t(e,r):t)),o),o)))))),[d,t,...r,...l,...s])},ke=(e,t,o=x,r=pe,...n)=>{const l=J(e);return se((()=>o(null==l?void 0:l["del"+t](...n))),[l,t,...r,...n])},he=(e,t,o)=>{const r=oe(e);return se((()=>null==r?void 0:r[t](o)),[r,t,o])},Pe=(e,t=pe)=>ue(e,t),Re=(e,t=pe)=>ue(e,t),xe=()=>z(1),qe=e=>Ce(c,J(e),4,[]),Se=e=>Ce(c,J(e),0),Oe=e=>Ce(a,J(e),1),Le=(e,t)=>Ce(i,J(t),4,[e]),je=(e,t)=>Ce(i,J(t),0,[e]),Be=(e,t)=>Ce(i+y,J(t),1,[e]),Ee=(e,t,o)=>Ce(i+g,J(o),4,[e,t]),Te=(e,t)=>Ce(p,J(t),5,[e]),Me=(e,t)=>Ce(v,J(t),1,[e]),Fe=(e,t,o,r=0,n,l)=>Ce(b,J(l),1,[e,t,o,r,n]),Ve=(e,t,o)=>Ce(I,J(o),4,[e,t]),Ae=(e,t,o)=>Ce(I,J(o),0,[e,t]),De=(e,t,o)=>Ce(y,J(o),1,[e,t]),He=(e,t,o,r)=>Ce(g,J(r),4,[e,t,o]),Qe=(e,t,o,r)=>Ce(g,J(r),3,[e,t,o]),We=e=>Ce(C,J(e),4,[]),ze=e=>Ce(C,J(e),0),Ge=e=>Ce(w,J(e),1),Je=(e,t)=>Ce(m,J(t),4,[e]),Ke=(e,t)=>Ce(m,J(t),3,[e]),Ne=(e,t,o,r,n)=>fe(o,c,e,t,r,n),Ue=(e,t,o,r,n,l)=>fe(r,i,t,o,n,l,e),Xe=(e,t,o,r,n,l,s)=>fe(n,I,o,r,l,s,e,t),Ye=(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])},Ze=(e,t,o,r,n,l,s)=>fe(n,"PartialRow",o,r,l,s,e,t),$e=(e,t,o,r,n,l,s,d)=>fe(l,g,r,n,s,d,e,t,o),_e=(e,t,o,r,n)=>fe(o,C,e,t,r,n),et=(e,t,o,r,n)=>fe(o,"PartialValues",e,t,r,n),tt=(e,t,o,r,n,l)=>fe(r,m,t,o,n,l,e),ot=(e,t,o)=>ke(e,c,t,o),rt=(e,t,o,r)=>ke(t,i,o,r,e),nt=(e,t,o,r,n)=>ke(o,I,r,n,e,t),lt=(e,t,o,r,n,l,s)=>ke(n,g,l,s,e,t,o,r),st=(e,t,o)=>ke(e,C,t,o),dt=(e,t,o,r)=>ke(t,m,o,r,e),ut=(e,t,o,r)=>we(d+c,J(r),e,t,[],o),it=(e,t,o,r)=>we(c,J(r),e,t,pe,o),ct=(e,t,o,r)=>we(a,J(r),e,t,pe,o),at=(e,t,o,r,n)=>we(d+i,J(n),t,o,[e],r),It=(e,t,o,r,n)=>we(i,J(n),t,o,[e],r),pt=(e,t,o,r,n)=>we(i+y,J(n),t,o,[e],r),vt=(e,t,o,r,n,l)=>we(d+i+g,J(l),o,r,[e,t],n),bt=(e,t,o,r,n)=>we(p,J(n),t,o,[e],r),gt=(e,t,o,r,n)=>we(v,J(n),t,o,[e],r),yt=(e,t,o,r,n,l,s,d,u)=>we(b,J(u),l,s,[e,t,o,r,n],d),mt=(e,t,o,r,n,l)=>we(d+I,J(l),o,r,[e,t],n),Ct=(e,t,o,r,n,l)=>we(I,J(l),o,r,[e,t],n),wt=(e,t,o,r,n,l)=>we(y,J(l),o,r,[e,t],n),ft=(e,t,o,r,n,l,s)=>we(d+g,J(s),r,n,[e,t,o],l),kt=(e,t,o,r,n,l,s)=>we(g,J(s),r,n,[e,t,o],l),ht=(e,t,o,r)=>we(d+C,J(r),e,t,[],o),Pt=(e,t,o,r)=>we(C,J(r),e,t,pe,o),Rt=(e,t,o,r)=>we(w,J(r),e,t,pe,o),xt=(e,t,o,r,n)=>we(d+m,J(n),t,o,[e],r),qt=(e,t,o,r,n)=>we(m,J(n),t,o,[e],r),St=(e,t,o)=>we("Start"+ne,J(o),e,t),Ot=(e,t,o)=>we("WillFinish"+ne,J(o),e,t),Lt=(e,t,o)=>we("DidFinish"+ne,J(o),e,t),jt=(e,t,o)=>ye(e,t,o),Bt=()=>z(3),Et=e=>Ce("MetricIds",U(e),1),Tt=(e,t)=>Ce("Metric",U(t),3,[e]),Mt=(e,t,o,r)=>we("Metric",U(r),t,o,[e]),Ft=(e,t,o)=>ye(e,t,o),Vt=()=>z(5),At=(e,t)=>Ce("SliceIds",Y(t),1,[e]),Dt=e=>Ce("IndexIds",Y(e),1),Ht=(e,t,o)=>Ce("Slice"+v,Y(o),1,[e,t]),Qt=(e,t,o,r)=>we("SliceIds",Y(r),t,o,[e]),Wt=(e,t,o,r,n)=>we("Slice"+v,Y(n),o,r,[e,t]),zt=(e,t,o)=>ye(e,t,o),Gt=()=>z(7),Jt=e=>Ce("RelationshipIds",$(e),1),Kt=(e,t,o)=>Ce("RemoteRowId",$(o),3,[e,t]),Nt=(e,t,o)=>Ce("Local"+v,$(o),1,[e,t]),Ut=(e,t,o)=>Ce("Linked"+v,$(o),1,[e,t]),Xt=(e,t,o,r,n)=>we("RemoteRowId",$(n),o,r,[e,t]),Yt=(e,t,o,r,n)=>we("Local"+v,$(n),o,r,[e,t]),Zt=(e,t,o,r,n)=>we("Linked"+v,$(n),o,r,[e,t]),$t=(e,t,o)=>ye(e,t,o),_t=()=>z(9),eo=e=>Ce("QueryIds",ee(e),1),to=(e,t)=>Ce(s+i,ee(t),0,[e]),oo=(e,t)=>Ce(s+i+y,ee(t),1,[e]),ro=(e,t)=>Ce(s+p,ee(t),5,[e]),no=(e,t)=>Ce(s+v,ee(t),1,[e]),lo=(e,t,o,r=0,n,l)=>Ce(s+b,ee(l),1,[e,t,o,r,n]),so=(e,t,o)=>Ce(s+I,ee(o),0,[e,t]),uo=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),io=(e,t,o,r)=>Ce(s+g,ee(r),3,[e,t,o]),co=(e,t,o,r)=>we(s+i,ee(r),t,o,[e]),ao=(e,t,o,r)=>we(s+i+y,ee(r),t,o,[e]),Io=(e,t,o,r)=>we(s+p,ee(r),t,o,[e]),po=(e,t,o,r)=>we(s+v,ee(r),t,o,[e]),vo=(e,t,o,r,n,l,d,u)=>we(s+b,ee(u),l,d,[e,t,o,r,n]),bo=(e,t,o,r,n)=>we(s+I,ee(n),o,r,[e,t]),go=(e,t,o,r,n)=>we(s+y,ee(n),o,r,[e,t]),yo=(e,t,o,r,n,l)=>we(s+g,ee(l),r,n,[e,t,o]),mo=(e,t,o)=>ye(e,t,o),Co=()=>z(11),wo=e=>Ce("CheckpointIds",oe(e),2),fo=(e,t)=>Ce("Checkpoint",oe(t),3,[e]),ko=(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])},ho=e=>he(e,"goBackward"),Po=e=>he(e,"goForward"),Ro=(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])},xo=e=>{var t;const r=oe(e),[n,l]=wo(r);return[(s=n,!(0==R(s))),ho(r),l,null!=(t=k(l,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o];var s},qo=e=>{var t;const r=oe(e),[,,[n]]=wo(r);return[!f(n),Po(r),n,null!=(t=k(n,(e=>null==r?void 0:r.getCheckpoint(e))))?t:o]},So=(e,t,o)=>we("CheckpointIds",oe(o),e,t),Oo=(e,t,o,r)=>we("Checkpoint",oe(r),t,o,[e]),Lo=(e,t,o=pe,r,n=pe,l,s=pe)=>{const[,d]=ae(),[u,i]=ae();return de((()=>{const o=e?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},jo=(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:Bo,Fragment:Eo,createElement:To,useCallback:Mo,useLayoutEffect:Fo,useRef:Vo,useState:Ao}=e,Do=(e,...t)=>f(e)?{}:e(...t),Ho=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Qo=Object.defineProperty,Wo=Object.defineProperties,zo=Object.getOwnPropertyDescriptors,Go=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Ko=Object.prototype.propertyIsEnumerable,No=(e,t,o)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Uo=(e,t)=>{for(var o in t||(t={}))Jo.call(t,o)&&No(e,o,t[o]);if(Go)for(var o of Go(t))Ko.call(t,o)&&No(e,o,t[o]);return e},Xo=(e,t)=>Wo(e,zo(t)),Yo=(e,t)=>{var o={};for(var r in e)Jo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&Go)for(var r of Go(e))t.indexOf(r)<0&&Ko.call(e,r)&&(o[r]=e[r]);return o};const{useCallback:Zo,useContext:$o,useMemo:_o,useState:er}=e,tr=({tableId:e,store:t,rowComponent:o=ur,getRowComponentProps:r,customCellIds:n,separator:l,debugIds:s},d)=>sr(O(d,(l=>To(o,Xo(Uo({},Do(r,l)),{key:l,tableId:e,rowId:l,customCellIds:n,store:t,debugIds:s})))),l,s,e),or=({queryId:e,queries:t,resultRowComponent:o=fr,getResultRowComponentProps:r,separator:n,debugIds:l},s)=>sr(O(s,(n=>To(o,Xo(Uo({},Do(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:l})))),n,l,e),rr=({relationshipId:e,relationships:t,rowComponent:o=ur,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,c]=Ho($(t),e),a=s(e,d,u);return sr(O(a,(e=>To(o,Xo(Uo({},Do(r,e)),{key:e,tableId:c,rowId:e,store:i,debugIds:l})))),n,l,d)},nr=e=>({checkpoints:t,checkpointComponent:o=Pr,getCheckpointComponentProps:r,separator:n,debugIds:l})=>{const s=oe(t);return sr(O(e(wo(s)),(e=>To(o,Xo(Uo({},Do(r,e)),{key:e,checkpoints:s,checkpointId:e,debugIds:l})))),n)},lr=({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=$o(H),[v,b]=er({}),g=Zo(((e,t)=>b((o=>M(o,e)==t?o:Xo(Uo({},o),{[e]:t})))),[]),y=Zo((e=>b((t=>Uo({},((e,t)=>(delete e[t],e))(t,e))))),[]);return To(H.Provider,{value:_o((()=>[null!=e?e:p[0],Uo(Uo(Uo({},p[1]),t),v),null!=o?o:p[2],Uo(Uo({},p[3]),r),null!=n?n:p[4],Uo(Uo({},p[5]),l),null!=s?s:p[6],Uo(Uo({},p[7]),d),null!=u?u:p[8],Uo(Uo({},p[9]),i),null!=c?c:p[10],Uo(Uo({},p[11]),a),g,y]),[e,t,v,o,r,n,l,s,d,u,i,c,a,p,g,y])},I)},sr=(e,t,o,r)=>{const n=f(t)||!Array.isArray(e)?e:O(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},dr=({tableId:e,rowId:t,cellId:r,store:n,debugIds:l})=>{var s;return sr(o+(null!=(s=Qe(e,t,r,n))?s:o),void 0,l,r)},ur=({tableId:e,rowId:t,store:o,cellComponent:r=dr,getCellComponentProps:n,customCellIds:l,separator:s,debugIds:d})=>sr(O(((e,t,o,r)=>{const n=De(t,o,r);return null!=e?e:n})(l,e,t,o),(l=>To(r,Xo(Uo({},Do(n,l)),{key:l,tableId:e,rowId:t,cellId:l,store:o,debugIds:d})))),s,d,t),ir=e=>tr(e,Me(e.tableId,e.store)),cr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=Yo(t,["cellId","descending","offset","limit"]);return tr(s,Fe(s.tableId,o,r,n,l,s.store))},ar=({store:e,tableComponent:t=ir,getTableComponentProps:o,separator:r,debugIds:n})=>sr(O(Oe(e),(r=>To(t,Xo(Uo({},Do(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),Ir=({valueId:e,store:t,debugIds:r})=>{var n;return sr(o+(null!=(n=Ke(e,t))?n:o),void 0,r,e)},pr=({store:e,valueComponent:t=Ir,getValueComponentProps:o,separator:r,debugIds:n})=>sr(O(Ge(e),(r=>To(t,Xo(Uo({},Do(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),vr=({metricId:e,metrics:t,debugIds:r})=>{var n;return sr(null!=(n=Tt(e,t))?n:o,void 0,r,e)},br=({indexId:e,sliceId:t,indexes:o,rowComponent:r=ur,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=Ht(e,t,d);return sr(O(c,(e=>To(r,Xo(Uo({},Do(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:s})))),l,s,t)},gr=({indexId:e,indexes:t,sliceComponent:o=br,getSliceComponentProps:r,separator:n,debugIds:l})=>sr(O(At(e,t),(n=>To(o,Xo(Uo({},Do(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:l})))),n,l,e),yr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=ur,getRowComponentProps:n,debugIds:l})=>{const[s,d,,u]=Ho($(o),e),i=Kt(e,t,s);return sr(f(u)||f(i)?null:To(r,Xo(Uo({},Do(n,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:l})),void 0,l,t)},mr=e=>rr(e,Nt,e.remoteRowId),Cr=e=>rr(e,Ut,e.firstRowId),wr=({queryId:e,rowId:t,cellId:r,queries:n,debugIds:l})=>{var s;return sr(o+(null!=(s=io(e,t,r,n))?s:o),void 0,l,r)},fr=({queryId:e,rowId:t,queries:o,resultCellComponent:r=wr,getResultCellComponentProps:n,separator:l,debugIds:s})=>sr(O(uo(e,t,o),(l=>To(r,Xo(Uo({},Do(n,l)),{key:l,queryId:e,rowId:t,cellId:l,queries:o,debugIds:s})))),l,s,t),kr=e=>or(e,no(e.queryId,e.queries)),hr=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:l}=t,s=Yo(t,["cellId","descending","offset","limit"]);return or(s,lo(s.queryId,o,r,n,l,s.queries))},Pr=({checkpoints:e,checkpointId:t,debugIds:r})=>{var n;return sr(null!=(n=fo(t,e))?n:o,void 0,r,t)},Rr=nr((e=>e[0])),xr=nr((e=>f(e[1])?[]:[e[1]])),qr=nr((e=>e[2]));export{Rr as BackwardCheckpointsView,dr as CellView,Pr as CheckpointView,xr as CurrentCheckpointView,qr as ForwardCheckpointsView,gr as IndexView,Cr as LinkedRowsView,mr as LocalRowsView,vr as MetricView,lr as Provider,yr as RemoteRowView,wr as ResultCellView,fr as ResultRowView,hr as ResultSortedTableView,kr as ResultTableView,ur as RowView,br as SliceView,cr as SortedTableView,ir as TableView,ar as TablesView,Ir as ValueView,pr as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,kt as useCellListener,fo as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Oo as useCheckpointListener,te as useCheckpoints,Co as useCheckpointsIds,oe as useCheckpointsOrCheckpointsById,mo as useCreateCheckpoints,Ft as useCreateIndexes,Re as useCreateMergeableStore,jt as useCreateMetrics,Lo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,Pe as useCreateStore,jo as useCreateSynchronizer,lt as useDelCellCallback,nt as useDelRowCallback,rt as useDelTableCallback,ot as useDelTablesCallback,dt as useDelValueCallback,st as useDelValuesCallback,Lt as useDidFinishTransactionListener,ho as useGoBackwardCallback,Po as useGoForwardCallback,Ro as useGoToCallback,He as useHasCell,ft as useHasCellListener,Ve as useHasRow,mt as useHasRowListener,Le as useHasTable,Ee as useHasTableCell,vt as useHasTableCellListener,at as useHasTableListener,qe as useHasTables,ut as useHasTablesListener,Je as useHasValue,xt as useHasValueListener,We as useHasValues,ht as useHasValuesListener,Dt as useIndexIds,X as useIndexes,Vt as useIndexesIds,Y as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Tt as useMetric,Et as useMetricIds,Mt as useMetricListener,N as useMetrics,Bt as useMetricsIds,U as useMetricsOrMetricsById,K as useProvideStore,_ as useQueries,_t as useQueriesIds,ee as useQueriesOrQueriesById,eo as useQueryIds,qo as useRedoInformation,Jt as useRelationshipIds,Z as useRelationships,Gt as useRelationshipsIds,$ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,io as useResultCell,uo as useResultCellIds,go as useResultCellIdsListener,yo as useResultCellListener,so as useResultRow,ro as useResultRowCount,Io as useResultRowCountListener,no as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,lo as useResultSortedRowIds,vo as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,ao as useResultTableCellIdsListener,co as useResultTableListener,Ae as useRow,Te as useRowCount,bt as useRowCountListener,Me as useRowIds,gt as useRowIdsListener,Ct as useRowListener,$e as useSetCellCallback,ko as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,At as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Fe as useSortedRowIds,yt as useSortedRowIdsListener,St as useStartTransactionListener,G as useStore,xe as useStoreIds,J as useStoreOrStoreById,je as useTable,Be as useTableCellIds,pt as useTableCellIdsListener,Oe as useTableIds,ct as useTableIdsListener,It as useTableListener,Se as useTables,it as useTablesListener,xo as useUndoInformation,Ke as useValue,Ge as useValueIds,Rt as useValueIdsListener,qt as useValueListener,ze as useValues,Pt as useValuesListener,Ot 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=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:ae,useState:ce,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]=ce(),[n,l]=ce();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=ae(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(a,J(e),4,[]),Le=e=>Ce(a,J(e),0),je=e=>Ce(c,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,a,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,n)=>we(o,C,e,t,r,n),ot=(e,t,o,r,n)=>we(o,"PartialValues",e,t,r,n),rt=(e,t,o,r,n,l)=>we(r,m,t,o,n,l,e),nt=(e,t,o)=>Pe(e,a,t,o),lt=(e,t,o,r)=>Pe(t,i,o,r,e),st=(e,t,o,r,n)=>Pe(o,I,r,n,e,t),dt=(e,t,o,r,n,l,s)=>Pe(n,g,l,s,e,t,o,r),ut=(e,t,o)=>Pe(e,C,t,o),it=(e,t,o,r)=>Pe(t,m,o,r,e),at=(e,t,o,r)=>fe(d+a,J(r),e,t,[],o),ct=(e,t,o,r)=>fe(a,J(r),e,t,pe,o),It=(e,t,o,r)=>fe(c,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,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]),ao=(e,t,o)=>Ce(s+y,ee(o),1,[e,t]),co=(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]=ce(),[u,i]=ce();return de((()=>{const o=e?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]=ce();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=ar,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=ar,getRowComponentProps:r,separator:n,debugIds:l},s,d)=>{const[u,i,a]=Wo($(t),e),c=s(e,d,u);return ur(O(c,(e=>Fo(o,Zo(Yo({},Qo(r,e)),{key:e,tableId:a,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:a,checkpointsById:c,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!=a?a:p[10],Yo(Yo({},p[11]),c),g,y]),[e,t,v,o,r,n,l,s,d,u,i,a,c,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)},ar=({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),cr=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=cr,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=ar,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),a=Wt(e,t,d);return ur(O(a,(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=ar,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=co(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(ao(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,ar as RowView,yr as SliceView,Ir as SortedTableView,cr 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,at 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,co as useResultCell,ao 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,ct 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};
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
39
39
  arrayEvery(array1, (value1, index) => array2[index] === value1);
40
40
  const arrayMap = (array, cb) => array.map(cb);
41
41
  const arrayIsEmpty = (array) => size(array) == 0;
42
+ const arrayFilter = (array, cb) => array.filter(cb);
42
43
 
43
44
  const object = Object;
44
45
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -266,9 +267,7 @@ const useSetCallback = (
266
267
  ifNotUndefined(get(parameter, store2), (thing) =>
267
268
  then(
268
269
  store2['set' + settable](
269
- ...arrayMap(args, (arg) =>
270
- isFunction(arg) ? arg(parameter, store2) : arg,
271
- ),
270
+ ...argsOrGetArgs(args, store2, parameter),
272
271
  thing,
273
272
  ),
274
273
  thing,
@@ -276,9 +275,12 @@ const useSetCallback = (
276
275
  ),
277
276
  ),
278
277
  // eslint-disable-next-line react-hooks/exhaustive-deps
279
- [store, settable, ...getDeps, ...thenDeps, ...args],
278
+ [store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
280
279
  );
281
280
  };
281
+ const argsOrGetArgs = (args, store, parameter) =>
282
+ arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
283
+ const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
282
284
  const useDel = (
283
285
  storeOrStoreId,
284
286
  deletable,
@@ -288,9 +290,14 @@ const useDel = (
288
290
  ) => {
289
291
  const store = useStoreOrStoreById(storeOrStoreId);
290
292
  return useCallback$2(
291
- () => then(store == null ? void 0 : store['del' + deletable](...args)),
293
+ (parameter) =>
294
+ then(
295
+ store == null
296
+ ? void 0
297
+ : store['del' + deletable](...argsOrGetArgs(args, store, parameter)),
298
+ ),
292
299
  // eslint-disable-next-line react-hooks/exhaustive-deps
293
- [store, deletable, ...thenDeps, ...args],
300
+ [store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
294
301
  );
295
302
  };
296
303
  const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
39
39
  arrayEvery(array1, (value1, index) => array2[index] === value1);
40
40
  const arrayMap = (array, cb) => array.map(cb);
41
41
  const arrayIsEmpty = (array) => size(array) == 0;
42
+ const arrayFilter = (array, cb) => array.filter(cb);
42
43
 
43
44
  const object = Object;
44
45
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -266,9 +267,7 @@ const useSetCallback = (
266
267
  ifNotUndefined(get(parameter, store2), (thing) =>
267
268
  then(
268
269
  store2['set' + settable](
269
- ...arrayMap(args, (arg) =>
270
- isFunction(arg) ? arg(parameter, store2) : arg,
271
- ),
270
+ ...argsOrGetArgs(args, store2, parameter),
272
271
  thing,
273
272
  ),
274
273
  thing,
@@ -276,9 +275,12 @@ const useSetCallback = (
276
275
  ),
277
276
  ),
278
277
  // eslint-disable-next-line react-hooks/exhaustive-deps
279
- [store, settable, ...getDeps, ...thenDeps, ...args],
278
+ [store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
280
279
  );
281
280
  };
281
+ const argsOrGetArgs = (args, store, parameter) =>
282
+ arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
283
+ const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
282
284
  const useDel = (
283
285
  storeOrStoreId,
284
286
  deletable,
@@ -288,9 +290,14 @@ const useDel = (
288
290
  ) => {
289
291
  const store = useStoreOrStoreById(storeOrStoreId);
290
292
  return useCallback$2(
291
- () => then(store == null ? void 0 : store['del' + deletable](...args)),
293
+ (parameter) =>
294
+ then(
295
+ store == null
296
+ ? void 0
297
+ : store['del' + deletable](...argsOrGetArgs(args, store, parameter)),
298
+ ),
292
299
  // eslint-disable-next-line react-hooks/exhaustive-deps
293
- [store, deletable, ...thenDeps, ...args],
300
+ [store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
294
301
  );
295
302
  };
296
303
  const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
@@ -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",i=I+"s",l=I+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=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:ie,useState:le,useSyncExternalStore:ae}=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)},ke=(e,t,s,r=pe)=>{const d=ie(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 ae(c,n)},we=(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](...L(n,(t=>v(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},Re=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},fe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},ve=(e,t=pe)=>ce(e,t),qe=(e,t=pe)=>ce(e,t),Pe=()=>G(1),xe=e=>ke(i,K(e),4,[]),Se=e=>ke(i,K(e),0),Le=e=>ke(l,K(e),1),Be=(e,t)=>ke(I,K(t),4,[e]),Te=(e,t)=>ke(I,K(t),0,[e]),Ee=(e,t)=>ke(I+m,K(t),1,[e]),Me=(e,t,o)=>ke(I+C,K(o),4,[e,t]),Fe=(e,t)=>ke(p,K(t),5,[e]),Ve=(e,t)=>ke(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>ke(a,K(o),4,[e,t]),je=(e,t,o)=>ke(a,K(o),0,[e,t]),De=(e,t,o)=>ke(m,K(o),1,[e,t]),He=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),We=e=>ke(k,K(e),4,[]),ze=e=>ke(k,K(e),0),Ge=e=>ke(w,K(e),1),Je=(e,t)=>ke(y,K(t),4,[e]),Ke=(e,t)=>ke(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,i,e,t,s,r),Ue=(e,t,o,s,r,d)=>he(s,I,t,o,r,d,e),Xe=(e,t,o,s,r,d,n)=>he(r,a,o,s,d,n,e,t),Ye=(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])},Ze=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),$e=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),_e=(e,t,o,s,r)=>he(o,k,e,t,s,r),et=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),tt=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),ot=(e,t,o)=>Re(e,i,t,o),st=(e,t,o,s)=>Re(t,I,o,s,e),rt=(e,t,o,s,r)=>Re(o,a,s,r,e,t),dt=(e,t,o,s,r,d,n)=>Re(r,C,d,n,e,t,o,s),nt=(e,t,o)=>Re(e,k,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>we(u+i,K(s),e,t,[],o),It=(e,t,o,s)=>we(i,K(s),e,t,pe,o),it=(e,t,o,s)=>we(l,K(s),e,t,pe,o),lt=(e,t,o,s,r)=>we(u+I,K(r),t,o,[e],s),at=(e,t,o,s,r)=>we(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>we(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>we(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),vt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),qt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),Pt=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),St=(e,t,o)=>we("Start"+de,K(o),e,t),Lt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>ke("MetricIds",X(e),1),Ft=(e,t)=>ke("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>ke("SliceIds",Z(t),1,[e]),Dt=e=>ke("IndexIds",Z(e),1),Ht=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>ke("RelationshipIds",_(e),1),Kt=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>ke("QueryIds",te(e),1),to=(e,t)=>ke(n+I,te(t),0,[e]),oo=(e,t)=>ke(n+I+m,te(t),1,[e]),so=(e,t)=>ke(n+p,te(t),5,[e]),ro=(e,t)=>ke(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>ke(n+a,te(o),0,[e,t]),co=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),io=(e,t,o,s)=>we(n+I,te(s),t,o,[e]),lo=(e,t,o,s)=>we(n+I+m,te(s),t,o,[e]),ao=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),ko=()=>G(11),wo=e=>ke("CheckpointIds",se(e),2),ho=(e,t)=>ke("Checkpoint",se(t),3,[e]),Ro=(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])},fo=e=>fe(e,"goBackward"),vo=e=>fe(e,"goForward"),qo=(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])},Po=e=>{const t=se(e),[s,r]=wo(t);return[(d=s,!(0==q(d))),fo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},xo=e=>{const t=se(e),[,,[s]]=wo(t);return[!h(s),vo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>we("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Bo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,I]=le();return ue((()=>{const o=e?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},To=(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:Eo,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Oo,useState:jo}=e,Do=(e,...t)=>h(e)?{}:e(...t),Ho=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Qo,useContext:Wo,useMemo:zo,useState:Go}=e,Jo=({tableId:e,store:t,rowComponent:o=$o,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Yo(L(u,(d=>Fo(o,{...Do(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Ko=({queryId:e,queries:t,resultRowComponent:o=ls,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Yo(L(n,(r=>Fo(o,{...Do(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),No=({relationshipId:e,relationships:t,rowComponent:o=$o,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,I,i]=Ho(_(t),e),l=n(e,u,c);return Yo(L(l,(e=>Fo(o,{...Do(s,e),key:e,tableId:i,rowId:e,store:I,debugIds:d}))),r,d,u)},Uo=e=>({checkpoints:t,checkpointComponent:o=gs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return Yo(L(e(wo(n)),(e=>Fo(o,{...Do(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Xo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:I,checkpoints:i,checkpointsById:l,children:a})=>{const p=Wo(Q),[g,b]=Go({}),C=Qo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=Qo((e=>b((t=>({...A(t,e)})))),[]);return Fo(Q.Provider,{value:zo((()=>[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},i??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,I,i,l,p,C,m])},a)},Yo=(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},Zo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Yo(o+(Qe(e,t,s,r)??o),void 0,d,s),$o=({tableId:e,rowId:t,store:o,cellComponent:s=Zo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Yo(L(((e,t,o,s)=>{const r=De(t,o,s);return e??r})(d,e,t,o),(d=>Fo(s,{...Do(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),_o=e=>Jo(e,Ve(e.tableId,e.store)),es=({cellId:e,descending:t,offset:o,limit:s,...r})=>Jo(r,Ae(r.tableId,e,t,o,s,r.store)),ts=({store:e,tableComponent:t=_o,getTableComponentProps:o,separator:s,debugIds:r})=>Yo(L(Le(e),(s=>Fo(t,{...Do(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),os=({valueId:e,store:t,debugIds:s})=>Yo(o+(Ke(e,t)??o),void 0,s,e),ss=({store:e,valueComponent:t=os,getValueComponentProps:o,separator:s,debugIds:r})=>Yo(L(Ge(e),(s=>Fo(t,{...Do(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),rs=({metricId:e,metrics:t,debugIds:s})=>Yo(Ft(e,t)??o,void 0,s,e),ds=({indexId:e,sliceId:t,indexes:o,rowComponent:s=$o,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,I]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),i=Ht(e,t,u);return Yo(L(i,(e=>Fo(s,{...Do(r,e),key:e,tableId:I,rowId:e,store:c,debugIds:n}))),d,n,t)},ns=({indexId:e,indexes:t,sliceComponent:o=ds,getSliceComponentProps:s,separator:r,debugIds:d})=>Yo(L(jt(e,t),(r=>Fo(o,{...Do(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),us=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=$o,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Ho(_(o),e),I=Kt(e,t,n);return Yo(h(c)||h(I)?null:Fo(s,{...Do(r,I),key:I,tableId:c,rowId:I,store:u,debugIds:d}),void 0,d,t)},cs=e=>No(e,Nt,e.remoteRowId),Is=e=>No(e,Ut,e.firstRowId),is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Yo(o+(Io(e,t,s,r)??o),void 0,d,s),ls=({queryId:e,rowId:t,queries:o,resultCellComponent:s=is,getResultCellComponentProps:r,separator:d,debugIds:n})=>Yo(L(co(e,t,o),(d=>Fo(s,{...Do(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),as=e=>Ko(e,ro(e.queryId,e.queries)),ps=({cellId:e,descending:t,offset:o,limit:s,...r})=>Ko(r,no(r.queryId,e,t,o,s,r.queries)),gs=({checkpoints:e,checkpointId:t,debugIds:s})=>Yo(ho(t,e)??o,void 0,s,t),bs=Uo((e=>e[0])),Cs=Uo((e=>h(e[1])?[]:[e[1]])),ms=Uo((e=>e[2]));export{bs as BackwardCheckpointsView,Zo as CellView,gs as CheckpointView,Cs as CurrentCheckpointView,ms as ForwardCheckpointsView,ns as IndexView,Is as LinkedRowsView,cs as LocalRowsView,rs as MetricView,Xo as Provider,us as RemoteRowView,is as ResultCellView,ls as ResultRowView,ps as ResultSortedTableView,as as ResultTableView,$o as RowView,ds as SliceView,es as SortedTableView,_o as TableView,ts as TablesView,os as ValueView,ss as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,ko as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,yo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Tt as useCreateMetrics,Bo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,ve as useCreateStore,To as useCreateSynchronizer,dt as useDelCellCallback,rt as useDelRowCallback,st as useDelTableCallback,ot as useDelTablesCallback,ut as useDelValueCallback,nt as useDelValuesCallback,Bt as useDidFinishTransactionListener,fo as useGoBackwardCallback,vo as useGoForwardCallback,qo as useGoToCallback,He as useHasCell,ht as useHasCellListener,Oe as useHasRow,yt as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,lt as useHasTableListener,xe as useHasTables,ct as useHasTablesListener,Je as useHasValue,Pt as useHasValueListener,We as useHasValues,ft as useHasValuesListener,Dt as useIndexIds,Y as useIndexes,Ot as useIndexesIds,Z as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,U as useMetrics,Et as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,_t as useQueriesIds,te as useQueriesOrQueriesById,eo as useQueryIds,xo as useRedoInformation,Jt as useRelationshipIds,$ as useRelationships,Gt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,Io as useResultCell,co as useResultCellIds,Co as useResultCellIdsListener,mo as useResultCellListener,uo as useResultRow,so as useResultRowCount,ao as useResultRowCountListener,ro as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,no as useResultSortedRowIds,go as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,lo as useResultTableCellIdsListener,io as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,kt as useRowListener,$e as useSetCellCallback,Ro as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,jt as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Ae as useSortedRowIds,mt as useSortedRowIdsListener,St as useStartTransactionListener,J as useStore,Pe as useStoreIds,K as useStoreOrStoreById,Te as useTable,Ee as useTableCellIds,pt as useTableCellIdsListener,Le as useTableIds,it as useTableIdsListener,at as useTableListener,Se as useTables,It as useTablesListener,Po as useUndoInformation,Ke as useValue,Ge as useValueIds,qt as useValueIdsListener,xt as useValueListener,ze as useValues,vt as useValuesListener,Lt 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",l=i+"s",I=i+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=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:le,useState:Ie,useSyncExternalStore:ae}=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]=Ie(),[r,d]=Ie();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)},ke=(e,t,s,r=pe)=>{const d=le(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 ae(c,n)},we=(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=>ke(l,K(e),4,[]),Be=e=>ke(l,K(e),0),Te=e=>ke(I,K(e),1),Ee=(e,t)=>ke(i,K(t),4,[e]),Me=(e,t)=>ke(i,K(t),0,[e]),Fe=(e,t)=>ke(i+m,K(t),1,[e]),Ve=(e,t,o)=>ke(i+C,K(o),4,[e,t]),Ae=(e,t)=>ke(p,K(t),5,[e]),Oe=(e,t)=>ke(g,K(t),1,[e]),je=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),De=(e,t,o)=>ke(a,K(o),4,[e,t]),He=(e,t,o)=>ke(a,K(o),0,[e,t]),Qe=(e,t,o)=>ke(m,K(o),1,[e,t]),We=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),ze=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),Ge=e=>ke(k,K(e),4,[]),Je=e=>ke(k,K(e),0),Ke=e=>ke(w,K(e),1),Ne=(e,t)=>ke(y,K(t),4,[e]),Ue=(e,t)=>ke(y,K(t),3,[e]),Xe=(e,t,o,s,r)=>he(o,l,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,a,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,k,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,l,t,o),dt=(e,t,o,s)=>ve(t,i,o,s,e),nt=(e,t,o,s,r)=>ve(o,a,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,k,t,o),it=(e,t,o,s)=>ve(t,y,o,s,e),lt=(e,t,o,s)=>we(u+l,K(s),e,t,[],o),It=(e,t,o,s)=>we(l,K(s),e,t,pe,o),at=(e,t,o,s)=>we(I,K(s),e,t,pe,o),pt=(e,t,o,s,r)=>we(u+i,K(r),t,o,[e],s),gt=(e,t,o,s,r)=>we(i,K(r),t,o,[e],s),bt=(e,t,o,s,r)=>we(i+m,K(r),t,o,[e],s),Ct=(e,t,o,s,r,d)=>we(u+i+C,K(d),o,s,[e,t],r),mt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),yt=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),kt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),wt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),Rt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ft=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),vt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),qt=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),Pt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),xt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),St=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),Lt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),Bt=(e,t,o)=>we("Start"+de,K(o),e,t),Tt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Et=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Mt=(e,t,o)=>me(e,t,o),Ft=()=>G(3),Vt=e=>ke("MetricIds",X(e),1),At=(e,t)=>ke("Metric",X(t),3,[e]),Ot=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),jt=(e,t,o)=>me(e,t,o),Dt=()=>G(5),Ht=(e,t)=>ke("SliceIds",Z(t),1,[e]),Qt=e=>ke("IndexIds",Z(e),1),Wt=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),zt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Gt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),Jt=(e,t,o)=>me(e,t,o),Kt=()=>G(7),Nt=e=>ke("RelationshipIds",_(e),1),Ut=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Xt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Yt=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Zt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),$t=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),_t=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),eo=(e,t,o)=>me(e,t,o),to=()=>G(9),oo=e=>ke("QueryIds",te(e),1),so=(e,t)=>ke(n+i,te(t),0,[e]),ro=(e,t)=>ke(n+i+m,te(t),1,[e]),no=(e,t)=>ke(n+p,te(t),5,[e]),uo=(e,t)=>ke(n+g,te(t),1,[e]),co=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),io=(e,t,o)=>ke(n+a,te(o),0,[e,t]),lo=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),ao=(e,t,o,s)=>we(n+i,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+i+m,te(s),t,o,[e]),go=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),bo=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),Co=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),mo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),yo=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),ko=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),wo=(e,t,o)=>me(e,t,o),ho=()=>G(11),Ro=e=>ke("CheckpointIds",se(e),2),fo=(e,t)=>ke("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)=>we("CheckpointIds",se(o),e,t),To=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Eo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=Ie(),[c,i]=Ie();return ue((()=>{const o=e?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]=Ie();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,l]=Wo(_(t),e),I=n(e,u,c);return $o(L(I,(e=>Ao(o,{...Qo(s,e),key:e,tableId:l,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:l,checkpointsById:I,children:a})=>{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},l??p[10],{...p[11],...I},C,m]),[e,t,g,o,s,r,d,n,u,c,i,l,I,p,C,m])},a)},$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),l=Wt(e,t,u);return $o(L(l,(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)},ls=e=>Xo(e,Xt,e.remoteRowId),Is=e=>Xo(e,Yt,e.firstRowId),as=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>$o(o+(Io(e,t,s,r)??o),void 0,d,s),ps=({queryId:e,rowId:t,queries:o,resultCellComponent:s=as,getResultCellComponentProps:r,separator:d,debugIds:n})=>$o(L(lo(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]])),ks=Yo((e=>e[2]));export{ms as BackwardCheckpointsView,_o as CellView,Cs as CheckpointView,ys as CurrentCheckpointView,ks as ForwardCheckpointsView,cs as IndexView,Is as LinkedRowsView,ls as LocalRowsView,ns as MetricView,Zo as Provider,is as RemoteRowView,as 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,wo 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,wt as useHasRowListener,Ee as useHasTable,Ve as useHasTableCell,Ct as useHasTableCellListener,pt as useHasTableListener,Le as useHasTables,lt 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,Io as useResultCell,lo as useResultCellIds,yo as useResultCellIdsListener,ko 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,ao 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,kt 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,at as useTableIdsListener,gt as useTableListener,Be as useTables,It 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};
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",i=I+"s",l=I+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=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:ie,useState:le,useSyncExternalStore:ae}=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)},ke=(e,t,s,r=pe)=>{const d=ie(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 ae(c,n)},we=(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](...L(n,(t=>v(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},Re=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},fe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},ve=(e,t=pe)=>ce(e,t),qe=(e,t=pe)=>ce(e,t),Pe=()=>G(1),xe=e=>ke(i,K(e),4,[]),Se=e=>ke(i,K(e),0),Le=e=>ke(l,K(e),1),Be=(e,t)=>ke(I,K(t),4,[e]),Te=(e,t)=>ke(I,K(t),0,[e]),Ee=(e,t)=>ke(I+m,K(t),1,[e]),Me=(e,t,o)=>ke(I+C,K(o),4,[e,t]),Fe=(e,t)=>ke(p,K(t),5,[e]),Ve=(e,t)=>ke(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>ke(a,K(o),4,[e,t]),je=(e,t,o)=>ke(a,K(o),0,[e,t]),De=(e,t,o)=>ke(m,K(o),1,[e,t]),He=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),We=e=>ke(k,K(e),4,[]),ze=e=>ke(k,K(e),0),Ge=e=>ke(w,K(e),1),Je=(e,t)=>ke(y,K(t),4,[e]),Ke=(e,t)=>ke(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,i,e,t,s,r),Ue=(e,t,o,s,r,d)=>he(s,I,t,o,r,d,e),Xe=(e,t,o,s,r,d,n)=>he(r,a,o,s,d,n,e,t),Ye=(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])},Ze=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),$e=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),_e=(e,t,o,s,r)=>he(o,k,e,t,s,r),et=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),tt=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),ot=(e,t,o)=>Re(e,i,t,o),st=(e,t,o,s)=>Re(t,I,o,s,e),rt=(e,t,o,s,r)=>Re(o,a,s,r,e,t),dt=(e,t,o,s,r,d,n)=>Re(r,C,d,n,e,t,o,s),nt=(e,t,o)=>Re(e,k,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>we(u+i,K(s),e,t,[],o),It=(e,t,o,s)=>we(i,K(s),e,t,pe,o),it=(e,t,o,s)=>we(l,K(s),e,t,pe,o),lt=(e,t,o,s,r)=>we(u+I,K(r),t,o,[e],s),at=(e,t,o,s,r)=>we(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>we(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>we(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),vt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),qt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),Pt=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),St=(e,t,o)=>we("Start"+de,K(o),e,t),Lt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>ke("MetricIds",X(e),1),Ft=(e,t)=>ke("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>ke("SliceIds",Z(t),1,[e]),Dt=e=>ke("IndexIds",Z(e),1),Ht=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>ke("RelationshipIds",_(e),1),Kt=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>ke("QueryIds",te(e),1),to=(e,t)=>ke(n+I,te(t),0,[e]),oo=(e,t)=>ke(n+I+m,te(t),1,[e]),so=(e,t)=>ke(n+p,te(t),5,[e]),ro=(e,t)=>ke(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>ke(n+a,te(o),0,[e,t]),co=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),io=(e,t,o,s)=>we(n+I,te(s),t,o,[e]),lo=(e,t,o,s)=>we(n+I+m,te(s),t,o,[e]),ao=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),ko=()=>G(11),wo=e=>ke("CheckpointIds",se(e),2),ho=(e,t)=>ke("Checkpoint",se(t),3,[e]),Ro=(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])},fo=e=>fe(e,"goBackward"),vo=e=>fe(e,"goForward"),qo=(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])},Po=e=>{const t=se(e),[s,r]=wo(t);return[(d=s,!(0==q(d))),fo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},xo=e=>{const t=se(e),[,,[s]]=wo(t);return[!h(s),vo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>we("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Bo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,I]=le();return ue((()=>{const o=e?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},To=(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:Eo,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Oo,useState:jo}=e,Do=(e,...t)=>h(e)?{}:e(...t),Ho=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Qo,useContext:Wo,useMemo:zo,useState:Go}=e,Jo=({tableId:e,store:t,rowComponent:o=$o,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Yo(L(u,(d=>Fo(o,{...Do(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Ko=({queryId:e,queries:t,resultRowComponent:o=ls,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Yo(L(n,(r=>Fo(o,{...Do(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),No=({relationshipId:e,relationships:t,rowComponent:o=$o,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,I,i]=Ho(_(t),e),l=n(e,u,c);return Yo(L(l,(e=>Fo(o,{...Do(s,e),key:e,tableId:i,rowId:e,store:I,debugIds:d}))),r,d,u)},Uo=e=>({checkpoints:t,checkpointComponent:o=gs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return Yo(L(e(wo(n)),(e=>Fo(o,{...Do(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Xo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:I,checkpoints:i,checkpointsById:l,children:a})=>{const p=Wo(Q),[g,b]=Go({}),C=Qo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=Qo((e=>b((t=>({...A(t,e)})))),[]);return Fo(Q.Provider,{value:zo((()=>[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},i??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,I,i,l,p,C,m])},a)},Yo=(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},Zo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Yo(o+(Qe(e,t,s,r)??o),void 0,d,s),$o=({tableId:e,rowId:t,store:o,cellComponent:s=Zo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Yo(L(((e,t,o,s)=>{const r=De(t,o,s);return e??r})(d,e,t,o),(d=>Fo(s,{...Do(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),_o=e=>Jo(e,Ve(e.tableId,e.store)),es=({cellId:e,descending:t,offset:o,limit:s,...r})=>Jo(r,Ae(r.tableId,e,t,o,s,r.store)),ts=({store:e,tableComponent:t=_o,getTableComponentProps:o,separator:s,debugIds:r})=>Yo(L(Le(e),(s=>Fo(t,{...Do(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),os=({valueId:e,store:t,debugIds:s})=>Yo(o+(Ke(e,t)??o),void 0,s,e),ss=({store:e,valueComponent:t=os,getValueComponentProps:o,separator:s,debugIds:r})=>Yo(L(Ge(e),(s=>Fo(t,{...Do(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),rs=({metricId:e,metrics:t,debugIds:s})=>Yo(Ft(e,t)??o,void 0,s,e),ds=({indexId:e,sliceId:t,indexes:o,rowComponent:s=$o,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,I]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),i=Ht(e,t,u);return Yo(L(i,(e=>Fo(s,{...Do(r,e),key:e,tableId:I,rowId:e,store:c,debugIds:n}))),d,n,t)},ns=({indexId:e,indexes:t,sliceComponent:o=ds,getSliceComponentProps:s,separator:r,debugIds:d})=>Yo(L(jt(e,t),(r=>Fo(o,{...Do(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),us=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=$o,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Ho(_(o),e),I=Kt(e,t,n);return Yo(h(c)||h(I)?null:Fo(s,{...Do(r,I),key:I,tableId:c,rowId:I,store:u,debugIds:d}),void 0,d,t)},cs=e=>No(e,Nt,e.remoteRowId),Is=e=>No(e,Ut,e.firstRowId),is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Yo(o+(Io(e,t,s,r)??o),void 0,d,s),ls=({queryId:e,rowId:t,queries:o,resultCellComponent:s=is,getResultCellComponentProps:r,separator:d,debugIds:n})=>Yo(L(co(e,t,o),(d=>Fo(s,{...Do(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),as=e=>Ko(e,ro(e.queryId,e.queries)),ps=({cellId:e,descending:t,offset:o,limit:s,...r})=>Ko(r,no(r.queryId,e,t,o,s,r.queries)),gs=({checkpoints:e,checkpointId:t,debugIds:s})=>Yo(ho(t,e)??o,void 0,s,t),bs=Uo((e=>e[0])),Cs=Uo((e=>h(e[1])?[]:[e[1]])),ms=Uo((e=>e[2]));export{bs as BackwardCheckpointsView,Zo as CellView,gs as CheckpointView,Cs as CurrentCheckpointView,ms as ForwardCheckpointsView,ns as IndexView,Is as LinkedRowsView,cs as LocalRowsView,rs as MetricView,Xo as Provider,us as RemoteRowView,is as ResultCellView,ls as ResultRowView,ps as ResultSortedTableView,as as ResultTableView,$o as RowView,ds as SliceView,es as SortedTableView,_o as TableView,ts as TablesView,os as ValueView,ss as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,ko as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,yo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Tt as useCreateMetrics,Bo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,ve as useCreateStore,To as useCreateSynchronizer,dt as useDelCellCallback,rt as useDelRowCallback,st as useDelTableCallback,ot as useDelTablesCallback,ut as useDelValueCallback,nt as useDelValuesCallback,Bt as useDidFinishTransactionListener,fo as useGoBackwardCallback,vo as useGoForwardCallback,qo as useGoToCallback,He as useHasCell,ht as useHasCellListener,Oe as useHasRow,yt as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,lt as useHasTableListener,xe as useHasTables,ct as useHasTablesListener,Je as useHasValue,Pt as useHasValueListener,We as useHasValues,ft as useHasValuesListener,Dt as useIndexIds,Y as useIndexes,Ot as useIndexesIds,Z as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,U as useMetrics,Et as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,_t as useQueriesIds,te as useQueriesOrQueriesById,eo as useQueryIds,xo as useRedoInformation,Jt as useRelationshipIds,$ as useRelationships,Gt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,Io as useResultCell,co as useResultCellIds,Co as useResultCellIdsListener,mo as useResultCellListener,uo as useResultRow,so as useResultRowCount,ao as useResultRowCountListener,ro as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,no as useResultSortedRowIds,go as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,lo as useResultTableCellIdsListener,io as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,kt as useRowListener,$e as useSetCellCallback,Ro as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,jt as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Ae as useSortedRowIds,mt as useSortedRowIdsListener,St as useStartTransactionListener,J as useStore,Pe as useStoreIds,K as useStoreOrStoreById,Te as useTable,Ee as useTableCellIds,pt as useTableCellIdsListener,Le as useTableIds,it as useTableIdsListener,at as useTableListener,Se as useTables,It as useTablesListener,Po as useUndoInformation,Ke as useValue,Ge as useValueIds,qt as useValueIdsListener,xt as useValueListener,ze as useValues,vt as useValuesListener,Lt 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",l=i+"s",I=i+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=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:le,useState:Ie,useSyncExternalStore:ae}=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]=Ie(),[r,d]=Ie();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)},ke=(e,t,s,r=pe)=>{const d=le(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 ae(c,n)},we=(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=>ke(l,K(e),4,[]),Be=e=>ke(l,K(e),0),Te=e=>ke(I,K(e),1),Ee=(e,t)=>ke(i,K(t),4,[e]),Me=(e,t)=>ke(i,K(t),0,[e]),Fe=(e,t)=>ke(i+m,K(t),1,[e]),Ve=(e,t,o)=>ke(i+C,K(o),4,[e,t]),Ae=(e,t)=>ke(p,K(t),5,[e]),Oe=(e,t)=>ke(g,K(t),1,[e]),je=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),De=(e,t,o)=>ke(a,K(o),4,[e,t]),He=(e,t,o)=>ke(a,K(o),0,[e,t]),Qe=(e,t,o)=>ke(m,K(o),1,[e,t]),We=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),ze=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),Ge=e=>ke(k,K(e),4,[]),Je=e=>ke(k,K(e),0),Ke=e=>ke(w,K(e),1),Ne=(e,t)=>ke(y,K(t),4,[e]),Ue=(e,t)=>ke(y,K(t),3,[e]),Xe=(e,t,o,s,r)=>he(o,l,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,a,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,k,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,l,t,o),dt=(e,t,o,s)=>ve(t,i,o,s,e),nt=(e,t,o,s,r)=>ve(o,a,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,k,t,o),it=(e,t,o,s)=>ve(t,y,o,s,e),lt=(e,t,o,s)=>we(u+l,K(s),e,t,[],o),It=(e,t,o,s)=>we(l,K(s),e,t,pe,o),at=(e,t,o,s)=>we(I,K(s),e,t,pe,o),pt=(e,t,o,s,r)=>we(u+i,K(r),t,o,[e],s),gt=(e,t,o,s,r)=>we(i,K(r),t,o,[e],s),bt=(e,t,o,s,r)=>we(i+m,K(r),t,o,[e],s),Ct=(e,t,o,s,r,d)=>we(u+i+C,K(d),o,s,[e,t],r),mt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),yt=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),kt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),wt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),Rt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ft=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),vt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),qt=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),Pt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),xt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),St=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),Lt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),Bt=(e,t,o)=>we("Start"+de,K(o),e,t),Tt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Et=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Mt=(e,t,o)=>me(e,t,o),Ft=()=>G(3),Vt=e=>ke("MetricIds",X(e),1),At=(e,t)=>ke("Metric",X(t),3,[e]),Ot=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),jt=(e,t,o)=>me(e,t,o),Dt=()=>G(5),Ht=(e,t)=>ke("SliceIds",Z(t),1,[e]),Qt=e=>ke("IndexIds",Z(e),1),Wt=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),zt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Gt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),Jt=(e,t,o)=>me(e,t,o),Kt=()=>G(7),Nt=e=>ke("RelationshipIds",_(e),1),Ut=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Xt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Yt=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Zt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),$t=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),_t=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),eo=(e,t,o)=>me(e,t,o),to=()=>G(9),oo=e=>ke("QueryIds",te(e),1),so=(e,t)=>ke(n+i,te(t),0,[e]),ro=(e,t)=>ke(n+i+m,te(t),1,[e]),no=(e,t)=>ke(n+p,te(t),5,[e]),uo=(e,t)=>ke(n+g,te(t),1,[e]),co=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),io=(e,t,o)=>ke(n+a,te(o),0,[e,t]),lo=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),ao=(e,t,o,s)=>we(n+i,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+i+m,te(s),t,o,[e]),go=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),bo=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),Co=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),mo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),yo=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),ko=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),wo=(e,t,o)=>me(e,t,o),ho=()=>G(11),Ro=e=>ke("CheckpointIds",se(e),2),fo=(e,t)=>ke("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)=>we("CheckpointIds",se(o),e,t),To=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Eo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=Ie(),[c,i]=Ie();return ue((()=>{const o=e?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]=Ie();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,l]=Wo(_(t),e),I=n(e,u,c);return $o(L(I,(e=>Ao(o,{...Qo(s,e),key:e,tableId:l,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:l,checkpointsById:I,children:a})=>{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},l??p[10],{...p[11],...I},C,m]),[e,t,g,o,s,r,d,n,u,c,i,l,I,p,C,m])},a)},$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),l=Wt(e,t,u);return $o(L(l,(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)},ls=e=>Xo(e,Xt,e.remoteRowId),Is=e=>Xo(e,Yt,e.firstRowId),as=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>$o(o+(Io(e,t,s,r)??o),void 0,d,s),ps=({queryId:e,rowId:t,queries:o,resultCellComponent:s=as,getResultCellComponentProps:r,separator:d,debugIds:n})=>$o(L(lo(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]])),ks=Yo((e=>e[2]));export{ms as BackwardCheckpointsView,_o as CellView,Cs as CheckpointView,ys as CurrentCheckpointView,ks as ForwardCheckpointsView,cs as IndexView,Is as LinkedRowsView,ls as LocalRowsView,ns as MetricView,Zo as Provider,is as RemoteRowView,as 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,wo 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,wt as useHasRowListener,Ee as useHasTable,Ve as useHasTableCell,Ct as useHasTableCellListener,pt as useHasTableListener,Le as useHasTables,lt 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,Io as useResultCell,lo as useResultCellIds,yo as useResultCellIdsListener,ko 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,ao 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,kt 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,at as useTableIdsListener,gt as useTableListener,Be as useTables,It 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
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-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;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&#x27;s <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <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="&#x27;#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures. TinyBase provides 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 - or the 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 is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</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-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</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/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-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.0" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://tinybase.org/guides/releases/#v5-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">&quot;The One You Can Sync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;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&#x27;s <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <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="&#x27;#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures. TinyBase provides 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 - or the 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 is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</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-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</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/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-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.1" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  import {createStore} from 'tinybase';
@@ -292,4 +292,4 @@ export const createShop: typeof createShopDecl = () => {
292
292
  };
293
293
  ```
294
294
 
295
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</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&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </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.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.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.1kB</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,371</td><td>2,371</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,555</td><td>2,555</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,000</td><td>1,000</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>951</td><td>951</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,816</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,001</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>
295
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>12.7kB</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&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </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.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.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.0kB</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,370</td><td>2,370</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,554</td><td>2,554</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,000</td><td>1,000</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>947</td><td>947</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,817</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,018</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>
package/ui-react/index.js CHANGED
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
39
39
  arrayEvery(array1, (value1, index) => array2[index] === value1);
40
40
  const arrayMap = (array, cb) => array.map(cb);
41
41
  const arrayIsEmpty = (array) => size(array) == 0;
42
+ const arrayFilter = (array, cb) => array.filter(cb);
42
43
 
43
44
  const object = Object;
44
45
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -223,9 +224,7 @@ const useSetCallback = (
223
224
  ifNotUndefined(get(parameter, store2), (thing) =>
224
225
  then(
225
226
  store2['set' + settable](
226
- ...arrayMap(args, (arg) =>
227
- isFunction(arg) ? arg(parameter, store2) : arg,
228
- ),
227
+ ...argsOrGetArgs(args, store2, parameter),
229
228
  thing,
230
229
  ),
231
230
  thing,
@@ -233,9 +232,12 @@ const useSetCallback = (
233
232
  ),
234
233
  ),
235
234
  // eslint-disable-next-line react-hooks/exhaustive-deps
236
- [store, settable, ...getDeps, ...thenDeps, ...args],
235
+ [store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
237
236
  );
238
237
  };
238
+ const argsOrGetArgs = (args, store, parameter) =>
239
+ arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
240
+ const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
239
241
  const useDel = (
240
242
  storeOrStoreId,
241
243
  deletable,
@@ -245,9 +247,12 @@ const useDel = (
245
247
  ) => {
246
248
  const store = useStoreOrStoreById(storeOrStoreId);
247
249
  return useCallback$2(
248
- () => then(store?.['del' + deletable](...args)),
250
+ (parameter) =>
251
+ then(
252
+ store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
253
+ ),
249
254
  // eslint-disable-next-line react-hooks/exhaustive-deps
250
- [store, deletable, ...thenDeps, ...args],
255
+ [store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
251
256
  );
252
257
  };
253
258
  const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
39
39
  arrayEvery(array1, (value1, index) => array2[index] === value1);
40
40
  const arrayMap = (array, cb) => array.map(cb);
41
41
  const arrayIsEmpty = (array) => size(array) == 0;
42
+ const arrayFilter = (array, cb) => array.filter(cb);
42
43
 
43
44
  const object = Object;
44
45
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
@@ -223,9 +224,7 @@ const useSetCallback = (
223
224
  ifNotUndefined(get(parameter, store2), (thing) =>
224
225
  then(
225
226
  store2['set' + settable](
226
- ...arrayMap(args, (arg) =>
227
- isFunction(arg) ? arg(parameter, store2) : arg,
228
- ),
227
+ ...argsOrGetArgs(args, store2, parameter),
229
228
  thing,
230
229
  ),
231
230
  thing,
@@ -233,9 +232,12 @@ const useSetCallback = (
233
232
  ),
234
233
  ),
235
234
  // eslint-disable-next-line react-hooks/exhaustive-deps
236
- [store, settable, ...getDeps, ...thenDeps, ...args],
235
+ [store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
237
236
  );
238
237
  };
238
+ const argsOrGetArgs = (args, store, parameter) =>
239
+ arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
240
+ const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
239
241
  const useDel = (
240
242
  storeOrStoreId,
241
243
  deletable,
@@ -245,9 +247,12 @@ const useDel = (
245
247
  ) => {
246
248
  const store = useStoreOrStoreById(storeOrStoreId);
247
249
  return useCallback$2(
248
- () => then(store?.['del' + deletable](...args)),
250
+ (parameter) =>
251
+ then(
252
+ store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
253
+ ),
249
254
  // eslint-disable-next-line react-hooks/exhaustive-deps
250
- [store, deletable, ...thenDeps, ...args],
255
+ [store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
251
256
  );
252
257
  };
253
258
  const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {