@qwik.dev/core 2.0.0-alpha.4 → 2.0.0-alpha.6
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.darwin-x64.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/build/package.json +1 -1
- package/dist/cli.cjs +2 -23
- package/dist/core-internal.d.ts +3 -3
- package/dist/core.cjs +446 -278
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +446 -278
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +406 -308
- package/dist/core.prod.mjs +493 -386
- package/dist/insights/index.qwik.cjs +8 -8
- package/dist/insights/index.qwik.mjs +8 -8
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +306 -189
- package/dist/optimizer.mjs +362 -239
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +396 -254
- package/dist/server.mjs +395 -253
- package/dist/starters/features/turso/src/utils/turso.ts +1 -1
- package/dist/testing/index.cjs +394 -252
- package/dist/testing/index.mjs +393 -251
- package/dist/testing/package.json +1 -1
- package/package.json +3 -3
package/dist/core.prod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core 2.0.0-alpha.6-dev+d848ba5
|
|
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
|
|
@@ -64,15 +64,41 @@
|
|
|
64
64
|
QError[QError.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError[QError.wrongTextareaValue = 40] = "wrongTextareaValue",
|
|
65
65
|
QError[QError.containerNotFound = 41] = "containerNotFound", QError[QError.elementWithoutContainer = 42] = "elementWithoutContainer",
|
|
66
66
|
QError[QError.invalidVNodeType = 43] = "invalidVNodeType", QError[QError.materializeVNodeDataError = 44] = "materializeVNodeDataError",
|
|
67
|
-
QError[QError.
|
|
68
|
-
QError[QError.
|
|
69
|
-
QError[QError.
|
|
70
|
-
QError[QError.unsafeAttr = 51] = "unsafeAttr";
|
|
67
|
+
QError[QError.cannotCoerceSignal = 45] = "cannotCoerceSignal", QError[QError.computedNotSync = 46] = "computedNotSync",
|
|
68
|
+
QError[QError.computedReadOnly = 47] = "computedReadOnly", QError[QError.wrappedReadOnly = 48] = "wrappedReadOnly",
|
|
69
|
+
QError[QError.promisesNotExpected = 49] = "promisesNotExpected", QError[QError.unsafeAttr = 50] = "unsafeAttr";
|
|
71
70
|
}(QError || (QError = {}));
|
|
72
71
|
const qError = (code, errorMessageArgs = []) => {
|
|
73
72
|
const text = (code => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`)(code, ...errorMessageArgs);
|
|
74
73
|
return ((message, ...optionalParams) => createAndLogError(!0, message, ...optionalParams))(text, ...errorMessageArgs);
|
|
75
74
|
};
|
|
75
|
+
var VirtualType;
|
|
76
|
+
!function(VirtualType) {
|
|
77
|
+
VirtualType.Virtual = "V", VirtualType.Fragment = "F", VirtualType.WrappedSignal = "S",
|
|
78
|
+
VirtualType.Awaited = "A", VirtualType.Component = "C", VirtualType.InlineComponent = "I",
|
|
79
|
+
VirtualType.Projection = "P";
|
|
80
|
+
}(VirtualType || (VirtualType = {}));
|
|
81
|
+
const VirtualTypeName = {
|
|
82
|
+
[VirtualType.Virtual]: "[34mVirtual[0m",
|
|
83
|
+
[VirtualType.Fragment]: "[34mFragment[0m",
|
|
84
|
+
[VirtualType.WrappedSignal]: "[34mSignal[0m",
|
|
85
|
+
[VirtualType.Awaited]: "[34mAwaited[0m",
|
|
86
|
+
[VirtualType.Component]: "[34mComponent[0m",
|
|
87
|
+
[VirtualType.InlineComponent]: "[34mInlineComponent[0m",
|
|
88
|
+
[VirtualType.Projection]: "[34mProjection[0m"
|
|
89
|
+
};
|
|
90
|
+
var QContainerValue;
|
|
91
|
+
!function(QContainerValue) {
|
|
92
|
+
QContainerValue.PAUSED = "paused", QContainerValue.RESUMED = "resumed", QContainerValue.HTML = "html",
|
|
93
|
+
QContainerValue.TEXT = "text";
|
|
94
|
+
}(QContainerValue || (QContainerValue = {}));
|
|
95
|
+
const QSlot = "q:slot";
|
|
96
|
+
const QSlotS = "q:s";
|
|
97
|
+
const getQFuncs = (document, hash) => document["qFuncs_" + hash] || [];
|
|
98
|
+
const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
|
|
99
|
+
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
100
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
101
|
+
const MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
76
102
|
const createPlatform = () => ({
|
|
77
103
|
isServer: build.isServer,
|
|
78
104
|
importSymbol(containerEl, url, symbolName) {
|
|
@@ -133,13 +159,17 @@
|
|
|
133
159
|
setTimeout(resolve, timeout);
|
|
134
160
|
}));
|
|
135
161
|
function retryOnPromise(fn, retryCount = 0) {
|
|
136
|
-
|
|
137
|
-
return fn();
|
|
138
|
-
} catch (e) {
|
|
162
|
+
const retryOrThrow = e => {
|
|
139
163
|
if (isPromise(e) && retryCount < 100) {
|
|
140
164
|
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
141
165
|
}
|
|
142
166
|
throw e;
|
|
167
|
+
};
|
|
168
|
+
try {
|
|
169
|
+
const result = fn();
|
|
170
|
+
return isPromise(result) ? result.catch((e => retryOrThrow(e))) : result;
|
|
171
|
+
} catch (e) {
|
|
172
|
+
return retryOrThrow(e);
|
|
143
173
|
}
|
|
144
174
|
}
|
|
145
175
|
const isSerializableObject = v => {
|
|
@@ -151,39 +181,12 @@
|
|
|
151
181
|
const isString = v => "string" == typeof v;
|
|
152
182
|
const isFunction = v => "function" == typeof v;
|
|
153
183
|
var VNodeDataFlag;
|
|
184
|
+
let _locale;
|
|
154
185
|
!function(VNodeDataFlag) {
|
|
155
186
|
VNodeDataFlag[VNodeDataFlag.NONE = 0] = "NONE", VNodeDataFlag[VNodeDataFlag.TEXT_DATA = 1] = "TEXT_DATA",
|
|
156
187
|
VNodeDataFlag[VNodeDataFlag.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag[VNodeDataFlag.ELEMENT_NODE = 4] = "ELEMENT_NODE",
|
|
157
188
|
VNodeDataFlag[VNodeDataFlag.REFERENCE = 8] = "REFERENCE", VNodeDataFlag[VNodeDataFlag.SERIALIZE = 16] = "SERIALIZE";
|
|
158
189
|
}(VNodeDataFlag || (VNodeDataFlag = {}));
|
|
159
|
-
var VirtualType;
|
|
160
|
-
!function(VirtualType) {
|
|
161
|
-
VirtualType.Virtual = "V", VirtualType.Fragment = "F", VirtualType.WrappedSignal = "S",
|
|
162
|
-
VirtualType.Awaited = "A", VirtualType.Component = "C", VirtualType.InlineComponent = "I",
|
|
163
|
-
VirtualType.Projection = "P";
|
|
164
|
-
}(VirtualType || (VirtualType = {}));
|
|
165
|
-
const VirtualTypeName = {
|
|
166
|
-
[VirtualType.Virtual]: "[34mVirtual[0m",
|
|
167
|
-
[VirtualType.Fragment]: "[34mFragment[0m",
|
|
168
|
-
[VirtualType.WrappedSignal]: "[34mSignal[0m",
|
|
169
|
-
[VirtualType.Awaited]: "[34mAwaited[0m",
|
|
170
|
-
[VirtualType.Component]: "[34mComponent[0m",
|
|
171
|
-
[VirtualType.InlineComponent]: "[34mInlineComponent[0m",
|
|
172
|
-
[VirtualType.Projection]: "[34mProjection[0m"
|
|
173
|
-
};
|
|
174
|
-
var QContainerValue;
|
|
175
|
-
!function(QContainerValue) {
|
|
176
|
-
QContainerValue.PAUSED = "paused", QContainerValue.RESUMED = "resumed", QContainerValue.HTML = "html",
|
|
177
|
-
QContainerValue.TEXT = "text";
|
|
178
|
-
}(QContainerValue || (QContainerValue = {}));
|
|
179
|
-
const QSlot = "q:slot";
|
|
180
|
-
const QSlotS = "q:s";
|
|
181
|
-
const getQFuncs = (document, hash) => document["qFuncs_" + hash] || [];
|
|
182
|
-
const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
|
|
183
|
-
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
184
|
-
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
185
|
-
const MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
186
|
-
let _locale;
|
|
187
190
|
const EMPTY_ARRAY = [];
|
|
188
191
|
const EMPTY_OBJ = {};
|
|
189
192
|
Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
|
|
@@ -418,7 +421,7 @@
|
|
|
418
421
|
return this.$flags$ & StoreFlags.RECURSIVE && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
|
|
419
422
|
}
|
|
420
423
|
set(target, prop, value) {
|
|
421
|
-
if (
|
|
424
|
+
if ("symbol" == typeof prop) {
|
|
422
425
|
return target[prop] = value, !0;
|
|
423
426
|
}
|
|
424
427
|
const newValue = this.$flags$ & StoreFlags.RECURSIVE ? unwrapStore(value) : value;
|
|
@@ -462,7 +465,8 @@
|
|
|
462
465
|
function addEffect(target, prop, store, effectSubscriber) {
|
|
463
466
|
const effectsMap = store.$effects$ ||= {};
|
|
464
467
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
465
|
-
ensureContainsEffect(effects, effectSubscriber), ensureContains(effectSubscriber, target)
|
|
468
|
+
ensureContainsEffect(effects, effectSubscriber), ensureContains(effectSubscriber, target),
|
|
469
|
+
ensureEffectContainsSubscriber(effectSubscriber[EffectSubscriptionsProp.EFFECT], target, store.$container$);
|
|
466
470
|
}
|
|
467
471
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
468
472
|
target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
|
|
@@ -500,24 +504,32 @@
|
|
|
500
504
|
const effects = vnode_getProp(value, "q:subs", container.$getObjectById$);
|
|
501
505
|
if (effects) {
|
|
502
506
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
503
|
-
clearEffects(effects[i], value
|
|
507
|
+
clearEffects(effects[i], value, effects, i, container);
|
|
504
508
|
}
|
|
509
|
+
0 === effects.length && vnode_setProp(value, "q:subs", null);
|
|
505
510
|
}
|
|
506
511
|
}
|
|
507
|
-
function clearSubscriberEffectDependencies(value) {
|
|
512
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
508
513
|
if (value.$effectDependencies$) {
|
|
509
514
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
510
|
-
clearEffects(value.$effectDependencies$[i], value
|
|
515
|
+
clearEffects(value.$effectDependencies$[i], value, value.$effectDependencies$, i, container);
|
|
511
516
|
}
|
|
517
|
+
0 === value.$effectDependencies$.length && (value.$effectDependencies$ = null);
|
|
512
518
|
}
|
|
513
519
|
}
|
|
514
|
-
function clearEffects(subscriber, value) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
520
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
521
|
+
let subscriptionRemoved = !1;
|
|
522
|
+
const seenSet = new Set;
|
|
523
|
+
if (subscriber instanceof WrappedSignal) {
|
|
524
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
525
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
526
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
527
|
+
subscriptionRemoved = clearStoreEffects(getStoreHandler(store), value);
|
|
528
|
+
}
|
|
529
|
+
subscriptionRemoved && effectArray.splice(indexToRemove, 1);
|
|
530
|
+
}
|
|
531
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
518
532
|
const effectSubscriptions = subscriber.$effects$;
|
|
519
|
-
const hostElement = subscriber.$hostElement$;
|
|
520
|
-
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
521
533
|
let subscriptionRemoved = !1;
|
|
522
534
|
if (effectSubscriptions) {
|
|
523
535
|
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
@@ -525,14 +537,62 @@
|
|
|
525
537
|
subscriptionRemoved = !0);
|
|
526
538
|
}
|
|
527
539
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
540
|
+
if (subscriber instanceof WrappedSignal) {
|
|
541
|
+
const hostElement = subscriber.$hostElement$;
|
|
542
|
+
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
543
|
+
const args = subscriber.$args$;
|
|
544
|
+
args && clearArgsEffects(args, subscriber, seenSet);
|
|
545
|
+
}
|
|
546
|
+
return subscriptionRemoved;
|
|
547
|
+
}
|
|
548
|
+
function clearStoreEffects(storeHandler, value) {
|
|
549
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
550
|
+
if (!effectSubscriptions) {
|
|
551
|
+
return !1;
|
|
552
|
+
}
|
|
553
|
+
let subscriptionRemoved = !1;
|
|
554
|
+
for (const key in effectSubscriptions) {
|
|
555
|
+
const effects = effectSubscriptions[key];
|
|
556
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
557
|
+
effects[i][EffectSubscriptionsProp.EFFECT] === value && (effects.splice(i, 1), subscriptionRemoved = !0);
|
|
532
558
|
}
|
|
559
|
+
0 === effects.length && delete effectSubscriptions[key];
|
|
533
560
|
}
|
|
534
561
|
return subscriptionRemoved;
|
|
535
562
|
}
|
|
563
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
564
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
565
|
+
clearArgEffect(args[i], subscriber, seenSet);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
569
|
+
if (!seenSet.has(arg)) {
|
|
570
|
+
if (seenSet.add(arg), isSignal(arg)) {
|
|
571
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
572
|
+
} else if ("object" == typeof arg && null !== arg) {
|
|
573
|
+
if (isStore(arg)) {
|
|
574
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
575
|
+
} else if (isPropsProxy(arg)) {
|
|
576
|
+
const constProps = arg[_CONST_PROPS];
|
|
577
|
+
const varProps = arg[_VAR_PROPS];
|
|
578
|
+
if (constProps) {
|
|
579
|
+
for (const key in constProps) {
|
|
580
|
+
clearArgEffect(constProps[key], subscriber, seenSet);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
for (const key in varProps) {
|
|
584
|
+
clearArgEffect(varProps[key], subscriber, seenSet);
|
|
585
|
+
}
|
|
586
|
+
} else {
|
|
587
|
+
for (const key in arg) {
|
|
588
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
} else {
|
|
592
|
+
Array.isArray(arg) && clearArgsEffects(arg, subscriber, seenSet);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
536
596
|
const useResourceQrl = (qrl, opts) => {
|
|
537
597
|
const {val, set, i, iCtx} = useSequentialScope();
|
|
538
598
|
if (null != val) {
|
|
@@ -562,7 +622,7 @@
|
|
|
562
622
|
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
563
623
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
|
|
564
624
|
iCtx.$container$ = container;
|
|
565
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(task)));
|
|
625
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(container, task)));
|
|
566
626
|
const resource = task.$state$;
|
|
567
627
|
assertDefined();
|
|
568
628
|
const cleanups = [];
|
|
@@ -898,6 +958,13 @@
|
|
|
898
958
|
}
|
|
899
959
|
return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
|
|
900
960
|
}
|
|
961
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
962
|
+
if (!jsxDev) {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
966
|
+
return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
|
|
967
|
+
}
|
|
901
968
|
const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
902
969
|
let journal = container.$journal$;
|
|
903
970
|
const stack = [];
|
|
@@ -1058,7 +1125,7 @@
|
|
|
1058
1125
|
advanceToNextSibling(), vnode_remove(journal, vParent, toRemove, !0);
|
|
1059
1126
|
}
|
|
1060
1127
|
}
|
|
1061
|
-
function createNewElement(jsx, elementName) {
|
|
1128
|
+
function createNewElement(jsx, elementName, currentFile) {
|
|
1062
1129
|
const element = function(elementName) {
|
|
1063
1130
|
const domParentVNode = vnode_getDomParentVNode(vParent);
|
|
1064
1131
|
const {elementNamespace, elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, elementName);
|
|
@@ -1086,6 +1153,7 @@
|
|
|
1086
1153
|
value(element);
|
|
1087
1154
|
continue;
|
|
1088
1155
|
}
|
|
1156
|
+
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1089
1157
|
}
|
|
1090
1158
|
if (isSignal(value)) {
|
|
1091
1159
|
const signalData = new EffectPropData({
|
|
@@ -1098,13 +1166,13 @@
|
|
|
1098
1166
|
if ("textarea" !== elementName || "value" !== key) {
|
|
1099
1167
|
value = serializeAttribute(key, value, scopedStyleIdPrefix), null != value && element.setAttribute(key, String(value));
|
|
1100
1168
|
} else {
|
|
1101
|
-
if ("string" != typeof value) {
|
|
1169
|
+
if (value && "string" != typeof value) {
|
|
1102
1170
|
if (build.isDev) {
|
|
1103
|
-
throw qError(QError.wrongTextareaValue);
|
|
1171
|
+
throw qError(QError.wrongTextareaValue, [ currentFile, value ]);
|
|
1104
1172
|
}
|
|
1105
1173
|
continue;
|
|
1106
1174
|
}
|
|
1107
|
-
element.value = escapeHTML(value);
|
|
1175
|
+
element.value = escapeHTML(value || "");
|
|
1108
1176
|
}
|
|
1109
1177
|
} else {
|
|
1110
1178
|
element.innerHTML = value, element.setAttribute("q:container", QContainerValue.HTML);
|
|
@@ -1121,17 +1189,19 @@
|
|
|
1121
1189
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
1122
1190
|
const jsxKey = jsx.key;
|
|
1123
1191
|
let needsQDispatchEventPatch = !1;
|
|
1192
|
+
const currentFile = getFileLocationFromJsx(jsx.dev);
|
|
1124
1193
|
isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey),
|
|
1125
|
-
null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx, elementName) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent)
|
|
1194
|
+
null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent),
|
|
1195
|
+
vCurrent = vNewNode, vNewNode = null, null !== vSiblings && (vSiblingsIdx -= SiblingsArray.Size)));
|
|
1126
1196
|
const jsxAttrs = [];
|
|
1127
1197
|
const props = jsx.varProps;
|
|
1128
1198
|
for (const key in props) {
|
|
1129
|
-
|
|
1130
|
-
|
|
1199
|
+
const value = props[key];
|
|
1200
|
+
null != value && mapArray_set(jsxAttrs, key, value, 0);
|
|
1131
1201
|
}
|
|
1132
1202
|
null !== jsxKey && mapArray_set(jsxAttrs, "q:key", jsxKey, 0);
|
|
1133
1203
|
const vNode = vNewNode || vCurrent;
|
|
1134
|
-
if (needsQDispatchEventPatch = function(vnode, srcAttrs) {
|
|
1204
|
+
if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile) {
|
|
1135
1205
|
vnode_ensureElementInflated(vnode);
|
|
1136
1206
|
const dstAttrs = vnode;
|
|
1137
1207
|
let srcIdx = 0;
|
|
@@ -1153,8 +1223,16 @@
|
|
|
1153
1223
|
if ("function" == typeof value) {
|
|
1154
1224
|
return void value(element);
|
|
1155
1225
|
}
|
|
1226
|
+
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1227
|
+
}
|
|
1228
|
+
if (isSignal(value)) {
|
|
1229
|
+
const signalData = new EffectPropData({
|
|
1230
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
1231
|
+
$isConst$: !1
|
|
1232
|
+
});
|
|
1233
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
1156
1234
|
}
|
|
1157
|
-
|
|
1235
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix)),
|
|
1158
1236
|
null === value && (dstLength = dstAttrs.length);
|
|
1159
1237
|
}
|
|
1160
1238
|
};
|
|
@@ -1175,7 +1253,7 @@
|
|
|
1175
1253
|
dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
1176
1254
|
} else if (null == dstKey) {
|
|
1177
1255
|
isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = !0, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]),
|
|
1178
|
-
srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
1256
|
+
srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
1179
1257
|
} else if (srcKey == dstKey) {
|
|
1180
1258
|
const srcValue = srcAttrs[srcIdx++];
|
|
1181
1259
|
srcValue !== dstAttrs[dstIdx++] && record(dstKey, srcValue), srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null,
|
|
@@ -1188,7 +1266,7 @@
|
|
|
1188
1266
|
}
|
|
1189
1267
|
}
|
|
1190
1268
|
return patchEventDispatch;
|
|
1191
|
-
}(vNode, jsxAttrs) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
|
|
1269
|
+
}(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
|
|
1192
1270
|
const element = vnode_getNode(vNode);
|
|
1193
1271
|
element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
|
|
1194
1272
|
const eventName = event.type;
|
|
@@ -1232,7 +1310,7 @@
|
|
|
1232
1310
|
function expectVirtual(type, jsxKey) {
|
|
1233
1311
|
vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey),
|
|
1234
1312
|
null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
|
|
1235
|
-
vnode_setProp(vNewNode, "q:key", jsxKey), build.isDev && vnode_setProp(vNewNode || vCurrent, "q:type", type)) : vnode_insertBefore(journal, vParent, vNewNode
|
|
1313
|
+
vnode_setProp(vNewNode, "q:key", jsxKey), build.isDev && vnode_setProp(vNewNode || vCurrent, "q:type", type)) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
|
|
1236
1314
|
}
|
|
1237
1315
|
function expectComponent(component) {
|
|
1238
1316
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -1367,7 +1445,7 @@
|
|
|
1367
1445
|
const obj = seq[i];
|
|
1368
1446
|
if (isTask(obj)) {
|
|
1369
1447
|
const task = obj;
|
|
1370
|
-
clearSubscriberEffectDependencies(task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
|
|
1448
|
+
clearSubscriberEffectDependencies(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
|
|
1371
1449
|
}
|
|
1372
1450
|
}
|
|
1373
1451
|
}
|
|
@@ -1452,6 +1530,10 @@
|
|
|
1452
1530
|
const createSignal = value => new Signal(null, value);
|
|
1453
1531
|
const createComputedQrl = qrl => (throwIfQRLNotResolved(qrl), new ComputedSignal(null, qrl));
|
|
1454
1532
|
const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedQrl);
|
|
1533
|
+
const aVNodePath = [];
|
|
1534
|
+
const bVNodePath = [];
|
|
1535
|
+
const aSsrNodePath = [];
|
|
1536
|
+
const bSsrNodePath = [];
|
|
1455
1537
|
var ChoreType;
|
|
1456
1538
|
!function(ChoreType) {
|
|
1457
1539
|
ChoreType[ChoreType.MACRO = 240] = "MACRO", ChoreType[ChoreType.MICRO = 15] = "MICRO",
|
|
@@ -1481,13 +1563,13 @@
|
|
|
1481
1563
|
$returnValue$: null,
|
|
1482
1564
|
$executed$: !1
|
|
1483
1565
|
};
|
|
1484
|
-
chore.$promise$ = new Promise((resolve => chore.$resolve$ = resolve)), chore = function(sortedArray, value) {
|
|
1485
|
-
const idx = function(sortedArray, value) {
|
|
1566
|
+
chore.$promise$ = new Promise((resolve => chore.$resolve$ = resolve)), chore = function(sortedArray, value, rootVNode) {
|
|
1567
|
+
const idx = function(sortedArray, value, rootVNode) {
|
|
1486
1568
|
let bottom = 0;
|
|
1487
1569
|
let top = sortedArray.length;
|
|
1488
1570
|
for (;bottom < top; ) {
|
|
1489
1571
|
const middle = bottom + (top - bottom >> 1);
|
|
1490
|
-
const comp = choreComparator(value, sortedArray[middle],
|
|
1572
|
+
const comp = choreComparator(value, sortedArray[middle], rootVNode);
|
|
1491
1573
|
if (comp < 0) {
|
|
1492
1574
|
top = middle;
|
|
1493
1575
|
} else {
|
|
@@ -1498,17 +1580,17 @@
|
|
|
1498
1580
|
}
|
|
1499
1581
|
}
|
|
1500
1582
|
return ~bottom;
|
|
1501
|
-
}(sortedArray, value);
|
|
1583
|
+
}(sortedArray, value, rootVNode);
|
|
1502
1584
|
if (idx < 0) {
|
|
1503
1585
|
return sortedArray.splice(~idx, 0, value), value;
|
|
1504
1586
|
}
|
|
1505
1587
|
const existing = sortedArray[idx];
|
|
1506
1588
|
return choreUpdate(existing, value), existing;
|
|
1507
|
-
}(choreQueue, chore), !journalFlushScheduled && runLater && (journalFlushScheduled = !0,
|
|
1589
|
+
}(choreQueue, chore, container.rootVNode || null), !journalFlushScheduled && runLater && (journalFlushScheduled = !0,
|
|
1508
1590
|
schedule(ChoreType.JOURNAL_FLUSH), scheduleDrain());
|
|
1509
|
-
return runLater ? chore.$promise$ : drainUpTo(chore);
|
|
1591
|
+
return runLater ? chore.$promise$ : drainUpTo(chore, container.rootVNode || null);
|
|
1510
1592
|
};
|
|
1511
|
-
function drainUpTo(runUptoChore) {
|
|
1593
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
1512
1594
|
if (runUptoChore.$executed$) {
|
|
1513
1595
|
return runUptoChore.$returnValue$;
|
|
1514
1596
|
}
|
|
@@ -1517,7 +1599,7 @@
|
|
|
1517
1599
|
}
|
|
1518
1600
|
for (;choreQueue.length; ) {
|
|
1519
1601
|
const nextChore = choreQueue.shift();
|
|
1520
|
-
const order = choreComparator(nextChore, runUptoChore,
|
|
1602
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode);
|
|
1521
1603
|
if (null === order) {
|
|
1522
1604
|
continue;
|
|
1523
1605
|
}
|
|
@@ -1529,7 +1611,7 @@
|
|
|
1529
1611
|
}
|
|
1530
1612
|
const returnValue = executeChore(nextChore);
|
|
1531
1613
|
if (isPromise(returnValue)) {
|
|
1532
|
-
return returnValue.then((() => drainUpTo(runUptoChore)));
|
|
1614
|
+
return returnValue.then((() => drainUpTo(runUptoChore, rootVNode)));
|
|
1533
1615
|
}
|
|
1534
1616
|
}
|
|
1535
1617
|
var chore;
|
|
@@ -1549,7 +1631,7 @@
|
|
|
1549
1631
|
returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
|
|
1550
1632
|
if (chore.$type$ === ChoreType.COMPONENT) {
|
|
1551
1633
|
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
1552
|
-
return vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId));
|
|
1634
|
+
return retryOnPromise((() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId))));
|
|
1553
1635
|
}
|
|
1554
1636
|
return jsx;
|
|
1555
1637
|
}), (err => container.handleError(err, host)));
|
|
@@ -1572,7 +1654,7 @@
|
|
|
1572
1654
|
case ChoreType.NODE_DIFF:
|
|
1573
1655
|
const parentVirtualNode = chore.$target$;
|
|
1574
1656
|
let jsx = chore.$payload$;
|
|
1575
|
-
isSignal(jsx) && (jsx = jsx.value), returnValue = vnode_diff(container, jsx, parentVirtualNode, null);
|
|
1657
|
+
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise((() => vnode_diff(container, jsx, parentVirtualNode, null)));
|
|
1576
1658
|
break;
|
|
1577
1659
|
|
|
1578
1660
|
case ChoreType.NODE_PROP:
|
|
@@ -1620,7 +1702,7 @@
|
|
|
1620
1702
|
const choreUpdate = (existing, newChore) => {
|
|
1621
1703
|
existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = newChore.$payload$);
|
|
1622
1704
|
};
|
|
1623
|
-
function choreComparator(a, b,
|
|
1705
|
+
function choreComparator(a, b, rootVNode) {
|
|
1624
1706
|
const macroTypeDiff = (a.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
|
|
1625
1707
|
if (0 !== macroTypeDiff) {
|
|
1626
1708
|
return macroTypeDiff;
|
|
@@ -1629,15 +1711,65 @@
|
|
|
1629
1711
|
const aHost = a.$host$;
|
|
1630
1712
|
const bHost = b.$host$;
|
|
1631
1713
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
1632
|
-
if (
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
|
|
1714
|
+
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
1715
|
+
const hostDiff = ((a, b, rootVNode) => {
|
|
1716
|
+
if (a === b) {
|
|
1717
|
+
return 0;
|
|
1718
|
+
}
|
|
1719
|
+
let aDepth = -1;
|
|
1720
|
+
let bDepth = -1;
|
|
1721
|
+
for (;a; ) {
|
|
1722
|
+
a = (aVNodePath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, ":", (id => vnode_locate(rootVNode, id)));
|
|
1723
|
+
}
|
|
1724
|
+
for (;b; ) {
|
|
1725
|
+
b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id)));
|
|
1726
|
+
}
|
|
1727
|
+
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
1728
|
+
if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
|
|
1729
|
+
let cursor = b;
|
|
1730
|
+
do {
|
|
1731
|
+
if (cursor = vnode_getNextSibling(cursor), cursor === a) {
|
|
1732
|
+
return 1;
|
|
1733
|
+
}
|
|
1734
|
+
} while (cursor);
|
|
1735
|
+
cursor = b;
|
|
1736
|
+
do {
|
|
1737
|
+
if (cursor = vnode_getPreviousSibling(cursor), cursor === a) {
|
|
1738
|
+
return -1;
|
|
1739
|
+
}
|
|
1740
|
+
} while (cursor);
|
|
1741
|
+
return rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
1742
|
+
}
|
|
1743
|
+
aDepth--, bDepth--;
|
|
1744
|
+
}
|
|
1745
|
+
return aDepth < bDepth ? -1 : 1;
|
|
1746
|
+
})(aHost, bHost, rootVNode);
|
|
1747
|
+
if (0 !== hostDiff) {
|
|
1748
|
+
return hostDiff;
|
|
1636
1749
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
const hostDiff =
|
|
1750
|
+
} else {
|
|
1751
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
1752
|
+
logWarn(errorMessage);
|
|
1753
|
+
const hostDiff = ((a, b) => {
|
|
1754
|
+
if (a === b) {
|
|
1755
|
+
return 0;
|
|
1756
|
+
}
|
|
1757
|
+
let aDepth = -1;
|
|
1758
|
+
let bDepth = -1;
|
|
1759
|
+
for (;a; ) {
|
|
1760
|
+
a = (aSsrNodePath[++aDepth] = a).currentComponentNode;
|
|
1761
|
+
}
|
|
1762
|
+
for (;b; ) {
|
|
1763
|
+
b = (bSsrNodePath[++bDepth] = b).currentComponentNode;
|
|
1764
|
+
}
|
|
1765
|
+
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
1766
|
+
if ((a = aSsrNodePath[aDepth]) !== (b = bSsrNodePath[bDepth])) {
|
|
1767
|
+
return 1;
|
|
1768
|
+
}
|
|
1769
|
+
aDepth--, bDepth--;
|
|
1770
|
+
}
|
|
1771
|
+
return aDepth < bDepth ? -1 : 1;
|
|
1772
|
+
})(aHost, bHost);
|
|
1641
1773
|
if (0 !== hostDiff) {
|
|
1642
1774
|
return hostDiff;
|
|
1643
1775
|
}
|
|
@@ -1695,7 +1827,7 @@
|
|
|
1695
1827
|
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
1696
1828
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
|
|
1697
1829
|
iCtx.$container$ = container;
|
|
1698
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(task)));
|
|
1830
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(container, task)));
|
|
1699
1831
|
const handleError = reason => container.handleError(reason, host);
|
|
1700
1832
|
let cleanupFns = null;
|
|
1701
1833
|
const cleanup = fn => {
|
|
@@ -2074,13 +2206,7 @@
|
|
|
2074
2206
|
jsx.constProps.class = "");
|
|
2075
2207
|
}(jsx, options.styleScoped);
|
|
2076
2208
|
let qwikInspectorAttrValue = null;
|
|
2077
|
-
build.isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue =
|
|
2078
|
-
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
2079
|
-
if (sanitizedFileName) {
|
|
2080
|
-
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
2081
|
-
}
|
|
2082
|
-
return null;
|
|
2083
|
-
}(jsx.dev));
|
|
2209
|
+
build.isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
|
|
2084
2210
|
const innerHTML = ssr.openElement(type, toSsrAttrs(jsx.varProps, jsx.constProps, ssr.serializationCtx, !0, options.styleScoped, jsx.key), function(constProps, varProps, serializationCtx, styleScopedId) {
|
|
2085
2211
|
return toSsrAttrs(constProps, varProps, serializationCtx, !1, styleScopedId);
|
|
2086
2212
|
}(jsx.constProps, jsx.varProps, ssr.serializationCtx, options.styleScoped), qwikInspectorAttrValue);
|
|
@@ -2241,7 +2367,7 @@
|
|
|
2241
2367
|
const eventName = key.substring(15);
|
|
2242
2368
|
eventName && serializationCtx.$eventNames$.add(eventName);
|
|
2243
2369
|
}
|
|
2244
|
-
const version = "2.0.0-alpha.
|
|
2370
|
+
const version = "2.0.0-alpha.6-dev+d848ba5";
|
|
2245
2371
|
class _SharedContainer {
|
|
2246
2372
|
$version$;
|
|
2247
2373
|
$scheduler$;
|
|
@@ -3164,6 +3290,7 @@
|
|
|
3164
3290
|
}
|
|
3165
3291
|
};
|
|
3166
3292
|
const vnode_getNextSibling = vnode => vnode[VNodeProps.nextSibling];
|
|
3293
|
+
const vnode_getPreviousSibling = vnode => vnode[VNodeProps.previousSibling];
|
|
3167
3294
|
const vnode_getAttrKeys = vnode => {
|
|
3168
3295
|
if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
3169
3296
|
vnode_ensureElementInflated(vnode);
|
|
@@ -3224,7 +3351,7 @@
|
|
|
3224
3351
|
const vnode_getParent = vnode => vnode[VNodeProps.parent] || null;
|
|
3225
3352
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode)),
|
|
3226
3353
|
vnode[TextVNodeProps.node]);
|
|
3227
|
-
function vnode_toString(depth =
|
|
3354
|
+
function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1) {
|
|
3228
3355
|
let vnode = this;
|
|
3229
3356
|
if (0 === depth) {
|
|
3230
3357
|
return "...";
|
|
@@ -3299,46 +3426,11 @@
|
|
|
3299
3426
|
throw qError(QError.invalidVNodeType, [ type ]);
|
|
3300
3427
|
};
|
|
3301
3428
|
const isElement = node => node && "object" == typeof node && 1 === fastNodeType(node);
|
|
3302
|
-
const aPath = [];
|
|
3303
|
-
const bPath = [];
|
|
3304
|
-
const vnode_documentPosition = (a, b) => {
|
|
3305
|
-
if (a === b) {
|
|
3306
|
-
return 0;
|
|
3307
|
-
}
|
|
3308
|
-
let aDepth = -1;
|
|
3309
|
-
let bDepth = -1;
|
|
3310
|
-
for (;a; ) {
|
|
3311
|
-
a = (aPath[++aDepth] = a)[VNodeProps.parent];
|
|
3312
|
-
}
|
|
3313
|
-
for (;b; ) {
|
|
3314
|
-
b = (bPath[++bDepth] = b)[VNodeProps.parent];
|
|
3315
|
-
}
|
|
3316
|
-
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
3317
|
-
if ((a = aPath[aDepth]) !== (b = bPath[bDepth])) {
|
|
3318
|
-
let cursor = b;
|
|
3319
|
-
do {
|
|
3320
|
-
if (cursor = vnode_getNextSibling(cursor), cursor === a) {
|
|
3321
|
-
return 1;
|
|
3322
|
-
}
|
|
3323
|
-
} while (cursor);
|
|
3324
|
-
cursor = b;
|
|
3325
|
-
do {
|
|
3326
|
-
if (cursor = cursor[VNodeProps.previousSibling], cursor === a) {
|
|
3327
|
-
return -1;
|
|
3328
|
-
}
|
|
3329
|
-
} while (cursor);
|
|
3330
|
-
return 1;
|
|
3331
|
-
}
|
|
3332
|
-
aDepth--, bDepth--;
|
|
3333
|
-
}
|
|
3334
|
-
return aDepth < bDepth ? -1 : 1;
|
|
3335
|
-
};
|
|
3336
3429
|
const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
3337
3430
|
let projectionDepth = 1;
|
|
3338
3431
|
for (;projectionDepth--; ) {
|
|
3339
3432
|
for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
|
|
3340
|
-
const
|
|
3341
|
-
const qSlotParent = qSlotParentProp && ("string" == typeof qSlotParentProp ? vnode_locate(rootVNode, qSlotParentProp) : qSlotParentProp);
|
|
3433
|
+
const qSlotParent = vnode_getProp(vHost, ":", (id => vnode_locate(rootVNode, id)));
|
|
3342
3434
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
3343
3435
|
vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
|
|
3344
3436
|
}
|
|
@@ -3713,13 +3805,10 @@
|
|
|
3713
3805
|
if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
|
|
3714
3806
|
return vNode;
|
|
3715
3807
|
}
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
continue;
|
|
3720
|
-
}
|
|
3808
|
+
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.$vnodeLocate$);
|
|
3809
|
+
} else {
|
|
3810
|
+
vNode = vnode_getParent(vNode);
|
|
3721
3811
|
}
|
|
3722
|
-
vNode = vnode_getParent(vNode);
|
|
3723
3812
|
}
|
|
3724
3813
|
return null;
|
|
3725
3814
|
}
|
|
@@ -3799,10 +3888,6 @@
|
|
|
3799
3888
|
}
|
|
3800
3889
|
}
|
|
3801
3890
|
const deserializedProxyMap = new WeakMap;
|
|
3802
|
-
const unwrapDeserializerProxy = value => {
|
|
3803
|
-
const unwrapped = "object" == typeof value && null !== value && value[SERIALIZER_PROXY_UNWRAP];
|
|
3804
|
-
return unwrapped || value;
|
|
3805
|
-
};
|
|
3806
3891
|
const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
|
|
3807
3892
|
const wrapDeserializerProxy = (container, data) => {
|
|
3808
3893
|
if (!Array.isArray(data) || vnode_isVNode(data) || "object" == typeof (value = data) && null !== value && SERIALIZER_PROXY_UNWRAP in value) {
|
|
@@ -3838,9 +3923,10 @@
|
|
|
3838
3923
|
return value;
|
|
3839
3924
|
}
|
|
3840
3925
|
const container = this.$container$;
|
|
3841
|
-
|
|
3842
|
-
return
|
|
3843
|
-
|
|
3926
|
+
let propValue = allocate(container, typeId, value);
|
|
3927
|
+
return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
|
|
3928
|
+
Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue,
|
|
3929
|
+
propValue;
|
|
3844
3930
|
}
|
|
3845
3931
|
has(target, property) {
|
|
3846
3932
|
return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
|
|
@@ -3860,186 +3946,189 @@
|
|
|
3860
3946
|
}
|
|
3861
3947
|
const resolvers = new WeakMap;
|
|
3862
3948
|
const inflate = (container, target, typeId, data) => {
|
|
3863
|
-
if (void 0
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
}
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
inflateQRL(container, target);
|
|
3897
|
-
break;
|
|
3949
|
+
if (void 0 === typeId) {
|
|
3950
|
+
return target;
|
|
3951
|
+
}
|
|
3952
|
+
switch (typeId !== TypeIds.Object && Array.isArray(data) && (data = ((container, data) => {
|
|
3953
|
+
const out = Array(data.length / 2);
|
|
3954
|
+
for (let i = 0; i < data.length; i += 2) {
|
|
3955
|
+
out[i / 2] = deserializeData(container, data[i], data[i + 1]);
|
|
3956
|
+
}
|
|
3957
|
+
return out;
|
|
3958
|
+
})(container, data)), typeId) {
|
|
3959
|
+
case TypeIds.Object:
|
|
3960
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
3961
|
+
const key = deserializeData(container, data[i], data[i + 1]);
|
|
3962
|
+
const valType = data[i + 2];
|
|
3963
|
+
const valData = data[i + 3];
|
|
3964
|
+
valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
|
|
3965
|
+
get() {
|
|
3966
|
+
const value = deserializeData(container, valType, valData);
|
|
3967
|
+
return target[key] = value, value;
|
|
3968
|
+
},
|
|
3969
|
+
set(value) {
|
|
3970
|
+
Object.defineProperty(target, key, {
|
|
3971
|
+
value,
|
|
3972
|
+
writable: !0,
|
|
3973
|
+
enumerable: !0,
|
|
3974
|
+
configurable: !0
|
|
3975
|
+
});
|
|
3976
|
+
},
|
|
3977
|
+
enumerable: !0,
|
|
3978
|
+
configurable: !0
|
|
3979
|
+
}) : target[key] = deserializeData(container, valType, valData);
|
|
3980
|
+
}
|
|
3981
|
+
break;
|
|
3898
3982
|
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
|
|
3903
|
-
task.$el$ = v[3], task.$effectDependencies$ = v[4], task.$state$ = v[5];
|
|
3904
|
-
break;
|
|
3983
|
+
case TypeIds.QRL:
|
|
3984
|
+
inflateQRL(container, target);
|
|
3985
|
+
break;
|
|
3905
3986
|
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
break;
|
|
3987
|
+
case TypeIds.Task:
|
|
3988
|
+
const task = target;
|
|
3989
|
+
const v = data;
|
|
3990
|
+
task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
|
|
3991
|
+
task.$el$ = v[3], task.$effectDependencies$ = v[4], task.$state$ = v[5];
|
|
3992
|
+
break;
|
|
3913
3993
|
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3994
|
+
case TypeIds.Resource:
|
|
3995
|
+
const [resolved, result, effects] = data;
|
|
3996
|
+
const resource = target;
|
|
3997
|
+
resolved ? (resource.value = Promise.resolve(result), resource._resolved = result,
|
|
3998
|
+
resource._state = "resolved") : (resource.value = Promise.reject(result), resource._error = result,
|
|
3999
|
+
resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
|
|
4000
|
+
break;
|
|
3917
4001
|
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
const [value, flags, effects, storeEffect] = data;
|
|
3922
|
-
const handler = getStoreHandler(target);
|
|
3923
|
-
handler.$flags$ = flags, Object.assign(getStoreTarget(target), value), storeEffect && (effects[STORE_ARRAY_PROP] = storeEffect),
|
|
3924
|
-
handler.$effects$ = effects, container.$storeProxyMap$.set(value, target);
|
|
3925
|
-
break;
|
|
3926
|
-
}
|
|
4002
|
+
case TypeIds.Component:
|
|
4003
|
+
target[SERIALIZABLE_STATE][0] = data[0];
|
|
4004
|
+
break;
|
|
3927
4005
|
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
4006
|
+
case TypeIds.Store:
|
|
4007
|
+
case TypeIds.StoreArray:
|
|
4008
|
+
{
|
|
4009
|
+
const [value, flags, effects, storeEffect] = data;
|
|
4010
|
+
const store = getOrCreateStore(value, flags, container);
|
|
4011
|
+
const storeHandler = getStoreHandler(store);
|
|
4012
|
+
storeEffect && (effects[STORE_ARRAY_PROP] = storeEffect), storeHandler.$effects$ = effects,
|
|
4013
|
+
target = store;
|
|
4014
|
+
break;
|
|
4015
|
+
}
|
|
3935
4016
|
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
}
|
|
4017
|
+
case TypeIds.Signal:
|
|
4018
|
+
{
|
|
4019
|
+
const signal = target;
|
|
4020
|
+
const d = data;
|
|
4021
|
+
signal.$untrackedValue$ = d[0], signal.$effects$ = d.slice(1);
|
|
4022
|
+
break;
|
|
4023
|
+
}
|
|
3944
4024
|
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
4025
|
+
case TypeIds.WrappedSignal:
|
|
4026
|
+
{
|
|
4027
|
+
const signal = target;
|
|
4028
|
+
const d = data;
|
|
4029
|
+
signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal.$effectDependencies$ = d[2],
|
|
4030
|
+
signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = d.slice(5);
|
|
4031
|
+
break;
|
|
4032
|
+
}
|
|
3953
4033
|
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
}
|
|
3963
|
-
target.stack = d[2];
|
|
3964
|
-
} else {
|
|
3965
|
-
target.stack = second;
|
|
3966
|
-
}
|
|
3967
|
-
break;
|
|
3968
|
-
}
|
|
4034
|
+
case TypeIds.ComputedSignal:
|
|
4035
|
+
{
|
|
4036
|
+
const computed = target;
|
|
4037
|
+
const d = data;
|
|
4038
|
+
computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$invalid$ = !0,
|
|
4039
|
+
computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
|
|
4040
|
+
break;
|
|
4041
|
+
}
|
|
3969
4042
|
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
4043
|
+
case TypeIds.Error:
|
|
4044
|
+
{
|
|
4045
|
+
const d = data;
|
|
4046
|
+
target.message = d[0];
|
|
4047
|
+
const second = d[1];
|
|
4048
|
+
if (second && Array.isArray(second)) {
|
|
4049
|
+
for (let i = 0; i < second.length; i++) {
|
|
4050
|
+
target[second[i++]] = d[i];
|
|
3976
4051
|
}
|
|
3977
|
-
|
|
3978
|
-
}
|
|
3979
|
-
|
|
3980
|
-
case TypeIds.JSXNode:
|
|
3981
|
-
{
|
|
3982
|
-
const jsx = target;
|
|
3983
|
-
const [type, varProps, constProps, children, flags, key] = data;
|
|
3984
|
-
jsx.type = type, jsx.varProps = varProps, jsx.constProps = constProps, jsx.children = children,
|
|
3985
|
-
jsx.flags = flags, jsx.key = key;
|
|
3986
|
-
break;
|
|
4052
|
+
target.stack = d[2];
|
|
4053
|
+
} else {
|
|
4054
|
+
target.stack = second;
|
|
3987
4055
|
}
|
|
4056
|
+
break;
|
|
4057
|
+
}
|
|
3988
4058
|
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
}
|
|
3996
|
-
break;
|
|
4059
|
+
case TypeIds.FormData:
|
|
4060
|
+
{
|
|
4061
|
+
const formData = target;
|
|
4062
|
+
const d = data;
|
|
4063
|
+
for (let i = 0; i < d.length; i++) {
|
|
4064
|
+
formData.append(d[i++], d[i]);
|
|
3997
4065
|
}
|
|
4066
|
+
break;
|
|
4067
|
+
}
|
|
3998
4068
|
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
}
|
|
4069
|
+
case TypeIds.JSXNode:
|
|
4070
|
+
{
|
|
4071
|
+
const jsx = target;
|
|
4072
|
+
const [type, varProps, constProps, children, flags, key] = data;
|
|
4073
|
+
jsx.type = type, jsx.varProps = varProps, jsx.constProps = constProps, jsx.children = children,
|
|
4074
|
+
jsx.flags = flags, jsx.key = key;
|
|
4075
|
+
break;
|
|
4076
|
+
}
|
|
4008
4077
|
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
break;
|
|
4078
|
+
case TypeIds.Set:
|
|
4079
|
+
{
|
|
4080
|
+
const set = target;
|
|
4081
|
+
const d = data;
|
|
4082
|
+
for (let i = 0; i < d.length; i++) {
|
|
4083
|
+
set.add(d[i]);
|
|
4016
4084
|
}
|
|
4085
|
+
break;
|
|
4086
|
+
}
|
|
4017
4087
|
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
const
|
|
4021
|
-
|
|
4022
|
-
for (
|
|
4023
|
-
|
|
4088
|
+
case TypeIds.Map:
|
|
4089
|
+
{
|
|
4090
|
+
const map = target;
|
|
4091
|
+
const d = data;
|
|
4092
|
+
for (let i = 0; i < d.length; i++) {
|
|
4093
|
+
map.set(d[i++], d[i]);
|
|
4024
4094
|
}
|
|
4025
4095
|
break;
|
|
4096
|
+
}
|
|
4026
4097
|
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4098
|
+
case TypeIds.Promise:
|
|
4099
|
+
{
|
|
4100
|
+
const promise = target;
|
|
4101
|
+
const [resolved, result] = data;
|
|
4102
|
+
const [resolve, reject] = resolvers.get(promise);
|
|
4103
|
+
resolved ? resolve(result) : reject(result);
|
|
4030
4104
|
break;
|
|
4105
|
+
}
|
|
4031
4106
|
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4107
|
+
case TypeIds.Uint8Array:
|
|
4108
|
+
const bytes = target;
|
|
4109
|
+
const buf = atob(data);
|
|
4110
|
+
let i = 0;
|
|
4111
|
+
for (const s of buf) {
|
|
4112
|
+
bytes[i++] = s.charCodeAt(0);
|
|
4113
|
+
}
|
|
4114
|
+
break;
|
|
4115
|
+
|
|
4116
|
+
case TypeIds.PropsProxy:
|
|
4117
|
+
const propsProxy = target;
|
|
4118
|
+
propsProxy[_VAR_PROPS] = 0 === data ? {} : data[0], propsProxy[_CONST_PROPS] = data[1];
|
|
4119
|
+
break;
|
|
4038
4120
|
|
|
4039
|
-
|
|
4040
|
-
|
|
4121
|
+
case TypeIds.EffectData:
|
|
4122
|
+
{
|
|
4123
|
+
const effectData = target;
|
|
4124
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
|
|
4125
|
+
break;
|
|
4041
4126
|
}
|
|
4127
|
+
|
|
4128
|
+
default:
|
|
4129
|
+
throw qError(QError.serializeErrorNotImplemented, [ typeId ]);
|
|
4042
4130
|
}
|
|
4131
|
+
return target;
|
|
4043
4132
|
};
|
|
4044
4133
|
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
4045
4134
|
const allocate = (container, typeId, value) => {
|
|
@@ -4100,10 +4189,8 @@
|
|
|
4100
4189
|
return new ComputedSignal(container, null);
|
|
4101
4190
|
|
|
4102
4191
|
case TypeIds.Store:
|
|
4103
|
-
return createStore(container, {}, 0);
|
|
4104
|
-
|
|
4105
4192
|
case TypeIds.StoreArray:
|
|
4106
|
-
return
|
|
4193
|
+
return null;
|
|
4107
4194
|
|
|
4108
4195
|
case TypeIds.URLSearchParams:
|
|
4109
4196
|
return new URLSearchParams(value);
|
|
@@ -4594,13 +4681,13 @@
|
|
|
4594
4681
|
}
|
|
4595
4682
|
return qrlStringInline;
|
|
4596
4683
|
}
|
|
4597
|
-
function deserializeData(container, typeId,
|
|
4684
|
+
function deserializeData(container, typeId, value) {
|
|
4598
4685
|
if (void 0 === typeId) {
|
|
4599
|
-
return
|
|
4686
|
+
return value;
|
|
4600
4687
|
}
|
|
4601
|
-
|
|
4602
|
-
return typeId >= TypeIds.Error && inflate(container,
|
|
4603
|
-
|
|
4688
|
+
let propValue = allocate(container, typeId, value);
|
|
4689
|
+
return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
|
|
4690
|
+
propValue;
|
|
4604
4691
|
}
|
|
4605
4692
|
function _createDeserializeContainer(stateData, element) {
|
|
4606
4693
|
let state;
|
|
@@ -5166,7 +5253,18 @@
|
|
|
5166
5253
|
if (isResourceReturn(resource)) {
|
|
5167
5254
|
if (!isServerPlatform()) {
|
|
5168
5255
|
const state = resource._state;
|
|
5169
|
-
|
|
5256
|
+
if ("pending" === state && props.onPending) {
|
|
5257
|
+
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
5258
|
+
}
|
|
5259
|
+
if ("rejected" === state && props.onRejected) {
|
|
5260
|
+
return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
|
|
5261
|
+
}
|
|
5262
|
+
{
|
|
5263
|
+
const resolvedValue = untrack((() => resource._resolved));
|
|
5264
|
+
if (void 0 !== resolvedValue) {
|
|
5265
|
+
return Promise.resolve(resolvedValue).then(useBindInvokeContext(props.onResolved));
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5170
5268
|
}
|
|
5171
5269
|
return resource.value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
5172
5270
|
}
|