xote 1.0.1 → 1.0.3
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 +36 -263
- package/dist/xote.cjs +1 -0
- package/dist/xote.cjs.map +1 -0
- package/dist/xote.mjs +708 -0
- package/dist/xote.mjs.map +1 -0
- package/dist/xote.umd.js +1 -0
- package/dist/xote.umd.js.map +1 -0
- package/package.json +20 -2
- package/.gitattributes +0 -2
- package/.github/workflows/release.yml +0 -44
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs +0 -9
- package/dist/index.mjs.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/docs/CHANGELOG.md +0 -20
- package/index.html +0 -28
- package/rescript.json +0 -18
- package/src/Xote.res +0 -5
- package/src/Xote.res.mjs +0 -21
- package/src/Xote__Component.res +0 -151
- package/src/Xote__Component.res.mjs +0 -202
- package/src/Xote__Computed.res +0 -43
- package/src/Xote__Computed.res.mjs +0 -61
- package/src/Xote__Core.res +0 -105
- package/src/Xote__Core.res.mjs +0 -148
- package/src/Xote__Effect.res +0 -36
- package/src/Xote__Effect.res.mjs +0 -57
- package/src/Xote__Example.res +0 -266
- package/src/Xote__Example.res.mjs +0 -303
- package/src/Xote__Id.res +0 -5
- package/src/Xote__Id.res.mjs +0 -17
- package/src/Xote__Observer.res +0 -12
- package/src/Xote__Observer.res.mjs +0 -12
- package/src/Xote__Signal.res +0 -31
- package/src/Xote__Signal.res.mjs +0 -64
- package/vite.config.js +0 -45
package/src/Xote__Signal.res
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module IntSet = Belt.Set.Int
|
|
2
|
-
module IntMap = Belt.Map.Int
|
|
3
|
-
module Observer = Xote__Observer
|
|
4
|
-
module Id = Xote__Id
|
|
5
|
-
module Core = Xote__Core
|
|
6
|
-
|
|
7
|
-
let make = (v: 'a): Core.t<'a> => {
|
|
8
|
-
let id = Id.make()
|
|
9
|
-
Core.ensureSignalBucket(id)
|
|
10
|
-
{id, value: ref(v), version: ref(0)}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let get = (s: Core.t<'a>): 'a => {
|
|
14
|
-
switch Core.currentObserverId.contents {
|
|
15
|
-
| None => ()
|
|
16
|
-
| Some(obsId) => Core.addDep(obsId, s.id)
|
|
17
|
-
}
|
|
18
|
-
s.value.contents
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* read without tracking */
|
|
22
|
-
let peek = (s: Core.t<'a>): 'a => s.value.contents
|
|
23
|
-
|
|
24
|
-
let set = (s: Core.t<'a>, v: 'a) => {
|
|
25
|
-
// Always update - skip equality check to avoid issues with complex types
|
|
26
|
-
s.value := v
|
|
27
|
-
s.version := s.version.contents + 1
|
|
28
|
-
Core.notify(s.id)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let update = (s: Core.t<'a>, f: 'a => 'a) => set(s, f(s.value.contents))
|
package/src/Xote__Signal.res.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as Xote__Id from "./Xote__Id.res.mjs";
|
|
4
|
-
import * as Xote__Core from "./Xote__Core.res.mjs";
|
|
5
|
-
|
|
6
|
-
function make(v) {
|
|
7
|
-
var id = Xote__Id.make();
|
|
8
|
-
Xote__Core.ensureSignalBucket(id);
|
|
9
|
-
return {
|
|
10
|
-
id: id,
|
|
11
|
-
value: {
|
|
12
|
-
contents: v
|
|
13
|
-
},
|
|
14
|
-
version: {
|
|
15
|
-
contents: 0
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function get(s) {
|
|
21
|
-
var obsId = Xote__Core.currentObserverId.contents;
|
|
22
|
-
if (obsId !== undefined) {
|
|
23
|
-
Xote__Core.addDep(obsId, s.id);
|
|
24
|
-
}
|
|
25
|
-
return s.value.contents;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function peek(s) {
|
|
29
|
-
return s.value.contents;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function set(s, v) {
|
|
33
|
-
s.value.contents = v;
|
|
34
|
-
s.version.contents = s.version.contents + 1 | 0;
|
|
35
|
-
Xote__Core.notify(s.id);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function update(s, f) {
|
|
39
|
-
set(s, f(s.value.contents));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var IntSet;
|
|
43
|
-
|
|
44
|
-
var IntMap;
|
|
45
|
-
|
|
46
|
-
var Observer;
|
|
47
|
-
|
|
48
|
-
var Id;
|
|
49
|
-
|
|
50
|
-
var Core;
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
IntSet ,
|
|
54
|
-
IntMap ,
|
|
55
|
-
Observer ,
|
|
56
|
-
Id ,
|
|
57
|
-
Core ,
|
|
58
|
-
make ,
|
|
59
|
-
get ,
|
|
60
|
-
peek ,
|
|
61
|
-
set ,
|
|
62
|
-
update ,
|
|
63
|
-
}
|
|
64
|
-
/* No side effect */
|
package/vite.config.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
|
|
5
|
-
// Read package.json to auto-externalize deps & name the UMD build
|
|
6
|
-
const pkg = JSON.parse(
|
|
7
|
-
readFileSync(new URL("./package.json", import.meta.url), "utf-8")
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
// Allow overriding the entry with ENV: ENTRY=src/whatever.ts
|
|
11
|
-
const entryFromEnv = process.env.ENTRY;
|
|
12
|
-
|
|
13
|
-
export default defineConfig(() => ({
|
|
14
|
-
build: {
|
|
15
|
-
outDir: "dist",
|
|
16
|
-
sourcemap: true,
|
|
17
|
-
lib: {
|
|
18
|
-
// Default entry is src/index.ts; override with ENTRY env var
|
|
19
|
-
entry: path.resolve(process.cwd(), entryFromEnv ?? "src/Xote.res.mjs"),
|
|
20
|
-
// A safe global name for UMD; falls back to "Library"
|
|
21
|
-
name:
|
|
22
|
-
(pkg.name?.replace?.(/[^a-zA-Z0-9_$]/g, "_")) ||
|
|
23
|
-
"xote",
|
|
24
|
-
formats: ["es", "cjs", "umd"],
|
|
25
|
-
fileName: (format) =>
|
|
26
|
-
format === "es"
|
|
27
|
-
? "index.mjs"
|
|
28
|
-
: format === "cjs"
|
|
29
|
-
? "index.cjs"
|
|
30
|
-
: "index.umd.js",
|
|
31
|
-
},
|
|
32
|
-
rollupOptions: {
|
|
33
|
-
external: [
|
|
34
|
-
...Object.keys(pkg.dependencies ?? {}),
|
|
35
|
-
...Object.keys(pkg.peerDependencies ?? {}),
|
|
36
|
-
],
|
|
37
|
-
output: {
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
// Tweak if you want smaller/faster builds
|
|
41
|
-
minify: "esbuild",
|
|
42
|
-
target: "es2019",
|
|
43
|
-
emptyOutDir: true,
|
|
44
|
-
},
|
|
45
|
-
}));
|