fibrae 0.2.2 → 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 (119) 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 -2
  72. package/dist/router/History.js.map +1 -1
  73. package/dist/router/Link.d.ts +8 -4
  74. package/dist/router/Link.js +13 -34
  75. package/dist/router/Link.js.map +1 -1
  76. package/dist/router/Navigator.d.ts +12 -1
  77. package/dist/router/Navigator.js +31 -68
  78. package/dist/router/Navigator.js.map +1 -1
  79. package/dist/router/Route.d.ts +16 -3
  80. package/dist/router/Route.js +32 -25
  81. package/dist/router/Route.js.map +1 -1
  82. package/dist/router/Router.d.ts +27 -19
  83. package/dist/router/Router.js +78 -101
  84. package/dist/router/Router.js.map +1 -1
  85. package/dist/router/RouterBuilder.d.ts +106 -34
  86. package/dist/router/RouterBuilder.js +78 -39
  87. package/dist/router/RouterBuilder.js.map +1 -1
  88. package/dist/router/RouterOutlet.d.ts +1 -18
  89. package/dist/router/RouterOutlet.js +25 -8
  90. package/dist/router/RouterOutlet.js.map +1 -1
  91. package/dist/router/RouterState.d.ts +1 -1
  92. package/dist/router/index.d.ts +4 -4
  93. package/dist/router/index.js +4 -2
  94. package/dist/router/index.js.map +1 -1
  95. package/dist/router/utils.d.ts +36 -0
  96. package/dist/router/utils.js +48 -0
  97. package/dist/router/utils.js.map +1 -0
  98. package/dist/runtime.d.ts +10 -7
  99. package/dist/runtime.js +20 -2
  100. package/dist/runtime.js.map +1 -1
  101. package/dist/server.d.ts +2 -2
  102. package/dist/server.js +15 -29
  103. package/dist/server.js.map +1 -1
  104. package/dist/shared.d.ts +58 -59
  105. package/dist/shared.js +51 -13
  106. package/dist/shared.js.map +1 -1
  107. package/dist/tracking.d.ts +4 -3
  108. package/dist/tracking.js +6 -1
  109. package/dist/tracking.js.map +1 -1
  110. package/package.json +32 -7
  111. package/dist/hydration.d.ts +0 -30
  112. package/dist/hydration.js +0 -355
  113. package/dist/hydration.js.map +0 -1
  114. package/dist/render.d.ts +0 -19
  115. package/dist/render.js +0 -285
  116. package/dist/render.js.map +0 -1
  117. package/dist/scope-utils.d.ts +0 -14
  118. package/dist/scope-utils.js +0 -29
  119. package/dist/scope-utils.js.map +0 -1
package/dist/server.d.ts CHANGED
@@ -77,7 +77,7 @@ export { SSRAtomRegistryLayer };
77
77
  * });
78
78
  * ```
79
79
  */
80
- export declare const renderToString: (element: VElement, _options?: RenderOptions) => Effect.Effect<RenderResult, unknown, never>;
80
+ export declare const renderToString: (element: VElement, _options?: RenderOptions | undefined) => Effect.Effect<RenderResult, unknown, never>;
81
81
  /**
82
82
  * Render a VElement tree to HTML, requiring AtomRegistry and any other
83
83
  * services the component tree needs.
@@ -106,5 +106,5 @@ export declare const renderToString: (element: VElement, _options?: RenderOption
106
106
  * );
107
107
  * ```
108
108
  */
109
- export declare const renderToStringWith: <R>(element: VElement, _options?: RenderOptions) => Effect.Effect<RenderResult, unknown, AtomRegistry.AtomRegistry | R>;
109
+ export declare const renderToStringWith: <R>(element: VElement, _options?: RenderOptions | undefined) => Effect.Effect<RenderResult, unknown, R | AtomRegistry.AtomRegistry>;
110
110
  export { Hydration, Result } from "@effect-atom/atom";
package/dist/server.js CHANGED
@@ -14,7 +14,7 @@ import * as Stream from "effect/Stream";
14
14
  import * as Option from "effect/Option";
15
15
  import * as Deferred from "effect/Deferred";
16
16
  import { Atom, Registry as AtomRegistry, Hydration } from "@effect-atom/atom";
