@tilia/react 1.6.0 → 2.0.0-canary.20250518T212544

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
@@ -14,7 +14,8 @@ npm install @tilia/react
14
14
  ## Usage
15
15
 
16
16
  ```tsx
17
- import { tilia, observe, useTilia } from "@tilia/react";
17
+ import { tilia, observe } from "tilia";
18
+ import { useTilia } from "@tilia/react";
18
19
 
19
20
  // Create a tracked object or array:
20
21
  const state: MyState = tilia({
@@ -178,7 +179,7 @@ let make(~clouds: clouds) {
178
179
  }
179
180
  ```
180
181
 
181
- Please check the documentation for [@tilia/core](../core/README.md) for technical details on how tracking is done.
182
+ Please check the documentation for [tilia](https://github.com/tiliajs/tilia) for technical details on how tracking is done.
182
183
 
183
184
  ## Little sandbox examples
184
185
 
@@ -186,4 +187,4 @@ Please check the documentation for [@tilia/core](../core/README.md) for technica
186
187
 
187
188
  ### Changelog
188
189
 
189
- See [core/changelog](https://github.com/tiliajs/tilia)
190
+ See [tilia/changelog](https://github.com/tiliajs/tilia)
package/dist/index.cjs CHANGED
@@ -1,2 +1,36 @@
1
- var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of s(t))!m.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(u=f(t,n))||u.enumerable});return e};var x=e=>p(a({},"__esModule",{value:!0}),e);var b={};l(b,{clear:()=>o.clear,compute:()=>o.compute,observe:()=>o.observe,tilia:()=>o.tilia,track:()=>o.track,useTilia:()=>_});module.exports=x(b);var i=require("react"),c=require("@tilia/core"),o=require("@tilia/core");function _(e){let[,t]=(0,i.useState)(0),r=(0,c._connect)(e,()=>t(u=>u+1));return(0,i.useEffect)(function(){return(0,c._ready)(r),()=>(0,c.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 index_exports = {};
21
+ __export(index_exports, {
22
+ useTilia: () => useTilia
23
+ });
24
+ module.exports = __toCommonJS(index_exports);
25
+ var import_react = require("react");
26
+ var import_tilia = require("tilia");
27
+ function useTilia(p) {
28
+ const [, setCount] = (0, import_react.useState)(0);
29
+ const o = (0, import_tilia._observe)(p, () => setCount((i) => i + 1));
30
+ (0, import_react.useEffect)(function() {
31
+ (0, import_tilia._ready)(o);
32
+ return () => (0, import_tilia._clear)(o);
33
+ });
34
+ return p;
35
+ }
2
36
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
- "sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _connect, _ready, clear } from \"@tilia/core\";\nexport { tilia, observe, track, clear, compute } 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 _ready(o);\n return () => clear(o);\n });\n return p;\n}\n"],
5
- "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gHAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,iBACpCC,EAAwC,uBACxCA,EAAsD,uBAE/C,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,SAAMA,CAAC,CACtB,CAAC,EACMF,CACT",
6
- "names": ["index_exports", "__export", "useTilia", "__toCommonJS", "import_react", "import_core", "p", "setCount", "o", "i"]
4
+ "sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _observe, _ready, _clear } from \"tilia\";\n\nexport function useTilia(p) {\n const [, setCount] = useState(0);\n const o = _observe(p, () => setCount((i) => i + 1));\n useEffect(function () {\n _ready(o);\n return () => _clear(o);\n });\n return p;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AACpC,mBAAyC;AAElC,SAAS,SAAS,GAAG;AAC1B,QAAM,CAAC,EAAE,QAAQ,QAAI,uBAAS,CAAC;AAC/B,QAAM,QAAI,uBAAS,GAAG,MAAM,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC;AAClD,8BAAU,WAAY;AACpB,6BAAO,CAAC;AACR,WAAO,UAAM,qBAAO,CAAC;AAAA,EACvB,CAAC;AACD,SAAO;AACT;",
6
+ "names": []
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1 @@
1
-
2
- import type { observer } from "@tilia/core";
3
- export function tilia<a extends object>(tree: a, flush?: (fn: () => void) => void): a;
4
- export function observe<a>(tree: a, fn: (tree: a) => void): void;
5
- export function compute<a extends object>(tree: a, key: keyof a, fn: (tree: a) => void): observer;
6
- export function track<a>(tree: a, fn: (tree: a) => void): observer;
7
- export function clear(observer: observer): void;
8
1
  export const useTilia: <a>(tree: a) => a;
package/dist/index.mjs CHANGED
@@ -1,2 +1,16 @@
1
- import{useState as c,useEffect as n}from"react";import{_connect as u,_ready as i,clear as a}from"@tilia/core";import{tilia as x,observe as _,track as b,clear as d,compute as k}from"@tilia/core";function m(t){let[,o]=c(0),e=u(t,()=>o(r=>r+1));return n(function(){return i(e),()=>a(e)}),t}export{d as clear,k as compute,_ as observe,x as tilia,b as track,m as useTilia};
1
+ // src/index.js
2
+ import { useState, useEffect } from "react";
3
+ import { _observe, _ready, _clear } from "tilia";
4
+ function useTilia(p) {
5
+ const [, setCount] = useState(0);
6
+ const o = _observe(p, () => setCount((i) => i + 1));
7
+ useEffect(function() {
8
+ _ready(o);
9
+ return () => _clear(o);
10
+ });
11
+ return p;
12
+ }
13
+ export {
14
+ useTilia
15
+ };
2
16
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
- "sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _connect, _ready, clear } from \"@tilia/core\";\nexport { tilia, observe, track, clear, compute } 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 _ready(o);\n return () => clear(o);\n });\n return p;\n}\n"],
5
- "mappings": "AAAA,OAAS,YAAAA,EAAU,aAAAC,MAAiB,QACpC,OAAS,YAAAC,EAAU,UAAAC,EAAQ,SAAAC,MAAa,cACxC,OAAS,SAAAC,EAAO,WAAAC,EAAS,SAAAC,EAAO,SAAAH,EAAO,WAAAI,MAAe,cAE/C,SAASC,EAASC,EAAG,CAC1B,GAAM,CAAC,CAAEC,CAAQ,EAAIX,EAAS,CAAC,EACzBY,EAAIV,EAASQ,EAAG,IAAMC,EAAUE,GAAMA,EAAI,CAAC,CAAC,EAClD,OAAAZ,EAAU,UAAY,CACpB,OAAAE,EAAOS,CAAC,EACD,IAAMR,EAAMQ,CAAC,CACtB,CAAC,EACMF,CACT",
6
- "names": ["useState", "useEffect", "_connect", "_ready", "clear", "tilia", "observe", "track", "compute", "useTilia", "p", "setCount", "o", "i"]
4
+ "sourcesContent": ["import { useState, useEffect } from \"react\";\nimport { _observe, _ready, _clear } from \"tilia\";\n\nexport function useTilia(p) {\n const [, setCount] = useState(0);\n const o = _observe(p, () => setCount((i) => i + 1));\n useEffect(function () {\n _ready(o);\n return () => _clear(o);\n });\n return p;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,UAAU,iBAAiB;AACpC,SAAS,UAAU,QAAQ,cAAc;AAElC,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.6.0",
3
+ "version": "2.0.0-canary.20250518T212544",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -24,6 +24,6 @@
24
24
  "react": "*"
25
25
  },
26
26
  "dependencies": {
27
- "@tilia/core": "1.6.0"
27
+ "tilia": "2.0.0-canary.20250518T212544"
28
28
  }
29
29
  }
package/rescript.json CHANGED
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "dir": "src",
6
6
  "public": [
7
- "Tilia"
7
+ "TiliaReact"
8
8
  ],
9
9
  "subdirs": true
10
10
  },
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "suffix": ".mjs",
21
21
  "bs-dependencies": [
22
- "@tilia/core"
22
+ "tilia"
23
23
  ],
