tinybase 0.9.4 → 1.0.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 +1 -1
- package/lib/checkpoints.d.ts +3 -0
- package/lib/debug/checkpoints.d.ts +3 -0
- package/lib/debug/indexes.d.ts +4 -0
- package/lib/debug/metrics.d.ts +4 -0
- package/lib/debug/persisters.d.ts +4 -0
- package/lib/debug/relationships.d.ts +2 -0
- package/lib/debug/store.d.ts +5 -0
- package/lib/debug/ui-react.d.ts +8 -0
- package/lib/indexes.d.ts +4 -0
- package/lib/metrics.d.ts +4 -0
- package/lib/persisters.d.ts +4 -0
- package/lib/relationships.d.ts +2 -0
- package/lib/store.d.ts +5 -0
- package/lib/ui-react.d.ts +8 -0
- package/package.json +20 -4
- package/readme.md +2 -2
package/LICENSE
CHANGED
package/lib/checkpoints.d.ts
CHANGED
|
@@ -142,6 +142,9 @@ export type CheckpointsListenerStats = {
|
|
|
142
142
|
* checkpoints.delListener(listenerId);
|
|
143
143
|
* checkpoints.destroy();
|
|
144
144
|
* ```
|
|
145
|
+
* @see Relationships And Checkpoints guides
|
|
146
|
+
* @see Todo App demos
|
|
147
|
+
* @see TinyDraw demo
|
|
145
148
|
* @category Checkpoints
|
|
146
149
|
*/
|
|
147
150
|
export interface Checkpoints {
|
|
@@ -142,6 +142,9 @@ export type CheckpointsListenerStats = {
|
|
|
142
142
|
* checkpoints.delListener(listenerId);
|
|
143
143
|
* checkpoints.destroy();
|
|
144
144
|
* ```
|
|
145
|
+
* @see Relationships And Checkpoints guides
|
|
146
|
+
* @see Todo App demos
|
|
147
|
+
* @see TinyDraw demo
|
|
145
148
|
* @category Checkpoints
|
|
146
149
|
*/
|
|
147
150
|
export interface Checkpoints {
|
package/lib/debug/indexes.d.ts
CHANGED
|
@@ -150,6 +150,10 @@ export type IndexesListenerStats = {
|
|
|
150
150
|
* indexes.delListener(listenerId);
|
|
151
151
|
* indexes.destroy();
|
|
152
152
|
* ```
|
|
153
|
+
* @see Metrics And Indexes guides
|
|
154
|
+
* @see Rolling Dice demos
|
|
155
|
+
* @see Country demo
|
|
156
|
+
* @see Todo App demos
|
|
153
157
|
* @category Indexes
|
|
154
158
|
*/
|
|
155
159
|
export interface Indexes {
|
package/lib/debug/metrics.d.ts
CHANGED
|
@@ -226,6 +226,10 @@ export type MetricsListenerStats = {
|
|
|
226
226
|
* metrics.delListener(listenerId);
|
|
227
227
|
* metrics.destroy();
|
|
228
228
|
* ```
|
|
229
|
+
* @see Metrics And Indexes guides
|
|
230
|
+
* @see Rolling Dice demos
|
|
231
|
+
* @see Country demo
|
|
232
|
+
* @see Todo App demos
|
|
229
233
|
* @category Metrics
|
|
230
234
|
*/
|
|
231
235
|
export interface Metrics {
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
* createCustomPersister function can also be used to easily create a fully
|
|
20
20
|
* customized way to save and load Store data.
|
|
21
21
|
*
|
|
22
|
+
* @see Persisting Data guide
|
|
23
|
+
* @see Countries demo
|
|
24
|
+
* @see Todo App demos
|
|
25
|
+
* @see TinyDraw demo
|
|
22
26
|
* @packageDocumentation
|
|
23
27
|
* @module persisters
|
|
24
28
|
*/
|
|
@@ -222,6 +222,8 @@ export type RelationshipsListenerStats = {
|
|
|
222
222
|
* relationships.delListener(listenerId2);
|
|
223
223
|
* relationships.destroy();
|
|
224
224
|
* ```
|
|
225
|
+
* @see Relationships And Checkpoints guides
|
|
226
|
+
* @see TinyDraw demo
|
|
225
227
|
* @category Relationships
|
|
226
228
|
*/
|
|
227
229
|
export interface Relationships {
|
package/lib/debug/store.d.ts
CHANGED
|
@@ -612,6 +612,10 @@ export type StoreListenerStats = {
|
|
|
612
612
|
*
|
|
613
613
|
* store.delListener(listenerId);
|
|
614
614
|
* ```
|
|
615
|
+
* @see The Basics guides
|
|
616
|
+
* @see Using Schemas guides
|
|
617
|
+
* @see Hello World demos
|
|
618
|
+
* @see Todo App demos
|
|
615
619
|
* @category Store
|
|
616
620
|
*/
|
|
617
621
|
export interface Store {
|
|
@@ -2496,6 +2500,7 @@ export interface Store {
|
|
|
2496
2500
|
* console.log(store.getTables());
|
|
2497
2501
|
* // -> {pets: {fido: {species: 'dog', sold: false}}}
|
|
2498
2502
|
* ```
|
|
2503
|
+
* @see The Basics guides
|
|
2499
2504
|
* @category Creation
|
|
2500
2505
|
*/
|
|
2501
2506
|
export function createStore(): Store;
|
package/lib/debug/ui-react.d.ts
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
* The components in this module provide a further abstraction over those hooks
|
|
11
11
|
* to ease the composition of user interfaces that use TinyBase.
|
|
12
12
|
*
|
|
13
|
+
* @see Building UIs guides
|
|
14
|
+
* @see Building UIs With Metrics guide
|
|
15
|
+
* @see Building UIs With Indexes guide
|
|
16
|
+
* @see Building UIs With Relationships guide
|
|
17
|
+
* @see Building UIs With Checkpoints guide
|
|
18
|
+
* @see Countries demo
|
|
19
|
+
* @see Todo App demos
|
|
20
|
+
* @see TinyDraw demo
|
|
13
21
|
* @packageDocumentation
|
|
14
22
|
* @module ui-react
|
|
15
23
|
*/
|
package/lib/indexes.d.ts
CHANGED
|
@@ -150,6 +150,10 @@ export type IndexesListenerStats = {
|
|
|
150
150
|
* indexes.delListener(listenerId);
|
|
151
151
|
* indexes.destroy();
|
|
152
152
|
* ```
|
|
153
|
+
* @see Metrics And Indexes guides
|
|
154
|
+
* @see Rolling Dice demos
|
|
155
|
+
* @see Country demo
|
|
156
|
+
* @see Todo App demos
|
|
153
157
|
* @category Indexes
|
|
154
158
|
*/
|
|
155
159
|
export interface Indexes {
|
package/lib/metrics.d.ts
CHANGED
|
@@ -226,6 +226,10 @@ export type MetricsListenerStats = {
|
|
|
226
226
|
* metrics.delListener(listenerId);
|
|
227
227
|
* metrics.destroy();
|
|
228
228
|
* ```
|
|
229
|
+
* @see Metrics And Indexes guides
|
|
230
|
+
* @see Rolling Dice demos
|
|
231
|
+
* @see Country demo
|
|
232
|
+
* @see Todo App demos
|
|
229
233
|
* @category Metrics
|
|
230
234
|
*/
|
|
231
235
|
export interface Metrics {
|
package/lib/persisters.d.ts
CHANGED
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
* createCustomPersister function can also be used to easily create a fully
|
|
20
20
|
* customized way to save and load Store data.
|
|
21
21
|
*
|
|
22
|
+
* @see Persisting Data guide
|
|
23
|
+
* @see Countries demo
|
|
24
|
+
* @see Todo App demos
|
|
25
|
+
* @see TinyDraw demo
|
|
22
26
|
* @packageDocumentation
|
|
23
27
|
* @module persisters
|
|
24
28
|
*/
|
package/lib/relationships.d.ts
CHANGED
|
@@ -222,6 +222,8 @@ export type RelationshipsListenerStats = {
|
|
|
222
222
|
* relationships.delListener(listenerId2);
|
|
223
223
|
* relationships.destroy();
|
|
224
224
|
* ```
|
|
225
|
+
* @see Relationships And Checkpoints guides
|
|
226
|
+
* @see TinyDraw demo
|
|
225
227
|
* @category Relationships
|
|
226
228
|
*/
|
|
227
229
|
export interface Relationships {
|
package/lib/store.d.ts
CHANGED
|
@@ -612,6 +612,10 @@ export type StoreListenerStats = {
|
|
|
612
612
|
*
|
|
613
613
|
* store.delListener(listenerId);
|
|
614
614
|
* ```
|
|
615
|
+
* @see The Basics guides
|
|
616
|
+
* @see Using Schemas guides
|
|
617
|
+
* @see Hello World demos
|
|
618
|
+
* @see Todo App demos
|
|
615
619
|
* @category Store
|
|
616
620
|
*/
|
|
617
621
|
export interface Store {
|
|
@@ -2496,6 +2500,7 @@ export interface Store {
|
|
|
2496
2500
|
* console.log(store.getTables());
|
|
2497
2501
|
* // -> {pets: {fido: {species: 'dog', sold: false}}}
|
|
2498
2502
|
* ```
|
|
2503
|
+
* @see The Basics guides
|
|
2499
2504
|
* @category Creation
|
|
2500
2505
|
*/
|
|
2501
2506
|
export function createStore(): Store;
|
package/lib/ui-react.d.ts
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
* The components in this module provide a further abstraction over those hooks
|
|
11
11
|
* to ease the composition of user interfaces that use TinyBase.
|
|
12
12
|
*
|
|
13
|
+
* @see Building UIs guides
|
|
14
|
+
* @see Building UIs With Metrics guide
|
|
15
|
+
* @see Building UIs With Indexes guide
|
|
16
|
+
* @see Building UIs With Relationships guide
|
|
17
|
+
* @see Building UIs With Checkpoints guide
|
|
18
|
+
* @see Countries demo
|
|
19
|
+
* @see Todo App demos
|
|
20
|
+
* @see TinyDraw demo
|
|
13
21
|
* @packageDocumentation
|
|
14
22
|
* @module ui-react
|
|
15
23
|
*/
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://tinybase.org",
|
|
8
8
|
"description": "A tiny, reactive JavaScript library for structured state and tabular data.",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"tiny",
|
|
11
|
+
"reactive",
|
|
12
|
+
"state",
|
|
13
|
+
"data",
|
|
14
|
+
"react"
|
|
15
|
+
],
|
|
9
16
|
"type": "module",
|
|
10
17
|
"files": [
|
|
11
18
|
"lib/**"
|
|
@@ -14,6 +21,14 @@
|
|
|
14
21
|
".": "./lib/tinybase.js",
|
|
15
22
|
"./*": "./lib/*.js"
|
|
16
23
|
},
|
|
24
|
+
"typesVersions": {
|
|
25
|
+
"*": {
|
|
26
|
+
"*": [
|
|
27
|
+
"./lib/*.d.ts",
|
|
28
|
+
"./lib/tinybase.d.ts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
17
32
|
"browser": {
|
|
18
33
|
"fs": false
|
|
19
34
|
},
|
|
@@ -33,6 +48,7 @@
|
|
|
33
48
|
"compileDocsPagesOnly": "gulp compileDocsPagesOnly",
|
|
34
49
|
"compileDocsAssetsOnly": "gulp compileDocsAssetsOnly",
|
|
35
50
|
"compileDocs": "gulp compileDocs",
|
|
51
|
+
"compileForProdAndDocs": "gulp compileForProdAndDocs",
|
|
36
52
|
"serveDocs": "gulp serveDocs",
|
|
37
53
|
"preCommit": "gulp preCommit",
|
|
38
54
|
"prePublishPackage": "gulp prePublishPackage",
|
|
@@ -65,9 +81,9 @@
|
|
|
65
81
|
"country-flag-emoji-json": "^2.0.0",
|
|
66
82
|
"cspell": "^5.15.2",
|
|
67
83
|
"esbuild": "^0.14.11",
|
|
68
|
-
"eslint": "^8.
|
|
84
|
+
"eslint": "^8.7.0",
|
|
69
85
|
"eslint-config-prettier": "^8.3.0",
|
|
70
|
-
"eslint-plugin-jest": "^25.
|
|
86
|
+
"eslint-plugin-jest": "^25.7.0",
|
|
71
87
|
"eslint-plugin-jsdoc": "^37.6.1",
|
|
72
88
|
"eslint-plugin-react": "^7.28.0",
|
|
73
89
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
@@ -83,7 +99,7 @@
|
|
|
83
99
|
"react": "^17.0.2",
|
|
84
100
|
"react-dom": "^17.0.2",
|
|
85
101
|
"react-test-renderer": "^17.0.2",
|
|
86
|
-
"rollup": "^2.
|
|
102
|
+
"rollup": "^2.64.0",
|
|
87
103
|
"rollup-plugin-esbuild": "^4.8.2",
|
|
88
104
|
"rollup-plugin-gzip": "^3.0.0",
|
|
89
105
|
"rollup-plugin-prettier": "^2.2.2",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="a-javascript-library-for-structured-state">A JavaScript library for <em>structured state</em>.</h2><p>Using plain old JavaScript objects to manage
|
|
1
|
+
<section id="hero"><h2 id="a-javascript-library-for-structured-state">A JavaScript library for <em>structured state</em>.</h2><p>Using plain old JavaScript objects to manage data gets old very quickly. It's error-prone, tricky to track changes efficiently, and easy to mistakenly incur performance costs.</p><p><em>TinyBase is a smarter way to structure your application state:</em></p><ul><li>Familiar concepts of <a href="#set-and-get-tables-rows-and-cells">tables, rows, and cells</a>, and <a href="#apply-schemas-to-tables">schematization</a> to model your data domain.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so you only spend cycles on the data that changes.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#configure-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state! - out of the box.</li><li>Easily <a href="#persist-data-to-browser-file-or-server">sync your data</a> to local or remote storage, and use <a href="#call-react-hooks-to-bind-to-data">idiomatic bindings</a> to your React UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">2.6kB - 5.5kB</a> when compressed, and has zero dependencies. And of course it's <a href="#well-tested-and-documented">well tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>. Other <a href="https://tinybase.org/guides/faq/">FAQs</a>?</p></section><hr><p><a id="start" href="https://tinybase.org/guides/the-basics/getting-started">Get started</a></p><p><a href="https://tinybase.org/demos">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="set-and-get-tables-rows-and-cells">Set and get tables, rows, and cells.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a>, or <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values by their <a href="https://tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a>. And of course you can easily get the values back out again.</p><p>Read more about setting and changing data in <a href="https://tinybase.org/guides/the-basics">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
const store = createStore()
|
|
@@ -192,4 +192,4 @@ console.log(store.getCell('pets', 'felix', 'sold'));
|
|
|
192
192
|
// -> false
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store"><code>store</code></a> module alone, you'll only add a gzipped <em>2.6kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>5.5kB</em>. The <code>ui-react</code> adaptor is just another <em>2.6kB</em>, and everything is fast.</p><p>Life's easy when you have zero dependencies.</p><p>Read more about how TinyBase is structured in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store">store</a></th><td>2.6kB</td><td>5.8kB</td><td>23.8kB</td><td>86.
|
|
195
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store"><code>store</code></a> module alone, you'll only add a gzipped <em>2.6kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>5.5kB</em>. The <code>ui-react</code> adaptor is just another <em>2.6kB</em>, and everything is fast.</p><p>Life's easy when you have zero dependencies.</p><p>Read more about how TinyBase is structured in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store">store</a></th><td>2.6kB</td><td>5.8kB</td><td>23.8kB</td><td>86.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes">indexes</a></th><td>1.5kB</td><td>2.9kB</td><td>13.0kB</td><td>27.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics">metrics</a></th><td>1.5kB</td><td>3.0kB</td><td>12.3kB</td><td>26.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships">relationships</a></th><td>1.5kB</td><td>3.1kB</td><td>14.3kB</td><td>39.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints">checkpoints</a></th><td>1.3kB</td><td>2.4kB</td><td>10.0kB</td><td>30.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters">persisters</a></th><td>0.8kB</td><td>1.6kB</td><td>4.9kB</td><td>26.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/tinybase">tinybase</a></th><td>5.5kB</td><td>13.0kB</td><td>53.9kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>933</td><td>933</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,018</td><td>1,018</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>366</td><td>366</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>341</td><td>341</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">1,712</td></tr><tr><th class="right">Assertions</th><td colspan="3">7,959</td></tr></tbody></table></div><hr><p><a id="start" href="https://tinybase.org/guides/the-basics/getting-started">Get started</a></p><p><a href="https://tinybase.org/demos">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a> and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/issues">Issues</a> and <a href="https://github.com/tinyplex/tinybase/releases">release notes</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a></li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/1.0.3">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was an interesting exercise in API design, minification, and documentation. It's not <a href="https://www.linkedin.com/in/jamespearce">my day job</a>, but I do intend to maintain it, so please provide feedback. I could not have done this without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>
|