fibrae 0.2.3 → 0.3.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.
Files changed (120) hide show
  1. package/dist/cli/build.d.ts +34 -0
  2. package/dist/cli/build.js +92 -0
  3. package/dist/cli/build.js.map +1 -0
  4. package/dist/cli/cli.d.ts +10 -0
  5. package/dist/cli/cli.js +43 -0
  6. package/dist/cli/cli.js.map +1 -0
  7. package/dist/cli/config.d.ts +19 -0
  8. package/dist/cli/config.js +5 -0
  9. package/dist/cli/config.js.map +1 -0
  10. package/dist/cli/html.d.ts +13 -0
  11. package/dist/cli/html.js +101 -0
  12. package/dist/cli/html.js.map +1 -0
  13. package/dist/cli/index.d.ts +6 -0
  14. package/dist/cli/index.js +4 -0
  15. package/dist/cli/index.js.map +1 -0
  16. package/dist/cli/vite-plugin.d.ts +9 -0
  17. package/dist/cli/vite-plugin.js +143 -0
  18. package/dist/cli/vite-plugin.js.map +1 -0
  19. package/dist/components.d.ts +27 -29
  20. package/dist/components.js +32 -52
  21. package/dist/components.js.map +1 -1
  22. package/dist/core.js +7 -10
  23. package/dist/core.js.map +1 -1
  24. package/dist/dom.d.ts +13 -4
  25. package/dist/dom.js +91 -26
  26. package/dist/dom.js.map +1 -1
  27. package/dist/fiber-boundary.d.ts +39 -0
  28. package/dist/fiber-boundary.js +151 -0
  29. package/dist/fiber-boundary.js.map +1 -0
  30. package/dist/fiber-commit.d.ts +27 -0
  31. package/dist/fiber-commit.js +243 -0
  32. package/dist/fiber-commit.js.map +1 -0
  33. package/dist/fiber-render.d.ts +9 -9
  34. package/dist/fiber-render.js +165 -958
  35. package/dist/fiber-render.js.map +1 -1
  36. package/dist/fiber-tree.d.ts +77 -0
  37. package/dist/fiber-tree.js +152 -0
  38. package/dist/fiber-tree.js.map +1 -0
  39. package/dist/fiber-update.d.ts +46 -0
  40. package/dist/fiber-update.js +515 -0
  41. package/dist/fiber-update.js.map +1 -0
  42. package/dist/h.js.map +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/jsx-runtime/index.d.ts +253 -2
  47. package/dist/live/atom.d.ts +31 -0
  48. package/dist/live/atom.js +33 -0
  49. package/dist/live/atom.js.map +1 -0
  50. package/dist/live/client.d.ts +50 -0
  51. package/dist/live/client.js +90 -0
  52. package/dist/live/client.js.map +1 -0
  53. package/dist/live/codec.d.ts +39 -0
  54. package/dist/live/codec.js +41 -0
  55. package/dist/live/codec.js.map +1 -0
  56. package/dist/live/config.d.ts +13 -0
  57. package/dist/live/config.js +11 -0
  58. package/dist/live/config.js.map +1 -0
  59. package/dist/live/index.d.ts +25 -0
  60. package/dist/live/index.js +19 -0
  61. package/dist/live/index.js.map +1 -0
  62. package/dist/live/server.d.ts +83 -0
  63. package/dist/live/server.js +106 -0
  64. package/dist/live/server.js.map +1 -0
  65. package/dist/live/sse-stream.d.ts +14 -0
  66. package/dist/live/sse-stream.js +30 -0
  67. package/dist/live/sse-stream.js.map +1 -0
  68. package/dist/live/types.d.ts +40 -0
  69. package/dist/live/types.js +20 -0
  70. package/dist/live/types.js.map +1 -0
  71. package/dist/router/History.d.ts +2 -7
  72. package/dist/router/History.js +0 -8
  73. package/dist/router/History.js.map +1 -1
  74. package/dist/router/Link.d.ts +8 -4
  75. package/dist/router/Link.js +13 -34
  76. package/dist/router/Link.js.map +1 -1
  77. package/dist/router/Navigator.d.ts +12 -1
  78. package/dist/router/Navigator.js +31 -68
  79. package/dist/router/Navigator.js.map +1 -1
  80. package/dist/router/Route.d.ts +16 -3
  81. package/dist/router/Route.js +32 -25
  82. package/dist/router/Route.js.map +1 -1
  83. package/dist/router/Router.d.ts +27 -19
  84. package/dist/router/Router.js +78 -101
  85. package/dist/router/Router.js.map +1 -1
  86. package/dist/router/RouterBuilder.d.ts +106 -34
  87. package/dist/router/RouterBuilder.js +78 -39
  88. package/dist/router/RouterBuilder.js.map +1 -1
  89. package/dist/router/RouterOutlet.d.ts +1 -18
  90. package/dist/router/RouterOutlet.js +25 -8
  91. package/dist/router/RouterOutlet.js.map +1 -1
  92. package/dist/router/RouterState.d.ts +1 -1
  93. package/dist/router/index.d.ts +5 -5
  94. package/dist/router/index.js +5 -3
  95. package/dist/router/index.js.map +1 -1
  96. package/dist/router/utils.d.ts +36 -0
  97. package/dist/router/utils.js +48 -0
  98. package/dist/router/utils.js.map +1 -0
  99. package/dist/runtime.d.ts +10 -7
  100. package/dist/runtime.js +20 -2
  101. package/dist/runtime.js.map +1 -1
  102. package/dist/server.d.ts +2 -2
  103. package/dist/server.js +15 -29
  104. package/dist/server.js.map +1 -1
  105. package/dist/shared.d.ts +58 -59
  106. package/dist/shared.js +51 -13
  107. package/dist/shared.js.map +1 -1
  108. package/dist/tracking.d.ts +4 -3
  109. package/dist/tracking.js +6 -1
  110. package/dist/tracking.js.map +1 -1
  111. package/package.json +32 -7
  112. package/dist/hydration.d.ts +0 -30
  113. package/dist/hydration.js +0 -355
  114. package/dist/hydration.js.map +0 -1
  115. package/dist/render.d.ts +0 -19
  116. package/dist/render.js +0 -285
  117. package/dist/render.js.map +0 -1
  118. package/dist/scope-utils.d.ts +0 -14
  119. package/dist/scope-utils.js +0 -29
  120. package/dist/scope-utils.js.map +0 -1
