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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/dev.cjs +730 -1723
  2. package/dist/dev.js +595 -1688
  3. package/dist/server.cjs +769 -703
  4. package/dist/server.js +682 -670
  5. package/dist/solid.cjs +696 -1667
  6. package/dist/solid.js +560 -1631
  7. package/package.json +7 -151
  8. package/types/{render → client}/component.d.ts +1 -38
  9. package/types/client/core.d.ts +65 -0
  10. package/types/client/flow.d.ts +100 -0
  11. package/types/client/hydration.d.ts +76 -0
  12. package/types/index.d.ts +11 -14
  13. package/types/jsx.d.ts +1508 -1633
  14. package/types/server/component.d.ts +66 -0
  15. package/types/server/core.d.ts +44 -0
  16. package/types/server/flow.d.ts +60 -0
  17. package/types/server/hydration.d.ts +21 -0
  18. package/types/server/index.d.ts +12 -3
  19. package/types/server/shared.d.ts +45 -0
  20. package/types/server/signals.d.ts +60 -0
  21. package/h/dist/h.cjs +0 -115
  22. package/h/dist/h.js +0 -113
  23. package/h/jsx-dev-runtime/package.json +0 -8
  24. package/h/jsx-runtime/dist/jsx.cjs +0 -15
  25. package/h/jsx-runtime/dist/jsx.js +0 -10
  26. package/h/jsx-runtime/package.json +0 -8
  27. package/h/jsx-runtime/types/index.d.ts +0 -11
  28. package/h/jsx-runtime/types/jsx.d.ts +0 -4242
  29. package/h/package.json +0 -8
  30. package/h/types/hyperscript.d.ts +0 -20
  31. package/h/types/index.d.ts +0 -3
  32. package/html/dist/html.cjs +0 -583
  33. package/html/dist/html.js +0 -581
  34. package/html/package.json +0 -8
  35. package/html/types/index.d.ts +0 -3
  36. package/html/types/lit.d.ts +0 -41
  37. package/store/dist/dev.cjs +0 -458
  38. package/store/dist/dev.js +0 -449
  39. package/store/dist/server.cjs +0 -126
  40. package/store/dist/server.js +0 -114
  41. package/store/dist/store.cjs +0 -438
  42. package/store/dist/store.js +0 -429
  43. package/store/package.json +0 -46
  44. package/store/types/index.d.ts +0 -12
  45. package/store/types/modifiers.d.ts +0 -6
  46. package/store/types/mutable.d.ts +0 -5
  47. package/store/types/server.d.ts +0 -17
  48. package/store/types/store.d.ts +0 -107
  49. package/types/reactive/array.d.ts +0 -44
  50. package/types/reactive/observable.d.ts +0 -36
  51. package/types/reactive/scheduler.d.ts +0 -10
  52. package/types/reactive/signal.d.ts +0 -586
  53. package/types/render/Suspense.d.ts +0 -26
  54. package/types/render/flow.d.ts +0 -118
  55. package/types/render/hydration.d.ts +0 -24
  56. package/types/render/index.d.ts +0 -4
  57. package/types/server/reactive.d.ts +0 -98
  58. package/types/server/rendering.d.ts +0 -159
  59. package/universal/dist/dev.cjs +0 -245
  60. package/universal/dist/dev.js +0 -243
  61. package/universal/dist/universal.cjs +0 -245
  62. package/universal/dist/universal.js +0 -243
  63. package/universal/package.json +0 -20
  64. package/universal/types/index.d.ts +0 -3
  65. package/universal/types/universal.d.ts +0 -30
  66. package/web/dist/dev.cjs +0 -894
  67. package/web/dist/dev.js +0 -782
  68. package/web/dist/server.cjs +0 -892
  69. package/web/dist/server.js +0 -782
  70. package/web/dist/web.cjs +0 -883
  71. package/web/dist/web.js +0 -771
  72. package/web/package.json +0 -46
  73. package/web/storage/dist/storage.cjs +0 -12
  74. package/web/storage/dist/storage.js +0 -10
  75. package/web/storage/package.json +0 -15
  76. package/web/storage/types/index.d.ts +0 -2
  77. package/web/types/client.d.ts +0 -79
  78. package/web/types/core.d.ts +0 -2
  79. package/web/types/index.d.ts +0 -50
  80. package/web/types/jsx.d.ts +0 -1
  81. package/web/types/server-mock.d.ts +0 -65
  82. package/web/types/server.d.ts +0 -177
package/dist/dev.cjs CHANGED
@@ -1,1543 +1,619 @@
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
 
120
63
  const sharedConfig = {
121
- context: undefined,
64
+ hydrating: false,
122
65
  registry: undefined,
123
- effects: undefined,
124
66
  done: false,
125
- getContextId() {
126
- return getContextId(this.context.count);
127
- },
128
67
  getNextContextId() {
129
- return getContextId(this.context.count++);
68
+ const o = signals.getOwner();
69
+ if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
70
+ return signals.getNextChildId(o);
130
71
  }
131
72
  };
