@ecopages/signals 0.3.0-alpha.16 → 0.3.0-alpha.18
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/package.json +7 -23
- package/README.md +0 -109
- package/dist/LICENSE +0 -21
- package/dist/package.json +0 -44
- package/size-budget.json +0 -10
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/index.js.map → index.js.map} +0 -0
- /package/{dist/src → src}/async-state/index.d.ts +0 -0
- /package/{dist/src → src}/computed.d.ts +0 -0
- /package/{dist/src → src}/dependency.d.ts +0 -0
- /package/{dist/src → src}/effect.d.ts +0 -0
- /package/{dist/src → src}/runtime.d.ts +0 -0
- /package/{dist/src → src}/signal-node.d.ts +0 -0
- /package/{dist/src → src}/state.d.ts +0 -0
- /package/{dist/src → src}/store.d.ts +0 -0
- /package/{dist/src → src}/tracking.d.ts +0 -0
- /package/{dist/src → src}/types.d.ts +0 -0
- /package/{dist/src → src}/watch.d.ts +0 -0
- /package/{dist/src → src}/watcher.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/signals",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.18",
|
|
4
4
|
"description": "Renderer-agnostic signal primitives based on the TC39 Signals proposal",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,19 +13,16 @@
|
|
|
13
13
|
},
|
|
14
14
|
"author": "Andrea Zanenghi",
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"main": "
|
|
17
|
-
"module": "
|
|
18
|
-
"types": "
|
|
16
|
+
"main": "./index.js",
|
|
17
|
+
"module": "./index.js",
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"files": [
|
|
25
|
-
"
|
|
26
|
-
"README.md",
|
|
27
|
-
"size-budget.json",
|
|
28
|
-
"package.json"
|
|
25
|
+
"**/*"
|
|
29
26
|
],
|
|
30
27
|
"keywords": [
|
|
31
28
|
"signals",
|
|
@@ -36,24 +33,11 @@
|
|
|
36
33
|
],
|
|
37
34
|
"exports": {
|
|
38
35
|
".": {
|
|
39
|
-
"types": "./
|
|
40
|
-
"import": "./
|
|
36
|
+
"types": "./index.d.ts",
|
|
37
|
+
"import": "./index.js"
|
|
41
38
|
},
|
|
42
39
|
"./package.json": "./package.json"
|
|
43
40
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build:lib": "bun run clean && bun run build:files && bun run build:types",
|
|
46
|
-
"build:files": "bun run ./build.ts",
|
|
47
|
-
"build:types": "tsc -p tsconfig.build.json",
|
|
48
|
-
"clean": "rm -rf ./dist",
|
|
49
|
-
"size:check": "bun run ./check-size.ts",
|
|
50
|
-
"size:report": "bun run ./check-size.ts --report-only",
|
|
51
|
-
"test:lib": "vitest run"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@vitest/coverage-v8": "3.2.4",
|
|
55
|
-
"vitest": "^3.2.4"
|
|
56
|
-
},
|
|
57
41
|
"peerDependencies": {
|
|
58
42
|
"typescript": "^5"
|
|
59
43
|
}
|
package/README.md
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# Ecopages Signals
|
|
2
|
-
|
|
3
|
-
`@ecopages/signals` is a renderer-agnostic signals package that can be used standalone or underneath Radiant.
|
|
4
|
-
|
|
5
|
-
Its core model is based on the [TC39 Signals proposal](https://github.com/tc39/proposal-signals/tree/main), with a smaller surface area and a few convenience helpers for application code today.
|
|
6
|
-
|
|
7
|
-
The public entrypoint remains `index.ts`, while the implementation now lives in focused modules under `src/` so the core runtime, effects, watcher support, and store logic can evolve independently.
|
|
8
|
-
|
|
9
|
-
## Current Scope
|
|
10
|
-
|
|
11
|
-
This package currently provides:
|
|
12
|
-
|
|
13
|
-
- `State<T>` for writable values
|
|
14
|
-
- `Computed<T>` for lazily derived values
|
|
15
|
-
- `currentComputed()` for advanced derived helpers that need the active computed context
|
|
16
|
-
- `effect(...)` for reactive side effects with scheduled re-execution
|
|
17
|
-
- `watch(...)` for observing derived values with previous-value access
|
|
18
|
-
- `untrack(...)` and `peek(...)` for non-tracking reads
|
|
19
|
-
- `subtle.Watcher` plus `watched` and `unwatched` hooks for low-level invalidation workflows
|
|
20
|
-
- `createStore(...)` for deep reactive object and array state
|
|
21
|
-
- `isStore(...)` for detecting signal-backed store proxies
|
|
22
|
-
- `snapshot(...)` for materializing plain nested data
|
|
23
|
-
- automatic dependency discovery during `Computed` evaluation
|
|
24
|
-
- subscription support for renderer or framework adapters
|
|
25
|
-
|
|
26
|
-
## Source Layout
|
|
27
|
-
|
|
28
|
-
The package is organized around a stable public barrel and smaller implementation files:
|
|
29
|
-
|
|
30
|
-
- `index.ts` re-exports the public API and exposes `subtle`
|
|
31
|
-
- `src/types.ts` defines the public contracts, options, and low-level symbols
|
|
32
|
-
- `src/state.ts` implements writable `State` signals
|
|
33
|
-
- `src/computed.ts` implements lazy derived `Computed` signals and active-computation helpers
|
|
34
|
-
- `src/effect.ts` and `src/watch.ts` implement effect scheduling and derived-value observation
|
|
35
|
-
- `src/watcher.ts` implements proposal-shaped low-level watchers
|
|
36
|
-
- `src/tracking.ts` contains non-tracking read helpers
|
|
37
|
-
- `src/store.ts` contains deep store proxying and snapshot materialization
|
|
38
|
-
|
|
39
|
-
## Design Position
|
|
40
|
-
|
|
41
|
-
This package is renderer-agnostic.
|
|
42
|
-
|
|
43
|
-
- It does not know about JSX.
|
|
44
|
-
- It does not know about Radiant components.
|
|
45
|
-
- It is meant to work both as a standalone package and underneath adapters in those packages.
|
|
46
|
-
|
|
47
|
-
## TC39 Relationship
|
|
48
|
-
|
|
49
|
-
This package is based on the current TC39 Signals proposal and tracks the same broad model around:
|
|
50
|
-
|
|
51
|
-
- `State` and `Computed` signal classes
|
|
52
|
-
- lazy pull-based recomputation with cached values
|
|
53
|
-
- automatic dependency discovery during computed evaluation
|
|
54
|
-
- custom equality functions for writable and computed signals
|
|
55
|
-
- untracked reads as an escape hatch
|
|
56
|
-
|
|
57
|
-
It is not a drop-in implementation of the current proposal draft.
|
|
58
|
-
|
|
59
|
-
It is best understood as proposal-aligned in its core semantics, but not yet fully API-compatible with the draft surface.
|
|
60
|
-
|
|
61
|
-
- It exposes convenience helpers such as `effect(...)`, `watch(...)`, `createStore(...)`, and `snapshot(...)` directly.
|
|
62
|
-
- It currently exposes manual `subscribe(...)` hooks for adapter and library integration.
|
|
63
|
-
- It exposes a proposal-shaped `subtle.Watcher` API, while still keeping the existing convenience helpers.
|
|
64
|
-
- Its `subtle.Watcher` follows the proposal-style re-arm behavior, where calling `watch(...)` resets the pending set and notification latch for the next invalidation cycle.
|
|
65
|
-
- It does not yet expose the full TC39 subtle introspection surface.
|
|
66
|
-
|
|
67
|
-
## API Notes
|
|
68
|
-
|
|
69
|
-
- `subscribe(...)` is intended for adapter-style push integration. Application-level derived work is usually better expressed with `Computed`, `effect(...)`, or `watch(...)`.
|
|
70
|
-
- `watch(...)` is built on top of a computed signal plus an effect, so it inherits computed equality behavior and effect scheduling.
|
|
71
|
-
- `subtle.Watcher` reports staleness rather than recalculated values. Calling `watch(...)` is both registration and reset.
|
|
72
|
-
- `createStore(...)` wraps nested plain objects and arrays, while `snapshot(...)` detaches the current plain value graph for logging, serialization, or comparison.
|
|
73
|
-
|
|
74
|
-
## Example
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
import { Computed, State, createStore, effect, watch } from '@ecopages/signals';
|
|
78
|
-
|
|
79
|
-
const count = new State(0);
|
|
80
|
-
const parity = new Computed(() => ((count.get() & 1) === 0 ? 'even' : 'odd'));
|
|
81
|
-
const store = createStore({ profile: { name: 'Ada' } });
|
|
82
|
-
|
|
83
|
-
const dispose = effect(() => {
|
|
84
|
-
console.log(parity.get(), store.profile.name);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const stopWatching = watch(
|
|
88
|
-
() => store.profile.name,
|
|
89
|
-
(nextName, previousName) => {
|
|
90
|
-
console.log(previousName, '->', nextName);
|
|
91
|
-
},
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
count.set(1);
|
|
95
|
-
store.profile.name = 'Grace';
|
|
96
|
-
dispose();
|
|
97
|
-
stopWatching();
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Limits
|
|
101
|
-
|
|
102
|
-
This implementation is still smaller than the current TC39 proposal draft.
|
|
103
|
-
|
|
104
|
-
- no full TC39 `Watcher` and subtle semantics surface yet
|
|
105
|
-
- no full proposal-style subtle introspection helpers yet
|
|
106
|
-
- no batching or transaction model
|
|
107
|
-
- no framework-owned disposal tree or component ownership integration yet
|
|
108
|
-
|
|
109
|
-
Those omissions are deliberate. The goal is to keep a small, useful standalone package while leaving room to align further as the proposal evolves.
|
package/dist/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026-present Andrea Zanenghi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/package.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ecopages/signals",
|
|
3
|
-
"version": "0.3.0-alpha.15",
|
|
4
|
-
"description": "Renderer-agnostic signal primitives based on the TC39 Signals proposal",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/ecopages/radiant.git",
|
|
8
|
-
"directory": "packages/signals"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://github.com/ecopages/radiant/tree/main/packages/signals#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/ecopages/radiant/issues"
|
|
13
|
-
},
|
|
14
|
-
"author": "Andrea Zanenghi",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"main": "./index.js",
|
|
17
|
-
"module": "./index.js",
|
|
18
|
-
"types": "./index.d.ts",
|
|
19
|
-
"type": "module",
|
|
20
|
-
"publishConfig": {
|
|
21
|
-
"access": "public"
|
|
22
|
-
},
|
|
23
|
-
"sideEffects": false,
|
|
24
|
-
"files": [
|
|
25
|
-
"**/*"
|
|
26
|
-
],
|
|
27
|
-
"keywords": [
|
|
28
|
-
"signals",
|
|
29
|
-
"reactivity",
|
|
30
|
-
"tc39",
|
|
31
|
-
"state-management",
|
|
32
|
-
"radiant"
|
|
33
|
-
],
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"types": "./index.d.ts",
|
|
37
|
-
"import": "./index.js"
|
|
38
|
-
},
|
|
39
|
-
"./package.json": "./package.json"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"typescript": "^5"
|
|
43
|
-
}
|
|
44
|
-
}
|
package/size-budget.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|