@kudzujs/core 0.17.0 → 0.17.1
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 +1 -1
- package/framework/binding-runtime.js +4 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Kudzu compiles ordinary React-shaped TypeScript and TSX into complete static HTM
|
|
|
14
14
|
|
|
15
15
|
> Experimental `0.17.x`: the compiler API and supported TSX surface may change.
|
|
16
16
|
|
|
17
|
-
**Current release: [0.17.
|
|
17
|
+
**Current release: [0.17.1](https://github.com/kudzujs/kudzu/releases/tag/v0.17.1).** Binding lifetime tracking uses one WeakMap instead of duplicate WeakMap/WeakSet membership, preserving state release and explicit DOM remount behavior. C2 saves 52 raw JavaScript bytes (7 gzip); the project application deploy saves 114 raw bytes. Generator `create-kudzu@0.1.162` targets core `^0.17.1`. This is a size and simplification improvement, not a demonstrated speed gain. Restoration latency and AI-cost/1.0 gates remain unresolved.
|
|
18
18
|
|
|
19
19
|
- [Documentation](https://kudzujs.cloud/docs)
|
|
20
20
|
- [Installation guide](https://kudzujs.cloud/docs#install)
|
|
@@ -5,7 +5,6 @@ import { serializeStyle } from "./style.js"
|
|
|
5
5
|
const imports = new Map()
|
|
6
6
|
const bindingTargets = new Map()
|
|
7
7
|
const conditionTargets = globalThis.__KUDZU_CONDITIONS__ && new Map()
|
|
8
|
-
const mountedBindings = new WeakSet()
|
|
9
8
|
const mountedConditions = globalThis.__KUDZU_CONDITIONS__ && new WeakSet()
|
|
10
9
|
const bindingRegistrations = new WeakMap()
|
|
11
10
|
const conditionRegistrations = globalThis.__KUDZU_CONDITIONS__ && new WeakMap()
|
|
@@ -67,8 +66,7 @@ if (typeof document !== "undefined") mountDom(document)
|
|
|
67
66
|
|
|
68
67
|
function mountBindings(root) {
|
|
69
68
|
if (globalThis.__KUDZU_ELEMENT_BINDINGS__ !== false) for (const node of matching(root, bindingSelector)) {
|
|
70
|
-
if (
|
|
71
|
-
mountedBindings.add(node)
|
|
69
|
+
if (bindingRegistrations.has(node)) continue
|
|
72
70
|
const registrations = []
|
|
73
71
|
bindingRegistrations.set(node, registrations)
|
|
74
72
|
const descriptors = []
|
|
@@ -98,10 +96,9 @@ function mountBindings(root) {
|
|
|
98
96
|
}
|
|
99
97
|
if (globalThis.__KUDZU_TEXT_BINDINGS__) {
|
|
100
98
|
for (const node of textBindingStarts(root)) {
|
|
101
|
-
if (
|
|
99
|
+
if (bindingRegistrations.has(node)) continue
|
|
102
100
|
const descriptor = textDescriptors[Number(node.data.slice("k-text:".length))]
|
|
103
101
|
if (!descriptor) continue
|
|
104
|
-
mountedBindings.add(node)
|
|
105
102
|
const registrations = []
|
|
106
103
|
bindingRegistrations.set(node, registrations)
|
|
107
104
|
if (descriptor.state) {
|
|
@@ -182,13 +179,11 @@ function unmountBindings(root) {
|
|
|
182
179
|
if (globalThis.__KUDZU_ELEMENT_BINDINGS__ !== false) for (const node of matching(root, bindingSelector)) {
|
|
183
180
|
for (const [id, binding] of bindingRegistrations.get(node) ?? []) bindingTargets.get(id)?.delete(binding)
|
|
184
181
|
bindingRegistrations.delete(node)
|
|
185
|
-
mountedBindings.delete(node)
|
|
186
182
|
}
|
|
187
183
|
if (globalThis.__KUDZU_TEXT_BINDINGS__) {
|
|
188
184
|
for (const node of textBindingStarts(root)) {
|
|
189
185
|
for (const [id, binding] of bindingRegistrations.get(node) ?? []) bindingTargets.get(id)?.delete(binding)
|
|
190
186
|
bindingRegistrations.delete(node)
|
|
191
|
-
mountedBindings.delete(node)
|
|
192
187
|
}
|
|
193
188
|
}
|
|
194
189
|
}
|
|
@@ -206,7 +201,8 @@ function unmountConditions(root) {
|
|
|
206
201
|
function releaseBindings(id) {
|
|
207
202
|
for (const binding of bindingTargets.get(id) ?? []) {
|
|
208
203
|
for (const [bindingId, entry] of bindingRegistrations.get(binding.node) ?? []) bindingTargets.get(bindingId)?.delete(entry)
|
|
209
|
-
|
|
204
|
+
// Keep mounted membership until unmount so released bindings cannot regain authority.
|
|
205
|
+
bindingRegistrations.set(binding.node, undefined)
|
|
210
206
|
}
|
|
211
207
|
bindingTargets.delete(id)
|
|
212
208
|
if (!globalThis.__KUDZU_CONDITIONS__) return
|