@pyreon/runtime-dom 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 +21 -0
- package/README.md +65 -0
- package/lib/analysis/index.js.html +5406 -0
- package/lib/index.js +1909 -0
- package/lib/index.js.map +1 -0
- package/lib/types/index.d.ts +1845 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index2.d.ts +355 -0
- package/lib/types/index2.d.ts.map +1 -0
- package/package.json +48 -0
- package/src/devtools.ts +304 -0
- package/src/hydrate.ts +385 -0
- package/src/hydration-debug.ts +39 -0
- package/src/index.ts +43 -0
- package/src/keep-alive.ts +71 -0
- package/src/mount.ts +367 -0
- package/src/nodes.ts +741 -0
- package/src/props.ts +328 -0
- package/src/template.ts +81 -0
- package/src/tests/coverage-gaps.test.ts +2488 -0
- package/src/tests/coverage.test.ts +1123 -0
- package/src/tests/mount.test.ts +3098 -0
- package/src/tests/setup.ts +3 -0
- package/src/transition-group.ts +264 -0
- package/src/transition.ts +184 -0
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,65 @@
|
|
|
1
|
+
# @pyreon/runtime-dom
|
|
2
|
+
|
|
3
|
+
DOM renderer for Pyreon. Performs surgical signal-to-DOM updates with no virtual DOM diffing.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @pyreon/runtime-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { mount } from "@pyreon/runtime-dom"
|
|
15
|
+
import { h } from "@pyreon/core"
|
|
16
|
+
import { signal } from "@pyreon/reactivity"
|
|
17
|
+
|
|
18
|
+
const count = signal(0)
|
|
19
|
+
|
|
20
|
+
const App = () =>
|
|
21
|
+
h("button", { onClick: () => count.update((n) => n + 1) }, () => `Clicks: ${count()}`)
|
|
22
|
+
|
|
23
|
+
const unmount = mount(h(App, null), document.getElementById("app")!)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
### Mounting
|
|
29
|
+
|
|
30
|
+
- **`mount(root, container): () => void`** -- Clears the container and mounts the VNode tree. Returns an `unmount` function.
|
|
31
|
+
- **`render`** -- Alias for `mount`.
|
|
32
|
+
- **`mountChild(child, parent, anchor)`** -- Low-level mount of a single child node.
|
|
33
|
+
|
|
34
|
+
### Hydration
|
|
35
|
+
|
|
36
|
+
- **`hydrateRoot(root, container)`** -- Hydrates server-rendered HTML with client-side reactivity.
|
|
37
|
+
- **`enableHydrationWarnings()` / `disableHydrationWarnings()`** -- Toggle console warnings for hydration mismatches.
|
|
38
|
+
|
|
39
|
+
### Props and Sanitization
|
|
40
|
+
|
|
41
|
+
- **`applyProp(el, key, value)`** -- Applies a single prop to a DOM element.
|
|
42
|
+
- **`applyProps(el, props)`** -- Applies all props to a DOM element.
|
|
43
|
+
- **`sanitizeHtml(html): string`** -- Sanitizes an HTML string using the active sanitizer.
|
|
44
|
+
- **`setSanitizer(fn: SanitizeFn)`** -- Replaces the default HTML sanitizer.
|
|
45
|
+
|
|
46
|
+
### Templates
|
|
47
|
+
|
|
48
|
+
- **`createTemplate(html): () => Element`** -- Creates a reusable DOM template factory from an HTML string.
|
|
49
|
+
|
|
50
|
+
### Transitions
|
|
51
|
+
|
|
52
|
+
- **`Transition`** -- Animates a single child on enter/leave with CSS classes or JS hooks.
|
|
53
|
+
- **`TransitionGroup`** -- Animates a list of keyed children, including move transitions.
|
|
54
|
+
|
|
55
|
+
### KeepAlive
|
|
56
|
+
|
|
57
|
+
- **`KeepAlive`** -- Caches inactive component subtrees instead of destroying them.
|
|
58
|
+
|
|
59
|
+
### Types
|
|
60
|
+
|
|
61
|
+
`TransitionProps`, `TransitionGroupProps`, `KeepAliveProps`, `Directive`, `SanitizeFn`, `DevtoolsComponentEntry`, `PyreonDevtools`
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|