tinybase 0.0.0 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/lib/checkpoints.d.ts +876 -0
- package/lib/checkpoints.js +1 -0
- package/lib/checkpoints.js.gz +0 -0
- package/lib/common.d.ts +59 -0
- package/lib/debug/checkpoints.d.ts +876 -0
- package/lib/debug/checkpoints.js +326 -0
- package/lib/debug/common.d.ts +59 -0
- package/lib/debug/indexes.d.ts +829 -0
- package/lib/debug/indexes.js +390 -0
- package/lib/debug/metrics.d.ts +753 -0
- package/lib/debug/metrics.js +391 -0
- package/lib/debug/persisters.d.ts +704 -0
- package/lib/debug/persisters.js +191 -0
- package/lib/debug/relationships.d.ts +1114 -0
- package/lib/debug/relationships.js +418 -0
- package/lib/debug/store.d.ts +2503 -0
- package/lib/debug/store.js +725 -0
- package/lib/debug/tinybase.d.ts +13 -0
- package/lib/debug/tinybase.js +1708 -0
- package/lib/debug/ui-react.d.ts +7158 -0
- package/lib/debug/ui-react.js +1040 -0
- package/lib/indexes.d.ts +829 -0
- package/lib/indexes.js +1 -0
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.d.ts +753 -0
- package/lib/metrics.js +1 -0
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters.d.ts +704 -0
- package/lib/persisters.js +1 -0
- package/lib/persisters.js.gz +0 -0
- package/lib/relationships.d.ts +1114 -0
- package/lib/relationships.js +1 -0
- package/lib/relationships.js.gz +0 -0
- package/lib/store.d.ts +2503 -0
- package/lib/store.js +1 -0
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.d.ts +13 -0
- package/lib/tinybase.js +1 -0
- package/lib/tinybase.js.gz +0 -0
- package/lib/ui-react.d.ts +7158 -0
- package/lib/ui-react.js +1 -0
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -0
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/indexes.js +1 -0
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.js +1 -0
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters.js +1 -0
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/relationships.js +1 -0
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -0
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -0
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -0
- package/lib/umd/ui-react.js.gz +0 -0
- package/package.json +98 -2
- package/readme.md +195 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,t)=>e.includes(t),t=(e,t)=>e.forEach(t),n=e=>e.length,s=e=>0==n(e),o=e=>e.slice(1),r=e=>null==e,l=(e,t,n)=>r(e)?n?.():t(e),c=(e,t)=>e?.has(t)??!1,i=e=>r(e)||0==(e=>e.size)(e),d=(e,t)=>e?.forEach(t),a=(e,t)=>e?.delete(t),p=e=>new Map(e),u=(e,t)=>e?.get(t),h=(e,t,n)=>r(n)?(a(e,t),e):e?.set(t,n),g=(e,t,n,s)=>(c(e,t)||(s?.(n),e.set(t,n)),u(e,t)),C=e=>new Set(e),k=(e,t,r)=>n(r)<2?((e,t)=>e?.add(t))(s(r)?e:g(e,r[0],C()),t):k(g(e,r[0],p()),t,o(r)),f=e=>{const n=(r,c,...i)=>l(r,(r=>s(i)?e(r,c):t([i[0],null],(e=>n(u(r,e),c,...o(i))))));return n},L=Object.freeze,w=(e=>{const t=new WeakMap;return n=>(t.has(n)||t.set(n,e(n)),t.get(n))})((o=>{let w,v,S,z=100,E=p(),I=1;const M=C(),b=p(),[j,x,y]=(e=>{let s,o=0;const c=[],i=p();return[(t,n,r=[])=>{s??=e();const l=c.pop()??""+o++;return h(i,l,[t,n,r]),k(n,l,r),l},(e,t=[],...n)=>f(d)(e,(e=>l(u(i,e),(([e])=>e(s,...t,...n)))),...t),e=>l(u(i,e),(([,t,s])=>(f(a)(t,e,...s),h(i,e),n(c)<1e3&&c.push(e),s)),(()=>[])),(e,o,c)=>l(u(i,e),(([e,,l])=>{const i=(...d)=>{const a=n(d);a==n(l)?e(s,...d,...c(d)):r(l[a])?t(o[a](...d),(e=>i(...d,e))):i(...d,l[a])};i()}))]})((()=>Q)),B=p(),F=p(),O=[],T=[],W=(e,t)=>{I=0,o.transaction((()=>d(u(B,t),((t,n)=>d(t,((t,s)=>d(t,((t,l)=>r(t[e])?o.delCell(n,s,l,!0):o.setCell(n,s,l,t[e]))))))))),I=1},m=e=>{h(B,e),h(F,e),x(b,[e])},q=(e,s)=>t(((e,t)=>e.splice(0,t))(e,s??n(e)),m),A=()=>q(O,n(O)-z),D=o.addCellListener(null,null,null,((e,t,n,s,o,r)=>{if(I){l(w,(()=>{O.push(w),A(),q(T),w=void 0,S=1}));const e=g(E,t,p()),c=g(e,n,p()),d=g(c,s,[void 0,void 0],(e=>e[0]=r));d[1]=o,d[0]===d[1]&&i(h(c,s))&&i(h(e,n))&&i(h(E,t))&&(w=O.pop(),S=1),K()}})),G=(e="")=>(r(w)&&(w=""+v++,h(B,w,E),P(w,e),E=p(),S=1),w),H=()=>{s(O)||(T.unshift(G()),W(0,w),w=O.pop(),S=1)},J=()=>{s(T)||(O.push(w),w=T.shift(),W(1,w),S=1)},K=()=>{S&&(x(M),S=0)},N=e=>{const t=G(e);return K(),t},P=(e,t)=>(c(B,e)&&u(F,e)!==t&&(h(F,e,t),x(b,[e])),Q),Q={setSize:e=>(z=e,A(),Q),addCheckpoint:N,setCheckpoint:P,getStore:()=>o,getCheckpointIds:()=>[[...O],w,[...T]],getCheckpoint:e=>u(F,e),goBackward:()=>(H(),K(),Q),goForward:()=>(J(),K(),Q),goTo:t=>{const n=e(O,t)?H:e(T,t)?J:null;for(;!r(n)&&t!=w;)n();return K(),Q},addCheckpointIdsListener:e=>j(e,M),addCheckpointListener:(e,t)=>j(t,b,[e]),delListener:e=>(y(e),Q),clear:()=>(q(O),q(T),r(w)||m(w),w=void 0,v=0,N(),Q),destroy:()=>{o.delListener(D)},getListenerStats:()=>({})};return L(Q.clear())}));export{w as createCheckpoints};
|
|
Binary file
|
package/lib/common.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The common module of the TinyBase project provides a small collection of
|
|
3
|
+
* common types used across other modules.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module common
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The Json type is a simple alias for a string, but is used to indicate that
|
|
11
|
+
* the string should be considered to be a JSON serialization of an object.
|
|
12
|
+
*
|
|
13
|
+
* @category General
|
|
14
|
+
*/
|
|
15
|
+
export type Json = string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The Ids type is a simple alias for an array of strings, but is used to
|
|
19
|
+
* indicate that the strings should be considered to be the keys of objects
|
|
20
|
+
* (such as the Row Id strings used in a Table).
|
|
21
|
+
*
|
|
22
|
+
* @category Identity
|
|
23
|
+
*/
|
|
24
|
+
export type Ids = Id[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The Id type is a simple alias for a string, but is used to indicate that the
|
|
28
|
+
* string should be considered to be the key of an object (such as a Row Id
|
|
29
|
+
* string used in a Table).
|
|
30
|
+
*
|
|
31
|
+
* @category Identity
|
|
32
|
+
*/
|
|
33
|
+
export type Id = string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The Id type is a simple alias for the union of a string or `null` value,
|
|
37
|
+
* where the string should be considered to be the key of an objects (such as a
|
|
38
|
+
* Row Id string used in a Table), and typically `null` indicates a wildcard -
|
|
39
|
+
* such as when used in the Store addRowListener method.
|
|
40
|
+
*
|
|
41
|
+
* @category Identity
|
|
42
|
+
*/
|
|
43
|
+
export type IdOrNull = Id | null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The ParameterizedCallback type represents a generic function that will take
|
|
47
|
+
* an optional parameter - such as the handler of a DOM event.
|
|
48
|
+
*
|
|
49
|
+
* @category Callback
|
|
50
|
+
*/
|
|
51
|
+
export type ParameterizedCallback<Parameter> = (parameter?: Parameter) => void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The Callback type represents a function that is used as a callback and which
|
|
55
|
+
* does not take a parameter.
|
|
56
|
+
*
|
|
57
|
+
* @category Callback
|
|
58
|
+
*/
|
|
59
|
+
export type Callback = () => void;
|