@qwik.dev/core 2.0.0-alpha.3 → 2.0.0-alpha.4
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 +34 -4
- package/dist/core-internal.d.ts +38 -16
- package/dist/core.cjs +6473 -6292
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +6460 -6291
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +1543 -1386
- package/dist/core.prod.mjs +3013 -2879
- package/dist/insights/index.qwik.cjs +144 -147
- package/dist/insights/index.qwik.mjs +144 -147
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +1894 -1887
- package/dist/optimizer.mjs +1728 -1775
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +689 -529
- package/dist/server.mjs +680 -521
- package/dist/testing/index.cjs +3200 -3029
- package/dist/testing/index.mjs +3165 -2995
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
- package/public.d.ts +3 -0
- package/dist/index.d.ts +0 -2
package/dist/optimizer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/optimizer 2.0.0-alpha.4-dev+374e0d6
|
|
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
|
|
@@ -1260,7 +1260,7 @@ function createPath(opts = {}) {
|
|
|
1260
1260
|
var QWIK_BINDING_MAP = {};
|
|
1261
1261
|
|
|
1262
1262
|
var versions = {
|
|
1263
|
-
qwik: "2.0.0-alpha.
|
|
1263
|
+
qwik: "2.0.0-alpha.4-dev+374e0d6"
|
|
1264
1264
|
};
|
|
1265
1265
|
|
|
1266
1266
|
async function getSystem() {
|
|
@@ -1541,7 +1541,7 @@ function generateManifestFromBundles(path, segments, injections, outputBundles,
|
|
|
1541
1541
|
}
|
|
1542
1542
|
return canonPath(bundle.fileName);
|
|
1543
1543
|
};
|
|
1544
|
-
const qrlNames = new Set([ ...segments.map((
|
|
1544
|
+
const qrlNames = new Set([ ...segments.map((h => h.name)) ]);
|
|
1545
1545
|
for (const outputBundle of Object.values(outputBundles)) {
|
|
1546
1546
|
if ("chunk" !== outputBundle.type) {
|
|
1547
1547
|
continue;
|
|
@@ -2265,7 +2265,7 @@ function createPlugin(optimizerOptions = {}) {
|
|
|
2265
2265
|
const generateManifest = async () => {
|
|
2266
2266
|
const optimizer2 = getOptimizer();
|
|
2267
2267
|
const path = optimizer2.sys.path;
|
|
2268
|
-
const segments = Array.from(clientResults.values()).flatMap((r => r.modules)).map((mod => mod.segment)).filter((
|
|
2268
|
+
const segments = Array.from(clientResults.values()).flatMap((r => r.modules)).map((mod => mod.segment)).filter((h => !!h));
|
|
2269
2269
|
const manifest = generateManifestFromBundles(path, segments, injections, rollupBundle, opts, debug);
|
|
2270
2270
|
for (const symbol of Object.values(manifest.symbols)) {
|
|
2271
2271
|
symbol.origin && (symbol.origin = normalizePath(symbol.origin));
|
|
@@ -2812,7 +2812,7 @@ function imgImportName(value) {
|
|
|
2812
2812
|
}
|
|
2813
2813
|
|
|
2814
2814
|
function toPascalCase(string) {
|
|
2815
|
-
return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (($1, $
|
|
2815
|
+
return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (($1, $2, $3) => `${$2.toUpperCase() + $3}`)).replace(new RegExp(/\w/), (s => s.toUpperCase()));
|
|
2816
2816
|
}
|
|
2817
2817
|
|
|
2818
2818
|
var FORCE_COLOR;
|
|
@@ -2941,7 +2941,7 @@ var logWarn = (message, ...optionalParams) => {
|
|
|
2941
2941
|
|
|
2942
2942
|
var createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
2943
2943
|
const err = message instanceof Error ? message : new Error(message);
|
|
2944
|
-
console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
2944
|
+
!qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
2945
2945
|
asyncThrow && !qTest && setTimeout((() => {
|
|
2946
2946
|
throw err;
|
|
2947
2947
|
}), 0);
|
|
@@ -2997,33 +2997,21 @@ function assertNumber(value1, text, ...parts) {
|
|
|
2997
2997
|
|
|
2998
2998
|
var codeToText = (code, ...parts) => {
|
|
2999
2999
|
if (qDev) {
|
|
3000
|
-
const MAP = [ "Error while serializing class or style attributes", "
|
|
3000
|
+
const MAP = [ "Error while serializing class or style attributes", "", "", "Only primitive and object literals can be serialized. {{0}}", "", "You can render over a existing q:container. Skipping render().", "", "", "", "", "QRL is not a function", "Dynamic import not found", "Unknown type argument", "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.", "Invoking 'use*()' method outside of invocation context.", "", "", "", "", "", "Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.\nSee https://qwik.dev/docs/components/tasks/#use-method-rules", "", "", "", "", "", "", "", 'The provided Context reference "{{0}}" is not a valid context created by createContextId()', "SsrError(tag): {{0}}", "QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.", "QRLs can not be dynamically resolved, because it does not have a chunk path", "The JSX ref attribute must be a Signal", "Serialization Error: Deserialization of data type {{0}} is not implemented", "Serialization Error: Expected vnode for ref prop, but got {{0}}", "Serialization Error: Cannot allocate data type {{0}}", "Serialization Error: Missing root id for {{0}}", "Serialization Error: Serialization of data type {{0}} is not implemented", "Serialization Error: Unvisited {{0}}", "Serialization Error: Missing QRL chunk for {{0}}", "The value of the textarea must be a string", "Unable to find q:container", "Element must have 'q:container' attribute.", "Unknown vnode type {{0}}.", "Materialize error: missing element: {{0}} {{1}} {{2}}", "SsrError: {{0}}", "Cannot coerce a Signal, use `.value` instead", "useComputedSignal$ QRL {{0}} {{1}} returned a Promise", "ComputedSignal is read-only", "WrappedSignal is read-only", "SsrError: Promises not expected here.", "Attribute value is unsafe for SSR" ];
|
|
3001
3001
|
let text = MAP[code] ?? "";
|
|
3002
3002
|
parts.length && (text = text.replaceAll(/{{(\d+)}}/g, ((_, index) => {
|
|
3003
3003
|
let v = parts[index];
|
|
3004
3004
|
v && "object" === typeof v && v.constructor === Object && (v = JSON.stringify(v).slice(0, 50));
|
|
3005
3005
|
return v;
|
|
3006
3006
|
})));
|
|
3007
|
-
return `Code(${code}): ${text}`;
|
|
3007
|
+
return `Code(Q${code}): ${text}`;
|
|
3008
3008
|
}
|
|
3009
|
-
return `Code(${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
3009
|
+
return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
3010
3010
|
};
|
|
3011
3011
|
|
|
3012
|
-
var
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
var QError_qrlIsNotFunction = 10;
|
|
3017
|
-
|
|
3018
|
-
var QError_useInvokeContext = 20;
|
|
3019
|
-
|
|
3020
|
-
var QError_qrlMissingContainer = 30;
|
|
3021
|
-
|
|
3022
|
-
var QError_qrlMissingChunk = 31;
|
|
3023
|
-
|
|
3024
|
-
var qError = (code, ...parts) => {
|
|
3025
|
-
const text = codeToText(code, ...parts);
|
|
3026
|
-
return logErrorAndStop(text, ...parts);
|
|
3012
|
+
var qError = (code, errorMessageArgs = []) => {
|
|
3013
|
+
const text = codeToText(code, ...errorMessageArgs);
|
|
3014
|
+
return logErrorAndStop(text, ...errorMessageArgs);
|
|
3027
3015
|
};
|
|
3028
3016
|
|
|
3029
3017
|
var createPlatform = () => ({
|
|
@@ -3037,10 +3025,10 @@ var createPlatform = () => ({
|
|
|
3037
3025
|
}
|
|
3038
3026
|
}
|
|
3039
3027
|
if (!url) {
|
|
3040
|
-
throw qError(
|
|
3028
|
+
throw qError(31, [ symbolName ]);
|
|
3041
3029
|
}
|
|
3042
3030
|
if (!containerEl) {
|
|
3043
|
-
throw qError(
|
|
3031
|
+
throw qError(30, [ url, symbolName ]);
|
|
3044
3032
|
}
|
|
3045
3033
|
const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
|
|
3046
3034
|
const urlCopy = new URL(urlDoc);
|
|
@@ -3098,7 +3086,7 @@ var maybeThen = (valueOrPromise, thenFn) => isPromise(valueOrPromise) ? valueOrP
|
|
|
3098
3086
|
var maybeThenPassError = (valueOrPromise, thenFn) => isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
|
|
3099
3087
|
|
|
3100
3088
|
var shouldNotError = reason => {
|
|
3101
|
-
throwErrorAndStop(
|
|
3089
|
+
throwErrorAndStop(reason);
|
|
3102
3090
|
};
|
|
3103
3091
|
|
|
3104
3092
|
var delay = timeout => new Promise((resolve => {
|
|
@@ -3131,43 +3119,6 @@ var isFunction = v => "function" === typeof v;
|
|
|
3131
3119
|
|
|
3132
3120
|
var isDev2 = true;
|
|
3133
3121
|
|
|
3134
|
-
var runtimeSymbolId = 0;
|
|
3135
|
-
|
|
3136
|
-
var $2 = expression => {
|
|
3137
|
-
if (!qRuntimeQrl && qDev) {
|
|
3138
|
-
throw new Error("Optimizer should replace all usages of $() with some special syntax. If you need to create a QRL manually, use inlinedQrl() instead.");
|
|
3139
|
-
}
|
|
3140
|
-
return createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null, null);
|
|
3141
|
-
};
|
|
3142
|
-
|
|
3143
|
-
var dollar = $2;
|
|
3144
|
-
|
|
3145
|
-
var eventQrl = qrl2 => qrl2;
|
|
3146
|
-
|
|
3147
|
-
var EMPTY_ARRAY = [];
|
|
3148
|
-
|
|
3149
|
-
var EMPTY_OBJ = {};
|
|
3150
|
-
|
|
3151
|
-
Object.freeze(EMPTY_ARRAY);
|
|
3152
|
-
|
|
3153
|
-
Object.freeze(EMPTY_OBJ);
|
|
3154
|
-
|
|
3155
|
-
var QObjectRecursive = 1;
|
|
3156
|
-
|
|
3157
|
-
var QObjectImmutable = 2;
|
|
3158
|
-
|
|
3159
|
-
var QObjectTargetSymbol = Symbol("proxy target");
|
|
3160
|
-
|
|
3161
|
-
var QObjectFlagsSymbol = Symbol("proxy flags");
|
|
3162
|
-
|
|
3163
|
-
var QObjectManagerSymbol = Symbol("proxy manager");
|
|
3164
|
-
|
|
3165
|
-
var _CONST_PROPS = Symbol("CONST");
|
|
3166
|
-
|
|
3167
|
-
var _VAR_PROPS = Symbol("VAR");
|
|
3168
|
-
|
|
3169
|
-
var _IMMUTABLE = Symbol("IMMUTABLE");
|
|
3170
|
-
|
|
3171
3122
|
var DEBUG_TYPE = "q:type";
|
|
3172
3123
|
|
|
3173
3124
|
var START = "[34m";
|
|
@@ -3260,6 +3211,8 @@ var ELEMENT_SEQ = "q:seq";
|
|
|
3260
3211
|
|
|
3261
3212
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
3262
3213
|
|
|
3214
|
+
var Q_PREFIX = "q:";
|
|
3215
|
+
|
|
3263
3216
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
3264
3217
|
|
|
3265
3218
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
@@ -3279,38 +3232,29 @@ function setLocale(locale) {
|
|
|
3279
3232
|
}
|
|
3280
3233
|
|
|
3281
3234
|
var versions3 = {
|
|
3282
|
-
qwik: "2.0.0-alpha.
|
|
3235
|
+
qwik: "2.0.0-alpha.4-dev+374e0d6",
|
|
3283
3236
|
qwikDom: globalThis.QWIK_DOM_VERSION
|
|
3284
3237
|
};
|
|
3285
3238
|
|
|
3286
3239
|
var isQrl = value => "function" === typeof value && "function" === typeof value.getSymbol;
|
|
3287
3240
|
|
|
3288
|
-
var
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
return seq[seqIdx] = value;
|
|
3306
|
-
};
|
|
3307
|
-
return {
|
|
3308
|
-
val: seq[seqIdx],
|
|
3309
|
-
set: set,
|
|
3310
|
-
i: seqIdx,
|
|
3311
|
-
iCtx: iCtx
|
|
3312
|
-
};
|
|
3313
|
-
};
|
|
3241
|
+
var EMPTY_ARRAY = [];
|
|
3242
|
+
|
|
3243
|
+
var EMPTY_OBJ = {};
|
|
3244
|
+
|
|
3245
|
+
Object.freeze(EMPTY_ARRAY);
|
|
3246
|
+
|
|
3247
|
+
Object.freeze(EMPTY_OBJ);
|
|
3248
|
+
|
|
3249
|
+
var Slot = props => _jsxSorted(Virtual, null, {
|
|
3250
|
+
[QSlotS]: ""
|
|
3251
|
+
}, props.children, 0, props.name ?? "");
|
|
3252
|
+
|
|
3253
|
+
var SkipRender = Symbol("skip render");
|
|
3254
|
+
|
|
3255
|
+
var SSRRaw = () => null;
|
|
3256
|
+
|
|
3257
|
+
var SSRComment = () => null;
|
|
3314
3258
|
|
|
3315
3259
|
var isJsxPropertyAnEventName = name => (name.startsWith("on") || name.startsWith("window:on") || name.startsWith("document:on")) && name.endsWith("$");
|
|
3316
3260
|
|
|
@@ -3371,525 +3315,341 @@ function isPreventDefault(key) {
|
|
|
3371
3315
|
return key.startsWith("preventdefault:");
|
|
3372
3316
|
}
|
|
3373
3317
|
|
|
3374
|
-
var
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3318
|
+
var unitlessNumbers = new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
|
|
3319
|
+
|
|
3320
|
+
var isUnitlessNumber = name => unitlessNumbers.has(name);
|
|
3321
|
+
|
|
3322
|
+
var serializeClass = obj => {
|
|
3323
|
+
if (!obj) {
|
|
3324
|
+
return "";
|
|
3325
|
+
}
|
|
3326
|
+
if (isString(obj)) {
|
|
3327
|
+
return obj.trim();
|
|
3328
|
+
}
|
|
3329
|
+
const classes = [];
|
|
3330
|
+
if (isArray(obj)) {
|
|
3331
|
+
for (const o of obj) {
|
|
3332
|
+
const classList = serializeClass(o);
|
|
3333
|
+
classList && classes.push(classList);
|
|
3334
|
+
}
|
|
3335
|
+
} else {
|
|
3336
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
3337
|
+
value && classes.push(key.trim());
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
return classes.join(" ");
|
|
3379
3341
|
};
|
|
3380
3342
|
|
|
3381
|
-
var
|
|
3343
|
+
var fromCamelToKebabCaseWithDash = text => text.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3382
3344
|
|
|
3383
|
-
var
|
|
3384
|
-
if (
|
|
3385
|
-
return
|
|
3345
|
+
var stringifyStyle = obj => {
|
|
3346
|
+
if (null == obj) {
|
|
3347
|
+
return "";
|
|
3386
3348
|
}
|
|
3387
|
-
|
|
3349
|
+
if ("object" == typeof obj) {
|
|
3350
|
+
if (isArray(obj)) {
|
|
3351
|
+
throw qError(0, [ obj, "style" ]);
|
|
3352
|
+
}
|
|
3353
|
+
{
|
|
3354
|
+
const chunks = [];
|
|
3355
|
+
for (const key in obj) {
|
|
3356
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
3357
|
+
const value = obj[key];
|
|
3358
|
+
null != value && "function" !== typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
return chunks.join(";");
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
return String(obj);
|
|
3388
3365
|
};
|
|
3389
3366
|
|
|
3390
|
-
|
|
3391
|
-
|
|
3367
|
+
var serializeBooleanOrNumberAttribute = value => null != value ? String(value) : null;
|
|
3368
|
+
|
|
3369
|
+
function serializeAttribute(key, value, styleScopedId) {
|
|
3370
|
+
if (isClassAttr(key)) {
|
|
3371
|
+
const serializedClass = serializeClass(value);
|
|
3372
|
+
value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
|
|
3373
|
+
} else {
|
|
3374
|
+
"style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" === typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
|
|
3375
|
+
}
|
|
3376
|
+
return value;
|
|
3392
3377
|
}
|
|
3393
3378
|
|
|
3394
|
-
function
|
|
3395
|
-
return
|
|
3379
|
+
function isEnumeratedBooleanAttribute(key) {
|
|
3380
|
+
return isAriaAttribute(key) || [ "spellcheck", "draggable", "contenteditable" ].includes(key);
|
|
3396
3381
|
}
|
|
3397
3382
|
|
|
3398
|
-
var
|
|
3399
|
-
|
|
3400
|
-
|
|
3383
|
+
var setValueForStyle = (styleName, value) => {
|
|
3384
|
+
if ("number" === typeof value && 0 !== value && !isUnitlessNumber(styleName)) {
|
|
3385
|
+
return value + "px";
|
|
3401
3386
|
}
|
|
3387
|
+
return value;
|
|
3402
3388
|
};
|
|
3403
3389
|
|
|
3404
|
-
function
|
|
3405
|
-
return
|
|
3390
|
+
function isAriaAttribute(prop) {
|
|
3391
|
+
return prop.startsWith("aria-");
|
|
3406
3392
|
}
|
|
3407
3393
|
|
|
3408
|
-
|
|
3409
|
-
const effects = vnode_getProp(value, QSubscribers, null);
|
|
3410
|
-
if (!effects) {
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
for (let i = effects.length - 1; i >= 0; i--) {
|
|
3414
|
-
const subscriber = effects[i];
|
|
3415
|
-
const subscriptionRemoved = clearEffects(subscriber, value);
|
|
3416
|
-
subscriptionRemoved && effects.splice(i, 1);
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3394
|
+
var styleContent = styleId => ComponentStylesPrefixContent + styleId;
|
|
3419
3395
|
|
|
3420
|
-
function
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
const subscriptionRemoved = clearEffects(subscriber, value);
|
|
3425
|
-
subscriptionRemoved && value.$effectDependencies$.splice(i, 1);
|
|
3396
|
+
function hasClassAttr(props) {
|
|
3397
|
+
for (const key in props) {
|
|
3398
|
+
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
3399
|
+
return true;
|
|
3426
3400
|
}
|
|
3427
3401
|
}
|
|
3402
|
+
return false;
|
|
3428
3403
|
}
|
|
3429
3404
|
|
|
3430
|
-
function
|
|
3431
|
-
|
|
3432
|
-
return false;
|
|
3433
|
-
}
|
|
3434
|
-
const effectSubscriptions = subscriber.$effects$;
|
|
3435
|
-
if (!effectSubscriptions) {
|
|
3436
|
-
return false;
|
|
3437
|
-
}
|
|
3438
|
-
let subscriptionRemoved = false;
|
|
3439
|
-
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
3440
|
-
const effect = effectSubscriptions[i];
|
|
3441
|
-
if (effect[0] === value) {
|
|
3442
|
-
effectSubscriptions.splice(i, 1);
|
|
3443
|
-
subscriptionRemoved = true;
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
return subscriptionRemoved;
|
|
3405
|
+
function isClassAttr(key) {
|
|
3406
|
+
return "class" === key || "className" === key;
|
|
3447
3407
|
}
|
|
3448
3408
|
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3409
|
+
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
3410
|
+
return scopedStyleIds?.split(" ") ?? null;
|
|
3411
|
+
}
|
|
3452
3412
|
|
|
3453
|
-
|
|
3413
|
+
function convertStyleIdsToString(scopedStyleIds) {
|
|
3414
|
+
return Array.from(scopedStyleIds).join(" ");
|
|
3415
|
+
}
|
|
3454
3416
|
|
|
3455
|
-
var
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3417
|
+
var addComponentStylePrefix = styleId => {
|
|
3418
|
+
if (styleId) {
|
|
3419
|
+
let idx = 0;
|
|
3420
|
+
do {
|
|
3421
|
+
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
3422
|
+
} while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
|
|
3459
3423
|
}
|
|
3424
|
+
return styleId || null;
|
|
3460
3425
|
};
|
|
3461
3426
|
|
|
3462
|
-
var
|
|
3427
|
+
var DEBUG = false;
|
|
3463
3428
|
|
|
3464
|
-
var
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3429
|
+
var log = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
|
|
3430
|
+
|
|
3431
|
+
var STORE_TARGET = Symbol("store.target");
|
|
3432
|
+
|
|
3433
|
+
var STORE_HANDLER = Symbol("store.handler");
|
|
3434
|
+
|
|
3435
|
+
var STORE_ARRAY_PROP = Symbol("store.array");
|
|
3436
|
+
|
|
3437
|
+
var getStoreHandler = value => value[STORE_HANDLER];
|
|
3438
|
+
|
|
3439
|
+
var getStoreTarget = value => value?.[STORE_TARGET] || null;
|
|
3440
|
+
|
|
3441
|
+
var unwrapStore = value => getStoreTarget(value) || value;
|
|
3442
|
+
|
|
3443
|
+
var isStore = value => STORE_TARGET in value;
|
|
3444
|
+
|
|
3445
|
+
function createStore(container, obj, flags) {
|
|
3446
|
+
return new Proxy(obj, new StoreHandler(flags, container || null));
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
var getOrCreateStore = (obj, flags, container) => {
|
|
3450
|
+
if (isSerializableObject(obj) && container) {
|
|
3451
|
+
let store = container.$storeProxyMap$.get(obj);
|
|
3452
|
+
if (!store) {
|
|
3453
|
+
store = createStore(container, obj, flags);
|
|
3454
|
+
container.$storeProxyMap$.set(obj, store);
|
|
3455
|
+
}
|
|
3456
|
+
return store;
|
|
3468
3457
|
}
|
|
3458
|
+
return obj;
|
|
3469
3459
|
};
|
|
3470
3460
|
|
|
3471
|
-
var
|
|
3472
|
-
constructor(container
|
|
3473
|
-
|
|
3461
|
+
var StoreHandler = class {
|
|
3462
|
+
constructor($flags$, $container$) {
|
|
3463
|
+
this.$flags$ = $flags$;
|
|
3464
|
+
this.$container$ = $container$;
|
|
3474
3465
|
__publicField(this, "$effects$", null);
|
|
3475
|
-
__publicField(this, "$container$", null);
|
|
3476
|
-
this.$container$ = container;
|
|
3477
|
-
this.$untrackedValue$ = value;
|
|
3478
|
-
DEBUG && log("new", this);
|
|
3479
|
-
}
|
|
3480
|
-
get untrackedValue() {
|
|
3481
|
-
return this.$untrackedValue$;
|
|
3482
3466
|
}
|
|
3483
|
-
|
|
3484
|
-
|
|
3467
|
+
toString() {
|
|
3468
|
+
return "[Store]";
|
|
3485
3469
|
}
|
|
3486
|
-
get
|
|
3470
|
+
get(target, prop) {
|
|
3471
|
+
if ("symbol" === typeof prop) {
|
|
3472
|
+
if (prop === STORE_TARGET) {
|
|
3473
|
+
return target;
|
|
3474
|
+
}
|
|
3475
|
+
if (prop === STORE_HANDLER) {
|
|
3476
|
+
return this;
|
|
3477
|
+
}
|
|
3478
|
+
return target[prop];
|
|
3479
|
+
}
|
|
3487
3480
|
const ctx = tryGetInvokeContext();
|
|
3481
|
+
const value = target[prop];
|
|
3488
3482
|
if (ctx) {
|
|
3489
3483
|
if (null === this.$container$) {
|
|
3490
3484
|
if (!ctx.$container$) {
|
|
3491
|
-
return
|
|
3485
|
+
return value;
|
|
3492
3486
|
}
|
|
3493
3487
|
this.$container$ = ctx.$container$;
|
|
3494
3488
|
} else {
|
|
3495
3489
|
assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$, "Do not use signals across containers");
|
|
3496
3490
|
}
|
|
3497
3491
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3492
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3493
|
+
}
|
|
3494
|
+
if ("toString" === prop && value === Object.prototype.toString) {
|
|
3495
|
+
return this.toString;
|
|
3496
|
+
}
|
|
3497
|
+
const flags = this.$flags$;
|
|
3498
|
+
if (1 & flags && "object" === typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target)) {
|
|
3499
|
+
return getOrCreateStore(value, this.$flags$, this.$container$);
|
|
3500
|
+
}
|
|
3501
|
+
return value;
|
|
3502
|
+
}
|
|
3503
|
+
set(target, prop, value) {
|
|
3504
|
+
target = unwrapDeserializerProxy(target);
|
|
3505
|
+
if ("symbol" === typeof prop) {
|
|
3506
|
+
target[prop] = value;
|
|
3507
|
+
return true;
|
|
3508
|
+
}
|
|
3509
|
+
const newValue = 1 & this.$flags$ ? unwrapStore(value) : value;
|
|
3510
|
+
if (prop in target) {
|
|
3511
|
+
const oldValue = target[prop];
|
|
3512
|
+
if (newValue !== oldValue) {
|
|
3513
|
+
DEBUG && log("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
|
|
3514
|
+
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
3504
3515
|
}
|
|
3516
|
+
} else {
|
|
3517
|
+
DEBUG && log("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
|
|
3518
|
+
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
3505
3519
|
}
|
|
3506
|
-
return
|
|
3520
|
+
return true;
|
|
3507
3521
|
}
|
|
3508
|
-
|
|
3509
|
-
if (
|
|
3510
|
-
|
|
3511
|
-
this.$untrackedValue$ = value;
|
|
3512
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3522
|
+
deleteProperty(target, prop) {
|
|
3523
|
+
if ("string" != typeof prop || !delete target[prop]) {
|
|
3524
|
+
return false;
|
|
3513
3525
|
}
|
|
3526
|
+
triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$));
|
|
3527
|
+
return true;
|
|
3514
3528
|
}
|
|
3515
|
-
|
|
3516
|
-
if (
|
|
3517
|
-
return
|
|
3529
|
+
has(target, prop) {
|
|
3530
|
+
if (prop === STORE_TARGET) {
|
|
3531
|
+
return true;
|
|
3532
|
+
}
|
|
3533
|
+
if ("string" === typeof prop) {
|
|
3534
|
+
const ctx = tryGetInvokeContext();
|
|
3535
|
+
if (ctx) {
|
|
3536
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3537
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3538
|
+
}
|
|
3518
3539
|
}
|
|
3540
|
+
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
3519
3541
|
}
|
|
3520
|
-
|
|
3521
|
-
|
|
3542
|
+
ownKeys(target) {
|
|
3543
|
+
const ctx = tryGetInvokeContext();
|
|
3544
|
+
const effectSubscriber = ctx?.$effectSubscriber$;
|
|
3545
|
+
effectSubscriber && addEffect(target, STORE_ARRAY_PROP, this, effectSubscriber);
|
|
3546
|
+
return Reflect.ownKeys(target);
|
|
3522
3547
|
}
|
|
3523
|
-
|
|
3548
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
3549
|
+
if (Array.isArray(target) || "symbol" === typeof prop) {
|
|
3550
|
+
return Object.getOwnPropertyDescriptor(target, prop);
|
|
3551
|
+
}
|
|
3524
3552
|
return {
|
|
3525
|
-
|
|
3553
|
+
enumerable: true,
|
|
3554
|
+
configurable: true
|
|
3526
3555
|
};
|
|
3527
3556
|
}
|
|
3528
3557
|
};
|
|
3529
3558
|
|
|
3530
|
-
|
|
3531
|
-
const
|
|
3532
|
-
|
|
3533
|
-
|
|
3559
|
+
function addEffect(target, prop, store, effectSubscriber) {
|
|
3560
|
+
const effectsMap = store.$effects$ || (store.$effects$ = {});
|
|
3561
|
+
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
3562
|
+
ensureContainsEffect(effects, effectSubscriber);
|
|
3563
|
+
ensureContains(effectSubscriber, target);
|
|
3564
|
+
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
3565
|
+
}
|
|
3534
3566
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3567
|
+
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
3568
|
+
target[prop] = value;
|
|
3569
|
+
triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
function getEffects(target, prop, storeEffects) {
|
|
3573
|
+
let effectsToTrigger = storeEffects ? Array.isArray(target) ? Object.values(storeEffects).flatMap((effects => effects)) : storeEffects[prop] : null;
|
|
3574
|
+
const storeArrayValue = storeEffects?.[STORE_ARRAY_PROP];
|
|
3575
|
+
if (storeArrayValue) {
|
|
3576
|
+
effectsToTrigger || (effectsToTrigger = []);
|
|
3577
|
+
effectsToTrigger.push(...storeArrayValue);
|
|
3541
3578
|
}
|
|
3542
|
-
|
|
3543
|
-
}
|
|
3579
|
+
return effectsToTrigger;
|
|
3580
|
+
}
|
|
3544
3581
|
|
|
3545
|
-
var
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
if (subscriberExistInSubscribers(effect.$effectDependencies$, subscriber)) {
|
|
3549
|
-
return;
|
|
3550
|
-
}
|
|
3551
|
-
effect.$effectDependencies$.push(subscriber);
|
|
3552
|
-
} else if (vnode_isVNode(effect) && vnode_isVirtualVNode(effect)) {
|
|
3553
|
-
let subscribers = vnode_getProp(effect, QSubscribers, container ? container.$getObjectById$ : null);
|
|
3554
|
-
subscribers || (subscribers = []);
|
|
3555
|
-
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
3556
|
-
return;
|
|
3557
|
-
}
|
|
3558
|
-
subscribers.push(subscriber);
|
|
3559
|
-
vnode_setProp(effect, QSubscribers, subscribers);
|
|
3560
|
-
} else if (isSSRNode(effect)) {
|
|
3561
|
-
let subscribers = effect.getProp(QSubscribers);
|
|
3562
|
-
subscribers || (subscribers = []);
|
|
3563
|
-
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
3564
|
-
return;
|
|
3565
|
-
}
|
|
3566
|
-
subscribers.push(subscriber);
|
|
3567
|
-
effect.setProp(QSubscribers, subscribers);
|
|
3582
|
+
var Subscriber = class {
|
|
3583
|
+
constructor() {
|
|
3584
|
+
__publicField(this, "$effectDependencies$", null);
|
|
3568
3585
|
}
|
|
3569
3586
|
};
|
|
3570
3587
|
|
|
3571
|
-
|
|
3588
|
+
function isSubscriber(value) {
|
|
3589
|
+
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
3590
|
+
}
|
|
3572
3591
|
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3592
|
+
function clearVNodeEffectDependencies(container, value) {
|
|
3593
|
+
vnode_isElementVNode(value) && ensureMaterialized(value);
|
|
3594
|
+
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
3595
|
+
if (!effects) {
|
|
3596
|
+
return;
|
|
3578
3597
|
}
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
if (effects) {
|
|
3584
|
-
const scheduleEffect = effectSubscriptions => {
|
|
3585
|
-
const effect = effectSubscriptions[0];
|
|
3586
|
-
const property = effectSubscriptions[1];
|
|
3587
|
-
assertDefined(container, "Container must be defined.");
|
|
3588
|
-
if (isTask(effect)) {
|
|
3589
|
-
effect.$flags$ |= 8;
|
|
3590
|
-
DEBUG && log("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
3591
|
-
let choreType = 3;
|
|
3592
|
-
1 & effect.$flags$ ? choreType = 64 : 4 & effect.$flags$ && (choreType = 2);
|
|
3593
|
-
container.$scheduler$(choreType, effect);
|
|
3594
|
-
} else if (effect instanceof Signal) {
|
|
3595
|
-
effect instanceof ComputedSignal && (effect.$computeQrl$.resolved || container.$scheduler$(1, null, effect.$computeQrl$));
|
|
3596
|
-
try {
|
|
3597
|
-
retryOnPromise((() => effect.$invalidate$()));
|
|
3598
|
-
} catch (e) {
|
|
3599
|
-
logError(e);
|
|
3600
|
-
}
|
|
3601
|
-
} else if (":" === property) {
|
|
3602
|
-
const host = effect;
|
|
3603
|
-
const qrl2 = container.getHostProp(host, OnRenderProp);
|
|
3604
|
-
assertDefined(qrl2, "Component must have QRL");
|
|
3605
|
-
const props = container.getHostProp(host, ELEMENT_PROPS);
|
|
3606
|
-
container.$scheduler$(7, host, qrl2, props);
|
|
3607
|
-
} else if ("." === property) {
|
|
3608
|
-
const host = effect;
|
|
3609
|
-
const target = host;
|
|
3610
|
-
container.$scheduler$(4, host, target, signal);
|
|
3611
|
-
} else {
|
|
3612
|
-
const host = effect;
|
|
3613
|
-
let effectData = effectSubscriptions[2];
|
|
3614
|
-
if (effectData instanceof EffectData) {
|
|
3615
|
-
const data = effectData.data;
|
|
3616
|
-
const payload = {
|
|
3617
|
-
...data,
|
|
3618
|
-
$value$: signal
|
|
3619
|
-
};
|
|
3620
|
-
container.$scheduler$(5, host, property, payload);
|
|
3621
|
-
}
|
|
3622
|
-
}
|
|
3623
|
-
};
|
|
3624
|
-
effects.forEach(scheduleEffect);
|
|
3598
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
3599
|
+
const subscriber = effects[i];
|
|
3600
|
+
const subscriptionRemoved = clearEffects(subscriber, value);
|
|
3601
|
+
subscriptionRemoved && effects.splice(i, 1);
|
|
3625
3602
|
}
|
|
3626
|
-
|
|
3627
|
-
};
|
|
3603
|
+
}
|
|
3628
3604
|
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
}
|
|
3636
|
-
$invalidate$() {
|
|
3637
|
-
this.$invalid$ = true;
|
|
3638
|
-
if (!this.$effects$?.length) {
|
|
3639
|
-
return;
|
|
3605
|
+
function clearSubscriberEffectDependencies(value) {
|
|
3606
|
+
if (value.$effectDependencies$) {
|
|
3607
|
+
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
3608
|
+
const subscriber = value.$effectDependencies$[i];
|
|
3609
|
+
const subscriptionRemoved = clearEffects(subscriber, value);
|
|
3610
|
+
subscriptionRemoved && value.$effectDependencies$.splice(i, 1);
|
|
3640
3611
|
}
|
|
3641
|
-
this.$computeIfNeeded$() && triggerEffects(this.$container$, this, this.$effects$);
|
|
3642
|
-
}
|
|
3643
|
-
force() {
|
|
3644
|
-
this.$invalid$ = true;
|
|
3645
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3646
3612
|
}
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
function clearEffects(subscriber, value) {
|
|
3616
|
+
if (!isSignal(subscriber)) {
|
|
3617
|
+
return false;
|
|
3651
3618
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
isPromise(untrackedValue) && throwErrorAndStop(`useComputedSignal$ QRL ${computeQrl.dev ? `${computeQrl.dev.file} ` : ""}${computeQrl.$hash$} returned a Promise`);
|
|
3664
|
-
DEBUG && log("Signal.$compute$", untrackedValue);
|
|
3665
|
-
this.$invalid$ = false;
|
|
3666
|
-
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
3667
|
-
didChange && (this.$untrackedValue$ = untrackedValue);
|
|
3668
|
-
return didChange;
|
|
3669
|
-
} finally {
|
|
3670
|
-
ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
|
|
3619
|
+
const effectSubscriptions = subscriber.$effects$;
|
|
3620
|
+
const hostElement = subscriber.$hostElement$;
|
|
3621
|
+
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
3622
|
+
let subscriptionRemoved = false;
|
|
3623
|
+
if (effectSubscriptions) {
|
|
3624
|
+
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
3625
|
+
const effect = effectSubscriptions[i];
|
|
3626
|
+
if (effect[0] === value) {
|
|
3627
|
+
effectSubscriptions.splice(i, 1);
|
|
3628
|
+
subscriptionRemoved = true;
|
|
3629
|
+
}
|
|
3671
3630
|
}
|
|
3672
3631
|
}
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3632
|
+
const args = subscriber.$args$;
|
|
3633
|
+
if (args) {
|
|
3634
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
3635
|
+
clearEffects(args[i], subscriber);
|
|
3636
|
+
}
|
|
3678
3637
|
}
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
}
|
|
3693
|
-
|
|
3694
|
-
this.$invalid$ = true;
|
|
3695
|
-
if (!this.$effects$?.length) {
|
|
3696
|
-
return;
|
|
3697
|
-
}
|
|
3698
|
-
this.$computeIfNeeded$() && triggerEffects(this.$container$, this, this.$effects$);
|
|
3699
|
-
}
|
|
3700
|
-
force() {
|
|
3701
|
-
this.$invalid$ = true;
|
|
3702
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3703
|
-
}
|
|
3704
|
-
get untrackedValue() {
|
|
3705
|
-
this.$computeIfNeeded$();
|
|
3706
|
-
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3707
|
-
return this.$untrackedValue$;
|
|
3708
|
-
}
|
|
3709
|
-
$computeIfNeeded$() {
|
|
3710
|
-
if (!this.$invalid$) {
|
|
3711
|
-
return false;
|
|
3712
|
-
}
|
|
3713
|
-
const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, ".", this.$container$);
|
|
3714
|
-
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
3715
|
-
didChange && (this.$untrackedValue$ = untrackedValue);
|
|
3716
|
-
return didChange;
|
|
3717
|
-
}
|
|
3718
|
-
get value() {
|
|
3719
|
-
return super.value;
|
|
3720
|
-
}
|
|
3721
|
-
set value(_) {
|
|
3722
|
-
throwErrorAndStop("WrappedSignal is read-only");
|
|
3723
|
-
}
|
|
3724
|
-
};
|
|
3725
|
-
|
|
3726
|
-
var DEBUG2 = false;
|
|
3727
|
-
|
|
3728
|
-
var log2 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
|
|
3729
|
-
|
|
3730
|
-
var STORE_TARGET = Symbol("store.target");
|
|
3731
|
-
|
|
3732
|
-
var STORE_HANDLER = Symbol("store.handler");
|
|
3733
|
-
|
|
3734
|
-
var STORE_ARRAY_PROP = Symbol("store.array");
|
|
3735
|
-
|
|
3736
|
-
var getStoreHandler = value => value[STORE_HANDLER];
|
|
3737
|
-
|
|
3738
|
-
var getStoreTarget = value => value?.[STORE_TARGET] || null;
|
|
3739
|
-
|
|
3740
|
-
var unwrapStore = value => getStoreTarget(value) || value;
|
|
3741
|
-
|
|
3742
|
-
var isStore = value => STORE_TARGET in value;
|
|
3743
|
-
|
|
3744
|
-
function createStore(container, obj, flags) {
|
|
3745
|
-
return new Proxy(obj, new StoreHandler(flags, container || null));
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3748
|
-
var getOrCreateStore = (obj, flags, container) => {
|
|
3749
|
-
if (isSerializableObject(obj) && container) {
|
|
3750
|
-
let store = container.$storeProxyMap$.get(obj);
|
|
3751
|
-
if (!store) {
|
|
3752
|
-
store = createStore(container, obj, flags);
|
|
3753
|
-
container.$storeProxyMap$.set(obj, store);
|
|
3754
|
-
}
|
|
3755
|
-
return store;
|
|
3756
|
-
}
|
|
3757
|
-
return obj;
|
|
3758
|
-
};
|
|
3759
|
-
|
|
3760
|
-
var StoreHandler = class {
|
|
3761
|
-
constructor($flags$, $container$) {
|
|
3762
|
-
this.$flags$ = $flags$;
|
|
3763
|
-
this.$container$ = $container$;
|
|
3764
|
-
__publicField(this, "$effects$", null);
|
|
3765
|
-
}
|
|
3766
|
-
toString() {
|
|
3767
|
-
return "[Store]";
|
|
3768
|
-
}
|
|
3769
|
-
get(target, prop) {
|
|
3770
|
-
if ("symbol" === typeof prop) {
|
|
3771
|
-
if (prop === STORE_TARGET) {
|
|
3772
|
-
return target;
|
|
3773
|
-
}
|
|
3774
|
-
if (prop === STORE_HANDLER) {
|
|
3775
|
-
return this;
|
|
3776
|
-
}
|
|
3777
|
-
return target[prop];
|
|
3778
|
-
}
|
|
3779
|
-
const ctx = tryGetInvokeContext();
|
|
3780
|
-
const value = target[prop];
|
|
3781
|
-
if (ctx) {
|
|
3782
|
-
if (null === this.$container$) {
|
|
3783
|
-
if (!ctx.$container$) {
|
|
3784
|
-
return value;
|
|
3785
|
-
}
|
|
3786
|
-
this.$container$ = ctx.$container$;
|
|
3787
|
-
} else {
|
|
3788
|
-
assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$, "Do not use signals across containers");
|
|
3789
|
-
}
|
|
3790
|
-
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3791
|
-
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3792
|
-
}
|
|
3793
|
-
if ("toString" === prop && value === Object.prototype.toString) {
|
|
3794
|
-
return this.toString;
|
|
3795
|
-
}
|
|
3796
|
-
const flags = this.$flags$;
|
|
3797
|
-
if (1 & flags && "object" === typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target)) {
|
|
3798
|
-
return getOrCreateStore(value, this.$flags$, this.$container$);
|
|
3799
|
-
}
|
|
3800
|
-
return value;
|
|
3801
|
-
}
|
|
3802
|
-
set(target, prop, value) {
|
|
3803
|
-
target = unwrapDeserializerProxy(target);
|
|
3804
|
-
if ("symbol" === typeof prop) {
|
|
3805
|
-
target[prop] = value;
|
|
3806
|
-
return true;
|
|
3807
|
-
}
|
|
3808
|
-
const newValue = 1 & this.$flags$ ? unwrapStore(value) : value;
|
|
3809
|
-
if (prop in target) {
|
|
3810
|
-
const oldValue = target[prop];
|
|
3811
|
-
if (newValue !== oldValue) {
|
|
3812
|
-
DEBUG2 && log2("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
|
|
3813
|
-
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
3814
|
-
}
|
|
3815
|
-
} else {
|
|
3816
|
-
DEBUG2 && log2("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
|
|
3817
|
-
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
3818
|
-
}
|
|
3819
|
-
return true;
|
|
3820
|
-
}
|
|
3821
|
-
deleteProperty(target, prop) {
|
|
3822
|
-
if ("string" != typeof prop || !delete target[prop]) {
|
|
3823
|
-
return false;
|
|
3824
|
-
}
|
|
3825
|
-
triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$));
|
|
3826
|
-
return true;
|
|
3827
|
-
}
|
|
3828
|
-
has(target, prop) {
|
|
3829
|
-
if (prop === STORE_TARGET) {
|
|
3830
|
-
return true;
|
|
3831
|
-
}
|
|
3832
|
-
if ("string" === typeof prop) {
|
|
3833
|
-
const ctx = tryGetInvokeContext();
|
|
3834
|
-
if (ctx) {
|
|
3835
|
-
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3836
|
-
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3837
|
-
}
|
|
3838
|
-
}
|
|
3839
|
-
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
3840
|
-
}
|
|
3841
|
-
ownKeys(target) {
|
|
3842
|
-
const ctx = tryGetInvokeContext();
|
|
3843
|
-
const effectSubscriber = ctx?.$effectSubscriber$;
|
|
3844
|
-
effectSubscriber && addEffect(target, STORE_ARRAY_PROP, this, effectSubscriber);
|
|
3845
|
-
return Reflect.ownKeys(target);
|
|
3846
|
-
}
|
|
3847
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
3848
|
-
if (Array.isArray(target) || "symbol" === typeof prop) {
|
|
3849
|
-
return Object.getOwnPropertyDescriptor(target, prop);
|
|
3850
|
-
}
|
|
3851
|
-
return {
|
|
3852
|
-
enumerable: true,
|
|
3853
|
-
configurable: true
|
|
3854
|
-
};
|
|
3855
|
-
}
|
|
3856
|
-
};
|
|
3857
|
-
|
|
3858
|
-
function addEffect(target, prop, store, effectSubscriber) {
|
|
3859
|
-
const effectsMap = store.$effects$ || (store.$effects$ = {});
|
|
3860
|
-
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
3861
|
-
ensureContainsEffect(effects, effectSubscriber);
|
|
3862
|
-
ensureContains(effectSubscriber, target);
|
|
3863
|
-
DEBUG2 && log2("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
3864
|
-
}
|
|
3865
|
-
|
|
3866
|
-
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
3867
|
-
target[prop] = value;
|
|
3868
|
-
triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
|
|
3869
|
-
}
|
|
3870
|
-
|
|
3871
|
-
function getEffects(target, prop, storeEffects) {
|
|
3872
|
-
let effectsToTrigger = storeEffects ? Array.isArray(target) ? Object.values(storeEffects).flatMap((effects => effects)) : storeEffects[prop] : null;
|
|
3873
|
-
const storeArrayValue = storeEffects?.[STORE_ARRAY_PROP];
|
|
3874
|
-
if (storeArrayValue) {
|
|
3875
|
-
effectsToTrigger || (effectsToTrigger = []);
|
|
3876
|
-
effectsToTrigger.push(...storeArrayValue);
|
|
3877
|
-
}
|
|
3878
|
-
return effectsToTrigger;
|
|
3879
|
-
}
|
|
3880
|
-
|
|
3881
|
-
var _createResourceReturn = opts => {
|
|
3882
|
-
const resource = {
|
|
3883
|
-
__brand: "resource",
|
|
3884
|
-
value: void 0,
|
|
3885
|
-
loading: !isServerPlatform(),
|
|
3886
|
-
_resolved: void 0,
|
|
3887
|
-
_error: void 0,
|
|
3888
|
-
_state: "pending",
|
|
3889
|
-
_timeout: opts?.timeout ?? -1,
|
|
3890
|
-
_cache: 0
|
|
3891
|
-
};
|
|
3892
|
-
return resource;
|
|
3638
|
+
return subscriptionRemoved;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
var _createResourceReturn = opts => {
|
|
3642
|
+
const resource = {
|
|
3643
|
+
__brand: "resource",
|
|
3644
|
+
value: void 0,
|
|
3645
|
+
loading: !isServerPlatform(),
|
|
3646
|
+
_resolved: void 0,
|
|
3647
|
+
_error: void 0,
|
|
3648
|
+
_state: "pending",
|
|
3649
|
+
_timeout: opts?.timeout ?? -1,
|
|
3650
|
+
_cache: 0
|
|
3651
|
+
};
|
|
3652
|
+
return resource;
|
|
3893
3653
|
};
|
|
3894
3654
|
|
|
3895
3655
|
var createResourceReturn = (container, opts, initialPromise) => {
|
|
@@ -4000,161 +3760,42 @@ var runResource = (task, container, host) => {
|
|
|
4000
3760
|
|
|
4001
3761
|
var ignoreErrorToPreventNodeFromCrashing = err => {};
|
|
4002
3762
|
|
|
4003
|
-
var
|
|
4004
|
-
[QSlotS]: ""
|
|
4005
|
-
}, props.children, 0, props.name ?? "");
|
|
4006
|
-
|
|
4007
|
-
var SkipRender = Symbol("skip render");
|
|
3763
|
+
var isForeignObjectElement = elementName => "foreignobject" === elementName.toLowerCase();
|
|
4008
3764
|
|
|
4009
|
-
var
|
|
3765
|
+
var isSvgElement = elementName => "svg" === elementName || isForeignObjectElement(elementName);
|
|
4010
3766
|
|
|
4011
|
-
var
|
|
3767
|
+
var isMathElement = elementName => "math" === elementName;
|
|
4012
3768
|
|
|
4013
|
-
var
|
|
3769
|
+
var vnode_isDefaultNamespace = vnode => {
|
|
3770
|
+
const flags = vnode[0];
|
|
3771
|
+
return 0 === (192 & flags);
|
|
3772
|
+
};
|
|
4014
3773
|
|
|
4015
|
-
var
|
|
3774
|
+
var vnode_getElementNamespaceFlags = elementName => isSvgElement(elementName) ? 64 : isMathElement(elementName) ? 128 : 0;
|
|
4016
3775
|
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
return obj.trim();
|
|
4023
|
-
}
|
|
4024
|
-
const classes = [];
|
|
4025
|
-
if (isArray(obj)) {
|
|
4026
|
-
for (const o of obj) {
|
|
4027
|
-
const classList = serializeClass(o);
|
|
4028
|
-
classList && classes.push(classList);
|
|
4029
|
-
}
|
|
3776
|
+
function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
|
|
3777
|
+
const {elementNamespace: elementNamespace, elementNamespaceFlag: elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, newChild);
|
|
3778
|
+
let domChildren = [];
|
|
3779
|
+
if (elementNamespace === HTML_NS) {
|
|
3780
|
+
domChildren = vnode_getDOMChildNodes(journal, newChild);
|
|
4030
3781
|
} else {
|
|
4031
|
-
|
|
4032
|
-
|
|
3782
|
+
const children = vnode_getDOMChildNodes(journal, newChild, true);
|
|
3783
|
+
for (let i = 0; i < children.length; i++) {
|
|
3784
|
+
const childVNode = children[i];
|
|
3785
|
+
if (vnode_isTextVNode(childVNode)) {
|
|
3786
|
+
domChildren.push(childVNode[4]);
|
|
3787
|
+
continue;
|
|
3788
|
+
}
|
|
3789
|
+
if ((192 & childVNode[0]) === (192 & domParentVNode[0])) {
|
|
3790
|
+
domChildren.push(childVNode[6]);
|
|
3791
|
+
continue;
|
|
3792
|
+
}
|
|
3793
|
+
const newChildElement = vnode_cloneElementWithNamespace(childVNode, domParentVNode, elementNamespace, elementNamespaceFlag);
|
|
3794
|
+
newChildElement && domChildren.push(newChildElement);
|
|
4033
3795
|
}
|
|
4034
3796
|
}
|
|
4035
|
-
return
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
|
-
var fromCamelToKebabCaseWithDash = text => text.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
4039
|
-
|
|
4040
|
-
var stringifyStyle = obj => {
|
|
4041
|
-
if (null == obj) {
|
|
4042
|
-
return "";
|
|
4043
|
-
}
|
|
4044
|
-
if ("object" == typeof obj) {
|
|
4045
|
-
if (isArray(obj)) {
|
|
4046
|
-
throw qError(QError_stringifyClassOrStyle, obj, "style");
|
|
4047
|
-
}
|
|
4048
|
-
{
|
|
4049
|
-
const chunks = [];
|
|
4050
|
-
for (const key in obj) {
|
|
4051
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
4052
|
-
const value = obj[key];
|
|
4053
|
-
null != value && "function" !== typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
|
|
4054
|
-
}
|
|
4055
|
-
}
|
|
4056
|
-
return chunks.join(";");
|
|
4057
|
-
}
|
|
4058
|
-
}
|
|
4059
|
-
return String(obj);
|
|
4060
|
-
};
|
|
4061
|
-
|
|
4062
|
-
var serializeBooleanOrNumberAttribute = value => null != value ? String(value) : null;
|
|
4063
|
-
|
|
4064
|
-
function serializeAttribute(key, value, styleScopedId) {
|
|
4065
|
-
if (isClassAttr(key)) {
|
|
4066
|
-
const serializedClass = serializeClass(value);
|
|
4067
|
-
value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
|
|
4068
|
-
} else {
|
|
4069
|
-
"style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" === typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
|
|
4070
|
-
}
|
|
4071
|
-
return value;
|
|
4072
|
-
}
|
|
4073
|
-
|
|
4074
|
-
function isEnumeratedBooleanAttribute(key) {
|
|
4075
|
-
return isAriaAttribute(key) || [ "spellcheck", "draggable", "contenteditable" ].includes(key);
|
|
4076
|
-
}
|
|
4077
|
-
|
|
4078
|
-
var setValueForStyle = (styleName, value) => {
|
|
4079
|
-
if ("number" === typeof value && 0 !== value && !isUnitlessNumber(styleName)) {
|
|
4080
|
-
return value + "px";
|
|
4081
|
-
}
|
|
4082
|
-
return value;
|
|
4083
|
-
};
|
|
4084
|
-
|
|
4085
|
-
function isAriaAttribute(prop) {
|
|
4086
|
-
return prop.startsWith("aria-");
|
|
4087
|
-
}
|
|
4088
|
-
|
|
4089
|
-
var styleContent = styleId => ComponentStylesPrefixContent + styleId;
|
|
4090
|
-
|
|
4091
|
-
function hasClassAttr(props) {
|
|
4092
|
-
for (const key in props) {
|
|
4093
|
-
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
4094
|
-
return true;
|
|
4095
|
-
}
|
|
4096
|
-
}
|
|
4097
|
-
return false;
|
|
4098
|
-
}
|
|
4099
|
-
|
|
4100
|
-
function isClassAttr(key) {
|
|
4101
|
-
return "class" === key || "className" === key;
|
|
4102
|
-
}
|
|
4103
|
-
|
|
4104
|
-
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
4105
|
-
return scopedStyleIds?.split(" ") ?? null;
|
|
4106
|
-
}
|
|
4107
|
-
|
|
4108
|
-
function convertStyleIdsToString(scopedStyleIds) {
|
|
4109
|
-
return Array.from(scopedStyleIds).join(" ");
|
|
4110
|
-
}
|
|
4111
|
-
|
|
4112
|
-
var addComponentStylePrefix = styleId => {
|
|
4113
|
-
if (styleId) {
|
|
4114
|
-
let idx = 0;
|
|
4115
|
-
do {
|
|
4116
|
-
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
4117
|
-
} while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
|
|
4118
|
-
}
|
|
4119
|
-
return styleId || null;
|
|
4120
|
-
};
|
|
4121
|
-
|
|
4122
|
-
var isForeignObjectElement = elementName => "foreignobject" === elementName.toLowerCase();
|
|
4123
|
-
|
|
4124
|
-
var isSvgElement = elementName => "svg" === elementName || isForeignObjectElement(elementName);
|
|
4125
|
-
|
|
4126
|
-
var isMathElement = elementName => "math" === elementName;
|
|
4127
|
-
|
|
4128
|
-
var vnode_isDefaultNamespace = vnode => {
|
|
4129
|
-
const flags = vnode[0];
|
|
4130
|
-
return 0 === (192 & flags);
|
|
4131
|
-
};
|
|
4132
|
-
|
|
4133
|
-
var vnode_getElementNamespaceFlags = elementName => isSvgElement(elementName) ? 64 : isMathElement(elementName) ? 128 : 0;
|
|
4134
|
-
|
|
4135
|
-
function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
|
|
4136
|
-
const {elementNamespace: elementNamespace, elementNamespaceFlag: elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, newChild);
|
|
4137
|
-
let domChildren = [];
|
|
4138
|
-
if (elementNamespace === HTML_NS) {
|
|
4139
|
-
domChildren = vnode_getDOMChildNodes(journal, newChild);
|
|
4140
|
-
} else {
|
|
4141
|
-
const children = vnode_getDOMChildNodes(journal, newChild, true);
|
|
4142
|
-
for (let i = 0; i < children.length; i++) {
|
|
4143
|
-
const childVNode = children[i];
|
|
4144
|
-
if (vnode_isTextVNode(childVNode)) {
|
|
4145
|
-
domChildren.push(childVNode[4]);
|
|
4146
|
-
continue;
|
|
4147
|
-
}
|
|
4148
|
-
if ((192 & childVNode[0]) === (192 & domParentVNode[0])) {
|
|
4149
|
-
domChildren.push(childVNode[6]);
|
|
4150
|
-
continue;
|
|
4151
|
-
}
|
|
4152
|
-
const newChildElement = vnode_cloneElementWithNamespace(childVNode, domParentVNode, elementNamespace, elementNamespaceFlag);
|
|
4153
|
-
newChildElement && domChildren.push(newChildElement);
|
|
4154
|
-
}
|
|
4155
|
-
}
|
|
4156
|
-
return domChildren;
|
|
4157
|
-
}
|
|
3797
|
+
return domChildren;
|
|
3798
|
+
}
|
|
4158
3799
|
|
|
4159
3800
|
function cloneElementWithNamespace(element, elementName, namespace) {
|
|
4160
3801
|
const newElement = element.ownerDocument.createElementNS(namespace, elementName);
|
|
@@ -4302,7 +3943,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
4302
3943
|
container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
|
|
4303
3944
|
container.getHostProp(renderHost, ELEMENT_PROPS) !== props && container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
4304
3945
|
}
|
|
4305
|
-
vnode_isVNode(renderHost) && clearVNodeEffectDependencies(renderHost);
|
|
3946
|
+
vnode_isVNode(renderHost) && clearVNodeEffectDependencies(container, renderHost);
|
|
4306
3947
|
return componentFn(props);
|
|
4307
3948
|
}), (jsx2 => {
|
|
4308
3949
|
const useOnEvents = container.getHostProp(renderHost, USE_ON_LOCAL);
|
|
@@ -4392,6 +4033,14 @@ function addScriptNodeForInvisibleComponents(jsx2) {
|
|
|
4392
4033
|
return null;
|
|
4393
4034
|
}
|
|
4394
4035
|
|
|
4036
|
+
function isSlotProp(prop) {
|
|
4037
|
+
return !prop.startsWith("q:") && !prop.startsWith(NON_SERIALIZABLE_MARKER_PREFIX);
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
function isParentSlotProp(prop) {
|
|
4041
|
+
return prop.startsWith(QSlotParent);
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4395
4044
|
function escapeHTML(html) {
|
|
4396
4045
|
let escapedHTML = "";
|
|
4397
4046
|
const length = html.length;
|
|
@@ -4452,9 +4101,9 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4452
4101
|
if (Array.isArray(jsxValue)) {
|
|
4453
4102
|
descend(jsxValue, false);
|
|
4454
4103
|
} else if (isSignal(jsxValue)) {
|
|
4455
|
-
vCurrent && clearVNodeEffectDependencies(vCurrent);
|
|
4104
|
+
vCurrent && clearVNodeEffectDependencies(container, vCurrent);
|
|
4456
4105
|
expectVirtual("S", null);
|
|
4457
|
-
descend(
|
|
4106
|
+
descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), true);
|
|
4458
4107
|
} else if (isPromise(jsxValue)) {
|
|
4459
4108
|
expectVirtual("A", null);
|
|
4460
4109
|
asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
@@ -4651,7 +4300,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4651
4300
|
if (constProps && "object" == typeof constProps && "name" in constProps) {
|
|
4652
4301
|
const constValue = constProps.name;
|
|
4653
4302
|
if (vHost && constValue instanceof WrappedSignal) {
|
|
4654
|
-
return
|
|
4303
|
+
return trackSignalAndAssignHost(constValue, vHost, ":", container);
|
|
4655
4304
|
}
|
|
4656
4305
|
}
|
|
4657
4306
|
return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
|
|
@@ -4725,11 +4374,11 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4725
4374
|
}
|
|
4726
4375
|
}
|
|
4727
4376
|
if (isSignal(value)) {
|
|
4728
|
-
const signalData = new
|
|
4377
|
+
const signalData = new EffectPropData({
|
|
4729
4378
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
4730
4379
|
$isConst$: true
|
|
4731
4380
|
});
|
|
4732
|
-
value =
|
|
4381
|
+
value = trackSignalAndAssignHost(value, vNewNode, key2, container, signalData);
|
|
4733
4382
|
}
|
|
4734
4383
|
if (key2 === dangerouslySetInnerHTML) {
|
|
4735
4384
|
element.innerHTML = value;
|
|
@@ -4738,7 +4387,9 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4738
4387
|
}
|
|
4739
4388
|
if ("textarea" === elementName && "value" === key2) {
|
|
4740
4389
|
if ("string" !== typeof value) {
|
|
4741
|
-
|
|
4390
|
+
if (isDev) {
|
|
4391
|
+
throw qError(40);
|
|
4392
|
+
}
|
|
4742
4393
|
continue;
|
|
4743
4394
|
}
|
|
4744
4395
|
element.value = escapeHTML(value);
|
|
@@ -4791,9 +4442,9 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4791
4442
|
const eventProp = ":" + scope.substring(1) + ":" + eventName;
|
|
4792
4443
|
const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
|
|
4793
4444
|
let returnValue = false;
|
|
4794
|
-
qrls.flat(2).forEach((
|
|
4795
|
-
if (
|
|
4796
|
-
const value =
|
|
4445
|
+
qrls.flat(2).forEach((qrl => {
|
|
4446
|
+
if (qrl) {
|
|
4447
|
+
const value = qrl(event, element);
|
|
4797
4448
|
returnValue = returnValue || true === value;
|
|
4798
4449
|
}
|
|
4799
4450
|
}));
|
|
@@ -4842,7 +4493,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4842
4493
|
eventName && registerQwikLoaderEvent(eventName);
|
|
4843
4494
|
};
|
|
4844
4495
|
while (null !== srcKey || null !== dstKey) {
|
|
4845
|
-
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey
|
|
4496
|
+
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith(Q_PREFIX)) {
|
|
4846
4497
|
dstIdx++;
|
|
4847
4498
|
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
4848
4499
|
} else if (null == srcKey) {
|
|
@@ -4996,7 +4647,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
4996
4647
|
}
|
|
4997
4648
|
}
|
|
4998
4649
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
4999
|
-
host && clearVNodeEffectDependencies(host);
|
|
4650
|
+
host && clearVNodeEffectDependencies(container, host);
|
|
5000
4651
|
vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
|
|
5001
4652
|
const jsxNode2 = jsxValue;
|
|
5002
4653
|
isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C");
|
|
@@ -5037,8 +4688,8 @@ function getComponentHash(vNode, getObject) {
|
|
|
5037
4688
|
if (null == vNode) {
|
|
5038
4689
|
return null;
|
|
5039
4690
|
}
|
|
5040
|
-
const
|
|
5041
|
-
return
|
|
4691
|
+
const qrl = vnode_getProp(vNode, OnRenderProp, getObject);
|
|
4692
|
+
return qrl ? qrl.$hash$ : null;
|
|
5042
4693
|
}
|
|
5043
4694
|
|
|
5044
4695
|
function Projection() {}
|
|
@@ -5047,8 +4698,8 @@ function propsDiffer(src, dst) {
|
|
|
5047
4698
|
if (!src || !dst) {
|
|
5048
4699
|
return true;
|
|
5049
4700
|
}
|
|
5050
|
-
let srcKeys =
|
|
5051
|
-
let dstKeys =
|
|
4701
|
+
let srcKeys = removePropsKeys(Object.keys(src), [ "children", QSubscribers ]);
|
|
4702
|
+
let dstKeys = removePropsKeys(Object.keys(dst), [ "children", QSubscribers ]);
|
|
5052
4703
|
if (srcKeys.length !== dstKeys.length) {
|
|
5053
4704
|
return true;
|
|
5054
4705
|
}
|
|
@@ -5064,9 +4715,12 @@ function propsDiffer(src, dst) {
|
|
|
5064
4715
|
return false;
|
|
5065
4716
|
}
|
|
5066
4717
|
|
|
5067
|
-
function
|
|
5068
|
-
|
|
5069
|
-
|
|
4718
|
+
function removePropsKeys(keys2, propKeys) {
|
|
4719
|
+
for (let i = propKeys.length - 1; i >= 0; i--) {
|
|
4720
|
+
const propKey = propKeys[i];
|
|
4721
|
+
const propIdx = keys2.indexOf(propKey);
|
|
4722
|
+
-1 !== propIdx && keys2.splice(propIdx, 1);
|
|
4723
|
+
}
|
|
5070
4724
|
return keys2;
|
|
5071
4725
|
}
|
|
5072
4726
|
|
|
@@ -5079,9 +4733,9 @@ function cleanup(container, vNode) {
|
|
|
5079
4733
|
do {
|
|
5080
4734
|
const type = vCursor[0];
|
|
5081
4735
|
if (3 & type) {
|
|
4736
|
+
clearVNodeEffectDependencies(container, vCursor);
|
|
4737
|
+
markVNodeAsDeleted(vCursor);
|
|
5082
4738
|
if (2 & type) {
|
|
5083
|
-
clearVNodeEffectDependencies(vCursor);
|
|
5084
|
-
markVNodeAsDeleted(vCursor);
|
|
5085
4739
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
5086
4740
|
if (seq) {
|
|
5087
4741
|
for (let i = 0; i < seq.length; i++) {
|
|
@@ -5089,7 +4743,7 @@ function cleanup(container, vNode) {
|
|
|
5089
4743
|
if (isTask(obj)) {
|
|
5090
4744
|
const task = obj;
|
|
5091
4745
|
clearSubscriberEffectDependencies(task);
|
|
5092
|
-
1 & task.$flags$ ? container.$scheduler$(
|
|
4746
|
+
1 & task.$flags$ ? container.$scheduler$(48, task) : cleanupTask(task);
|
|
5093
4747
|
}
|
|
5094
4748
|
}
|
|
5095
4749
|
}
|
|
@@ -5173,11 +4827,7 @@ var HANDLER_PREFIX = ":";
|
|
|
5173
4827
|
|
|
5174
4828
|
var count = 0;
|
|
5175
4829
|
|
|
5176
|
-
var
|
|
5177
|
-
return fn.call(null, dollar(first), ...rest);
|
|
5178
|
-
};
|
|
5179
|
-
|
|
5180
|
-
var DEBUG3 = false;
|
|
4830
|
+
var DEBUG2 = false;
|
|
5181
4831
|
|
|
5182
4832
|
var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
5183
4833
|
const choreQueue = [];
|
|
@@ -5185,8 +4835,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5185
4835
|
let journalFlushScheduled = false;
|
|
5186
4836
|
return schedule;
|
|
5187
4837
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
5188
|
-
const runLater =
|
|
5189
|
-
const isTask2 = 3 === type ||
|
|
4838
|
+
const runLater = 255 !== type && 6 !== type;
|
|
4839
|
+
const isTask2 = 3 === type || 32 === type || 2 === type || 48 === type;
|
|
5190
4840
|
isTask2 && (hostOrTask.$flags$ |= 8);
|
|
5191
4841
|
let chore = {
|
|
5192
4842
|
$type$: type,
|
|
@@ -5200,11 +4850,11 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5200
4850
|
$executed$: false
|
|
5201
4851
|
};
|
|
5202
4852
|
chore.$promise$ = new Promise((resolve => chore.$resolve$ = resolve));
|
|
5203
|
-
|
|
4853
|
+
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
5204
4854
|
chore = sortedInsert(choreQueue, chore);
|
|
5205
4855
|
if (!journalFlushScheduled && runLater) {
|
|
5206
4856
|
journalFlushScheduled = true;
|
|
5207
|
-
schedule(
|
|
4857
|
+
schedule(16);
|
|
5208
4858
|
scheduleDrain();
|
|
5209
4859
|
}
|
|
5210
4860
|
return runLater ? chore.$promise$ : drainUpTo(chore);
|
|
@@ -5226,8 +4876,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5226
4876
|
break;
|
|
5227
4877
|
}
|
|
5228
4878
|
const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
|
|
5229
|
-
if (isDeletedVNode &&
|
|
5230
|
-
|
|
4879
|
+
if (isDeletedVNode && 48 !== nextChore.$type$) {
|
|
4880
|
+
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
5231
4881
|
continue;
|
|
5232
4882
|
}
|
|
5233
4883
|
const returnValue = executeChore(nextChore);
|
|
@@ -5240,12 +4890,12 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5240
4890
|
}
|
|
5241
4891
|
function executeChore(chore) {
|
|
5242
4892
|
const host = chore.$host$;
|
|
5243
|
-
|
|
4893
|
+
DEBUG2 && debugTrace("execute", chore, currentChore, choreQueue);
|
|
5244
4894
|
assertEqual(currentChore, null, "Chore already running.");
|
|
5245
4895
|
currentChore = chore;
|
|
5246
4896
|
let returnValue = null;
|
|
5247
4897
|
switch (chore.$type$) {
|
|
5248
|
-
case
|
|
4898
|
+
case 16:
|
|
5249
4899
|
returnValue = journalFlush();
|
|
5250
4900
|
journalFlushScheduled = false;
|
|
5251
4901
|
break;
|
|
@@ -5270,11 +4920,11 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5270
4920
|
returnValue = runTask(chore.$payload$, container, host);
|
|
5271
4921
|
break;
|
|
5272
4922
|
|
|
5273
|
-
case
|
|
4923
|
+
case 32:
|
|
5274
4924
|
returnValue = runTask(chore.$payload$, container, host);
|
|
5275
4925
|
break;
|
|
5276
4926
|
|
|
5277
|
-
case
|
|
4927
|
+
case 48:
|
|
5278
4928
|
const task = chore.$payload$;
|
|
5279
4929
|
cleanupTask(task);
|
|
5280
4930
|
break;
|
|
@@ -5309,9 +4959,23 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
5309
4959
|
returnValue = target.resolved ? null : target.resolve();
|
|
5310
4960
|
break;
|
|
5311
4961
|
}
|
|
4962
|
+
|
|
4963
|
+
case 8:
|
|
4964
|
+
{
|
|
4965
|
+
const target = chore.$target$;
|
|
4966
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
4967
|
+
target.$forceRunEffects$ = false;
|
|
4968
|
+
if (!target.$effects$?.length) {
|
|
4969
|
+
break;
|
|
4970
|
+
}
|
|
4971
|
+
returnValue = retryOnPromise((() => {
|
|
4972
|
+
(target.$computeIfNeeded$() || forceRunEffects) && triggerEffects(container, target, target.$effects$);
|
|
4973
|
+
}));
|
|
4974
|
+
break;
|
|
4975
|
+
}
|
|
5312
4976
|
}
|
|
5313
4977
|
return maybeThenPassError(returnValue, (value => {
|
|
5314
|
-
|
|
4978
|
+
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
5315
4979
|
if (currentChore) {
|
|
5316
4980
|
currentChore.$executed$ = true;
|
|
5317
4981
|
currentChore.$resolve$?.(value);
|
|
@@ -5333,17 +4997,19 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
5333
4997
|
}
|
|
5334
4998
|
|
|
5335
4999
|
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
5336
|
-
const macroTypeDiff = (
|
|
5000
|
+
const macroTypeDiff = (240 & a.$type$) - (240 & b.$type$);
|
|
5337
5001
|
if (0 !== macroTypeDiff) {
|
|
5338
5002
|
return macroTypeDiff;
|
|
5339
5003
|
}
|
|
5340
|
-
if (
|
|
5004
|
+
if (16 !== a.$type$) {
|
|
5341
5005
|
const aHost = a.$host$;
|
|
5342
5006
|
const bHost = b.$host$;
|
|
5343
5007
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
5344
5008
|
if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
|
|
5345
5009
|
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()}`;
|
|
5346
|
-
|
|
5010
|
+
if (shouldThrowOnHostMismatch) {
|
|
5011
|
+
throw qError(45, [ errorMessage ]);
|
|
5012
|
+
}
|
|
5347
5013
|
logWarn(errorMessage);
|
|
5348
5014
|
return null;
|
|
5349
5015
|
}
|
|
@@ -5362,7 +5028,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
5362
5028
|
if (0 !== idxDiff) {
|
|
5363
5029
|
return idxDiff;
|
|
5364
5030
|
}
|
|
5365
|
-
if (a.$target$ !== b.$target$ && (1 === a.$type$ && 1 === b.$type$ || 5 === a.$type$ && 5 === b.$type$)) {
|
|
5031
|
+
if (a.$target$ !== b.$target$ && (1 === a.$type$ && 1 === b.$type$ || 5 === a.$type$ && 5 === b.$type$ || 8 === a.$type$ && 8 === b.$type$)) {
|
|
5366
5032
|
return 1;
|
|
5367
5033
|
}
|
|
5368
5034
|
}
|
|
@@ -5408,11 +5074,11 @@ function debugChoreToString(chore) {
|
|
|
5408
5074
|
5: "NODE_PROP",
|
|
5409
5075
|
7: "COMPONENT",
|
|
5410
5076
|
6: "COMPONENT_SSR",
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5077
|
+
8: "RECOMPUTE_SIGNAL",
|
|
5078
|
+
16: "JOURNAL_FLUSH",
|
|
5079
|
+
32: "VISIBLE",
|
|
5080
|
+
48: "CLEANUP_VISIBLE",
|
|
5081
|
+
255: "WAIT_FOR_ALL"
|
|
5416
5082
|
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
5417
5083
|
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
5418
5084
|
const qrlTarget = chore.$target$?.$symbol$;
|
|
@@ -5429,618 +5095,564 @@ function debugTrace(action, arg, currentChore, queue) {
|
|
|
5429
5095
|
console.log(lines.join("\n ") + "\n");
|
|
5430
5096
|
}
|
|
5431
5097
|
|
|
5432
|
-
var
|
|
5098
|
+
var runTask = (task, container, host) => {
|
|
5099
|
+
task.$flags$ &= -9;
|
|
5100
|
+
cleanupTask(task);
|
|
5101
|
+
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
5102
|
+
iCtx.$container$ = container;
|
|
5103
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(task)));
|
|
5104
|
+
const track = (obj, prop) => {
|
|
5105
|
+
const ctx = newInvokeContext();
|
|
5106
|
+
ctx.$effectSubscriber$ = [ task, ":" ];
|
|
5107
|
+
ctx.$container$ = container;
|
|
5108
|
+
return invoke(ctx, (() => {
|
|
5109
|
+
if (isFunction(obj)) {
|
|
5110
|
+
return obj();
|
|
5111
|
+
}
|
|
5112
|
+
return prop ? obj[prop] : isSignal(obj) ? obj.value : obj;
|
|
5113
|
+
}));
|
|
5114
|
+
};
|
|
5115
|
+
const handleError = reason => container.handleError(reason, host);
|
|
5116
|
+
let cleanupFns = null;
|
|
5117
|
+
const cleanup2 = fn => {
|
|
5118
|
+
if ("function" == typeof fn) {
|
|
5119
|
+
if (!cleanupFns) {
|
|
5120
|
+
cleanupFns = [];
|
|
5121
|
+
task.$destroy$ = noSerialize((() => {
|
|
5122
|
+
task.$destroy$ = null;
|
|
5123
|
+
cleanupFns.forEach((fn2 => {
|
|
5124
|
+
try {
|
|
5125
|
+
fn2();
|
|
5126
|
+
} catch (err) {
|
|
5127
|
+
handleError(err);
|
|
5128
|
+
}
|
|
5129
|
+
}));
|
|
5130
|
+
}));
|
|
5131
|
+
}
|
|
5132
|
+
cleanupFns.push(fn);
|
|
5133
|
+
}
|
|
5134
|
+
};
|
|
5135
|
+
const taskApi = {
|
|
5136
|
+
track: track,
|
|
5137
|
+
cleanup: cleanup2
|
|
5138
|
+
};
|
|
5139
|
+
const result = safeCall((() => taskFn(taskApi)), cleanup2, (err => isPromise(err) ? err.then((() => runTask(task, container, host))) : handleError(err)));
|
|
5140
|
+
return result;
|
|
5141
|
+
};
|
|
5433
5142
|
|
|
5434
|
-
var
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
__publicField(this, "$instanceHash$", null);
|
|
5444
|
-
this.$serverData$ = serverData;
|
|
5445
|
-
this.$locale$ = locale;
|
|
5446
|
-
this.$version$ = version;
|
|
5447
|
-
this.$storeProxyMap$ = new WeakMap;
|
|
5448
|
-
this.$getObjectById$ = _id => {
|
|
5449
|
-
throw Error("Not implemented");
|
|
5450
|
-
};
|
|
5451
|
-
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
5452
|
-
}
|
|
5453
|
-
trackSignalValue(signal, subscriber, property, data) {
|
|
5454
|
-
return trackSignal((() => signal.value), subscriber, property, this, data);
|
|
5455
|
-
}
|
|
5456
|
-
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5457
|
-
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5143
|
+
var cleanupTask = task => {
|
|
5144
|
+
const destroy = task.$destroy$;
|
|
5145
|
+
if (destroy) {
|
|
5146
|
+
task.$destroy$ = null;
|
|
5147
|
+
try {
|
|
5148
|
+
destroy();
|
|
5149
|
+
} catch (err) {
|
|
5150
|
+
logError(err);
|
|
5151
|
+
}
|
|
5458
5152
|
}
|
|
5459
5153
|
};
|
|
5460
5154
|
|
|
5461
|
-
var
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
ADVANCE_8: 36,
|
|
5472
|
-
ADVANCE_16_CH: "%",
|
|
5473
|
-
ADVANCE_16: 37,
|
|
5474
|
-
ADVANCE_32_CH: "&",
|
|
5475
|
-
ADVANCE_32: 38,
|
|
5476
|
-
ADVANCE_64_CH: "'",
|
|
5477
|
-
ADVANCE_64: 39,
|
|
5478
|
-
ADVANCE_128_CH: "(",
|
|
5479
|
-
ADVANCE_128: 40,
|
|
5480
|
-
ADVANCE_256_CH: ")",
|
|
5481
|
-
ADVANCE_256: 41,
|
|
5482
|
-
ADVANCE_512_CH: "*",
|
|
5483
|
-
ADVANCE_512: 42,
|
|
5484
|
-
ADVANCE_1024_CH: "+",
|
|
5485
|
-
ADVANCE_1024: 43,
|
|
5486
|
-
ADVANCE_2048_CH: ",",
|
|
5487
|
-
ADVANCE_2048: 44,
|
|
5488
|
-
ADVANCE_4096_CH: "-",
|
|
5489
|
-
ADVANCE_4096: 45,
|
|
5490
|
-
ADVANCE_8192_CH: ".",
|
|
5491
|
-
ADVANCE_8192: 46
|
|
5155
|
+
var Task = class extends Subscriber {
|
|
5156
|
+
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
5157
|
+
super();
|
|
5158
|
+
this.$flags$ = $flags$;
|
|
5159
|
+
this.$index$ = $index$;
|
|
5160
|
+
this.$el$ = $el$;
|
|
5161
|
+
this.$qrl$ = $qrl$;
|
|
5162
|
+
this.$state$ = $state$;
|
|
5163
|
+
this.$destroy$ = $destroy$;
|
|
5164
|
+
}
|
|
5492
5165
|
};
|
|
5493
5166
|
|
|
5494
|
-
var
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
SLOT_REF: 63,
|
|
5508
|
-
SLOT_REF_CHAR: "?",
|
|
5509
|
-
KEY: 64,
|
|
5510
|
-
KEY_CHAR: "@",
|
|
5511
|
-
SEQ: 91,
|
|
5512
|
-
SEQ_CHAR: "[",
|
|
5513
|
-
DON_T_USE: 93,
|
|
5514
|
-
DON_T_USE_CHAR: "\\",
|
|
5515
|
-
CONTEXT: 93,
|
|
5516
|
-
CONTEXT_CHAR: "]",
|
|
5517
|
-
SEQ_IDX: 94,
|
|
5518
|
-
SEQ_IDX_CHAR: "^",
|
|
5519
|
-
SEPARATOR: 124,
|
|
5520
|
-
SEPARATOR_CHAR: "|",
|
|
5521
|
-
SLOT: 126,
|
|
5522
|
-
SLOT_CHAR: "~"
|
|
5167
|
+
var isTask = value => value instanceof Task;
|
|
5168
|
+
|
|
5169
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
5170
|
+
|
|
5171
|
+
var DEBUG3 = false;
|
|
5172
|
+
|
|
5173
|
+
var log2 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
5174
|
+
|
|
5175
|
+
var throwIfQRLNotResolved = qrl => {
|
|
5176
|
+
const resolved = qrl.resolved;
|
|
5177
|
+
if (!resolved) {
|
|
5178
|
+
throw qrl.resolve();
|
|
5179
|
+
}
|
|
5523
5180
|
};
|
|
5524
5181
|
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
}));
|
|
5556
|
-
element.querySelectorAll("[q\\:shadowroot]").forEach((parent => {
|
|
5557
|
-
const shadowRoot = parent.shadowRoot;
|
|
5558
|
-
shadowRoot && attachVnodeDataAndRefs(shadowRoot);
|
|
5559
|
-
}));
|
|
5560
|
-
};
|
|
5561
|
-
attachVnodeDataAndRefs(document2);
|
|
5562
|
-
let NodeType;
|
|
5563
|
-
(NodeType2 => {
|
|
5564
|
-
NodeType2[NodeType2.CONTAINER_MASK = 1] = "CONTAINER_MASK";
|
|
5565
|
-
NodeType2[NodeType2.ELEMENT = 2] = "ELEMENT";
|
|
5566
|
-
NodeType2[NodeType2.ELEMENT_CONTAINER = 3] = "ELEMENT_CONTAINER";
|
|
5567
|
-
NodeType2[NodeType2.ELEMENT_SHADOW_ROOT = 6] = "ELEMENT_SHADOW_ROOT";
|
|
5568
|
-
NodeType2[NodeType2.COMMENT_SKIP_START = 5] = "COMMENT_SKIP_START";
|
|
5569
|
-
NodeType2[NodeType2.COMMENT_SKIP_END = 8] = "COMMENT_SKIP_END";
|
|
5570
|
-
NodeType2[NodeType2.COMMENT_IGNORE_START = 16] = "COMMENT_IGNORE_START";
|
|
5571
|
-
NodeType2[NodeType2.COMMENT_IGNORE_END = 32] = "COMMENT_IGNORE_END";
|
|
5572
|
-
NodeType2[NodeType2.COMMENT_ISLAND_START = 65] = "COMMENT_ISLAND_START";
|
|
5573
|
-
NodeType2[NodeType2.COMMENT_ISLAND_END = 128] = "COMMENT_ISLAND_END";
|
|
5574
|
-
NodeType2[NodeType2.OTHER = 0] = "OTHER";
|
|
5575
|
-
})(NodeType || (NodeType = {}));
|
|
5576
|
-
const getFastNodeType = node => {
|
|
5577
|
-
const nodeType = getNodeType.call(node);
|
|
5578
|
-
if (1 === nodeType) {
|
|
5579
|
-
const qContainer = getAttribute.call(node, Q_CONTAINER);
|
|
5580
|
-
if (null === qContainer) {
|
|
5581
|
-
if (hasAttribute.call(node, Q_SHADOW_ROOT)) {
|
|
5582
|
-
return 6;
|
|
5182
|
+
var isSignal = value => value instanceof Signal;
|
|
5183
|
+
|
|
5184
|
+
var EffectPropData = class {
|
|
5185
|
+
constructor(data) {
|
|
5186
|
+
__publicField(this, "data");
|
|
5187
|
+
this.data = data;
|
|
5188
|
+
}
|
|
5189
|
+
};
|
|
5190
|
+
|
|
5191
|
+
var Signal = class {
|
|
5192
|
+
constructor(container, value) {
|
|
5193
|
+
__publicField(this, "$untrackedValue$");
|
|
5194
|
+
__publicField(this, "$effects$", null);
|
|
5195
|
+
__publicField(this, "$container$", null);
|
|
5196
|
+
this.$container$ = container;
|
|
5197
|
+
this.$untrackedValue$ = value;
|
|
5198
|
+
DEBUG3 && log2("new", this);
|
|
5199
|
+
}
|
|
5200
|
+
get untrackedValue() {
|
|
5201
|
+
return this.$untrackedValue$;
|
|
5202
|
+
}
|
|
5203
|
+
set untrackedValue(value) {
|
|
5204
|
+
this.$untrackedValue$ = value;
|
|
5205
|
+
}
|
|
5206
|
+
get value() {
|
|
5207
|
+
const ctx = tryGetInvokeContext();
|
|
5208
|
+
if (ctx) {
|
|
5209
|
+
if (null === this.$container$) {
|
|
5210
|
+
if (!ctx.$container$) {
|
|
5211
|
+
return this.untrackedValue;
|
|
5583
5212
|
}
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
return 3;
|
|
5588
|
-
}
|
|
5589
|
-
if (8 === nodeType) {
|
|
5590
|
-
const nodeValue = node.nodeValue || "";
|
|
5591
|
-
if (nodeValue.startsWith(Q_CONTAINER_ISLAND)) {
|
|
5592
|
-
return 65;
|
|
5593
|
-
}
|
|
5594
|
-
if (nodeValue.startsWith(Q_IGNORE)) {
|
|
5595
|
-
return 16;
|
|
5596
|
-
}
|
|
5597
|
-
if (nodeValue.startsWith(Q_CONTAINER)) {
|
|
5598
|
-
return 5;
|
|
5599
|
-
}
|
|
5600
|
-
if (nodeValue.startsWith(Q_CONTAINER_ISLAND_END)) {
|
|
5601
|
-
return 128;
|
|
5602
|
-
}
|
|
5603
|
-
if (nodeValue.startsWith(Q_IGNORE_END)) {
|
|
5604
|
-
return 32;
|
|
5213
|
+
this.$container$ = ctx.$container$;
|
|
5214
|
+
} else {
|
|
5215
|
+
assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$, "Do not use signals across containers");
|
|
5605
5216
|
}
|
|
5606
|
-
|
|
5607
|
-
|
|
5217
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
5218
|
+
if (effectSubscriber) {
|
|
5219
|
+
const effects = this.$effects$ || (this.$effects$ = []);
|
|
5220
|
+
ensureContainsEffect(effects, effectSubscriber);
|
|
5221
|
+
ensureContains(effectSubscriber, this);
|
|
5222
|
+
isSubscriber(this) && ensureEffectContainsSubscriber(effectSubscriber[0], this, this.$container$);
|
|
5223
|
+
DEBUG3 && log2("read->sub", pad("\n" + this.toString(), " "));
|
|
5608
5224
|
}
|
|
5609
5225
|
}
|
|
5610
|
-
return
|
|
5611
|
-
}
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
break;
|
|
5618
|
-
}
|
|
5619
|
-
{
|
|
5620
|
-
const ch = vData.charCodeAt(start);
|
|
5621
|
-
if (0 === depth && isSeparator(ch)) {
|
|
5622
|
-
break;
|
|
5623
|
-
}
|
|
5624
|
-
ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--;
|
|
5625
|
-
start++;
|
|
5626
|
-
}
|
|
5226
|
+
return this.untrackedValue;
|
|
5227
|
+
}
|
|
5228
|
+
set value(value) {
|
|
5229
|
+
if (value !== this.$untrackedValue$) {
|
|
5230
|
+
DEBUG3 && log2("Signal.set", this.$untrackedValue$, "->", value, pad("\n" + this.toString(), " "));
|
|
5231
|
+
this.$untrackedValue$ = value;
|
|
5232
|
+
triggerEffects(this.$container$, this, this.$effects$);
|
|
5627
5233
|
}
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
}
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
let elementIdx = 0;
|
|
5641
|
-
let vNodeElementIndex = -1;
|
|
5642
|
-
let vData_start = 0;
|
|
5643
|
-
let vData_end = 0;
|
|
5644
|
-
let ch = 0;
|
|
5645
|
-
let needsToStoreRef = -1;
|
|
5646
|
-
let nextNode = null;
|
|
5647
|
-
const howManyElementsToSkip = () => {
|
|
5648
|
-
let elementsToSkip = 0;
|
|
5649
|
-
while (isSeparator(ch = vData.charCodeAt(vData_start))) {
|
|
5650
|
-
elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1;
|
|
5651
|
-
vData_start++;
|
|
5652
|
-
if (vData_start >= vData_length) {
|
|
5653
|
-
break;
|
|
5654
|
-
}
|
|
5655
|
-
}
|
|
5656
|
-
return elementsToSkip;
|
|
5234
|
+
}
|
|
5235
|
+
valueOf() {
|
|
5236
|
+
if (qDev) {
|
|
5237
|
+
throw qError(46);
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
toString() {
|
|
5241
|
+
return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (this.$effects$?.map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "");
|
|
5242
|
+
}
|
|
5243
|
+
toJSON() {
|
|
5244
|
+
return {
|
|
5245
|
+
value: this.$untrackedValue$
|
|
5657
5246
|
};
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
return;
|
|
5661
|
-
}
|
|
5662
|
-
nextNode = null;
|
|
5663
|
-
const nodeType = node == containerNode ? 2 : getFastNodeType(node);
|
|
5664
|
-
if (3 === nodeType) {
|
|
5665
|
-
const container = node;
|
|
5666
|
-
let cursor = node;
|
|
5667
|
-
while (cursor && !(nextNode = nextSibling(cursor))) {
|
|
5668
|
-
cursor = cursor.parentNode;
|
|
5669
|
-
}
|
|
5670
|
-
walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs, prefix + " ");
|
|
5671
|
-
} else if (16 === nodeType) {
|
|
5672
|
-
let islandNode = node;
|
|
5673
|
-
do {
|
|
5674
|
-
islandNode = walker2.nextNode();
|
|
5675
|
-
if (!islandNode) {
|
|
5676
|
-
throw new Error(`Island inside \x3c!--${node?.nodeValue}--\x3e not found!`);
|
|
5677
|
-
}
|
|
5678
|
-
} while (65 !== getFastNodeType(islandNode));
|
|
5679
|
-
nextNode = null;
|
|
5680
|
-
} else if (128 === nodeType) {
|
|
5681
|
-
nextNode = node;
|
|
5682
|
-
do {
|
|
5683
|
-
nextNode = walker2.nextNode();
|
|
5684
|
-
if (!nextNode) {
|
|
5685
|
-
throw new Error("Ignore block not closed!");
|
|
5686
|
-
}
|
|
5687
|
-
} while (32 !== getFastNodeType(nextNode));
|
|
5688
|
-
nextNode = null;
|
|
5689
|
-
} else if (5 === nodeType) {
|
|
5690
|
-
nextNode = node;
|
|
5691
|
-
do {
|
|
5692
|
-
nextNode = nextSibling(nextNode);
|
|
5693
|
-
if (!nextNode) {
|
|
5694
|
-
throw new Error(`\x3c!--${node?.nodeValue}--\x3e not closed!`);
|
|
5695
|
-
}
|
|
5696
|
-
} while (8 !== getFastNodeType(nextNode));
|
|
5697
|
-
walkContainer(walker2, node, node, nextNode, "", null, prefix + " ");
|
|
5698
|
-
} else if (6 === nodeType) {
|
|
5699
|
-
nextNode = nextSibling(node);
|
|
5700
|
-
const shadowRootContainer = node;
|
|
5701
|
-
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
5702
|
-
shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null, prefix + " ");
|
|
5703
|
-
}
|
|
5704
|
-
if (2 === (2 & nodeType)) {
|
|
5705
|
-
if (vNodeElementIndex < elementIdx) {
|
|
5706
|
-
-1 === vNodeElementIndex && (vNodeElementIndex = 0);
|
|
5707
|
-
vData_start = vData_end;
|
|
5708
|
-
if (vData_start < vData_length) {
|
|
5709
|
-
vNodeElementIndex += howManyElementsToSkip();
|
|
5710
|
-
const shouldStoreRef = ch === VNodeDataSeparator.REFERENCE;
|
|
5711
|
-
if (shouldStoreRef) {
|
|
5712
|
-
needsToStoreRef = vNodeElementIndex;
|
|
5713
|
-
vData_start++;
|
|
5714
|
-
ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1;
|
|
5715
|
-
}
|
|
5716
|
-
vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
|
|
5717
|
-
} else {
|
|
5718
|
-
vNodeElementIndex = Number.MAX_SAFE_INTEGER;
|
|
5719
|
-
}
|
|
5720
|
-
}
|
|
5721
|
-
if (elementIdx === vNodeElementIndex) {
|
|
5722
|
-
needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
|
|
5723
|
-
const instructions = vData.substring(vData_start, vData_end);
|
|
5724
|
-
vNodeDataMap.set(node, instructions);
|
|
5725
|
-
}
|
|
5726
|
-
elementIdx++;
|
|
5727
|
-
}
|
|
5728
|
-
} while (node = nextNode || walker2.nextNode());
|
|
5729
|
-
};
|
|
5730
|
-
const walker = document2.createTreeWalker(document2, 129);
|
|
5731
|
-
walkContainer(walker, null, walker.firstChild(), null, "", null, "");
|
|
5732
|
-
}
|
|
5247
|
+
}
|
|
5248
|
+
};
|
|
5733
5249
|
|
|
5734
|
-
|
|
5735
|
-
const
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
}
|
|
5250
|
+
var ensureContains = (array, value) => {
|
|
5251
|
+
const isMissing = -1 === array.indexOf(value);
|
|
5252
|
+
isMissing && array.push(value);
|
|
5253
|
+
};
|
|
5739
5254
|
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5255
|
+
var ensureContainsEffect = (array, effectSubscriptions) => {
|
|
5256
|
+
for (let i = 0; i < array.length; i++) {
|
|
5257
|
+
const existingEffect = array[i];
|
|
5258
|
+
if (existingEffect[0] === effectSubscriptions[0] && existingEffect[1] === effectSubscriptions[1]) {
|
|
5259
|
+
return;
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
array.push(effectSubscriptions);
|
|
5263
|
+
};
|
|
5264
|
+
|
|
5265
|
+
var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
5266
|
+
if (isSubscriber(effect)) {
|
|
5267
|
+
effect.$effectDependencies$ || (effect.$effectDependencies$ = []);
|
|
5268
|
+
if (subscriberExistInSubscribers(effect.$effectDependencies$, subscriber)) {
|
|
5269
|
+
return;
|
|
5270
|
+
}
|
|
5271
|
+
effect.$effectDependencies$.push(subscriber);
|
|
5272
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
5273
|
+
let subscribers = vnode_getProp(effect, QSubscribers, container ? container.$getObjectById$ : null);
|
|
5274
|
+
subscribers || (subscribers = []);
|
|
5275
|
+
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
subscribers.push(subscriber);
|
|
5279
|
+
vnode_setProp(effect, QSubscribers, subscribers);
|
|
5280
|
+
} else if (isSSRNode(effect)) {
|
|
5281
|
+
let subscribers = effect.getProp(QSubscribers);
|
|
5282
|
+
subscribers || (subscribers = []);
|
|
5283
|
+
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
5284
|
+
return;
|
|
5285
|
+
}
|
|
5286
|
+
subscribers.push(subscriber);
|
|
5287
|
+
effect.setProp(QSubscribers, subscribers);
|
|
5288
|
+
}
|
|
5289
|
+
};
|
|
5290
|
+
|
|
5291
|
+
var isSSRNode = effect => "setProp" in effect && "getProp" in effect && "removeProp" in effect && "id" in effect;
|
|
5292
|
+
|
|
5293
|
+
var subscriberExistInSubscribers = (subscribers, subscriber) => {
|
|
5294
|
+
for (let i = 0; i < subscribers.length; i++) {
|
|
5295
|
+
if (subscribers[i] === subscriber) {
|
|
5296
|
+
return true;
|
|
5297
|
+
}
|
|
5298
|
+
}
|
|
5299
|
+
return false;
|
|
5300
|
+
};
|
|
5301
|
+
|
|
5302
|
+
var triggerEffects = (container, signal, effects) => {
|
|
5303
|
+
if (effects) {
|
|
5304
|
+
const scheduleEffect = effectSubscriptions => {
|
|
5305
|
+
const effect = effectSubscriptions[0];
|
|
5306
|
+
const property = effectSubscriptions[1];
|
|
5307
|
+
assertDefined(container, "Container must be defined.");
|
|
5308
|
+
if (isTask(effect)) {
|
|
5309
|
+
effect.$flags$ |= 8;
|
|
5310
|
+
DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
5311
|
+
let choreType = 3;
|
|
5312
|
+
1 & effect.$flags$ ? choreType = 32 : 4 & effect.$flags$ && (choreType = 2);
|
|
5313
|
+
container.$scheduler$(choreType, effect);
|
|
5314
|
+
} else if (effect instanceof Signal) {
|
|
5315
|
+
effect instanceof ComputedSignal && (effect.$computeQrl$.resolved || container.$scheduler$(1, null, effect.$computeQrl$));
|
|
5316
|
+
effect.$invalidate$();
|
|
5317
|
+
} else if (":" === property) {
|
|
5318
|
+
const host = effect;
|
|
5319
|
+
const qrl = container.getHostProp(host, OnRenderProp);
|
|
5320
|
+
assertDefined(qrl, "Component must have QRL");
|
|
5321
|
+
const props = container.getHostProp(host, ELEMENT_PROPS);
|
|
5322
|
+
container.$scheduler$(7, host, qrl, props);
|
|
5323
|
+
} else if ("." === property) {
|
|
5324
|
+
const host = effect;
|
|
5325
|
+
const target = host;
|
|
5326
|
+
container.$scheduler$(4, host, target, signal);
|
|
5327
|
+
} else {
|
|
5328
|
+
const host = effect;
|
|
5329
|
+
const effectData = effectSubscriptions[2];
|
|
5330
|
+
if (effectData instanceof EffectPropData) {
|
|
5331
|
+
const data = effectData.data;
|
|
5332
|
+
const payload = {
|
|
5333
|
+
...data,
|
|
5334
|
+
$value$: signal
|
|
5335
|
+
};
|
|
5336
|
+
container.$scheduler$(5, host, property, payload);
|
|
5755
5337
|
}
|
|
5756
5338
|
}
|
|
5339
|
+
};
|
|
5340
|
+
effects.forEach(scheduleEffect);
|
|
5341
|
+
}
|
|
5342
|
+
DEBUG3 && log2("done scheduling");
|
|
5343
|
+
};
|
|
5344
|
+
|
|
5345
|
+
var ComputedSignal = class extends Signal {
|
|
5346
|
+
constructor(container, fn) {
|
|
5347
|
+
super(container, NEEDS_COMPUTATION);
|
|
5348
|
+
__publicField(this, "$computeQrl$");
|
|
5349
|
+
__publicField(this, "$invalid$", true);
|
|
5350
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
5351
|
+
this.$computeQrl$ = fn;
|
|
5352
|
+
}
|
|
5353
|
+
$invalidate$() {
|
|
5354
|
+
this.$invalid$ = true;
|
|
5355
|
+
this.$forceRunEffects$ = false;
|
|
5356
|
+
this.$container$?.$scheduler$(8, null, this);
|
|
5357
|
+
}
|
|
5358
|
+
force() {
|
|
5359
|
+
this.$invalid$ = true;
|
|
5360
|
+
this.$forceRunEffects$ = false;
|
|
5361
|
+
triggerEffects(this.$container$, this, this.$effects$);
|
|
5362
|
+
}
|
|
5363
|
+
get untrackedValue() {
|
|
5364
|
+
const didChange = this.$computeIfNeeded$();
|
|
5365
|
+
didChange && (this.$forceRunEffects$ = didChange);
|
|
5366
|
+
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
5367
|
+
return this.$untrackedValue$;
|
|
5368
|
+
}
|
|
5369
|
+
$computeIfNeeded$() {
|
|
5370
|
+
if (!this.$invalid$) {
|
|
5371
|
+
return false;
|
|
5372
|
+
}
|
|
5373
|
+
const computeQrl = this.$computeQrl$;
|
|
5374
|
+
throwIfQRLNotResolved(computeQrl);
|
|
5375
|
+
const ctx = tryGetInvokeContext();
|
|
5376
|
+
const previousEffectSubscription = ctx?.$effectSubscriber$;
|
|
5377
|
+
ctx && (ctx.$effectSubscriber$ = [ this, "." ]);
|
|
5378
|
+
try {
|
|
5379
|
+
const untrackedValue = computeQrl.getFn(ctx)();
|
|
5380
|
+
if (isPromise(untrackedValue)) {
|
|
5381
|
+
throw qError(47, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
|
|
5382
|
+
}
|
|
5383
|
+
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
5384
|
+
this.$invalid$ = false;
|
|
5385
|
+
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
5386
|
+
didChange && (this.$untrackedValue$ = untrackedValue);
|
|
5387
|
+
return didChange;
|
|
5388
|
+
} finally {
|
|
5389
|
+
ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
|
|
5757
5390
|
}
|
|
5758
|
-
container.$serverData$ = {
|
|
5759
|
-
containerAttributes: containerAttributes
|
|
5760
|
-
};
|
|
5761
|
-
qElement.setAttribute(QContainerAttr, "resumed");
|
|
5762
|
-
qElement.qContainer = container;
|
|
5763
5391
|
}
|
|
5764
|
-
|
|
5765
|
-
|
|
5392
|
+
get value() {
|
|
5393
|
+
return super.value;
|
|
5394
|
+
}
|
|
5395
|
+
set value(_) {
|
|
5396
|
+
throw qError(48);
|
|
5397
|
+
}
|
|
5398
|
+
};
|
|
5766
5399
|
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5400
|
+
var WrappedSignal = class extends Signal {
|
|
5401
|
+
constructor(container, fn, args, fnStr) {
|
|
5402
|
+
super(container, NEEDS_COMPUTATION);
|
|
5403
|
+
__publicField(this, "$args$");
|
|
5404
|
+
__publicField(this, "$func$");
|
|
5405
|
+
__publicField(this, "$funcStr$");
|
|
5406
|
+
__publicField(this, "$invalid$", true);
|
|
5407
|
+
__publicField(this, "$effectDependencies$", null);
|
|
5408
|
+
__publicField(this, "$hostElement$", null);
|
|
5409
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
5410
|
+
this.$args$ = args;
|
|
5411
|
+
this.$func$ = fn;
|
|
5412
|
+
this.$funcStr$ = fnStr;
|
|
5413
|
+
}
|
|
5414
|
+
$invalidate$() {
|
|
5415
|
+
this.$invalid$ = true;
|
|
5416
|
+
this.$forceRunEffects$ = false;
|
|
5417
|
+
this.$container$?.$scheduler$(8, this.$hostElement$, this);
|
|
5418
|
+
}
|
|
5419
|
+
force() {
|
|
5420
|
+
this.$invalid$ = true;
|
|
5421
|
+
this.$forceRunEffects$ = false;
|
|
5422
|
+
triggerEffects(this.$container$, this, this.$effects$);
|
|
5423
|
+
}
|
|
5424
|
+
get untrackedValue() {
|
|
5425
|
+
const didChange = this.$computeIfNeeded$();
|
|
5426
|
+
didChange && (this.$forceRunEffects$ = didChange);
|
|
5427
|
+
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
5428
|
+
return this.$untrackedValue$;
|
|
5429
|
+
}
|
|
5430
|
+
$computeIfNeeded$() {
|
|
5431
|
+
if (!this.$invalid$) {
|
|
5432
|
+
return false;
|
|
5433
|
+
}
|
|
5434
|
+
const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, ".", this.$container$);
|
|
5435
|
+
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
5436
|
+
didChange && (this.$untrackedValue$ = untrackedValue);
|
|
5437
|
+
return didChange;
|
|
5438
|
+
}
|
|
5439
|
+
get value() {
|
|
5440
|
+
return super.value;
|
|
5441
|
+
}
|
|
5442
|
+
set value(_) {
|
|
5443
|
+
throw qError(49);
|
|
5444
|
+
}
|
|
5445
|
+
};
|
|
5771
5446
|
|
|
5772
|
-
var
|
|
5447
|
+
var version = "2.0.0-alpha.4-dev+374e0d6";
|
|
5773
5448
|
|
|
5774
|
-
var
|
|
5775
|
-
constructor(
|
|
5776
|
-
|
|
5777
|
-
__publicField(this, "
|
|
5778
|
-
__publicField(this, "
|
|
5779
|
-
__publicField(this, "
|
|
5780
|
-
__publicField(this, "
|
|
5781
|
-
__publicField(this, "
|
|
5782
|
-
__publicField(this, "
|
|
5783
|
-
__publicField(this, "$
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
__publicField(this, "$renderCount$", 0);
|
|
5793
|
-
__publicField(this, "$getObjectById$", (id => {
|
|
5794
|
-
"string" === typeof id && (id = parseFloat(id));
|
|
5795
|
-
assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`);
|
|
5796
|
-
return this.stateData[id];
|
|
5797
|
-
}));
|
|
5798
|
-
this.qContainer = element.getAttribute(QContainerAttr);
|
|
5799
|
-
this.qContainer || throwErrorAndStop("Element must have 'q:container' attribute.");
|
|
5800
|
-
this.$journal$ = [ 3, element.ownerDocument ];
|
|
5801
|
-
this.document = element.ownerDocument;
|
|
5802
|
-
this.element = element;
|
|
5803
|
-
this.qBase = element.getAttribute(QBaseAttr);
|
|
5804
|
-
this.$instanceHash$ = element.getAttribute(QInstanceAttr);
|
|
5805
|
-
this.qManifestHash = element.getAttribute("q:manifest-hash");
|
|
5806
|
-
this.rootVNode = vnode_newUnMaterializedElement(this.element);
|
|
5807
|
-
this.$rawStateData$ = null;
|
|
5808
|
-
this.stateData = null;
|
|
5809
|
-
const document2 = this.element.ownerDocument;
|
|
5810
|
-
document2.qVNodeData || processVNodeData(document2);
|
|
5811
|
-
this.$rawStateData$ = [];
|
|
5812
|
-
this.stateData = [];
|
|
5813
|
-
const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
|
|
5814
|
-
if (0 !== qwikStates.length) {
|
|
5815
|
-
const lastState = qwikStates[qwikStates.length - 1];
|
|
5816
|
-
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
5817
|
-
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
5818
|
-
}
|
|
5819
|
-
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
5449
|
+
var _SharedContainer = class {
|
|
5450
|
+
constructor(scheduleDrain, journalFlush, serverData, locale) {
|
|
5451
|
+
__publicField(this, "$version$");
|
|
5452
|
+
__publicField(this, "$scheduler$");
|
|
5453
|
+
__publicField(this, "$storeProxyMap$");
|
|
5454
|
+
__publicField(this, "$locale$");
|
|
5455
|
+
__publicField(this, "$getObjectById$");
|
|
5456
|
+
__publicField(this, "$serverData$");
|
|
5457
|
+
__publicField(this, "$currentUniqueId$", 0);
|
|
5458
|
+
__publicField(this, "$instanceHash$", null);
|
|
5459
|
+
this.$serverData$ = serverData;
|
|
5460
|
+
this.$locale$ = locale;
|
|
5461
|
+
this.$version$ = version;
|
|
5462
|
+
this.$storeProxyMap$ = new WeakMap;
|
|
5463
|
+
this.$getObjectById$ = _id => {
|
|
5464
|
+
throw Error("Not implemented");
|
|
5465
|
+
};
|
|
5466
|
+
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
5820
5467
|
}
|
|
5821
|
-
|
|
5822
|
-
this
|
|
5468
|
+
trackSignalValue(signal, subscriber, property, data) {
|
|
5469
|
+
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
5823
5470
|
}
|
|
5824
|
-
|
|
5825
|
-
return
|
|
5471
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5472
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5826
5473
|
}
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5474
|
+
};
|
|
5475
|
+
|
|
5476
|
+
var QObjectRecursive = 1;
|
|
5477
|
+
|
|
5478
|
+
var QObjectImmutable = 2;
|
|
5479
|
+
|
|
5480
|
+
var QObjectTargetSymbol = Symbol("proxy target");
|
|
5481
|
+
|
|
5482
|
+
var QObjectFlagsSymbol = Symbol("proxy flags");
|
|
5483
|
+
|
|
5484
|
+
var QObjectManagerSymbol = Symbol("proxy manager");
|
|
5485
|
+
|
|
5486
|
+
var _CONST_PROPS = Symbol("CONST");
|
|
5487
|
+
|
|
5488
|
+
var _VAR_PROPS = Symbol("VAR");
|
|
5489
|
+
|
|
5490
|
+
var _IMMUTABLE = Symbol("IMMUTABLE");
|
|
5491
|
+
|
|
5492
|
+
var componentQrl = componentQrl2 => {
|
|
5493
|
+
function QwikComponent(props, key, flags = 0) {
|
|
5494
|
+
assertQrl(componentQrl2);
|
|
5495
|
+
assertNumber(flags, "The Qwik Component was not invoked correctly");
|
|
5496
|
+
const hash = qTest ? "sX" : componentQrl2.$hash$.slice(0, 4);
|
|
5497
|
+
const finalKey = hash + ":" + (key || "");
|
|
5498
|
+
const InnerCmp = () => {};
|
|
5499
|
+
InnerCmp[SERIALIZABLE_STATE] = [ componentQrl2 ];
|
|
5500
|
+
return _jsxSplit(InnerCmp, props, null, props.children, flags, finalKey);
|
|
5501
|
+
}
|
|
5502
|
+
QwikComponent[SERIALIZABLE_STATE] = [ componentQrl2 ];
|
|
5503
|
+
return QwikComponent;
|
|
5504
|
+
};
|
|
5505
|
+
|
|
5506
|
+
var SERIALIZABLE_STATE = Symbol("serializable-data");
|
|
5507
|
+
|
|
5508
|
+
var isQwikComponent = component => "function" == typeof component && void 0 !== component[SERIALIZABLE_STATE];
|
|
5509
|
+
|
|
5510
|
+
var _jsxSorted = (type, varProps, constProps, children, flags, key, dev) => {
|
|
5511
|
+
const processed = null == key ? null : String(key);
|
|
5512
|
+
const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
|
|
5513
|
+
qDev && dev && (node.dev = {
|
|
5514
|
+
stack: (new Error).stack,
|
|
5515
|
+
...dev
|
|
5516
|
+
});
|
|
5517
|
+
seal(node);
|
|
5518
|
+
return node;
|
|
5519
|
+
};
|
|
5520
|
+
|
|
5521
|
+
var _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
5522
|
+
let sortedProps;
|
|
5523
|
+
sortedProps = varProps ? Object.fromEntries(untrack((() => Object.entries(varProps))).filter((entry => {
|
|
5524
|
+
const attr = entry[0];
|
|
5525
|
+
if ("children" === attr) {
|
|
5526
|
+
children ?? (children = entry[1]);
|
|
5527
|
+
return false;
|
|
5846
5528
|
}
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5529
|
+
if ("key" === attr) {
|
|
5530
|
+
key = entry[1];
|
|
5531
|
+
return false;
|
|
5850
5532
|
}
|
|
5851
|
-
|
|
5852
|
-
}
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
mapArray_set(ctx, context.id, value, 0);
|
|
5533
|
+
return !constProps || !(attr in constProps) || /^on[A-Z].*\$$/.test(attr);
|
|
5534
|
+
})).sort((([a], [b]) => a < b ? -1 : 1))) : "string" === typeof type ? EMPTY_OBJ : {};
|
|
5535
|
+
if (constProps && "children" in constProps) {
|
|
5536
|
+
children = constProps.children;
|
|
5537
|
+
constProps.children = void 0;
|
|
5857
5538
|
}
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5539
|
+
return _jsxSorted(type, sortedProps, constProps, children, flags, key, dev);
|
|
5540
|
+
};
|
|
5541
|
+
|
|
5542
|
+
var isPropsProxy = obj => obj && void 0 !== obj[_VAR_PROPS];
|
|
5543
|
+
|
|
5544
|
+
var JSXNodeImpl = class {
|
|
5545
|
+
constructor(type, varProps, constProps, children, flags, key = null) {
|
|
5546
|
+
this.type = type;
|
|
5547
|
+
this.varProps = varProps;
|
|
5548
|
+
this.constProps = constProps;
|
|
5549
|
+
this.children = children;
|
|
5550
|
+
this.flags = flags;
|
|
5551
|
+
this.key = key;
|
|
5552
|
+
__publicField(this, "dev");
|
|
5553
|
+
__publicField(this, "_proxy", null);
|
|
5554
|
+
if (qDev) {
|
|
5555
|
+
if ("object" !== typeof varProps) {
|
|
5556
|
+
throw new Error("JSXNodeImpl: varProps must be objects: " + JSON.stringify(varProps));
|
|
5866
5557
|
}
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
return;
|
|
5870
|
-
}
|
|
5871
|
-
getParentHost(host) {
|
|
5872
|
-
let vNode = vnode_getParent(host);
|
|
5873
|
-
while (vNode) {
|
|
5874
|
-
if (vnode_isVirtualVNode(vNode)) {
|
|
5875
|
-
if (null !== vnode_getProp(vNode, OnRenderProp, null)) {
|
|
5876
|
-
return vNode;
|
|
5877
|
-
}
|
|
5878
|
-
const parent = vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5879
|
-
if (parent) {
|
|
5880
|
-
vNode = parent;
|
|
5881
|
-
continue;
|
|
5882
|
-
}
|
|
5558
|
+
if ("object" !== typeof constProps) {
|
|
5559
|
+
throw new Error("JSXNodeImpl: constProps must be objects: " + JSON.stringify(constProps));
|
|
5883
5560
|
}
|
|
5884
|
-
vNode = vnode_getParent(vNode);
|
|
5885
5561
|
}
|
|
5886
|
-
return null;
|
|
5887
5562
|
}
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5563
|
+
get props() {
|
|
5564
|
+
this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children));
|
|
5565
|
+
return this._proxy;
|
|
5891
5566
|
}
|
|
5892
|
-
|
|
5893
|
-
const vNode = host;
|
|
5894
|
-
let getObjectById = null;
|
|
5895
|
-
switch (name) {
|
|
5896
|
-
case ELEMENT_SEQ:
|
|
5897
|
-
case ELEMENT_PROPS:
|
|
5898
|
-
case OnRenderProp:
|
|
5899
|
-
case QCtxAttr:
|
|
5900
|
-
case QSubscribers:
|
|
5901
|
-
getObjectById = this.$getObjectById$;
|
|
5902
|
-
break;
|
|
5567
|
+
};
|
|
5903
5568
|
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5569
|
+
var Virtual = props => props.children;
|
|
5570
|
+
|
|
5571
|
+
var isJSXNode = n => {
|
|
5572
|
+
if (qDev) {
|
|
5573
|
+
if (n instanceof JSXNodeImpl) {
|
|
5574
|
+
return true;
|
|
5908
5575
|
}
|
|
5909
|
-
|
|
5576
|
+
if (isObject(n) && "key" in n && "props" in n && "type" in n) {
|
|
5577
|
+
logWarn('Duplicate implementations of "JSXNode" found');
|
|
5578
|
+
return true;
|
|
5579
|
+
}
|
|
5580
|
+
return false;
|
|
5910
5581
|
}
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5582
|
+
return n instanceof JSXNodeImpl;
|
|
5583
|
+
};
|
|
5584
|
+
|
|
5585
|
+
var Fragment = props => props.children;
|
|
5586
|
+
|
|
5587
|
+
function createPropsProxy(varProps, constProps, children) {
|
|
5588
|
+
return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
|
|
5589
|
+
}
|
|
5590
|
+
|
|
5591
|
+
var PropsProxyHandler = class {
|
|
5592
|
+
constructor($varProps$, $constProps$, $children$) {
|
|
5593
|
+
this.$varProps$ = $varProps$;
|
|
5594
|
+
this.$constProps$ = $constProps$;
|
|
5595
|
+
this.$children$ = $children$;
|
|
5915
5596
|
}
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
if (isPromise(result)) {
|
|
5920
|
-
return result.then((async () => {
|
|
5921
|
-
while (renderCount !== this.$renderCount$) {
|
|
5922
|
-
renderCount = this.$renderCount$;
|
|
5923
|
-
await this.$scheduler$(127);
|
|
5924
|
-
}
|
|
5925
|
-
this.renderDone = null;
|
|
5926
|
-
}));
|
|
5597
|
+
get(_, prop) {
|
|
5598
|
+
if (prop === _CONST_PROPS) {
|
|
5599
|
+
return this.$constProps$;
|
|
5927
5600
|
}
|
|
5928
|
-
if (
|
|
5929
|
-
this
|
|
5930
|
-
return;
|
|
5601
|
+
if (prop === _VAR_PROPS) {
|
|
5602
|
+
return this.$varProps$;
|
|
5931
5603
|
}
|
|
5932
|
-
this
|
|
5933
|
-
|
|
5934
|
-
ensureProjectionResolved(vNode) {
|
|
5935
|
-
if (0 === (16 & vNode[0])) {
|
|
5936
|
-
vNode[0] |= 16;
|
|
5937
|
-
for (let i = vnode_getPropStartIndex(vNode); i < vNode.length; i += 2) {
|
|
5938
|
-
const prop = vNode[i];
|
|
5939
|
-
if (isSlotProp(prop)) {
|
|
5940
|
-
const value = vNode[i + 1];
|
|
5941
|
-
"string" == typeof value && (vNode[i + 1] = this.$vnodeLocate$(value));
|
|
5942
|
-
}
|
|
5943
|
-
}
|
|
5604
|
+
if (null != this.$children$ && "children" === prop) {
|
|
5605
|
+
return this.$children$;
|
|
5944
5606
|
}
|
|
5607
|
+
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
5608
|
+
return value instanceof WrappedSignal ? value.value : value;
|
|
5945
5609
|
}
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
}
|
|
5951
|
-
$appendStyle$(content, styleId, host, scoped) {
|
|
5952
|
-
if (scoped) {
|
|
5953
|
-
const scopedStyleIdsString = this.getHostProp(host, QScopedStyle);
|
|
5954
|
-
const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
|
|
5955
|
-
scopedStyleIds.add(styleId);
|
|
5956
|
-
this.setHostProp(host, QScopedStyle, convertStyleIdsToString(scopedStyleIds));
|
|
5610
|
+
set(_, prop, value) {
|
|
5611
|
+
if (prop === _CONST_PROPS) {
|
|
5612
|
+
this.$constProps$ = value;
|
|
5613
|
+
return true;
|
|
5957
5614
|
}
|
|
5958
|
-
if (
|
|
5959
|
-
this.$
|
|
5960
|
-
|
|
5961
|
-
this.$styleIds$.add(style.getAttribute(QStyle));
|
|
5962
|
-
}));
|
|
5615
|
+
if (prop === _VAR_PROPS) {
|
|
5616
|
+
this.$varProps$ = value;
|
|
5617
|
+
return true;
|
|
5963
5618
|
}
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5619
|
+
this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value;
|
|
5620
|
+
return true;
|
|
5621
|
+
}
|
|
5622
|
+
deleteProperty(_, prop) {
|
|
5623
|
+
if ("string" !== typeof prop) {
|
|
5624
|
+
return false;
|
|
5970
5625
|
}
|
|
5626
|
+
let didDelete = delete this.$varProps$[prop];
|
|
5627
|
+
this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete);
|
|
5628
|
+
null != this.$children$ && "children" === prop && (this.$children$ = null);
|
|
5629
|
+
return didDelete;
|
|
5971
5630
|
}
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
};
|
|
5991
|
-
const handleError = reason => container.handleError(reason, host);
|
|
5992
|
-
let cleanupFns = null;
|
|
5993
|
-
const cleanup2 = fn => {
|
|
5994
|
-
if ("function" == typeof fn) {
|
|
5995
|
-
if (!cleanupFns) {
|
|
5996
|
-
cleanupFns = [];
|
|
5997
|
-
task.$destroy$ = noSerialize((() => {
|
|
5998
|
-
task.$destroy$ = null;
|
|
5999
|
-
cleanupFns.forEach((fn2 => {
|
|
6000
|
-
try {
|
|
6001
|
-
fn2();
|
|
6002
|
-
} catch (err) {
|
|
6003
|
-
handleError(err);
|
|
6004
|
-
}
|
|
6005
|
-
}));
|
|
6006
|
-
}));
|
|
5631
|
+
has(_, prop) {
|
|
5632
|
+
const hasProp = "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
|
|
5633
|
+
return hasProp;
|
|
5634
|
+
}
|
|
5635
|
+
getOwnPropertyDescriptor(target, p) {
|
|
5636
|
+
const value = "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p];
|
|
5637
|
+
return {
|
|
5638
|
+
configurable: true,
|
|
5639
|
+
enumerable: true,
|
|
5640
|
+
value: value
|
|
5641
|
+
};
|
|
5642
|
+
}
|
|
5643
|
+
ownKeys() {
|
|
5644
|
+
const out = Object.keys(this.$varProps$);
|
|
5645
|
+
null != this.$children$ && -1 === out.indexOf("children") && out.push("children");
|
|
5646
|
+
if (this.$constProps$) {
|
|
5647
|
+
for (const key in this.$constProps$) {
|
|
5648
|
+
-1 === out.indexOf(key) && out.push(key);
|
|
6007
5649
|
}
|
|
6008
|
-
cleanupFns.push(fn);
|
|
6009
|
-
}
|
|
6010
|
-
};
|
|
6011
|
-
const taskApi = {
|
|
6012
|
-
track: track,
|
|
6013
|
-
cleanup: cleanup2
|
|
6014
|
-
};
|
|
6015
|
-
const result = safeCall((() => taskFn(taskApi)), cleanup2, (err => isPromise(err) ? err.then((() => runTask(task, container, host))) : handleError(err)));
|
|
6016
|
-
return result;
|
|
6017
|
-
};
|
|
6018
|
-
|
|
6019
|
-
var cleanupTask = task => {
|
|
6020
|
-
const destroy = task.$destroy$;
|
|
6021
|
-
if (destroy) {
|
|
6022
|
-
task.$destroy$ = null;
|
|
6023
|
-
try {
|
|
6024
|
-
destroy();
|
|
6025
|
-
} catch (err) {
|
|
6026
|
-
logError(err);
|
|
6027
5650
|
}
|
|
5651
|
+
return out;
|
|
6028
5652
|
}
|
|
6029
5653
|
};
|
|
6030
5654
|
|
|
6031
|
-
var
|
|
6032
|
-
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
6033
|
-
super();
|
|
6034
|
-
this.$flags$ = $flags$;
|
|
6035
|
-
this.$index$ = $index$;
|
|
6036
|
-
this.$el$ = $el$;
|
|
6037
|
-
this.$qrl$ = $qrl$;
|
|
6038
|
-
this.$state$ = $state$;
|
|
6039
|
-
this.$destroy$ = $destroy$;
|
|
6040
|
-
}
|
|
6041
|
-
};
|
|
6042
|
-
|
|
6043
|
-
var isTask = value => value instanceof Task2;
|
|
5655
|
+
var directGetPropsProxyProp = (jsx2, prop) => jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
|
|
6044
5656
|
|
|
6045
5657
|
var stringifyPath = [];
|
|
6046
5658
|
|
|
@@ -6116,6 +5728,72 @@ var jsxToString = value => {
|
|
|
6116
5728
|
return String(value);
|
|
6117
5729
|
};
|
|
6118
5730
|
|
|
5731
|
+
var VNodeDataSeparator = {
|
|
5732
|
+
REFERENCE_CH: "~",
|
|
5733
|
+
REFERENCE: 126,
|
|
5734
|
+
ADVANCE_1_CH: "!",
|
|
5735
|
+
ADVANCE_1: 33,
|
|
5736
|
+
ADVANCE_2_CH: '"',
|
|
5737
|
+
ADVANCE_2: 34,
|
|
5738
|
+
ADVANCE_4_CH: "#",
|
|
5739
|
+
ADVANCE_4: 35,
|
|
5740
|
+
ADVANCE_8_CH: "$",
|
|
5741
|
+
ADVANCE_8: 36,
|
|
5742
|
+
ADVANCE_16_CH: "%",
|
|
5743
|
+
ADVANCE_16: 37,
|
|
5744
|
+
ADVANCE_32_CH: "&",
|
|
5745
|
+
ADVANCE_32: 38,
|
|
5746
|
+
ADVANCE_64_CH: "'",
|
|
5747
|
+
ADVANCE_64: 39,
|
|
5748
|
+
ADVANCE_128_CH: "(",
|
|
5749
|
+
ADVANCE_128: 40,
|
|
5750
|
+
ADVANCE_256_CH: ")",
|
|
5751
|
+
ADVANCE_256: 41,
|
|
5752
|
+
ADVANCE_512_CH: "*",
|
|
5753
|
+
ADVANCE_512: 42,
|
|
5754
|
+
ADVANCE_1024_CH: "+",
|
|
5755
|
+
ADVANCE_1024: 43,
|
|
5756
|
+
ADVANCE_2048_CH: ",",
|
|
5757
|
+
ADVANCE_2048: 44,
|
|
5758
|
+
ADVANCE_4096_CH: "-",
|
|
5759
|
+
ADVANCE_4096: 45,
|
|
5760
|
+
ADVANCE_8192_CH: ".",
|
|
5761
|
+
ADVANCE_8192: 46
|
|
5762
|
+
};
|
|
5763
|
+
|
|
5764
|
+
var VNodeDataChar = {
|
|
5765
|
+
OPEN: 123,
|
|
5766
|
+
OPEN_CHAR: "{",
|
|
5767
|
+
CLOSE: 125,
|
|
5768
|
+
CLOSE_CHAR: "}",
|
|
5769
|
+
SCOPED_STYLE: 59,
|
|
5770
|
+
SCOPED_STYLE_CHAR: ";",
|
|
5771
|
+
RENDER_FN: 60,
|
|
5772
|
+
RENDER_FN_CHAR: "<",
|
|
5773
|
+
ID: 61,
|
|
5774
|
+
ID_CHAR: "=",
|
|
5775
|
+
PROPS: 62,
|
|
5776
|
+
PROPS_CHAR: ">",
|
|
5777
|
+
SLOT_REF: 63,
|
|
5778
|
+
SLOT_REF_CHAR: "?",
|
|
5779
|
+
KEY: 64,
|
|
5780
|
+
KEY_CHAR: "@",
|
|
5781
|
+
SEQ: 91,
|
|
5782
|
+
SEQ_CHAR: "[",
|
|
5783
|
+
DON_T_USE: 92,
|
|
5784
|
+
DON_T_USE_CHAR: "\\",
|
|
5785
|
+
CONTEXT: 93,
|
|
5786
|
+
CONTEXT_CHAR: "]",
|
|
5787
|
+
SEQ_IDX: 94,
|
|
5788
|
+
SEQ_IDX_CHAR: "^",
|
|
5789
|
+
SUBS: 96,
|
|
5790
|
+
SUBS_CHAR: "`",
|
|
5791
|
+
SEPARATOR: 124,
|
|
5792
|
+
SEPARATOR_CHAR: "|",
|
|
5793
|
+
SLOT: 126,
|
|
5794
|
+
SLOT_CHAR: "~"
|
|
5795
|
+
};
|
|
5796
|
+
|
|
6119
5797
|
var vnode_newElement = (element, elementName) => {
|
|
6120
5798
|
assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
6121
5799
|
const vnode = VNodeArray.createElement(-247, null, null, null, null, null, element, elementName);
|
|
@@ -6688,10 +6366,30 @@ var vnode_materialize = vNode => {
|
|
|
6688
6366
|
const element = vNode[6];
|
|
6689
6367
|
const firstChild = fastFirstChild(element);
|
|
6690
6368
|
const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
|
|
6691
|
-
const vFirstChild =
|
|
6369
|
+
const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
|
|
6692
6370
|
return vFirstChild;
|
|
6693
6371
|
};
|
|
6694
6372
|
|
|
6373
|
+
var materialize = (vNode, element, firstChild, vNodeData) => {
|
|
6374
|
+
if (vNodeData) {
|
|
6375
|
+
if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
|
|
6376
|
+
const elementVNodeDataStartIdx = 1;
|
|
6377
|
+
let elementVNodeDataEndIdx = 1;
|
|
6378
|
+
while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
|
|
6379
|
+
elementVNodeDataEndIdx++;
|
|
6380
|
+
}
|
|
6381
|
+
const elementVNodeData = vNodeData.substring(elementVNodeDataStartIdx, elementVNodeDataEndIdx);
|
|
6382
|
+
vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
|
|
6383
|
+
const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
|
|
6384
|
+
if (!vNodeData) {
|
|
6385
|
+
return vFirstChild;
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6388
|
+
return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
|
|
6389
|
+
}
|
|
6390
|
+
return materializeFromDOM(vNode, firstChild);
|
|
6391
|
+
};
|
|
6392
|
+
|
|
6695
6393
|
var ensureMaterialized = vnode => {
|
|
6696
6394
|
const vParent = ensureElementVNode(vnode);
|
|
6697
6395
|
let vFirstChild = vParent[4];
|
|
@@ -6803,7 +6501,7 @@ var fastGetter = (prototype, name) => {
|
|
|
6803
6501
|
|
|
6804
6502
|
var isQStyleElement = node => isElement(node) && "STYLE" === node.nodeName && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
|
|
6805
6503
|
|
|
6806
|
-
var materializeFromDOM = (vParent, firstChild) => {
|
|
6504
|
+
var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
6807
6505
|
let vFirstChild = null;
|
|
6808
6506
|
const skipStyleElements = () => {
|
|
6809
6507
|
while (isQStyleElement(child)) {
|
|
@@ -6829,9 +6527,46 @@ var materializeFromDOM = (vParent, firstChild) => {
|
|
|
6829
6527
|
}
|
|
6830
6528
|
vParent[5] = vChild || null;
|
|
6831
6529
|
vParent[4] = vFirstChild;
|
|
6530
|
+
if (vData) {
|
|
6531
|
+
let container = null;
|
|
6532
|
+
processVNodeData(vData, ((peek, consumeValue) => {
|
|
6533
|
+
if (peek() === VNodeDataChar.ID) {
|
|
6534
|
+
container || (container = getDomContainer(vParent[6]));
|
|
6535
|
+
const id = consumeValue();
|
|
6536
|
+
container.$setRawState$(parseInt(id), vParent);
|
|
6537
|
+
isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
6538
|
+
} else {
|
|
6539
|
+
peek() === VNodeDataChar.SUBS ? vnode_setProp(vParent, QSubscribers, consumeValue()) : consumeValue();
|
|
6540
|
+
}
|
|
6541
|
+
}));
|
|
6542
|
+
}
|
|
6832
6543
|
return vFirstChild;
|
|
6833
6544
|
};
|
|
6834
6545
|
|
|
6546
|
+
var processVNodeData = (vData, callback) => {
|
|
6547
|
+
let nextToConsumeIdx = 0;
|
|
6548
|
+
let ch = 0;
|
|
6549
|
+
let peekCh = 0;
|
|
6550
|
+
const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
6551
|
+
const consume = () => {
|
|
6552
|
+
ch = peek();
|
|
6553
|
+
peekCh = 0;
|
|
6554
|
+
nextToConsumeIdx++;
|
|
6555
|
+
return ch;
|
|
6556
|
+
};
|
|
6557
|
+
const consumeValue = () => {
|
|
6558
|
+
consume();
|
|
6559
|
+
const start = nextToConsumeIdx;
|
|
6560
|
+
while (peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
6561
|
+
consume();
|
|
6562
|
+
}
|
|
6563
|
+
return vData.substring(start, nextToConsumeIdx);
|
|
6564
|
+
};
|
|
6565
|
+
while (0 !== peek()) {
|
|
6566
|
+
callback(peek, consumeValue, consume, nextToConsumeIdx);
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
|
|
6835
6570
|
var vnode_getNextSibling = vnode => vnode[3];
|
|
6836
6571
|
|
|
6837
6572
|
var vnode_getPreviousSibling = vnode => vnode[2];
|
|
@@ -6908,7 +6643,7 @@ var vnode_getPropStartIndex = vnode => {
|
|
|
6908
6643
|
if (2 === type) {
|
|
6909
6644
|
return 6;
|
|
6910
6645
|
}
|
|
6911
|
-
throw
|
|
6646
|
+
throw qError(43, [ type ]);
|
|
6912
6647
|
};
|
|
6913
6648
|
|
|
6914
6649
|
var vnode_getParent = vnode => vnode[1] || null;
|
|
@@ -6924,7 +6659,7 @@ var vnode_getNode = vnode => {
|
|
|
6924
6659
|
return vnode[4];
|
|
6925
6660
|
};
|
|
6926
6661
|
|
|
6927
|
-
function vnode_toString(depth = 10, offset = "",
|
|
6662
|
+
function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
|
|
6928
6663
|
let vnode = this;
|
|
6929
6664
|
if (0 === depth) {
|
|
6930
6665
|
return "...";
|
|
@@ -6972,7 +6707,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
|
|
|
6972
6707
|
-1 === keys2.indexOf(attr.name) && attrs.push(" " + attr.name + (attr.value ? "=" + qwikDebugToString(attr.value) : ""));
|
|
6973
6708
|
}
|
|
6974
6709
|
strings.push("<" + tag + attrs.join("") + ">");
|
|
6975
|
-
if (vnode_isMaterialized(vnode) ||
|
|
6710
|
+
if (vnode_isMaterialized(vnode) || materialize2) {
|
|
6976
6711
|
const child = vnode_getFirstChild(vnode);
|
|
6977
6712
|
child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
|
|
6978
6713
|
} else {
|
|
@@ -6993,19 +6728,9 @@ var stack = [];
|
|
|
6993
6728
|
|
|
6994
6729
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
6995
6730
|
let idx = 0;
|
|
6996
|
-
let nextToConsumeIdx = 0;
|
|
6997
6731
|
let vFirst = null;
|
|
6998
6732
|
let vLast = null;
|
|
6999
6733
|
let previousTextNode = null;
|
|
7000
|
-
let ch = 0;
|
|
7001
|
-
let peekCh = 0;
|
|
7002
|
-
const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
7003
|
-
const consume = () => {
|
|
7004
|
-
ch = peek();
|
|
7005
|
-
peekCh = 0;
|
|
7006
|
-
nextToConsumeIdx++;
|
|
7007
|
-
return ch;
|
|
7008
|
-
};
|
|
7009
6734
|
const addVNode = node => {
|
|
7010
6735
|
node[0] = 255 & node[0] | idx << 8;
|
|
7011
6736
|
idx++;
|
|
@@ -7015,22 +6740,16 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
7015
6740
|
vFirst || (vParent[4] = vFirst = node);
|
|
7016
6741
|
vLast = node;
|
|
7017
6742
|
};
|
|
7018
|
-
const consumeValue = () => {
|
|
7019
|
-
consume();
|
|
7020
|
-
const start = nextToConsumeIdx;
|
|
7021
|
-
while (peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
7022
|
-
consume();
|
|
7023
|
-
}
|
|
7024
|
-
return vData.substring(start, nextToConsumeIdx);
|
|
7025
|
-
};
|
|
7026
6743
|
let textIdx = 0;
|
|
7027
6744
|
let combinedText = null;
|
|
7028
6745
|
let container = null;
|
|
7029
|
-
|
|
6746
|
+
processVNodeData(vData, ((peek, consumeValue, consume, nextToConsumeIdx) => {
|
|
7030
6747
|
if (isNumber(peek())) {
|
|
7031
6748
|
while (!isElement(child)) {
|
|
7032
6749
|
child = fastNextSibling(child);
|
|
7033
|
-
|
|
6750
|
+
if (!child) {
|
|
6751
|
+
throw qError(44, [ vData, peek(), nextToConsumeIdx ]);
|
|
6752
|
+
}
|
|
7034
6753
|
}
|
|
7035
6754
|
while (isQStyleElement(child)) {
|
|
7036
6755
|
child = fastNextSibling(child);
|
|
@@ -7065,6 +6784,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
7065
6784
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
7066
6785
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
7067
6786
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
6787
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
6788
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
7068
6789
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
7069
6790
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
7070
6791
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -7104,7 +6825,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
7104
6825
|
addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text));
|
|
7105
6826
|
textIdx += length;
|
|
7106
6827
|
}
|
|
7107
|
-
}
|
|
6828
|
+
}));
|
|
7108
6829
|
vParent[5] = vLast;
|
|
7109
6830
|
return vFirst;
|
|
7110
6831
|
}
|
|
@@ -7120,440 +6841,639 @@ var vnode_getType = vnode => {
|
|
|
7120
6841
|
if (4 & type) {
|
|
7121
6842
|
return 3;
|
|
7122
6843
|
}
|
|
7123
|
-
throw
|
|
6844
|
+
throw qError(43, [ type ]);
|
|
6845
|
+
};
|
|
6846
|
+
|
|
6847
|
+
var isElement = node => node && "object" == typeof node && 1 === fastNodeType(node);
|
|
6848
|
+
|
|
6849
|
+
var aPath = [];
|
|
6850
|
+
|
|
6851
|
+
var bPath = [];
|
|
6852
|
+
|
|
6853
|
+
var vnode_documentPosition = (a, b) => {
|
|
6854
|
+
if (a === b) {
|
|
6855
|
+
return 0;
|
|
6856
|
+
}
|
|
6857
|
+
let aDepth = -1;
|
|
6858
|
+
let bDepth = -1;
|
|
6859
|
+
while (a) {
|
|
6860
|
+
a = (aPath[++aDepth] = a)[1];
|
|
6861
|
+
}
|
|
6862
|
+
while (b) {
|
|
6863
|
+
b = (bPath[++bDepth] = b)[1];
|
|
6864
|
+
}
|
|
6865
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
6866
|
+
a = aPath[aDepth];
|
|
6867
|
+
b = bPath[bDepth];
|
|
6868
|
+
if (a !== b) {
|
|
6869
|
+
let cursor = b;
|
|
6870
|
+
do {
|
|
6871
|
+
cursor = vnode_getNextSibling(cursor);
|
|
6872
|
+
if (cursor === a) {
|
|
6873
|
+
return 1;
|
|
6874
|
+
}
|
|
6875
|
+
} while (cursor);
|
|
6876
|
+
cursor = b;
|
|
6877
|
+
do {
|
|
6878
|
+
cursor = vnode_getPreviousSibling(cursor);
|
|
6879
|
+
if (cursor === a) {
|
|
6880
|
+
return -1;
|
|
6881
|
+
}
|
|
6882
|
+
} while (cursor);
|
|
6883
|
+
return 1;
|
|
6884
|
+
}
|
|
6885
|
+
aDepth--;
|
|
6886
|
+
bDepth--;
|
|
6887
|
+
}
|
|
6888
|
+
return aDepth < bDepth ? -1 : 1;
|
|
6889
|
+
};
|
|
6890
|
+
|
|
6891
|
+
var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
6892
|
+
let projectionDepth = 1;
|
|
6893
|
+
while (projectionDepth--) {
|
|
6894
|
+
while (vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, OnRenderProp, null))) {
|
|
6895
|
+
const qSlotParentProp = vnode_getProp(vHost, QSlotParent, null);
|
|
6896
|
+
const qSlotParent = qSlotParentProp && ("string" === typeof qSlotParentProp ? vnode_locate(rootVNode, qSlotParentProp) : qSlotParentProp);
|
|
6897
|
+
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
6898
|
+
vProjectionParent && projectionDepth++;
|
|
6899
|
+
vHost = vProjectionParent || vnode_getParent(vHost);
|
|
6900
|
+
}
|
|
6901
|
+
projectionDepth > 0 && (vHost = vnode_getParent(vHost));
|
|
6902
|
+
}
|
|
6903
|
+
return vHost;
|
|
6904
|
+
};
|
|
6905
|
+
|
|
6906
|
+
var VNodeArray = class VNode extends Array {
|
|
6907
|
+
static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
|
|
6908
|
+
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
6909
|
+
vnode.push(firstChild, lastChild, element, elementName);
|
|
6910
|
+
return vnode;
|
|
6911
|
+
}
|
|
6912
|
+
static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
|
|
6913
|
+
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
6914
|
+
vnode.push(textNode, text);
|
|
6915
|
+
return vnode;
|
|
6916
|
+
}
|
|
6917
|
+
static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
|
|
6918
|
+
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
6919
|
+
vnode.push(firstChild, lastChild);
|
|
6920
|
+
return vnode;
|
|
6921
|
+
}
|
|
6922
|
+
constructor(flags, parent, previousSibling, nextSibling) {
|
|
6923
|
+
super();
|
|
6924
|
+
this.push(flags, parent, previousSibling, nextSibling);
|
|
6925
|
+
isDev && (this.toString = vnode_toString);
|
|
6926
|
+
}
|
|
6927
|
+
};
|
|
6928
|
+
|
|
6929
|
+
var _context;
|
|
6930
|
+
|
|
6931
|
+
var tryGetInvokeContext = () => {
|
|
6932
|
+
if (!_context) {
|
|
6933
|
+
const context = "undefined" !== typeof document && document && document.__q_context__;
|
|
6934
|
+
if (!context) {
|
|
6935
|
+
return;
|
|
6936
|
+
}
|
|
6937
|
+
if (isArray(context)) {
|
|
6938
|
+
return document.__q_context__ = newInvokeContextFromTuple(context);
|
|
6939
|
+
}
|
|
6940
|
+
return context;
|
|
6941
|
+
}
|
|
6942
|
+
return _context;
|
|
6943
|
+
};
|
|
6944
|
+
|
|
6945
|
+
function invoke(context, fn, ...args) {
|
|
6946
|
+
return invokeApply.call(this, context, fn, args);
|
|
6947
|
+
}
|
|
6948
|
+
|
|
6949
|
+
function invokeApply(context, fn, args) {
|
|
6950
|
+
const previousContext = _context;
|
|
6951
|
+
let returnValue;
|
|
6952
|
+
try {
|
|
6953
|
+
_context = context;
|
|
6954
|
+
returnValue = fn.apply(this, args);
|
|
6955
|
+
} finally {
|
|
6956
|
+
_context = previousContext;
|
|
6957
|
+
}
|
|
6958
|
+
return returnValue;
|
|
6959
|
+
}
|
|
6960
|
+
|
|
6961
|
+
var newInvokeContextFromTuple = ([element, event, url]) => {
|
|
6962
|
+
const container = element.closest(QContainerSelector);
|
|
6963
|
+
const locale = container?.getAttribute(QLocaleAttr) || void 0;
|
|
6964
|
+
locale && setLocale(locale);
|
|
6965
|
+
return newInvokeContext(locale, void 0, element, event, url);
|
|
6966
|
+
};
|
|
6967
|
+
|
|
6968
|
+
var newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
6969
|
+
const $locale$ = locale || ("object" === typeof event && event && "locale" in event ? event.locale : void 0);
|
|
6970
|
+
const ctx = {
|
|
6971
|
+
$url$: url,
|
|
6972
|
+
$i$: 0,
|
|
6973
|
+
$hostElement$: hostElement,
|
|
6974
|
+
$element$: element,
|
|
6975
|
+
$event$: event,
|
|
6976
|
+
$qrl$: void 0,
|
|
6977
|
+
$effectSubscriber$: void 0,
|
|
6978
|
+
$locale$: $locale$,
|
|
6979
|
+
$container$: void 0
|
|
6980
|
+
};
|
|
6981
|
+
seal(ctx);
|
|
6982
|
+
return ctx;
|
|
6983
|
+
};
|
|
6984
|
+
|
|
6985
|
+
var untrack = fn => invoke(void 0, fn);
|
|
6986
|
+
|
|
6987
|
+
var trackInvocation = newInvokeContext(void 0, void 0, void 0, RenderEvent);
|
|
6988
|
+
|
|
6989
|
+
var trackSignal = (fn, subscriber, property, container, data) => {
|
|
6990
|
+
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
6991
|
+
const previousContainer = trackInvocation.$container$;
|
|
6992
|
+
try {
|
|
6993
|
+
trackInvocation.$effectSubscriber$ = [ subscriber, property ];
|
|
6994
|
+
data && trackInvocation.$effectSubscriber$.push(data);
|
|
6995
|
+
trackInvocation.$container$ = container;
|
|
6996
|
+
return invoke(trackInvocation, fn);
|
|
6997
|
+
} finally {
|
|
6998
|
+
trackInvocation.$effectSubscriber$ = previousSubscriber;
|
|
6999
|
+
trackInvocation.$container$ = previousContainer;
|
|
7000
|
+
}
|
|
7124
7001
|
};
|
|
7125
7002
|
|
|
7126
|
-
var
|
|
7003
|
+
var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
7004
|
+
value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host);
|
|
7005
|
+
return trackSignal((() => value.value), host, property, container, data);
|
|
7006
|
+
};
|
|
7127
7007
|
|
|
7128
|
-
var
|
|
7008
|
+
var createContextId = name => {
|
|
7009
|
+
assertTrue(/^[\w/.-]+$/.test(name), "Context name must only contain A-Z,a-z,0-9, _", name);
|
|
7010
|
+
return Object.freeze({
|
|
7011
|
+
id: fromCamelToKebabCase(name)
|
|
7012
|
+
});
|
|
7013
|
+
};
|
|
7129
7014
|
|
|
7130
|
-
var
|
|
7015
|
+
var ERROR_CONTEXT = createContextId("qk-error");
|
|
7131
7016
|
|
|
7132
|
-
var
|
|
7133
|
-
if (
|
|
7134
|
-
return
|
|
7135
|
-
}
|
|
7136
|
-
let aDepth = -1;
|
|
7137
|
-
let bDepth = -1;
|
|
7138
|
-
while (a) {
|
|
7139
|
-
a = (aPath[++aDepth] = a)[1];
|
|
7140
|
-
}
|
|
7141
|
-
while (b) {
|
|
7142
|
-
b = (bPath[++bDepth] = b)[1];
|
|
7143
|
-
}
|
|
7144
|
-
while (aDepth >= 0 && bDepth >= 0) {
|
|
7145
|
-
a = aPath[aDepth];
|
|
7146
|
-
b = bPath[bDepth];
|
|
7147
|
-
if (a !== b) {
|
|
7148
|
-
let cursor = b;
|
|
7149
|
-
do {
|
|
7150
|
-
cursor = vnode_getNextSibling(cursor);
|
|
7151
|
-
if (cursor === a) {
|
|
7152
|
-
return 1;
|
|
7153
|
-
}
|
|
7154
|
-
} while (cursor);
|
|
7155
|
-
cursor = b;
|
|
7156
|
-
do {
|
|
7157
|
-
cursor = vnode_getPreviousSibling(cursor);
|
|
7158
|
-
if (cursor === a) {
|
|
7159
|
-
return -1;
|
|
7160
|
-
}
|
|
7161
|
-
} while (cursor);
|
|
7162
|
-
return 1;
|
|
7163
|
-
}
|
|
7164
|
-
aDepth--;
|
|
7165
|
-
bDepth--;
|
|
7017
|
+
var isRecoverable = err => {
|
|
7018
|
+
if (err && err instanceof Error && "plugin" in err) {
|
|
7019
|
+
return false;
|
|
7166
7020
|
}
|
|
7167
|
-
return
|
|
7021
|
+
return true;
|
|
7168
7022
|
};
|
|
7169
7023
|
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7024
|
+
function processVNodeData2(document2) {
|
|
7025
|
+
const Q_CONTAINER = "q:container";
|
|
7026
|
+
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
7027
|
+
const Q_PROPS_SEPARATOR2 = ":";
|
|
7028
|
+
const Q_SHADOW_ROOT = "q:shadowroot";
|
|
7029
|
+
const Q_IGNORE = "q:ignore";
|
|
7030
|
+
const Q_IGNORE_END = "/" + Q_IGNORE;
|
|
7031
|
+
const Q_CONTAINER_ISLAND = "q:container-island";
|
|
7032
|
+
const Q_CONTAINER_ISLAND_END = "/" + Q_CONTAINER_ISLAND;
|
|
7033
|
+
const qDocument = document2;
|
|
7034
|
+
const vNodeDataMap = qDocument.qVNodeData || (qDocument.qVNodeData = new WeakMap);
|
|
7035
|
+
const prototype = document2.body;
|
|
7036
|
+
const getter = (prototype2, name) => {
|
|
7037
|
+
let getter2;
|
|
7038
|
+
while (prototype2 && !(getter2 = Object.getOwnPropertyDescriptor(prototype2, name)?.get)) {
|
|
7039
|
+
prototype2 = Object.getPrototypeOf(prototype2);
|
|
7179
7040
|
}
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
};
|
|
7041
|
+
return getter2 || function() {
|
|
7042
|
+
return this[name];
|
|
7043
|
+
};
|
|
7044
|
+
};
|
|
7045
|
+
const getAttribute = prototype.getAttribute;
|
|
7046
|
+
const hasAttribute = prototype.hasAttribute;
|
|
7047
|
+
const getNodeType = getter(prototype, "nodeType");
|
|
7048
|
+
const attachVnodeDataAndRefs = element => {
|
|
7049
|
+
Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script => {
|
|
7050
|
+
script.setAttribute("type", "x-qwik/vnode");
|
|
7051
|
+
const qContainerElement = script.closest("[q\\:container]");
|
|
7052
|
+
qContainerElement.qVnodeData = script.textContent;
|
|
7053
|
+
qContainerElement.qVNodeRefs = new Map;
|
|
7054
|
+
}));
|
|
7055
|
+
element.querySelectorAll("[q\\:shadowroot]").forEach((parent => {
|
|
7056
|
+
const shadowRoot = parent.shadowRoot;
|
|
7057
|
+
shadowRoot && attachVnodeDataAndRefs(shadowRoot);
|
|
7058
|
+
}));
|
|
7059
|
+
};
|
|
7060
|
+
attachVnodeDataAndRefs(document2);
|
|
7061
|
+
let NodeType;
|
|
7062
|
+
(NodeType2 => {
|
|
7063
|
+
NodeType2[NodeType2.CONTAINER_MASK = 1] = "CONTAINER_MASK";
|
|
7064
|
+
NodeType2[NodeType2.ELEMENT = 2] = "ELEMENT";
|
|
7065
|
+
NodeType2[NodeType2.ELEMENT_CONTAINER = 3] = "ELEMENT_CONTAINER";
|
|
7066
|
+
NodeType2[NodeType2.ELEMENT_SHADOW_ROOT = 6] = "ELEMENT_SHADOW_ROOT";
|
|
7067
|
+
NodeType2[NodeType2.COMMENT_SKIP_START = 5] = "COMMENT_SKIP_START";
|
|
7068
|
+
NodeType2[NodeType2.COMMENT_SKIP_END = 8] = "COMMENT_SKIP_END";
|
|
7069
|
+
NodeType2[NodeType2.COMMENT_IGNORE_START = 16] = "COMMENT_IGNORE_START";
|
|
7070
|
+
NodeType2[NodeType2.COMMENT_IGNORE_END = 32] = "COMMENT_IGNORE_END";
|
|
7071
|
+
NodeType2[NodeType2.COMMENT_ISLAND_START = 65] = "COMMENT_ISLAND_START";
|
|
7072
|
+
NodeType2[NodeType2.COMMENT_ISLAND_END = 128] = "COMMENT_ISLAND_END";
|
|
7073
|
+
NodeType2[NodeType2.OTHER = 0] = "OTHER";
|
|
7074
|
+
})(NodeType || (NodeType = {}));
|
|
7075
|
+
const getFastNodeType = node => {
|
|
7076
|
+
const nodeType = getNodeType.call(node);
|
|
7077
|
+
if (1 === nodeType) {
|
|
7078
|
+
const qContainer = getAttribute.call(node, Q_CONTAINER);
|
|
7079
|
+
if (null === qContainer) {
|
|
7080
|
+
if (hasAttribute.call(node, Q_SHADOW_ROOT)) {
|
|
7081
|
+
return 6;
|
|
7082
|
+
}
|
|
7083
|
+
const isQElement = hasAttribute.call(node, Q_PROPS_SEPARATOR2);
|
|
7084
|
+
return isQElement ? 2 : 0;
|
|
7085
|
+
}
|
|
7086
|
+
return 3;
|
|
7087
|
+
}
|
|
7088
|
+
if (8 === nodeType) {
|
|
7089
|
+
const nodeValue = node.nodeValue || "";
|
|
7090
|
+
if (nodeValue.startsWith(Q_CONTAINER_ISLAND)) {
|
|
7091
|
+
return 65;
|
|
7092
|
+
}
|
|
7093
|
+
if (nodeValue.startsWith(Q_IGNORE)) {
|
|
7094
|
+
return 16;
|
|
7095
|
+
}
|
|
7096
|
+
if (nodeValue.startsWith(Q_CONTAINER)) {
|
|
7097
|
+
return 5;
|
|
7098
|
+
}
|
|
7099
|
+
if (nodeValue.startsWith(Q_CONTAINER_ISLAND_END)) {
|
|
7100
|
+
return 128;
|
|
7101
|
+
}
|
|
7102
|
+
if (nodeValue.startsWith(Q_IGNORE_END)) {
|
|
7103
|
+
return 32;
|
|
7104
|
+
}
|
|
7105
|
+
if (nodeValue.startsWith(Q_CONTAINER_END)) {
|
|
7106
|
+
return 8;
|
|
7107
|
+
}
|
|
7108
|
+
}
|
|
7109
|
+
return 0;
|
|
7110
|
+
};
|
|
7111
|
+
const isSeparator = ch => VNodeDataSeparator.ADVANCE_1 <= ch && ch <= VNodeDataSeparator.ADVANCE_8192;
|
|
7112
|
+
const findVDataSectionEnd = (vData, start, end) => {
|
|
7113
|
+
let depth = 0;
|
|
7114
|
+
while (true) {
|
|
7115
|
+
if (!(start < end)) {
|
|
7116
|
+
break;
|
|
7117
|
+
}
|
|
7118
|
+
{
|
|
7119
|
+
const ch = vData.charCodeAt(start);
|
|
7120
|
+
if (0 === depth && isSeparator(ch)) {
|
|
7121
|
+
break;
|
|
7122
|
+
}
|
|
7123
|
+
ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--;
|
|
7124
|
+
start++;
|
|
7125
|
+
}
|
|
7126
|
+
}
|
|
7127
|
+
return start;
|
|
7128
|
+
};
|
|
7129
|
+
const nextSibling = node => {
|
|
7130
|
+
while (node && (node = node.nextSibling) && 0 === getFastNodeType(node)) {}
|
|
7131
|
+
return node;
|
|
7132
|
+
};
|
|
7133
|
+
const firstChild = node => {
|
|
7134
|
+
while (node && (node = node.firstChild) && 0 === getFastNodeType(node)) {}
|
|
7135
|
+
return node;
|
|
7136
|
+
};
|
|
7137
|
+
const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs, prefix) => {
|
|
7138
|
+
const vData_length = vData.length;
|
|
7139
|
+
let elementIdx = 0;
|
|
7140
|
+
let vNodeElementIndex = -1;
|
|
7141
|
+
let vData_start = 0;
|
|
7142
|
+
let vData_end = 0;
|
|
7143
|
+
let ch = 0;
|
|
7144
|
+
let needsToStoreRef = -1;
|
|
7145
|
+
let nextNode = null;
|
|
7146
|
+
const howManyElementsToSkip = () => {
|
|
7147
|
+
let elementsToSkip = 0;
|
|
7148
|
+
while (isSeparator(ch = vData.charCodeAt(vData_start))) {
|
|
7149
|
+
elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1;
|
|
7150
|
+
vData_start++;
|
|
7151
|
+
if (vData_start >= vData_length) {
|
|
7152
|
+
break;
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7155
|
+
return elementsToSkip;
|
|
7156
|
+
};
|
|
7157
|
+
do {
|
|
7158
|
+
if (node === exitNode) {
|
|
7159
|
+
return;
|
|
7160
|
+
}
|
|
7161
|
+
nextNode = null;
|
|
7162
|
+
const nodeType = node == containerNode ? 2 : getFastNodeType(node);
|
|
7163
|
+
if (3 === nodeType) {
|
|
7164
|
+
const container = node;
|
|
7165
|
+
let cursor = node;
|
|
7166
|
+
while (cursor && !(nextNode = nextSibling(cursor))) {
|
|
7167
|
+
cursor = cursor.parentNode;
|
|
7168
|
+
}
|
|
7169
|
+
walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs, prefix + " ");
|
|
7170
|
+
} else if (16 === nodeType) {
|
|
7171
|
+
let islandNode = node;
|
|
7172
|
+
do {
|
|
7173
|
+
islandNode = walker2.nextNode();
|
|
7174
|
+
if (!islandNode) {
|
|
7175
|
+
throw new Error(`Island inside \x3c!--${node?.nodeValue}--\x3e not found!`);
|
|
7176
|
+
}
|
|
7177
|
+
} while (65 !== getFastNodeType(islandNode));
|
|
7178
|
+
nextNode = null;
|
|
7179
|
+
} else if (128 === nodeType) {
|
|
7180
|
+
nextNode = node;
|
|
7181
|
+
do {
|
|
7182
|
+
nextNode = walker2.nextNode();
|
|
7183
|
+
if (!nextNode) {
|
|
7184
|
+
throw new Error("Ignore block not closed!");
|
|
7185
|
+
}
|
|
7186
|
+
} while (32 !== getFastNodeType(nextNode));
|
|
7187
|
+
nextNode = null;
|
|
7188
|
+
} else if (5 === nodeType) {
|
|
7189
|
+
nextNode = node;
|
|
7190
|
+
do {
|
|
7191
|
+
nextNode = nextSibling(nextNode);
|
|
7192
|
+
if (!nextNode) {
|
|
7193
|
+
throw new Error(`\x3c!--${node?.nodeValue}--\x3e not closed!`);
|
|
7194
|
+
}
|
|
7195
|
+
} while (8 !== getFastNodeType(nextNode));
|
|
7196
|
+
walkContainer(walker2, node, node, nextNode, "", null, prefix + " ");
|
|
7197
|
+
} else if (6 === nodeType) {
|
|
7198
|
+
nextNode = nextSibling(node);
|
|
7199
|
+
const shadowRootContainer = node;
|
|
7200
|
+
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
7201
|
+
shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null, prefix + " ");
|
|
7202
|
+
}
|
|
7203
|
+
if (2 === (2 & nodeType)) {
|
|
7204
|
+
if (vNodeElementIndex < elementIdx) {
|
|
7205
|
+
-1 === vNodeElementIndex && (vNodeElementIndex = 0);
|
|
7206
|
+
vData_start = vData_end;
|
|
7207
|
+
if (vData_start < vData_length) {
|
|
7208
|
+
vNodeElementIndex += howManyElementsToSkip();
|
|
7209
|
+
const shouldStoreRef = ch === VNodeDataSeparator.REFERENCE;
|
|
7210
|
+
if (shouldStoreRef) {
|
|
7211
|
+
needsToStoreRef = vNodeElementIndex;
|
|
7212
|
+
vData_start++;
|
|
7213
|
+
ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1;
|
|
7214
|
+
}
|
|
7215
|
+
vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
|
|
7216
|
+
} else {
|
|
7217
|
+
vNodeElementIndex = Number.MAX_SAFE_INTEGER;
|
|
7218
|
+
}
|
|
7219
|
+
}
|
|
7220
|
+
if (elementIdx === vNodeElementIndex) {
|
|
7221
|
+
needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
|
|
7222
|
+
const instructions = vData.substring(vData_start, vData_end);
|
|
7223
|
+
vNodeDataMap.set(node, instructions);
|
|
7224
|
+
}
|
|
7225
|
+
elementIdx++;
|
|
7226
|
+
}
|
|
7227
|
+
} while (node = nextNode || walker2.nextNode());
|
|
7228
|
+
};
|
|
7229
|
+
const walker = document2.createTreeWalker(document2, 129);
|
|
7230
|
+
walkContainer(walker, null, walker.firstChild(), null, "", null, "");
|
|
7231
|
+
}
|
|
7184
7232
|
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
return vnode;
|
|
7190
|
-
}
|
|
7191
|
-
static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
|
|
7192
|
-
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
7193
|
-
vnode.push(textNode, text);
|
|
7194
|
-
return vnode;
|
|
7195
|
-
}
|
|
7196
|
-
static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
|
|
7197
|
-
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
7198
|
-
vnode.push(firstChild, lastChild);
|
|
7199
|
-
return vnode;
|
|
7200
|
-
}
|
|
7201
|
-
constructor(flags, parent, previousSibling, nextSibling) {
|
|
7202
|
-
super();
|
|
7203
|
-
this.push(flags, parent, previousSibling, nextSibling);
|
|
7204
|
-
isDev && (this.toString = vnode_toString);
|
|
7233
|
+
function getDomContainer(element) {
|
|
7234
|
+
const qContainerElement = _getQContainerElement(element);
|
|
7235
|
+
if (!qContainerElement) {
|
|
7236
|
+
throw qError(41);
|
|
7205
7237
|
}
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
var _context;
|
|
7238
|
+
return getDomContainerFromQContainerElement(qContainerElement);
|
|
7239
|
+
}
|
|
7209
7240
|
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
}
|
|
7216
|
-
if (
|
|
7217
|
-
|
|
7241
|
+
function getDomContainerFromQContainerElement(qContainerElement) {
|
|
7242
|
+
const qElement = qContainerElement;
|
|
7243
|
+
let container = qElement.qContainer;
|
|
7244
|
+
if (!container) {
|
|
7245
|
+
container = new DomContainer(qElement);
|
|
7246
|
+
const containerAttributes = {};
|
|
7247
|
+
if (qElement) {
|
|
7248
|
+
const attrs = qElement.attributes;
|
|
7249
|
+
if (attrs) {
|
|
7250
|
+
for (let index = 0; index < attrs.length; index++) {
|
|
7251
|
+
const attr = attrs[index];
|
|
7252
|
+
if (attr.name === Q_PROPS_SEPARATOR) {
|
|
7253
|
+
continue;
|
|
7254
|
+
}
|
|
7255
|
+
containerAttributes[attr.name] = attr.value;
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7218
7258
|
}
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
var useInvokeContext = () => {
|
|
7225
|
-
const ctx = tryGetInvokeContext();
|
|
7226
|
-
if (!ctx || ctx.$event$ !== RenderEvent) {
|
|
7227
|
-
throw qError(QError_useInvokeContext);
|
|
7259
|
+
container.$serverData$ = {
|
|
7260
|
+
containerAttributes: containerAttributes
|
|
7261
|
+
};
|
|
7262
|
+
qElement.setAttribute(QContainerAttr, "resumed");
|
|
7263
|
+
qElement.qContainer = container;
|
|
7228
7264
|
}
|
|
7229
|
-
|
|
7230
|
-
assertDefined(ctx.$effectSubscriber$, "invoke: $effectSubscriber$ must be defined", ctx);
|
|
7231
|
-
return ctx;
|
|
7232
|
-
};
|
|
7233
|
-
|
|
7234
|
-
function invoke(context, fn, ...args) {
|
|
7235
|
-
return invokeApply.call(this, context, fn, args);
|
|
7265
|
+
return container;
|
|
7236
7266
|
}
|
|
7237
7267
|
|
|
7238
|
-
function
|
|
7239
|
-
const
|
|
7240
|
-
|
|
7241
|
-
try {
|
|
7242
|
-
_context = context;
|
|
7243
|
-
returnValue = fn.apply(this, args);
|
|
7244
|
-
} finally {
|
|
7245
|
-
_context = previousContext;
|
|
7246
|
-
}
|
|
7247
|
-
return returnValue;
|
|
7268
|
+
function _getQContainerElement(element) {
|
|
7269
|
+
const qContainerElement = Array.isArray(element) ? vnode_getDomParent(element) : element;
|
|
7270
|
+
return qContainerElement.closest(QContainerSelector);
|
|
7248
7271
|
}
|
|
7249
7272
|
|
|
7250
|
-
var
|
|
7251
|
-
const container = element.closest(QContainerSelector);
|
|
7252
|
-
const locale = container?.getAttribute(QLocaleAttr) || void 0;
|
|
7253
|
-
locale && setLocale(locale);
|
|
7254
|
-
return newInvokeContext(locale, void 0, element, event, url);
|
|
7255
|
-
};
|
|
7256
|
-
|
|
7257
|
-
var newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
7258
|
-
const $locale$ = locale || ("object" === typeof event && event && "locale" in event ? event.locale : void 0);
|
|
7259
|
-
const ctx = {
|
|
7260
|
-
$url$: url,
|
|
7261
|
-
$i$: 0,
|
|
7262
|
-
$hostElement$: hostElement,
|
|
7263
|
-
$element$: element,
|
|
7264
|
-
$event$: event,
|
|
7265
|
-
$qrl$: void 0,
|
|
7266
|
-
$effectSubscriber$: void 0,
|
|
7267
|
-
$locale$: $locale$,
|
|
7268
|
-
$container$: void 0
|
|
7269
|
-
};
|
|
7270
|
-
seal(ctx);
|
|
7271
|
-
return ctx;
|
|
7272
|
-
};
|
|
7273
|
-
|
|
7274
|
-
var untrack = fn => invoke(void 0, fn);
|
|
7275
|
-
|
|
7276
|
-
var trackInvocation = newInvokeContext(void 0, void 0, void 0, RenderEvent);
|
|
7277
|
-
|
|
7278
|
-
var trackSignal = (fn, subscriber, property, container, data) => {
|
|
7279
|
-
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
7280
|
-
const previousContainer = trackInvocation.$container$;
|
|
7281
|
-
try {
|
|
7282
|
-
trackInvocation.$effectSubscriber$ = [ subscriber, property ];
|
|
7283
|
-
data && trackInvocation.$effectSubscriber$.push(data);
|
|
7284
|
-
trackInvocation.$container$ = container;
|
|
7285
|
-
return invoke(trackInvocation, fn);
|
|
7286
|
-
} finally {
|
|
7287
|
-
trackInvocation.$effectSubscriber$ = previousSubscriber;
|
|
7288
|
-
trackInvocation.$container$ = previousContainer;
|
|
7289
|
-
}
|
|
7290
|
-
};
|
|
7291
|
-
|
|
7292
|
-
var _jsxSorted = (type, varProps, constProps, children, flags, key, dev) => {
|
|
7293
|
-
const processed = null == key ? null : String(key);
|
|
7294
|
-
const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
|
|
7295
|
-
qDev && dev && (node.dev = {
|
|
7296
|
-
stack: (new Error).stack,
|
|
7297
|
-
...dev
|
|
7298
|
-
});
|
|
7299
|
-
seal(node);
|
|
7300
|
-
return node;
|
|
7301
|
-
};
|
|
7273
|
+
var isDomContainer = container => container instanceof DomContainer;
|
|
7302
7274
|
|
|
7303
|
-
var
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7275
|
+
var DomContainer = class extends _SharedContainer {
|
|
7276
|
+
constructor(element) {
|
|
7277
|
+
super((() => this.scheduleRender()), (() => vnode_applyJournal(this.$journal$)), {}, element.getAttribute("q:locale"));
|
|
7278
|
+
__publicField(this, "element");
|
|
7279
|
+
__publicField(this, "qContainer");
|
|
7280
|
+
__publicField(this, "qBase");
|
|
7281
|
+
__publicField(this, "qManifestHash");
|
|
7282
|
+
__publicField(this, "rootVNode");
|
|
7283
|
+
__publicField(this, "document");
|
|
7284
|
+
__publicField(this, "$journal$");
|
|
7285
|
+
__publicField(this, "renderDone", null);
|
|
7286
|
+
__publicField(this, "$rawStateData$");
|
|
7287
|
+
__publicField(this, "$storeProxyMap$", new WeakMap);
|
|
7288
|
+
__publicField(this, "$qFuncs$");
|
|
7289
|
+
__publicField(this, "$instanceHash$");
|
|
7290
|
+
__publicField(this, "stateData");
|
|
7291
|
+
__publicField(this, "$styleIds$", null);
|
|
7292
|
+
__publicField(this, "$vnodeLocate$", (id => vnode_locate(this.rootVNode, id)));
|
|
7293
|
+
__publicField(this, "$renderCount$", 0);
|
|
7294
|
+
__publicField(this, "$getObjectById$", (id => {
|
|
7295
|
+
"string" === typeof id && (id = parseFloat(id));
|
|
7296
|
+
assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`);
|
|
7297
|
+
return this.stateData[id];
|
|
7298
|
+
}));
|
|
7299
|
+
this.qContainer = element.getAttribute(QContainerAttr);
|
|
7300
|
+
if (!this.qContainer) {
|
|
7301
|
+
throw qError(42);
|
|
7310
7302
|
}
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7303
|
+
this.$journal$ = [ 3, element.ownerDocument ];
|
|
7304
|
+
this.document = element.ownerDocument;
|
|
7305
|
+
this.element = element;
|
|
7306
|
+
this.qBase = element.getAttribute(QBaseAttr);
|
|
7307
|
+
this.$instanceHash$ = element.getAttribute(QInstanceAttr);
|
|
7308
|
+
this.qManifestHash = element.getAttribute("q:manifest-hash");
|
|
7309
|
+
this.rootVNode = vnode_newUnMaterializedElement(this.element);
|
|
7310
|
+
this.$rawStateData$ = null;
|
|
7311
|
+
this.stateData = null;
|
|
7312
|
+
const document2 = this.element.ownerDocument;
|
|
7313
|
+
document2.qVNodeData || processVNodeData2(document2);
|
|
7314
|
+
this.$rawStateData$ = [];
|
|
7315
|
+
this.stateData = [];
|
|
7316
|
+
const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
|
|
7317
|
+
if (0 !== qwikStates.length) {
|
|
7318
|
+
const lastState = qwikStates[qwikStates.length - 1];
|
|
7319
|
+
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
7320
|
+
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
7314
7321
|
}
|
|
7315
|
-
|
|
7316
|
-
})).sort((([a], [b]) => a < b ? -1 : 1))) : "string" === typeof type ? EMPTY_OBJ : {};
|
|
7317
|
-
if (constProps && "children" in constProps) {
|
|
7318
|
-
children = constProps.children;
|
|
7319
|
-
constProps.children = void 0;
|
|
7322
|
+
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
7320
7323
|
}
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
var isPropsProxy = obj => obj && void 0 !== obj[_VAR_PROPS];
|
|
7325
|
-
|
|
7326
|
-
var JSXNodeImpl = class {
|
|
7327
|
-
constructor(type, varProps, constProps, children, flags, key = null) {
|
|
7328
|
-
this.type = type;
|
|
7329
|
-
this.varProps = varProps;
|
|
7330
|
-
this.constProps = constProps;
|
|
7331
|
-
this.children = children;
|
|
7332
|
-
this.flags = flags;
|
|
7333
|
-
this.key = key;
|
|
7334
|
-
__publicField(this, "dev");
|
|
7335
|
-
__publicField(this, "_proxy", null);
|
|
7336
|
-
if (qDev) {
|
|
7337
|
-
if ("object" !== typeof varProps) {
|
|
7338
|
-
throw new Error("JSXNodeImpl: varProps must be objects: " + JSON.stringify(varProps));
|
|
7339
|
-
}
|
|
7340
|
-
if ("object" !== typeof constProps) {
|
|
7341
|
-
throw new Error("JSXNodeImpl: constProps must be objects: " + JSON.stringify(constProps));
|
|
7342
|
-
}
|
|
7343
|
-
}
|
|
7324
|
+
$setRawState$(id, vParent) {
|
|
7325
|
+
this.stateData[id] = vParent;
|
|
7344
7326
|
}
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
return this._proxy;
|
|
7327
|
+
parseQRL(qrl) {
|
|
7328
|
+
return inflateQRL(this, parseQRL(qrl));
|
|
7348
7329
|
}
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7330
|
+
handleError(err, host) {
|
|
7331
|
+
if (qDev) {
|
|
7332
|
+
if ("undefined" !== typeof document) {
|
|
7333
|
+
const vHost = host;
|
|
7334
|
+
const errorDiv = document.createElement("errored-host");
|
|
7335
|
+
err && err instanceof Error && (errorDiv.props = {
|
|
7336
|
+
error: err
|
|
7337
|
+
});
|
|
7338
|
+
errorDiv.setAttribute("q:key", "_error_");
|
|
7339
|
+
const journal = [];
|
|
7340
|
+
vnode_getDOMChildNodes(journal, vHost).forEach((child => errorDiv.appendChild(child)));
|
|
7341
|
+
const vErrorDiv = vnode_newElement(errorDiv, "error-host");
|
|
7342
|
+
vnode_insertBefore(journal, vHost, vErrorDiv, null);
|
|
7343
|
+
vnode_applyJournal(journal);
|
|
7344
|
+
}
|
|
7345
|
+
err && err instanceof Error && ("hostElement" in err || (err.hostElement = host));
|
|
7346
|
+
if (!isRecoverable(err)) {
|
|
7347
|
+
throw err;
|
|
7348
|
+
}
|
|
7357
7349
|
}
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7350
|
+
const errorStore = this.resolveContext(host, ERROR_CONTEXT);
|
|
7351
|
+
if (!errorStore) {
|
|
7352
|
+
throw err;
|
|
7361
7353
|
}
|
|
7362
|
-
|
|
7354
|
+
errorStore.error = err;
|
|
7363
7355
|
}
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
function createPropsProxy(varProps, constProps, children) {
|
|
7370
|
-
return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
|
|
7371
|
-
}
|
|
7372
|
-
|
|
7373
|
-
var PropsProxyHandler = class {
|
|
7374
|
-
constructor($varProps$, $constProps$, $children$) {
|
|
7375
|
-
this.$varProps$ = $varProps$;
|
|
7376
|
-
this.$constProps$ = $constProps$;
|
|
7377
|
-
this.$children$ = $children$;
|
|
7356
|
+
setContext(host, context, value) {
|
|
7357
|
+
let ctx = this.getHostProp(host, QCtxAttr);
|
|
7358
|
+
ctx || this.setHostProp(host, QCtxAttr, ctx = []);
|
|
7359
|
+
mapArray_set(ctx, context.id, value, 0);
|
|
7378
7360
|
}
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7361
|
+
resolveContext(host, contextId) {
|
|
7362
|
+
while (host) {
|
|
7363
|
+
const ctx = this.getHostProp(host, QCtxAttr);
|
|
7364
|
+
if (ctx) {
|
|
7365
|
+
const value = mapArray_get(ctx, contextId.id, 0);
|
|
7366
|
+
if (value) {
|
|
7367
|
+
return value;
|
|
7368
|
+
}
|
|
7369
|
+
}
|
|
7370
|
+
host = this.getParentHost(host);
|
|
7388
7371
|
}
|
|
7389
|
-
|
|
7390
|
-
return value instanceof WrappedSignal ? value.value : value;
|
|
7372
|
+
return;
|
|
7391
7373
|
}
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7374
|
+
getParentHost(host) {
|
|
7375
|
+
let vNode = vnode_getParent(host);
|
|
7376
|
+
while (vNode) {
|
|
7377
|
+
if (vnode_isVirtualVNode(vNode)) {
|
|
7378
|
+
if (null !== vnode_getProp(vNode, OnRenderProp, null)) {
|
|
7379
|
+
return vNode;
|
|
7380
|
+
}
|
|
7381
|
+
const parent = vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
7382
|
+
if (parent) {
|
|
7383
|
+
vNode = parent;
|
|
7384
|
+
continue;
|
|
7385
|
+
}
|
|
7386
|
+
}
|
|
7387
|
+
vNode = vnode_getParent(vNode);
|
|
7400
7388
|
}
|
|
7401
|
-
|
|
7402
|
-
return true;
|
|
7389
|
+
return null;
|
|
7403
7390
|
}
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7391
|
+
setHostProp(host, name, value) {
|
|
7392
|
+
const vNode = host;
|
|
7393
|
+
vnode_setProp(vNode, name, value);
|
|
7394
|
+
}
|
|
7395
|
+
getHostProp(host, name) {
|
|
7396
|
+
const vNode = host;
|
|
7397
|
+
let getObjectById = null;
|
|
7398
|
+
switch (name) {
|
|
7399
|
+
case ELEMENT_SEQ:
|
|
7400
|
+
case ELEMENT_PROPS:
|
|
7401
|
+
case OnRenderProp:
|
|
7402
|
+
case QCtxAttr:
|
|
7403
|
+
case QSubscribers:
|
|
7404
|
+
getObjectById = this.$getObjectById$;
|
|
7405
|
+
break;
|
|
7406
|
+
|
|
7407
|
+
case ELEMENT_SEQ_IDX:
|
|
7408
|
+
case USE_ON_LOCAL_SEQ_IDX:
|
|
7409
|
+
getObjectById = parseInt;
|
|
7410
|
+
break;
|
|
7407
7411
|
}
|
|
7408
|
-
|
|
7409
|
-
this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete);
|
|
7410
|
-
null != this.$children$ && "children" === prop && (this.$children$ = null);
|
|
7411
|
-
return didDelete;
|
|
7412
|
+
return vnode_getProp(vNode, name, getObjectById);
|
|
7412
7413
|
}
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7414
|
+
scheduleRender() {
|
|
7415
|
+
this.$renderCount$++;
|
|
7416
|
+
this.renderDone || (this.renderDone = getPlatform().nextTick((() => this.processChores())));
|
|
7417
|
+
return this.renderDone;
|
|
7416
7418
|
}
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7419
|
+
processChores() {
|
|
7420
|
+
let renderCount = this.$renderCount$;
|
|
7421
|
+
const result = this.$scheduler$(255);
|
|
7422
|
+
if (isPromise(result)) {
|
|
7423
|
+
return result.then((async () => {
|
|
7424
|
+
while (renderCount !== this.$renderCount$) {
|
|
7425
|
+
renderCount = this.$renderCount$;
|
|
7426
|
+
await this.$scheduler$(255);
|
|
7427
|
+
}
|
|
7428
|
+
this.renderDone = null;
|
|
7429
|
+
}));
|
|
7430
|
+
}
|
|
7431
|
+
if (renderCount !== this.$renderCount$) {
|
|
7432
|
+
this.processChores();
|
|
7433
|
+
return;
|
|
7434
|
+
}
|
|
7435
|
+
this.renderDone = null;
|
|
7424
7436
|
}
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7437
|
+
ensureProjectionResolved(vNode) {
|
|
7438
|
+
if (0 === (16 & vNode[0])) {
|
|
7439
|
+
vNode[0] |= 16;
|
|
7440
|
+
for (let i = vnode_getPropStartIndex(vNode); i < vNode.length; i += 2) {
|
|
7441
|
+
const prop = vNode[i];
|
|
7442
|
+
if (isSlotProp(prop)) {
|
|
7443
|
+
const value = vNode[i + 1];
|
|
7444
|
+
"string" == typeof value && (vNode[i + 1] = this.$vnodeLocate$(value));
|
|
7445
|
+
}
|
|
7431
7446
|
}
|
|
7432
7447
|
}
|
|
7433
|
-
return out;
|
|
7434
7448
|
}
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
var componentQrl = componentQrl2 => {
|
|
7440
|
-
function QwikComponent(props, key, flags = 0) {
|
|
7441
|
-
assertQrl(componentQrl2);
|
|
7442
|
-
assertNumber(flags, "The Qwik Component was not invoked correctly");
|
|
7443
|
-
const hash = qTest ? "sX" : componentQrl2.$hash$.slice(0, 4);
|
|
7444
|
-
const finalKey = hash + ":" + (key || "");
|
|
7445
|
-
const InnerCmp = () => {};
|
|
7446
|
-
InnerCmp[SERIALIZABLE_STATE] = [ componentQrl2 ];
|
|
7447
|
-
return _jsxSplit(InnerCmp, props, null, props.children, flags, finalKey);
|
|
7449
|
+
getSyncFn(id) {
|
|
7450
|
+
const fn = this.$qFuncs$[id];
|
|
7451
|
+
assertTrue("function" === typeof fn, "Invalid reference: " + id);
|
|
7452
|
+
return fn;
|
|
7448
7453
|
}
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
var pseudoGlobal = 5;
|
|
7470
|
-
|
|
7471
|
-
var pseudoElement = 6;
|
|
7472
|
-
|
|
7473
|
-
var attrSelector = 7;
|
|
7474
|
-
|
|
7475
|
-
var inertParenthesis = 8;
|
|
7476
|
-
|
|
7477
|
-
var inertBlock = 9;
|
|
7478
|
-
|
|
7479
|
-
var atRuleSelector = 10;
|
|
7480
|
-
|
|
7481
|
-
var atRuleBlock = 11;
|
|
7482
|
-
|
|
7483
|
-
var atRuleInert = 12;
|
|
7484
|
-
|
|
7485
|
-
var body = 13;
|
|
7486
|
-
|
|
7487
|
-
var stringSingle = 14;
|
|
7488
|
-
|
|
7489
|
-
var stringDouble = 15;
|
|
7490
|
-
|
|
7491
|
-
var commentMultiline = 16;
|
|
7492
|
-
|
|
7493
|
-
var EXIT = 17;
|
|
7494
|
-
|
|
7495
|
-
var EXIT_INSERT_SCOPE = 18;
|
|
7496
|
-
|
|
7497
|
-
var ANY = 0;
|
|
7498
|
-
|
|
7499
|
-
var IDENT = 1;
|
|
7500
|
-
|
|
7501
|
-
var NOT_IDENT = 2;
|
|
7502
|
-
|
|
7503
|
-
var WHITESPACE = 3;
|
|
7504
|
-
|
|
7505
|
-
var DOUBLE_QUOTE = 34;
|
|
7506
|
-
|
|
7507
|
-
var HASH = 35;
|
|
7508
|
-
|
|
7509
|
-
var SINGLE_QUOTE = 39;
|
|
7510
|
-
|
|
7511
|
-
var OPEN_PARENTHESIS = 40;
|
|
7512
|
-
|
|
7513
|
-
var CLOSE_PARENTHESIS = 41;
|
|
7514
|
-
|
|
7515
|
-
var STAR = 42;
|
|
7516
|
-
|
|
7517
|
-
var DOT = 46;
|
|
7518
|
-
|
|
7519
|
-
var FORWARD_SLASH = 47;
|
|
7520
|
-
|
|
7521
|
-
var COLON = 58;
|
|
7522
|
-
|
|
7523
|
-
var SEMICOLON = 59;
|
|
7524
|
-
|
|
7525
|
-
var AT = 64;
|
|
7526
|
-
|
|
7527
|
-
var OPEN_BRACKET = 91;
|
|
7528
|
-
|
|
7529
|
-
var CLOSE_BRACKET = 93;
|
|
7530
|
-
|
|
7531
|
-
var OPEN_BRACE = 123;
|
|
7532
|
-
|
|
7533
|
-
var CLOSE_BRACE = 125;
|
|
7534
|
-
|
|
7535
|
-
var STRINGS_COMMENTS = (() => [ [ ANY, SINGLE_QUOTE, stringSingle ], [ ANY, DOUBLE_QUOTE, stringDouble ], [ ANY, FORWARD_SLASH, commentMultiline, "*" ] ])();
|
|
7536
|
-
|
|
7537
|
-
var STATE_MACHINE = (() => [ [ [ ANY, STAR, starSelector ], [ ANY, OPEN_BRACKET, attrSelector ], [ ANY, COLON, pseudoElement, ":", "before", "after", "first-letter", "first-line" ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, COLON, pseudoClassWithSelector, "has", "host-context", "not", "where", "is", "matches", "any" ], [ ANY, COLON, pseudoClass ], [ ANY, IDENT, elementClassIdSelector ], [ ANY, DOT, elementClassIdSelector ], [ ANY, HASH, elementClassIdSelector ], [ ANY, AT, atRuleSelector, "keyframe" ], [ ANY, AT, atRuleBlock, "media", "supports", "container" ], [ ANY, AT, atRuleInert ], [ ANY, OPEN_BRACE, body ], [ FORWARD_SLASH, STAR, commentMultiline ], [ ANY, SEMICOLON, EXIT ], [ ANY, CLOSE_BRACE, EXIT ], [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, OPEN_PARENTHESIS, rule ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, OPEN_PARENTHESIS, inertParenthesis ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, OPEN_PARENTHESIS, rule ], [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, CLOSE_BRACKET, EXIT_INSERT_SCOPE ], [ ANY, SINGLE_QUOTE, stringSingle ], [ ANY, DOUBLE_QUOTE, stringDouble ] ], [ [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, CLOSE_BRACE, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, CLOSE_BRACE, EXIT ], [ WHITESPACE, IDENT, elementClassIdSelector ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, OPEN_BRACE, body ], ...STRINGS_COMMENTS ], [ [ ANY, OPEN_BRACE, rule ], [ ANY, SEMICOLON, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, SEMICOLON, EXIT ], [ ANY, OPEN_BRACE, inertBlock ], ...STRINGS_COMMENTS ], [ [ ANY, CLOSE_BRACE, EXIT ], [ ANY, OPEN_BRACE, body ], [ ANY, OPEN_PARENTHESIS, inertParenthesis ], ...STRINGS_COMMENTS ], [ [ ANY, SINGLE_QUOTE, EXIT ] ], [ [ ANY, DOUBLE_QUOTE, EXIT ] ], [ [ STAR, FORWARD_SLASH, EXIT ] ] ])();
|
|
7538
|
-
|
|
7539
|
-
var useComputedQrl = qrl2 => {
|
|
7540
|
-
const {val: val, set: set} = useSequentialScope();
|
|
7541
|
-
if (val) {
|
|
7542
|
-
return val;
|
|
7454
|
+
$appendStyle$(content, styleId, host, scoped) {
|
|
7455
|
+
if (scoped) {
|
|
7456
|
+
const scopedStyleIdsString = this.getHostProp(host, QScopedStyle);
|
|
7457
|
+
const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
|
|
7458
|
+
scopedStyleIds.add(styleId);
|
|
7459
|
+
this.setHostProp(host, QScopedStyle, convertStyleIdsToString(scopedStyleIds));
|
|
7460
|
+
}
|
|
7461
|
+
if (null == this.$styleIds$) {
|
|
7462
|
+
this.$styleIds$ = new Set;
|
|
7463
|
+
this.element.querySelectorAll(QStyleSelector).forEach((style => {
|
|
7464
|
+
this.$styleIds$.add(style.getAttribute(QStyle));
|
|
7465
|
+
}));
|
|
7466
|
+
}
|
|
7467
|
+
if (!this.$styleIds$.has(styleId)) {
|
|
7468
|
+
this.$styleIds$.add(styleId);
|
|
7469
|
+
const styleElement = this.document.createElement("style");
|
|
7470
|
+
styleElement.setAttribute(QStyle, styleId);
|
|
7471
|
+
styleElement.textContent = content;
|
|
7472
|
+
this.$journal$.push(5, this.document.head, null, styleElement);
|
|
7473
|
+
}
|
|
7543
7474
|
}
|
|
7544
|
-
assertQrl(qrl2);
|
|
7545
|
-
const signal = new ComputedSignal(null, qrl2);
|
|
7546
|
-
set(signal);
|
|
7547
|
-
throwIfQRLNotResolved(qrl2);
|
|
7548
|
-
return signal;
|
|
7549
7475
|
};
|
|
7550
7476
|
|
|
7551
|
-
var useComputed$ = implicit$FirstArg(useComputedQrl);
|
|
7552
|
-
|
|
7553
|
-
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
7554
|
-
|
|
7555
|
-
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
7556
|
-
|
|
7557
7477
|
var deserializedProxyMap = new WeakMap;
|
|
7558
7478
|
|
|
7559
7479
|
var unwrapDeserializerProxy = value => {
|
|
@@ -7735,7 +7655,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
7735
7655
|
signal.$args$ = d[1];
|
|
7736
7656
|
signal.$effectDependencies$ = d[2];
|
|
7737
7657
|
signal.$untrackedValue$ = d[3];
|
|
7738
|
-
signal.$
|
|
7658
|
+
signal.$hostElement$ = d[4];
|
|
7659
|
+
signal.$effects$ = d.slice(5);
|
|
7739
7660
|
break;
|
|
7740
7661
|
}
|
|
7741
7662
|
|
|
@@ -7841,12 +7762,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
7841
7762
|
case 30:
|
|
7842
7763
|
{
|
|
7843
7764
|
const effectData = target;
|
|
7844
|
-
effectData.data = data[0];
|
|
7765
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
7766
|
+
effectData.data.$isConst$ = data[1];
|
|
7845
7767
|
break;
|
|
7846
7768
|
}
|
|
7847
7769
|
|
|
7848
7770
|
default:
|
|
7849
|
-
|
|
7771
|
+
throw qError(33, [ typeId ]);
|
|
7850
7772
|
}
|
|
7851
7773
|
};
|
|
7852
7774
|
|
|
@@ -7873,11 +7795,11 @@ var allocate = (container, typeId, value) => {
|
|
|
7873
7795
|
return {};
|
|
7874
7796
|
|
|
7875
7797
|
case 18:
|
|
7876
|
-
const
|
|
7877
|
-
return parseQRL(
|
|
7798
|
+
const qrl = container.$getObjectById$(value);
|
|
7799
|
+
return parseQRL(qrl);
|
|
7878
7800
|
|
|
7879
7801
|
case 19:
|
|
7880
|
-
return new
|
|
7802
|
+
return new Task(-1, -1, null, null, null, null);
|
|
7881
7803
|
|
|
7882
7804
|
case 20:
|
|
7883
7805
|
{
|
|
@@ -7965,13 +7887,16 @@ var allocate = (container, typeId, value) => {
|
|
|
7965
7887
|
return vnodeOrDocument;
|
|
7966
7888
|
}
|
|
7967
7889
|
const vNode = retrieveVNodeOrDocument(container, value);
|
|
7968
|
-
|
|
7890
|
+
if (vnode_isVNode(vNode)) {
|
|
7891
|
+
return vnode_getNode(vNode);
|
|
7892
|
+
}
|
|
7893
|
+
throw qError(34, [ typeof vNode ]);
|
|
7969
7894
|
|
|
7970
7895
|
case 30:
|
|
7971
|
-
return new
|
|
7896
|
+
return new EffectPropData({});
|
|
7972
7897
|
|
|
7973
7898
|
default:
|
|
7974
|
-
|
|
7899
|
+
throw qError(35, [ typeId ]);
|
|
7975
7900
|
}
|
|
7976
7901
|
};
|
|
7977
7902
|
|
|
@@ -7979,13 +7904,13 @@ function retrieveVNodeOrDocument(container, value) {
|
|
|
7979
7904
|
return value ? container.rootVNode ? vnode_locate(container.rootVNode, value) : void 0 : container.element?.ownerDocument;
|
|
7980
7905
|
}
|
|
7981
7906
|
|
|
7982
|
-
function parseQRL(
|
|
7983
|
-
const hashIdx =
|
|
7984
|
-
const captureStart =
|
|
7985
|
-
const captureEnd =
|
|
7986
|
-
const chunk = hashIdx > -1 ?
|
|
7987
|
-
const symbol = captureStart > -1 ?
|
|
7988
|
-
const captureIds = captureStart > -1 && captureEnd > -1 ?
|
|
7907
|
+
function parseQRL(qrl) {
|
|
7908
|
+
const hashIdx = qrl.indexOf("#");
|
|
7909
|
+
const captureStart = qrl.indexOf("[", hashIdx);
|
|
7910
|
+
const captureEnd = qrl.indexOf("]", captureStart);
|
|
7911
|
+
const chunk = hashIdx > -1 ? qrl.slice(0, hashIdx) : qrl.slice(0, captureStart);
|
|
7912
|
+
const symbol = captureStart > -1 ? qrl.slice(hashIdx + 1, captureStart) : qrl.slice(hashIdx + 1);
|
|
7913
|
+
const captureIds = captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter((v => v.length)).map((s => parseInt(s, 10))) : null;
|
|
7989
7914
|
let qrlRef = null;
|
|
7990
7915
|
if (isDev2 && chunk === QRL_RUNTIME_CHUNK) {
|
|
7991
7916
|
const backChannel = globalThis[QRL_RUNTIME_CHUNK];
|
|
@@ -7995,11 +7920,11 @@ function parseQRL(qrl2) {
|
|
|
7995
7920
|
return createQRL(chunk, symbol, qrlRef, null, captureIds, null, null);
|
|
7996
7921
|
}
|
|
7997
7922
|
|
|
7998
|
-
function inflateQRL(container,
|
|
7999
|
-
const captureIds =
|
|
8000
|
-
|
|
8001
|
-
container.element &&
|
|
8002
|
-
return
|
|
7923
|
+
function inflateQRL(container, qrl) {
|
|
7924
|
+
const captureIds = qrl.$capture$;
|
|
7925
|
+
qrl.$captureRef$ = captureIds ? captureIds.map((id => container.$getObjectById$(id))) : null;
|
|
7926
|
+
container.element && qrl.$setContainer$(container.element);
|
|
7927
|
+
return qrl;
|
|
8003
7928
|
}
|
|
8004
7929
|
|
|
8005
7930
|
var isDomRef = obj => false;
|
|
@@ -8047,7 +7972,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
8047
7972
|
$getRootId$: obj => {
|
|
8048
7973
|
const id = map.get(obj);
|
|
8049
7974
|
if (!id || -1 === id) {
|
|
8050
|
-
|
|
7975
|
+
throw qError(36, [ obj ]);
|
|
8051
7976
|
}
|
|
8052
7977
|
return id;
|
|
8053
7978
|
},
|
|
@@ -8090,8 +8015,8 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
8090
8015
|
if (isQrl2(obj)) {
|
|
8091
8016
|
obj.$captureRef$ && discoveredValues.push(...obj.$captureRef$);
|
|
8092
8017
|
} else if (isQwikComponent(obj)) {
|
|
8093
|
-
const [
|
|
8094
|
-
discoveredValues.push(
|
|
8018
|
+
const [qrl] = obj[SERIALIZABLE_STATE];
|
|
8019
|
+
discoveredValues.push(qrl);
|
|
8095
8020
|
}
|
|
8096
8021
|
} else if ("object" !== typeof obj || null === obj || obj instanceof URL || obj instanceof Date || obj instanceof RegExp || obj instanceof Uint8Array || obj instanceof URLSearchParams || "undefined" !== typeof FormData && obj instanceof FormData || fastSkipSerialize(obj)) {} else if (obj instanceof Error) {
|
|
8097
8022
|
discoveredValues.push(...Object.values(obj));
|
|
@@ -8117,13 +8042,19 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
8117
8042
|
if (obj instanceof WrappedSignal) {
|
|
8118
8043
|
obj.$effectDependencies$ && discoveredValues.push(...obj.$effectDependencies$);
|
|
8119
8044
|
obj.$args$ && discoveredValues.push(...obj.$args$);
|
|
8045
|
+
obj.$hostElement$ && discoveredValues.push(obj.$hostElement$);
|
|
8120
8046
|
} else {
|
|
8121
8047
|
obj instanceof ComputedSignal && discoveredValues.push(obj.$computeQrl$);
|
|
8122
8048
|
}
|
|
8123
|
-
} else if (obj instanceof
|
|
8049
|
+
} else if (obj instanceof Task) {
|
|
8124
8050
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
8125
8051
|
} else if (isSsrNode(obj)) {
|
|
8126
|
-
|
|
8052
|
+
discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
|
|
8053
|
+
if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
8054
|
+
for (const data of obj.childrenVNodeData) {
|
|
8055
|
+
discoverValuesForVNodeData(data, discoveredValues);
|
|
8056
|
+
}
|
|
8057
|
+
}
|
|
8127
8058
|
} else if (isDomRef(obj)) {
|
|
8128
8059
|
discoveredValues.push(obj.$ssrNode$.id);
|
|
8129
8060
|
} else if (isJSXNode(obj)) {
|
|
@@ -8143,11 +8074,11 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
8143
8074
|
discoveredValues.push(error);
|
|
8144
8075
|
}));
|
|
8145
8076
|
promises.push(obj);
|
|
8146
|
-
} else if (obj instanceof
|
|
8077
|
+
} else if (obj instanceof EffectPropData) {
|
|
8147
8078
|
discoveredValues.push(obj.data);
|
|
8148
8079
|
} else {
|
|
8149
8080
|
if (!isObjectLiteral(obj)) {
|
|
8150
|
-
|
|
8081
|
+
throw qError(37, [ obj ]);
|
|
8151
8082
|
}
|
|
8152
8083
|
Object.entries(obj).forEach((([key, value]) => {
|
|
8153
8084
|
discoveredValues.push(key, value);
|
|
@@ -8177,6 +8108,22 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
8177
8108
|
}
|
|
8178
8109
|
};
|
|
8179
8110
|
|
|
8111
|
+
var isSsrAttrs = value => Array.isArray(value) && value.length > 0;
|
|
8112
|
+
|
|
8113
|
+
var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
|
|
8114
|
+
for (const value of vnodeData) {
|
|
8115
|
+
if (isSsrAttrs(value)) {
|
|
8116
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
8117
|
+
if (value[i - 1] === ELEMENT_KEY) {
|
|
8118
|
+
continue;
|
|
8119
|
+
}
|
|
8120
|
+
const attrValue = value[i];
|
|
8121
|
+
discoveredValues.push(attrValue);
|
|
8122
|
+
}
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
};
|
|
8126
|
+
|
|
8180
8127
|
var promiseResults = new WeakMap;
|
|
8181
8128
|
|
|
8182
8129
|
function serialize(serializationContext) {
|
|
@@ -8222,13 +8169,13 @@ function serialize(serializationContext) {
|
|
|
8222
8169
|
} else if (value === Fragment) {
|
|
8223
8170
|
output(1, 9);
|
|
8224
8171
|
} else if (isQrl2(value)) {
|
|
8225
|
-
const
|
|
8226
|
-
const id = serializationContext.$addRoot$(
|
|
8172
|
+
const qrl = qrlToString(serializationContext, value);
|
|
8173
|
+
const id = serializationContext.$addRoot$(qrl);
|
|
8227
8174
|
output(18, id);
|
|
8228
8175
|
} else if (isQwikComponent(value)) {
|
|
8229
|
-
const [
|
|
8230
|
-
serializationContext.$renderSymbols$.add(
|
|
8231
|
-
output(21, [
|
|
8176
|
+
const [qrl] = value[SERIALIZABLE_STATE];
|
|
8177
|
+
serializationContext.$renderSymbols$.add(qrl.$symbol$);
|
|
8178
|
+
output(21, [ qrl ]);
|
|
8232
8179
|
} else {
|
|
8233
8180
|
console.error("Cannot serialize function (ignoring for now): " + value.toString());
|
|
8234
8181
|
output(1, 0);
|
|
@@ -8252,8 +8199,13 @@ function serialize(serializationContext) {
|
|
|
8252
8199
|
const seen = depth > 1 && serializationContext.$wasSeen$(value);
|
|
8253
8200
|
"number" === typeof seen && seen >= 0 ? output(0, seen) : output(3, value);
|
|
8254
8201
|
}
|
|
8202
|
+
} else if ("undefined" === typeof value) {
|
|
8203
|
+
output(1, 0);
|
|
8255
8204
|
} else {
|
|
8256
|
-
|
|
8205
|
+
if (value !== NEEDS_COMPUTATION) {
|
|
8206
|
+
throw qError(37, [ typeof value ]);
|
|
8207
|
+
}
|
|
8208
|
+
output(1, 7);
|
|
8257
8209
|
}
|
|
8258
8210
|
};
|
|
8259
8211
|
const writeObjectValue = (value, idx) => {
|
|
@@ -8270,14 +8222,14 @@ function serialize(serializationContext) {
|
|
|
8270
8222
|
const constProps = value[_CONST_PROPS];
|
|
8271
8223
|
const out = constProps ? [ varProps, constProps ] : Object.keys(varProps).length ? [ varProps ] : 0;
|
|
8272
8224
|
output(29, out);
|
|
8273
|
-
} else if (value instanceof
|
|
8274
|
-
output(30, [ value.data ]);
|
|
8225
|
+
} else if (value instanceof EffectPropData) {
|
|
8226
|
+
output(30, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
|
|
8275
8227
|
} else if (isStore(value)) {
|
|
8276
8228
|
if (isResource(value)) {
|
|
8277
8229
|
serializationContext.$resources$.add(value);
|
|
8278
8230
|
const res = promiseResults.get(value.value);
|
|
8279
8231
|
if (!res) {
|
|
8280
|
-
|
|
8232
|
+
throw qError(38, [ "resource" ]);
|
|
8281
8233
|
}
|
|
8282
8234
|
output(20, [ ...res, getStoreHandler(value).$effects$ ]);
|
|
8283
8235
|
} else {
|
|
@@ -8312,12 +8264,12 @@ function serialize(serializationContext) {
|
|
|
8312
8264
|
output(13, out);
|
|
8313
8265
|
}
|
|
8314
8266
|
} else if ($isDomRef$(value)) {
|
|
8315
|
-
value.$ssrNode$.vnodeData[0] |=
|
|
8267
|
+
value.$ssrNode$.vnodeData[0] |= 16;
|
|
8316
8268
|
output(9, value.$ssrNode$.id);
|
|
8317
8269
|
} else if (value instanceof Signal) {
|
|
8318
8270
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
8319
8271
|
if (value instanceof WrappedSignal) {
|
|
8320
|
-
output(23, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
|
|
8272
|
+
output(23, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
8321
8273
|
} else if (value instanceof ComputedSignal) {
|
|
8322
8274
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
8323
8275
|
v !== NEEDS_COMPUTATION && out.push(v);
|
|
@@ -8344,11 +8296,11 @@ function serialize(serializationContext) {
|
|
|
8344
8296
|
const vNodeData = value.vnodeData;
|
|
8345
8297
|
if (vNodeData) {
|
|
8346
8298
|
serializationContext.$prepVNodeData$?.(vNodeData);
|
|
8347
|
-
vNodeData[0] |=
|
|
8299
|
+
vNodeData[0] |= 16;
|
|
8348
8300
|
}
|
|
8349
8301
|
if (value.childrenVNodeData) {
|
|
8350
8302
|
for (const vNodeData2 of value.childrenVNodeData) {
|
|
8351
|
-
vNodeData2[0] |=
|
|
8303
|
+
vNodeData2[0] |= 16;
|
|
8352
8304
|
}
|
|
8353
8305
|
}
|
|
8354
8306
|
} else {
|
|
@@ -8373,7 +8325,7 @@ function serialize(serializationContext) {
|
|
|
8373
8325
|
output(16, combined);
|
|
8374
8326
|
} else if (isJSXNode(value)) {
|
|
8375
8327
|
output(28, [ value.type, value.varProps, value.constProps, value.children, value.flags, value.key ]);
|
|
8376
|
-
} else if (value instanceof
|
|
8328
|
+
} else if (value instanceof Task) {
|
|
8377
8329
|
const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value.$effectDependencies$, value.$state$ ];
|
|
8378
8330
|
while (null == out[out.length - 1]) {
|
|
8379
8331
|
out.pop();
|
|
@@ -8382,12 +8334,12 @@ function serialize(serializationContext) {
|
|
|
8382
8334
|
} else if (isPromise(value)) {
|
|
8383
8335
|
const res = promiseResults.get(value);
|
|
8384
8336
|
if (!res) {
|
|
8385
|
-
|
|
8337
|
+
throw qError(38, [ "promise" ]);
|
|
8386
8338
|
}
|
|
8387
8339
|
output(14, res);
|
|
8388
8340
|
} else {
|
|
8389
8341
|
if (!(value instanceof Uint8Array)) {
|
|
8390
|
-
|
|
8342
|
+
throw qError(37, [ typeof value ]);
|
|
8391
8343
|
}
|
|
8392
8344
|
{
|
|
8393
8345
|
let buf = "";
|
|
@@ -8433,7 +8385,9 @@ function qrlToString(serializationContext, value) {
|
|
|
8433
8385
|
backChannel.set(value.$symbol$, value._devOnlySymbolRef);
|
|
8434
8386
|
chunk || (chunk = QRL_RUNTIME_CHUNK);
|
|
8435
8387
|
}
|
|
8436
|
-
|
|
8388
|
+
if (!chunk) {
|
|
8389
|
+
throw qError(31, [ value.$symbol$ ]);
|
|
8390
|
+
}
|
|
8437
8391
|
chunk.startsWith("./") && (chunk = chunk.slice(2));
|
|
8438
8392
|
}
|
|
8439
8393
|
let qrlStringInline = `${chunk}#${symbol}`;
|
|
@@ -8472,7 +8426,7 @@ function isResource(value) {
|
|
|
8472
8426
|
return "__brand" in value && "resource" === value.__brand;
|
|
8473
8427
|
}
|
|
8474
8428
|
|
|
8475
|
-
var frameworkType = obj => "object" === typeof obj && null !== obj && (obj instanceof Signal || obj instanceof
|
|
8429
|
+
var frameworkType = obj => "object" === typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
|
|
8476
8430
|
|
|
8477
8431
|
var canSerialize = value => {
|
|
8478
8432
|
if (null == value || "string" === typeof value || "number" === typeof value || "boolean" === typeof value || "bigint" === typeof value) {
|
|
@@ -8581,7 +8535,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
8581
8535
|
let expectIndex = 0;
|
|
8582
8536
|
unwrapped.forEach(((v, i) => {
|
|
8583
8537
|
if (i !== expectIndex) {
|
|
8584
|
-
throw qError(
|
|
8538
|
+
throw qError(3, [ unwrapped ]);
|
|
8585
8539
|
}
|
|
8586
8540
|
_verifySerializable(v, seen, ctx + "[" + i + "]");
|
|
8587
8541
|
expectIndex = i + 1;
|
|
@@ -8610,8 +8564,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
8610
8564
|
const fnName = value.name;
|
|
8611
8565
|
message += ` because it's a function named "${fnName}". You might need to convert it to a QRL using $(fn):\n\nconst ${fnName} = $(${String(value)});\n\nPlease check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
|
|
8612
8566
|
}
|
|
8613
|
-
|
|
8614
|
-
throwErrorAndStop(message);
|
|
8567
|
+
throw qError(3, [ message ]);
|
|
8615
8568
|
}
|
|
8616
8569
|
return value;
|
|
8617
8570
|
};
|
|
@@ -8645,7 +8598,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8645
8598
|
}
|
|
8646
8599
|
}
|
|
8647
8600
|
let _containerEl;
|
|
8648
|
-
const
|
|
8601
|
+
const qrl = async function(...args) {
|
|
8649
8602
|
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
8650
8603
|
const result = await boundedFn(...args);
|
|
8651
8604
|
return result;
|
|
@@ -8657,7 +8610,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8657
8610
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
8658
8611
|
return (...args) => maybeThen(resolveLazy(), (fn => {
|
|
8659
8612
|
if (!isFunction(fn)) {
|
|
8660
|
-
throw qError(
|
|
8613
|
+
throw qError(10);
|
|
8661
8614
|
}
|
|
8662
8615
|
if (beforeFn && false === beforeFn()) {
|
|
8663
8616
|
return;
|
|
@@ -8665,7 +8618,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8665
8618
|
const context = createOrReuseInvocationContext(currentCtx);
|
|
8666
8619
|
const prevQrl = context.$qrl$;
|
|
8667
8620
|
const prevEvent = context.$event$;
|
|
8668
|
-
context.$qrl$ =
|
|
8621
|
+
context.$qrl$ = qrl;
|
|
8669
8622
|
context.$event$ || (context.$event$ = this);
|
|
8670
8623
|
try {
|
|
8671
8624
|
return invoke.call(this, context, fn, ...args);
|
|
@@ -8686,7 +8639,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8686
8639
|
return fn.apply(this, args);
|
|
8687
8640
|
}
|
|
8688
8641
|
context = newInvokeContext();
|
|
8689
|
-
context.$qrl$ =
|
|
8642
|
+
context.$qrl$ = qrl;
|
|
8690
8643
|
context.$event$ = this;
|
|
8691
8644
|
return invoke.call(this, context, fn, ...args);
|
|
8692
8645
|
};
|
|
@@ -8701,15 +8654,15 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8701
8654
|
const hash2 = _containerEl.getAttribute(QInstanceAttr);
|
|
8702
8655
|
const doc = _containerEl.ownerDocument;
|
|
8703
8656
|
const qFuncs = getQFuncs(doc, hash2);
|
|
8704
|
-
return
|
|
8657
|
+
return qrl.resolved = symbolRef = qFuncs[Number(symbol)];
|
|
8705
8658
|
}
|
|
8706
8659
|
const start = now();
|
|
8707
8660
|
const ctx = tryGetInvokeContext();
|
|
8708
8661
|
if (null !== symbolFn) {
|
|
8709
|
-
symbolRef = symbolFn().then((module =>
|
|
8662
|
+
symbolRef = symbolFn().then((module => qrl.resolved = symbolRef = wrapFn(module[symbol])));
|
|
8710
8663
|
} else {
|
|
8711
8664
|
const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
|
|
8712
|
-
symbolRef = maybeThen(imported, (ref =>
|
|
8665
|
+
symbolRef = maybeThen(imported, (ref => qrl.resolved = symbolRef = wrapFn(ref)));
|
|
8713
8666
|
}
|
|
8714
8667
|
"object" === typeof symbolRef && isPromise(symbolRef) && symbolRef.then((() => emitUsedSymbol(symbol, ctx?.$element$, start)), (err => {
|
|
8715
8668
|
console.error(`qrl ${symbol} failed to load`, err);
|
|
@@ -8721,7 +8674,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8721
8674
|
const createOrReuseInvocationContext = invoke2 => null == invoke2 ? newInvokeContext() : isArray(invoke2) ? newInvokeContextFromTuple(invoke2) : invoke2;
|
|
8722
8675
|
const resolvedSymbol = refSymbol ?? symbol;
|
|
8723
8676
|
const hash = getSymbolHash(resolvedSymbol);
|
|
8724
|
-
Object.assign(
|
|
8677
|
+
Object.assign(qrl, {
|
|
8725
8678
|
getSymbol: () => resolvedSymbol,
|
|
8726
8679
|
getHash: () => hash,
|
|
8727
8680
|
getCaptured: () => captureRef,
|
|
@@ -8738,12 +8691,12 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8738
8691
|
dev: null,
|
|
8739
8692
|
resolved: void 0
|
|
8740
8693
|
});
|
|
8741
|
-
symbolRef && (symbolRef = maybeThen(symbolRef, (resolved =>
|
|
8742
|
-
isDev && Object.defineProperty(
|
|
8694
|
+
symbolRef && (symbolRef = maybeThen(symbolRef, (resolved => qrl.resolved = symbolRef = wrapFn(resolved))));
|
|
8695
|
+
isDev && Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
8743
8696
|
get: () => symbolRef
|
|
8744
8697
|
});
|
|
8745
|
-
qDev && seal(
|
|
8746
|
-
return
|
|
8698
|
+
qDev && seal(qrl);
|
|
8699
|
+
return qrl;
|
|
8747
8700
|
};
|
|
8748
8701
|
|
|
8749
8702
|
var getSymbolHash = symbolName => {
|
|
@@ -8754,8 +8707,8 @@ var getSymbolHash = symbolName => {
|
|
|
8754
8707
|
return symbolName;
|
|
8755
8708
|
};
|
|
8756
8709
|
|
|
8757
|
-
function assertQrl(
|
|
8758
|
-
if (qDev && !isQrl2(
|
|
8710
|
+
function assertQrl(qrl) {
|
|
8711
|
+
if (qDev && !isQrl2(qrl)) {
|
|
8759
8712
|
throw new Error("Not a QRL");
|
|
8760
8713
|
}
|
|
8761
8714
|
}
|
|
@@ -8872,8 +8825,8 @@ async function configureDevServer(base, server, opts, sys, path, isClientDevOnly
|
|
|
8872
8825
|
}
|
|
8873
8826
|
const firstInput = opts.input && Object.values(opts.input)[0];
|
|
8874
8827
|
const ssrModule = await server.ssrLoadModule(firstInput);
|
|
8875
|
-
const
|
|
8876
|
-
if ("function" === typeof
|
|
8828
|
+
const render = ssrModule.default ?? ssrModule.render;
|
|
8829
|
+
if ("function" === typeof render) {
|
|
8877
8830
|
const manifest = {
|
|
8878
8831
|
manifestHash: "",
|
|
8879
8832
|
symbols: {},
|
|
@@ -8921,7 +8874,7 @@ async function configureDevServer(base, server, opts, sys, path, isClientDevOnly
|
|
|
8921
8874
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
8922
8875
|
res.setHeader("X-Powered-By", "Qwik Vite Dev Server");
|
|
8923
8876
|
res.writeHead(status);
|
|
8924
|
-
const result = await
|
|
8877
|
+
const result = await render(renderOpts);
|
|
8925
8878
|
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry => {
|
|
8926
8879
|
entry[1].forEach((v => {
|
|
8927
8880
|
const {pathId: pathId, query: query} = parseId(v.url);
|