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

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 (45) hide show
  1. package/dist/index.d.ts +180 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +215 -256
  4. package/dist/index.js.map +1 -0
  5. package/dist/install.d.ts +21 -0
  6. package/dist/install.d.ts.map +1 -0
  7. package/dist/install.js +88 -107
  8. package/dist/install.js.map +1 -0
  9. package/dist/reactive-context-DNq02nr1.js +122 -0
  10. package/dist/reactive-context-DNq02nr1.js.map +1 -0
  11. package/dist/unpkg/dev/index.js +259 -304
  12. package/dist/unpkg/dev/index.js.map +1 -0
  13. package/dist/unpkg/dev/install.js +80 -105
  14. package/dist/unpkg/dev/install.js.map +1 -0
  15. package/dist/unpkg/dev/reactive-context-ir4_7OCl.js +218 -0
  16. package/dist/unpkg/dev/reactive-context-ir4_7OCl.js.map +1 -0
  17. package/dist/unpkg/dev-deprecated/index.js +259 -304
  18. package/dist/unpkg/dev-deprecated/index.js.map +1 -0
  19. package/dist/unpkg/dev-deprecated/install.js +80 -105
  20. package/dist/unpkg/dev-deprecated/install.js.map +1 -0
  21. package/dist/unpkg/dev-deprecated/reactive-context-CBrZV0cR.js +218 -0
  22. package/dist/unpkg/dev-deprecated/reactive-context-CBrZV0cR.js.map +1 -0
  23. package/dist/unpkg/prod/index.js +198 -231
  24. package/dist/unpkg/prod/index.js.map +1 -0
  25. package/dist/unpkg/prod/install.js +54 -61
  26. package/dist/unpkg/prod/install.js.map +1 -0
  27. package/dist/unpkg/prod/reactive-context-CvfXAZqb.js +92 -0
  28. package/dist/unpkg/prod/reactive-context-CvfXAZqb.js.map +1 -0
  29. package/dist/unpkg/prod-deprecated/index.js +198 -231
  30. package/dist/unpkg/prod-deprecated/index.js.map +1 -0
  31. package/dist/unpkg/prod-deprecated/install.js +54 -61
  32. package/dist/unpkg/prod-deprecated/install.js.map +1 -0
  33. package/dist/unpkg/prod-deprecated/reactive-context-CvfXAZqb.js +92 -0
  34. package/dist/unpkg/prod-deprecated/reactive-context-CvfXAZqb.js.map +1 -0
  35. package/package.json +15 -17
  36. package/declarations/-private/reactive-context.d.ts +0 -21
  37. package/declarations/-private/request.d.ts +0 -148
  38. package/declarations/-private/store-provider.d.ts +0 -19
  39. package/declarations/index.d.ts +0 -7
  40. package/declarations/install.d.ts +0 -17
  41. package/dist/reactive-context-ClTRYXie.js +0 -154
  42. package/dist/unpkg/dev/reactive-context-4Y50NyRg.js +0 -306
  43. package/dist/unpkg/dev-deprecated/reactive-context-D54NwOLZ.js +0 -306
  44. package/dist/unpkg/prod/reactive-context-DKimDkR3.js +0 -110
  45. package/dist/unpkg/prod-deprecated/reactive-context-DKimDkR3.js +0 -110
@@ -1,330 +1,285 @@
1
- import { R as ReactiveContext } from "./reactive-context-4Y50NyRg.js";
2
- export { W as WatcherContext } from "./reactive-context-4Y50NyRg.js";
3
- import '@warp-drive/core';
4
- import { useMemo, createContext, use, useRef, useEffect } from 'react';
5
- import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
6
- import { createRequestSubscription } from '@warp-drive/core/reactive';
7
- import { DISPOSE, signal } from '@warp-drive/core/signals/-leaked';
8
- import '@warp-drive/core/request';
9
- var _jsxFileName$1 = "/home/runner/work/warp-drive/warp-drive/warp-drive-packages/react/src/-private/store-provider.tsx";
10
- const StoreContext = /*#__PURE__*/createContext(null);
1
+ import { n as WatcherContext, t as ReactiveContext } from "./reactive-context-ir4_7OCl.js";
2
+ import { createContext, use, useEffect, useMemo, useRef } from "react";
3
+ import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
4
+ import { createRequestSubscription } from "@warp-drive/core/reactive";
5
+ import { DISPOSE, signal } from "@warp-drive/core/signals/-leaked";
11
6
 
7
+ //#region src/-private/store-provider.tsx
8
+ /**
9
+ * @category Contexts
10
+ */
11
+ var _jsxFileName$1 = "/home/runner/work/warp-drive/warp-drive/warp-drive-packages/react/src/-private/store-provider.tsx";
12
+ const StoreContext = /*#__PURE__*/ createContext(null);
12
13
  /**
13
- * @category Hooks
14
- */
14
+ * @category Hooks
15
+ */
15
16
  function useStore() {
16
- const store = use(StoreContext);
17
- (test => {
18
- if (!test) {
19
- throw new Error("No Store provided via context. Please ensure you are using <StoreProvider> to provide a Store instance.");
20
- }
21
- })(store);
22
- return store;
17
+ const store = use(StoreContext);
18
+ ((test) => {
19
+ if (!test) throw new Error("No Store provided via context. Please ensure you are using <StoreProvider> to provide a Store instance.");
20
+ })(store);
21
+ return store;
23
22
  }
