@qwik.dev/core 2.0.0-beta.42 → 2.0.0-beta.45
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/async-local-storage.d.ts +3 -0
- package/dist/async-local-storage.mjs +8 -0
- package/dist/async-local-storage.node.mjs +6 -0
- package/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +26 -5
- package/dist/core-internal.d.ts +65 -73
- package/dist/core.min.mjs +11 -11
- package/dist/core.mjs +905 -1071
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +3932 -4125
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +226 -7
- package/dist/optimizer.mjs +828 -648
- package/dist/qwikloader.debug.js +12 -10
- package/dist/qwikloader.js +1 -1
- package/dist/server.mjs +8 -6
- package/dist/server.prod.mjs +381 -379
- package/dist/testing/index.d.ts +3 -8
- package/dist/testing/index.mjs +183 -96
- package/dist/testing/package.json +1 -1
- package/dist/ts-optimizer.mjs +10450 -0
- package/dist/worker/index.mjs +10 -8
- package/dist/worker/package.json +1 -1
- package/package.json +21 -7
package/dist/core.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.45-dev+596de70
|
|
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
|
|
7
7
|
*/
|
|
8
|
-
import { isDev, isServer, isBrowser
|
|
8
|
+
import { isDev, isServer, isBrowser } from '@qwik.dev/core/build';
|
|
9
9
|
export { isBrowser, isDev, isServer } from '@qwik.dev/core/build';
|
|
10
|
+
import { getAsyncLocalStorage } from '@qwik.dev/core/async-local-storage';
|
|
11
|
+
export { getAsyncLocalStorage as _getAsyncLocalStorage } from '@qwik.dev/core/async-local-storage';
|
|
10
12
|
import { p } from '@qwik.dev/core/preloader';
|
|
11
13
|
|
|
12
14
|
// Direct `globalThis.X` accesses (no alias) so Terser's `global_defs` engages
|
|
@@ -76,102 +78,6 @@ const createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
|
76
78
|
return err;
|
|
77
79
|
};
|
|
78
80
|
|
|
79
|
-
const ASSERT_DISCLAIMER = 'Internal assert, this is likely caused by a bug in Qwik: ';
|
|
80
|
-
/*@__INLINE__*/
|
|
81
|
-
function assertDefined(value, text, ...parts) {
|
|
82
|
-
if (isDev) {
|
|
83
|
-
if (value != null) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/*@__INLINE__*/
|
|
90
|
-
function assertEqual(value1, value2, text, ...parts) {
|
|
91
|
-
if (isDev) {
|
|
92
|
-
if (value1 === value2) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/*@__INLINE__*/
|
|
99
|
-
function assertTrue(value1, text, ...parts) {
|
|
100
|
-
if (isDev) {
|
|
101
|
-
if (value1 === true) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/*@__INLINE__*/
|
|
108
|
-
function assertFalse(value1, text, ...parts) {
|
|
109
|
-
if (isDev) {
|
|
110
|
-
if (value1 === false) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/*@__INLINE__*/
|
|
117
|
-
function assertNumber(value1, text, ...parts) {
|
|
118
|
-
if (isDev) {
|
|
119
|
-
if (typeof value1 === 'number') {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** @internal */
|
|
127
|
-
const mapApp_findIndx = (array, key, start) => {
|
|
128
|
-
isDev && assertTrue(start % 2 === 0, 'Expecting even number.');
|
|
129
|
-
let bottom = start >> 1;
|
|
130
|
-
let top = (array.length - 2) >> 1;
|
|
131
|
-
while (bottom <= top) {
|
|
132
|
-
const mid = bottom + ((top - bottom) >> 1);
|
|
133
|
-
const midKey = array[mid << 1];
|
|
134
|
-
if (midKey === key) {
|
|
135
|
-
return mid << 1;
|
|
136
|
-
}
|
|
137
|
-
if (midKey < key) {
|
|
138
|
-
bottom = mid + 1;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
top = mid - 1;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return (bottom << 1) ^ -1;
|
|
145
|
-
};
|
|
146
|
-
/** @internal */
|
|
147
|
-
const mapArray_set = (array, key, value, start, allowNullValue = false) => {
|
|
148
|
-
const indx = mapApp_findIndx(array, key, start);
|
|
149
|
-
if (indx >= 0) {
|
|
150
|
-
if (value == null && !allowNullValue) {
|
|
151
|
-
array.splice(indx, 2);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
array[indx + 1] = value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else if (value != null || allowNullValue) {
|
|
158
|
-
array.splice(indx ^ -1, 0, key, value);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
/** @internal */
|
|
162
|
-
const mapArray_get = (array, key, start) => {
|
|
163
|
-
const indx = mapApp_findIndx(array, key, start);
|
|
164
|
-
if (indx >= 0) {
|
|
165
|
-
return array[indx + 1];
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const mapArray_has = (array, key, start) => {
|
|
172
|
-
return mapApp_findIndx(array, key, start) >= 0;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
81
|
/** @private */
|
|
176
82
|
const isSerializableObject = (v) => {
|
|
177
83
|
const proto = Object.getPrototypeOf(v);
|
|
@@ -189,9 +95,6 @@ const isString = (v) => {
|
|
|
189
95
|
const isFunction = (v) => {
|
|
190
96
|
return typeof v === 'function';
|
|
191
97
|
};
|
|
192
|
-
const isPrimitiveOrNullUndefined = (v) => {
|
|
193
|
-
return (typeof v !== 'object' && typeof v !== 'function') || v === null || v === undefined;
|
|
194
|
-
};
|
|
195
98
|
|
|
196
99
|
const baseUrl = 'https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q';
|
|
197
100
|
const codeToText = (code, ...parts) => {
|
|
@@ -234,10 +137,11 @@ const codeToText = (code, ...parts) => {
|
|
|
234
137
|
'Attribute value is unsafe for SSR {{0}}', // 32
|
|
235
138
|
'SerializerSymbol function returned rejected promise', // 33
|
|
236
139
|
'Serialization Error: Cannot serialize function: {{0}}', // 34
|
|
237
|
-
'Cannot read .value of a clientOnly async signal during SSR.
|
|
140
|
+
'Cannot read .value of a clientOnly async signal during SSR. Provide an initial value.', // 35
|
|
238
141
|
'Invalid element name for SSR {{0}}', // 36
|
|
239
142
|
'Invalid serialized Promise dependency', // 37
|
|
240
143
|
'Invalid serialized Uint8Array payload', // 38
|
|
144
|
+
'Computed signal was disposed', // 39
|
|
241
145
|
];
|
|
242
146
|
let text = MAP[code] ?? '';
|
|
243
147
|
if (parts.length) {
|
|
@@ -260,6 +164,13 @@ const qError = (code, errorMessageArgs = []) => {
|
|
|
260
164
|
return logErrorAndStop(text, ...errorMessageArgs);
|
|
261
165
|
};
|
|
262
166
|
|
|
167
|
+
/**
|
|
168
|
+
* QWIK_VERSION
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
const version = "2.0.0-beta.45-dev+596de70";
|
|
173
|
+
|
|
263
174
|
/** QRL related utilities that you can import without importing all of Qwik. */
|
|
264
175
|
const SYNC_QRL = '<sync>';
|
|
265
176
|
/** Sync QRL is a function which is serialized into `<script q:func="qwik/json">` tag. */
|
|
@@ -281,132 +192,6 @@ const getSymbolHash = (symbolName) => {
|
|
|
281
192
|
return symbolName.slice(index);
|
|
282
193
|
};
|
|
283
194
|
|
|
284
|
-
/**
|
|
285
|
-
* A friendly name tag for a VirtualVNode.
|
|
286
|
-
*
|
|
287
|
-
* Theses are used to give a name to a VirtualVNode. This is useful for debugging and testing.
|
|
288
|
-
*
|
|
289
|
-
* The name is only added in development mode and is not included in production builds.
|
|
290
|
-
*/
|
|
291
|
-
const DEBUG_TYPE = 'q:type';
|
|
292
|
-
const VirtualTypeName = {
|
|
293
|
-
["V" /* VirtualType.Virtual */]: /* ********* */ 'Virtual', //
|
|
294
|
-
["F" /* VirtualType.Fragment */]: /* ******** */ 'Fragment', //
|
|
295
|
-
["S" /* VirtualType.WrappedSignal */]: /* *** */ 'Signal', //
|
|
296
|
-
["A" /* VirtualType.Awaited */]: /* ********* */ 'Awaited', //
|
|
297
|
-
["C" /* VirtualType.Component */]: /* ******* */ 'Component', //
|
|
298
|
-
["I" /* VirtualType.InlineComponent */]: /* * */ 'InlineComponent', //
|
|
299
|
-
["P" /* VirtualType.Projection */]: /* ****** */ 'Projection', //
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* @file
|
|
304
|
-
*
|
|
305
|
-
* VNodeData is additional information which allows the `vnode` to recover virtual VNode information
|
|
306
|
-
* from the HTML.
|
|
307
|
-
*/
|
|
308
|
-
/**
|
|
309
|
-
* VNodeDataSeparator contains information about splitting up the VNodeData and attaching it to the
|
|
310
|
-
* HTML.
|
|
311
|
-
*/
|
|
312
|
-
const VNodeDataSeparator = {
|
|
313
|
-
REFERENCE: /* ******** */ 126, // `~` is a reference to the node. Save it.
|
|
314
|
-
ADVANCE_1: /* ********* */ 33, // `!` is vNodeData separator skipping 0. (ie next vNode)
|
|
315
|
-
ADVANCE_8192: /* ****** */ 46, // `.` is vNodeData separator skipping 4096.
|
|
316
|
-
};
|
|
317
|
-
/**
|
|
318
|
-
* VNodeDataChar contains information about the VNodeData used for encoding props.
|
|
319
|
-
*
|
|
320
|
-
* Available character ranges: 59 - 64, 91 - 94, 96, 123 - 126
|
|
321
|
-
*/
|
|
322
|
-
const VNodeDataChar = {
|
|
323
|
-
OPEN: /* ************** */ 123, // `{` is the start of the VNodeData for a virtual element.
|
|
324
|
-
CLOSE: /* ************* */ 125, // `}` is the end of the VNodeData for a virtual element.
|
|
325
|
-
SCOPED_STYLE: /* ******* */ 59, // `;` - `q:sstyle` - Style attribute.
|
|
326
|
-
RENDER_FN: /* ********** */ 60, // `<` - `q:renderFn' - Component QRL render function (body)
|
|
327
|
-
RENDER_HASH_PREFIX: /* **/ 95, // `_` after `<` identifies a component hash.
|
|
328
|
-
ID: /* ***************** */ 61, // `=` - `q:id` - ID of the element.
|
|
329
|
-
PROPS: /* ************** */ 62, // `>` - `q:props' - Component Props
|
|
330
|
-
SLOT_PARENT: /* ******** */ 63, // `?` - `q:sparent` - Slot parent.
|
|
331
|
-
KEY: /* **************** */ 64, // `@` - `q:key` - Element key.
|
|
332
|
-
SEQ: /* **************** */ 91, // `[` - `q:seq' - Seq value from `useSequentialScope()`
|
|
333
|
-
CONTEXT: /* ************ */ 93, // `]` - `q:ctx' - Component context/props
|
|
334
|
-
SEQ_IDX: /* ************ */ 94, // `^` - `q:seqIdx' - Sequential scope id
|
|
335
|
-
BACK_REFS: /* ********** */ 96, // '`' - `q:brefs' - Effect dependencies/subscriptions
|
|
336
|
-
SEPARATOR: /* ********* */ 124, // `|` - Separator char to encode any key/value pairs.
|
|
337
|
-
SLOT: /* ************** */ 126};
|
|
338
|
-
/**
|
|
339
|
-
* Convert a segment-local vnode index into a key for the root container's shared qVNodeRefs map.
|
|
340
|
-
*
|
|
341
|
-
* Out-of-order Suspense segments each start counting vnode refs from 0, but the client merges all
|
|
342
|
-
* segment refs into one root-level map. This uses a Cantor-style pairing function for the
|
|
343
|
-
* zero-based pair `(segmentIndex, localIndex)`, then makes it negative so segment refs cannot
|
|
344
|
-
* collide with root refs, which are non-negative.
|
|
345
|
-
*
|
|
346
|
-
* Examples:
|
|
347
|
-
*
|
|
348
|
-
* - Segment 1, local 0 -> -1
|
|
349
|
-
* - Segment 2, local 0 -> -2
|
|
350
|
-
* - Segment 1, local 1 -> -3
|
|
351
|
-
*/
|
|
352
|
-
const getSegmentVNodeRefId = (segmentId, localIndex) => {
|
|
353
|
-
const segmentIndex = parseInt(segmentId, 10) - 1;
|
|
354
|
-
const diagonal = segmentIndex + localIndex;
|
|
355
|
-
return -((diagonal * (diagonal + 1)) / 2 + localIndex + 1);
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
function escapeHTML(html) {
|
|
359
|
-
let escapedHTML = '';
|
|
360
|
-
const length = html.length;
|
|
361
|
-
let idx = 0;
|
|
362
|
-
let lastIdx = idx;
|
|
363
|
-
for (; idx < length; idx++) {
|
|
364
|
-
// We get the charCode NOT string. String would allocate memory.
|
|
365
|
-
const ch = html.charCodeAt(idx);
|
|
366
|
-
// Every time we concat a string we allocate memory. We want to minimize that.
|
|
367
|
-
if (ch === 60 /* < */) {
|
|
368
|
-
escapedHTML += html.substring(lastIdx, idx) + '<';
|
|
369
|
-
}
|
|
370
|
-
else if (ch === 62 /* > */) {
|
|
371
|
-
escapedHTML += html.substring(lastIdx, idx) + '>';
|
|
372
|
-
}
|
|
373
|
-
else if (ch === 38 /* & */) {
|
|
374
|
-
escapedHTML += html.substring(lastIdx, idx) + '&';
|
|
375
|
-
}
|
|
376
|
-
else if (ch === 34 /* " */) {
|
|
377
|
-
escapedHTML += html.substring(lastIdx, idx) + '"';
|
|
378
|
-
}
|
|
379
|
-
else if (ch === 39 /* ' */) {
|
|
380
|
-
escapedHTML += html.substring(lastIdx, idx) + ''';
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
lastIdx = idx + 1;
|
|
386
|
-
}
|
|
387
|
-
if (lastIdx === 0) {
|
|
388
|
-
// This is most common case, just return previous string no memory allocation.
|
|
389
|
-
return html;
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
// Add the tail of replacement.
|
|
393
|
-
return escapedHTML + html.substring(lastIdx);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function decodeVNodeDataString(str) {
|
|
397
|
-
let result = '';
|
|
398
|
-
for (let i = 0; i < str.length; i++) {
|
|
399
|
-
if (str.charAt(i) === '\\' && i + 1 < str.length) {
|
|
400
|
-
result += str.charAt(i + 1);
|
|
401
|
-
i++;
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
result += str.charAt(i);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return result;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
195
|
/** State factory of the component. */
|
|
411
196
|
const OnRenderProp = 'q:renderFn';
|
|
412
197
|
const QComponentHash = 'q:componentHash';
|
|
@@ -462,6 +247,8 @@ const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
|
462
247
|
const XML_NS = 'http://www.w3.org/XML/1998/namespace';
|
|
463
248
|
const RenderEvent = 'qRender';
|
|
464
249
|
const TaskEvent = 'qTask';
|
|
250
|
+
/** Scoped qvisible listener attribute; the qwik loader observes elements carrying it. */
|
|
251
|
+
const QVisibleAttr = 'q-e:qvisible';
|
|
465
252
|
/** `<q:slot name="...">` */
|
|
466
253
|
const QDefaultSlot = '';
|
|
467
254
|
/**
|
|
@@ -475,6 +262,7 @@ const QDefaultSlot = '';
|
|
|
475
262
|
const ELEMENT_ID = 'q:id';
|
|
476
263
|
const ELEMENT_KEY = 'q:key';
|
|
477
264
|
const ELEMENT_PROPS = 'q:props';
|
|
265
|
+
const USE_ON_PLACEHOLDER_KEY = ':useOn';
|
|
478
266
|
/** @internal */
|
|
479
267
|
const ELEMENT_SEQ = 'q:seq';
|
|
480
268
|
const ELEMENT_SEQ_IDX = 'q:seqIdx';
|
|
@@ -492,399 +280,6 @@ const dangerouslySetInnerHTML = 'dangerouslySetInnerHTML';
|
|
|
492
280
|
const qwikInspectorAttr = 'data-qwik-inspector';
|
|
493
281
|
const debugStyleScopeIdPrefixAttr = '__scopedStyleIdPrefix__';
|
|
494
282
|
|
|
495
|
-
const MAX_RETRY_ON_PROMISE_COUNT = 100;
|
|
496
|
-
const isPromise = (value) => {
|
|
497
|
-
try {
|
|
498
|
-
// not using "value instanceof Promise" to have zone.js support
|
|
499
|
-
return !!value && typeof value == 'object' && typeof value.then === 'function';
|
|
500
|
-
}
|
|
501
|
-
catch {
|
|
502
|
-
return false;
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
const safeCall = (call, thenFn, rejectFn) => {
|
|
506
|
-
try {
|
|
507
|
-
const result = call();
|
|
508
|
-
if (isPromise(result)) {
|
|
509
|
-
return result.then(thenFn, rejectFn);
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
return thenFn(result);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
catch (e) {
|
|
516
|
-
return rejectFn(e);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
const maybeThen = (valueOrPromise, thenFn) => {
|
|
520
|
-
return isPromise(valueOrPromise)
|
|
521
|
-
? valueOrPromise.then(thenFn)
|
|
522
|
-
: thenFn(valueOrPromise);
|
|
523
|
-
};
|
|
524
|
-
/** @internal */
|
|
525
|
-
const delay = (timeout) => {
|
|
526
|
-
return new Promise((resolve) => {
|
|
527
|
-
setTimeout(resolve, timeout);
|
|
528
|
-
});
|
|
529
|
-
};
|
|
530
|
-
const checkError = (e) => {
|
|
531
|
-
try {
|
|
532
|
-
if (isServer && e instanceof ReferenceError && e.message.includes('window')) {
|
|
533
|
-
e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
catch {
|
|
537
|
-
// ignore
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
const justThrow = (e) => {
|
|
541
|
-
throw e;
|
|
542
|
-
};
|
|
543
|
-
/**
|
|
544
|
-
* Retries a function that throws a promise. If you pass `onError`, you're responsible for handling
|
|
545
|
-
* errors.
|
|
546
|
-
*
|
|
547
|
-
* @internal
|
|
548
|
-
*/
|
|
549
|
-
function retryOnPromise(fn, onError = justThrow) {
|
|
550
|
-
let ok = false;
|
|
551
|
-
let result;
|
|
552
|
-
try {
|
|
553
|
-
result = fn();
|
|
554
|
-
ok = true;
|
|
555
|
-
}
|
|
556
|
-
catch (e) {
|
|
557
|
-
result = e;
|
|
558
|
-
}
|
|
559
|
-
if (!isPromise(result)) {
|
|
560
|
-
// Synchronous function or error, no need to retry
|
|
561
|
-
if (ok) {
|
|
562
|
-
return result;
|
|
563
|
-
}
|
|
564
|
-
isDev && checkError(result);
|
|
565
|
-
return onError(result);
|
|
566
|
-
}
|
|
567
|
-
let retryCount = MAX_RETRY_ON_PROMISE_COUNT;
|
|
568
|
-
const retry = async (p) => {
|
|
569
|
-
while (isPromise(p)) {
|
|
570
|
-
try {
|
|
571
|
-
await p;
|
|
572
|
-
// We waited for the thrown promise, now try again
|
|
573
|
-
return await fn();
|
|
574
|
-
}
|
|
575
|
-
catch (err) {
|
|
576
|
-
if (isPromise(err)) {
|
|
577
|
-
if (!--retryCount) {
|
|
578
|
-
p = new Error('Exceeded max retry count in retryOnPromise');
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
p = err;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
else {
|
|
586
|
-
p = err;
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
isDev && checkError(p);
|
|
592
|
-
return onError(p);
|
|
593
|
-
};
|
|
594
|
-
return ok ? result.catch(retry) : retry(result);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
const styleContent = (styleId) => {
|
|
598
|
-
return ComponentStylesPrefixContent + styleId;
|
|
599
|
-
};
|
|
600
|
-
function isClassAttr(key) {
|
|
601
|
-
return key === 'class';
|
|
602
|
-
}
|
|
603
|
-
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
604
|
-
return scopedStyleIds?.split(' ') ?? null;
|
|
605
|
-
}
|
|
606
|
-
function convertStyleIdsToString(scopedStyleIds) {
|
|
607
|
-
return Array.from(scopedStyleIds).join(' ');
|
|
608
|
-
}
|
|
609
|
-
const addComponentStylePrefix = (styleId) => {
|
|
610
|
-
if (styleId) {
|
|
611
|
-
let idx = 0;
|
|
612
|
-
do {
|
|
613
|
-
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
614
|
-
} while ((idx = styleId.indexOf(' ', idx) + 1) !== 0);
|
|
615
|
-
}
|
|
616
|
-
return styleId || null;
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Think of `-` as an escape character which makes the next character uppercase. `--` is just `-`.
|
|
621
|
-
*
|
|
622
|
-
* Rules for JSX property event names starting with `on`:
|
|
623
|
-
*
|
|
624
|
-
* - Are case insensitive: `onClick$` is same `onclick$`
|
|
625
|
-
* - A `--` is `-`: `dbl--click` => `dbl-click`
|
|
626
|
-
* - Become case sensitive if prefixed by `-`: `-Click` is `Click`
|
|
627
|
-
* - A `-` (not at the beginning) makes next character uppercase: `dbl-click` => `dblClick`
|
|
628
|
-
*/
|
|
629
|
-
const EVENT_SUFFIX = '$';
|
|
630
|
-
const DOM_CONTENT_LOADED_EVENT = 'DOMContentLoaded';
|
|
631
|
-
const isHtmlAttributeAnEventName = (name) => {
|
|
632
|
-
return (name.charCodeAt(0) === 113 /* q */ &&
|
|
633
|
-
name.charCodeAt(1) === 45 /* - */ &&
|
|
634
|
-
(name.charCodeAt(3) === 58 /* : */ ||
|
|
635
|
-
(name.charCodeAt(3) === 112 /* p */ && name.charCodeAt(4) === 58)) /* : */);
|
|
636
|
-
};
|
|
637
|
-
function jsxEventToHtmlAttribute(jsxEvent, isPassive = false) {
|
|
638
|
-
if (jsxEvent.endsWith(EVENT_SUFFIX)) {
|
|
639
|
-
const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent, isPassive);
|
|
640
|
-
if (idx !== -1) {
|
|
641
|
-
return prefix + normalizeJsxEventName(jsxEvent.slice(idx, -1));
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
return null; // Return null if not matching expected format
|
|
645
|
-
}
|
|
646
|
-
function createEventName(event, prefix = '') {
|
|
647
|
-
const eventName = fromCamelToKebabCase(event);
|
|
648
|
-
return prefix + eventName;
|
|
649
|
-
}
|
|
650
|
-
function getEventScopeDataFromJsxEvent(eventName, isPassive = false) {
|
|
651
|
-
let prefix;
|
|
652
|
-
let idx = -1;
|
|
653
|
-
// set prefix and idx based on the scope
|
|
654
|
-
if (eventName.startsWith("on" /* EventNameJSXScope.on */)) {
|
|
655
|
-
prefix = isPassive ? "q-ep:" /* EventNameHtmlScope.onPassive */ : "q-e:" /* EventNameHtmlScope.on */;
|
|
656
|
-
idx = 2;
|
|
657
|
-
}
|
|
658
|
-
else if (eventName.startsWith("window:on" /* EventNameJSXScope.window */)) {
|
|
659
|
-
prefix = isPassive ? "q-wp:" /* EventNameHtmlScope.windowPassive */ : "q-w:" /* EventNameHtmlScope.window */;
|
|
660
|
-
idx = 9;
|
|
661
|
-
}
|
|
662
|
-
else if (eventName.startsWith("document:on" /* EventNameJSXScope.document */)) {
|
|
663
|
-
prefix = isPassive ? "q-dp:" /* EventNameHtmlScope.documentPassive */ : "q-d:" /* EventNameHtmlScope.document */;
|
|
664
|
-
idx = 11;
|
|
665
|
-
}
|
|
666
|
-
return [prefix, idx];
|
|
667
|
-
}
|
|
668
|
-
const normalizeJsxEventName = (name) => {
|
|
669
|
-
return name === DOM_CONTENT_LOADED_EVENT
|
|
670
|
-
? '-d-o-m-content-loaded'
|
|
671
|
-
: createEventName(name.charAt(0) === '-'
|
|
672
|
-
? // marker for case sensitive event name
|
|
673
|
-
name.slice(1)
|
|
674
|
-
: name.toLowerCase());
|
|
675
|
-
};
|
|
676
|
-
function isPreventDefault(key) {
|
|
677
|
-
return key.startsWith('preventdefault:');
|
|
678
|
-
}
|
|
679
|
-
/** Converts a camelCase string to kebab-case. This is used for event names. */
|
|
680
|
-
const fromCamelToKebabCase = (text) => {
|
|
681
|
-
return text.replace(/([A-Z-])/g, (a) => '-' + a.toLowerCase());
|
|
682
|
-
};
|
|
683
|
-
/** E.g. `"q-e:click"` => `['e', 'click']`, `"q-ep:click"` => `['ep', 'click']` */
|
|
684
|
-
const getEventDataFromHtmlAttribute = (htmlKey) => {
|
|
685
|
-
const separatorIndex = htmlKey.indexOf(':');
|
|
686
|
-
return [htmlKey.slice(2, separatorIndex), htmlKey.slice(separatorIndex + 1)];
|
|
687
|
-
};
|
|
688
|
-
/** E.g. `"e:click"`, `"w:load"` */
|
|
689
|
-
const getScopedEventName = (scope, eventName) => scope + ':' + eventName;
|
|
690
|
-
|
|
691
|
-
/** CSS properties which accept numbers but are not in units of "px". */
|
|
692
|
-
const unitlessNumbers = new Set([
|
|
693
|
-
'animationIterationCount',
|
|
694
|
-
'aspectRatio',
|
|
695
|
-
'borderImageOutset',
|
|
696
|
-
'borderImageSlice',
|
|
697
|
-
'borderImageWidth',
|
|
698
|
-
'boxFlex',
|
|
699
|
-
'boxFlexGroup',
|
|
700
|
-
'boxOrdinalGroup',
|
|
701
|
-
'columnCount',
|
|
702
|
-
'columns',
|
|
703
|
-
'flex',
|
|
704
|
-
'flexGrow',
|
|
705
|
-
'flexShrink',
|
|
706
|
-
'gridArea',
|
|
707
|
-
'gridRow',
|
|
708
|
-
'gridRowEnd',
|
|
709
|
-
'gridRowStart',
|
|
710
|
-
'gridColumn',
|
|
711
|
-
'gridColumnEnd',
|
|
712
|
-
'gridColumnStart',
|
|
713
|
-
'fontWeight',
|
|
714
|
-
'lineClamp',
|
|
715
|
-
'lineHeight',
|
|
716
|
-
'opacity',
|
|
717
|
-
'order',
|
|
718
|
-
'orphans',
|
|
719
|
-
'scale',
|
|
720
|
-
'tabSize',
|
|
721
|
-
'widows',
|
|
722
|
-
'zIndex',
|
|
723
|
-
'zoom',
|
|
724
|
-
'MozAnimationIterationCount', // Known Prefixed Properties
|
|
725
|
-
'MozBoxFlex', // TODO: Remove these since they shouldn't be used in modern code
|
|
726
|
-
'msFlex',
|
|
727
|
-
'msFlexPositive',
|
|
728
|
-
'WebkitAnimationIterationCount',
|
|
729
|
-
'WebkitBoxFlex',
|
|
730
|
-
'WebkitBoxOrdinalGroup',
|
|
731
|
-
'WebkitColumnCount',
|
|
732
|
-
'WebkitColumns',
|
|
733
|
-
'WebkitFlex',
|
|
734
|
-
'WebkitFlexGrow',
|
|
735
|
-
'WebkitFlexShrink',
|
|
736
|
-
'WebkitLineClamp',
|
|
737
|
-
]);
|
|
738
|
-
const isUnitlessNumber = (name) => {
|
|
739
|
-
return unitlessNumbers.has(name);
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
const hashCode = (text, hash = 0) => {
|
|
743
|
-
for (let i = 0; i < text.length; i++) {
|
|
744
|
-
const chr = text.charCodeAt(i);
|
|
745
|
-
hash = (hash << 5) - hash + chr;
|
|
746
|
-
hash |= 0; // Convert to 32bit integer
|
|
747
|
-
}
|
|
748
|
-
return Number(Math.abs(hash)).toString(36);
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
const serializeClass = (obj) => {
|
|
752
|
-
if (!obj) {
|
|
753
|
-
return '';
|
|
754
|
-
}
|
|
755
|
-
if (isString(obj)) {
|
|
756
|
-
return obj.trim();
|
|
757
|
-
}
|
|
758
|
-
const classes = [];
|
|
759
|
-
if (isArray(obj)) {
|
|
760
|
-
for (let i = 0; i < obj.length; i++) {
|
|
761
|
-
const o = obj[i];
|
|
762
|
-
const classList = serializeClass(o);
|
|
763
|
-
if (classList) {
|
|
764
|
-
classes.push(classList);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
else {
|
|
769
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
770
|
-
if (value) {
|
|
771
|
-
classes.push(key.trim());
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
return classes.join(' ');
|
|
776
|
-
};
|
|
777
|
-
// Unlike fromCamelToKebabCase, this leaves `-` so that `background-color` stays `background-color`
|
|
778
|
-
const fromCamelToKebabCaseWithDash = (text) => {
|
|
779
|
-
return text.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
780
|
-
};
|
|
781
|
-
const stringifyStyle = (obj) => {
|
|
782
|
-
if (obj == null) {
|
|
783
|
-
return '';
|
|
784
|
-
}
|
|
785
|
-
if (typeof obj == 'object') {
|
|
786
|
-
if (isArray(obj)) {
|
|
787
|
-
throw qError(0 /* QError.stringifyClassOrStyle */, [obj, 'style']);
|
|
788
|
-
}
|
|
789
|
-
else {
|
|
790
|
-
const chunks = [];
|
|
791
|
-
for (const key in obj) {
|
|
792
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
793
|
-
const value = obj[key];
|
|
794
|
-
if (value != null && typeof value !== 'function') {
|
|
795
|
-
if (key.startsWith('--')) {
|
|
796
|
-
chunks.push(key + ':' + value);
|
|
797
|
-
}
|
|
798
|
-
else {
|
|
799
|
-
chunks.push(fromCamelToKebabCaseWithDash(key) + ':' + setValueForStyle(key, value));
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return chunks.join(';');
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
return String(obj);
|
|
808
|
-
};
|
|
809
|
-
const serializeBooleanOrNumberAttribute = (value) => {
|
|
810
|
-
return value != null ? String(value) : null;
|
|
811
|
-
};
|
|
812
|
-
function serializeAttribute(key, value, styleScopedId) {
|
|
813
|
-
if (isClassAttr(key)) {
|
|
814
|
-
const serializedClass = serializeClass(value);
|
|
815
|
-
value = styleScopedId
|
|
816
|
-
? styleScopedId + (serializedClass.length ? ' ' + serializedClass : serializedClass)
|
|
817
|
-
: serializedClass;
|
|
818
|
-
}
|
|
819
|
-
else if (key === 'style') {
|
|
820
|
-
value = stringifyStyle(value);
|
|
821
|
-
}
|
|
822
|
-
else if (isEnumeratedBooleanAttribute(key) || typeof value === 'number') {
|
|
823
|
-
// aria attrs, tabindex etc.
|
|
824
|
-
value = serializeBooleanOrNumberAttribute(value);
|
|
825
|
-
}
|
|
826
|
-
else if (value === false || value == null) {
|
|
827
|
-
value = null;
|
|
828
|
-
}
|
|
829
|
-
else if (value === true && isPreventDefault(key)) {
|
|
830
|
-
value = '';
|
|
831
|
-
}
|
|
832
|
-
return value;
|
|
833
|
-
}
|
|
834
|
-
function isEnumeratedBooleanAttribute(key) {
|
|
835
|
-
return isAriaAttribute(key) || ['spellcheck', 'draggable', 'contenteditable'].includes(key);
|
|
836
|
-
}
|
|
837
|
-
const setValueForStyle = (styleName, value) => {
|
|
838
|
-
if (typeof value === 'number' && value !== 0 && !isUnitlessNumber(styleName)) {
|
|
839
|
-
return value + 'px';
|
|
840
|
-
}
|
|
841
|
-
return value;
|
|
842
|
-
};
|
|
843
|
-
function isAriaAttribute(prop) {
|
|
844
|
-
return prop.startsWith('aria-');
|
|
845
|
-
}
|
|
846
|
-
const styleKey = (qStyles, index) => {
|
|
847
|
-
assertQrl(qStyles);
|
|
848
|
-
return `${hashCode(qStyles.$hash$)}-${index}`;
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Creates a function that schedules `fn` to run as a microtask. Microtasks run before browser
|
|
853
|
-
* paint, preventing flickering.
|
|
854
|
-
*/
|
|
855
|
-
const createMicroTask = (fn) => {
|
|
856
|
-
return () => queueMicrotask(fn);
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* Creates a function that schedules `fn` to run as a macrotask. Macrotasks yield to the browser,
|
|
860
|
-
* allowing paint and user input. Used for time-slicing to avoid blocking the main thread.
|
|
861
|
-
*/
|
|
862
|
-
const createMacroTask = (fn) => {
|
|
863
|
-
let macroTask;
|
|
864
|
-
if (typeof MessageChannel !== 'undefined') {
|
|
865
|
-
const channel = new MessageChannel();
|
|
866
|
-
let active = true;
|
|
867
|
-
channel.port1.onmessage = () => fn();
|
|
868
|
-
macroTask = () => {
|
|
869
|
-
if (active) {
|
|
870
|
-
channel.port2.postMessage(null);
|
|
871
|
-
}
|
|
872
|
-
};
|
|
873
|
-
macroTask.$destroy$ = () => {
|
|
874
|
-
if (active) {
|
|
875
|
-
active = false;
|
|
876
|
-
channel.port1.onmessage = null;
|
|
877
|
-
channel.port1.close();
|
|
878
|
-
channel.port2.close();
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
else {
|
|
883
|
-
macroTask = () => setTimeout(fn);
|
|
884
|
-
}
|
|
885
|
-
return macroTask;
|
|
886
|
-
};
|
|
887
|
-
|
|
888
283
|
// keep this import from core/build so the cjs build works
|
|
889
284
|
const createPlatform = () => {
|
|
890
285
|
return {
|
|
@@ -985,303 +380,101 @@ const isServerPlatform = () => {
|
|
|
985
380
|
return false;
|
|
986
381
|
};
|
|
987
382
|
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
};
|
|
995
|
-
// Determine which rel attribute to use based on browser support
|
|
996
|
-
const rel = isBrowser && doc.createElement('link').relList?.supports?.('modulepreload')
|
|
997
|
-
? 'modulePreload'
|
|
998
|
-
: 'preload';
|
|
999
|
-
const isJSRegex = /\.[mc]?js$/;
|
|
1000
|
-
const yieldInterval = 10;
|
|
1001
|
-
|
|
1002
|
-
const BundleImportState_None = 0;
|
|
1003
|
-
const BundleImportState_Preload = 2;
|
|
1004
|
-
const BundleImportState_Alias = 3;
|
|
1005
|
-
const BundleImportState_Loaded = 4;
|
|
1006
|
-
|
|
1007
|
-
let base;
|
|
1008
|
-
const makeBundle = (name, deps) => {
|
|
1009
|
-
return {
|
|
1010
|
-
$name$: name,
|
|
1011
|
-
$state$: isJSRegex.test(name) ? BundleImportState_None : BundleImportState_Alias,
|
|
1012
|
-
$deps$: deps,
|
|
1013
|
-
$inverseProbability$: 1,
|
|
1014
|
-
$createdTs$: performance.now(),
|
|
1015
|
-
$waitedMs$: 0,
|
|
1016
|
-
$loadedMs$: 0,
|
|
1017
|
-
};
|
|
1018
|
-
};
|
|
1019
|
-
const getBundle = (name) => {
|
|
1020
|
-
let bundle = bundles.get(name);
|
|
1021
|
-
if (!bundle) {
|
|
1022
|
-
let deps;
|
|
1023
|
-
bundle = makeBundle(name, deps);
|
|
1024
|
-
bundles.set(name, bundle);
|
|
1025
|
-
}
|
|
1026
|
-
return bundle;
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
const bundles = new Map();
|
|
1030
|
-
let preloadCount = 0;
|
|
1031
|
-
const queue = [];
|
|
1032
|
-
const nextTriggerMacroTask = createMacroTask(trigger);
|
|
1033
|
-
const nextAdjustmentMacroTask = createMacroTask(processPendingAdjustments);
|
|
1034
|
-
let isTriggerScheduled = false;
|
|
1035
|
-
let isAdjustmentScheduled = false;
|
|
1036
|
-
let isProcessingAdjustments = false;
|
|
1037
|
-
const adjustmentStack = [];
|
|
1038
|
-
/**
|
|
1039
|
-
* This is called when a bundle is queued, or finished loading.
|
|
1040
|
-
*
|
|
1041
|
-
* Because Chrome doesn't treat new modulepreloads as higher priority, we only make
|
|
1042
|
-
* maxSimultaneousPreloads links available at a time, so that when a new high priority bundle comes
|
|
1043
|
-
* in, it is soon preloaded.
|
|
1044
|
-
*
|
|
1045
|
-
* We make sure to first preload the high priority items.
|
|
1046
|
-
*/
|
|
1047
|
-
function trigger() {
|
|
1048
|
-
isTriggerScheduled = false;
|
|
1049
|
-
if (!queue.length) {
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
const deadline = performance.now() + yieldInterval;
|
|
1053
|
-
let shouldYield = false;
|
|
1054
|
-
while (queue.length) {
|
|
1055
|
-
const bundle = queue[0];
|
|
1056
|
-
const inverseProbability = bundle.$inverseProbability$;
|
|
1057
|
-
const probability = 1 - inverseProbability;
|
|
1058
|
-
// We want to preload all the transitive static (1) and dynamic (0.99) dependencies, throttled by the user defined maxIdlePreloads.
|
|
1059
|
-
if (probability >= 0.99 || preloadCount < config.$maxIdlePreloads$) {
|
|
1060
|
-
queue.shift();
|
|
1061
|
-
preloadOne(bundle);
|
|
1062
|
-
if (performance.now() >= deadline) {
|
|
1063
|
-
shouldYield = true;
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
else {
|
|
1068
|
-
break;
|
|
383
|
+
const ASSERT_DISCLAIMER = 'Internal assert, this is likely caused by a bug in Qwik: ';
|
|
384
|
+
/*@__INLINE__*/
|
|
385
|
+
function assertDefined(value, text, ...parts) {
|
|
386
|
+
if (isDev) {
|
|
387
|
+
if (value != null) {
|
|
388
|
+
return;
|
|
1069
389
|
}
|
|
1070
|
-
|
|
1071
|
-
if (shouldYield && queue.length && !isTriggerScheduled) {
|
|
1072
|
-
isTriggerScheduled = true;
|
|
1073
|
-
nextTriggerMacroTask();
|
|
390
|
+
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
1074
391
|
}
|
|
1075
392
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
$seen$: seen,
|
|
1082
|
-
});
|
|
1083
|
-
};
|
|
1084
|
-
const processAdjustmentFrame = () => {
|
|
1085
|
-
const frame = adjustmentStack[adjustmentStack.length - 1];
|
|
1086
|
-
const bundle = frame.$bundle$;
|
|
1087
|
-
if (frame.$deps$) {
|
|
1088
|
-
const index = frame.$index$;
|
|
1089
|
-
if (index >= frame.$deps$.length) {
|
|
1090
|
-
adjustmentStack.pop();
|
|
1091
|
-
return false;
|
|
1092
|
-
}
|
|
1093
|
-
const dep = frame.$deps$[index];
|
|
1094
|
-
frame.$index$ = index + 1;
|
|
1095
|
-
const depBundle = getBundle(dep.$name$);
|
|
1096
|
-
if (depBundle.$inverseProbability$ === 0) {
|
|
1097
|
-
return true;
|
|
1098
|
-
}
|
|
1099
|
-
const probability = 1 - bundle.$inverseProbability$;
|
|
1100
|
-
let newInverseProbability;
|
|
1101
|
-
if (probability === 1 || probability >= 0.99) {
|
|
1102
|
-
// bundle is requested at max probability, so elevate all its transitive static and dynamic deps to 99% sure
|
|
1103
|
-
newInverseProbability = Math.min(0.01, 1 - dep.$importProbability$);
|
|
393
|
+
/*@__INLINE__*/
|
|
394
|
+
function assertEqual(value1, value2, text, ...parts) {
|
|
395
|
+
if (isDev) {
|
|
396
|
+
if (value1 === value2) {
|
|
397
|
+
return;
|
|
1104
398
|
}
|
|
1105
|
-
|
|
1106
|
-
const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
|
|
1107
|
-
/** We need to undo the previous adjustment */
|
|
1108
|
-
const prevAdjust = dep.$factor$;
|
|
1109
|
-
const factor = newInverseImportProbability / prevAdjust;
|
|
1110
|
-
// limit organic probability to 98%
|
|
1111
|
-
newInverseProbability = Math.max(0.02, depBundle.$inverseProbability$ * factor);
|
|
1112
|
-
dep.$factor$ = factor;
|
|
1113
|
-
}
|
|
1114
|
-
adjustmentStack.push({
|
|
1115
|
-
$bundle$: depBundle,
|
|
1116
|
-
$inverseProbability$: newInverseProbability,
|
|
1117
|
-
$seen$: frame.$seen$,
|
|
1118
|
-
});
|
|
1119
|
-
return true;
|
|
1120
|
-
}
|
|
1121
|
-
if (frame.$seen$?.has(bundle)) {
|
|
1122
|
-
adjustmentStack.pop();
|
|
1123
|
-
return false;
|
|
1124
|
-
}
|
|
1125
|
-
const previousInverseProbability = bundle.$inverseProbability$;
|
|
1126
|
-
bundle.$inverseProbability$ = frame.$inverseProbability$;
|
|
1127
|
-
// Don't propagate tiny changes
|
|
1128
|
-
if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
|
|
1129
|
-
adjustmentStack.pop();
|
|
1130
|
-
return false;
|
|
1131
|
-
}
|
|
1132
|
-
if (bundle.$deps$?.length) {
|
|
1133
|
-
const seen = frame.$seen$ || new Set();
|
|
1134
|
-
seen.add(bundle);
|
|
1135
|
-
frame.$seen$ = seen;
|
|
1136
|
-
frame.$deps$ = bundle.$deps$;
|
|
1137
|
-
frame.$index$ = 0;
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
adjustmentStack.pop();
|
|
1141
|
-
return false;
|
|
1142
|
-
};
|
|
1143
|
-
function processPendingAdjustments() {
|
|
1144
|
-
if (isProcessingAdjustments || !adjustmentStack.length) {
|
|
1145
|
-
return;
|
|
399
|
+
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
1146
400
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
const checkDeadline = processAdjustmentFrame();
|
|
1154
|
-
if (isBrowser && checkDeadline && performance.now() >= deadline) {
|
|
1155
|
-
if (!isAdjustmentScheduled) {
|
|
1156
|
-
isAdjustmentScheduled = true;
|
|
1157
|
-
nextAdjustmentMacroTask();
|
|
1158
|
-
}
|
|
1159
|
-
break;
|
|
401
|
+
}
|
|
402
|
+
/*@__INLINE__*/
|
|
403
|
+
function assertTrue(value1, text, ...parts) {
|
|
404
|
+
if (isDev) {
|
|
405
|
+
if (value1 === true) {
|
|
406
|
+
return;
|
|
1160
407
|
}
|
|
1161
|
-
|
|
1162
|
-
isProcessingAdjustments = false;
|
|
1163
|
-
if (processed && isBrowser) {
|
|
1164
|
-
nextTriggerMacroTask();
|
|
408
|
+
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
1165
409
|
}
|
|
1166
410
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
const start = performance.now();
|
|
1173
|
-
bundle.$waitedMs$ = start - bundle.$createdTs$;
|
|
1174
|
-
bundle.$state$ = BundleImportState_Preload;
|
|
1175
|
-
const link = doc.createElement('link');
|
|
1176
|
-
// Only bundles with state none are js bundles
|
|
1177
|
-
link.href = new URL(`${base}${bundle.$name$}`, doc.baseURI).toString();
|
|
1178
|
-
link.rel = rel;
|
|
1179
|
-
// Needed when rel is 'preload'
|
|
1180
|
-
link.as = 'script';
|
|
1181
|
-
// Handle completion of the preload
|
|
1182
|
-
link.onload = link.onerror = () => {
|
|
1183
|
-
preloadCount--;
|
|
1184
|
-
const end = performance.now();
|
|
1185
|
-
bundle.$loadedMs$ = end - start;
|
|
1186
|
-
bundle.$state$ = BundleImportState_Loaded;
|
|
1187
|
-
// Keep the <head> clean
|
|
1188
|
-
link.remove();
|
|
1189
|
-
// More bundles may be ready to preload
|
|
1190
|
-
nextTriggerMacroTask();
|
|
1191
|
-
};
|
|
1192
|
-
doc.head.appendChild(link);
|
|
1193
|
-
};
|
|
1194
|
-
const handleBundle = (name, inverseProbability) => {
|
|
1195
|
-
const bundle = getBundle(name);
|
|
1196
|
-
if (bundle) {
|
|
1197
|
-
enqueueAdjustment(bundle, inverseProbability);
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1200
|
-
const preload = (item, probability) => {
|
|
1201
|
-
if (!item?.length) {
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
const inverseProbability = 1 - probability ;
|
|
1205
|
-
if (Array.isArray(item)) {
|
|
1206
|
-
// We must process in reverse order to ensure first bundles are handled first
|
|
1207
|
-
for (let i = item.length - 1; i >= 0; i--) {
|
|
1208
|
-
const bundle = item[i];
|
|
1209
|
-
handleBundle(bundle, inverseProbability);
|
|
411
|
+
/*@__INLINE__*/
|
|
412
|
+
function assertFalse(value1, text, ...parts) {
|
|
413
|
+
if (isDev) {
|
|
414
|
+
if (value1 === false) {
|
|
415
|
+
return;
|
|
1210
416
|
}
|
|
417
|
+
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
1211
418
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
if (
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
else {
|
|
1219
|
-
processPendingAdjustments();
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
if (isBrowser) {
|
|
1223
|
-
// Get early hints from qwikloader
|
|
1224
|
-
document.addEventListener('qsymbol', (ev) => {
|
|
1225
|
-
const { symbol, href } = ev.detail;
|
|
1226
|
-
// the qrl class doesn't emit href, we don't need to preload
|
|
1227
|
-
if (href) {
|
|
1228
|
-
const hash = symbol.slice(symbol.lastIndexOf('_') + 1);
|
|
1229
|
-
preload(hash, 1);
|
|
419
|
+
}
|
|
420
|
+
/*@__INLINE__*/
|
|
421
|
+
function assertNumber(value1, text, ...parts) {
|
|
422
|
+
if (isDev) {
|
|
423
|
+
if (typeof value1 === 'number') {
|
|
424
|
+
return;
|
|
1230
425
|
}
|
|
1231
|
-
|
|
426
|
+
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
|
|
427
|
+
}
|
|
1232
428
|
}
|
|
1233
429
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
430
|
+
/** @internal */
|
|
431
|
+
const mapApp_findIndx = (array, key, start) => {
|
|
432
|
+
isDev && assertTrue(start % 2 === 0, 'Expecting even number.');
|
|
433
|
+
let bottom = start >> 1;
|
|
434
|
+
let top = (array.length - 2) >> 1;
|
|
435
|
+
while (bottom <= top) {
|
|
436
|
+
const mid = bottom + ((top - bottom) >> 1);
|
|
437
|
+
const midKey = array[mid << 1];
|
|
438
|
+
if (midKey === key) {
|
|
439
|
+
return mid << 1;
|
|
440
|
+
}
|
|
441
|
+
if (midKey < key) {
|
|
442
|
+
bottom = mid + 1;
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
top = mid - 1;
|
|
1238
446
|
}
|
|
1239
447
|
}
|
|
1240
|
-
return
|
|
448
|
+
return (bottom << 1) ^ -1;
|
|
1241
449
|
};
|
|
1242
|
-
|
|
1243
450
|
/** @internal */
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
451
|
+
const mapArray_set = (array, key, value, start, allowNullValue = false) => {
|
|
452
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
453
|
+
if (indx >= 0) {
|
|
454
|
+
if (value == null && !allowNullValue) {
|
|
455
|
+
array.splice(indx, 2);
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
array[indx + 1] = value;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else if (value != null || allowNullValue) {
|
|
462
|
+
array.splice(indx ^ -1, 0, key, value);
|
|
1248
463
|
}
|
|
1249
|
-
return text;
|
|
1250
464
|
};
|
|
1251
465
|
/** @internal */
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
return writeStringRootRefPath(this, path);
|
|
1265
|
-
},
|
|
1266
|
-
writeRootRefDelta(id, base) {
|
|
1267
|
-
return writeStringRootRefDelta(this, id, base);
|
|
1268
|
-
},
|
|
1269
|
-
});
|
|
1270
|
-
|
|
1271
|
-
// Pre-allocated common strings to reduce allocation overhead
|
|
1272
|
-
const CLOSE_TAG = '</';
|
|
1273
|
-
const ESCAPED_CLOSE_TAG = '<\\/';
|
|
1274
|
-
const QUOTE = '"';
|
|
1275
|
-
const BRACKET_OPEN = '[';
|
|
1276
|
-
const BRACKET_CLOSE = ']';
|
|
1277
|
-
const COMMA = ',';
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
* QWIK_VERSION
|
|
1281
|
-
*
|
|
1282
|
-
* @public
|
|
1283
|
-
*/
|
|
1284
|
-
const version = "2.0.0-beta.42-dev+3473a49";
|
|
466
|
+
const mapArray_get = (array, key, start) => {
|
|
467
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
468
|
+
if (indx >= 0) {
|
|
469
|
+
return array[indx + 1];
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
const mapArray_has = (array, key, start) => {
|
|
476
|
+
return mapApp_findIndx(array, key, start) >= 0;
|
|
477
|
+
};
|
|
1285
478
|
|
|
1286
479
|
const isNode = (value) => {
|
|
1287
480
|
return value && typeof value.nodeType === 'number';
|
|
@@ -1293,6 +486,108 @@ const isElement$1 = (value) => {
|
|
|
1293
486
|
return value.nodeType === 1;
|
|
1294
487
|
};
|
|
1295
488
|
|
|
489
|
+
const MAX_RETRY_ON_PROMISE_COUNT = 100;
|
|
490
|
+
const isPromise = (value) => {
|
|
491
|
+
try {
|
|
492
|
+
// not using "value instanceof Promise" to have zone.js support
|
|
493
|
+
return !!value && typeof value == 'object' && typeof value.then === 'function';
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const safeCall = (call, thenFn, rejectFn) => {
|
|
500
|
+
try {
|
|
501
|
+
const result = call();
|
|
502
|
+
if (isPromise(result)) {
|
|
503
|
+
return result.then(thenFn, rejectFn);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
return thenFn(result);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
catch (e) {
|
|
510
|
+
return rejectFn(e);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
const maybeThen = (valueOrPromise, thenFn) => {
|
|
514
|
+
return isPromise(valueOrPromise)
|
|
515
|
+
? valueOrPromise.then(thenFn)
|
|
516
|
+
: thenFn(valueOrPromise);
|
|
517
|
+
};
|
|
518
|
+
/** @internal */
|
|
519
|
+
const delay = (timeout) => {
|
|
520
|
+
return new Promise((resolve) => {
|
|
521
|
+
setTimeout(resolve, timeout);
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
const checkError = (e) => {
|
|
525
|
+
try {
|
|
526
|
+
if (isServer && e instanceof ReferenceError && e.message.includes('window')) {
|
|
527
|
+
e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
// ignore
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
const justThrow = (e) => {
|
|
535
|
+
throw e;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Retries a function that throws a promise. If you pass `onError`, you're responsible for handling
|
|
539
|
+
* errors.
|
|
540
|
+
*
|
|
541
|
+
* @internal
|
|
542
|
+
*/
|
|
543
|
+
function retryOnPromise(fn, onError = justThrow) {
|
|
544
|
+
let ok = false;
|
|
545
|
+
let result;
|
|
546
|
+
try {
|
|
547
|
+
result = fn();
|
|
548
|
+
ok = true;
|
|
549
|
+
}
|
|
550
|
+
catch (e) {
|
|
551
|
+
result = e;
|
|
552
|
+
}
|
|
553
|
+
if (!isPromise(result)) {
|
|
554
|
+
// Synchronous function or error, no need to retry
|
|
555
|
+
if (ok) {
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
isDev && checkError(result);
|
|
559
|
+
return onError(result);
|
|
560
|
+
}
|
|
561
|
+
let retryCount = MAX_RETRY_ON_PROMISE_COUNT;
|
|
562
|
+
const retry = async (p) => {
|
|
563
|
+
while (isPromise(p)) {
|
|
564
|
+
try {
|
|
565
|
+
await p;
|
|
566
|
+
// We waited for the thrown promise, now try again
|
|
567
|
+
return await fn();
|
|
568
|
+
}
|
|
569
|
+
catch (err) {
|
|
570
|
+
if (isPromise(err)) {
|
|
571
|
+
if (!--retryCount) {
|
|
572
|
+
p = new Error('Exceeded max retry count in retryOnPromise');
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
p = err;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
p = err;
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
isDev && checkError(p);
|
|
586
|
+
return onError(p);
|
|
587
|
+
};
|
|
588
|
+
return ok ? result.catch(retry) : retry(result);
|
|
589
|
+
}
|
|
590
|
+
|
|
1296
591
|
/** @internal */
|
|
1297
592
|
const getRootContainer = (container) => {
|
|
1298
593
|
const rootContainer = container.$rootContainer$;
|
|
@@ -1314,6 +609,80 @@ class BackRef {
|
|
|
1314
609
|
[_EFFECT_BACK_REF] = undefined;
|
|
1315
610
|
}
|
|
1316
611
|
|
|
612
|
+
/**
|
|
613
|
+
* A friendly name tag for a VirtualVNode.
|
|
614
|
+
*
|
|
615
|
+
* Theses are used to give a name to a VirtualVNode. This is useful for debugging and testing.
|
|
616
|
+
*
|
|
617
|
+
* The name is only added in development mode and is not included in production builds.
|
|
618
|
+
*/
|
|
619
|
+
const DEBUG_TYPE = 'q:type';
|
|
620
|
+
const VirtualTypeName = {
|
|
621
|
+
["V" /* VirtualType.Virtual */]: /* ********* */ 'Virtual', //
|
|
622
|
+
["F" /* VirtualType.Fragment */]: /* ******** */ 'Fragment', //
|
|
623
|
+
["S" /* VirtualType.WrappedSignal */]: /* *** */ 'Signal', //
|
|
624
|
+
["A" /* VirtualType.Awaited */]: /* ********* */ 'Awaited', //
|
|
625
|
+
["C" /* VirtualType.Component */]: /* ******* */ 'Component', //
|
|
626
|
+
["I" /* VirtualType.InlineComponent */]: /* * */ 'InlineComponent', //
|
|
627
|
+
["P" /* VirtualType.Projection */]: /* ****** */ 'Projection', //
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* @file
|
|
632
|
+
*
|
|
633
|
+
* VNodeData is additional information which allows the `vnode` to recover virtual VNode information
|
|
634
|
+
* from the HTML.
|
|
635
|
+
*/
|
|
636
|
+
/**
|
|
637
|
+
* VNodeDataSeparator contains information about splitting up the VNodeData and attaching it to the
|
|
638
|
+
* HTML.
|
|
639
|
+
*/
|
|
640
|
+
const VNodeDataSeparator = {
|
|
641
|
+
REFERENCE: /* ******** */ 126, // `~` is a reference to the node. Save it.
|
|
642
|
+
ADVANCE_1: /* ********* */ 33, // `!` is vNodeData separator skipping 0. (ie next vNode)
|
|
643
|
+
ADVANCE_8192: /* ****** */ 46, // `.` is vNodeData separator skipping 4096.
|
|
644
|
+
};
|
|
645
|
+
/**
|
|
646
|
+
* VNodeDataChar contains information about the VNodeData used for encoding props.
|
|
647
|
+
*
|
|
648
|
+
* Available character ranges: 59 - 64, 91 - 94, 96, 123 - 126
|
|
649
|
+
*/
|
|
650
|
+
const VNodeDataChar = {
|
|
651
|
+
OPEN: /* ************** */ 123, // `{` is the start of the VNodeData for a virtual element.
|
|
652
|
+
CLOSE: /* ************* */ 125, // `}` is the end of the VNodeData for a virtual element.
|
|
653
|
+
SCOPED_STYLE: /* ******* */ 59, // `;` - `q:sstyle` - Style attribute.
|
|
654
|
+
RENDER_FN: /* ********** */ 60, // `<` - `q:renderFn' - Component QRL render function (body)
|
|
655
|
+
RENDER_HASH_PREFIX: /* **/ 95, // `_` after `<` identifies a component hash.
|
|
656
|
+
ID: /* ***************** */ 61, // `=` - `q:id` - ID of the element.
|
|
657
|
+
PROPS: /* ************** */ 62, // `>` - `q:props' - Component Props
|
|
658
|
+
SLOT_PARENT: /* ******** */ 63, // `?` - `q:sparent` - Slot parent.
|
|
659
|
+
KEY: /* **************** */ 64, // `@` - `q:key` - Element key.
|
|
660
|
+
SEQ: /* **************** */ 91, // `[` - `q:seq' - Seq value from `useSequentialScope()`
|
|
661
|
+
CONTEXT: /* ************ */ 93, // `]` - `q:ctx' - Component context/props
|
|
662
|
+
SEQ_IDX: /* ************ */ 94, // `^` - `q:seqIdx' - Sequential scope id
|
|
663
|
+
BACK_REFS: /* ********** */ 96, // '`' - `q:brefs' - Effect dependencies/subscriptions
|
|
664
|
+
SEPARATOR: /* ********* */ 124, // `|` - Separator char to encode any key/value pairs.
|
|
665
|
+
SLOT: /* ************** */ 126};
|
|
666
|
+
/**
|
|
667
|
+
* Convert a segment-local vnode index into a key for the root container's shared qVNodeRefs map.
|
|
668
|
+
*
|
|
669
|
+
* Out-of-order Suspense segments each start counting vnode refs from 0, but the client merges all
|
|
670
|
+
* segment refs into one root-level map. This uses a Cantor-style pairing function for the
|
|
671
|
+
* zero-based pair `(segmentIndex, localIndex)`, then makes it negative so segment refs cannot
|
|
672
|
+
* collide with root refs, which are non-negative.
|
|
673
|
+
*
|
|
674
|
+
* Examples:
|
|
675
|
+
*
|
|
676
|
+
* - Segment 1, local 0 -> -1
|
|
677
|
+
* - Segment 2, local 0 -> -2
|
|
678
|
+
* - Segment 1, local 1 -> -3
|
|
679
|
+
*/
|
|
680
|
+
const getSegmentVNodeRefId = (segmentId, localIndex) => {
|
|
681
|
+
const segmentIndex = parseInt(segmentId, 10) - 1;
|
|
682
|
+
const diagonal = segmentIndex + localIndex;
|
|
683
|
+
return -((diagonal * (diagonal + 1)) / 2 + localIndex + 1);
|
|
684
|
+
};
|
|
685
|
+
|
|
1317
686
|
const isForeignObjectElement = (elementName) => {
|
|
1318
687
|
return isDev ? elementName.toLowerCase() === 'foreignobject' : elementName === 'foreignObject';
|
|
1319
688
|
};
|
|
@@ -1506,37 +875,109 @@ function isMath(tagOrVNode) {
|
|
|
1506
875
|
if (typeof tagOrVNode === 'string') {
|
|
1507
876
|
return isMathElement(tagOrVNode);
|
|
1508
877
|
}
|
|
1509
|
-
if (vnode_isElementVNode(tagOrVNode)) {
|
|
1510
|
-
return (isMathElement(vnode_getElementName(tagOrVNode)) ||
|
|
1511
|
-
(tagOrVNode.flags & 1024 /* VNodeFlags.NS_math */) !== 0);
|
|
878
|
+
if (vnode_isElementVNode(tagOrVNode)) {
|
|
879
|
+
return (isMathElement(vnode_getElementName(tagOrVNode)) ||
|
|
880
|
+
(tagOrVNode.flags & 1024 /* VNodeFlags.NS_math */) !== 0);
|
|
881
|
+
}
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
function getAttributeNamespace(attributeName) {
|
|
885
|
+
switch (attributeName) {
|
|
886
|
+
case 'xlink:href':
|
|
887
|
+
case 'xlink:actuate':
|
|
888
|
+
case 'xlink:arcrole':
|
|
889
|
+
case 'xlink:role':
|
|
890
|
+
case 'xlink:show':
|
|
891
|
+
case 'xlink:title':
|
|
892
|
+
case 'xlink:type':
|
|
893
|
+
return XLINK_NS;
|
|
894
|
+
case 'xml:base':
|
|
895
|
+
case 'xml:lang':
|
|
896
|
+
case 'xml:space':
|
|
897
|
+
return XML_NS;
|
|
898
|
+
default:
|
|
899
|
+
return null;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const mergeMaps = (map1, map2) => {
|
|
904
|
+
for (const [k, v] of map2) {
|
|
905
|
+
map1.set(k, v);
|
|
906
|
+
}
|
|
907
|
+
return map1;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Think of `-` as an escape character which makes the next character uppercase. `--` is just `-`.
|
|
912
|
+
*
|
|
913
|
+
* Rules for JSX property event names starting with `on`:
|
|
914
|
+
*
|
|
915
|
+
* - Are case insensitive: `onClick$` is same `onclick$`
|
|
916
|
+
* - A `--` is `-`: `dbl--click` => `dbl-click`
|
|
917
|
+
* - Become case sensitive if prefixed by `-`: `-Click` is `Click`
|
|
918
|
+
* - A `-` (not at the beginning) makes next character uppercase: `dbl-click` => `dblClick`
|
|
919
|
+
*/
|
|
920
|
+
const EVENT_SUFFIX = '$';
|
|
921
|
+
const DOM_CONTENT_LOADED_EVENT = 'DOMContentLoaded';
|
|
922
|
+
const isHtmlAttributeAnEventName = (name) => {
|
|
923
|
+
return (name.charCodeAt(0) === 113 /* q */ &&
|
|
924
|
+
name.charCodeAt(1) === 45 /* - */ &&
|
|
925
|
+
(name.charCodeAt(3) === 58 /* : */ ||
|
|
926
|
+
(name.charCodeAt(3) === 112 /* p */ && name.charCodeAt(4) === 58)) /* : */);
|
|
927
|
+
};
|
|
928
|
+
function jsxEventToHtmlAttribute(jsxEvent, isPassive = false) {
|
|
929
|
+
if (jsxEvent.endsWith(EVENT_SUFFIX)) {
|
|
930
|
+
const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent, isPassive);
|
|
931
|
+
if (idx !== -1) {
|
|
932
|
+
return prefix + normalizeJsxEventName(jsxEvent.slice(idx, -1));
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
return null; // Return null if not matching expected format
|
|
936
|
+
}
|
|
937
|
+
function createEventName(event, prefix = '') {
|
|
938
|
+
const eventName = fromCamelToKebabCase(event);
|
|
939
|
+
return prefix + eventName;
|
|
940
|
+
}
|
|
941
|
+
function getEventScopeDataFromJsxEvent(eventName, isPassive = false) {
|
|
942
|
+
let prefix;
|
|
943
|
+
let idx = -1;
|
|
944
|
+
// set prefix and idx based on the scope
|
|
945
|
+
if (eventName.startsWith("on" /* EventNameJSXScope.on */)) {
|
|
946
|
+
prefix = isPassive ? "q-ep:" /* EventNameHtmlScope.onPassive */ : "q-e:" /* EventNameHtmlScope.on */;
|
|
947
|
+
idx = 2;
|
|
948
|
+
}
|
|
949
|
+
else if (eventName.startsWith("window:on" /* EventNameJSXScope.window */)) {
|
|
950
|
+
prefix = isPassive ? "q-wp:" /* EventNameHtmlScope.windowPassive */ : "q-w:" /* EventNameHtmlScope.window */;
|
|
951
|
+
idx = 9;
|
|
1512
952
|
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
switch (attributeName) {
|
|
1517
|
-
case 'xlink:href':
|
|
1518
|
-
case 'xlink:actuate':
|
|
1519
|
-
case 'xlink:arcrole':
|
|
1520
|
-
case 'xlink:role':
|
|
1521
|
-
case 'xlink:show':
|
|
1522
|
-
case 'xlink:title':
|
|
1523
|
-
case 'xlink:type':
|
|
1524
|
-
return XLINK_NS;
|
|
1525
|
-
case 'xml:base':
|
|
1526
|
-
case 'xml:lang':
|
|
1527
|
-
case 'xml:space':
|
|
1528
|
-
return XML_NS;
|
|
1529
|
-
default:
|
|
1530
|
-
return null;
|
|
953
|
+
else if (eventName.startsWith("document:on" /* EventNameJSXScope.document */)) {
|
|
954
|
+
prefix = isPassive ? "q-dp:" /* EventNameHtmlScope.documentPassive */ : "q-d:" /* EventNameHtmlScope.document */;
|
|
955
|
+
idx = 11;
|
|
1531
956
|
}
|
|
957
|
+
return [prefix, idx];
|
|
1532
958
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
959
|
+
const normalizeJsxEventName = (name) => {
|
|
960
|
+
return name === DOM_CONTENT_LOADED_EVENT
|
|
961
|
+
? '-d-o-m-content-loaded'
|
|
962
|
+
: createEventName(name.charAt(0) === '-'
|
|
963
|
+
? // marker for case sensitive event name
|
|
964
|
+
name.slice(1)
|
|
965
|
+
: name.toLowerCase());
|
|
966
|
+
};
|
|
967
|
+
function isPreventDefault(key) {
|
|
968
|
+
return key.startsWith('preventdefault:');
|
|
969
|
+
}
|
|
970
|
+
/** Converts a camelCase string to kebab-case. This is used for event names. */
|
|
971
|
+
const fromCamelToKebabCase = (text) => {
|
|
972
|
+
return text.replace(/([A-Z-])/g, (a) => '-' + a.toLowerCase());
|
|
973
|
+
};
|
|
974
|
+
/** E.g. `"q-e:click"` => `['e', 'click']`, `"q-ep:click"` => `['ep', 'click']` */
|
|
975
|
+
const getEventDataFromHtmlAttribute = (htmlKey) => {
|
|
976
|
+
const separatorIndex = htmlKey.indexOf(':');
|
|
977
|
+
return [htmlKey.slice(2, separatorIndex), htmlKey.slice(separatorIndex + 1)];
|
|
1539
978
|
};
|
|
979
|
+
/** E.g. `"e:click"`, `"w:load"` */
|
|
980
|
+
const getScopedEventName = (scope, eventName) => scope + ':' + eventName;
|
|
1540
981
|
|
|
1541
982
|
/** @internal */
|
|
1542
983
|
class VNode {
|
|
@@ -1724,6 +1165,24 @@ const NODE_DIFF_DATA_KEY = ':nodeDiff';
|
|
|
1724
1165
|
const ERROR_DATA_KEY = ':errorData';
|
|
1725
1166
|
const HOST_SIGNAL = ':signal';
|
|
1726
1167
|
const INLINE_COMPONENT_DATA_KEY = ':inlineComponentData';
|
|
1168
|
+
/** Qwik loader events to (re)register once the cursor's journal is flushed to the DOM. */
|
|
1169
|
+
const pendingQwikLoaderEvents = new WeakMap();
|
|
1170
|
+
function queueQwikLoaderEvent(cursorData, eventName) {
|
|
1171
|
+
let loaderEvents = pendingQwikLoaderEvents.get(cursorData);
|
|
1172
|
+
if (!loaderEvents) {
|
|
1173
|
+
pendingQwikLoaderEvents.set(cursorData, (loaderEvents = []));
|
|
1174
|
+
}
|
|
1175
|
+
if (!loaderEvents.includes(eventName)) {
|
|
1176
|
+
loaderEvents.push(eventName);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
function getPendingQwikLoaderEvents(cursorData) {
|
|
1180
|
+
const loaderEvents = pendingQwikLoaderEvents.get(cursorData);
|
|
1181
|
+
if (loaderEvents) {
|
|
1182
|
+
pendingQwikLoaderEvents.delete(cursorData);
|
|
1183
|
+
}
|
|
1184
|
+
return loaderEvents;
|
|
1185
|
+
}
|
|
1727
1186
|
/**
|
|
1728
1187
|
* Sets the cursor position in a cursor vNode.
|
|
1729
1188
|
*
|
|
@@ -1761,6 +1220,13 @@ function mergeCursorData(newCursorData, oldCursorData) {
|
|
|
1761
1220
|
newCursorData.afterFlushTasks = oldAfterFlushTasks;
|
|
1762
1221
|
}
|
|
1763
1222
|
}
|
|
1223
|
+
// merge qwik loader event notifications
|
|
1224
|
+
const oldLoaderEvents = getPendingQwikLoaderEvents(oldCursorData);
|
|
1225
|
+
if (oldLoaderEvents) {
|
|
1226
|
+
for (let i = 0; i < oldLoaderEvents.length; i++) {
|
|
1227
|
+
queueQwikLoaderEvent(newCursorData, oldLoaderEvents[i]);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1764
1230
|
// merge extra promises
|
|
1765
1231
|
const oldExtraPromises = oldCursorData.extraPromises;
|
|
1766
1232
|
if (oldExtraPromises && oldExtraPromises.length > 0) {
|
|
@@ -2323,10 +1789,23 @@ class Job {
|
|
|
2323
1789
|
}
|
|
2324
1790
|
}
|
|
2325
1791
|
get track() {
|
|
2326
|
-
|
|
1792
|
+
if (!this.$track$) {
|
|
1793
|
+
const track = trackFn(this.$signal$, this.$signal$.$container$);
|
|
1794
|
+
this.$track$ = (obj, prop) => {
|
|
1795
|
+
if (this.$signal$.$disposed$) {
|
|
1796
|
+
throw qError(39 /* QError.computedSignalDisposed */);
|
|
1797
|
+
}
|
|
1798
|
+
return track(obj, prop);
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
return this.$track$;
|
|
2327
1802
|
}
|
|
2328
1803
|
get abortSignal() {
|
|
2329
|
-
|
|
1804
|
+
const controller = (this.$abortController$ ||= new AbortController());
|
|
1805
|
+
if (this.$cleanupRequested$) {
|
|
1806
|
+
controller.abort();
|
|
1807
|
+
}
|
|
1808
|
+
return controller.signal;
|
|
2330
1809
|
}
|
|
2331
1810
|
/** Backward compatible cache method for resource */
|
|
2332
1811
|
cache() {
|
|
@@ -2339,11 +1818,12 @@ class Job {
|
|
|
2339
1818
|
return val;
|
|
2340
1819
|
}
|
|
2341
1820
|
}
|
|
2342
|
-
cleanup
|
|
1821
|
+
// Arrow property so the compute function can destructure `cleanup` from the context.
|
|
1822
|
+
cleanup = (callback) => {
|
|
2343
1823
|
if (typeof callback === 'function') {
|
|
2344
1824
|
(this.$cleanups$ ||= []).push(callback);
|
|
2345
1825
|
}
|
|
2346
|
-
}
|
|
1826
|
+
};
|
|
2347
1827
|
}
|
|
2348
1828
|
/**
|
|
2349
1829
|
* A signal which is computed from other signals.
|
|
@@ -2405,6 +1885,9 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2405
1885
|
this.invalidate();
|
|
2406
1886
|
}
|
|
2407
1887
|
invalidate(info) {
|
|
1888
|
+
if (this.$disposed$) {
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
2408
1891
|
if (arguments.length > 0) {
|
|
2409
1892
|
this.$info$ = info;
|
|
2410
1893
|
this.$infoVersion$ = this.$infoVersion$ === undefined ? 1 : this.$infoVersion$ + 1;
|
|
@@ -2579,6 +2062,9 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2579
2062
|
return this.$untrackedError$;
|
|
2580
2063
|
}
|
|
2581
2064
|
$setInvalid$(allowRecalc) {
|
|
2065
|
+
if (this.$disposed$) {
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2582
2068
|
this.$flags$ |= 1 /* ComputedSignalFlags.INVALID */;
|
|
2583
2069
|
if (allowRecalc &&
|
|
2584
2070
|
(this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size)) {
|
|
@@ -2597,7 +2083,7 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2597
2083
|
if (!(this.$flags$ & 32 /* AsyncSignalFlags.EAGER_CLEANUP */) || this.$hasSubscribers$()) {
|
|
2598
2084
|
return;
|
|
2599
2085
|
}
|
|
2600
|
-
if (!(qTest ? !isServerPlatform() : isBrowser
|
|
2086
|
+
if (!(qTest ? !isServerPlatform() : isBrowser)) {
|
|
2601
2087
|
return;
|
|
2602
2088
|
}
|
|
2603
2089
|
setTimeout(() => {
|
|
@@ -2608,7 +2094,7 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2608
2094
|
}
|
|
2609
2095
|
/** Returns a promise resolves when the signal finished computing. */
|
|
2610
2096
|
async promise() {
|
|
2611
|
-
this.$computeIfNeeded$();
|
|
2097
|
+
await retryOnPromise(() => this.$computeIfNeeded$());
|
|
2612
2098
|
// Wait for the current computation to finish, but if we became invalid while running, we need to wait for the new computation instead. So we loop until we are no longer invalid
|
|
2613
2099
|
while (this.$current$?.$promise$) {
|
|
2614
2100
|
await this.$current$?.$promise$;
|
|
@@ -2616,7 +2102,7 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2616
2102
|
}
|
|
2617
2103
|
/** Run the computation if needed */
|
|
2618
2104
|
$computeIfNeeded$() {
|
|
2619
|
-
if (!(this.$flags$ & 1 /* ComputedSignalFlags.INVALID */)) {
|
|
2105
|
+
if (this.$disposed$ || !(this.$flags$ & 1 /* ComputedSignalFlags.INVALID */)) {
|
|
2620
2106
|
return;
|
|
2621
2107
|
}
|
|
2622
2108
|
if (this.$flags$ & 512 /* AsyncSignalFlags.ASYNC_MODE */) {
|
|
@@ -2676,6 +2162,9 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2676
2162
|
* instead; after the first await they must use the explicit track() too.
|
|
2677
2163
|
*/
|
|
2678
2164
|
$invokeComputeFn$(fn, job) {
|
|
2165
|
+
if (this.$disposed$) {
|
|
2166
|
+
throw qError(39 /* QError.computedSignalDisposed */);
|
|
2167
|
+
}
|
|
2679
2168
|
const computeFn = fn;
|
|
2680
2169
|
if (this.$flags$ & 1024 /* AsyncSignalFlags.CTX_ARG */) {
|
|
2681
2170
|
// Strip the ambient effect subscriber: these compute fns track only via their track()
|
|
@@ -2734,7 +2223,7 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2734
2223
|
// subscribers know the value isn't ready yet.
|
|
2735
2224
|
this.untrackedPending = true;
|
|
2736
2225
|
fn = await this.$computeQrl$.resolve();
|
|
2737
|
-
if (running.$abortController$?.signal.aborted) {
|
|
2226
|
+
if (this.$disposed$ || running.$abortController$?.signal.aborted) {
|
|
2738
2227
|
running.$promise$ = null;
|
|
2739
2228
|
return;
|
|
2740
2229
|
}
|
|
@@ -2795,7 +2284,7 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2795
2284
|
running.$promise$ = null;
|
|
2796
2285
|
this.$setError$(running, err);
|
|
2797
2286
|
}
|
|
2798
|
-
if (isCurrent()) {
|
|
2287
|
+
if (isCurrent() && !this.$disposed$) {
|
|
2799
2288
|
clearTimeout(this.$computationTimeoutId$);
|
|
2800
2289
|
if (running.$infoVersion$ === this.$infoVersion$) {
|
|
2801
2290
|
this.$info$ = undefined;
|
|
@@ -2826,7 +2315,27 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
2826
2315
|
// Job failures should be rare and require retrying
|
|
2827
2316
|
this.untrackedValue = NEEDS_COMPUTATION;
|
|
2828
2317
|
}
|
|
2829
|
-
/**
|
|
2318
|
+
/** Permanently stop computations; keep this cross-package name stable. */
|
|
2319
|
+
$dispose() {
|
|
2320
|
+
if (this.$disposed$) {
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
this.$disposed$ = true;
|
|
2324
|
+
this.$flags$ &= -2 /* ComputedSignalFlags.INVALID */;
|
|
2325
|
+
clearTimeout(this.$computationTimeoutId$);
|
|
2326
|
+
if (this.$container$) {
|
|
2327
|
+
clearAllEffects(this.$container$, this);
|
|
2328
|
+
}
|
|
2329
|
+
const jobs = new Set(this.$jobs$);
|
|
2330
|
+
if (this.$current$) {
|
|
2331
|
+
jobs.add(this.$current$);
|
|
2332
|
+
}
|
|
2333
|
+
for (const job of jobs) {
|
|
2334
|
+
job.$canWrite$ = false;
|
|
2335
|
+
this.$requestCleanups$(job);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
/** Clean computations after SSR while preserving dependencies for serialization. */
|
|
2830
2339
|
async $destroy$() {
|
|
2831
2340
|
clearTimeout(this.$computationTimeoutId$);
|
|
2832
2341
|
const current = this.$current$;
|
|
@@ -3051,9 +2560,9 @@ const createSignal = createSignal$1;
|
|
|
3051
2560
|
*
|
|
3052
2561
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
3053
2562
|
* effects. Every synchronous signal or store read is tracked automatically; reads after the first
|
|
3054
|
-
* `await` must use the `track()` provided on the context argument. When the function is async,
|
|
3055
|
-
*
|
|
3056
|
-
*
|
|
2563
|
+
* `await` must use the `track()` provided on the context argument. When the function is async,
|
|
2564
|
+
* reading an unresolved `.value` throws the computation promise, and reading a failed `.value`
|
|
2565
|
+
* throws the error.
|
|
3057
2566
|
*
|
|
3058
2567
|
* @public
|
|
3059
2568
|
*/
|
|
@@ -3231,6 +2740,15 @@ class SubscriptionData {
|
|
|
3231
2740
|
}
|
|
3232
2741
|
}
|
|
3233
2742
|
|
|
2743
|
+
const isObjectEmpty = (obj) => {
|
|
2744
|
+
for (const key in obj) {
|
|
2745
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2746
|
+
return false;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
return true;
|
|
2750
|
+
};
|
|
2751
|
+
|
|
3234
2752
|
const _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
3235
2753
|
// TODO store props as the arrays the vnodes also use?
|
|
3236
2754
|
class JSXNodeImpl {
|
|
@@ -3779,6 +3297,58 @@ function directSetAttribute(element, attrName, attrValue, isSvg) {
|
|
|
3779
3297
|
}
|
|
3780
3298
|
}
|
|
3781
3299
|
|
|
3300
|
+
function escapeHTML(html) {
|
|
3301
|
+
let escapedHTML = '';
|
|
3302
|
+
const length = html.length;
|
|
3303
|
+
let idx = 0;
|
|
3304
|
+
let lastIdx = idx;
|
|
3305
|
+
for (; idx < length; idx++) {
|
|
3306
|
+
// We get the charCode NOT string. String would allocate memory.
|
|
3307
|
+
const ch = html.charCodeAt(idx);
|
|
3308
|
+
// Every time we concat a string we allocate memory. We want to minimize that.
|
|
3309
|
+
if (ch === 60 /* < */) {
|
|
3310
|
+
escapedHTML += html.substring(lastIdx, idx) + '<';
|
|
3311
|
+
}
|
|
3312
|
+
else if (ch === 62 /* > */) {
|
|
3313
|
+
escapedHTML += html.substring(lastIdx, idx) + '>';
|
|
3314
|
+
}
|
|
3315
|
+
else if (ch === 38 /* & */) {
|
|
3316
|
+
escapedHTML += html.substring(lastIdx, idx) + '&';
|
|
3317
|
+
}
|
|
3318
|
+
else if (ch === 34 /* " */) {
|
|
3319
|
+
escapedHTML += html.substring(lastIdx, idx) + '"';
|
|
3320
|
+
}
|
|
3321
|
+
else if (ch === 39 /* ' */) {
|
|
3322
|
+
escapedHTML += html.substring(lastIdx, idx) + ''';
|
|
3323
|
+
}
|
|
3324
|
+
else {
|
|
3325
|
+
continue;
|
|
3326
|
+
}
|
|
3327
|
+
lastIdx = idx + 1;
|
|
3328
|
+
}
|
|
3329
|
+
if (lastIdx === 0) {
|
|
3330
|
+
// This is most common case, just return previous string no memory allocation.
|
|
3331
|
+
return html;
|
|
3332
|
+
}
|
|
3333
|
+
else {
|
|
3334
|
+
// Add the tail of replacement.
|
|
3335
|
+
return escapedHTML + html.substring(lastIdx);
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
function decodeVNodeDataString(str) {
|
|
3339
|
+
let result = '';
|
|
3340
|
+
for (let i = 0; i < str.length; i++) {
|
|
3341
|
+
if (str.charAt(i) === '\\' && i + 1 < str.length) {
|
|
3342
|
+
result += str.charAt(i + 1);
|
|
3343
|
+
i++;
|
|
3344
|
+
}
|
|
3345
|
+
else {
|
|
3346
|
+
result += str.charAt(i);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
return result;
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3782
3352
|
function getFileLocationFromJsx(jsxDev) {
|
|
3783
3353
|
if (!jsxDev) {
|
|
3784
3354
|
return null;
|
|
@@ -3831,37 +3401,219 @@ const _restProps = (props, omit = [], target = {}) => {
|
|
|
3831
3401
|
});
|
|
3832
3402
|
}
|
|
3833
3403
|
}
|
|
3834
|
-
return target;
|
|
3404
|
+
return target;
|
|
3405
|
+
}
|
|
3406
|
+
let constPropsTarget = null;
|
|
3407
|
+
const constProps = props[_CONST_PROPS];
|
|
3408
|
+
if (constProps) {
|
|
3409
|
+
for (const key in constProps) {
|
|
3410
|
+
if (!omit.includes(key)) {
|
|
3411
|
+
constPropsTarget ||= {};
|
|
3412
|
+
constPropsTarget[key] = constProps[key];
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
const varPropsTarget = target;
|
|
3417
|
+
const varProps = props[_VAR_PROPS];
|
|
3418
|
+
for (const key in varProps) {
|
|
3419
|
+
if (!omit.includes(key)) {
|
|
3420
|
+
varPropsTarget[key] = varProps[key];
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
return createPropsProxy(new JSXNodeImpl(null, varPropsTarget, constPropsTarget, null, 0, null));
|
|
3424
|
+
};
|
|
3425
|
+
function resolveSlotName(host, jsx, container) {
|
|
3426
|
+
const constProps = jsx.constProps;
|
|
3427
|
+
if (constProps && typeof constProps == 'object' && _hasOwnProperty$1.call(constProps, 'name')) {
|
|
3428
|
+
const constValue = constProps.name;
|
|
3429
|
+
if (host && constValue instanceof WrappedSignalImpl) {
|
|
3430
|
+
return trackSignalAndAssignHost(constValue, host, ":" /* EffectProperty.COMPONENT */, container);
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
return directGetPropsProxyProp(jsx, 'name') || QDefaultSlot;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
const styleContent = (styleId) => {
|
|
3437
|
+
return ComponentStylesPrefixContent + styleId;
|
|
3438
|
+
};
|
|
3439
|
+
function isClassAttr(key) {
|
|
3440
|
+
return key === 'class';
|
|
3441
|
+
}
|
|
3442
|
+
function convertScopedStyleIdsToArray(scopedStyleIds) {
|
|
3443
|
+
return scopedStyleIds?.split(' ') ?? null;
|
|
3444
|
+
}
|
|
3445
|
+
function convertStyleIdsToString(scopedStyleIds) {
|
|
3446
|
+
return Array.from(scopedStyleIds).join(' ');
|
|
3447
|
+
}
|
|
3448
|
+
const addComponentStylePrefix = (styleId) => {
|
|
3449
|
+
if (styleId) {
|
|
3450
|
+
let idx = 0;
|
|
3451
|
+
do {
|
|
3452
|
+
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
3453
|
+
} while ((idx = styleId.indexOf(' ', idx) + 1) !== 0);
|
|
3454
|
+
}
|
|
3455
|
+
return styleId || null;
|
|
3456
|
+
};
|
|
3457
|
+
|
|
3458
|
+
/** CSS properties which accept numbers but are not in units of "px". */
|
|
3459
|
+
const unitlessNumbers = new Set([
|
|
3460
|
+
'animationIterationCount',
|
|
3461
|
+
'aspectRatio',
|
|
3462
|
+
'borderImageOutset',
|
|
3463
|
+
'borderImageSlice',
|
|
3464
|
+
'borderImageWidth',
|
|
3465
|
+
'boxFlex',
|
|
3466
|
+
'boxFlexGroup',
|
|
3467
|
+
'boxOrdinalGroup',
|
|
3468
|
+
'columnCount',
|
|
3469
|
+
'columns',
|
|
3470
|
+
'flex',
|
|
3471
|
+
'flexGrow',
|
|
3472
|
+
'flexShrink',
|
|
3473
|
+
'gridArea',
|
|
3474
|
+
'gridRow',
|
|
3475
|
+
'gridRowEnd',
|
|
3476
|
+
'gridRowStart',
|
|
3477
|
+
'gridColumn',
|
|
3478
|
+
'gridColumnEnd',
|
|
3479
|
+
'gridColumnStart',
|
|
3480
|
+
'fontWeight',
|
|
3481
|
+
'lineClamp',
|
|
3482
|
+
'lineHeight',
|
|
3483
|
+
'opacity',
|
|
3484
|
+
'order',
|
|
3485
|
+
'orphans',
|
|
3486
|
+
'scale',
|
|
3487
|
+
'tabSize',
|
|
3488
|
+
'widows',
|
|
3489
|
+
'zIndex',
|
|
3490
|
+
'zoom',
|
|
3491
|
+
'MozAnimationIterationCount', // Known Prefixed Properties
|
|
3492
|
+
'MozBoxFlex', // TODO: Remove these since they shouldn't be used in modern code
|
|
3493
|
+
'msFlex',
|
|
3494
|
+
'msFlexPositive',
|
|
3495
|
+
'WebkitAnimationIterationCount',
|
|
3496
|
+
'WebkitBoxFlex',
|
|
3497
|
+
'WebkitBoxOrdinalGroup',
|
|
3498
|
+
'WebkitColumnCount',
|
|
3499
|
+
'WebkitColumns',
|
|
3500
|
+
'WebkitFlex',
|
|
3501
|
+
'WebkitFlexGrow',
|
|
3502
|
+
'WebkitFlexShrink',
|
|
3503
|
+
'WebkitLineClamp',
|
|
3504
|
+
]);
|
|
3505
|
+
const isUnitlessNumber = (name) => {
|
|
3506
|
+
return unitlessNumbers.has(name);
|
|
3507
|
+
};
|
|
3508
|
+
|
|
3509
|
+
const hashCode = (text, hash = 0) => {
|
|
3510
|
+
for (let i = 0; i < text.length; i++) {
|
|
3511
|
+
const chr = text.charCodeAt(i);
|
|
3512
|
+
hash = (hash << 5) - hash + chr;
|
|
3513
|
+
hash |= 0; // Convert to 32bit integer
|
|
3514
|
+
}
|
|
3515
|
+
return Number(Math.abs(hash)).toString(36);
|
|
3516
|
+
};
|
|
3517
|
+
|
|
3518
|
+
const serializeClass = (obj) => {
|
|
3519
|
+
if (!obj) {
|
|
3520
|
+
return '';
|
|
3521
|
+
}
|
|
3522
|
+
if (isString(obj)) {
|
|
3523
|
+
return obj.trim();
|
|
3524
|
+
}
|
|
3525
|
+
const classes = [];
|
|
3526
|
+
if (isArray(obj)) {
|
|
3527
|
+
for (let i = 0; i < obj.length; i++) {
|
|
3528
|
+
const o = obj[i];
|
|
3529
|
+
const classList = serializeClass(o);
|
|
3530
|
+
if (classList) {
|
|
3531
|
+
classes.push(classList);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3835
3534
|
}
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
if (!omit.includes(key)) {
|
|
3841
|
-
constPropsTarget ||= {};
|
|
3842
|
-
constPropsTarget[key] = constProps[key];
|
|
3535
|
+
else {
|
|
3536
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
3537
|
+
if (value) {
|
|
3538
|
+
classes.push(key.trim());
|
|
3843
3539
|
}
|
|
3844
3540
|
}
|
|
3845
3541
|
}
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3542
|
+
return classes.join(' ');
|
|
3543
|
+
};
|
|
3544
|
+
// Unlike fromCamelToKebabCase, this leaves `-` so that `background-color` stays `background-color`
|
|
3545
|
+
const fromCamelToKebabCaseWithDash = (text) => {
|
|
3546
|
+
return text.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
3547
|
+
};
|
|
3548
|
+
const stringifyStyle = (obj) => {
|
|
3549
|
+
if (obj == null) {
|
|
3550
|
+
return '';
|
|
3551
|
+
}
|
|
3552
|
+
if (typeof obj == 'object') {
|
|
3553
|
+
if (isArray(obj)) {
|
|
3554
|
+
throw qError(0 /* QError.stringifyClassOrStyle */, [obj, 'style']);
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
const chunks = [];
|
|
3558
|
+
for (const key in obj) {
|
|
3559
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
3560
|
+
const value = obj[key];
|
|
3561
|
+
if (value != null && typeof value !== 'function') {
|
|
3562
|
+
if (key.startsWith('--')) {
|
|
3563
|
+
chunks.push(key + ':' + value);
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
chunks.push(fromCamelToKebabCaseWithDash(key) + ':' + setValueForStyle(key, value));
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
return chunks.join(';');
|
|
3851
3572
|
}
|
|
3852
3573
|
}
|
|
3853
|
-
return
|
|
3574
|
+
return String(obj);
|
|
3854
3575
|
};
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3576
|
+
const serializeBooleanOrNumberAttribute = (value) => {
|
|
3577
|
+
return value != null ? String(value) : null;
|
|
3578
|
+
};
|
|
3579
|
+
function serializeAttribute(key, value, styleScopedId) {
|
|
3580
|
+
if (isClassAttr(key)) {
|
|
3581
|
+
const serializedClass = serializeClass(value);
|
|
3582
|
+
value = styleScopedId
|
|
3583
|
+
? styleScopedId + (serializedClass.length ? ' ' + serializedClass : serializedClass)
|
|
3584
|
+
: serializedClass;
|
|
3862
3585
|
}
|
|
3863
|
-
|
|
3586
|
+
else if (key === 'style') {
|
|
3587
|
+
value = stringifyStyle(value);
|
|
3588
|
+
}
|
|
3589
|
+
else if (isEnumeratedBooleanAttribute(key) || typeof value === 'number') {
|
|
3590
|
+
// aria attrs, tabindex etc.
|
|
3591
|
+
value = serializeBooleanOrNumberAttribute(value);
|
|
3592
|
+
}
|
|
3593
|
+
else if (value === false || value == null) {
|
|
3594
|
+
value = null;
|
|
3595
|
+
}
|
|
3596
|
+
else if (value === true && isPreventDefault(key)) {
|
|
3597
|
+
value = '';
|
|
3598
|
+
}
|
|
3599
|
+
return value;
|
|
3600
|
+
}
|
|
3601
|
+
function isEnumeratedBooleanAttribute(key) {
|
|
3602
|
+
return isAriaAttribute(key) || ['spellcheck', 'draggable', 'contenteditable'].includes(key);
|
|
3603
|
+
}
|
|
3604
|
+
const setValueForStyle = (styleName, value) => {
|
|
3605
|
+
if (typeof value === 'number' && value !== 0 && !isUnitlessNumber(styleName)) {
|
|
3606
|
+
return value + 'px';
|
|
3607
|
+
}
|
|
3608
|
+
return value;
|
|
3609
|
+
};
|
|
3610
|
+
function isAriaAttribute(prop) {
|
|
3611
|
+
return prop.startsWith('aria-');
|
|
3864
3612
|
}
|
|
3613
|
+
const styleKey = (qStyles, index) => {
|
|
3614
|
+
assertQrl(qStyles);
|
|
3615
|
+
return `${hashCode(qStyles.$hash$)}-${index}`;
|
|
3616
|
+
};
|
|
3865
3617
|
|
|
3866
3618
|
class DeleteOperation {
|
|
3867
3619
|
target;
|
|
@@ -4891,12 +4643,21 @@ function registerEventHandlers(key, value, element, vnode, diffContext) {
|
|
|
4891
4643
|
else if (value) {
|
|
4892
4644
|
(element._qDispatch ||= {})[scopedKebabName] = runEventHandlerQRL.bind(null, value);
|
|
4893
4645
|
}
|
|
4894
|
-
|
|
4646
|
+
const isQVisible = scopedKebabName === "e:qvisible" /* QwikLoaderScanEvent.qvisible */;
|
|
4647
|
+
// window, document and qvisible events need attrs so qwik loader can find them
|
|
4895
4648
|
// TODO only do these when not already present
|
|
4896
|
-
if (key.charAt(2) !== 'e') {
|
|
4649
|
+
if (key.charAt(2) !== 'e' || isQVisible) {
|
|
4897
4650
|
vnode_setAttr(diffContext.$journal$, vnode, key, '');
|
|
4898
4651
|
}
|
|
4899
|
-
|
|
4652
|
+
if (isQVisible ||
|
|
4653
|
+
scopedKebabName === "d:qinit" /* QwikLoaderScanEvent.qinit */ ||
|
|
4654
|
+
scopedKebabName === "d:qidle" /* QwikLoaderScanEvent.qidle */) {
|
|
4655
|
+
// the loader scans the DOM for these, so notify it only after the flush
|
|
4656
|
+
queueQwikLoaderEvent(getCursorData(diffContext.$cursor$), scopedKebabName);
|
|
4657
|
+
}
|
|
4658
|
+
else {
|
|
4659
|
+
registerQwikLoaderEvent(diffContext.$container$, scopedKebabName);
|
|
4660
|
+
}
|
|
4900
4661
|
}
|
|
4901
4662
|
function createElementWithNamespace(diffContext, elementName) {
|
|
4902
4663
|
const domParentVNode = vnode_getDomParentVNode(diffContext.$vParent$, true);
|
|
@@ -5027,14 +4788,6 @@ const patchProperty = (diffContext, vnode, key, value, currentFile) => {
|
|
|
5027
4788
|
}
|
|
5028
4789
|
setAttribute(diffContext.$journal$, vnode, key, value, diffContext.$scopedStyleIdPrefix$, originalValue);
|
|
5029
4790
|
};
|
|
5030
|
-
function registerQwikLoaderEvent(diffContext, eventName) {
|
|
5031
|
-
const qWindow = qTest
|
|
5032
|
-
? diffContext.$container$.document.defaultView
|
|
5033
|
-
: window;
|
|
5034
|
-
if (qWindow) {
|
|
5035
|
-
(qWindow._qwikEv ||= []).push(eventName);
|
|
5036
|
-
}
|
|
5037
|
-
}
|
|
5038
4791
|
function retrieveChildWithKey(diffContext, nodeName, key) {
|
|
5039
4792
|
let vNodeWithKey = null;
|
|
5040
4793
|
if (diffContext.$vSiblings$ === null) {
|
|
@@ -5430,6 +5183,12 @@ function handleChangedProps(src, dst, propsHandler, container, triggerEffects =
|
|
|
5430
5183
|
}
|
|
5431
5184
|
const newValue = src[key];
|
|
5432
5185
|
const oldValue = dst?.[key];
|
|
5186
|
+
// Every parent render creates an equivalent wrapper, but only the old one has subscribers.
|
|
5187
|
+
// handleProps() swaps the props owner, so keep the subscribed instance or they are orphaned.
|
|
5188
|
+
if (dst && newValue !== oldValue && areDiffValuesEqual(newValue, oldValue)) {
|
|
5189
|
+
src[key] = oldValue;
|
|
5190
|
+
continue;
|
|
5191
|
+
}
|
|
5433
5192
|
if (!dst ||
|
|
5434
5193
|
!(areDiffValuesEqual(newValue, oldValue) || areSignalValuesEqual(newValue, oldValue))) {
|
|
5435
5194
|
if (key === 'class') {
|
|
@@ -5528,24 +5287,29 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
|
|
|
5528
5287
|
const obj = seq[i];
|
|
5529
5288
|
if (isObject(obj)) {
|
|
5530
5289
|
const objIsTask = isTask(obj);
|
|
5531
|
-
if (objIsTask
|
|
5532
|
-
obj
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5290
|
+
if (objIsTask) {
|
|
5291
|
+
clearAllEffects(container, obj);
|
|
5292
|
+
if (obj.$flags$ & 1 /* TaskFlags.VISIBLE_TASK */) {
|
|
5293
|
+
obj.$flags$ |= 16 /* TaskFlags.NEEDS_CLEANUP */;
|
|
5294
|
+
markVNodeDirty(container, vCursor, 128 /* ChoreBits.CLEANUP */, cursorRoot);
|
|
5295
|
+
// don't call cleanupDestroyable yet, do it by the scheduler
|
|
5296
|
+
continue;
|
|
5297
|
+
}
|
|
5298
|
+
cleanupDestroyable(obj);
|
|
5536
5299
|
}
|
|
5537
5300
|
// Stores and plain signals are only producers; their subscriptions are removed
|
|
5538
5301
|
// when cleaning the consumers that read them. They don't own reactive backrefs.
|
|
5539
5302
|
else if (obj instanceof ComputedSignalImpl || obj instanceof WrappedSignalImpl) {
|
|
5540
|
-
if (
|
|
5303
|
+
if (obj.$flags$ & 4 /* ComputedSignalFlags.PRESERVE_ON_SEQ_CLEANUP */) {
|
|
5304
|
+
continue;
|
|
5305
|
+
}
|
|
5306
|
+
if (obj instanceof ComputedSignalImpl) {
|
|
5307
|
+
obj.$dispose();
|
|
5308
|
+
}
|
|
5309
|
+
else {
|
|
5541
5310
|
clearAllEffects(container, obj);
|
|
5542
5311
|
}
|
|
5543
5312
|
}
|
|
5544
|
-
if (objIsTask ||
|
|
5545
|
-
(obj instanceof ComputedSignalImpl &&
|
|
5546
|
-
(obj.$flags$ & 512 /* AsyncSignalFlags.ASYNC_MODE */ || obj.$current$))) {
|
|
5547
|
-
cleanupDestroyable(obj);
|
|
5548
|
-
}
|
|
5549
5313
|
}
|
|
5550
5314
|
}
|
|
5551
5315
|
}
|
|
@@ -5829,7 +5593,6 @@ const executeComponent = (container, renderHost, subscriptionHost, componentQRL,
|
|
|
5829
5593
|
function addUseOnEvents(container, jsx, useOnEvents) {
|
|
5830
5594
|
const jsxElement = findFirstElementNode(jsx);
|
|
5831
5595
|
let jsxResult = jsx;
|
|
5832
|
-
const qVisibleEvent = 'q-e:qvisible';
|
|
5833
5596
|
return maybeThen(jsxElement, (jsxElement) => {
|
|
5834
5597
|
// headless components are components that don't render a real DOM element
|
|
5835
5598
|
const isHeadless = !jsxElement;
|
|
@@ -5841,7 +5604,7 @@ function addUseOnEvents(container, jsx, useOnEvents) {
|
|
|
5841
5604
|
let eventKey = key;
|
|
5842
5605
|
if (isHeadless) {
|
|
5843
5606
|
// if the component is headless, we need to add the event to the placeholder element
|
|
5844
|
-
if (key ===
|
|
5607
|
+
if (key === QVisibleAttr ||
|
|
5845
5608
|
key.startsWith("q-d:" /* EventNameHtmlScope.document */) ||
|
|
5846
5609
|
key.startsWith("q-w:" /* EventNameHtmlScope.window */)) {
|
|
5847
5610
|
if (!placeholderElement) {
|
|
@@ -5870,7 +5633,7 @@ function addUseOnEvents(container, jsx, useOnEvents) {
|
|
|
5870
5633
|
}
|
|
5871
5634
|
}
|
|
5872
5635
|
if (targetElement) {
|
|
5873
|
-
if (targetElement.type === 'script' && key ===
|
|
5636
|
+
if (targetElement.type === 'script' && key === QVisibleAttr) {
|
|
5874
5637
|
eventKey = 'q-d:qinit';
|
|
5875
5638
|
if (isDev) {
|
|
5876
5639
|
const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
|
|
@@ -5988,43 +5751,16 @@ function findFirstElementNode(jsx) {
|
|
|
5988
5751
|
* This is necessary for headless components (components that don't render a real DOM element) to
|
|
5989
5752
|
* have an anchor point for `useOn` event listeners that target the document or window.
|
|
5990
5753
|
*
|
|
5991
|
-
* @param jsx The JSX output
|
|
5754
|
+
* @param jsx The JSX output of the component.
|
|
5992
5755
|
* @param placeholder The placeholder element to inject.
|
|
5993
|
-
* @returns The
|
|
5756
|
+
* @returns The JSX output with the placeholder as its last sibling.
|
|
5994
5757
|
*/
|
|
5995
5758
|
function injectPlaceholderElement(jsx, placeholder) {
|
|
5996
|
-
|
|
5997
|
-
if (isJSXNode(jsx)) {
|
|
5998
|
-
// Inline components may ignore children, while component$ children become projections.
|
|
5999
|
-
if (jsx.type !== Fragment) {
|
|
6000
|
-
return _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null);
|
|
6001
|
-
}
|
|
6002
|
-
if (jsx.children == null) {
|
|
6003
|
-
jsx.children = placeholder;
|
|
6004
|
-
}
|
|
6005
|
-
else if (isArray(jsx.children)) {
|
|
6006
|
-
jsx.children.push(placeholder);
|
|
6007
|
-
}
|
|
6008
|
-
else {
|
|
6009
|
-
jsx.children = [jsx.children, placeholder];
|
|
6010
|
-
}
|
|
6011
|
-
return jsx;
|
|
6012
|
-
}
|
|
6013
|
-
// For primitives, we can't add children, so we wrap them in a fragment.
|
|
6014
|
-
if (isPrimitiveOrNullUndefined(jsx)) {
|
|
6015
|
-
return _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null);
|
|
6016
|
-
}
|
|
6017
|
-
// For an array of nodes, we inject the placeholder into the first element.
|
|
6018
|
-
if (isArray(jsx) && jsx.length > 0) {
|
|
6019
|
-
injectPlaceholderElement(jsx[0], placeholder);
|
|
6020
|
-
return jsx;
|
|
6021
|
-
}
|
|
6022
|
-
// For anything else we do nothing.
|
|
6023
|
-
return jsx;
|
|
5759
|
+
return isArray(jsx) ? [...jsx, placeholder] : [jsx, placeholder];
|
|
6024
5760
|
}
|
|
6025
5761
|
/** @returns An empty <script> element for adding qwik metadata attributes to */
|
|
6026
5762
|
function createPlaceholderScriptNode() {
|
|
6027
|
-
return new JSXNodeImpl('script', null, { hidden: '' }, null, 0,
|
|
5763
|
+
return new JSXNodeImpl('script', null, { hidden: '' }, null, 0, USE_ON_PLACEHOLDER_KEY);
|
|
6028
5764
|
}
|
|
6029
5765
|
|
|
6030
5766
|
function collectChildren(first, last = null) {
|
|
@@ -6388,7 +6124,10 @@ function executeComponentChore(vNode, container, journal, cursor) {
|
|
|
6388
6124
|
* it. We just return the promise and we'll be called again, possibly with updated props, which
|
|
6389
6125
|
* is why we don't clear the dirty bit yet.
|
|
6390
6126
|
*/
|
|
6391
|
-
return componentQRL.resolve()
|
|
6127
|
+
return componentQRL.resolve().catch((error) => {
|
|
6128
|
+
vNode.dirty &= -5 /* ChoreBits.COMPONENT */;
|
|
6129
|
+
throw error;
|
|
6130
|
+
});
|
|
6392
6131
|
}
|
|
6393
6132
|
vNode.dirty &= -5 /* ChoreBits.COMPONENT */;
|
|
6394
6133
|
if (!componentQRL) {
|
|
@@ -6558,6 +6297,9 @@ function executeCompute(vNode, container) {
|
|
|
6558
6297
|
*/
|
|
6559
6298
|
function executeReconcile(vNode, container, journal, cursor) {
|
|
6560
6299
|
vNode.dirty &= -257 /* ChoreBits.RECONCILE */;
|
|
6300
|
+
if (!__EXPERIMENTAL__.each) {
|
|
6301
|
+
return;
|
|
6302
|
+
}
|
|
6561
6303
|
const host = vNode;
|
|
6562
6304
|
const props = container.getHostProp(host, ELEMENT_PROPS) || null;
|
|
6563
6305
|
if (!props) {
|
|
@@ -6590,6 +6332,12 @@ function executeFlushPhase(cursor, container) {
|
|
|
6590
6332
|
_flushJournal(journal);
|
|
6591
6333
|
cursorData.journal = null;
|
|
6592
6334
|
}
|
|
6335
|
+
const loaderEvents = getPendingQwikLoaderEvents(cursorData);
|
|
6336
|
+
if (loaderEvents) {
|
|
6337
|
+
for (let i = 0; i < loaderEvents.length; i++) {
|
|
6338
|
+
registerQwikLoaderEvent(container, loaderEvents[i]);
|
|
6339
|
+
}
|
|
6340
|
+
}
|
|
6593
6341
|
executeAfterFlush(container, cursorData);
|
|
6594
6342
|
}
|
|
6595
6343
|
let _insertBefore = null;
|
|
@@ -6771,6 +6519,43 @@ const parseBoolean = (value) => {
|
|
|
6771
6519
|
return Boolean(value);
|
|
6772
6520
|
};
|
|
6773
6521
|
|
|
6522
|
+
/**
|
|
6523
|
+
* Creates a function that schedules `fn` to run as a microtask. Microtasks run before browser
|
|
6524
|
+
* paint, preventing flickering.
|
|
6525
|
+
*/
|
|
6526
|
+
const createMicroTask = (fn) => {
|
|
6527
|
+
return () => queueMicrotask(fn);
|
|
6528
|
+
};
|
|
6529
|
+
/**
|
|
6530
|
+
* Creates a function that schedules `fn` to run as a macrotask. Macrotasks yield to the browser,
|
|
6531
|
+
* allowing paint and user input. Used for time-slicing to avoid blocking the main thread.
|
|
6532
|
+
*/
|
|
6533
|
+
const createMacroTask = (fn) => {
|
|
6534
|
+
let macroTask;
|
|
6535
|
+
if (typeof MessageChannel !== 'undefined') {
|
|
6536
|
+
const channel = new MessageChannel();
|
|
6537
|
+
let active = true;
|
|
6538
|
+
channel.port1.onmessage = () => fn();
|
|
6539
|
+
macroTask = () => {
|
|
6540
|
+
if (active) {
|
|
6541
|
+
channel.port2.postMessage(null);
|
|
6542
|
+
}
|
|
6543
|
+
};
|
|
6544
|
+
macroTask.$destroy$ = () => {
|
|
6545
|
+
if (active) {
|
|
6546
|
+
active = false;
|
|
6547
|
+
channel.port1.onmessage = null;
|
|
6548
|
+
channel.port1.close();
|
|
6549
|
+
channel.port2.close();
|
|
6550
|
+
}
|
|
6551
|
+
};
|
|
6552
|
+
}
|
|
6553
|
+
else {
|
|
6554
|
+
macroTask = () => setTimeout(fn);
|
|
6555
|
+
}
|
|
6556
|
+
return macroTask;
|
|
6557
|
+
};
|
|
6558
|
+
|
|
6774
6559
|
/**
|
|
6775
6560
|
* @file Cursor walker implementation for cursor-based scheduling.
|
|
6776
6561
|
*
|
|
@@ -7129,11 +6914,12 @@ function findCursor(vNode) {
|
|
|
7129
6914
|
/** @internal */
|
|
7130
6915
|
function _executeSsrChores(container, ssrNode) {
|
|
7131
6916
|
if (!(ssrNode.flags & 1 /* SsrNodeFlags.Updatable */)) {
|
|
6917
|
+
let result = undefined;
|
|
7132
6918
|
if (ssrNode.dirty & 16 /* ChoreBits.NODE_PROPS */) {
|
|
7133
6919
|
executeNodePropChore(container, ssrNode);
|
|
7134
6920
|
}
|
|
7135
6921
|
if (ssrNode.dirty & 32 /* ChoreBits.COMPUTE */) {
|
|
7136
|
-
executeCompute(ssrNode, container);
|
|
6922
|
+
result = executeCompute(ssrNode, container);
|
|
7137
6923
|
}
|
|
7138
6924
|
if (isDev &&
|
|
7139
6925
|
ssrNode.dirty & 1023 /* ChoreBits.DIRTY_MASK */ &&
|
|
@@ -7155,7 +6941,7 @@ function _executeSsrChores(container, ssrNode) {
|
|
|
7155
6941
|
logWarn(warningMessage);
|
|
7156
6942
|
}
|
|
7157
6943
|
ssrNode.dirty &= -1024 /* ChoreBits.DIRTY_MASK */;
|
|
7158
|
-
return;
|
|
6944
|
+
return result;
|
|
7159
6945
|
}
|
|
7160
6946
|
let promise = null;
|
|
7161
6947
|
if (ssrNode.dirty & 1 /* ChoreBits.TASKS */) {
|
|
@@ -7219,6 +7005,9 @@ function executeNodePropChore(container, ssrNode) {
|
|
|
7219
7005
|
}
|
|
7220
7006
|
async function executeReconcileChore(container, ssrNode) {
|
|
7221
7007
|
ssrNode.dirty &= -257 /* ChoreBits.RECONCILE */;
|
|
7008
|
+
if (!__EXPERIMENTAL__.each) {
|
|
7009
|
+
return;
|
|
7010
|
+
}
|
|
7222
7011
|
const host = ssrNode;
|
|
7223
7012
|
const props = container.getHostProp(host, ELEMENT_PROPS) || null;
|
|
7224
7013
|
if (!props) {
|
|
@@ -7707,6 +7496,14 @@ const vnode_setAttr = (journal, vNode, key, value, scopedStyleIdPrefix = null) =
|
|
|
7707
7496
|
addVNodeOperation(journal, createSetAttributeOperation(vNode.node, key, value, scopedStyleIdPrefix, (vNode.flags & 512 /* VNodeFlags.NS_svg */) !== 0));
|
|
7708
7497
|
}
|
|
7709
7498
|
};
|
|
7499
|
+
const registerQwikLoaderEvent = (container, eventName) => {
|
|
7500
|
+
const win = qTest
|
|
7501
|
+
? container.document.defaultView
|
|
7502
|
+
: window;
|
|
7503
|
+
if (win) {
|
|
7504
|
+
(win._qwikEv ||= []).push(eventName);
|
|
7505
|
+
}
|
|
7506
|
+
};
|
|
7710
7507
|
const vnode_ensureElementKeyInflated = (vnode) => {
|
|
7711
7508
|
if (vnode.key) {
|
|
7712
7509
|
return;
|
|
@@ -9364,7 +9161,7 @@ const runTask = (task, container, host) => {
|
|
|
9364
9161
|
if (pendingTask) {
|
|
9365
9162
|
return pendingTask;
|
|
9366
9163
|
}
|
|
9367
|
-
task.$flags$
|
|
9164
|
+
task.$flags$ = (task.$flags$ & -5 /* TaskFlags.DIRTY */) | 64 /* TaskFlags.EXECUTED */;
|
|
9368
9165
|
const handleError = (reason) => {
|
|
9369
9166
|
tagErrorPhase(reason, "hook" /* ErrorBoundaryPhase.Hook */);
|
|
9370
9167
|
container.handleError(reason, host, "hook" /* ErrorBoundaryPhase.Hook */);
|
|
@@ -9385,7 +9182,7 @@ const runTask = (task, container, host) => {
|
|
|
9385
9182
|
task.$taskPromise$ = null;
|
|
9386
9183
|
}
|
|
9387
9184
|
return runTask(task, container, host);
|
|
9388
|
-
});
|
|
9185
|
+
}, handleError);
|
|
9389
9186
|
}
|
|
9390
9187
|
else {
|
|
9391
9188
|
handleError(err);
|
|
@@ -9442,6 +9239,10 @@ function scheduleTask(_event, element) {
|
|
|
9442
9239
|
// An ErrorBoundary tore the host down; the task has nothing left to run against.
|
|
9443
9240
|
return;
|
|
9444
9241
|
}
|
|
9242
|
+
if (task.$flags$ & (4 /* TaskFlags.DIRTY */ | 64 /* TaskFlags.EXECUTED */)) {
|
|
9243
|
+
// the trigger event only performs the initial run
|
|
9244
|
+
return;
|
|
9245
|
+
}
|
|
9445
9246
|
task.$flags$ |= 4 /* TaskFlags.DIRTY */;
|
|
9446
9247
|
markVNodeDirty(container, task.$el$, 1 /* ChoreBits.TASKS */);
|
|
9447
9248
|
});
|
|
@@ -9498,7 +9299,7 @@ const getEffectSerializationContainer = (renderContainer, ownerContainer) => {
|
|
|
9498
9299
|
return ownerContainer;
|
|
9499
9300
|
};
|
|
9500
9301
|
const scheduleEffects = (container, signal, effects) => {
|
|
9501
|
-
const isRunningOnBrowser = qTest ? !isServerPlatform() : isBrowser
|
|
9302
|
+
const isRunningOnBrowser = qTest ? !isServerPlatform() : isBrowser;
|
|
9502
9303
|
if (effects) {
|
|
9503
9304
|
const scheduleEffect = (effectSubscription) => {
|
|
9504
9305
|
const consumer = effectSubscription.consumer;
|
|
@@ -9951,6 +9752,42 @@ function getEffects(target, prop, storeEffects) {
|
|
|
9951
9752
|
return effectsToTrigger;
|
|
9952
9753
|
}
|
|
9953
9754
|
|
|
9755
|
+
/** @internal */
|
|
9756
|
+
const stringifyRootRefPath = (path) => {
|
|
9757
|
+
let text = String(path[0]);
|
|
9758
|
+
for (let i = 1; i < path.length; i++) {
|
|
9759
|
+
text += ' ' + path[i];
|
|
9760
|
+
}
|
|
9761
|
+
return text;
|
|
9762
|
+
};
|
|
9763
|
+
/** @internal */
|
|
9764
|
+
const writeStringRootRef = (writer, id) => writer.write(String(id));
|
|
9765
|
+
/** @internal */
|
|
9766
|
+
const writeStringRootRefPath = (writer, path) => writer.write(stringifyRootRefPath(path));
|
|
9767
|
+
/** @internal */
|
|
9768
|
+
const writeStringRootRefDelta = (writer, id, base) => writer.write(String(id - base));
|
|
9769
|
+
/** @internal */
|
|
9770
|
+
const createStringStreamWriter = (write) => ({
|
|
9771
|
+
write,
|
|
9772
|
+
writeRootRef(id) {
|
|
9773
|
+
return writeStringRootRef(this, id);
|
|
9774
|
+
},
|
|
9775
|
+
writeRootRefPath(path) {
|
|
9776
|
+
return writeStringRootRefPath(this, path);
|
|
9777
|
+
},
|
|
9778
|
+
writeRootRefDelta(id, base) {
|
|
9779
|
+
return writeStringRootRefDelta(this, id, base);
|
|
9780
|
+
},
|
|
9781
|
+
});
|
|
9782
|
+
|
|
9783
|
+
// Pre-allocated common strings to reduce allocation overhead
|
|
9784
|
+
const CLOSE_TAG = '</';
|
|
9785
|
+
const ESCAPED_CLOSE_TAG = '<\\/';
|
|
9786
|
+
const QUOTE = '"';
|
|
9787
|
+
const BRACKET_OPEN = '[';
|
|
9788
|
+
const BRACKET_CLOSE = ']';
|
|
9789
|
+
const COMMA = ',';
|
|
9790
|
+
|
|
9954
9791
|
/** Used to represent an undefined value that must be serialized */
|
|
9955
9792
|
const explicitUndefined = Symbol('undefined');
|
|
9956
9793
|
const EMPTY_OBJECT_PAYLOAD = 0;
|
|
@@ -12019,12 +11856,6 @@ const _regSymbol = (symbol, hash) => {
|
|
|
12019
11856
|
return symbol;
|
|
12020
11857
|
};
|
|
12021
11858
|
|
|
12022
|
-
/** @internal */
|
|
12023
|
-
const getAsyncLocalStorage = () => {
|
|
12024
|
-
const process = globalThis.process;
|
|
12025
|
-
return process?.getBuiltinModule?.('node:async_hooks')?.AsyncLocalStorage;
|
|
12026
|
-
};
|
|
12027
|
-
|
|
12028
11859
|
/** @file Shared types */
|
|
12029
11860
|
/** @internal */
|
|
12030
11861
|
function isStringifiable(value) {
|
|
@@ -12069,7 +11900,10 @@ class _SharedContainer {
|
|
|
12069
11900
|
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
12070
11901
|
}
|
|
12071
11902
|
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer) {
|
|
12072
|
-
|
|
11903
|
+
if (isServer) {
|
|
11904
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.setHostProp.bind(this), this.$storeProxyMap$, writer);
|
|
11905
|
+
}
|
|
11906
|
+
throw new Error('Serialization context is only available on the server');
|
|
12073
11907
|
}
|
|
12074
11908
|
$checkPendingCount$() {
|
|
12075
11909
|
if (this.$pendingCount$ === 0) {
|
|
@@ -12654,21 +12488,13 @@ const useResourceQrl = (qrl, opts) => {
|
|
|
12654
12488
|
* return (
|
|
12655
12489
|
* <div>
|
|
12656
12490
|
* <input name="city" bind:value={city} />
|
|
12657
|
-
* <div>
|
|
12658
|
-
* Temperature:{' '}
|
|
12659
|
-
* {weather.pending
|
|
12660
|
-
* ? 'Loading...'
|
|
12661
|
-
* : weather.error
|
|
12662
|
-
* ? `Error: ${weather.error.message}`
|
|
12663
|
-
* : weather.value.temp}
|
|
12664
|
-
* </div>
|
|
12491
|
+
* <div>Temperature: {weather.value.temp}</div>
|
|
12665
12492
|
* </div>
|
|
12666
12493
|
* );
|
|
12667
12494
|
* });
|
|
12668
12495
|
* ```
|
|
12669
12496
|
*
|
|
12670
|
-
* @deprecated Use `useComputed$` instead.
|
|
12671
|
-
* returned signal to determine the status.
|
|
12497
|
+
* @deprecated Use `useComputed$` instead.
|
|
12672
12498
|
* @public
|
|
12673
12499
|
*/
|
|
12674
12500
|
const Resource = ({ value, onResolved, onPending, onRejected, }) => {
|
|
@@ -12676,7 +12502,7 @@ const Resource = ({ value, onResolved, onPending, onRejected, }) => {
|
|
|
12676
12502
|
return value.then(onResolved, onRejected);
|
|
12677
12503
|
}
|
|
12678
12504
|
const isRes = isResourceReturn(value);
|
|
12679
|
-
const signal = isRes ? value.signal : value;
|
|
12505
|
+
const signal = (isRes ? value.signal : value);
|
|
12680
12506
|
if (onPending && signal.loading) {
|
|
12681
12507
|
return onPending();
|
|
12682
12508
|
}
|
|
@@ -15196,7 +15022,8 @@ class DomContainer extends _SharedContainer {
|
|
|
15196
15022
|
if (!__EXPERIMENTAL__.errorBoundary) {
|
|
15197
15023
|
const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
|
|
15198
15024
|
if (!errorStore) {
|
|
15199
|
-
|
|
15025
|
+
logErrorAndThrowAsync(err);
|
|
15026
|
+
return;
|
|
15200
15027
|
}
|
|
15201
15028
|
errorStore.error = err;
|
|
15202
15029
|
return;
|
|
@@ -15403,6 +15230,9 @@ function getLocale(defaultLocale) {
|
|
|
15403
15230
|
/**
|
|
15404
15231
|
* Override the `getLocale` with `lang` within the `fn` execution.
|
|
15405
15232
|
*
|
|
15233
|
+
* `fn` may be async. The locale stays set until the returned promise settles, even when
|
|
15234
|
+
* AsyncLocalStorage is not available.
|
|
15235
|
+
*
|
|
15406
15236
|
* @public
|
|
15407
15237
|
*/
|
|
15408
15238
|
function withLocale(locale, fn) {
|
|
@@ -15410,13 +15240,17 @@ function withLocale(locale, fn) {
|
|
|
15410
15240
|
return localAsyncStore.run(locale, fn);
|
|
15411
15241
|
}
|
|
15412
15242
|
const previousLang = _locale;
|
|
15413
|
-
|
|
15414
|
-
_locale = locale;
|
|
15415
|
-
return fn();
|
|
15416
|
-
}
|
|
15417
|
-
finally {
|
|
15243
|
+
const restore = () => {
|
|
15418
15244
|
_locale = previousLang;
|
|
15419
|
-
}
|
|
15245
|
+
};
|
|
15246
|
+
_locale = locale;
|
|
15247
|
+
return safeCall(fn, (value) => {
|
|
15248
|
+
restore();
|
|
15249
|
+
return value;
|
|
15250
|
+
}, (error) => {
|
|
15251
|
+
restore();
|
|
15252
|
+
throw error;
|
|
15253
|
+
});
|
|
15420
15254
|
}
|
|
15421
15255
|
/**
|
|
15422
15256
|
* Globally set a lang.
|
|
@@ -15495,15 +15329,12 @@ function newRenderInvokeContext(locale, hostElement, container) {
|
|
|
15495
15329
|
return ctx;
|
|
15496
15330
|
}
|
|
15497
15331
|
/** @internal */
|
|
15498
|
-
// TODO how about putting url and locale (and event/custom?) in to a "static" object
|
|
15499
15332
|
function newInvokeContext(locale, hostElement, event) {
|
|
15500
|
-
// ServerRequestEvent has .locale, but it's not always defined.
|
|
15501
|
-
const $locale$ = locale || (event && isObject(event) && 'locale' in event ? event.locale : undefined);
|
|
15502
15333
|
const ctx = {
|
|
15503
15334
|
$hostElement$: hostElement,
|
|
15504
15335
|
$event$: event,
|
|
15505
15336
|
$effectSubscriber$: undefined,
|
|
15506
|
-
$locale
|
|
15337
|
+
$locale$: locale,
|
|
15507
15338
|
$container$: undefined,
|
|
15508
15339
|
};
|
|
15509
15340
|
seal(ctx);
|
|
@@ -15628,7 +15459,7 @@ const initQrlClassDev = (lazy, captures, qrl) => {
|
|
|
15628
15459
|
};
|
|
15629
15460
|
/** Set up HMR support: cache LazyRefs and invalidate on file changes. */
|
|
15630
15461
|
const setupHmr = (LazyRefClass, setGetLazyRef) => {
|
|
15631
|
-
if (!(isBrowser
|
|
15462
|
+
if (!(isBrowser && import.meta.hot)) {
|
|
15632
15463
|
return;
|
|
15633
15464
|
}
|
|
15634
15465
|
const allLazyRefs = new Map();
|
|
@@ -15738,7 +15569,7 @@ class LazyRef {
|
|
|
15738
15569
|
}
|
|
15739
15570
|
qDev && initLazyRefDev(this);
|
|
15740
15571
|
/** Preload the chunk with somewhat lower probability when we create the QRL. */
|
|
15741
|
-
if (isBrowser
|
|
15572
|
+
if (isBrowser && $chunk$) {
|
|
15742
15573
|
p($chunk$, 0.8);
|
|
15743
15574
|
}
|
|
15744
15575
|
}
|
|
@@ -15754,7 +15585,7 @@ class LazyRef {
|
|
|
15754
15585
|
if (qTest ? isServerPlatform() : isServer) {
|
|
15755
15586
|
console.error(errorMessage, err);
|
|
15756
15587
|
}
|
|
15757
|
-
else if (qTest ? !isServerPlatform() : isBrowser
|
|
15588
|
+
else if (qTest ? !isServerPlatform() : isBrowser) {
|
|
15758
15589
|
const failureKey = this.$chunk$ === null ? `symbol:${this.$symbol$}` : `chunk:${this.$chunk$}`;
|
|
15759
15590
|
const container = this.$container$;
|
|
15760
15591
|
let containerFailures = container && reportedChunkFailures?.get(container);
|
|
@@ -15787,7 +15618,7 @@ class LazyRef {
|
|
|
15787
15618
|
const qFuncs = getQFuncs(doc, hash);
|
|
15788
15619
|
return (this.$ref$ = qFuncs[Number(this.$symbol$)]);
|
|
15789
15620
|
}
|
|
15790
|
-
if (isBrowser
|
|
15621
|
+
if (isBrowser && this.$chunk$) {
|
|
15791
15622
|
/** We will run the QRL, so now the probability of the chunk is 100% */
|
|
15792
15623
|
p(this.$chunk$, 1);
|
|
15793
15624
|
}
|
|
@@ -15799,7 +15630,8 @@ class LazyRef {
|
|
|
15799
15630
|
return this.$ref$;
|
|
15800
15631
|
}
|
|
15801
15632
|
}
|
|
15802
|
-
|
|
15633
|
+
qDev &&
|
|
15634
|
+
isBrowser &&
|
|
15803
15635
|
import.meta.hot &&
|
|
15804
15636
|
setupHmr(LazyRef, (fn) => {
|
|
15805
15637
|
getLazyRef = fn;
|
|
@@ -17018,9 +16850,8 @@ const useComputedQrl = (qrl, options) => {
|
|
|
17018
16850
|
*
|
|
17019
16851
|
* Every synchronous signal or store read is tracked automatically. Reads after an `await` are not:
|
|
17020
16852
|
* the tracking context is lost, so track them explicitly with the `track()` provided on the context
|
|
17021
|
-
* argument. When the function is async,
|
|
17022
|
-
*
|
|
17023
|
-
* computation state.
|
|
16853
|
+
* argument. When the function is async, reading an unresolved `.value` throws the computation
|
|
16854
|
+
* promise, and reading a failed `.value` throws the error.
|
|
17024
16855
|
*
|
|
17025
16856
|
* The function must not have any side effects.
|
|
17026
16857
|
*
|
|
@@ -17110,15 +16941,18 @@ const useVisibleTaskQrl = (qrl, opts) => {
|
|
|
17110
16941
|
}
|
|
17111
16942
|
assertQrl(qrl);
|
|
17112
16943
|
let flags;
|
|
17113
|
-
if (!isServerPlatform()) {
|
|
17114
|
-
//
|
|
16944
|
+
if (!isServerPlatform() && eagerness !== 'intersection-observer') {
|
|
16945
|
+
// The document is already ready/idle in DOM, so execute immediately
|
|
17115
16946
|
flags = 1 /* TaskFlags.VISIBLE_TASK */ | 4 /* TaskFlags.DIRTY */;
|
|
17116
16947
|
qrl.resolve();
|
|
17117
16948
|
markVNodeDirty(iCtx.$container$, iCtx.$hostElement$, 1 /* ChoreBits.TASKS */);
|
|
17118
16949
|
}
|
|
17119
16950
|
else {
|
|
17120
|
-
//
|
|
16951
|
+
// Defer execution until the trigger event fires
|
|
17121
16952
|
flags = 1 /* TaskFlags.VISIBLE_TASK */;
|
|
16953
|
+
if (!isServerPlatform()) {
|
|
16954
|
+
qrl.resolve();
|
|
16955
|
+
}
|
|
17122
16956
|
}
|
|
17123
16957
|
const task = new Task(flags, i, iCtx.$hostElement$, qrl, null);
|
|
17124
16958
|
set(task);
|
|
@@ -17297,7 +17131,7 @@ const errorBoundaryReset = () => {
|
|
|
17297
17131
|
const [host] = _captures;
|
|
17298
17132
|
// this is executed only on client
|
|
17299
17133
|
const container = tryGetInvokeContext()?.$container$;
|
|
17300
|
-
const isBrowserEnv = qTest ? !isServerPlatform() : isBrowser
|
|
17134
|
+
const isBrowserEnv = qTest ? !isServerPlatform() : isBrowser;
|
|
17301
17135
|
if (isBrowserEnv && host && container) {
|
|
17302
17136
|
resetErrorBoundary(container, host);
|
|
17303
17137
|
}
|
|
@@ -17390,7 +17224,7 @@ const errorBoundaryCmp = (props) => {
|
|
|
17390
17224
|
if (container && (getStoreTarget(store) ?? store).boundaryId === undefined) {
|
|
17391
17225
|
store.boundaryId = getNextUniqueIndex(container);
|
|
17392
17226
|
}
|
|
17393
|
-
const isServerEnv = qTest ? isServerPlatform() : !isBrowser
|
|
17227
|
+
const isServerEnv = qTest ? isServerPlatform() : !isBrowser;
|
|
17394
17228
|
if (!isServerEnv && store.error === undefined) {
|
|
17395
17229
|
return /*#__PURE__*/ _jsxSorted(Slot, null, null, null, 0, null);
|
|
17396
17230
|
}
|
|
@@ -17555,7 +17389,7 @@ const revealCanReveal = () => {
|
|
|
17555
17389
|
if (registration !== null && registration.reveal.version.value < 0) {
|
|
17556
17390
|
return false;
|
|
17557
17391
|
}
|
|
17558
|
-
if (qTest ? isServerPlatform() : !isBrowser
|
|
17392
|
+
if (qTest ? isServerPlatform() : !isBrowser) {
|
|
17559
17393
|
const ooos = registration?.reveal.ooos;
|
|
17560
17394
|
if (ooos) {
|
|
17561
17395
|
return ooos.canReveal(registration);
|
|
@@ -17568,7 +17402,7 @@ const revealCleanupTask = ({ cleanup }) => {
|
|
|
17568
17402
|
const registration = _captures[0];
|
|
17569
17403
|
cleanup(() => {
|
|
17570
17404
|
// Keep the SSR registry intact so `reveal.items` serializes for resume.
|
|
17571
|
-
if (qTest ? isServerPlatform() : !isBrowser
|
|
17405
|
+
if (qTest ? isServerPlatform() : !isBrowser) {
|
|
17572
17406
|
return;
|
|
17573
17407
|
}
|
|
17574
17408
|
const items = registration.reveal.items;
|
|
@@ -17612,7 +17446,7 @@ const revealCmp = (props) => {
|
|
|
17612
17446
|
}
|
|
17613
17447
|
const reveal = useConstant(createRevealContext, props);
|
|
17614
17448
|
useContextProvider(RevealContext, reveal);
|
|
17615
|
-
const isServerEnv = qTest ? isServerPlatform() : !isBrowser
|
|
17449
|
+
const isServerEnv = qTest ? isServerPlatform() : !isBrowser;
|
|
17616
17450
|
if (__EXPERIMENTAL__.suspense && isServerEnv && isOutOfOrderStreaming()) {
|
|
17617
17451
|
const coordinator = getOutOfOrderCoordinator(reveal);
|
|
17618
17452
|
return /*#__PURE__*/ _jsxSorted(SSRRevealSlot, {
|
|
@@ -17656,7 +17490,7 @@ const _hf1_str = '{display:p0.value==="content"&&p1.value?"contents":"none"}';
|
|
|
17656
17490
|
const suspenseTask = ({ track, cleanup }) => {
|
|
17657
17491
|
const cursorBoundary = _captures[0], props = _captures[1], state = _captures[2], revealRegistration = _captures[3];
|
|
17658
17492
|
const pendingCount = track(cursorBoundary);
|
|
17659
|
-
const isBrowserEnv = qTest ? !isServerPlatform() : isBrowser
|
|
17493
|
+
const isBrowserEnv = qTest ? !isServerPlatform() : isBrowser;
|
|
17660
17494
|
if (revealRegistration !== null && isBrowserEnv) {
|
|
17661
17495
|
revealRegistration.reveal.version.value++;
|
|
17662
17496
|
}
|
|
@@ -17688,7 +17522,7 @@ const suspenseCmp = (props) => {
|
|
|
17688
17522
|
state,
|
|
17689
17523
|
revealRegistration,
|
|
17690
17524
|
]));
|
|
17691
|
-
const isServerEnv = qTest ? isServerPlatform() : !isBrowser
|
|
17525
|
+
const isServerEnv = qTest ? isServerPlatform() : !isBrowser;
|
|
17692
17526
|
const isServerOutOfOrder = isServerEnv && isOutOfOrderStreaming();
|
|
17693
17527
|
const outOfOrderBoundaryId = isServerOutOfOrder ? nextOutOfOrderSuspenseId() : 0;
|
|
17694
17528
|
const outOfOrderRevealBoundary = isServerOutOfOrder
|
|
@@ -17916,11 +17750,11 @@ if (globalThis.__qwik) {
|
|
|
17916
17750
|
qError(30 /* QError.duplicateQwik */, [globalThis.__qwik, version]);
|
|
17917
17751
|
}
|
|
17918
17752
|
globalThis.__qwik = version;
|
|
17919
|
-
if (import.meta.hot) {
|
|
17753
|
+
if (isDev && import.meta.hot) {
|
|
17920
17754
|
import.meta.hot.dispose(() => {
|
|
17921
17755
|
globalThis.__qwik = undefined;
|
|
17922
17756
|
});
|
|
17923
17757
|
}
|
|
17924
17758
|
|
|
17925
|
-
export { $, Each, ErrorBoundary, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, Reveal, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, Show, SkipRender, Slot, Suspense, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, ELEMENT_SEQ as _ELEMENT_SEQ, EMPTY_ARRAY as _EMPTY_ARRAY, EMPTY_OBJ as _EMPTY_OBJ, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, SubscriptionPatch as _SubscriptionPatch, Task as _Task, _UNINITIALIZED, _VAR_PROPS, _addProjection, _captures, _chk, _createDeserializeContainer, createQRL as _createQRL, createStore as _createStore, delay as _delay, _deserialize, _dumpState, eachCmp as _eaC, eachCmpTask as _eaT, errorBoundaryCmp as _ebC, errorBoundaryReset as _ebR, _executeSsrChores, _fnSignal,
|
|
17759
|
+
export { $, Each, ErrorBoundary, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, Reveal, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, Show, SkipRender, Slot, Suspense, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, ELEMENT_SEQ as _ELEMENT_SEQ, EMPTY_ARRAY as _EMPTY_ARRAY, EMPTY_OBJ as _EMPTY_OBJ, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, SubscriptionPatch as _SubscriptionPatch, Task as _Task, _UNINITIALIZED, _VAR_PROPS, _addProjection, _captures, _chk, _createDeserializeContainer, createQRL as _createQRL, createStore as _createStore, delay as _delay, _deserialize, _dumpState, eachCmp as _eaC, eachCmpTask as _eaT, errorBoundaryCmp as _ebC, errorBoundaryReset as _ebR, _executeSsrChores, _fnSignal, _getConstProps, _getContextContainer, _getContextEvent, _getContextHostElement, getDomContainer as _getDomContainer, _getQContainerElement, getSubscriber as _getSubscriber, _getVarProps, handleSSRError as _handleSSRError, _hasStoreEffects, _hmr, _injectAsyncSignalValue, invoke as _invoke, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _markSignalAsExternallyOwned, newInvokeContext as _newInvokeContext, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, qrlToString as _qrlToString, _qrlWithChunk, _qrlWithChunkDEV, revealCmp as _reC, revealCanReveal as _reR, revealCleanupTask as _reT, _regSymbol, _removeProjection, _res, _resolveContextWithoutSequentialScope, _restProps, retryOnPromise as _retryOnPromise, _rsc, _run, _serialize, setEvent as _setEvent, _setProjectionTarget, showCmp as _shC, showCmpTask as _shT, suspenseCmp as _suC, suspenseTask as _suT, scheduleTask as _task, _updateProjectionProps, _useHmr, _val, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getElementName as _vnode_getElementName, vnode_getFirstChild as _vnode_getFirstChild, vnode_getProp as _vnode_getProp, vnode_getVNodeForChildNode as _vnode_getVNodeForChildNode, vnode_insertBefore as _vnode_insertBefore, vnode_isElementVNode as _vnode_isElementVNode, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_newVirtual as _vnode_newVirtual, vnode_remove as _vnode_remove, vnode_setProp as _vnode_setProp, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncSignal as createAsyncQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getClientManifest, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
|
|
17926
17760
|
//# sourceMappingURL=core.mjs.map
|