@tilia/react 1.1.0 → 1.1.1-canary.20241224T092550
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/README.md +16 -3
- package/dist/index.cjs.js +37 -1
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.esm.js +17 -1
- package/dist/index.esm.js.map +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,11 +52,9 @@ function Clouds(props: { clouds: MyState["clouds"] }) {
|
|
|
52
52
|
Note that you can re-insert a tracked object inside the same tree and share
|
|
53
53
|
state and tracking.
|
|
54
54
|
|
|
55
|
-
|
|
56
55
|
# ReScript example
|
|
57
56
|
|
|
58
57
|
```res
|
|
59
|
-
open TiliaCore
|
|
60
58
|
open JsxEvent.Form
|
|
61
59
|
|
|
62
60
|
type clouds = {
|
|
@@ -69,7 +67,7 @@ type state = {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
// Create a tracked object or array:
|
|
72
|
-
let tree = make({
|
|
70
|
+
let tree = Tilia.make({
|
|
73
71
|
flowers: "are beautiful",
|
|
74
72
|
clouds: { morning: "can be pink", evening: "can be orange" },
|
|
75
73
|
})
|
|
@@ -96,3 +94,18 @@ let make(~clouds: clouds) {
|
|
|
96
94
|
</div>
|
|
97
95
|
}
|
|
98
96
|
```
|
|
97
|
+
|
|
98
|
+
Please check the documentation for [@tilia/core](../core/README.md) for technical details on how tracking is done.
|
|
99
|
+
|
|
100
|
+
## Little sandbox examples
|
|
101
|
+
|
|
102
|
+
- [An input field](https://codesandbox.io/p/sandbox/react-ts)
|
|
103
|
+
|
|
104
|
+
### Changelog
|
|
105
|
+
|
|
106
|
+
- 2024-12-18 **1.2.2** Fix readonly tracking: should not proxy.
|
|
107
|
+
- 2024-12-18 **1.2.1** Fix bug to not track prototype methods.
|
|
108
|
+
- 2024-12-18 **1.2.0** Improve ownKeys watching, notify on key deletion.
|
|
109
|
+
- 2024-12-18 **1.1.1** Fix build issue (rescript was still required)
|
|
110
|
+
- 2024-12-17 **1.1.0** Add support to share tracking between branches.
|
|
111
|
+
- 2024-12-13 **1.0.0** Alpha release.
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.js
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
observe: () => import_core.observe,
|
|
23
|
+
tilia: () => import_core.tilia,
|
|
24
|
+
useTilia: () => useTilia
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_core = require("@tilia/core");
|
|
29
|
+
function useTilia(p) {
|
|
30
|
+
const [, setCount] = (0, import_react.useState)(0);
|
|
31
|
+
const o = (0, import_core._connect)(p, () => setCount((i) => i + 1));
|
|
32
|
+
(0, import_react.useEffect)(function() {
|
|
33
|
+
(0, import_core._flush)(o);
|
|
34
|
+
return () => (0, import_core._clear)(o);
|
|
35
|
+
});
|
|
36
|
+
return p;
|
|
37
|
+
}
|
|
2
38
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _connect, _flush, _clear, tilia, observe } from \"@tilia/core\";\n\nexport function useTilia(p) {\n const [, setCount] = useState(0);\n const o = _connect(p, () => setCount((i) => i + 1));\n useEffect(function () {\n _flush(o);\n return () => _clear(o);\n });\n return p;\n}\n\nexport { tilia, observe };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AACpC,kBAAyD;AAElD,SAAS,SAAS,GAAG;AAC1B,QAAM,CAAC,EAAE,QAAQ,QAAI,uBAAS,CAAC;AAC/B,QAAM,QAAI,sBAAS,GAAG,MAAM,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC;AAClD,8BAAU,WAAY;AACpB,4BAAO,CAAC;AACR,WAAO,UAAM,oBAAO,CAAC;AAAA,EACvB,CAAC;AACD,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
// src/index.js
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { _connect, _flush, _clear, tilia, observe } from "@tilia/core";
|
|
4
|
+
function useTilia(p) {
|
|
5
|
+
const [, setCount] = useState(0);
|
|
6
|
+
const o = _connect(p, () => setCount((i) => i + 1));
|
|
7
|
+
useEffect(function() {
|
|
8
|
+
_flush(o);
|
|
9
|
+
return () => _clear(o);
|
|
10
|
+
});
|
|
11
|
+
return p;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
observe,
|
|
15
|
+
tilia,
|
|
16
|
+
useTilia
|
|
17
|
+
};
|
|
2
18
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _connect, _flush, _clear, tilia, observe } from \"@tilia/core\";\n\nexport function useTilia(p) {\n const [, setCount] = useState(0);\n const o = _connect(p, () => setCount((i) => i + 1));\n useEffect(function () {\n _flush(o);\n return () => _clear(o);\n });\n return p;\n}\n\nexport { tilia, observe };\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU,iBAAiB;AACpC,SAAS,UAAU,QAAQ,QAAQ,OAAO,eAAe;AAElD,SAAS,SAAS,GAAG;AAC1B,QAAM,CAAC,EAAE,QAAQ,IAAI,SAAS,CAAC;AAC/B,QAAM,IAAI,SAAS,GAAG,MAAM,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC;AAClD,YAAU,WAAY;AACpB,WAAO,CAAC;AACR,WAAO,MAAM,OAAO,CAAC;AAAA,EACvB,CAAC;AACD,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tilia/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1-canary.20241224T092550",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"react": "*"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tilia/core": "
|
|
27
|
+
"@tilia/core": "1.2.3-canary.20241223T161042"
|
|
28
28
|
}
|
|
29
29
|
}
|