fibrae 0.2.3 → 0.3.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/atom-utils.d.ts +52 -0
- package/dist/atom-utils.js +64 -0
- package/dist/atom-utils.js.map +1 -0
- package/dist/cli/build.d.ts +34 -0
- package/dist/cli/build.js +92 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cli.d.ts +10 -0
- package/dist/cli/cli.js +43 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.d.ts +19 -0
- package/dist/cli/config.js +5 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/html.d.ts +19 -0
- package/dist/cli/html.js +95 -0
- package/dist/cli/html.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/vite-plugin.d.ts +9 -0
- package/dist/cli/vite-plugin.js +143 -0
- package/dist/cli/vite-plugin.js.map +1 -0
- package/dist/components.d.ts +28 -30
- package/dist/components.js +35 -53
- package/dist/components.js.map +1 -1
- package/dist/core.js +7 -10
- package/dist/core.js.map +1 -1
- package/dist/dom.d.ts +25 -6
- package/dist/dom.js +161 -27
- package/dist/dom.js.map +1 -1
- package/dist/fiber-boundary.d.ts +39 -0
- package/dist/fiber-boundary.js +151 -0
- package/dist/fiber-boundary.js.map +1 -0
- package/dist/fiber-commit.d.ts +27 -0
- package/dist/fiber-commit.js +247 -0
- package/dist/fiber-commit.js.map +1 -0
- package/dist/fiber-render.d.ts +9 -9
- package/dist/fiber-render.js +165 -958
- package/dist/fiber-render.js.map +1 -1
- package/dist/fiber-tree.d.ts +77 -0
- package/dist/fiber-tree.js +152 -0
- package/dist/fiber-tree.js.map +1 -0
- package/dist/fiber-update.d.ts +46 -0
- package/dist/fiber-update.js +521 -0
- package/dist/fiber-update.js.map +1 -0
- package/dist/h.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime/index.d.ts +368 -2
- package/dist/live/atom.d.ts +31 -0
- package/dist/live/atom.js +33 -0
- package/dist/live/atom.js.map +1 -0
- package/dist/live/client.d.ts +50 -0
- package/dist/live/client.js +90 -0
- package/dist/live/client.js.map +1 -0
- package/dist/live/codec.d.ts +39 -0
- package/dist/live/codec.js +41 -0
- package/dist/live/codec.js.map +1 -0
- package/dist/live/config.d.ts +13 -0
- package/dist/live/config.js +11 -0
- package/dist/live/config.js.map +1 -0
- package/dist/live/index.d.ts +25 -0
- package/dist/live/index.js +19 -0
- package/dist/live/index.js.map +1 -0
- package/dist/live/server.d.ts +83 -0
- package/dist/live/server.js +106 -0
- package/dist/live/server.js.map +1 -0
- package/dist/live/sse-stream.d.ts +14 -0
- package/dist/live/sse-stream.js +30 -0
- package/dist/live/sse-stream.js.map +1 -0
- package/dist/live/types.d.ts +40 -0
- package/dist/live/types.js +20 -0
- package/dist/live/types.js.map +1 -0
- package/dist/mdx/index.d.ts +125 -0
- package/dist/mdx/index.js +137 -0
- package/dist/mdx/index.js.map +1 -0
- package/dist/mdx/parse.d.ts +42 -0
- package/dist/mdx/parse.js +147 -0
- package/dist/mdx/parse.js.map +1 -0
- package/dist/mdx/render.d.ts +23 -0
- package/dist/mdx/render.js +263 -0
- package/dist/mdx/render.js.map +1 -0
- package/dist/router/Form.d.ts +90 -0
- package/dist/router/Form.js +166 -0
- package/dist/router/Form.js.map +1 -0
- package/dist/router/History.d.ts +4 -9
- package/dist/router/History.js +0 -8
- package/dist/router/History.js.map +1 -1
- package/dist/router/Link.d.ts +27 -28
- package/dist/router/Link.js +50 -119
- package/dist/router/Link.js.map +1 -1
- package/dist/router/Navigator.d.ts +25 -33
- package/dist/router/Navigator.js +41 -149
- package/dist/router/Navigator.js.map +1 -1
- package/dist/router/Route.d.ts +24 -7
- package/dist/router/Route.js +42 -27
- package/dist/router/Route.js.map +1 -1
- package/dist/router/Router.d.ts +27 -19
- package/dist/router/Router.js +112 -120
- package/dist/router/Router.js.map +1 -1
- package/dist/router/RouterBuilder.d.ts +171 -36
- package/dist/router/RouterBuilder.js +101 -39
- package/dist/router/RouterBuilder.js.map +1 -1
- package/dist/router/RouterOutlet.d.ts +1 -18
- package/dist/router/RouterOutlet.js +60 -48
- package/dist/router/RouterOutlet.js.map +1 -1
- package/dist/router/RouterState.d.ts +1 -1
- package/dist/router/index.d.ts +8 -5
- package/dist/router/index.js +6 -3
- package/dist/router/index.js.map +1 -1
- package/dist/router/register.d.ts +37 -0
- package/dist/router/register.js +18 -0
- package/dist/router/register.js.map +1 -0
- package/dist/router/utils.d.ts +36 -0
- package/dist/router/utils.js +48 -0
- package/dist/router/utils.js.map +1 -0
- package/dist/runtime.d.ts +11 -8
- package/dist/runtime.js +20 -2
- package/dist/runtime.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +15 -29
- package/dist/server.js.map +1 -1
- package/dist/shared.d.ts +61 -62
- package/dist/shared.js +51 -13
- package/dist/shared.js.map +1 -1
- package/dist/tracking.d.ts +4 -3
- package/dist/tracking.js +6 -1
- package/dist/tracking.js.map +1 -1
- package/package.json +45 -7
- package/dist/hydration.d.ts +0 -30
- package/dist/hydration.js +0 -355
- package/dist/hydration.js.map +0 -1
- package/dist/render.d.ts +0 -19
- package/dist/render.js +0 -285
- package/dist/render.js.map +0 -1
- package/dist/scope-utils.d.ts +0 -14
- package/dist/scope-utils.js +0 -29
- package/dist/scope-utils.js.map +0 -1
package/dist/hydration.js
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Stream from "effect/Stream";
|
|
3
|
-
import * as Sink from "effect/Sink";
|
|
4
|
-
import * as Scope from "effect/Scope";
|
|
5
|
-
import * as Exit from "effect/Exit";
|
|
6
|
-
import * as Ref from "effect/Ref";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import * as Context from "effect/Context";
|
|
9
|
-
import * as FiberRef from "effect/FiberRef";
|
|
10
|
-
import { Atom, Registry as AtomRegistry } from "@effect-atom/atom";
|
|
11
|
-
import { HydrationMismatch, RenderError } from "./shared.js";
|
|
12
|
-
import { FibraeRuntime, runForkWithRuntime } from "./runtime.js";
|
|
13
|
-
import { attachEventListeners } from "./dom.js";
|
|
14
|
-
import { normalizeToStream, makeTrackingRegistry, subscribeToAtoms } from "./tracking.js";
|
|
15
|
-
import { clearContentScope, registerNodeCleanup } from "./scope-utils.js";
|
|
16
|
-
import { ErrorBoundaryChannel } from "./components.js";
|
|
17
|
-
import { renderVElementToDOM } from "./render.js";
|
|
18
|
-
// =============================================================================
|
|
19
|
-
// Type Guards
|
|
20
|
-
// =============================================================================
|
|
21
|
-
const isFunctionComponent = (type) => typeof type === "function";
|
|
22
|
-
const isHostElement = (type) => typeof type === "string";
|
|
23
|
-
// =============================================================================
|
|
24
|
-
// Hydration Helpers
|
|
25
|
-
// =============================================================================
|
|
26
|
-
/**
|
|
27
|
-
* Build a human-readable path for hydration error messages.
|
|
28
|
-
* Example: "div > ul > li:2" means the 3rd li inside ul inside div
|
|
29
|
-
*/
|
|
30
|
-
const buildPath = (ancestors) => {
|
|
31
|
-
if (ancestors.length === 0)
|
|
32
|
-
return "root";
|
|
33
|
-
return ancestors.map(({ tag, index }) => (index > 0 ? `${tag}:${index}` : tag)).join(" > ");
|
|
34
|
-
};
|
|
35
|
-
// =============================================================================
|
|
36
|
-
// Hydration Implementation
|
|
37
|
-
// =============================================================================
|
|
38
|
-
/**
|
|
39
|
-
* Hydrate a VElement tree by walking existing DOM nodes.
|
|
40
|
-
*
|
|
41
|
-
* This function:
|
|
42
|
-
* - Matches VElement tree to existing DOM nodes positionally
|
|
43
|
-
* - Attaches event handlers to existing elements
|
|
44
|
-
* - Sets up atom subscriptions for reactivity
|
|
45
|
-
* - Throws HydrationMismatch on structural mismatches
|
|
46
|
-
* - Tolerates text/attribute differences (DOM wins)
|
|
47
|
-
*
|
|
48
|
-
* Uses cursor-based hydration: returns the next DOM sibling to process,
|
|
49
|
-
* or None if no more siblings. This allows Suspense boundaries to
|
|
50
|
-
* consume multiple DOM nodes (markers + content).
|
|
51
|
-
*
|
|
52
|
-
* @param vElement - Virtual element to hydrate
|
|
53
|
-
* @param domNode - Existing DOM node to hydrate against
|
|
54
|
-
* @param runtime - Fibrae runtime instance
|
|
55
|
-
* @param parentScope - Optional scope for registering cleanup
|
|
56
|
-
* @param path - Ancestor path for error messages
|
|
57
|
-
* @returns Option containing the next sibling node after what was consumed
|
|
58
|
-
*/
|
|
59
|
-
export const hydrateVElementToDOM = (vElement, domNode, runtime, parentScope, path = []) => Effect.gen(function* () {
|
|
60
|
-
const type = vElement.type;
|
|
61
|
-
if (isFunctionComponent(type)) {
|
|
62
|
-
// Function component - during hydration, the component's output maps directly to domNode
|
|
63
|
-
// (SSR doesn't create wrapper spans - it renders component output directly)
|
|
64
|
-
// Component scope - for atom subscriptions and stream subscriptions
|
|
65
|
-
const componentScope = yield* Scope.make();
|
|
66
|
-
// Content scope ref - for rendered children
|
|
67
|
-
const initialContentScope = yield* Scope.make();
|
|
68
|
-
const contentScopeRef = yield* Ref.make(initialContentScope);
|
|
69
|
-
const accessedAtoms = new Set();
|
|
70
|
-
const trackingRegistry = makeTrackingRegistry(runtime.registry, accessedAtoms);
|
|
71
|
-
// Capture current runtime context
|
|
72
|
-
const currentContext = yield* FiberRef.get(FiberRef.currentContext);
|
|
73
|
-
const contextWithTracking = Context.add(currentContext, AtomRegistry.AtomRegistry, trackingRegistry);
|
|
74
|
-
// Invoke component - catch sync errors and convert to HydrationMismatch
|
|
75
|
-
const outputResult = yield* Effect.try({
|
|
76
|
-
try: () => type(vElement.props),
|
|
77
|
-
catch: (e) => new HydrationMismatch({
|
|
78
|
-
expected: "component to render",
|
|
79
|
-
actual: `error: ${String(e)}`,
|
|
80
|
-
path: buildPath(path),
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
83
|
-
// Normalize to stream and get first value
|
|
84
|
-
const stream = normalizeToStream(outputResult).pipe(Stream.provideContext(contextWithTracking));
|
|
85
|
-
const peelResult = yield* Effect.either(Effect.gen(function* () {
|
|
86
|
-
const [maybeFirst, remainingStream] = yield* Stream.peel(stream, Sink.head()).pipe(Effect.provideService(Scope.Scope, componentScope));
|
|
87
|
-
if (Option.isNone(maybeFirst)) {
|
|
88
|
-
return { rendered: false };
|
|
89
|
-
}
|
|
90
|
-
// Hydrate the component's output DIRECTLY against domNode
|
|
91
|
-
// (not against wrapper's children - SSR doesn't create wrapper spans)
|
|
92
|
-
yield* hydrateVElementToDOM(maybeFirst.value, domNode, runtime, yield* Ref.get(contentScopeRef), path);
|
|
93
|
-
// Register the hydrated DOM node for cleanup
|
|
94
|
-
// When the content scope closes (on re-render), this node will be removed
|
|
95
|
-
yield* registerNodeCleanup(domNode, yield* Ref.get(contentScopeRef));
|
|
96
|
-
// Get parent for re-renders (we'll need to replace domNode on updates)
|
|
97
|
-
const parent = domNode.parentNode;
|
|
98
|
-
// Subscribe to atom changes for reactivity
|
|
99
|
-
if (accessedAtoms.size > 0) {
|
|
100
|
-
yield* subscribeToAtoms(accessedAtoms, () => {
|
|
101
|
-
runForkWithRuntime(runtime)(Effect.gen(function* () {
|
|
102
|
-
const newContentScope = yield* clearContentScope(contentScopeRef);
|
|
103
|
-
const newAccessedAtoms = new Set();
|
|
104
|
-
const newTrackingRegistry = makeTrackingRegistry(runtime.registry, newAccessedAtoms);
|
|
105
|
-
const newContextWithTracking = Context.add(currentContext, AtomRegistry.AtomRegistry, newTrackingRegistry);
|
|
106
|
-
const newOutput = yield* Effect.try({
|
|
107
|
-
try: () => type(vElement.props),
|
|
108
|
-
catch: (cause) => new RenderError({ cause }),
|
|
109
|
-
});
|
|
110
|
-
const newStream = normalizeToStream(newOutput).pipe(Stream.provideContext(newContextWithTracking));
|
|
111
|
-
// After first hydration, re-renders create new DOM
|
|
112
|
-
// We need to render into parent, clearing old content first
|
|
113
|
-
yield* Stream.runForEach(newStream, (reEmitted) => renderVElementToDOM(reEmitted, parent, runtime, newContentScope).pipe(Effect.catchAll((e) => Effect.logError("Re-render child error", e))));
|
|
114
|
-
}).pipe(Effect.catchAllCause((cause) => Effect.logError("Re-render error", cause))));
|
|
115
|
-
}, runtime, componentScope);
|
|
116
|
-
}
|
|
117
|
-
// Fork subscription for remaining emissions
|
|
118
|
-
const maybeErrorChannel = Context.getOption(currentContext, ErrorBoundaryChannel);
|
|
119
|
-
const streamErrorHandler = Option.match(maybeErrorChannel, {
|
|
120
|
-
onNone: () => (cause) => Effect.logError("Component stream error (no boundary)", cause),
|
|
121
|
-
onSome: (channel) => (cause) => channel.reportError(cause),
|
|
122
|
-
});
|
|
123
|
-
const subscription = Stream.runForEach(remainingStream, (emitted) => Effect.gen(function* () {
|
|
124
|
-
const newContentScope = yield* clearContentScope(contentScopeRef);
|
|
125
|
-
yield* renderVElementToDOM(emitted, parent, runtime, newContentScope).pipe(Effect.catchAll((e) => Effect.logError("Stream emission render error", e)));
|
|
126
|
-
})).pipe(Effect.catchAllCause(streamErrorHandler));
|
|
127
|
-
yield* Effect.forkIn(subscription, componentScope);
|
|
128
|
-
return { rendered: true };
|
|
129
|
-
}));
|
|
130
|
-
if (peelResult._tag === "Left") {
|
|
131
|
-
const contentScope = yield* Ref.get(contentScopeRef);
|
|
132
|
-
yield* Scope.close(contentScope, Exit.void);
|
|
133
|
-
yield* Scope.close(componentScope, Exit.void);
|
|
134
|
-
// Re-throw if it's already a HydrationMismatch
|
|
135
|
-
if (peelResult.left instanceof HydrationMismatch) {
|
|
136
|
-
return yield* Effect.fail(peelResult.left);
|
|
137
|
-
}
|
|
138
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
139
|
-
expected: "component to render",
|
|
140
|
-
actual: `error: ${String(peelResult.left)}`,
|
|
141
|
-
path: buildPath(path),
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
// Function components: return next sibling after the node we hydrated
|
|
145
|
-
return Option.fromNullable(domNode.nextSibling);
|
|
146
|
-
}
|
|
147
|
-
else if (type === "TEXT_ELEMENT") {
|
|
148
|
-
// Text node - just verify it's a text node, don't update content (DOM wins)
|
|
149
|
-
if (domNode.nodeType !== Node.TEXT_NODE) {
|
|
150
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
151
|
-
expected: "TEXT_NODE",
|
|
152
|
-
actual: domNode.nodeName,
|
|
153
|
-
path: buildPath(path),
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
// DOM text content wins - we don't update it
|
|
157
|
-
return Option.fromNullable(domNode.nextSibling);
|
|
158
|
-
}
|
|
159
|
-
else if (type === "FRAGMENT") {
|
|
160
|
-
// Fragment - hydrate children using cursor-based walking
|
|
161
|
-
const children = vElement.props.children ?? [];
|
|
162
|
-
const parent = domNode.parentNode;
|
|
163
|
-
if (!parent) {
|
|
164
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
165
|
-
expected: "fragment parent",
|
|
166
|
-
actual: "no parent node",
|
|
167
|
-
path: buildPath(path),
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
// For fragments, hydrate starting from domNode's position using cursor
|
|
171
|
-
const finalState = yield* Effect.iterate({ index: 0, cursor: Option.some(domNode) }, {
|
|
172
|
-
while: (state) => state.index < children.length && Option.isSome(state.cursor),
|
|
173
|
-
body: (state) => Option.match(state.cursor, {
|
|
174
|
-
onNone: () => Effect.fail(new HydrationMismatch({
|
|
175
|
-
expected: `${children.length} children`,
|
|
176
|
-
actual: `${state.index} children`,
|
|
177
|
-
path: buildPath(path),
|
|
178
|
-
})),
|
|
179
|
-
onSome: (cursorNode) => Effect.gen(function* () {
|
|
180
|
-
const nextCursor = yield* hydrateVElementToDOM(children[state.index], cursorNode, runtime, parentScope, [...path, { tag: "fragment", index: state.index }]);
|
|
181
|
-
return { index: state.index + 1, cursor: nextCursor };
|
|
182
|
-
}),
|
|
183
|
-
}),
|
|
184
|
-
});
|
|
185
|
-
return finalState.cursor;
|
|
186
|
-
}
|
|
187
|
-
else if (type === "SUSPENSE") {
|
|
188
|
-
// Suspense during hydration: domNode should be the opening comment marker
|
|
189
|
-
// Phase 4: Handle <!--fibrae:sus:resolved--> ... <!--/fibrae:sus-->
|
|
190
|
-
// Phase 5: Will handle <!--fibrae:sus:fallback--> case
|
|
191
|
-
const children = vElement.props.children;
|
|
192
|
-
// Check if we're at an opening marker
|
|
193
|
-
if (domNode.nodeType === Node.COMMENT_NODE &&
|
|
194
|
-
domNode.data.includes("fibrae:sus:resolved")) {
|
|
195
|
-
// Use Effect.iterate to hydrate children, walking from first content node
|
|
196
|
-
// until we hit the closing marker
|
|
197
|
-
const finalState = yield* Effect.iterate({
|
|
198
|
-
index: 0,
|
|
199
|
-
cursor: Option.fromNullable(domNode.nextSibling),
|
|
200
|
-
}, {
|
|
201
|
-
while: (state) => {
|
|
202
|
-
if (state.index >= children.length)
|
|
203
|
-
return false;
|
|
204
|
-
return Option.match(state.cursor, {
|
|
205
|
-
onNone: () => false,
|
|
206
|
-
onSome: (node) => {
|
|
207
|
-
// Stop if we hit closing marker
|
|
208
|
-
if (node.nodeType === Node.COMMENT_NODE &&
|
|
209
|
-
node.data.includes("/fibrae:sus")) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
body: (state) => Option.match(state.cursor, {
|
|
217
|
-
onNone: () => Effect.succeed({
|
|
218
|
-
index: state.index,
|
|
219
|
-
cursor: Option.none(),
|
|
220
|
-
}),
|
|
221
|
-
onSome: (cursorNode) => Effect.gen(function* () {
|
|
222
|
-
const nextCursor = yield* hydrateVElementToDOM(children[state.index], cursorNode, runtime, parentScope, [...path, { tag: "suspense", index: state.index }]);
|
|
223
|
-
return { index: state.index + 1, cursor: nextCursor };
|
|
224
|
-
}),
|
|
225
|
-
}),
|
|
226
|
-
});
|
|
227
|
-
// Skip past the closing marker to return the next sibling
|
|
228
|
-
return Option.match(finalState.cursor, {
|
|
229
|
-
onNone: () => Option.none(),
|
|
230
|
-
onSome: (maybeClosingMarker) => {
|
|
231
|
-
if (maybeClosingMarker.nodeType === Node.COMMENT_NODE &&
|
|
232
|
-
maybeClosingMarker.data.includes("/fibrae:sus")) {
|
|
233
|
-
return Option.fromNullable(maybeClosingMarker.nextSibling);
|
|
234
|
-
}
|
|
235
|
-
return Option.some(maybeClosingMarker);
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
else if (domNode.nodeType === Node.COMMENT_NODE &&
|
|
240
|
-
domNode.data.includes("fibrae:sus:fallback")) {
|
|
241
|
-
// Phase 5: SSR rendered fallback - we need to switch to render mode
|
|
242
|
-
// The actual content was never rendered on server, so we need to:
|
|
243
|
-
// 1. Find all nodes in the fallback boundary
|
|
244
|
-
// 2. Remove them from DOM
|
|
245
|
-
// 3. Render the Suspense fresh (which will handle the stream/async content)
|
|
246
|
-
const parent = domNode.parentNode;
|
|
247
|
-
if (!parent) {
|
|
248
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
249
|
-
expected: "parent node for Suspense fallback",
|
|
250
|
-
actual: "no parent",
|
|
251
|
-
path: buildPath(path),
|
|
252
|
-
}));
|
|
253
|
-
}
|
|
254
|
-
// Collect all nodes in the fallback boundary using Effect.iterate
|
|
255
|
-
// State: { nodes: collected nodes, cursor: current node, done: found closing marker }
|
|
256
|
-
const collectResult = yield* Effect.iterate({
|
|
257
|
-
nodes: [domNode],
|
|
258
|
-
cursor: Option.fromNullable(domNode.nextSibling),
|
|
259
|
-
closingMarker: Option.none(),
|
|
260
|
-
}, {
|
|
261
|
-
while: (state) => Option.isSome(state.cursor) && Option.isNone(state.closingMarker),
|
|
262
|
-
body: (state) => Effect.sync(() => {
|
|
263
|
-
const current = Option.getOrThrow(state.cursor);
|
|
264
|
-
const isClosingMarker = current.nodeType === Node.COMMENT_NODE &&
|
|
265
|
-
current.data.includes("/fibrae:sus");
|
|
266
|
-
return {
|
|
267
|
-
nodes: [...state.nodes, current],
|
|
268
|
-
cursor: Option.fromNullable(current.nextSibling),
|
|
269
|
-
closingMarker: isClosingMarker ? Option.some(current) : Option.none(),
|
|
270
|
-
};
|
|
271
|
-
}),
|
|
272
|
-
});
|
|
273
|
-
// Get the next sibling after the closing marker (our return cursor)
|
|
274
|
-
const nextSibling = Option.flatMap(collectResult.closingMarker, (marker) => Option.fromNullable(marker.nextSibling));
|
|
275
|
-
// Remove fallback nodes from DOM
|
|
276
|
-
yield* Effect.sync(() => {
|
|
277
|
-
for (const node of collectResult.nodes) {
|
|
278
|
-
parent.removeChild(node);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
// Render the Suspense fresh - this will invoke the stream-returning component,
|
|
282
|
-
// handle the timeout/race logic, and properly render children
|
|
283
|
-
// Insert before nextSibling if it exists, otherwise append
|
|
284
|
-
const suspenseScope = yield* Scope.make();
|
|
285
|
-
const renderEffect = Option.match(nextSibling, {
|
|
286
|
-
onNone: () => renderVElementToDOM(vElement, parent, runtime, suspenseScope),
|
|
287
|
-
onSome: (sibling) => Effect.gen(function* () {
|
|
288
|
-
// Create a temporary container, render into it, then insert before sibling
|
|
289
|
-
const tempContainer = document.createElement("span");
|
|
290
|
-
tempContainer.style.display = "contents";
|
|
291
|
-
parent.insertBefore(tempContainer, sibling);
|
|
292
|
-
yield* renderVElementToDOM(vElement, tempContainer, runtime, suspenseScope);
|
|
293
|
-
}),
|
|
294
|
-
});
|
|
295
|
-
// Catch render errors and convert to HydrationMismatch
|
|
296
|
-
yield* renderEffect.pipe(Effect.catchAll((e) => Effect.fail(new HydrationMismatch({
|
|
297
|
-
expected: "Suspense to render successfully",
|
|
298
|
-
actual: `render error: ${String(e)}`,
|
|
299
|
-
path: buildPath(path),
|
|
300
|
-
}))));
|
|
301
|
-
// Return cursor after where the boundary was
|
|
302
|
-
return nextSibling;
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
// No Suspense markers found - this means SSR output doesn't match expected format
|
|
306
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
307
|
-
expected: "Suspense comment marker (<!--fibrae:sus:resolved--> or <!--fibrae:sus:fallback-->)",
|
|
308
|
-
actual: domNode.nodeType === Node.COMMENT_NODE
|
|
309
|
-
? `comment: ${domNode.data}`
|
|
310
|
-
: domNode.nodeName,
|
|
311
|
-
path: buildPath(path),
|
|
312
|
-
}));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if (isHostElement(type)) {
|
|
316
|
-
// Host element - verify tag matches and hydrate
|
|
317
|
-
const el = domNode;
|
|
318
|
-
// Validate tag name matches
|
|
319
|
-
if (el.nodeName.toLowerCase() !== type.toLowerCase()) {
|
|
320
|
-
return yield* Effect.fail(new HydrationMismatch({
|
|
321
|
-
expected: type,
|
|
322
|
-
actual: el.nodeName.toLowerCase(),
|
|
323
|
-
path: buildPath(path),
|
|
324
|
-
}));
|
|
325
|
-
}
|
|
326
|
-
// Attach event listeners - uses runForkWithRuntime internally for full context
|
|
327
|
-
attachEventListeners(el, vElement.props, runtime);
|
|
328
|
-
// Handle ref
|
|
329
|
-
const ref = vElement.props.ref;
|
|
330
|
-
if (ref && typeof ref === "object" && "current" in ref) {
|
|
331
|
-
ref.current = el;
|
|
332
|
-
}
|
|
333
|
-
// Hydrate children using cursor-based iteration
|
|
334
|
-
const vChildren = vElement.props.children ?? [];
|
|
335
|
-
const childScope = yield* Scope.make();
|
|
336
|
-
yield* Effect.iterate({ index: 0, cursor: Option.fromNullable(el.firstChild) }, {
|
|
337
|
-
while: (state) => state.index < vChildren.length,
|
|
338
|
-
body: (state) => Option.match(state.cursor, {
|
|
339
|
-
onNone: () => Effect.fail(new HydrationMismatch({
|
|
340
|
-
expected: `child at index ${state.index}`,
|
|
341
|
-
actual: "no more DOM nodes",
|
|
342
|
-
path: buildPath([...path, { tag: type, index: state.index }]),
|
|
343
|
-
})),
|
|
344
|
-
onSome: (cursorNode) => Effect.gen(function* () {
|
|
345
|
-
const nextCursor = yield* hydrateVElementToDOM(vChildren[state.index], cursorNode, runtime, childScope, [...path, { tag: type, index: state.index }]);
|
|
346
|
-
return { index: state.index + 1, cursor: nextCursor };
|
|
347
|
-
}),
|
|
348
|
-
}),
|
|
349
|
-
});
|
|
350
|
-
return Option.fromNullable(domNode.nextSibling);
|
|
351
|
-
}
|
|
352
|
-
// Fallback for unknown types
|
|
353
|
-
return Option.fromNullable(domNode.nextSibling);
|
|
354
|
-
});
|
|
355
|
-
//# sourceMappingURL=hydration.js.map
|
package/dist/hydration.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAmD,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EA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7C,CAAC;oBACF,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;gBACxD,CAAC,CAAC;aACL,CAAC;SACL,CACF,CAAC;QAEF,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,6BAA6B;IAC7B,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC"}
|
package/dist/render.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Scope from "effect/Scope";
|
|
3
|
-
import { type VElement } from "./shared.js";
|
|
4
|
-
import { FibraeRuntime } from "./runtime.js";
|
|
5
|
-
/**
|
|
6
|
-
* Recursively render a VElement tree to DOM.
|
|
7
|
-
* This is the core rendering function that handles:
|
|
8
|
-
* - Function components (with stream subscriptions and atom reactivity)
|
|
9
|
-
* - Host elements (DOM nodes)
|
|
10
|
-
* - Text elements
|
|
11
|
-
* - Fragments
|
|
12
|
-
* - Error boundaries
|
|
13
|
-
*
|
|
14
|
-
* @param vElement - Virtual element to render
|
|
15
|
-
* @param parent - Parent DOM node to append to
|
|
16
|
-
* @param runtime - Fibrae runtime instance
|
|
17
|
-
* @param parentScope - Optional scope for registering cleanup (used for proper DOM node removal)
|
|
18
|
-
*/
|
|
19
|
-
export declare const renderVElementToDOM: (vElement: VElement, parent: Node, runtime: FibraeRuntime, parentScope?: Scope.Scope.Closeable) => Effect.Effect<void, unknown, never>;
|