@warp-drive/react 5.9.0-alpha.2 → 5.9.0-alpha.20

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.
@@ -7,6 +7,9 @@ export declare function useWatcher(): {
7
7
  * @category Contexts
8
8
  */
9
9
  export declare const WatcherContext: Context<{
10
+ /**
11
+ * The `Signal.subtle.Watcher` used to observe signal changes for the nearest {@link ReactiveContext}.
12
+ */
10
13
  watcher: Signal.subtle.Watcher;
11
14
  } | null>;
12
15
  /**
@@ -70,6 +70,12 @@ interface RequestStates<
70
70
  features: ContentFeatures<RT>;
71
71
  }>;
72
72
  }
73
+ /**
74
+ * Throws the given error. Used internally to rethrow request errors that
75
+ * are not otherwise handled by a provided error/cancelled block.
76
+ *
77
+ * @private
78
+ */
73
79
  export declare function Throw({ error }: {
74
80
  error: Error;
75
81
  }): never;
@@ -1,3 +1,17 @@
1
1
  import { type HooksOptions, type SignalHooks } from "@warp-drive/core/configure";
2
+ /**
3
+ * Resolves once all pending requests started via WarpDrive's React signal
4
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
5
+ * a no-op otherwise.
6
+ *
7
+ * @public
8
+ */
2
9
  export declare function settled(): Promise<void>;
10
+ /**
11
+ * Builds the {@link SignalHooks} implementation backed by the
12
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
13
+ * used to wire WarpDrive's reactivity primitives into React.
14
+ *
15
+ * @public
16
+ */
3
17
  export declare function buildSignalConfig(options: HooksOptions): SignalHooks;
package/dist/index.js CHANGED
@@ -111,6 +111,12 @@ const DefaultChrome = ({
111
111
  children: children
112
112
  });
113
113
  };
114
+ /**
115
+ * Throws the given error. Used internally to rethrow request errors that
116
+ * are not otherwise handled by a provided error/cancelled block.
117
+ *
118
+ * @private
119
+ */
114
120
  function Throw({
115
121
  error
116
122
  }) {
package/dist/install.js CHANGED
@@ -40,6 +40,13 @@ function tryConsumeContext(signal) {
40
40
  }
41
41
  }
42
42
  let pending;
43
+ /**
44
+ * Resolves once all pending requests started via WarpDrive's React signal
45
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
46
+ * a no-op otherwise.
47
+ *
48
+ * @public
49
+ */
43
50
  async function settled() {
44
51
  if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
45
52
  // in testing mode we provide a test waiter integration
@@ -53,6 +60,14 @@ async function settled() {
53
60
  return settled();
54
61
  }
55
62
  }
63
+
64
+ /**
65
+ * Builds the {@link SignalHooks} implementation backed by the
66
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
67
+ * used to wire WarpDrive's reactivity primitives into React.
68
+ *
69
+ * @public
70
+ */
56
71
  function buildSignalConfig(options) {
57
72
  return {
58
73
  createSignal: (obj, key) => new Signal.State(macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? {
@@ -1,5 +1,5 @@
1
- import { R as ReactiveContext } from "./reactive-context-CTtwoaBx.js";
2
- export { W as WatcherContext } from "./reactive-context-CTtwoaBx.js";
1
+ import { R as ReactiveContext } from "./reactive-context-4Y50NyRg.js";
2
+ export { W as WatcherContext } from "./reactive-context-4Y50NyRg.js";
3
3
  import '@warp-drive/core';
4
4
  import { useMemo, createContext, use, useRef, useEffect } from 'react';
5
5
  import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
@@ -116,6 +116,12 @@ const DefaultChrome = ({
116
116
  children: children
117
117
  }, void 0, false);
118
118
  };
119
+ /**
120
+ * Throws the given error. Used internally to rethrow request errors that
121
+ * are not otherwise handled by a provided error/cancelled block.
122
+ *
123
+ * @private
124
+ */
119
125
  function Throw({
120
126
  error
121
127
  }) {
@@ -190,12 +196,12 @@ function Request($props) {
190
196
  ...$props
191
197
  }, void 0, false, {
192
198
  fileName: _jsxFileName,
193
- lineNumber: 174,
199
+ lineNumber: 180,
194
200
  columnNumber: 7
195
201
  }, this)
196
202
  }, void 0, false, {
197
203
  fileName: _jsxFileName,
198
- lineNumber: 173,
204
+ lineNumber: 179,
199
205
  columnNumber: 5
200
206
  }, this);
201
207
  }
