@xmachines/play-react 2.0.0 → 2.1.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.
@@ -1,71 +1,72 @@
1
1
  /**
2
- * useSignalEffect - React hook for signal subscriptions with automatic cleanup
2
+ * useSignalEffect - the React hook that subscribes to a signal and cleans up by itself
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
6
  import type { DependencyList } from "react";
7
7
  /**
8
- * React hook that subscribes to signal changes and runs effect callback
8
+ * The React hook that subscribes to the signal changes and runs an effect callback
9
9
  *
10
- * Wraps the callback in a Signal.Computed to automatically track signal
11
- * dependencies accessed inside it, then delegates the watcher lifecycle
12
- * (microtask batching, re-arming, disposal) to `watchSignal` from
13
- * `@xmachines/play-signals` the single canonical implementation shared
14
- * across framework renderers.
10
+ * The hook puts the callback in a Signal.Computed, which tracks each signal that
11
+ * the callback reads. It then gives the watcher lifecycle to `watchSignal` from
12
+ * `@xmachines/play-signals`. That function does the microtask batching, the new arm
13
+ * of the watcher, and the disposal. It is the one canonical implementation, and
14
+ * every framework renderer uses it.
15
15
  *
16
16
  * Architecture:
17
- * - Uses Signal.Computed to wrap callback for automatic dependency tracking
18
- * - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29 memory safety)
19
- * - Microtask batching coalesces rapid signal updates
20
- * - Re-rendering is driven by the callback's own setState (see remarks)
21
- * - Handles cleanup on unmount to prevent memory leaks
17
+ * - The hook puts the callback in a Signal.Computed for the dependency tracking
18
+ * - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29, memory safety)
19
+ * - The microtask batching groups rapid signal updates
20
+ * - The callback triggers each new render with its own setState (see the remarks)
21
+ * - The hook cleans up on unmount, so that nothing stays in memory
22
22
  *
23
- * Invariant: Signal-Only Reactivity - Signals accessed in callback are watched.
24
- * Invariant: Passive Infrastructure - React observes signals and does not control them.
23
+ * Invariant: Signal-Only Reactivity. The hook watches each signal that the callback reads.
24
+ * Invariant: Passive Infrastructure. React observes the signals, and it does not control them.
25
25
  *
26
- * @param callback - Effect function that accesses signals. Can return cleanup function.
27
- * @param deps - Optional dependency list (like useEffect). When any dependency
28
- * changes, the watcher and Computed are torn down and recreated, re-tracking
29
- * signals from scratch. Defaults to `[]` (subscribe once per mount). Pass this
30
- * when the identity of the object whose signals you read can change over the
31
- * component's lifetime (e.g. an `actor` prop) otherwise the watcher keeps
32
- * tracking the OLD object's signals forever.
26
+ * @param callback - The effect function that reads the signals. It can return a cleanup function.
27
+ * @param deps - The optional dependency list, as in useEffect. On a change of one
28
+ * dependency, the hook removes the watcher and the Computed, then makes them again
29
+ * and tracks the signals from the start. The default is `[]`, which subscribes one
30
+ * time for each mount. Give this list when the identity of the object whose signals
31
+ * you read can change during the life of the component, for example an `actor`
32
+ * prop. Without the list, the watcher tracks the signals of the OLD object for
33
+ * ever.
33
34
  *
34
35
  * @example
35
36
  * ```typescript
36
37
  * const MyComponent = ({ actor }) => {
37
38
  * const [view, setView] = useState(null);
38
39
  *
39
- * // Subscribe to actor.currentView signal; re-subscribe if the actor swaps
40
+ * // Subscribe to the actor.currentView signal, and subscribe again on a new actor
40
41
  * useSignalEffect(() => {
41
42
  * const currentView = actor.currentView.get();
42
43
  * setView(currentView);
43
44
  * }, [actor]);
44
45
  *
45
- * return <div>{view?.component}</div>;
46
+ * return <div>{view?.root}</div>;
46
47
  * };
47
48
  * ```
48
49
  *
49
50
  * @remarks
50
- * **CRITICAL:** Signals must be accessed unconditionally (no if statements).
51
- * Conditional signal access breaks automatic dependency tracking.
51
+ * **CRITICAL:** read each signal unconditionally, with no `if` statement. A
52
+ * conditional read breaks the dependency tracking.
52
53
  *
53
- * **Performance:** Microtask batching (queueMicrotask, inside watchSignal)
54
- * prevents React thrashing when multiple signals update rapidly.
54
+ * **Performance:** the microtask batching (queueMicrotask, inside watchSignal)
55
+ * stops a flood of React renders when several signals update in rapid sequence.
55
56
  *
56
- * **Re-rendering:** the hook itself does NOT force a React render on signal
57
- * change the callback drives re-rendering by calling setState with the new
58
- * signal value (as in the example above). This lets React's setState bailout
59
- * skip renders when the derived value is unchanged; an unconditional
60
- * force-update here previously caused a wasted render per notification even
61
- * when the callback's setState bailed. If you need to re-render on every
62
- * notification while reading signals during render, mirror the signal value
63
- * into React state inside the callback.
57
+ * **Re-rendering:** the hook itself does NOT force a React render on a signal
58
+ * change. The callback triggers each new render, because it calls setState with the
59
+ * new signal value, as in the example above. The setState bailout of React can
60
+ * therefore skip a render when the derived value is the same. An unconditional
61
+ * force-update here caused one wasted render for each notification before, also
62
+ * when the setState of the callback made the bailout. If you must render again on
63
+ * every notification, and you read the signals during the render, copy the signal
64
+ * value into the React state inside the callback.
64
65
  *
65
- * **Implementation note:** We wrap the callback in Signal.Computed because
66
- * Signal.subtle.Watcher cannot automatically track arbitrary function calls.
67
- * The Computed handles dependency tracking; watchSignal evaluates it (which
68
- * runs the callback) whenever any tracked signal changes.
66
+ * **Implementation note:** the hook puts the callback in a Signal.Computed, because
67
+ * Signal.subtle.Watcher cannot track an arbitrary function call. The Computed does
68
+ * the dependency tracking. watchSignal evaluates the Computed, which runs the
69
+ * callback, on each change of a tracked signal.
69
70
  */