@@ -0,0 +1,515 @@
1
+ /**
2
+ * Fiber update and reconciliation functions.
3
+ *
4
+ * Contains the core update logic for function components and host components,
5
+ * the work-loop's performUnitOfWork dispatcher, fiber scope management
6
+ * (resubscribeFiber), atom/live-atom subscription wiring, and key-based
7
+ * child reconciliation. Extracted from fiber-render.ts.
8
+ */
9
+ import * as Effect from "effect/Effect";
10
+ import * as Stream from "effect/Stream";
11
+ import * as Scope from "effect/Scope";
12
+ import * as Ref from "effect/Ref";
13
+ import * as Exit from "effect/Exit";
14
+ import * as Option from "effect/Option";
15
+ import * as Deferred from "effect/Deferred";
16
+ import * as Context from "effect/Context";
17
+ import * as FiberRef from "effect/FiberRef";
18
+ import * as Cause from "effect/Cause";
19
+ import * as Schema from "effect/Schema";
20
+ import * as RcMap from "effect/RcMap";
21
+ import { Atom, Registry as AtomRegistry, Result } from "@effect-atom/atom";
22
+ import { ComponentScope, StreamError, isStream, } from "./shared.js";
23
+ import { FibraeRuntime } from "./runtime.js";
24
+ import { normalizeToStream, makeTrackingRegistry } from "./tracking.js";
25
+ import {} from "./live/atom.js";
26
+ import { LiveConfig } from "./live/config.js";
27
+ import { createFiber, fiberTypeIs, fiberTypeIsFunction, fiberIsVirtualElement, getComponentScopeOrDie, getComponentScopeService, linkFibersAsSiblings, findNextSibling, getSuspenseThreshold, queueFiberForRerender, } from "./fiber-tree.js";
28
+ import { handleFiberError, handleFiberSuspension, signalFiberReady, signalBoundaryRecovery, } from "./fiber-boundary.js";
29
+ import { createDom } from "./fiber-commit.js";
30
+ // =============================================================================
31
+ // Stream Subscription Helper
32
+ // =============================================================================
33
+ /**
34
+ * Subscribe to a component's output stream, handling first value and subsequent emissions.
35
+ *
36
+ * Returns a deferred that will be completed with the first emitted value.
37
+ * Subsequent emissions update latestStreamValue and queue re-renders.
38
+ * Errors are forwarded to handleFiberError.
39
+ *
40
+ * @param stream - The component's output stream
41
+ * @param fiberRef - Mutable reference to the current fiber (for re-renders after reconciliation)
42
+ * @param scope - Scope to fork the subscription into
43
+ *
44
+ * @typeParam E - Error type for the deferred (use `never` for die mode, stream error type for fail mode)
45
+ */
46
+ export const subscribeComponentStream = (stream, fiberRef, scope) => Effect.gen(function* () {
47
+ const firstValueDeferred = yield* Deferred.make();
48
+ const subscription = Stream.runForEach(stream, (vElement) => Effect.gen(function* () {
49
+ const done = yield* Deferred.isDone(firstValueDeferred);
50
+ const currentFiber = fiberRef.current;
51
+ if (!done) {
52
+ yield* Deferred.succeed(firstValueDeferred, vElement);
53
+ }
54
+ else {
55
+ // Subsequent emissions - queue re-render
56
+ currentFiber.latestStreamValue = Option.some(vElement);
57
+ if (currentFiber.isParked) {
58
+ // Parked under an error boundary — signal recovery
59
+ yield* signalBoundaryRecovery(currentFiber);
60
+ }
61
+ else {
62
+ yield* queueFiberForRerender(currentFiber);
63
+ }
64
+ }
65
+ })).pipe(Effect.catchAllCause((cause) => Effect.gen(function* () {
66
+ const done = yield* Deferred.isDone(firstValueDeferred);
67
+ const streamError = new StreamError({
68
+ cause: Cause.squash(cause),
69
+ phase: done ? "after-first-emission" : "before-first-emission",
70
+ });
71
+ if (!done) {
72
+ // Fail the deferred with StreamError so awaiting code gets the typed error
73
+ yield* Deferred.fail(firstValueDeferred, streamError);
74
+ }
75
+ const currentFiber = fiberRef.current;
76
+ yield* handleFiberError(currentFiber, streamError);
77
+ })));
78
+ yield* Effect.forkIn(subscription, scope);
79
+ return firstValueDeferred;
80
+ });
81
+ // =============================================================================
82
+ // Update Function Component
83
+ // =============================================================================
84
+ export const updateFunctionComponent = (fiber, runtime) => Effect.gen(function* () {
85
+ // Initialize deferred for child first commit signaling
86
+ if (Option.isNone(fiber.childFirstCommitDeferred)) {
87
+ fiber.childFirstCommitDeferred = Option.some(yield* Deferred.make());
88
+ }
89
+ // Capture current context during render phase for event handlers in commit phase
90
+ // This includes services like Navigator, RouterHandlers, etc.
91
+ const currentContext = yield* FiberRef.get(FiberRef.currentContext);
92
+ fiber.renderContext = Option.some(currentContext);
93
+ // Check if we can reuse cached stream value from alternate
94
+ const hasAlternate = Option.isSome(fiber.alternate);
95
+ const hasCachedValue = fiber.alternate.pipe(Option.map((alt) => Option.isSome(alt.latestStreamValue) && alt.isMultiEmissionStream), Option.getOrElse(() => false));
96
+ if (hasAlternate && hasCachedValue) {
97
+ // Reuse cached value from alternate (stream component that emitted multiple values)
98
+ const alt = Option.getOrThrow(fiber.alternate);
99
+ const vElement = Option.getOrThrow(alt.latestStreamValue);
100
+ fiber.latestStreamValue = alt.latestStreamValue;
101
+ fiber.accessedAtoms = alt.accessedAtoms;
102
+ fiber.componentScope = alt.componentScope;
103
+ alt.componentScope = Option.none(); // Transfer ownership
104
+ fiber.fiberRef = alt.fiberRef;
105
+ fiber.fiberRef.pipe(Option.map((ref) => {
106
+ ref.current = fiber;
107
+ }));
108
+ fiber.isMultiEmissionStream = alt.isMultiEmissionStream;
109
+ yield* reconcileChildren(fiber, [vElement]);
110
+ return;
111
+ }
112
+ // Check if this fiber is being restored from parked (suspended) state
113
+ // If so, skip re-execution and use the cached latestStreamValue
114
+ if (fiber.isUnparking && Option.isSome(fiber.latestStreamValue)) {
115
+ fiber.isUnparking = false; // Clear flag
116
+ const vElement = Option.getOrThrow(fiber.latestStreamValue);
117
+ yield* reconcileChildren(fiber, [vElement]);
118
+ return;
119
+ }
120
+ // Create scope for this component FIRST so it's available in context
121
+ yield* resubscribeFiber(fiber);
122
+ const componentScopeService = yield* getComponentScopeService(fiber, "Expected componentScope to be created by resubscribeFiber");
123
+ // Set up atom tracking
124
+ const accessedAtoms = new Set();
125
+ const accessedLiveAtoms = new Set();
126
+ const trackingRegistry = makeTrackingRegistry(runtime.registry, accessedAtoms, accessedLiveAtoms);
127
+ fiber.accessedAtoms = Option.some(accessedAtoms);
128
+ // Build context with tracking registry AND ComponentScope
129
+ // This allows Effect components to yield* ComponentScope for cleanup registration
130
+ const contextWithTracking = Context.add(Context.add(currentContext, ComponentScope, componentScopeService), AtomRegistry.AtomRegistry, trackingRegistry);
131
+ // Invoke the component
132
+ const output = yield* Option.match(fiber.type, {
133
+ onNone: () => Effect.die("updateFunctionComponent called with no type"),
134
+ onSome: (type) => {
135
+ if (typeof type !== "function") {
136
+ return Effect.die("updateFunctionComponent called with non-function type");
137
+ }
138
+ const component = type;
139
+ return Effect.sync(() => component(fiber.props));
140
+ },
141
+ });
142
+ // Fast path: if component returns a plain VElement (not Effect/Stream),
143
+ // and it's a special element type, just reconcile directly without stream machinery.
144
+ // This handles wrapper components like Suspense and ErrorBoundary efficiently.
145
+ if (!Effect.isEffect(output) && !isStream(output)) {
146
+ const vElement = output;
147
+ if (typeof vElement === "object" && vElement !== null && "type" in vElement) {
148
+ const elementType = vElement.type;
149
+ if (elementType === "SUSPENSE" || elementType === "FRAGMENT") {
150
+ // Simple wrapper component - just reconcile with the VElement directly
151
+ yield* reconcileChildren(fiber, [vElement]);
152
+ return;
153
+ }
154
+ }
155
+ }
156
+ // Check if it's a multi-emission stream
157
+ fiber.isMultiEmissionStream = isStream(output);
158
+ // Normalize to stream and provide context
159
+ const stream = normalizeToStream(output).pipe(Stream.provideContext(contextWithTracking));
160
+ // Set up fiber ref for stream subscriptions
161
+ const fiberRef = fiber.fiberRef.pipe(Option.getOrElse(() => ({ current: fiber })));
162
+ fiber.fiberRef = Option.some(fiberRef);
163
+ // Subscribe to component stream - errors become defects via "die" mode
164
+ const firstValueDeferred = yield* subscribeComponentStream(stream, fiberRef, componentScopeService.scope);
165
+ // Get threshold from nearest Suspense boundary
166
+ const threshold = getSuspenseThreshold(fiber);
167
+ if (threshold > 0) {
168
+ // Race first value vs threshold
169
+ const result = yield* Effect.race(Deferred.await(firstValueDeferred).pipe(Effect.map((v) => ({ _tag: "value", value: v }))), Effect.sleep(`${threshold} millis`).pipe(Effect.map(() => ({ _tag: "timeout" }))));
170
+ if (result._tag === "timeout") {
171
+ // Threshold expired - signal suspension to boundary
172
+ yield* handleFiberSuspension(fiber);
173
+ // Fork background work: wait for value, then signal ready
174
+ // This allows the render loop to continue and show fallback
175
+ yield* Effect.forkIn(Effect.gen(function* () {
176
+ const value = yield* Deferred.await(firstValueDeferred);
177
+ const currentFiber = fiberRef.current;
178
+ currentFiber.latestStreamValue = Option.some(value);
179
+ yield* signalFiberReady(currentFiber);
180
+ }), componentScopeService.scope);
181
+ // Return early - don't reconcile children yet
182
+ // The Suspense boundary will show fallback via queued re-render
183
+ return;
184
+ }
185
+ else {
186
+ // Value arrived before threshold - no suspension
187
+ fiber.latestStreamValue = Option.some(result.value);
188
+ yield* reconcileChildren(fiber, [result.value]);
189
+ }
190
+ }
191
+ else {
192
+ // No threshold (0) - wait indefinitely, no suspension possible
193
+ const firstVElement = yield* Deferred.await(firstValueDeferred);
194
+ fiber.latestStreamValue = Option.some(firstVElement);
195
+ yield* reconcileChildren(fiber, [firstVElement]);
196
+ }
197
+ // Subscribe to atom changes
198
+ yield* subscribeFiberAtoms(fiber, accessedAtoms, runtime);
199
+ // Activate SSE connections for any live atoms
200
+ if (accessedLiveAtoms.size > 0) {
201
+ yield* activateLiveAtoms(accessedLiveAtoms, currentContext, runtime, componentScopeService.scope);
202
+ }
203
+ });
204
+ // =============================================================================
205
+ // Perform Unit of Work
206
+ // =============================================================================
207
+ export const performUnitOfWork = (fiber, runtime) => Effect.gen(function* () {
208
+ const isFunctionComponent = fiberTypeIsFunction(fiber);
209
+ const eff = isFunctionComponent
210
+ ? updateFunctionComponent(fiber, runtime)
211
+ : updateHostComponent(fiber, runtime);
212
+ const exited = yield* Effect.exit(eff);
213
+ if (Exit.isFailure(exited)) {
214
+ // handleFiberError returns the next fiber to process (if recovery happened)
215
+ return yield* handleFiberError(fiber, exited.cause);
216
+ }
217
+ // Return next unit of work: child → sibling → uncle (walk up to find sibling)
218
+ return fiber.child.pipe(Option.orElse(() => findNextSibling(fiber)));
219
+ });
220
+ // =============================================================================
221
+ // Atom Subscription
222
+ // =============================================================================
223
+ export const resubscribeFiber = (fiber) => Effect.gen(function* () {
224
+ // Close old scope if exists
225
+ yield* Option.match(fiber.componentScope, {
226
+ onNone: () => Effect.void,
227
+ onSome: (scope) => Scope.close(scope, Exit.void),
228
+ });
229
+ // Create new scope and mounted deferred
230
+ const newScope = yield* Scope.make();
231
+ const newMounted = yield* Deferred.make();
232
+ fiber.componentScope = Option.some(newScope);
233
+ fiber.mountedDeferred = Option.some(newMounted);
234
+ });
235
+ export const subscribeFiberAtoms = (fiber, accessedAtoms, runtime) => Effect.gen(function* () {
236
+ const scope = yield* getComponentScopeOrDie(fiber, "subscribeFiberAtoms requires an existing componentScope");
237
+ // Use registry.subscribe directly — simpler and more efficient than
238
+ // toStream + drop(1) + runForEach. Cleanup via scope finalizers.
239
+ // unsafeOffer is synchronous, no need for runForkWithRuntime.
240
+ yield* Effect.forEach(accessedAtoms, (atom) => Effect.gen(function* () {
241
+ const unsubscribe = runtime.registry.subscribe(atom, () => {
242
+ runtime.renderMailbox.unsafeOffer(fiber);
243
+ });
244
+ yield* Scope.addFinalizer(scope, Effect.sync(unsubscribe));
245
+ }), { discard: true });
246
+ });
247
+ // =============================================================================
248
+ // Live Atom SSE Activation
249
+ // =============================================================================
250
+ /**
251
+ * Activate SSE connections for live atoms using the runtime's RcMap.
252
+ *
253
+ * EventSources are shared by URL via RcMap — ref-counted and automatically
254
+ * closed when the last consumer's scope closes. Each atom adds its own
255
+ * listener to the shared EventSource.
256
+ */
257
+ export const activateLiveAtoms = (liveAtoms, currentContext, runtime, scope) => {
258
+ // Skip on server
259
+ if (typeof window === "undefined")
260
+ return Effect.void;
261
+ // Try to get LiveConfig from context
262
+ const configOption = Context.getOption(currentContext, LiveConfig);
263
+ if (Option.isNone(configOption))
264
+ return Effect.void;
265
+ const config = configOption.value;
266
+ return Effect.gen(function* () {
267
+ // Ensure withCredentials is set before any RcMap lookups create EventSources
268
+ yield* Ref.set(runtime.sseWithCredentials, config.withCredentials ?? false);
269
+ yield* Effect.forEach(liveAtoms, (atom) => Effect.gen(function* () {
270
+ const url = LiveConfig.resolve(config, atom._live.event);
271
+ const decode = Schema.decodeUnknownSync(Schema.parseJson(atom._live.schema));
272
+ // Get shared EventSource for this URL (ref-counted via RcMap).
273
+ // Scope.extend binds the reference to the component scope —
274
+ // when the component unmounts, the ref count decrements.
275
+ const es = yield* RcMap.get(runtime.sseConnections, url).pipe(Scope.extend(scope));
276
+ const handler = (e) => {
277
+ try {
278
+ runtime.registry.set(atom, Result.success(decode(e.data)));
279
+ }
280
+ catch {
281
+ // Decode errors silently skipped
282
+ }
283
+ };
284
+ es.addEventListener(atom._live.event, handler);
285
+ // Clean up this atom's listener when the component unmounts
286
+ yield* Scope.addFinalizer(scope, Effect.sync(() => es.removeEventListener(atom._live.event, handler)));
287
+ }), { discard: true });
288
+ });
289
+ };
290
+ // =============================================================================
291
+ // Update Host Component
292
+ // =============================================================================
293
+ export const updateHostComponent = (fiber, runtime) => Effect.gen(function* () {
294
+ // Inherit renderContext from parent fiber (function components capture it during render)
295
+ // This propagates Navigator, RouterHandlers, etc. down to host elements for event handlers
296
+ if (Option.isNone(fiber.renderContext) && Option.isSome(fiber.parent)) {
297
+ fiber.renderContext = fiber.parent.value.renderContext;
298
+ }
299
+ // Handle BOUNDARY specially (Effect-native error boundary API)
300
+ const isBoundary = fiberTypeIs(fiber, "BOUNDARY");
301
+ if (isBoundary) {
302
+ const boundaryId = fiber.props.boundaryId;
303
+ const fallbackFn = fiber.props.fallback;
304
+ // Inherit boundary state from alternate (previous render) if present
305
+ // This preserves hasError state across re-renders
306
+ if (Option.isNone(fiber.boundary) && Option.isSome(fiber.alternate)) {
307
+ const alt = fiber.alternate.value;
308
+ if (Option.isSome(alt.boundary)) {
309
+ fiber.boundary = alt.boundary;
310
+ }
311
+ }
312
+ // Initialize boundary config if not already set
313
+ if (Option.isNone(fiber.boundary)) {
314
+ fiber.boundary = Option.some({
315
+ boundaryId,
316
+ fallback: fallbackFn,
317
+ hasError: false,
318
+ error: Option.none(),
319
+ parkedFiber: Option.none(),
320
+ currentFiber: Option.none(),
321
+ });
322
+ }
323
+ const cfg = Option.getOrThrow(fiber.boundary);
324
+ // Always update the current fiber reference (survives alternate swaps)
325
+ cfg.currentFiber = Option.some(fiber);
326
+ if (cfg.hasError && Option.isSome(cfg.error)) {
327
+ // Error state — render fallback, children are parked
328
+ const fallbackElement = cfg.fallback(cfg.error.value);
329
+ yield* reconcileChildren(fiber, [fallbackElement]);
330
+ }
331
+ else if (Option.isSome(cfg.parkedFiber)) {
332
+ // Recovering from error — close parked scopes and re-create children fresh.
333
+ // The parked tree served only to keep the stream subscription alive long enough
334
+ // to detect the next emission (route change). Now we rebuild from scratch.
335
+ const closeParkedTree = (f) => Effect.gen(function* () {
336
+ f.isParked = false;
337
+ if (Option.isSome(f.componentScope)) {
338
+ yield* Scope.close(f.componentScope.value, Exit.void);
339
+ }
340
+ if (Option.isSome(f.child))
341
+ yield* closeParkedTree(f.child.value);
342
+ if (Option.isSome(f.sibling))
343
+ yield* closeParkedTree(f.sibling.value);
344
+ });
345
+ yield* closeParkedTree(cfg.parkedFiber.value);
346
+ cfg.parkedFiber = Option.none();
347
+ // Re-create children from the original props
348
+ const children = fiber.props.children;
349
+ yield* reconcileChildren(fiber, children || []);
350
+ }
351
+ else {
352
+ // Normal rendering — show children
353
+ const children = fiber.props.children;
354
+ yield* reconcileChildren(fiber, children || []);
355
+ }
356
+ return;
357
+ }
358
+ // Handle SUSPENSE specially
359
+ const isSuspense = fiberTypeIs(fiber, "SUSPENSE");
360
+ if (isSuspense) {
361
+ const fallback = fiber.props.fallback;
362
+ const threshold = fiber.props.threshold ?? 100;
363
+ const children = fiber.props.children;
364
+ // Initialize suspense config if not already set
365
+ if (Option.isNone(fiber.suspense)) {
366
+ fiber.suspense = Option.some({
367
+ fallback,
368
+ threshold,
369
+ showingFallback: false,
370
+ parkedFiber: Option.none(),
371
+ parkedComplete: Option.none(),
372
+ });
373
+ }
374
+ const config = Option.getOrThrow(fiber.suspense);
375
+ // Check if parked fiber has completed (signaled via signalFiberReady)
376
+ const parkedDone = yield* config.parkedComplete.pipe(Option.map((d) => Deferred.isDone(d)), Option.getOrElse(() => Effect.succeed(false)));
377
+ if (parkedDone && config.showingFallback) {
378
+ // Parked fiber is ready - switch back to showing its content
379
+ config.showingFallback = false;
380
+ // Mark the fallback child from alternate (previous render) for deletion
381
+ // The fallback fiber is in the alternate's child, not the current fiber's child
382
+ yield* Option.match(fiber.alternate, {
383
+ onNone: () => Effect.void,
384
+ onSome: (alt) => Option.match(alt.child, {
385
+ onNone: () => Effect.void,
386
+ onSome: (fallbackChild) => Effect.gen(function* () {
387
+ fallbackChild.effectTag = Option.some("DELETION");
388
+ yield* Ref.update(runtime.fiberState, (s) => ({
389
+ ...s,
390
+ deletions: [...s.deletions, fallbackChild],
391
+ }));
392
+ }),
393
+ }),
394
+ });
395
+ // Reuse the parked fiber directly - it already has latestStreamValue
396
+ const parkedFiber = Option.getOrThrow(config.parkedFiber);
397
+ // Re-parent the parked fiber under this suspense boundary
398
+ parkedFiber.parent = Option.some(fiber);
399
+ parkedFiber.sibling = Option.none();
400
+ parkedFiber.effectTag = Option.some("PLACEMENT");
401
+ // Mark as unparking - this tells updateFunctionComponent to skip re-execution
402
+ parkedFiber.isUnparking = true;
403
+ // Set as child of this boundary
404
+ fiber.child = Option.some(parkedFiber);
405
+ // Clear parked state
406
+ config.parkedFiber = Option.none();
407
+ config.parkedComplete = Option.none();
408
+ // Don't reconcile here - let performUnitOfWork handle it
409
+ // The work loop will process parkedFiber next, and updateFunctionComponent
410
+ // will see isUnparking=true and use the cached latestStreamValue
411
+ return;
412
+ }
413
+ if (config.showingFallback) {
414
+ // Show fallback while children are suspended
415
+ yield* reconcileChildren(fiber, [fallback]);
416
+ }
417
+ else {
418
+ // Show children normally (they'll race against threshold in updateFunctionComponent)
419
+ yield* reconcileChildren(fiber, children || []);
420
+ }
421
+ return;
422
+ }
423
+ // Virtual element types don't create DOM - just reconcile children
424
+ const isVirtualElement = fiberIsVirtualElement(fiber);
425
+ if (!isVirtualElement && Option.isNone(fiber.dom)) {
426
+ fiber.dom = Option.some(yield* createDom(fiber, runtime));
427
+ }
428
+ const children = fiber.props.children;
429
+ yield* reconcileChildren(fiber, children || []);
430
+ });
431
+ // =============================================================================
432
+ // Reconcile Children (key-based diffing)
433
+ // =============================================================================
434
+ export const reconcileChildren = (wipFiber, elements) => Effect.gen(function* () {
435
+ const runtime = yield* FibraeRuntime;
436
+ const stateRef = runtime.fiberState;
437
+ // Collect old children from alternate by walking the sibling chain
438
+ const collectSiblings = (start) => {
439
+ const result = [];
440
+ let current = start;
441
+ while (Option.isSome(current)) {
442
+ result.push(current.value);
443
+ current = current.value.sibling;
444
+ }
445
+ return result;
446
+ };
447
+ const oldChildren = wipFiber.alternate.pipe(Option.map((alt) => collectSiblings(alt.child)), Option.getOrElse(() => []));
448
+ const getKey = (props) => Option.fromNullable(props?.key);
449
+ // Build maps for keyed and unkeyed old fibers
450
+ const { keyed: oldByKey, unkeyed: oldUnkeyed } = oldChildren.reduce((acc, f) => {
451
+ Option.match(getKey(f.props), {
452
+ onNone: () => acc.unkeyed.push(f),
453
+ onSome: (key) => acc.keyed.set(key, f),
454
+ });
455
+ return acc;
456
+ }, { keyed: new Map(), unkeyed: [] });
457
+ // Match each element against old fibers by key, then by type
458
+ const matchOldFiber = (element) => {
459
+ // Try keyed match first
460
+ const keyMatch = getKey(element.props).pipe(Option.flatMap((key) => {
461
+ const found = Option.fromNullable(oldByKey.get(key));
462
+ found.pipe(Option.map(() => oldByKey.delete(key)));
463
+ return found;
464
+ }));
465
+ if (Option.isSome(keyMatch))
466
+ return keyMatch;
467
+ // Fall back to type matching for unkeyed elements
468
+ const idx = oldUnkeyed.findIndex((f) => f.type.pipe(Option.map((fType) => fType === element.type), Option.getOrElse(() => false)));
469
+ if (idx >= 0) {
470
+ const matched = oldUnkeyed[idx];
471
+ oldUnkeyed.splice(idx, 1);
472
+ return Option.some(matched);
473
+ }
474
+ return Option.none();
475
+ };
476
+ // Reconcile each element against its matched old fiber
477
+ const newFibers = yield* Effect.forEach(elements, (element) => {
478
+ const matchedOldOpt = matchOldFiber(element);
479
+ return matchedOldOpt.pipe(Option.match({
480
+ onNone: () => Effect.succeed(createFiber(Option.some(element.type), element.props, Option.some(wipFiber), Option.none(), Option.some("PLACEMENT"))),
481
+ onSome: (matched) => Effect.gen(function* () {
482
+ const typeMatches = matched.type.pipe(Option.map((mType) => mType === element.type), Option.getOrElse(() => false));
483
+ if (typeMatches) {
484
+ // UPDATE - reuse DOM, update props
485
+ const fiber = createFiber(matched.type, element.props, Option.some(wipFiber), matchedOldOpt, Option.some("UPDATE"));
486
+ fiber.dom = matched.dom;
487
+ fiber.boundary = matched.boundary;
488
+ fiber.suspense = matched.suspense;
489
+ return fiber;
490
+ }
491
+ else {
492
+ // Type changed - delete old, create new
493
+ matched.effectTag = Option.some("DELETION");
494
+ yield* Ref.update(stateRef, (s) => ({
495
+ ...s,
496
+ deletions: [...s.deletions, matched],
497
+ }));
498
+ return createFiber(Option.some(element.type), element.props, Option.some(wipFiber), Option.none(), Option.some("PLACEMENT"));
499
+ }
500
+ }),
501
+ }));
502
+ });
503
+ // Mark leftover old fibers for deletion
504
+ const leftovers = [...oldByKey.values(), ...oldUnkeyed];
505
+ yield* Effect.forEach(leftovers, (leftover) => Effect.gen(function* () {
506
+ leftover.effectTag = Option.some("DELETION");
507
+ yield* Ref.update(stateRef, (s) => ({
508
+ ...s,
509
+ deletions: [...s.deletions, leftover],
510
+ }));
511
+ }), { discard: true });
512
+ // Link new fibers as child/sibling chain
513
+ linkFibersAsSiblings(newFibers, wipFiber);
514
+ });
515
+ //# sourceMappingURL=fiber-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiber-update.js","sourceRoot":"","sources":["../src/fiber-update.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,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AC,CAAC,CAAC;IACN,CAAC,CAAC,EACJ,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;IAEF,yCAAyC;IACzC,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
package/dist/h.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"h.js","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4E,MAAM,aAAa,CAAC;AAEvG,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE;QACL,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAeH,MAAM,UAAU,CAAC,CACf,IAAoB,EACpB,QAAoC,EAAE,EACtC,WAAqB,EAAE;IAEvB,OAAO;QACL,IAAI,EAAE,IAAmB;QACzB,KAAK,EAAE;YACL,GAAG,KAAK;YACR,QAAQ,EAAE,QAAQ;iBACf,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;iBAC3E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACvD,OAAO,KAAiB,CAAC;gBAC3B,CAAC;gBACD,gEAAgE;gBAChE,OAAO,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC;SACL;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"h.js","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,aAAa,CAAC;AAErB,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE;QACL,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAeH,MAAM,UAAU,CAAC,CACf,IAAoB,EACpB,KAAK,GAA+B,EAAE,EACtC,QAAQ,GAAa,EAAE;IAEvB,OAAO;QACL,IAAI,EAAE,IAAmB;QACzB,KAAK,EAAE;YACL,GAAG,KAAK;YACR,QAAQ,EAAE,QAAQ;iBACf,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;iBAC3E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACvD,OAAO,KAAiB,CAAC;gBAC3B,CAAC;gBACD,gEAAgE;gBAChE,OAAO,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC;SACL;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { Suspense, ErrorBoundary } from "./components.js";
4
4
  export { h, createTextElement } from "./h.js";
