@qwik.dev/core 2.0.0-beta.31 → 2.0.0-beta.32
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 +2 -2
- package/dist/core-internal.d.ts +112 -34
- package/dist/core.min.mjs +2 -2
- package/dist/core.mjs +696 -347
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +3269 -3020
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +4 -4
- package/dist/qwikloader.debug.js +237 -90
- package/dist/qwikloader.js +1 -1
- package/dist/server.mjs +10 -7
- package/dist/server.prod.mjs +694 -690
- package/dist/starters/adapters/bun/src/entry.bun.ts +2 -8
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +2 -4
- package/dist/starters/adapters/deno/src/entry.deno.ts +2 -8
- package/dist/starters/adapters/express/src/entry.express.tsx +1 -4
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +2 -4
- package/dist/testing/index.d.ts +5 -3
- package/dist/testing/index.mjs +717 -281
- package/dist/testing/package.json +1 -1
- package/package.json +3 -3
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.32-dev+0e29f8a
|
|
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
|
|
@@ -23773,6 +23773,7 @@ var isPrimitiveOrNullUndefined = (v) => {
|
|
|
23773
23773
|
};
|
|
23774
23774
|
|
|
23775
23775
|
// packages/qwik/src/core/shared/error/error.ts
|
|
23776
|
+
var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#Q";
|
|
23776
23777
|
var codeToText = (code2, ...parts) => {
|
|
23777
23778
|
if (qDev) {
|
|
23778
23779
|
const MAP = [
|
|
@@ -23850,8 +23851,10 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
|
|
|
23850
23851
|
// 32
|
|
23851
23852
|
"SerializerSymbol function returned rejected promise",
|
|
23852
23853
|
// 33
|
|
23853
|
-
"Serialization Error: Cannot serialize function: {{0}}"
|
|
23854
|
+
"Serialization Error: Cannot serialize function: {{0}}",
|
|
23854
23855
|
// 34
|
|
23856
|
+
"Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value."
|
|
23857
|
+
// 35
|
|
23855
23858
|
];
|
|
23856
23859
|
let text = MAP[code2] ?? "";
|
|
23857
23860
|
if (parts.length) {
|
|
@@ -23865,7 +23868,7 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
|
|
|
23865
23868
|
}
|
|
23866
23869
|
return `Code(Q${code2}): ${text}`;
|
|
23867
23870
|
} else {
|
|
23868
|
-
return `Code(Q${code2})
|
|
23871
|
+
return `Code(Q${code2}) ${baseUrl}${code2}`;
|
|
23869
23872
|
}
|
|
23870
23873
|
};
|
|
23871
23874
|
var qError = (code2, errorMessageArgs = []) => {
|
|
@@ -24169,56 +24172,59 @@ var useSequentialScope = () => {
|
|
|
24169
24172
|
|
|
24170
24173
|
// packages/qwik/src/core/shared/utils/event-names.ts
|
|
24171
24174
|
var EVENT_SUFFIX = "$";
|
|
24175
|
+
var DOM_CONTENT_LOADED_EVENT = "DOMContentLoaded";
|
|
24172
24176
|
var isJsxPropertyAnEventName = (name) => {
|
|
24173
24177
|
return name.endsWith(EVENT_SUFFIX) && (name.startsWith("on" /* on */) || name.startsWith("window:on" /* window */) || name.startsWith("document:on" /* document */));
|
|
24174
24178
|
};
|
|
24175
24179
|
var isHtmlAttributeAnEventName = (name) => {
|
|
24176
|
-
return name.charCodeAt(0) === 113 && name.charCodeAt(1) === 45 && name.charCodeAt(3) === 58;
|
|
24180
|
+
return name.charCodeAt(0) === 113 && name.charCodeAt(1) === 45 && (name.charCodeAt(3) === 58 || name.charCodeAt(3) === 112 && name.charCodeAt(4) === 58);
|
|
24177
24181
|
};
|
|
24178
|
-
function jsxEventToHtmlAttribute(jsxEvent) {
|
|
24182
|
+
function jsxEventToHtmlAttribute(jsxEvent, isPassive = false) {
|
|
24179
24183
|
if (jsxEvent.endsWith(EVENT_SUFFIX)) {
|
|
24180
|
-
const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
|
|
24184
|
+
const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent, isPassive);
|
|
24181
24185
|
if (idx !== -1) {
|
|
24182
|
-
|
|
24183
|
-
return name === "DOMContentLoaded" ? (
|
|
24184
|
-
// The only DOM event that is not all lowercase
|
|
24185
|
-
prefix + "-d-o-m-content-loaded"
|
|
24186
|
-
) : createEventName(
|
|
24187
|
-
name.charAt(0) === "-" ? (
|
|
24188
|
-
// marker for case sensitive event name
|
|
24189
|
-
name.slice(1)
|
|
24190
|
-
) : name.toLowerCase(),
|
|
24191
|
-
prefix
|
|
24192
|
-
);
|
|
24186
|
+
return prefix + normalizeJsxEventName(jsxEvent.slice(idx, -1));
|
|
24193
24187
|
}
|
|
24194
24188
|
}
|
|
24195
24189
|
return null;
|
|
24196
24190
|
}
|
|
24197
|
-
function createEventName(event, prefix) {
|
|
24191
|
+
function createEventName(event, prefix = "") {
|
|
24198
24192
|
const eventName = fromCamelToKebabCase(event);
|
|
24199
24193
|
return prefix + eventName;
|
|
24200
24194
|
}
|
|
24201
|
-
function getEventScopeDataFromJsxEvent(eventName) {
|
|
24195
|
+
function getEventScopeDataFromJsxEvent(eventName, isPassive = false) {
|
|
24202
24196
|
let prefix;
|
|
24203
24197
|
let idx = -1;
|
|
24204
24198
|
if (eventName.startsWith("on" /* on */)) {
|
|
24205
|
-
prefix = "q-e:" /* on */;
|
|
24199
|
+
prefix = isPassive ? "q-ep:" /* onPassive */ : "q-e:" /* on */;
|
|
24206
24200
|
idx = 2;
|
|
24207
24201
|
} else if (eventName.startsWith("window:on" /* window */)) {
|
|
24208
|
-
prefix = "q-w:" /* window */;
|
|
24202
|
+
prefix = isPassive ? "q-wp:" /* windowPassive */ : "q-w:" /* window */;
|
|
24209
24203
|
idx = 9;
|
|
24210
24204
|
} else if (eventName.startsWith("document:on" /* document */)) {
|
|
24211
|
-
prefix = "q-d:" /* document */;
|
|
24205
|
+
prefix = isPassive ? "q-dp:" /* documentPassive */ : "q-d:" /* document */;
|
|
24212
24206
|
idx = 11;
|
|
24213
24207
|
}
|
|
24214
24208
|
return [prefix, idx];
|
|
24215
24209
|
}
|
|
24210
|
+
var normalizeJsxEventName = (name) => {
|
|
24211
|
+
return name === DOM_CONTENT_LOADED_EVENT ? "-d-o-m-content-loaded" : createEventName(
|
|
24212
|
+
name.charAt(0) === "-" ? (
|
|
24213
|
+
// marker for case sensitive event name
|
|
24214
|
+
name.slice(1)
|
|
24215
|
+
) : name.toLowerCase()
|
|
24216
|
+
);
|
|
24217
|
+
};
|
|
24216
24218
|
function isPreventDefault(key) {
|
|
24217
24219
|
return key.startsWith("preventdefault:");
|
|
24218
24220
|
}
|
|
24219
24221
|
var fromCamelToKebabCase = (text) => {
|
|
24220
24222
|
return text.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());
|
|
24221
24223
|
};
|
|
24224
|
+
var getEventDataFromHtmlAttribute = (htmlKey) => {
|
|
24225
|
+
const separatorIndex = htmlKey.indexOf(":");
|
|
24226
|
+
return [htmlKey.slice(2, separatorIndex), htmlKey.slice(separatorIndex + 1)];
|
|
24227
|
+
};
|
|
24222
24228
|
|
|
24223
24229
|
// packages/qwik/src/core/use/use-context.ts
|
|
24224
24230
|
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
@@ -25006,15 +25012,14 @@ var log3 = (...args) => (
|
|
|
25006
25012
|
var AsyncJob = class {
|
|
25007
25013
|
constructor($signal$, info, $infoVersion$) {
|
|
25008
25014
|
this.$signal$ = $signal$;
|
|
25009
|
-
this.info = info;
|
|
25010
|
-
this.$infoVersion$ = $infoVersion$;
|
|
25011
25015
|
/** First holds the compute promise and then the cleanup promise */
|
|
25012
25016
|
__publicField(this, "$promise$", null);
|
|
25013
25017
|
__publicField(this, "$cleanupRequested$", false);
|
|
25014
25018
|
__publicField(this, "$canWrite$", true);
|
|
25015
|
-
|
|
25016
|
-
|
|
25017
|
-
|
|
25019
|
+
if (info !== void 0) {
|
|
25020
|
+
this.info = info;
|
|
25021
|
+
this.$infoVersion$ = $infoVersion$;
|
|
25022
|
+
}
|
|
25018
25023
|
}
|
|
25019
25024
|
get track() {
|
|
25020
25025
|
return this.$track$ || (this.$track$ = trackFn(this.$signal$, this.$signal$.$container$));
|
|
@@ -25025,7 +25030,7 @@ var AsyncJob = class {
|
|
|
25025
25030
|
/** Backward compatible cache method for resource */
|
|
25026
25031
|
cache() {
|
|
25027
25032
|
isDev10 && console.error(
|
|
25028
|
-
"useResource cache() method does not do anything. Use `useAsync$` instead of `useResource$`, use the `
|
|
25033
|
+
"useResource cache() method does not do anything. Use `useAsync$` instead of `useResource$`, use the `expires` option for polling behavior."
|
|
25029
25034
|
);
|
|
25030
25035
|
}
|
|
25031
25036
|
get previous() {
|
|
@@ -25046,39 +25051,45 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25046
25051
|
super(container, fn, flags);
|
|
25047
25052
|
__publicField(this, "$untrackedLoading$", false);
|
|
25048
25053
|
__publicField(this, "$untrackedError$");
|
|
25049
|
-
__publicField(this, "$loadingEffects$");
|
|
25050
|
-
__publicField(this, "$errorEffects$");
|
|
25051
25054
|
__publicField(this, "$current$", null);
|
|
25052
|
-
// TODO only create the array if concurrency > 1
|
|
25053
|
-
__publicField(this, "$jobs$", []);
|
|
25054
|
-
__publicField(this, "$concurrency$", 1);
|
|
25055
|
-
__publicField(this, "$interval$", 0);
|
|
25056
|
-
__publicField(this, "$timeoutMs$");
|
|
25057
|
-
__publicField(this, "$info$");
|
|
25058
|
-
__publicField(this, "$infoVersion$", 0);
|
|
25059
25055
|
__publicField(this, _a3);
|
|
25060
|
-
|
|
25061
|
-
|
|
25062
|
-
|
|
25063
|
-
const
|
|
25064
|
-
const eagerCleanup = options?.eagerCleanup;
|
|
25065
|
-
const clientOnly = options?.clientOnly;
|
|
25056
|
+
if (!options) {
|
|
25057
|
+
return;
|
|
25058
|
+
}
|
|
25059
|
+
const initial = options.initial;
|
|
25066
25060
|
if (initial !== void 0) {
|
|
25067
25061
|
const initialValue = typeof initial === "function" ? initial() : initial;
|
|
25068
25062
|
this.$untrackedValue$ = initialValue;
|
|
25069
25063
|
}
|
|
25070
|
-
|
|
25064
|
+
const concurrency = options.concurrency;
|
|
25065
|
+
if (concurrency !== void 0 && concurrency >= 0 && concurrency !== 1) {
|
|
25066
|
+
this.$concurrency$ = concurrency;
|
|
25067
|
+
this.$jobs$ = [];
|
|
25068
|
+
}
|
|
25069
|
+
const timeout = options.timeout;
|
|
25071
25070
|
if (timeout) {
|
|
25072
25071
|
this.$timeoutMs$ = timeout;
|
|
25073
25072
|
}
|
|
25074
|
-
if (eagerCleanup) {
|
|
25073
|
+
if (options.eagerCleanup) {
|
|
25075
25074
|
this.$flags$ |= 32 /* EAGER_CLEANUP */;
|
|
25076
25075
|
}
|
|
25077
|
-
if (clientOnly) {
|
|
25076
|
+
if (options.clientOnly) {
|
|
25078
25077
|
this.$flags$ |= 64 /* CLIENT_ONLY */;
|
|
25079
25078
|
}
|
|
25080
|
-
if (
|
|
25081
|
-
|
|
25079
|
+
if (options.allowStale === false) {
|
|
25080
|
+
if (isDev10 && initial !== void 0) {
|
|
25081
|
+
throw new Error(
|
|
25082
|
+
"allowStale: false and initial cannot be used together. allowStale: false clears the value on invalidation, which conflicts with providing an initial value."
|
|
25083
|
+
);
|
|
25084
|
+
}
|
|
25085
|
+
this.$flags$ |= 128 /* CLEAR_ON_INVALIDATE */;
|
|
25086
|
+
}
|
|
25087
|
+
const expires = options.expires ?? (options.interval ? Math.abs(options.interval) : void 0);
|
|
25088
|
+
if (expires) {
|
|
25089
|
+
this.expires = expires;
|
|
25090
|
+
}
|
|
25091
|
+
if (options.poll === false || options.interval !== void 0 && options.interval < 0) {
|
|
25092
|
+
this.$flags$ |= 256 /* NO_POLL */;
|
|
25082
25093
|
}
|
|
25083
25094
|
}
|
|
25084
25095
|
get untrackedValue() {
|
|
@@ -25096,9 +25107,7 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25096
25107
|
throw this.$untrackedError$;
|
|
25097
25108
|
}
|
|
25098
25109
|
if ((import.meta.env.TEST ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */ && this.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
25099
|
-
throw
|
|
25100
|
-
isDev10 ? "During SSR, cannot read .value from clientOnly async signal without an initial value. Use .loading or provide an initial value." : "Cannot read .value from clientOnly"
|
|
25101
|
-
);
|
|
25110
|
+
throw qError(35 /* asyncClientOnlyValueDuringSSR */);
|
|
25102
25111
|
}
|
|
25103
25112
|
return this.$untrackedValue$;
|
|
25104
25113
|
}
|
|
@@ -25124,8 +25133,12 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25124
25133
|
this.untrackedLoading = false;
|
|
25125
25134
|
this.untrackedError = void 0;
|
|
25126
25135
|
this.$info$ = void 0;
|
|
25127
|
-
|
|
25128
|
-
this.$jobs
|
|
25136
|
+
if (this.$jobs$) {
|
|
25137
|
+
for (let i = 0; i < this.$jobs$.length; i++) {
|
|
25138
|
+
this.$jobs$[i].$canWrite$ = false;
|
|
25139
|
+
}
|
|
25140
|
+
} else if (this.$current$) {
|
|
25141
|
+
this.$current$.$canWrite$ = false;
|
|
25129
25142
|
}
|
|
25130
25143
|
this.$clearNextPoll$();
|
|
25131
25144
|
super.value = value;
|
|
@@ -25197,27 +25210,59 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25197
25210
|
get untrackedError() {
|
|
25198
25211
|
return this.$untrackedError$;
|
|
25199
25212
|
}
|
|
25200
|
-
get
|
|
25201
|
-
return this.$
|
|
25213
|
+
get expires() {
|
|
25214
|
+
return this.$expires$ || 0;
|
|
25202
25215
|
}
|
|
25203
|
-
set
|
|
25216
|
+
set expires(value) {
|
|
25204
25217
|
this.$clearNextPoll$();
|
|
25205
|
-
this.$
|
|
25206
|
-
if (this.$
|
|
25218
|
+
this.$expires$ = value;
|
|
25219
|
+
if (this.$expires$ && this.$hasSubscribers$()) {
|
|
25207
25220
|
this.$scheduleNextPoll$();
|
|
25208
25221
|
}
|
|
25209
25222
|
}
|
|
25223
|
+
get poll() {
|
|
25224
|
+
return !(this.$flags$ & 256 /* NO_POLL */);
|
|
25225
|
+
}
|
|
25226
|
+
set poll(value) {
|
|
25227
|
+
if (value) {
|
|
25228
|
+
this.$flags$ &= ~256 /* NO_POLL */;
|
|
25229
|
+
} else {
|
|
25230
|
+
this.$flags$ |= 256 /* NO_POLL */;
|
|
25231
|
+
}
|
|
25232
|
+
if (this.$expires$ && this.$hasSubscribers$()) {
|
|
25233
|
+
this.$clearNextPoll$();
|
|
25234
|
+
this.$scheduleNextPoll$();
|
|
25235
|
+
}
|
|
25236
|
+
}
|
|
25237
|
+
/** @deprecated Use `expires` and `poll` instead. */
|
|
25238
|
+
get interval() {
|
|
25239
|
+
const expires = this.$expires$ || 0;
|
|
25240
|
+
return this.$flags$ & 256 /* NO_POLL */ ? -expires : expires;
|
|
25241
|
+
}
|
|
25242
|
+
set interval(value) {
|
|
25243
|
+
if (value < 0) {
|
|
25244
|
+
this.$flags$ |= 256 /* NO_POLL */;
|
|
25245
|
+
} else {
|
|
25246
|
+
this.$flags$ &= ~256 /* NO_POLL */;
|
|
25247
|
+
}
|
|
25248
|
+
this.expires = Math.abs(value);
|
|
25249
|
+
}
|
|
25210
25250
|
/** Invalidates the signal, causing it to re-compute its value. */
|
|
25211
25251
|
async invalidate(info) {
|
|
25212
|
-
this.$flags$ |= 1 /* INVALID */;
|
|
25213
|
-
this.$clearNextPoll$();
|
|
25214
25252
|
if (arguments.length > 0) {
|
|
25215
25253
|
this.$info$ = info;
|
|
25216
|
-
this.$infoVersion
|
|
25254
|
+
this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
|
|
25217
25255
|
}
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25256
|
+
this.$setInvalid$(true, this.$flags$ & 128 /* CLEAR_ON_INVALIDATE */);
|
|
25257
|
+
}
|
|
25258
|
+
$setInvalid$(allowRecalc, mustClear) {
|
|
25259
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25260
|
+
this.$clearNextPoll$();
|
|
25261
|
+
if (mustClear) {
|
|
25262
|
+
this.$untrackedValue$ = NEEDS_COMPUTATION;
|
|
25263
|
+
}
|
|
25264
|
+
if (allowRecalc && (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size)) {
|
|
25265
|
+
Promise.resolve().then(() => this.$computeIfNeeded$());
|
|
25221
25266
|
}
|
|
25222
25267
|
}
|
|
25223
25268
|
/** Abort the current computation and run cleanups if needed. */
|
|
@@ -25258,45 +25303,59 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25258
25303
|
return;
|
|
25259
25304
|
}
|
|
25260
25305
|
this.$clearNextPoll$();
|
|
25261
|
-
|
|
25262
|
-
|
|
25306
|
+
this.$flags$ &= ~1 /* INVALID */;
|
|
25307
|
+
const current = this.$current$;
|
|
25308
|
+
if (current) {
|
|
25309
|
+
this.$requestCleanups$(current);
|
|
25263
25310
|
}
|
|
25264
|
-
const limit = this.$concurrency$ === 0 ? Number.POSITIVE_INFINITY : this.$concurrency
|
|
25265
|
-
if (this.$jobs$.length >= limit) {
|
|
25311
|
+
const limit = this.$concurrency$ === 0 ? Number.POSITIVE_INFINITY : this.$concurrency$ ?? 1;
|
|
25312
|
+
if (this.$jobs$ ? this.$jobs$.length >= limit : current?.$promise$) {
|
|
25266
25313
|
DEBUG3 && log3(`Concurrency limit ${limit} reached, not starting new computation`);
|
|
25314
|
+
this.$flags$ |= 1 /* INVALID */;
|
|
25267
25315
|
return;
|
|
25268
25316
|
}
|
|
25269
25317
|
DEBUG3 && log3("Starting new async computation");
|
|
25270
|
-
this.$flags$ &= ~1 /* INVALID */;
|
|
25271
25318
|
const infoVersion = this.$infoVersion$;
|
|
25272
25319
|
const running = new AsyncJob(this, this.$info$, infoVersion);
|
|
25273
25320
|
this.$current$ = running;
|
|
25274
|
-
this.$jobs
|
|
25321
|
+
if (this.$jobs$) {
|
|
25322
|
+
this.$jobs$.push(running);
|
|
25323
|
+
}
|
|
25275
25324
|
running.$promise$ = this.$runComputation$(running);
|
|
25276
25325
|
}
|
|
25277
25326
|
async $runComputation$(running) {
|
|
25278
25327
|
const isCurrent = () => running === this.$current$;
|
|
25279
25328
|
this.untrackedLoading = true;
|
|
25280
|
-
|
|
25329
|
+
let fn = this.$computeQrl$.resolved;
|
|
25330
|
+
if (!fn) {
|
|
25331
|
+
fn = await this.$computeQrl$.resolve();
|
|
25332
|
+
if (running.$abortController$?.signal.aborted) {
|
|
25333
|
+
DEBUG3 && log3("Computation aborted before it started");
|
|
25334
|
+
running.$promise$ = null;
|
|
25335
|
+
return;
|
|
25336
|
+
}
|
|
25337
|
+
}
|
|
25281
25338
|
try {
|
|
25282
25339
|
if (this.$timeoutMs$) {
|
|
25283
25340
|
this.$computationTimeoutId$ = setTimeout(() => {
|
|
25284
|
-
|
|
25285
|
-
|
|
25286
|
-
|
|
25287
|
-
this.untrackedError = error;
|
|
25288
|
-
running.$canWrite$ = false;
|
|
25289
|
-
}
|
|
25341
|
+
const error = new Error(`timeout ${this.$timeoutMs$}ms`);
|
|
25342
|
+
this.$setError$(running, error);
|
|
25343
|
+
running.$abortController$?.abort(error);
|
|
25290
25344
|
}, this.$timeoutMs$);
|
|
25291
25345
|
}
|
|
25292
25346
|
const valuePromise = retryOnPromise(fn.bind(null, running));
|
|
25293
25347
|
const value = isPromise(valuePromise) ? await valuePromise : valuePromise;
|
|
25294
25348
|
running.$promise$ = null;
|
|
25295
25349
|
if (running.$canWrite$) {
|
|
25296
|
-
const
|
|
25297
|
-
if (
|
|
25298
|
-
|
|
25299
|
-
|
|
25350
|
+
const jobs = this.$jobs$;
|
|
25351
|
+
if (jobs) {
|
|
25352
|
+
let doDisable = false;
|
|
25353
|
+
for (let i = jobs.length - 1; i >= 0; i--) {
|
|
25354
|
+
if (jobs[i] === running) {
|
|
25355
|
+
doDisable = true;
|
|
25356
|
+
} else if (doDisable) {
|
|
25357
|
+
jobs[i].$canWrite$ = false;
|
|
25358
|
+
}
|
|
25300
25359
|
}
|
|
25301
25360
|
}
|
|
25302
25361
|
DEBUG3 && log3("Promise resolved", value);
|
|
@@ -25306,9 +25365,7 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25306
25365
|
} catch (err) {
|
|
25307
25366
|
running.$promise$ = null;
|
|
25308
25367
|
DEBUG3 && log3("Error caught in promise.catch", err);
|
|
25309
|
-
|
|
25310
|
-
this.untrackedError = err;
|
|
25311
|
-
}
|
|
25368
|
+
this.$setError$(running, err);
|
|
25312
25369
|
}
|
|
25313
25370
|
if (isCurrent()) {
|
|
25314
25371
|
clearTimeout(this.$computationTimeoutId$);
|
|
@@ -25324,14 +25381,34 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25324
25381
|
}
|
|
25325
25382
|
}
|
|
25326
25383
|
}
|
|
25384
|
+
/**
|
|
25385
|
+
* Sets the error from the given job. We only accept errors from the current job and we ignore
|
|
25386
|
+
* AbortErrors.
|
|
25387
|
+
*/
|
|
25388
|
+
$setError$(job, error) {
|
|
25389
|
+
if (job !== this.$current$ || !job.$canWrite$) {
|
|
25390
|
+
return;
|
|
25391
|
+
}
|
|
25392
|
+
job.$canWrite$ = false;
|
|
25393
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
25394
|
+
return;
|
|
25395
|
+
}
|
|
25396
|
+
this.untrackedError = error;
|
|
25397
|
+
this.untrackedValue = NEEDS_COMPUTATION;
|
|
25398
|
+
}
|
|
25327
25399
|
/** Called after SSR/unmount */
|
|
25328
25400
|
async $destroy$() {
|
|
25329
25401
|
this.$clearNextPoll$();
|
|
25330
25402
|
clearTimeout(this.$computationTimeoutId$);
|
|
25331
|
-
|
|
25332
|
-
|
|
25403
|
+
const current = this.$current$;
|
|
25404
|
+
if (current) {
|
|
25405
|
+
this.$requestCleanups$(current);
|
|
25406
|
+
}
|
|
25407
|
+
if (this.$jobs$) {
|
|
25408
|
+
await Promise.all(this.$jobs$.map((job) => job.$promise$));
|
|
25409
|
+
} else {
|
|
25410
|
+
await current?.$promise$;
|
|
25333
25411
|
}
|
|
25334
|
-
await Promise.all(this.$jobs$.map((job) => job.$promise$));
|
|
25335
25412
|
}
|
|
25336
25413
|
$clearNextPoll$() {
|
|
25337
25414
|
if (this.$pollTimeoutId$ !== void 0) {
|
|
@@ -25340,69 +25417,76 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
|
|
|
25340
25417
|
}
|
|
25341
25418
|
}
|
|
25342
25419
|
$scheduleNextPoll$() {
|
|
25343
|
-
if (
|
|
25420
|
+
if ((import.meta.env.TEST ? isServerPlatform() : isServer5) || !this.$expires$) {
|
|
25344
25421
|
return;
|
|
25345
25422
|
}
|
|
25346
25423
|
this.$clearNextPoll$();
|
|
25347
|
-
|
|
25348
|
-
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
this.$pollTimeoutId$ = setTimeout(this.invalidate.bind(this), this.$interval$);
|
|
25354
|
-
}
|
|
25424
|
+
const allowRecalc = !(this.$flags$ & 256 /* NO_POLL */);
|
|
25425
|
+
const mustClear = this.$flags$ & 128 /* CLEAR_ON_INVALIDATE */ && !allowRecalc;
|
|
25426
|
+
this.$pollTimeoutId$ = setTimeout(
|
|
25427
|
+
() => this.$setInvalid$(allowRecalc, mustClear),
|
|
25428
|
+
this.$expires$
|
|
25429
|
+
);
|
|
25355
25430
|
this.$pollTimeoutId$?.unref?.();
|
|
25356
25431
|
}
|
|
25357
25432
|
$hasSubscribers$() {
|
|
25358
25433
|
return !!(this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size);
|
|
25359
25434
|
}
|
|
25360
|
-
|
|
25435
|
+
$requestCleanups$(job, reason) {
|
|
25361
25436
|
if (job.$cleanupRequested$) {
|
|
25362
|
-
return
|
|
25437
|
+
return;
|
|
25363
25438
|
}
|
|
25364
25439
|
DEBUG3 && log3("Requesting cleanups for job", job);
|
|
25365
25440
|
job.$cleanupRequested$ = true;
|
|
25366
25441
|
job.$abortController$?.abort(reason);
|
|
25367
|
-
job.$promise$ =
|
|
25368
|
-
() => job.$promise$ = this.$runCleanups$(job)
|
|
25369
|
-
);
|
|
25442
|
+
job.$promise$ = maybeThen(job.$promise$, () => this.$runCleanups$(job));
|
|
25370
25443
|
}
|
|
25371
25444
|
/** Clean up and trigger signal compute once complete */
|
|
25372
|
-
|
|
25445
|
+
$runCleanups$(job) {
|
|
25373
25446
|
const cleanups = job.$cleanups$;
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
const
|
|
25377
|
-
|
|
25378
|
-
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25447
|
+
DEBUG3 && log3("cleanup start", job);
|
|
25448
|
+
const onError = (err) => {
|
|
25449
|
+
const handleError = this.$container$?.handleError;
|
|
25450
|
+
if (handleError) {
|
|
25451
|
+
handleError(err, null);
|
|
25452
|
+
} else {
|
|
25453
|
+
console.error("Error in async signal cleanup", err);
|
|
25454
|
+
}
|
|
25455
|
+
};
|
|
25456
|
+
const onDone = () => {
|
|
25457
|
+
job.$promise$ = null;
|
|
25458
|
+
if (cleanups) {
|
|
25459
|
+
cleanups.length = 0;
|
|
25460
|
+
}
|
|
25461
|
+
DEBUG3 && log3("cleanup finished", job);
|
|
25462
|
+
const jobs = this.$jobs$;
|
|
25463
|
+
if (jobs) {
|
|
25464
|
+
const idx = jobs.indexOf(job);
|
|
25465
|
+
if (idx !== -1) {
|
|
25466
|
+
jobs.splice(idx, 1);
|
|
25382
25467
|
}
|
|
25383
|
-
}
|
|
25468
|
+
}
|
|
25469
|
+
this.$computeIfNeeded$();
|
|
25470
|
+
};
|
|
25471
|
+
let promiseChain = void 0;
|
|
25472
|
+
if (cleanups) {
|
|
25384
25473
|
DEBUG3 && log3("cleanup start for real", job);
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
return result2.catch(onError);
|
|
25391
|
-
}
|
|
25392
|
-
} catch (err) {
|
|
25393
|
-
onError(err);
|
|
25474
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
25475
|
+
try {
|
|
25476
|
+
const result2 = cleanups[i]();
|
|
25477
|
+
if (isPromise(result2)) {
|
|
25478
|
+
promiseChain = (promiseChain ? promiseChain.then(() => result2) : result2).catch(onError);
|
|
25394
25479
|
}
|
|
25395
|
-
})
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25480
|
+
} catch (err) {
|
|
25481
|
+
onError(err);
|
|
25482
|
+
}
|
|
25483
|
+
}
|
|
25399
25484
|
}
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25485
|
+
if (promiseChain) {
|
|
25486
|
+
return promiseChain.then(onDone);
|
|
25487
|
+
} else {
|
|
25488
|
+
onDone();
|
|
25404
25489
|
}
|
|
25405
|
-
this.$computeIfNeeded$();
|
|
25406
25490
|
}
|
|
25407
25491
|
};
|
|
25408
25492
|
|
|
@@ -25798,8 +25882,9 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
25798
25882
|
targetElement = placeholderElement;
|
|
25799
25883
|
} else {
|
|
25800
25884
|
if (isDev12) {
|
|
25885
|
+
const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
|
|
25801
25886
|
logWarn(
|
|
25802
|
-
'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
|
|
25887
|
+
'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}.` : "")
|
|
25803
25888
|
);
|
|
25804
25889
|
}
|
|
25805
25890
|
continue;
|
|
@@ -25809,8 +25894,9 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
25809
25894
|
if (targetElement.type === "script" && key === qVisibleEvent) {
|
|
25810
25895
|
eventKey = "q-d:qinit";
|
|
25811
25896
|
if (isDev12) {
|
|
25897
|
+
const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
|
|
25812
25898
|
logWarn(
|
|
25813
|
-
|
|
25899
|
+
`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}.` : "")
|
|
25814
25900
|
);
|
|
25815
25901
|
}
|
|
25816
25902
|
}
|
|
@@ -25821,25 +25907,57 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
25821
25907
|
return jsxResult;
|
|
25822
25908
|
});
|
|
25823
25909
|
}
|
|
25910
|
+
function getUseOnSourceLocation(eventQrls) {
|
|
25911
|
+
for (let i = 0; i < eventQrls.length; i++) {
|
|
25912
|
+
const eventQrl = eventQrls[i];
|
|
25913
|
+
const task = eventQrl?.getCaptured()?.[0];
|
|
25914
|
+
if (isTask(task)) {
|
|
25915
|
+
const dev = task.$qrl$.dev;
|
|
25916
|
+
if (dev?.file) {
|
|
25917
|
+
return typeof dev.lo === "number" && typeof dev.hi === "number" ? `${dev.file}:${dev.lo}-${dev.hi}` : dev.file;
|
|
25918
|
+
}
|
|
25919
|
+
}
|
|
25920
|
+
}
|
|
25921
|
+
return null;
|
|
25922
|
+
}
|
|
25824
25923
|
function addUseOnEvent(jsxElement, key, value) {
|
|
25825
25924
|
const props = jsxElement.constProps || (jsxElement.constProps = {});
|
|
25826
25925
|
const propValue = props[key];
|
|
25926
|
+
const qrls = value.qrls;
|
|
25827
25927
|
if (propValue == null) {
|
|
25828
|
-
props[key] =
|
|
25928
|
+
props[key] = qrls;
|
|
25829
25929
|
} else if (Array.isArray(propValue)) {
|
|
25830
|
-
propValue.push(...
|
|
25930
|
+
propValue.push(...qrls);
|
|
25831
25931
|
} else {
|
|
25832
|
-
props[key] = [propValue, ...
|
|
25932
|
+
props[key] = [propValue, ...qrls];
|
|
25833
25933
|
}
|
|
25834
25934
|
const varProp = jsxElement.varProps[key];
|
|
25835
25935
|
if (varProp) {
|
|
25836
25936
|
if (Array.isArray(propValue)) {
|
|
25837
25937
|
propValue.push(...props[key]);
|
|
25838
25938
|
} else {
|
|
25839
|
-
jsxElement.varProps[key] = [propValue, ...
|
|
25939
|
+
jsxElement.varProps[key] = [propValue, ...qrls];
|
|
25840
25940
|
}
|
|
25841
25941
|
props[key] = void 0;
|
|
25842
25942
|
}
|
|
25943
|
+
const capture = value.capture;
|
|
25944
|
+
const preventdefault = value.preventdefault;
|
|
25945
|
+
const stoppropagation = value.stoppropagation;
|
|
25946
|
+
if (!capture && !preventdefault && !stoppropagation) {
|
|
25947
|
+
return;
|
|
25948
|
+
}
|
|
25949
|
+
const [, eventName] = getEventDataFromHtmlAttribute(key);
|
|
25950
|
+
capture && addUseOnModifier(jsxElement, eventName, "capture");
|
|
25951
|
+
preventdefault && addUseOnModifier(jsxElement, eventName, "preventdefault");
|
|
25952
|
+
stoppropagation && addUseOnModifier(jsxElement, eventName, "stoppropagation");
|
|
25953
|
+
}
|
|
25954
|
+
function addUseOnModifier(jsxElement, eventName, modifier) {
|
|
25955
|
+
const key = `${modifier}:${eventName}`;
|
|
25956
|
+
const varProps = jsxElement.varProps;
|
|
25957
|
+
if (varProps === EMPTY_OBJ) {
|
|
25958
|
+
jsxElement.varProps = {};
|
|
25959
|
+
}
|
|
25960
|
+
jsxElement.varProps[key] = true;
|
|
25843
25961
|
}
|
|
25844
25962
|
function findFirstElementNode(jsx2) {
|
|
25845
25963
|
const queue2 = [jsx2];
|
|
@@ -29496,6 +29614,8 @@ var Serializer = class {
|
|
|
29496
29614
|
__publicField(this, "$parent$");
|
|
29497
29615
|
__publicField(this, "$qrlMap$", /* @__PURE__ */ new Map());
|
|
29498
29616
|
__publicField(this, "$writer$");
|
|
29617
|
+
/** We need to determine this at runtime because polyfills may not be loaded a module load time */
|
|
29618
|
+
__publicField(this, "$hasTemporal$", typeof Temporal !== "undefined");
|
|
29499
29619
|
this.$writer$ = $serializationContext$.$writer$;
|
|
29500
29620
|
}
|
|
29501
29621
|
async serialize() {
|
|
@@ -29535,6 +29655,29 @@ var Serializer = class {
|
|
|
29535
29655
|
}
|
|
29536
29656
|
return false;
|
|
29537
29657
|
}
|
|
29658
|
+
maybeNumericObjectKey$(key) {
|
|
29659
|
+
if (key.length === 0 || key.length >= 8) {
|
|
29660
|
+
return key;
|
|
29661
|
+
}
|
|
29662
|
+
let i = 0;
|
|
29663
|
+
if (key.charCodeAt(0) === 45) {
|
|
29664
|
+
if (key.length === 1) {
|
|
29665
|
+
return key;
|
|
29666
|
+
}
|
|
29667
|
+
i = 1;
|
|
29668
|
+
}
|
|
29669
|
+
const first = key.charCodeAt(i);
|
|
29670
|
+
if (first < 49 || first > 57) {
|
|
29671
|
+
return key;
|
|
29672
|
+
}
|
|
29673
|
+
for (i++; i < key.length; i++) {
|
|
29674
|
+
const c = key.charCodeAt(i);
|
|
29675
|
+
if (c < 48 || c > 57) {
|
|
29676
|
+
return key;
|
|
29677
|
+
}
|
|
29678
|
+
}
|
|
29679
|
+
return Number(key);
|
|
29680
|
+
}
|
|
29538
29681
|
/** Output a type,value pair. If the value is an array, it calls writeValue on each item. */
|
|
29539
29682
|
output(type, value, keepUndefined) {
|
|
29540
29683
|
if (typeof value === "number") {
|
|
@@ -29640,6 +29783,8 @@ var Serializer = class {
|
|
|
29640
29783
|
this.output(3 /* Constant */, 8 /* STORE_ALL_PROPS */);
|
|
29641
29784
|
} else if (value === _UNINITIALIZED) {
|
|
29642
29785
|
this.output(3 /* Constant */, 9 /* UNINITIALIZED */);
|
|
29786
|
+
} else if (value === explicitUndefined) {
|
|
29787
|
+
this.output(3 /* Constant */, 0 /* Undefined */);
|
|
29643
29788
|
}
|
|
29644
29789
|
break;
|
|
29645
29790
|
case "function":
|
|
@@ -29673,7 +29818,7 @@ var Serializer = class {
|
|
|
29673
29818
|
} else if (isQwikComponent(value)) {
|
|
29674
29819
|
const [qrl] = value[SERIALIZABLE_STATE];
|
|
29675
29820
|
this.$serializationContext$.$renderSymbols$.add(qrl.$symbol$);
|
|
29676
|
-
this.output(
|
|
29821
|
+
this.output(29 /* Component */, [qrl]);
|
|
29677
29822
|
} else {
|
|
29678
29823
|
throw qError(34 /* serializeErrorCannotSerializeFunction */, [value.toString()]);
|
|
29679
29824
|
}
|
|
@@ -29705,19 +29850,19 @@ var Serializer = class {
|
|
|
29705
29850
|
writeObjectValue(value) {
|
|
29706
29851
|
if (isPropsProxy(value)) {
|
|
29707
29852
|
const owner = value[_OWNER];
|
|
29708
|
-
this.output(
|
|
29853
|
+
this.output(38 /* PropsProxy */, [
|
|
29709
29854
|
_serializationWeakRef(owner),
|
|
29710
29855
|
owner.varProps,
|
|
29711
29856
|
owner.constProps,
|
|
29712
29857
|
value[_PROPS_HANDLER].$effects$
|
|
29713
29858
|
]);
|
|
29714
29859
|
} else if (value instanceof SubscriptionData) {
|
|
29715
|
-
this.output(
|
|
29860
|
+
this.output(39 /* SubscriptionData */, [
|
|
29716
29861
|
value.data.$scopedStyleIdPrefix$,
|
|
29717
29862
|
value.data.$isConst$
|
|
29718
29863
|
]);
|
|
29719
29864
|
} else if (value instanceof EffectSubscription) {
|
|
29720
|
-
this.output(
|
|
29865
|
+
this.output(40 /* EffectSubscription */, [value.consumer, value.property, value.data]);
|
|
29721
29866
|
} else if (isStore(value)) {
|
|
29722
29867
|
const storeHandler = getStoreHandler(value);
|
|
29723
29868
|
const storeTarget = getStoreTarget(value);
|
|
@@ -29735,13 +29880,13 @@ var Serializer = class {
|
|
|
29735
29880
|
while (out[out.length - 1] === void 0) {
|
|
29736
29881
|
out.pop();
|
|
29737
29882
|
}
|
|
29738
|
-
this.output(
|
|
29883
|
+
this.output(35 /* Store */, out);
|
|
29739
29884
|
} else if (isSerializerObj(value)) {
|
|
29740
29885
|
const result2 = value[SerializerSymbol](value);
|
|
29741
29886
|
if (isPromise(result2)) {
|
|
29742
29887
|
const forwardRef = this.resolvePromise(result2, (resolved, resolvedValue) => {
|
|
29743
29888
|
return new PromiseResult(
|
|
29744
|
-
|
|
29889
|
+
34 /* SerializerSignal */,
|
|
29745
29890
|
resolved,
|
|
29746
29891
|
resolvedValue,
|
|
29747
29892
|
void 0,
|
|
@@ -29763,7 +29908,7 @@ var Serializer = class {
|
|
|
29763
29908
|
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
29764
29909
|
const subVal = value[key];
|
|
29765
29910
|
if (!fastSkipSerialize(subVal)) {
|
|
29766
|
-
out.push(key, subVal);
|
|
29911
|
+
out.push(this.maybeNumericObjectKey$(key), subVal);
|
|
29767
29912
|
}
|
|
29768
29913
|
}
|
|
29769
29914
|
}
|
|
@@ -29778,7 +29923,7 @@ var Serializer = class {
|
|
|
29778
29923
|
if (isPromise(maybeValue)) {
|
|
29779
29924
|
const forwardRefId = this.resolvePromise(maybeValue, (resolved, resolvedValue) => {
|
|
29780
29925
|
return new PromiseResult(
|
|
29781
|
-
|
|
29926
|
+
34 /* SerializerSignal */,
|
|
29782
29927
|
resolved,
|
|
29783
29928
|
resolvedValue,
|
|
29784
29929
|
value.$effects$,
|
|
@@ -29787,12 +29932,12 @@ var Serializer = class {
|
|
|
29787
29932
|
});
|
|
29788
29933
|
this.output(2 /* ForwardRef */, forwardRefId);
|
|
29789
29934
|
} else {
|
|
29790
|
-
this.output(
|
|
29935
|
+
this.output(34 /* SerializerSignal */, [value.$computeQrl$, value.$effects$, maybeValue]);
|
|
29791
29936
|
}
|
|
29792
29937
|
return;
|
|
29793
29938
|
}
|
|
29794
29939
|
if (value instanceof WrappedSignalImpl) {
|
|
29795
|
-
this.output(
|
|
29940
|
+
this.output(31 /* WrappedSignal */, [
|
|
29796
29941
|
...serializeWrappingFn(this.$serializationContext$, value),
|
|
29797
29942
|
value.$flags$,
|
|
29798
29943
|
value.$hostElement$,
|
|
@@ -29805,7 +29950,7 @@ var Serializer = class {
|
|
|
29805
29950
|
const isInvalid = value.$flags$ & 1 /* INVALID */;
|
|
29806
29951
|
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
29807
29952
|
const isAsync = value instanceof AsyncSignalImpl;
|
|
29808
|
-
const
|
|
29953
|
+
const expires = isAsync && value.$expires$ !== 0 ? value.$expires$ : void 0;
|
|
29809
29954
|
const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
|
|
29810
29955
|
const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
|
|
29811
29956
|
const asyncFlags = isAsync && value.$flags$ & ~24 /* SERIALIZATION_ALL_STRATEGIES */ || void 0;
|
|
@@ -29821,32 +29966,43 @@ var Serializer = class {
|
|
|
29821
29966
|
out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
|
|
29822
29967
|
out.push(asyncFlags || void 0);
|
|
29823
29968
|
}
|
|
29824
|
-
|
|
29825
|
-
|
|
29826
|
-
out.push(v);
|
|
29827
|
-
if (v === void 0) {
|
|
29828
|
-
keepUndefined = true;
|
|
29829
|
-
}
|
|
29969
|
+
if (v !== NEEDS_COMPUTATION || expires !== void 0 || concurrency !== void 0 || timeout !== void 0) {
|
|
29970
|
+
out.push(v === void 0 ? explicitUndefined : v);
|
|
29830
29971
|
}
|
|
29831
29972
|
if (isAsync) {
|
|
29832
|
-
out.push(
|
|
29973
|
+
out.push(expires);
|
|
29833
29974
|
out.push(concurrency);
|
|
29834
29975
|
out.push(timeout);
|
|
29835
29976
|
}
|
|
29836
|
-
this.output(isAsync ?
|
|
29977
|
+
this.output(isAsync ? 33 /* AsyncSignal */ : 32 /* ComputedSignal */, out);
|
|
29837
29978
|
} else {
|
|
29838
29979
|
const v = value.$untrackedValue$;
|
|
29839
|
-
const
|
|
29840
|
-
const out = [v];
|
|
29980
|
+
const out = [v === void 0 ? explicitUndefined : v];
|
|
29841
29981
|
if (value.$effects$) {
|
|
29842
29982
|
out.push(...value.$effects$);
|
|
29843
29983
|
}
|
|
29844
|
-
this.output(
|
|
29984
|
+
this.output(30 /* Signal */, out);
|
|
29845
29985
|
}
|
|
29846
29986
|
} else if (value instanceof URL) {
|
|
29847
29987
|
this.output(6 /* URL */, value.href);
|
|
29848
29988
|
} else if (value instanceof Date) {
|
|
29849
29989
|
this.output(7 /* Date */, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
|
|
29990
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.Duration) {
|
|
29991
|
+
this.output(15 /* TemporalDuration */, value.toJSON());
|
|
29992
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.Instant) {
|
|
29993
|
+
this.output(16 /* TemporalInstant */, value.toJSON());
|
|
29994
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDate) {
|
|
29995
|
+
this.output(17 /* TemporalPlainDate */, value.toJSON());
|
|
29996
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainDateTime) {
|
|
29997
|
+
this.output(18 /* TemporalPlainDateTime */, value.toJSON());
|
|
29998
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainMonthDay) {
|
|
29999
|
+
this.output(19 /* TemporalPlainMonthDay */, value.toJSON());
|
|
30000
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainTime) {
|
|
30001
|
+
this.output(20 /* TemporalPlainTime */, value.toJSON());
|
|
30002
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.PlainYearMonth) {
|
|
30003
|
+
this.output(21 /* TemporalPlainYearMonth */, value.toJSON());
|
|
30004
|
+
} else if (this.$hasTemporal$ && value instanceof Temporal.ZonedDateTime) {
|
|
30005
|
+
this.output(22 /* TemporalZonedDateTime */, value.toJSON());
|
|
29850
30006
|
} else if (value instanceof RegExp) {
|
|
29851
30007
|
this.output(8 /* Regex */, value.toString());
|
|
29852
30008
|
} else if (value instanceof Error) {
|
|
@@ -29855,7 +30011,7 @@ var Serializer = class {
|
|
|
29855
30011
|
if (isDev18) {
|
|
29856
30012
|
out.push("stack", value.stack);
|
|
29857
30013
|
}
|
|
29858
|
-
this.output(
|
|
30014
|
+
this.output(23 /* Error */, out);
|
|
29859
30015
|
} else if (this.$serializationContext$.$isSsrNode$(value)) {
|
|
29860
30016
|
const rootIndex = this.$serializationContext$.$addRoot$(value);
|
|
29861
30017
|
this.$serializationContext$.$setProp$(value, ELEMENT_ID, String(rootIndex));
|
|
@@ -29885,17 +30041,17 @@ var Serializer = class {
|
|
|
29885
30041
|
array.push(k, v);
|
|
29886
30042
|
}
|
|
29887
30043
|
}
|
|
29888
|
-
this.output(
|
|
30044
|
+
this.output(36 /* FormData */, array);
|
|
29889
30045
|
} else if (value instanceof URLSearchParams) {
|
|
29890
30046
|
this.output(13 /* URLSearchParams */, value.toString());
|
|
29891
30047
|
} else if (value instanceof Set) {
|
|
29892
|
-
this.output(
|
|
30048
|
+
this.output(25 /* Set */, [...value.values()]);
|
|
29893
30049
|
} else if (value instanceof Map) {
|
|
29894
30050
|
const combined = [];
|
|
29895
30051
|
for (const [k, v] of value.entries()) {
|
|
29896
30052
|
combined.push(k, v);
|
|
29897
30053
|
}
|
|
29898
|
-
this.output(
|
|
30054
|
+
this.output(26 /* Map */, combined);
|
|
29899
30055
|
} else if (isJSXNode(value)) {
|
|
29900
30056
|
const out = [
|
|
29901
30057
|
value.type,
|
|
@@ -29908,22 +30064,22 @@ var Serializer = class {
|
|
|
29908
30064
|
while (out[out.length - 1] === void 0) {
|
|
29909
30065
|
out.pop();
|
|
29910
30066
|
}
|
|
29911
|
-
this.output(
|
|
30067
|
+
this.output(37 /* JSXNode */, out);
|
|
29912
30068
|
} else if (value instanceof Task) {
|
|
29913
30069
|
const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$, value.$state$];
|
|
29914
30070
|
while (out[out.length - 1] === void 0) {
|
|
29915
30071
|
out.pop();
|
|
29916
30072
|
}
|
|
29917
|
-
this.output(
|
|
30073
|
+
this.output(28 /* Task */, out);
|
|
29918
30074
|
} else if (isPromise(value)) {
|
|
29919
30075
|
const forwardRefId = this.resolvePromise(value, (resolved, resolvedValue) => {
|
|
29920
|
-
return new PromiseResult(
|
|
30076
|
+
return new PromiseResult(24 /* Promise */, resolved, resolvedValue);
|
|
29921
30077
|
});
|
|
29922
30078
|
this.output(2 /* ForwardRef */, forwardRefId);
|
|
29923
30079
|
} else if (value instanceof PromiseResult) {
|
|
29924
|
-
if (value.$type$ ===
|
|
30080
|
+
if (value.$type$ === 34 /* SerializerSignal */) {
|
|
29925
30081
|
if (value.$qrl$) {
|
|
29926
|
-
this.output(
|
|
30082
|
+
this.output(34 /* SerializerSignal */, [value.$qrl$, value.$effects$, value.$value$]);
|
|
29927
30083
|
} else if (value.$resolved$) {
|
|
29928
30084
|
const index = this.$parent$.$index$;
|
|
29929
30085
|
this.$parent$ = this.$parent$.$parent$;
|
|
@@ -29933,7 +30089,7 @@ var Serializer = class {
|
|
|
29933
30089
|
throw qError(33 /* serializerSymbolRejectedPromise */);
|
|
29934
30090
|
}
|
|
29935
30091
|
} else {
|
|
29936
|
-
this.output(
|
|
30092
|
+
this.output(24 /* Promise */, [value.$resolved$, value.$value$]);
|
|
29937
30093
|
}
|
|
29938
30094
|
} else if (value instanceof Uint8Array) {
|
|
29939
30095
|
let buf = "";
|
|
@@ -29942,7 +30098,7 @@ var Serializer = class {
|
|
|
29942
30098
|
buf += String.fromCharCode(value[i]);
|
|
29943
30099
|
}
|
|
29944
30100
|
const out = btoa(buf).replace(/=+$/, "");
|
|
29945
|
-
this.output(
|
|
30101
|
+
this.output(27 /* Uint8Array */, out);
|
|
29946
30102
|
} else if (value instanceof SerializationWeakRef) {
|
|
29947
30103
|
const obj = value.$obj$;
|
|
29948
30104
|
if (this.getSeenRefOrOutput(obj, this.$parent$.$index$, true)) {
|
|
@@ -30305,30 +30461,46 @@ var allocate = (container, typeId, value) => {
|
|
|
30305
30461
|
}
|
|
30306
30462
|
return qrl;
|
|
30307
30463
|
}
|
|
30308
|
-
case
|
|
30464
|
+
case 28 /* Task */:
|
|
30309
30465
|
return new Task(-1, -1, null, null, null, null);
|
|
30310
30466
|
case 6 /* URL */:
|
|
30311
30467
|
return new URL(value);
|
|
30312
30468
|
case 7 /* Date */:
|
|
30313
30469
|
return new Date(value);
|
|
30470
|
+
case 15 /* TemporalDuration */:
|
|
30471
|
+
return Temporal.Duration.from(value);
|
|
30472
|
+
case 16 /* TemporalInstant */:
|
|
30473
|
+
return Temporal.Instant.from(value);
|
|
30474
|
+
case 17 /* TemporalPlainDate */:
|
|
30475
|
+
return Temporal.PlainDate.from(value);
|
|
30476
|
+
case 18 /* TemporalPlainDateTime */:
|
|
30477
|
+
return Temporal.PlainDateTime.from(value);
|
|
30478
|
+
case 19 /* TemporalPlainMonthDay */:
|
|
30479
|
+
return Temporal.PlainMonthDay.from(value);
|
|
30480
|
+
case 20 /* TemporalPlainTime */:
|
|
30481
|
+
return Temporal.PlainTime.from(value);
|
|
30482
|
+
case 21 /* TemporalPlainYearMonth */:
|
|
30483
|
+
return Temporal.PlainYearMonth.from(value);
|
|
30484
|
+
case 22 /* TemporalZonedDateTime */:
|
|
30485
|
+
return Temporal.ZonedDateTime.from(value);
|
|
30314
30486
|
case 8 /* Regex */:
|
|
30315
30487
|
const idx = value.lastIndexOf("/");
|
|
30316
30488
|
return new RegExp(value.slice(1, idx), value.slice(idx + 1));
|
|
30317
|
-
case
|
|
30489
|
+
case 23 /* Error */:
|
|
30318
30490
|
return new Error();
|
|
30319
|
-
case
|
|
30491
|
+
case 29 /* Component */:
|
|
30320
30492
|
return componentQrl(null);
|
|
30321
|
-
case
|
|
30493
|
+
case 30 /* Signal */:
|
|
30322
30494
|
return new SignalImpl(container, 0);
|
|
30323
|
-
case
|
|
30495
|
+
case 31 /* WrappedSignal */:
|
|
30324
30496
|
return new WrappedSignalImpl(container, null, null, null);
|
|
30325
|
-
case
|
|
30497
|
+
case 32 /* ComputedSignal */:
|
|
30326
30498
|
return new ComputedSignalImpl(container, null);
|
|
30327
|
-
case
|
|
30328
|
-
return new AsyncSignalImpl(container, null, void 0, {
|
|
30329
|
-
case
|
|
30499
|
+
case 33 /* AsyncSignal */:
|
|
30500
|
+
return new AsyncSignalImpl(container, null, void 0, {});
|
|
30501
|
+
case 34 /* SerializerSignal */:
|
|
30330
30502
|
return new SerializerSignalImpl(container, null);
|
|
30331
|
-
case
|
|
30503
|
+
case 35 /* Store */: {
|
|
30332
30504
|
const data = value;
|
|
30333
30505
|
const t = data[0];
|
|
30334
30506
|
const v = data[1];
|
|
@@ -30343,17 +30515,17 @@ var allocate = (container, typeId, value) => {
|
|
|
30343
30515
|
}
|
|
30344
30516
|
case 13 /* URLSearchParams */:
|
|
30345
30517
|
return new URLSearchParams(value);
|
|
30346
|
-
case
|
|
30518
|
+
case 36 /* FormData */:
|
|
30347
30519
|
return new FormData();
|
|
30348
|
-
case
|
|
30520
|
+
case 37 /* JSXNode */:
|
|
30349
30521
|
return new JSXNodeImpl(null, null, null, null, 0, null);
|
|
30350
30522
|
case 12 /* BigInt */:
|
|
30351
30523
|
return BigInt(value);
|
|
30352
|
-
case
|
|
30524
|
+
case 25 /* Set */:
|
|
30353
30525
|
return /* @__PURE__ */ new Set();
|
|
30354
|
-
case
|
|
30526
|
+
case 26 /* Map */:
|
|
30355
30527
|
return /* @__PURE__ */ new Map();
|
|
30356
|
-
case
|
|
30528
|
+
case 24 /* Promise */:
|
|
30357
30529
|
let resolve;
|
|
30358
30530
|
let reject;
|
|
30359
30531
|
const promise = new Promise((res, rej) => {
|
|
@@ -30364,13 +30536,13 @@ var allocate = (container, typeId, value) => {
|
|
|
30364
30536
|
promise.catch(() => {
|
|
30365
30537
|
});
|
|
30366
30538
|
return promise;
|
|
30367
|
-
case
|
|
30539
|
+
case 27 /* Uint8Array */:
|
|
30368
30540
|
const encodedLength = value.length;
|
|
30369
30541
|
const blocks = encodedLength >>> 2;
|
|
30370
30542
|
const rest = encodedLength & 3;
|
|
30371
30543
|
const decodedLength = blocks * 3 + (rest ? rest - 1 : 0);
|
|
30372
30544
|
return new Uint8Array(decodedLength);
|
|
30373
|
-
case
|
|
30545
|
+
case 38 /* PropsProxy */:
|
|
30374
30546
|
return createPropsProxy(null);
|
|
30375
30547
|
case 10 /* VNode */:
|
|
30376
30548
|
return retrieveVNodeOrDocument(container, value);
|
|
@@ -30382,9 +30554,9 @@ var allocate = (container, typeId, value) => {
|
|
|
30382
30554
|
} else {
|
|
30383
30555
|
throw qError(17 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
30384
30556
|
}
|
|
30385
|
-
case
|
|
30557
|
+
case 39 /* SubscriptionData */:
|
|
30386
30558
|
return new SubscriptionData({});
|
|
30387
|
-
case
|
|
30559
|
+
case 40 /* EffectSubscription */:
|
|
30388
30560
|
return new EffectSubscription(null, null, null, null);
|
|
30389
30561
|
default:
|
|
30390
30562
|
throw qError(18 /* serializeErrorCannotAllocate */, [typeId]);
|
|
@@ -30405,6 +30577,9 @@ var dangerousObjectKeys = /* @__PURE__ */ new Set([
|
|
|
30405
30577
|
"then"
|
|
30406
30578
|
]);
|
|
30407
30579
|
var isSafeObjectKV = (key, value) => {
|
|
30580
|
+
if (typeof key === "number") {
|
|
30581
|
+
return true;
|
|
30582
|
+
}
|
|
30408
30583
|
return typeof key === "string" && key !== "__proto__" && (typeof value !== "function" || !dangerousObjectKeys.has(key));
|
|
30409
30584
|
};
|
|
30410
30585
|
var inflate = (container, target, typeId, data) => {
|
|
@@ -30431,7 +30606,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30431
30606
|
target[key] = value;
|
|
30432
30607
|
}
|
|
30433
30608
|
break;
|
|
30434
|
-
case
|
|
30609
|
+
case 28 /* Task */:
|
|
30435
30610
|
const task = target;
|
|
30436
30611
|
const v = data;
|
|
30437
30612
|
task.$qrl$ = v[0];
|
|
@@ -30440,10 +30615,10 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30440
30615
|
task.$el$ = v[3];
|
|
30441
30616
|
task.$state$ = v[4];
|
|
30442
30617
|
break;
|
|
30443
|
-
case
|
|
30618
|
+
case 29 /* Component */:
|
|
30444
30619
|
target[SERIALIZABLE_STATE][0] = data[0];
|
|
30445
30620
|
break;
|
|
30446
|
-
case
|
|
30621
|
+
case 35 /* Store */: {
|
|
30447
30622
|
const store = unwrapStore(target);
|
|
30448
30623
|
const storeTarget = pendingStoreTargets.get(store);
|
|
30449
30624
|
if (storeTarget) {
|
|
@@ -30457,7 +30632,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30457
30632
|
restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
|
|
30458
30633
|
break;
|
|
30459
30634
|
}
|
|
30460
|
-
case
|
|
30635
|
+
case 30 /* Signal */: {
|
|
30461
30636
|
const signal = target;
|
|
30462
30637
|
const d2 = data;
|
|
30463
30638
|
signal.$untrackedValue$ = d2[0];
|
|
@@ -30465,7 +30640,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30465
30640
|
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
30466
30641
|
break;
|
|
30467
30642
|
}
|
|
30468
|
-
case
|
|
30643
|
+
case 31 /* WrappedSignal */: {
|
|
30469
30644
|
const signal = target;
|
|
30470
30645
|
const d2 = data;
|
|
30471
30646
|
signal.$func$ = container.getSyncFn(d2[0]);
|
|
@@ -30479,14 +30654,22 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30479
30654
|
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
30480
30655
|
break;
|
|
30481
30656
|
}
|
|
30482
|
-
case
|
|
30657
|
+
case 33 /* AsyncSignal */: {
|
|
30483
30658
|
const asyncSignal = target;
|
|
30484
30659
|
const d2 = data;
|
|
30485
30660
|
asyncSignal.$computeQrl$ = d2[0];
|
|
30486
|
-
|
|
30487
|
-
|
|
30488
|
-
|
|
30489
|
-
|
|
30661
|
+
if (d2[1]) {
|
|
30662
|
+
asyncSignal.$effects$ = new Set(d2[1]);
|
|
30663
|
+
}
|
|
30664
|
+
if (d2[2]) {
|
|
30665
|
+
asyncSignal.$loadingEffects$ = new Set(d2[2]);
|
|
30666
|
+
}
|
|
30667
|
+
if (d2[3]) {
|
|
30668
|
+
asyncSignal.$errorEffects$ = new Set(d2[3]);
|
|
30669
|
+
}
|
|
30670
|
+
if (d2[4]) {
|
|
30671
|
+
asyncSignal.$untrackedError$ = d2[4];
|
|
30672
|
+
}
|
|
30490
30673
|
asyncSignal.$flags$ = d2[5] ?? 0;
|
|
30491
30674
|
if (asyncSignal.$flags$ & 64 /* CLIENT_ONLY */) {
|
|
30492
30675
|
asyncSignal.$untrackedLoading$ = true;
|
|
@@ -30498,8 +30681,15 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30498
30681
|
if (asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
30499
30682
|
asyncSignal.$flags$ |= 1 /* INVALID */;
|
|
30500
30683
|
}
|
|
30501
|
-
|
|
30502
|
-
asyncSignal
|
|
30684
|
+
const rawExpires = d2[7] ?? 0;
|
|
30685
|
+
asyncSignal.expires = Math.abs(rawExpires);
|
|
30686
|
+
if (rawExpires < 0) {
|
|
30687
|
+
asyncSignal.$flags$ |= 256 /* NO_POLL */;
|
|
30688
|
+
}
|
|
30689
|
+
if (d2[8] !== void 0 && d2[8] !== 1) {
|
|
30690
|
+
asyncSignal.$concurrency$ = d2[8] ?? 1;
|
|
30691
|
+
asyncSignal.$jobs$ = [];
|
|
30692
|
+
}
|
|
30503
30693
|
asyncSignal.$timeoutMs$ = d2[9] ?? 0;
|
|
30504
30694
|
restoreEffectBackRefForEffects(asyncSignal.$effects$, asyncSignal);
|
|
30505
30695
|
restoreEffectBackRefForEffects(asyncSignal.$loadingEffects$, asyncSignal);
|
|
@@ -30507,8 +30697,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30507
30697
|
break;
|
|
30508
30698
|
}
|
|
30509
30699
|
// Inflating a SerializerSignal is the same as inflating a ComputedSignal
|
|
30510
|
-
case
|
|
30511
|
-
case
|
|
30700
|
+
case 34 /* SerializerSignal */:
|
|
30701
|
+
case 32 /* ComputedSignal */: {
|
|
30512
30702
|
const computed = target;
|
|
30513
30703
|
const d2 = data;
|
|
30514
30704
|
computed.$computeQrl$ = d2[0];
|
|
@@ -30522,13 +30712,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30522
30712
|
if (hasValue) {
|
|
30523
30713
|
computed.$untrackedValue$ = d2[2];
|
|
30524
30714
|
}
|
|
30525
|
-
if (typeId !==
|
|
30715
|
+
if (typeId !== 34 /* SerializerSignal */ && computed.$untrackedValue$ !== NEEDS_COMPUTATION) {
|
|
30526
30716
|
computed.$flags$ &= ~1 /* INVALID */;
|
|
30527
30717
|
}
|
|
30528
30718
|
restoreEffectBackRefForEffects(computed.$effects$, computed);
|
|
30529
30719
|
break;
|
|
30530
30720
|
}
|
|
30531
|
-
case
|
|
30721
|
+
case 23 /* Error */: {
|
|
30532
30722
|
const d2 = data;
|
|
30533
30723
|
target.message = d2[0];
|
|
30534
30724
|
for (let i2 = 1; i2 < d2.length; i2 += 2) {
|
|
@@ -30536,7 +30726,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30536
30726
|
}
|
|
30537
30727
|
break;
|
|
30538
30728
|
}
|
|
30539
|
-
case
|
|
30729
|
+
case 36 /* FormData */: {
|
|
30540
30730
|
const formData = target;
|
|
30541
30731
|
const d2 = data;
|
|
30542
30732
|
for (let i2 = 0; i2 < d2.length; i2++) {
|
|
@@ -30544,7 +30734,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30544
30734
|
}
|
|
30545
30735
|
break;
|
|
30546
30736
|
}
|
|
30547
|
-
case
|
|
30737
|
+
case 37 /* JSXNode */: {
|
|
30548
30738
|
const jsx2 = target;
|
|
30549
30739
|
const [type, key, varProps, constProps, children, toSort] = data;
|
|
30550
30740
|
jsx2.type = type;
|
|
@@ -30555,7 +30745,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30555
30745
|
jsx2.toSort = !!toSort;
|
|
30556
30746
|
break;
|
|
30557
30747
|
}
|
|
30558
|
-
case
|
|
30748
|
+
case 25 /* Set */: {
|
|
30559
30749
|
const set = target;
|
|
30560
30750
|
const d2 = data;
|
|
30561
30751
|
for (let i2 = 0; i2 < d2.length; i2++) {
|
|
@@ -30563,7 +30753,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30563
30753
|
}
|
|
30564
30754
|
break;
|
|
30565
30755
|
}
|
|
30566
|
-
case
|
|
30756
|
+
case 26 /* Map */: {
|
|
30567
30757
|
const map = target;
|
|
30568
30758
|
const d2 = data;
|
|
30569
30759
|
for (let i2 = 0; i2 < d2.length; i2++) {
|
|
@@ -30571,7 +30761,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30571
30761
|
}
|
|
30572
30762
|
break;
|
|
30573
30763
|
}
|
|
30574
|
-
case
|
|
30764
|
+
case 24 /* Promise */: {
|
|
30575
30765
|
const promise = target;
|
|
30576
30766
|
const [resolved, result2] = data;
|
|
30577
30767
|
const [resolve, reject] = resolvers.get(promise);
|
|
@@ -30582,7 +30772,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30582
30772
|
}
|
|
30583
30773
|
break;
|
|
30584
30774
|
}
|
|
30585
|
-
case
|
|
30775
|
+
case 27 /* Uint8Array */:
|
|
30586
30776
|
const bytes = target;
|
|
30587
30777
|
const buf = atob(data);
|
|
30588
30778
|
let i = 0;
|
|
@@ -30591,7 +30781,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30591
30781
|
bytes[i++] = s.charCodeAt(0);
|
|
30592
30782
|
}
|
|
30593
30783
|
break;
|
|
30594
|
-
case
|
|
30784
|
+
case 38 /* PropsProxy */:
|
|
30595
30785
|
const propsProxy = target;
|
|
30596
30786
|
const d = data;
|
|
30597
30787
|
let owner = d[0];
|
|
@@ -30604,13 +30794,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
30604
30794
|
propsHandler.$effects$ = d[3];
|
|
30605
30795
|
restoreEffectBackRefForEffectsMap(propsHandler.$effects$, propsProxy);
|
|
30606
30796
|
break;
|
|
30607
|
-
case
|
|
30797
|
+
case 39 /* SubscriptionData */: {
|
|
30608
30798
|
const effectData = target;
|
|
30609
30799
|
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
30610
30800
|
effectData.data.$isConst$ = data[1];
|
|
30611
30801
|
break;
|
|
30612
30802
|
}
|
|
30613
|
-
case
|
|
30803
|
+
case 40 /* EffectSubscription */: {
|
|
30614
30804
|
const effectSub = target;
|
|
30615
30805
|
const d2 = data;
|
|
30616
30806
|
effectSub.consumer = d2[0];
|
|
@@ -30813,12 +31003,14 @@ var QRLClass = class {
|
|
|
30813
31003
|
// This is defined or undefined for the lifetime of the QRL, so we set it lazily
|
|
30814
31004
|
__publicField(this, "$captures$");
|
|
30815
31005
|
__publicField(this, "$container$");
|
|
31006
|
+
if (qDev) {
|
|
31007
|
+
initQrlClassDev($lazy$, $captures$, this);
|
|
31008
|
+
}
|
|
30816
31009
|
if ($captures$) {
|
|
30817
31010
|
this.$captures$ = $captures$;
|
|
30818
31011
|
if (typeof $captures$ === "string") {
|
|
30819
31012
|
this.$container$ = container;
|
|
30820
31013
|
}
|
|
30821
|
-
qDev && initQrlClassDev($lazy$, $captures$, this);
|
|
30822
31014
|
}
|
|
30823
31015
|
if ($lazy$.$ref$ != null && typeof this.$captures$ !== "string" && !isPromise($lazy$.$ref$)) {
|
|
30824
31016
|
this.resolved = bindCaptures(this, $lazy$.$ref$);
|
|
@@ -31078,7 +31270,69 @@ var now = () => {
|
|
|
31078
31270
|
// packages/qwik/src/core/shared/jsx/jsx-internal.ts
|
|
31079
31271
|
var BIND_VALUE = "bind:value";
|
|
31080
31272
|
var BIND_CHECKED = "bind:checked";
|
|
31273
|
+
var PASSIVE = "passive:";
|
|
31274
|
+
var PREVENT_DEFAULT = "preventdefault:";
|
|
31081
31275
|
var _hasOwnProperty3 = Object.prototype.hasOwnProperty;
|
|
31276
|
+
var removePassiveMarkers = (props, passiveKeys, preventDefaultKeys, passiveEvents, canMutate = false) => {
|
|
31277
|
+
let mutableProps = props;
|
|
31278
|
+
let copied = canMutate;
|
|
31279
|
+
if (passiveKeys.length > 0) {
|
|
31280
|
+
if (!copied) {
|
|
31281
|
+
mutableProps = { ...mutableProps };
|
|
31282
|
+
copied = true;
|
|
31283
|
+
}
|
|
31284
|
+
for (let i = 0; i < passiveKeys.length; i++) {
|
|
31285
|
+
const k = passiveKeys[i];
|
|
31286
|
+
delete mutableProps[k];
|
|
31287
|
+
}
|
|
31288
|
+
}
|
|
31289
|
+
if (preventDefaultKeys.length > 0) {
|
|
31290
|
+
for (let i = 0; i < preventDefaultKeys.length; i++) {
|
|
31291
|
+
const k = preventDefaultKeys[i];
|
|
31292
|
+
if (passiveEvents.has(normalizeJsxEventName(k.slice(PREVENT_DEFAULT.length)))) {
|
|
31293
|
+
if (!copied) {
|
|
31294
|
+
mutableProps = { ...mutableProps };
|
|
31295
|
+
copied = true;
|
|
31296
|
+
}
|
|
31297
|
+
delete mutableProps[k];
|
|
31298
|
+
}
|
|
31299
|
+
}
|
|
31300
|
+
}
|
|
31301
|
+
return mutableProps;
|
|
31302
|
+
};
|
|
31303
|
+
var getPassiveEventKey = (key) => {
|
|
31304
|
+
if (key.startsWith("on") && key.endsWith("$")) {
|
|
31305
|
+
return normalizeJsxEventName(key.slice(2, -1));
|
|
31306
|
+
}
|
|
31307
|
+
if (key.startsWith("window:on") && key.endsWith("$")) {
|
|
31308
|
+
return normalizeJsxEventName(key.slice(9, -1));
|
|
31309
|
+
}
|
|
31310
|
+
if (key.startsWith("document:on") && key.endsWith("$")) {
|
|
31311
|
+
return normalizeJsxEventName(key.slice(11, -1));
|
|
31312
|
+
}
|
|
31313
|
+
return null;
|
|
31314
|
+
};
|
|
31315
|
+
var convertJsxEventProps = (props, eventKeys, keyOrder, passiveEvents, canMutate = false) => {
|
|
31316
|
+
let mutableProps = props;
|
|
31317
|
+
let copied = canMutate;
|
|
31318
|
+
for (let i = 0; i < eventKeys.length; i++) {
|
|
31319
|
+
const k = eventKeys[i];
|
|
31320
|
+
const passiveEventKey = getPassiveEventKey(k);
|
|
31321
|
+
const attr = jsxEventToHtmlAttribute(k, passiveEvents.has(passiveEventKey));
|
|
31322
|
+
if (attr) {
|
|
31323
|
+
if (!copied) {
|
|
31324
|
+
mutableProps = { ...mutableProps };
|
|
31325
|
+
copied = true;
|
|
31326
|
+
}
|
|
31327
|
+
const attrIndex = keyOrder.get(attr);
|
|
31328
|
+
if (attrIndex === void 0 || attrIndex < keyOrder.get(k)) {
|
|
31329
|
+
mutableProps[attr] = mutableProps[k];
|
|
31330
|
+
}
|
|
31331
|
+
delete mutableProps[k];
|
|
31332
|
+
}
|
|
31333
|
+
}
|
|
31334
|
+
return mutableProps;
|
|
31335
|
+
};
|
|
31082
31336
|
var _jsxSorted = (type, varProps, constProps, children, flags, key, dev) => {
|
|
31083
31337
|
return new JSXNodeImpl(type, varProps, constProps, children, flags, key, false, dev);
|
|
31084
31338
|
};
|
|
@@ -31089,49 +31343,90 @@ var _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
|
31089
31343
|
let bindValueSignal = null;
|
|
31090
31344
|
let bindCheckedSignal = null;
|
|
31091
31345
|
if (typeof type === "string") {
|
|
31346
|
+
const passiveEvents = /* @__PURE__ */ new Set();
|
|
31347
|
+
const constEventKeys = [];
|
|
31348
|
+
const varEventKeys = [];
|
|
31349
|
+
const constPassiveKeys = [];
|
|
31350
|
+
const varPassiveKeys = [];
|
|
31351
|
+
const constPreventDefaultKeys = [];
|
|
31352
|
+
const varPreventDefaultKeys = [];
|
|
31353
|
+
const constKeyOrder = /* @__PURE__ */ new Map();
|
|
31354
|
+
const varKeyOrder = /* @__PURE__ */ new Map();
|
|
31092
31355
|
if (constProps) {
|
|
31093
|
-
|
|
31356
|
+
let index = 0;
|
|
31094
31357
|
for (const k in constProps) {
|
|
31095
|
-
|
|
31096
|
-
if (
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
|
|
31103
|
-
}
|
|
31104
|
-
delete constProps[k];
|
|
31358
|
+
constKeyOrder.set(k, index++);
|
|
31359
|
+
if (k.startsWith(PASSIVE)) {
|
|
31360
|
+
constPassiveKeys.push(k);
|
|
31361
|
+
passiveEvents.add(normalizeJsxEventName(k.slice(PASSIVE.length)));
|
|
31362
|
+
} else if (k.startsWith(PREVENT_DEFAULT)) {
|
|
31363
|
+
constPreventDefaultKeys.push(k);
|
|
31364
|
+
} else if (getPassiveEventKey(k) !== null) {
|
|
31365
|
+
constEventKeys.push(k);
|
|
31105
31366
|
} else if (k === BIND_CHECKED) {
|
|
31106
31367
|
bindCheckedSignal = constProps[k];
|
|
31107
31368
|
} else if (k === BIND_VALUE) {
|
|
31108
31369
|
bindValueSignal = constProps[k];
|
|
31109
31370
|
}
|
|
31110
|
-
processedKeys.add(k);
|
|
31111
31371
|
}
|
|
31112
31372
|
}
|
|
31113
31373
|
if (varProps) {
|
|
31114
|
-
|
|
31374
|
+
let index = 0;
|
|
31115
31375
|
for (const k in varProps) {
|
|
31116
|
-
|
|
31117
|
-
if (
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
}
|
|
31125
|
-
delete varProps[k];
|
|
31126
|
-
toSort = true;
|
|
31376
|
+
varKeyOrder.set(k, index++);
|
|
31377
|
+
if (k.startsWith(PASSIVE)) {
|
|
31378
|
+
varPassiveKeys.push(k);
|
|
31379
|
+
passiveEvents.add(normalizeJsxEventName(k.slice(PASSIVE.length)));
|
|
31380
|
+
} else if (k.startsWith(PREVENT_DEFAULT)) {
|
|
31381
|
+
varPreventDefaultKeys.push(k);
|
|
31382
|
+
} else if (getPassiveEventKey(k) !== null) {
|
|
31383
|
+
varEventKeys.push(k);
|
|
31127
31384
|
} else if (k === BIND_CHECKED) {
|
|
31128
31385
|
bindCheckedSignal = varProps[k];
|
|
31129
31386
|
} else if (k === BIND_VALUE) {
|
|
31130
31387
|
bindValueSignal = varProps[k];
|
|
31131
31388
|
}
|
|
31132
|
-
processedKeys.add(k);
|
|
31133
31389
|
}
|
|
31134
31390
|
}
|
|
31391
|
+
if (constProps) {
|
|
31392
|
+
const originalConstProps = constProps;
|
|
31393
|
+
constProps = removePassiveMarkers(
|
|
31394
|
+
constProps,
|
|
31395
|
+
constPassiveKeys,
|
|
31396
|
+
constPreventDefaultKeys,
|
|
31397
|
+
passiveEvents,
|
|
31398
|
+
constPropsCopied
|
|
31399
|
+
);
|
|
31400
|
+
constPropsCopied = constPropsCopied || constProps !== originalConstProps;
|
|
31401
|
+
constProps = convertJsxEventProps(
|
|
31402
|
+
constProps,
|
|
31403
|
+
constEventKeys,
|
|
31404
|
+
constKeyOrder,
|
|
31405
|
+
passiveEvents,
|
|
31406
|
+
constPropsCopied
|
|
31407
|
+
);
|
|
31408
|
+
constPropsCopied = constPropsCopied || constProps !== originalConstProps;
|
|
31409
|
+
}
|
|
31410
|
+
if (varProps) {
|
|
31411
|
+
const originalVarProps = varProps;
|
|
31412
|
+
varProps = removePassiveMarkers(
|
|
31413
|
+
varProps,
|
|
31414
|
+
varPassiveKeys,
|
|
31415
|
+
varPreventDefaultKeys,
|
|
31416
|
+
passiveEvents,
|
|
31417
|
+
varPropsCopied
|
|
31418
|
+
);
|
|
31419
|
+
varPropsCopied = varPropsCopied || varProps !== originalVarProps;
|
|
31420
|
+
varProps = convertJsxEventProps(
|
|
31421
|
+
varProps,
|
|
31422
|
+
varEventKeys,
|
|
31423
|
+
varKeyOrder,
|
|
31424
|
+
passiveEvents,
|
|
31425
|
+
varPropsCopied
|
|
31426
|
+
);
|
|
31427
|
+
varPropsCopied = varPropsCopied || varProps !== originalVarProps;
|
|
31428
|
+
toSort = toSort || varEventKeys.length > 0;
|
|
31429
|
+
}
|
|
31135
31430
|
if (bindCheckedSignal || bindValueSignal) {
|
|
31136
31431
|
if (!varPropsCopied) {
|
|
31137
31432
|
varProps = { ...varProps };
|
|
@@ -31255,6 +31550,7 @@ var Slot = (props) => {
|
|
|
31255
31550
|
};
|
|
31256
31551
|
|
|
31257
31552
|
// packages/qwik/src/core/shared/serdes/constants.ts
|
|
31553
|
+
var explicitUndefined = /* @__PURE__ */ Symbol("undefined");
|
|
31258
31554
|
var _constants = [
|
|
31259
31555
|
void 0,
|
|
31260
31556
|
null,
|
|
@@ -31311,6 +31607,14 @@ var _typeIdNames = [
|
|
|
31311
31607
|
"BigInt",
|
|
31312
31608
|
"URLSearchParams",
|
|
31313
31609
|
"ForwardRefs",
|
|
31610
|
+
"TemporalDuration",
|
|
31611
|
+
"TemporalInstant",
|
|
31612
|
+
"TemporalPlainDate",
|
|
31613
|
+
"TemporalPlainDateTime",
|
|
31614
|
+
"TemporalPlainMonthDay",
|
|
31615
|
+
"TemporalPlainTime",
|
|
31616
|
+
"TemporalPlainYearMonth",
|
|
31617
|
+
"TemporalZonedDateTime",
|
|
31314
31618
|
"Error",
|
|
31315
31619
|
"Promise",
|
|
31316
31620
|
"Set",
|
|
@@ -31332,7 +31636,7 @@ var _typeIdNames = [
|
|
|
31332
31636
|
];
|
|
31333
31637
|
|
|
31334
31638
|
// packages/qwik/src/core/shared/serdes/deser-proxy.ts
|
|
31335
|
-
var needsInflation = (typeId) => typeId >=
|
|
31639
|
+
var needsInflation = (typeId) => typeId >= 23 /* Error */ || typeId === 4 /* Array */ || typeId === 5 /* Object */;
|
|
31336
31640
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
31337
31641
|
var isDeserializerProxy = (value) => {
|
|
31338
31642
|
return isObject(value) && SERIALIZER_PROXY_UNWRAP in value;
|
|
@@ -32231,6 +32535,7 @@ function getEffects2(target, prop, storeEffects) {
|
|
|
32231
32535
|
// packages/qwik/src/core/shared/serdes/can-serialize.ts
|
|
32232
32536
|
var getKeyVal = (value, key) => value[key];
|
|
32233
32537
|
var canSerialize = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
32538
|
+
const hasTemporal = typeof Temporal !== "undefined";
|
|
32234
32539
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
32235
32540
|
return true;
|
|
32236
32541
|
} else if (typeof value === "object") {
|
|
@@ -32275,6 +32580,22 @@ var canSerialize = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
32275
32580
|
return true;
|
|
32276
32581
|
} else if (value instanceof Date) {
|
|
32277
32582
|
return true;
|
|
32583
|
+
} else if (hasTemporal && value instanceof Temporal.Duration) {
|
|
32584
|
+
return true;
|
|
32585
|
+
} else if (hasTemporal && value instanceof Temporal.Instant) {
|
|
32586
|
+
return true;
|
|
32587
|
+
} else if (hasTemporal && value instanceof Temporal.PlainDate) {
|
|
32588
|
+
return true;
|
|
32589
|
+
} else if (hasTemporal && value instanceof Temporal.PlainDateTime) {
|
|
32590
|
+
return true;
|
|
32591
|
+
} else if (hasTemporal && value instanceof Temporal.PlainMonthDay) {
|
|
32592
|
+
return true;
|
|
32593
|
+
} else if (hasTemporal && value instanceof Temporal.PlainTime) {
|
|
32594
|
+
return true;
|
|
32595
|
+
} else if (hasTemporal && value instanceof Temporal.PlainYearMonth) {
|
|
32596
|
+
return true;
|
|
32597
|
+
} else if (hasTemporal && value instanceof Temporal.ZonedDateTime) {
|
|
32598
|
+
return true;
|
|
32278
32599
|
} else if (value instanceof RegExp) {
|
|
32279
32600
|
return true;
|
|
32280
32601
|
} else if (value instanceof URLSearchParams) {
|
|
@@ -35218,24 +35539,10 @@ var ElementFixture = class {
|
|
|
35218
35539
|
};
|
|
35219
35540
|
async function trigger(root, queryOrElement, eventName, eventPayload = {}, options) {
|
|
35220
35541
|
const waitForIdle = options?.waitForIdle ?? true;
|
|
35221
|
-
|
|
35222
|
-
let
|
|
35223
|
-
|
|
35224
|
-
|
|
35225
|
-
scopedKebabName = eventName;
|
|
35226
|
-
scope = eventName.charAt(0);
|
|
35227
|
-
kebabName = eventName.substring(2);
|
|
35228
|
-
if (kebabName === "DOMContentLoaded") {
|
|
35229
|
-
kebabName = "-d-o-m-content-loaded";
|
|
35230
|
-
scopedKebabName = scope + ":" + kebabName;
|
|
35231
|
-
}
|
|
35232
|
-
} else {
|
|
35233
|
-
scope = "e";
|
|
35234
|
-
kebabName = fromCamelToKebabCase(eventName);
|
|
35235
|
-
scopedKebabName = "e:" + kebabName;
|
|
35236
|
-
}
|
|
35237
|
-
if (scope !== "e") {
|
|
35238
|
-
queryOrElement = `[q-${scope}\\:${kebabName}]`;
|
|
35542
|
+
const { rootScope, kebabName, selectors, scopedEventNames } = parseTriggerEvent(eventName);
|
|
35543
|
+
let event = null;
|
|
35544
|
+
if (selectors) {
|
|
35545
|
+
queryOrElement = selectors;
|
|
35239
35546
|
}
|
|
35240
35547
|
const elements = typeof queryOrElement === "string" ? Array.from(root.querySelectorAll(queryOrElement)) : [queryOrElement];
|
|
35241
35548
|
let container = null;
|
|
@@ -35248,29 +35555,114 @@ async function trigger(root, queryOrElement, eventName, eventPayload = {}, optio
|
|
|
35248
35555
|
container = getDomContainer2(element);
|
|
35249
35556
|
}
|
|
35250
35557
|
const { bubbles = true, cancelable = true, ...rest } = eventPayload ?? {};
|
|
35251
|
-
|
|
35558
|
+
event = new Event(eventName, {
|
|
35252
35559
|
bubbles,
|
|
35253
35560
|
cancelable
|
|
35254
35561
|
});
|
|
35255
35562
|
Object.assign(event, rest);
|
|
35256
|
-
|
|
35563
|
+
for (let i2 = 0; i2 < scopedEventNames.length; i2++) {
|
|
35564
|
+
const { scope, scopedKebabName } = scopedEventNames[i2];
|
|
35565
|
+
await dispatch(element, event, scopedKebabName, kebabName, scope === rootScope);
|
|
35566
|
+
}
|
|
35257
35567
|
}
|
|
35258
35568
|
if (waitForIdle && container) {
|
|
35259
35569
|
await waitForDrain(container);
|
|
35260
35570
|
}
|
|
35571
|
+
return event;
|
|
35261
35572
|
}
|
|
35262
|
-
var
|
|
35573
|
+
var parseTriggerEvent = (eventName) => {
|
|
35574
|
+
let scope = "e";
|
|
35575
|
+
let kebabName = eventName;
|
|
35576
|
+
const separatorIndex = eventName.indexOf(":");
|
|
35577
|
+
if (separatorIndex !== -1) {
|
|
35578
|
+
scope = eventName.slice(0, separatorIndex);
|
|
35579
|
+
kebabName = eventName.substring(separatorIndex + 1);
|
|
35580
|
+
if (kebabName === "DOMContentLoaded") {
|
|
35581
|
+
kebabName = "-d-o-m-content-loaded";
|
|
35582
|
+
}
|
|
35583
|
+
} else {
|
|
35584
|
+
kebabName = fromCamelToKebabCase(eventName);
|
|
35585
|
+
}
|
|
35586
|
+
const rootScope = scope.charAt(0);
|
|
35587
|
+
const scopes = scope.length === 2 ? [scope] : [scope, `${scope}p`];
|
|
35588
|
+
return {
|
|
35589
|
+
rootScope,
|
|
35590
|
+
kebabName,
|
|
35591
|
+
selectors: rootScope === "e" ? void 0 : scopes.map((scope2) => `[q-${scope2}\\:${kebabName}]`).join(", "),
|
|
35592
|
+
scopedEventNames: scopes.map((scope2) => ({
|
|
35593
|
+
scope: scope2,
|
|
35594
|
+
scopedKebabName: `${scope2}:${kebabName}`
|
|
35595
|
+
}))
|
|
35596
|
+
};
|
|
35597
|
+
};
|
|
35598
|
+
var PREVENT_DEFAULT2 = "preventdefault:";
|
|
35263
35599
|
var STOP_PROPAGATION = "stoppropagation:";
|
|
35600
|
+
var CAPTURE = "capture:";
|
|
35264
35601
|
var Q_FUNCS_PREFIX = /document.qdata\["qFuncs_(.+)"\]=/;
|
|
35265
35602
|
var QContainerSelector2 = "[q\\:container]";
|
|
35266
|
-
var
|
|
35267
|
-
|
|
35603
|
+
var isElementNode = (node) => !!node && node.nodeType === 1;
|
|
35604
|
+
var isPromise2 = (promise) => promise && typeof promise.then === "function";
|
|
35605
|
+
var queuedTasks;
|
|
35606
|
+
var runTasks = async (tasks) => {
|
|
35607
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
35608
|
+
await tasks[i]();
|
|
35609
|
+
}
|
|
35610
|
+
};
|
|
35611
|
+
var queueTasks = (tasks) => {
|
|
35612
|
+
const run = () => runTasks(tasks);
|
|
35613
|
+
queuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();
|
|
35614
|
+
return queuedTasks;
|
|
35615
|
+
};
|
|
35616
|
+
var dispatch = async (element, event, scopedKebabName, kebabName, allowPreventDefault = true) => {
|
|
35617
|
+
const captureAttributeName = CAPTURE + kebabName;
|
|
35618
|
+
const elements = [];
|
|
35619
|
+
const captureHandlers = [];
|
|
35620
|
+
const tasks = [];
|
|
35621
|
+
let current = element;
|
|
35622
|
+
while (current) {
|
|
35623
|
+
if (isElementNode(current)) {
|
|
35624
|
+
elements.push(current);
|
|
35625
|
+
captureHandlers.push(
|
|
35626
|
+
current.hasAttribute(captureAttributeName) && (!!current.getAttribute("q-" + scopedKebabName) || "_qDispatch" in current && !!current._qDispatch?.[scopedKebabName])
|
|
35627
|
+
);
|
|
35628
|
+
current = current.parentElement;
|
|
35629
|
+
} else {
|
|
35630
|
+
current = current.parentElement;
|
|
35631
|
+
}
|
|
35632
|
+
}
|
|
35633
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
35634
|
+
if (captureHandlers[i]) {
|
|
35635
|
+
dispatchOnElement(elements[i], event, scopedKebabName, tasks, kebabName, allowPreventDefault);
|
|
35636
|
+
const continuePropagation = !event.cancelBubble;
|
|
35637
|
+
if (!continuePropagation || event.cancelBubble) {
|
|
35638
|
+
await queueTasks(tasks);
|
|
35639
|
+
return;
|
|
35640
|
+
}
|
|
35641
|
+
}
|
|
35642
|
+
}
|
|
35643
|
+
for (let i = 0; i < elements.length; i++) {
|
|
35644
|
+
if (!captureHandlers[i]) {
|
|
35645
|
+
dispatchOnElement(elements[i], event, scopedKebabName, tasks, kebabName, allowPreventDefault);
|
|
35646
|
+
const doBubble = event.bubbles && !event.cancelBubble;
|
|
35647
|
+
if (!doBubble || event.cancelBubble) {
|
|
35648
|
+
await queueTasks(tasks);
|
|
35649
|
+
return;
|
|
35650
|
+
}
|
|
35651
|
+
}
|
|
35652
|
+
}
|
|
35653
|
+
await queueTasks(tasks);
|
|
35654
|
+
};
|
|
35655
|
+
var dispatchOnElement = (element, event, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {
|
|
35656
|
+
const preventAttributeName = PREVENT_DEFAULT2 + kebabName;
|
|
35268
35657
|
const stopPropagationName = STOP_PROPAGATION + kebabName;
|
|
35269
|
-
|
|
35658
|
+
if (element) {
|
|
35659
|
+
let defer = false;
|
|
35660
|
+
const handlers = "_qDispatch" in element ? element._qDispatch?.[scopedKebabName] : void 0;
|
|
35661
|
+
const attrValue = element.getAttribute("q-" + scopedKebabName);
|
|
35270
35662
|
if (kebabName) {
|
|
35271
35663
|
const preventDefault = element.hasAttribute(preventAttributeName);
|
|
35272
35664
|
const stopPropagation = element.hasAttribute(stopPropagationName);
|
|
35273
|
-
if (preventDefault) {
|
|
35665
|
+
if (allowPreventDefault && preventDefault) {
|
|
35274
35666
|
event.preventDefault();
|
|
35275
35667
|
}
|
|
35276
35668
|
if (stopPropagation) {
|
|
@@ -35278,47 +35670,91 @@ var dispatch = async (element, event, scopedKebabName, kebabName) => {
|
|
|
35278
35670
|
}
|
|
35279
35671
|
}
|
|
35280
35672
|
if ("_qDispatch" in element) {
|
|
35281
|
-
const handlers = element._qDispatch?.[scopedKebabName];
|
|
35282
35673
|
if (handlers) {
|
|
35283
35674
|
if (typeof handlers === "function") {
|
|
35284
|
-
|
|
35675
|
+
const run = () => handlers(event, element);
|
|
35676
|
+
if (defer) {
|
|
35677
|
+
tasks.push(async () => {
|
|
35678
|
+
const result2 = run();
|
|
35679
|
+
if (isPromise2(result2)) {
|
|
35680
|
+
await result2;
|
|
35681
|
+
}
|
|
35682
|
+
});
|
|
35683
|
+
} else {
|
|
35684
|
+
const result2 = run();
|
|
35685
|
+
if (isPromise2(result2)) {
|
|
35686
|
+
defer = true;
|
|
35687
|
+
tasks.push(() => result2);
|
|
35688
|
+
}
|
|
35689
|
+
}
|
|
35285
35690
|
} else if (handlers.length) {
|
|
35286
35691
|
for (let i = 0; i < handlers.length; i++) {
|
|
35287
35692
|
const handler = handlers[i];
|
|
35288
35693
|
if (handler) {
|
|
35289
|
-
|
|
35694
|
+
const run = () => handler(event, element);
|
|
35695
|
+
if (defer) {
|
|
35696
|
+
tasks.push(async () => {
|
|
35697
|
+
const result2 = run();
|
|
35698
|
+
if (isPromise2(result2)) {
|
|
35699
|
+
await result2;
|
|
35700
|
+
}
|
|
35701
|
+
});
|
|
35702
|
+
} else {
|
|
35703
|
+
const result2 = run();
|
|
35704
|
+
if (isPromise2(result2)) {
|
|
35705
|
+
defer = true;
|
|
35706
|
+
tasks.push(() => result2);
|
|
35707
|
+
}
|
|
35708
|
+
}
|
|
35290
35709
|
}
|
|
35291
35710
|
}
|
|
35292
35711
|
}
|
|
35712
|
+
return;
|
|
35293
35713
|
}
|
|
35294
|
-
}
|
|
35295
|
-
|
|
35714
|
+
}
|
|
35715
|
+
if (attrValue) {
|
|
35716
|
+
const qrls = attrValue;
|
|
35296
35717
|
try {
|
|
35297
35718
|
const qrlsArray = qrls.split("|");
|
|
35298
35719
|
for (let i = 0; i < qrlsArray.length; i++) {
|
|
35299
35720
|
const qrl = qrlsArray[i];
|
|
35300
35721
|
const [chunk, symbol, captures] = qrl.split("#");
|
|
35301
|
-
|
|
35302
|
-
|
|
35303
|
-
|
|
35304
|
-
|
|
35305
|
-
|
|
35722
|
+
const run = () => {
|
|
35723
|
+
let fn;
|
|
35724
|
+
if (chunk) {
|
|
35725
|
+
fn = globalThis.__qrl_back_channel__?.get(symbol);
|
|
35726
|
+
if (typeof fn !== "function") {
|
|
35727
|
+
throw new Error(`QRL function not found in back channel for ${qrl}`);
|
|
35728
|
+
}
|
|
35729
|
+
} else {
|
|
35730
|
+
const container = getDomContainer2(element);
|
|
35731
|
+
const sync = container.parseQRL(qrl);
|
|
35732
|
+
sync.resolve();
|
|
35733
|
+
fn = sync.resolved;
|
|
35306
35734
|
}
|
|
35735
|
+
return fn.apply(captures, [event, element]);
|
|
35736
|
+
};
|
|
35737
|
+
if (chunk || defer) {
|
|
35738
|
+
defer = true;
|
|
35739
|
+
tasks.push(async () => {
|
|
35740
|
+
const result2 = run();
|
|
35741
|
+
if (isPromise2(result2)) {
|
|
35742
|
+
await result2;
|
|
35743
|
+
}
|
|
35744
|
+
});
|
|
35307
35745
|
} else {
|
|
35308
|
-
const
|
|
35309
|
-
|
|
35310
|
-
|
|
35311
|
-
|
|
35746
|
+
const result2 = run();
|
|
35747
|
+
if (isPromise2(result2)) {
|
|
35748
|
+
defer = true;
|
|
35749
|
+
tasks.push(() => result2);
|
|
35750
|
+
}
|
|
35312
35751
|
}
|
|
35313
|
-
await fn.apply(captures, [event, element]);
|
|
35314
35752
|
}
|
|
35315
35753
|
} catch (error) {
|
|
35316
35754
|
console.error("!!! qrl error", qrls, error);
|
|
35317
35755
|
throw error;
|
|
35318
35756
|
}
|
|
35319
|
-
return;
|
|
35320
35757
|
}
|
|
35321
|
-
element = event.bubbles && !event.cancelBubble ? element.parentElement : null;
|
|
35322
35758
|
}
|
|
35323
35759
|
};
|
|
35324
35760
|
|