solid-js 1.5.0-beta.3 → 1.5.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +18 -13
- package/dist/dev.js +18 -13
- package/dist/server.cjs +16 -4
- package/dist/server.js +16 -4
- package/dist/solid.cjs +18 -13
- package/dist/solid.js +18 -13
- package/package.json +1 -1
- package/store/types/store.d.ts +2 -2
- package/types/index.d.ts +1 -1
- package/types/reactive/signal.d.ts +13 -5
- package/types/server/reactive.d.ts +4 -1
- package/types/server/rendering.d.ts +2 -1
- package/web/dist/dev.cjs +8 -7
- package/web/dist/dev.js +3 -5
- package/web/dist/server.cjs +49 -12
- package/web/dist/server.js +47 -13
- package/web/dist/web.cjs +8 -7
- package/web/dist/web.js +3 -5
- package/web/types/client.d.ts +3 -0
- package/web/types/server-mock.d.ts +4 -1
- package/web/types/server.d.ts +2 -0
package/dist/dev.cjs
CHANGED
|
@@ -301,7 +301,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
301
301
|
!success && (err = castError(v));
|
|
302
302
|
runUpdates(() => {
|
|
303
303
|
setValue(() => v);
|
|
304
|
-
setState(success ? "ready" : "
|
|
304
|
+
setState(success ? "ready" : "errored");
|
|
305
305
|
for (const c of contexts.keys()) c.decrement();
|
|
306
306
|
contexts.clear();
|
|
307
307
|
}, false);
|
|
@@ -352,10 +352,11 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
352
352
|
return p.then(v => loadEnd(p, v, true, lookup), e => loadEnd(p, e, false));
|
|
353
353
|
}
|
|
354
354
|
Object.defineProperties(read, {
|
|
355
|
+
value: {
|
|
356
|
+
get: () => value()
|
|
357
|
+
},
|
|
355
358
|
state: {
|
|
356
|
-
get()
|
|
357
|
-
return state();
|
|
358
|
-
}
|
|
359
|
+
get: () => state()
|
|
359
360
|
},
|
|
360
361
|
loading: {
|
|
361
362
|
get() {
|
|
@@ -365,13 +366,13 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
365
366
|
},
|
|
366
367
|
error: {
|
|
367
368
|
get() {
|
|
368
|
-
return state() === "
|
|
369
|
+
return state() === "errored" ? err : undefined;
|
|
369
370
|
}
|
|
370
371
|
},
|
|
371
372
|
latest: {
|
|
372
373
|
get() {
|
|
373
374
|
if (!resolved) return read();
|
|
374
|
-
if (state() === "
|
|
375
|
+
if (state() === "errored") throw err;
|
|
375
376
|
return value();
|
|
376
377
|
}
|
|
377
378
|
}
|
|
@@ -400,9 +401,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
400
401
|
const subs = new Map();
|
|
401
402
|
const node = createComputation(p => {
|
|
402
403
|
const v = source();
|
|
403
|
-
for (const key of subs.
|
|
404
|
-
const
|
|
405
|
-
for (const c of l.values()) {
|
|
404
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
405
|
+
for (const c of val.values()) {
|
|
406
406
|
c.state = STALE;
|
|
407
407
|
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
408
408
|
}
|
|
@@ -411,8 +411,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
411
411
|
}, undefined, true, STALE, options );
|
|
412
412
|
updateComputation(node);
|
|
413
413
|
return key => {
|
|
414
|
-
|
|
415
|
-
if (listener
|
|
414
|
+
const listener = Listener;
|
|
415
|
+
if (listener) {
|
|
416
416
|
let l;
|
|
417
417
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
418
418
|
onCleanup(() => {
|
|
@@ -585,7 +585,12 @@ function useContext(context) {
|
|
|
585
585
|
}
|
|
586
586
|
function children(fn) {
|
|
587
587
|
const children = createMemo(fn);
|
|
588
|
-
|
|
588
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
589
|
+
memo.toArray = () => {
|
|
590
|
+
const c = memo();
|
|
591
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
592
|
+
};
|
|
593
|
+
return memo;
|
|
589
594
|
}
|
|
590
595
|
let SuspenseContext;
|
|
591
596
|
function getSuspenseContext() {
|
|
@@ -700,7 +705,7 @@ function runComputation(node, value, time) {
|
|
|
700
705
|
handleError(err);
|
|
701
706
|
}
|
|
702
707
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
703
|
-
if (node.updatedAt && "observers" in node) {
|
|
708
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
704
709
|
writeSignal(node, nextValue, true);
|
|
705
710
|
} else if (Transition && Transition.running && node.pure) {
|
|
706
711
|
Transition.sources.add(node);
|
package/dist/dev.js
CHANGED
|
@@ -297,7 +297,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
297
297
|
!success && (err = castError(v));
|
|
298
298
|
runUpdates(() => {
|
|
299
299
|
setValue(() => v);
|
|
300
|
-
setState(success ? "ready" : "
|
|
300
|
+
setState(success ? "ready" : "errored");
|
|
301
301
|
for (const c of contexts.keys()) c.decrement();
|
|
302
302
|
contexts.clear();
|
|
303
303
|
}, false);
|
|
@@ -348,10 +348,11 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
348
348
|
return p.then(v => loadEnd(p, v, true, lookup), e => loadEnd(p, e, false));
|
|
349
349
|
}
|
|
350
350
|
Object.defineProperties(read, {
|
|
351
|
+
value: {
|
|
352
|
+
get: () => value()
|
|
353
|
+
},
|
|
351
354
|
state: {
|
|
352
|
-
get()
|
|
353
|
-
return state();
|
|
354
|
-
}
|
|
355
|
+
get: () => state()
|
|
355
356
|
},
|
|
356
357
|
loading: {
|
|
357
358
|
get() {
|
|
@@ -361,13 +362,13 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
361
362
|
},
|
|
362
363
|
error: {
|
|
363
364
|
get() {
|
|
364
|
-
return state() === "
|
|
365
|
+
return state() === "errored" ? err : undefined;
|
|
365
366
|
}
|
|
366
367
|
},
|
|
367
368
|
latest: {
|
|
368
369
|
get() {
|
|
369
370
|
if (!resolved) return read();
|
|
370
|
-
if (state() === "
|
|
371
|
+
if (state() === "errored") throw err;
|
|
371
372
|
return value();
|
|
372
373
|
}
|
|
373
374
|
}
|
|
@@ -396,9 +397,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
396
397
|
const subs = new Map();
|
|
397
398
|
const node = createComputation(p => {
|
|
398
399
|
const v = source();
|
|
399
|
-
for (const key of subs.
|
|
400
|
-
const
|
|
401
|
-
for (const c of l.values()) {
|
|
400
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
401
|
+
for (const c of val.values()) {
|
|
402
402
|
c.state = STALE;
|
|
403
403
|
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
404
404
|
}
|
|
@@ -407,8 +407,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
407
407
|
}, undefined, true, STALE, options );
|
|
408
408
|
updateComputation(node);
|
|
409
409
|
return key => {
|
|
410
|
-
|
|
411
|
-
if (listener
|
|
410
|
+
const listener = Listener;
|
|
411
|
+
if (listener) {
|
|
412
412
|
let l;
|
|
413
413
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
414
414
|
onCleanup(() => {
|
|
@@ -581,7 +581,12 @@ function useContext(context) {
|
|
|
581
581
|
}
|
|
582
582
|
function children(fn) {
|
|
583
583
|
const children = createMemo(fn);
|
|
584
|
-
|
|
584
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
585
|
+
memo.toArray = () => {
|
|
586
|
+
const c = memo();
|
|
587
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
588
|
+
};
|
|
589
|
+
return memo;
|
|
585
590
|
}
|
|
586
591
|
let SuspenseContext;
|
|
587
592
|
function getSuspenseContext() {
|
|
@@ -696,7 +701,7 @@ function runComputation(node, value, time) {
|
|
|
696
701
|
handleError(err);
|
|
697
702
|
}
|
|
698
703
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
699
|
-
if (node.updatedAt && "observers" in node) {
|
|
704
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
700
705
|
writeSignal(node, nextValue, true);
|
|
701
706
|
} else if (Transition && Transition.running && node.pure) {
|
|
702
707
|
Transition.sources.add(node);
|
package/dist/server.cjs
CHANGED
|
@@ -144,7 +144,12 @@ function getOwner() {
|
|
|
144
144
|
return Owner;
|
|
145
145
|
}
|
|
146
146
|
function children(fn) {
|
|
147
|
-
|
|
147
|
+
const memo = createMemo(() => resolveChildren(fn()));
|
|
148
|
+
memo.toArray = () => {
|
|
149
|
+
const c = memo();
|
|
150
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
151
|
+
};
|
|
152
|
+
return memo;
|
|
148
153
|
}
|
|
149
154
|
function runWithOwner(o, fn) {
|
|
150
155
|
const prev = Owner;
|
|
@@ -416,9 +421,13 @@ function createResource(source, fetcher, options = {}) {
|
|
|
416
421
|
};
|
|
417
422
|
read.loading = false;
|
|
418
423
|
read.error = undefined;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
read.state = "initialValue" in options ? "resolved" : "unresolved";
|
|
425
|
+
Object.defineProperties(read, {
|
|
426
|
+
value: {
|
|
427
|
+
get: () => read()
|
|
428
|
+
},
|
|
429
|
+
latest: {
|
|
430
|
+
get: () => read()
|
|
422
431
|
}
|
|
423
432
|
});
|
|
424
433
|
function load() {
|
|
@@ -444,15 +453,18 @@ function createResource(source, fetcher, options = {}) {
|
|
|
444
453
|
}
|
|
445
454
|
if (p != undefined && typeof p === "object" && "then" in p) {
|
|
446
455
|
read.loading = true;
|
|
456
|
+
read.state = "pending";
|
|
447
457
|
if (ctx.writeResource) ctx.writeResource(id, p, undefined, options.deferStream);
|
|
448
458
|
return p.then(res => {
|
|
449
459
|
read.loading = false;
|
|
460
|
+
read.state = "resolved";
|
|
450
461
|
ctx.resources[id].data = res;
|
|
451
462
|
p = null;
|
|
452
463
|
notifySuspense(contexts);
|
|
453
464
|
return res;
|
|
454
465
|
}).catch(err => {
|
|
455
466
|
read.loading = false;
|
|
467
|
+
read.state = "errored";
|
|
456
468
|
read.error = error = castError(err);
|
|
457
469
|
p = null;
|
|
458
470
|
notifySuspense(contexts);
|
package/dist/server.js
CHANGED
|
@@ -140,7 +140,12 @@ function getOwner() {
|
|
|
140
140
|
return Owner;
|
|
141
141
|
}
|
|
142
142
|
function children(fn) {
|
|
143
|
-
|
|
143
|
+
const memo = createMemo(() => resolveChildren(fn()));
|
|
144
|
+
memo.toArray = () => {
|
|
145
|
+
const c = memo();
|
|
146
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
147
|
+
};
|
|
148
|
+
return memo;
|
|
144
149
|
}
|
|
145
150
|
function runWithOwner(o, fn) {
|
|
146
151
|
const prev = Owner;
|
|
@@ -412,9 +417,13 @@ function createResource(source, fetcher, options = {}) {
|
|
|
412
417
|
};
|
|
413
418
|
read.loading = false;
|
|
414
419
|
read.error = undefined;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
420
|
+
read.state = "initialValue" in options ? "resolved" : "unresolved";
|
|
421
|
+
Object.defineProperties(read, {
|
|
422
|
+
value: {
|
|
423
|
+
get: () => read()
|
|
424
|
+
},
|
|
425
|
+
latest: {
|
|
426
|
+
get: () => read()
|
|
418
427
|
}
|
|
419
428
|
});
|
|
420
429
|
function load() {
|
|
@@ -440,15 +449,18 @@ function createResource(source, fetcher, options = {}) {
|
|
|
440
449
|
}
|
|
441
450
|
if (p != undefined && typeof p === "object" && "then" in p) {
|
|
442
451
|
read.loading = true;
|
|
452
|
+
read.state = "pending";
|
|
443
453
|
if (ctx.writeResource) ctx.writeResource(id, p, undefined, options.deferStream);
|
|
444
454
|
return p.then(res => {
|
|
445
455
|
read.loading = false;
|
|
456
|
+
read.state = "resolved";
|
|
446
457
|
ctx.resources[id].data = res;
|
|
447
458
|
p = null;
|
|
448
459
|
notifySuspense(contexts);
|
|
449
460
|
return res;
|
|
450
461
|
}).catch(err => {
|
|
451
462
|
read.loading = false;
|
|
463
|
+
read.state = "errored";
|
|
452
464
|
read.error = error = castError(err);
|
|
453
465
|
p = null;
|
|
454
466
|
notifySuspense(contexts);
|
package/dist/solid.cjs
CHANGED
|
@@ -293,7 +293,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
293
293
|
!success && (err = castError(v));
|
|
294
294
|
runUpdates(() => {
|
|
295
295
|
setValue(() => v);
|
|
296
|
-
setState(success ? "ready" : "
|
|
296
|
+
setState(success ? "ready" : "errored");
|
|
297
297
|
for (const c of contexts.keys()) c.decrement();
|
|
298
298
|
contexts.clear();
|
|
299
299
|
}, false);
|
|
@@ -344,10 +344,11 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
344
344
|
return p.then(v => loadEnd(p, v, true, lookup), e => loadEnd(p, e, false));
|
|
345
345
|
}
|
|
346
346
|
Object.defineProperties(read, {
|
|
347
|
+
value: {
|
|
348
|
+
get: () => value()
|
|
349
|
+
},
|
|
347
350
|
state: {
|
|
348
|
-
get()
|
|
349
|
-
return state();
|
|
350
|
-
}
|
|
351
|
+
get: () => state()
|
|
351
352
|
},
|
|
352
353
|
loading: {
|
|
353
354
|
get() {
|
|
@@ -357,13 +358,13 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
357
358
|
},
|
|
358
359
|
error: {
|
|
359
360
|
get() {
|
|
360
|
-
return state() === "
|
|
361
|
+
return state() === "errored" ? err : undefined;
|
|
361
362
|
}
|
|
362
363
|
},
|
|
363
364
|
latest: {
|
|
364
365
|
get() {
|
|
365
366
|
if (!resolved) return read();
|
|
366
|
-
if (state() === "
|
|
367
|
+
if (state() === "errored") throw err;
|
|
367
368
|
return value();
|
|
368
369
|
}
|
|
369
370
|
}
|
|
@@ -392,9 +393,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
392
393
|
const subs = new Map();
|
|
393
394
|
const node = createComputation(p => {
|
|
394
395
|
const v = source();
|
|
395
|
-
for (const key of subs.
|
|
396
|
-
const
|
|
397
|
-
for (const c of l.values()) {
|
|
396
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
397
|
+
for (const c of val.values()) {
|
|
398
398
|
c.state = STALE;
|
|
399
399
|
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
400
400
|
}
|
|
@@ -403,8 +403,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
403
403
|
}, undefined, true, STALE);
|
|
404
404
|
updateComputation(node);
|
|
405
405
|
return key => {
|
|
406
|
-
|
|
407
|
-
if (listener
|
|
406
|
+
const listener = Listener;
|
|
407
|
+
if (listener) {
|
|
408
408
|
let l;
|
|
409
409
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
410
410
|
onCleanup(() => {
|
|
@@ -525,7 +525,12 @@ function useContext(context) {
|
|
|
525
525
|
}
|
|
526
526
|
function children(fn) {
|
|
527
527
|
const children = createMemo(fn);
|
|
528
|
-
|
|
528
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
529
|
+
memo.toArray = () => {
|
|
530
|
+
const c = memo();
|
|
531
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
532
|
+
};
|
|
533
|
+
return memo;
|
|
529
534
|
}
|
|
530
535
|
let SuspenseContext;
|
|
531
536
|
function getSuspenseContext() {
|
|
@@ -640,7 +645,7 @@ function runComputation(node, value, time) {
|
|
|
640
645
|
handleError(err);
|
|
641
646
|
}
|
|
642
647
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
643
|
-
if (node.updatedAt && "observers" in node) {
|
|
648
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
644
649
|
writeSignal(node, nextValue, true);
|
|
645
650
|
} else if (Transition && Transition.running && node.pure) {
|
|
646
651
|
Transition.sources.add(node);
|
package/dist/solid.js
CHANGED
|
@@ -289,7 +289,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
289
289
|
!success && (err = castError(v));
|
|
290
290
|
runUpdates(() => {
|
|
291
291
|
setValue(() => v);
|
|
292
|
-
setState(success ? "ready" : "
|
|
292
|
+
setState(success ? "ready" : "errored");
|
|
293
293
|
for (const c of contexts.keys()) c.decrement();
|
|
294
294
|
contexts.clear();
|
|
295
295
|
}, false);
|
|
@@ -340,10 +340,11 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
340
340
|
return p.then(v => loadEnd(p, v, true, lookup), e => loadEnd(p, e, false));
|
|
341
341
|
}
|
|
342
342
|
Object.defineProperties(read, {
|
|
343
|
+
value: {
|
|
344
|
+
get: () => value()
|
|
345
|
+
},
|
|
343
346
|
state: {
|
|
344
|
-
get()
|
|
345
|
-
return state();
|
|
346
|
-
}
|
|
347
|
+
get: () => state()
|
|
347
348
|
},
|
|
348
349
|
loading: {
|
|
349
350
|
get() {
|
|
@@ -353,13 +354,13 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
353
354
|
},
|
|
354
355
|
error: {
|
|
355
356
|
get() {
|
|
356
|
-
return state() === "
|
|
357
|
+
return state() === "errored" ? err : undefined;
|
|
357
358
|
}
|
|
358
359
|
},
|
|
359
360
|
latest: {
|
|
360
361
|
get() {
|
|
361
362
|
if (!resolved) return read();
|
|
362
|
-
if (state() === "
|
|
363
|
+
if (state() === "errored") throw err;
|
|
363
364
|
return value();
|
|
364
365
|
}
|
|
365
366
|
}
|
|
@@ -388,9 +389,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
388
389
|
const subs = new Map();
|
|
389
390
|
const node = createComputation(p => {
|
|
390
391
|
const v = source();
|
|
391
|
-
for (const key of subs.
|
|
392
|
-
const
|
|
393
|
-
for (const c of l.values()) {
|
|
392
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
393
|
+
for (const c of val.values()) {
|
|
394
394
|
c.state = STALE;
|
|
395
395
|
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
396
396
|
}
|
|
@@ -399,8 +399,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
399
399
|
}, undefined, true, STALE);
|
|
400
400
|
updateComputation(node);
|
|
401
401
|
return key => {
|
|
402
|
-
|
|
403
|
-
if (listener
|
|
402
|
+
const listener = Listener;
|
|
403
|
+
if (listener) {
|
|
404
404
|
let l;
|
|
405
405
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
406
406
|
onCleanup(() => {
|
|
@@ -521,7 +521,12 @@ function useContext(context) {
|
|
|
521
521
|
}
|
|
522
522
|
function children(fn) {
|
|
523
523
|
const children = createMemo(fn);
|
|
524
|
-
|
|
524
|
+
const memo = createMemo(() => resolveChildren(children()));
|
|
525
|
+
memo.toArray = () => {
|
|
526
|
+
const c = memo();
|
|
527
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
528
|
+
};
|
|
529
|
+
return memo;
|
|
525
530
|
}
|
|
526
531
|
let SuspenseContext;
|
|
527
532
|
function getSuspenseContext() {
|
|
@@ -636,7 +641,7 @@ function runComputation(node, value, time) {
|
|
|
636
641
|
handleError(err);
|
|
637
642
|
}
|
|
638
643
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
639
|
-
if (node.updatedAt && "observers" in node) {
|
|
644
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
640
645
|
writeSignal(node, nextValue, true);
|
|
641
646
|
} else if (Transition && Transition.running && node.pure) {
|
|
642
647
|
Transition.sources.add(node);
|
package/package.json
CHANGED
package/store/types/store.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ export interface SetStoreFunction<T> {
|
|
|
55
55
|
*
|
|
56
56
|
* @description https://www.solidjs.com/docs/latest/api#createstore
|
|
57
57
|
*/
|
|
58
|
-
export declare function createStore<T extends {}>(...[store, options]: {} extends T ? [store?: T | Store<T>, options?: {
|
|
58
|
+
export declare function createStore<T extends object = {}>(...[store, options]: {} extends T ? [store?: T | Store<T>, options?: {
|
|
59
59
|
name?: string;
|
|
60
|
-
}] : [store:
|
|
60
|
+
}] : [store: T | Store<T>, options?: {
|
|
61
61
|
name?: string;
|
|
62
62
|
}]): [get: Store<T>, set: SetStoreFunction<T>];
|
|
63
63
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createReaction, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY, $TRACK } from "./reactive/signal.js";
|
|
2
|
-
export type { Accessor, Setter, Signal, Resource, ResourceOptions, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes, Owner, InitializedResource, InitializedResourceOptions, InitializedResourceReturn } from "./reactive/signal.js";
|
|
2
|
+
export type { Accessor, Setter, Signal, Resource, ResourceOptions, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, ChildrenReturn, Context, ReturnTypes, Owner, InitializedResource, InitializedResourceOptions, InitializedResourceReturn } from "./reactive/signal.js";
|
|
3
3
|
export * from "./reactive/observable.js";
|
|
4
4
|
export * from "./reactive/scheduler.js";
|
|
5
5
|
export * from "./reactive/array.js";
|
|
@@ -197,6 +197,7 @@ export interface MemoOptions<T> extends EffectOptions {
|
|
|
197
197
|
export declare function createMemo<Next extends Prev, Prev = Next>(fn: EffectFunction<undefined | NoInfer<Prev>, Next>): Accessor<Next>;
|
|
198
198
|
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(fn: EffectFunction<Init | Prev, Next>, value: Init, options?: MemoOptions<Next>): Accessor<Next>;
|
|
199
199
|
interface Unresolved {
|
|
200
|
+
value: undefined;
|
|
200
201
|
state: "unresolved";
|
|
201
202
|
loading: false;
|
|
202
203
|
error: undefined;
|
|
@@ -204,6 +205,7 @@ interface Unresolved {
|
|
|
204
205
|
(): undefined;
|
|
205
206
|
}
|
|
206
207
|
interface Pending {
|
|
208
|
+
value: undefined;
|
|
207
209
|
state: "pending";
|
|
208
210
|
loading: true;
|
|
209
211
|
error: undefined;
|
|
@@ -211,6 +213,7 @@ interface Pending {
|
|
|
211
213
|
(): undefined;
|
|
212
214
|
}
|
|
213
215
|
interface Ready<T> {
|
|
216
|
+
value: T;
|
|
214
217
|
state: "ready";
|
|
215
218
|
loading: false;
|
|
216
219
|
error: undefined;
|
|
@@ -218,21 +221,23 @@ interface Ready<T> {
|
|
|
218
221
|
(): T;
|
|
219
222
|
}
|
|
220
223
|
interface Refreshing<T> {
|
|
224
|
+
value: T;
|
|
221
225
|
state: "refreshing";
|
|
222
226
|
loading: true;
|
|
223
227
|
error: undefined;
|
|
224
228
|
latest: T;
|
|
225
229
|
(): T;
|
|
226
230
|
}
|
|
227
|
-
interface
|
|
228
|
-
|
|
231
|
+
interface Errored {
|
|
232
|
+
value: never;
|
|
233
|
+
state: "errored";
|
|
229
234
|
loading: false;
|
|
230
235
|
error: any;
|
|
231
236
|
latest: never;
|
|
232
237
|
(): never;
|
|
233
238
|
}
|
|
234
|
-
export declare type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> |
|
|
235
|
-
export declare type InitializedResource<T> = Ready<T> | Refreshing<T> |
|
|
239
|
+
export declare type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
240
|
+
export declare type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
236
241
|
export declare type ResourceActions<T, R = unknown> = {
|
|
237
242
|
mutate: Setter<T | undefined>;
|
|
238
243
|
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
@@ -489,6 +494,9 @@ export declare function createContext<T>(defaultValue: T): Context<T>;
|
|
|
489
494
|
export declare function useContext<T>(context: Context<T>): T;
|
|
490
495
|
export declare type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement | JSX.FunctionElement>;
|
|
491
496
|
export declare type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
497
|
+
export declare type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
498
|
+
toArray: () => ResolvedJSXElement[];
|
|
499
|
+
};
|
|
492
500
|
/**
|
|
493
501
|
* Resolves child elements to help interact with children
|
|
494
502
|
*
|
|
@@ -497,7 +505,7 @@ export declare type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[]
|
|
|
497
505
|
*
|
|
498
506
|
* @description https://www.solidjs.com/docs/latest/api#children
|
|
499
507
|
*/
|
|
500
|
-
export declare function children(fn: Accessor<JSX.Element>):
|
|
508
|
+
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
501
509
|
export declare type SuspenseContextType = {
|
|
502
510
|
increment?: () => void;
|
|
503
511
|
decrement?: () => void;
|
|
@@ -46,7 +46,10 @@ export interface Context<T> {
|
|
|
46
46
|
export declare function createContext<T>(defaultValue?: T): Context<T>;
|
|
47
47
|
export declare function useContext<T>(context: Context<T>): T;
|
|
48
48
|
export declare function getOwner(): Owner | null;
|
|
49
|
-
|
|
49
|
+
declare type ChildrenReturn = Accessor<any> & {
|
|
50
|
+
toArray: () => any[];
|
|
51
|
+
};
|
|
52
|
+
export declare function children(fn: () => any): ChildrenReturn;
|
|
50
53
|
export declare function runWithOwner<T>(o: Owner, fn: () => T): T | undefined;
|
|
51
54
|
export declare function lookup(owner: Owner | null, key: symbol | string): any;
|
|
52
55
|
export interface Task {
|
|
@@ -72,7 +72,8 @@ export declare function ErrorBoundary(props: {
|
|
|
72
72
|
};
|
|
73
73
|
export interface Resource<T> {
|
|
74
74
|
(): T | undefined;
|
|
75
|
-
|
|
75
|
+
value: T | undefined;
|
|
76
|
+
state: "unresolved" | "pending" | "ready" | "refreshing" | "errored";
|
|
76
77
|
loading: boolean;
|
|
77
78
|
error: any;
|
|
78
79
|
latest: T | undefined;
|
package/web/dist/dev.cjs
CHANGED
|
@@ -502,12 +502,10 @@ function getHydrationKey() {
|
|
|
502
502
|
const hydrate = solidJs.sharedConfig.context;
|
|
503
503
|
return `${hydrate.id}${hydrate.count++}`;
|
|
504
504
|
}
|
|
505
|
-
function Assets() {
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
505
|
function NoHydration(props) {
|
|
509
506
|
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
510
507
|
}
|
|
508
|
+
function voidFn() {}
|
|
511
509
|
|
|
512
510
|
function throwInBrowser(func) {
|
|
513
511
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
@@ -530,7 +528,7 @@ function ssrAttribute(key, value) {}
|
|
|
530
528
|
function ssrHydrationKey() {}
|
|
531
529
|
function resolveSSRNode(node) {}
|
|
532
530
|
function escape(html) {}
|
|
533
|
-
function
|
|
531
|
+
function ssrSpread(props, isSVG, skipChildren) {}
|
|
534
532
|
|
|
535
533
|
const isServer = false;
|
|
536
534
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
@@ -647,12 +645,12 @@ Object.defineProperty(exports, 'mergeProps', {
|
|
|
647
645
|
get: function () { return solidJs.mergeProps; }
|
|
648
646
|
});
|
|
649
647
|
exports.Aliases = Aliases;
|
|
650
|
-
exports.Assets =
|
|
648
|
+
exports.Assets = voidFn;
|
|
651
649
|
exports.ChildProperties = ChildProperties;
|
|
652
650
|
exports.DOMElements = DOMElements;
|
|
653
651
|
exports.DelegatedEvents = DelegatedEvents;
|
|
654
652
|
exports.Dynamic = Dynamic;
|
|
655
|
-
exports.HydrationScript =
|
|
653
|
+
exports.HydrationScript = voidFn;
|
|
656
654
|
exports.NoHydration = NoHydration;
|
|
657
655
|
exports.Portal = Portal;
|
|
658
656
|
exports.PropAliases = PropAliases;
|
|
@@ -667,7 +665,8 @@ exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
|
667
665
|
exports.delegateEvents = delegateEvents;
|
|
668
666
|
exports.dynamicProperty = dynamicProperty;
|
|
669
667
|
exports.escape = escape;
|
|
670
|
-
exports.generateHydrationScript =
|
|
668
|
+
exports.generateHydrationScript = voidFn;
|
|
669
|
+
exports.getAssets = voidFn;
|
|
671
670
|
exports.getHydrationKey = getHydrationKey;
|
|
672
671
|
exports.getNextElement = getNextElement;
|
|
673
672
|
exports.getNextMarker = getNextMarker;
|
|
@@ -691,7 +690,9 @@ exports.ssrAttribute = ssrAttribute;
|
|
|
691
690
|
exports.ssrClassList = ssrClassList;
|
|
692
691
|
exports.ssrElement = ssrElement;
|
|
693
692
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
693
|
+
exports.ssrSpread = ssrSpread;
|
|
694
694
|
exports.ssrStyle = ssrStyle;
|
|
695
695
|
exports.style = style;
|
|
696
696
|
exports.template = template;
|
|
697
697
|
exports.use = use;
|
|
698
|
+
exports.useAssets = voidFn;
|
package/web/dist/dev.js
CHANGED
|
@@ -499,12 +499,10 @@ function getHydrationKey() {
|
|
|
499
499
|
const hydrate = sharedConfig.context;
|
|
500
500
|
return `${hydrate.id}${hydrate.count++}`;
|
|
501
501
|
}
|
|
502
|
-
function Assets() {
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
502
|
function NoHydration(props) {
|
|
506
503
|
return sharedConfig.context ? undefined : props.children;
|
|
507
504
|
}
|
|
505
|
+
function voidFn() {}
|
|
508
506
|
|
|
509
507
|
function throwInBrowser(func) {
|
|
510
508
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
@@ -527,7 +525,7 @@ function ssrAttribute(key, value) {}
|
|
|
527
525
|
function ssrHydrationKey() {}
|
|
528
526
|
function resolveSSRNode(node) {}
|
|
529
527
|
function escape(html) {}
|
|
530
|
-
function
|
|
528
|
+
function ssrSpread(props, isSVG, skipChildren) {}
|
|
531
529
|
|
|
532
530
|
const isServer = false;
|
|
533
531
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
@@ -595,4 +593,4 @@ function Dynamic(props) {
|
|
|
595
593
|
});
|
|
596
594
|
}
|
|
597
595
|
|
|
598
|
-
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic,
|
|
596
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
package/web/dist/server.cjs
CHANGED
|
@@ -460,22 +460,16 @@ function renderToStream(code, options = {}) {
|
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
462
|
function Assets(props) {
|
|
463
|
-
|
|
464
|
-
get children() {
|
|
465
|
-
return resolveSSRNode(props.children);
|
|
466
|
-
}
|
|
467
|
-
}));
|
|
468
|
-
return ssr(`%%$${solidJs.sharedConfig.context.assets.length - 1}%%`);
|
|
463
|
+
useAssets(() => props.children);
|
|
469
464
|
}
|
|
470
465
|
function HydrationScript(props) {
|
|
471
466
|
const {
|
|
472
467
|
nonce
|
|
473
468
|
} = solidJs.sharedConfig.context;
|
|
474
|
-
|
|
469
|
+
return ssr(generateHydrationScript({
|
|
475
470
|
nonce,
|
|
476
471
|
...props
|
|
477
472
|
}));
|
|
478
|
-
return ssr(`%%$${solidJs.sharedConfig.context.assets.length - 1}%%`);
|
|
479
473
|
}
|
|
480
474
|
function NoHydration(props) {
|
|
481
475
|
const c = solidJs.sharedConfig.context;
|
|
@@ -621,6 +615,15 @@ function getHydrationKey() {
|
|
|
621
615
|
const hydrate = solidJs.sharedConfig.context;
|
|
622
616
|
return hydrate && !hydrate.noHydrate && `${hydrate.id}${hydrate.count++}`;
|
|
623
617
|
}
|
|
618
|
+
function useAssets(fn) {
|
|
619
|
+
solidJs.sharedConfig.context.assets.push(() => resolveSSRNode(fn()));
|
|
620
|
+
}
|
|
621
|
+
function getAssets() {
|
|
622
|
+
const assets = solidJs.sharedConfig.context.assets;
|
|
623
|
+
let out = "";
|
|
624
|
+
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
625
|
+
return out;
|
|
626
|
+
}
|
|
624
627
|
function generateHydrationScript({
|
|
625
628
|
eventNames = ["click", "input"],
|
|
626
629
|
nonce
|
|
@@ -628,10 +631,10 @@ function generateHydrationScript({
|
|
|
628
631
|
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=t=>e.r[t];</script><!--xs-->`;
|
|
629
632
|
}
|
|
630
633
|
function injectAssets(assets, html) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return html;
|
|
634
|
+
if (!assets || !assets.length) return html;
|
|
635
|
+
let out = "";
|
|
636
|
+
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
637
|
+
return html.replace(`<head>`, `<head>` + out);
|
|
635
638
|
}
|
|
636
639
|
function injectScripts(html, scripts, nonce) {
|
|
637
640
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
@@ -720,6 +723,37 @@ function pipeToWritable(code, writable, options = {}) {
|
|
|
720
723
|
const stream = renderToStream(code, options);
|
|
721
724
|
if (!options.onReady) stream.pipeTo(writable);
|
|
722
725
|
}
|
|
726
|
+
function ssrSpread(props, isSVG, skipChildren) {
|
|
727
|
+
let result = "";
|
|
728
|
+
if (props == null) return results;
|
|
729
|
+
if (typeof props === "function") props = props();
|
|
730
|
+
const keys = Object.keys(props);
|
|
731
|
+
let classResolved;
|
|
732
|
+
for (let i = 0; i < keys.length; i++) {
|
|
733
|
+
const prop = keys[i];
|
|
734
|
+
if (prop === "children") {
|
|
735
|
+
!skipChildren && console.warn(`SSR currently does not support spread children.`);
|
|
736
|
+
continue;
|
|
737
|
+
}
|
|
738
|
+
const value = props[prop];
|
|
739
|
+
if (prop === "style") {
|
|
740
|
+
result += `style="${ssrStyle(value)}"`;
|
|
741
|
+
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
742
|
+
if (classResolved) continue;
|
|
743
|
+
let n;
|
|
744
|
+
result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
|
|
745
|
+
classResolved = true;
|
|
746
|
+
} else if (BooleanAttributes.has(prop)) {
|
|
747
|
+
if (value) result += prop;else continue;
|
|
748
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
749
|
+
continue;
|
|
750
|
+
} else {
|
|
751
|
+
result += `${Aliases[prop] || prop}="${escape(value, true)}"`;
|
|
752
|
+
}
|
|
753
|
+
if (i !== keys.length - 1) result += " ";
|
|
754
|
+
}
|
|
755
|
+
return result;
|
|
756
|
+
}
|
|
723
757
|
|
|
724
758
|
const isServer = true;
|
|
725
759
|
function spread() {}
|
|
@@ -784,6 +818,7 @@ exports.NoHydration = NoHydration;
|
|
|
784
818
|
exports.Portal = Portal;
|
|
785
819
|
exports.escape = escape;
|
|
786
820
|
exports.generateHydrationScript = generateHydrationScript;
|
|
821
|
+
exports.getAssets = getAssets;
|
|
787
822
|
exports.getHydrationKey = getHydrationKey;
|
|
788
823
|
exports.isServer = isServer;
|
|
789
824
|
exports.pipeToNodeWritable = pipeToNodeWritable;
|
|
@@ -798,4 +833,6 @@ exports.ssrAttribute = ssrAttribute;
|
|
|
798
833
|
exports.ssrClassList = ssrClassList;
|
|
799
834
|
exports.ssrElement = ssrElement;
|
|
800
835
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
836
|
+
exports.ssrSpread = ssrSpread;
|
|
801
837
|
exports.ssrStyle = ssrStyle;
|
|
838
|
+
exports.useAssets = useAssets;
|
package/web/dist/server.js
CHANGED
|
@@ -457,22 +457,16 @@ function renderToStream(code, options = {}) {
|
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
function Assets(props) {
|
|
460
|
-
|
|
461
|
-
get children() {
|
|
462
|
-
return resolveSSRNode(props.children);
|
|
463
|
-
}
|
|
464
|
-
}));
|
|
465
|
-
return ssr(`%%$${sharedConfig.context.assets.length - 1}%%`);
|
|
460
|
+
useAssets(() => props.children);
|
|
466
461
|
}
|
|
467
462
|
function HydrationScript(props) {
|
|
468
463
|
const {
|
|
469
464
|
nonce
|
|
470
465
|
} = sharedConfig.context;
|
|
471
|
-
|
|
466
|
+
return ssr(generateHydrationScript({
|
|
472
467
|
nonce,
|
|
473
468
|
...props
|
|
474
469
|
}));
|
|
475
|
-
return ssr(`%%$${sharedConfig.context.assets.length - 1}%%`);
|
|
476
470
|
}
|
|
477
471
|
function NoHydration(props) {
|
|
478
472
|
const c = sharedConfig.context;
|
|
@@ -618,6 +612,15 @@ function getHydrationKey() {
|
|
|
618
612
|
const hydrate = sharedConfig.context;
|
|
619
613
|
return hydrate && !hydrate.noHydrate && `${hydrate.id}${hydrate.count++}`;
|
|
620
614
|
}
|
|
615
|
+
function useAssets(fn) {
|
|
616
|
+
sharedConfig.context.assets.push(() => resolveSSRNode(fn()));
|
|
617
|
+
}
|
|
618
|
+
function getAssets() {
|
|
619
|
+
const assets = sharedConfig.context.assets;
|
|
620
|
+
let out = "";
|
|
621
|
+
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
622
|
+
return out;
|
|
623
|
+
}
|
|
621
624
|
function generateHydrationScript({
|
|
622
625
|
eventNames = ["click", "input"],
|
|
623
626
|
nonce
|
|
@@ -625,10 +628,10 @@ function generateHydrationScript({
|
|
|
625
628
|
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=t=>e.r[t];</script><!--xs-->`;
|
|
626
629
|
}
|
|
627
630
|
function injectAssets(assets, html) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
return html;
|
|
631
|
+
if (!assets || !assets.length) return html;
|
|
632
|
+
let out = "";
|
|
633
|
+
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
634
|
+
return html.replace(`<head>`, `<head>` + out);
|
|
632
635
|
}
|
|
633
636
|
function injectScripts(html, scripts, nonce) {
|
|
634
637
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
@@ -717,6 +720,37 @@ function pipeToWritable(code, writable, options = {}) {
|
|
|
717
720
|
const stream = renderToStream(code, options);
|
|
718
721
|
if (!options.onReady) stream.pipeTo(writable);
|
|
719
722
|
}
|
|
723
|
+
function ssrSpread(props, isSVG, skipChildren) {
|
|
724
|
+
let result = "";
|
|
725
|
+
if (props == null) return results;
|
|
726
|
+
if (typeof props === "function") props = props();
|
|
727
|
+
const keys = Object.keys(props);
|
|
728
|
+
let classResolved;
|
|
729
|
+
for (let i = 0; i < keys.length; i++) {
|
|
730
|
+
const prop = keys[i];
|
|
731
|
+
if (prop === "children") {
|
|
732
|
+
!skipChildren && console.warn(`SSR currently does not support spread children.`);
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
const value = props[prop];
|
|
736
|
+
if (prop === "style") {
|
|
737
|
+
result += `style="${ssrStyle(value)}"`;
|
|
738
|
+
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
739
|
+
if (classResolved) continue;
|
|
740
|
+
let n;
|
|
741
|
+
result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
|
|
742
|
+
classResolved = true;
|
|
743
|
+
} else if (BooleanAttributes.has(prop)) {
|
|
744
|
+
if (value) result += prop;else continue;
|
|
745
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
746
|
+
continue;
|
|
747
|
+
} else {
|
|
748
|
+
result += `${Aliases[prop] || prop}="${escape(value, true)}"`;
|
|
749
|
+
}
|
|
750
|
+
if (i !== keys.length - 1) result += " ";
|
|
751
|
+
}
|
|
752
|
+
return result;
|
|
753
|
+
}
|
|
720
754
|
|
|
721
755
|
const isServer = true;
|
|
722
756
|
function spread() {}
|
|
@@ -734,4 +768,4 @@ function Portal(props) {
|
|
|
734
768
|
return "";
|
|
735
769
|
}
|
|
736
770
|
|
|
737
|
-
export { Assets, Dynamic, HydrationScript, NoHydration, Portal, escape, generateHydrationScript, getHydrationKey, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle };
|
|
771
|
+
export { Assets, Dynamic, HydrationScript, NoHydration, Portal, escape, generateHydrationScript, getAssets, getHydrationKey, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
|
package/web/dist/web.cjs
CHANGED
|
@@ -501,12 +501,10 @@ function getHydrationKey() {
|
|
|
501
501
|
const hydrate = solidJs.sharedConfig.context;
|
|
502
502
|
return `${hydrate.id}${hydrate.count++}`;
|
|
503
503
|
}
|
|
504
|
-
function Assets() {
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
504
|
function NoHydration(props) {
|
|
508
505
|
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
509
506
|
}
|
|
507
|
+
function voidFn() {}
|
|
510
508
|
|
|
511
509
|
function throwInBrowser(func) {
|
|
512
510
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
@@ -529,7 +527,7 @@ function ssrAttribute(key, value) {}
|
|
|
529
527
|
function ssrHydrationKey() {}
|
|
530
528
|
function resolveSSRNode(node) {}
|
|
531
529
|
function escape(html) {}
|
|
532
|
-
function
|
|
530
|
+
function ssrSpread(props, isSVG, skipChildren) {}
|
|
533
531
|
|
|
534
532
|
const isServer = false;
|
|
535
533
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
@@ -643,12 +641,12 @@ Object.defineProperty(exports, 'mergeProps', {
|
|
|
643
641
|
get: function () { return solidJs.mergeProps; }
|
|
644
642
|
});
|
|
645
643
|
exports.Aliases = Aliases;
|
|
646
|
-
exports.Assets =
|
|
644
|
+
exports.Assets = voidFn;
|
|
647
645
|
exports.ChildProperties = ChildProperties;
|
|
648
646
|
exports.DOMElements = DOMElements;
|
|
649
647
|
exports.DelegatedEvents = DelegatedEvents;
|
|
650
648
|
exports.Dynamic = Dynamic;
|
|
651
|
-
exports.HydrationScript =
|
|
649
|
+
exports.HydrationScript = voidFn;
|
|
652
650
|
exports.NoHydration = NoHydration;
|
|
653
651
|
exports.Portal = Portal;
|
|
654
652
|
exports.PropAliases = PropAliases;
|
|
@@ -663,7 +661,8 @@ exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
|
663
661
|
exports.delegateEvents = delegateEvents;
|
|
664
662
|
exports.dynamicProperty = dynamicProperty;
|
|
665
663
|
exports.escape = escape;
|
|
666
|
-
exports.generateHydrationScript =
|
|
664
|
+
exports.generateHydrationScript = voidFn;
|
|
665
|
+
exports.getAssets = voidFn;
|
|
667
666
|
exports.getHydrationKey = getHydrationKey;
|
|
668
667
|
exports.getNextElement = getNextElement;
|
|
669
668
|
exports.getNextMarker = getNextMarker;
|
|
@@ -687,7 +686,9 @@ exports.ssrAttribute = ssrAttribute;
|
|
|
687
686
|
exports.ssrClassList = ssrClassList;
|
|
688
687
|
exports.ssrElement = ssrElement;
|
|
689
688
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
689
|
+
exports.ssrSpread = ssrSpread;
|
|
690
690
|
exports.ssrStyle = ssrStyle;
|
|
691
691
|
exports.style = style;
|
|
692
692
|
exports.template = template;
|
|
693
693
|
exports.use = use;
|
|
694
|
+
exports.useAssets = voidFn;
|
package/web/dist/web.js
CHANGED
|
@@ -498,12 +498,10 @@ function getHydrationKey() {
|
|
|
498
498
|
const hydrate = sharedConfig.context;
|
|
499
499
|
return `${hydrate.id}${hydrate.count++}`;
|
|
500
500
|
}
|
|
501
|
-
function Assets() {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
501
|
function NoHydration(props) {
|
|
505
502
|
return sharedConfig.context ? undefined : props.children;
|
|
506
503
|
}
|
|
504
|
+
function voidFn() {}
|
|
507
505
|
|
|
508
506
|
function throwInBrowser(func) {
|
|
509
507
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
@@ -526,7 +524,7 @@ function ssrAttribute(key, value) {}
|
|
|
526
524
|
function ssrHydrationKey() {}
|
|
527
525
|
function resolveSSRNode(node) {}
|
|
528
526
|
function escape(html) {}
|
|
529
|
-
function
|
|
527
|
+
function ssrSpread(props, isSVG, skipChildren) {}
|
|
530
528
|
|
|
531
529
|
const isServer = false;
|
|
532
530
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
@@ -591,4 +589,4 @@ function Dynamic(props) {
|
|
|
591
589
|
});
|
|
592
590
|
}
|
|
593
591
|
|
|
594
|
-
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic,
|
|
592
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
package/web/types/client.d.ts
CHANGED
|
@@ -62,6 +62,9 @@ export function getHydrationKey(): string;
|
|
|
62
62
|
export function getNextElement(template?: HTMLTemplateElement): Element;
|
|
63
63
|
export function getNextMatch(start: Node, elementName: string): Element;
|
|
64
64
|
export function getNextMarker(start: Node): [Node, Array<Node>];
|
|
65
|
+
export function useAsset(fn: () => string): void;
|
|
66
|
+
export function getAssets(): string;
|
|
65
67
|
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
66
68
|
export function HydrationScript(): JSX.Element;
|
|
67
69
|
export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
|
|
70
|
+
export function getHydrationScript(): string;
|
|
@@ -38,7 +38,10 @@ export declare function ssrAttribute(key: string, value: boolean): string;
|
|
|
38
38
|
export declare function ssrHydrationKey(): string;
|
|
39
39
|
export declare function resolveSSRNode(node: any): string;
|
|
40
40
|
export declare function escape(html: string): string;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Replaced by ssrElement
|
|
43
|
+
*/
|
|
44
|
+
export declare function ssrSpread(props: any, isSVG: boolean, skipChildren: boolean): void;
|
|
42
45
|
export declare type LegacyResults = {
|
|
43
46
|
startWriting: () => void;
|
|
44
47
|
};
|
package/web/types/server.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export function ssrAttribute(key: string, value: any, isBoolean: boolean): strin
|
|
|
37
37
|
export function ssrHydrationKey(): string;
|
|
38
38
|
export function resolveSSRNode(node: any): string;
|
|
39
39
|
export function escape(html: string): string;
|
|
40
|
+
export function useAsset(fn: () => string): void;
|
|
41
|
+
export function getAssets(): string;
|
|
40
42
|
export function getHydrationKey(): string;
|
|
41
43
|
export function effect<T>(fn: (prev?: T) => T, init?: T): void;
|
|
42
44
|
export function memo<T>(fn: () => T, equal: boolean): () => T;
|