@tilia/react 4.0.0-canary.20251114T172550 → 4.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 -60
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +1 -40
- package/dist/index.mjs.map +2 -2
- package/package.json +3 -13
- package/rescript.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,61 +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
|
-
leaf: () => leaf,
|
|
23
|
-
make: () => make,
|
|
24
|
-
useComputed: () => useComputed,
|
|
25
|
-
useTilia: () => useTilia
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var import_tilia = require("tilia");
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function make({ _observe, tilia }) {
|
|
31
|
-
function useTilia2() {
|
|
32
|
-
const [_, setCount] = (0, import_react.useState)(0);
|
|
33
|
-
const o = _observe(() => setCount((i) => i + 1));
|
|
34
|
-
(0, import_react.useEffect)(() => {
|
|
35
|
-
(0, import_tilia._ready)(o, true);
|
|
36
|
-
return () => (0, import_tilia._clear)(o);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function useComputed2(fn) {
|
|
40
|
-
return (0, import_react.useMemo)(() => tilia({ value: (0, import_tilia.computed)(fn) }), []).value;
|
|
41
|
-
}
|
|
42
|
-
function leaf2(fn) {
|
|
43
|
-
return (p) => {
|
|
44
|
-
const [_, setCount] = (0, import_react.useState)(0);
|
|
45
|
-
const o = _observe(() => setCount((i) => i + 1));
|
|
46
|
-
(0, import_react.useEffect)(() => {
|
|
47
|
-
(0, import_tilia._ready)(o, true);
|
|
48
|
-
return () => (0, import_tilia._clear)(o);
|
|
49
|
-
});
|
|
50
|
-
const node = fn(p);
|
|
51
|
-
(0, import_tilia._done)(o);
|
|
52
|
-
return node;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return { useTilia: useTilia2, useComputed: useComputed2, leaf: leaf2 };
|
|
56
|
-
}
|
|
57
|
-
var lib = make(import_tilia._ctx);
|
|
58
|
-
var useTilia = lib.useTilia;
|
|
59
|
-
var useComputed = lib.useComputed;
|
|
60
|
-
var leaf = lib.leaf;
|
|
1
|
+
var m=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var v=(o,e)=>{for(var r in e)m(o,r,{get:e[r],enumerable:!0})},y=(o,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!k.call(o,n)&&n!==r&&m(o,n,{get:()=>e[n],enumerable:!(s=_(e,n))||s.enumerable});return o};var E=o=>y(m({},"__esModule",{value:!0}),o);var g={};v(g,{leaf:()=>b,make:()=>d,useComputed:()=>S,useTilia:()=>M});module.exports=E(g);var t=require("tilia"),u=require("react");function d({_observe:o,tilia:e}){function r(){let[c,i]=(0,u.useState)(0),a=o(()=>i(f=>f+1));(0,u.useEffect)(()=>((0,t._ready)(a,!0),()=>(0,t._clear)(a)))}function s(c){return(0,u.useMemo)(()=>e({value:(0,t.computed)(c)}),[]).value}function n(c){return i=>{let[a,f]=(0,u.useState)(0),l=o(()=>f(C=>C+1));(0,u.useEffect)(()=>((0,t._ready)(l,!0),()=>(0,t._clear)(l)));let x=c(i);return(0,t._done)(l),x}}return{useTilia:r,useComputed:s,leaf:n}}var p=d(t._ctx),M=p.useTilia,S=p.useComputed,b=p.leaf;
|
|
61
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["import { _ctx, _done, _ready, _clear, computed } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe, tilia }) {\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(() => tilia({ value: computed(fn) }), []).value;\n }\n\n function leaf(fn) {\n return (p) => {\n const [_, setCount] = useState(0);\n const o = _observe(() => setCount((i) => i + 1));\n\n useEffect(() => {\n _ready(o, true);\n return () => _clear(o);\n });\n\n const node = fn(p);\n _done(o);\n return node;\n };\n }\n return { useTilia, useComputed, leaf };\n}\n\nconst lib = make(_ctx);\nexport const useTilia = lib.useTilia;\nexport const useComputed = lib.useComputed;\nexport const leaf = lib.leaf;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
5
|
+
"mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,SAAAC,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAAsD,iBACtDC,EAA6C,iBAEtC,SAASL,EAAK,CAAE,SAAAM,EAAU,MAAAC,CAAM,EAAG,CACxC,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,EAAM,CAAE,SAAO,YAASK,CAAE,CAAE,CAAC,EAAG,CAAC,CAAC,EAAE,KAC3D,CAEA,SAASb,EAAKa,EAAI,CAChB,OAAQC,GAAM,CACZ,GAAM,CAACL,EAAGC,CAAQ,KAAI,YAAS,CAAC,EAC1BC,EAAIJ,EAAS,IAAMG,EAAUE,GAAMA,EAAI,CAAC,CAAC,KAE/C,aAAU,QACR,UAAOD,EAAG,EAAI,EACP,OAAM,UAAOA,CAAC,EACtB,EAED,IAAMI,EAAOF,EAAGC,CAAC,EACjB,kBAAMH,CAAC,EACAI,CACT,CACF,CACA,MAAO,CAAE,SAAAZ,EAAU,YAAAD,EAAa,KAAAF,CAAK,CACvC,CAEA,IAAMgB,EAAMf,EAAK,MAAI,EACRE,EAAWa,EAAI,SACfd,EAAcc,EAAI,YAClBhB,EAAOgB,EAAI",
|
|
6
|
+
"names": ["index_exports", "__export", "leaf", "make", "useComputed", "useTilia", "__toCommonJS", "import_tilia", "import_react", "_observe", "tilia", "_", "setCount", "o", "i", "fn", "p", "node", "lib"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { _ctx, _done, _ready, _clear, computed } from "tilia";
|
|
3
|
-
import { useMemo, useState, useEffect } from "react";
|
|
4
|
-
function make({ _observe, tilia }) {
|
|
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) }), []).value;
|
|
15
|
-
}
|
|
16
|
-
function leaf2(fn) {
|
|
17
|
-
return (p) => {
|
|
18
|
-
const [_, setCount] = useState(0);
|
|
19
|
-
const o = _observe(() => setCount((i) => i + 1));
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
_ready(o, true);
|
|
22
|
-
return () => _clear(o);
|
|
23
|
-
});
|
|
24
|
-
const node = fn(p);
|
|
25
|
-
_done(o);
|
|
26
|
-
return node;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return { useTilia: useTilia2, useComputed: useComputed2, leaf: leaf2 };
|
|
30
|
-
}
|
|
31
|
-
var lib = make(_ctx);
|
|
32
|
-
var useTilia = lib.useTilia;
|
|
33
|
-
var useComputed = lib.useComputed;
|
|
34
|
-
var leaf = lib.leaf;
|
|
35
|
-
export {
|
|
36
|
-
leaf,
|
|
37
|
-
make,
|
|
38
|
-
useComputed,
|
|
39
|
-
useTilia
|
|
40
|
-
};
|
|
1
|
+
import{_ctx as _,_done as T,_ready as c,_clear as i,computed as k}from"tilia";import{useMemo as v,useState as a,useEffect as f}from"react";function y({_observe:s,tilia:l}){function m(){let[t,e]=a(0),o=s(()=>e(u=>u+1));f(()=>(c(o,!0),()=>i(o)))}function p(t){return v(()=>l({value:k(t)}),[]).value}function d(t){return e=>{let[o,u]=a(0),n=s(()=>u(C=>C+1));f(()=>(c(n,!0),()=>i(n)));let x=t(e);return T(n),x}}return{useTilia:m,useComputed:p,leaf:d}}var r=y(_),S=r.useTilia,b=r.useComputed,g=r.leaf;export{g as leaf,y as make,b as useComputed,S as useTilia};
|
|
41
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["import { _ctx, _done, _ready, _clear, computed } from \"tilia\";\nimport { useMemo, useState, useEffect } from \"react\";\n\nexport function make({ _observe, tilia }) {\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(() => tilia({ value: computed(fn) }), []).value;\n }\n\n function leaf(fn) {\n return (p) => {\n const [_, setCount] = useState(0);\n const o = _observe(() => setCount((i) => i + 1));\n\n useEffect(() => {\n _ready(o, true);\n return () => _clear(o);\n });\n\n const node = fn(p);\n _done(o);\n return node;\n };\n }\n return { useTilia, useComputed, leaf };\n}\n\nconst lib = make(_ctx);\nexport const useTilia = lib.useTilia;\nexport const useComputed = lib.useComputed;\nexport const leaf = lib.leaf;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["useTilia", "useComputed", "leaf"]
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,EAAO,UAAAC,EAAQ,UAAAC,EAAQ,YAAAC,MAAgB,QACtD,OAAS,WAAAC,EAAS,YAAAC,EAAU,aAAAC,MAAiB,QAEtC,SAASC,EAAK,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAAG,CACxC,SAASC,GAAW,CAClB,GAAM,CAACC,EAAGC,CAAQ,EAAIP,EAAS,CAAC,EAC1B,EAAIG,EAAS,IAAMI,EAAUC,GAAMA,EAAI,CAAC,CAAC,EAC/CP,EAAU,KACRL,EAAO,EAAG,EAAI,EACP,IAAMC,EAAO,CAAC,EACtB,CACH,CACA,SAASY,EAAYC,EAAI,CACvB,OAAOX,EAAQ,IAAMK,EAAM,CAAE,MAAON,EAASY,CAAE,CAAE,CAAC,EAAG,CAAC,CAAC,EAAE,KAC3D,CAEA,SAASC,EAAKD,EAAI,CAChB,OAAQE,GAAM,CACZ,GAAM,CAACN,EAAGC,CAAQ,EAAIP,EAAS,CAAC,EAC1Ba,EAAIV,EAAS,IAAMI,EAAUC,GAAMA,EAAI,CAAC,CAAC,EAE/CP,EAAU,KACRL,EAAOiB,EAAG,EAAI,EACP,IAAMhB,EAAOgB,CAAC,EACtB,EAED,IAAMC,EAAOJ,EAAGE,CAAC,EACjB,OAAAjB,EAAMkB,CAAC,EACAC,CACT,CACF,CACA,MAAO,CAAE,SAAAT,EAAU,YAAAI,EAAa,KAAAE,CAAK,CACvC,CAEA,IAAMI,EAAMb,EAAKR,CAAI,EACRW,EAAWU,EAAI,SACfN,EAAcM,EAAI,YAClBJ,EAAOI,EAAI",
|
|
6
|
+
"names": ["_ctx", "_done", "_ready", "_clear", "computed", "useMemo", "useState", "useEffect", "make", "_observe", "tilia", "useTilia", "_", "setCount", "i", "useComputed", "fn", "leaf", "p", "o", "node", "lib"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tilia/react",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"homepage": "https://tiliajs.com",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "./dist/index.cjs",
|
|
6
7
|
"module": "./dist/index.mjs",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.cjs"
|
|
13
|
-
},
|
|
14
|
-
"./src/TiliaReact.res": "./src/TiliaReact.res",
|
|
15
|
-
"./src/TiliaReact.resi": "./src/TiliaReact.resi",
|
|
16
|
-
"./src/TiliaReact.mjs": "./src/TiliaReact.mjs"
|
|
17
|
-
},
|
|
18
|
-
"type": "module",
|
|
19
9
|
"repository": {
|
|
20
10
|
"type": "git",
|
|
21
11
|
"url": "https://github.com/tiliajs/tilia.git"
|
|
@@ -40,6 +30,6 @@
|
|
|
40
30
|
"react": "*"
|
|
41
31
|
},
|
|
42
32
|
"dependencies": {
|
|
43
|
-
"tilia": "4.0
|
|
33
|
+
"tilia": "^4.0"
|
|
44
34
|
}
|
|
45
35
|
}
|
package/rescript.json
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
"sources": [
|
|
4
4
|
{
|
|
5
5
|
"dir": "src",
|
|
6
|
-
"public": [
|
|
7
|
-
"TiliaReact"
|
|
8
|
-
],
|
|
9
6
|
"subdirs": true
|
|
10
7
|
},
|
|
11
8
|
{
|
|
12
9
|
"dir": "test",
|
|
10
|
+
"subdirs": true,
|
|
13
11
|
"type": "dev"
|
|
14
12
|
}
|
|
15
13
|
],
|
|
@@ -19,15 +17,17 @@
|
|
|
19
17
|
},
|
|
20
18
|
"suffix": ".mjs",
|
|
21
19
|
"bs-dependencies": [
|
|
20
|
+
"@rescript/core",
|
|
21
|
+
"@rescript/react",
|
|
22
22
|
"tilia"
|
|
23
23
|
],
|
|
24
24
|
"bs-dev-dependencies": [
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
"vitest-bdd"
|
|
26
|
+
],
|
|
27
|
+
"bsc-flags": [
|
|
28
|
+
"-open RescriptCore"
|
|
28
29
|
],
|
|
29
|
-
"bsc-flags": [],
|
|
30
30
|
"jsx": {
|
|
31
31
|
"version": 4
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|