Commit d397919
committed
Add reactive when and bind features with automatic dependency tracking
Signal-based reactivity system for _hyperscript:
- `when <expr> changes` re-runs commands when tracked dependencies change
- `bind <target> to <expr>` for one-way derived bindings
- `bind <target> and <target>` for two-way sync
- Automatic tracking of $global, :element variables, @attributes, and .properties
- MutationObserver for attribute changes, defineProperty interception for properties
- Microtask batching, same-value dedup (Object.is), circular dependency guard
- Auto-dispose effects when owning element is removed from DOM
Includes Playwright tests for when (22 tests), bind (8 tests), and
desired-behavior tests (13 tests, currently failing) documenting known
footguns and areas for improvement.1 parent 01fd042 commit d397919
14 files changed
Lines changed: 1805 additions & 15 deletions
File tree
- src
- core/runtime
- parsetree
- expressions
- features
- test/features
- www
- features
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | | - | |
| 119 | + | |
115 | 120 | | |
116 | 121 | | |
117 | 122 | | |
| |||
0 commit comments