132
- function getContextId(count) {
133
- const num = String(count),
134
- len = num.length - 1;
135
- return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
136
- }
137
- function setHydrateContext(context) {
138
- sharedConfig.context = context;
73
+ let _hydrationEndCallbacks = null;
74
+ let _pendingBoundaries = 0;
75
+ let _hydrationDone = false;
76
+ let _snapshotRootOwner = null;
77
+ function markTopLevelSnapshotScope() {
78
+ if (_snapshotRootOwner) return;
79
+ let owner = signals.getOwner();
80
+ if (!owner) return;
81
+ while (owner._parent) owner = owner._parent;
82
+ signals.markSnapshotScope(owner);
83
+ _snapshotRootOwner = owner;
84
+ }
85
+ function drainHydrationCallbacks() {
86
+ if (_hydrationDone) return;
87
+ _hydrationDone = true;
88
+ _doneValue = true;
89
+ signals.clearSnapshots();
90
+ signals.setSnapshotCapture(false);
91
+ signals.flush();
92
+ const cbs = _hydrationEndCallbacks;
93
+ _hydrationEndCallbacks = null;
94
+ if (cbs) for (const cb of cbs) cb();
95
+ setTimeout(() => {
96
+ if (sharedConfig.verifyHydration) sharedConfig.verifyHydration();
97
+ if (globalThis._$HY) globalThis._$HY.done = true;
98
+ });
139
99
  }
140
- function nextHydrateContext() {
141
- return {
142
- ...sharedConfig.context,
143
- id: sharedConfig.getNextContextId(),
144
- count: 0
145
- };
100
+ function checkHydrationComplete() {
101
+ if (_pendingBoundaries === 0) drainHydrationCallbacks();
146
102
  }
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;
103
+ let _hydratingValue = false;
104
+ let _doneValue = false;
105
+ let _createMemo;
106
+ let _createSignal;
107
+ let _createErrorBoundary;
108
+ let _createOptimistic;
109
+ let _createProjection;
110
+ let _createStore;
111
+ let _createOptimisticStore;
112
+ let _createRenderEffect;
113
+ let _createEffect;
114
+ class MockPromise {
115
+ static all() {
116
+ return new MockPromise();
205
117
  }
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
- }
118
+ static allSettled() {
119
+ return new MockPromise();
223
120
  }
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 || {};
121
+ static any() {
122
+ return new MockPromise();
289
123
  }
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);
124
+ static race() {
125
+ return new MockPromise();
307
126
  }
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;
127
+ static reject() {
128
+ return new MockPromise();
326
129
  }
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);
130
+ static resolve() {
131
+ return new MockPromise();
335
132
  }
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;
133
+ catch() {
134
+ return new MockPromise();
353
135
  }
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));
136
+ then() {
137
+ return new MockPromise();
394
138
  }
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;
139
+ finally() {
140
+ return new MockPromise();
476
141
  }
