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