jq79 0.8.0 → 0.8.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/dist/jq79.cjs +6 -6
- package/dist/jq79.cjs.map +1 -1
- package/dist/jq79.global.js +6 -6
- package/dist/jq79.global.js.map +1 -1
- package/dist/jq79.js +6 -6
- package/dist/jq79.js.map +1 -1
- package/package.json +1 -1
- package/src/jq79.ts +9 -1
- package/src/reactive.ts +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jq79",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Mini reactive component library: single-file .html components, Svelte-style setup scripts, fine-grained proxy reactivity. No compiler, no bundler, no dependencies — works from any static host.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
package/src/jq79.ts
CHANGED
|
@@ -2000,9 +2000,17 @@ const planOf = (node: TemplateNode): SkeletonPlan | null => {
|
|
|
2000
2000
|
return plan
|
|
2001
2001
|
}
|
|
2002
2002
|
|
|
2003
|
+
// siblings rather than `childNodes[i]`: the first `childNodes` read on a node
|
|
2004
|
+
// allocates a live NodeList for it, and every node of a fresh clone is a first
|
|
2005
|
+
// read. buildSkeleton appends a DOM child per TemplateNode child, text
|
|
2006
|
+
// included, so a sibling count is the same index.
|
|
2007
|
+
// RECORD/2026-11-18.two-small-create-costs.md
|
|
2003
2008
|
const atPath = (root: Node, path: number[]): Node => {
|
|
2004
2009
|
let at = root
|
|
2005
|
-
for (let i = 0; i < path.length; i++)
|
|
2010
|
+
for (let i = 0; i < path.length; i++) {
|
|
2011
|
+
at = at.firstChild!
|
|
2012
|
+
for (let k = path[i]; k > 0; k--) at = at.nextSibling!
|
|
2013
|
+
}
|
|
2006
2014
|
return at
|
|
2007
2015
|
}
|
|
2008
2016
|
|
package/src/reactive.ts
CHANGED
|
@@ -433,8 +433,13 @@ export const $reactive = <T extends Record<string, any>>(data: T): ReactiveDeepD
|
|
|
433
433
|
// hands back the node it registered on, which is what lets a removal skip the
|
|
434
434
|
// path entirely (see indexEffect)
|
|
435
435
|
const insertDep = (dep: string, effect: Effect): TrieNode => {
|
|
436
|
+
// the dots walked in place rather than split: this runs per binding
|
|
437
|
+
// created, and the array and closure split().forEach built were thrown
|
|
438
|
+
// away at once. RECORD/2026-11-18.two-small-create-costs.md
|
|
436
439
|
let node = depTrie
|
|
437
|
-
|
|
440
|
+
for (let from = 0; ;) {
|
|
441
|
+
const dot = dep.indexOf(".", from)
|
|
442
|
+
const segment = dot === -1 ? dep.slice(from) : dep.slice(from, dot)
|
|
438
443
|
const children = (node.children ??= new Map())
|
|
439
444
|
let child = children.get(segment)
|
|
440
445
|
if (!child) {
|
|
@@ -442,7 +447,9 @@ export const $reactive = <T extends Record<string, any>>(data: T): ReactiveDeepD
|
|
|
442
447
|
children.set(segment, child)
|
|
443
448
|
}
|
|
444
449
|
node = child
|
|
445
|
-
|
|
450
|
+
if (dot === -1) break
|
|
451
|
+
from = dot + 1
|
|
452
|
+
}
|
|
446
453
|
if (effect.deep) addDeep(node, effect)
|
|
447
454
|
else addOwn(node, effect)
|
|
448
455
|
return node
|