477
142
  }
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;
143
+ function subFetch(fn, prev) {
144
+ const ogFetch = fetch;
145
+ const ogPromise = Promise;
146
+ try {
147
+ window.fetch = () => new MockPromise();
148
+ Promise = MockPromise;
149
+ const result = fn(prev);
150
+ if (result && typeof result[Symbol.asyncIterator] === "function") {
151
+ result[Symbol.asyncIterator]().next();
491
152
  }
492
- const result = untrack(() => fn(input, prevInput, prevValue));
493
- prevInput = input;
494
153
  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
154
  } finally {
536
- Owner = prev;
537
- Listener = prevListener;
155
+ window.fetch = ogFetch;
156
+ Promise = ogPromise;
157
+ }
158
+ }
159
+ function consumeFirstSync(ai) {
160
+ const iter = ai[Symbol.asyncIterator]();
161
+ const r = iter.next();
162
+ const value = !(r instanceof Promise) && !r.done ? r.value : undefined;
163
+ return [value, iter];
164
+ }
165
+ function applyPatches(target, patches) {
166
+ for (const patch of patches) {
167
+ const path = patch[0];
168
+ let current = target;
169
+ for (let i = 0; i < path.length - 1; i++) current = current[path[i]];
170
+ const key = path[path.length - 1];
171
+ if (patch.length === 1) {
172
+ Array.isArray(current) ? current.splice(key, 1) : delete current[key];
173
+ } else if (patch.length === 3) {
174
+ current.splice(key, 0, patch[1]);
175
+ } else {
176
+ current[key] = patch[1];
177
+ }
538
178
  }
539
179
  }
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;
180
+ function scheduleIteratorConsumption(iter, apply) {
181
+ const consume = () => {
182
+ while (true) {
183
+ const n = iter.next();
184
+ if (n instanceof Promise) {
185
+ n.then(r => {
186
+ if (r.done) return;
187
+ apply(r.value);
188
+ consume();
189
+ });
190
+ return;
191
+ }
192
+ if (n.done) break;
193
+ apply(n.value);
565
194
  }
566
- runUpdates(fn, false);
567
- Listener = Owner = null;
568
- return t ? t.done : undefined;
195
+ };
196
+ consume();
197
+ }
198
+ function isAsyncIterable(v) {
199
+ return v != null && typeof v[Symbol.asyncIterator] === "function";
200
+ }
201
+ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
202
+ const parent = signals.getOwner();
203
+ const expectedId = signals.peekNextChildId(parent);
204
+ if (!sharedConfig.has(expectedId)) return null;
205
+ const initP = sharedConfig.load(expectedId);
206
+ if (!isAsyncIterable(initP)) return null;
207
+ const [firstValue, iter] = consumeFirstSync(initP);
208
+ const [get, set] = signals.createSignal(firstValue);
209
+ const result = coreFn(() => get(), firstValue, options);
210
+ scheduleIteratorConsumption(iter, v => {
211
+ set(() => v);
212
+ signals.flush();
569
213
  });
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
214
+ return result;
215
+ }
216
+ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
217
+ const parent = signals.getOwner();
218
+ const expectedId = signals.peekNextChildId(parent);
219
+ if (!sharedConfig.has(expectedId)) return null;
220
+ const initP = sharedConfig.load(expectedId);
221
+ if (!isAsyncIterable(initP)) return null;
222
+ const [firstState, iter] = consumeFirstSync(initP);
223
+ const [store, setStore] = coreFn(() => {}, firstState ?? initialValue, options);
224
+ scheduleIteratorConsumption(iter, patches => {
225
+ setStore(d => {
226
+ applyPatches(d, patches);
583
227
  });
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
228
+ });
229
+ return [store, setStore];
230
+ }
231
+ function hydratedCreateMemo(compute, value, options) {
232
+ if (!sharedConfig.hydrating) return signals.createMemo(compute, value, options);
233
+ markTopLevelSnapshotScope();
234
+ const ssrSource = options?.ssrSource;
235
+ if (ssrSource === "client") {
236
+ const [hydrated, setHydrated] = signals.createSignal(false);
237
+ const memo = signals.createMemo(prev => {
238
+ if (!hydrated()) return prev ?? value;
239
+ return compute(prev);
240
+ }, value, options);
241
+ setHydrated(true);
242
+ return memo;
243
+ }
244
+ if (ssrSource === "initial") {
245
+ return signals.createMemo(prev => {
246
+ if (!sharedConfig.hydrating) return compute(prev);
247
+ subFetch(compute, prev);
248
+ return prev ?? value;
249
+ }, value, options);
250
+ }
251
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, value, options);
252
+ if (aiResult !== null) return aiResult;
253
+ return signals.createMemo(prev => {
254
+ const o = signals.getOwner();
255
+ if (!sharedConfig.hydrating) return compute(prev);
256
+ let initP;
257
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
258
+ const init = initP?.v ?? initP;
259
+ return init != null ? (subFetch(compute, prev), init) : compute(prev);
260
+ }, value, options);
261
+ }
262
+ function hydratedCreateSignal(fn, second, third) {
263
+ if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second, third);
264
+ markTopLevelSnapshotScope();
265
+ const ssrSource = third?.ssrSource;
266
+ if (ssrSource === "client") {
267
+ const [hydrated, setHydrated] = signals.createSignal(false);
268
+ const sig = signals.createSignal(prev => {
269
+ if (!hydrated()) return prev ?? second;
270
+ return fn(prev);
271
+ }, second, third);
272
+ setHydrated(true);
273
+ return sig;
274
+ }
275
+ if (ssrSource === "initial") {
276
+ return signals.createSignal(prev => {
277
+ if (!sharedConfig.hydrating) return fn(prev);
278
+ subFetch(fn, prev);
279
+ return prev ?? second;
280
+ }, second, third);
281
+ }
282
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second, third);
283
+ if (aiResult !== null) return aiResult;
284
+ return signals.createSignal(prev => {
285
+ if (!sharedConfig.hydrating) return fn(prev);
286
+ const o = signals.getOwner();
287
+ let initP;
288
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
289
+ const init = initP?.v ?? initP;
290
+ return init != null ? (subFetch(fn, prev), init) : fn(prev);
291
+ }, second, third);
292
+ }
293
+ function hydratedCreateErrorBoundary(fn, fallback) {
294
+ if (!sharedConfig.hydrating) return signals.createErrorBoundary(fn, fallback);
295
+ markTopLevelSnapshotScope();
296
+ const parent = signals.getOwner();
297
+ const expectedId = signals.peekNextChildId(parent);
298
+ if (sharedConfig.has(expectedId)) {
299
+ const err = sharedConfig.load(expectedId);
300
+ if (err !== undefined) {
301
+ let hydrated = true;
302
+ return signals.createErrorBoundary(() => {
303
+ if (hydrated) {
304
+ hydrated = false;
305
+ throw err;
306
+ }
307
+ return fn();
308
+ }, fallback);
309
+ }
310
+ }
311
+ return signals.createErrorBoundary(fn, fallback);
312
+ }
313
+ function hydratedCreateOptimistic(fn, second, third) {
314
+ if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second, third);
315
+ markTopLevelSnapshotScope();
316
+ const ssrSource = third?.ssrSource;
317
+ if (ssrSource === "client") {
318
+ const [hydrated, setHydrated] = signals.createSignal(false);
319
+ const sig = signals.createOptimistic(prev => {
320
+ if (!hydrated()) return prev ?? second;
321
+ return fn(prev);
322
+ }, second, third);
323
+ setHydrated(true);
324
+ return sig;
325
+ }
326
+ if (ssrSource === "initial") {
327
+ return signals.createOptimistic(prev => {
328
+ if (!sharedConfig.hydrating) return fn(prev);
329
+ subFetch(fn, prev);
330
+ return prev ?? second;
331
+ }, second, third);
332
+ }
333
+ const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second, third);
334
+ if (aiResult !== null) return aiResult;
335
+ return signals.createOptimistic(prev => {
336
+ const o = signals.getOwner();
337
+ if (!sharedConfig.hydrating) return fn(prev);
338
+ let initP;
339
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
340
+ const init = initP?.v ?? initP;
341
+ return init != null ? (subFetch(fn, prev), init) : fn(prev);
342
+ }, second, third);
343
+ }
344
+ function wrapStoreFn(fn, ssrSource) {
345
+ if (ssrSource === "initial") {
346
+ return draft => {
347
+ if (!sharedConfig.hydrating) return fn(draft);
348
+ subFetch(fn, draft);
349
+ return undefined;
652
350
  };
653
351
  }
352
+ return draft => {
353
+ const o = signals.getOwner();
354
+ if (!sharedConfig.hydrating) return fn(draft);
355
+ let initP;
356
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
357
+ const init = initP?.v ?? initP;
358
+ return init != null ? (subFetch(fn, draft), init) : fn(draft);
359
+ };
654
360
  }
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) {
361
+ function hydratedCreateStore(first, second, third) {
362
+ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createStore(first, second, third);
363
+ markTopLevelSnapshotScope();
364
+ const ssrSource = third?.ssrSource;
365
+ if (ssrSource === "client" || ssrSource === "initial") {
366
+ return signals.createStore(second ?? {}, undefined, third);
367
+ }
368
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, second ?? {}, third);
369
+ if (aiResult !== null) return aiResult;
370
+ return signals.createStore(wrapStoreFn(first, ssrSource), second, third);
371
+ }
372
+ function hydratedCreateOptimisticStore(first, second, third) {
373
+ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createOptimisticStore(first, second, third);
374
+ markTopLevelSnapshotScope();
375
+ const ssrSource = third?.ssrSource;
376
+ if (ssrSource === "client" || ssrSource === "initial") {
377
+ return signals.createOptimisticStore(second ?? {}, undefined, third);
378
+ }
379
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createOptimisticStore, second ?? {}, third);
380
+ if (aiResult !== null) return aiResult;
381
+ return signals.createOptimisticStore(wrapStoreFn(first, ssrSource), second, third);
382
+ }
383
+ function hydratedCreateProjection(fn, initialValue, options) {
384
+ if (!sharedConfig.hydrating) return signals.createProjection(fn, initialValue, options);
385
+ markTopLevelSnapshotScope();
386
+ const ssrSource = options?.ssrSource;
387
+ if (ssrSource === "client" || ssrSource === "initial") {
388
+ return signals.createProjection(draft => draft, initialValue, options);
389
+ }
390
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, initialValue, options);
391
+ if (aiResult !== null) return aiResult[0];
392
+ return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options);
393
+ }
394
+ function hydratedEffect(coreFn, compute, effectFn, value, options) {
395
+ if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
396
+ const ssrSource = options?.ssrSource;
397
+ if (ssrSource === "client") {
398
+ const [hydrated, setHydrated] = signals.createSignal(false);
399
+ let active = false;
400
+ coreFn(prev => {
401
+ if (!hydrated()) return value;
402
+ active = true;
403
+ return compute(prev);
404
+ }, (next, prev) => {
405
+ if (!active) return;
406
+ return effectFn(next, prev);
407
+ }, value, options);
408
+ setHydrated(true);
674
409
  return;
675
410
  }
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;
411
+ if (ssrSource === "initial") {
412
+ coreFn(prev => {
413
+ if (!sharedConfig.hydrating) return compute(prev);
414
+ subFetch(compute, prev);
415
+ return prev ?? value;
416
+ }, effectFn, value, options);
681
417
  return;
682
418
  }
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
- }
705
- }
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;
739
- }
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
- }
419
+ markTopLevelSnapshotScope();
420
+ coreFn(prev => {
421
+ const o = signals.getOwner();
422
+ if (!sharedConfig.hydrating) return compute(prev);
423
+ let initP;
424
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
425
+ const init = initP?.v ?? initP;
426
+ return init != null ? (subFetch(compute, prev), init) : compute(prev);
427
+ }, effectFn, value, options);
758
428
  }
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
- }
429
+ function hydratedCreateRenderEffect(compute, effectFn, value, options) {
430
+ return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options);
793
431
  }
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
- }
432
+ function hydratedCreateEffect(compute, effectFn, value, options) {
433
+ return hydratedEffect(signals.createEffect, compute, effectFn, value, options);
865
434
  }
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;
435
+ function enableHydration() {
436
+ _createMemo = hydratedCreateMemo;
437
+ _createSignal = hydratedCreateSignal;
438
+ _createErrorBoundary = hydratedCreateErrorBoundary;
439
+ _createOptimistic = hydratedCreateOptimistic;
440
+ _createProjection = hydratedCreateProjection;
441
+ _createStore = hydratedCreateStore;
442
+ _createOptimisticStore = hydratedCreateOptimisticStore;
443
+ _createRenderEffect = hydratedCreateRenderEffect;
444
+ _createEffect = hydratedCreateEffect;
445
+ _hydratingValue = sharedConfig.hydrating;
446
+ _doneValue = sharedConfig.done;
447
+ Object.defineProperty(sharedConfig, "hydrating", {
448
+ get() {
449
+ return _hydratingValue;
450
+ },
451
+ set(v) {
452
+ const was = _hydratingValue;
453
+ _hydratingValue = v;
454
+ if (!was && v) {
455
+ _hydrationDone = false;
456
+ _doneValue = false;
457
+ _pendingBoundaries = 0;
458
+ signals.setSnapshotCapture(true);
459
+ _snapshotRootOwner = null;
460
+ } else if (was && !v) {
461
+ if (_snapshotRootOwner) {
462
+ signals.releaseSnapshotScope(_snapshotRootOwner);
463
+ _snapshotRootOwner = null;
911
464
  }
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
465
+ checkHydrationComplete();
466
+ }
467
+ },
468
+ configurable: true,
469
+ enumerable: true
1066
470
  });
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);
471
+ Object.defineProperty(sharedConfig, "done", {
472
+ get() {
473
+ return _doneValue;
1082
474
  },
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
- }
475
+ set(v) {
476
+ _doneValue = v;
477
+ if (v) drainHydrationCallbacks();
478
+ },
479
+ configurable: true,
480
+ enumerable: true
481
+ });
1135
482
  }
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;
483
+ const createMemo = (...args) => (_createMemo || signals.createMemo)(...args);
484
+ const createSignal = (...args) => (_createSignal || signals.createSignal)(...args);
485
+ const createErrorBoundary = (...args) => (_createErrorBoundary || signals.createErrorBoundary)(...args);
486
+ const createOptimistic = (...args) => (_createOptimistic || signals.createOptimistic)(...args);
487
+ const createProjection = (...args) => (_createProjection || signals.createProjection)(...args);
488
+ const createStore = (...args) => (_createStore || signals.createStore)(...args);
489
+ const createOptimisticStore = (...args) => (_createOptimisticStore || signals.createOptimisticStore)(...args);
490
+ const createRenderEffect = (...args) => (_createRenderEffect || signals.createRenderEffect)(...args);
491
+ const createEffect = (...args) => (_createEffect || signals.createEffect)(...args);
492
+ function loadModuleAssets(mapping) {
493
+ const hy = globalThis._$HY;
494
+ if (!hy) return;
495
+ if (!hy.modules) hy.modules = {};
496
+ if (!hy.loading) hy.loading = {};
497
+ const pending = [];
498
+ for (const moduleUrl in mapping) {
499
+ if (hy.modules[moduleUrl]) continue;
500
+ const entryUrl = mapping[moduleUrl];
501
+ if (!hy.loading[moduleUrl]) {
502
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
503
+ hy.modules[moduleUrl] = mod;
1155
504
  });
1156
- if (getOwner()) onCleanup(dispose);
1157
- return {
1158
- unsubscribe() {
1159
- dispose();
1160
- }
1161
- };
1162
- },
1163
- [Symbol.observable || "@@observable"]() {
1164
- return this;
1165
505
  }
