@qwik.dev/core 2.0.0-beta.25 → 2.0.0-beta.27
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +14 -5
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +525 -460
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +6068 -6041
- package/dist/insights/index.qwik.mjs +80 -57
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +320 -319
- package/dist/preloader.mjs +86 -86
- package/dist/server.mjs +30 -36
- package/dist/server.prod.mjs +3263 -0
- package/dist/starters/adapters/fastify/package.json +1 -1
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.mjs +624 -613
- package/dist/testing/package.json +1 -1
- package/package.json +8 -4
package/dist/core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.27-dev+7fc6984
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -10,12 +10,13 @@ export { isBrowser, isDev, isServer } from '@qwik.dev/core/build';
|
|
|
10
10
|
import { p } from '@qwik.dev/core/preloader';
|
|
11
11
|
|
|
12
12
|
// same as isDev but separate so we can test
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
13
|
+
const g = globalThis;
|
|
14
|
+
const qDev = g.qDev !== false;
|
|
15
|
+
const qInspector = g.qInspector === true;
|
|
16
|
+
const qSerialize = g.qSerialize !== false;
|
|
17
|
+
const qDynamicPlatform = g.qDynamicPlatform !== false;
|
|
18
|
+
const qTest = g.qTest === true;
|
|
19
|
+
const qRuntimeQrl = g.qRuntimeQrl === true;
|
|
19
20
|
const seal = (obj) => {
|
|
20
21
|
if (qDev) {
|
|
21
22
|
Object.seal(obj);
|
|
@@ -199,7 +200,7 @@ const codeToText = (code, ...parts) => {
|
|
|
199
200
|
'Only primitive and object literals can be serialized. {{0}}', // 3
|
|
200
201
|
'You can render over a existing q:container. Skipping render().', // 4
|
|
201
202
|
'QRL is not a function', // 5
|
|
202
|
-
'Dynamic import not found', // 6
|
|
203
|
+
'Dynamic import {{0}} not found', // 6
|
|
203
204
|
'Unknown type argument', // 7
|
|
204
205
|
`Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`, // 8
|
|
205
206
|
"Invoking 'use*()' method outside of invocation context.", // 9
|
|
@@ -1007,7 +1008,7 @@ const COMMA = ',';
|
|
|
1007
1008
|
*
|
|
1008
1009
|
* @public
|
|
1009
1010
|
*/
|
|
1010
|
-
const version = "2.0.0-beta.
|
|
1011
|
+
const version = "2.0.0-beta.27-dev+7fc6984";
|
|
1011
1012
|
|
|
1012
1013
|
// keep this import from core/build so the cjs build works
|
|
1013
1014
|
const createPlatform = () => {
|
|
@@ -1020,6 +1021,8 @@ const createPlatform = () => {
|
|
|
1020
1021
|
if (regSym) {
|
|
1021
1022
|
return regSym;
|
|
1022
1023
|
}
|
|
1024
|
+
// we never lazy import on the server
|
|
1025
|
+
throw qError(6 /* QError.dynamicImportFailed */, [symbolName]);
|
|
1023
1026
|
}
|
|
1024
1027
|
if (!url) {
|
|
1025
1028
|
throw qError(14 /* QError.qrlMissingChunk */, [symbolName]);
|
|
@@ -1668,28 +1671,6 @@ class SignalImpl {
|
|
|
1668
1671
|
return { value: this.$untrackedValue$ };
|
|
1669
1672
|
}
|
|
1670
1673
|
}
|
|
1671
|
-
const setupSignalValueAccess = (target, effectsProp, valueProp) => {
|
|
1672
|
-
const ctx = tryGetInvokeContext();
|
|
1673
|
-
// We need a container for this
|
|
1674
|
-
// Grab the container if we have access to it
|
|
1675
|
-
if (ctx && (target.$container$ ||= ctx.$container$ || null)) {
|
|
1676
|
-
isDev &&
|
|
1677
|
-
assertTrue(!ctx.$container$ || ctx.$container$ === target.$container$, 'Do not use signals across containers');
|
|
1678
|
-
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1679
|
-
if (effectSubscriber) {
|
|
1680
|
-
// Let's make sure that we have a reference to this effect.
|
|
1681
|
-
// Adding reference is essentially adding a subscription, so if the signal
|
|
1682
|
-
// changes we know who to notify.
|
|
1683
|
-
ensureContainsSubscription((target[effectsProp] ||= new Set()), effectSubscriber);
|
|
1684
|
-
// But when effect is scheduled in needs to be able to know which signals
|
|
1685
|
-
// to unsubscribe from. So we need to store the reference from the effect back
|
|
1686
|
-
// to this signal.
|
|
1687
|
-
ensureContainsBackRef(effectSubscriber, target);
|
|
1688
|
-
addQrlToSerializationCtx(effectSubscriber, target.$container$);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
return target[valueProp];
|
|
1692
|
-
};
|
|
1693
1674
|
|
|
1694
1675
|
/** @internal */
|
|
1695
1676
|
const _CONST_PROPS = Symbol('CONST');
|
|
@@ -2185,7 +2166,8 @@ class AsyncJob {
|
|
|
2185
2166
|
}
|
|
2186
2167
|
/** Backward compatible cache method for resource */
|
|
2187
2168
|
cache() {
|
|
2188
|
-
|
|
2169
|
+
isDev &&
|
|
2170
|
+
console.error('useResource cache() method does not do anything. Use `useAsync$` instead of `useResource$`, use the `interval` option for polling behavior.');
|
|
2189
2171
|
}
|
|
2190
2172
|
get previous() {
|
|
2191
2173
|
const val = this.$signal$.$untrackedValue$;
|
|
@@ -2264,7 +2246,9 @@ class AsyncSignalImpl extends ComputedSignalImpl {
|
|
|
2264
2246
|
if ((import.meta.env.TEST ? isServerPlatform() : isServer) &&
|
|
2265
2247
|
this.$flags$ & 64 /* AsyncSignalFlags.CLIENT_ONLY */ &&
|
|
2266
2248
|
this.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
2267
|
-
throw new Error(
|
|
2249
|
+
throw new Error(isDev
|
|
2250
|
+
? 'During SSR, cannot read .value from clientOnly async signal without an initial value. Use .loading or provide an initial value.'
|
|
2251
|
+
: 'Cannot read .value from clientOnly');
|
|
2268
2252
|
}
|
|
2269
2253
|
return this.$untrackedValue$;
|
|
2270
2254
|
}
|
|
@@ -2279,7 +2263,19 @@ class AsyncSignalImpl extends ComputedSignalImpl {
|
|
|
2279
2263
|
* `signal.loading ? <Loading /> : signal.value`.
|
|
2280
2264
|
*/
|
|
2281
2265
|
get loading() {
|
|
2282
|
-
|
|
2266
|
+
const val = this.untrackedLoading;
|
|
2267
|
+
const ctx = tryGetInvokeContext();
|
|
2268
|
+
if (ctx && (this.$container$ ||= ctx.$container$ || null)) {
|
|
2269
|
+
isDev &&
|
|
2270
|
+
assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$, 'Do not use signals across containers');
|
|
2271
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
2272
|
+
if (effectSubscriber) {
|
|
2273
|
+
ensureContainsSubscription((this.$loadingEffects$ ||= new Set()), effectSubscriber);
|
|
2274
|
+
ensureContainsBackRef(effectSubscriber, this);
|
|
2275
|
+
addQrlToSerializationCtx(effectSubscriber, this.$container$);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
return val;
|
|
2283
2279
|
}
|
|
2284
2280
|
set untrackedLoading(value) {
|
|
2285
2281
|
if (value !== this.$untrackedLoading$) {
|
|
@@ -2298,7 +2294,19 @@ class AsyncSignalImpl extends ComputedSignalImpl {
|
|
|
2298
2294
|
}
|
|
2299
2295
|
/** The error that occurred when the signal was resolved. */
|
|
2300
2296
|
get error() {
|
|
2301
|
-
|
|
2297
|
+
const val = this.untrackedError;
|
|
2298
|
+
const ctx = tryGetInvokeContext();
|
|
2299
|
+
if (ctx && (this.$container$ ||= ctx.$container$ || null)) {
|
|
2300
|
+
isDev &&
|
|
2301
|
+
assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$, 'Do not use signals across containers');
|
|
2302
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
2303
|
+
if (effectSubscriber) {
|
|
2304
|
+
ensureContainsSubscription((this.$errorEffects$ ||= new Set()), effectSubscriber);
|
|
2305
|
+
ensureContainsBackRef(effectSubscriber, this);
|
|
2306
|
+
addQrlToSerializationCtx(effectSubscriber, this.$container$);
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
return val;
|
|
2302
2310
|
}
|
|
2303
2311
|
set untrackedError(value) {
|
|
2304
2312
|
if (value !== this.$untrackedError$) {
|
|
@@ -2940,15 +2948,17 @@ const _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
|
2940
2948
|
class JSXNodeImpl {
|
|
2941
2949
|
type;
|
|
2942
2950
|
children;
|
|
2951
|
+
flags;
|
|
2943
2952
|
toSort;
|
|
2944
2953
|
key;
|
|
2945
2954
|
varProps;
|
|
2946
2955
|
constProps;
|
|
2947
2956
|
dev;
|
|
2948
2957
|
_proxy = null;
|
|
2949
|
-
constructor(type, varProps, constProps, children, key, toSort, dev) {
|
|
2958
|
+
constructor(type, varProps, constProps, children, flags, key, toSort, dev) {
|
|
2950
2959
|
this.type = type;
|
|
2951
2960
|
this.children = children;
|
|
2961
|
+
this.flags = flags;
|
|
2952
2962
|
this.toSort = !!toSort;
|
|
2953
2963
|
this.key = key === null || key === undefined ? null : typeof key === 'string' ? key : '' + key;
|
|
2954
2964
|
this.varProps = !varProps || isObjectEmpty(varProps) ? EMPTY_OBJ : varProps;
|
|
@@ -3027,7 +3037,7 @@ const _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
|
3027
3037
|
const _jsxSorted = (type, varProps, constProps, children,
|
|
3028
3038
|
// TODO use this to know static parts of the tree
|
|
3029
3039
|
flags, key, dev) => {
|
|
3030
|
-
return new JSXNodeImpl(type, varProps, constProps, children, key, false, dev);
|
|
3040
|
+
return new JSXNodeImpl(type, varProps, constProps, children, flags, key, false, dev);
|
|
3031
3041
|
};
|
|
3032
3042
|
/**
|
|
3033
3043
|
* Create a JSXNode, with the properties split into variable and constant parts, but the variable
|
|
@@ -3226,7 +3236,7 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
|
3226
3236
|
}
|
|
3227
3237
|
}
|
|
3228
3238
|
}
|
|
3229
|
-
return new JSXNodeImpl(type, varProps, constProps, children, key, toSort || true, dev);
|
|
3239
|
+
return new JSXNodeImpl(type, varProps, constProps, children, flags, key, toSort || true, dev);
|
|
3230
3240
|
};
|
|
3231
3241
|
/** @internal @deprecated v1 compat */
|
|
3232
3242
|
const _jsxC = (type, mutable, _flags, key) => jsx(type, mutable, key);
|
|
@@ -3287,7 +3297,7 @@ function h(type, props, ...children) {
|
|
|
3287
3297
|
const Fragment = (props) => props.children;
|
|
3288
3298
|
/** @public */
|
|
3289
3299
|
const RenderOnce = (props, key) => {
|
|
3290
|
-
return new JSXNodeImpl(Virtual, null, null, props.children, key);
|
|
3300
|
+
return new JSXNodeImpl(Virtual, null, null, props.children, 0, key);
|
|
3291
3301
|
};
|
|
3292
3302
|
|
|
3293
3303
|
/**
|
|
@@ -3547,7 +3557,7 @@ function injectPlaceholderElement(jsx) {
|
|
|
3547
3557
|
}
|
|
3548
3558
|
/** @returns An empty <script> element for adding qwik metadata attributes to */
|
|
3549
3559
|
function createPlaceholderScriptNode() {
|
|
3550
|
-
return new JSXNodeImpl('script', null, { hidden: '' }, null, null);
|
|
3560
|
+
return new JSXNodeImpl('script', null, { hidden: '' }, null, 0, null);
|
|
3551
3561
|
}
|
|
3552
3562
|
|
|
3553
3563
|
/**
|
|
@@ -3635,7 +3645,7 @@ const _restProps = (props, omit = [], target = {}) => {
|
|
|
3635
3645
|
varPropsTarget[key] = varProps[key];
|
|
3636
3646
|
}
|
|
3637
3647
|
}
|
|
3638
|
-
return createPropsProxy(new JSXNodeImpl(null, varPropsTarget, constPropsTarget, null, null));
|
|
3648
|
+
return createPropsProxy(new JSXNodeImpl(null, varPropsTarget, constPropsTarget, null, 0, null));
|
|
3639
3649
|
};
|
|
3640
3650
|
|
|
3641
3651
|
class DeleteOperation {
|
|
@@ -3705,7 +3715,14 @@ const cleanupDestroyable = (destroyable) => {
|
|
|
3705
3715
|
* This safely calls an event handler, handling errors and retrying on thrown Promises, and
|
|
3706
3716
|
* providing extra parameters defined on the elements as arguments (used for loop optimization)
|
|
3707
3717
|
*/
|
|
3708
|
-
function runEventHandlerQRL(handler, event, element, ctx
|
|
3718
|
+
function runEventHandlerQRL(handler, event, element, ctx) {
|
|
3719
|
+
if (!element.isConnected) {
|
|
3720
|
+
// ignore events on disconnected elements, this can happen when the event is triggered while the element is being removed
|
|
3721
|
+
return;
|
|
3722
|
+
}
|
|
3723
|
+
if (!ctx) {
|
|
3724
|
+
ctx = newInvokeContextFromDOM(event, element);
|
|
3725
|
+
}
|
|
3709
3726
|
const container = ctx.$container$;
|
|
3710
3727
|
const hostElement = ctx.$hostElement$;
|
|
3711
3728
|
vnode_ensureElementInflated(container, hostElement);
|
|
@@ -3770,38 +3787,41 @@ function setAttribute(journal, vnode, key, value, scopedStyleIdPrefix, originalV
|
|
|
3770
3787
|
vnode_setProp(vnode, key, originalValue);
|
|
3771
3788
|
addVNodeOperation(journal, createSetAttributeOperation(vnode.node, key, value, scopedStyleIdPrefix, (vnode.flags & 512 /* VNodeFlags.NS_svg */) !== 0));
|
|
3772
3789
|
}
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
container,
|
|
3776
|
-
journal,
|
|
3777
|
-
cursor,
|
|
3778
|
-
scopedStyleIdPrefix,
|
|
3779
|
-
stack
|
|
3780
|
-
asyncQueue
|
|
3781
|
-
asyncAttributePromises
|
|
3782
|
-
vParent
|
|
3783
|
-
vCurrent
|
|
3784
|
-
vNewNode
|
|
3785
|
-
vSiblings
|
|
3786
|
-
vSiblingsArray
|
|
3787
|
-
vSideBuffer
|
|
3788
|
-
jsxChildren
|
|
3789
|
-
jsxValue
|
|
3790
|
-
jsxIdx
|
|
3791
|
-
jsxCount
|
|
3792
|
-
shouldAdvance
|
|
3793
|
-
isCreationMode
|
|
3794
|
-
subscriptionData
|
|
3795
|
-
const
|
|
3790
|
+
function createDiffContext(container, journal, cursor, scopedStyleIdPrefix) {
|
|
3791
|
+
return {
|
|
3792
|
+
$container$: container,
|
|
3793
|
+
$journal$: journal,
|
|
3794
|
+
$cursor$: cursor,
|
|
3795
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
3796
|
+
$stack$: [],
|
|
3797
|
+
$asyncQueue$: [],
|
|
3798
|
+
$asyncAttributePromises$: [],
|
|
3799
|
+
$vParent$: null,
|
|
3800
|
+
$vCurrent$: null,
|
|
3801
|
+
$vNewNode$: null,
|
|
3802
|
+
$vSiblings$: null,
|
|
3803
|
+
$vSiblingsArray$: null,
|
|
3804
|
+
$vSideBuffer$: null,
|
|
3805
|
+
$jsxChildren$: null,
|
|
3806
|
+
$jsxValue$: null,
|
|
3807
|
+
$jsxIdx$: 0,
|
|
3808
|
+
$jsxCount$: 0,
|
|
3809
|
+
$shouldAdvance$: true,
|
|
3810
|
+
$isCreationMode$: false,
|
|
3811
|
+
$subscriptionData$: {
|
|
3812
|
+
$const$: new SubscriptionData({
|
|
3796
3813
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
3797
3814
|
$isConst$: true,
|
|
3798
3815
|
}),
|
|
3799
|
-
var
|
|
3816
|
+
$var$: new SubscriptionData({
|
|
3800
3817
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
3801
3818
|
$isConst$: false,
|
|
3802
3819
|
}),
|
|
3803
3820
|
},
|
|
3804
3821
|
};
|
|
3822
|
+
}
|
|
3823
|
+
const vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleIdPrefix) => {
|
|
3824
|
+
const diffContext = createDiffContext(container, journal, cursor, scopedStyleIdPrefix);
|
|
3805
3825
|
////////////////////////////////
|
|
3806
3826
|
diff(diffContext, jsxNode, vStartNode);
|
|
3807
3827
|
const result = drainAsyncQueue(diffContext);
|
|
@@ -3821,56 +3841,56 @@ const vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyle
|
|
|
3821
3841
|
function diff(diffContext, jsxNode, vStartNode) {
|
|
3822
3842
|
isDev && assertFalse(vnode_isVNode(jsxNode), 'JSXNode should not be a VNode');
|
|
3823
3843
|
isDev && assertTrue(vnode_isVNode(vStartNode), 'vStartNode should be a VNode');
|
|
3824
|
-
diffContext
|
|
3825
|
-
diffContext
|
|
3826
|
-
diffContext
|
|
3844
|
+
diffContext.$vParent$ = vStartNode;
|
|
3845
|
+
diffContext.$vNewNode$ = null;
|
|
3846
|
+
diffContext.$vCurrent$ = vnode_getFirstChild(vStartNode);
|
|
3827
3847
|
stackPush(diffContext, jsxNode, true);
|
|
3828
|
-
if (diffContext
|
|
3848
|
+
if (diffContext.$vParent$.flags & 32 /* VNodeFlags.Deleted */) {
|
|
3829
3849
|
// Ignore diff if the parent is deleted.
|
|
3830
3850
|
return;
|
|
3831
3851
|
}
|
|
3832
|
-
while (diffContext
|
|
3833
|
-
while (diffContext
|
|
3852
|
+
while (diffContext.$stack$.length) {
|
|
3853
|
+
while (diffContext.$jsxIdx$ < diffContext.$jsxCount$) {
|
|
3834
3854
|
isDev &&
|
|
3835
|
-
assertFalse(diffContext
|
|
3836
|
-
if (typeof diffContext
|
|
3837
|
-
expectText(diffContext, diffContext
|
|
3855
|
+
assertFalse(diffContext.$vParent$ === diffContext.$vCurrent$, "Parent and current can't be the same");
|
|
3856
|
+
if (typeof diffContext.$jsxValue$ === 'string') {
|
|
3857
|
+
expectText(diffContext, diffContext.$jsxValue$);
|
|
3838
3858
|
}
|
|
3839
|
-
else if (typeof diffContext
|
|
3840
|
-
expectText(diffContext, String(diffContext
|
|
3859
|
+
else if (typeof diffContext.$jsxValue$ === 'number') {
|
|
3860
|
+
expectText(diffContext, String(diffContext.$jsxValue$));
|
|
3841
3861
|
}
|
|
3842
|
-
else if (diffContext
|
|
3843
|
-
if (isJSXNode(diffContext
|
|
3844
|
-
const type = diffContext
|
|
3862
|
+
else if (diffContext.$jsxValue$ && typeof diffContext.$jsxValue$ === 'object') {
|
|
3863
|
+
if (isJSXNode(diffContext.$jsxValue$)) {
|
|
3864
|
+
const type = diffContext.$jsxValue$.type;
|
|
3845
3865
|
if (typeof type === 'string') {
|
|
3846
3866
|
expectNoTextNode(diffContext);
|
|
3847
|
-
expectElement(diffContext, diffContext
|
|
3848
|
-
const hasDangerousInnerHTML = (diffContext
|
|
3849
|
-
_hasOwnProperty.call(diffContext
|
|
3850
|
-
_hasOwnProperty.call(diffContext
|
|
3867
|
+
expectElement(diffContext, diffContext.$jsxValue$, type);
|
|
3868
|
+
const hasDangerousInnerHTML = (diffContext.$jsxValue$.constProps &&
|
|
3869
|
+
_hasOwnProperty.call(diffContext.$jsxValue$.constProps, dangerouslySetInnerHTML)) ||
|
|
3870
|
+
_hasOwnProperty.call(diffContext.$jsxValue$.varProps, dangerouslySetInnerHTML);
|
|
3851
3871
|
if (hasDangerousInnerHTML) {
|
|
3852
3872
|
expectNoChildren(diffContext, false);
|
|
3853
3873
|
}
|
|
3854
3874
|
else {
|
|
3855
|
-
descend(diffContext, diffContext
|
|
3875
|
+
descend(diffContext, diffContext.$jsxValue$.children, true);
|
|
3856
3876
|
}
|
|
3857
3877
|
}
|
|
3858
3878
|
else if (typeof type === 'function') {
|
|
3859
3879
|
if (type === Fragment) {
|
|
3860
3880
|
expectNoTextNode(diffContext);
|
|
3861
|
-
expectVirtual(diffContext, "F" /* VirtualType.Fragment */, diffContext
|
|
3862
|
-
descend(diffContext, diffContext
|
|
3881
|
+
expectVirtual(diffContext, "F" /* VirtualType.Fragment */, diffContext.$jsxValue$.key);
|
|
3882
|
+
descend(diffContext, diffContext.$jsxValue$.children, true);
|
|
3863
3883
|
}
|
|
3864
3884
|
else if (type === Slot) {
|
|
3865
3885
|
expectNoTextNode(diffContext);
|
|
3866
3886
|
if (!expectSlot(diffContext)) {
|
|
3867
3887
|
// nothing to project, so try to render the Slot default content.
|
|
3868
|
-
descend(diffContext, diffContext
|
|
3888
|
+
descend(diffContext, diffContext.$jsxValue$.children, true);
|
|
3869
3889
|
}
|
|
3870
3890
|
}
|
|
3871
3891
|
else if (type === Projection) {
|
|
3872
3892
|
expectProjection(diffContext);
|
|
3873
|
-
descend(diffContext, diffContext
|
|
3893
|
+
descend(diffContext, diffContext.$jsxValue$.children, true,
|
|
3874
3894
|
// special case for projection, we don't want to expect no children
|
|
3875
3895
|
// because the projection's children are not removed
|
|
3876
3896
|
false);
|
|
@@ -3888,30 +3908,30 @@ function diff(diffContext, jsxNode, vStartNode) {
|
|
|
3888
3908
|
}
|
|
3889
3909
|
}
|
|
3890
3910
|
}
|
|
3891
|
-
else if (Array.isArray(diffContext
|
|
3892
|
-
descend(diffContext, diffContext
|
|
3911
|
+
else if (Array.isArray(diffContext.$jsxValue$)) {
|
|
3912
|
+
descend(diffContext, diffContext.$jsxValue$, false);
|
|
3893
3913
|
}
|
|
3894
|
-
else if (isSignal(diffContext
|
|
3914
|
+
else if (isSignal(diffContext.$jsxValue$)) {
|
|
3895
3915
|
expectVirtual(diffContext, "S" /* VirtualType.WrappedSignal */, null);
|
|
3896
|
-
const unwrappedSignal = diffContext
|
|
3897
|
-
? diffContext
|
|
3898
|
-
: diffContext
|
|
3899
|
-
const signals = diffContext
|
|
3916
|
+
const unwrappedSignal = diffContext.$jsxValue$ instanceof WrappedSignalImpl
|
|
3917
|
+
? diffContext.$jsxValue$.$unwrapIfSignal$()
|
|
3918
|
+
: diffContext.$jsxValue$;
|
|
3919
|
+
const signals = diffContext.$vCurrent$?.[_EFFECT_BACK_REF]?.get("." /* EffectProperty.VNODE */)?.backRef;
|
|
3900
3920
|
let hasUnwrappedSignal = signals?.has(unwrappedSignal);
|
|
3901
3921
|
if (signals && unwrappedSignal instanceof WrappedSignalImpl) {
|
|
3902
3922
|
hasUnwrappedSignal = containsWrappedSignal(signals, unwrappedSignal);
|
|
3903
3923
|
}
|
|
3904
3924
|
if (!hasUnwrappedSignal) {
|
|
3905
|
-
const vHost = (diffContext
|
|
3906
|
-
descend(diffContext, resolveSignalAndDescend(diffContext, () => trackSignalAndAssignHost(unwrappedSignal, vHost, "." /* EffectProperty.VNODE */, diffContext
|
|
3925
|
+
const vHost = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
3926
|
+
descend(diffContext, resolveSignalAndDescend(diffContext, () => trackSignalAndAssignHost(unwrappedSignal, vHost, "." /* EffectProperty.VNODE */, diffContext.$container$)), true);
|
|
3907
3927
|
}
|
|
3908
3928
|
}
|
|
3909
|
-
else if (isPromise(diffContext
|
|
3929
|
+
else if (isPromise(diffContext.$jsxValue$)) {
|
|
3910
3930
|
expectVirtual(diffContext, "A" /* VirtualType.Awaited */, null);
|
|
3911
|
-
diffContext
|
|
3931
|
+
diffContext.$asyncQueue$.push(diffContext.$jsxValue$, diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
3912
3932
|
}
|
|
3913
3933
|
}
|
|
3914
|
-
else if (diffContext
|
|
3934
|
+
else if (diffContext.$jsxValue$ === SkipRender) ;
|
|
3915
3935
|
else {
|
|
3916
3936
|
expectText(diffContext, '');
|
|
3917
3937
|
}
|
|
@@ -3931,35 +3951,35 @@ function resolveSignalAndDescend(diffContext, fn) {
|
|
|
3931
3951
|
if (isPromise(e)) {
|
|
3932
3952
|
// The thrown promise will resolve when the signal is ready, then retry fn() with retry logic
|
|
3933
3953
|
const retryPromise = e.then(() => retryOnPromise(fn));
|
|
3934
|
-
diffContext
|
|
3954
|
+
diffContext.$asyncQueue$.push(retryPromise, diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
3935
3955
|
return null;
|
|
3936
3956
|
}
|
|
3937
3957
|
throw e;
|
|
3938
3958
|
}
|
|
3939
3959
|
}
|
|
3940
3960
|
function advance(diffContext) {
|
|
3941
|
-
if (!diffContext
|
|
3942
|
-
diffContext
|
|
3961
|
+
if (!diffContext.$shouldAdvance$) {
|
|
3962
|
+
diffContext.$shouldAdvance$ = true;
|
|
3943
3963
|
return;
|
|
3944
3964
|
}
|
|
3945
|
-
diffContext
|
|
3946
|
-
if (diffContext
|
|
3947
|
-
diffContext
|
|
3965
|
+
diffContext.$jsxIdx$++;
|
|
3966
|
+
if (diffContext.$jsxIdx$ < diffContext.$jsxCount$) {
|
|
3967
|
+
diffContext.$jsxValue$ = diffContext.$jsxChildren$[diffContext.$jsxIdx$];
|
|
3948
3968
|
}
|
|
3949
|
-
else if (diffContext
|
|
3950
|
-
diffContext
|
|
3969
|
+
else if (diffContext.$stack$.length > 0 &&
|
|
3970
|
+
diffContext.$stack$[diffContext.$stack$.length - 1] === false) {
|
|
3951
3971
|
// this was special `descendVNode === false` so pop and try again
|
|
3952
3972
|
return ascend(diffContext);
|
|
3953
3973
|
}
|
|
3954
|
-
if (diffContext
|
|
3974
|
+
if (diffContext.$vNewNode$ !== null) {
|
|
3955
3975
|
// We have a new Node.
|
|
3956
3976
|
// This means that the `vCurrent` was deemed not useful and we inserted in front of it.
|
|
3957
3977
|
// This means that the next node we should look at is the `vCurrent` so just clear the
|
|
3958
3978
|
// vNewNode and try again.
|
|
3959
|
-
diffContext
|
|
3979
|
+
diffContext.$vNewNode$ = null;
|
|
3960
3980
|
}
|
|
3961
3981
|
else {
|
|
3962
|
-
diffContext
|
|
3982
|
+
diffContext.$vCurrent$ = peekNextSibling(diffContext.$vCurrent$);
|
|
3963
3983
|
}
|
|
3964
3984
|
}
|
|
3965
3985
|
/**
|
|
@@ -3990,69 +4010,69 @@ function descend(diffContext, children, descendVNode, shouldExpectNoChildren = t
|
|
|
3990
4010
|
stackPush(diffContext, children, descendVNode);
|
|
3991
4011
|
if (descendVNode) {
|
|
3992
4012
|
isDev &&
|
|
3993
|
-
assertDefined(diffContext
|
|
3994
|
-
const creationMode = diffContext
|
|
3995
|
-
!!diffContext
|
|
3996
|
-
!vnode_getFirstChild(diffContext
|
|
3997
|
-
diffContext
|
|
3998
|
-
diffContext
|
|
3999
|
-
diffContext
|
|
4000
|
-
diffContext
|
|
4001
|
-
diffContext
|
|
4002
|
-
diffContext
|
|
4003
|
-
diffContext
|
|
4004
|
-
}
|
|
4005
|
-
diffContext
|
|
4013
|
+
assertDefined(diffContext.$vCurrent$ || diffContext.$vNewNode$, 'Expecting vCurrent to be defined.');
|
|
4014
|
+
const creationMode = diffContext.$isCreationMode$ ||
|
|
4015
|
+
!!diffContext.$vNewNode$ ||
|
|
4016
|
+
!vnode_getFirstChild(diffContext.$vCurrent$);
|
|
4017
|
+
diffContext.$isCreationMode$ = creationMode;
|
|
4018
|
+
diffContext.$vSideBuffer$ = null;
|
|
4019
|
+
diffContext.$vSiblings$ = null;
|
|
4020
|
+
diffContext.$vSiblingsArray$ = null;
|
|
4021
|
+
diffContext.$vParent$ = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
4022
|
+
diffContext.$vCurrent$ = vnode_getFirstChild(diffContext.$vParent$);
|
|
4023
|
+
diffContext.$vNewNode$ = null;
|
|
4024
|
+
}
|
|
4025
|
+
diffContext.$shouldAdvance$ = false;
|
|
4006
4026
|
}
|
|
4007
4027
|
function ascend(diffContext) {
|
|
4008
|
-
const descendVNode = diffContext
|
|
4028
|
+
const descendVNode = diffContext.$stack$.pop(); // boolean: descendVNode
|
|
4009
4029
|
if (descendVNode) {
|
|
4010
|
-
diffContext
|
|
4011
|
-
diffContext
|
|
4012
|
-
diffContext
|
|
4013
|
-
diffContext
|
|
4014
|
-
diffContext
|
|
4015
|
-
diffContext
|
|
4016
|
-
diffContext
|
|
4017
|
-
}
|
|
4018
|
-
diffContext
|
|
4019
|
-
diffContext
|
|
4020
|
-
diffContext
|
|
4021
|
-
diffContext
|
|
4030
|
+
diffContext.$isCreationMode$ = diffContext.$stack$.pop();
|
|
4031
|
+
diffContext.$vSideBuffer$ = diffContext.$stack$.pop();
|
|
4032
|
+
diffContext.$vSiblings$ = diffContext.$stack$.pop();
|
|
4033
|
+
diffContext.$vSiblingsArray$ = diffContext.$stack$.pop();
|
|
4034
|
+
diffContext.$vNewNode$ = diffContext.$stack$.pop();
|
|
4035
|
+
diffContext.$vCurrent$ = diffContext.$stack$.pop();
|
|
4036
|
+
diffContext.$vParent$ = diffContext.$stack$.pop();
|
|
4037
|
+
}
|
|
4038
|
+
diffContext.$jsxValue$ = diffContext.$stack$.pop();
|
|
4039
|
+
diffContext.$jsxCount$ = diffContext.$stack$.pop();
|
|
4040
|
+
diffContext.$jsxIdx$ = diffContext.$stack$.pop();
|
|
4041
|
+
diffContext.$jsxChildren$ = diffContext.$stack$.pop();
|
|
4022
4042
|
advance(diffContext);
|
|
4023
4043
|
}
|
|
4024
4044
|
function stackPush(diffContext, children, descendVNode) {
|
|
4025
|
-
diffContext
|
|
4045
|
+
diffContext.$stack$.push(diffContext.$jsxChildren$, diffContext.$jsxIdx$, diffContext.$jsxCount$, diffContext.$jsxValue$);
|
|
4026
4046
|
if (descendVNode) {
|
|
4027
|
-
diffContext
|
|
4047
|
+
diffContext.$stack$.push(diffContext.$vParent$, diffContext.$vCurrent$, diffContext.$vNewNode$, diffContext.$vSiblingsArray$, diffContext.$vSiblings$, diffContext.$vSideBuffer$, diffContext.$isCreationMode$);
|
|
4028
4048
|
}
|
|
4029
|
-
diffContext
|
|
4049
|
+
diffContext.$stack$.push(descendVNode);
|
|
4030
4050
|
if (Array.isArray(children)) {
|
|
4031
|
-
diffContext
|
|
4032
|
-
diffContext
|
|
4033
|
-
diffContext
|
|
4034
|
-
diffContext
|
|
4051
|
+
diffContext.$jsxIdx$ = 0;
|
|
4052
|
+
diffContext.$jsxCount$ = children.length;
|
|
4053
|
+
diffContext.$jsxChildren$ = children;
|
|
4054
|
+
diffContext.$jsxValue$ = diffContext.$jsxCount$ > 0 ? children[0] : null;
|
|
4035
4055
|
}
|
|
4036
4056
|
else if (children === undefined) {
|
|
4037
4057
|
// no children
|
|
4038
|
-
diffContext
|
|
4039
|
-
diffContext
|
|
4040
|
-
diffContext
|
|
4041
|
-
diffContext
|
|
4058
|
+
diffContext.$jsxIdx$ = 0;
|
|
4059
|
+
diffContext.$jsxValue$ = null;
|
|
4060
|
+
diffContext.$jsxChildren$ = null;
|
|
4061
|
+
diffContext.$jsxCount$ = 0;
|
|
4042
4062
|
}
|
|
4043
4063
|
else {
|
|
4044
|
-
diffContext
|
|
4045
|
-
diffContext
|
|
4046
|
-
diffContext
|
|
4047
|
-
diffContext
|
|
4064
|
+
diffContext.$jsxIdx$ = 0;
|
|
4065
|
+
diffContext.$jsxValue$ = children;
|
|
4066
|
+
diffContext.$jsxChildren$ = null;
|
|
4067
|
+
diffContext.$jsxCount$ = 1;
|
|
4048
4068
|
}
|
|
4049
4069
|
}
|
|
4050
4070
|
function getInsertBefore(diffContext) {
|
|
4051
|
-
if (diffContext
|
|
4052
|
-
return diffContext
|
|
4071
|
+
if (diffContext.$vNewNode$) {
|
|
4072
|
+
return diffContext.$vCurrent$;
|
|
4053
4073
|
}
|
|
4054
4074
|
else {
|
|
4055
|
-
return peekNextSibling(diffContext
|
|
4075
|
+
return peekNextSibling(diffContext.$vCurrent$);
|
|
4056
4076
|
}
|
|
4057
4077
|
}
|
|
4058
4078
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -4061,7 +4081,7 @@ function getInsertBefore(diffContext) {
|
|
|
4061
4081
|
function descendContentToProject(diffContext, children, host) {
|
|
4062
4082
|
const projectionChildren = Array.isArray(children) ? children : [children];
|
|
4063
4083
|
const createProjectionJSXNode = (slotName) => {
|
|
4064
|
-
return new JSXNodeImpl(Projection, null, null, [], slotName);
|
|
4084
|
+
return new JSXNodeImpl(Projection, null, null, [], 0, slotName);
|
|
4065
4085
|
};
|
|
4066
4086
|
const projections = [];
|
|
4067
4087
|
if (host) {
|
|
@@ -4104,32 +4124,32 @@ function descendContentToProject(diffContext, children, host) {
|
|
|
4104
4124
|
descend(diffContext, projections, true);
|
|
4105
4125
|
}
|
|
4106
4126
|
function expectProjection(diffContext) {
|
|
4107
|
-
const jsxNode = diffContext
|
|
4127
|
+
const jsxNode = diffContext.$jsxValue$;
|
|
4108
4128
|
const slotName = jsxNode.key;
|
|
4109
4129
|
// console.log('expectProjection', JSON.stringify(slotName));
|
|
4110
4130
|
// The parent is the component and it should have our portal.
|
|
4111
|
-
diffContext
|
|
4131
|
+
diffContext.$vCurrent$ = vnode_getProp(diffContext.$vParent$, slotName, (id) => vnode_locate(diffContext.$container$.rootVNode, id));
|
|
4112
4132
|
// if projection is marked as deleted then we need to create a new one
|
|
4113
|
-
diffContext
|
|
4114
|
-
diffContext
|
|
4133
|
+
diffContext.$vCurrent$ =
|
|
4134
|
+
diffContext.$vCurrent$ && diffContext.$vCurrent$.flags & 32 /* VNodeFlags.Deleted */
|
|
4115
4135
|
? null
|
|
4116
|
-
: diffContext
|
|
4117
|
-
if (diffContext
|
|
4118
|
-
diffContext
|
|
4136
|
+
: diffContext.$vCurrent$;
|
|
4137
|
+
if (diffContext.$vCurrent$ == null) {
|
|
4138
|
+
diffContext.$vNewNode$ = vnode_newVirtual();
|
|
4119
4139
|
// you may be tempted to add the projection into the current parent, but
|
|
4120
4140
|
// that is wrong. We don't yet know if the projection will be projected, so
|
|
4121
4141
|
// we should leave it unattached.
|
|
4122
4142
|
// vNewNode[VNodeProps.parent] = vParent;
|
|
4123
4143
|
isDev &&
|
|
4124
|
-
vnode_setProp(diffContext
|
|
4125
|
-
isDev && vnode_setProp(diffContext
|
|
4126
|
-
vnode_setProp(diffContext
|
|
4127
|
-
diffContext
|
|
4128
|
-
vnode_setProp(diffContext
|
|
4144
|
+
vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* VirtualType.Projection */);
|
|
4145
|
+
isDev && vnode_setProp(diffContext.$vNewNode$, 'q:code', 'expectProjection');
|
|
4146
|
+
vnode_setProp(diffContext.$vNewNode$, QSlot, slotName);
|
|
4147
|
+
diffContext.$vNewNode$.slotParent = diffContext.$vParent$;
|
|
4148
|
+
vnode_setProp(diffContext.$vParent$, slotName, diffContext.$vNewNode$);
|
|
4129
4149
|
}
|
|
4130
4150
|
}
|
|
4131
4151
|
function expectSlot(diffContext) {
|
|
4132
|
-
const vHost = vnode_getProjectionParentComponent(diffContext
|
|
4152
|
+
const vHost = vnode_getProjectionParentComponent(diffContext.$vParent$);
|
|
4133
4153
|
const slotNameKey = getSlotNameKey(diffContext, vHost);
|
|
4134
4154
|
const vProjectedNode = vHost
|
|
4135
4155
|
? vnode_getProp(vHost, slotNameKey,
|
|
@@ -4139,64 +4159,65 @@ function expectSlot(diffContext) {
|
|
|
4139
4159
|
)
|
|
4140
4160
|
: null;
|
|
4141
4161
|
if (vProjectedNode == null) {
|
|
4142
|
-
diffContext
|
|
4143
|
-
vnode_setProp(diffContext
|
|
4144
|
-
vHost && vnode_setProp(vHost, slotNameKey, diffContext
|
|
4162
|
+
diffContext.$vNewNode$ = vnode_newVirtual();
|
|
4163
|
+
vnode_setProp(diffContext.$vNewNode$, QSlot, slotNameKey);
|
|
4164
|
+
vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
|
|
4145
4165
|
isDev &&
|
|
4146
|
-
vnode_setProp(diffContext
|
|
4147
|
-
vnode_insertBefore(diffContext
|
|
4166
|
+
vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* VirtualType.Projection */); // Nothing to project, so render content of the slot.
|
|
4167
|
+
vnode_insertBefore(diffContext.$journal$, diffContext.$vParent$, diffContext.$vNewNode$, diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4148
4168
|
return false;
|
|
4149
4169
|
}
|
|
4150
|
-
else if (vProjectedNode === diffContext
|
|
4170
|
+
else if (vProjectedNode === diffContext.$vCurrent$) ;
|
|
4151
4171
|
else {
|
|
4152
4172
|
// move from q:template to the target node
|
|
4153
4173
|
const oldParent = vProjectedNode.parent;
|
|
4154
|
-
diffContext
|
|
4155
|
-
vnode_setProp(diffContext
|
|
4156
|
-
vHost && vnode_setProp(vHost, slotNameKey, diffContext
|
|
4174
|
+
diffContext.$vNewNode$ = vProjectedNode;
|
|
4175
|
+
vnode_setProp(diffContext.$vNewNode$, QSlot, slotNameKey);
|
|
4176
|
+
vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
|
|
4157
4177
|
isDev &&
|
|
4158
|
-
vnode_setProp(diffContext
|
|
4159
|
-
|
|
4178
|
+
vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* VirtualType.Projection */);
|
|
4179
|
+
vnode_inflateProjectionTrailingText(diffContext.$journal$, diffContext.$vNewNode$);
|
|
4180
|
+
vnode_insertBefore(diffContext.$journal$, diffContext.$vParent$, diffContext.$vNewNode$, diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4160
4181
|
// If we moved from a q:template and it's now empty, remove it
|
|
4161
4182
|
if (oldParent &&
|
|
4162
4183
|
vnode_isElementVNode(oldParent) &&
|
|
4163
4184
|
!oldParent.firstChild &&
|
|
4164
4185
|
vnode_getElementName(oldParent) === QTemplate) {
|
|
4165
|
-
vnode_remove(diffContext
|
|
4186
|
+
vnode_remove(diffContext.$journal$, oldParent.parent, oldParent, true);
|
|
4166
4187
|
}
|
|
4167
4188
|
}
|
|
4168
4189
|
return true;
|
|
4169
4190
|
}
|
|
4170
4191
|
function getSlotNameKey(diffContext, vHost) {
|
|
4171
|
-
const jsxNode = diffContext
|
|
4192
|
+
const jsxNode = diffContext.$jsxValue$;
|
|
4172
4193
|
const constProps = jsxNode.constProps;
|
|
4173
4194
|
if (constProps && typeof constProps == 'object' && _hasOwnProperty.call(constProps, 'name')) {
|
|
4174
4195
|
const constValue = constProps.name;
|
|
4175
4196
|
if (vHost && constValue instanceof WrappedSignalImpl) {
|
|
4176
|
-
return trackSignalAndAssignHost(constValue, vHost, ":" /* EffectProperty.COMPONENT */, diffContext
|
|
4197
|
+
return trackSignalAndAssignHost(constValue, vHost, ":" /* EffectProperty.COMPONENT */, diffContext.$container$);
|
|
4177
4198
|
}
|
|
4178
4199
|
}
|
|
4179
4200
|
return directGetPropsProxyProp(jsxNode, 'name') || QDefaultSlot;
|
|
4180
4201
|
}
|
|
4181
4202
|
function cleanupSideBuffer(diffContext) {
|
|
4182
|
-
if (diffContext
|
|
4203
|
+
if (diffContext.$vSideBuffer$) {
|
|
4183
4204
|
// Remove all nodes in the side buffer as they are no longer needed
|
|
4184
|
-
for (const vNode of diffContext
|
|
4205
|
+
for (const vNode of diffContext.$vSideBuffer$.values()) {
|
|
4185
4206
|
if (vNode.flags & 32 /* VNodeFlags.Deleted */) {
|
|
4186
4207
|
continue;
|
|
4187
4208
|
}
|
|
4188
|
-
cleanup(diffContext
|
|
4189
|
-
vnode_remove(diffContext
|
|
4209
|
+
cleanup(diffContext.$container$, diffContext.$journal$, vNode, diffContext.$cursor$);
|
|
4210
|
+
vnode_remove(diffContext.$journal$, diffContext.$vParent$, vNode, true);
|
|
4190
4211
|
}
|
|
4191
|
-
diffContext
|
|
4192
|
-
diffContext
|
|
4212
|
+
diffContext.$vSideBuffer$.clear();
|
|
4213
|
+
diffContext.$vSideBuffer$ = null;
|
|
4193
4214
|
}
|
|
4194
|
-
diffContext
|
|
4215
|
+
diffContext.$vCurrent$ = null;
|
|
4195
4216
|
}
|
|
4196
4217
|
function drainAsyncQueue(diffContext) {
|
|
4197
|
-
while (diffContext
|
|
4198
|
-
const jsxNode = diffContext
|
|
4199
|
-
const vHostNode = diffContext
|
|
4218
|
+
while (diffContext.$asyncQueue$.length) {
|
|
4219
|
+
const jsxNode = diffContext.$asyncQueue$.shift();
|
|
4220
|
+
const vHostNode = diffContext.$asyncQueue$.shift();
|
|
4200
4221
|
if (isPromise(jsxNode)) {
|
|
4201
4222
|
return jsxNode
|
|
4202
4223
|
.then((jsxNode) => {
|
|
@@ -4204,7 +4225,7 @@ function drainAsyncQueue(diffContext) {
|
|
|
4204
4225
|
return drainAsyncQueue(diffContext);
|
|
4205
4226
|
})
|
|
4206
4227
|
.catch((e) => {
|
|
4207
|
-
diffContext
|
|
4228
|
+
diffContext.$container$.handleError(e, vHostNode);
|
|
4208
4229
|
return drainAsyncQueue(diffContext);
|
|
4209
4230
|
});
|
|
4210
4231
|
}
|
|
@@ -4213,8 +4234,8 @@ function drainAsyncQueue(diffContext) {
|
|
|
4213
4234
|
}
|
|
4214
4235
|
}
|
|
4215
4236
|
// Wait for all async attribute promises to complete, then check for more work
|
|
4216
|
-
if (diffContext
|
|
4217
|
-
const promises = diffContext
|
|
4237
|
+
if (diffContext.$asyncAttributePromises$.length) {
|
|
4238
|
+
const promises = diffContext.$asyncAttributePromises$.splice(0);
|
|
4218
4239
|
return Promise.all(promises).then(() => {
|
|
4219
4240
|
// After attributes are set, check if there's more work in the queue
|
|
4220
4241
|
return drainAsyncQueue(diffContext);
|
|
@@ -4222,42 +4243,42 @@ function drainAsyncQueue(diffContext) {
|
|
|
4222
4243
|
}
|
|
4223
4244
|
}
|
|
4224
4245
|
function cleanupDiffContext(diffContext) {
|
|
4225
|
-
diffContext
|
|
4226
|
-
diffContext
|
|
4246
|
+
diffContext.$journal$ = null;
|
|
4247
|
+
diffContext.$cursor$ = null;
|
|
4227
4248
|
}
|
|
4228
4249
|
function expectNoChildren(diffContext, removeDOM = true) {
|
|
4229
|
-
const vFirstChild = diffContext
|
|
4250
|
+
const vFirstChild = diffContext.$vCurrent$ && vnode_getFirstChild(diffContext.$vCurrent$);
|
|
4230
4251
|
if (vFirstChild !== null) {
|
|
4231
4252
|
let vChild = vFirstChild;
|
|
4232
4253
|
while (vChild) {
|
|
4233
|
-
cleanup(diffContext
|
|
4254
|
+
cleanup(diffContext.$container$, diffContext.$journal$, vChild, diffContext.$cursor$);
|
|
4234
4255
|
vChild = vChild.nextSibling;
|
|
4235
4256
|
}
|
|
4236
|
-
vnode_truncate(diffContext
|
|
4257
|
+
vnode_truncate(diffContext.$journal$, diffContext.$vCurrent$, vFirstChild, removeDOM);
|
|
4237
4258
|
}
|
|
4238
4259
|
}
|
|
4239
4260
|
/** Expect no more nodes - Any nodes which are still at cursor, need to be removed. */
|
|
4240
4261
|
function expectNoMore(diffContext) {
|
|
4241
4262
|
isDev &&
|
|
4242
|
-
assertFalse(diffContext
|
|
4243
|
-
if (diffContext
|
|
4244
|
-
while (diffContext
|
|
4245
|
-
const toRemove = diffContext
|
|
4246
|
-
diffContext
|
|
4247
|
-
if (diffContext
|
|
4248
|
-
cleanup(diffContext
|
|
4263
|
+
assertFalse(diffContext.$vParent$ === diffContext.$vCurrent$, "Parent and current can't be the same");
|
|
4264
|
+
if (diffContext.$vCurrent$ !== null) {
|
|
4265
|
+
while (diffContext.$vCurrent$) {
|
|
4266
|
+
const toRemove = diffContext.$vCurrent$;
|
|
4267
|
+
diffContext.$vCurrent$ = peekNextSibling(diffContext.$vCurrent$);
|
|
4268
|
+
if (diffContext.$vParent$ === toRemove.parent) {
|
|
4269
|
+
cleanup(diffContext.$container$, diffContext.$journal$, toRemove, diffContext.$cursor$);
|
|
4249
4270
|
// If we are diffing projection than the parent is not the parent of the node.
|
|
4250
4271
|
// If that is the case we don't want to remove the node from the parent.
|
|
4251
|
-
vnode_remove(diffContext
|
|
4272
|
+
vnode_remove(diffContext.$journal$, diffContext.$vParent$, toRemove, true);
|
|
4252
4273
|
}
|
|
4253
4274
|
}
|
|
4254
4275
|
}
|
|
4255
4276
|
}
|
|
4256
4277
|
function expectNoTextNode(diffContext) {
|
|
4257
|
-
if (diffContext
|
|
4258
|
-
const toRemove = diffContext
|
|
4259
|
-
diffContext
|
|
4260
|
-
vnode_remove(diffContext
|
|
4278
|
+
if (diffContext.$vCurrent$ !== null && vnode_isTextVNode(diffContext.$vCurrent$)) {
|
|
4279
|
+
const toRemove = diffContext.$vCurrent$;
|
|
4280
|
+
diffContext.$vCurrent$ = peekNextSibling(diffContext.$vCurrent$);
|
|
4281
|
+
vnode_remove(diffContext.$journal$, diffContext.$vParent$, toRemove, true);
|
|
4261
4282
|
}
|
|
4262
4283
|
}
|
|
4263
4284
|
function createNewElement(diffContext, jsx, elementName, currentFile) {
|
|
@@ -4270,7 +4291,7 @@ function createNewElement(diffContext, jsx, elementName, currentFile) {
|
|
|
4270
4291
|
for (const key in constProps) {
|
|
4271
4292
|
let value = constProps[key];
|
|
4272
4293
|
if (isHtmlAttributeAnEventName(key)) {
|
|
4273
|
-
registerEventHandlers(key, value, element, diffContext
|
|
4294
|
+
registerEventHandlers(key, value, element, diffContext.$vNewNode$, diffContext);
|
|
4274
4295
|
continue;
|
|
4275
4296
|
}
|
|
4276
4297
|
if (key === 'ref') {
|
|
@@ -4290,14 +4311,14 @@ function createNewElement(diffContext, jsx, elementName, currentFile) {
|
|
|
4290
4311
|
}
|
|
4291
4312
|
}
|
|
4292
4313
|
if (isSignal(value)) {
|
|
4293
|
-
const vHost = diffContext
|
|
4314
|
+
const vHost = diffContext.$vNewNode$;
|
|
4294
4315
|
const signal = value;
|
|
4295
|
-
value = retryOnPromise(() => trackSignalAndAssignHost(signal, vHost, key, diffContext
|
|
4316
|
+
value = retryOnPromise(() => trackSignalAndAssignHost(signal, vHost, key, diffContext.$container$, diffContext.$subscriptionData$.$const$));
|
|
4296
4317
|
}
|
|
4297
4318
|
if (isPromise(value)) {
|
|
4298
|
-
const vHost = diffContext
|
|
4299
|
-
const attributePromise = value.then((resolvedValue) => directSetAttribute(element, key, serializeAttribute(key, resolvedValue, diffContext
|
|
4300
|
-
diffContext
|
|
4319
|
+
const vHost = diffContext.$vNewNode$;
|
|
4320
|
+
const attributePromise = value.then((resolvedValue) => directSetAttribute(element, key, serializeAttribute(key, resolvedValue, diffContext.$scopedStyleIdPrefix$), (vHost.flags & 512 /* VNodeFlags.NS_svg */) !== 0));
|
|
4321
|
+
diffContext.$asyncAttributePromises$.push(attributePromise);
|
|
4301
4322
|
continue;
|
|
4302
4323
|
}
|
|
4303
4324
|
if (key === dangerouslySetInnerHTML) {
|
|
@@ -4317,22 +4338,22 @@ function createNewElement(diffContext, jsx, elementName, currentFile) {
|
|
|
4317
4338
|
element.value = escapeHTML(value || '');
|
|
4318
4339
|
continue;
|
|
4319
4340
|
}
|
|
4320
|
-
directSetAttribute(element, key, serializeAttribute(key, value, diffContext
|
|
4341
|
+
directSetAttribute(element, key, serializeAttribute(key, value, diffContext.$scopedStyleIdPrefix$), (diffContext.$vNewNode$.flags & 512 /* VNodeFlags.NS_svg */) !== 0);
|
|
4321
4342
|
}
|
|
4322
4343
|
}
|
|
4323
4344
|
const key = jsx.key;
|
|
4324
4345
|
if (key) {
|
|
4325
|
-
diffContext
|
|
4346
|
+
diffContext.$vNewNode$.key = key;
|
|
4326
4347
|
}
|
|
4327
4348
|
// append class attribute if styleScopedId exists and there is no class attribute
|
|
4328
|
-
if (diffContext
|
|
4349
|
+
if (diffContext.$scopedStyleIdPrefix$) {
|
|
4329
4350
|
const classAttributeExists = _hasOwnProperty.call(jsx.varProps, 'class') ||
|
|
4330
4351
|
(jsx.constProps && _hasOwnProperty.call(jsx.constProps, 'class'));
|
|
4331
4352
|
if (!classAttributeExists) {
|
|
4332
|
-
element.setAttribute('class', diffContext
|
|
4353
|
+
element.setAttribute('class', diffContext.$scopedStyleIdPrefix$);
|
|
4333
4354
|
}
|
|
4334
4355
|
}
|
|
4335
|
-
vnode_insertElementBefore(diffContext
|
|
4356
|
+
vnode_insertElementBefore(diffContext.$journal$, diffContext.$vParent$, diffContext.$vNewNode$, diffContext.$vCurrent$);
|
|
4336
4357
|
}
|
|
4337
4358
|
function registerEventHandlers(key, value, element, vnode, diffContext) {
|
|
4338
4359
|
const scopedKebabName = key.slice(2);
|
|
@@ -4365,33 +4386,34 @@ function registerEventHandlers(key, value, element, vnode, diffContext) {
|
|
|
4365
4386
|
// window and document events need attrs so qwik loader can find them
|
|
4366
4387
|
// TODO only do these when not already present
|
|
4367
4388
|
if (key.charAt(2) !== 'e') {
|
|
4368
|
-
vnode_setAttr(diffContext
|
|
4389
|
+
vnode_setAttr(diffContext.$journal$, vnode, key, '');
|
|
4369
4390
|
}
|
|
4370
4391
|
registerQwikLoaderEvent(diffContext, scopedKebabName);
|
|
4371
4392
|
}
|
|
4372
4393
|
function createElementWithNamespace(diffContext, elementName) {
|
|
4373
|
-
const domParentVNode = vnode_getDomParentVNode(diffContext
|
|
4394
|
+
const domParentVNode = vnode_getDomParentVNode(diffContext.$vParent$, true);
|
|
4374
4395
|
const namespaceData = getNewElementNamespaceData(domParentVNode, elementName);
|
|
4375
|
-
const currentDocument = import.meta.env.TEST ? diffContext
|
|
4396
|
+
const currentDocument = import.meta.env.TEST ? diffContext.$container$.document : document;
|
|
4376
4397
|
const element = namespaceData.elementNamespaceFlag === 0 /* VNodeFlags.NS_html */
|
|
4377
4398
|
? currentDocument.createElement(elementName)
|
|
4378
4399
|
: currentDocument.createElementNS(namespaceData.elementNamespace, elementName);
|
|
4379
|
-
diffContext
|
|
4380
|
-
diffContext
|
|
4400
|
+
diffContext.$vNewNode$ = vnode_newElement(element, elementName);
|
|
4401
|
+
diffContext.$vNewNode$.flags |= namespaceData.elementNamespaceFlag;
|
|
4381
4402
|
return element;
|
|
4382
4403
|
}
|
|
4383
4404
|
function expectElement(diffContext, jsx, elementName) {
|
|
4384
|
-
if (diffContext
|
|
4405
|
+
if (diffContext.$isCreationMode$) {
|
|
4385
4406
|
createNewElement(diffContext, jsx, elementName, null);
|
|
4386
4407
|
}
|
|
4387
4408
|
else {
|
|
4388
|
-
const isElementVNode = diffContext
|
|
4389
|
-
const isSameElementName = isElementVNode &&
|
|
4409
|
+
const isElementVNode = diffContext.$vCurrent$ && vnode_isElementVNode(diffContext.$vCurrent$);
|
|
4410
|
+
const isSameElementName = isElementVNode &&
|
|
4411
|
+
elementName === vnode_getElementName(diffContext.$vCurrent$);
|
|
4390
4412
|
const jsxKey = jsx.key;
|
|
4391
|
-
const currentKey = isElementVNode && diffContext
|
|
4413
|
+
const currentKey = isElementVNode && diffContext.$vCurrent$.key;
|
|
4392
4414
|
if (!isSameElementName || jsxKey !== currentKey) {
|
|
4393
4415
|
const sideBufferKey = getSideBufferKey(elementName, jsxKey);
|
|
4394
|
-
if (moveOrCreateKeyedNode(diffContext, elementName, jsxKey, sideBufferKey, diffContext
|
|
4416
|
+
if (moveOrCreateKeyedNode(diffContext, elementName, jsxKey, sideBufferKey, diffContext.$vParent$)) {
|
|
4395
4417
|
createNewElement(diffContext, jsx, elementName, null);
|
|
4396
4418
|
}
|
|
4397
4419
|
}
|
|
@@ -4402,15 +4424,15 @@ function expectElement(diffContext, jsx, elementName) {
|
|
|
4402
4424
|
}
|
|
4403
4425
|
// reconcile attributes
|
|
4404
4426
|
const jsxProps = jsx.varProps;
|
|
4405
|
-
const vNode = (diffContext
|
|
4427
|
+
const vNode = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
4406
4428
|
if (jsxProps) {
|
|
4407
4429
|
diffProps(diffContext, vNode, jsxProps, (isDev && getFileLocationFromJsx(jsx.dev)) || null);
|
|
4408
4430
|
}
|
|
4409
4431
|
}
|
|
4410
4432
|
function diffProps(diffContext, vnode, newAttrs, currentFile) {
|
|
4411
|
-
if (!diffContext
|
|
4433
|
+
if (!diffContext.$isCreationMode$) {
|
|
4412
4434
|
// inflate only resumed vnodes
|
|
4413
|
-
vnode_ensureElementInflated(diffContext
|
|
4435
|
+
vnode_ensureElementInflated(diffContext.$container$, vnode);
|
|
4414
4436
|
}
|
|
4415
4437
|
const oldAttrs = vnode.props;
|
|
4416
4438
|
// Actual diffing logic
|
|
@@ -4483,29 +4505,29 @@ const patchProperty = (diffContext, vnode, key, value, currentFile) => {
|
|
|
4483
4505
|
return;
|
|
4484
4506
|
}
|
|
4485
4507
|
if (currentEffect) {
|
|
4486
|
-
clearEffectSubscription(diffContext
|
|
4508
|
+
clearEffectSubscription(diffContext.$container$, currentEffect);
|
|
4487
4509
|
}
|
|
4488
4510
|
const vHost = vnode;
|
|
4489
|
-
value = retryOnPromise(() => trackSignalAndAssignHost(unwrappedSignal, vHost, key, diffContext
|
|
4511
|
+
value = retryOnPromise(() => trackSignalAndAssignHost(unwrappedSignal, vHost, key, diffContext.$container$, diffContext.$subscriptionData$.$var$));
|
|
4490
4512
|
}
|
|
4491
4513
|
else {
|
|
4492
4514
|
if (currentEffect) {
|
|
4493
|
-
clearEffectSubscription(diffContext
|
|
4515
|
+
clearEffectSubscription(diffContext.$container$, currentEffect);
|
|
4494
4516
|
}
|
|
4495
4517
|
}
|
|
4496
4518
|
if (isPromise(value)) {
|
|
4497
4519
|
const vHost = vnode;
|
|
4498
4520
|
const attributePromise = value.then((resolvedValue) => {
|
|
4499
|
-
setAttribute(diffContext
|
|
4521
|
+
setAttribute(diffContext.$journal$, vHost, key, resolvedValue, diffContext.$scopedStyleIdPrefix$, originalValue);
|
|
4500
4522
|
});
|
|
4501
|
-
diffContext
|
|
4523
|
+
diffContext.$asyncAttributePromises$.push(attributePromise);
|
|
4502
4524
|
return;
|
|
4503
4525
|
}
|
|
4504
|
-
setAttribute(diffContext
|
|
4526
|
+
setAttribute(diffContext.$journal$, vnode, key, value, diffContext.$scopedStyleIdPrefix$, originalValue);
|
|
4505
4527
|
};
|
|
4506
4528
|
function registerQwikLoaderEvent(diffContext, eventName) {
|
|
4507
4529
|
const qWindow = import.meta.env.TEST
|
|
4508
|
-
? diffContext
|
|
4530
|
+
? diffContext.$container$.document.defaultView
|
|
4509
4531
|
: window;
|
|
4510
4532
|
if (qWindow) {
|
|
4511
4533
|
(qWindow._qwikEv ||= []).push(eventName);
|
|
@@ -4513,35 +4535,35 @@ function registerQwikLoaderEvent(diffContext, eventName) {
|
|
|
4513
4535
|
}
|
|
4514
4536
|
function retrieveChildWithKey(diffContext, nodeName, key) {
|
|
4515
4537
|
let vNodeWithKey = null;
|
|
4516
|
-
if (diffContext
|
|
4538
|
+
if (diffContext.$vSiblings$ === null) {
|
|
4517
4539
|
// check if the current node is the one we are looking for
|
|
4518
|
-
const vCurrent = diffContext
|
|
4540
|
+
const vCurrent = diffContext.$vCurrent$;
|
|
4519
4541
|
if (vCurrent) {
|
|
4520
4542
|
const name = vnode_isElementVNode(vCurrent) ? vnode_getElementName(vCurrent) : null;
|
|
4521
4543
|
const vKey = getKey(vCurrent) ||
|
|
4522
|
-
getComponentHash(vCurrent, diffContext
|
|
4544
|
+
getComponentHash(vCurrent, diffContext.$container$.$getObjectById$);
|
|
4523
4545
|
if (vKey === key && name === nodeName) {
|
|
4524
4546
|
return vCurrent;
|
|
4525
4547
|
}
|
|
4526
4548
|
}
|
|
4527
4549
|
// it is not materialized; so materialize it.
|
|
4528
|
-
diffContext
|
|
4529
|
-
diffContext
|
|
4530
|
-
let vNode = diffContext
|
|
4550
|
+
diffContext.$vSiblings$ = new Map();
|
|
4551
|
+
diffContext.$vSiblingsArray$ = [];
|
|
4552
|
+
let vNode = diffContext.$vCurrent$;
|
|
4531
4553
|
while (vNode) {
|
|
4532
4554
|
const name = vnode_isElementVNode(vNode) ? vnode_getElementName(vNode) : null;
|
|
4533
4555
|
const vKey = getKey(vNode) ||
|
|
4534
|
-
getComponentHash(vNode, diffContext
|
|
4556
|
+
getComponentHash(vNode, diffContext.$container$.$getObjectById$);
|
|
4535
4557
|
if (vNodeWithKey === null && vKey == key && name == nodeName) {
|
|
4536
4558
|
vNodeWithKey = vNode;
|
|
4537
4559
|
}
|
|
4538
4560
|
else {
|
|
4539
4561
|
if (vKey === null) {
|
|
4540
|
-
diffContext
|
|
4562
|
+
diffContext.$vSiblingsArray$.push(name, vNode);
|
|
4541
4563
|
}
|
|
4542
4564
|
else {
|
|
4543
4565
|
// we only add the elements which we did not find yet.
|
|
4544
|
-
diffContext
|
|
4566
|
+
diffContext.$vSiblings$.set(getSideBufferKey(name, vKey), vNode);
|
|
4545
4567
|
}
|
|
4546
4568
|
}
|
|
4547
4569
|
vNode = vNode.nextSibling;
|
|
@@ -4549,20 +4571,20 @@ function retrieveChildWithKey(diffContext, nodeName, key) {
|
|
|
4549
4571
|
}
|
|
4550
4572
|
else {
|
|
4551
4573
|
if (key === null) {
|
|
4552
|
-
for (let i = 0; i < diffContext
|
|
4553
|
-
if (diffContext
|
|
4554
|
-
vNodeWithKey = diffContext
|
|
4555
|
-
diffContext
|
|
4574
|
+
for (let i = 0; i < diffContext.$vSiblingsArray$.length; i += 2) {
|
|
4575
|
+
if (diffContext.$vSiblingsArray$[i] === nodeName) {
|
|
4576
|
+
vNodeWithKey = diffContext.$vSiblingsArray$[i + 1];
|
|
4577
|
+
diffContext.$vSiblingsArray$.splice(i, 2);
|
|
4556
4578
|
break;
|
|
4557
4579
|
}
|
|
4558
4580
|
}
|
|
4559
4581
|
}
|
|
4560
4582
|
else {
|
|
4561
4583
|
const siblingsKey = getSideBufferKey(nodeName, key);
|
|
4562
|
-
const sibling = diffContext
|
|
4584
|
+
const sibling = diffContext.$vSiblings$.get(siblingsKey);
|
|
4563
4585
|
if (sibling) {
|
|
4564
4586
|
vNodeWithKey = sibling;
|
|
4565
|
-
diffContext
|
|
4587
|
+
diffContext.$vSiblings$.delete(siblingsKey);
|
|
4566
4588
|
}
|
|
4567
4589
|
}
|
|
4568
4590
|
}
|
|
@@ -4571,32 +4593,32 @@ function retrieveChildWithKey(diffContext, nodeName, key) {
|
|
|
4571
4593
|
}
|
|
4572
4594
|
function collectSideBufferSiblings(diffContext, targetNode) {
|
|
4573
4595
|
if (!targetNode) {
|
|
4574
|
-
if (diffContext
|
|
4575
|
-
const name = vnode_isElementVNode(diffContext
|
|
4576
|
-
? vnode_getElementName(diffContext
|
|
4596
|
+
if (diffContext.$vCurrent$) {
|
|
4597
|
+
const name = vnode_isElementVNode(diffContext.$vCurrent$)
|
|
4598
|
+
? vnode_getElementName(diffContext.$vCurrent$)
|
|
4577
4599
|
: null;
|
|
4578
|
-
const vKey = getKey(diffContext
|
|
4579
|
-
getComponentHash(diffContext
|
|
4600
|
+
const vKey = getKey(diffContext.$vCurrent$) ||
|
|
4601
|
+
getComponentHash(diffContext.$vCurrent$, diffContext.$container$.$getObjectById$);
|
|
4580
4602
|
if (vKey != null) {
|
|
4581
4603
|
const sideBufferKey = getSideBufferKey(name, vKey);
|
|
4582
|
-
diffContext
|
|
4583
|
-
diffContext
|
|
4584
|
-
diffContext
|
|
4604
|
+
diffContext.$vSideBuffer$ ||= new Map();
|
|
4605
|
+
diffContext.$vSideBuffer$.set(sideBufferKey, diffContext.$vCurrent$);
|
|
4606
|
+
diffContext.$vSiblings$?.delete(sideBufferKey);
|
|
4585
4607
|
}
|
|
4586
4608
|
}
|
|
4587
4609
|
return;
|
|
4588
4610
|
}
|
|
4589
4611
|
// Walk from vCurrent up to the target node and collect all keyed siblings
|
|
4590
|
-
let vNode = diffContext
|
|
4612
|
+
let vNode = diffContext.$vCurrent$;
|
|
4591
4613
|
while (vNode && vNode !== targetNode) {
|
|
4592
4614
|
const name = vnode_isElementVNode(vNode) ? vnode_getElementName(vNode) : null;
|
|
4593
4615
|
const vKey = getKey(vNode) ||
|
|
4594
|
-
getComponentHash(vNode, diffContext
|
|
4616
|
+
getComponentHash(vNode, diffContext.$container$.$getObjectById$);
|
|
4595
4617
|
if (vKey != null) {
|
|
4596
4618
|
const sideBufferKey = getSideBufferKey(name, vKey);
|
|
4597
|
-
diffContext
|
|
4598
|
-
diffContext
|
|
4599
|
-
diffContext
|
|
4619
|
+
diffContext.$vSideBuffer$ ||= new Map();
|
|
4620
|
+
diffContext.$vSideBuffer$.set(sideBufferKey, vNode);
|
|
4621
|
+
diffContext.$vSiblings$?.delete(sideBufferKey);
|
|
4600
4622
|
}
|
|
4601
4623
|
vNode = vNode.nextSibling;
|
|
4602
4624
|
}
|
|
@@ -4609,8 +4631,8 @@ function getSideBufferKey(nodeName, key) {
|
|
|
4609
4631
|
}
|
|
4610
4632
|
function deleteFromSideBuffer(diffContext, nodeName, key) {
|
|
4611
4633
|
const sbKey = getSideBufferKey(nodeName, key);
|
|
4612
|
-
if (sbKey && diffContext
|
|
4613
|
-
diffContext
|
|
4634
|
+
if (sbKey && diffContext.$vSideBuffer$?.has(sbKey)) {
|
|
4635
|
+
diffContext.$vSideBuffer$.delete(sbKey);
|
|
4614
4636
|
return true;
|
|
4615
4637
|
}
|
|
4616
4638
|
return false;
|
|
@@ -4628,40 +4650,40 @@ function deleteFromSideBuffer(diffContext, nodeName, key) {
|
|
|
4628
4650
|
*/
|
|
4629
4651
|
function moveOrCreateKeyedNode(diffContext, nodeName, lookupKey, sideBufferKey, parentForInsert, addCurrentToSideBufferOnSideInsert) {
|
|
4630
4652
|
// 1) Try to find the node among upcoming siblings
|
|
4631
|
-
diffContext
|
|
4632
|
-
if (diffContext
|
|
4653
|
+
diffContext.$vNewNode$ = retrieveChildWithKey(diffContext, nodeName, lookupKey);
|
|
4654
|
+
if (diffContext.$vNewNode$) {
|
|
4633
4655
|
if (!sideBufferKey) {
|
|
4634
|
-
vnode_insertBefore(diffContext
|
|
4656
|
+
vnode_insertBefore(diffContext.$journal$, parentForInsert, diffContext.$vNewNode$, diffContext.$vCurrent$);
|
|
4635
4657
|
}
|
|
4636
|
-
diffContext
|
|
4637
|
-
diffContext
|
|
4658
|
+
diffContext.$vCurrent$ = diffContext.$vNewNode$;
|
|
4659
|
+
diffContext.$vNewNode$ = null;
|
|
4638
4660
|
return false;
|
|
4639
4661
|
}
|
|
4640
4662
|
// 2) Try side buffer
|
|
4641
4663
|
if (sideBufferKey != null) {
|
|
4642
|
-
const buffered = diffContext
|
|
4664
|
+
const buffered = diffContext.$vSideBuffer$?.get(sideBufferKey) || null;
|
|
4643
4665
|
if (buffered) {
|
|
4644
|
-
diffContext
|
|
4645
|
-
if (addCurrentToSideBufferOnSideInsert && diffContext
|
|
4646
|
-
const currentKey = getKey(diffContext
|
|
4647
|
-
getComponentHash(diffContext
|
|
4666
|
+
diffContext.$vSideBuffer$.delete(sideBufferKey);
|
|
4667
|
+
if (addCurrentToSideBufferOnSideInsert && diffContext.$vCurrent$) {
|
|
4668
|
+
const currentKey = getKey(diffContext.$vCurrent$) ||
|
|
4669
|
+
getComponentHash(diffContext.$vCurrent$, diffContext.$container$.$getObjectById$);
|
|
4648
4670
|
if (currentKey != null) {
|
|
4649
|
-
const currentName = vnode_isElementVNode(diffContext
|
|
4650
|
-
? vnode_getElementName(diffContext
|
|
4671
|
+
const currentName = vnode_isElementVNode(diffContext.$vCurrent$)
|
|
4672
|
+
? vnode_getElementName(diffContext.$vCurrent$)
|
|
4651
4673
|
: null;
|
|
4652
4674
|
const currentSideKey = getSideBufferKey(currentName, currentKey);
|
|
4653
4675
|
if (currentSideKey != null) {
|
|
4654
|
-
diffContext
|
|
4655
|
-
diffContext
|
|
4676
|
+
diffContext.$vSideBuffer$ ||= new Map();
|
|
4677
|
+
diffContext.$vSideBuffer$.set(currentSideKey, diffContext.$vCurrent$);
|
|
4656
4678
|
}
|
|
4657
4679
|
}
|
|
4658
4680
|
}
|
|
4659
4681
|
// Only move if the node is not already in the correct position
|
|
4660
|
-
if (buffered !== diffContext
|
|
4661
|
-
vnode_insertBefore(diffContext
|
|
4682
|
+
if (buffered !== diffContext.$vCurrent$) {
|
|
4683
|
+
vnode_insertBefore(diffContext.$journal$, parentForInsert, buffered, diffContext.$vCurrent$);
|
|
4662
4684
|
}
|
|
4663
|
-
diffContext
|
|
4664
|
-
diffContext
|
|
4685
|
+
diffContext.$vCurrent$ = buffered;
|
|
4686
|
+
diffContext.$vNewNode$ = null;
|
|
4665
4687
|
return false;
|
|
4666
4688
|
}
|
|
4667
4689
|
}
|
|
@@ -4670,8 +4692,8 @@ function moveOrCreateKeyedNode(diffContext, nodeName, lookupKey, sideBufferKey,
|
|
|
4670
4692
|
}
|
|
4671
4693
|
function expectVirtual(diffContext, type, jsxKey) {
|
|
4672
4694
|
const checkKey = type === "F" /* VirtualType.Fragment */;
|
|
4673
|
-
const currentKey = getKey(diffContext
|
|
4674
|
-
const currentIsVirtual = diffContext
|
|
4695
|
+
const currentKey = getKey(diffContext.$vCurrent$);
|
|
4696
|
+
const currentIsVirtual = diffContext.$vCurrent$ && vnode_isVirtualVNode(diffContext.$vCurrent$);
|
|
4675
4697
|
const isSameNode = currentIsVirtual && currentKey === jsxKey && (checkKey ? !!jsxKey : true);
|
|
4676
4698
|
if (isSameNode) {
|
|
4677
4699
|
// All is good.
|
|
@@ -4679,53 +4701,61 @@ function expectVirtual(diffContext, type, jsxKey) {
|
|
|
4679
4701
|
return;
|
|
4680
4702
|
}
|
|
4681
4703
|
// For fragments without a key, always create a new virtual node (ensures rerender semantics)
|
|
4682
|
-
if (jsxKey === null || diffContext
|
|
4683
|
-
vnode_insertVirtualBefore(diffContext
|
|
4684
|
-
diffContext
|
|
4685
|
-
isDev && vnode_setProp(diffContext
|
|
4704
|
+
if (jsxKey === null || diffContext.$isCreationMode$) {
|
|
4705
|
+
vnode_insertVirtualBefore(diffContext.$journal$, diffContext.$vParent$, (diffContext.$vNewNode$ = vnode_newVirtual()), diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4706
|
+
diffContext.$vNewNode$.key = jsxKey;
|
|
4707
|
+
isDev && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
|
|
4686
4708
|
return;
|
|
4687
4709
|
}
|
|
4688
|
-
if (moveOrCreateKeyedNode(diffContext, null, jsxKey, getSideBufferKey(null, jsxKey), diffContext
|
|
4689
|
-
vnode_insertVirtualBefore(diffContext
|
|
4690
|
-
diffContext
|
|
4691
|
-
isDev && vnode_setProp(diffContext
|
|
4710
|
+
if (moveOrCreateKeyedNode(diffContext, null, jsxKey, getSideBufferKey(null, jsxKey), diffContext.$vParent$, true)) {
|
|
4711
|
+
vnode_insertVirtualBefore(diffContext.$journal$, diffContext.$vParent$, (diffContext.$vNewNode$ = vnode_newVirtual()), diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4712
|
+
diffContext.$vNewNode$.key = jsxKey;
|
|
4713
|
+
isDev && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
|
|
4692
4714
|
}
|
|
4693
4715
|
}
|
|
4694
4716
|
function expectComponent(diffContext, component) {
|
|
4695
4717
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
4696
|
-
let host = (diffContext
|
|
4697
|
-
const jsxNode = diffContext
|
|
4718
|
+
let host = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
4719
|
+
const jsxNode = diffContext.$jsxValue$;
|
|
4698
4720
|
if (componentMeta) {
|
|
4699
4721
|
const jsxProps = jsxNode.props;
|
|
4700
4722
|
// QComponent
|
|
4701
4723
|
let shouldRender = false;
|
|
4702
4724
|
const [componentQRL] = componentMeta;
|
|
4703
4725
|
const componentHash = componentQRL.$hash$;
|
|
4704
|
-
const vNodeComponentHash = getComponentHash(host, diffContext
|
|
4726
|
+
const vNodeComponentHash = getComponentHash(host, diffContext.$container$.$getObjectById$);
|
|
4705
4727
|
const lookupKey = jsxNode.key || componentHash;
|
|
4706
4728
|
const vNodeLookupKey = getKey(host) || vNodeComponentHash;
|
|
4707
4729
|
const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
|
|
4708
4730
|
const hashesAreEqual = componentHash === vNodeComponentHash;
|
|
4709
|
-
if (
|
|
4710
|
-
if (
|
|
4731
|
+
if (lookupKeysAreEqual) {
|
|
4732
|
+
if (hashesAreEqual) {
|
|
4733
|
+
deleteFromSideBuffer(diffContext, null, lookupKey);
|
|
4734
|
+
}
|
|
4735
|
+
else {
|
|
4711
4736
|
insertNewComponent(diffContext, host, componentQRL, jsxProps);
|
|
4737
|
+
host = diffContext.$vNewNode$;
|
|
4712
4738
|
shouldRender = true;
|
|
4713
4739
|
}
|
|
4714
|
-
host = (diffContext.vNewNode || diffContext.vCurrent);
|
|
4715
|
-
}
|
|
4716
|
-
else if (!hashesAreEqual || !jsxNode.key) {
|
|
4717
|
-
insertNewComponent(diffContext, host, componentQRL, jsxProps);
|
|
4718
|
-
host = diffContext.vNewNode;
|
|
4719
|
-
shouldRender = true;
|
|
4720
4740
|
}
|
|
4721
4741
|
else {
|
|
4722
|
-
|
|
4723
|
-
|
|
4742
|
+
if (moveOrCreateKeyedNode(diffContext, null, lookupKey, lookupKey, diffContext.$vParent$)) {
|
|
4743
|
+
insertNewComponent(diffContext, host, componentQRL, jsxProps);
|
|
4744
|
+
shouldRender = true;
|
|
4745
|
+
}
|
|
4746
|
+
host = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
4724
4747
|
}
|
|
4725
4748
|
if (host) {
|
|
4726
|
-
const vNodeProps = vnode_getProp(host, ELEMENT_PROPS, diffContext
|
|
4749
|
+
const vNodeProps = vnode_getProp(host, ELEMENT_PROPS, diffContext.$container$.$getObjectById$);
|
|
4727
4750
|
if (!shouldRender) {
|
|
4728
|
-
|
|
4751
|
+
const propsChanged = handleProps(host, jsxProps, vNodeProps, diffContext.$container$);
|
|
4752
|
+
// if props changed but key is null we need to insert a new component, because we need to execute hooks etc
|
|
4753
|
+
if (propsChanged && jsxNode.key == null) {
|
|
4754
|
+
insertNewComponent(diffContext, host, componentQRL, jsxProps);
|
|
4755
|
+
host = diffContext.$vNewNode$;
|
|
4756
|
+
shouldRender = true;
|
|
4757
|
+
}
|
|
4758
|
+
shouldRender ||= propsChanged;
|
|
4729
4759
|
}
|
|
4730
4760
|
if (shouldRender) {
|
|
4731
4761
|
// Assign the new QRL instance to the host.
|
|
@@ -4736,7 +4766,7 @@ function expectComponent(diffContext, component) {
|
|
|
4736
4766
|
* cleanup run. Now we found it and want to reuse it, so we need to mark it as not deleted.
|
|
4737
4767
|
*/
|
|
4738
4768
|
host.flags &= -33 /* VNodeFlags.Deleted */;
|
|
4739
|
-
markVNodeDirty(diffContext
|
|
4769
|
+
markVNodeDirty(diffContext.$container$, host, 4 /* ChoreBits.COMPONENT */, diffContext.$cursor$);
|
|
4740
4770
|
}
|
|
4741
4771
|
}
|
|
4742
4772
|
descendContentToProject(diffContext, jsxNode.children, host);
|
|
@@ -4745,18 +4775,18 @@ function expectComponent(diffContext, component) {
|
|
|
4745
4775
|
const lookupKey = jsxNode.key;
|
|
4746
4776
|
const vNodeLookupKey = getKey(host);
|
|
4747
4777
|
const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
|
|
4748
|
-
const vNodeComponentHash = getComponentHash(host, diffContext
|
|
4778
|
+
const vNodeComponentHash = getComponentHash(host, diffContext.$container$.$getObjectById$);
|
|
4749
4779
|
const isInlineComponent = vNodeComponentHash == null;
|
|
4750
|
-
if ((host && !isInlineComponent) ||
|
|
4780
|
+
if ((host && !isInlineComponent) || !host) {
|
|
4751
4781
|
insertNewInlineComponent(diffContext);
|
|
4752
|
-
host = diffContext
|
|
4782
|
+
host = diffContext.$vNewNode$;
|
|
4753
4783
|
}
|
|
4754
4784
|
else if (!lookupKeysAreEqual) {
|
|
4755
|
-
if (moveOrCreateKeyedNode(diffContext, null, lookupKey, lookupKey, diffContext
|
|
4785
|
+
if (moveOrCreateKeyedNode(diffContext, null, lookupKey, lookupKey, diffContext.$vParent$)) {
|
|
4756
4786
|
// We did not find the inline component, create it.
|
|
4757
4787
|
insertNewInlineComponent(diffContext);
|
|
4758
4788
|
}
|
|
4759
|
-
host = (diffContext
|
|
4789
|
+
host = (diffContext.$vNewNode$ || diffContext.$vCurrent$);
|
|
4760
4790
|
}
|
|
4761
4791
|
else {
|
|
4762
4792
|
// delete the key from the side buffer if it is the same component
|
|
@@ -4771,44 +4801,44 @@ function expectComponent(diffContext, component) {
|
|
|
4771
4801
|
: true)) {
|
|
4772
4802
|
componentHost = componentHost.parent || vnode_getProjectionParentComponent(componentHost);
|
|
4773
4803
|
}
|
|
4774
|
-
const jsxOutput = executeComponent(diffContext
|
|
4775
|
-
diffContext
|
|
4804
|
+
const jsxOutput = executeComponent(diffContext.$container$, host, (componentHost || diffContext.$container$.rootVNode), component, jsxNode.props);
|
|
4805
|
+
diffContext.$asyncQueue$.push(jsxOutput, host);
|
|
4776
4806
|
}
|
|
4777
4807
|
}
|
|
4778
4808
|
}
|
|
4779
4809
|
function insertNewComponent(diffContext, host, componentQRL, jsxProps) {
|
|
4780
4810
|
if (host) {
|
|
4781
|
-
clearAllEffects(diffContext
|
|
4811
|
+
clearAllEffects(diffContext.$container$, host);
|
|
4782
4812
|
}
|
|
4783
|
-
vnode_insertVirtualBefore(diffContext
|
|
4784
|
-
const jsxNode = diffContext
|
|
4785
|
-
isDev && vnode_setProp(diffContext
|
|
4786
|
-
vnode_setProp(diffContext
|
|
4787
|
-
vnode_setProp(diffContext
|
|
4788
|
-
diffContext
|
|
4813
|
+
vnode_insertVirtualBefore(diffContext.$journal$, diffContext.$vParent$, (diffContext.$vNewNode$ = vnode_newVirtual()), diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4814
|
+
const jsxNode = diffContext.$jsxValue$;
|
|
4815
|
+
isDev && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "C" /* VirtualType.Component */);
|
|
4816
|
+
vnode_setProp(diffContext.$vNewNode$, OnRenderProp, componentQRL);
|
|
4817
|
+
vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxProps);
|
|
4818
|
+
diffContext.$vNewNode$.key = jsxNode.key;
|
|
4789
4819
|
}
|
|
4790
4820
|
function insertNewInlineComponent(diffContext) {
|
|
4791
|
-
vnode_insertVirtualBefore(diffContext
|
|
4792
|
-
const jsxNode = diffContext
|
|
4821
|
+
vnode_insertVirtualBefore(diffContext.$journal$, diffContext.$vParent$, (diffContext.$vNewNode$ = vnode_newVirtual()), diffContext.$vCurrent$ && getInsertBefore(diffContext));
|
|
4822
|
+
const jsxNode = diffContext.$jsxValue$;
|
|
4793
4823
|
isDev &&
|
|
4794
|
-
vnode_setProp(diffContext
|
|
4795
|
-
vnode_setProp(diffContext
|
|
4824
|
+
vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "I" /* VirtualType.InlineComponent */);
|
|
4825
|
+
vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxNode.props);
|
|
4796
4826
|
if (jsxNode.key) {
|
|
4797
|
-
diffContext
|
|
4827
|
+
diffContext.$vNewNode$.key = jsxNode.key;
|
|
4798
4828
|
}
|
|
4799
4829
|
}
|
|
4800
4830
|
function expectText(diffContext, text) {
|
|
4801
|
-
if (diffContext
|
|
4802
|
-
const type = vnode_getType(diffContext
|
|
4831
|
+
if (diffContext.$vCurrent$ !== null) {
|
|
4832
|
+
const type = vnode_getType(diffContext.$vCurrent$);
|
|
4803
4833
|
if (type === 3 /* Text */) {
|
|
4804
|
-
if (text !== vnode_getText(diffContext
|
|
4805
|
-
vnode_setText(diffContext
|
|
4834
|
+
if (text !== vnode_getText(diffContext.$vCurrent$)) {
|
|
4835
|
+
vnode_setText(diffContext.$journal$, diffContext.$vCurrent$, text);
|
|
4806
4836
|
return;
|
|
4807
4837
|
}
|
|
4808
4838
|
return;
|
|
4809
4839
|
}
|
|
4810
4840
|
}
|
|
4811
|
-
vnode_insertElementBefore(diffContext
|
|
4841
|
+
vnode_insertElementBefore(diffContext.$journal$, diffContext.$vParent$, (diffContext.$vNewNode$ = vnode_newText((import.meta.env.TEST ? diffContext.$container$.document : document).createTextNode(text), text)), diffContext.$vCurrent$);
|
|
4812
4842
|
}
|
|
4813
4843
|
/**
|
|
4814
4844
|
* Retrieve the key from the VNode.
|
|
@@ -5739,7 +5769,7 @@ function walkCursor(cursor, options) {
|
|
|
5739
5769
|
return;
|
|
5740
5770
|
}
|
|
5741
5771
|
// Check time budget (only for DOM, not SSR)
|
|
5742
|
-
if (
|
|
5772
|
+
if (isBrowser) {
|
|
5743
5773
|
const elapsed = performance.now() - startTime;
|
|
5744
5774
|
if (elapsed >= timeBudget) {
|
|
5745
5775
|
// Schedule continuation as macrotask to actually yield to browser
|
|
@@ -5781,10 +5811,27 @@ function tryDescendDirtyChildren(container, cursorData, currentVNode, cursor) {
|
|
|
5781
5811
|
return null;
|
|
5782
5812
|
}
|
|
5783
5813
|
partitionDirtyChildren(dirtyChildren, currentVNode);
|
|
5814
|
+
// Scan dirtyChildren directly instead of going through getNextVNode.
|
|
5815
|
+
// getNextVNode follows the child's parent/slotParent pointer, which for Projection nodes
|
|
5816
|
+
// points to the DOM insertion location rather than currentVNode — that would scan the
|
|
5817
|
+
// wrong dirtyChildren array and potentially cause infinite loops.
|
|
5818
|
+
// const len = dirtyChildren.length;
|
|
5819
|
+
// for (let i = 0; i < len; i++) {
|
|
5820
|
+
// const child = dirtyChildren[i];
|
|
5821
|
+
// if (child.dirty & ChoreBits.DIRTY_MASK) {
|
|
5822
|
+
// currentVNode.nextDirtyChildIndex = (i + 1) % len;
|
|
5823
|
+
// setCursorPosition(container, cursorData, child);
|
|
5824
|
+
// return child;
|
|
5825
|
+
// }
|
|
5826
|
+
// }
|
|
5827
|
+
// // No dirty child found — clean up
|
|
5828
|
+
// currentVNode.dirty &= ~ChoreBits.CHILDREN;
|
|
5829
|
+
// currentVNode.dirtyChildren = null;
|
|
5784
5830
|
currentVNode.nextDirtyChildIndex = 0;
|
|
5785
5831
|
const next = getNextVNode(dirtyChildren[0], cursor);
|
|
5786
5832
|
setCursorPosition(container, cursorData, next);
|
|
5787
5833
|
return next;
|
|
5834
|
+
// return null;
|
|
5788
5835
|
}
|
|
5789
5836
|
/**
|
|
5790
5837
|
* Partitions dirtyChildren array so non-projections come first, projections last. Uses in-place
|
|
@@ -5813,14 +5860,14 @@ function getNextVNode(vNode, cursor) {
|
|
|
5813
5860
|
}
|
|
5814
5861
|
return null;
|
|
5815
5862
|
}
|
|
5816
|
-
// Prefer
|
|
5863
|
+
// Prefer slotParent (logical owner) for Projections, fall back to parent
|
|
5817
5864
|
let parent = null;
|
|
5818
|
-
if (vNode.
|
|
5819
|
-
parent = vNode.parent;
|
|
5820
|
-
}
|
|
5821
|
-
else if (vNode.slotParent && vNode.slotParent.dirty & 32 /* ChoreBits.CHILDREN */) {
|
|
5865
|
+
if (vNode.slotParent && vNode.slotParent.dirty & 32 /* ChoreBits.CHILDREN */) {
|
|
5822
5866
|
parent = vNode.slotParent;
|
|
5823
5867
|
}
|
|
5868
|
+
else if (vNode.parent && vNode.parent.dirty & 32 /* ChoreBits.CHILDREN */) {
|
|
5869
|
+
parent = vNode.parent;
|
|
5870
|
+
}
|
|
5824
5871
|
if (!parent) {
|
|
5825
5872
|
if (cursor.dirty & 127 /* ChoreBits.DIRTY_MASK */) {
|
|
5826
5873
|
return cursor;
|
|
@@ -5992,7 +6039,9 @@ function propagatePath(target) {
|
|
|
5992
6039
|
const parent = reusablePath[i + 1] || target;
|
|
5993
6040
|
parent.dirty |= 32 /* ChoreBits.CHILDREN */;
|
|
5994
6041
|
parent.dirtyChildren ||= [];
|
|
5995
|
-
parent.dirtyChildren.
|
|
6042
|
+
if (!parent.dirtyChildren.includes(child)) {
|
|
6043
|
+
parent.dirtyChildren.push(child);
|
|
6044
|
+
}
|
|
5996
6045
|
}
|
|
5997
6046
|
}
|
|
5998
6047
|
/**
|
|
@@ -6001,7 +6050,7 @@ function propagatePath(target) {
|
|
|
6001
6050
|
*/
|
|
6002
6051
|
function propagateToCursorRoot(vNode, cursorRoot) {
|
|
6003
6052
|
reusablePath.push(vNode);
|
|
6004
|
-
let current = vNode.
|
|
6053
|
+
let current = vNode.slotParent || vNode.parent;
|
|
6005
6054
|
while (current) {
|
|
6006
6055
|
const isDirty = current.dirty & 127 /* ChoreBits.DIRTY_MASK */;
|
|
6007
6056
|
const currentIsCursor = isCursor(current);
|
|
@@ -6026,7 +6075,7 @@ function propagateToCursorRoot(vNode, cursorRoot) {
|
|
|
6026
6075
|
}
|
|
6027
6076
|
}
|
|
6028
6077
|
reusablePath.push(current);
|
|
6029
|
-
current = current.
|
|
6078
|
+
current = current.slotParent || current.parent;
|
|
6030
6079
|
}
|
|
6031
6080
|
reusablePath.length = 0;
|
|
6032
6081
|
throwErrorAndStop('Cursor root not found in current path!');
|
|
@@ -6037,7 +6086,7 @@ function propagateToCursorRoot(vNode, cursorRoot) {
|
|
|
6037
6086
|
*/
|
|
6038
6087
|
function findAndPropagateToBlockingCursor(vNode) {
|
|
6039
6088
|
reusablePath.push(vNode);
|
|
6040
|
-
let current = vNode.
|
|
6089
|
+
let current = vNode.slotParent || vNode.parent;
|
|
6041
6090
|
while (current) {
|
|
6042
6091
|
const currentIsCursor = isCursor(current);
|
|
6043
6092
|
if (currentIsCursor) {
|
|
@@ -6046,7 +6095,7 @@ function findAndPropagateToBlockingCursor(vNode) {
|
|
|
6046
6095
|
return true;
|
|
6047
6096
|
}
|
|
6048
6097
|
reusablePath.push(current);
|
|
6049
|
-
current = current.
|
|
6098
|
+
current = current.slotParent || current.parent;
|
|
6050
6099
|
}
|
|
6051
6100
|
reusablePath.length = 0;
|
|
6052
6101
|
return false;
|
|
@@ -6080,7 +6129,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
6080
6129
|
if ((isRealDirty ? prevDirty & 127 /* ChoreBits.DIRTY_MASK */ : prevDirty) || vNode === cursorRoot) {
|
|
6081
6130
|
return;
|
|
6082
6131
|
}
|
|
6083
|
-
const parent = vNode.
|
|
6132
|
+
const parent = vNode.slotParent || vNode.parent;
|
|
6084
6133
|
// If cursorRoot is provided, propagate up to it
|
|
6085
6134
|
if (cursorRoot && isRealDirty && parent && !parent.dirty) {
|
|
6086
6135
|
propagateToCursorRoot(vNode, cursorRoot);
|
|
@@ -6092,7 +6141,9 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
6092
6141
|
parent.dirty |= 32 /* ChoreBits.CHILDREN */;
|
|
6093
6142
|
}
|
|
6094
6143
|
parent.dirtyChildren ||= [];
|
|
6095
|
-
parent.dirtyChildren.
|
|
6144
|
+
if (!parent.dirtyChildren.includes(vNode)) {
|
|
6145
|
+
parent.dirtyChildren.push(vNode);
|
|
6146
|
+
}
|
|
6096
6147
|
if (isRealDirty && vNode.dirtyChildren) {
|
|
6097
6148
|
// this node is maybe an ancestor of the current cursor position
|
|
6098
6149
|
// if so we must restart from here
|
|
@@ -6103,7 +6154,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
6103
6154
|
if (cursorPosition) {
|
|
6104
6155
|
// find the ancestor of the cursor position that is current vNode
|
|
6105
6156
|
while (cursorPosition !== cursor) {
|
|
6106
|
-
cursorPosition = cursorPosition.
|
|
6157
|
+
cursorPosition = cursorPosition.slotParent || cursorPosition.parent;
|
|
6107
6158
|
if (cursorPosition === vNode) {
|
|
6108
6159
|
// set cursor position to this node
|
|
6109
6160
|
cursorData.position = vNode;
|
|
@@ -6137,6 +6188,20 @@ const fastGetter = (prototype, name) => {
|
|
|
6137
6188
|
return this[name];
|
|
6138
6189
|
});
|
|
6139
6190
|
};
|
|
6191
|
+
/**
|
|
6192
|
+
* Creates a cached fast property accessor by pulling the native getter from the prototype chain.
|
|
6193
|
+
* The getter is resolved lazily on the first call and then reused, bypassing prototype lookups on
|
|
6194
|
+
* every subsequent access.
|
|
6195
|
+
*/
|
|
6196
|
+
const createFastGetter = (propName) => {
|
|
6197
|
+
let getter = null;
|
|
6198
|
+
return (node) => {
|
|
6199
|
+
if (!getter) {
|
|
6200
|
+
getter = fastGetter(node, propName);
|
|
6201
|
+
}
|
|
6202
|
+
return getter.call(node);
|
|
6203
|
+
};
|
|
6204
|
+
};
|
|
6140
6205
|
|
|
6141
6206
|
/**
|
|
6142
6207
|
* @file
|
|
@@ -6487,7 +6552,7 @@ function vnode_walkVNode(vNode, callback) {
|
|
|
6487
6552
|
let vCursor = vNode;
|
|
6488
6553
|
// Depth first traversal
|
|
6489
6554
|
if (vnode_isTextVNode(vNode)) {
|
|
6490
|
-
|
|
6555
|
+
callback?.(vNode, null);
|
|
6491
6556
|
return;
|
|
6492
6557
|
}
|
|
6493
6558
|
let vParent = null;
|
|
@@ -6635,11 +6700,6 @@ const vnode_getDomSibling = (vNode, nextDirection, descend) => {
|
|
|
6635
6700
|
}
|
|
6636
6701
|
return null;
|
|
6637
6702
|
};
|
|
6638
|
-
const vnode_ensureInflatedIfText = (journal, vNode) => {
|
|
6639
|
-
if (vnode_isTextVNode(vNode)) {
|
|
6640
|
-
vnode_ensureTextInflated(journal, vNode);
|
|
6641
|
-
}
|
|
6642
|
-
};
|
|
6643
6703
|
const vnode_ensureTextInflated = (journal, vnode) => {
|
|
6644
6704
|
const textVNode = ensureTextVNode(vnode);
|
|
6645
6705
|
const flags = textVNode.flags;
|
|
@@ -6965,7 +7025,9 @@ const vnode_findInsertBefore = (journal, parent, insertBefore) => {
|
|
|
6965
7025
|
else {
|
|
6966
7026
|
adjustedInsertBefore = insertBefore;
|
|
6967
7027
|
}
|
|
6968
|
-
adjustedInsertBefore &&
|
|
7028
|
+
adjustedInsertBefore &&
|
|
7029
|
+
vnode_isTextVNode(adjustedInsertBefore) &&
|
|
7030
|
+
vnode_ensureTextInflated(journal, adjustedInsertBefore);
|
|
6969
7031
|
return adjustedInsertBefore;
|
|
6970
7032
|
};
|
|
6971
7033
|
const vnode_connectSiblings = (parent, vNode, vNext) => {
|
|
@@ -7029,6 +7091,45 @@ const vnode_unlinkFromOldParent = (journal, currentParent, newParent, newChild)
|
|
|
7029
7091
|
vnode_remove(journal, currentParent, newChild, false);
|
|
7030
7092
|
}
|
|
7031
7093
|
};
|
|
7094
|
+
/**
|
|
7095
|
+
* When a projection vnode is about to be repositioned (moved in the vnode tree), its trailing text
|
|
7096
|
+
* node must be inflated before the projection is unlinked from its current sibling chain.
|
|
7097
|
+
* `vnode_ensureTextInflated` relies on `vnode_getDomSibling` to locate adjacent text nodes and
|
|
7098
|
+
* decide which one is "last" (i.e. the one that gets to reuse the shared SSR DOM `Text` node). Once
|
|
7099
|
+
* the projection is unlinked, its `nextSibling` becomes `null`, so `getDomSibling` can no longer
|
|
7100
|
+
* cross the boundary to find a trailing sibling such as an empty-string text node — causing
|
|
7101
|
+
* `isLastNode` to be `true` prematurely and corrupting the shared DOM text node. Inflating the
|
|
7102
|
+
* trailing text node while the siblings are still connected gives it its own fresh DOM node and
|
|
7103
|
+
* avoids the corruption.
|
|
7104
|
+
*
|
|
7105
|
+
* Example:
|
|
7106
|
+
*
|
|
7107
|
+
* ```
|
|
7108
|
+
* <Component>
|
|
7109
|
+
* <button>
|
|
7110
|
+
* <InlineComponent>
|
|
7111
|
+
* <span>
|
|
7112
|
+
* "*"
|
|
7113
|
+
* </span>
|
|
7114
|
+
* </InlineComponent>
|
|
7115
|
+
* <Projection> // <-- this projection when unlinked from the siblings will cause the "test" text node to be considered the last node without inflating it
|
|
7116
|
+
* "test" // <-- this text node is sharing the same DOM node with the ""
|
|
7117
|
+
* </Projection>
|
|
7118
|
+
* "" <-- this text node is sharing the same DOM node with the "test"
|
|
7119
|
+
* </button>
|
|
7120
|
+
* </Component>
|
|
7121
|
+
* ```
|
|
7122
|
+
*/
|
|
7123
|
+
const vnode_inflateProjectionTrailingText = (journal, projection) => {
|
|
7124
|
+
// Follow lastChild through any inner virtual wrappers to reach the actual trailing text node.
|
|
7125
|
+
let last = projection;
|
|
7126
|
+
while (last && vnode_isVirtualVNode(last)) {
|
|
7127
|
+
last = last.lastChild;
|
|
7128
|
+
}
|
|
7129
|
+
if (last && vnode_isTextVNode(last) && (last.flags & 8 /* VNodeFlags.Inflated */) === 0) {
|
|
7130
|
+
vnode_ensureTextInflated(journal, last);
|
|
7131
|
+
}
|
|
7132
|
+
};
|
|
7032
7133
|
const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
|
|
7033
7134
|
if (vnode_isElementOrTextVNode(newChild)) {
|
|
7034
7135
|
vnode_insertElementBefore(journal, parent, newChild, insertBefore);
|
|
@@ -7219,13 +7320,7 @@ const fastGetAttribute = (element, key) => {
|
|
|
7219
7320
|
}
|
|
7220
7321
|
return _fastGetAttribute.call(element, key);
|
|
7221
7322
|
};
|
|
7222
|
-
|
|
7223
|
-
const fastNodeType = (node) => {
|
|
7224
|
-
if (!_fastNodeType) {
|
|
7225
|
-
_fastNodeType = fastGetter(node, 'nodeType');
|
|
7226
|
-
}
|
|
7227
|
-
return _fastNodeType.call(node);
|
|
7228
|
-
};
|
|
7323
|
+
const fastNodeType = createFastGetter('nodeType');
|
|
7229
7324
|
const fastIsTextOrElement = (node) => {
|
|
7230
7325
|
const type = fastNodeType(node);
|
|
7231
7326
|
return type === /* Node.TEXT_NODE */ 3 || type === /* Node.ELEMENT_NODE */ 1;
|
|
@@ -7286,13 +7381,7 @@ function getNodeAfterCommentNode(node, commentValue, nextSibling, firstChild) {
|
|
|
7286
7381
|
}
|
|
7287
7382
|
return null;
|
|
7288
7383
|
}
|
|
7289
|
-
|
|
7290
|
-
const fastParentNode = (node) => {
|
|
7291
|
-
if (!_fastParentNode) {
|
|
7292
|
-
_fastParentNode = fastGetter(node, 'parentNode');
|
|
7293
|
-
}
|
|
7294
|
-
return _fastParentNode.call(node);
|
|
7295
|
-
};
|
|
7384
|
+
const fastParentNode = createFastGetter('parentNode');
|
|
7296
7385
|
let _fastFirstChild = null;
|
|
7297
7386
|
const fastFirstChild = (node) => {
|
|
7298
7387
|
if (!_fastFirstChild) {
|
|
@@ -7304,34 +7393,9 @@ const fastFirstChild = (node) => {
|
|
|
7304
7393
|
}
|
|
7305
7394
|
return node;
|
|
7306
7395
|
};
|
|
7307
|
-
|
|
7308
|
-
const
|
|
7309
|
-
|
|
7310
|
-
_fastNamespaceURI = fastGetter(element, 'namespaceURI');
|
|
7311
|
-
}
|
|
7312
|
-
return _fastNamespaceURI.call(element);
|
|
7313
|
-
};
|
|
7314
|
-
let _fastNodeName = null;
|
|
7315
|
-
const fastNodeName = (element) => {
|
|
7316
|
-
if (!_fastNodeName) {
|
|
7317
|
-
_fastNodeName = fastGetter(element, 'nodeName');
|
|
7318
|
-
}
|
|
7319
|
-
return _fastNodeName.call(element);
|
|
7320
|
-
};
|
|
7321
|
-
let _fastOwnerDocument = null;
|
|
7322
|
-
const fastOwnerDocument = (node) => {
|
|
7323
|
-
if (!_fastOwnerDocument) {
|
|
7324
|
-
_fastOwnerDocument = fastGetter(node, 'ownerDocument');
|
|
7325
|
-
}
|
|
7326
|
-
return _fastOwnerDocument.call(node);
|
|
7327
|
-
};
|
|
7328
|
-
const hasQStyleAttribute = (element) => {
|
|
7329
|
-
return (element.nodeName === 'STYLE' &&
|
|
7330
|
-
(element.hasAttribute(QScopedStyle) || element.hasAttribute(QStyle)));
|
|
7331
|
-
};
|
|
7332
|
-
const hasPropsSeparator = (element) => {
|
|
7333
|
-
return element.hasAttribute(Q_PROPS_SEPARATOR);
|
|
7334
|
-
};
|
|
7396
|
+
const fastNamespaceURI = createFastGetter('namespaceURI');
|
|
7397
|
+
const fastNodeName = createFastGetter('nodeName');
|
|
7398
|
+
const fastOwnerDocument = createFastGetter('ownerDocument');
|
|
7335
7399
|
const materializeFromDOM = (vParent, firstChild, vData) => {
|
|
7336
7400
|
let vFirstChild = null;
|
|
7337
7401
|
const skipElements = () => {
|
|
@@ -7600,11 +7664,12 @@ const isLowercase = (ch) => /* `a` */ 97 <= ch && ch <= 122; /* `z` */
|
|
|
7600
7664
|
function shouldSkipElement(element) {
|
|
7601
7665
|
return (
|
|
7602
7666
|
// Skip over elements that don't have a props separator. They are not rendered by Qwik.
|
|
7603
|
-
!
|
|
7667
|
+
!element.hasAttribute(Q_PROPS_SEPARATOR) ||
|
|
7604
7668
|
// We pretend that style element's don't exist as they can get moved out.
|
|
7605
7669
|
// skip over style elements, as those need to be moved to the head
|
|
7606
7670
|
// and are not included in the counts.
|
|
7607
|
-
|
|
7671
|
+
(element.nodeName === 'STYLE' &&
|
|
7672
|
+
(element.hasAttribute(QScopedStyle) || element.hasAttribute(QStyle))));
|
|
7608
7673
|
}
|
|
7609
7674
|
const stack = [];
|
|
7610
7675
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
@@ -8572,7 +8637,7 @@ const allocate = (container, typeId, value) => {
|
|
|
8572
8637
|
case 28 /* TypeIds.FormData */:
|
|
8573
8638
|
return new FormData();
|
|
8574
8639
|
case 29 /* TypeIds.JSXNode */:
|
|
8575
|
-
return new JSXNodeImpl(null, null, null, null, null);
|
|
8640
|
+
return new JSXNodeImpl(null, null, null, null, 0, null);
|
|
8576
8641
|
case 12 /* TypeIds.BigInt */:
|
|
8577
8642
|
return BigInt(value);
|
|
8578
8643
|
case 17 /* TypeIds.Set */:
|
|
@@ -8785,13 +8850,13 @@ const _fnSignal = (fn, args, fnStr) => {
|
|
|
8785
8850
|
*/
|
|
8786
8851
|
class Serializer {
|
|
8787
8852
|
$serializationContext$;
|
|
8788
|
-
rootIdx = 0;
|
|
8789
|
-
forwardRefs = [];
|
|
8790
|
-
forwardRefsId = 0;
|
|
8791
|
-
promises = new Set();
|
|
8792
|
-
s11nWeakRefs = new Map();
|
|
8793
|
-
parent
|
|
8794
|
-
qrlMap = new Map();
|
|
8853
|
+
$rootIdx$ = 0;
|
|
8854
|
+
$forwardRefs$ = [];
|
|
8855
|
+
$forwardRefsId$ = 0;
|
|
8856
|
+
$promises$ = new Set();
|
|
8857
|
+
$s11nWeakRefs$ = new Map();
|
|
8858
|
+
$parent$;
|
|
8859
|
+
$qrlMap$ = new Map();
|
|
8795
8860
|
$writer$;
|
|
8796
8861
|
constructor($serializationContext$) {
|
|
8797
8862
|
this.$serializationContext$ = $serializationContext$;
|
|
@@ -8862,7 +8927,7 @@ class Serializer {
|
|
|
8862
8927
|
}
|
|
8863
8928
|
getSeenRefOrOutput(value, index, keepWeak) {
|
|
8864
8929
|
let seen = this.$serializationContext$.getSeenRef(value);
|
|
8865
|
-
const forwardRefIdx = !keepWeak && this
|
|
8930
|
+
const forwardRefIdx = !keepWeak && this.$s11nWeakRefs$.get(value);
|
|
8866
8931
|
if (!seen) {
|
|
8867
8932
|
if (keepWeak) {
|
|
8868
8933
|
// we're testing a weakref, so don't mark it as seen yet
|
|
@@ -8874,14 +8939,14 @@ class Serializer {
|
|
|
8874
8939
|
seen = this.$serializationContext$.$addRoot$(value, true);
|
|
8875
8940
|
}
|
|
8876
8941
|
else {
|
|
8877
|
-
return this.$serializationContext$.$markSeen$(value, this
|
|
8942
|
+
return this.$serializationContext$.$markSeen$(value, this.$parent$, index);
|
|
8878
8943
|
}
|
|
8879
8944
|
}
|
|
8880
8945
|
// Now that we saw it a second time, make sure it's a root
|
|
8881
8946
|
if (seen.$parent$) {
|
|
8882
8947
|
// Note, this means it was output before so we always need a backref
|
|
8883
8948
|
// Special case: we're a root so instead of adding a backref, we replace ourself
|
|
8884
|
-
if (!this
|
|
8949
|
+
if (!this.$parent$) {
|
|
8885
8950
|
this.$serializationContext$.$promoteToRoot$(seen, index);
|
|
8886
8951
|
value = this.$serializationContext$.$roots$[index];
|
|
8887
8952
|
}
|
|
@@ -8891,13 +8956,13 @@ class Serializer {
|
|
|
8891
8956
|
}
|
|
8892
8957
|
// Check if there was a weakref to us
|
|
8893
8958
|
if (typeof forwardRefIdx === 'number') {
|
|
8894
|
-
this
|
|
8895
|
-
this
|
|
8959
|
+
this.$forwardRefs$[forwardRefIdx] = seen.$index$;
|
|
8960
|
+
this.$s11nWeakRefs$.delete(value);
|
|
8896
8961
|
}
|
|
8897
8962
|
// Now we know it's a root and we should output a RootRef
|
|
8898
8963
|
const rootIdx = value instanceof SerializationBackRef ? value.$path$ : seen.$index$;
|
|
8899
8964
|
// But make sure we do output ourselves
|
|
8900
|
-
if (!this
|
|
8965
|
+
if (!this.$parent$ && rootIdx === index) {
|
|
8901
8966
|
return seen;
|
|
8902
8967
|
}
|
|
8903
8968
|
this.output(1 /* TypeIds.RootRef */, rootIdx);
|
|
@@ -8979,7 +9044,7 @@ class Serializer {
|
|
|
8979
9044
|
// not a sync QRL, replace all parts with string references
|
|
8980
9045
|
data = `${this.$serializationContext$.$addRoot$(chunk)}#${this.$serializationContext$.$addRoot$(symbol)}${captures ? '#' + captures : ''}`;
|
|
8981
9046
|
// Since we map QRLs to strings, we need to keep track of this secondary mapping
|
|
8982
|
-
const existing = this
|
|
9047
|
+
const existing = this.$qrlMap$.get(data);
|
|
8983
9048
|
if (existing) {
|
|
8984
9049
|
// We encountered the same QRL again, make it a root
|
|
8985
9050
|
const ref = this.$serializationContext$.$addRoot$(existing);
|
|
@@ -8987,7 +9052,7 @@ class Serializer {
|
|
|
8987
9052
|
return;
|
|
8988
9053
|
}
|
|
8989
9054
|
else {
|
|
8990
|
-
this
|
|
9055
|
+
this.$qrlMap$.set(data, value);
|
|
8991
9056
|
}
|
|
8992
9057
|
}
|
|
8993
9058
|
else {
|
|
@@ -9022,11 +9087,11 @@ class Serializer {
|
|
|
9022
9087
|
else {
|
|
9023
9088
|
const newSeenRef = this.getSeenRefOrOutput(value, index);
|
|
9024
9089
|
if (newSeenRef) {
|
|
9025
|
-
const oldParent = this
|
|
9026
|
-
this
|
|
9090
|
+
const oldParent = this.$parent$;
|
|
9091
|
+
this.$parent$ = newSeenRef;
|
|
9027
9092
|
// separate function for readability
|
|
9028
9093
|
this.writeObjectValue(value);
|
|
9029
|
-
this
|
|
9094
|
+
this.$parent$ = oldParent;
|
|
9030
9095
|
}
|
|
9031
9096
|
}
|
|
9032
9097
|
break;
|
|
@@ -9084,8 +9149,8 @@ class Serializer {
|
|
|
9084
9149
|
}
|
|
9085
9150
|
else {
|
|
9086
9151
|
// We replace ourselves with this value
|
|
9087
|
-
const index = this
|
|
9088
|
-
this
|
|
9152
|
+
const index = this.$parent$.$index$;
|
|
9153
|
+
this.$parent$ = this.$parent$.$parent$;
|
|
9089
9154
|
this.writeValue(result, index);
|
|
9090
9155
|
}
|
|
9091
9156
|
}
|
|
@@ -9300,8 +9365,8 @@ class Serializer {
|
|
|
9300
9365
|
}
|
|
9301
9366
|
else if (value.$resolved$) {
|
|
9302
9367
|
// We replace ourselves with this value
|
|
9303
|
-
const index = this
|
|
9304
|
-
this
|
|
9368
|
+
const index = this.$parent$.$index$;
|
|
9369
|
+
this.$parent$ = this.$parent$.$parent$;
|
|
9305
9370
|
this.writeValue(value.$value$, index);
|
|
9306
9371
|
}
|
|
9307
9372
|
else {
|
|
@@ -9325,12 +9390,12 @@ class Serializer {
|
|
|
9325
9390
|
else if (value instanceof SerializationWeakRef) {
|
|
9326
9391
|
const obj = value.$obj$;
|
|
9327
9392
|
// This will return a fake SeenRef if it's not been seen before
|
|
9328
|
-
if (this.getSeenRefOrOutput(obj, this
|
|
9329
|
-
let forwardRefId = this
|
|
9393
|
+
if (this.getSeenRefOrOutput(obj, this.$parent$.$index$, true)) {
|
|
9394
|
+
let forwardRefId = this.$s11nWeakRefs$.get(obj);
|
|
9330
9395
|
if (forwardRefId === undefined) {
|
|
9331
|
-
forwardRefId = this
|
|
9332
|
-
this
|
|
9333
|
-
this
|
|
9396
|
+
forwardRefId = this.$forwardRefsId$++;
|
|
9397
|
+
this.$s11nWeakRefs$.set(obj, forwardRefId);
|
|
9398
|
+
this.$forwardRefs$[forwardRefId] = -1;
|
|
9334
9399
|
}
|
|
9335
9400
|
this.output(2 /* TypeIds.ForwardRef */, forwardRefId);
|
|
9336
9401
|
}
|
|
@@ -9343,56 +9408,56 @@ class Serializer {
|
|
|
9343
9408
|
}
|
|
9344
9409
|
}
|
|
9345
9410
|
resolvePromise(promise, classCreator) {
|
|
9346
|
-
const forwardRefId = this
|
|
9411
|
+
const forwardRefId = this.$forwardRefsId$++;
|
|
9347
9412
|
promise
|
|
9348
9413
|
.then((resolvedValue) => {
|
|
9349
|
-
this
|
|
9350
|
-
this
|
|
9414
|
+
this.$promises$.delete(promise);
|
|
9415
|
+
this.$forwardRefs$[forwardRefId] = this.$serializationContext$.$addRoot$(classCreator(true, resolvedValue));
|
|
9351
9416
|
})
|
|
9352
9417
|
.catch((err) => {
|
|
9353
|
-
this
|
|
9354
|
-
this
|
|
9418
|
+
this.$promises$.delete(promise);
|
|
9419
|
+
this.$forwardRefs$[forwardRefId] = this.$serializationContext$.$addRoot$(classCreator(false, err));
|
|
9355
9420
|
});
|
|
9356
|
-
this
|
|
9421
|
+
this.$promises$.add(promise);
|
|
9357
9422
|
return forwardRefId;
|
|
9358
9423
|
}
|
|
9359
9424
|
async outputRoots() {
|
|
9360
9425
|
this.$writer$.write(BRACKET_OPEN);
|
|
9361
9426
|
const { $roots$ } = this.$serializationContext$;
|
|
9362
|
-
while (this
|
|
9363
|
-
if (this
|
|
9427
|
+
while (this.$rootIdx$ < $roots$.length || this.$promises$.size) {
|
|
9428
|
+
if (this.$rootIdx$ !== 0) {
|
|
9364
9429
|
this.$writer$.write(COMMA);
|
|
9365
9430
|
}
|
|
9366
9431
|
let separator = false;
|
|
9367
|
-
for (; this
|
|
9432
|
+
for (; this.$rootIdx$ < $roots$.length; this.$rootIdx$++) {
|
|
9368
9433
|
if (separator) {
|
|
9369
9434
|
this.$writer$.write(COMMA);
|
|
9370
9435
|
}
|
|
9371
9436
|
else {
|
|
9372
9437
|
separator = true;
|
|
9373
9438
|
}
|
|
9374
|
-
this.writeValue($roots$[this
|
|
9439
|
+
this.writeValue($roots$[this.$rootIdx$], this.$rootIdx$);
|
|
9375
9440
|
}
|
|
9376
|
-
if (this
|
|
9441
|
+
if (this.$promises$.size) {
|
|
9377
9442
|
try {
|
|
9378
|
-
await Promise.race(this
|
|
9443
|
+
await Promise.race(this.$promises$);
|
|
9379
9444
|
}
|
|
9380
9445
|
catch {
|
|
9381
9446
|
// ignore rejections, they will be serialized as rejected promises
|
|
9382
9447
|
}
|
|
9383
9448
|
}
|
|
9384
9449
|
}
|
|
9385
|
-
if (this
|
|
9386
|
-
let lastIdx = this
|
|
9387
|
-
while (lastIdx >= 0 && this
|
|
9450
|
+
if (this.$forwardRefs$.length) {
|
|
9451
|
+
let lastIdx = this.$forwardRefs$.length - 1;
|
|
9452
|
+
while (lastIdx >= 0 && this.$forwardRefs$[lastIdx] === -1) {
|
|
9388
9453
|
lastIdx--;
|
|
9389
9454
|
}
|
|
9390
9455
|
if (lastIdx >= 0) {
|
|
9391
9456
|
this.$writer$.write(COMMA);
|
|
9392
9457
|
this.$writer$.write(14 /* TypeIds.ForwardRefs */ + COMMA);
|
|
9393
|
-
const out = lastIdx === this
|
|
9394
|
-
? this
|
|
9395
|
-
: this
|
|
9458
|
+
const out = lastIdx === this.$forwardRefs$.length - 1
|
|
9459
|
+
? this.$forwardRefs$
|
|
9460
|
+
: this.$forwardRefs$.slice(0, lastIdx + 1);
|
|
9396
9461
|
// We could also implement RLE of -1 values
|
|
9397
9462
|
this.outputArray(out, true, (value) => {
|
|
9398
9463
|
this.$writer$.write(String(value));
|
|
@@ -9807,7 +9872,7 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
9807
9872
|
appendQwikInspectorAttribute(jsx, qwikInspectorAttrValue);
|
|
9808
9873
|
}
|
|
9809
9874
|
}
|
|
9810
|
-
const innerHTML = ssr.openElement(type, jsx.key, jsx.varProps, jsx.constProps, options.currentStyleScoped, qwikInspectorAttrValue);
|
|
9875
|
+
const innerHTML = ssr.openElement(type, jsx.key, jsx.varProps, jsx.constProps, options.currentStyleScoped, qwikInspectorAttrValue, !!(jsx.flags & 4 /* JSXNodeFlags.HasCapturedProps */));
|
|
9811
9876
|
if (innerHTML) {
|
|
9812
9877
|
ssr.htmlNode(innerHTML);
|
|
9813
9878
|
}
|
|
@@ -10120,7 +10185,7 @@ const isResourceReturn = (obj) => {
|
|
|
10120
10185
|
};
|
|
10121
10186
|
|
|
10122
10187
|
/** @internal */
|
|
10123
|
-
function setEvent(serializationCtx, key, rawValue,
|
|
10188
|
+
function setEvent(serializationCtx, key, rawValue, hasMovedCaptures) {
|
|
10124
10189
|
let value = null;
|
|
10125
10190
|
const qrls = rawValue;
|
|
10126
10191
|
const appendToValue = (valueToAppend) => {
|
|
@@ -10133,7 +10198,7 @@ function setEvent(serializationCtx, key, rawValue, isLoopElement) {
|
|
|
10133
10198
|
*
|
|
10134
10199
|
* For internal qrls (starting with `_`) we assume that they do the right thing.
|
|
10135
10200
|
*/
|
|
10136
|
-
if (!qrl.$symbol$.startsWith('_') && (qrl.$captures$?.length ||
|
|
10201
|
+
if (!qrl.$symbol$.startsWith('_') && (qrl.$captures$?.length || hasMovedCaptures)) {
|
|
10137
10202
|
qrl = createQRL(null, '_run', _run, null, [qrl]);
|
|
10138
10203
|
}
|
|
10139
10204
|
return qrlToString(serializationCtx, qrl);
|
|
@@ -10147,7 +10212,7 @@ function setEvent(serializationCtx, key, rawValue, isLoopElement) {
|
|
|
10147
10212
|
}
|
|
10148
10213
|
else if (qrl != null) {
|
|
10149
10214
|
// nested arrays etc.
|
|
10150
|
-
const nestedValue = setEvent(serializationCtx, key, qrl,
|
|
10215
|
+
const nestedValue = setEvent(serializationCtx, key, qrl, hasMovedCaptures);
|
|
10151
10216
|
if (nestedValue) {
|
|
10152
10217
|
appendToValue(nestedValue);
|
|
10153
10218
|
}
|
|
@@ -10377,7 +10442,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10377
10442
|
const d = data;
|
|
10378
10443
|
let owner = d[0];
|
|
10379
10444
|
if (owner === _UNINITIALIZED) {
|
|
10380
|
-
owner = new JSXNodeImpl(Fragment, d[1], d[2], null, null);
|
|
10445
|
+
owner = new JSXNodeImpl(Fragment, d[1], d[2], null, 0, null);
|
|
10381
10446
|
owner._proxy = propsProxy;
|
|
10382
10447
|
}
|
|
10383
10448
|
propsProxy[_OWNER] = owner;
|
|
@@ -10910,12 +10975,12 @@ class DomContainer extends _SharedContainer {
|
|
|
10910
10975
|
qManifestHash;
|
|
10911
10976
|
rootVNode;
|
|
10912
10977
|
document;
|
|
10913
|
-
$rawStateData$;
|
|
10914
10978
|
$storeProxyMap$ = new WeakMap();
|
|
10915
10979
|
$qFuncs$;
|
|
10916
10980
|
$instanceHash$;
|
|
10917
10981
|
$forwardRefs$ = null;
|
|
10918
10982
|
vNodeLocate = (id) => vnode_locate(this.rootVNode, id);
|
|
10983
|
+
$rawStateData$;
|
|
10919
10984
|
$stateData$;
|
|
10920
10985
|
$styleIds$ = null;
|
|
10921
10986
|
constructor(element) {
|