solid-js 1.2.3 → 1.3.0-beta.1
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 +69 -35
- package/dist/dev.js +70 -35
- package/dist/server.cjs +20 -51
- package/dist/server.js +21 -51
- package/dist/solid.cjs +69 -35
- package/dist/solid.js +70 -35
- package/html/dist/html.cjs +3 -2
- package/html/dist/html.js +3 -2
- package/package.json +2 -2
- package/store/dist/dev.cjs +1 -1
- package/store/dist/dev.js +2 -2
- package/store/dist/store.cjs +1 -1
- package/store/dist/store.js +1 -1
- package/store/types/store.d.ts +1 -1
- package/types/index.d.ts +0 -1
- package/types/jsx.d.ts +2 -0
- package/types/reactive/signal.d.ts +76 -78
- package/types/render/hydration.d.ts +3 -2
- package/types/server/index.d.ts +1 -1
- package/types/server/reactive.d.ts +1 -2
- package/types/server/rendering.d.ts +2 -1
- package/web/dist/dev.cjs +57 -40
- package/web/dist/dev.js +58 -40
- package/web/dist/server.cjs +205 -101
- package/web/dist/server.js +206 -103
- package/web/dist/web.cjs +57 -40
- package/web/dist/web.js +58 -40
- package/web/types/client.d.ts +0 -1
- package/web/types/core.d.ts +2 -2
package/dist/server.js
CHANGED
|
@@ -215,7 +215,7 @@ function createUniqueId() {
|
|
|
215
215
|
return `${ctx.id}${ctx.count++}`;
|
|
216
216
|
}
|
|
217
217
|
function createComponent(Comp, props) {
|
|
218
|
-
if (sharedConfig.context) {
|
|
218
|
+
if (sharedConfig.context && !sharedConfig.context.noHydrate) {
|
|
219
219
|
const c = sharedConfig.context;
|
|
220
220
|
setHydrateContext(nextHydrateContext());
|
|
221
221
|
const r = Comp(props);
|
|
@@ -316,7 +316,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
316
316
|
const read = () => {
|
|
317
317
|
if (resourceContext && p) resourceContext.push(p);
|
|
318
318
|
const resolved = sharedConfig.context.async && sharedConfig.context.resources[id].data;
|
|
319
|
-
if (
|
|
319
|
+
if (!resolved) {
|
|
320
320
|
const ctx = useContext(SuspenseContext);
|
|
321
321
|
if (ctx) {
|
|
322
322
|
ctx.resources.set(id, read);
|
|
@@ -328,7 +328,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
328
328
|
read.loading = false;
|
|
329
329
|
function load() {
|
|
330
330
|
const ctx = sharedConfig.context;
|
|
331
|
-
if (!ctx.async
|
|
331
|
+
if (!ctx.async) return read.loading = true;
|
|
332
332
|
if (ctx.resources && id in ctx.resources && ctx.resources[id].data) {
|
|
333
333
|
value = ctx.resources[id].data;
|
|
334
334
|
return;
|
|
@@ -345,15 +345,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
345
345
|
}
|
|
346
346
|
read.loading = true;
|
|
347
347
|
if ("then" in p) {
|
|
348
|
-
if (ctx.writeResource)
|
|
349
|
-
ctx.writeResource(id, p);
|
|
350
|
-
p.then(v => {
|
|
351
|
-
value = v;
|
|
352
|
-
read.loading = false;
|
|
353
|
-
p = null;
|
|
354
|
-
});
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
348
|
+
if (ctx.writeResource) ctx.writeResource(id, p);
|
|
357
349
|
p.then(res => {
|
|
358
350
|
read.loading = false;
|
|
359
351
|
ctx.resources[id].data = res;
|
|
@@ -388,7 +380,7 @@ function lazy(fn) {
|
|
|
388
380
|
ctx.resources.set(id, track);
|
|
389
381
|
contexts.add(ctx);
|
|
390
382
|
}
|
|
391
|
-
p.then(() => {
|
|
383
|
+
if (sharedConfig.context.async) p.then(() => {
|
|
392
384
|
track.loading = false;
|
|
393
385
|
notifySuspense(contexts);
|
|
394
386
|
});
|
|
@@ -421,15 +413,10 @@ function useTransition() {
|
|
|
421
413
|
function SuspenseList(props) {
|
|
422
414
|
return props.children;
|
|
423
415
|
}
|
|
424
|
-
const SUSPENSE_GLOBAL = Symbol("suspense-global");
|
|
425
416
|
function Suspense(props) {
|
|
426
417
|
const ctx = sharedConfig.context;
|
|
427
|
-
if (!ctx.async) return createComponent(() => {
|
|
428
|
-
props.children;
|
|
429
|
-
return props.fallback;
|
|
430
|
-
}, {});
|
|
431
418
|
const id = ctx.id + ctx.count;
|
|
432
|
-
const done = ctx.async ?
|
|
419
|
+
const done = ctx.async ? ctx.registerFragment(id) : () => {};
|
|
433
420
|
const o = Owner;
|
|
434
421
|
const value = ctx.suspense[id] || (ctx.suspense[id] = {
|
|
435
422
|
resources: new Map(),
|
|
@@ -458,40 +445,23 @@ function Suspense(props) {
|
|
|
458
445
|
done();
|
|
459
446
|
return res;
|
|
460
447
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
function awaitSuspense(fn) {
|
|
467
|
-
return new Promise(resolve => {
|
|
468
|
-
const registry = new Set();
|
|
469
|
-
const cache = Object.create(null);
|
|
470
|
-
const res = createMemo(() => {
|
|
471
|
-
Owner.context = {
|
|
472
|
-
[SUSPENSE_GLOBAL]: getCallback
|
|
473
|
-
};
|
|
474
|
-
return fn();
|
|
475
|
-
});
|
|
476
|
-
if (!registry.size) resolve(res());
|
|
477
|
-
function getCallback(key) {
|
|
478
|
-
registry.add(key);
|
|
479
|
-
return value => {
|
|
480
|
-
if (value) cache[key] = value;
|
|
481
|
-
registry.delete(key);
|
|
482
|
-
if (!registry.size) Promise.resolve().then(() => {
|
|
483
|
-
let source = resolveSSRNode(res());
|
|
484
|
-
let final = "";
|
|
485
|
-
let match;
|
|
486
|
-
while (match = source.match(SUSPENSE_REPLACE)) {
|
|
487
|
-
final += source.substring(0, match.index);
|
|
488
|
-
source = cache[match[1]] + source.substring(match.index + match[0].length);
|
|
489
|
-
}
|
|
490
|
-
resolve(final + source);
|
|
491
|
-
});
|
|
448
|
+
if (sharedConfig.context.async) {
|
|
449
|
+
if (sharedConfig.context.streaming) {
|
|
450
|
+
setHydrateContext(undefined);
|
|
451
|
+
const res = {
|
|
452
|
+
t: `<span id="pl${id}">${resolveSSRNode(props.fallback)}</span>`
|
|
492
453
|
};
|
|
454
|
+
setHydrateContext(ctx);
|
|
455
|
+
return res;
|
|
493
456
|
}
|
|
457
|
+
return {
|
|
458
|
+
t: `<![${id}]>`
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
setHydrateContext({ ...ctx,
|
|
462
|
+
count: 0
|
|
494
463
|
});
|
|
464
|
+
return createComponent(() => props.fallback, {});
|
|
495
465
|
}
|
|
496
466
|
|
|
497
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch,
|
|
467
|
+
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -184,18 +184,21 @@ function createSignal(value, options) {
|
|
|
184
184
|
pending: NOTPENDING,
|
|
185
185
|
comparator: options.equals || undefined
|
|
186
186
|
};
|
|
187
|
-
|
|
187
|
+
const setter = value => {
|
|
188
188
|
if (typeof value === "function") {
|
|
189
189
|
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.pending !== NOTPENDING ? s.pending : s.tValue);else value = value(s.pending !== NOTPENDING ? s.pending : s.value);
|
|
190
190
|
}
|
|
191
191
|
return writeSignal(s, value);
|
|
192
|
-
}
|
|
192
|
+
};
|
|
193
|
+
return [readSignal.bind(s), setter];
|
|
193
194
|
}
|
|
194
195
|
function createComputed(fn, value, options) {
|
|
195
|
-
|
|
196
|
+
const c = createComputation(fn, value, true, STALE);
|
|
197
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
196
198
|
}
|
|
197
199
|
function createRenderEffect(fn, value, options) {
|
|
198
|
-
|
|
200
|
+
const c = createComputation(fn, value, false, STALE);
|
|
201
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
199
202
|
}
|
|
200
203
|
function createEffect(fn, value, options) {
|
|
201
204
|
runEffects = runUserEffects;
|
|
@@ -212,7 +215,10 @@ function createMemo(fn, value, options) {
|
|
|
212
215
|
c.observers = null;
|
|
213
216
|
c.observerSlots = null;
|
|
214
217
|
c.comparator = options.equals || undefined;
|
|
215
|
-
|
|
218
|
+
if (Scheduler && Transition && Transition.running) {
|
|
219
|
+
c.tState = STALE;
|
|
220
|
+
Updates.push(c);
|
|
221
|
+
} else updateComputation(c);
|
|
216
222
|
return readSignal.bind(c);
|
|
217
223
|
}
|
|
218
224
|
function createResource(source, fetcher, options) {
|
|
@@ -241,12 +247,7 @@ function createResource(source, fetcher, options) {
|
|
|
241
247
|
dynamic = typeof source === "function";
|
|
242
248
|
if (sharedConfig.context) {
|
|
243
249
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
244
|
-
if (sharedConfig.
|
|
245
|
-
initP = sharedConfig.context.loadResource(id);
|
|
246
|
-
} else if (sharedConfig.resources && id && id in sharedConfig.resources) {
|
|
247
|
-
initP = sharedConfig.resources[id];
|
|
248
|
-
delete sharedConfig.resources[id];
|
|
249
|
-
}
|
|
250
|
+
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
250
251
|
}
|
|
251
252
|
function loadEnd(p, v, e) {
|
|
252
253
|
if (pr === p) {
|
|
@@ -350,7 +351,7 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
350
351
|
const subs = new Map();
|
|
351
352
|
const node = createComputation(p => {
|
|
352
353
|
const v = source();
|
|
353
|
-
for (const key of subs.keys()) if (fn(key, v)
|
|
354
|
+
for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
|
|
354
355
|
const l = subs.get(key);
|
|
355
356
|
for (const c of l.values()) {
|
|
356
357
|
c.state = STALE;
|
|
@@ -401,7 +402,8 @@ function untrack(fn) {
|
|
|
401
402
|
Listener = listener;
|
|
402
403
|
return result;
|
|
403
404
|
}
|
|
404
|
-
function on(deps, fn,
|
|
405
|
+
function on(deps, fn,
|
|
406
|
+
options) {
|
|
405
407
|
const isArray = Array.isArray(deps);
|
|
406
408
|
let prevInput;
|
|
407
409
|
let defer = options && options.defer;
|
|
@@ -654,7 +656,7 @@ function runTop(node) {
|
|
|
654
656
|
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
655
657
|
const updates = Updates;
|
|
656
658
|
Updates = null;
|
|
657
|
-
lookDownstream(node);
|
|
659
|
+
lookDownstream(node, ancestors[0]);
|
|
658
660
|
Updates = updates;
|
|
659
661
|
}
|
|
660
662
|
}
|
|
@@ -752,13 +754,15 @@ function runUserEffects(queue) {
|
|
|
752
754
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
753
755
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
754
756
|
}
|
|
755
|
-
function lookDownstream(node) {
|
|
757
|
+
function lookDownstream(node, ignore) {
|
|
756
758
|
node.state = 0;
|
|
757
759
|
const runningTransition = Transition && Transition.running;
|
|
758
760
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
759
761
|
const source = node.sources[i];
|
|
760
762
|
if (source.sources) {
|
|
761
|
-
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE)
|
|
763
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
764
|
+
if (source !== ignore) runTop(source);
|
|
765
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
|
|
762
766
|
}
|
|
763
767
|
}
|
|
764
768
|
}
|
|
@@ -1131,6 +1135,9 @@ function splitProps(props, ...keys) {
|
|
|
1131
1135
|
Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
|
|
1132
1136
|
get() {
|
|
1133
1137
|
return props[key];
|
|
1138
|
+
},
|
|
1139
|
+
set() {
|
|
1140
|
+
return true;
|
|
1134
1141
|
}
|
|
1135
1142
|
});
|
|
1136
1143
|
}
|
|
@@ -1153,7 +1160,7 @@ function lazy(fn) {
|
|
|
1153
1160
|
let comp;
|
|
1154
1161
|
const wrap = props => {
|
|
1155
1162
|
const ctx = sharedConfig.context;
|
|
1156
|
-
if (ctx
|
|
1163
|
+
if (ctx) {
|
|
1157
1164
|
ctx.count++;
|
|
1158
1165
|
const [s, set] = createSignal();
|
|
1159
1166
|
fn().then(mod => {
|
|
@@ -1226,7 +1233,7 @@ function Switch(props) {
|
|
|
1226
1233
|
}
|
|
1227
1234
|
return [-1];
|
|
1228
1235
|
}, undefined, {
|
|
1229
|
-
equals: (a, b) => a
|
|
1236
|
+
equals: (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]
|
|
1230
1237
|
});
|
|
1231
1238
|
return createMemo(() => {
|
|
1232
1239
|
const [index, when, cond] = evalConditions();
|
|
@@ -1320,7 +1327,10 @@ function SuspenseList(props) {
|
|
|
1320
1327
|
function Suspense(props) {
|
|
1321
1328
|
let counter = 0,
|
|
1322
1329
|
showContent,
|
|
1323
|
-
showFallback
|
|
1330
|
+
showFallback,
|
|
1331
|
+
ctx,
|
|
1332
|
+
waitingHydration,
|
|
1333
|
+
flicker;
|
|
1324
1334
|
const [inFallback, setFallback] = createSignal(false),
|
|
1325
1335
|
SuspenseContext = getSuspenseContext(),
|
|
1326
1336
|
store = {
|
|
@@ -1335,6 +1345,24 @@ function Suspense(props) {
|
|
|
1335
1345
|
resolved: false
|
|
1336
1346
|
},
|
|
1337
1347
|
owner = getOwner();
|
|
1348
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1349
|
+
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1350
|
+
const p = sharedConfig.load(key);
|
|
1351
|
+
if (p) {
|
|
1352
|
+
const [s, set] = createSignal(undefined, {
|
|
1353
|
+
equals: false
|
|
1354
|
+
});
|
|
1355
|
+
flicker = s;
|
|
1356
|
+
p.then(() => {
|
|
1357
|
+
sharedConfig.gather(key);
|
|
1358
|
+
waitingHydration = true;
|
|
1359
|
+
setHydrateContext(ctx);
|
|
1360
|
+
set();
|
|
1361
|
+
setHydrateContext(undefined);
|
|
1362
|
+
waitingHydration = false;
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1338
1366
|
const listContext = useContext(SuspenseListContext);
|
|
1339
1367
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1340
1368
|
let dispose;
|
|
@@ -1342,28 +1370,35 @@ function Suspense(props) {
|
|
|
1342
1370
|
return createComponent(SuspenseContext.Provider, {
|
|
1343
1371
|
value: store,
|
|
1344
1372
|
get children() {
|
|
1345
|
-
const rendered = untrack(() => props.children);
|
|
1346
1373
|
return createMemo(() => {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
if (!inFallback && visibleContent) {
|
|
1352
|
-
store.resolved = true;
|
|
1353
|
-
resumeEffects(store.effects);
|
|
1354
|
-
return rendered;
|
|
1374
|
+
if (flicker) {
|
|
1375
|
+
ctx = sharedConfig.context;
|
|
1376
|
+
flicker();
|
|
1377
|
+
return flicker = undefined;
|
|
1355
1378
|
}
|
|
1356
|
-
|
|
1357
|
-
return
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1379
|
+
const rendered = untrack(() => props.children);
|
|
1380
|
+
return createMemo(() => {
|
|
1381
|
+
const inFallback = store.inFallback(),
|
|
1382
|
+
visibleContent = showContent ? showContent() : true,
|
|
1383
|
+
visibleFallback = showFallback ? showFallback() : true;
|
|
1384
|
+
dispose && dispose();
|
|
1385
|
+
if ((!inFallback || waitingHydration) && visibleContent) {
|
|
1386
|
+
store.resolved = true;
|
|
1387
|
+
resumeEffects(store.effects);
|
|
1388
|
+
return rendered;
|
|
1389
|
+
}
|
|
1390
|
+
if (!visibleFallback) return;
|
|
1391
|
+
return createRoot(disposer => {
|
|
1392
|
+
dispose = disposer;
|
|
1393
|
+
if (sharedConfig.context) sharedConfig.context.count = 0;
|
|
1394
|
+
return props.fallback;
|
|
1395
|
+
}, owner);
|
|
1396
|
+
});
|
|
1361
1397
|
});
|
|
1362
1398
|
}
|
|
1363
1399
|
});
|
|
1364
1400
|
}
|
|
1365
1401
|
|
|
1366
|
-
function awaitSuspense() {}
|
|
1367
1402
|
let DEV;
|
|
1368
1403
|
|
|
1369
1404
|
exports.$PROXY = $PROXY;
|
|
@@ -1376,7 +1411,6 @@ exports.Show = Show;
|
|
|
1376
1411
|
exports.Suspense = Suspense;
|
|
1377
1412
|
exports.SuspenseList = SuspenseList;
|
|
1378
1413
|
exports.Switch = Switch;
|
|
1379
|
-
exports.awaitSuspense = awaitSuspense;
|
|
1380
1414
|
exports.batch = batch;
|
|
1381
1415
|
exports.cancelCallback = cancelCallback;
|
|
1382
1416
|
exports.children = children;
|
package/dist/solid.js
CHANGED
|
@@ -180,18 +180,21 @@ function createSignal(value, options) {
|
|
|
180
180
|
pending: NOTPENDING,
|
|
181
181
|
comparator: options.equals || undefined
|
|
182
182
|
};
|
|
183
|
-
|
|
183
|
+
const setter = value => {
|
|
184
184
|
if (typeof value === "function") {
|
|
185
185
|
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.pending !== NOTPENDING ? s.pending : s.tValue);else value = value(s.pending !== NOTPENDING ? s.pending : s.value);
|
|
186
186
|
}
|
|
187
187
|
return writeSignal(s, value);
|
|
188
|
-
}
|
|
188
|
+
};
|
|
189
|
+
return [readSignal.bind(s), setter];
|
|
189
190
|
}
|
|
190
191
|
function createComputed(fn, value, options) {
|
|
191
|
-
|
|
192
|
+
const c = createComputation(fn, value, true, STALE);
|
|
193
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
192
194
|
}
|
|
193
195
|
function createRenderEffect(fn, value, options) {
|
|
194
|
-
|
|
196
|
+
const c = createComputation(fn, value, false, STALE);
|
|
197
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
195
198
|
}
|
|
196
199
|
function createEffect(fn, value, options) {
|
|
197
200
|
runEffects = runUserEffects;
|
|
@@ -208,7 +211,10 @@ function createMemo(fn, value, options) {
|
|
|
208
211
|
c.observers = null;
|
|
209
212
|
c.observerSlots = null;
|
|
210
213
|
c.comparator = options.equals || undefined;
|
|
211
|
-
|
|
214
|
+
if (Scheduler && Transition && Transition.running) {
|
|
215
|
+
c.tState = STALE;
|
|
216
|
+
Updates.push(c);
|
|
217
|
+
} else updateComputation(c);
|
|
212
218
|
return readSignal.bind(c);
|
|
213
219
|
}
|
|
214
220
|
function createResource(source, fetcher, options) {
|
|
@@ -237,12 +243,7 @@ function createResource(source, fetcher, options) {
|
|
|
237
243
|
dynamic = typeof source === "function";
|
|
238
244
|
if (sharedConfig.context) {
|
|
239
245
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
240
|
-
if (sharedConfig.
|
|
241
|
-
initP = sharedConfig.context.loadResource(id);
|
|
242
|
-
} else if (sharedConfig.resources && id && id in sharedConfig.resources) {
|
|
243
|
-
initP = sharedConfig.resources[id];
|
|
244
|
-
delete sharedConfig.resources[id];
|
|
245
|
-
}
|
|
246
|
+
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
246
247
|
}
|
|
247
248
|
function loadEnd(p, v, e) {
|
|
248
249
|
if (pr === p) {
|
|
@@ -346,7 +347,7 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
346
347
|
const subs = new Map();
|
|
347
348
|
const node = createComputation(p => {
|
|
348
349
|
const v = source();
|
|
349
|
-
for (const key of subs.keys()) if (fn(key, v)
|
|
350
|
+
for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
|
|
350
351
|
const l = subs.get(key);
|
|
351
352
|
for (const c of l.values()) {
|
|
352
353
|
c.state = STALE;
|
|
@@ -397,7 +398,8 @@ function untrack(fn) {
|
|
|
397
398
|
Listener = listener;
|
|
398
399
|
return result;
|
|
399
400
|
}
|
|
400
|
-
function on(deps, fn,
|
|
401
|
+
function on(deps, fn,
|
|
402
|
+
options) {
|
|
401
403
|
const isArray = Array.isArray(deps);
|
|
402
404
|
let prevInput;
|
|
403
405
|
let defer = options && options.defer;
|
|
@@ -650,7 +652,7 @@ function runTop(node) {
|
|
|
650
652
|
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
651
653
|
const updates = Updates;
|
|
652
654
|
Updates = null;
|
|
653
|
-
lookDownstream(node);
|
|
655
|
+
lookDownstream(node, ancestors[0]);
|
|
654
656
|
Updates = updates;
|
|
655
657
|
}
|
|
656
658
|
}
|
|
@@ -748,13 +750,15 @@ function runUserEffects(queue) {
|
|
|
748
750
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
749
751
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
750
752
|
}
|
|
751
|
-
function lookDownstream(node) {
|
|
753
|
+
function lookDownstream(node, ignore) {
|
|
752
754
|
node.state = 0;
|
|
753
755
|
const runningTransition = Transition && Transition.running;
|
|
754
756
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
755
757
|
const source = node.sources[i];
|
|
756
758
|
if (source.sources) {
|
|
757
|
-
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE)
|
|
759
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
760
|
+
if (source !== ignore) runTop(source);
|
|
761
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
|
|
758
762
|
}
|
|
759
763
|
}
|
|
760
764
|
}
|
|
@@ -1127,6 +1131,9 @@ function splitProps(props, ...keys) {
|
|
|
1127
1131
|
Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
|
|
1128
1132
|
get() {
|
|
1129
1133
|
return props[key];
|
|
1134
|
+
},
|
|
1135
|
+
set() {
|
|
1136
|
+
return true;
|
|
1130
1137
|
}
|
|
1131
1138
|
});
|
|
1132
1139
|
}
|
|
@@ -1149,7 +1156,7 @@ function lazy(fn) {
|
|
|
1149
1156
|
let comp;
|
|
1150
1157
|
const wrap = props => {
|
|
1151
1158
|
const ctx = sharedConfig.context;
|
|
1152
|
-
if (ctx
|
|
1159
|
+
if (ctx) {
|
|
1153
1160
|
ctx.count++;
|
|
1154
1161
|
const [s, set] = createSignal();
|
|
1155
1162
|
fn().then(mod => {
|
|
@@ -1222,7 +1229,7 @@ function Switch(props) {
|
|
|
1222
1229
|
}
|
|
1223
1230
|
return [-1];
|
|
1224
1231
|
}, undefined, {
|
|
1225
|
-
equals: (a, b) => a
|
|
1232
|
+
equals: (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]
|
|
1226
1233
|
});
|
|
1227
1234
|
return createMemo(() => {
|
|
1228
1235
|
const [index, when, cond] = evalConditions();
|
|
@@ -1316,7 +1323,10 @@ function SuspenseList(props) {
|
|
|
1316
1323
|
function Suspense(props) {
|
|
1317
1324
|
let counter = 0,
|
|
1318
1325
|
showContent,
|
|
1319
|
-
showFallback
|
|
1326
|
+
showFallback,
|
|
1327
|
+
ctx,
|
|
1328
|
+
waitingHydration,
|
|
1329
|
+
flicker;
|
|
1320
1330
|
const [inFallback, setFallback] = createSignal(false),
|
|
1321
1331
|
SuspenseContext = getSuspenseContext(),
|
|
1322
1332
|
store = {
|
|
@@ -1331,6 +1341,24 @@ function Suspense(props) {
|
|
|
1331
1341
|
resolved: false
|
|
1332
1342
|
},
|
|
1333
1343
|
owner = getOwner();
|
|
1344
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1345
|
+
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1346
|
+
const p = sharedConfig.load(key);
|
|
1347
|
+
if (p) {
|
|
1348
|
+
const [s, set] = createSignal(undefined, {
|
|
1349
|
+
equals: false
|
|
1350
|
+
});
|
|
1351
|
+
flicker = s;
|
|
1352
|
+
p.then(() => {
|
|
1353
|
+
sharedConfig.gather(key);
|
|
1354
|
+
waitingHydration = true;
|
|
1355
|
+
setHydrateContext(ctx);
|
|
1356
|
+
set();
|
|
1357
|
+
setHydrateContext(undefined);
|
|
1358
|
+
waitingHydration = false;
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1334
1362
|
const listContext = useContext(SuspenseListContext);
|
|
1335
1363
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1336
1364
|
let dispose;
|
|
@@ -1338,28 +1366,35 @@ function Suspense(props) {
|
|
|
1338
1366
|
return createComponent(SuspenseContext.Provider, {
|
|
1339
1367
|
value: store,
|
|
1340
1368
|
get children() {
|
|
1341
|
-
const rendered = untrack(() => props.children);
|
|
1342
1369
|
return createMemo(() => {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
if (!inFallback && visibleContent) {
|
|
1348
|
-
store.resolved = true;
|
|
1349
|
-
resumeEffects(store.effects);
|
|
1350
|
-
return rendered;
|
|
1370
|
+
if (flicker) {
|
|
1371
|
+
ctx = sharedConfig.context;
|
|
1372
|
+
flicker();
|
|
1373
|
+
return flicker = undefined;
|
|
1351
1374
|
}
|
|
1352
|
-
|
|
1353
|
-
return
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1375
|
+
const rendered = untrack(() => props.children);
|
|
1376
|
+
return createMemo(() => {
|
|
1377
|
+
const inFallback = store.inFallback(),
|
|
1378
|
+
visibleContent = showContent ? showContent() : true,
|
|
1379
|
+
visibleFallback = showFallback ? showFallback() : true;
|
|
1380
|
+
dispose && dispose();
|
|
1381
|
+
if ((!inFallback || waitingHydration) && visibleContent) {
|
|
1382
|
+
store.resolved = true;
|
|
1383
|
+
resumeEffects(store.effects);
|
|
1384
|
+
return rendered;
|
|
1385
|
+
}
|
|
1386
|
+
if (!visibleFallback) return;
|
|
1387
|
+
return createRoot(disposer => {
|
|
1388
|
+
dispose = disposer;
|
|
1389
|
+
if (sharedConfig.context) sharedConfig.context.count = 0;
|
|
1390
|
+
return props.fallback;
|
|
1391
|
+
}, owner);
|
|
1392
|
+
});
|
|
1357
1393
|
});
|
|
1358
1394
|
}
|
|
1359
1395
|
});
|
|
1360
1396
|
}
|
|
1361
1397
|
|
|
1362
|
-
function awaitSuspense() {}
|
|
1363
1398
|
let DEV;
|
|
1364
1399
|
|
|
1365
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch,
|
|
1400
|
+
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/html/dist/html.cjs
CHANGED
|
@@ -358,7 +358,8 @@ function createHTML(r, {
|
|
|
358
358
|
childOptions = Object.assign({}, options, {
|
|
359
359
|
first: true,
|
|
360
360
|
decl: [],
|
|
361
|
-
exprs: []
|
|
361
|
+
exprs: [],
|
|
362
|
+
parent: false
|
|
362
363
|
});
|
|
363
364
|
parseNode(children, childOptions);
|
|
364
365
|
props.push(`children: () => { ${childOptions.exprs.join(";\n")}}`);
|
|
@@ -399,8 +400,8 @@ function createHTML(r, {
|
|
|
399
400
|
decl: [],
|
|
400
401
|
exprs: []
|
|
401
402
|
});
|
|
402
|
-
parseNode(child, childOptions);
|
|
403
403
|
options.templateNodes.push([child]);
|
|
404
|
+
parseNode(child, childOptions);
|
|
404
405
|
parts.push(`function() { ${childOptions.decl.join(",\n") + ";\n" + childOptions.exprs.join(";\n") + `;\nreturn _$el${id};\n`}}()`);
|
|
405
406
|
options.counter = childOptions.counter;
|
|
406
407
|
options.templateId = childOptions.templateId;
|
package/html/dist/html.js
CHANGED
|
@@ -356,7 +356,8 @@ function createHTML(r, {
|
|
|
356
356
|
childOptions = Object.assign({}, options, {
|
|
357
357
|
first: true,
|
|
358
358
|
decl: [],
|
|
359
|
-
exprs: []
|
|
359
|
+
exprs: [],
|
|
360
|
+
parent: false
|
|
360
361
|
});
|
|
361
362
|
parseNode(children, childOptions);
|
|
362
363
|
props.push(`children: () => { ${childOptions.exprs.join(";\n")}}`);
|
|
@@ -397,8 +398,8 @@ function createHTML(r, {
|
|
|
397
398
|
decl: [],
|
|
398
399
|
exprs: []
|
|
399
400
|
});
|
|
400
|
-
parseNode(child, childOptions);
|
|
401
401
|
options.templateNodes.push([child]);
|
|
402
|
+
parseNode(child, childOptions);
|
|
402
403
|
parts.push(`function() { ${childOptions.decl.join(",\n") + ";\n" + childOptions.exprs.join(";\n") + `;\nreturn _$el${id};\n`}}()`);
|
|
403
404
|
options.counter = childOptions.counter;
|
|
404
405
|
options.templateId = childOptions.templateId;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0-beta.1",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/solidjs/solid#readme",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"compiler",
|
|
133
133
|
"performance"
|
|
134
134
|
],
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "148c4c7d4f55842ec606364a972ce9abeb46c324"
|
|
136
136
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function wrap$1(value, name) {
|
|
|
31
31
|
return p;
|
|
32
32
|
}
|
|
33
33
|
function isWrappable(obj) {
|
|
34
|
-
return obj != null && typeof obj === "object" && (!obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
34
|
+
return obj != null && typeof obj === "object" && (obj[solidJs.$PROXY] || !obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
35
35
|
}
|
|
36
36
|
function unwrap(item, set = new Set()) {
|
|
37
37
|
let result, unwrapped, v, prop;
|
package/store/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $PROXY, DEV, getListener, batch, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
@@ -27,7 +27,7 @@ function wrap$1(value, name) {
|
|
|
27
27
|
return p;
|
|
28
28
|
}
|
|
29
29
|
function isWrappable(obj) {
|
|
30
|
-
return obj != null && typeof obj === "object" && (!obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
30
|
+
return obj != null && typeof obj === "object" && (obj[$PROXY] || !obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
31
31
|
}
|
|
32
32
|
function unwrap(item, set = new Set()) {
|
|
33
33
|
let result, unwrapped, v, prop;
|
package/store/dist/store.cjs
CHANGED
|
@@ -28,7 +28,7 @@ function wrap$1(value, name) {
|
|
|
28
28
|
return p;
|
|
29
29
|
}
|
|
30
30
|
function isWrappable(obj) {
|
|
31
|
-
return obj != null && typeof obj === "object" && (!obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
31
|
+
return obj != null && typeof obj === "object" && (obj[solidJs.$PROXY] || !obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
32
32
|
}
|
|
33
33
|
function unwrap(item, set = new Set()) {
|
|
34
34
|
let result, unwrapped, v, prop;
|
package/store/dist/store.js
CHANGED
|
@@ -24,7 +24,7 @@ function wrap$1(value, name) {
|
|
|
24
24
|
return p;
|
|
25
25
|
}
|
|
26
26
|
function isWrappable(obj) {
|
|
27
|
-
return obj != null && typeof obj === "object" && (!obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
27
|
+
return obj != null && typeof obj === "object" && (obj[$PROXY] || !obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj));
|
|
28
28
|
}
|
|
29
29
|
function unwrap(item, set = new Set()) {
|
|
30
30
|
let result, unwrapped, v, prop;
|
package/store/types/store.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare type Store<T> = {
|
|
|
33
33
|
} & {
|
|
34
34
|
[$RAW]?: T;
|
|
35
35
|
} & AddSymbolToPrimitive<T> & AddSymbolIterator<T> & AddSymbolToStringTag<T> & AddCallable<T>;
|
|
36
|
-
export declare function isWrappable(obj: any):
|
|
36
|
+
export declare function isWrappable(obj: any): any;
|
|
37
37
|
export declare function unwrap<T extends StoreNode>(item: any, set?: Set<unknown>): T;
|
|
38
38
|
export declare function getDataNodes(target: StoreNode): any;
|
|
39
39
|
export declare function proxyDescriptor(target: StoreNode, property: string | number | symbol): PropertyDescriptor | undefined;
|