1166
- };
506
+ pending.push(hy.loading[moduleUrl]);
507
+ }
508
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1167
509
  }
1168
- function from(producer, initalValue = undefined) {
1169
- const [s, set] = createSignal(initalValue, {
510
+ function createBoundaryTrigger() {
511
+ signals.setSnapshotCapture(false);
512
+ const [s, set] = signals.createSignal(undefined, {
1170
513
  equals: false
1171
514
  });
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);
515
+ s();
516
+ signals.setSnapshotCapture(true);
517
+ return set;
518
+ }
519
+ function resumeBoundaryHydration(o, id, set) {
520
+ _pendingBoundaries--;
521
+ if (signals.isDisposed(o)) {
522
+ checkHydrationComplete();
523
+ return;
1178
524
  }
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
- }
1218
- }
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);
525
+ sharedConfig.gather(id);
526
+ _hydratingValue = true;
527
+ signals.markSnapshotScope(o);
528
+ _snapshotRootOwner = o;
529
+ set();
530
+ signals.flush();
531
+ _snapshotRootOwner = null;
532
+ _hydratingValue = false;
533
+ signals.releaseSnapshotScope(o);
534
+ signals.flush();
535
+ checkHydrationComplete();
536
+ }
537
+ function Loading(props) {
538
+ if (!sharedConfig.hydrating) return signals.createLoadBoundary(() => props.children, () => props.fallback);
539
+ return signals.createMemo(() => {
540
+ const o = signals.getOwner();
541
+ const id = o.id;
542
+ let assetPromise;
543
+ if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
544
+ const mapping = sharedConfig.load(id + "_assets");
545
+ if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
546
+ }
547
+ if (sharedConfig.hydrating && sharedConfig.has(id)) {
548
+ let ref = sharedConfig.load(id);
549
+ let p;
550
+ if (ref) {
551
+ if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(id);
1278
552
  }
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();
553
+ if (p) {
554
+ _pendingBoundaries++;
555
+ signals.onCleanup(() => {
556
+ if (!signals.isDisposed(o)) return;
557
+ sharedConfig.cleanupFragment?.(id);
558
+ });
559
+ const set = createBoundaryTrigger();
560
+ if (p !== "$$f") {
561
+ const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
562
+ waitFor.then(() => resumeBoundaryHydration(o, id, set), err => {
563
+ _pendingBoundaries--;
564
+ checkHydrationComplete();
565
+ signals.runWithOwner(o, () => {
566
+ throw err;
567
+ });
1310
568
  });
1311
- len = 1;
569
+ } else {
570
+ const afterAssets = () => {
571
+ _pendingBoundaries--;
572
+ set();
573
+ checkHydrationComplete();
574
+ };
575
+ if (assetPromise) assetPromise.then(() => queueMicrotask(afterAssets));else queueMicrotask(afterAssets);
1312
576
  }
1313
- return mapped;
1314
- }
1315
- if (items[0] === FALLBACK) {
1316
- disposers[0]();
1317
- disposers = [];
1318
- items = [];
1319
- mapped = [];
1320
- len = 0;
577
+ return props.fallback;
1321
578
  }
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);
1327
- }
1328
- }
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
579
  }
