solid-js 2.0.0-beta.10 → 2.0.0-beta.12
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/CHEATSHEET.md +6 -5
- package/dist/dev.cjs +24 -12
- package/dist/dev.js +25 -12
- package/dist/server.cjs +360 -142
- package/dist/server.js +286 -43
- package/dist/solid.cjs +26 -12
- package/dist/solid.js +27 -12
- package/package.json +2 -2
- package/types/client/flow.d.ts +75 -14
- package/types/client/hydration.d.ts +14 -16
- package/types/index.d.ts +1 -3
- package/types/server/core.d.ts +0 -7
- package/types/server/flow.d.ts +58 -5
- package/types/server/index.d.ts +1 -1
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +53 -8
- package/types-cjs/client/flow.d.cts +75 -14
- package/types-cjs/client/hydration.d.cts +14 -16
- package/types-cjs/index.d.cts +1 -3
- package/types-cjs/server/core.d.cts +0 -7
- package/types-cjs/server/flow.d.cts +58 -5
- package/types-cjs/server/index.d.cts +1 -1
- package/types-cjs/server/shared.d.cts +5 -1
- package/types-cjs/server/signals.d.cts +53 -8
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { $PROXY, $REFRESH, $TRACK, NotReadyError,
|
|
1
|
+
import { NotReadyError, $REFRESH, merge as merge$1, isWrappable, NoOwnerError, ContextNotFoundError, $PROXY, flatten } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $REFRESH, $TRACK, NotReadyError, enableExternalSource, enforceLoadingBoundary, flatten, isEqual, isWrappable, omit, snapshot, storePath } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const NoHydrateContext = {
|
|
5
5
|
id: Symbol("NoHydrateContext"),
|
|
@@ -14,6 +14,147 @@ const sharedConfig = {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const defaultSSRContext = {};
|
|
18
|
+
let currentOwner = null;
|
|
19
|
+
const OWNER_POOL_MAX = 4096;
|
|
20
|
+
const ownerPool = [];
|
|
21
|
+
function formatChildId(prefix, id) {
|
|
22
|
+
const num = id.toString(36);
|
|
23
|
+
const len = num.length - 1;
|
|
24
|
+
return prefix + (len ? String.fromCharCode(64 + len) : "") + num;
|
|
25
|
+
}
|
|
26
|
+
function nextChildIdFor(owner, consume) {
|
|
27
|
+
let counter = owner;
|
|
28
|
+
while (counter._transparent && counter._parent) counter = counter._parent;
|
|
29
|
+
if (counter.id != null) {
|
|
30
|
+
return formatChildId(counter.id, counter._childCount++ );
|
|
31
|
+
}
|
|
32
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
33
|
+
}
|
|
34
|
+
function consumeClientComputedSlot(owner) {
|
|
35
|
+
if (owner?.id != null) nextChildIdFor(owner);
|
|
36
|
+
}
|
|
37
|
+
function getNextChildId(owner) {
|
|
38
|
+
return nextChildIdFor(owner);
|
|
39
|
+
}
|
|
40
|
+
function createOwner(options) {
|
|
41
|
+
const parent = currentOwner;
|
|
42
|
+
const transparent = options?.transparent ?? false;
|
|
43
|
+
const id = options?.id ?? (transparent ? parent?.id : parent?.id != null ? nextChildIdFor(parent) : undefined);
|
|
44
|
+
const ctx = parent?._context ?? defaultSSRContext;
|
|
45
|
+
let owner;
|
|
46
|
+
if (ownerPool.length) {
|
|
47
|
+
owner = ownerPool.pop();
|
|
48
|
+
owner.id = id;
|
|
49
|
+
owner._transparent = transparent;
|
|
50
|
+
owner._disposal = null;
|
|
51
|
+
owner._parent = parent;
|
|
52
|
+
owner._context = ctx;
|
|
53
|
+
owner._childCount = 0;
|
|
54
|
+
owner._firstChild = null;
|
|
55
|
+
owner._nextSibling = null;
|
|
56
|
+
owner._disposed = false;
|
|
57
|
+
} else {
|
|
58
|
+
owner = {
|
|
59
|
+
id,
|
|
60
|
+
_transparent: transparent,
|
|
61
|
+
_disposal: null,
|
|
62
|
+
_parent: parent,
|
|
63
|
+
_context: ctx,
|
|
64
|
+
_childCount: 0,
|
|
65
|
+
_firstChild: null,
|
|
66
|
+
_nextSibling: null,
|
|
67
|
+
_disposed: false
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (parent) {
|
|
71
|
+
const lastChild = parent._firstChild;
|
|
72
|
+
if (lastChild) owner._nextSibling = lastChild;
|
|
73
|
+
parent._firstChild = owner;
|
|
74
|
+
}
|
|
75
|
+
return owner;
|
|
76
|
+
}
|
|
77
|
+
function runWithOwner(owner, fn) {
|
|
78
|
+
const prev = currentOwner;
|
|
79
|
+
currentOwner = owner;
|
|
80
|
+
try {
|
|
81
|
+
return fn();
|
|
82
|
+
} finally {
|
|
83
|
+
currentOwner = prev;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function getOwner() {
|
|
87
|
+
return currentOwner;
|
|
88
|
+
}
|
|
89
|
+
function isDisposed(owner) {
|
|
90
|
+
return owner._disposed;
|
|
91
|
+
}
|
|
92
|
+
function onCleanup(fn) {
|
|
93
|
+
const o = currentOwner;
|
|
94
|
+
if (!o) return fn;
|
|
95
|
+
if (!o._disposal) o._disposal = fn;else if (Array.isArray(o._disposal)) o._disposal.push(fn);else o._disposal = [o._disposal, fn];
|
|
96
|
+
return fn;
|
|
97
|
+
}
|
|
98
|
+
function getContext(context, owner = currentOwner) {
|
|
99
|
+
if (!owner) throw new NoOwnerError();
|
|
100
|
+
const map = owner._context;
|
|
101
|
+
const stored = map[context.id];
|
|
102
|
+
const value = stored !== undefined ? stored : context.defaultValue;
|
|
103
|
+
if (value === undefined) throw new ContextNotFoundError();
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
function setContext(context, value, owner = currentOwner) {
|
|
107
|
+
if (!owner) throw new NoOwnerError();
|
|
108
|
+
const o = owner;
|
|
109
|
+
o._context = {
|
|
110
|
+
...o._context,
|
|
111
|
+
[context.id]: value === undefined ? context.defaultValue : value
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function disposeOwner(owner, self = true) {
|
|
115
|
+
const node = owner;
|
|
116
|
+
if (node._disposed) return;
|
|
117
|
+
if (!node._firstChild && !node._disposal) {
|
|
118
|
+
if (self) {
|
|
119
|
+
node._disposed = true;
|
|
120
|
+
if (ownerPool.length < OWNER_POOL_MAX) {
|
|
121
|
+
node.id = undefined;
|
|
122
|
+
node._parent = null;
|
|
123
|
+
node._nextSibling = null;
|
|
124
|
+
ownerPool.push(node);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (self) node._disposed = true;
|
|
130
|
+
let child = node._firstChild;
|
|
131
|
+
while (child) {
|
|
132
|
+
const next = child._nextSibling;
|
|
133
|
+
disposeOwner(child, true);
|
|
134
|
+
child = next;
|
|
135
|
+
}
|
|
136
|
+
node._firstChild = null;
|
|
137
|
+
node._childCount = 0;
|
|
138
|
+
const d = node._disposal;
|
|
139
|
+
if (d) {
|
|
140
|
+
if (Array.isArray(d)) {
|
|
141
|
+
for (let i = 0, len = d.length; i < len; i++) d[i]();
|
|
142
|
+
} else {
|
|
143
|
+
d();
|
|
144
|
+
}
|
|
145
|
+
node._disposal = null;
|
|
146
|
+
}
|
|
147
|
+
if (self && ownerPool.length < OWNER_POOL_MAX) {
|
|
148
|
+
node.id = undefined;
|
|
149
|
+
node._parent = null;
|
|
150
|
+
node._nextSibling = null;
|
|
151
|
+
ownerPool.push(node);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function createRoot(init, options) {
|
|
155
|
+
const owner = createOwner(options);
|
|
156
|
+
return runWithOwner(owner, () => init(() => disposeOwner(owner)));
|
|
157
|
+
}
|
|
17
158
|
let Observer = null;
|
|
18
159
|
function runWithObserver(comp, fn) {
|
|
19
160
|
const prev = Observer;
|
|
@@ -98,6 +239,9 @@ function createSignal(first, second) {
|
|
|
98
239
|
}];
|
|
99
240
|
}
|
|
100
241
|
function createMemo(compute, options) {
|
|
242
|
+
if (options?.sync) {
|
|
243
|
+
return createSyncMemo(compute, options);
|
|
244
|
+
}
|
|
101
245
|
const ctx = sharedConfig.context;
|
|
102
246
|
const owner = createOwner();
|
|
103
247
|
const comp = {
|
|
@@ -133,7 +277,7 @@ function createMemo(compute, options) {
|
|
|
133
277
|
} else if (!options?.lazy) {
|
|
134
278
|
update();
|
|
135
279
|
}
|
|
136
|
-
|
|
280
|
+
const read = () => {
|
|
137
281
|
if (!comp.computed) {
|
|
138
282
|
update();
|
|
139
283
|
}
|
|
@@ -142,6 +286,44 @@ function createMemo(compute, options) {
|
|
|
142
286
|
}
|
|
143
287
|
return comp.value;
|
|
144
288
|
};
|
|
289
|
+
read[$REFRESH] = comp;
|
|
290
|
+
return read;
|
|
291
|
+
}
|
|
292
|
+
function createSyncMemo(compute, options) {
|
|
293
|
+
const owner = createOwner();
|
|
294
|
+
let value;
|
|
295
|
+
let error;
|
|
296
|
+
let cached = false;
|
|
297
|
+
function pull() {
|
|
298
|
+
const prev = currentOwner;
|
|
299
|
+
currentOwner = owner;
|
|
300
|
+
try {
|
|
301
|
+
value = compute(value);
|
|
302
|
+
error = undefined;
|
|
303
|
+
cached = true;
|
|
304
|
+
return value;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
if (err instanceof NotReadyError) throw err;
|
|
307
|
+
error = err;
|
|
308
|
+
cached = true;
|
|
309
|
+
throw err;
|
|
310
|
+
} finally {
|
|
311
|
+
currentOwner = prev;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (!options?.lazy) {
|
|
315
|
+
try {
|
|
316
|
+
pull();
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return () => {
|
|
321
|
+
if (cached) {
|
|
322
|
+
if (error !== undefined) throw error;
|
|
323
|
+
return value;
|
|
324
|
+
}
|
|
325
|
+
return pull();
|
|
326
|
+
};
|
|
145
327
|
}
|
|
146
328
|
function createDeepProxy(target, patches, basePath = []) {
|
|
147
329
|
const childProxies = new Map();
|
|
@@ -566,46 +748,104 @@ function reconcile(value) {
|
|
|
566
748
|
function deep(store) {
|
|
567
749
|
return store;
|
|
568
750
|
}
|
|
751
|
+
function proxySource(read) {
|
|
752
|
+
return new Proxy({}, {
|
|
753
|
+
get(_, property, receiver) {
|
|
754
|
+
if (property === $PROXY) return receiver;
|
|
755
|
+
const source = read() || {};
|
|
756
|
+
return source[property];
|
|
757
|
+
},
|
|
758
|
+
has(_, property) {
|
|
759
|
+
if (property === $PROXY) return true;
|
|
760
|
+
return property in (read() || {});
|
|
761
|
+
},
|
|
762
|
+
ownKeys() {
|
|
763
|
+
return Object.keys(read() || {});
|
|
764
|
+
},
|
|
765
|
+
getOwnPropertyDescriptor(_, property) {
|
|
766
|
+
return {
|
|
767
|
+
configurable: true,
|
|
768
|
+
enumerable: true,
|
|
769
|
+
get() {
|
|
770
|
+
return (read() || {})[property];
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function merge(...sources) {
|
|
777
|
+
for (let i = 0; i < sources.length; i++) {
|
|
778
|
+
if (typeof sources[i] === "function") {
|
|
779
|
+
sources[i] = proxySource(createMemo(sources[i]));
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return merge$1(...sources);
|
|
783
|
+
}
|
|
569
784
|
function mapArray(list, mapFn, options = {}) {
|
|
570
|
-
const
|
|
571
|
-
|
|
785
|
+
const indexes = mapFn.length > 1;
|
|
786
|
+
const parent = currentOwner;
|
|
787
|
+
const read = createMemo(() => {
|
|
572
788
|
const items = list();
|
|
573
|
-
|
|
789
|
+
const s = [];
|
|
574
790
|
if (items && items.length) {
|
|
575
|
-
|
|
791
|
+
const parent = currentOwner;
|
|
792
|
+
const origId = parent.id;
|
|
793
|
+
const origChildCount = parent._childCount;
|
|
794
|
+
try {
|
|
576
795
|
for (let i = 0, len = items.length; i < len; i++) {
|
|
577
|
-
|
|
578
|
-
|
|
796
|
+
if (origId !== undefined) {
|
|
797
|
+
parent.id = formatChildId(origId, origChildCount + i);
|
|
798
|
+
}
|
|
799
|
+
parent._childCount = 0;
|
|
800
|
+
s.push(options.keyed === false ? indexes ? mapFn(() => items[i], i) : mapFn(() => items[i]) : typeof options.keyed === "function" ? indexes ? mapFn(() => items[i], () => i) : mapFn(() => items[i]) : indexes ? mapFn(items[i], () => i) : mapFn(items[i]));
|
|
579
801
|
}
|
|
580
|
-
}
|
|
802
|
+
} finally {
|
|
803
|
+
parent.id = origId;
|
|
804
|
+
parent._childCount = origChildCount + items.length;
|
|
805
|
+
}
|
|
581
806
|
} else if (options.fallback) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
return runWithOwner(fo, () => options.fallback());
|
|
585
|
-
})];
|
|
807
|
+
const fo = createOwner();
|
|
808
|
+
s.push(runWithOwner(fo, () => options.fallback()));
|
|
586
809
|
}
|
|
587
810
|
return s;
|
|
811
|
+
}, {
|
|
812
|
+
sync: true
|
|
588
813
|
});
|
|
814
|
+
consumeClientComputedSlot(parent);
|
|
815
|
+
return read;
|
|
589
816
|
}
|
|
590
817
|
function repeat(count, mapFn, options = {}) {
|
|
591
|
-
const
|
|
592
|
-
|
|
818
|
+
const parent = currentOwner;
|
|
819
|
+
const read = createMemo(() => {
|
|
593
820
|
const len = count();
|
|
594
821
|
const offset = options.from?.() || 0;
|
|
595
822
|
if (!len) {
|
|
596
823
|
if (!options.fallback) return [];
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
return runWithOwner(fallbackOwner, () => options.fallback());
|
|
600
|
-
})];
|
|
824
|
+
const fo = createOwner();
|
|
825
|
+
return [runWithOwner(fo, () => options.fallback())];
|
|
601
826
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
827
|
+
const out = new Array(len);
|
|
828
|
+
const parent = currentOwner;
|
|
829
|
+
const origId = parent.id;
|
|
830
|
+
const origChildCount = parent._childCount;
|
|
831
|
+
try {
|
|
832
|
+
for (let i = 0; i < len; i++) {
|
|
833
|
+
if (origId !== undefined) {
|
|
834
|
+
parent.id = formatChildId(origId, origChildCount + i);
|
|
835
|
+
}
|
|
836
|
+
parent._childCount = 0;
|
|
837
|
+
out[i] = mapFn(i + offset);
|
|
838
|
+
}
|
|
839
|
+
} finally {
|
|
840
|
+
parent.id = origId;
|
|
841
|
+
parent._childCount = origChildCount + len;
|
|
842
|
+
}
|
|
843
|
+
return out;
|
|
844
|
+
}, {
|
|
845
|
+
sync: true
|
|
608
846
|
});
|
|
847
|
+
consumeClientComputedSlot(parent);
|
|
848
|
+
return read;
|
|
609
849
|
}
|
|
610
850
|
const ErrorContext = {
|
|
611
851
|
id: Symbol("ErrorContext"),
|
|
@@ -656,7 +896,7 @@ function createErrorBoundary(fn, fallback) {
|
|
|
656
896
|
return () => {
|
|
657
897
|
let result;
|
|
658
898
|
let handled = false;
|
|
659
|
-
if (ctx) owner
|
|
899
|
+
if (ctx) disposeOwner(owner, false);
|
|
660
900
|
try {
|
|
661
901
|
result = ctx ? runWithBoundaryErrorContext(owner, resolve, err => {
|
|
662
902
|
if (err instanceof NotReadyError) throw err;
|
|
@@ -710,8 +950,8 @@ function latest(fn) {
|
|
|
710
950
|
function isRefreshing() {
|
|
711
951
|
return false;
|
|
712
952
|
}
|
|
713
|
-
function refresh(
|
|
714
|
-
return
|
|
953
|
+
function refresh(_target) {
|
|
954
|
+
return undefined;
|
|
715
955
|
}
|
|
716
956
|
function action(fn) {
|
|
717
957
|
return fn;
|
|
@@ -742,7 +982,8 @@ function children(fn) {
|
|
|
742
982
|
lazy: true
|
|
743
983
|
});
|
|
744
984
|
const memo = createMemo(() => flatten(c()), {
|
|
745
|
-
lazy: true
|
|
985
|
+
lazy: true,
|
|
986
|
+
sync: true
|
|
746
987
|
});
|
|
747
988
|
memo.toArray = () => {
|
|
748
989
|
const v = memo();
|
|
@@ -750,11 +991,6 @@ function children(fn) {
|
|
|
750
991
|
};
|
|
751
992
|
return memo;
|
|
752
993
|
}
|
|
753
|
-
function ssrRunInScope(fn) {
|
|
754
|
-
const owner = getOwner();
|
|
755
|
-
if (!owner) return fn;
|
|
756
|
-
return Array.isArray(fn) ? fn.map(hole => () => runWithOwner(owner, hole)) : () => runWithOwner(owner, fn);
|
|
757
|
-
}
|
|
758
994
|
|
|
759
995
|
function enableHydration() {}
|
|
760
996
|
function createComponent(Comp, props) {
|
|
@@ -798,6 +1034,8 @@ function lazy(fn, moduleUrl) {
|
|
|
798
1034
|
return createMemo(() => {
|
|
799
1035
|
if (!p.v) throw new NotReadyError(p);
|
|
800
1036
|
return p.v(props);
|
|
1037
|
+
}, {
|
|
1038
|
+
sync: true
|
|
801
1039
|
});
|
|
802
1040
|
};
|
|
803
1041
|
wrap.preload = load;
|
|
@@ -881,7 +1119,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
881
1119
|
}
|
|
882
1120
|
}
|
|
883
1121
|
function runDiscovery() {
|
|
884
|
-
o
|
|
1122
|
+
disposeOwner(o, false);
|
|
885
1123
|
serializeBuffer = [];
|
|
886
1124
|
retryPromise = undefined;
|
|
887
1125
|
return runLoadingPhase(() => {
|
|
@@ -928,12 +1166,13 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
928
1166
|
ret = runDiscovery();
|
|
929
1167
|
}
|
|
930
1168
|
commitBoundaryState();
|
|
931
|
-
while (ret.p.length) {
|
|
932
|
-
|
|
933
|
-
|
|
1169
|
+
while (ret && ret.p && ret.p.length) {
|
|
1170
|
+
const pending = ret;
|
|
1171
|
+
await Promise.all(pending.p).catch(() => {});
|
|
1172
|
+
ret = runLoadingPhase(() => ctx.ssr(pending.t, ...pending.h));
|
|
934
1173
|
}
|
|
935
1174
|
flushSerializeBuffer();
|
|
936
|
-
done(ret.t[0]);
|
|
1175
|
+
done(ret && Array.isArray(ret.t) ? ret.t[0] : ret && ret.t);
|
|
937
1176
|
if (revealGroup) revealGroup.onResolved(id);
|
|
938
1177
|
} catch (err) {
|
|
939
1178
|
finalizeError(err);
|
|
@@ -990,11 +1229,13 @@ function Show(props) {
|
|
|
990
1229
|
if (when) {
|
|
991
1230
|
const child = props.children;
|
|
992
1231
|
if (typeof child === "function" && child.length > 0) {
|
|
993
|
-
return child(() => when);
|
|
1232
|
+
return props.keyed ? child(when) : child(() => when);
|
|
994
1233
|
}
|
|
995
1234
|
return child;
|
|
996
1235
|
}
|
|
997
1236
|
return props.fallback;
|
|
1237
|
+
}, {
|
|
1238
|
+
sync: true
|
|
998
1239
|
});
|
|
999
1240
|
}
|
|
1000
1241
|
function Switch(props) {
|
|
@@ -1008,10 +1249,12 @@ function Switch(props) {
|
|
|
1008
1249
|
const w = conds[i].when;
|
|
1009
1250
|
if (w) {
|
|
1010
1251
|
const c = conds[i].children;
|
|
1011
|
-
return typeof c === "function" && c.length > 0 ? c(() => w) : c;
|
|
1252
|
+
return typeof c === "function" && c.length > 0 ? conds[i].keyed ? c(w) : c(() => w) : c;
|
|
1012
1253
|
}
|
|
1013
1254
|
}
|
|
1014
1255
|
return props.fallback;
|
|
1256
|
+
}, {
|
|
1257
|
+
sync: true
|
|
1015
1258
|
});
|
|
1016
1259
|
}
|
|
1017
1260
|
function Match(props) {
|
|
@@ -1201,4 +1444,4 @@ function Reveal(props) {
|
|
|
1201
1444
|
|
|
1202
1445
|
const DEV = undefined;
|
|
1203
1446
|
|
|
1204
|
-
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRevealOrder, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError,
|
|
1447
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createOwner, createProjection, createReaction, createRenderEffect, createRevealOrder, createRoot, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getNextChildId, getObserver, getOwner, isDisposed, isPending, isRefreshing, latest, lazy, mapArray, merge, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, sharedConfig, ssrHandleError, untrack, useContext };
|
package/dist/solid.cjs
CHANGED
|
@@ -24,7 +24,8 @@ function children(fn) {
|
|
|
24
24
|
lazy: true
|
|
25
25
|
});
|
|
26
26
|
const memo = signals.createMemo(() => signals.flatten(c()), {
|
|
27
|
-
lazy: true
|
|
27
|
+
lazy: true,
|
|
28
|
+
sync: true
|
|
28
29
|
});
|
|
29
30
|
memo.toArray = () => {
|
|
30
31
|
const v = memo();
|
|
@@ -741,7 +742,9 @@ function lazy(fn, moduleUrl) {
|
|
|
741
742
|
let Comp;
|
|
742
743
|
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
|
|
743
744
|
return Comp(props);
|
|
744
|
-
}) : ""
|
|
745
|
+
}) : "", {
|
|
746
|
+
sync: true
|
|
747
|
+
});
|
|
745
748
|
};
|
|
746
749
|
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
747
750
|
wrap.moduleUrl = moduleUrl;
|
|
@@ -773,20 +776,23 @@ function Show(props) {
|
|
|
773
776
|
const keyed = props.keyed;
|
|
774
777
|
const conditionValue = signals.createMemo(() => props.when, undefined);
|
|
775
778
|
const condition = keyed ? conditionValue : signals.createMemo(conditionValue, {
|
|
776
|
-
equals: (a, b) => !a === !b
|
|
779
|
+
equals: (a, b) => !a === !b,
|
|
780
|
+
sync: true
|
|
777
781
|
});
|
|
778
782
|
return signals.createMemo(() => {
|
|
779
783
|
const c = condition();
|
|
780
784
|
if (c) {
|
|
781
785
|
const child = props.children;
|
|
782
786
|
const fn = typeof child === "function" && child.length > 0;
|
|
783
|
-
return fn ? signals.untrack(() => child(() => {
|
|
787
|
+
return fn ? keyed ? signals.untrack(() => child(c), IS_DEV) : signals.untrack(() => child(() => {
|
|
784
788
|
if (!signals.untrack(condition)) throw narrowedError("Show");
|
|
785
789
|
return conditionValue();
|
|
786
790
|
}), IS_DEV) : child;
|
|
787
791
|
}
|
|
788
792
|
return props.fallback;
|
|
789
|
-
},
|
|
793
|
+
}, {
|
|
794
|
+
sync: true
|
|
795
|
+
});
|
|
790
796
|
}
|
|
791
797
|
function Switch(props) {
|
|
792
798
|
const chs = children(() => props.children);
|
|
@@ -799,23 +805,33 @@ function Switch(props) {
|
|
|
799
805
|
const prevFunc = func;
|
|
800
806
|
const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined);
|
|
801
807
|
const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, {
|
|
802
|
-
equals: (a, b) => !a === !b
|
|
808
|
+
equals: (a, b) => !a === !b,
|
|
809
|
+
sync: true
|
|
803
810
|
});
|
|
804
|
-
func = () =>
|
|
811
|
+
func = () => {
|
|
812
|
+
const prev = prevFunc();
|
|
813
|
+
if (prev) return prev;
|
|
814
|
+
const c = condition();
|
|
815
|
+
return c ? [index, c, conditionValue, mp] : undefined;
|
|
816
|
+
};
|
|
805
817
|
}
|
|
806
818
|
return func;
|
|
819
|
+
}, {
|
|
820
|
+
sync: true
|
|
807
821
|
});
|
|
808
822
|
return signals.createMemo(() => {
|
|
809
823
|
const sel = switchFunc()();
|
|
810
824
|
if (!sel) return props.fallback;
|
|
811
|
-
const [index, conditionValue, mp] = sel;
|
|
825
|
+
const [index, value, conditionValue, mp] = sel;
|
|
812
826
|
const child = mp.children;
|
|
813
827
|
const fn = typeof child === "function" && child.length > 0;
|
|
814
|
-
return fn ? signals.untrack(() => child(() => {
|
|
828
|
+
return fn ? mp.keyed ? signals.untrack(() => child(value), IS_DEV) : signals.untrack(() => child(() => {
|
|
815
829
|
if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
816
830
|
return conditionValue();
|
|
817
831
|
}), IS_DEV) : child;
|
|
818
|
-
},
|
|
832
|
+
}, {
|
|
833
|
+
sync: true
|
|
834
|
+
});
|
|
819
835
|
}
|
|
820
836
|
function Match(props) {
|
|
821
837
|
return props;
|
|
@@ -840,7 +856,6 @@ function Reveal(props) {
|
|
|
840
856
|
}
|
|
841
857
|
|
|
842
858
|
function ssrHandleError() {}
|
|
843
|
-
function ssrRunInScope() {}
|
|
844
859
|
const DEV = undefined;
|
|
845
860
|
|
|
846
861
|
Object.defineProperty(exports, "$PROXY", {
|
|
@@ -1022,5 +1037,4 @@ exports.enableHydration = enableHydration;
|
|
|
1022
1037
|
exports.lazy = lazy;
|
|
1023
1038
|
exports.sharedConfig = sharedConfig;
|
|
1024
1039
|
exports.ssrHandleError = ssrHandleError;
|
|
1025
|
-
exports.ssrRunInScope = ssrRunInScope;
|
|
1026
1040
|
exports.useContext = useContext;
|
package/dist/solid.js
CHANGED
|
@@ -23,7 +23,8 @@ function children(fn) {
|
|
|
23
23
|
lazy: true
|
|
24
24
|
});
|
|
25
25
|
const memo = createMemo$1(() => flatten(c()), {
|
|
26
|
-
lazy: true
|
|
26
|
+
lazy: true,
|
|
27
|
+
sync: true
|
|
27
28
|
});
|
|
28
29
|
memo.toArray = () => {
|
|
29
30
|
const v = memo();
|
|
@@ -740,7 +741,9 @@ function lazy(fn, moduleUrl) {
|
|
|
740
741
|
let Comp;
|
|
741
742
|
return createMemo$1(() => (Comp = comp()) ? untrack(() => {
|
|
742
743
|
return Comp(props);
|
|
743
|
-
}) : ""
|
|
744
|
+
}) : "", {
|
|
745
|
+
sync: true
|
|
746
|
+
});
|
|
744
747
|
};
|
|
745
748
|
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
746
749
|
wrap.moduleUrl = moduleUrl;
|
|
@@ -772,20 +775,23 @@ function Show(props) {
|
|
|
772
775
|
const keyed = props.keyed;
|
|
773
776
|
const conditionValue = createMemo$1(() => props.when, undefined);
|
|
774
777
|
const condition = keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
775
|
-
equals: (a, b) => !a === !b
|
|
778
|
+
equals: (a, b) => !a === !b,
|
|
779
|
+
sync: true
|
|
776
780
|
});
|
|
777
781
|
return createMemo$1(() => {
|
|
778
782
|
const c = condition();
|
|
779
783
|
if (c) {
|
|
780
784
|
const child = props.children;
|
|
781
785
|
const fn = typeof child === "function" && child.length > 0;
|
|
782
|
-
return fn ? untrack(() => child(() => {
|
|
786
|
+
return fn ? keyed ? untrack(() => child(c), IS_DEV) : untrack(() => child(() => {
|
|
783
787
|
if (!untrack(condition)) throw narrowedError("Show");
|
|
784
788
|
return conditionValue();
|
|
785
789
|
}), IS_DEV) : child;
|
|
786
790
|
}
|
|
787
791
|
return props.fallback;
|
|
788
|
-
},
|
|
792
|
+
}, {
|
|
793
|
+
sync: true
|
|
794
|
+
});
|
|
789
795
|
}
|
|
790
796
|
function Switch(props) {
|
|
791
797
|
const chs = children(() => props.children);
|
|
@@ -798,23 +804,33 @@ function Switch(props) {
|
|
|
798
804
|
const prevFunc = func;
|
|
799
805
|
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined);
|
|
800
806
|
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
801
|
-
equals: (a, b) => !a === !b
|
|
807
|
+
equals: (a, b) => !a === !b,
|
|
808
|
+
sync: true
|
|
802
809
|
});
|
|
803
|
-
func = () =>
|
|
810
|
+
func = () => {
|
|
811
|
+
const prev = prevFunc();
|
|
812
|
+
if (prev) return prev;
|
|
813
|
+
const c = condition();
|
|
814
|
+
return c ? [index, c, conditionValue, mp] : undefined;
|
|
815
|
+
};
|
|
804
816
|
}
|
|
805
817
|
return func;
|
|
818
|
+
}, {
|
|
819
|
+
sync: true
|
|
806
820
|
});
|
|
807
821
|
return createMemo$1(() => {
|
|
808
822
|
const sel = switchFunc()();
|
|
809
823
|
if (!sel) return props.fallback;
|
|
810
|
-
const [index, conditionValue, mp] = sel;
|
|
824
|
+
const [index, value, conditionValue, mp] = sel;
|
|
811
825
|
const child = mp.children;
|
|
812
826
|
const fn = typeof child === "function" && child.length > 0;
|
|
813
|
-
return fn ? untrack(() => child(() => {
|
|
827
|
+
return fn ? mp.keyed ? untrack(() => child(value), IS_DEV) : untrack(() => child(() => {
|
|
814
828
|
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
815
829
|
return conditionValue();
|
|
816
830
|
}), IS_DEV) : child;
|
|
817
|
-
},
|
|
831
|
+
}, {
|
|
832
|
+
sync: true
|
|
833
|
+
});
|
|
818
834
|
}
|
|
819
835
|
function Match(props) {
|
|
820
836
|
return props;
|
|
@@ -839,7 +855,6 @@ function Reveal(props) {
|
|
|
839
855
|
}
|
|
840
856
|
|
|
841
857
|
function ssrHandleError() {}
|
|
842
|
-
function ssrRunInScope() {}
|
|
843
858
|
const DEV = undefined;
|
|
844
859
|
|
|
845
|
-
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError,
|
|
860
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, useContext };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "Reactive JavaScript library for building user interfaces. Compiles JSX to real DOM with fine-grained signal-based updates — no virtual DOM.",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.12",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"performance"
|
|
108
108
|
],
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@solidjs/signals": "^2.0.0-beta.
|
|
110
|
+
"@solidjs/signals": "^2.0.0-beta.12",
|
|
111
111
|
"csstype": "^3.1.0",
|
|
112
112
|
"seroval": "~1.5.0",
|
|
113
113
|
"seroval-plugins": "~1.5.0"
|