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