70
71
  export declare const useSignalEffect: (callback: () => void | (() => void), deps?: DependencyList) => void;
71
72
  //# sourceMappingURL=useSignalEffect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSignalEffect.d.ts","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,eAAO,MAAM,eAAe,GAC3B,UAAU,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EACnC,OAAM,cAAmB,KACvB,IA0CF,CAAC"}
1
+ {"version":3,"file":"useSignalEffect.d.ts","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,eAAe,GAC3B,UAAU,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EACnC,OAAM,cAAmB,KACvB,IA4CF,CAAC"}
@@ -1,109 +1,112 @@
1
1
  /**
2
- * useSignalEffect - React hook for signal subscriptions with automatic cleanup
2
+ * useSignalEffect - the React hook that subscribes to a signal and cleans up by itself
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
6
  import { useEffect, useRef } from "react";
7
7
  import { Signal, watchSignal } from "@xmachines/play-signals";
8
8
  /**
9
- * Marker symbol returned by effect Computed to satisfy type requirements
10
- * The actual value doesn't matter - we only care about side effects
9
+ * The marker symbol that the effect Computed returns, to satisfy the type.
10
+ * The value has no meaning. Only the side effects are important.
11
11
  */
12
12
  const EFFECT_RUN_MARKER = Symbol("effect-run");
