23 Commits

Author SHA1 Message Date
32b2e20c54 feat: add Value.Diff granular prop payloads for commitUpdate
Value.Diff produces property-level diff payloads instead of relying
solely on prepareUpdate. Function-valued props are stripped before
diffing; ValueDiffError is caught and falls back to prepareUpdate.
Value.Equal and Value.Clone now safely handle function-valued props
with try-catch fallbacks.
2026-05-18 17:44:27 +00:00
27c1f2671b Merge feat/value-hash-detection: add Value.Hash O(1) change detection with commitHashes (clean merge, no Value.Diff overlap) 2026-05-18 17:40:17 +00:00
6d704f59e0 feat: add Value.Hash O(1) change detection before Value.Equal in reconciler
Adds hash field to Fiber<I> for caching FNV-1a hash after each commit.
Hash comparison runs before Value.Equal in reconcileProps for fast bail-out
on unchanged subtrees. Hashes computed during commit phase only (outside
reactive computations) via commitHashes after commitEffects.
2026-05-18 17:38:27 +00:00
84498f6b58 Merge branch 'feat/unmount-implementation' 2026-05-18 17:31:43 +00:00
47e0e490a2 feat: implement full Root.unmount() with disposeFiber and instance cleanup 2026-05-18 17:31:31 +00:00
86642b1fb3 Merge branch 'feat/host-finalize-instance' 2026-05-18 17:31:05 +00:00
9af99d5d06 Integrate finalizeInstance into commit/remove pipeline via disposeFiber 2026-05-18 17:30:53 +00:00
3f6ae8691e Use Value.Clone for deep prevProps snapshots before mutation 2026-05-18 17:29:56 +00:00
4fb70c3f0a Merge feat/value-equal-bailout: add Value.Equal bail-out + cachedNode on Fiber (resolved conflicts with fiber-disposal's disposed field) 2026-05-18 17:26:42 +00:00
23db3775ad feat: add Value.Equal bail-out check before reconciliation
Add TypeBox Value.Equal deep-comparison as first optimization layer
in reconcileProps. When a fiber's cached node is deep-equal to the
next node, skip prepareUpdate, commitUpdate, and children
reconciliation entirely. New cachedNode field on Fiber stores the
last reconciled node for comparison.
2026-05-18 17:25:02 +00:00
f14916c1bb Implement ReactiveRoot.dispose() and real dispose on ReactiveNode
Adds ReactiveRoot.dispose() which calls render effect disposer, iterates
all tracked subscriber disposers, and clears internal state. subscribe()
now tracks effect disposers in a Set and returns idempotent unsubscribe.
render() now disposes previous render effect before overwriting. Both
reactiveComponent and reactiveElement return real dispose functions that
sever the computed signal reference on disposal.
2026-05-18 17:23:51 +00:00
95995f4602 Implement disposeFiber for fiber tree disposal
Add disposeFiber() function that performs bottom-up teardown of fiber
subtrees: recursively disposes children before parents, calls
host.finalizeInstance for per-instance cleanup, invokes signal disposers,
and clears fiber state. Idempotent via disposed flag. Does NOT call
host.removeChild (that's the commit phase's job).

- Add disposeFiber + HostLike to src/host/fiber.ts
- Add finalizeInstance to HostConfig interface
- Add disposed boolean to Fiber interface
- Export disposeFiber and HostLike from barrel
- Add 7 tests for disposeFiber (3-level tree, idempotency, signal cleanup, etc.)
2026-05-18 17:22:05 +00:00
1e0abb0900 Implement commitMutations for insert/move/remove effects in tree order
Adds commitMutations function to reconcile.ts that processes fiber effects
in correct order: removes (reverse), inserts+moves (left-to-right with
insertBefore), updates (top-down). Integrates key-based reconciliation
pipeline into render() via reconcileNode, resolveUNode, and
createFiberForInsert.
2026-05-18 17:17:28 +00:00
9e5b901efc feat: add LIS-based move detection for keyed children reconciliation 2026-05-18 16:59:57 +00:00
63b5fcba67 Add key-based child matching algorithm (reconcileChildren) for fiber reconciliation 2026-05-18 16:56:19 +00:00
021be4644b Merge feat/signal-driven-updates with conflict resolution (reconcile.ts extracted, render re-renderable preserved) 2026-05-18 16:50:59 +00:00
24d0134ae4 Wire signal-driven updates: scheduleUpdate, flushUpdates, reconcileProps, commitEffects, wireSignalToFiber, re-renderable render() 2026-05-18 16:50:08 +00:00
8faa9fc4aa Make Root.render() re-renderable with positional props reconciliation
First render still does a full mount and builds fiber tree. Subsequent
renders reconcile the new UNode tree against existing fibers: compare
props via prepareUpdate, apply changes via commitUpdate. Excess old
children remain (structural changes deferred to Phase 2). Function
components remain transparent during reconciliation.
2026-05-18 16:49:22 +00:00
87ec672641 Refactor mountNode to build fiber tree alongside host instances 2026-05-18 16:46:15 +00:00
d472b9f107 Define Fiber<I> and Effect<I> types in src/host/fiber.ts 2026-05-18 16:43:21 +00:00
614ee05364 Extract key from props in h() for UElement, keep key in props for URoot 2026-05-18 16:41:35 +00:00
822ded6cf1 Add key field to UElement (ADR-004) 2026-05-18 16:39:14 +00:00
3eb1f1d896 port ujsx from Deno-only to cross-platform (Node/Bun/Deno)
Add npm project configuration (package.json, tsconfig.json, tsup, vitest)
matching the taskgraph_ts conventions. All source imports changed from .ts
to .js extensions for Node16 module resolution. Tests migrated from Deno.test
to vitest. Fixed strict type errors (noUncheckedIndexedAccess). Preserved
deno.json with sloppy-imports for dual Deno/Node compatibility.

Subpath exports: schema, h, reactive, context, events, pointer, host,
transform, jsx-runtime — plus barrel export at root.

Build: ESM + CJS dual output via tsup. 22 tests passing.
2026-05-03 08:19:49 +00:00