tinybase 4.3.8 → 4.3.10
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/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/cjs/checkpoints.cjs +1 -1
- package/lib/cjs/checkpoints.cjs.gz +0 -0
- package/lib/cjs/indexes.cjs +1 -1
- package/lib/cjs/indexes.cjs.gz +0 -0
- package/lib/cjs/metrics.cjs +1 -1
- package/lib/cjs/metrics.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-expo-sqlite.cjs +1 -1
- package/lib/cjs/persisters/persister-expo-sqlite.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-indexed-db.cjs +1 -1
- package/lib/cjs/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-partykit-client.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-client.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-yjs.cjs +1 -1
- package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs/queries.cjs +1 -1
- package/lib/cjs/queries.cjs.gz +0 -0
- package/lib/cjs/relationships.cjs +1 -1
- package/lib/cjs/relationships.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.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/checkpoints.cjs +1 -1
- package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
- package/lib/cjs-es6/indexes.cjs +1 -1
- package/lib/cjs-es6/indexes.cjs.gz +0 -0
- package/lib/cjs-es6/metrics.cjs +1 -1
- package/lib/cjs-es6/metrics.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-client.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-client.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs-es6/queries.cjs +1 -1
- package/lib/cjs-es6/queries.cjs.gz +0 -0
- package/lib/cjs-es6/relationships.cjs +1 -1
- package/lib/cjs-es6/relationships.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.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/checkpoints.js +12 -12
- package/lib/debug/indexes.js +9 -9
- package/lib/debug/metrics.js +9 -9
- package/lib/debug/persisters/persister-automerge.js +6 -6
- package/lib/debug/persisters/persister-browser.js +2 -2
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +5 -5
- package/lib/debug/persisters/persister-expo-sqlite.js +5 -5
- package/lib/debug/persisters/persister-file.js +2 -2
- package/lib/debug/persisters/persister-indexed-db.js +6 -6
- package/lib/debug/persisters/persister-partykit-client.js +15 -5
- package/lib/debug/persisters/persister-partykit-server.js +44 -30
- package/lib/debug/persisters/persister-remote.js +2 -2
- package/lib/debug/persisters/persister-sqlite-wasm.js +5 -5
- package/lib/debug/persisters/persister-sqlite3.js +5 -5
- package/lib/debug/persisters/persister-yjs.js +9 -9
- package/lib/debug/persisters.js +2 -2
- package/lib/debug/queries.js +15 -15
- package/lib/debug/relationships.js +9 -9
- package/lib/debug/store.js +9 -9
- package/lib/debug/tinybase.js +15 -15
- package/lib/debug/tools.js +6 -7
- package/lib/debug/ui-react-dom.js +10 -10
- package/lib/debug/ui-react.js +2 -2
- package/lib/es6/checkpoints.js +1 -1
- package/lib/es6/checkpoints.js.gz +0 -0
- package/lib/es6/indexes.js +1 -1
- package/lib/es6/indexes.js.gz +0 -0
- package/lib/es6/metrics.js +1 -1
- package/lib/es6/metrics.js.gz +0 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-expo-sqlite.js +1 -1
- package/lib/es6/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/es6/persisters/persister-indexed-db.js +1 -1
- package/lib/es6/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/es6/persisters/persister-partykit-client.js +1 -1
- package/lib/es6/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/es6/persisters/persister-partykit-server.js +1 -1
- package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite3.js +1 -1
- package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/es6/persisters/persister-yjs.js +1 -1
- package/lib/es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/es6/queries.js +1 -1
- package/lib/es6/queries.js.gz +0 -0
- package/lib/es6/relationships.js +1 -1
- package/lib/es6/relationships.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite.js +1 -1
- package/lib/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/persisters/persister-indexed-db.js +1 -1
- package/lib/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/persisters/persister-partykit-client.js +1 -1
- package/lib/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/persisters/persister-partykit-server.js +1 -1
- package/lib/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-sqlite3.js +1 -1
- package/lib/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/persisters/persister-yjs.js +1 -1
- package/lib/persisters/persister-yjs.js.gz +0 -0
- package/lib/queries.js +1 -1
- package/lib/queries.js.gz +0 -0
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/persisters/persister-partykit-client.d.ts +43 -4
- package/lib/types/persisters/persister-partykit-server.d.ts +66 -0
- package/lib/types/with-schemas/persisters/persister-partykit-client.d.ts +44 -5
- package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +66 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite.js +1 -1
- package/lib/umd/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/umd/persisters/persister-indexed-db.js +1 -1
- package/lib/umd/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd/persisters/persister-partykit-client.js +1 -1
- package/lib/umd/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/umd/persisters/persister-partykit-server.js +1 -1
- package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite3.js +1 -1
- package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd/persisters/persister-yjs.js +1 -1
- package/lib/umd/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd/queries.js +1 -1
- package/lib/umd/queries.js.gz +0 -0
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.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/checkpoints.js +1 -1
- package/lib/umd-es6/checkpoints.js.gz +0 -0
- package/lib/umd-es6/indexes.js +1 -1
- package/lib/umd-es6/indexes.js.gz +0 -0
- package/lib/umd-es6/metrics.js +1 -1
- package/lib/umd-es6/metrics.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite.js +1 -1
- package/lib/umd-es6/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-indexed-db.js +1 -1
- package/lib/umd-es6/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-client.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-yjs.js +1 -1
- package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd-es6/queries.js +1 -1
- package/lib/umd-es6/queries.js.gz +0 -0
- package/lib/umd-es6/relationships.js +1 -1
- package/lib/umd-es6/relationships.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.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 +8 -8
- package/readme.md +2 -2
package/lib/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>typeof e,t="tinybase",l="",a=",",n=e(l),o=e(!0),d=e(0),s="type",r="default",I="Listener",c="get",$="add",u="Ids",i="Table",p=i+"s",b=i+u,C="Row",h=C+u,m="Sorted"+C+u,g="Cell",f=g+u,w="Value",y=w+"s",T=w+u,v=Promise,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==n||e==o,S=t=>e(t)==n,P=e=>Array.isArray(e),A=(e,t,l)=>e.slice(t,l),E=async e=>v.all(e),D=t=>{const l=e(t);return k(l)||l==d&&V(t)?l:void 0},O=(e,t)=>e.every(t),N=(e,t)=>e.sort(t),G=(e,t)=>e.forEach(t),L=(e,t=l)=>e.join(t),j=(e,t)=>e.map(t),M=e=>e.length,J=(e,t)=>e.filter(t),z=(e,...t)=>e.push(...t),W=e=>e.pop(),B=(e,...t)=>e.unshift(...t),F=e=>e.shift(),U=Object,_=U.keys,Z=U.freeze,H=e=>x(e,U)&&e.constructor==U,Q=(e,t)=>j(U.entries(e),(([e,l])=>t(l,e))),q=e=>M(_(e)),K=e=>H(e)&&0==q(e),X=(e,t)=>e?.has(t)??!1,Y=e=>[...e?.values()??[]],ee=(e,t)=>e?.forEach(t),te=(e,t)=>e?.delete(t),le=e=>new Map(e),ae=(e,t)=>e?.get(t),ne=(e,t)=>ee(e,((e,l)=>t(l,e))),oe=(e,t)=>j([...e?.entries()??[]],(([e,l])=>t(l,e))),de=(e,t,l)=>R(l)?(te(e,t),e):e?.set(t,l),se=(e,t,l)=>(X(e,t)||de(e,t,l()),ae(e,t)),re=e=>e.toUpperCase(),Ie=e=>e.toLowerCase(),ce="a ",$e="A function for",ue=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",pe="Del",be="Deps",Ce=be+"?: React.DependencyList",he="doRollback?: DoRollback",me="actions: () => Return, "+he,ge="export",fe="Id",we="Invalid",ye="Json",Te=Ie(I),ve="?: ",Ve=" | undefined",xe="NonNullable",Re="Partial",ke="Props",Se="Provider",Pe=`Registers a ${Te} that will be called`,Ae="Represents",Ee="rowId: "+fe,De="Schema",Oe="Set",Ne=", descending?: boolean, offset?: number, limit?: number",Ge="[]",Le="the Store",je="Transaction",Me=je+"Changes",Je=Ie(je),ze="Execute a "+Je+" to make multiple mutations",We="Explicitly starts a "+Je,Be="Explicitly finishes a "+Je,Fe="the end of the "+Je,Ue="void",_e=" => "+Ue,Ze="WhenSet",He=" when setting it",Qe=ce+"string serialization of",qe=" ",Ke="Gets a callback that can ",Xe="the ",Ye=" the schema for",et=(e=0,t=0)=>`the ${mt[e]}content of`+(t?qe+Le:l),tt=(e=0,t,a=0)=>bt[t]+qe+et(e,1)+(a?" when setting it":l),lt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${et()} the '${e}' `+i,at=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,nt=(e,t)=>`Calls a function for each ${e} in `+t,ot=e=>"The props passed to a component that renders "+e,dt=e=>"A function that takes "+e,st=(e,t=0)=>$e+" listening to changes to "+ht[e]+" in "+ht[t],rt=(e,t,a=0)=>Pe+" whenever "+ht[e]+" in "+ht[t]+" change"+(a?l:"s"),It=e=>`the '${e}' `+i,ct=e=>"the specified Row in "+It(e),$t=(e,t=0)=>bt[t]+` ${et()} `+It(e),ut=(e,t=0)=>bt[t]+` ${et()} `+ct(e),it=(e,t,l=0)=>bt[l]+` the '${t}' Cell for `+ct(e),pt=(e,t=0)=>bt[t]+` the '${e}' Value`,bt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+Qe,"Sets "+Qe,Pe+" whenever",Ke+"set",Ke+"add",Ke+"set part of",Ke+"delete","Renders","Gets "+Qe+Ye,"Sets"+Ye,"Deletes"+Ye],Ct=[c,"has","set","del","set","forEach",$,l],ht=[Le,p,Xe+i+qe+u,ce+i,Xe+C+qe+u,ce+C,Xe+g+qe+u,ce+g,"invalid Cell changes",y,Xe+w+qe+u,ce+w,"invalid Value changes",Xe+"sorted "+C+qe+u,Xe+g+qe+u+" anywhere",Xe+"number of Rows"],mt=[l,"tabular ","keyed value "],gt=e=>new Set(P(e)||R(e)?e:[e]),ft=(e,t)=>e?.add(t),wt=/[^A-Za-z]+/,yt=/[^A-Za-z0-9]+/,Tt=/^( *)\/\*\* *(.*?) *\*\/$/gm,vt=e=>e.includes(a),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return X(e,n)?Vt(e,t,l,a+1):(de(e,n,l),n)},xt=e=>e.replace(Tt,((e,t,l)=>{const a=77-Rt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.length,kt=e=>e.flat(1e3),St=(e,t=0)=>L(j(e.split(yt),((e,l)=>(l>0||t?re:Ie)(A(e,0,1))+A(e,1)))),Pt=e=>re(L((e&&!wt.test(e[0])?e:" "+e).split(yt),"_")),At=e=>`/** ${e}. */`,Et=(...e)=>L(J(e,(e=>e)),", "),Dt=(...e)=>"{"+L(e,"; ")+"}",Ot=(...e)=>Dt(...j(e,(e=>"readonly "+e))),Nt=()=>{const e=[le(),le(),le(),le()],t=le(),a=le(),n=e=>{const t=e.indexOf(" as ");return-1!=t?A(e,t+4):e};return[(...e)=>L(kt(e),"\n"),(t,l,...a)=>G(a,(a=>G([0,1],(n=>(t??n)==n?ft(se(e[n],l,gt),a):0)))),(e,a,n,o=l,d=1)=>Vt(t,e,[a,n,o,d]),(e,t,l)=>Vt(a,e,P(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>ae(a,e)===t?e:Vt(a,e,t),(t=0)=>j([...N(oe(e[t],((e,t)=>`import {${L(N(Y(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),l],(e=>e.replace("{React}","React"))),()=>oe(t,(([e,t,a,n],o)=>[At(t),`${n?ge+" ":l}type ${o}${a} = ${e};`,l])),()=>oe(a,((e,t)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${t} = ${F(e)}`,e,l])))]},Gt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Lt=(e,t,l)=>[t=>Q(e,((e,a)=>t(a,St(a,1),l(Pt(a),`'${a}'`)))),(t,a)=>Q(e[t],((e,t)=>a(t,e[s],e[r],l(Pt(t),`'${t}'`),St(t,1)))),e=>Q(t,((t,a)=>e(a,t[s],t[r],l(Pt(a),`'${a}'`),St(a,1))))],jt=(e,t,a,n)=>[(n,o)=>{const d=n+": "+o,s=e(p,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...a(e,((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`)))+"}"))),tt(1,5)),r=e(p+Ze,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...a(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),tt(1,5,1)),c=e(i+fe,"keyof "+s,"A "+i+" Id in "+Le),$=`<TId extends ${c}>`,u=e(i,xe+`<${s}[TId]>`,"A "+i+" in "+Le,$),w=e(i+Ze,xe+`<${r}[TId]>`,"A "+i+" in "+Le+He,$),y=e(C,u+"<TId>[Id]","A "+C+" in a "+i,$),T=e(C+Ze,w+"<TId>[Id]","A "+C+" in a "+i+He,$),v=e(g+fe,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+C,$),V=e(g,xe+`<${s}[TId]>[Id][CId]`,"A "+g+" in a "+C,`<TId extends ${c}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+C,`<TId extends ${c}, CId = ${v}<TId>>`,0),k=e(g+ie,`(...[cellId, cell]: ${x}<TId>)`+_e,dt(ce+g+" Id, and "+g),$),S=e(C+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+_e+") "+_e,dt(ce+C+" Id, and a "+g+" iterator"),$),P=e(i+g+ie,`(cellId: ${v}<TId>, count: number) `+_e,dt(ce+g+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${c} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${_e}] : never`,i+" Ids and callback types",`<TId = ${c}>`,0),E=e(i+ie,`(...[tableId, forEachRow]: ${A})`+_e,dt(ce+i+" Id, and a "+C+" iterator"),l),D=e("TableIdRowIdCellIdArray",`TId extends ${c} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${c}>`,0),O=e("GetCellChange",`(...[tableId, rowId, cellId]: ${D}) => CellChange`,$e+" returning information about any Cell's changes during a "+Je),N=e(p+I,`(${d}, getCellChange: ${O}${Ve})`+_e,st(1)),G=e(b+I,`(${d})`+_e,st(2)),L=e(i+I,`(${d}, tableId: ${c}, getCellChange: ${O}${Ve})`+_e,st(3)),j=e(i+f+I,`(${d}, tableId: ${c})`+_e,st(14,3)),M=e(C+"Count"+I,`(${d}, tableId: ${c})`+_e,st(15,3)),J=e(h+I,`(${d}, tableId: ${c})`+_e,st(4,3)),z=e(m+I,"("+Et(d,"tableId: "+c,"cellId: Id"+Ve,"descending: boolean","offset: number","limit: number"+Ve,"sortedRowIds: Ids")+")"+_e,st(13,3)),W=e(C+I,"("+Et(""+d,"tableId: "+c,Ee,`getCellChange: ${O}${Ve}`)+")"+_e,st(5,3)),B=e(f+I,"("+Et(""+d,"tableId: "+c,Ee)+")"+_e,st(6,5)),F=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Ee}, cellId: CId, newCell: ${V}<TId, CId> ${Ve}, oldCell: ${V}<TId, CId> ${Ve}, getCellChange: ${O} ${Ve}] : never`,"Cell args for CellListener",`<TId extends ${c}, CId = ${v}<TId>>`,0),U=e("CellListenerArgsArrayOuter",`TId extends ${c} ? `+F+"<TId> : never","Table args for CellListener",`<TId = ${c}>`,0);return[s,r,c,u,w,y,T,v,V,k,S,P,E,N,G,L,j,M,J,z,W,B,e(g+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${U})`+_e,st(7,5)),e(we+g+I,`(${d}, tableId: Id, ${Ee}, cellId: Id, invalidCells: any[])`+_e,st(8))]},(t,a)=>{const o=t+": "+a,d=e(y,Dt(...n(((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`))),tt(2,5)),s=e(y+Ze,Dt(...n(((e,t)=>`'${e}'?: ${t}`))),tt(2,5,1)),r=e(w+fe,"keyof "+d,"A "+w+" Id in "+Le),c=e(w,xe+`<${d}[VId]>`,"A "+w+" Id in "+Le,`<VId extends ${r}>`),$=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${c}<VId>] : never`,w+" Ids and types in "+Le,`<VId = ${r}>`,0),u=e(w+ie,`(...[valueId, value]: ${$})`+_e,dt(ce+w+" Id, and "+w)),i=e("GetValueChange",`(valueId: ${r}) => ValueChange`,$e+" returning information about any Value's changes during a "+Je),p=e(y+I,`(${o}, getValueChange: ${i}${Ve})`+_e,st(9)),b=e(T+I,`(${o})`+_e,st(10)),C=e("ValueListenerArgsArray",`VId extends ${r} ? [${o}, valueId: VId, newValue: ${c}<VId> ${Ve}, oldValue: ${c}<VId> ${Ve}, getValueChange: ${i} ${Ve}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[d,s,r,c,u,p,b,e(w+I,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+_e,st(11)),e(we+w+I,`(${o}, valueId: Id, invalidValues: any[])`+_e,st(12))]},(t,l)=>e(je+I,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+_e,$e+" listening to the completion of a "+Je)],Mt=(e,t=l,a=l)=>`store.${e}(${t})`+(a?" as "+a:l),Jt=(e,t=l)=>`fluent(() => ${Mt(e,t)})`,zt=(e,t=l,a=l)=>`store.${e}(${t?t+", ":l}proxy(listener)${a?", "+a:l})`,Wt=(e,a,n)=>{const[d,c,v,V,x,k,P,A]=Nt(),[E,D,O]=Lt(e,a,x),[N,j,M]=jt(v,E,D,O),J=le(),W=(e=0)=>oe(J,(([t,a,n,o,d],s)=>{const r=e?[s+`: ${d}(${t}): ${a} => ${n},`]:[s+d+`(${t}): ${a};`];return e||B(r,At(o)),z(r,l),r})),F=(e,t,a,n,o,d=l)=>Vt(J,e,[t,a,n,o,d]),U=(e,t,a,n,o,d=l,s=l,r=l)=>F(Ct[e]+t+(4==e?Re:l)+a,d,n,(n==H?Jt:Mt)(Ct[e]+(4==e?Re:l)+a,s,e?void 0:n),o,r),_=(e,t,a,n=l,o=l,d=1,s=l)=>F($+e+I,(n?n+", ":l)+Te+": "+t+(d?", mutator?: boolean":l),fe,zt($+e+I,o,d?"mutator":l),a,s),Z=`./${St(n)}.d`,H=St(n,1),Q=St(H),q=[],X=le();let ee=[],te=[];if(c(1,Z,H,`create${H} as create${H}Decl`),K(e))c(null,t,p);else{c(0,t,"CellChange"),c(null,t,u);const[e,a,n,d,I,$,w,y,T,V,k,P,A,O,j,M,J,W,B,F,K,te,ne,oe]=N(Q,H),se=le();E(((e,t)=>{const l=`<'${e}'>`,a=[v(t+i,d+l,Ae+` the '${e}' `+i),v(t+i+Ze,I+l,Ae+` the '${e}' `+i+He),v(t+C,$+l,lt(e)),v(t+C+Ze,w+l,lt(e,1)),v(t+g+fe,y+l,`A Cell Id for the '${e}' `+i),v(t+g+ie,V+l,dt(`a Cell Id and value from a Row in the '${e}' `+i)),v(t+C+ie,k+l,dt(`a Row Id from the '${e}' Table, and a Cell iterator`)),v(t+i+g+ie,P+l,dt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];de(se,e,a),c(1,Z,...a)})),c(1,Z,e,a,n,y,A,O,j,M,J,W,B,F,K,te,ne,oe),ee=[e,a,n,y,O,j,M,J,W,B,F,K,te,ne,se],G([[e],[o],[H,"tables: "+a,"tables"],[H]],(([e,t,a],n)=>U(n,l,p,e,tt(1,n),t,a))),U(0,l,b,n+Ge,at(i,Le)),U(5,l,i,Ue,nt(i,Le),"tableCallback: "+A,"tableCallback as any"),E(((e,t,a)=>{const[n,d,s,r,I,c,$,p]=ae(se,e);G([[n],[o],[H,"table: "+d,", table"],[H]],(([n,o,d=l],s)=>U(s,t,i,n,$t(e,s),o,a+d))),U(0,t,i+f,u,at(g,"the whole of "+It(e)),l,a),U(5,t,i+g,Ue,nt(i+g,"the whole of "+It(e)),"tableCellCallback: "+p,a+", tableCellCallback as any"),U(0,t,C+"Count","number","Gets the number of Rows in the "+It(e),l,a),U(0,t,h,u,at(C,It(e)),l,a),U(0,t,m,u,at(C,It(e),1),"cellId?: "+I+Ne,a+", cellId, descending, offset, limit"),U(5,t,C,Ue,nt(C,It(e)),"rowCallback: "+$,a+", rowCallback as any"),G([[s],[o],[H,", row: "+r,", row"],[H],[H,", partialRow: "+r,", partialRow"]],(([n,o=l,d=l],s)=>U(s,t,C,n,ut(e,s),Ee+o,a+", rowId"+d))),U(6,t,C,fe+Ve,"Add a new Row to "+It(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,t,f,I+Ge,at(g,ct(e)),Ee,a+", rowId"),U(5,t,g,Ue,nt(g,ct(e)),Ee+", cellCallback: "+c,a+", rowId, cellCallback as any"),D(e,((n,d,s,r,I)=>{const c="Map"+St(d,1);de(X,d,c);const $=d+(R(s)?Ve:l);G([[$],[o],[H,`, cell: ${d} | `+c,", cell as any"],[H]],(([o,d=l,s=l],c)=>U(c,t+I,g,o,it(e,n,c),Ee+d,a+", rowId, "+r+s))),U(1,t+I,i+g,o,bt[1]+` the '${n}' Cell anywhere in `+It(e),l,a+", "+r)}))})),U(0,l,p+ye,ye,tt(1,6)),U(2,l,p+ye,H,tt(1,7),"tablesJson: "+ye,"tables"+ye),_(p,O,tt(1,8)+" changes"),_(b,j,rt(2,0,1)),_(i,M,rt(3,0),`tableId: ${n} | null`,"tableId"),_(i+f,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(C+"Count",W,rt(15,3),`tableId: ${n} | null`,"tableId"),_(h,B,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,F,rt(13,3,1),Et("tableId: TId",`cellId: ${y}<TId>`+Ve,"descending: boolean","offset: number","limit: number"+Ve),Et("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(C,K,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,te,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,ne,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${L(E((e=>ae(se,e)?.[4]??l))," | ")} | null`,"tableId, rowId, cellId"),_(we+g,oe,Pe+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),c(1,Z,...Y(X)),z(q,".set"+p+De+"({",kt(E(((e,t,a)=>[`[${a}]: {`,...D(e,((e,t,a,n)=>`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(a)?l:`, [${x(Pt(r),`'${r}'`)}]: `+(S(a)?x(Pt(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(K(a))c(null,t,y);else{const[e,a,n,d,I,$,u,i,p]=j(Q,H);c(1,Z,e,a,n,I,$,u,i,p),te=[e,a,n,$,u,i],G([[e],[o],[H,"values: "+a,"values"],[H],[H,"partialValues: "+a,"partialValues"]],(([e,t,a],n)=>U(n,l,y,e,tt(2,n),t,a))),U(0,l,T,n+Ge,at(w,Le)),U(5,l,w,"void",nt(w,Le),"valueCallback: "+I,"valueCallback as any"),O(((e,t,a,n,d)=>{const s="Map"+St(t,1);de(X,t,s),G([[t],[o],[H,`value: ${t} | `+s,", value as any"],[H]],(([t,a,o=l],s)=>U(s,d,w,t,pt(e,s),a,n+o)))})),U(0,l,y+ye,ye,tt(2,6)),U(2,l,y+ye,H,tt(2,7),"valuesJson: "+ye,"values"+ye),_(y,$,tt(2,8)+" changes"),_(T,u,rt(10,0,1)),_(w,i,rt(11,0),`valueId: ${n} | null`,"valueId"),_(we+w,p,Pe+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),c(1,Z,...Y(X)),c(0,t,"ValueChange"),z(q,".set"+y+De+"({",O(((e,t,a,n)=>[`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(a)?l:`, [${x(Pt(r),`'${r}'`)}]: `+(S(a)?x(Pt(a),`'${a}'`):a)}},`])),"})")}U(0,l,"Content",`[${p}, ${y}]`,tt(0,0)),U(2,l,"Content",H,tt(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,l,Me,H,`Applies a set of ${Me} to the Store`,"transactionChanges: "+Me,"transactionChanges"),ne(X,((e,t)=>v(t,`(cell: ${e}${Ve}) => `+e,`Takes a ${e} Cell value and returns another`))),c(null,t,"DoRollback",fe,"IdOrNull",ye,"Store",Me),c(0,t,"Get"+Me,"GetTransactionLog"),U(0,l,ye,ye,tt(0,6)),U(2,l,ye,H,tt(0,7),"tablesAndValuesJson: "+ye,"tablesAndValuesJson"),U(7,l,Je,"Return",ze,me,"actions, doRollback","<Return>"),U(7,l,"start"+je,H,We),U(7,l,"finish"+je,H,Be,he,"doRollback");const se=M(Q,H);return _("Start"+je,se,Pe+" just before the start of the "+Je,l,l,0),_("WillFinish"+je,se,Pe+" just before "+Fe,l,l,0),_("DidFinish"+je,se,Pe+" just after "+Fe,l,l,0),U(7,l,"call"+I,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,l,I,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",l,"Store","store",bt[0]+" the underlying Store object"),c(1,t,"createStore"),c(1,Z,H,`create${H} as create${H}Decl`,se),x("store",["createStore()",...q]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...W(1),"}"]),[d(...k(0),...P(),ge+" interface "+H+" {",...W(0),"}",l,At(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),d(...k(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${Q});`,"};"),ee,te]},Bt=e=>c+e,Ft=e=>Et(Bt(e),Bt(e)+be),Ut="debugIds?: boolean",_t="debugIds={debugIds}",Zt="then"+Ce,Ht="Parameter",Qt=": (parameter: "+Ht+", store: Store) => ",qt="const contextValue = useContext(Context);",Kt=", based on a parameter",Xt=": ",Yt="<"+Ht+",>",el=Ht+"ized"+ie+"<"+Ht+">",tl="rowId",ll="rowId={rowId}",al=", separator, debugIds",nl="separator?: ReactElement | string",ol="then?: (store: Store",dl=Et(ol+")"+_e,Zt),sl="then, then"+be,rl=tl+Xt+fe,Il="View",cl=(e,...t)=>Et(...t,Te+": "+e,Te+Ce,"mutator?: boolean"),$l=(...e)=>Et(...e,Te,Te+be,"mutator"),ul=(e,a,n,o,d)=>{const[s,r,c,$,v,V,x,k]=Nt(),[S,P,A]=Lt(e,a,v),E=`./${St(n)}.d`,D=`./${St(n)}-ui-react.d`,O="tinybase/ui-react",N=St(n,1),G=St(N),j=N+"Or"+N+fe,M=G+"Or"+N+fe,J=G+`={${G}}`,W=le(),F=(e,t,a,n,o,d=l)=>(r(1,D,e+" as "+e+"Decl"),Vt(W,e,[t,a,n,o,d])),U=(e,t,a,n,o,d=l)=>F("use"+e,t,a,n,o,d),_=(e,t,a,n,o=l,d=l,s=l,I=l,c=l)=>(r(1,O,`use${t} as use${t}Core`),U(e,Et(o,X,I),a,ee+`(${M}, use${t}Core, [`+(d||l)+(c?"], ["+c:l)+"]);",n,s)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>oe(W,(([t,a,n,o,d],s)=>{const r=e?[ge+` const ${s}: typeof ${s}Decl = ${d}(${t}): ${1==a?"any":a} =>`,n]:[ge+` function ${s}${d}(${t}): ${1==a?"ComponentReturnType":a};`];return e||B(r,At(o)),z(r,l),r}));r(null,t,fe,"Store",ie,Ht+"ized"+ie),r(0,O,"ComponentReturnType"),r(1,O,"useCellIds"),r(null,O,"ExtraProps"),r(0,E,N);const Q=c(j,N+" | "+fe,`Used when you need to refer to a ${N} in a React hook or component`),q=c(Se+ke,Ot(G+ve+N,G+`ById?: {[${G}Id: Id]: ${N}}`),`Used with the ${Se} component, so that a `+N+" can be passed into the context of an application");r(0,"react","ReactElement","ComponentType"),r(1,"react","React"),r(1,D,Q,q);const X=M+ve+Q;v("{createContext, useContext, useMemo}","React"),v("Context",`createContext<[${N}?, {[${G}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+Ce,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Ve,["{",qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Se} component context`),ee=$("useHook",M+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${M} as Id);`,`return hook(...preParams, ((${M} == null || typeof ${M} == 'string')`,`? ${G} : ${M})?.getStore(), ...postParams)`]),te=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),ne=$("wrap",Et("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("useCustomOrDefaultCellIds",Et("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${M}?: ${Q} | undefined`),[`const defaultCellIds = ${ee}(${M}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),se=v("NullComponent","() => null");if(!K(e)){const[e,a,n,d,s,w,y,T,v,V,x,k,A,O,j]=o;r(null,E,e,a,n,s,w,y,T,v,V,x,k,A,O),r(0,E,d),r(1,E,N),r(null,t,u,"IdOrNull");const M=$("tableView",`{${G}, rowComponent, getRowComponentProps, customCellIds`+al+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${ne}(rowIds.map((rowId) => (`,"<Row","{..."+te+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ll,"customCellIds={customCellIds}",J,_t,"/>","))",al,", tableId,",");"]),z=$("getDefaultTableComponent","tableId: Id",L(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+se),W=$("getDefaultCellComponent","tableId: Id, cellId: Id",L(S(((e,t,l)=>`tableId == ${l} ? ${L(P(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+se} : `)))+se);_(p,p,e,tt(1,0)+ue);const B=_(b,b,n+Ge,at(i,Le)+ue);_(Oe+p+ie,Oe+p+ie,el,tt(1,9)+Kt,Et(Bt(p)+Qt+a,Bt(p)+Ce),Ft(p),Yt,Et(ol,`tables: ${a})`+_e,Zt),sl),_(pe+p+ie,pe+p+ie,ie,tt(1,12),l,l,l,dl,sl);const F=c(g+ke,Ot("tableId?: TId","rowId: Id","cellId?: CId",G+ve+N,Ut),ot(ce+g),`<TId extends ${n}, CId extends ${d}<TId>>`),U=c(C+ke,Ot("tableId?: TId","rowId: Id",G+ve+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${F}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,nl,Ut),ot(ce+C),`<TId extends ${n}>`),H=c(i+ke,Ot("tableId?: TId",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),ot(ce+i),`<TId extends ${n}>`),Q=c("Sorted"+i+ke,Ot("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),ot(ce+"sorted "+i),`<TId extends ${n}>`),q=c(p+ke,Ot(G+ve+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${H}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,nl,Ut),ot(et(1,1)));r(1,D,q,H,Q,U,F),Z(p+Il,"{"+G+", tableComponents, getTableComponentProps"+al+"}: "+q,[ne+`(${B}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+z+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${te}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",J,_t,"/>;","}), separator)"],tt(1,13)+ue),S(((e,t,a)=>{const[n,o,d,s,I]=ae(j,e);r(null,E,n,o,d,s,I),_(t+i,i,n,$t(e)+ue,l,a),_(t+i+f,i+f,u,at(g,"the whole of "+It(e))+ue,l,a);const c=_(t+h,h,u,at(C,It(e))+ue,l,a),$=_(t+m,m,u,at(C,It(e),1)+ue,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");_(t+C,C,d,ut(e)+ue,rl,Et(a,tl)),_(t+f,f,I+Ge,at(g,ct(e))+ue,rl,Et(a,tl)),_(Oe+t+i+ie,Oe+i+ie,el,$t(e,9)+Kt,Et(Bt(i)+Qt+o,Bt(i)+Ce),Et(a,Ft(i)),Yt,Et(ol,`table: ${o})`+_e,Zt),sl),_(pe+t+i+ie,pe+i+ie,ie,$t(e,12),l,a,l,dl,sl),_(Oe+t+C+ie,Oe+C+ie,el,ut(e,9)+Kt,Et(rl,Bt(C)+Qt+s,Bt(C)+Ce),Et(a,tl,Ft(C)),Yt,Et(ol,`row: ${s})`+_e,Zt),sl),_("Add"+t+C+ie,"Add"+C+ie,el,ut(e,10)+Kt,Et(Bt(C)+Qt+s,Bt(C)+Ce),Et(a,Ft(C)),Yt,"then?: ("+Et(rl+Ve,"store: Store","row: "+s+")"+_e,"then"+Ce)+", reuseRowIds?: boolean",sl+", reuseRowIds"),_(Oe+t+Re+C+ie,Oe+Re+C+ie,el,ut(e,11)+Kt,Et(rl,Bt(Re+C)+Qt+s,Bt(Re+C)+Ce),Et(a,tl,Ft(Re+C)),Yt,Et(ol,`partialRow: ${s})`+_e,Zt),sl),_(pe+t+C+ie,pe+C+ie,ie,ut(e,12),rl,Et(a,tl),l,dl,sl);const p=Z(t+C+Il,"{rowId, "+G+", cellComponents, getCellComponentProps, customCellIds"+al+`}: ${U}<'${e}'>`,[ne+`(${de}(customCellIds, `+a+`, rowId, ${G}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+W+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${te}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,ll,"cellId={cellId}",J,_t,"/>;","})"+al+", rowId)"],ut(e,13)+ue);Z(t+"Sorted"+i+Il,"{cellId, descending, offset, limit, ...props}: "+Q+`<'${e}'>`,M+"(props, "+$+`(cellId, descending, offset, limit, props.${G}), ${a}, ${p});`,$t(e,13)+", sorted"+ue),Z(t+i+Il,`props: ${H}<'${e}'>`,M+"(props, "+c+`(props.${G}), ${a}, ${p});`,$t(e,13)+ue),P(e,((n,o,d,s,I)=>{const c="Map"+St(o,1);r(0,E,c),r(1,E,c);const $=_(t+I+g,g,o+(R(d)?Ve:l),it(e,n)+ue,rl,Et(a,tl,s));_(Oe+t+I+g+ie,Oe+g+ie,el,it(e,n,9)+Kt,Et(rl,Bt(g)+Qt+o+" | "+c,Bt(g)+Ce),Et(a,tl,s,Ft(g)),Yt,Et(ol,`cell: ${o} | ${c})`+_e,Zt),sl),_(pe+t+I+g+ie,pe+g+ie,ie,it(e,n,12),Et(rl,"forceDel?: boolean"),Et(a,tl,s,"forceDel"),l,dl,sl),Z(t+I+g+Il,`{rowId, ${G}, debugIds}: `+F+`<'${e}', '${n}'>`,[ne+`('' + ${$}(rowId, `+G+`) ?? '', undefined, debugIds, ${s})`],it(e,n,13)+ue)}))}));const K=L(S((e=>ae(j,e)?.[4]??l))," | ");_(p+I,p+I,Ue,tt(1,8)+" changes",cl(s),$l()),_(b+I,b+I,Ue,rt(2,0,1),cl(w),$l()),_(i+I,i+I,Ue,rt(3,0),cl(y,`tableId: ${n} | null`),$l("tableId")),_(i+f+I,i+f+I,Ue,rt(14,3,1),cl(T,`tableId: ${n} | null`),$l("tableId")),_(h+I,h+I,Ue,rt(4,3,1),cl(V,`tableId: ${n} | null`),$l("tableId")),_(m+I,m+I,Ue,rt(13,3,1),cl(x,`tableId: ${n} | null`,"cellId: "+K+Ve,"descending: boolean","offset: number","limit: number"+Ve),$l("tableId","cellId","descending","offset","limit")),_(C+I,C+I,Ue,rt(5,3),cl(k,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(f+I,f+I,Ue,rt(6,5,1),cl(A,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(g+I,g+I,Ue,rt(7,5),cl(O,`tableId: ${n} | null`,tl+": IdOrNull",`cellId: ${K} | null`),$l("tableId",tl,"cellId"))}if(!K(a)){const[e,t,a,n,o,s]=d;r(null,E,...d),r(1,E,N);const u=$("getDefaultValueComponent","valueId: Id",L(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+se);_(y,y,e,tt(2,0)+ue);const i=_(T,T,a+Ge,at(w,Le)+ue);_(Oe+y+ie,Oe+y+ie,el,tt(2,9)+Kt,Et(Bt(y)+Qt+t,Bt(y)+Ce),Ft(y),Yt,Et(ol,`values: ${t})`+_e,Zt),sl),_(Oe+Re+y+ie,Oe+Re+y+ie,el,tt(2,11)+Kt,Et(Bt(Re+y)+Qt+t,Bt(Re+y)+Ce),Ft(Re+y),Yt,Et(ol,`partialValues: ${t})`+_e,Zt),sl),_(pe+y+ie,pe+y+ie,ie,tt(2,12),l,l,l,dl,sl);const p=c(w+ke,Ot("valueId?: VId",G+ve+N,Ut),ot("a Value"),`<VId extends ${a}>`),b=c(y+ke,Ot(G+ve+N,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,nl,Ut),ot(et(2,1)));r(1,D,b,p),Z(y+Il,"{"+G+", valueComponents, getValueComponentProps"+al+"}: "+b,[ne+`(${i}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+u+"(valueId);","return <Value",`{...${te}(getValueComponentProps, valueId)}`,"key={valueId}",J,_t,"/>;","}), separator)"],tt(2,13)+ue),A(((e,t,a,n,o)=>{const d="Map"+St(t,1);r(0,E,d),r(1,E,d);const s=_(o+w,w,t,pt(e)+ue,l,n);_(Oe+o+w+ie,Oe+w+ie,el,pt(e,9)+Kt,Et(Bt(w)+Qt+t+" | "+d,Bt(w)+Ce),Et(n,Ft(w)),Yt,Et(ol,`value: ${t} | ${d})`+_e,Zt),sl),_(pe+o+w+ie,pe+w+ie,ie,pt(e,12),l,n,l,dl,sl),Z(o+w+Il,`{${G}, debugIds}: ${p}<'${e}'>`,[ne+`('' + ${s}(`+G+`) ?? '', undefined, debugIds, ${n})`],pt(e,13)+ue)})),_(y+I,y+I,Ue,tt(2,8)+" changes",cl(n),$l()),_(T+I,T+I,Ue,rt(10,0,1),cl(o),$l()),_(w+I,w+I,Ue,rt(11,0),cl(s,`valueId: ${a} | null`),$l("valueId"))}return Z(Se,`{${G}, ${G}ById, children}: `+q+" & {children: React.ReactNode}",["{",qt,"return (","<Context."+Se,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${Se}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[s(...V(0),...x(),...H(0)),s(...V(1),...k(),...H(1))]},il=(e,t,a)=>{if(K(e)&&K(t))return[l,l,l,l];const[n,o,d,s]=Wt(e,t,a);return[n,o,...ul(e,t,a,d,s)]},pl=JSON.parse,bl="prettier/",Cl=bl+"plugins/",hl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},ml=Gt((e=>{const t=()=>{const t=pl(e.getTablesSchemaJson());return!K(t)||O(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=le();if(O(a,(t=>O(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=se(n,a,(()=>[D(o),le(),[0],0])),[s,r,[I]]=d,c=se(r,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),de(r,o,c),d[3]++,s==D(o)})))))return t[l]={},ee(n,(([e,,[,n],o],d)=>{t[l][d]={[s]:e,...o==M(a)?{[r]:n}:{}}})),1}))?t:{}},l=()=>{const t=pl(e.getValuesSchemaJson());return K(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:D(l)}})),t},a=e=>il(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"],l=[];let n;try{n=(await import(bl+"standalone")).format,z(l,await import(Cl+"estree"),await import(Cl+"typescript"))}catch(e){n=async e=>e}return await E(j(a(e),(async(e,a)=>xt(await n(e,{...hl,plugins:l,filepath:"_."+t[a]})))))};return Z({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let s=0,r=0;const I={};d(((e,l)=>{s++;let a=0;l((()=>a++)),r+=a,t&&(I[e]={rowCells:a})})),a+=s,n+=r,t&&(o[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:M(e.getValueIds()),jsonLength:Rt(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{ml as createTools};
|
|
1
|
+
const e=e=>typeof e,t="tinybase",l="",a=",",n=e(l),o=e(!0),d=e(0),s="type",r="default",I="Listener",c="get",$="add",u="Ids",i="Table",p=i+"s",b=i+u,C="Row",h=C+u,m="Sorted"+C+u,g="Cell",f=g+u,w="Value",y=w+"s",T=w+u,v=Promise,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==n||e==o,S=t=>e(t)==n,P=e=>Array.isArray(e),A=(e,t,l)=>e.slice(t,l),E=e=>e.length,D=async e=>v.all(e),O=t=>{const l=e(t);return k(l)||l==d&&V(t)?l:void 0},N=(e,t)=>e.every(t),G=(e,t)=>e.sort(t),L=(e,t)=>e.forEach(t),j=(e,t=l)=>e.join(t),M=(e,t)=>e.map(t),J=(e,t)=>e.filter(t),z=(e,...t)=>e.push(...t),W=e=>e.pop(),B=(e,...t)=>e.unshift(...t),F=e=>e.shift(),U=Object,_=U.keys,Z=U.freeze,H=e=>x(e,U)&&e.constructor==U,Q=(e,t)=>M(U.entries(e),(([e,l])=>t(l,e))),q=e=>E(_(e)),K=e=>H(e)&&0==q(e),X=(e,t)=>e?.has(t)??!1,Y=e=>[...e?.values()??[]],ee=(e,t)=>e?.forEach(t),te=(e,t)=>e?.delete(t),le=e=>new Map(e),ae=(e,t)=>e?.get(t),ne=(e,t)=>ee(e,((e,l)=>t(l,e))),oe=(e,t)=>M([...e?.entries()??[]],(([e,l])=>t(l,e))),de=(e,t,l)=>R(l)?(te(e,t),e):e?.set(t,l),se=(e,t,l)=>(X(e,t)||de(e,t,l()),ae(e,t)),re=e=>e.toUpperCase(),Ie=e=>e.toLowerCase(),ce="a ",$e="A function for",ue=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",pe="Del",be="Deps",Ce=be+"?: React.DependencyList",he="doRollback?: DoRollback",me="actions: () => Return, "+he,ge="export",fe="Id",we="Invalid",ye="Json",Te=Ie(I),ve="?: ",Ve=" | undefined",xe="NonNullable",Re="Partial",ke="Props",Se="Provider",Pe=`Registers a ${Te} that will be called`,Ae="Represents",Ee="rowId: "+fe,De="Schema",Oe="Set",Ne=", descending?: boolean, offset?: number, limit?: number",Ge="[]",Le="the Store",je="Transaction",Me=je+"Changes",Je=Ie(je),ze="Execute a "+Je+" to make multiple mutations",We="Explicitly starts a "+Je,Be="Explicitly finishes a "+Je,Fe="the end of the "+Je,Ue="void",_e=" => "+Ue,Ze="WhenSet",He=" when setting it",Qe=ce+"string serialization of",qe=" ",Ke="Gets a callback that can ",Xe="the ",Ye=" the schema for",et=(e=0,t=0)=>`the ${mt[e]}content of`+(t?qe+Le:l),tt=(e=0,t,a=0)=>bt[t]+qe+et(e,1)+(a?" when setting it":l),lt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${et()} the '${e}' `+i,at=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,nt=(e,t)=>`Calls a function for each ${e} in `+t,ot=e=>"The props passed to a component that renders "+e,dt=e=>"A function that takes "+e,st=(e,t=0)=>$e+" listening to changes to "+ht[e]+" in "+ht[t],rt=(e,t,a=0)=>Pe+" whenever "+ht[e]+" in "+ht[t]+" change"+(a?l:"s"),It=e=>`the '${e}' `+i,ct=e=>"the specified Row in "+It(e),$t=(e,t=0)=>bt[t]+` ${et()} `+It(e),ut=(e,t=0)=>bt[t]+` ${et()} `+ct(e),it=(e,t,l=0)=>bt[l]+` the '${t}' Cell for `+ct(e),pt=(e,t=0)=>bt[t]+` the '${e}' Value`,bt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+Qe,"Sets "+Qe,Pe+" whenever",Ke+"set",Ke+"add",Ke+"set part of",Ke+"delete","Renders","Gets "+Qe+Ye,"Sets"+Ye,"Deletes"+Ye],Ct=[c,"has","set","del","set","forEach",$,l],ht=[Le,p,Xe+i+qe+u,ce+i,Xe+C+qe+u,ce+C,Xe+g+qe+u,ce+g,"invalid Cell changes",y,Xe+w+qe+u,ce+w,"invalid Value changes",Xe+"sorted "+C+qe+u,Xe+g+qe+u+" anywhere",Xe+"number of Rows"],mt=[l,"tabular ","keyed value "],gt=e=>new Set(P(e)||R(e)?e:[e]),ft=(e,t)=>e?.add(t),wt=/[^A-Za-z]+/,yt=/[^A-Za-z0-9]+/,Tt=/^( *)\/\*\* *(.*?) *\*\/$/gm,vt=e=>e.includes(a),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return X(e,n)?Vt(e,t,l,a+1):(de(e,n,l),n)},xt=e=>e.replace(Tt,((e,t,l)=>{const a=77-E(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.flat(1e3),kt=(e,t=0)=>j(M(e.split(yt),((e,l)=>(l>0||t?re:Ie)(A(e,0,1))+A(e,1)))),St=e=>re(j((e&&!wt.test(e[0])?e:" "+e).split(yt),"_")),Pt=e=>`/** ${e}. */`,At=(...e)=>j(J(e,(e=>e)),", "),Et=(...e)=>"{"+j(e,"; ")+"}",Dt=(...e)=>Et(...M(e,(e=>"readonly "+e))),Ot=()=>{const e=[le(),le(),le(),le()],t=le(),a=le(),n=e=>{const t=e.indexOf(" as ");return-1!=t?A(e,t+4):e};return[(...e)=>j(Rt(e),"\n"),(t,l,...a)=>L(a,(a=>L([0,1],(n=>(t??n)==n?ft(se(e[n],l,gt),a):0)))),(e,a,n,o=l,d=1)=>Vt(t,e,[a,n,o,d]),(e,t,l)=>Vt(a,e,P(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>ae(a,e)===t?e:Vt(a,e,t),(t=0)=>M([...G(oe(e[t],((e,t)=>`import {${j(G(Y(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),l],(e=>e.replace("{React}","React"))),()=>oe(t,(([e,t,a,n],o)=>[Pt(t),`${n?ge+" ":l}type ${o}${a} = ${e};`,l])),()=>oe(a,((e,t)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${t} = ${F(e)}`,e,l])))]},Nt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Gt=(e,t,l)=>[t=>Q(e,((e,a)=>t(a,kt(a,1),l(St(a),`'${a}'`)))),(t,a)=>Q(e[t],((e,t)=>a(t,e[s],e[r],l(St(t),`'${t}'`),kt(t,1)))),e=>Q(t,((t,a)=>e(a,t[s],t[r],l(St(a),`'${a}'`),kt(a,1))))],Lt=(e,t,a,n)=>[(n,o)=>{const d=n+": "+o,s=e(p,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...a(e,((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`)))+"}"))),tt(1,5)),r=e(p+Ze,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...a(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),tt(1,5,1)),c=e(i+fe,"keyof "+s,"A "+i+" Id in "+Le),$=`<TId extends ${c}>`,u=e(i,xe+`<${s}[TId]>`,"A "+i+" in "+Le,$),w=e(i+Ze,xe+`<${r}[TId]>`,"A "+i+" in "+Le+He,$),y=e(C,u+"<TId>[Id]","A "+C+" in a "+i,$),T=e(C+Ze,w+"<TId>[Id]","A "+C+" in a "+i+He,$),v=e(g+fe,`Extract<keyof ${y}<TId>, Id>`,"A "+g+" Id in a "+C,$),V=e(g,xe+`<${s}[TId]>[Id][CId]`,"A "+g+" in a "+C,`<TId extends ${c}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,g+" Ids and types in a "+C,`<TId extends ${c}, CId = ${v}<TId>>`,0),k=e(g+ie,`(...[cellId, cell]: ${x}<TId>)`+_e,dt(ce+g+" Id, and "+g),$),S=e(C+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+_e+") "+_e,dt(ce+C+" Id, and a "+g+" iterator"),$),P=e(i+g+ie,`(cellId: ${v}<TId>, count: number) `+_e,dt(ce+g+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${c} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${_e}] : never`,i+" Ids and callback types",`<TId = ${c}>`,0),E=e(i+ie,`(...[tableId, forEachRow]: ${A})`+_e,dt(ce+i+" Id, and a "+C+" iterator"),l),D=e("TableIdRowIdCellIdArray",`TId extends ${c} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${c}>`,0),O=e("GetCellChange",`(...[tableId, rowId, cellId]: ${D}) => CellChange`,$e+" returning information about any Cell's changes during a "+Je),N=e(p+I,`(${d}, getCellChange: ${O}${Ve})`+_e,st(1)),G=e(b+I,`(${d})`+_e,st(2)),L=e(i+I,`(${d}, tableId: ${c}, getCellChange: ${O}${Ve})`+_e,st(3)),j=e(i+f+I,`(${d}, tableId: ${c})`+_e,st(14,3)),M=e(C+"Count"+I,`(${d}, tableId: ${c})`+_e,st(15,3)),J=e(h+I,`(${d}, tableId: ${c})`+_e,st(4,3)),z=e(m+I,"("+At(d,"tableId: "+c,"cellId: Id"+Ve,"descending: boolean","offset: number","limit: number"+Ve,"sortedRowIds: Ids")+")"+_e,st(13,3)),W=e(C+I,"("+At(""+d,"tableId: "+c,Ee,`getCellChange: ${O}${Ve}`)+")"+_e,st(5,3)),B=e(f+I,"("+At(""+d,"tableId: "+c,Ee)+")"+_e,st(6,5)),F=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Ee}, cellId: CId, newCell: ${V}<TId, CId> ${Ve}, oldCell: ${V}<TId, CId> ${Ve}, getCellChange: ${O} ${Ve}] : never`,"Cell args for CellListener",`<TId extends ${c}, CId = ${v}<TId>>`,0),U=e("CellListenerArgsArrayOuter",`TId extends ${c} ? `+F+"<TId> : never","Table args for CellListener",`<TId = ${c}>`,0);return[s,r,c,u,w,y,T,v,V,k,S,P,E,N,G,L,j,M,J,z,W,B,e(g+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${U})`+_e,st(7,5)),e(we+g+I,`(${d}, tableId: Id, ${Ee}, cellId: Id, invalidCells: any[])`+_e,st(8))]},(t,a)=>{const o=t+": "+a,d=e(y,Et(...n(((e,t,a)=>`'${e}'${R(a)?"?":l}: ${t}`))),tt(2,5)),s=e(y+Ze,Et(...n(((e,t)=>`'${e}'?: ${t}`))),tt(2,5,1)),r=e(w+fe,"keyof "+d,"A "+w+" Id in "+Le),c=e(w,xe+`<${d}[VId]>`,"A "+w+" Id in "+Le,`<VId extends ${r}>`),$=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${c}<VId>] : never`,w+" Ids and types in "+Le,`<VId = ${r}>`,0),u=e(w+ie,`(...[valueId, value]: ${$})`+_e,dt(ce+w+" Id, and "+w)),i=e("GetValueChange",`(valueId: ${r}) => ValueChange`,$e+" returning information about any Value's changes during a "+Je),p=e(y+I,`(${o}, getValueChange: ${i}${Ve})`+_e,st(9)),b=e(T+I,`(${o})`+_e,st(10)),C=e("ValueListenerArgsArray",`VId extends ${r} ? [${o}, valueId: VId, newValue: ${c}<VId> ${Ve}, oldValue: ${c}<VId> ${Ve}, getValueChange: ${i} ${Ve}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[d,s,r,c,u,p,b,e(w+I,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+_e,st(11)),e(we+w+I,`(${o}, valueId: Id, invalidValues: any[])`+_e,st(12))]},(t,l)=>e(je+I,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+_e,$e+" listening to the completion of a "+Je)],jt=(e,t=l,a=l)=>`store.${e}(${t})`+(a?" as "+a:l),Mt=(e,t=l)=>`fluent(() => ${jt(e,t)})`,Jt=(e,t=l,a=l)=>`store.${e}(${t?t+", ":l}proxy(listener)${a?", "+a:l})`,zt=(e,a,n)=>{const[d,c,v,V,x,k,P,A]=Ot(),[E,D,O]=Gt(e,a,x),[N,G,M]=Lt(v,E,D,O),J=le(),W=(e=0)=>oe(J,(([t,a,n,o,d],s)=>{const r=e?[s+`: ${d}(${t}): ${a} => ${n},`]:[s+d+`(${t}): ${a};`];return e||B(r,Pt(o)),z(r,l),r})),F=(e,t,a,n,o,d=l)=>Vt(J,e,[t,a,n,o,d]),U=(e,t,a,n,o,d=l,s=l,r=l)=>F(Ct[e]+t+(4==e?Re:l)+a,d,n,(n==H?Mt:jt)(Ct[e]+(4==e?Re:l)+a,s,e?void 0:n),o,r),_=(e,t,a,n=l,o=l,d=1,s=l)=>F($+e+I,(n?n+", ":l)+Te+": "+t+(d?", mutator?: boolean":l),fe,Jt($+e+I,o,d?"mutator":l),a,s),Z=`./${kt(n)}.d`,H=kt(n,1),Q=kt(H),q=[],X=le();let ee=[],te=[];if(c(1,Z,H,`create${H} as create${H}Decl`),K(e))c(null,t,p);else{c(0,t,"CellChange"),c(null,t,u);const[e,a,n,d,I,$,w,y,T,V,k,P,A,O,G,M,J,W,B,F,K,te,ne,oe]=N(Q,H),se=le();E(((e,t)=>{const l=`<'${e}'>`,a=[v(t+i,d+l,Ae+` the '${e}' `+i),v(t+i+Ze,I+l,Ae+` the '${e}' `+i+He),v(t+C,$+l,lt(e)),v(t+C+Ze,w+l,lt(e,1)),v(t+g+fe,y+l,`A Cell Id for the '${e}' `+i),v(t+g+ie,V+l,dt(`a Cell Id and value from a Row in the '${e}' `+i)),v(t+C+ie,k+l,dt(`a Row Id from the '${e}' Table, and a Cell iterator`)),v(t+i+g+ie,P+l,dt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];de(se,e,a),c(1,Z,...a)})),c(1,Z,e,a,n,y,A,O,G,M,J,W,B,F,K,te,ne,oe),ee=[e,a,n,y,O,G,M,J,W,B,F,K,te,ne,se],L([[e],[o],[H,"tables: "+a,"tables"],[H]],(([e,t,a],n)=>U(n,l,p,e,tt(1,n),t,a))),U(0,l,b,n+Ge,at(i,Le)),U(5,l,i,Ue,nt(i,Le),"tableCallback: "+A,"tableCallback as any"),E(((e,t,a)=>{const[n,d,s,r,I,c,$,p]=ae(se,e);L([[n],[o],[H,"table: "+d,", table"],[H]],(([n,o,d=l],s)=>U(s,t,i,n,$t(e,s),o,a+d))),U(0,t,i+f,u,at(g,"the whole of "+It(e)),l,a),U(5,t,i+g,Ue,nt(i+g,"the whole of "+It(e)),"tableCellCallback: "+p,a+", tableCellCallback as any"),U(0,t,C+"Count","number","Gets the number of Rows in the "+It(e),l,a),U(0,t,h,u,at(C,It(e)),l,a),U(0,t,m,u,at(C,It(e),1),"cellId?: "+I+Ne,a+", cellId, descending, offset, limit"),U(5,t,C,Ue,nt(C,It(e)),"rowCallback: "+$,a+", rowCallback as any"),L([[s],[o],[H,", row: "+r,", row"],[H],[H,", partialRow: "+r,", partialRow"]],(([n,o=l,d=l],s)=>U(s,t,C,n,ut(e,s),Ee+o,a+", rowId"+d))),U(6,t,C,fe+Ve,"Add a new Row to "+It(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,t,f,I+Ge,at(g,ct(e)),Ee,a+", rowId"),U(5,t,g,Ue,nt(g,ct(e)),Ee+", cellCallback: "+c,a+", rowId, cellCallback as any"),D(e,((n,d,s,r,I)=>{const c="Map"+kt(d,1);de(X,d,c);const $=d+(R(s)?Ve:l);L([[$],[o],[H,`, cell: ${d} | `+c,", cell as any"],[H]],(([o,d=l,s=l],c)=>U(c,t+I,g,o,it(e,n,c),Ee+d,a+", rowId, "+r+s))),U(1,t+I,i+g,o,bt[1]+` the '${n}' Cell anywhere in `+It(e),l,a+", "+r)}))})),U(0,l,p+ye,ye,tt(1,6)),U(2,l,p+ye,H,tt(1,7),"tablesJson: "+ye,"tables"+ye),_(p,O,tt(1,8)+" changes"),_(b,G,rt(2,0,1)),_(i,M,rt(3,0),`tableId: ${n} | null`,"tableId"),_(i+f,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(C+"Count",W,rt(15,3),`tableId: ${n} | null`,"tableId"),_(h,B,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,F,rt(13,3,1),At("tableId: TId",`cellId: ${y}<TId>`+Ve,"descending: boolean","offset: number","limit: number"+Ve),At("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(C,K,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,te,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(g,ne,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${j(E((e=>ae(se,e)?.[4]??l))," | ")} | null`,"tableId, rowId, cellId"),_(we+g,oe,Pe+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),c(1,Z,...Y(X)),z(q,".set"+p+De+"({",Rt(E(((e,t,a)=>[`[${a}]: {`,...D(e,((e,t,a,n)=>`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${R(a)?l:`, [${x(St(r),`'${r}'`)}]: `+(S(a)?x(St(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(K(a))c(null,t,y);else{const[e,a,n,d,I,$,u,i,p]=G(Q,H);c(1,Z,e,a,n,I,$,u,i,p),te=[e,a,n,$,u,i],L([[e],[o],[H,"values: "+a,"values"],[H],[H,"partialValues: "+a,"partialValues"]],(([e,t,a],n)=>U(n,l,y,e,tt(2,n),t,a))),U(0,l,T,n+Ge,at(w,Le)),U(5,l,w,"void",nt(w,Le),"valueCallback: "+I,"valueCallback as any"),O(((e,t,a,n,d)=>{const s="Map"+kt(t,1);de(X,t,s),L([[t],[o],[H,`value: ${t} | `+s,", value as any"],[H]],(([t,a,o=l],s)=>U(s,d,w,t,pt(e,s),a,n+o)))})),U(0,l,y+ye,ye,tt(2,6)),U(2,l,y+ye,H,tt(2,7),"valuesJson: "+ye,"values"+ye),_(y,$,tt(2,8)+" changes"),_(T,u,rt(10,0,1)),_(w,i,rt(11,0),`valueId: ${n} | null`,"valueId"),_(we+w,p,Pe+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),c(1,Z,...Y(X)),c(0,t,"ValueChange"),z(q,".set"+y+De+"({",O(((e,t,a,n)=>[`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${R(a)?l:`, [${x(St(r),`'${r}'`)}]: `+(S(a)?x(St(a),`'${a}'`):a)}},`])),"})")}U(0,l,"Content",`[${p}, ${y}]`,tt(0,0)),U(2,l,"Content",H,tt(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,l,Me,H,`Applies a set of ${Me} to the Store`,"transactionChanges: "+Me,"transactionChanges"),ne(X,((e,t)=>v(t,`(cell: ${e}${Ve}) => `+e,`Takes a ${e} Cell value and returns another`))),c(null,t,"DoRollback",fe,"IdOrNull",ye,"Store",Me),c(0,t,"Get"+Me,"GetTransactionLog"),U(0,l,ye,ye,tt(0,6)),U(2,l,ye,H,tt(0,7),"tablesAndValuesJson: "+ye,"tablesAndValuesJson"),U(7,l,Je,"Return",ze,me,"actions, doRollback","<Return>"),U(7,l,"start"+je,H,We),U(7,l,"finish"+je,H,Be,he,"doRollback");const se=M(Q,H);return _("Start"+je,se,Pe+" just before the start of the "+Je,l,l,0),_("WillFinish"+je,se,Pe+" just before "+Fe,l,l,0),_("DidFinish"+je,se,Pe+" just after "+Fe,l,l,0),U(7,l,"call"+I,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,l,I,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",l,"Store","store",bt[0]+" the underlying Store object"),c(1,t,"createStore"),c(1,Z,H,`create${H} as create${H}Decl`,se),x("store",["createStore()",...q]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...W(1),"}"]),[d(...k(0),...P(),ge+" interface "+H+" {",...W(0),"}",l,Pt(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),d(...k(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${Q});`,"};"),ee,te]},Wt=e=>c+e,Bt=e=>At(Wt(e),Wt(e)+be),Ft="debugIds?: boolean",Ut="debugIds={debugIds}",_t="then"+Ce,Zt="Parameter",Ht=": (parameter: "+Zt+", store: Store) => ",Qt="const contextValue = useContext(Context);",qt=", based on a parameter",Kt=": ",Xt="<"+Zt+",>",Yt=Zt+"ized"+ie+"<"+Zt+">",el="rowId",tl="rowId={rowId}",ll=", separator, debugIds",al="separator?: ReactElement | string",nl="then?: (store: Store",ol=At(nl+")"+_e,_t),dl="then, then"+be,sl=el+Kt+fe,rl="View",Il=(e,...t)=>At(...t,Te+": "+e,Te+Ce,"mutator?: boolean"),cl=(...e)=>At(...e,Te,Te+be,"mutator"),$l=(e,a,n,o,d)=>{const[s,r,c,$,v,V,x,k]=Ot(),[S,P,A]=Gt(e,a,v),E=`./${kt(n)}.d`,D=`./${kt(n)}-ui-react.d`,O="tinybase/ui-react",N=kt(n,1),G=kt(N),L=N+"Or"+N+fe,M=G+"Or"+N+fe,J=G+`={${G}}`,W=le(),F=(e,t,a,n,o,d=l)=>(r(1,D,e+" as "+e+"Decl"),Vt(W,e,[t,a,n,o,d])),U=(e,t,a,n,o,d=l)=>F("use"+e,t,a,n,o,d),_=(e,t,a,n,o=l,d=l,s=l,I=l,c=l)=>(r(1,O,`use${t} as use${t}Core`),U(e,At(o,X,I),a,ee+`(${M}, use${t}Core, [`+(d||l)+(c?"], ["+c:l)+"]);",n,s)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>oe(W,(([t,a,n,o,d],s)=>{const r=e?[ge+` const ${s}: typeof ${s}Decl = ${d}(${t}): ${1==a?"any":a} =>`,n]:[ge+` function ${s}${d}(${t}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Pt(o)),z(r,l),r}));r(null,t,fe,"Store",ie,Zt+"ized"+ie),r(0,O,"ComponentReturnType"),r(1,O,"useCellIds"),r(null,O,"ExtraProps"),r(0,E,N);const Q=c(L,N+" | "+fe,`Used when you need to refer to a ${N} in a React hook or component`),q=c(Se+ke,Dt(G+ve+N,G+`ById?: {[${G}Id: Id]: ${N}}`),`Used with the ${Se} component, so that a `+N+" can be passed into the context of an application");r(0,"react","ReactElement","ComponentType"),r(1,"react","React"),r(1,D,Q,q);const X=M+ve+Q;v("{createContext, useContext, useMemo}","React"),v("Context",`createContext<[${N}?, {[${G}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+Ce,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=U(N,"id?: Id",N+Ve,["{",Qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Se} component context`),ee=$("useHook",M+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${M} as Id);`,`return hook(...preParams, ((${M} == null || typeof ${M} == 'string')`,`? ${G} : ${M})?.getStore(), ...postParams)`]),te=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),ne=$("wrap",At("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("useCustomOrDefaultCellIds",At("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${M}?: ${Q} | undefined`),[`const defaultCellIds = ${ee}(${M}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),se=v("NullComponent","() => null");if(!K(e)){const[e,a,n,d,s,w,y,T,v,V,x,k,A,O,L]=o;r(null,E,e,a,n,s,w,y,T,v,V,x,k,A,O),r(0,E,d),r(1,E,N),r(null,t,u,"IdOrNull");const M=$("tableView",`{${G}, rowComponent, getRowComponentProps, customCellIds`+ll+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${ne}(rowIds.map((rowId) => (`,"<Row","{..."+te+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",tl,"customCellIds={customCellIds}",J,Ut,"/>","))",ll,", tableId,",");"]),z=$("getDefaultTableComponent","tableId: Id",j(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+se),W=$("getDefaultCellComponent","tableId: Id, cellId: Id",j(S(((e,t,l)=>`tableId == ${l} ? ${j(P(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+se} : `)))+se);_(p,p,e,tt(1,0)+ue);const B=_(b,b,n+Ge,at(i,Le)+ue);_(Oe+p+ie,Oe+p+ie,Yt,tt(1,9)+qt,At(Wt(p)+Ht+a,Wt(p)+Ce),Bt(p),Xt,At(nl,`tables: ${a})`+_e,_t),dl),_(pe+p+ie,pe+p+ie,ie,tt(1,12),l,l,l,ol,dl);const F=c(g+ke,Dt("tableId?: TId","rowId: Id","cellId?: CId",G+ve+N,Ft),ot(ce+g),`<TId extends ${n}, CId extends ${d}<TId>>`),U=c(C+ke,Dt("tableId?: TId","rowId: Id",G+ve+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${F}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,al,Ft),ot(ce+C),`<TId extends ${n}>`),H=c(i+ke,Dt("tableId?: TId",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),ot(ce+i),`<TId extends ${n}>`),Q=c("Sorted"+i+ke,Dt("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ve+N,`rowComponent?: ComponentType<${U}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",al,Ft),ot(ce+"sorted "+i),`<TId extends ${n}>`),q=c(p+ke,Dt(G+ve+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${H}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,al,Ft),ot(et(1,1)));r(1,D,q,H,Q,U,F),Z(p+rl,"{"+G+", tableComponents, getTableComponentProps"+ll+"}: "+q,[ne+`(${B}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+z+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${te}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",J,Ut,"/>;","}), separator)"],tt(1,13)+ue),S(((e,t,a)=>{const[n,o,d,s,I]=ae(L,e);r(null,E,n,o,d,s,I),_(t+i,i,n,$t(e)+ue,l,a),_(t+i+f,i+f,u,at(g,"the whole of "+It(e))+ue,l,a);const c=_(t+h,h,u,at(C,It(e))+ue,l,a),$=_(t+m,m,u,at(C,It(e),1)+ue,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");_(t+C,C,d,ut(e)+ue,sl,At(a,el)),_(t+f,f,I+Ge,at(g,ct(e))+ue,sl,At(a,el)),_(Oe+t+i+ie,Oe+i+ie,Yt,$t(e,9)+qt,At(Wt(i)+Ht+o,Wt(i)+Ce),At(a,Bt(i)),Xt,At(nl,`table: ${o})`+_e,_t),dl),_(pe+t+i+ie,pe+i+ie,ie,$t(e,12),l,a,l,ol,dl),_(Oe+t+C+ie,Oe+C+ie,Yt,ut(e,9)+qt,At(sl,Wt(C)+Ht+s,Wt(C)+Ce),At(a,el,Bt(C)),Xt,At(nl,`row: ${s})`+_e,_t),dl),_("Add"+t+C+ie,"Add"+C+ie,Yt,ut(e,10)+qt,At(Wt(C)+Ht+s,Wt(C)+Ce),At(a,Bt(C)),Xt,"then?: ("+At(sl+Ve,"store: Store","row: "+s+")"+_e,"then"+Ce)+", reuseRowIds?: boolean",dl+", reuseRowIds"),_(Oe+t+Re+C+ie,Oe+Re+C+ie,Yt,ut(e,11)+qt,At(sl,Wt(Re+C)+Ht+s,Wt(Re+C)+Ce),At(a,el,Bt(Re+C)),Xt,At(nl,`partialRow: ${s})`+_e,_t),dl),_(pe+t+C+ie,pe+C+ie,ie,ut(e,12),sl,At(a,el),l,ol,dl);const p=Z(t+C+rl,"{rowId, "+G+", cellComponents, getCellComponentProps, customCellIds"+ll+`}: ${U}<'${e}'>`,[ne+`(${de}(customCellIds, `+a+`, rowId, ${G}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+W+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${te}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,tl,"cellId={cellId}",J,Ut,"/>;","})"+ll+", rowId)"],ut(e,13)+ue);Z(t+"Sorted"+i+rl,"{cellId, descending, offset, limit, ...props}: "+Q+`<'${e}'>`,M+"(props, "+$+`(cellId, descending, offset, limit, props.${G}), ${a}, ${p});`,$t(e,13)+", sorted"+ue),Z(t+i+rl,`props: ${H}<'${e}'>`,M+"(props, "+c+`(props.${G}), ${a}, ${p});`,$t(e,13)+ue),P(e,((n,o,d,s,I)=>{const c="Map"+kt(o,1);r(0,E,c),r(1,E,c);const $=_(t+I+g,g,o+(R(d)?Ve:l),it(e,n)+ue,sl,At(a,el,s));_(Oe+t+I+g+ie,Oe+g+ie,Yt,it(e,n,9)+qt,At(sl,Wt(g)+Ht+o+" | "+c,Wt(g)+Ce),At(a,el,s,Bt(g)),Xt,At(nl,`cell: ${o} | ${c})`+_e,_t),dl),_(pe+t+I+g+ie,pe+g+ie,ie,it(e,n,12),At(sl,"forceDel?: boolean"),At(a,el,s,"forceDel"),l,ol,dl),Z(t+I+g+rl,`{rowId, ${G}, debugIds}: `+F+`<'${e}', '${n}'>`,[ne+`('' + ${$}(rowId, `+G+`) ?? '', undefined, debugIds, ${s})`],it(e,n,13)+ue)}))}));const K=j(S((e=>ae(L,e)?.[4]??l))," | ");_(p+I,p+I,Ue,tt(1,8)+" changes",Il(s),cl()),_(b+I,b+I,Ue,rt(2,0,1),Il(w),cl()),_(i+I,i+I,Ue,rt(3,0),Il(y,`tableId: ${n} | null`),cl("tableId")),_(i+f+I,i+f+I,Ue,rt(14,3,1),Il(T,`tableId: ${n} | null`),cl("tableId")),_(h+I,h+I,Ue,rt(4,3,1),Il(V,`tableId: ${n} | null`),cl("tableId")),_(m+I,m+I,Ue,rt(13,3,1),Il(x,`tableId: ${n} | null`,"cellId: "+K+Ve,"descending: boolean","offset: number","limit: number"+Ve),cl("tableId","cellId","descending","offset","limit")),_(C+I,C+I,Ue,rt(5,3),Il(k,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(f+I,f+I,Ue,rt(6,5,1),Il(A,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(g+I,g+I,Ue,rt(7,5),Il(O,`tableId: ${n} | null`,el+": IdOrNull",`cellId: ${K} | null`),cl("tableId",el,"cellId"))}if(!K(a)){const[e,t,a,n,o,s]=d;r(null,E,...d),r(1,E,N);const u=$("getDefaultValueComponent","valueId: Id",j(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+se);_(y,y,e,tt(2,0)+ue);const i=_(T,T,a+Ge,at(w,Le)+ue);_(Oe+y+ie,Oe+y+ie,Yt,tt(2,9)+qt,At(Wt(y)+Ht+t,Wt(y)+Ce),Bt(y),Xt,At(nl,`values: ${t})`+_e,_t),dl),_(Oe+Re+y+ie,Oe+Re+y+ie,Yt,tt(2,11)+qt,At(Wt(Re+y)+Ht+t,Wt(Re+y)+Ce),Bt(Re+y),Xt,At(nl,`partialValues: ${t})`+_e,_t),dl),_(pe+y+ie,pe+y+ie,ie,tt(2,12),l,l,l,ol,dl);const p=c(w+ke,Dt("valueId?: VId",G+ve+N,Ft),ot("a Value"),`<VId extends ${a}>`),b=c(y+ke,Dt(G+ve+N,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,al,Ft),ot(et(2,1)));r(1,D,b,p),Z(y+rl,"{"+G+", valueComponents, getValueComponentProps"+ll+"}: "+b,[ne+`(${i}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+u+"(valueId);","return <Value",`{...${te}(getValueComponentProps, valueId)}`,"key={valueId}",J,Ut,"/>;","}), separator)"],tt(2,13)+ue),A(((e,t,a,n,o)=>{const d="Map"+kt(t,1);r(0,E,d),r(1,E,d);const s=_(o+w,w,t,pt(e)+ue,l,n);_(Oe+o+w+ie,Oe+w+ie,Yt,pt(e,9)+qt,At(Wt(w)+Ht+t+" | "+d,Wt(w)+Ce),At(n,Bt(w)),Xt,At(nl,`value: ${t} | ${d})`+_e,_t),dl),_(pe+o+w+ie,pe+w+ie,ie,pt(e,12),l,n,l,ol,dl),Z(o+w+rl,`{${G}, debugIds}: ${p}<'${e}'>`,[ne+`('' + ${s}(`+G+`) ?? '', undefined, debugIds, ${n})`],pt(e,13)+ue)})),_(y+I,y+I,Ue,tt(2,8)+" changes",Il(n),cl()),_(T+I,T+I,Ue,rt(10,0,1),Il(o),cl()),_(w+I,w+I,Ue,rt(11,0),Il(s,`valueId: ${a} | null`),cl("valueId"))}return Z(Se,`{${G}, ${G}ById, children}: `+q+" & {children: React.ReactNode}",["{",Qt,"return (","<Context."+Se,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${Se}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[s(...V(0),...x(),...H(0)),s(...V(1),...k(),...H(1))]},ul=(e,t,a)=>{if(K(e)&&K(t))return[l,l,l,l];const[n,o,d,s]=zt(e,t,a);return[n,o,...$l(e,t,a,d,s)]},il=JSON.parse,pl="prettier/",bl=pl+"plugins/",Cl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},hl=Nt((e=>{const t=()=>{const t=il(e.getTablesSchemaJson());return!K(t)||N(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=le();if(N(a,(t=>N(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=se(n,a,(()=>[O(o),le(),[0],0])),[s,r,[I]]=d,c=se(r,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),de(r,o,c),d[3]++,s==O(o)})))))return t[l]={},ee(n,(([e,,[,n],o],d)=>{t[l][d]={[s]:e,...o==E(a)?{[r]:n}:{}}})),1}))?t:{}},l=()=>{const t=il(e.getValuesSchemaJson());return K(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:O(l)}})),t},a=e=>ul(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"],l=[];let n;try{n=(await import(pl+"standalone")).format,z(l,await import(bl+"estree"),await import(bl+"typescript"))}catch(e){n=async e=>e}return await D(M(a(e),(async(e,a)=>xt(await n(e,{...Cl,plugins:l,filepath:"_."+t[a]})))))};return Z({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let s=0,r=0;const I={};d(((e,l)=>{s++;let a=0;l((()=>a++)),r+=a,t&&(I[e]={rowCells:a})})),a+=s,n+=r,t&&(o[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{hl as createTools};
|
package/lib/tools.js.gz
CHANGED
|
Binary file
|
|
@@ -23,6 +23,45 @@ import PartySocket from 'partysocket';
|
|
|
23
23
|
import {Persister} from '../persisters';
|
|
24
24
|
import {Store} from '../store';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The PartyKitPersisterConfig type describes the configuration of a PartyKit
|
|
28
|
+
* Persister on the client side.
|
|
29
|
+
*
|
|
30
|
+
* The defaults (if used on both the server and client) will work fine, but if
|
|
31
|
+
* you are building more complex PartyKit apps and you need to configure path
|
|
32
|
+
* names, for example, then this is the thing to use.
|
|
33
|
+
* @example
|
|
34
|
+
* When applied to a PartyKit Persister, this PartyKitPersisterConfig will load
|
|
35
|
+
* and save a JSON serialization from and to an end point in your room called
|
|
36
|
+
* `/my_tinybase`, and use HTTP (rather than the default HTTPS) as the protocol.
|
|
37
|
+
*
|
|
38
|
+
* Note that this would require you to also add the matching storePath setting
|
|
39
|
+
* to the TinyBasePartyKitServerConfig on the server side.
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* const partyKitPersisterConfig: PartyKitPersisterConfig = {
|
|
43
|
+
* storeProtocol: 'http',
|
|
44
|
+
* storePath: '/my_tinybase',
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
* @category Configuration
|
|
48
|
+
* @since v4.3.9
|
|
49
|
+
*/
|
|
50
|
+
export type PartyKitPersisterConfig = {
|
|
51
|
+
/**
|
|
52
|
+
* The HTTP protocol to use (in addition to the websocket channel). This
|
|
53
|
+
* defaults to 'https' but you may wish to use 'http' for local PartyKit
|
|
54
|
+
* development.
|
|
55
|
+
*/
|
|
56
|
+
storeProtocol?: 'http' | 'https';
|
|
57
|
+
/**
|
|
58
|
+
* The path used to set and get the whole Store over HTTP(S) on the server.
|
|
59
|
+
* This must match the storePath property of the TinyBasePartyKitServerConfig
|
|
60
|
+
* object on the server. Both default to '/store'.
|
|
61
|
+
*/
|
|
62
|
+
storePath?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
26
65
|
/**
|
|
27
66
|
* The createPartyKitPersister function creates a Persister object that can
|
|
28
67
|
* persist the Store to durable PartyKit storage, enabling synchronization of
|
|
@@ -52,9 +91,9 @@ import {Store} from '../store';
|
|
|
52
91
|
* @param store The Store to persist.
|
|
53
92
|
* @param connection The PartySocket to use for participating in the PartyKit
|
|
54
93
|
* room.
|
|
55
|
-
* @param
|
|
56
|
-
*
|
|
57
|
-
*
|
|
94
|
+
* @param configOrStoreProtocol The PartyKitPersisterConfig configuration for
|
|
95
|
+
* the Persister, (or a string to specify a HTTP protocol to use, defaulting to
|
|
96
|
+
* 'https').
|
|
58
97
|
* @param onIgnoredError An optional handler for the errors that the Persister
|
|
59
98
|
* would otherwise ignore when trying to save or load data. This is suitable for
|
|
60
99
|
* debugging persistence issues in a development environment.
|
|
@@ -83,6 +122,6 @@ import {Store} from '../store';
|
|
|
83
122
|
export function createPartyKitPersister(
|
|
84
123
|
store: Store,
|
|
85
124
|
connection: PartySocket,
|
|
86
|
-
|
|
125
|
+
configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
|
|
87
126
|
onIgnoredError?: (error: any) => void,
|
|
88
127
|
): Persister;
|
|
@@ -20,6 +20,65 @@
|
|
|
20
20
|
|
|
21
21
|
import {Connection, Party, Request, Server} from 'partykit/server';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The TinyBasePartyKitServerConfig type describes the configuration of a
|
|
25
|
+
* PartyKit Persister on the server side.
|
|
26
|
+
*
|
|
27
|
+
* The defaults (if used on both the server and client) will work fine, but if
|
|
28
|
+
* you are building more complex PartyKit apps and you need to configure path
|
|
29
|
+
* names, for example, then this is the type to use.
|
|
30
|
+
* @example
|
|
31
|
+
* When set as the config in a TinyBasePartyKitServer, this
|
|
32
|
+
* TinyBasePartyKitServerConfig will expect clients to load and save their JSON
|
|
33
|
+
* serialization from and to an end point in the room called `/my_tinybase`.
|
|
34
|
+
* Note that this would require you to also add the matching storePath setting
|
|
35
|
+
* to the PartyKitPersisterConfig on the client side.
|
|
36
|
+
*
|
|
37
|
+
* It will also store the data in the durable storage with a prefix of
|
|
38
|
+
* 'tinybase_' in case you are worried about colliding with other data stored
|
|
39
|
+
* in the room.
|
|
40
|
+
*
|
|
41
|
+
* ```js yolo
|
|
42
|
+
* export default class extends TinyBasePartyServer {
|
|
43
|
+
* readonly config: TinyBasePartyKitServerConfig = {
|
|
44
|
+
* storePath: '/my_tinybase',
|
|
45
|
+
* storagePrefix: 'tinybase_',
|
|
46
|
+
* };
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
* @category Configuration
|
|
50
|
+
* @since v4.3.9
|
|
51
|
+
*/
|
|
52
|
+
export type TinyBasePartyKitServerConfig = {
|
|
53
|
+
/**
|
|
54
|
+
* The path used to set and get the whole Store over HTTP(S) on the server.
|
|
55
|
+
* This must match the storePath property of the PartyKitPersisterConfig used
|
|
56
|
+
* on the client. Both default to '/store'.
|
|
57
|
+
*/
|
|
58
|
+
storePath?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The prefix used before all the keys in the server's durable storage. Use
|
|
61
|
+
* this in case you are worried about the Store data colliding with other data
|
|
62
|
+
* stored in the room. Defaults to an empty string.
|
|
63
|
+
*/
|
|
64
|
+
storagePrefix?: string;
|
|
65
|
+
/**
|
|
66
|
+
* An object containing the extra HTTP(S) headers returned to the client from
|
|
67
|
+
* this server. This defaults to the following three headers to allow CORS:
|
|
68
|
+
*
|
|
69
|
+
* ```
|
|
70
|
+
* Access-Control-Allow-Origin: *
|
|
71
|
+
* Access-Control-Allow-Methods: *
|
|
72
|
+
* Access-Control-Allow-Headers: *
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* If you set this field, it will override the default completely. So, for
|
|
76
|
+
* example, if you add another header but still want the CORS defaults, you
|
|
77
|
+
* will need to explicitly set the Access-Control-Allow headers above again.
|
|
78
|
+
*/
|
|
79
|
+
responseHeaders?: HeadersInit;
|
|
80
|
+
};
|
|
81
|
+
|
|
23
82
|
/**
|
|
24
83
|
* A TinyBasePartyKitServer is the server component for persisting the Store to
|
|
25
84
|
* durable PartyKit storage, enabling synchronization of the same Store across
|
|
@@ -68,6 +127,13 @@ import {Connection, Party, Request, Server} from 'partykit/server';
|
|
|
68
127
|
*/
|
|
69
128
|
export class TinyBasePartyKitServer implements Server {
|
|
70
129
|
constructor(party: Party);
|
|
130
|
+
/**
|
|
131
|
+
* The config property is used to optionally configure the server, using an
|
|
132
|
+
* object of the TinyBasePartyKitServerConfig type.
|
|
133
|
+
*
|
|
134
|
+
* See the documentation for that type for more details.
|
|
135
|
+
*/
|
|
136
|
+
readonly config: TinyBasePartyKitServerConfig;
|
|
71
137
|
/**
|
|
72
138
|
* The onRequest method is called when a HTTP request is made to the party
|
|
73
139
|
* URL.
|
|
@@ -23,6 +23,45 @@ import {OptionalSchemas, Store} from '../store';
|
|
|
23
23
|
import PartySocket from 'partysocket';
|
|
24
24
|
import {Persister} from '../persisters';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The PartyKitPersisterConfig type describes the configuration of a PartyKit
|
|
28
|
+
* Persister on the client side.
|
|
29
|
+
*
|
|
30
|
+
* The defaults (if used on both the server and client) will work fine, but if
|
|
31
|
+
* you are building more complex PartyKit apps and you need to configure path
|
|
32
|
+
* names, for example, then this is the thing to use.
|
|
33
|
+
* @example
|
|
34
|
+
* When applied to a PartyKit Persister, this PartyKitPersisterConfig will load
|
|
35
|
+
* and save a JSON serialization from and to an end point in your room called
|
|
36
|
+
* `/my_tinybase`, and use HTTP (rather than the default HTTPS) as the protocol.
|
|
37
|
+
*
|
|
38
|
+
* Note that this would require you to also add the matching storePath setting
|
|
39
|
+
* to the TinyBasePartyKitServerConfig on the server side.
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* const partyKitPersisterConfig: PartyKitPersisterConfig = {
|
|
43
|
+
* storeProtocol: 'http',
|
|
44
|
+
* storePath: '/my_tinybase',
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
* @category Configuration
|
|
48
|
+
* @since v4.3.9
|
|
49
|
+
*/
|
|
50
|
+
export type PartyKitPersisterConfig = {
|
|
51
|
+
/**
|
|
52
|
+
* The HTTP protocol to use (in addition to the websocket channel). This
|
|
53
|
+
* defaults to 'https' but you may wish to use 'http' for local PartyKit
|
|
54
|
+
* development.
|
|
55
|
+
*/
|
|
56
|
+
storeProtocol?: 'http' | 'https';
|
|
57
|
+
/**
|
|
58
|
+
* The path used to set and get the whole Store over HTTP(S) on the server.
|
|
59
|
+
* This must match the storePath property of the TinyBasePartyKitServerConfig
|
|
60
|
+
* object on the server. Both default to '/store'.
|
|
61
|
+
*/
|
|
62
|
+
storePath?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
26
65
|
/**
|
|
27
66
|
* The createPartyKitPersister function creates a Persister object that can
|
|
28
67
|
* persist the Store to durable PartyKit storage, enabling synchronization of
|
|
@@ -34,7 +73,7 @@ import {Persister} from '../persisters';
|
|
|
34
73
|
* createPartyKitPersister(
|
|
35
74
|
* store: Store,
|
|
36
75
|
* connection: PartySocket,
|
|
37
|
-
*
|
|
76
|
+
* configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
|
|
38
77
|
* onIgnoredError?: (error: any) => void,
|
|
39
78
|
* ): Persister;
|
|
40
79
|
* ```
|
|
@@ -63,9 +102,9 @@ import {Persister} from '../persisters';
|
|
|
63
102
|
* @param store The Store to persist.
|
|
64
103
|
* @param connection The PartySocket to use for participating in the PartyKit
|
|
65
104
|
* room.
|
|
66
|
-
* @param
|
|
67
|
-
*
|
|
68
|
-
*
|
|
105
|
+
* @param configOrStoreProtocol The PartyKitPersisterConfig configuration for
|
|
106
|
+
* the Persister, (or a string to specify a HTTP protocol to use, defaulting to
|
|
107
|
+
* 'https').
|
|
69
108
|
* @param onIgnoredError An optional handler for the errors that the Persister
|
|
70
109
|
* would otherwise ignore when trying to save or load data. This is suitable for
|
|
71
110
|
* debugging persistence issues in a development environment.
|
|
@@ -94,6 +133,6 @@ import {Persister} from '../persisters';
|
|
|
94
133
|
export function createPartyKitPersister<Schemas extends OptionalSchemas>(
|
|
95
134
|
store: Store<Schemas>,
|
|
96
135
|
connection: PartySocket,
|
|
97
|
-
|
|
136
|
+
configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
|
|
98
137
|
onIgnoredError?: (error: any) => void,
|
|
99
138
|
): Persister<Schemas>;
|
|
@@ -20,6 +20,65 @@
|
|
|
20
20
|
|
|
21
21
|
import {Connection, Party, Request, Server} from 'partykit/server';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The TinyBasePartyKitServerConfig type describes the configuration of a
|
|
25
|
+
* PartyKit Persister on the server side.
|
|
26
|
+
*
|
|
27
|
+
* The defaults (if used on both the server and client) will work fine, but if
|
|
28
|
+
* you are building more complex PartyKit apps and you need to configure path
|
|
29
|
+
* names, for example, then this is the type to use.
|
|
30
|
+
* @example
|
|
31
|
+
* When set as the config in a TinyBasePartyKitServer, this
|
|
32
|
+
* TinyBasePartyKitServerConfig will expect clients to load and save their JSON
|
|
33
|
+
* serialization from and to an end point in the room called `/my_tinybase`.
|
|
34
|
+
* Note that this would require you to also add the matching storePath setting
|
|
35
|
+
* to the PartyKitPersisterConfig on the client side.
|
|
36
|
+
*
|
|
37
|
+
* It will also store the data in the durable storage with a prefix of
|
|
38
|
+
* 'tinybase_' in case you are worried about colliding with other data stored
|
|
39
|
+
* in the room.
|
|
40
|
+
*
|
|
41
|
+
* ```js yolo
|
|
42
|
+
* export default class extends TinyBasePartyServer {
|
|
43
|
+
* readonly config: TinyBasePartyKitServerConfig = {
|
|
44
|
+
* storePath: '/my_tinybase',
|
|
45
|
+
* storagePrefix: 'tinybase_',
|
|
46
|
+
* };
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
* @category Configuration
|
|
50
|
+
* @since v4.3.9
|
|
51
|
+
*/
|
|
52
|
+
export type TinyBasePartyKitServerConfig = {
|
|
53
|
+
/**
|
|
54
|
+
* The path used to set and get the whole Store over HTTP(S) on the server.
|
|
55
|
+
* This must match the storePath property of the PartyKitPersisterConfig used
|
|
56
|
+
* on the client. Both default to '/store'.
|
|
57
|
+
*/
|
|
58
|
+
storePath?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The prefix used before all the keys in the server's durable storage. Use
|
|
61
|
+
* this in case you are worried about the Store data colliding with other data
|
|
62
|
+
* stored in the room. Defaults to an empty string.
|
|
63
|
+
*/
|
|
64
|
+
storagePrefix?: string;
|
|
65
|
+
/**
|
|
66
|
+
* An object containing the extra HTTP(S) headers returned to the client from
|
|
67
|
+
* this server. This defaults to the following three headers to allow CORS:
|
|
68
|
+
*
|
|
69
|
+
* ```
|
|
70
|
+
* Access-Control-Allow-Origin: *
|
|
71
|
+
* Access-Control-Allow-Methods: *
|
|
72
|
+
* Access-Control-Allow-Headers: *
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* If you set this field, it will override the default completely. So, for
|
|
76
|
+
* example, if you add another header but still want the CORS defaults, you
|
|
77
|
+
* will need to explicitly set the Access-Control-Allow headers above again.
|
|
78
|
+
*/
|
|
79
|
+
responseHeaders?: HeadersInit;
|
|
80
|
+
};
|
|
81
|
+
|
|
23
82
|
/**
|
|
24
83
|
* A TinyBasePartyKitServer is the server component for persisting the Store to
|
|
25
84
|
* durable PartyKit storage, enabling synchronization of the same Store across
|
|
@@ -68,6 +127,13 @@ import {Connection, Party, Request, Server} from 'partykit/server';
|
|
|
68
127
|
*/
|
|
69
128
|
export class TinyBasePartyKitServer implements Server {
|
|
70
129
|
constructor(party: Party);
|
|
130
|
+
/**
|
|
131
|
+
* The config property is used to optionally configure the server, using an
|
|
132
|
+
* object of the TinyBasePartyKitServerConfig type.
|
|
133
|
+
*
|
|
134
|
+
* See the documentation for that type for more details.
|
|
135
|
+
*/
|
|
136
|
+
readonly config: TinyBasePartyKitServerConfig;
|
|
71
137
|
/**
|
|
72
138
|
* The onRequest method is called when a HTTP request is made to the party
|
|
73
139
|
* URL.
|
package/lib/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",I="Ids",i="Table",u=i+"s",l=i+I,c="Row",a=c+"Count",p=c+I,g="Sorted"+c+I,b="Cell",C=b+I,m="Value",k=m+"s",w=m+I,y=e=>null==e,h=(e,t,o)=>y(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),P=Object.keys,{createContext:f,useContext:x}=e,S=f([]),L=(e,t)=>{const o=x(S);return y(e)?o[t]:R(e)?((e,t)=>h(e,(e=>e[t])))(o[t+1]??{},e):e},B=(e,t)=>{const o=L(e,t);return y(e)||R(e)?o:e},T=e=>P(x(S)[e]??{}),M=e=>L(e,0),F=e=>B(e,0),E=e=>L(e,2),V=e=>B(e,2),A=e=>L(e,4),j=e=>B(e,4),D=e=>L(e,6),O=e=>B(e,6),Q=e=>L(e,8),W=e=>B(e,8),z=e=>L(e,10),G=e=>B(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},$=(e,t,o,s=[],r)=>{const[,d]=Y(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=Y(n),i=X(I);return U((()=>i.current=n()),[n]),_(e,t,((...e)=>{i.current=y(r)?n():e[r],d([])}),[],s),i.current},_=(e,t,o,s=[],r=[],...n)=>N((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,...r,...s,...n]),ee=(e,t,o,s=[],r=v,d=[],...n)=>{const I=F(e);return K((e=>h(I,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},te=(e,t,o=v,s=[],...r)=>{const d=F(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},oe=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},se=(e,t=[])=>U(e,t),re=()=>T(1),de=e=>$(u,F(e),{}),ne=e=>$(l,F(e),[],[]),Ie=(e,t)=>$(i,F(t),{},[e]),ie=(e,t)=>$(i+C,F(t),[],[e]),ue=(e,t)=>$(a,F(t),[],[e]),le=(e,t)=>$(p,F(t),[],[e]),ce=(e,t,o,s=0,r,d)=>$(g,F(d),[],[e,t,o,s,r],6),ae=(e,t,o)=>$(c,F(o),{},[e,t]),pe=(e,t,o)=>$(C,F(o),[],[e,t]),ge=(e,t,o,s)=>$(b,F(s),void 0,[e,t,o],4),be=e=>$(k,F(e),{}),Ce=e=>$(w,F(e),[],[]),me=(e,t)=>$(m,F(t),void 0,[e]),ke=(e,t,o,s,r)=>ee(o,u,e,t,s,r),we=(e,t,o,s,r,d)=>ee(s,i,t,o,r,d,e),ye=(e,t,o,s,r,d,n)=>ee(r,c,o,s,d,n,e,t),he=(e,t,o=[],s,r=v,d=[],n=!0)=>{const I=F(s);return K((o=>h(I,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},Re=(e,t,o,s,r,d,n)=>ee(r,"PartialRow",o,s,d,n,e,t),ve=(e,t,o,s,r,d,n,I)=>ee(d,b,s,r,n,I,e,t,o),qe=(e,t,o,s,r)=>ee(o,k,e,t,s,r),Pe=(e,t,o,s,r)=>ee(o,"PartialValues",e,t,s,r),fe=(e,t,o,s,r,d)=>ee(s,m,t,o,r,d,e),xe=(e,t,o)=>te(e,u,t,o),Se=(e,t,o,s)=>te(t,i,o,s,e),Le=(e,t,o,s,r)=>te(o,c,s,r,e,t),Be=(e,t,o,s,r,d,n)=>te(r,b,d,n,e,t,o,s),Te=(e,t,o)=>te(e,k,t,o),Me=(e,t,o,s)=>te(t,m,o,s,e),Fe=(e,t,o,s)=>_(u,F(s),e,t,[],o),Ee=(e,t,o,s)=>_(l,F(s),e,t,[],o),Ve=(e,t,o,s,r)=>_(i,F(r),t,o,[e],s),Ae=(e,t,o,s,r)=>_(i+C,F(r),t,o,[e],s),je=(e,t,o,s,r)=>_(a,F(r),t,o,[e],s),De=(e,t,o,s,r)=>_(p,F(r),t,o,[e],s),Oe=(e,t,o,s,r,d,n,I,i)=>_(g,F(i),d,n,[e,t,o,s,r],I),Qe=(e,t,o,s,r,d)=>_(c,F(d),o,s,[e,t],r),We=(e,t,o,s,r,d)=>_(C,F(d),o,s,[e,t],r),ze=(e,t,o,s,r,d,n)=>_(b,F(n),s,r,[e,t,o],d),Ge=(e,t,o,s)=>_(k,F(s),e,t,[],o),He=(e,t,o,s)=>_(w,F(s),e,t,[],o),Je=(e,t,o,s,r)=>_(m,F(r),t,o,[e],s),Ke=(e,t,o)=>_("Start"+J,F(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,F(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,F(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>T(3),Ze=e=>$("MetricIds",V(e),[]),$e=(e,t)=>$("Metric",V(t),void 0,[e]),_e=(e,t,o,s)=>_("Metric",V(s),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>T(5),ot=(e,t)=>$("SliceIds",j(t),[],[e]),st=e=>$("IndexIds",j(e),[]),rt=(e,t,o)=>$("Slice"+p,j(o),[],[e,t]),dt=(e,t,o,s)=>_("SliceIds",j(s),t,o,[e]),nt=(e,t,o,s,r)=>_("Slice"+p,j(r),o,s,[e,t]),It=(e,t,o)=>Z(e,t,o),it=()=>T(7),ut=e=>$("RelationshipIds",O(e),[]),lt=(e,t,o)=>$("RemoteRowId",O(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,O(o),[],[e,t]),at=(e,t,o)=>$("Linked"+p,O(o),[],[e,t]),pt=(e,t,o,s,r)=>_("RemoteRowId",O(r),o,s,[e,t]),gt=(e,t,o,s,r)=>_("Local"+p,O(r),o,s,[e,t]),bt=(e,t,o,s,r)=>_("Linked"+p,O(r),o,s,[e,t]),Ct=(e,t,o)=>Z(e,t,o),mt=()=>T(9),kt=e=>$("QueryIds",W(e),[]),wt=(e,t)=>$(n+i,W(t),{},[e]),yt=(e,t)=>$(n+i+C,W(t),[],[e]),ht=(e,t)=>$(n+a,W(t),[],[e]),Rt=(e,t)=>$(n+p,W(t),[],[e]),vt=(e,t,o,s=0,r,d)=>$(n+g,W(d),[],[e,t,o,s,r],6),qt=(e,t,o)=>$(n+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(n+C,W(o),[],[e,t]),ft=(e,t,o,s)=>$(n+b,W(s),void 0,[e,t,o]),xt=(e,t,o,s)=>_(n+i,W(s),t,o,[e]),St=(e,t,o,s)=>_(n+i+C,W(s),t,o,[e]),Lt=(e,t,o,s)=>_(n+a,W(s),t,o,[e]),Bt=(e,t,o,s)=>_(n+p,W(s),t,o,[e]),Tt=(e,t,o,s,r,d,I,i)=>_(n+g,W(i),d,I,[e,t,o,s,r]),Mt=(e,t,o,s,r)=>_(n+c,W(r),o,s,[e,t]),Ft=(e,t,o,s,r)=>_(n+C,W(r),o,s,[e,t]),Et=(e,t,o,s,r,d)=>_(n+b,W(d),s,r,[e,t,o]),Vt=(e,t,o)=>Z(e,t,o),At=()=>T(11),jt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),Dt=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Ot=(e=v,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>h(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Gt=e=>{const t=G(e),[o,r]=jt(t);return[(d=o,!(0==(e=>e.length)(d))),Qt(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ht=e=>{const t=G(e),[,,[o]]=jt(t);return[!y(o),Wt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,s)=>_("Checkpoint",G(s),t,o,[e]),Nt=(e,t,o=[],s,r=[])=>{const[,d]=Y(),n=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{await(s?.(n)),d(1)})(),()=>{n?.destroy()})),[n,...r]),n},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>y(e)?{}:e(...t),oo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:so}=e,ro=({tableId:e,store:t,rowComponent:o=ao,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>lo(q(I,(d=>Yt(o,{...to(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),no=({queryId:e,queries:t,resultRowComponent:o=Po,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>lo(q(n,(r=>Yt(o,{...to(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Io=({relationshipId:e,relationships:t,rowComponent:o=ao,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[i,u,l]=oo(O(t),e),c=n(e,I,i);return lo(q(c,(e=>Yt(o,{...to(s,e),key:e,tableId:l,rowId:e,store:u,debugIds:d}))),r,d,I)},io=e=>({checkpoints:t,checkpointComponent:o=So,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return lo(q(e(jt(n)),(e=>Yt(o,{...to(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},uo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:i,queries:u,queriesById:l,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(S);return Yt(S.Provider,{value:so((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...i},u??g[8],{...g[9],...l},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,i,u,l,c,a,g])},p)},lo=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},co=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>lo(s+(ge(e,t,o,r)??s),void 0,d,o),ao=({tableId:e,rowId:t,store:o,cellComponent:s=co,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>lo(q(((e,t,o,s)=>{const r=pe(t,o,s);return e??r})(d,e,t,o),(d=>Yt(s,{...to(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),po=e=>ro(e,le(e.tableId,e.store)),go=({cellId:e,descending:t,offset:o,limit:s,...r})=>ro(r,ce(r.tableId,e,t,o,s,r.store)),bo=({store:e,tableComponent:t=po,getTableComponentProps:o,separator:s,debugIds:r})=>lo(q(ne(e),(s=>Yt(t,{...to(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Co=({valueId:e,store:t,debugIds:o})=>lo(s+(me(e,t)??s),void 0,o,e),mo=({store:e,valueComponent:t=Co,getValueComponentProps:o,separator:s,debugIds:r})=>lo(q(Ce(e),(s=>Yt(t,{...to(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ko=({metricId:e,metrics:t,debugIds:o})=>lo($e(e,t)??s,void 0,o,e),wo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=ao,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,i,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),l=rt(e,t,I);return lo(q(l,(e=>Yt(s,{...to(r,e),key:e,tableId:u,rowId:e,store:i,debugIds:n}))),d,n,t)},yo=({indexId:e,indexes:t,sliceComponent:o=wo,getSliceComponentProps:s,separator:r,debugIds:d})=>lo(q(ot(e,t),(r=>Yt(o,{...to(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ho=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=ao,getRowComponentProps:r,debugIds:d})=>{const[n,I,,i]=oo(O(o),e),u=lt(e,t,n);return lo(y(i)||y(u)?null:Yt(s,{...to(r,u),key:u,tableId:i,rowId:u,store:I,debugIds:d}),void 0,d,t)},Ro=e=>Io(e,ct,e.remoteRowId),vo=e=>Io(e,at,e.firstRowId),qo=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>lo(s+(ft(e,t,o,r)??s),void 0,d,o),Po=({queryId:e,rowId:t,queries:o,resultCellComponent:s=qo,getResultCellComponentProps:r,separator:d,debugIds:n})=>lo(q(Pt(e,t,o),(d=>Yt(s,{...to(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),fo=e=>no(e,Rt(e.queryId,e.queries)),xo=({cellId:e,descending:t,offset:o,limit:s,...r})=>no(r,vt(r.queryId,e,t,o,s,r.queries)),So=({checkpoints:e,checkpointId:t,debugIds:o})=>lo(Dt(t,e)??s,void 0,o,t),Lo=io((e=>e[0])),Bo=io((e=>y(e[1])?[]:[e[1]])),To=io((e=>e[2]));export{Lo as BackwardCheckpointsView,co as CellView,So as CheckpointView,Bo as CurrentCheckpointView,To as ForwardCheckpointsView,yo as IndexView,vo as LinkedRowsView,Ro as LocalRowsView,ko as MetricView,uo as Provider,ho as RemoteRowView,qo as ResultCellView,Po as ResultRowView,xo as ResultSortedTableView,fo as ResultTableView,ao as RowView,wo as SliceView,go as SortedTableView,po as TableView,bo as TablesView,Co as ValueView,mo as ValuesView,he as useAddRowCallback,ge as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,Dt as useCheckpoint,jt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,At as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Vt as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,Ct as useCreateQueries,It as useCreateRelationships,se as useCreateStore,Be as useDelCellCallback,Le as useDelRowCallback,Se as useDelTableCallback,xe as useDelTablesCallback,Me as useDelValueCallback,Te as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,st as useIndexIds,A as useIndexes,tt as useIndexesIds,j as useIndexesOrIndexesById,at as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,gt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,E as useMetrics,Ye as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ht as useRedoInformation,ut as useRelationshipIds,D as useRelationships,it as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,lt as useRemoteRowId,pt as useRemoteRowIdListener,ft as useResultCell,Pt as useResultCellIds,Ft as useResultCellIdsListener,Et as useResultCellListener,qt as useResultRow,ht as useResultRowCount,Lt as useResultRowCountListener,Rt as useResultRowIds,Bt as useResultRowIdsListener,Mt as useResultRowListener,vt as useResultSortedRowIds,Tt as useResultSortedRowIdsListener,wt as useResultTable,yt as useResultTableCellIds,St as useResultTableCellIdsListener,xt as useResultTableListener,ae as useRow,ue as useRowCount,je as useRowCountListener,le as useRowIds,De as useRowIdsListener,Qe as useRowListener,ve as useSetCellCallback,Ot as useSetCheckpointCallback,Re as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,ye as useSetRowCallback,we as useSetTableCallback,ke as useSetTablesCallback,fe as useSetValueCallback,qe as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,rt as useSliceRowIds,nt as useSliceRowIdsListener,ce as useSortedRowIds,Oe as useSortedRowIdsListener,Ke as useStartTransactionListener,M as useStore,re as useStoreIds,F as useStoreOrStoreById,Ie as useTable,ie as useTableCellIds,Ae as useTableCellIdsListener,ne as useTableIds,Ee as useTableIdsListener,Ve as useTableListener,de as useTables,Fe as useTablesListener,Gt as useUndoInformation,me as useValue,Ce as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
|
|
1
|
+
import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",I="Ids",i="Table",u=i+"s",l=i+I,c="Row",a=c+"Count",p=c+I,g="Sorted"+c+I,b="Cell",C=b+I,m="Value",k=m+"s",w=m+I,y=e=>null==e,h=(e,t,o)=>y(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),P=Object.keys,{createContext:f,useContext:x}=e,S=f([]),L=(e,t)=>{const o=x(S);return y(e)?o[t]:R(e)?((e,t)=>h(e,(e=>e[t])))(o[t+1]??{},e):e},B=(e,t)=>{const o=L(e,t);return y(e)||R(e)?o:e},T=e=>P(x(S)[e]??{}),M=e=>L(e,0),F=e=>B(e,0),E=e=>L(e,2),V=e=>B(e,2),A=e=>L(e,4),j=e=>B(e,4),D=e=>L(e,6),O=e=>B(e,6),Q=e=>L(e,8),W=e=>B(e,8),z=e=>L(e,10),G=e=>B(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},$=(e,t,o,s=[],r)=>{const[,d]=Y(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=Y(n),i=X(I);return U((()=>i.current=n()),[n]),_(e,t,((...e)=>{i.current=y(r)?n():e[r],d([])}),[],s),i.current},_=(e,t,o,s=[],r=[],...n)=>N((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,...r,...s,...n]),ee=(e,t,o,s=[],r=v,d=[],...n)=>{const I=F(e);return K((e=>h(I,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},te=(e,t,o=v,s=[],...r)=>{const d=F(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},oe=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},se=(e,t=[])=>U(e,t),re=()=>T(1),de=e=>$(u,F(e),{}),ne=e=>$(l,F(e),[],[]),Ie=(e,t)=>$(i,F(t),{},[e]),ie=(e,t)=>$(i+C,F(t),[],[e]),ue=(e,t)=>$(a,F(t),[],[e]),le=(e,t)=>$(p,F(t),[],[e]),ce=(e,t,o,s=0,r,d)=>$(g,F(d),[],[e,t,o,s,r],6),ae=(e,t,o)=>$(c,F(o),{},[e,t]),pe=(e,t,o)=>$(C,F(o),[],[e,t]),ge=(e,t,o,s)=>$(b,F(s),void 0,[e,t,o],4),be=e=>$(k,F(e),{}),Ce=e=>$(w,F(e),[],[]),me=(e,t)=>$(m,F(t),void 0,[e]),ke=(e,t,o,s,r)=>ee(o,u,e,t,s,r),we=(e,t,o,s,r,d)=>ee(s,i,t,o,r,d,e),ye=(e,t,o,s,r,d,n)=>ee(r,c,o,s,d,n,e,t),he=(e,t,o=[],s,r=v,d=[],n=!0)=>{const I=F(s);return K((o=>h(I,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},Re=(e,t,o,s,r,d,n)=>ee(r,"PartialRow",o,s,d,n,e,t),ve=(e,t,o,s,r,d,n,I)=>ee(d,b,s,r,n,I,e,t,o),qe=(e,t,o,s,r)=>ee(o,k,e,t,s,r),Pe=(e,t,o,s,r)=>ee(o,"PartialValues",e,t,s,r),fe=(e,t,o,s,r,d)=>ee(s,m,t,o,r,d,e),xe=(e,t,o)=>te(e,u,t,o),Se=(e,t,o,s)=>te(t,i,o,s,e),Le=(e,t,o,s,r)=>te(o,c,s,r,e,t),Be=(e,t,o,s,r,d,n)=>te(r,b,d,n,e,t,o,s),Te=(e,t,o)=>te(e,k,t,o),Me=(e,t,o,s)=>te(t,m,o,s,e),Fe=(e,t,o,s)=>_(u,F(s),e,t,[],o),Ee=(e,t,o,s)=>_(l,F(s),e,t,[],o),Ve=(e,t,o,s,r)=>_(i,F(r),t,o,[e],s),Ae=(e,t,o,s,r)=>_(i+C,F(r),t,o,[e],s),je=(e,t,o,s,r)=>_(a,F(r),t,o,[e],s),De=(e,t,o,s,r)=>_(p,F(r),t,o,[e],s),Oe=(e,t,o,s,r,d,n,I,i)=>_(g,F(i),d,n,[e,t,o,s,r],I),Qe=(e,t,o,s,r,d)=>_(c,F(d),o,s,[e,t],r),We=(e,t,o,s,r,d)=>_(C,F(d),o,s,[e,t],r),ze=(e,t,o,s,r,d,n)=>_(b,F(n),s,r,[e,t,o],d),Ge=(e,t,o,s)=>_(k,F(s),e,t,[],o),He=(e,t,o,s)=>_(w,F(s),e,t,[],o),Je=(e,t,o,s,r)=>_(m,F(r),t,o,[e],s),Ke=(e,t,o)=>_("Start"+J,F(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,F(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,F(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>T(3),Ze=e=>$("MetricIds",V(e),[]),$e=(e,t)=>$("Metric",V(t),void 0,[e]),_e=(e,t,o,s)=>_("Metric",V(s),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>T(5),ot=(e,t)=>$("SliceIds",j(t),[],[e]),st=e=>$("IndexIds",j(e),[]),rt=(e,t,o)=>$("Slice"+p,j(o),[],[e,t]),dt=(e,t,o,s)=>_("SliceIds",j(s),t,o,[e]),nt=(e,t,o,s,r)=>_("Slice"+p,j(r),o,s,[e,t]),It=(e,t,o)=>Z(e,t,o),it=()=>T(7),ut=e=>$("RelationshipIds",O(e),[]),lt=(e,t,o)=>$("RemoteRowId",O(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,O(o),[],[e,t]),at=(e,t,o)=>$("Linked"+p,O(o),[],[e,t]),pt=(e,t,o,s,r)=>_("RemoteRowId",O(r),o,s,[e,t]),gt=(e,t,o,s,r)=>_("Local"+p,O(r),o,s,[e,t]),bt=(e,t,o,s,r)=>_("Linked"+p,O(r),o,s,[e,t]),Ct=(e,t,o)=>Z(e,t,o),mt=()=>T(9),kt=e=>$("QueryIds",W(e),[]),wt=(e,t)=>$(n+i,W(t),{},[e]),yt=(e,t)=>$(n+i+C,W(t),[],[e]),ht=(e,t)=>$(n+a,W(t),[],[e]),Rt=(e,t)=>$(n+p,W(t),[],[e]),vt=(e,t,o,s=0,r,d)=>$(n+g,W(d),[],[e,t,o,s,r],6),qt=(e,t,o)=>$(n+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(n+C,W(o),[],[e,t]),ft=(e,t,o,s)=>$(n+b,W(s),void 0,[e,t,o]),xt=(e,t,o,s)=>_(n+i,W(s),t,o,[e]),St=(e,t,o,s)=>_(n+i+C,W(s),t,o,[e]),Lt=(e,t,o,s)=>_(n+a,W(s),t,o,[e]),Bt=(e,t,o,s)=>_(n+p,W(s),t,o,[e]),Tt=(e,t,o,s,r,d,I,i)=>_(n+g,W(i),d,I,[e,t,o,s,r]),Mt=(e,t,o,s,r)=>_(n+c,W(r),o,s,[e,t]),Ft=(e,t,o,s,r)=>_(n+C,W(r),o,s,[e,t]),Et=(e,t,o,s,r,d)=>_(n+b,W(d),s,r,[e,t,o]),Vt=(e,t,o)=>Z(e,t,o),At=()=>T(11),jt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),Dt=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Ot=(e=v,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>h(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Gt=e=>{const t=G(e),[o,r]=jt(t);return[(d=o,!(0==d.length)),Qt(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ht=e=>{const t=G(e),[,,[o]]=jt(t);return[!y(o),Wt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,s)=>_("Checkpoint",G(s),t,o,[e]),Nt=(e,t,o=[],s,r=[])=>{const[,d]=Y(),n=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{await(s?.(n)),d(1)})(),()=>{n?.destroy()})),[n,...r]),n},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>y(e)?{}:e(...t),oo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:so}=e,ro=({tableId:e,store:t,rowComponent:o=ao,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>lo(q(I,(d=>Yt(o,{...to(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),no=({queryId:e,queries:t,resultRowComponent:o=Po,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>lo(q(n,(r=>Yt(o,{...to(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Io=({relationshipId:e,relationships:t,rowComponent:o=ao,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[i,u,l]=oo(O(t),e),c=n(e,I,i);return lo(q(c,(e=>Yt(o,{...to(s,e),key:e,tableId:l,rowId:e,store:u,debugIds:d}))),r,d,I)},io=e=>({checkpoints:t,checkpointComponent:o=So,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return lo(q(e(jt(n)),(e=>Yt(o,{...to(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},uo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:i,queries:u,queriesById:l,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(S);return Yt(S.Provider,{value:so((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...i},u??g[8],{...g[9],...l},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,i,u,l,c,a,g])},p)},lo=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},co=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>lo(s+(ge(e,t,o,r)??s),void 0,d,o),ao=({tableId:e,rowId:t,store:o,cellComponent:s=co,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>lo(q(((e,t,o,s)=>{const r=pe(t,o,s);return e??r})(d,e,t,o),(d=>Yt(s,{...to(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),po=e=>ro(e,le(e.tableId,e.store)),go=({cellId:e,descending:t,offset:o,limit:s,...r})=>ro(r,ce(r.tableId,e,t,o,s,r.store)),bo=({store:e,tableComponent:t=po,getTableComponentProps:o,separator:s,debugIds:r})=>lo(q(ne(e),(s=>Yt(t,{...to(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Co=({valueId:e,store:t,debugIds:o})=>lo(s+(me(e,t)??s),void 0,o,e),mo=({store:e,valueComponent:t=Co,getValueComponentProps:o,separator:s,debugIds:r})=>lo(q(Ce(e),(s=>Yt(t,{...to(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ko=({metricId:e,metrics:t,debugIds:o})=>lo($e(e,t)??s,void 0,o,e),wo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=ao,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,i,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),l=rt(e,t,I);return lo(q(l,(e=>Yt(s,{...to(r,e),key:e,tableId:u,rowId:e,store:i,debugIds:n}))),d,n,t)},yo=({indexId:e,indexes:t,sliceComponent:o=wo,getSliceComponentProps:s,separator:r,debugIds:d})=>lo(q(ot(e,t),(r=>Yt(o,{...to(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ho=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=ao,getRowComponentProps:r,debugIds:d})=>{const[n,I,,i]=oo(O(o),e),u=lt(e,t,n);return lo(y(i)||y(u)?null:Yt(s,{...to(r,u),key:u,tableId:i,rowId:u,store:I,debugIds:d}),void 0,d,t)},Ro=e=>Io(e,ct,e.remoteRowId),vo=e=>Io(e,at,e.firstRowId),qo=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>lo(s+(ft(e,t,o,r)??s),void 0,d,o),Po=({queryId:e,rowId:t,queries:o,resultCellComponent:s=qo,getResultCellComponentProps:r,separator:d,debugIds:n})=>lo(q(Pt(e,t,o),(d=>Yt(s,{...to(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),fo=e=>no(e,Rt(e.queryId,e.queries)),xo=({cellId:e,descending:t,offset:o,limit:s,...r})=>no(r,vt(r.queryId,e,t,o,s,r.queries)),So=({checkpoints:e,checkpointId:t,debugIds:o})=>lo(Dt(t,e)??s,void 0,o,t),Lo=io((e=>e[0])),Bo=io((e=>y(e[1])?[]:[e[1]])),To=io((e=>e[2]));export{Lo as BackwardCheckpointsView,co as CellView,So as CheckpointView,Bo as CurrentCheckpointView,To as ForwardCheckpointsView,yo as IndexView,vo as LinkedRowsView,Ro as LocalRowsView,ko as MetricView,uo as Provider,ho as RemoteRowView,qo as ResultCellView,Po as ResultRowView,xo as ResultSortedTableView,fo as ResultTableView,ao as RowView,wo as SliceView,go as SortedTableView,po as TableView,bo as TablesView,Co as ValueView,mo as ValuesView,he as useAddRowCallback,ge as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,Dt as useCheckpoint,jt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,At as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Vt as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,Ct as useCreateQueries,It as useCreateRelationships,se as useCreateStore,Be as useDelCellCallback,Le as useDelRowCallback,Se as useDelTableCallback,xe as useDelTablesCallback,Me as useDelValueCallback,Te as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,st as useIndexIds,A as useIndexes,tt as useIndexesIds,j as useIndexesOrIndexesById,at as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,gt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,E as useMetrics,Ye as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ht as useRedoInformation,ut as useRelationshipIds,D as useRelationships,it as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,lt as useRemoteRowId,pt as useRemoteRowIdListener,ft as useResultCell,Pt as useResultCellIds,Ft as useResultCellIdsListener,Et as useResultCellListener,qt as useResultRow,ht as useResultRowCount,Lt as useResultRowCountListener,Rt as useResultRowIds,Bt as useResultRowIdsListener,Mt as useResultRowListener,vt as useResultSortedRowIds,Tt as useResultSortedRowIdsListener,wt as useResultTable,yt as useResultTableCellIds,St as useResultTableCellIdsListener,xt as useResultTableListener,ae as useRow,ue as useRowCount,je as useRowCountListener,le as useRowIds,De as useRowIdsListener,Qe as useRowListener,ve as useSetCellCallback,Ot as useSetCheckpointCallback,Re as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,ye as useSetRowCallback,we as useSetTableCallback,ke as useSetTablesCallback,fe as useSetValueCallback,qe as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,rt as useSliceRowIds,nt as useSliceRowIdsListener,ce as useSortedRowIds,Oe as useSortedRowIdsListener,Ke as useStartTransactionListener,M as useStore,re as useStoreIds,F as useStoreOrStoreById,Ie as useTable,ie as useTableCellIds,Ae as useTableCellIdsListener,ne as useTableIds,Ee as useTableIdsListener,Ve as useTableListener,de as useTables,Fe as useTablesListener,Gt as useUndoInformation,me as useValue,Ce as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
|
package/lib/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd/checkpoints.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=(e,t)=>e.includes(t),
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>null==e,n=(e,n,s)=>t(e)?s?.():n(e),s=e=>e.length,o=(e,t)=>e.includes(t),r=(e,t)=>e.forEach(t),l=e=>0==s(e),i=(e,...t)=>e.push(...t),c=e=>e.pop(),d=e=>e.shift(),a=Object.freeze,u=(e,t)=>e?.has(t)??!1,h=e=>t(e)||0==(e=>e?.size??0)(e),p=(e,t)=>e?.forEach(t),f=(e,t)=>e?.delete(t),C=e=>new Map(e),g=(e,t)=>e?.get(t),k=(e,n,s)=>t(s)?(f(e,n),e):e?.set(n,s),v=(e,t,n)=>(u(e,t)||k(e,t,n()),g(e,t)),y=(e,t,o,r,l=0)=>n((o?v:g)(e,t[l],l>s(t)-2?o:C),(n=>{if(l>s(t)-2)return r?.(n)&&k(e,t[l]),n;const i=y(n,t,o,r,l+1);return h(n)&&k(e,t[l]),i})),L=e=>new Set(Array.isArray(e)||t(e)?e:[e]),w=/^\d+$/,b=(e=>{const b=new WeakMap;return e=>(b.has(e)||b.set(e,(e=>{let b,S,T,x=100,z=C(),E=C(),V=1;const j=C(),m=C(),[A,B,I]=(e=>{let o;const[l,c]=(()=>{const e=[];let t=0;return[n=>(n?d(e):null)??""+t++,t=>{w.test(t)&&s(e)<1e3&&i(e,t)}]})(),a=C();return[(e,t,n,s=[],r=(()=>[]))=>{o??=_;const i=l(1);var c,d;return k(a,i,[e,t,n,s,r]),c=y(t,n??[""],L),d=i,c?.add(d),i},(e,t,...n)=>r(((e,t=[""])=>{const n=[],o=(e,l)=>l==s(t)?i(n,e):null===t[l]?p(e,(e=>o(e,l+1))):r([t[l],null],(t=>o(g(e,t),l+1)));return o(e,0),n})(e,t),(e=>p(e,(e=>g(a,e)[0](o,...t??[],...n))))),e=>n(g(a,e),(([,t,n])=>(y(t,n??[""],void 0,(t=>(f(t,e),h(t)?1:0))),k(a,e),c(e),n))),e=>n(g(a,e),(([e,,n=[],l,i])=>{const c=(...d)=>{const a=s(d);a==s(n)?e(o,...d,...i(d)):t(n[a])?r(l[a]?.(...d)??[],(e=>c(...d,e))):c(...d,n[a])};c()}))]})(),M=C(),F=C(),O=[],W=[],$=(n,s)=>{V=0,e.transaction((()=>{const[o,r]=g(M,s);p(o,((s,o)=>p(s,((s,r)=>p(s,((s,l)=>((e,n,s,o,r)=>t(r)?e.delCell(n,s,o,!0):e.setCell(n,s,o,r))(e,o,r,l,s[n]))))))),p(r,((s,o)=>((e,n,s)=>t(s)?e.delValue(n):e.setValue(n,s))(e,o,s[n])))})),V=1},q=e=>{k(M,e),k(F,e),B(m,[e])},D=(e,t)=>r(((e,t)=>e.splice(0,t))(e,t??s(e)),q),G=()=>D(O,s(O)-x),H=()=>n(b,(()=>{i(O,b),G(),D(W),b=void 0,T=1})),J=()=>{b=c(O),T=1},K=e.addCellListener(null,null,null,((e,t,n,s,o,r)=>{if(V){H();const e=v(z,t,C),l=v(e,n,C),i=v(l,s,(()=>[r,void 0]));i[1]=o,i[0]===o&&h(k(l,s))&&h(k(e,n))&&h(k(z,t))&&J(),U()}})),N=e.addValueListener(null,((e,t,n,s)=>{if(V){H();const e=v(E,t,(()=>[s,void 0]));e[1]=n,e[0]===n&&h(k(E,t))&&J(),U()}})),P=(e="")=>(t(b)&&(b=""+S++,k(M,b,[z,E]),Y(b,e),z=C(),E=C(),T=1),b),Q=()=>{l(O)||(((e,...t)=>{e.unshift(...t)})(W,P()),$(0,b),b=c(O),T=1)},R=()=>{l(W)||(i(O,b),b=d(W),$(1,b),T=1)},U=()=>{T&&(B(j),T=0)},X=e=>{const t=P(e);return U(),t},Y=(e,t)=>(Z(e)&&g(F,e)!==t&&(k(F,e,t),B(m,[e])),_),Z=e=>u(M,e),_={setSize:e=>(x=e,G(),_),addCheckpoint:X,setCheckpoint:Y,getStore:()=>e,getCheckpointIds:()=>[[...O],b,[...W]],forEachCheckpoint:e=>{return t=e,p(F,((e,n)=>t(n,e)));var t},hasCheckpoint:Z,getCheckpoint:e=>g(F,e),goBackward:()=>(Q(),U(),_),goForward:()=>(R(),U(),_),goTo:e=>{const n=o(O,e)?Q:o(W,e)?R:null;for(;!t(n)&&e!=b;)n();return U(),_},addCheckpointIdsListener:e=>A(e,j),addCheckpointListener:(e,t)=>A(t,m,[e]),delListener:e=>(I(e),_),clear:()=>(D(O),D(W),t(b)||q(b),b=void 0,S=0,X(),_),destroy:()=>{e.delListener(K),e.delListener(N)},getListenerStats:()=>({})};return a(_.clear())})(e)),b.get(e))})();e.createCheckpoints=b},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseCheckpoints={});
|
|
Binary file
|
package/lib/umd/indexes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n="",s=t(n),r=e=>n+e,o=e=>null==e,d=(e,t,n)=>o(e)?n?.():t(e),i=e=>Array.isArray(e),l=(e,t)=>e.every(t),
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n="",s=t(n),r=e=>n+e,o=e=>null==e,d=(e,t,n)=>o(e)?n?.():t(e),i=e=>Array.isArray(e),l=e=>e.length,c=(e,t)=>e.every(t),a=(e,t)=>c(e,((n,s)=>0==s||t(e[s-1],n)<=0)),f=(e,t)=>e.sort(t),u=(e,t)=>e.forEach(t),h=(e,...t)=>e.push(...t),I=Object.freeze,g=(e,t)=>e?.has(t)??!1,p=e=>o(e)||0==(e=>e?.size??0)(e),x=e=>[...e?.values()??[]],y=e=>e.clear(),v=(e,t)=>e?.forEach(t),L=(e,t)=>e?.delete(t),S=e=>new Map(e),w=e=>[...e?.keys()??[]],b=(e,t)=>e?.get(t),T=(e,t)=>v(e,((e,n)=>t(n,e))),E=(e,t,n)=>o(n)?(L(e,t),e):e?.set(t,n),R=(e,t,n)=>(g(e,t)||E(e,t,n()),b(e,t)),m=(e,t,n,s,r=0)=>d((n?R:b)(e,t[r],r>l(t)-2?n:S),(o=>{if(r>l(t)-2)return s?.(o)&&E(e,t[r]),o;const d=m(o,t,n,s,r+1);return p(o)&&E(e,t[r]),d})),j=e=>new Set(i(e)||o(e)?e:[e]),k=(e,t)=>e?.add(t),z=(e,r)=>t(e)==s?t=>t(e):e??(()=>r??n),A=(e,t)=>(e??0)<(t??0)?-1:1,C=/^\d+$/,D=(e=>{const t=new WeakMap;return e=>(t.has(e)||t.set(e,(e=>{const t=S(),s=S(),[D,M,B]=(e=>{let t;const[s,r]=(()=>{const e=[];let t=0;return[s=>(s?e.shift():null)??n+t++,t=>{C.test(t)&&l(e)<1e3&&h(e,t)}]})(),i=S();return[(e,r,o,d=[],l=(()=>[]))=>{t??=U;const c=s(1);return E(i,c,[e,r,o,d,l]),k(m(r,o??[n],j),c),c},(e,s,...r)=>u(((e,t=[n])=>{const s=[],r=(e,n)=>n==l(t)?h(s,e):null===t[n]?v(e,(e=>r(e,n+1))):u([t[n],null],(t=>r(b(e,t),n+1)));return r(e,0),s})(e,s),(e=>v(e,(e=>b(i,e)[0](t,...s??[],...r))))),e=>d(b(i,e),(([,t,s])=>(m(t,s??[n],void 0,(t=>(L(t,e),p(t)?1:0))),E(i,e),r(e),s))),e=>d(b(i,e),(([e,,n=[],s,r])=>{const d=(...i)=>{const c=l(i);c==l(n)?e(t,...i,...r(i)):o(n[c])?u(s[c]?.(...i)??[],(e=>d(...i,e))):d(...i,n[c])};d()}))]})(),[O,W,$,q,F,G,H,,J,K,N,P]=((e,t,n,s,r)=>{const a=e.hasRow,f=S(),h=S(),I=S(),m=S(),z=S(),A=S(),C=(t,n,...s)=>{const r=R(A,t,j);return u(s,(t=>k(r,t)&&n&&e.callListener(t))),s},D=(t,...n)=>d(b(A,t),(s=>{u(0==l(n)?x(s):n,(t=>{e.delListener(t),L(s,t)})),p(s)&&E(A,t)})),M=(e,n)=>{E(f,e,n),g(h,e)||(E(h,e,t()),E(m,e,S()),E(z,e,S()),r(I))},B=e=>{E(f,e),E(h,e),E(m,e),E(z,e),D(e),r(I)};return[()=>e,()=>w(f),e=>T(h,e),e=>g(h,e),e=>b(f,e),e=>b(h,e),(e,t)=>E(h,e,t),M,(t,s,r,d,f)=>{M(t,s);const h=S(),I=S(),p=b(m,t),x=b(z,t),L=t=>{const r=n=>e.getCell(s,t,n),u=b(p,t),g=a(s,t)?n(d(r,t)):void 0;var y,v;if(u===g||i(u)&&i(g)&&(v=g,l(y=u)===l(v)&&c(y,((e,t)=>v[t]===e)))||E(h,t,[u,g]),!o(f)){const e=b(x,t),n=a(s,t)?f(r,t):void 0;e!=n&&E(I,t,n)}},w=e=>{r((()=>{v(h,(([,e],t)=>E(p,t,e))),v(I,((e,t)=>E(x,t,e)))}),h,I,p,x,e),y(h),y(I)};T(p,L),e.hasTable(s)&&u(e.getRowIds(s),(e=>{g(p,e)||L(e)})),w(!0),D(t),C(t,0,e.addRowListener(s,null,((e,t,n)=>L(n))),e.addTableListener(s,(()=>w())))},B,e=>s(e,I),()=>T(A,B),C,D]})(e,S,(e=>{return o(e)?n:i(e)?(t=r,e.map(t)):r(e);var t}),D,M),Q=(t,n,s)=>{const r=F(t);v(s,((t,s)=>n(s,(n=>v(t,(t=>n(t,(n=>e.forEachCell(r,t,n)))))))))},U={setIndexDefinition:(e,n,r,i,l,c=A)=>{const u=o(l)?void 0:([e],[t])=>l(e,t);return J(e,n,((n,r,l,h,I,x)=>{let y=0;const w=j(),R=j(),m=G(e);if(v(r,(([e,t],n)=>{const s=j(e),r=j(t);v(s,(e=>L(r,e)?L(s,e):0)),v(s,(e=>{k(w,e),d(b(m,e),(t=>{L(t,n),p(t)&&(E(m,e),y=1)}))})),v(r,(e=>{k(w,e),g(m,e)||(E(m,e,j()),y=1),k(b(m,e),n),o(i)||k(R,e)}))})),n(),p(I)||(x?T(m,(e=>k(R,e))):T(l,(e=>d(b(h,e),(e=>k(R,e))))),v(R,(e=>{const t=(t,n)=>c(b(I,t),b(I,n),e),n=[...b(m,e)];a(n,t)||(E(m,e,j(f(n,t))),k(w,e))}))),(y||x)&&!o(u)){const t=[...m];a(t,u)||(H(e,S(f(t,u))),y=1)}y&&M(t,[e]),v(w,(t=>M(s,[e,t])))}),z(r),d(i,z)),U},delIndexDefinition:e=>(K(e),U),getStore:O,getIndexIds:W,forEachIndex:e=>$(((t,n)=>e(t,(e=>Q(t,e,n))))),forEachSlice:(e,t)=>Q(e,t,G(e)),hasIndex:q,hasSlice:(e,t)=>g(G(e),t),getTableId:F,getSliceIds:e=>w(G(e)),getSliceRowIds:(e,t)=>x(b(G(e),t)),addIndexIdsListener:N,addSliceIdsListener:(e,n)=>D(n,t,[e]),addSliceRowIdsListener:(e,t,n)=>D(n,s,[e,t]),delListener:e=>(B(e),U),destroy:P,getListenerStats:()=>({})};return I(U)})(e)),t.get(e))})();e.createIndexes=D},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseIndexes={});
|
package/lib/umd/indexes.js.gz
CHANGED
|
Binary file
|
package/lib/umd/metrics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n="",r=t(n),s=t(t),i=Math.max,o=Math.min,a=isFinite,c=e=>null==e,d=(e,t,n)=>c(e)?n?.():t(e),l=e=>Array.isArray(e),u=()=>{},
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,n="",r=t(n),s=t(t),i=Math.max,o=Math.min,a=isFinite,c=e=>null==e,d=(e,t,n)=>c(e)?n?.():t(e),l=e=>Array.isArray(e),u=e=>e.length,f=()=>{},h=(e,t)=>e.forEach(t),v=e=>M(e,((e,t)=>e+t),0),M=(e,t,n)=>e.reduce(t,n),g=(e,...t)=>e.push(...t),p=Object.freeze,y=e=>e?.size??0,m=(e,t)=>e?.has(t)??!1,L=e=>c(e)||0==y(e),b=e=>[...e?.values()??[]],w=e=>e.clear(),T=(e,t)=>e?.forEach(t),x=(e,t)=>e?.delete(t),I=e=>new Map(e),E=(e,t)=>e?.get(t),R=(e,t)=>T(e,((e,n)=>t(n,e))),S=(e,t,n)=>c(n)?(x(e,t),e):e?.set(t,n),j=(e,t,n)=>(m(e,t)||S(e,t,n()),E(e,t)),k=(e,t,n,r,s=0)=>d((n?j:E)(e,t[s],s>u(t)-2?n:I),(i=>{if(s>u(t)-2)return r?.(i)&&S(e,t[s]),i;const o=k(i,t,n,r,s+1);return L(i)&&S(e,t[s]),o})),z=I([["avg",[(e,t)=>v(e)/t,(e,t,n)=>e+(t-e)/(n+1),(e,t,n)=>e+(e-t)/(n-1),(e,t,n,r)=>e+(t-n)/r]],["max",[e=>i(...e),(e,t)=>i(t,e),(e,t)=>t==e?void 0:e,(e,t,n)=>n==e?void 0:i(t,e)]],["min",[e=>o(...e),(e,t)=>o(t,e),(e,t)=>t==e?void 0:e,(e,t,n)=>n==e?void 0:o(t,e)]],["sum",[e=>v(e),(e,t)=>e+t,(e,t)=>e-t,(e,t,n)=>e-n+t]]]),A=e=>new Set(l(e)||c(e)?e:[e]),D=(e,t)=>e?.add(t),N=/^\d+$/,B=(e=>{const i=new WeakMap;return e=>(i.has(e)||i.set(e,(e=>{const i=I(),[o,v,M]=(e=>{let t;const[r,s]=(()=>{const e=[];let t=0;return[r=>(r?e.shift():null)??n+t++,t=>{N.test(t)&&u(e)<1e3&&g(e,t)}]})(),i=I();return[(e,s,o,a=[],c=(()=>[]))=>{t??=P;const d=r(1);return S(i,d,[e,s,o,a,c]),D(k(s,o??[n],A),d),d},(e,r,...s)=>h(((e,t=[n])=>{const r=[],s=(e,n)=>n==u(t)?g(r,e):null===t[n]?T(e,(e=>s(e,n+1))):h([t[n],null],(t=>s(E(e,t),n+1)));return s(e,0),r})(e,r),(e=>T(e,(e=>E(i,e)[0](t,...r??[],...s))))),e=>d(E(i,e),(([,t,r])=>(k(t,r??[n],void 0,(t=>(x(t,e),L(t)?1:0))),S(i,e),s(e),r))),e=>d(E(i,e),(([e,,n=[],r,s])=>{const i=(...o)=>{const a=u(o);a==u(n)?e(t,...o,...s(o)):c(n[a])?h(r[a]?.(...o)??[],(e=>i(...o,e))):i(...o,n[a])};i()}))]})(),[B,C,F,O,W,$,q,,G,H,J,K]=((e,t,r,s,i)=>{const o=e.hasRow,a=I(),f=I(),v=I(),M=I(),g=I(),p=I(),y=(t,n,...r)=>{const s=j(p,t,A);return h(r,(t=>D(s,t)&&n&&e.callListener(t))),r},k=(t,...n)=>d(E(p,t),(r=>{h(0==u(n)?b(r):n,(t=>{e.delListener(t),x(r,t)})),L(r)&&S(p,t)})),z=(e,n)=>{S(a,e,n),m(f,e)||(S(f,e,t()),S(M,e,I()),S(g,e,I()),i(v))},N=e=>{S(a,e),S(f,e),S(M,e),S(g,e),k(e),i(v)};return[()=>e,()=>{return e=a,[...e?.keys()??[]];var e},e=>R(f,e),e=>m(f,e),e=>E(a,e),e=>E(f,e),(e,t)=>S(f,e,t),z,(t,r,s,i,a)=>{z(t,r);const d=I(),f=I(),v=E(M,t),p=E(g,t),L=t=>{const s=n=>e.getCell(r,t,n),h=E(v,t),M=o(r,t)?(g=i(s,t),isNaN(g)||c(g)||!0===g||!1===g||g===n?void 0:1*g):void 0;var g,y,m,L;if(h===M||l(h)&&l(M)&&(m=M,u(y=h)===u(m)&&(L=(e,t)=>m[t]===e,y.every(L)))||S(d,t,[h,M]),!c(a)){const e=E(p,t),n=o(r,t)?a(s,t):void 0;e!=n&&S(f,t,n)}},b=e=>{s((()=>{T(d,(([,e],t)=>S(v,t,e))),T(f,((e,t)=>S(p,t,e)))}),d,f,v,p,e),w(d),w(f)};R(v,L),e.hasTable(r)&&h(e.getRowIds(r),(e=>{m(v,e)||L(e)})),b(!0),k(t),y(t,0,e.addRowListener(r,null,((e,t,n)=>L(n))),e.addTableListener(r,(()=>b())))},N,e=>s(e,v),()=>R(p,N),y,k]})(e,f,0,o,v),P={setMetricDefinition:(e,n,o,d,l,u,f)=>{const h=t(o)==s?[o,l,u,f]:E(z,o)??E(z,"sum");return G(e,n,((t,n,r,s,o,d)=>{const l=$(e),u=y(s);d||=c(l),t();let f=((e,t,n,r,s,i=!1)=>{if(L(n))return;const[o,a,d,l]=s;return i||=c(e),T(r,(([n,r])=>{i||(e=c(n)?a?.(e,r,t++):c(r)?d?.(e,n,t--):l?.(e,r,n,t),i||=c(e))})),i?o(b(n),y(n)):e})(l,u,s,n,h,d);a(f)||(f=void 0),f!=l&&(q(e,f),v(i,[e],f,l))}),(1,t(M=d)==r?e=>e(M):M??(()=>1))),P;var M},delMetricDefinition:e=>(H(e),P),getStore:B,getMetricIds:C,forEachMetric:F,hasMetric:O,getTableId:W,getMetric:$,addMetricIdsListener:J,addMetricListener:(e,t)=>o(t,i,[e]),delListener:e=>(M(e),P),destroy:K,getListenerStats:()=>({})};return p(P)})(e)),i.get(e))})();e.createMetrics=B},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseMetrics={});
|
package/lib/umd/metrics.js.gz
CHANGED
|
Binary file
|