solid-js 1.10.0-beta.0 → 2.0.0-beta.1

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