13
13
  /**
14
- * React hook that subscribes to signal changes and runs effect callback
14
+ * The React hook that subscribes to the signal changes and runs an effect callback
15
15
  *
16
- * Wraps the callback in a Signal.Computed to automatically track signal
17
- * dependencies accessed inside it, then delegates the watcher lifecycle
18
- * (microtask batching, re-arming, disposal) to `watchSignal` from
19
- * `@xmachines/play-signals` the single canonical implementation shared
20
- * across framework renderers.
16
+ * The hook puts the callback in a Signal.Computed, which tracks each signal that
17
+ * the callback reads. It then gives the watcher lifecycle to `watchSignal` from
18
+ * `@xmachines/play-signals`. That function does the microtask batching, the new arm
19
+ * of the watcher, and the disposal. It is the one canonical implementation, and
20
+ * every framework renderer uses it.
21
21
  *
22
22
  * Architecture:
23
- * - Uses Signal.Computed to wrap callback for automatic dependency tracking
24
- * - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29 memory safety)
25
- * - Microtask batching coalesces rapid signal updates
26
- * - Re-rendering is driven by the callback's own setState (see remarks)
27
- * - Handles cleanup on unmount to prevent memory leaks
23
+ * - The hook puts the callback in a Signal.Computed for the dependency tracking
24
+ * - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29, memory safety)
25
+ * - The microtask batching groups rapid signal updates
26
+ * - The callback triggers each new render with its own setState (see the remarks)
27
+ * - The hook cleans up on unmount, so that nothing stays in memory
28
28
  *
29
- * Invariant: Signal-Only Reactivity - Signals accessed in callback are watched.
30
- * Invariant: Passive Infrastructure - React observes signals and does not control them.
29
+ * Invariant: Signal-Only Reactivity. The hook watches each signal that the callback reads.
30
+ * Invariant: Passive Infrastructure. React observes the signals, and it does not control them.
31
31
  *
32
- * @param callback - Effect function that accesses signals. Can return cleanup function.
33
- * @param deps - Optional dependency list (like useEffect). When any dependency
34
- * changes, the watcher and Computed are torn down and recreated, re-tracking
35
- * signals from scratch. Defaults to `[]` (subscribe once per mount). Pass this
36
- * when the identity of the object whose signals you read can change over the
37
- * component's lifetime (e.g. an `actor` prop) otherwise the watcher keeps
38
- * tracking the OLD object's signals forever.
32
+ * @param callback - The effect function that reads the signals. It can return a cleanup function.
33
+ * @param deps - The optional dependency list, as in useEffect. On a change of one
34
+ * dependency, the hook removes the watcher and the Computed, then makes them again
35
+ * and tracks the signals from the start. The default is `[]`, which subscribes one
36
+ * time for each mount. Give this list when the identity of the object whose signals
37
+ * you read can change during the life of the component, for example an `actor`
38
+ * prop. Without the list, the watcher tracks the signals of the OLD object for
39
+ * ever.
39
40
  *
40
41
  * @example
41
42
  * ```typescript
42
43
  * const MyComponent = ({ actor }) => {
43
44
  * const [view, setView] = useState(null);
44
45
  *
45
- * // Subscribe to actor.currentView signal; re-subscribe if the actor swaps
46
+ * // Subscribe to the actor.currentView signal, and subscribe again on a new actor
46
47
  * useSignalEffect(() => {
47
48
  * const currentView = actor.currentView.get();
48
49
  * setView(currentView);
49
50
  * }, [actor]);
50
51
  *
51
- * return <div>{view?.component}</div>;
52
+ * return <div>{view?.root}</div>;
52
53
  * };
53
54
  * ```
54
55
  *
55
56
  * @remarks
56
- * **CRITICAL:** Signals must be accessed unconditionally (no if statements).
57
- * Conditional signal access breaks automatic dependency tracking.
57
+ * **CRITICAL:** read each signal unconditionally, with no `if` statement. A
58
+ * conditional read breaks the dependency tracking.
58
59
  *
59
- * **Performance:** Microtask batching (queueMicrotask, inside watchSignal)
60
- * prevents React thrashing when multiple signals update rapidly.
60
+ * **Performance:** the microtask batching (queueMicrotask, inside watchSignal)
61
+ * stops a flood of React renders when several signals update in rapid sequence.
61
62
  *
62
- * **Re-rendering:** the hook itself does NOT force a React render on signal
63
- * change the callback drives re-rendering by calling setState with the new
64
- * signal value (as in the example above). This lets React's setState bailout
65
- * skip renders when the derived value is unchanged; an unconditional
66
- * force-update here previously caused a wasted render per notification even
67
- * when the callback's setState bailed. If you need to re-render on every
68
- * notification while reading signals during render, mirror the signal value
69
- * into React state inside the callback.
63
+ * **Re-rendering:** the hook itself does NOT force a React render on a signal
64
+ * change. The callback triggers each new render, because it calls setState with the
65
+ * new signal value, as in the example above. The setState bailout of React can
66
+ * therefore skip a render when the derived value is the same. An unconditional
67
+ * force-update here caused one wasted render for each notification before, also
68
+ * when the setState of the callback made the bailout. If you must render again on
69
+ * every notification, and you read the signals during the render, copy the signal
70
+ * value into the React state inside the callback.
70
71
  *
71
- * **Implementation note:** We wrap the callback in Signal.Computed because
72
- * Signal.subtle.Watcher cannot automatically track arbitrary function calls.
73
- * The Computed handles dependency tracking; watchSignal evaluates it (which
74
- * runs the callback) whenever any tracked signal changes.
72
+ * **Implementation note:** the hook puts the callback in a Signal.Computed, because
73
+ * Signal.subtle.Watcher cannot track an arbitrary function call. The Computed does
74
+ * the dependency tracking. watchSignal evaluates the Computed, which runs the
75
+ * callback, on each change of a tracked signal.
75
76
  */