24
23
  /**
25
- * @category Components
26
- */
24
+ * @category Components
25
+ */
27
26
  function StoreProvider($props) {
28
- const store = useMemo(() => "store" in $props ? $props.store : new $props.Store(), ["store" in $props ? $props.store : $props.Store]);
29
- return /*#__PURE__*/jsxDEV(StoreContext, {
30
- value: store,
31
- children: $props.children
32
- }, void 0, false, {
33
- fileName: _jsxFileName$1,
34
- lineNumber: 34,
35
- columnNumber: 10
36
- }, this);
27
+ const store = useMemo(() => "store" in $props ? $props.store : new $props.Store(), ["store" in $props ? $props.store : $props.Store]);
28
+ return /*#__PURE__*/ jsxDEV(StoreContext, {
29
+ value: store,
30
+ children: $props.children
31
+ }, void 0, false, {
32
+ fileName: _jsxFileName$1,
33
+ lineNumber: 34,
34
+ columnNumber: 10
35
+ }, this);
37
36
  }
38
- const deferred = /* @__PURE__ */new WeakMap();
37
+
38
+ //#endregion
39
+ //#region ../../node_modules/.pnpm/decorat_5005bbc272376d25df08203abab44e2f/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js
40
+ const deferred = /* @__PURE__ */ new WeakMap();
39
41
  function deferDecorator(proto, prop, desc) {
40
- let map = deferred.get(proto);
41
- if (!map) {
42
- map = /* @__PURE__ */new Map();
43
- deferred.set(proto, map);
44
- }
45
- map.set(prop, desc);
42
+ let map = deferred.get(proto);
43
+ if (!map) {
44
+ map = /* @__PURE__ */ new Map();
45
+ deferred.set(proto, map);
46
+ }
47
+ map.set(prop, desc);
46
48
  }
47
49
  function findDeferredDecorator(target, prop) {
48
- var _a;
49
- let cursor = target.prototype;
50
- while (cursor) {
51
- let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);
52
- if (desc) {
53
- return desc;
54
- }
55
- cursor = cursor.prototype;
56
- }
50
+ var _a;
51
+ let cursor = target.prototype;
52
+ while (cursor) {
53
+ let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);
54
+ if (desc) return desc;
55
+ cursor = cursor.prototype;
56
+ }
57
57
  }
58
58
  function decorateFieldV2(prototype, prop, decorators, initializer) {
59
- let desc = {
60
- configurable: true,
61
- enumerable: true,
62
- writable: true,
63
- initializer: null
64
- };
65
- if (initializer) {
66
- desc.initializer = initializer;
67
- }
68
- for (let decorator of decorators) {
69
- desc = decorator(prototype, prop, desc) || desc;
70
- }
71
- if (desc.initializer === void 0) {
72
- Object.defineProperty(prototype, prop, desc);
73
- } else {
74
- deferDecorator(prototype, prop, desc);
75
- }
59
+ let desc = {
60
+ configurable: true,
61
+ enumerable: true,
62
+ writable: true,
63
+ initializer: null
64
+ };
65
+ if (initializer) desc.initializer = initializer;
66
+ for (let decorator of decorators) desc = decorator(prototype, prop, desc) || desc;
67
+ if (desc.initializer === void 0) Object.defineProperty(prototype, prop, desc);
68
+ else deferDecorator(prototype, prop, desc);
76
69
  }
77
70
  function initializeDeferredDecorator(target, prop) {
78
- let desc = findDeferredDecorator(target.constructor, prop);
79
- if (desc) {
80
- Object.defineProperty(target, prop, {
81
- enumerable: desc.enumerable,
82
- configurable: desc.configurable,
83
- writable: desc.writable,
84
- value: desc.initializer ? desc.initializer.call(target) : void 0
85
- });
86
- }
71
+ let desc = findDeferredDecorator(target.constructor, prop);
72
+ if (desc) Object.defineProperty(target, prop, {
73
+ enumerable: desc.enumerable,
74
+ configurable: desc.configurable,
75
+ writable: desc.writable,
76
+ value: desc.initializer ? desc.initializer.call(target) : void 0
77
+ });
87
78
  }
79
+
80
+ //#endregion
81
+ //#region src/-private/request.tsx
88
82
  var _jsxFileName = "/home/runner/work/warp-drive/warp-drive/warp-drive-packages/react/src/-private/request.tsx";
