solid-js 1.5.0-beta.1 → 1.5.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +161 -145
- package/dist/dev.js +161 -145
- package/dist/server.cjs +76 -42
- package/dist/server.js +76 -42
- package/dist/solid.cjs +161 -145
- package/dist/solid.js +161 -145
- package/h/jsx-runtime/types/jsx.d.ts +3 -1
- package/package.json +81 -21
- package/store/types/index.d.ts +4 -4
- package/store/types/mutable.d.ts +1 -1
- package/store/types/server.d.ts +1 -1
- package/store/types/store.d.ts +2 -2
- package/types/index.d.ts +8 -8
- package/types/jsx.d.ts +4 -2
- package/types/reactive/array.d.ts +1 -1
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +51 -36
- package/types/render/Suspense.d.ts +1 -1
- package/types/render/component.d.ts +1 -1
- package/types/render/flow.d.ts +20 -3
- package/types/render/index.d.ts +4 -4
- package/types/server/index.d.ts +3 -3
- package/types/server/reactive.d.ts +6 -3
- package/types/server/rendering.d.ts +16 -7
- package/universal/dist/dev.cjs +4 -1
- package/universal/dist/dev.js +5 -2
- package/universal/dist/universal.cjs +4 -1
- package/universal/dist/universal.js +5 -2
- package/universal/types/index.d.ts +1 -1
- package/web/dist/dev.cjs +13 -7
- package/web/dist/dev.js +8 -6
- package/web/dist/server.cjs +324 -246
- package/web/dist/server.js +322 -247
- package/web/dist/web.cjs +13 -7
- package/web/dist/web.js +8 -6
- package/web/types/client.d.ts +4 -1
- package/web/types/core.d.ts +2 -2
- package/web/types/index.d.ts +3 -3
- package/web/types/jsx.d.ts +1 -1
- package/web/types/server-mock.d.ts +4 -1
- package/web/types/server.d.ts +2 -0
package/dist/solid.js
CHANGED
|
@@ -149,7 +149,6 @@ let Transition = null;
|
|
|
149
149
|
let Scheduler = null;
|
|
150
150
|
let ExternalSourceFactory = null;
|
|
151
151
|
let Listener = null;
|
|
152
|
-
let Pending = null;
|
|
153
152
|
let Updates = null;
|
|
154
153
|
let Effects = null;
|
|
155
154
|
let ExecCount = 0;
|
|
@@ -163,7 +162,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
163
162
|
context: null,
|
|
164
163
|
owner: detachedOwner || owner
|
|
165
164
|
},
|
|
166
|
-
updateFn = unowned ? fn : () => fn(() => cleanNode(root));
|
|
165
|
+
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
167
166
|
Owner = root;
|
|
168
167
|
Listener = null;
|
|
169
168
|
try {
|
|
@@ -231,18 +230,19 @@ function createMemo(fn, value, options) {
|
|
|
231
230
|
} else updateComputation(c);
|
|
232
231
|
return readSignal.bind(c);
|
|
233
232
|
}
|
|
234
|
-
function createResource(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
source = true;
|
|
240
|
-
}
|
|
241
|
-
} else if (arguments.length === 1) {
|
|
242
|
-
fetcher = source;
|
|
233
|
+
function createResource(pSource, pFetcher, pOptions) {
|
|
234
|
+
let source;
|
|
235
|
+
let fetcher;
|
|
236
|
+
let options;
|
|
237
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
243
238
|
source = true;
|
|
239
|
+
fetcher = pSource;
|
|
240
|
+
options = pFetcher || {};
|
|
241
|
+
} else {
|
|
242
|
+
source = pSource;
|
|
243
|
+
fetcher = pFetcher;
|
|
244
|
+
options = pOptions || {};
|
|
244
245
|
}
|
|
245
|
-
options || (options = {});
|
|
246
246
|
let err = undefined,
|
|
247
247
|
pr = null,
|
|
248
248
|
initP = NO_INIT,
|
|
@@ -260,7 +260,7 @@ function createResource(source, fetcher, options) {
|
|
|
260
260
|
if (sharedConfig.context) {
|
|
261
261
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
262
262
|
let v;
|
|
263
|
-
if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
263
|
+
if (options.useInitialValue) initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
264
264
|
}
|
|
265
265
|
function loadEnd(p, v, success, key) {
|
|
266
266
|
if (pr === p) {
|
|
@@ -288,8 +288,8 @@ function createResource(source, fetcher, options) {
|
|
|
288
288
|
function completeLoad(v, success) {
|
|
289
289
|
!success && (err = castError(v));
|
|
290
290
|
runUpdates(() => {
|
|
291
|
-
setValue(() =>
|
|
292
|
-
setState(success ? "ready" : "
|
|
291
|
+
setValue(() => v);
|
|
292
|
+
setState(success ? "ready" : "errored");
|
|
293
293
|
for (const c of contexts.keys()) c.decrement();
|
|
294
294
|
contexts.clear();
|
|
295
295
|
}, false);
|
|
@@ -312,7 +312,7 @@ function createResource(source, fetcher, options) {
|
|
|
312
312
|
return v;
|
|
313
313
|
}
|
|
314
314
|
function load(refetching = true) {
|
|
315
|
-
if (refetching && scheduled) return;
|
|
315
|
+
if (refetching !== false && scheduled) return;
|
|
316
316
|
scheduled = false;
|
|
317
317
|
err = undefined;
|
|
318
318
|
const lookup = dynamic ? dynamic() : source;
|
|
@@ -340,10 +340,11 @@ function createResource(source, fetcher, options) {
|
|
|
340
340
|
return p.then(v => loadEnd(p, v, true, lookup), e => loadEnd(p, e, false));
|
|
341
341
|
}
|
|
342
342
|
Object.defineProperties(read, {
|
|
343
|
+
value: {
|
|
344
|
+
get: () => value()
|
|
345
|
+
},
|
|
343
346
|
state: {
|
|
344
|
-
get()
|
|
345
|
-
return state();
|
|
346
|
-
}
|
|
347
|
+
get: () => state()
|
|
347
348
|
},
|
|
348
349
|
loading: {
|
|
349
350
|
get() {
|
|
@@ -353,13 +354,13 @@ function createResource(source, fetcher, options) {
|
|
|
353
354
|
},
|
|
354
355
|
error: {
|
|
355
356
|
get() {
|
|
356
|
-
return state() === "
|
|
357
|
+
return state() === "errored" ? err : undefined;
|
|
357
358
|
}
|
|
358
359
|
},
|
|
359
360
|
latest: {
|
|
360
361
|
get() {
|
|
361
362
|
if (!resolved) return read();
|
|
362
|
-
if (state() === "
|
|
363
|
+
if (state() === "errored") throw err;
|
|
363
364
|
return value();
|
|
364
365
|
}
|
|
365
366
|
}
|
|
@@ -388,9 +389,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
388
389
|
const subs = new Map();
|
|
389
390
|
const node = createComputation(p => {
|
|
390
391
|
const v = source();
|
|
391
|
-
for (const key of subs.
|
|
392
|
-
const
|
|
393
|
-
for (const c of l.values()) {
|
|
392
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
393
|
+
for (const c of val.values()) {
|
|
394
394
|
c.state = STALE;
|
|
395
395
|
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
396
396
|
}
|
|
@@ -399,8 +399,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
399
399
|
}, undefined, true, STALE);
|
|
400
400
|
updateComputation(node);
|
|
401
401
|
return key => {
|
|
402
|
-
|
|
403
|
-
if (listener
|
|
402
|
+
const listener = Listener;
|
|
403
|
+
if (listener) {
|
|
404
404
|
let l;
|
|
405
405
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
406
406
|
onCleanup(() => {
|
|
@@ -412,18 +412,7 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
function batch(fn) {
|
|
415
|
-
|
|
416
|
-
let result;
|
|
417
|
-
const q = Pending = [];
|
|
418
|
-
try {
|
|
419
|
-
result = fn();
|
|
420
|
-
} finally {
|
|
421
|
-
Pending = null;
|
|
422
|
-
}
|
|
423
|
-
runUpdates(() => {
|
|
424
|
-
for (let i = 0; i < q.length; i += 1) notifySignal(q[i]);
|
|
425
|
-
}, false);
|
|
426
|
-
return result;
|
|
415
|
+
return runUpdates(fn, false);
|
|
427
416
|
}
|
|
428
417
|
function untrack(fn) {
|
|
429
418
|
let result,
|
|
@@ -532,7 +521,12 @@ function useContext(context) {
|
|
|
532
521
|
}
|
|
533
522
|
function children(fn) {
|
|
534
523
|
const children = createMemo(fn);
|
|
535
|
-
|
|
524
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
525
|
+
memo.toArray = () => {
|
|
526
|
+
const c = memo();
|
|
527
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
528
|
+
};
|
|
529
|
+
return memo;
|
|
536
530
|
}
|
|
537
531
|
let SuspenseContext;
|
|
538
532
|
function getSuspenseContext() {
|
|
@@ -559,10 +553,12 @@ function enableExternalSource(factory) {
|
|
|
559
553
|
function readSignal() {
|
|
560
554
|
const runningTransition = Transition && Transition.running;
|
|
561
555
|
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
556
|
+
if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE) updateComputation(this);else {
|
|
557
|
+
const updates = Updates;
|
|
558
|
+
Updates = null;
|
|
559
|
+
runUpdates(() => lookUpstream(this), false);
|
|
560
|
+
Updates = updates;
|
|
561
|
+
}
|
|
566
562
|
}
|
|
567
563
|
if (Listener) {
|
|
568
564
|
const sSlot = this.observers ? this.observers.length : 0;
|
|
@@ -595,30 +591,27 @@ function writeSignal(node, value, isComp) {
|
|
|
595
591
|
}
|
|
596
592
|
if (!TransitionRunning) node.value = value;
|
|
597
593
|
} else node.value = value;
|
|
598
|
-
if (
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
|
|
610
|
-
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
611
|
-
if (o.observers) markDownstream(o);
|
|
594
|
+
if (node.observers && node.observers.length) {
|
|
595
|
+
runUpdates(() => {
|
|
596
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
597
|
+
const o = node.observers[i];
|
|
598
|
+
const TransitionRunning = Transition && Transition.running;
|
|
599
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
600
|
+
if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
|
|
601
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
602
|
+
if (o.observers) markDownstream(o);
|
|
603
|
+
}
|
|
604
|
+
if (TransitionRunning) o.tState = STALE;else o.state = STALE;
|
|
612
605
|
}
|
|
613
|
-
if (
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}, false);
|
|
606
|
+
if (Updates.length > 10e5) {
|
|
607
|
+
Updates = [];
|
|
608
|
+
if (false) ;
|
|
609
|
+
throw new Error();
|
|
610
|
+
}
|
|
611
|
+
}, false);
|
|
612
|
+
}
|
|
621
613
|
}
|
|
614
|
+
return value;
|
|
622
615
|
}
|
|
623
616
|
function updateComputation(node) {
|
|
624
617
|
if (!node.fn) return;
|
|
@@ -644,10 +637,11 @@ function runComputation(node, value, time) {
|
|
|
644
637
|
try {
|
|
645
638
|
nextValue = node.fn(value);
|
|
646
639
|
} catch (err) {
|
|
640
|
+
if (node.pure) Transition && Transition.running ? node.tState = STALE : node.state = STALE;
|
|
647
641
|
handleError(err);
|
|
648
642
|
}
|
|
649
643
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
650
|
-
if (node.updatedAt && "observers" in node) {
|
|
644
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
651
645
|
writeSignal(node, nextValue, true);
|
|
652
646
|
} else if (Transition && Transition.running && node.pure) {
|
|
653
647
|
Transition.sources.add(node);
|
|
@@ -720,7 +714,7 @@ function runTop(node) {
|
|
|
720
714
|
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
721
715
|
const updates = Updates;
|
|
722
716
|
Updates = null;
|
|
723
|
-
lookUpstream(node, ancestors[0]);
|
|
717
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
724
718
|
Updates = updates;
|
|
725
719
|
}
|
|
726
720
|
}
|
|
@@ -914,7 +908,7 @@ function resolveChildren(children) {
|
|
|
914
908
|
function createProvider(id) {
|
|
915
909
|
return function provider(props) {
|
|
916
910
|
let res;
|
|
917
|
-
|
|
911
|
+
createRenderEffect(() => res = untrack(() => {
|
|
918
912
|
Owner.context = {
|
|
919
913
|
[id]: props.value
|
|
920
914
|
};
|
|
@@ -937,7 +931,7 @@ function observable(input) {
|
|
|
937
931
|
};
|
|
938
932
|
}
|
|
939
933
|
const dispose = createRoot(disposer => {
|
|
940
|
-
|
|
934
|
+
createEffect(() => {
|
|
941
935
|
const v = input();
|
|
942
936
|
untrack(() => handler(v));
|
|
943
937
|
});
|
|
@@ -1289,6 +1283,7 @@ function Index(props) {
|
|
|
1289
1283
|
}
|
|
1290
1284
|
function Show(props) {
|
|
1291
1285
|
let strictEqual = false;
|
|
1286
|
+
const keyed = props.keyed;
|
|
1292
1287
|
const condition = createMemo(() => props.when, undefined, {
|
|
1293
1288
|
equals: (a, b) => strictEqual ? a === b : !a === !b
|
|
1294
1289
|
});
|
|
@@ -1296,20 +1291,26 @@ function Show(props) {
|
|
|
1296
1291
|
const c = condition();
|
|
1297
1292
|
if (c) {
|
|
1298
1293
|
const child = props.children;
|
|
1299
|
-
|
|
1294
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1295
|
+
strictEqual = keyed || fn;
|
|
1296
|
+
return fn ? untrack(() => child(c)) : child;
|
|
1300
1297
|
}
|
|
1301
1298
|
return props.fallback;
|
|
1302
1299
|
});
|
|
1303
1300
|
}
|
|
1304
1301
|
function Switch(props) {
|
|
1305
1302
|
let strictEqual = false;
|
|
1303
|
+
let keyed = false;
|
|
1306
1304
|
const conditions = children(() => props.children),
|
|
1307
1305
|
evalConditions = createMemo(() => {
|
|
1308
1306
|
let conds = conditions();
|
|
1309
1307
|
if (!Array.isArray(conds)) conds = [conds];
|
|
1310
1308
|
for (let i = 0; i < conds.length; i++) {
|
|
1311
1309
|
const c = conds[i].when;
|
|
1312
|
-
if (c)
|
|
1310
|
+
if (c) {
|
|
1311
|
+
keyed = !!conds[i].keyed;
|
|
1312
|
+
return [i, c, conds[i]];
|
|
1313
|
+
}
|
|
1313
1314
|
}
|
|
1314
1315
|
return [-1];
|
|
1315
1316
|
}, undefined, {
|
|
@@ -1319,7 +1320,9 @@ function Switch(props) {
|
|
|
1319
1320
|
const [index, when, cond] = evalConditions();
|
|
1320
1321
|
if (index < 0) return props.fallback;
|
|
1321
1322
|
const c = cond.children;
|
|
1322
|
-
|
|
1323
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1324
|
+
strictEqual = keyed || fn;
|
|
1325
|
+
return fn ? untrack(() => c(when)) : c;
|
|
1323
1326
|
});
|
|
1324
1327
|
}
|
|
1325
1328
|
function Match(props) {
|
|
@@ -1341,81 +1344,94 @@ function ErrorBoundary(props) {
|
|
|
1341
1344
|
let e;
|
|
1342
1345
|
if (e = errored()) {
|
|
1343
1346
|
const f = props.fallback;
|
|
1344
|
-
|
|
1347
|
+
const res = typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1348
|
+
onError(setErrored);
|
|
1349
|
+
return res;
|
|
1345
1350
|
}
|
|
1346
1351
|
onError(setErrored);
|
|
1347
1352
|
return props.children;
|
|
1348
1353
|
});
|
|
1349
1354
|
}
|
|
1350
1355
|
|
|
1356
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1351
1357
|
const SuspenseListContext = createContext();
|
|
1352
1358
|
function SuspenseList(props) {
|
|
1353
|
-
let
|
|
1359
|
+
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1360
|
+
inFallback: false
|
|
1361
|
+
})),
|
|
1362
|
+
show;
|
|
1354
1363
|
const listContext = useContext(SuspenseListContext);
|
|
1364
|
+
const [registry, setRegistry] = createSignal([]);
|
|
1355
1365
|
if (listContext) {
|
|
1356
|
-
|
|
1357
|
-
suspenseSetter = setFallback;
|
|
1358
|
-
[showContent, showFallback] = listContext.register(inFallback);
|
|
1366
|
+
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1359
1367
|
}
|
|
1360
|
-
const
|
|
1361
|
-
comp = createComponent(SuspenseListContext.Provider, {
|
|
1362
|
-
value: {
|
|
1363
|
-
register: inFallback => {
|
|
1364
|
-
const [showingContent, showContent] = createSignal(false),
|
|
1365
|
-
[showingFallback, showFallback] = createSignal(false);
|
|
1366
|
-
setRegistry(registry => [...registry, {
|
|
1367
|
-
inFallback,
|
|
1368
|
-
showContent,
|
|
1369
|
-
showFallback
|
|
1370
|
-
}]);
|
|
1371
|
-
return [showingContent, showingFallback];
|
|
1372
|
-
}
|
|
1373
|
-
},
|
|
1374
|
-
get children() {
|
|
1375
|
-
return props.children;
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
createComputed(() => {
|
|
1368
|
+
const resolved = createMemo(prev => {
|
|
1379
1369
|
const reveal = props.revealOrder,
|
|
1380
1370
|
tail = props.tail,
|
|
1381
|
-
|
|
1382
|
-
|
|
1371
|
+
{
|
|
1372
|
+
showContent = true,
|
|
1373
|
+
showFallback = true
|
|
1374
|
+
} = show ? show() : {},
|
|
1383
1375
|
reg = registry(),
|
|
1384
1376
|
reverse = reveal === "backwards";
|
|
1385
1377
|
if (reveal === "together") {
|
|
1386
|
-
const all = reg.every(
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
return;
|
|
1378
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1379
|
+
const res = reg.map(() => ({
|
|
1380
|
+
showContent: all && showContent,
|
|
1381
|
+
showFallback
|
|
1382
|
+
}));
|
|
1383
|
+
res.inFallback = !all;
|
|
1384
|
+
return res;
|
|
1393
1385
|
}
|
|
1394
1386
|
let stop = false;
|
|
1387
|
+
let inFallback = prev.inFallback;
|
|
1388
|
+
const res = [];
|
|
1395
1389
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1396
1390
|
const n = reverse ? len - i - 1 : i,
|
|
1397
|
-
s = reg[n]
|
|
1391
|
+
s = reg[n]();
|
|
1398
1392
|
if (!stop && !s) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1393
|
+
res[n] = {
|
|
1394
|
+
showContent,
|
|
1395
|
+
showFallback
|
|
1396
|
+
};
|
|
1401
1397
|
} else {
|
|
1402
1398
|
const next = !stop;
|
|
1403
|
-
if (next
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1399
|
+
if (next) inFallback = true;
|
|
1400
|
+
res[n] = {
|
|
1401
|
+
showContent: next,
|
|
1402
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1403
|
+
};
|
|
1407
1404
|
stop = true;
|
|
1408
|
-
reg[n].showContent(next);
|
|
1409
1405
|
}
|
|
1410
1406
|
}
|
|
1411
|
-
if (!stop
|
|
1407
|
+
if (!stop) inFallback = false;
|
|
1408
|
+
res.inFallback = inFallback;
|
|
1409
|
+
return res;
|
|
1410
|
+
}, {
|
|
1411
|
+
inFallback: false
|
|
1412
|
+
});
|
|
1413
|
+
setWrapper(() => resolved);
|
|
1414
|
+
return createComponent(SuspenseListContext.Provider, {
|
|
1415
|
+
value: {
|
|
1416
|
+
register: inFallback => {
|
|
1417
|
+
let index;
|
|
1418
|
+
setRegistry(registry => {
|
|
1419
|
+
index = registry.length;
|
|
1420
|
+
return [...registry, inFallback];
|
|
1421
|
+
});
|
|
1422
|
+
return createMemo(() => resolved()[index], undefined, {
|
|
1423
|
+
equals: suspenseListEquals
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
},
|
|
1427
|
+
get children() {
|
|
1428
|
+
return props.children;
|
|
1429
|
+
}
|
|
1412
1430
|
});
|
|
1413
|
-
return comp;
|
|
1414
1431
|
}
|
|
1415
1432
|
function Suspense(props) {
|
|
1416
1433
|
let counter = 0,
|
|
1417
|
-
|
|
1418
|
-
showFallback,
|
|
1434
|
+
show,
|
|
1419
1435
|
ctx,
|
|
1420
1436
|
p,
|
|
1421
1437
|
flicker,
|
|
@@ -1437,29 +1453,26 @@ function Suspense(props) {
|
|
|
1437
1453
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1438
1454
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1439
1455
|
let ref = sharedConfig.load(key);
|
|
1440
|
-
if (ref) {
|
|
1441
|
-
p =
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
setHydrateContext();
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1456
|
+
if (ref && (p = ref[0]) && p !== "$$f") {
|
|
1457
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1458
|
+
const [s, set] = createSignal(undefined, {
|
|
1459
|
+
equals: false
|
|
1460
|
+
});
|
|
1461
|
+
flicker = s;
|
|
1462
|
+
p.then(err => {
|
|
1463
|
+
if (err || sharedConfig.done) {
|
|
1464
|
+
err && (error = err);
|
|
1465
|
+
return set();
|
|
1466
|
+
}
|
|
1467
|
+
sharedConfig.gather(key);
|
|
1468
|
+
setHydrateContext(ctx);
|
|
1469
|
+
set();
|
|
1470
|
+
setHydrateContext();
|
|
1471
|
+
});
|
|
1459
1472
|
}
|
|
1460
1473
|
}
|
|
1461
1474
|
const listContext = useContext(SuspenseListContext);
|
|
1462
|
-
if (listContext)
|
|
1475
|
+
if (listContext) show = listContext.register(store.inFallback);
|
|
1463
1476
|
let dispose;
|
|
1464
1477
|
onCleanup(() => dispose && dispose());
|
|
1465
1478
|
return createComponent(SuspenseContext.Provider, {
|
|
@@ -1472,20 +1485,23 @@ function Suspense(props) {
|
|
|
1472
1485
|
flicker();
|
|
1473
1486
|
return flicker = undefined;
|
|
1474
1487
|
}
|
|
1475
|
-
if (ctx &&
|
|
1488
|
+
if (ctx && p === "$$f") setHydrateContext();
|
|
1476
1489
|
const rendered = createMemo(() => props.children);
|
|
1477
|
-
return createMemo(
|
|
1490
|
+
return createMemo(prev => {
|
|
1478
1491
|
const inFallback = store.inFallback(),
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1492
|
+
{
|
|
1493
|
+
showContent = true,
|
|
1494
|
+
showFallback = true
|
|
1495
|
+
} = show ? show() : {};
|
|
1496
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1483
1497
|
store.resolved = true;
|
|
1484
|
-
|
|
1498
|
+
dispose && dispose();
|
|
1499
|
+
dispose = ctx = p = undefined;
|
|
1485
1500
|
resumeEffects(store.effects);
|
|
1486
1501
|
return rendered();
|
|
1487
1502
|
}
|
|
1488
|
-
if (!
|
|
1503
|
+
if (!showFallback) return;
|
|
1504
|
+
if (dispose) return prev;
|
|
1489
1505
|
return createRoot(disposer => {
|
|
1490
1506
|
dispose = disposer;
|
|
1491
1507
|
if (ctx) {
|
|
@@ -163,6 +163,7 @@ export namespace JSX {
|
|
|
163
163
|
onVolumeChange?: EventHandlerUnion<T, Event>;
|
|
164
164
|
onWaiting?: EventHandlerUnion<T, Event>;
|
|
165
165
|
onClick?: EventHandlerUnion<T, MouseEvent>;
|
|
166
|
+
onAuxClick?: EventHandlerUnion<T, MouseEvent>;
|
|
166
167
|
onContextMenu?: EventHandlerUnion<T, MouseEvent>;
|
|
167
168
|
onDblClick?: EventHandlerUnion<T, MouseEvent>;
|
|
168
169
|
onDrag?: EventHandlerUnion<T, DragEvent>;
|
|
@@ -252,6 +253,7 @@ export namespace JSX {
|
|
|
252
253
|
onvolumechange?: EventHandlerUnion<T, Event>;
|
|
253
254
|
onwaiting?: EventHandlerUnion<T, Event>;
|
|
254
255
|
onclick?: EventHandlerUnion<T, MouseEvent>;
|
|
256
|
+
onauxclick?: EventHandlerUnion<T, MouseEvent>;
|
|
255
257
|
oncontextmenu?: EventHandlerUnion<T, MouseEvent>;
|
|
256
258
|
ondblclick?: EventHandlerUnion<T, MouseEvent>;
|
|
257
259
|
ondrag?: EventHandlerUnion<T, DragEvent>;
|
|
@@ -1852,7 +1854,7 @@ export namespace JSX {
|
|
|
1852
1854
|
del: HTMLAttributes<HTMLElement>;
|
|
1853
1855
|
details: DetailsHtmlAttributes<HTMLDetailsElement>;
|
|
1854
1856
|
dfn: HTMLAttributes<HTMLElement>;
|
|
1855
|
-
dialog: DialogHtmlAttributes<
|
|
1857
|
+
dialog: DialogHtmlAttributes<HTMLDialogElement>;
|
|
1856
1858
|
div: HTMLAttributes<HTMLDivElement>;
|
|
1857
1859
|
dl: HTMLAttributes<HTMLDListElement>;
|
|
1858
1860
|
dt: HTMLAttributes<HTMLElement>;
|