76
77
  export const useSignalEffect = (callback, deps = []) => {
77
- // Store callback in a ref so the effect closure always calls the latest version
78
- // WITHOUT triggering watcher teardown/re-setup on each render (standard React ref pattern)
78
+ // A ref holds the callback. The closure of the effect therefore always calls the
79
+ // newest callback, and the code removes the watcher on each render NOT and installs it
80
+ // again NOT. This is the standard ref pattern of React.
79
81
  const callbackRef = useRef(callback);
80
- // Assignment outside useEffect keeps ref current without triggering re-effect
82
+ // The assignment is outside useEffect. The ref therefore holds the newest value, and no effect runs again
81
83
  callbackRef.current = callback;
82
84
  useEffect(() => {
83
85
  let cleanup;
84
- // Wrap callback in a Computed to automatically track dependencies
85
- // The Computed will re-evaluate when any accessed signal changes
86
+ // Put the callback in a Computed, which tracks each dependency.
87
+ // The Computed evaluates the callback again after a change of a signal that the
88
+ // callback reads.
86
89
  const effect = new Signal.Computed(() => {
87
- // Run cleanup from previous effect
90
+ // Run the cleanup of the previous effect
88
91
  if (typeof cleanup === "function")
89
92
  cleanup();
90
- // Run user callback via ref (always latest version, no dep churn)
93
+ // Run the callback of the user through the ref. It is always the newest one, and the deps therefore change not
91
94
  cleanup = callbackRef.current();
92
- // Return marker value (Computed requires a return value)
95
+ // Return the marker value, because a Computed requires a return value
93
96
  return EFFECT_RUN_MARKER;
94
97
  });
95
- // watchSignal owns the watcher lifecycle: microtask batching, disposed
96
- // guard, and re-arming after each notification (Phase 29 memory safety
97
- // lives there single source of truth, no copy-pasted watcher code).
98
- // Reading the Computed inside watchSignal re-evaluates it, which runs the
99
- // user callback; re-rendering is the callback's job (setState), so no
100
- // extra work is needed in onValue.
98
+ // watchSignal owns the lifecycle of the watcher: the batching in a microtask, the
99
+ // guard of a disposal, and the new arm after each notification. The memory safety of
100
+ // Phase 29 is there, in one place, and no file holds a copy of the watcher code.
101
+ // The read of the Computed inside watchSignal evaluates it again, and that run calls
102
+ // the callback of the user. The callback starts each new render with its setState.
103
+ // Therefore onValue needs no more work.
101
104
  const unwatch = watchSignal(effect, () => { });
102
- // Initial run of callback (via Computed)
105
+ // The first run of the callback, through the Computed
103
106
  effect.get();
104
- // Cleanup on unmount or deps change
107
+ // The cleanup, on an unmount and on a change of the deps
105
108
  return () => {
106
- // Stop receiving signal updates (idempotent, disposes pending microtasks)
109
+ // Stop the signal updates. The call is idempotent, and it disposes of each microtask that waits
107
110
  unwatch();
108
111
  if (typeof cleanup === "function")
109
112
  cleanup();
@@ -1 +1 @@
1
- {"version":3,"file":"useSignalEffect.js","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,QAAmC,EACnC,OAAuB,EAAE,EAClB,EAAE;IACT,gFAAgF;IAChF,2FAA2F;IAC3F,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,8EAA8E;IAC9E,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAA4B,CAAC;QAEjC,kEAAkE;QAClE,iEAAiE;QACjE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE;YACvC,mCAAmC;YACnC,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;YAE7C,kEAAkE;YAClE,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;YAEhC,yDAAyD;YACzD,OAAO,iBAAiB,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,uEAAuE;QACvE,uEAAuE;QACvE,sEAAsE;QACtE,0EAA0E;QAC1E,sEAAsE;QACtE,mCAAmC;QACnC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAE1E,yCAAyC;QACzC,MAAM,CAAC,GAAG,EAAE,CAAC;QAEb,oCAAoC;QACpC,OAAO,GAAG,EAAE;YACX,0EAA0E;YAC1E,OAAO,EAAE,CAAC;YACV,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;QAC9C,CAAC,CAAC;QACF,wHAAwH;IACzH,CAAC,EAAE,IAAI,CAAC,CAAC;AACV,CAAC,CAAC"}
1
+ {"version":3,"file":"useSignalEffect.js","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,QAAmC,EACnC,OAAuB,EAAE,EAClB,EAAE;IACT,iFAAiF;IACjF,uFAAuF;IACvF,wDAAwD;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,0GAA0G;IAC1G,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAA4B,CAAC;QAEjC,gEAAgE;QAChE,gFAAgF;QAChF,kBAAkB;QAClB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE;YACvC,yCAAyC;YACzC,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;YAE7C,+GAA+G;YAC/G,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;YAEhC,sEAAsE;YACtE,OAAO,iBAAiB,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,kFAAkF;QAClF,qFAAqF;QACrF,iFAAiF;QACjF,qFAAqF;QACrF,mFAAmF;QACnF,wCAAwC;QACxC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAE1E,sDAAsD;QACtD,MAAM,CAAC,GAAG,EAAE,CAAC;QAEb,yDAAyD;QACzD,OAAO,GAAG,EAAE;YACX,gGAAgG;YAChG,OAAO,EAAE,CAAC;YACV,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;QAC9C,CAAC,CAAC;QACF,wHAAwH;IACzH,CAAC,EAAE,IAAI,CAAC,CAAC;AACV,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-react",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "React renderer for XMachines Play architecture with signal-driven rendering",
5
5
  "keywords": [
6
6
  "actor",
@@ -43,13 +43,14 @@
43
43
  "lint": "oxlint .",
44
44
  "format": "oxfmt .",
45
45
  "test": "vitest",
46
+ "test:coverage": "vitest run --coverage",
46
47
  "test:vitest": "vitest run",
47
48
  "test:browser": "vitest --browser.enabled --browser.name=chromium test/browser"
48
49
  },
49
50
  "dependencies": {
50
- "@xmachines/play": "2.0.0",
51
- "@xmachines/play-actor": "2.0.0",
52
- "@xmachines/play-signals": "2.0.0"
51
+ "@xmachines/play": "2.1.0",
52
+ "@xmachines/play-actor": "2.1.0",
53
+ "@xmachines/play-signals": "2.1.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@testing-library/jest-dom": "^6.9.1",
package/dist/errors.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { PlayError } from "@xmachines/play";
2
- /**
3
- * Error class for renderer-level errors in the Play architecture.
4
- *
5
- * **Note (Phase 29):** `PlayErrorBoundary.componentDidCatch()` no longer throws
6
- * this error. Re-throwing from `componentDidCatch` can unmount the entire React 19
7
- * root. `RendererError` is retained for programmatic use in custom error handlers
8
- * and parent boundaries — it is no longer emitted by the built-in boundary itself.
9
- *
10
- * **Error code:** `PLAY_REACT_RENDER_ERROR`
11
- *
12
- * @example
13
- * ```typescript
14
- * import { RendererError } from "@xmachines/play-react/errors";
15
- *
16
- * // Create a RendererError programmatically in a custom boundary:
17
- * throw new RendererError("Custom render failure", { cause: originalError });
18
- * ```
19
- */
20
- export declare class RendererError extends PlayError {
21
- constructor(message: string, options?: ErrorOptions);
22
- }
23
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,SAAS;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAInD"}
package/dist/errors.js DELETED
@@ -1,26 +0,0 @@
1
- import { PlayError } from "@xmachines/play";
2
- /**
3
- * Error class for renderer-level errors in the Play architecture.
4
- *
5
- * **Note (Phase 29):** `PlayErrorBoundary.componentDidCatch()` no longer throws
6
- * this error. Re-throwing from `componentDidCatch` can unmount the entire React 19
7
- * root. `RendererError` is retained for programmatic use in custom error handlers
8
- * and parent boundaries — it is no longer emitted by the built-in boundary itself.
9
- *
10
- * **Error code:** `PLAY_REACT_RENDER_ERROR`
11
- *
12
- * @example
13
- * ```typescript
14
- * import { RendererError } from "@xmachines/play-react/errors";
15
- *
16
- * // Create a RendererError programmatically in a custom boundary:
17
- * throw new RendererError("Custom render failure", { cause: originalError });
18
- * ```
19
- */
20
- export class RendererError extends PlayError {
21
- constructor(message, options) {
22
- super("PlayRenderer", "PLAY_REACT_RENDER_ERROR", message, options);
23
- this.name = "RendererError";
24
- }
25
- }
26
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC3C,YAAY,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,cAAc,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC7B,CAAC;CACD"}