@@ -267,57 +273,57 @@ function InternalRequest($props) {
267
273
  // prettier-ignore
268
274
  state.isIdle && slots.idle ? /*#__PURE__*/jsxDEV(slots.idle, {}, void 0, false, {
269
275
  fileName: _jsxFileName,
270
- lineNumber: 258,
276
+ lineNumber: 264,
271
277
  columnNumber: 38
272
278
  }, this) : state.isIdle ? /*#__PURE__*/jsxDEV(Throw, {
273
279
  error: IdleBlockMissingError
274
280
  }, void 0, false, {
275
281
  fileName: _jsxFileName,
276
- lineNumber: 259,
282
+ lineNumber: 265,
277
283
  columnNumber: 28
278
284
  }, this) : state.reqState.isLoading ? slots.loading ? /*#__PURE__*/jsxDEV(slots.loading, {
279
285
  state: state.reqState.loadingState
280
286
  }, void 0, false, {
281
287
  fileName: _jsxFileName,
282
- lineNumber: 260,
288
+ lineNumber: 266,
283
289
  columnNumber: 56
284
290
  }, this) : '' : state.reqState.isCancelled && slots.cancelled ? /*#__PURE__*/jsxDEV(slots.cancelled, {
285
291
  error: state.reqState.reason,
286
292
  features: state.errorFeatures
287
293
  }, void 0, false, {
288
294
  fileName: _jsxFileName,
289
- lineNumber: 261,
295
+ lineNumber: 267,
290
296
  columnNumber: 61
291
297
  }, this) : state.reqState.isError && slots.error ? /*#__PURE__*/jsxDEV(slots.error, {
292
298
  error: state.reqState.reason,
293
299
  features: state.errorFeatures
294
300
  }, void 0, false, {
295
301
  fileName: _jsxFileName,
296
- lineNumber: 262,
302
+ lineNumber: 268,
297
303
  columnNumber: 53
298
304
  }, this) : state.reqState.isSuccess ? slots.content ? /*#__PURE__*/jsxDEV(slots.content, {
299
305
  result: state.reqState.value,
300
306
  features: state.contentFeatures
301
307
  }, void 0, false, {
302
308
  fileName: _jsxFileName,
303
- lineNumber: 263,
309
+ lineNumber: 269,
304
310
  columnNumber: 56
305
311
  }, this) : /*#__PURE__*/jsxDEV(Throw, {
306
312
  error: new Error('No content block provided for <Request> component.')
307
313
  }, void 0, false, {
308
314
  fileName: _jsxFileName,
309
- lineNumber: 263,
315
+ lineNumber: 269,
310
316
  columnNumber: 139
311
317
  }, this) : !state.reqState.isCancelled ? /*#__PURE__*/jsxDEV(Throw, {
312
318
  error: state.reqState.reason
313
319
  }, void 0, false, {
314
320
  fileName: _jsxFileName,
315
- lineNumber: 264,
321
+ lineNumber: 270,
316
322
  columnNumber: 43
317
323
  }, this) : '' // never
318
324
  }, void 0, false, {
319
325
  fileName: _jsxFileName,
320
- lineNumber: 255,
326
+ lineNumber: 261,
321
327
  columnNumber: 5
322
328
  }, this);
323
329
  }
@@ -1,7 +1,7 @@
1
1
  import { use } from 'react';
2
2
  import { Signal } from 'signal-polyfill';
3
3
  import { setupSignals } from '@warp-drive/core/configure';
4
- import { g as getGlobalConfig, W as WatcherContext } from "./reactive-context-CTtwoaBx.js";
4
+ import { g as getGlobalConfig, W as WatcherContext } from "./reactive-context-4Y50NyRg.js";
5
5
 
