solid-js 1.10.0-beta.0 → 2.0.0-beta.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 (82) hide show
  1. package/dist/dev.cjs +730 -1723
  2. package/dist/dev.js +595 -1688
  3. package/dist/server.cjs +769 -703
  4. package/dist/server.js +682 -670
  5. package/dist/solid.cjs +696 -1667
  6. package/dist/solid.js +560 -1631
  7. package/package.json +7 -151
  8. package/types/{render → client}/component.d.ts +1 -38
  9. package/types/client/core.d.ts +65 -0
  10. package/types/client/flow.d.ts +100 -0
  11. package/types/client/hydration.d.ts +76 -0
  12. package/types/index.d.ts +11 -14
  13. package/types/jsx.d.ts +1508 -1633
  14. package/types/server/component.d.ts +66 -0
  15. package/types/server/core.d.ts +44 -0
  16. package/types/server/flow.d.ts +60 -0
  17. package/types/server/hydration.d.ts +21 -0
  18. package/types/server/index.d.ts +12 -3
  19. package/types/server/shared.d.ts +45 -0
  20. package/types/server/signals.d.ts +60 -0
  21. package/h/dist/h.cjs +0 -115
  22. package/h/dist/h.js +0 -113
  23. package/h/jsx-dev-runtime/package.json +0 -8
  24. package/h/jsx-runtime/dist/jsx.cjs +0 -15
  25. package/h/jsx-runtime/dist/jsx.js +0 -10
  26. package/h/jsx-runtime/package.json +0 -8
  27. package/h/jsx-runtime/types/index.d.ts +0 -11
  28. package/h/jsx-runtime/types/jsx.d.ts +0 -4242
  29. package/h/package.json +0 -8
  30. package/h/types/hyperscript.d.ts +0 -20
  31. package/h/types/index.d.ts +0 -3
  32. package/html/dist/html.cjs +0 -583
  33. package/html/dist/html.js +0 -581
  34. package/html/package.json +0 -8
  35. package/html/types/index.d.ts +0 -3
  36. package/html/types/lit.d.ts +0 -41
  37. package/store/dist/dev.cjs +0 -458
  38. package/store/dist/dev.js +0 -449
  39. package/store/dist/server.cjs +0 -126
  40. package/store/dist/server.js +0 -114
  41. package/store/dist/store.cjs +0 -438
  42. package/store/dist/store.js +0 -429
  43. package/store/package.json +0 -46
  44. package/store/types/index.d.ts +0 -12
  45. package/store/types/modifiers.d.ts +0 -6
  46. package/store/types/mutable.d.ts +0 -5
  47. package/store/types/server.d.ts +0 -17
  48. package/store/types/store.d.ts +0 -107
  49. package/types/reactive/array.d.ts +0 -44
  50. package/types/reactive/observable.d.ts +0 -36
  51. package/types/reactive/scheduler.d.ts +0 -10
  52. package/types/reactive/signal.d.ts +0 -586
  53. package/types/render/Suspense.d.ts +0 -26
  54. package/types/render/flow.d.ts +0 -118
  55. package/types/render/hydration.d.ts +0 -24
  56. package/types/render/index.d.ts +0 -4
  57. package/types/server/reactive.d.ts +0 -98
  58. package/types/server/rendering.d.ts +0 -159
  59. package/universal/dist/dev.cjs +0 -245
  60. package/universal/dist/dev.js +0 -243
  61. package/universal/dist/universal.cjs +0 -245
  62. package/universal/dist/universal.js +0 -243
  63. package/universal/package.json +0 -20
  64. package/universal/types/index.d.ts +0 -3
  65. package/universal/types/universal.d.ts +0 -30
  66. package/web/dist/dev.cjs +0 -894
  67. package/web/dist/dev.js +0 -782
  68. package/web/dist/server.cjs +0 -892
  69. package/web/dist/server.js +0 -782
  70. package/web/dist/web.cjs +0 -883
  71. package/web/dist/web.js +0 -771
  72. package/web/package.json +0 -46
  73. package/web/storage/dist/storage.cjs +0 -12
  74. package/web/storage/dist/storage.js +0 -10
  75. package/web/storage/package.json +0 -15
  76. package/web/storage/types/index.d.ts +0 -2
  77. package/web/types/client.d.ts +0 -79
  78. package/web/types/core.d.ts +0 -2
  79. package/web/types/index.d.ts +0 -50
  80. package/web/types/jsx.d.ts +0 -1
  81. package/web/types/server-mock.d.ts +0 -65
  82. package/web/types/server.d.ts +0 -177
package/dist/solid.cjs CHANGED
@@ -1,1491 +1,587 @@
1
1
  'use strict';
2
2
 
