solid-js 1.2.0-beta.0 → 1.2.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 -11
- package/dist/dev.js +20 -11
- package/dist/server.cjs +1 -0
- package/dist/server.js +1 -1
- package/dist/solid.cjs +20 -11
- package/dist/solid.js +20 -11
- package/h/README.md +99 -0
- package/html/README.md +84 -0
- package/package.json +2 -2
- package/store/README.md +23 -0
- package/store/dist/dev.cjs +1 -1
- package/store/dist/dev.js +1 -1
- package/store/dist/store.cjs +1 -1
- package/store/dist/store.js +1 -1
- package/types/jsx.d.ts +4 -2
- package/types/server/index.d.ts +1 -1
- package/universal/README.md +102 -0
- package/web/README.md +7 -0
package/dist/dev.cjs
CHANGED
|
@@ -553,10 +553,11 @@ function getSuspenseContext() {
|
|
|
553
553
|
return SuspenseContext || (SuspenseContext = createContext({}));
|
|
554
554
|
}
|
|
555
555
|
function readSignal() {
|
|
556
|
-
|
|
556
|
+
const runningTransition = Transition && Transition.running;
|
|
557
|
+
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
557
558
|
const updates = Updates;
|
|
558
559
|
Updates = null;
|
|
559
|
-
this.state === STALE ||
|
|
560
|
+
!runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
|
|
560
561
|
Updates = updates;
|
|
561
562
|
}
|
|
562
563
|
if (Listener) {
|
|
@@ -576,7 +577,7 @@ function readSignal() {
|
|
|
576
577
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
577
578
|
}
|
|
578
579
|
}
|
|
579
|
-
if (
|
|
580
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
580
581
|
return this.value;
|
|
581
582
|
}
|
|
582
583
|
function writeSignal(node, value, isComp) {
|
|
@@ -624,7 +625,7 @@ function updateComputation(node) {
|
|
|
624
625
|
listener = Listener,
|
|
625
626
|
time = ExecCount;
|
|
626
627
|
Listener = Owner = node;
|
|
627
|
-
runComputation(node, node.value, time);
|
|
628
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
628
629
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
629
630
|
queueMicrotask(() => {
|
|
630
631
|
runUpdates(() => {
|
|
@@ -689,7 +690,7 @@ function runTop(node) {
|
|
|
689
690
|
const ancestors = [node];
|
|
690
691
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
691
692
|
if (runningTransition && Transition.disposed.has(node)) return;
|
|
692
|
-
if (node.state || runningTransition && node.tState) ancestors.push(node);
|
|
693
|
+
if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
|
|
693
694
|
}
|
|
694
695
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
695
696
|
node = ancestors[i];
|
|
@@ -700,9 +701,9 @@ function runTop(node) {
|
|
|
700
701
|
if (Transition.disposed.has(top)) return;
|
|
701
702
|
}
|
|
702
703
|
}
|
|
703
|
-
if (node.state === STALE || runningTransition && node.tState === STALE) {
|
|
704
|
+
if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
|
|
704
705
|
updateComputation(node);
|
|
705
|
-
} else if (node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
706
|
+
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
706
707
|
const updates = Updates;
|
|
707
708
|
Updates = null;
|
|
708
709
|
lookDownstream(node);
|
|
@@ -806,10 +807,11 @@ function runUserEffects(queue) {
|
|
|
806
807
|
}
|
|
807
808
|
function lookDownstream(node) {
|
|
808
809
|
node.state = 0;
|
|
810
|
+
const runningTransition = Transition && Transition.running;
|
|
809
811
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
810
812
|
const source = node.sources[i];
|
|
811
813
|
if (source.sources) {
|
|
812
|
-
if (source.state === STALE ||
|
|
814
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) runTop(source);else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source);
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
817
|
}
|
|
@@ -817,7 +819,7 @@ function markUpstream(node) {
|
|
|
817
819
|
const runningTransition = Transition && Transition.running;
|
|
818
820
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
819
821
|
const o = node.observers[i];
|
|
820
|
-
if (!o.state || runningTransition && !o.tState) {
|
|
822
|
+
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
821
823
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
822
824
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
823
825
|
o.observers && markUpstream(o);
|
|
@@ -1407,9 +1409,12 @@ function Suspense(props) {
|
|
|
1407
1409
|
inFallback,
|
|
1408
1410
|
effects: [],
|
|
1409
1411
|
resolved: false
|
|
1410
|
-
}
|
|
1412
|
+
},
|
|
1413
|
+
owner = getOwner();
|
|
1411
1414
|
const listContext = useContext(SuspenseListContext);
|
|
1412
1415
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1416
|
+
let dispose;
|
|
1417
|
+
onCleanup(() => dispose && dispose());
|
|
1413
1418
|
return createComponent(SuspenseContext.Provider, {
|
|
1414
1419
|
value: store,
|
|
1415
1420
|
get children() {
|
|
@@ -1418,13 +1423,17 @@ function Suspense(props) {
|
|
|
1418
1423
|
const inFallback = store.inFallback(),
|
|
1419
1424
|
visibleContent = showContent ? showContent() : true,
|
|
1420
1425
|
visibleFallback = showFallback ? showFallback() : true;
|
|
1426
|
+
dispose && dispose();
|
|
1421
1427
|
if (!inFallback && visibleContent) {
|
|
1422
1428
|
store.resolved = true;
|
|
1423
1429
|
resumeEffects(store.effects);
|
|
1424
1430
|
return rendered;
|
|
1425
1431
|
}
|
|
1426
1432
|
if (!visibleFallback) return;
|
|
1427
|
-
return
|
|
1433
|
+
return createRoot(disposer => {
|
|
1434
|
+
dispose = disposer;
|
|
1435
|
+
return props.fallback;
|
|
1436
|
+
}, owner);
|
|
1428
1437
|
});
|
|
1429
1438
|
}
|
|
1430
1439
|
});
|
package/dist/dev.js
CHANGED
|
@@ -549,10 +549,11 @@ function getSuspenseContext() {
|
|
|
549
549
|
return SuspenseContext || (SuspenseContext = createContext({}));
|
|
550
550
|
}
|
|
551
551
|
function readSignal() {
|
|
552
|
-
|
|
552
|
+
const runningTransition = Transition && Transition.running;
|
|
553
|
+
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
553
554
|
const updates = Updates;
|
|
554
555
|
Updates = null;
|
|
555
|
-
this.state === STALE ||
|
|
556
|
+
!runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
|
|
556
557
|
Updates = updates;
|
|
557
558
|
}
|
|
558
559
|
if (Listener) {
|
|
@@ -572,7 +573,7 @@ function readSignal() {
|
|
|
572
573
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
573
574
|
}
|
|
574
575
|
}
|
|
575
|
-
if (
|
|
576
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
576
577
|
return this.value;
|
|
577
578
|
}
|
|
578
579
|
function writeSignal(node, value, isComp) {
|
|
@@ -620,7 +621,7 @@ function updateComputation(node) {
|
|
|
620
621
|
listener = Listener,
|
|
621
622
|
time = ExecCount;
|
|
622
623
|
Listener = Owner = node;
|
|
623
|
-
runComputation(node, node.value, time);
|
|
624
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
624
625
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
625
626
|
queueMicrotask(() => {
|
|
626
627
|
runUpdates(() => {
|
|
@@ -685,7 +686,7 @@ function runTop(node) {
|
|
|
685
686
|
const ancestors = [node];
|
|
686
687
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
687
688
|
if (runningTransition && Transition.disposed.has(node)) return;
|
|
688
|
-
if (node.state || runningTransition && node.tState) ancestors.push(node);
|
|
689
|
+
if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
|
|
689
690
|
}
|
|
690
691
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
691
692
|
node = ancestors[i];
|
|
@@ -696,9 +697,9 @@ function runTop(node) {
|
|
|
696
697
|
if (Transition.disposed.has(top)) return;
|
|
697
698
|
}
|
|
698
699
|
}
|
|
699
|
-
if (node.state === STALE || runningTransition && node.tState === STALE) {
|
|
700
|
+
if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
|
|
700
701
|
updateComputation(node);
|
|
701
|
-
} else if (node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
702
|
+
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
702
703
|
const updates = Updates;
|
|
703
704
|
Updates = null;
|
|
704
705
|
lookDownstream(node);
|
|
@@ -802,10 +803,11 @@ function runUserEffects(queue) {
|
|
|
802
803
|
}
|
|
803
804
|
function lookDownstream(node) {
|
|
804
805
|
node.state = 0;
|
|
806
|
+
const runningTransition = Transition && Transition.running;
|
|
805
807
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
806
808
|
const source = node.sources[i];
|
|
807
809
|
if (source.sources) {
|
|
808
|
-
if (source.state === STALE ||
|
|
810
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) runTop(source);else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source);
|
|
809
811
|
}
|
|
810
812
|
}
|
|
811
813
|
}
|
|
@@ -813,7 +815,7 @@ function markUpstream(node) {
|
|
|
813
815
|
const runningTransition = Transition && Transition.running;
|
|
814
816
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
815
817
|
const o = node.observers[i];
|
|
816
|
-
if (!o.state || runningTransition && !o.tState) {
|
|
818
|
+
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
817
819
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
818
820
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
819
821
|
o.observers && markUpstream(o);
|
|
@@ -1403,9 +1405,12 @@ function Suspense(props) {
|
|
|
1403
1405
|
inFallback,
|
|
1404
1406
|
effects: [],
|
|
1405
1407
|
resolved: false
|
|
1406
|
-
}
|
|
1408
|
+
},
|
|
1409
|
+
owner = getOwner();
|
|
1407
1410
|
const listContext = useContext(SuspenseListContext);
|
|
1408
1411
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1412
|
+
let dispose;
|
|
1413
|
+
onCleanup(() => dispose && dispose());
|
|
1409
1414
|
return createComponent(SuspenseContext.Provider, {
|
|
1410
1415
|
value: store,
|
|
1411
1416
|
get children() {
|
|
@@ -1414,13 +1419,17 @@ function Suspense(props) {
|
|
|
1414
1419
|
const inFallback = store.inFallback(),
|
|
1415
1420
|
visibleContent = showContent ? showContent() : true,
|
|
1416
1421
|
visibleFallback = showFallback ? showFallback() : true;
|
|
1422
|
+
dispose && dispose();
|
|
1417
1423
|
if (!inFallback && visibleContent) {
|
|
1418
1424
|
store.resolved = true;
|
|
1419
1425
|
resumeEffects(store.effects);
|
|
1420
1426
|
return rendered;
|
|
1421
1427
|
}
|
|
1422
1428
|
if (!visibleFallback) return;
|
|
1423
|
-
return
|
|
1429
|
+
return createRoot(disposer => {
|
|
1430
|
+
dispose = disposer;
|
|
1431
|
+
return props.fallback;
|
|
1432
|
+
}, owner);
|
|
1424
1433
|
});
|
|
1425
1434
|
}
|
|
1426
1435
|
});
|
package/dist/server.cjs
CHANGED
|
@@ -510,6 +510,7 @@ exports.SuspenseList = SuspenseList;
|
|
|
510
510
|
exports.Switch = Switch;
|
|
511
511
|
exports.awaitSuspense = awaitSuspense;
|
|
512
512
|
exports.batch = batch;
|
|
513
|
+
exports.children = children;
|
|
513
514
|
exports.createComponent = createComponent;
|
|
514
515
|
exports.createComputed = createComputed;
|
|
515
516
|
exports.createContext = createContext;
|
package/dist/server.js
CHANGED
|
@@ -494,4 +494,4 @@ function awaitSuspense(fn) {
|
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, awaitSuspense, batch, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
497
|
+
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, awaitSuspense, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -502,10 +502,11 @@ function getSuspenseContext() {
|
|
|
502
502
|
return SuspenseContext || (SuspenseContext = createContext({}));
|
|
503
503
|
}
|
|
504
504
|
function readSignal() {
|
|
505
|
-
|
|
505
|
+
const runningTransition = Transition && Transition.running;
|
|
506
|
+
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
506
507
|
const updates = Updates;
|
|
507
508
|
Updates = null;
|
|
508
|
-
this.state === STALE ||
|
|
509
|
+
!runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
|
|
509
510
|
Updates = updates;
|
|
510
511
|
}
|
|
511
512
|
if (Listener) {
|
|
@@ -525,7 +526,7 @@ function readSignal() {
|
|
|
525
526
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
526
527
|
}
|
|
527
528
|
}
|
|
528
|
-
if (
|
|
529
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
529
530
|
return this.value;
|
|
530
531
|
}
|
|
531
532
|
function writeSignal(node, value, isComp) {
|
|
@@ -573,7 +574,7 @@ function updateComputation(node) {
|
|
|
573
574
|
listener = Listener,
|
|
574
575
|
time = ExecCount;
|
|
575
576
|
Listener = Owner = node;
|
|
576
|
-
runComputation(node, node.value, time);
|
|
577
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
577
578
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
578
579
|
queueMicrotask(() => {
|
|
579
580
|
runUpdates(() => {
|
|
@@ -637,7 +638,7 @@ function runTop(node) {
|
|
|
637
638
|
const ancestors = [node];
|
|
638
639
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
639
640
|
if (runningTransition && Transition.disposed.has(node)) return;
|
|
640
|
-
if (node.state || runningTransition && node.tState) ancestors.push(node);
|
|
641
|
+
if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
|
|
641
642
|
}
|
|
642
643
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
643
644
|
node = ancestors[i];
|
|
@@ -648,9 +649,9 @@ function runTop(node) {
|
|
|
648
649
|
if (Transition.disposed.has(top)) return;
|
|
649
650
|
}
|
|
650
651
|
}
|
|
651
|
-
if (node.state === STALE || runningTransition && node.tState === STALE) {
|
|
652
|
+
if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
|
|
652
653
|
updateComputation(node);
|
|
653
|
-
} else if (node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
654
|
+
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
654
655
|
const updates = Updates;
|
|
655
656
|
Updates = null;
|
|
656
657
|
lookDownstream(node);
|
|
@@ -753,10 +754,11 @@ function runUserEffects(queue) {
|
|
|
753
754
|
}
|
|
754
755
|
function lookDownstream(node) {
|
|
755
756
|
node.state = 0;
|
|
757
|
+
const runningTransition = Transition && Transition.running;
|
|
756
758
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
757
759
|
const source = node.sources[i];
|
|
758
760
|
if (source.sources) {
|
|
759
|
-
if (source.state === STALE ||
|
|
761
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) runTop(source);else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source);
|
|
760
762
|
}
|
|
761
763
|
}
|
|
762
764
|
}
|
|
@@ -764,7 +766,7 @@ function markUpstream(node) {
|
|
|
764
766
|
const runningTransition = Transition && Transition.running;
|
|
765
767
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
766
768
|
const o = node.observers[i];
|
|
767
|
-
if (!o.state || runningTransition && !o.tState) {
|
|
769
|
+
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
768
770
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
769
771
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
770
772
|
o.observers && markUpstream(o);
|
|
@@ -1331,9 +1333,12 @@ function Suspense(props) {
|
|
|
1331
1333
|
inFallback,
|
|
1332
1334
|
effects: [],
|
|
1333
1335
|
resolved: false
|
|
1334
|
-
}
|
|
1336
|
+
},
|
|
1337
|
+
owner = getOwner();
|
|
1335
1338
|
const listContext = useContext(SuspenseListContext);
|
|
1336
1339
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1340
|
+
let dispose;
|
|
1341
|
+
onCleanup(() => dispose && dispose());
|
|
1337
1342
|
return createComponent(SuspenseContext.Provider, {
|
|
1338
1343
|
value: store,
|
|
1339
1344
|
get children() {
|
|
@@ -1342,13 +1347,17 @@ function Suspense(props) {
|
|
|
1342
1347
|
const inFallback = store.inFallback(),
|
|
1343
1348
|
visibleContent = showContent ? showContent() : true,
|
|
1344
1349
|
visibleFallback = showFallback ? showFallback() : true;
|
|
1350
|
+
dispose && dispose();
|
|
1345
1351
|
if (!inFallback && visibleContent) {
|
|
1346
1352
|
store.resolved = true;
|
|
1347
1353
|
resumeEffects(store.effects);
|
|
1348
1354
|
return rendered;
|
|
1349
1355
|
}
|
|
1350
1356
|
if (!visibleFallback) return;
|
|
1351
|
-
return
|
|
1357
|
+
return createRoot(disposer => {
|
|
1358
|
+
dispose = disposer;
|
|
1359
|
+
return props.fallback;
|
|
1360
|
+
}, owner);
|
|
1352
1361
|
});
|
|
1353
1362
|
}
|
|
1354
1363
|
});
|
package/dist/solid.js
CHANGED
|
@@ -498,10 +498,11 @@ function getSuspenseContext() {
|
|
|
498
498
|
return SuspenseContext || (SuspenseContext = createContext({}));
|
|
499
499
|
}
|
|
500
500
|
function readSignal() {
|
|
501
|
-
|
|
501
|
+
const runningTransition = Transition && Transition.running;
|
|
502
|
+
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
502
503
|
const updates = Updates;
|
|
503
504
|
Updates = null;
|
|
504
|
-
this.state === STALE ||
|
|
505
|
+
!runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
|
|
505
506
|
Updates = updates;
|
|
506
507
|
}
|
|
507
508
|
if (Listener) {
|
|
@@ -521,7 +522,7 @@ function readSignal() {
|
|
|
521
522
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
|
-
if (
|
|
525
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
525
526
|
return this.value;
|
|
526
527
|
}
|
|
527
528
|
function writeSignal(node, value, isComp) {
|
|
@@ -569,7 +570,7 @@ function updateComputation(node) {
|
|
|
569
570
|
listener = Listener,
|
|
570
571
|
time = ExecCount;
|
|
571
572
|
Listener = Owner = node;
|
|
572
|
-
runComputation(node, node.value, time);
|
|
573
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
573
574
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
574
575
|
queueMicrotask(() => {
|
|
575
576
|
runUpdates(() => {
|
|
@@ -633,7 +634,7 @@ function runTop(node) {
|
|
|
633
634
|
const ancestors = [node];
|
|
634
635
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
635
636
|
if (runningTransition && Transition.disposed.has(node)) return;
|
|
636
|
-
if (node.state || runningTransition && node.tState) ancestors.push(node);
|
|
637
|
+
if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
|
|
637
638
|
}
|
|
638
639
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
639
640
|
node = ancestors[i];
|
|
@@ -644,9 +645,9 @@ function runTop(node) {
|
|
|
644
645
|
if (Transition.disposed.has(top)) return;
|
|
645
646
|
}
|
|
646
647
|
}
|
|
647
|
-
if (node.state === STALE || runningTransition && node.tState === STALE) {
|
|
648
|
+
if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
|
|
648
649
|
updateComputation(node);
|
|
649
|
-
} else if (node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
650
|
+
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
650
651
|
const updates = Updates;
|
|
651
652
|
Updates = null;
|
|
652
653
|
lookDownstream(node);
|
|
@@ -749,10 +750,11 @@ function runUserEffects(queue) {
|
|
|
749
750
|
}
|
|
750
751
|
function lookDownstream(node) {
|
|
751
752
|
node.state = 0;
|
|
753
|
+
const runningTransition = Transition && Transition.running;
|
|
752
754
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
753
755
|
const source = node.sources[i];
|
|
754
756
|
if (source.sources) {
|
|
755
|
-
if (source.state === STALE ||
|
|
757
|
+
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) runTop(source);else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source);
|
|
756
758
|
}
|
|
757
759
|
}
|
|
758
760
|
}
|
|
@@ -760,7 +762,7 @@ function markUpstream(node) {
|
|
|
760
762
|
const runningTransition = Transition && Transition.running;
|
|
761
763
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
762
764
|
const o = node.observers[i];
|
|
763
|
-
if (!o.state || runningTransition && !o.tState) {
|
|
765
|
+
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
764
766
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
765
767
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
766
768
|
o.observers && markUpstream(o);
|
|
@@ -1327,9 +1329,12 @@ function Suspense(props) {
|
|
|
1327
1329
|
inFallback,
|
|
1328
1330
|
effects: [],
|
|
1329
1331
|
resolved: false
|
|
1330
|
-
}
|
|
1332
|
+
},
|
|
1333
|
+
owner = getOwner();
|
|
1331
1334
|
const listContext = useContext(SuspenseListContext);
|
|
1332
1335
|
if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
|
|
1336
|
+
let dispose;
|
|
1337
|
+
onCleanup(() => dispose && dispose());
|
|
1333
1338
|
return createComponent(SuspenseContext.Provider, {
|
|
1334
1339
|
value: store,
|
|
1335
1340
|
get children() {
|
|
@@ -1338,13 +1343,17 @@ function Suspense(props) {
|
|
|
1338
1343
|
const inFallback = store.inFallback(),
|
|
1339
1344
|
visibleContent = showContent ? showContent() : true,
|
|
1340
1345
|
visibleFallback = showFallback ? showFallback() : true;
|
|
1346
|
+
dispose && dispose();
|
|
1341
1347
|
if (!inFallback && visibleContent) {
|
|
1342
1348
|
store.resolved = true;
|
|
1343
1349
|
resumeEffects(store.effects);
|
|
1344
1350
|
return rendered;
|
|
1345
1351
|
}
|
|
1346
1352
|
if (!visibleFallback) return;
|
|
1347
|
-
return
|
|
1353
|
+
return createRoot(disposer => {
|
|
1354
|
+
dispose = disposer;
|
|
1355
|
+
return props.fallback;
|
|
1356
|
+
}, owner);
|
|
1348
1357
|
});
|
|
1349
1358
|
}
|
|
1350
1359
|
});
|
package/h/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Solid HyperScript
|
|
2
|
+
|
|
3
|
+
This sub module provides a HyperScript method for Solid. This is useful to use Solid in non-compiled environments or in some environments where you can only use a standard JSX transform. This method can be used as the JSX factory function.
|
|
4
|
+
|
|
5
|
+
HyperScript function takes a few forms. The 2nd props argument is optional. Children may be passed as either an array to the 2nd/3rd argument or as every argument past the 2nd.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
// create an element with a title attribute
|
|
9
|
+
h("button", { title: "My button" }, "Click Me")
|
|
10
|
+
|
|
11
|
+
// create a component with a title prop
|
|
12
|
+
h(Button, { title: "My button" }, "Click Me")
|
|
13
|
+
|
|
14
|
+
// create an element with many children
|
|
15
|
+
h("div", { title: "My button" }, h("span", "1"), h("span", "2"), h("span", "3"))
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This is the least efficient way to use Solid as it requires a slightly larger runtime that isn't treeshakebable, and cannot leverage anything in the way of analysis, so it requires manual wrapping of expressions and has a few other caveats (see below).
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { render } from "solid-js/web";
|
|
24
|
+
import h from "solid-js/h";
|
|
25
|
+
import { createSignal } from "solid-js";
|
|
26
|
+
|
|
27
|
+
function Button(props) {
|
|
28
|
+
return h("button.btn-primary", props)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function Counter() {
|
|
32
|
+
const [count, setCount] = createSignal(0);
|
|
33
|
+
const increment = (e) => setCount(c => c + 1);
|
|
34
|
+
|
|
35
|
+
return h(Button, { type: "button", onClick: increment }, count);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render(Counter, document.getElementById("app"));
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Differences from JSX
|
|
42
|
+
|
|
43
|
+
There are a few differences from Solid's JSX that are important to note. And also apply when attempting use any transformation that would compile to HyperScript.
|
|
44
|
+
|
|
45
|
+
1. Reactive expression must be manually wrapped in functions to be reactive.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// jsx
|
|
49
|
+
<div id={props.id}>{firstName() + lastName()}</div>
|
|
50
|
+
|
|
51
|
+
// hyperscript
|
|
52
|
+
h("div", { id: () => props.id }, () => firstName() + lastName())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. Merging spreads requires using the merge props helper to keep reactivity
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
// jsx
|
|
59
|
+
<div class={selectedClass()} {...props} />
|
|
60
|
+
|
|
61
|
+
// hyperscript
|
|
62
|
+
import { mergeProps } from "solid-js"
|
|
63
|
+
|
|
64
|
+
h("div", mergeProps({ class: selectedClass }, props))
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. Events on components require explicit event in the arguments
|
|
68
|
+
|
|
69
|
+
Solid's HyperScript automatically wraps functions passed to props of components with no arguments in getters so you need to provide one to prevent this. The same applies to render props like in the `<For>` component.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// good
|
|
73
|
+
h(Button, { onClick: (e) => console.log("Hi")});
|
|
74
|
+
|
|
75
|
+
// bad
|
|
76
|
+
h(Button, { onClick: () => console.log("Hi")})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4. All refs are callback form
|
|
80
|
+
|
|
81
|
+
We can't do the compiled assigment trick so only the callback form is supported.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
let myEl;
|
|
85
|
+
|
|
86
|
+
h(div, { ref: (el) => myEl = el });
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
5. There is a shorthand for static id and classes
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
h("div#some-id.my-class")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
6. Fragments are just arrays
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
[h("span", "1"), h("span", "2")]
|
|
99
|
+
```
|
package/html/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Solid Tagged Template Literals
|
|
2
|
+
|
|
3
|
+
This sub module provides a Tagged Template Literal `html` method for Solid. This is useful to use Solid in non-compiled environments. This method can be used as replacement for JSX.
|
|
4
|
+
|
|
5
|
+
`html` uses `${}` to escape into JavaScript expressions. Components are closed with `<//>`
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
// create an element with a title attribute
|
|
9
|
+
html`<button title="My button">Click Me</button>`
|
|
10
|
+
|
|
11
|
+
// create a component with a title prop
|
|
12
|
+
html`<${Button} title="My button">Click me<//>`
|
|
13
|
+
|
|
14
|
+
// create an element with dynamic attribute and spread
|
|
15
|
+
html`<div title=${() => selectedClass()} ...${props} />`
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Using `html` is slightly less efficient than JSX(but more than HyperScript), requires a larger runtime that isn't treeshakebable, and cannot leverage expression analysis, so it requires manual wrapping of expressions and has a few other caveats (see below).
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { render } from "solid-js/web";
|
|
24
|
+
import html from "solid-js/html";
|
|
25
|
+
import { createSignal } from "solid-js";
|
|
26
|
+
|
|
27
|
+
function Button(props) {
|
|
28
|
+
return html`<button class="btn-primary" ...${props} />`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function Counter() {
|
|
32
|
+
const [count, setCount] = createSignal(0);
|
|
33
|
+
const increment = (e) => setCount((c) => c + 1);
|
|
34
|
+
|
|
35
|
+
return html`<${Button} type="button" onClick=${increment}>${count}<//>`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render(Counter, document.getElementById("app"));
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Differences from JSX
|
|
42
|
+
|
|
43
|
+
There are a few differences from Solid's JSX that are important to note.
|
|
44
|
+
|
|
45
|
+
1. Reactive expression must be manually wrapped in functions to be reactive.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// jsx
|
|
49
|
+
<div id={props.id}>{firstName() + lastName()}</div>
|
|
50
|
+
|
|
51
|
+
// hyperscript
|
|
52
|
+
html`<div id=${() => props.id}>${() => firstName() + lastName()}</div>`
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. Events on components require explicit event in the arguments
|
|
56
|
+
|
|
57
|
+
Solid's Tagged Template Literals automatically wraps functions passed to props of components with no arguments in getters so you need to provide one to prevent this. The same applies to render props like in the `<For>` component.
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
// good
|
|
61
|
+
html`<${Button} onClick=${(e) => console.log("Hi")} />`;
|
|
62
|
+
|
|
63
|
+
// bad
|
|
64
|
+
html`<${Button} onClick=${() => console.log("Hi")} />`;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
4. All refs are callback form
|
|
68
|
+
|
|
69
|
+
We can't do the compiled assigment trick so only the callback form is supported.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
let myEl;
|
|
73
|
+
html`<div ref=${(el) => myEl = el} />`;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
5. There can be multiple top level elements
|
|
77
|
+
|
|
78
|
+
No need for fragments just:
|
|
79
|
+
```js
|
|
80
|
+
html`
|
|
81
|
+
<div>1</div>
|
|
82
|
+
<div>2</div>
|
|
83
|
+
`
|
|
84
|
+
```
|
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.2.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/solidjs/solid#readme",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"compiler",
|
|
133
133
|
"performance"
|
|
134
134
|
],
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "151eee8891045ff05229d6e38a71742c597102ba"
|
|
136
136
|
}
|
package/store/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Solid Store
|
|
2
|
+
|
|
3
|
+
This submodules contains the means for handling deeps nested reactivity. It provides 2 main primitives `createStore` and `createMutable` which leverage proxies to create dynamic nested reactive structures.
|
|
4
|
+
|
|
5
|
+
This also contains helper methods `produce` and `reconcile` which augment the behavior of the store setter method to allow for localized mutationa and data diffing.
|
|
6
|
+
|
|
7
|
+
For full documentation, check out the [website](https://www.solidjs.com/docs/latest/api).
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createStore } from "solid-js/store";
|
|
13
|
+
|
|
14
|
+
const [store, setStore] = createStore({
|
|
15
|
+
user: {
|
|
16
|
+
firstName: "John",
|
|
17
|
+
lastName: "Smith"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// update store.user.firstName
|
|
22
|
+
setStore("user", "firstName", "Will");
|
|
23
|
+
```
|
package/store/dist/dev.cjs
CHANGED
|
@@ -65,7 +65,7 @@ function getDataNodes(target) {
|
|
|
65
65
|
}
|
|
66
66
|
function proxyDescriptor(target, property) {
|
|
67
67
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
68
|
-
if (!desc || desc.get || property === solidJs.$PROXY || property === $NODE || property === $NAME) return desc;
|
|
68
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE || property === $NAME) return desc;
|
|
69
69
|
delete desc.value;
|
|
70
70
|
delete desc.writable;
|
|
71
71
|
desc.get = () => target[solidJs.$PROXY][property];
|
package/store/dist/dev.js
CHANGED
|
@@ -61,7 +61,7 @@ function getDataNodes(target) {
|
|
|
61
61
|
}
|
|
62
62
|
function proxyDescriptor(target, property) {
|
|
63
63
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
64
|
-
if (!desc || desc.get || property === $PROXY || property === $NODE || property === $NAME) return desc;
|
|
64
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc;
|
|
65
65
|
delete desc.value;
|
|
66
66
|
delete desc.writable;
|
|
67
67
|
desc.get = () => target[$PROXY][property];
|
package/store/dist/store.cjs
CHANGED
|
@@ -62,7 +62,7 @@ function getDataNodes(target) {
|
|
|
62
62
|
}
|
|
63
63
|
function proxyDescriptor(target, property) {
|
|
64
64
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
65
|
-
if (!desc || desc.get || property === solidJs.$PROXY || property === $NODE || property === $NAME) return desc;
|
|
65
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE || property === $NAME) return desc;
|
|
66
66
|
delete desc.value;
|
|
67
67
|
delete desc.writable;
|
|
68
68
|
desc.get = () => target[solidJs.$PROXY][property];
|
package/store/dist/store.js
CHANGED
|
@@ -58,7 +58,7 @@ function getDataNodes(target) {
|
|
|
58
58
|
}
|
|
59
59
|
function proxyDescriptor(target, property) {
|
|
60
60
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
61
|
-
if (!desc || desc.get || property === $PROXY || property === $NODE || property === $NAME) return desc;
|
|
61
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc;
|
|
62
62
|
delete desc.value;
|
|
63
63
|
delete desc.writable;
|
|
64
64
|
desc.get = () => target[$PROXY][property];
|
package/types/jsx.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export namespace JSX {
|
|
|
11
11
|
| Node
|
|
12
12
|
| ArrayElement
|
|
13
13
|
| FunctionElement
|
|
14
|
-
| string
|
|
14
|
+
| (string & {})
|
|
15
15
|
| number
|
|
16
16
|
| boolean
|
|
17
17
|
| null
|
|
@@ -2874,7 +2874,8 @@ export namespace JSX {
|
|
|
2874
2874
|
extends FilterPrimitiveElementSVGAttributes<T>,
|
|
2875
2875
|
ExternalResourceSVGAttributes,
|
|
2876
2876
|
StylableSVGAttributes {
|
|
2877
|
-
preserveAspectRatio
|
|
2877
|
+
preserveAspectRatio?: SVGPreserveAspectRatio;
|
|
2878
|
+
href?: string;
|
|
2878
2879
|
}
|
|
2879
2880
|
interface FeMergeSVGAttributes<T>
|
|
2880
2881
|
extends FilterPrimitiveElementSVGAttributes<T>,
|
|
@@ -2977,6 +2978,7 @@ export namespace JSX {
|
|
|
2977
2978
|
width?: number | string;
|
|
2978
2979
|
height?: number | string;
|
|
2979
2980
|
preserveAspectRatio?: ImagePreserveAspectRatio;
|
|
2981
|
+
href?: string;
|
|
2980
2982
|
}
|
|
2981
2983
|
interface LineSVGAttributes<T>
|
|
2982
2984
|
extends GraphicsElementSVGAttributes<T>,
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, DEV } from "./reactive";
|
|
1
|
+
export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, DEV } from "./reactive";
|
|
2
2
|
export { awaitSuspense, mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, enableScheduling, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
3
3
|
export type { Component, Resource } from "./rendering";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Solid Universal
|
|
2
|
+
|
|
3
|
+
This contains the means to create the runtime for a custom renderer for Solid. This can enable using Solid to render to different platforms like native mobile and desktop, canvas or WebGL, or even the terminal. It relies on custom compilation from `babel-preset-solid` and exporting the result of `createRenderer` at a referenceable location.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
To use a custom renderer available in the (fictional) `solid-custom-dom` package you'd configure your babelrc as:
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"presets": [
|
|
11
|
+
[
|
|
12
|
+
"babel-preset-solid",
|
|
13
|
+
{
|
|
14
|
+
"moduleName": "solid-custom-dom",
|
|
15
|
+
"generate": "universal"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To create a custom renderer you must implement certain methods and export (as named exports) the results. You may also want to forward `solid-js` control flow to allow them to be auto imported as well.
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
// example custom dom renderer
|
|
26
|
+
import { createRenderer } from "solid-js/universal";
|
|
27
|
+
|
|
28
|
+
const PROPERTIES = new Set(["className", "textContent"]);
|
|
29
|
+
|
|
30
|
+
export const {
|
|
31
|
+
render,
|
|
32
|
+
effect,
|
|
33
|
+
memo,
|
|
34
|
+
createComponent,
|
|
35
|
+
createElement,
|
|
36
|
+
createTextNode,
|
|
37
|
+
insertNode,
|
|
38
|
+
insert,
|
|
39
|
+
spread,
|
|
40
|
+
setProp,
|
|
41
|
+
mergeProps
|
|
42
|
+
} = createRenderer({
|
|
43
|
+
createElement(string) {
|
|
44
|
+
return document.createElement(string);
|
|
45
|
+
},
|
|
46
|
+
createTextNode(value) {
|
|
47
|
+
return document.createTextNode(value);
|
|
48
|
+
},
|
|
49
|
+
replaceText(textNode, value) {
|
|
50
|
+
textNode.data = value;
|
|
51
|
+
},
|
|
52
|
+
setProperty(node, name, value) {
|
|
53
|
+
if (name === "style") Object.assign(node.style, value);
|
|
54
|
+
else if (name.startsWith("on")) node[name.toLowerCase()] = value;
|
|
55
|
+
else if (PROPERTIES.has(name)) node[name] = value;
|
|
56
|
+
else node.setAttribute(name, value);
|
|
57
|
+
},
|
|
58
|
+
insertNode(parent, node, anchor) {
|
|
59
|
+
parent.insertBefore(node, anchor);
|
|
60
|
+
},
|
|
61
|
+
isTextNode(node) {
|
|
62
|
+
return node.type === 3;
|
|
63
|
+
},
|
|
64
|
+
removeNode(parent, node) {
|
|
65
|
+
parent.removeChild(node);
|
|
66
|
+
},
|
|
67
|
+
getParentNode(node) {
|
|
68
|
+
return node.parentNode;
|
|
69
|
+
},
|
|
70
|
+
getFirstChild(node) {
|
|
71
|
+
return node.firstChild;
|
|
72
|
+
},
|
|
73
|
+
getNextSibling(node) {
|
|
74
|
+
return node.nextSibling;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Forward Solid control flow
|
|
79
|
+
export {
|
|
80
|
+
For,
|
|
81
|
+
Show,
|
|
82
|
+
Suspense,
|
|
83
|
+
SuspenseList,
|
|
84
|
+
Switch,
|
|
85
|
+
Match,
|
|
86
|
+
Index,
|
|
87
|
+
ErrorBoundary
|
|
88
|
+
} from "solid-js";
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Then to consume:
|
|
92
|
+
```js
|
|
93
|
+
import { render } from "solid-custom-dom";
|
|
94
|
+
|
|
95
|
+
function App() {
|
|
96
|
+
// the skies the limits
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
render(() => <App />, mountNode)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
> Note: For TypeScript support of non-standard JSX you will need to provide your own types at a jsx-runtime entry on your package so that it can be set as the `jsxImportSource`. If mixing and matching different JSX implementations you will need use the per file pragmas.
|
package/web/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Solid Web
|
|
2
|
+
|
|
3
|
+
This submodule contains the web specific APIs for Solid that are mostly internal methods imported during compilation. It has all the code to render for the web on the server and the browser.
|
|
4
|
+
|
|
5
|
+
In addition this modules provides the primary entry point methods `render`, `hydrate`, `renderToString`, `renderToStringAsync`, `pipeToNodeWritable`, and `pipeToWritable`. As well as a few web specific control flow components `<Portal>` and `<Dynamic>`.
|
|
6
|
+
|
|
7
|
+
Refer to the [website](https://www.solidjs.com/docs/latest/api) for documentation.
|