tinybase 4.6.2 → 5.0.0-beta.1
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/bin/cli.js +1 -1
- 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-automerge.cjs +1 -1
- package/lib/cjs/persisters/persister-automerge.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-electric-sql.cjs +1 -1
- package/lib/cjs/persisters/persister-electric-sql.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs/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-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-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.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-automerge.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-automerge.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-electric-sql.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-electric-sql.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs-es6/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-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-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.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 +251 -234
- package/lib/debug/indexes.js +7 -5
- package/lib/debug/metrics.js +7 -5
- package/lib/debug/persisters/persister-automerge.js +3 -1
- package/lib/debug/persisters/persister-browser.js +1 -0
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +3 -1
- package/lib/debug/persisters/persister-electric-sql.js +3 -1
- package/lib/debug/persisters/persister-expo-sqlite-next.js +3 -1
- package/lib/debug/persisters/persister-expo-sqlite.js +3 -1
- package/lib/debug/persisters/persister-file.js +1 -0
- package/lib/debug/persisters/persister-indexed-db.js +3 -1
- package/lib/debug/persisters/persister-partykit-client.js +1 -0
- package/lib/debug/persisters/persister-partykit-server.js +2 -1
- package/lib/debug/persisters/persister-remote.js +1 -0
- package/lib/debug/persisters/persister-sqlite-wasm.js +3 -1
- package/lib/debug/persisters/persister-sqlite3.js +3 -1
- package/lib/debug/persisters/persister-yjs.js +3 -1
- package/lib/debug/persisters.js +1 -0
- package/lib/debug/queries.js +9 -6
- package/lib/debug/relationships.js +7 -5
- package/lib/debug/store.js +3 -1
- package/lib/debug/tinybase.js +254 -235
- package/lib/debug/tools.js +10 -6
- package/lib/debug/ui-react-dom.js +3 -1
- package/lib/debug/ui-react.js +166 -200
- 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-automerge.js +1 -1
- package/lib/es6/persisters/persister-automerge.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-electric-sql.js +1 -1
- package/lib/es6/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/es6/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-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-dom.js +1 -1
- package/lib/es6/ui-react-dom.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-automerge.js +1 -1
- package/lib/persisters/persister-automerge.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-electric-sql.js +1 -1
- package/lib/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/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-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/ui-react.d.ts +77 -88
- package/lib/types/with-schemas/ui-react.d.ts +84 -95
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -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-automerge.js +1 -1
- package/lib/umd/persisters/persister-automerge.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-electric-sql.js +1 -1
- package/lib/umd/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd/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-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-dom.js +1 -1
- package/lib/umd/ui-react-dom.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-automerge.js +1 -1
- package/lib/umd-es6/persisters/persister-automerge.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-electric-sql.js +1 -1
- package/lib/umd-es6/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd-es6/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-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-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.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 +4 -4
- package/readme.md +13 -13
package/lib/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",g=h+i,m="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V=Promise,x=isFinite,R=e=>null==e,A=(e,l,t)=>R(e)?t?.():l(e),k=e=>e==n||e==d,S=l=>e(l)==n,P=e=>Array.isArray(e),O=(e,l,t)=>e.slice(l,t),E=e=>e.length,L=async e=>V.all(e),N=l=>{const t=e(l);return k(t)||t==o&&x(l)?t:void 0},D=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),j=(e,l)=>e.forEach(l),H=(e,l=t)=>e.join(l),M=(e,l)=>e.map(l),J=(e,l)=>e.filter(l),z=(e,...l)=>e.push(...l),W=e=>e.pop(),B=(e,...l)=>e.unshift(...l),F=e=>e.shift(),U=Object,_=e=>U.getPrototypeOf(e),Z=U.keys,Q=U.freeze,q=e=>!R(e)&&A(_(e),(e=>e==U.prototype||R(_(e))),(()=>!0)),K=(e,l)=>M(U.entries(e),(([e,t])=>l(t,e))),X=e=>E(Z(e)),Y=e=>q(e)&&0==X(e),ee=(e,l)=>e?.has(l)??!1,le=e=>[...e?.values()??[]],te=(e,l)=>e?.forEach(l),ae=(e,l)=>e?.delete(l),ne=e=>new Map(e),de=(e,l)=>e?.get(l),oe=(e,l)=>te(e,((e,t)=>l(t,e))),se=(e,l)=>M([...e?.entries()??[]],(([e,t])=>l(t,e))),re=(e,l,t)=>R(t)?(ae(e,l),e):e?.set(l,t),Ie=(e,l,t)=>(ee(e,l)||re(e,l,t()),de(e,l)),$e=e=>e.toUpperCase(),ce=e=>e.toLowerCase(),ue="a ",ie="A function for",be=", and registers a listener so that any changes to that result will cause a re-render",pe="Callback",Ce="Count",he="Del",ge="Deps",me=ge+"?: React.DependencyList",we="doRollback?: DoRollback",fe="actions: () => Return, "+we,Te="export",ye="Id",ve="Invalid",Ve="Json",xe=ce(I),Re="?: ",Ae=" | undefined",ke="NonNullable",Se="Partial",Pe="Props",Oe="Provider",Ee=`Registers a ${xe} that will be called`,Le="Represents",Ne="rowId: "+ye,De="Schema",Ge="Set",je=", descending?: boolean, offset?: number, limit?: number",He="[]",Me="the Store",Je="Transaction",ze=Je+"Changes",We=ce(Je),Be="Execute a "+We+" to make multiple mutations",Fe="Explicitly starts a "+We,Ue="Explicitly finishes a "+We,_e="the end of the "+We,Ze="void",Qe=" => "+Ze,qe="WhenSet",Ke=" when setting it",Xe=ue+"string serialization of",Ye=" ",el="Gets a callback that can ",ll="the ",tl=" the schema for",al=(e=0)=>e?"the existence of ":"",nl=(e=0,l=0,a=0)=>al(a)+`the ${Tl[e]}content of`+(l?Ye+Me:t),dl=(e=0,l,a=0,n=0)=>ml[l]+Ye+al(n)+nl(e,1)+(a?" when setting it":t),ol=(e,l=0)=>Le+` a Row when ${l?"s":"g"}etting ${nl()} the '${e}' `+b,sl=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,rl=(e,l)=>`Calls a function for each ${e} in `+l,Il=e=>"The props passed to a component that renders "+e,$l=e=>"A function that takes "+e,cl=(e,l=0,t=0)=>ie+" listening to changes to "+al(t)+fl[e]+" in "+fl[l],ul=(e,l,a=0,n=0)=>Ee+" whenever "+al(n)+fl[e]+" in "+fl[l]+" change"+(a?t:"s"),il=e=>`the '${e}' `+b,bl=e=>"the specified Row in "+il(e),pl=(e,l=0,t=0)=>ml[l]+Ye+nl(0,0,t)+Ye+il(e),Cl=(e,l=0,t=0)=>ml[l]+` ${nl(0,0,t)} `+bl(e),hl=(e,l,t=0,a=0)=>ml[t]+Ye+al(a)+`the '${l}' Cell for `+bl(e),gl=(e,l=0,t=0)=>ml[l]+Ye+al(t)+`the '${e}' Value`,ml=["Gets","Checks existence of","Sets","Deletes","Sets part of",Le,"Gets "+Xe,"Sets "+Xe,Ee+" whenever",el+"set",el+"add",el+"set part of",el+"delete","Renders","Gets "+Xe+tl,"Sets"+tl,"Deletes"+tl],wl=[$,"has","set","del","set","forEach",c,t],fl=[Me,p,ll+b+Ye+i,ue+b,ll+h+Ye+i,ue+h,ll+w+Ye+i,ue+w,"invalid Cell changes",y,ll+T+Ye+i,ue+T,"invalid Value changes",ll+"sorted "+h+Ye+i,ll+w+Ye+i+" anywhere",ll+"number of Rows",ue+w+" anywhere"],Tl=[t,"tabular ","keyed value "],yl=e=>new Set(P(e)||R(e)?e:[e]),vl=(e,l)=>e?.add(l),Vl=/[^A-Za-z]+/,xl=/[^A-Za-z0-9]+/,Rl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Al=e=>e.includes(a),kl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return ee(e,n)?kl(e,l,t,a+1):(re(e,n,t),n)},Sl=e=>e.replace(Rl,((e,l,t)=>{const a=77-E(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Pl=e=>e.flat(1e3),Ol=(e,l=0)=>H(M(e.split(xl),((e,t)=>(t>0||l?$e:ce)(O(e,0,1))+O(e,1)))),El=e=>$e(H((e&&!Vl.test(e[0])?e:" "+e).split(xl),"_")),Ll=e=>`/** ${e}. */`,Nl=(...e)=>H(J(e,(e=>e)),", "),Dl=(...e)=>"{"+H(e,"; ")+"}",Gl=(...e)=>Dl(...M(e,(e=>"readonly "+e))),jl=()=>{const e=[ne(),ne(),ne(),ne()],l=ne(),a=ne(),n=e=>{const l=e.indexOf(" as ");return-1!=l?O(e,l+4):e};return[(...e)=>H(Pl(e),"\n"),(l,t,...a)=>j(a,(a=>j([0,1],(n=>(l??n)==n?vl(Ie(e[n],t,yl),a):0)))),(e,a,n,d=t,o=1)=>kl(l,e,[a,n,d,o]),(e,l,t)=>kl(a,e,P(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>de(a,e)===l?e:kl(a,e,l),(l=0)=>M([...G(se(e[l],((e,l)=>`import {${H(G(le(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Al(e)!=Al(l)?Al(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>se(l,(([e,l,a,n],d)=>[Ll(l),`${n?Te+" ":t}type ${d}${a} = ${e};`,t])),()=>se(a,((e,l)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${l} = ${F(e)}`,e,t])))]},Hl=e=>{const l=new WeakMap;return t=>(l.has(t)||l.set(t,e(t)),l.get(t))},Ml=(e,l,t)=>[l=>K(e,((e,a)=>l(a,Ol(a,1),t(El(a),`'${a}'`)))),(l,a)=>K(e[l],((e,l)=>a(l,e[s],e[r],t(El(l),`'${l}'`),Ol(l,1)))),e=>K(l,((l,a)=>e(a,l[s],l[r],t(El(a),`'${a}'`),Ol(a,1))))],Jl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,Dl(...l((e=>`'${e}'?: {[rowId: Id]: `+Dl(...a(e,((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`)))+"}"))),dl(1,5)),r=e(p+qe,Dl(...l((e=>`'${e}'?: {[rowId: Id]: `+Dl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),dl(1,5,1)),$=e(b+ye,"keyof "+s,"A "+b+" Id in "+Me),c=`<TId extends ${$}>`,i=e(b,ke+`<${s}[TId]>`,"A "+b+" in "+Me,c),T=e(b+qe,ke+`<${r}[TId]>`,"A "+b+" in "+Me+Ke,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+qe,T+"<TId>[Id]","A "+h+" in a "+b+Ke,c),V=e(w+ye,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,ke+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),A=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),k=e(w+pe,`(...[cellId, cell]: ${A}<TId>)`+Qe,$l(ue+w+" Id, and "+w),c),S=e(h+pe,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Qe+") "+Qe,$l(ue+h+" Id, and a "+w+" iterator"),c),P=e(b+w+pe,`(cellId: ${V}<TId>, count: number) `+Qe,$l(ue+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${Qe}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+pe,`(...[tableId, forEachRow]: ${O})`+Qe,$l(ue+b+" Id, and a "+h+" iterator"),t),L=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),N=e("GetCellChange",`(...[tableId, rowId, cellId]: ${L}) => CellChange`,ie+" returning information about any Cell's changes during a "+We),D=e(u+p+I,`(${o}, hasTables: boolean)`+Qe,cl(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${N}${Ae})`+Qe,cl(1)),j=e(C+I,`(${o})`+Qe,cl(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+Qe,cl(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${N}${Ae})`+Qe,cl(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+Qe,cl(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Qe,cl(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+Qe,cl(15,3)),U=e(g+I,`(${o}, tableId: ${$})`+Qe,cl(4,3)),_=e(m+I,"("+Nl(o,"tableId: "+$,"cellId: Id"+Ae,"descending: boolean","offset: number","limit: number"+Ae,"sortedRowIds: Ids")+")"+Qe,cl(13,3)),Z=e(u+h+I,"("+Nl(""+o,"tableId: "+$,Ne,"hasRow: boolean")+")"+Qe,cl(5,3,1)),Q=e(h+I,"("+Nl(""+o,"tableId: "+$,Ne,`getCellChange: ${N}${Ae}`)+")"+Qe,cl(5,3)),q=e(f+I,"("+Nl(""+o,"tableId: "+$,Ne)+")"+Qe,cl(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ne}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Qe,cl(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ne}, cellId: CId, newCell: ${x}<TId, CId> ${Ae}, oldCell: ${x}<TId, CId> ${Ae}, getCellChange: ${N} ${Ae}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,k,S,P,E,D,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Qe,cl(7,5)),e(ve+w+I,`(${o}, tableId: Id, ${Ne}, cellId: Id, invalidCells: any[])`+Qe,cl(8))]},(l,a)=>{const d=l+": "+a,o=e(y,Dl(...n(((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`))),dl(2,5)),s=e(y+qe,Dl(...n(((e,l)=>`'${e}'?: ${l}`))),dl(2,5,1)),r=e(T+ye,"keyof "+o,"A "+T+" Id in "+Me),$=e(T,ke+`<${o}[VId]>`,"A "+T+" Id in "+Me,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+Me,`<VId = ${r}>`,0),i=e(T+pe,`(...[valueId, value]: ${c})`+Qe,$l(ue+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,ie+" returning information about any Value's changes during a "+We),p=e(u+y+I,`(${d}, hasValues: boolean)`+Qe,cl(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${Ae})`+Qe,cl(9)),h=e(v+I,`(${d})`+Qe,cl(10)),g=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+Qe,cl(11,0,1)),m=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${Ae}, oldValue: ${$}<VId> ${Ae}, getValueChange: ${b} ${Ae}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,g,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+m+")"+Qe,cl(11)),e(ve+T+I,`(${d}, valueId: Id, invalidValues: any[])`+Qe,cl(12))]},(l,t)=>e(Je+I,`(${l}: ${t}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Qe,ie+" listening to the completion of a "+We)],zl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Wl=(e,l=t)=>`fluent(() => ${zl(e,l)})`,Bl=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,Fl=(e,a,n)=>{const[o,$,V,x,A,k,P,O]=jl(),[E,L,N]=Ml(e,a,A),[D,G,M]=Jl(V,E,L,N),J=ne(),W=(e=0)=>se(J,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||B(r,Ll(d)),z(r,t),r})),F=(e,l,a,n,d,o=t)=>kl(J,e,[l,a,n,d,o]),U=(e,l,a,n,d,o=t,s=t,r=t)=>F(wl[e]+l+(4==e?Se:t)+a,o,n,(n==Q?Wl:zl)(wl[e]+(4==e?Se:t)+a,s,e?void 0:n),d,r),_=(e,l,a,n=t,d=t,o=1,s=t)=>F(c+e+I,(n?n+", ":t)+xe+": "+l+(o?", mutator?: boolean":t),ye,Bl(c+e+I,d,o?"mutator":t),a,s),Z=`./${Ol(n)}.d`,Q=Ol(n,1),q=Ol(Q),K=[],X=ne();let ee=[],te=[];if($(1,Z,Q,`create${Q} as create${Q}Decl`),Y(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,x,k,P,O,N,G,M,J,W,B,F,Y,te,ae,oe,se,Ie,$e,ce,ue]=D(q,Q),ie=ne();E(((e,l)=>{const t=`<'${e}'>`,a=[V(l+b,o+t,Le+` the '${e}' `+b),V(l+b+qe,I+t,Le+` the '${e}' `+b+Ke),V(l+h,c+t,ol(e)),V(l+h+qe,T+t,ol(e,1)),V(l+w+ye,y+t,`A Cell Id for the '${e}' `+b),V(l+w+pe,x+t,$l(`a Cell Id and value from a Row in the '${e}' `+b)),V(l+h+pe,k+t,$l(`a Row Id from the '${e}' Table, and a Cell iterator`)),V(l+b+w+pe,P+t,$l(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];re(ie,e,a),$(1,Z,...a)})),$(1,Z,e,a,n,y,O,N,G,M,J,W,B,F,Y,te,ae,oe,se,Ie,$e,ce,ue),ee=[e,a,n,y,N,G,M,J,W,B,F,Y,te,ae,oe,se,Ie,$e,ce,ie],j([[e],[d],[Q,"tables: "+a,"tables"],[Q]],(([e,l,a],n)=>U(n,t,p,e,dl(1,n),l,a))),U(0,t,C,n+He,sl(b,Me)),U(5,t,b,Ze,rl(b,Me),"tableCallback: "+O,"tableCallback as any"),E(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=de(ie,e);j([[n],[d],[Q,"table: "+o,", table"],[Q]],(([n,d,o=t],s)=>U(s,l,b,n,pl(e,s),d,a+o))),U(0,l,b+f,i,sl(w,"the whole of "+il(e)),t,a),U(5,l,b+w,Ze,rl(b+w,"the whole of "+il(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),U(0,l,h+Ce,"number","Gets the number of Rows in the "+il(e),t,a),U(0,l,g,i,sl(h,il(e)),t,a),U(0,l,m,i,sl(h,il(e),1),"cellId?: "+I+je,a+", cellId, descending, offset, limit"),U(5,l,h,Ze,rl(h,il(e)),"rowCallback: "+c,a+", rowCallback as any"),j([[s],[d],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>U(s,l,h,n,Cl(e,s),Ne+d,a+", rowId"+o))),U(6,l,h,ye+Ae,"Add a new Row to "+il(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,l,f,I+He,sl(w,bl(e)),Ne,a+", rowId"),U(5,l,w,Ze,rl(w,bl(e)),Ne+", cellCallback: "+$,a+", rowId, cellCallback as any"),L(e,((n,o,s,r,I)=>{const $="Map"+Ol(o,1);re(X,o,$);const c=o+(R(s)?Ae:t);j([[c],[d],[Q,`, cell: ${o} | `+$,", cell as any"],[Q]],(([d,o=t,s=t],$)=>U($,l+I,w,d,hl(e,n,$),Ne+o,a+", rowId, "+r+s))),U(1,l+I,b+w,d,ml[1]+` the '${n}' Cell anywhere in `+il(e),t,a+", "+r)}))})),U(0,t,p+Ve,Ve,dl(1,6)),U(2,t,p+Ve,Q,dl(1,7),"tablesJson: "+Ve,"tables"+Ve),_(u+p,N,dl(1,8,0,1)+" changes"),_(p,G,dl(1,8)+" changes"),_(C,M,ul(2,0,1)),_(u+b,J,ul(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(b,W,ul(3,0),`tableId: ${n} | null`,"tableId"),_(b+f,B,ul(14,3,1),`tableId: ${n} | null`,"tableId"),_(u+b+w,F,ul(16,3,0,1),`tableId: ${n} | null, cellId: ${H(E((e=>de(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),_(h+Ce,Y,ul(15,3),`tableId: ${n} | null`,"tableId"),_(g,te,ul(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,ae,ul(13,3,1),Nl("tableId: TId",`cellId: ${y}<TId>`+Ae,"descending: boolean","offset: number","limit: number"+Ae),Nl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(u+h,oe,ul(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(h,se,ul(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,Ie,ul(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(u+w,$e,ul(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>de(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,ul(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>de(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(ve+w,ue,Ee+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,Z,...le(X)),z(K,".set"+p+De+"({",Pl(E(((e,l,a)=>[`[${a}]: {`,...L(e,((e,l,a,n)=>`[${n}]: {[${A(El(s),`'${s}'`)}]: ${A(El(l),`'${l}'`)}${R(a)?t:`, [${A(El(r),`'${r}'`)}]: `+(S(a)?A(El(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(Y(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=G(q,Q);$(1,Z,e,a,n,I,c,i,b,p,C,h),te=[e,a,n,c,i,b,p,C],j([[e],[d],[Q,"values: "+a,"values"],[Q],[Q,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>U(n,t,y,e,dl(2,n),l,a))),U(0,t,v,n+He,sl(T,Me)),U(5,t,T,"void",rl(T,Me),"valueCallback: "+I,"valueCallback as any"),N(((e,l,a,n,o)=>{const s="Map"+Ol(l,1);re(X,l,s),j([[l],[d],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,a,d=t],s)=>U(s,o,T,l,gl(e,s),a,n+d)))})),U(0,t,y+Ve,Ve,dl(2,6)),U(2,t,y+Ve,Q,dl(2,7),"valuesJson: "+Ve,"values"+Ve),_(u+y,c,dl(2,8,0,1)+" changes"),_(y,i,dl(2,8)+" changes"),_(v,b,ul(10,0,1)),_(u+T,p,ul(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(T,C,ul(11,0),`valueId: ${n} | null`,"valueId"),_(ve+T,h,Ee+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,Z,...le(X)),$(0,l,"ValueChange"),z(K,".set"+y+De+"({",N(((e,l,a,n)=>[`[${n}]: {[${A(El(s),`'${s}'`)}]: ${A(El(l),`'${l}'`)}${R(a)?t:`, [${A(El(r),`'${r}'`)}]: `+(S(a)?A(El(a),`'${a}'`):a)}},`])),"})")}U(0,t,"Content",`[${p}, ${y}]`,dl(0,0)),U(2,t,"Content",Q,dl(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,t,ze,Q,`Applies a set of ${ze} to the Store`,"transactionChanges: "+ze,"transactionChanges"),oe(X,((e,l)=>V(l,`(cell: ${e}${Ae}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",ye,"IdOrNull",Ve,"Store",ze),$(0,l,"Get"+ze,"GetTransactionLog"),U(0,t,Ve,Ve,dl(0,6)),U(2,t,Ve,Q,dl(0,7),"tablesAndValuesJson: "+Ve,"tablesAndValuesJson"),U(7,t,We,"Return",Be,fe,"actions, doRollback","<Return>"),U(7,t,"start"+Je,Q,Fe),U(7,t,"finish"+Je,Q,Ue,we,"doRollback");const ae=M(q,Q);return _("Start"+Je,ae,Ee+" just before the start of the "+We,t,t,0),_("WillFinish"+Je,ae,Ee+" just before "+_e,t,t,0),_("DidFinish"+Je,ae,Ee+" just after "+_e,t,t,0),U(7,t,"call"+I,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,t,I,Q,"Remove a listener that was previously added to "+Me,"listenerId: Id","listenerId"),F("getStore",t,"Store","store",ml[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,Z,Q,`create${Q} as create${Q}Decl`,ae),A("store",["createStore()",...K]),x("fluent","actions: () => Store",["actions();",`return ${q};`]),x("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),A(q,["{",...W(1),"}"]),[o(...k(0),...P(),Te+" interface "+Q+" {",...W(0),"}",t,Ll(`Creates a ${Q} object`),Te+" function create"+Q+"(): "+Q+";"),o(...k(1),Te+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),ee,te]},Ul=e=>$+e,_l=e=>Nl(Ul(e),Ul(e)+ge),Zl="debugIds?: boolean",Ql="debugIds={debugIds}",ql="then"+me,Kl="Parameter",Xl=": (parameter: "+Kl+", store: Store) => ",Yl="const contextValue = useContext(Context);",et=", based on a parameter",lt=": ",tt="<"+Kl+",>",at=Kl+"ized"+pe+"<"+Kl+">",nt="rowId",dt="rowId={rowId}",ot=", separator, debugIds",st="separator?: ReactElement | string",rt="then?: (store: Store",It=Nl(rt+")"+Qe,ql),$t="then, then"+ge,ct=nt+lt+ye,ut="View",it=(e,...l)=>Nl(...l,xe+": "+e,xe+me,"mutator?: boolean"),bt=(...e)=>Nl(...e,xe,xe+ge,"mutator"),pt=(e,a,n,s,r)=>{const[$,c,V,x,A,k,S,P]=jl(),[O,E,L]=Ml(e,a,A),N=`./${Ol(n)}.d`,D=`./${Ol(n)}-ui-react.d`,G="tinybase/ui-react",j=Ol(n,1),M=Ol(j),J=j+"Or"+j+ye,W=M+"Or"+j+ye,F=M+`={${M}}`,U=ne(),_=(e,l,a,n,d,o=t)=>(c(1,D,e+" as "+e+"Decl"),kl(U,e,[l,a,n,d,o])),Z=(e,l,a,n,d,o=t)=>_("use"+e,l,a,n,d,o),Q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,G,`use${l} as use${l}Core`),Z(e,Nl(d,le,r),a,ae+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>se(U,(([l,a,n,d,o],s)=>{const r=e?[Te+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[Te+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Ll(d)),z(r,t),r}));c(null,l,ye,"Store",pe,Kl+"ized"+pe),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,N,j);const X=V(J,j+" | "+ye,`Used when you need to refer to a ${j} in a React hook or component`),ee=V(Oe+Pe,Gl(M+Re+j,M+`ById?: {[${M}Id: Id]: ${j}}`),`Used with the ${Oe} component, so that a `+j+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,D,X,ee);const le=W+Re+X;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${j}?, {[${M}Id: Id]: ${j}}?]>([])`),Z("Create"+j,`create: () => ${j}, create`+me,j,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${j} within a React application with convenient memoization`);const te=Z(j,"id?: Id",j+Ae,["{",Yl,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${j} from within a ${Oe} component context`),ae=x("useHook",W+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),oe=x("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),re=x("wrap",Nl("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;"]),Ie=x("useCustomOrDefaultCellIds",Nl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!Y(e)){const[e,a,n,r,$,T,y,v,A,k,S,P,L,G,J,z,W,B,U,_]=s;c(null,N,e,a,n,$,T,y,v,A,k,S,P,L,G,J,z,W,U,B),c(0,N,r),c(1,N,j),c(null,l,i,"IdOrNull");const Z=x("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+ot+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${re}(rowIds.map((rowId) => (`,"<Row","{..."+oe+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",dt,"customCellIds={customCellIds}",F,Ql,"/>","))",ot,", tableId,",");"]),K=x("getDefaultTableComponent","tableId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=x("getDefaultCellComponent","tableId: Id, cellId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${H(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(u+p,u+p,d,dl(1,0,0,1)+be),Q(p,p,e,dl(1,0)+be);const Y=Q(C,C,n+He,sl(b,Me)+be);Q(Ge+p+pe,Ge+p+pe,at,dl(1,9)+et,Nl(Ul(p)+Xl+a,Ul(p)+me),_l(p),tt,Nl(rt,`tables: ${a})`+Qe,ql),$t),Q(he+p+pe,he+p+pe,pe,dl(1,12),t,t,t,It,$t);const ee=V(w+Pe,Gl("tableId?: TId","rowId: Id","cellId?: CId",M+Re+j,Zl),Il(ue+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=V(h+Pe,Gl("tableId?: TId","rowId: Id",M+Re+j,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,st,Zl),Il(ue+h),`<TId extends ${n}>`),te=V(b+Pe,Gl("tableId?: TId",M+Re+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",st,Zl),Il(ue+b),`<TId extends ${n}>`),ae=V("Sorted"+b+Pe,Gl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Re+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",st,Zl),Il(ue+"sorted "+b),`<TId extends ${n}>`),ne=V(p+Pe,Gl(M+Re+j,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,st,Zl),Il(nl(1,1)));c(1,D,ne,te,ae,le,ee),q(p+ut,"{"+M+", tableComponents, getTableComponentProps"+ot+"}: "+ne,[re+`(${Y}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${oe}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",F,Ql,"/>;","}), separator)"],dl(1,13)+be),O(((e,l,a)=>{const[n,s,r,I,$]=de(_,e);c(null,N,n,s,r,I,$),Q(u+l+b,u+b,d,pl(e,0,1)+be,t,a),Q(l+b,b,n,pl(e)+be,t,a),Q(l+b+f,b+f,i,sl(w,"the whole of "+il(e))+be,t,a),Q(l+h+Ce,h+Ce,o,"Gets the number of Rows in "+il(e)+be,t,a);const p=Q(l+g,g,i,sl(h,il(e))+be,t,a),C=Q(l+m,m,i,sl(h,il(e),1)+be,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");Q(u+l+h,u+h,d,Cl(e,0,1)+be,ct,Nl(a,nt)),Q(l+h,h,r,Cl(e)+be,ct,Nl(a,nt)),Q(l+f,f,$+He,sl(w,bl(e))+be,ct,Nl(a,nt)),Q(Ge+l+b+pe,Ge+b+pe,at,pl(e,9)+et,Nl(Ul(b)+Xl+s,Ul(b)+me),Nl(a,_l(b)),tt,Nl(rt,`table: ${s})`+Qe,ql),$t),Q(he+l+b+pe,he+b+pe,pe,pl(e,12),t,a,t,It,$t),Q(Ge+l+h+pe,Ge+h+pe,at,Cl(e,9)+et,Nl(ct,Ul(h)+Xl+I,Ul(h)+me),Nl(a,nt,_l(h)),tt,Nl(rt,`row: ${I})`+Qe,ql),$t),Q("Add"+l+h+pe,"Add"+h+pe,at,Cl(e,10)+et,Nl(Ul(h)+Xl+I,Ul(h)+me),Nl(a,_l(h)),tt,"then?: ("+Nl(ct+Ae,"store: Store","row: "+I+")"+Qe,"then"+me)+", reuseRowIds?: boolean",$t+", reuseRowIds"),Q(Ge+l+Se+h+pe,Ge+Se+h+pe,at,Cl(e,11)+et,Nl(ct,Ul(Se+h)+Xl+I,Ul(Se+h)+me),Nl(a,nt,_l(Se+h)),tt,Nl(rt,`partialRow: ${I})`+Qe,ql),$t),Q(he+l+h+pe,he+h+pe,pe,Cl(e,12),ct,Nl(a,nt),t,It,$t);const T=q(l+h+ut,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+ot+`}: ${le}<'${e}'>`,[re+`(${Ie}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${oe}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,dt,"cellId={cellId}",F,Ql,"/>;","})"+ot+", rowId)"],Cl(e,13)+be);q(l+"Sorted"+b+ut,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,pl(e,13)+", sorted"+be),q(l+b+ut,`props: ${te}<'${e}'>`,Z+"(props, "+p+`(props.${M}), ${a}, ${T});`,pl(e,13)+be),E(e,((n,o,s,r,I)=>{const $="Map"+Ol(o,1);c(0,N,$),c(1,N,$),Q(u+l+I+b+w,u+b+w,d,`Gets ${al(1)}the '${n}' Cell anywhere in `+il(e)+be,t,Nl(a,r)),Q(u+l+I+w,u+w,d,hl(e,n,0,1)+be,ct,Nl(a,nt,r));const i=Q(l+I+w,w,o+(R(s)?Ae:t),hl(e,n)+be,ct,Nl(a,nt,r));Q(Ge+l+I+w+pe,Ge+w+pe,at,hl(e,n,9)+et,Nl(ct,Ul(w)+Xl+o+" | "+$,Ul(w)+me),Nl(a,nt,r,_l(w)),tt,Nl(rt,`cell: ${o} | ${$})`+Qe,ql),$t),Q(he+l+I+w+pe,he+w+pe,pe,hl(e,n,12),Nl(ct,"forceDel?: boolean"),Nl(a,nt,r,"forceDel"),t,It,$t),q(l+I+w+ut,`{rowId, ${M}, debugIds}: `+ee+`<'${e}', '${n}'>`,[re+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],hl(e,n,13)+be)}))}));const se=H(O((e=>de(_,e)?.[4]??t))," | ");Q(u+p+I,u+p+I,Ze,dl(1,8,0,1)+" changes",it($),bt()),Q(p+I,p+I,Ze,dl(1,8)+" changes",it(T),bt()),Q(C+I,C+I,Ze,ul(2,0,1),it(y),bt()),Q(u+b+I,u+b+I,Ze,ul(3,0,0,1),it(v,`tableId: ${n} | null`),bt("tableId")),Q(b+I,b+I,Ze,ul(3,0),it(A,`tableId: ${n} | null`),bt("tableId")),Q(b+f+I,b+f+I,Ze,ul(14,3,1),it(k,`tableId: ${n} | null`),bt("tableId")),Q(u+b+w+I,u+b+w+I,Ze,ul(16,3,0,1),it(S,`tableId: ${n} | null`,`cellId: ${se} | null`),bt("tableId","cellId")),Q(h+Ce+I,h+Ce+I,Ze,ul(15,3),it(P,`tableId: ${n} | null`),bt("tableId")),Q(g+I,g+I,Ze,ul(4,3,1),it(L,`tableId: ${n} | null`),bt("tableId")),Q(m+I,m+I,Ze,ul(13,3,1),it(G,`tableId: ${n} | null`,"cellId: "+se+Ae,"descending: boolean","offset: number","limit: number"+Ae),bt("tableId","cellId","descending","offset","limit")),Q(u+h+I,u+h+I,Ze,ul(5,3,0,1),it(J,`tableId: ${n} | null`,nt+": IdOrNull"),bt("tableId",nt)),Q(h+I,h+I,Ze,ul(5,3),it(z,`tableId: ${n} | null`,nt+": IdOrNull"),bt("tableId",nt)),Q(f+I,f+I,Ze,ul(6,5,1),it(W,`tableId: ${n} | null`,nt+": IdOrNull"),bt("tableId",nt)),Q(u+w+I,u+w+I,Ze,ul(7,5,0,1),it(B,`tableId: ${n} | null`,nt+": IdOrNull",`cellId: ${se} | null`),bt("tableId",nt,"cellId")),Q(w+I,w+I,Ze,ul(7,5),it(U,`tableId: ${n} | null`,nt+": IdOrNull",`cellId: ${se} | null`),bt("tableId",nt,"cellId"))}if(!Y(a)){const[e,l,a,n,o,s,$,i]=r;c(null,N,...r),c(1,N,j);const b=x("getDefaultValueComponent","valueId: Id",H(L(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(u+y,u+y,d,dl(2,0,0,1)+be),Q(y,y,e,dl(2,0)+be);const p=Q(v,v,a+He,sl(T,Me)+be);Q(Ge+y+pe,Ge+y+pe,at,dl(2,9)+et,Nl(Ul(y)+Xl+l,Ul(y)+me),_l(y),tt,Nl(rt,`values: ${l})`+Qe,ql),$t),Q(Ge+Se+y+pe,Ge+Se+y+pe,at,dl(2,11)+et,Nl(Ul(Se+y)+Xl+l,Ul(Se+y)+me),_l(Se+y),tt,Nl(rt,`partialValues: ${l})`+Qe,ql),$t),Q(he+y+pe,he+y+pe,pe,dl(2,12),t,t,t,It,$t);const C=V(T+Pe,Gl("valueId?: VId",M+Re+j,Zl),Il("a Value"),`<VId extends ${a}>`),h=V(y+Pe,Gl(M+Re+j,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,st,Zl),Il(nl(2,1)));c(1,D,h,C),q(y+ut,"{"+M+", valueComponents, getValueComponentProps"+ot+"}: "+h,[re+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${oe}(getValueComponentProps, valueId)}`,"key={valueId}",F,Ql,"/>;","}), separator)"],dl(2,13)+be),L(((e,l,a,n,o)=>{const s="Map"+Ol(l,1);c(0,N,s),c(1,N,s),Q(u+o+T,u+T,d,gl(e,0,1)+be,t,n);const r=Q(o+T,T,l,gl(e)+be,t,n);Q(Ge+o+T+pe,Ge+T+pe,at,gl(e,9)+et,Nl(Ul(T)+Xl+l+" | "+s,Ul(T)+me),Nl(n,_l(T)),tt,Nl(rt,`value: ${l} | ${s})`+Qe,ql),$t),Q(he+o+T+pe,he+T+pe,pe,gl(e,12),t,n,t,It,$t),q(o+T+ut,`{${M}, debugIds}: ${C}<'${e}'>`,[re+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],gl(e,13)+be)})),Q(u+y+I,u+y+I,Ze,dl(2,8,0,1)+" changes",it(n),bt()),Q(y+I,y+I,Ze,dl(2,8)+" changes",it(o),bt()),Q(v+I,v+I,Ze,ul(10,0,1),it(s),bt()),Q(u+T+I,u+T+I,Ze,ul(11,0,0,1),it($,`valueId: ${a} | null`),bt("valueId")),Q(T+I,T+I,Ze,ul(11,0),it(i,`valueId: ${a} | null`),bt("valueId"))}return q(Oe,`{${M}, ${M}ById, children}: `+ee+" & {children: React.ReactNode}",["{",Yl,"return (","<Context."+Oe,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Oe}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...S(),...K(0)),$(...k(1),...P(),...K(1))]},Ct=(e,l,a)=>{if(Y(e)&&Y(l))return[t,t,t,t];const[n,d,o,s]=Fl(e,l,a);return[n,d,...pt(e,l,a,o,s)]},ht=JSON.parse,gt="prettier/",mt=gt+"plugins/",wt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},ft=Hl((e=>{const l=()=>{const l=ht(e.getTablesSchemaJson());return!Y(l)||D(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=ne();if(D(a,(l=>D(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=Ie(n,a,(()=>[N(d),ne(),[0],0])),[s,r,[I]]=o,$=Ie(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),re(r,d,$),o[3]++,s==N(d)})))))return l[t]={},te(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==E(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=ht(e.getValuesSchemaJson());return Y(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:N(t)}})),l},a=e=>Ct(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(gt+"standalone")).format,z(t,await import(mt+"estree"),await import(mt+"typescript"))}catch(e){n=async e=>e}return await L(M(a(e),(async(e,a)=>Sl(await n(e,{...wt,plugins:t,filepath:"_."+l[a]})))))};return Q({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{ft as createTools};
|
|
1
|
+
const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",g=h+i,m="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V=Promise,x=isFinite,R=e=>null==e,A=(e,l,t)=>R(e)?t?.():l(e),k=e=>e==n||e==d,S=l=>e(l)==n,P=e=>Array.isArray(e),O=(e,l,t)=>e.slice(l,t),E=e=>e.length,L=async e=>V.all(e),N=l=>{const t=e(l);return k(t)||t==o&&x(l)?t:void 0},D=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),j=(e,l)=>e.forEach(l),H=(e,l=t)=>e.join(l),M=(e,l)=>e.map(l),J=(e,l)=>e.filter(l),z=(e,...l)=>e.push(...l),W=e=>e.pop(),B=(e,...l)=>e.unshift(...l),F=e=>e.shift(),U=Object,_=e=>U.getPrototypeOf(e),Z=U.entries,Q=U.keys,q=U.freeze,K=e=>!R(e)&&A(_(e),(e=>e==U.prototype||R(_(e))),(()=>!0)),X=(e,l)=>M(Z(e),(([e,t])=>l(t,e))),Y=e=>E(Q(e)),ee=e=>K(e)&&0==Y(e),le=(e,l)=>e?.has(l)??!1,te=e=>[...e?.values()??[]],ae=(e,l)=>e?.forEach(l),ne=(e,l)=>e?.delete(l),de=e=>new Map(e),oe=(e,l)=>e?.get(l),se=(e,l)=>ae(e,((e,t)=>l(t,e))),re=(e,l)=>M([...e?.entries()??[]],(([e,t])=>l(t,e))),Ie=(e,l,t)=>R(t)?(ne(e,l),e):e?.set(l,t),$e=(e,l,t)=>(le(e,l)||Ie(e,l,t()),oe(e,l)),ce=e=>e.toUpperCase(),ue=e=>e.toLowerCase(),ie="a ",be="A function for",pe=", and registers a listener so that any changes to that result will cause a re-render",Ce="Callback",he="Count",ge="Del",me="Deps",we=me+"?: React.DependencyList",fe="doRollback?: DoRollback",Te="actions: () => Return, "+fe,ye="export",ve="Id",Ve="Invalid",xe="Json",Re=ue(I),Ae="?: ",ke=" | undefined",Se="NonNullable",Pe="Partial",Oe="Props",Ee="Provider",Le=`Registers a ${Re} that will be called`,Ne="Represents",De="rowId: "+ve,Ge="Schema",je="Set",He=", descending?: boolean, offset?: number, limit?: number",Me="[]",Je="the Store",ze="Transaction",We=ze+"Changes",Be=ue(ze),Fe="Execute a "+Be+" to make multiple mutations",Ue="Explicitly starts a "+Be,_e="Explicitly finishes a "+Be,Ze="the end of the "+Be,Qe="void",qe=" => "+Qe,Ke="WhenSet",Xe=" when setting it",Ye=ie+"string serialization of",el=" ",ll="Gets a callback that can ",tl="the ",al=" the schema for",nl=(e=0)=>e?"the existence of ":"",dl=(e=0,l=0,a=0)=>nl(a)+`the ${yl[e]}content of`+(l?el+Je:t),ol=(e=0,l,a=0,n=0)=>wl[l]+el+nl(n)+dl(e,1)+(a?" when setting it":t),sl=(e,l=0)=>Ne+` a Row when ${l?"s":"g"}etting ${dl()} the '${e}' `+b,rl=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,Il=(e,l)=>`Calls a function for each ${e} in `+l,$l=e=>"The props passed to a component that renders "+e,cl=e=>"A function that takes "+e,ul=(e,l=0,t=0)=>be+" listening to changes to "+nl(t)+Tl[e]+" in "+Tl[l],il=(e,l,a=0,n=0)=>Le+" whenever "+nl(n)+Tl[e]+" in "+Tl[l]+" change"+(a?t:"s"),bl=e=>`the '${e}' `+b,pl=e=>"the specified Row in "+bl(e),Cl=(e,l=0,t=0)=>wl[l]+el+dl(0,0,t)+el+bl(e),hl=(e,l=0,t=0)=>wl[l]+` ${dl(0,0,t)} `+pl(e),gl=(e,l,t=0,a=0)=>wl[t]+el+nl(a)+`the '${l}' Cell for `+pl(e),ml=(e,l=0,t=0)=>wl[l]+el+nl(t)+`the '${e}' Value`,wl=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ne,"Gets "+Ye,"Sets "+Ye,Le+" whenever",ll+"set",ll+"add",ll+"set part of",ll+"delete","Renders","Gets "+Ye+al,"Sets"+al,"Deletes"+al],fl=[$,"has","set","del","set","forEach",c,t],Tl=[Je,p,tl+b+el+i,ie+b,tl+h+el+i,ie+h,tl+w+el+i,ie+w,"invalid Cell changes",y,tl+T+el+i,ie+T,"invalid Value changes",tl+"sorted "+h+el+i,tl+w+el+i+" anywhere",tl+"number of Rows",ie+w+" anywhere"],yl=[t,"tabular ","keyed value "],vl=e=>new Set(P(e)||R(e)?e:[e]),Vl=(e,l)=>e?.add(l),xl=/[^A-Za-z]+/,Rl=/[^A-Za-z0-9]+/,Al=/^( *)\/\*\* *(.*?) *\*\/$/gm,kl=e=>e.includes(a),Sl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return le(e,n)?Sl(e,l,t,a+1):(Ie(e,n,t),n)},Pl=e=>e.replace(Al,((e,l,t)=>{const a=77-E(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Ol=e=>e.flat(1e3),El=(e,l=0)=>H(M(e.split(Rl),((e,t)=>(t>0||l?ce:ue)(O(e,0,1))+O(e,1)))),Ll=e=>ce(H((e&&!xl.test(e[0])?e:" "+e).split(Rl),"_")),Nl=e=>`/** ${e}. */`,Dl=(...e)=>H(J(e,(e=>e)),", "),Gl=(...e)=>"{"+H(e,"; ")+"}",jl=(...e)=>Gl(...M(e,(e=>"readonly "+e))),Hl=()=>{const e=[de(),de(),de(),de()],l=de(),a=de(),n=e=>{const l=e.indexOf(" as ");return-1!=l?O(e,l+4):e};return[(...e)=>H(Ol(e),"\n"),(l,t,...a)=>j(a,(a=>j([0,1],(n=>(l??n)==n?Vl($e(e[n],t,vl),a):0)))),(e,a,n,d=t,o=1)=>Sl(l,e,[a,n,d,o]),(e,l,t)=>Sl(a,e,P(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>oe(a,e)===l?e:Sl(a,e,l),(l=0)=>M([...G(re(e[l],((e,l)=>`import {${H(G(te(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>kl(e)!=kl(l)?kl(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>re(l,(([e,l,a,n],d)=>[Nl(l),`${n?ye+" ":t}type ${d}${a} = ${e};`,t])),()=>re(a,((e,l)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${l} = ${F(e)}`,e,t])))]},Ml=(e,l)=>{const t=new WeakMap;return a=>{t.has(a)||t.set(a,e(a));const n=t.get(a);return l?.(n),n}},Jl=(e,l,t)=>[l=>X(e,((e,a)=>l(a,El(a,1),t(Ll(a),`'${a}'`)))),(l,a)=>X(e[l],((e,l)=>a(l,e[s],e[r],t(Ll(l),`'${l}'`),El(l,1)))),e=>X(l,((l,a)=>e(a,l[s],l[r],t(Ll(a),`'${a}'`),El(a,1))))],zl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`)))+"}"))),ol(1,5)),r=e(p+Ke,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),ol(1,5,1)),$=e(b+ve,"keyof "+s,"A "+b+" Id in "+Je),c=`<TId extends ${$}>`,i=e(b,Se+`<${s}[TId]>`,"A "+b+" in "+Je,c),T=e(b+Ke,Se+`<${r}[TId]>`,"A "+b+" in "+Je+Xe,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+Ke,T+"<TId>[Id]","A "+h+" in a "+b+Xe,c),V=e(w+ve,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,Se+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),A=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),k=e(w+Ce,`(...[cellId, cell]: ${A}<TId>)`+qe,cl(ie+w+" Id, and "+w),c),S=e(h+Ce,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+qe+") "+qe,cl(ie+h+" Id, and a "+w+" iterator"),c),P=e(b+w+Ce,`(cellId: ${V}<TId>, count: number) `+qe,cl(ie+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${qe}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+Ce,`(...[tableId, forEachRow]: ${O})`+qe,cl(ie+b+" Id, and a "+h+" iterator"),t),L=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),N=e("GetCellChange",`(...[tableId, rowId, cellId]: ${L}) => CellChange`,be+" returning information about any Cell's changes during a "+Be),D=e(u+p+I,`(${o}, hasTables: boolean)`+qe,ul(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${N}${ke})`+qe,ul(1)),j=e(C+I,`(${o})`+qe,ul(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+qe,ul(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${N}${ke})`+qe,ul(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+qe,ul(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+qe,ul(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+qe,ul(15,3)),U=e(g+I,`(${o}, tableId: ${$})`+qe,ul(4,3)),_=e(m+I,"("+Dl(o,"tableId: "+$,"cellId: Id"+ke,"descending: boolean","offset: number","limit: number"+ke,"sortedRowIds: Ids")+")"+qe,ul(13,3)),Z=e(u+h+I,"("+Dl(""+o,"tableId: "+$,De,"hasRow: boolean")+")"+qe,ul(5,3,1)),Q=e(h+I,"("+Dl(""+o,"tableId: "+$,De,`getCellChange: ${N}${ke}`)+")"+qe,ul(5,3)),q=e(f+I,"("+Dl(""+o,"tableId: "+$,De)+")"+qe,ul(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${De}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+qe,ul(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${De}, cellId: CId, newCell: ${x}<TId, CId> ${ke}, oldCell: ${x}<TId, CId> ${ke}, getCellChange: ${N} ${ke}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,k,S,P,E,D,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+qe,ul(7,5)),e(Ve+w+I,`(${o}, tableId: Id, ${De}, cellId: Id, invalidCells: any[])`+qe,ul(8))]},(l,a)=>{const d=l+": "+a,o=e(y,Gl(...n(((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`))),ol(2,5)),s=e(y+Ke,Gl(...n(((e,l)=>`'${e}'?: ${l}`))),ol(2,5,1)),r=e(T+ve,"keyof "+o,"A "+T+" Id in "+Je),$=e(T,Se+`<${o}[VId]>`,"A "+T+" Id in "+Je,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+Je,`<VId = ${r}>`,0),i=e(T+Ce,`(...[valueId, value]: ${c})`+qe,cl(ie+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,be+" returning information about any Value's changes during a "+Be),p=e(u+y+I,`(${d}, hasValues: boolean)`+qe,ul(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${ke})`+qe,ul(9)),h=e(v+I,`(${d})`+qe,ul(10)),g=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+qe,ul(11,0,1)),m=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${ke}, oldValue: ${$}<VId> ${ke}, getValueChange: ${b} ${ke}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,g,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+m+")"+qe,ul(11)),e(Ve+T+I,`(${d}, valueId: Id, invalidValues: any[])`+qe,ul(12))]},(l,t)=>e(ze+I,`(${l}: ${t}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+qe,be+" listening to the completion of a "+Be)],Wl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Bl=(e,l=t)=>`fluent(() => ${Wl(e,l)})`,Fl=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,Ul=(e,a,n)=>{const[o,$,V,x,A,k,P,O]=Hl(),[E,L,N]=Jl(e,a,A),[D,G,M]=zl(V,E,L,N),J=de(),W=(e=0)=>re(J,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||B(r,Nl(d)),z(r,t),r})),F=(e,l,a,n,d,o=t)=>Sl(J,e,[l,a,n,d,o]),U=(e,l,a,n,d,o=t,s=t,r=t)=>F(fl[e]+l+(4==e?Pe:t)+a,o,n,(n==Q?Bl:Wl)(fl[e]+(4==e?Pe:t)+a,s,e?void 0:n),d,r),_=(e,l,a,n=t,d=t,o=1,s=t)=>F(c+e+I,(n?n+", ":t)+Re+": "+l+(o?", mutator?: boolean":t),ve,Fl(c+e+I,d,o?"mutator":t),a,s),Z=`./${El(n)}.d`,Q=El(n,1),q=El(Q),K=[],X=de();let Y=[],le=[];if($(1,Z,Q,`create${Q} as create${Q}Decl`),ee(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,x,k,P,O,N,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue]=D(q,Q),ie=de();E(((e,l)=>{const t=`<'${e}'>`,a=[V(l+b,o+t,Ne+` the '${e}' `+b),V(l+b+Ke,I+t,Ne+` the '${e}' `+b+Xe),V(l+h,c+t,sl(e)),V(l+h+Ke,T+t,sl(e,1)),V(l+w+ve,y+t,`A Cell Id for the '${e}' `+b),V(l+w+Ce,x+t,cl(`a Cell Id and value from a Row in the '${e}' `+b)),V(l+h+Ce,k+t,cl(`a Row Id from the '${e}' Table, and a Cell iterator`)),V(l+b+w+Ce,P+t,cl(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];Ie(ie,e,a),$(1,Z,...a)})),$(1,Z,e,a,n,y,O,N,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue),Y=[e,a,n,y,N,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ie],j([[e],[d],[Q,"tables: "+a,"tables"],[Q]],(([e,l,a],n)=>U(n,t,p,e,ol(1,n),l,a))),U(0,t,C,n+Me,rl(b,Je)),U(5,t,b,Qe,Il(b,Je),"tableCallback: "+O,"tableCallback as any"),E(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=oe(ie,e);j([[n],[d],[Q,"table: "+o,", table"],[Q]],(([n,d,o=t],s)=>U(s,l,b,n,Cl(e,s),d,a+o))),U(0,l,b+f,i,rl(w,"the whole of "+bl(e)),t,a),U(5,l,b+w,Qe,Il(b+w,"the whole of "+bl(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),U(0,l,h+he,"number","Gets the number of Rows in the "+bl(e),t,a),U(0,l,g,i,rl(h,bl(e)),t,a),U(0,l,m,i,rl(h,bl(e),1),"cellId?: "+I+He,a+", cellId, descending, offset, limit"),U(5,l,h,Qe,Il(h,bl(e)),"rowCallback: "+c,a+", rowCallback as any"),j([[s],[d],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>U(s,l,h,n,hl(e,s),De+d,a+", rowId"+o))),U(6,l,h,ve+ke,"Add a new Row to "+bl(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,l,f,I+Me,rl(w,pl(e)),De,a+", rowId"),U(5,l,w,Qe,Il(w,pl(e)),De+", cellCallback: "+$,a+", rowId, cellCallback as any"),L(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);Ie(X,o,$);const c=o+(R(s)?ke:t);j([[c],[d],[Q,`, cell: ${o} | `+$,", cell as any"],[Q]],(([d,o=t,s=t],$)=>U($,l+I,w,d,gl(e,n,$),De+o,a+", rowId, "+r+s))),U(1,l+I,b+w,d,wl[1]+` the '${n}' Cell anywhere in `+bl(e),t,a+", "+r)}))})),U(0,t,p+xe,xe,ol(1,6)),U(2,t,p+xe,Q,ol(1,7),"tablesJson: "+xe,"tables"+xe),_(u+p,N,ol(1,8,0,1)+" changes"),_(p,G,ol(1,8)+" changes"),_(C,M,il(2,0,1)),_(u+b,J,il(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(b,W,il(3,0),`tableId: ${n} | null`,"tableId"),_(b+f,B,il(14,3,1),`tableId: ${n} | null`,"tableId"),_(u+b+w,F,il(16,3,0,1),`tableId: ${n} | null, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),_(h+he,ee,il(15,3),`tableId: ${n} | null`,"tableId"),_(g,le,il(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,ae,il(13,3,1),Dl("tableId: TId",`cellId: ${y}<TId>`+ke,"descending: boolean","offset: number","limit: number"+ke),Dl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(u+h,ne,il(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(h,se,il(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,re,il(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(u+w,$e,il(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,il(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(Ve+w,ue,Le+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,Z,...te(X)),z(K,".set"+p+Ge+"({",Ol(E(((e,l,a)=>[`[${a}]: {`,...L(e,((e,l,a,n)=>`[${n}]: {[${A(Ll(s),`'${s}'`)}]: ${A(Ll(l),`'${l}'`)}${R(a)?t:`, [${A(Ll(r),`'${r}'`)}]: `+(S(a)?A(Ll(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(ee(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=G(q,Q);$(1,Z,e,a,n,I,c,i,b,p,C,h),le=[e,a,n,c,i,b,p,C],j([[e],[d],[Q,"values: "+a,"values"],[Q],[Q,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>U(n,t,y,e,ol(2,n),l,a))),U(0,t,v,n+Me,rl(T,Je)),U(5,t,T,"void",Il(T,Je),"valueCallback: "+I,"valueCallback as any"),N(((e,l,a,n,o)=>{const s="Map"+El(l,1);Ie(X,l,s),j([[l],[d],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,a,d=t],s)=>U(s,o,T,l,ml(e,s),a,n+d)))})),U(0,t,y+xe,xe,ol(2,6)),U(2,t,y+xe,Q,ol(2,7),"valuesJson: "+xe,"values"+xe),_(u+y,c,ol(2,8,0,1)+" changes"),_(y,i,ol(2,8)+" changes"),_(v,b,il(10,0,1)),_(u+T,p,il(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(T,C,il(11,0),`valueId: ${n} | null`,"valueId"),_(Ve+T,h,Le+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,Z,...te(X)),$(0,l,"ValueChange"),z(K,".set"+y+Ge+"({",N(((e,l,a,n)=>[`[${n}]: {[${A(Ll(s),`'${s}'`)}]: ${A(Ll(l),`'${l}'`)}${R(a)?t:`, [${A(Ll(r),`'${r}'`)}]: `+(S(a)?A(Ll(a),`'${a}'`):a)}},`])),"})")}U(0,t,"Content",`[${p}, ${y}]`,ol(0,0)),U(2,t,"Content",Q,ol(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(2,t,We,Q,`Applies a set of ${We} to the Store`,"transactionChanges: "+We,"transactionChanges"),se(X,((e,l)=>V(l,`(cell: ${e}${ke}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",ve,"IdOrNull",xe,"Store",We),$(0,l,"Get"+We,"GetTransactionLog"),U(0,t,xe,xe,ol(0,6)),U(2,t,xe,Q,ol(0,7),"tablesAndValuesJson: "+xe,"tablesAndValuesJson"),U(7,t,Be,"Return",Fe,Te,"actions, doRollback","<Return>"),U(7,t,"start"+ze,Q,Ue),U(7,t,"finish"+ze,Q,_e,fe,"doRollback");const ae=M(q,Q);return _("Start"+ze,ae,Le+" just before the start of the "+Be,t,t,0),_("WillFinish"+ze,ae,Le+" just before "+Ze,t,t,0),_("DidFinish"+ze,ae,Le+" just after "+Ze,t,t,0),U(7,t,"call"+I,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,t,I,Q,"Remove a listener that was previously added to "+Je,"listenerId: Id","listenerId"),F("getStore",t,"Store","store",wl[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,Z,Q,`create${Q} as create${Q}Decl`,ae),A("store",["createStore()",...K]),x("fluent","actions: () => Store",["actions();",`return ${q};`]),x("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),A(q,["{",...W(1),"}"]),[o(...k(0),...P(),ye+" interface "+Q+" {",...W(0),"}",t,Nl(`Creates a ${Q} object`),ye+" function create"+Q+"(): "+Q+";"),o(...k(1),ye+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),Y,le]},_l=e=>$+e,Zl=e=>Dl(_l(e),_l(e)+me),Ql="debugIds?: boolean",ql="debugIds={debugIds}",Kl="then"+we,Xl="Parameter",Yl=": (parameter: "+Xl+", store: Store) => ",et="const contextValue = useContext(Context);",lt=", based on a parameter",tt=": ",at="<"+Xl+",>",nt=Xl+"ized"+Ce+"<"+Xl+">",dt="rowId",ot="rowId={rowId}",st=", separator, debugIds",rt="separator?: ReactElement | string",It="then?: (store: Store",$t=Dl(It+")"+qe,Kl),ct="then, then"+me,ut=dt+tt+ve,it="View",bt=(e,...l)=>Dl(...l,Re+": "+e,Re+we,"mutator?: boolean"),pt=(...e)=>Dl(...e,Re,Re+me,"mutator"),Ct=(e,a,n,s,r)=>{const[$,c,V,x,A,k,S,P]=Hl(),[O,E,L]=Jl(e,a,A),N=`./${El(n)}.d`,D=`./${El(n)}-ui-react.d`,G="tinybase/ui-react",j=El(n,1),M=El(j),J=j+"Or"+j+ve,W=M+"Or"+j+ve,F=M+`={${M}}`,U=de(),_=(e,l,a,n,d,o=t)=>(c(1,D,e+" as "+e+"Decl"),Sl(U,e,[l,a,n,d,o])),Z=(e,l,a,n,d,o=t)=>_("use"+e,l,a,n,d,o),Q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,G,`use${l} as use${l}Core`),Z(e,Dl(d,le,r),a,ae+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>re(U,(([l,a,n,d,o],s)=>{const r=e?[ye+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[ye+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Nl(d)),z(r,t),r}));c(null,l,ve,"Store",Ce,Xl+"ized"+Ce),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,N,j);const X=V(J,j+" | "+ve,`Used when you need to refer to a ${j} in a React hook or component`),Y=V(Ee+Oe,jl(M+Ae+j,M+`ById?: {[${M}Id: Id]: ${j}}`),`Used with the ${Ee} component, so that a `+j+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,D,X,Y);const le=W+Ae+X;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${j}?, {[${M}Id: Id]: ${j}}?]>([])`),Z("Create"+j,`create: () => ${j}, create`+we,j,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${j} within a React application with convenient memoization`);const te=Z(j,"id?: Id",j+ke,["{",et,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${j} from within a ${Ee} component context`),ae=x("useHook",W+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),ne=x("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),se=x("wrap",Dl("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;"]),Ie=x("useCustomOrDefaultCellIds",Dl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!ee(e)){const[e,a,n,r,$,T,y,v,A,k,S,P,L,G,J,z,W,B,U,_]=s;c(null,N,e,a,n,$,T,y,v,A,k,S,P,L,G,J,z,W,U,B),c(0,N,r),c(1,N,j),c(null,l,i,"IdOrNull");const Z=x("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+st+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${se}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ot,"customCellIds={customCellIds}",F,ql,"/>","))",st,", tableId,",");"]),K=x("getDefaultTableComponent","tableId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=x("getDefaultCellComponent","tableId: Id, cellId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${H(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(u+p,u+p,d,ol(1,0,0,1)+pe),Q(p,p,e,ol(1,0)+pe);const Y=Q(C,C,n+Me,rl(b,Je)+pe);Q(je+p+Ce,je+p+Ce,nt,ol(1,9)+lt,Dl(_l(p)+Yl+a,_l(p)+we),Zl(p),at,Dl(It,`tables: ${a})`+qe,Kl),ct),Q(ge+p+Ce,ge+p+Ce,Ce,ol(1,12),t,t,t,$t,ct);const ee=V(w+Oe,jl("tableId?: TId","rowId: Id","cellId?: CId",M+Ae+j,Ql),$l(ie+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=V(h+Oe,jl("tableId?: TId","rowId: Id",M+Ae+j,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,rt,Ql),$l(ie+h),`<TId extends ${n}>`),te=V(b+Oe,jl("tableId?: TId",M+Ae+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+b),`<TId extends ${n}>`),ae=V("Sorted"+b+Oe,jl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Ae+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+"sorted "+b),`<TId extends ${n}>`),de=V(p+Oe,jl(M+Ae+j,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,rt,Ql),$l(dl(1,1)));c(1,D,de,te,ae,le,ee),q(p+it,"{"+M+", tableComponents, getTableComponentProps"+st+"}: "+de,[se+`(${Y}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",F,ql,"/>;","}), separator)"],ol(1,13)+pe),O(((e,l,a)=>{const[n,s,r,I,$]=oe(_,e);c(null,N,n,s,r,I,$),Q(u+l+b,u+b,d,Cl(e,0,1)+pe,t,a),Q(l+b,b,n,Cl(e)+pe,t,a),Q(l+b+f,b+f,i,rl(w,"the whole of "+bl(e))+pe,t,a),Q(l+h+he,h+he,o,"Gets the number of Rows in "+bl(e)+pe,t,a);const p=Q(l+g,g,i,rl(h,bl(e))+pe,t,a),C=Q(l+m,m,i,rl(h,bl(e),1)+pe,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");Q(u+l+h,u+h,d,hl(e,0,1)+pe,ut,Dl(a,dt)),Q(l+h,h,r,hl(e)+pe,ut,Dl(a,dt)),Q(l+f,f,$+Me,rl(w,pl(e))+pe,ut,Dl(a,dt)),Q(je+l+b+Ce,je+b+Ce,nt,Cl(e,9)+lt,Dl(_l(b)+Yl+s,_l(b)+we),Dl(a,Zl(b)),at,Dl(It,`table: ${s})`+qe,Kl),ct),Q(ge+l+b+Ce,ge+b+Ce,Ce,Cl(e,12),t,a,t,$t,ct),Q(je+l+h+Ce,je+h+Ce,nt,hl(e,9)+lt,Dl(ut,_l(h)+Yl+I,_l(h)+we),Dl(a,dt,Zl(h)),at,Dl(It,`row: ${I})`+qe,Kl),ct),Q("Add"+l+h+Ce,"Add"+h+Ce,nt,hl(e,10)+lt,Dl(_l(h)+Yl+I,_l(h)+we),Dl(a,Zl(h)),at,"then?: ("+Dl(ut+ke,"store: Store","row: "+I+")"+qe,"then"+we)+", reuseRowIds?: boolean",ct+", reuseRowIds"),Q(je+l+Pe+h+Ce,je+Pe+h+Ce,nt,hl(e,11)+lt,Dl(ut,_l(Pe+h)+Yl+I,_l(Pe+h)+we),Dl(a,dt,Zl(Pe+h)),at,Dl(It,`partialRow: ${I})`+qe,Kl),ct),Q(ge+l+h+Ce,ge+h+Ce,Ce,hl(e,12),ut,Dl(a,dt),t,$t,ct);const T=q(l+h+it,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+st+`}: ${le}<'${e}'>`,[se+`(${Ie}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,ot,"cellId={cellId}",F,ql,"/>;","})"+st+", rowId)"],hl(e,13)+pe);q(l+"Sorted"+b+it,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,Cl(e,13)+", sorted"+pe),q(l+b+it,`props: ${te}<'${e}'>`,Z+"(props, "+p+`(props.${M}), ${a}, ${T});`,Cl(e,13)+pe),E(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);c(0,N,$),c(1,N,$),Q(u+l+I+b+w,u+b+w,d,`Gets ${nl(1)}the '${n}' Cell anywhere in `+bl(e)+pe,t,Dl(a,r)),Q(u+l+I+w,u+w,d,gl(e,n,0,1)+pe,ut,Dl(a,dt,r));const i=Q(l+I+w,w,o+(R(s)?ke:t),gl(e,n)+pe,ut,Dl(a,dt,r));Q(je+l+I+w+Ce,je+w+Ce,nt,gl(e,n,9)+lt,Dl(ut,_l(w)+Yl+o+" | "+$,_l(w)+we),Dl(a,dt,r,Zl(w)),at,Dl(It,`cell: ${o} | ${$})`+qe,Kl),ct),Q(ge+l+I+w+Ce,ge+w+Ce,Ce,gl(e,n,12),Dl(ut,"forceDel?: boolean"),Dl(a,dt,r,"forceDel"),t,$t,ct),q(l+I+w+it,`{rowId, ${M}, debugIds}: `+ee+`<'${e}', '${n}'>`,[se+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],gl(e,n,13)+pe)}))}));const re=H(O((e=>oe(_,e)?.[4]??t))," | ");Q(u+p+I,u+p+I,Qe,ol(1,8,0,1)+" changes",bt($),pt()),Q(p+I,p+I,Qe,ol(1,8)+" changes",bt(T),pt()),Q(C+I,C+I,Qe,il(2,0,1),bt(y),pt()),Q(u+b+I,u+b+I,Qe,il(3,0,0,1),bt(v,`tableId: ${n} | null`),pt("tableId")),Q(b+I,b+I,Qe,il(3,0),bt(A,`tableId: ${n} | null`),pt("tableId")),Q(b+f+I,b+f+I,Qe,il(14,3,1),bt(k,`tableId: ${n} | null`),pt("tableId")),Q(u+b+w+I,u+b+w+I,Qe,il(16,3,0,1),bt(S,`tableId: ${n} | null`,`cellId: ${re} | null`),pt("tableId","cellId")),Q(h+he+I,h+he+I,Qe,il(15,3),bt(P,`tableId: ${n} | null`),pt("tableId")),Q(g+I,g+I,Qe,il(4,3,1),bt(L,`tableId: ${n} | null`),pt("tableId")),Q(m+I,m+I,Qe,il(13,3,1),bt(G,`tableId: ${n} | null`,"cellId: "+re+ke,"descending: boolean","offset: number","limit: number"+ke),pt("tableId","cellId","descending","offset","limit")),Q(u+h+I,u+h+I,Qe,il(5,3,0,1),bt(J,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(h+I,h+I,Qe,il(5,3),bt(z,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(f+I,f+I,Qe,il(6,5,1),bt(W,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(u+w+I,u+w+I,Qe,il(7,5,0,1),bt(B,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId")),Q(w+I,w+I,Qe,il(7,5),bt(U,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId"))}if(!ee(a)){const[e,l,a,n,o,s,$,i]=r;c(null,N,...r),c(1,N,j);const b=x("getDefaultValueComponent","valueId: Id",H(L(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(u+y,u+y,d,ol(2,0,0,1)+pe),Q(y,y,e,ol(2,0)+pe);const p=Q(v,v,a+Me,rl(T,Je)+pe);Q(je+y+Ce,je+y+Ce,nt,ol(2,9)+lt,Dl(_l(y)+Yl+l,_l(y)+we),Zl(y),at,Dl(It,`values: ${l})`+qe,Kl),ct),Q(je+Pe+y+Ce,je+Pe+y+Ce,nt,ol(2,11)+lt,Dl(_l(Pe+y)+Yl+l,_l(Pe+y)+we),Zl(Pe+y),at,Dl(It,`partialValues: ${l})`+qe,Kl),ct),Q(ge+y+Ce,ge+y+Ce,Ce,ol(2,12),t,t,t,$t,ct);const C=V(T+Oe,jl("valueId?: VId",M+Ae+j,Ql),$l("a Value"),`<VId extends ${a}>`),h=V(y+Oe,jl(M+Ae+j,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,rt,Ql),$l(dl(2,1)));c(1,D,h,C),q(y+it,"{"+M+", valueComponents, getValueComponentProps"+st+"}: "+h,[se+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",F,ql,"/>;","}), separator)"],ol(2,13)+pe),L(((e,l,a,n,o)=>{const s="Map"+El(l,1);c(0,N,s),c(1,N,s),Q(u+o+T,u+T,d,ml(e,0,1)+pe,t,n);const r=Q(o+T,T,l,ml(e)+pe,t,n);Q(je+o+T+Ce,je+T+Ce,nt,ml(e,9)+lt,Dl(_l(T)+Yl+l+" | "+s,_l(T)+we),Dl(n,Zl(T)),at,Dl(It,`value: ${l} | ${s})`+qe,Kl),ct),Q(ge+o+T+Ce,ge+T+Ce,Ce,ml(e,12),t,n,t,$t,ct),q(o+T+it,`{${M}, debugIds}: ${C}<'${e}'>`,[se+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],ml(e,13)+pe)})),Q(u+y+I,u+y+I,Qe,ol(2,8,0,1)+" changes",bt(n),pt()),Q(y+I,y+I,Qe,ol(2,8)+" changes",bt(o),pt()),Q(v+I,v+I,Qe,il(10,0,1),bt(s),pt()),Q(u+T+I,u+T+I,Qe,il(11,0,0,1),bt($,`valueId: ${a} | null`),pt("valueId")),Q(T+I,T+I,Qe,il(11,0),bt(i,`valueId: ${a} | null`),pt("valueId"))}return q(Ee,`{${M}, ${M}ById, children}: `+Y+" & {children: React.ReactNode}",["{",et,"return (","<Context."+Ee,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Ee}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...S(),...K(0)),$(...k(1),...P(),...K(1))]},ht=(e,l,a)=>{if(ee(e)&&ee(l))return[t,t,t,t];const[n,d,o,s]=Ul(e,l,a);return[n,d,...Ct(e,l,a,o,s)]},gt=JSON.parse,mt="prettier/",wt=mt+"plugins/",ft={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Tt=Ml((e=>{const l=()=>{const l=gt(e.getTablesSchemaJson());return!ee(l)||D(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=de();if(D(a,(l=>D(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=$e(n,a,(()=>[N(d),de(),[0],0])),[s,r,[I]]=o,$=$e(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),Ie(r,d,$),o[3]++,s==N(d)})))))return l[t]={},ae(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==E(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=gt(e.getValuesSchemaJson());return ee(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:N(t)}})),l},a=e=>ht(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(mt+"standalone")).format,z(t,await import(wt+"estree"),await import(wt+"typescript"))}catch(e){n=async e=>e}return await L(M(a(e),(async(e,a)=>Pl(await n(e,{...ft,plugins:t,filepath:"_."+l[a]})))))};return q({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{Tt as createTools};
|
package/lib/tools.js.gz
CHANGED
|
Binary file
|
package/lib/types/ui-react.d.ts
CHANGED
|
@@ -221,9 +221,9 @@ export type GetId<Parameter> = (parameter: Parameter, store: Store) => Id;
|
|
|
221
221
|
*
|
|
222
222
|
* It is possible to create a Store outside of the React app with the regular
|
|
223
223
|
* createStore function and pass it in, but you may prefer to create it within
|
|
224
|
-
* the app, perhaps inside the top-level component. To
|
|
225
|
-
*
|
|
226
|
-
*
|
|
224
|
+
* the app, perhaps inside the top-level component. To prevent a new Store being
|
|
225
|
+
* created every time the app renders or re-renders, the useCreateStore hook
|
|
226
|
+
* wraps the creation in a memoization.
|
|
227
227
|
*
|
|
228
228
|
* The useCreateStore hook is a very thin wrapper around the React `useMemo`
|
|
229
229
|
* hook, defaulting to an empty array for its dependencies, so that by default,
|
|
@@ -2476,8 +2476,8 @@ export function useSetRowCallback<Parameter>(
|
|
|
2476
2476
|
* specify `reuseRowIds` to be `false`, then the Id will be a monotonically
|
|
2477
2477
|
* increasing string representation of an increasing integer, regardless of any
|
|
2478
2478
|
* you may have previously deleted.
|
|
2479
|
-
* @param tableId The Id of the Table in the Store, or a GetId function
|
|
2480
|
-
*
|
|
2479
|
+
* @param tableId The Id of the Table in the Store, or a GetId function that
|
|
2480
|
+
* will return it.
|
|
2481
2481
|
* @param getRow A function which returns the Row object that will be used to
|
|
2482
2482
|
* update the Store, based on the parameter the callback will receive (and which
|
|
2483
2483
|
* is most likely a DOM event).
|
|
@@ -3626,8 +3626,8 @@ export function useTableIdsListener(
|
|
|
3626
3626
|
* dependencies) or the component unmounts, the listener on the underlying Store
|
|
3627
3627
|
* will be deleted.
|
|
3628
3628
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
3629
|
-
* @param listener The function that will be called whenever the matching
|
|
3630
|
-
*
|
|
3629
|
+
* @param listener The function that will be called whenever the matching Table
|
|
3630
|
+
* is added or removed.
|
|
3631
3631
|
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
3632
3632
|
* function, which, if any change, result in the re-registration of the
|
|
3633
3633
|
* listener. This parameter defaults to an empty array.
|
|
@@ -4112,8 +4112,8 @@ export function useSortedRowIdsListener(
|
|
|
4112
4112
|
* more easily done with the useHasRow hook).
|
|
4113
4113
|
*
|
|
4114
4114
|
* You can either listen to a single Row being added or removed (by specifying
|
|
4115
|
-
* the Table Id and Row Id, as the method's first two parameters) or changes
|
|
4116
|
-
*
|
|
4115
|
+
* the Table Id and Row Id, as the method's first two parameters) or changes to
|
|
4116
|
+
* any Row (by providing `null` wildcards).
|
|
4117
4117
|
*
|
|
4118
4118
|
* Both, either, or neither of the `tableId` and `rowId` parameters can be
|
|
4119
4119
|
* wildcarded with `null`. You can listen to a specific Row in a specific Table,
|
|
@@ -4126,8 +4126,8 @@ export function useSortedRowIdsListener(
|
|
|
4126
4126
|
* the component unmounts, the listener on the underlying Store will be deleted.
|
|
4127
4127
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4128
4128
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
4129
|
-
* @param listener The function that will be called whenever the matching Row
|
|
4130
|
-
*
|
|
4129
|
+
* @param listener The function that will be called whenever the matching Row is
|
|
4130
|
+
* added or removed.
|
|
4131
4131
|
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
4132
4132
|
* function, which, if any change, result in the re-registration of the
|
|
4133
4133
|
* listener. This parameter defaults to an empty array.
|
|
@@ -4339,14 +4339,14 @@ export function useCellIdsListener(
|
|
|
4339
4339
|
* own specific listener to do more than simply tracking the value (which is
|
|
4340
4340
|
* more easily done with the useHasCell hook).
|
|
4341
4341
|
*
|
|
4342
|
-
* You can either listen to a single Cell being added or removed (by
|
|
4343
|
-
*
|
|
4344
|
-
*
|
|
4342
|
+
* You can either listen to a single Cell being added or removed (by specifying
|
|
4343
|
+
* the Table Id, Row Id, and Cell Id as the method's first three parameters) or
|
|
4344
|
+
* changes to any Cell (by providing `null` wildcards).
|
|
4345
4345
|
*
|
|
4346
|
-
* All, some, or none of the `tableId`, `rowId`, and `cellId` parameters can
|
|
4347
|
-
*
|
|
4348
|
-
*
|
|
4349
|
-
*
|
|
4346
|
+
* All, some, or none of the `tableId`, `rowId`, and `cellId` parameters can be
|
|
4347
|
+
* wildcarded with `null`. You can listen to a specific Cell in a specific Row
|
|
4348
|
+
* in a specific Table, any Cell in any Row in any Table, for example - or every
|
|
4349
|
+
* other combination of wildcards.
|
|
4350
4350
|
*
|
|
4351
4351
|
* Unlike the addHasCellListener method, which returns a listener Id and
|
|
4352
4352
|
* requires you to remove it manually, the useHasCellListener hook manages this
|
|
@@ -4696,8 +4696,8 @@ export function useValueIdsListener(
|
|
|
4696
4696
|
* dependencies) or the component unmounts, the listener on the underlying Store
|
|
4697
4697
|
* will be deleted.
|
|
4698
4698
|
* @param valueId The Id of the Value to listen to, or `null` as a wildcard.
|
|
4699
|
-
* @param listener The function that will be called whenever the matching
|
|
4700
|
-
*
|
|
4699
|
+
* @param listener The function that will be called whenever the matching Value
|
|
4700
|
+
* is added or removed.
|
|
4701
4701
|
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
4702
4702
|
* function, which, if any change, result in the re-registration of the
|
|
4703
4703
|
* listener. This parameter defaults to an empty array.
|
|
@@ -4996,13 +4996,11 @@ export function useDidFinishTransactionListener(
|
|
|
4996
4996
|
*
|
|
4997
4997
|
* It is possible to create a Metrics object outside of the React app with the
|
|
4998
4998
|
* regular createMetrics function and pass it in, but you may prefer to create
|
|
4999
|
-
* it within the app, perhaps inside the top-level component. To
|
|
5000
|
-
*
|
|
5001
|
-
* the useCreateMetrics hook
|
|
5002
|
-
*
|
|
5003
|
-
*
|
|
5004
|
-
* hook, defaulting to the provided Store as its dependency, so that by default,
|
|
5005
|
-
* the creation only occurs once per Store.
|
|
4999
|
+
* it within the app, perhaps inside the top-level component. To prevent a new
|
|
5000
|
+
* Metrics object being created every time the app renders or re-renders, since
|
|
5001
|
+
* v5.0 the useCreateMetrics hook performs the creation in an effect. As a
|
|
5002
|
+
* result this hook will return `undefined` on the brief first render, which you
|
|
5003
|
+
* should defend against.
|
|
5006
5004
|
*
|
|
5007
5005
|
* If your `create` function contains other dependencies, the changing of which
|
|
5008
5006
|
* should also cause the Metrics object to be recreated, you can provide them in
|
|
@@ -5037,7 +5035,7 @@ export function useDidFinishTransactionListener(
|
|
|
5037
5035
|
* 'species',
|
|
5038
5036
|
* );
|
|
5039
5037
|
* });
|
|
5040
|
-
* return <span>{metrics
|
|
5038
|
+
* return <span>{metrics?.getMetric('speciesCount')}</span>;
|
|
5041
5039
|
* };
|
|
5042
5040
|
*
|
|
5043
5041
|
* const app = document.createElement('div');
|
|
@@ -5075,7 +5073,7 @@ export function useDidFinishTransactionListener(
|
|
|
5075
5073
|
* },
|
|
5076
5074
|
* [tableToCount],
|
|
5077
5075
|
* );
|
|
5078
|
-
* return <span>{metrics
|
|
5076
|
+
* return <span>{metrics?.getMetric('tableCount')}</span>;
|
|
5079
5077
|
* };
|
|
5080
5078
|
*
|
|
5081
5079
|
* const app = document.createElement('div');
|
|
@@ -5098,7 +5096,7 @@ export function useCreateMetrics(
|
|
|
5098
5096
|
store: Store,
|
|
5099
5097
|
create: (store: Store) => Metrics,
|
|
5100
5098
|
createDeps?: React.DependencyList,
|
|
5101
|
-
): Metrics;
|
|
5099
|
+
): Metrics | undefined;
|
|
5102
5100
|
|
|
5103
5101
|
/**
|
|
5104
5102
|
* The useMetricsIds hook is used to retrieve the Ids of all the named Metrics
|
|
@@ -5478,13 +5476,11 @@ export function useMetricListener(
|
|
|
5478
5476
|
*
|
|
5479
5477
|
* It is possible to create an Indexes object outside of the React app with the
|
|
5480
5478
|
* regular createIndexes function and pass it in, but you may prefer to create
|
|
5481
|
-
* it within the app, perhaps inside the top-level component. To
|
|
5482
|
-
*
|
|
5483
|
-
* the useCreateIndexes hook
|
|
5484
|
-
*
|
|
5485
|
-
*
|
|
5486
|
-
* hook, defaulting to the provided Store as its dependency, so that by default,
|
|
5487
|
-
* the creation only occurs once per Store.
|
|
5479
|
+
* it within the app, perhaps inside the top-level component. To prevent a new
|
|
5480
|
+
* Indexes object being created every time the app renders or re-renders, since
|
|
5481
|
+
* v5.0 the useCreateIndexes hook performs the creation in an effect. As a
|
|
5482
|
+
* result this hook will return `undefined` on the brief first render, which you
|
|
5483
|
+
* should defend against.
|
|
5488
5484
|
*
|
|
5489
5485
|
* If your `create` function contains other dependencies, the changing of which
|
|
5490
5486
|
* should also cause the Indexes object to be recreated, you can provide them in
|
|
@@ -5524,7 +5520,7 @@ export function useMetricListener(
|
|
|
5524
5520
|
* 'species',
|
|
5525
5521
|
* );
|
|
5526
5522
|
* });
|
|
5527
|
-
* return <span>{JSON.stringify(indexes
|
|
5523
|
+
* return <span>{JSON.stringify(indexes?.getSliceIds('bySpecies'))}</span>;
|
|
5528
5524
|
* };
|
|
5529
5525
|
*
|
|
5530
5526
|
* const app = document.createElement('div');
|
|
@@ -5565,7 +5561,7 @@ export function useMetricListener(
|
|
|
5565
5561
|
* },
|
|
5566
5562
|
* [cellToIndex],
|
|
5567
5563
|
* );
|
|
5568
|
-
* return <span>{JSON.stringify(indexes
|
|
5564
|
+
* return <span>{JSON.stringify(indexes?.getSliceIds('byCell'))}</span>;
|
|
5569
5565
|
* };
|
|
5570
5566
|
*
|
|
5571
5567
|
* const app = document.createElement('div');
|
|
@@ -5588,7 +5584,7 @@ export function useCreateIndexes(
|
|
|
5588
5584
|
store: Store,
|
|
5589
5585
|
create: (store: Store) => Indexes,
|
|
5590
5586
|
createDeps?: React.DependencyList,
|
|
5591
|
-
): Indexes;
|
|
5587
|
+
): Indexes | undefined;
|
|
5592
5588
|
|
|
5593
5589
|
/**
|
|
5594
5590
|
* The useIndexesIds hook is used to retrieve the Ids of all the named Indexes
|
|
@@ -6166,13 +6162,10 @@ export function useSliceRowIdsListener(
|
|
|
6166
6162
|
* It is possible to create a Relationships object outside of the React app with
|
|
6167
6163
|
* the regular createRelationships function and pass it in, but you may prefer
|
|
6168
6164
|
* to create it within the app, perhaps inside the top-level component. To
|
|
6169
|
-
*
|
|
6170
|
-
*
|
|
6171
|
-
* a
|
|
6172
|
-
*
|
|
6173
|
-
* The useCreateRelationships hook is a very thin wrapper around the React
|
|
6174
|
-
* `useMemo` hook, defaulting to the provided Store as its dependency, so that
|
|
6175
|
-
* by default, the creation only occurs once per Store.
|
|
6165
|
+
* prevent a new Relationships object being created every time the app renders
|
|
6166
|
+
* or re-renders, since v5.0 the useCreateRelationships hook performs the
|
|
6167
|
+
* creation in an effect. As a result this hook will return `undefined` on the
|
|
6168
|
+
* brief first render, which you should defend against.
|
|
6176
6169
|
*
|
|
6177
6170
|
* If your `create` function contains other dependencies, the changing of which
|
|
6178
6171
|
* should also cause the Relationships object to be recreated, you can provide
|
|
@@ -6214,7 +6207,9 @@ export function useSliceRowIdsListener(
|
|
|
6214
6207
|
* 'species',
|
|
6215
6208
|
* );
|
|
6216
6209
|
* });
|
|
6217
|
-
* return
|
|
6210
|
+
* return (
|
|
6211
|
+
* <span>{relationships?.getRemoteRowId('petSpecies', 'fido')}</span>
|
|
6212
|
+
* );
|
|
6218
6213
|
* };
|
|
6219
6214
|
*
|
|
6220
6215
|
* const app = document.createElement('div');
|
|
@@ -6260,7 +6255,9 @@ export function useSliceRowIdsListener(
|
|
|
6260
6255
|
* },
|
|
6261
6256
|
* [remoteTableAndCellToLink],
|
|
6262
6257
|
* );
|
|
6263
|
-
* return
|
|
6258
|
+
* return (
|
|
6259
|
+
* <span>{relationships?.getRemoteRowId('cellLinked', 'fido')}</span>
|
|
6260
|
+
* );
|
|
6264
6261
|
* };
|
|
6265
6262
|
*
|
|
6266
6263
|
* const app = document.createElement('div');
|
|
@@ -6283,7 +6280,7 @@ export function useCreateRelationships(
|
|
|
6283
6280
|
store: Store,
|
|
6284
6281
|
create: (store: Store) => Relationships,
|
|
6285
6282
|
createDeps?: React.DependencyList,
|
|
6286
|
-
): Relationships;
|
|
6283
|
+
): Relationships | undefined;
|
|
6287
6284
|
|
|
6288
6285
|
/**
|
|
6289
6286
|
* The useRelationshipsIds hook is used to retrieve the Ids of all the named
|
|
@@ -7129,13 +7126,11 @@ export function useLinkedRowIdsListener(
|
|
|
7129
7126
|
*
|
|
7130
7127
|
* It is possible to create a Queries object outside of the React app with the
|
|
7131
7128
|
* regular createQueries function and pass it in, but you may prefer to create
|
|
7132
|
-
* it within the app, perhaps inside the top-level component. To
|
|
7133
|
-
*
|
|
7134
|
-
* the useCreateQueries hook
|
|
7135
|
-
*
|
|
7136
|
-
*
|
|
7137
|
-
* hook, defaulting to the provided Store as its dependency, so that by default,
|
|
7138
|
-
* the creation only occurs once per Store.
|
|
7129
|
+
* it within the app, perhaps inside the top-level component. To prevent a new
|
|
7130
|
+
* Queries object being created every time the app renders or re-renders, since
|
|
7131
|
+
* v5.0 the useCreateQueries hook performs the creation in an effect. As a
|
|
7132
|
+
* result this hook will return `undefined` on the brief first render, which you
|
|
7133
|
+
* should defend against.
|
|
7139
7134
|
*
|
|
7140
7135
|
* If your `create` function contains other dependencies, the changing of which
|
|
7141
7136
|
* should also cause the Queries object to be recreated, you can provide them in
|
|
@@ -7178,7 +7173,7 @@ export function useLinkedRowIdsListener(
|
|
|
7178
7173
|
* );
|
|
7179
7174
|
* });
|
|
7180
7175
|
* return (
|
|
7181
|
-
* <span>{queries
|
|
7176
|
+
* <span>{queries?.getResultCell('dogColors', 'fido', 'color')}</span>
|
|
7182
7177
|
* );
|
|
7183
7178
|
* };
|
|
7184
7179
|
*
|
|
@@ -7220,7 +7215,7 @@ export function useLinkedRowIdsListener(
|
|
|
7220
7215
|
* );
|
|
7221
7216
|
* });
|
|
7222
7217
|
* return (
|
|
7223
|
-
* <span>{queries
|
|
7218
|
+
* <span>{queries?.getResultCell('dogColors', 'fido', 'color')}</span>
|
|
7224
7219
|
* );
|
|
7225
7220
|
* };
|
|
7226
7221
|
*
|
|
@@ -7242,7 +7237,7 @@ export function useCreateQueries(
|
|
|
7242
7237
|
store: Store,
|
|
7243
7238
|
create: (store: Store) => Queries,
|
|
7244
7239
|
createDeps?: React.DependencyList,
|
|
7245
|
-
): Queries;
|
|
7240
|
+
): Queries | undefined;
|
|
7246
7241
|
|
|
7247
7242
|
/**
|
|
7248
7243
|
* The useQueriesIds hook is used to retrieve the Ids of all the named Queries
|
|
@@ -9133,14 +9128,11 @@ export function useResultCellListener(
|
|
|
9133
9128
|
*
|
|
9134
9129
|
* It is possible to create a Checkpoints object outside of the React app with
|
|
9135
9130
|
* the regular createCheckpoints function and pass it in, but you may prefer to
|
|
9136
|
-
* create it within the app, perhaps inside the top-level component. To
|
|
9137
|
-
*
|
|
9138
|
-
* re-renders, the
|
|
9139
|
-
*
|
|
9140
|
-
*
|
|
9141
|
-
* The useCreateCheckpoints hook is a very thin wrapper around the React
|
|
9142
|
-
* `useMemo` hook, defaulting to the provided Store as its dependency, so that
|
|
9143
|
-
* by default, the creation only occurs once per Store.
|
|
9131
|
+
* create it within the app, perhaps inside the top-level component. To prevent
|
|
9132
|
+
* a new Checkpoints object being created every time the app renders or
|
|
9133
|
+
* re-renders, since v5.0 the useCreateMetrics hook performs the creation in an
|
|
9134
|
+
* effect. As a result this hook will return `undefined` on the brief first
|
|
9135
|
+
* render, which you should defend against.
|
|
9144
9136
|
*
|
|
9145
9137
|
* If your `create` function contains other dependencies, the changing of which
|
|
9146
9138
|
* should also cause the Checkpoints object to be recreated, you can provide
|
|
@@ -9170,7 +9162,7 @@ export function useResultCellListener(
|
|
|
9170
9162
|
* console.log('Checkpoints created');
|
|
9171
9163
|
* return createCheckpoints(store).setSize(10);
|
|
9172
9164
|
* });
|
|
9173
|
-
* return <span>{JSON.stringify(checkpoints
|
|
9165
|
+
* return <span>{JSON.stringify(checkpoints?.getCheckpointIds())}</span>;
|
|
9174
9166
|
* };
|
|
9175
9167
|
*
|
|
9176
9168
|
* const app = document.createElement('div');
|
|
@@ -9202,7 +9194,7 @@ export function useResultCellListener(
|
|
|
9202
9194
|
* },
|
|
9203
9195
|
* [size],
|
|
9204
9196
|
* );
|
|
9205
|
-
* return <span>{JSON.stringify(checkpoints
|
|
9197
|
+
* return <span>{JSON.stringify(checkpoints?.getCheckpointIds())}</span>;
|
|
9206
9198
|
* };
|
|
9207
9199
|
*
|
|
9208
9200
|
* const app = document.createElement('div');
|
|
@@ -9225,7 +9217,7 @@ export function useCreateCheckpoints(
|
|
|
9225
9217
|
store: Store,
|
|
9226
9218
|
create: (store: Store) => Checkpoints,
|
|
9227
9219
|
createDeps?: React.DependencyList,
|
|
9228
|
-
): Checkpoints;
|
|
9220
|
+
): Checkpoints | undefined;
|
|
9229
9221
|
|
|
9230
9222
|
/**
|
|
9231
9223
|
* The useCheckpointsIds hook is used to retrieve the Ids of all the named
|
|
@@ -10064,11 +10056,9 @@ export function useCheckpointListener(
|
|
|
10064
10056
|
*
|
|
10065
10057
|
* It is possible to create a Persister outside of the React app with the
|
|
10066
10058
|
* regular createPersister function and pass it in, but you may prefer to create
|
|
10067
|
-
* it within the app, perhaps inside the top-level component. To
|
|
10068
|
-
*
|
|
10069
|
-
*
|
|
10070
|
-
* second callback so that you can configure the Persister, once, and
|
|
10071
|
-
* asynchronously, when it is created.
|
|
10059
|
+
* it within the app, perhaps inside the top-level component. To prevent a new
|
|
10060
|
+
* Persister being created every time the app renders or re-renders, since v5.0
|
|
10061
|
+
* the useCreateMetrics hook performs the creation in an effect.
|
|
10072
10062
|
*
|
|
10073
10063
|
* If your `create` function (the second parameter to the hook) contains
|
|
10074
10064
|
* dependencies, the changing of which should cause the Persister to be
|
|
@@ -10076,19 +10066,18 @@ export function useCheckpointListener(
|
|
|
10076
10066
|
* you would for any React hook with dependencies. The Store passed in as the
|
|
10077
10067
|
* first parameter of this hook is used as a dependency by default.
|
|
10078
10068
|
*
|
|
10079
|
-
* A second `then
|
|
10080
|
-
* called after the creation, and, importantly, can be asynchronous, so
|
|
10081
|
-
* can configure the Persister with the startAutoLoad method and
|
|
10082
|
-
* method, for example. If this callback contains dependencies,
|
|
10083
|
-
* which should cause the Persister to be reconfigured, you can
|
|
10084
|
-
* an array in the fifth parameter. The Persister itself is used
|
|
10085
|
-
* by default.
|
|
10069
|
+
* A second callback, called `then`, can be provided as the fourth parameter.
|
|
10070
|
+
* This is called after the creation, and, importantly, can be asynchronous, so
|
|
10071
|
+
* that you can configure the Persister with the startAutoLoad method and
|
|
10072
|
+
* startAutoSave method, for example. If this callback contains dependencies,
|
|
10073
|
+
* the changing of which should cause the Persister to be reconfigured, you can
|
|
10074
|
+
* provide them in an array in the fifth parameter. The Persister itself is used
|
|
10075
|
+
* as a dependency by default.
|
|
10086
10076
|
*
|
|
10087
10077
|
* Since v4.3.0, the `create` function can return undefined, meaning that you
|
|
10088
10078
|
* can enable or disable persistence conditionally within this hook. This is
|
|
10089
10079
|
* useful for applications which might turn on or off their cloud persistence or
|
|
10090
|
-
* collaboration features.
|
|
10091
|
-
* undefined, which you should handle accordingly.
|
|
10080
|
+
* collaboration features.
|
|
10092
10081
|
*
|
|
10093
10082
|
* Since v4.3.19, a `destroy` function can be provided which will be called
|
|
10094
10083
|
* after an old Persister is destroyed due to a change in the `createDeps`
|
|
@@ -10207,8 +10196,8 @@ export function useCheckpointListener(
|
|
|
10207
10196
|
* // -> '<span>{\"pets\":{\"fido\":{\"species\":\"dog\"}}}</span>'
|
|
10208
10197
|
*
|
|
10209
10198
|
* root.render(<App sessionKey="cujoStore" />); // !act
|
|
10210
|
-
* // -> 'Persister created for session key cujoStore'
|
|
10211
10199
|
* // -> 'Persister destroyed for session key fidoStore'
|
|
10200
|
+
* // -> 'Persister created for session key cujoStore'
|
|
10212
10201
|
*
|
|
10213
10202
|
* // ... // !act
|
|
10214
10203
|
* console.log(app.innerHTML);
|
|
@@ -10225,9 +10214,9 @@ export function useCreatePersister<
|
|
|
10225
10214
|
store: Store,
|
|
10226
10215
|
create: (store: Store) => PersisterOrUndefined,
|
|
10227
10216
|
createDeps?: React.DependencyList,
|
|
10228
|
-
then?: (persister:
|
|
10217
|
+
then?: (persister: Persister) => Promise<void>,
|
|
10229
10218
|
thenDeps?: React.DependencyList,
|
|
10230
|
-
destroy?: (persister:
|
|
10219
|
+
destroy?: (persister: Persister) => void,
|
|
10231
10220
|
destroyDeps?: React.DependencyList,
|
|
10232
10221
|
): PersisterOrUndefined;
|
|
10233
10222
|
|