24
24
  "bs-dev-dependencies": [
25
25
  "@rescript/core",
@@ -1,20 +1,13 @@
1
1
  @module("react") external useState: int => (int, (int => int) => unit) = "useState"
2
2
  @module("react") external useEffect: (unit => option<unit => unit>) => unit = "useEffect"
3
- open TiliaCore
4
-
5
- type observer = observer
6
- let make = make
7
- let observe = observe
8
- let track = track
9
- let clear = clear
10
- let compute = compute
3
+ open Tilia
11
4
 
12
5
  let use = p => {
13
6
  let (_, setCount) = useState(0)
14
- let o = _connect(p, () => setCount(i => i + 1))
7
+ let o = _observe(p, () => setCount(i => i + 1))
15
8
  useEffect(() => {
16
9
  _ready(o)
17
- Some(() => clear(o))
10
+ Some(() => _clear(o))
18
11
  })
19
12
  p
20
13
  }
@@ -0,0 +1 @@
1
+ let use: 'a => 'a
package/src/Tilia.resi DELETED
@@ -1,8 +0,0 @@
1
- type observer = TiliaCore.observer
2
- let make: ('a, ~flush: (unit => unit) => unit=?) => 'a
3
- let observe: ('a, 'a => unit) => unit
4
- let compute: ('a, string, 'a => unit) => observer
5
- let track: ('a, 'a => unit) => observer
6
- let clear: observer => unit
7
-
8
- let use: 'a => 'a