@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.mjs
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
|
|
@@ -125,7 +125,7 @@ var logWarn = (message, ...optionalParams) => {
|
|
|
125
125
|
};
|
|
126
126
|
var createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
127
127
|
const err = message instanceof Error ? message : new Error(message);
|
|
128
|
-
console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
128
|
+
!qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
|
|
129
129
|
asyncThrow && !qTest && setTimeout(() => {
|
|
130
130
|
throw err;
|
|
131
131
|
}, 0);
|
|
@@ -138,24 +138,24 @@ var codeToText = (code, ...parts) => {
|
|
|
138
138
|
const MAP = [
|
|
139
139
|
"Error while serializing class or style attributes",
|
|
140
140
|
// 0
|
|
141
|
-
"
|
|
142
|
-
// 1
|
|
143
|
-
"
|
|
144
|
-
// 2
|
|
145
|
-
"Only primitive and object literals can be serialized",
|
|
141
|
+
"",
|
|
142
|
+
// 1 unused
|
|
143
|
+
"",
|
|
144
|
+
// 2 unused
|
|
145
|
+
"Only primitive and object literals can be serialized. {{0}}",
|
|
146
146
|
// 3
|
|
147
|
-
"
|
|
148
|
-
// 4
|
|
147
|
+
"",
|
|
148
|
+
// 4 unused
|
|
149
149
|
"You can render over a existing q:container. Skipping render().",
|
|
150
150
|
// 5
|
|
151
|
-
"
|
|
152
|
-
// 6
|
|
153
|
-
"
|
|
154
|
-
// 7
|
|
155
|
-
"
|
|
156
|
-
// 8
|
|
157
|
-
|
|
158
|
-
// 9
|
|
151
|
+
"",
|
|
152
|
+
// 6 unused
|
|
153
|
+
"",
|
|
154
|
+
// 7 unused
|
|
155
|
+
"",
|
|
156
|
+
// 8 unused
|
|
157
|
+
"",
|
|
158
|
+
// 9 unused
|
|
159
159
|
"QRL is not a function",
|
|
160
160
|
// 10
|
|
161
161
|
"Dynamic import not found",
|
|
@@ -166,43 +166,81 @@ var codeToText = (code, ...parts) => {
|
|
|
166
166
|
// 13
|
|
167
167
|
"Invoking 'use*()' method outside of invocation context.",
|
|
168
168
|
// 14
|
|
169
|
-
"
|
|
170
|
-
// 15
|
|
171
|
-
"
|
|
172
|
-
// 16
|
|
173
|
-
"
|
|
174
|
-
// 17
|
|
175
|
-
"
|
|
176
|
-
// 18
|
|
177
|
-
"
|
|
178
|
-
// 19
|
|
169
|
+
"",
|
|
170
|
+
// 15 unused
|
|
171
|
+
"",
|
|
172
|
+
// 16 unused
|
|
173
|
+
"",
|
|
174
|
+
// 17 unused
|
|
175
|
+
"",
|
|
176
|
+
// 18 unused
|
|
177
|
+
"",
|
|
178
|
+
// 19 unused
|
|
179
179
|
`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.
|
|
180
180
|
See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
181
181
|
// 20
|
|
182
|
-
"Container is already paused. Skipping",
|
|
183
|
-
// 21
|
|
184
182
|
"",
|
|
185
|
-
//
|
|
186
|
-
"
|
|
187
|
-
//
|
|
188
|
-
"
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
"
|
|
193
|
-
//
|
|
194
|
-
"
|
|
195
|
-
//
|
|
183
|
+
// 21 unused
|
|
184
|
+
"",
|
|
185
|
+
// 22 unused
|
|
186
|
+
"",
|
|
187
|
+
// 23 unused
|
|
188
|
+
"",
|
|
189
|
+
// 24 unused
|
|
190
|
+
"",
|
|
191
|
+
// 25 unused
|
|
192
|
+
"",
|
|
193
|
+
// 26 unused
|
|
194
|
+
"",
|
|
195
|
+
// 27 unused
|
|
196
196
|
'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
|
|
197
197
|
// 28
|
|
198
|
-
"
|
|
198
|
+
"SsrError(tag): {{0}}",
|
|
199
199
|
// 29
|
|
200
200
|
"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.",
|
|
201
201
|
// 30
|
|
202
202
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
203
203
|
// 31
|
|
204
|
-
"
|
|
204
|
+
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
205
205
|
// 32
|
|
206
|
+
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
207
|
+
// 33
|
|
208
|
+
"Serialization Error: Expected vnode for ref prop, but got {{0}}",
|
|
209
|
+
// 34
|
|
210
|
+
"Serialization Error: Cannot allocate data type {{0}}",
|
|
211
|
+
// 35
|
|
212
|
+
"Serialization Error: Missing root id for {{0}}",
|
|
213
|
+
// 36
|
|
214
|
+
"Serialization Error: Serialization of data type {{0}} is not implemented",
|
|
215
|
+
// 37
|
|
216
|
+
"Serialization Error: Unvisited {{0}}",
|
|
217
|
+
// 38
|
|
218
|
+
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
219
|
+
// 39
|
|
220
|
+
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
221
|
+
// 40
|
|
222
|
+
"Unable to find q:container",
|
|
223
|
+
// 41
|
|
224
|
+
"Element must have 'q:container' attribute.",
|
|
225
|
+
// 42
|
|
226
|
+
"Unknown vnode type {{0}}.",
|
|
227
|
+
// 43
|
|
228
|
+
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
229
|
+
// 44
|
|
230
|
+
"SsrError: {{0}}",
|
|
231
|
+
// 45
|
|
232
|
+
"Cannot coerce a Signal, use `.value` instead",
|
|
233
|
+
// 46
|
|
234
|
+
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
|
|
235
|
+
// 47
|
|
236
|
+
"ComputedSignal is read-only",
|
|
237
|
+
// 48
|
|
238
|
+
"WrappedSignal is read-only",
|
|
239
|
+
// 49
|
|
240
|
+
"SsrError: Promises not expected here.",
|
|
241
|
+
// 50
|
|
242
|
+
"Attribute value is unsafe for SSR"
|
|
243
|
+
// 51
|
|
206
244
|
];
|
|
207
245
|
let text = MAP[code] ?? "";
|
|
208
246
|
if (parts.length) {
|
|
@@ -214,19 +252,14 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
214
252
|
return v;
|
|
215
253
|
});
|
|
216
254
|
}
|
|
217
|
-
return `Code(${code}): ${text}`;
|
|
255
|
+
return `Code(Q${code}): ${text}`;
|
|
218
256
|
} else {
|
|
219
|
-
return `Code(${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
257
|
+
return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
220
258
|
}
|
|
221
259
|
};
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var QError_qrlMissingContainer = 30;
|
|
226
|
-
var QError_qrlMissingChunk = 31;
|
|
227
|
-
var qError = (code, ...parts) => {
|
|
228
|
-
const text = codeToText(code, ...parts);
|
|
229
|
-
return logErrorAndStop(text, ...parts);
|
|
260
|
+
var qError = (code, errorMessageArgs = []) => {
|
|
261
|
+
const text = codeToText(code, ...errorMessageArgs);
|
|
262
|
+
return logErrorAndStop(text, ...errorMessageArgs);
|
|
230
263
|
};
|
|
231
264
|
|
|
232
265
|
// packages/qwik/src/core/shared/utils/event-names.ts
|
|
@@ -405,7 +438,7 @@ var isUnitlessNumber = (name) => {
|
|
|
405
438
|
};
|
|
406
439
|
|
|
407
440
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
408
|
-
import { isDev as
|
|
441
|
+
import { isDev as isDev7 } from "@qwik.dev/core/build";
|
|
409
442
|
|
|
410
443
|
// packages/qwik/src/core/shared/error/assert.ts
|
|
411
444
|
var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
|
|
@@ -464,10 +497,10 @@ var createPlatform2 = () => {
|
|
|
464
497
|
}
|
|
465
498
|
}
|
|
466
499
|
if (!url) {
|
|
467
|
-
throw qError(
|
|
500
|
+
throw qError(31 /* qrlMissingChunk */, [symbolName]);
|
|
468
501
|
}
|
|
469
502
|
if (!containerEl) {
|
|
470
|
-
throw qError(
|
|
503
|
+
throw qError(30 /* qrlMissingContainer */, [url, symbolName]);
|
|
471
504
|
}
|
|
472
505
|
const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
|
|
473
506
|
const urlCopy = new URL(urlDoc);
|
|
@@ -544,7 +577,7 @@ var maybeThenPassError = (valueOrPromise, thenFn) => {
|
|
|
544
577
|
return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
|
|
545
578
|
};
|
|
546
579
|
var shouldNotError = (reason) => {
|
|
547
|
-
throwErrorAndStop(
|
|
580
|
+
throwErrorAndStop(reason);
|
|
548
581
|
};
|
|
549
582
|
var delay = (timeout) => {
|
|
550
583
|
return new Promise((resolve) => {
|
|
@@ -565,259 +598,6 @@ function retryOnPromise(fn, retryCount = 0) {
|
|
|
565
598
|
// packages/qwik/src/build/index.dev.ts
|
|
566
599
|
var isDev = true;
|
|
567
600
|
|
|
568
|
-
// packages/qwik/src/server/ssr-node.ts
|
|
569
|
-
import { _isJSXNode as isJSXNode, _EMPTY_ARRAY } from "@qwik.dev/core";
|
|
570
|
-
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
571
|
-
var SsrNode = class {
|
|
572
|
-
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
|
|
573
|
-
this.attrs = attrs;
|
|
574
|
-
this.cleanupQueue = cleanupQueue;
|
|
575
|
-
this.vnodeData = vnodeData;
|
|
576
|
-
__publicField(this, "__brand__");
|
|
577
|
-
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
|
|
578
|
-
__publicField(this, "nodeType");
|
|
579
|
-
/**
|
|
580
|
-
* ID which the deserialize will use to retrieve the node.
|
|
581
|
-
*
|
|
582
|
-
* @param refId - Unique id for the node.
|
|
583
|
-
*/
|
|
584
|
-
__publicField(this, "id");
|
|
585
|
-
/** Local props which don't serialize; */
|
|
586
|
-
__publicField(this, "locals", null);
|
|
587
|
-
__publicField(this, "currentComponentNode");
|
|
588
|
-
__publicField(this, "childrenVNodeData", null);
|
|
589
|
-
this.currentComponentNode = currentComponentNode;
|
|
590
|
-
this.currentComponentNode?.addChildVNodeData(this.vnodeData);
|
|
591
|
-
this.nodeType = nodeType;
|
|
592
|
-
this.id = id;
|
|
593
|
-
if (isDev2 && id.indexOf("undefined") != -1) {
|
|
594
|
-
throw new Error(`Invalid SSR node id: ${id}`);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
setProp(name, value) {
|
|
598
|
-
if (this.attrs === _EMPTY_ARRAY) {
|
|
599
|
-
this.attrs = [];
|
|
600
|
-
}
|
|
601
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
602
|
-
mapArray_set(this.locals || (this.locals = []), name, value, 0);
|
|
603
|
-
} else {
|
|
604
|
-
mapArray_set(this.attrs, name, value, 0);
|
|
605
|
-
}
|
|
606
|
-
if (name == ELEMENT_SEQ && value) {
|
|
607
|
-
this.cleanupQueue.push(value);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
getProp(name) {
|
|
611
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
612
|
-
return this.locals ? mapArray_get(this.locals, name, 0) : null;
|
|
613
|
-
} else {
|
|
614
|
-
return mapArray_get(this.attrs, name, 0);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
removeProp(name) {
|
|
618
|
-
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
619
|
-
if (this.locals) {
|
|
620
|
-
mapApp_remove(this.locals, name, 0);
|
|
621
|
-
}
|
|
622
|
-
} else {
|
|
623
|
-
mapApp_remove(this.attrs, name, 0);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
addChildVNodeData(child) {
|
|
627
|
-
if (!this.childrenVNodeData) {
|
|
628
|
-
this.childrenVNodeData = [];
|
|
629
|
-
}
|
|
630
|
-
this.childrenVNodeData.push(child);
|
|
631
|
-
}
|
|
632
|
-
toString() {
|
|
633
|
-
let stringifiedAttrs = "";
|
|
634
|
-
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
635
|
-
const key = this.attrs[i];
|
|
636
|
-
const value = this.attrs[i + 1];
|
|
637
|
-
stringifiedAttrs += `${key}=`;
|
|
638
|
-
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
639
|
-
if (i < this.attrs.length - 2) {
|
|
640
|
-
stringifiedAttrs += ", ";
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
__publicField(SsrNode, "ELEMENT_NODE", 1);
|
|
647
|
-
__publicField(SsrNode, "TEXT_NODE", 3);
|
|
648
|
-
__publicField(SsrNode, "DOCUMENT_NODE", 9);
|
|
649
|
-
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
|
|
650
|
-
var DomRef = class {
|
|
651
|
-
constructor($ssrNode$) {
|
|
652
|
-
this.$ssrNode$ = $ssrNode$;
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
var SsrComponentFrame = class {
|
|
656
|
-
constructor(componentNode) {
|
|
657
|
-
this.componentNode = componentNode;
|
|
658
|
-
__publicField(this, "slots", []);
|
|
659
|
-
__publicField(this, "projectionDepth", 0);
|
|
660
|
-
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
|
|
661
|
-
__publicField(this, "projectionScopedStyle", null);
|
|
662
|
-
__publicField(this, "projectionComponentFrame", null);
|
|
663
|
-
}
|
|
664
|
-
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
665
|
-
this.projectionScopedStyle = projectionScopedStyle;
|
|
666
|
-
this.projectionComponentFrame = projectionComponentFrame;
|
|
667
|
-
if (isJSXNode(children)) {
|
|
668
|
-
const slotName = this.getSlotName(children);
|
|
669
|
-
mapArray_set(this.slots, slotName, children, 0);
|
|
670
|
-
} else if (Array.isArray(children)) {
|
|
671
|
-
const defaultSlot = [];
|
|
672
|
-
for (let i = 0; i < children.length; i++) {
|
|
673
|
-
const child = children[i];
|
|
674
|
-
if (isJSXNode(child)) {
|
|
675
|
-
const slotName = this.getSlotName(child);
|
|
676
|
-
if (slotName === QDefaultSlot) {
|
|
677
|
-
defaultSlot.push(child);
|
|
678
|
-
} else {
|
|
679
|
-
this.updateSlot(slotName, child);
|
|
680
|
-
}
|
|
681
|
-
} else {
|
|
682
|
-
defaultSlot.push(child);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
686
|
-
} else {
|
|
687
|
-
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
updateSlot(slotName, child) {
|
|
691
|
-
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
692
|
-
if (existingSlots === null) {
|
|
693
|
-
existingSlots = child;
|
|
694
|
-
} else if (Array.isArray(existingSlots)) {
|
|
695
|
-
existingSlots.push(child);
|
|
696
|
-
} else {
|
|
697
|
-
existingSlots = [existingSlots, child];
|
|
698
|
-
}
|
|
699
|
-
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
700
|
-
}
|
|
701
|
-
getSlotName(jsx2) {
|
|
702
|
-
if (jsx2.props[QSlot]) {
|
|
703
|
-
return jsx2.props[QSlot];
|
|
704
|
-
}
|
|
705
|
-
return QDefaultSlot;
|
|
706
|
-
}
|
|
707
|
-
hasSlot(slotName) {
|
|
708
|
-
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
709
|
-
}
|
|
710
|
-
consumeChildrenForSlot(projectionNode, slotName) {
|
|
711
|
-
const children = mapApp_remove(this.slots, slotName, 0);
|
|
712
|
-
if (children !== null) {
|
|
713
|
-
this.componentNode.setProp(slotName, projectionNode.id);
|
|
714
|
-
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
715
|
-
}
|
|
716
|
-
return children;
|
|
717
|
-
}
|
|
718
|
-
releaseUnclaimedProjections(unclaimedProjections) {
|
|
719
|
-
if (this.slots.length) {
|
|
720
|
-
unclaimedProjections.push(this);
|
|
721
|
-
unclaimedProjections.push(this.projectionScopedStyle);
|
|
722
|
-
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
// packages/qwik/src/server/vnode-data.ts
|
|
728
|
-
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
729
|
-
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
730
|
-
var EMPTY_ARRAY = [];
|
|
731
|
-
function vNodeData_incrementElementCount(vNodeData) {
|
|
732
|
-
const length = vNodeData.length;
|
|
733
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
734
|
-
if (lastValue >= 0) {
|
|
735
|
-
vNodeData.push(-1);
|
|
736
|
-
} else {
|
|
737
|
-
vNodeData[length - 1] = lastValue - 1;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
function vNodeData_addTextSize(vNodeData, size) {
|
|
741
|
-
const length = vNodeData.length;
|
|
742
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
743
|
-
if (length > 1 && lastValue >= 0) {
|
|
744
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
745
|
-
}
|
|
746
|
-
vNodeData.push(size);
|
|
747
|
-
if (size == 0) {
|
|
748
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
function vNodeData_openFragment(vNodeData, attrs) {
|
|
752
|
-
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
753
|
-
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
754
|
-
}
|
|
755
|
-
function vNodeData_closeFragment(vNodeData) {
|
|
756
|
-
vNodeData.push(CLOSE_FRAGMENT);
|
|
757
|
-
}
|
|
758
|
-
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
759
|
-
vNodeData[0] |= 4 /* REFERENCE */;
|
|
760
|
-
if (vNodeData.length == 1) {
|
|
761
|
-
return new SsrNode(
|
|
762
|
-
currentComponentNode,
|
|
763
|
-
SsrNode.ELEMENT_NODE,
|
|
764
|
-
String(depthFirstElementIdx),
|
|
765
|
-
EMPTY_ARRAY,
|
|
766
|
-
cleanupQueue,
|
|
767
|
-
vNodeData
|
|
768
|
-
);
|
|
769
|
-
} else {
|
|
770
|
-
let fragmentAttrs = EMPTY_ARRAY;
|
|
771
|
-
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
772
|
-
for (let i = 1; i < vNodeData.length; i++) {
|
|
773
|
-
const value = vNodeData[i];
|
|
774
|
-
if (Array.isArray(value)) {
|
|
775
|
-
fragmentAttrs = value;
|
|
776
|
-
i++;
|
|
777
|
-
stack2[stack2.length - 1]++;
|
|
778
|
-
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
779
|
-
} else if (value === CLOSE_FRAGMENT) {
|
|
780
|
-
stack2.pop();
|
|
781
|
-
stack2.pop();
|
|
782
|
-
fragmentAttrs = EMPTY_ARRAY;
|
|
783
|
-
} else if (value < 0) {
|
|
784
|
-
const numberOfElements = 0 - value;
|
|
785
|
-
stack2[stack2.length - 1] += numberOfElements;
|
|
786
|
-
} else {
|
|
787
|
-
stack2[stack2.length - 1]++;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
let refId = String(depthFirstElementIdx);
|
|
791
|
-
for (let i = 1; i < stack2.length; i += 2) {
|
|
792
|
-
const childCount = stack2[i];
|
|
793
|
-
if (childCount >= 0) {
|
|
794
|
-
refId += encodeAsAlphanumeric(childCount);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
const type = stack2[stack2.length - 2];
|
|
798
|
-
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
var ALPHANUMERIC = [];
|
|
802
|
-
function encodeAsAlphanumeric(value) {
|
|
803
|
-
while (ALPHANUMERIC.length <= value) {
|
|
804
|
-
let value2 = ALPHANUMERIC.length;
|
|
805
|
-
let text = "";
|
|
806
|
-
do {
|
|
807
|
-
text = String.fromCharCode(
|
|
808
|
-
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
809
|
-
/* A-Z */
|
|
810
|
-
) + text;
|
|
811
|
-
value2 = Math.floor(
|
|
812
|
-
value2 / 26
|
|
813
|
-
/* A-Z */
|
|
814
|
-
);
|
|
815
|
-
} while (value2 !== 0);
|
|
816
|
-
ALPHANUMERIC.push(text);
|
|
817
|
-
}
|
|
818
|
-
return ALPHANUMERIC[value];
|
|
819
|
-
}
|
|
820
|
-
|
|
821
601
|
// packages/qwik/src/core/shared/types.ts
|
|
822
602
|
var DEBUG_TYPE = "q:type";
|
|
823
603
|
var START = "\x1B[34m";
|
|
@@ -905,6 +685,7 @@ var ELEMENT_KEY = "q:key";
|
|
|
905
685
|
var ELEMENT_PROPS = "q:props";
|
|
906
686
|
var ELEMENT_SEQ = "q:seq";
|
|
907
687
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
688
|
+
var Q_PREFIX = "q:";
|
|
908
689
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
909
690
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
910
691
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
@@ -922,7 +703,7 @@ function setLocale(locale) {
|
|
|
922
703
|
}
|
|
923
704
|
|
|
924
705
|
// packages/qwik/src/core/client/vnode.ts
|
|
925
|
-
import { isDev as
|
|
706
|
+
import { isDev as isDev6 } from "@qwik.dev/core/build";
|
|
926
707
|
|
|
927
708
|
// packages/qwik/src/server/utils.ts
|
|
928
709
|
function createTimer() {
|
|
@@ -950,12 +731,12 @@ function getBuildBase(opts) {
|
|
|
950
731
|
return `${import.meta.env.BASE_URL}build/`;
|
|
951
732
|
}
|
|
952
733
|
var versions = {
|
|
953
|
-
qwik: "2.0.0-alpha.
|
|
734
|
+
qwik: "2.0.0-alpha.5-dev+cb53bbd",
|
|
954
735
|
qwikDom: "2.1.19"
|
|
955
736
|
};
|
|
956
737
|
|
|
957
738
|
// packages/qwik/src/server/prefetch-strategy.ts
|
|
958
|
-
import { isDev as
|
|
739
|
+
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
959
740
|
function getPrefetchResources(qrls, opts, resolvedManifest) {
|
|
960
741
|
if (!resolvedManifest) {
|
|
961
742
|
return [];
|
|
@@ -993,7 +774,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
|
|
|
993
774
|
return prefetchResources;
|
|
994
775
|
}
|
|
995
776
|
function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
|
|
996
|
-
const url =
|
|
777
|
+
const url = isDev2 ? bundleFileName : buildBase + bundleFileName;
|
|
997
778
|
let prefetchResource = urls.get(url);
|
|
998
779
|
if (!prefetchResource) {
|
|
999
780
|
prefetchResource = {
|
|
@@ -1017,13 +798,13 @@ var isQrl = (value) => {
|
|
|
1017
798
|
};
|
|
1018
799
|
|
|
1019
800
|
// packages/qwik/src/core/shared/utils/flyweight.ts
|
|
1020
|
-
var
|
|
801
|
+
var EMPTY_ARRAY = [];
|
|
1021
802
|
var EMPTY_OBJ = {};
|
|
1022
|
-
Object.freeze(
|
|
803
|
+
Object.freeze(EMPTY_ARRAY);
|
|
1023
804
|
Object.freeze(EMPTY_OBJ);
|
|
1024
805
|
|
|
1025
806
|
// packages/qwik/src/core/ssr/ssr-render-jsx.ts
|
|
1026
|
-
import { isDev as
|
|
807
|
+
import { isDev as isDev5 } from "@qwik.dev/core/build";
|
|
1027
808
|
|
|
1028
809
|
// packages/qwik/src/core/shared/jsx/slot.public.ts
|
|
1029
810
|
var Slot = (props) => {
|
|
@@ -1116,7 +897,6 @@ var StoreHandler = class {
|
|
|
1116
897
|
}
|
|
1117
898
|
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
1118
899
|
set(target, prop, value) {
|
|
1119
|
-
target = unwrapDeserializerProxy(target);
|
|
1120
900
|
if (typeof prop === "symbol") {
|
|
1121
901
|
target[prop] = value;
|
|
1122
902
|
return true;
|
|
@@ -1184,6 +964,11 @@ function addEffect(target, prop, store, effectSubscriber) {
|
|
|
1184
964
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
1185
965
|
ensureContainsEffect(effects, effectSubscriber);
|
|
1186
966
|
ensureContains(effectSubscriber, target);
|
|
967
|
+
ensureEffectContainsSubscriber(
|
|
968
|
+
effectSubscriber[0 /* EFFECT */],
|
|
969
|
+
target,
|
|
970
|
+
store.$container$
|
|
971
|
+
);
|
|
1187
972
|
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
1188
973
|
}
|
|
1189
974
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -1213,48 +998,118 @@ var Subscriber = class {
|
|
|
1213
998
|
function isSubscriber(value) {
|
|
1214
999
|
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
1215
1000
|
}
|
|
1216
|
-
function clearVNodeEffectDependencies(value) {
|
|
1217
|
-
|
|
1001
|
+
function clearVNodeEffectDependencies(container, value) {
|
|
1002
|
+
if (vnode_isElementVNode(value)) {
|
|
1003
|
+
ensureMaterialized(value);
|
|
1004
|
+
}
|
|
1005
|
+
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
1218
1006
|
if (!effects) {
|
|
1219
1007
|
return;
|
|
1220
1008
|
}
|
|
1221
1009
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1222
1010
|
const subscriber = effects[i];
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1011
|
+
clearEffects(subscriber, value, effects, i, container);
|
|
1012
|
+
}
|
|
1013
|
+
if (effects.length === 0) {
|
|
1014
|
+
vnode_setProp(value, QSubscribers, null);
|
|
1227
1015
|
}
|
|
1228
1016
|
}
|
|
1229
|
-
function clearSubscriberEffectDependencies(value) {
|
|
1017
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
1230
1018
|
if (value.$effectDependencies$) {
|
|
1231
1019
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
1232
1020
|
const subscriber = value.$effectDependencies$[i];
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1021
|
+
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
1022
|
+
}
|
|
1023
|
+
if (value.$effectDependencies$.length === 0) {
|
|
1024
|
+
value.$effectDependencies$ = null;
|
|
1237
1025
|
}
|
|
1238
1026
|
}
|
|
1239
1027
|
}
|
|
1240
|
-
function clearEffects(subscriber, value) {
|
|
1241
|
-
|
|
1242
|
-
|
|
1028
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
1029
|
+
let subscriptionRemoved = false;
|
|
1030
|
+
const seenSet = /* @__PURE__ */ new Set();
|
|
1031
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1032
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
1033
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
1034
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
1035
|
+
const handler = getStoreHandler(store);
|
|
1036
|
+
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
1037
|
+
}
|
|
1038
|
+
if (subscriptionRemoved) {
|
|
1039
|
+
effectArray.splice(indexToRemove, 1);
|
|
1243
1040
|
}
|
|
1041
|
+
}
|
|
1042
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
1244
1043
|
const effectSubscriptions = subscriber.$effects$;
|
|
1044
|
+
let subscriptionRemoved = false;
|
|
1045
|
+
if (effectSubscriptions) {
|
|
1046
|
+
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
1047
|
+
const effect = effectSubscriptions[i];
|
|
1048
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1049
|
+
effectSubscriptions.splice(i, 1);
|
|
1050
|
+
subscriptionRemoved = true;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1055
|
+
const hostElement = subscriber.$hostElement$;
|
|
1056
|
+
if (hostElement && hostElement === value) {
|
|
1057
|
+
subscriber.$hostElement$ = null;
|
|
1058
|
+
}
|
|
1059
|
+
const args = subscriber.$args$;
|
|
1060
|
+
if (args) {
|
|
1061
|
+
clearArgsEffects(args, subscriber, seenSet);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return subscriptionRemoved;
|
|
1065
|
+
}
|
|
1066
|
+
function clearStoreEffects(storeHandler, value) {
|
|
1067
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
1245
1068
|
if (!effectSubscriptions) {
|
|
1246
1069
|
return false;
|
|
1247
1070
|
}
|
|
1248
1071
|
let subscriptionRemoved = false;
|
|
1249
|
-
for (
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1072
|
+
for (const key in effectSubscriptions) {
|
|
1073
|
+
const effects = effectSubscriptions[key];
|
|
1074
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1075
|
+
const effect = effects[i];
|
|
1076
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1077
|
+
effects.splice(i, 1);
|
|
1078
|
+
subscriptionRemoved = true;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (effects.length === 0) {
|
|
1082
|
+
delete effectSubscriptions[key];
|
|
1254
1083
|
}
|
|
1255
1084
|
}
|
|
1256
1085
|
return subscriptionRemoved;
|
|
1257
1086
|
}
|
|
1087
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
1088
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1089
|
+
const arg = args[i];
|
|
1090
|
+
clearArgEffect(arg, subscriber, seenSet);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
1094
|
+
if (seenSet.has(arg)) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
seenSet.add(arg);
|
|
1098
|
+
if (isSignal(arg)) {
|
|
1099
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
1100
|
+
} else if (typeof arg === "object" && arg !== null) {
|
|
1101
|
+
if (isStore(arg)) {
|
|
1102
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
1103
|
+
} else {
|
|
1104
|
+
for (const key in arg) {
|
|
1105
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
} else if (Array.isArray(arg)) {
|
|
1109
|
+
clearArgsEffects(arg, subscriber, seenSet);
|
|
1110
|
+
} else {
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1258
1113
|
|
|
1259
1114
|
// packages/qwik/src/core/use/use-resource.ts
|
|
1260
1115
|
var _createResourceReturn = (opts) => {
|
|
@@ -1280,7 +1135,7 @@ var runResource = (task, container, host) => {
|
|
|
1280
1135
|
cleanupTask(task);
|
|
1281
1136
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
1282
1137
|
iCtx.$container$ = container;
|
|
1283
|
-
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
|
|
1138
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
|
|
1284
1139
|
const resource = task.$state$;
|
|
1285
1140
|
assertDefined(
|
|
1286
1141
|
resource,
|
|
@@ -1404,7 +1259,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
|
|
|
1404
1259
|
};
|
|
1405
1260
|
|
|
1406
1261
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1407
|
-
import { isDev as
|
|
1262
|
+
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
1408
1263
|
|
|
1409
1264
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
1410
1265
|
var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
|
|
@@ -1576,7 +1431,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
1576
1431
|
}
|
|
1577
1432
|
|
|
1578
1433
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
1579
|
-
import { isDev as
|
|
1434
|
+
import { isDev as isDev3 } from "@qwik.dev/core/build";
|
|
1580
1435
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1581
1436
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
|
|
1582
1437
|
iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
|
|
@@ -1612,7 +1467,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1612
1467
|
}
|
|
1613
1468
|
}
|
|
1614
1469
|
if (vnode_isVNode(renderHost)) {
|
|
1615
|
-
clearVNodeEffectDependencies(renderHost);
|
|
1470
|
+
clearVNodeEffectDependencies(container, renderHost);
|
|
1616
1471
|
}
|
|
1617
1472
|
return componentFn(props);
|
|
1618
1473
|
},
|
|
@@ -1655,7 +1510,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
1655
1510
|
if (jsxElement2) {
|
|
1656
1511
|
addUseOnEvent(jsxElement2, key, useOnEvents[key]);
|
|
1657
1512
|
}
|
|
1658
|
-
} else if (
|
|
1513
|
+
} else if (isDev3) {
|
|
1659
1514
|
logWarn(
|
|
1660
1515
|
'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. '
|
|
1661
1516
|
);
|
|
@@ -1686,7 +1541,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1686
1541
|
const queue = [jsx2];
|
|
1687
1542
|
while (queue.length) {
|
|
1688
1543
|
const jsx3 = queue.shift();
|
|
1689
|
-
if (
|
|
1544
|
+
if (isJSXNode(jsx3)) {
|
|
1690
1545
|
if (typeof jsx3.type === "string") {
|
|
1691
1546
|
return jsx3;
|
|
1692
1547
|
}
|
|
@@ -1705,7 +1560,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1705
1560
|
return null;
|
|
1706
1561
|
}
|
|
1707
1562
|
function addScriptNodeForInvisibleComponents(jsx2) {
|
|
1708
|
-
if (
|
|
1563
|
+
if (isJSXNode(jsx2)) {
|
|
1709
1564
|
const jsxElement = new JSXNodeImpl(
|
|
1710
1565
|
"script",
|
|
1711
1566
|
{},
|
|
@@ -1768,6 +1623,18 @@ function escapeHTML(html) {
|
|
|
1768
1623
|
}
|
|
1769
1624
|
}
|
|
1770
1625
|
|
|
1626
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
1627
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1628
|
+
if (!jsxDev) {
|
|
1629
|
+
return null;
|
|
1630
|
+
}
|
|
1631
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
1632
|
+
if (sanitizedFileName) {
|
|
1633
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
1634
|
+
}
|
|
1635
|
+
return null;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1771
1638
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1772
1639
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1773
1640
|
let journal = container.$journal$;
|
|
@@ -1804,12 +1671,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1804
1671
|
descend(jsxValue, false);
|
|
1805
1672
|
} else if (isSignal(jsxValue)) {
|
|
1806
1673
|
if (vCurrent) {
|
|
1807
|
-
clearVNodeEffectDependencies(vCurrent);
|
|
1674
|
+
clearVNodeEffectDependencies(container, vCurrent);
|
|
1808
1675
|
}
|
|
1809
1676
|
expectVirtual("S" /* WrappedSignal */, null);
|
|
1810
1677
|
descend(
|
|
1811
|
-
|
|
1812
|
-
|
|
1678
|
+
trackSignalAndAssignHost(
|
|
1679
|
+
jsxValue,
|
|
1813
1680
|
vNewNode || vCurrent,
|
|
1814
1681
|
"." /* VNODE */,
|
|
1815
1682
|
container
|
|
@@ -1819,7 +1686,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1819
1686
|
} else if (isPromise(jsxValue)) {
|
|
1820
1687
|
expectVirtual("A" /* Awaited */, null);
|
|
1821
1688
|
asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
1822
|
-
} else if (
|
|
1689
|
+
} else if (isJSXNode(jsxValue)) {
|
|
1823
1690
|
const type = jsxValue.type;
|
|
1824
1691
|
if (typeof type === "string") {
|
|
1825
1692
|
expectNoMoreTextNodes();
|
|
@@ -1976,7 +1843,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1976
1843
|
for (let i = 0; i < projectionChildren.length; i++) {
|
|
1977
1844
|
const child = projectionChildren[i];
|
|
1978
1845
|
const slotName = String(
|
|
1979
|
-
|
|
1846
|
+
isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
|
|
1980
1847
|
);
|
|
1981
1848
|
const idx = mapApp_findIndx(projections, slotName, 0);
|
|
1982
1849
|
let jsxBucket;
|
|
@@ -2006,8 +1873,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2006
1873
|
);
|
|
2007
1874
|
if (vCurrent == null) {
|
|
2008
1875
|
vNewNode = vnode_newVirtual();
|
|
2009
|
-
|
|
2010
|
-
|
|
1876
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1877
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectProjection");
|
|
2011
1878
|
vnode_setProp(vNewNode, QSlot, slotName);
|
|
2012
1879
|
vnode_setProp(vNewNode, QSlotParent, vParent);
|
|
2013
1880
|
vnode_setProp(vParent, slotName, vNewNode);
|
|
@@ -2033,8 +1900,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2033
1900
|
);
|
|
2034
1901
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2035
1902
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2036
|
-
|
|
2037
|
-
|
|
1903
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1904
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2038
1905
|
return false;
|
|
2039
1906
|
} else if (vProjectedNode === vCurrent) {
|
|
2040
1907
|
} else {
|
|
@@ -2046,8 +1913,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2046
1913
|
);
|
|
2047
1914
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2048
1915
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2049
|
-
|
|
2050
|
-
|
|
1916
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1917
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2051
1918
|
}
|
|
2052
1919
|
return true;
|
|
2053
1920
|
}
|
|
@@ -2057,7 +1924,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2057
1924
|
if (constProps && typeof constProps == "object" && "name" in constProps) {
|
|
2058
1925
|
const constValue = constProps.name;
|
|
2059
1926
|
if (vHost && constValue instanceof WrappedSignal) {
|
|
2060
|
-
return
|
|
1927
|
+
return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
|
|
2061
1928
|
}
|
|
2062
1929
|
}
|
|
2063
1930
|
return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
|
|
@@ -2108,7 +1975,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2108
1975
|
vnode_remove(journal, vParent, toRemove, true);
|
|
2109
1976
|
}
|
|
2110
1977
|
}
|
|
2111
|
-
function createNewElement(jsx2, elementName) {
|
|
1978
|
+
function createNewElement(jsx2, elementName, currentFile) {
|
|
2112
1979
|
const element = createElementWithNamespace(elementName);
|
|
2113
1980
|
const { constProps } = jsx2;
|
|
2114
1981
|
let needsQDispatchEventPatch = false;
|
|
@@ -2136,15 +2003,17 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2136
2003
|
} else if (typeof value === "function") {
|
|
2137
2004
|
value(element);
|
|
2138
2005
|
continue;
|
|
2006
|
+
} else {
|
|
2007
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2139
2008
|
}
|
|
2140
2009
|
}
|
|
2141
2010
|
if (isSignal(value)) {
|
|
2142
|
-
const signalData = new
|
|
2011
|
+
const signalData = new EffectPropData({
|
|
2143
2012
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2144
2013
|
$isConst$: true
|
|
2145
2014
|
});
|
|
2146
|
-
value =
|
|
2147
|
-
|
|
2015
|
+
value = trackSignalAndAssignHost(
|
|
2016
|
+
value,
|
|
2148
2017
|
vNewNode,
|
|
2149
2018
|
key2,
|
|
2150
2019
|
container,
|
|
@@ -2157,13 +2026,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2157
2026
|
continue;
|
|
2158
2027
|
}
|
|
2159
2028
|
if (elementName === "textarea" && key2 === "value") {
|
|
2160
|
-
if (typeof value !== "string") {
|
|
2161
|
-
if (
|
|
2162
|
-
|
|
2029
|
+
if (value && typeof value !== "string") {
|
|
2030
|
+
if (isDev4) {
|
|
2031
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
2163
2032
|
}
|
|
2164
2033
|
continue;
|
|
2165
2034
|
}
|
|
2166
|
-
element.value = escapeHTML(value);
|
|
2035
|
+
element.value = escapeHTML(value || "");
|
|
2167
2036
|
continue;
|
|
2168
2037
|
}
|
|
2169
2038
|
value = serializeAttribute(key2, value, scopedStyleIdPrefix);
|
|
@@ -2199,19 +2068,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2199
2068
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
2200
2069
|
const jsxKey = jsx2.key;
|
|
2201
2070
|
let needsQDispatchEventPatch = false;
|
|
2071
|
+
const currentFile = getFileLocationFromJsx(jsx2.dev);
|
|
2202
2072
|
if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
|
|
2203
2073
|
vNewNode = retrieveChildWithKey(elementName, jsxKey);
|
|
2204
2074
|
if (vNewNode === null) {
|
|
2205
2075
|
needsQDispatchEventPatch = createNewElement(jsx2, elementName);
|
|
2206
2076
|
} else {
|
|
2207
2077
|
vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
|
|
2078
|
+
vCurrent = vNewNode;
|
|
2079
|
+
vNewNode = null;
|
|
2080
|
+
if (vSiblings !== null) {
|
|
2081
|
+
vSiblingsIdx -= 3 /* Size */;
|
|
2082
|
+
}
|
|
2208
2083
|
}
|
|
2209
2084
|
}
|
|
2210
2085
|
const jsxAttrs = [];
|
|
2211
2086
|
const props = jsx2.varProps;
|
|
2212
2087
|
for (const key in props) {
|
|
2213
|
-
|
|
2214
|
-
value = serializeAttribute(key, value, scopedStyleIdPrefix);
|
|
2088
|
+
const value = props[key];
|
|
2215
2089
|
if (value != null) {
|
|
2216
2090
|
mapArray_set(jsxAttrs, key, value, 0);
|
|
2217
2091
|
}
|
|
@@ -2220,7 +2094,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2220
2094
|
mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
|
|
2221
2095
|
}
|
|
2222
2096
|
const vNode = vNewNode || vCurrent;
|
|
2223
|
-
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
|
|
2097
|
+
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
|
|
2224
2098
|
if (needsQDispatchEventPatch) {
|
|
2225
2099
|
const element = vnode_getNode(vNode);
|
|
2226
2100
|
if (!element.qDispatchEvent) {
|
|
@@ -2243,7 +2117,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2243
2117
|
}
|
|
2244
2118
|
}
|
|
2245
2119
|
}
|
|
2246
|
-
function setBulkProps(vnode, srcAttrs) {
|
|
2120
|
+
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
2247
2121
|
vnode_ensureElementInflated(vnode);
|
|
2248
2122
|
const dstAttrs = vnode;
|
|
2249
2123
|
let srcIdx = 0;
|
|
@@ -2266,12 +2140,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2266
2140
|
} else if (typeof value === "function") {
|
|
2267
2141
|
value(element);
|
|
2268
2142
|
return;
|
|
2143
|
+
} else {
|
|
2144
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2269
2145
|
}
|
|
2270
2146
|
}
|
|
2271
2147
|
if (isSignal(value)) {
|
|
2272
|
-
|
|
2148
|
+
const signalData = new EffectPropData({
|
|
2149
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2150
|
+
$isConst$: false
|
|
2151
|
+
});
|
|
2152
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
2273
2153
|
}
|
|
2274
|
-
vnode_setAttr(journal, vnode, key, value);
|
|
2154
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
|
|
2275
2155
|
if (value === null) {
|
|
2276
2156
|
dstLength = dstAttrs.length;
|
|
2277
2157
|
}
|
|
@@ -2291,7 +2171,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2291
2171
|
}
|
|
2292
2172
|
};
|
|
2293
2173
|
while (srcKey !== null || dstKey !== null) {
|
|
2294
|
-
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey
|
|
2174
|
+
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith(Q_PREFIX)) {
|
|
2295
2175
|
dstIdx++;
|
|
2296
2176
|
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2297
2177
|
} else if (srcKey == null) {
|
|
@@ -2313,6 +2193,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2313
2193
|
}
|
|
2314
2194
|
srcIdx++;
|
|
2315
2195
|
srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
2196
|
+
dstIdx++;
|
|
2197
|
+
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2316
2198
|
} else if (srcKey == dstKey) {
|
|
2317
2199
|
const srcValue = srcAttrs[srcIdx++];
|
|
2318
2200
|
const dstValue = dstAttrs[dstIdx++];
|
|
@@ -2389,7 +2271,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2389
2271
|
vnode_insertBefore(
|
|
2390
2272
|
journal,
|
|
2391
2273
|
vParent,
|
|
2392
|
-
vNewNode
|
|
2274
|
+
vNewNode,
|
|
2393
2275
|
vCurrent && getInsertBefore()
|
|
2394
2276
|
);
|
|
2395
2277
|
return;
|
|
@@ -2402,7 +2284,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2402
2284
|
vCurrent && getInsertBefore()
|
|
2403
2285
|
);
|
|
2404
2286
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
|
|
2405
|
-
|
|
2287
|
+
isDev4 && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
|
|
2406
2288
|
}
|
|
2407
2289
|
function expectComponent(component) {
|
|
2408
2290
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -2477,7 +2359,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2477
2359
|
}
|
|
2478
2360
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
2479
2361
|
if (host) {
|
|
2480
|
-
clearVNodeEffectDependencies(host);
|
|
2362
|
+
clearVNodeEffectDependencies(container, host);
|
|
2481
2363
|
}
|
|
2482
2364
|
vnode_insertBefore(
|
|
2483
2365
|
journal,
|
|
@@ -2486,7 +2368,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2486
2368
|
vCurrent && getInsertBefore()
|
|
2487
2369
|
);
|
|
2488
2370
|
const jsxNode2 = jsxValue;
|
|
2489
|
-
|
|
2371
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
2490
2372
|
container.setHostProp(vNewNode, OnRenderProp, componentQRL);
|
|
2491
2373
|
container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
|
|
2492
2374
|
container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2499,7 +2381,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2499
2381
|
vCurrent && getInsertBefore()
|
|
2500
2382
|
);
|
|
2501
2383
|
const jsxNode2 = jsxValue;
|
|
2502
|
-
|
|
2384
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
2503
2385
|
vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
|
|
2504
2386
|
if (jsxNode2.key) {
|
|
2505
2387
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2543,8 +2425,8 @@ function propsDiffer(src, dst) {
|
|
|
2543
2425
|
if (!src || !dst) {
|
|
2544
2426
|
return true;
|
|
2545
2427
|
}
|
|
2546
|
-
let srcKeys =
|
|
2547
|
-
let dstKeys =
|
|
2428
|
+
let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
|
|
2429
|
+
let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
|
|
2548
2430
|
if (srcKeys.length !== dstKeys.length) {
|
|
2549
2431
|
return true;
|
|
2550
2432
|
}
|
|
@@ -2559,10 +2441,13 @@ function propsDiffer(src, dst) {
|
|
|
2559
2441
|
}
|
|
2560
2442
|
return false;
|
|
2561
2443
|
}
|
|
2562
|
-
function
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
keys.
|
|
2444
|
+
function removePropsKeys(keys, propKeys) {
|
|
2445
|
+
for (let i = propKeys.length - 1; i >= 0; i--) {
|
|
2446
|
+
const propKey = propKeys[i];
|
|
2447
|
+
const propIdx = keys.indexOf(propKey);
|
|
2448
|
+
if (propIdx !== -1) {
|
|
2449
|
+
keys.splice(propIdx, 1);
|
|
2450
|
+
}
|
|
2566
2451
|
}
|
|
2567
2452
|
return keys;
|
|
2568
2453
|
}
|
|
@@ -2575,18 +2460,18 @@ function cleanup(container, vNode) {
|
|
|
2575
2460
|
do {
|
|
2576
2461
|
const type = vCursor[0 /* flags */];
|
|
2577
2462
|
if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
|
|
2463
|
+
clearVNodeEffectDependencies(container, vCursor);
|
|
2464
|
+
markVNodeAsDeleted(vCursor);
|
|
2578
2465
|
if (type & 2 /* Virtual */) {
|
|
2579
|
-
clearVNodeEffectDependencies(vCursor);
|
|
2580
|
-
markVNodeAsDeleted(vCursor);
|
|
2581
2466
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
2582
2467
|
if (seq) {
|
|
2583
2468
|
for (let i = 0; i < seq.length; i++) {
|
|
2584
2469
|
const obj = seq[i];
|
|
2585
2470
|
if (isTask(obj)) {
|
|
2586
2471
|
const task = obj;
|
|
2587
|
-
clearSubscriberEffectDependencies(task);
|
|
2472
|
+
clearSubscriberEffectDependencies(container, task);
|
|
2588
2473
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2589
|
-
container.$scheduler$(
|
|
2474
|
+
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2590
2475
|
} else {
|
|
2591
2476
|
cleanupTask(task);
|
|
2592
2477
|
}
|
|
@@ -2677,8 +2562,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2677
2562
|
let journalFlushScheduled = false;
|
|
2678
2563
|
return schedule;
|
|
2679
2564
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
2680
|
-
const runLater = type !==
|
|
2681
|
-
const isTask2 = type === 3 /* TASK */ || type ===
|
|
2565
|
+
const runLater = type !== 255 /* WAIT_FOR_ALL */ && type !== 6 /* COMPONENT_SSR */;
|
|
2566
|
+
const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 48 /* CLEANUP_VISIBLE */;
|
|
2682
2567
|
if (isTask2) {
|
|
2683
2568
|
hostOrTask.$flags$ |= 8 /* DIRTY */;
|
|
2684
2569
|
}
|
|
@@ -2695,19 +2580,19 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2695
2580
|
};
|
|
2696
2581
|
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
2697
2582
|
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
2698
|
-
chore = sortedInsert(choreQueue, chore);
|
|
2583
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2699
2584
|
if (!journalFlushScheduled && runLater) {
|
|
2700
2585
|
journalFlushScheduled = true;
|
|
2701
|
-
schedule(
|
|
2586
|
+
schedule(16 /* JOURNAL_FLUSH */);
|
|
2702
2587
|
scheduleDrain();
|
|
2703
2588
|
}
|
|
2704
2589
|
if (runLater) {
|
|
2705
2590
|
return chore.$promise$;
|
|
2706
2591
|
} else {
|
|
2707
|
-
return drainUpTo(chore);
|
|
2592
|
+
return drainUpTo(chore, container.rootVNode || null);
|
|
2708
2593
|
}
|
|
2709
2594
|
}
|
|
2710
|
-
function drainUpTo(runUptoChore) {
|
|
2595
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
2711
2596
|
if (runUptoChore.$executed$) {
|
|
2712
2597
|
return runUptoChore.$returnValue$;
|
|
2713
2598
|
}
|
|
@@ -2716,7 +2601,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2716
2601
|
}
|
|
2717
2602
|
while (choreQueue.length) {
|
|
2718
2603
|
const nextChore = choreQueue.shift();
|
|
2719
|
-
const order = choreComparator(nextChore, runUptoChore, false);
|
|
2604
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode, false);
|
|
2720
2605
|
if (order === null) {
|
|
2721
2606
|
continue;
|
|
2722
2607
|
}
|
|
@@ -2725,13 +2610,13 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2725
2610
|
}
|
|
2726
2611
|
const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
|
|
2727
2612
|
if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
|
|
2728
|
-
nextChore.$type$ !==
|
|
2613
|
+
nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
|
|
2729
2614
|
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
2730
2615
|
continue;
|
|
2731
2616
|
}
|
|
2732
2617
|
const returnValue = executeChore(nextChore);
|
|
2733
2618
|
if (isPromise(returnValue)) {
|
|
2734
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore));
|
|
2619
|
+
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
2735
2620
|
return promise;
|
|
2736
2621
|
}
|
|
2737
2622
|
}
|
|
@@ -2744,7 +2629,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2744
2629
|
currentChore = chore;
|
|
2745
2630
|
let returnValue = null;
|
|
2746
2631
|
switch (chore.$type$) {
|
|
2747
|
-
case
|
|
2632
|
+
case 16 /* JOURNAL_FLUSH */:
|
|
2748
2633
|
returnValue = journalFlush();
|
|
2749
2634
|
journalFlushScheduled = false;
|
|
2750
2635
|
break;
|
|
@@ -2781,10 +2666,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2781
2666
|
case 3 /* TASK */:
|
|
2782
2667
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2783
2668
|
break;
|
|
2784
|
-
case
|
|
2669
|
+
case 32 /* VISIBLE */:
|
|
2785
2670
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2786
2671
|
break;
|
|
2787
|
-
case
|
|
2672
|
+
case 48 /* CLEANUP_VISIBLE */:
|
|
2788
2673
|
const task = chore.$payload$;
|
|
2789
2674
|
cleanupTask(task);
|
|
2790
2675
|
break;
|
|
@@ -2819,6 +2704,20 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2819
2704
|
returnValue = !target.resolved ? target.resolve() : null;
|
|
2820
2705
|
break;
|
|
2821
2706
|
}
|
|
2707
|
+
case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
|
|
2708
|
+
const target = chore.$target$;
|
|
2709
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
2710
|
+
target.$forceRunEffects$ = false;
|
|
2711
|
+
if (!target.$effects$?.length) {
|
|
2712
|
+
break;
|
|
2713
|
+
}
|
|
2714
|
+
returnValue = retryOnPromise(() => {
|
|
2715
|
+
if (target.$computeIfNeeded$() || forceRunEffects) {
|
|
2716
|
+
triggerEffects(container, target, target.$effects$);
|
|
2717
|
+
}
|
|
2718
|
+
});
|
|
2719
|
+
break;
|
|
2720
|
+
}
|
|
2822
2721
|
}
|
|
2823
2722
|
return maybeThenPassError(returnValue, (value) => {
|
|
2824
2723
|
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
@@ -2842,17 +2741,17 @@ var choreUpdate = (existing, newChore) => {
|
|
|
2842
2741
|
function vNodeAlreadyDeleted(chore) {
|
|
2843
2742
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2844
2743
|
}
|
|
2845
|
-
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2846
|
-
const macroTypeDiff = (a.$type$ &
|
|
2744
|
+
function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
|
|
2745
|
+
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2847
2746
|
if (macroTypeDiff !== 0) {
|
|
2848
2747
|
return macroTypeDiff;
|
|
2849
2748
|
}
|
|
2850
|
-
if (a.$type$ !==
|
|
2749
|
+
if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
|
|
2851
2750
|
const aHost = a.$host$;
|
|
2852
2751
|
const bHost = b.$host$;
|
|
2853
2752
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
2854
2753
|
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
2855
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2754
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2856
2755
|
if (hostDiff !== 0) {
|
|
2857
2756
|
return hostDiff;
|
|
2858
2757
|
}
|
|
@@ -2862,7 +2761,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2862
2761
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2863
2762
|
Problematic Node: ${aHost.toString()}`;
|
|
2864
2763
|
if (shouldThrowOnHostMismatch) {
|
|
2865
|
-
|
|
2764
|
+
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2866
2765
|
}
|
|
2867
2766
|
logWarn(errorMessage);
|
|
2868
2767
|
return null;
|
|
@@ -2876,19 +2775,19 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2876
2775
|
if (idxDiff !== 0) {
|
|
2877
2776
|
return idxDiff;
|
|
2878
2777
|
}
|
|
2879
|
-
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 */)) {
|
|
2778
|
+
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 */)) {
|
|
2880
2779
|
return 1;
|
|
2881
2780
|
}
|
|
2882
2781
|
}
|
|
2883
2782
|
return 0;
|
|
2884
2783
|
}
|
|
2885
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2784
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2886
2785
|
let bottom = 0;
|
|
2887
2786
|
let top = sortedArray.length;
|
|
2888
2787
|
while (bottom < top) {
|
|
2889
2788
|
const middle = bottom + (top - bottom >> 1);
|
|
2890
2789
|
const midChore = sortedArray[middle];
|
|
2891
|
-
const comp = choreComparator(value, midChore, true);
|
|
2790
|
+
const comp = choreComparator(value, midChore, rootVNode, true);
|
|
2892
2791
|
if (comp < 0) {
|
|
2893
2792
|
top = middle;
|
|
2894
2793
|
} else if (comp > 0) {
|
|
@@ -2899,8 +2798,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2899
2798
|
}
|
|
2900
2799
|
return ~bottom;
|
|
2901
2800
|
}
|
|
2902
|
-
function sortedInsert(sortedArray, value) {
|
|
2903
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2801
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2802
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2904
2803
|
if (idx < 0) {
|
|
2905
2804
|
sortedArray.splice(~idx, 0, value);
|
|
2906
2805
|
return value;
|
|
@@ -2918,11 +2817,11 @@ function debugChoreToString(chore) {
|
|
|
2918
2817
|
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
2919
2818
|
[7 /* COMPONENT */]: "COMPONENT",
|
|
2920
2819
|
[6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
|
|
2921
|
-
[
|
|
2922
|
-
[
|
|
2923
|
-
[
|
|
2924
|
-
[
|
|
2925
|
-
[
|
|
2820
|
+
[8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
|
|
2821
|
+
[16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
|
|
2822
|
+
[32 /* VISIBLE */]: "VISIBLE",
|
|
2823
|
+
[48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
|
|
2824
|
+
[255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
|
|
2926
2825
|
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
2927
2826
|
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
2928
2827
|
const qrlTarget = chore.$target$?.$symbol$;
|
|
@@ -2952,7 +2851,10 @@ var runTask = (task, container, host) => {
|
|
|
2952
2851
|
cleanupTask(task);
|
|
2953
2852
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
2954
2853
|
iCtx.$container$ = container;
|
|
2955
|
-
const taskFn = task.$qrl$.getFn(
|
|
2854
|
+
const taskFn = task.$qrl$.getFn(
|
|
2855
|
+
iCtx,
|
|
2856
|
+
() => clearSubscriberEffectDependencies(container, task)
|
|
2857
|
+
);
|
|
2956
2858
|
const track = (obj, prop) => {
|
|
2957
2859
|
const ctx = newInvokeContext();
|
|
2958
2860
|
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
@@ -3045,7 +2947,7 @@ var throwIfQRLNotResolved = (qrl) => {
|
|
|
3045
2947
|
var isSignal = (value) => {
|
|
3046
2948
|
return value instanceof Signal;
|
|
3047
2949
|
};
|
|
3048
|
-
var
|
|
2950
|
+
var EffectPropData = class {
|
|
3049
2951
|
constructor(data) {
|
|
3050
2952
|
__publicField(this, "data");
|
|
3051
2953
|
this.data = data;
|
|
@@ -3109,7 +3011,7 @@ var Signal = class {
|
|
|
3109
3011
|
// prevent accidental use as value
|
|
3110
3012
|
valueOf() {
|
|
3111
3013
|
if (qDev) {
|
|
3112
|
-
|
|
3014
|
+
throw qError(46 /* cannotCoerceSignal */);
|
|
3113
3015
|
}
|
|
3114
3016
|
}
|
|
3115
3017
|
toString() {
|
|
@@ -3141,7 +3043,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
|
3141
3043
|
return;
|
|
3142
3044
|
}
|
|
3143
3045
|
effect.$effectDependencies$.push(subscriber);
|
|
3144
|
-
} else if (vnode_isVNode(effect) &&
|
|
3046
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
3145
3047
|
let subscribers = vnode_getProp(
|
|
3146
3048
|
effect,
|
|
3147
3049
|
QSubscribers,
|
|
@@ -3185,7 +3087,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3185
3087
|
DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
3186
3088
|
let choreType = 3 /* TASK */;
|
|
3187
3089
|
if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
3188
|
-
choreType =
|
|
3090
|
+
choreType = 32 /* VISIBLE */;
|
|
3189
3091
|
} else if (effect.$flags$ & 4 /* RESOURCE */) {
|
|
3190
3092
|
choreType = 2 /* RESOURCE */;
|
|
3191
3093
|
}
|
|
@@ -3196,13 +3098,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3196
3098
|
container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
|
|
3197
3099
|
}
|
|
3198
3100
|
}
|
|
3199
|
-
|
|
3200
|
-
retryOnPromise(
|
|
3201
|
-
() => effect.$invalidate$()
|
|
3202
|
-
);
|
|
3203
|
-
} catch (e) {
|
|
3204
|
-
logError(e);
|
|
3205
|
-
}
|
|
3101
|
+
effect.$invalidate$();
|
|
3206
3102
|
} else if (property === ":" /* COMPONENT */) {
|
|
3207
3103
|
const host = effect;
|
|
3208
3104
|
const qrl = container.getHostProp(host, OnRenderProp);
|
|
@@ -3215,9 +3111,8 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3215
3111
|
container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
|
|
3216
3112
|
} else {
|
|
3217
3113
|
const host = effect;
|
|
3218
|
-
|
|
3219
|
-
if (effectData instanceof
|
|
3220
|
-
effectData = effectData;
|
|
3114
|
+
const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
|
|
3115
|
+
if (effectData instanceof EffectPropData) {
|
|
3221
3116
|
const data = effectData.data;
|
|
3222
3117
|
const payload = {
|
|
3223
3118
|
...data,
|
|
@@ -3244,16 +3139,13 @@ var ComputedSignal = class extends Signal {
|
|
|
3244
3139
|
// We need a separate flag to know when the computation needs running because
|
|
3245
3140
|
// we need the old value to know if effects need running after computation
|
|
3246
3141
|
__publicField(this, "$invalid$", true);
|
|
3142
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3247
3143
|
this.$computeQrl$ = fn;
|
|
3248
3144
|
}
|
|
3249
3145
|
$invalidate$() {
|
|
3250
3146
|
this.$invalid$ = true;
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
}
|
|
3254
|
-
if (this.$computeIfNeeded$()) {
|
|
3255
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3256
|
-
}
|
|
3147
|
+
this.$forceRunEffects$ = false;
|
|
3148
|
+
this.$container$?.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
|
|
3257
3149
|
}
|
|
3258
3150
|
/**
|
|
3259
3151
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3261,10 +3153,14 @@ var ComputedSignal = class extends Signal {
|
|
|
3261
3153
|
*/
|
|
3262
3154
|
force() {
|
|
3263
3155
|
this.$invalid$ = true;
|
|
3156
|
+
this.$forceRunEffects$ = false;
|
|
3264
3157
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3265
3158
|
}
|
|
3266
3159
|
get untrackedValue() {
|
|
3267
|
-
this.$computeIfNeeded$();
|
|
3160
|
+
const didChange = this.$computeIfNeeded$();
|
|
3161
|
+
if (didChange) {
|
|
3162
|
+
this.$forceRunEffects$ = didChange;
|
|
3163
|
+
}
|
|
3268
3164
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3269
3165
|
return this.$untrackedValue$;
|
|
3270
3166
|
}
|
|
@@ -3280,9 +3176,10 @@ var ComputedSignal = class extends Signal {
|
|
|
3280
3176
|
try {
|
|
3281
3177
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3282
3178
|
if (isPromise(untrackedValue)) {
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3179
|
+
throw qError(47 /* computedNotSync */, [
|
|
3180
|
+
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3181
|
+
computeQrl.$hash$
|
|
3182
|
+
]);
|
|
3286
3183
|
}
|
|
3287
3184
|
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
3288
3185
|
this.$invalid$ = false;
|
|
@@ -3302,7 +3199,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3302
3199
|
return super.value;
|
|
3303
3200
|
}
|
|
3304
3201
|
set value(_) {
|
|
3305
|
-
|
|
3202
|
+
throw qError(48 /* computedReadOnly */);
|
|
3306
3203
|
}
|
|
3307
3204
|
};
|
|
3308
3205
|
var WrappedSignal = class extends Signal {
|
|
@@ -3315,18 +3212,20 @@ var WrappedSignal = class extends Signal {
|
|
|
3315
3212
|
// we need the old value to know if effects need running after computation
|
|
3316
3213
|
__publicField(this, "$invalid$", true);
|
|
3317
3214
|
__publicField(this, "$effectDependencies$", null);
|
|
3215
|
+
__publicField(this, "$hostElement$", null);
|
|
3216
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3318
3217
|
this.$args$ = args;
|
|
3319
3218
|
this.$func$ = fn;
|
|
3320
3219
|
this.$funcStr$ = fnStr;
|
|
3321
3220
|
}
|
|
3322
3221
|
$invalidate$() {
|
|
3323
3222
|
this.$invalid$ = true;
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3223
|
+
this.$forceRunEffects$ = false;
|
|
3224
|
+
this.$container$?.$scheduler$(
|
|
3225
|
+
8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
|
|
3226
|
+
this.$hostElement$,
|
|
3227
|
+
this
|
|
3228
|
+
);
|
|
3330
3229
|
}
|
|
3331
3230
|
/**
|
|
3332
3231
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3334,10 +3233,14 @@ var WrappedSignal = class extends Signal {
|
|
|
3334
3233
|
*/
|
|
3335
3234
|
force() {
|
|
3336
3235
|
this.$invalid$ = true;
|
|
3236
|
+
this.$forceRunEffects$ = false;
|
|
3337
3237
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3338
3238
|
}
|
|
3339
3239
|
get untrackedValue() {
|
|
3340
|
-
this.$computeIfNeeded$();
|
|
3240
|
+
const didChange = this.$computeIfNeeded$();
|
|
3241
|
+
if (didChange) {
|
|
3242
|
+
this.$forceRunEffects$ = didChange;
|
|
3243
|
+
}
|
|
3341
3244
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3342
3245
|
return this.$untrackedValue$;
|
|
3343
3246
|
}
|
|
@@ -3362,12 +3265,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3362
3265
|
return super.value;
|
|
3363
3266
|
}
|
|
3364
3267
|
set value(_) {
|
|
3365
|
-
|
|
3268
|
+
throw qError(49 /* wrappedReadOnly */);
|
|
3366
3269
|
}
|
|
3367
3270
|
};
|
|
3368
3271
|
|
|
3369
3272
|
// packages/qwik/src/core/version.ts
|
|
3370
|
-
var version = "2.0.0-alpha.
|
|
3273
|
+
var version = "2.0.0-alpha.5-dev+cb53bbd";
|
|
3371
3274
|
|
|
3372
3275
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3373
3276
|
var _SharedContainer = class {
|
|
@@ -3392,7 +3295,7 @@ var _SharedContainer = class {
|
|
|
3392
3295
|
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
3393
3296
|
}
|
|
3394
3297
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3395
|
-
return
|
|
3298
|
+
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
3396
3299
|
}
|
|
3397
3300
|
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3398
3301
|
return createSerializationContext(
|
|
@@ -3514,7 +3417,7 @@ var JSXNodeImpl = class {
|
|
|
3514
3417
|
}
|
|
3515
3418
|
};
|
|
3516
3419
|
var Virtual = (props) => props.children;
|
|
3517
|
-
var
|
|
3420
|
+
var isJSXNode = (n) => {
|
|
3518
3421
|
if (qDev) {
|
|
3519
3422
|
if (n instanceof JSXNodeImpl) {
|
|
3520
3423
|
return true;
|
|
@@ -3650,7 +3553,7 @@ function qwikDebugToString(value) {
|
|
|
3650
3553
|
}
|
|
3651
3554
|
} else if (isStore(value)) {
|
|
3652
3555
|
return "Store";
|
|
3653
|
-
} else if (
|
|
3556
|
+
} else if (isJSXNode(value)) {
|
|
3654
3557
|
return jsxToString(value);
|
|
3655
3558
|
}
|
|
3656
3559
|
} finally {
|
|
@@ -3663,7 +3566,7 @@ var pad = (text, prefix) => {
|
|
|
3663
3566
|
return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
|
|
3664
3567
|
};
|
|
3665
3568
|
var jsxToString = (value) => {
|
|
3666
|
-
if (
|
|
3569
|
+
if (isJSXNode(value)) {
|
|
3667
3570
|
let type = value.type;
|
|
3668
3571
|
if (typeof type === "function") {
|
|
3669
3572
|
type = type.name || "Component";
|
|
@@ -3852,7 +3755,7 @@ var VNodeDataChar = {
|
|
|
3852
3755
|
/* ************** */
|
|
3853
3756
|
123
|
|
3854
3757
|
),
|
|
3855
|
-
// `{` is the start of the VNodeData.
|
|
3758
|
+
// `{` is the start of the VNodeData for a virtual element.
|
|
3856
3759
|
OPEN_CHAR: (
|
|
3857
3760
|
/* ****** */
|
|
3858
3761
|
"{"
|
|
@@ -3861,7 +3764,7 @@ var VNodeDataChar = {
|
|
|
3861
3764
|
/* ************* */
|
|
3862
3765
|
125
|
|
3863
3766
|
),
|
|
3864
|
-
// `}` is the end of the VNodeData.
|
|
3767
|
+
// `}` is the end of the VNodeData for a virtual element.
|
|
3865
3768
|
CLOSE_CHAR: (
|
|
3866
3769
|
/* ***** */
|
|
3867
3770
|
"}"
|
|
@@ -3931,7 +3834,7 @@ var VNodeDataChar = {
|
|
|
3931
3834
|
),
|
|
3932
3835
|
DON_T_USE: (
|
|
3933
3836
|
/* ********** */
|
|
3934
|
-
|
|
3837
|
+
92
|
|
3935
3838
|
),
|
|
3936
3839
|
// `\` - SKIP because `\` is used as escaping
|
|
3937
3840
|
DON_T_USE_CHAR: "\\",
|
|
@@ -3953,6 +3856,15 @@ var VNodeDataChar = {
|
|
|
3953
3856
|
/* **** */
|
|
3954
3857
|
"^"
|
|
3955
3858
|
),
|
|
3859
|
+
SUBS: (
|
|
3860
|
+
/* *************** */
|
|
3861
|
+
96
|
|
3862
|
+
),
|
|
3863
|
+
// '`' - `q:subs' - Effect dependencies/subscriptions
|
|
3864
|
+
SUBS_CHAR: (
|
|
3865
|
+
/* ******* */
|
|
3866
|
+
"`"
|
|
3867
|
+
),
|
|
3956
3868
|
SEPARATOR: (
|
|
3957
3869
|
/* ********* */
|
|
3958
3870
|
124
|
|
@@ -4672,9 +4584,32 @@ var vnode_materialize = (vNode) => {
|
|
|
4672
4584
|
const element = vNode[6 /* element */];
|
|
4673
4585
|
const firstChild = fastFirstChild(element);
|
|
4674
4586
|
const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
|
|
4675
|
-
const vFirstChild =
|
|
4587
|
+
const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
|
|
4676
4588
|
return vFirstChild;
|
|
4677
4589
|
};
|
|
4590
|
+
var materialize = (vNode, element, firstChild, vNodeData) => {
|
|
4591
|
+
if (vNodeData) {
|
|
4592
|
+
if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
|
|
4593
|
+
const elementVNodeDataStartIdx = 1;
|
|
4594
|
+
let elementVNodeDataEndIdx = 1;
|
|
4595
|
+
while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
|
|
4596
|
+
elementVNodeDataEndIdx++;
|
|
4597
|
+
}
|
|
4598
|
+
const elementVNodeData = vNodeData.substring(
|
|
4599
|
+
elementVNodeDataStartIdx,
|
|
4600
|
+
elementVNodeDataEndIdx
|
|
4601
|
+
);
|
|
4602
|
+
vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
|
|
4603
|
+
const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
|
|
4604
|
+
if (!vNodeData) {
|
|
4605
|
+
return vFirstChild;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
|
|
4609
|
+
} else {
|
|
4610
|
+
return materializeFromDOM(vNode, firstChild);
|
|
4611
|
+
}
|
|
4612
|
+
};
|
|
4678
4613
|
var ensureMaterialized = (vnode) => {
|
|
4679
4614
|
const vParent = ensureElementVNode(vnode);
|
|
4680
4615
|
let vFirstChild = vParent[4 /* firstChild */];
|
|
@@ -4796,7 +4731,7 @@ var fastGetter = (prototype, name) => {
|
|
|
4796
4731
|
var isQStyleElement = (node) => {
|
|
4797
4732
|
return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
|
|
4798
4733
|
};
|
|
4799
|
-
var materializeFromDOM = (vParent, firstChild) => {
|
|
4734
|
+
var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
4800
4735
|
let vFirstChild = null;
|
|
4801
4736
|
const skipStyleElements = () => {
|
|
4802
4737
|
while (isQStyleElement(child)) {
|
|
@@ -4830,8 +4765,54 @@ var materializeFromDOM = (vParent, firstChild) => {
|
|
|
4830
4765
|
}
|
|
4831
4766
|
vParent[5 /* lastChild */] = vChild || null;
|
|
4832
4767
|
vParent[4 /* firstChild */] = vFirstChild;
|
|
4768
|
+
if (vData) {
|
|
4769
|
+
let container = null;
|
|
4770
|
+
processVNodeData(vData, (peek, consumeValue) => {
|
|
4771
|
+
if (peek() === VNodeDataChar.ID) {
|
|
4772
|
+
if (!container) {
|
|
4773
|
+
container = getDomContainer(vParent[6 /* element */]);
|
|
4774
|
+
}
|
|
4775
|
+
const id = consumeValue();
|
|
4776
|
+
container.$setRawState$(parseInt(id), vParent);
|
|
4777
|
+
isDev6 && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
4778
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
4779
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
4780
|
+
} else {
|
|
4781
|
+
consumeValue();
|
|
4782
|
+
}
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4833
4785
|
return vFirstChild;
|
|
4834
4786
|
};
|
|
4787
|
+
var processVNodeData = (vData, callback) => {
|
|
4788
|
+
let nextToConsumeIdx = 0;
|
|
4789
|
+
let ch = 0;
|
|
4790
|
+
let peekCh = 0;
|
|
4791
|
+
const peek = () => {
|
|
4792
|
+
if (peekCh !== 0) {
|
|
4793
|
+
return peekCh;
|
|
4794
|
+
} else {
|
|
4795
|
+
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
4796
|
+
}
|
|
4797
|
+
};
|
|
4798
|
+
const consume = () => {
|
|
4799
|
+
ch = peek();
|
|
4800
|
+
peekCh = 0;
|
|
4801
|
+
nextToConsumeIdx++;
|
|
4802
|
+
return ch;
|
|
4803
|
+
};
|
|
4804
|
+
const consumeValue = () => {
|
|
4805
|
+
consume();
|
|
4806
|
+
const start = nextToConsumeIdx;
|
|
4807
|
+
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
4808
|
+
consume();
|
|
4809
|
+
}
|
|
4810
|
+
return vData.substring(start, nextToConsumeIdx);
|
|
4811
|
+
};
|
|
4812
|
+
while (peek() !== 0) {
|
|
4813
|
+
callback(peek, consumeValue, consume, nextToConsumeIdx);
|
|
4814
|
+
}
|
|
4815
|
+
};
|
|
4835
4816
|
var vnode_getNextSibling = (vnode) => {
|
|
4836
4817
|
return vnode[3 /* nextSibling */];
|
|
4837
4818
|
};
|
|
@@ -4916,7 +4897,7 @@ var vnode_getPropStartIndex = (vnode) => {
|
|
|
4916
4897
|
} else if (type === 2 /* Virtual */) {
|
|
4917
4898
|
return 6 /* PROPS_OFFSET */;
|
|
4918
4899
|
}
|
|
4919
|
-
throw
|
|
4900
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
4920
4901
|
};
|
|
4921
4902
|
var vnode_getParent = (vnode) => {
|
|
4922
4903
|
return vnode[1 /* parent */] || null;
|
|
@@ -4931,7 +4912,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4931
4912
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4932
4913
|
return vnode[4 /* node */];
|
|
4933
4914
|
};
|
|
4934
|
-
function vnode_toString(depth =
|
|
4915
|
+
function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
|
|
4935
4916
|
let vnode = this;
|
|
4936
4917
|
if (depth === 0) {
|
|
4937
4918
|
return "...";
|
|
@@ -4983,7 +4964,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
|
|
|
4983
4964
|
}
|
|
4984
4965
|
}
|
|
4985
4966
|
strings.push("<" + tag + attrs.join("") + ">");
|
|
4986
|
-
if (vnode_isMaterialized(vnode) ||
|
|
4967
|
+
if (vnode_isMaterialized(vnode) || materialize2) {
|
|
4987
4968
|
const child = vnode_getFirstChild(vnode);
|
|
4988
4969
|
child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
|
|
4989
4970
|
} else {
|
|
@@ -5006,25 +4987,9 @@ var isLowercase = (ch) => (
|
|
|
5006
4987
|
var stack = [];
|
|
5007
4988
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
5008
4989
|
let idx = 0;
|
|
5009
|
-
let nextToConsumeIdx = 0;
|
|
5010
4990
|
let vFirst = null;
|
|
5011
4991
|
let vLast = null;
|
|
5012
4992
|
let previousTextNode = null;
|
|
5013
|
-
let ch = 0;
|
|
5014
|
-
let peekCh = 0;
|
|
5015
|
-
const peek = () => {
|
|
5016
|
-
if (peekCh !== 0) {
|
|
5017
|
-
return peekCh;
|
|
5018
|
-
} else {
|
|
5019
|
-
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
5020
|
-
}
|
|
5021
|
-
};
|
|
5022
|
-
const consume = () => {
|
|
5023
|
-
ch = peek();
|
|
5024
|
-
peekCh = 0;
|
|
5025
|
-
nextToConsumeIdx++;
|
|
5026
|
-
return ch;
|
|
5027
|
-
};
|
|
5028
4993
|
const addVNode = (node) => {
|
|
5029
4994
|
node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
|
|
5030
4995
|
idx++;
|
|
@@ -5036,25 +5001,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5036
5001
|
}
|
|
5037
5002
|
vLast = node;
|
|
5038
5003
|
};
|
|
5039
|
-
const consumeValue = () => {
|
|
5040
|
-
consume();
|
|
5041
|
-
const start = nextToConsumeIdx;
|
|
5042
|
-
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
5043
|
-
consume();
|
|
5044
|
-
}
|
|
5045
|
-
return vData.substring(start, nextToConsumeIdx);
|
|
5046
|
-
};
|
|
5047
5004
|
let textIdx = 0;
|
|
5048
5005
|
let combinedText = null;
|
|
5049
5006
|
let container = null;
|
|
5050
|
-
|
|
5007
|
+
processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
|
|
5051
5008
|
if (isNumber(peek())) {
|
|
5052
5009
|
while (!isElement(child)) {
|
|
5053
5010
|
child = fastNextSibling(child);
|
|
5054
5011
|
if (!child) {
|
|
5055
|
-
|
|
5056
|
-
"Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
|
|
5057
|
-
);
|
|
5012
|
+
throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
|
|
5058
5013
|
}
|
|
5059
5014
|
}
|
|
5060
5015
|
while (isQStyleElement(child)) {
|
|
@@ -5081,7 +5036,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5081
5036
|
}
|
|
5082
5037
|
const id = consumeValue();
|
|
5083
5038
|
container.$setRawState$(parseInt(id), vParent);
|
|
5084
|
-
|
|
5039
|
+
isDev6 && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
5085
5040
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
5086
5041
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
5087
5042
|
} else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
@@ -5092,6 +5047,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5092
5047
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
5093
5048
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
5094
5049
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
5050
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
5051
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
5095
5052
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
5096
5053
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
5097
5054
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -5134,7 +5091,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5134
5091
|
);
|
|
5135
5092
|
textIdx += length;
|
|
5136
5093
|
}
|
|
5137
|
-
}
|
|
5094
|
+
});
|
|
5138
5095
|
vParent[5 /* lastChild */] = vLast;
|
|
5139
5096
|
return vFirst;
|
|
5140
5097
|
}
|
|
@@ -5147,23 +5104,25 @@ var vnode_getType = (vnode) => {
|
|
|
5147
5104
|
} else if (type & 4 /* Text */) {
|
|
5148
5105
|
return 3;
|
|
5149
5106
|
}
|
|
5150
|
-
throw
|
|
5107
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
5151
5108
|
};
|
|
5152
5109
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5153
5110
|
1;
|
|
5154
5111
|
var aPath = [];
|
|
5155
5112
|
var bPath = [];
|
|
5156
|
-
var vnode_documentPosition = (a, b) => {
|
|
5113
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
5157
5114
|
if (a === b) {
|
|
5158
5115
|
return 0;
|
|
5159
5116
|
}
|
|
5160
5117
|
let aDepth = -1;
|
|
5161
5118
|
let bDepth = -1;
|
|
5162
5119
|
while (a) {
|
|
5163
|
-
|
|
5120
|
+
const vNode = aPath[++aDepth] = a;
|
|
5121
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5164
5122
|
}
|
|
5165
5123
|
while (b) {
|
|
5166
|
-
|
|
5124
|
+
const vNode = bPath[++bDepth] = b;
|
|
5125
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
5167
5126
|
}
|
|
5168
5127
|
while (aDepth >= 0 && bDepth >= 0) {
|
|
5169
5128
|
a = aPath[aDepth];
|
|
@@ -5186,6 +5145,9 @@ var vnode_documentPosition = (a, b) => {
|
|
|
5186
5145
|
return -1;
|
|
5187
5146
|
}
|
|
5188
5147
|
} while (cursor);
|
|
5148
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
5149
|
+
return -1;
|
|
5150
|
+
}
|
|
5189
5151
|
return 1;
|
|
5190
5152
|
}
|
|
5191
5153
|
}
|
|
@@ -5195,8 +5157,11 @@ var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
|
5195
5157
|
let projectionDepth = 1;
|
|
5196
5158
|
while (projectionDepth--) {
|
|
5197
5159
|
while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
|
|
5198
|
-
const
|
|
5199
|
-
|
|
5160
|
+
const qSlotParent = vnode_getProp(
|
|
5161
|
+
vHost,
|
|
5162
|
+
QSlotParent,
|
|
5163
|
+
(id) => vnode_locate(rootVNode, id)
|
|
5164
|
+
);
|
|
5200
5165
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
5201
5166
|
if (vProjectionParent) {
|
|
5202
5167
|
projectionDepth++;
|
|
@@ -5228,7 +5193,7 @@ var VNodeArray = class VNode extends Array {
|
|
|
5228
5193
|
constructor(flags, parent, previousSibling, nextSibling) {
|
|
5229
5194
|
super();
|
|
5230
5195
|
this.push(flags, parent, previousSibling, nextSibling);
|
|
5231
|
-
if (
|
|
5196
|
+
if (isDev6) {
|
|
5232
5197
|
this.toString = vnode_toString;
|
|
5233
5198
|
}
|
|
5234
5199
|
}
|
|
@@ -5309,6 +5274,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
|
|
|
5309
5274
|
trackInvocation.$container$ = previousContainer;
|
|
5310
5275
|
}
|
|
5311
5276
|
};
|
|
5277
|
+
var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
5278
|
+
if (value instanceof WrappedSignal && value.$hostElement$ !== host && host) {
|
|
5279
|
+
value.$hostElement$ = host;
|
|
5280
|
+
}
|
|
5281
|
+
return trackSignal(() => value.value, host, property, container, data);
|
|
5282
|
+
};
|
|
5312
5283
|
|
|
5313
5284
|
// packages/qwik/src/core/use/use-context.ts
|
|
5314
5285
|
var createContextId = (name) => {
|
|
@@ -5330,7 +5301,7 @@ var isRecoverable = (err) => {
|
|
|
5330
5301
|
};
|
|
5331
5302
|
|
|
5332
5303
|
// packages/qwik/src/core/client/process-vnode-data.ts
|
|
5333
|
-
function
|
|
5304
|
+
function processVNodeData2(document2) {
|
|
5334
5305
|
const Q_CONTAINER = "q:container";
|
|
5335
5306
|
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
5336
5307
|
const Q_PROPS_SEPARATOR2 = ":";
|
|
@@ -5582,7 +5553,7 @@ function processVNodeData(document2) {
|
|
|
5582
5553
|
function getDomContainer(element) {
|
|
5583
5554
|
const qContainerElement = _getQContainerElement(element);
|
|
5584
5555
|
if (!qContainerElement) {
|
|
5585
|
-
|
|
5556
|
+
throw qError(41 /* containerNotFound */);
|
|
5586
5557
|
}
|
|
5587
5558
|
return getDomContainerFromQContainerElement(qContainerElement);
|
|
5588
5559
|
}
|
|
@@ -5653,7 +5624,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5653
5624
|
});
|
|
5654
5625
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
5655
5626
|
if (!this.qContainer) {
|
|
5656
|
-
|
|
5627
|
+
throw qError(42 /* elementWithoutContainer */);
|
|
5657
5628
|
}
|
|
5658
5629
|
this.$journal$ = [
|
|
5659
5630
|
// The first time we render we need to hoist the styles.
|
|
@@ -5674,7 +5645,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5674
5645
|
this.stateData = null;
|
|
5675
5646
|
const document2 = this.element.ownerDocument;
|
|
5676
5647
|
if (!document2.qVNodeData) {
|
|
5677
|
-
|
|
5648
|
+
processVNodeData2(document2);
|
|
5678
5649
|
}
|
|
5679
5650
|
this.$rawStateData$ = [];
|
|
5680
5651
|
this.stateData = [];
|
|
@@ -5684,7 +5655,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5684
5655
|
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
5685
5656
|
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
5686
5657
|
}
|
|
5687
|
-
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) ||
|
|
5658
|
+
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
5688
5659
|
}
|
|
5689
5660
|
$setRawState$(id, vParent) {
|
|
5690
5661
|
this.stateData[id] = vParent;
|
|
@@ -5749,13 +5720,11 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5749
5720
|
if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
|
|
5750
5721
|
return vNode;
|
|
5751
5722
|
}
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
}
|
|
5723
|
+
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
5724
|
+
vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5725
|
+
} else {
|
|
5726
|
+
vNode = vnode_getParent(vNode);
|
|
5757
5727
|
}
|
|
5758
|
-
vNode = vnode_getParent(vNode);
|
|
5759
5728
|
}
|
|
5760
5729
|
return null;
|
|
5761
5730
|
}
|
|
@@ -5788,12 +5757,12 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5788
5757
|
}
|
|
5789
5758
|
processChores() {
|
|
5790
5759
|
let renderCount = this.$renderCount$;
|
|
5791
|
-
const result = this.$scheduler$(
|
|
5760
|
+
const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5792
5761
|
if (isPromise(result)) {
|
|
5793
5762
|
return result.then(async () => {
|
|
5794
5763
|
while (renderCount !== this.$renderCount$) {
|
|
5795
5764
|
renderCount = this.$renderCount$;
|
|
5796
|
-
await this.$scheduler$(
|
|
5765
|
+
await this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5797
5766
|
}
|
|
5798
5767
|
this.renderDone = null;
|
|
5799
5768
|
});
|
|
@@ -5848,10 +5817,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5848
5817
|
|
|
5849
5818
|
// packages/qwik/src/core/shared/shared-serialization.ts
|
|
5850
5819
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
5851
|
-
var unwrapDeserializerProxy = (value) => {
|
|
5852
|
-
const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
|
|
5853
|
-
return unwrapped ? unwrapped : value;
|
|
5854
|
-
};
|
|
5855
5820
|
var isDeserializerProxy = (value) => {
|
|
5856
5821
|
return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
|
|
5857
5822
|
};
|
|
@@ -5893,13 +5858,13 @@ var DeserializationHandler = class {
|
|
|
5893
5858
|
return value;
|
|
5894
5859
|
}
|
|
5895
5860
|
const container = this.$container$;
|
|
5896
|
-
|
|
5861
|
+
let propValue = allocate(container, typeId, value);
|
|
5862
|
+
if (typeId >= 12 /* Error */) {
|
|
5863
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
5864
|
+
}
|
|
5897
5865
|
Reflect.set(target, property, propValue);
|
|
5898
5866
|
this.$data$[idx] = void 0;
|
|
5899
5867
|
this.$data$[idx + 1] = propValue;
|
|
5900
|
-
if (typeId >= 12 /* Error */) {
|
|
5901
|
-
inflate(container, propValue, typeId, value);
|
|
5902
|
-
}
|
|
5903
5868
|
return propValue;
|
|
5904
5869
|
}
|
|
5905
5870
|
has(target, property) {
|
|
@@ -5933,7 +5898,7 @@ var _eagerDeserializeArray = (container, data) => {
|
|
|
5933
5898
|
var resolvers = /* @__PURE__ */ new WeakMap();
|
|
5934
5899
|
var inflate = (container, target, typeId, data) => {
|
|
5935
5900
|
if (typeId === void 0) {
|
|
5936
|
-
return;
|
|
5901
|
+
return target;
|
|
5937
5902
|
}
|
|
5938
5903
|
if (typeId !== 13 /* Object */ && Array.isArray(data)) {
|
|
5939
5904
|
data = _eagerDeserializeArray(container, data);
|
|
@@ -6004,14 +5969,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6004
5969
|
case 25 /* Store */:
|
|
6005
5970
|
case 26 /* StoreArray */: {
|
|
6006
5971
|
const [value, flags, effects2, storeEffect] = data;
|
|
6007
|
-
const
|
|
6008
|
-
|
|
6009
|
-
Object.assign(getStoreTarget(target), value);
|
|
5972
|
+
const store = getOrCreateStore(value, flags, container);
|
|
5973
|
+
const storeHandler = getStoreHandler(store);
|
|
6010
5974
|
if (storeEffect) {
|
|
6011
5975
|
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
6012
5976
|
}
|
|
6013
|
-
|
|
6014
|
-
|
|
5977
|
+
storeHandler.$effects$ = effects2;
|
|
5978
|
+
target = store;
|
|
6015
5979
|
break;
|
|
6016
5980
|
}
|
|
6017
5981
|
case 22 /* Signal */: {
|
|
@@ -6028,7 +5992,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6028
5992
|
signal.$args$ = d[1];
|
|
6029
5993
|
signal.$effectDependencies$ = d[2];
|
|
6030
5994
|
signal.$untrackedValue$ = d[3];
|
|
6031
|
-
signal.$
|
|
5995
|
+
signal.$hostElement$ = d[4];
|
|
5996
|
+
signal.$effects$ = d.slice(5);
|
|
6032
5997
|
break;
|
|
6033
5998
|
}
|
|
6034
5999
|
case 24 /* ComputedSignal */: {
|
|
@@ -6124,12 +6089,14 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6124
6089
|
break;
|
|
6125
6090
|
case 30 /* EffectData */: {
|
|
6126
6091
|
const effectData = target;
|
|
6127
|
-
effectData.data = data[0];
|
|
6092
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
6093
|
+
effectData.data.$isConst$ = data[1];
|
|
6128
6094
|
break;
|
|
6129
6095
|
}
|
|
6130
6096
|
default:
|
|
6131
|
-
|
|
6097
|
+
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6132
6098
|
}
|
|
6099
|
+
return target;
|
|
6133
6100
|
};
|
|
6134
6101
|
var _constants = [
|
|
6135
6102
|
void 0,
|
|
@@ -6137,7 +6104,7 @@ var _constants = [
|
|
|
6137
6104
|
true,
|
|
6138
6105
|
false,
|
|
6139
6106
|
"",
|
|
6140
|
-
|
|
6107
|
+
EMPTY_ARRAY,
|
|
6141
6108
|
EMPTY_OBJ,
|
|
6142
6109
|
NEEDS_COMPUTATION,
|
|
6143
6110
|
Slot,
|
|
@@ -6197,9 +6164,8 @@ var allocate = (container, typeId, value) => {
|
|
|
6197
6164
|
case 24 /* ComputedSignal */:
|
|
6198
6165
|
return new ComputedSignal(container, null);
|
|
6199
6166
|
case 25 /* Store */:
|
|
6200
|
-
return createStore(container, {}, 0);
|
|
6201
6167
|
case 26 /* StoreArray */:
|
|
6202
|
-
return
|
|
6168
|
+
return null;
|
|
6203
6169
|
case 11 /* URLSearchParams */:
|
|
6204
6170
|
return new URLSearchParams(value);
|
|
6205
6171
|
case 27 /* FormData */:
|
|
@@ -6241,12 +6207,12 @@ var allocate = (container, typeId, value) => {
|
|
|
6241
6207
|
if (vnode_isVNode(vNode)) {
|
|
6242
6208
|
return vnode_getNode(vNode);
|
|
6243
6209
|
} else {
|
|
6244
|
-
|
|
6210
|
+
throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
6245
6211
|
}
|
|
6246
6212
|
case 30 /* EffectData */:
|
|
6247
|
-
return new
|
|
6213
|
+
return new EffectPropData({});
|
|
6248
6214
|
default:
|
|
6249
|
-
|
|
6215
|
+
throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
|
|
6250
6216
|
}
|
|
6251
6217
|
};
|
|
6252
6218
|
function retrieveVNodeOrDocument(container, value) {
|
|
@@ -6319,7 +6285,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6319
6285
|
$getRootId$: (obj) => {
|
|
6320
6286
|
const id = map.get(obj);
|
|
6321
6287
|
if (!id || id === -1) {
|
|
6322
|
-
|
|
6288
|
+
throw qError(36 /* serializeErrorMissingRootId */, [obj]);
|
|
6323
6289
|
}
|
|
6324
6290
|
return id;
|
|
6325
6291
|
},
|
|
@@ -6408,16 +6374,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6408
6374
|
if (obj.$args$) {
|
|
6409
6375
|
discoveredValues.push(...obj.$args$);
|
|
6410
6376
|
}
|
|
6377
|
+
if (obj.$hostElement$) {
|
|
6378
|
+
discoveredValues.push(obj.$hostElement$);
|
|
6379
|
+
}
|
|
6411
6380
|
} else if (obj instanceof ComputedSignal) {
|
|
6412
6381
|
discoveredValues.push(obj.$computeQrl$);
|
|
6413
6382
|
}
|
|
6414
6383
|
} else if (obj instanceof Task) {
|
|
6415
6384
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6416
6385
|
} else if (isSsrNode(obj)) {
|
|
6417
|
-
|
|
6386
|
+
discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
|
|
6387
|
+
if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
6388
|
+
for (const data of obj.childrenVNodeData) {
|
|
6389
|
+
discoverValuesForVNodeData(data, discoveredValues);
|
|
6390
|
+
}
|
|
6391
|
+
}
|
|
6418
6392
|
} else if (isDomRef(obj)) {
|
|
6419
6393
|
discoveredValues.push(obj.$ssrNode$.id);
|
|
6420
|
-
} else if (
|
|
6394
|
+
} else if (isJSXNode(obj)) {
|
|
6421
6395
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6422
6396
|
} else if (Array.isArray(obj)) {
|
|
6423
6397
|
discoveredValues.push(...obj);
|
|
@@ -6437,14 +6411,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6437
6411
|
}
|
|
6438
6412
|
);
|
|
6439
6413
|
promises.push(obj);
|
|
6440
|
-
} else if (obj instanceof
|
|
6414
|
+
} else if (obj instanceof EffectPropData) {
|
|
6441
6415
|
discoveredValues.push(obj.data);
|
|
6442
6416
|
} else if (isObjectLiteral(obj)) {
|
|
6443
6417
|
Object.entries(obj).forEach(([key, value]) => {
|
|
6444
6418
|
discoveredValues.push(key, value);
|
|
6445
6419
|
});
|
|
6446
6420
|
} else {
|
|
6447
|
-
|
|
6421
|
+
throw qError(37 /* serializeErrorUnknownType */, [obj]);
|
|
6448
6422
|
}
|
|
6449
6423
|
};
|
|
6450
6424
|
for (const root of roots) {
|
|
@@ -6469,6 +6443,20 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6469
6443
|
} while (discoveredValues.length);
|
|
6470
6444
|
}
|
|
6471
6445
|
};
|
|
6446
|
+
var isSsrAttrs = (value) => Array.isArray(value) && value.length > 0;
|
|
6447
|
+
var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
|
|
6448
|
+
for (const value of vnodeData) {
|
|
6449
|
+
if (isSsrAttrs(value)) {
|
|
6450
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
6451
|
+
if (value[i - 1] === ELEMENT_KEY) {
|
|
6452
|
+
continue;
|
|
6453
|
+
}
|
|
6454
|
+
const attrValue = value[i];
|
|
6455
|
+
discoveredValues.push(attrValue);
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
};
|
|
6472
6460
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
6473
6461
|
function serialize(serializationContext) {
|
|
6474
6462
|
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
@@ -6550,7 +6538,7 @@ function serialize(serializationContext) {
|
|
|
6550
6538
|
output(2 /* Number */, value);
|
|
6551
6539
|
}
|
|
6552
6540
|
} else if (typeof value === "object") {
|
|
6553
|
-
if (value ===
|
|
6541
|
+
if (value === EMPTY_ARRAY) {
|
|
6554
6542
|
output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
6555
6543
|
} else if (value === EMPTY_OBJ) {
|
|
6556
6544
|
output(1 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
@@ -6579,7 +6567,7 @@ function serialize(serializationContext) {
|
|
|
6579
6567
|
} else if (value === NEEDS_COMPUTATION) {
|
|
6580
6568
|
output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
6581
6569
|
} else {
|
|
6582
|
-
|
|
6570
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6583
6571
|
}
|
|
6584
6572
|
};
|
|
6585
6573
|
const writeObjectValue = (value, idx) => {
|
|
@@ -6596,14 +6584,14 @@ function serialize(serializationContext) {
|
|
|
6596
6584
|
const constProps = value[_CONST_PROPS];
|
|
6597
6585
|
const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
|
|
6598
6586
|
output(29 /* PropsProxy */, out);
|
|
6599
|
-
} else if (value instanceof
|
|
6600
|
-
output(30 /* EffectData */, [value.data]);
|
|
6587
|
+
} else if (value instanceof EffectPropData) {
|
|
6588
|
+
output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
|
|
6601
6589
|
} else if (isStore(value)) {
|
|
6602
6590
|
if (isResource(value)) {
|
|
6603
6591
|
serializationContext.$resources$.add(value);
|
|
6604
6592
|
const res = promiseResults.get(value.value);
|
|
6605
6593
|
if (!res) {
|
|
6606
|
-
|
|
6594
|
+
throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
|
|
6607
6595
|
}
|
|
6608
6596
|
output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
|
|
6609
6597
|
} else {
|
|
@@ -6640,7 +6628,7 @@ function serialize(serializationContext) {
|
|
|
6640
6628
|
output(13 /* Object */, out);
|
|
6641
6629
|
}
|
|
6642
6630
|
} else if ($isDomRef$(value)) {
|
|
6643
|
-
value.$ssrNode$.vnodeData[0] |=
|
|
6631
|
+
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
6644
6632
|
output(9 /* RefVNode */, value.$ssrNode$.id);
|
|
6645
6633
|
} else if (value instanceof Signal) {
|
|
6646
6634
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
@@ -6649,6 +6637,7 @@ function serialize(serializationContext) {
|
|
|
6649
6637
|
...serializeWrappingFn(serializationContext, value),
|
|
6650
6638
|
value.$effectDependencies$,
|
|
6651
6639
|
v,
|
|
6640
|
+
value.$hostElement$,
|
|
6652
6641
|
...value.$effects$ || []
|
|
6653
6642
|
]);
|
|
6654
6643
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -6687,11 +6676,11 @@ function serialize(serializationContext) {
|
|
|
6687
6676
|
const vNodeData = value.vnodeData;
|
|
6688
6677
|
if (vNodeData) {
|
|
6689
6678
|
serializationContext.$prepVNodeData$?.(vNodeData);
|
|
6690
|
-
vNodeData[0] |=
|
|
6679
|
+
vNodeData[0] |= 16 /* SERIALIZE */;
|
|
6691
6680
|
}
|
|
6692
6681
|
if (value.childrenVNodeData) {
|
|
6693
6682
|
for (const vNodeData2 of value.childrenVNodeData) {
|
|
6694
|
-
vNodeData2[0] |=
|
|
6683
|
+
vNodeData2[0] |= 16 /* SERIALIZE */;
|
|
6695
6684
|
}
|
|
6696
6685
|
}
|
|
6697
6686
|
} else {
|
|
@@ -6718,7 +6707,7 @@ function serialize(serializationContext) {
|
|
|
6718
6707
|
combined.push(k, v);
|
|
6719
6708
|
}
|
|
6720
6709
|
output(16 /* Map */, combined);
|
|
6721
|
-
} else if (
|
|
6710
|
+
} else if (isJSXNode(value)) {
|
|
6722
6711
|
output(28 /* JSXNode */, [
|
|
6723
6712
|
value.type,
|
|
6724
6713
|
value.varProps,
|
|
@@ -6743,7 +6732,7 @@ function serialize(serializationContext) {
|
|
|
6743
6732
|
} else if (isPromise(value)) {
|
|
6744
6733
|
const res = promiseResults.get(value);
|
|
6745
6734
|
if (!res) {
|
|
6746
|
-
|
|
6735
|
+
throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
|
|
6747
6736
|
}
|
|
6748
6737
|
output(14 /* Promise */, res);
|
|
6749
6738
|
} else if (value instanceof Uint8Array) {
|
|
@@ -6754,7 +6743,7 @@ function serialize(serializationContext) {
|
|
|
6754
6743
|
const out = btoa(buf).replace(/=+$/, "");
|
|
6755
6744
|
output(17 /* Uint8Array */, out);
|
|
6756
6745
|
} else {
|
|
6757
|
-
|
|
6746
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6758
6747
|
}
|
|
6759
6748
|
};
|
|
6760
6749
|
writeValue(serializationContext.$roots$, -1);
|
|
@@ -6800,7 +6789,7 @@ function qrlToString(serializationContext, value) {
|
|
|
6800
6789
|
}
|
|
6801
6790
|
}
|
|
6802
6791
|
if (!chunk) {
|
|
6803
|
-
|
|
6792
|
+
throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
|
|
6804
6793
|
}
|
|
6805
6794
|
if (chunk.startsWith("./")) {
|
|
6806
6795
|
chunk = chunk.slice(2);
|
|
@@ -6825,15 +6814,15 @@ function qrlToString(serializationContext, value) {
|
|
|
6825
6814
|
}
|
|
6826
6815
|
return qrlStringInline;
|
|
6827
6816
|
}
|
|
6828
|
-
function deserializeData(container, typeId,
|
|
6817
|
+
function deserializeData(container, typeId, value) {
|
|
6829
6818
|
if (typeId === void 0) {
|
|
6830
|
-
return
|
|
6819
|
+
return value;
|
|
6831
6820
|
}
|
|
6832
|
-
|
|
6821
|
+
let propValue = allocate(container, typeId, value);
|
|
6833
6822
|
if (typeId >= 12 /* Error */) {
|
|
6834
|
-
inflate(container,
|
|
6823
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
6835
6824
|
}
|
|
6836
|
-
return
|
|
6825
|
+
return propValue;
|
|
6837
6826
|
}
|
|
6838
6827
|
function shouldTrackObj(obj) {
|
|
6839
6828
|
return (
|
|
@@ -6855,7 +6844,7 @@ function isResource(value) {
|
|
|
6855
6844
|
return "__brand" in value && value.__brand === "resource";
|
|
6856
6845
|
}
|
|
6857
6846
|
var frameworkType = (obj) => {
|
|
6858
|
-
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task ||
|
|
6847
|
+
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
|
|
6859
6848
|
};
|
|
6860
6849
|
var canSerialize = (value) => {
|
|
6861
6850
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
@@ -6885,7 +6874,7 @@ var canSerialize = (value) => {
|
|
|
6885
6874
|
return true;
|
|
6886
6875
|
} else if (isPromise(value)) {
|
|
6887
6876
|
return true;
|
|
6888
|
-
} else if (
|
|
6877
|
+
} else if (isJSXNode(value)) {
|
|
6889
6878
|
return true;
|
|
6890
6879
|
} else if (value instanceof Error) {
|
|
6891
6880
|
return true;
|
|
@@ -6951,7 +6940,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
6951
6940
|
let expectIndex = 0;
|
|
6952
6941
|
unwrapped.forEach((v, i) => {
|
|
6953
6942
|
if (i !== expectIndex) {
|
|
6954
|
-
throw qError(
|
|
6943
|
+
throw qError(3 /* verifySerializable */, [unwrapped]);
|
|
6955
6944
|
}
|
|
6956
6945
|
_verifySerializable(v, seen, ctx + "[" + i + "]");
|
|
6957
6946
|
expectIndex = i + 1;
|
|
@@ -6991,8 +6980,7 @@ const ${fnName} = $(${String(
|
|
|
6991
6980
|
|
|
6992
6981
|
Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
|
|
6993
6982
|
}
|
|
6994
|
-
|
|
6995
|
-
throwErrorAndStop(message);
|
|
6983
|
+
throw qError(3 /* verifySerializable */, [message]);
|
|
6996
6984
|
}
|
|
6997
6985
|
return value;
|
|
6998
6986
|
};
|
|
@@ -7044,7 +7032,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7044
7032
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
7045
7033
|
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
7046
7034
|
if (!isFunction(fn)) {
|
|
7047
|
-
throw qError(
|
|
7035
|
+
throw qError(10 /* qrlIsNotFunction */);
|
|
7048
7036
|
}
|
|
7049
7037
|
if (beforeFn && beforeFn() === false) {
|
|
7050
7038
|
return;
|
|
@@ -7145,7 +7133,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7145
7133
|
if (symbolRef) {
|
|
7146
7134
|
symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
|
|
7147
7135
|
}
|
|
7148
|
-
if (
|
|
7136
|
+
if (isDev7) {
|
|
7149
7137
|
Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
7150
7138
|
get() {
|
|
7151
7139
|
return symbolRef;
|
|
@@ -7236,7 +7224,7 @@ var stringifyStyle = (obj) => {
|
|
|
7236
7224
|
}
|
|
7237
7225
|
if (typeof obj == "object") {
|
|
7238
7226
|
if (isArray(obj)) {
|
|
7239
|
-
throw qError(
|
|
7227
|
+
throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
|
|
7240
7228
|
} else {
|
|
7241
7229
|
const chunks = [];
|
|
7242
7230
|
for (const key in obj) {
|
|
@@ -7300,12 +7288,12 @@ function getValidManifest(manifest) {
|
|
|
7300
7288
|
|
|
7301
7289
|
// packages/qwik/src/server/ssr-container.ts
|
|
7302
7290
|
import {
|
|
7291
|
+
_EffectData as EffectData,
|
|
7303
7292
|
_SharedContainer as _SharedContainer2,
|
|
7304
7293
|
_jsxSorted as _jsxSorted3,
|
|
7305
7294
|
_jsxSplit as _jsxSplit2,
|
|
7306
7295
|
_walkJSX as _walkJSX2,
|
|
7307
|
-
isSignal as isSignal2
|
|
7308
|
-
_EffectData as EffectData2
|
|
7296
|
+
isSignal as isSignal2
|
|
7309
7297
|
} from "@qwik.dev/core";
|
|
7310
7298
|
import { isDev as isDev9 } from "@qwik.dev/core/build";
|
|
7311
7299
|
|
|
@@ -7482,6 +7470,165 @@ var PrefetchImplementationDefault = {
|
|
|
7482
7470
|
prefetchEvent: "always"
|
|
7483
7471
|
};
|
|
7484
7472
|
|
|
7473
|
+
// packages/qwik/src/server/ssr-node.ts
|
|
7474
|
+
import { _isJSXNode as isJSXNode2, _EMPTY_ARRAY } from "@qwik.dev/core";
|
|
7475
|
+
import { isDev as isDev8 } from "@qwik.dev/core/build";
|
|
7476
|
+
var SsrNode = class {
|
|
7477
|
+
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
|
|
7478
|
+
this.attrs = attrs;
|
|
7479
|
+
this.cleanupQueue = cleanupQueue;
|
|
7480
|
+
this.vnodeData = vnodeData;
|
|
7481
|
+
__publicField(this, "__brand__");
|
|
7482
|
+
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
|
|
7483
|
+
__publicField(this, "nodeType");
|
|
7484
|
+
/**
|
|
7485
|
+
* ID which the deserialize will use to retrieve the node.
|
|
7486
|
+
*
|
|
7487
|
+
* @param refId - Unique id for the node.
|
|
7488
|
+
*/
|
|
7489
|
+
__publicField(this, "id");
|
|
7490
|
+
/** Local props which don't serialize; */
|
|
7491
|
+
__publicField(this, "locals", null);
|
|
7492
|
+
__publicField(this, "currentComponentNode");
|
|
7493
|
+
__publicField(this, "childrenVNodeData", null);
|
|
7494
|
+
this.currentComponentNode = currentComponentNode;
|
|
7495
|
+
this.currentComponentNode?.addChildVNodeData(this.vnodeData);
|
|
7496
|
+
this.nodeType = nodeType;
|
|
7497
|
+
this.id = id;
|
|
7498
|
+
if (isDev8 && id.indexOf("undefined") != -1) {
|
|
7499
|
+
throw new Error(`Invalid SSR node id: ${id}`);
|
|
7500
|
+
}
|
|
7501
|
+
}
|
|
7502
|
+
setProp(name, value) {
|
|
7503
|
+
if (this.attrs === _EMPTY_ARRAY) {
|
|
7504
|
+
this.attrs = [];
|
|
7505
|
+
}
|
|
7506
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7507
|
+
mapArray_set(this.locals || (this.locals = []), name, value, 0);
|
|
7508
|
+
} else {
|
|
7509
|
+
mapArray_set(this.attrs, name, value, 0);
|
|
7510
|
+
}
|
|
7511
|
+
if (name == ELEMENT_SEQ && value) {
|
|
7512
|
+
this.cleanupQueue.push(value);
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
getProp(name) {
|
|
7516
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7517
|
+
return this.locals ? mapArray_get(this.locals, name, 0) : null;
|
|
7518
|
+
} else {
|
|
7519
|
+
return mapArray_get(this.attrs, name, 0);
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
removeProp(name) {
|
|
7523
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7524
|
+
if (this.locals) {
|
|
7525
|
+
mapApp_remove(this.locals, name, 0);
|
|
7526
|
+
}
|
|
7527
|
+
} else {
|
|
7528
|
+
mapApp_remove(this.attrs, name, 0);
|
|
7529
|
+
}
|
|
7530
|
+
}
|
|
7531
|
+
addChildVNodeData(child) {
|
|
7532
|
+
if (!this.childrenVNodeData) {
|
|
7533
|
+
this.childrenVNodeData = [];
|
|
7534
|
+
}
|
|
7535
|
+
this.childrenVNodeData.push(child);
|
|
7536
|
+
}
|
|
7537
|
+
toString() {
|
|
7538
|
+
let stringifiedAttrs = "";
|
|
7539
|
+
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
7540
|
+
const key = this.attrs[i];
|
|
7541
|
+
const value = this.attrs[i + 1];
|
|
7542
|
+
stringifiedAttrs += `${key}=`;
|
|
7543
|
+
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
7544
|
+
if (i < this.attrs.length - 2) {
|
|
7545
|
+
stringifiedAttrs += ", ";
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7548
|
+
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
7549
|
+
}
|
|
7550
|
+
};
|
|
7551
|
+
__publicField(SsrNode, "ELEMENT_NODE", 1);
|
|
7552
|
+
__publicField(SsrNode, "TEXT_NODE", 3);
|
|
7553
|
+
__publicField(SsrNode, "DOCUMENT_NODE", 9);
|
|
7554
|
+
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
|
|
7555
|
+
var DomRef = class {
|
|
7556
|
+
constructor($ssrNode$) {
|
|
7557
|
+
this.$ssrNode$ = $ssrNode$;
|
|
7558
|
+
}
|
|
7559
|
+
};
|
|
7560
|
+
var SsrComponentFrame = class {
|
|
7561
|
+
constructor(componentNode) {
|
|
7562
|
+
this.componentNode = componentNode;
|
|
7563
|
+
__publicField(this, "slots", []);
|
|
7564
|
+
__publicField(this, "projectionDepth", 0);
|
|
7565
|
+
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
|
|
7566
|
+
__publicField(this, "projectionScopedStyle", null);
|
|
7567
|
+
__publicField(this, "projectionComponentFrame", null);
|
|
7568
|
+
}
|
|
7569
|
+
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
7570
|
+
this.projectionScopedStyle = projectionScopedStyle;
|
|
7571
|
+
this.projectionComponentFrame = projectionComponentFrame;
|
|
7572
|
+
if (isJSXNode2(children)) {
|
|
7573
|
+
const slotName = this.getSlotName(children);
|
|
7574
|
+
mapArray_set(this.slots, slotName, children, 0);
|
|
7575
|
+
} else if (Array.isArray(children) && children.length > 0) {
|
|
7576
|
+
const defaultSlot = [];
|
|
7577
|
+
for (let i = 0; i < children.length; i++) {
|
|
7578
|
+
const child = children[i];
|
|
7579
|
+
if (isJSXNode2(child)) {
|
|
7580
|
+
const slotName = this.getSlotName(child);
|
|
7581
|
+
if (slotName === QDefaultSlot) {
|
|
7582
|
+
defaultSlot.push(child);
|
|
7583
|
+
} else {
|
|
7584
|
+
this.updateSlot(slotName, child);
|
|
7585
|
+
}
|
|
7586
|
+
} else {
|
|
7587
|
+
defaultSlot.push(child);
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7591
|
+
} else {
|
|
7592
|
+
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7593
|
+
}
|
|
7594
|
+
}
|
|
7595
|
+
updateSlot(slotName, child) {
|
|
7596
|
+
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
7597
|
+
if (existingSlots === null) {
|
|
7598
|
+
existingSlots = child;
|
|
7599
|
+
} else if (Array.isArray(existingSlots)) {
|
|
7600
|
+
existingSlots.push(child);
|
|
7601
|
+
} else {
|
|
7602
|
+
existingSlots = [existingSlots, child];
|
|
7603
|
+
}
|
|
7604
|
+
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
7605
|
+
}
|
|
7606
|
+
getSlotName(jsx2) {
|
|
7607
|
+
if (jsx2.props[QSlot]) {
|
|
7608
|
+
return jsx2.props[QSlot];
|
|
7609
|
+
}
|
|
7610
|
+
return QDefaultSlot;
|
|
7611
|
+
}
|
|
7612
|
+
hasSlot(slotName) {
|
|
7613
|
+
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
7614
|
+
}
|
|
7615
|
+
consumeChildrenForSlot(projectionNode, slotName) {
|
|
7616
|
+
const children = mapApp_remove(this.slots, slotName, 0);
|
|
7617
|
+
if (children !== null) {
|
|
7618
|
+
this.componentNode.setProp(slotName, projectionNode.id);
|
|
7619
|
+
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
7620
|
+
}
|
|
7621
|
+
return children;
|
|
7622
|
+
}
|
|
7623
|
+
releaseUnclaimedProjections(unclaimedProjections) {
|
|
7624
|
+
if (this.slots.length) {
|
|
7625
|
+
unclaimedProjections.push(this);
|
|
7626
|
+
unclaimedProjections.push(this.projectionScopedStyle);
|
|
7627
|
+
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7630
|
+
};
|
|
7631
|
+
|
|
7485
7632
|
// packages/qwik/src/server/tag-nesting.ts
|
|
7486
7633
|
var allowedContent = (state) => {
|
|
7487
7634
|
switch (state) {
|
|
@@ -7752,6 +7899,110 @@ function isInPhrasing(text, allowInput) {
|
|
|
7752
7899
|
}
|
|
7753
7900
|
}
|
|
7754
7901
|
|
|
7902
|
+
// packages/qwik/src/server/vnode-data.ts
|
|
7903
|
+
import { _EMPTY_ARRAY as _EMPTY_ARRAY2 } from "@qwik.dev/core";
|
|
7904
|
+
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
7905
|
+
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
7906
|
+
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
|
|
7907
|
+
function vNodeData_incrementElementCount(vNodeData) {
|
|
7908
|
+
const length = vNodeData.length;
|
|
7909
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7910
|
+
if (lastValue >= 0) {
|
|
7911
|
+
vNodeData.push(-1);
|
|
7912
|
+
} else {
|
|
7913
|
+
vNodeData[length - 1] = lastValue - 1;
|
|
7914
|
+
}
|
|
7915
|
+
}
|
|
7916
|
+
function vNodeData_addTextSize(vNodeData, size) {
|
|
7917
|
+
const length = vNodeData.length;
|
|
7918
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7919
|
+
if (length > 1 && lastValue >= 0) {
|
|
7920
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7921
|
+
}
|
|
7922
|
+
vNodeData.push(size);
|
|
7923
|
+
if (size == 0) {
|
|
7924
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7925
|
+
}
|
|
7926
|
+
}
|
|
7927
|
+
function vNodeData_openFragment(vNodeData, attrs) {
|
|
7928
|
+
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
7929
|
+
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
7930
|
+
}
|
|
7931
|
+
function vNodeData_closeFragment(vNodeData) {
|
|
7932
|
+
vNodeData.push(CLOSE_FRAGMENT);
|
|
7933
|
+
}
|
|
7934
|
+
function vNodeData_openElement(vNodeData) {
|
|
7935
|
+
vNodeData.push([], WRITE_ELEMENT_ATTRS);
|
|
7936
|
+
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
7937
|
+
}
|
|
7938
|
+
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
7939
|
+
vNodeData[0] |= 8 /* REFERENCE */;
|
|
7940
|
+
let fragmentAttrs = _EMPTY_ARRAY2;
|
|
7941
|
+
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
7942
|
+
for (let i = 1; i < vNodeData.length; i++) {
|
|
7943
|
+
const value = vNodeData[i];
|
|
7944
|
+
if (Array.isArray(value)) {
|
|
7945
|
+
fragmentAttrs = value;
|
|
7946
|
+
i++;
|
|
7947
|
+
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
7948
|
+
stack2[stack2.length - 1]++;
|
|
7949
|
+
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
7950
|
+
}
|
|
7951
|
+
} else if (value === CLOSE_FRAGMENT) {
|
|
7952
|
+
stack2.pop();
|
|
7953
|
+
stack2.pop();
|
|
7954
|
+
fragmentAttrs = _EMPTY_ARRAY2;
|
|
7955
|
+
} else if (value < 0) {
|
|
7956
|
+
const numberOfElements = 0 - value;
|
|
7957
|
+
stack2[stack2.length - 1] += numberOfElements;
|
|
7958
|
+
} else {
|
|
7959
|
+
stack2[stack2.length - 1]++;
|
|
7960
|
+
}
|
|
7961
|
+
}
|
|
7962
|
+
let refId = String(depthFirstElementIdx);
|
|
7963
|
+
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
7964
|
+
for (let i = 1; i < stack2.length; i += 2) {
|
|
7965
|
+
const childCount = stack2[i];
|
|
7966
|
+
if (childCount >= 0) {
|
|
7967
|
+
refId += encodeAsAlphanumeric(childCount);
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
const type = stack2[stack2.length - 2];
|
|
7972
|
+
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
7973
|
+
}
|
|
7974
|
+
var ALPHANUMERIC = [];
|
|
7975
|
+
function encodeAsAlphanumeric(value) {
|
|
7976
|
+
while (ALPHANUMERIC.length <= value) {
|
|
7977
|
+
let value2 = ALPHANUMERIC.length;
|
|
7978
|
+
let text = "";
|
|
7979
|
+
do {
|
|
7980
|
+
text = String.fromCharCode(
|
|
7981
|
+
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
7982
|
+
/* A-Z */
|
|
7983
|
+
) + text;
|
|
7984
|
+
value2 = Math.floor(
|
|
7985
|
+
value2 / 26
|
|
7986
|
+
/* A-Z */
|
|
7987
|
+
);
|
|
7988
|
+
} while (value2 !== 0);
|
|
7989
|
+
ALPHANUMERIC.push(text);
|
|
7990
|
+
}
|
|
7991
|
+
return ALPHANUMERIC[value];
|
|
7992
|
+
}
|
|
7993
|
+
|
|
7994
|
+
// packages/qwik/src/server/scripts.ts
|
|
7995
|
+
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)})()';
|
|
7996
|
+
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})()';
|
|
7997
|
+
function getQwikLoaderScript(opts = {}) {
|
|
7998
|
+
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
7999
|
+
}
|
|
8000
|
+
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
8001
|
+
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
8002
|
+
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
8003
|
+
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
8004
|
+
}
|
|
8005
|
+
|
|
7755
8006
|
// packages/qwik/src/server/ssr-container.ts
|
|
7756
8007
|
function ssrCreateContainer(opts) {
|
|
7757
8008
|
opts.renderOptions || (opts.renderOptions = {});
|
|
@@ -7951,15 +8202,16 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
7951
8202
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
7952
8203
|
}
|
|
7953
8204
|
this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
|
|
8205
|
+
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
7954
8206
|
this.write("<");
|
|
7955
8207
|
this.write(elementName);
|
|
7956
8208
|
if (varAttrs) {
|
|
7957
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false);
|
|
8209
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
7958
8210
|
}
|
|
7959
8211
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
7960
8212
|
isDev9 && this.write('=""');
|
|
7961
8213
|
if (constAttrs && constAttrs.length) {
|
|
7962
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
|
|
8214
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
7963
8215
|
}
|
|
7964
8216
|
this.write(">");
|
|
7965
8217
|
this.lastNode = null;
|
|
@@ -8034,12 +8286,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8034
8286
|
}
|
|
8035
8287
|
openProjection(attrs) {
|
|
8036
8288
|
this.openFragment(attrs);
|
|
8037
|
-
const vNode = this.currentElementFrame?.vNodeData;
|
|
8038
|
-
if (vNode) {
|
|
8039
|
-
vNode[0] |= 8 /* SERIALIZE */;
|
|
8040
|
-
}
|
|
8041
8289
|
const componentFrame = this.getComponentFrame();
|
|
8042
8290
|
if (componentFrame) {
|
|
8291
|
+
this.serializationCtx.$addRoot$(componentFrame.componentNode);
|
|
8043
8292
|
componentFrame.projectionDepth++;
|
|
8044
8293
|
}
|
|
8045
8294
|
}
|
|
@@ -8199,12 +8448,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8199
8448
|
for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
|
|
8200
8449
|
const vNode = vNodeData[elementIdx];
|
|
8201
8450
|
const flag = vNode[0];
|
|
8202
|
-
if (flag &
|
|
8451
|
+
if (flag & 16 /* SERIALIZE */) {
|
|
8203
8452
|
lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
|
|
8204
|
-
if (flag &
|
|
8453
|
+
if (flag & 8 /* REFERENCE */) {
|
|
8205
8454
|
this.write(VNodeDataSeparator.REFERENCE_CH);
|
|
8206
8455
|
}
|
|
8207
|
-
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
|
|
8456
|
+
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
|
|
8208
8457
|
let fragmentAttrs = null;
|
|
8209
8458
|
let depth = 0;
|
|
8210
8459
|
for (let i = 1; i < vNode.length; i++) {
|
|
@@ -8222,6 +8471,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8222
8471
|
}
|
|
8223
8472
|
depth--;
|
|
8224
8473
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
8474
|
+
} else if (value === WRITE_ELEMENT_ATTRS) {
|
|
8475
|
+
if (fragmentAttrs && fragmentAttrs.length) {
|
|
8476
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8477
|
+
writeFragmentAttrs(this.write.bind(this), this.addRoot.bind(this), fragmentAttrs);
|
|
8478
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8479
|
+
fragmentAttrs = vNodeAttrsStack.pop();
|
|
8480
|
+
}
|
|
8225
8481
|
} else if (value >= 0) {
|
|
8226
8482
|
this.write(encodeAsAlphanumeric(value));
|
|
8227
8483
|
} else {
|
|
@@ -8274,6 +8530,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8274
8530
|
case ELEMENT_SEQ_IDX:
|
|
8275
8531
|
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
8276
8532
|
break;
|
|
8533
|
+
case QSubscribers:
|
|
8534
|
+
write(VNodeDataChar.SUBS_CHAR);
|
|
8535
|
+
break;
|
|
8277
8536
|
// Skipping `\` character for now because it is used for escaping.
|
|
8278
8537
|
case QCtxAttr:
|
|
8279
8538
|
write(VNodeDataChar.CONTEXT_CHAR);
|
|
@@ -8473,7 +8732,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8473
8732
|
);
|
|
8474
8733
|
const lastNode = this.getLastNode();
|
|
8475
8734
|
if (lastNode.vnodeData) {
|
|
8476
|
-
lastNode.vnodeData[0] |=
|
|
8735
|
+
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
8477
8736
|
}
|
|
8478
8737
|
ssrComponentNode?.setProp(value, lastNode.id);
|
|
8479
8738
|
await _walkJSX2(this, children, {
|
|
@@ -8587,7 +8846,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8587
8846
|
this.write(element);
|
|
8588
8847
|
}
|
|
8589
8848
|
}
|
|
8590
|
-
writeAttrs(tag, attrs, isConst) {
|
|
8849
|
+
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
8591
8850
|
let innerHTML = void 0;
|
|
8592
8851
|
if (attrs.length) {
|
|
8593
8852
|
for (let i = 0; i < attrs.length; i++) {
|
|
@@ -8596,7 +8855,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8596
8855
|
let styleScopedId = null;
|
|
8597
8856
|
if (isSSRUnsafeAttr(key)) {
|
|
8598
8857
|
if (isDev9) {
|
|
8599
|
-
throw
|
|
8858
|
+
throw qError(51 /* unsafeAttr */);
|
|
8600
8859
|
}
|
|
8601
8860
|
continue;
|
|
8602
8861
|
}
|
|
@@ -8613,11 +8872,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8613
8872
|
} else if (typeof value === "function") {
|
|
8614
8873
|
value(new DomRef(lastNode));
|
|
8615
8874
|
continue;
|
|
8875
|
+
} else {
|
|
8876
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
8616
8877
|
}
|
|
8617
8878
|
}
|
|
8618
8879
|
if (isSignal2(value)) {
|
|
8619
8880
|
const lastNode = this.getLastNode();
|
|
8620
|
-
const signalData = new
|
|
8881
|
+
const signalData = new EffectData({
|
|
8621
8882
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
8622
8883
|
$isConst$: isConst
|
|
8623
8884
|
});
|
|
@@ -8632,13 +8893,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8632
8893
|
}
|
|
8633
8894
|
}
|
|
8634
8895
|
if (tag === "textarea" && key === "value") {
|
|
8635
|
-
if (typeof value !== "string") {
|
|
8896
|
+
if (value && typeof value !== "string") {
|
|
8636
8897
|
if (isDev9) {
|
|
8637
|
-
throw
|
|
8898
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
8638
8899
|
}
|
|
8639
8900
|
continue;
|
|
8640
8901
|
}
|
|
8641
|
-
innerHTML = escapeHTML(value);
|
|
8902
|
+
innerHTML = escapeHTML(value || "");
|
|
8642
8903
|
key = QContainerAttr;
|
|
8643
8904
|
value = "text" /* TEXT */;
|
|
8644
8905
|
}
|
|
@@ -8670,7 +8931,7 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
8670
8931
|
return false;
|
|
8671
8932
|
};
|
|
8672
8933
|
function newTagError(text) {
|
|
8673
|
-
return
|
|
8934
|
+
return qError(29 /* tagError */, [text]);
|
|
8674
8935
|
}
|
|
8675
8936
|
function hasDestroy(obj) {
|
|
8676
8937
|
return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
|
|
@@ -8884,18 +9145,6 @@ function resolveManifest(manifest) {
|
|
|
8884
9145
|
}
|
|
8885
9146
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8886
9147
|
|
|
8887
|
-
// packages/qwik/src/server/scripts.ts
|
|
8888
|
-
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)})()';
|
|
8889
|
-
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})()';
|
|
8890
|
-
function getQwikLoaderScript(opts = {}) {
|
|
8891
|
-
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8892
|
-
}
|
|
8893
|
-
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
8894
|
-
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
8895
|
-
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
8896
|
-
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
8897
|
-
}
|
|
8898
|
-
|
|
8899
9148
|
// packages/qwik/src/server/index.ts
|
|
8900
9149
|
async function setServerPlatform2(manifest) {
|
|
8901
9150
|
const platform = createPlatform({ manifest }, resolveManifest(manifest));
|