1344
- };
580
+ if (assetPromise) {
581
+ _pendingBoundaries++;
582
+ const set = createBoundaryTrigger();
583
+ assetPromise.then(() => resumeBoundaryHydration(o, id, set));
584
+ return undefined;
585
+ }
586
+ return signals.createLoadBoundary(() => props.children, () => props.fallback);
587
+ });
1345
588
  }
1346
589
 
1347
- let hydrationEnabled = false;
1348
- function enableHydration() {
1349
- hydrationEnabled = true;
1350
- }
1351
590
  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;
1359
- }
1360
- }
1361
591
  return devComponent(Comp, props || {});
1362
592
  }
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;
1394
- }
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
- }
1400
- }
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;
1461
- }
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;
1509
- }
1510
- function lazy(fn) {
593
+ function lazy(fn, moduleUrl) {
1511
594
  let comp;
1512
595
  let p;
1513
596
  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();
597
+ if (sharedConfig.hydrating && moduleUrl) {
598
+ const cached = globalThis._$HY?.modules?.[moduleUrl];
599
+ if (!cached) {
600
+ throw new Error(`lazy() module "${moduleUrl}" was not preloaded before hydration. ` + "Ensure it is inside a Loading boundary.");
601
+ }
602
+ comp = () => cached.default;
603
+ }
604
+ if (!comp) {
605
+ p || (p = fn());
606
+ p.then(mod => {
607
+ comp = () => mod.default;
1524
608
  });
1525
- comp = s;
1526
- } else if (!comp) {
1527
- const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));
1528
- comp = s;
609
+ comp = signals.createMemo(() => p.then(mod => mod.default));
1529
610
  }
