@qwik.dev/core 2.0.0-alpha.4 → 2.0.0-alpha.5
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 -2
- package/dist/core-internal.d.ts +2 -2
- package/dist/core.cjs +196 -106
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +196 -106
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +297 -234
- package/dist/core.prod.mjs +297 -229
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +152 -78
- package/dist/optimizer.mjs +157 -80
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +188 -98
- package/dist/server.mjs +187 -97
- package/dist/testing/index.cjs +186 -96
- package/dist/testing/index.mjs +185 -95
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-alpha.5-dev+cb53bbd
|
|
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
|
|
@@ -201,7 +201,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
201
201
|
// 30
|
|
202
202
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
203
203
|
// 31
|
|
204
|
-
"
|
|
204
|
+
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
205
205
|
// 32
|
|
206
206
|
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
207
207
|
// 33
|
|
@@ -217,7 +217,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
217
217
|
// 38
|
|
218
218
|
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
219
219
|
// 39
|
|
220
|
-
"
|
|
220
|
+
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
221
221
|
// 40
|
|
222
222
|
"Unable to find q:container",
|
|
223
223
|
// 41
|
|
@@ -731,7 +731,7 @@ function getBuildBase(opts) {
|
|
|
731
731
|
return `${import.meta.env.BASE_URL}build/`;
|
|
732
732
|
}
|
|
733
733
|
var versions = {
|
|
734
|
-
qwik: "2.0.0-alpha.
|
|
734
|
+
qwik: "2.0.0-alpha.5-dev+cb53bbd",
|
|
735
735
|
qwikDom: "2.1.19"
|
|
736
736
|
};
|
|
737
737
|
|
|
@@ -897,7 +897,6 @@ var StoreHandler = class {
|
|
|
897
897
|
}
|
|
898
898
|
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
899
899
|
set(target, prop, value) {
|
|
900
|
-
target = unwrapDeserializerProxy(target);
|
|
901
900
|
if (typeof prop === "symbol") {
|
|
902
901
|
target[prop] = value;
|
|
903
902
|
return true;
|
|
@@ -965,6 +964,11 @@ function addEffect(target, prop, store, effectSubscriber) {
|
|
|
965
964
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
966
965
|
ensureContainsEffect(effects, effectSubscriber);
|
|
967
966
|
ensureContains(effectSubscriber, target);
|
|
967
|
+
ensureEffectContainsSubscriber(
|
|
968
|
+
effectSubscriber[0 /* EFFECT */],
|
|
969
|
+
target,
|
|
970
|
+
store.$container$
|
|
971
|
+
);
|
|
968
972
|
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
969
973
|
}
|
|
970
974
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -1004,32 +1008,39 @@ function clearVNodeEffectDependencies(container, value) {
|
|
|
1004
1008
|
}
|
|
1005
1009
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1006
1010
|
const subscriber = effects[i];
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
+
clearEffects(subscriber, value, effects, i, container);
|
|
1012
|
+
}
|
|
1013
|
+
if (effects.length === 0) {
|
|
1014
|
+
vnode_setProp(value, QSubscribers, null);
|
|
1011
1015
|
}
|
|
1012
1016
|
}
|
|
1013
|
-
function clearSubscriberEffectDependencies(value) {
|
|
1017
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
1014
1018
|
if (value.$effectDependencies$) {
|
|
1015
1019
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
1016
1020
|
const subscriber = value.$effectDependencies$[i];
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
+
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
1022
|
+
}
|
|
1023
|
+
if (value.$effectDependencies$.length === 0) {
|
|
1024
|
+
value.$effectDependencies$ = null;
|
|
1021
1025
|
}
|
|
1022
1026
|
}
|
|
1023
1027
|
}
|
|
1024
|
-
function clearEffects(subscriber, value) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1028
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
1029
|
+
let subscriptionRemoved = false;
|
|
1030
|
+
const seenSet = /* @__PURE__ */ new Set();
|
|
1031
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1032
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
1033
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
1034
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
1035
|
+
const handler = getStoreHandler(store);
|
|
1036
|
+
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
1027
1037
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
if (hostElement && hostElement === value) {
|
|
1031
|
-
subscriber.$hostElement$ = null;
|
|
1038
|
+
if (subscriptionRemoved) {
|
|
1039
|
+
effectArray.splice(indexToRemove, 1);
|
|
1032
1040
|
}
|
|
1041
|
+
}
|
|
1042
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
1043
|
+
const effectSubscriptions = subscriber.$effects$;
|
|
1033
1044
|
let subscriptionRemoved = false;
|
|
1034
1045
|
if (effectSubscriptions) {
|
|
1035
1046
|
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
@@ -1040,14 +1051,65 @@ function clearEffects(subscriber, value) {
|
|
|
1040
1051
|
}
|
|
1041
1052
|
}
|
|
1042
1053
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1054
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1055
|
+
const hostElement = subscriber.$hostElement$;
|
|
1056
|
+
if (hostElement && hostElement === value) {
|
|
1057
|
+
subscriber.$hostElement$ = null;
|
|
1058
|
+
}
|
|
1059
|
+
const args = subscriber.$args$;
|
|
1060
|
+
if (args) {
|
|
1061
|
+
clearArgsEffects(args, subscriber, seenSet);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return subscriptionRemoved;
|
|
1065
|
+
}
|
|
1066
|
+
function clearStoreEffects(storeHandler, value) {
|
|
1067
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
1068
|
+
if (!effectSubscriptions) {
|
|
1069
|
+
return false;
|
|
1070
|
+
}
|
|
1071
|
+
let subscriptionRemoved = false;
|
|
1072
|
+
for (const key in effectSubscriptions) {
|
|
1073
|
+
const effects = effectSubscriptions[key];
|
|
1074
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1075
|
+
const effect = effects[i];
|
|
1076
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1077
|
+
effects.splice(i, 1);
|
|
1078
|
+
subscriptionRemoved = true;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (effects.length === 0) {
|
|
1082
|
+
delete effectSubscriptions[key];
|
|
1047
1083
|
}
|
|
1048
1084
|
}
|
|
1049
1085
|
return subscriptionRemoved;
|
|
1050
1086
|
}
|
|
1087
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
1088
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1089
|
+
const arg = args[i];
|
|
1090
|
+
clearArgEffect(arg, subscriber, seenSet);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
1094
|
+
if (seenSet.has(arg)) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
seenSet.add(arg);
|
|
1098
|
+
if (isSignal(arg)) {
|
|
1099
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
1100
|
+
} else if (typeof arg === "object" && arg !== null) {
|
|
1101
|
+
if (isStore(arg)) {
|
|
1102
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
1103
|
+
} else {
|
|
1104
|
+
for (const key in arg) {
|
|
1105
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
} else if (Array.isArray(arg)) {
|
|
1109
|
+
clearArgsEffects(arg, subscriber, seenSet);
|
|
1110
|
+
} else {
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1051
1113
|
|
|
1052
1114
|
// packages/qwik/src/core/use/use-resource.ts
|
|
1053
1115
|
var _createResourceReturn = (opts) => {
|
|
@@ -1073,7 +1135,7 @@ var runResource = (task, container, host) => {
|
|
|
1073
1135
|
cleanupTask(task);
|
|
1074
1136
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
1075
1137
|
iCtx.$container$ = container;
|
|
1076
|
-
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
|
|
1138
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
|
|
1077
1139
|
const resource = task.$state$;
|
|
1078
1140
|
assertDefined(
|
|
1079
1141
|
resource,
|
|
@@ -1561,6 +1623,18 @@ function escapeHTML(html) {
|
|
|
1561
1623
|
}
|
|
1562
1624
|
}
|
|
1563
1625
|
|
|
1626
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
1627
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1628
|
+
if (!jsxDev) {
|
|
1629
|
+
return null;
|
|
1630
|
+
}
|
|
1631
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
1632
|
+
if (sanitizedFileName) {
|
|
1633
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
1634
|
+
}
|
|
1635
|
+
return null;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1564
1638
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1565
1639
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1566
1640
|
let journal = container.$journal$;
|
|
@@ -1901,7 +1975,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1901
1975
|
vnode_remove(journal, vParent, toRemove, true);
|
|
1902
1976
|
}
|
|
1903
1977
|
}
|
|
1904
|
-
function createNewElement(jsx2, elementName) {
|
|
1978
|
+
function createNewElement(jsx2, elementName, currentFile) {
|
|
1905
1979
|
const element = createElementWithNamespace(elementName);
|
|
1906
1980
|
const { constProps } = jsx2;
|
|
1907
1981
|
let needsQDispatchEventPatch = false;
|
|
@@ -1929,6 +2003,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1929
2003
|
} else if (typeof value === "function") {
|
|
1930
2004
|
value(element);
|
|
1931
2005
|
continue;
|
|
2006
|
+
} else {
|
|
2007
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
1932
2008
|
}
|
|
1933
2009
|
}
|
|
1934
2010
|
if (isSignal(value)) {
|
|
@@ -1950,13 +2026,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1950
2026
|
continue;
|
|
1951
2027
|
}
|
|
1952
2028
|
if (elementName === "textarea" && key2 === "value") {
|
|
1953
|
-
if (typeof value !== "string") {
|
|
2029
|
+
if (value && typeof value !== "string") {
|
|
1954
2030
|
if (isDev4) {
|
|
1955
|
-
throw qError(40 /* wrongTextareaValue
|
|
2031
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
1956
2032
|
}
|
|
1957
2033
|
continue;
|
|
1958
2034
|
}
|
|
1959
|
-
element.value = escapeHTML(value);
|
|
2035
|
+
element.value = escapeHTML(value || "");
|
|
1960
2036
|
continue;
|
|
1961
2037
|
}
|
|
1962
2038
|
value = serializeAttribute(key2, value, scopedStyleIdPrefix);
|
|
@@ -1992,19 +2068,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1992
2068
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
1993
2069
|
const jsxKey = jsx2.key;
|
|
1994
2070
|
let needsQDispatchEventPatch = false;
|
|
2071
|
+
const currentFile = getFileLocationFromJsx(jsx2.dev);
|
|
1995
2072
|
if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
|
|
1996
2073
|
vNewNode = retrieveChildWithKey(elementName, jsxKey);
|
|
1997
2074
|
if (vNewNode === null) {
|
|
1998
2075
|
needsQDispatchEventPatch = createNewElement(jsx2, elementName);
|
|
1999
2076
|
} else {
|
|
2000
2077
|
vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
|
|
2078
|
+
vCurrent = vNewNode;
|
|
2079
|
+
vNewNode = null;
|
|
2080
|
+
if (vSiblings !== null) {
|
|
2081
|
+
vSiblingsIdx -= 3 /* Size */;
|
|
2082
|
+
}
|
|
2001
2083
|
}
|
|
2002
2084
|
}
|
|
2003
2085
|
const jsxAttrs = [];
|
|
2004
2086
|
const props = jsx2.varProps;
|
|
2005
2087
|
for (const key in props) {
|
|
2006
|
-
|
|
2007
|
-
value = serializeAttribute(key, value, scopedStyleIdPrefix);
|
|
2088
|
+
const value = props[key];
|
|
2008
2089
|
if (value != null) {
|
|
2009
2090
|
mapArray_set(jsxAttrs, key, value, 0);
|
|
2010
2091
|
}
|
|
@@ -2013,7 +2094,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2013
2094
|
mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
|
|
2014
2095
|
}
|
|
2015
2096
|
const vNode = vNewNode || vCurrent;
|
|
2016
|
-
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
|
|
2097
|
+
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
|
|
2017
2098
|
if (needsQDispatchEventPatch) {
|
|
2018
2099
|
const element = vnode_getNode(vNode);
|
|
2019
2100
|
if (!element.qDispatchEvent) {
|
|
@@ -2036,7 +2117,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2036
2117
|
}
|
|
2037
2118
|
}
|
|
2038
2119
|
}
|
|
2039
|
-
function setBulkProps(vnode, srcAttrs) {
|
|
2120
|
+
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
2040
2121
|
vnode_ensureElementInflated(vnode);
|
|
2041
2122
|
const dstAttrs = vnode;
|
|
2042
2123
|
let srcIdx = 0;
|
|
@@ -2059,12 +2140,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2059
2140
|
} else if (typeof value === "function") {
|
|
2060
2141
|
value(element);
|
|
2061
2142
|
return;
|
|
2143
|
+
} else {
|
|
2144
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2062
2145
|
}
|
|
2063
2146
|
}
|
|
2064
2147
|
if (isSignal(value)) {
|
|
2065
|
-
|
|
2148
|
+
const signalData = new EffectPropData({
|
|
2149
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2150
|
+
$isConst$: false
|
|
2151
|
+
});
|
|
2152
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
2066
2153
|
}
|
|
2067
|
-
vnode_setAttr(journal, vnode, key, value);
|
|
2154
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
|
|
2068
2155
|
if (value === null) {
|
|
2069
2156
|
dstLength = dstAttrs.length;
|
|
2070
2157
|
}
|
|
@@ -2106,6 +2193,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2106
2193
|
}
|
|
2107
2194
|
srcIdx++;
|
|
2108
2195
|
srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
2196
|
+
dstIdx++;
|
|
2197
|
+
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2109
2198
|
} else if (srcKey == dstKey) {
|
|
2110
2199
|
const srcValue = srcAttrs[srcIdx++];
|
|
2111
2200
|
const dstValue = dstAttrs[dstIdx++];
|
|
@@ -2182,7 +2271,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2182
2271
|
vnode_insertBefore(
|
|
2183
2272
|
journal,
|
|
2184
2273
|
vParent,
|
|
2185
|
-
vNewNode
|
|
2274
|
+
vNewNode,
|
|
2186
2275
|
vCurrent && getInsertBefore()
|
|
2187
2276
|
);
|
|
2188
2277
|
return;
|
|
@@ -2380,7 +2469,7 @@ function cleanup(container, vNode) {
|
|
|
2380
2469
|
const obj = seq[i];
|
|
2381
2470
|
if (isTask(obj)) {
|
|
2382
2471
|
const task = obj;
|
|
2383
|
-
clearSubscriberEffectDependencies(task);
|
|
2472
|
+
clearSubscriberEffectDependencies(container, task);
|
|
2384
2473
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2385
2474
|
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2386
2475
|
} else {
|
|
@@ -2491,7 +2580,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2491
2580
|
};
|
|
2492
2581
|
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
2493
2582
|
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
2494
|
-
chore = sortedInsert(choreQueue, chore);
|
|
2583
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2495
2584
|
if (!journalFlushScheduled && runLater) {
|
|
2496
2585
|
journalFlushScheduled = true;
|
|
2497
2586
|
schedule(16 /* JOURNAL_FLUSH */);
|
|
@@ -2500,10 +2589,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2500
2589
|
if (runLater) {
|
|
2501
2590
|
return chore.$promise$;
|
|
2502
2591
|
} else {
|
|
2503
|
-
return drainUpTo(chore);
|
|
2592
|
+
return drainUpTo(chore, container.rootVNode || null);
|
|
2504
2593
|
}
|
|
2505
2594
|
}
|
|
2506
|
-
function drainUpTo(runUptoChore) {
|
|
2595
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
2507
2596
|
if (runUptoChore.$executed$) {
|
|
2508
2597
|
return runUptoChore.$returnValue$;
|
|
2509
2598
|
}
|
|
@@ -2512,7 +2601,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2512
2601
|
}
|
|
2513
2602
|
while (choreQueue.length) {
|
|
2514
2603
|
const nextChore = choreQueue.shift();
|
|
2515
|
-
const order = choreComparator(nextChore, runUptoChore, false);
|
|
2604
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode, false);
|
|
2516
2605
|
if (order === null) {
|
|
2517
2606
|
continue;
|
|
2518
2607
|
}
|
|
@@ -2527,7 +2616,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2527
2616
|
}
|
|
2528
2617
|
const returnValue = executeChore(nextChore);
|
|
2529
2618
|
if (isPromise(returnValue)) {
|
|
2530
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore));
|
|
2619
|
+
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
2531
2620
|
return promise;
|
|
2532
2621
|
}
|
|
2533
2622
|
}
|
|
@@ -2652,7 +2741,7 @@ var choreUpdate = (existing, newChore) => {
|
|
|
2652
2741
|
function vNodeAlreadyDeleted(chore) {
|
|
2653
2742
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2654
2743
|
}
|
|
2655
|
-
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2744
|
+
function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
|
|
2656
2745
|
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2657
2746
|
if (macroTypeDiff !== 0) {
|
|
2658
2747
|
return macroTypeDiff;
|
|
@@ -2662,7 +2751,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2662
2751
|
const bHost = b.$host$;
|
|
2663
2752
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
2664
2753
|
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
2665
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2754
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2666
2755
|
if (hostDiff !== 0) {
|
|
2667
2756
|
return hostDiff;
|
|
2668
2757
|
}
|
|
@@ -2692,13 +2781,13 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2692
2781
|
}
|
|
2693
2782
|
return 0;
|
|
2694
2783
|
}
|
|
2695
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2784
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2696
2785
|
let bottom = 0;
|
|
2697
2786
|
let top = sortedArray.length;
|
|
2698
2787
|
while (bottom < top) {
|
|
2699
2788
|
const middle = bottom + (top - bottom >> 1);
|
|
2700
2789
|
const midChore = sortedArray[middle];
|
|
2701
|
-
const comp = choreComparator(value, midChore, true);
|
|
2790
|
+
const comp = choreComparator(value, midChore, rootVNode, true);
|
|
2702
2791
|
if (comp < 0) {
|
|
2703
2792
|
top = middle;
|
|
2704
2793
|
} else if (comp > 0) {
|
|
@@ -2709,8 +2798,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2709
2798
|
}
|
|
2710
2799
|
return ~bottom;
|
|
2711
2800
|
}
|
|
2712
|
-
function sortedInsert(sortedArray, value) {
|
|
2713
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2801
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2802
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2714
2803
|
if (idx < 0) {
|
|
2715
2804
|
sortedArray.splice(~idx, 0, value);
|
|
2716
2805
|
return value;
|
|
@@ -2762,7 +2851,10 @@ var runTask = (task, container, host) => {
|
|
|
2762
2851
|
cleanupTask(task);
|
|
2763
2852
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
2764
2853
|
iCtx.$container$ = container;
|
|
2765
|
-
const taskFn = task.$qrl$.getFn(
|
|
2854
|
+
const taskFn = task.$qrl$.getFn(
|
|
2855
|
+
iCtx,
|
|
2856
|
+
() => clearSubscriberEffectDependencies(container, task)
|
|
2857
|
+
);
|
|
2766
2858
|
const track = (obj, prop) => {
|
|
2767
2859
|
const ctx = newInvokeContext();
|
|
2768
2860
|
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
@@ -3178,7 +3270,7 @@ var WrappedSignal = class extends Signal {
|
|
|
3178
3270
|
};
|
|
3179
3271
|
|
|
3180
3272
|
// packages/qwik/src/core/version.ts
|
|
3181
|
-
var version = "2.0.0-alpha.
|
|
3273
|
+
var version = "2.0.0-alpha.5-dev+cb53bbd";
|
|
3182
3274
|
|
|
3183
3275
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3184
3276
|
var _SharedContainer = class {
|
|
@@ -4820,7 +4912,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4820
4912
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4821
4913
|
return vnode[4 /* node */];
|
|
4822
4914
|
};
|
|
4823
|
-
function vnode_toString(depth =
|
|
4915
|
+
function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
|
|
4824
4916
|
let vnode = this;
|
|
4825
4917
|
if (depth === 0) {
|
|
4826
4918
|
return "...";
|
|
@@ -5018,17 +5110,19 @@ var isElement = (node) => node && typeof node == "object" && fastNodeType(node)
|
|
|
5018
5110
|
1;
|
|
5019
5111
|
var aPath = [];
|
|
5020
5112
|
var bPath = [];
|
|
5021
|
-
var vnode_documentPosition = (a, b) => {
|
|
5113
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
5022
5114
|
if (a === b) {
|
|
5023
5115
|
return 0;
|
|
5024
5116
|
}
|
|
5025
5117
|
let aDepth = -1;
|
|
5026
5118
|
let bDepth = -1;
|
|
5027
5119
|
while (a) {
|
|
5028
|
-
|
|
5120
|
+
const vNode = aPath[++aDepth] = a;
|
|
5121
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5029
5122
|
}
|
|
5030
5123
|
while (b) {
|
|
5031
|
-
|
|
5124
|
+
const vNode = bPath[++bDepth] = b;
|
|
5125
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5032
5126
|
}
|
|
5033
5127
|
while (aDepth >= 0 && bDepth >= 0) {
|
|
5034
5128
|
a = aPath[aDepth];
|
|
@@ -5051,6 +5145,9 @@ var vnode_documentPosition = (a, b) => {
|
|
|
5051
5145
|
return -1;
|
|
5052
5146
|
}
|
|
5053
5147
|
} while (cursor);
|
|
5148
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
5149
|
+
return -1;
|
|
5150
|
+
}
|
|
5054
5151
|
return 1;
|
|
5055
5152
|
}
|
|
5056
5153
|
}
|
|
@@ -5060,8 +5157,11 @@ var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
|
5060
5157
|
let projectionDepth = 1;
|
|
5061
5158
|
while (projectionDepth--) {
|
|
5062
5159
|
while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
|
|
5063
|
-
const
|
|
5064
|
-
|
|
5160
|
+
const qSlotParent = vnode_getProp(
|
|
5161
|
+
vHost,
|
|
5162
|
+
QSlotParent,
|
|
5163
|
+
(id) => vnode_locate(rootVNode, id)
|
|
5164
|
+
);
|
|
5065
5165
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
5066
5166
|
if (vProjectionParent) {
|
|
5067
5167
|
projectionDepth++;
|
|
@@ -5620,13 +5720,11 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5620
5720
|
if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
|
|
5621
5721
|
return vNode;
|
|
5622
5722
|
}
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
}
|
|
5723
|
+
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
5724
|
+
vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5725
|
+
} else {
|
|
5726
|
+
vNode = vnode_getParent(vNode);
|
|
5628
5727
|
}
|
|
5629
|
-
vNode = vnode_getParent(vNode);
|
|
5630
5728
|
}
|
|
5631
5729
|
return null;
|
|
5632
5730
|
}
|
|
@@ -5719,10 +5817,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5719
5817
|
|
|
5720
5818
|
// packages/qwik/src/core/shared/shared-serialization.ts
|
|
5721
5819
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
5722
|
-
var unwrapDeserializerProxy = (value) => {
|
|
5723
|
-
const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
|
|
5724
|
-
return unwrapped ? unwrapped : value;
|
|
5725
|
-
};
|
|
5726
5820
|
var isDeserializerProxy = (value) => {
|
|
5727
5821
|
return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
|
|
5728
5822
|
};
|
|
@@ -5764,13 +5858,13 @@ var DeserializationHandler = class {
|
|
|
5764
5858
|
return value;
|
|
5765
5859
|
}
|
|
5766
5860
|
const container = this.$container$;
|
|
5767
|
-
|
|
5861
|
+
let propValue = allocate(container, typeId, value);
|
|
5862
|
+
if (typeId >= 12 /* Error */) {
|
|
5863
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
5864
|
+
}
|
|
5768
5865
|
Reflect.set(target, property, propValue);
|
|
5769
5866
|
this.$data$[idx] = void 0;
|
|
5770
5867
|
this.$data$[idx + 1] = propValue;
|
|
5771
|
-
if (typeId >= 12 /* Error */) {
|
|
5772
|
-
inflate(container, propValue, typeId, value);
|
|
5773
|
-
}
|
|
5774
5868
|
return propValue;
|
|
5775
5869
|
}
|
|
5776
5870
|
has(target, property) {
|
|
@@ -5804,7 +5898,7 @@ var _eagerDeserializeArray = (container, data) => {
|
|
|
5804
5898
|
var resolvers = /* @__PURE__ */ new WeakMap();
|
|
5805
5899
|
var inflate = (container, target, typeId, data) => {
|
|
5806
5900
|
if (typeId === void 0) {
|
|
5807
|
-
return;
|
|
5901
|
+
return target;
|
|
5808
5902
|
}
|
|
5809
5903
|
if (typeId !== 13 /* Object */ && Array.isArray(data)) {
|
|
5810
5904
|
data = _eagerDeserializeArray(container, data);
|
|
@@ -5875,14 +5969,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
5875
5969
|
case 25 /* Store */:
|
|
5876
5970
|
case 26 /* StoreArray */: {
|
|
5877
5971
|
const [value, flags, effects2, storeEffect] = data;
|
|
5878
|
-
const
|
|
5879
|
-
|
|
5880
|
-
Object.assign(getStoreTarget(target), value);
|
|
5972
|
+
const store = getOrCreateStore(value, flags, container);
|
|
5973
|
+
const storeHandler = getStoreHandler(store);
|
|
5881
5974
|
if (storeEffect) {
|
|
5882
5975
|
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
5883
5976
|
}
|
|
5884
|
-
|
|
5885
|
-
|
|
5977
|
+
storeHandler.$effects$ = effects2;
|
|
5978
|
+
target = store;
|
|
5886
5979
|
break;
|
|
5887
5980
|
}
|
|
5888
5981
|
case 22 /* Signal */: {
|
|
@@ -6003,6 +6096,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6003
6096
|
default:
|
|
6004
6097
|
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6005
6098
|
}
|
|
6099
|
+
return target;
|
|
6006
6100
|
};
|
|
6007
6101
|
var _constants = [
|
|
6008
6102
|
void 0,
|
|
@@ -6070,9 +6164,8 @@ var allocate = (container, typeId, value) => {
|
|
|
6070
6164
|
case 24 /* ComputedSignal */:
|
|
6071
6165
|
return new ComputedSignal(container, null);
|
|
6072
6166
|
case 25 /* Store */:
|
|
6073
|
-
return createStore(container, {}, 0);
|
|
6074
6167
|
case 26 /* StoreArray */:
|
|
6075
|
-
return
|
|
6168
|
+
return null;
|
|
6076
6169
|
case 11 /* URLSearchParams */:
|
|
6077
6170
|
return new URLSearchParams(value);
|
|
6078
6171
|
case 27 /* FormData */:
|
|
@@ -6721,15 +6814,15 @@ function qrlToString(serializationContext, value) {
|
|
|
6721
6814
|
}
|
|
6722
6815
|
return qrlStringInline;
|
|
6723
6816
|
}
|
|
6724
|
-
function deserializeData(container, typeId,
|
|
6817
|
+
function deserializeData(container, typeId, value) {
|
|
6725
6818
|
if (typeId === void 0) {
|
|
6726
|
-
return
|
|
6819
|
+
return value;
|
|
6727
6820
|
}
|
|
6728
|
-
|
|
6821
|
+
let propValue = allocate(container, typeId, value);
|
|
6729
6822
|
if (typeId >= 12 /* Error */) {
|
|
6730
|
-
inflate(container,
|
|
6823
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
6731
6824
|
}
|
|
6732
|
-
return
|
|
6825
|
+
return propValue;
|
|
6733
6826
|
}
|
|
6734
6827
|
function shouldTrackObj(obj) {
|
|
6735
6828
|
return (
|
|
@@ -7479,7 +7572,7 @@ var SsrComponentFrame = class {
|
|
|
7479
7572
|
if (isJSXNode2(children)) {
|
|
7480
7573
|
const slotName = this.getSlotName(children);
|
|
7481
7574
|
mapArray_set(this.slots, slotName, children, 0);
|
|
7482
|
-
} else if (Array.isArray(children)) {
|
|
7575
|
+
} else if (Array.isArray(children) && children.length > 0) {
|
|
7483
7576
|
const defaultSlot = [];
|
|
7484
7577
|
for (let i = 0; i < children.length; i++) {
|
|
7485
7578
|
const child = children[i];
|
|
@@ -7494,7 +7587,7 @@ var SsrComponentFrame = class {
|
|
|
7494
7587
|
defaultSlot.push(child);
|
|
7495
7588
|
}
|
|
7496
7589
|
}
|
|
7497
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7590
|
+
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7498
7591
|
} else {
|
|
7499
7592
|
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7500
7593
|
}
|
|
@@ -8113,12 +8206,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8113
8206
|
this.write("<");
|
|
8114
8207
|
this.write(elementName);
|
|
8115
8208
|
if (varAttrs) {
|
|
8116
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false);
|
|
8209
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
8117
8210
|
}
|
|
8118
8211
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
8119
8212
|
isDev9 && this.write('=""');
|
|
8120
8213
|
if (constAttrs && constAttrs.length) {
|
|
8121
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
|
|
8214
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
8122
8215
|
}
|
|
8123
8216
|
this.write(">");
|
|
8124
8217
|
this.lastNode = null;
|
|
@@ -8193,12 +8286,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8193
8286
|
}
|
|
8194
8287
|
openProjection(attrs) {
|
|
8195
8288
|
this.openFragment(attrs);
|
|
8196
|
-
const vNode = this.currentElementFrame?.vNodeData;
|
|
8197
|
-
if (vNode) {
|
|
8198
|
-
vNode[0] |= 16 /* SERIALIZE */;
|
|
8199
|
-
}
|
|
8200
8289
|
const componentFrame = this.getComponentFrame();
|
|
8201
8290
|
if (componentFrame) {
|
|
8291
|
+
this.serializationCtx.$addRoot$(componentFrame.componentNode);
|
|
8202
8292
|
componentFrame.projectionDepth++;
|
|
8203
8293
|
}
|
|
8204
8294
|
}
|
|
@@ -8756,7 +8846,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8756
8846
|
this.write(element);
|
|
8757
8847
|
}
|
|
8758
8848
|
}
|
|
8759
|
-
writeAttrs(tag, attrs, isConst) {
|
|
8849
|
+
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
8760
8850
|
let innerHTML = void 0;
|
|
8761
8851
|
if (attrs.length) {
|
|
8762
8852
|
for (let i = 0; i < attrs.length; i++) {
|
|
@@ -8783,7 +8873,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8783
8873
|
value(new DomRef(lastNode));
|
|
8784
8874
|
continue;
|
|
8785
8875
|
} else {
|
|
8786
|
-
throw qError(32 /* invalidRefValue
|
|
8876
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
8787
8877
|
}
|
|
8788
8878
|
}
|
|
8789
8879
|
if (isSignal2(value)) {
|
|
@@ -8803,13 +8893,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8803
8893
|
}
|
|
8804
8894
|
}
|
|
8805
8895
|
if (tag === "textarea" && key === "value") {
|
|
8806
|
-
if (typeof value !== "string") {
|
|
8896
|
+
if (value && typeof value !== "string") {
|
|
8807
8897
|
if (isDev9) {
|
|
8808
|
-
throw qError(40 /* wrongTextareaValue
|
|
8898
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
8809
8899
|
}
|
|
8810
8900
|
continue;
|
|
8811
8901
|
}
|
|
8812
|
-
innerHTML = escapeHTML(value);
|
|
8902
|
+
innerHTML = escapeHTML(value || "");
|
|
8813
8903
|
key = QContainerAttr;
|
|
8814
8904
|
value = "text" /* TEXT */;
|
|
8815
8905
|
}
|