89
- const IdleBlockMissingError = new Error("No idle block provided for <Request> component, and no query or request was provided.");
90
- class ReactiveArgs {
91
- static {
92
- decorateFieldV2(this.prototype, "request", [signal]);
93
- }
94
- #request = (initializeDeferredDecorator(this, "request"), void 0);
95
- static {
96
- decorateFieldV2(this.prototype, "query", [signal]);
97
- }
98
- #query = (initializeDeferredDecorator(this, "query"), void 0);
99
- static {
100
- decorateFieldV2(this.prototype, "autorefresh", [signal]);
101
- }
102
- #autorefresh = (initializeDeferredDecorator(this, "autorefresh"), void 0);
103
- static {
104
- decorateFieldV2(this.prototype, "autorefreshThreshold", [signal]);
105
- }
106
- #autorefreshThreshold = (initializeDeferredDecorator(this, "autorefreshThreshold"), void 0);
107
- static {
108
- decorateFieldV2(this.prototype, "autorefreshBehavior", [signal]);
109
- }
110
- #autorefreshBehavior = (initializeDeferredDecorator(this, "autorefreshBehavior"), void 0);
111
- }
112
- const DefaultChrome = ({
113
- children
114
- }) => {
115
- return /*#__PURE__*/jsxDEV(Fragment, {
116
- children: children
117
- }, void 0, false);
83
+ const IdleBlockMissingError = /* @__PURE__ */ new Error("No idle block provided for <Request> component, and no query or request was provided.");
84
+ var ReactiveArgs = class {
85
+ static {
86
+ decorateFieldV2(this.prototype, "request", [signal]);
87
+ }
88
+ #request = (initializeDeferredDecorator(this, "request"), void 0);
89
+ static {
90
+ decorateFieldV2(this.prototype, "query", [signal]);
91
+ }
92
+ #query = (initializeDeferredDecorator(this, "query"), void 0);
93
+ static {
94
+ decorateFieldV2(this.prototype, "autorefresh", [signal]);
95
+ }
96
+ #autorefresh = (initializeDeferredDecorator(this, "autorefresh"), void 0);
97
+ static {
98
+ decorateFieldV2(this.prototype, "autorefreshThreshold", [signal]);
99
+ }
100
+ #autorefreshThreshold = (initializeDeferredDecorator(this, "autorefreshThreshold"), void 0);
101
+ static {
102
+ decorateFieldV2(this.prototype, "autorefreshBehavior", [signal]);
103
+ }
104
+ #autorefreshBehavior = (initializeDeferredDecorator(this, "autorefreshBehavior"), void 0);
105
+ };
106
+ const DefaultChrome = ({ children }) => {
107
+ return /*#__PURE__*/ jsxDEV(Fragment, { children }, void 0, false);
118
108
  };
119
109
  /**
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
- */
125
- function Throw({
126
- error
127
- }) {
128
- throw error;
110
+ * Throws the given error. Used internally to rethrow request errors that
111
+ * are not otherwise handled by a provided error/cancelled block.
112
+ *
113
+ * @private
114
+ */
115
+ function Throw({ error }) {
116
+ throw error;
129
117
  }
130
-
131
118
  /**
132
- * The `<Request />` component is a powerful tool for managing data fetching and
133
- * state in your React application. It provides a declarative approach to reactive
134
- * control-flow for managing requests and state in your application.
135
- *
136
- * The `<Request />` component is ideal for handling "boundaries", outside which some
137
- * state is still allowed to be unresolved and within which it MUST be resolved.
138
- *
139
- * ## Request States
140
- *
141
- * `<Request />` has five states, only one of which will be active and rendered at a time.
142
- *
143
- * - `idle`: The component is waiting to be given a request to monitor
144
- * - `loading`: The request is in progress
145
- * - `error`: The request failed
146
- * - `content`: The request succeeded
147
- * - `cancelled`: The request was cancelled
148
- *
149
- * Additionally, the `content` state has a `refresh` method that can be used to
150
- * refresh the request in the background, which is available as a sub-state of
151
- * the `content` state.
152
- *
153
- * ### Example Usage
154
- *
155
- * ```tsx
156
- * import { Request } from "@warp-drive/react";
157
- *
158
- * export function UserPreview($props: { id: string | null }) {
159
- * return (
160
- * <Request
161
- * query={findRecord('user', $props.id)}
162
- * states={{
163
- * idle: () => <div>Waiting for User Selection</div>,
164
- * loading: ({ state }) => <div>Loading user data...</div>,
165
- * cancelled: ({ error, features }) => (
166
- * <div>
167
- * <p>Request Cancelled</p>
168
- * <p><button onClick={features.retry}>Start Again?</button></p>
169
- * </div>
170
- * ),
171
- * error: ({ error, features }) => (
172
- * <div>
173
- * <p>Error: {error.message}</p>
174
- * <p><button onClick={features.retry}>Try Again?</button></p>
175
- * </div>
176
- * ),
177
- * content: ({ result, features }) => (
178
- * <div>
179
- * <h2>User Details</h2>
180
- * <p>ID: {result.id}</p>
181
- * <p>Name: {result.name}</p>
182
- * </div>
183
- * ),
184
- * }}
185
- * />
186
- * );
187
- * }
188
- *
189
- * ```
190
- *
191
- * @category Components
192
- */
119
+ * The `<Request />` component is a powerful tool for managing data fetching and
120
+ * state in your React application. It provides a declarative approach to reactive
121
+ * control-flow for managing requests and state in your application.
122
+ *
123
+ * The `<Request />` component is ideal for handling "boundaries", outside which some
124
+ * state is still allowed to be unresolved and within which it MUST be resolved.
125
+ *
126
+ * ## Request States
127
+ *
128
+ * `<Request />` has five states, only one of which will be active and rendered at a time.
129
+ *
130
+ * - `idle`: The component is waiting to be given a request to monitor
131
+ * - `loading`: The request is in progress
132
+ * - `error`: The request failed
133
+ * - `content`: The request succeeded
134
+ * - `cancelled`: The request was cancelled
135
+ *
136
+ * Additionally, the `content` state has a `refresh` method that can be used to
137
+ * refresh the request in the background, which is available as a sub-state of
138
+ * the `content` state.
139
+ *
140
+ * ### Example Usage
141
+ *
142
+ * ```tsx
143
+ * import { Request } from "@warp-drive/react";
144
+ *
145
+ * export function UserPreview($props: { id: string | null }) {
146
+ * return (
147
+ * <Request
148
+ * query={findRecord('user', $props.id)}
149
+ * states={{
150
+ * idle: () => <div>Waiting for User Selection</div>,
151
+ * loading: ({ state }) => <div>Loading user data...</div>,
152
+ * cancelled: ({ error, features }) => (
153
+ * <div>
154
+ * <p>Request Cancelled</p>
155
+ * <p><button onClick={features.retry}>Start Again?</button></p>
156
+ * </div>
157
+ * ),
158
+ * error: ({ error, features }) => (
159
+ * <div>
160
+ * <p>Error: {error.message}</p>
161
+ * <p><button onClick={features.retry}>Try Again?</button></p>
162
+ * </div>
163
+ * ),
164
+ * content: ({ result, features }) => (
165
+ * <div>
166
+ * <h2>User Details</h2>
167
+ * <p>ID: {result.id}</p>
168
+ * <p>Name: {result.name}</p>
169
+ * </div>
170
+ * ),
171
+ * }}
172
+ * />
173
+ * );
174
+ * }
175
+ *
176
+ * ```
177
+ *
178
+ * @category Components
179
+ */
193
180
  function Request($props) {
194
- return /*#__PURE__*/jsxDEV(ReactiveContext, {
195
- children: /*#__PURE__*/jsxDEV(InternalRequest, {
196
- ...$props
197
- }, void 0, false, {
198
- fileName: _jsxFileName,
199
- lineNumber: 180,
200
- columnNumber: 7
201
- }, this)
202
- }, void 0, false, {
203
- fileName: _jsxFileName,
204
- lineNumber: 179,
205
- columnNumber: 5
206
- }, this);
181
+ return /*#__PURE__*/ jsxDEV(ReactiveContext, { children: /*#__PURE__*/ jsxDEV(InternalRequest, { ...$props }, void 0, false, {
182
+ fileName: _jsxFileName,
183
+ lineNumber: 180,
184
+ columnNumber: 7
185
+ }, this) }, void 0, false, {
186
+ fileName: _jsxFileName,
187
+ lineNumber: 179,
188
+ columnNumber: 5
189
+ }, this);
207
190
  }
208
191
  function isStrictModeRender() {
209
- const count = useRef(0);
210
-
211
- // in debug we need to skip every second invocation
212
- {
213
- if (count.current++ % 2 === 1) {
214
- return true;
215
- }
216
- }
217
- return false;
192
+ const count = useRef(0);
193
+ if (count.current++ % 2 === 1) return true;
194
+ return false;
218
195
  }
219
196
  function InternalRequest($props) {
220
- const isStrict = isStrictModeRender();
221
- const store = $props.store ?? useStore();
222
- const Chrome = $props.chrome ?? DefaultChrome;
223
- const sink = useRef(null);
224
- const args = useRef(null);
225
- if (!args.current) {
226
- args.current = new ReactiveArgs();
227
- }
228
- Object.assign(args.current, $props);
229
- if (sink.current && (sink.current.store !== store || $props.subscription)) {
230
- sink.current[DISPOSE]();
231
- sink.current = null;
232
- }
233
- if (!sink.current && !$props.subscription) {
234
- sink.current = createRequestSubscription(store, args.current);
235
- }
236
- const initialized = useRef(null);
237
- const effect = () => {
238
- if (sink.current && (!initialized.current || initialized.current.disposable !== sink.current)) {
239
- initialized.current = {
240
- disposable: sink.current,
241
- dispose: () => {
242
- sink.current?.[DISPOSE]();
243
- initialized.current = null;
244
- sink.current = null;
245
- }
246
- };
247
- }
248
- return sink.current ? initialized.current.dispose : undefined;
249
- };
250
- let maybeEffect = effect;
251
- {
252
- if (isStrict) {
253
- maybeEffect = () => {
254
- if (initialized.current) {
255
- return effect();
256
- }
257
- return () => {
258
- // initialize our actual effect
259
- effect();
260
- // in strict mode we don't want to run the teardown
261
- // for the second invocation
262
- };
263
- };
264
- }
265
- }
266
- useEffect(maybeEffect, [sink.current]);
267
- const state = $props.subscription ?? sink.current;
268
- const slots = $props.states;
269
- return /*#__PURE__*/jsxDEV(Chrome, {
270
- state: state.isIdle ? null : state.reqState,
271
- features: state.contentFeatures,
272
- children:
273
- // prettier-ignore
274
- state.isIdle && slots.idle ? /*#__PURE__*/jsxDEV(slots.idle, {}, void 0, false, {
275
- fileName: _jsxFileName,
276
- lineNumber: 264,
277
- columnNumber: 38
278
- }, this) : state.isIdle ? /*#__PURE__*/jsxDEV(Throw, {
279
- error: IdleBlockMissingError
280
- }, void 0, false, {
281
- fileName: _jsxFileName,
282
- lineNumber: 265,
283
- columnNumber: 28
284
- }, this) : state.reqState.isLoading ? slots.loading ? /*#__PURE__*/jsxDEV(slots.loading, {
285
- state: state.reqState.loadingState
286
- }, void 0, false, {
287
- fileName: _jsxFileName,
288
- lineNumber: 266,
289
- columnNumber: 56
290
- }, this) : '' : state.reqState.isCancelled && slots.cancelled ? /*#__PURE__*/jsxDEV(slots.cancelled, {
291
- error: state.reqState.reason,
292
- features: state.errorFeatures
293
- }, void 0, false, {
294
- fileName: _jsxFileName,
295
- lineNumber: 267,
296
- columnNumber: 61
297
- }, this) : state.reqState.isError && slots.error ? /*#__PURE__*/jsxDEV(slots.error, {
298
- error: state.reqState.reason,
299
- features: state.errorFeatures
300
- }, void 0, false, {
301
- fileName: _jsxFileName,
302
- lineNumber: 268,
303
- columnNumber: 53
304
- }, this) : state.reqState.isSuccess ? slots.content ? /*#__PURE__*/jsxDEV(slots.content, {
305
- result: state.reqState.value,
306
- features: state.contentFeatures
307
- }, void 0, false, {
308
- fileName: _jsxFileName,
309
- lineNumber: 269,
310
- columnNumber: 56
311
- }, this) : /*#__PURE__*/jsxDEV(Throw, {
312
- error: new Error('No content block provided for <Request> component.')
313
- }, void 0, false, {
314
- fileName: _jsxFileName,
315
- lineNumber: 269,
316
- columnNumber: 139
317
- }, this) : !state.reqState.isCancelled ? /*#__PURE__*/jsxDEV(Throw, {
318
- error: state.reqState.reason
319
- }, void 0, false, {
320
- fileName: _jsxFileName,
321
- lineNumber: 270,
322
- columnNumber: 43
323
- }, this) : '' // never
324
- }, void 0, false, {
325
- fileName: _jsxFileName,
326
- lineNumber: 261,
327
- columnNumber: 5
328
- }, this);
197
+ const isStrict = isStrictModeRender();
198
+ const store = $props.store ?? useStore();
199
+ const Chrome = $props.chrome ?? DefaultChrome;
200
+ const sink = useRef(null);
201
+ const args = useRef(null);
202
+ if (!args.current) args.current = new ReactiveArgs();
203
+ Object.assign(args.current, $props);
204
+ if (sink.current && (sink.current.store !== store || $props.subscription)) {
205
+ sink.current[DISPOSE]();
206
+ sink.current = null;
207
+ }
208
+ if (!sink.current && !$props.subscription) sink.current = createRequestSubscription(store, args.current);
209
+ const initialized = useRef(null);
210
+ const effect = () => {
211
+ if (sink.current && (!initialized.current || initialized.current.disposable !== sink.current)) initialized.current = {
212
+ disposable: sink.current,
213
+ dispose: () => {
214
+ sink.current?.[DISPOSE]();
215
+ initialized.current = null;
216
+ sink.current = null;
217
+ }
218
+ };
219
+ return sink.current ? initialized.current.dispose : void 0;
220
+ };
221
+ let maybeEffect = effect;
222
+ if (isStrict) maybeEffect = () => {
223
+ if (initialized.current) return effect();
224
+ return () => {
225
+ effect();
226
+ };
227
+ };
228
+ useEffect(maybeEffect, [sink.current]);
229
+ const state = $props.subscription ?? sink.current;
230
+ const slots = $props.states;
231
+ return /*#__PURE__*/ jsxDEV(Chrome, {
232
+ state: state.isIdle ? null : state.reqState,
233
+ features: state.contentFeatures,
234
+ children: state.isIdle && slots.idle ? /*#__PURE__*/ jsxDEV(slots.idle, {}, void 0, false, {
235
+ fileName: _jsxFileName,
236
+ lineNumber: 264,
237
+ columnNumber: 38
238
+ }, this) : state.isIdle ? /*#__PURE__*/ jsxDEV(Throw, { error: IdleBlockMissingError }, void 0, false, {
239
+ fileName: _jsxFileName,
240
+ lineNumber: 265,
241
+ columnNumber: 28
242
+ }, this) : state.reqState.isLoading ? slots.loading ? /*#__PURE__*/ jsxDEV(slots.loading, { state: state.reqState.loadingState }, void 0, false, {
243
+ fileName: _jsxFileName,
244
+ lineNumber: 266,
245
+ columnNumber: 56
246
+ }, this) : "" : state.reqState.isCancelled && slots.cancelled ? /*#__PURE__*/ jsxDEV(slots.cancelled, {
247
+ error: state.reqState.reason,
248
+ features: state.errorFeatures
249
+ }, void 0, false, {
250
+ fileName: _jsxFileName,
251
+ lineNumber: 267,
252
+ columnNumber: 61
253
+ }, this) : state.reqState.isError && slots.error ? /*#__PURE__*/ jsxDEV(slots.error, {
254
+ error: state.reqState.reason,
255
+ features: state.errorFeatures
256
+ }, void 0, false, {
257
+ fileName: _jsxFileName,
258
+ lineNumber: 268,
259
+ columnNumber: 53
260
+ }, this) : state.reqState.isSuccess ? slots.content ? /*#__PURE__*/ jsxDEV(slots.content, {
261
+ result: state.reqState.value,
262
+ features: state.contentFeatures
263
+ }, void 0, false, {
264
+ fileName: _jsxFileName,
265
+ lineNumber: 269,
266
+ columnNumber: 56
267
+ }, this) : /*#__PURE__*/ jsxDEV(Throw, { error: /* @__PURE__ */ new Error("No content block provided for <Request> component.") }, void 0, false, {
268
+ fileName: _jsxFileName,
269
+ lineNumber: 269,
270
+ columnNumber: 139
271
+ }, this) : !state.reqState.isCancelled ? /*#__PURE__*/ jsxDEV(Throw, { error: state.reqState.reason }, void 0, false, {
272
+ fileName: _jsxFileName,
273
+ lineNumber: 270,
274
+ columnNumber: 43
275
+ }, this) : ""
276
+ }, void 0, false, {
277
+ fileName: _jsxFileName,
278
+ lineNumber: 261,
279
+ columnNumber: 5
280
+ }, this);
329
281
  }
330
- export { ReactiveContext, Request, StoreProvider, Throw, useStore };
282
+
283
+ //#endregion
284
+ export { ReactiveContext, Request, StoreProvider, Throw, WatcherContext, useStore };
285
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Store","createContext","JSX","ReactNode","use","useMemo","jsxDEV","_jsxDEV","StoreContext","useStore","store","test","Error","StoreProvider","$props","value","children","fileName","_jsxFileName","lineNumber","columnNumber","createRequestSubscription","AutorefreshBehaviorCombos","DISPOSE","RequestArgs","signal","JSX","ReactNode","useEffect","useMemo","useRef","useStore","ReactiveContext","Future","StoreRequestInput","g","i","Fragment","_Fragment","jsxDEV","_jsxDEV","IdleBlockMissingError","Error","ReactiveArgs","prototype","request","void 0","query","autorefresh","autorefreshThreshold","autorefreshBehavior","DefaultChrome","children","Throw","error","Request","$props","InternalRequest","fileName","_jsxFileName","lineNumber","columnNumber","isStrictModeRender","count","current","isStrict","store","Chrome","chrome","sink","args","Object","assign","subscription","initialized","effect","disposable","dispose","undefined","maybeEffect","state","slots","states","isIdle","reqState","features","contentFeatures","idle","isLoading","loading","loadingState","isCancelled","cancelled","reason","errorFeatures","isError","isSuccess","content","result","value"],"sources":["../../../src/-private/store-provider.tsx","../../../../../node_modules/.pnpm/decorat_5005bbc272376d25df08203abab44e2f/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../../../src/-private/request.tsx"],"sourcesContent":["import { Store } from \"@warp-drive/core\";\nimport { assert } from \"@warp-drive/core/build-config/macros\";\nimport { createContext, JSX, ReactNode, use, useMemo } from \"react\";\n\n/**\n * @category Contexts\n */\nconst StoreContext = createContext<Store | null>(null);\n\n/**\n * @category Hooks\n */\nexport function useStore(): Store {\n const store = use(StoreContext);\n assert(\n \"No Store provided via context. Please ensure you are using <StoreProvider> to provide a Store instance.\",\n store\n );\n return store;\n}\n\ntype WithExistingStore = { store: Store; children: ReactNode };\ntype WithNewStore = { Store: typeof Store; children: ReactNode };\n\n/**\n * @category Components\n */\nexport function StoreProvider($props: WithExistingStore | WithNewStore): JSX.Element {\n const store = useMemo(\n () => (\"store\" in $props ? $props.store : new $props.Store()),\n [\"store\" in $props ? $props.store : $props.Store]\n );\n\n return <StoreContext value={store}>{$props.children}</StoreContext>;\n}\n","const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n","import {\n createRequestSubscription,\n type RequestLoadingState,\n type RequestState,\n type RequestSubscription,\n} from \"@warp-drive/core/reactive\";\nimport {\n AutorefreshBehaviorCombos,\n DISPOSE,\n RequestArgs,\n signal,\n type ContentFeatures,\n type RecoveryFeatures,\n type SubscriptionArgs,\n} from \"@warp-drive/core/signals/-leaked\";\nimport type { StructuredErrorDocument } from \"@warp-drive/core/types/request\";\nimport { JSX, ReactNode, useEffect, useMemo, useRef } from \"react\";\nimport { useStore } from \"./store-provider\";\nimport { ReactiveContext } from \"./reactive-context\";\nimport { Future } from \"@warp-drive/core/request\";\nimport { StoreRequestInput } from \"@warp-drive/core\";\nimport { DEBUG } from \"@warp-drive/core/build-config/env\";\n\nconst IdleBlockMissingError = new Error(\n \"No idle block provided for <Request> component, and no query or request was provided.\"\n);\n\nclass ReactiveArgs<RT, E> implements SubscriptionArgs<RT, E> {\n @signal request?: Future<RT> | undefined | null;\n @signal query?: StoreRequestInput<RT> | undefined | null;\n @signal autorefresh?: AutorefreshBehaviorCombos | undefined;\n @signal autorefreshThreshold?: number | undefined;\n @signal autorefreshBehavior?: \"refresh\" | \"reload\" | \"policy\";\n}\n\ninterface ChromeComponentProps<RT> {\n children: ReactNode;\n state: RequestState | null;\n features: ContentFeatures<RT>;\n}\n\nconst DefaultChrome = <RT,>({ children }: ChromeComponentProps<RT>) => {\n return <>{children}</>;\n};\n\nexport interface RequestProps<RT, E> extends RequestArgs<RT, E> {\n chrome?: React.FC<ChromeComponentProps<RT>>;\n\n states: RequestStates<RT, E>;\n}\n\ninterface RequestStates<RT, E> {\n /**\n * The block to render when the component is idle and waiting to be given a request.\n *\n */\n idle?: React.FC<{}>;\n\n /**\n * The block to render when the request is loading.\n *\n */\n loading?: React.FC<{ state: RequestLoadingState }>;\n\n /**\n * The block to render when the request was cancelled.\n *\n */\n cancelled?: React.FC<{\n /**\n * The Error the request rejected with.\n */\n error: StructuredErrorDocument<E>;\n /**\n * Utilities to assist in recovering from the error.\n */\n features: RecoveryFeatures;\n }>;\n\n /**\n * The block to render when the request failed. If this block is not provided,\n * the error will be rethrown.\n *\n * Thus it is required to provide an error block and proper error handling if\n * you do not want the error to crash the application.\n */\n error: React.FC<{\n /**\n * The Error the request rejected with.\n */\n error: StructuredErrorDocument<E>;\n /**\n * Utilities to assist in recovering from the error.\n */\n features: RecoveryFeatures;\n }>;\n\n /**\n * The block to render when the request succeeded.\n *\n */\n content: React.FC<{ result: RT; features: ContentFeatures<RT> }>;\n}\n\n/**\n * Throws the given error. Used internally to rethrow request errors that\n * are not otherwise handled by a provided error/cancelled block.\n *\n * @private\n */\nexport function Throw({ error }: { error: Error }): never {\n throw error;\n}\n\n/**\n * The `<Request />` component is a powerful tool for managing data fetching and\n * state in your React application. It provides a declarative approach to reactive\n * control-flow for managing requests and state in your application.\n *\n * The `<Request />` component is ideal for handling \"boundaries\", outside which some\n * state is still allowed to be unresolved and within which it MUST be resolved.\n *\n * ## Request States\n *\n * `<Request />` has five states, only one of which will be active and rendered at a time.\n *\n * - `idle`: The component is waiting to be given a request to monitor\n * - `loading`: The request is in progress\n * - `error`: The request failed\n * - `content`: The request succeeded\n * - `cancelled`: The request was cancelled\n *\n * Additionally, the `content` state has a `refresh` method that can be used to\n * refresh the request in the background, which is available as a sub-state of\n * the `content` state.\n *\n * ### Example Usage\n *\n * ```tsx\n * import { Request } from \"@warp-drive/react\";\n *\n * export function UserPreview($props: { id: string | null }) {\n * return (\n * <Request\n * query={findRecord('user', $props.id)}\n * states={{\n * idle: () => <div>Waiting for User Selection</div>,\n * loading: ({ state }) => <div>Loading user data...</div>,\n * cancelled: ({ error, features }) => (\n * <div>\n * <p>Request Cancelled</p>\n * <p><button onClick={features.retry}>Start Again?</button></p>\n * </div>\n * ),\n * error: ({ error, features }) => (\n * <div>\n * <p>Error: {error.message}</p>\n * <p><button onClick={features.retry}>Try Again?</button></p>\n * </div>\n * ),\n * content: ({ result, features }) => (\n * <div>\n * <h2>User Details</h2>\n * <p>ID: {result.id}</p>\n * <p>Name: {result.name}</p>\n * </div>\n * ),\n * }}\n * />\n * );\n * }\n *\n * ```\n *\n * @category Components\n */\nexport function Request<RT, E>($props: RequestProps<RT, E>): JSX.Element {\n return (\n <ReactiveContext>\n <InternalRequest {...$props} />\n </ReactiveContext>\n );\n}\n\nfunction isStrictModeRender(): boolean {\n const count = useRef<number>(0);\n\n // in debug we need to skip every second invocation\n if (DEBUG) {\n if (count.current++ % 2 === 1) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction InternalRequest<RT, E>($props: RequestProps<RT, E>): JSX.Element {\n const isStrict = isStrictModeRender();\n const store = $props.store ?? useStore();\n const Chrome = $props.chrome ?? DefaultChrome;\n const sink = useRef<RequestSubscription<RT, E> | null>(null);\n const args = useRef<SubscriptionArgs<RT, E> | null>(null);\n\n if (!args.current) {\n args.current = new ReactiveArgs<RT, E>();\n }\n Object.assign(args.current, $props);\n\n if (sink.current && (sink.current.store !== store || $props.subscription)) {\n sink.current[DISPOSE]();\n sink.current = null;\n }\n\n if (!sink.current && !$props.subscription) {\n sink.current = createRequestSubscription(store, args.current!);\n }\n\n const initialized = useRef<null | {\n disposable: { [DISPOSE]: () => void } | null;\n dispose: () => void;\n }>(null);\n const effect = () => {\n if (sink.current && (!initialized.current || initialized.current.disposable !== sink.current)) {\n initialized.current = {\n disposable: sink.current,\n dispose: () => {\n sink.current?.[DISPOSE]();\n initialized.current = null;\n sink.current = null;\n },\n };\n }\n\n return sink.current ? initialized.current!.dispose : undefined;\n };\n let maybeEffect = effect;\n\n if (DEBUG) {\n if (isStrict) {\n maybeEffect = () => {\n if (initialized.current) {\n return effect();\n }\n return () => {\n // initialize our actual effect\n effect();\n // in strict mode we don't want to run the teardown\n // for the second invocation\n };\n };\n }\n }\n\n useEffect(maybeEffect, [sink.current]);\n\n const state = $props.subscription ?? sink.current!;\n const slots = $props.states;\n\n return (\n <Chrome state={state.isIdle ? null : state.reqState} features={state.contentFeatures}>\n {\n // prettier-ignore\n state.isIdle && slots.idle ? <slots.idle />\n : state.isIdle ? <Throw error={IdleBlockMissingError} />\n : state.reqState.isLoading ? slots.loading ? <slots.loading state={state.reqState.loadingState} /> : ''\n : state.reqState.isCancelled && slots.cancelled ? <slots.cancelled error={state.reqState.reason} features={state.errorFeatures} />\n : state.reqState.isError && slots.error ? <slots.error error={state.reqState.reason} features={state.errorFeatures} />\n : state.reqState.isSuccess ? slots.content ? <slots.content result={state.reqState.value} features={state.contentFeatures} /> : <Throw error={new Error('No content block provided for <Request> component.')} />\n : !state.reqState.isCancelled ? <Throw error={state.reqState.reason} />\n : '' // never\n }\n </Chrome>\n );\n}\n"],"x_google_ignoreList":[1],"mappings":";;;;;;;;;;;AAOA,MAAMQ,eAAeP,4BAA4B,IAAI;;;;AAKrD,SAAgBQ,WAAkB;CAChC,MAAMC,QAAQN,IAAII,YAAY;CAC9B,EAAAG,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,yGAAyG;CAAA,EAAA,CACzGF,KAAK;CAEP,OAAOA;AACT;;;;AAQA,SAAgBG,cAAcC,QAAuD;CACnF,MAAMJ,QAAQL,cACL,WAAWS,SAASA,OAAOJ,QAAQ,IAAII,OAAOd,MAAM,GAC3D,CAAC,WAAWc,SAASA,OAAOJ,QAAQI,OAAOd,KAAK,CAClD;CAEA,OAAOO,qBAACC,cAAY;EAACO,OAAOL;EAAMM,UAAEF,OAAOE;CAAQ,GAAA,KAAA,GAAA,OAAA;EAAAC,UAAAC;EAAAC,YAAA;EAAAC,cAAA;CAAA,GAAA,IAAe;AACpE;;;;AClCA,MAAM,2BAA2B,IAAI,QAAQ;AAC7C,SAAS,eAAe,OAAO,MAAM,MAAM;CACzC,IAAI,MAAM,SAAS,IAAI,KAAK;CAC5B,IAAI,CAAC,KAAK;EACR,sBAAsB,IAAI,IAAI;EAC9B,SAAS,IAAI,OAAO,GAAG;CACzB;CACA,IAAI,IAAI,MAAM,IAAI;AACpB;AACA,SAAS,sBAAsB,QAAQ,MAAM;CAC3C,IAAI;CACJ,IAAI,SAAS,OAAO;CACpB,OAAO,QAAQ;EACb,IAAI,QAAQ,KAAK,SAAS,IAAI,MAAM,MAAM,OAAO,KAAK,IAAI,GAAG,IAAI,IAAI;EACrE,IAAI,MACF,OAAO;EAET,SAAS,OAAO;CAClB;AACF;AAIA,SAAS,gBAAgB,WAAW,MAAM,YAAY,aAAa;CACjE,IAAI,OAAO;EACT,cAAc;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