tinybase 4.6.1 → 4.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/persisters/persister-automerge.cjs +1 -1
- package/lib/cjs/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/persisters/persister-automerge.js +5 -3
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +1 -3
- package/lib/debug/persisters/persister-electric-sql.js +1 -3
- package/lib/debug/persisters/persister-expo-sqlite-next.js +2 -4
- package/lib/debug/persisters/persister-expo-sqlite.js +1 -3
- package/lib/debug/persisters/persister-sqlite-wasm.js +1 -3
- package/lib/debug/persisters/persister-sqlite3.js +1 -3
- package/lib/debug/tools.js +9 -37
- package/lib/debug/ui-react.js +1 -1
- package/lib/es6/persisters/persister-automerge.js +1 -1
- package/lib/es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/persisters/persister-automerge.js +1 -1
- package/lib/persisters/persister-automerge.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/types/persisters/persister-automerge.d.ts +7 -7
- package/lib/types/persisters/persister-expo-sqlite-next.d.ts +3 -3
- package/lib/types/with-schemas/internal/queries.d.ts +4 -3
- package/lib/types/with-schemas/internal/store.d.ts +4 -3
- package/lib/types/with-schemas/persisters/persister-automerge.d.ts +7 -7
- package/lib/types/with-schemas/persisters/persister-expo-sqlite-next.d.ts +4 -4
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/persisters/persister-automerge.js +1 -1
- package/lib/umd/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-automerge.js +1 -1
- package/lib/umd-es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +23 -23
- package/readme.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,n;e=this,n=function(e,n){"use strict";const t=e=>typeof e,l="tinybase",o=",",i=t(""),r=(e,n)=>e.repeat(n),u=Promise,
|
|
1
|
+
var e,n;e=this,n=function(e,n){"use strict";const t=e=>typeof e,l="tinybase",o=",",i=t(""),r=(e,n)=>e.repeat(n),u=Promise,d=clearInterval,a=e=>null==e,s=(e,n,t)=>a(e)?null==t?void 0:t():n(e),c=e=>t(e)==i,v=(e,n,t)=>e.slice(n,t),y=e=>e.length,f=e=>{return n=function*(){return u.all(e)},new Promise(((e,t)=>{var l=e=>{try{i(n.next(e))}catch(e){t(e)}},o=e=>{try{i(n.throw(e))}catch(e){t(e)}},i=n=>n.done?e(n.value):Promise.resolve(n.value).then(l,o);i((n=n.apply(void 0,null)).next())}));var n},p="_",h="_id",E=e=>`"${e.replace(/"/g,'""')}"`,m="SELECT",T=(e,n="")=>e.join(n),x=(e,n)=>e.map(n),A=e=>0==y(e),O=(e,n)=>e.filter(n),P=(e,...n)=>e.push(...n),b=(e,n)=>{var t;return null!=(t=null==e?void 0:e.has(n))&&t},L=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},N=(e,n)=>null==e?void 0:e.delete(n),R=Object,w=e=>R.getPrototypeOf(e),g=R.keys,S=R.freeze,C=(e=[])=>R.fromEntries(e),D=(...e)=>R.assign({},...e),I=(e,n)=>x(R.entries(e),(([e,t])=>n(t,e))),F=e=>R.values(e),M=e=>y(g(e)),$=e=>(e=>!a(e)&&s(w(e),(e=>e==R.prototype||a(w(e))),(()=>!0)))(e)&&0==M(e),j=e=>new Map(e),_=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},B=(e,n)=>null==e?void 0:e.get(n),q=(e,n)=>{var t;return x([...null!=(t=null==e?void 0:e.entries())?t:[]],(([e,t])=>n(t,e)))},H=(e,n,t)=>a(t)?(N(e,n),e):null==e?void 0:e.set(n,t),W=(e,n,t)=>(b(e,n)||H(e,n,t()),B(e,n)),Y=(e,n,t,l=H)=>(I(n,((n,l)=>t(e,l,n))),((e,n)=>{((e,n)=>{null==e||e.forEach(n)})(e,((e,t)=>n(t)))})(e,(t=>((e,n)=>!a(((e,n)=>s(e,(e=>e[n])))(e,n)))(n,t)?0:l(e,t))),e),k=e=>new Set(Array.isArray(e)||a(e)?e:[e]),G=(e,n)=>null==e?void 0:e.add(n);var J=Object.defineProperty,U=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(e,n,t)=>n in e?J(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Q=(e,n)=>{for(var t in n||(n={}))z.call(n,t)&&V(e,t,n[t]);if(U)for(var t of U(n))K.call(n,t)&&V(e,t,n[t]);return e},X=(e,n,t)=>new Promise(((l,o)=>{var i=e=>{try{u(t.next(e))}catch(e){o(e)}},r=e=>{try{u(t.throw(e))}catch(e){o(e)}},u=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);u((t=t.apply(e,n)).next())}));const Z=m+"*FROM",ee="FROM pragma_table_",ne="WHERE",te=(e,n,t)=>{const l=j();return[()=>X(void 0,null,(function*(){return Y(l,C(yield f(x(yield e("SELECT name "+ee+"list WHERE schema='main'AND type='table'AND name IN("+oe(n)+")ORDER BY name",n),(n=>X(void 0,[n],(function*({name:n}){return[n,C(x(yield e(m+" name,type "+ee+"info(?)",[n]),(({name:e,type:n})=>[e,n])))]})))))),((e,n,t)=>H(l,n,Y(W(l,n,j),t,((e,n,t)=>{t!=B(e,n)&&H(e,n,t)}),((e,n)=>H(e,n))))),((e,n)=>H(l,n)))})),(n,t)=>X(void 0,null,(function*(){return((e,n)=>!a(B(B(l,e),n)))(n,t)?C(O(x(yield e(Z+E(n)),(e=>{return[e[t],(n=Q({},e),l=t,delete n[l],n)];var n,l})),(([e,n])=>!a(e)&&!$(n)))):{}})),(n,t,i,r,u,d=!1)=>X(void 0,null,(function*(){const s=k();I(null!=i?i:{},(e=>x(g(null!=e?e:{}),(e=>G(s,e)))));const c=L(s);if(!d&&u&&A(c)&&b(l,n))return yield e("DROP TABLE"+E(n)),void H(l,n);if(A(c)||b(l,n)){const o=B(l,n),i=k(_(o));yield f([...x(c,(t=>X(void 0,null,(function*(){N(i,t)||(yield e(`ALTER TABLE${E(n)}ADD${E(t)}`),H(o,t,""))})))),...!d&&r?x(L(i),(l=>X(void 0,null,(function*(){l!=t&&(yield e(`ALTER TABLE${E(n)}DROP${E(l)}`),H(o,l))})))):[]])}else yield e(`CREATE TABLE${E(n)}(${E(t)} PRIMARY KEY ON CONFLICT REPLACE${T(x(c,(e=>o+E(e))))});`),H(l,n,j([[t,""],...x(c,(e=>[e,""]))]));if(d)a(i)?yield e("DELETE FROM"+E(n)+"WHERE 1"):yield f(I(i,((l,o)=>X(void 0,null,(function*(){a(l)?yield e("DELETE FROM"+E(n)+ne+E(t)+"=?",[o]):A(c)||(yield le(e,n,t,g(l),[o,...F(l)]))})))));else if(A(c))b(l,n)&&(yield e("DELETE FROM"+E(n)+"WHERE 1"));else{const o=O(_(B(l,n)),(e=>e!=t)),r=[],u=[];I(null!=i?i:{},((e,n)=>{P(r,n,...x(o,(n=>null==e?void 0:e[n]))),P(u,n)})),yield le(e,n,t,o,r),yield e("DELETE FROM"+E(n)+ne+E(t)+"NOT IN("+oe(u)+")",u)}})),n=>X(void 0,null,(function*(){let l;yield e("BEGIN");try{l=yield n()}catch(e){null==t||t(e)}return yield e("END"),l}))]},le=(e,n,t,l,i)=>X(void 0,null,(function*(){return yield e("INSERT INTO"+E(n)+"("+E(t)+T(x(l,(e=>o+E(e))))+")VALUES"+v(r(`,(?${r(",?",y(l))})`,y(i)/(y(l)+1)),1)+"ON CONFLICT("+E(t)+")DO UPDATE SET"+T(x(l,(e=>E(e)+"=excluded."+E(e))),o),i)})),oe=e=>T(x(e,(()=>"?")),o),ie=JSON.parse;var re=(e,n,t)=>new Promise(((l,o)=>{var i=e=>{try{u(t.next(e))}catch(e){o(e)}},r=e=>{try{u(t.throw(e))}catch(e){o(e)}},u=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);u((t=t.apply(e,n)).next())}));const ue=j(),de=j(),ae=(e,n,t,l,o,i,[r,u]=[],d=[])=>{let c,v,y,f=0,p=0;W(ue,d,(()=>0)),W(de,d,(()=>[]));const h=e=>re(void 0,null,(function*(){return 2!=f&&(f=1,yield E.schedule((()=>re(void 0,null,(function*(){yield e(),f=0}))))),E})),E={load:(t,l)=>re(void 0,null,(function*(){return yield h((()=>re(void 0,null,(function*(){try{e.setContent(yield n())}catch(n){e.setContent([t,l])}}))))})),startAutoLoad:(...t)=>re(void 0,[...t],(function*(t={},o={}){return E.stopAutoLoad(),yield E.load(t,o),p=1,y=l(((t,l)=>re(void 0,null,(function*(){if(l){const n=l();yield h((()=>re(void 0,null,(function*(){return e.setTransactionChanges(n)}))))}else yield h((()=>re(void 0,null,(function*(){var l;try{e.setContent(null!=(l=null==t?void 0:t())?l:yield n())}catch(e){null==i||i(e)}}))))})))),E})),stopAutoLoad:()=>(p&&(o(y),y=void 0,p=0),E),save:n=>re(void 0,null,(function*(){return 1!=f&&(f=2,yield E.schedule((()=>re(void 0,null,(function*(){try{yield t(e.getContent,n)}catch(e){null==i||i(e)}f=0}))))),E})),startAutoSave:()=>re(void 0,null,(function*(){return yield E.stopAutoSave().save(),c=e.addDidFinishTransactionListener(((e,n)=>{const[t,l]=n();$(t)&&$(l)||E.save((()=>[t,l]))})),E})),stopAutoSave:()=>(s(c,e.delListener),c=void 0,E),schedule:(...e)=>re(void 0,null,(function*(){return P(B(de,d),...e),yield re(void 0,null,(function*(){if(!B(ue,d)){for(H(ue,d,1);!a((e=B(de,d),v=e.shift()));)try{yield v()}catch(e){null==i||i(e)}H(ue,d,0)}var e})),E})),getStore:()=>e,destroy:()=>E.stopAutoLoad().stopAutoSave(),getStats:()=>({})};return r&&(E[r]=()=>u),S(E)};var se=(e,n,t)=>new Promise(((l,o)=>{var i=e=>{try{u(t.next(e))}catch(e){o(e)}},r=e=>{try{u(t.throw(e))}catch(e){o(e)}},u=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);u((t=t.apply(e,n)).next())}));const ce="store",ve=(e,n,t,l,o,[i],r,u,d)=>{const[a,s,c,v]=te(n,r,o);return ae(e,(()=>se(void 0,null,(function*(){return yield v((()=>se(void 0,null,(function*(){var e,n;return yield a(),ie(null!=(n=null==(e=(yield s(i,h))[p])?void 0:e[ce])?n:"null")}))))}))),(e=>se(void 0,null,(function*(){return yield v((()=>se(void 0,null,(function*(){var n,t;yield a(),yield c(i,h,{[p]:{[ce]:(t=null!=(n=e())?n:null,JSON.stringify(t,((e,n)=>n instanceof Map?R.fromEntries([...n]):n)))}},!0,!0)}))))}))),t,l,o,[d,u],u)};var ye=(e,n,t)=>new Promise(((l,o)=>{var i=e=>{try{u(t.next(e))}catch(e){o(e)}},r=e=>{try{u(t.throw(e))}catch(e){o(e)}},u=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);u((t=t.apply(e,n)).next())}));const fe=(e,n,t,l,o,[i,r,[u,d,s]],c,v,y)=>{const[E,m,T,x]=te(n,c,o),A=(e,n)=>ye(void 0,null,(function*(){return yield f(q(r,((t,l)=>ye(void 0,[t,l],(function*([t,l,o,i],r){const u=e[r];n&&void 0===u||(yield T(t,l,u,o,i,n))})))))})),P=(e,n)=>ye(void 0,null,(function*(){return d?yield T(s,h,{[p]:e},!0,!0,n):null}));return ae(e,(()=>ye(void 0,null,(function*(){return yield x((()=>ye(void 0,null,(function*(){yield E();const e=yield ye(void 0,null,(function*(){return C(O(yield f(q(i,((e,n)=>ye(void 0,[e,n],(function*([e,n],t){return[e,yield m(t,n)]}))))),(e=>!$(e[1]))))})),n=yield ye(void 0,null,(function*(){return u?(yield m(s,h))[p]:{}}));return $(e)&&a(n)?void 0:[e,n]}))))}))),((e,n)=>ye(void 0,null,(function*(){return yield x((()=>ye(void 0,null,(function*(){if(yield E(),a(n)){const[n,t]=e();yield A(n),yield P(t)}else{const[e,t]=n();yield A(e,!0),yield P(t,!0)}}))))}))),t,l,o,[y,v],v)},pe="json",he="autoLoadIntervalSeconds",Ee="rowIdColumnName",me="tableId",Te="tableName",xe={mode:pe,[he]:1},Ae={load:0,save:0,[Te]:l+"_values"},Oe=(e,n,t,l)=>{const o=j();return I(e,((e,i)=>{const r=v(F(D(n,c(e)?{[t]:e}:e)),0,M(n));a(r[0])||l(i,r[0])||H(o,i,r)})),o};var Pe=(e,n,t)=>new Promise(((l,o)=>{var i=e=>{try{u(t.next(e))}catch(e){o(e)}},r=e=>{try{u(t.throw(e))}catch(e){o(e)}},u=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);u((t=t.apply(e,n)).next())}));const be="pragma ",Le="data_version",Ne="schema_version",Re=(e,n,t,o,i,r,u,a,s="getDb")=>{let y,f,p;const[E,T,x,A]=(e=>{const n=(e=>D(xe,c(e)?{storeTableName:e}:null!=e?e:{}))(e),t=n[he];if(n.mode==pe){const{storeTableName:e=l}=n;return[1,t,[e],k(e)]}const{tables:{load:o={},save:i={}}={},values:r={}}=n,u=v(F(D(Ae,r)),0,M(Ae)),d=u[2],a=k(d);return[0,t,[Oe(o,{[me]:null,[Ee]:h},me,(e=>G(a,e)&&e==d)),Oe(i,{[Te]:null,[Ee]:h,deleteEmptyColumns:0,deleteEmptyTable:0},Te,((e,n)=>G(a,n)&&n==d)),u],a]})(n);return(E?ve:fe)(e,r?(e,n)=>Pe(void 0,null,(function*(){return r(e,n),yield t(e,n)})):t,(e=>{return[(n=()=>Pe(void 0,null,(function*(){try{const n=(yield t(be+Le))[0][Le],l=(yield t(be+Ne))[0][Ne],o=(yield t(m+" TOTAL_CHANGES() c"))[0].c;n==(null!=y?y:y=n)&&l==(null!=f?f:f=l)&&o==(null!=p?p:p=o)||(e(),y=n,f=l)}catch(e){}})),l=T,n(),setInterval(n,1e3*l)),o((n=>A.has(n)?e():0))];var n,l}),(([e,n])=>{d(e),y=f=null,i(n)}),u,x,L(A),a,s)};e.createExpoSqliteNextPersister=(e,t,l,o,i)=>Re(e,l,((e,...n)=>{return l=[e,...n],o=function*(e,n=[]){return yield t.getAllAsync(e,n)},new Promise(((e,n)=>{var t=e=>{try{r(o.next(e))}catch(e){n(e)}},i=e=>{try{r(o.throw(e))}catch(e){n(e)}},r=n=>n.done?e(n.value):Promise.resolve(n.value).then(t,i);r((o=o.apply(void 0,l)).next())}));var l,o}),(e=>n.addDatabaseChangeListener((({tableName:n})=>e(n)))),(e=>e.remove()),o,i,t)},"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("expo-sqlite/next")):"function"==typeof define&&define.amd?define(["exports","expo-sqlite/next"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBasePersisterExpoSqliteNext={},e["expo-sqlite/next"]);
|
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="has",a="Ids",c="Table",I=c+"s",C=c+a,p="Row",b=p+"Count",w=p+a,R="Sorted"+p+a,k="Cell",v=k+a,g="Value",h=g+"s",y=g+a,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,T=e=>t(e)==r,V=()=>{},S=(e,s)=>e.map(s),P=Object.keys,x=(e,s)=>L(e,(e=>e[s])),{createContext:O,useContext:q,useEffect:B}=s,H=O([]),M=(e,s)=>{var t;const l=q(H);return m(e)?l[s]:f(e)?x(null!=(t=l[s+1])?t:{},e):e},D=(e,s)=>{const t=M(e,s);return m(e)||f(e)?t:e},j=e=>{var s;return P(null!=(s=q(H)[e])?s:{})},F=e=>D(e,0),Q=e=>D(e,2),E=e=>D(e,4),A=e=>D(e,6),G=e=>D(e,8),U=e=>D(e,10),W=e=>e.toLowerCase();W(u);const z="Transaction";W(z);const{useCallback:J,useEffect:K,useMemo:N,useLayoutEffect:X,useRef:Y,useState:Z}=s,$=[],_={},ee=[[],void 0,[]],se=(e,s,t=$)=>{const l=N((()=>s(e)),[e,...t]);return K((()=>()=>l.destroy()),[l]),l},te=(e,s,t,l=$,o,r="get",u="")=>{const[,n]=Z(),d=J((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[r+e])?void 0:o.call(s,...l))?u:t}),[s,e,...l,t]),i=Y();return N((()=>i.current=d()),[d]),le(u+e,s,((...e)=>{i.current=m(o)?d():e[o],n([])}),[d,o],l),i.current},le=(e,s,t,l=$,o=$,...r)=>X((()=>{var l;const n=null==(l=null==s?void 0:s["add"+e+u])?void 0:l.call(s,...o,t,...r);return()=>null==s?void 0:s.delListener(n)}),[s,e,...o,...l,...r]),oe=(e,s,t,l=$,o=V,r=$,...u)=>{const n=F(e);return J((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...S(u,(s=>T(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},re=(e,s,t=V,l=$,...o)=>{const r=F(e);return J((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},ue=(e,s,t)=>{const l=U(e);return J((()=>null==l?void 0:l[s](t)),[l,s,t])},ne=e=>te(C,F(e),$),de=(e,s)=>te(w,F(s),$,[e]),ie=(e,s,t,l=0,o,r)=>te(R,F(r),$,[e,s,t,l,o],6),ae=(e,s,t)=>te(v,F(t),$,[e,s]),ce=(e,s,t,l)=>te(k,F(l),void 0,[e,s,t],4),Ie=e=>te(y,F(e),$),Ce=(e,s)=>te(g,F(s),void 0,[e]),pe=(e,s)=>te("Metric",Q(s),void 0,[e]),be=(e,s)=>te("SliceIds",E(s),$,[e]),we=(e,s,t)=>te("Slice"+w,E(t),$,[e,s]),Re=(e,s,t)=>te("RemoteRowId",A(t),void 0,[e,s]),ke=(e,s,t)=>te("Local"+w,A(t),$,[e,s]),ve=(e,s,t)=>te("Linked"+w,A(t),$,[e,s]),ge=(e,s)=>te(n+w,G(s),$,[e]),he=(e,s,t,l=0,o,r)=>te(n+R,G(r),$,[e,s,t,l,o],6),ye=(e,s,t)=>te(n+v,G(t),$,[e,s]),me=(e,s,t,l)=>te(n+k,G(l),void 0,[e,s,t]),Le=e=>te("CheckpointIds",U(e),ee),fe=(e,s)=>te("Checkpoint",U(s),void 0,[e]),Te=e=>ue(e,"goBackward"),Ve=e=>ue(e,"goForward"),{PureComponent:Se,Fragment:Pe,createElement:xe,useCallback:Oe,useLayoutEffect:qe,useRef:Be,useState:He}=s,Me=(e,...s)=>m(e)?{}:e(...s),De=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var je=Object.defineProperty,Fe=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ue=(e,s,t)=>s in e?je(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,We=(e,s)=>{for(var t in s||(s={}))Ae.call(s,t)&&Ue(e,t,s[t]);if(Ee)for(var t of Ee(s))Ge.call(s,t)&&Ue(e,t,s[t]);return e},ze=(e,s)=>Fe(e,Qe(s)),Je=(e,s)=>{var t={};for(var l in e)Ae.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ee)for(var l of Ee(e))s.indexOf(l)<0&&Ge.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:Ke,useContext:Ne,useMemo:Xe,useState:Ye}=s,Ze=({tableId:e,store:s,rowComponent:t=ls,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>ss(S(n,(r=>xe(t,ze(We({},Me(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),$e=({queryId:e,queries:s,resultRowComponent:t=ds,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>ss(S(u,(o=>xe(t,ze(We({},Me(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),_e=({relationshipId:e,relationships:s,rowComponent:t=ls,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=De(A(s),e),c=u(e,n,d);return ss(S(c,(e=>xe(t,ze(We({},Me(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},es=e=>({checkpoints:s,checkpointComponent:t=is,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=U(s);return ss(S(e(Le(u)),(e=>xe(t,ze(We({},Me(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},ss=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},ts=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return ss(l+(null!=(u=ce(e,s,t,o))?u:l),void 0,r,t)},ls=({tableId:e,rowId:s,store:t,cellComponent:l=ts,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>ss(S(((e,s,t,l)=>{const o=ae(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),os=e=>Ze(e,de(e.tableId,e.store)),rs=({valueId:e,store:s,debugIds:t})=>{var o;return ss(l+(null!=(o=Ce(e,s))?o:l),void 0,t,e)},us=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ls,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(E(t),e),a=we(e,s,n);return ss(S(a,(e=>xe(l,ze(We({},Me(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ns=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return ss(l+(null!=(u=me(e,s,t,o))?u:l),void 0,r,t)},ds=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ns,getResultCellComponentProps:o,separator:r,debugIds:u})=>ss(S(ye(e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),is=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return ss(null!=(o=fe(s,e))?o:l,void 0,t,s)},as=es((e=>e[0])),cs=es((e=>m(e[1])?[]:[e[1]])),Is=es((e=>e[2]));e.BackwardCheckpointsView=as,e.CellView=ts,e.CheckpointView=is,e.CurrentCheckpointView=cs,e.ForwardCheckpointsView=Is,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=us,getSliceComponentProps:l,separator:o,debugIds:r})=>ss(S(be(e,s),(o=>xe(t,ze(We({},Me(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>_e(e,ve,e.firstRowId),e.LocalRowsView=e=>_e(e,ke,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return ss(null!=(o=pe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Ne(H),[p,b]=Ye({}),w=Ke(((e,s)=>b((t=>x(t,e)==s?t:ze(We({},t),{[e]:s})))),[]),R=Ke((e=>b((s=>We({},((e,s)=>(delete e[s],e))(s,e))))),[]);return xe(H.Provider,{value:Xe((()=>[null!=e?e:C[0],We(We(We({},C[1]),s),p),null!=t?t:C[2],We(We({},C[3]),l),null!=o?o:C[4],We(We({},C[5]),r),null!=u?u:C[6],We(We({},C[7]),n),null!=d?d:C[8],We(We({},C[9]),i),null!=a?a:C[10],We(We({},C[11]),c),w,R]),[e,s,p,t,l,o,r,u,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ls,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=De(A(t),e),i=Re(e,s,u);return ss(m(d)||m(i)?null:xe(l,ze(We({},Me(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ns,e.ResultRowView=ds,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return $e(u,he(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>$e(e,ge(e.queryId,e.queries)),e.RowView=ls,e.SliceView=us,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return Ze(u,ie(u.tableId,t,l,o,r,u.store))},e.TableView=os,e.TablesView=({store:e,tableComponent:s=os,getTableComponentProps:t,separator:l,debugIds:o})=>ss(S(ne(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=rs,e.ValuesView=({store:e,valueComponent:s=rs,getValueComponentProps:t,separator:l,debugIds:o})=>ss(S(Ie(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=$,l,o=V,r=$,u=!0)=>{const n=F(l);return J((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(T(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=ce,e.useCellIds=ae,e.useCellIdsListener=(e,s,t,l,o,r)=>le(v,F(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>le(k,F(u),l,o,[e,s,t],r),e.useCheckpoint=fe,e.useCheckpointIds=Le,e.useCheckpointIdsListener=(e,s,t)=>le("CheckpointIds",U(t),e,s),e.useCheckpointListener=(e,s,t,l)=>le("Checkpoint",U(l),s,t,[e]),e.useCheckpoints=e=>M(e,10),e.useCheckpointsIds=()=>j(11),e.useCheckpointsOrCheckpointsById=U,e.useCreateCheckpoints=(e,s,t)=>se(e,s,t),e.useCreateIndexes=(e,s,t)=>se(e,s,t),e.useCreateMetrics=(e,s,t)=>se(e,s,t),e.useCreatePersister=(e,s,t=$,l,o=$,r,u=$)=>{const[,n]=Z(),d=N((()=>s(e)),[e,...t]);return K((()=>{var e;return e=function*(){l&&(yield l(d),n([]))},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...o,...u]),d},e.useCreateQueries=(e,s,t)=>se(e,s,t),e.useCreateRelationships=(e,s,t)=>se(e,s,t),e.useCreateStore=(e,s=$)=>N(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>re(o,k,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>re(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>re(s,c,t,l,e),e.useDelTablesCallback=(e,s,t)=>re(e,I,s,t),e.useDelValueCallback=(e,s,t,l)=>re(s,g,t,l,e),e.useDelValuesCallback=(e,s,t)=>re(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>le("DidFinish"+z,F(t),e,s),e.useGoBackwardCallback=Te,e.useGoForwardCallback=Ve,e.useGoToCallback=(e,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>te(k,F(l),!1,[e,s,t],4,i,d),e.useHasCellListener=(e,s,t,l,o,r,u)=>le(d+k,F(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>te(p,F(t),!1,[e,s],3,i,d),e.useHasRowListener=(e,s,t,l,o,r)=>le(d+p,F(r),t,l,[e,s],o),e.useHasTable=(e,s)=>te(c,F(s),!1,[e],2,i,d),e.useHasTableCell=(e,s,t)=>te(c+k,F(t),!1,[e,s],3,i,d),e.useHasTableCellListener=(e,s,t,l,o,r)=>le(d+c+k,F(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>le(d+c,F(o),s,t,[e],l),e.useHasTables=e=>te(I,F(e),!1,[],1,i,d),e.useHasTablesListener=(e,s,t,l)=>le(d+I,F(l),e,s,[],t),e.useHasValue=(e,s)=>te(g,F(s),!1,[e],2,i,d),e.useHasValueListener=(e,s,t,l,o)=>le(d+g,F(o),s,t,[e],l),e.useHasValues=e=>te(h,F(e),!1,[],1,i,d),e.useHasValuesListener=(e,s,t,l)=>le(d+h,F(l),e,s,[],t),e.useIndexIds=e=>te("IndexIds",E(e),$),e.useIndexes=e=>M(e,4),e.useIndexesIds=()=>j(5),e.useIndexesOrIndexesById=E,e.useLinkedRowIds=ve,e.useLinkedRowIdsListener=(e,s,t,l,o)=>le("Linked"+w,A(o),t,l,[e,s]),e.useLocalRowIds=ke,e.useLocalRowIdsListener=(e,s,t,l,o)=>le("Local"+w,A(o),t,l,[e,s]),e.useMetric=pe,e.useMetricIds=e=>te("MetricIds",Q(e),$),e.useMetricListener=(e,s,t,l)=>le("Metric",Q(l),s,t,[e]),e.useMetrics=e=>M(e,2),e.useMetricsIds=()=>j(3),e.useMetricsOrMetricsById=Q,e.useProvideStore=(e,s)=>{const{12:t,13:l}=q(H);B((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>M(e,8),e.useQueriesIds=()=>j(9),e.useQueriesOrQueriesById=G,e.useQueryIds=e=>te("QueryIds",G(e),$),e.useRedoInformation=e=>{var s;const t=U(e),[,,[o]]=Le(t);return[!m(o),Ve(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>te("RelationshipIds",A(e),$),e.useRelationships=e=>M(e,6),e.useRelationshipsIds=()=>j(7),e.useRelationshipsOrRelationshipsById=A,e.useRemoteRowId=Re,e.useRemoteRowIdListener=(e,s,t,l,o)=>le("RemoteRowId",A(o),t,l,[e,s]),e.useResultCell=me,e.useResultCellIds=ye,e.useResultCellIdsListener=(e,s,t,l,o)=>le(n+v,G(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>le(n+k,G(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>te(n+p,G(t),_,[e,s]),e.useResultRowCount=(e,s)=>te(n+b,G(s),0,[e]),e.useResultRowCountListener=(e,s,t,l)=>le(n+b,G(l),s,t,[e]),e.useResultRowIds=ge,e.useResultRowIdsListener=(e,s,t,l)=>le(n+w,G(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>le(n+p,G(o),t,l,[e,s]),e.useResultSortedRowIds=he,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>le(n+R,G(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>te(n+c,G(s),_,[e]),e.useResultTableCellIds=(e,s)=>te(n+c+v,G(s),$,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>le(n+c+v,G(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>le(n+c,G(l),s,t,[e]),e.useRow=(e,s,t)=>te(p,F(t),_,[e,s]),e.useRowCount=(e,s)=>te(b,F(s),0,[e]),e.useRowCountListener=(e,s,t,l,o)=>le(b,F(o),s,t,[e],l),e.useRowIds=de,e.useRowIdsListener=(e,s,t,l,o)=>le(w,F(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>le(p,F(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>oe(r,k,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>oe(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>oe(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>oe(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>oe(l,c,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>oe(t,I,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>oe(l,g,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>oe(t,h,e,s,l,o),e.useSliceIds=be,e.useSliceIdsListener=(e,s,t,l)=>le("SliceIds",E(l),s,t,[e]),e.useSliceRowIds=we,e.useSliceRowIdsListener=(e,s,t,l,o)=>le("Slice"+w,E(o),t,l,[e,s]),e.useSortedRowIds=ie,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>le(R,F(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>le("Start"+z,F(t),e,s),e.useStore=e=>M(e,0),e.useStoreIds=()=>j(1),e.useStoreOrStoreById=F,e.useTable=(e,s)=>te(c,F(s),_,[e]),e.useTableCellIds=(e,s)=>te(c+v,F(s),$,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>le(c+v,F(o),s,t,[e],l),e.useTableIds=ne,e.useTableIdsListener=(e,s,t,l)=>le(C,F(l),e,s,$,t),e.useTableListener=(e,s,t,l,o)=>le(c,F(o),s,t,[e],l),e.useTables=e=>te(I,F(e),_),e.useTablesListener=(e,s,t,l)=>le(I,F(l),e,s,$,t),e.useUndoInformation=e=>{var s;const t=U(e),[o,r]=Le(t);return[(u=o,!(0==u.length)),Te(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Ce,e.useValueIds=Ie,e.useValueIdsListener=(e,s,t,l)=>le(y,F(l),e,s,$,t),e.useValueListener=(e,s,t,l,o)=>le(g,F(o),s,t,[e],l),e.useValues=e=>te(h,F(e),_),e.useValuesListener=(e,s,t,l)=>le(h,F(l),e,s,$,t),e.useWillFinishTransactionListener=(e,s,t)=>le("WillFinish"+z,F(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="has",a="Ids",c="Table",I=c+"s",C=c+a,p="Row",b=p+"Count",w=p+a,R="Sorted"+p+a,k="Cell",v=k+a,g="Value",h=g+"s",y=g+a,m=e=>null==e,L=(e,s,t)=>m(e)?null==t?void 0:t():s(e),f=e=>t(e)==o,T=e=>t(e)==r,V=()=>{},S=(e,s)=>e.map(s),P=Object.keys,x=(e,s)=>L(e,(e=>e[s])),{createContext:O,useContext:q,useEffect:B}=s,H=O([]),M=(e,s)=>{var t;const l=q(H);return m(e)?l[s]:f(e)?x(null!=(t=l[s+1])?t:{},e):e},D=(e,s)=>{const t=M(e,s);return m(e)||f(e)?t:e},j=e=>{var s;return P(null!=(s=q(H)[e])?s:{})},F=e=>D(e,0),Q=e=>D(e,2),E=e=>D(e,4),A=e=>D(e,6),G=e=>D(e,8),U=e=>D(e,10),W=e=>e.toLowerCase();W(u);const z="Transaction";W(z);const{useCallback:J,useEffect:K,useMemo:N,useLayoutEffect:X,useRef:Y,useState:Z}=s,$=[],_={},ee=[[],void 0,[]],se=(e,s,t=$)=>{const l=N((()=>s(e)),[e,...t]);return K((()=>()=>l.destroy()),[l]),l},te=(e,s,t,l=$,o,r="get",u="")=>{const[,n]=Z(),d=J((()=>{var o,u;return null!=(u=null==(o=null==s?void 0:s[r+e])?void 0:o.call(s,...l))?u:t}),[s,r,e,...l,t]),i=Y();return N((()=>i.current=d()),[d]),le(u+e,s,((...e)=>{i.current=m(o)?d():e[o],n([])}),[d,o],l),i.current},le=(e,s,t,l=$,o=$,...r)=>X((()=>{var l;const n=null==(l=null==s?void 0:s["add"+e+u])?void 0:l.call(s,...o,t,...r);return()=>null==s?void 0:s.delListener(n)}),[s,e,...o,...l,...r]),oe=(e,s,t,l=$,o=V,r=$,...u)=>{const n=F(e);return J((e=>L(n,(l=>L(t(e,l),(t=>o(l["set"+s](...S(u,(s=>T(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},re=(e,s,t=V,l=$,...o)=>{const r=F(e);return J((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},ue=(e,s,t)=>{const l=U(e);return J((()=>null==l?void 0:l[s](t)),[l,s,t])},ne=e=>te(C,F(e),$),de=(e,s)=>te(w,F(s),$,[e]),ie=(e,s,t,l=0,o,r)=>te(R,F(r),$,[e,s,t,l,o],6),ae=(e,s,t)=>te(v,F(t),$,[e,s]),ce=(e,s,t,l)=>te(k,F(l),void 0,[e,s,t],4),Ie=e=>te(y,F(e),$),Ce=(e,s)=>te(g,F(s),void 0,[e]),pe=(e,s)=>te("Metric",Q(s),void 0,[e]),be=(e,s)=>te("SliceIds",E(s),$,[e]),we=(e,s,t)=>te("Slice"+w,E(t),$,[e,s]),Re=(e,s,t)=>te("RemoteRowId",A(t),void 0,[e,s]),ke=(e,s,t)=>te("Local"+w,A(t),$,[e,s]),ve=(e,s,t)=>te("Linked"+w,A(t),$,[e,s]),ge=(e,s)=>te(n+w,G(s),$,[e]),he=(e,s,t,l=0,o,r)=>te(n+R,G(r),$,[e,s,t,l,o],6),ye=(e,s,t)=>te(n+v,G(t),$,[e,s]),me=(e,s,t,l)=>te(n+k,G(l),void 0,[e,s,t]),Le=e=>te("CheckpointIds",U(e),ee),fe=(e,s)=>te("Checkpoint",U(s),void 0,[e]),Te=e=>ue(e,"goBackward"),Ve=e=>ue(e,"goForward"),{PureComponent:Se,Fragment:Pe,createElement:xe,useCallback:Oe,useLayoutEffect:qe,useRef:Be,useState:He}=s,Me=(e,...s)=>m(e)?{}:e(...s),De=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var je=Object.defineProperty,Fe=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ue=(e,s,t)=>s in e?je(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,We=(e,s)=>{for(var t in s||(s={}))Ae.call(s,t)&&Ue(e,t,s[t]);if(Ee)for(var t of Ee(s))Ge.call(s,t)&&Ue(e,t,s[t]);return e},ze=(e,s)=>Fe(e,Qe(s)),Je=(e,s)=>{var t={};for(var l in e)Ae.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ee)for(var l of Ee(e))s.indexOf(l)<0&&Ge.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:Ke,useContext:Ne,useMemo:Xe,useState:Ye}=s,Ze=({tableId:e,store:s,rowComponent:t=ls,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>ss(S(n,(r=>xe(t,ze(We({},Me(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),$e=({queryId:e,queries:s,resultRowComponent:t=ds,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>ss(S(u,(o=>xe(t,ze(We({},Me(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),_e=({relationshipId:e,relationships:s,rowComponent:t=ls,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=De(A(s),e),c=u(e,n,d);return ss(S(c,(e=>xe(t,ze(We({},Me(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},es=e=>({checkpoints:s,checkpointComponent:t=is,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=U(s);return ss(S(e(Le(u)),(e=>xe(t,ze(We({},Me(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},ss=(e,s,t,l)=>{const o=m(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},ts=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return ss(l+(null!=(u=ce(e,s,t,o))?u:l),void 0,r,t)},ls=({tableId:e,rowId:s,store:t,cellComponent:l=ts,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>ss(S(((e,s,t,l)=>{const o=ae(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),os=e=>Ze(e,de(e.tableId,e.store)),rs=({valueId:e,store:s,debugIds:t})=>{var o;return ss(l+(null!=(o=Ce(e,s))?o:l),void 0,t,e)},us=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ls,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(E(t),e),a=we(e,s,n);return ss(S(a,(e=>xe(l,ze(We({},Me(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ns=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return ss(l+(null!=(u=me(e,s,t,o))?u:l),void 0,r,t)},ds=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ns,getResultCellComponentProps:o,separator:r,debugIds:u})=>ss(S(ye(e,s,t),(r=>xe(l,ze(We({},Me(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),is=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return ss(null!=(o=fe(s,e))?o:l,void 0,t,s)},as=es((e=>e[0])),cs=es((e=>m(e[1])?[]:[e[1]])),Is=es((e=>e[2]));e.BackwardCheckpointsView=as,e.CellView=ts,e.CheckpointView=is,e.CurrentCheckpointView=cs,e.ForwardCheckpointsView=Is,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=us,getSliceComponentProps:l,separator:o,debugIds:r})=>ss(S(be(e,s),(o=>xe(t,ze(We({},Me(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>_e(e,ve,e.firstRowId),e.LocalRowsView=e=>_e(e,ke,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return ss(null!=(o=pe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const C=Ne(H),[p,b]=Ye({}),w=Ke(((e,s)=>b((t=>x(t,e)==s?t:ze(We({},t),{[e]:s})))),[]),R=Ke((e=>b((s=>We({},((e,s)=>(delete e[s],e))(s,e))))),[]);return xe(H.Provider,{value:Xe((()=>[null!=e?e:C[0],We(We(We({},C[1]),s),p),null!=t?t:C[2],We(We({},C[3]),l),null!=o?o:C[4],We(We({},C[5]),r),null!=u?u:C[6],We(We({},C[7]),n),null!=d?d:C[8],We(We({},C[9]),i),null!=a?a:C[10],We(We({},C[11]),c),w,R]),[e,s,p,t,l,o,r,u,n,d,i,a,c,C,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ls,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=De(A(t),e),i=Re(e,s,u);return ss(m(d)||m(i)?null:xe(l,ze(We({},Me(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ns,e.ResultRowView=ds,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return $e(u,he(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>$e(e,ge(e.queryId,e.queries)),e.RowView=ls,e.SliceView=us,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=Je(s,["cellId","descending","offset","limit"]);return Ze(u,ie(u.tableId,t,l,o,r,u.store))},e.TableView=os,e.TablesView=({store:e,tableComponent:s=os,getTableComponentProps:t,separator:l,debugIds:o})=>ss(S(ne(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=rs,e.ValuesView=({store:e,valueComponent:s=rs,getValueComponentProps:t,separator:l,debugIds:o})=>ss(S(Ie(e),(l=>xe(s,ze(We({},Me(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=$,l,o=V,r=$,u=!0)=>{const n=F(l);return J((t=>L(n,(l=>L(s(t,l),(s=>o(l.addRow(T(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=ce,e.useCellIds=ae,e.useCellIdsListener=(e,s,t,l,o,r)=>le(v,F(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>le(k,F(u),l,o,[e,s,t],r),e.useCheckpoint=fe,e.useCheckpointIds=Le,e.useCheckpointIdsListener=(e,s,t)=>le("CheckpointIds",U(t),e,s),e.useCheckpointListener=(e,s,t,l)=>le("Checkpoint",U(l),s,t,[e]),e.useCheckpoints=e=>M(e,10),e.useCheckpointsIds=()=>j(11),e.useCheckpointsOrCheckpointsById=U,e.useCreateCheckpoints=(e,s,t)=>se(e,s,t),e.useCreateIndexes=(e,s,t)=>se(e,s,t),e.useCreateMetrics=(e,s,t)=>se(e,s,t),e.useCreatePersister=(e,s,t=$,l,o=$,r,u=$)=>{const[,n]=Z(),d=N((()=>s(e)),[e,...t]);return K((()=>{var e;return e=function*(){l&&(yield l(d),n([]))},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...o,...u]),d},e.useCreateQueries=(e,s,t)=>se(e,s,t),e.useCreateRelationships=(e,s,t)=>se(e,s,t),e.useCreateStore=(e,s=$)=>N(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>re(o,k,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>re(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>re(s,c,t,l,e),e.useDelTablesCallback=(e,s,t)=>re(e,I,s,t),e.useDelValueCallback=(e,s,t,l)=>re(s,g,t,l,e),e.useDelValuesCallback=(e,s,t)=>re(e,h,s,t),e.useDidFinishTransactionListener=(e,s,t)=>le("DidFinish"+z,F(t),e,s),e.useGoBackwardCallback=Te,e.useGoForwardCallback=Ve,e.useGoToCallback=(e,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>L(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>te(k,F(l),!1,[e,s,t],4,i,d),e.useHasCellListener=(e,s,t,l,o,r,u)=>le(d+k,F(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>te(p,F(t),!1,[e,s],3,i,d),e.useHasRowListener=(e,s,t,l,o,r)=>le(d+p,F(r),t,l,[e,s],o),e.useHasTable=(e,s)=>te(c,F(s),!1,[e],2,i,d),e.useHasTableCell=(e,s,t)=>te(c+k,F(t),!1,[e,s],3,i,d),e.useHasTableCellListener=(e,s,t,l,o,r)=>le(d+c+k,F(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>le(d+c,F(o),s,t,[e],l),e.useHasTables=e=>te(I,F(e),!1,[],1,i,d),e.useHasTablesListener=(e,s,t,l)=>le(d+I,F(l),e,s,[],t),e.useHasValue=(e,s)=>te(g,F(s),!1,[e],2,i,d),e.useHasValueListener=(e,s,t,l,o)=>le(d+g,F(o),s,t,[e],l),e.useHasValues=e=>te(h,F(e),!1,[],1,i,d),e.useHasValuesListener=(e,s,t,l)=>le(d+h,F(l),e,s,[],t),e.useIndexIds=e=>te("IndexIds",E(e),$),e.useIndexes=e=>M(e,4),e.useIndexesIds=()=>j(5),e.useIndexesOrIndexesById=E,e.useLinkedRowIds=ve,e.useLinkedRowIdsListener=(e,s,t,l,o)=>le("Linked"+w,A(o),t,l,[e,s]),e.useLocalRowIds=ke,e.useLocalRowIdsListener=(e,s,t,l,o)=>le("Local"+w,A(o),t,l,[e,s]),e.useMetric=pe,e.useMetricIds=e=>te("MetricIds",Q(e),$),e.useMetricListener=(e,s,t,l)=>le("Metric",Q(l),s,t,[e]),e.useMetrics=e=>M(e,2),e.useMetricsIds=()=>j(3),e.useMetricsOrMetricsById=Q,e.useProvideStore=(e,s)=>{const{12:t,13:l}=q(H);B((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>M(e,8),e.useQueriesIds=()=>j(9),e.useQueriesOrQueriesById=G,e.useQueryIds=e=>te("QueryIds",G(e),$),e.useRedoInformation=e=>{var s;const t=U(e),[,,[o]]=Le(t);return[!m(o),Ve(t),o,null!=(s=L(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>te("RelationshipIds",A(e),$),e.useRelationships=e=>M(e,6),e.useRelationshipsIds=()=>j(7),e.useRelationshipsOrRelationshipsById=A,e.useRemoteRowId=Re,e.useRemoteRowIdListener=(e,s,t,l,o)=>le("RemoteRowId",A(o),t,l,[e,s]),e.useResultCell=me,e.useResultCellIds=ye,e.useResultCellIdsListener=(e,s,t,l,o)=>le(n+v,G(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>le(n+k,G(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>te(n+p,G(t),_,[e,s]),e.useResultRowCount=(e,s)=>te(n+b,G(s),0,[e]),e.useResultRowCountListener=(e,s,t,l)=>le(n+b,G(l),s,t,[e]),e.useResultRowIds=ge,e.useResultRowIdsListener=(e,s,t,l)=>le(n+w,G(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>le(n+p,G(o),t,l,[e,s]),e.useResultSortedRowIds=he,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>le(n+R,G(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>te(n+c,G(s),_,[e]),e.useResultTableCellIds=(e,s)=>te(n+c+v,G(s),$,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>le(n+c+v,G(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>le(n+c,G(l),s,t,[e]),e.useRow=(e,s,t)=>te(p,F(t),_,[e,s]),e.useRowCount=(e,s)=>te(b,F(s),0,[e]),e.useRowCountListener=(e,s,t,l,o)=>le(b,F(o),s,t,[e],l),e.useRowIds=de,e.useRowIdsListener=(e,s,t,l,o)=>le(w,F(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>le(p,F(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>oe(r,k,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=V,s=$,t,l=V,o=$)=>{const r=U(t);return J((s=>L(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>oe(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>oe(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>oe(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>oe(l,c,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>oe(t,I,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>oe(l,g,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>oe(t,h,e,s,l,o),e.useSliceIds=be,e.useSliceIdsListener=(e,s,t,l)=>le("SliceIds",E(l),s,t,[e]),e.useSliceRowIds=we,e.useSliceRowIdsListener=(e,s,t,l,o)=>le("Slice"+w,E(o),t,l,[e,s]),e.useSortedRowIds=ie,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>le(R,F(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>le("Start"+z,F(t),e,s),e.useStore=e=>M(e,0),e.useStoreIds=()=>j(1),e.useStoreOrStoreById=F,e.useTable=(e,s)=>te(c,F(s),_,[e]),e.useTableCellIds=(e,s)=>te(c+v,F(s),$,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>le(c+v,F(o),s,t,[e],l),e.useTableIds=ne,e.useTableIdsListener=(e,s,t,l)=>le(C,F(l),e,s,$,t),e.useTableListener=(e,s,t,l,o)=>le(c,F(o),s,t,[e],l),e.useTables=e=>te(I,F(e),_),e.useTablesListener=(e,s,t,l)=>le(I,F(l),e,s,$,t),e.useUndoInformation=e=>{var s;const t=U(e),[o,r]=Le(t);return[(u=o,!(0==u.length)),Te(t),r,null!=(s=L(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Ce,e.useValueIds=Ie,e.useValueIdsListener=(e,s,t,l)=>le(y,F(l),e,s,$,t),e.useValueListener=(e,s,t,l,o)=>le(g,F(o),s,t,[e],l),e.useValues=e=>te(h,F(e),_),e.useValuesListener=(e,s,t,l)=>le(h,F(l),e,s,$,t),e.useWillFinishTransactionListener=(e,s,t)=>le("WillFinish"+z,F(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.3",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -215,6 +215,7 @@
|
|
|
215
215
|
},
|
|
216
216
|
"devDependencies": {
|
|
217
217
|
"@automerge/automerge": "^2.1.10",
|
|
218
|
+
"@automerge/automerge-repo": "^1.0.19",
|
|
218
219
|
"@babel/cli": "^7.23.4",
|
|
219
220
|
"@babel/core": "^7.23.7",
|
|
220
221
|
"@babel/preset-env": "^7.23.8",
|
|
@@ -231,17 +232,16 @@
|
|
|
231
232
|
"@types/jest": "^29.5.11",
|
|
232
233
|
"@types/jest-environment-puppeteer": "^5.0.6",
|
|
233
234
|
"@types/less": "^3.0.6",
|
|
234
|
-
"@types/node": "^20.
|
|
235
|
+
"@types/node": "^20.11.5",
|
|
235
236
|
"@types/puppeteer": "^5.4.7",
|
|
236
|
-
"@types/react": "^18.2.
|
|
237
|
+
"@types/react": "^18.2.48",
|
|
237
238
|
"@types/react-dom": "^18.2.18",
|
|
238
239
|
"@types/react-test-renderer": "^18.0.7",
|
|
239
240
|
"@types/tmp": "^0.2.6",
|
|
240
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
241
|
-
"@typescript-eslint/parser": "^6.
|
|
241
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
242
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
242
243
|
"@vlcn.io/crsqlite-wasm": "^0.16.0",
|
|
243
244
|
"asciichart": "^1.5.25",
|
|
244
|
-
"automerge-repo": "^0.1.0",
|
|
245
245
|
"babel-eslint": "^10.1.0",
|
|
246
246
|
"babel-jest": "^29.7.0",
|
|
247
247
|
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
@@ -250,15 +250,15 @@
|
|
|
250
250
|
"buffer-replace": "^1.0.0",
|
|
251
251
|
"country-flag-emoji-json": "^2.0.0",
|
|
252
252
|
"cspell": "^8.3.2",
|
|
253
|
-
"electric-sql": "^0.
|
|
253
|
+
"electric-sql": "^0.9.0",
|
|
254
254
|
"esbuild": "^0.19.11",
|
|
255
255
|
"eslint": "^8.56.0",
|
|
256
256
|
"eslint-config-prettier": "^9.1.0",
|
|
257
|
-
"eslint-plugin-jest": "^27.6.
|
|
257
|
+
"eslint-plugin-jest": "^27.6.3",
|
|
258
258
|
"eslint-plugin-jsdoc": "^48.0.2",
|
|
259
259
|
"eslint-plugin-react": "7.33.2",
|
|
260
260
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
261
|
-
"expo-sqlite": "^
|
|
261
|
+
"expo-sqlite": "^13.2.1",
|
|
262
262
|
"fake-indexeddb": "^5.0.2",
|
|
263
263
|
"gulp": "^4.0.2",
|
|
264
264
|
"gulp-gzip": "^1.4.2",
|
|
@@ -269,14 +269,14 @@
|
|
|
269
269
|
"jest-fetch-mock": "^3.0.3",
|
|
270
270
|
"jest-puppeteer": "^9.0.2",
|
|
271
271
|
"less": "^4.2.0",
|
|
272
|
-
"partykit": "^0.0.
|
|
273
|
-
"partysocket": "^0.0.
|
|
274
|
-
"prettier": "^3.
|
|
272
|
+
"partykit": "^0.0.74",
|
|
273
|
+
"partysocket": "^0.0.21",
|
|
274
|
+
"prettier": "^3.2.4",
|
|
275
275
|
"puppeteer": "21.7.0",
|
|
276
276
|
"react": "^18.2.0",
|
|
277
277
|
"react-dom": "^18.2.0",
|
|
278
278
|
"react-test-renderer": "^18.2.0",
|
|
279
|
-
"rollup": "^4.9.
|
|
279
|
+
"rollup": "^4.9.6",
|
|
280
280
|
"rollup-plugin-esbuild": "^6.1.0",
|
|
281
281
|
"rollup-plugin-gzip": "^3.1.1",
|
|
282
282
|
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
@@ -288,29 +288,29 @@
|
|
|
288
288
|
"ts-unused-exports": "^10.0.1",
|
|
289
289
|
"typescript": "5.3.3",
|
|
290
290
|
"wa-sqlite": "github:rhashimoto/wa-sqlite",
|
|
291
|
-
"yjs": "^13.6.
|
|
291
|
+
"yjs": "^13.6.11"
|
|
292
292
|
},
|
|
293
293
|
"peerDependencies": {
|
|
294
|
+
"@automerge/automerge-repo": "^1.0.19",
|
|
294
295
|
"@sqlite.org/sqlite-wasm": "^3.44.2-build3",
|
|
295
296
|
"@vlcn.io/crsqlite-wasm": "^0.16.0",
|
|
296
|
-
"
|
|
297
|
-
"
|
|
298
|
-
"
|
|
299
|
-
"
|
|
300
|
-
"prettier": "^3.1.1",
|
|
297
|
+
"electric-sql": "^0.9.0",
|
|
298
|
+
"partykit": "^0.0.74",
|
|
299
|
+
"partysocket": "^0.0.21",
|
|
300
|
+
"prettier": "^3.2.4",
|
|
301
301
|
"react": "^18.2.0",
|
|
302
302
|
"react-dom": "^18.2.0",
|
|
303
303
|
"sqlite3": "^5.1.7",
|
|
304
|
-
"yjs": "^13.6.
|
|
304
|
+
"yjs": "^13.6.11"
|
|
305
305
|
},
|
|
306
306
|
"peerDependenciesMeta": {
|
|
307
|
-
"@
|
|
307
|
+
"@automerge/automerge-repo": {
|
|
308
308
|
"optional": true
|
|
309
309
|
},
|
|
310
|
-
"@
|
|
310
|
+
"@sqlite.org/sqlite-wasm": {
|
|
311
311
|
"optional": true
|
|
312
312
|
},
|
|
313
|
-
"
|
|
313
|
+
"@vlcn.io/crsqlite-wasm": {
|
|
314
314
|
"optional": true
|
|
315
315
|
},
|
|
316
316
|
"electric-sql": {
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-6"><em>NEW!</em> v4.6 release</a> <span id="one-with">"The One With ElectricSQL"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a> and <a href="https://electric-sql.com/">ElectricSQL</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/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/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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.6.
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-6"><em>NEW!</em> v4.6 release</a> <span id="one-with">"The One With ElectricSQL"</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a> and <a href="https://electric-sql.com/">ElectricSQL</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/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/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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.6.3" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
const store = createStore()
|