solid-js 2.0.0-beta.1 → 2.0.0-beta.11
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 +640 -0
- package/README.md +42 -188
- package/dist/dev.cjs +446 -291
- package/dist/dev.js +426 -293
- package/dist/server.cjs +941 -345
- package/dist/server.js +897 -299
- package/dist/solid.cjs +438 -261
- package/dist/solid.js +418 -263
- package/package.json +67 -39
- package/types/client/component.d.ts +64 -19
- package/types/client/core.d.ts +110 -34
- package/types/client/flow.d.ts +176 -42
- package/types/client/hydration.d.ts +513 -37
- package/types/index.d.ts +8 -13
- package/types/server/component.d.ts +11 -11
- package/types/server/core.d.ts +19 -21
- package/types/server/flow.d.ts +76 -21
- package/types/server/hydration.d.ts +34 -9
- package/types/server/index.d.ts +6 -8
- package/types/server/shared.d.ts +10 -2
- package/types/server/signals.d.ts +80 -19
- package/types/types.d.ts +15 -0
- package/types-cjs/client/component.d.cts +120 -0
- package/types-cjs/client/core.d.cts +141 -0
- package/types-cjs/client/flow.d.cts +234 -0
- package/types-cjs/client/hydration.d.cts +568 -0
- package/types-cjs/index.d.cts +15 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server/component.d.cts +67 -0
- package/types-cjs/server/core.d.cts +42 -0
- package/types-cjs/server/flow.d.cts +115 -0
- package/types-cjs/server/hydration.d.cts +63 -0
- package/types-cjs/server/index.d.cts +10 -0
- package/types-cjs/server/shared.d.cts +54 -0
- package/types-cjs/server/signals.d.cts +123 -0
- package/types-cjs/types.d.cts +15 -0
- package/jsx-runtime.d.ts +0 -1
- package/types/jsx.d.ts +0 -4129
package/dist/server.cjs
CHANGED
|
@@ -8,13 +8,149 @@ const NoHydrateContext = {
|
|
|
8
8
|
};
|
|
9
9
|
const sharedConfig = {
|
|
10
10
|
getNextContextId() {
|
|
11
|
-
const o =
|
|
11
|
+
const o = getOwner();
|
|
12
12
|
if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
13
|
+
if (getContext(NoHydrateContext)) return undefined;
|
|
14
|
+
return getNextChildId(o);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
const defaultSSRContext = {};
|
|
19
|
+
let currentOwner = null;
|
|
20
|
+
const OWNER_POOL_MAX = 4096;
|
|
21
|
+
const ownerPool = [];
|
|
22
|
+
function formatChildId(prefix, id) {
|
|
23
|
+
const num = id.toString(36);
|
|
24
|
+
const len = num.length - 1;
|
|
25
|
+
return prefix + (len ? String.fromCharCode(64 + len) : "") + num;
|
|
26
|
+
}
|
|
27
|
+
function nextChildIdFor(owner, consume) {
|
|
28
|
+
let counter = owner;
|
|
29
|
+
while (counter._transparent && counter._parent) counter = counter._parent;
|
|
30
|
+
if (counter.id != null) {
|
|
31
|
+
return formatChildId(counter.id, counter._childCount++ );
|
|
32
|
+
}
|
|
33
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
34
|
+
}
|
|
35
|
+
function getNextChildId(owner) {
|
|
36
|
+
return nextChildIdFor(owner);
|
|
37
|
+
}
|
|
38
|
+
function createOwner(options) {
|
|
39
|
+
const parent = currentOwner;
|
|
40
|
+
const transparent = options?.transparent ?? false;
|
|
41
|
+
const id = options?.id ?? (transparent ? parent?.id : parent?.id != null ? nextChildIdFor(parent) : undefined);
|
|
42
|
+
const ctx = parent?._context ?? defaultSSRContext;
|
|
43
|
+
let owner;
|
|
44
|
+
if (ownerPool.length) {
|
|
45
|
+
owner = ownerPool.pop();
|
|
46
|
+
owner.id = id;
|
|
47
|
+
owner._transparent = transparent;
|
|
48
|
+
owner._disposal = null;
|
|
49
|
+
owner._parent = parent;
|
|
50
|
+
owner._context = ctx;
|
|
51
|
+
owner._childCount = 0;
|
|
52
|
+
owner._firstChild = null;
|
|
53
|
+
owner._nextSibling = null;
|
|
54
|
+
owner._disposed = false;
|
|
55
|
+
} else {
|
|
56
|
+
owner = {
|
|
57
|
+
id,
|
|
58
|
+
_transparent: transparent,
|
|
59
|
+
_disposal: null,
|
|
60
|
+
_parent: parent,
|
|
61
|
+
_context: ctx,
|
|
62
|
+
_childCount: 0,
|
|
63
|
+
_firstChild: null,
|
|
64
|
+
_nextSibling: null,
|
|
65
|
+
_disposed: false
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (parent) {
|
|
69
|
+
const lastChild = parent._firstChild;
|
|
70
|
+
if (lastChild) owner._nextSibling = lastChild;
|
|
71
|
+
parent._firstChild = owner;
|
|
72
|
+
}
|
|
73
|
+
return owner;
|
|
74
|
+
}
|
|
75
|
+
function runWithOwner(owner, fn) {
|
|
76
|
+
const prev = currentOwner;
|
|
77
|
+
currentOwner = owner;
|
|
78
|
+
try {
|
|
79
|
+
return fn();
|
|
80
|
+
} finally {
|
|
81
|
+
currentOwner = prev;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getOwner() {
|
|
85
|
+
return currentOwner;
|
|
86
|
+
}
|
|
87
|
+
function isDisposed(owner) {
|
|
88
|
+
return owner._disposed;
|
|
89
|
+
}
|
|
90
|
+
function onCleanup(fn) {
|
|
91
|
+
const o = currentOwner;
|
|
92
|
+
if (!o) return fn;
|
|
93
|
+
if (!o._disposal) o._disposal = fn;else if (Array.isArray(o._disposal)) o._disposal.push(fn);else o._disposal = [o._disposal, fn];
|
|
94
|
+
return fn;
|
|
95
|
+
}
|
|
96
|
+
function getContext(context, owner = currentOwner) {
|
|
97
|
+
if (!owner) throw new signals.NoOwnerError();
|
|
98
|
+
const map = owner._context;
|
|
99
|
+
const stored = map[context.id];
|
|
100
|
+
const value = stored !== undefined ? stored : context.defaultValue;
|
|
101
|
+
if (value === undefined) throw new signals.ContextNotFoundError();
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
function setContext(context, value, owner = currentOwner) {
|
|
105
|
+
if (!owner) throw new signals.NoOwnerError();
|
|
106
|
+
const o = owner;
|
|
107
|
+
o._context = {
|
|
108
|
+
...o._context,
|
|
109
|
+
[context.id]: value === undefined ? context.defaultValue : value
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function disposeOwner(owner, self = true) {
|
|
113
|
+
const node = owner;
|
|
114
|
+
if (node._disposed) return;
|
|
115
|
+
if (!node._firstChild && !node._disposal) {
|
|
116
|
+
if (self) {
|
|
117
|
+
node._disposed = true;
|
|
118
|
+
if (ownerPool.length < OWNER_POOL_MAX) {
|
|
119
|
+
node._parent = null;
|
|
120
|
+
node._nextSibling = null;
|
|
121
|
+
ownerPool.push(node);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (self) node._disposed = true;
|
|
127
|
+
let child = node._firstChild;
|
|
128
|
+
while (child) {
|
|
129
|
+
const next = child._nextSibling;
|
|
130
|
+
disposeOwner(child, true);
|
|
131
|
+
child = next;
|
|
132
|
+
}
|
|
133
|
+
node._firstChild = null;
|
|
134
|
+
node._childCount = 0;
|
|
135
|
+
const d = node._disposal;
|
|
136
|
+
if (d) {
|
|
137
|
+
if (Array.isArray(d)) {
|
|
138
|
+
for (let i = 0, len = d.length; i < len; i++) d[i]();
|
|
139
|
+
} else {
|
|
140
|
+
d();
|
|
141
|
+
}
|
|
142
|
+
node._disposal = null;
|
|
143
|
+
}
|
|
144
|
+
if (self && ownerPool.length < OWNER_POOL_MAX) {
|
|
145
|
+
node._parent = null;
|
|
146
|
+
node._nextSibling = null;
|
|
147
|
+
ownerPool.push(node);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function createRoot(init, options) {
|
|
151
|
+
const owner = createOwner(options);
|
|
152
|
+
return runWithOwner(owner, () => init(() => disposeOwner(owner)));
|
|
153
|
+
}
|
|
18
154
|
let Observer = null;
|
|
19
155
|
function runWithObserver(comp, fn) {
|
|
20
156
|
const prev = Observer;
|
|
@@ -28,68 +164,116 @@ function runWithObserver(comp, fn) {
|
|
|
28
164
|
function getObserver() {
|
|
29
165
|
return Observer;
|
|
30
166
|
}
|
|
31
|
-
function
|
|
167
|
+
function createDeferredPromise() {
|
|
168
|
+
let settled = false;
|
|
169
|
+
let resolvePromise;
|
|
170
|
+
let rejectPromise;
|
|
171
|
+
const promise = new Promise((resolve, reject) => {
|
|
172
|
+
resolvePromise = resolve;
|
|
173
|
+
rejectPromise = reject;
|
|
174
|
+
});
|
|
175
|
+
return {
|
|
176
|
+
promise,
|
|
177
|
+
resolve(value) {
|
|
178
|
+
if (settled) return;
|
|
179
|
+
settled = true;
|
|
180
|
+
promise.s = 1;
|
|
181
|
+
promise.v = value;
|
|
182
|
+
resolvePromise(value);
|
|
183
|
+
},
|
|
184
|
+
reject(error) {
|
|
185
|
+
if (settled) return;
|
|
186
|
+
settled = true;
|
|
187
|
+
promise.s = 2;
|
|
188
|
+
promise.v = error;
|
|
189
|
+
rejectPromise(error);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function subscribePendingRetry(error, retry) {
|
|
194
|
+
if (!(error instanceof signals.NotReadyError)) return false;
|
|
195
|
+
error.source?.then(() => retry(), () => retry());
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
function settleServerAsync(initial, rerun, deferred, onSuccess, onError, isDisposed) {
|
|
199
|
+
let first = true;
|
|
200
|
+
const attempt = () => {
|
|
201
|
+
if (isDisposed()) return;
|
|
202
|
+
let current;
|
|
203
|
+
try {
|
|
204
|
+
current = first ? initial : rerun();
|
|
205
|
+
first = false;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (subscribePendingRetry(error, attempt)) return;
|
|
208
|
+
onError(error);
|
|
209
|
+
deferred.reject(error);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
Promise.resolve(current).then(value => {
|
|
213
|
+
if (isDisposed()) return;
|
|
214
|
+
deferred.resolve(onSuccess(value));
|
|
215
|
+
}, error => {
|
|
216
|
+
if (isDisposed()) return;
|
|
217
|
+
if (subscribePendingRetry(error, attempt)) return;
|
|
218
|
+
onError(error);
|
|
219
|
+
deferred.reject(error);
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
attempt();
|
|
223
|
+
}
|
|
224
|
+
function createSignal(first, second) {
|
|
32
225
|
if (typeof first === "function") {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let value = second;
|
|
37
|
-
return [() => value, v => {
|
|
38
|
-
return value = typeof v === "function" ? v(value) : v;
|
|
39
|
-
}];
|
|
40
|
-
}
|
|
41
|
-
const memoOpts = third?.deferStream || ssrSource ? {
|
|
42
|
-
deferStream: third?.deferStream,
|
|
43
|
-
ssrSource
|
|
226
|
+
const opts = second?.deferStream || second?.ssrSource ? {
|
|
227
|
+
deferStream: second?.deferStream,
|
|
228
|
+
ssrSource: second?.ssrSource
|
|
44
229
|
} : undefined;
|
|
45
|
-
const memo = createMemo(
|
|
46
|
-
|
|
47
|
-
return [() => value, v => {
|
|
48
|
-
return value = typeof v === "function" ? v(value) : v;
|
|
49
|
-
}];
|
|
50
|
-
}, undefined, memoOpts);
|
|
51
|
-
return [() => memo()[0](), v => memo()[1](v)];
|
|
230
|
+
const memo = createMemo(prev => first(prev), opts);
|
|
231
|
+
return [memo, () => undefined];
|
|
52
232
|
}
|
|
53
233
|
return [() => first, v => {
|
|
54
234
|
return first = typeof v === "function" ? v(first) : v;
|
|
55
235
|
}];
|
|
56
236
|
}
|
|
57
|
-
function createMemo(compute,
|
|
237
|
+
function createMemo(compute, options) {
|
|
238
|
+
if (options?.sync) {
|
|
239
|
+
return createSyncMemo(compute, options);
|
|
240
|
+
}
|
|
58
241
|
const ctx = sharedConfig.context;
|
|
59
|
-
const owner =
|
|
242
|
+
const owner = createOwner();
|
|
60
243
|
const comp = {
|
|
61
244
|
owner,
|
|
62
|
-
value:
|
|
245
|
+
value: undefined,
|
|
63
246
|
compute: compute,
|
|
64
247
|
error: undefined,
|
|
65
248
|
computed: false,
|
|
66
249
|
disposed: false
|
|
67
250
|
};
|
|
68
|
-
|
|
251
|
+
runWithOwner(owner, () => onCleanup(() => {
|
|
69
252
|
comp.disposed = true;
|
|
70
253
|
}));
|
|
71
254
|
function update() {
|
|
72
255
|
if (comp.disposed) return;
|
|
256
|
+
const run = () => runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value)));
|
|
73
257
|
try {
|
|
74
258
|
comp.error = undefined;
|
|
75
|
-
const result =
|
|
259
|
+
const result = run();
|
|
76
260
|
comp.computed = true;
|
|
77
|
-
processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource);
|
|
261
|
+
processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource, run);
|
|
78
262
|
} catch (err) {
|
|
79
263
|
if (err instanceof signals.NotReadyError) {
|
|
80
|
-
err
|
|
264
|
+
subscribePendingRetry(err, update);
|
|
81
265
|
}
|
|
82
266
|
comp.error = err;
|
|
83
267
|
comp.computed = true;
|
|
84
268
|
}
|
|
85
269
|
}
|
|
86
270
|
const ssrSource = options?.ssrSource;
|
|
87
|
-
if (ssrSource === "
|
|
271
|
+
if (ssrSource === "client") {
|
|
88
272
|
comp.computed = true;
|
|
89
273
|
} else if (!options?.lazy) {
|
|
90
274
|
update();
|
|
91
275
|
}
|
|
92
|
-
|
|
276
|
+
const read = () => {
|
|
93
277
|
if (!comp.computed) {
|
|
94
278
|
update();
|
|
95
279
|
}
|
|
@@ -98,6 +282,44 @@ function createMemo(compute, value, options) {
|
|
|
98
282
|
}
|
|
99
283
|
return comp.value;
|
|
100
284
|
};
|
|
285
|
+
read[signals.$REFRESH] = comp;
|
|
286
|
+
return read;
|
|
287
|
+
}
|
|
288
|
+
function createSyncMemo(compute, options) {
|
|
289
|
+
const owner = createOwner();
|
|
290
|
+
let value;
|
|
291
|
+
let error;
|
|
292
|
+
let cached = false;
|
|
293
|
+
function pull() {
|
|
294
|
+
const prev = currentOwner;
|
|
295
|
+
currentOwner = owner;
|
|
296
|
+
try {
|
|
297
|
+
value = compute(value);
|
|
298
|
+
error = undefined;
|
|
299
|
+
cached = true;
|
|
300
|
+
return value;
|
|
301
|
+
} catch (err) {
|
|
302
|
+
if (err instanceof signals.NotReadyError) throw err;
|
|
303
|
+
error = err;
|
|
304
|
+
cached = true;
|
|
305
|
+
throw err;
|
|
306
|
+
} finally {
|
|
307
|
+
currentOwner = prev;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (!options?.lazy) {
|
|
311
|
+
try {
|
|
312
|
+
pull();
|
|
313
|
+
} catch {
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return () => {
|
|
317
|
+
if (cached) {
|
|
318
|
+
if (error !== undefined) throw error;
|
|
319
|
+
return value;
|
|
320
|
+
}
|
|
321
|
+
return pull();
|
|
322
|
+
};
|
|
101
323
|
}
|
|
102
324
|
function createDeepProxy(target, patches, basePath = []) {
|
|
103
325
|
const childProxies = new Map();
|
|
@@ -159,120 +381,172 @@ function createDeepProxy(target, patches, basePath = []) {
|
|
|
159
381
|
};
|
|
160
382
|
return new Proxy(target, handler);
|
|
161
383
|
}
|
|
162
|
-
function processResult(comp, result, owner, ctx, deferStream, ssrSource) {
|
|
384
|
+
function processResult(comp, result, owner, ctx, deferStream, ssrSource, rerun) {
|
|
163
385
|
if (comp.disposed) return;
|
|
164
386
|
const id = owner.id;
|
|
165
|
-
const
|
|
166
|
-
const noHydrate = signals.getContext(NoHydrateContext, owner);
|
|
387
|
+
const noHydrate = getContext(NoHydrateContext, owner);
|
|
167
388
|
if (result instanceof Promise) {
|
|
168
|
-
result.
|
|
169
|
-
|
|
170
|
-
result.v = v;
|
|
171
|
-
if (comp.disposed) return;
|
|
172
|
-
comp.value = v;
|
|
389
|
+
if (result.s === 1) {
|
|
390
|
+
comp.value = result.v;
|
|
173
391
|
comp.error = undefined;
|
|
174
|
-
|
|
175
|
-
if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, result, deferStream);
|
|
176
|
-
if (uninitialized) {
|
|
177
|
-
comp.error = new signals.NotReadyError(result);
|
|
392
|
+
return;
|
|
178
393
|
}
|
|
394
|
+
if (result.s === 2) {
|
|
395
|
+
comp.error = result.v;
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const deferred = createDeferredPromise();
|
|
399
|
+
if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream);
|
|
400
|
+
settleServerAsync(result, () => rerun ? rerun() : result, deferred, value => {
|
|
401
|
+
result.s = 1;
|
|
402
|
+
result.v = value;
|
|
403
|
+
comp.value = value;
|
|
404
|
+
comp.error = undefined;
|
|
405
|
+
return value;
|
|
406
|
+
}, error => {
|
|
407
|
+
result.s = 2;
|
|
408
|
+
result.v = error;
|
|
409
|
+
comp.error = error;
|
|
410
|
+
}, () => comp.disposed);
|
|
411
|
+
comp.error = new signals.NotReadyError(deferred.promise);
|
|
179
412
|
return;
|
|
180
413
|
}
|
|
181
414
|
const iterator = result?.[Symbol.asyncIterator];
|
|
182
415
|
if (typeof iterator === "function") {
|
|
183
|
-
const iter = iterator.call(result);
|
|
184
416
|
if (ssrSource === "hybrid") {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
417
|
+
let currentResult = result;
|
|
418
|
+
let iter;
|
|
419
|
+
const deferred = createDeferredPromise();
|
|
420
|
+
const runFirst = () => {
|
|
421
|
+
const source = currentResult ?? (rerun ? rerun() : result);
|
|
422
|
+
currentResult = undefined;
|
|
423
|
+
const nextIterator = source?.[Symbol.asyncIterator];
|
|
424
|
+
if (typeof nextIterator !== "function") {
|
|
425
|
+
throw new Error("Expected async iterator while retrying server createMemo");
|
|
426
|
+
}
|
|
427
|
+
iter = nextIterator.call(source);
|
|
428
|
+
return iter.next().then(value => {
|
|
429
|
+
if (!value.done) closeAsyncIterator(iter);
|
|
430
|
+
return value.value;
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
settleServerAsync(runFirst(), runFirst, deferred, value => {
|
|
434
|
+
comp.value = value;
|
|
190
435
|
comp.error = undefined;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
436
|
+
return value;
|
|
437
|
+
}, error => {
|
|
438
|
+
comp.error = error;
|
|
439
|
+
}, () => comp.disposed);
|
|
440
|
+
if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream);
|
|
441
|
+
comp.error = new signals.NotReadyError(deferred.promise);
|
|
196
442
|
} else {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
443
|
+
let currentResult = result;
|
|
444
|
+
let iter;
|
|
445
|
+
let firstResult;
|
|
446
|
+
const deferred = createDeferredPromise();
|
|
447
|
+
const runFirst = () => {
|
|
448
|
+
const source = currentResult ?? (rerun ? rerun() : result);
|
|
449
|
+
currentResult = undefined;
|
|
450
|
+
const nextIterator = source?.[Symbol.asyncIterator];
|
|
451
|
+
if (typeof nextIterator !== "function") {
|
|
452
|
+
throw new Error("Expected async iterator while retrying server createMemo");
|
|
203
453
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (!servedFirst) {
|
|
210
|
-
servedFirst = true;
|
|
211
|
-
return firstNext.then(r => {
|
|
212
|
-
if (!r.done && !comp.disposed) comp.value = r.value;
|
|
213
|
-
return r;
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
return iter.next().then(r => r);
|
|
217
|
-
}
|
|
218
|
-
})
|
|
454
|
+
iter = nextIterator.call(source);
|
|
455
|
+
return iter.next().then(value => {
|
|
456
|
+
firstResult = value;
|
|
457
|
+
return Promise.resolve();
|
|
458
|
+
});
|
|
219
459
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
460
|
+
settleServerAsync(runFirst(), runFirst, deferred, () => {
|
|
461
|
+
const resolved = firstResult;
|
|
462
|
+
if (resolved && !resolved.done) {
|
|
463
|
+
comp.value = resolved.value;
|
|
464
|
+
}
|
|
465
|
+
comp.error = undefined;
|
|
466
|
+
return undefined;
|
|
467
|
+
}, error => {
|
|
468
|
+
comp.error = error;
|
|
469
|
+
}, () => comp.disposed);
|
|
470
|
+
if (ctx?.async && ctx.serialize && id && !noHydrate) {
|
|
471
|
+
let tappedFirst = true;
|
|
472
|
+
const tapped = {
|
|
473
|
+
[Symbol.asyncIterator]: () => ({
|
|
474
|
+
next() {
|
|
475
|
+
if (tappedFirst) {
|
|
476
|
+
tappedFirst = false;
|
|
477
|
+
return deferred.promise.then(() => firstResult?.done ? {
|
|
478
|
+
done: true,
|
|
479
|
+
value: undefined
|
|
480
|
+
} : firstResult);
|
|
481
|
+
}
|
|
482
|
+
return iter.next().then(r => r);
|
|
483
|
+
},
|
|
484
|
+
return(value) {
|
|
485
|
+
return iter.return?.(value);
|
|
486
|
+
}
|
|
487
|
+
})
|
|
488
|
+
};
|
|
489
|
+
ctx.serialize(id, tapped, deferStream);
|
|
223
490
|
}
|
|
491
|
+
comp.error = new signals.NotReadyError(deferred.promise);
|
|
224
492
|
}
|
|
225
493
|
return;
|
|
226
494
|
}
|
|
227
495
|
comp.value = result;
|
|
228
496
|
}
|
|
229
|
-
function
|
|
497
|
+
function closeAsyncIterator(iter, value) {
|
|
498
|
+
const returned = iter.return?.(value);
|
|
499
|
+
if (returned && typeof returned.then === "function") {
|
|
500
|
+
returned.then(undefined, () => {});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function serverEffect(compute, effectFn, options) {
|
|
230
504
|
const ssrSource = options?.ssrSource;
|
|
231
|
-
if (ssrSource === "client"
|
|
232
|
-
|
|
505
|
+
if (ssrSource === "client") {
|
|
506
|
+
createOwner();
|
|
233
507
|
return;
|
|
234
508
|
}
|
|
235
509
|
const ctx = sharedConfig.context;
|
|
236
|
-
const owner =
|
|
510
|
+
const owner = createOwner();
|
|
237
511
|
const comp = {
|
|
238
512
|
owner,
|
|
239
|
-
value:
|
|
513
|
+
value: undefined,
|
|
240
514
|
compute: compute,
|
|
241
515
|
error: undefined,
|
|
242
516
|
computed: true,
|
|
243
517
|
disposed: false
|
|
244
518
|
};
|
|
245
519
|
if (ssrSource) {
|
|
246
|
-
|
|
520
|
+
runWithOwner(owner, () => onCleanup(() => {
|
|
247
521
|
comp.disposed = true;
|
|
248
522
|
}));
|
|
249
523
|
}
|
|
250
524
|
try {
|
|
251
|
-
const result =
|
|
525
|
+
const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(undefined)));
|
|
252
526
|
if (ssrSource) {
|
|
253
527
|
processResult(comp, result, owner, ctx, options?.deferStream, ssrSource);
|
|
254
528
|
}
|
|
255
|
-
effectFn?.(ssrSource ? comp.value ?? result : result,
|
|
529
|
+
effectFn?.(ssrSource ? comp.value ?? result : result, undefined);
|
|
256
530
|
} catch (err) {
|
|
257
531
|
}
|
|
258
532
|
}
|
|
259
|
-
function createEffect(compute, effect,
|
|
260
|
-
serverEffect(compute, undefined,
|
|
533
|
+
function createEffect(compute, effect, options) {
|
|
534
|
+
serverEffect(compute, undefined, options);
|
|
261
535
|
}
|
|
262
|
-
function createRenderEffect(compute, effectFn,
|
|
263
|
-
serverEffect(compute, effectFn,
|
|
536
|
+
function createRenderEffect(compute, effectFn, options) {
|
|
537
|
+
serverEffect(compute, effectFn, options);
|
|
264
538
|
}
|
|
265
539
|
function createTrackedEffect(compute, options) {
|
|
266
|
-
const o =
|
|
267
|
-
if (o?.id != null)
|
|
540
|
+
const o = getOwner();
|
|
541
|
+
if (o?.id != null) getNextChildId(o);
|
|
268
542
|
}
|
|
269
543
|
function createReaction(effectFn, options) {
|
|
270
544
|
return tracking => {
|
|
271
545
|
tracking();
|
|
272
546
|
};
|
|
273
547
|
}
|
|
274
|
-
function createOptimistic(first, second
|
|
275
|
-
return createSignal(first, second
|
|
548
|
+
function createOptimistic(first, second) {
|
|
549
|
+
return createSignal(first, second);
|
|
276
550
|
}
|
|
277
551
|
function setProperty(state, property, value) {
|
|
278
552
|
if (state[property] === value) return;
|
|
@@ -282,7 +556,7 @@ function setProperty(state, property, value) {
|
|
|
282
556
|
}
|
|
283
557
|
function createStore(first, second) {
|
|
284
558
|
if (typeof first === "function") {
|
|
285
|
-
const store = createProjection(first, second
|
|
559
|
+
const store = createProjection(first, second);
|
|
286
560
|
return [store, fn => fn(store)];
|
|
287
561
|
}
|
|
288
562
|
const state = first;
|
|
@@ -305,115 +579,146 @@ function createPendingProxy(state, source) {
|
|
|
305
579
|
pending = false;
|
|
306
580
|
}];
|
|
307
581
|
}
|
|
308
|
-
function createProjection(fn, initialValue
|
|
582
|
+
function createProjection(fn, initialValue, options) {
|
|
309
583
|
const ctx = sharedConfig.context;
|
|
310
|
-
const owner =
|
|
584
|
+
const owner = createOwner();
|
|
311
585
|
const [state] = createStore(initialValue);
|
|
312
|
-
if (options?.ssrSource === "
|
|
586
|
+
if (options?.ssrSource === "client") {
|
|
313
587
|
return state;
|
|
314
588
|
}
|
|
315
589
|
let disposed = false;
|
|
316
|
-
|
|
590
|
+
runWithOwner(owner, () => onCleanup(() => {
|
|
317
591
|
disposed = true;
|
|
318
592
|
}));
|
|
319
593
|
const ssrSource = options?.ssrSource;
|
|
320
594
|
const useProxy = ssrSource !== "hybrid";
|
|
321
595
|
const patches = [];
|
|
322
596
|
const draft = useProxy ? createDeepProxy(state, patches) : state;
|
|
323
|
-
const
|
|
597
|
+
const runProjection = () => runWithOwner(owner, () => fn(draft));
|
|
598
|
+
const result = runProjection();
|
|
324
599
|
const iteratorFn = result?.[Symbol.asyncIterator];
|
|
325
600
|
if (typeof iteratorFn === "function") {
|
|
326
|
-
const iter = iteratorFn.call(result);
|
|
327
601
|
if (ssrSource === "hybrid") {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
602
|
+
let currentResult = result;
|
|
603
|
+
let iter;
|
|
604
|
+
const deferred = createDeferredPromise();
|
|
605
|
+
const [pending, markReady] = createPendingProxy(state, deferred.promise);
|
|
606
|
+
const runFirst = () => {
|
|
607
|
+
const source = currentResult ?? runProjection();
|
|
608
|
+
currentResult = undefined;
|
|
609
|
+
const nextIterator = source?.[Symbol.asyncIterator];
|
|
610
|
+
if (typeof nextIterator !== "function") {
|
|
611
|
+
throw new Error("Expected async iterator while retrying server createProjection");
|
|
333
612
|
}
|
|
334
|
-
|
|
335
|
-
|
|
613
|
+
iter = nextIterator.call(source);
|
|
614
|
+
return iter.next().then(r => {
|
|
615
|
+
if (!r.done) closeAsyncIterator(iter);
|
|
616
|
+
return r.value;
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
settleServerAsync(runFirst(), runFirst, deferred, value => {
|
|
620
|
+
if (value !== undefined && value !== state) {
|
|
621
|
+
Object.assign(state, value);
|
|
336
622
|
}
|
|
337
|
-
promise.v = state;
|
|
338
623
|
markReady();
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
624
|
+
return state;
|
|
625
|
+
}, error => {
|
|
626
|
+
markReady();
|
|
627
|
+
}, () => disposed);
|
|
628
|
+
if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream);
|
|
342
629
|
return pending;
|
|
343
630
|
} else {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
631
|
+
let currentResult = result;
|
|
632
|
+
let iter;
|
|
633
|
+
let firstResult;
|
|
634
|
+
const deferred = createDeferredPromise();
|
|
635
|
+
const [pending, markReady] = createPendingProxy(state, deferred.promise);
|
|
636
|
+
const runFirst = () => {
|
|
637
|
+
const source = currentResult ?? runProjection();
|
|
638
|
+
currentResult = undefined;
|
|
639
|
+
const nextIterator = source?.[Symbol.asyncIterator];
|
|
640
|
+
if (typeof nextIterator !== "function") {
|
|
641
|
+
throw new Error("Expected async iterator while retrying server createProjection");
|
|
642
|
+
}
|
|
643
|
+
iter = nextIterator.call(source);
|
|
644
|
+
return iter.next().then(value => {
|
|
645
|
+
firstResult = value;
|
|
646
|
+
return Promise.resolve();
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
settleServerAsync(runFirst(), runFirst, deferred, () => {
|
|
347
650
|
patches.length = 0;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
651
|
+
const resolved = firstResult;
|
|
652
|
+
if (resolved && !resolved.done && resolved.value !== undefined && resolved.value !== draft) {
|
|
653
|
+
Object.assign(state, resolved.value);
|
|
352
654
|
}
|
|
353
655
|
markReady(JSON.parse(JSON.stringify(state)));
|
|
354
|
-
|
|
656
|
+
return undefined;
|
|
657
|
+
}, error => {
|
|
355
658
|
markReady();
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
done
|
|
366
|
-
|
|
659
|
+
}, () => disposed);
|
|
660
|
+
if (ctx?.async && !getContext(NoHydrateContext) && owner.id) {
|
|
661
|
+
let tappedFirst = true;
|
|
662
|
+
const tapped = {
|
|
663
|
+
[Symbol.asyncIterator]: () => ({
|
|
664
|
+
next() {
|
|
665
|
+
if (tappedFirst) {
|
|
666
|
+
tappedFirst = false;
|
|
667
|
+
return deferred.promise.then(() => {
|
|
668
|
+
if (firstResult?.done) return {
|
|
669
|
+
done: true,
|
|
670
|
+
value: undefined
|
|
671
|
+
};
|
|
672
|
+
return {
|
|
673
|
+
done: false,
|
|
674
|
+
value: JSON.parse(JSON.stringify(state))
|
|
675
|
+
};
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
return iter.next().then(r => {
|
|
679
|
+
if (disposed) return {
|
|
680
|
+
done: true,
|
|
681
|
+
value: undefined
|
|
367
682
|
};
|
|
683
|
+
const flushed = patches.splice(0);
|
|
684
|
+
if (!r.done) {
|
|
685
|
+
if (r.value !== undefined && r.value !== draft) {
|
|
686
|
+
Object.assign(state, r.value);
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
done: false,
|
|
690
|
+
value: flushed
|
|
691
|
+
};
|
|
692
|
+
}
|
|
368
693
|
return {
|
|
369
|
-
done:
|
|
694
|
+
done: true,
|
|
370
695
|
value: undefined
|
|
371
696
|
};
|
|
372
697
|
});
|
|
698
|
+
},
|
|
699
|
+
return(value) {
|
|
700
|
+
return iter.return?.(value);
|
|
373
701
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
};
|
|
379
|
-
const flushed = patches.splice(0);
|
|
380
|
-
if (!r.done) {
|
|
381
|
-
if (r.value !== undefined && r.value !== draft) {
|
|
382
|
-
Object.assign(state, r.value);
|
|
383
|
-
}
|
|
384
|
-
return {
|
|
385
|
-
done: false,
|
|
386
|
-
value: flushed
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
return {
|
|
390
|
-
done: true,
|
|
391
|
-
value: undefined
|
|
392
|
-
};
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
})
|
|
396
|
-
};
|
|
397
|
-
if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, tapped, options?.deferStream);
|
|
398
|
-
const [pending, markReady] = createPendingProxy(state, firstReady);
|
|
702
|
+
})
|
|
703
|
+
};
|
|
704
|
+
ctx.serialize(owner.id, tapped, options?.deferStream);
|
|
705
|
+
}
|
|
399
706
|
return pending;
|
|
400
707
|
}
|
|
401
708
|
}
|
|
402
709
|
if (result instanceof Promise) {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
if (v !== undefined && v !== state) {
|
|
410
|
-
Object.assign(state, v);
|
|
710
|
+
const deferred = createDeferredPromise();
|
|
711
|
+
const [pending, markReady] = createPendingProxy(state, deferred.promise);
|
|
712
|
+
settleServerAsync(result, () => runProjection(), deferred, value => {
|
|
713
|
+
if (value !== undefined && value !== state) {
|
|
714
|
+
Object.assign(state, value);
|
|
411
715
|
}
|
|
412
|
-
promise.v = state;
|
|
413
716
|
markReady();
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
717
|
+
return state;
|
|
718
|
+
}, error => {
|
|
719
|
+
markReady();
|
|
720
|
+
}, () => disposed);
|
|
721
|
+
if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream);
|
|
417
722
|
return pending;
|
|
418
723
|
}
|
|
419
724
|
if (result !== undefined && result !== state && result !== draft) {
|
|
@@ -440,72 +745,129 @@ function deep(store) {
|
|
|
440
745
|
return store;
|
|
441
746
|
}
|
|
442
747
|
function mapArray(list, mapFn, options = {}) {
|
|
443
|
-
|
|
444
|
-
return () => {
|
|
748
|
+
return createMemo(() => {
|
|
445
749
|
const items = list();
|
|
446
|
-
|
|
750
|
+
const s = [];
|
|
447
751
|
if (items && items.length) {
|
|
448
|
-
|
|
752
|
+
const parent = currentOwner;
|
|
753
|
+
const origId = parent.id;
|
|
754
|
+
const origChildCount = parent._childCount;
|
|
755
|
+
try {
|
|
449
756
|
for (let i = 0, len = items.length; i < len; i++) {
|
|
450
|
-
|
|
451
|
-
|
|
757
|
+
if (origId !== undefined) {
|
|
758
|
+
parent.id = formatChildId(origId, origChildCount + i);
|
|
759
|
+
}
|
|
760
|
+
parent._childCount = 0;
|
|
761
|
+
s.push(mapFn(() => items[i], () => i));
|
|
452
762
|
}
|
|
453
|
-
}
|
|
763
|
+
} finally {
|
|
764
|
+
parent.id = origId;
|
|
765
|
+
parent._childCount = origChildCount + items.length;
|
|
766
|
+
}
|
|
454
767
|
} else if (options.fallback) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return signals.runWithOwner(fo, () => options.fallback());
|
|
458
|
-
})];
|
|
768
|
+
const fo = createOwner();
|
|
769
|
+
s.push(runWithOwner(fo, () => options.fallback()));
|
|
459
770
|
}
|
|
460
771
|
return s;
|
|
461
|
-
}
|
|
772
|
+
}, {
|
|
773
|
+
sync: true
|
|
774
|
+
});
|
|
462
775
|
}
|
|
463
776
|
function repeat(count, mapFn, options = {}) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
777
|
+
return createMemo(() => {
|
|
778
|
+
const len = count();
|
|
779
|
+
const offset = options.from?.() || 0;
|
|
780
|
+
if (!len) {
|
|
781
|
+
if (!options.fallback) return [];
|
|
782
|
+
const fo = createOwner();
|
|
783
|
+
return [runWithOwner(fo, () => options.fallback())];
|
|
784
|
+
}
|
|
785
|
+
const out = new Array(len);
|
|
786
|
+
const parent = currentOwner;
|
|
787
|
+
const origId = parent.id;
|
|
788
|
+
const origChildCount = parent._childCount;
|
|
789
|
+
try {
|
|
470
790
|
for (let i = 0; i < len; i++) {
|
|
471
|
-
|
|
472
|
-
|
|
791
|
+
if (origId !== undefined) {
|
|
792
|
+
parent.id = formatChildId(origId, origChildCount + i);
|
|
793
|
+
}
|
|
794
|
+
parent._childCount = 0;
|
|
795
|
+
out[i] = mapFn(i + offset);
|
|
473
796
|
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
797
|
+
} finally {
|
|
798
|
+
parent.id = origId;
|
|
799
|
+
parent._childCount = origChildCount + len;
|
|
800
|
+
}
|
|
801
|
+
return out;
|
|
802
|
+
}, {
|
|
803
|
+
sync: true
|
|
804
|
+
});
|
|
482
805
|
}
|
|
483
806
|
const ErrorContext = {
|
|
484
807
|
id: Symbol("ErrorContext"),
|
|
485
808
|
defaultValue: null
|
|
486
809
|
};
|
|
810
|
+
function runWithBoundaryErrorContext(owner, render, onError, context, boundaryId) {
|
|
811
|
+
const prevCtx = sharedConfig.context;
|
|
812
|
+
const prevBoundary = context?._currentBoundaryId;
|
|
813
|
+
if (context) {
|
|
814
|
+
sharedConfig.context = context;
|
|
815
|
+
if (boundaryId !== undefined) context._currentBoundaryId = boundaryId;
|
|
816
|
+
}
|
|
817
|
+
try {
|
|
818
|
+
return runWithOwner(owner, () => {
|
|
819
|
+
const parentHandler = getContext(ErrorContext);
|
|
820
|
+
setContext(ErrorContext, err => onError(err, parentHandler));
|
|
821
|
+
return render();
|
|
822
|
+
});
|
|
823
|
+
} finally {
|
|
824
|
+
if (context) {
|
|
825
|
+
if (boundaryId !== undefined) context._currentBoundaryId = prevBoundary;
|
|
826
|
+
sharedConfig.context = prevCtx;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
487
830
|
function createErrorBoundary(fn, fallback) {
|
|
488
831
|
const ctx = sharedConfig.context;
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
832
|
+
const parent = getOwner();
|
|
833
|
+
const owner = createOwner();
|
|
834
|
+
const resolve = () => {
|
|
835
|
+
const resolved = ctx.resolve(runWithOwner(createOwner(), fn));
|
|
836
|
+
if (resolved?.p?.length) throw new signals.NotReadyError(Promise.all(resolved.p));
|
|
837
|
+
return resolved;
|
|
838
|
+
};
|
|
839
|
+
const renderFallback = err => ctx ? runWithOwner(parent, () => {
|
|
840
|
+
const fallbackOwner = createOwner();
|
|
841
|
+
return runWithOwner(fallbackOwner, () => fallback(err, () => {}));
|
|
842
|
+
}) : fallback(err, () => {});
|
|
843
|
+
const serializeError = err => {
|
|
844
|
+
if (ctx && owner.id && !runWithOwner(owner, () => getContext(NoHydrateContext))) {
|
|
845
|
+
ctx.serialize(owner.id, err);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
const handleError = err => {
|
|
849
|
+
serializeError(err);
|
|
850
|
+
return renderFallback(err);
|
|
851
|
+
};
|
|
852
|
+
return () => {
|
|
494
853
|
let result;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
result = fallback(err, () => {});
|
|
498
|
-
});
|
|
854
|
+
let handled = false;
|
|
855
|
+
if (ctx) disposeOwner(owner, false);
|
|
499
856
|
try {
|
|
500
|
-
result =
|
|
857
|
+
result = ctx ? runWithBoundaryErrorContext(owner, resolve, err => {
|
|
858
|
+
if (err instanceof signals.NotReadyError) throw err;
|
|
859
|
+
handled = true;
|
|
860
|
+
result = handleError(err);
|
|
861
|
+
throw err;
|
|
862
|
+
}) : runWithOwner(owner, fn);
|
|
501
863
|
} catch (err) {
|
|
502
|
-
if (
|
|
503
|
-
result =
|
|
864
|
+
if (err instanceof signals.NotReadyError) throw err;
|
|
865
|
+
result = handled ? result : handleError(err);
|
|
504
866
|
}
|
|
505
|
-
return
|
|
506
|
-
}
|
|
867
|
+
return result;
|
|
868
|
+
};
|
|
507
869
|
}
|
|
508
|
-
function
|
|
870
|
+
function createLoadingBoundary$1(fn, fallback, options) {
|
|
509
871
|
try {
|
|
510
872
|
const result = fn();
|
|
511
873
|
return () => result;
|
|
@@ -516,6 +878,10 @@ function createLoadBoundary(fn, fallback) {
|
|
|
516
878
|
throw err;
|
|
517
879
|
}
|
|
518
880
|
}
|
|
881
|
+
function createRevealOrder(fn, _options) {
|
|
882
|
+
const o = createOwner();
|
|
883
|
+
return runWithOwner(o, fn);
|
|
884
|
+
}
|
|
519
885
|
function untrack(fn) {
|
|
520
886
|
return fn();
|
|
521
887
|
}
|
|
@@ -540,23 +906,23 @@ function latest(fn) {
|
|
|
540
906
|
function isRefreshing() {
|
|
541
907
|
return false;
|
|
542
908
|
}
|
|
543
|
-
function refresh(
|
|
544
|
-
return
|
|
909
|
+
function refresh(_target) {
|
|
910
|
+
return undefined;
|
|
545
911
|
}
|
|
546
912
|
function action(fn) {
|
|
547
913
|
return fn;
|
|
548
914
|
}
|
|
549
915
|
function onSettled(callback) {
|
|
550
|
-
const o =
|
|
551
|
-
if (o?.id != null)
|
|
916
|
+
const o = getOwner();
|
|
917
|
+
if (o?.id != null) getNextChildId(o);
|
|
552
918
|
}
|
|
553
919
|
|
|
554
920
|
const $DEVCOMP = Symbol("solid-dev-component");
|
|
555
921
|
function createContext(defaultValue, options) {
|
|
556
922
|
const id = Symbol(options && options.name || "");
|
|
557
923
|
function provider(props) {
|
|
558
|
-
return
|
|
559
|
-
|
|
924
|
+
return createRoot(() => {
|
|
925
|
+
setContext(provider, props.value);
|
|
560
926
|
return children(() => props.children);
|
|
561
927
|
});
|
|
562
928
|
}
|
|
@@ -565,14 +931,15 @@ function createContext(defaultValue, options) {
|
|
|
565
931
|
return provider;
|
|
566
932
|
}
|
|
567
933
|
function useContext(context) {
|
|
568
|
-
return
|
|
934
|
+
return getContext(context);
|
|
569
935
|
}
|
|
570
936
|
function children(fn) {
|
|
571
|
-
const c = createMemo(fn,
|
|
937
|
+
const c = createMemo(fn, {
|
|
572
938
|
lazy: true
|
|
573
939
|
});
|
|
574
|
-
const memo = createMemo(() => signals.flatten(c()),
|
|
575
|
-
lazy: true
|
|
940
|
+
const memo = createMemo(() => signals.flatten(c()), {
|
|
941
|
+
lazy: true,
|
|
942
|
+
sync: true
|
|
576
943
|
});
|
|
577
944
|
memo.toArray = () => {
|
|
578
945
|
const v = memo();
|
|
@@ -580,9 +947,6 @@ function children(fn) {
|
|
|
580
947
|
};
|
|
581
948
|
return memo;
|
|
582
949
|
}
|
|
583
|
-
function ssrRunInScope(fn) {
|
|
584
|
-
return fn;
|
|
585
|
-
}
|
|
586
950
|
|
|
587
951
|
function enableHydration() {}
|
|
588
952
|
function createComponent(Comp, props) {
|
|
@@ -600,7 +964,7 @@ function lazy(fn, moduleUrl) {
|
|
|
600
964
|
return p;
|
|
601
965
|
};
|
|
602
966
|
const wrap = props => {
|
|
603
|
-
const noHydrate =
|
|
967
|
+
const noHydrate = getContext(NoHydrateContext);
|
|
604
968
|
if (!noHydrate && !moduleUrl) {
|
|
605
969
|
throw new Error("lazy() used in SSR without a moduleUrl. " + "All lazy() components require a moduleUrl for correct hydration. " + "This is typically injected by the bundler plugin.");
|
|
606
970
|
}
|
|
@@ -626,6 +990,8 @@ function lazy(fn, moduleUrl) {
|
|
|
626
990
|
return createMemo(() => {
|
|
627
991
|
if (!p.v) throw new signals.NotReadyError(p);
|
|
628
992
|
return p.v(props);
|
|
993
|
+
}, {
|
|
994
|
+
sync: true
|
|
629
995
|
});
|
|
630
996
|
};
|
|
631
997
|
wrap.preload = load;
|
|
@@ -633,9 +999,163 @@ function lazy(fn, moduleUrl) {
|
|
|
633
999
|
return wrap;
|
|
634
1000
|
}
|
|
635
1001
|
function createUniqueId() {
|
|
636
|
-
const o =
|
|
1002
|
+
const o = getOwner();
|
|
637
1003
|
if (!o) throw new Error(`createUniqueId cannot be used outside of a reactive context`);
|
|
638
|
-
return
|
|
1004
|
+
return getNextChildId(o);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const RevealGroupContext = {
|
|
1008
|
+
id: Symbol("RevealGroupContext"),
|
|
1009
|
+
defaultValue: null
|
|
1010
|
+
};
|
|
1011
|
+
function ssrHandleError(err) {
|
|
1012
|
+
if (err instanceof signals.NotReadyError) {
|
|
1013
|
+
return err.source;
|
|
1014
|
+
}
|
|
1015
|
+
const handler = getContext(ErrorContext);
|
|
1016
|
+
if (handler) {
|
|
1017
|
+
handler(err);
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
throw err;
|
|
1021
|
+
}
|
|
1022
|
+
function createLoadingBoundary(fn, fallback, options) {
|
|
1023
|
+
const currentCtx = sharedConfig.context;
|
|
1024
|
+
if (!currentCtx) {
|
|
1025
|
+
return createLoadingBoundary$1(fn, fallback);
|
|
1026
|
+
}
|
|
1027
|
+
const ctx = currentCtx;
|
|
1028
|
+
const parent = getOwner();
|
|
1029
|
+
const parentHandler = parent && runWithOwner(parent, () => getContext(ErrorContext));
|
|
1030
|
+
const revealGroup = parent && runWithOwner(parent, () => getContext(RevealGroupContext));
|
|
1031
|
+
const o = createOwner();
|
|
1032
|
+
const id = o.id;
|
|
1033
|
+
o.id = id + "00";
|
|
1034
|
+
let done;
|
|
1035
|
+
let handledRenderError;
|
|
1036
|
+
let retryPromise;
|
|
1037
|
+
let serializeBuffer = [];
|
|
1038
|
+
const bufferedCtx = Object.create(ctx);
|
|
1039
|
+
bufferedCtx.serialize = (id, value, deferStream) => {
|
|
1040
|
+
serializeBuffer.push([id, value, deferStream]);
|
|
1041
|
+
};
|
|
1042
|
+
bufferedCtx._currentBoundaryId = id;
|
|
1043
|
+
function flushSerializeBuffer() {
|
|
1044
|
+
for (const args of serializeBuffer) ctx.serialize(args[0], args[1], args[2]);
|
|
1045
|
+
serializeBuffer = [];
|
|
1046
|
+
}
|
|
1047
|
+
function commitBoundaryState() {
|
|
1048
|
+
flushSerializeBuffer();
|
|
1049
|
+
const modules = ctx.getBoundaryModules?.(id);
|
|
1050
|
+
if (modules) ctx.serialize(id + "_assets", modules);
|
|
1051
|
+
}
|
|
1052
|
+
function runLoadingPhase(render) {
|
|
1053
|
+
handledRenderError = undefined;
|
|
1054
|
+
return runWithBoundaryErrorContext(o, render, (err, parentHandler) => {
|
|
1055
|
+
handledRenderError = err;
|
|
1056
|
+
if (done?.(undefined, err)) throw err;
|
|
1057
|
+
if (parentHandler) {
|
|
1058
|
+
parentHandler(err);
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
throw err;
|
|
1062
|
+
}, bufferedCtx, id);
|
|
1063
|
+
}
|
|
1064
|
+
function finalizeError(err) {
|
|
1065
|
+
if (handledRenderError === err) {
|
|
1066
|
+
handledRenderError = undefined;
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
if (done?.(undefined, err)) return;
|
|
1070
|
+
if (!parentHandler) throw err;
|
|
1071
|
+
try {
|
|
1072
|
+
runWithOwner(parent, () => parentHandler(err));
|
|
1073
|
+
} catch (caught) {
|
|
1074
|
+
if (caught !== err) throw caught;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
function runDiscovery() {
|
|
1078
|
+
disposeOwner(o, false);
|
|
1079
|
+
serializeBuffer = [];
|
|
1080
|
+
retryPromise = undefined;
|
|
1081
|
+
return runLoadingPhase(() => {
|
|
1082
|
+
try {
|
|
1083
|
+
return ctx.resolve(fn());
|
|
1084
|
+
} catch (err) {
|
|
1085
|
+
if (err instanceof signals.NotReadyError) {
|
|
1086
|
+
retryPromise = err.source;
|
|
1087
|
+
return undefined;
|
|
1088
|
+
}
|
|
1089
|
+
throw err;
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
let ret = runDiscovery();
|
|
1094
|
+
if (!retryPromise && !ret?.p?.length) {
|
|
1095
|
+
commitBoundaryState();
|
|
1096
|
+
return () => ret;
|
|
1097
|
+
}
|
|
1098
|
+
const regResult = revealGroup ? revealGroup.register(id) : null;
|
|
1099
|
+
const collapseFallback = regResult?.collapseFallback ?? false;
|
|
1100
|
+
if (collapseFallback && !ctx.async) {
|
|
1101
|
+
commitBoundaryState();
|
|
1102
|
+
ctx.serialize(id, "$$f");
|
|
1103
|
+
return () => undefined;
|
|
1104
|
+
}
|
|
1105
|
+
const fallbackOwner = createOwner({
|
|
1106
|
+
id
|
|
1107
|
+
});
|
|
1108
|
+
const fallbackResult = runWithOwner(fallbackOwner, () => {
|
|
1109
|
+
if (!ctx.async) return fallback();
|
|
1110
|
+
const tpl = collapseFallback ? [`<template id="pl-${id}">`, `</template><!--pl-${id}-->`] : [`<template id="pl-${id}"></template>`, `<!--pl-${id}-->`];
|
|
1111
|
+
return ctx.ssr(tpl, ctx.escape(fallback()));
|
|
1112
|
+
});
|
|
1113
|
+
if (ctx.async) {
|
|
1114
|
+
const regOpts = revealGroup ? {
|
|
1115
|
+
revealGroup: revealGroup.id
|
|
1116
|
+
} : undefined;
|
|
1117
|
+
done = ctx.registerFragment(id, regOpts);
|
|
1118
|
+
(async () => {
|
|
1119
|
+
try {
|
|
1120
|
+
while (retryPromise) {
|
|
1121
|
+
await retryPromise.catch(() => {});
|
|
1122
|
+
ret = runDiscovery();
|
|
1123
|
+
}
|
|
1124
|
+
commitBoundaryState();
|
|
1125
|
+
while (ret && ret.p && ret.p.length) {
|
|
1126
|
+
const pending = ret;
|
|
1127
|
+
await Promise.all(pending.p).catch(() => {});
|
|
1128
|
+
ret = runLoadingPhase(() => ctx.ssr(pending.t, ...pending.h));
|
|
1129
|
+
}
|
|
1130
|
+
flushSerializeBuffer();
|
|
1131
|
+
done(ret && Array.isArray(ret.t) ? ret.t[0] : ret && ret.t);
|
|
1132
|
+
if (revealGroup) revealGroup.onResolved(id);
|
|
1133
|
+
} catch (err) {
|
|
1134
|
+
finalizeError(err);
|
|
1135
|
+
}
|
|
1136
|
+
})();
|
|
1137
|
+
return () => fallbackResult;
|
|
1138
|
+
}
|
|
1139
|
+
commitBoundaryState();
|
|
1140
|
+
ctx.serialize(id, "$$f");
|
|
1141
|
+
return () => fallbackResult;
|
|
1142
|
+
}
|
|
1143
|
+
function NoHydration(props) {
|
|
1144
|
+
const o = createOwner();
|
|
1145
|
+
return runWithOwner(o, () => {
|
|
1146
|
+
setContext(NoHydrateContext, true);
|
|
1147
|
+
return props.children;
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
function Hydration(props) {
|
|
1151
|
+
if (!getContext(NoHydrateContext)) return props.children;
|
|
1152
|
+
const o = createOwner({
|
|
1153
|
+
id: props.id ?? ""
|
|
1154
|
+
});
|
|
1155
|
+
return runWithOwner(o, () => {
|
|
1156
|
+
setContext(NoHydrateContext, false);
|
|
1157
|
+
return props.children;
|
|
1158
|
+
});
|
|
639
1159
|
}
|
|
640
1160
|
|
|
641
1161
|
function For(props) {
|
|
@@ -645,7 +1165,7 @@ function For(props) {
|
|
|
645
1165
|
} : {
|
|
646
1166
|
keyed: props.keyed
|
|
647
1167
|
};
|
|
648
|
-
return
|
|
1168
|
+
return mapArray(() => props.each, props.children, options);
|
|
649
1169
|
}
|
|
650
1170
|
function Repeat(props) {
|
|
651
1171
|
const options = "fallback" in props ? {
|
|
@@ -655,10 +1175,10 @@ function Repeat(props) {
|
|
|
655
1175
|
return repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options);
|
|
656
1176
|
}
|
|
657
1177
|
function Show(props) {
|
|
658
|
-
const o =
|
|
1178
|
+
const o = getOwner();
|
|
659
1179
|
if (o?.id != null) {
|
|
660
|
-
|
|
661
|
-
if (!props.keyed)
|
|
1180
|
+
getNextChildId(o);
|
|
1181
|
+
if (!props.keyed) getNextChildId(o);
|
|
662
1182
|
}
|
|
663
1183
|
return createMemo(() => {
|
|
664
1184
|
const when = props.when;
|
|
@@ -670,12 +1190,14 @@ function Show(props) {
|
|
|
670
1190
|
return child;
|
|
671
1191
|
}
|
|
672
1192
|
return props.fallback;
|
|
1193
|
+
}, {
|
|
1194
|
+
sync: true
|
|
673
1195
|
});
|
|
674
1196
|
}
|
|
675
1197
|
function Switch(props) {
|
|
676
1198
|
const chs = children(() => props.children);
|
|
677
|
-
const o =
|
|
678
|
-
if (o?.id != null)
|
|
1199
|
+
const o = getOwner();
|
|
1200
|
+
if (o?.id != null) getNextChildId(o);
|
|
679
1201
|
return createMemo(() => {
|
|
680
1202
|
let conds = chs();
|
|
681
1203
|
if (!Array.isArray(conds)) conds = [conds];
|
|
@@ -687,6 +1209,8 @@ function Switch(props) {
|
|
|
687
1209
|
}
|
|
688
1210
|
}
|
|
689
1211
|
return props.fallback;
|
|
1212
|
+
}, {
|
|
1213
|
+
sync: true
|
|
690
1214
|
});
|
|
691
1215
|
}
|
|
692
1216
|
function Match(props) {
|
|
@@ -698,106 +1222,180 @@ function Errored(props) {
|
|
|
698
1222
|
return typeof f === "function" && f.length ? f(err, reset) : f;
|
|
699
1223
|
});
|
|
700
1224
|
}
|
|
701
|
-
|
|
702
|
-
function ssrHandleError(err) {
|
|
703
|
-
if (err instanceof signals.NotReadyError) {
|
|
704
|
-
return err.source;
|
|
705
|
-
}
|
|
706
|
-
const handler = signals.getContext(ErrorContext);
|
|
707
|
-
if (handler) {
|
|
708
|
-
handler(err);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
throw err;
|
|
712
|
-
}
|
|
713
1225
|
function Loading(props) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
const o = signals.createOwner();
|
|
1226
|
+
return createLoadingBoundary(() => props.children, () => props.fallback);
|
|
1227
|
+
}
|
|
1228
|
+
function Reveal(props) {
|
|
1229
|
+
const o = createOwner();
|
|
719
1230
|
const id = o.id;
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
1231
|
+
const order = props.order ?? "sequential";
|
|
1232
|
+
const collapsed = order === "sequential" && !!props.collapsed;
|
|
1233
|
+
if (!sharedConfig.context?.async) {
|
|
1234
|
+
const parent = getOwner();
|
|
1235
|
+
const parentGroup = parent ? runWithOwner(parent, () => getContext(RevealGroupContext)) : null;
|
|
1236
|
+
let collapsedByParent = false;
|
|
1237
|
+
if (parentGroup) {
|
|
1238
|
+
const reg = parentGroup.register(id);
|
|
1239
|
+
collapsedByParent = reg.collapseFallback;
|
|
1240
|
+
if (order === "together" || collapsed) console.warn("Nested <Reveal> with collapsed/together won't coordinate correctly with renderToString. Use renderToStream for full support.");
|
|
1241
|
+
}
|
|
1242
|
+
let count = 0;
|
|
1243
|
+
return runWithOwner(o, () => {
|
|
1244
|
+
setContext(RevealGroupContext, {
|
|
1245
|
+
id,
|
|
1246
|
+
register(_key) {
|
|
1247
|
+
count++;
|
|
1248
|
+
const collapseFallback = collapsedByParent || order === "sequential" && collapsed && count > 1;
|
|
1249
|
+
return {
|
|
1250
|
+
collapseFallback,
|
|
1251
|
+
held: false
|
|
1252
|
+
};
|
|
1253
|
+
},
|
|
1254
|
+
onResolved() {}
|
|
1255
|
+
});
|
|
1256
|
+
return props.children;
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
const ctx = sharedConfig.context;
|
|
1260
|
+
const keys = [];
|
|
1261
|
+
const resolved = new Set();
|
|
1262
|
+
const minimallyResolved = new Set();
|
|
1263
|
+
const composites = new Map();
|
|
1264
|
+
const activated = new Set();
|
|
1265
|
+
const stash = [];
|
|
1266
|
+
const collapsedLeafKeys = [];
|
|
1267
|
+
let frontier = 0;
|
|
1268
|
+
let heldByParent = false;
|
|
1269
|
+
let collapsedByParent = false;
|
|
1270
|
+
let selfMinimallyResolved = false;
|
|
1271
|
+
let notifiedParentDone = false;
|
|
1272
|
+
const parent = getOwner();
|
|
1273
|
+
const parentGroup = parent ? runWithOwner(parent, () => getContext(RevealGroupContext)) : null;
|
|
1274
|
+
if (parentGroup) {
|
|
1275
|
+
const reg = parentGroup.register(id, {
|
|
1276
|
+
onActivate: () => {
|
|
1277
|
+
if (!heldByParent) return;
|
|
1278
|
+
heldByParent = false;
|
|
1279
|
+
if (collapsedByParent) {
|
|
1280
|
+
collapsedByParent = false;
|
|
1281
|
+
if (collapsedLeafKeys.length) {
|
|
1282
|
+
ctx.revealFallbacks?.([...collapsedLeafKeys]);
|
|
1283
|
+
collapsedLeafKeys.length = 0;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
if (order === "sequential") advanceFrontier();else if (order === "together") checkTogetherRelease();else naturalRelease();
|
|
737
1287
|
}
|
|
738
1288
|
});
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
return result;
|
|
1289
|
+
collapsedByParent = reg.collapseFallback;
|
|
1290
|
+
heldByParent = reg.held;
|
|
742
1291
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
return ret;
|
|
1292
|
+
function notifyParentIfDone() {
|
|
1293
|
+
if (notifiedParentDone) return;
|
|
1294
|
+
if (parentGroup && resolved.size === keys.length) {
|
|
1295
|
+
notifiedParentDone = true;
|
|
1296
|
+
parentGroup.onResolved(id);
|
|
1297
|
+
}
|
|
750
1298
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1299
|
+
function activateComposite(key) {
|
|
1300
|
+
if (activated.has(key)) return;
|
|
1301
|
+
activated.add(key);
|
|
1302
|
+
composites.get(key)();
|
|
1303
|
+
}
|
|
1304
|
+
function updateSelfMinimallyResolved() {
|
|
1305
|
+
if (selfMinimallyResolved) return;
|
|
1306
|
+
if (keys.length === 0) selfMinimallyResolved = true;else if (order === "together") selfMinimallyResolved = minimallyResolved.size === keys.length;else if (order === "sequential") selfMinimallyResolved = minimallyResolved.has(keys[0]);
|
|
1307
|
+
else selfMinimallyResolved = resolved.size > 0;
|
|
1308
|
+
if (selfMinimallyResolved) parentGroup?.onMinimallyResolved?.(id);
|
|
1309
|
+
}
|
|
1310
|
+
function advanceFrontier() {
|
|
1311
|
+
if (heldByParent) return;
|
|
1312
|
+
while (frontier < keys.length && resolved.has(keys[frontier])) {
|
|
1313
|
+
const k = keys[frontier];
|
|
1314
|
+
if (composites.has(k)) activateComposite(k);else ctx.revealFragments?.([k]);
|
|
1315
|
+
frontier++;
|
|
1316
|
+
}
|
|
1317
|
+
if (frontier < keys.length) {
|
|
1318
|
+
const k = keys[frontier];
|
|
1319
|
+
if (composites.has(k)) activateComposite(k);else if (order === "sequential" && collapsed) ctx.revealFallbacks?.([k]);
|
|
1320
|
+
}
|
|
1321
|
+
notifyParentIfDone();
|
|
1322
|
+
}
|
|
1323
|
+
function checkTogetherRelease() {
|
|
1324
|
+
if (order !== "together" || heldByParent) return;
|
|
1325
|
+
if (minimallyResolved.size < keys.length) return;
|
|
1326
|
+
if (stash.length) {
|
|
1327
|
+
ctx.revealFragments?.([...stash]);
|
|
1328
|
+
stash.length = 0;
|
|
1329
|
+
}
|
|
1330
|
+
composites.forEach((_, key) => activateComposite(key));
|
|
1331
|
+
notifyParentIfDone();
|
|
1332
|
+
}
|
|
1333
|
+
function naturalRelease() {
|
|
1334
|
+
if (stash.length) {
|
|
1335
|
+
ctx.revealFragments?.([...stash]);
|
|
1336
|
+
stash.length = 0;
|
|
1337
|
+
}
|
|
1338
|
+
composites.forEach((_, key) => activateComposite(key));
|
|
1339
|
+
notifyParentIfDone();
|
|
1340
|
+
}
|
|
1341
|
+
return runWithOwner(o, () => {
|
|
1342
|
+
setContext(RevealGroupContext, {
|
|
1343
|
+
id,
|
|
1344
|
+
register(key, options) {
|
|
1345
|
+
keys.push(key);
|
|
1346
|
+
const isComposite = !!options?.onActivate;
|
|
1347
|
+
if (isComposite) composites.set(key, options.onActivate);
|
|
1348
|
+
const selfCollapse = order === "sequential" && collapsed && keys.length > 1;
|
|
1349
|
+
const collapseFallback = collapsedByParent || selfCollapse;
|
|
1350
|
+
if (collapseFallback && !isComposite) collapsedLeafKeys.push(key);
|
|
1351
|
+
let held = heldByParent;
|
|
1352
|
+
if (!held) {
|
|
1353
|
+
if (order === "together") held = true;else if (order === "sequential" && keys.length > 1) held = true;
|
|
764
1354
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
1355
|
+
return {
|
|
1356
|
+
collapseFallback,
|
|
1357
|
+
held
|
|
1358
|
+
};
|
|
1359
|
+
},
|
|
1360
|
+
onResolved(key) {
|
|
1361
|
+
resolved.add(key);
|
|
1362
|
+
const isLeaf = !composites.has(key);
|
|
1363
|
+
if (isLeaf) {
|
|
1364
|
+
if (order === "together") {
|
|
1365
|
+
stash.push(key);
|
|
1366
|
+
} else if (order === "natural" && heldByParent) {
|
|
1367
|
+
stash.push(key);
|
|
1368
|
+
} else if (order === "natural") {
|
|
1369
|
+
ctx.revealFragments?.([key]);
|
|
1370
|
+
}
|
|
1371
|
+
markMinimallyResolved(key);
|
|
1372
|
+
if (order === "sequential" && !heldByParent) advanceFrontier();
|
|
1373
|
+
if (order === "natural") updateSelfMinimallyResolved();
|
|
1374
|
+
} else {
|
|
1375
|
+
if (!heldByParent) {
|
|
1376
|
+
if (order === "sequential") advanceFrontier();else if (order === "natural") activateComposite(key);
|
|
1377
|
+
}
|
|
1378
|
+
if (order === "together") checkTogetherRelease();
|
|
1379
|
+
if (order === "natural") updateSelfMinimallyResolved();
|
|
770
1380
|
}
|
|
771
|
-
|
|
772
|
-
}
|
|
773
|
-
|
|
1381
|
+
notifyParentIfDone();
|
|
1382
|
+
},
|
|
1383
|
+
onMinimallyResolved(key) {
|
|
1384
|
+
markMinimallyResolved(key);
|
|
774
1385
|
}
|
|
775
|
-
})
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
if (modules) ctx.serialize(id + "_assets", modules);
|
|
782
|
-
ctx.serialize(id, "$$f");
|
|
783
|
-
return signals.runWithOwner(fallbackOwner, () => props.fallback);
|
|
784
|
-
}
|
|
785
|
-
function NoHydration(props) {
|
|
786
|
-
const o = signals.createOwner();
|
|
787
|
-
return signals.runWithOwner(o, () => {
|
|
788
|
-
signals.setContext(NoHydrateContext, true);
|
|
789
|
-
return props.children;
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
function Hydration(props) {
|
|
793
|
-
if (!signals.getContext(NoHydrateContext)) return props.children;
|
|
794
|
-
const o = signals.createOwner({
|
|
795
|
-
id: props.id ?? ""
|
|
796
|
-
});
|
|
797
|
-
return signals.runWithOwner(o, () => {
|
|
798
|
-
signals.setContext(NoHydrateContext, false);
|
|
799
|
-
return props.children;
|
|
1386
|
+
});
|
|
1387
|
+
const result = props.children;
|
|
1388
|
+
if (parentGroup && keys.length === 0) {
|
|
1389
|
+
parentGroup.onResolved(id);
|
|
1390
|
+
}
|
|
1391
|
+
return result;
|
|
800
1392
|
});
|
|
1393
|
+
function markMinimallyResolved(key) {
|
|
1394
|
+
if (minimallyResolved.has(key)) return;
|
|
1395
|
+
minimallyResolved.add(key);
|
|
1396
|
+
updateSelfMinimallyResolved();
|
|
1397
|
+
if (order === "together") checkTogetherRelease();
|
|
1398
|
+
}
|
|
801
1399
|
}
|
|
802
1400
|
|
|
803
1401
|
const DEV = undefined;
|
|
@@ -806,6 +1404,10 @@ Object.defineProperty(exports, "$PROXY", {
|
|
|
806
1404
|
enumerable: true,
|
|
807
1405
|
get: function () { return signals.$PROXY; }
|
|
808
1406
|
});
|
|
1407
|
+
Object.defineProperty(exports, "$REFRESH", {
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
get: function () { return signals.$REFRESH; }
|
|
1410
|
+
});
|
|
809
1411
|
Object.defineProperty(exports, "$TRACK", {
|
|
810
1412
|
enumerable: true,
|
|
811
1413
|
get: function () { return signals.$TRACK; }
|
|
@@ -814,26 +1416,18 @@ Object.defineProperty(exports, "NotReadyError", {
|
|
|
814
1416
|
enumerable: true,
|
|
815
1417
|
get: function () { return signals.NotReadyError; }
|
|
816
1418
|
});
|
|
817
|
-
Object.defineProperty(exports, "
|
|
1419
|
+
Object.defineProperty(exports, "enableExternalSource", {
|
|
818
1420
|
enumerable: true,
|
|
819
|
-
get: function () { return signals.
|
|
1421
|
+
get: function () { return signals.enableExternalSource; }
|
|
820
1422
|
});
|
|
821
|
-
Object.defineProperty(exports, "
|
|
1423
|
+
Object.defineProperty(exports, "enforceLoadingBoundary", {
|
|
822
1424
|
enumerable: true,
|
|
823
|
-
get: function () { return signals.
|
|
1425
|
+
get: function () { return signals.enforceLoadingBoundary; }
|
|
824
1426
|
});
|
|
825
1427
|
Object.defineProperty(exports, "flatten", {
|
|
826
1428
|
enumerable: true,
|
|
827
1429
|
get: function () { return signals.flatten; }
|
|
828
1430
|
});
|
|
829
|
-
Object.defineProperty(exports, "getNextChildId", {
|
|
830
|
-
enumerable: true,
|
|
831
|
-
get: function () { return signals.getNextChildId; }
|
|
832
|
-
});
|
|
833
|
-
Object.defineProperty(exports, "getOwner", {
|
|
834
|
-
enumerable: true,
|
|
835
|
-
get: function () { return signals.getOwner; }
|
|
836
|
-
});
|
|
837
1431
|
Object.defineProperty(exports, "isEqual", {
|
|
838
1432
|
enumerable: true,
|
|
839
1433
|
get: function () { return signals.isEqual; }
|
|
@@ -850,14 +1444,6 @@ Object.defineProperty(exports, "omit", {
|
|
|
850
1444
|
enumerable: true,
|
|
851
1445
|
get: function () { return signals.omit; }
|
|
852
1446
|
});
|
|
853
|
-
Object.defineProperty(exports, "onCleanup", {
|
|
854
|
-
enumerable: true,
|
|
855
|
-
get: function () { return signals.onCleanup; }
|
|
856
|
-
});
|
|
857
|
-
Object.defineProperty(exports, "runWithOwner", {
|
|
858
|
-
enumerable: true,
|
|
859
|
-
get: function () { return signals.runWithOwner; }
|
|
860
|
-
});
|
|
861
1447
|
Object.defineProperty(exports, "snapshot", {
|
|
862
1448
|
enumerable: true,
|
|
863
1449
|
get: function () { return signals.snapshot; }
|
|
@@ -876,6 +1462,7 @@ exports.Match = Match;
|
|
|
876
1462
|
exports.NoHydrateContext = NoHydrateContext;
|
|
877
1463
|
exports.NoHydration = NoHydration;
|
|
878
1464
|
exports.Repeat = Repeat;
|
|
1465
|
+
exports.Reveal = Reveal;
|
|
879
1466
|
exports.Show = Show;
|
|
880
1467
|
exports.Switch = Switch;
|
|
881
1468
|
exports.action = action;
|
|
@@ -884,12 +1471,17 @@ exports.createComponent = createComponent;
|
|
|
884
1471
|
exports.createContext = createContext;
|
|
885
1472
|
exports.createDeepProxy = createDeepProxy;
|
|
886
1473
|
exports.createEffect = createEffect;
|
|
1474
|
+
exports.createErrorBoundary = createErrorBoundary;
|
|
1475
|
+
exports.createLoadingBoundary = createLoadingBoundary;
|
|
887
1476
|
exports.createMemo = createMemo;
|
|
888
1477
|
exports.createOptimistic = createOptimistic;
|
|
889
1478
|
exports.createOptimisticStore = createOptimisticStore;
|
|
1479
|
+
exports.createOwner = createOwner;
|
|
890
1480
|
exports.createProjection = createProjection;
|
|
891
1481
|
exports.createReaction = createReaction;
|
|
892
1482
|
exports.createRenderEffect = createRenderEffect;
|
|
1483
|
+
exports.createRevealOrder = createRevealOrder;
|
|
1484
|
+
exports.createRoot = createRoot;
|
|
893
1485
|
exports.createSignal = createSignal;
|
|
894
1486
|
exports.createStore = createStore;
|
|
895
1487
|
exports.createTrackedEffect = createTrackedEffect;
|
|
@@ -897,19 +1489,23 @@ exports.createUniqueId = createUniqueId;
|
|
|
897
1489
|
exports.deep = deep;
|
|
898
1490
|
exports.enableHydration = enableHydration;
|
|
899
1491
|
exports.flush = flush;
|
|
1492
|
+
exports.getNextChildId = getNextChildId;
|
|
900
1493
|
exports.getObserver = getObserver;
|
|
1494
|
+
exports.getOwner = getOwner;
|
|
1495
|
+
exports.isDisposed = isDisposed;
|
|
901
1496
|
exports.isPending = isPending;
|
|
902
1497
|
exports.isRefreshing = isRefreshing;
|
|
903
1498
|
exports.latest = latest;
|
|
904
1499
|
exports.lazy = lazy;
|
|
905
1500
|
exports.mapArray = mapArray;
|
|
1501
|
+
exports.onCleanup = onCleanup;
|
|
906
1502
|
exports.onSettled = onSettled;
|
|
907
1503
|
exports.reconcile = reconcile;
|
|
908
1504
|
exports.refresh = refresh;
|
|
909
1505
|
exports.repeat = repeat;
|
|
910
1506
|
exports.resolve = resolve;
|
|
1507
|
+
exports.runWithOwner = runWithOwner;
|
|
911
1508
|
exports.sharedConfig = sharedConfig;
|
|
912
1509
|
exports.ssrHandleError = ssrHandleError;
|
|
913
|
-
exports.ssrRunInScope = ssrRunInScope;
|
|
914
1510
|
exports.untrack = untrack;
|
|
915
1511
|
exports.useContext = useContext;
|