@tilia/react 2.0.0-canary.20250617T095051 → 2.0.0
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/dist/index.cjs +1 -45
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +1 -25
- package/dist/index.mjs.map +3 -3
- package/package.json +12 -6
- package/src/TiliaReact.res +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
var
|
|
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
|
-
make: () => make,
|
|
23
|
-
useComputed: () => useComputed,
|
|
24
|
-
useTilia: () => useTilia
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var import_tilia = require("tilia");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
function make({ _observe, _ready, _clear, tilia, computed }) {
|
|
30
|
-
function useTilia2() {
|
|
31
|
-
const [_, setCount] = (0, import_react.useState)(0);
|
|
32
|
-
const o = _observe(() => setCount((i) => i + 1));
|
|
33
|
-
(0, import_react.useEffect)(() => {
|
|
34
|
-
_ready(o, true);
|
|
35
|
-
return () => _clear(o);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function useComputed2(fn) {
|
|
39
|
-
return (0, import_react.useMemo)(() => tilia({ value: computed(fn) }), []);
|
|
40
|
-
}
|
|
41
|
-
return { useTilia: useTilia2, useComputed: useComputed2 };
|
|
42
|
-
}
|
|
43
|
-
var tr = make(import_tilia._ctx);
|
|
44
|
-
var useTilia = tr.useTilia;
|
|
45
|
-
var useComputed = tr.useComputed;
|
|
1
|
+
var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!x.call(t,o)&&o!==r&&c(t,o,{get:()=>e[o],enumerable:!(s=d(e,o))||s.enumerable});return t};var T=t=>_(c({},"__esModule",{value:!0}),t);var y={};C(y,{make:()=>m,useComputed:()=>k,useTilia:()=>b});module.exports=T(y);var u=require("tilia"),n=require("react");function m({_observe:t,signal:e}){function r(){let[o,a]=(0,n.useState)(0),i=t(()=>a(f=>f+1));(0,n.useEffect)(()=>((0,u._ready)(i,!0),()=>(0,u._clear)(i)))}function s(o){return(0,n.useMemo)(()=>e((0,u.computed)(o)),[])}return{useTilia:r,useComputed:s}}var p=m(u._ctx),b=p.useTilia,k=p.useComputed;
|
|
46
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["import { _ctx } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe,
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { _ctx, _ready, _clear, computed } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe, signal }) {\n function useTilia() {\n const [_, setCount] = useState(0);\n const o = _observe(() => setCount((i) => i + 1));\n useEffect(() => {\n _ready(o, true);\n return () => _clear(o);\n });\n }\n function useComputed(fn) {\n return useMemo(() => signal(computed(fn)), []);\n }\n return { useTilia, useComputed };\n}\n\nconst lib = make(_ctx);\nexport const useTilia = lib.useTilia;\nexport const useComputed = lib.useComputed;\n"],
|
|
5
|
+
"mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA+C,iBAC/CC,EAA6C,iBAEtC,SAASL,EAAK,CAAE,SAAAM,EAAU,OAAAC,CAAO,EAAG,CACzC,SAASL,GAAW,CAClB,GAAM,CAACM,EAAGC,CAAQ,KAAI,YAAS,CAAC,EAC1BC,EAAIJ,EAAS,IAAMG,EAAUE,GAAMA,EAAI,CAAC,CAAC,KAC/C,aAAU,QACR,UAAOD,EAAG,EAAI,EACP,OAAM,UAAOA,CAAC,EACtB,CACH,CACA,SAAST,EAAYW,EAAI,CACvB,SAAO,WAAQ,IAAML,KAAO,YAASK,CAAE,CAAC,EAAG,CAAC,CAAC,CAC/C,CACA,MAAO,CAAE,SAAAV,EAAU,YAAAD,CAAY,CACjC,CAEA,IAAMY,EAAMb,EAAK,MAAI,EACRE,EAAWW,EAAI,SACfZ,EAAcY,EAAI",
|
|
6
|
+
"names": ["index_exports", "__export", "make", "useComputed", "useTilia", "__toCommonJS", "import_tilia", "import_react", "_observe", "signal", "_", "setCount", "o", "i", "fn", "lib"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { _ctx } from "tilia";
|
|
3
|
-
import { useMemo, useState, useEffect } from "react";
|
|
4
|
-
function make({ _observe, _ready, _clear, tilia, computed }) {
|
|
5
|
-
function useTilia2() {
|
|
6
|
-
const [_, setCount] = useState(0);
|
|
7
|
-
const o = _observe(() => setCount((i) => i + 1));
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
_ready(o, true);
|
|
10
|
-
return () => _clear(o);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function useComputed2(fn) {
|
|
14
|
-
return useMemo(() => tilia({ value: computed(fn) }), []);
|
|
15
|
-
}
|
|
16
|
-
return { useTilia: useTilia2, useComputed: useComputed2 };
|
|
17
|
-
}
|
|
18
|
-
var tr = make(_ctx);
|
|
19
|
-
var useTilia = tr.useTilia;
|
|
20
|
-
var useComputed = tr.useComputed;
|
|
21
|
-
export {
|
|
22
|
-
make,
|
|
23
|
-
useComputed,
|
|
24
|
-
useTilia
|
|
25
|
-
};
|
|
1
|
+
import{_ctx as m,_ready as p,_clear as a,computed as f}from"tilia";import{useMemo as d,useState as l,useEffect as x}from"react";function C({_observe:u,signal:r}){function n(){let[e,c]=l(0),t=u(()=>c(i=>i+1));x(()=>(p(t,!0),()=>a(t)))}function s(e){return d(()=>r(f(e)),[])}return{useTilia:n,useComputed:s}}var o=C(m),b=o.useTilia,k=o.useComputed;export{C as make,k as useComputed,b as useTilia};
|
|
26
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["import { _ctx } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe,
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["useTilia", "useComputed"]
|
|
4
|
+
"sourcesContent": ["import { _ctx, _ready, _clear, computed } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe, signal }) {\n function useTilia() {\n const [_, setCount] = useState(0);\n const o = _observe(() => setCount((i) => i + 1));\n useEffect(() => {\n _ready(o, true);\n return () => _clear(o);\n });\n }\n function useComputed(fn) {\n return useMemo(() => signal(computed(fn)), []);\n }\n return { useTilia, useComputed };\n}\n\nconst lib = make(_ctx);\nexport const useTilia = lib.useTilia;\nexport const useComputed = lib.useComputed;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,UAAAC,EAAQ,UAAAC,EAAQ,YAAAC,MAAgB,QAC/C,OAAS,WAAAC,EAAS,YAAAC,EAAU,aAAAC,MAAiB,QAEtC,SAASC,EAAK,CAAE,SAAAC,EAAU,OAAAC,CAAO,EAAG,CACzC,SAASC,GAAW,CAClB,GAAM,CAACC,EAAGC,CAAQ,EAAIP,EAAS,CAAC,EAC1BQ,EAAIL,EAAS,IAAMI,EAAU,GAAM,EAAI,CAAC,CAAC,EAC/CN,EAAU,KACRL,EAAOY,EAAG,EAAI,EACP,IAAMX,EAAOW,CAAC,EACtB,CACH,CACA,SAASC,EAAYC,EAAI,CACvB,OAAOX,EAAQ,IAAMK,EAAON,EAASY,CAAE,CAAC,EAAG,CAAC,CAAC,CAC/C,CACA,MAAO,CAAE,SAAAL,EAAU,YAAAI,CAAY,CACjC,CAEA,IAAME,EAAMT,EAAKP,CAAI,EACRU,EAAWM,EAAI,SACfF,EAAcE,EAAI",
|
|
6
|
+
"names": ["_ctx", "_ready", "_clear", "computed", "useMemo", "useState", "useEffect", "make", "_observe", "signal", "useTilia", "_", "setCount", "o", "useComputed", "fn", "lib"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tilia/react",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"homepage": "https://tiliajs.com",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -12,12 +12,17 @@
|
|
|
12
12
|
},
|
|
13
13
|
"description": "🍃 React State Management with Tilia.",
|
|
14
14
|
"keywords": [
|
|
15
|
+
"state management",
|
|
16
|
+
"domain-driven",
|
|
17
|
+
"reactive",
|
|
18
|
+
"typescript",
|
|
15
19
|
"rescript",
|
|
20
|
+
"frp",
|
|
16
21
|
"react",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
22
|
+
"hooks",
|
|
23
|
+
"computed",
|
|
24
|
+
"minimal",
|
|
25
|
+
"simple"
|
|
21
26
|
],
|
|
22
27
|
"author": "Gaspard Anna Bucher <g.a.bucher@midasum.com>",
|
|
23
28
|
"license": "MIT",
|
|
@@ -25,6 +30,7 @@
|
|
|
25
30
|
"react": "*"
|
|
26
31
|
},
|
|
27
32
|
"dependencies": {
|
|
28
|
-
"tilia": "2.0.0
|
|
33
|
+
"@tilia/tilia": "2.0.0",
|
|
34
|
+
"tilia": "^2.0.0"
|
|
29
35
|
}
|
|
30
36
|
}
|
package/src/TiliaReact.res
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
3
|
@module("react") external useMemo: (unit => 'a, 'b) => 'a = "useMemo"
|
|
4
|
+
open Tilia
|
|
4
5
|
|
|
5
6
|
type tilia_react = {
|
|
6
7
|
useTilia: unit => unit,
|
|
@@ -8,7 +9,7 @@ type tilia_react = {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
let make = ctx => {
|
|
11
|
-
let {Tilia._observe: _observe,
|
|
12
|
+
let {Tilia._observe: _observe, signal} = ctx
|
|
12
13
|
let useTilia = () => {
|
|
13
14
|
let (_, setCount) = useState(0)
|
|
14
15
|
let o = _observe(() => setCount(i => i + 1))
|
|
@@ -17,10 +18,10 @@ let make = ctx => {
|
|
|
17
18
|
Some(() => _clear(o))
|
|
18
19
|
})
|
|
19
20
|
}
|
|
20
|
-
let useComputed = fn => useMemo(() =>
|
|
21
|
+
let useComputed = fn => useMemo(() => signal(computed(fn)), [])
|
|
21
22
|
{useTilia, useComputed}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
let tr = make(
|
|
25
|
+
let tr = make(_ctx)
|
|
25
26
|
let useTilia = tr.useTilia
|
|
26
27
|
let useComputed = tr.useComputed
|