@qwik.dev/core 2.0.0-alpha.3 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +34 -4
- package/dist/core-internal.d.ts +39 -17
- package/dist/core.cjs +6436 -6165
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +6423 -6164
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +1714 -1494
- package/dist/core.prod.mjs +3824 -3622
- package/dist/insights/index.qwik.cjs +144 -147
- package/dist/insights/index.qwik.mjs +144 -147
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +2600 -2519
- package/dist/optimizer.mjs +1867 -1837
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +927 -677
- package/dist/server.mjs +842 -593
- package/dist/testing/index.cjs +3385 -3124
- package/dist/testing/index.mjs +3357 -3097
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
- package/public.d.ts +3 -0
- package/dist/index.d.ts +0 -2
package/dist/server.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-alpha.5-dev+cb53bbd
|
|
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
|
|
@@ -56,7 +56,7 @@ __export(server_exports, {
|
|
|
56
56
|
versions: () => versions
|
|
57
57
|
});
|
|
58
58
|
module.exports = __toCommonJS(server_exports);
|
|
59
|
-
var
|
|
59
|
+
var import_core5 = require("@qwik.dev/core");
|
|
60
60
|
|
|
61
61
|
// packages/qwik/src/server/platform.ts
|
|
62
62
|
var import_core = require("@qwik.dev/core");
|
|
@@ -167,7 +167,7 @@ var logWarn = (message, ...optionalParams) => {
|
|
|
167
167
|
};
|
|
168
168
|
var createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
169
169
|
const err = message instanceof Error ? message : new Error(message);
|
|
170
|
-
console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
170
|
+
!qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
171
171
|
asyncThrow && !qTest && setTimeout(() => {
|
|
172
172
|
throw err;
|
|
173
173
|
}, 0);
|
|
@@ -180,24 +180,24 @@ var codeToText = (code, ...parts) => {
|
|
|
180
180
|
const MAP = [
|
|
181
181
|
"Error while serializing class or style attributes",
|
|
182
182
|
// 0
|
|
183
|
-
"
|
|
184
|
-
// 1
|
|
185
|
-
"
|
|
186
|
-
// 2
|
|
187
|
-
"Only primitive and object literals can be serialized",
|
|
183
|
+
"",
|
|
184
|
+
// 1 unused
|
|
185
|
+
"",
|
|
186
|
+
// 2 unused
|
|
187
|
+
"Only primitive and object literals can be serialized. {{0}}",
|
|
188
188
|
// 3
|
|
189
|
-
"
|
|
190
|
-
// 4
|
|
189
|
+
"",
|
|
190
|
+
// 4 unused
|
|
191
191
|
"You can render over a existing q:container. Skipping render().",
|
|
192
192
|
// 5
|
|
193
|
-
"
|
|
194
|
-
// 6
|
|
195
|
-
"
|
|
196
|
-
// 7
|
|
197
|
-
"
|
|
198
|
-
// 8
|
|
199
|
-
|
|
200
|
-
// 9
|
|
193
|
+
"",
|
|
194
|
+
// 6 unused
|
|
195
|
+
"",
|
|
196
|
+
// 7 unused
|
|
197
|
+
"",
|
|
198
|
+
// 8 unused
|
|
199
|
+
"",
|
|
200
|
+
// 9 unused
|
|
201
201
|
"QRL is not a function",
|
|
202
202
|
// 10
|
|
203
203
|
"Dynamic import not found",
|
|
@@ -208,43 +208,81 @@ var codeToText = (code, ...parts) => {
|
|
|
208
208
|
// 13
|
|
209
209
|
"Invoking 'use*()' method outside of invocation context.",
|
|
210
210
|
// 14
|
|
211
|
-
"
|
|
212
|
-
// 15
|
|
213
|
-
"
|
|
214
|
-
// 16
|
|
215
|
-
"
|
|
216
|
-
// 17
|
|
217
|
-
"
|
|
218
|
-
// 18
|
|
219
|
-
"
|
|
220
|
-
// 19
|
|
211
|
+
"",
|
|
212
|
+
// 15 unused
|
|
213
|
+
"",
|
|
214
|
+
// 16 unused
|
|
215
|
+
"",
|
|
216
|
+
// 17 unused
|
|
217
|
+
"",
|
|
218
|
+
// 18 unused
|
|
219
|
+
"",
|
|
220
|
+
// 19 unused
|
|
221
221
|
`Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
|
|
222
222
|
See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
223
223
|
// 20
|
|
224
|
-
"Container is already paused. Skipping",
|
|
225
|
-
// 21
|
|
226
224
|
"",
|
|
227
|
-
//
|
|
228
|
-
"
|
|
229
|
-
//
|
|
230
|
-
"
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
//
|
|
234
|
-
"
|
|
235
|
-
//
|
|
236
|
-
"
|
|
237
|
-
//
|
|
225
|
+
// 21 unused
|
|
226
|
+
"",
|
|
227
|
+
// 22 unused
|
|
228
|
+
"",
|
|
229
|
+
// 23 unused
|
|
230
|
+
"",
|
|
231
|
+
// 24 unused
|
|
232
|
+
"",
|
|
233
|
+
// 25 unused
|
|
234
|
+
"",
|
|
235
|
+
// 26 unused
|
|
236
|
+
"",
|
|
237
|
+
// 27 unused
|
|
238
238
|
'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
|
|
239
239
|
// 28
|
|
240
|
-
"
|
|
240
|
+
"SsrError(tag): {{0}}",
|
|
241
241
|
// 29
|
|
242
242
|
"QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
|
|
243
243
|
// 30
|
|
244
244
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
245
245
|
// 31
|
|
246
|
-
"
|
|
246
|
+
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
247
247
|
// 32
|
|
248
|
+
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
249
|
+
// 33
|
|
250
|
+
"Serialization Error: Expected vnode for ref prop, but got {{0}}",
|
|
251
|
+
// 34
|
|
252
|
+
"Serialization Error: Cannot allocate data type {{0}}",
|
|
253
|
+
// 35
|
|
254
|
+
"Serialization Error: Missing root id for {{0}}",
|
|
255
|
+
// 36
|
|
256
|
+
"Serialization Error: Serialization of data type {{0}} is not implemented",
|
|
257
|
+
// 37
|
|
258
|
+
"Serialization Error: Unvisited {{0}}",
|
|
259
|
+
// 38
|
|
260
|
+
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
261
|
+
// 39
|
|
262
|
+
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
263
|
+
// 40
|
|
264
|
+
"Unable to find q:container",
|
|
265
|
+
// 41
|
|
266
|
+
"Element must have 'q:container' attribute.",
|
|
267
|
+
// 42
|
|
268
|
+
"Unknown vnode type {{0}}.",
|
|
269
|
+
// 43
|
|
270
|
+
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
271
|
+
// 44
|
|
272
|
+
"SsrError: {{0}}",
|
|
273
|
+
// 45
|
|
274
|
+
"Cannot coerce a Signal, use `.value` instead",
|
|
275
|
+
// 46
|
|
276
|
+
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
|
|
277
|
+
// 47
|
|
278
|
+
"ComputedSignal is read-only",
|
|
279
|
+
// 48
|
|
280
|
+
"WrappedSignal is read-only",
|
|
281
|
+
// 49
|
|
282
|
+
"SsrError: Promises not expected here.",
|
|
283
|
+
// 50
|
|
284
|
+
"Attribute value is unsafe for SSR"
|
|
285
|
+
// 51
|
|
248
286
|
];
|
|
249
287
|
let text = MAP[code] ?? "";
|
|
250
288
|
if (parts.length) {
|
|
@@ -256,19 +294,14 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
256
294
|
return v;
|
|
257
295
|
});
|
|
258
296
|
}
|
|
259
|
-
return `Code(${code}): ${text}`;
|
|
297
|
+
return `Code(Q${code}): ${text}`;
|
|
260
298
|
} else {
|
|
261
|
-
return `Code(${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
299
|
+
return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
262
300
|
}
|
|
263
301
|
};
|
|
264
|
-
var
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var QError_qrlMissingContainer = 30;
|
|
268
|
-
var QError_qrlMissingChunk = 31;
|
|
269
|
-
var qError = (code, ...parts) => {
|
|
270
|
-
const text = codeToText(code, ...parts);
|
|
271
|
-
return logErrorAndStop(text, ...parts);
|
|
302
|
+
var qError = (code, errorMessageArgs = []) => {
|
|
303
|
+
const text = codeToText(code, ...errorMessageArgs);
|
|
304
|
+
return logErrorAndStop(text, ...errorMessageArgs);
|
|
272
305
|
};
|
|
273
306
|
|
|
274
307
|
// packages/qwik/src/core/shared/utils/event-names.ts
|
|
@@ -447,7 +480,7 @@ var isUnitlessNumber = (name) => {
|
|
|
447
480
|
};
|
|
448
481
|
|
|
449
482
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
450
|
-
var
|
|
483
|
+
var import_build8 = require("@qwik.dev/core/build");
|
|
451
484
|
|
|
452
485
|
// packages/qwik/src/core/shared/error/assert.ts
|
|
453
486
|
var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
|
|
@@ -507,10 +540,10 @@ var createPlatform2 = () => {
|
|
|
507
540
|
}
|
|
508
541
|
}
|
|
509
542
|
if (!url) {
|
|
510
|
-
throw qError(
|
|
543
|
+
throw qError(31 /* qrlMissingChunk */, [symbolName]);
|
|
511
544
|
}
|
|
512
545
|
if (!containerEl) {
|
|
513
|
-
throw qError(
|
|
546
|
+
throw qError(30 /* qrlMissingContainer */, [url, symbolName]);
|
|
514
547
|
}
|
|
515
548
|
const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
|
|
516
549
|
const urlCopy = new URL(urlDoc);
|
|
@@ -587,7 +620,7 @@ var maybeThenPassError = (valueOrPromise, thenFn) => {
|
|
|
587
620
|
return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
|
|
588
621
|
};
|
|
589
622
|
var shouldNotError = (reason) => {
|
|
590
|
-
throwErrorAndStop(
|
|
623
|
+
throwErrorAndStop(reason);
|
|
591
624
|
};
|
|
592
625
|
var delay = (timeout) => {
|
|
593
626
|
return new Promise((resolve) => {
|
|
@@ -608,260 +641,6 @@ function retryOnPromise(fn, retryCount = 0) {
|
|
|
608
641
|
// packages/qwik/src/build/index.dev.ts
|
|
609
642
|
var isDev = true;
|
|
610
643
|
|
|
611
|
-
// packages/qwik/src/server/ssr-node.ts
|
|
612
|
-
var import_core2 = require("@qwik.dev/core");
|
|
613
|
-
var import_build2 = require("@qwik.dev/core/build");
|
|
614
|
-
var SsrNode = class {
|
|
615
|
-
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
|
|
616
|
-
this.attrs = attrs;
|
|
617
|
-
this.cleanupQueue = cleanupQueue;
|
|
618
|
-
this.vnodeData = vnodeData;
|
|
619
|
-
var _a;
|
|
620
|
-
this.currentComponentNode = currentComponentNode;
|
|
621
|
-
(_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
|
|
622
|
-
this.nodeType = nodeType;
|
|
623
|
-
this.id = id;
|
|
624
|
-
if (import_build2.isDev && id.indexOf("undefined") != -1) {
|
|
625
|
-
throw new Error(`Invalid SSR node id: ${id}`);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
__brand__;
|
|
629
|
-
static ELEMENT_NODE = 1;
|
|
630
|
-
static TEXT_NODE = 3;
|
|
631
|
-
static DOCUMENT_NODE = 9;
|
|
632
|
-
static DOCUMENT_FRAGMENT_NODE = 11;
|
|
633
|
-
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
|
|
634
|
-
nodeType;
|
|
635
|
-
/**
|
|
636
|
-
* ID which the deserialize will use to retrieve the node.
|
|
637
|
-
*
|
|
638
|
-
* @param refId - Unique id for the node.
|
|
639
|
-
*/
|
|
640
|
-
id;
|
|
641
|
-
/** Local props which don't serialize; */
|
|
642
|
-
locals = null;
|
|
643
|
-
currentComponentNode;
|
|
644
|
-
childrenVNodeData = null;
|
|
645
|
-
setProp(name, value) {
|
|
646
|
-
if (this.attrs === import_core2._EMPTY_ARRAY) {
|
|
647
|
-
this.attrs = [];
|
|
648
|
-
}
|
|
649
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
650
|
-
mapArray_set(this.locals || (this.locals = []), name, value, 0);
|
|
651
|
-
} else {
|
|
652
|
-
mapArray_set(this.attrs, name, value, 0);
|
|
653
|
-
}
|
|
654
|
-
if (name == ELEMENT_SEQ && value) {
|
|
655
|
-
this.cleanupQueue.push(value);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
getProp(name) {
|
|
659
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
660
|
-
return this.locals ? mapArray_get(this.locals, name, 0) : null;
|
|
661
|
-
} else {
|
|
662
|
-
return mapArray_get(this.attrs, name, 0);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
removeProp(name) {
|
|
666
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
667
|
-
if (this.locals) {
|
|
668
|
-
mapApp_remove(this.locals, name, 0);
|
|
669
|
-
}
|
|
670
|
-
} else {
|
|
671
|
-
mapApp_remove(this.attrs, name, 0);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
addChildVNodeData(child) {
|
|
675
|
-
if (!this.childrenVNodeData) {
|
|
676
|
-
this.childrenVNodeData = [];
|
|
677
|
-
}
|
|
678
|
-
this.childrenVNodeData.push(child);
|
|
679
|
-
}
|
|
680
|
-
toString() {
|
|
681
|
-
let stringifiedAttrs = "";
|
|
682
|
-
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
683
|
-
const key = this.attrs[i];
|
|
684
|
-
const value = this.attrs[i + 1];
|
|
685
|
-
stringifiedAttrs += `${key}=`;
|
|
686
|
-
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
687
|
-
if (i < this.attrs.length - 2) {
|
|
688
|
-
stringifiedAttrs += ", ";
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
var DomRef = class {
|
|
695
|
-
constructor($ssrNode$) {
|
|
696
|
-
this.$ssrNode$ = $ssrNode$;
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
var SsrComponentFrame = class {
|
|
700
|
-
constructor(componentNode) {
|
|
701
|
-
this.componentNode = componentNode;
|
|
702
|
-
}
|
|
703
|
-
slots = [];
|
|
704
|
-
projectionDepth = 0;
|
|
705
|
-
scopedStyleIds = /* @__PURE__ */ new Set();
|
|
706
|
-
projectionScopedStyle = null;
|
|
707
|
-
projectionComponentFrame = null;
|
|
708
|
-
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
709
|
-
this.projectionScopedStyle = projectionScopedStyle;
|
|
710
|
-
this.projectionComponentFrame = projectionComponentFrame;
|
|
711
|
-
if ((0, import_core2._isJSXNode)(children)) {
|
|
712
|
-
const slotName = this.getSlotName(children);
|
|
713
|
-
mapArray_set(this.slots, slotName, children, 0);
|
|
714
|
-
} else if (Array.isArray(children)) {
|
|
715
|
-
const defaultSlot = [];
|
|
716
|
-
for (let i = 0; i < children.length; i++) {
|
|
717
|
-
const child = children[i];
|
|
718
|
-
if ((0, import_core2._isJSXNode)(child)) {
|
|
719
|
-
const slotName = this.getSlotName(child);
|
|
720
|
-
if (slotName === QDefaultSlot) {
|
|
721
|
-
defaultSlot.push(child);
|
|
722
|
-
} else {
|
|
723
|
-
this.updateSlot(slotName, child);
|
|
724
|
-
}
|
|
725
|
-
} else {
|
|
726
|
-
defaultSlot.push(child);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
730
|
-
} else {
|
|
731
|
-
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
updateSlot(slotName, child) {
|
|
735
|
-
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
736
|
-
if (existingSlots === null) {
|
|
737
|
-
existingSlots = child;
|
|
738
|
-
} else if (Array.isArray(existingSlots)) {
|
|
739
|
-
existingSlots.push(child);
|
|
740
|
-
} else {
|
|
741
|
-
existingSlots = [existingSlots, child];
|
|
742
|
-
}
|
|
743
|
-
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
744
|
-
}
|
|
745
|
-
getSlotName(jsx2) {
|
|
746
|
-
if (jsx2.props[QSlot]) {
|
|
747
|
-
return jsx2.props[QSlot];
|
|
748
|
-
}
|
|
749
|
-
return QDefaultSlot;
|
|
750
|
-
}
|
|
751
|
-
hasSlot(slotName) {
|
|
752
|
-
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
753
|
-
}
|
|
754
|
-
consumeChildrenForSlot(projectionNode, slotName) {
|
|
755
|
-
const children = mapApp_remove(this.slots, slotName, 0);
|
|
756
|
-
if (children !== null) {
|
|
757
|
-
this.componentNode.setProp(slotName, projectionNode.id);
|
|
758
|
-
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
759
|
-
}
|
|
760
|
-
return children;
|
|
761
|
-
}
|
|
762
|
-
releaseUnclaimedProjections(unclaimedProjections) {
|
|
763
|
-
if (this.slots.length) {
|
|
764
|
-
unclaimedProjections.push(this);
|
|
765
|
-
unclaimedProjections.push(this.projectionScopedStyle);
|
|
766
|
-
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
// packages/qwik/src/server/vnode-data.ts
|
|
772
|
-
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
773
|
-
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
774
|
-
var EMPTY_ARRAY = [];
|
|
775
|
-
function vNodeData_incrementElementCount(vNodeData) {
|
|
776
|
-
const length = vNodeData.length;
|
|
777
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
778
|
-
if (lastValue >= 0) {
|
|
779
|
-
vNodeData.push(-1);
|
|
780
|
-
} else {
|
|
781
|
-
vNodeData[length - 1] = lastValue - 1;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
function vNodeData_addTextSize(vNodeData, size) {
|
|
785
|
-
const length = vNodeData.length;
|
|
786
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
787
|
-
if (length > 1 && lastValue >= 0) {
|
|
788
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
789
|
-
}
|
|
790
|
-
vNodeData.push(size);
|
|
791
|
-
if (size == 0) {
|
|
792
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
function vNodeData_openFragment(vNodeData, attrs) {
|
|
796
|
-
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
797
|
-
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
798
|
-
}
|
|
799
|
-
function vNodeData_closeFragment(vNodeData) {
|
|
800
|
-
vNodeData.push(CLOSE_FRAGMENT);
|
|
801
|
-
}
|
|
802
|
-
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
803
|
-
vNodeData[0] |= 4 /* REFERENCE */;
|
|
804
|
-
if (vNodeData.length == 1) {
|
|
805
|
-
return new SsrNode(
|
|
806
|
-
currentComponentNode,
|
|
807
|
-
SsrNode.ELEMENT_NODE,
|
|
808
|
-
String(depthFirstElementIdx),
|
|
809
|
-
EMPTY_ARRAY,
|
|
810
|
-
cleanupQueue,
|
|
811
|
-
vNodeData
|
|
812
|
-
);
|
|
813
|
-
} else {
|
|
814
|
-
let fragmentAttrs = EMPTY_ARRAY;
|
|
815
|
-
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
816
|
-
for (let i = 1; i < vNodeData.length; i++) {
|
|
817
|
-
const value = vNodeData[i];
|
|
818
|
-
if (Array.isArray(value)) {
|
|
819
|
-
fragmentAttrs = value;
|
|
820
|
-
i++;
|
|
821
|
-
stack2[stack2.length - 1]++;
|
|
822
|
-
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
823
|
-
} else if (value === CLOSE_FRAGMENT) {
|
|
824
|
-
stack2.pop();
|
|
825
|
-
stack2.pop();
|
|
826
|
-
fragmentAttrs = EMPTY_ARRAY;
|
|
827
|
-
} else if (value < 0) {
|
|
828
|
-
const numberOfElements = 0 - value;
|
|
829
|
-
stack2[stack2.length - 1] += numberOfElements;
|
|
830
|
-
} else {
|
|
831
|
-
stack2[stack2.length - 1]++;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
let refId = String(depthFirstElementIdx);
|
|
835
|
-
for (let i = 1; i < stack2.length; i += 2) {
|
|
836
|
-
const childCount = stack2[i];
|
|
837
|
-
if (childCount >= 0) {
|
|
838
|
-
refId += encodeAsAlphanumeric(childCount);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
const type = stack2[stack2.length - 2];
|
|
842
|
-
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
var ALPHANUMERIC = [];
|
|
846
|
-
function encodeAsAlphanumeric(value) {
|
|
847
|
-
while (ALPHANUMERIC.length <= value) {
|
|
848
|
-
let value2 = ALPHANUMERIC.length;
|
|
849
|
-
let text = "";
|
|
850
|
-
do {
|
|
851
|
-
text = String.fromCharCode(
|
|
852
|
-
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
853
|
-
/* A-Z */
|
|
854
|
-
) + text;
|
|
855
|
-
value2 = Math.floor(
|
|
856
|
-
value2 / 26
|
|
857
|
-
/* A-Z */
|
|
858
|
-
);
|
|
859
|
-
} while (value2 !== 0);
|
|
860
|
-
ALPHANUMERIC.push(text);
|
|
861
|
-
}
|
|
862
|
-
return ALPHANUMERIC[value];
|
|
863
|
-
}
|
|
864
|
-
|
|
865
644
|
// packages/qwik/src/core/shared/types.ts
|
|
866
645
|
var DEBUG_TYPE = "q:type";
|
|
867
646
|
var START = "\x1B[34m";
|
|
@@ -949,6 +728,7 @@ var ELEMENT_KEY = "q:key";
|
|
|
949
728
|
var ELEMENT_PROPS = "q:props";
|
|
950
729
|
var ELEMENT_SEQ = "q:seq";
|
|
951
730
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
731
|
+
var Q_PREFIX = "q:";
|
|
952
732
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
953
733
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
954
734
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
@@ -966,7 +746,7 @@ function setLocale(locale) {
|
|
|
966
746
|
}
|
|
967
747
|
|
|
968
748
|
// packages/qwik/src/core/client/vnode.ts
|
|
969
|
-
var
|
|
749
|
+
var import_build6 = require("@qwik.dev/core/build");
|
|
970
750
|
|
|
971
751
|
// packages/qwik/src/server/utils.ts
|
|
972
752
|
var import_meta = {};
|
|
@@ -995,12 +775,12 @@ function getBuildBase(opts) {
|
|
|
995
775
|
return `${import_meta.env.BASE_URL}build/`;
|
|
996
776
|
}
|
|
997
777
|
var versions = {
|
|
998
|
-
qwik: "2.0.0-alpha.
|
|
778
|
+
qwik: "2.0.0-alpha.5-dev+cb53bbd",
|
|
999
779
|
qwikDom: "2.1.19"
|
|
1000
780
|
};
|
|
1001
781
|
|
|
1002
782
|
// packages/qwik/src/server/prefetch-strategy.ts
|
|
1003
|
-
var
|
|
783
|
+
var import_build2 = require("@qwik.dev/core/build");
|
|
1004
784
|
function getPrefetchResources(qrls, opts, resolvedManifest) {
|
|
1005
785
|
if (!resolvedManifest) {
|
|
1006
786
|
return [];
|
|
@@ -1038,7 +818,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
|
|
|
1038
818
|
return prefetchResources;
|
|
1039
819
|
}
|
|
1040
820
|
function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
|
|
1041
|
-
const url =
|
|
821
|
+
const url = import_build2.isDev ? bundleFileName : buildBase + bundleFileName;
|
|
1042
822
|
let prefetchResource = urls.get(url);
|
|
1043
823
|
if (!prefetchResource) {
|
|
1044
824
|
prefetchResource = {
|
|
@@ -1062,13 +842,13 @@ var isQrl = (value) => {
|
|
|
1062
842
|
};
|
|
1063
843
|
|
|
1064
844
|
// packages/qwik/src/core/shared/utils/flyweight.ts
|
|
1065
|
-
var
|
|
845
|
+
var EMPTY_ARRAY = [];
|
|
1066
846
|
var EMPTY_OBJ = {};
|
|
1067
|
-
Object.freeze(
|
|
847
|
+
Object.freeze(EMPTY_ARRAY);
|
|
1068
848
|
Object.freeze(EMPTY_OBJ);
|
|
1069
849
|
|
|
1070
850
|
// packages/qwik/src/core/ssr/ssr-render-jsx.ts
|
|
1071
|
-
var
|
|
851
|
+
var import_build5 = require("@qwik.dev/core/build");
|
|
1072
852
|
|
|
1073
853
|
// packages/qwik/src/core/shared/jsx/slot.public.ts
|
|
1074
854
|
var Slot = (props) => {
|
|
@@ -1161,7 +941,6 @@ var StoreHandler = class {
|
|
|
1161
941
|
}
|
|
1162
942
|
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
1163
943
|
set(target, prop, value) {
|
|
1164
|
-
target = unwrapDeserializerProxy(target);
|
|
1165
944
|
if (typeof prop === "symbol") {
|
|
1166
945
|
target[prop] = value;
|
|
1167
946
|
return true;
|
|
@@ -1229,6 +1008,11 @@ function addEffect(target, prop, store, effectSubscriber) {
|
|
|
1229
1008
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
1230
1009
|
ensureContainsEffect(effects, effectSubscriber);
|
|
1231
1010
|
ensureContains(effectSubscriber, target);
|
|
1011
|
+
ensureEffectContainsSubscriber(
|
|
1012
|
+
effectSubscriber[0 /* EFFECT */],
|
|
1013
|
+
target,
|
|
1014
|
+
store.$container$
|
|
1015
|
+
);
|
|
1232
1016
|
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
1233
1017
|
}
|
|
1234
1018
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -1256,48 +1040,118 @@ var Subscriber = class {
|
|
|
1256
1040
|
function isSubscriber(value) {
|
|
1257
1041
|
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
1258
1042
|
}
|
|
1259
|
-
function clearVNodeEffectDependencies(value) {
|
|
1260
|
-
|
|
1043
|
+
function clearVNodeEffectDependencies(container, value) {
|
|
1044
|
+
if (vnode_isElementVNode(value)) {
|
|
1045
|
+
ensureMaterialized(value);
|
|
1046
|
+
}
|
|
1047
|
+
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
1261
1048
|
if (!effects) {
|
|
1262
1049
|
return;
|
|
1263
1050
|
}
|
|
1264
1051
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1265
1052
|
const subscriber = effects[i];
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1053
|
+
clearEffects(subscriber, value, effects, i, container);
|
|
1054
|
+
}
|
|
1055
|
+
if (effects.length === 0) {
|
|
1056
|
+
vnode_setProp(value, QSubscribers, null);
|
|
1270
1057
|
}
|
|
1271
1058
|
}
|
|
1272
|
-
function clearSubscriberEffectDependencies(value) {
|
|
1059
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
1273
1060
|
if (value.$effectDependencies$) {
|
|
1274
1061
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
1275
1062
|
const subscriber = value.$effectDependencies$[i];
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1063
|
+
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
1064
|
+
}
|
|
1065
|
+
if (value.$effectDependencies$.length === 0) {
|
|
1066
|
+
value.$effectDependencies$ = null;
|
|
1280
1067
|
}
|
|
1281
1068
|
}
|
|
1282
1069
|
}
|
|
1283
|
-
function clearEffects(subscriber, value) {
|
|
1284
|
-
|
|
1285
|
-
|
|
1070
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
1071
|
+
let subscriptionRemoved = false;
|
|
1072
|
+
const seenSet = /* @__PURE__ */ new Set();
|
|
1073
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1074
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
1075
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
1076
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
1077
|
+
const handler = getStoreHandler(store);
|
|
1078
|
+
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
1079
|
+
}
|
|
1080
|
+
if (subscriptionRemoved) {
|
|
1081
|
+
effectArray.splice(indexToRemove, 1);
|
|
1286
1082
|
}
|
|
1083
|
+
}
|
|
1084
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
1287
1085
|
const effectSubscriptions = subscriber.$effects$;
|
|
1086
|
+
let subscriptionRemoved = false;
|
|
1087
|
+
if (effectSubscriptions) {
|
|
1088
|
+
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
1089
|
+
const effect = effectSubscriptions[i];
|
|
1090
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1091
|
+
effectSubscriptions.splice(i, 1);
|
|
1092
|
+
subscriptionRemoved = true;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1097
|
+
const hostElement = subscriber.$hostElement$;
|
|
1098
|
+
if (hostElement && hostElement === value) {
|
|
1099
|
+
subscriber.$hostElement$ = null;
|
|
1100
|
+
}
|
|
1101
|
+
const args = subscriber.$args$;
|
|
1102
|
+
if (args) {
|
|
1103
|
+
clearArgsEffects(args, subscriber, seenSet);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
return subscriptionRemoved;
|
|
1107
|
+
}
|
|
1108
|
+
function clearStoreEffects(storeHandler, value) {
|
|
1109
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
1288
1110
|
if (!effectSubscriptions) {
|
|
1289
1111
|
return false;
|
|
1290
1112
|
}
|
|
1291
1113
|
let subscriptionRemoved = false;
|
|
1292
|
-
for (
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1114
|
+
for (const key in effectSubscriptions) {
|
|
1115
|
+
const effects = effectSubscriptions[key];
|
|
1116
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1117
|
+
const effect = effects[i];
|
|
1118
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1119
|
+
effects.splice(i, 1);
|
|
1120
|
+
subscriptionRemoved = true;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
if (effects.length === 0) {
|
|
1124
|
+
delete effectSubscriptions[key];
|
|
1297
1125
|
}
|
|
1298
1126
|
}
|
|
1299
1127
|
return subscriptionRemoved;
|
|
1300
1128
|
}
|
|
1129
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
1130
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1131
|
+
const arg = args[i];
|
|
1132
|
+
clearArgEffect(arg, subscriber, seenSet);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
1136
|
+
if (seenSet.has(arg)) {
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
seenSet.add(arg);
|
|
1140
|
+
if (isSignal(arg)) {
|
|
1141
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
1142
|
+
} else if (typeof arg === "object" && arg !== null) {
|
|
1143
|
+
if (isStore(arg)) {
|
|
1144
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
1145
|
+
} else {
|
|
1146
|
+
for (const key in arg) {
|
|
1147
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
} else if (Array.isArray(arg)) {
|
|
1151
|
+
clearArgsEffects(arg, subscriber, seenSet);
|
|
1152
|
+
} else {
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1301
1155
|
|
|
1302
1156
|
// packages/qwik/src/core/use/use-resource.ts
|
|
1303
1157
|
var _createResourceReturn = (opts) => {
|
|
@@ -1323,7 +1177,7 @@ var runResource = (task, container, host) => {
|
|
|
1323
1177
|
cleanupTask(task);
|
|
1324
1178
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
1325
1179
|
iCtx.$container$ = container;
|
|
1326
|
-
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
|
|
1180
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
|
|
1327
1181
|
const resource = task.$state$;
|
|
1328
1182
|
assertDefined(
|
|
1329
1183
|
resource,
|
|
@@ -1447,7 +1301,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
|
|
|
1447
1301
|
};
|
|
1448
1302
|
|
|
1449
1303
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1450
|
-
var
|
|
1304
|
+
var import_build4 = require("@qwik.dev/core/build");
|
|
1451
1305
|
|
|
1452
1306
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
1453
1307
|
var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
|
|
@@ -1619,7 +1473,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
1619
1473
|
}
|
|
1620
1474
|
|
|
1621
1475
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
1622
|
-
var
|
|
1476
|
+
var import_build3 = require("@qwik.dev/core/build");
|
|
1623
1477
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1624
1478
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
|
|
1625
1479
|
iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
|
|
@@ -1655,7 +1509,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1655
1509
|
}
|
|
1656
1510
|
}
|
|
1657
1511
|
if (vnode_isVNode(renderHost)) {
|
|
1658
|
-
clearVNodeEffectDependencies(renderHost);
|
|
1512
|
+
clearVNodeEffectDependencies(container, renderHost);
|
|
1659
1513
|
}
|
|
1660
1514
|
return componentFn(props);
|
|
1661
1515
|
},
|
|
@@ -1698,7 +1552,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
1698
1552
|
if (jsxElement2) {
|
|
1699
1553
|
addUseOnEvent(jsxElement2, key, useOnEvents[key]);
|
|
1700
1554
|
}
|
|
1701
|
-
} else if (
|
|
1555
|
+
} else if (import_build3.isDev) {
|
|
1702
1556
|
logWarn(
|
|
1703
1557
|
'You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. '
|
|
1704
1558
|
);
|
|
@@ -1729,7 +1583,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1729
1583
|
const queue = [jsx2];
|
|
1730
1584
|
while (queue.length) {
|
|
1731
1585
|
const jsx3 = queue.shift();
|
|
1732
|
-
if (
|
|
1586
|
+
if (isJSXNode(jsx3)) {
|
|
1733
1587
|
if (typeof jsx3.type === "string") {
|
|
1734
1588
|
return jsx3;
|
|
1735
1589
|
}
|
|
@@ -1748,7 +1602,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1748
1602
|
return null;
|
|
1749
1603
|
}
|
|
1750
1604
|
function addScriptNodeForInvisibleComponents(jsx2) {
|
|
1751
|
-
if (
|
|
1605
|
+
if (isJSXNode(jsx2)) {
|
|
1752
1606
|
const jsxElement = new JSXNodeImpl(
|
|
1753
1607
|
"script",
|
|
1754
1608
|
{},
|
|
@@ -1811,6 +1665,19 @@ function escapeHTML(html) {
|
|
|
1811
1665
|
}
|
|
1812
1666
|
}
|
|
1813
1667
|
|
|
1668
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
1669
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1670
|
+
var _a;
|
|
1671
|
+
if (!jsxDev) {
|
|
1672
|
+
return null;
|
|
1673
|
+
}
|
|
1674
|
+
const sanitizedFileName = (_a = jsxDev.fileName) == null ? void 0 : _a.replace(/\\/g, "/");
|
|
1675
|
+
if (sanitizedFileName) {
|
|
1676
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
1677
|
+
}
|
|
1678
|
+
return null;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1814
1681
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1815
1682
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1816
1683
|
let journal = container.$journal$;
|
|
@@ -1847,12 +1714,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1847
1714
|
descend(jsxValue, false);
|
|
1848
1715
|
} else if (isSignal(jsxValue)) {
|
|
1849
1716
|
if (vCurrent) {
|
|
1850
|
-
clearVNodeEffectDependencies(vCurrent);
|
|
1717
|
+
clearVNodeEffectDependencies(container, vCurrent);
|
|
1851
1718
|
}
|
|
1852
1719
|
expectVirtual("S" /* WrappedSignal */, null);
|
|
1853
1720
|
descend(
|
|
1854
|
-
|
|
1855
|
-
|
|
1721
|
+
trackSignalAndAssignHost(
|
|
1722
|
+
jsxValue,
|
|
1856
1723
|
vNewNode || vCurrent,
|
|
1857
1724
|
"." /* VNODE */,
|
|
1858
1725
|
container
|
|
@@ -1862,7 +1729,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1862
1729
|
} else if (isPromise(jsxValue)) {
|
|
1863
1730
|
expectVirtual("A" /* Awaited */, null);
|
|
1864
1731
|
asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
1865
|
-
} else if (
|
|
1732
|
+
} else if (isJSXNode(jsxValue)) {
|
|
1866
1733
|
const type = jsxValue.type;
|
|
1867
1734
|
if (typeof type === "string") {
|
|
1868
1735
|
expectNoMoreTextNodes();
|
|
@@ -2019,7 +1886,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2019
1886
|
for (let i = 0; i < projectionChildren.length; i++) {
|
|
2020
1887
|
const child = projectionChildren[i];
|
|
2021
1888
|
const slotName = String(
|
|
2022
|
-
|
|
1889
|
+
isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
|
|
2023
1890
|
);
|
|
2024
1891
|
const idx = mapApp_findIndx(projections, slotName, 0);
|
|
2025
1892
|
let jsxBucket;
|
|
@@ -2049,8 +1916,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2049
1916
|
);
|
|
2050
1917
|
if (vCurrent == null) {
|
|
2051
1918
|
vNewNode = vnode_newVirtual();
|
|
2052
|
-
|
|
2053
|
-
|
|
1919
|
+
import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1920
|
+
import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
|
|
2054
1921
|
vnode_setProp(vNewNode, QSlot, slotName);
|
|
2055
1922
|
vnode_setProp(vNewNode, QSlotParent, vParent);
|
|
2056
1923
|
vnode_setProp(vParent, slotName, vNewNode);
|
|
@@ -2076,8 +1943,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2076
1943
|
);
|
|
2077
1944
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2078
1945
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2079
|
-
|
|
2080
|
-
|
|
1946
|
+
import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1947
|
+
import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2081
1948
|
return false;
|
|
2082
1949
|
} else if (vProjectedNode === vCurrent) {
|
|
2083
1950
|
} else {
|
|
@@ -2089,8 +1956,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2089
1956
|
);
|
|
2090
1957
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2091
1958
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2092
|
-
|
|
2093
|
-
|
|
1959
|
+
import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1960
|
+
import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2094
1961
|
}
|
|
2095
1962
|
return true;
|
|
2096
1963
|
}
|
|
@@ -2100,7 +1967,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2100
1967
|
if (constProps && typeof constProps == "object" && "name" in constProps) {
|
|
2101
1968
|
const constValue = constProps.name;
|
|
2102
1969
|
if (vHost && constValue instanceof WrappedSignal) {
|
|
2103
|
-
return
|
|
1970
|
+
return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
|
|
2104
1971
|
}
|
|
2105
1972
|
}
|
|
2106
1973
|
return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
|
|
@@ -2151,7 +2018,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2151
2018
|
vnode_remove(journal, vParent, toRemove, true);
|
|
2152
2019
|
}
|
|
2153
2020
|
}
|
|
2154
|
-
function createNewElement(jsx2, elementName) {
|
|
2021
|
+
function createNewElement(jsx2, elementName, currentFile) {
|
|
2155
2022
|
const element = createElementWithNamespace(elementName);
|
|
2156
2023
|
const { constProps } = jsx2;
|
|
2157
2024
|
let needsQDispatchEventPatch = false;
|
|
@@ -2179,15 +2046,17 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2179
2046
|
} else if (typeof value === "function") {
|
|
2180
2047
|
value(element);
|
|
2181
2048
|
continue;
|
|
2049
|
+
} else {
|
|
2050
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2182
2051
|
}
|
|
2183
2052
|
}
|
|
2184
2053
|
if (isSignal(value)) {
|
|
2185
|
-
const signalData = new
|
|
2054
|
+
const signalData = new EffectPropData({
|
|
2186
2055
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2187
2056
|
$isConst$: true
|
|
2188
2057
|
});
|
|
2189
|
-
value =
|
|
2190
|
-
|
|
2058
|
+
value = trackSignalAndAssignHost(
|
|
2059
|
+
value,
|
|
2191
2060
|
vNewNode,
|
|
2192
2061
|
key2,
|
|
2193
2062
|
container,
|
|
@@ -2200,13 +2069,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2200
2069
|
continue;
|
|
2201
2070
|
}
|
|
2202
2071
|
if (elementName === "textarea" && key2 === "value") {
|
|
2203
|
-
if (typeof value !== "string") {
|
|
2204
|
-
if (
|
|
2205
|
-
|
|
2072
|
+
if (value && typeof value !== "string") {
|
|
2073
|
+
if (import_build4.isDev) {
|
|
2074
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
2206
2075
|
}
|
|
2207
2076
|
continue;
|
|
2208
2077
|
}
|
|
2209
|
-
element.value = escapeHTML(value);
|
|
2078
|
+
element.value = escapeHTML(value || "");
|
|
2210
2079
|
continue;
|
|
2211
2080
|
}
|
|
2212
2081
|
value = serializeAttribute(key2, value, scopedStyleIdPrefix);
|
|
@@ -2242,19 +2111,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2242
2111
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
2243
2112
|
const jsxKey = jsx2.key;
|
|
2244
2113
|
let needsQDispatchEventPatch = false;
|
|
2114
|
+
const currentFile = getFileLocationFromJsx(jsx2.dev);
|
|
2245
2115
|
if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
|
|
2246
2116
|
vNewNode = retrieveChildWithKey(elementName, jsxKey);
|
|
2247
2117
|
if (vNewNode === null) {
|
|
2248
2118
|
needsQDispatchEventPatch = createNewElement(jsx2, elementName);
|
|
2249
2119
|
} else {
|
|
2250
2120
|
vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
|
|
2121
|
+
vCurrent = vNewNode;
|
|
2122
|
+
vNewNode = null;
|
|
2123
|
+
if (vSiblings !== null) {
|
|
2124
|
+
vSiblingsIdx -= 3 /* Size */;
|
|
2125
|
+
}
|
|
2251
2126
|
}
|
|
2252
2127
|
}
|
|
2253
2128
|
const jsxAttrs = [];
|
|
2254
2129
|
const props = jsx2.varProps;
|
|
2255
2130
|
for (const key in props) {
|
|
2256
|
-
|
|
2257
|
-
value = serializeAttribute(key, value, scopedStyleIdPrefix);
|
|
2131
|
+
const value = props[key];
|
|
2258
2132
|
if (value != null) {
|
|
2259
2133
|
mapArray_set(jsxAttrs, key, value, 0);
|
|
2260
2134
|
}
|
|
@@ -2263,7 +2137,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2263
2137
|
mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
|
|
2264
2138
|
}
|
|
2265
2139
|
const vNode = vNewNode || vCurrent;
|
|
2266
|
-
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
|
|
2140
|
+
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
|
|
2267
2141
|
if (needsQDispatchEventPatch) {
|
|
2268
2142
|
const element = vnode_getNode(vNode);
|
|
2269
2143
|
if (!element.qDispatchEvent) {
|
|
@@ -2286,7 +2160,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2286
2160
|
}
|
|
2287
2161
|
}
|
|
2288
2162
|
}
|
|
2289
|
-
function setBulkProps(vnode, srcAttrs) {
|
|
2163
|
+
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
2290
2164
|
vnode_ensureElementInflated(vnode);
|
|
2291
2165
|
const dstAttrs = vnode;
|
|
2292
2166
|
let srcIdx = 0;
|
|
@@ -2309,12 +2183,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2309
2183
|
} else if (typeof value === "function") {
|
|
2310
2184
|
value(element);
|
|
2311
2185
|
return;
|
|
2186
|
+
} else {
|
|
2187
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2312
2188
|
}
|
|
2313
2189
|
}
|
|
2314
2190
|
if (isSignal(value)) {
|
|
2315
|
-
|
|
2191
|
+
const signalData = new EffectPropData({
|
|
2192
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2193
|
+
$isConst$: false
|
|
2194
|
+
});
|
|
2195
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
2316
2196
|
}
|
|
2317
|
-
vnode_setAttr(journal, vnode, key, value);
|
|
2197
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
|
|
2318
2198
|
if (value === null) {
|
|
2319
2199
|
dstLength = dstAttrs.length;
|
|
2320
2200
|
}
|
|
@@ -2334,7 +2214,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2334
2214
|
}
|
|
2335
2215
|
};
|
|
2336
2216
|
while (srcKey !== null || dstKey !== null) {
|
|
2337
|
-
if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || dstKey ==
|
|
2217
|
+
if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || (dstKey == null ? void 0 : dstKey.startsWith(Q_PREFIX))) {
|
|
2338
2218
|
dstIdx++;
|
|
2339
2219
|
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2340
2220
|
} else if (srcKey == null) {
|
|
@@ -2356,6 +2236,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2356
2236
|
}
|
|
2357
2237
|
srcIdx++;
|
|
2358
2238
|
srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
2239
|
+
dstIdx++;
|
|
2240
|
+
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2359
2241
|
} else if (srcKey == dstKey) {
|
|
2360
2242
|
const srcValue = srcAttrs[srcIdx++];
|
|
2361
2243
|
const dstValue = dstAttrs[dstIdx++];
|
|
@@ -2432,7 +2314,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2432
2314
|
vnode_insertBefore(
|
|
2433
2315
|
journal,
|
|
2434
2316
|
vParent,
|
|
2435
|
-
vNewNode
|
|
2317
|
+
vNewNode,
|
|
2436
2318
|
vCurrent && getInsertBefore()
|
|
2437
2319
|
);
|
|
2438
2320
|
return;
|
|
@@ -2445,7 +2327,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2445
2327
|
vCurrent && getInsertBefore()
|
|
2446
2328
|
);
|
|
2447
2329
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
|
|
2448
|
-
|
|
2330
|
+
import_build4.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
|
|
2449
2331
|
}
|
|
2450
2332
|
function expectComponent(component) {
|
|
2451
2333
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -2520,7 +2402,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2520
2402
|
}
|
|
2521
2403
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
2522
2404
|
if (host) {
|
|
2523
|
-
clearVNodeEffectDependencies(host);
|
|
2405
|
+
clearVNodeEffectDependencies(container, host);
|
|
2524
2406
|
}
|
|
2525
2407
|
vnode_insertBefore(
|
|
2526
2408
|
journal,
|
|
@@ -2529,7 +2411,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2529
2411
|
vCurrent && getInsertBefore()
|
|
2530
2412
|
);
|
|
2531
2413
|
const jsxNode2 = jsxValue;
|
|
2532
|
-
|
|
2414
|
+
import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
2533
2415
|
container.setHostProp(vNewNode, OnRenderProp, componentQRL);
|
|
2534
2416
|
container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
|
|
2535
2417
|
container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2542,7 +2424,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2542
2424
|
vCurrent && getInsertBefore()
|
|
2543
2425
|
);
|
|
2544
2426
|
const jsxNode2 = jsxValue;
|
|
2545
|
-
|
|
2427
|
+
import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
2546
2428
|
vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
|
|
2547
2429
|
if (jsxNode2.key) {
|
|
2548
2430
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2586,8 +2468,8 @@ function propsDiffer(src, dst) {
|
|
|
2586
2468
|
if (!src || !dst) {
|
|
2587
2469
|
return true;
|
|
2588
2470
|
}
|
|
2589
|
-
let srcKeys =
|
|
2590
|
-
let dstKeys =
|
|
2471
|
+
let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
|
|
2472
|
+
let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
|
|
2591
2473
|
if (srcKeys.length !== dstKeys.length) {
|
|
2592
2474
|
return true;
|
|
2593
2475
|
}
|
|
@@ -2602,10 +2484,13 @@ function propsDiffer(src, dst) {
|
|
|
2602
2484
|
}
|
|
2603
2485
|
return false;
|
|
2604
2486
|
}
|
|
2605
|
-
function
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
keys.
|
|
2487
|
+
function removePropsKeys(keys, propKeys) {
|
|
2488
|
+
for (let i = propKeys.length - 1; i >= 0; i--) {
|
|
2489
|
+
const propKey = propKeys[i];
|
|
2490
|
+
const propIdx = keys.indexOf(propKey);
|
|
2491
|
+
if (propIdx !== -1) {
|
|
2492
|
+
keys.splice(propIdx, 1);
|
|
2493
|
+
}
|
|
2609
2494
|
}
|
|
2610
2495
|
return keys;
|
|
2611
2496
|
}
|
|
@@ -2618,18 +2503,18 @@ function cleanup(container, vNode) {
|
|
|
2618
2503
|
do {
|
|
2619
2504
|
const type = vCursor[0 /* flags */];
|
|
2620
2505
|
if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
|
|
2506
|
+
clearVNodeEffectDependencies(container, vCursor);
|
|
2507
|
+
markVNodeAsDeleted(vCursor);
|
|
2621
2508
|
if (type & 2 /* Virtual */) {
|
|
2622
|
-
clearVNodeEffectDependencies(vCursor);
|
|
2623
|
-
markVNodeAsDeleted(vCursor);
|
|
2624
2509
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
2625
2510
|
if (seq) {
|
|
2626
2511
|
for (let i = 0; i < seq.length; i++) {
|
|
2627
2512
|
const obj = seq[i];
|
|
2628
2513
|
if (isTask(obj)) {
|
|
2629
2514
|
const task = obj;
|
|
2630
|
-
clearSubscriberEffectDependencies(task);
|
|
2515
|
+
clearSubscriberEffectDependencies(container, task);
|
|
2631
2516
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2632
|
-
container.$scheduler$(
|
|
2517
|
+
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2633
2518
|
} else {
|
|
2634
2519
|
cleanupTask(task);
|
|
2635
2520
|
}
|
|
@@ -2720,8 +2605,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2720
2605
|
let journalFlushScheduled = false;
|
|
2721
2606
|
return schedule;
|
|
2722
2607
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
2723
|
-
const runLater = type !==
|
|
2724
|
-
const isTask2 = type === 3 /* TASK */ || type ===
|
|
2608
|
+
const runLater = type !== 255 /* WAIT_FOR_ALL */ && type !== 6 /* COMPONENT_SSR */;
|
|
2609
|
+
const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 48 /* CLEANUP_VISIBLE */;
|
|
2725
2610
|
if (isTask2) {
|
|
2726
2611
|
hostOrTask.$flags$ |= 8 /* DIRTY */;
|
|
2727
2612
|
}
|
|
@@ -2738,19 +2623,19 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2738
2623
|
};
|
|
2739
2624
|
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
2740
2625
|
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
2741
|
-
chore = sortedInsert(choreQueue, chore);
|
|
2626
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2742
2627
|
if (!journalFlushScheduled && runLater) {
|
|
2743
2628
|
journalFlushScheduled = true;
|
|
2744
|
-
schedule(
|
|
2629
|
+
schedule(16 /* JOURNAL_FLUSH */);
|
|
2745
2630
|
scheduleDrain();
|
|
2746
2631
|
}
|
|
2747
2632
|
if (runLater) {
|
|
2748
2633
|
return chore.$promise$;
|
|
2749
2634
|
} else {
|
|
2750
|
-
return drainUpTo(chore);
|
|
2635
|
+
return drainUpTo(chore, container.rootVNode || null);
|
|
2751
2636
|
}
|
|
2752
2637
|
}
|
|
2753
|
-
function drainUpTo(runUptoChore) {
|
|
2638
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
2754
2639
|
if (runUptoChore.$executed$) {
|
|
2755
2640
|
return runUptoChore.$returnValue$;
|
|
2756
2641
|
}
|
|
@@ -2759,7 +2644,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2759
2644
|
}
|
|
2760
2645
|
while (choreQueue.length) {
|
|
2761
2646
|
const nextChore = choreQueue.shift();
|
|
2762
|
-
const order = choreComparator(nextChore, runUptoChore, false);
|
|
2647
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode, false);
|
|
2763
2648
|
if (order === null) {
|
|
2764
2649
|
continue;
|
|
2765
2650
|
}
|
|
@@ -2768,26 +2653,27 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2768
2653
|
}
|
|
2769
2654
|
const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
|
|
2770
2655
|
if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
|
|
2771
|
-
nextChore.$type$ !==
|
|
2656
|
+
nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
|
|
2772
2657
|
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
2773
2658
|
continue;
|
|
2774
2659
|
}
|
|
2775
2660
|
const returnValue = executeChore(nextChore);
|
|
2776
2661
|
if (isPromise(returnValue)) {
|
|
2777
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore));
|
|
2662
|
+
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
2778
2663
|
return promise;
|
|
2779
2664
|
}
|
|
2780
2665
|
}
|
|
2781
2666
|
return runUptoChore.$returnValue$;
|
|
2782
2667
|
}
|
|
2783
2668
|
function executeChore(chore) {
|
|
2669
|
+
var _a;
|
|
2784
2670
|
const host = chore.$host$;
|
|
2785
2671
|
DEBUG2 && debugTrace("execute", chore, currentChore, choreQueue);
|
|
2786
2672
|
assertEqual(currentChore, null, "Chore already running.");
|
|
2787
2673
|
currentChore = chore;
|
|
2788
2674
|
let returnValue = null;
|
|
2789
2675
|
switch (chore.$type$) {
|
|
2790
|
-
case
|
|
2676
|
+
case 16 /* JOURNAL_FLUSH */:
|
|
2791
2677
|
returnValue = journalFlush();
|
|
2792
2678
|
journalFlushScheduled = false;
|
|
2793
2679
|
break;
|
|
@@ -2824,10 +2710,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2824
2710
|
case 3 /* TASK */:
|
|
2825
2711
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2826
2712
|
break;
|
|
2827
|
-
case
|
|
2713
|
+
case 32 /* VISIBLE */:
|
|
2828
2714
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2829
2715
|
break;
|
|
2830
|
-
case
|
|
2716
|
+
case 48 /* CLEANUP_VISIBLE */:
|
|
2831
2717
|
const task = chore.$payload$;
|
|
2832
2718
|
cleanupTask(task);
|
|
2833
2719
|
break;
|
|
@@ -2862,13 +2748,27 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2862
2748
|
returnValue = !target.resolved ? target.resolve() : null;
|
|
2863
2749
|
break;
|
|
2864
2750
|
}
|
|
2751
|
+
case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
|
|
2752
|
+
const target = chore.$target$;
|
|
2753
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
2754
|
+
target.$forceRunEffects$ = false;
|
|
2755
|
+
if (!((_a = target.$effects$) == null ? void 0 : _a.length)) {
|
|
2756
|
+
break;
|
|
2757
|
+
}
|
|
2758
|
+
returnValue = retryOnPromise(() => {
|
|
2759
|
+
if (target.$computeIfNeeded$() || forceRunEffects) {
|
|
2760
|
+
triggerEffects(container, target, target.$effects$);
|
|
2761
|
+
}
|
|
2762
|
+
});
|
|
2763
|
+
break;
|
|
2764
|
+
}
|
|
2865
2765
|
}
|
|
2866
2766
|
return maybeThenPassError(returnValue, (value) => {
|
|
2867
|
-
var
|
|
2767
|
+
var _a2;
|
|
2868
2768
|
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
2869
2769
|
if (currentChore) {
|
|
2870
2770
|
currentChore.$executed$ = true;
|
|
2871
|
-
(
|
|
2771
|
+
(_a2 = currentChore.$resolve$) == null ? void 0 : _a2.call(currentChore, value);
|
|
2872
2772
|
}
|
|
2873
2773
|
currentChore = null;
|
|
2874
2774
|
return chore.$returnValue$ = value;
|
|
@@ -2886,17 +2786,17 @@ var choreUpdate = (existing, newChore) => {
|
|
|
2886
2786
|
function vNodeAlreadyDeleted(chore) {
|
|
2887
2787
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2888
2788
|
}
|
|
2889
|
-
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2890
|
-
const macroTypeDiff = (a.$type$ &
|
|
2789
|
+
function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
|
|
2790
|
+
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2891
2791
|
if (macroTypeDiff !== 0) {
|
|
2892
2792
|
return macroTypeDiff;
|
|
2893
2793
|
}
|
|
2894
|
-
if (a.$type$ !==
|
|
2794
|
+
if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
|
|
2895
2795
|
const aHost = a.$host$;
|
|
2896
2796
|
const bHost = b.$host$;
|
|
2897
2797
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
2898
2798
|
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
2899
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2799
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2900
2800
|
if (hostDiff !== 0) {
|
|
2901
2801
|
return hostDiff;
|
|
2902
2802
|
}
|
|
@@ -2906,7 +2806,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2906
2806
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2907
2807
|
Problematic Node: ${aHost.toString()}`;
|
|
2908
2808
|
if (shouldThrowOnHostMismatch) {
|
|
2909
|
-
|
|
2809
|
+
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2910
2810
|
}
|
|
2911
2811
|
logWarn(errorMessage);
|
|
2912
2812
|
return null;
|
|
@@ -2920,19 +2820,19 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2920
2820
|
if (idxDiff !== 0) {
|
|
2921
2821
|
return idxDiff;
|
|
2922
2822
|
}
|
|
2923
|
-
if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */)) {
|
|
2823
|
+
if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */ || a.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && b.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */)) {
|
|
2924
2824
|
return 1;
|
|
2925
2825
|
}
|
|
2926
2826
|
}
|
|
2927
2827
|
return 0;
|
|
2928
2828
|
}
|
|
2929
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2829
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2930
2830
|
let bottom = 0;
|
|
2931
2831
|
let top = sortedArray.length;
|
|
2932
2832
|
while (bottom < top) {
|
|
2933
2833
|
const middle = bottom + (top - bottom >> 1);
|
|
2934
2834
|
const midChore = sortedArray[middle];
|
|
2935
|
-
const comp = choreComparator(value, midChore, true);
|
|
2835
|
+
const comp = choreComparator(value, midChore, rootVNode, true);
|
|
2936
2836
|
if (comp < 0) {
|
|
2937
2837
|
top = middle;
|
|
2938
2838
|
} else if (comp > 0) {
|
|
@@ -2943,8 +2843,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2943
2843
|
}
|
|
2944
2844
|
return ~bottom;
|
|
2945
2845
|
}
|
|
2946
|
-
function sortedInsert(sortedArray, value) {
|
|
2947
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2846
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2847
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2948
2848
|
if (idx < 0) {
|
|
2949
2849
|
sortedArray.splice(~idx, 0, value);
|
|
2950
2850
|
return value;
|
|
@@ -2963,11 +2863,11 @@ function debugChoreToString(chore) {
|
|
|
2963
2863
|
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
2964
2864
|
[7 /* COMPONENT */]: "COMPONENT",
|
|
2965
2865
|
[6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
|
|
2966
|
-
[
|
|
2967
|
-
[
|
|
2968
|
-
[
|
|
2969
|
-
[
|
|
2970
|
-
[
|
|
2866
|
+
[8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
|
|
2867
|
+
[16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
|
|
2868
|
+
[32 /* VISIBLE */]: "VISIBLE",
|
|
2869
|
+
[48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
|
|
2870
|
+
[255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
|
|
2971
2871
|
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
2972
2872
|
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
2973
2873
|
const qrlTarget = (_a = chore.$target$) == null ? void 0 : _a.$symbol$;
|
|
@@ -2997,7 +2897,10 @@ var runTask = (task, container, host) => {
|
|
|
2997
2897
|
cleanupTask(task);
|
|
2998
2898
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
2999
2899
|
iCtx.$container$ = container;
|
|
3000
|
-
const taskFn = task.$qrl$.getFn(
|
|
2900
|
+
const taskFn = task.$qrl$.getFn(
|
|
2901
|
+
iCtx,
|
|
2902
|
+
() => clearSubscriberEffectDependencies(container, task)
|
|
2903
|
+
);
|
|
3001
2904
|
const track = (obj, prop) => {
|
|
3002
2905
|
const ctx = newInvokeContext();
|
|
3003
2906
|
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
@@ -3090,7 +2993,7 @@ var throwIfQRLNotResolved = (qrl) => {
|
|
|
3090
2993
|
var isSignal = (value) => {
|
|
3091
2994
|
return value instanceof Signal;
|
|
3092
2995
|
};
|
|
3093
|
-
var
|
|
2996
|
+
var EffectPropData = class {
|
|
3094
2997
|
data;
|
|
3095
2998
|
constructor(data) {
|
|
3096
2999
|
this.data = data;
|
|
@@ -3154,7 +3057,7 @@ var Signal = class {
|
|
|
3154
3057
|
// prevent accidental use as value
|
|
3155
3058
|
valueOf() {
|
|
3156
3059
|
if (qDev) {
|
|
3157
|
-
|
|
3060
|
+
throw qError(46 /* cannotCoerceSignal */);
|
|
3158
3061
|
}
|
|
3159
3062
|
}
|
|
3160
3063
|
toString() {
|
|
@@ -3187,7 +3090,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
|
3187
3090
|
return;
|
|
3188
3091
|
}
|
|
3189
3092
|
effect.$effectDependencies$.push(subscriber);
|
|
3190
|
-
} else if (vnode_isVNode(effect) &&
|
|
3093
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
3191
3094
|
let subscribers = vnode_getProp(
|
|
3192
3095
|
effect,
|
|
3193
3096
|
QSubscribers,
|
|
@@ -3231,7 +3134,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3231
3134
|
DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
3232
3135
|
let choreType = 3 /* TASK */;
|
|
3233
3136
|
if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
3234
|
-
choreType =
|
|
3137
|
+
choreType = 32 /* VISIBLE */;
|
|
3235
3138
|
} else if (effect.$flags$ & 4 /* RESOURCE */) {
|
|
3236
3139
|
choreType = 2 /* RESOURCE */;
|
|
3237
3140
|
}
|
|
@@ -3240,15 +3143,9 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3240
3143
|
if (effect instanceof ComputedSignal) {
|
|
3241
3144
|
if (!effect.$computeQrl$.resolved) {
|
|
3242
3145
|
container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
try {
|
|
3246
|
-
retryOnPromise(
|
|
3247
|
-
() => effect.$invalidate$()
|
|
3248
|
-
);
|
|
3249
|
-
} catch (e) {
|
|
3250
|
-
logError(e);
|
|
3146
|
+
}
|
|
3251
3147
|
}
|
|
3148
|
+
effect.$invalidate$();
|
|
3252
3149
|
} else if (property === ":" /* COMPONENT */) {
|
|
3253
3150
|
const host = effect;
|
|
3254
3151
|
const qrl = container.getHostProp(host, OnRenderProp);
|
|
@@ -3261,9 +3158,8 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3261
3158
|
container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
|
|
3262
3159
|
} else {
|
|
3263
3160
|
const host = effect;
|
|
3264
|
-
|
|
3265
|
-
if (effectData instanceof
|
|
3266
|
-
effectData = effectData;
|
|
3161
|
+
const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
|
|
3162
|
+
if (effectData instanceof EffectPropData) {
|
|
3267
3163
|
const data = effectData.data;
|
|
3268
3164
|
const payload = {
|
|
3269
3165
|
...data,
|
|
@@ -3288,6 +3184,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3288
3184
|
// We need a separate flag to know when the computation needs running because
|
|
3289
3185
|
// we need the old value to know if effects need running after computation
|
|
3290
3186
|
$invalid$ = true;
|
|
3187
|
+
$forceRunEffects$ = false;
|
|
3291
3188
|
constructor(container, fn) {
|
|
3292
3189
|
super(container, NEEDS_COMPUTATION);
|
|
3293
3190
|
this.$computeQrl$ = fn;
|
|
@@ -3295,12 +3192,8 @@ var ComputedSignal = class extends Signal {
|
|
|
3295
3192
|
$invalidate$() {
|
|
3296
3193
|
var _a;
|
|
3297
3194
|
this.$invalid$ = true;
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
}
|
|
3301
|
-
if (this.$computeIfNeeded$()) {
|
|
3302
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3303
|
-
}
|
|
3195
|
+
this.$forceRunEffects$ = false;
|
|
3196
|
+
(_a = this.$container$) == null ? void 0 : _a.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
|
|
3304
3197
|
}
|
|
3305
3198
|
/**
|
|
3306
3199
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3308,10 +3201,14 @@ var ComputedSignal = class extends Signal {
|
|
|
3308
3201
|
*/
|
|
3309
3202
|
force() {
|
|
3310
3203
|
this.$invalid$ = true;
|
|
3204
|
+
this.$forceRunEffects$ = false;
|
|
3311
3205
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3312
3206
|
}
|
|
3313
3207
|
get untrackedValue() {
|
|
3314
|
-
this.$computeIfNeeded$();
|
|
3208
|
+
const didChange = this.$computeIfNeeded$();
|
|
3209
|
+
if (didChange) {
|
|
3210
|
+
this.$forceRunEffects$ = didChange;
|
|
3211
|
+
}
|
|
3315
3212
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3316
3213
|
return this.$untrackedValue$;
|
|
3317
3214
|
}
|
|
@@ -3327,9 +3224,10 @@ var ComputedSignal = class extends Signal {
|
|
|
3327
3224
|
try {
|
|
3328
3225
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3329
3226
|
if (isPromise(untrackedValue)) {
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3227
|
+
throw qError(47 /* computedNotSync */, [
|
|
3228
|
+
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3229
|
+
computeQrl.$hash$
|
|
3230
|
+
]);
|
|
3333
3231
|
}
|
|
3334
3232
|
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
3335
3233
|
this.$invalid$ = false;
|
|
@@ -3349,7 +3247,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3349
3247
|
return super.value;
|
|
3350
3248
|
}
|
|
3351
3249
|
set value(_) {
|
|
3352
|
-
|
|
3250
|
+
throw qError(48 /* computedReadOnly */);
|
|
3353
3251
|
}
|
|
3354
3252
|
};
|
|
3355
3253
|
var WrappedSignal = class extends Signal {
|
|
@@ -3360,6 +3258,8 @@ var WrappedSignal = class extends Signal {
|
|
|
3360
3258
|
// we need the old value to know if effects need running after computation
|
|
3361
3259
|
$invalid$ = true;
|
|
3362
3260
|
$effectDependencies$ = null;
|
|
3261
|
+
$hostElement$ = null;
|
|
3262
|
+
$forceRunEffects$ = false;
|
|
3363
3263
|
constructor(container, fn, args, fnStr) {
|
|
3364
3264
|
super(container, NEEDS_COMPUTATION);
|
|
3365
3265
|
this.$args$ = args;
|
|
@@ -3369,12 +3269,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3369
3269
|
$invalidate$() {
|
|
3370
3270
|
var _a;
|
|
3371
3271
|
this.$invalid$ = true;
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3272
|
+
this.$forceRunEffects$ = false;
|
|
3273
|
+
(_a = this.$container$) == null ? void 0 : _a.$scheduler$(
|
|
3274
|
+
8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
|
|
3275
|
+
this.$hostElement$,
|
|
3276
|
+
this
|
|
3277
|
+
);
|
|
3378
3278
|
}
|
|
3379
3279
|
/**
|
|
3380
3280
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3382,10 +3282,14 @@ var WrappedSignal = class extends Signal {
|
|
|
3382
3282
|
*/
|
|
3383
3283
|
force() {
|
|
3384
3284
|
this.$invalid$ = true;
|
|
3285
|
+
this.$forceRunEffects$ = false;
|
|
3385
3286
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3386
3287
|
}
|
|
3387
3288
|
get untrackedValue() {
|
|
3388
|
-
this.$computeIfNeeded$();
|
|
3289
|
+
const didChange = this.$computeIfNeeded$();
|
|
3290
|
+
if (didChange) {
|
|
3291
|
+
this.$forceRunEffects$ = didChange;
|
|
3292
|
+
}
|
|
3389
3293
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3390
3294
|
return this.$untrackedValue$;
|
|
3391
3295
|
}
|
|
@@ -3410,12 +3314,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3410
3314
|
return super.value;
|
|
3411
3315
|
}
|
|
3412
3316
|
set value(_) {
|
|
3413
|
-
|
|
3317
|
+
throw qError(49 /* wrappedReadOnly */);
|
|
3414
3318
|
}
|
|
3415
3319
|
};
|
|
3416
3320
|
|
|
3417
3321
|
// packages/qwik/src/core/version.ts
|
|
3418
|
-
var version = "2.0.0-alpha.
|
|
3322
|
+
var version = "2.0.0-alpha.5-dev+cb53bbd";
|
|
3419
3323
|
|
|
3420
3324
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3421
3325
|
var _SharedContainer = class {
|
|
@@ -3440,7 +3344,7 @@ var _SharedContainer = class {
|
|
|
3440
3344
|
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
3441
3345
|
}
|
|
3442
3346
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3443
|
-
return
|
|
3347
|
+
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
3444
3348
|
}
|
|
3445
3349
|
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3446
3350
|
return createSerializationContext(
|
|
@@ -3562,7 +3466,7 @@ var JSXNodeImpl = class {
|
|
|
3562
3466
|
}
|
|
3563
3467
|
};
|
|
3564
3468
|
var Virtual = (props) => props.children;
|
|
3565
|
-
var
|
|
3469
|
+
var isJSXNode = (n) => {
|
|
3566
3470
|
if (qDev) {
|
|
3567
3471
|
if (n instanceof JSXNodeImpl) {
|
|
3568
3472
|
return true;
|
|
@@ -3698,7 +3602,7 @@ function qwikDebugToString(value) {
|
|
|
3698
3602
|
}
|
|
3699
3603
|
} else if (isStore(value)) {
|
|
3700
3604
|
return "Store";
|
|
3701
|
-
} else if (
|
|
3605
|
+
} else if (isJSXNode(value)) {
|
|
3702
3606
|
return jsxToString(value);
|
|
3703
3607
|
}
|
|
3704
3608
|
} finally {
|
|
@@ -3711,7 +3615,7 @@ var pad = (text, prefix) => {
|
|
|
3711
3615
|
return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
|
|
3712
3616
|
};
|
|
3713
3617
|
var jsxToString = (value) => {
|
|
3714
|
-
if (
|
|
3618
|
+
if (isJSXNode(value)) {
|
|
3715
3619
|
let type = value.type;
|
|
3716
3620
|
if (typeof type === "function") {
|
|
3717
3621
|
type = type.name || "Component";
|
|
@@ -3900,7 +3804,7 @@ var VNodeDataChar = {
|
|
|
3900
3804
|
/* ************** */
|
|
3901
3805
|
123
|
|
3902
3806
|
),
|
|
3903
|
-
// `{` is the start of the VNodeData.
|
|
3807
|
+
// `{` is the start of the VNodeData for a virtual element.
|
|
3904
3808
|
OPEN_CHAR: (
|
|
3905
3809
|
/* ****** */
|
|
3906
3810
|
"{"
|
|
@@ -3909,7 +3813,7 @@ var VNodeDataChar = {
|
|
|
3909
3813
|
/* ************* */
|
|
3910
3814
|
125
|
|
3911
3815
|
),
|
|
3912
|
-
// `}` is the end of the VNodeData.
|
|
3816
|
+
// `}` is the end of the VNodeData for a virtual element.
|
|
3913
3817
|
CLOSE_CHAR: (
|
|
3914
3818
|
/* ***** */
|
|
3915
3819
|
"}"
|
|
@@ -3979,7 +3883,7 @@ var VNodeDataChar = {
|
|
|
3979
3883
|
),
|
|
3980
3884
|
DON_T_USE: (
|
|
3981
3885
|
/* ********** */
|
|
3982
|
-
|
|
3886
|
+
92
|
|
3983
3887
|
),
|
|
3984
3888
|
// `\` - SKIP because `\` is used as escaping
|
|
3985
3889
|
DON_T_USE_CHAR: "\\",
|
|
@@ -4001,6 +3905,15 @@ var VNodeDataChar = {
|
|
|
4001
3905
|
/* **** */
|
|
4002
3906
|
"^"
|
|
4003
3907
|
),
|
|
3908
|
+
SUBS: (
|
|
3909
|
+
/* *************** */
|
|
3910
|
+
96
|
|
3911
|
+
),
|
|
3912
|
+
// '`' - `q:subs' - Effect dependencies/subscriptions
|
|
3913
|
+
SUBS_CHAR: (
|
|
3914
|
+
/* ******* */
|
|
3915
|
+
"`"
|
|
3916
|
+
),
|
|
4004
3917
|
SEPARATOR: (
|
|
4005
3918
|
/* ********* */
|
|
4006
3919
|
124
|
|
@@ -4722,9 +4635,32 @@ var vnode_materialize = (vNode) => {
|
|
|
4722
4635
|
const element = vNode[6 /* element */];
|
|
4723
4636
|
const firstChild = fastFirstChild(element);
|
|
4724
4637
|
const vNodeData = (_b = (_a = element.ownerDocument) == null ? void 0 : _a.qVNodeData) == null ? void 0 : _b.get(element);
|
|
4725
|
-
const vFirstChild =
|
|
4638
|
+
const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
|
|
4726
4639
|
return vFirstChild;
|
|
4727
4640
|
};
|
|
4641
|
+
var materialize = (vNode, element, firstChild, vNodeData) => {
|
|
4642
|
+
if (vNodeData) {
|
|
4643
|
+
if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
|
|
4644
|
+
const elementVNodeDataStartIdx = 1;
|
|
4645
|
+
let elementVNodeDataEndIdx = 1;
|
|
4646
|
+
while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
|
|
4647
|
+
elementVNodeDataEndIdx++;
|
|
4648
|
+
}
|
|
4649
|
+
const elementVNodeData = vNodeData.substring(
|
|
4650
|
+
elementVNodeDataStartIdx,
|
|
4651
|
+
elementVNodeDataEndIdx
|
|
4652
|
+
);
|
|
4653
|
+
vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
|
|
4654
|
+
const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
|
|
4655
|
+
if (!vNodeData) {
|
|
4656
|
+
return vFirstChild;
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
|
|
4660
|
+
} else {
|
|
4661
|
+
return materializeFromDOM(vNode, firstChild);
|
|
4662
|
+
}
|
|
4663
|
+
};
|
|
4728
4664
|
var ensureMaterialized = (vnode) => {
|
|
4729
4665
|
const vParent = ensureElementVNode(vnode);
|
|
4730
4666
|
let vFirstChild = vParent[4 /* firstChild */];
|
|
@@ -4849,7 +4785,7 @@ var fastGetter = (prototype, name) => {
|
|
|
4849
4785
|
var isQStyleElement = (node) => {
|
|
4850
4786
|
return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
|
|
4851
4787
|
};
|
|
4852
|
-
var materializeFromDOM = (vParent, firstChild) => {
|
|
4788
|
+
var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
4853
4789
|
let vFirstChild = null;
|
|
4854
4790
|
const skipStyleElements = () => {
|
|
4855
4791
|
while (isQStyleElement(child)) {
|
|
@@ -4883,8 +4819,54 @@ var materializeFromDOM = (vParent, firstChild) => {
|
|
|
4883
4819
|
}
|
|
4884
4820
|
vParent[5 /* lastChild */] = vChild || null;
|
|
4885
4821
|
vParent[4 /* firstChild */] = vFirstChild;
|
|
4822
|
+
if (vData) {
|
|
4823
|
+
let container = null;
|
|
4824
|
+
processVNodeData(vData, (peek, consumeValue) => {
|
|
4825
|
+
if (peek() === VNodeDataChar.ID) {
|
|
4826
|
+
if (!container) {
|
|
4827
|
+
container = getDomContainer(vParent[6 /* element */]);
|
|
4828
|
+
}
|
|
4829
|
+
const id = consumeValue();
|
|
4830
|
+
container.$setRawState$(parseInt(id), vParent);
|
|
4831
|
+
import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
4832
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
4833
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
4834
|
+
} else {
|
|
4835
|
+
consumeValue();
|
|
4836
|
+
}
|
|
4837
|
+
});
|
|
4838
|
+
}
|
|
4886
4839
|
return vFirstChild;
|
|
4887
4840
|
};
|
|
4841
|
+
var processVNodeData = (vData, callback) => {
|
|
4842
|
+
let nextToConsumeIdx = 0;
|
|
4843
|
+
let ch = 0;
|
|
4844
|
+
let peekCh = 0;
|
|
4845
|
+
const peek = () => {
|
|
4846
|
+
if (peekCh !== 0) {
|
|
4847
|
+
return peekCh;
|
|
4848
|
+
} else {
|
|
4849
|
+
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
4850
|
+
}
|
|
4851
|
+
};
|
|
4852
|
+
const consume = () => {
|
|
4853
|
+
ch = peek();
|
|
4854
|
+
peekCh = 0;
|
|
4855
|
+
nextToConsumeIdx++;
|
|
4856
|
+
return ch;
|
|
4857
|
+
};
|
|
4858
|
+
const consumeValue = () => {
|
|
4859
|
+
consume();
|
|
4860
|
+
const start = nextToConsumeIdx;
|
|
4861
|
+
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
4862
|
+
consume();
|
|
4863
|
+
}
|
|
4864
|
+
return vData.substring(start, nextToConsumeIdx);
|
|
4865
|
+
};
|
|
4866
|
+
while (peek() !== 0) {
|
|
4867
|
+
callback(peek, consumeValue, consume, nextToConsumeIdx);
|
|
4868
|
+
}
|
|
4869
|
+
};
|
|
4888
4870
|
var vnode_getNextSibling = (vnode) => {
|
|
4889
4871
|
return vnode[3 /* nextSibling */];
|
|
4890
4872
|
};
|
|
@@ -4969,7 +4951,7 @@ var vnode_getPropStartIndex = (vnode) => {
|
|
|
4969
4951
|
} else if (type === 2 /* Virtual */) {
|
|
4970
4952
|
return 6 /* PROPS_OFFSET */;
|
|
4971
4953
|
}
|
|
4972
|
-
throw
|
|
4954
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
4973
4955
|
};
|
|
4974
4956
|
var vnode_getParent = (vnode) => {
|
|
4975
4957
|
return vnode[1 /* parent */] || null;
|
|
@@ -4984,7 +4966,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4984
4966
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4985
4967
|
return vnode[4 /* node */];
|
|
4986
4968
|
};
|
|
4987
|
-
function vnode_toString(depth =
|
|
4969
|
+
function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
|
|
4988
4970
|
var _a;
|
|
4989
4971
|
let vnode = this;
|
|
4990
4972
|
if (depth === 0) {
|
|
@@ -5037,7 +5019,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
|
|
|
5037
5019
|
}
|
|
5038
5020
|
}
|
|
5039
5021
|
strings.push("<" + tag + attrs.join("") + ">");
|
|
5040
|
-
if (vnode_isMaterialized(vnode) ||
|
|
5022
|
+
if (vnode_isMaterialized(vnode) || materialize2) {
|
|
5041
5023
|
const child = vnode_getFirstChild(vnode);
|
|
5042
5024
|
child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
|
|
5043
5025
|
} else {
|
|
@@ -5060,25 +5042,9 @@ var isLowercase = (ch) => (
|
|
|
5060
5042
|
var stack = [];
|
|
5061
5043
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
5062
5044
|
let idx = 0;
|
|
5063
|
-
let nextToConsumeIdx = 0;
|
|
5064
5045
|
let vFirst = null;
|
|
5065
5046
|
let vLast = null;
|
|
5066
5047
|
let previousTextNode = null;
|
|
5067
|
-
let ch = 0;
|
|
5068
|
-
let peekCh = 0;
|
|
5069
|
-
const peek = () => {
|
|
5070
|
-
if (peekCh !== 0) {
|
|
5071
|
-
return peekCh;
|
|
5072
|
-
} else {
|
|
5073
|
-
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
5074
|
-
}
|
|
5075
|
-
};
|
|
5076
|
-
const consume = () => {
|
|
5077
|
-
ch = peek();
|
|
5078
|
-
peekCh = 0;
|
|
5079
|
-
nextToConsumeIdx++;
|
|
5080
|
-
return ch;
|
|
5081
|
-
};
|
|
5082
5048
|
const addVNode = (node) => {
|
|
5083
5049
|
node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
|
|
5084
5050
|
idx++;
|
|
@@ -5090,25 +5056,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5090
5056
|
}
|
|
5091
5057
|
vLast = node;
|
|
5092
5058
|
};
|
|
5093
|
-
const consumeValue = () => {
|
|
5094
|
-
consume();
|
|
5095
|
-
const start = nextToConsumeIdx;
|
|
5096
|
-
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
5097
|
-
consume();
|
|
5098
|
-
}
|
|
5099
|
-
return vData.substring(start, nextToConsumeIdx);
|
|
5100
|
-
};
|
|
5101
5059
|
let textIdx = 0;
|
|
5102
5060
|
let combinedText = null;
|
|
5103
5061
|
let container = null;
|
|
5104
|
-
|
|
5062
|
+
processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
|
|
5105
5063
|
if (isNumber(peek())) {
|
|
5106
5064
|
while (!isElement(child)) {
|
|
5107
5065
|
child = fastNextSibling(child);
|
|
5108
5066
|
if (!child) {
|
|
5109
|
-
|
|
5110
|
-
"Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
|
|
5111
|
-
);
|
|
5067
|
+
throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
|
|
5112
5068
|
}
|
|
5113
5069
|
}
|
|
5114
5070
|
while (isQStyleElement(child)) {
|
|
@@ -5135,7 +5091,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5135
5091
|
}
|
|
5136
5092
|
const id = consumeValue();
|
|
5137
5093
|
container.$setRawState$(parseInt(id), vParent);
|
|
5138
|
-
|
|
5094
|
+
import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
5139
5095
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
5140
5096
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
5141
5097
|
} else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
@@ -5146,6 +5102,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5146
5102
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
5147
5103
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
5148
5104
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
5105
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
5106
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
5149
5107
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
5150
5108
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
5151
5109
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -5188,7 +5146,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5188
5146
|
);
|
|
5189
5147
|
textIdx += length;
|
|
5190
5148
|
}
|
|
5191
|
-
}
|
|
5149
|
+
});
|
|
5192
5150
|
vParent[5 /* lastChild */] = vLast;
|
|
5193
5151
|
return vFirst;
|
|
5194
5152
|
}
|
|
@@ -5201,23 +5159,25 @@ var vnode_getType = (vnode) => {
|
|
|
5201
5159
|
} else if (type & 4 /* Text */) {
|
|
5202
5160
|
return 3;
|
|
5203
5161
|
}
|
|
5204
|
-
throw
|
|
5162
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
5205
5163
|
};
|
|
5206
5164
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5207
5165
|
1;
|
|
5208
5166
|
var aPath = [];
|
|
5209
5167
|
var bPath = [];
|
|
5210
|
-
var vnode_documentPosition = (a, b) => {
|
|
5168
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
5211
5169
|
if (a === b) {
|
|
5212
5170
|
return 0;
|
|
5213
5171
|
}
|
|
5214
5172
|
let aDepth = -1;
|
|
5215
5173
|
let bDepth = -1;
|
|
5216
5174
|
while (a) {
|
|
5217
|
-
|
|
5175
|
+
const vNode = aPath[++aDepth] = a;
|
|
5176
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5218
5177
|
}
|
|
5219
5178
|
while (b) {
|
|
5220
|
-
|
|
5179
|
+
const vNode = bPath[++bDepth] = b;
|
|
5180
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5221
5181
|
}
|
|
5222
5182
|
while (aDepth >= 0 && bDepth >= 0) {
|
|
5223
5183
|
a = aPath[aDepth];
|
|
@@ -5240,6 +5200,9 @@ var vnode_documentPosition = (a, b) => {
|
|
|
5240
5200
|
return -1;
|
|
5241
5201
|
}
|
|
5242
5202
|
} while (cursor);
|
|
5203
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
5204
|
+
return -1;
|
|
5205
|
+
}
|
|
5243
5206
|
return 1;
|
|
5244
5207
|
}
|
|
5245
5208
|
}
|
|
@@ -5249,8 +5212,11 @@ var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
|
5249
5212
|
let projectionDepth = 1;
|
|
5250
5213
|
while (projectionDepth--) {
|
|
5251
5214
|
while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
|
|
5252
|
-
const
|
|
5253
|
-
|
|
5215
|
+
const qSlotParent = vnode_getProp(
|
|
5216
|
+
vHost,
|
|
5217
|
+
QSlotParent,
|
|
5218
|
+
(id) => vnode_locate(rootVNode, id)
|
|
5219
|
+
);
|
|
5254
5220
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
5255
5221
|
if (vProjectionParent) {
|
|
5256
5222
|
projectionDepth++;
|
|
@@ -5282,7 +5248,7 @@ var VNodeArray = class VNode extends Array {
|
|
|
5282
5248
|
constructor(flags, parent, previousSibling, nextSibling) {
|
|
5283
5249
|
super();
|
|
5284
5250
|
this.push(flags, parent, previousSibling, nextSibling);
|
|
5285
|
-
if (
|
|
5251
|
+
if (import_build6.isDev) {
|
|
5286
5252
|
this.toString = vnode_toString;
|
|
5287
5253
|
}
|
|
5288
5254
|
}
|
|
@@ -5363,6 +5329,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
|
|
|
5363
5329
|
trackInvocation.$container$ = previousContainer;
|
|
5364
5330
|
}
|
|
5365
5331
|
};
|
|
5332
|
+
var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
5333
|
+
if (value instanceof WrappedSignal && value.$hostElement$ !== host && host) {
|
|
5334
|
+
value.$hostElement$ = host;
|
|
5335
|
+
}
|
|
5336
|
+
return trackSignal(() => value.value, host, property, container, data);
|
|
5337
|
+
};
|
|
5366
5338
|
|
|
5367
5339
|
// packages/qwik/src/core/use/use-context.ts
|
|
5368
5340
|
var createContextId = (name) => {
|
|
@@ -5384,7 +5356,7 @@ var isRecoverable = (err) => {
|
|
|
5384
5356
|
};
|
|
5385
5357
|
|
|
5386
5358
|
// packages/qwik/src/core/client/process-vnode-data.ts
|
|
5387
|
-
function
|
|
5359
|
+
function processVNodeData2(document2) {
|
|
5388
5360
|
const Q_CONTAINER = "q:container";
|
|
5389
5361
|
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
5390
5362
|
const Q_PROPS_SEPARATOR2 = ":";
|
|
@@ -5637,7 +5609,7 @@ function processVNodeData(document2) {
|
|
|
5637
5609
|
function getDomContainer(element) {
|
|
5638
5610
|
const qContainerElement = _getQContainerElement(element);
|
|
5639
5611
|
if (!qContainerElement) {
|
|
5640
|
-
|
|
5612
|
+
throw qError(41 /* containerNotFound */);
|
|
5641
5613
|
}
|
|
5642
5614
|
return getDomContainerFromQContainerElement(qContainerElement);
|
|
5643
5615
|
}
|
|
@@ -5698,7 +5670,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5698
5670
|
);
|
|
5699
5671
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
5700
5672
|
if (!this.qContainer) {
|
|
5701
|
-
|
|
5673
|
+
throw qError(42 /* elementWithoutContainer */);
|
|
5702
5674
|
}
|
|
5703
5675
|
this.$journal$ = [
|
|
5704
5676
|
// The first time we render we need to hoist the styles.
|
|
@@ -5719,7 +5691,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5719
5691
|
this.stateData = null;
|
|
5720
5692
|
const document2 = this.element.ownerDocument;
|
|
5721
5693
|
if (!document2.qVNodeData) {
|
|
5722
|
-
|
|
5694
|
+
processVNodeData2(document2);
|
|
5723
5695
|
}
|
|
5724
5696
|
this.$rawStateData$ = [];
|
|
5725
5697
|
this.stateData = [];
|
|
@@ -5729,7 +5701,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5729
5701
|
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
5730
5702
|
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
5731
5703
|
}
|
|
5732
|
-
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) ||
|
|
5704
|
+
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
5733
5705
|
}
|
|
5734
5706
|
$setRawState$(id, vParent) {
|
|
5735
5707
|
this.stateData[id] = vParent;
|
|
@@ -5794,13 +5766,11 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5794
5766
|
if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
|
|
5795
5767
|
return vNode;
|
|
5796
5768
|
}
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
}
|
|
5769
|
+
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
5770
|
+
vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5771
|
+
} else {
|
|
5772
|
+
vNode = vnode_getParent(vNode);
|
|
5802
5773
|
}
|
|
5803
|
-
vNode = vnode_getParent(vNode);
|
|
5804
5774
|
}
|
|
5805
5775
|
return null;
|
|
5806
5776
|
}
|
|
@@ -5833,12 +5803,12 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5833
5803
|
}
|
|
5834
5804
|
processChores() {
|
|
5835
5805
|
let renderCount = this.$renderCount$;
|
|
5836
|
-
const result = this.$scheduler$(
|
|
5806
|
+
const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5837
5807
|
if (isPromise(result)) {
|
|
5838
5808
|
return result.then(async () => {
|
|
5839
5809
|
while (renderCount !== this.$renderCount$) {
|
|
5840
5810
|
renderCount = this.$renderCount$;
|
|
5841
|
-
await this.$scheduler$(
|
|
5811
|
+
await this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5842
5812
|
}
|
|
5843
5813
|
this.renderDone = null;
|
|
5844
5814
|
});
|
|
@@ -5903,10 +5873,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5903
5873
|
|
|
5904
5874
|
// packages/qwik/src/core/shared/shared-serialization.ts
|
|
5905
5875
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
5906
|
-
var unwrapDeserializerProxy = (value) => {
|
|
5907
|
-
const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
|
|
5908
|
-
return unwrapped ? unwrapped : value;
|
|
5909
|
-
};
|
|
5910
5876
|
var isDeserializerProxy = (value) => {
|
|
5911
5877
|
return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
|
|
5912
5878
|
};
|
|
@@ -5948,13 +5914,13 @@ var DeserializationHandler = class {
|
|
|
5948
5914
|
return value;
|
|
5949
5915
|
}
|
|
5950
5916
|
const container = this.$container$;
|
|
5951
|
-
|
|
5917
|
+
let propValue = allocate(container, typeId, value);
|
|
5918
|
+
if (typeId >= 12 /* Error */) {
|
|
5919
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
5920
|
+
}
|
|
5952
5921
|
Reflect.set(target, property, propValue);
|
|
5953
5922
|
this.$data$[idx] = void 0;
|
|
5954
5923
|
this.$data$[idx + 1] = propValue;
|
|
5955
|
-
if (typeId >= 12 /* Error */) {
|
|
5956
|
-
inflate(container, propValue, typeId, value);
|
|
5957
|
-
}
|
|
5958
5924
|
return propValue;
|
|
5959
5925
|
}
|
|
5960
5926
|
has(target, property) {
|
|
@@ -5989,7 +5955,7 @@ var resolvers = /* @__PURE__ */ new WeakMap();
|
|
|
5989
5955
|
var inflate = (container, target, typeId, data) => {
|
|
5990
5956
|
var _a;
|
|
5991
5957
|
if (typeId === void 0) {
|
|
5992
|
-
return;
|
|
5958
|
+
return target;
|
|
5993
5959
|
}
|
|
5994
5960
|
if (typeId !== 13 /* Object */ && Array.isArray(data)) {
|
|
5995
5961
|
data = _eagerDeserializeArray(container, data);
|
|
@@ -6060,14 +6026,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6060
6026
|
case 25 /* Store */:
|
|
6061
6027
|
case 26 /* StoreArray */: {
|
|
6062
6028
|
const [value, flags, effects2, storeEffect] = data;
|
|
6063
|
-
const
|
|
6064
|
-
|
|
6065
|
-
Object.assign(getStoreTarget(target), value);
|
|
6029
|
+
const store = getOrCreateStore(value, flags, container);
|
|
6030
|
+
const storeHandler = getStoreHandler(store);
|
|
6066
6031
|
if (storeEffect) {
|
|
6067
6032
|
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
6068
6033
|
}
|
|
6069
|
-
|
|
6070
|
-
|
|
6034
|
+
storeHandler.$effects$ = effects2;
|
|
6035
|
+
target = store;
|
|
6071
6036
|
break;
|
|
6072
6037
|
}
|
|
6073
6038
|
case 22 /* Signal */: {
|
|
@@ -6084,7 +6049,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6084
6049
|
signal.$args$ = d[1];
|
|
6085
6050
|
signal.$effectDependencies$ = d[2];
|
|
6086
6051
|
signal.$untrackedValue$ = d[3];
|
|
6087
|
-
signal.$
|
|
6052
|
+
signal.$hostElement$ = d[4];
|
|
6053
|
+
signal.$effects$ = d.slice(5);
|
|
6088
6054
|
break;
|
|
6089
6055
|
}
|
|
6090
6056
|
case 24 /* ComputedSignal */: {
|
|
@@ -6181,12 +6147,14 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6181
6147
|
break;
|
|
6182
6148
|
case 30 /* EffectData */: {
|
|
6183
6149
|
const effectData = target;
|
|
6184
|
-
effectData.data = data[0];
|
|
6150
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
6151
|
+
effectData.data.$isConst$ = data[1];
|
|
6185
6152
|
break;
|
|
6186
6153
|
}
|
|
6187
6154
|
default:
|
|
6188
|
-
|
|
6155
|
+
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6189
6156
|
}
|
|
6157
|
+
return target;
|
|
6190
6158
|
};
|
|
6191
6159
|
var _constants = [
|
|
6192
6160
|
void 0,
|
|
@@ -6194,7 +6162,7 @@ var _constants = [
|
|
|
6194
6162
|
true,
|
|
6195
6163
|
false,
|
|
6196
6164
|
"",
|
|
6197
|
-
|
|
6165
|
+
EMPTY_ARRAY,
|
|
6198
6166
|
EMPTY_OBJ,
|
|
6199
6167
|
NEEDS_COMPUTATION,
|
|
6200
6168
|
Slot,
|
|
@@ -6254,9 +6222,8 @@ var allocate = (container, typeId, value) => {
|
|
|
6254
6222
|
case 24 /* ComputedSignal */:
|
|
6255
6223
|
return new ComputedSignal(container, null);
|
|
6256
6224
|
case 25 /* Store */:
|
|
6257
|
-
return createStore(container, {}, 0);
|
|
6258
6225
|
case 26 /* StoreArray */:
|
|
6259
|
-
return
|
|
6226
|
+
return null;
|
|
6260
6227
|
case 11 /* URLSearchParams */:
|
|
6261
6228
|
return new URLSearchParams(value);
|
|
6262
6229
|
case 27 /* FormData */:
|
|
@@ -6298,12 +6265,12 @@ var allocate = (container, typeId, value) => {
|
|
|
6298
6265
|
if (vnode_isVNode(vNode)) {
|
|
6299
6266
|
return vnode_getNode(vNode);
|
|
6300
6267
|
} else {
|
|
6301
|
-
|
|
6268
|
+
throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
6302
6269
|
}
|
|
6303
6270
|
case 30 /* EffectData */:
|
|
6304
|
-
return new
|
|
6271
|
+
return new EffectPropData({});
|
|
6305
6272
|
default:
|
|
6306
|
-
|
|
6273
|
+
throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
|
|
6307
6274
|
}
|
|
6308
6275
|
};
|
|
6309
6276
|
function retrieveVNodeOrDocument(container, value) {
|
|
@@ -6377,7 +6344,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6377
6344
|
$getRootId$: (obj) => {
|
|
6378
6345
|
const id = map.get(obj);
|
|
6379
6346
|
if (!id || id === -1) {
|
|
6380
|
-
|
|
6347
|
+
throw qError(36 /* serializeErrorMissingRootId */, [obj]);
|
|
6381
6348
|
}
|
|
6382
6349
|
return id;
|
|
6383
6350
|
},
|
|
@@ -6466,16 +6433,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6466
6433
|
if (obj.$args$) {
|
|
6467
6434
|
discoveredValues.push(...obj.$args$);
|
|
6468
6435
|
}
|
|
6436
|
+
if (obj.$hostElement$) {
|
|
6437
|
+
discoveredValues.push(obj.$hostElement$);
|
|
6438
|
+
}
|
|
6469
6439
|
} else if (obj instanceof ComputedSignal) {
|
|
6470
6440
|
discoveredValues.push(obj.$computeQrl$);
|
|
6471
6441
|
}
|
|
6472
6442
|
} else if (obj instanceof Task) {
|
|
6473
6443
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6474
6444
|
} else if (isSsrNode(obj)) {
|
|
6475
|
-
|
|
6445
|
+
discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
|
|
6446
|
+
if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
6447
|
+
for (const data of obj.childrenVNodeData) {
|
|
6448
|
+
discoverValuesForVNodeData(data, discoveredValues);
|
|
6449
|
+
}
|
|
6450
|
+
}
|
|
6476
6451
|
} else if (isDomRef(obj)) {
|
|
6477
6452
|
discoveredValues.push(obj.$ssrNode$.id);
|
|
6478
|
-
} else if (
|
|
6453
|
+
} else if (isJSXNode(obj)) {
|
|
6479
6454
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6480
6455
|
} else if (Array.isArray(obj)) {
|
|
6481
6456
|
discoveredValues.push(...obj);
|
|
@@ -6495,14 +6470,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6495
6470
|
}
|
|
6496
6471
|
);
|
|
6497
6472
|
promises.push(obj);
|
|
6498
|
-
} else if (obj instanceof
|
|
6473
|
+
} else if (obj instanceof EffectPropData) {
|
|
6499
6474
|
discoveredValues.push(obj.data);
|
|
6500
6475
|
} else if (isObjectLiteral(obj)) {
|
|
6501
6476
|
Object.entries(obj).forEach(([key, value]) => {
|
|
6502
6477
|
discoveredValues.push(key, value);
|
|
6503
6478
|
});
|
|
6504
6479
|
} else {
|
|
6505
|
-
|
|
6480
|
+
throw qError(37 /* serializeErrorUnknownType */, [obj]);
|
|
6506
6481
|
}
|
|
6507
6482
|
};
|
|
6508
6483
|
for (const root of roots) {
|
|
@@ -6527,6 +6502,20 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6527
6502
|
} while (discoveredValues.length);
|
|
6528
6503
|
}
|
|
6529
6504
|
};
|
|
6505
|
+
var isSsrAttrs = (value) => Array.isArray(value) && value.length > 0;
|
|
6506
|
+
var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
|
|
6507
|
+
for (const value of vnodeData) {
|
|
6508
|
+
if (isSsrAttrs(value)) {
|
|
6509
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
6510
|
+
if (value[i - 1] === ELEMENT_KEY) {
|
|
6511
|
+
continue;
|
|
6512
|
+
}
|
|
6513
|
+
const attrValue = value[i];
|
|
6514
|
+
discoveredValues.push(attrValue);
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
};
|
|
6530
6519
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
6531
6520
|
function serialize(serializationContext) {
|
|
6532
6521
|
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
@@ -6608,7 +6597,7 @@ function serialize(serializationContext) {
|
|
|
6608
6597
|
output(2 /* Number */, value);
|
|
6609
6598
|
}
|
|
6610
6599
|
} else if (typeof value === "object") {
|
|
6611
|
-
if (value ===
|
|
6600
|
+
if (value === EMPTY_ARRAY) {
|
|
6612
6601
|
output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
6613
6602
|
} else if (value === EMPTY_OBJ) {
|
|
6614
6603
|
output(1 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
@@ -6637,7 +6626,7 @@ function serialize(serializationContext) {
|
|
|
6637
6626
|
} else if (value === NEEDS_COMPUTATION) {
|
|
6638
6627
|
output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
6639
6628
|
} else {
|
|
6640
|
-
|
|
6629
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6641
6630
|
}
|
|
6642
6631
|
};
|
|
6643
6632
|
const writeObjectValue = (value, idx) => {
|
|
@@ -6655,14 +6644,14 @@ function serialize(serializationContext) {
|
|
|
6655
6644
|
const constProps = value[_CONST_PROPS];
|
|
6656
6645
|
const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
|
|
6657
6646
|
output(29 /* PropsProxy */, out);
|
|
6658
|
-
} else if (value instanceof
|
|
6659
|
-
output(30 /* EffectData */, [value.data]);
|
|
6647
|
+
} else if (value instanceof EffectPropData) {
|
|
6648
|
+
output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
|
|
6660
6649
|
} else if (isStore(value)) {
|
|
6661
6650
|
if (isResource(value)) {
|
|
6662
6651
|
serializationContext.$resources$.add(value);
|
|
6663
6652
|
const res = promiseResults.get(value.value);
|
|
6664
6653
|
if (!res) {
|
|
6665
|
-
|
|
6654
|
+
throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
|
|
6666
6655
|
}
|
|
6667
6656
|
output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
|
|
6668
6657
|
} else {
|
|
@@ -6699,7 +6688,7 @@ function serialize(serializationContext) {
|
|
|
6699
6688
|
output(13 /* Object */, out);
|
|
6700
6689
|
}
|
|
6701
6690
|
} else if ($isDomRef$(value)) {
|
|
6702
|
-
value.$ssrNode$.vnodeData[0] |=
|
|
6691
|
+
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
6703
6692
|
output(9 /* RefVNode */, value.$ssrNode$.id);
|
|
6704
6693
|
} else if (value instanceof Signal) {
|
|
6705
6694
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
@@ -6708,6 +6697,7 @@ function serialize(serializationContext) {
|
|
|
6708
6697
|
...serializeWrappingFn(serializationContext, value),
|
|
6709
6698
|
value.$effectDependencies$,
|
|
6710
6699
|
v,
|
|
6700
|
+
value.$hostElement$,
|
|
6711
6701
|
...value.$effects$ || []
|
|
6712
6702
|
]);
|
|
6713
6703
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -6746,11 +6736,11 @@ function serialize(serializationContext) {
|
|
|
6746
6736
|
const vNodeData = value.vnodeData;
|
|
6747
6737
|
if (vNodeData) {
|
|
6748
6738
|
(_a = serializationContext.$prepVNodeData$) == null ? void 0 : _a.call(serializationContext, vNodeData);
|
|
6749
|
-
vNodeData[0] |=
|
|
6739
|
+
vNodeData[0] |= 16 /* SERIALIZE */;
|
|
6750
6740
|
}
|
|
6751
6741
|
if (value.childrenVNodeData) {
|
|
6752
6742
|
for (const vNodeData2 of value.childrenVNodeData) {
|
|
6753
|
-
vNodeData2[0] |=
|
|
6743
|
+
vNodeData2[0] |= 16 /* SERIALIZE */;
|
|
6754
6744
|
}
|
|
6755
6745
|
}
|
|
6756
6746
|
} else {
|
|
@@ -6777,7 +6767,7 @@ function serialize(serializationContext) {
|
|
|
6777
6767
|
combined.push(k, v);
|
|
6778
6768
|
}
|
|
6779
6769
|
output(16 /* Map */, combined);
|
|
6780
|
-
} else if (
|
|
6770
|
+
} else if (isJSXNode(value)) {
|
|
6781
6771
|
output(28 /* JSXNode */, [
|
|
6782
6772
|
value.type,
|
|
6783
6773
|
value.varProps,
|
|
@@ -6802,7 +6792,7 @@ function serialize(serializationContext) {
|
|
|
6802
6792
|
} else if (isPromise(value)) {
|
|
6803
6793
|
const res = promiseResults.get(value);
|
|
6804
6794
|
if (!res) {
|
|
6805
|
-
|
|
6795
|
+
throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
|
|
6806
6796
|
}
|
|
6807
6797
|
output(14 /* Promise */, res);
|
|
6808
6798
|
} else if (value instanceof Uint8Array) {
|
|
@@ -6813,7 +6803,7 @@ function serialize(serializationContext) {
|
|
|
6813
6803
|
const out = btoa(buf).replace(/=+$/, "");
|
|
6814
6804
|
output(17 /* Uint8Array */, out);
|
|
6815
6805
|
} else {
|
|
6816
|
-
|
|
6806
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6817
6807
|
}
|
|
6818
6808
|
};
|
|
6819
6809
|
writeValue(serializationContext.$roots$, -1);
|
|
@@ -6860,7 +6850,7 @@ function qrlToString(serializationContext, value) {
|
|
|
6860
6850
|
}
|
|
6861
6851
|
}
|
|
6862
6852
|
if (!chunk) {
|
|
6863
|
-
|
|
6853
|
+
throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
|
|
6864
6854
|
}
|
|
6865
6855
|
if (chunk.startsWith("./")) {
|
|
6866
6856
|
chunk = chunk.slice(2);
|
|
@@ -6885,15 +6875,15 @@ function qrlToString(serializationContext, value) {
|
|
|
6885
6875
|
}
|
|
6886
6876
|
return qrlStringInline;
|
|
6887
6877
|
}
|
|
6888
|
-
function deserializeData(container, typeId,
|
|
6878
|
+
function deserializeData(container, typeId, value) {
|
|
6889
6879
|
if (typeId === void 0) {
|
|
6890
|
-
return
|
|
6880
|
+
return value;
|
|
6891
6881
|
}
|
|
6892
|
-
|
|
6882
|
+
let propValue = allocate(container, typeId, value);
|
|
6893
6883
|
if (typeId >= 12 /* Error */) {
|
|
6894
|
-
inflate(container,
|
|
6884
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
6895
6885
|
}
|
|
6896
|
-
return
|
|
6886
|
+
return propValue;
|
|
6897
6887
|
}
|
|
6898
6888
|
function shouldTrackObj(obj) {
|
|
6899
6889
|
return (
|
|
@@ -6915,7 +6905,7 @@ function isResource(value) {
|
|
|
6915
6905
|
return "__brand" in value && value.__brand === "resource";
|
|
6916
6906
|
}
|
|
6917
6907
|
var frameworkType = (obj) => {
|
|
6918
|
-
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task ||
|
|
6908
|
+
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
|
|
6919
6909
|
};
|
|
6920
6910
|
var canSerialize = (value) => {
|
|
6921
6911
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
@@ -6945,7 +6935,7 @@ var canSerialize = (value) => {
|
|
|
6945
6935
|
return true;
|
|
6946
6936
|
} else if (isPromise(value)) {
|
|
6947
6937
|
return true;
|
|
6948
|
-
} else if (
|
|
6938
|
+
} else if (isJSXNode(value)) {
|
|
6949
6939
|
return true;
|
|
6950
6940
|
} else if (value instanceof Error) {
|
|
6951
6941
|
return true;
|
|
@@ -7011,7 +7001,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
7011
7001
|
let expectIndex = 0;
|
|
7012
7002
|
unwrapped.forEach((v, i) => {
|
|
7013
7003
|
if (i !== expectIndex) {
|
|
7014
|
-
throw qError(
|
|
7004
|
+
throw qError(3 /* verifySerializable */, [unwrapped]);
|
|
7015
7005
|
}
|
|
7016
7006
|
_verifySerializable(v, seen, ctx + "[" + i + "]");
|
|
7017
7007
|
expectIndex = i + 1;
|
|
@@ -7051,8 +7041,7 @@ const ${fnName} = $(${String(
|
|
|
7051
7041
|
|
|
7052
7042
|
Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
|
|
7053
7043
|
}
|
|
7054
|
-
|
|
7055
|
-
throwErrorAndStop(message);
|
|
7044
|
+
throw qError(3 /* verifySerializable */, [message]);
|
|
7056
7045
|
}
|
|
7057
7046
|
return value;
|
|
7058
7047
|
};
|
|
@@ -7104,7 +7093,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7104
7093
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
7105
7094
|
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
7106
7095
|
if (!isFunction(fn)) {
|
|
7107
|
-
throw qError(
|
|
7096
|
+
throw qError(10 /* qrlIsNotFunction */);
|
|
7108
7097
|
}
|
|
7109
7098
|
if (beforeFn && beforeFn() === false) {
|
|
7110
7099
|
return;
|
|
@@ -7205,7 +7194,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7205
7194
|
if (symbolRef) {
|
|
7206
7195
|
symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
|
|
7207
7196
|
}
|
|
7208
|
-
if (
|
|
7197
|
+
if (import_build8.isDev) {
|
|
7209
7198
|
Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
7210
7199
|
get() {
|
|
7211
7200
|
return symbolRef;
|
|
@@ -7296,7 +7285,7 @@ var stringifyStyle = (obj) => {
|
|
|
7296
7285
|
}
|
|
7297
7286
|
if (typeof obj == "object") {
|
|
7298
7287
|
if (isArray(obj)) {
|
|
7299
|
-
throw qError(
|
|
7288
|
+
throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
|
|
7300
7289
|
} else {
|
|
7301
7290
|
const chunks = [];
|
|
7302
7291
|
for (const key in obj) {
|
|
@@ -7359,7 +7348,7 @@ function getValidManifest(manifest) {
|
|
|
7359
7348
|
}
|
|
7360
7349
|
|
|
7361
7350
|
// packages/qwik/src/server/ssr-container.ts
|
|
7362
|
-
var
|
|
7351
|
+
var import_core4 = require("@qwik.dev/core");
|
|
7363
7352
|
var import_build10 = require("@qwik.dev/core/build");
|
|
7364
7353
|
|
|
7365
7354
|
// packages/qwik/src/server/prefetch-utils.ts
|
|
@@ -7451,88 +7440,248 @@ function prefetchUrlsEvent2(container, prefetchResources, nonce) {
|
|
|
7451
7440
|
if (nonce) {
|
|
7452
7441
|
scriptAttrs.push("nonce", nonce);
|
|
7453
7442
|
}
|
|
7454
|
-
container.openElement("script", null, scriptAttrs);
|
|
7455
|
-
container.writer.write(prefetchUrlsEventScript(container.buildBase, prefetchResources));
|
|
7456
|
-
container.writer.write(
|
|
7457
|
-
`;document.dispatchEvent(new CustomEvent('qprefetch', {detail:{links: [location.pathname]}}))`
|
|
7458
|
-
);
|
|
7459
|
-
container.closeElement();
|
|
7460
|
-
}
|
|
7461
|
-
function linkHtmlImplementation2(container, prefetchResources, prefetchImpl) {
|
|
7462
|
-
const urls = flattenPrefetchResources(prefetchResources);
|
|
7463
|
-
const rel = prefetchImpl.linkRel || "prefetch";
|
|
7464
|
-
const priority = prefetchImpl.linkFetchPriority;
|
|
7465
|
-
for (const url of urls) {
|
|
7466
|
-
const attributes = ["href", url, "rel", rel];
|
|
7467
|
-
if (priority) {
|
|
7468
|
-
attributes.push("fetchpriority", priority);
|
|
7443
|
+
container.openElement("script", null, scriptAttrs);
|
|
7444
|
+
container.writer.write(prefetchUrlsEventScript(container.buildBase, prefetchResources));
|
|
7445
|
+
container.writer.write(
|
|
7446
|
+
`;document.dispatchEvent(new CustomEvent('qprefetch', {detail:{links: [location.pathname]}}))`
|
|
7447
|
+
);
|
|
7448
|
+
container.closeElement();
|
|
7449
|
+
}
|
|
7450
|
+
function linkHtmlImplementation2(container, prefetchResources, prefetchImpl) {
|
|
7451
|
+
const urls = flattenPrefetchResources(prefetchResources);
|
|
7452
|
+
const rel = prefetchImpl.linkRel || "prefetch";
|
|
7453
|
+
const priority = prefetchImpl.linkFetchPriority;
|
|
7454
|
+
for (const url of urls) {
|
|
7455
|
+
const attributes = ["href", url, "rel", rel];
|
|
7456
|
+
if (priority) {
|
|
7457
|
+
attributes.push("fetchpriority", priority);
|
|
7458
|
+
}
|
|
7459
|
+
if (rel === "prefetch" || rel === "preload") {
|
|
7460
|
+
if (url.endsWith(".js")) {
|
|
7461
|
+
attributes.push("as", "script");
|
|
7462
|
+
}
|
|
7463
|
+
}
|
|
7464
|
+
container.openElement("link", null, attributes);
|
|
7465
|
+
container.closeElement();
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
function linkJsImplementation2(container, prefetchResources, prefetchImpl, nonce) {
|
|
7469
|
+
const scriptAttrs = ["type", "module", "q:type", "link-js"];
|
|
7470
|
+
if (nonce) {
|
|
7471
|
+
scriptAttrs.push("nonce", nonce);
|
|
7472
|
+
}
|
|
7473
|
+
container.openElement("script", null, scriptAttrs);
|
|
7474
|
+
const rel = prefetchImpl.linkRel || "prefetch";
|
|
7475
|
+
const priority = prefetchImpl.linkFetchPriority;
|
|
7476
|
+
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
7477
|
+
container.writer.write(`let supportsLinkRel = true;`);
|
|
7478
|
+
}
|
|
7479
|
+
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
|
|
7480
|
+
container.writer.write(`u.map((u,i)=>{`);
|
|
7481
|
+
container.writer.write(`const l=document.createElement('link');`);
|
|
7482
|
+
container.writer.write(`l.setAttribute("href",u);`);
|
|
7483
|
+
container.writer.write(`l.setAttribute("rel","${rel}");`);
|
|
7484
|
+
if (priority) {
|
|
7485
|
+
container.writer.write(`l.setAttribute("fetchpriority","${priority}");`);
|
|
7486
|
+
}
|
|
7487
|
+
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
7488
|
+
container.writer.write(`if(i===0){`);
|
|
7489
|
+
container.writer.write(`try{`);
|
|
7490
|
+
container.writer.write(`supportsLinkRel=l.relList.supports("${rel}");`);
|
|
7491
|
+
container.writer.write(`}catch(e){}`);
|
|
7492
|
+
container.writer.write(`}`);
|
|
7493
|
+
}
|
|
7494
|
+
container.writer.write(`document.body.appendChild(l);`);
|
|
7495
|
+
container.writer.write(`});`);
|
|
7496
|
+
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
7497
|
+
container.writer.write(`if(!supportsLinkRel){`);
|
|
7498
|
+
container.writer.write(workerFetchScript());
|
|
7499
|
+
container.writer.write(`}`);
|
|
7500
|
+
}
|
|
7501
|
+
if (prefetchImpl.workerFetchInsert === "always") {
|
|
7502
|
+
container.writer.write(workerFetchScript());
|
|
7503
|
+
}
|
|
7504
|
+
container.closeElement();
|
|
7505
|
+
}
|
|
7506
|
+
function workerFetchImplementation2(container, prefetchResources, nonce) {
|
|
7507
|
+
const scriptAttrs = ["type", "module", "q:type", "prefetch-worker"];
|
|
7508
|
+
if (nonce) {
|
|
7509
|
+
scriptAttrs.push(nonce, "nonce");
|
|
7510
|
+
}
|
|
7511
|
+
container.openElement("script", null, scriptAttrs);
|
|
7512
|
+
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
|
|
7513
|
+
container.writer.write(workerFetchScript());
|
|
7514
|
+
container.closeElement();
|
|
7515
|
+
}
|
|
7516
|
+
function normalizePrefetchImplementation(input) {
|
|
7517
|
+
return { ...PrefetchImplementationDefault, ...input };
|
|
7518
|
+
}
|
|
7519
|
+
var PrefetchImplementationDefault = {
|
|
7520
|
+
linkInsert: null,
|
|
7521
|
+
linkRel: null,
|
|
7522
|
+
linkFetchPriority: null,
|
|
7523
|
+
workerFetchInsert: null,
|
|
7524
|
+
prefetchEvent: "always"
|
|
7525
|
+
};
|
|
7526
|
+
|
|
7527
|
+
// packages/qwik/src/server/ssr-node.ts
|
|
7528
|
+
var import_core2 = require("@qwik.dev/core");
|
|
7529
|
+
var import_build9 = require("@qwik.dev/core/build");
|
|
7530
|
+
var SsrNode = class {
|
|
7531
|
+
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
|
|
7532
|
+
this.attrs = attrs;
|
|
7533
|
+
this.cleanupQueue = cleanupQueue;
|
|
7534
|
+
this.vnodeData = vnodeData;
|
|
7535
|
+
var _a;
|
|
7536
|
+
this.currentComponentNode = currentComponentNode;
|
|
7537
|
+
(_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
|
|
7538
|
+
this.nodeType = nodeType;
|
|
7539
|
+
this.id = id;
|
|
7540
|
+
if (import_build9.isDev && id.indexOf("undefined") != -1) {
|
|
7541
|
+
throw new Error(`Invalid SSR node id: ${id}`);
|
|
7542
|
+
}
|
|
7543
|
+
}
|
|
7544
|
+
__brand__;
|
|
7545
|
+
static ELEMENT_NODE = 1;
|
|
7546
|
+
static TEXT_NODE = 3;
|
|
7547
|
+
static DOCUMENT_NODE = 9;
|
|
7548
|
+
static DOCUMENT_FRAGMENT_NODE = 11;
|
|
7549
|
+
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
|
|
7550
|
+
nodeType;
|
|
7551
|
+
/**
|
|
7552
|
+
* ID which the deserialize will use to retrieve the node.
|
|
7553
|
+
*
|
|
7554
|
+
* @param refId - Unique id for the node.
|
|
7555
|
+
*/
|
|
7556
|
+
id;
|
|
7557
|
+
/** Local props which don't serialize; */
|
|
7558
|
+
locals = null;
|
|
7559
|
+
currentComponentNode;
|
|
7560
|
+
childrenVNodeData = null;
|
|
7561
|
+
setProp(name, value) {
|
|
7562
|
+
if (this.attrs === import_core2._EMPTY_ARRAY) {
|
|
7563
|
+
this.attrs = [];
|
|
7564
|
+
}
|
|
7565
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7566
|
+
mapArray_set(this.locals || (this.locals = []), name, value, 0);
|
|
7567
|
+
} else {
|
|
7568
|
+
mapArray_set(this.attrs, name, value, 0);
|
|
7569
|
+
}
|
|
7570
|
+
if (name == ELEMENT_SEQ && value) {
|
|
7571
|
+
this.cleanupQueue.push(value);
|
|
7572
|
+
}
|
|
7573
|
+
}
|
|
7574
|
+
getProp(name) {
|
|
7575
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7576
|
+
return this.locals ? mapArray_get(this.locals, name, 0) : null;
|
|
7577
|
+
} else {
|
|
7578
|
+
return mapArray_get(this.attrs, name, 0);
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
removeProp(name) {
|
|
7582
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7583
|
+
if (this.locals) {
|
|
7584
|
+
mapApp_remove(this.locals, name, 0);
|
|
7585
|
+
}
|
|
7586
|
+
} else {
|
|
7587
|
+
mapApp_remove(this.attrs, name, 0);
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
addChildVNodeData(child) {
|
|
7591
|
+
if (!this.childrenVNodeData) {
|
|
7592
|
+
this.childrenVNodeData = [];
|
|
7469
7593
|
}
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7594
|
+
this.childrenVNodeData.push(child);
|
|
7595
|
+
}
|
|
7596
|
+
toString() {
|
|
7597
|
+
let stringifiedAttrs = "";
|
|
7598
|
+
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
7599
|
+
const key = this.attrs[i];
|
|
7600
|
+
const value = this.attrs[i + 1];
|
|
7601
|
+
stringifiedAttrs += `${key}=`;
|
|
7602
|
+
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
7603
|
+
if (i < this.attrs.length - 2) {
|
|
7604
|
+
stringifiedAttrs += ", ";
|
|
7473
7605
|
}
|
|
7474
7606
|
}
|
|
7475
|
-
|
|
7476
|
-
container.closeElement();
|
|
7607
|
+
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
7477
7608
|
}
|
|
7478
|
-
}
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
scriptAttrs.push("nonce", nonce);
|
|
7609
|
+
};
|
|
7610
|
+
var DomRef = class {
|
|
7611
|
+
constructor($ssrNode$) {
|
|
7612
|
+
this.$ssrNode$ = $ssrNode$;
|
|
7483
7613
|
}
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
container.writer.write(`let supportsLinkRel = true;`);
|
|
7614
|
+
};
|
|
7615
|
+
var SsrComponentFrame = class {
|
|
7616
|
+
constructor(componentNode) {
|
|
7617
|
+
this.componentNode = componentNode;
|
|
7489
7618
|
}
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7619
|
+
slots = [];
|
|
7620
|
+
projectionDepth = 0;
|
|
7621
|
+
scopedStyleIds = /* @__PURE__ */ new Set();
|
|
7622
|
+
projectionScopedStyle = null;
|
|
7623
|
+
projectionComponentFrame = null;
|
|
7624
|
+
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
7625
|
+
this.projectionScopedStyle = projectionScopedStyle;
|
|
7626
|
+
this.projectionComponentFrame = projectionComponentFrame;
|
|
7627
|
+
if ((0, import_core2._isJSXNode)(children)) {
|
|
7628
|
+
const slotName = this.getSlotName(children);
|
|
7629
|
+
mapArray_set(this.slots, slotName, children, 0);
|
|
7630
|
+
} else if (Array.isArray(children) && children.length > 0) {
|
|
7631
|
+
const defaultSlot = [];
|
|
7632
|
+
for (let i = 0; i < children.length; i++) {
|
|
7633
|
+
const child = children[i];
|
|
7634
|
+
if ((0, import_core2._isJSXNode)(child)) {
|
|
7635
|
+
const slotName = this.getSlotName(child);
|
|
7636
|
+
if (slotName === QDefaultSlot) {
|
|
7637
|
+
defaultSlot.push(child);
|
|
7638
|
+
} else {
|
|
7639
|
+
this.updateSlot(slotName, child);
|
|
7640
|
+
}
|
|
7641
|
+
} else {
|
|
7642
|
+
defaultSlot.push(child);
|
|
7643
|
+
}
|
|
7644
|
+
}
|
|
7645
|
+
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7646
|
+
} else {
|
|
7647
|
+
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7648
|
+
}
|
|
7497
7649
|
}
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7650
|
+
updateSlot(slotName, child) {
|
|
7651
|
+
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
7652
|
+
if (existingSlots === null) {
|
|
7653
|
+
existingSlots = child;
|
|
7654
|
+
} else if (Array.isArray(existingSlots)) {
|
|
7655
|
+
existingSlots.push(child);
|
|
7656
|
+
} else {
|
|
7657
|
+
existingSlots = [existingSlots, child];
|
|
7658
|
+
}
|
|
7659
|
+
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
7504
7660
|
}
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
container.writer.write(`}`);
|
|
7661
|
+
getSlotName(jsx2) {
|
|
7662
|
+
if (jsx2.props[QSlot]) {
|
|
7663
|
+
return jsx2.props[QSlot];
|
|
7664
|
+
}
|
|
7665
|
+
return QDefaultSlot;
|
|
7511
7666
|
}
|
|
7512
|
-
|
|
7513
|
-
|
|
7667
|
+
hasSlot(slotName) {
|
|
7668
|
+
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
7514
7669
|
}
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7670
|
+
consumeChildrenForSlot(projectionNode, slotName) {
|
|
7671
|
+
const children = mapApp_remove(this.slots, slotName, 0);
|
|
7672
|
+
if (children !== null) {
|
|
7673
|
+
this.componentNode.setProp(slotName, projectionNode.id);
|
|
7674
|
+
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
7675
|
+
}
|
|
7676
|
+
return children;
|
|
7677
|
+
}
|
|
7678
|
+
releaseUnclaimedProjections(unclaimedProjections) {
|
|
7679
|
+
if (this.slots.length) {
|
|
7680
|
+
unclaimedProjections.push(this);
|
|
7681
|
+
unclaimedProjections.push(this.projectionScopedStyle);
|
|
7682
|
+
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
7683
|
+
}
|
|
7521
7684
|
}
|
|
7522
|
-
container.openElement("script", null, scriptAttrs);
|
|
7523
|
-
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
|
|
7524
|
-
container.writer.write(workerFetchScript());
|
|
7525
|
-
container.closeElement();
|
|
7526
|
-
}
|
|
7527
|
-
function normalizePrefetchImplementation(input) {
|
|
7528
|
-
return { ...PrefetchImplementationDefault, ...input };
|
|
7529
|
-
}
|
|
7530
|
-
var PrefetchImplementationDefault = {
|
|
7531
|
-
linkInsert: null,
|
|
7532
|
-
linkRel: null,
|
|
7533
|
-
linkFetchPriority: null,
|
|
7534
|
-
workerFetchInsert: null,
|
|
7535
|
-
prefetchEvent: "always"
|
|
7536
7685
|
};
|
|
7537
7686
|
|
|
7538
7687
|
// packages/qwik/src/server/tag-nesting.ts
|
|
@@ -7805,6 +7954,110 @@ function isInPhrasing(text, allowInput) {
|
|
|
7805
7954
|
}
|
|
7806
7955
|
}
|
|
7807
7956
|
|
|
7957
|
+
// packages/qwik/src/server/vnode-data.ts
|
|
7958
|
+
var import_core3 = require("@qwik.dev/core");
|
|
7959
|
+
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
7960
|
+
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
7961
|
+
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
|
|
7962
|
+
function vNodeData_incrementElementCount(vNodeData) {
|
|
7963
|
+
const length = vNodeData.length;
|
|
7964
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7965
|
+
if (lastValue >= 0) {
|
|
7966
|
+
vNodeData.push(-1);
|
|
7967
|
+
} else {
|
|
7968
|
+
vNodeData[length - 1] = lastValue - 1;
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
function vNodeData_addTextSize(vNodeData, size) {
|
|
7972
|
+
const length = vNodeData.length;
|
|
7973
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7974
|
+
if (length > 1 && lastValue >= 0) {
|
|
7975
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7976
|
+
}
|
|
7977
|
+
vNodeData.push(size);
|
|
7978
|
+
if (size == 0) {
|
|
7979
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
function vNodeData_openFragment(vNodeData, attrs) {
|
|
7983
|
+
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
7984
|
+
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
7985
|
+
}
|
|
7986
|
+
function vNodeData_closeFragment(vNodeData) {
|
|
7987
|
+
vNodeData.push(CLOSE_FRAGMENT);
|
|
7988
|
+
}
|
|
7989
|
+
function vNodeData_openElement(vNodeData) {
|
|
7990
|
+
vNodeData.push([], WRITE_ELEMENT_ATTRS);
|
|
7991
|
+
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
7992
|
+
}
|
|
7993
|
+
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
7994
|
+
vNodeData[0] |= 8 /* REFERENCE */;
|
|
7995
|
+
let fragmentAttrs = import_core3._EMPTY_ARRAY;
|
|
7996
|
+
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
7997
|
+
for (let i = 1; i < vNodeData.length; i++) {
|
|
7998
|
+
const value = vNodeData[i];
|
|
7999
|
+
if (Array.isArray(value)) {
|
|
8000
|
+
fragmentAttrs = value;
|
|
8001
|
+
i++;
|
|
8002
|
+
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
8003
|
+
stack2[stack2.length - 1]++;
|
|
8004
|
+
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
8005
|
+
}
|
|
8006
|
+
} else if (value === CLOSE_FRAGMENT) {
|
|
8007
|
+
stack2.pop();
|
|
8008
|
+
stack2.pop();
|
|
8009
|
+
fragmentAttrs = import_core3._EMPTY_ARRAY;
|
|
8010
|
+
} else if (value < 0) {
|
|
8011
|
+
const numberOfElements = 0 - value;
|
|
8012
|
+
stack2[stack2.length - 1] += numberOfElements;
|
|
8013
|
+
} else {
|
|
8014
|
+
stack2[stack2.length - 1]++;
|
|
8015
|
+
}
|
|
8016
|
+
}
|
|
8017
|
+
let refId = String(depthFirstElementIdx);
|
|
8018
|
+
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
8019
|
+
for (let i = 1; i < stack2.length; i += 2) {
|
|
8020
|
+
const childCount = stack2[i];
|
|
8021
|
+
if (childCount >= 0) {
|
|
8022
|
+
refId += encodeAsAlphanumeric(childCount);
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
const type = stack2[stack2.length - 2];
|
|
8027
|
+
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
8028
|
+
}
|
|
8029
|
+
var ALPHANUMERIC = [];
|
|
8030
|
+
function encodeAsAlphanumeric(value) {
|
|
8031
|
+
while (ALPHANUMERIC.length <= value) {
|
|
8032
|
+
let value2 = ALPHANUMERIC.length;
|
|
8033
|
+
let text = "";
|
|
8034
|
+
do {
|
|
8035
|
+
text = String.fromCharCode(
|
|
8036
|
+
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
8037
|
+
/* A-Z */
|
|
8038
|
+
) + text;
|
|
8039
|
+
value2 = Math.floor(
|
|
8040
|
+
value2 / 26
|
|
8041
|
+
/* A-Z */
|
|
8042
|
+
);
|
|
8043
|
+
} while (value2 !== 0);
|
|
8044
|
+
ALPHANUMERIC.push(text);
|
|
8045
|
+
}
|
|
8046
|
+
return ALPHANUMERIC[value];
|
|
8047
|
+
}
|
|
8048
|
+
|
|
8049
|
+
// packages/qwik/src/server/scripts.ts
|
|
8050
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
|
|
8051
|
+
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
8052
|
+
function getQwikLoaderScript(opts = {}) {
|
|
8053
|
+
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8054
|
+
}
|
|
8055
|
+
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
8056
|
+
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
8057
|
+
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
8058
|
+
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
8059
|
+
}
|
|
8060
|
+
|
|
7808
8061
|
// packages/qwik/src/server/ssr-container.ts
|
|
7809
8062
|
function ssrCreateContainer(opts) {
|
|
7810
8063
|
opts.renderOptions ||= {};
|
|
@@ -7841,7 +8094,7 @@ var StringBufferWriter = class {
|
|
|
7841
8094
|
}
|
|
7842
8095
|
};
|
|
7843
8096
|
var EMPTY_OBJ2 = {};
|
|
7844
|
-
var SSRContainer = class extends
|
|
8097
|
+
var SSRContainer = class extends import_core4._SharedContainer {
|
|
7845
8098
|
tag;
|
|
7846
8099
|
writer;
|
|
7847
8100
|
timing;
|
|
@@ -7919,7 +8172,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
7919
8172
|
}
|
|
7920
8173
|
async render(jsx2) {
|
|
7921
8174
|
this.openContainer();
|
|
7922
|
-
await (0,
|
|
8175
|
+
await (0, import_core4._walkJSX)(this, jsx2, {
|
|
7923
8176
|
allowPromises: true,
|
|
7924
8177
|
currentStyleScoped: null,
|
|
7925
8178
|
parentComponentFrame: this.getComponentFrame()
|
|
@@ -8002,15 +8255,16 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8002
8255
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
8003
8256
|
}
|
|
8004
8257
|
this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
|
|
8258
|
+
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
8005
8259
|
this.write("<");
|
|
8006
8260
|
this.write(elementName);
|
|
8007
8261
|
if (varAttrs) {
|
|
8008
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false);
|
|
8262
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
8009
8263
|
}
|
|
8010
8264
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
8011
8265
|
import_build10.isDev && this.write('=""');
|
|
8012
8266
|
if (constAttrs && constAttrs.length) {
|
|
8013
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
|
|
8267
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
8014
8268
|
}
|
|
8015
8269
|
this.write(">");
|
|
8016
8270
|
this.lastNode = null;
|
|
@@ -8085,14 +8339,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8085
8339
|
}
|
|
8086
8340
|
}
|
|
8087
8341
|
openProjection(attrs) {
|
|
8088
|
-
var _a;
|
|
8089
8342
|
this.openFragment(attrs);
|
|
8090
|
-
const vNode = (_a = this.currentElementFrame) == null ? void 0 : _a.vNodeData;
|
|
8091
|
-
if (vNode) {
|
|
8092
|
-
vNode[0] |= 8 /* SERIALIZE */;
|
|
8093
|
-
}
|
|
8094
8343
|
const componentFrame = this.getComponentFrame();
|
|
8095
8344
|
if (componentFrame) {
|
|
8345
|
+
this.serializationCtx.$addRoot$(componentFrame.componentNode);
|
|
8096
8346
|
componentFrame.projectionDepth++;
|
|
8097
8347
|
}
|
|
8098
8348
|
}
|
|
@@ -8174,7 +8424,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8174
8424
|
}
|
|
8175
8425
|
for (let i = 0; i < injections.length; i++) {
|
|
8176
8426
|
const injection = injections[i];
|
|
8177
|
-
const jsxNode = (0,
|
|
8427
|
+
const jsxNode = (0, import_core4._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
|
|
8178
8428
|
if (injection.location === "head") {
|
|
8179
8429
|
this.additionalHeadNodes.push(jsxNode);
|
|
8180
8430
|
} else {
|
|
@@ -8194,7 +8444,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8194
8444
|
this.styleIds.add(styleId);
|
|
8195
8445
|
if (((_a = this.currentElementFrame) == null ? void 0 : _a.elementName) === "html") {
|
|
8196
8446
|
this.additionalHeadNodes.push(
|
|
8197
|
-
(0,
|
|
8447
|
+
(0, import_core4._jsxSorted)(
|
|
8198
8448
|
"style",
|
|
8199
8449
|
null,
|
|
8200
8450
|
{ dangerouslySetInnerHTML: content, [QStyle]: styleId },
|
|
@@ -8255,12 +8505,12 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8255
8505
|
for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
|
|
8256
8506
|
const vNode = vNodeData[elementIdx];
|
|
8257
8507
|
const flag = vNode[0];
|
|
8258
|
-
if (flag &
|
|
8508
|
+
if (flag & 16 /* SERIALIZE */) {
|
|
8259
8509
|
lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
|
|
8260
|
-
if (flag &
|
|
8510
|
+
if (flag & 8 /* REFERENCE */) {
|
|
8261
8511
|
this.write(VNodeDataSeparator.REFERENCE_CH);
|
|
8262
8512
|
}
|
|
8263
|
-
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
|
|
8513
|
+
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
|
|
8264
8514
|
let fragmentAttrs = null;
|
|
8265
8515
|
let depth = 0;
|
|
8266
8516
|
for (let i = 1; i < vNode.length; i++) {
|
|
@@ -8278,6 +8528,13 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8278
8528
|
}
|
|
8279
8529
|
depth--;
|
|
8280
8530
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
8531
|
+
} else if (value === WRITE_ELEMENT_ATTRS) {
|
|
8532
|
+
if (fragmentAttrs && fragmentAttrs.length) {
|
|
8533
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8534
|
+
writeFragmentAttrs(this.write.bind(this), this.addRoot.bind(this), fragmentAttrs);
|
|
8535
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8536
|
+
fragmentAttrs = vNodeAttrsStack.pop();
|
|
8537
|
+
}
|
|
8281
8538
|
} else if (value >= 0) {
|
|
8282
8539
|
this.write(encodeAsAlphanumeric(value));
|
|
8283
8540
|
} else {
|
|
@@ -8330,6 +8587,9 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8330
8587
|
case ELEMENT_SEQ_IDX:
|
|
8331
8588
|
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
8332
8589
|
break;
|
|
8590
|
+
case QSubscribers:
|
|
8591
|
+
write(VNodeDataChar.SUBS_CHAR);
|
|
8592
|
+
break;
|
|
8333
8593
|
// Skipping `\` character for now because it is used for escaping.
|
|
8334
8594
|
case QCtxAttr:
|
|
8335
8595
|
write(VNodeDataChar.CONTEXT_CHAR);
|
|
@@ -8534,10 +8794,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8534
8794
|
);
|
|
8535
8795
|
const lastNode = this.getLastNode();
|
|
8536
8796
|
if (lastNode.vnodeData) {
|
|
8537
|
-
lastNode.vnodeData[0] |=
|
|
8797
|
+
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
8538
8798
|
}
|
|
8539
8799
|
ssrComponentNode == null ? void 0 : ssrComponentNode.setProp(value, lastNode.id);
|
|
8540
|
-
await (0,
|
|
8800
|
+
await (0, import_core4._walkJSX)(this, children, {
|
|
8541
8801
|
allowPromises: true,
|
|
8542
8802
|
currentStyleScoped: scopedStyleId,
|
|
8543
8803
|
parentComponentFrame: null
|
|
@@ -8648,7 +8908,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8648
8908
|
this.write(element);
|
|
8649
8909
|
}
|
|
8650
8910
|
}
|
|
8651
|
-
writeAttrs(tag, attrs, isConst) {
|
|
8911
|
+
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
8652
8912
|
let innerHTML = void 0;
|
|
8653
8913
|
if (attrs.length) {
|
|
8654
8914
|
for (let i = 0; i < attrs.length; i++) {
|
|
@@ -8657,7 +8917,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8657
8917
|
let styleScopedId = null;
|
|
8658
8918
|
if (isSSRUnsafeAttr(key)) {
|
|
8659
8919
|
if (import_build10.isDev) {
|
|
8660
|
-
throw
|
|
8920
|
+
throw qError(51 /* unsafeAttr */);
|
|
8661
8921
|
}
|
|
8662
8922
|
continue;
|
|
8663
8923
|
}
|
|
@@ -8668,17 +8928,19 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8668
8928
|
}
|
|
8669
8929
|
if (key === "ref") {
|
|
8670
8930
|
const lastNode = this.getLastNode();
|
|
8671
|
-
if ((0,
|
|
8931
|
+
if ((0, import_core4.isSignal)(value)) {
|
|
8672
8932
|
value.value = new DomRef(lastNode);
|
|
8673
8933
|
continue;
|
|
8674
8934
|
} else if (typeof value === "function") {
|
|
8675
8935
|
value(new DomRef(lastNode));
|
|
8676
8936
|
continue;
|
|
8937
|
+
} else {
|
|
8938
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
8677
8939
|
}
|
|
8678
8940
|
}
|
|
8679
|
-
if ((0,
|
|
8941
|
+
if ((0, import_core4.isSignal)(value)) {
|
|
8680
8942
|
const lastNode = this.getLastNode();
|
|
8681
|
-
const signalData = new
|
|
8943
|
+
const signalData = new import_core4._EffectData({
|
|
8682
8944
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
8683
8945
|
$isConst$: isConst
|
|
8684
8946
|
});
|
|
@@ -8693,13 +8955,13 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8693
8955
|
}
|
|
8694
8956
|
}
|
|
8695
8957
|
if (tag === "textarea" && key === "value") {
|
|
8696
|
-
if (typeof value !== "string") {
|
|
8958
|
+
if (value && typeof value !== "string") {
|
|
8697
8959
|
if (import_build10.isDev) {
|
|
8698
|
-
throw
|
|
8960
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
8699
8961
|
}
|
|
8700
8962
|
continue;
|
|
8701
8963
|
}
|
|
8702
|
-
innerHTML = escapeHTML(value);
|
|
8964
|
+
innerHTML = escapeHTML(value || "");
|
|
8703
8965
|
key = QContainerAttr;
|
|
8704
8966
|
value = "text" /* TEXT */;
|
|
8705
8967
|
}
|
|
@@ -8731,7 +8993,7 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
8731
8993
|
return false;
|
|
8732
8994
|
};
|
|
8733
8995
|
function newTagError(text) {
|
|
8734
|
-
return
|
|
8996
|
+
return qError(29 /* tagError */, [text]);
|
|
8735
8997
|
}
|
|
8736
8998
|
function hasDestroy(obj) {
|
|
8737
8999
|
return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
|
|
@@ -8947,22 +9209,10 @@ function resolveManifest(manifest) {
|
|
|
8947
9209
|
}
|
|
8948
9210
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8949
9211
|
|
|
8950
|
-
// packages/qwik/src/server/scripts.ts
|
|
8951
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
|
|
8952
|
-
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
8953
|
-
function getQwikLoaderScript(opts = {}) {
|
|
8954
|
-
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8955
|
-
}
|
|
8956
|
-
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
8957
|
-
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
8958
|
-
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
8959
|
-
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
8960
|
-
}
|
|
8961
|
-
|
|
8962
9212
|
// packages/qwik/src/server/index.ts
|
|
8963
9213
|
async function setServerPlatform2(manifest) {
|
|
8964
9214
|
const platform = createPlatform({ manifest }, resolveManifest(manifest));
|
|
8965
|
-
(0,
|
|
9215
|
+
(0, import_core5.setPlatform)(platform);
|
|
8966
9216
|
}
|
|
8967
9217
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8968
9218
|
0 && (module.exports = {
|