1530
611
  let Comp;
1531
- return createMemo(() => (Comp = comp()) ? untrack(() => {
1532
- if (IS_DEV) Object.assign(Comp, {
612
+ return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
613
+ Object.assign(Comp, {
1533
614
  [$DEVCOMP]: true
1534
615
  });
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;
616
+ return Comp(props);
1541
617
  }) : "");
1542
618
  };
1543
619
  wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
@@ -1545,45 +621,53 @@ function lazy(fn) {
1545
621
  }
1546
622
  let counter = 0;
1547
623
  function createUniqueId() {
1548
- const ctx = sharedConfig.context;
1549
- return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
624
+ return sharedConfig.hydrating ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1550
625
  }
1551
626
 
1552
627
  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
628
  function For(props) {
1554
- const fallback = "fallback" in props && {
629
+ const options = "fallback" in props ? {
630
+ keyed: props.keyed,
1555
631
  fallback: () => props.fallback
632
+ } : {
633
+ keyed: props.keyed
1556
634
  };
1557
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1558
- name: "value"
1559
- }) ;
635
+ options.name = "<For>";
636
+ return signals.mapArray(() => props.each, props.children, options);
1560
637
  }
1561
- function Index(props) {
1562
- const fallback = "fallback" in props && {
638
+ function Repeat(props) {
639
+ const options = "fallback" in props ? {
1563
640
  fallback: () => props.fallback
1564
- };
1565
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1566
- name: "value"
1567
- }) ;
641
+ } : {};
642
+ options.from = () => props.from;
643
+ options.name = "<Repeat>";
644
+ return signals.repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options);
1568
645
  }
