@qwik.dev/core 2.0.0-alpha.6 → 2.0.0-alpha.8
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 +65 -42
- package/dist/core-internal.d.ts +92 -78
- package/dist/core.cjs +1603 -1374
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1600 -1374
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +963 -834
- package/dist/core.prod.mjs +1093 -927
- package/dist/insights/index.qwik.cjs +3679 -167
- package/dist/insights/index.qwik.mjs +3679 -167
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +228 -5715
- package/dist/optimizer.mjs +208 -6038
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +12 -15
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +787 -7152
- package/dist/server.mjs +805 -7148
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +2 -0
- package/dist/starters/features/cypress/package.json +1 -1
- package/dist/starters/features/drizzle/drizzle/schema.ts +6 -18
- package/dist/starters/features/drizzle/drizzle.config.ts +5 -4
- package/dist/starters/features/drizzle/package.json +14 -11
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/partytown/package.json +1 -1
- package/dist/starters/features/postcss/package.json +1 -1
- package/dist/starters/features/prisma/package.json +1 -1
- package/dist/starters/features/react/package.json +1 -1
- package/dist/starters/features/storybook/package.json +1 -1
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +15 -9
- package/dist/starters/features/tailwind/src/global.css +1 -7
- package/dist/starters/features/turso/package.json +1 -1
- package/dist/starters/features/vitest/package.json +1 -1
- package/dist/testing/index.cjs +1341 -1180
- package/dist/testing/index.mjs +1354 -1186
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +9 -0
- package/package.json +6 -4
- package/public.d.ts +2 -0
- package/dist/starters/features/tailwind/.vscode/settings.json +0 -3
- package/dist/starters/features/tailwind/postcss.config.cjs +0 -6
- package/dist/starters/features/tailwind/tailwind.config.js +0 -8
package/dist/testing/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/testing 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/testing 2.0.0-alpha.8-dev+66037b5
|
|
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
|
|
@@ -22166,7 +22166,7 @@ var seal = (obj) => {
|
|
|
22166
22166
|
};
|
|
22167
22167
|
|
|
22168
22168
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
22169
|
-
var
|
|
22169
|
+
var import_build10 = require("@qwik.dev/core/build");
|
|
22170
22170
|
|
|
22171
22171
|
// packages/qwik/src/core/shared/utils/log.ts
|
|
22172
22172
|
var STYLE = qDev ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
|
|
@@ -22246,10 +22246,10 @@ var codeToText = (code2, ...parts) => {
|
|
|
22246
22246
|
const MAP = [
|
|
22247
22247
|
"Error while serializing class or style attributes",
|
|
22248
22248
|
// 0
|
|
22249
|
-
"",
|
|
22250
|
-
// 1
|
|
22251
|
-
"",
|
|
22252
|
-
// 2
|
|
22249
|
+
"Scheduler not found",
|
|
22250
|
+
// 1
|
|
22251
|
+
"track() received object, without prop to track",
|
|
22252
|
+
// 2
|
|
22253
22253
|
"Only primitive and object literals can be serialized. {{0}}",
|
|
22254
22254
|
// 3
|
|
22255
22255
|
"",
|
|
@@ -22336,17 +22336,15 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
22336
22336
|
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
22337
22337
|
// 44
|
|
22338
22338
|
"Cannot coerce a Signal, use `.value` instead",
|
|
22339
|
-
//
|
|
22339
|
+
// 45
|
|
22340
22340
|
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
|
|
22341
|
-
//
|
|
22341
|
+
// 46
|
|
22342
22342
|
"ComputedSignal is read-only",
|
|
22343
|
-
//
|
|
22343
|
+
// 47
|
|
22344
22344
|
"WrappedSignal is read-only",
|
|
22345
|
-
//
|
|
22346
|
-
"SsrError: Promises not expected here.",
|
|
22347
|
-
// 50
|
|
22345
|
+
// 48
|
|
22348
22346
|
"Attribute value is unsafe for SSR"
|
|
22349
|
-
//
|
|
22347
|
+
// 49
|
|
22350
22348
|
];
|
|
22351
22349
|
let text = MAP[code2] ?? "";
|
|
22352
22350
|
if (parts.length) {
|
|
@@ -22369,7 +22367,31 @@ var qError = (code2, errorMessageArgs = []) => {
|
|
|
22369
22367
|
};
|
|
22370
22368
|
|
|
22371
22369
|
// packages/qwik/src/core/shared/platform/platform.ts
|
|
22370
|
+
var import_build2 = require("@qwik.dev/core/build");
|
|
22371
|
+
|
|
22372
|
+
// packages/qwik/src/core/shared/qrl/qrl-utils.ts
|
|
22372
22373
|
var import_build = require("@qwik.dev/core/build");
|
|
22374
|
+
var SYNC_QRL = "<sync>";
|
|
22375
|
+
var isSyncQrl = (value) => {
|
|
22376
|
+
return isQrl(value) && value.$symbol$ == SYNC_QRL;
|
|
22377
|
+
};
|
|
22378
|
+
var isQrl = (value) => {
|
|
22379
|
+
return typeof value === "function" && typeof value.getSymbol === "function";
|
|
22380
|
+
};
|
|
22381
|
+
function assertQrl(qrl2) {
|
|
22382
|
+
if (import_build.isDev) {
|
|
22383
|
+
if (!isQrl(qrl2)) {
|
|
22384
|
+
throw new Error("Not a QRL");
|
|
22385
|
+
}
|
|
22386
|
+
}
|
|
22387
|
+
}
|
|
22388
|
+
var getSymbolHash = (symbolName) => {
|
|
22389
|
+
const index = symbolName.lastIndexOf("_");
|
|
22390
|
+
if (index > -1) {
|
|
22391
|
+
return symbolName.slice(index + 1);
|
|
22392
|
+
}
|
|
22393
|
+
return symbolName;
|
|
22394
|
+
};
|
|
22373
22395
|
|
|
22374
22396
|
// packages/qwik/src/core/shared/types.ts
|
|
22375
22397
|
var DEBUG_TYPE = "q:type";
|
|
@@ -22415,10 +22437,9 @@ var VirtualTypeName = {
|
|
|
22415
22437
|
|
|
22416
22438
|
// packages/qwik/src/core/shared/utils/markers.ts
|
|
22417
22439
|
var OnRenderProp = "q:renderFn";
|
|
22418
|
-
var ComponentStylesPrefixContent = "\
|
|
22440
|
+
var ComponentStylesPrefixContent = "\u26A1\uFE0F";
|
|
22419
22441
|
var QSlot = "q:slot";
|
|
22420
|
-
var QSlotParent = ":";
|
|
22421
|
-
var QSlotRef = "q:sref";
|
|
22442
|
+
var QSlotParent = "q:sparent";
|
|
22422
22443
|
var QSlotS = "q:s";
|
|
22423
22444
|
var QStyle = "q:style";
|
|
22424
22445
|
var QStyleSelector = "style[q\\:style]";
|
|
@@ -22426,7 +22447,7 @@ var QStyleSSelector = "style[q\\:sstyle]";
|
|
|
22426
22447
|
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
|
|
22427
22448
|
var QScopedStyle = "q:sstyle";
|
|
22428
22449
|
var QCtxAttr = "q:ctx";
|
|
22429
|
-
var
|
|
22450
|
+
var QBackRefs = "q:brefs";
|
|
22430
22451
|
var QFuncsPrefix = "qFuncs_";
|
|
22431
22452
|
var getQFuncs = (document2, hash3) => {
|
|
22432
22453
|
return document2[QFuncsPrefix + hash3] || [];
|
|
@@ -22472,10 +22493,10 @@ var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
|
22472
22493
|
// packages/qwik/src/core/shared/platform/platform.ts
|
|
22473
22494
|
var createPlatform = () => {
|
|
22474
22495
|
return {
|
|
22475
|
-
isServer:
|
|
22496
|
+
isServer: import_build2.isServer,
|
|
22476
22497
|
importSymbol(containerEl, url, symbolName) {
|
|
22477
22498
|
var _a;
|
|
22478
|
-
if (
|
|
22499
|
+
if (import_build2.isServer) {
|
|
22479
22500
|
const hash3 = getSymbolHash(symbolName);
|
|
22480
22501
|
const regSym = (_a = globalThis.__qwik_reg_symbols) == null ? void 0 : _a.get(hash3);
|
|
22481
22502
|
if (regSym) {
|
|
@@ -22563,9 +22584,6 @@ var safeCall = (call, thenFn, rejectFn) => {
|
|
|
22563
22584
|
var maybeThen = (valueOrPromise, thenFn) => {
|
|
22564
22585
|
return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn, shouldNotError) : thenFn(valueOrPromise);
|
|
22565
22586
|
};
|
|
22566
|
-
var maybeThenPassError = (valueOrPromise, thenFn) => {
|
|
22567
|
-
return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
|
|
22568
|
-
};
|
|
22569
22587
|
var shouldNotError = (reason) => {
|
|
22570
22588
|
throwErrorAndStop(reason);
|
|
22571
22589
|
};
|
|
@@ -22611,7 +22629,7 @@ var isFunction = (v) => {
|
|
|
22611
22629
|
};
|
|
22612
22630
|
|
|
22613
22631
|
// packages/qwik/src/build/index.dev.ts
|
|
22614
|
-
var
|
|
22632
|
+
var isDev2 = true;
|
|
22615
22633
|
|
|
22616
22634
|
// packages/qwik/src/core/use/use-locale.ts
|
|
22617
22635
|
var _locale = void 0;
|
|
@@ -22620,7 +22638,7 @@ function setLocale(locale) {
|
|
|
22620
22638
|
}
|
|
22621
22639
|
|
|
22622
22640
|
// packages/qwik/src/core/client/vnode.ts
|
|
22623
|
-
var
|
|
22641
|
+
var import_build8 = require("@qwik.dev/core/build");
|
|
22624
22642
|
|
|
22625
22643
|
// packages/qwik/src/server/utils.ts
|
|
22626
22644
|
var import_meta = {};
|
|
@@ -22654,7 +22672,7 @@ var versions = {
|
|
|
22654
22672
|
};
|
|
22655
22673
|
|
|
22656
22674
|
// packages/qwik/src/server/prefetch-strategy.ts
|
|
22657
|
-
var
|
|
22675
|
+
var import_build3 = require("@qwik.dev/core/build");
|
|
22658
22676
|
function getPrefetchResources(qrls, opts, resolvedManifest) {
|
|
22659
22677
|
if (!resolvedManifest) {
|
|
22660
22678
|
return [];
|
|
@@ -22692,7 +22710,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
|
|
|
22692
22710
|
return prefetchResources;
|
|
22693
22711
|
}
|
|
22694
22712
|
function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
|
|
22695
|
-
const url =
|
|
22713
|
+
const url = import_build3.isDev ? bundleFileName : buildBase + bundleFileName;
|
|
22696
22714
|
let prefetchResource = urls.get(url);
|
|
22697
22715
|
if (!prefetchResource) {
|
|
22698
22716
|
prefetchResource = {
|
|
@@ -22711,7 +22729,7 @@ function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName)
|
|
|
22711
22729
|
}
|
|
22712
22730
|
prefetchResources.push(prefetchResource);
|
|
22713
22731
|
}
|
|
22714
|
-
var
|
|
22732
|
+
var isQrl2 = (value) => {
|
|
22715
22733
|
return typeof value === "function" && typeof value.getSymbol === "function";
|
|
22716
22734
|
};
|
|
22717
22735
|
|
|
@@ -22723,12 +22741,9 @@ Object.freeze(EMPTY_OBJ);
|
|
|
22723
22741
|
|
|
22724
22742
|
// packages/qwik/src/core/shared/qrl/qrl.ts
|
|
22725
22743
|
var inlinedQrl = (symbol, symbolName, lexicalScopeCapture = EMPTY_ARRAY) => {
|
|
22726
|
-
return createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture
|
|
22744
|
+
return createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture);
|
|
22727
22745
|
};
|
|
22728
22746
|
|
|
22729
|
-
// packages/qwik/src/core/ssr/ssr-render-jsx.ts
|
|
22730
|
-
var import_build5 = require("@qwik.dev/core/build");
|
|
22731
|
-
|
|
22732
22747
|
// packages/qwik/src/core/shared/jsx/slot.public.ts
|
|
22733
22748
|
var Slot = (props) => {
|
|
22734
22749
|
return _jsxSorted(Virtual, null, { [QSlotS]: "" }, props.children, 0, props.name ?? "");
|
|
@@ -22815,6 +22830,50 @@ function isPreventDefault(key) {
|
|
|
22815
22830
|
return key.startsWith("preventdefault:");
|
|
22816
22831
|
}
|
|
22817
22832
|
|
|
22833
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
22834
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
22835
|
+
var _a;
|
|
22836
|
+
if (!jsxDev) {
|
|
22837
|
+
return null;
|
|
22838
|
+
}
|
|
22839
|
+
const sanitizedFileName = (_a = jsxDev.fileName) == null ? void 0 : _a.replace(/\\/g, "/");
|
|
22840
|
+
if (sanitizedFileName) {
|
|
22841
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
22842
|
+
}
|
|
22843
|
+
return null;
|
|
22844
|
+
}
|
|
22845
|
+
|
|
22846
|
+
// packages/qwik/src/core/shared/utils/scoped-styles.ts
|
|
22847
|
+
var styleContent = (styleId) => {
|
|
22848
|
+
return ComponentStylesPrefixContent + styleId;
|
|
22849
|
+
};
|
|
22850
|
+
function hasClassAttr(props) {
|
|
22851
|
+
for (const key in props) {
|
|
22852
|
+
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
22853
|
+
return true;
|
|
22854
|
+
}
|
|
22855
|
+
}
|
|
22856
|
+
return false;
|
|
22857
|
+
}
|
|
22858
|
+
function isClassAttr(key) {
|
|
22859
|
+
return key === "class" || key === "className";
|
|
22860
|
+
}
|
|
22861
|
+
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
22862
|
+
return (scopedStyleIds == null ? void 0 : scopedStyleIds.split(" ")) ?? null;
|
|
22863
|
+
}
|
|
22864
|
+
function convertStyleIdsToString(scopedStyleIds) {
|
|
22865
|
+
return Array.from(scopedStyleIds).join(" ");
|
|
22866
|
+
}
|
|
22867
|
+
var addComponentStylePrefix = (styleId) => {
|
|
22868
|
+
if (styleId) {
|
|
22869
|
+
let idx = 0;
|
|
22870
|
+
do {
|
|
22871
|
+
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
22872
|
+
} while ((idx = styleId.indexOf(" ", idx) + 1) !== 0);
|
|
22873
|
+
}
|
|
22874
|
+
return styleId || null;
|
|
22875
|
+
};
|
|
22876
|
+
|
|
22818
22877
|
// packages/qwik/src/core/shared/utils/unitless_number.ts
|
|
22819
22878
|
var unitlessNumbers = /* @__PURE__ */ new Set([
|
|
22820
22879
|
"animationIterationCount",
|
|
@@ -22952,44 +23011,13 @@ var setValueForStyle = (styleName, value) => {
|
|
|
22952
23011
|
function isAriaAttribute(prop) {
|
|
22953
23012
|
return prop.startsWith("aria-");
|
|
22954
23013
|
}
|
|
22955
|
-
var styleContent = (styleId) => {
|
|
22956
|
-
return ComponentStylesPrefixContent + styleId;
|
|
22957
|
-
};
|
|
22958
|
-
|
|
22959
|
-
// packages/qwik/src/core/shared/utils/scoped-styles.ts
|
|
22960
|
-
function hasClassAttr(props) {
|
|
22961
|
-
for (const key in props) {
|
|
22962
|
-
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
22963
|
-
return true;
|
|
22964
|
-
}
|
|
22965
|
-
}
|
|
22966
|
-
return false;
|
|
22967
|
-
}
|
|
22968
|
-
function isClassAttr(key) {
|
|
22969
|
-
return key === "class" || key === "className";
|
|
22970
|
-
}
|
|
22971
|
-
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
22972
|
-
return (scopedStyleIds == null ? void 0 : scopedStyleIds.split(" ")) ?? null;
|
|
22973
|
-
}
|
|
22974
|
-
function convertStyleIdsToString(scopedStyleIds) {
|
|
22975
|
-
return Array.from(scopedStyleIds).join(" ");
|
|
22976
|
-
}
|
|
22977
|
-
var addComponentStylePrefix = (styleId) => {
|
|
22978
|
-
if (styleId) {
|
|
22979
|
-
let idx = 0;
|
|
22980
|
-
do {
|
|
22981
|
-
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
22982
|
-
} while ((idx = styleId.indexOf(" ", idx) + 1) !== 0);
|
|
22983
|
-
}
|
|
22984
|
-
return styleId || null;
|
|
22985
|
-
};
|
|
22986
23014
|
|
|
22987
23015
|
// packages/qwik/src/core/signal/store.ts
|
|
22988
23016
|
var DEBUG = false;
|
|
22989
23017
|
var log = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
|
|
22990
23018
|
var STORE_TARGET = Symbol("store.target");
|
|
22991
23019
|
var STORE_HANDLER = Symbol("store.handler");
|
|
22992
|
-
var
|
|
23020
|
+
var STORE_ALL_PROPS = Symbol("store.all");
|
|
22993
23021
|
var getStoreHandler = (value) => {
|
|
22994
23022
|
return value[STORE_HANDLER];
|
|
22995
23023
|
};
|
|
@@ -23051,7 +23079,12 @@ var StoreHandler = class {
|
|
|
23051
23079
|
}
|
|
23052
23080
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
23053
23081
|
if (effectSubscriber) {
|
|
23054
|
-
|
|
23082
|
+
addStoreEffect(
|
|
23083
|
+
target,
|
|
23084
|
+
Array.isArray(target) ? STORE_ALL_PROPS : prop,
|
|
23085
|
+
this,
|
|
23086
|
+
effectSubscriber
|
|
23087
|
+
);
|
|
23055
23088
|
}
|
|
23056
23089
|
}
|
|
23057
23090
|
if (prop === "toString" && value === Object.prototype.toString) {
|
|
@@ -23098,9 +23131,9 @@ var StoreHandler = class {
|
|
|
23098
23131
|
if (ctx) {
|
|
23099
23132
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
23100
23133
|
if (effectSubscriber) {
|
|
23101
|
-
|
|
23134
|
+
addStoreEffect(
|
|
23102
23135
|
target,
|
|
23103
|
-
Array.isArray(target) ?
|
|
23136
|
+
Array.isArray(target) ? STORE_ALL_PROPS : prop,
|
|
23104
23137
|
this,
|
|
23105
23138
|
effectSubscriber
|
|
23106
23139
|
);
|
|
@@ -23113,13 +23146,17 @@ var StoreHandler = class {
|
|
|
23113
23146
|
const ctx = tryGetInvokeContext();
|
|
23114
23147
|
const effectSubscriber = ctx == null ? void 0 : ctx.$effectSubscriber$;
|
|
23115
23148
|
if (effectSubscriber) {
|
|
23116
|
-
|
|
23149
|
+
addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber);
|
|
23117
23150
|
}
|
|
23118
23151
|
return Reflect.ownKeys(target);
|
|
23119
23152
|
}
|
|
23120
23153
|
getOwnPropertyDescriptor(target, prop) {
|
|
23154
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
23121
23155
|
if (Array.isArray(target) || typeof prop === "symbol") {
|
|
23122
|
-
return
|
|
23156
|
+
return descriptor;
|
|
23157
|
+
}
|
|
23158
|
+
if (descriptor && !descriptor.configurable) {
|
|
23159
|
+
return descriptor;
|
|
23123
23160
|
}
|
|
23124
23161
|
return {
|
|
23125
23162
|
enumerable: true,
|
|
@@ -23127,17 +23164,18 @@ var StoreHandler = class {
|
|
|
23127
23164
|
};
|
|
23128
23165
|
}
|
|
23129
23166
|
};
|
|
23130
|
-
function
|
|
23131
|
-
|
|
23132
|
-
const
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
);
|
|
23140
|
-
|
|
23167
|
+
function addStoreEffect(target, prop, store, effectSubscription) {
|
|
23168
|
+
var _a;
|
|
23169
|
+
const effectsMap = store.$effects$ ||= /* @__PURE__ */ new Map();
|
|
23170
|
+
let effects = effectsMap.get(prop);
|
|
23171
|
+
if (!effects) {
|
|
23172
|
+
effects = /* @__PURE__ */ new Set();
|
|
23173
|
+
effectsMap.set(prop, effects);
|
|
23174
|
+
}
|
|
23175
|
+
ensureContainsSubscription(effects, effectSubscription);
|
|
23176
|
+
ensureContainsBackRef(effectSubscription, target);
|
|
23177
|
+
addQrlToSerializationCtx(effectSubscription, store.$container$);
|
|
23178
|
+
DEBUG && log("sub", pad("\n" + ((_a = store.$effects$) == null ? void 0 : _a.entries.toString()), " "));
|
|
23141
23179
|
}
|
|
23142
23180
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
23143
23181
|
target[prop] = value;
|
|
@@ -23148,15 +23186,87 @@ function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
|
23148
23186
|
);
|
|
23149
23187
|
}
|
|
23150
23188
|
function getEffects(target, prop, storeEffects) {
|
|
23151
|
-
let effectsToTrigger
|
|
23152
|
-
|
|
23189
|
+
let effectsToTrigger;
|
|
23190
|
+
if (storeEffects) {
|
|
23191
|
+
if (Array.isArray(target)) {
|
|
23192
|
+
for (const effects of storeEffects.values()) {
|
|
23193
|
+
effectsToTrigger ||= /* @__PURE__ */ new Set();
|
|
23194
|
+
for (const effect of effects) {
|
|
23195
|
+
effectsToTrigger.add(effect);
|
|
23196
|
+
}
|
|
23197
|
+
}
|
|
23198
|
+
} else {
|
|
23199
|
+
effectsToTrigger = storeEffects.get(prop);
|
|
23200
|
+
}
|
|
23201
|
+
}
|
|
23202
|
+
const storeArrayValue = storeEffects == null ? void 0 : storeEffects.get(STORE_ALL_PROPS);
|
|
23153
23203
|
if (storeArrayValue) {
|
|
23154
|
-
effectsToTrigger ||=
|
|
23155
|
-
|
|
23204
|
+
effectsToTrigger ||= /* @__PURE__ */ new Set();
|
|
23205
|
+
for (const effect of storeArrayValue) {
|
|
23206
|
+
effectsToTrigger.add(effect);
|
|
23207
|
+
}
|
|
23208
|
+
}
|
|
23209
|
+
return effectsToTrigger || null;
|
|
23210
|
+
}
|
|
23211
|
+
|
|
23212
|
+
// packages/qwik/src/core/signal/flags.ts
|
|
23213
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
23214
|
+
var _EFFECT_BACK_REF = Symbol("backRef");
|
|
23215
|
+
|
|
23216
|
+
// packages/qwik/src/core/signal/signal-cleanup.ts
|
|
23217
|
+
var BackRef = class {
|
|
23218
|
+
[_EFFECT_BACK_REF] = null;
|
|
23219
|
+
};
|
|
23220
|
+
function clearAllEffects(container, consumer) {
|
|
23221
|
+
if (vnode_isVNode(consumer) && vnode_isElementVNode(consumer)) {
|
|
23222
|
+
ensureMaterialized(consumer);
|
|
23223
|
+
}
|
|
23224
|
+
const effects = consumer[_EFFECT_BACK_REF];
|
|
23225
|
+
if (!effects) {
|
|
23226
|
+
return;
|
|
23227
|
+
}
|
|
23228
|
+
for (const [, effect] of effects) {
|
|
23229
|
+
const backRefs = effect[2 /* BACK_REF */];
|
|
23230
|
+
if (!backRefs) {
|
|
23231
|
+
return;
|
|
23232
|
+
}
|
|
23233
|
+
for (const producer of backRefs) {
|
|
23234
|
+
if (producer instanceof Signal) {
|
|
23235
|
+
clearSignal(container, producer, effect);
|
|
23236
|
+
} else if (container.$storeProxyMap$.has(producer)) {
|
|
23237
|
+
const target = container.$storeProxyMap$.get(producer);
|
|
23238
|
+
const storeHandler = getStoreHandler(target);
|
|
23239
|
+
clearStore(storeHandler, effect);
|
|
23240
|
+
}
|
|
23241
|
+
}
|
|
23242
|
+
}
|
|
23243
|
+
}
|
|
23244
|
+
function clearSignal(container, producer, effect) {
|
|
23245
|
+
const effects = producer.$effects$;
|
|
23246
|
+
if (effects) {
|
|
23247
|
+
effects.delete(effect);
|
|
23248
|
+
}
|
|
23249
|
+
if (producer instanceof WrappedSignal) {
|
|
23250
|
+
producer.$hostElement$ = null;
|
|
23251
|
+
clearAllEffects(container, producer);
|
|
23252
|
+
}
|
|
23253
|
+
}
|
|
23254
|
+
function clearStore(producer, effect) {
|
|
23255
|
+
const effects = producer == null ? void 0 : producer.$effects$;
|
|
23256
|
+
if (effects) {
|
|
23257
|
+
for (const propEffects of effects.values()) {
|
|
23258
|
+
propEffects.delete(effect);
|
|
23259
|
+
}
|
|
23156
23260
|
}
|
|
23157
|
-
return effectsToTrigger;
|
|
23158
23261
|
}
|
|
23159
23262
|
|
|
23263
|
+
// packages/qwik/src/core/shared/qrl/implicit_dollar.ts
|
|
23264
|
+
var implicit$FirstArg = (fn) => {
|
|
23265
|
+
return function(first, ...rest) {
|
|
23266
|
+
return fn.call(null, dollar(first), ...rest);
|
|
23267
|
+
};
|
|
23268
|
+
};
|
|
23269
|
+
|
|
23160
23270
|
// packages/qwik/src/core/use/use-sequential-scope.ts
|
|
23161
23271
|
var useSequentialScope = () => {
|
|
23162
23272
|
const iCtx = useInvokeContext();
|
|
@@ -23189,171 +23299,41 @@ var useSequentialScope = () => {
|
|
|
23189
23299
|
};
|
|
23190
23300
|
};
|
|
23191
23301
|
|
|
23192
|
-
// packages/qwik/src/core/signal/
|
|
23193
|
-
var
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
}
|
|
23199
|
-
|
|
23200
|
-
if (vnode_isElementVNode(value)) {
|
|
23201
|
-
ensureMaterialized(value);
|
|
23202
|
-
}
|
|
23203
|
-
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
23204
|
-
if (!effects) {
|
|
23205
|
-
return;
|
|
23206
|
-
}
|
|
23207
|
-
for (let i = effects.length - 1; i >= 0; i--) {
|
|
23208
|
-
const subscriber = effects[i];
|
|
23209
|
-
clearEffects(subscriber, value, effects, i, container);
|
|
23210
|
-
}
|
|
23211
|
-
if (effects.length === 0) {
|
|
23212
|
-
vnode_setProp(value, QSubscribers, null);
|
|
23213
|
-
}
|
|
23214
|
-
}
|
|
23215
|
-
function clearSubscriberEffectDependencies(container, value) {
|
|
23216
|
-
if (value.$effectDependencies$) {
|
|
23217
|
-
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
23218
|
-
const subscriber = value.$effectDependencies$[i];
|
|
23219
|
-
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
23220
|
-
}
|
|
23221
|
-
if (value.$effectDependencies$.length === 0) {
|
|
23222
|
-
value.$effectDependencies$ = null;
|
|
23223
|
-
}
|
|
23224
|
-
}
|
|
23225
|
-
}
|
|
23226
|
-
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
23227
|
-
let subscriptionRemoved = false;
|
|
23228
|
-
const seenSet = /* @__PURE__ */ new Set();
|
|
23229
|
-
if (subscriber instanceof WrappedSignal) {
|
|
23230
|
-
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
23231
|
-
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
23232
|
-
const store = container.$storeProxyMap$.get(subscriber);
|
|
23233
|
-
const handler = getStoreHandler(store);
|
|
23234
|
-
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
23235
|
-
}
|
|
23236
|
-
if (subscriptionRemoved) {
|
|
23237
|
-
effectArray.splice(indexToRemove, 1);
|
|
23238
|
-
}
|
|
23239
|
-
}
|
|
23240
|
-
function clearSignalEffects(subscriber, value, seenSet) {
|
|
23241
|
-
const effectSubscriptions = subscriber.$effects$;
|
|
23242
|
-
let subscriptionRemoved = false;
|
|
23243
|
-
if (effectSubscriptions) {
|
|
23244
|
-
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
23245
|
-
const effect = effectSubscriptions[i];
|
|
23246
|
-
if (effect[0 /* EFFECT */] === value) {
|
|
23247
|
-
effectSubscriptions.splice(i, 1);
|
|
23248
|
-
subscriptionRemoved = true;
|
|
23249
|
-
}
|
|
23250
|
-
}
|
|
23251
|
-
}
|
|
23252
|
-
if (subscriber instanceof WrappedSignal) {
|
|
23253
|
-
const hostElement = subscriber.$hostElement$;
|
|
23254
|
-
if (hostElement && hostElement === value) {
|
|
23255
|
-
subscriber.$hostElement$ = null;
|
|
23256
|
-
}
|
|
23257
|
-
const args = subscriber.$args$;
|
|
23258
|
-
if (args) {
|
|
23259
|
-
clearArgsEffects(args, subscriber, seenSet);
|
|
23302
|
+
// packages/qwik/src/core/signal/subscriber.ts
|
|
23303
|
+
var import_build4 = require("@qwik.dev/core/build");
|
|
23304
|
+
function getSubscriber(effect, prop, data) {
|
|
23305
|
+
if (!effect[_EFFECT_BACK_REF]) {
|
|
23306
|
+
if (import_build4.isServer && isSsrNode(effect)) {
|
|
23307
|
+
effect.setProp(QBackRefs, /* @__PURE__ */ new Map());
|
|
23308
|
+
} else {
|
|
23309
|
+
effect[_EFFECT_BACK_REF] = /* @__PURE__ */ new Map();
|
|
23260
23310
|
}
|
|
23261
23311
|
}
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
return false;
|
|
23268
|
-
}
|
|
23269
|
-
let subscriptionRemoved = false;
|
|
23270
|
-
for (const key in effectSubscriptions) {
|
|
23271
|
-
const effects = effectSubscriptions[key];
|
|
23272
|
-
for (let i = effects.length - 1; i >= 0; i--) {
|
|
23273
|
-
const effect = effects[i];
|
|
23274
|
-
if (effect[0 /* EFFECT */] === value) {
|
|
23275
|
-
effects.splice(i, 1);
|
|
23276
|
-
subscriptionRemoved = true;
|
|
23277
|
-
}
|
|
23278
|
-
}
|
|
23279
|
-
if (effects.length === 0) {
|
|
23280
|
-
delete effectSubscriptions[key];
|
|
23281
|
-
}
|
|
23312
|
+
const subMap = effect[_EFFECT_BACK_REF];
|
|
23313
|
+
let sub = subMap.get(prop);
|
|
23314
|
+
if (!sub) {
|
|
23315
|
+
sub = [effect, prop];
|
|
23316
|
+
subMap.set(prop, sub);
|
|
23282
23317
|
}
|
|
23283
|
-
|
|
23284
|
-
|
|
23285
|
-
function clearArgsEffects(args, subscriber, seenSet) {
|
|
23286
|
-
for (let i = args.length - 1; i >= 0; i--) {
|
|
23287
|
-
const arg = args[i];
|
|
23288
|
-
clearArgEffect(arg, subscriber, seenSet);
|
|
23318
|
+
if (data) {
|
|
23319
|
+
sub[3 /* DATA */] = data;
|
|
23289
23320
|
}
|
|
23321
|
+
return sub;
|
|
23290
23322
|
}
|
|
23291
|
-
function
|
|
23292
|
-
|
|
23293
|
-
return;
|
|
23294
|
-
}
|
|
23295
|
-
seenSet.add(arg);
|
|
23296
|
-
if (isSignal(arg)) {
|
|
23297
|
-
clearSignalEffects(arg, subscriber, seenSet);
|
|
23298
|
-
} else if (typeof arg === "object" && arg !== null) {
|
|
23299
|
-
if (isStore(arg)) {
|
|
23300
|
-
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
23301
|
-
} else if (isPropsProxy(arg)) {
|
|
23302
|
-
const constProps = arg[_CONST_PROPS];
|
|
23303
|
-
const varProps = arg[_VAR_PROPS];
|
|
23304
|
-
if (constProps) {
|
|
23305
|
-
for (const key in constProps) {
|
|
23306
|
-
clearArgEffect(constProps[key], subscriber, seenSet);
|
|
23307
|
-
}
|
|
23308
|
-
}
|
|
23309
|
-
for (const key in varProps) {
|
|
23310
|
-
clearArgEffect(varProps[key], subscriber, seenSet);
|
|
23311
|
-
}
|
|
23312
|
-
} else {
|
|
23313
|
-
for (const key in arg) {
|
|
23314
|
-
clearArgEffect(arg[key], subscriber, seenSet);
|
|
23315
|
-
}
|
|
23316
|
-
}
|
|
23317
|
-
} else if (Array.isArray(arg)) {
|
|
23318
|
-
clearArgsEffects(arg, subscriber, seenSet);
|
|
23319
|
-
} else {
|
|
23320
|
-
}
|
|
23323
|
+
function isSsrNode(value) {
|
|
23324
|
+
return "__brand__" in value && "currentComponentNode" in value;
|
|
23321
23325
|
}
|
|
23322
23326
|
|
|
23323
|
-
// packages/qwik/src/core/use/use-
|
|
23324
|
-
var
|
|
23325
|
-
const resource = {
|
|
23326
|
-
__brand: "resource",
|
|
23327
|
-
value: void 0,
|
|
23328
|
-
loading: isServerPlatform() ? false : true,
|
|
23329
|
-
_resolved: void 0,
|
|
23330
|
-
_error: void 0,
|
|
23331
|
-
_state: "pending",
|
|
23332
|
-
_timeout: (opts == null ? void 0 : opts.timeout) ?? -1,
|
|
23333
|
-
_cache: 0
|
|
23334
|
-
};
|
|
23335
|
-
return resource;
|
|
23336
|
-
};
|
|
23337
|
-
var createResourceReturn = (container, opts, initialPromise) => {
|
|
23338
|
-
const result = _createResourceReturn(opts);
|
|
23339
|
-
result.value = initialPromise;
|
|
23340
|
-
return createStore(container, result, 1 /* RECURSIVE */);
|
|
23341
|
-
};
|
|
23342
|
-
var runResource = (task, container, host) => {
|
|
23327
|
+
// packages/qwik/src/core/use/use-task.ts
|
|
23328
|
+
var runTask = (task, container, host) => {
|
|
23343
23329
|
task.$flags$ &= ~8 /* DIRTY */;
|
|
23344
23330
|
cleanupTask(task);
|
|
23345
|
-
const iCtx = newInvokeContext(container.$locale$, host, void 0,
|
|
23331
|
+
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
23346
23332
|
iCtx.$container$ = container;
|
|
23347
|
-
const taskFn = task.$qrl$.getFn(iCtx, () =>
|
|
23348
|
-
const resource = task.$state$;
|
|
23349
|
-
assertDefined(
|
|
23350
|
-
resource,
|
|
23351
|
-
'useResource: when running a resource, "task.resource" must be a defined.',
|
|
23352
|
-
task
|
|
23353
|
-
);
|
|
23333
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
|
|
23354
23334
|
const track = (obj, prop) => {
|
|
23355
23335
|
const ctx = newInvokeContext();
|
|
23356
|
-
ctx.$effectSubscriber$ =
|
|
23336
|
+
ctx.$effectSubscriber$ = getSubscriber(task, ":" /* COMPONENT */);
|
|
23357
23337
|
ctx.$container$ = container;
|
|
23358
23338
|
return invoke(ctx, () => {
|
|
23359
23339
|
if (isFunction(obj)) {
|
|
@@ -23363,128 +23343,155 @@ var runResource = (task, container, host) => {
|
|
|
23363
23343
|
return obj[prop];
|
|
23364
23344
|
} else if (isSignal(obj)) {
|
|
23365
23345
|
return obj.value;
|
|
23366
|
-
} else {
|
|
23346
|
+
} else if (isStore(obj)) {
|
|
23347
|
+
addStoreEffect(
|
|
23348
|
+
getStoreTarget(obj),
|
|
23349
|
+
STORE_ALL_PROPS,
|
|
23350
|
+
getStoreHandler(obj),
|
|
23351
|
+
ctx.$effectSubscriber$
|
|
23352
|
+
);
|
|
23367
23353
|
return obj;
|
|
23354
|
+
} else {
|
|
23355
|
+
throw qError(2 /* trackObjectWithoutProp */);
|
|
23368
23356
|
}
|
|
23369
23357
|
});
|
|
23370
23358
|
};
|
|
23371
23359
|
const handleError = (reason) => container.handleError(reason, host);
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23360
|
+
let cleanupFns = null;
|
|
23361
|
+
const cleanup2 = (fn) => {
|
|
23362
|
+
if (typeof fn == "function") {
|
|
23363
|
+
if (!cleanupFns) {
|
|
23364
|
+
cleanupFns = [];
|
|
23365
|
+
task.$destroy$ = noSerialize(() => {
|
|
23366
|
+
task.$destroy$ = null;
|
|
23367
|
+
cleanupFns.forEach((fn2) => {
|
|
23368
|
+
try {
|
|
23369
|
+
fn2();
|
|
23370
|
+
} catch (err) {
|
|
23371
|
+
handleError(err);
|
|
23372
|
+
}
|
|
23373
|
+
});
|
|
23374
|
+
});
|
|
23379
23375
|
}
|
|
23380
|
-
|
|
23381
|
-
done = true;
|
|
23382
|
-
});
|
|
23383
|
-
const resourceTarget = unwrapStore(resource);
|
|
23384
|
-
const opts = {
|
|
23385
|
-
track,
|
|
23386
|
-
cleanup(fn) {
|
|
23387
|
-
if (typeof fn === "function") {
|
|
23388
|
-
cleanups.push(fn);
|
|
23389
|
-
}
|
|
23390
|
-
},
|
|
23391
|
-
cache(policy) {
|
|
23392
|
-
let milliseconds = 0;
|
|
23393
|
-
if (policy === "immutable") {
|
|
23394
|
-
milliseconds = Infinity;
|
|
23395
|
-
} else {
|
|
23396
|
-
milliseconds = policy;
|
|
23397
|
-
}
|
|
23398
|
-
resource._cache = milliseconds;
|
|
23399
|
-
},
|
|
23400
|
-
previous: resourceTarget._resolved
|
|
23401
|
-
};
|
|
23402
|
-
let resolve;
|
|
23403
|
-
let reject;
|
|
23404
|
-
let done = false;
|
|
23405
|
-
const setState = (resolved, value) => {
|
|
23406
|
-
if (!done) {
|
|
23407
|
-
done = true;
|
|
23408
|
-
if (resolved) {
|
|
23409
|
-
done = true;
|
|
23410
|
-
resource.loading = false;
|
|
23411
|
-
resource._state = "resolved";
|
|
23412
|
-
resource._resolved = value;
|
|
23413
|
-
resource._error = void 0;
|
|
23414
|
-
resolve(value);
|
|
23415
|
-
} else {
|
|
23416
|
-
done = true;
|
|
23417
|
-
resource.loading = false;
|
|
23418
|
-
resource._state = "rejected";
|
|
23419
|
-
resource._error = value;
|
|
23420
|
-
reject(value);
|
|
23421
|
-
}
|
|
23422
|
-
return true;
|
|
23376
|
+
cleanupFns.push(fn);
|
|
23423
23377
|
}
|
|
23424
|
-
return false;
|
|
23425
23378
|
};
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
}
|
|
23431
|
-
});
|
|
23432
|
-
invoke(iCtx, () => {
|
|
23433
|
-
resource._state = "pending";
|
|
23434
|
-
resource.loading = !isServerPlatform();
|
|
23435
|
-
const promise2 = resource.value = new Promise((r, re) => {
|
|
23436
|
-
resolve = r;
|
|
23437
|
-
reject = re;
|
|
23438
|
-
});
|
|
23439
|
-
promise2.catch(ignoreErrorToPreventNodeFromCrashing);
|
|
23440
|
-
});
|
|
23441
|
-
const promise = safeCall(
|
|
23442
|
-
() => Promise.resolve(taskFn(opts)),
|
|
23443
|
-
(value) => {
|
|
23444
|
-
setState(true, value);
|
|
23445
|
-
},
|
|
23379
|
+
const taskApi = { track, cleanup: cleanup2 };
|
|
23380
|
+
const result = safeCall(
|
|
23381
|
+
() => taskFn(taskApi),
|
|
23382
|
+
cleanup2,
|
|
23446
23383
|
(err) => {
|
|
23447
23384
|
if (isPromise(err)) {
|
|
23448
|
-
return err.then(() =>
|
|
23385
|
+
return err.then(() => runTask(task, container, host));
|
|
23449
23386
|
} else {
|
|
23450
|
-
|
|
23387
|
+
throw err;
|
|
23451
23388
|
}
|
|
23452
23389
|
}
|
|
23453
23390
|
);
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23391
|
+
return result;
|
|
23392
|
+
};
|
|
23393
|
+
var cleanupTask = (task) => {
|
|
23394
|
+
const destroy = task.$destroy$;
|
|
23395
|
+
if (destroy) {
|
|
23396
|
+
task.$destroy$ = null;
|
|
23397
|
+
try {
|
|
23398
|
+
destroy();
|
|
23399
|
+
} catch (err) {
|
|
23400
|
+
logError(err);
|
|
23401
|
+
}
|
|
23464
23402
|
}
|
|
23465
|
-
return promise;
|
|
23466
23403
|
};
|
|
23467
|
-
var
|
|
23404
|
+
var Task = class extends BackRef {
|
|
23405
|
+
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
23406
|
+
super();
|
|
23407
|
+
this.$flags$ = $flags$;
|
|
23408
|
+
this.$index$ = $index$;
|
|
23409
|
+
this.$el$ = $el$;
|
|
23410
|
+
this.$qrl$ = $qrl$;
|
|
23411
|
+
this.$state$ = $state$;
|
|
23412
|
+
this.$destroy$ = $destroy$;
|
|
23413
|
+
}
|
|
23414
|
+
};
|
|
23415
|
+
var isTask = (value) => {
|
|
23416
|
+
return value instanceof Task;
|
|
23468
23417
|
};
|
|
23469
23418
|
|
|
23470
23419
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
23471
|
-
var
|
|
23420
|
+
var import_build7 = require("@qwik.dev/core/build");
|
|
23421
|
+
|
|
23422
|
+
// packages/qwik/src/core/client/util-mapArray.ts
|
|
23423
|
+
var mapApp_findIndx = (array, key, start) => {
|
|
23424
|
+
assertTrue(start % 2 === 0, "Expecting even number.");
|
|
23425
|
+
let bottom = start >> 1;
|
|
23426
|
+
let top = array.length - 2 >> 1;
|
|
23427
|
+
while (bottom <= top) {
|
|
23428
|
+
const mid = bottom + (top - bottom >> 1);
|
|
23429
|
+
const midKey = array[mid << 1];
|
|
23430
|
+
if (midKey === key) {
|
|
23431
|
+
return mid << 1;
|
|
23432
|
+
}
|
|
23433
|
+
if (midKey < key) {
|
|
23434
|
+
bottom = mid + 1;
|
|
23435
|
+
} else {
|
|
23436
|
+
top = mid - 1;
|
|
23437
|
+
}
|
|
23438
|
+
}
|
|
23439
|
+
return bottom << 1 ^ -1;
|
|
23440
|
+
};
|
|
23441
|
+
var mapArray_set = (array, key, value, start) => {
|
|
23442
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
23443
|
+
if (indx >= 0) {
|
|
23444
|
+
if (value == null) {
|
|
23445
|
+
array.splice(indx, 2);
|
|
23446
|
+
} else {
|
|
23447
|
+
array[indx + 1] = value;
|
|
23448
|
+
}
|
|
23449
|
+
} else if (value != null) {
|
|
23450
|
+
array.splice(indx ^ -1, 0, key, value);
|
|
23451
|
+
}
|
|
23452
|
+
};
|
|
23453
|
+
var mapApp_remove = (array, key, start) => {
|
|
23454
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
23455
|
+
let value = null;
|
|
23456
|
+
if (indx >= 0) {
|
|
23457
|
+
value = array[indx + 1];
|
|
23458
|
+
array.splice(indx, 2);
|
|
23459
|
+
return value;
|
|
23460
|
+
}
|
|
23461
|
+
return value;
|
|
23462
|
+
};
|
|
23463
|
+
var mapArray_get = (array, key, start) => {
|
|
23464
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
23465
|
+
if (indx >= 0) {
|
|
23466
|
+
return array[indx + 1];
|
|
23467
|
+
} else {
|
|
23468
|
+
return null;
|
|
23469
|
+
}
|
|
23470
|
+
};
|
|
23471
|
+
var mapArray_has = (array, key, start) => {
|
|
23472
|
+
return mapApp_findIndx(array, key, start) >= 0;
|
|
23473
|
+
};
|
|
23472
23474
|
|
|
23473
23475
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
23474
|
-
var
|
|
23476
|
+
var import_build5 = require("@qwik.dev/core/build");
|
|
23477
|
+
var isForeignObjectElement = (elementName) => {
|
|
23478
|
+
return import_build5.isDev ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
|
|
23479
|
+
};
|
|
23475
23480
|
var isSvgElement = (elementName) => elementName === "svg" || isForeignObjectElement(elementName);
|
|
23476
23481
|
var isMathElement = (elementName) => elementName === "math";
|
|
23477
23482
|
var vnode_isDefaultNamespace = (vnode) => {
|
|
23478
23483
|
const flags = vnode[0 /* flags */];
|
|
23479
23484
|
return (flags & 192 /* NAMESPACE_MASK */) === 0;
|
|
23480
23485
|
};
|
|
23481
|
-
var vnode_getElementNamespaceFlags = (
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23486
|
+
var vnode_getElementNamespaceFlags = (element) => {
|
|
23487
|
+
const namespace = fastNamespaceURI(element);
|
|
23488
|
+
switch (namespace) {
|
|
23489
|
+
case SVG_NS:
|
|
23490
|
+
return 64 /* NS_svg */;
|
|
23491
|
+
case MATH_NS:
|
|
23492
|
+
return 128 /* NS_math */;
|
|
23493
|
+
default:
|
|
23494
|
+
return 0 /* NS_html */;
|
|
23488
23495
|
}
|
|
23489
23496
|
};
|
|
23490
23497
|
function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
|
|
@@ -23640,21 +23647,28 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
23640
23647
|
}
|
|
23641
23648
|
|
|
23642
23649
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
23643
|
-
var
|
|
23650
|
+
var import_build6 = require("@qwik.dev/core/build");
|
|
23644
23651
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
23645
|
-
const iCtx = newInvokeContext(
|
|
23646
|
-
|
|
23647
|
-
|
|
23652
|
+
const iCtx = newInvokeContext(
|
|
23653
|
+
container.$locale$,
|
|
23654
|
+
subscriptionHost || void 0,
|
|
23655
|
+
void 0,
|
|
23656
|
+
RenderEvent
|
|
23657
|
+
);
|
|
23658
|
+
if (subscriptionHost) {
|
|
23659
|
+
iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, ":" /* COMPONENT */);
|
|
23660
|
+
iCtx.$container$ = container;
|
|
23661
|
+
}
|
|
23648
23662
|
let componentFn;
|
|
23649
23663
|
container.ensureProjectionResolved(renderHost);
|
|
23650
23664
|
let isInlineComponent = false;
|
|
23651
23665
|
if (componentQRL === null) {
|
|
23652
|
-
componentQRL =
|
|
23666
|
+
componentQRL = container.getHostProp(renderHost, OnRenderProp);
|
|
23653
23667
|
assertDefined(componentQRL, "No Component found at this location");
|
|
23654
23668
|
}
|
|
23655
|
-
if (
|
|
23669
|
+
if (isQrl(componentQRL)) {
|
|
23656
23670
|
props = props || container.getHostProp(renderHost, ELEMENT_PROPS) || EMPTY_OBJ;
|
|
23657
|
-
if (props
|
|
23671
|
+
if (props.children) {
|
|
23658
23672
|
delete props.children;
|
|
23659
23673
|
}
|
|
23660
23674
|
componentFn = componentQRL.getFn(iCtx);
|
|
@@ -23671,19 +23685,17 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
23671
23685
|
if (!isInlineComponent) {
|
|
23672
23686
|
container.setHostProp(renderHost, ELEMENT_SEQ_IDX, null);
|
|
23673
23687
|
container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
|
|
23674
|
-
|
|
23675
|
-
container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
23676
|
-
}
|
|
23688
|
+
container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
23677
23689
|
}
|
|
23678
23690
|
if (vnode_isVNode(renderHost)) {
|
|
23679
|
-
|
|
23691
|
+
clearAllEffects(container, renderHost);
|
|
23680
23692
|
}
|
|
23681
23693
|
return componentFn(props);
|
|
23682
23694
|
},
|
|
23683
23695
|
(jsx4) => {
|
|
23684
23696
|
const useOnEvents = container.getHostProp(renderHost, USE_ON_LOCAL);
|
|
23685
23697
|
if (useOnEvents) {
|
|
23686
|
-
return
|
|
23698
|
+
return addUseOnEvents(jsx4, useOnEvents);
|
|
23687
23699
|
}
|
|
23688
23700
|
return jsx4;
|
|
23689
23701
|
},
|
|
@@ -23701,6 +23713,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
23701
23713
|
};
|
|
23702
23714
|
function addUseOnEvents(jsx4, useOnEvents) {
|
|
23703
23715
|
const jsxElement = findFirstStringJSX(jsx4);
|
|
23716
|
+
let jsxResult = jsx4;
|
|
23704
23717
|
return maybeThen(jsxElement, (jsxElement2) => {
|
|
23705
23718
|
let isInvisibleComponent = false;
|
|
23706
23719
|
if (!jsxElement2) {
|
|
@@ -23710,16 +23723,18 @@ function addUseOnEvents(jsx4, useOnEvents) {
|
|
|
23710
23723
|
if (Object.prototype.hasOwnProperty.call(useOnEvents, key)) {
|
|
23711
23724
|
if (isInvisibleComponent) {
|
|
23712
23725
|
if (key === "onQvisible$") {
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23726
|
+
const [jsxElement3, jsx5] = addScriptNodeForInvisibleComponents(jsxResult);
|
|
23727
|
+
jsxResult = jsx5;
|
|
23728
|
+
if (jsxElement3) {
|
|
23729
|
+
addUseOnEvent(jsxElement3, "document:onQinit$", useOnEvents[key]);
|
|
23716
23730
|
}
|
|
23717
23731
|
} else if (key.startsWith("document:") || key.startsWith("window:")) {
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23732
|
+
const [jsxElement3, jsx5] = addScriptNodeForInvisibleComponents(jsxResult);
|
|
23733
|
+
jsxResult = jsx5;
|
|
23734
|
+
if (jsxElement3) {
|
|
23735
|
+
addUseOnEvent(jsxElement3, key, useOnEvents[key]);
|
|
23721
23736
|
}
|
|
23722
|
-
} else if (
|
|
23737
|
+
} else if (import_build6.isDev) {
|
|
23723
23738
|
logWarn(
|
|
23724
23739
|
'You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. '
|
|
23725
23740
|
);
|
|
@@ -23729,7 +23744,7 @@ function addUseOnEvents(jsx4, useOnEvents) {
|
|
|
23729
23744
|
}
|
|
23730
23745
|
}
|
|
23731
23746
|
}
|
|
23732
|
-
return
|
|
23747
|
+
return jsxResult;
|
|
23733
23748
|
});
|
|
23734
23749
|
}
|
|
23735
23750
|
function addUseOnEvent(jsxElement, key, value) {
|
|
@@ -23780,6 +23795,9 @@ function addScriptNodeForInvisibleComponents(jsx4) {
|
|
|
23780
23795
|
null,
|
|
23781
23796
|
3
|
|
23782
23797
|
);
|
|
23798
|
+
if (jsx4.type === Slot) {
|
|
23799
|
+
return [jsxElement, _jsxSorted(Fragment, null, null, [jsx4, jsxElement], 0, null)];
|
|
23800
|
+
}
|
|
23783
23801
|
if (jsx4.children == null) {
|
|
23784
23802
|
jsx4.children = jsxElement;
|
|
23785
23803
|
} else if (Array.isArray(jsx4.children)) {
|
|
@@ -23787,20 +23805,23 @@ function addScriptNodeForInvisibleComponents(jsx4) {
|
|
|
23787
23805
|
} else {
|
|
23788
23806
|
jsx4.children = [jsx4.children, jsxElement];
|
|
23789
23807
|
}
|
|
23790
|
-
return jsxElement;
|
|
23808
|
+
return [jsxElement, jsx4];
|
|
23791
23809
|
} else if (Array.isArray(jsx4) && jsx4.length) {
|
|
23792
|
-
|
|
23810
|
+
const [jsxElement, _] = addScriptNodeForInvisibleComponents(jsx4[0]);
|
|
23811
|
+
return [jsxElement, jsx4];
|
|
23793
23812
|
}
|
|
23794
|
-
return null;
|
|
23813
|
+
return [null, null];
|
|
23795
23814
|
}
|
|
23796
23815
|
|
|
23816
|
+
// packages/qwik/src/core/shared/utils/constants.ts
|
|
23817
|
+
var _CONST_PROPS = Symbol("CONST");
|
|
23818
|
+
var _VAR_PROPS = Symbol("VAR");
|
|
23819
|
+
var _IMMUTABLE = Symbol("IMMUTABLE");
|
|
23820
|
+
|
|
23797
23821
|
// packages/qwik/src/core/shared/utils/prop.ts
|
|
23798
23822
|
function isSlotProp(prop) {
|
|
23799
23823
|
return !prop.startsWith("q:") && !prop.startsWith(NON_SERIALIZABLE_MARKER_PREFIX);
|
|
23800
23824
|
}
|
|
23801
|
-
function isParentSlotProp(prop) {
|
|
23802
|
-
return prop.startsWith(QSlotParent);
|
|
23803
|
-
}
|
|
23804
23825
|
|
|
23805
23826
|
// packages/qwik/src/core/shared/utils/character-escaping.ts
|
|
23806
23827
|
function escapeHTML(html) {
|
|
@@ -23832,19 +23853,6 @@ function escapeHTML(html) {
|
|
|
23832
23853
|
}
|
|
23833
23854
|
}
|
|
23834
23855
|
|
|
23835
|
-
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
23836
|
-
function getFileLocationFromJsx(jsxDev) {
|
|
23837
|
-
var _a;
|
|
23838
|
-
if (!jsxDev) {
|
|
23839
|
-
return null;
|
|
23840
|
-
}
|
|
23841
|
-
const sanitizedFileName = (_a = jsxDev.fileName) == null ? void 0 : _a.replace(/\\/g, "/");
|
|
23842
|
-
if (sanitizedFileName) {
|
|
23843
|
-
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
23844
|
-
}
|
|
23845
|
-
return null;
|
|
23846
|
-
}
|
|
23847
|
-
|
|
23848
23856
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
23849
23857
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
23850
23858
|
let journal = container.$journal$;
|
|
@@ -23881,7 +23889,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
23881
23889
|
descend(jsxValue, false);
|
|
23882
23890
|
} else if (isSignal(jsxValue)) {
|
|
23883
23891
|
if (vCurrent) {
|
|
23884
|
-
|
|
23892
|
+
clearAllEffects(container, vCurrent);
|
|
23885
23893
|
}
|
|
23886
23894
|
expectVirtual("S" /* WrappedSignal */, null);
|
|
23887
23895
|
descend(
|
|
@@ -24038,8 +24046,9 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24038
24046
|
};
|
|
24039
24047
|
const projections = [];
|
|
24040
24048
|
if (host) {
|
|
24041
|
-
|
|
24042
|
-
|
|
24049
|
+
const props = vnode_getProps(host);
|
|
24050
|
+
for (let i = 0; i < props.length; i = i + 2) {
|
|
24051
|
+
const prop = props[i];
|
|
24043
24052
|
if (isSlotProp(prop)) {
|
|
24044
24053
|
const slotName = prop;
|
|
24045
24054
|
projections.push(slotName);
|
|
@@ -24081,10 +24090,11 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24081
24090
|
slotName,
|
|
24082
24091
|
(id) => vnode_locate(container.rootVNode, id)
|
|
24083
24092
|
);
|
|
24093
|
+
vCurrent = vCurrent && vCurrent[0 /* flags */] & 32 /* Deleted */ ? null : vCurrent;
|
|
24084
24094
|
if (vCurrent == null) {
|
|
24085
24095
|
vNewNode = vnode_newVirtual();
|
|
24086
|
-
|
|
24087
|
-
|
|
24096
|
+
import_build7.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
24097
|
+
import_build7.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
|
|
24088
24098
|
vnode_setProp(vNewNode, QSlot, slotName);
|
|
24089
24099
|
vnode_setProp(vNewNode, QSlotParent, vParent);
|
|
24090
24100
|
vnode_setProp(vParent, slotName, vNewNode);
|
|
@@ -24110,11 +24120,16 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24110
24120
|
);
|
|
24111
24121
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
24112
24122
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
24113
|
-
|
|
24114
|
-
|
|
24123
|
+
import_build7.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
24124
|
+
import_build7.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
24115
24125
|
return false;
|
|
24116
24126
|
} else if (vProjectedNode === vCurrent) {
|
|
24117
24127
|
} else {
|
|
24128
|
+
const parent = vnode_getParent(vProjectedNode);
|
|
24129
|
+
const isAlreadyProjected = !!parent && !(vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate);
|
|
24130
|
+
if (isAlreadyProjected && vParent !== parent) {
|
|
24131
|
+
vnode_remove(journal, parent, vProjectedNode, false);
|
|
24132
|
+
}
|
|
24118
24133
|
vnode_insertBefore(
|
|
24119
24134
|
journal,
|
|
24120
24135
|
vParent,
|
|
@@ -24123,8 +24138,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24123
24138
|
);
|
|
24124
24139
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
24125
24140
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
24126
|
-
|
|
24127
|
-
|
|
24141
|
+
import_build7.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
24142
|
+
import_build7.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
24128
24143
|
}
|
|
24129
24144
|
return true;
|
|
24130
24145
|
}
|
|
@@ -24170,8 +24185,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24170
24185
|
while (vCurrent) {
|
|
24171
24186
|
const toRemove = vCurrent;
|
|
24172
24187
|
advanceToNextSibling();
|
|
24173
|
-
cleanup(container, toRemove);
|
|
24174
24188
|
if (vParent === vnode_getParent(toRemove)) {
|
|
24189
|
+
cleanup(container, toRemove);
|
|
24175
24190
|
vnode_remove(journal, vParent, toRemove, true);
|
|
24176
24191
|
}
|
|
24177
24192
|
}
|
|
@@ -24195,14 +24210,20 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24195
24210
|
if (isJsxPropertyAnEventName(key2)) {
|
|
24196
24211
|
const eventName = getEventNameFromJsxProp(key2);
|
|
24197
24212
|
const scope = getEventNameScopeFromJsxProp(key2);
|
|
24198
|
-
vnode_setProp(
|
|
24199
|
-
vNewNode,
|
|
24200
|
-
HANDLER_PREFIX + ":" + scope + ":" + eventName,
|
|
24201
|
-
value
|
|
24202
|
-
);
|
|
24203
24213
|
if (eventName) {
|
|
24214
|
+
vnode_setProp(
|
|
24215
|
+
vNewNode,
|
|
24216
|
+
HANDLER_PREFIX + ":" + scope + ":" + eventName,
|
|
24217
|
+
value
|
|
24218
|
+
);
|
|
24204
24219
|
registerQwikLoaderEvent(eventName);
|
|
24205
24220
|
}
|
|
24221
|
+
if (scope) {
|
|
24222
|
+
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key2);
|
|
24223
|
+
if (htmlEvent) {
|
|
24224
|
+
vnode_setAttr(journal, vNewNode, htmlEvent, "");
|
|
24225
|
+
}
|
|
24226
|
+
}
|
|
24206
24227
|
needsQDispatchEventPatch = true;
|
|
24207
24228
|
continue;
|
|
24208
24229
|
}
|
|
@@ -24213,12 +24234,14 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24213
24234
|
} else if (typeof value === "function") {
|
|
24214
24235
|
value(element);
|
|
24215
24236
|
continue;
|
|
24237
|
+
} else if (value == null) {
|
|
24238
|
+
continue;
|
|
24216
24239
|
} else {
|
|
24217
24240
|
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
24218
24241
|
}
|
|
24219
24242
|
}
|
|
24220
24243
|
if (isSignal(value)) {
|
|
24221
|
-
const signalData = new
|
|
24244
|
+
const signalData = new SubscriptionData({
|
|
24222
24245
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
24223
24246
|
$isConst$: true
|
|
24224
24247
|
});
|
|
@@ -24237,7 +24260,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24237
24260
|
}
|
|
24238
24261
|
if (elementName === "textarea" && key2 === "value") {
|
|
24239
24262
|
if (value && typeof value !== "string") {
|
|
24240
|
-
if (
|
|
24263
|
+
if (import_build7.isDev) {
|
|
24241
24264
|
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
24242
24265
|
}
|
|
24243
24266
|
continue;
|
|
@@ -24318,7 +24341,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24318
24341
|
let returnValue = false;
|
|
24319
24342
|
qrls.flat(2).forEach((qrl2) => {
|
|
24320
24343
|
if (qrl2) {
|
|
24321
|
-
const value =
|
|
24344
|
+
const value = container.$scheduler$(
|
|
24345
|
+
2 /* RUN_QRL */,
|
|
24346
|
+
vNode,
|
|
24347
|
+
qrl2,
|
|
24348
|
+
[event, element]
|
|
24349
|
+
);
|
|
24322
24350
|
returnValue = returnValue || value === true;
|
|
24323
24351
|
}
|
|
24324
24352
|
});
|
|
@@ -24329,10 +24357,10 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24329
24357
|
}
|
|
24330
24358
|
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
24331
24359
|
vnode_ensureElementInflated(vnode);
|
|
24332
|
-
const dstAttrs = vnode;
|
|
24360
|
+
const dstAttrs = vnode_getProps(vnode);
|
|
24333
24361
|
let srcIdx = 0;
|
|
24334
24362
|
const srcLength = srcAttrs.length;
|
|
24335
|
-
let dstIdx =
|
|
24363
|
+
let dstIdx = 0;
|
|
24336
24364
|
let dstLength = dstAttrs.length;
|
|
24337
24365
|
let srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
24338
24366
|
let dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
@@ -24350,12 +24378,14 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24350
24378
|
} else if (typeof value === "function") {
|
|
24351
24379
|
value(element);
|
|
24352
24380
|
return;
|
|
24381
|
+
} else if (value == null) {
|
|
24382
|
+
return;
|
|
24353
24383
|
} else {
|
|
24354
24384
|
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
24355
24385
|
}
|
|
24356
24386
|
}
|
|
24357
24387
|
if (isSignal(value)) {
|
|
24358
|
-
const signalData = new
|
|
24388
|
+
const signalData = new SubscriptionData({
|
|
24359
24389
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
24360
24390
|
$isConst$: false
|
|
24361
24391
|
});
|
|
@@ -24368,17 +24398,17 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24368
24398
|
};
|
|
24369
24399
|
const recordJsxEvent = (key, value) => {
|
|
24370
24400
|
const eventName = getEventNameFromJsxProp(key);
|
|
24401
|
+
const scope = getEventNameScopeFromJsxProp(key);
|
|
24371
24402
|
if (eventName) {
|
|
24372
|
-
const scope = getEventNameScopeFromJsxProp(key);
|
|
24373
24403
|
record(":" + scope + ":" + eventName, value);
|
|
24374
|
-
}
|
|
24375
|
-
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
|
|
24376
|
-
if (htmlEvent) {
|
|
24377
|
-
record(htmlEvent, "");
|
|
24378
|
-
}
|
|
24379
|
-
if (eventName) {
|
|
24380
24404
|
registerQwikLoaderEvent(eventName);
|
|
24381
24405
|
}
|
|
24406
|
+
if (scope) {
|
|
24407
|
+
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
|
|
24408
|
+
if (htmlEvent) {
|
|
24409
|
+
record(htmlEvent, "");
|
|
24410
|
+
}
|
|
24411
|
+
}
|
|
24382
24412
|
};
|
|
24383
24413
|
while (srcKey !== null || dstKey !== null) {
|
|
24384
24414
|
if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || (dstKey == null ? void 0 : dstKey.startsWith(Q_PREFIX))) {
|
|
@@ -24494,7 +24524,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24494
24524
|
vCurrent && getInsertBefore()
|
|
24495
24525
|
);
|
|
24496
24526
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
|
|
24497
|
-
|
|
24527
|
+
import_build7.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
|
|
24498
24528
|
}
|
|
24499
24529
|
function expectComponent(component) {
|
|
24500
24530
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -24521,20 +24551,15 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24521
24551
|
shouldRender = true;
|
|
24522
24552
|
} else if (!hashesAreEqual) {
|
|
24523
24553
|
insertNewComponent(host, componentQRL, jsxProps);
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
vNewNode[0 /* flags */] = host[0 /* flags */];
|
|
24527
|
-
}
|
|
24528
|
-
host = vNewNode;
|
|
24529
|
-
shouldRender = true;
|
|
24530
|
-
}
|
|
24554
|
+
host = vNewNode;
|
|
24555
|
+
shouldRender = true;
|
|
24531
24556
|
}
|
|
24532
24557
|
if (host) {
|
|
24533
24558
|
const vNodeProps = vnode_getProp(host, ELEMENT_PROPS, container.$getObjectById$);
|
|
24534
24559
|
shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps);
|
|
24535
24560
|
if (shouldRender) {
|
|
24536
24561
|
host[0 /* flags */] &= ~32 /* Deleted */;
|
|
24537
|
-
container.$scheduler$(
|
|
24562
|
+
container.$scheduler$(6 /* COMPONENT */, host, componentQRL, jsxProps);
|
|
24538
24563
|
}
|
|
24539
24564
|
}
|
|
24540
24565
|
descendContentToProject(jsxNode2.children, host);
|
|
@@ -24542,6 +24567,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24542
24567
|
const lookupKey = jsxNode2.key;
|
|
24543
24568
|
const vNodeLookupKey = getKey(host);
|
|
24544
24569
|
const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
|
|
24570
|
+
const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
|
|
24545
24571
|
if (!lookupKeysAreEqual) {
|
|
24546
24572
|
vNewNode = retrieveChildWithKey(null, lookupKey);
|
|
24547
24573
|
if (vNewNode) {
|
|
@@ -24550,6 +24576,9 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24550
24576
|
insertNewInlineComponent();
|
|
24551
24577
|
}
|
|
24552
24578
|
host = vNewNode;
|
|
24579
|
+
} else if (vNodeComponentHash != null) {
|
|
24580
|
+
insertNewInlineComponent();
|
|
24581
|
+
host = vNewNode;
|
|
24553
24582
|
}
|
|
24554
24583
|
if (host) {
|
|
24555
24584
|
let componentHost = host;
|
|
@@ -24569,7 +24598,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24569
24598
|
}
|
|
24570
24599
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
24571
24600
|
if (host) {
|
|
24572
|
-
|
|
24601
|
+
clearAllEffects(container, host);
|
|
24573
24602
|
}
|
|
24574
24603
|
vnode_insertBefore(
|
|
24575
24604
|
journal,
|
|
@@ -24578,7 +24607,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24578
24607
|
vCurrent && getInsertBefore()
|
|
24579
24608
|
);
|
|
24580
24609
|
const jsxNode2 = jsxValue;
|
|
24581
|
-
|
|
24610
|
+
import_build7.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
24582
24611
|
container.setHostProp(vNewNode, OnRenderProp, componentQRL);
|
|
24583
24612
|
container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
|
|
24584
24613
|
container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -24591,7 +24620,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
24591
24620
|
vCurrent && getInsertBefore()
|
|
24592
24621
|
);
|
|
24593
24622
|
const jsxNode2 = jsxValue;
|
|
24594
|
-
|
|
24623
|
+
import_build7.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
24595
24624
|
vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
|
|
24596
24625
|
if (jsxNode2.key) {
|
|
24597
24626
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -24635,8 +24664,8 @@ function propsDiffer(src, dst) {
|
|
|
24635
24664
|
if (!src || !dst) {
|
|
24636
24665
|
return true;
|
|
24637
24666
|
}
|
|
24638
|
-
let srcKeys = removePropsKeys(Object.keys(src), ["children",
|
|
24639
|
-
let dstKeys = removePropsKeys(Object.keys(dst), ["children",
|
|
24667
|
+
let srcKeys = removePropsKeys(Object.keys(src), ["children", QBackRefs]);
|
|
24668
|
+
let dstKeys = removePropsKeys(Object.keys(dst), ["children", QBackRefs]);
|
|
24640
24669
|
if (srcKeys.length !== dstKeys.length) {
|
|
24641
24670
|
return true;
|
|
24642
24671
|
}
|
|
@@ -24664,13 +24693,14 @@ function removePropsKeys(keys, propKeys) {
|
|
|
24664
24693
|
function cleanup(container, vNode) {
|
|
24665
24694
|
let vCursor = vNode;
|
|
24666
24695
|
if (vnode_isTextVNode(vNode)) {
|
|
24696
|
+
markVNodeAsDeleted(vCursor);
|
|
24667
24697
|
return;
|
|
24668
24698
|
}
|
|
24669
24699
|
let vParent = null;
|
|
24670
24700
|
do {
|
|
24671
24701
|
const type = vCursor[0 /* flags */];
|
|
24672
24702
|
if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
|
|
24673
|
-
|
|
24703
|
+
clearAllEffects(container, vCursor);
|
|
24674
24704
|
markVNodeAsDeleted(vCursor);
|
|
24675
24705
|
if (type & 2 /* Virtual */) {
|
|
24676
24706
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
@@ -24679,7 +24709,7 @@ function cleanup(container, vNode) {
|
|
|
24679
24709
|
const obj = seq[i];
|
|
24680
24710
|
if (isTask(obj)) {
|
|
24681
24711
|
const task = obj;
|
|
24682
|
-
|
|
24712
|
+
clearAllEffects(container, task);
|
|
24683
24713
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
24684
24714
|
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
24685
24715
|
} else {
|
|
@@ -24691,10 +24721,10 @@ function cleanup(container, vNode) {
|
|
|
24691
24721
|
}
|
|
24692
24722
|
const isComponent = type & 2 /* Virtual */ && vnode_getProp(vCursor, OnRenderProp, null) !== null;
|
|
24693
24723
|
if (isComponent) {
|
|
24694
|
-
const attrs = vCursor;
|
|
24695
|
-
for (let i =
|
|
24724
|
+
const attrs = vnode_getProps(vCursor);
|
|
24725
|
+
for (let i = 0; i < attrs.length; i = i + 2) {
|
|
24696
24726
|
const key = attrs[i];
|
|
24697
|
-
if (
|
|
24727
|
+
if (isSlotProp(key)) {
|
|
24698
24728
|
const value = attrs[i + 1];
|
|
24699
24729
|
if (value) {
|
|
24700
24730
|
attrs[i + 1] = null;
|
|
@@ -24709,7 +24739,7 @@ function cleanup(container, vNode) {
|
|
|
24709
24739
|
}
|
|
24710
24740
|
}
|
|
24711
24741
|
}
|
|
24712
|
-
const isProjection =
|
|
24742
|
+
const isProjection = vnode_isProjection(vCursor);
|
|
24713
24743
|
if (!isProjection) {
|
|
24714
24744
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
24715
24745
|
if (vFirstChild) {
|
|
@@ -24723,6 +24753,8 @@ function cleanup(container, vNode) {
|
|
|
24723
24753
|
return;
|
|
24724
24754
|
}
|
|
24725
24755
|
}
|
|
24756
|
+
} else if (type & 4 /* Text */) {
|
|
24757
|
+
markVNodeAsDeleted(vCursor);
|
|
24726
24758
|
}
|
|
24727
24759
|
if (vCursor === vNode) {
|
|
24728
24760
|
return;
|
|
@@ -24764,57 +24796,197 @@ function markVNodeAsDeleted(vCursor) {
|
|
|
24764
24796
|
var HANDLER_PREFIX = ":";
|
|
24765
24797
|
var count = 0;
|
|
24766
24798
|
|
|
24767
|
-
// packages/qwik/src/core/
|
|
24768
|
-
var
|
|
24769
|
-
|
|
24770
|
-
|
|
24799
|
+
// packages/qwik/src/core/use/use-resource.ts
|
|
24800
|
+
var _createResourceReturn = (opts) => {
|
|
24801
|
+
const resource = {
|
|
24802
|
+
__brand: "resource",
|
|
24803
|
+
value: void 0,
|
|
24804
|
+
loading: isServerPlatform() ? false : true,
|
|
24805
|
+
_resolved: void 0,
|
|
24806
|
+
_error: void 0,
|
|
24807
|
+
_state: "pending",
|
|
24808
|
+
_timeout: (opts == null ? void 0 : opts.timeout) ?? -1,
|
|
24809
|
+
_cache: 0
|
|
24771
24810
|
};
|
|
24811
|
+
return resource;
|
|
24772
24812
|
};
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
}
|
|
24805
|
-
|
|
24806
|
-
|
|
24807
|
-
|
|
24808
|
-
|
|
24809
|
-
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
|
|
24816
|
-
}
|
|
24817
|
-
|
|
24813
|
+
var createResourceReturn = (container, opts, initialPromise) => {
|
|
24814
|
+
const result = _createResourceReturn(opts);
|
|
24815
|
+
result.value = initialPromise;
|
|
24816
|
+
return createStore(container, result, 1 /* RECURSIVE */);
|
|
24817
|
+
};
|
|
24818
|
+
var runResource = (task, container, host) => {
|
|
24819
|
+
task.$flags$ &= ~8 /* DIRTY */;
|
|
24820
|
+
cleanupTask(task);
|
|
24821
|
+
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
24822
|
+
iCtx.$container$ = container;
|
|
24823
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
|
|
24824
|
+
const resource = task.$state$;
|
|
24825
|
+
assertDefined(
|
|
24826
|
+
resource,
|
|
24827
|
+
'useResource: when running a resource, "task.resource" must be a defined.',
|
|
24828
|
+
task
|
|
24829
|
+
);
|
|
24830
|
+
const track = (obj, prop) => {
|
|
24831
|
+
const ctx = newInvokeContext();
|
|
24832
|
+
ctx.$effectSubscriber$ = getSubscriber(task, ":" /* COMPONENT */);
|
|
24833
|
+
ctx.$container$ = container;
|
|
24834
|
+
return invoke(ctx, () => {
|
|
24835
|
+
if (isFunction(obj)) {
|
|
24836
|
+
return obj();
|
|
24837
|
+
}
|
|
24838
|
+
if (prop) {
|
|
24839
|
+
return obj[prop];
|
|
24840
|
+
} else if (isSignal(obj)) {
|
|
24841
|
+
return obj.value;
|
|
24842
|
+
} else {
|
|
24843
|
+
return obj;
|
|
24844
|
+
}
|
|
24845
|
+
});
|
|
24846
|
+
};
|
|
24847
|
+
const handleError = (reason) => container.handleError(reason, host);
|
|
24848
|
+
const cleanups = [];
|
|
24849
|
+
task.$destroy$ = noSerialize(() => {
|
|
24850
|
+
cleanups.forEach((fn) => {
|
|
24851
|
+
try {
|
|
24852
|
+
fn();
|
|
24853
|
+
} catch (err) {
|
|
24854
|
+
handleError(err);
|
|
24855
|
+
}
|
|
24856
|
+
});
|
|
24857
|
+
done = true;
|
|
24858
|
+
});
|
|
24859
|
+
const resourceTarget = unwrapStore(resource);
|
|
24860
|
+
const opts = {
|
|
24861
|
+
track,
|
|
24862
|
+
cleanup(fn) {
|
|
24863
|
+
if (typeof fn === "function") {
|
|
24864
|
+
cleanups.push(fn);
|
|
24865
|
+
}
|
|
24866
|
+
},
|
|
24867
|
+
cache(policy) {
|
|
24868
|
+
let milliseconds = 0;
|
|
24869
|
+
if (policy === "immutable") {
|
|
24870
|
+
milliseconds = Infinity;
|
|
24871
|
+
} else {
|
|
24872
|
+
milliseconds = policy;
|
|
24873
|
+
}
|
|
24874
|
+
resource._cache = milliseconds;
|
|
24875
|
+
},
|
|
24876
|
+
previous: resourceTarget._resolved
|
|
24877
|
+
};
|
|
24878
|
+
let resolve;
|
|
24879
|
+
let reject;
|
|
24880
|
+
let done = false;
|
|
24881
|
+
const setState = (resolved, value) => {
|
|
24882
|
+
if (!done) {
|
|
24883
|
+
done = true;
|
|
24884
|
+
if (resolved) {
|
|
24885
|
+
done = true;
|
|
24886
|
+
resource.loading = false;
|
|
24887
|
+
resource._state = "resolved";
|
|
24888
|
+
resource._resolved = value;
|
|
24889
|
+
resource._error = void 0;
|
|
24890
|
+
resolve(value);
|
|
24891
|
+
} else {
|
|
24892
|
+
done = true;
|
|
24893
|
+
resource.loading = false;
|
|
24894
|
+
resource._state = "rejected";
|
|
24895
|
+
resource._error = value;
|
|
24896
|
+
reject(value);
|
|
24897
|
+
}
|
|
24898
|
+
return true;
|
|
24899
|
+
}
|
|
24900
|
+
return false;
|
|
24901
|
+
};
|
|
24902
|
+
cleanups.push(() => {
|
|
24903
|
+
if (untrack(() => resource.loading) === true) {
|
|
24904
|
+
const value = untrack(() => resource._resolved);
|
|
24905
|
+
setState(true, value);
|
|
24906
|
+
}
|
|
24907
|
+
});
|
|
24908
|
+
invoke(iCtx, () => {
|
|
24909
|
+
resource._state = "pending";
|
|
24910
|
+
resource.loading = !isServerPlatform();
|
|
24911
|
+
const promise2 = resource.value = new Promise((r, re) => {
|
|
24912
|
+
resolve = r;
|
|
24913
|
+
reject = re;
|
|
24914
|
+
});
|
|
24915
|
+
promise2.catch(ignoreErrorToPreventNodeFromCrashing);
|
|
24916
|
+
});
|
|
24917
|
+
const promise = safeCall(
|
|
24918
|
+
() => Promise.resolve(taskFn(opts)),
|
|
24919
|
+
(value) => {
|
|
24920
|
+
setState(true, value);
|
|
24921
|
+
},
|
|
24922
|
+
(err) => {
|
|
24923
|
+
if (isPromise(err)) {
|
|
24924
|
+
return err.then(() => runResource(task, container, host));
|
|
24925
|
+
} else {
|
|
24926
|
+
setState(false, err);
|
|
24927
|
+
}
|
|
24928
|
+
}
|
|
24929
|
+
);
|
|
24930
|
+
const timeout = resourceTarget._timeout;
|
|
24931
|
+
if (timeout > 0) {
|
|
24932
|
+
return Promise.race([
|
|
24933
|
+
promise,
|
|
24934
|
+
delay(timeout).then(() => {
|
|
24935
|
+
if (setState(false, new Error("timeout"))) {
|
|
24936
|
+
cleanupTask(task);
|
|
24937
|
+
}
|
|
24938
|
+
})
|
|
24939
|
+
]);
|
|
24940
|
+
}
|
|
24941
|
+
return promise;
|
|
24942
|
+
};
|
|
24943
|
+
var ignoreErrorToPreventNodeFromCrashing = (err) => {
|
|
24944
|
+
};
|
|
24945
|
+
|
|
24946
|
+
// packages/qwik/src/core/shared/scheduler-document-position.ts
|
|
24947
|
+
var aVNodePath = [];
|
|
24948
|
+
var bVNodePath = [];
|
|
24949
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
24950
|
+
if (a === b) {
|
|
24951
|
+
return 0;
|
|
24952
|
+
}
|
|
24953
|
+
let aDepth = -1;
|
|
24954
|
+
let bDepth = -1;
|
|
24955
|
+
while (a) {
|
|
24956
|
+
const vNode = aVNodePath[++aDepth] = a;
|
|
24957
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
24958
|
+
}
|
|
24959
|
+
while (b) {
|
|
24960
|
+
const vNode = bVNodePath[++bDepth] = b;
|
|
24961
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
24962
|
+
}
|
|
24963
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
24964
|
+
a = aVNodePath[aDepth];
|
|
24965
|
+
b = bVNodePath[bDepth];
|
|
24966
|
+
if (a === b) {
|
|
24967
|
+
aDepth--;
|
|
24968
|
+
bDepth--;
|
|
24969
|
+
} else {
|
|
24970
|
+
let cursor = b;
|
|
24971
|
+
do {
|
|
24972
|
+
cursor = vnode_getNextSibling(cursor);
|
|
24973
|
+
if (cursor === a) {
|
|
24974
|
+
return 1;
|
|
24975
|
+
}
|
|
24976
|
+
} while (cursor);
|
|
24977
|
+
cursor = b;
|
|
24978
|
+
do {
|
|
24979
|
+
cursor = vnode_getPreviousSibling(cursor);
|
|
24980
|
+
if (cursor === a) {
|
|
24981
|
+
return -1;
|
|
24982
|
+
}
|
|
24983
|
+
} while (cursor);
|
|
24984
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
24985
|
+
return -1;
|
|
24986
|
+
}
|
|
24987
|
+
return 1;
|
|
24988
|
+
}
|
|
24989
|
+
}
|
|
24818
24990
|
return aDepth < bDepth ? -1 : 1;
|
|
24819
24991
|
};
|
|
24820
24992
|
var aSsrNodePath = [];
|
|
@@ -24848,14 +25020,31 @@ var ssrNodeDocumentPosition = (a, b) => {
|
|
|
24848
25020
|
|
|
24849
25021
|
// packages/qwik/src/core/shared/scheduler.ts
|
|
24850
25022
|
var DEBUG2 = false;
|
|
25023
|
+
var getPromise = (chore) => chore.$promise$ ||= new Promise((resolve) => {
|
|
25024
|
+
chore.$resolve$ = resolve;
|
|
25025
|
+
});
|
|
24851
25026
|
var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
24852
25027
|
const choreQueue = [];
|
|
25028
|
+
const qrlRuns = [];
|
|
24853
25029
|
let currentChore = null;
|
|
24854
|
-
let
|
|
25030
|
+
let drainScheduled = false;
|
|
24855
25031
|
return schedule;
|
|
24856
25032
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
24857
|
-
|
|
24858
|
-
const
|
|
25033
|
+
var _a, _b;
|
|
25034
|
+
const isServer4 = !isDomContainer(container);
|
|
25035
|
+
const isComponentSsr = isServer4 && type === 6 /* COMPONENT */;
|
|
25036
|
+
const runLater = type !== 255 /* WAIT_FOR_ALL */ && !isComponentSsr && type !== 2 /* RUN_QRL */;
|
|
25037
|
+
const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 48 /* CLEANUP_VISIBLE */;
|
|
25038
|
+
const isClientOnly = type === 16 /* JOURNAL_FLUSH */ || type === 4 /* NODE_DIFF */ || type === 5 /* NODE_PROP */;
|
|
25039
|
+
if (isServer4 && isClientOnly) {
|
|
25040
|
+
DEBUG2 && debugTrace(
|
|
25041
|
+
`skip client chore ${debugChoreTypeToString(type)}`,
|
|
25042
|
+
null,
|
|
25043
|
+
currentChore,
|
|
25044
|
+
choreQueue
|
|
25045
|
+
);
|
|
25046
|
+
return;
|
|
25047
|
+
}
|
|
24859
25048
|
if (isTask2) {
|
|
24860
25049
|
hostOrTask.$flags$ |= 8 /* DIRTY */;
|
|
24861
25050
|
}
|
|
@@ -24870,181 +25059,228 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
24870
25059
|
$returnValue$: null,
|
|
24871
25060
|
$executed$: false
|
|
24872
25061
|
};
|
|
24873
|
-
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
24874
|
-
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
24875
25062
|
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
24876
|
-
|
|
24877
|
-
|
|
25063
|
+
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
25064
|
+
if (!drainScheduled && runLater) {
|
|
25065
|
+
drainScheduled = true;
|
|
24878
25066
|
schedule(16 /* JOURNAL_FLUSH */);
|
|
24879
|
-
scheduleDrain()
|
|
25067
|
+
(_b = (_a = scheduleDrain()) == null ? void 0 : _a.catch) == null ? void 0 : _b.call(_a, () => {
|
|
25068
|
+
});
|
|
24880
25069
|
}
|
|
24881
25070
|
if (runLater) {
|
|
24882
|
-
return chore
|
|
25071
|
+
return getPromise(chore);
|
|
24883
25072
|
} else {
|
|
24884
|
-
return drainUpTo(chore,
|
|
25073
|
+
return drainUpTo(chore, isServer4);
|
|
24885
25074
|
}
|
|
24886
25075
|
}
|
|
24887
|
-
function drainUpTo(runUptoChore,
|
|
24888
|
-
|
|
24889
|
-
return runUptoChore.$returnValue$;
|
|
24890
|
-
}
|
|
24891
|
-
if (currentChore) {
|
|
24892
|
-
return runUptoChore.$promise$;
|
|
24893
|
-
}
|
|
25076
|
+
function drainUpTo(runUptoChore, isServer4) {
|
|
25077
|
+
let maxRetries = 5e3;
|
|
24894
25078
|
while (choreQueue.length) {
|
|
24895
|
-
|
|
24896
|
-
|
|
24897
|
-
if (order === null) {
|
|
24898
|
-
continue;
|
|
25079
|
+
if (maxRetries-- < 0) {
|
|
25080
|
+
throw new Error("drainUpTo: max retries reached");
|
|
24899
25081
|
}
|
|
24900
|
-
if (
|
|
24901
|
-
|
|
25082
|
+
if (currentChore) {
|
|
25083
|
+
return getPromise(currentChore).then(() => drainUpTo(runUptoChore, isServer4)).catch((e) => {
|
|
25084
|
+
container.handleError(e, currentChore == null ? void 0 : currentChore.$host$);
|
|
25085
|
+
});
|
|
25086
|
+
}
|
|
25087
|
+
const nextChore = choreQueue[0];
|
|
25088
|
+
if (nextChore.$executed$) {
|
|
25089
|
+
choreQueue.shift();
|
|
25090
|
+
if (nextChore === runUptoChore) {
|
|
25091
|
+
break;
|
|
25092
|
+
}
|
|
25093
|
+
continue;
|
|
24902
25094
|
}
|
|
24903
|
-
|
|
24904
|
-
if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
|
|
25095
|
+
if (vNodeAlreadyDeleted(nextChore) && // we need to process cleanup tasks for deleted nodes
|
|
24905
25096
|
nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
|
|
24906
25097
|
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
25098
|
+
choreQueue.shift();
|
|
24907
25099
|
continue;
|
|
24908
25100
|
}
|
|
24909
|
-
|
|
24910
|
-
if (isPromise(returnValue)) {
|
|
24911
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
24912
|
-
return promise;
|
|
24913
|
-
}
|
|
25101
|
+
executeChore(nextChore, isServer4);
|
|
24914
25102
|
}
|
|
24915
25103
|
return runUptoChore.$returnValue$;
|
|
24916
25104
|
}
|
|
24917
|
-
function executeChore(chore) {
|
|
24918
|
-
var _a;
|
|
25105
|
+
function executeChore(chore, isServer4) {
|
|
25106
|
+
var _a, _b, _c;
|
|
24919
25107
|
const host = chore.$host$;
|
|
24920
25108
|
DEBUG2 && debugTrace("execute", chore, currentChore, choreQueue);
|
|
24921
25109
|
assertEqual(currentChore, null, "Chore already running.");
|
|
24922
25110
|
currentChore = chore;
|
|
24923
25111
|
let returnValue = null;
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
|
|
24934
|
-
|
|
24935
|
-
|
|
24936
|
-
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
)
|
|
25112
|
+
try {
|
|
25113
|
+
switch (chore.$type$) {
|
|
25114
|
+
case 255 /* WAIT_FOR_ALL */:
|
|
25115
|
+
{
|
|
25116
|
+
if (isServer4) {
|
|
25117
|
+
drainScheduled = false;
|
|
25118
|
+
}
|
|
25119
|
+
}
|
|
25120
|
+
break;
|
|
25121
|
+
case 16 /* JOURNAL_FLUSH */:
|
|
25122
|
+
{
|
|
25123
|
+
returnValue = journalFlush();
|
|
25124
|
+
drainScheduled = false;
|
|
25125
|
+
}
|
|
25126
|
+
break;
|
|
25127
|
+
case 6 /* COMPONENT */:
|
|
25128
|
+
{
|
|
25129
|
+
returnValue = safeCall(
|
|
25130
|
+
() => executeComponent(
|
|
25131
|
+
container,
|
|
25132
|
+
host,
|
|
25133
|
+
host,
|
|
25134
|
+
chore.$target$,
|
|
25135
|
+
chore.$payload$
|
|
25136
|
+
),
|
|
25137
|
+
(jsx4) => {
|
|
25138
|
+
if (isServer4) {
|
|
25139
|
+
return jsx4;
|
|
25140
|
+
} else {
|
|
25141
|
+
const styleScopedId = container.getHostProp(host, QScopedStyle);
|
|
25142
|
+
return retryOnPromise(
|
|
25143
|
+
() => vnode_diff(
|
|
25144
|
+
container,
|
|
25145
|
+
jsx4,
|
|
25146
|
+
host,
|
|
25147
|
+
addComponentStylePrefix(styleScopedId)
|
|
25148
|
+
)
|
|
25149
|
+
);
|
|
25150
|
+
}
|
|
25151
|
+
},
|
|
25152
|
+
(err) => container.handleError(err, host)
|
|
25153
|
+
);
|
|
25154
|
+
}
|
|
25155
|
+
break;
|
|
25156
|
+
case 2 /* RUN_QRL */:
|
|
25157
|
+
{
|
|
25158
|
+
const fn = chore.$target$.getFn();
|
|
25159
|
+
const result = retryOnPromise(() => fn(...chore.$payload$));
|
|
25160
|
+
if (isPromise(result)) {
|
|
25161
|
+
const handled = result.finally(() => {
|
|
25162
|
+
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
25163
|
+
}).catch((error) => {
|
|
25164
|
+
container.handleError(error, chore.$host$);
|
|
25165
|
+
});
|
|
25166
|
+
qrlRuns.push(handled);
|
|
25167
|
+
DEBUG2 && debugTrace("execute.DONE (but still running)", chore, currentChore, choreQueue);
|
|
25168
|
+
chore.$returnValue$ = handled;
|
|
25169
|
+
(_a = chore.$resolve$) == null ? void 0 : _a.call(chore, handled);
|
|
25170
|
+
currentChore = null;
|
|
25171
|
+
chore.$executed$ = true;
|
|
25172
|
+
return;
|
|
25173
|
+
}
|
|
25174
|
+
returnValue = null;
|
|
25175
|
+
}
|
|
25176
|
+
break;
|
|
25177
|
+
case 3 /* TASK */:
|
|
25178
|
+
case 32 /* VISIBLE */:
|
|
25179
|
+
{
|
|
25180
|
+
const payload = chore.$payload$;
|
|
25181
|
+
if (payload.$flags$ & 4 /* RESOURCE */) {
|
|
25182
|
+
const result = runResource(payload, container, host);
|
|
25183
|
+
returnValue = isServer4 ? result : null;
|
|
24950
25184
|
} else {
|
|
24951
|
-
|
|
25185
|
+
returnValue = runTask(payload, container, host);
|
|
24952
25186
|
}
|
|
24953
|
-
}
|
|
24954
|
-
|
|
24955
|
-
|
|
24956
|
-
|
|
24957
|
-
|
|
24958
|
-
|
|
24959
|
-
|
|
24960
|
-
|
|
24961
|
-
|
|
24962
|
-
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
24973
|
-
|
|
24974
|
-
|
|
24975
|
-
|
|
24976
|
-
|
|
24977
|
-
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
|
|
24986
|
-
|
|
24987
|
-
|
|
24988
|
-
|
|
24989
|
-
|
|
24990
|
-
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
|
|
25001
|
-
|
|
25002
|
-
break;
|
|
25003
|
-
}
|
|
25004
|
-
case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
|
|
25005
|
-
const target = chore.$target$;
|
|
25006
|
-
const forceRunEffects = target.$forceRunEffects$;
|
|
25007
|
-
target.$forceRunEffects$ = false;
|
|
25008
|
-
if (!((_a = target.$effects$) == null ? void 0 : _a.length)) {
|
|
25187
|
+
}
|
|
25188
|
+
break;
|
|
25189
|
+
case 48 /* CLEANUP_VISIBLE */:
|
|
25190
|
+
{
|
|
25191
|
+
const task = chore.$payload$;
|
|
25192
|
+
cleanupTask(task);
|
|
25193
|
+
}
|
|
25194
|
+
break;
|
|
25195
|
+
case 4 /* NODE_DIFF */:
|
|
25196
|
+
{
|
|
25197
|
+
const parentVirtualNode = chore.$target$;
|
|
25198
|
+
let jsx4 = chore.$payload$;
|
|
25199
|
+
if (isSignal(jsx4)) {
|
|
25200
|
+
jsx4 = jsx4.value;
|
|
25201
|
+
}
|
|
25202
|
+
returnValue = retryOnPromise(
|
|
25203
|
+
() => vnode_diff(container, jsx4, parentVirtualNode, null)
|
|
25204
|
+
);
|
|
25205
|
+
}
|
|
25206
|
+
break;
|
|
25207
|
+
case 5 /* NODE_PROP */:
|
|
25208
|
+
{
|
|
25209
|
+
const virtualNode = chore.$host$;
|
|
25210
|
+
const payload = chore.$payload$;
|
|
25211
|
+
let value = payload.$value$;
|
|
25212
|
+
if (isSignal(value)) {
|
|
25213
|
+
value = value.value;
|
|
25214
|
+
}
|
|
25215
|
+
const isConst = payload.$isConst$;
|
|
25216
|
+
const journal = container.$journal$;
|
|
25217
|
+
const property = chore.$idx$;
|
|
25218
|
+
const serializedValue = serializeAttribute(
|
|
25219
|
+
property,
|
|
25220
|
+
value,
|
|
25221
|
+
payload.$scopedStyleIdPrefix$
|
|
25222
|
+
);
|
|
25223
|
+
if (isConst) {
|
|
25224
|
+
const element = virtualNode[6 /* element */];
|
|
25225
|
+
journal.push(2 /* SetAttribute */, element, property, serializedValue);
|
|
25226
|
+
} else {
|
|
25227
|
+
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
25228
|
+
}
|
|
25229
|
+
}
|
|
25230
|
+
break;
|
|
25231
|
+
case 1 /* QRL_RESOLVE */: {
|
|
25232
|
+
{
|
|
25233
|
+
const target = chore.$target$;
|
|
25234
|
+
returnValue = !target.resolved ? target.resolve() : null;
|
|
25235
|
+
}
|
|
25009
25236
|
break;
|
|
25010
25237
|
}
|
|
25011
|
-
|
|
25012
|
-
|
|
25013
|
-
|
|
25238
|
+
case 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
|
|
25239
|
+
{
|
|
25240
|
+
const target = chore.$target$;
|
|
25241
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
25242
|
+
target.$forceRunEffects$ = false;
|
|
25243
|
+
if (!((_b = target.$effects$) == null ? void 0 : _b.size)) {
|
|
25244
|
+
break;
|
|
25245
|
+
}
|
|
25246
|
+
returnValue = retryOnPromise(() => {
|
|
25247
|
+
if (target.$computeIfNeeded$() || forceRunEffects) {
|
|
25248
|
+
triggerEffects(container, target, target.$effects$);
|
|
25249
|
+
}
|
|
25250
|
+
});
|
|
25014
25251
|
}
|
|
25015
|
-
|
|
25016
|
-
|
|
25252
|
+
break;
|
|
25253
|
+
}
|
|
25017
25254
|
}
|
|
25255
|
+
} catch (e) {
|
|
25256
|
+
returnValue = Promise.reject(e);
|
|
25018
25257
|
}
|
|
25019
|
-
|
|
25258
|
+
const after = (value, error) => {
|
|
25020
25259
|
var _a2;
|
|
25021
|
-
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
25022
|
-
if (currentChore) {
|
|
25023
|
-
currentChore.$executed$ = true;
|
|
25024
|
-
(_a2 = currentChore.$resolve$) == null ? void 0 : _a2.call(currentChore, value);
|
|
25025
|
-
}
|
|
25026
25260
|
currentChore = null;
|
|
25027
|
-
|
|
25028
|
-
|
|
25029
|
-
|
|
25030
|
-
|
|
25031
|
-
|
|
25032
|
-
|
|
25033
|
-
|
|
25034
|
-
|
|
25035
|
-
|
|
25036
|
-
|
|
25037
|
-
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
}
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
if (macroTypeDiff !== 0) {
|
|
25045
|
-
return macroTypeDiff;
|
|
25261
|
+
chore.$executed$ = true;
|
|
25262
|
+
if (error) {
|
|
25263
|
+
DEBUG2 && debugTrace("execute.ERROR", chore, currentChore, choreQueue);
|
|
25264
|
+
container.handleError(error, host);
|
|
25265
|
+
} else {
|
|
25266
|
+
chore.$returnValue$ = value;
|
|
25267
|
+
DEBUG2 && debugTrace("execute.DONE", chore, currentChore, choreQueue);
|
|
25268
|
+
(_a2 = chore.$resolve$) == null ? void 0 : _a2.call(chore, value);
|
|
25269
|
+
}
|
|
25270
|
+
};
|
|
25271
|
+
if (isPromise(returnValue)) {
|
|
25272
|
+
chore.$promise$ = returnValue.then(after, (error) => after(void 0, error));
|
|
25273
|
+
(_c = chore.$resolve$) == null ? void 0 : _c.call(chore, chore.$promise$);
|
|
25274
|
+
chore.$resolve$ = void 0;
|
|
25275
|
+
} else {
|
|
25276
|
+
after(returnValue);
|
|
25277
|
+
}
|
|
25046
25278
|
}
|
|
25047
|
-
|
|
25279
|
+
function choreComparator(a, b, rootVNode) {
|
|
25280
|
+
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
25281
|
+
if (macroTypeDiff !== 0) {
|
|
25282
|
+
return macroTypeDiff;
|
|
25283
|
+
}
|
|
25048
25284
|
const aHost = a.$host$;
|
|
25049
25285
|
const bHost = b.$host$;
|
|
25050
25286
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
@@ -25054,6 +25290,8 @@ function choreComparator(a, b, rootVNode) {
|
|
|
25054
25290
|
return hostDiff;
|
|
25055
25291
|
}
|
|
25056
25292
|
} else {
|
|
25293
|
+
assertFalse(vnode_isVNode(aHost), "expected aHost to be SSRNode but it is a VNode");
|
|
25294
|
+
assertFalse(vnode_isVNode(bHost), "expected bHost to be SSRNode but it is a VNode");
|
|
25057
25295
|
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
|
|
25058
25296
|
You are attempting to change a state that has already been streamed to the client.
|
|
25059
25297
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
@@ -25073,166 +25311,90 @@ function choreComparator(a, b, rootVNode) {
|
|
|
25073
25311
|
if (idxDiff !== 0) {
|
|
25074
25312
|
return idxDiff;
|
|
25075
25313
|
}
|
|
25076
|
-
if (a.$target$ !== b.$target$
|
|
25314
|
+
if (a.$target$ !== b.$target$ || a.$payload$ !== b.$payload$) {
|
|
25077
25315
|
return 1;
|
|
25078
25316
|
}
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
}
|
|
25082
|
-
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
25083
|
-
let bottom = 0;
|
|
25084
|
-
let top = sortedArray.length;
|
|
25085
|
-
while (bottom < top) {
|
|
25086
|
-
const middle = bottom + (top - bottom >> 1);
|
|
25087
|
-
const midChore = sortedArray[middle];
|
|
25088
|
-
const comp = choreComparator(value, midChore, rootVNode);
|
|
25089
|
-
if (comp < 0) {
|
|
25090
|
-
top = middle;
|
|
25091
|
-
} else if (comp > 0) {
|
|
25092
|
-
bottom = middle + 1;
|
|
25093
|
-
} else {
|
|
25094
|
-
return middle;
|
|
25095
|
-
}
|
|
25096
|
-
}
|
|
25097
|
-
return ~bottom;
|
|
25098
|
-
}
|
|
25099
|
-
function sortedInsert(sortedArray, value, rootVNode) {
|
|
25100
|
-
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
25101
|
-
if (idx < 0) {
|
|
25102
|
-
sortedArray.splice(~idx, 0, value);
|
|
25103
|
-
return value;
|
|
25104
|
-
}
|
|
25105
|
-
const existing = sortedArray[idx];
|
|
25106
|
-
choreUpdate(existing, value);
|
|
25107
|
-
return existing;
|
|
25108
|
-
}
|
|
25109
|
-
function debugChoreToString(chore) {
|
|
25110
|
-
var _a;
|
|
25111
|
-
const type = {
|
|
25112
|
-
[1 /* QRL_RESOLVE */]: "QRL_RESOLVE",
|
|
25113
|
-
[2 /* RESOURCE */]: "RESOURCE",
|
|
25114
|
-
[3 /* TASK */]: "TASK",
|
|
25115
|
-
[4 /* NODE_DIFF */]: "NODE_DIFF",
|
|
25116
|
-
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
25117
|
-
[7 /* COMPONENT */]: "COMPONENT",
|
|
25118
|
-
[6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
|
|
25119
|
-
[8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
|
|
25120
|
-
[16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
|
|
25121
|
-
[32 /* VISIBLE */]: "VISIBLE",
|
|
25122
|
-
[48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
|
|
25123
|
-
[255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
|
|
25124
|
-
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
25125
|
-
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
25126
|
-
const qrlTarget = (_a = chore.$target$) == null ? void 0 : _a.$symbol$;
|
|
25127
|
-
return `Chore(${type} ${chore.$type$ === 1 /* QRL_RESOLVE */ ? qrlTarget : host} ${chore.$idx$})`;
|
|
25128
|
-
}
|
|
25129
|
-
function debugTrace(action, arg, currentChore, queue) {
|
|
25130
|
-
const lines = ["Scheduler: " + action];
|
|
25131
|
-
if (arg) {
|
|
25132
|
-
lines.push(
|
|
25133
|
-
" arg: " + ("$type$" in arg ? debugChoreToString(arg) : String(arg).replaceAll(/\n.*/gim, ""))
|
|
25134
|
-
);
|
|
25135
|
-
}
|
|
25136
|
-
if (currentChore) {
|
|
25137
|
-
lines.push("running: " + debugChoreToString(currentChore));
|
|
25138
|
-
}
|
|
25139
|
-
if (queue) {
|
|
25140
|
-
queue.forEach((chore, idx) => {
|
|
25141
|
-
lines.push((idx == 0 ? " queue: " : " ") + debugChoreToString(chore));
|
|
25142
|
-
});
|
|
25143
|
-
}
|
|
25144
|
-
console.log(lines.join("\n ") + "\n");
|
|
25145
|
-
}
|
|
25146
|
-
|
|
25147
|
-
// packages/qwik/src/core/use/use-task.ts
|
|
25148
|
-
var runTask = (task, container, host) => {
|
|
25149
|
-
task.$flags$ &= ~8 /* DIRTY */;
|
|
25150
|
-
cleanupTask(task);
|
|
25151
|
-
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
25152
|
-
iCtx.$container$ = container;
|
|
25153
|
-
const taskFn = task.$qrl$.getFn(
|
|
25154
|
-
iCtx,
|
|
25155
|
-
() => clearSubscriberEffectDependencies(container, task)
|
|
25156
|
-
);
|
|
25157
|
-
const track = (obj, prop) => {
|
|
25158
|
-
const ctx = newInvokeContext();
|
|
25159
|
-
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
25160
|
-
ctx.$container$ = container;
|
|
25161
|
-
return invoke(ctx, () => {
|
|
25162
|
-
if (isFunction(obj)) {
|
|
25163
|
-
return obj();
|
|
25164
|
-
}
|
|
25165
|
-
if (prop) {
|
|
25166
|
-
return obj[prop];
|
|
25167
|
-
} else if (isSignal(obj)) {
|
|
25168
|
-
return obj.value;
|
|
25169
|
-
} else {
|
|
25170
|
-
return obj;
|
|
25171
|
-
}
|
|
25172
|
-
});
|
|
25173
|
-
};
|
|
25174
|
-
const handleError = (reason) => container.handleError(reason, host);
|
|
25175
|
-
let cleanupFns = null;
|
|
25176
|
-
const cleanup2 = (fn) => {
|
|
25177
|
-
if (typeof fn == "function") {
|
|
25178
|
-
if (!cleanupFns) {
|
|
25179
|
-
cleanupFns = [];
|
|
25180
|
-
task.$destroy$ = noSerialize(() => {
|
|
25181
|
-
task.$destroy$ = null;
|
|
25182
|
-
cleanupFns.forEach((fn2) => {
|
|
25183
|
-
try {
|
|
25184
|
-
fn2();
|
|
25185
|
-
} catch (err) {
|
|
25186
|
-
handleError(err);
|
|
25187
|
-
}
|
|
25188
|
-
});
|
|
25189
|
-
});
|
|
25190
|
-
}
|
|
25191
|
-
cleanupFns.push(fn);
|
|
25192
|
-
}
|
|
25193
|
-
};
|
|
25194
|
-
const taskApi = { track, cleanup: cleanup2 };
|
|
25195
|
-
const result = safeCall(
|
|
25196
|
-
() => taskFn(taskApi),
|
|
25197
|
-
cleanup2,
|
|
25198
|
-
(err) => {
|
|
25199
|
-
if (isPromise(err)) {
|
|
25200
|
-
return err.then(() => runTask(task, container, host));
|
|
25201
|
-
} else {
|
|
25202
|
-
return handleError(err);
|
|
25203
|
-
}
|
|
25317
|
+
if (b === currentChore) {
|
|
25318
|
+
return 1;
|
|
25204
25319
|
}
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25320
|
+
return 0;
|
|
25321
|
+
}
|
|
25322
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
25323
|
+
let bottom = 0;
|
|
25324
|
+
let top = sortedArray.length;
|
|
25325
|
+
while (bottom < top) {
|
|
25326
|
+
const middle = bottom + (top - bottom >> 1);
|
|
25327
|
+
const midChore = sortedArray[middle];
|
|
25328
|
+
const comp = choreComparator(value, midChore, rootVNode);
|
|
25329
|
+
if (comp < 0) {
|
|
25330
|
+
top = middle;
|
|
25331
|
+
} else if (comp > 0) {
|
|
25332
|
+
bottom = middle + 1;
|
|
25333
|
+
} else {
|
|
25334
|
+
return middle;
|
|
25335
|
+
}
|
|
25216
25336
|
}
|
|
25337
|
+
return ~bottom;
|
|
25217
25338
|
}
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25339
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
25340
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
25341
|
+
if (idx < 0) {
|
|
25342
|
+
sortedArray.splice(~idx, 0, value);
|
|
25343
|
+
return value;
|
|
25344
|
+
}
|
|
25345
|
+
const existing = sortedArray[idx];
|
|
25346
|
+
if (existing.$type$ === 4 /* NODE_DIFF */) {
|
|
25347
|
+
existing.$payload$ = value.$payload$;
|
|
25348
|
+
}
|
|
25349
|
+
if (existing.$executed$) {
|
|
25350
|
+
existing.$executed$ = false;
|
|
25351
|
+
}
|
|
25352
|
+
return existing;
|
|
25228
25353
|
}
|
|
25229
25354
|
};
|
|
25230
|
-
var
|
|
25231
|
-
return value
|
|
25355
|
+
var toNumber = (value) => {
|
|
25356
|
+
return typeof value === "number" ? value : -1;
|
|
25232
25357
|
};
|
|
25233
|
-
|
|
25234
|
-
|
|
25235
|
-
|
|
25358
|
+
function vNodeAlreadyDeleted(chore) {
|
|
25359
|
+
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
25360
|
+
}
|
|
25361
|
+
function debugChoreTypeToString(type) {
|
|
25362
|
+
return {
|
|
25363
|
+
[1 /* QRL_RESOLVE */]: "QRL_RESOLVE",
|
|
25364
|
+
[2 /* RUN_QRL */]: "RUN_QRL",
|
|
25365
|
+
[3 /* TASK */]: "TASK",
|
|
25366
|
+
[4 /* NODE_DIFF */]: "NODE_DIFF",
|
|
25367
|
+
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
25368
|
+
[6 /* COMPONENT */]: "COMPONENT",
|
|
25369
|
+
[7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
|
|
25370
|
+
[16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
|
|
25371
|
+
[32 /* VISIBLE */]: "VISIBLE",
|
|
25372
|
+
[48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
|
|
25373
|
+
[255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
|
|
25374
|
+
}[type] || "UNKNOWN: " + type;
|
|
25375
|
+
}
|
|
25376
|
+
function debugChoreToString(chore) {
|
|
25377
|
+
var _a;
|
|
25378
|
+
const type = debugChoreTypeToString(chore.$type$);
|
|
25379
|
+
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
25380
|
+
const qrlTarget = (_a = chore.$target$) == null ? void 0 : _a.$symbol$;
|
|
25381
|
+
return `Chore(${type} ${chore.$type$ === 1 /* QRL_RESOLVE */ || chore.$type$ === 2 /* RUN_QRL */ ? qrlTarget : host} ${chore.$idx$})`;
|
|
25382
|
+
}
|
|
25383
|
+
function debugTrace(action, arg, currentChore, queue) {
|
|
25384
|
+
const lines = ["===========================\nScheduler: " + action];
|
|
25385
|
+
if (arg && !("$type$" in arg)) {
|
|
25386
|
+
lines.push(" arg: " + String(arg).replaceAll(/\n.*/gim, ""));
|
|
25387
|
+
}
|
|
25388
|
+
if (queue) {
|
|
25389
|
+
queue.forEach((chore) => {
|
|
25390
|
+
const active = chore === arg ? ">>>" : " ";
|
|
25391
|
+
lines.push(
|
|
25392
|
+
` ${active} > ` + (chore === currentChore ? "[running] " : "") + debugChoreToString(chore)
|
|
25393
|
+
);
|
|
25394
|
+
});
|
|
25395
|
+
}
|
|
25396
|
+
console.log(lines.join("\n") + "\n");
|
|
25397
|
+
}
|
|
25236
25398
|
|
|
25237
25399
|
// packages/qwik/src/core/signal/signal.ts
|
|
25238
25400
|
var DEBUG3 = false;
|
|
@@ -25246,7 +25408,7 @@ var throwIfQRLNotResolved = (qrl2) => {
|
|
|
25246
25408
|
var isSignal = (value) => {
|
|
25247
25409
|
return value instanceof Signal;
|
|
25248
25410
|
};
|
|
25249
|
-
var
|
|
25411
|
+
var SubscriptionData = class {
|
|
25250
25412
|
data;
|
|
25251
25413
|
constructor(data) {
|
|
25252
25414
|
this.data = data;
|
|
@@ -25285,16 +25447,10 @@ var Signal = class {
|
|
|
25285
25447
|
}
|
|
25286
25448
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
25287
25449
|
if (effectSubscriber) {
|
|
25288
|
-
const effects = this.$effects$ ||=
|
|
25289
|
-
|
|
25290
|
-
|
|
25291
|
-
|
|
25292
|
-
ensureEffectContainsSubscriber(
|
|
25293
|
-
effectSubscriber[0 /* EFFECT */],
|
|
25294
|
-
this,
|
|
25295
|
-
this.$container$
|
|
25296
|
-
);
|
|
25297
|
-
}
|
|
25450
|
+
const effects = this.$effects$ ||= /* @__PURE__ */ new Set();
|
|
25451
|
+
ensureContainsSubscription(effects, effectSubscriber);
|
|
25452
|
+
ensureContainsBackRef(effectSubscriber, this);
|
|
25453
|
+
addQrlToSerializationCtx(effectSubscriber, this.$container$);
|
|
25298
25454
|
DEBUG3 && log2("read->sub", pad("\n" + this.toString(), " "));
|
|
25299
25455
|
}
|
|
25300
25456
|
}
|
|
@@ -25314,115 +25470,85 @@ var Signal = class {
|
|
|
25314
25470
|
}
|
|
25315
25471
|
}
|
|
25316
25472
|
toString() {
|
|
25317
|
-
|
|
25318
|
-
return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (((_a = this.$effects$) == null ? void 0 : _a.map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n")) || "");
|
|
25473
|
+
return `[${this.constructor.name}${this.$flags$ & 1 /* INVALID */ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
|
|
25319
25474
|
}
|
|
25320
25475
|
toJSON() {
|
|
25321
25476
|
return { value: this.$untrackedValue$ };
|
|
25322
25477
|
}
|
|
25323
25478
|
};
|
|
25324
|
-
var
|
|
25325
|
-
|
|
25326
|
-
if (isMissing) {
|
|
25327
|
-
array.push(value);
|
|
25328
|
-
}
|
|
25329
|
-
};
|
|
25330
|
-
var ensureContainsEffect = (array, effectSubscriptions) => {
|
|
25331
|
-
for (let i = 0; i < array.length; i++) {
|
|
25332
|
-
const existingEffect = array[i];
|
|
25333
|
-
if (existingEffect[0] === effectSubscriptions[0] && existingEffect[1] === effectSubscriptions[1]) {
|
|
25334
|
-
return;
|
|
25335
|
-
}
|
|
25336
|
-
}
|
|
25337
|
-
array.push(effectSubscriptions);
|
|
25338
|
-
};
|
|
25339
|
-
var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
25340
|
-
if (isSubscriber(effect)) {
|
|
25341
|
-
effect.$effectDependencies$ ||= [];
|
|
25342
|
-
if (subscriberExistInSubscribers(effect.$effectDependencies$, subscriber)) {
|
|
25343
|
-
return;
|
|
25344
|
-
}
|
|
25345
|
-
effect.$effectDependencies$.push(subscriber);
|
|
25346
|
-
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
25347
|
-
let subscribers = vnode_getProp(
|
|
25348
|
-
effect,
|
|
25349
|
-
QSubscribers,
|
|
25350
|
-
container ? container.$getObjectById$ : null
|
|
25351
|
-
);
|
|
25352
|
-
subscribers ||= [];
|
|
25353
|
-
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
25354
|
-
return;
|
|
25355
|
-
}
|
|
25356
|
-
subscribers.push(subscriber);
|
|
25357
|
-
vnode_setProp(effect, QSubscribers, subscribers);
|
|
25358
|
-
} else if (isSSRNode(effect)) {
|
|
25359
|
-
let subscribers = effect.getProp(QSubscribers);
|
|
25360
|
-
subscribers ||= [];
|
|
25361
|
-
if (subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
25362
|
-
return;
|
|
25363
|
-
}
|
|
25364
|
-
subscribers.push(subscriber);
|
|
25365
|
-
effect.setProp(QSubscribers, subscribers);
|
|
25366
|
-
}
|
|
25479
|
+
var ensureContainsSubscription = (array, effectSubscription) => {
|
|
25480
|
+
array.add(effectSubscription);
|
|
25367
25481
|
};
|
|
25368
|
-
var
|
|
25369
|
-
|
|
25482
|
+
var ensureContainsBackRef = (array, value) => {
|
|
25483
|
+
array[2 /* BACK_REF */] ||= /* @__PURE__ */ new Set();
|
|
25484
|
+
array[2 /* BACK_REF */].add(value);
|
|
25370
25485
|
};
|
|
25371
|
-
var
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25486
|
+
var addQrlToSerializationCtx = (effectSubscriber, container) => {
|
|
25487
|
+
if (!!container && !isDomContainer(container)) {
|
|
25488
|
+
const effect = effectSubscriber[0 /* CONSUMER */];
|
|
25489
|
+
const property = effectSubscriber[1 /* PROPERTY */];
|
|
25490
|
+
let qrl2 = null;
|
|
25491
|
+
if (isTask(effect)) {
|
|
25492
|
+
qrl2 = effect.$qrl$;
|
|
25493
|
+
} else if (effect instanceof ComputedSignal) {
|
|
25494
|
+
qrl2 = effect.$computeQrl$;
|
|
25495
|
+
} else if (property === ":" /* COMPONENT */) {
|
|
25496
|
+
qrl2 = container.getHostProp(effect, OnRenderProp);
|
|
25497
|
+
}
|
|
25498
|
+
if (qrl2) {
|
|
25499
|
+
container.serializationCtx.$eventQrls$.add(qrl2);
|
|
25375
25500
|
}
|
|
25376
25501
|
}
|
|
25377
|
-
return false;
|
|
25378
25502
|
};
|
|
25379
25503
|
var triggerEffects = (container, signal, effects) => {
|
|
25504
|
+
const isBrowser2 = isDomContainer(container);
|
|
25380
25505
|
if (effects) {
|
|
25381
|
-
const scheduleEffect = (
|
|
25382
|
-
const
|
|
25383
|
-
const property =
|
|
25506
|
+
const scheduleEffect = (effectSubscription) => {
|
|
25507
|
+
const consumer = effectSubscription[0 /* CONSUMER */];
|
|
25508
|
+
const property = effectSubscription[1 /* PROPERTY */];
|
|
25384
25509
|
assertDefined(container, "Container must be defined.");
|
|
25385
|
-
if (isTask(
|
|
25386
|
-
|
|
25387
|
-
DEBUG3 && log2("schedule.
|
|
25510
|
+
if (isTask(consumer)) {
|
|
25511
|
+
consumer.$flags$ |= 8 /* DIRTY */;
|
|
25512
|
+
DEBUG3 && log2("schedule.consumer.task", pad("\n" + String(consumer), " "));
|
|
25388
25513
|
let choreType = 3 /* TASK */;
|
|
25389
|
-
if (
|
|
25514
|
+
if (consumer.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
25390
25515
|
choreType = 32 /* VISIBLE */;
|
|
25391
|
-
} else if (effect.$flags$ & 4 /* RESOURCE */) {
|
|
25392
|
-
choreType = 2 /* RESOURCE */;
|
|
25393
25516
|
}
|
|
25394
|
-
container.$scheduler$(choreType,
|
|
25395
|
-
} else if (
|
|
25396
|
-
if (
|
|
25397
|
-
if (!
|
|
25398
|
-
container.$scheduler$(1 /* QRL_RESOLVE */, null,
|
|
25517
|
+
container.$scheduler$(choreType, consumer);
|
|
25518
|
+
} else if (consumer instanceof Signal) {
|
|
25519
|
+
if (consumer instanceof ComputedSignal) {
|
|
25520
|
+
if (!consumer.$computeQrl$.resolved) {
|
|
25521
|
+
container.$scheduler$(1 /* QRL_RESOLVE */, null, consumer.$computeQrl$);
|
|
25399
25522
|
}
|
|
25400
25523
|
}
|
|
25401
|
-
|
|
25524
|
+
consumer.$invalidate$();
|
|
25402
25525
|
} else if (property === ":" /* COMPONENT */) {
|
|
25403
|
-
const host =
|
|
25526
|
+
const host = consumer;
|
|
25404
25527
|
const qrl2 = container.getHostProp(host, OnRenderProp);
|
|
25405
25528
|
assertDefined(qrl2, "Component must have QRL");
|
|
25406
25529
|
const props = container.getHostProp(host, ELEMENT_PROPS);
|
|
25407
|
-
container.$scheduler$(
|
|
25408
|
-
} else if (
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25530
|
+
container.$scheduler$(6 /* COMPONENT */, host, qrl2, props);
|
|
25531
|
+
} else if (isBrowser2) {
|
|
25532
|
+
if (property === "." /* VNODE */) {
|
|
25533
|
+
const host = consumer;
|
|
25534
|
+
container.$scheduler$(4 /* NODE_DIFF */, host, host, signal);
|
|
25535
|
+
} else {
|
|
25536
|
+
const host = consumer;
|
|
25537
|
+
const effectData = effectSubscription[3 /* DATA */];
|
|
25538
|
+
if (effectData instanceof SubscriptionData) {
|
|
25539
|
+
const data = effectData.data;
|
|
25540
|
+
const payload = {
|
|
25541
|
+
...data,
|
|
25542
|
+
$value$: signal
|
|
25543
|
+
};
|
|
25544
|
+
container.$scheduler$(5 /* NODE_PROP */, host, property, payload);
|
|
25545
|
+
}
|
|
25422
25546
|
}
|
|
25423
25547
|
}
|
|
25424
25548
|
};
|
|
25425
|
-
effects
|
|
25549
|
+
for (const effect of effects) {
|
|
25550
|
+
scheduleEffect(effect);
|
|
25551
|
+
}
|
|
25426
25552
|
}
|
|
25427
25553
|
DEBUG3 && log2("done scheduling");
|
|
25428
25554
|
};
|
|
@@ -25434,26 +25560,26 @@ var ComputedSignal = class extends Signal {
|
|
|
25434
25560
|
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
|
|
25435
25561
|
*/
|
|
25436
25562
|
$computeQrl$;
|
|
25437
|
-
|
|
25438
|
-
// we need the old value to know if effects need running after computation
|
|
25439
|
-
$invalid$ = true;
|
|
25563
|
+
$flags$;
|
|
25440
25564
|
$forceRunEffects$ = false;
|
|
25441
|
-
|
|
25565
|
+
[_EFFECT_BACK_REF] = null;
|
|
25566
|
+
constructor(container, fn, flags = 1 /* INVALID */) {
|
|
25442
25567
|
super(container, NEEDS_COMPUTATION);
|
|
25443
25568
|
this.$computeQrl$ = fn;
|
|
25569
|
+
this.$flags$ = flags;
|
|
25444
25570
|
}
|
|
25445
25571
|
$invalidate$() {
|
|
25446
25572
|
var _a;
|
|
25447
|
-
this.$
|
|
25573
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25448
25574
|
this.$forceRunEffects$ = false;
|
|
25449
|
-
(_a = this.$container$) == null ? void 0 : _a.$scheduler$(
|
|
25575
|
+
(_a = this.$container$) == null ? void 0 : _a.$scheduler$(7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
|
|
25450
25576
|
}
|
|
25451
25577
|
/**
|
|
25452
25578
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
25453
25579
|
* remained the same object
|
|
25454
25580
|
*/
|
|
25455
25581
|
force() {
|
|
25456
|
-
this.$
|
|
25582
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25457
25583
|
this.$forceRunEffects$ = false;
|
|
25458
25584
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
25459
25585
|
}
|
|
@@ -25466,14 +25592,14 @@ var ComputedSignal = class extends Signal {
|
|
|
25466
25592
|
return this.$untrackedValue$;
|
|
25467
25593
|
}
|
|
25468
25594
|
$computeIfNeeded$() {
|
|
25469
|
-
if (!this.$
|
|
25595
|
+
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
25470
25596
|
return false;
|
|
25471
25597
|
}
|
|
25472
25598
|
const computeQrl = this.$computeQrl$;
|
|
25473
25599
|
throwIfQRLNotResolved(computeQrl);
|
|
25474
25600
|
const ctx = tryGetInvokeContext();
|
|
25475
25601
|
const previousEffectSubscription = ctx == null ? void 0 : ctx.$effectSubscriber$;
|
|
25476
|
-
ctx && (ctx.$effectSubscriber$ =
|
|
25602
|
+
ctx && (ctx.$effectSubscriber$ = getSubscriber(this, "." /* VNODE */));
|
|
25477
25603
|
try {
|
|
25478
25604
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
25479
25605
|
if (isPromise(untrackedValue)) {
|
|
@@ -25483,7 +25609,7 @@ var ComputedSignal = class extends Signal {
|
|
|
25483
25609
|
]);
|
|
25484
25610
|
}
|
|
25485
25611
|
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
25486
|
-
this.$
|
|
25612
|
+
this.$flags$ &= ~1 /* INVALID */;
|
|
25487
25613
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
25488
25614
|
if (didChange) {
|
|
25489
25615
|
this.$untrackedValue$ = untrackedValue;
|
|
@@ -25507,24 +25633,23 @@ var WrappedSignal = class extends Signal {
|
|
|
25507
25633
|
$args$;
|
|
25508
25634
|
$func$;
|
|
25509
25635
|
$funcStr$;
|
|
25510
|
-
|
|
25511
|
-
// we need the old value to know if effects need running after computation
|
|
25512
|
-
$invalid$ = true;
|
|
25513
|
-
$effectDependencies$ = null;
|
|
25636
|
+
$flags$;
|
|
25514
25637
|
$hostElement$ = null;
|
|
25515
25638
|
$forceRunEffects$ = false;
|
|
25516
|
-
|
|
25639
|
+
[_EFFECT_BACK_REF] = null;
|
|
25640
|
+
constructor(container, fn, args, fnStr, flags = 1 /* INVALID */ | 2 /* UNWRAP */) {
|
|
25517
25641
|
super(container, NEEDS_COMPUTATION);
|
|
25518
25642
|
this.$args$ = args;
|
|
25519
25643
|
this.$func$ = fn;
|
|
25520
25644
|
this.$funcStr$ = fnStr;
|
|
25645
|
+
this.$flags$ = flags;
|
|
25521
25646
|
}
|
|
25522
25647
|
$invalidate$() {
|
|
25523
25648
|
var _a;
|
|
25524
|
-
this.$
|
|
25649
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25525
25650
|
this.$forceRunEffects$ = false;
|
|
25526
25651
|
(_a = this.$container$) == null ? void 0 : _a.$scheduler$(
|
|
25527
|
-
|
|
25652
|
+
7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
|
|
25528
25653
|
this.$hostElement$,
|
|
25529
25654
|
this
|
|
25530
25655
|
);
|
|
@@ -25534,7 +25659,7 @@ var WrappedSignal = class extends Signal {
|
|
|
25534
25659
|
* remained the same object
|
|
25535
25660
|
*/
|
|
25536
25661
|
force() {
|
|
25537
|
-
this.$
|
|
25662
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25538
25663
|
this.$forceRunEffects$ = false;
|
|
25539
25664
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
25540
25665
|
}
|
|
@@ -25547,7 +25672,7 @@ var WrappedSignal = class extends Signal {
|
|
|
25547
25672
|
return this.$untrackedValue$;
|
|
25548
25673
|
}
|
|
25549
25674
|
$computeIfNeeded$() {
|
|
25550
|
-
if (!this.$
|
|
25675
|
+
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
25551
25676
|
return false;
|
|
25552
25677
|
}
|
|
25553
25678
|
const untrackedValue = trackSignal(
|
|
@@ -25613,16 +25738,6 @@ var _SharedContainer = class {
|
|
|
25613
25738
|
}
|
|
25614
25739
|
};
|
|
25615
25740
|
|
|
25616
|
-
// packages/qwik/src/core/shared/utils/constants.ts
|
|
25617
|
-
var QObjectRecursive = 1 << 0;
|
|
25618
|
-
var QObjectImmutable = 1 << 1;
|
|
25619
|
-
var QObjectTargetSymbol = Symbol("proxy target");
|
|
25620
|
-
var QObjectFlagsSymbol = Symbol("proxy flags");
|
|
25621
|
-
var QObjectManagerSymbol = Symbol("proxy manager");
|
|
25622
|
-
var _CONST_PROPS = Symbol("CONST");
|
|
25623
|
-
var _VAR_PROPS = Symbol("VAR");
|
|
25624
|
-
var _IMMUTABLE = Symbol("IMMUTABLE");
|
|
25625
|
-
|
|
25626
25741
|
// packages/qwik/src/core/shared-types.ts
|
|
25627
25742
|
function isStringifiable(value) {
|
|
25628
25743
|
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
@@ -25739,7 +25854,7 @@ var PropsProxyHandler = class {
|
|
|
25739
25854
|
return this.$children$;
|
|
25740
25855
|
}
|
|
25741
25856
|
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
25742
|
-
return value instanceof WrappedSignal ? value.value : value;
|
|
25857
|
+
return value instanceof WrappedSignal && value.$flags$ & 2 /* UNWRAP */ ? value.value : value;
|
|
25743
25858
|
}
|
|
25744
25859
|
set(_, prop, value) {
|
|
25745
25860
|
if (prop === _CONST_PROPS) {
|
|
@@ -25814,7 +25929,7 @@ function qwikDebugToString(value) {
|
|
|
25814
25929
|
return String(value);
|
|
25815
25930
|
} else if (isTask(value)) {
|
|
25816
25931
|
return `Task(${qwikDebugToString(value.$qrl$)})`;
|
|
25817
|
-
} else if (
|
|
25932
|
+
} else if (isQrl2(value)) {
|
|
25818
25933
|
return `Qrl(${value.$symbol$})`;
|
|
25819
25934
|
} else if (typeof value === "object" || typeof value === "function") {
|
|
25820
25935
|
if (stringifyPath.includes(value)) {
|
|
@@ -26092,13 +26207,13 @@ var VNodeDataChar = {
|
|
|
26092
26207
|
/* ****** */
|
|
26093
26208
|
">"
|
|
26094
26209
|
),
|
|
26095
|
-
|
|
26096
|
-
/*
|
|
26210
|
+
SLOT_PARENT: (
|
|
26211
|
+
/* ******** */
|
|
26097
26212
|
63
|
|
26098
26213
|
),
|
|
26099
|
-
// `?` - `q:
|
|
26100
|
-
|
|
26101
|
-
/*
|
|
26214
|
+
// `?` - `q:sparent` - Slot parent.
|
|
26215
|
+
SLOT_PARENT_CHAR: (
|
|
26216
|
+
/* */
|
|
26102
26217
|
"?"
|
|
26103
26218
|
),
|
|
26104
26219
|
KEY: (
|
|
@@ -26143,13 +26258,13 @@ var VNodeDataChar = {
|
|
|
26143
26258
|
/* **** */
|
|
26144
26259
|
"^"
|
|
26145
26260
|
),
|
|
26146
|
-
|
|
26147
|
-
/*
|
|
26261
|
+
BACK_REFS: (
|
|
26262
|
+
/* ********** */
|
|
26148
26263
|
96
|
|
26149
26264
|
),
|
|
26150
|
-
// '`' - `q:
|
|
26151
|
-
|
|
26152
|
-
/*
|
|
26265
|
+
// '`' - `q:brefs' - Effect dependencies/subscriptions
|
|
26266
|
+
BACK_REFS_CHAR: (
|
|
26267
|
+
/* ** */
|
|
26153
26268
|
"`"
|
|
26154
26269
|
),
|
|
26155
26270
|
SEPARATOR: (
|
|
@@ -26172,6 +26287,14 @@ var VNodeDataChar = {
|
|
|
26172
26287
|
)
|
|
26173
26288
|
};
|
|
26174
26289
|
|
|
26290
|
+
// packages/qwik/src/core/shared/utils/maps.ts
|
|
26291
|
+
var mergeMaps = (map1, map2) => {
|
|
26292
|
+
for (const [k, v] of map2) {
|
|
26293
|
+
map1.set(k, v);
|
|
26294
|
+
}
|
|
26295
|
+
return map1;
|
|
26296
|
+
};
|
|
26297
|
+
|
|
26175
26298
|
// packages/qwik/src/core/client/vnode.ts
|
|
26176
26299
|
var vnode_newElement = (element, elementName) => {
|
|
26177
26300
|
assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
@@ -26294,6 +26417,11 @@ var vnode_isVirtualVNode = (vNode) => {
|
|
|
26294
26417
|
const flag = vNode[0 /* flags */];
|
|
26295
26418
|
return (flag & 2 /* Virtual */) === 2 /* Virtual */;
|
|
26296
26419
|
};
|
|
26420
|
+
var vnode_isProjection = (vNode) => {
|
|
26421
|
+
assertDefined(vNode, "Missing vNode");
|
|
26422
|
+
const flag = vNode[0 /* flags */];
|
|
26423
|
+
return (flag & 2 /* Virtual */) === 2 /* Virtual */ && vnode_getProp(vNode, QSlot, null) !== null;
|
|
26424
|
+
};
|
|
26297
26425
|
var ensureTextVNode = (vNode) => {
|
|
26298
26426
|
assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode));
|
|
26299
26427
|
return vNode;
|
|
@@ -26333,6 +26461,7 @@ var vnode_ensureElementInflated = (vnode) => {
|
|
|
26333
26461
|
elementVNode[0 /* flags */] ^= 8 /* Inflated */;
|
|
26334
26462
|
const element = elementVNode[6 /* element */];
|
|
26335
26463
|
const attributes = element.attributes;
|
|
26464
|
+
const props = vnode_getProps(elementVNode);
|
|
26336
26465
|
for (let idx = 0; idx < attributes.length; idx++) {
|
|
26337
26466
|
const attr = attributes[idx];
|
|
26338
26467
|
const key = attr.name;
|
|
@@ -26340,23 +26469,13 @@ var vnode_ensureElementInflated = (vnode) => {
|
|
|
26340
26469
|
break;
|
|
26341
26470
|
} else if (key.startsWith(QContainerAttr)) {
|
|
26342
26471
|
if (attr.value === "html" /* HTML */) {
|
|
26343
|
-
mapArray_set(
|
|
26344
|
-
elementVNode,
|
|
26345
|
-
dangerouslySetInnerHTML,
|
|
26346
|
-
element.innerHTML,
|
|
26347
|
-
8 /* PROPS_OFFSET */
|
|
26348
|
-
);
|
|
26472
|
+
mapArray_set(props, dangerouslySetInnerHTML, element.innerHTML, 0);
|
|
26349
26473
|
} else if (attr.value === "text" /* TEXT */ && "value" in element) {
|
|
26350
|
-
mapArray_set(
|
|
26351
|
-
elementVNode,
|
|
26352
|
-
"value",
|
|
26353
|
-
element.value,
|
|
26354
|
-
8 /* PROPS_OFFSET */
|
|
26355
|
-
);
|
|
26474
|
+
mapArray_set(props, "value", element.value, 0);
|
|
26356
26475
|
}
|
|
26357
26476
|
} else if (!key.startsWith("on:")) {
|
|
26358
26477
|
const value = attr.value;
|
|
26359
|
-
mapArray_set(
|
|
26478
|
+
mapArray_set(props, key, value, 0);
|
|
26360
26479
|
}
|
|
26361
26480
|
}
|
|
26362
26481
|
}
|
|
@@ -26368,7 +26487,9 @@ function vnode_walkVNode(vNode, callback) {
|
|
|
26368
26487
|
}
|
|
26369
26488
|
let vParent = null;
|
|
26370
26489
|
do {
|
|
26371
|
-
callback == null ? void 0 : callback(vCursor, vParent)
|
|
26490
|
+
if (callback == null ? void 0 : callback(vCursor, vParent)) {
|
|
26491
|
+
return;
|
|
26492
|
+
}
|
|
26372
26493
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
26373
26494
|
if (vFirstChild) {
|
|
26374
26495
|
vCursor = vFirstChild;
|
|
@@ -26645,7 +26766,7 @@ var vnode_applyJournal = (journal) => {
|
|
|
26645
26766
|
if (isBooleanAttr(element, key)) {
|
|
26646
26767
|
element[key] = parseBoolean(value);
|
|
26647
26768
|
} else if (key === "value" && key in element) {
|
|
26648
|
-
element.value =
|
|
26769
|
+
element.value = String(value);
|
|
26649
26770
|
} else if (key === dangerouslySetInnerHTML) {
|
|
26650
26771
|
element.innerHTML = value;
|
|
26651
26772
|
} else {
|
|
@@ -26685,59 +26806,14 @@ var vnode_applyJournal = (journal) => {
|
|
|
26685
26806
|
}
|
|
26686
26807
|
journal.length = 0;
|
|
26687
26808
|
};
|
|
26688
|
-
var mapApp_findIndx = (elementVNode, key, start) => {
|
|
26689
|
-
assertTrue(start % 2 === 0, "Expecting even number.");
|
|
26690
|
-
let bottom = start >> 1;
|
|
26691
|
-
let top = elementVNode.length - 2 >> 1;
|
|
26692
|
-
while (bottom <= top) {
|
|
26693
|
-
const mid = bottom + (top - bottom >> 1);
|
|
26694
|
-
const midKey = elementVNode[mid << 1];
|
|
26695
|
-
if (midKey === key) {
|
|
26696
|
-
return mid << 1;
|
|
26697
|
-
}
|
|
26698
|
-
if (midKey < key) {
|
|
26699
|
-
bottom = mid + 1;
|
|
26700
|
-
} else {
|
|
26701
|
-
top = mid - 1;
|
|
26702
|
-
}
|
|
26703
|
-
}
|
|
26704
|
-
return bottom << 1 ^ -1;
|
|
26705
|
-
};
|
|
26706
|
-
var mapArray_set = (elementVNode, key, value, start) => {
|
|
26707
|
-
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
26708
|
-
if (indx >= 0) {
|
|
26709
|
-
if (value == null) {
|
|
26710
|
-
elementVNode.splice(indx, 2);
|
|
26711
|
-
} else {
|
|
26712
|
-
elementVNode[indx + 1] = value;
|
|
26713
|
-
}
|
|
26714
|
-
} else if (value != null) {
|
|
26715
|
-
elementVNode.splice(indx ^ -1, 0, key, value);
|
|
26716
|
-
}
|
|
26717
|
-
};
|
|
26718
|
-
var mapApp_remove = (elementVNode, key, start) => {
|
|
26719
|
-
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
26720
|
-
let value = null;
|
|
26721
|
-
if (indx >= 0) {
|
|
26722
|
-
value = elementVNode[indx + 1];
|
|
26723
|
-
elementVNode.splice(indx, 2);
|
|
26724
|
-
return value;
|
|
26725
|
-
}
|
|
26726
|
-
return value;
|
|
26727
|
-
};
|
|
26728
|
-
var mapArray_get = (elementVNode, key, start) => {
|
|
26729
|
-
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
26730
|
-
if (indx >= 0) {
|
|
26731
|
-
return elementVNode[indx + 1];
|
|
26732
|
-
} else {
|
|
26733
|
-
return null;
|
|
26734
|
-
}
|
|
26735
|
-
};
|
|
26736
26809
|
var vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
|
|
26737
26810
|
ensureElementOrVirtualVNode(parent);
|
|
26738
26811
|
if (vnode_isElementVNode(parent)) {
|
|
26739
26812
|
ensureMaterialized(parent);
|
|
26740
26813
|
}
|
|
26814
|
+
if (newChild === insertBefore) {
|
|
26815
|
+
insertBefore = null;
|
|
26816
|
+
}
|
|
26741
26817
|
let adjustedInsertBefore = null;
|
|
26742
26818
|
if (insertBefore == null) {
|
|
26743
26819
|
if (vnode_isVirtualVNode(parent)) {
|
|
@@ -26840,8 +26916,10 @@ var vnode_getElementName = (vnode) => {
|
|
|
26840
26916
|
const elementVNode = ensureElementVNode(vnode);
|
|
26841
26917
|
let elementName = elementVNode[7 /* elementName */];
|
|
26842
26918
|
if (elementName === void 0) {
|
|
26843
|
-
|
|
26844
|
-
|
|
26919
|
+
const element = elementVNode[6 /* element */];
|
|
26920
|
+
const nodeName = import_build8.isDev ? fastNodeName(element).toLowerCase() : fastNodeName(element);
|
|
26921
|
+
elementName = elementVNode[7 /* elementName */] = nodeName;
|
|
26922
|
+
elementVNode[0 /* flags */] |= vnode_getElementNamespaceFlags(element);
|
|
26845
26923
|
}
|
|
26846
26924
|
return elementName;
|
|
26847
26925
|
};
|
|
@@ -27010,6 +27088,20 @@ var fastFirstChild = (node) => {
|
|
|
27010
27088
|
}
|
|
27011
27089
|
return node;
|
|
27012
27090
|
};
|
|
27091
|
+
var _fastNamespaceURI = null;
|
|
27092
|
+
var fastNamespaceURI = (element) => {
|
|
27093
|
+
if (!_fastNamespaceURI) {
|
|
27094
|
+
_fastNamespaceURI = fastGetter(element, "namespaceURI");
|
|
27095
|
+
}
|
|
27096
|
+
return _fastNamespaceURI.call(element);
|
|
27097
|
+
};
|
|
27098
|
+
var _fastNodeName = null;
|
|
27099
|
+
var fastNodeName = (element) => {
|
|
27100
|
+
if (!_fastNodeName) {
|
|
27101
|
+
_fastNodeName = fastGetter(element, "nodeName");
|
|
27102
|
+
}
|
|
27103
|
+
return _fastNodeName.call(element);
|
|
27104
|
+
};
|
|
27013
27105
|
var fastGetter = (prototype, name) => {
|
|
27014
27106
|
var _a;
|
|
27015
27107
|
let getter;
|
|
@@ -27066,9 +27158,12 @@ var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
|
27066
27158
|
}
|
|
27067
27159
|
const id = consumeValue();
|
|
27068
27160
|
container.$setRawState$(parseInt(id), vParent);
|
|
27069
|
-
|
|
27070
|
-
} else if (peek() === VNodeDataChar.
|
|
27071
|
-
|
|
27161
|
+
import_build8.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
27162
|
+
} else if (peek() === VNodeDataChar.BACK_REFS) {
|
|
27163
|
+
if (!container) {
|
|
27164
|
+
container = getDomContainer(vParent[6 /* element */]);
|
|
27165
|
+
}
|
|
27166
|
+
setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
|
|
27072
27167
|
} else {
|
|
27073
27168
|
consumeValue();
|
|
27074
27169
|
}
|
|
@@ -27076,6 +27171,17 @@ var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
|
27076
27171
|
}
|
|
27077
27172
|
return vFirstChild;
|
|
27078
27173
|
};
|
|
27174
|
+
function setEffectBackRefFromVNodeData(vParent, value, container) {
|
|
27175
|
+
const deserializedSubMap = container.$getObjectById$(value);
|
|
27176
|
+
if (!vParent[_EFFECT_BACK_REF]) {
|
|
27177
|
+
Object.defineProperty(vParent, _EFFECT_BACK_REF, {
|
|
27178
|
+
value: deserializedSubMap
|
|
27179
|
+
});
|
|
27180
|
+
} else {
|
|
27181
|
+
const subMap = vParent[_EFFECT_BACK_REF];
|
|
27182
|
+
mergeMaps(subMap, deserializedSubMap);
|
|
27183
|
+
}
|
|
27184
|
+
}
|
|
27079
27185
|
var processVNodeData = (vData, callback) => {
|
|
27080
27186
|
let nextToConsumeIdx = 0;
|
|
27081
27187
|
let ch = 0;
|
|
@@ -27116,8 +27222,9 @@ var vnode_getAttrKeys = (vnode) => {
|
|
|
27116
27222
|
if ((type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
|
|
27117
27223
|
vnode_ensureElementInflated(vnode);
|
|
27118
27224
|
const keys = [];
|
|
27119
|
-
|
|
27120
|
-
|
|
27225
|
+
const props = vnode_getProps(vnode);
|
|
27226
|
+
for (let i = 0; i < props.length; i = i + 2) {
|
|
27227
|
+
const key = props[i];
|
|
27121
27228
|
if (!key.startsWith(Q_PROPS_SEPARATOR)) {
|
|
27122
27229
|
keys.push(key);
|
|
27123
27230
|
}
|
|
@@ -27130,19 +27237,20 @@ var vnode_setAttr = (journal, vnode, key, value) => {
|
|
|
27130
27237
|
const type = vnode[0 /* flags */];
|
|
27131
27238
|
if ((type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
|
|
27132
27239
|
vnode_ensureElementInflated(vnode);
|
|
27133
|
-
const
|
|
27240
|
+
const props = vnode_getProps(vnode);
|
|
27241
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
27134
27242
|
if (idx >= 0) {
|
|
27135
|
-
if (
|
|
27243
|
+
if (props[idx + 1] != value && (type & 1 /* Element */) !== 0) {
|
|
27136
27244
|
const element = vnode[6 /* element */];
|
|
27137
27245
|
journal && journal.push(2 /* SetAttribute */, element, key, value);
|
|
27138
27246
|
}
|
|
27139
27247
|
if (value == null) {
|
|
27140
|
-
|
|
27248
|
+
props.splice(idx, 2);
|
|
27141
27249
|
} else {
|
|
27142
|
-
|
|
27250
|
+
props[idx + 1] = value;
|
|
27143
27251
|
}
|
|
27144
27252
|
} else if (value != null) {
|
|
27145
|
-
|
|
27253
|
+
props.splice(idx ^ -1, 0, key, value);
|
|
27146
27254
|
if ((type & 1 /* Element */) !== 0) {
|
|
27147
27255
|
const element = vnode[6 /* element */];
|
|
27148
27256
|
journal && journal.push(2 /* SetAttribute */, element, key, value);
|
|
@@ -27154,7 +27262,8 @@ var vnode_getAttr = (vnode, key) => {
|
|
|
27154
27262
|
const type = vnode[0 /* flags */];
|
|
27155
27263
|
if ((type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
|
|
27156
27264
|
vnode_ensureElementInflated(vnode);
|
|
27157
|
-
|
|
27265
|
+
const props = vnode_getProps(vnode);
|
|
27266
|
+
return mapArray_get(props, key, 0);
|
|
27158
27267
|
}
|
|
27159
27268
|
return null;
|
|
27160
27269
|
};
|
|
@@ -27162,11 +27271,12 @@ var vnode_getProp = (vnode, key, getObject) => {
|
|
|
27162
27271
|
const type = vnode[0 /* flags */];
|
|
27163
27272
|
if ((type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
|
|
27164
27273
|
type & 1 /* Element */ && vnode_ensureElementInflated(vnode);
|
|
27165
|
-
const
|
|
27274
|
+
const props = vnode_getProps(vnode);
|
|
27275
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
27166
27276
|
if (idx >= 0) {
|
|
27167
|
-
let value =
|
|
27277
|
+
let value = props[idx + 1];
|
|
27168
27278
|
if (typeof value === "string" && getObject) {
|
|
27169
|
-
|
|
27279
|
+
props[idx + 1] = value = getObject(value);
|
|
27170
27280
|
}
|
|
27171
27281
|
return value;
|
|
27172
27282
|
}
|
|
@@ -27175,11 +27285,12 @@ var vnode_getProp = (vnode, key, getObject) => {
|
|
|
27175
27285
|
};
|
|
27176
27286
|
var vnode_setProp = (vnode, key, value) => {
|
|
27177
27287
|
ensureElementOrVirtualVNode(vnode);
|
|
27178
|
-
const
|
|
27288
|
+
const props = vnode_getProps(vnode);
|
|
27289
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
27179
27290
|
if (idx >= 0) {
|
|
27180
|
-
|
|
27291
|
+
props[idx + 1] = value;
|
|
27181
27292
|
} else if (value != null) {
|
|
27182
|
-
|
|
27293
|
+
props.splice(idx ^ -1, 0, key, value);
|
|
27183
27294
|
}
|
|
27184
27295
|
};
|
|
27185
27296
|
var vnode_getPropStartIndex = (vnode) => {
|
|
@@ -27191,6 +27302,9 @@ var vnode_getPropStartIndex = (vnode) => {
|
|
|
27191
27302
|
}
|
|
27192
27303
|
throw qError(43 /* invalidVNodeType */, [type]);
|
|
27193
27304
|
};
|
|
27305
|
+
var vnode_getProps = (vnode) => {
|
|
27306
|
+
return vnode[vnode_getPropStartIndex(vnode)];
|
|
27307
|
+
};
|
|
27194
27308
|
var vnode_getParent = (vnode) => {
|
|
27195
27309
|
return vnode[1 /* parent */] || null;
|
|
27196
27310
|
};
|
|
@@ -27329,19 +27443,22 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
27329
27443
|
}
|
|
27330
27444
|
const id = consumeValue();
|
|
27331
27445
|
container.$setRawState$(parseInt(id), vParent);
|
|
27332
|
-
|
|
27446
|
+
import_build8.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
27333
27447
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
27334
27448
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
27335
|
-
} else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
27336
|
-
vnode_setAttr(null, vParent, QSlotRef, consumeValue());
|
|
27337
27449
|
} else if (peek() === VNodeDataChar.KEY) {
|
|
27338
27450
|
vnode_setAttr(null, vParent, ELEMENT_KEY, consumeValue());
|
|
27339
27451
|
} else if (peek() === VNodeDataChar.SEQ) {
|
|
27340
27452
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
27341
27453
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
27342
27454
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
27343
|
-
} else if (peek() === VNodeDataChar.
|
|
27344
|
-
|
|
27455
|
+
} else if (peek() === VNodeDataChar.BACK_REFS) {
|
|
27456
|
+
if (!container) {
|
|
27457
|
+
container = getDomContainer(element);
|
|
27458
|
+
}
|
|
27459
|
+
setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
|
|
27460
|
+
} else if (peek() === VNodeDataChar.SLOT_PARENT) {
|
|
27461
|
+
vnode_setProp(vParent, QSlotParent, consumeValue());
|
|
27345
27462
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
27346
27463
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
27347
27464
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -27424,24 +27541,38 @@ var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
|
27424
27541
|
};
|
|
27425
27542
|
var VNodeArray = class VNode extends Array {
|
|
27426
27543
|
static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
|
|
27427
|
-
const vnode = new VNode(
|
|
27428
|
-
|
|
27544
|
+
const vnode = new VNode(
|
|
27545
|
+
flags,
|
|
27546
|
+
parent,
|
|
27547
|
+
previousSibling,
|
|
27548
|
+
nextSibling,
|
|
27549
|
+
firstChild,
|
|
27550
|
+
lastChild,
|
|
27551
|
+
element,
|
|
27552
|
+
elementName,
|
|
27553
|
+
[]
|
|
27554
|
+
);
|
|
27429
27555
|
return vnode;
|
|
27430
27556
|
}
|
|
27431
27557
|
static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
|
|
27432
|
-
const vnode = new VNode(flags, parent, previousSibling, nextSibling);
|
|
27433
|
-
vnode.push(textNode, text);
|
|
27558
|
+
const vnode = new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
|
|
27434
27559
|
return vnode;
|
|
27435
27560
|
}
|
|
27436
27561
|
static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
|
|
27437
|
-
const vnode = new VNode(
|
|
27438
|
-
|
|
27562
|
+
const vnode = new VNode(
|
|
27563
|
+
flags,
|
|
27564
|
+
parent,
|
|
27565
|
+
previousSibling,
|
|
27566
|
+
nextSibling,
|
|
27567
|
+
firstChild,
|
|
27568
|
+
lastChild,
|
|
27569
|
+
[]
|
|
27570
|
+
);
|
|
27439
27571
|
return vnode;
|
|
27440
27572
|
}
|
|
27441
|
-
constructor(flags, parent, previousSibling, nextSibling) {
|
|
27442
|
-
super();
|
|
27443
|
-
|
|
27444
|
-
if (import_build6.isDev) {
|
|
27573
|
+
constructor(flags, parent, previousSibling, nextSibling, ...rest) {
|
|
27574
|
+
super(flags, parent, previousSibling, nextSibling, ...rest);
|
|
27575
|
+
if (import_build8.isDev) {
|
|
27445
27576
|
this.toString = vnode_toString;
|
|
27446
27577
|
}
|
|
27447
27578
|
}
|
|
@@ -27486,10 +27617,12 @@ function invokeApply(context, fn, args) {
|
|
|
27486
27617
|
return returnValue;
|
|
27487
27618
|
}
|
|
27488
27619
|
var newInvokeContextFromTuple = ([element, event, url]) => {
|
|
27489
|
-
const
|
|
27620
|
+
const domContainer = getDomContainer(element);
|
|
27621
|
+
const container = domContainer.element;
|
|
27622
|
+
const vNode = container ? vnode_locate(domContainer.rootVNode, element) : void 0;
|
|
27490
27623
|
const locale = (container == null ? void 0 : container.getAttribute(QLocaleAttr)) || void 0;
|
|
27491
27624
|
locale && setLocale(locale);
|
|
27492
|
-
return newInvokeContext(locale,
|
|
27625
|
+
return newInvokeContext(locale, vNode, element, event, url);
|
|
27493
27626
|
};
|
|
27494
27627
|
var newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
27495
27628
|
const $locale$ = locale || (typeof event === "object" && event && "locale" in event ? event.locale : void 0);
|
|
@@ -27520,10 +27653,7 @@ var trackSignal = (fn, subscriber, property, container, data) => {
|
|
|
27520
27653
|
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
27521
27654
|
const previousContainer = trackInvocation.$container$;
|
|
27522
27655
|
try {
|
|
27523
|
-
trackInvocation.$effectSubscriber$ =
|
|
27524
|
-
if (data) {
|
|
27525
|
-
trackInvocation.$effectSubscriber$.push(data);
|
|
27526
|
-
}
|
|
27656
|
+
trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data);
|
|
27527
27657
|
trackInvocation.$container$ = container;
|
|
27528
27658
|
return invoke(trackInvocation, fn);
|
|
27529
27659
|
} finally {
|
|
@@ -27878,16 +28008,16 @@ var DomContainer = class extends _SharedContainer {
|
|
|
27878
28008
|
$storeProxyMap$ = /* @__PURE__ */ new WeakMap();
|
|
27879
28009
|
$qFuncs$;
|
|
27880
28010
|
$instanceHash$;
|
|
27881
|
-
|
|
28011
|
+
vNodeLocate = (id) => vnode_locate(this.rootVNode, id);
|
|
28012
|
+
$stateData$;
|
|
27882
28013
|
$styleIds$ = null;
|
|
27883
|
-
$vnodeLocate$ = (id) => vnode_locate(this.rootVNode, id);
|
|
27884
28014
|
$renderCount$ = 0;
|
|
27885
28015
|
constructor(element) {
|
|
27886
28016
|
super(
|
|
27887
28017
|
() => this.scheduleRender(),
|
|
27888
28018
|
() => vnode_applyJournal(this.$journal$),
|
|
27889
28019
|
{},
|
|
27890
|
-
element.getAttribute(
|
|
28020
|
+
element.getAttribute(QLocaleAttr)
|
|
27891
28021
|
);
|
|
27892
28022
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
27893
28023
|
if (!this.qContainer) {
|
|
@@ -27909,29 +28039,29 @@ var DomContainer = class extends _SharedContainer {
|
|
|
27909
28039
|
this.qManifestHash = element.getAttribute("q:manifest-hash");
|
|
27910
28040
|
this.rootVNode = vnode_newUnMaterializedElement(this.element);
|
|
27911
28041
|
this.$rawStateData$ = null;
|
|
27912
|
-
this
|
|
28042
|
+
this.$stateData$ = null;
|
|
27913
28043
|
const document2 = this.element.ownerDocument;
|
|
27914
28044
|
if (!document2.qVNodeData) {
|
|
27915
28045
|
processVNodeData2(document2);
|
|
27916
28046
|
}
|
|
27917
28047
|
this.$rawStateData$ = [];
|
|
27918
|
-
this
|
|
28048
|
+
this.$stateData$ = [];
|
|
27919
28049
|
const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
|
|
27920
28050
|
if (qwikStates.length !== 0) {
|
|
27921
28051
|
const lastState = qwikStates[qwikStates.length - 1];
|
|
27922
28052
|
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
27923
|
-
this
|
|
28053
|
+
this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
27924
28054
|
}
|
|
27925
28055
|
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
27926
28056
|
}
|
|
27927
28057
|
$setRawState$(id, vParent) {
|
|
27928
|
-
this
|
|
28058
|
+
this.$stateData$[id] = vParent;
|
|
27929
28059
|
}
|
|
27930
28060
|
parseQRL(qrl2) {
|
|
27931
28061
|
return inflateQRL(this, parseQRL(qrl2));
|
|
27932
28062
|
}
|
|
27933
28063
|
handleError(err, host) {
|
|
27934
|
-
if (qDev) {
|
|
28064
|
+
if (qDev && host) {
|
|
27935
28065
|
if (typeof document !== "undefined") {
|
|
27936
28066
|
const vHost = host;
|
|
27937
28067
|
const errorDiv = document.createElement("errored-host");
|
|
@@ -27954,7 +28084,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
27954
28084
|
throw err;
|
|
27955
28085
|
}
|
|
27956
28086
|
}
|
|
27957
|
-
const errorStore = this.resolveContext(host, ERROR_CONTEXT);
|
|
28087
|
+
const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
|
|
27958
28088
|
if (!errorStore) {
|
|
27959
28089
|
throw err;
|
|
27960
28090
|
}
|
|
@@ -27988,7 +28118,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
27988
28118
|
return vNode;
|
|
27989
28119
|
}
|
|
27990
28120
|
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
27991
|
-
vnode_getProp(vNode, QSlotParent, this
|
|
28121
|
+
vnode_getProp(vNode, QSlotParent, this.vNodeLocate);
|
|
27992
28122
|
} else {
|
|
27993
28123
|
vNode = vnode_getParent(vNode);
|
|
27994
28124
|
}
|
|
@@ -28007,7 +28137,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
28007
28137
|
case ELEMENT_PROPS:
|
|
28008
28138
|
case OnRenderProp:
|
|
28009
28139
|
case QCtxAttr:
|
|
28010
|
-
case
|
|
28140
|
+
case QBackRefs:
|
|
28011
28141
|
getObjectById = this.$getObjectById$;
|
|
28012
28142
|
break;
|
|
28013
28143
|
case ELEMENT_SEQ_IDX:
|
|
@@ -28020,7 +28150,9 @@ var DomContainer = class extends _SharedContainer {
|
|
|
28020
28150
|
scheduleRender() {
|
|
28021
28151
|
this.$renderCount$++;
|
|
28022
28152
|
this.renderDone ||= getPlatform().nextTick(() => this.processChores());
|
|
28023
|
-
return this.renderDone
|
|
28153
|
+
return this.renderDone.finally(
|
|
28154
|
+
() => emitEvent("qrender", { instanceHash: this.$instanceHash$, renderCount: this.$renderCount$ })
|
|
28155
|
+
);
|
|
28024
28156
|
}
|
|
28025
28157
|
processChores() {
|
|
28026
28158
|
let renderCount = this.$renderCount$;
|
|
@@ -28043,12 +28175,13 @@ var DomContainer = class extends _SharedContainer {
|
|
|
28043
28175
|
ensureProjectionResolved(vNode) {
|
|
28044
28176
|
if ((vNode[0 /* flags */] & 16 /* Resolved */) === 0) {
|
|
28045
28177
|
vNode[0 /* flags */] |= 16 /* Resolved */;
|
|
28046
|
-
|
|
28047
|
-
|
|
28178
|
+
const props = vnode_getProps(vNode);
|
|
28179
|
+
for (let i = 0; i < props.length; i = i + 2) {
|
|
28180
|
+
const prop = props[i];
|
|
28048
28181
|
if (isSlotProp(prop)) {
|
|
28049
|
-
const value =
|
|
28182
|
+
const value = props[i + 1];
|
|
28050
28183
|
if (typeof value == "string") {
|
|
28051
|
-
|
|
28184
|
+
props[i + 1] = this.vNodeLocate(value);
|
|
28052
28185
|
}
|
|
28053
28186
|
}
|
|
28054
28187
|
}
|
|
@@ -28062,7 +28195,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
28062
28195
|
id < this.$rawStateData$.length / 2,
|
|
28063
28196
|
`Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`
|
|
28064
28197
|
);
|
|
28065
|
-
return this
|
|
28198
|
+
return this.$stateData$[id];
|
|
28066
28199
|
};
|
|
28067
28200
|
getSyncFn(id) {
|
|
28068
28201
|
const fn = this.$qFuncs$[id];
|
|
@@ -28125,8 +28258,7 @@ var DeserializationHandler = class {
|
|
|
28125
28258
|
}
|
|
28126
28259
|
const i = typeof property === "number" ? property : typeof property === "string" ? parseInt(property, 10) : NaN;
|
|
28127
28260
|
if (Number.isNaN(i) || i < 0 || i >= this.$length$) {
|
|
28128
|
-
|
|
28129
|
-
return out;
|
|
28261
|
+
return Reflect.get(target, property, receiver);
|
|
28130
28262
|
}
|
|
28131
28263
|
const idx = i * 2;
|
|
28132
28264
|
const typeId = this.$data$[idx];
|
|
@@ -28224,7 +28356,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
28224
28356
|
task.$flags$ = v[1];
|
|
28225
28357
|
task.$index$ = v[2];
|
|
28226
28358
|
task.$el$ = v[3];
|
|
28227
|
-
task
|
|
28359
|
+
task[_EFFECT_BACK_REF] = v[4];
|
|
28228
28360
|
task.$state$ = v[5];
|
|
28229
28361
|
break;
|
|
28230
28362
|
case 20 /* Resource */:
|
|
@@ -28246,12 +28378,9 @@ var inflate = (container, target, typeId, data) => {
|
|
|
28246
28378
|
break;
|
|
28247
28379
|
case 25 /* Store */:
|
|
28248
28380
|
case 26 /* StoreArray */: {
|
|
28249
|
-
const [value, flags, effects2
|
|
28381
|
+
const [value, flags, effects2] = data;
|
|
28250
28382
|
const store = getOrCreateStore(value, flags, container);
|
|
28251
28383
|
const storeHandler = getStoreHandler(store);
|
|
28252
|
-
if (storeEffect) {
|
|
28253
|
-
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
28254
|
-
}
|
|
28255
28384
|
storeHandler.$effects$ = effects2;
|
|
28256
28385
|
target = store;
|
|
28257
28386
|
break;
|
|
@@ -28260,7 +28389,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
28260
28389
|
const signal = target;
|
|
28261
28390
|
const d = data;
|
|
28262
28391
|
signal.$untrackedValue$ = d[0];
|
|
28263
|
-
signal.$effects$ = d.slice(1);
|
|
28392
|
+
signal.$effects$ = new Set(d.slice(1));
|
|
28264
28393
|
break;
|
|
28265
28394
|
}
|
|
28266
28395
|
case 23 /* WrappedSignal */: {
|
|
@@ -28268,10 +28397,11 @@ var inflate = (container, target, typeId, data) => {
|
|
|
28268
28397
|
const d = data;
|
|
28269
28398
|
signal.$func$ = container.getSyncFn(d[0]);
|
|
28270
28399
|
signal.$args$ = d[1];
|
|
28271
|
-
signal
|
|
28400
|
+
signal[_EFFECT_BACK_REF] = d[2];
|
|
28272
28401
|
signal.$untrackedValue$ = d[3];
|
|
28273
|
-
signal.$
|
|
28274
|
-
signal.$
|
|
28402
|
+
signal.$flags$ = d[4];
|
|
28403
|
+
signal.$hostElement$ = d[5];
|
|
28404
|
+
signal.$effects$ = new Set(d.slice(6));
|
|
28275
28405
|
break;
|
|
28276
28406
|
}
|
|
28277
28407
|
case 24 /* ComputedSignal */: {
|
|
@@ -28282,7 +28412,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
28282
28412
|
if (d.length === 3) {
|
|
28283
28413
|
computed.$untrackedValue$ = d[2];
|
|
28284
28414
|
} else {
|
|
28285
|
-
computed.$
|
|
28415
|
+
computed.$flags$ |= 1 /* INVALID */;
|
|
28286
28416
|
computed.$computeQrl$.resolve();
|
|
28287
28417
|
(_a = container.$scheduler$) == null ? void 0 : _a.call(
|
|
28288
28418
|
container,
|
|
@@ -28386,6 +28516,7 @@ var _constants = [
|
|
|
28386
28516
|
EMPTY_ARRAY,
|
|
28387
28517
|
EMPTY_OBJ,
|
|
28388
28518
|
NEEDS_COMPUTATION,
|
|
28519
|
+
STORE_ALL_PROPS,
|
|
28389
28520
|
Slot,
|
|
28390
28521
|
Fragment,
|
|
28391
28522
|
NaN,
|
|
@@ -28404,6 +28535,7 @@ var _constantNames = [
|
|
|
28404
28535
|
"EMPTY_ARRAY",
|
|
28405
28536
|
"EMPTY_OBJ",
|
|
28406
28537
|
"NEEDS_COMPUTATION",
|
|
28538
|
+
"STORE_ALL_PROPS",
|
|
28407
28539
|
"Slot",
|
|
28408
28540
|
"Fragment",
|
|
28409
28541
|
"NaN",
|
|
@@ -28485,6 +28617,8 @@ var allocate = (container, typeId, value) => {
|
|
|
28485
28617
|
reject = rej;
|
|
28486
28618
|
});
|
|
28487
28619
|
resolvers.set(promise, [resolve, reject]);
|
|
28620
|
+
promise.catch(() => {
|
|
28621
|
+
});
|
|
28488
28622
|
return promise;
|
|
28489
28623
|
case 17 /* Uint8Array */:
|
|
28490
28624
|
const encodedLength = value.length;
|
|
@@ -28494,12 +28628,9 @@ var allocate = (container, typeId, value) => {
|
|
|
28494
28628
|
return new Uint8Array(decodedLength);
|
|
28495
28629
|
case 29 /* PropsProxy */:
|
|
28496
28630
|
return createPropsProxy(null, null);
|
|
28497
|
-
case 9 /* RefVNode */:
|
|
28498
28631
|
case 8 /* VNode */:
|
|
28499
|
-
|
|
28500
|
-
|
|
28501
|
-
return vnodeOrDocument;
|
|
28502
|
-
}
|
|
28632
|
+
return retrieveVNodeOrDocument(container, value);
|
|
28633
|
+
case 9 /* RefVNode */:
|
|
28503
28634
|
const vNode = retrieveVNodeOrDocument(container, value);
|
|
28504
28635
|
if (vnode_isVNode(vNode)) {
|
|
28505
28636
|
return vnode_getNode(vNode);
|
|
@@ -28507,7 +28638,7 @@ var allocate = (container, typeId, value) => {
|
|
|
28507
28638
|
throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
28508
28639
|
}
|
|
28509
28640
|
case 30 /* EffectData */:
|
|
28510
|
-
return new
|
|
28641
|
+
return new SubscriptionData({});
|
|
28511
28642
|
default:
|
|
28512
28643
|
throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
|
|
28513
28644
|
}
|
|
@@ -28524,12 +28655,12 @@ function parseQRL(qrl2) {
|
|
|
28524
28655
|
const symbol = captureStart > -1 ? qrl2.slice(hashIdx + 1, captureStart) : qrl2.slice(hashIdx + 1);
|
|
28525
28656
|
const captureIds = captureStart > -1 && captureEnd > -1 ? qrl2.slice(captureStart + 1, captureEnd).split(" ").filter((v) => v.length).map((s) => parseInt(s, 10)) : null;
|
|
28526
28657
|
let qrlRef = null;
|
|
28527
|
-
if (
|
|
28658
|
+
if (isDev2 && chunk === QRL_RUNTIME_CHUNK) {
|
|
28528
28659
|
const backChannel = globalThis[QRL_RUNTIME_CHUNK];
|
|
28529
28660
|
assertDefined(backChannel, "Missing QRL_RUNTIME_CHUNK");
|
|
28530
28661
|
qrlRef = backChannel.get(symbol);
|
|
28531
28662
|
}
|
|
28532
|
-
return createQRL(chunk, symbol, qrlRef, null, captureIds, null
|
|
28663
|
+
return createQRL(chunk, symbol, qrlRef, null, captureIds, null);
|
|
28533
28664
|
}
|
|
28534
28665
|
function inflateQRL(container, qrl2) {
|
|
28535
28666
|
const captureIds = qrl2.$capture$;
|
|
@@ -28563,13 +28694,13 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28563
28694
|
}
|
|
28564
28695
|
return id;
|
|
28565
28696
|
};
|
|
28566
|
-
const
|
|
28697
|
+
const isSsrNode2 = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
28567
28698
|
isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
28568
28699
|
return {
|
|
28569
28700
|
$serialize$() {
|
|
28570
28701
|
serialize(this);
|
|
28571
28702
|
},
|
|
28572
|
-
$isSsrNode$:
|
|
28703
|
+
$isSsrNode$: isSsrNode2,
|
|
28573
28704
|
$isDomRef$: isDomRef,
|
|
28574
28705
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
28575
28706
|
$wasSeen$,
|
|
@@ -28625,7 +28756,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28625
28756
|
const promises = [];
|
|
28626
28757
|
const visit = (obj) => {
|
|
28627
28758
|
if (typeof obj === "function") {
|
|
28628
|
-
if (
|
|
28759
|
+
if (isQrl(obj)) {
|
|
28629
28760
|
if (obj.$captureRef$) {
|
|
28630
28761
|
discoveredValues.push(...obj.$captureRef$);
|
|
28631
28762
|
}
|
|
@@ -28635,7 +28766,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28635
28766
|
}
|
|
28636
28767
|
} else if (
|
|
28637
28768
|
// skip as these are primitives
|
|
28638
|
-
typeof obj !== "object" || obj === null || obj instanceof URL || obj instanceof Date || obj instanceof RegExp || obj instanceof Uint8Array || obj instanceof URLSearchParams || typeof FormData !== "undefined" && obj instanceof FormData || // Ignore the no serialize objects
|
|
28769
|
+
typeof obj !== "object" || obj === null || obj instanceof URL || obj instanceof Date || obj instanceof RegExp || obj instanceof Uint8Array || obj instanceof URLSearchParams || vnode_isVNode(obj) || typeof FormData !== "undefined" && obj instanceof FormData || // Ignore the no serialize objects
|
|
28639
28770
|
fastSkipSerialize(obj)
|
|
28640
28771
|
) {
|
|
28641
28772
|
} else if (obj instanceof Error) {
|
|
@@ -28643,8 +28774,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28643
28774
|
} else if (isStore(obj)) {
|
|
28644
28775
|
const target = getStoreTarget(obj);
|
|
28645
28776
|
const effects = getStoreHandler(obj).$effects$;
|
|
28646
|
-
|
|
28647
|
-
discoveredValues.push(target, effects, storeEffect);
|
|
28777
|
+
discoveredValues.push(target, effects);
|
|
28648
28778
|
for (const prop in target) {
|
|
28649
28779
|
const propValue = target[prop];
|
|
28650
28780
|
if (storeProxyMap.has(propValue)) {
|
|
@@ -28658,17 +28788,15 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28658
28788
|
discoveredValues.push(k, v);
|
|
28659
28789
|
});
|
|
28660
28790
|
} else if (obj instanceof Signal) {
|
|
28661
|
-
const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$
|
|
28791
|
+
const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & 1 /* INVALID */ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
|
|
28662
28792
|
if (v !== NEEDS_COMPUTATION) {
|
|
28663
28793
|
discoveredValues.push(v);
|
|
28664
28794
|
}
|
|
28665
28795
|
if (obj.$effects$) {
|
|
28666
|
-
discoveredValues.push(
|
|
28796
|
+
discoveredValues.push(obj.$effects$);
|
|
28667
28797
|
}
|
|
28668
28798
|
if (obj instanceof WrappedSignal) {
|
|
28669
|
-
|
|
28670
|
-
discoveredValues.push(...obj.$effectDependencies$);
|
|
28671
|
-
}
|
|
28799
|
+
discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
28672
28800
|
if (obj.$args$) {
|
|
28673
28801
|
discoveredValues.push(...obj.$args$);
|
|
28674
28802
|
}
|
|
@@ -28676,11 +28804,13 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28676
28804
|
discoveredValues.push(obj.$hostElement$);
|
|
28677
28805
|
}
|
|
28678
28806
|
} else if (obj instanceof ComputedSignal) {
|
|
28807
|
+
discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
28679
28808
|
discoveredValues.push(obj.$computeQrl$);
|
|
28680
28809
|
}
|
|
28681
28810
|
} else if (obj instanceof Task) {
|
|
28682
|
-
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state
|
|
28683
|
-
|
|
28811
|
+
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$);
|
|
28812
|
+
discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
28813
|
+
} else if (isSsrNode2(obj)) {
|
|
28684
28814
|
discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
|
|
28685
28815
|
if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
28686
28816
|
for (const data of obj.childrenVNodeData) {
|
|
@@ -28693,7 +28823,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28693
28823
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
28694
28824
|
} else if (Array.isArray(obj)) {
|
|
28695
28825
|
discoveredValues.push(...obj);
|
|
28696
|
-
} else if (
|
|
28826
|
+
} else if (isQrl(obj)) {
|
|
28697
28827
|
obj.$captureRef$ && obj.$captureRef$.length && discoveredValues.push(...obj.$captureRef$);
|
|
28698
28828
|
} else if (isPropsProxy(obj)) {
|
|
28699
28829
|
discoveredValues.push(obj[_VAR_PROPS], obj[_CONST_PROPS]);
|
|
@@ -28709,7 +28839,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
28709
28839
|
}
|
|
28710
28840
|
);
|
|
28711
28841
|
promises.push(obj);
|
|
28712
|
-
} else if (obj instanceof
|
|
28842
|
+
} else if (obj instanceof SubscriptionData) {
|
|
28713
28843
|
discoveredValues.push(obj.data);
|
|
28714
28844
|
} else if (isObjectLiteral(obj)) {
|
|
28715
28845
|
Object.entries(obj).forEach(([key, value]) => {
|
|
@@ -28746,15 +28876,20 @@ var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
|
|
|
28746
28876
|
for (const value of vnodeData) {
|
|
28747
28877
|
if (isSsrAttrs(value)) {
|
|
28748
28878
|
for (let i = 1; i < value.length; i += 2) {
|
|
28749
|
-
|
|
28879
|
+
const attrValue = value[i];
|
|
28880
|
+
if (typeof attrValue === "string") {
|
|
28750
28881
|
continue;
|
|
28751
28882
|
}
|
|
28752
|
-
const attrValue = value[i];
|
|
28753
28883
|
discoveredValues.push(attrValue);
|
|
28754
28884
|
}
|
|
28755
28885
|
}
|
|
28756
28886
|
}
|
|
28757
28887
|
};
|
|
28888
|
+
var discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
|
|
28889
|
+
if (effectsBackRefs) {
|
|
28890
|
+
discoveredValues.push(effectsBackRefs);
|
|
28891
|
+
}
|
|
28892
|
+
};
|
|
28758
28893
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
28759
28894
|
function serialize(serializationContext) {
|
|
28760
28895
|
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
@@ -28803,10 +28938,10 @@ function serialize(serializationContext) {
|
|
|
28803
28938
|
output(1 /* Constant */, value ? 2 /* True */ : 3 /* False */);
|
|
28804
28939
|
} else if (typeof value === "function") {
|
|
28805
28940
|
if (value === Slot) {
|
|
28806
|
-
output(1 /* Constant */,
|
|
28941
|
+
output(1 /* Constant */, 9 /* Slot */);
|
|
28807
28942
|
} else if (value === Fragment) {
|
|
28808
|
-
output(1 /* Constant */,
|
|
28809
|
-
} else if (
|
|
28943
|
+
output(1 /* Constant */, 10 /* Fragment */);
|
|
28944
|
+
} else if (isQrl(value)) {
|
|
28810
28945
|
const qrl2 = qrlToString(serializationContext, value);
|
|
28811
28946
|
const id = serializationContext.$addRoot$(qrl2);
|
|
28812
28947
|
output(18 /* QRL */, id);
|
|
@@ -28820,18 +28955,18 @@ function serialize(serializationContext) {
|
|
|
28820
28955
|
}
|
|
28821
28956
|
} else if (typeof value === "number") {
|
|
28822
28957
|
if (Number.isNaN(value)) {
|
|
28823
|
-
output(1 /* Constant */,
|
|
28958
|
+
output(1 /* Constant */, 11 /* NaN */);
|
|
28824
28959
|
} else if (!Number.isFinite(value)) {
|
|
28825
28960
|
output(
|
|
28826
28961
|
1 /* Constant */,
|
|
28827
|
-
value < 0 ?
|
|
28962
|
+
value < 0 ? 13 /* NegativeInfinity */ : 12 /* PositiveInfinity */
|
|
28828
28963
|
);
|
|
28829
28964
|
} else if (value === Number.MAX_SAFE_INTEGER) {
|
|
28830
|
-
output(1 /* Constant */,
|
|
28965
|
+
output(1 /* Constant */, 14 /* MaxSafeInt */);
|
|
28831
28966
|
} else if (value === Number.MAX_SAFE_INTEGER - 1) {
|
|
28832
|
-
output(1 /* Constant */,
|
|
28967
|
+
output(1 /* Constant */, 15 /* AlmostMaxSafeInt */);
|
|
28833
28968
|
} else if (value === Number.MIN_SAFE_INTEGER) {
|
|
28834
|
-
output(1 /* Constant */,
|
|
28969
|
+
output(1 /* Constant */, 16 /* MinSafeInt */);
|
|
28835
28970
|
} else {
|
|
28836
28971
|
output(2 /* Number */, value);
|
|
28837
28972
|
}
|
|
@@ -28864,6 +28999,8 @@ function serialize(serializationContext) {
|
|
|
28864
28999
|
output(1 /* Constant */, 0 /* Undefined */);
|
|
28865
29000
|
} else if (value === NEEDS_COMPUTATION) {
|
|
28866
29001
|
output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
29002
|
+
} else if (value === STORE_ALL_PROPS) {
|
|
29003
|
+
output(1 /* Constant */, 8 /* STORE_ALL_PROPS */);
|
|
28867
29004
|
} else {
|
|
28868
29005
|
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
28869
29006
|
}
|
|
@@ -28883,7 +29020,7 @@ function serialize(serializationContext) {
|
|
|
28883
29020
|
const constProps = value[_CONST_PROPS];
|
|
28884
29021
|
const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
|
|
28885
29022
|
output(29 /* PropsProxy */, out);
|
|
28886
|
-
} else if (value instanceof
|
|
29023
|
+
} else if (value instanceof SubscriptionData) {
|
|
28887
29024
|
output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
|
|
28888
29025
|
} else if (isStore(value)) {
|
|
28889
29026
|
if (isResource(value)) {
|
|
@@ -28898,7 +29035,6 @@ function serialize(serializationContext) {
|
|
|
28898
29035
|
const storeTarget = getStoreTarget(value);
|
|
28899
29036
|
const flags = storeHandler.$flags$;
|
|
28900
29037
|
const effects = storeHandler.$effects$;
|
|
28901
|
-
const storeEffect = (effects == null ? void 0 : effects[STORE_ARRAY_PROP]) ?? null;
|
|
28902
29038
|
const innerStores = [];
|
|
28903
29039
|
for (const prop in storeTarget) {
|
|
28904
29040
|
const propValue = storeTarget[prop];
|
|
@@ -28908,7 +29044,7 @@ function serialize(serializationContext) {
|
|
|
28908
29044
|
serializationContext.$addRoot$(innerStore);
|
|
28909
29045
|
}
|
|
28910
29046
|
}
|
|
28911
|
-
const out = [storeTarget, flags, effects,
|
|
29047
|
+
const out = [storeTarget, flags, effects, ...innerStores];
|
|
28912
29048
|
while (out[out.length - 1] == null) {
|
|
28913
29049
|
out.pop();
|
|
28914
29050
|
}
|
|
@@ -28930,12 +29066,13 @@ function serialize(serializationContext) {
|
|
|
28930
29066
|
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
28931
29067
|
output(9 /* RefVNode */, value.$ssrNode$.id);
|
|
28932
29068
|
} else if (value instanceof Signal) {
|
|
28933
|
-
const v = value instanceof ComputedSignal && (value.$
|
|
29069
|
+
const v = value instanceof ComputedSignal && (value.$flags$ & 1 /* INVALID */ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
28934
29070
|
if (value instanceof WrappedSignal) {
|
|
28935
29071
|
output(23 /* WrappedSignal */, [
|
|
28936
29072
|
...serializeWrappingFn(serializationContext, value),
|
|
28937
|
-
value
|
|
29073
|
+
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
28938
29074
|
v,
|
|
29075
|
+
value.$flags$,
|
|
28939
29076
|
value.$hostElement$,
|
|
28940
29077
|
...value.$effects$ || []
|
|
28941
29078
|
]);
|
|
@@ -28964,7 +29101,7 @@ function serialize(serializationContext) {
|
|
|
28964
29101
|
if (extraProps.length) {
|
|
28965
29102
|
out.push(extraProps);
|
|
28966
29103
|
}
|
|
28967
|
-
if (
|
|
29104
|
+
if (isDev2) {
|
|
28968
29105
|
out.push(value.stack);
|
|
28969
29106
|
}
|
|
28970
29107
|
output(12 /* Error */, out);
|
|
@@ -29021,7 +29158,7 @@ function serialize(serializationContext) {
|
|
|
29021
29158
|
value.$flags$,
|
|
29022
29159
|
value.$index$,
|
|
29023
29160
|
value.$el$,
|
|
29024
|
-
value
|
|
29161
|
+
value[_EFFECT_BACK_REF],
|
|
29025
29162
|
value.$state$
|
|
29026
29163
|
];
|
|
29027
29164
|
while (out[out.length - 1] == null) {
|
|
@@ -29041,12 +29178,26 @@ function serialize(serializationContext) {
|
|
|
29041
29178
|
}
|
|
29042
29179
|
const out = btoa(buf).replace(/=+$/, "");
|
|
29043
29180
|
output(17 /* Uint8Array */, out);
|
|
29181
|
+
} else if (vnode_isVNode(value)) {
|
|
29182
|
+
output(1 /* Constant */, 0 /* Undefined */);
|
|
29044
29183
|
} else {
|
|
29045
29184
|
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
29046
29185
|
}
|
|
29047
29186
|
};
|
|
29048
29187
|
writeValue(serializationContext.$roots$, -1);
|
|
29049
29188
|
}
|
|
29189
|
+
function filterEffectBackRefs(effectBackRef) {
|
|
29190
|
+
let effectBackRefToSerialize = null;
|
|
29191
|
+
if (effectBackRef) {
|
|
29192
|
+
for (const [effectProp, effect] of effectBackRef) {
|
|
29193
|
+
if (effect[2 /* BACK_REF */]) {
|
|
29194
|
+
effectBackRefToSerialize ||= /* @__PURE__ */ new Map();
|
|
29195
|
+
effectBackRefToSerialize.set(effectProp, effect);
|
|
29196
|
+
}
|
|
29197
|
+
}
|
|
29198
|
+
}
|
|
29199
|
+
return effectBackRefToSerialize;
|
|
29200
|
+
}
|
|
29050
29201
|
function serializeWrappingFn(serializationContext, value) {
|
|
29051
29202
|
if (value.$funcStr$ && value.$funcStr$[0] === "{") {
|
|
29052
29203
|
value.$funcStr$ = `(${value.$funcStr$})`;
|
|
@@ -29062,15 +29213,12 @@ function qrlToString(serializationContext, value) {
|
|
|
29062
29213
|
var _a;
|
|
29063
29214
|
let symbol = value.$symbol$;
|
|
29064
29215
|
let chunk = value.$chunk$;
|
|
29065
|
-
const refSymbol = value.$refSymbol$ ?? symbol;
|
|
29066
29216
|
const platform = getPlatform();
|
|
29067
29217
|
if (platform) {
|
|
29068
|
-
const result = platform.chunkForSymbol(
|
|
29218
|
+
const result = platform.chunkForSymbol(symbol, chunk, (_a = value.dev) == null ? void 0 : _a.file);
|
|
29069
29219
|
if (result) {
|
|
29070
29220
|
chunk = result[1];
|
|
29071
|
-
|
|
29072
|
-
symbol = result[0];
|
|
29073
|
-
}
|
|
29221
|
+
symbol = result[0];
|
|
29074
29222
|
}
|
|
29075
29223
|
}
|
|
29076
29224
|
const isSync = isSyncQrl(value);
|
|
@@ -29078,7 +29226,7 @@ function qrlToString(serializationContext, value) {
|
|
|
29078
29226
|
if (!chunk) {
|
|
29079
29227
|
chunk = serializationContext.$symbolToChunkResolver$(value.$hash$);
|
|
29080
29228
|
}
|
|
29081
|
-
if (
|
|
29229
|
+
if (isDev2) {
|
|
29082
29230
|
let backChannel = globalThis[QRL_RUNTIME_CHUNK];
|
|
29083
29231
|
if (!backChannel) {
|
|
29084
29232
|
backChannel = globalThis[QRL_RUNTIME_CHUNK] = /* @__PURE__ */ new Map();
|
|
@@ -29144,26 +29292,33 @@ function isResource(value) {
|
|
|
29144
29292
|
return "__brand" in value && value.__brand === "resource";
|
|
29145
29293
|
}
|
|
29146
29294
|
var frameworkType = (obj) => {
|
|
29147
|
-
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) ||
|
|
29295
|
+
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl(obj);
|
|
29148
29296
|
};
|
|
29149
|
-
var canSerialize = (value) => {
|
|
29297
|
+
var canSerialize = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
29150
29298
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
29151
29299
|
return true;
|
|
29152
29300
|
} else if (typeof value === "object") {
|
|
29301
|
+
if (seen.has(value)) {
|
|
29302
|
+
return true;
|
|
29303
|
+
}
|
|
29304
|
+
seen.add(value);
|
|
29153
29305
|
const proto = Object.getPrototypeOf(value);
|
|
29154
29306
|
if (isStore(value)) {
|
|
29155
29307
|
value = getStoreTarget(value);
|
|
29156
29308
|
}
|
|
29157
29309
|
if (proto == Object.prototype) {
|
|
29158
29310
|
for (const key in value) {
|
|
29159
|
-
if (!canSerialize(
|
|
29311
|
+
if (!canSerialize(
|
|
29312
|
+
untrack(() => value[key]),
|
|
29313
|
+
seen
|
|
29314
|
+
)) {
|
|
29160
29315
|
return false;
|
|
29161
29316
|
}
|
|
29162
29317
|
}
|
|
29163
29318
|
return true;
|
|
29164
29319
|
} else if (proto == Array.prototype) {
|
|
29165
29320
|
for (let i = 0; i < value.length; i++) {
|
|
29166
|
-
if (!canSerialize(value[i])) {
|
|
29321
|
+
if (!canSerialize(value[i], seen)) {
|
|
29167
29322
|
return false;
|
|
29168
29323
|
}
|
|
29169
29324
|
}
|
|
@@ -29198,7 +29353,7 @@ var canSerialize = (value) => {
|
|
|
29198
29353
|
return true;
|
|
29199
29354
|
}
|
|
29200
29355
|
} else if (typeof value === "function") {
|
|
29201
|
-
if (
|
|
29356
|
+
if (isQrl(value) || isQwikComponent(value)) {
|
|
29202
29357
|
return true;
|
|
29203
29358
|
}
|
|
29204
29359
|
}
|
|
@@ -29316,7 +29471,7 @@ var constantToName = (code2) => {
|
|
|
29316
29471
|
|
|
29317
29472
|
// packages/qwik/src/core/shared/utils/serialize-utils.ts
|
|
29318
29473
|
var verifySerializable = (value, preMessage) => {
|
|
29319
|
-
const seen = /* @__PURE__ */ new
|
|
29474
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
29320
29475
|
return _verifySerializable(value, seen, "_", preMessage);
|
|
29321
29476
|
};
|
|
29322
29477
|
var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
@@ -29325,10 +29480,12 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
29325
29480
|
return value;
|
|
29326
29481
|
}
|
|
29327
29482
|
if (shouldSerialize(unwrapped)) {
|
|
29328
|
-
if (
|
|
29329
|
-
|
|
29483
|
+
if (typeof unwrapped === "object") {
|
|
29484
|
+
if (seen.has(unwrapped)) {
|
|
29485
|
+
return value;
|
|
29486
|
+
}
|
|
29487
|
+
seen.add(unwrapped);
|
|
29330
29488
|
}
|
|
29331
|
-
seen.add(unwrapped);
|
|
29332
29489
|
if (isSignal(unwrapped)) {
|
|
29333
29490
|
return value;
|
|
29334
29491
|
}
|
|
@@ -29410,14 +29567,7 @@ var noSerialize = (input) => {
|
|
|
29410
29567
|
};
|
|
29411
29568
|
|
|
29412
29569
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
29413
|
-
var
|
|
29414
|
-
return typeof value === "function" && typeof value.getSymbol === "function";
|
|
29415
|
-
};
|
|
29416
|
-
var SYNC_QRL = "<sync>";
|
|
29417
|
-
var isSyncQrl = (value) => {
|
|
29418
|
-
return isQrl2(value) && value.$symbol$ == SYNC_QRL;
|
|
29419
|
-
};
|
|
29420
|
-
var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
|
|
29570
|
+
var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
|
|
29421
29571
|
if (qDev && qSerialize) {
|
|
29422
29572
|
if (captureRef) {
|
|
29423
29573
|
for (const item of captureRef) {
|
|
@@ -29438,9 +29588,14 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29438
29588
|
return _containerEl;
|
|
29439
29589
|
};
|
|
29440
29590
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
29441
|
-
|
|
29442
|
-
if (!
|
|
29443
|
-
|
|
29591
|
+
const bound = (...args) => {
|
|
29592
|
+
if (!qrl2.resolved) {
|
|
29593
|
+
return qrl2.resolve().then((fn) => {
|
|
29594
|
+
if (!isFunction(fn)) {
|
|
29595
|
+
throw qError(10 /* qrlIsNotFunction */);
|
|
29596
|
+
}
|
|
29597
|
+
return bound(...args);
|
|
29598
|
+
});
|
|
29444
29599
|
}
|
|
29445
29600
|
if (beforeFn && beforeFn() === false) {
|
|
29446
29601
|
return;
|
|
@@ -29451,12 +29606,13 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29451
29606
|
context.$qrl$ = qrl2;
|
|
29452
29607
|
context.$event$ ||= this;
|
|
29453
29608
|
try {
|
|
29454
|
-
return invoke.call(this, context,
|
|
29609
|
+
return invoke.call(this, context, symbolRef, ...args);
|
|
29455
29610
|
} finally {
|
|
29456
29611
|
context.$qrl$ = prevQrl;
|
|
29457
29612
|
context.$event$ = prevEvent;
|
|
29458
29613
|
}
|
|
29459
|
-
}
|
|
29614
|
+
};
|
|
29615
|
+
return bound;
|
|
29460
29616
|
}
|
|
29461
29617
|
const resolveLazy = (containerEl) => {
|
|
29462
29618
|
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
@@ -29466,9 +29622,19 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29466
29622
|
return fn;
|
|
29467
29623
|
}
|
|
29468
29624
|
return function(...args) {
|
|
29625
|
+
var _a;
|
|
29469
29626
|
let context = tryGetInvokeContext();
|
|
29470
29627
|
if (context) {
|
|
29471
|
-
|
|
29628
|
+
if (((_a = context.$qrl$) == null ? void 0 : _a.$symbol$) === qrl2.$symbol$) {
|
|
29629
|
+
return fn.apply(this, args);
|
|
29630
|
+
}
|
|
29631
|
+
const prevQrl = context.$qrl$;
|
|
29632
|
+
context.$qrl$ = qrl2;
|
|
29633
|
+
try {
|
|
29634
|
+
return fn.apply(this, args);
|
|
29635
|
+
} finally {
|
|
29636
|
+
context.$qrl$ = prevQrl;
|
|
29637
|
+
}
|
|
29472
29638
|
}
|
|
29473
29639
|
context = newInvokeContext();
|
|
29474
29640
|
context.$qrl$ = qrl2;
|
|
@@ -29493,10 +29659,12 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29493
29659
|
const start = now();
|
|
29494
29660
|
const ctx = tryGetInvokeContext();
|
|
29495
29661
|
if (symbolFn !== null) {
|
|
29496
|
-
symbolRef = symbolFn().then(
|
|
29662
|
+
symbolRef = symbolFn().then(
|
|
29663
|
+
(module2) => qrl2.resolved = wrapFn(symbolRef = module2[symbol])
|
|
29664
|
+
);
|
|
29497
29665
|
} else {
|
|
29498
29666
|
const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
|
|
29499
|
-
symbolRef = maybeThen(imported, (ref) => qrl2.resolved = symbolRef =
|
|
29667
|
+
symbolRef = maybeThen(imported, (ref) => qrl2.resolved = wrapFn(symbolRef = ref));
|
|
29500
29668
|
}
|
|
29501
29669
|
if (typeof symbolRef === "object" && isPromise(symbolRef)) {
|
|
29502
29670
|
symbolRef.then(
|
|
@@ -29519,10 +29687,9 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29519
29687
|
return invoke2;
|
|
29520
29688
|
}
|
|
29521
29689
|
};
|
|
29522
|
-
const
|
|
29523
|
-
const hash3 = getSymbolHash(resolvedSymbol);
|
|
29690
|
+
const hash3 = getSymbolHash(symbol);
|
|
29524
29691
|
Object.assign(qrl2, {
|
|
29525
|
-
getSymbol: () =>
|
|
29692
|
+
getSymbol: () => symbol,
|
|
29526
29693
|
getHash: () => hash3,
|
|
29527
29694
|
getCaptured: () => captureRef,
|
|
29528
29695
|
resolve,
|
|
@@ -29530,7 +29697,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29530
29697
|
$setContainer$: setContainer,
|
|
29531
29698
|
$chunk$: chunk,
|
|
29532
29699
|
$symbol$: symbol,
|
|
29533
|
-
$refSymbol$: refSymbol,
|
|
29534
29700
|
$hash$: hash3,
|
|
29535
29701
|
getFn: bindFnToContext,
|
|
29536
29702
|
$capture$: capture,
|
|
@@ -29539,9 +29705,9 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29539
29705
|
resolved: void 0
|
|
29540
29706
|
});
|
|
29541
29707
|
if (symbolRef) {
|
|
29542
|
-
symbolRef = maybeThen(symbolRef, (resolved) => qrl2.resolved = symbolRef =
|
|
29708
|
+
symbolRef = maybeThen(symbolRef, (resolved) => qrl2.resolved = wrapFn(symbolRef = resolved));
|
|
29543
29709
|
}
|
|
29544
|
-
if (
|
|
29710
|
+
if (import_build10.isDev) {
|
|
29545
29711
|
Object.defineProperty(qrl2, "_devOnlySymbolRef", {
|
|
29546
29712
|
get() {
|
|
29547
29713
|
return symbolRef;
|
|
@@ -29553,20 +29719,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29553
29719
|
}
|
|
29554
29720
|
return qrl2;
|
|
29555
29721
|
};
|
|
29556
|
-
var getSymbolHash = (symbolName) => {
|
|
29557
|
-
const index = symbolName.lastIndexOf("_");
|
|
29558
|
-
if (index > -1) {
|
|
29559
|
-
return symbolName.slice(index + 1);
|
|
29560
|
-
}
|
|
29561
|
-
return symbolName;
|
|
29562
|
-
};
|
|
29563
|
-
function assertQrl(qrl2) {
|
|
29564
|
-
if (qDev) {
|
|
29565
|
-
if (!isQrl2(qrl2)) {
|
|
29566
|
-
throw new Error("Not a QRL");
|
|
29567
|
-
}
|
|
29568
|
-
}
|
|
29569
|
-
}
|
|
29570
29722
|
var EMITTED = /* @__PURE__ */ new Set();
|
|
29571
29723
|
var emitUsedSymbol = (symbol, element, reqTime) => {
|
|
29572
29724
|
if (!EMITTED.has(symbol)) {
|
|
@@ -29606,7 +29758,7 @@ var $ = (expression) => {
|
|
|
29606
29758
|
"Optimizer should replace all usages of $() with some special syntax. If you need to create a QRL manually, use inlinedQrl() instead."
|
|
29607
29759
|
);
|
|
29608
29760
|
}
|
|
29609
|
-
return createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null
|
|
29761
|
+
return createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null);
|
|
29610
29762
|
};
|
|
29611
29763
|
var dollar = $;
|
|
29612
29764
|
var eventQrl = (qrl2) => {
|
|
@@ -29633,9 +29785,6 @@ var isQwikComponent = (component) => {
|
|
|
29633
29785
|
return typeof component == "function" && component[SERIALIZABLE_STATE] !== void 0;
|
|
29634
29786
|
};
|
|
29635
29787
|
|
|
29636
|
-
// packages/qwik/src/core/index.ts
|
|
29637
|
-
var import_build10 = require("@qwik.dev/core/build");
|
|
29638
|
-
|
|
29639
29788
|
// packages/qwik/src/core/shared/qrl/qrl.public.dollar.ts
|
|
29640
29789
|
var event$ = implicit$FirstArg(eventQrl);
|
|
29641
29790
|
|
|
@@ -29822,9 +29971,6 @@ var useComputedQrl = (qrl2) => {
|
|
|
29822
29971
|
// packages/qwik/src/core/use/use-computed-dollar.ts
|
|
29823
29972
|
var useComputed$ = implicit$FirstArg(useComputedQrl);
|
|
29824
29973
|
|
|
29825
|
-
// packages/qwik/src/core/shared/prefetch-service-worker/prefetch.ts
|
|
29826
|
-
var import_build9 = require("@qwik.dev/core/build");
|
|
29827
|
-
|
|
29828
29974
|
// packages/qwik/src/testing/vdom-diff.unit-util.ts
|
|
29829
29975
|
var import_vitest = require("vitest");
|
|
29830
29976
|
var import_prettier = require("prettier");
|
|
@@ -29937,7 +30083,7 @@ import_vitest.expect.extend({
|
|
|
29937
30083
|
};
|
|
29938
30084
|
}
|
|
29939
30085
|
});
|
|
29940
|
-
var ignoredAttributes = [
|
|
30086
|
+
var ignoredAttributes = [QBackRefs, ELEMENT_ID, "", Q_PROPS_SEPARATOR];
|
|
29941
30087
|
function getContainerElement(vNode) {
|
|
29942
30088
|
let maybeParent;
|
|
29943
30089
|
do {
|
|
@@ -30366,7 +30512,6 @@ function attrsEqual(expectedValue, receivedValue) {
|
|
|
30366
30512
|
}
|
|
30367
30513
|
|
|
30368
30514
|
// packages/qwik/src/testing/element-fixture.ts
|
|
30369
|
-
var import_vitest2 = require("vitest");
|
|
30370
30515
|
var import_core2 = require("../core.cjs");
|
|
30371
30516
|
|
|
30372
30517
|
// packages/qwik/src/testing/platform.ts
|
|
@@ -30544,7 +30689,6 @@ var dispatch = async (element, attrName, event, scope) => {
|
|
|
30544
30689
|
const isDocumentOrWindow = isDocumentOrWindowEvent(event.type);
|
|
30545
30690
|
const preventAttributeName = PREVENT_DEFAULT + (isDocumentOrWindow ? event.type.substring(1) : event.type);
|
|
30546
30691
|
const stopPropagationName = STOP_PROPAGATION + event.type;
|
|
30547
|
-
const collectListeners = [];
|
|
30548
30692
|
while (element) {
|
|
30549
30693
|
const preventDefault = element.hasAttribute(preventAttributeName);
|
|
30550
30694
|
const stopPropagation = element.hasAttribute(stopPropagationName);
|
|
@@ -30561,15 +30705,21 @@ var dispatch = async (element, attrName, event, scope) => {
|
|
|
30561
30705
|
} else if (element.hasAttribute(attrName)) {
|
|
30562
30706
|
const container = (0, import_core2.getDomContainer)(element);
|
|
30563
30707
|
const qrl2 = element.getAttribute(attrName);
|
|
30564
|
-
|
|
30708
|
+
const ctx = newInvokeContextFromTuple([element, event]);
|
|
30709
|
+
try {
|
|
30710
|
+
await Promise.all(
|
|
30711
|
+
qrl2.split("\n").map((qrl3) => container.parseQRL(qrl3.trim())).map((qrl3) => {
|
|
30712
|
+
return invokeApply(ctx, qrl3, [event, element]);
|
|
30713
|
+
})
|
|
30714
|
+
);
|
|
30715
|
+
} catch (error) {
|
|
30716
|
+
console.error("!!! qrl error", qrl2, error);
|
|
30717
|
+
throw error;
|
|
30718
|
+
}
|
|
30565
30719
|
return;
|
|
30566
30720
|
}
|
|
30567
30721
|
element = element.parentElement;
|
|
30568
30722
|
}
|
|
30569
|
-
for (let i = 0; i < collectListeners.length; i++) {
|
|
30570
|
-
const { element: element2, qrl: qrl2 } = collectListeners[i];
|
|
30571
|
-
await qrl2.getFn([element2, event], () => element2.isConnected)(event, element2);
|
|
30572
|
-
}
|
|
30573
30723
|
};
|
|
30574
30724
|
|
|
30575
30725
|
// packages/qwik/src/testing/library.ts
|
|
@@ -30596,20 +30746,34 @@ var getQwik = async () => {
|
|
|
30596
30746
|
};
|
|
30597
30747
|
|
|
30598
30748
|
// packages/qwik/src/testing/expect-dom.tsx
|
|
30599
|
-
var
|
|
30749
|
+
var import_vitest2 = require("vitest");
|
|
30600
30750
|
var import_prettier2 = require("prettier");
|
|
30601
30751
|
async function expectDOM(actual, expected) {
|
|
30602
30752
|
const options = { parser: "html", htmlWhitespaceSensitivity: "ignore" };
|
|
30603
|
-
|
|
30753
|
+
import_vitest2.assert.equal(await (0, import_prettier2.format)(actual.outerHTML, options), await (0, import_prettier2.format)(expected, options));
|
|
30604
30754
|
}
|
|
30605
30755
|
|
|
30606
30756
|
// packages/qwik/src/testing/rendering.unit-util.tsx
|
|
30607
30757
|
var import_core8 = require("../core.cjs");
|
|
30608
|
-
var
|
|
30758
|
+
var import_vitest3 = require("vitest");
|
|
30609
30759
|
|
|
30610
30760
|
// packages/qwik/src/server/platform.ts
|
|
30611
30761
|
var import_core3 = require("../core.cjs");
|
|
30612
|
-
|
|
30762
|
+
|
|
30763
|
+
// packages/qwik/src/optimizer/src/versions.ts
|
|
30764
|
+
var versions2 = {
|
|
30765
|
+
qwik: globalThis.QWIK_VERSION
|
|
30766
|
+
};
|
|
30767
|
+
|
|
30768
|
+
// packages/qwik/src/optimizer/src/manifest.ts
|
|
30769
|
+
function getValidManifest(manifest) {
|
|
30770
|
+
if (manifest != null && manifest.mapping != null && typeof manifest.mapping === "object" && manifest.symbols != null && typeof manifest.symbols === "object" && manifest.bundles != null && typeof manifest.bundles === "object") {
|
|
30771
|
+
return manifest;
|
|
30772
|
+
}
|
|
30773
|
+
return void 0;
|
|
30774
|
+
}
|
|
30775
|
+
|
|
30776
|
+
// packages/qwik/src/server/platform.ts
|
|
30613
30777
|
function createPlatform3(opts, resolvedManifest) {
|
|
30614
30778
|
const mapper = resolvedManifest == null ? void 0 : resolvedManifest.mapper;
|
|
30615
30779
|
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
|
|
@@ -30618,7 +30782,7 @@ function createPlatform3(opts, resolvedManifest) {
|
|
|
30618
30782
|
const hash3 = getSymbolHash2(symbolName);
|
|
30619
30783
|
const result = mapper[hash3];
|
|
30620
30784
|
if (!result) {
|
|
30621
|
-
if (hash3 ===
|
|
30785
|
+
if (hash3 === SYNC_QRL) {
|
|
30622
30786
|
return [hash3, ""];
|
|
30623
30787
|
}
|
|
30624
30788
|
const isRegistered = (_a = globalThis.__qwik_reg_symbols) == null ? void 0 : _a.has(hash3);
|
|
@@ -30681,19 +30845,6 @@ var getSymbolHash2 = (symbolName) => {
|
|
|
30681
30845
|
return symbolName;
|
|
30682
30846
|
};
|
|
30683
30847
|
|
|
30684
|
-
// packages/qwik/src/optimizer/src/versions.ts
|
|
30685
|
-
var versions2 = {
|
|
30686
|
-
qwik: globalThis.QWIK_VERSION
|
|
30687
|
-
};
|
|
30688
|
-
|
|
30689
|
-
// packages/qwik/src/optimizer/src/manifest.ts
|
|
30690
|
-
function getValidManifest(manifest) {
|
|
30691
|
-
if (manifest != null && manifest.mapping != null && typeof manifest.mapping === "object" && manifest.symbols != null && typeof manifest.symbols === "object" && manifest.bundles != null && typeof manifest.bundles === "object") {
|
|
30692
|
-
return manifest;
|
|
30693
|
-
}
|
|
30694
|
-
return void 0;
|
|
30695
|
-
}
|
|
30696
|
-
|
|
30697
30848
|
// packages/qwik/src/server/ssr-container.ts
|
|
30698
30849
|
var import_core6 = require("../core.cjs");
|
|
30699
30850
|
var import_build12 = require("@qwik.dev/core/build");
|
|
@@ -30714,7 +30865,8 @@ function prefetchUrlsEventScript(base, prefetchResources) {
|
|
|
30714
30865
|
bundles: flattenPrefetchResources(prefetchResources).map((u) => u.split("/").pop())
|
|
30715
30866
|
};
|
|
30716
30867
|
const args = JSON.stringify(["prefetch", base, ...data.bundles]);
|
|
30717
|
-
return `(
|
|
30868
|
+
return `document.dispatchEvent(new CustomEvent("qprefetch",{detail:${JSON.stringify(data)}}));
|
|
30869
|
+
(window.qwikPrefetchSW||(window.qwikPrefetchSW=[])).push(${args});`;
|
|
30718
30870
|
}
|
|
30719
30871
|
function flattenPrefetchResources(prefetchResources) {
|
|
30720
30872
|
const urls = [];
|
|
@@ -30905,6 +31057,9 @@ var SsrNode = class {
|
|
|
30905
31057
|
locals = null;
|
|
30906
31058
|
currentComponentNode;
|
|
30907
31059
|
childrenVNodeData = null;
|
|
31060
|
+
get [import_core4._EFFECT_BACK_REF]() {
|
|
31061
|
+
return this.getProp(QBackRefs);
|
|
31062
|
+
}
|
|
30908
31063
|
setProp(name, value) {
|
|
30909
31064
|
if (this.attrs === import_core4._EMPTY_ARRAY) {
|
|
30910
31065
|
this.attrs = [];
|
|
@@ -31012,14 +31167,12 @@ var SsrComponentFrame = class {
|
|
|
31012
31167
|
return QDefaultSlot;
|
|
31013
31168
|
}
|
|
31014
31169
|
hasSlot(slotName) {
|
|
31015
|
-
return
|
|
31170
|
+
return mapArray_has(this.slots, slotName, 0);
|
|
31016
31171
|
}
|
|
31017
31172
|
consumeChildrenForSlot(projectionNode, slotName) {
|
|
31018
31173
|
const children = mapApp_remove(this.slots, slotName, 0);
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
31022
|
-
}
|
|
31174
|
+
this.componentNode.setProp(slotName, projectionNode.id);
|
|
31175
|
+
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
31023
31176
|
return children;
|
|
31024
31177
|
}
|
|
31025
31178
|
releaseUnclaimedProjections(unclaimedProjections) {
|
|
@@ -31483,7 +31636,13 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
31483
31636
|
$noMoreRoots$ = false;
|
|
31484
31637
|
constructor(opts) {
|
|
31485
31638
|
super(
|
|
31486
|
-
() =>
|
|
31639
|
+
() => {
|
|
31640
|
+
try {
|
|
31641
|
+
return this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
31642
|
+
} catch (e) {
|
|
31643
|
+
this.handleError(e, null);
|
|
31644
|
+
}
|
|
31645
|
+
},
|
|
31487
31646
|
() => null,
|
|
31488
31647
|
opts.renderOptions.serverData ?? EMPTY_OBJ2,
|
|
31489
31648
|
opts.locale
|
|
@@ -31509,15 +31668,14 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
31509
31668
|
this.renderOptions = opts.renderOptions;
|
|
31510
31669
|
this.$processInjectionsFromManifest$();
|
|
31511
31670
|
}
|
|
31512
|
-
ensureProjectionResolved(
|
|
31671
|
+
ensureProjectionResolved(_host) {
|
|
31513
31672
|
}
|
|
31514
|
-
handleError(err, $host$) {
|
|
31673
|
+
handleError(err, _$host$) {
|
|
31515
31674
|
throw err;
|
|
31516
31675
|
}
|
|
31517
31676
|
async render(jsx4) {
|
|
31518
31677
|
this.openContainer();
|
|
31519
31678
|
await (0, import_core6._walkJSX)(this, jsx4, {
|
|
31520
|
-
allowPromises: true,
|
|
31521
31679
|
currentStyleScoped: null,
|
|
31522
31680
|
parentComponentFrame: this.getComponentFrame()
|
|
31523
31681
|
});
|
|
@@ -31919,9 +32077,6 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
31919
32077
|
case ELEMENT_PROPS:
|
|
31920
32078
|
write(VNodeDataChar.PROPS_CHAR);
|
|
31921
32079
|
break;
|
|
31922
|
-
case QSlotRef:
|
|
31923
|
-
write(VNodeDataChar.SLOT_REF_CHAR);
|
|
31924
|
-
break;
|
|
31925
32080
|
case ELEMENT_KEY:
|
|
31926
32081
|
write(VNodeDataChar.KEY_CHAR);
|
|
31927
32082
|
break;
|
|
@@ -31931,8 +32086,11 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
31931
32086
|
case ELEMENT_SEQ_IDX:
|
|
31932
32087
|
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
31933
32088
|
break;
|
|
31934
|
-
case
|
|
31935
|
-
write(VNodeDataChar.
|
|
32089
|
+
case QBackRefs:
|
|
32090
|
+
write(VNodeDataChar.BACK_REFS_CHAR);
|
|
32091
|
+
break;
|
|
32092
|
+
case QSlotParent:
|
|
32093
|
+
write(VNodeDataChar.SLOT_PARENT_CHAR);
|
|
31936
32094
|
break;
|
|
31937
32095
|
// Skipping `\` character for now because it is used for escaping.
|
|
31938
32096
|
case QCtxAttr:
|
|
@@ -32142,7 +32300,6 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
32142
32300
|
}
|
|
32143
32301
|
ssrComponentNode == null ? void 0 : ssrComponentNode.setProp(value, lastNode.id);
|
|
32144
32302
|
await (0, import_core6._walkJSX)(this, children, {
|
|
32145
|
-
allowPromises: true,
|
|
32146
32303
|
currentStyleScoped: scopedStyleId,
|
|
32147
32304
|
parentComponentFrame: null
|
|
32148
32305
|
});
|
|
@@ -32261,7 +32418,7 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
32261
32418
|
let styleScopedId = null;
|
|
32262
32419
|
if (isSSRUnsafeAttr(key)) {
|
|
32263
32420
|
if (import_build12.isDev) {
|
|
32264
|
-
throw qError(
|
|
32421
|
+
throw qError(49 /* unsafeAttr */);
|
|
32265
32422
|
}
|
|
32266
32423
|
continue;
|
|
32267
32424
|
}
|
|
@@ -32278,6 +32435,8 @@ var SSRContainer = class extends import_core6._SharedContainer {
|
|
|
32278
32435
|
} else if (typeof value === "function") {
|
|
32279
32436
|
value(new DomRef(lastNode));
|
|
32280
32437
|
continue;
|
|
32438
|
+
} else if (value == null) {
|
|
32439
|
+
continue;
|
|
32281
32440
|
} else {
|
|
32282
32441
|
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
32283
32442
|
}
|
|
@@ -32601,7 +32760,7 @@ async function ssrRenderToDom(jsx4, opts = {}) {
|
|
|
32601
32760
|
const platform = getPlatform();
|
|
32602
32761
|
try {
|
|
32603
32762
|
const jsxToRender = opts.raw ? jsx4 : [
|
|
32604
|
-
/* @__PURE__ */ (0, import_core7.jsx)("head", { children: /* @__PURE__ */ (0, import_core7.jsx)("title", { children:
|
|
32763
|
+
/* @__PURE__ */ (0, import_core7.jsx)("head", { children: /* @__PURE__ */ (0, import_core7.jsx)("title", { children: import_vitest3.expect.getState().testPath }) }),
|
|
32605
32764
|
/* @__PURE__ */ (0, import_core7.jsx)("body", { children: jsx4 })
|
|
32606
32765
|
];
|
|
32607
32766
|
const result = await renderToString(jsxToRender);
|
|
@@ -32646,7 +32805,7 @@ async function ssrRenderToDom(jsx4, opts = {}) {
|
|
|
32646
32805
|
let child = firstContainerChild;
|
|
32647
32806
|
let insertBefore = null;
|
|
32648
32807
|
while (child) {
|
|
32649
|
-
if (vnode_isElementVNode(child) && (vnode_getElementName(child) === "script" && vnode_getAttr(child, "type") === "qwik/state" || vnode_getElementName(child) === "q:template")) {
|
|
32808
|
+
if (vnode_isElementVNode(child) && (vnode_getElementName(child) === "script" && (vnode_getAttr(child, "type") === "qwik/state" || vnode_getAttr(child, "id") === "qwikloader") || vnode_getElementName(child) === "q:template")) {
|
|
32650
32809
|
insertBefore = child;
|
|
32651
32810
|
break;
|
|
32652
32811
|
}
|
|
@@ -32706,14 +32865,16 @@ function renderStyles(getStyles) {
|
|
|
32706
32865
|
console.log(START2 + key + ": " + END2 + value);
|
|
32707
32866
|
});
|
|
32708
32867
|
}
|
|
32709
|
-
async function rerenderComponent(element) {
|
|
32868
|
+
async function rerenderComponent(element, flush) {
|
|
32710
32869
|
const container = (0, import_core8._getDomContainer)(element);
|
|
32711
32870
|
const vElement = vnode_locate(container.rootVNode, element);
|
|
32712
32871
|
const host = getHostVNode(vElement);
|
|
32713
32872
|
const qrl2 = container.getHostProp(host, OnRenderProp);
|
|
32714
32873
|
const props = container.getHostProp(host, ELEMENT_PROPS);
|
|
32715
|
-
|
|
32716
|
-
|
|
32874
|
+
container.$scheduler$(6 /* COMPONENT */, host, qrl2, props);
|
|
32875
|
+
if (flush) {
|
|
32876
|
+
await getTestPlatform().flush();
|
|
32877
|
+
}
|
|
32717
32878
|
}
|
|
32718
32879
|
function getHostVNode(vElement) {
|
|
32719
32880
|
while (vElement != null) {
|