3
- let taskIdCounter = 1,
4
- isCallbackScheduled = false,
5
- isPerformingWork = false,
6
- taskQueue = [],
7
- currentTask = null,
8
- shouldYieldToHost = null,
9
- yieldInterval = 5,
10
- deadline = 0,
11
- maxYieldInterval = 300,
12
- maxDeadline = 0,
13
- scheduleCallback = null,
14
- scheduledCallback = null;
15
- const maxSigned31BitInt = 1073741823;
16
- function setupScheduler() {
17
- const channel = new MessageChannel(),
18
- port = channel.port2;
19
- scheduleCallback = () => port.postMessage(null);
20
- channel.port1.onmessage = () => {
21
- if (scheduledCallback !== null) {
22
- const currentTime = performance.now();
23
- deadline = currentTime + yieldInterval;
24
- maxDeadline = currentTime + maxYieldInterval;
25
- try {
26
- const hasMoreWork = scheduledCallback(currentTime);
27
- if (!hasMoreWork) {
28
- scheduledCallback = null;
29
- } else port.postMessage(null);
30
- } catch (error) {
31
- port.postMessage(null);
32
- throw error;
33
- }
34
- }
35
- };
36
- if (navigator && navigator.scheduling && navigator.scheduling.isInputPending) {
37
- const scheduling = navigator.scheduling;
38
- shouldYieldToHost = () => {
39
- const currentTime = performance.now();
40
- if (currentTime >= deadline) {
41
- if (scheduling.isInputPending()) {
42
- return true;
43
- }
44
- return currentTime >= maxDeadline;
45
- } else {
46
- return false;
47
- }
48
- };
49
- } else {
50
- shouldYieldToHost = () => performance.now() >= deadline;
3
+ var signals = require('@solidjs/signals');
4
+
5
+ const $DEVCOMP = Symbol(0);
6
+ function createContext(defaultValue, options) {
7
+ const id = Symbol(options && options.name || "");
8
+ function provider(props) {
9
+ return signals.createRoot(() => {
10
+ signals.setContext(provider, props.value);
11
+ return children(() => props.children);
12
+ });
51
13
  }
14
+ provider.id = id;
15
+ provider.defaultValue = defaultValue;
16
+ return provider;
52
17
  }
53
- function enqueue(taskQueue, task) {
54
- function findIndex() {
55
- let m = 0;
56
- let n = taskQueue.length - 1;
57
- while (m <= n) {
58
- const k = n + m >> 1;
59
- const cmp = task.expirationTime - taskQueue[k].expirationTime;
60
- if (cmp > 0) m = k + 1;else if (cmp < 0) n = k - 1;else return k;
61
- }
62
- return m;
63
- }
64
- taskQueue.splice(findIndex(), 0, task);
18
+ function useContext(context) {
19
+ return signals.getContext(context);
65
20
  }
66
- function requestCallback(fn, options) {
67
- if (!scheduleCallback) setupScheduler();
68
- let startTime = performance.now(),
69
- timeout = maxSigned31BitInt;
70
- if (options && options.timeout) timeout = options.timeout;
71
- const newTask = {
72
- id: taskIdCounter++,
73
- fn,
74
- startTime,
75
- expirationTime: startTime + timeout
21
+ function children(fn) {
22
+ const c = signals.createMemo(fn, undefined, {
23
+ lazy: true
24
+ });
25
+ const memo = signals.createMemo(() => signals.flatten(c()), undefined, {
26
+ lazy: true
27
+ });
28
+ memo.toArray = () => {
29
+ const v = memo();
30
+ return Array.isArray(v) ? v : v != null ? [v] : [];
76
31
  };
77
- enqueue(taskQueue, newTask);
78
- if (!isCallbackScheduled && !isPerformingWork) {
79
- isCallbackScheduled = true;
80
- scheduledCallback = flushWork;
81
- scheduleCallback();
82
- }
83
- return newTask;
84
- }
85
- function cancelCallback(task) {
86
- task.fn = null;
87
- }
88
- function flushWork(initialTime) {
89
- isCallbackScheduled = false;
90
- isPerformingWork = true;
91
- try {
92
- return workLoop(initialTime);
93
- } finally {
94
- currentTask = null;
95
- isPerformingWork = false;
96
- }
97
- }
98
- function workLoop(initialTime) {
99
- let currentTime = initialTime;
100
- currentTask = taskQueue[0] || null;
101
- while (currentTask !== null) {
102
- if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
103
- break;
104
- }
105
- const callback = currentTask.fn;
106
- if (callback !== null) {
107
- currentTask.fn = null;
108
- const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
109
- callback(didUserCallbackTimeout);
110
- currentTime = performance.now();
111
- if (currentTask === taskQueue[0]) {
112
- taskQueue.shift();
113
- }
114
- } else taskQueue.shift();
115
- currentTask = taskQueue[0] || null;
116
- }
117
- return currentTask !== null;
32
+ return memo;
118
33
  }
119
34
 
120
35
  const sharedConfig = {
121
- context: undefined,
36
+ hydrating: false,
122
37
  registry: undefined,
123
- effects: undefined,
124
38
  done: false,
125
- getContextId() {
126
- return getContextId(this.context.count);
127
- },
128
39
  getNextContextId() {
129
- return getContextId(this.context.count++);
40
+ const o = signals.getOwner();
41
+ if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
42
+ return signals.getNextChildId(o);
130
43
  }
131
44
  };
132
- function getContextId(count) {
133
- const num = String(count),
134
- len = num.length - 1;
135
- return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
136
- }
137
- function setHydrateContext(context) {
138
- sharedConfig.context = context;
139
- }
140
- function nextHydrateContext() {
141
- return {
142
- ...sharedConfig.context,
143
- id: sharedConfig.getNextContextId(),
144
- count: 0
145
- };
146
- }
147
-
148
- const IS_DEV = false;
149
- const equalFn = (a, b) => a === b;
150
- const $PROXY = Symbol("solid-proxy");
151
- const SUPPORTS_PROXY = typeof Proxy === "function";
152
- const $TRACK = Symbol("solid-track");
153
- const $DEVCOMP = Symbol("solid-dev-component");
154
- const signalOptions = {
155
- equals: equalFn
156
- };
157
- let ERROR = null;
158
- let runEffects = runQueue;
159
- const STALE = 1;
160
- const PENDING = 2;
161
- const UNOWNED = {
162
- owned: null,
163
- cleanups: null,
164
- context: null,
165
- owner: null
166
- };
167
- const NO_INIT = {};
168
- var Owner = null;
169
- let Transition = null;
170
- let Scheduler = null;
171
- let ExternalSourceConfig = null;
172
- let Listener = null;
173
- let Updates = null;
174
- let Effects = null;
175
- let ExecCount = 0;
176
- function createRoot(fn, detachedOwner) {
177
- const listener = Listener,
178
- owner = Owner,
179
- unowned = fn.length === 0,
180
- current = detachedOwner === undefined ? owner : detachedOwner,
181
- root = unowned ? UNOWNED : {
182
- owned: null,
183
- cleanups: null,
184
- context: current ? current.context : null,
185
- owner: current
186
- },
187
- updateFn = unowned ? fn : () => fn(() => untrack(() => cleanupRoot(root)));
188
- Owner = root;
189
- Listener = null;
190
- try {
191
- return runUpdates(updateFn, true);
192
- } finally {
193
- Listener = listener;
194
- Owner = owner;
195
- }
196
- }
197
- function createSignal(value, options) {
198
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
199
- const s = {
200
- value,
201
- observers: null,
202
- observersTail: null,
203
- comparator: options.equals || undefined
204
- };
205
- const setter = value => {
206
- if (typeof value === "function") {
207
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
208
- }
209
- return writeSignal(s, value);
210
- };
211
- return [readSignal.bind(s), setter];
212
- }
213
- function createComputed(fn, value, options) {
214
- const c = createComputation(fn, value, true, STALE);
215
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
216
- }
217
- function createRenderEffect(fn, value, options) {
218
- const c = createComputation(fn, value, false, STALE);
219
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
220
- }
221
- function createEffect(fn, value, options) {
222
- runEffects = runUserEffects;
223
- const c = createComputation(fn, value, false, STALE),
224
- s = SuspenseContext && useContext(SuspenseContext);
225
- if (s) c.suspense = s;
226
- if (!options || !options.render) c.user = true;
227
- Effects ? Effects.push(c) : updateComputation(c);
228
- }
229
- function createReaction(onInvalidate, options) {
230
- let fn;
231
- const c = createComputation(() => {
232
- fn ? fn() : untrack(onInvalidate);
233
- fn = undefined;
234
- }, undefined, false, 0),
235
- s = SuspenseContext && useContext(SuspenseContext);
236
- if (s) c.suspense = s;
237
- c.user = true;
238
- return tracking => {
239
- fn = tracking;
240
- updateComputation(c);
241
- };
242
- }
243
- function createMemo(fn, value, options) {
244
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
245
- const c = createComputation(fn, value, true, 0);
246
- c.observers = null;
247
- c.observersTail = null;
248
- c.comparator = options.equals || undefined;
249
- if (Scheduler && Transition && Transition.running) {
250
- c.tState = STALE;
251
- Updates.push(c);
252
- } else updateComputation(c);
253
- return readSignal.bind(c);
254
- }
255
- function isPromise(v) {
256
- return v && typeof v === "object" && "then" in v;
257
- }
258
- function createResource(pSource, pFetcher, pOptions) {
259
- let source;
260
- let fetcher;
261
- let options;
262
- if (typeof pFetcher === "function") {
263
- source = pSource;
264
- fetcher = pFetcher;
265
- options = pOptions || {};
266
- } else {
267
- source = true;
268
- fetcher = pSource;
269
- options = pFetcher || {};
270
- }
271
- let pr = null,
272
- initP = NO_INIT,
273
- id = null,
274
- loadedUnderTransition = false,
275
- scheduled = false,
276
- resolved = "initialValue" in options,
277
- dynamic = typeof source === "function" && createMemo(source);
278
- const contexts = new Set(),
279
- [value, setValue] = (options.storage || createSignal)(options.initialValue),
280
- [error, setError] = createSignal(undefined),
281
- [track, trigger] = createSignal(undefined, {
282
- equals: false
283
- }),
284
- [state, setState] = createSignal(resolved ? "ready" : "unresolved");
285
- if (sharedConfig.context) {
286
- id = sharedConfig.getNextContextId();
287
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
288
- }
289
- function loadEnd(p, v, error, key) {
290
- if (pr === p) {
291
- pr = null;
292
- key !== undefined && (resolved = true);
293
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
294
- value: v
295
- }));
296
- initP = NO_INIT;
297
- if (Transition && p && loadedUnderTransition) {
298
- Transition.promises.delete(p);
299
- loadedUnderTransition = false;
300
- runUpdates(() => {
301
- Transition.running = true;
302
- completeLoad(v, error);
303
- }, false);
304
- } else completeLoad(v, error);
305
- }
306
- return v;
307
- }
308
- function completeLoad(v, err) {
309
- runUpdates(() => {
310
- if (err === undefined) setValue(() => v);
311
- setState(err !== undefined ? "errored" : resolved ? "ready" : "unresolved");
312
- setError(err);
313
- for (const c of contexts.keys()) c.decrement();
314
- contexts.clear();
315
- }, false);
316
- }
317
- function read() {
318
- const c = SuspenseContext && useContext(SuspenseContext),
319
- v = value(),
320
- err = error();
321
- if (err !== undefined && !pr) throw err;
322
- if (Listener && !Listener.user && c) {
323
- createComputed(() => {
324
- track();
325
- if (pr) {
326
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
327
- c.increment();
328
- contexts.add(c);
329
- }
330
- }
331
- });
332
- }
333
- return v;
334
- }
335
- function load(refetching = true) {
336
- if (refetching !== false && scheduled) return;
337
- scheduled = false;
338
- const lookup = dynamic ? dynamic() : source;
339
- loadedUnderTransition = Transition && Transition.running;
340
- if (lookup == null || lookup === false) {
341
- loadEnd(pr, untrack(value));
342
- return;
343
- }
344
- if (Transition && pr) Transition.promises.delete(pr);
345
- let error;
346
- const p = initP !== NO_INIT ? initP : untrack(() => {
347
- try {
348
- return fetcher(lookup, {
349
- value: value(),
350
- refetching
351
- });
352
- } catch (fetcherError) {
353
- error = fetcherError;
354
- }
355
- });
356
- if (error !== undefined) {
357
- loadEnd(pr, undefined, castError(error), lookup);
358
- return;
359
- } else if (!isPromise(p)) {
360
- loadEnd(pr, p, undefined, lookup);
361
- return p;
362
- }
363
- pr = p;
364
- if ("v" in p) {
365
- if (p.s === 1) loadEnd(pr, p.v, undefined, lookup);else loadEnd(pr, undefined, castError(p.v), lookup);
366
- return p;
367
- }
368
- scheduled = true;
369
- queueMicrotask(() => scheduled = false);
370
- runUpdates(() => {
371
- setState(resolved ? "refreshing" : "pending");
372
- trigger();
373
- }, false);
374
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
375
- }
376
- Object.defineProperties(read, {
377
- state: {
378
- get: () => state()
379
- },
380
- error: {
381
- get: () => error()
382
- },
383
- loading: {
384
- get() {
385
- const s = state();
386
- return s === "pending" || s === "refreshing";
387
- }
388
- },
389
- latest: {
390
- get() {
391
- if (!resolved) return read();
392
- const err = error();
393
- if (err && !pr) throw err;
394
- return value();
395
- }
396
- }
397
- });
398
- let owner = Owner;
399
- if (dynamic) createComputed(() => (owner = Owner, load(false)));else load(false);
400
- return [read, {
401
- refetch: info => runWithOwner(owner, () => load(info)),
402
- mutate: setValue
403
- }];
404
- }
405
- function createDeferred(source, options) {
406
- let t,
407
- timeout = options ? options.timeoutMs : undefined;
408
- const node = createComputation(() => {
409
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
410
- timeout
411
- } : undefined);
412
- return source();
413
- }, undefined, true);
414
- const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
415
- updateComputation(node);
416
- setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
417
- return deferred;
418
- }
419
- function createSelector(source, fn = equalFn, options) {
420
- const subs = new Map();
421
- const node = createComputation(p => {
422
- const v = source();
423
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
424
- for (const c of val.values()) {
425
- c.state = STALE;
426
- if (c.pure) Updates.push(c);else Effects.push(c);
427
- }
428
- }
429
- return v;
430
- }, undefined, true, STALE);
431
- updateComputation(node);
432
- return key => {
433
- const listener = Listener;
434
- if (listener) {
435
- let l;
436
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
437
- onCleanup(() => {
438
- l.delete(listener);
439
- !l.size && subs.delete(key);
440
- });
441
- }
442
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
443
- };
444
- }
445
- function batch(fn) {
446
- return runUpdates(fn, false);
447
- }
448
- function untrack(fn) {
449
- if (!ExternalSourceConfig && Listener === null) return fn();
450
- const listener = Listener;
451
- Listener = null;
452
- try {
453
- if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
454
- return fn();
455
- } finally {
456
- Listener = listener;
457
- }
458
- }
459
- function on(deps, fn, options) {
460
- const isArray = Array.isArray(deps);
461
- let prevInput;
462
- let defer = options && options.defer;
463
- return prevValue => {
464
- let input;
465
- if (isArray) {
466
- input = Array(deps.length);
467
- for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
468
- } else input = deps();
469
- if (defer) {
470
- defer = false;
471
- return prevValue;
472
- }
473
- const result = untrack(() => fn(input, prevInput, prevValue));
474
- prevInput = input;
475
- return result;
476
- };
477
- }
478
- function onMount(fn) {
479
- createEffect(() => untrack(fn));
480
- }
481
- function onCleanup(fn) {
482
- if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
483
- return fn;
484
- }
485
- function catchError(fn, handler) {
486
- ERROR || (ERROR = Symbol("error"));
487
- Owner = createComputation(undefined, undefined, true);
488
- Owner.context = {
489
- ...Owner.context,
490
- [ERROR]: [handler]
491
- };
492
- if (Transition && Transition.running) Transition.sources.add(Owner);
493
- try {
494
- return fn();
495
- } catch (err) {
496
- handleError(err);
497
- } finally {
498
- Owner = Owner.owner;
499
- }
500
- }
501
- function getListener() {
502
- return Listener;
503
- }
504
- function getOwner() {
505
- return Owner;
506
- }
507
- function runWithOwner(o, fn) {
508
- const prev = Owner;
509
- const prevListener = Listener;
510
- Owner = o;
511
- Listener = null;
512
- try {
513
- return runUpdates(fn, true);
514
- } catch (err) {
515
- handleError(err);
516
- } finally {
517
- Owner = prev;
518
- Listener = prevListener;
519
- }
520
- }
521
- function enableScheduling(scheduler = requestCallback) {
522
- Scheduler = scheduler;
523
- }
524
- function startTransition(fn) {
525
- if (Transition && Transition.running) {
526
- fn();
527
- return Transition.done;
528
- }
529
- const l = Listener;
530
- const o = Owner;
531
- return Promise.resolve().then(() => {
532
- Listener = l;
533
- Owner = o;
534
- let t;
535
- if (Scheduler || SuspenseContext) {
536
- t = Transition || (Transition = {
537
- sources: new Set(),
538
- effects: [],
539
- promises: new Set(),
540
- disposed: new Set(),
541
- queue: new Set(),
542
- running: true
543
- });
544
- t.done || (t.done = new Promise(res => t.resolve = res));
545
- t.running = true;
546
- }
547
- runUpdates(fn, false);
548
- Listener = Owner = null;
549
- return t ? t.done : undefined;
45
+ let _hydrationEndCallbacks = null;
46
+ let _pendingBoundaries = 0;
47
+ let _hydrationDone = false;
48
+ let _snapshotRootOwner = null;
49
+ function markTopLevelSnapshotScope() {
50
+ if (_snapshotRootOwner) return;
51
+ let owner = signals.getOwner();
52
+ if (!owner) return;
53
+ while (owner._parent) owner = owner._parent;
54
+ signals.markSnapshotScope(owner);
55
+ _snapshotRootOwner = owner;
56
+ }
57
+ function drainHydrationCallbacks() {
58
+ if (_hydrationDone) return;
59
+ _hydrationDone = true;
60
+ _doneValue = true;
61
+ signals.clearSnapshots();
62
+ signals.setSnapshotCapture(false);
63
+ signals.flush();
64
+ const cbs = _hydrationEndCallbacks;
65
+ _hydrationEndCallbacks = null;
66
+ if (cbs) for (const cb of cbs) cb();
67
+ setTimeout(() => {
68
+ if (globalThis._$HY) globalThis._$HY.done = true;
550
69
  });
551
70
  }
552
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
553
- function useTransition() {
554
- return [transPending, startTransition];
555
- }
556
- function resumeEffects(e) {
557
- Effects.push.apply(Effects, e);
558
- e.length = 0;
559
- }
560
- function createContext(defaultValue, options) {
561
- const id = Symbol("context");
562
- return {
563
- id,
564
- Provider: createProvider(id),
565
- defaultValue
566
- };
567
- }
568
- function useContext(context) {
569
- let value;
570
- return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
571
- }
572
- function children(fn) {
573
- const children = createMemo(fn);
574
- const memo = createMemo(() => resolveChildren(children()));
575
- memo.toArray = () => {
576
- const c = memo();
577
- return Array.isArray(c) ? c : c != null ? [c] : [];
578
- };
579
- return memo;
580
- }
581
- let SuspenseContext;
582
- function getSuspenseContext() {
583
- return SuspenseContext || (SuspenseContext = createContext());
584
- }
585
- function enableExternalSource(factory, untrack = fn => fn()) {
586
- if (ExternalSourceConfig) {
587
- const {
588
- factory: oldFactory,
589
- untrack: oldUntrack
590
- } = ExternalSourceConfig;
591
- ExternalSourceConfig = {
592
- factory: (fn, trigger) => {
593
- const oldSource = oldFactory(fn, trigger);
594
- const source = factory(x => oldSource.track(x), trigger);
595
- return {
596
- track: x => source.track(x),
597
- dispose() {
598
- source.dispose();
599
- oldSource.dispose();
600
- }
601
- };
602
- },
603
- untrack: fn => oldUntrack(() => untrack(fn))
604
- };
605
- } else {
606
- ExternalSourceConfig = {
607
- factory,
608
- untrack
609
- };
610
- }
71
+ function checkHydrationComplete() {
72
+ if (_pendingBoundaries === 0) drainHydrationCallbacks();
611
73
  }
612
- function readSignal() {
613
- const runningTransition = Transition && Transition.running;
614
- if (this.sources && (runningTransition ? this.tState : this.state)) {
615
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
616
- const updates = Updates;
617
- Updates = null;
618
- runUpdates(() => lookUpstream(this), false);
619
- Updates = updates;
620
- }
74
+ let _hydratingValue = false;
75
+ let _doneValue = false;
76
+ let _createMemo;
77
+ let _createSignal;
78
+ let _createErrorBoundary;
79
+ let _createOptimistic;
80
+ let _createProjection;
81
+ let _createStore;
82
+ let _createOptimisticStore;
83
+ let _createRenderEffect;
84
+ let _createEffect;
85
+ class MockPromise {
86
+ static all() {
87
+ return new MockPromise();
621
88
  }
622
- if (Listener) {
623
- link(this, Listener);
89
+ static allSettled() {
90
+ return new MockPromise();
624
91
  }
625
- if (runningTransition && Transition.sources.has(this)) return this.tValue;
626
- return this.value;
627
- }
628
- function link(source, observer) {
629
- const prevSource = observer.sourcesTail;
630
- if (prevSource !== null && prevSource.source === source) {
631
- return;
92
+ static any() {
93
+ return new MockPromise();
632
94
  }
633
- const nextSource = prevSource !== null ? prevSource.nextSource : observer.sources;
634
- const time = observer.relinkTime;
635
- if (nextSource !== null && nextSource.source === source) {
636
- nextSource.version = time;
637
- observer.sourcesTail = nextSource;
638
- return;
95
+ static race() {
96
+ return new MockPromise();
639
97
  }
640
- const prevObserver = source.observersTail;
641
- if (prevObserver !== null && prevObserver.version === observer.relinkTime && prevObserver.observer === observer) {
642
- return;
98
+ static reject() {
99
+ return new MockPromise();
643
100
  }
644
- const newLink = observer.sourcesTail = source.observersTail = {
645
- source: source,
646
- observer: observer,
647
- nextSource: nextSource,
648
- prevObserver: prevObserver,
649
- nextObserver: null,
650
- version: time
651
- };
652
- if (prevSource !== null) {
653
- prevSource.nextSource = newLink;
654
- } else {
655
- observer.sources = newLink;
101
+ static resolve() {
102
+ return new MockPromise();
656
103
  }
657
- if (prevObserver !== null) {
658
- prevObserver.nextObserver = newLink;
659
- } else {
660
- source.observers = newLink;
104
+ catch() {
105
+ return new MockPromise();
661
106
  }
662
- }
663
- function writeSignal(node, value, isComp) {
664
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
665
- if (!node.comparator || !node.comparator(current, value)) {
666
- if (Transition) {
667
- const TransitionRunning = Transition.running;
668
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
669
- Transition.sources.add(node);
670
- node.tValue = value;
671
- }
672
- if (!TransitionRunning) node.value = value;
673
- } else node.value = value;
674
- if (node.observers && node.observers) {
675
- runUpdates(() => {
676
- for (let link = node.observers; link !== null; link = link.nextObserver) {
677
- const o = link.observer;
678
- if (link.version < o.relinkTime) continue;
679
- const TransitionRunning = Transition && Transition.running;
680
- if (TransitionRunning && Transition.disposed.has(o)) continue;
681
- if (TransitionRunning ? !o.tState : !o.state) {
682
- if (o.pure) Updates.push(o);else Effects.push(o);
683
- if (o.observers) markDownstream(o);
684
- }
685
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
686
- }
687
- if (Updates.length > 10e5) {
688
- Updates = [];
689
- if (IS_DEV) ;
690
- throw new Error();
691
- }
692
- }, false);
693
- }
107
+ then() {
108
+ return new MockPromise();
694
109
  }
695
- return value;
696
- }
697
- function updateComputation(node) {
698
- if (!node.fn) return;
699
- node.sourcesTail = null;
700
- node.relinkTime = ExecCount;
701
- cleanupRoot(node);
702
- const time = ExecCount;
703
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
704
- afterComputation(node);
705
- if (Transition && !Transition.running && Transition.sources.has(node)) {
706
- queueMicrotask(() => {
707
- runUpdates(() => {
708
- Transition && (Transition.running = true);
709
- Listener = Owner = node;
710
- runComputation(node, node.tValue, time);
711
- Listener = Owner = null;
712
- }, false);
713
- });
110
+ finally() {
111
+ return new MockPromise();
714
112
  }
715
113
  }
716
- function runComputation(node, value, time) {
717
- let nextValue;
718
- const owner = Owner,
719
- listener = Listener;
720
- Listener = Owner = node;
114
+ function subFetch(fn, prev) {
115
+ const ogFetch = fetch;
116
+ const ogPromise = Promise;
721
117
  try {
722
- nextValue = node.fn(value);
723
- } catch (err) {
724
- if (node.pure) {
725
- if (Transition && Transition.running) {
726
- node.tState = STALE;
727
- node.tOwned && node.tOwned.forEach(destroyNode);
728
- node.tOwned = undefined;
729
- } else {
730
- node.state = STALE;
731
- node.owned && node.owned.forEach(destroyNode);
732
- node.owned = null;
733
- }
118
+ window.fetch = () => new MockPromise();
119
+ Promise = MockPromise;
120
+ const result = fn(prev);
121
+ if (result && typeof result[Symbol.asyncIterator] === "function") {
122
+ result[Symbol.asyncIterator]().next();
734
123
  }
735
- node.updatedAt = time + 1;
736
- return handleError(err);
124
+ return result;
737
125
  } finally {
738
- Listener = listener;
739
- Owner = owner;
740
- }
741
- if (!node.updatedAt || node.updatedAt <= time) {
742
- if (node.updatedAt != null && "observers" in node) {
743
- writeSignal(node, nextValue, true);
744
- } else if (Transition && Transition.running && node.pure) {
745
- Transition.sources.add(node);
746
- node.tValue = nextValue;
747
- } else node.value = nextValue;
748
- node.updatedAt = time;
749
- }
750
- }
751
- function createComputation(fn, init, pure, state = STALE, options) {
752
- const c = {
753
- fn,
754
- state: state,
755
- updatedAt: null,
756
- owned: null,
757
- sources: null,
758
- sourcesTail: null,
759
- cleanups: null,
760
- value: init,
761
- owner: Owner,
762
- relinkTime: 0,
763
- context: Owner ? Owner.context : null,
764
- pure
765
- };
766
- if (Transition && Transition.running) {
767
- c.state = 0;
768
- c.tState = state;
769
- }
770
- if (Owner === null) ;else if (Owner !== UNOWNED) {
771
- if (Transition && Transition.running && Owner.pure) {
772
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
126
+ window.fetch = ogFetch;
127
+ Promise = ogPromise;
128
+ }
129
+ }
130
+ function consumeFirstSync(ai) {
131
+ const iter = ai[Symbol.asyncIterator]();
132
+ const r = iter.next();
133
+ const value = !(r instanceof Promise) && !r.done ? r.value : undefined;
134
+ return [value, iter];
135
+ }
136
+ function applyPatches(target, patches) {
137
+ for (const patch of patches) {
138
+ const path = patch[0];
139
+ let current = target;
140
+ for (let i = 0; i < path.length - 1; i++) current = current[path[i]];
141
+ const key = path[path.length - 1];
142
+ if (patch.length === 1) {
143
+ Array.isArray(current) ? current.splice(key, 1) : delete current[key];
144
+ } else if (patch.length === 3) {
145
+ current.splice(key, 0, patch[1]);
773
146
  } else {
774
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
147
+ current[key] = patch[1];
775
148
  }
776
149
  }
777
- if (ExternalSourceConfig && c.fn) {
778
- const [track, trigger] = createSignal(undefined, {
779
- equals: false
780
- });
781
- const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
782
- onCleanup(() => ordinary.dispose());
783
- const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
784
- const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
785
- c.fn = x => {
786
- track();
787
- return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
788
- };
789
- }
790
- return c;
791
150
  }
792
- function runTop(node) {
793
- const runningTransition = Transition && Transition.running;
794
- if ((runningTransition ? node.tState : node.state) === 0) return;
795
- if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
796
- if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
797
- const ancestors = [node];
798
- while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
799
- if (runningTransition && Transition.disposed.has(node)) return;
800
- if (runningTransition ? node.tState : node.state) ancestors.push(node);
801
- }
802
- for (let i = ancestors.length - 1; i >= 0; i--) {
803
- node = ancestors[i];
804
- if (runningTransition) {
805
- let top = node,
806
- prev = ancestors[i + 1];
807
- while ((top = top.owner) && top !== prev) {
808
- if (Transition.disposed.has(top)) return;
151
+ function scheduleIteratorConsumption(iter, apply) {
152
+ const consume = () => {
153
+ while (true) {
154
+ const n = iter.next();
155
+ if (n instanceof Promise) {
156
+ n.then(r => {
157
+ if (r.done) return;
158
+ apply(r.value);
159
+ consume();
160
+ });
161
+ return;
809
162
  }
163
+ if (n.done) break;
164
+ apply(n.value);
810
165
  }
811
- if ((runningTransition ? node.tState : node.state) === STALE) {
812
- updateComputation(node);
813
- } else if ((runningTransition ? node.tState : node.state) === PENDING) {
814
- const updates = Updates;
815
- Updates = null;
816
- runUpdates(() => lookUpstream(node, ancestors[0]), false);
817
- Updates = updates;
818
- }
819
- }
820
- }
821
- function runUpdates(fn, init) {
822
- if (Updates) return fn();
823
- let wait = false;
824
- if (!init) Updates = [];
825
- if (Effects) wait = true;else Effects = [];
826
- ExecCount++;
827
- try {
828
- const res = fn();
829
- completeUpdates(wait);
830
- return res;
831
- } catch (err) {
832
- if (!wait) Effects = null;
833
- Updates = null;
834
- handleError(err);
835
- }
836
- }
837
- function completeUpdates(wait) {
838
- if (Updates) {
839
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
840
- Updates = null;
841
- }
842
- if (wait) return;
843
- let res;
844
- if (Transition) {
845
- if (!Transition.promises.size && !Transition.queue.size) {
846
- const sources = Transition.sources;
847
- const disposed = Transition.disposed;
848
- Effects.push.apply(Effects, Transition.effects);
849
- res = Transition.resolve;
850
- for (const e of Effects) {
851
- "tState" in e && (e.state = e.tState);
852
- delete e.tState;
853
- }
854
- Transition = null;
855
- runUpdates(() => {
856
- for (const d of disposed) destroyNode(d);
857
- for (const v of sources) {
858
- v.value = v.tValue;
859
- if (v.owned) {
860
- for (let i = 0, len = v.owned.length; i < len; i++) destroyNode(v.owned[i]);
861
- }
862
- if (v.tOwned) v.owned = v.tOwned;
863
- delete v.tValue;
864
- delete v.tOwned;
865
- v.tState = 0;
166
+ };
167
+ consume();
168
+ }
169
+ function isAsyncIterable(v) {
170
+ return v != null && typeof v[Symbol.asyncIterator] === "function";
171
+ }
172
+ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
173
+ const parent = signals.getOwner();
174
+ const expectedId = signals.peekNextChildId(parent);
175
+ if (!sharedConfig.has(expectedId)) return null;
176
+ const initP = sharedConfig.load(expectedId);
177
+ if (!isAsyncIterable(initP)) return null;
178
+ const [firstValue, iter] = consumeFirstSync(initP);
179
+ const [get, set] = signals.createSignal(firstValue);
180
+ const result = coreFn(() => get(), firstValue, options);
181
+ scheduleIteratorConsumption(iter, v => {
182
+ set(() => v);
183
+ signals.flush();
184
+ });
185
+ return result;
186
+ }
187
+ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
188
+ const parent = signals.getOwner();
189
+ const expectedId = signals.peekNextChildId(parent);
190
+ if (!sharedConfig.has(expectedId)) return null;
191
+ const initP = sharedConfig.load(expectedId);
192
+ if (!isAsyncIterable(initP)) return null;
193
+ const [firstState, iter] = consumeFirstSync(initP);
194
+ const [store, setStore] = coreFn(() => {}, firstState ?? initialValue, options);
195
+ scheduleIteratorConsumption(iter, patches => {
196
+ setStore(d => {
197
+ applyPatches(d, patches);
198
+ });
199
+ });
200
+ return [store, setStore];
201
+ }
202
+ function hydratedCreateMemo(compute, value, options) {
203
+ if (!sharedConfig.hydrating) return signals.createMemo(compute, value, options);
204
+ markTopLevelSnapshotScope();
205
+ const ssrSource = options?.ssrSource;
206
+ if (ssrSource === "client") {
207
+ const [hydrated, setHydrated] = signals.createSignal(false);
208
+ const memo = signals.createMemo(prev => {
209
+ if (!hydrated()) return prev ?? value;
210
+ return compute(prev);
211
+ }, value, options);
212
+ setHydrated(true);
213
+ return memo;
214
+ }
215
+ if (ssrSource === "initial") {
216
+ return signals.createMemo(prev => {
217
+ if (!sharedConfig.hydrating) return compute(prev);
218
+ subFetch(compute, prev);
219
+ return prev ?? value;
220
+ }, value, options);
221
+ }
222
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, value, options);
223
+ if (aiResult !== null) return aiResult;
224
+ return signals.createMemo(prev => {
225
+ const o = signals.getOwner();
226
+ if (!sharedConfig.hydrating) return compute(prev);
227
+ let initP;
228
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
229
+ const init = initP?.v ?? initP;
230
+ return init != null ? (subFetch(compute, prev), init) : compute(prev);
231
+ }, value, options);
232
+ }
233
+ function hydratedCreateSignal(fn, second, third) {
234
+ if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second, third);
235
+ markTopLevelSnapshotScope();
236
+ const ssrSource = third?.ssrSource;
237
+ if (ssrSource === "client") {
238
+ const [hydrated, setHydrated] = signals.createSignal(false);
239
+ const sig = signals.createSignal(prev => {
240
+ if (!hydrated()) return prev ?? second;
241
+ return fn(prev);
242
+ }, second, third);
243
+ setHydrated(true);
244
+ return sig;
245
+ }
246
+ if (ssrSource === "initial") {
247
+ return signals.createSignal(prev => {
248
+ if (!sharedConfig.hydrating) return fn(prev);
249
+ subFetch(fn, prev);
250
+ return prev ?? second;
251
+ }, second, third);
252
+ }
253
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second, third);
254
+ if (aiResult !== null) return aiResult;
255
+ return signals.createSignal(prev => {
256
+ if (!sharedConfig.hydrating) return fn(prev);
257
+ const o = signals.getOwner();
258
+ let initP;
259
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
260
+ const init = initP?.v ?? initP;
261
+ return init != null ? (subFetch(fn, prev), init) : fn(prev);
262
+ }, second, third);
263
+ }
264
+ function hydratedCreateErrorBoundary(fn, fallback) {
265
+ if (!sharedConfig.hydrating) return signals.createErrorBoundary(fn, fallback);
266
+ markTopLevelSnapshotScope();
267
+ const parent = signals.getOwner();
268
+ const expectedId = signals.peekNextChildId(parent);
269
+ if (sharedConfig.has(expectedId)) {
270
+ const err = sharedConfig.load(expectedId);
271
+ if (err !== undefined) {
272
+ let hydrated = true;
273
+ return signals.createErrorBoundary(() => {
274
+ if (hydrated) {
275
+ hydrated = false;
276
+ throw err;
866
277
  }
867
- setTransPending(false);
868
- }, false);
869
- } else if (Transition.running) {
870
- Transition.running = false;
871
- Transition.effects.push.apply(Transition.effects, Effects);
872
- Effects = null;
873
- setTransPending(true);
874
- return;
875
- }
876
- }
877
- const e = Effects;
878
- Effects = null;
879
- if (e.length) runUpdates(() => runEffects(e), false);
880
- if (res) res();
881
- }
882
- function runQueue(queue) {
883
- for (let i = 0; i < queue.length; i++) runTop(queue[i]);
884
- }
885
- function scheduleQueue(queue) {
886
- for (let i = 0; i < queue.length; i++) {
887
- const item = queue[i];
888
- const tasks = Transition.queue;
889
- if (!tasks.has(item)) {
890
- tasks.add(item);
891
- Scheduler(() => {
892
- tasks.delete(item);
893
- runUpdates(() => {
894
- Transition.running = true;
895
- runTop(item);
896
- }, false);
897
- Transition && (Transition.running = false);
898
- });
899
- }
900
- }
901
- }
902
- function runUserEffects(queue) {
903
- let i,
904
- userLength = 0;
905
- for (i = 0; i < queue.length; i++) {
906
- const e = queue[i];
907
- if (!e.user) runTop(e);else queue[userLength++] = e;
908
- }
909
- if (sharedConfig.context) {
910
- if (sharedConfig.count) {
911
- sharedConfig.effects || (sharedConfig.effects = []);
912
- sharedConfig.effects.push(...queue.slice(0, userLength));
913
- return;
914
- }
915
- setHydrateContext();
916
- }
917
- if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
918
- queue = [...sharedConfig.effects, ...queue];
919
- userLength += sharedConfig.effects.length;
920
- delete sharedConfig.effects;
921
- }
922
- for (i = 0; i < userLength; i++) runTop(queue[i]);
923
- }
924
- function lookUpstream(node, ignore) {
925
- const runningTransition = Transition && Transition.running;
926
- if (runningTransition) node.tState = 0;else node.state = 0;
927
- for (let link = node.sources; link !== null; link = link.nextSource) {
928
- const source = link.source;
929
- if (source.sources) {
930
- const state = runningTransition ? source.tState : source.state;
931
- if (state === STALE) {
932
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
933
- } else if (state === PENDING) lookUpstream(source, ignore);
934
- }
935
- }
936
- }
937
- function markDownstream(node) {
938
- const runningTransition = Transition && Transition.running;
939
- for (let link = node.observers; link !== null; link = link.nextObserver) {
940
- const o = link.observer;
941
- if (link.version < o.relinkTime) continue;
942
- if (runningTransition ? !o.tState : !o.state) {
943
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
944
- if (o.pure) Updates.push(o);else Effects.push(o);
945
- o.observers && markDownstream(o);
946
- }
947
- }
948
- }
949
- function cleanupRoot(node) {
950
- let i;
951
- if (node.tOwned) {
952
- for (i = node.tOwned.length - 1; i >= 0; i--) destroyNode(node.tOwned[i]);
953
- delete node.tOwned;
954
- }
955
- if (Transition && Transition.running && node.pure) {
956
- reset(node, true);
957
- } else if (node.owned) {
958
- for (i = node.owned.length - 1; i >= 0; i--) destroyNode(node.owned[i]);
959
- node.owned = null;
960
- }
961
- if (node.cleanups) {
962
- for (let i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
963
- node.cleanups = null;
964
- }
965
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
966
- }
967
- function afterComputation(node) {
968
- const sourcesTail = node.sourcesTail;
969
- let toRemove = sourcesTail !== null ? sourcesTail.nextSource : node.sources;
970
- if (toRemove !== null) {
971
- do {
972
- toRemove = unlinkFromObservers(toRemove);
973
- } while (toRemove !== null);
974
- if (sourcesTail !== null) {
975
- sourcesTail.nextSource = null;
976
- } else {
977
- node.sources = null;
978
- }
979
- }
980
- }
981
- function unlinkFromObservers(link) {
982
- const source = link.source;
983
- const nextSource = link.nextSource;
984
- const nextObserver = link.nextObserver;
985
- const prevObserver = link.prevObserver;
986
- if (nextObserver !== null) {
987
- nextObserver.prevObserver = prevObserver;
988
- } else {
989
- source.observersTail = prevObserver;
990
- }
991
- if (prevObserver !== null) {
992
- prevObserver.nextObserver = nextObserver;
993
- } else {
994
- source.observers = nextObserver;
995
- }
996
- return nextSource;
997
- }
998
- function destroyNode(node) {
999
- let link = node.sources;
1000
- while (link) {
1001
- link = unlinkFromObservers(link);
278
+ return fn();
279
+ }, fallback);
280
+ }
281
+ }
282
+ return signals.createErrorBoundary(fn, fallback);
283
+ }
284
+ function hydratedCreateOptimistic(fn, second, third) {
285
+ if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second, third);
286
+ markTopLevelSnapshotScope();
287
+ const ssrSource = third?.ssrSource;
288
+ if (ssrSource === "client") {
289
+ const [hydrated, setHydrated] = signals.createSignal(false);
290
+ const sig = signals.createOptimistic(prev => {
291
+ if (!hydrated()) return prev ?? second;
292
+ return fn(prev);
293
+ }, second, third);
294
+ setHydrated(true);
295
+ return sig;
296
+ }
297
+ if (ssrSource === "initial") {
298
+ return signals.createOptimistic(prev => {
299
+ if (!sharedConfig.hydrating) return fn(prev);
300
+ subFetch(fn, prev);
301
+ return prev ?? second;
302
+ }, second, third);
303
+ }
304
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second, third);
305
+ if (aiResult !== null) return aiResult;
306
+ return signals.createOptimistic(prev => {
307
+ const o = signals.getOwner();
308
+ if (!sharedConfig.hydrating) return fn(prev);
309
+ let initP;
310
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
311
+ const init = initP?.v ?? initP;
312
+ return init != null ? (subFetch(fn, prev), init) : fn(prev);
313
+ }, second, third);
314
+ }
315
+ function wrapStoreFn(fn, ssrSource) {
316
+ if (ssrSource === "initial") {
317
+ return draft => {
318
+ if (!sharedConfig.hydrating) return fn(draft);
319
+ subFetch(fn, draft);
320
+ return undefined;
321
+ };
1002
322
  }
1003
- node.sources = null;
1004
- node.sourcesTail = null;
1005
- cleanupRoot(node);
323
+ return draft => {
324
+ const o = signals.getOwner();
325
+ if (!sharedConfig.hydrating) return fn(draft);
326
+ let initP;
327
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
328
+ const init = initP?.v ?? initP;
329
+ return init != null ? (subFetch(fn, draft), init) : fn(draft);
330
+ };
1006
331
  }
1007
- function reset(node, top) {
1008
- if (!top) {
1009
- node.tState = 0;
1010
- Transition.disposed.add(node);
332
+ function hydratedCreateStore(first, second, third) {
333
+ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createStore(first, second, third);
334
+ markTopLevelSnapshotScope();
335
+ const ssrSource = third?.ssrSource;
336
+ if (ssrSource === "client" || ssrSource === "initial") {
337
+ return signals.createStore(second ?? {}, undefined, third);
338
+ }
339
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, second ?? {}, third);
340
+ if (aiResult !== null) return aiResult;
341
+ return signals.createStore(wrapStoreFn(first, ssrSource), second, third);
342
+ }
343
+ function hydratedCreateOptimisticStore(first, second, third) {
344
+ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createOptimisticStore(first, second, third);
345
+ markTopLevelSnapshotScope();
346
+ const ssrSource = third?.ssrSource;
347
+ if (ssrSource === "client" || ssrSource === "initial") {
348
+ return signals.createOptimisticStore(second ?? {}, undefined, third);
349
+ }
350
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createOptimisticStore, second ?? {}, third);
351
+ if (aiResult !== null) return aiResult;
352
+ return signals.createOptimisticStore(wrapStoreFn(first, ssrSource), second, third);
353
+ }
354
+ function hydratedCreateProjection(fn, initialValue, options) {
355
+ if (!sharedConfig.hydrating) return signals.createProjection(fn, initialValue, options);
356
+ markTopLevelSnapshotScope();
357
+ const ssrSource = options?.ssrSource;
358
+ if (ssrSource === "client" || ssrSource === "initial") {
359
+ return signals.createProjection(draft => draft, initialValue, options);
360
+ }
361
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, initialValue, options);
362
+ if (aiResult !== null) return aiResult[0];
363
+ return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options);
364
+ }
365
+ function hydratedEffect(coreFn, compute, effectFn, value, options) {
366
+ if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
367
+ const ssrSource = options?.ssrSource;
368
+ if (ssrSource === "client") {
369
+ const [hydrated, setHydrated] = signals.createSignal(false);
370
+ let active = false;
371
+ coreFn(prev => {
372
+ if (!hydrated()) return value;
373
+ active = true;
374
+ return compute(prev);
375
+ }, (next, prev) => {
376
+ if (!active) return;
377
+ return effectFn(next, prev);
378
+ }, value, options);
379
+ setHydrated(true);
380
+ return;
1011
381
  }
1012
- if (node.owned) {
1013
- for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
382
+ if (ssrSource === "initial") {
383
+ coreFn(prev => {
384
+ if (!sharedConfig.hydrating) return compute(prev);
385
+ subFetch(compute, prev);
386
+ return prev ?? value;
387
+ }, effectFn, value, options);
388
+ return;
1014
389
  }
390
+ markTopLevelSnapshotScope();
391
+ coreFn(prev => {
392
+ const o = signals.getOwner();
393
+ if (!sharedConfig.hydrating) return compute(prev);
394
+ let initP;
395
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
396
+ const init = initP?.v ?? initP;
397
+ return init != null ? (subFetch(compute, prev), init) : compute(prev);
398
+ }, effectFn, value, options);
1015
399
  }
1016
- function castError(err) {
1017
- if (err instanceof Error) return err;
1018
- return new Error(typeof err === "string" ? err : "Unknown error", {
1019
- cause: err
1020
- });
400
+ function hydratedCreateRenderEffect(compute, effectFn, value, options) {
401
+ return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options);
1021
402
  }
1022
- function runErrors(err, fns, owner) {
1023
- try {
1024
- for (const f of fns) f(err);
1025
- } catch (e) {
1026
- handleError(e, owner && owner.owner || null);
1027
- }
403
+ function hydratedCreateEffect(compute, effectFn, value, options) {
404
+ return hydratedEffect(signals.createEffect, compute, effectFn, value, options);
1028
405
  }
1029
- function handleError(err, owner = Owner) {
1030
- const fns = ERROR && owner && owner.context && owner.context[ERROR];
1031
- const error = castError(err);
1032
- if (!fns) throw error;
1033
- if (Effects) Effects.push({
1034
- fn() {
1035
- runErrors(error, fns, owner);
406
+ function enableHydration() {
407
+ _createMemo = hydratedCreateMemo;
408
+ _createSignal = hydratedCreateSignal;
409
+ _createErrorBoundary = hydratedCreateErrorBoundary;
410
+ _createOptimistic = hydratedCreateOptimistic;
411
+ _createProjection = hydratedCreateProjection;
412
+ _createStore = hydratedCreateStore;
413
+ _createOptimisticStore = hydratedCreateOptimisticStore;
414
+ _createRenderEffect = hydratedCreateRenderEffect;
415
+ _createEffect = hydratedCreateEffect;
416
+ _hydratingValue = sharedConfig.hydrating;
417
+ _doneValue = sharedConfig.done;
418
+ Object.defineProperty(sharedConfig, "hydrating", {
419
+ get() {
420
+ return _hydratingValue;
1036
421
  },
1037
- sources: null,
1038
- state: STALE
1039
- });else runErrors(error, fns, owner);
1040
- }
1041
- function resolveChildren(children) {
1042
- if (typeof children === "function" && !children.length) return resolveChildren(children());
1043
- if (Array.isArray(children)) {
1044
- const results = [];
1045
- for (let i = 0; i < children.length; i++) {
1046
- const result = resolveChildren(children[i]);
1047
- Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
1048
- }
1049
- return results;
1050
- }
1051
- return children;
1052
- }
1053
- function createProvider(id, options) {
1054
- return function provider(props) {
1055
- let res;
1056
- createRenderEffect(() => res = untrack(() => {
1057
- Owner.context = {
1058
- ...Owner.context,
1059
- [id]: props.value
1060
- };
1061
- return children(() => props.children);
1062
- }), undefined);
1063
- return res;
1064
- };
1065
- }
1066
- function onError(fn) {
1067
- ERROR || (ERROR = Symbol("error"));
1068
- if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
1069
- Owner.context = {
1070
- ...Owner.context,
1071
- [ERROR]: [fn]
1072
- };
1073
- mutateContext(Owner, ERROR, [fn]);
1074
- } else Owner.context[ERROR].push(fn);
1075
- }
1076
- function mutateContext(o, key, value) {
1077
- if (o.owned) {
1078
- for (let i = 0; i < o.owned.length; i++) {
1079
- if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
1080
- if (!o.owned[i].context) {
1081
- o.owned[i].context = o.context;
1082
- mutateContext(o.owned[i], key, value);
1083
- } else if (!o.owned[i].context[key]) {
1084
- o.owned[i].context[key] = value;
1085
- mutateContext(o.owned[i], key, value);
422
+ set(v) {
423
+ const was = _hydratingValue;
424
+ _hydratingValue = v;
425
+ if (!was && v) {
426
+ _hydrationDone = false;
427
+ _doneValue = false;
428
+ _pendingBoundaries = 0;
429
+ signals.setSnapshotCapture(true);
430
+ _snapshotRootOwner = null;
431
+ } else if (was && !v) {
432
+ if (_snapshotRootOwner) {
433
+ signals.releaseSnapshotScope(_snapshotRootOwner);
434
+ _snapshotRootOwner = null;
435
+ }
436
+ checkHydrationComplete();
1086
437
  }
1087
- }
1088
- }
438
+ },
439
+ configurable: true,
440
+ enumerable: true
441
+ });
442
+ Object.defineProperty(sharedConfig, "done", {
443
+ get() {
444
+ return _doneValue;
445
+ },
446
+ set(v) {
447
+ _doneValue = v;
448
+ if (v) drainHydrationCallbacks();
449
+ },
450
+ configurable: true,
451
+ enumerable: true
452
+ });
1089
453
  }
1090
-
1091
- function observable(input) {
1092
- return {
1093
- subscribe(observer) {
1094
- if (!(observer instanceof Object) || observer == null) {
1095
- throw new TypeError("Expected the observer to be an object.");
1096
- }
1097
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1098
- if (!handler) {
1099
- return {
1100
- unsubscribe() {}
1101
- };
1102
- }
1103
- const dispose = createRoot(disposer => {
1104
- createEffect(() => {
1105
- const v = input();
1106
- untrack(() => handler(v));
1107
- });
1108
- return disposer;
454
+ const createMemo = (...args) => (_createMemo || signals.createMemo)(...args);
455
+ const createSignal = (...args) => (_createSignal || signals.createSignal)(...args);
456
+ const createErrorBoundary = (...args) => (_createErrorBoundary || signals.createErrorBoundary)(...args);
457
+ const createOptimistic = (...args) => (_createOptimistic || signals.createOptimistic)(...args);
458
+ const createProjection = (...args) => (_createProjection || signals.createProjection)(...args);
459
+ const createStore = (...args) => (_createStore || signals.createStore)(...args);
460
+ const createOptimisticStore = (...args) => (_createOptimisticStore || signals.createOptimisticStore)(...args);
461
+ const createRenderEffect = (...args) => (_createRenderEffect || signals.createRenderEffect)(...args);
462
+ const createEffect = (...args) => (_createEffect || signals.createEffect)(...args);
463
+ function loadModuleAssets(mapping) {
464
+ const hy = globalThis._$HY;
465
+ if (!hy) return;
466
+ if (!hy.modules) hy.modules = {};
467
+ if (!hy.loading) hy.loading = {};
468
+ const pending = [];
469
+ for (const moduleUrl in mapping) {
470
+ if (hy.modules[moduleUrl]) continue;
471
+ const entryUrl = mapping[moduleUrl];
472
+ if (!hy.loading[moduleUrl]) {
473
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
474
+ hy.modules[moduleUrl] = mod;
1109
475
  });
1110
- if (getOwner()) onCleanup(dispose);
1111
- return {
1112
- unsubscribe() {
1113
- dispose();
1114
- }
1115
- };
1116
- },
1117
- [Symbol.observable || "@@observable"]() {
1118
- return this;
1119
476
  }
1120
- };
477
+ pending.push(hy.loading[moduleUrl]);
478
+ }
479
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1121
480
  }
1122
- function from(producer, initalValue = undefined) {
1123
- const [s, set] = createSignal(initalValue, {
481
+ function createBoundaryTrigger() {
482
+ signals.setSnapshotCapture(false);
483
+ const [s, set] = signals.createSignal(undefined, {
1124
484
  equals: false
1125
485
  });
1126
- if ("subscribe" in producer) {
1127
- const unsub = producer.subscribe(v => set(() => v));
1128
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1129
- } else {
1130
- const clean = producer(set);
1131
- onCleanup(clean);
486
+ s();
487
+ signals.setSnapshotCapture(true);
488
+ return set;
489
+ }
490
+ function resumeBoundaryHydration(o, id, set) {
491
+ _pendingBoundaries--;
492
+ if (signals.isDisposed(o)) {
493
+ checkHydrationComplete();
494
+ return;
1132
495
  }
1133
- return s;
1134
- }
1135
-
1136
- const FALLBACK = Symbol("fallback");
1137
- function dispose(d) {
1138
- for (let i = 0; i < d.length; i++) d[i]();
1139
- }
1140
- function mapArray(list, mapFn, options = {}) {
1141
- let items = [],
1142
- mapped = [],
1143
- disposers = [],
1144
- len = 0,
1145
- indexes = mapFn.length > 1 ? [] : null;
1146
- onCleanup(() => dispose(disposers));
1147
- return () => {
1148
- let newItems = list() || [],
1149
- newLen = newItems.length,
1150
- i,
1151
- j;
1152
- newItems[$TRACK];
1153
- return untrack(() => {
1154
- let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
1155
- if (newLen === 0) {
1156
- if (len !== 0) {
1157
- dispose(disposers);
1158
- disposers = [];
1159
- items = [];
1160
- mapped = [];
1161
- len = 0;
1162
- indexes && (indexes = []);
1163
- }
1164
- if (options.fallback) {
1165
- items = [FALLBACK];
1166
- mapped[0] = createRoot(disposer => {
1167
- disposers[0] = disposer;
1168
- return options.fallback();
1169
- });
1170
- len = 1;
1171
- }
1172
- }
1173
- else if (len === 0) {
1174
- mapped = new Array(newLen);
1175
- for (j = 0; j < newLen; j++) {
1176
- items[j] = newItems[j];
1177
- mapped[j] = createRoot(mapper);
1178
- }
1179
- len = newLen;
1180
- } else {
1181
- temp = new Array(newLen);
1182
- tempdisposers = new Array(newLen);
1183
- indexes && (tempIndexes = new Array(newLen));
1184
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1185
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1186
- temp[newEnd] = mapped[end];
1187
- tempdisposers[newEnd] = disposers[end];
1188
- indexes && (tempIndexes[newEnd] = indexes[end]);
1189
- }
1190
- newIndices = new Map();
1191
- newIndicesNext = new Array(newEnd + 1);
1192
- for (j = newEnd; j >= start; j--) {
1193
- item = newItems[j];
1194
- i = newIndices.get(item);
1195
- newIndicesNext[j] = i === undefined ? -1 : i;
1196
- newIndices.set(item, j);
1197
- }
1198
- for (i = start; i <= end; i++) {
1199
- item = items[i];
1200
- j = newIndices.get(item);
1201
- if (j !== undefined && j !== -1) {
1202
- temp[j] = mapped[i];
1203
- tempdisposers[j] = disposers[i];
1204
- indexes && (tempIndexes[j] = indexes[i]);
1205
- j = newIndicesNext[j];
1206
- newIndices.set(item, j);
1207
- } else disposers[i]();
1208
- }
1209
- for (j = start; j < newLen; j++) {
1210
- if (j in temp) {
1211
- mapped[j] = temp[j];
1212
- disposers[j] = tempdisposers[j];
1213
- if (indexes) {
1214
- indexes[j] = tempIndexes[j];
1215
- indexes[j](j);
1216
- }
1217
- } else mapped[j] = createRoot(mapper);
1218
- }
1219
- mapped = mapped.slice(0, len = newLen);
1220
- items = newItems.slice(0);
1221
- }
1222
- return mapped;
1223
- });
1224
- function mapper(disposer) {
1225
- disposers[j] = disposer;
1226
- if (indexes) {
1227
- const [s, set] = createSignal(j);
1228
- indexes[j] = set;
1229
- return mapFn(newItems[j], s);
496
+ sharedConfig.gather(id);
497
+ _hydratingValue = true;
498
+ signals.markSnapshotScope(o);
499
+ _snapshotRootOwner = o;
500
+ set();
501
+ signals.flush();
502
+ _snapshotRootOwner = null;
503
+ _hydratingValue = false;
504
+ signals.releaseSnapshotScope(o);
505
+ signals.flush();
506
+ checkHydrationComplete();
507
+ }
508
+ function Loading(props) {
509
+ if (!sharedConfig.hydrating) return signals.createLoadBoundary(() => props.children, () => props.fallback);
510
+ return signals.createMemo(() => {
511
+ const o = signals.getOwner();
512
+ const id = o.id;
513
+ let assetPromise;
514
+ if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
515
+ const mapping = sharedConfig.load(id + "_assets");
516
+ if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
517
+ }
518
+ if (sharedConfig.hydrating && sharedConfig.has(id)) {
519
+ let ref = sharedConfig.load(id);
520
+ let p;
521
+ if (ref) {
522
+ if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(id);
1230
523
  }
1231
- return mapFn(newItems[j]);
1232
- }
1233
- };
1234
- }
1235
- function indexArray(list, mapFn, options = {}) {
1236
- let items = [],
1237
- mapped = [],
1238
- disposers = [],
1239
- signals = [],
1240
- len = 0,
1241
- i;
1242
- onCleanup(() => dispose(disposers));
1243
- return () => {
1244
- const newItems = list() || [],
1245
- newLen = newItems.length;
1246
- newItems[$TRACK];
1247
- return untrack(() => {
1248
- if (newLen === 0) {
1249
- if (len !== 0) {
1250
- dispose(disposers);
1251
- disposers = [];
1252
- items = [];
1253
- mapped = [];
1254
- len = 0;
1255
- signals = [];
1256
- }
1257
- if (options.fallback) {
1258
- items = [FALLBACK];
1259
- mapped[0] = createRoot(disposer => {
1260
- disposers[0] = disposer;
1261
- return options.fallback();
524
+ if (p) {
525
+ _pendingBoundaries++;
526
+ signals.onCleanup(() => {
527
+ if (!signals.isDisposed(o)) return;
528
+ sharedConfig.cleanupFragment?.(id);
529
+ });
530
+ const set = createBoundaryTrigger();
531
+ if (p !== "$$f") {
532
+ const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
533
+ waitFor.then(() => resumeBoundaryHydration(o, id, set), err => {
534
+ _pendingBoundaries--;
535
+ checkHydrationComplete();
536
+ signals.runWithOwner(o, () => {
537
+ throw err;
538
+ });
1262
539
  });
1263
- len = 1;
540
+ } else {
541
+ const afterAssets = () => {
542
+ _pendingBoundaries--;
543
+ set();
544
+ checkHydrationComplete();
545
+ };
546
+ if (assetPromise) assetPromise.then(() => queueMicrotask(afterAssets));else queueMicrotask(afterAssets);
1264
547
  }
1265
- return mapped;
1266
- }
1267
- if (items[0] === FALLBACK) {
1268
- disposers[0]();
1269
- disposers = [];
1270
- items = [];
1271
- mapped = [];
1272
- len = 0;
1273
- }
1274
- for (i = 0; i < newLen; i++) {
1275
- if (i < items.length && items[i] !== newItems[i]) {
1276
- signals[i](() => newItems[i]);
1277
- } else if (i >= items.length) {
1278
- mapped[i] = createRoot(mapper);
1279
- }
1280
- }
1281
- for (; i < items.length; i++) {
1282
- disposers[i]();
548
+ return props.fallback;
1283
549
  }
1284
- len = signals.length = disposers.length = newLen;
1285
- items = newItems.slice(0);
1286
- return mapped = mapped.slice(0, len);
1287
- });
1288
- function mapper(disposer) {
1289
- disposers[i] = disposer;
1290
- const [s, set] = createSignal(newItems[i]);
1291
- signals[i] = set;
1292
- return mapFn(s, i);
1293
550
  }
1294
- };
551
+ if (assetPromise) {
552
+ _pendingBoundaries++;
553
+ const set = createBoundaryTrigger();
554
+ assetPromise.then(() => resumeBoundaryHydration(o, id, set));
555
+ return undefined;
556
+ }
557
+ return signals.createLoadBoundary(() => props.children, () => props.fallback);
558
+ });
1295
559
  }
1296
560
 
1297
- let hydrationEnabled = false;
1298
- function enableHydration() {
1299
- hydrationEnabled = true;
1300
- }
1301
561
  function createComponent(Comp, props) {
1302
- if (hydrationEnabled) {
1303
- if (sharedConfig.context) {
1304
- const c = sharedConfig.context;
1305
- setHydrateContext(nextHydrateContext());
1306
- const r = untrack(() => Comp(props || {}));
1307
- setHydrateContext(c);
1308
- return r;
1309
- }
1310
- }
1311
- return untrack(() => Comp(props || {}));
1312
- }
1313
- function trueFn() {
1314
- return true;
1315
- }
1316
- const propTraps = {
1317
- get(_, property, receiver) {
1318
- if (property === $PROXY) return receiver;
1319
- return _.get(property);
1320
- },
1321
- has(_, property) {
1322
- if (property === $PROXY) return true;
1323
- return _.has(property);
1324
- },
1325
- set: trueFn,
1326
- deleteProperty: trueFn,
1327
- getOwnPropertyDescriptor(_, property) {
1328
- return {
1329
- configurable: true,
1330
- enumerable: true,
1331
- get() {
1332
- return _.get(property);
1333
- },
1334
- set: trueFn,
1335
- deleteProperty: trueFn
1336
- };
1337
- },
1338
- ownKeys(_) {
1339
- return _.keys();
1340
- }
1341
- };
1342
- function resolveSource(s) {
1343
- return !(s = typeof s === "function" ? s() : s) ? {} : s;
1344
- }
1345
- function resolveSources() {
1346
- for (let i = 0, length = this.length; i < length; ++i) {
1347
- const v = this[i]();
1348
- if (v !== undefined) return v;
1349
- }
1350
- }
1351
- function mergeProps(...sources) {
1352
- let proxy = false;
1353
- for (let i = 0; i < sources.length; i++) {
1354
- const s = sources[i];
1355
- proxy = proxy || !!s && $PROXY in s;
1356
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1357
- }
1358
- if (SUPPORTS_PROXY && proxy) {
1359
- return new Proxy({
1360
- get(property) {
1361
- for (let i = sources.length - 1; i >= 0; i--) {
1362
- const v = resolveSource(sources[i])[property];
1363
- if (v !== undefined) return v;
1364
- }
1365
- },
1366
- has(property) {
1367
- for (let i = sources.length - 1; i >= 0; i--) {
1368
- if (property in resolveSource(sources[i])) return true;
1369
- }
1370
- return false;
1371
- },
1372
- keys() {
1373
- const keys = [];
1374
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1375
- return [...new Set(keys)];
1376
- }
1377
- }, propTraps);
1378
- }
1379
- const sourcesMap = {};
1380
- const defined = Object.create(null);
1381
- for (let i = sources.length - 1; i >= 0; i--) {
1382
- const source = sources[i];
1383
- if (!source) continue;
1384
- const sourceKeys = Object.getOwnPropertyNames(source);
1385
- for (let i = sourceKeys.length - 1; i >= 0; i--) {
1386
- const key = sourceKeys[i];
1387
- if (key === "__proto__" || key === "constructor") continue;
1388
- const desc = Object.getOwnPropertyDescriptor(source, key);
1389
- if (!defined[key]) {
1390
- defined[key] = desc.get ? {
1391
- enumerable: true,
1392
- configurable: true,
1393
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1394
- } : desc.value !== undefined ? desc : undefined;
1395
- } else {
1396
- const sources = sourcesMap[key];
1397
- if (sources) {
1398
- if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
1399
- }
1400
- }
1401
- }
1402
- }
1403
- const target = {};
1404
- const definedKeys = Object.keys(defined);
1405
- for (let i = definedKeys.length - 1; i >= 0; i--) {
1406
- const key = definedKeys[i],
1407
- desc = defined[key];
1408
- if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
1409
- }
1410
- return target;
1411
- }
1412
- function splitProps(props, ...keys) {
1413
- const len = keys.length;
1414
- if (SUPPORTS_PROXY && $PROXY in props) {
1415
- const blocked = len > 1 ? keys.flat() : keys[0];
1416
- const res = keys.map(k => {
1417
- return new Proxy({
1418
- get(property) {
1419
- return k.includes(property) ? props[property] : undefined;
1420
- },
1421
- has(property) {
1422
- return k.includes(property) && property in props;
1423
- },
1424
- keys() {
1425
- return k.filter(property => property in props);
1426
- }
1427
- }, propTraps);
1428
- });
1429
- res.push(new Proxy({
1430
- get(property) {
1431
- return blocked.includes(property) ? undefined : props[property];
1432
- },
1433
- has(property) {
1434
- return blocked.includes(property) ? false : property in props;
1435
- },
1436
- keys() {
1437
- return Object.keys(props).filter(k => !blocked.includes(k));
1438
- }
1439
- }, propTraps));
1440
- return res;
1441
- }
1442
- const objects = [];
1443
- for (let i = 0; i <= len; i++) {
1444
- objects[i] = {};
1445
- }
1446
- for (const propName of Object.getOwnPropertyNames(props)) {
1447
- let keyIndex = len;
1448
- for (let i = 0; i < keys.length; i++) {
1449
- if (keys[i].includes(propName)) {
1450
- keyIndex = i;
1451
- break;
1452
- }
1453
- }
1454
- const desc = Object.getOwnPropertyDescriptor(props, propName);
1455
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1456
- isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
1457
- }
1458
- return objects;
562
+ return signals.untrack(() => Comp(props || {}));
1459
563
  }
1460
- function lazy(fn) {
564
+ function lazy(fn, moduleUrl) {
1461
565
  let comp;
1462
566
  let p;
1463
567
  const wrap = props => {
1464
- const ctx = sharedConfig.context;
1465
- if (ctx) {
1466
- const [s, set] = createSignal();
1467
- sharedConfig.count || (sharedConfig.count = 0);
1468
- sharedConfig.count++;
1469
- (p || (p = fn())).then(mod => {
1470
- !sharedConfig.done && setHydrateContext(ctx);
1471
- sharedConfig.count--;
1472
- set(() => mod.default);
1473
- setHydrateContext();
568
+ if (sharedConfig.hydrating && moduleUrl) {
569
+ const cached = globalThis._$HY?.modules?.[moduleUrl];
570
+ if (!cached) {
571
+ throw new Error(`lazy() module "${moduleUrl}" was not preloaded before hydration. ` + "Ensure it is inside a Loading boundary.");
572
+ }
573
+ comp = () => cached.default;
574
+ }
575
+ if (!comp) {
576
+ p || (p = fn());
577
+ p.then(mod => {
578
+ comp = () => mod.default;
1474
579
  });
1475
- comp = s;
1476
- } else if (!comp) {
1477
- const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));
1478
- comp = s;
580
+ comp = signals.createMemo(() => p.then(mod => mod.default));
1479
581
  }
1480
582
  let Comp;
1481
- return createMemo(() => (Comp = comp()) ? untrack(() => {
1482
- if (IS_DEV) ;
1483
- if (!ctx || sharedConfig.done) return Comp(props);
1484
- const c = sharedConfig.context;
1485
- setHydrateContext(ctx);
1486
- const r = Comp(props);
1487
- setHydrateContext(c);
1488
- return r;
583
+ return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
584
+ return Comp(props);
1489
585
  }) : "");
1490
586
  };
1491
587
  wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
@@ -1493,317 +589,250 @@ function lazy(fn) {
1493
589
  }
1494
590
  let counter = 0;
1495
591
  function createUniqueId() {
1496
- const ctx = sharedConfig.context;
1497
- return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
592
+ return sharedConfig.hydrating ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1498
593
  }
1499
594
 
1500
595
  const narrowedError = name => `Stale read from <${name}>.`;
1501
596
  function For(props) {
1502
- const fallback = "fallback" in props && {
597
+ const options = "fallback" in props ? {
598
+ keyed: props.keyed,
1503
599
  fallback: () => props.fallback
600
+ } : {
601
+ keyed: props.keyed
1504
602
  };
1505
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined));
603
+ return signals.mapArray(() => props.each, props.children, options);
1506
604
  }
1507
- function Index(props) {
1508
- const fallback = "fallback" in props && {
605
+ function Repeat(props) {
606
+ const options = "fallback" in props ? {
1509
607
  fallback: () => props.fallback
1510
- };
1511
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined));
608
+ } : {};
609
+ options.from = () => props.from;
610
+ return signals.repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options);
1512
611
  }
1513
612
  function Show(props) {
1514
613
  const keyed = props.keyed;
1515
- const conditionValue = createMemo(() => props.when, undefined, undefined);
1516
- const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
614
+ const conditionValue = signals.createMemo(() => props.when, undefined, undefined);
615
+ const condition = keyed ? conditionValue : signals.createMemo(conditionValue, undefined, {
1517
616
  equals: (a, b) => !a === !b
1518
617
  });
1519
- return createMemo(() => {
618
+ return signals.createMemo(() => {
1520
619
  const c = condition();
1521
620
  if (c) {
1522
621
  const child = props.children;
1523
622
  const fn = typeof child === "function" && child.length > 0;
1524
- return fn ? untrack(() => child(keyed ? c : () => {
1525
- if (!untrack(condition)) throw narrowedError("Show");
1526
- return conditionValue();
1527
- })) : child;
623
+ return fn ? signals.untrack(() => {
624
+ try {
625
+ return child(() => {
626
+ if (!signals.untrack(condition)) throw narrowedError("Show");
627
+ return conditionValue();
628
+ });
629
+ } finally {
630
+ }
631
+ }) : child;
1528
632
  }
1529
633
  return props.fallback;
1530
634
  }, undefined, undefined);
1531
635
  }
1532
636
  function Switch(props) {
1533
637
  const chs = children(() => props.children);
1534
- const switchFunc = createMemo(() => {
1535
- const ch = chs();
1536
- const mps = Array.isArray(ch) ? ch : [ch];
638
+ const switchFunc = signals.createMemo(() => {
639
+ const mps = chs.toArray();
1537
640
  let func = () => undefined;
1538
641
  for (let i = 0; i < mps.length; i++) {
1539
642
  const index = i;
1540
643
  const mp = mps[i];
1541
644
  const prevFunc = func;
1542
- const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when, undefined, undefined);
1543
- const condition = mp.keyed ? conditionValue : createMemo(conditionValue, undefined, {
645
+ const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined, undefined);
646
+ const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, undefined, {
1544
647
  equals: (a, b) => !a === !b
1545
648
  });
1546
649
  func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
1547
650
  }
1548
651
  return func;
1549
652
  });
1550
- return createMemo(() => {
653
+ return signals.createMemo(() => {
1551
654
  const sel = switchFunc()();
1552
655
  if (!sel) return props.fallback;
1553
656
  const [index, conditionValue, mp] = sel;
1554
657
  const child = mp.children;
1555
658
  const fn = typeof child === "function" && child.length > 0;
1556
- return fn ? untrack(() => child(mp.keyed ? conditionValue() : () => {
1557
- if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
1558
- return conditionValue();
1559
- })) : child;
659
+ return fn ? signals.untrack(() => {
660
+ try {
661
+ return child(() => {
662
+ if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
663
+ return conditionValue();
664
+ });
665
+ } finally {
666
+ }
667
+ }) : child;
1560
668
  }, undefined, undefined);
1561
669
  }
1562
670
  function Match(props) {
1563
671
  return props;
1564
672
  }
1565
- let Errors;
1566
- function resetErrorBoundaries() {
1567
- Errors && [...Errors].forEach(fn => fn());
1568
- }
1569
- function ErrorBoundary(props) {
1570
- let err;
1571
- if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
1572
- const [errored, setErrored] = createSignal(err, undefined);
1573
- Errors || (Errors = new Set());
1574
- Errors.add(setErrored);
1575
- onCleanup(() => Errors.delete(setErrored));
1576
- return createMemo(() => {
1577
- let e;
1578
- if (e = errored()) {
1579
- const f = props.fallback;
1580
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1581
- }
1582
- return catchError(() => props.children, setErrored);
1583
- }, undefined, undefined);
1584
- }
1585
-
1586
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1587
- const SuspenseListContext = /* #__PURE__ */createContext();
1588
- function SuspenseList(props) {
1589
- let [wrapper, setWrapper] = createSignal(() => ({
1590
- inFallback: false
1591
- })),
1592
- show;
1593
- const listContext = useContext(SuspenseListContext);
1594
- const [registry, setRegistry] = createSignal([]);
1595
- if (listContext) {
1596
- show = listContext.register(createMemo(() => wrapper()().inFallback));
1597
- }
1598
- const resolved = createMemo(prev => {
1599
- const reveal = props.revealOrder,
1600
- tail = props.tail,
1601
- {
1602
- showContent = true,
1603
- showFallback = true
1604
- } = show ? show() : {},
1605
- reg = registry(),
1606
- reverse = reveal === "backwards";
1607
- if (reveal === "together") {
1608
- const all = reg.every(inFallback => !inFallback());
1609
- const res = reg.map(() => ({
1610
- showContent: all && showContent,
1611
- showFallback
1612
- }));
1613
- res.inFallback = !all;
1614
- return res;
1615
- }
1616
- let stop = false;
1617
- let inFallback = prev.inFallback;
1618
- const res = [];
1619
- for (let i = 0, len = reg.length; i < len; i++) {
1620
- const n = reverse ? len - i - 1 : i,
1621
- s = reg[n]();
1622
- if (!stop && !s) {
1623
- res[n] = {
1624
- showContent,
1625
- showFallback
1626
- };
1627
- } else {
1628
- const next = !stop;
1629
- if (next) inFallback = true;
1630
- res[n] = {
1631
- showContent: next,
1632
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1633
- };
1634
- stop = true;
1635
- }
1636
- }
1637
- if (!stop) inFallback = false;
1638
- res.inFallback = inFallback;
1639
- return res;
1640
- }, {
1641
- inFallback: false
1642
- });
1643
- setWrapper(() => resolved);
1644
- return createComponent(SuspenseListContext.Provider, {
1645
- value: {
1646
- register: inFallback => {
1647
- let index;
1648
- setRegistry(registry => {
1649
- index = registry.length;
1650
- return [...registry, inFallback];
1651
- });
1652
- return createMemo(() => resolved()[index], undefined, {
1653
- equals: suspenseListEquals
1654
- });
1655
- }
1656
- },
1657
- get children() {
1658
- return props.children;
1659
- }
1660
- });
1661
- }
1662
- function Suspense(props) {
1663
- let counter = 0,
1664
- show,
1665
- ctx,
1666
- p,
1667
- flicker,
1668
- error;
1669
- const [inFallback, setFallback] = createSignal(false),
1670
- SuspenseContext = getSuspenseContext(),
1671
- store = {
1672
- increment: () => {
1673
- if (++counter === 1) setFallback(true);
1674
- },
1675
- decrement: () => {
1676
- if (--counter === 0) setFallback(false);
1677
- },
1678
- inFallback,
1679
- effects: [],
1680
- resolved: false
1681
- },
1682
- owner = getOwner();
1683
- if (sharedConfig.context && sharedConfig.load) {
1684
- const key = sharedConfig.getContextId();
1685
- let ref = sharedConfig.load(key);
1686
- if (ref) {
1687
- if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(key);
1688
- }
1689
- if (p && p !== "$$f") {
1690
- const [s, set] = createSignal(undefined, {
1691
- equals: false
1692
- });
1693
- flicker = s;
1694
- p.then(() => {
1695
- if (sharedConfig.done) return set();
1696
- sharedConfig.gather(key);
1697
- setHydrateContext(ctx);
1698
- set();
1699
- setHydrateContext();
1700
- }, err => {
1701
- error = err;
1702
- set();
1703
- });
1704
- }
1705
- }
1706
- const listContext = useContext(SuspenseListContext);
1707
- if (listContext) show = listContext.register(store.inFallback);
1708
- let dispose;
1709
- onCleanup(() => dispose && dispose());
1710
- return createComponent(SuspenseContext.Provider, {
1711
- value: store,
1712
- get children() {
1713
- return createMemo(() => {
1714
- if (error) throw error;
1715
- ctx = sharedConfig.context;
1716
- if (flicker) {
1717
- flicker();
1718
- return flicker = undefined;
1719
- }
1720
- if (ctx && p === "$$f") setHydrateContext();
1721
- const rendered = createMemo(() => props.children);
1722
- return createMemo(prev => {
1723
- const inFallback = store.inFallback(),
1724
- {
1725
- showContent = true,
1726
- showFallback = true
1727
- } = show ? show() : {};
1728
- if ((!inFallback || p && p !== "$$f") && showContent) {
1729
- store.resolved = true;
1730
- dispose && dispose();
1731
- dispose = ctx = p = undefined;
1732
- resumeEffects(store.effects);
1733
- return rendered();
1734
- }
1735
- if (!showFallback) return;
1736
- if (dispose) return prev;
1737
- return createRoot(disposer => {
1738
- dispose = disposer;
1739
- if (ctx) {
1740
- setHydrateContext({
1741
- id: ctx.id + "F",
1742
- count: 0
1743
- });
1744
- ctx = undefined;
1745
- }
1746
- return props.fallback;
1747
- }, owner);
1748
- });
1749
- });
1750
- }
673
+ function Errored(props) {
674
+ return createErrorBoundary(() => props.children, (err, reset) => {
675
+ const f = props.fallback;
676
+ return typeof f === "function" && f.length ? f(err, reset) : f;
1751
677
  });
1752
678
  }
1753
679
 
680
+ function ssrHandleError() {}
681
+ function ssrRunInScope() {}
1754
682
  const DEV = undefined;
1755
683
 
684
+ Object.defineProperty(exports, "$PROXY", {
685
+ enumerable: true,
686
+ get: function () { return signals.$PROXY; }
687
+ });
688
+ Object.defineProperty(exports, "$TRACK", {
689
+ enumerable: true,
690
+ get: function () { return signals.$TRACK; }
691
+ });
692
+ Object.defineProperty(exports, "NotReadyError", {
693
+ enumerable: true,
694
+ get: function () { return signals.NotReadyError; }
695
+ });
696
+ Object.defineProperty(exports, "action", {
697
+ enumerable: true,
698
+ get: function () { return signals.action; }
699
+ });
700
+ Object.defineProperty(exports, "createOwner", {
701
+ enumerable: true,
702
+ get: function () { return signals.createOwner; }
703
+ });
704
+ Object.defineProperty(exports, "createReaction", {
705
+ enumerable: true,
706
+ get: function () { return signals.createReaction; }
707
+ });
708
+ Object.defineProperty(exports, "createRoot", {
709
+ enumerable: true,
710
+ get: function () { return signals.createRoot; }
711
+ });
712
+ Object.defineProperty(exports, "createTrackedEffect", {
713
+ enumerable: true,
714
+ get: function () { return signals.createTrackedEffect; }
715
+ });
716
+ Object.defineProperty(exports, "deep", {
717
+ enumerable: true,
718
+ get: function () { return signals.deep; }
719
+ });
720
+ Object.defineProperty(exports, "flatten", {
721
+ enumerable: true,
722
+ get: function () { return signals.flatten; }
723
+ });
724
+ Object.defineProperty(exports, "flush", {
725
+ enumerable: true,
726
+ get: function () { return signals.flush; }
727
+ });
728
+ Object.defineProperty(exports, "getNextChildId", {
729
+ enumerable: true,
730
+ get: function () { return signals.getNextChildId; }
731
+ });
732
+ Object.defineProperty(exports, "getObserver", {
733
+ enumerable: true,
734
+ get: function () { return signals.getObserver; }
735
+ });
736
+ Object.defineProperty(exports, "getOwner", {
737
+ enumerable: true,
738
+ get: function () { return signals.getOwner; }
739
+ });
740
+ Object.defineProperty(exports, "isEqual", {
741
+ enumerable: true,
742
+ get: function () { return signals.isEqual; }
743
+ });
744
+ Object.defineProperty(exports, "isPending", {
745
+ enumerable: true,
746
+ get: function () { return signals.isPending; }
747
+ });
748
+ Object.defineProperty(exports, "isRefreshing", {
749
+ enumerable: true,
750
+ get: function () { return signals.isRefreshing; }
751
+ });
752
+ Object.defineProperty(exports, "isWrappable", {
753
+ enumerable: true,
754
+ get: function () { return signals.isWrappable; }
755
+ });
756
+ Object.defineProperty(exports, "latest", {
757
+ enumerable: true,
758
+ get: function () { return signals.latest; }
759
+ });
760
+ Object.defineProperty(exports, "mapArray", {
761
+ enumerable: true,
762
+ get: function () { return signals.mapArray; }
763
+ });
764
+ Object.defineProperty(exports, "merge", {
765
+ enumerable: true,
766
+ get: function () { return signals.merge; }
767
+ });
768
+ Object.defineProperty(exports, "omit", {
769
+ enumerable: true,
770
+ get: function () { return signals.omit; }
771
+ });
772
+ Object.defineProperty(exports, "onCleanup", {
773
+ enumerable: true,
774
+ get: function () { return signals.onCleanup; }
775
+ });
776
+ Object.defineProperty(exports, "onSettled", {
777
+ enumerable: true,
778
+ get: function () { return signals.onSettled; }
779
+ });
780
+ Object.defineProperty(exports, "reconcile", {
781
+ enumerable: true,
782
+ get: function () { return signals.reconcile; }
783
+ });
784
+ Object.defineProperty(exports, "refresh", {
785
+ enumerable: true,
786
+ get: function () { return signals.refresh; }
787
+ });
788
+ Object.defineProperty(exports, "repeat", {
789
+ enumerable: true,
790
+ get: function () { return signals.repeat; }
791
+ });
792
+ Object.defineProperty(exports, "resolve", {
793
+ enumerable: true,
794
+ get: function () { return signals.resolve; }
795
+ });
796
+ Object.defineProperty(exports, "runWithOwner", {
797
+ enumerable: true,
798
+ get: function () { return signals.runWithOwner; }
799
+ });
800
+ Object.defineProperty(exports, "snapshot", {
801
+ enumerable: true,
802
+ get: function () { return signals.snapshot; }
803
+ });
804
+ Object.defineProperty(exports, "storePath", {
805
+ enumerable: true,
806
+ get: function () { return signals.storePath; }
807
+ });
808
+ Object.defineProperty(exports, "untrack", {
809
+ enumerable: true,
810
+ get: function () { return signals.untrack; }
811
+ });
1756
812
  exports.$DEVCOMP = $DEVCOMP;
1757
- exports.$PROXY = $PROXY;
1758
- exports.$TRACK = $TRACK;
1759
813
  exports.DEV = DEV;
1760
- exports.ErrorBoundary = ErrorBoundary;
814
+ exports.Errored = Errored;
1761
815
  exports.For = For;
1762
- exports.Index = Index;
816
+ exports.Loading = Loading;
1763
817
  exports.Match = Match;
818
+ exports.Repeat = Repeat;
1764
819
  exports.Show = Show;
1765
- exports.Suspense = Suspense;
1766
- exports.SuspenseList = SuspenseList;
1767
820
  exports.Switch = Switch;
1768
- exports.batch = batch;
1769
- exports.cancelCallback = cancelCallback;
1770
- exports.catchError = catchError;
1771
821
  exports.children = children;
1772
822
  exports.createComponent = createComponent;
1773
- exports.createComputed = createComputed;
1774
823
  exports.createContext = createContext;
1775
- exports.createDeferred = createDeferred;
1776
824
  exports.createEffect = createEffect;
1777
825
  exports.createMemo = createMemo;
1778
- exports.createReaction = createReaction;
826
+ exports.createOptimistic = createOptimistic;
827
+ exports.createOptimisticStore = createOptimisticStore;
828
+ exports.createProjection = createProjection;
1779
829
  exports.createRenderEffect = createRenderEffect;
1780
- exports.createResource = createResource;
1781
- exports.createRoot = createRoot;
1782
- exports.createSelector = createSelector;
1783
830
  exports.createSignal = createSignal;
831
+ exports.createStore = createStore;
1784
832
  exports.createUniqueId = createUniqueId;
1785
- exports.enableExternalSource = enableExternalSource;
1786
833
  exports.enableHydration = enableHydration;
1787
- exports.enableScheduling = enableScheduling;
1788
- exports.equalFn = equalFn;
1789
- exports.from = from;
1790
- exports.getListener = getListener;
1791
- exports.getOwner = getOwner;
1792
- exports.indexArray = indexArray;
1793
834
  exports.lazy = lazy;
1794
- exports.mapArray = mapArray;
1795
- exports.mergeProps = mergeProps;
1796
- exports.observable = observable;
1797
- exports.on = on;
1798
- exports.onCleanup = onCleanup;
1799
- exports.onError = onError;
1800
- exports.onMount = onMount;
1801
- exports.requestCallback = requestCallback;
1802
- exports.resetErrorBoundaries = resetErrorBoundaries;
1803
- exports.runWithOwner = runWithOwner;
1804
835
  exports.sharedConfig = sharedConfig;
1805
- exports.splitProps = splitProps;
1806
- exports.startTransition = startTransition;
1807
- exports.untrack = untrack;
836
+ exports.ssrHandleError = ssrHandleError;
837
+ exports.ssrRunInScope = ssrRunInScope;
1808
838
  exports.useContext = useContext;
1809
- exports.useTransition = useTransition;