@qwik.dev/core 2.0.0-beta.37 → 2.0.0-beta.39
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/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +14 -5
- package/dist/core-internal.d.ts +397 -323
- package/dist/core.min.mjs +9 -8
- package/dist/core.mjs +1886 -1161
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4646 -4048
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +5 -3
- package/dist/optimizer.mjs +1676 -1722
- package/dist/preloader.mjs +1 -1
- package/dist/qwikloader.debug.js +1 -1
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +7 -0
- package/dist/server.mjs +75 -34
- package/dist/server.prod.mjs +392 -345
- package/dist/starters/adapters/bun/src/entry.bun.ts +35 -0
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +20 -0
- package/dist/starters/adapters/deno/src/entry.deno.ts +41 -0
- package/dist/starters/adapters/express/src/entry.express.tsx +20 -0
- package/dist/starters/adapters/fastify/package.json +2 -2
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +20 -0
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +10 -1
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +20 -0
- package/dist/starters/features/csr/package.json +1 -1
- package/dist/starters/features/drizzle/package.json +1 -1
- package/dist/starters/features/vitest/package.json +1 -1
- package/dist/testing/index.d.ts +40 -31
- package/dist/testing/index.mjs +1568 -942
- package/dist/testing/package.json +1 -1
- package/dist/worker/package.json +1 -1
- package/dist/worker/worker.shared.js +1 -1
- package/handlers.mjs +3 -0
- package/package.json +7 -7
- package/public.d.ts +3 -0
package/dist/testing/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/testing 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/testing 2.0.0-beta.39-dev+6fb620f
|
|
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
|
|
@@ -13,7 +13,11 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
13
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
14
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
15
|
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw mod = 0, e;
|
|
20
|
+
}
|
|
17
21
|
};
|
|
18
22
|
var __copyProps = (to, from, except, desc) => {
|
|
19
23
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -21426,7 +21430,7 @@ import { _isJSXNode, _isStringifiable } from "@qwik.dev/core/internal";
|
|
|
21426
21430
|
import { expect } from "vitest";
|
|
21427
21431
|
|
|
21428
21432
|
// packages/qwik/src/core/client/vnode-utils.ts
|
|
21429
|
-
import { isDev as
|
|
21433
|
+
import { isDev as isDev26 } from "@qwik.dev/core/build";
|
|
21430
21434
|
|
|
21431
21435
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
21432
21436
|
var qDev = globalThis.qDev !== false;
|
|
@@ -21619,8 +21623,8 @@ See https://qwik.dev/docs/core/tasks/#use-method-rules`,
|
|
|
21619
21623
|
// 27
|
|
21620
21624
|
"Cannot coerce a Signal, use `.value` instead",
|
|
21621
21625
|
// 28
|
|
21622
|
-
"
|
|
21623
|
-
// 29
|
|
21626
|
+
"",
|
|
21627
|
+
// 29 (cleared: useComputed$ now supports async functions)
|
|
21624
21628
|
`===
|
|
21625
21629
|
Qwik version {{0}} already imported while importing {{1}}.
|
|
21626
21630
|
This can lead to issues due to duplicated shared structures.
|
|
@@ -21636,8 +21640,14 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
|
|
|
21636
21640
|
// 33
|
|
21637
21641
|
"Serialization Error: Cannot serialize function: {{0}}",
|
|
21638
21642
|
// 34
|
|
21639
|
-
"Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value."
|
|
21643
|
+
"Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value.",
|
|
21640
21644
|
// 35
|
|
21645
|
+
"Invalid element name for SSR {{0}}",
|
|
21646
|
+
// 36
|
|
21647
|
+
"Invalid serialized Promise dependency",
|
|
21648
|
+
// 37
|
|
21649
|
+
"Invalid serialized Uint8Array payload"
|
|
21650
|
+
// 38
|
|
21641
21651
|
];
|
|
21642
21652
|
let text = MAP[code2] ?? "";
|
|
21643
21653
|
if (parts.length) {
|
|
@@ -21722,6 +21732,7 @@ var VirtualTypeName = {
|
|
|
21722
21732
|
|
|
21723
21733
|
// packages/qwik/src/core/shared/utils/markers.ts
|
|
21724
21734
|
var OnRenderProp = "q:renderFn";
|
|
21735
|
+
var QComponentHash = "q:componentHash";
|
|
21725
21736
|
var QTargetElement = "q:targetEl";
|
|
21726
21737
|
var ComponentStylesPrefixContent = "\u26A1\uFE0F";
|
|
21727
21738
|
var QSlot = "q:slot";
|
|
@@ -21750,13 +21761,13 @@ var QBaseAttr = "q:base";
|
|
|
21750
21761
|
var QLocaleAttr = "q:locale";
|
|
21751
21762
|
var QManifestHashAttr = "q:manifest-hash";
|
|
21752
21763
|
var QInstanceAttr = "q:instance";
|
|
21764
|
+
var QStatePrewarmAttr = "q:prewarm";
|
|
21753
21765
|
var QContainerIsland = "q:container-island";
|
|
21754
21766
|
var QContainerIslandEnd = "/" + QContainerIsland;
|
|
21755
21767
|
var QIgnore = "q:ignore";
|
|
21756
21768
|
var QIgnoreEnd = "/" + QIgnore;
|
|
21757
21769
|
var QContainerAttr = "q:container";
|
|
21758
21770
|
var QContainerAttrEnd = "/" + QContainerAttr;
|
|
21759
|
-
var QCursorBoundary = "q:cursorBoundary";
|
|
21760
21771
|
var QTemplate = "q:template";
|
|
21761
21772
|
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
21762
21773
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
@@ -21779,6 +21790,7 @@ var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
|
21779
21790
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
21780
21791
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
21781
21792
|
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
21793
|
+
var QCursorBoundary = NON_SERIALIZABLE_MARKER_PREFIX + "cursorBoundary";
|
|
21782
21794
|
var NEAREST_CURSOR_BOUNDARY = NON_SERIALIZABLE_MARKER_PREFIX + "nearestCursorBoundary";
|
|
21783
21795
|
var Q_PROPS_SEPARATOR = ":";
|
|
21784
21796
|
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
@@ -21934,7 +21946,7 @@ function retryOnPromise(fn, onError = justThrow) {
|
|
|
21934
21946
|
}
|
|
21935
21947
|
|
|
21936
21948
|
// packages/qwik/src/core/client/dom-container.ts
|
|
21937
|
-
import { isDev as
|
|
21949
|
+
import { isDev as isDev23 } from "@qwik.dev/core/build";
|
|
21938
21950
|
|
|
21939
21951
|
// packages/qwik/src/core/shared/utils/event-names.ts
|
|
21940
21952
|
var EVENT_SUFFIX = "$";
|
|
@@ -22016,10 +22028,10 @@ var isRecoverable = (err) => {
|
|
|
22016
22028
|
var NEEDS_COMPUTATION = /* @__PURE__ */ Symbol("invalid");
|
|
22017
22029
|
var EffectSubscription = class {
|
|
22018
22030
|
constructor(consumer, property, backRef = null, data = null) {
|
|
22019
|
-
this
|
|
22020
|
-
this
|
|
22021
|
-
this
|
|
22022
|
-
this
|
|
22031
|
+
__publicField(this, "consumer", consumer);
|
|
22032
|
+
__publicField(this, "property", property);
|
|
22033
|
+
__publicField(this, "backRef", backRef);
|
|
22034
|
+
__publicField(this, "data", data);
|
|
22023
22035
|
}
|
|
22024
22036
|
};
|
|
22025
22037
|
var STORE_TARGET = /* @__PURE__ */ Symbol("store.target");
|
|
@@ -22040,7 +22052,7 @@ Object.freeze(EMPTY_ARRAY);
|
|
|
22040
22052
|
Object.freeze(EMPTY_OBJ);
|
|
22041
22053
|
|
|
22042
22054
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
22043
|
-
import { isBrowser as isBrowser3, isDev as
|
|
22055
|
+
import { isBrowser as isBrowser3, isDev as isDev22, isServer as isServer10 } from "@qwik.dev/core/build";
|
|
22044
22056
|
|
|
22045
22057
|
// packages/qwik/src/core/shared/qrl/qrl-class-dev.ts
|
|
22046
22058
|
import { isBrowser } from "@qwik.dev/core/build";
|
|
@@ -22051,7 +22063,7 @@ var initLazyRefDev = (lazy) => {
|
|
|
22051
22063
|
}
|
|
22052
22064
|
};
|
|
22053
22065
|
var initQrlClassDev = (lazy, captures, qrl) => {
|
|
22054
|
-
if (captures
|
|
22066
|
+
if (Array.isArray(captures)) {
|
|
22055
22067
|
for (let i2 = 0; i2 < captures.length; i2++) {
|
|
22056
22068
|
const item = captures[i2];
|
|
22057
22069
|
verifySerializable(item, "Captured variable in the closure can not be serialized");
|
|
@@ -22183,16 +22195,24 @@ function qrlToString(serializationContext, qrl, raw) {
|
|
|
22183
22195
|
symbol = String(serializationContext.$addSyncFn$(null, 0, fn));
|
|
22184
22196
|
}
|
|
22185
22197
|
const captures = qrl.getCaptured();
|
|
22186
|
-
let
|
|
22198
|
+
let captureDeltas = null;
|
|
22187
22199
|
if (captures && captures.length > 0) {
|
|
22188
|
-
|
|
22200
|
+
let previous = 0;
|
|
22201
|
+
let output = "";
|
|
22202
|
+
for (let i2 = 0; i2 < captures.length; i2++) {
|
|
22203
|
+
const captureId = serializationContext.$addRoot$(captures[i2]);
|
|
22204
|
+
const delta = captureId - previous;
|
|
22205
|
+
previous = captureId;
|
|
22206
|
+
output += (i2 === 0 ? "" : " ") + delta;
|
|
22207
|
+
}
|
|
22208
|
+
captureDeltas = output;
|
|
22189
22209
|
}
|
|
22190
22210
|
if (raw) {
|
|
22191
|
-
return [chunk, symbol,
|
|
22211
|
+
return [chunk, symbol, captureDeltas];
|
|
22192
22212
|
}
|
|
22193
22213
|
let qrlStringInline = `${chunk}#${symbol}`;
|
|
22194
|
-
if (
|
|
22195
|
-
qrlStringInline += `#${
|
|
22214
|
+
if (captureDeltas) {
|
|
22215
|
+
qrlStringInline += `#${captureDeltas}`;
|
|
22196
22216
|
}
|
|
22197
22217
|
return qrlStringInline;
|
|
22198
22218
|
}
|
|
@@ -22209,8 +22229,12 @@ function createQRLWithBackChannel(chunk, symbol, captures, container) {
|
|
|
22209
22229
|
return createQRL(chunk, symbol, null, qrlImporter, captures, container);
|
|
22210
22230
|
}
|
|
22211
22231
|
function parseQRL(qrl, container) {
|
|
22212
|
-
const
|
|
22213
|
-
|
|
22232
|
+
const firstHash = qrl.indexOf("#");
|
|
22233
|
+
const secondHash = qrl.indexOf("#", firstHash + 1);
|
|
22234
|
+
const chunk = qrl.slice(0, firstHash);
|
|
22235
|
+
const symbol = secondHash === -1 ? qrl.slice(firstHash + 1) : qrl.slice(firstHash + 1, secondHash);
|
|
22236
|
+
const captures = secondHash !== -1 && secondHash + 1 < qrl.length ? qrl.slice(secondHash + 1) : null;
|
|
22237
|
+
return createQRLWithBackChannel(chunk, symbol, captures, container);
|
|
22214
22238
|
}
|
|
22215
22239
|
var QRL_RUNTIME_CHUNK = "mock-chunk";
|
|
22216
22240
|
|
|
@@ -22220,7 +22244,16 @@ function runEventHandlerQRL(handler, event, element, ctx) {
|
|
|
22220
22244
|
return;
|
|
22221
22245
|
}
|
|
22222
22246
|
if (!ctx) {
|
|
22223
|
-
|
|
22247
|
+
const container2 = getDomContainer(element);
|
|
22248
|
+
return whenContainerDataReady(
|
|
22249
|
+
container2,
|
|
22250
|
+
() => runEventHandlerQRL(
|
|
22251
|
+
handler,
|
|
22252
|
+
event,
|
|
22253
|
+
element,
|
|
22254
|
+
newInvokeContextFromDOM(event, element, container2)
|
|
22255
|
+
)
|
|
22256
|
+
);
|
|
22224
22257
|
}
|
|
22225
22258
|
const container = ctx.$container$;
|
|
22226
22259
|
const hostElement = ctx.$hostElement$;
|
|
@@ -22435,7 +22468,7 @@ function createPropsProxy(owner) {
|
|
|
22435
22468
|
}
|
|
22436
22469
|
var PropsProxyHandler = class {
|
|
22437
22470
|
constructor(owner) {
|
|
22438
|
-
this
|
|
22471
|
+
__publicField(this, "owner", owner);
|
|
22439
22472
|
__publicField(this, "$effects$");
|
|
22440
22473
|
__publicField(this, "$container$", null);
|
|
22441
22474
|
}
|
|
@@ -22464,7 +22497,7 @@ var PropsProxyHandler = class {
|
|
|
22464
22497
|
addPropsProxyEffect(this, prop);
|
|
22465
22498
|
}
|
|
22466
22499
|
}
|
|
22467
|
-
return value instanceof WrappedSignalImpl
|
|
22500
|
+
return value instanceof WrappedSignalImpl ? value.value : value;
|
|
22468
22501
|
}
|
|
22469
22502
|
set(_, prop, value) {
|
|
22470
22503
|
if (prop === _OWNER) {
|
|
@@ -22605,8 +22638,8 @@ var isPropsProxy = (obj) => {
|
|
|
22605
22638
|
return obj && _VAR_PROPS in obj;
|
|
22606
22639
|
};
|
|
22607
22640
|
|
|
22608
|
-
// packages/qwik/src/core/reactive-primitives/impl/
|
|
22609
|
-
import { isBrowser as isBrowser2, isDev as
|
|
22641
|
+
// packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
|
|
22642
|
+
import { isBrowser as isBrowser2, isDev as isDev10, isServer as isServer5 } from "@qwik.dev/core/build";
|
|
22610
22643
|
|
|
22611
22644
|
// packages/qwik/src/core/reactive-primitives/subscriber.ts
|
|
22612
22645
|
import { isServer as isServer4 } from "@qwik.dev/core/build";
|
|
@@ -22692,89 +22725,11 @@ var cleanupFn = (target, handleError) => {
|
|
|
22692
22725
|
};
|
|
22693
22726
|
|
|
22694
22727
|
// packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
|
|
22695
|
-
import { isDev as isDev10 } from "@qwik.dev/core/build";
|
|
22696
22728
|
var DEBUG2 = false;
|
|
22697
22729
|
var log2 = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToString));
|
|
22698
|
-
var
|
|
22699
|
-
var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
|
|
22700
|
-
constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */) {
|
|
22701
|
-
super(container || tryGetInvokeContext()?.$container$, NEEDS_COMPUTATION);
|
|
22702
|
-
/**
|
|
22703
|
-
* The compute function is stored here.
|
|
22704
|
-
*
|
|
22705
|
-
* The computed functions must be executed synchronously (because of this we need to eagerly
|
|
22706
|
-
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
|
|
22707
|
-
*/
|
|
22708
|
-
__publicField(this, "$computeQrl$");
|
|
22709
|
-
__publicField(this, "$flags$");
|
|
22710
|
-
__publicField(this, _a2);
|
|
22711
|
-
this.$computeQrl$ = fn;
|
|
22712
|
-
this.$flags$ = flags;
|
|
22713
|
-
}
|
|
22714
|
-
invalidate() {
|
|
22715
|
-
this.$flags$ |= 1 /* INVALID */;
|
|
22716
|
-
const ctx = newInvokeContext();
|
|
22717
|
-
ctx.$container$ = this.$container$ || void 0;
|
|
22718
|
-
const running = retryOnPromise(invokeApply.bind(this, ctx, this.$computeIfNeeded$));
|
|
22719
|
-
if (running) {
|
|
22720
|
-
running.catch((err) => {
|
|
22721
|
-
if (this.$container$) {
|
|
22722
|
-
this.$container$.handleError(err, null);
|
|
22723
|
-
} else {
|
|
22724
|
-
console.error("Error during computation", err);
|
|
22725
|
-
}
|
|
22726
|
-
});
|
|
22727
|
-
}
|
|
22728
|
-
}
|
|
22729
|
-
get untrackedValue() {
|
|
22730
|
-
this.$computeIfNeeded$();
|
|
22731
|
-
isDev10 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
22732
|
-
return this.$untrackedValue$;
|
|
22733
|
-
}
|
|
22734
|
-
set untrackedValue(value) {
|
|
22735
|
-
this.$untrackedValue$ = value;
|
|
22736
|
-
}
|
|
22737
|
-
$computeIfNeeded$() {
|
|
22738
|
-
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
22739
|
-
return;
|
|
22740
|
-
}
|
|
22741
|
-
const computeQrl = this.$computeQrl$;
|
|
22742
|
-
throwIfQRLNotResolved(computeQrl);
|
|
22743
|
-
const ctx = tryGetInvokeContext();
|
|
22744
|
-
const previousEffectSubscription = ctx?.$effectSubscriber$;
|
|
22745
|
-
if (ctx) {
|
|
22746
|
-
const effectSubscriber = getSubscriber(this, "." /* VNODE */);
|
|
22747
|
-
clearEffectSubscription(this.$container$, effectSubscriber);
|
|
22748
|
-
ctx.$effectSubscriber$ = effectSubscriber;
|
|
22749
|
-
}
|
|
22750
|
-
try {
|
|
22751
|
-
const untrackedValue = computeQrl.getFn(ctx)();
|
|
22752
|
-
if (isPromise(untrackedValue)) {
|
|
22753
|
-
throw qError(29 /* computedNotSync */, [
|
|
22754
|
-
computeQrl.dev ? computeQrl.dev.file : "",
|
|
22755
|
-
computeQrl.$hash$
|
|
22756
|
-
]);
|
|
22757
|
-
}
|
|
22758
|
-
DEBUG2 && log2("Signal.$compute$", untrackedValue);
|
|
22759
|
-
this.$flags$ &= ~1 /* INVALID */;
|
|
22760
|
-
super.value = untrackedValue;
|
|
22761
|
-
} finally {
|
|
22762
|
-
if (ctx) {
|
|
22763
|
-
ctx.$effectSubscriber$ = previousEffectSubscription;
|
|
22764
|
-
}
|
|
22765
|
-
}
|
|
22766
|
-
}
|
|
22767
|
-
};
|
|
22768
|
-
|
|
22769
|
-
// packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
|
|
22770
|
-
var DEBUG3 = false;
|
|
22771
|
-
var log3 = (...args) => (
|
|
22772
|
-
// eslint-disable-next-line no-console
|
|
22773
|
-
console.log("ASYNC COMPUTED SIGNAL", ...args.map(qwikDebugToString))
|
|
22774
|
-
);
|
|
22775
|
-
var AsyncJob = class {
|
|
22730
|
+
var Job = class {
|
|
22776
22731
|
constructor($signal$, info, $infoVersion$) {
|
|
22777
|
-
this
|
|
22732
|
+
__publicField(this, "$signal$", $signal$);
|
|
22778
22733
|
/** First holds the compute promise and then the cleanup promise */
|
|
22779
22734
|
__publicField(this, "$promise$", null);
|
|
22780
22735
|
__publicField(this, "$cleanupRequested$", false);
|
|
@@ -22792,8 +22747,8 @@ var AsyncJob = class {
|
|
|
22792
22747
|
}
|
|
22793
22748
|
/** Backward compatible cache method for resource */
|
|
22794
22749
|
cache() {
|
|
22795
|
-
|
|
22796
|
-
"useResource cache() method does not do anything. Use `
|
|
22750
|
+
isDev10 && console.error(
|
|
22751
|
+
"useResource cache() method does not do anything. Use `useComputed$` instead of `useResource$`; for polling use the `usePoll` hook from `@qwik.dev/utils`."
|
|
22797
22752
|
);
|
|
22798
22753
|
}
|
|
22799
22754
|
get previous() {
|
|
@@ -22808,74 +22763,70 @@ var AsyncJob = class {
|
|
|
22808
22763
|
}
|
|
22809
22764
|
}
|
|
22810
22765
|
};
|
|
22811
|
-
var
|
|
22812
|
-
var
|
|
22766
|
+
var _a2, _b;
|
|
22767
|
+
var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
|
|
22813
22768
|
constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */, options) {
|
|
22814
|
-
super(container
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22769
|
+
super(container || tryGetInvokeContext()?.$container$, NEEDS_COMPUTATION);
|
|
22770
|
+
/**
|
|
22771
|
+
* The compute function is stored here.
|
|
22772
|
+
*
|
|
22773
|
+
* Sync computed functions must be executed synchronously (because of this we need to eagerly
|
|
22774
|
+
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous).
|
|
22775
|
+
*/
|
|
22776
|
+
__publicField(this, "$computeQrl$");
|
|
22777
|
+
__publicField(this, "$flags$");
|
|
22778
|
+
__publicField(this, _a2);
|
|
22779
|
+
this.$computeQrl$ = fn;
|
|
22780
|
+
this.$flags$ = flags;
|
|
22819
22781
|
if (!options) {
|
|
22820
22782
|
return;
|
|
22821
22783
|
}
|
|
22822
22784
|
const initial = options.initial;
|
|
22823
22785
|
if (initial !== void 0) {
|
|
22824
|
-
|
|
22825
|
-
this.$untrackedValue$ = initialValue;
|
|
22786
|
+
this.$untrackedValue$ = typeof initial === "function" ? initial() : initial;
|
|
22826
22787
|
}
|
|
22827
22788
|
const concurrency = options.concurrency;
|
|
22828
22789
|
if (concurrency !== void 0 && concurrency >= 0 && concurrency !== 1) {
|
|
22829
22790
|
this.$concurrency$ = concurrency;
|
|
22830
22791
|
this.$jobs$ = [];
|
|
22831
22792
|
}
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
this.$timeoutMs$ = timeout;
|
|
22793
|
+
if (options.timeout) {
|
|
22794
|
+
this.$timeoutMs$ = options.timeout;
|
|
22835
22795
|
}
|
|
22836
22796
|
if (options.eagerCleanup) {
|
|
22837
22797
|
this.$flags$ |= 32 /* EAGER_CLEANUP */;
|
|
22838
22798
|
}
|
|
22839
22799
|
if (options.clientOnly) {
|
|
22840
|
-
this.$flags$ |= 64 /* CLIENT_ONLY */;
|
|
22841
|
-
}
|
|
22842
|
-
if (options.allowStale === false) {
|
|
22843
|
-
if (isDev11 && initial !== void 0) {
|
|
22844
|
-
throw new Error(
|
|
22845
|
-
"allowStale: false and initial cannot be used together. allowStale: false clears the value on invalidation, which conflicts with providing an initial value."
|
|
22846
|
-
);
|
|
22847
|
-
}
|
|
22848
|
-
this.$flags$ |= 128 /* CLEAR_ON_INVALIDATE */;
|
|
22849
|
-
}
|
|
22850
|
-
const expires = options.expires ?? (options.interval ? Math.abs(options.interval) : void 0);
|
|
22851
|
-
if (expires) {
|
|
22852
|
-
this.expires = expires;
|
|
22853
|
-
}
|
|
22854
|
-
if (options.poll === false || options.interval !== void 0 && options.interval < 0) {
|
|
22855
|
-
this.$flags$ |= 256 /* NO_POLL */;
|
|
22800
|
+
this.$flags$ |= 64 /* CLIENT_ONLY */ | 512 /* ASYNC_MODE */;
|
|
22856
22801
|
}
|
|
22857
22802
|
}
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22803
|
+
/** Clear the value so readers see the loading state, then recompute. */
|
|
22804
|
+
clear() {
|
|
22805
|
+
this.$untrackedValue$ = NEEDS_COMPUTATION;
|
|
22806
|
+
this.invalidate();
|
|
22807
|
+
}
|
|
22808
|
+
invalidate(info) {
|
|
22809
|
+
if (arguments.length > 0) {
|
|
22810
|
+
this.$info$ = info;
|
|
22811
|
+
this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
|
|
22867
22812
|
}
|
|
22868
|
-
if (this.$
|
|
22869
|
-
|
|
22870
|
-
|
|
22813
|
+
if (this.$flags$ & 512 /* ASYNC_MODE */) {
|
|
22814
|
+
this.$setInvalid$(true);
|
|
22815
|
+
return;
|
|
22871
22816
|
}
|
|
22872
|
-
|
|
22873
|
-
|
|
22817
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
22818
|
+
const ctx = newInvokeContext();
|
|
22819
|
+
ctx.$container$ = this.$container$ || void 0;
|
|
22820
|
+
const running = retryOnPromise(invokeApply.bind(this, ctx, this.$computeIfNeeded$));
|
|
22821
|
+
if (isPromise(running)) {
|
|
22822
|
+
running.catch((err) => {
|
|
22823
|
+
if (this.$container$) {
|
|
22824
|
+
this.$container$.handleError(err, null);
|
|
22825
|
+
} else {
|
|
22826
|
+
console.error("Error during computation", err);
|
|
22827
|
+
}
|
|
22828
|
+
});
|
|
22874
22829
|
}
|
|
22875
|
-
return this.$untrackedValue$;
|
|
22876
|
-
}
|
|
22877
|
-
set untrackedValue(value) {
|
|
22878
|
-
this.$untrackedValue$ = value;
|
|
22879
22830
|
}
|
|
22880
22831
|
/**
|
|
22881
22832
|
* Read the value, subscribing if in a tracking context. Triggers computation if needed.
|
|
@@ -22893,32 +22844,60 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
22893
22844
|
}
|
|
22894
22845
|
set value(value) {
|
|
22895
22846
|
this.$flags$ &= ~1 /* INVALID */;
|
|
22896
|
-
this.untrackedLoading = false;
|
|
22897
22847
|
this.untrackedError = void 0;
|
|
22898
|
-
this.$
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22848
|
+
if (this.$flags$ & 512 /* ASYNC_MODE */) {
|
|
22849
|
+
this.untrackedPending = false;
|
|
22850
|
+
this.$info$ = void 0;
|
|
22851
|
+
if (this.$jobs$) {
|
|
22852
|
+
for (let i2 = 0; i2 < this.$jobs$.length; i2++) {
|
|
22853
|
+
this.$jobs$[i2].$canWrite$ = false;
|
|
22854
|
+
}
|
|
22855
|
+
} else if (this.$current$) {
|
|
22856
|
+
this.$current$.$canWrite$ = false;
|
|
22902
22857
|
}
|
|
22903
|
-
|
|
22904
|
-
|
|
22858
|
+
super.value = value;
|
|
22859
|
+
return;
|
|
22905
22860
|
}
|
|
22906
|
-
this.$clearNextPoll$();
|
|
22907
22861
|
super.value = value;
|
|
22908
|
-
|
|
22862
|
+
}
|
|
22863
|
+
get untrackedValue() {
|
|
22864
|
+
this.$computeIfNeeded$();
|
|
22865
|
+
if (this.$current$?.$promise$) {
|
|
22866
|
+
if (this.$untrackedValue$ === NEEDS_COMPUTATION || (qTest ? isServerPlatform() : isServer5)) {
|
|
22867
|
+
DEBUG2 && log2("Throwing promise while computing initial value", this);
|
|
22868
|
+
throw this.$current$?.$promise$;
|
|
22869
|
+
}
|
|
22870
|
+
DEBUG2 && log2("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
|
|
22871
|
+
return this.$untrackedValue$;
|
|
22872
|
+
}
|
|
22873
|
+
if (this.$untrackedError$) {
|
|
22874
|
+
DEBUG2 && log2("Throwing error while reading value", this);
|
|
22875
|
+
throw this.$untrackedError$;
|
|
22876
|
+
}
|
|
22877
|
+
if ((qTest ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */ && this.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
22878
|
+
throw qError(35 /* asyncClientOnlyValueDuringSSR */);
|
|
22879
|
+
}
|
|
22880
|
+
isDev10 && !(this.$flags$ & 512 /* ASYNC_MODE */) && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
22881
|
+
return this.$untrackedValue$;
|
|
22882
|
+
}
|
|
22883
|
+
set untrackedValue(value) {
|
|
22884
|
+
this.$untrackedValue$ = value;
|
|
22909
22885
|
}
|
|
22910
22886
|
/**
|
|
22911
22887
|
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
22912
|
-
* has resolved or rejected.
|
|
22888
|
+
* has resolved or rejected (or the compute function is synchronous).
|
|
22913
22889
|
*
|
|
22914
|
-
* Accessing
|
|
22915
|
-
*
|
|
22890
|
+
* Accessing `.pending` will trigger computation if needed, since it's often used like
|
|
22891
|
+
*
|
|
22892
|
+
* ```ts
|
|
22893
|
+
* signal.pending ? <Loading /> : signal.value
|
|
22894
|
+
* ```
|
|
22916
22895
|
*/
|
|
22917
|
-
get
|
|
22918
|
-
const val = this.
|
|
22896
|
+
get pending() {
|
|
22897
|
+
const val = this.untrackedPending;
|
|
22919
22898
|
const ctx = tryGetInvokeContext();
|
|
22920
22899
|
if (ctx && (this.$container$ || (this.$container$ = ctx.$container$ || null))) {
|
|
22921
|
-
|
|
22900
|
+
isDev10 && assertTrue(
|
|
22922
22901
|
!ctx.$container$ || ctx.$container$ === this.$container$,
|
|
22923
22902
|
"Do not use signals across containers"
|
|
22924
22903
|
);
|
|
@@ -22931,27 +22910,46 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
22931
22910
|
}
|
|
22932
22911
|
return val;
|
|
22933
22912
|
}
|
|
22934
|
-
set
|
|
22935
|
-
if (value !== this.$
|
|
22936
|
-
this.$
|
|
22937
|
-
|
|
22913
|
+
set untrackedPending(value) {
|
|
22914
|
+
if (value !== !!this.$untrackedPending$) {
|
|
22915
|
+
this.$untrackedPending$ = value;
|
|
22916
|
+
DEBUG2 && log2("Set untrackedPending", value);
|
|
22938
22917
|
scheduleEffects(this.$container$, this, this.$loadingEffects$);
|
|
22939
22918
|
}
|
|
22940
22919
|
}
|
|
22941
|
-
get
|
|
22920
|
+
get untrackedPending() {
|
|
22942
22921
|
this.$computeIfNeeded$();
|
|
22943
22922
|
if ((qTest ? isServerPlatform() : isServer5) && this.$current$?.$promise$) {
|
|
22944
|
-
|
|
22923
|
+
DEBUG2 && log2("Throwing loading promise for SSR");
|
|
22945
22924
|
throw this.$current$?.$promise$;
|
|
22946
22925
|
}
|
|
22947
|
-
return this.$
|
|
22926
|
+
return !!this.$untrackedPending$;
|
|
22948
22927
|
}
|
|
22949
|
-
/**
|
|
22928
|
+
/** @deprecated Use `pending` instead */
|
|
22929
|
+
get loading() {
|
|
22930
|
+
return this.pending;
|
|
22931
|
+
}
|
|
22932
|
+
/** @deprecated Use `untrackedPending` instead */
|
|
22933
|
+
get untrackedLoading() {
|
|
22934
|
+
return this.untrackedPending;
|
|
22935
|
+
}
|
|
22936
|
+
set untrackedLoading(value) {
|
|
22937
|
+
this.untrackedPending = value;
|
|
22938
|
+
}
|
|
22939
|
+
/**
|
|
22940
|
+
* The error the compute function threw or rejected with.
|
|
22941
|
+
*
|
|
22942
|
+
* Accessing .error will trigger computation if needed, since it's often used like
|
|
22943
|
+
*
|
|
22944
|
+
* ```ts
|
|
22945
|
+
* signal.error ? <Failed /> : signal.value
|
|
22946
|
+
* ```
|
|
22947
|
+
*/
|
|
22950
22948
|
get error() {
|
|
22951
22949
|
const val = this.untrackedError;
|
|
22952
22950
|
const ctx = tryGetInvokeContext();
|
|
22953
22951
|
if (ctx && (this.$container$ || (this.$container$ = ctx.$container$ || null))) {
|
|
22954
|
-
|
|
22952
|
+
isDev10 && assertTrue(
|
|
22955
22953
|
!ctx.$container$ || ctx.$container$ === this.$container$,
|
|
22956
22954
|
"Do not use signals across containers"
|
|
22957
22955
|
);
|
|
@@ -22971,59 +22969,14 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
22971
22969
|
}
|
|
22972
22970
|
}
|
|
22973
22971
|
get untrackedError() {
|
|
22974
|
-
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
return this.$expires$ || 0;
|
|
22978
|
-
}
|
|
22979
|
-
set expires(value) {
|
|
22980
|
-
this.$clearNextPoll$();
|
|
22981
|
-
this.$expires$ = value;
|
|
22982
|
-
if (this.$expires$ && this.$hasSubscribers$()) {
|
|
22983
|
-
this.$scheduleNextPoll$();
|
|
22984
|
-
}
|
|
22985
|
-
}
|
|
22986
|
-
get poll() {
|
|
22987
|
-
return !(this.$flags$ & 256 /* NO_POLL */);
|
|
22988
|
-
}
|
|
22989
|
-
set poll(value) {
|
|
22990
|
-
if (value) {
|
|
22991
|
-
this.$flags$ &= ~256 /* NO_POLL */;
|
|
22992
|
-
} else {
|
|
22993
|
-
this.$flags$ |= 256 /* NO_POLL */;
|
|
22994
|
-
}
|
|
22995
|
-
if (this.$expires$ && this.$hasSubscribers$()) {
|
|
22996
|
-
this.$clearNextPoll$();
|
|
22997
|
-
this.$scheduleNextPoll$();
|
|
22998
|
-
}
|
|
22999
|
-
}
|
|
23000
|
-
/** @deprecated Use `expires` and `poll` instead. */
|
|
23001
|
-
get interval() {
|
|
23002
|
-
const expires = this.$expires$ || 0;
|
|
23003
|
-
return this.$flags$ & 256 /* NO_POLL */ ? -expires : expires;
|
|
23004
|
-
}
|
|
23005
|
-
set interval(value) {
|
|
23006
|
-
if (value < 0) {
|
|
23007
|
-
this.$flags$ |= 256 /* NO_POLL */;
|
|
23008
|
-
} else {
|
|
23009
|
-
this.$flags$ &= ~256 /* NO_POLL */;
|
|
23010
|
-
}
|
|
23011
|
-
this.expires = Math.abs(value);
|
|
23012
|
-
}
|
|
23013
|
-
/** Invalidates the signal, causing it to re-compute its value. */
|
|
23014
|
-
async invalidate(info) {
|
|
23015
|
-
if (arguments.length > 0) {
|
|
23016
|
-
this.$info$ = info;
|
|
23017
|
-
this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
|
|
22972
|
+
this.$computeIfNeeded$();
|
|
22973
|
+
if ((qTest ? isServerPlatform() : isServer5) && this.$current$?.$promise$) {
|
|
22974
|
+
throw this.$current$?.$promise$;
|
|
23018
22975
|
}
|
|
23019
|
-
|
|
22976
|
+
return this.$untrackedError$;
|
|
23020
22977
|
}
|
|
23021
|
-
$setInvalid$(allowRecalc
|
|
22978
|
+
$setInvalid$(allowRecalc) {
|
|
23022
22979
|
this.$flags$ |= 1 /* INVALID */;
|
|
23023
|
-
this.$clearNextPoll$();
|
|
23024
|
-
if (mustClear) {
|
|
23025
|
-
this.$untrackedValue$ = NEEDS_COMPUTATION;
|
|
23026
|
-
}
|
|
23027
22980
|
if (allowRecalc && (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size)) {
|
|
23028
22981
|
Promise.resolve().then(() => this.$computeIfNeeded$());
|
|
23029
22982
|
}
|
|
@@ -23060,12 +23013,84 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23060
23013
|
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
23061
23014
|
return;
|
|
23062
23015
|
}
|
|
23016
|
+
if (this.$flags$ & 512 /* ASYNC_MODE */) {
|
|
23017
|
+
return this.$computeAsync$();
|
|
23018
|
+
}
|
|
23019
|
+
const computeQrl = this.$computeQrl$;
|
|
23020
|
+
throwIfQRLNotResolved(computeQrl);
|
|
23021
|
+
const prevJob = this.$current$;
|
|
23022
|
+
if (prevJob && !prevJob.$cleanupRequested$) {
|
|
23023
|
+
prevJob.$cleanupRequested$ = true;
|
|
23024
|
+
prevJob.$abortController$?.abort();
|
|
23025
|
+
this.$runCleanupCallbacks$(prevJob);
|
|
23026
|
+
}
|
|
23027
|
+
const running = new Job(this, this.$info$, this.$infoVersion$);
|
|
23028
|
+
this.$current$ = running;
|
|
23029
|
+
let result;
|
|
23030
|
+
try {
|
|
23031
|
+
result = this.$invokeComputeFn$(computeQrl.resolved, running);
|
|
23032
|
+
} catch (err) {
|
|
23033
|
+
if (isPromise(err)) {
|
|
23034
|
+
throw err;
|
|
23035
|
+
}
|
|
23036
|
+
if (running.$infoVersion$ === this.$infoVersion$) {
|
|
23037
|
+
this.$info$ = void 0;
|
|
23038
|
+
}
|
|
23039
|
+
this.$flags$ &= ~1 /* INVALID */;
|
|
23040
|
+
this.$setError$(running, err);
|
|
23041
|
+
return;
|
|
23042
|
+
}
|
|
23043
|
+
if (isPromise(result)) {
|
|
23044
|
+
this.$flags$ |= 512 /* ASYNC_MODE */;
|
|
23045
|
+
this.$flags$ &= ~1 /* INVALID */;
|
|
23046
|
+
let first = result;
|
|
23047
|
+
const compute = () => {
|
|
23048
|
+
const r = first ?? this.$invokeComputeFn$(this.$computeQrl$.resolved, running);
|
|
23049
|
+
first = void 0;
|
|
23050
|
+
return r;
|
|
23051
|
+
};
|
|
23052
|
+
running.$promise$ = this.$settleComputation$(running, () => retryOnPromise(compute));
|
|
23053
|
+
return;
|
|
23054
|
+
}
|
|
23055
|
+
DEBUG2 && log2("Signal.$compute$", result);
|
|
23056
|
+
if (running.$infoVersion$ === this.$infoVersion$) {
|
|
23057
|
+
this.$info$ = void 0;
|
|
23058
|
+
}
|
|
23059
|
+
this.$flags$ &= ~1 /* INVALID */;
|
|
23060
|
+
this.untrackedError = void 0;
|
|
23061
|
+
super.value = result;
|
|
23062
|
+
}
|
|
23063
|
+
/**
|
|
23064
|
+
* Invoke the compute fn with the ComputeCtx argument. CTX_ARG signals (useAsync$, useResource$)
|
|
23065
|
+
* only track via its explicit track(). Computeds auto-track every synchronous read instead; after
|
|
23066
|
+
* the first await they must use the explicit track() too.
|
|
23067
|
+
*/
|
|
23068
|
+
$invokeComputeFn$(fn, job) {
|
|
23069
|
+
const computeFn = fn;
|
|
23070
|
+
if (this.$flags$ & 1024 /* CTX_ARG */) {
|
|
23071
|
+
let iCtx = tryGetInvokeContext();
|
|
23072
|
+
if (iCtx?.$effectSubscriber$) {
|
|
23073
|
+
iCtx = { ...iCtx, $effectSubscriber$: void 0 };
|
|
23074
|
+
}
|
|
23075
|
+
return invokeApply(iCtx, computeFn, [job]);
|
|
23076
|
+
}
|
|
23077
|
+
const container = this.$container$ || (this.$container$ = tryGetInvokeContext()?.$container$ || null);
|
|
23078
|
+
const subscriber = getSubscriber(this, "." /* VNODE */);
|
|
23079
|
+
if (container) {
|
|
23080
|
+
clearEffectSubscription(container, subscriber);
|
|
23081
|
+
}
|
|
23082
|
+
const ctx = newInvokeContext();
|
|
23083
|
+
ctx.$container$ = container || void 0;
|
|
23084
|
+
ctx.$effectSubscriber$ = subscriber;
|
|
23085
|
+
return invokeApply(ctx, computeFn, [job]);
|
|
23086
|
+
}
|
|
23087
|
+
/** Start an async computation (the async engine; assumes the INVALID flag is set) */
|
|
23088
|
+
$computeAsync$() {
|
|
23063
23089
|
if ((qTest ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */) {
|
|
23064
|
-
this.$
|
|
23090
|
+
this.$untrackedPending$ = true;
|
|
23065
23091
|
this.$container$?.serializationCtx.$eagerResume$.add(this);
|
|
23066
23092
|
return;
|
|
23067
23093
|
}
|
|
23068
|
-
this.$clearNextPoll$();
|
|
23069
23094
|
this.$flags$ &= ~1 /* INVALID */;
|
|
23070
23095
|
const current = this.$current$;
|
|
23071
23096
|
if (current) {
|
|
@@ -23073,13 +23098,13 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23073
23098
|
}
|
|
23074
23099
|
const limit = this.$concurrency$ === 0 ? Number.POSITIVE_INFINITY : this.$concurrency$ ?? 1;
|
|
23075
23100
|
if (this.$jobs$ ? this.$jobs$.length >= limit : current?.$promise$) {
|
|
23076
|
-
|
|
23101
|
+
DEBUG2 && log2(`Concurrency limit ${limit} reached, not starting new computation`);
|
|
23077
23102
|
this.$flags$ |= 1 /* INVALID */;
|
|
23078
23103
|
return;
|
|
23079
23104
|
}
|
|
23080
|
-
|
|
23105
|
+
DEBUG2 && log2("Starting new async computation");
|
|
23081
23106
|
const infoVersion = this.$infoVersion$;
|
|
23082
|
-
const running = new
|
|
23107
|
+
const running = new Job(this, this.$info$, infoVersion);
|
|
23083
23108
|
this.$current$ = running;
|
|
23084
23109
|
if (this.$jobs$) {
|
|
23085
23110
|
this.$jobs$.push(running);
|
|
@@ -23087,29 +23112,36 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23087
23112
|
running.$promise$ = this.$runComputation$(running);
|
|
23088
23113
|
}
|
|
23089
23114
|
async $runComputation$(running) {
|
|
23090
|
-
const isCurrent = () => running === this.$current$;
|
|
23091
23115
|
let fn = this.$computeQrl$.resolved;
|
|
23092
23116
|
if (!fn) {
|
|
23093
|
-
this.
|
|
23117
|
+
this.untrackedPending = true;
|
|
23094
23118
|
fn = await this.$computeQrl$.resolve();
|
|
23095
23119
|
if (running.$abortController$?.signal.aborted) {
|
|
23096
|
-
|
|
23120
|
+
DEBUG2 && log2("Computation aborted before it started");
|
|
23097
23121
|
running.$promise$ = null;
|
|
23098
23122
|
return;
|
|
23099
23123
|
}
|
|
23100
23124
|
}
|
|
23125
|
+
if (this.$timeoutMs$) {
|
|
23126
|
+
this.$computationTimeoutId$ = setTimeout(() => {
|
|
23127
|
+
const error = new Error(`timeout ${this.$timeoutMs$}ms`);
|
|
23128
|
+
this.$setError$(running, error);
|
|
23129
|
+
running.$abortController$?.abort(error);
|
|
23130
|
+
}, this.$timeoutMs$);
|
|
23131
|
+
}
|
|
23132
|
+
return this.$settleComputation$(
|
|
23133
|
+
running,
|
|
23134
|
+
() => retryOnPromise(() => this.$invokeComputeFn$(fn, running))
|
|
23135
|
+
);
|
|
23136
|
+
}
|
|
23137
|
+
/** Await the computation and publish its result, error, and loading transitions. */
|
|
23138
|
+
async $settleComputation$(running, compute) {
|
|
23139
|
+
const isCurrent = () => running === this.$current$;
|
|
23101
23140
|
try {
|
|
23102
|
-
|
|
23103
|
-
this.$computationTimeoutId$ = setTimeout(() => {
|
|
23104
|
-
const error = new Error(`timeout ${this.$timeoutMs$}ms`);
|
|
23105
|
-
this.$setError$(running, error);
|
|
23106
|
-
running.$abortController$?.abort(error);
|
|
23107
|
-
}, this.$timeoutMs$);
|
|
23108
|
-
}
|
|
23109
|
-
const valuePromise = retryOnPromise(fn.bind(null, running));
|
|
23141
|
+
const valuePromise = compute();
|
|
23110
23142
|
let value;
|
|
23111
23143
|
if (isPromise(valuePromise)) {
|
|
23112
|
-
this.
|
|
23144
|
+
this.untrackedPending = true;
|
|
23113
23145
|
value = await valuePromise;
|
|
23114
23146
|
} else {
|
|
23115
23147
|
value = valuePromise;
|
|
@@ -23127,13 +23159,13 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23127
23159
|
}
|
|
23128
23160
|
}
|
|
23129
23161
|
}
|
|
23130
|
-
|
|
23162
|
+
DEBUG2 && log2("Promise resolved", value);
|
|
23131
23163
|
this.untrackedError = void 0;
|
|
23132
23164
|
super.value = value;
|
|
23133
23165
|
}
|
|
23134
23166
|
} catch (err) {
|
|
23135
23167
|
running.$promise$ = null;
|
|
23136
|
-
|
|
23168
|
+
DEBUG2 && log2("Error caught in promise.catch", err);
|
|
23137
23169
|
this.$setError$(running, err);
|
|
23138
23170
|
}
|
|
23139
23171
|
if (isCurrent()) {
|
|
@@ -23142,11 +23174,10 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23142
23174
|
this.$info$ = void 0;
|
|
23143
23175
|
}
|
|
23144
23176
|
if (this.$flags$ & 1 /* INVALID */) {
|
|
23145
|
-
|
|
23177
|
+
DEBUG2 && log2("Computation finished but signal is invalid, re-running");
|
|
23146
23178
|
this.$computeIfNeeded$();
|
|
23147
23179
|
} else {
|
|
23148
|
-
this.
|
|
23149
|
-
this.$scheduleNextPoll$();
|
|
23180
|
+
this.untrackedPending = false;
|
|
23150
23181
|
}
|
|
23151
23182
|
}
|
|
23152
23183
|
}
|
|
@@ -23167,7 +23198,6 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23167
23198
|
}
|
|
23168
23199
|
/** Called after SSR/unmount */
|
|
23169
23200
|
async $destroy$() {
|
|
23170
|
-
this.$clearNextPoll$();
|
|
23171
23201
|
clearTimeout(this.$computationTimeoutId$);
|
|
23172
23202
|
const current = this.$current$;
|
|
23173
23203
|
if (current) {
|
|
@@ -23179,25 +23209,6 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23179
23209
|
await current?.$promise$;
|
|
23180
23210
|
}
|
|
23181
23211
|
}
|
|
23182
|
-
$clearNextPoll$() {
|
|
23183
|
-
if (this.$pollTimeoutId$ !== void 0) {
|
|
23184
|
-
clearTimeout(this.$pollTimeoutId$);
|
|
23185
|
-
this.$pollTimeoutId$ = void 0;
|
|
23186
|
-
}
|
|
23187
|
-
}
|
|
23188
|
-
$scheduleNextPoll$() {
|
|
23189
|
-
if ((qTest ? isServerPlatform() : isServer5) || !this.$expires$) {
|
|
23190
|
-
return;
|
|
23191
|
-
}
|
|
23192
|
-
this.$clearNextPoll$();
|
|
23193
|
-
const allowRecalc = !(this.$flags$ & 256 /* NO_POLL */);
|
|
23194
|
-
const mustClear = this.$flags$ & 128 /* CLEAR_ON_INVALIDATE */ && !allowRecalc;
|
|
23195
|
-
this.$pollTimeoutId$ = setTimeout(
|
|
23196
|
-
() => this.$setInvalid$(allowRecalc, mustClear),
|
|
23197
|
-
this.$expires$
|
|
23198
|
-
);
|
|
23199
|
-
this.$pollTimeoutId$?.unref?.();
|
|
23200
|
-
}
|
|
23201
23212
|
$hasSubscribers$() {
|
|
23202
23213
|
return !!(this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size);
|
|
23203
23214
|
}
|
|
@@ -23205,15 +23216,14 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23205
23216
|
if (job.$cleanupRequested$) {
|
|
23206
23217
|
return;
|
|
23207
23218
|
}
|
|
23208
|
-
|
|
23219
|
+
DEBUG2 && log2("Requesting cleanups for job", job);
|
|
23209
23220
|
job.$cleanupRequested$ = true;
|
|
23210
23221
|
job.$abortController$?.abort(reason);
|
|
23211
23222
|
job.$promise$ = maybeThen(job.$promise$, () => this.$runCleanups$(job));
|
|
23212
23223
|
}
|
|
23213
|
-
/**
|
|
23214
|
-
$
|
|
23224
|
+
/** Run a job's cleanup callbacks, returning a promise when any of them are async. */
|
|
23225
|
+
$runCleanupCallbacks$(job) {
|
|
23215
23226
|
const cleanups = job.$cleanups$;
|
|
23216
|
-
DEBUG3 && log3("cleanup start", job);
|
|
23217
23227
|
const onError = (err) => {
|
|
23218
23228
|
const handleError = this.$container$?.handleError;
|
|
23219
23229
|
if (handleError) {
|
|
@@ -23222,24 +23232,9 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23222
23232
|
console.error("Error in async signal cleanup", err);
|
|
23223
23233
|
}
|
|
23224
23234
|
};
|
|
23225
|
-
const onDone = () => {
|
|
23226
|
-
job.$promise$ = null;
|
|
23227
|
-
if (cleanups) {
|
|
23228
|
-
cleanups.length = 0;
|
|
23229
|
-
}
|
|
23230
|
-
DEBUG3 && log3("cleanup finished", job);
|
|
23231
|
-
const jobs = this.$jobs$;
|
|
23232
|
-
if (jobs) {
|
|
23233
|
-
const idx = jobs.indexOf(job);
|
|
23234
|
-
if (idx !== -1) {
|
|
23235
|
-
jobs.splice(idx, 1);
|
|
23236
|
-
}
|
|
23237
|
-
}
|
|
23238
|
-
this.$computeIfNeeded$();
|
|
23239
|
-
};
|
|
23240
23235
|
let promiseChain = void 0;
|
|
23241
23236
|
if (cleanups) {
|
|
23242
|
-
|
|
23237
|
+
DEBUG2 && log2("cleanup start for real", job);
|
|
23243
23238
|
for (let i2 = 0; i2 < cleanups.length; i2++) {
|
|
23244
23239
|
try {
|
|
23245
23240
|
const result = cleanups[i2]();
|
|
@@ -23250,7 +23245,26 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
23250
23245
|
onError(err);
|
|
23251
23246
|
}
|
|
23252
23247
|
}
|
|
23248
|
+
cleanups.length = 0;
|
|
23253
23249
|
}
|
|
23250
|
+
return promiseChain;
|
|
23251
|
+
}
|
|
23252
|
+
/** Clean up and trigger signal compute once complete */
|
|
23253
|
+
$runCleanups$(job) {
|
|
23254
|
+
DEBUG2 && log2("cleanup start", job);
|
|
23255
|
+
const onDone = () => {
|
|
23256
|
+
job.$promise$ = null;
|
|
23257
|
+
DEBUG2 && log2("cleanup finished", job);
|
|
23258
|
+
const jobs = this.$jobs$;
|
|
23259
|
+
if (jobs) {
|
|
23260
|
+
const idx = jobs.indexOf(job);
|
|
23261
|
+
if (idx !== -1) {
|
|
23262
|
+
jobs.splice(idx, 1);
|
|
23263
|
+
}
|
|
23264
|
+
}
|
|
23265
|
+
this.$computeIfNeeded$();
|
|
23266
|
+
};
|
|
23267
|
+
const promiseChain = this.$runCleanupCallbacks$(job);
|
|
23254
23268
|
if (promiseChain) {
|
|
23255
23269
|
return promiseChain.then(onDone);
|
|
23256
23270
|
} else {
|
|
@@ -23279,8 +23293,8 @@ var implicit$FirstArg = (fn) => {
|
|
|
23279
23293
|
};
|
|
23280
23294
|
|
|
23281
23295
|
// packages/qwik/src/core/reactive-primitives/impl/serializer-signal-impl.ts
|
|
23282
|
-
var
|
|
23283
|
-
var
|
|
23296
|
+
var DEBUG3 = false;
|
|
23297
|
+
var log3 = (...args) => console.log("SERIALIZER SIGNAL", ...args.map(qwikDebugToString));
|
|
23284
23298
|
var SerializerSignalImpl = class extends ComputedSignalImpl {
|
|
23285
23299
|
constructor(container, argQrl) {
|
|
23286
23300
|
super(
|
|
@@ -23307,7 +23321,7 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
|
|
|
23307
23321
|
);
|
|
23308
23322
|
this.$didInitialize$ = true;
|
|
23309
23323
|
this.$flags$ &= ~1 /* INVALID */;
|
|
23310
|
-
|
|
23324
|
+
DEBUG3 && log3("SerializerSignal.$compute$", untrackedValue);
|
|
23311
23325
|
const didChange = this.$didInitialize$ && untrackedValue !== "undefined" || untrackedValue !== this.$untrackedValue$;
|
|
23312
23326
|
if (didChange) {
|
|
23313
23327
|
this.$untrackedValue$ = untrackedValue;
|
|
@@ -23316,6 +23330,13 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
|
|
|
23316
23330
|
}
|
|
23317
23331
|
};
|
|
23318
23332
|
|
|
23333
|
+
// packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
|
|
23334
|
+
var AsyncSignalImpl = class extends ComputedSignalImpl {
|
|
23335
|
+
constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */, options) {
|
|
23336
|
+
super(container, fn, flags | 512 /* ASYNC_MODE */ | 1024 /* CTX_ARG */, options);
|
|
23337
|
+
}
|
|
23338
|
+
};
|
|
23339
|
+
|
|
23319
23340
|
// packages/qwik/src/core/reactive-primitives/signal-api.ts
|
|
23320
23341
|
var createSerializerSignal = (arg) => {
|
|
23321
23342
|
return new SerializerSignalImpl(null, arg);
|
|
@@ -23433,8 +23454,11 @@ function setCursorPosition(container, cursorData, position) {
|
|
|
23433
23454
|
}
|
|
23434
23455
|
}
|
|
23435
23456
|
function mergeCursors(container, newCursorData, oldCursor) {
|
|
23436
|
-
removeCursorFromQueue(oldCursor, container);
|
|
23437
23457
|
const oldCursorData = getCursorData(oldCursor);
|
|
23458
|
+
if (!oldCursorData || oldCursorData === newCursorData) {
|
|
23459
|
+
return;
|
|
23460
|
+
}
|
|
23461
|
+
removeCursorFromQueue(oldCursor, container);
|
|
23438
23462
|
mergeCursorData(newCursorData, oldCursorData);
|
|
23439
23463
|
}
|
|
23440
23464
|
function mergeCursorData(newCursorData, oldCursorData) {
|
|
@@ -23493,7 +23517,7 @@ function setCursorData(vNode, cursorData) {
|
|
|
23493
23517
|
}
|
|
23494
23518
|
|
|
23495
23519
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
23496
|
-
import { isDev as
|
|
23520
|
+
import { isDev as isDev13 } from "@qwik.dev/core/build";
|
|
23497
23521
|
|
|
23498
23522
|
// packages/qwik/src/core/reactive-primitives/subscription-data.ts
|
|
23499
23523
|
var SubscriptionData = class {
|
|
@@ -23504,11 +23528,11 @@ var SubscriptionData = class {
|
|
|
23504
23528
|
};
|
|
23505
23529
|
|
|
23506
23530
|
// packages/qwik/src/core/shared/component.public.ts
|
|
23507
|
-
import { isDev as
|
|
23531
|
+
import { isDev as isDev11 } from "@qwik.dev/core/build";
|
|
23508
23532
|
var componentQrl = (componentQrl3) => {
|
|
23509
23533
|
function QwikComponent(props, key, flags = 0) {
|
|
23510
|
-
|
|
23511
|
-
|
|
23534
|
+
isDev11 && assertQrl(componentQrl3);
|
|
23535
|
+
isDev11 && assertNumber(flags, "The Qwik Component was not invoked correctly");
|
|
23512
23536
|
const hash = qTest ? "sX" : componentQrl3.$hash$.slice(0, 4);
|
|
23513
23537
|
const finalKey = hash + ":" + (key ? key : "");
|
|
23514
23538
|
const InnerCmp = () => {
|
|
@@ -23538,9 +23562,9 @@ var isObjectEmpty = (obj) => {
|
|
|
23538
23562
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23539
23563
|
var JSXNodeImpl = class {
|
|
23540
23564
|
constructor(type, varProps, constProps, children, flags, key, toSort, dev) {
|
|
23541
|
-
this
|
|
23542
|
-
this
|
|
23543
|
-
this
|
|
23565
|
+
__publicField(this, "type", type);
|
|
23566
|
+
__publicField(this, "children", children);
|
|
23567
|
+
__publicField(this, "flags", flags);
|
|
23544
23568
|
__publicField(this, "toSort");
|
|
23545
23569
|
__publicField(this, "key");
|
|
23546
23570
|
__publicField(this, "varProps");
|
|
@@ -23603,9 +23627,9 @@ var SSRRaw = () => null;
|
|
|
23603
23627
|
var SSRComment = () => null;
|
|
23604
23628
|
|
|
23605
23629
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
23606
|
-
import { isDev as
|
|
23630
|
+
import { isDev as isDev12 } from "@qwik.dev/core/build";
|
|
23607
23631
|
var isForeignObjectElement = (elementName) => {
|
|
23608
|
-
return
|
|
23632
|
+
return isDev12 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
|
|
23609
23633
|
};
|
|
23610
23634
|
var isSvgElement = (elementName) => elementName === "svg" || isForeignObjectElement(elementName);
|
|
23611
23635
|
var isMathElement = (elementName) => elementName === "math";
|
|
@@ -24010,6 +24034,12 @@ var VNodeDataChar = {
|
|
|
24010
24034
|
/* ** */
|
|
24011
24035
|
"<"
|
|
24012
24036
|
),
|
|
24037
|
+
RENDER_HASH_PREFIX: (
|
|
24038
|
+
/* **/
|
|
24039
|
+
95
|
|
24040
|
+
),
|
|
24041
|
+
// `_` after `<` identifies a component hash.
|
|
24042
|
+
RENDER_HASH_PREFIX_CHAR: "_",
|
|
24013
24043
|
ID: (
|
|
24014
24044
|
/* ***************** */
|
|
24015
24045
|
61
|
|
@@ -24399,34 +24429,34 @@ function isAriaAttribute(prop) {
|
|
|
24399
24429
|
// packages/qwik/src/core/shared/vnode/types/dom-vnode-operation.ts
|
|
24400
24430
|
var DeleteOperation = class {
|
|
24401
24431
|
constructor(target) {
|
|
24402
|
-
this
|
|
24432
|
+
__publicField(this, "target", target);
|
|
24403
24433
|
}
|
|
24404
24434
|
};
|
|
24405
24435
|
var RemoveAllChildrenOperation = class {
|
|
24406
24436
|
constructor(target) {
|
|
24407
|
-
this
|
|
24437
|
+
__publicField(this, "target", target);
|
|
24408
24438
|
}
|
|
24409
24439
|
};
|
|
24410
24440
|
var SetTextOperation = class {
|
|
24411
24441
|
constructor(target, text) {
|
|
24412
|
-
this
|
|
24413
|
-
this
|
|
24442
|
+
__publicField(this, "target", target);
|
|
24443
|
+
__publicField(this, "text", text);
|
|
24414
24444
|
}
|
|
24415
24445
|
};
|
|
24416
24446
|
var InsertOrMoveOperation = class {
|
|
24417
24447
|
constructor(target, parent, beforeTarget) {
|
|
24418
|
-
this
|
|
24419
|
-
this
|
|
24420
|
-
this
|
|
24448
|
+
__publicField(this, "target", target);
|
|
24449
|
+
__publicField(this, "parent", parent);
|
|
24450
|
+
__publicField(this, "beforeTarget", beforeTarget);
|
|
24421
24451
|
}
|
|
24422
24452
|
};
|
|
24423
24453
|
var SetAttributeOperation = class {
|
|
24424
24454
|
constructor(target, attrName, attrValue, scopedStyleIdPrefix, isSvg2) {
|
|
24425
|
-
this
|
|
24426
|
-
this
|
|
24427
|
-
this
|
|
24428
|
-
this
|
|
24429
|
-
this
|
|
24455
|
+
__publicField(this, "target", target);
|
|
24456
|
+
__publicField(this, "attrName", attrName);
|
|
24457
|
+
__publicField(this, "attrValue", attrValue);
|
|
24458
|
+
__publicField(this, "scopedStyleIdPrefix", scopedStyleIdPrefix);
|
|
24459
|
+
__publicField(this, "isSvg", isSvg2);
|
|
24430
24460
|
}
|
|
24431
24461
|
};
|
|
24432
24462
|
var createDeleteOperation = (target) => new DeleteOperation(target);
|
|
@@ -24440,14 +24470,14 @@ function addCursorBoundary(cursorData, vNode) {
|
|
|
24440
24470
|
if (!__EXPERIMENTAL__.suspense) {
|
|
24441
24471
|
return;
|
|
24442
24472
|
}
|
|
24443
|
-
const boundary = getNearestCursorBoundary(
|
|
24473
|
+
const boundary = getNearestCursorBoundary(vNode);
|
|
24444
24474
|
if (!boundary) {
|
|
24445
24475
|
return;
|
|
24446
24476
|
}
|
|
24447
24477
|
const boundaries = cursorData.boundaries || (cursorData.boundaries = []);
|
|
24448
24478
|
if (!boundaries.includes(boundary)) {
|
|
24449
24479
|
boundaries.push(boundary);
|
|
24450
|
-
boundary.
|
|
24480
|
+
boundary.value++;
|
|
24451
24481
|
}
|
|
24452
24482
|
}
|
|
24453
24483
|
function resolveCursorBoundaries(cursorData) {
|
|
@@ -24461,38 +24491,33 @@ function resolveCursorBoundaries(cursorData) {
|
|
|
24461
24491
|
cursorData.boundaries = null;
|
|
24462
24492
|
for (let i2 = 0; i2 < boundaries.length; i2++) {
|
|
24463
24493
|
const boundary = boundaries[i2];
|
|
24464
|
-
boundary.
|
|
24465
|
-
boundary.version.value++;
|
|
24494
|
+
boundary.value = Math.max(0, boundary.value - 1);
|
|
24466
24495
|
}
|
|
24467
24496
|
}
|
|
24468
|
-
function getOwnCursorBoundary(
|
|
24497
|
+
function getOwnCursorBoundary(vNode) {
|
|
24469
24498
|
if (!__EXPERIMENTAL__.suspense) {
|
|
24470
24499
|
return null;
|
|
24471
24500
|
}
|
|
24472
|
-
return
|
|
24473
|
-
}
|
|
24474
|
-
function getNearestCursorBoundaryProp(vNode) {
|
|
24475
|
-
if (!__EXPERIMENTAL__.suspense) {
|
|
24476
|
-
return null;
|
|
24477
|
-
}
|
|
24478
|
-
return vnode_getProp(vNode, NEAREST_CURSOR_BOUNDARY, null) || null;
|
|
24501
|
+
return vnode_getProp(vNode, QCursorBoundary, null) || null;
|
|
24479
24502
|
}
|
|
24480
24503
|
function clearNearestCursorBoundary(vNode) {
|
|
24481
|
-
|
|
24482
|
-
return;
|
|
24483
|
-
}
|
|
24484
|
-
vnode_setProp(vNode, NEAREST_CURSOR_BOUNDARY, null);
|
|
24504
|
+
setNearestCursorBoundary(vNode, null);
|
|
24485
24505
|
}
|
|
24486
|
-
function getNearestCursorBoundary(
|
|
24506
|
+
function getNearestCursorBoundary(vNode) {
|
|
24487
24507
|
if (!__EXPERIMENTAL__.suspense) {
|
|
24488
24508
|
return null;
|
|
24489
24509
|
}
|
|
24490
|
-
return
|
|
24510
|
+
return vnode_getProp(vNode, NEAREST_CURSOR_BOUNDARY, null) || getOwnCursorBoundary(vNode);
|
|
24491
24511
|
}
|
|
24492
24512
|
function setNearestCursorBoundary(vNode, boundary) {
|
|
24493
24513
|
__EXPERIMENTAL__.suspense && vnode_setProp(vNode, NEAREST_CURSOR_BOUNDARY, boundary);
|
|
24494
24514
|
}
|
|
24495
|
-
function
|
|
24515
|
+
function clearCursorBoundary(vNode) {
|
|
24516
|
+
if (__EXPERIMENTAL__.suspense && vNode.props && QCursorBoundary in vNode.props) {
|
|
24517
|
+
vnode_setProp(vNode, QCursorBoundary, null);
|
|
24518
|
+
}
|
|
24519
|
+
}
|
|
24520
|
+
function updateDirtySubtreeCursorBoundary(vNode, boundary) {
|
|
24496
24521
|
if (!__EXPERIMENTAL__.suspense) {
|
|
24497
24522
|
return;
|
|
24498
24523
|
}
|
|
@@ -24503,11 +24528,7 @@ function updateDirtySubtreeCursorBoundary(container, vNode, boundary) {
|
|
|
24503
24528
|
}
|
|
24504
24529
|
for (let i2 = 0; i2 < dirtyChildren.length; i2++) {
|
|
24505
24530
|
const child = dirtyChildren[i2];
|
|
24506
|
-
updateDirtySubtreeCursorBoundary(
|
|
24507
|
-
container,
|
|
24508
|
-
child,
|
|
24509
|
-
getOwnCursorBoundary(container, child) || boundary
|
|
24510
|
-
);
|
|
24531
|
+
updateDirtySubtreeCursorBoundary(child, getOwnCursorBoundary(child) || boundary);
|
|
24511
24532
|
}
|
|
24512
24533
|
}
|
|
24513
24534
|
|
|
@@ -24664,8 +24685,8 @@ function runDiff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChil
|
|
|
24664
24685
|
}
|
|
24665
24686
|
function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(vStartNode), vEnd = null, forceCreationMode = false) {
|
|
24666
24687
|
const previousCreationMode = diffContext.$isCreationMode$;
|
|
24667
|
-
|
|
24668
|
-
|
|
24688
|
+
isDev13 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
|
|
24689
|
+
isDev13 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
|
|
24669
24690
|
diffContext.$isCreationMode$ = forceCreationMode || previousCreationMode;
|
|
24670
24691
|
diffContext.$vParent$ = vStartNode;
|
|
24671
24692
|
diffContext.$vNewNode$ = null;
|
|
@@ -24679,7 +24700,7 @@ function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(v
|
|
|
24679
24700
|
}
|
|
24680
24701
|
while (diffContext.$stack$.length) {
|
|
24681
24702
|
while (diffContext.$jsxIdx$ < diffContext.$jsxCount$) {
|
|
24682
|
-
|
|
24703
|
+
isDev13 && assertFalse(
|
|
24683
24704
|
diffContext.$vParent$ === diffContext.$vCurrent$,
|
|
24684
24705
|
"Parent and current can't be the same"
|
|
24685
24706
|
);
|
|
@@ -24720,9 +24741,8 @@ function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(v
|
|
|
24720
24741
|
diffContext,
|
|
24721
24742
|
diffContext.$jsxValue$.children,
|
|
24722
24743
|
true,
|
|
24723
|
-
|
|
24724
|
-
|
|
24725
|
-
false
|
|
24744
|
+
/* isProjection */
|
|
24745
|
+
true
|
|
24726
24746
|
);
|
|
24727
24747
|
} else if (type === SSRComment) {
|
|
24728
24748
|
expectNoMore(diffContext);
|
|
@@ -24811,18 +24831,22 @@ function advance(diffContext) {
|
|
|
24811
24831
|
diffContext.$vCurrent$ = peekNextSiblingWithinBoundary(diffContext, diffContext.$vCurrent$);
|
|
24812
24832
|
}
|
|
24813
24833
|
}
|
|
24814
|
-
function descend(diffContext, children, descendVNode,
|
|
24815
|
-
if (
|
|
24834
|
+
function descend(diffContext, children, descendVNode, isProjection = false) {
|
|
24835
|
+
if (!isProjection && (children == null || descendVNode && isArray(children) && children.length === 0)) {
|
|
24816
24836
|
expectNoChildren(diffContext);
|
|
24817
24837
|
return;
|
|
24818
24838
|
}
|
|
24819
24839
|
stackPush(diffContext, children, descendVNode);
|
|
24820
24840
|
if (descendVNode) {
|
|
24821
|
-
|
|
24841
|
+
isDev13 && assertDefined(
|
|
24822
24842
|
diffContext.$vCurrent$ || diffContext.$vNewNode$,
|
|
24823
24843
|
"Expecting vCurrent to be defined."
|
|
24824
24844
|
);
|
|
24825
|
-
const creationMode =
|
|
24845
|
+
const creationMode = (
|
|
24846
|
+
// a projection keeps its children across re-renders, so it never inherits
|
|
24847
|
+
// creation mode from a not-yet-rendered host; create only if new or empty
|
|
24848
|
+
!isProjection && diffContext.$isCreationMode$ || !!diffContext.$vNewNode$ || !vnode_getFirstChild(diffContext.$vCurrent$)
|
|
24849
|
+
);
|
|
24826
24850
|
diffContext.$isCreationMode$ = creationMode;
|
|
24827
24851
|
diffContext.$vSideBuffer$ = null;
|
|
24828
24852
|
diffContext.$vSiblings$ = null;
|
|
@@ -24945,8 +24969,8 @@ function expectProjection(diffContext) {
|
|
|
24945
24969
|
diffContext.$vCurrent$ = diffContext.$vCurrent$ && diffContext.$vCurrent$.flags & 32 /* Deleted */ ? null : diffContext.$vCurrent$;
|
|
24946
24970
|
if (diffContext.$vCurrent$ == null) {
|
|
24947
24971
|
diffContext.$vNewNode$ = vnode_newVirtual();
|
|
24948
|
-
|
|
24949
|
-
|
|
24972
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
|
|
24973
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, "q:code", "expectProjection");
|
|
24950
24974
|
vnode_setProp(diffContext.$vNewNode$, QSlot, slotName);
|
|
24951
24975
|
diffContext.$vNewNode$.slotParent = diffContext.$vParent$;
|
|
24952
24976
|
vnode_setProp(diffContext.$vParent$, slotName, diffContext.$vNewNode$);
|
|
@@ -24969,13 +24993,9 @@ function expectSlot(diffContext) {
|
|
|
24969
24993
|
diffContext.$vNewNode$ = vnode_newVirtual();
|
|
24970
24994
|
vnode_setProp(diffContext.$vNewNode$, QSlot, slotNameKey);
|
|
24971
24995
|
vnode_setProp(diffContext.$vNewNode$, QCursorBoundary, cursorBoundary);
|
|
24972
|
-
updateDirtySubtreeCursorBoundary(
|
|
24973
|
-
diffContext.$container$,
|
|
24974
|
-
diffContext.$vNewNode$,
|
|
24975
|
-
cursorBoundary
|
|
24976
|
-
);
|
|
24996
|
+
updateDirtySubtreeCursorBoundary(diffContext.$vNewNode$, cursorBoundary);
|
|
24977
24997
|
vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
|
|
24978
|
-
|
|
24998
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
|
|
24979
24999
|
vnode_insertBefore(
|
|
24980
25000
|
diffContext.$journal$,
|
|
24981
25001
|
diffContext.$vParent$,
|
|
@@ -24989,13 +25009,9 @@ function expectSlot(diffContext) {
|
|
|
24989
25009
|
diffContext.$vNewNode$ = vProjectedNode;
|
|
24990
25010
|
vnode_setProp(diffContext.$vNewNode$, QSlot, slotNameKey);
|
|
24991
25011
|
vnode_setProp(diffContext.$vNewNode$, QCursorBoundary, cursorBoundary);
|
|
24992
|
-
updateDirtySubtreeCursorBoundary(
|
|
24993
|
-
diffContext.$container$,
|
|
24994
|
-
diffContext.$vNewNode$,
|
|
24995
|
-
cursorBoundary
|
|
24996
|
-
);
|
|
25012
|
+
updateDirtySubtreeCursorBoundary(diffContext.$vNewNode$, cursorBoundary);
|
|
24997
25013
|
vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
|
|
24998
|
-
|
|
25014
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
|
|
24999
25015
|
vnode_inflateProjectionTrailingText(
|
|
25000
25016
|
diffContext.$journal$,
|
|
25001
25017
|
diffContext.$vNewNode$
|
|
@@ -25077,7 +25093,7 @@ function expectNoChildren(diffContext, removeDOM = true) {
|
|
|
25077
25093
|
}
|
|
25078
25094
|
function expectNoMore(diffContext) {
|
|
25079
25095
|
const boundary = getLevelBoundary(diffContext);
|
|
25080
|
-
|
|
25096
|
+
isDev13 && assertFalse(
|
|
25081
25097
|
diffContext.$vParent$ === diffContext.$vCurrent$,
|
|
25082
25098
|
"Parent and current can't be the same"
|
|
25083
25099
|
);
|
|
@@ -25138,7 +25154,7 @@ function applyConstInnerHtml(element, value) {
|
|
|
25138
25154
|
}
|
|
25139
25155
|
function applyConstTextareaValue(element, value, currentFile) {
|
|
25140
25156
|
if (value && typeof value !== "string") {
|
|
25141
|
-
if (
|
|
25157
|
+
if (isDev13) {
|
|
25142
25158
|
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
25143
25159
|
}
|
|
25144
25160
|
return true;
|
|
@@ -25273,7 +25289,7 @@ function expectElement(diffContext, jsx2, elementName) {
|
|
|
25273
25289
|
const jsxProps = jsx2.varProps;
|
|
25274
25290
|
const vNode = diffContext.$vNewNode$ || diffContext.$vCurrent$;
|
|
25275
25291
|
if (jsxProps) {
|
|
25276
|
-
diffProps(diffContext, vNode, jsxProps,
|
|
25292
|
+
diffProps(diffContext, vNode, jsxProps, isDev13 && getFileLocationFromJsx(jsx2.dev) || null);
|
|
25277
25293
|
}
|
|
25278
25294
|
}
|
|
25279
25295
|
function diffProps(diffContext, vnode, newAttrs, currentFile) {
|
|
@@ -25281,14 +25297,17 @@ function diffProps(diffContext, vnode, newAttrs, currentFile) {
|
|
|
25281
25297
|
vnode_ensureElementInflated(diffContext.$container$, vnode);
|
|
25282
25298
|
}
|
|
25283
25299
|
const oldAttrs = vnode.props;
|
|
25300
|
+
const isHtml = (vnode.flags & 1536 /* NAMESPACE_MASK */) === 0 /* NS_html */;
|
|
25284
25301
|
for (const key in newAttrs) {
|
|
25285
25302
|
const newValue = newAttrs[key];
|
|
25286
|
-
|
|
25287
|
-
|
|
25288
|
-
|
|
25289
|
-
|
|
25290
|
-
|
|
25291
|
-
|
|
25303
|
+
const oldKey = oldAttrs && isHtml && !_hasOwnProperty3.call(oldAttrs, key) ? key.toLowerCase() : key;
|
|
25304
|
+
if (oldAttrs && _hasOwnProperty3.call(oldAttrs, oldKey)) {
|
|
25305
|
+
const oldValue = oldAttrs[oldKey];
|
|
25306
|
+
if (oldKey !== key) {
|
|
25307
|
+
vnode_setProp(vnode, oldKey, null);
|
|
25308
|
+
vnode_setProp(vnode, key, oldValue);
|
|
25309
|
+
}
|
|
25310
|
+
if (!areDiffValuesEqual(newValue, oldValue)) {
|
|
25292
25311
|
patchProperty(diffContext, vnode, key, newValue, currentFile);
|
|
25293
25312
|
}
|
|
25294
25313
|
} else if (newValue != null) {
|
|
@@ -25533,7 +25552,7 @@ function expectVirtual(diffContext, type, jsxKey) {
|
|
|
25533
25552
|
getInsertBefore(diffContext)
|
|
25534
25553
|
);
|
|
25535
25554
|
diffContext.$vNewNode$.key = jsxKey;
|
|
25536
|
-
|
|
25555
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
|
|
25537
25556
|
return;
|
|
25538
25557
|
}
|
|
25539
25558
|
if (moveOrCreateKeyedNode(
|
|
@@ -25551,7 +25570,7 @@ function expectVirtual(diffContext, type, jsxKey) {
|
|
|
25551
25570
|
getInsertBefore(diffContext)
|
|
25552
25571
|
);
|
|
25553
25572
|
diffContext.$vNewNode$.key = jsxKey;
|
|
25554
|
-
|
|
25573
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
|
|
25555
25574
|
}
|
|
25556
25575
|
}
|
|
25557
25576
|
function expectComponent(diffContext, component) {
|
|
@@ -25663,7 +25682,7 @@ function insertNewComponent(diffContext, host, componentQRL, jsxProps) {
|
|
|
25663
25682
|
getInsertBefore(diffContext)
|
|
25664
25683
|
);
|
|
25665
25684
|
const jsxNode = diffContext.$jsxValue$;
|
|
25666
|
-
|
|
25685
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "C" /* Component */);
|
|
25667
25686
|
vnode_setProp(diffContext.$vNewNode$, OnRenderProp, componentQRL);
|
|
25668
25687
|
vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxProps);
|
|
25669
25688
|
diffContext.$vNewNode$.key = jsxNode.key;
|
|
@@ -25676,7 +25695,7 @@ function insertNewInlineComponent(diffContext) {
|
|
|
25676
25695
|
getInsertBefore(diffContext)
|
|
25677
25696
|
);
|
|
25678
25697
|
const jsxNode = diffContext.$jsxValue$;
|
|
25679
|
-
|
|
25698
|
+
isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
25680
25699
|
vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxNode.props);
|
|
25681
25700
|
if (jsxNode.key) {
|
|
25682
25701
|
diffContext.$vNewNode$.key = jsxNode.key;
|
|
@@ -25714,7 +25733,7 @@ function getComponentHash(vNode, getObject) {
|
|
|
25714
25733
|
return null;
|
|
25715
25734
|
}
|
|
25716
25735
|
const qrl = vnode_getProp(vNode, OnRenderProp, getObject);
|
|
25717
|
-
return qrl ? qrl.$hash$ : null;
|
|
25736
|
+
return qrl ? qrl.$hash$ : vnode_getProp(vNode, QComponentHash, null);
|
|
25718
25737
|
}
|
|
25719
25738
|
function Projection() {
|
|
25720
25739
|
}
|
|
@@ -25755,10 +25774,21 @@ function handleChangedProps(src, dst, propsHandler, container, triggerEffects =
|
|
|
25755
25774
|
if (key === "children" || key === QBackRefs) {
|
|
25756
25775
|
continue;
|
|
25757
25776
|
}
|
|
25758
|
-
|
|
25777
|
+
const newValue = src[key];
|
|
25778
|
+
const oldValue = dst?.[key];
|
|
25779
|
+
if (!dst || !(areDiffValuesEqual(newValue, oldValue) || areSignalValuesEqual(newValue, oldValue))) {
|
|
25780
|
+
if (key === "class") {
|
|
25781
|
+
if (areClassValuesEqual(newValue, oldValue)) {
|
|
25782
|
+
continue;
|
|
25783
|
+
}
|
|
25784
|
+
} else if (key === "style") {
|
|
25785
|
+
if (areStyleValuesEqual(newValue, oldValue)) {
|
|
25786
|
+
continue;
|
|
25787
|
+
}
|
|
25788
|
+
}
|
|
25759
25789
|
if (triggerEffects) {
|
|
25760
25790
|
if (dst) {
|
|
25761
|
-
dst[key] =
|
|
25791
|
+
dst[key] = newValue;
|
|
25762
25792
|
}
|
|
25763
25793
|
const didTigger = triggerPropsProxyEffect(propsHandler, key);
|
|
25764
25794
|
if (!didTigger) {
|
|
@@ -25822,10 +25852,12 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
|
|
|
25822
25852
|
obj.$flags$ |= 16 /* NEEDS_CLEANUP */;
|
|
25823
25853
|
markVNodeDirty(container, vCursor, 128 /* CLEANUP */, cursorRoot);
|
|
25824
25854
|
continue;
|
|
25825
|
-
} else if (obj instanceof
|
|
25826
|
-
|
|
25855
|
+
} else if (obj instanceof ComputedSignalImpl || obj instanceof WrappedSignalImpl) {
|
|
25856
|
+
if (!(obj.$flags$ & 4 /* PRESERVE_ON_SEQ_CLEANUP */)) {
|
|
25857
|
+
clearAllEffects(container, obj);
|
|
25858
|
+
}
|
|
25827
25859
|
}
|
|
25828
|
-
if (objIsTask || obj instanceof
|
|
25860
|
+
if (objIsTask || obj instanceof ComputedSignalImpl && (obj.$flags$ & 512 /* ASYNC_MODE */ || obj.$current$)) {
|
|
25829
25861
|
cleanupDestroyable(obj);
|
|
25830
25862
|
}
|
|
25831
25863
|
}
|
|
@@ -25917,6 +25949,35 @@ function cleanupStaleUnclaimedProjection(container, journal, projection) {
|
|
|
25917
25949
|
function markVNodeAsDeleted(vCursor) {
|
|
25918
25950
|
vCursor.flags |= 32 /* Deleted */;
|
|
25919
25951
|
}
|
|
25952
|
+
function areDiffValuesEqual(newValue, oldValue) {
|
|
25953
|
+
if (newValue === oldValue) {
|
|
25954
|
+
return true;
|
|
25955
|
+
}
|
|
25956
|
+
return newValue instanceof WrappedSignalImpl && oldValue instanceof WrappedSignalImpl && areWrappedSignalsEqual(oldValue, newValue);
|
|
25957
|
+
}
|
|
25958
|
+
function areSignalValuesEqual(newValue, oldValue) {
|
|
25959
|
+
if (newValue === oldValue) {
|
|
25960
|
+
return true;
|
|
25961
|
+
}
|
|
25962
|
+
if (isSignal(newValue) && isSignal(oldValue)) {
|
|
25963
|
+
const unwrappedNew = newValue instanceof WrappedSignalImpl ? newValue.$unwrapIfSignal$() : newValue;
|
|
25964
|
+
const unwrappedOld = oldValue instanceof WrappedSignalImpl ? oldValue.$unwrapIfSignal$() : oldValue;
|
|
25965
|
+
return untrack(() => unwrappedNew.value === unwrappedOld.value);
|
|
25966
|
+
}
|
|
25967
|
+
return false;
|
|
25968
|
+
}
|
|
25969
|
+
function areStyleValuesEqual(newValue, oldValue) {
|
|
25970
|
+
if (newValue === oldValue) {
|
|
25971
|
+
return true;
|
|
25972
|
+
}
|
|
25973
|
+
return stringifyStyle(newValue) === stringifyStyle(oldValue);
|
|
25974
|
+
}
|
|
25975
|
+
function areClassValuesEqual(newValue, oldValue) {
|
|
25976
|
+
if (newValue === oldValue) {
|
|
25977
|
+
return true;
|
|
25978
|
+
}
|
|
25979
|
+
return serializeClass(newValue) === serializeClass(oldValue);
|
|
25980
|
+
}
|
|
25920
25981
|
function areWrappedSignalsEqual(oldSignal, newSignal) {
|
|
25921
25982
|
if (oldSignal === newSignal) {
|
|
25922
25983
|
return true;
|
|
@@ -25951,7 +26012,7 @@ function containsWrappedSignal(data, signal) {
|
|
|
25951
26012
|
}
|
|
25952
26013
|
|
|
25953
26014
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
25954
|
-
import { isDev as
|
|
26015
|
+
import { isDev as isDev14, isServer as isServer6 } from "@qwik.dev/core/build";
|
|
25955
26016
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
25956
26017
|
const iCtx = newRenderInvokeContext(
|
|
25957
26018
|
container.$locale$,
|
|
@@ -25967,7 +26028,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
25967
26028
|
let isInlineComponent = false;
|
|
25968
26029
|
if (componentQRL === null) {
|
|
25969
26030
|
componentQRL = container.getHostProp(renderHost, OnRenderProp);
|
|
25970
|
-
|
|
26031
|
+
isDev14 && assertDefined(componentQRL, "No Component found at this location");
|
|
25971
26032
|
}
|
|
25972
26033
|
if (isQrl(componentQRL)) {
|
|
25973
26034
|
props = props || container.getHostProp(renderHost, ELEMENT_PROPS) || EMPTY_OBJ;
|
|
@@ -26048,7 +26109,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
|
|
|
26048
26109
|
}
|
|
26049
26110
|
targetElement = placeholderElement;
|
|
26050
26111
|
} else {
|
|
26051
|
-
if (
|
|
26112
|
+
if (isDev14) {
|
|
26052
26113
|
const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
|
|
26053
26114
|
logWarn(
|
|
26054
26115
|
'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 outputs a DOM element.' + (sourceLocation ? ` Offending \`useOn\`: ${sourceLocation}.` : "")
|
|
@@ -26060,7 +26121,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
|
|
|
26060
26121
|
if (targetElement) {
|
|
26061
26122
|
if (targetElement.type === "script" && key === qVisibleEvent) {
|
|
26062
26123
|
eventKey = "q-d:qinit";
|
|
26063
|
-
if (
|
|
26124
|
+
if (isDev14) {
|
|
26064
26125
|
const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
|
|
26065
26126
|
logWarn(
|
|
26066
26127
|
`You are trying to add the event "${key}" using the \`useVisibleTask$\` hook with the "intersection-observer" strategy, but this only works when the component outputs a DOM element. Falling back to "document-ready" instead.` + (sourceLocation ? ` Offending \`useVisibleTask$\`: ${sourceLocation}.` : "")
|
|
@@ -26147,7 +26208,7 @@ function findFirstElementNode(jsx2) {
|
|
|
26147
26208
|
}
|
|
26148
26209
|
function injectPlaceholderElement(jsx2, placeholder) {
|
|
26149
26210
|
if (isJSXNode(jsx2)) {
|
|
26150
|
-
if (jsx2.type !== Fragment
|
|
26211
|
+
if (jsx2.type !== Fragment) {
|
|
26151
26212
|
return _jsxSorted(Fragment, null, null, [jsx2, placeholder], 0, null);
|
|
26152
26213
|
}
|
|
26153
26214
|
if (jsx2.children == null) {
|
|
@@ -26173,7 +26234,7 @@ function createPlaceholderScriptNode() {
|
|
|
26173
26234
|
}
|
|
26174
26235
|
|
|
26175
26236
|
// packages/qwik/src/core/client/reconcile-keyed-loop.ts
|
|
26176
|
-
import { isDev as
|
|
26237
|
+
import { isDev as isDev15 } from "@qwik.dev/core/build";
|
|
26177
26238
|
function collectChildren(first, last = null) {
|
|
26178
26239
|
const children = [];
|
|
26179
26240
|
let child = first;
|
|
@@ -26188,7 +26249,7 @@ function collectChildren(first, last = null) {
|
|
|
26188
26249
|
}
|
|
26189
26250
|
function renderKeyedRow(item, index, key, renderItem) {
|
|
26190
26251
|
const jsx2 = renderItem(item, index);
|
|
26191
|
-
if (
|
|
26252
|
+
if (isDev15 && !isJSXNode(jsx2)) {
|
|
26192
26253
|
throw new Error("Each item$ must return a single JSX node");
|
|
26193
26254
|
}
|
|
26194
26255
|
jsx2.key = key;
|
|
@@ -26414,7 +26475,7 @@ function reconcileKeyedLoopToParent(container, journal, parent, cursor, items, k
|
|
|
26414
26475
|
);
|
|
26415
26476
|
return maybeThen(result, () => {
|
|
26416
26477
|
const firstInserted = firstInsertedBeforeAnchor(parent, anchor, blockLength);
|
|
26417
|
-
if (
|
|
26478
|
+
if (isDev15 && !firstInserted) {
|
|
26418
26479
|
throw new Error("Failed to insert keyed loop block");
|
|
26419
26480
|
}
|
|
26420
26481
|
anchor = firstInserted;
|
|
@@ -26712,7 +26773,7 @@ function executeReconcile(vNode, container, journal, cursor) {
|
|
|
26712
26773
|
}
|
|
26713
26774
|
|
|
26714
26775
|
// packages/qwik/src/core/shared/cursor/cursor-flush.ts
|
|
26715
|
-
var
|
|
26776
|
+
var DEBUG4 = false;
|
|
26716
26777
|
function executeFlushPhase(cursor, container) {
|
|
26717
26778
|
const cursorData = getCursorData(cursor);
|
|
26718
26779
|
const journal = cursorData.journal;
|
|
@@ -26730,7 +26791,7 @@ var fastInsertBefore = (insertBeforeParent, target, insertBefore) => {
|
|
|
26730
26791
|
_insertBefore.call(insertBeforeParent, target, insertBefore);
|
|
26731
26792
|
};
|
|
26732
26793
|
function _flushJournal(journal) {
|
|
26733
|
-
|
|
26794
|
+
DEBUG4 && console.warn("walkCursor: flushing journal", vnode_journalToString(journal));
|
|
26734
26795
|
let batchParent = null;
|
|
26735
26796
|
let batchBefore = null;
|
|
26736
26797
|
let batchNodes = null;
|
|
@@ -26839,7 +26900,7 @@ function executeAfterFlush(container, cursorData) {
|
|
|
26839
26900
|
cursorData.afterFlushTasks = null;
|
|
26840
26901
|
return;
|
|
26841
26902
|
}
|
|
26842
|
-
|
|
26903
|
+
DEBUG4 && console.warn(
|
|
26843
26904
|
"walkCursor: executeAfterFlush",
|
|
26844
26905
|
visibleTasks.map((t) => t.$qrl$.$symbol$)
|
|
26845
26906
|
);
|
|
@@ -26868,8 +26929,21 @@ var createMacroTask = (fn) => {
|
|
|
26868
26929
|
let macroTask;
|
|
26869
26930
|
if (typeof MessageChannel !== "undefined") {
|
|
26870
26931
|
const channel = new MessageChannel();
|
|
26932
|
+
let active = true;
|
|
26871
26933
|
channel.port1.onmessage = () => fn();
|
|
26872
|
-
macroTask = () =>
|
|
26934
|
+
macroTask = () => {
|
|
26935
|
+
if (active) {
|
|
26936
|
+
channel.port2.postMessage(null);
|
|
26937
|
+
}
|
|
26938
|
+
};
|
|
26939
|
+
macroTask.$destroy$ = () => {
|
|
26940
|
+
if (active) {
|
|
26941
|
+
active = false;
|
|
26942
|
+
channel.port1.onmessage = null;
|
|
26943
|
+
channel.port1.close();
|
|
26944
|
+
channel.port2.close();
|
|
26945
|
+
}
|
|
26946
|
+
};
|
|
26873
26947
|
} else {
|
|
26874
26948
|
macroTask = () => setTimeout(fn);
|
|
26875
26949
|
}
|
|
@@ -26877,8 +26951,8 @@ var createMacroTask = (fn) => {
|
|
|
26877
26951
|
};
|
|
26878
26952
|
|
|
26879
26953
|
// packages/qwik/src/core/shared/cursor/cursor-walker.ts
|
|
26880
|
-
import { isDev as
|
|
26881
|
-
var
|
|
26954
|
+
import { isDev as isDev16, isServer as isServer7 } from "@qwik.dev/core/build";
|
|
26955
|
+
var DEBUG5 = false;
|
|
26882
26956
|
var nextMicroTask = createMicroTask(processCursorQueue);
|
|
26883
26957
|
var nextMacroTask = createMacroTask(processCursorQueue);
|
|
26884
26958
|
var isNextTickScheduled = false;
|
|
@@ -26914,7 +26988,7 @@ function walkCursor(cursor, until) {
|
|
|
26914
26988
|
return;
|
|
26915
26989
|
}
|
|
26916
26990
|
const container = cursorData.container;
|
|
26917
|
-
|
|
26991
|
+
isDev16 && assertDefined(container, "Cursor container not found");
|
|
26918
26992
|
if (!cursor.dirty) {
|
|
26919
26993
|
finishWalk(container, cursor, cursorData, isRunningOnServer);
|
|
26920
26994
|
return;
|
|
@@ -26923,8 +26997,8 @@ function walkCursor(cursor, until) {
|
|
|
26923
26997
|
let currentVNode = null;
|
|
26924
26998
|
let count = 0;
|
|
26925
26999
|
while (currentVNode = cursorData.position) {
|
|
26926
|
-
|
|
26927
|
-
if (
|
|
27000
|
+
DEBUG5 && console.warn("walkCursor", currentVNode.toString());
|
|
27001
|
+
if (DEBUG5 && count++ > 1e3) {
|
|
26928
27002
|
throw new Error("Infinite loop detected in cursor walker");
|
|
26929
27003
|
}
|
|
26930
27004
|
if (cursorData.promise) {
|
|
@@ -26978,7 +27052,7 @@ function walkCursor(cursor, until) {
|
|
|
26978
27052
|
container.handleError(error, currentVNode);
|
|
26979
27053
|
}
|
|
26980
27054
|
if (result && isPromise(result)) {
|
|
26981
|
-
|
|
27055
|
+
DEBUG5 && console.warn("walkCursor: blocking promise", currentVNode.toString());
|
|
26982
27056
|
addCursorBoundary(cursorData, currentVNode);
|
|
26983
27057
|
const blockingPromise2 = result;
|
|
26984
27058
|
cursorData.promise = blockingPromise2;
|
|
@@ -27002,20 +27076,21 @@ function walkCursor(cursor, until) {
|
|
|
27002
27076
|
return true;
|
|
27003
27077
|
}
|
|
27004
27078
|
}
|
|
27005
|
-
|
|
27079
|
+
isDev16 && assertFalse(
|
|
27006
27080
|
!!(cursor.dirty & 1023 /* DIRTY_MASK */ && !cursorData.position),
|
|
27007
27081
|
"Cursor is still dirty and position is not set after walking"
|
|
27008
27082
|
);
|
|
27009
27083
|
finishWalk(container, cursor, cursorData, isRunningOnServer);
|
|
27010
27084
|
}
|
|
27011
|
-
function finishWalk(container, cursor, cursorData,
|
|
27085
|
+
function finishWalk(container, cursor, cursorData, isServer13) {
|
|
27012
27086
|
if (!(cursor.dirty & 1023 /* DIRTY_MASK */)) {
|
|
27013
27087
|
removeCursorFromQueue(cursor, container);
|
|
27014
|
-
|
|
27015
|
-
if (!
|
|
27088
|
+
DEBUG5 && console.warn("walkCursor: cursor done", cursor.toString());
|
|
27089
|
+
if (!isServer13) {
|
|
27016
27090
|
executeFlushPhase(cursor, container);
|
|
27017
27091
|
}
|
|
27018
27092
|
resolveCursorBoundaries(cursorData);
|
|
27093
|
+
clearCursorBoundary(cursor);
|
|
27019
27094
|
if (cursorData.extraPromises) {
|
|
27020
27095
|
Promise.all(cursorData.extraPromises).then(() => {
|
|
27021
27096
|
resolveCursor(container);
|
|
@@ -27026,7 +27101,7 @@ function finishWalk(container, cursor, cursorData, isServer12) {
|
|
|
27026
27101
|
}
|
|
27027
27102
|
}
|
|
27028
27103
|
function resolveCursor(container) {
|
|
27029
|
-
|
|
27104
|
+
DEBUG5 && console.warn(`walkCursor: cursor resolved, ${container.$pendingCount$} remaining`);
|
|
27030
27105
|
container.$checkPendingCount$();
|
|
27031
27106
|
}
|
|
27032
27107
|
function tryDescendDirtyChildren(container, cursorData, currentVNode, cursor) {
|
|
@@ -27104,10 +27179,7 @@ function getNextVNode(vNode, cursor, container) {
|
|
|
27104
27179
|
return getNextVNode(parent, cursor, container);
|
|
27105
27180
|
}
|
|
27106
27181
|
function splitCursorBoundary(container, vNode) {
|
|
27107
|
-
if (!
|
|
27108
|
-
return false;
|
|
27109
|
-
}
|
|
27110
|
-
if (!vNode.props || !(QCursorBoundary in vNode.props) || !container.getHostProp(vNode, QCursorBoundary)) {
|
|
27182
|
+
if (!getOwnCursorBoundary(vNode)) {
|
|
27111
27183
|
return false;
|
|
27112
27184
|
}
|
|
27113
27185
|
if (!isCursor(vNode)) {
|
|
@@ -27118,6 +27190,10 @@ function splitCursorBoundary(container, vNode) {
|
|
|
27118
27190
|
|
|
27119
27191
|
// packages/qwik/src/core/shared/cursor/cursor.ts
|
|
27120
27192
|
function addCursor(container, root, priority) {
|
|
27193
|
+
if (isCursor(root)) {
|
|
27194
|
+
triggerCursors();
|
|
27195
|
+
return root;
|
|
27196
|
+
}
|
|
27121
27197
|
const cursorData = {
|
|
27122
27198
|
afterFlushTasks: null,
|
|
27123
27199
|
extraPromises: null,
|
|
@@ -27161,15 +27237,15 @@ function propagatePath(target) {
|
|
|
27161
27237
|
}
|
|
27162
27238
|
}
|
|
27163
27239
|
}
|
|
27164
|
-
function propagateToCursorRoot(
|
|
27240
|
+
function propagateToCursorRoot(vNode, cursorRoot) {
|
|
27165
27241
|
reusablePath.push(vNode);
|
|
27166
|
-
let cursorBoundary = getOwnCursorBoundary(
|
|
27242
|
+
let cursorBoundary = getOwnCursorBoundary(vNode);
|
|
27167
27243
|
let current = vNode.slotParent || vNode.parent;
|
|
27168
27244
|
while (current) {
|
|
27169
27245
|
const isDirty = current.dirty & 1023 /* DIRTY_MASK */;
|
|
27170
27246
|
const currentIsCursor = isCursor(current);
|
|
27171
27247
|
if (__EXPERIMENTAL__.suspense) {
|
|
27172
|
-
cursorBoundary || (cursorBoundary = getOwnCursorBoundary(
|
|
27248
|
+
cursorBoundary || (cursorBoundary = getOwnCursorBoundary(current) || (isDirty ? getNearestCursorBoundary(current) : null));
|
|
27173
27249
|
}
|
|
27174
27250
|
if (current === cursorRoot || isDirty) {
|
|
27175
27251
|
setNearestCursorBoundary(vNode, cursorBoundary);
|
|
@@ -27195,14 +27271,14 @@ function propagateToCursorRoot(container, vNode, cursorRoot) {
|
|
|
27195
27271
|
reusablePath.length = 0;
|
|
27196
27272
|
throwErrorAndStop("Cursor root not found in current path!");
|
|
27197
27273
|
}
|
|
27198
|
-
function findAndPropagateToBlockingCursor(
|
|
27274
|
+
function findAndPropagateToBlockingCursor(vNode) {
|
|
27199
27275
|
reusablePath.push(vNode);
|
|
27200
|
-
let cursorBoundary =
|
|
27276
|
+
let cursorBoundary = getOwnCursorBoundary(vNode);
|
|
27201
27277
|
let current = vNode.slotParent || vNode.parent;
|
|
27202
27278
|
while (current) {
|
|
27203
27279
|
const currentIsCursor = isCursor(current);
|
|
27204
27280
|
if (__EXPERIMENTAL__.suspense) {
|
|
27205
|
-
cursorBoundary || (cursorBoundary = getOwnCursorBoundary(
|
|
27281
|
+
cursorBoundary || (cursorBoundary = getOwnCursorBoundary(current) || (currentIsCursor ? getNearestCursorBoundary(current) : null));
|
|
27206
27282
|
}
|
|
27207
27283
|
if (currentIsCursor) {
|
|
27208
27284
|
setNearestCursorBoundary(vNode, cursorBoundary);
|
|
@@ -27228,7 +27304,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
27228
27304
|
if (isPromise(result)) {
|
|
27229
27305
|
container.$renderPromise$ = container.$renderPromise$ ? container.$renderPromise$.then(() => result) : result;
|
|
27230
27306
|
}
|
|
27231
|
-
return;
|
|
27307
|
+
return result;
|
|
27232
27308
|
}
|
|
27233
27309
|
const isRealDirty = bits & 1023 /* DIRTY_MASK */;
|
|
27234
27310
|
if ((isRealDirty ? prevDirty & 1023 /* DIRTY_MASK */ : prevDirty) || vNode === cursorRoot) {
|
|
@@ -27236,13 +27312,13 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
27236
27312
|
}
|
|
27237
27313
|
const parent = vNode.slotParent || vNode.parent;
|
|
27238
27314
|
if (cursorRoot && isRealDirty && parent && !parent.dirty) {
|
|
27239
|
-
propagateToCursorRoot(
|
|
27315
|
+
propagateToCursorRoot(vNode, cursorRoot);
|
|
27240
27316
|
return;
|
|
27241
27317
|
}
|
|
27242
27318
|
if (parent && parent.dirty & 1023 /* DIRTY_MASK */) {
|
|
27243
27319
|
setNearestCursorBoundary(
|
|
27244
27320
|
vNode,
|
|
27245
|
-
getOwnCursorBoundary(
|
|
27321
|
+
getOwnCursorBoundary(vNode) || getNearestCursorBoundary(parent)
|
|
27246
27322
|
);
|
|
27247
27323
|
if (isRealDirty) {
|
|
27248
27324
|
parent.dirty |= 64 /* CHILDREN */;
|
|
@@ -27268,11 +27344,11 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
|
|
|
27268
27344
|
}
|
|
27269
27345
|
}
|
|
27270
27346
|
} else if (!isCursor(vNode)) {
|
|
27271
|
-
if (!findAndPropagateToBlockingCursor(
|
|
27347
|
+
if (!findAndPropagateToBlockingCursor(vNode)) {
|
|
27272
27348
|
addCursor(container, vNode, 0);
|
|
27273
27349
|
}
|
|
27274
27350
|
} else {
|
|
27275
|
-
setNearestCursorBoundary(vNode, getOwnCursorBoundary(
|
|
27351
|
+
setNearestCursorBoundary(vNode, getOwnCursorBoundary(vNode));
|
|
27276
27352
|
}
|
|
27277
27353
|
}
|
|
27278
27354
|
function addVNodeOperation(journal, operation) {
|
|
@@ -27280,10 +27356,10 @@ function addVNodeOperation(journal, operation) {
|
|
|
27280
27356
|
}
|
|
27281
27357
|
|
|
27282
27358
|
// packages/qwik/src/core/reactive-primitives/impl/wrapped-signal-impl.ts
|
|
27283
|
-
import { isDev as
|
|
27284
|
-
var
|
|
27285
|
-
var WrappedSignalImpl = class extends (
|
|
27286
|
-
constructor(container, fn, args, fnStr, flags = 1 /* INVALID */
|
|
27359
|
+
import { isDev as isDev17 } from "@qwik.dev/core/build";
|
|
27360
|
+
var _a3, _b2;
|
|
27361
|
+
var WrappedSignalImpl = class extends (_b2 = SignalImpl, _a3 = _EFFECT_BACK_REF, _b2) {
|
|
27362
|
+
constructor(container, fn, args, fnStr, flags = 1 /* INVALID */) {
|
|
27287
27363
|
super(container, NEEDS_COMPUTATION);
|
|
27288
27364
|
__publicField(this, "$args$");
|
|
27289
27365
|
__publicField(this, "$func$");
|
|
@@ -27292,7 +27368,7 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a4 = _EFFECT_BACK_REF,
|
|
|
27292
27368
|
__publicField(this, "$hostElement$");
|
|
27293
27369
|
// important: don't use implemnets BackRef here
|
|
27294
27370
|
// it causes v8 optimizations eager bailouts, because of not consistent class shape
|
|
27295
|
-
__publicField(this,
|
|
27371
|
+
__publicField(this, _a3);
|
|
27296
27372
|
this.$args$ = args;
|
|
27297
27373
|
this.$func$ = fn;
|
|
27298
27374
|
this.$funcStr$ = fnStr;
|
|
@@ -27315,7 +27391,7 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a4 = _EFFECT_BACK_REF,
|
|
|
27315
27391
|
}
|
|
27316
27392
|
get untrackedValue() {
|
|
27317
27393
|
this.$computeIfNeeded$();
|
|
27318
|
-
|
|
27394
|
+
isDev17 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
27319
27395
|
return this.$untrackedValue$;
|
|
27320
27396
|
}
|
|
27321
27397
|
$computeIfNeeded$() {
|
|
@@ -27368,10 +27444,11 @@ function clearEffectSubscription(container, effect) {
|
|
|
27368
27444
|
return;
|
|
27369
27445
|
}
|
|
27370
27446
|
for (const producer of backRefs) {
|
|
27371
|
-
if (producer instanceof
|
|
27372
|
-
clearAsyncSignal(producer, effect);
|
|
27373
|
-
} else if (producer instanceof SignalImpl) {
|
|
27447
|
+
if (producer instanceof SignalImpl) {
|
|
27374
27448
|
clearSignal(container, producer, effect);
|
|
27449
|
+
if (producer instanceof ComputedSignalImpl) {
|
|
27450
|
+
clearAsyncSignalEffects(producer, effect);
|
|
27451
|
+
}
|
|
27375
27452
|
} else if (isPropsProxy(producer)) {
|
|
27376
27453
|
const propsHandler = producer[_PROPS_HANDLER];
|
|
27377
27454
|
clearStoreOrProps(propsHandler, effect);
|
|
@@ -27393,11 +27470,7 @@ function clearSignal(container, producer, effect) {
|
|
|
27393
27470
|
clearAllEffects(container, producer);
|
|
27394
27471
|
}
|
|
27395
27472
|
}
|
|
27396
|
-
function
|
|
27397
|
-
const effects = producer.$effects$;
|
|
27398
|
-
if (effects && effects.has(effect)) {
|
|
27399
|
-
effects.delete(effect);
|
|
27400
|
-
}
|
|
27473
|
+
function clearAsyncSignalEffects(producer, effect) {
|
|
27401
27474
|
const pendingEffects = producer.$loadingEffects$;
|
|
27402
27475
|
if (pendingEffects && pendingEffects.has(effect)) {
|
|
27403
27476
|
pendingEffects.delete(effect);
|
|
@@ -27467,14 +27540,13 @@ var runTask = (task, container, host) => {
|
|
|
27467
27540
|
return result;
|
|
27468
27541
|
};
|
|
27469
27542
|
var Task = class extends BackRef {
|
|
27470
|
-
constructor($flags$, $index$, $el$, $qrl$, $
|
|
27543
|
+
constructor($flags$, $index$, $el$, $qrl$, $destroy$) {
|
|
27471
27544
|
super();
|
|
27472
|
-
this
|
|
27473
|
-
this
|
|
27474
|
-
this
|
|
27475
|
-
this
|
|
27476
|
-
this
|
|
27477
|
-
this.$destroy$ = $destroy$;
|
|
27545
|
+
__publicField(this, "$flags$", $flags$);
|
|
27546
|
+
__publicField(this, "$index$", $index$);
|
|
27547
|
+
__publicField(this, "$el$", $el$);
|
|
27548
|
+
__publicField(this, "$qrl$", $qrl$);
|
|
27549
|
+
__publicField(this, "$destroy$", $destroy$);
|
|
27478
27550
|
__publicField(this, "$destroyPromise$");
|
|
27479
27551
|
__publicField(this, "$taskPromise$", null);
|
|
27480
27552
|
}
|
|
@@ -27484,7 +27556,7 @@ var isTask = (value) => {
|
|
|
27484
27556
|
};
|
|
27485
27557
|
|
|
27486
27558
|
// packages/qwik/src/core/shared/cursor/ssr-chore-execution.ts
|
|
27487
|
-
import { isDev as
|
|
27559
|
+
import { isDev as isDev18 } from "@qwik.dev/core/build";
|
|
27488
27560
|
function _executeSsrChores(container, ssrNode) {
|
|
27489
27561
|
if (!(ssrNode.flags & 1 /* Updatable */)) {
|
|
27490
27562
|
if (ssrNode.dirty & 16 /* NODE_PROPS */) {
|
|
@@ -27493,7 +27565,8 @@ function _executeSsrChores(container, ssrNode) {
|
|
|
27493
27565
|
if (ssrNode.dirty & 32 /* COMPUTE */) {
|
|
27494
27566
|
executeCompute(ssrNode, container);
|
|
27495
27567
|
}
|
|
27496
|
-
if (
|
|
27568
|
+
if (isDev18 && ssrNode.dirty & 1023 /* DIRTY_MASK */ && !(ssrNode.flags & 2 /* WarnedStreamedChore */)) {
|
|
27569
|
+
ssrNode.flags |= 2 /* WarnedStreamedChore */;
|
|
27497
27570
|
const warningMessage = `A chore was scheduled on a host element that has already been streamed to the client.
|
|
27498
27571
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
27499
27572
|
|
|
@@ -27592,29 +27665,34 @@ var getAsyncLocalStorage = () => {
|
|
|
27592
27665
|
};
|
|
27593
27666
|
|
|
27594
27667
|
// packages/qwik/src/core/shared/jsx/bind-handlers.ts
|
|
27595
|
-
var
|
|
27596
|
-
if (typeof
|
|
27668
|
+
var withScopeFromQL = (captureDeltas, element, callback) => {
|
|
27669
|
+
if (typeof captureDeltas === "string") {
|
|
27597
27670
|
const container = getDomContainer(element);
|
|
27598
|
-
|
|
27671
|
+
return whenContainerDataReady(container, () => {
|
|
27672
|
+
setCaptures(deserializeCaptureDeltas(container, captureDeltas));
|
|
27673
|
+
return callback();
|
|
27674
|
+
});
|
|
27599
27675
|
}
|
|
27600
|
-
return
|
|
27676
|
+
return callback();
|
|
27601
27677
|
};
|
|
27602
27678
|
function _val(_, element) {
|
|
27603
|
-
|
|
27604
|
-
|
|
27605
|
-
|
|
27679
|
+
return withScopeFromQL(this, element, () => {
|
|
27680
|
+
const signal = _captures[0];
|
|
27681
|
+
signal.value = element.type === "number" ? element.valueAsNumber : element.value;
|
|
27682
|
+
});
|
|
27606
27683
|
}
|
|
27607
27684
|
function _chk(_, element) {
|
|
27608
|
-
|
|
27609
|
-
|
|
27610
|
-
|
|
27685
|
+
return withScopeFromQL(this, element, () => {
|
|
27686
|
+
const signal = _captures[0];
|
|
27687
|
+
signal.value = element.checked;
|
|
27688
|
+
});
|
|
27611
27689
|
}
|
|
27612
27690
|
|
|
27613
27691
|
// packages/qwik/src/core/shared/serdes/subscription-patch.ts
|
|
27614
27692
|
var SubscriptionPatch = class {
|
|
27615
27693
|
constructor(rootId = 0, subscriptions = /* @__PURE__ */ new Set()) {
|
|
27616
|
-
this
|
|
27617
|
-
this
|
|
27694
|
+
__publicField(this, "rootId", rootId);
|
|
27695
|
+
__publicField(this, "subscriptions", subscriptions);
|
|
27618
27696
|
}
|
|
27619
27697
|
};
|
|
27620
27698
|
|
|
@@ -27631,6 +27709,7 @@ var stringifyRootRefPath = (path) => {
|
|
|
27631
27709
|
};
|
|
27632
27710
|
var writeStringRootRef = (writer, id) => writer.write(String(id));
|
|
27633
27711
|
var writeStringRootRefPath = (writer, path) => writer.write(stringifyRootRefPath(path));
|
|
27712
|
+
var writeStringRootRefDelta = (writer, id, base2) => writer.write(String(id - base2));
|
|
27634
27713
|
var createStringStreamWriter = (write) => ({
|
|
27635
27714
|
write,
|
|
27636
27715
|
writeRootRef(id) {
|
|
@@ -27638,11 +27717,14 @@ var createStringStreamWriter = (write) => ({
|
|
|
27638
27717
|
},
|
|
27639
27718
|
writeRootRefPath(path) {
|
|
27640
27719
|
return writeStringRootRefPath(this, path);
|
|
27720
|
+
},
|
|
27721
|
+
writeRootRefDelta(id, base2) {
|
|
27722
|
+
return writeStringRootRefDelta(this, id, base2);
|
|
27641
27723
|
}
|
|
27642
27724
|
});
|
|
27643
27725
|
|
|
27644
27726
|
// packages/qwik/src/core/shared/serdes/serialize.ts
|
|
27645
|
-
import { isDev as
|
|
27727
|
+
import { isDev as isDev19 } from "@qwik.dev/core/build";
|
|
27646
27728
|
|
|
27647
27729
|
// packages/qwik/src/core/shared/ssr-const.ts
|
|
27648
27730
|
var LT = "<";
|
|
@@ -27661,7 +27743,7 @@ var COMMA = ",";
|
|
|
27661
27743
|
// packages/qwik/src/core/shared/serdes/serialize.ts
|
|
27662
27744
|
var Serializer = class {
|
|
27663
27745
|
constructor($serializationContext$) {
|
|
27664
|
-
this
|
|
27746
|
+
__publicField(this, "$serializationContext$", $serializationContext$);
|
|
27665
27747
|
__publicField(this, "$rootIdx$", 0);
|
|
27666
27748
|
__publicField(this, "$forwardRefs$", []);
|
|
27667
27749
|
__publicField(this, "$forwardRefsId$", 0);
|
|
@@ -27782,6 +27864,36 @@ var Serializer = class {
|
|
|
27782
27864
|
}
|
|
27783
27865
|
return Number(key);
|
|
27784
27866
|
}
|
|
27867
|
+
rebaseQrlCaptureDeltas$(baseRootId, captureDeltas) {
|
|
27868
|
+
let previousCaptureId = 0;
|
|
27869
|
+
let previousOutputBase = baseRootId;
|
|
27870
|
+
const deltaList = captureDeltas.split(" ");
|
|
27871
|
+
for (let i2 = 0; i2 < deltaList.length; i2++) {
|
|
27872
|
+
const captureId = previousCaptureId + Number(deltaList[i2]);
|
|
27873
|
+
deltaList[i2] = String(captureId - previousOutputBase);
|
|
27874
|
+
previousCaptureId = captureId;
|
|
27875
|
+
previousOutputBase = captureId;
|
|
27876
|
+
}
|
|
27877
|
+
return deltaList.join(" ");
|
|
27878
|
+
}
|
|
27879
|
+
outputShortStringConstant$(value) {
|
|
27880
|
+
switch (value) {
|
|
27881
|
+
case ":":
|
|
27882
|
+
this.output(3 /* Constant */, 18 /* Colon */);
|
|
27883
|
+
return true;
|
|
27884
|
+
case ".":
|
|
27885
|
+
this.output(3 /* Constant */, 19 /* Dot */);
|
|
27886
|
+
return true;
|
|
27887
|
+
case "id":
|
|
27888
|
+
this.output(3 /* Constant */, 20 /* Id */);
|
|
27889
|
+
return true;
|
|
27890
|
+
case "ref":
|
|
27891
|
+
this.output(3 /* Constant */, 21 /* Ref */);
|
|
27892
|
+
return true;
|
|
27893
|
+
default:
|
|
27894
|
+
return false;
|
|
27895
|
+
}
|
|
27896
|
+
}
|
|
27785
27897
|
outputString(value) {
|
|
27786
27898
|
const s = this.stringNeedsJsonEscape$(value) ? JSON.stringify(value) : QUOTE + value + QUOTE;
|
|
27787
27899
|
let angleBracketIdx = -1;
|
|
@@ -27799,6 +27911,9 @@ var Serializer = class {
|
|
|
27799
27911
|
writeRootRefPath(path) {
|
|
27800
27912
|
this.$writer$.writeRootRefPath(path);
|
|
27801
27913
|
}
|
|
27914
|
+
writeRootRefDelta(id, base2) {
|
|
27915
|
+
this.$writer$.writeRootRefDelta(id, base2);
|
|
27916
|
+
}
|
|
27802
27917
|
outputStringChunks(chunks) {
|
|
27803
27918
|
this.$writer$.write(QUOTE);
|
|
27804
27919
|
for (let i2 = 0; i2 < chunks.length; i2++) {
|
|
@@ -27807,6 +27922,8 @@ var Serializer = class {
|
|
|
27807
27922
|
this.$writer$.write(chunk);
|
|
27808
27923
|
} else if (typeof chunk === "number") {
|
|
27809
27924
|
this.writeRootRef(chunk);
|
|
27925
|
+
} else if ("base" in chunk) {
|
|
27926
|
+
this.writeRootRefDelta(chunk.id, chunk.base);
|
|
27810
27927
|
} else {
|
|
27811
27928
|
this.writeRootRefPath(chunk.path);
|
|
27812
27929
|
}
|
|
@@ -27914,6 +28031,8 @@ var Serializer = class {
|
|
|
27914
28031
|
case "string":
|
|
27915
28032
|
if (value.length === 0) {
|
|
27916
28033
|
this.output(3 /* Constant */, 4 /* EmptyString */);
|
|
28034
|
+
} else if (this.outputShortStringConstant$(value)) {
|
|
28035
|
+
break;
|
|
27917
28036
|
} else {
|
|
27918
28037
|
if (value.length < 4 || this.getSeenRefOrOutput(value, index)) {
|
|
27919
28038
|
this.output(0 /* Plain */, value);
|
|
@@ -27945,29 +28064,38 @@ var Serializer = class {
|
|
|
27945
28064
|
this.output(3 /* Constant */, 11 /* Fragment */);
|
|
27946
28065
|
} else if (isQrl(value)) {
|
|
27947
28066
|
if (this.getSeenRefOrOutput(value, index)) {
|
|
27948
|
-
const [chunk, symbol,
|
|
28067
|
+
const [chunk, symbol, captureDeltasFromZero] = qrlToString(
|
|
27949
28068
|
this.$serializationContext$,
|
|
27950
28069
|
value,
|
|
27951
28070
|
true
|
|
27952
28071
|
);
|
|
27953
28072
|
let data;
|
|
27954
28073
|
if (chunk !== "") {
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
|
|
27960
|
-
|
|
27961
|
-
|
|
28074
|
+
const chunkRootId = this.$serializationContext$.$addRoot$(chunk);
|
|
28075
|
+
const symbolRootId = this.$serializationContext$.$addRoot$(symbol);
|
|
28076
|
+
const captureDeltas = captureDeltasFromZero ? this.rebaseQrlCaptureDeltas$(symbolRootId, captureDeltasFromZero) : null;
|
|
28077
|
+
data = [chunkRootId, "#", { id: symbolRootId, base: chunkRootId }];
|
|
28078
|
+
if (captureDeltasFromZero) {
|
|
28079
|
+
let previousRootId = 0;
|
|
28080
|
+
let previousOutputBase = symbolRootId;
|
|
28081
|
+
let start = 0;
|
|
27962
28082
|
data.push("#");
|
|
27963
|
-
for (let i2 = 0; i2
|
|
27964
|
-
if (i2
|
|
27965
|
-
|
|
28083
|
+
for (let i2 = 0; i2 <= captureDeltasFromZero.length; i2++) {
|
|
28084
|
+
if (i2 === captureDeltasFromZero.length || captureDeltasFromZero[i2] === " ") {
|
|
28085
|
+
if (i2 > start) {
|
|
28086
|
+
const captureId = previousRootId + Number(captureDeltasFromZero.slice(start, i2));
|
|
28087
|
+
if (start > 0) {
|
|
28088
|
+
data.push(" ");
|
|
28089
|
+
}
|
|
28090
|
+
data.push({ id: captureId, base: previousOutputBase });
|
|
28091
|
+
previousRootId = captureId;
|
|
28092
|
+
previousOutputBase = captureId;
|
|
28093
|
+
}
|
|
28094
|
+
start = i2 + 1;
|
|
27966
28095
|
}
|
|
27967
|
-
data.push(Number(captureIds[i2]));
|
|
27968
28096
|
}
|
|
27969
28097
|
}
|
|
27970
|
-
const qrlKey =
|
|
28098
|
+
const qrlKey = `${chunkRootId}#${symbolRootId - chunkRootId}${captureDeltas ? "#" + captureDeltas : ""}`;
|
|
27971
28099
|
const existing = this.$qrlMap$.get(qrlKey);
|
|
27972
28100
|
if (existing) {
|
|
27973
28101
|
const ref = this.$serializationContext$.$addRoot$(existing);
|
|
@@ -28023,12 +28151,21 @@ var Serializer = class {
|
|
|
28023
28151
|
value[_PROPS_HANDLER].$effects$
|
|
28024
28152
|
]);
|
|
28025
28153
|
} else if (value instanceof SubscriptionData) {
|
|
28026
|
-
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28154
|
+
const { $scopedStyleIdPrefix$, $isConst$ } = value.data;
|
|
28155
|
+
if ($scopedStyleIdPrefix$ === null) {
|
|
28156
|
+
this.output(
|
|
28157
|
+
$isConst$ ? 42 /* SubscriptionDataConstTrue */ : 43 /* SubscriptionDataConstFalse */,
|
|
28158
|
+
0
|
|
28159
|
+
);
|
|
28160
|
+
} else {
|
|
28161
|
+
this.output(39 /* SubscriptionData */, [$scopedStyleIdPrefix$, $isConst$]);
|
|
28162
|
+
}
|
|
28030
28163
|
} else if (value instanceof EffectSubscription) {
|
|
28031
|
-
|
|
28164
|
+
if (value.data === null) {
|
|
28165
|
+
this.output(44 /* EffectSubscriptionNoData */, [value.consumer, value.property]);
|
|
28166
|
+
} else {
|
|
28167
|
+
this.output(40 /* EffectSubscription */, [value.consumer, value.property, value.data]);
|
|
28168
|
+
}
|
|
28032
28169
|
} else if (value instanceof SubscriptionPatch) {
|
|
28033
28170
|
this.output(41 /* SubscriptionPatch */, [value.rootId, value.subscriptions]);
|
|
28034
28171
|
} else if (isStore(value)) {
|
|
@@ -28080,7 +28217,7 @@ var Serializer = class {
|
|
|
28080
28217
|
}
|
|
28081
28218
|
}
|
|
28082
28219
|
}
|
|
28083
|
-
this.output(5 /* Object */, out.length ? out :
|
|
28220
|
+
this.output(5 /* Object */, out.length ? out : EMPTY_OBJECT_PAYLOAD);
|
|
28084
28221
|
}
|
|
28085
28222
|
} else if (this.$serializationContext$.$isDomRef$(value)) {
|
|
28086
28223
|
this.$serializationContext$.$markSsrNodeForSerialization$(
|
|
@@ -28120,12 +28257,12 @@ var Serializer = class {
|
|
|
28120
28257
|
const shouldNeverSerialize = value.$flags$ & 8 /* SERIALIZATION_STRATEGY_NEVER */;
|
|
28121
28258
|
const isInvalid = value.$flags$ & 1 /* INVALID */;
|
|
28122
28259
|
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
28123
|
-
const isAsync = value
|
|
28124
|
-
const
|
|
28260
|
+
const isAsync = !!(value.$flags$ & 512 /* ASYNC_MODE */);
|
|
28261
|
+
const isErrored = isAsync && !!value.$untrackedError$;
|
|
28125
28262
|
const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
|
|
28126
28263
|
const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
|
|
28127
28264
|
const asyncFlags = isAsync && value.$flags$ & ~24 /* SERIALIZATION_ALL_STRATEGIES */ || void 0;
|
|
28128
|
-
if (isInvalid || isSkippable) {
|
|
28265
|
+
if (isInvalid || isSkippable || isErrored) {
|
|
28129
28266
|
v = NEEDS_COMPUTATION;
|
|
28130
28267
|
} else if (shouldAlwaysSerialize) {
|
|
28131
28268
|
v = value.$untrackedValue$;
|
|
@@ -28137,11 +28274,10 @@ var Serializer = class {
|
|
|
28137
28274
|
out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
|
|
28138
28275
|
out.push(asyncFlags || void 0);
|
|
28139
28276
|
}
|
|
28140
|
-
if (v !== NEEDS_COMPUTATION ||
|
|
28277
|
+
if (v !== NEEDS_COMPUTATION || concurrency !== void 0 || timeout !== void 0) {
|
|
28141
28278
|
out.push(v === void 0 ? explicitUndefined : v);
|
|
28142
28279
|
}
|
|
28143
28280
|
if (isAsync) {
|
|
28144
|
-
out.push(expires);
|
|
28145
28281
|
out.push(concurrency);
|
|
28146
28282
|
out.push(timeout);
|
|
28147
28283
|
}
|
|
@@ -28158,28 +28294,12 @@ var Serializer = class {
|
|
|
28158
28294
|
this.output(6 /* URL */, value.href);
|
|
28159
28295
|
} else if (value instanceof Date) {
|
|
28160
28296
|
this.output(7 /* Date */, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
|
|
28161
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.Duration) {
|
|
28162
|
-
this.output(15 /* TemporalDuration */, value.toJSON());
|
|
28163
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.Instant) {
|
|
28164
|
-
this.output(16 /* TemporalInstant */, value.toJSON());
|
|
28165
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDate) {
|
|
28166
|
-
this.output(17 /* TemporalPlainDate */, value.toJSON());
|
|
28167
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDateTime) {
|
|
28168
|
-
this.output(18 /* TemporalPlainDateTime */, value.toJSON());
|
|
28169
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainMonthDay) {
|
|
28170
|
-
this.output(19 /* TemporalPlainMonthDay */, value.toJSON());
|
|
28171
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainTime) {
|
|
28172
|
-
this.output(20 /* TemporalPlainTime */, value.toJSON());
|
|
28173
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainYearMonth) {
|
|
28174
|
-
this.output(21 /* TemporalPlainYearMonth */, value.toJSON());
|
|
28175
|
-
} else if (this.$hasTemporal$ && value instanceof Temporal.ZonedDateTime) {
|
|
28176
|
-
this.output(22 /* TemporalZonedDateTime */, value.toJSON());
|
|
28177
28297
|
} else if (value instanceof RegExp) {
|
|
28178
28298
|
this.output(8 /* Regex */, value.toString());
|
|
28179
28299
|
} else if (value instanceof Error) {
|
|
28180
28300
|
const out = [value.message];
|
|
28181
28301
|
out.push(...Object.entries(value).flat());
|
|
28182
|
-
if (
|
|
28302
|
+
if (isDev19) {
|
|
28183
28303
|
out.push("stack", value.stack);
|
|
28184
28304
|
}
|
|
28185
28305
|
this.output(23 /* Error */, out);
|
|
@@ -28233,7 +28353,7 @@ var Serializer = class {
|
|
|
28233
28353
|
}
|
|
28234
28354
|
this.output(37 /* JSXNode */, out);
|
|
28235
28355
|
} else if (value instanceof Task) {
|
|
28236
|
-
const out = [value.$qrl$, value.$flags$, value.$index$, value.$el
|
|
28356
|
+
const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$];
|
|
28237
28357
|
while (out[out.length - 1] === void 0) {
|
|
28238
28358
|
out.pop();
|
|
28239
28359
|
}
|
|
@@ -28277,6 +28397,22 @@ var Serializer = class {
|
|
|
28277
28397
|
}
|
|
28278
28398
|
this.output(2 /* ForwardRef */, this.getForwardRefId(forwardRefId));
|
|
28279
28399
|
}
|
|
28400
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.Duration) {
|
|
28401
|
+
this.output(15 /* TemporalDuration */, value.toJSON());
|
|
28402
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.Instant) {
|
|
28403
|
+
this.output(16 /* TemporalInstant */, value.toJSON());
|
|
28404
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDate) {
|
|
28405
|
+
this.output(17 /* TemporalPlainDate */, value.toJSON());
|
|
28406
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDateTime) {
|
|
28407
|
+
this.output(18 /* TemporalPlainDateTime */, value.toJSON());
|
|
28408
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainMonthDay) {
|
|
28409
|
+
this.output(19 /* TemporalPlainMonthDay */, value.toJSON());
|
|
28410
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainTime) {
|
|
28411
|
+
this.output(20 /* TemporalPlainTime */, value.toJSON());
|
|
28412
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainYearMonth) {
|
|
28413
|
+
this.output(21 /* TemporalPlainYearMonth */, value.toJSON());
|
|
28414
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.ZonedDateTime) {
|
|
28415
|
+
this.output(22 /* TemporalZonedDateTime */, value.toJSON());
|
|
28280
28416
|
} else if (vnode_isVNode(value)) {
|
|
28281
28417
|
this.output(3 /* Constant */, 0 /* Undefined */);
|
|
28282
28418
|
} else {
|
|
@@ -28389,11 +28525,11 @@ var Serializer = class {
|
|
|
28389
28525
|
};
|
|
28390
28526
|
var PromiseResult = class {
|
|
28391
28527
|
constructor($type$, $resolved$, $value$, $effects$ = void 0, $qrl$ = void 0) {
|
|
28392
|
-
this
|
|
28393
|
-
this
|
|
28394
|
-
this
|
|
28395
|
-
this
|
|
28396
|
-
this
|
|
28528
|
+
__publicField(this, "$type$", $type$);
|
|
28529
|
+
__publicField(this, "$resolved$", $resolved$);
|
|
28530
|
+
__publicField(this, "$value$", $value$);
|
|
28531
|
+
__publicField(this, "$effects$", $effects$);
|
|
28532
|
+
__publicField(this, "$qrl$", $qrl$);
|
|
28397
28533
|
}
|
|
28398
28534
|
};
|
|
28399
28535
|
function getCustomSerializerPromise(signal, value) {
|
|
@@ -28426,7 +28562,7 @@ var discoverValuesForVNodeData = (vnodeData, callback) => {
|
|
|
28426
28562
|
if (isSsrAttrs(value)) {
|
|
28427
28563
|
for (const key in value) {
|
|
28428
28564
|
const attrValue = value[key];
|
|
28429
|
-
if (attrValue == null || typeof attrValue === "string" || typeof attrValue === "number" && key === ELEMENT_ID || key === ELEMENT_PROPS && isObjectEmpty(attrValue)) {
|
|
28565
|
+
if (attrValue == null || typeof attrValue === "string" || typeof attrValue === "number" && key === ELEMENT_ID || key === ELEMENT_PROPS && (isObjectEmpty(attrValue) || shouldSkipComponentProps(value, attrValue))) {
|
|
28430
28566
|
continue;
|
|
28431
28567
|
}
|
|
28432
28568
|
callback(attrValue);
|
|
@@ -28435,6 +28571,19 @@ var discoverValuesForVNodeData = (vnodeData, callback) => {
|
|
|
28435
28571
|
}
|
|
28436
28572
|
};
|
|
28437
28573
|
var isSsrAttrs = (value) => typeof value === "object" && value !== null && !isObjectEmpty(value);
|
|
28574
|
+
var shouldSkipComponentProps = (attrs, value, isDevMode = isDev19) => {
|
|
28575
|
+
if (isDevMode || !Object.prototype.hasOwnProperty.call(attrs, OnRenderProp)) {
|
|
28576
|
+
return false;
|
|
28577
|
+
}
|
|
28578
|
+
const owner = value[_OWNER];
|
|
28579
|
+
return isObjectEmpty(owner.varProps) && !hasPropsEffects(value) && !hasComponentBackRef(attrs[QBackRefs]);
|
|
28580
|
+
};
|
|
28581
|
+
var hasPropsEffects = (propsProxy) => {
|
|
28582
|
+
return !!propsProxy[_PROPS_HANDLER].$effects$?.size;
|
|
28583
|
+
};
|
|
28584
|
+
var hasComponentBackRef = (backRefs) => {
|
|
28585
|
+
return backRefs instanceof Map && backRefs.has(":" /* COMPONENT */);
|
|
28586
|
+
};
|
|
28438
28587
|
function isObjectLiteral(obj) {
|
|
28439
28588
|
const prototype = Object.getPrototypeOf(obj);
|
|
28440
28589
|
return prototype == null || prototype === Object.prototype || prototype === Array.prototype;
|
|
@@ -28452,7 +28601,7 @@ function serializeWrappingFn(serializationContext, value) {
|
|
|
28452
28601
|
}
|
|
28453
28602
|
var SerializationWeakRef = class {
|
|
28454
28603
|
constructor($obj$) {
|
|
28455
|
-
this
|
|
28604
|
+
__publicField(this, "$obj$", $obj$);
|
|
28456
28605
|
}
|
|
28457
28606
|
};
|
|
28458
28607
|
var _serializationWeakRef = (obj) => new SerializationWeakRef(obj);
|
|
@@ -28461,17 +28610,17 @@ var _serializationWeakRef = (obj) => new SerializationWeakRef(obj);
|
|
|
28461
28610
|
var isDomRef = (obj) => false;
|
|
28462
28611
|
var SerializationBackRef = class {
|
|
28463
28612
|
constructor($path$) {
|
|
28464
|
-
this
|
|
28613
|
+
__publicField(this, "$path$", $path$);
|
|
28465
28614
|
}
|
|
28466
28615
|
};
|
|
28467
28616
|
var SerializationContextImpl = class {
|
|
28468
28617
|
constructor(NodeConstructor, DomRefConstructor, $symbolToChunkResolver$, $setProp$, $storeProxyMap$, $writer$) {
|
|
28469
|
-
this
|
|
28470
|
-
this
|
|
28471
|
-
this
|
|
28472
|
-
this
|
|
28473
|
-
this
|
|
28474
|
-
this
|
|
28618
|
+
__publicField(this, "NodeConstructor", NodeConstructor);
|
|
28619
|
+
__publicField(this, "DomRefConstructor", DomRefConstructor);
|
|
28620
|
+
__publicField(this, "$symbolToChunkResolver$", $symbolToChunkResolver$);
|
|
28621
|
+
__publicField(this, "$setProp$", $setProp$);
|
|
28622
|
+
__publicField(this, "$storeProxyMap$", $storeProxyMap$);
|
|
28623
|
+
__publicField(this, "$writer$", $writer$);
|
|
28475
28624
|
__publicField(this, "$seenObjsMap$", /* @__PURE__ */ new Map());
|
|
28476
28625
|
__publicField(this, "$syncFnMap$", /* @__PURE__ */ new Map());
|
|
28477
28626
|
__publicField(this, "$syncFnOffset$", 0);
|
|
@@ -28692,7 +28841,7 @@ var _SharedContainer = class {
|
|
|
28692
28841
|
};
|
|
28693
28842
|
|
|
28694
28843
|
// packages/qwik/src/core/shared/serdes/preprocess-state.ts
|
|
28695
|
-
function
|
|
28844
|
+
function* preprocessStateIterator(data, container, startIndex = 0) {
|
|
28696
28845
|
const isRootDeepRef = (type, value) => {
|
|
28697
28846
|
return type === 1 /* RootRef */ && typeof value === "string" && value.indexOf(" ") !== -1;
|
|
28698
28847
|
};
|
|
@@ -28734,23 +28883,103 @@ function preprocessState(data, container, segmentId, startIndex = 0) {
|
|
|
28734
28883
|
} else if (isForwardRefsMap(data[i2])) {
|
|
28735
28884
|
container.$forwardRefs$ = data[i2 + 1];
|
|
28736
28885
|
}
|
|
28886
|
+
yield;
|
|
28737
28887
|
}
|
|
28738
28888
|
}
|
|
28739
28889
|
|
|
28740
28890
|
// packages/qwik/src/core/shared/serdes/serdes.public.ts
|
|
28741
|
-
import { isDev as
|
|
28891
|
+
import { isDev as isDev20 } from "@qwik.dev/core/build";
|
|
28892
|
+
|
|
28893
|
+
// packages/qwik/src/core/client/yielding-iterator.ts
|
|
28894
|
+
var YIELD_INTERVAL = 10;
|
|
28895
|
+
var scheduleYieldingIterator = (state) => {
|
|
28896
|
+
if (!state.$scheduled$) {
|
|
28897
|
+
state.$scheduled$ = true;
|
|
28898
|
+
state.$schedule$();
|
|
28899
|
+
}
|
|
28900
|
+
};
|
|
28901
|
+
var runYieldingIterator = (state, onDone, onError) => {
|
|
28902
|
+
state.$scheduled$ = false;
|
|
28903
|
+
const deadline = performance.now() + YIELD_INTERVAL;
|
|
28904
|
+
let count = 0;
|
|
28905
|
+
try {
|
|
28906
|
+
while (true) {
|
|
28907
|
+
const result = state.$iterator$.next();
|
|
28908
|
+
if (result.done) {
|
|
28909
|
+
onDone(result.value);
|
|
28910
|
+
return;
|
|
28911
|
+
}
|
|
28912
|
+
if ((++count & 31) === 0 && performance.now() >= deadline) {
|
|
28913
|
+
scheduleYieldingIterator(state);
|
|
28914
|
+
return;
|
|
28915
|
+
}
|
|
28916
|
+
}
|
|
28917
|
+
} catch (error) {
|
|
28918
|
+
onError(error);
|
|
28919
|
+
}
|
|
28920
|
+
};
|
|
28921
|
+
var createYieldingIteratorState = (iterator, onDone, onError) => {
|
|
28922
|
+
const state = {
|
|
28923
|
+
$iterator$: iterator,
|
|
28924
|
+
$schedule$: void 0,
|
|
28925
|
+
$scheduled$: false
|
|
28926
|
+
};
|
|
28927
|
+
const schedule = createMacroTask(() => {
|
|
28928
|
+
runYieldingIterator(
|
|
28929
|
+
state,
|
|
28930
|
+
(value) => {
|
|
28931
|
+
schedule.$destroy$?.();
|
|
28932
|
+
onDone(value);
|
|
28933
|
+
},
|
|
28934
|
+
(error) => {
|
|
28935
|
+
schedule.$destroy$?.();
|
|
28936
|
+
onError(error);
|
|
28937
|
+
}
|
|
28938
|
+
);
|
|
28939
|
+
});
|
|
28940
|
+
state.$schedule$ = schedule;
|
|
28941
|
+
return state;
|
|
28942
|
+
};
|
|
28943
|
+
|
|
28944
|
+
// packages/qwik/src/core/shared/serdes/serdes.public.ts
|
|
28742
28945
|
function getObjectById(id, stateData) {
|
|
28743
28946
|
if (typeof id === "string") {
|
|
28744
28947
|
id = parseInt(id, 10);
|
|
28745
28948
|
return stateData[id];
|
|
28746
28949
|
}
|
|
28747
|
-
|
|
28950
|
+
isDev20 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
|
|
28748
28951
|
return stateData[id];
|
|
28749
28952
|
}
|
|
28750
28953
|
|
|
28751
28954
|
// packages/qwik/src/core/shared/serdes/allocate.ts
|
|
28752
28955
|
var resolvers = /* @__PURE__ */ new WeakMap();
|
|
28753
|
-
var
|
|
28956
|
+
var BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
28957
|
+
var BASE64_REGEXP = /^[A-Za-z0-9+/]*$/;
|
|
28958
|
+
var isCanonicalBase64 = (value) => {
|
|
28959
|
+
if (typeof value !== "string" || !BASE64_REGEXP.test(value)) {
|
|
28960
|
+
return false;
|
|
28961
|
+
}
|
|
28962
|
+
const rest = value.length % 4;
|
|
28963
|
+
if (rest === 0) {
|
|
28964
|
+
return true;
|
|
28965
|
+
}
|
|
28966
|
+
if (rest === 1) {
|
|
28967
|
+
return false;
|
|
28968
|
+
}
|
|
28969
|
+
const lastValue = BASE64_ALPHABET.indexOf(value[value.length - 1]);
|
|
28970
|
+
return (lastValue & (rest === 2 ? 15 : 3)) === 0;
|
|
28971
|
+
};
|
|
28972
|
+
var beginDeserialization = (container) => {
|
|
28973
|
+
const ownsPendingStoreTargets = container.$pendingStoreTargets$ === void 0;
|
|
28974
|
+
container.$pendingStoreTargets$ ?? (container.$pendingStoreTargets$ = /* @__PURE__ */ new Map());
|
|
28975
|
+
return ownsPendingStoreTargets;
|
|
28976
|
+
};
|
|
28977
|
+
var endDeserialization = (container, ownsPendingStoreTargets) => {
|
|
28978
|
+
if (ownsPendingStoreTargets) {
|
|
28979
|
+
container.$pendingStoreTargets$.clear();
|
|
28980
|
+
container.$pendingStoreTargets$ = void 0;
|
|
28981
|
+
}
|
|
28982
|
+
};
|
|
28754
28983
|
var allocate = (container, typeId, value) => {
|
|
28755
28984
|
switch (typeId) {
|
|
28756
28985
|
case 0 /* Plain */:
|
|
@@ -28775,13 +29004,18 @@ var allocate = (container, typeId, value) => {
|
|
|
28775
29004
|
case 9 /* QRL */: {
|
|
28776
29005
|
let qrl;
|
|
28777
29006
|
if (typeof value === "string") {
|
|
28778
|
-
const
|
|
28779
|
-
const
|
|
28780
|
-
const
|
|
29007
|
+
const serializedQrl = value;
|
|
29008
|
+
const firstHash = serializedQrl.indexOf("#");
|
|
29009
|
+
const secondHash = serializedQrl.indexOf("#", firstHash + 1);
|
|
29010
|
+
const chunkRootId = Number(serializedQrl.slice(0, firstHash));
|
|
29011
|
+
const symbolDelta = secondHash === -1 ? Number(serializedQrl.slice(firstHash + 1)) : Number(serializedQrl.slice(firstHash + 1, secondHash));
|
|
29012
|
+
const symbolRootId = chunkRootId + symbolDelta;
|
|
29013
|
+
const chunk = container.$getObjectById$(chunkRootId);
|
|
29014
|
+
const symbol = container.$getObjectById$(symbolRootId);
|
|
28781
29015
|
qrl = createQRLWithBackChannel(
|
|
28782
29016
|
chunk,
|
|
28783
29017
|
symbol,
|
|
28784
|
-
|
|
29018
|
+
secondHash !== -1 ? serializedQrl : null,
|
|
28785
29019
|
container
|
|
28786
29020
|
);
|
|
28787
29021
|
} else {
|
|
@@ -28790,7 +29024,7 @@ var allocate = (container, typeId, value) => {
|
|
|
28790
29024
|
return qrl;
|
|
28791
29025
|
}
|
|
28792
29026
|
case 28 /* Task */:
|
|
28793
|
-
return new Task(-1, -1, null, null, null
|
|
29027
|
+
return new Task(-1, -1, null, null, null);
|
|
28794
29028
|
case 6 /* URL */:
|
|
28795
29029
|
return new URL(value);
|
|
28796
29030
|
case 7 /* Date */:
|
|
@@ -28835,7 +29069,7 @@ var allocate = (container, typeId, value) => {
|
|
|
28835
29069
|
const storeValue = allocate(container, t, v);
|
|
28836
29070
|
const store = getOrCreateStore(storeValue, 0 /* NONE */, container);
|
|
28837
29071
|
if (needsInflation(t)) {
|
|
28838
|
-
pendingStoreTargets
|
|
29072
|
+
container.$pendingStoreTargets$.set(storeValue, { t, v });
|
|
28839
29073
|
}
|
|
28840
29074
|
data[0] = 0 /* Plain */;
|
|
28841
29075
|
data[1] = storeValue;
|
|
@@ -28864,12 +29098,16 @@ var allocate = (container, typeId, value) => {
|
|
|
28864
29098
|
promise.catch(() => {
|
|
28865
29099
|
});
|
|
28866
29100
|
return promise;
|
|
28867
|
-
case 27 /* Uint8Array */:
|
|
29101
|
+
case 27 /* Uint8Array */: {
|
|
29102
|
+
if (!isCanonicalBase64(value)) {
|
|
29103
|
+
throw qError(38 /* invalidUint8ArrayPayload */);
|
|
29104
|
+
}
|
|
28868
29105
|
const encodedLength = value.length;
|
|
28869
|
-
const blocks = encodedLength
|
|
28870
|
-
const rest = encodedLength
|
|
29106
|
+
const blocks = Math.floor(encodedLength / 4);
|
|
29107
|
+
const rest = encodedLength % 4;
|
|
28871
29108
|
const decodedLength = blocks * 3 + (rest ? rest - 1 : 0);
|
|
28872
29109
|
return new Uint8Array(decodedLength);
|
|
29110
|
+
}
|
|
28873
29111
|
case 38 /* PropsProxy */:
|
|
28874
29112
|
return createPropsProxy(null);
|
|
28875
29113
|
case 10 /* VNode */:
|
|
@@ -28884,7 +29122,12 @@ var allocate = (container, typeId, value) => {
|
|
|
28884
29122
|
}
|
|
28885
29123
|
case 39 /* SubscriptionData */:
|
|
28886
29124
|
return new SubscriptionData({});
|
|
29125
|
+
case 42 /* SubscriptionDataConstTrue */:
|
|
29126
|
+
return new SubscriptionData({ $scopedStyleIdPrefix$: null, $isConst$: true });
|
|
29127
|
+
case 43 /* SubscriptionDataConstFalse */:
|
|
29128
|
+
return new SubscriptionData({ $scopedStyleIdPrefix$: null, $isConst$: false });
|
|
28887
29129
|
case 40 /* EffectSubscription */:
|
|
29130
|
+
case 44 /* EffectSubscriptionNoData */:
|
|
28888
29131
|
return new EffectSubscription(null, null, null, null);
|
|
28889
29132
|
case 41 /* SubscriptionPatch */:
|
|
28890
29133
|
return new SubscriptionPatch();
|
|
@@ -28913,114 +29156,209 @@ var isSafeObjectKV = (key, value) => {
|
|
|
28913
29156
|
return typeof key === "string" && key !== "__proto__" && (typeof value !== "function" || !dangerousObjectKeys.has(key));
|
|
28914
29157
|
};
|
|
28915
29158
|
var inflate = (container, target, typeId, data) => {
|
|
29159
|
+
const ownsPendingStoreTargets = beginDeserialization(container);
|
|
29160
|
+
try {
|
|
29161
|
+
const iterator = inflateIterator(container, target, typeId, data);
|
|
29162
|
+
while (!iterator.next().done) {
|
|
29163
|
+
}
|
|
29164
|
+
} finally {
|
|
29165
|
+
endDeserialization(container, ownsPendingStoreTargets);
|
|
29166
|
+
}
|
|
29167
|
+
};
|
|
29168
|
+
function* eagerDeserializeArrayIterator(container, data, output = Array(data.length / 2)) {
|
|
29169
|
+
for (let i2 = 0; i2 < data.length; i2 += 2) {
|
|
29170
|
+
output[i2 / 2] = yield* deserializeDataIterator(container, data[i2], data[i2 + 1]);
|
|
29171
|
+
yield;
|
|
29172
|
+
}
|
|
29173
|
+
return output;
|
|
29174
|
+
}
|
|
29175
|
+
function* eagerDeserializeStateIterator(container, data, output = Array(data.length / 2)) {
|
|
29176
|
+
const ownsPendingStoreTargets = beginDeserialization(container);
|
|
29177
|
+
const length = data.length / 2;
|
|
29178
|
+
const allocated = new Uint8Array(length);
|
|
29179
|
+
const previousGetObjectById = container.$getObjectById$;
|
|
29180
|
+
const allocateRoot = (index) => {
|
|
29181
|
+
if (!allocated[index]) {
|
|
29182
|
+
allocated[index] = 1;
|
|
29183
|
+
const typeIndex = index * 2;
|
|
29184
|
+
const typeId = data[typeIndex];
|
|
29185
|
+
const value = data[typeIndex + 1];
|
|
29186
|
+
output[index] = typeId === 0 /* Plain */ ? value : allocate(container, typeId, value);
|
|
29187
|
+
}
|
|
29188
|
+
return output[index];
|
|
29189
|
+
};
|
|
29190
|
+
container.$getObjectById$ = (id) => allocateRoot(typeof id === "string" ? parseInt(id, 10) : id);
|
|
29191
|
+
try {
|
|
29192
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
29193
|
+
allocateRoot(i2);
|
|
29194
|
+
yield;
|
|
29195
|
+
}
|
|
29196
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
29197
|
+
const typeIndex = i2 * 2;
|
|
29198
|
+
const typeId = data[typeIndex];
|
|
29199
|
+
const value = data[typeIndex + 1];
|
|
29200
|
+
const propValue = output[i2];
|
|
29201
|
+
data[typeIndex] = 0 /* Plain */;
|
|
29202
|
+
data[typeIndex + 1] = propValue;
|
|
29203
|
+
if (needsInflation(typeId)) {
|
|
29204
|
+
yield* inflateIterator(container, propValue, typeId, value);
|
|
29205
|
+
}
|
|
29206
|
+
yield;
|
|
29207
|
+
}
|
|
29208
|
+
} finally {
|
|
29209
|
+
container.$getObjectById$ = previousGetObjectById;
|
|
29210
|
+
endDeserialization(container, ownsPendingStoreTargets);
|
|
29211
|
+
}
|
|
29212
|
+
return output;
|
|
29213
|
+
}
|
|
29214
|
+
function* deserializeDataIterator(container, typeId, value) {
|
|
29215
|
+
if (typeId === 0 /* Plain */) {
|
|
29216
|
+
return value;
|
|
29217
|
+
}
|
|
29218
|
+
const propValue = allocate(container, typeId, value);
|
|
29219
|
+
if (needsInflation(typeId)) {
|
|
29220
|
+
yield* inflateIterator(container, propValue, typeId, value);
|
|
29221
|
+
}
|
|
29222
|
+
return propValue;
|
|
29223
|
+
}
|
|
29224
|
+
function* inflateIterator(container, target, typeId, data) {
|
|
28916
29225
|
if (typeId === 0 /* Plain */) {
|
|
28917
29226
|
return;
|
|
28918
29227
|
}
|
|
29228
|
+
if (typeId === 5 /* Object */ && data !== EMPTY_OBJECT_PAYLOAD && !Array.isArray(data)) {
|
|
29229
|
+
throw new Error("Invalid Object payload");
|
|
29230
|
+
}
|
|
28919
29231
|
if (typeId !== 4 /* Array */ && Array.isArray(data)) {
|
|
28920
|
-
data =
|
|
29232
|
+
data = yield* eagerDeserializeArrayIterator(container, data);
|
|
28921
29233
|
}
|
|
28922
29234
|
switch (typeId) {
|
|
28923
29235
|
case 4 /* Array */:
|
|
28924
|
-
|
|
29236
|
+
yield* eagerDeserializeArrayIterator(container, data, target);
|
|
28925
29237
|
break;
|
|
28926
29238
|
case 5 /* Object */:
|
|
28927
|
-
if (data ===
|
|
29239
|
+
if (data === EMPTY_OBJECT_PAYLOAD) {
|
|
28928
29240
|
break;
|
|
28929
29241
|
}
|
|
28930
|
-
for (let
|
|
28931
|
-
const key = data[
|
|
28932
|
-
const value = data[
|
|
29242
|
+
for (let i2 = 0; i2 < data.length; i2 += 2) {
|
|
29243
|
+
const key = data[i2];
|
|
29244
|
+
const value = data[i2 + 1];
|
|
28933
29245
|
if (!isSafeObjectKV(key, value)) {
|
|
28934
29246
|
continue;
|
|
28935
29247
|
}
|
|
28936
29248
|
target[key] = value;
|
|
28937
29249
|
}
|
|
28938
29250
|
break;
|
|
28939
|
-
case
|
|
29251
|
+
case 25 /* Set */: {
|
|
29252
|
+
const set = target;
|
|
29253
|
+
const d = data;
|
|
29254
|
+
for (let i2 = 0; i2 < d.length; i2++) {
|
|
29255
|
+
set.add(d[i2]);
|
|
29256
|
+
yield;
|
|
29257
|
+
}
|
|
29258
|
+
break;
|
|
29259
|
+
}
|
|
29260
|
+
case 26 /* Map */: {
|
|
29261
|
+
const map = target;
|
|
29262
|
+
const d = data;
|
|
29263
|
+
for (let i2 = 0; i2 < d.length; i2++) {
|
|
29264
|
+
map.set(d[i2++], d[i2]);
|
|
29265
|
+
yield;
|
|
29266
|
+
}
|
|
29267
|
+
break;
|
|
29268
|
+
}
|
|
29269
|
+
case 24 /* Promise */: {
|
|
29270
|
+
const promise = target;
|
|
29271
|
+
const [resolved, result] = data;
|
|
29272
|
+
const [resolve, reject] = resolvers.get(promise);
|
|
29273
|
+
if (resolved) {
|
|
29274
|
+
if (resolvers.has(result)) {
|
|
29275
|
+
throw qError(37 /* invalidPromiseDependency */);
|
|
29276
|
+
}
|
|
29277
|
+
resolve(result);
|
|
29278
|
+
} else {
|
|
29279
|
+
reject(result);
|
|
29280
|
+
}
|
|
29281
|
+
break;
|
|
29282
|
+
}
|
|
29283
|
+
case 23 /* Error */: {
|
|
29284
|
+
const d = data;
|
|
29285
|
+
target.message = d[0];
|
|
29286
|
+
for (let i2 = 1; i2 < d.length; i2 += 2) {
|
|
29287
|
+
const key = d[i2];
|
|
29288
|
+
const value = d[i2 + 1];
|
|
29289
|
+
if (isSafeObjectKV(key, value)) {
|
|
29290
|
+
target[key] = value;
|
|
29291
|
+
}
|
|
29292
|
+
yield;
|
|
29293
|
+
}
|
|
29294
|
+
break;
|
|
29295
|
+
}
|
|
29296
|
+
case 28 /* Task */: {
|
|
28940
29297
|
const task = target;
|
|
28941
29298
|
const v = data;
|
|
28942
29299
|
task.$qrl$ = v[0];
|
|
28943
29300
|
task.$flags$ = v[1];
|
|
28944
29301
|
task.$index$ = v[2];
|
|
28945
29302
|
task.$el$ = v[3];
|
|
28946
|
-
task.$state$ = v[4];
|
|
28947
29303
|
break;
|
|
29304
|
+
}
|
|
28948
29305
|
case 29 /* Component */:
|
|
28949
29306
|
target[SERIALIZABLE_STATE][0] = data[0];
|
|
28950
29307
|
break;
|
|
28951
|
-
case 35 /* Store */: {
|
|
28952
|
-
const store = unwrapStore(target);
|
|
28953
|
-
const storeTarget = pendingStoreTargets.get(store);
|
|
28954
|
-
if (storeTarget) {
|
|
28955
|
-
pendingStoreTargets.delete(store);
|
|
28956
|
-
inflate(container, store, storeTarget.t, storeTarget.v);
|
|
28957
|
-
}
|
|
28958
|
-
const [, flags, effects] = data;
|
|
28959
|
-
const storeHandler = getStoreHandler(target);
|
|
28960
|
-
storeHandler.$flags$ = flags;
|
|
28961
|
-
storeHandler.$effects$ = effects;
|
|
28962
|
-
restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
|
|
28963
|
-
break;
|
|
28964
|
-
}
|
|
28965
29308
|
case 30 /* Signal */: {
|
|
28966
29309
|
const signal = target;
|
|
28967
|
-
const
|
|
28968
|
-
signal.$untrackedValue$ =
|
|
28969
|
-
signal.$effects$ = new Set(
|
|
29310
|
+
const d = data;
|
|
29311
|
+
signal.$untrackedValue$ = d[0];
|
|
29312
|
+
signal.$effects$ = new Set(d.slice(1));
|
|
28970
29313
|
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
28971
29314
|
break;
|
|
28972
29315
|
}
|
|
28973
29316
|
case 31 /* WrappedSignal */: {
|
|
28974
29317
|
const signal = target;
|
|
28975
|
-
const
|
|
28976
|
-
signal.$func$ = container.getSyncFn(
|
|
28977
|
-
signal.$args$ =
|
|
29318
|
+
const d = data;
|
|
29319
|
+
signal.$func$ = container.getSyncFn(d[0]);
|
|
29320
|
+
signal.$args$ = d[1];
|
|
28978
29321
|
signal.$untrackedValue$ = NEEDS_COMPUTATION;
|
|
28979
|
-
signal.$flags$ =
|
|
29322
|
+
signal.$flags$ = d[2];
|
|
28980
29323
|
signal.$flags$ |= 1 /* INVALID */;
|
|
28981
|
-
signal.$hostElement$ =
|
|
28982
|
-
signal.$effects$ = new Set(
|
|
29324
|
+
signal.$hostElement$ = d[3];
|
|
29325
|
+
signal.$effects$ = new Set(d.slice(4));
|
|
28983
29326
|
inflateWrappedSignalValue(signal);
|
|
28984
29327
|
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
28985
29328
|
break;
|
|
28986
29329
|
}
|
|
28987
29330
|
case 33 /* AsyncSignal */: {
|
|
28988
29331
|
const asyncSignal = target;
|
|
28989
|
-
const
|
|
28990
|
-
asyncSignal.$computeQrl$ =
|
|
28991
|
-
if (
|
|
28992
|
-
asyncSignal.$effects$ = new Set(
|
|
29332
|
+
const d = data;
|
|
29333
|
+
asyncSignal.$computeQrl$ = d[0];
|
|
29334
|
+
if (d[1]) {
|
|
29335
|
+
asyncSignal.$effects$ = new Set(d[1]);
|
|
28993
29336
|
}
|
|
28994
|
-
if (
|
|
28995
|
-
asyncSignal.$loadingEffects$ = new Set(
|
|
29337
|
+
if (d[2]) {
|
|
29338
|
+
asyncSignal.$loadingEffects$ = new Set(d[2]);
|
|
28996
29339
|
}
|
|
28997
|
-
if (
|
|
28998
|
-
asyncSignal.$errorEffects$ = new Set(
|
|
29340
|
+
if (d[3]) {
|
|
29341
|
+
asyncSignal.$errorEffects$ = new Set(d[3]);
|
|
28999
29342
|
}
|
|
29000
|
-
if (
|
|
29001
|
-
asyncSignal.$untrackedError$ =
|
|
29343
|
+
if (d[4]) {
|
|
29344
|
+
asyncSignal.$untrackedError$ = d[4];
|
|
29002
29345
|
}
|
|
29003
|
-
asyncSignal.$flags$ =
|
|
29346
|
+
asyncSignal.$flags$ = d[5] ?? 0;
|
|
29004
29347
|
if (asyncSignal.$flags$ & 64 /* CLIENT_ONLY */) {
|
|
29005
|
-
asyncSignal.$
|
|
29348
|
+
asyncSignal.$untrackedPending$ = true;
|
|
29006
29349
|
}
|
|
29007
|
-
const hasValue =
|
|
29350
|
+
const hasValue = d.length > 6;
|
|
29008
29351
|
if (hasValue) {
|
|
29009
|
-
asyncSignal.$untrackedValue$ =
|
|
29352
|
+
asyncSignal.$untrackedValue$ = d[6];
|
|
29010
29353
|
}
|
|
29011
29354
|
if (asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
29012
29355
|
asyncSignal.$flags$ |= 1 /* INVALID */;
|
|
29013
29356
|
}
|
|
29014
|
-
|
|
29015
|
-
|
|
29016
|
-
if (rawExpires < 0) {
|
|
29017
|
-
asyncSignal.$flags$ |= 256 /* NO_POLL */;
|
|
29018
|
-
}
|
|
29019
|
-
if (d2[8] !== void 0 && d2[8] !== 1) {
|
|
29020
|
-
asyncSignal.$concurrency$ = d2[8] ?? 1;
|
|
29357
|
+
if (d[7] !== void 0 && d[7] !== 1) {
|
|
29358
|
+
asyncSignal.$concurrency$ = d[7] ?? 1;
|
|
29021
29359
|
asyncSignal.$jobs$ = [];
|
|
29022
29360
|
}
|
|
29023
|
-
asyncSignal.$timeoutMs$ =
|
|
29361
|
+
asyncSignal.$timeoutMs$ = d[8] ?? 0;
|
|
29024
29362
|
restoreEffectBackRefForEffects(asyncSignal.$effects$, asyncSignal);
|
|
29025
29363
|
restoreEffectBackRefForEffects(asyncSignal.$loadingEffects$, asyncSignal);
|
|
29026
29364
|
restoreEffectBackRefForEffects(asyncSignal.$errorEffects$, asyncSignal);
|
|
@@ -29030,17 +29368,17 @@ var inflate = (container, target, typeId, data) => {
|
|
|
29030
29368
|
case 34 /* SerializerSignal */:
|
|
29031
29369
|
case 32 /* ComputedSignal */: {
|
|
29032
29370
|
const computed = target;
|
|
29033
|
-
const
|
|
29034
|
-
computed.$computeQrl$ =
|
|
29371
|
+
const d = data;
|
|
29372
|
+
computed.$computeQrl$ = d[0];
|
|
29035
29373
|
const p = computed.$computeQrl$.resolve(container).catch(() => {
|
|
29036
29374
|
});
|
|
29037
29375
|
loading = loading.finally(() => p);
|
|
29038
|
-
if (
|
|
29039
|
-
computed.$effects$ = new Set(
|
|
29376
|
+
if (d[1]) {
|
|
29377
|
+
computed.$effects$ = new Set(d[1]);
|
|
29040
29378
|
}
|
|
29041
|
-
const hasValue =
|
|
29379
|
+
const hasValue = d.length > 2;
|
|
29042
29380
|
if (hasValue) {
|
|
29043
|
-
computed.$untrackedValue$ =
|
|
29381
|
+
computed.$untrackedValue$ = d[2];
|
|
29044
29382
|
}
|
|
29045
29383
|
if (typeId !== 34 /* SerializerSignal */ && computed.$untrackedValue$ !== NEEDS_COMPUTATION) {
|
|
29046
29384
|
computed.$flags$ &= ~1 /* INVALID */;
|
|
@@ -29048,19 +29386,12 @@ var inflate = (container, target, typeId, data) => {
|
|
|
29048
29386
|
restoreEffectBackRefForEffects(computed.$effects$, computed);
|
|
29049
29387
|
break;
|
|
29050
29388
|
}
|
|
29051
|
-
case 23 /* Error */: {
|
|
29052
|
-
const d2 = data;
|
|
29053
|
-
target.message = d2[0];
|
|
29054
|
-
for (let i3 = 1; i3 < d2.length; i3 += 2) {
|
|
29055
|
-
target[d2[i3]] = d2[i3 + 1];
|
|
29056
|
-
}
|
|
29057
|
-
break;
|
|
29058
|
-
}
|
|
29059
29389
|
case 36 /* FormData */: {
|
|
29060
29390
|
const formData = target;
|
|
29061
|
-
const
|
|
29062
|
-
for (let
|
|
29063
|
-
formData.append(
|
|
29391
|
+
const d = data;
|
|
29392
|
+
for (let i2 = 0; i2 < d.length; i2++) {
|
|
29393
|
+
formData.append(d[i2++], d[i2]);
|
|
29394
|
+
yield;
|
|
29064
29395
|
}
|
|
29065
29396
|
break;
|
|
29066
29397
|
}
|
|
@@ -29075,48 +29406,14 @@ var inflate = (container, target, typeId, data) => {
|
|
|
29075
29406
|
jsx2.toSort = !!toSort;
|
|
29076
29407
|
break;
|
|
29077
29408
|
}
|
|
29078
|
-
case
|
|
29079
|
-
const set = target;
|
|
29080
|
-
const d2 = data;
|
|
29081
|
-
for (let i3 = 0; i3 < d2.length; i3++) {
|
|
29082
|
-
set.add(d2[i3]);
|
|
29083
|
-
}
|
|
29084
|
-
break;
|
|
29085
|
-
}
|
|
29086
|
-
case 26 /* Map */: {
|
|
29087
|
-
const map = target;
|
|
29088
|
-
const d2 = data;
|
|
29089
|
-
for (let i3 = 0; i3 < d2.length; i3++) {
|
|
29090
|
-
map.set(d2[i3++], d2[i3]);
|
|
29091
|
-
}
|
|
29092
|
-
break;
|
|
29093
|
-
}
|
|
29094
|
-
case 24 /* Promise */: {
|
|
29095
|
-
const promise = target;
|
|
29096
|
-
const [resolved, result] = data;
|
|
29097
|
-
const [resolve, reject] = resolvers.get(promise);
|
|
29098
|
-
if (resolved) {
|
|
29099
|
-
resolve(result);
|
|
29100
|
-
} else {
|
|
29101
|
-
reject(result);
|
|
29102
|
-
}
|
|
29103
|
-
break;
|
|
29104
|
-
}
|
|
29105
|
-
case 27 /* Uint8Array */:
|
|
29106
|
-
const bytes = target;
|
|
29107
|
-
const buf = atob(data);
|
|
29108
|
-
let i2 = 0;
|
|
29109
|
-
for (let j = 0; j < buf.length; j++) {
|
|
29110
|
-
const s = buf[j];
|
|
29111
|
-
bytes[i2++] = s.charCodeAt(0);
|
|
29112
|
-
}
|
|
29113
|
-
break;
|
|
29114
|
-
case 38 /* PropsProxy */:
|
|
29409
|
+
case 38 /* PropsProxy */: {
|
|
29115
29410
|
const propsProxy = target;
|
|
29116
29411
|
const d = data;
|
|
29117
29412
|
let owner = d[0];
|
|
29118
29413
|
if (owner === _UNINITIALIZED) {
|
|
29119
|
-
owner = new JSXNodeImpl(Fragment,
|
|
29414
|
+
owner = new JSXNodeImpl(Fragment, null, null, null, 0, null);
|
|
29415
|
+
owner.varProps = d[1];
|
|
29416
|
+
owner.constProps = d[2];
|
|
29120
29417
|
owner._proxy = propsProxy;
|
|
29121
29418
|
}
|
|
29122
29419
|
propsProxy[_OWNER] = owner;
|
|
@@ -29124,47 +29421,69 @@ var inflate = (container, target, typeId, data) => {
|
|
|
29124
29421
|
propsHandler.$effects$ = d[3];
|
|
29125
29422
|
restoreEffectBackRefForEffectsMap(propsHandler.$effects$, propsProxy);
|
|
29126
29423
|
break;
|
|
29424
|
+
}
|
|
29127
29425
|
case 39 /* SubscriptionData */: {
|
|
29128
29426
|
const effectData = target;
|
|
29129
29427
|
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
29130
29428
|
effectData.data.$isConst$ = data[1];
|
|
29131
29429
|
break;
|
|
29132
29430
|
}
|
|
29431
|
+
case 42 /* SubscriptionDataConstTrue */:
|
|
29432
|
+
case 43 /* SubscriptionDataConstFalse */:
|
|
29433
|
+
break;
|
|
29133
29434
|
case 40 /* EffectSubscription */: {
|
|
29134
29435
|
const effectSub = target;
|
|
29135
|
-
const
|
|
29136
|
-
effectSub.consumer =
|
|
29137
|
-
effectSub.property =
|
|
29138
|
-
effectSub.data =
|
|
29436
|
+
const d = data;
|
|
29437
|
+
effectSub.consumer = d[0];
|
|
29438
|
+
effectSub.property = d[1];
|
|
29439
|
+
effectSub.data = d[2];
|
|
29139
29440
|
restoreEffectBackRefForConsumer(effectSub);
|
|
29140
29441
|
break;
|
|
29141
29442
|
}
|
|
29142
29443
|
case 41 /* SubscriptionPatch */: {
|
|
29143
29444
|
const patch = target;
|
|
29144
|
-
const
|
|
29145
|
-
patch.rootId =
|
|
29146
|
-
patch.subscriptions =
|
|
29445
|
+
const d = data;
|
|
29446
|
+
patch.rootId = d[0];
|
|
29447
|
+
patch.subscriptions = d[1];
|
|
29448
|
+
break;
|
|
29449
|
+
}
|
|
29450
|
+
case 44 /* EffectSubscriptionNoData */: {
|
|
29451
|
+
const effectSub = target;
|
|
29452
|
+
const d = data;
|
|
29453
|
+
effectSub.consumer = d[0];
|
|
29454
|
+
effectSub.property = d[1];
|
|
29455
|
+
effectSub.data = null;
|
|
29456
|
+
restoreEffectBackRefForConsumer(effectSub);
|
|
29457
|
+
break;
|
|
29458
|
+
}
|
|
29459
|
+
case 27 /* Uint8Array */: {
|
|
29460
|
+
const bytes = target;
|
|
29461
|
+
const buf = atob(data);
|
|
29462
|
+
for (let j = 0; j < buf.length; j++) {
|
|
29463
|
+
bytes[j] = buf.charCodeAt(j);
|
|
29464
|
+
if ((j & 31) === 31) {
|
|
29465
|
+
yield;
|
|
29466
|
+
}
|
|
29467
|
+
}
|
|
29468
|
+
break;
|
|
29469
|
+
}
|
|
29470
|
+
case 35 /* Store */: {
|
|
29471
|
+
const store = unwrapStore(target);
|
|
29472
|
+
const storeTarget = container.$pendingStoreTargets$.get(store);
|
|
29473
|
+
if (storeTarget) {
|
|
29474
|
+
container.$pendingStoreTargets$.delete(store);
|
|
29475
|
+
yield* inflateIterator(container, store, storeTarget.t, storeTarget.v);
|
|
29476
|
+
}
|
|
29477
|
+
const [, flags, effects] = data;
|
|
29478
|
+
const storeHandler = getStoreHandler(target);
|
|
29479
|
+
storeHandler.$flags$ = flags;
|
|
29480
|
+
storeHandler.$effects$ = effects;
|
|
29481
|
+
restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
|
|
29147
29482
|
break;
|
|
29148
29483
|
}
|
|
29149
29484
|
default:
|
|
29150
29485
|
throw qError(16 /* serializeErrorNotImplemented */, [typeId]);
|
|
29151
29486
|
}
|
|
29152
|
-
};
|
|
29153
|
-
var _eagerDeserializeArray = (container, data, output = Array(data.length / 2)) => {
|
|
29154
|
-
for (let i2 = 0; i2 < data.length; i2 += 2) {
|
|
29155
|
-
output[i2 / 2] = deserializeData(container, data[i2], data[i2 + 1]);
|
|
29156
|
-
}
|
|
29157
|
-
return output;
|
|
29158
|
-
};
|
|
29159
|
-
function deserializeData(container, typeId, value) {
|
|
29160
|
-
if (typeId === 0 /* Plain */) {
|
|
29161
|
-
return value;
|
|
29162
|
-
}
|
|
29163
|
-
const propValue = allocate(container, typeId, value);
|
|
29164
|
-
if (needsInflation(typeId)) {
|
|
29165
|
-
inflate(container, propValue, typeId, value);
|
|
29166
|
-
}
|
|
29167
|
-
return propValue;
|
|
29168
29487
|
}
|
|
29169
29488
|
function inflateWrappedSignalValue(signal) {
|
|
29170
29489
|
if (signal.$hostElement$ !== null && vnode_isVNode(signal.$hostElement$)) {
|
|
@@ -29193,13 +29512,13 @@ function inflateWrappedSignalValue(signal) {
|
|
|
29193
29512
|
}
|
|
29194
29513
|
}
|
|
29195
29514
|
function restoreEffectBackRefForConsumer(effect) {
|
|
29196
|
-
var
|
|
29515
|
+
var _a5;
|
|
29197
29516
|
const isServerSide = qTest ? isServerPlatform() : isServer9;
|
|
29198
29517
|
const consumerBackRef = effect.consumer;
|
|
29199
29518
|
if (isServerSide && !consumerBackRef) {
|
|
29200
29519
|
return;
|
|
29201
29520
|
}
|
|
29202
|
-
consumerBackRef[
|
|
29521
|
+
consumerBackRef[_a5 = _EFFECT_BACK_REF] || (consumerBackRef[_a5] = /* @__PURE__ */ new Map());
|
|
29203
29522
|
consumerBackRef[_EFFECT_BACK_REF].set(effect.property, effect);
|
|
29204
29523
|
}
|
|
29205
29524
|
function restoreEffectBackRefForEffects(effects, consumer) {
|
|
@@ -29219,17 +29538,17 @@ function restoreEffectBackRefForEffectsMap(effectsMap, consumer) {
|
|
|
29219
29538
|
}
|
|
29220
29539
|
|
|
29221
29540
|
// packages/qwik/src/core/shared/vnode/vnode.ts
|
|
29222
|
-
import { isDev as
|
|
29223
|
-
var
|
|
29224
|
-
|
|
29541
|
+
import { isDev as isDev21 } from "@qwik.dev/core/build";
|
|
29542
|
+
var _a4;
|
|
29543
|
+
_a4 = _EFFECT_BACK_REF;
|
|
29225
29544
|
var VNode = class {
|
|
29226
29545
|
constructor(flags, parent, previousSibling, nextSibling, props) {
|
|
29227
|
-
this
|
|
29228
|
-
this
|
|
29229
|
-
this
|
|
29230
|
-
this
|
|
29231
|
-
this
|
|
29232
|
-
__publicField(this,
|
|
29546
|
+
__publicField(this, "flags", flags);
|
|
29547
|
+
__publicField(this, "parent", parent);
|
|
29548
|
+
__publicField(this, "previousSibling", previousSibling);
|
|
29549
|
+
__publicField(this, "nextSibling", nextSibling);
|
|
29550
|
+
__publicField(this, "props", props);
|
|
29551
|
+
__publicField(this, _a4);
|
|
29233
29552
|
__publicField(this, "slotParent", null);
|
|
29234
29553
|
__publicField(this, "dirty", 0 /* NONE */);
|
|
29235
29554
|
__publicField(this, "dirtyChildren", null);
|
|
@@ -29237,7 +29556,7 @@ var VNode = class {
|
|
|
29237
29556
|
}
|
|
29238
29557
|
// TODO: this creates debug issues
|
|
29239
29558
|
toString() {
|
|
29240
|
-
if (
|
|
29559
|
+
if (isDev21) {
|
|
29241
29560
|
return vnode_toString.call(this);
|
|
29242
29561
|
}
|
|
29243
29562
|
return Object.prototype.toString.call(this);
|
|
@@ -29248,9 +29567,9 @@ var VNode = class {
|
|
|
29248
29567
|
var VirtualVNode = class extends VNode {
|
|
29249
29568
|
constructor(key, flags, parent, previousSibling, nextSibling, props, firstChild, lastChild) {
|
|
29250
29569
|
super(flags, parent, previousSibling, nextSibling, props);
|
|
29251
|
-
this
|
|
29252
|
-
this
|
|
29253
|
-
this
|
|
29570
|
+
__publicField(this, "key", key);
|
|
29571
|
+
__publicField(this, "firstChild", firstChild);
|
|
29572
|
+
__publicField(this, "lastChild", lastChild);
|
|
29254
29573
|
}
|
|
29255
29574
|
};
|
|
29256
29575
|
|
|
@@ -29258,21 +29577,22 @@ var VirtualVNode = class extends VNode {
|
|
|
29258
29577
|
var ElementVNode = class extends VirtualVNode {
|
|
29259
29578
|
constructor(key, flags, parent, previousSibling, nextSibling, props, firstChild, lastChild, node, elementName) {
|
|
29260
29579
|
super(key, flags, parent, previousSibling, nextSibling, props, firstChild, lastChild);
|
|
29261
|
-
this
|
|
29262
|
-
this
|
|
29580
|
+
__publicField(this, "node", node);
|
|
29581
|
+
__publicField(this, "elementName", elementName);
|
|
29263
29582
|
}
|
|
29264
29583
|
};
|
|
29265
29584
|
|
|
29266
29585
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
29586
|
+
var reportedChunkFailures;
|
|
29267
29587
|
var getLazyRef = (chunk, symbol, symbolFn, ref, container) => {
|
|
29268
29588
|
return new LazyRef(chunk, symbol, symbolFn, ref, container);
|
|
29269
29589
|
};
|
|
29270
29590
|
var LazyRef = class {
|
|
29271
29591
|
constructor($chunk$, $symbol$, $symbolFn$, $ref$, container) {
|
|
29272
|
-
this
|
|
29273
|
-
this
|
|
29274
|
-
this
|
|
29275
|
-
this
|
|
29592
|
+
__publicField(this, "$chunk$", $chunk$);
|
|
29593
|
+
__publicField(this, "$symbol$", $symbol$);
|
|
29594
|
+
__publicField(this, "$symbolFn$", $symbolFn$);
|
|
29595
|
+
__publicField(this, "$ref$", $ref$);
|
|
29276
29596
|
__publicField(this, "$container$");
|
|
29277
29597
|
if ($ref$) {
|
|
29278
29598
|
this.$setRef$($ref$);
|
|
@@ -29295,7 +29615,24 @@ var LazyRef = class {
|
|
|
29295
29615
|
ref.then(
|
|
29296
29616
|
(r) => this.$ref$ = r,
|
|
29297
29617
|
(err) => {
|
|
29298
|
-
|
|
29618
|
+
const errorMessage = `qrl ${this.$symbol$} failed to load`;
|
|
29619
|
+
if (qTest ? isServerPlatform() : isServer10) {
|
|
29620
|
+
console.error(errorMessage, err);
|
|
29621
|
+
} else if (qTest ? !isServerPlatform() : isBrowser3) {
|
|
29622
|
+
const failureKey = this.$chunk$ === null ? `symbol:${this.$symbol$}` : `chunk:${this.$chunk$}`;
|
|
29623
|
+
const container = this.$container$;
|
|
29624
|
+
let containerFailures = container && reportedChunkFailures?.get(container);
|
|
29625
|
+
if (!containerFailures?.has(failureKey)) {
|
|
29626
|
+
if (container) {
|
|
29627
|
+
if (!containerFailures) {
|
|
29628
|
+
containerFailures = /* @__PURE__ */ new Set();
|
|
29629
|
+
(reportedChunkFailures || (reportedChunkFailures = /* @__PURE__ */ new WeakMap())).set(container, containerFailures);
|
|
29630
|
+
}
|
|
29631
|
+
containerFailures.add(failureKey);
|
|
29632
|
+
}
|
|
29633
|
+
console.error(errorMessage, err);
|
|
29634
|
+
}
|
|
29635
|
+
}
|
|
29299
29636
|
this.$ref$ = null;
|
|
29300
29637
|
}
|
|
29301
29638
|
);
|
|
@@ -29307,7 +29644,7 @@ var LazyRef = class {
|
|
|
29307
29644
|
return this.$ref$;
|
|
29308
29645
|
}
|
|
29309
29646
|
if (this.$chunk$ === "") {
|
|
29310
|
-
|
|
29647
|
+
isDev22 && assertDefined(this.$container$, "Sync QRL must have container element");
|
|
29311
29648
|
const hash = this.$container$.$instanceHash$;
|
|
29312
29649
|
const doc = this.$container$.element?.ownerDocument || document;
|
|
29313
29650
|
const qFuncs2 = getQFuncs(doc, hash);
|
|
@@ -29335,7 +29672,7 @@ var getInstance = (instance) => {
|
|
|
29335
29672
|
};
|
|
29336
29673
|
var QRLClass = class {
|
|
29337
29674
|
constructor($lazy$, $captures$, container) {
|
|
29338
|
-
this
|
|
29675
|
+
__publicField(this, "$lazy$", $lazy$);
|
|
29339
29676
|
__publicField(this, "resolved");
|
|
29340
29677
|
// This is defined or undefined for the lifetime of the QRL, so we set it lazily
|
|
29341
29678
|
__publicField(this, "$captures$");
|
|
@@ -29349,7 +29686,7 @@ var QRLClass = class {
|
|
|
29349
29686
|
this.$container$ = container;
|
|
29350
29687
|
}
|
|
29351
29688
|
}
|
|
29352
|
-
if ($lazy$.$ref$ != null && typeof this.$captures$ !== "string" && !isPromise($lazy$.$ref$)) {
|
|
29689
|
+
if ($lazy$.$ref$ != null && (!this.$captures$ || typeof this.$captures$ !== "string") && !isPromise($lazy$.$ref$)) {
|
|
29353
29690
|
this.resolved = bindCaptures(this, $lazy$.$ref$);
|
|
29354
29691
|
}
|
|
29355
29692
|
}
|
|
@@ -29371,6 +29708,10 @@ var qrlWithCaptures = function(captures) {
|
|
|
29371
29708
|
);
|
|
29372
29709
|
return makeQrlFn(newQrl);
|
|
29373
29710
|
};
|
|
29711
|
+
var qrlWithMovedCaptures = function() {
|
|
29712
|
+
this[QRL_STATE].$lazy$.$hasMovedCaptures$ = true;
|
|
29713
|
+
return this;
|
|
29714
|
+
};
|
|
29374
29715
|
var qrlSetRef = function(ref) {
|
|
29375
29716
|
const qrl = getInstance(this);
|
|
29376
29717
|
qrl.$lazy$.$setRef$(ref);
|
|
@@ -29426,6 +29767,11 @@ var QRL_FUNCTION_PROTO = Object.create(Function.prototype, {
|
|
|
29426
29767
|
this[QRL_STATE].$captures$ = value;
|
|
29427
29768
|
}
|
|
29428
29769
|
},
|
|
29770
|
+
$hasMovedCaptures$: {
|
|
29771
|
+
get() {
|
|
29772
|
+
return this[QRL_STATE].$lazy$.$hasMovedCaptures$;
|
|
29773
|
+
}
|
|
29774
|
+
},
|
|
29429
29775
|
$container$: {
|
|
29430
29776
|
get() {
|
|
29431
29777
|
return this[QRL_STATE].$container$;
|
|
@@ -29472,6 +29818,9 @@ var QRL_FUNCTION_PROTO = Object.create(Function.prototype, {
|
|
|
29472
29818
|
w: {
|
|
29473
29819
|
value: qrlWithCaptures
|
|
29474
29820
|
},
|
|
29821
|
+
m: {
|
|
29822
|
+
value: qrlWithMovedCaptures
|
|
29823
|
+
},
|
|
29475
29824
|
s: {
|
|
29476
29825
|
value: qrlSetRef
|
|
29477
29826
|
},
|
|
@@ -29495,27 +29844,45 @@ var _captures = null;
|
|
|
29495
29844
|
var setCaptures = (captures) => {
|
|
29496
29845
|
_captures = captures;
|
|
29497
29846
|
};
|
|
29498
|
-
var
|
|
29847
|
+
var deserializeCaptureDeltas = (container, deltaString, startIndex = 0, previousRootId) => {
|
|
29499
29848
|
const refs = [];
|
|
29500
|
-
|
|
29501
|
-
|
|
29502
|
-
|
|
29503
|
-
|
|
29849
|
+
let previous = previousRootId;
|
|
29850
|
+
let start = startIndex;
|
|
29851
|
+
for (let i2 = startIndex; i2 <= deltaString.length; i2++) {
|
|
29852
|
+
if (i2 === deltaString.length || deltaString.charCodeAt(i2) === 32) {
|
|
29853
|
+
if (i2 > start) {
|
|
29854
|
+
const delta = Number(deltaString.slice(start, i2));
|
|
29855
|
+
previous = previous === void 0 ? delta : previous + delta;
|
|
29856
|
+
refs.push(container.$getObjectById$(previous));
|
|
29857
|
+
}
|
|
29858
|
+
start = i2 + 1;
|
|
29859
|
+
}
|
|
29504
29860
|
}
|
|
29505
29861
|
return refs;
|
|
29506
29862
|
};
|
|
29863
|
+
var deserializeQrlCaptureDeltas = (container, qrlString) => {
|
|
29864
|
+
const firstHash = qrlString.indexOf("#");
|
|
29865
|
+
if (firstHash === -1) {
|
|
29866
|
+
return deserializeCaptureDeltas(container, qrlString);
|
|
29867
|
+
}
|
|
29868
|
+
const secondHash = qrlString.indexOf("#", firstHash + 1);
|
|
29869
|
+
const previousRootId = Number(qrlString.slice(0, firstHash)) + Number(qrlString.slice(firstHash + 1, secondHash));
|
|
29870
|
+
return deserializeCaptureDeltas(container, qrlString, secondHash + 1, previousRootId);
|
|
29871
|
+
};
|
|
29507
29872
|
var ensureQrlCaptures = (qrl) => {
|
|
29508
|
-
|
|
29873
|
+
const serializedCaptures = qrl.$captures$;
|
|
29509
29874
|
const container = qrl.$container$;
|
|
29510
|
-
if (typeof
|
|
29875
|
+
if (typeof serializedCaptures === "string") {
|
|
29511
29876
|
if (!container) {
|
|
29512
29877
|
throw qError(13 /* qrlMissingContainer */);
|
|
29513
29878
|
}
|
|
29514
29879
|
const prevLoading = loading;
|
|
29515
|
-
_captures = qrl.$captures$ =
|
|
29880
|
+
_captures = qrl.$captures$ = deserializeQrlCaptureDeltas(container, serializedCaptures);
|
|
29516
29881
|
if (loading !== prevLoading) {
|
|
29517
29882
|
return loading;
|
|
29518
29883
|
}
|
|
29884
|
+
} else {
|
|
29885
|
+
_captures = serializedCaptures || null;
|
|
29519
29886
|
}
|
|
29520
29887
|
};
|
|
29521
29888
|
var bindCaptures = (qrl, ref) => {
|
|
@@ -29888,6 +30255,7 @@ var Slot = (props) => {
|
|
|
29888
30255
|
|
|
29889
30256
|
// packages/qwik/src/core/shared/serdes/constants.ts
|
|
29890
30257
|
var explicitUndefined = /* @__PURE__ */ Symbol("undefined");
|
|
30258
|
+
var EMPTY_OBJECT_PAYLOAD = 0;
|
|
29891
30259
|
var _constants = [
|
|
29892
30260
|
void 0,
|
|
29893
30261
|
null,
|
|
@@ -29906,7 +30274,11 @@ var _constants = [
|
|
|
29906
30274
|
-Infinity,
|
|
29907
30275
|
Number.MAX_SAFE_INTEGER,
|
|
29908
30276
|
Number.MAX_SAFE_INTEGER - 1,
|
|
29909
|
-
Number.MIN_SAFE_INTEGER
|
|
30277
|
+
Number.MIN_SAFE_INTEGER,
|
|
30278
|
+
":",
|
|
30279
|
+
".",
|
|
30280
|
+
"id",
|
|
30281
|
+
"ref"
|
|
29910
30282
|
];
|
|
29911
30283
|
|
|
29912
30284
|
// packages/qwik/src/core/shared/serdes/deser-proxy.ts
|
|
@@ -29932,8 +30304,8 @@ var wrapDeserializerProxy = (container, data) => {
|
|
|
29932
30304
|
};
|
|
29933
30305
|
var DeserializationHandler = class {
|
|
29934
30306
|
constructor($container$, $data$) {
|
|
29935
|
-
this
|
|
29936
|
-
this
|
|
30307
|
+
__publicField(this, "$container$", $container$);
|
|
30308
|
+
__publicField(this, "$data$", $data$);
|
|
29937
30309
|
}
|
|
29938
30310
|
get(target, property, receiver) {
|
|
29939
30311
|
if (property === SERIALIZER_PROXY_UNWRAP) {
|
|
@@ -29950,14 +30322,19 @@ var DeserializationHandler = class {
|
|
|
29950
30322
|
return value;
|
|
29951
30323
|
}
|
|
29952
30324
|
const container = this.$container$;
|
|
29953
|
-
const
|
|
29954
|
-
|
|
29955
|
-
|
|
29956
|
-
|
|
29957
|
-
|
|
29958
|
-
|
|
30325
|
+
const ownsPendingStoreTargets = beginDeserialization(container);
|
|
30326
|
+
try {
|
|
30327
|
+
const propValue = allocate(container, typeId, value);
|
|
30328
|
+
Reflect.set(target, property, propValue);
|
|
30329
|
+
this.$data$[idx] = 0 /* Plain */;
|
|
30330
|
+
this.$data$[idx + 1] = propValue;
|
|
30331
|
+
if (needsInflation(typeId)) {
|
|
30332
|
+
inflate(container, propValue, typeId, value);
|
|
30333
|
+
}
|
|
30334
|
+
return propValue;
|
|
30335
|
+
} finally {
|
|
30336
|
+
endDeserialization(container, ownsPendingStoreTargets);
|
|
29959
30337
|
}
|
|
29960
|
-
return propValue;
|
|
29961
30338
|
}
|
|
29962
30339
|
has(target, property) {
|
|
29963
30340
|
if (property === SERIALIZER_PROXY_UNWRAP) {
|
|
@@ -30031,13 +30408,13 @@ var mergeSubscriptionSet = (container, producer, backRef, rootEffects, patchEffe
|
|
|
30031
30408
|
|
|
30032
30409
|
// packages/qwik/src/core/client/process-segment-state.ts
|
|
30033
30410
|
var processedStatePatchScripts = /* @__PURE__ */ new WeakMap();
|
|
30034
|
-
|
|
30411
|
+
function* processSegmentStateScriptsIterator(container, segmentId) {
|
|
30035
30412
|
if (!__EXPERIMENTAL__.suspense) {
|
|
30036
30413
|
return;
|
|
30037
30414
|
}
|
|
30038
30415
|
const stateContainer = container;
|
|
30039
30416
|
const qwikStates = stateContainer.element.querySelectorAll(
|
|
30040
|
-
|
|
30417
|
+
`script[type="qwik/state"][q\\:instance="${stateContainer.$instanceHash$}"]${QStatePatchAttrSelector}`
|
|
30041
30418
|
);
|
|
30042
30419
|
const processedScripts = getProcessedStatePatchScripts(container);
|
|
30043
30420
|
for (let i2 = 0; i2 < qwikStates.length; i2++) {
|
|
@@ -30049,9 +30426,10 @@ var processSegmentStateScripts = (container, segmentId) => {
|
|
|
30049
30426
|
continue;
|
|
30050
30427
|
}
|
|
30051
30428
|
processedScripts.add(stateScript);
|
|
30052
|
-
processStatePatch(container, stateContainer, stateScript.textContent);
|
|
30429
|
+
yield* processStatePatch(container, stateContainer, stateScript.textContent);
|
|
30430
|
+
yield;
|
|
30053
30431
|
}
|
|
30054
|
-
}
|
|
30432
|
+
}
|
|
30055
30433
|
var getProcessedStatePatchScripts = (container) => {
|
|
30056
30434
|
let processedScripts = processedStatePatchScripts.get(container);
|
|
30057
30435
|
if (!processedScripts) {
|
|
@@ -30060,23 +30438,21 @@ var getProcessedStatePatchScripts = (container) => {
|
|
|
30060
30438
|
}
|
|
30061
30439
|
return processedScripts;
|
|
30062
30440
|
};
|
|
30063
|
-
|
|
30064
|
-
|
|
30065
|
-
|
|
30066
|
-
var processStatePatch = (container, stateContainer, textContent) => {
|
|
30067
|
-
if (textContent) {
|
|
30068
|
-
const [rootStart, rawStateData, forwardRefs, subscriptionPatchRootId] = JSON.parse(
|
|
30069
|
-
textContent
|
|
30070
|
-
);
|
|
30071
|
-
appendStatePatchRoots(container, stateContainer, rootStart, rawStateData);
|
|
30072
|
-
mergeForwardRefs(stateContainer, forwardRefs || void 0);
|
|
30073
|
-
applySubscriptionPatches(
|
|
30074
|
-
container,
|
|
30075
|
-
subscriptionPatchRootId === void 0 ? void 0 : stateContainer.$getObjectById$(subscriptionPatchRootId)
|
|
30076
|
-
);
|
|
30441
|
+
function* processStatePatch(container, stateContainer, textContent) {
|
|
30442
|
+
if (!textContent) {
|
|
30443
|
+
return;
|
|
30077
30444
|
}
|
|
30078
|
-
|
|
30079
|
-
|
|
30445
|
+
const [rootStart, rawStateData, forwardRefs, subscriptionPatchRootId] = JSON.parse(
|
|
30446
|
+
textContent
|
|
30447
|
+
);
|
|
30448
|
+
yield* appendStatePatchRoots(container, stateContainer, rootStart, rawStateData);
|
|
30449
|
+
mergeForwardRefs(stateContainer, forwardRefs || void 0);
|
|
30450
|
+
applySubscriptionPatches(
|
|
30451
|
+
container,
|
|
30452
|
+
subscriptionPatchRootId === void 0 ? void 0 : stateContainer.$getObjectById$(subscriptionPatchRootId)
|
|
30453
|
+
);
|
|
30454
|
+
}
|
|
30455
|
+
function* appendStatePatchRoots(container, stateContainer, rootStart, rawStateData) {
|
|
30080
30456
|
const currentRootCount = stateContainer.$rawStateData$.length / 2;
|
|
30081
30457
|
if (rootStart !== currentRootCount) {
|
|
30082
30458
|
if (qDev) {
|
|
@@ -30088,15 +30464,16 @@ var appendStatePatchRoots = (container, stateContainer, rootStart, rawStateData)
|
|
|
30088
30464
|
}
|
|
30089
30465
|
for (let i2 = 0; i2 < rawStateData.length; i2++) {
|
|
30090
30466
|
stateContainer.$rawStateData$[rootStart * 2 + i2] = rawStateData[i2];
|
|
30467
|
+
yield;
|
|
30091
30468
|
}
|
|
30092
|
-
|
|
30469
|
+
yield* preprocessStateIterator(stateContainer.$rawStateData$, container, rootStart * 2);
|
|
30093
30470
|
stateContainer.$stateData$ = wrapDeserializerProxy(
|
|
30094
30471
|
container,
|
|
30095
30472
|
stateContainer.$rawStateData$
|
|
30096
30473
|
);
|
|
30097
30474
|
stateContainer.$stateData$.length = stateContainer.$rawStateData$.length / 2;
|
|
30098
30475
|
stateContainer.$rootForwardRefs$ = stateContainer.$forwardRefs$;
|
|
30099
|
-
}
|
|
30476
|
+
}
|
|
30100
30477
|
var mergeForwardRefs = (stateContainer, forwardRefs) => {
|
|
30101
30478
|
if (!forwardRefs) {
|
|
30102
30479
|
return;
|
|
@@ -30112,33 +30489,144 @@ var mergeForwardRefs = (stateContainer, forwardRefs) => {
|
|
|
30112
30489
|
};
|
|
30113
30490
|
|
|
30114
30491
|
// packages/qwik/src/core/client/process-vnode-data.ts
|
|
30492
|
+
var Q_SUSPENSE_RESOLVED = "q:r";
|
|
30493
|
+
var Q_PATCH = "q:patch";
|
|
30494
|
+
function processVNodeData(document2, containerElement) {
|
|
30495
|
+
const qDocument = document2;
|
|
30496
|
+
if (containerElement?.qVNodeRefs) {
|
|
30497
|
+
return;
|
|
30498
|
+
}
|
|
30499
|
+
if (qDocument.qVNodeDataStarted && !qDocument.qVNodeDataProcessed) {
|
|
30500
|
+
return;
|
|
30501
|
+
}
|
|
30502
|
+
qDocument.qVNodeDataStarted = true;
|
|
30503
|
+
qDocument.qVNodeData || (qDocument.qVNodeData = /* @__PURE__ */ new WeakMap());
|
|
30504
|
+
enqueueProcessVNodeDataJob(qDocument, processRootVNodeData(document2));
|
|
30505
|
+
}
|
|
30115
30506
|
function processOutOfOrderSegmentVNodeData(document2, segmentId, contentNode) {
|
|
30116
30507
|
if (!__EXPERIMENTAL__.suspense || !contentNode) {
|
|
30117
30508
|
return;
|
|
30118
30509
|
}
|
|
30119
30510
|
const qContainerElement = contentNode.closest("[q\\:container]");
|
|
30120
|
-
|
|
30511
|
+
if (!qContainerElement) {
|
|
30512
|
+
return;
|
|
30513
|
+
}
|
|
30514
|
+
const script = qContainerElement.querySelector(
|
|
30121
30515
|
`script[type="qwik/vnode"][q\\:r="${segmentId}"]:not([q\\:patch])`
|
|
30122
30516
|
);
|
|
30123
|
-
|
|
30517
|
+
const patches = qContainerElement.querySelectorAll(
|
|
30518
|
+
`script[type="qwik/vnode"][q\\:r="${segmentId}"][q\\:patch]`
|
|
30519
|
+
);
|
|
30520
|
+
enqueueProcessVNodeDataJob(
|
|
30124
30521
|
document2,
|
|
30125
|
-
|
|
30126
|
-
|
|
30127
|
-
|
|
30128
|
-
|
|
30522
|
+
processOutOfOrderSegmentVNodeDataIterator(
|
|
30523
|
+
document2,
|
|
30524
|
+
segmentId,
|
|
30525
|
+
qContainerElement,
|
|
30526
|
+
contentNode,
|
|
30527
|
+
script?.textContent || void 0,
|
|
30528
|
+
patches
|
|
30529
|
+
)
|
|
30129
30530
|
);
|
|
30130
|
-
|
|
30131
|
-
|
|
30531
|
+
}
|
|
30532
|
+
var onVNodeDataReady = (document2, callback) => {
|
|
30533
|
+
const qDocument = document2;
|
|
30534
|
+
if (qDocument.qVNodeDataReady) {
|
|
30535
|
+
callback();
|
|
30536
|
+
} else {
|
|
30537
|
+
(qDocument.qVNodeDataCallbacks || (qDocument.qVNodeDataCallbacks = [])).push(callback);
|
|
30538
|
+
}
|
|
30539
|
+
};
|
|
30540
|
+
function enqueueProcessVNodeDataJob(qDocument, iterator) {
|
|
30541
|
+
const state = qDocument.qVNodeDataState || (qDocument.qVNodeDataState = {
|
|
30542
|
+
$queue$: [],
|
|
30543
|
+
$active$: null
|
|
30544
|
+
});
|
|
30545
|
+
qDocument.qProcessVNodeDataPatch || (qDocument.qProcessVNodeDataPatch = (script) => enqueueProcessVNodeDataJob(qDocument, processVNodeDataPatch(qDocument, script)));
|
|
30546
|
+
qDocument.qVNodeDataReady = false;
|
|
30547
|
+
state.$queue$.push(iterator);
|
|
30548
|
+
scheduleProcessVNodeData(qDocument, state);
|
|
30549
|
+
}
|
|
30550
|
+
function scheduleProcessVNodeData(qDocument, state) {
|
|
30551
|
+
if (state.$active$) {
|
|
30552
|
+
return;
|
|
30553
|
+
}
|
|
30554
|
+
const iterator = state.$queue$.shift();
|
|
30555
|
+
if (!iterator) {
|
|
30556
|
+
markVNodeDataReady(qDocument);
|
|
30557
|
+
return;
|
|
30558
|
+
}
|
|
30559
|
+
state.$active$ = createYieldingIteratorState(
|
|
30560
|
+
runProcessVNodeData(qDocument, state, iterator),
|
|
30561
|
+
() => {
|
|
30562
|
+
if (qDocument.qVNodeDataState === state) {
|
|
30563
|
+
state.$active$ = null;
|
|
30564
|
+
scheduleProcessVNodeData(qDocument, state);
|
|
30565
|
+
}
|
|
30566
|
+
},
|
|
30567
|
+
(error) => {
|
|
30568
|
+
state.$active$ = null;
|
|
30569
|
+
logError(error);
|
|
30570
|
+
markVNodeDataReady(qDocument);
|
|
30571
|
+
}
|
|
30572
|
+
);
|
|
30573
|
+
scheduleYieldingIterator(state.$active$);
|
|
30574
|
+
}
|
|
30575
|
+
function* runProcessVNodeData(qDocument, state, iterator) {
|
|
30576
|
+
while (qDocument.qVNodeDataState === state) {
|
|
30577
|
+
if (iterator.next().done) {
|
|
30578
|
+
return;
|
|
30579
|
+
}
|
|
30580
|
+
yield;
|
|
30581
|
+
}
|
|
30582
|
+
}
|
|
30583
|
+
function markVNodeDataReady(document2) {
|
|
30584
|
+
if (document2.qVNodeDataReady) {
|
|
30585
|
+
return;
|
|
30586
|
+
}
|
|
30587
|
+
document2.qVNodeDataReady = true;
|
|
30588
|
+
document2.qVNodeDataState = void 0;
|
|
30589
|
+
const callbacks = document2.qVNodeDataCallbacks;
|
|
30590
|
+
document2.qVNodeDataCallbacks = void 0;
|
|
30591
|
+
if (callbacks) {
|
|
30592
|
+
for (let i2 = 0; i2 < callbacks.length; i2++) {
|
|
30593
|
+
callbacks[i2]();
|
|
30594
|
+
}
|
|
30595
|
+
}
|
|
30596
|
+
}
|
|
30597
|
+
function* processRootVNodeData(document2) {
|
|
30598
|
+
yield* processVNodeDataImpl(document2);
|
|
30599
|
+
const qDocument = document2;
|
|
30600
|
+
qDocument.qVNodeDataProcessed = true;
|
|
30601
|
+
qDocument.qVNodeDataStarted = false;
|
|
30602
|
+
}
|
|
30603
|
+
function* processOutOfOrderSegmentVNodeDataIterator(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData, patches) {
|
|
30604
|
+
yield* processVNodeDataImpl(
|
|
30605
|
+
document2,
|
|
30606
|
+
segmentId,
|
|
30607
|
+
segmentContainer,
|
|
30608
|
+
segmentContent,
|
|
30609
|
+
segmentVNodeData
|
|
30132
30610
|
);
|
|
30133
|
-
for (let i2 = 0;
|
|
30134
|
-
document2
|
|
30611
|
+
for (let i2 = 0; i2 < patches.length; i2++) {
|
|
30612
|
+
yield* processVNodeDataPatch(document2, patches[i2]);
|
|
30135
30613
|
}
|
|
30136
30614
|
}
|
|
30137
|
-
function
|
|
30138
|
-
|
|
30139
|
-
|
|
30615
|
+
function* processVNodeDataPatch(document2, script) {
|
|
30616
|
+
const qContainerElement = script?.closest("[q\\:container]");
|
|
30617
|
+
const patchSegment = script?.getAttribute(Q_SUSPENSE_RESOLVED);
|
|
30618
|
+
const contentNode = qContainerElement && (patchSegment ? qContainerElement.querySelector(`[q\\:rp="${patchSegment}"]`) : qContainerElement);
|
|
30619
|
+
if (qContainerElement && contentNode) {
|
|
30620
|
+
yield* processVNodeDataImpl(
|
|
30621
|
+
document2,
|
|
30622
|
+
patchSegment || void 0,
|
|
30623
|
+
qContainerElement,
|
|
30624
|
+
contentNode,
|
|
30625
|
+
script.textContent
|
|
30626
|
+
);
|
|
30627
|
+
}
|
|
30140
30628
|
}
|
|
30141
|
-
function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData) {
|
|
30629
|
+
function* processVNodeDataImpl(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData) {
|
|
30142
30630
|
const Q_CONTAINER = "q:container";
|
|
30143
30631
|
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
30144
30632
|
const Q_PROPS_SEPARATOR2 = ":";
|
|
@@ -30147,9 +30635,22 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30147
30635
|
const Q_IGNORE_END = "/" + Q_IGNORE;
|
|
30148
30636
|
const Q_CONTAINER_ISLAND = "q:container-island";
|
|
30149
30637
|
const Q_CONTAINER_ISLAND_END = "/" + Q_CONTAINER_ISLAND;
|
|
30150
|
-
const Q_SUSPENSE_RESOLVED = "q:r";
|
|
30151
30638
|
const Q_SUSPENSE_RESULT_PARENT = "q:rp";
|
|
30152
|
-
|
|
30639
|
+
let NodeType;
|
|
30640
|
+
((NodeType2) => {
|
|
30641
|
+
NodeType2[NodeType2["CONTAINER_MASK"] = 1] = "CONTAINER_MASK";
|
|
30642
|
+
NodeType2[NodeType2["ELEMENT"] = 2] = "ELEMENT";
|
|
30643
|
+
NodeType2[NodeType2["ELEMENT_CONTAINER"] = 3] = "ELEMENT_CONTAINER";
|
|
30644
|
+
NodeType2[NodeType2["ELEMENT_SHADOW_ROOT_WRAPPER"] = 6] = "ELEMENT_SHADOW_ROOT_WRAPPER";
|
|
30645
|
+
NodeType2[NodeType2["ELEMENT_SUSPENSE_RESULT_PARENT"] = 130] = "ELEMENT_SUSPENSE_RESULT_PARENT";
|
|
30646
|
+
NodeType2[NodeType2["COMMENT_SKIP_START"] = 9] = "COMMENT_SKIP_START";
|
|
30647
|
+
NodeType2[NodeType2["COMMENT_SKIP_END"] = 8] = "COMMENT_SKIP_END";
|
|
30648
|
+
NodeType2[NodeType2["COMMENT_IGNORE_START"] = 16] = "COMMENT_IGNORE_START";
|
|
30649
|
+
NodeType2[NodeType2["COMMENT_IGNORE_END"] = 32] = "COMMENT_IGNORE_END";
|
|
30650
|
+
NodeType2[NodeType2["COMMENT_ISLAND_START"] = 65] = "COMMENT_ISLAND_START";
|
|
30651
|
+
NodeType2[NodeType2["COMMENT_ISLAND_END"] = 64] = "COMMENT_ISLAND_END";
|
|
30652
|
+
NodeType2[NodeType2["OTHER"] = 0] = "OTHER";
|
|
30653
|
+
})(NodeType || (NodeType = {}));
|
|
30153
30654
|
const qDocument = document2;
|
|
30154
30655
|
const vNodeDataMap = qDocument.qVNodeData || (qDocument.qVNodeData = /* @__PURE__ */ new WeakMap());
|
|
30155
30656
|
const prototype = document2.body;
|
|
@@ -30165,7 +30666,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30165
30666
|
const getAttribute = prototype.getAttribute;
|
|
30166
30667
|
const hasAttribute = prototype.hasAttribute;
|
|
30167
30668
|
const getNodeType = getter(prototype, "nodeType");
|
|
30168
|
-
const attachVnodeDataAndRefs = (element)
|
|
30669
|
+
const attachVnodeDataAndRefs = function* (element) {
|
|
30169
30670
|
const scripts = element.querySelectorAll('script[type="qwik/vnode"]');
|
|
30170
30671
|
for (let i2 = 0; i2 < scripts.length; i2++) {
|
|
30171
30672
|
const script = scripts[i2];
|
|
@@ -30173,6 +30674,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30173
30674
|
qContainer.qVNodeRefs || (qContainer.qVNodeRefs = /* @__PURE__ */ new Map());
|
|
30174
30675
|
if (script.hasAttribute(Q_PATCH)) {
|
|
30175
30676
|
qDocument.qProcessVNodeDataPatch?.(script);
|
|
30677
|
+
yield;
|
|
30176
30678
|
continue;
|
|
30177
30679
|
}
|
|
30178
30680
|
const scriptContent = script.textContent;
|
|
@@ -30182,29 +30684,18 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30182
30684
|
} else {
|
|
30183
30685
|
qContainer.qVnodeData = scriptContent;
|
|
30184
30686
|
}
|
|
30687
|
+
yield;
|
|
30185
30688
|
}
|
|
30186
30689
|
const shadowRoots = element.querySelectorAll("[q\\:shadowroot]");
|
|
30187
30690
|
for (let i2 = 0; i2 < shadowRoots.length; i2++) {
|
|
30188
30691
|
const parent = shadowRoots[i2];
|
|
30189
30692
|
const shadowRoot = parent.shadowRoot;
|
|
30190
|
-
|
|
30693
|
+
if (shadowRoot) {
|
|
30694
|
+
yield* attachVnodeDataAndRefs(shadowRoot);
|
|
30695
|
+
}
|
|
30696
|
+
yield;
|
|
30191
30697
|
}
|
|
30192
30698
|
};
|
|
30193
|
-
let NodeType;
|
|
30194
|
-
((NodeType2) => {
|
|
30195
|
-
NodeType2[NodeType2["CONTAINER_MASK"] = 1] = "CONTAINER_MASK";
|
|
30196
|
-
NodeType2[NodeType2["ELEMENT"] = 2] = "ELEMENT";
|
|
30197
|
-
NodeType2[NodeType2["ELEMENT_CONTAINER"] = 3] = "ELEMENT_CONTAINER";
|
|
30198
|
-
NodeType2[NodeType2["ELEMENT_SHADOW_ROOT_WRAPPER"] = 6] = "ELEMENT_SHADOW_ROOT_WRAPPER";
|
|
30199
|
-
NodeType2[NodeType2["ELEMENT_SUSPENSE_RESULT_PARENT"] = 130] = "ELEMENT_SUSPENSE_RESULT_PARENT";
|
|
30200
|
-
NodeType2[NodeType2["COMMENT_SKIP_START"] = 9] = "COMMENT_SKIP_START";
|
|
30201
|
-
NodeType2[NodeType2["COMMENT_SKIP_END"] = 8] = "COMMENT_SKIP_END";
|
|
30202
|
-
NodeType2[NodeType2["COMMENT_IGNORE_START"] = 16] = "COMMENT_IGNORE_START";
|
|
30203
|
-
NodeType2[NodeType2["COMMENT_IGNORE_END"] = 32] = "COMMENT_IGNORE_END";
|
|
30204
|
-
NodeType2[NodeType2["COMMENT_ISLAND_START"] = 65] = "COMMENT_ISLAND_START";
|
|
30205
|
-
NodeType2[NodeType2["COMMENT_ISLAND_END"] = 64] = "COMMENT_ISLAND_END";
|
|
30206
|
-
NodeType2[NodeType2["OTHER"] = 0] = "OTHER";
|
|
30207
|
-
})(NodeType || (NodeType = {}));
|
|
30208
30699
|
const getFastNodeType = (node) => {
|
|
30209
30700
|
const nodeType = getNodeType.call(node);
|
|
30210
30701
|
if (nodeType === 1) {
|
|
@@ -30241,7 +30732,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30241
30732
|
}
|
|
30242
30733
|
return node;
|
|
30243
30734
|
};
|
|
30244
|
-
const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs, qContainerElement, segmentId2)
|
|
30735
|
+
const walkContainer = function* (walker2, containerNode, node, exitNode, vData, qVNodeRefs, qContainerElement, segmentId2) {
|
|
30245
30736
|
const isSegment = __EXPERIMENTAL__.suspense && segmentId2 !== void 0;
|
|
30246
30737
|
const vData_length = vData.length;
|
|
30247
30738
|
let elementIdx = 0;
|
|
@@ -30262,6 +30753,9 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30262
30753
|
}
|
|
30263
30754
|
return elementsToSkip;
|
|
30264
30755
|
};
|
|
30756
|
+
if (!node) {
|
|
30757
|
+
return;
|
|
30758
|
+
}
|
|
30265
30759
|
do {
|
|
30266
30760
|
if (node === exitNode) {
|
|
30267
30761
|
return;
|
|
@@ -30274,7 +30768,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30274
30768
|
while (cursor && !(nextNode = nextSibling(cursor))) {
|
|
30275
30769
|
cursor = cursor.parentNode;
|
|
30276
30770
|
}
|
|
30277
|
-
walkContainer(
|
|
30771
|
+
yield* walkContainer(
|
|
30278
30772
|
walker2,
|
|
30279
30773
|
container,
|
|
30280
30774
|
node,
|
|
@@ -30310,13 +30804,13 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30310
30804
|
throw new Error(`<!--${node?.nodeValue}--> not closed!`);
|
|
30311
30805
|
}
|
|
30312
30806
|
} while (getFastNodeType(nextNode) !== 8 /* COMMENT_SKIP_END */);
|
|
30313
|
-
walkContainer(walker2, node, node, nextNode, "", null, qContainerElement);
|
|
30807
|
+
yield* walkContainer(walker2, node, node, nextNode, "", null, qContainerElement);
|
|
30314
30808
|
} else if (nodeType === 6 /* ELEMENT_SHADOW_ROOT_WRAPPER */) {
|
|
30315
30809
|
nextNode = nextSibling(node);
|
|
30316
30810
|
const shadowRootContainer = node;
|
|
30317
30811
|
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
30318
30812
|
if (shadowRoot) {
|
|
30319
|
-
walkContainer(
|
|
30813
|
+
yield* walkContainer(
|
|
30320
30814
|
// we need to create a new walker for the shadow root
|
|
30321
30815
|
document2.createTreeWalker(
|
|
30322
30816
|
shadowRoot,
|
|
@@ -30380,16 +30874,21 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30380
30874
|
}
|
|
30381
30875
|
elementIdx++;
|
|
30382
30876
|
if (__EXPERIMENTAL__.suspense && contentBoundaryId !== null) {
|
|
30383
|
-
processSuspenseContentSegment(
|
|
30877
|
+
yield* processSuspenseContentSegment(
|
|
30878
|
+
qContainerElement,
|
|
30879
|
+
node,
|
|
30880
|
+
contentBoundaryId
|
|
30881
|
+
);
|
|
30384
30882
|
nextNode = nextSibling(node);
|
|
30385
30883
|
if (nextNode) {
|
|
30386
30884
|
walker2.currentNode = nextNode;
|
|
30387
30885
|
}
|
|
30388
30886
|
}
|
|
30389
30887
|
}
|
|
30888
|
+
yield;
|
|
30390
30889
|
} while (node = nextNode || walker2.nextNode());
|
|
30391
30890
|
};
|
|
30392
|
-
const processVNodeDataScope = (qContainerElement, contentNode, vData, scopeSegmentId)
|
|
30891
|
+
const processVNodeDataScope = function* (qContainerElement, contentNode, vData, scopeSegmentId) {
|
|
30393
30892
|
qContainerElement.qVNodeRefs || (qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map());
|
|
30394
30893
|
const scopeWalker = document2.createTreeWalker(
|
|
30395
30894
|
document2,
|
|
@@ -30397,7 +30896,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30397
30896
|
/* NodeFilter.SHOW_COMMENT */
|
|
30398
30897
|
);
|
|
30399
30898
|
scopeWalker.currentNode = contentNode;
|
|
30400
|
-
walkContainer(
|
|
30899
|
+
yield* walkContainer(
|
|
30401
30900
|
scopeWalker,
|
|
30402
30901
|
contentNode,
|
|
30403
30902
|
contentNode,
|
|
@@ -30408,39 +30907,33 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
|
|
|
30408
30907
|
scopeSegmentId
|
|
30409
30908
|
);
|
|
30410
30909
|
};
|
|
30411
|
-
const processSuspenseContentSegment =
|
|
30910
|
+
const processSuspenseContentSegment = function* (qContainerElement, contentNode, boundaryId, vData) {
|
|
30412
30911
|
vData || (vData = qContainerElement?.qSegmentVnodeData?.get(boundaryId));
|
|
30413
30912
|
if (qContainerElement && vData) {
|
|
30414
|
-
processVNodeDataScope(qContainerElement, contentNode, vData, boundaryId);
|
|
30415
|
-
}
|
|
30416
|
-
} : null;
|
|
30417
|
-
qDocument.qProcessVNodeDataPatch = (script) => {
|
|
30418
|
-
const qContainerElement = script?.closest("[q\\:container]");
|
|
30419
|
-
const patchSegment = script?.getAttribute(Q_SUSPENSE_RESOLVED);
|
|
30420
|
-
const contentNode = qContainerElement && (patchSegment ? qContainerElement.querySelector(`[q\\:rp="${patchSegment}"]`) : qContainerElement);
|
|
30421
|
-
if (qContainerElement && contentNode) {
|
|
30422
|
-
processVNodeDataScope(
|
|
30423
|
-
qContainerElement,
|
|
30424
|
-
contentNode,
|
|
30425
|
-
script.textContent,
|
|
30426
|
-
patchSegment || void 0
|
|
30427
|
-
);
|
|
30913
|
+
yield* processVNodeDataScope(qContainerElement, contentNode, vData, boundaryId);
|
|
30428
30914
|
}
|
|
30429
30915
|
};
|
|
30430
|
-
if (
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
processSuspenseContentSegment(
|
|
30916
|
+
if (segmentContainer && segmentContent && segmentVNodeData !== void 0) {
|
|
30917
|
+
segmentContainer.qVNodeRefs || (segmentContainer.qVNodeRefs = /* @__PURE__ */ new Map());
|
|
30918
|
+
if (__EXPERIMENTAL__.suspense && segmentId !== void 0) {
|
|
30919
|
+
yield* processSuspenseContentSegment(
|
|
30920
|
+
segmentContainer,
|
|
30921
|
+
segmentContent,
|
|
30922
|
+
segmentId,
|
|
30923
|
+
segmentVNodeData
|
|
30924
|
+
);
|
|
30925
|
+
} else {
|
|
30926
|
+
yield* processVNodeDataScope(segmentContainer, segmentContent, segmentVNodeData);
|
|
30434
30927
|
}
|
|
30435
30928
|
return;
|
|
30436
30929
|
}
|
|
30437
|
-
attachVnodeDataAndRefs(document2);
|
|
30930
|
+
yield* attachVnodeDataAndRefs(document2);
|
|
30438
30931
|
const walker = document2.createTreeWalker(
|
|
30439
30932
|
document2,
|
|
30440
30933
|
1 | 128
|
|
30441
30934
|
/* NodeFilter.SHOW_COMMENT */
|
|
30442
30935
|
);
|
|
30443
|
-
walkContainer(walker, null, walker.firstChild(), null, "", null, null);
|
|
30936
|
+
yield* walkContainer(walker, null, walker.firstChild(), null, "", null, null);
|
|
30444
30937
|
}
|
|
30445
30938
|
var isSeparator = (ch) => (
|
|
30446
30939
|
/* `!` */
|
|
@@ -30470,6 +30963,90 @@ var findVDataSectionEnd = (vData, start, end) => {
|
|
|
30470
30963
|
return start;
|
|
30471
30964
|
};
|
|
30472
30965
|
|
|
30966
|
+
// packages/qwik/src/core/client/process-state-data.ts
|
|
30967
|
+
function isContainerReady(container) {
|
|
30968
|
+
return container.$containerDataProcessState$ === 3 /* ProcessingStateDone */;
|
|
30969
|
+
}
|
|
30970
|
+
function processContainerStateData(container, iterator) {
|
|
30971
|
+
const state = container.$containerStateDataState$ || (container.$containerStateDataState$ = {
|
|
30972
|
+
$queue$: [],
|
|
30973
|
+
$active$: null
|
|
30974
|
+
});
|
|
30975
|
+
container.$containerDataProcessState$ = 2 /* ProcessingState */;
|
|
30976
|
+
state.$queue$.push(iterator);
|
|
30977
|
+
scheduleProcessContainerStateData(container, state);
|
|
30978
|
+
}
|
|
30979
|
+
var onContainerDataReady = (container, callback) => {
|
|
30980
|
+
const domContainer = container;
|
|
30981
|
+
const checkReady = () => {
|
|
30982
|
+
if (!isContainerReady(domContainer)) {
|
|
30983
|
+
(domContainer.$containerStateReadyCallbacks$ || (domContainer.$containerStateReadyCallbacks$ = [])).push(checkReady);
|
|
30984
|
+
return;
|
|
30985
|
+
}
|
|
30986
|
+
onVNodeDataReady(domContainer.document, () => {
|
|
30987
|
+
if (isContainerReady(domContainer)) {
|
|
30988
|
+
callback();
|
|
30989
|
+
} else {
|
|
30990
|
+
checkReady();
|
|
30991
|
+
}
|
|
30992
|
+
});
|
|
30993
|
+
};
|
|
30994
|
+
checkReady();
|
|
30995
|
+
};
|
|
30996
|
+
var whenContainerDataReady = (container, callback) => {
|
|
30997
|
+
const domContainer = container;
|
|
30998
|
+
if (isContainerReady(domContainer) && domContainer.document.qVNodeDataReady) {
|
|
30999
|
+
return callback();
|
|
31000
|
+
}
|
|
31001
|
+
return new Promise((resolve, reject) => {
|
|
31002
|
+
onContainerDataReady(domContainer, () => {
|
|
31003
|
+
try {
|
|
31004
|
+
resolve(callback());
|
|
31005
|
+
} catch (error) {
|
|
31006
|
+
reject(error);
|
|
31007
|
+
}
|
|
31008
|
+
});
|
|
31009
|
+
});
|
|
31010
|
+
};
|
|
31011
|
+
function scheduleProcessContainerStateData(container, state) {
|
|
31012
|
+
if (state.$active$) {
|
|
31013
|
+
return;
|
|
31014
|
+
}
|
|
31015
|
+
const iterator = state.$queue$.shift();
|
|
31016
|
+
if (!iterator) {
|
|
31017
|
+
markContainerDataReady(container);
|
|
31018
|
+
return;
|
|
31019
|
+
}
|
|
31020
|
+
state.$active$ = createYieldingIteratorState(
|
|
31021
|
+
iterator,
|
|
31022
|
+
() => {
|
|
31023
|
+
state.$active$ = null;
|
|
31024
|
+
scheduleProcessContainerStateData(container, state);
|
|
31025
|
+
},
|
|
31026
|
+
(error) => {
|
|
31027
|
+
state.$active$ = null;
|
|
31028
|
+
logError(error);
|
|
31029
|
+
markContainerDataReady(container);
|
|
31030
|
+
}
|
|
31031
|
+
);
|
|
31032
|
+
scheduleYieldingIterator(state.$active$);
|
|
31033
|
+
}
|
|
31034
|
+
function markContainerDataReady(container) {
|
|
31035
|
+
const state = container.$containerDataProcessState$;
|
|
31036
|
+
if (state !== 2 /* ProcessingState */) {
|
|
31037
|
+
return;
|
|
31038
|
+
}
|
|
31039
|
+
container.$containerDataProcessState$ = 3 /* ProcessingStateDone */;
|
|
31040
|
+
container.$containerStateDataState$ = void 0;
|
|
31041
|
+
const callbacks = container.$containerStateReadyCallbacks$;
|
|
31042
|
+
container.$containerStateReadyCallbacks$ = void 0;
|
|
31043
|
+
if (callbacks) {
|
|
31044
|
+
for (let i2 = 0; i2 < callbacks.length; i2++) {
|
|
31045
|
+
callbacks[i2]();
|
|
31046
|
+
}
|
|
31047
|
+
}
|
|
31048
|
+
}
|
|
31049
|
+
|
|
30473
31050
|
// packages/qwik/src/core/client/dom-container.ts
|
|
30474
31051
|
function getDomContainer(element) {
|
|
30475
31052
|
const qContainerElement = _getQContainerElement(element);
|
|
@@ -30490,8 +31067,14 @@ function getOutOfOrderStreamingScript(boundaryId, content) {
|
|
|
30490
31067
|
const qContainerElement = content?.closest(QContainerSelector);
|
|
30491
31068
|
const qContainer = qContainerElement?.qContainer;
|
|
30492
31069
|
if (qContainer) {
|
|
30493
|
-
|
|
30494
|
-
|
|
31070
|
+
const document2 = qContainer.element.ownerDocument;
|
|
31071
|
+
processOutOfOrderSegmentVNodeData(document2, segmentId, content);
|
|
31072
|
+
onVNodeDataReady(document2, () => {
|
|
31073
|
+
qContainer.element.qContainer === qContainer && processContainerStateData(
|
|
31074
|
+
qContainer,
|
|
31075
|
+
processSegmentStateScriptsIterator(qContainer, segmentId)
|
|
31076
|
+
);
|
|
31077
|
+
});
|
|
30495
31078
|
}
|
|
30496
31079
|
}
|
|
30497
31080
|
var DomContainer = class extends _SharedContainer {
|
|
@@ -30507,6 +31090,9 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30507
31090
|
__publicField(this, "$instanceHash$");
|
|
30508
31091
|
__publicField(this, "$forwardRefs$", null);
|
|
30509
31092
|
__publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
|
|
31093
|
+
__publicField(this, "$containerDataProcessState$", 0 /* NotStarted */);
|
|
31094
|
+
__publicField(this, "$containerStateReadyCallbacks$");
|
|
31095
|
+
__publicField(this, "$containerStateDataState$");
|
|
30510
31096
|
__publicField(this, "$rawStateData$");
|
|
30511
31097
|
__publicField(this, "$stateData$");
|
|
30512
31098
|
__publicField(this, "$rootForwardRefs$", null);
|
|
@@ -30518,7 +31104,8 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30518
31104
|
if (!this.qContainer) {
|
|
30519
31105
|
throw qError(25 /* elementWithoutContainer */);
|
|
30520
31106
|
}
|
|
30521
|
-
|
|
31107
|
+
const document2 = element.ownerDocument;
|
|
31108
|
+
this.document = document2;
|
|
30522
31109
|
this.element = element;
|
|
30523
31110
|
this.$buildBase$ = element.getAttribute(QBaseAttr);
|
|
30524
31111
|
this.$instanceHash$ = element.getAttribute(QInstanceAttr);
|
|
@@ -30526,23 +31113,48 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30526
31113
|
this.rootVNode = vnode_newUnMaterializedElement(this.element);
|
|
30527
31114
|
this.$rawStateData$ = [];
|
|
30528
31115
|
this.$stateData$ = [];
|
|
30529
|
-
const document2 = this.element.ownerDocument;
|
|
30530
|
-
if (!document2.qVNodeDataProcessed) {
|
|
30531
|
-
processVNodeData(document2);
|
|
30532
|
-
}
|
|
30533
31116
|
if (__EXPERIMENTAL__.suspense && document2.querySelector("template[q\\:r]")) {
|
|
30534
31117
|
document2.qProcessOOOS || (document2.qProcessOOOS = getOutOfOrderStreamingScript);
|
|
30535
31118
|
}
|
|
30536
31119
|
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
30537
31120
|
this.$setServerData$();
|
|
30538
|
-
element.setAttribute(QContainerAttr, "resumed" /* RESUMED */);
|
|
30539
31121
|
element.qContainer = this;
|
|
30540
31122
|
element.qDestroy = () => this.$destroy$();
|
|
30541
|
-
this.$
|
|
31123
|
+
this.$containerDataProcessState$ = 1 /* ProcessingVNode */;
|
|
31124
|
+
processVNodeData(document2, element);
|
|
31125
|
+
onVNodeDataReady(document2, () => {
|
|
31126
|
+
if (this.$containerDataProcessState$ === 1 /* ProcessingVNode */) {
|
|
31127
|
+
processContainerStateData(this, this.$processContainerData$());
|
|
31128
|
+
}
|
|
31129
|
+
});
|
|
31130
|
+
}
|
|
31131
|
+
*$processContainerData$() {
|
|
31132
|
+
const element = this.element;
|
|
31133
|
+
if (element.qContainer !== this) {
|
|
31134
|
+
return;
|
|
31135
|
+
}
|
|
31136
|
+
const rootState = element.querySelector(
|
|
31137
|
+
`script[type="qwik/state"][q\\:instance="${this.$instanceHash$}"]:not(${QStatePatchAttrSelector})`
|
|
31138
|
+
) || element.querySelector(
|
|
31139
|
+
`script[type="qwik/state"]:not([q\\:instance]):not(${QStatePatchAttrSelector})`
|
|
31140
|
+
);
|
|
31141
|
+
if (rootState) {
|
|
31142
|
+
this.$rawStateData$ = JSON.parse(rootState.textContent);
|
|
31143
|
+
yield* preprocessStateIterator(this.$rawStateData$, this);
|
|
31144
|
+
this.$rootForwardRefs$ = this.$forwardRefs$;
|
|
31145
|
+
const rootCount = this.$rawStateData$.length / 2;
|
|
31146
|
+
const statePrewarm = element.getAttribute(QStatePrewarmAttr);
|
|
31147
|
+
if (statePrewarm !== null && rootCount > 0 && rootCount >= Number(statePrewarm)) {
|
|
31148
|
+
this.$stateData$ = yield* eagerDeserializeStateIterator(this, this.$rawStateData$);
|
|
31149
|
+
} else {
|
|
31150
|
+
this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
31151
|
+
}
|
|
31152
|
+
}
|
|
30542
31153
|
if (__EXPERIMENTAL__.suspense) {
|
|
30543
|
-
|
|
31154
|
+
yield* processSegmentStateScriptsIterator(this);
|
|
30544
31155
|
}
|
|
30545
31156
|
this.$hoistStyles$();
|
|
31157
|
+
element.setAttribute(QContainerAttr, "resumed" /* RESUMED */);
|
|
30546
31158
|
if (!qTest && element.isConnected) {
|
|
30547
31159
|
element.dispatchEvent(new CustomEvent("qresume", { bubbles: true }));
|
|
30548
31160
|
}
|
|
@@ -30562,9 +31174,15 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30562
31174
|
}
|
|
30563
31175
|
el.removeAttribute(QContainerAttr);
|
|
30564
31176
|
const document2 = el.ownerDocument;
|
|
31177
|
+
this.$containerStateDataState$ = void 0;
|
|
31178
|
+
this.$containerDataProcessState$ = 0 /* NotStarted */;
|
|
30565
31179
|
const hasContainers = document2.querySelector(QContainerSelector) !== null;
|
|
30566
31180
|
if (!hasContainers) {
|
|
30567
31181
|
document2.qVNodeData = void 0;
|
|
31182
|
+
document2.qVNodeDataStarted = void 0;
|
|
31183
|
+
document2.qVNodeDataReady = void 0;
|
|
31184
|
+
document2.qVNodeDataState = void 0;
|
|
31185
|
+
document2.qVNodeDataCallbacks = void 0;
|
|
30568
31186
|
document2.qVNodeDataProcessed = void 0;
|
|
30569
31187
|
document2.qProcessVNodeDataPatch = void 0;
|
|
30570
31188
|
}
|
|
@@ -30574,20 +31192,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30574
31192
|
}
|
|
30575
31193
|
}
|
|
30576
31194
|
}
|
|
30577
|
-
$processRootStateScript$() {
|
|
30578
|
-
const rootState = this.element.querySelector(
|
|
30579
|
-
`${this.$stateScriptSelector$()}:not(${QStatePatchAttrSelector})`
|
|
30580
|
-
);
|
|
30581
|
-
if (rootState) {
|
|
30582
|
-
this.$rawStateData$ = JSON.parse(rootState.textContent);
|
|
30583
|
-
preprocessState(this.$rawStateData$, this);
|
|
30584
|
-
this.$rootForwardRefs$ = this.$forwardRefs$;
|
|
30585
|
-
this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
30586
|
-
}
|
|
30587
|
-
}
|
|
30588
|
-
$stateScriptSelector$() {
|
|
30589
|
-
return `script[type="qwik/state"][q\\:instance="${this.$instanceHash$}"]`;
|
|
30590
|
-
}
|
|
30591
31195
|
/**
|
|
30592
31196
|
* The first time we render we need to hoist the styles. (Meaning we need to move all styles from
|
|
30593
31197
|
* component inline to <head>)
|
|
@@ -30682,7 +31286,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30682
31286
|
case OnRenderProp:
|
|
30683
31287
|
case QCtxAttr:
|
|
30684
31288
|
case QBackRefs:
|
|
30685
|
-
case QCursorBoundary:
|
|
30686
31289
|
getObjectById2 = this.$getObjectById$;
|
|
30687
31290
|
break;
|
|
30688
31291
|
case ELEMENT_SEQ_IDX:
|
|
@@ -30716,7 +31319,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30716
31319
|
}
|
|
30717
31320
|
getSyncFn(id) {
|
|
30718
31321
|
const fn = this.$qFuncs$[id];
|
|
30719
|
-
|
|
31322
|
+
isDev23 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
|
|
30720
31323
|
return fn;
|
|
30721
31324
|
}
|
|
30722
31325
|
$appendStyle$(content, styleId, host, scoped) {
|
|
@@ -30761,10 +31364,10 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30761
31364
|
};
|
|
30762
31365
|
|
|
30763
31366
|
// packages/qwik/src/core/use/use-locale.ts
|
|
30764
|
-
import { isServer as
|
|
31367
|
+
import { isServer as isServer11 } from "@qwik.dev/core/build";
|
|
30765
31368
|
var _locale = void 0;
|
|
30766
31369
|
var localAsyncStore;
|
|
30767
|
-
if (
|
|
31370
|
+
if (isServer11) {
|
|
30768
31371
|
const AsyncLocalStorage = getAsyncLocalStorage();
|
|
30769
31372
|
if (AsyncLocalStorage) {
|
|
30770
31373
|
localAsyncStore = new AsyncLocalStorage();
|
|
@@ -30795,8 +31398,7 @@ function invokeApply(context, fn, args) {
|
|
|
30795
31398
|
_context = previousContext;
|
|
30796
31399
|
}
|
|
30797
31400
|
}
|
|
30798
|
-
var newInvokeContextFromDOM = (event, element) => {
|
|
30799
|
-
const domContainer = getDomContainer(element);
|
|
31401
|
+
var newInvokeContextFromDOM = (event, element, domContainer = getDomContainer(element)) => {
|
|
30800
31402
|
const hostElement = vnode_locate(domContainer.rootVNode, element);
|
|
30801
31403
|
const locale = domContainer.$locale$;
|
|
30802
31404
|
locale && setLocale(locale);
|
|
@@ -30868,9 +31470,9 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
|
30868
31470
|
};
|
|
30869
31471
|
|
|
30870
31472
|
// packages/qwik/src/core/reactive-primitives/impl/store.ts
|
|
30871
|
-
import { isDev as
|
|
30872
|
-
var
|
|
30873
|
-
var
|
|
31473
|
+
import { isDev as isDev24, isServer as isServer12 } from "@qwik.dev/core/build";
|
|
31474
|
+
var DEBUG6 = false;
|
|
31475
|
+
var log4 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
|
|
30874
31476
|
var getStoreHandler = (value) => {
|
|
30875
31477
|
return value[STORE_HANDLER];
|
|
30876
31478
|
};
|
|
@@ -30899,8 +31501,8 @@ var getOrCreateStore = (obj, flags, container) => {
|
|
|
30899
31501
|
};
|
|
30900
31502
|
var StoreHandler2 = class {
|
|
30901
31503
|
constructor($flags$, $container$) {
|
|
30902
|
-
this
|
|
30903
|
-
this
|
|
31504
|
+
__publicField(this, "$flags$", $flags$);
|
|
31505
|
+
__publicField(this, "$container$", $container$);
|
|
30904
31506
|
__publicField(this, "$effects$");
|
|
30905
31507
|
}
|
|
30906
31508
|
toString() {
|
|
@@ -30929,7 +31531,7 @@ var StoreHandler2 = class {
|
|
|
30929
31531
|
}
|
|
30930
31532
|
this.$container$ = ctx.$container$;
|
|
30931
31533
|
} else {
|
|
30932
|
-
|
|
31534
|
+
isDev24 && assertTrue(
|
|
30933
31535
|
!ctx.$container$ || isSameContainer(ctx.$container$, this.$container$),
|
|
30934
31536
|
"Do not use signals across containers"
|
|
30935
31537
|
);
|
|
@@ -30964,11 +31566,11 @@ var StoreHandler2 = class {
|
|
|
30964
31566
|
if (prop in target) {
|
|
30965
31567
|
const oldValue = target[prop];
|
|
30966
31568
|
if (newValue !== oldValue) {
|
|
30967
|
-
|
|
31569
|
+
DEBUG6 && log4("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
|
|
30968
31570
|
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
30969
31571
|
}
|
|
30970
31572
|
} else {
|
|
30971
|
-
|
|
31573
|
+
DEBUG6 && log4("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
|
|
30972
31574
|
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
30973
31575
|
}
|
|
30974
31576
|
return true;
|
|
@@ -31032,7 +31634,7 @@ function addStoreEffect(target, prop, store, effectSubscription, renderContainer
|
|
|
31032
31634
|
effects = /* @__PURE__ */ new Set();
|
|
31033
31635
|
effectsMap.set(prop, effects);
|
|
31034
31636
|
}
|
|
31035
|
-
const isOnServer = qTest ? isServerPlatform() :
|
|
31637
|
+
const isOnServer = qTest ? isServerPlatform() : isServer12;
|
|
31036
31638
|
const shouldRecordExternalRootEffect = __EXPERIMENTAL__.suspense && store instanceof StoreHandler2 && isOnServer;
|
|
31037
31639
|
ensureContainsSubscription(effects, effectSubscription);
|
|
31038
31640
|
ensureContainsBackRef(effectSubscription, target);
|
|
@@ -31051,7 +31653,7 @@ function addStoreEffect(target, prop, store, effectSubscription, renderContainer
|
|
|
31051
31653
|
}
|
|
31052
31654
|
addQrlToSerializationCtx(effectSubscription, serializationContainer);
|
|
31053
31655
|
}
|
|
31054
|
-
|
|
31656
|
+
DEBUG6 && log4(
|
|
31055
31657
|
"sub",
|
|
31056
31658
|
pad(
|
|
31057
31659
|
"\n" + [...store.$effects$?.entries() || []].map(([key, value]) => `${String(key)}: ${String(value)}`).join(","),
|
|
@@ -31281,9 +31883,9 @@ var NoSerializeSymbol = /* @__PURE__ */ Symbol("noSerialize");
|
|
|
31281
31883
|
var SerializerSymbol = /* @__PURE__ */ Symbol("serialize");
|
|
31282
31884
|
|
|
31283
31885
|
// packages/qwik/src/core/reactive-primitives/utils.ts
|
|
31284
|
-
import { isBrowser as isBrowser4, isDev as
|
|
31285
|
-
var
|
|
31286
|
-
var
|
|
31886
|
+
import { isBrowser as isBrowser4, isDev as isDev25 } from "@qwik.dev/core/build";
|
|
31887
|
+
var DEBUG7 = false;
|
|
31888
|
+
var log5 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
31287
31889
|
var throwIfQRLNotResolved = (qrl) => {
|
|
31288
31890
|
const resolved = qrl.resolved;
|
|
31289
31891
|
if (!resolved) {
|
|
@@ -31328,7 +31930,7 @@ var scheduleEffects = (container, signal, effects) => {
|
|
|
31328
31930
|
const scheduleEffect = (effectSubscription) => {
|
|
31329
31931
|
const consumer = effectSubscription.consumer;
|
|
31330
31932
|
const property = effectSubscription.property;
|
|
31331
|
-
|
|
31933
|
+
isDev25 && assertDefined(container, "Container must be defined.");
|
|
31332
31934
|
if (isTask(consumer)) {
|
|
31333
31935
|
consumer.$flags$ |= 4 /* DIRTY */;
|
|
31334
31936
|
markVNodeDirty(container, consumer.$el$, 1 /* TASKS */);
|
|
@@ -31370,7 +31972,7 @@ var scheduleEffects = (container, signal, effects) => {
|
|
|
31370
31972
|
scheduleEffect(effectsSnapshot[i2]);
|
|
31371
31973
|
}
|
|
31372
31974
|
}
|
|
31373
|
-
|
|
31975
|
+
DEBUG7 && log5("done scheduling");
|
|
31374
31976
|
};
|
|
31375
31977
|
var isSerializerObj = (obj) => {
|
|
31376
31978
|
return isObject(obj) && typeof obj[SerializerSymbol] === "function";
|
|
@@ -31485,8 +32087,8 @@ var mergeMaps = (map1, map2) => {
|
|
|
31485
32087
|
var TextVNode = class extends VNode {
|
|
31486
32088
|
constructor(flags, parent, previousSibling, nextSibling, props, node, text) {
|
|
31487
32089
|
super(flags, parent, previousSibling, nextSibling, props);
|
|
31488
|
-
this
|
|
31489
|
-
this
|
|
32090
|
+
__publicField(this, "node", node);
|
|
32091
|
+
__publicField(this, "text", text);
|
|
31490
32092
|
}
|
|
31491
32093
|
};
|
|
31492
32094
|
|
|
@@ -31512,7 +32114,7 @@ var createFastGetter = (propName) => {
|
|
|
31512
32114
|
|
|
31513
32115
|
// packages/qwik/src/core/client/vnode-utils.ts
|
|
31514
32116
|
var vnode_newElement = (element, elementName, key = null) => {
|
|
31515
|
-
|
|
32117
|
+
isDev26 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
31516
32118
|
const vnode = new ElementVNode(
|
|
31517
32119
|
key,
|
|
31518
32120
|
1 /* Element */ | 8 /* Inflated */ | -1 << 12 /* shift */,
|
|
@@ -31530,7 +32132,7 @@ var vnode_newElement = (element, elementName, key = null) => {
|
|
|
31530
32132
|
return vnode;
|
|
31531
32133
|
};
|
|
31532
32134
|
var vnode_newUnMaterializedElement = (element) => {
|
|
31533
|
-
|
|
32135
|
+
isDev26 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
31534
32136
|
const vnode = new ElementVNode(
|
|
31535
32137
|
null,
|
|
31536
32138
|
1 /* Element */ | -1 << 12 /* shift */,
|
|
@@ -31548,7 +32150,7 @@ var vnode_newUnMaterializedElement = (element) => {
|
|
|
31548
32150
|
return vnode;
|
|
31549
32151
|
};
|
|
31550
32152
|
var vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
|
|
31551
|
-
|
|
32153
|
+
isDev26 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
|
|
31552
32154
|
const vnode = new TextVNode(
|
|
31553
32155
|
4 /* Text */ | -1 << 12 /* shift */,
|
|
31554
32156
|
// Flag
|
|
@@ -31580,10 +32182,10 @@ var vnode_newText = (textNode, textContent) => {
|
|
|
31580
32182
|
textContent
|
|
31581
32183
|
// Text Content
|
|
31582
32184
|
);
|
|
31583
|
-
|
|
31584
|
-
|
|
31585
|
-
|
|
31586
|
-
|
|
32185
|
+
isDev26 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
|
|
32186
|
+
isDev26 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
|
|
32187
|
+
isDev26 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
|
|
32188
|
+
isDev26 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
|
|
31587
32189
|
return vnode;
|
|
31588
32190
|
};
|
|
31589
32191
|
var vnode_newVirtual = () => {
|
|
@@ -31598,9 +32200,9 @@ var vnode_newVirtual = () => {
|
|
|
31598
32200
|
null,
|
|
31599
32201
|
null
|
|
31600
32202
|
);
|
|
31601
|
-
|
|
31602
|
-
|
|
31603
|
-
|
|
32203
|
+
isDev26 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
|
|
32204
|
+
isDev26 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
|
|
32205
|
+
isDev26 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
|
|
31604
32206
|
return vnode;
|
|
31605
32207
|
};
|
|
31606
32208
|
var vnode_isVNode = (vNode) => {
|
|
@@ -31610,12 +32212,12 @@ var vnode_isElementVNode = (vNode) => {
|
|
|
31610
32212
|
return (vNode.flags & 1 /* Element */) === 1 /* Element */;
|
|
31611
32213
|
};
|
|
31612
32214
|
var vnode_isElementOrTextVNode = (vNode) => {
|
|
31613
|
-
|
|
32215
|
+
isDev26 && assertDefined(vNode, "Missing vNode");
|
|
31614
32216
|
const flag = vNode.flags;
|
|
31615
32217
|
return (flag & 5 /* ELEMENT_OR_TEXT_MASK */) !== 0;
|
|
31616
32218
|
};
|
|
31617
32219
|
var vnode_isMaterialized = (vNode) => {
|
|
31618
|
-
|
|
32220
|
+
isDev26 && assertDefined(vNode, "Missing vNode");
|
|
31619
32221
|
const flag = vNode.flags;
|
|
31620
32222
|
return (flag & 1 /* Element */) === 1 /* Element */ && vNode.firstChild !== void 0 && vNode.lastChild !== void 0;
|
|
31621
32223
|
};
|
|
@@ -31626,26 +32228,26 @@ var vnode_isVirtualVNode = (vNode) => {
|
|
|
31626
32228
|
return (vNode.flags & 2 /* Virtual */) === 2 /* Virtual */;
|
|
31627
32229
|
};
|
|
31628
32230
|
var vnode_isProjection = (vNode) => {
|
|
31629
|
-
|
|
32231
|
+
isDev26 && assertDefined(vNode, "Missing vNode");
|
|
31630
32232
|
const flag = vNode.flags;
|
|
31631
32233
|
return (flag & 2 /* Virtual */) === 2 /* Virtual */ && vnode_getProp(vNode, QSlot, null) !== null;
|
|
31632
32234
|
};
|
|
31633
32235
|
var ensureTextVNode = (vNode) => {
|
|
31634
|
-
|
|
32236
|
+
isDev26 && assertTrue(
|
|
31635
32237
|
vnode_isTextVNode(vNode),
|
|
31636
32238
|
"Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31637
32239
|
);
|
|
31638
32240
|
return vNode;
|
|
31639
32241
|
};
|
|
31640
32242
|
var ensureElementOrVirtualVNode = (vNode) => {
|
|
31641
|
-
|
|
31642
|
-
|
|
32243
|
+
isDev26 && assertDefined(vNode, "Missing vNode");
|
|
32244
|
+
isDev26 && assertTrue(
|
|
31643
32245
|
(vNode.flags & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0,
|
|
31644
32246
|
"Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31645
32247
|
);
|
|
31646
32248
|
};
|
|
31647
32249
|
var ensureElementVNode = (vNode) => {
|
|
31648
|
-
|
|
32250
|
+
isDev26 && assertTrue(
|
|
31649
32251
|
vnode_isElementVNode(vNode),
|
|
31650
32252
|
"Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31651
32253
|
);
|
|
@@ -31886,7 +32488,7 @@ var vnode_ensureTextInflated = (journal, vnode) => {
|
|
|
31886
32488
|
const flags = textVNode.flags;
|
|
31887
32489
|
if ((flags & 8 /* Inflated */) === 0) {
|
|
31888
32490
|
const parentNode = vnode_getDomParent(vnode, true);
|
|
31889
|
-
|
|
32491
|
+
isDev26 && assertDefined(parentNode, "Missing parent node.");
|
|
31890
32492
|
const sharedTextNode = textVNode.node;
|
|
31891
32493
|
const doc = fastOwnerDocument(parentNode);
|
|
31892
32494
|
let vCursor = vnode_getDomSibling(vnode, false, true);
|
|
@@ -31936,7 +32538,7 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
31936
32538
|
let refElement;
|
|
31937
32539
|
const localId = typeof id === "string" ? id : "";
|
|
31938
32540
|
if (typeof id === "string") {
|
|
31939
|
-
|
|
32541
|
+
isDev26 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
|
|
31940
32542
|
elementOffset = parseInt(localId);
|
|
31941
32543
|
refElement = qVNodeRefs.get(elementOffset);
|
|
31942
32544
|
} else {
|
|
@@ -31953,12 +32555,12 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
31953
32555
|
return vNode;
|
|
31954
32556
|
}
|
|
31955
32557
|
}
|
|
31956
|
-
|
|
32558
|
+
isDev26 && assertDefined(
|
|
31957
32559
|
refElement,
|
|
31958
32560
|
"Missing refElement " + (typeof id === "string" ? `for id ${id}` : "")
|
|
31959
32561
|
);
|
|
31960
32562
|
if (!vnode_isVNode(refElement)) {
|
|
31961
|
-
|
|
32563
|
+
isDev26 && assertTrue(
|
|
31962
32564
|
containerElement.contains(refElement),
|
|
31963
32565
|
`Couldn't find the element inside the container while locating the VNode.`
|
|
31964
32566
|
);
|
|
@@ -32007,10 +32609,10 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
32007
32609
|
};
|
|
32008
32610
|
var vnode_getChildWithIdx = (vNode, childIdx) => {
|
|
32009
32611
|
let child = vnode_getFirstChild(vNode);
|
|
32010
|
-
|
|
32612
|
+
isDev26 && assertDefined(child, "Missing child.");
|
|
32011
32613
|
while (child.flags >>> 12 /* shift */ !== childIdx) {
|
|
32012
32614
|
child = child.nextSibling;
|
|
32013
|
-
|
|
32615
|
+
isDev26 && assertDefined(child, "Missing child.");
|
|
32014
32616
|
}
|
|
32015
32617
|
return child;
|
|
32016
32618
|
};
|
|
@@ -32018,7 +32620,7 @@ var vNodeStack = [];
|
|
|
32018
32620
|
var vnode_getVNodeForChildNode = (vNode, childElement) => {
|
|
32019
32621
|
ensureElementVNode(vNode);
|
|
32020
32622
|
let child = vnode_getFirstChild(vNode);
|
|
32021
|
-
|
|
32623
|
+
isDev26 && assertDefined(child, "Missing child.");
|
|
32022
32624
|
while (child && (child instanceof ElementVNode ? child.node !== childElement : true)) {
|
|
32023
32625
|
if (vnode_isVirtualVNode(child)) {
|
|
32024
32626
|
const next = child.nextSibling;
|
|
@@ -32037,13 +32639,13 @@ var vnode_getVNodeForChildNode = (vNode, childElement) => {
|
|
|
32037
32639
|
child = next || vNodeStack.pop();
|
|
32038
32640
|
}
|
|
32039
32641
|
}
|
|
32040
|
-
|
|
32642
|
+
isDev26 && assertDefined(child, "Missing child.");
|
|
32041
32643
|
}
|
|
32042
32644
|
while (vNodeStack.length) {
|
|
32043
32645
|
vNodeStack.pop();
|
|
32044
32646
|
}
|
|
32045
32647
|
ensureElementVNode(child);
|
|
32046
|
-
|
|
32648
|
+
isDev26 && assertEqual(child.node, childElement, "Child not found.");
|
|
32047
32649
|
return child;
|
|
32048
32650
|
};
|
|
32049
32651
|
var indexOfAlphanumeric = (id, length) => {
|
|
@@ -32301,7 +32903,7 @@ var vnode_getDomParentVNode = (vnode, includeProjection) => {
|
|
|
32301
32903
|
return vnode;
|
|
32302
32904
|
};
|
|
32303
32905
|
var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
32304
|
-
|
|
32906
|
+
isDev26 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
|
|
32305
32907
|
if (vnode_isTextVNode(vToRemove)) {
|
|
32306
32908
|
vnode_ensureTextInflated(journal, vToRemove);
|
|
32307
32909
|
}
|
|
@@ -32334,7 +32936,7 @@ var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
|
32334
32936
|
vToRemove.nextSibling = null;
|
|
32335
32937
|
};
|
|
32336
32938
|
var vnode_truncate = (journal, vParent, vDelete, removeDOM = true) => {
|
|
32337
|
-
|
|
32939
|
+
isDev26 && assertDefined(vDelete, "Missing vDelete.");
|
|
32338
32940
|
const parent = vnode_getDomParent(vParent, true);
|
|
32339
32941
|
if (parent && removeDOM) {
|
|
32340
32942
|
if (vnode_isElementOrTextVNode(vParent)) {
|
|
@@ -32437,8 +33039,8 @@ var ensureMaterialized = (vnode) => {
|
|
|
32437
33039
|
vFirstChild = vnode_materialize(vParent);
|
|
32438
33040
|
}
|
|
32439
33041
|
}
|
|
32440
|
-
|
|
32441
|
-
|
|
33042
|
+
isDev26 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
|
|
33043
|
+
isDev26 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
|
|
32442
33044
|
return vFirstChild;
|
|
32443
33045
|
};
|
|
32444
33046
|
var _fastHasAttribute = null;
|
|
@@ -32610,7 +33212,7 @@ var materializeFromDOM = (vParent, firstChild, vData, segmentId) => {
|
|
|
32610
33212
|
}
|
|
32611
33213
|
const id = consumeValue();
|
|
32612
33214
|
container.$setRawState$(parseInt(id, 10), vParent);
|
|
32613
|
-
|
|
33215
|
+
isDev26 && vnode_setProp(vParent, ELEMENT_ID, id);
|
|
32614
33216
|
} else if (peek() === VNodeDataChar.BACK_REFS) {
|
|
32615
33217
|
if (!container) {
|
|
32616
33218
|
container = getDomContainer(vParent.node);
|
|
@@ -32675,8 +33277,17 @@ var processVNodeData2 = (vData, callback) => {
|
|
|
32675
33277
|
}
|
|
32676
33278
|
return vData.substring(start, nextToConsumeIdx);
|
|
32677
33279
|
};
|
|
33280
|
+
const consumeEncodedValue = () => {
|
|
33281
|
+
if (getChar(nextToConsumeIdx + 1) !== VNodeDataChar.SEPARATOR) {
|
|
33282
|
+
return consumeValue();
|
|
33283
|
+
}
|
|
33284
|
+
consume();
|
|
33285
|
+
const value = decodeURIComponent(decodeVNodeDataString(consumeValue()));
|
|
33286
|
+
consume();
|
|
33287
|
+
return value;
|
|
33288
|
+
};
|
|
32678
33289
|
while (peek() !== 0) {
|
|
32679
|
-
callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
|
|
33290
|
+
callback(peek, consumeValue, consume, getChar, nextToConsumeIdx, consumeEncodedValue);
|
|
32680
33291
|
}
|
|
32681
33292
|
};
|
|
32682
33293
|
var vnode_getAttrKeys = (container, vnode) => {
|
|
@@ -32861,12 +33472,12 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
|
|
|
32861
33472
|
return !nodeIsElement || nodeIsElement && shouldSkipElement(node);
|
|
32862
33473
|
};
|
|
32863
33474
|
let components = null;
|
|
32864
|
-
processVNodeData2(vData, (peek, consumeValue, consume, getChar,
|
|
33475
|
+
processVNodeData2(vData, (peek, consumeValue, consume, getChar, dataIdx, consumeEncodedValue) => {
|
|
32865
33476
|
if (isNumber(peek())) {
|
|
32866
33477
|
while (shouldSkipNode(child)) {
|
|
32867
33478
|
child = fastNextSibling(child);
|
|
32868
33479
|
if (!child) {
|
|
32869
|
-
throw qError(27 /* materializeVNodeDataError */, [vData, peek(),
|
|
33480
|
+
throw qError(27 /* materializeVNodeDataError */, [vData, peek(), dataIdx]);
|
|
32870
33481
|
}
|
|
32871
33482
|
}
|
|
32872
33483
|
combinedText = null;
|
|
@@ -32887,35 +33498,35 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
|
|
|
32887
33498
|
) {
|
|
32888
33499
|
child = fastNextSibling(child);
|
|
32889
33500
|
if (!child && value > 0) {
|
|
32890
|
-
throw qError(27 /* materializeVNodeDataError */, [vData, peek(),
|
|
33501
|
+
throw qError(27 /* materializeVNodeDataError */, [vData, peek(), dataIdx]);
|
|
32891
33502
|
}
|
|
32892
33503
|
}
|
|
32893
33504
|
}
|
|
32894
33505
|
} else if (peek() === VNodeDataChar.SCOPED_STYLE) {
|
|
32895
33506
|
vnode_setProp(vParent, QScopedStyle, consumeValue());
|
|
32896
33507
|
} else if (peek() === VNodeDataChar.RENDER_FN) {
|
|
32897
|
-
|
|
32898
|
-
|
|
33508
|
+
const renderRef = consumeValue();
|
|
33509
|
+
if (renderRef.charCodeAt(0) === VNodeDataChar.RENDER_HASH_PREFIX) {
|
|
33510
|
+
vnode_setProp(
|
|
33511
|
+
vParent,
|
|
33512
|
+
QComponentHash,
|
|
33513
|
+
decodeURIComponent(decodeVNodeDataString(renderRef.slice(1)))
|
|
33514
|
+
);
|
|
33515
|
+
} else {
|
|
33516
|
+
(components || (components = [])).push(vParent);
|
|
33517
|
+
vnode_setProp(vParent, OnRenderProp, renderRef);
|
|
33518
|
+
}
|
|
32899
33519
|
} else if (peek() === VNodeDataChar.ID) {
|
|
32900
33520
|
if (!container) {
|
|
32901
33521
|
container = getDomContainer(element);
|
|
32902
33522
|
}
|
|
32903
33523
|
const id = consumeValue();
|
|
32904
33524
|
container.$setRawState$(parseInt(id, 10), vParent);
|
|
32905
|
-
|
|
33525
|
+
isDev26 && vnode_setProp(vParent, ELEMENT_ID, id);
|
|
32906
33526
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
32907
33527
|
vnode_setProp(vParent, ELEMENT_PROPS, consumeValue());
|
|
32908
33528
|
} else if (peek() === VNodeDataChar.KEY) {
|
|
32909
|
-
|
|
32910
|
-
let value;
|
|
32911
|
-
if (isEscapedValue) {
|
|
32912
|
-
consume();
|
|
32913
|
-
value = decodeURIComponent(decodeVNodeDataString(consumeValue()));
|
|
32914
|
-
consume();
|
|
32915
|
-
} else {
|
|
32916
|
-
value = consumeValue();
|
|
32917
|
-
}
|
|
32918
|
-
vParent.key = value;
|
|
33529
|
+
vParent.key = consumeEncodedValue();
|
|
32919
33530
|
} else if (peek() === VNodeDataChar.SEQ) {
|
|
32920
33531
|
vnode_setProp(vParent, ELEMENT_SEQ, consumeValue());
|
|
32921
33532
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
@@ -32941,8 +33552,8 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
|
|
|
32941
33552
|
vFirst = vLast = null;
|
|
32942
33553
|
} else if (peek() === VNodeDataChar.SEPARATOR) {
|
|
32943
33554
|
const keyValue = consumeValue();
|
|
32944
|
-
const key = decodeVNodeDataString(keyValue);
|
|
32945
|
-
const valueSeparatorIdx =
|
|
33555
|
+
const key = decodeURIComponent(decodeVNodeDataString(keyValue));
|
|
33556
|
+
const valueSeparatorIdx = dataIdx + keyValue.length + 1;
|
|
32946
33557
|
const isEscapedValue = getChar(valueSeparatorIdx + 1) === VNodeDataChar.SEPARATOR;
|
|
32947
33558
|
let value;
|
|
32948
33559
|
if (isEscapedValue) {
|
|
@@ -32962,8 +33573,7 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
|
|
|
32962
33573
|
vFirst = stack.pop();
|
|
32963
33574
|
vParent = stack.pop();
|
|
32964
33575
|
} else if (peek() === VNodeDataChar.SLOT) {
|
|
32965
|
-
|
|
32966
|
-
vnode_setProp(vParent, QSlot, value);
|
|
33576
|
+
vnode_setProp(vParent, QSlot, consumeEncodedValue());
|
|
32967
33577
|
} else {
|
|
32968
33578
|
while (isElement(child) && shouldSkipElement(child)) {
|
|
32969
33579
|
child = fastNextSibling(child);
|
|
@@ -34536,7 +35146,7 @@ import {
|
|
|
34536
35146
|
_vnode_toString
|
|
34537
35147
|
} from "@qwik.dev/core/internal";
|
|
34538
35148
|
import { expect as expect2 } from "vitest";
|
|
34539
|
-
import { _dumpState, _preprocessState as
|
|
35149
|
+
import { _dumpState, _preprocessState as preprocessState } from "@qwik.dev/core/internal";
|
|
34540
35150
|
import { useContextProvider } from "../core.mjs";
|
|
34541
35151
|
|
|
34542
35152
|
// packages/qwik/src/core/preloader/bundle-graph.ts
|
|
@@ -34579,7 +35189,7 @@ import { getClientManifest } from "../core.mjs";
|
|
|
34579
35189
|
|
|
34580
35190
|
// packages/qwik/src/server/platform.ts
|
|
34581
35191
|
import { setPlatform } from "../core.mjs";
|
|
34582
|
-
import { isDev as
|
|
35192
|
+
import { isDev as isDev27 } from "@qwik.dev/core/build";
|
|
34583
35193
|
var getDevSegmentPath = (mapper, hash, symbolName, parent) => {
|
|
34584
35194
|
const existing = mapper?.[hash];
|
|
34585
35195
|
if (existing) {
|
|
@@ -34601,9 +35211,9 @@ var getDevSegmentPath = (mapper, hash, symbolName, parent) => {
|
|
|
34601
35211
|
function createPlatform3(opts, resolvedManifest) {
|
|
34602
35212
|
const mapper = resolvedManifest?.mapper;
|
|
34603
35213
|
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
|
|
34604
|
-
if (mapper ||
|
|
35214
|
+
if (mapper || isDev27 && import.meta.env?.MODE !== "test") {
|
|
34605
35215
|
const hash = getSymbolHash2(symbolName);
|
|
34606
|
-
const result = !
|
|
35216
|
+
const result = !isDev27 ? mapper[hash] : getDevSegmentPath(mapper, hash, symbolName, parent);
|
|
34607
35217
|
if (!result) {
|
|
34608
35218
|
if (hash === SYNC_QRL) {
|
|
34609
35219
|
return [hash, ""];
|
|
@@ -34650,7 +35260,7 @@ var getSymbolHash2 = (symbolName) => {
|
|
|
34650
35260
|
};
|
|
34651
35261
|
|
|
34652
35262
|
// packages/qwik/src/server/ssr-container.ts
|
|
34653
|
-
import { isDev as
|
|
35263
|
+
import { isDev as isDev29 } from "@qwik.dev/core/build";
|
|
34654
35264
|
import {
|
|
34655
35265
|
_SubscriptionData as SubscriptionData2,
|
|
34656
35266
|
_SharedContainer as _SharedContainer2,
|
|
@@ -34915,14 +35525,14 @@ import {
|
|
|
34915
35525
|
_EMPTY_OBJ,
|
|
34916
35526
|
_EFFECT_BACK_REF as _EFFECT_BACK_REF2
|
|
34917
35527
|
} from "@qwik.dev/core/internal";
|
|
34918
|
-
import { isDev as
|
|
35528
|
+
import { isDev as isDev28 } from "@qwik.dev/core/build";
|
|
34919
35529
|
var SsrNode = class {
|
|
34920
35530
|
constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
|
|
34921
|
-
this
|
|
34922
|
-
this
|
|
34923
|
-
this
|
|
34924
|
-
this
|
|
34925
|
-
this
|
|
35531
|
+
__publicField(this, "parentComponent", parentComponent);
|
|
35532
|
+
__publicField(this, "attributesIndex", attributesIndex);
|
|
35533
|
+
__publicField(this, "cleanupQueue", cleanupQueue);
|
|
35534
|
+
__publicField(this, "vnodeData", vnodeData);
|
|
35535
|
+
__publicField(this, "currentFile", currentFile);
|
|
34926
35536
|
__publicField(this, "__brand__", "SsrNode");
|
|
34927
35537
|
/**
|
|
34928
35538
|
* ID which the deserialize will use to retrieve the node.
|
|
@@ -34940,7 +35550,7 @@ var SsrNode = class {
|
|
|
34940
35550
|
this.flags = 1 /* Updatable */;
|
|
34941
35551
|
this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_OBJ;
|
|
34942
35552
|
this.parentComponent?.addChild(this);
|
|
34943
|
-
if (
|
|
35553
|
+
if (isDev28 && id.indexOf("undefined") != -1) {
|
|
34944
35554
|
throw new Error(`Invalid SSR node id: ${id}`);
|
|
34945
35555
|
}
|
|
34946
35556
|
}
|
|
@@ -35005,7 +35615,7 @@ var SsrNode = class {
|
|
|
35005
35615
|
}
|
|
35006
35616
|
}
|
|
35007
35617
|
toString() {
|
|
35008
|
-
if (
|
|
35618
|
+
if (isDev28) {
|
|
35009
35619
|
let stringifiedAttrs = "";
|
|
35010
35620
|
for (const key in this.attrs) {
|
|
35011
35621
|
const value = this.attrs[key];
|
|
@@ -35021,13 +35631,13 @@ var SsrNode = class {
|
|
|
35021
35631
|
};
|
|
35022
35632
|
var DomRef = class {
|
|
35023
35633
|
constructor($ssrNode$) {
|
|
35024
|
-
this
|
|
35634
|
+
__publicField(this, "$ssrNode$", $ssrNode$);
|
|
35025
35635
|
__publicField(this, "__brand__", "DomRef");
|
|
35026
35636
|
}
|
|
35027
35637
|
};
|
|
35028
35638
|
var SsrComponentFrame = class {
|
|
35029
35639
|
constructor(componentNode) {
|
|
35030
|
-
this
|
|
35640
|
+
__publicField(this, "componentNode", componentNode);
|
|
35031
35641
|
__publicField(this, "slots", []);
|
|
35032
35642
|
__publicField(this, "projectionDepth", 0);
|
|
35033
35643
|
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
|
|
@@ -35098,6 +35708,10 @@ var renderSSRChunks = (chunks, remap) => {
|
|
|
35098
35708
|
const chunk = chunks[i2];
|
|
35099
35709
|
if (typeof chunk === "string") {
|
|
35100
35710
|
out += chunk;
|
|
35711
|
+
} else if (chunk.type === "root-ref-delta") {
|
|
35712
|
+
const id = remap ? remap[chunk.localId] ?? chunk.localId : chunk.localId;
|
|
35713
|
+
const base2 = remap ? remap[chunk.localBaseId] ?? chunk.localBaseId : chunk.localBaseId;
|
|
35714
|
+
out += String(id - base2);
|
|
35101
35715
|
} else {
|
|
35102
35716
|
const localId = chunk.type === "root-ref" ? chunk.localId : chunk.localPath[0];
|
|
35103
35717
|
out += String(remap ? remap[localId] ?? localId : localId);
|
|
@@ -35125,6 +35739,9 @@ var StringSSRWriter = class {
|
|
|
35125
35739
|
writeRootRefPath(path) {
|
|
35126
35740
|
writeStringRootRefPath(this, path);
|
|
35127
35741
|
}
|
|
35742
|
+
writeRootRefDelta(id, base2) {
|
|
35743
|
+
writeStringRootRefDelta(this, id, base2);
|
|
35744
|
+
}
|
|
35128
35745
|
clear() {
|
|
35129
35746
|
this.buffer.length = 0;
|
|
35130
35747
|
}
|
|
@@ -35145,6 +35762,9 @@ var StringBufferSegmentWriter = class {
|
|
|
35145
35762
|
writeRootRefPath(path) {
|
|
35146
35763
|
this.chunks.push({ type: "root-ref-path", localPath: path });
|
|
35147
35764
|
}
|
|
35765
|
+
writeRootRefDelta(id, base2) {
|
|
35766
|
+
this.chunks.push({ type: "root-ref-delta", localId: id, localBaseId: base2 });
|
|
35767
|
+
}
|
|
35148
35768
|
clear() {
|
|
35149
35769
|
this.chunks.length = 0;
|
|
35150
35770
|
}
|
|
@@ -35284,6 +35904,7 @@ function encodeAsAlphanumeric(value) {
|
|
|
35284
35904
|
}
|
|
35285
35905
|
|
|
35286
35906
|
// packages/qwik/src/server/ssr-container.ts
|
|
35907
|
+
var VALID_ELEMENT_NAME = /^[A-Za-z][A-Za-z0-9._:-]*$/;
|
|
35287
35908
|
var NO_SCRIPT_HERE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
35288
35909
|
"script",
|
|
35289
35910
|
"style",
|
|
@@ -35669,11 +36290,17 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35669
36290
|
containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
|
|
35670
36291
|
containerAttributes[QRuntimeAttr] = "2";
|
|
35671
36292
|
containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
|
|
35672
|
-
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (
|
|
36293
|
+
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev29 ? "ssr-dev" : "ssr");
|
|
35673
36294
|
containerAttributes[QBaseAttr] = this.$buildBase$ || "";
|
|
35674
36295
|
containerAttributes[QLocaleAttr] = this.$locale$;
|
|
35675
36296
|
containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
|
|
35676
36297
|
containerAttributes[QInstanceAttr] = this.$instanceHash$;
|
|
36298
|
+
const statePrewarm = this.renderOptions.statePrewarm;
|
|
36299
|
+
if (typeof statePrewarm === "number") {
|
|
36300
|
+
containerAttributes[QStatePrewarmAttr] = String(statePrewarm);
|
|
36301
|
+
} else {
|
|
36302
|
+
delete containerAttributes[QStatePrewarmAttr];
|
|
36303
|
+
}
|
|
35677
36304
|
this.$serverData$.containerAttributes = containerAttributes;
|
|
35678
36305
|
this.openElement(this.tag, null, containerAttributes);
|
|
35679
36306
|
if (!this.isHtml) {
|
|
@@ -35686,6 +36313,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35686
36313
|
}
|
|
35687
36314
|
/** Renders opening tag for DOM element */
|
|
35688
36315
|
openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null, hasMovedCaptures = true) {
|
|
36316
|
+
if (!VALID_ELEMENT_NAME.test(elementName)) {
|
|
36317
|
+
throw qError(36 /* invalidElementName */, [JSON.stringify(elementName)]);
|
|
36318
|
+
}
|
|
35689
36319
|
const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
|
|
35690
36320
|
if (NO_SCRIPT_HERE_ELEMENTS.has(elementName)) {
|
|
35691
36321
|
this.$noScriptHere$++;
|
|
@@ -35724,7 +36354,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35724
36354
|
}
|
|
35725
36355
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
35726
36356
|
if (key !== null) {
|
|
35727
|
-
this.write(
|
|
36357
|
+
this.write(ATTR_EQUALS_QUOTE);
|
|
36358
|
+
this.write(escapeHTML(key));
|
|
36359
|
+
this.write(QUOTE);
|
|
35728
36360
|
} else if (qTest) {
|
|
35729
36361
|
this.write(EMPTY_ATTR);
|
|
35730
36362
|
}
|
|
@@ -35866,7 +36498,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35866
36498
|
this.markVNodeRefForSerialization(componentFrame.componentNode);
|
|
35867
36499
|
}
|
|
35868
36500
|
this.openFragment(
|
|
35869
|
-
|
|
36501
|
+
isDev29 ? {
|
|
35870
36502
|
[DEBUG_TYPE]: "P" /* Projection */,
|
|
35871
36503
|
[QSlotParent]: componentFrame.componentNode.id,
|
|
35872
36504
|
[QSlot]: slotName
|
|
@@ -35995,7 +36627,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35995
36627
|
emitRestStateData() {
|
|
35996
36628
|
this.emitVNodeData();
|
|
35997
36629
|
this.emitDelayedOutOfOrderSegmentVNodeData();
|
|
35998
|
-
if (!
|
|
36630
|
+
if (!isDev29) {
|
|
35999
36631
|
preloaderPost(this, this.renderOptions, this.$serverData$?.nonce);
|
|
36000
36632
|
}
|
|
36001
36633
|
this.emitSyncFnsData();
|
|
@@ -36159,6 +36791,11 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36159
36791
|
} else if (typeof rawValue !== "string") {
|
|
36160
36792
|
rootId = this.addRoot(rawValue);
|
|
36161
36793
|
if (rootId === void 0) {
|
|
36794
|
+
if (key === OnRenderProp) {
|
|
36795
|
+
this.write(VNodeDataChar.RENDER_FN_CHAR);
|
|
36796
|
+
this.write(VNodeDataChar.RENDER_HASH_PREFIX_CHAR);
|
|
36797
|
+
this.write(encodeVNodeDataString(encodeVNodeDataKey(rawValue.$hash$)));
|
|
36798
|
+
}
|
|
36162
36799
|
continue;
|
|
36163
36800
|
}
|
|
36164
36801
|
value = String(rootId);
|
|
@@ -36197,12 +36834,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36197
36834
|
this.write(VNodeDataChar.CONTEXT_CHAR);
|
|
36198
36835
|
break;
|
|
36199
36836
|
case QSlot:
|
|
36837
|
+
encodeValue = encodeVNodeDataKey;
|
|
36200
36838
|
this.write(VNodeDataChar.SLOT_CHAR);
|
|
36201
36839
|
break;
|
|
36202
36840
|
default: {
|
|
36203
36841
|
encodeValue = encodeURI;
|
|
36204
36842
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
36205
|
-
this.write(encodeVNodeDataString(key));
|
|
36843
|
+
this.write(encodeVNodeDataString(encodeVNodeDataKey(key)));
|
|
36206
36844
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
36207
36845
|
}
|
|
36208
36846
|
}
|
|
@@ -36220,7 +36858,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36220
36858
|
}
|
|
36221
36859
|
}
|
|
36222
36860
|
emitStateData() {
|
|
36223
|
-
if (!this.serializationCtx.$roots$.length) {
|
|
36861
|
+
if (!this.serializationCtx.$roots$.length && !this.serializationCtx.$eagerResume$.size) {
|
|
36224
36862
|
return;
|
|
36225
36863
|
}
|
|
36226
36864
|
const attrs = this.stateScriptAttrs();
|
|
@@ -36287,7 +36925,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36287
36925
|
if (this.renderOptions.serverData?.nonce) {
|
|
36288
36926
|
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36289
36927
|
}
|
|
36290
|
-
this.writeScript(scriptAttrs, JSON.stringify(patches));
|
|
36928
|
+
this.writeScript(scriptAttrs, JSON.stringify(patches).replaceAll("<", "\\u003C"));
|
|
36291
36929
|
}
|
|
36292
36930
|
}
|
|
36293
36931
|
emitBackpatchDataAndExecutorIfNeeded() {
|
|
@@ -36306,7 +36944,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36306
36944
|
if (this.renderOptions.serverData?.nonce) {
|
|
36307
36945
|
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36308
36946
|
}
|
|
36309
|
-
const backpatchScript = getQwikBackpatchExecutorScript({ debug:
|
|
36947
|
+
const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev29 });
|
|
36310
36948
|
this.writeScript(scriptAttrs, backpatchScript);
|
|
36311
36949
|
}
|
|
36312
36950
|
emitOutOfOrderExecutorIfNeeded() {
|
|
@@ -36316,7 +36954,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36316
36954
|
this.isOutOfOrderExecutorEmitted = true;
|
|
36317
36955
|
this.writeScript(
|
|
36318
36956
|
{ type: "text/javascript", nonce: this.renderOptions.serverData?.nonce },
|
|
36319
|
-
getQwikOutOfOrderExecutorScript({ debug:
|
|
36957
|
+
getQwikOutOfOrderExecutorScript({ debug: isDev29 })
|
|
36320
36958
|
);
|
|
36321
36959
|
}
|
|
36322
36960
|
emitInlineScript(script) {
|
|
@@ -36342,7 +36980,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36342
36980
|
this.write("</script>");
|
|
36343
36981
|
}
|
|
36344
36982
|
emitPreloaderPre() {
|
|
36345
|
-
if (!
|
|
36983
|
+
if (!isDev29) {
|
|
36346
36984
|
preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
|
|
36347
36985
|
}
|
|
36348
36986
|
}
|
|
@@ -36447,7 +37085,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36447
37085
|
}
|
|
36448
37086
|
createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
|
|
36449
37087
|
let tagNesting = 10 /* ANYTHING */;
|
|
36450
|
-
if (
|
|
37088
|
+
if (isDev29) {
|
|
36451
37089
|
if (!this.currentElementFrame) {
|
|
36452
37090
|
tagNesting = initialTag(elementName);
|
|
36453
37091
|
} else {
|
|
@@ -36494,7 +37132,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36494
37132
|
elementName,
|
|
36495
37133
|
depthFirstElementIdx,
|
|
36496
37134
|
vNodeData: [0 /* NONE */],
|
|
36497
|
-
currentFile:
|
|
37135
|
+
currentFile: isDev29 ? currentFile || null : null,
|
|
36498
37136
|
refBase: null
|
|
36499
37137
|
};
|
|
36500
37138
|
this.currentElementFrame = frame;
|
|
@@ -36521,6 +37159,11 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36521
37159
|
this.size += 1 + String(path[i2]).length;
|
|
36522
37160
|
}
|
|
36523
37161
|
}
|
|
37162
|
+
writeRootRefDelta(id, base2) {
|
|
37163
|
+
const delta = id - base2;
|
|
37164
|
+
this.size += String(delta).length;
|
|
37165
|
+
this.writer.writeRootRefDelta(id, base2);
|
|
37166
|
+
}
|
|
36524
37167
|
writeArray(array, separator) {
|
|
36525
37168
|
for (let i2 = 0; i2 < array.length; i2++) {
|
|
36526
37169
|
const element = array[i2];
|
|
@@ -36535,7 +37178,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36535
37178
|
for (let key in attrs) {
|
|
36536
37179
|
let value = attrs[key];
|
|
36537
37180
|
if (isSSRUnsafeAttr(key)) {
|
|
36538
|
-
if (
|
|
37181
|
+
if (isDev29) {
|
|
36539
37182
|
throw qError(32 /* unsafeAttr */, [key]);
|
|
36540
37183
|
}
|
|
36541
37184
|
continue;
|
|
@@ -36598,7 +37241,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36598
37241
|
}
|
|
36599
37242
|
if (tag === "textarea" && key === "value") {
|
|
36600
37243
|
if (value && typeof value !== "string") {
|
|
36601
|
-
if (
|
|
37244
|
+
if (isDev29) {
|
|
36602
37245
|
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
36603
37246
|
}
|
|
36604
37247
|
continue;
|
|
@@ -36632,6 +37275,8 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36632
37275
|
this.write(escapeHTML(chunk));
|
|
36633
37276
|
} else if (typeof chunk === "number") {
|
|
36634
37277
|
this.writeRootRef(chunk);
|
|
37278
|
+
} else if ("base" in chunk) {
|
|
37279
|
+
this.writeRootRefDelta(chunk.id, chunk.base);
|
|
36635
37280
|
} else {
|
|
36636
37281
|
this.writeRootRefPath(chunk.path);
|
|
36637
37282
|
}
|
|
@@ -36651,27 +37296,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36651
37296
|
var SSRSegmentContainer = class extends SSRContainer {
|
|
36652
37297
|
constructor(opts, $rootContainer$) {
|
|
36653
37298
|
super(opts);
|
|
36654
|
-
this
|
|
37299
|
+
__publicField(this, "$rootContainer$", $rootContainer$);
|
|
36655
37300
|
__publicField(this, "$outOfOrderState$", 0 /* Rendering */);
|
|
36656
37301
|
__publicField(this, "$outOfOrderRootIdMap$", null);
|
|
36657
37302
|
__publicField(this, "subscriptionPatchRecords", []);
|
|
36658
37303
|
__publicField(this, "pendingVNodeDataPatches", null);
|
|
36659
37304
|
}
|
|
36660
|
-
nextOutOfOrderId() {
|
|
36661
|
-
return this.$rootContainer$.nextOutOfOrderId();
|
|
36662
|
-
}
|
|
36663
|
-
$runQueuedRender$(render2) {
|
|
36664
|
-
return this.$rootContainer$.$runQueuedRender$(render2);
|
|
36665
|
-
}
|
|
36666
|
-
queueOutOfOrderSegment(segment) {
|
|
36667
|
-
this.$rootContainer$.queueOutOfOrderSegment(segment);
|
|
36668
|
-
}
|
|
36669
|
-
emitOutOfOrderSegmentScripts(scripts) {
|
|
36670
|
-
this.$rootContainer$.emitOutOfOrderSegmentScripts(scripts);
|
|
36671
|
-
}
|
|
36672
|
-
emitOutOfOrderExecutorIfNeeded() {
|
|
36673
|
-
this.$rootContainer$.emitOutOfOrderExecutorIfNeeded();
|
|
36674
|
-
}
|
|
36675
37305
|
$recordExternalRootEffect$(producer, effect, prop, sourceEffects) {
|
|
36676
37306
|
recordExternalRootEffect(
|
|
36677
37307
|
this.$rootContainer$.serializationCtx,
|
|
@@ -36691,7 +37321,6 @@ var SSRSegmentContainer = class extends SSRContainer {
|
|
|
36691
37321
|
try {
|
|
36692
37322
|
const commit = this.$commitRoots$(rootContainer, segmentSerializationCtx);
|
|
36693
37323
|
this.$mergeSegmentEventData$(rootContainer, segmentSerializationCtx);
|
|
36694
|
-
this.$mergeSegmentSyncFns$(rootContainer, segmentSerializationCtx);
|
|
36695
37324
|
const subscriptionPatchRootId = this.$addSubscriptionsToRoots$(
|
|
36696
37325
|
rootContainer,
|
|
36697
37326
|
rootReadyAtSegment,
|
|
@@ -36763,7 +37392,7 @@ var SSRSegmentContainer = class extends SSRContainer {
|
|
|
36763
37392
|
}
|
|
36764
37393
|
}
|
|
36765
37394
|
queueLateVNodeDataPatch(node, addedFlags) {
|
|
36766
|
-
if (!
|
|
37395
|
+
if (!(addedFlags & (16 /* SERIALIZE */ | 8 /* REFERENCE */))) {
|
|
36767
37396
|
return;
|
|
36768
37397
|
}
|
|
36769
37398
|
const owner = this.getVNodeDataOwnerFromNodeId(node.id);
|
|
@@ -36885,13 +37514,7 @@ var SSRSegmentContainer = class extends SSRContainer {
|
|
|
36885
37514
|
rootContainer.serializationCtx.$eventQrls$.add(qrl);
|
|
36886
37515
|
}
|
|
36887
37516
|
}
|
|
36888
|
-
$mergeSegmentSyncFns$(rootContainer, segmentSerializationCtx) {
|
|
36889
|
-
rootContainer.serializationCtx.$syncFns$.push(...segmentSerializationCtx.$syncFns$);
|
|
36890
|
-
}
|
|
36891
37517
|
collectSubscriptionPatches(rootContainer, rootLimit) {
|
|
36892
|
-
if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
|
|
36893
|
-
return;
|
|
36894
|
-
}
|
|
36895
37518
|
return collectSubscriptionPatches(
|
|
36896
37519
|
rootContainer.serializationCtx,
|
|
36897
37520
|
this.subscriptionPatchRecords,
|
|
@@ -36953,8 +37576,8 @@ function addPreventDefaultEventToSerializationContext(serializationCtx, key) {
|
|
|
36953
37576
|
// packages/qwik/src/server/ssr-stream-handler.ts
|
|
36954
37577
|
var StreamHandler = class {
|
|
36955
37578
|
constructor(opts, timing) {
|
|
36956
|
-
this
|
|
36957
|
-
this
|
|
37579
|
+
__publicField(this, "opts", opts);
|
|
37580
|
+
__publicField(this, "timing", timing);
|
|
36958
37581
|
__publicField(this, "bufferSize", 0);
|
|
36959
37582
|
__publicField(this, "buffer", "");
|
|
36960
37583
|
__publicField(this, "networkFlushes", 0);
|
|
@@ -37265,7 +37888,8 @@ async function ssrRenderToDom(jsx2, opts = {}) {
|
|
|
37265
37888
|
];
|
|
37266
37889
|
const renderOptions = {
|
|
37267
37890
|
containerTagName: opts.containerTagName,
|
|
37268
|
-
qwikLoader: opts.qwikLoader ? "inline" : "never"
|
|
37891
|
+
qwikLoader: opts.qwikLoader ? "inline" : "never",
|
|
37892
|
+
statePrewarm: opts.statePrewarm
|
|
37269
37893
|
};
|
|
37270
37894
|
if (opts.stream || opts.streaming) {
|
|
37271
37895
|
const stream = {
|
|
@@ -37307,6 +37931,7 @@ async function ssrRenderToDom(jsx2, opts = {}) {
|
|
|
37307
37931
|
if (!isStreaming) {
|
|
37308
37932
|
emulateExecutionOfOutOfOrderScripts(document2);
|
|
37309
37933
|
}
|
|
37934
|
+
await whenContainerDataReady(container, () => void 0);
|
|
37310
37935
|
if (opts.debug) {
|
|
37311
37936
|
console.log("========================================================");
|
|
37312
37937
|
console.log("------------------------- SSR --------------------------");
|
|
@@ -37362,12 +37987,12 @@ async function ssrRenderToDom(jsx2, opts = {}) {
|
|
|
37362
37987
|
return { container, document: document2, vNode, getStyles };
|
|
37363
37988
|
}
|
|
37364
37989
|
function getDebugSerializedState(container) {
|
|
37365
|
-
const
|
|
37990
|
+
const stateScriptSelector = `script[type="qwik/state"][q\\:instance="${container.$instanceHash$}"]`;
|
|
37366
37991
|
const rootStateScript = container.element.querySelector(
|
|
37367
|
-
`${
|
|
37992
|
+
`${stateScriptSelector}:not(${QStatePatchAttrSelector})`
|
|
37368
37993
|
);
|
|
37369
37994
|
const patchStateScripts = container.element.querySelectorAll(
|
|
37370
|
-
`${
|
|
37995
|
+
`${stateScriptSelector}${QStatePatchAttrSelector}`
|
|
37371
37996
|
);
|
|
37372
37997
|
if (!rootStateScript && patchStateScripts.length === 0) {
|
|
37373
37998
|
return null;
|
|
@@ -37388,7 +38013,7 @@ function getDebugSerializedState(container) {
|
|
|
37388
38013
|
}
|
|
37389
38014
|
}
|
|
37390
38015
|
const debugContainer = { $forwardRefs$: null };
|
|
37391
|
-
|
|
38016
|
+
preprocessState(state, debugContainer);
|
|
37392
38017
|
for (let i2 = 0; i2 < patchForwardRefs.length; i2++) {
|
|
37393
38018
|
const rootForwardRefs = debugContainer.$forwardRefs$ || (debugContainer.$forwardRefs$ = []);
|
|
37394
38019
|
const forwardRefs = patchForwardRefs[i2];
|
|
@@ -37487,6 +38112,7 @@ function renderStyles(getStyles) {
|
|
|
37487
38112
|
}
|
|
37488
38113
|
async function rerenderComponent(element) {
|
|
37489
38114
|
const container = _getDomContainer2(element);
|
|
38115
|
+
await whenContainerDataReady(container, () => void 0);
|
|
37490
38116
|
const vElement = container.vNodeLocate(element);
|
|
37491
38117
|
const host = getHostVNode(vElement);
|
|
37492
38118
|
markVNodeDirty(container, host, 4 /* COMPONENT */);
|