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