6
6
  /**
7
7
  * {@include ./install.md}
@@ -39,6 +39,13 @@ function tryConsumeContext(signal) {
39
39
  }
40
40
  }
41
41
  let pending;
42
+ /**
43
+ * Resolves once all pending requests started via WarpDrive's React signal
44
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
45
+ * a no-op otherwise.
46
+ *
47
+ * @public
48
+ */
42
49
  async function settled() {
43
50
  {
44
51
  // in testing mode we provide a test waiter integration
@@ -52,6 +59,14 @@ async function settled() {
52
59
  return settled();
53
60
  }
54
61
  }
62
+
63
+ /**
64
+ * Builds the {@link SignalHooks} implementation backed by the
65
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
66
+ * used to wire WarpDrive's reactivity primitives into React.
67
+ *
68
+ * @public
69
+ */
55
70
  function buildSignalConfig(options) {
56
71
  return {
57
72
  createSignal: (obj, key) => new Signal.State({
@@ -23,7 +23,23 @@ function config(packageRoot) {
23
23
  function getGlobalConfig() {
24
24
  return runtimeConfig.global;
25
25
  }
26
- const runtimeConfig = initializeRuntimeMacrosConfig();
26
+
27
+ // Welcome intrepid developer!
28
+ //
29
+ // While this data is "global", this is a private variable.
30
+ //
31
+ // do not build features based off of its contents,
32
+ // or assume it will have the same name in future releases.
33
+ const runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};
34
+ runtimeConfig.packages ||= {};
35
+ runtimeConfig.global ||= {};
36
+
37
+ // In the off chance there are duplicate copies of @embroider/macros in the dep graph
38
+ // (due to the package manager messing up)
39
+ // Let's try to merge them together via the above global well known variable
40
+ const localConfig = initializeRuntimeMacrosConfig();
41
+ Object.assign(runtimeConfig.packages, localConfig.packages);
42
+ Object.assign(runtimeConfig.global, localConfig.global);
27
43
 
28
44
  // this exists to be targeted by our babel plugin
29
45
  function initializeRuntimeMacrosConfig() {
@@ -283,7 +299,7 @@ function ReactiveContext({
283
299
  children: children
284
300
  }, void 0, false, {
285
301
  fileName: _jsxFileName,
286
- lineNumber: 159,
302
+ lineNumber: 164,
287
303
  columnNumber: 10
288
304
  }, this);
289
305
  }
@@ -1,5 +1,5 @@
1
- import { R as ReactiveContext } from "./reactive-context-sqyJMb7I.js";
2
- export { W as WatcherContext } from "./reactive-context-sqyJMb7I.js";
1
+ import { R as ReactiveContext } from "./reactive-context-D54NwOLZ.js";
2
+ export { W as WatcherContext } from "./reactive-context-D54NwOLZ.js";
3
3
  import '@warp-drive/core';
4
4
  import { useMemo, createContext, use, useRef, useEffect } from 'react';
5
5
  import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
@@ -116,6 +116,12 @@ const DefaultChrome = ({
116
116
  children: children
117
117
  }, void 0, false);
118
118
  };
119
+ /**
120
+ * Throws the given error. Used internally to rethrow request errors that
121
+ * are not otherwise handled by a provided error/cancelled block.
122
+ *
123
+ * @private
124
+ */
119
125
  function Throw({
120
126
  error
121
127
  }) {
@@ -190,12 +196,12 @@ function Request($props) {
190
196
  ...$props
191
197
  }, void 0, false, {
192
198
  fileName: _jsxFileName,
193
- lineNumber: 174,
199
+ lineNumber: 180,
194
200
  columnNumber: 7
195
201
  }, this)
196
202
  }, void 0, false, {
197
203
  fileName: _jsxFileName,
198
- lineNumber: 173,
204
+ lineNumber: 179,
199
205
  columnNumber: 5
200
206
  }, this);
201
207
  }
@@ -267,57 +273,57 @@ function InternalRequest($props) {
267
273
  // prettier-ignore
268
274
  state.isIdle && slots.idle ? /*#__PURE__*/jsxDEV(slots.idle, {}, void 0, false, {
269
275
  fileName: _jsxFileName,
270
- lineNumber: 258,
276
+ lineNumber: 264,
271
277
  columnNumber: 38
272
278
  }, this) : state.isIdle ? /*#__PURE__*/jsxDEV(Throw, {
273
279
  error: IdleBlockMissingError
274
280
  }, void 0, false, {
275
281
  fileName: _jsxFileName,
276
- lineNumber: 259,
282
+ lineNumber: 265,
277
283
  columnNumber: 28
278
284
  }, this) : state.reqState.isLoading ? slots.loading ? /*#__PURE__*/jsxDEV(slots.loading, {
279
285
  state: state.reqState.loadingState
280
286
  }, void 0, false, {
281
287
  fileName: _jsxFileName,
282
- lineNumber: 260,
288
+ lineNumber: 266,
283
289
  columnNumber: 56
284
290
  }, this) : '' : state.reqState.isCancelled && slots.cancelled ? /*#__PURE__*/jsxDEV(slots.cancelled, {
285
291
  error: state.reqState.reason,
286
292
  features: state.errorFeatures
287
293
  }, void 0, false, {
288
294
  fileName: _jsxFileName,
289
- lineNumber: 261,
295
+ lineNumber: 267,
290
296
  columnNumber: 61
291
297
  }, this) : state.reqState.isError && slots.error ? /*#__PURE__*/jsxDEV(slots.error, {
292
298
  error: state.reqState.reason,
293
299
  features: state.errorFeatures
294
300
  }, void 0, false, {
295
301
  fileName: _jsxFileName,
296
- lineNumber: 262,
302
+ lineNumber: 268,
297
303
  columnNumber: 53
298
304
  }, this) : state.reqState.isSuccess ? slots.content ? /*#__PURE__*/jsxDEV(slots.content, {
299
305
  result: state.reqState.value,
300
306
  features: state.contentFeatures
301
307
  }, void 0, false, {
302
308
  fileName: _jsxFileName,
303
- lineNumber: 263,
309
+ lineNumber: 269,
304
310
  columnNumber: 56
305
311
  }, this) : /*#__PURE__*/jsxDEV(Throw, {
306
312
  error: new Error('No content block provided for <Request> component.')
307
313
  }, void 0, false, {
308
314
  fileName: _jsxFileName,
309
- lineNumber: 263,
315
+ lineNumber: 269,
310
316
  columnNumber: 139
311
317
  }, this) : !state.reqState.isCancelled ? /*#__PURE__*/jsxDEV(Throw, {
312
318
  error: state.reqState.reason
313
319
  }, void 0, false, {
314
320
  fileName: _jsxFileName,
315
- lineNumber: 264,
321
+ lineNumber: 270,
316
322
  columnNumber: 43
317
323
  }, this) : '' // never
318
324
  }, void 0, false, {
319
325
  fileName: _jsxFileName,
320
- lineNumber: 255,
326
+ lineNumber: 261,
321
327
  columnNumber: 5
322
328
  }, this);