17
- import { isStream, isProperty, RenderError } from "./shared.js";
17
+ import { isStream, isProperty, RenderError, } from "./shared.js";
18
18
  // =============================================================================
19
19
  // SSR Registry Layer
20
20
  // =============================================================================
@@ -89,15 +89,10 @@ const renderAttribute = (name, value) => {
89
89
  /**
90
90
  * Render all props as HTML attributes
91
91
  */
92
- const renderAttributes = (props) => {
93
- let attrs = "";
94
- for (const [key, value] of Object.entries(props)) {
95
- if (isProperty(key)) {
96
- attrs += renderAttribute(propToAttr(key), value);
97
- }
98
- }
99
- return attrs;
100
- };
92
+ const renderAttributes = (props) => Object.entries(props)
93
+ .filter(([key]) => isProperty(key))
94
+ .map(([key, value]) => renderAttribute(propToAttr(key), value))
95
+ .join("");
101
96
  // =============================================================================
102
97
  // Void Elements (self-closing)
103
98
  // =============================================================================
@@ -167,13 +162,11 @@ const renderVElementToString = (vElement) => Effect.gen(function* () {
167
162
  return escapeHtml(String(vElement.props.nodeValue ?? ""));
168
163
  }
169
164
  else if (type === "FRAGMENT") {
170
- // Fragment - render children directly
171
- const children = vElement.props.children ?? [];
172
- let html = "";
173
- for (const child of children) {
174
- html += yield* renderVElementToString(child);
175
- }
176
- return html;
165
+ // Fragment - render children directly, or raw HTML if dangerouslySetInnerHTML is set
166
+ const rawHtml = vElement.props.dangerouslySetInnerHTML;
167
+ if (rawHtml != null)
168
+ return String(rawHtml);
169
+ return yield* Effect.reduce(vElement.props.children ?? [], "", (acc, child) => renderVElementToString(child).pipe(Effect.map((h) => acc + h)));
177
170
  }
178
171
  else if (type === "SUSPENSE") {
179
172
  // Suspense boundary - race child rendering against timeout
@@ -185,13 +178,7 @@ const renderVElementToString = (vElement) => Effect.gen(function* () {
185
178
  // Create a Deferred to signal when children complete
186
179
  const childrenComplete = yield* Deferred.make();
187
180
  // Fork: render children to string
188
- yield* Effect.fork(Effect.gen(function* () {
189
- let childrenHtml = "";
190
- for (const child of children) {
191
- childrenHtml += yield* renderVElementToString(child);
192
- }
193
- yield* Deferred.succeed(childrenComplete, childrenHtml);
194
- }).pipe(Effect.catchAll((e) => Deferred.fail(childrenComplete, e))));
181
+ yield* Effect.fork(Effect.reduce(children, "", (acc, child) => renderVElementToString(child).pipe(Effect.map((h) => acc + h))).pipe(Effect.flatMap((html) => Deferred.succeed(childrenComplete, html)), Effect.catchAll((e) => Deferred.fail(childrenComplete, e))));
195
182
  // Race: children completing vs timeout
196
183
  const result = yield* Effect.race(Deferred.await(childrenComplete).pipe(Effect.map((html) => ({ type: "resolved", html }))), Effect.sleep(`${threshold} millis`).pipe(Effect.as({ type: "timeout" })));
197
184
  if (result.type === "resolved") {
@@ -213,11 +200,10 @@ const renderVElementToString = (vElement) => Effect.gen(function* () {
213
200
  if (VOID_ELEMENTS.has(type)) {
214
201
  return `<${type}${attrs}${keyAttr} />`;
215
202
  }
216
- const children = vElement.props.children ?? [];
217
- let childrenHtml = "";
218
- for (const child of children) {
219
- childrenHtml += yield* renderVElementToString(child);
220
- }
203
+ const rawHtml = vElement.props.dangerouslySetInnerHTML;
204
+ const childrenHtml = rawHtml != null
205
+ ? String(rawHtml)
206
+ : yield* Effect.reduce(vElement.props.children ?? [], "", (acc, child) => renderVElementToString(child).pipe(Effect.map((h) => acc + h)));
221
207
  return `<${type}${attrs}${keyAttr}>${childrenHtml}</${type}>`;
222
208
  }
223
209
  // Unknown type
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CA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MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,OAAiB,EACjB,QAAwB,EACqB,EAAE,CAC/C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IAElD,qBAAqB;IACrB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEpD,+BAA+B;IAC/B,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEtD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAiB,EACjB,QAAwB,EAC6C,EAAE,CACvE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IAElD,qBAAqB;IACrB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEpD,+BAA+B;IAC/B,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEtD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,iDAAiD;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/shared.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as Stream from "effect/Stream";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Scope from "effect/Scope";
5
5
  import * as Deferred from "effect/Deferred";
6
+ import * as Schema from "effect/Schema";
6
7
  import * as Context from "effect/Context";
7
8
  import type * as Cause from "effect/Cause";
8
9
  import type * as Types from "effect/Types";
@@ -10,7 +11,7 @@ import { Atom as BaseAtom } from "@effect-atom/atom";
10
11
  export type { Cause, Types };
11
12
  declare const ComponentScope_base: Context.TagClass<ComponentScope, "fibrae/ComponentScope", {
12
13
  scope: Scope.Scope;
13
- mounted: Deferred.Deferred<void>;
14
+ mounted: Deferred.Deferred<void, never>;
14
15
  }>;
15
16
  /**
16
17
  * Service tag for accessing the current component's scope and mount signal.
@@ -110,18 +111,25 @@ export type SuspenseConfig = {
110
111
  parkedComplete: Option.Option<Deferred.Deferred<void>>;
111
112
  };
112
113
  /**
113
- * Effect-native boundary configuration (ErrorBoundary API)
114
+ * Error boundary configuration (ErrorBoundary component)
114
115
  *
115
- * Created when the renderer encounters a BOUNDARY marker from ErrorBoundary().
116
- * The onError callback fails the boundary's stream, triggering catchTags.
116
+ * Created when the renderer encounters a BOUNDARY marker from ErrorBoundary.
117
+ * On error, parks children (keeps subscriptions alive) and renders fallback.
118
+ * When parked children emit new values (e.g. route change), boundary resets.
117
119
  */
118
120
  export type BoundaryConfig = {
119
121
  /** Unique identifier for this boundary (for debugging) */
120
122
  boundaryId: string;
121
- /** Callback to report errors - fails the boundary stream */
122
- onError: (error: ComponentError) => void;
123
+ /** Fallback renderer called with the caught error to produce fallback UI */
124
+ fallback: (error: ComponentError) => VElement;
123
125
  /** True when an error has occurred and fallback is being shown */
124
126
  hasError: boolean;
127
+ /** The caught error (when hasError is true) */
128
+ error: Option.Option<ComponentError>;
129
+ /** Reference to the parked child fiber (kept alive for recovery) */
130
+ parkedFiber: Option.Option<Fiber>;
131
+ /** Mutable reference to the current BOUNDARY fiber (survives reconciliation) */
132
+ currentFiber: Option.Option<Fiber>;
125
133
  };
126
134
  /**
127
135
  * Fiber node - represents a unit of work in the reconciliation tree
@@ -139,10 +147,10 @@ export interface Fiber {
139
147
  sibling: Option.Option<Fiber>;
140
148
  alternate: Option.Option<Fiber>;
141
149
  effectTag: Option.Option<"UPDATE" | "PLACEMENT" | "DELETION">;
142
- componentScope: Option.Option<Scope.Scope>;
150
+ componentScope: Option.Option<Scope.Scope.Closeable>;
143
151
  /** Deferred that resolves after this component's DOM subtree commits */
144
152
  mountedDeferred: Option.Option<Deferred.Deferred<void>>;
145
- accessedAtoms: Option.Option<Set<BaseAtom.Atom<any>>>;
153
+ accessedAtoms: Option.Option<Set<BaseAtom.Atom<unknown>>>;
146
154
  latestStreamValue: Option.Option<VElement>;
147
155
  childFirstCommitDeferred: Option.Option<Deferred.Deferred<void>>;
148
156
  fiberRef: Option.Option<FiberRef>;
@@ -151,7 +159,7 @@ export interface Fiber {
151
159
  boundary: Option.Option<BoundaryConfig>;
152
160
  suspense: Option.Option<SuspenseConfig>;
153
161
  /** Context captured during render phase, used for event handlers in commit phase */
154
- renderContext: Option.Option<Context.Context<unknown>>;
162
+ renderContext: Option.Option<Context.Context<never>>;
155
163
  /** True if this fiber is parked (suspended) - scope should not be closed on deletion */
156
164
  isParked: boolean;
157
165
  /** True when fiber is being restored from parked state - skip component re-execution */
@@ -168,15 +176,22 @@ export declare const isProperty: (key: string) => boolean;
168
176
  /**
169
177
  * Check if an element type is a primitive (string) or component (function)
170
178
  */
171
- export declare const isPrimitive: (type: ElementType) => type is Primitive;
179
+ export declare const isPrimitive: (type: ElementType<{}>) => type is Primitive;
172
180
  /**
173
181
  * Check if element type is a component function
174
182
  */
175
- export declare const isComponent: (type: ElementType) => type is (props: {}) => VNode;
183
+ export declare const isComponent: (type: ElementType<{}>) => type is (props: {}) => VNode;
176
184
  export declare const isStream: (value: unknown) => value is Stream.Stream<any, any, any>;
177
- declare const HydrationMismatch_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
178
- readonly _tag: "HydrationMismatch";
179
- } & Readonly<A>;
185
+ declare const HydrationMismatch_base: Schema.TaggedErrorClass<HydrationMismatch, "HydrationMismatch", {
186
+ readonly _tag: Schema.tag<"HydrationMismatch">;
187
+ } & {
188
+ /** What the VElement tree expected (e.g., "div", "3 children") */
189
+ expected: typeof Schema.String;
190
+ /** What the DOM actually had (e.g., "span", "2 children") */
191
+ actual: typeof Schema.String;
192
+ /** Human-readable path to the mismatch location (e.g., "div > ul > li:2") */
193
+ path: typeof Schema.String;
194
+ }>;
180
195
  /**
181
196
  * Error thrown when DOM structure doesn't match VElement tree during hydration.
182
197
  *
@@ -197,40 +212,27 @@ declare const HydrationMismatch_base: new <A extends Record<string, any> = {}>(a
197
212
  * );
198
213
  * ```
199
214
  */
200
- export declare class HydrationMismatch extends HydrationMismatch_base<{
201
- /** What the VElement tree expected (e.g., "div", "3 children") */
202
- readonly expected: string;
203
- /** What the DOM actually had (e.g., "span", "2 children") */
204
- readonly actual: string;
205
- /** Human-readable path to the mismatch location (e.g., "div > ul > li:2") */
206
- readonly path: string;
207
- }> {
215
+ export declare class HydrationMismatch extends HydrationMismatch_base {
208
216
  }
209
- declare const RenderError_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
210
- readonly _tag: "RenderError";
211
- } & Readonly<A>;
212
- /**
213
- * Error during component render (sync throw or Effect failure).
214
- *
215
- * Caught by ErrorBoundary and can be handled via Stream.catchTags:
216
- * ```typescript
217
- * const SafeApp = () => ErrorBoundary(<MyComponent />).pipe(
218
- * Stream.catchTags({
219
- * RenderError: (e) => Stream.succeed(<div>Render failed: {e.componentName}</div>),
220
- * })
221
- * );
222
- * ```
223
- */
224
- export declare class RenderError extends RenderError_base<{
217
+ declare const RenderError_base: Schema.TaggedErrorClass<RenderError, "RenderError", {
218
+ readonly _tag: Schema.tag<"RenderError">;
219
+ } & {
225
220
  /** The underlying error that caused the render failure */
226
- readonly cause: unknown;
221
+ cause: typeof Schema.Unknown;
227
222
  /** Name of the component that failed (if available) */
228
- readonly componentName?: string;
229
- }> {
223
+ componentName: Schema.optional<typeof Schema.String>;
224
+ }>;
225
+ export declare class RenderError extends RenderError_base {
226
+ get message(): string;
230
227
  }
231
- declare const StreamError_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
232
- readonly _tag: "StreamError";
233
- } & Readonly<A>;
228
+ declare const StreamError_base: Schema.TaggedErrorClass<StreamError, "StreamError", {
229
+ readonly _tag: Schema.tag<"StreamError">;
230
+ } & {
231
+ /** The underlying error that caused the stream failure */
232
+ cause: typeof Schema.Unknown;
233
+ /** When the error occurred relative to first emission */
234
+ phase: Schema.Literal<["before-first-emission", "after-first-emission"]>;
235
+ }>;
234
236
  /**
235
237
  * Error from a Stream component (before or after first emission).
236
238
  *
@@ -238,27 +240,24 @@ declare const StreamError_base: new <A extends Record<string, any> = {}>(args: T
238
240
  * - "before-first-emission": Stream failed before producing any value (shows fallback immediately)
239
241
  * - "after-first-emission": Stream failed after showing content (replaces content with fallback)
240
242
  */
241
- export declare class StreamError extends StreamError_base<{
242
- /** The underlying error that caused the stream failure */
243
- readonly cause: unknown;
244
- /** When the error occurred relative to first emission */
245
- readonly phase: "before-first-emission" | "after-first-emission";
246
- }> {
243
+ export declare class StreamError extends StreamError_base {
244
+ get message(): string;
247
245
  }
248
- declare const EventHandlerError_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
249
- readonly _tag: "EventHandlerError";
250
- } & Readonly<A>;
246
+ declare const EventHandlerError_base: Schema.TaggedErrorClass<EventHandlerError, "EventHandlerError", {
247
+ readonly _tag: Schema.tag<"EventHandlerError">;
248
+ } & {
249
+ /** The underlying error that caused the event handler failure */
250
+ cause: typeof Schema.Unknown;
251
+ /** The DOM event type that triggered this handler (e.g., "click", "change") */
252
+ eventType: typeof Schema.String;
253
+ }>;
251
254
  /**
252
255
  * Error from an event handler Effect.
253
256
  *
254
257
  * The `eventType` field indicates which event triggered the failure (e.g., "click", "change").
255
258
  */
256
- export declare class EventHandlerError extends EventHandlerError_base<{
257
- /** The underlying error that caused the event handler failure */
258
- readonly cause: unknown;
259
- /** The DOM event type that triggered this handler (e.g., "click", "change") */
260
- readonly eventType: string;
261
- }> {
259
+ export declare class EventHandlerError extends EventHandlerError_base {
260
+ get message(): string;
262
261
  }
263
262
  /**
264
263
  * Union of all component error types.
package/dist/shared.js CHANGED
@@ -3,7 +3,7 @@ import * as Stream from "effect/Stream";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Scope from "effect/Scope";
5
5
  import * as Deferred from "effect/Deferred";
6
- import * as Data from "effect/Data";
6
+ import * as Schema from "effect/Schema";
7
7
  import * as Context from "effect/Context";
8
8
  import { Atom as BaseAtom } from "@effect-atom/atom";
9
9
  // =============================================================================
@@ -64,7 +64,11 @@ export const isEvent = (key) => key.startsWith("on");
64
64
  /**
65
65
  * Helper to check if a key is a regular property (not children, ref, key, or event)
66
66
  */
67
- export const isProperty = (key) => key !== "children" && key !== "ref" && key !== "key" && !isEvent(key);
67
+ export const isProperty = (key) => key !== "children" &&
68
+ key !== "ref" &&
69
+ key !== "key" &&
70
+ key !== "dangerouslySetInnerHTML" &&
71
+ !isEvent(key);
68
72
  /**
69
73
  * Check if an element type is a primitive (string) or component (function)
70
74
  */
@@ -97,7 +101,14 @@ export const isStream = (value) => typeof value === "object" && value !== null &
97
101
  * );
98
102
  * ```
99
103
  */
100
- export class HydrationMismatch extends Data.TaggedError("HydrationMismatch") {
104
+ export class HydrationMismatch extends Schema.TaggedError()("HydrationMismatch", {
105
+ /** What the VElement tree expected (e.g., "div", "3 children") */
106
+ expected: Schema.String,
107
+ /** What the DOM actually had (e.g., "span", "2 children") */
108
+ actual: Schema.String,
109
+ /** Human-readable path to the mismatch location (e.g., "div > ul > li:2") */
110
+ path: Schema.String,
111
+ }) {
101
112
  }
102
113
  // =============================================================================
103
114
  // Component Errors
@@ -105,16 +116,27 @@ export class HydrationMismatch extends Data.TaggedError("HydrationMismatch") {
105
116
  /**
106
117
  * Error during component render (sync throw or Effect failure).
107
118
  *
108
- * Caught by ErrorBoundary and can be handled via Stream.catchTags:
109
- * ```typescript
110
- * const SafeApp = () => ErrorBoundary(<MyComponent />).pipe(
111
- * Stream.catchTags({
112
- * RenderError: (e) => Stream.succeed(<div>Render failed: {e.componentName}</div>),
113
- * })
114
- * );
119
+ * Caught by ErrorBoundary match on `_tag` in the fallback:
120
+ * ```tsx
121
+ * <ErrorBoundary fallback={(e) =>
122
+ * e._tag === "RenderError"
123
+ * ? <div>Render failed: {e.componentName}</div>
124
+ * : <div>Error</div>
125
+ * }>
115
126
  * ```
116
127
  */
117
- export class RenderError extends Data.TaggedError("RenderError") {
128
+ /** Format a cause for inclusion in error messages. */
129
+ const formatCause = (cause) => cause instanceof Error ? cause.message : String(cause);
130
+ export class RenderError extends Schema.TaggedError()("RenderError", {
131
+ /** The underlying error that caused the render failure */
132
+ cause: Schema.Unknown,
133
+ /** Name of the component that failed (if available) */
134
+ componentName: Schema.optional(Schema.String),
135
+ }) {
136
+ get message() {
137
+ const name = this.componentName ? ` in ${this.componentName}` : "";
138
+ return `RenderError${name}: ${formatCause(this.cause)}`;
139
+ }
118
140
  }
119
141
  /**
120
142
  * Error from a Stream component (before or after first emission).
@@ -123,13 +145,29 @@ export class RenderError extends Data.TaggedError("RenderError") {
123
145
  * - "before-first-emission": Stream failed before producing any value (shows fallback immediately)
124
146
  * - "after-first-emission": Stream failed after showing content (replaces content with fallback)
125
147
  */
126
- export class StreamError extends Data.TaggedError("StreamError") {
148
+ export class StreamError extends Schema.TaggedError()("StreamError", {
149
+ /** The underlying error that caused the stream failure */
150
+ cause: Schema.Unknown,
151
+ /** When the error occurred relative to first emission */
152
+ phase: Schema.Literal("before-first-emission", "after-first-emission"),
153
+ }) {
154
+ get message() {
155
+ return `StreamError (${this.phase}): ${formatCause(this.cause)}`;
156
+ }
127
157
  }
128
158
  /**
129
159
  * Error from an event handler Effect.
130
160
  *
131
161
  * The `eventType` field indicates which event triggered the failure (e.g., "click", "change").
132
162
  */
133
- export class EventHandlerError extends Data.TaggedError("EventHandlerError") {
163
+ export class EventHandlerError extends Schema.TaggedError()("EventHandlerError", {
164
+ /** The underlying error that caused the event handler failure */
165
+ cause: Schema.Unknown,
166
+ /** The DOM event type that triggered this handler (e.g., "click", "change") */
167
+ eventType: Schema.String,
168
+ }) {
169
+ get message() {
170
+ return `EventHandlerError (${this.eventType}): ${formatCause(this.cause)}`;
171
+ }
134
172
  }
135
173
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAI1C,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAKrD,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,EAGrE;CAAG;AA4HN;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,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CAAC,EAAE,CAAC;IACnE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,mBAAmB,EACnB;IACE,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CACF;IACC,IAAI,OAAO;QACT,OAAO,sBAAsB,IAAI,CAAC,SAAS,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7E,CAAC;CACF"}
@@ -4,20 +4,21 @@ import * as Scope from "effect/Scope";
4
4
  import { Atom, Registry as AtomRegistry } from "@effect-atom/atom";
5
5
  import { type VElement } from "./shared.js";
6
6
  import { FibraeRuntime } from "./runtime.js";
7
+ import { type LiveAtom } from "./live/atom.js";
7
8
  /**
8
9
  * Normalize component output to a Stream.
9
10
  * Components can return VElement, Effect<VElement, E>, or Stream<VElement, E>.
10
11
  * Error type is preserved through the conversion.
11
12
  */
12
- export declare const normalizeToStream: <E>(value: VElement | Effect.Effect<VElement, E, never> | Stream.Stream<VElement, E, never>) => Stream.Stream<VElement, E, never>;
13
+ export declare const normalizeToStream: <E>(value: Effect.Effect<VElement, E, never> | Stream.Stream<VElement, E, never> | VElement) => Stream.Stream<VElement, E, never>;
13
14
  /**
14
15
  * Create a tracking registry that records which atoms are accessed
15
16
  */
16
- export declare const makeTrackingRegistry: (realRegistry: AtomRegistry.Registry, accessedAtoms: Set<Atom.Atom<unknown>>) => AtomRegistry.Registry;
17
+ export declare const makeTrackingRegistry: (realRegistry: AtomRegistry.Registry, accessedAtoms: Set<Atom.Atom<unknown>>, accessedLiveAtoms?: Set<LiveAtom<any>> | undefined) => AtomRegistry.Registry;
17
18
  /**
18
19
  * Subscribe to atom changes for reactivity.
19
20
  * Uses registry.subscribe directly (like atom-react) instead of streams.
20
21
  * This is simpler and more efficient - subscriptions are synchronous
21
22
  * and cleanup is handled via scope finalizers.
22
23
  */
23
- export declare const subscribeToAtoms: (atoms: Set<Atom.Atom<unknown>>, onUpdate: () => void, runtime: FibraeRuntime, scope: Scope.Scope.Closeable) => Effect.Effect<void, never, never>;
24
+ export declare const subscribeToAtoms: (atoms: Set<Atom.Atom<unknown>>, onUpdate: () => void, runtime: FibraeRuntime, scope: Scope.CloseableScope) => Effect.Effect<void, never, never>;
package/dist/tracking.js CHANGED
@@ -4,6 +4,7 @@ import * as Scope from "effect/Scope";
4
4
  import { Atom, Registry as AtomRegistry } from "@effect-atom/atom";
5
5
  import { isStream } from "./shared.js";
6
6
  import { FibraeRuntime } from "./runtime.js";
7
+ import { isLiveAtom } from "./live/atom.js";
7
8
  // =============================================================================
8
9
  // Stream Normalization
9
10
  // =============================================================================
@@ -25,12 +26,16 @@ export const normalizeToStream = (value) => {
25
26
  /**
26
27
  * Create a tracking registry that records which atoms are accessed
27
28
  */
28
- export const makeTrackingRegistry = (realRegistry, accessedAtoms) => {
29
+ export const makeTrackingRegistry = (realRegistry, accessedAtoms, accessedLiveAtoms) => {
29
30
  return new Proxy(realRegistry, {
30
31
  get(target, prop, receiver) {
31
32
  if (prop === "get") {
32
33
  return (atom) => {
33
34
  accessedAtoms.add(atom);
35
+ // Also track live atoms if the set was provided
36
+ if (accessedLiveAtoms && isLiveAtom(atom)) {
37
+ accessedLiveAtoms.add(atom);
38
+ }
34
39
  return realRegistry.get(atom);
35
40
  };
36
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tracking.js","sourceRoot":"","sources":["../src/tracking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAiB,QAAQ,EAAE,MAAM,aAAa,CAAC;A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K,CAAC,YAAsB,EAAE;QACvC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnB,OAAO,CAAC,IAAwB,EAAE,EAAE;oBAClC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACxB,gDAAgD;oBAChD,IAAI,iBAAiB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC1C,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAC9B,CAAC;oBACD,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAChC,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;KACF,CAA0B,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAA8B,EAC9B,QAAoB,EACpB,OAAsB,EACtB,KAA4B,EACO,EAAE,CACrC,MAAM,CAAC,OAAO,CACZ,KAAK,EACL,CAAC,IAAI,EAAE,EAAE,CACP,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,uDAAuD;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,gDAAgD;IAChD,KAAK,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC,EACJ,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "fibrae",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Effect-first JSX renderer with automatic reactivity",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/DanielFGray/fibrae"
9
9
  },
10
+ "bin": {
11
+ "fibrae": "./dist/cli/cli.js"
12
+ },
10
13
  "files": [
11
14
  "dist"
12
15
  ],
@@ -38,27 +41,49 @@
38
41
  "./router": {
39
42
  "types": "./dist/router/index.d.ts",
40
43
  "import": "./dist/router/index.js"
44
+ },
45
+ "./live": {
46
+ "types": "./dist/live/index.d.ts",
47
+ "import": "./dist/live/index.js"
48
+ },
49
+ "./cli": {
50
+ "types": "./dist/cli/index.d.ts",
51
+ "import": "./dist/cli/index.js"
52
+ },
53
+ "./vite": {
54
+ "types": "./dist/cli/vite-plugin.d.ts",
55
+ "import": "./dist/cli/vite-plugin.js"
41
56
  }
42
57
  },
43
58
  "scripts": {
44
59
  "dev:server": "vite dev",
45
- "build:watch": "tsc --watch -p .",
46
- "build": "tsc -p .",
47
- "types:watch": "tsc -p . --noEmit --watch",
48
- "types:check": "tsc -p . --noEmit"
60
+ "format": "oxfmt src/",
61
+ "lint": "oxlint --tsconfig tsconfig.json src/",
62
+ "prebuild": "run-s format lint",
63
+ "build:watch": "tsgo --watch -p .",
64
+ "build": "tsgo -p .",
65
+ "types:watch": "tsgo -p . --noEmit --watch",
66
+ "types:check": "tsgo -p . --noEmit",
67
+ "effect:check": "effect-language-service diagnostics --project tsconfig.json",
68
+ "prepare": "effect-language-service patch --module tsc --module typescript"
49
69
  },
50
70
  "devDependencies": {
51
71
  "@effect/language-service": "catalog:",
52
- "typescript": "catalog:"
72
+ "@types/node": "^24.10.0",
73
+ "@typescript/native-preview": "^7.0.0-dev.20260314.1",
74
+ "typescript": "catalog:",
75
+ "vite": "^8.0.0"
53
76
  },
54
77
  "peerDependencies": {
55
78
  "@effect-atom/atom": "catalog:",
79
+ "@effect/platform": "catalog:",
56
80
  "effect": "catalog:"
57
81
  },
58
82
  "optionalDependencies": {
59
83
  "@effect/platform-browser": "catalog:",
60
84
  "@effect/platform-bun": "catalog:",
61
- "@effect/platform-node": "catalog:"
85
+ "@effect/platform-node": "catalog:",
86
+ "vite": "*"
62
87
  },
63
88
  "overrides": {
64
89
  "effect": "catalog:"
@@ -1,30 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import * as Scope from "effect/Scope";
3
- import * as Option from "effect/Option";
4
- import { type VElement, HydrationMismatch } from "./shared.js";
5
- import { FibraeRuntime } from "./runtime.js";
6
- /**
7
- * Hydrate a VElement tree by walking existing DOM nodes.
8
- *
9
- * This function:
10
- * - Matches VElement tree to existing DOM nodes positionally
11
- * - Attaches event handlers to existing elements
12
- * - Sets up atom subscriptions for reactivity
13
- * - Throws HydrationMismatch on structural mismatches
14
- * - Tolerates text/attribute differences (DOM wins)
15
- *
16
- * Uses cursor-based hydration: returns the next DOM sibling to process,
17
- * or None if no more siblings. This allows Suspense boundaries to
18
- * consume multiple DOM nodes (markers + content).
19
- *
20
- * @param vElement - Virtual element to hydrate
21
- * @param domNode - Existing DOM node to hydrate against
22
- * @param runtime - Fibrae runtime instance
23
- * @param parentScope - Optional scope for registering cleanup
24
- * @param path - Ancestor path for error messages
25
- * @returns Option containing the next sibling node after what was consumed
26
- */
27
- export declare const hydrateVElementToDOM: (vElement: VElement, domNode: Node, runtime: FibraeRuntime, parentScope?: Scope.Scope.Closeable, path?: Array<{
28
- tag: string;
29
- index: number;
30
- }>) => Effect.Effect<Option.Option<Node>, HydrationMismatch, never>;