solid-js 2.0.0-experimental.11 → 2.0.0-experimental.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/dist/dev.cjs +9 -107
- package/dist/dev.js +4 -106
- package/dist/solid.cjs +9 -107
- package/dist/solid.js +4 -106
- package/package.json +2 -2
- package/types/client/core.d.ts +0 -7
- package/types/client/hydration.d.ts +0 -19
- package/types/index.d.ts +3 -4
- package/types/client/observable.d.ts +0 -36
package/dist/dev.cjs
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
var signals = require('@solidjs/signals');
|
|
4
4
|
|
|
5
5
|
const $DEVCOMP = Symbol("COMPONENT_DEV" );
|
|
6
|
-
function onMount(fn) {
|
|
7
|
-
signals.createEffect(() => null, fn);
|
|
8
|
-
}
|
|
9
6
|
function createContext(defaultValue, options) {
|
|
10
7
|
const id = Symbol(options && options.name || "");
|
|
11
8
|
function provider(props) {
|
|
@@ -74,50 +71,6 @@ function reducer(source, reducerFn) {
|
|
|
74
71
|
}];
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
function observable(input) {
|
|
78
|
-
return {
|
|
79
|
-
subscribe(observer) {
|
|
80
|
-
if (!(observer instanceof Object) || observer == null) {
|
|
81
|
-
throw new TypeError("Expected the observer to be an object.");
|
|
82
|
-
}
|
|
83
|
-
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
84
|
-
if (!handler) {
|
|
85
|
-
return {
|
|
86
|
-
unsubscribe() {}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const dispose = signals.createRoot(disposer => {
|
|
90
|
-
signals.createEffect(() => input(), v => {
|
|
91
|
-
handler(v);
|
|
92
|
-
});
|
|
93
|
-
return disposer;
|
|
94
|
-
});
|
|
95
|
-
if (signals.getOwner()) signals.onCleanup(dispose);
|
|
96
|
-
return {
|
|
97
|
-
unsubscribe() {
|
|
98
|
-
dispose();
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
[Symbol.observable || "@@observable"]() {
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function from(producer, initialValue = undefined) {
|
|
108
|
-
const [s, set] = signals.createSignal(() => initialValue, initialValue, {
|
|
109
|
-
equals: false
|
|
110
|
-
});
|
|
111
|
-
if ("subscribe" in producer) {
|
|
112
|
-
const unsub = producer.subscribe(v => set(() => v));
|
|
113
|
-
signals.onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
114
|
-
} else {
|
|
115
|
-
const clean = producer(set);
|
|
116
|
-
signals.onCleanup(clean);
|
|
117
|
-
}
|
|
118
|
-
return s;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
74
|
const sharedConfig = {
|
|
122
75
|
hydrating: false,
|
|
123
76
|
registry: undefined,
|
|
@@ -161,58 +114,6 @@ function Loading(props) {
|
|
|
161
114
|
return signals.createLoadBoundary(() => props.children, () => props.fallback);
|
|
162
115
|
});
|
|
163
116
|
}
|
|
164
|
-
function createAsync(compute, value, options) {
|
|
165
|
-
if (!sharedConfig.hydrating) return signals.createAsync(compute, value, options);
|
|
166
|
-
return signals.createAsync(prev => {
|
|
167
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
168
|
-
const o = signals.getOwner();
|
|
169
|
-
let initP;
|
|
170
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
171
|
-
const init = initP?.value || initP;
|
|
172
|
-
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
173
|
-
}, value, options);
|
|
174
|
-
}
|
|
175
|
-
class MockPromise {
|
|
176
|
-
static all() {
|
|
177
|
-
return new MockPromise();
|
|
178
|
-
}
|
|
179
|
-
static allSettled() {
|
|
180
|
-
return new MockPromise();
|
|
181
|
-
}
|
|
182
|
-
static any() {
|
|
183
|
-
return new MockPromise();
|
|
184
|
-
}
|
|
185
|
-
static race() {
|
|
186
|
-
return new MockPromise();
|
|
187
|
-
}
|
|
188
|
-
static reject() {
|
|
189
|
-
return new MockPromise();
|
|
190
|
-
}
|
|
191
|
-
static resolve() {
|
|
192
|
-
return new MockPromise();
|
|
193
|
-
}
|
|
194
|
-
catch() {
|
|
195
|
-
return new MockPromise();
|
|
196
|
-
}
|
|
197
|
-
then() {
|
|
198
|
-
return new MockPromise();
|
|
199
|
-
}
|
|
200
|
-
finally() {
|
|
201
|
-
return new MockPromise();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function subFetch(fn, prev) {
|
|
205
|
-
const ogFetch = fetch;
|
|
206
|
-
const ogPromise = Promise;
|
|
207
|
-
try {
|
|
208
|
-
window.fetch = () => new MockPromise();
|
|
209
|
-
Promise = MockPromise;
|
|
210
|
-
return fn(prev);
|
|
211
|
-
} finally {
|
|
212
|
-
window.fetch = ogFetch;
|
|
213
|
-
Promise = ogPromise;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
117
|
|
|
217
118
|
function enableHydration() {
|
|
218
119
|
}
|
|
@@ -223,10 +124,7 @@ function lazy(fn) {
|
|
|
223
124
|
let comp;
|
|
224
125
|
let p;
|
|
225
126
|
const wrap = props => {
|
|
226
|
-
|
|
227
|
-
const s = signals.createAsync(() => (p || (p = fn())).then(mod => mod.default));
|
|
228
|
-
comp = s;
|
|
229
|
-
}
|
|
127
|
+
comp = signals.createMemo(() => (p || (p = fn())).then(mod => mod.default));
|
|
230
128
|
let Comp;
|
|
231
129
|
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
|
|
232
130
|
Object.assign(Comp, {
|
|
@@ -423,6 +321,10 @@ Object.defineProperty(exports, "isPending", {
|
|
|
423
321
|
enumerable: true,
|
|
424
322
|
get: function () { return signals.isPending; }
|
|
425
323
|
});
|
|
324
|
+
Object.defineProperty(exports, "isRefreshing", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () { return signals.isRefreshing; }
|
|
327
|
+
});
|
|
426
328
|
Object.defineProperty(exports, "isWrappable", {
|
|
427
329
|
enumerable: true,
|
|
428
330
|
get: function () { return signals.isWrappable; }
|
|
@@ -455,6 +357,10 @@ Object.defineProperty(exports, "reconcile", {
|
|
|
455
357
|
enumerable: true,
|
|
456
358
|
get: function () { return signals.reconcile; }
|
|
457
359
|
});
|
|
360
|
+
Object.defineProperty(exports, "refresh", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () { return signals.refresh; }
|
|
363
|
+
});
|
|
458
364
|
Object.defineProperty(exports, "repeat", {
|
|
459
365
|
enumerable: true,
|
|
460
366
|
get: function () { return signals.repeat; }
|
|
@@ -486,15 +392,11 @@ exports.Repeat = Repeat;
|
|
|
486
392
|
exports.Show = Show;
|
|
487
393
|
exports.Switch = Switch;
|
|
488
394
|
exports.children = children;
|
|
489
|
-
exports.createAsync = createAsync;
|
|
490
395
|
exports.createComponent = createComponent;
|
|
491
396
|
exports.createContext = createContext;
|
|
492
397
|
exports.createUniqueId = createUniqueId;
|
|
493
398
|
exports.enableHydration = enableHydration;
|
|
494
|
-
exports.from = from;
|
|
495
399
|
exports.lazy = lazy;
|
|
496
|
-
exports.observable = observable;
|
|
497
|
-
exports.onMount = onMount;
|
|
498
400
|
exports.reducer = reducer;
|
|
499
401
|
exports.sharedConfig = sharedConfig;
|
|
500
402
|
exports.ssrHandleError = ssrHandleError;
|
package/dist/dev.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, repeat, resolve, runWithOwner, snapshot, untrack } from '@solidjs/signals';
|
|
1
|
+
import { getContext, createMemo, flatten, createRoot, setContext, getOwner, untrack, NotReadyError, getNextChildId, createLoadBoundary, createSignal, flush, runWithOwner, mapArray, repeat, createErrorBoundary, createBoundary } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol("COMPONENT_DEV" );
|
|
5
|
-
function onMount(fn) {
|
|
6
|
-
createEffect(() => null, fn);
|
|
7
|
-
}
|
|
8
5
|
function createContext(defaultValue, options) {
|
|
9
6
|
const id = Symbol(options && options.name || "");
|
|
10
7
|
function provider(props) {
|
|
@@ -73,50 +70,6 @@ function reducer(source, reducerFn) {
|
|
|
73
70
|
}];
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
function observable(input) {
|
|
77
|
-
return {
|
|
78
|
-
subscribe(observer) {
|
|
79
|
-
if (!(observer instanceof Object) || observer == null) {
|
|
80
|
-
throw new TypeError("Expected the observer to be an object.");
|
|
81
|
-
}
|
|
82
|
-
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
83
|
-
if (!handler) {
|
|
84
|
-
return {
|
|
85
|
-
unsubscribe() {}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const dispose = createRoot(disposer => {
|
|
89
|
-
createEffect(() => input(), v => {
|
|
90
|
-
handler(v);
|
|
91
|
-
});
|
|
92
|
-
return disposer;
|
|
93
|
-
});
|
|
94
|
-
if (getOwner()) onCleanup(dispose);
|
|
95
|
-
return {
|
|
96
|
-
unsubscribe() {
|
|
97
|
-
dispose();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
[Symbol.observable || "@@observable"]() {
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function from(producer, initialValue = undefined) {
|
|
107
|
-
const [s, set] = createSignal(() => initialValue, initialValue, {
|
|
108
|
-
equals: false
|
|
109
|
-
});
|
|
110
|
-
if ("subscribe" in producer) {
|
|
111
|
-
const unsub = producer.subscribe(v => set(() => v));
|
|
112
|
-
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
113
|
-
} else {
|
|
114
|
-
const clean = producer(set);
|
|
115
|
-
onCleanup(clean);
|
|
116
|
-
}
|
|
117
|
-
return s;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
73
|
const sharedConfig = {
|
|
121
74
|
hydrating: false,
|
|
122
75
|
registry: undefined,
|
|
@@ -160,58 +113,6 @@ function Loading(props) {
|
|
|
160
113
|
return createLoadBoundary(() => props.children, () => props.fallback);
|
|
161
114
|
});
|
|
162
115
|
}
|
|
163
|
-
function createAsync(compute, value, options) {
|
|
164
|
-
if (!sharedConfig.hydrating) return createAsync$1(compute, value, options);
|
|
165
|
-
return createAsync$1(prev => {
|
|
166
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
167
|
-
const o = getOwner();
|
|
168
|
-
let initP;
|
|
169
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
170
|
-
const init = initP?.value || initP;
|
|
171
|
-
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
172
|
-
}, value, options);
|
|
173
|
-
}
|
|
174
|
-
class MockPromise {
|
|
175
|
-
static all() {
|
|
176
|
-
return new MockPromise();
|
|
177
|
-
}
|
|
178
|
-
static allSettled() {
|
|
179
|
-
return new MockPromise();
|
|
180
|
-
}
|
|
181
|
-
static any() {
|
|
182
|
-
return new MockPromise();
|
|
183
|
-
}
|
|
184
|
-
static race() {
|
|
185
|
-
return new MockPromise();
|
|
186
|
-
}
|
|
187
|
-
static reject() {
|
|
188
|
-
return new MockPromise();
|
|
189
|
-
}
|
|
190
|
-
static resolve() {
|
|
191
|
-
return new MockPromise();
|
|
192
|
-
}
|
|
193
|
-
catch() {
|
|
194
|
-
return new MockPromise();
|
|
195
|
-
}
|
|
196
|
-
then() {
|
|
197
|
-
return new MockPromise();
|
|
198
|
-
}
|
|
199
|
-
finally() {
|
|
200
|
-
return new MockPromise();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function subFetch(fn, prev) {
|
|
204
|
-
const ogFetch = fetch;
|
|
205
|
-
const ogPromise = Promise;
|
|
206
|
-
try {
|
|
207
|
-
window.fetch = () => new MockPromise();
|
|
208
|
-
Promise = MockPromise;
|
|
209
|
-
return fn(prev);
|
|
210
|
-
} finally {
|
|
211
|
-
window.fetch = ogFetch;
|
|
212
|
-
Promise = ogPromise;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
116
|
|
|
216
117
|
function enableHydration() {
|
|
217
118
|
}
|
|
@@ -222,10 +123,7 @@ function lazy(fn) {
|
|
|
222
123
|
let comp;
|
|
223
124
|
let p;
|
|
224
125
|
const wrap = props => {
|
|
225
|
-
|
|
226
|
-
const s = createAsync$1(() => (p || (p = fn())).then(mod => mod.default));
|
|
227
|
-
comp = s;
|
|
228
|
-
}
|
|
126
|
+
comp = createMemo(() => (p || (p = fn())).then(mod => mod.default));
|
|
229
127
|
let Comp;
|
|
230
128
|
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
231
129
|
Object.assign(Comp, {
|
|
@@ -342,4 +240,4 @@ if (globalThis) {
|
|
|
342
240
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
343
241
|
}
|
|
344
242
|
|
|
345
|
-
export { $DEVCOMP, Boundary, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children,
|
|
243
|
+
export { $DEVCOMP, Boundary, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createUniqueId, enableHydration, lazy, reducer, sharedConfig, ssrHandleError, ssrRunInScope, tryCatch, useContext };
|
package/dist/solid.cjs
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
var signals = require('@solidjs/signals');
|
|
4
4
|
|
|
5
5
|
const $DEVCOMP = Symbol(0);
|
|
6
|
-
function onMount(fn) {
|
|
7
|
-
signals.createEffect(() => null, fn);
|
|
8
|
-
}
|
|
9
6
|
function createContext(defaultValue, options) {
|
|
10
7
|
const id = Symbol(options && options.name || "");
|
|
11
8
|
function provider(props) {
|
|
@@ -52,50 +49,6 @@ function reducer(source, reducerFn) {
|
|
|
52
49
|
}];
|
|
53
50
|
}
|
|
54
51
|
|
|
55
|
-
function observable(input) {
|
|
56
|
-
return {
|
|
57
|
-
subscribe(observer) {
|
|
58
|
-
if (!(observer instanceof Object) || observer == null) {
|
|
59
|
-
throw new TypeError("Expected the observer to be an object.");
|
|
60
|
-
}
|
|
61
|
-
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
62
|
-
if (!handler) {
|
|
63
|
-
return {
|
|
64
|
-
unsubscribe() {}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const dispose = signals.createRoot(disposer => {
|
|
68
|
-
signals.createEffect(() => input(), v => {
|
|
69
|
-
handler(v);
|
|
70
|
-
});
|
|
71
|
-
return disposer;
|
|
72
|
-
});
|
|
73
|
-
if (signals.getOwner()) signals.onCleanup(dispose);
|
|
74
|
-
return {
|
|
75
|
-
unsubscribe() {
|
|
76
|
-
dispose();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
[Symbol.observable || "@@observable"]() {
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function from(producer, initialValue = undefined) {
|
|
86
|
-
const [s, set] = signals.createSignal(() => initialValue, initialValue, {
|
|
87
|
-
equals: false
|
|
88
|
-
});
|
|
89
|
-
if ("subscribe" in producer) {
|
|
90
|
-
const unsub = producer.subscribe(v => set(() => v));
|
|
91
|
-
signals.onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
92
|
-
} else {
|
|
93
|
-
const clean = producer(set);
|
|
94
|
-
signals.onCleanup(clean);
|
|
95
|
-
}
|
|
96
|
-
return s;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
52
|
const sharedConfig = {
|
|
100
53
|
hydrating: false,
|
|
101
54
|
registry: undefined,
|
|
@@ -139,58 +92,6 @@ function Loading(props) {
|
|
|
139
92
|
return signals.createLoadBoundary(() => props.children, () => props.fallback);
|
|
140
93
|
});
|
|
141
94
|
}
|
|
142
|
-
function createAsync(compute, value, options) {
|
|
143
|
-
if (!sharedConfig.hydrating) return signals.createAsync(compute, value, options);
|
|
144
|
-
return signals.createAsync(prev => {
|
|
145
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
146
|
-
const o = signals.getOwner();
|
|
147
|
-
let initP;
|
|
148
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
149
|
-
const init = initP?.value || initP;
|
|
150
|
-
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
151
|
-
}, value, options);
|
|
152
|
-
}
|
|
153
|
-
class MockPromise {
|
|
154
|
-
static all() {
|
|
155
|
-
return new MockPromise();
|
|
156
|
-
}
|
|
157
|
-
static allSettled() {
|
|
158
|
-
return new MockPromise();
|
|
159
|
-
}
|
|
160
|
-
static any() {
|
|
161
|
-
return new MockPromise();
|
|
162
|
-
}
|
|
163
|
-
static race() {
|
|
164
|
-
return new MockPromise();
|
|
165
|
-
}
|
|
166
|
-
static reject() {
|
|
167
|
-
return new MockPromise();
|
|
168
|
-
}
|
|
169
|
-
static resolve() {
|
|
170
|
-
return new MockPromise();
|
|
171
|
-
}
|
|
172
|
-
catch() {
|
|
173
|
-
return new MockPromise();
|
|
174
|
-
}
|
|
175
|
-
then() {
|
|
176
|
-
return new MockPromise();
|
|
177
|
-
}
|
|
178
|
-
finally() {
|
|
179
|
-
return new MockPromise();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function subFetch(fn, prev) {
|
|
183
|
-
const ogFetch = fetch;
|
|
184
|
-
const ogPromise = Promise;
|
|
185
|
-
try {
|
|
186
|
-
window.fetch = () => new MockPromise();
|
|
187
|
-
Promise = MockPromise;
|
|
188
|
-
return fn(prev);
|
|
189
|
-
} finally {
|
|
190
|
-
window.fetch = ogFetch;
|
|
191
|
-
Promise = ogPromise;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
95
|
|
|
195
96
|
function enableHydration() {
|
|
196
97
|
}
|
|
@@ -201,10 +102,7 @@ function lazy(fn) {
|
|
|
201
102
|
let comp;
|
|
202
103
|
let p;
|
|
203
104
|
const wrap = props => {
|
|
204
|
-
|
|
205
|
-
const s = signals.createAsync(() => (p || (p = fn())).then(mod => mod.default));
|
|
206
|
-
comp = s;
|
|
207
|
-
}
|
|
105
|
+
comp = signals.createMemo(() => (p || (p = fn())).then(mod => mod.default));
|
|
208
106
|
let Comp;
|
|
209
107
|
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
|
|
210
108
|
return Comp(props);
|
|
@@ -380,6 +278,10 @@ Object.defineProperty(exports, "isPending", {
|
|
|
380
278
|
enumerable: true,
|
|
381
279
|
get: function () { return signals.isPending; }
|
|
382
280
|
});
|
|
281
|
+
Object.defineProperty(exports, "isRefreshing", {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: function () { return signals.isRefreshing; }
|
|
284
|
+
});
|
|
383
285
|
Object.defineProperty(exports, "isWrappable", {
|
|
384
286
|
enumerable: true,
|
|
385
287
|
get: function () { return signals.isWrappable; }
|
|
@@ -412,6 +314,10 @@ Object.defineProperty(exports, "reconcile", {
|
|
|
412
314
|
enumerable: true,
|
|
413
315
|
get: function () { return signals.reconcile; }
|
|
414
316
|
});
|
|
317
|
+
Object.defineProperty(exports, "refresh", {
|
|
318
|
+
enumerable: true,
|
|
319
|
+
get: function () { return signals.refresh; }
|
|
320
|
+
});
|
|
415
321
|
Object.defineProperty(exports, "repeat", {
|
|
416
322
|
enumerable: true,
|
|
417
323
|
get: function () { return signals.repeat; }
|
|
@@ -443,15 +349,11 @@ exports.Repeat = Repeat;
|
|
|
443
349
|
exports.Show = Show;
|
|
444
350
|
exports.Switch = Switch;
|
|
445
351
|
exports.children = children;
|
|
446
|
-
exports.createAsync = createAsync;
|
|
447
352
|
exports.createComponent = createComponent;
|
|
448
353
|
exports.createContext = createContext;
|
|
449
354
|
exports.createUniqueId = createUniqueId;
|
|
450
355
|
exports.enableHydration = enableHydration;
|
|
451
|
-
exports.from = from;
|
|
452
356
|
exports.lazy = lazy;
|
|
453
|
-
exports.observable = observable;
|
|
454
|
-
exports.onMount = onMount;
|
|
455
357
|
exports.reducer = reducer;
|
|
456
358
|
exports.sharedConfig = sharedConfig;
|
|
457
359
|
exports.ssrHandleError = ssrHandleError;
|
package/dist/solid.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, repeat, resolve, runWithOwner, snapshot, untrack } from '@solidjs/signals';
|
|
1
|
+
import { getContext, createMemo, flatten, createRoot, setContext, NotReadyError, getOwner, getNextChildId, createLoadBoundary, createSignal, flush, runWithOwner, untrack, mapArray, repeat, createErrorBoundary, createBoundary } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol(0);
|
|
5
|
-
function onMount(fn) {
|
|
6
|
-
createEffect(() => null, fn);
|
|
7
|
-
}
|
|
8
5
|
function createContext(defaultValue, options) {
|
|
9
6
|
const id = Symbol(options && options.name || "");
|
|
10
7
|
function provider(props) {
|
|
@@ -51,50 +48,6 @@ function reducer(source, reducerFn) {
|
|
|
51
48
|
}];
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
function observable(input) {
|
|
55
|
-
return {
|
|
56
|
-
subscribe(observer) {
|
|
57
|
-
if (!(observer instanceof Object) || observer == null) {
|
|
58
|
-
throw new TypeError("Expected the observer to be an object.");
|
|
59
|
-
}
|
|
60
|
-
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
61
|
-
if (!handler) {
|
|
62
|
-
return {
|
|
63
|
-
unsubscribe() {}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const dispose = createRoot(disposer => {
|
|
67
|
-
createEffect(() => input(), v => {
|
|
68
|
-
handler(v);
|
|
69
|
-
});
|
|
70
|
-
return disposer;
|
|
71
|
-
});
|
|
72
|
-
if (getOwner()) onCleanup(dispose);
|
|
73
|
-
return {
|
|
74
|
-
unsubscribe() {
|
|
75
|
-
dispose();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
[Symbol.observable || "@@observable"]() {
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function from(producer, initialValue = undefined) {
|
|
85
|
-
const [s, set] = createSignal(() => initialValue, initialValue, {
|
|
86
|
-
equals: false
|
|
87
|
-
});
|
|
88
|
-
if ("subscribe" in producer) {
|
|
89
|
-
const unsub = producer.subscribe(v => set(() => v));
|
|
90
|
-
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
91
|
-
} else {
|
|
92
|
-
const clean = producer(set);
|
|
93
|
-
onCleanup(clean);
|
|
94
|
-
}
|
|
95
|
-
return s;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
51
|
const sharedConfig = {
|
|
99
52
|
hydrating: false,
|
|
100
53
|
registry: undefined,
|
|
@@ -138,58 +91,6 @@ function Loading(props) {
|
|
|
138
91
|
return createLoadBoundary(() => props.children, () => props.fallback);
|
|
139
92
|
});
|
|
140
93
|
}
|
|
141
|
-
function createAsync(compute, value, options) {
|
|
142
|
-
if (!sharedConfig.hydrating) return createAsync$1(compute, value, options);
|
|
143
|
-
return createAsync$1(prev => {
|
|
144
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
145
|
-
const o = getOwner();
|
|
146
|
-
let initP;
|
|
147
|
-
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
148
|
-
const init = initP?.value || initP;
|
|
149
|
-
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
150
|
-
}, value, options);
|
|
151
|
-
}
|
|
152
|
-
class MockPromise {
|
|
153
|
-
static all() {
|
|
154
|
-
return new MockPromise();
|
|
155
|
-
}
|
|
156
|
-
static allSettled() {
|
|
157
|
-
return new MockPromise();
|
|
158
|
-
}
|
|
159
|
-
static any() {
|
|
160
|
-
return new MockPromise();
|
|
161
|
-
}
|
|
162
|
-
static race() {
|
|
163
|
-
return new MockPromise();
|
|
164
|
-
}
|
|
165
|
-
static reject() {
|
|
166
|
-
return new MockPromise();
|
|
167
|
-
}
|
|
168
|
-
static resolve() {
|
|
169
|
-
return new MockPromise();
|
|
170
|
-
}
|
|
171
|
-
catch() {
|
|
172
|
-
return new MockPromise();
|
|
173
|
-
}
|
|
174
|
-
then() {
|
|
175
|
-
return new MockPromise();
|
|
176
|
-
}
|
|
177
|
-
finally() {
|
|
178
|
-
return new MockPromise();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function subFetch(fn, prev) {
|
|
182
|
-
const ogFetch = fetch;
|
|
183
|
-
const ogPromise = Promise;
|
|
184
|
-
try {
|
|
185
|
-
window.fetch = () => new MockPromise();
|
|
186
|
-
Promise = MockPromise;
|
|
187
|
-
return fn(prev);
|
|
188
|
-
} finally {
|
|
189
|
-
window.fetch = ogFetch;
|
|
190
|
-
Promise = ogPromise;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
94
|
|
|
194
95
|
function enableHydration() {
|
|
195
96
|
}
|
|
@@ -200,10 +101,7 @@ function lazy(fn) {
|
|
|
200
101
|
let comp;
|
|
201
102
|
let p;
|
|
202
103
|
const wrap = props => {
|
|
203
|
-
|
|
204
|
-
const s = createAsync$1(() => (p || (p = fn())).then(mod => mod.default));
|
|
205
|
-
comp = s;
|
|
206
|
-
}
|
|
104
|
+
comp = createMemo(() => (p || (p = fn())).then(mod => mod.default));
|
|
207
105
|
let Comp;
|
|
208
106
|
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
209
107
|
return Comp(props);
|
|
@@ -299,4 +197,4 @@ function ssrHandleError() {}
|
|
|
299
197
|
function ssrRunInScope() {}
|
|
300
198
|
const DEV = undefined;
|
|
301
199
|
|
|
302
|
-
export { $DEVCOMP, Boundary, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children,
|
|
200
|
+
export { $DEVCOMP, Boundary, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createUniqueId, enableHydration, lazy, reducer, sharedConfig, ssrHandleError, ssrRunInScope, tryCatch, useContext };
|
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": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.12",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"performance"
|
|
80
80
|
],
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.
|
|
82
|
+
"@solidjs/signals": "^0.9.0",
|
|
83
83
|
"csstype": "^3.1.0",
|
|
84
84
|
"seroval": "~1.3.0",
|
|
85
85
|
"seroval-plugins": "~1.3.0"
|
package/types/client/core.d.ts
CHANGED
|
@@ -3,13 +3,6 @@ import type { JSX } from "../jsx.js";
|
|
|
3
3
|
import { FlowComponent } from "./component.js";
|
|
4
4
|
export declare const IS_DEV: string | boolean;
|
|
5
5
|
export declare const $DEVCOMP: unique symbol;
|
|
6
|
-
/**
|
|
7
|
-
* Runs an effect only after initial render on mount
|
|
8
|
-
* @param fn an effect that should run only once on mount
|
|
9
|
-
*
|
|
10
|
-
* @description https://docs.solidjs.com/reference/lifecycle/on-mount
|
|
11
|
-
*/
|
|
12
|
-
export declare function onMount(fn: () => void): void;
|
|
13
6
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
14
7
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
15
8
|
value: T;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MemoOptions } from "@solidjs/signals";
|
|
2
1
|
import { JSX } from "../jsx.js";
|
|
3
2
|
export type HydrationContext = {};
|
|
4
3
|
type SharedConfig = {
|
|
@@ -29,22 +28,4 @@ export declare function Loading(props: {
|
|
|
29
28
|
fallback?: JSX.Element;
|
|
30
29
|
children: JSX.Element;
|
|
31
30
|
}): JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a readonly derived async reactive memoized signal
|
|
34
|
-
* ```typescript
|
|
35
|
-
* export function createAsync<T>(
|
|
36
|
-
* compute: (v: T) => Promise<T> | T,
|
|
37
|
-
* value?: T,
|
|
38
|
-
* options?: { name?: string, equals?: false | ((prev: T, next: T) => boolean) }
|
|
39
|
-
* ): () => T & { refresh: () => void };
|
|
40
|
-
* ```
|
|
41
|
-
* @param compute a function that receives its previous or the initial value, if set, and returns a new value used to react on a computation
|
|
42
|
-
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
43
|
-
* @param options allows to set a name in dev mode for debugging purposes and use a custom comparison function in equals
|
|
44
|
-
*
|
|
45
|
-
* @description https://docs.solidjs.com/reference/basic-reactivity/create-async
|
|
46
|
-
*/
|
|
47
|
-
export declare function createAsync<T>(compute: (prev?: T) => Promise<T> | AsyncIterable<T> | T, value?: T, options?: MemoOptions<T>): import("@solidjs/signals").Accessor<T> & {
|
|
48
|
-
refresh: () => void;
|
|
49
|
-
};
|
|
50
31
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, repeat, resolve, runWithOwner, snapshot, untrack } from "@solidjs/signals";
|
|
1
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, pending, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, untrack } from "@solidjs/signals";
|
|
2
2
|
export type { Accessor, BoundaryMode, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter } from "@solidjs/signals";
|
|
3
|
-
export { $DEVCOMP, children, createContext,
|
|
3
|
+
export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
5
5
|
export * from "./utilities.js";
|
|
6
|
-
export * from "./client/observable.js";
|
|
7
6
|
export * from "./client/component.js";
|
|
8
7
|
export * from "./client/flow.js";
|
|
9
|
-
export { sharedConfig,
|
|
8
|
+
export { sharedConfig, Loading } from "./client/hydration.js";
|
|
10
9
|
export declare function ssrHandleError(): void;
|
|
11
10
|
export declare function ssrRunInScope(): void;
|
|
12
11
|
import type { JSX } from "./jsx.js";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Accessor, Setter } from "@solidjs/signals";
|
|
2
|
-
declare global {
|
|
3
|
-
interface SymbolConstructor {
|
|
4
|
-
readonly observable: symbol;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
interface Observable<T> {
|
|
8
|
-
subscribe(observer: ObservableObserver<T>): {
|
|
9
|
-
unsubscribe(): void;
|
|
10
|
-
};
|
|
11
|
-
[Symbol.observable](): Observable<T>;
|
|
12
|
-
}
|
|
13
|
-
export type ObservableObserver<T> = ((v: T) => void) | {
|
|
14
|
-
next?: (v: T) => void;
|
|
15
|
-
error?: (v: any) => void;
|
|
16
|
-
complete?: (v: boolean) => void;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Creates a simple observable from a signal's accessor to be used with the `from` operator of observable libraries like e.g. rxjs
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { from } from "rxjs";
|
|
22
|
-
* const [s, set] = createSignal(0);
|
|
23
|
-
* const obsv$ = from(observable(s));
|
|
24
|
-
* obsv$.subscribe((v) => console.log(v));
|
|
25
|
-
* ```
|
|
26
|
-
* description https://docs.solidjs.com/reference/reactive-utilities/observable
|
|
27
|
-
*/
|
|
28
|
-
export declare function observable<T>(input: Accessor<T>): Observable<T>;
|
|
29
|
-
type Producer<T> = ((setter: Setter<T>) => () => void) | {
|
|
30
|
-
subscribe: (fn: (v: T) => void) => (() => void) | {
|
|
31
|
-
unsubscribe: () => void;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export declare function from<T>(producer: Producer<T>, initalValue: T): Accessor<T>;
|
|
35
|
-
export declare function from<T>(producer: Producer<T | undefined>): Accessor<T | undefined>;
|
|
36
|
-
export {};
|