323
329
  }
@@ -1,7 +1,7 @@
1
1
  import { use } from 'react';
2
2
  import { Signal } from 'signal-polyfill';
3
3
  import { setupSignals } from '@warp-drive/core/configure';
4
- import { g as getGlobalConfig, W as WatcherContext } from "./reactive-context-sqyJMb7I.js";
4
+ import { g as getGlobalConfig, W as WatcherContext } from "./reactive-context-D54NwOLZ.js";
5
5
 
6
6
  /**
7
7
  * {@include ./install.md}
@@ -39,6 +39,13 @@ function tryConsumeContext(signal) {
39
39
  }
40
40
  }
41
41
  let pending;
42
+ /**
43
+ * Resolves once all pending requests started via WarpDrive's React signal
44
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
45
+ * a no-op otherwise.
46
+ *
47
+ * @public
48
+ */
42
49
  async function settled() {
43
50
  {
44
51
  // in testing mode we provide a test waiter integration
@@ -52,6 +59,14 @@ async function settled() {
52
59
  return settled();
53
60
  }
54
61
  }
62
+
63
+ /**
64
+ * Builds the {@link SignalHooks} implementation backed by the
65
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
66
+ * used to wire WarpDrive's reactivity primitives into React.
67
+ *
68
+ * @public
69
+ */
55
70
  function buildSignalConfig(options) {
56
71
  return {
57
72
  createSignal: (obj, key) => new Signal.State({
@@ -23,7 +23,23 @@ function config(packageRoot) {
23
23
  function getGlobalConfig() {
24
24
  return runtimeConfig.global;
25
25
  }
26
- const runtimeConfig = initializeRuntimeMacrosConfig();
26
+
27
+ // Welcome intrepid developer!
28
+ //
29
+ // While this data is "global", this is a private variable.
30
+ //
31
+ // do not build features based off of its contents,
32
+ // or assume it will have the same name in future releases.
33
+ const runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};
34
+ runtimeConfig.packages ||= {};
35
+ runtimeConfig.global ||= {};
36
+
37
+ // In the off chance there are duplicate copies of @embroider/macros in the dep graph
38
+ // (due to the package manager messing up)
39
+ // Let's try to merge them together via the above global well known variable
40
+ const localConfig = initializeRuntimeMacrosConfig();
41
+ Object.assign(runtimeConfig.packages, localConfig.packages);
42
+ Object.assign(runtimeConfig.global, localConfig.global);
27
43
 
28
44
  // this exists to be targeted by our babel plugin
29
45
  function initializeRuntimeMacrosConfig() {
@@ -283,7 +299,7 @@ function ReactiveContext({
283
299
  children: children
284
300
  }, void 0, false, {
285
301
  fileName: _jsxFileName,
286
- lineNumber: 159,
302
+ lineNumber: 164,
287
303
  columnNumber: 10
288
304
  }, this);
289
305
  }
@@ -105,6 +105,12 @@ const DefaultChrome = ({
105
105
  children: children
106
106
  });
107
107
  };
108
+ /**
109
+ * Throws the given error. Used internally to rethrow request errors that
110
+ * are not otherwise handled by a provided error/cancelled block.
111
+ *
112
+ * @private
113
+ */
108
114
  function Throw({
109
115
  error
110
116
  }) {
@@ -26,7 +26,22 @@ function tryConsumeContext(signal) {
26
26
  // so we just ignore it.
27
27
  }
28
28
  }
29
+ /**
30
+ * Resolves once all pending requests started via WarpDrive's React signal
31
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
32
+ * a no-op otherwise.
33
+ *
34
+ * @public
35
+ */
29
36
  async function settled() {}
37
+
38
+ /**
39
+ * Builds the {@link SignalHooks} implementation backed by the
40
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
41
+ * used to wire WarpDrive's reactivity primitives into React.
42
+ *
43
+ * @public
44
+ */
30
45
  function buildSignalConfig(options) {
31
46
  return {
32
47
  createSignal: (obj, key) => new Signal.State(null, {
@@ -105,6 +105,12 @@ const DefaultChrome = ({
105
105
  children: children
106
106
  });
107
107
  };
108
+ /**
109
+ * Throws the given error. Used internally to rethrow request errors that
110
+ * are not otherwise handled by a provided error/cancelled block.
111
+ *
112
+ * @private
113
+ */
108
114
  function Throw({
109
115
  error
110
116
  }) {
@@ -26,7 +26,22 @@ function tryConsumeContext(signal) {
26
26
  // so we just ignore it.
27
27
  }
28
28
  }
29
+ /**
30
+ * Resolves once all pending requests started via WarpDrive's React signal
31
+ * integration have settled. Only tracks requests while `TESTING` is enabled;
32
+ * a no-op otherwise.
33
+ *
34
+ * @public
35
+ */
29
36
  async function settled() {}
37
+
38
+ /**
39
+ * Builds the {@link SignalHooks} implementation backed by the
40
+ * [Signal Polyfill](https://github.com/proposal-signals/signal-polyfill),
41
+ * used to wire WarpDrive's reactivity primitives into React.
42
+ *
43
+ * @public
44
+ */
30
45
  function buildSignalConfig(options) {
31
46
  return {
32
47
  createSignal: (obj, key) => new Signal.State(null, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@warp-drive/react",
3
3
  "description": "Data bindings and utilities for React applications using WarpDrive",
4
- "version": "5.9.0-alpha.2",
4
+ "version": "5.9.0-alpha.20",
5
5
  "license": "MIT",
6
6
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
7
7
  "repository": {
@@ -43,27 +43,26 @@
43
43
  "default": "./dist/*.js"
44
44
  }
45
45
  },
46
- "peerDependencies": {},
47
46
  "dependencies": {
48
- "@embroider/macros": "^1.19.6",
49
- "@warp-drive/core": "5.9.0-alpha.2",
50
- "@warp-drive/tc39-proposal-signals": "5.9.0-alpha.2",
51
- "signal-polyfill": "^0.2.2",
52
- "react": "^19.1.1"
47
+ "@embroider/macros": "^1.20.6",
48
+ "@warp-drive/core": "5.9.0-alpha.20",
49
+ "@warp-drive/tc39-proposal-signals": "5.9.0-alpha.20",
50
+ "react": "^19.1.1",
51
+ "signal-polyfill": "^0.2.2"
53
52
  },
54
53
  "peerDependenciesMeta": {},
55
54
  "devDependencies": {
56
55
  "@babel/core": "^7.28.3",
57
56
  "@babel/plugin-transform-typescript": "^7.28.0",
58
57
  "@babel/preset-env": "^7.28.3",
59
- "@babel/preset-typescript": "^7.27.1",
60
58
  "@babel/preset-react": "^7.27.1",
59
+ "@babel/preset-typescript": "^7.27.1",
61
60
  "@babel/runtime": "^7.28.3",
62
- "decorator-transforms": "^2.3.0",
63
61
  "@embroider/addon-dev": "^8.1.0",
64
- "@warp-drive/internal-config": "5.9.0-alpha.2",
65
- "@warp-drive/core": "5.9.0-alpha.2",
66
62
  "@types/react": "^19.1.11",
63
+ "@warp-drive/core": "5.9.0-alpha.20",
64
+ "@warp-drive/internal-config": "5.9.0-alpha.20",
65
+ "decorator-transforms": "^2.3.0",
67
66
  "react": "^19.1.1",
68
67
  "rollup": "^4.48.0",
69
68
  "typescript": "^5.9.3",