5
5
  export type { VElement, ElementType, Primitive } from "./shared.js";
6
6
  export type { VElement as VNode } from "./shared.js";
7
- export { RenderError, StreamError, EventHandlerError, type ComponentError, } from "./shared.js";
7
+ export { RenderError, StreamError, EventHandlerError, type ComponentError } from "./shared.js";
8
8
  export { ComponentScope } from "./shared.js";
9
9
  export { HydrationState, HydrationStateLive, HydrationStateEmpty } from "./hydration-state.js";
10
10
  export { Atom, Registry as AtomRegistry, Result } from "@effect-atom/atom";
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ export { Suspense, ErrorBoundary } from "./components.js";
10
10
  // Element creation (JSX factory)
11
11
  export { h, createTextElement } from "./h.js";
12
12
  // Error types
13
- export { RenderError, StreamError, EventHandlerError, } from "./shared.js";
13
+ export { RenderError, StreamError, EventHandlerError } from "./shared.js";
14
14
  // Component lifecycle
15
15
  export { ComponentScope } from "./shared.js";
16
16
  // Hydration state service
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,uBAAuB;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,UAAU;AACV,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEtE,sBAAsB;AACtB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE1D,iCAAiC;AACjC,OAAO,EAAE,CAAC,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAM9C,cAAc;AACd,OAAO,EACL,WAAW,EACX,WAAW,EACX,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAErB,sBAAsB;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE/F,oDAAoD;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3E,8CAA8C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,uBAAuB;AACvB,OAAO,EAAE,MAAM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