@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 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 i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},m=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!a.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(u=s(t,n))||u.enumerable});return e};var p=e=>m(i({},"__esModule",{value:!0}),e);var x={};l(x,{observe:()=>o.observe,tilia:()=>o.tilia,useTilia:()=>_});module.exports=p(x);var c=require("react"),o=require("@tilia/core");function _(e){let[,t]=(0,c.useState)(0),r=(0,o._connect)(e,()=>t(u=>u+1));return(0,c.useEffect)(function(){return(0,o._flush)(r),()=>(0,o._clear)(r)}),e}
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
@@ -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": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sDAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,iBACpCC,EAAyD,uBAElD,SAASH,EAASI,EAAG,CAC1B,GAAM,CAAC,CAAEC,CAAQ,KAAI,YAAS,CAAC,EACzBC,KAAI,YAASF,EAAG,IAAMC,EAAUE,GAAMA,EAAI,CAAC,CAAC,EAClD,sBAAU,UAAY,CACpB,mBAAOD,CAAC,EACD,OAAM,UAAOA,CAAC,CACvB,CAAC,EACMF,CACT",
6
- "names": ["src_exports", "__export", "useTilia", "__toCommonJS", "import_react", "import_core", "p", "setCount", "o", "i"]
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
- import{useState as n,useEffect as u}from"react";import{_connect as c,_flush as i,_clear as s,tilia as l,observe as m}from"@tilia/core";function p(t){let[,o]=n(0),e=c(t,()=>o(r=>r+1));return u(function(){return i(e),()=>s(e)}),t}export{m as observe,l as tilia,p as useTilia};
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
@@ -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,OAAS,YAAAA,EAAU,aAAAC,MAAiB,QACpC,OAAS,YAAAC,EAAU,UAAAC,EAAQ,UAAAC,EAAQ,SAAAC,EAAO,WAAAC,MAAe,cAElD,SAASC,EAASC,EAAG,CAC1B,GAAM,CAAC,CAAEC,CAAQ,EAAIT,EAAS,CAAC,EACzBU,EAAIR,EAASM,EAAG,IAAMC,EAAUE,GAAMA,EAAI,CAAC,CAAC,EAClD,OAAAV,EAAU,UAAY,CACpB,OAAAE,EAAOO,CAAC,EACD,IAAMN,EAAOM,CAAC,CACvB,CAAC,EACMF,CACT",
6
- "names": ["useState", "useEffect", "_connect", "_flush", "_clear", "tilia", "observe", "useTilia", "p", "setCount", "o", "i"]
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.0",
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": "^1.1.0"
27
+ "@tilia/core": "1.2.3-canary.20241223T161042"
28
28
  }
29
29
  }