1569
646
  function Show(props) {
1570
647
  const keyed = props.keyed;
1571
- const conditionValue = createMemo(() => props.when, undefined, {
648
+ const conditionValue = signals.createMemo(() => props.when, undefined, {
1572
649
  name: "condition value"
1573
650
  } );
1574
- const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
651
+ const condition = keyed ? conditionValue : signals.createMemo(conditionValue, undefined, {
1575
652
  equals: (a, b) => !a === !b,
1576
653
  name: "condition"
1577
654
  } );
1578
- return createMemo(() => {
655
+ return signals.createMemo(() => {
1579
656
  const c = condition();
1580
657
  if (c) {
1581
658
  const child = props.children;
1582
659
  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;
660
+ return fn ? signals.untrack(() => {
661
+ signals.setStrictRead("<Show>");
662
+ try {
663
+ return child(() => {
664
+ if (!signals.untrack(condition)) throw narrowedError("Show");
665
+ return conditionValue();
666
+ });
667
+ } finally {
668
+ signals.setStrictRead(false);
669
+ }
670
+ }) : child;
1587
671
  }
1588
672
  return props.fallback;
1589
673
  }, undefined, {
@@ -1592,18 +676,17 @@ function Show(props) {
1592
676
  }
1593
677
  function Switch(props) {
1594
678
  const chs = children(() => props.children);
1595
- const switchFunc = createMemo(() => {
1596
- const ch = chs();
1597
- const mps = Array.isArray(ch) ? ch : [ch];
679
+ const switchFunc = signals.createMemo(() => {
680
+ const mps = chs.toArray();
1598
681
  let func = () => undefined;
1599
682
  for (let i = 0; i < mps.length; i++) {
1600
683
  const index = i;
1601
684
  const mp = mps[i];
1602
685
  const prevFunc = func;
1603
- const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when, undefined, {
686
+ const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined, {
1604
687
  name: "condition value"
1605
688
  } );
1606
- const condition = mp.keyed ? conditionValue : createMemo(conditionValue, undefined, {
689
+ const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, undefined, {
1607
690
  equals: (a, b) => !a === !b,
1608
691
  name: "condition"
1609
692
  } );
@@ -1611,16 +694,23 @@ function Switch(props) {
1611
694
  }
1612
695
  return func;
1613
696
  });
1614
- return createMemo(() => {
697
+ return signals.createMemo(() => {
1615
698
  const sel = switchFunc()();
1616
699
  if (!sel) return props.fallback;
1617
700
  const [index, conditionValue, mp] = sel;
1618
701
  const child = mp.children;
1619
702
  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;
703
+ return fn ? signals.untrack(() => {
704
+ signals.setStrictRead("<Match>");
705
+ try {
706
+ return child(() => {
707
+ if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
708
+ return conditionValue();
709
+ });
710
+ } finally {
711
+ signals.setStrictRead(false);
712
+ }
713
+ }) : child;
1624
714
  }, undefined, {
1625
715
  name: "eval conditions"
1626
716
  } );
@@ -1628,260 +718,177 @@ function Switch(props) {
1628
718
  function Match(props) {
1629
719
  return props;
1630
720
  }
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
- }
721
+ function Errored(props) {
722
+ return createErrorBoundary(() => props.children, (err, reset) => {
723
+ const f = props.fallback;
724
+ if ((typeof f !== "function" || f.length == 0)) console.error(err);
725
+ return typeof f === "function" && f.length ? f(err, reset) : f;
1822
726
  });
1823
727
  }
1824
728
 
729
+ function ssrHandleError() {}
730
+ function ssrRunInScope() {}
731
+ const DevHooks = {};
1825
732
  const DEV = {
1826
733
  hooks: DevHooks,
1827
- writeSignal,
1828
734
  registerGraph
1829
735
  } ;
1830
736
  if (globalThis) {
1831
737
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1832
738
  }
1833
739
 
740
+ Object.defineProperty(exports, "$PROXY", {
741
+ enumerable: true,
742
+ get: function () { return signals.$PROXY; }
743
+ });
744
+ Object.defineProperty(exports, "$TRACK", {
745
+ enumerable: true,
746
+ get: function () { return signals.$TRACK; }
747
+ });
748
+ Object.defineProperty(exports, "NotReadyError", {
749
+ enumerable: true,
750
+ get: function () { return signals.NotReadyError; }
751
+ });
752
+ Object.defineProperty(exports, "action", {
753
+ enumerable: true,
754
+ get: function () { return signals.action; }
755
+ });
756
+ Object.defineProperty(exports, "createOwner", {
757
+ enumerable: true,
758
+ get: function () { return signals.createOwner; }
759
+ });
760
+ Object.defineProperty(exports, "createReaction", {
761
+ enumerable: true,
762
+ get: function () { return signals.createReaction; }
763
+ });
764
+ Object.defineProperty(exports, "createRoot", {
765
+ enumerable: true,
766
+ get: function () { return signals.createRoot; }
767
+ });
768
+ Object.defineProperty(exports, "createTrackedEffect", {
769
+ enumerable: true,
770
+ get: function () { return signals.createTrackedEffect; }
771
+ });
772
+ Object.defineProperty(exports, "deep", {
773
+ enumerable: true,
774
+ get: function () { return signals.deep; }
775
+ });
776
+ Object.defineProperty(exports, "flatten", {
777
+ enumerable: true,
778
+ get: function () { return signals.flatten; }
779
+ });
780
+ Object.defineProperty(exports, "flush", {
781
+ enumerable: true,
782
+ get: function () { return signals.flush; }
783
+ });
784
+ Object.defineProperty(exports, "getNextChildId", {
785
+ enumerable: true,
786
+ get: function () { return signals.getNextChildId; }
787
+ });
788
+ Object.defineProperty(exports, "getObserver", {
789
+ enumerable: true,
790
+ get: function () { return signals.getObserver; }
791
+ });
792
+ Object.defineProperty(exports, "getOwner", {
793
+ enumerable: true,
794
+ get: function () { return signals.getOwner; }
795
+ });
796
+ Object.defineProperty(exports, "isEqual", {
797
+ enumerable: true,
798
+ get: function () { return signals.isEqual; }
799
+ });
800
+ Object.defineProperty(exports, "isPending", {
801
+ enumerable: true,
802
+ get: function () { return signals.isPending; }
803
+ });
804
+ Object.defineProperty(exports, "isRefreshing", {
805
+ enumerable: true,
806
+ get: function () { return signals.isRefreshing; }
807
+ });
808
+ Object.defineProperty(exports, "isWrappable", {
809
+ enumerable: true,
810
+ get: function () { return signals.isWrappable; }
811
+ });
812
+ Object.defineProperty(exports, "latest", {
813
+ enumerable: true,
814
+ get: function () { return signals.latest; }
815
+ });
816
+ Object.defineProperty(exports, "mapArray", {
817
+ enumerable: true,
818
+ get: function () { return signals.mapArray; }
819
+ });
820
+ Object.defineProperty(exports, "merge", {
821
+ enumerable: true,
822
+ get: function () { return signals.merge; }
823
+ });
824
+ Object.defineProperty(exports, "omit", {
825
+ enumerable: true,
826
+ get: function () { return signals.omit; }
827
+ });
828
+ Object.defineProperty(exports, "onCleanup", {
829
+ enumerable: true,
830
+ get: function () { return signals.onCleanup; }
831
+ });
832
+ Object.defineProperty(exports, "onSettled", {
833
+ enumerable: true,
834
+ get: function () { return signals.onSettled; }
835
+ });
836
+ Object.defineProperty(exports, "reconcile", {
837
+ enumerable: true,
838
+ get: function () { return signals.reconcile; }
839
+ });
840
+ Object.defineProperty(exports, "refresh", {
841
+ enumerable: true,
842
+ get: function () { return signals.refresh; }
843
+ });
844
+ Object.defineProperty(exports, "repeat", {
845
+ enumerable: true,
846
+ get: function () { return signals.repeat; }
847
+ });
848
+ Object.defineProperty(exports, "resolve", {
849
+ enumerable: true,
850
+ get: function () { return signals.resolve; }
851
+ });
852
+ Object.defineProperty(exports, "runWithOwner", {
853
+ enumerable: true,
854
+ get: function () { return signals.runWithOwner; }
855
+ });
856
+ Object.defineProperty(exports, "snapshot", {
857
+ enumerable: true,
858
+ get: function () { return signals.snapshot; }
859
+ });
860
+ Object.defineProperty(exports, "storePath", {
861
+ enumerable: true,
862
+ get: function () { return signals.storePath; }
863
+ });
864
+ Object.defineProperty(exports, "untrack", {
865
+ enumerable: true,
866
+ get: function () { return signals.untrack; }
867
+ });
1834
868
  exports.$DEVCOMP = $DEVCOMP;
1835
- exports.$PROXY = $PROXY;
1836
- exports.$TRACK = $TRACK;
1837
869
  exports.DEV = DEV;
1838
- exports.ErrorBoundary = ErrorBoundary;
870
+ exports.Errored = Errored;
1839
871
  exports.For = For;
1840
- exports.Index = Index;
872
+ exports.Loading = Loading;
1841
873
  exports.Match = Match;
874
+ exports.Repeat = Repeat;
1842
875
  exports.Show = Show;
1843
- exports.Suspense = Suspense;
1844
- exports.SuspenseList = SuspenseList;
1845
876
  exports.Switch = Switch;
1846
- exports.batch = batch;
1847
- exports.cancelCallback = cancelCallback;
1848
- exports.catchError = catchError;
1849
877
  exports.children = children;
1850
878
  exports.createComponent = createComponent;
1851
- exports.createComputed = createComputed;
1852
879
  exports.createContext = createContext;
1853
- exports.createDeferred = createDeferred;
1854
880
  exports.createEffect = createEffect;
1855
881
  exports.createMemo = createMemo;
1856
- exports.createReaction = createReaction;
882
+ exports.createOptimistic = createOptimistic;
883
+ exports.createOptimisticStore = createOptimisticStore;
884
+ exports.createProjection = createProjection;
1857
885
  exports.createRenderEffect = createRenderEffect;
1858
- exports.createResource = createResource;
1859
- exports.createRoot = createRoot;
1860
- exports.createSelector = createSelector;
1861
886
  exports.createSignal = createSignal;
887
+ exports.createStore = createStore;
1862
888
  exports.createUniqueId = createUniqueId;
1863
- exports.enableExternalSource = enableExternalSource;
1864
889
  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
890
  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
891
  exports.sharedConfig = sharedConfig;
1883
- exports.splitProps = splitProps;
1884
- exports.startTransition = startTransition;
1885
- exports.untrack = untrack;
892
+ exports.ssrHandleError = ssrHandleError;
893
+ exports.ssrRunInScope = ssrRunInScope;
1886
894
  exports.useContext = useContext;
1887
- exports.useTransition = useTransition;