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