solid-js 2.0.0-beta.0 → 2.0.0-beta.10
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/CHEATSHEET.md +640 -0
- package/README.md +42 -188
- package/dist/dev.cjs +451 -283
- package/dist/dev.js +428 -286
- package/dist/server.cjs +735 -279
- package/dist/server.js +715 -282
- package/dist/solid.cjs +443 -255
- package/dist/solid.js +420 -258
- package/package.json +67 -39
- package/types/client/component.d.ts +65 -19
- package/types/client/core.d.ts +110 -34
- package/types/client/flow.d.ts +176 -42
- package/types/client/hydration.d.ts +525 -31
- package/types/index.d.ts +9 -12
- package/types/server/component.d.ts +12 -11
- package/types/server/core.d.ts +19 -14
- package/types/server/flow.d.ts +76 -21
- package/types/server/hydration.d.ts +49 -7
- package/types/server/index.d.ts +5 -7
- package/types/server/shared.d.ts +9 -4
- package/types/server/signals.d.ts +45 -18
- package/types/types.d.ts +15 -0
- package/types-cjs/client/component.d.cts +120 -0
- package/types-cjs/client/core.d.cts +141 -0
- package/types-cjs/client/flow.d.cts +234 -0
- package/types-cjs/client/hydration.d.cts +570 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server/component.d.cts +67 -0
- package/types-cjs/server/core.d.cts +49 -0
- package/types-cjs/server/flow.d.cts +115 -0
- package/types-cjs/server/hydration.d.cts +63 -0
- package/types-cjs/server/index.d.cts +10 -0
- package/types-cjs/server/shared.d.cts +50 -0
- package/types-cjs/server/signals.d.cts +87 -0
- package/types-cjs/types.d.cts +15 -0
- package/jsx-runtime.d.ts +0 -1
- package/types/jsx.d.ts +0 -4129
package/dist/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getContext, createMemo as createMemo$1, flatten,
|
|
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';
|
|
1
|
+
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, getOwner, untrack, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$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, onCleanup, isDisposed, peekNextChildId, clearSnapshots, flush, markSnapshotScope, mapArray, repeat, createRevealOrder, DEV as DEV$1 } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol("COMPONENT_DEV" );
|
|
5
5
|
function createContext(defaultValue, options) {
|
|
@@ -18,10 +18,10 @@ function useContext(context) {
|
|
|
18
18
|
return getContext(context);
|
|
19
19
|
}
|
|
20
20
|
function children(fn) {
|
|
21
|
-
const c = createMemo$1(fn,
|
|
21
|
+
const c = createMemo$1(fn, {
|
|
22
22
|
lazy: true
|
|
23
23
|
});
|
|
24
|
-
const memo = createMemo$1(() => flatten(c()),
|
|
24
|
+
const memo = createMemo$1(() => flatten(c()), {
|
|
25
25
|
name: "children",
|
|
26
26
|
lazy: true
|
|
27
27
|
} );
|
|
@@ -34,31 +34,24 @@ function children(fn) {
|
|
|
34
34
|
function devComponent(Comp, props) {
|
|
35
35
|
return createRoot(() => {
|
|
36
36
|
const owner = getOwner();
|
|
37
|
-
owner.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setStrictRead(`<${Comp.name || "Anonymous"}>`);
|
|
45
|
-
try {
|
|
46
|
-
return Comp(props);
|
|
47
|
-
} finally {
|
|
48
|
-
setStrictRead(false);
|
|
49
|
-
}
|
|
37
|
+
owner._component = {
|
|
38
|
+
fn: Comp,
|
|
39
|
+
props,
|
|
40
|
+
name: Comp.name
|
|
41
|
+
};
|
|
42
|
+
Object.assign(Comp, {
|
|
43
|
+
[$DEVCOMP]: true
|
|
50
44
|
});
|
|
45
|
+
return untrack(() => Comp(props), `<${Comp.name || "Anonymous"}>`);
|
|
51
46
|
}, {
|
|
52
47
|
transparent: true
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
|
-
function registerGraph(value) {
|
|
56
|
-
const owner = getOwner();
|
|
57
|
-
if (!owner) return;
|
|
58
|
-
if (owner.sourceMap) owner.sourceMap.push(value);else owner.sourceMap = [value];
|
|
59
|
-
value.graph = owner;
|
|
60
|
-
}
|
|
61
50
|
|
|
51
|
+
const NoHydrateContext = {
|
|
52
|
+
id: Symbol("NoHydrateContext"),
|
|
53
|
+
defaultValue: false
|
|
54
|
+
};
|
|
62
55
|
const sharedConfig = {
|
|
63
56
|
hydrating: false,
|
|
64
57
|
registry: undefined,
|
|
@@ -66,6 +59,7 @@ const sharedConfig = {
|
|
|
66
59
|
getNextContextId() {
|
|
67
60
|
const o = getOwner();
|
|
68
61
|
if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
|
|
62
|
+
if (getContext(NoHydrateContext)) return undefined;
|
|
69
63
|
return getNextChildId(o);
|
|
70
64
|
}
|
|
71
65
|
};
|
|
@@ -94,6 +88,7 @@ function drainHydrationCallbacks() {
|
|
|
94
88
|
setTimeout(() => {
|
|
95
89
|
if (sharedConfig.verifyHydration) sharedConfig.verifyHydration();
|
|
96
90
|
if (globalThis._$HY) globalThis._$HY.done = true;
|
|
91
|
+
sharedConfig.registry?.clear();
|
|
97
92
|
});
|
|
98
93
|
}
|
|
99
94
|
function checkHydrationComplete() {
|
|
@@ -111,23 +106,10 @@ let _createOptimisticStore;
|
|
|
111
106
|
let _createRenderEffect;
|
|
112
107
|
let _createEffect;
|
|
113
108
|
class MockPromise {
|
|
114
|
-
static
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return new MockPromise();
|
|
119
|
-
}
|
|
120
|
-
static any() {
|
|
121
|
-
return new MockPromise();
|
|
122
|
-
}
|
|
123
|
-
static race() {
|
|
124
|
-
return new MockPromise();
|
|
125
|
-
}
|
|
126
|
-
static reject() {
|
|
127
|
-
return new MockPromise();
|
|
128
|
-
}
|
|
129
|
-
static resolve() {
|
|
130
|
-
return new MockPromise();
|
|
109
|
+
static {
|
|
110
|
+
for (const k of ["all", "allSettled", "any", "race", "reject", "resolve"]) {
|
|
111
|
+
MockPromise[k] = () => new MockPromise();
|
|
112
|
+
}
|
|
131
113
|
}
|
|
132
114
|
catch() {
|
|
133
115
|
return new MockPromise();
|
|
@@ -155,11 +137,67 @@ function subFetch(fn, prev) {
|
|
|
155
137
|
Promise = ogPromise;
|
|
156
138
|
}
|
|
157
139
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
140
|
+
function syncThenable(value) {
|
|
141
|
+
return {
|
|
142
|
+
then(fn) {
|
|
143
|
+
fn(value);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const NO_HYDRATED_VALUE = Symbol("NO_HYDRATED_VALUE");
|
|
148
|
+
function readHydratedValue(initP, refresh) {
|
|
149
|
+
if (initP == null) return NO_HYDRATED_VALUE;
|
|
150
|
+
refresh();
|
|
151
|
+
if (typeof initP === "object" && initP.s === 2) throw initP.v;
|
|
152
|
+
return initP?.v ?? initP;
|
|
153
|
+
}
|
|
154
|
+
function readSerializedOrCompute(compute, prev) {
|
|
155
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
156
|
+
const o = getOwner();
|
|
157
|
+
let initP;
|
|
158
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
159
|
+
const init = readHydratedValue(initP, () => subFetch(compute, prev));
|
|
160
|
+
return init !== NO_HYDRATED_VALUE ? init : compute(prev);
|
|
161
|
+
}
|
|
162
|
+
function forwardIteratorReturn(it, value) {
|
|
163
|
+
const returned = it.return?.(value);
|
|
164
|
+
return returned && typeof returned.then === "function" ? returned : syncThenable(returned ?? {
|
|
165
|
+
done: true,
|
|
166
|
+
value
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function normalizeIterator(it) {
|
|
170
|
+
let first = true;
|
|
171
|
+
let buffered = null;
|
|
172
|
+
return {
|
|
173
|
+
next() {
|
|
174
|
+
if (first) {
|
|
175
|
+
first = false;
|
|
176
|
+
const r = it.next();
|
|
177
|
+
return r && typeof r.then === "function" ? r : syncThenable(r);
|
|
178
|
+
}
|
|
179
|
+
if (buffered) {
|
|
180
|
+
const b = buffered;
|
|
181
|
+
buffered = null;
|
|
182
|
+
return b;
|
|
183
|
+
}
|
|
184
|
+
let latest = it.next();
|
|
185
|
+
if (latest && typeof latest.then === "function") return latest;
|
|
186
|
+
while (!latest.done) {
|
|
187
|
+
const peek = it.next();
|
|
188
|
+
if (peek && typeof peek.then === "function") {
|
|
189
|
+
buffered = peek;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
latest = peek;
|
|
193
|
+
}
|
|
194
|
+
return Promise.resolve(latest);
|
|
195
|
+
},
|
|
196
|
+
return(value) {
|
|
197
|
+
buffered = null;
|
|
198
|
+
return forwardIteratorReturn(it, value);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
163
201
|
}
|
|
164
202
|
function applyPatches(target, patches) {
|
|
165
203
|
for (const patch of patches) {
|
|
@@ -176,118 +214,211 @@ function applyPatches(target, patches) {
|
|
|
176
214
|
}
|
|
177
215
|
}
|
|
178
216
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
217
|
+
function isAsyncIterable(v) {
|
|
218
|
+
return v != null && typeof v[Symbol.asyncIterator] === "function";
|
|
219
|
+
}
|
|
220
|
+
function createShadowDraft(realDraft) {
|
|
221
|
+
const shadow = JSON.parse(JSON.stringify(realDraft));
|
|
222
|
+
let useShadow = true;
|
|
223
|
+
return {
|
|
224
|
+
proxy: new Proxy(shadow, {
|
|
225
|
+
get(_, prop) {
|
|
226
|
+
return useShadow ? shadow[prop] : realDraft[prop];
|
|
227
|
+
},
|
|
228
|
+
set(_, prop, value) {
|
|
229
|
+
if (useShadow) {
|
|
230
|
+
shadow[prop] = value;
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
return Reflect.set(realDraft, prop, value);
|
|
234
|
+
},
|
|
235
|
+
deleteProperty(_, prop) {
|
|
236
|
+
if (useShadow) {
|
|
237
|
+
delete shadow[prop];
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
return Reflect.deleteProperty(realDraft, prop);
|
|
241
|
+
},
|
|
242
|
+
has(_, prop) {
|
|
243
|
+
return prop in (useShadow ? shadow : realDraft);
|
|
244
|
+
},
|
|
245
|
+
ownKeys() {
|
|
246
|
+
return Reflect.ownKeys(useShadow ? shadow : realDraft);
|
|
247
|
+
},
|
|
248
|
+
getOwnPropertyDescriptor(_, prop) {
|
|
249
|
+
return Object.getOwnPropertyDescriptor(useShadow ? shadow : realDraft, prop);
|
|
190
250
|
}
|
|
191
|
-
|
|
192
|
-
|
|
251
|
+
}),
|
|
252
|
+
activate() {
|
|
253
|
+
useShadow = false;
|
|
193
254
|
}
|
|
194
255
|
};
|
|
195
|
-
consume();
|
|
196
256
|
}
|
|
197
|
-
function
|
|
198
|
-
|
|
257
|
+
function wrapFirstYield(iterable, activate) {
|
|
258
|
+
const srcIt = iterable[Symbol.asyncIterator]();
|
|
259
|
+
let first = true;
|
|
260
|
+
return {
|
|
261
|
+
[Symbol.asyncIterator]() {
|
|
262
|
+
return {
|
|
263
|
+
next() {
|
|
264
|
+
const p = srcIt.next();
|
|
265
|
+
if (first) {
|
|
266
|
+
first = false;
|
|
267
|
+
return p.then(r => {
|
|
268
|
+
activate();
|
|
269
|
+
return r.done ? r : {
|
|
270
|
+
done: false,
|
|
271
|
+
value: undefined
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return p;
|
|
276
|
+
},
|
|
277
|
+
return(value) {
|
|
278
|
+
return forwardIteratorReturn(srcIt, value);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
};
|
|
199
283
|
}
|
|
200
|
-
function hydrateSignalFromAsyncIterable(coreFn, compute,
|
|
284
|
+
function hydrateSignalFromAsyncIterable(coreFn, compute, options) {
|
|
201
285
|
const parent = getOwner();
|
|
202
286
|
const expectedId = peekNextChildId(parent);
|
|
203
287
|
if (!sharedConfig.has(expectedId)) return null;
|
|
204
|
-
const
|
|
205
|
-
if (!isAsyncIterable(
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
288
|
+
const loaded = sharedConfig.load(expectedId);
|
|
289
|
+
if (!isAsyncIterable(loaded)) return null;
|
|
290
|
+
const it = normalizeIterator(loaded[Symbol.asyncIterator]());
|
|
291
|
+
const iterable = {
|
|
292
|
+
[Symbol.asyncIterator]() {
|
|
293
|
+
return it;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
return coreFn(prev => {
|
|
297
|
+
subFetch(compute, prev);
|
|
298
|
+
return iterable;
|
|
299
|
+
}, options);
|
|
214
300
|
}
|
|
215
|
-
function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
301
|
+
function hydrateStoreFromAsyncIterable(coreFn, fn, initialValue, options) {
|
|
216
302
|
const parent = getOwner();
|
|
217
303
|
const expectedId = peekNextChildId(parent);
|
|
218
304
|
if (!sharedConfig.has(expectedId)) return null;
|
|
219
|
-
const
|
|
220
|
-
if (!isAsyncIterable(
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
305
|
+
const loaded = sharedConfig.load(expectedId);
|
|
306
|
+
if (!isAsyncIterable(loaded)) return null;
|
|
307
|
+
const srcIt = loaded[Symbol.asyncIterator]();
|
|
308
|
+
let isFirst = true;
|
|
309
|
+
let buffered = null;
|
|
310
|
+
return coreFn(draft => {
|
|
311
|
+
const {
|
|
312
|
+
proxy
|
|
313
|
+
} = createShadowDraft(draft);
|
|
314
|
+
subFetch(fn, proxy);
|
|
315
|
+
const process = res => {
|
|
316
|
+
if (res.done) return {
|
|
317
|
+
done: true,
|
|
318
|
+
value: undefined
|
|
319
|
+
};
|
|
320
|
+
if (isFirst) {
|
|
321
|
+
isFirst = false;
|
|
322
|
+
setSnapshotCapture(false);
|
|
323
|
+
try {
|
|
324
|
+
if (Array.isArray(res.value)) {
|
|
325
|
+
for (let i = 0; i < res.value.length; i++) draft[i] = res.value[i];
|
|
326
|
+
draft.length = res.value.length;
|
|
327
|
+
} else {
|
|
328
|
+
Object.assign(draft, res.value);
|
|
329
|
+
}
|
|
330
|
+
} finally {
|
|
331
|
+
setSnapshotCapture(true);
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
applyPatches(draft, res.value);
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
done: false,
|
|
338
|
+
value: undefined
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
return {
|
|
342
|
+
[Symbol.asyncIterator]() {
|
|
343
|
+
return {
|
|
344
|
+
next() {
|
|
345
|
+
if (isFirst) {
|
|
346
|
+
const r = srcIt.next();
|
|
347
|
+
return r && typeof r.then === "function" ? {
|
|
348
|
+
then(fn, rej) {
|
|
349
|
+
r.then(v => fn(process(v)), rej);
|
|
350
|
+
}
|
|
351
|
+
} : syncThenable(process(r));
|
|
352
|
+
}
|
|
353
|
+
if (buffered) {
|
|
354
|
+
const b = buffered;
|
|
355
|
+
buffered = null;
|
|
356
|
+
return b.then(process);
|
|
357
|
+
}
|
|
358
|
+
let r = srcIt.next();
|
|
359
|
+
if (r && typeof r.then === "function") {
|
|
360
|
+
return r.then(process);
|
|
361
|
+
}
|
|
362
|
+
let result = process(r);
|
|
363
|
+
while (!r.done) {
|
|
364
|
+
const peek = srcIt.next();
|
|
365
|
+
if (peek && typeof peek.then === "function") {
|
|
366
|
+
buffered = peek;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
r = peek;
|
|
370
|
+
if (!r.done) result = process(r);
|
|
371
|
+
}
|
|
372
|
+
return Promise.resolve(result);
|
|
373
|
+
},
|
|
374
|
+
return(value) {
|
|
375
|
+
buffered = null;
|
|
376
|
+
return forwardIteratorReturn(srcIt, value);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}, initialValue, options);
|
|
229
382
|
}
|
|
230
|
-
function hydratedCreateMemo(compute,
|
|
231
|
-
if (!sharedConfig.hydrating
|
|
383
|
+
function hydratedCreateMemo(compute, options) {
|
|
384
|
+
if (!sharedConfig.hydrating || options?.transparent) {
|
|
385
|
+
return createMemo$1(compute, options);
|
|
386
|
+
}
|
|
232
387
|
markTopLevelSnapshotScope();
|
|
233
388
|
const ssrSource = options?.ssrSource;
|
|
234
389
|
if (ssrSource === "client") {
|
|
235
|
-
const [hydrated, setHydrated] = createSignal$1(false
|
|
390
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
391
|
+
ownedWrite: true
|
|
392
|
+
});
|
|
236
393
|
const memo = createMemo$1(prev => {
|
|
237
|
-
if (!hydrated()) return prev
|
|
394
|
+
if (!hydrated()) return prev;
|
|
238
395
|
return compute(prev);
|
|
239
|
-
},
|
|
396
|
+
}, options);
|
|
240
397
|
setHydrated(true);
|
|
241
398
|
return memo;
|
|
242
399
|
}
|
|
243
|
-
|
|
244
|
-
return createMemo$1(prev => {
|
|
245
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
246
|
-
subFetch(compute, prev);
|
|
247
|
-
return prev ?? value;
|
|
248
|
-
}, value, options);
|
|
249
|
-
}
|
|
250
|
-
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, value, options);
|
|
400
|
+
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options);
|
|
251
401
|
if (aiResult !== null) return aiResult;
|
|
252
|
-
return createMemo$1(prev =>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
257
|
-
const init = initP?.v ?? initP;
|
|
258
|
-
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
259
|
-
}, value, options);
|
|
260
|
-
}
|
|
261
|
-
function hydratedCreateSignal(fn, second, third) {
|
|
262
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second, third);
|
|
402
|
+
return createMemo$1(prev => readSerializedOrCompute(compute, prev), options);
|
|
403
|
+
}
|
|
404
|
+
function hydratedCreateSignal(fn, second) {
|
|
405
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second);
|
|
263
406
|
markTopLevelSnapshotScope();
|
|
264
|
-
const ssrSource =
|
|
407
|
+
const ssrSource = second?.ssrSource;
|
|
265
408
|
if (ssrSource === "client") {
|
|
266
|
-
const [hydrated, setHydrated] = createSignal$1(false
|
|
409
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
410
|
+
ownedWrite: true
|
|
411
|
+
});
|
|
267
412
|
const sig = createSignal$1(prev => {
|
|
268
|
-
if (!hydrated()) return prev
|
|
413
|
+
if (!hydrated()) return prev;
|
|
269
414
|
return fn(prev);
|
|
270
|
-
}, second
|
|
415
|
+
}, second);
|
|
271
416
|
setHydrated(true);
|
|
272
417
|
return sig;
|
|
273
418
|
}
|
|
274
|
-
|
|
275
|
-
return createSignal$1(prev => {
|
|
276
|
-
if (!sharedConfig.hydrating) return fn(prev);
|
|
277
|
-
subFetch(fn, prev);
|
|
278
|
-
return prev ?? second;
|
|
279
|
-
}, second, third);
|
|
280
|
-
}
|
|
281
|
-
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second, third);
|
|
419
|
+
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second);
|
|
282
420
|
if (aiResult !== null) return aiResult;
|
|
283
|
-
return createSignal$1(prev =>
|
|
284
|
-
if (!sharedConfig.hydrating) return fn(prev);
|
|
285
|
-
const o = getOwner();
|
|
286
|
-
let initP;
|
|
287
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
288
|
-
const init = initP?.v ?? initP;
|
|
289
|
-
return init != null ? (subFetch(fn, prev), init) : fn(prev);
|
|
290
|
-
}, second, third);
|
|
421
|
+
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
291
422
|
}
|
|
292
423
|
function hydratedCreateErrorBoundary(fn, fallback) {
|
|
293
424
|
if (!sharedConfig.hydrating) return createErrorBoundary$1(fn, fallback);
|
|
@@ -309,127 +440,113 @@ function hydratedCreateErrorBoundary(fn, fallback) {
|
|
|
309
440
|
}
|
|
310
441
|
return createErrorBoundary$1(fn, fallback);
|
|
311
442
|
}
|
|
312
|
-
function hydratedCreateOptimistic(fn, second
|
|
313
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second
|
|
443
|
+
function hydratedCreateOptimistic(fn, second) {
|
|
444
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second);
|
|
314
445
|
markTopLevelSnapshotScope();
|
|
315
|
-
const ssrSource =
|
|
446
|
+
const ssrSource = second?.ssrSource;
|
|
316
447
|
if (ssrSource === "client") {
|
|
317
|
-
const [hydrated, setHydrated] = createSignal$1(false
|
|
448
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
449
|
+
ownedWrite: true
|
|
450
|
+
});
|
|
318
451
|
const sig = createOptimistic$1(prev => {
|
|
319
|
-
if (!hydrated()) return prev
|
|
452
|
+
if (!hydrated()) return prev;
|
|
320
453
|
return fn(prev);
|
|
321
|
-
}, second
|
|
454
|
+
}, second);
|
|
322
455
|
setHydrated(true);
|
|
323
456
|
return sig;
|
|
324
457
|
}
|
|
325
|
-
|
|
326
|
-
return createOptimistic$1(prev => {
|
|
327
|
-
if (!sharedConfig.hydrating) return fn(prev);
|
|
328
|
-
subFetch(fn, prev);
|
|
329
|
-
return prev ?? second;
|
|
330
|
-
}, second, third);
|
|
331
|
-
}
|
|
332
|
-
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second, third);
|
|
458
|
+
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second);
|
|
333
459
|
if (aiResult !== null) return aiResult;
|
|
334
|
-
return createOptimistic$1(prev =>
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
460
|
+
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
461
|
+
}
|
|
462
|
+
function wrapStoreFn(fn) {
|
|
463
|
+
return draft => readSerializedOrCompute(() => fn(draft), draft);
|
|
464
|
+
}
|
|
465
|
+
function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
466
|
+
if (ssrSource === "client") {
|
|
467
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
468
|
+
ownedWrite: true
|
|
469
|
+
});
|
|
470
|
+
const result = coreFn(draft => {
|
|
471
|
+
if (!hydrated()) return;
|
|
472
|
+
return fn(draft);
|
|
473
|
+
}, initialValue, options);
|
|
474
|
+
setHydrated(true);
|
|
475
|
+
return result;
|
|
350
476
|
}
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
477
|
+
if (ssrSource === "hybrid") {
|
|
478
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
479
|
+
ownedWrite: true
|
|
480
|
+
});
|
|
481
|
+
const result = coreFn(draft => {
|
|
482
|
+
const o = getOwner();
|
|
483
|
+
if (!hydrated()) {
|
|
484
|
+
if (sharedConfig.has(o.id)) {
|
|
485
|
+
const initP = sharedConfig.load(o.id);
|
|
486
|
+
const init = readHydratedValue(initP, () => subFetch(fn, draft));
|
|
487
|
+
if (init !== NO_HYDRATED_VALUE) return init;
|
|
488
|
+
}
|
|
489
|
+
return fn(draft);
|
|
490
|
+
}
|
|
491
|
+
const {
|
|
492
|
+
proxy,
|
|
493
|
+
activate
|
|
494
|
+
} = createShadowDraft(draft);
|
|
495
|
+
const r = fn(proxy);
|
|
496
|
+
return isAsyncIterable(r) ? wrapFirstYield(r, activate) : r;
|
|
497
|
+
}, initialValue, options);
|
|
498
|
+
setHydrated(true);
|
|
499
|
+
return result;
|
|
500
|
+
}
|
|
501
|
+
const aiResult = hydrateStoreFromAsyncIterable(coreFn, fn, initialValue, options);
|
|
502
|
+
if (aiResult !== null) return aiResult;
|
|
503
|
+
return coreFn(wrapStoreFn(fn), initialValue, options);
|
|
359
504
|
}
|
|
360
505
|
function hydratedCreateStore(first, second, third) {
|
|
361
506
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third);
|
|
362
507
|
markTopLevelSnapshotScope();
|
|
363
508
|
const ssrSource = third?.ssrSource;
|
|
364
|
-
|
|
365
|
-
return createStore$1(second ?? {}, undefined, third);
|
|
366
|
-
}
|
|
367
|
-
const aiResult = hydrateStoreFromAsyncIterable(createStore$1, second ?? {}, third);
|
|
368
|
-
if (aiResult !== null) return aiResult;
|
|
369
|
-
return createStore$1(wrapStoreFn(first, ssrSource), second, third);
|
|
509
|
+
return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource);
|
|
370
510
|
}
|
|
371
511
|
function hydratedCreateOptimisticStore(first, second, third) {
|
|
372
512
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createOptimisticStore$1(first, second, third);
|
|
373
513
|
markTopLevelSnapshotScope();
|
|
374
514
|
const ssrSource = third?.ssrSource;
|
|
375
|
-
|
|
376
|
-
return createOptimisticStore$1(second ?? {}, undefined, third);
|
|
377
|
-
}
|
|
378
|
-
const aiResult = hydrateStoreFromAsyncIterable(createOptimisticStore$1, second ?? {}, third);
|
|
379
|
-
if (aiResult !== null) return aiResult;
|
|
380
|
-
return createOptimisticStore$1(wrapStoreFn(first, ssrSource), second, third);
|
|
515
|
+
return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource);
|
|
381
516
|
}
|
|
382
517
|
function hydratedCreateProjection(fn, initialValue, options) {
|
|
383
518
|
if (!sharedConfig.hydrating) return createProjection$1(fn, initialValue, options);
|
|
384
519
|
markTopLevelSnapshotScope();
|
|
385
520
|
const ssrSource = options?.ssrSource;
|
|
386
|
-
|
|
387
|
-
return createProjection$1(draft => draft, initialValue, options);
|
|
388
|
-
}
|
|
389
|
-
const aiResult = hydrateStoreFromAsyncIterable(createStore$1, initialValue, options);
|
|
390
|
-
if (aiResult !== null) return aiResult[0];
|
|
391
|
-
return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options);
|
|
521
|
+
return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource);
|
|
392
522
|
}
|
|
393
|
-
function hydratedEffect(coreFn, compute, effectFn,
|
|
394
|
-
if (!sharedConfig.hydrating) return coreFn(compute, effectFn,
|
|
523
|
+
function hydratedEffect(coreFn, compute, effectFn, options) {
|
|
524
|
+
if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options);
|
|
395
525
|
const ssrSource = options?.ssrSource;
|
|
396
526
|
if (ssrSource === "client") {
|
|
397
|
-
const [hydrated, setHydrated] = createSignal$1(false
|
|
527
|
+
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
528
|
+
ownedWrite: true
|
|
529
|
+
});
|
|
398
530
|
let active = false;
|
|
399
531
|
coreFn(prev => {
|
|
400
|
-
if (!hydrated()) return
|
|
532
|
+
if (!hydrated()) return prev;
|
|
401
533
|
active = true;
|
|
402
534
|
return compute(prev);
|
|
403
535
|
}, (next, prev) => {
|
|
404
536
|
if (!active) return;
|
|
405
537
|
return effectFn(next, prev);
|
|
406
|
-
},
|
|
538
|
+
}, options);
|
|
407
539
|
setHydrated(true);
|
|
408
540
|
return;
|
|
409
541
|
}
|
|
410
|
-
if (ssrSource === "initial") {
|
|
411
|
-
coreFn(prev => {
|
|
412
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
413
|
-
subFetch(compute, prev);
|
|
414
|
-
return prev ?? value;
|
|
415
|
-
}, effectFn, value, options);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
542
|
markTopLevelSnapshotScope();
|
|
419
|
-
coreFn(prev =>
|
|
420
|
-
const o = getOwner();
|
|
421
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
422
|
-
let initP;
|
|
423
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
424
|
-
const init = initP?.v ?? initP;
|
|
425
|
-
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
426
|
-
}, effectFn, value, options);
|
|
543
|
+
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options);
|
|
427
544
|
}
|
|
428
|
-
function hydratedCreateRenderEffect(compute, effectFn,
|
|
429
|
-
return hydratedEffect(createRenderEffect$1, compute, effectFn,
|
|
545
|
+
function hydratedCreateRenderEffect(compute, effectFn, options) {
|
|
546
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, options);
|
|
430
547
|
}
|
|
431
|
-
function hydratedCreateEffect(compute, effectFn,
|
|
432
|
-
return hydratedEffect(createEffect$1, compute, effectFn,
|
|
548
|
+
function hydratedCreateEffect(compute, effectFn, options) {
|
|
549
|
+
return hydratedEffect(createEffect$1, compute, effectFn, options);
|
|
433
550
|
}
|
|
434
551
|
function enableHydration() {
|
|
435
552
|
_createMemo = hydratedCreateMemo;
|
|
@@ -488,24 +605,6 @@ const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
|
488
605
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
489
606
|
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
490
607
|
const createEffect = (...args) => (_createEffect || createEffect$1)(...args);
|
|
491
|
-
function loadModuleAssets(mapping) {
|
|
492
|
-
const hy = globalThis._$HY;
|
|
493
|
-
if (!hy) return;
|
|
494
|
-
if (!hy.modules) hy.modules = {};
|
|
495
|
-
if (!hy.loading) hy.loading = {};
|
|
496
|
-
const pending = [];
|
|
497
|
-
for (const moduleUrl in mapping) {
|
|
498
|
-
if (hy.modules[moduleUrl]) continue;
|
|
499
|
-
const entryUrl = mapping[moduleUrl];
|
|
500
|
-
if (!hy.loading[moduleUrl]) {
|
|
501
|
-
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
502
|
-
hy.modules[moduleUrl] = mod;
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
pending.push(hy.loading[moduleUrl]);
|
|
506
|
-
}
|
|
507
|
-
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
508
|
-
}
|
|
509
608
|
function createBoundaryTrigger() {
|
|
510
609
|
setSnapshotCapture(false);
|
|
511
610
|
const [s, set] = createSignal$1(undefined, {
|
|
@@ -521,7 +620,7 @@ function resumeBoundaryHydration(o, id, set) {
|
|
|
521
620
|
checkHydrationComplete();
|
|
522
621
|
return;
|
|
523
622
|
}
|
|
524
|
-
sharedConfig.gather(id);
|
|
623
|
+
sharedConfig.gather?.(id);
|
|
525
624
|
_hydratingValue = true;
|
|
526
625
|
markSnapshotScope(o);
|
|
527
626
|
_snapshotRootOwner = o;
|
|
@@ -533,38 +632,65 @@ function resumeBoundaryHydration(o, id, set) {
|
|
|
533
632
|
flush();
|
|
534
633
|
checkHydrationComplete();
|
|
535
634
|
}
|
|
536
|
-
function
|
|
537
|
-
|
|
635
|
+
function initBoundaryResume(o, id) {
|
|
636
|
+
_pendingBoundaries++;
|
|
637
|
+
onCleanup(() => {
|
|
638
|
+
if (!isDisposed(o)) return;
|
|
639
|
+
sharedConfig.cleanupFragment?.(id);
|
|
640
|
+
});
|
|
641
|
+
const set = createBoundaryTrigger();
|
|
642
|
+
return [set, () => resumeBoundaryHydration(o, id, set)];
|
|
643
|
+
}
|
|
644
|
+
function waitAndResume(p, resume, assetPromise) {
|
|
645
|
+
const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
|
|
646
|
+
waitFor.then(() => {
|
|
647
|
+
if (p && typeof p === "object") p.s = 1;
|
|
648
|
+
resume();
|
|
649
|
+
}, err => {
|
|
650
|
+
if (p && typeof p === "object") {
|
|
651
|
+
p.s = 2;
|
|
652
|
+
p.v = err;
|
|
653
|
+
}
|
|
654
|
+
resume();
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function scheduleResumeAfterAssets(id, resume, assetPromise) {
|
|
658
|
+
sharedConfig.gather?.(id);
|
|
659
|
+
const doResume = () => queueMicrotask(resume);
|
|
660
|
+
if (assetPromise) {
|
|
661
|
+
assetPromise.then(doResume);
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
doResume();
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
function createLoadingBoundary(fn, fallback, options) {
|
|
668
|
+
if (!sharedConfig.hydrating) return createLoadingBoundary$1(fn, fallback, options);
|
|
669
|
+
let settledSerializationResumeQueued = false;
|
|
538
670
|
return createMemo$1(() => {
|
|
539
671
|
const o = getOwner();
|
|
540
672
|
const id = o.id;
|
|
541
673
|
let assetPromise;
|
|
542
674
|
if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
|
|
543
675
|
const mapping = sharedConfig.load(id + "_assets");
|
|
544
|
-
if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
|
|
676
|
+
if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping);
|
|
545
677
|
}
|
|
546
678
|
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
547
|
-
|
|
679
|
+
const ref = sharedConfig.load(id);
|
|
548
680
|
let p;
|
|
549
681
|
if (ref) {
|
|
550
|
-
if (typeof ref !== "object" || ref.s
|
|
682
|
+
if (typeof ref !== "object" || ref.s == null) p = ref;else if (ref.s === 1 || ref.s === 2) sharedConfig.gather?.(id);else p = ref;
|
|
683
|
+
}
|
|
684
|
+
if (ref && typeof ref === "object" && ref.s === 1 && p == null && !settledSerializationResumeQueued) {
|
|
685
|
+
settledSerializationResumeQueued = true;
|
|
686
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
687
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
688
|
+
return fallback();
|
|
551
689
|
}
|
|
552
690
|
if (p) {
|
|
553
|
-
|
|
554
|
-
onCleanup(() => {
|
|
555
|
-
if (!isDisposed(o)) return;
|
|
556
|
-
sharedConfig.cleanupFragment?.(id);
|
|
557
|
-
});
|
|
558
|
-
const set = createBoundaryTrigger();
|
|
691
|
+
const [set, resume] = initBoundaryResume(o, id);
|
|
559
692
|
if (p !== "$$f") {
|
|
560
|
-
|
|
561
|
-
waitFor.then(() => resumeBoundaryHydration(o, id, set), err => {
|
|
562
|
-
_pendingBoundaries--;
|
|
563
|
-
checkHydrationComplete();
|
|
564
|
-
runWithOwner(o, () => {
|
|
565
|
-
throw err;
|
|
566
|
-
});
|
|
567
|
-
});
|
|
693
|
+
waitAndResume(p, resume, assetPromise);
|
|
568
694
|
} else {
|
|
569
695
|
const afterAssets = () => {
|
|
570
696
|
_pendingBoundaries--;
|
|
@@ -573,18 +699,39 @@ function Loading(props) {
|
|
|
573
699
|
};
|
|
574
700
|
if (assetPromise) assetPromise.then(() => queueMicrotask(afterAssets));else queueMicrotask(afterAssets);
|
|
575
701
|
}
|
|
576
|
-
return
|
|
702
|
+
return fallback();
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (sharedConfig.hydrating && sharedConfig.has(id + "_fr") && !settledSerializationResumeQueued) {
|
|
706
|
+
settledSerializationResumeQueued = true;
|
|
707
|
+
const fr = sharedConfig.load(id + "_fr");
|
|
708
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
709
|
+
if (fr && typeof fr === "object" && (fr.s === 1 || fr.s === 2)) {
|
|
710
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
711
|
+
return fallback();
|
|
577
712
|
}
|
|
713
|
+
waitAndResume(fr, resume, assetPromise);
|
|
714
|
+
return fallback();
|
|
578
715
|
}
|
|
579
|
-
if (assetPromise) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
assetPromise.then(() => resumeBoundaryHydration(o, id, set));
|
|
716
|
+
if (assetPromise && !sharedConfig.has(id)) {
|
|
717
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
718
|
+
assetPromise.then(resume);
|
|
583
719
|
return undefined;
|
|
584
720
|
}
|
|
585
|
-
return
|
|
721
|
+
return createLoadingBoundary$1(fn, fallback, options);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function NoHydration(props) {
|
|
725
|
+
const o = createOwner();
|
|
726
|
+
return runWithOwner(o, () => {
|
|
727
|
+
setContext(NoHydrateContext, true);
|
|
728
|
+
if (sharedConfig.hydrating) return undefined;
|
|
729
|
+
return props.children;
|
|
586
730
|
});
|
|
587
731
|
}
|
|
732
|
+
function Hydration(props) {
|
|
733
|
+
return props.children;
|
|
734
|
+
}
|
|
588
735
|
|
|
589
736
|
function createComponent(Comp, props) {
|
|
590
737
|
return devComponent(Comp, props || {});
|
|
@@ -616,6 +763,7 @@ function lazy(fn, moduleUrl) {
|
|
|
616
763
|
}) : "");
|
|
617
764
|
};
|
|
618
765
|
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
766
|
+
wrap.moduleUrl = moduleUrl;
|
|
619
767
|
return wrap;
|
|
620
768
|
}
|
|
621
769
|
let counter = 0;
|
|
@@ -644,10 +792,10 @@ function Repeat(props) {
|
|
|
644
792
|
}
|
|
645
793
|
function Show(props) {
|
|
646
794
|
const keyed = props.keyed;
|
|
647
|
-
const conditionValue = createMemo$1(() => props.when,
|
|
795
|
+
const conditionValue = createMemo$1(() => props.when, {
|
|
648
796
|
name: "condition value"
|
|
649
797
|
} );
|
|
650
|
-
const condition = keyed ? conditionValue : createMemo$1(conditionValue,
|
|
798
|
+
const condition = keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
651
799
|
equals: (a, b) => !a === !b,
|
|
652
800
|
name: "condition"
|
|
653
801
|
} );
|
|
@@ -656,20 +804,13 @@ function Show(props) {
|
|
|
656
804
|
if (c) {
|
|
657
805
|
const child = props.children;
|
|
658
806
|
const fn = typeof child === "function" && child.length > 0;
|
|
659
|
-
return fn ? untrack(() => {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
664
|
-
return conditionValue();
|
|
665
|
-
});
|
|
666
|
-
} finally {
|
|
667
|
-
setStrictRead(false);
|
|
668
|
-
}
|
|
669
|
-
}) : child;
|
|
807
|
+
return fn ? untrack(() => child(() => {
|
|
808
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
809
|
+
return conditionValue();
|
|
810
|
+
}), "<Show>") : child;
|
|
670
811
|
}
|
|
671
812
|
return props.fallback;
|
|
672
|
-
},
|
|
813
|
+
}, {
|
|
673
814
|
name: "value"
|
|
674
815
|
} );
|
|
675
816
|
}
|
|
@@ -682,10 +823,10 @@ function Switch(props) {
|
|
|
682
823
|
const index = i;
|
|
683
824
|
const mp = mps[i];
|
|
684
825
|
const prevFunc = func;
|
|
685
|
-
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when,
|
|
826
|
+
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, {
|
|
686
827
|
name: "condition value"
|
|
687
828
|
} );
|
|
688
|
-
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue,
|
|
829
|
+
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
689
830
|
equals: (a, b) => !a === !b,
|
|
690
831
|
name: "condition"
|
|
691
832
|
} );
|
|
@@ -699,18 +840,11 @@ function Switch(props) {
|
|
|
699
840
|
const [index, conditionValue, mp] = sel;
|
|
700
841
|
const child = mp.children;
|
|
701
842
|
const fn = typeof child === "function" && child.length > 0;
|
|
702
|
-
return fn ? untrack(() => {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
return conditionValue();
|
|
708
|
-
});
|
|
709
|
-
} finally {
|
|
710
|
-
setStrictRead(false);
|
|
711
|
-
}
|
|
712
|
-
}) : child;
|
|
713
|
-
}, undefined, {
|
|
843
|
+
return fn ? untrack(() => child(() => {
|
|
844
|
+
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
845
|
+
return conditionValue();
|
|
846
|
+
}), "<Match>") : child;
|
|
847
|
+
}, {
|
|
714
848
|
name: "eval conditions"
|
|
715
849
|
} );
|
|
716
850
|
}
|
|
@@ -724,16 +858,24 @@ function Errored(props) {
|
|
|
724
858
|
return typeof f === "function" && f.length ? f(err, reset) : f;
|
|
725
859
|
});
|
|
726
860
|
}
|
|
861
|
+
function Loading(props) {
|
|
862
|
+
const onOpt = "on" in props ? {
|
|
863
|
+
on: () => props.on
|
|
864
|
+
} : undefined;
|
|
865
|
+
return createLoadingBoundary(() => props.children, () => props.fallback, onOpt);
|
|
866
|
+
}
|
|
867
|
+
function Reveal(props) {
|
|
868
|
+
return createRevealOrder(() => props.children, {
|
|
869
|
+
order: () => props.order ?? "sequential",
|
|
870
|
+
collapsed: () => !!props.collapsed
|
|
871
|
+
});
|
|
872
|
+
}
|
|
727
873
|
|
|
728
874
|
function ssrHandleError() {}
|
|
729
875
|
function ssrRunInScope() {}
|
|
730
|
-
const
|
|
731
|
-
const DEV = {
|
|
732
|
-
hooks: DevHooks,
|
|
733
|
-
registerGraph
|
|
734
|
-
} ;
|
|
876
|
+
const DEV = DEV$1 ;
|
|
735
877
|
if (globalThis) {
|
|
736
878
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
737
879
|
}
|
|
738
880
|
|
|
739
|
-
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 };
|
|
881
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|