@pyreon/solid-compat 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Vit Bokisch
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/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @pyreon/solid-compat
2
+
3
+ SolidJS-compatible API shim that runs on Pyreon's signal-based reactive engine. Migrate Solid code by swapping the import path.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ bun add @pyreon/solid-compat
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```ts
14
+ // Replace:
15
+ // import { createSignal, createEffect } from "solid-js"
16
+ // With:
17
+ import { createSignal, createEffect } from "@pyreon/solid-compat"
18
+
19
+ function Counter() {
20
+ const [count, setCount] = createSignal(0)
21
+ createEffect(() => console.log("count:", count()))
22
+ return <button onClick={() => setCount((c) => c + 1)}>{count}</button>
23
+ }
24
+ ```
25
+
26
+ ## Key Differences from SolidJS
27
+
28
+ - **Same mental model.** Pyreon's reactivity is signal-based, just like Solid.
29
+ - **`createEffect` cleanup is not supported.** Pyreon's `effect()` does not use return values as cleanup functions.
30
+ - **`lazy` throws promises for Suspense.** Works with `<Suspense>` boundaries.
31
+
32
+ ## API
33
+
34
+ ### Primitives
35
+
36
+ - **`createSignal(initial)`** -- returns `[getter, setter]`.
37
+ - **`createEffect(fn)`** -- reactive side effect.
38
+ - **`createRenderEffect(fn)`** -- alias for `createEffect`.
39
+ - **`createComputed(fn)`** -- alias for `createEffect`.
40
+ - **`createMemo(fn)`** -- returns a computed getter.
41
+ - **`createRoot(fn)`** -- run in a new reactive scope with `dispose`.
42
+ - **`on(deps, fn)`** -- explicit dependency tracking.
43
+
44
+ ### Utilities
45
+
46
+ - **`batch(fn)`** -- coalesce multiple signal writes.
47
+ - **`untrack(fn)`** -- read signals without tracking.
48
+ - **`mergeProps(...sources)`** -- merge multiple props objects (supports symbol keys).
49
+ - **`splitProps(props, ...keys)`** -- split props into groups (supports symbol keys).
50
+ - **`children(fn)`** -- resolve reactive children.
51
+
52
+ ### Lifecycle
53
+
54
+ - **`onMount(fn)`** -- run after component mounts.
55
+ - **`onCleanup(fn)`** -- run on component unmount.
56
+
57
+ ### Context
58
+
59
+ - **`createContext(defaultValue)`** -- create a context.
60
+ - **`useContext(ctx)`** -- read a context value.
61
+
62
+ ### Ownership
63
+
64
+ - **`getOwner()`** -- get the current reactive scope.
65
+ - **`runWithOwner(owner, fn)`** -- run in a specific scope.
66
+
67
+ ### Reactivity
68
+
69
+ - **`createSelector(source)`** -- O(1) equality selector.
70
+
71
+ ### Components
72
+
73
+ - **`lazy(loader)`** -- dynamic import wrapper, throws promises for `<Suspense>`.
74
+ - **`Show`**, **`Switch`**, **`Match`**, **`For`** -- control flow components.
75
+ - **`Suspense`**, **`ErrorBoundary`** -- boundary components.