solid-js 1.5.0 → 1.5.3
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 +20 -23
- package/dist/dev.js +20 -23
- package/dist/server.cjs +13 -10
- package/dist/server.js +13 -10
- package/dist/solid.cjs +20 -23
- package/dist/solid.js +20 -23
- package/h/jsx-runtime/package.json +8 -0
- package/h/jsx-runtime/types/jsx.d.ts +74 -73
- package/h/package.json +8 -0
- package/html/package.json +8 -0
- package/package.json +7 -1
- package/store/package.json +50 -0
- package/types/jsx.d.ts +37 -36
- package/types/reactive/signal.d.ts +5 -2
- package/types/server/rendering.d.ts +1 -1
- package/universal/package.json +24 -0
- package/web/dist/dev.cjs +3 -1
- package/web/dist/dev.js +3 -1
- package/web/dist/server.cjs +12 -9
- package/web/dist/server.js +12 -9
- package/web/dist/web.cjs +1 -1
- package/web/dist/web.js +1 -1
- package/web/package.json +50 -0
- package/web/types/client.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -255,8 +255,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
255
255
|
fetcher = pFetcher;
|
|
256
256
|
options = pOptions || {};
|
|
257
257
|
}
|
|
258
|
-
let
|
|
259
|
-
pr = null,
|
|
258
|
+
let pr = null,
|
|
260
259
|
initP = NO_INIT,
|
|
261
260
|
id = null,
|
|
262
261
|
loadedUnderTransition = false,
|
|
@@ -265,6 +264,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
265
264
|
dynamic = typeof source === "function" && createMemo(source);
|
|
266
265
|
const contexts = new Set(),
|
|
267
266
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
267
|
+
[error, setError] = createSignal(undefined),
|
|
268
268
|
[track, trigger] = createSignal(undefined, {
|
|
269
269
|
equals: false
|
|
270
270
|
}),
|
|
@@ -274,7 +274,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
274
274
|
let v;
|
|
275
275
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
276
276
|
}
|
|
277
|
-
function loadEnd(p, v,
|
|
277
|
+
function loadEnd(p, v, error, key) {
|
|
278
278
|
if (pr === p) {
|
|
279
279
|
pr = null;
|
|
280
280
|
resolved = true;
|
|
@@ -291,25 +291,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
291
291
|
Effects.push.apply(Effects, Transition.effects);
|
|
292
292
|
Transition.effects = [];
|
|
293
293
|
}
|
|
294
|
-
completeLoad(v,
|
|
294
|
+
completeLoad(v, error);
|
|
295
295
|
}, false);
|
|
296
|
-
} else completeLoad(v,
|
|
296
|
+
} else completeLoad(v, error);
|
|
297
297
|
}
|
|
298
298
|
return v;
|
|
299
299
|
}
|
|
300
|
-
function completeLoad(v,
|
|
301
|
-
!success && (err = castError(v));
|
|
300
|
+
function completeLoad(v, err) {
|
|
302
301
|
runUpdates(() => {
|
|
303
|
-
setValue(() => v);
|
|
304
|
-
|
|
302
|
+
if (!err) setValue(() => v);
|
|
303
|
+
setError(err);
|
|
304
|
+
setState(err ? "errored" : "ready");
|
|
305
305
|
for (const c of contexts.keys()) c.decrement();
|
|
306
306
|
contexts.clear();
|
|
307
307
|
}, false);
|
|
308
308
|
}
|
|
309
309
|
function read() {
|
|
310
310
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
311
|
-
v = value()
|
|
312
|
-
|
|
311
|
+
v = value(),
|
|
312
|
+
err = error();
|
|
313
|
+
if (err && !pr) throw err;
|
|
313
314
|
if (Listener && !Listener.user && c) {
|
|
314
315
|
createComputed(() => {
|
|
315
316
|
track();
|
|
@@ -326,11 +327,10 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
326
327
|
function load(refetching = true) {
|
|
327
328
|
if (refetching !== false && scheduled) return;
|
|
328
329
|
scheduled = false;
|
|
329
|
-
err = undefined;
|
|
330
330
|
const lookup = dynamic ? dynamic() : source;
|
|
331
331
|
loadedUnderTransition = Transition && Transition.running;
|
|
332
332
|
if (lookup == null || lookup === false) {
|
|
333
|
-
loadEnd(pr, untrack(value)
|
|
333
|
+
loadEnd(pr, untrack(value));
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
@@ -339,7 +339,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
339
339
|
refetching
|
|
340
340
|
}));
|
|
341
341
|
if (typeof p !== "object" || !("then" in p)) {
|
|
342
|
-
loadEnd(pr, p
|
|
342
|
+
loadEnd(pr, p);
|
|
343
343
|
return p;
|
|
344
344
|
}
|
|
345
345
|
pr = p;
|
|
@@ -349,27 +349,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
349
349
|
setState(resolved ? "refreshing" : "pending");
|
|
350
350
|
trigger();
|
|
351
351
|
}, false);
|
|
352
|
-
return p.then(v => loadEnd(p, v,
|
|
352
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e)));
|
|
353
353
|
}
|
|
354
354
|
Object.defineProperties(read, {
|
|
355
355
|
state: {
|
|
356
356
|
get: () => state()
|
|
357
357
|
},
|
|
358
|
+
error: {
|
|
359
|
+
get: () => error()
|
|
360
|
+
},
|
|
358
361
|
loading: {
|
|
359
362
|
get() {
|
|
360
363
|
const s = state();
|
|
361
364
|
return s === "pending" || s === "refreshing";
|
|
362
365
|
}
|
|
363
366
|
},
|
|
364
|
-
error: {
|
|
365
|
-
get() {
|
|
366
|
-
return state() === "errored" ? err : undefined;
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
367
|
latest: {
|
|
370
368
|
get() {
|
|
371
369
|
if (!resolved) return read();
|
|
372
|
-
|
|
370
|
+
const err = error();
|
|
371
|
+
if (err && !pr) throw err;
|
|
373
372
|
return value();
|
|
374
373
|
}
|
|
375
374
|
}
|
|
@@ -871,9 +870,7 @@ function runUserEffects(queue) {
|
|
|
871
870
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
872
871
|
}
|
|
873
872
|
if (sharedConfig.context) setHydrateContext();
|
|
874
|
-
Effects = [];
|
|
875
873
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
876
|
-
if (Effects.length) runUserEffects(Effects);
|
|
877
874
|
}
|
|
878
875
|
function lookUpstream(node, ignore) {
|
|
879
876
|
const runningTransition = Transition && Transition.running;
|
package/dist/dev.js
CHANGED
|
@@ -251,8 +251,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
251
251
|
fetcher = pFetcher;
|
|
252
252
|
options = pOptions || {};
|
|
253
253
|
}
|
|
254
|
-
let
|
|
255
|
-
pr = null,
|
|
254
|
+
let pr = null,
|
|
256
255
|
initP = NO_INIT,
|
|
257
256
|
id = null,
|
|
258
257
|
loadedUnderTransition = false,
|
|
@@ -261,6 +260,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
261
260
|
dynamic = typeof source === "function" && createMemo(source);
|
|
262
261
|
const contexts = new Set(),
|
|
263
262
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
263
|
+
[error, setError] = createSignal(undefined),
|
|
264
264
|
[track, trigger] = createSignal(undefined, {
|
|
265
265
|
equals: false
|
|
266
266
|
}),
|
|
@@ -270,7 +270,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
270
270
|
let v;
|
|
271
271
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
272
272
|
}
|
|
273
|
-
function loadEnd(p, v,
|
|
273
|
+
function loadEnd(p, v, error, key) {
|
|
274
274
|
if (pr === p) {
|
|
275
275
|
pr = null;
|
|
276
276
|
resolved = true;
|
|
@@ -287,25 +287,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
287
287
|
Effects.push.apply(Effects, Transition.effects);
|
|
288
288
|
Transition.effects = [];
|
|
289
289
|
}
|
|
290
|
-
completeLoad(v,
|
|
290
|
+
completeLoad(v, error);
|
|
291
291
|
}, false);
|
|
292
|
-
} else completeLoad(v,
|
|
292
|
+
} else completeLoad(v, error);
|
|
293
293
|
}
|
|
294
294
|
return v;
|
|
295
295
|
}
|
|
296
|
-
function completeLoad(v,
|
|
297
|
-
!success && (err = castError(v));
|
|
296
|
+
function completeLoad(v, err) {
|
|
298
297
|
runUpdates(() => {
|
|
299
|
-
setValue(() => v);
|
|
300
|
-
|
|
298
|
+
if (!err) setValue(() => v);
|
|
299
|
+
setError(err);
|
|
300
|
+
setState(err ? "errored" : "ready");
|
|
301
301
|
for (const c of contexts.keys()) c.decrement();
|
|
302
302
|
contexts.clear();
|
|
303
303
|
}, false);
|
|
304
304
|
}
|
|
305
305
|
function read() {
|
|
306
306
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
307
|
-
v = value()
|
|
308
|
-
|
|
307
|
+
v = value(),
|
|
308
|
+
err = error();
|
|
309
|
+
if (err && !pr) throw err;
|
|
309
310
|
if (Listener && !Listener.user && c) {
|
|
310
311
|
createComputed(() => {
|
|
311
312
|
track();
|
|
@@ -322,11 +323,10 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
322
323
|
function load(refetching = true) {
|
|
323
324
|
if (refetching !== false && scheduled) return;
|
|
324
325
|
scheduled = false;
|
|
325
|
-
err = undefined;
|
|
326
326
|
const lookup = dynamic ? dynamic() : source;
|
|
327
327
|
loadedUnderTransition = Transition && Transition.running;
|
|
328
328
|
if (lookup == null || lookup === false) {
|
|
329
|
-
loadEnd(pr, untrack(value)
|
|
329
|
+
loadEnd(pr, untrack(value));
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
@@ -335,7 +335,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
335
335
|
refetching
|
|
336
336
|
}));
|
|
337
337
|
if (typeof p !== "object" || !("then" in p)) {
|
|
338
|
-
loadEnd(pr, p
|
|
338
|
+
loadEnd(pr, p);
|
|
339
339
|
return p;
|
|
340
340
|
}
|
|
341
341
|
pr = p;
|
|
@@ -345,27 +345,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
345
345
|
setState(resolved ? "refreshing" : "pending");
|
|
346
346
|
trigger();
|
|
347
347
|
}, false);
|
|
348
|
-
return p.then(v => loadEnd(p, v,
|
|
348
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e)));
|
|
349
349
|
}
|
|
350
350
|
Object.defineProperties(read, {
|
|
351
351
|
state: {
|
|
352
352
|
get: () => state()
|
|
353
353
|
},
|
|
354
|
+
error: {
|
|
355
|
+
get: () => error()
|
|
356
|
+
},
|
|
354
357
|
loading: {
|
|
355
358
|
get() {
|
|
356
359
|
const s = state();
|
|
357
360
|
return s === "pending" || s === "refreshing";
|
|
358
361
|
}
|
|
359
362
|
},
|
|
360
|
-
error: {
|
|
361
|
-
get() {
|
|
362
|
-
return state() === "errored" ? err : undefined;
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
363
|
latest: {
|
|
366
364
|
get() {
|
|
367
365
|
if (!resolved) return read();
|
|
368
|
-
|
|
366
|
+
const err = error();
|
|
367
|
+
if (err && !pr) throw err;
|
|
369
368
|
return value();
|
|
370
369
|
}
|
|
371
370
|
}
|
|
@@ -867,9 +866,7 @@ function runUserEffects(queue) {
|
|
|
867
866
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
868
867
|
}
|
|
869
868
|
if (sharedConfig.context) setHydrateContext();
|
|
870
|
-
Effects = [];
|
|
871
869
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
872
|
-
if (Effects.length) runUserEffects(Effects);
|
|
873
870
|
}
|
|
874
871
|
function lookUpstream(node, ignore) {
|
|
875
872
|
const runningTransition = Transition && Transition.running;
|
package/dist/server.cjs
CHANGED
|
@@ -489,7 +489,6 @@ function lazy(fn) {
|
|
|
489
489
|
return p;
|
|
490
490
|
};
|
|
491
491
|
const contexts = new Set();
|
|
492
|
-
setTimeout(load);
|
|
493
492
|
const wrap = props => {
|
|
494
493
|
load();
|
|
495
494
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
@@ -503,21 +502,22 @@ function lazy(fn) {
|
|
|
503
502
|
ctx.resources.set(id, track);
|
|
504
503
|
contexts.add(ctx);
|
|
505
504
|
}
|
|
506
|
-
if (sharedConfig.context.async)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
505
|
+
if (sharedConfig.context.async) {
|
|
506
|
+
sharedConfig.context.block(p.then(() => {
|
|
507
|
+
track.loading = false;
|
|
508
|
+
notifySuspense(contexts);
|
|
509
|
+
}));
|
|
510
|
+
}
|
|
510
511
|
return "";
|
|
511
512
|
};
|
|
512
513
|
wrap.preload = load;
|
|
513
514
|
return wrap;
|
|
514
515
|
}
|
|
515
516
|
function suspenseComplete(c) {
|
|
516
|
-
if (c.complete) return true;
|
|
517
517
|
for (const r of c.resources.values()) {
|
|
518
518
|
if (r.loading) return false;
|
|
519
519
|
}
|
|
520
|
-
return
|
|
520
|
+
return true;
|
|
521
521
|
}
|
|
522
522
|
function notifySuspense(contexts) {
|
|
523
523
|
for (const c of contexts) {
|
|
@@ -556,8 +556,7 @@ function Suspense(props) {
|
|
|
556
556
|
if (suspenseComplete(value)) {
|
|
557
557
|
done(resolveSSRNode(res));
|
|
558
558
|
}
|
|
559
|
-
}
|
|
560
|
-
complete: false
|
|
559
|
+
}
|
|
561
560
|
});
|
|
562
561
|
function runSuspense() {
|
|
563
562
|
setHydrateContext({ ...ctx,
|
|
@@ -584,7 +583,11 @@ function Suspense(props) {
|
|
|
584
583
|
});
|
|
585
584
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
586
585
|
if (ctx.async) {
|
|
587
|
-
setHydrateContext(
|
|
586
|
+
setHydrateContext({ ...ctx,
|
|
587
|
+
count: 0,
|
|
588
|
+
id: ctx.id + "0.f",
|
|
589
|
+
noHydrate: true
|
|
590
|
+
});
|
|
588
591
|
const res = {
|
|
589
592
|
t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
|
|
590
593
|
};
|
package/dist/server.js
CHANGED
|
@@ -485,7 +485,6 @@ function lazy(fn) {
|
|
|
485
485
|
return p;
|
|
486
486
|
};
|
|
487
487
|
const contexts = new Set();
|
|
488
|
-
setTimeout(load);
|
|
489
488
|
const wrap = props => {
|
|
490
489
|
load();
|
|
491
490
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
@@ -499,21 +498,22 @@ function lazy(fn) {
|
|
|
499
498
|
ctx.resources.set(id, track);
|
|
500
499
|
contexts.add(ctx);
|
|
501
500
|
}
|
|
502
|
-
if (sharedConfig.context.async)
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
501
|
+
if (sharedConfig.context.async) {
|
|
502
|
+
sharedConfig.context.block(p.then(() => {
|
|
503
|
+
track.loading = false;
|
|
504
|
+
notifySuspense(contexts);
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
506
507
|
return "";
|
|
507
508
|
};
|
|
508
509
|
wrap.preload = load;
|
|
509
510
|
return wrap;
|
|
510
511
|
}
|
|
511
512
|
function suspenseComplete(c) {
|
|
512
|
-
if (c.complete) return true;
|
|
513
513
|
for (const r of c.resources.values()) {
|
|
514
514
|
if (r.loading) return false;
|
|
515
515
|
}
|
|
516
|
-
return
|
|
516
|
+
return true;
|
|
517
517
|
}
|
|
518
518
|
function notifySuspense(contexts) {
|
|
519
519
|
for (const c of contexts) {
|
|
@@ -552,8 +552,7 @@ function Suspense(props) {
|
|
|
552
552
|
if (suspenseComplete(value)) {
|
|
553
553
|
done(resolveSSRNode(res));
|
|
554
554
|
}
|
|
555
|
-
}
|
|
556
|
-
complete: false
|
|
555
|
+
}
|
|
557
556
|
});
|
|
558
557
|
function runSuspense() {
|
|
559
558
|
setHydrateContext({ ...ctx,
|
|
@@ -580,7 +579,11 @@ function Suspense(props) {
|
|
|
580
579
|
});
|
|
581
580
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
582
581
|
if (ctx.async) {
|
|
583
|
-
setHydrateContext(
|
|
582
|
+
setHydrateContext({ ...ctx,
|
|
583
|
+
count: 0,
|
|
584
|
+
id: ctx.id + "0.f",
|
|
585
|
+
noHydrate: true
|
|
586
|
+
});
|
|
584
587
|
const res = {
|
|
585
588
|
t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
|
|
586
589
|
};
|
package/dist/solid.cjs
CHANGED
|
@@ -247,8 +247,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
247
247
|
fetcher = pFetcher;
|
|
248
248
|
options = pOptions || {};
|
|
249
249
|
}
|
|
250
|
-
let
|
|
251
|
-
pr = null,
|
|
250
|
+
let pr = null,
|
|
252
251
|
initP = NO_INIT,
|
|
253
252
|
id = null,
|
|
254
253
|
loadedUnderTransition = false,
|
|
@@ -257,6 +256,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
257
256
|
dynamic = typeof source === "function" && createMemo(source);
|
|
258
257
|
const contexts = new Set(),
|
|
259
258
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
259
|
+
[error, setError] = createSignal(undefined),
|
|
260
260
|
[track, trigger] = createSignal(undefined, {
|
|
261
261
|
equals: false
|
|
262
262
|
}),
|
|
@@ -266,7 +266,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
266
266
|
let v;
|
|
267
267
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
268
268
|
}
|
|
269
|
-
function loadEnd(p, v,
|
|
269
|
+
function loadEnd(p, v, error, key) {
|
|
270
270
|
if (pr === p) {
|
|
271
271
|
pr = null;
|
|
272
272
|
resolved = true;
|
|
@@ -283,25 +283,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
283
283
|
Effects.push.apply(Effects, Transition.effects);
|
|
284
284
|
Transition.effects = [];
|
|
285
285
|
}
|
|
286
|
-
completeLoad(v,
|
|
286
|
+
completeLoad(v, error);
|
|
287
287
|
}, false);
|
|
288
|
-
} else completeLoad(v,
|
|
288
|
+
} else completeLoad(v, error);
|
|
289
289
|
}
|
|
290
290
|
return v;
|
|
291
291
|
}
|
|
292
|
-
function completeLoad(v,
|
|
293
|
-
!success && (err = castError(v));
|
|
292
|
+
function completeLoad(v, err) {
|
|
294
293
|
runUpdates(() => {
|
|
295
|
-
setValue(() => v);
|
|
296
|
-
|
|
294
|
+
if (!err) setValue(() => v);
|
|
295
|
+
setError(err);
|
|
296
|
+
setState(err ? "errored" : "ready");
|
|
297
297
|
for (const c of contexts.keys()) c.decrement();
|
|
298
298
|
contexts.clear();
|
|
299
299
|
}, false);
|
|
300
300
|
}
|
|
301
301
|
function read() {
|
|
302
302
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
303
|
-
v = value()
|
|
304
|
-
|
|
303
|
+
v = value(),
|
|
304
|
+
err = error();
|
|
305
|
+
if (err && !pr) throw err;
|
|
305
306
|
if (Listener && !Listener.user && c) {
|
|
306
307
|
createComputed(() => {
|
|
307
308
|
track();
|
|
@@ -318,11 +319,10 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
318
319
|
function load(refetching = true) {
|
|
319
320
|
if (refetching !== false && scheduled) return;
|
|
320
321
|
scheduled = false;
|
|
321
|
-
err = undefined;
|
|
322
322
|
const lookup = dynamic ? dynamic() : source;
|
|
323
323
|
loadedUnderTransition = Transition && Transition.running;
|
|
324
324
|
if (lookup == null || lookup === false) {
|
|
325
|
-
loadEnd(pr, untrack(value)
|
|
325
|
+
loadEnd(pr, untrack(value));
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
@@ -331,7 +331,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
331
331
|
refetching
|
|
332
332
|
}));
|
|
333
333
|
if (typeof p !== "object" || !("then" in p)) {
|
|
334
|
-
loadEnd(pr, p
|
|
334
|
+
loadEnd(pr, p);
|
|
335
335
|
return p;
|
|
336
336
|
}
|
|
337
337
|
pr = p;
|
|
@@ -341,27 +341,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
341
341
|
setState(resolved ? "refreshing" : "pending");
|
|
342
342
|
trigger();
|
|
343
343
|
}, false);
|
|
344
|
-
return p.then(v => loadEnd(p, v,
|
|
344
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e)));
|
|
345
345
|
}
|
|
346
346
|
Object.defineProperties(read, {
|
|
347
347
|
state: {
|
|
348
348
|
get: () => state()
|
|
349
349
|
},
|
|
350
|
+
error: {
|
|
351
|
+
get: () => error()
|
|
352
|
+
},
|
|
350
353
|
loading: {
|
|
351
354
|
get() {
|
|
352
355
|
const s = state();
|
|
353
356
|
return s === "pending" || s === "refreshing";
|
|
354
357
|
}
|
|
355
358
|
},
|
|
356
|
-
error: {
|
|
357
|
-
get() {
|
|
358
|
-
return state() === "errored" ? err : undefined;
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
359
|
latest: {
|
|
362
360
|
get() {
|
|
363
361
|
if (!resolved) return read();
|
|
364
|
-
|
|
362
|
+
const err = error();
|
|
363
|
+
if (err && !pr) throw err;
|
|
365
364
|
return value();
|
|
366
365
|
}
|
|
367
366
|
}
|
|
@@ -810,9 +809,7 @@ function runUserEffects(queue) {
|
|
|
810
809
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
811
810
|
}
|
|
812
811
|
if (sharedConfig.context) setHydrateContext();
|
|
813
|
-
Effects = [];
|
|
814
812
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
815
|
-
if (Effects.length) runUserEffects(Effects);
|
|
816
813
|
}
|
|
817
814
|
function lookUpstream(node, ignore) {
|
|
818
815
|
const runningTransition = Transition && Transition.running;
|
package/dist/solid.js
CHANGED
|
@@ -243,8 +243,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
243
243
|
fetcher = pFetcher;
|
|
244
244
|
options = pOptions || {};
|
|
245
245
|
}
|
|
246
|
-
let
|
|
247
|
-
pr = null,
|
|
246
|
+
let pr = null,
|
|
248
247
|
initP = NO_INIT,
|
|
249
248
|
id = null,
|
|
250
249
|
loadedUnderTransition = false,
|
|
@@ -253,6 +252,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
253
252
|
dynamic = typeof source === "function" && createMemo(source);
|
|
254
253
|
const contexts = new Set(),
|
|
255
254
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
255
|
+
[error, setError] = createSignal(undefined),
|
|
256
256
|
[track, trigger] = createSignal(undefined, {
|
|
257
257
|
equals: false
|
|
258
258
|
}),
|
|
@@ -262,7 +262,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
262
262
|
let v;
|
|
263
263
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
264
264
|
}
|
|
265
|
-
function loadEnd(p, v,
|
|
265
|
+
function loadEnd(p, v, error, key) {
|
|
266
266
|
if (pr === p) {
|
|
267
267
|
pr = null;
|
|
268
268
|
resolved = true;
|
|
@@ -279,25 +279,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
279
279
|
Effects.push.apply(Effects, Transition.effects);
|
|
280
280
|
Transition.effects = [];
|
|
281
281
|
}
|
|
282
|
-
completeLoad(v,
|
|
282
|
+
completeLoad(v, error);
|
|
283
283
|
}, false);
|
|
284
|
-
} else completeLoad(v,
|
|
284
|
+
} else completeLoad(v, error);
|
|
285
285
|
}
|
|
286
286
|
return v;
|
|
287
287
|
}
|
|
288
|
-
function completeLoad(v,
|
|
289
|
-
!success && (err = castError(v));
|
|
288
|
+
function completeLoad(v, err) {
|
|
290
289
|
runUpdates(() => {
|
|
291
|
-
setValue(() => v);
|
|
292
|
-
|
|
290
|
+
if (!err) setValue(() => v);
|
|
291
|
+
setError(err);
|
|
292
|
+
setState(err ? "errored" : "ready");
|
|
293
293
|
for (const c of contexts.keys()) c.decrement();
|
|
294
294
|
contexts.clear();
|
|
295
295
|
}, false);
|
|
296
296
|
}
|
|
297
297
|
function read() {
|
|
298
298
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
299
|
-
v = value()
|
|
300
|
-
|
|
299
|
+
v = value(),
|
|
300
|
+
err = error();
|
|
301
|
+
if (err && !pr) throw err;
|
|
301
302
|
if (Listener && !Listener.user && c) {
|
|
302
303
|
createComputed(() => {
|
|
303
304
|
track();
|
|
@@ -314,11 +315,10 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
314
315
|
function load(refetching = true) {
|
|
315
316
|
if (refetching !== false && scheduled) return;
|
|
316
317
|
scheduled = false;
|
|
317
|
-
err = undefined;
|
|
318
318
|
const lookup = dynamic ? dynamic() : source;
|
|
319
319
|
loadedUnderTransition = Transition && Transition.running;
|
|
320
320
|
if (lookup == null || lookup === false) {
|
|
321
|
-
loadEnd(pr, untrack(value)
|
|
321
|
+
loadEnd(pr, untrack(value));
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
@@ -327,7 +327,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
327
327
|
refetching
|
|
328
328
|
}));
|
|
329
329
|
if (typeof p !== "object" || !("then" in p)) {
|
|
330
|
-
loadEnd(pr, p
|
|
330
|
+
loadEnd(pr, p);
|
|
331
331
|
return p;
|
|
332
332
|
}
|
|
333
333
|
pr = p;
|
|
@@ -337,27 +337,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
337
337
|
setState(resolved ? "refreshing" : "pending");
|
|
338
338
|
trigger();
|
|
339
339
|
}, false);
|
|
340
|
-
return p.then(v => loadEnd(p, v,
|
|
340
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e)));
|
|
341
341
|
}
|
|
342
342
|
Object.defineProperties(read, {
|
|
343
343
|
state: {
|
|
344
344
|
get: () => state()
|
|
345
345
|
},
|
|
346
|
+
error: {
|
|
347
|
+
get: () => error()
|
|
348
|
+
},
|
|
346
349
|
loading: {
|
|
347
350
|
get() {
|
|
348
351
|
const s = state();
|
|
349
352
|
return s === "pending" || s === "refreshing";
|
|
350
353
|
}
|
|
351
354
|
},
|
|
352
|
-
error: {
|
|
353
|
-
get() {
|
|
354
|
-
return state() === "errored" ? err : undefined;
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
355
|
latest: {
|
|
358
356
|
get() {
|
|
359
357
|
if (!resolved) return read();
|
|
360
|
-
|
|
358
|
+
const err = error();
|
|
359
|
+
if (err && !pr) throw err;
|
|
361
360
|
return value();
|
|
362
361
|
}
|
|
363
362
|
}
|
|
@@ -806,9 +805,7 @@ function runUserEffects(queue) {
|
|
|
806
805
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
807
806
|
}
|
|
808
807
|
if (sharedConfig.context) setHydrateContext();
|
|
809
|
-
Effects = [];
|
|
810
808
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
811
|
-
if (Effects.length) runUserEffects(Effects);
|
|
812
809
|
}
|
|
813
810
|
function lookUpstream(node, ignore) {
|
|
814
811
|
const runningTransition = Transition && Transition.running;
|
|
@@ -283,9 +283,10 @@ export namespace JSX {
|
|
|
283
283
|
onanimationiteration?: EventHandlerUnion<T, AnimationEvent>;
|
|
284
284
|
ontransitionend?: EventHandlerUnion<T, TransitionEvent>;
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
interface CSSProperties extends csstype.PropertiesHyphen {
|
|
288
288
|
// Override
|
|
289
|
+
[key: `-${string}`]: string | number | undefined
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
|
|
@@ -527,6 +528,77 @@ export namespace JSX {
|
|
|
527
528
|
"aria-valuenow"?: number | string;
|
|
528
529
|
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
|
529
530
|
"aria-valuetext"?: string;
|
|
531
|
+
role?: FunctionMaybe<
|
|
532
|
+
| "alert"
|
|
533
|
+
| "alertdialog"
|
|
534
|
+
| "application"
|
|
535
|
+
| "article"
|
|
536
|
+
| "banner"
|
|
537
|
+
| "button"
|
|
538
|
+
| "cell"
|
|
539
|
+
| "checkbox"
|
|
540
|
+
| "columnheader"
|
|
541
|
+
| "combobox"
|
|
542
|
+
| "complementary"
|
|
543
|
+
| "contentinfo"
|
|
544
|
+
| "definition"
|
|
545
|
+
| "dialog"
|
|
546
|
+
| "directory"
|
|
547
|
+
| "document"
|
|
548
|
+
| "feed"
|
|
549
|
+
| "figure"
|
|
550
|
+
| "form"
|
|
551
|
+
| "grid"
|
|
552
|
+
| "gridcell"
|
|
553
|
+
| "group"
|
|
554
|
+
| "heading"
|
|
555
|
+
| "img"
|
|
556
|
+
| "link"
|
|
557
|
+
| "list"
|
|
558
|
+
| "listbox"
|
|
559
|
+
| "listitem"
|
|
560
|
+
| "log"
|
|
561
|
+
| "main"
|
|
562
|
+
| "marquee"
|
|
563
|
+
| "math"
|
|
564
|
+
| "menu"
|
|
565
|
+
| "menubar"
|
|
566
|
+
| "menuitem"
|
|
567
|
+
| "menuitemcheckbox"
|
|
568
|
+
| "menuitemradio"
|
|
569
|
+
| "meter"
|
|
570
|
+
| "navigation"
|
|
571
|
+
| "none"
|
|
572
|
+
| "note"
|
|
573
|
+
| "option"
|
|
574
|
+
| "presentation"
|
|
575
|
+
| "progressbar"
|
|
576
|
+
| "radio"
|
|
577
|
+
| "radiogroup"
|
|
578
|
+
| "region"
|
|
579
|
+
| "row"
|
|
580
|
+
| "rowgroup"
|
|
581
|
+
| "rowheader"
|
|
582
|
+
| "scrollbar"
|
|
583
|
+
| "search"
|
|
584
|
+
| "searchbox"
|
|
585
|
+
| "separator"
|
|
586
|
+
| "slider"
|
|
587
|
+
| "spinbutton"
|
|
588
|
+
| "status"
|
|
589
|
+
| "switch"
|
|
590
|
+
| "tab"
|
|
591
|
+
| "table"
|
|
592
|
+
| "tablist"
|
|
593
|
+
| "tabpanel"
|
|
594
|
+
| "term"
|
|
595
|
+
| "textbox"
|
|
596
|
+
| "timer"
|
|
597
|
+
| "toolbar"
|
|
598
|
+
| "tooltip"
|
|
599
|
+
| "tree"
|
|
600
|
+
| "treegrid"
|
|
601
|
+
| "treeitem">;
|
|
530
602
|
}
|
|
531
603
|
|
|
532
604
|
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
@@ -552,77 +624,6 @@ export namespace JSX {
|
|
|
552
624
|
resource?: FunctionMaybe<string>;
|
|
553
625
|
typeof?: FunctionMaybe<string>;
|
|
554
626
|
vocab?: FunctionMaybe<string>;
|
|
555
|
-
role?: FunctionMaybe<
|
|
556
|
-
| "alert"
|
|
557
|
-
| "alertdialog"
|
|
558
|
-
| "application"
|
|
559
|
-
| "article"
|
|
560
|
-
| "banner"
|
|
561
|
-
| "button"
|
|
562
|
-
| "cell"
|
|
563
|
-
| "checkbox"
|
|
564
|
-
| "columnheader"
|
|
565
|
-
| "combobox"
|
|
566
|
-
| "complementary"
|
|
567
|
-
| "contentinfo"
|
|
568
|
-
| "definition"
|
|
569
|
-
| "dialog"
|
|
570
|
-
| "directory"
|
|
571
|
-
| "document"
|
|
572
|
-
| "feed"
|
|
573
|
-
| "figure"
|
|
574
|
-
| "form"
|
|
575
|
-
| "grid"
|
|
576
|
-
| "gridcell"
|
|
577
|
-
| "group"
|
|
578
|
-
| "heading"
|
|
579
|
-
| "img"
|
|
580
|
-
| "link"
|
|
581
|
-
| "list"
|
|
582
|
-
| "listbox"
|
|
583
|
-
| "listitem"
|
|
584
|
-
| "log"
|
|
585
|
-
| "main"
|
|
586
|
-
| "marquee"
|
|
587
|
-
| "math"
|
|
588
|
-
| "menu"
|
|
589
|
-
| "menubar"
|
|
590
|
-
| "menuitem"
|
|
591
|
-
| "menuitemcheckbox"
|
|
592
|
-
| "menuitemradio"
|
|
593
|
-
| "meter"
|
|
594
|
-
| "navigation"
|
|
595
|
-
| "none"
|
|
596
|
-
| "note"
|
|
597
|
-
| "option"
|
|
598
|
-
| "presentation"
|
|
599
|
-
| "progressbar"
|
|
600
|
-
| "radio"
|
|
601
|
-
| "radiogroup"
|
|
602
|
-
| "region"
|
|
603
|
-
| "row"
|
|
604
|
-
| "rowgroup"
|
|
605
|
-
| "rowheader"
|
|
606
|
-
| "scrollbar"
|
|
607
|
-
| "search"
|
|
608
|
-
| "searchbox"
|
|
609
|
-
| "separator"
|
|
610
|
-
| "slider"
|
|
611
|
-
| "spinbutton"
|
|
612
|
-
| "status"
|
|
613
|
-
| "switch"
|
|
614
|
-
| "tab"
|
|
615
|
-
| "table"
|
|
616
|
-
| "tablist"
|
|
617
|
-
| "tabpanel"
|
|
618
|
-
| "term"
|
|
619
|
-
| "textbox"
|
|
620
|
-
| "timer"
|
|
621
|
-
| "toolbar"
|
|
622
|
-
| "tooltip"
|
|
623
|
-
| "tree"
|
|
624
|
-
| "treegrid"
|
|
625
|
-
| "treeitem">;
|
|
626
627
|
autocapitalize?: FunctionMaybe<HTMLAutocapitalize>;
|
|
627
628
|
slot?: FunctionMaybe<string>;
|
|
628
629
|
color?: FunctionMaybe<string>;
|
|
@@ -1082,7 +1083,7 @@ export namespace JSX {
|
|
|
1082
1083
|
| "defer xMidYMax slice"
|
|
1083
1084
|
| "defer xMaxYMax slice";
|
|
1084
1085
|
type SVGUnits = "userSpaceOnUse" | "objectBoundingBox";
|
|
1085
|
-
interface CoreSVGAttributes<T> extends DOMAttributes<T> {
|
|
1086
|
+
interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
1086
1087
|
id?: FunctionMaybe<string>;
|
|
1087
1088
|
lang?: FunctionMaybe<string>;
|
|
1088
1089
|
tabIndex?: FunctionMaybe<number | string>;
|
package/h/package.json
ADDED
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.5.
|
|
4
|
+
"version": "1.5.3",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -23,16 +23,22 @@
|
|
|
23
23
|
"dist",
|
|
24
24
|
"store/dist",
|
|
25
25
|
"store/types",
|
|
26
|
+
"store/package.json",
|
|
26
27
|
"web/dist",
|
|
27
28
|
"web/types",
|
|
29
|
+
"web/package.json",
|
|
28
30
|
"h/dist",
|
|
29
31
|
"h/types",
|
|
32
|
+
"h/package.json",
|
|
30
33
|
"h/jsx-runtime/dist",
|
|
31
34
|
"h/jsx-runtime/types",
|
|
35
|
+
"h/jsx-runtime/package.json",
|
|
32
36
|
"html/dist",
|
|
33
37
|
"html/types",
|
|
38
|
+
"html/package.json",
|
|
34
39
|
"universal/dist",
|
|
35
40
|
"universal/types",
|
|
41
|
+
"universal/package.json",
|
|
36
42
|
"types",
|
|
37
43
|
"jsx-runtime.d.ts"
|
|
38
44
|
],
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solid-js/store",
|
|
3
|
+
"main": "./dist/server.cjs",
|
|
4
|
+
"module": "./dist/server.js",
|
|
5
|
+
"browser": {
|
|
6
|
+
"./dist/server.cjs": "./dist/store.cjs",
|
|
7
|
+
"./dist/server.js": "./dist/store.js"
|
|
8
|
+
},
|
|
9
|
+
"unpkg": "./dist/store.cjs",
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./types/index.d.ts",
|
|
19
|
+
"default": "./dist/dev.js"
|
|
20
|
+
},
|
|
21
|
+
"require": "./dist/dev.cjs"
|
|
22
|
+
},
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./types/index.d.ts",
|
|
25
|
+
"default": "./dist/store.js"
|
|
26
|
+
},
|
|
27
|
+
"require": "./dist/store.cjs"
|
|
28
|
+
},
|
|
29
|
+
"node": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./types/index.d.ts",
|
|
32
|
+
"default": "./dist/server.js"
|
|
33
|
+
},
|
|
34
|
+
"require": "./dist/server.cjs"
|
|
35
|
+
},
|
|
36
|
+
"development": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./types/index.d.ts",
|
|
39
|
+
"default": "./dist/dev.js"
|
|
40
|
+
},
|
|
41
|
+
"require": "./dist/dev.cjs"
|
|
42
|
+
},
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./types/index.d.ts",
|
|
45
|
+
"default": "./dist/store.js"
|
|
46
|
+
},
|
|
47
|
+
"require": "./dist/store.cjs"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/types/jsx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as csstype from 'csstype
|
|
1
|
+
import * as csstype from 'csstype';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Based on JSX types for Surplus and Inferno and adapted for `dom-expressions`.
|
|
@@ -285,6 +285,7 @@ export namespace JSX {
|
|
|
285
285
|
|
|
286
286
|
interface CSSProperties extends csstype.PropertiesHyphen {
|
|
287
287
|
// Override
|
|
288
|
+
[key: `-${string}`]: string | number | undefined
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
|
|
@@ -526,40 +527,6 @@ export namespace JSX {
|
|
|
526
527
|
"aria-valuenow"?: number | string;
|
|
527
528
|
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
|
528
529
|
"aria-valuetext"?: string;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// TODO: Should we allow this?
|
|
532
|
-
// type ClassKeys = `class:${string}`;
|
|
533
|
-
// type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
|
|
534
|
-
|
|
535
|
-
// type CSSAttributes = {
|
|
536
|
-
// [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
|
|
537
|
-
// };
|
|
538
|
-
|
|
539
|
-
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
540
|
-
// [key: ClassKeys]: boolean;
|
|
541
|
-
accessKey?: string;
|
|
542
|
-
class?: string;
|
|
543
|
-
contenteditable?: boolean | "inherit";
|
|
544
|
-
contextmenu?: string;
|
|
545
|
-
dir?: HTMLDir;
|
|
546
|
-
draggable?: boolean;
|
|
547
|
-
hidden?: boolean;
|
|
548
|
-
id?: string;
|
|
549
|
-
lang?: string;
|
|
550
|
-
spellcheck?: boolean;
|
|
551
|
-
style?: CSSProperties | string;
|
|
552
|
-
tabindex?: number | string;
|
|
553
|
-
title?: string;
|
|
554
|
-
translate?: "yes" | "no";
|
|
555
|
-
about?: string;
|
|
556
|
-
datatype?: string;
|
|
557
|
-
inlist?: any;
|
|
558
|
-
prefix?: string;
|
|
559
|
-
property?: string;
|
|
560
|
-
resource?: string;
|
|
561
|
-
typeof?: string;
|
|
562
|
-
vocab?: string;
|
|
563
530
|
role?:
|
|
564
531
|
| "alert"
|
|
565
532
|
| "alertdialog"
|
|
@@ -631,6 +598,40 @@ export namespace JSX {
|
|
|
631
598
|
| "tree"
|
|
632
599
|
| "treegrid"
|
|
633
600
|
| "treeitem";
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// TODO: Should we allow this?
|
|
604
|
+
// type ClassKeys = `class:${string}`;
|
|
605
|
+
// type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
|
|
606
|
+
|
|
607
|
+
// type CSSAttributes = {
|
|
608
|
+
// [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
|
|
609
|
+
// };
|
|
610
|
+
|
|
611
|
+
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
612
|
+
// [key: ClassKeys]: boolean;
|
|
613
|
+
accessKey?: string;
|
|
614
|
+
class?: string;
|
|
615
|
+
contenteditable?: boolean | "inherit";
|
|
616
|
+
contextmenu?: string;
|
|
617
|
+
dir?: HTMLDir;
|
|
618
|
+
draggable?: boolean;
|
|
619
|
+
hidden?: boolean;
|
|
620
|
+
id?: string;
|
|
621
|
+
lang?: string;
|
|
622
|
+
spellcheck?: boolean;
|
|
623
|
+
style?: CSSProperties | string;
|
|
624
|
+
tabindex?: number | string;
|
|
625
|
+
title?: string;
|
|
626
|
+
translate?: "yes" | "no";
|
|
627
|
+
about?: string;
|
|
628
|
+
datatype?: string;
|
|
629
|
+
inlist?: any;
|
|
630
|
+
prefix?: string;
|
|
631
|
+
property?: string;
|
|
632
|
+
resource?: string;
|
|
633
|
+
typeof?: string;
|
|
634
|
+
vocab?: string;
|
|
634
635
|
autocapitalize?: HTMLAutocapitalize;
|
|
635
636
|
slot?: string;
|
|
636
637
|
color?: string;
|
|
@@ -1090,7 +1091,7 @@ export namespace JSX {
|
|
|
1090
1091
|
| "defer xMidYMax slice"
|
|
1091
1092
|
| "defer xMaxYMax slice";
|
|
1092
1093
|
type SVGUnits = "userSpaceOnUse" | "objectBoundingBox";
|
|
1093
|
-
interface CoreSVGAttributes<T> extends DOMAttributes<T> {
|
|
1094
|
+
interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
1094
1095
|
id?: string;
|
|
1095
1096
|
lang?: string;
|
|
1096
1097
|
tabIndex?: number | string;
|
|
@@ -234,7 +234,7 @@ interface Errored {
|
|
|
234
234
|
export declare type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
235
235
|
export declare type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
236
236
|
export declare type ResourceActions<T, R = unknown> = {
|
|
237
|
-
mutate: Setter<T
|
|
237
|
+
mutate: Setter<T>;
|
|
238
238
|
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
239
239
|
};
|
|
240
240
|
export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
@@ -256,7 +256,10 @@ export declare type ResourceOptions<T, S = unknown> = {
|
|
|
256
256
|
export declare type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
257
257
|
initialValue: T;
|
|
258
258
|
};
|
|
259
|
-
export declare type ResourceReturn<T, R = unknown> = [
|
|
259
|
+
export declare type ResourceReturn<T, R = unknown> = [
|
|
260
|
+
Resource<T>,
|
|
261
|
+
ResourceActions<T | undefined, R>
|
|
262
|
+
];
|
|
260
263
|
export declare type InitializedResourceReturn<T, R = unknown> = [
|
|
261
264
|
InitializedResource<T>,
|
|
262
265
|
ResourceActions<T, R>
|
|
@@ -82,7 +82,6 @@ declare type SuspenseContextType = {
|
|
|
82
82
|
loading: boolean;
|
|
83
83
|
error: any;
|
|
84
84
|
}>;
|
|
85
|
-
complete: boolean;
|
|
86
85
|
completed: () => void;
|
|
87
86
|
};
|
|
88
87
|
export declare type ResourceActions<T> = {
|
|
@@ -131,6 +130,7 @@ declare type HydrationContext = {
|
|
|
131
130
|
count: number;
|
|
132
131
|
writeResource: (id: string, v: Promise<any> | any, error?: boolean, deferStream?: boolean) => void;
|
|
133
132
|
replace: (id: string, replacement: () => any) => void;
|
|
133
|
+
block: (p: Promise<any>) => void;
|
|
134
134
|
resources: Record<string, any>;
|
|
135
135
|
suspense: Record<string, SuspenseContextType>;
|
|
136
136
|
registerFragment: (v: string) => (v?: string, err?: any) => boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solid-js/universal",
|
|
3
|
+
"main": "./dist/universal.cjs",
|
|
4
|
+
"module": "./dist/universal.js",
|
|
5
|
+
"types": "./types/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./types/index.d.ts",
|
|
13
|
+
"default": "./dist/dev.js"
|
|
14
|
+
},
|
|
15
|
+
"require": "./dist/dev.cjs"
|
|
16
|
+
},
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./types/index.d.ts",
|
|
19
|
+
"default": "./dist/universal.js"
|
|
20
|
+
},
|
|
21
|
+
"require": "./dist/universal.cjs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/web/dist/dev.cjs
CHANGED
|
@@ -250,6 +250,8 @@ function hydrate$1(code, element, options = {}) {
|
|
|
250
250
|
function getNextElement(template) {
|
|
251
251
|
let node, key;
|
|
252
252
|
if (!solidJs.sharedConfig.context || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
253
|
+
if (solidJs.sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
|
|
254
|
+
if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
|
|
253
255
|
return template.cloneNode(true);
|
|
254
256
|
}
|
|
255
257
|
if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
|
|
@@ -458,7 +460,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
458
460
|
} else if ((typeof item) === "function") {
|
|
459
461
|
if (unwrap) {
|
|
460
462
|
while (typeof item === "function") item = item();
|
|
461
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
463
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
462
464
|
} else {
|
|
463
465
|
normalized.push(item);
|
|
464
466
|
dynamic = true;
|
package/web/dist/dev.js
CHANGED
|
@@ -247,6 +247,8 @@ function hydrate$1(code, element, options = {}) {
|
|
|
247
247
|
function getNextElement(template) {
|
|
248
248
|
let node, key;
|
|
249
249
|
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
250
|
+
if (sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
|
|
251
|
+
if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
|
|
250
252
|
return template.cloneNode(true);
|
|
251
253
|
}
|
|
252
254
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -455,7 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
455
457
|
} else if ((typeof item) === "function") {
|
|
456
458
|
if (unwrap) {
|
|
457
459
|
while (typeof item === "function") item = item();
|
|
458
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
460
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
459
461
|
} else {
|
|
460
462
|
normalized.push(item);
|
|
461
463
|
dynamic = true;
|
package/web/dist/server.cjs
CHANGED
|
@@ -266,8 +266,7 @@ function toRefParam(index) {
|
|
|
266
266
|
const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t)}`;
|
|
267
267
|
function renderToString(code, options = {}) {
|
|
268
268
|
let scripts = "";
|
|
269
|
-
|
|
270
|
-
solidJs.sharedConfig.context = context = {
|
|
269
|
+
solidJs.sharedConfig.context = {
|
|
271
270
|
id: options.renderId || "",
|
|
272
271
|
count: 0,
|
|
273
272
|
suspense: {},
|
|
@@ -279,8 +278,8 @@ function renderToString(code, options = {}) {
|
|
|
279
278
|
}
|
|
280
279
|
};
|
|
281
280
|
let html = resolveSSRNode(escape(code()));
|
|
282
|
-
solidJs.sharedConfig.context =
|
|
283
|
-
html = injectAssets(context.assets, html);
|
|
281
|
+
solidJs.sharedConfig.context.noHydrate = true;
|
|
282
|
+
html = injectAssets(solidJs.sharedConfig.context.assets, html);
|
|
284
283
|
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
285
284
|
return html;
|
|
286
285
|
}
|
|
@@ -354,6 +353,9 @@ function renderToStream(code, options = {}) {
|
|
|
354
353
|
suspense: {},
|
|
355
354
|
assets: [],
|
|
356
355
|
nonce,
|
|
356
|
+
block(p) {
|
|
357
|
+
if (!firstFlushed) blockingResources.push(p);
|
|
358
|
+
},
|
|
357
359
|
replace(id, payloadFn) {
|
|
358
360
|
if (firstFlushed) return;
|
|
359
361
|
const placeholder = `<!${id}>`;
|
|
@@ -393,14 +395,15 @@ function renderToStream(code, options = {}) {
|
|
|
393
395
|
}
|
|
394
396
|
}
|
|
395
397
|
}
|
|
396
|
-
Promise.resolve().then(checkEnd);
|
|
398
|
+
if (!registry.size) Promise.resolve().then(checkEnd);
|
|
397
399
|
return firstFlushed;
|
|
398
400
|
};
|
|
399
401
|
}
|
|
400
402
|
};
|
|
401
403
|
let html = resolveSSRNode(escape(code()));
|
|
402
404
|
function doShell() {
|
|
403
|
-
solidJs.sharedConfig.context =
|
|
405
|
+
solidJs.sharedConfig.context = context;
|
|
406
|
+
context.noHydrate = true;
|
|
404
407
|
html = injectAssets(context.assets, html);
|
|
405
408
|
for (const key in context.resources) {
|
|
406
409
|
if (!("data" in context.resources[key] || context.resources[key].ref[0].error)) pushTask(`_$HY.init("${key}")`);
|
|
@@ -429,7 +432,7 @@ function renderToStream(code, options = {}) {
|
|
|
429
432
|
complete();
|
|
430
433
|
};
|
|
431
434
|
} else onCompleteAll = complete;
|
|
432
|
-
|
|
435
|
+
if (!registry.size) Promise.resolve().then(checkEnd);
|
|
433
436
|
},
|
|
434
437
|
pipe(w) {
|
|
435
438
|
Promise.allSettled(blockingResources).then(() => {
|
|
@@ -528,8 +531,8 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
528
531
|
let classResolved;
|
|
529
532
|
for (let i = 0; i < keys.length; i++) {
|
|
530
533
|
const prop = keys[i];
|
|
531
|
-
if (ChildProperties.has(prop)
|
|
532
|
-
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
534
|
+
if (ChildProperties.has(prop)) {
|
|
535
|
+
if (children === undefined) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
533
536
|
continue;
|
|
534
537
|
}
|
|
535
538
|
const value = props[prop];
|
package/web/dist/server.js
CHANGED
|
@@ -263,8 +263,7 @@ function toRefParam(index) {
|
|
|
263
263
|
const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t)}`;
|
|
264
264
|
function renderToString(code, options = {}) {
|
|
265
265
|
let scripts = "";
|
|
266
|
-
|
|
267
|
-
sharedConfig.context = context = {
|
|
266
|
+
sharedConfig.context = {
|
|
268
267
|
id: options.renderId || "",
|
|
269
268
|
count: 0,
|
|
270
269
|
suspense: {},
|
|
@@ -276,8 +275,8 @@ function renderToString(code, options = {}) {
|
|
|
276
275
|
}
|
|
277
276
|
};
|
|
278
277
|
let html = resolveSSRNode(escape(code()));
|
|
279
|
-
sharedConfig.context =
|
|
280
|
-
html = injectAssets(context.assets, html);
|
|
278
|
+
sharedConfig.context.noHydrate = true;
|
|
279
|
+
html = injectAssets(sharedConfig.context.assets, html);
|
|
281
280
|
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
282
281
|
return html;
|
|
283
282
|
}
|
|
@@ -351,6 +350,9 @@ function renderToStream(code, options = {}) {
|
|
|
351
350
|
suspense: {},
|
|
352
351
|
assets: [],
|
|
353
352
|
nonce,
|
|
353
|
+
block(p) {
|
|
354
|
+
if (!firstFlushed) blockingResources.push(p);
|
|
355
|
+
},
|
|
354
356
|
replace(id, payloadFn) {
|
|
355
357
|
if (firstFlushed) return;
|
|
356
358
|
const placeholder = `<!${id}>`;
|
|
@@ -390,14 +392,15 @@ function renderToStream(code, options = {}) {
|
|
|
390
392
|
}
|
|
391
393
|
}
|
|
392
394
|
}
|
|
393
|
-
Promise.resolve().then(checkEnd);
|
|
395
|
+
if (!registry.size) Promise.resolve().then(checkEnd);
|
|
394
396
|
return firstFlushed;
|
|
395
397
|
};
|
|
396
398
|
}
|
|
397
399
|
};
|
|
398
400
|
let html = resolveSSRNode(escape(code()));
|
|
399
401
|
function doShell() {
|
|
400
|
-
sharedConfig.context =
|
|
402
|
+
sharedConfig.context = context;
|
|
403
|
+
context.noHydrate = true;
|
|
401
404
|
html = injectAssets(context.assets, html);
|
|
402
405
|
for (const key in context.resources) {
|
|
403
406
|
if (!("data" in context.resources[key] || context.resources[key].ref[0].error)) pushTask(`_$HY.init("${key}")`);
|
|
@@ -426,7 +429,7 @@ function renderToStream(code, options = {}) {
|
|
|
426
429
|
complete();
|
|
427
430
|
};
|
|
428
431
|
} else onCompleteAll = complete;
|
|
429
|
-
|
|
432
|
+
if (!registry.size) Promise.resolve().then(checkEnd);
|
|
430
433
|
},
|
|
431
434
|
pipe(w) {
|
|
432
435
|
Promise.allSettled(blockingResources).then(() => {
|
|
@@ -525,8 +528,8 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
525
528
|
let classResolved;
|
|
526
529
|
for (let i = 0; i < keys.length; i++) {
|
|
527
530
|
const prop = keys[i];
|
|
528
|
-
if (ChildProperties.has(prop)
|
|
529
|
-
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
531
|
+
if (ChildProperties.has(prop)) {
|
|
532
|
+
if (children === undefined) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
530
533
|
continue;
|
|
531
534
|
}
|
|
532
535
|
const value = props[prop];
|
package/web/dist/web.cjs
CHANGED
|
@@ -457,7 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
457
457
|
} else if ((typeof item) === "function") {
|
|
458
458
|
if (unwrap) {
|
|
459
459
|
while (typeof item === "function") item = item();
|
|
460
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
460
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
461
461
|
} else {
|
|
462
462
|
normalized.push(item);
|
|
463
463
|
dynamic = true;
|
package/web/dist/web.js
CHANGED
|
@@ -454,7 +454,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
454
454
|
} else if ((typeof item) === "function") {
|
|
455
455
|
if (unwrap) {
|
|
456
456
|
while (typeof item === "function") item = item();
|
|
457
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
457
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
458
458
|
} else {
|
|
459
459
|
normalized.push(item);
|
|
460
460
|
dynamic = true;
|
package/web/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solid-js/web",
|
|
3
|
+
"main": "./dist/server.cjs",
|
|
4
|
+
"module": "./dist/server.js",
|
|
5
|
+
"browser": {
|
|
6
|
+
"./dist/server.cjs": "./dist/web.cjs",
|
|
7
|
+
"./dist/server.js": "./dist/web.js"
|
|
8
|
+
},
|
|
9
|
+
"unpkg": "./dist/web.cjs",
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./types/index.d.ts",
|
|
19
|
+
"default": "./dist/dev.js"
|
|
20
|
+
},
|
|
21
|
+
"require": "./dist/dev.cjs"
|
|
22
|
+
},
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./types/index.d.ts",
|
|
25
|
+
"default": "./dist/web.js"
|
|
26
|
+
},
|
|
27
|
+
"require": "./dist/web.cjs"
|
|
28
|
+
},
|
|
29
|
+
"node": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./types/index.d.ts",
|
|
32
|
+
"default": "./dist/server.js"
|
|
33
|
+
},
|
|
34
|
+
"require": "./dist/server.cjs"
|
|
35
|
+
},
|
|
36
|
+
"development": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./types/index.d.ts",
|
|
39
|
+
"default": "./dist/dev.js"
|
|
40
|
+
},
|
|
41
|
+
"require": "./dist/dev.cjs"
|
|
42
|
+
},
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./types/index.d.ts",
|
|
45
|
+
"default": "./dist/web.js"
|
|
46
|
+
},
|
|
47
|
+
"require": "./dist/web.cjs"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/web/types/client.d.ts
CHANGED
|
@@ -67,4 +67,4 @@ export function getAssets(): string;
|
|
|
67
67
|
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
68
68
|
export function HydrationScript(): JSX.Element;
|
|
69
69
|
export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
|
|
70
|
-
export function
|
|
70
|
+
export function generateHydrationScript(): string;
|