solid-js 1.3.0-rc.2 → 1.3.1
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 +34 -10
- package/dist/dev.js +33 -11
- package/dist/server.cjs +9 -1
- package/dist/server.js +8 -2
- package/dist/solid.cjs +28 -9
- package/dist/solid.js +27 -10
- package/package.json +5 -5
- package/store/dist/dev.cjs +3 -5
- package/store/dist/dev.js +3 -5
- package/store/dist/store.cjs +2 -4
- package/store/dist/store.js +2 -4
- package/store/types/index.d.ts +1 -1
- package/store/types/modifiers.d.ts +3 -3
- package/store/types/mutable.d.ts +3 -3
- package/store/types/server.d.ts +3 -38
- package/store/types/store.d.ts +27 -55
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +1 -0
- package/types/reactive/signal.d.ts +18 -3
- package/types/server/index.d.ts +1 -1
- package/types/server/reactive.d.ts +2 -0
- package/web/dist/dev.cjs +13 -37
- package/web/dist/dev.js +1 -1
- package/web/dist/server.cjs +24 -36
- package/web/dist/server.js +14 -6
- package/web/dist/web.cjs +13 -37
- package/web/dist/web.js +1 -1
- package/web/types/client.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
134
135
|
const signalOptions = {
|
|
135
136
|
equals: equalFn
|
|
136
137
|
};
|
|
@@ -169,14 +170,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
169
170
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
170
171
|
Owner = root;
|
|
171
172
|
Listener = null;
|
|
172
|
-
let result;
|
|
173
173
|
try {
|
|
174
|
-
runUpdates(() =>
|
|
174
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
175
175
|
} finally {
|
|
176
176
|
Listener = listener;
|
|
177
177
|
Owner = owner;
|
|
178
178
|
}
|
|
179
|
-
return result;
|
|
180
179
|
}
|
|
181
180
|
function createSignal(value, options) {
|
|
182
181
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -210,7 +209,21 @@ function createEffect(fn, value, options) {
|
|
|
210
209
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
211
210
|
if (s) c.suspense = s;
|
|
212
211
|
c.user = true;
|
|
213
|
-
Effects
|
|
212
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
213
|
+
}
|
|
214
|
+
function createReaction(onInvalidate, options) {
|
|
215
|
+
let fn;
|
|
216
|
+
const c = createComputation(() => {
|
|
217
|
+
fn ? fn() : untrack(onInvalidate);
|
|
218
|
+
fn = undefined;
|
|
219
|
+
}, undefined, false, 0, options ),
|
|
220
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
221
|
+
if (s) c.suspense = s;
|
|
222
|
+
c.user = true;
|
|
223
|
+
return tracking => {
|
|
224
|
+
fn = tracking;
|
|
225
|
+
updateComputation(c);
|
|
226
|
+
};
|
|
214
227
|
}
|
|
215
228
|
function createMemo(fn, value, options) {
|
|
216
229
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -240,7 +253,7 @@ function createResource(source, fetcher, options) {
|
|
|
240
253
|
if (options.globalRefetch !== false) {
|
|
241
254
|
Resources || (Resources = new Set());
|
|
242
255
|
Resources.add(load);
|
|
243
|
-
onCleanup(() => Resources.delete(load));
|
|
256
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
244
257
|
}
|
|
245
258
|
const contexts = new Set(),
|
|
246
259
|
[s, set] = createSignal(options.initialValue),
|
|
@@ -351,7 +364,7 @@ function createResource(source, fetcher, options) {
|
|
|
351
364
|
}
|
|
352
365
|
let Resources;
|
|
353
366
|
function refetchResources(info) {
|
|
354
|
-
Resources && Resources.
|
|
367
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
355
368
|
}
|
|
356
369
|
function createDeferred(source, options) {
|
|
357
370
|
let t,
|
|
@@ -465,7 +478,7 @@ function runWithOwner(o, fn) {
|
|
|
465
478
|
const prev = Owner;
|
|
466
479
|
Owner = o;
|
|
467
480
|
try {
|
|
468
|
-
return fn
|
|
481
|
+
return runUpdates(fn, true);
|
|
469
482
|
} finally {
|
|
470
483
|
Owner = prev;
|
|
471
484
|
}
|
|
@@ -478,7 +491,11 @@ function startTransition(fn) {
|
|
|
478
491
|
fn();
|
|
479
492
|
return Transition.done;
|
|
480
493
|
}
|
|
494
|
+
const l = Listener;
|
|
495
|
+
const o = Owner;
|
|
481
496
|
return Promise.resolve().then(() => {
|
|
497
|
+
Listener = l;
|
|
498
|
+
Owner = o;
|
|
482
499
|
let t;
|
|
483
500
|
if (Scheduler || SuspenseContext) {
|
|
484
501
|
t = Transition || (Transition = {
|
|
@@ -504,7 +521,12 @@ function resumeEffects(e) {
|
|
|
504
521
|
e.length = 0;
|
|
505
522
|
}
|
|
506
523
|
function devComponent(Comp, props) {
|
|
507
|
-
const c = createComputation(() => untrack(() =>
|
|
524
|
+
const c = createComputation(() => untrack(() => {
|
|
525
|
+
Object.assign(Comp, {
|
|
526
|
+
[$DEVCOMP]: true
|
|
527
|
+
});
|
|
528
|
+
return Comp(props);
|
|
529
|
+
}), undefined, true);
|
|
508
530
|
c.pending = NOTPENDING;
|
|
509
531
|
c.observers = null;
|
|
510
532
|
c.observerSlots = null;
|
|
@@ -767,7 +789,7 @@ function runUpdates(fn, init) {
|
|
|
767
789
|
if (Effects) wait = true;else Effects = [];
|
|
768
790
|
ExecCount++;
|
|
769
791
|
try {
|
|
770
|
-
fn();
|
|
792
|
+
return fn();
|
|
771
793
|
} catch (err) {
|
|
772
794
|
handleError(err);
|
|
773
795
|
} finally {
|
|
@@ -927,7 +949,7 @@ function handleError(err) {
|
|
|
927
949
|
fns.forEach(f => f(err));
|
|
928
950
|
}
|
|
929
951
|
function lookup(owner, key) {
|
|
930
|
-
return owner && (owner.context && owner.context[key]
|
|
952
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
931
953
|
}
|
|
932
954
|
function resolveChildren(children) {
|
|
933
955
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1559,6 +1581,7 @@ if (globalThis) {
|
|
|
1559
1581
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1560
1582
|
}
|
|
1561
1583
|
|
|
1584
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
1562
1585
|
exports.$PROXY = $PROXY;
|
|
1563
1586
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1564
1587
|
exports.For = For;
|
|
@@ -1577,6 +1600,7 @@ exports.createContext = createContext;
|
|
|
1577
1600
|
exports.createDeferred = createDeferred;
|
|
1578
1601
|
exports.createEffect = createEffect;
|
|
1579
1602
|
exports.createMemo = createMemo;
|
|
1603
|
+
exports.createReaction = createReaction;
|
|
1580
1604
|
exports.createRenderEffect = createRenderEffect;
|
|
1581
1605
|
exports.createResource = createResource;
|
|
1582
1606
|
exports.createRoot = createRoot;
|
package/dist/dev.js
CHANGED
|
@@ -127,6 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
130
131
|
const signalOptions = {
|
|
131
132
|
equals: equalFn
|
|
132
133
|
};
|
|
@@ -165,14 +166,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
165
166
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
166
167
|
Owner = root;
|
|
167
168
|
Listener = null;
|
|
168
|
-
let result;
|
|
169
169
|
try {
|
|
170
|
-
runUpdates(() =>
|
|
170
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
171
171
|
} finally {
|
|
172
172
|
Listener = listener;
|
|
173
173
|
Owner = owner;
|
|
174
174
|
}
|
|
175
|
-
return result;
|
|
176
175
|
}
|
|
177
176
|
function createSignal(value, options) {
|
|
178
177
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -206,7 +205,21 @@ function createEffect(fn, value, options) {
|
|
|
206
205
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
207
206
|
if (s) c.suspense = s;
|
|
208
207
|
c.user = true;
|
|
209
|
-
Effects
|
|
208
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
209
|
+
}
|
|
210
|
+
function createReaction(onInvalidate, options) {
|
|
211
|
+
let fn;
|
|
212
|
+
const c = createComputation(() => {
|
|
213
|
+
fn ? fn() : untrack(onInvalidate);
|
|
214
|
+
fn = undefined;
|
|
215
|
+
}, undefined, false, 0, options ),
|
|
216
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
217
|
+
if (s) c.suspense = s;
|
|
218
|
+
c.user = true;
|
|
219
|
+
return tracking => {
|
|
220
|
+
fn = tracking;
|
|
221
|
+
updateComputation(c);
|
|
222
|
+
};
|
|
210
223
|
}
|
|
211
224
|
function createMemo(fn, value, options) {
|
|
212
225
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -236,7 +249,7 @@ function createResource(source, fetcher, options) {
|
|
|
236
249
|
if (options.globalRefetch !== false) {
|
|
237
250
|
Resources || (Resources = new Set());
|
|
238
251
|
Resources.add(load);
|
|
239
|
-
onCleanup(() => Resources.delete(load));
|
|
252
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
240
253
|
}
|
|
241
254
|
const contexts = new Set(),
|
|
242
255
|
[s, set] = createSignal(options.initialValue),
|
|
@@ -347,7 +360,7 @@ function createResource(source, fetcher, options) {
|
|
|
347
360
|
}
|
|
348
361
|
let Resources;
|
|
349
362
|
function refetchResources(info) {
|
|
350
|
-
Resources && Resources.
|
|
363
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
351
364
|
}
|
|
352
365
|
function createDeferred(source, options) {
|
|
353
366
|
let t,
|
|
@@ -461,7 +474,7 @@ function runWithOwner(o, fn) {
|
|
|
461
474
|
const prev = Owner;
|
|
462
475
|
Owner = o;
|
|
463
476
|
try {
|
|
464
|
-
return fn
|
|
477
|
+
return runUpdates(fn, true);
|
|
465
478
|
} finally {
|
|
466
479
|
Owner = prev;
|
|
467
480
|
}
|
|
@@ -474,7 +487,11 @@ function startTransition(fn) {
|
|
|
474
487
|
fn();
|
|
475
488
|
return Transition.done;
|
|
476
489
|
}
|
|
490
|
+
const l = Listener;
|
|
491
|
+
const o = Owner;
|
|
477
492
|
return Promise.resolve().then(() => {
|
|
493
|
+
Listener = l;
|
|
494
|
+
Owner = o;
|
|
478
495
|
let t;
|
|
479
496
|
if (Scheduler || SuspenseContext) {
|
|
480
497
|
t = Transition || (Transition = {
|
|
@@ -500,7 +517,12 @@ function resumeEffects(e) {
|
|
|
500
517
|
e.length = 0;
|
|
501
518
|
}
|
|
502
519
|
function devComponent(Comp, props) {
|
|
503
|
-
const c = createComputation(() => untrack(() =>
|
|
520
|
+
const c = createComputation(() => untrack(() => {
|
|
521
|
+
Object.assign(Comp, {
|
|
522
|
+
[$DEVCOMP]: true
|
|
523
|
+
});
|
|
524
|
+
return Comp(props);
|
|
525
|
+
}), undefined, true);
|
|
504
526
|
c.pending = NOTPENDING;
|
|
505
527
|
c.observers = null;
|
|
506
528
|
c.observerSlots = null;
|
|
@@ -763,7 +785,7 @@ function runUpdates(fn, init) {
|
|
|
763
785
|
if (Effects) wait = true;else Effects = [];
|
|
764
786
|
ExecCount++;
|
|
765
787
|
try {
|
|
766
|
-
fn();
|
|
788
|
+
return fn();
|
|
767
789
|
} catch (err) {
|
|
768
790
|
handleError(err);
|
|
769
791
|
} finally {
|
|
@@ -923,7 +945,7 @@ function handleError(err) {
|
|
|
923
945
|
fns.forEach(f => f(err));
|
|
924
946
|
}
|
|
925
947
|
function lookup(owner, key) {
|
|
926
|
-
return owner && (owner.context && owner.context[key]
|
|
948
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
927
949
|
}
|
|
928
950
|
function resolveChildren(children) {
|
|
929
951
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1555,4 +1577,4 @@ if (globalThis) {
|
|
|
1555
1577
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1556
1578
|
}
|
|
1557
1579
|
|
|
1558
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1580
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/server.cjs
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const equalFn = (a, b) => a === b;
|
|
6
6
|
const $PROXY = Symbol("solid-proxy");
|
|
7
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
7
8
|
const DEV = {};
|
|
8
9
|
const ERROR = Symbol("error");
|
|
9
10
|
const UNOWNED = {
|
|
@@ -53,6 +54,11 @@ function createComputed(fn, value) {
|
|
|
53
54
|
}
|
|
54
55
|
const createRenderEffect = createComputed;
|
|
55
56
|
function createEffect(fn, value) {}
|
|
57
|
+
function createReaction(fn) {
|
|
58
|
+
return fn => {
|
|
59
|
+
fn();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
56
62
|
function createMemo(fn, value) {
|
|
57
63
|
Owner = {
|
|
58
64
|
owner: Owner,
|
|
@@ -130,7 +136,7 @@ function runWithOwner(o, fn) {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
function lookup(owner, key) {
|
|
133
|
-
return owner && (owner.context && owner.context[key]
|
|
139
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
134
140
|
}
|
|
135
141
|
function resolveChildren(children) {
|
|
136
142
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -509,6 +515,7 @@ function Suspense(props) {
|
|
|
509
515
|
return props.fallback;
|
|
510
516
|
}
|
|
511
517
|
|
|
518
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
512
519
|
exports.$PROXY = $PROXY;
|
|
513
520
|
exports.DEV = DEV;
|
|
514
521
|
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -527,6 +534,7 @@ exports.createContext = createContext;
|
|
|
527
534
|
exports.createDeferred = createDeferred;
|
|
528
535
|
exports.createEffect = createEffect;
|
|
529
536
|
exports.createMemo = createMemo;
|
|
537
|
+
exports.createReaction = createReaction;
|
|
530
538
|
exports.createRenderEffect = createRenderEffect;
|
|
531
539
|
exports.createResource = createResource;
|
|
532
540
|
exports.createRoot = createRoot;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const equalFn = (a, b) => a === b;
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
|
+
const $DEVCOMP = Symbol('solid-dev-component');
|
|
3
4
|
const DEV = {};
|
|
4
5
|
const ERROR = Symbol("error");
|
|
5
6
|
const UNOWNED = {
|
|
@@ -49,6 +50,11 @@ function createComputed(fn, value) {
|
|
|
49
50
|
}
|
|
50
51
|
const createRenderEffect = createComputed;
|
|
51
52
|
function createEffect(fn, value) {}
|
|
53
|
+
function createReaction(fn) {
|
|
54
|
+
return fn => {
|
|
55
|
+
fn();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
52
58
|
function createMemo(fn, value) {
|
|
53
59
|
Owner = {
|
|
54
60
|
owner: Owner,
|
|
@@ -126,7 +132,7 @@ function runWithOwner(o, fn) {
|
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
function lookup(owner, key) {
|
|
129
|
-
return owner && (owner.context && owner.context[key]
|
|
135
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
130
136
|
}
|
|
131
137
|
function resolveChildren(children) {
|
|
132
138
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -505,4 +511,4 @@ function Suspense(props) {
|
|
|
505
511
|
return props.fallback;
|
|
506
512
|
}
|
|
507
513
|
|
|
508
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
514
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -131,6 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
134
135
|
const signalOptions = {
|
|
135
136
|
equals: equalFn
|
|
136
137
|
};
|
|
@@ -167,14 +168,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
167
168
|
};
|
|
168
169
|
Owner = root;
|
|
169
170
|
Listener = null;
|
|
170
|
-
let result;
|
|
171
171
|
try {
|
|
172
|
-
runUpdates(() =>
|
|
172
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
173
173
|
} finally {
|
|
174
174
|
Listener = listener;
|
|
175
175
|
Owner = owner;
|
|
176
176
|
}
|
|
177
|
-
return result;
|
|
178
177
|
}
|
|
179
178
|
function createSignal(value, options) {
|
|
180
179
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -207,7 +206,21 @@ function createEffect(fn, value, options) {
|
|
|
207
206
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
208
207
|
if (s) c.suspense = s;
|
|
209
208
|
c.user = true;
|
|
210
|
-
Effects
|
|
209
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
210
|
+
}
|
|
211
|
+
function createReaction(onInvalidate, options) {
|
|
212
|
+
let fn;
|
|
213
|
+
const c = createComputation(() => {
|
|
214
|
+
fn ? fn() : untrack(onInvalidate);
|
|
215
|
+
fn = undefined;
|
|
216
|
+
}, undefined, false, 0),
|
|
217
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
218
|
+
if (s) c.suspense = s;
|
|
219
|
+
c.user = true;
|
|
220
|
+
return tracking => {
|
|
221
|
+
fn = tracking;
|
|
222
|
+
updateComputation(c);
|
|
223
|
+
};
|
|
211
224
|
}
|
|
212
225
|
function createMemo(fn, value, options) {
|
|
213
226
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -237,7 +250,7 @@ function createResource(source, fetcher, options) {
|
|
|
237
250
|
if (options.globalRefetch !== false) {
|
|
238
251
|
Resources || (Resources = new Set());
|
|
239
252
|
Resources.add(load);
|
|
240
|
-
onCleanup(() => Resources.delete(load));
|
|
253
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
241
254
|
}
|
|
242
255
|
const contexts = new Set(),
|
|
243
256
|
[s, set] = createSignal(options.initialValue),
|
|
@@ -348,7 +361,7 @@ function createResource(source, fetcher, options) {
|
|
|
348
361
|
}
|
|
349
362
|
let Resources;
|
|
350
363
|
function refetchResources(info) {
|
|
351
|
-
Resources && Resources.
|
|
364
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
352
365
|
}
|
|
353
366
|
function createDeferred(source, options) {
|
|
354
367
|
let t,
|
|
@@ -462,7 +475,7 @@ function runWithOwner(o, fn) {
|
|
|
462
475
|
const prev = Owner;
|
|
463
476
|
Owner = o;
|
|
464
477
|
try {
|
|
465
|
-
return fn
|
|
478
|
+
return runUpdates(fn, true);
|
|
466
479
|
} finally {
|
|
467
480
|
Owner = prev;
|
|
468
481
|
}
|
|
@@ -475,7 +488,11 @@ function startTransition(fn) {
|
|
|
475
488
|
fn();
|
|
476
489
|
return Transition.done;
|
|
477
490
|
}
|
|
491
|
+
const l = Listener;
|
|
492
|
+
const o = Owner;
|
|
478
493
|
return Promise.resolve().then(() => {
|
|
494
|
+
Listener = l;
|
|
495
|
+
Owner = o;
|
|
479
496
|
let t;
|
|
480
497
|
if (Scheduler || SuspenseContext) {
|
|
481
498
|
t = Transition || (Transition = {
|
|
@@ -715,7 +732,7 @@ function runUpdates(fn, init) {
|
|
|
715
732
|
if (Effects) wait = true;else Effects = [];
|
|
716
733
|
ExecCount++;
|
|
717
734
|
try {
|
|
718
|
-
fn();
|
|
735
|
+
return fn();
|
|
719
736
|
} catch (err) {
|
|
720
737
|
handleError(err);
|
|
721
738
|
} finally {
|
|
@@ -874,7 +891,7 @@ function handleError(err) {
|
|
|
874
891
|
fns.forEach(f => f(err));
|
|
875
892
|
}
|
|
876
893
|
function lookup(owner, key) {
|
|
877
|
-
return owner && (owner.context && owner.context[key]
|
|
894
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
878
895
|
}
|
|
879
896
|
function resolveChildren(children) {
|
|
880
897
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1472,6 +1489,7 @@ function Suspense(props) {
|
|
|
1472
1489
|
|
|
1473
1490
|
let DEV;
|
|
1474
1491
|
|
|
1492
|
+
exports.$DEVCOMP = $DEVCOMP;
|
|
1475
1493
|
exports.$PROXY = $PROXY;
|
|
1476
1494
|
exports.DEV = DEV;
|
|
1477
1495
|
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -1491,6 +1509,7 @@ exports.createContext = createContext;
|
|
|
1491
1509
|
exports.createDeferred = createDeferred;
|
|
1492
1510
|
exports.createEffect = createEffect;
|
|
1493
1511
|
exports.createMemo = createMemo;
|
|
1512
|
+
exports.createReaction = createReaction;
|
|
1494
1513
|
exports.createRenderEffect = createRenderEffect;
|
|
1495
1514
|
exports.createResource = createResource;
|
|
1496
1515
|
exports.createRoot = createRoot;
|
package/dist/solid.js
CHANGED
|
@@ -127,6 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
130
131
|
const signalOptions = {
|
|
131
132
|
equals: equalFn
|
|
132
133
|
};
|
|
@@ -163,14 +164,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
163
164
|
};
|
|
164
165
|
Owner = root;
|
|
165
166
|
Listener = null;
|
|
166
|
-
let result;
|
|
167
167
|
try {
|
|
168
|
-
runUpdates(() =>
|
|
168
|
+
return runUpdates(() => fn(() => cleanNode(root)), true);
|
|
169
169
|
} finally {
|
|
170
170
|
Listener = listener;
|
|
171
171
|
Owner = owner;
|
|
172
172
|
}
|
|
173
|
-
return result;
|
|
174
173
|
}
|
|
175
174
|
function createSignal(value, options) {
|
|
176
175
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -203,7 +202,21 @@ function createEffect(fn, value, options) {
|
|
|
203
202
|
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
204
203
|
if (s) c.suspense = s;
|
|
205
204
|
c.user = true;
|
|
206
|
-
Effects
|
|
205
|
+
Effects ? Effects.push(c) : queueMicrotask(() => updateComputation(c));
|
|
206
|
+
}
|
|
207
|
+
function createReaction(onInvalidate, options) {
|
|
208
|
+
let fn;
|
|
209
|
+
const c = createComputation(() => {
|
|
210
|
+
fn ? fn() : untrack(onInvalidate);
|
|
211
|
+
fn = undefined;
|
|
212
|
+
}, undefined, false, 0),
|
|
213
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
214
|
+
if (s) c.suspense = s;
|
|
215
|
+
c.user = true;
|
|
216
|
+
return tracking => {
|
|
217
|
+
fn = tracking;
|
|
218
|
+
updateComputation(c);
|
|
219
|
+
};
|
|
207
220
|
}
|
|
208
221
|
function createMemo(fn, value, options) {
|
|
209
222
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
@@ -233,7 +246,7 @@ function createResource(source, fetcher, options) {
|
|
|
233
246
|
if (options.globalRefetch !== false) {
|
|
234
247
|
Resources || (Resources = new Set());
|
|
235
248
|
Resources.add(load);
|
|
236
|
-
onCleanup(() => Resources.delete(load));
|
|
249
|
+
Owner && onCleanup(() => Resources.delete(load));
|
|
237
250
|
}
|
|
238
251
|
const contexts = new Set(),
|
|
239
252
|
[s, set] = createSignal(options.initialValue),
|
|
@@ -344,7 +357,7 @@ function createResource(source, fetcher, options) {
|
|
|
344
357
|
}
|
|
345
358
|
let Resources;
|
|
346
359
|
function refetchResources(info) {
|
|
347
|
-
Resources && Resources.
|
|
360
|
+
return Resources && Promise.all([...Resources].map(fn => fn(info)));
|
|
348
361
|
}
|
|
349
362
|
function createDeferred(source, options) {
|
|
350
363
|
let t,
|
|
@@ -458,7 +471,7 @@ function runWithOwner(o, fn) {
|
|
|
458
471
|
const prev = Owner;
|
|
459
472
|
Owner = o;
|
|
460
473
|
try {
|
|
461
|
-
return fn
|
|
474
|
+
return runUpdates(fn, true);
|
|
462
475
|
} finally {
|
|
463
476
|
Owner = prev;
|
|
464
477
|
}
|
|
@@ -471,7 +484,11 @@ function startTransition(fn) {
|
|
|
471
484
|
fn();
|
|
472
485
|
return Transition.done;
|
|
473
486
|
}
|
|
487
|
+
const l = Listener;
|
|
488
|
+
const o = Owner;
|
|
474
489
|
return Promise.resolve().then(() => {
|
|
490
|
+
Listener = l;
|
|
491
|
+
Owner = o;
|
|
475
492
|
let t;
|
|
476
493
|
if (Scheduler || SuspenseContext) {
|
|
477
494
|
t = Transition || (Transition = {
|
|
@@ -711,7 +728,7 @@ function runUpdates(fn, init) {
|
|
|
711
728
|
if (Effects) wait = true;else Effects = [];
|
|
712
729
|
ExecCount++;
|
|
713
730
|
try {
|
|
714
|
-
fn();
|
|
731
|
+
return fn();
|
|
715
732
|
} catch (err) {
|
|
716
733
|
handleError(err);
|
|
717
734
|
} finally {
|
|
@@ -870,7 +887,7 @@ function handleError(err) {
|
|
|
870
887
|
fns.forEach(f => f(err));
|
|
871
888
|
}
|
|
872
889
|
function lookup(owner, key) {
|
|
873
|
-
return owner && (owner.context && owner.context[key]
|
|
890
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
874
891
|
}
|
|
875
892
|
function resolveChildren(children) {
|
|
876
893
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1468,4 +1485,4 @@ function Suspense(props) {
|
|
|
1468
1485
|
|
|
1469
1486
|
let DEV;
|
|
1470
1487
|
|
|
1471
|
-
export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1488
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/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.3.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"build": "npm-run-all -cnl build:*",
|
|
125
125
|
"build:link": "symlink-dir . node_modules/solid-js",
|
|
126
126
|
"build:js": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && rollup -c",
|
|
127
|
-
"build:types": "tsc",
|
|
128
|
-
"build:types-store": "tsc --project ./store/tsconfig.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
|
|
129
|
-
"build:types-web": "tsc --project ./web/tsconfig.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
|
|
127
|
+
"build:types": "tsc --project ./tsconfig.build.json",
|
|
128
|
+
"build:types-store": "tsc --project ./store/tsconfig.build.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
|
|
129
|
+
"build:types-web": "tsc --project ./web/tsconfig.build.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
|
|
130
130
|
"build:types-html": "tsc --project ./html/tsconfig.json",
|
|
131
131
|
"build:types-h": "tsc --project ./h/tsconfig.json",
|
|
132
132
|
"build:types-universal": "tsc --project ./universal/tsconfig.json",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "9198a44115b8450b0ae61355008a490c4e25007f"
|
|
148
148
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -103,7 +103,7 @@ const proxyTraps$1 = {
|
|
|
103
103
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
104
104
|
node();
|
|
105
105
|
}
|
|
106
|
-
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
106
|
+
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
107
107
|
},
|
|
108
108
|
set() {
|
|
109
109
|
console.warn("Cannot mutate a Store directly");
|
|
@@ -344,8 +344,7 @@ function reconcile(value, options = {}) {
|
|
|
344
344
|
key = "id"
|
|
345
345
|
} = options,
|
|
346
346
|
v = unwrap(value);
|
|
347
|
-
return
|
|
348
|
-
const state = s;
|
|
347
|
+
return state => {
|
|
349
348
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
350
349
|
applyState(v, {
|
|
351
350
|
state
|
|
@@ -369,8 +368,7 @@ const setterTraps = {
|
|
|
369
368
|
}
|
|
370
369
|
};
|
|
371
370
|
function produce(fn) {
|
|
372
|
-
return
|
|
373
|
-
const state = s;
|
|
371
|
+
return state => {
|
|
374
372
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
375
373
|
return state;
|
|
376
374
|
};
|
package/store/dist/dev.js
CHANGED
|
@@ -99,7 +99,7 @@ const proxyTraps$1 = {
|
|
|
99
99
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
100
100
|
node();
|
|
101
101
|
}
|
|
102
|
-
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
102
|
+
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
103
103
|
},
|
|
104
104
|
set() {
|
|
105
105
|
console.warn("Cannot mutate a Store directly");
|
|
@@ -340,8 +340,7 @@ function reconcile(value, options = {}) {
|
|
|
340
340
|
key = "id"
|
|
341
341
|
} = options,
|
|
342
342
|
v = unwrap(value);
|
|
343
|
-
return
|
|
344
|
-
const state = s;
|
|
343
|
+
return state => {
|
|
345
344
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
346
345
|
applyState(v, {
|
|
347
346
|
state
|
|
@@ -365,8 +364,7 @@ const setterTraps = {
|
|
|
365
364
|
}
|
|
366
365
|
};
|
|
367
366
|
function produce(fn) {
|
|
368
|
-
return
|
|
369
|
-
const state = s;
|
|
367
|
+
return state => {
|
|
370
368
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
371
369
|
return state;
|
|
372
370
|
};
|
package/store/dist/store.cjs
CHANGED
|
@@ -324,8 +324,7 @@ function reconcile(value, options = {}) {
|
|
|
324
324
|
key = "id"
|
|
325
325
|
} = options,
|
|
326
326
|
v = unwrap(value);
|
|
327
|
-
return
|
|
328
|
-
const state = s;
|
|
327
|
+
return state => {
|
|
329
328
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
330
329
|
applyState(v, {
|
|
331
330
|
state
|
|
@@ -349,8 +348,7 @@ const setterTraps = {
|
|
|
349
348
|
}
|
|
350
349
|
};
|
|
351
350
|
function produce(fn) {
|
|
352
|
-
return
|
|
353
|
-
const state = s;
|
|
351
|
+
return state => {
|
|
354
352
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
355
353
|
return state;
|
|
356
354
|
};
|
package/store/dist/store.js
CHANGED
|
@@ -320,8 +320,7 @@ function reconcile(value, options = {}) {
|
|
|
320
320
|
key = "id"
|
|
321
321
|
} = options,
|
|
322
322
|
v = unwrap(value);
|
|
323
|
-
return
|
|
324
|
-
const state = s;
|
|
323
|
+
return state => {
|
|
325
324
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
326
325
|
applyState(v, {
|
|
327
326
|
state
|
|
@@ -345,8 +344,7 @@ const setterTraps = {
|
|
|
345
344
|
}
|
|
346
345
|
};
|
|
347
346
|
function produce(fn) {
|
|
348
|
-
return
|
|
349
|
-
const state = s;
|
|
347
|
+
return state => {
|
|
350
348
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
351
349
|
return state;
|
|
352
350
|
};
|