solid-js 1.3.0-rc.1 → 1.3.0
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 +64 -35
- package/dist/dev.js +63 -36
- package/dist/server.cjs +13 -3
- package/dist/server.js +11 -4
- package/dist/solid.cjs +58 -34
- package/dist/solid.js +57 -35
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +1 -0
- package/types/reactive/signal.d.ts +27 -7
- package/types/server/index.d.ts +2 -2
- package/types/server/reactive.d.ts +2 -0
- package/types/server/rendering.d.ts +1 -0
- package/web/dist/dev.cjs +12 -36
- package/web/dist/server.cjs +24 -36
- package/web/dist/server.js +14 -6
- package/web/dist/web.cjs +12 -36
package/dist/dev.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
134
135
|
const signalOptions = {
|
|
135
136
|
equals: equalFn
|
|
136
137
|
};
|
|
@@ -169,14 +170,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
169
170
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
170
171
|
Owner = root;
|
|
171
172
|
Listener = null;
|
|
172
|
-
let result;
|
|
173
173
|
try {
|
|
174
|
-
runUpdates(() =>
|
|
174
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
175
175
|
} finally {
|
|
176
176
|
Listener = listener;
|
|
177
177
|
Owner = owner;
|
|
178
178
|
}
|
|
179
|
-
return result;
|
|
180
179
|
}
|
|
181
180
|
function createSignal(value, options) {
|
|
182
181
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -210,7 +209,21 @@ function createEffect(fn, value, options) {
|
|
|
210
209
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
211
210
|
if (s) c.suspense = s;
|
|
212
211
|
c.user = true;
|
|
213
|
-
Effects
|
|
212
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
213
|
+
}
|
|
214
|
+
function createReaction(onInvalidate, options) {
|
|
215
|
+
let fn;
|
|
216
|
+
const c = createComputation(() => {
|
|
217
|
+
fn ? fn() : untrack(onInvalidate);
|
|
218
|
+
fn = undefined;
|
|
219
|
+
}, undefined, false, 0, options ),
|
|
220
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
221
|
+
if (s) c.suspense = s;
|
|
222
|
+
c.user = true;
|
|
223
|
+
return tracking => {
|
|
224
|
+
fn = tracking;
|
|
225
|
+
updateComputation(c);
|
|
226
|
+
};
|
|
214
227
|
}
|
|
215
228
|
function createMemo(fn, value, options) {
|
|
216
229
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -236,11 +249,14 @@ function createResource(source, fetcher, options) {
|
|
|
236
249
|
fetcher = source;
|
|
237
250
|
source = true;
|
|
238
251
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
252
|
+
options ||= {};
|
|
253
|
+
if (options.globalRefetch !== false) {
|
|
254
|
+
Resources || (Resources = new Set());
|
|
255
|
+
Resources.add(load);
|
|
256
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
257
|
+
}
|
|
242
258
|
const contexts = new Set(),
|
|
243
|
-
[s, set] = createSignal(
|
|
259
|
+
[s, set] = createSignal(options.initialValue),
|
|
244
260
|
[track, trigger] = createSignal(undefined, {
|
|
245
261
|
equals: false
|
|
246
262
|
}),
|
|
@@ -256,10 +272,14 @@ function createResource(source, fetcher, options) {
|
|
|
256
272
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
257
273
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
258
274
|
}
|
|
259
|
-
function loadEnd(p, v, e) {
|
|
275
|
+
function loadEnd(p, v, e, key) {
|
|
260
276
|
if (pr === p) {
|
|
261
|
-
setError(err = e);
|
|
262
277
|
pr = null;
|
|
278
|
+
if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
|
|
279
|
+
value: v
|
|
280
|
+
});
|
|
281
|
+
initP = null;
|
|
282
|
+
setError(err = e);
|
|
263
283
|
if (Transition && p && loadedUnderTransition) {
|
|
264
284
|
Transition.promises.delete(p);
|
|
265
285
|
loadedUnderTransition = false;
|
|
@@ -313,17 +333,16 @@ function createResource(source, fetcher, options) {
|
|
|
313
333
|
value: s(),
|
|
314
334
|
refetching
|
|
315
335
|
}));
|
|
316
|
-
initP = null;
|
|
317
336
|
if (typeof p !== "object" || !("then" in p)) {
|
|
318
337
|
loadEnd(pr, p);
|
|
319
|
-
return;
|
|
338
|
+
return p;
|
|
320
339
|
}
|
|
321
340
|
pr = p;
|
|
322
341
|
batch(() => {
|
|
323
342
|
setLoading(true);
|
|
324
343
|
trigger();
|
|
325
344
|
});
|
|
326
|
-
p.then(v => loadEnd(p, v), e => loadEnd(p, e, e));
|
|
345
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, e, e));
|
|
327
346
|
}
|
|
328
347
|
Object.defineProperties(read, {
|
|
329
348
|
loading: {
|
|
@@ -345,7 +364,7 @@ function createResource(source, fetcher, options) {
|
|
|
345
364
|
}
|
|
346
365
|
let Resources;
|
|
347
366
|
function refetchResources(info) {
|
|
348
|
-
Resources && Resources.
|
|
367
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
349
368
|
}
|
|
350
369
|
function createDeferred(source, options) {
|
|
351
370
|
let t,
|
|
@@ -459,7 +478,7 @@ function runWithOwner(o, fn) {
|
|
|
459
478
|
const prev = Owner;
|
|
460
479
|
Owner = o;
|
|
461
480
|
try {
|
|
462
|
-
return fn
|
|
481
|
+
return runUpdates(fn, true);
|
|
463
482
|
} finally {
|
|
464
483
|
Owner = prev;
|
|
465
484
|
}
|
|
@@ -467,28 +486,31 @@ function runWithOwner(o, fn) {
|
|
|
467
486
|
function enableScheduling(scheduler = requestCallback) {
|
|
468
487
|
Scheduler = scheduler;
|
|
469
488
|
}
|
|
470
|
-
function startTransition(fn
|
|
489
|
+
function startTransition(fn) {
|
|
471
490
|
if (Transition && Transition.running) {
|
|
472
491
|
fn();
|
|
473
|
-
|
|
474
|
-
return;
|
|
492
|
+
return Transition.done;
|
|
475
493
|
}
|
|
476
|
-
|
|
494
|
+
const l = Listener;
|
|
495
|
+
const o = Owner;
|
|
496
|
+
return Promise.resolve().then(() => {
|
|
497
|
+
Listener = l;
|
|
498
|
+
Owner = o;
|
|
499
|
+
let t;
|
|
477
500
|
if (Scheduler || SuspenseContext) {
|
|
478
|
-
Transition || (Transition = {
|
|
501
|
+
t = Transition || (Transition = {
|
|
479
502
|
sources: new Set(),
|
|
480
503
|
effects: [],
|
|
481
504
|
promises: new Set(),
|
|
482
505
|
disposed: new Set(),
|
|
483
506
|
queue: new Set(),
|
|
484
|
-
running: true
|
|
485
|
-
cb: []
|
|
507
|
+
running: true
|
|
486
508
|
});
|
|
487
|
-
|
|
488
|
-
|
|
509
|
+
t.done ||= new Promise(res => t.resolve = res);
|
|
510
|
+
t.running = true;
|
|
489
511
|
}
|
|
490
512
|
batch(fn);
|
|
491
|
-
|
|
513
|
+
return t ? t.done : undefined;
|
|
492
514
|
});
|
|
493
515
|
}
|
|
494
516
|
function useTransition() {
|
|
@@ -499,7 +521,12 @@ function resumeEffects(e) {
|
|
|
499
521
|
e.length = 0;
|
|
500
522
|
}
|
|
501
523
|
function devComponent(Comp, props) {
|
|
502
|
-
const c = createComputation(() => untrack(() =>
|
|
524
|
+
const c = createComputation(() => untrack(() => {
|
|
525
|
+
Object.assign(Comp, {
|
|
526
|
+
[$DEVCOMP]: true
|
|
527
|
+
});
|
|
528
|
+
return Comp(props);
|
|
529
|
+
}), undefined, true);
|
|
503
530
|
c.pending = NOTPENDING;
|
|
504
531
|
c.observers = null;
|
|
505
532
|
c.observerSlots = null;
|
|
@@ -717,7 +744,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
717
744
|
});
|
|
718
745
|
const ordinary = ExternalSourceFactory(c.fn, trigger);
|
|
719
746
|
onCleanup(() => ordinary.dispose());
|
|
720
|
-
const triggerInTransition = () => startTransition(trigger
|
|
747
|
+
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
721
748
|
const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
|
|
722
749
|
c.fn = x => {
|
|
723
750
|
track();
|
|
@@ -762,7 +789,7 @@ function runUpdates(fn, init) {
|
|
|
762
789
|
if (Effects) wait = true;else Effects = [];
|
|
763
790
|
ExecCount++;
|
|
764
791
|
try {
|
|
765
|
-
fn();
|
|
792
|
+
return fn();
|
|
766
793
|
} catch (err) {
|
|
767
794
|
handleError(err);
|
|
768
795
|
} finally {
|
|
@@ -775,7 +802,7 @@ function completeUpdates(wait) {
|
|
|
775
802
|
Updates = null;
|
|
776
803
|
}
|
|
777
804
|
if (wait) return;
|
|
778
|
-
let
|
|
805
|
+
let res;
|
|
779
806
|
if (Transition && Transition.running) {
|
|
780
807
|
if (Transition.promises.size || Transition.queue.size) {
|
|
781
808
|
Transition.running = false;
|
|
@@ -785,7 +812,7 @@ function completeUpdates(wait) {
|
|
|
785
812
|
return;
|
|
786
813
|
}
|
|
787
814
|
const sources = Transition.sources;
|
|
788
|
-
|
|
815
|
+
res = Transition.resolve;
|
|
789
816
|
Effects.forEach(e => {
|
|
790
817
|
"tState" in e && (e.state = e.tState);
|
|
791
818
|
delete e.tState;
|
|
@@ -812,7 +839,7 @@ function completeUpdates(wait) {
|
|
|
812
839
|
Effects = null;
|
|
813
840
|
globalThis._$afterUpdate && globalThis._$afterUpdate();
|
|
814
841
|
}
|
|
815
|
-
if (
|
|
842
|
+
if (res) res();
|
|
816
843
|
}
|
|
817
844
|
function runQueue(queue) {
|
|
818
845
|
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
@@ -922,7 +949,7 @@ function handleError(err) {
|
|
|
922
949
|
fns.forEach(f => f(err));
|
|
923
950
|
}
|
|
924
951
|
function lookup(owner, key) {
|
|
925
|
-
return owner && (owner.context && owner.context[key]
|
|
952
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
926
953
|
}
|
|
927
954
|
function resolveChildren(children) {
|
|
928
955
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1295,9 +1322,9 @@ function lazy(fn) {
|
|
|
1295
1322
|
});
|
|
1296
1323
|
comp = s;
|
|
1297
1324
|
} else if (!comp) {
|
|
1298
|
-
const [s] = createResource((
|
|
1299
|
-
|
|
1300
|
-
})
|
|
1325
|
+
const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default), {
|
|
1326
|
+
globalRefetch: false
|
|
1327
|
+
});
|
|
1301
1328
|
comp = s;
|
|
1302
1329
|
} else {
|
|
1303
1330
|
const c = comp();
|
|
@@ -1554,6 +1581,7 @@ if (globalThis) {
|
|
|
1554
1581
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1555
1582
|
}
|
|
1556
1583
|
|
|
1584
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
1557
1585
|
exports.$PROXY = $PROXY;
|
|
1558
1586
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1559
1587
|
exports.For = For;
|
|
@@ -1572,6 +1600,7 @@ exports.createContext = createContext;
|
|
|
1572
1600
|
exports.createDeferred = createDeferred;
|
|
1573
1601
|
exports.createEffect = createEffect;
|
|
1574
1602
|
exports.createMemo = createMemo;
|
|
1603
|
+
exports.createReaction = createReaction;
|
|
1575
1604
|
exports.createRenderEffect = createRenderEffect;
|
|
1576
1605
|
exports.createResource = createResource;
|
|
1577
1606
|
exports.createRoot = createRoot;
|
package/dist/dev.js
CHANGED
|
@@ -127,6 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
130
131
|
const signalOptions = {
|
|
131
132
|
equals: equalFn
|
|
132
133
|
};
|
|
@@ -165,14 +166,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
165
166
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
166
167
|
Owner = root;
|
|
167
168
|
Listener = null;
|
|
168
|
-
let result;
|
|
169
169
|
try {
|
|
170
|
-
runUpdates(() =>
|
|
170
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
171
171
|
} finally {
|
|
172
172
|
Listener = listener;
|
|
173
173
|
Owner = owner;
|
|
174
174
|
}
|
|
175
|
-
return result;
|
|
176
175
|
}
|
|
177
176
|
function createSignal(value, options) {
|
|
178
177
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -206,7 +205,21 @@ function createEffect(fn, value, options) {
|
|
|
206
205
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
207
206
|
if (s) c.suspense = s;
|
|
208
207
|
c.user = true;
|
|
209
|
-
Effects
|
|
208
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
209
|
+
}
|
|
210
|
+
function createReaction(onInvalidate, options) {
|
|
211
|
+
let fn;
|
|
212
|
+
const c = createComputation(() => {
|
|
213
|
+
fn ? fn() : untrack(onInvalidate);
|
|
214
|
+
fn = undefined;
|
|
215
|
+
}, undefined, false, 0, options ),
|
|
216
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
217
|
+
if (s) c.suspense = s;
|
|
218
|
+
c.user = true;
|
|
219
|
+
return tracking => {
|
|
220
|
+
fn = tracking;
|
|
221
|
+
updateComputation(c);
|
|
222
|
+
};
|
|
210
223
|
}
|
|
211
224
|
function createMemo(fn, value, options) {
|
|
212
225
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -232,11 +245,14 @@ function createResource(source, fetcher, options) {
|
|
|
232
245
|
fetcher = source;
|
|
233
246
|
source = true;
|
|
234
247
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
options ||= {};
|
|
249
|
+
if (options.globalRefetch !== false) {
|
|
250
|
+
Resources || (Resources = new Set());
|
|
251
|
+
Resources.add(load);
|
|
252
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
253
|
+
}
|
|
238
254
|
const contexts = new Set(),
|
|
239
|
-
[s, set] = createSignal(
|
|
255
|
+
[s, set] = createSignal(options.initialValue),
|
|
240
256
|
[track, trigger] = createSignal(undefined, {
|
|
241
257
|
equals: false
|
|
242
258
|
}),
|
|
@@ -252,10 +268,14 @@ function createResource(source, fetcher, options) {
|
|
|
252
268
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
253
269
|
if (sharedConfig.load) initP = sharedConfig.load(id);
|
|
254
270
|
}
|
|
255
|
-
function loadEnd(p, v, e) {
|
|
271
|
+
function loadEnd(p, v, e, key) {
|
|
256
272
|
if (pr === p) {
|
|
257
|
-
setError(err = e);
|
|
258
273
|
pr = null;
|
|
274
|
+
if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
|
|
275
|
+
value: v
|
|
276
|
+
});
|
|
277
|
+
initP = null;
|
|
278
|
+
setError(err = e);
|
|
259
279
|
if (Transition && p && loadedUnderTransition) {
|
|
260
280
|
Transition.promises.delete(p);
|
|
261
281
|
loadedUnderTransition = false;
|
|
@@ -309,17 +329,16 @@ function createResource(source, fetcher, options) {
|
|
|
309
329
|
value: s(),
|
|
310
330
|
refetching
|
|
311
331
|
}));
|
|
312
|
-
initP = null;
|
|
313
332
|
if (typeof p !== "object" || !("then" in p)) {
|
|
314
333
|
loadEnd(pr, p);
|
|
315
|
-
return;
|
|
334
|
+
return p;
|
|
316
335
|
}
|
|
317
336
|
pr = p;
|
|
318
337
|
batch(() => {
|
|
319
338
|
setLoading(true);
|
|
320
339
|
trigger();
|
|
321
340
|
});
|
|
322
|
-
p.then(v => loadEnd(p, v), e => loadEnd(p, e, e));
|
|
341
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, e, e));
|
|
323
342
|
}
|
|
324
343
|
Object.defineProperties(read, {
|
|
325
344
|
loading: {
|
|
@@ -341,7 +360,7 @@ function createResource(source, fetcher, options) {
|
|
|
341
360
|
}
|
|
342
361
|
let Resources;
|
|
343
362
|
function refetchResources(info) {
|
|
344
|
-
Resources && Resources.
|
|
363
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
345
364
|
}
|
|
346
365
|
function createDeferred(source, options) {
|
|
347
366
|
let t,
|
|
@@ -455,7 +474,7 @@ function runWithOwner(o, fn) {
|
|
|
455
474
|
const prev = Owner;
|
|
456
475
|
Owner = o;
|
|
457
476
|
try {
|
|
458
|
-
return fn
|
|
477
|
+
return runUpdates(fn, true);
|
|
459
478
|
} finally {
|
|
460
479
|
Owner = prev;
|
|
461
480
|
}
|
|
@@ -463,28 +482,31 @@ function runWithOwner(o, fn) {
|
|
|
463
482
|
function enableScheduling(scheduler = requestCallback) {
|
|
464
483
|
Scheduler = scheduler;
|
|
465
484
|
}
|
|
466
|
-
function startTransition(fn
|
|
485
|
+
function startTransition(fn) {
|
|
467
486
|
if (Transition && Transition.running) {
|
|
468
487
|
fn();
|
|
469
|
-
|
|
470
|
-
return;
|
|
488
|
+
return Transition.done;
|
|
471
489
|
}
|
|
472
|
-
|
|
490
|
+
const l = Listener;
|
|
491
|
+
const o = Owner;
|
|
492
|
+
return Promise.resolve().then(() => {
|
|
493
|
+
Listener = l;
|
|
494
|
+
Owner = o;
|
|
495
|
+
let t;
|
|
473
496
|
if (Scheduler || SuspenseContext) {
|
|
474
|
-
Transition || (Transition = {
|
|
497
|
+
t = Transition || (Transition = {
|
|
475
498
|
sources: new Set(),
|
|
476
499
|
effects: [],
|
|
477
500
|
promises: new Set(),
|
|
478
501
|
disposed: new Set(),
|
|
479
502
|
queue: new Set(),
|
|
480
|
-
running: true
|
|
481
|
-
cb: []
|
|
503
|
+
running: true
|
|
482
504
|
});
|
|
483
|
-
|
|
484
|
-
|
|
505
|
+
t.done ||= new Promise(res => t.resolve = res);
|
|
506
|
+
t.running = true;
|
|
485
507
|
}
|
|
486
508
|
batch(fn);
|
|
487
|
-
|
|
509
|
+
return t ? t.done : undefined;
|
|
488
510
|
});
|
|
489
511
|
}
|
|
490
512
|
function useTransition() {
|
|
@@ -495,7 +517,12 @@ function resumeEffects(e) {
|
|
|
495
517
|
e.length = 0;
|
|
496
518
|
}
|
|
497
519
|
function devComponent(Comp, props) {
|
|
498
|
-
const c = createComputation(() => untrack(() =>
|
|
520
|
+
const c = createComputation(() => untrack(() => {
|
|
521
|
+
Object.assign(Comp, {
|
|
522
|
+
[$DEVCOMP]: true
|
|
523
|
+
});
|
|
524
|
+
return Comp(props);
|
|
525
|
+
}), undefined, true);
|
|
499
526
|
c.pending = NOTPENDING;
|
|
500
527
|
c.observers = null;
|
|
501
528
|
c.observerSlots = null;
|
|
@@ -713,7 +740,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
713
740
|
});
|
|
714
741
|
const ordinary = ExternalSourceFactory(c.fn, trigger);
|
|
715
742
|
onCleanup(() => ordinary.dispose());
|
|
716
|
-
const triggerInTransition = () => startTransition(trigger
|
|
743
|
+
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
717
744
|
const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
|
|
718
745
|
c.fn = x => {
|
|
719
746
|
track();
|
|
@@ -758,7 +785,7 @@ function runUpdates(fn, init) {
|
|
|
758
785
|
if (Effects) wait = true;else Effects = [];
|
|
759
786
|
ExecCount++;
|
|
760
787
|
try {
|
|
761
|
-
fn();
|
|
788
|
+
return fn();
|
|
762
789
|
} catch (err) {
|
|
763
790
|
handleError(err);
|
|
764
791
|
} finally {
|
|
@@ -771,7 +798,7 @@ function completeUpdates(wait) {
|
|
|
771
798
|
Updates = null;
|
|
772
799
|
}
|
|
773
800
|
if (wait) return;
|
|
774
|
-
let
|
|
801
|
+
let res;
|
|
775
802
|
if (Transition && Transition.running) {
|
|
776
803
|
if (Transition.promises.size || Transition.queue.size) {
|
|
777
804
|
Transition.running = false;
|
|
@@ -781,7 +808,7 @@ function completeUpdates(wait) {
|
|
|
781
808
|
return;
|
|
782
809
|
}
|
|
783
810
|
const sources = Transition.sources;
|
|
784
|
-
|
|
811
|
+
res = Transition.resolve;
|
|
785
812
|
Effects.forEach(e => {
|
|
786
813
|
"tState" in e && (e.state = e.tState);
|
|
787
814
|
delete e.tState;
|
|
@@ -808,7 +835,7 @@ function completeUpdates(wait) {
|
|
|
808
835
|
Effects = null;
|
|
809
836
|
globalThis._$afterUpdate && globalThis._$afterUpdate();
|
|
810
837
|
}
|
|
811
|
-
if (
|
|
838
|
+
if (res) res();
|
|
812
839
|
}
|
|
813
840
|
function runQueue(queue) {
|
|
814
841
|
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
@@ -918,7 +945,7 @@ function handleError(err) {
|
|
|
918
945
|
fns.forEach(f => f(err));
|
|
919
946
|
}
|
|
920
947
|
function lookup(owner, key) {
|
|
921
|
-
return owner && (owner.context && owner.context[key]
|
|
948
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
922
949
|
}
|
|
923
950
|
function resolveChildren(children) {
|
|
924
951
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1291,9 +1318,9 @@ function lazy(fn) {
|
|
|
1291
1318
|
});
|
|
1292
1319
|
comp = s;
|
|
1293
1320
|
} else if (!comp) {
|
|
1294
|
-
const [s] = createResource((
|
|
1295
|
-
|
|
1296
|
-
})
|
|
1321
|
+
const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default), {
|
|
1322
|
+
globalRefetch: false
|
|
1323
|
+
});
|
|
1297
1324
|
comp = s;
|
|
1298
1325
|
} else {
|
|
1299
1326
|
const c = comp();
|
|
@@ -1550,4 +1577,4 @@ if (globalThis) {
|
|
|
1550
1577
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1551
1578
|
}
|
|
1552
1579
|
|
|
1553
|
-
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, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1580
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/server.cjs
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const equalFn = (a, b) => a === b;
|
|
6
6
|
const $PROXY = Symbol("solid-proxy");
|
|
7
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
7
8
|
const DEV = {};
|
|
8
9
|
const ERROR = Symbol("error");
|
|
9
10
|
const UNOWNED = {
|
|
@@ -53,6 +54,11 @@ function createComputed(fn, value) {
|
|
|
53
54
|
}
|
|
54
55
|
const createRenderEffect = createComputed;
|
|
55
56
|
function createEffect(fn, value) {}
|
|
57
|
+
function createReaction(fn) {
|
|
58
|
+
return fn => {
|
|
59
|
+
fn();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
56
62
|
function createMemo(fn, value) {
|
|
57
63
|
Owner = {
|
|
58
64
|
owner: Owner,
|
|
@@ -130,7 +136,7 @@ function runWithOwner(o, fn) {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
function lookup(owner, key) {
|
|
133
|
-
return owner && (owner.context && owner.context[key]
|
|
139
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
134
140
|
}
|
|
135
141
|
function resolveChildren(children) {
|
|
136
142
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -381,7 +387,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
381
387
|
read.loading = true;
|
|
382
388
|
if ("then" in p) {
|
|
383
389
|
if (ctx.writeResource) ctx.writeResource(id, p);
|
|
384
|
-
p.then(res => {
|
|
390
|
+
return p.then(res => {
|
|
385
391
|
read.loading = false;
|
|
386
392
|
ctx.resources[id].data = res;
|
|
387
393
|
p = null;
|
|
@@ -393,10 +399,10 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
393
399
|
p = null;
|
|
394
400
|
notifySuspense(contexts);
|
|
395
401
|
});
|
|
396
|
-
return;
|
|
397
402
|
}
|
|
398
403
|
ctx.resources[id].data = p;
|
|
399
404
|
p = null;
|
|
405
|
+
return ctx.resources[id].data;
|
|
400
406
|
}
|
|
401
407
|
load();
|
|
402
408
|
return resource.ref = [read, {
|
|
@@ -442,6 +448,7 @@ function notifySuspense(contexts) {
|
|
|
442
448
|
contexts.clear();
|
|
443
449
|
}
|
|
444
450
|
function enableScheduling() {}
|
|
451
|
+
function enableHydration() {}
|
|
445
452
|
function startTransition(fn) {
|
|
446
453
|
fn();
|
|
447
454
|
}
|
|
@@ -508,6 +515,7 @@ function Suspense(props) {
|
|
|
508
515
|
return props.fallback;
|
|
509
516
|
}
|
|
510
517
|
|
|
518
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
511
519
|
exports.$PROXY = $PROXY;
|
|
512
520
|
exports.DEV = DEV;
|
|
513
521
|
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -526,6 +534,7 @@ exports.createContext = createContext;
|
|
|
526
534
|
exports.createDeferred = createDeferred;
|
|
527
535
|
exports.createEffect = createEffect;
|
|
528
536
|
exports.createMemo = createMemo;
|
|
537
|
+
exports.createReaction = createReaction;
|
|
529
538
|
exports.createRenderEffect = createRenderEffect;
|
|
530
539
|
exports.createResource = createResource;
|
|
531
540
|
exports.createRoot = createRoot;
|
|
@@ -533,6 +542,7 @@ exports.createSelector = createSelector;
|
|
|
533
542
|
exports.createSignal = createSignal;
|
|
534
543
|
exports.createUniqueId = createUniqueId;
|
|
535
544
|
exports.enableExternalSource = enableExternalSource;
|
|
545
|
+
exports.enableHydration = enableHydration;
|
|
536
546
|
exports.enableScheduling = enableScheduling;
|
|
537
547
|
exports.equalFn = equalFn;
|
|
538
548
|
exports.from = from;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const equalFn = (a, b) => a === b;
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
3
4
|
const DEV = {};
|
|
4
5
|
const ERROR = Symbol("error");
|
|
5
6
|
const UNOWNED = {
|
|
@@ -49,6 +50,11 @@ function createComputed(fn, value) {
|
|
|
49
50
|
}
|
|
50
51
|
const createRenderEffect = createComputed;
|
|
51
52
|
function createEffect(fn, value) {}
|
|
53
|
+
function createReaction(fn) {
|
|
54
|
+
return fn => {
|
|
55
|
+
fn();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
52
58
|
function createMemo(fn, value) {
|
|
53
59
|
Owner = {
|
|
54
60
|
owner: Owner,
|
|
@@ -126,7 +132,7 @@ function runWithOwner(o, fn) {
|
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
function lookup(owner, key) {
|
|
129
|
-
return owner && (owner.context && owner.context[key]
|
|
135
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
130
136
|
}
|
|
131
137
|
function resolveChildren(children) {
|
|
132
138
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -377,7 +383,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
377
383
|
read.loading = true;
|
|
378
384
|
if ("then" in p) {
|
|
379
385
|
if (ctx.writeResource) ctx.writeResource(id, p);
|
|
380
|
-
p.then(res => {
|
|
386
|
+
return p.then(res => {
|
|
381
387
|
read.loading = false;
|
|
382
388
|
ctx.resources[id].data = res;
|
|
383
389
|
p = null;
|
|
@@ -389,10 +395,10 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
389
395
|
p = null;
|
|
390
396
|
notifySuspense(contexts);
|
|
391
397
|
});
|
|
392
|
-
return;
|
|
393
398
|
}
|
|
394
399
|
ctx.resources[id].data = p;
|
|
395
400
|
p = null;
|
|
401
|
+
return ctx.resources[id].data;
|
|
396
402
|
}
|
|
397
403
|
load();
|
|
398
404
|
return resource.ref = [read, {
|
|
@@ -438,6 +444,7 @@ function notifySuspense(contexts) {
|
|
|
438
444
|
contexts.clear();
|
|
439
445
|
}
|
|
440
446
|
function enableScheduling() {}
|
|
447
|
+
function enableHydration() {}
|
|
441
448
|
function startTransition(fn) {
|
|
442
449
|
fn();
|
|
443
450
|
}
|
|
@@ -504,4 +511,4 @@ function Suspense(props) {
|
|
|
504
511
|
return props.fallback;
|
|
505
512
|
}
|
|
506
513
|
|
|
507
|
-
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, enableExternalSource, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
514
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|