@qwik.dev/core 2.0.0-alpha.3 → 2.0.0-alpha.4
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 +38 -16
- package/dist/core.cjs +6473 -6292
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +6460 -6291
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +1543 -1386
- package/dist/core.prod.mjs +3013 -2879
- 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 +1894 -1887
- package/dist/optimizer.mjs +1728 -1775
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +689 -529
- package/dist/server.mjs +680 -521
- package/dist/testing/index.cjs +3200 -3029
- package/dist/testing/index.mjs +3165 -2995
- 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.4-dev+374e0d6
|
|
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
|
-
"The JSX ref attribute must be a Signal"
|
|
204
|
+
"The 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
|
+
"The value of the textarea must be a string",
|
|
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.4-dev+374e0d6",
|
|
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) => {
|
|
@@ -1213,8 +994,11 @@ var Subscriber = class {
|
|
|
1213
994
|
function isSubscriber(value) {
|
|
1214
995
|
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
1215
996
|
}
|
|
1216
|
-
function clearVNodeEffectDependencies(value) {
|
|
1217
|
-
|
|
997
|
+
function clearVNodeEffectDependencies(container, value) {
|
|
998
|
+
if (vnode_isElementVNode(value)) {
|
|
999
|
+
ensureMaterialized(value);
|
|
1000
|
+
}
|
|
1001
|
+
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
1218
1002
|
if (!effects) {
|
|
1219
1003
|
return;
|
|
1220
1004
|
}
|
|
@@ -1242,15 +1026,24 @@ function clearEffects(subscriber, value) {
|
|
|
1242
1026
|
return false;
|
|
1243
1027
|
}
|
|
1244
1028
|
const effectSubscriptions = subscriber.$effects$;
|
|
1245
|
-
|
|
1246
|
-
|
|
1029
|
+
const hostElement = subscriber.$hostElement$;
|
|
1030
|
+
if (hostElement && hostElement === value) {
|
|
1031
|
+
subscriber.$hostElement$ = null;
|
|
1247
1032
|
}
|
|
1248
1033
|
let subscriptionRemoved = false;
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1034
|
+
if (effectSubscriptions) {
|
|
1035
|
+
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
1036
|
+
const effect = effectSubscriptions[i];
|
|
1037
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1038
|
+
effectSubscriptions.splice(i, 1);
|
|
1039
|
+
subscriptionRemoved = true;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
const args = subscriber.$args$;
|
|
1044
|
+
if (args) {
|
|
1045
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1046
|
+
clearEffects(args[i], subscriber);
|
|
1254
1047
|
}
|
|
1255
1048
|
}
|
|
1256
1049
|
return subscriptionRemoved;
|
|
@@ -1404,7 +1197,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
|
|
|
1404
1197
|
};
|
|
1405
1198
|
|
|
1406
1199
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1407
|
-
import { isDev as
|
|
1200
|
+
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
1408
1201
|
|
|
1409
1202
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
1410
1203
|
var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
|
|
@@ -1576,7 +1369,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
1576
1369
|
}
|
|
1577
1370
|
|
|
1578
1371
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
1579
|
-
import { isDev as
|
|
1372
|
+
import { isDev as isDev3 } from "@qwik.dev/core/build";
|
|
1580
1373
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1581
1374
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
|
|
1582
1375
|
iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
|
|
@@ -1612,7 +1405,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1612
1405
|
}
|
|
1613
1406
|
}
|
|
1614
1407
|
if (vnode_isVNode(renderHost)) {
|
|
1615
|
-
clearVNodeEffectDependencies(renderHost);
|
|
1408
|
+
clearVNodeEffectDependencies(container, renderHost);
|
|
1616
1409
|
}
|
|
1617
1410
|
return componentFn(props);
|
|
1618
1411
|
},
|
|
@@ -1655,7 +1448,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
1655
1448
|
if (jsxElement2) {
|
|
1656
1449
|
addUseOnEvent(jsxElement2, key, useOnEvents[key]);
|
|
1657
1450
|
}
|
|
1658
|
-
} else if (
|
|
1451
|
+
} else if (isDev3) {
|
|
1659
1452
|
logWarn(
|
|
1660
1453
|
'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
1454
|
);
|
|
@@ -1686,7 +1479,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1686
1479
|
const queue = [jsx2];
|
|
1687
1480
|
while (queue.length) {
|
|
1688
1481
|
const jsx3 = queue.shift();
|
|
1689
|
-
if (
|
|
1482
|
+
if (isJSXNode(jsx3)) {
|
|
1690
1483
|
if (typeof jsx3.type === "string") {
|
|
1691
1484
|
return jsx3;
|
|
1692
1485
|
}
|
|
@@ -1705,7 +1498,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1705
1498
|
return null;
|
|
1706
1499
|
}
|
|
1707
1500
|
function addScriptNodeForInvisibleComponents(jsx2) {
|
|
1708
|
-
if (
|
|
1501
|
+
if (isJSXNode(jsx2)) {
|
|
1709
1502
|
const jsxElement = new JSXNodeImpl(
|
|
1710
1503
|
"script",
|
|
1711
1504
|
{},
|
|
@@ -1804,12 +1597,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1804
1597
|
descend(jsxValue, false);
|
|
1805
1598
|
} else if (isSignal(jsxValue)) {
|
|
1806
1599
|
if (vCurrent) {
|
|
1807
|
-
clearVNodeEffectDependencies(vCurrent);
|
|
1600
|
+
clearVNodeEffectDependencies(container, vCurrent);
|
|
1808
1601
|
}
|
|
1809
1602
|
expectVirtual("S" /* WrappedSignal */, null);
|
|
1810
1603
|
descend(
|
|
1811
|
-
|
|
1812
|
-
|
|
1604
|
+
trackSignalAndAssignHost(
|
|
1605
|
+
jsxValue,
|
|
1813
1606
|
vNewNode || vCurrent,
|
|
1814
1607
|
"." /* VNODE */,
|
|
1815
1608
|
container
|
|
@@ -1819,7 +1612,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1819
1612
|
} else if (isPromise(jsxValue)) {
|
|
1820
1613
|
expectVirtual("A" /* Awaited */, null);
|
|
1821
1614
|
asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
1822
|
-
} else if (
|
|
1615
|
+
} else if (isJSXNode(jsxValue)) {
|
|
1823
1616
|
const type = jsxValue.type;
|
|
1824
1617
|
if (typeof type === "string") {
|
|
1825
1618
|
expectNoMoreTextNodes();
|
|
@@ -1976,7 +1769,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1976
1769
|
for (let i = 0; i < projectionChildren.length; i++) {
|
|
1977
1770
|
const child = projectionChildren[i];
|
|
1978
1771
|
const slotName = String(
|
|
1979
|
-
|
|
1772
|
+
isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
|
|
1980
1773
|
);
|
|
1981
1774
|
const idx = mapApp_findIndx(projections, slotName, 0);
|
|
1982
1775
|
let jsxBucket;
|
|
@@ -2006,8 +1799,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2006
1799
|
);
|
|
2007
1800
|
if (vCurrent == null) {
|
|
2008
1801
|
vNewNode = vnode_newVirtual();
|
|
2009
|
-
|
|
2010
|
-
|
|
1802
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1803
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectProjection");
|
|
2011
1804
|
vnode_setProp(vNewNode, QSlot, slotName);
|
|
2012
1805
|
vnode_setProp(vNewNode, QSlotParent, vParent);
|
|
2013
1806
|
vnode_setProp(vParent, slotName, vNewNode);
|
|
@@ -2033,8 +1826,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2033
1826
|
);
|
|
2034
1827
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2035
1828
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2036
|
-
|
|
2037
|
-
|
|
1829
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1830
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2038
1831
|
return false;
|
|
2039
1832
|
} else if (vProjectedNode === vCurrent) {
|
|
2040
1833
|
} else {
|
|
@@ -2046,8 +1839,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2046
1839
|
);
|
|
2047
1840
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2048
1841
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2049
|
-
|
|
2050
|
-
|
|
1842
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1843
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2051
1844
|
}
|
|
2052
1845
|
return true;
|
|
2053
1846
|
}
|
|
@@ -2057,7 +1850,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2057
1850
|
if (constProps && typeof constProps == "object" && "name" in constProps) {
|
|
2058
1851
|
const constValue = constProps.name;
|
|
2059
1852
|
if (vHost && constValue instanceof WrappedSignal) {
|
|
2060
|
-
return
|
|
1853
|
+
return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
|
|
2061
1854
|
}
|
|
2062
1855
|
}
|
|
2063
1856
|
return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
|
|
@@ -2139,12 +1932,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2139
1932
|
}
|
|
2140
1933
|
}
|
|
2141
1934
|
if (isSignal(value)) {
|
|
2142
|
-
const signalData = new
|
|
1935
|
+
const signalData = new EffectPropData({
|
|
2143
1936
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2144
1937
|
$isConst$: true
|
|
2145
1938
|
});
|
|
2146
|
-
value =
|
|
2147
|
-
|
|
1939
|
+
value = trackSignalAndAssignHost(
|
|
1940
|
+
value,
|
|
2148
1941
|
vNewNode,
|
|
2149
1942
|
key2,
|
|
2150
1943
|
container,
|
|
@@ -2158,8 +1951,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2158
1951
|
}
|
|
2159
1952
|
if (elementName === "textarea" && key2 === "value") {
|
|
2160
1953
|
if (typeof value !== "string") {
|
|
2161
|
-
if (
|
|
2162
|
-
|
|
1954
|
+
if (isDev4) {
|
|
1955
|
+
throw qError(40 /* wrongTextareaValue */);
|
|
2163
1956
|
}
|
|
2164
1957
|
continue;
|
|
2165
1958
|
}
|
|
@@ -2291,7 +2084,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2291
2084
|
}
|
|
2292
2085
|
};
|
|
2293
2086
|
while (srcKey !== null || dstKey !== null) {
|
|
2294
|
-
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey
|
|
2087
|
+
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith(Q_PREFIX)) {
|
|
2295
2088
|
dstIdx++;
|
|
2296
2089
|
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2297
2090
|
} else if (srcKey == null) {
|
|
@@ -2402,7 +2195,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2402
2195
|
vCurrent && getInsertBefore()
|
|
2403
2196
|
);
|
|
2404
2197
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
|
|
2405
|
-
|
|
2198
|
+
isDev4 && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
|
|
2406
2199
|
}
|
|
2407
2200
|
function expectComponent(component) {
|
|
2408
2201
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -2477,7 +2270,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2477
2270
|
}
|
|
2478
2271
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
2479
2272
|
if (host) {
|
|
2480
|
-
clearVNodeEffectDependencies(host);
|
|
2273
|
+
clearVNodeEffectDependencies(container, host);
|
|
2481
2274
|
}
|
|
2482
2275
|
vnode_insertBefore(
|
|
2483
2276
|
journal,
|
|
@@ -2486,7 +2279,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2486
2279
|
vCurrent && getInsertBefore()
|
|
2487
2280
|
);
|
|
2488
2281
|
const jsxNode2 = jsxValue;
|
|
2489
|
-
|
|
2282
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
2490
2283
|
container.setHostProp(vNewNode, OnRenderProp, componentQRL);
|
|
2491
2284
|
container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
|
|
2492
2285
|
container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2499,7 +2292,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2499
2292
|
vCurrent && getInsertBefore()
|
|
2500
2293
|
);
|
|
2501
2294
|
const jsxNode2 = jsxValue;
|
|
2502
|
-
|
|
2295
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
2503
2296
|
vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
|
|
2504
2297
|
if (jsxNode2.key) {
|
|
2505
2298
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2543,8 +2336,8 @@ function propsDiffer(src, dst) {
|
|
|
2543
2336
|
if (!src || !dst) {
|
|
2544
2337
|
return true;
|
|
2545
2338
|
}
|
|
2546
|
-
let srcKeys =
|
|
2547
|
-
let dstKeys =
|
|
2339
|
+
let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
|
|
2340
|
+
let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
|
|
2548
2341
|
if (srcKeys.length !== dstKeys.length) {
|
|
2549
2342
|
return true;
|
|
2550
2343
|
}
|
|
@@ -2559,10 +2352,13 @@ function propsDiffer(src, dst) {
|
|
|
2559
2352
|
}
|
|
2560
2353
|
return false;
|
|
2561
2354
|
}
|
|
2562
|
-
function
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
keys.
|
|
2355
|
+
function removePropsKeys(keys, propKeys) {
|
|
2356
|
+
for (let i = propKeys.length - 1; i >= 0; i--) {
|
|
2357
|
+
const propKey = propKeys[i];
|
|
2358
|
+
const propIdx = keys.indexOf(propKey);
|
|
2359
|
+
if (propIdx !== -1) {
|
|
2360
|
+
keys.splice(propIdx, 1);
|
|
2361
|
+
}
|
|
2566
2362
|
}
|
|
2567
2363
|
return keys;
|
|
2568
2364
|
}
|
|
@@ -2575,9 +2371,9 @@ function cleanup(container, vNode) {
|
|
|
2575
2371
|
do {
|
|
2576
2372
|
const type = vCursor[0 /* flags */];
|
|
2577
2373
|
if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
|
|
2374
|
+
clearVNodeEffectDependencies(container, vCursor);
|
|
2375
|
+
markVNodeAsDeleted(vCursor);
|
|
2578
2376
|
if (type & 2 /* Virtual */) {
|
|
2579
|
-
clearVNodeEffectDependencies(vCursor);
|
|
2580
|
-
markVNodeAsDeleted(vCursor);
|
|
2581
2377
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
2582
2378
|
if (seq) {
|
|
2583
2379
|
for (let i = 0; i < seq.length; i++) {
|
|
@@ -2586,7 +2382,7 @@ function cleanup(container, vNode) {
|
|
|
2586
2382
|
const task = obj;
|
|
2587
2383
|
clearSubscriberEffectDependencies(task);
|
|
2588
2384
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2589
|
-
container.$scheduler$(
|
|
2385
|
+
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2590
2386
|
} else {
|
|
2591
2387
|
cleanupTask(task);
|
|
2592
2388
|
}
|
|
@@ -2677,8 +2473,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2677
2473
|
let journalFlushScheduled = false;
|
|
2678
2474
|
return schedule;
|
|
2679
2475
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
2680
|
-
const runLater = type !==
|
|
2681
|
-
const isTask2 = type === 3 /* TASK */ || type ===
|
|
2476
|
+
const runLater = type !== 255 /* WAIT_FOR_ALL */ && type !== 6 /* COMPONENT_SSR */;
|
|
2477
|
+
const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 48 /* CLEANUP_VISIBLE */;
|
|
2682
2478
|
if (isTask2) {
|
|
2683
2479
|
hostOrTask.$flags$ |= 8 /* DIRTY */;
|
|
2684
2480
|
}
|
|
@@ -2698,7 +2494,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2698
2494
|
chore = sortedInsert(choreQueue, chore);
|
|
2699
2495
|
if (!journalFlushScheduled && runLater) {
|
|
2700
2496
|
journalFlushScheduled = true;
|
|
2701
|
-
schedule(
|
|
2497
|
+
schedule(16 /* JOURNAL_FLUSH */);
|
|
2702
2498
|
scheduleDrain();
|
|
2703
2499
|
}
|
|
2704
2500
|
if (runLater) {
|
|
@@ -2725,7 +2521,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2725
2521
|
}
|
|
2726
2522
|
const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
|
|
2727
2523
|
if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
|
|
2728
|
-
nextChore.$type$ !==
|
|
2524
|
+
nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
|
|
2729
2525
|
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
2730
2526
|
continue;
|
|
2731
2527
|
}
|
|
@@ -2744,7 +2540,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2744
2540
|
currentChore = chore;
|
|
2745
2541
|
let returnValue = null;
|
|
2746
2542
|
switch (chore.$type$) {
|
|
2747
|
-
case
|
|
2543
|
+
case 16 /* JOURNAL_FLUSH */:
|
|
2748
2544
|
returnValue = journalFlush();
|
|
2749
2545
|
journalFlushScheduled = false;
|
|
2750
2546
|
break;
|
|
@@ -2781,10 +2577,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2781
2577
|
case 3 /* TASK */:
|
|
2782
2578
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2783
2579
|
break;
|
|
2784
|
-
case
|
|
2580
|
+
case 32 /* VISIBLE */:
|
|
2785
2581
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2786
2582
|
break;
|
|
2787
|
-
case
|
|
2583
|
+
case 48 /* CLEANUP_VISIBLE */:
|
|
2788
2584
|
const task = chore.$payload$;
|
|
2789
2585
|
cleanupTask(task);
|
|
2790
2586
|
break;
|
|
@@ -2819,6 +2615,20 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2819
2615
|
returnValue = !target.resolved ? target.resolve() : null;
|
|
2820
2616
|
break;
|
|
2821
2617
|
}
|
|
2618
|
+
case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
|
|
2619
|
+
const target = chore.$target$;
|
|
2620
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
2621
|
+
target.$forceRunEffects$ = false;
|
|
2622
|
+
if (!target.$effects$?.length) {
|
|
2623
|
+
break;
|
|
2624
|
+
}
|
|
2625
|
+
returnValue = retryOnPromise(() => {
|
|
2626
|
+
if (target.$computeIfNeeded$() || forceRunEffects) {
|
|
2627
|
+
triggerEffects(container, target, target.$effects$);
|
|
2628
|
+
}
|
|
2629
|
+
});
|
|
2630
|
+
break;
|
|
2631
|
+
}
|
|
2822
2632
|
}
|
|
2823
2633
|
return maybeThenPassError(returnValue, (value) => {
|
|
2824
2634
|
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
@@ -2843,11 +2653,11 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
2843
2653
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2844
2654
|
}
|
|
2845
2655
|
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2846
|
-
const macroTypeDiff = (a.$type$ &
|
|
2656
|
+
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2847
2657
|
if (macroTypeDiff !== 0) {
|
|
2848
2658
|
return macroTypeDiff;
|
|
2849
2659
|
}
|
|
2850
|
-
if (a.$type$ !==
|
|
2660
|
+
if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
|
|
2851
2661
|
const aHost = a.$host$;
|
|
2852
2662
|
const bHost = b.$host$;
|
|
2853
2663
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
@@ -2862,7 +2672,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2862
2672
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2863
2673
|
Problematic Node: ${aHost.toString()}`;
|
|
2864
2674
|
if (shouldThrowOnHostMismatch) {
|
|
2865
|
-
|
|
2675
|
+
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2866
2676
|
}
|
|
2867
2677
|
logWarn(errorMessage);
|
|
2868
2678
|
return null;
|
|
@@ -2876,7 +2686,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2876
2686
|
if (idxDiff !== 0) {
|
|
2877
2687
|
return idxDiff;
|
|
2878
2688
|
}
|
|
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 */)) {
|
|
2689
|
+
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
2690
|
return 1;
|
|
2881
2691
|
}
|
|
2882
2692
|
}
|
|
@@ -2918,11 +2728,11 @@ function debugChoreToString(chore) {
|
|
|
2918
2728
|
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
2919
2729
|
[7 /* COMPONENT */]: "COMPONENT",
|
|
2920
2730
|
[6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
|
|
2921
|
-
[
|
|
2922
|
-
[
|
|
2923
|
-
[
|
|
2924
|
-
[
|
|
2925
|
-
[
|
|
2731
|
+
[8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
|
|
2732
|
+
[16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
|
|
2733
|
+
[32 /* VISIBLE */]: "VISIBLE",
|
|
2734
|
+
[48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
|
|
2735
|
+
[255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
|
|
2926
2736
|
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
2927
2737
|
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
2928
2738
|
const qrlTarget = chore.$target$?.$symbol$;
|
|
@@ -3045,7 +2855,7 @@ var throwIfQRLNotResolved = (qrl) => {
|
|
|
3045
2855
|
var isSignal = (value) => {
|
|
3046
2856
|
return value instanceof Signal;
|
|
3047
2857
|
};
|
|
3048
|
-
var
|
|
2858
|
+
var EffectPropData = class {
|
|
3049
2859
|
constructor(data) {
|
|
3050
2860
|
__publicField(this, "data");
|
|
3051
2861
|
this.data = data;
|
|
@@ -3109,7 +2919,7 @@ var Signal = class {
|
|
|
3109
2919
|
// prevent accidental use as value
|
|
3110
2920
|
valueOf() {
|
|
3111
2921
|
if (qDev) {
|
|
3112
|
-
|
|
2922
|
+
throw qError(46 /* cannotCoerceSignal */);
|
|
3113
2923
|
}
|
|
3114
2924
|
}
|
|
3115
2925
|
toString() {
|
|
@@ -3141,7 +2951,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
|
3141
2951
|
return;
|
|
3142
2952
|
}
|
|
3143
2953
|
effect.$effectDependencies$.push(subscriber);
|
|
3144
|
-
} else if (vnode_isVNode(effect) &&
|
|
2954
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
3145
2955
|
let subscribers = vnode_getProp(
|
|
3146
2956
|
effect,
|
|
3147
2957
|
QSubscribers,
|
|
@@ -3185,7 +2995,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3185
2995
|
DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
3186
2996
|
let choreType = 3 /* TASK */;
|
|
3187
2997
|
if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
3188
|
-
choreType =
|
|
2998
|
+
choreType = 32 /* VISIBLE */;
|
|
3189
2999
|
} else if (effect.$flags$ & 4 /* RESOURCE */) {
|
|
3190
3000
|
choreType = 2 /* RESOURCE */;
|
|
3191
3001
|
}
|
|
@@ -3196,13 +3006,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3196
3006
|
container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
|
|
3197
3007
|
}
|
|
3198
3008
|
}
|
|
3199
|
-
|
|
3200
|
-
retryOnPromise(
|
|
3201
|
-
() => effect.$invalidate$()
|
|
3202
|
-
);
|
|
3203
|
-
} catch (e) {
|
|
3204
|
-
logError(e);
|
|
3205
|
-
}
|
|
3009
|
+
effect.$invalidate$();
|
|
3206
3010
|
} else if (property === ":" /* COMPONENT */) {
|
|
3207
3011
|
const host = effect;
|
|
3208
3012
|
const qrl = container.getHostProp(host, OnRenderProp);
|
|
@@ -3215,9 +3019,8 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3215
3019
|
container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
|
|
3216
3020
|
} else {
|
|
3217
3021
|
const host = effect;
|
|
3218
|
-
|
|
3219
|
-
if (effectData instanceof
|
|
3220
|
-
effectData = effectData;
|
|
3022
|
+
const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
|
|
3023
|
+
if (effectData instanceof EffectPropData) {
|
|
3221
3024
|
const data = effectData.data;
|
|
3222
3025
|
const payload = {
|
|
3223
3026
|
...data,
|
|
@@ -3244,16 +3047,13 @@ var ComputedSignal = class extends Signal {
|
|
|
3244
3047
|
// We need a separate flag to know when the computation needs running because
|
|
3245
3048
|
// we need the old value to know if effects need running after computation
|
|
3246
3049
|
__publicField(this, "$invalid$", true);
|
|
3050
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3247
3051
|
this.$computeQrl$ = fn;
|
|
3248
3052
|
}
|
|
3249
3053
|
$invalidate$() {
|
|
3250
3054
|
this.$invalid$ = true;
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
}
|
|
3254
|
-
if (this.$computeIfNeeded$()) {
|
|
3255
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3256
|
-
}
|
|
3055
|
+
this.$forceRunEffects$ = false;
|
|
3056
|
+
this.$container$?.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
|
|
3257
3057
|
}
|
|
3258
3058
|
/**
|
|
3259
3059
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3261,10 +3061,14 @@ var ComputedSignal = class extends Signal {
|
|
|
3261
3061
|
*/
|
|
3262
3062
|
force() {
|
|
3263
3063
|
this.$invalid$ = true;
|
|
3064
|
+
this.$forceRunEffects$ = false;
|
|
3264
3065
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3265
3066
|
}
|
|
3266
3067
|
get untrackedValue() {
|
|
3267
|
-
this.$computeIfNeeded$();
|
|
3068
|
+
const didChange = this.$computeIfNeeded$();
|
|
3069
|
+
if (didChange) {
|
|
3070
|
+
this.$forceRunEffects$ = didChange;
|
|
3071
|
+
}
|
|
3268
3072
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3269
3073
|
return this.$untrackedValue$;
|
|
3270
3074
|
}
|
|
@@ -3280,9 +3084,10 @@ var ComputedSignal = class extends Signal {
|
|
|
3280
3084
|
try {
|
|
3281
3085
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3282
3086
|
if (isPromise(untrackedValue)) {
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3087
|
+
throw qError(47 /* computedNotSync */, [
|
|
3088
|
+
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3089
|
+
computeQrl.$hash$
|
|
3090
|
+
]);
|
|
3286
3091
|
}
|
|
3287
3092
|
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
3288
3093
|
this.$invalid$ = false;
|
|
@@ -3302,7 +3107,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3302
3107
|
return super.value;
|
|
3303
3108
|
}
|
|
3304
3109
|
set value(_) {
|
|
3305
|
-
|
|
3110
|
+
throw qError(48 /* computedReadOnly */);
|
|
3306
3111
|
}
|
|
3307
3112
|
};
|
|
3308
3113
|
var WrappedSignal = class extends Signal {
|
|
@@ -3315,18 +3120,20 @@ var WrappedSignal = class extends Signal {
|
|
|
3315
3120
|
// we need the old value to know if effects need running after computation
|
|
3316
3121
|
__publicField(this, "$invalid$", true);
|
|
3317
3122
|
__publicField(this, "$effectDependencies$", null);
|
|
3123
|
+
__publicField(this, "$hostElement$", null);
|
|
3124
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3318
3125
|
this.$args$ = args;
|
|
3319
3126
|
this.$func$ = fn;
|
|
3320
3127
|
this.$funcStr$ = fnStr;
|
|
3321
3128
|
}
|
|
3322
3129
|
$invalidate$() {
|
|
3323
3130
|
this.$invalid$ = true;
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3131
|
+
this.$forceRunEffects$ = false;
|
|
3132
|
+
this.$container$?.$scheduler$(
|
|
3133
|
+
8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
|
|
3134
|
+
this.$hostElement$,
|
|
3135
|
+
this
|
|
3136
|
+
);
|
|
3330
3137
|
}
|
|
3331
3138
|
/**
|
|
3332
3139
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3334,10 +3141,14 @@ var WrappedSignal = class extends Signal {
|
|
|
3334
3141
|
*/
|
|
3335
3142
|
force() {
|
|
3336
3143
|
this.$invalid$ = true;
|
|
3144
|
+
this.$forceRunEffects$ = false;
|
|
3337
3145
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3338
3146
|
}
|
|
3339
3147
|
get untrackedValue() {
|
|
3340
|
-
this.$computeIfNeeded$();
|
|
3148
|
+
const didChange = this.$computeIfNeeded$();
|
|
3149
|
+
if (didChange) {
|
|
3150
|
+
this.$forceRunEffects$ = didChange;
|
|
3151
|
+
}
|
|
3341
3152
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3342
3153
|
return this.$untrackedValue$;
|
|
3343
3154
|
}
|
|
@@ -3362,12 +3173,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3362
3173
|
return super.value;
|
|
3363
3174
|
}
|
|
3364
3175
|
set value(_) {
|
|
3365
|
-
|
|
3176
|
+
throw qError(49 /* wrappedReadOnly */);
|
|
3366
3177
|
}
|
|
3367
3178
|
};
|
|
3368
3179
|
|
|
3369
3180
|
// packages/qwik/src/core/version.ts
|
|
3370
|
-
var version = "2.0.0-alpha.
|
|
3181
|
+
var version = "2.0.0-alpha.4-dev+374e0d6";
|
|
3371
3182
|
|
|
3372
3183
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3373
3184
|
var _SharedContainer = class {
|
|
@@ -3392,7 +3203,7 @@ var _SharedContainer = class {
|
|
|
3392
3203
|
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
3393
3204
|
}
|
|
3394
3205
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3395
|
-
return
|
|
3206
|
+
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
3396
3207
|
}
|
|
3397
3208
|
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3398
3209
|
return createSerializationContext(
|
|
@@ -3514,7 +3325,7 @@ var JSXNodeImpl = class {
|
|
|
3514
3325
|
}
|
|
3515
3326
|
};
|
|
3516
3327
|
var Virtual = (props) => props.children;
|
|
3517
|
-
var
|
|
3328
|
+
var isJSXNode = (n) => {
|
|
3518
3329
|
if (qDev) {
|
|
3519
3330
|
if (n instanceof JSXNodeImpl) {
|
|
3520
3331
|
return true;
|
|
@@ -3650,7 +3461,7 @@ function qwikDebugToString(value) {
|
|
|
3650
3461
|
}
|
|
3651
3462
|
} else if (isStore(value)) {
|
|
3652
3463
|
return "Store";
|
|
3653
|
-
} else if (
|
|
3464
|
+
} else if (isJSXNode(value)) {
|
|
3654
3465
|
return jsxToString(value);
|
|
3655
3466
|
}
|
|
3656
3467
|
} finally {
|
|
@@ -3663,7 +3474,7 @@ var pad = (text, prefix) => {
|
|
|
3663
3474
|
return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
|
|
3664
3475
|
};
|
|
3665
3476
|
var jsxToString = (value) => {
|
|
3666
|
-
if (
|
|
3477
|
+
if (isJSXNode(value)) {
|
|
3667
3478
|
let type = value.type;
|
|
3668
3479
|
if (typeof type === "function") {
|
|
3669
3480
|
type = type.name || "Component";
|
|
@@ -3852,7 +3663,7 @@ var VNodeDataChar = {
|
|
|
3852
3663
|
/* ************** */
|
|
3853
3664
|
123
|
|
3854
3665
|
),
|
|
3855
|
-
// `{` is the start of the VNodeData.
|
|
3666
|
+
// `{` is the start of the VNodeData for a virtual element.
|
|
3856
3667
|
OPEN_CHAR: (
|
|
3857
3668
|
/* ****** */
|
|
3858
3669
|
"{"
|
|
@@ -3861,7 +3672,7 @@ var VNodeDataChar = {
|
|
|
3861
3672
|
/* ************* */
|
|
3862
3673
|
125
|
|
3863
3674
|
),
|
|
3864
|
-
// `}` is the end of the VNodeData.
|
|
3675
|
+
// `}` is the end of the VNodeData for a virtual element.
|
|
3865
3676
|
CLOSE_CHAR: (
|
|
3866
3677
|
/* ***** */
|
|
3867
3678
|
"}"
|
|
@@ -3931,7 +3742,7 @@ var VNodeDataChar = {
|
|
|
3931
3742
|
),
|
|
3932
3743
|
DON_T_USE: (
|
|
3933
3744
|
/* ********** */
|
|
3934
|
-
|
|
3745
|
+
92
|
|
3935
3746
|
),
|
|
3936
3747
|
// `\` - SKIP because `\` is used as escaping
|
|
3937
3748
|
DON_T_USE_CHAR: "\\",
|
|
@@ -3953,6 +3764,15 @@ var VNodeDataChar = {
|
|
|
3953
3764
|
/* **** */
|
|
3954
3765
|
"^"
|
|
3955
3766
|
),
|
|
3767
|
+
SUBS: (
|
|
3768
|
+
/* *************** */
|
|
3769
|
+
96
|
|
3770
|
+
),
|
|
3771
|
+
// '`' - `q:subs' - Effect dependencies/subscriptions
|
|
3772
|
+
SUBS_CHAR: (
|
|
3773
|
+
/* ******* */
|
|
3774
|
+
"`"
|
|
3775
|
+
),
|
|
3956
3776
|
SEPARATOR: (
|
|
3957
3777
|
/* ********* */
|
|
3958
3778
|
124
|
|
@@ -4672,9 +4492,32 @@ var vnode_materialize = (vNode) => {
|
|
|
4672
4492
|
const element = vNode[6 /* element */];
|
|
4673
4493
|
const firstChild = fastFirstChild(element);
|
|
4674
4494
|
const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
|
|
4675
|
-
const vFirstChild =
|
|
4495
|
+
const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
|
|
4676
4496
|
return vFirstChild;
|
|
4677
4497
|
};
|
|
4498
|
+
var materialize = (vNode, element, firstChild, vNodeData) => {
|
|
4499
|
+
if (vNodeData) {
|
|
4500
|
+
if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
|
|
4501
|
+
const elementVNodeDataStartIdx = 1;
|
|
4502
|
+
let elementVNodeDataEndIdx = 1;
|
|
4503
|
+
while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
|
|
4504
|
+
elementVNodeDataEndIdx++;
|
|
4505
|
+
}
|
|
4506
|
+
const elementVNodeData = vNodeData.substring(
|
|
4507
|
+
elementVNodeDataStartIdx,
|
|
4508
|
+
elementVNodeDataEndIdx
|
|
4509
|
+
);
|
|
4510
|
+
vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
|
|
4511
|
+
const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
|
|
4512
|
+
if (!vNodeData) {
|
|
4513
|
+
return vFirstChild;
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
|
|
4517
|
+
} else {
|
|
4518
|
+
return materializeFromDOM(vNode, firstChild);
|
|
4519
|
+
}
|
|
4520
|
+
};
|
|
4678
4521
|
var ensureMaterialized = (vnode) => {
|
|
4679
4522
|
const vParent = ensureElementVNode(vnode);
|
|
4680
4523
|
let vFirstChild = vParent[4 /* firstChild */];
|
|
@@ -4796,7 +4639,7 @@ var fastGetter = (prototype, name) => {
|
|
|
4796
4639
|
var isQStyleElement = (node) => {
|
|
4797
4640
|
return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
|
|
4798
4641
|
};
|
|
4799
|
-
var materializeFromDOM = (vParent, firstChild) => {
|
|
4642
|
+
var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
4800
4643
|
let vFirstChild = null;
|
|
4801
4644
|
const skipStyleElements = () => {
|
|
4802
4645
|
while (isQStyleElement(child)) {
|
|
@@ -4830,8 +4673,54 @@ var materializeFromDOM = (vParent, firstChild) => {
|
|
|
4830
4673
|
}
|
|
4831
4674
|
vParent[5 /* lastChild */] = vChild || null;
|
|
4832
4675
|
vParent[4 /* firstChild */] = vFirstChild;
|
|
4676
|
+
if (vData) {
|
|
4677
|
+
let container = null;
|
|
4678
|
+
processVNodeData(vData, (peek, consumeValue) => {
|
|
4679
|
+
if (peek() === VNodeDataChar.ID) {
|
|
4680
|
+
if (!container) {
|
|
4681
|
+
container = getDomContainer(vParent[6 /* element */]);
|
|
4682
|
+
}
|
|
4683
|
+
const id = consumeValue();
|
|
4684
|
+
container.$setRawState$(parseInt(id), vParent);
|
|
4685
|
+
isDev6 && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
4686
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
4687
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
4688
|
+
} else {
|
|
4689
|
+
consumeValue();
|
|
4690
|
+
}
|
|
4691
|
+
});
|
|
4692
|
+
}
|
|
4833
4693
|
return vFirstChild;
|
|
4834
4694
|
};
|
|
4695
|
+
var processVNodeData = (vData, callback) => {
|
|
4696
|
+
let nextToConsumeIdx = 0;
|
|
4697
|
+
let ch = 0;
|
|
4698
|
+
let peekCh = 0;
|
|
4699
|
+
const peek = () => {
|
|
4700
|
+
if (peekCh !== 0) {
|
|
4701
|
+
return peekCh;
|
|
4702
|
+
} else {
|
|
4703
|
+
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
4704
|
+
}
|
|
4705
|
+
};
|
|
4706
|
+
const consume = () => {
|
|
4707
|
+
ch = peek();
|
|
4708
|
+
peekCh = 0;
|
|
4709
|
+
nextToConsumeIdx++;
|
|
4710
|
+
return ch;
|
|
4711
|
+
};
|
|
4712
|
+
const consumeValue = () => {
|
|
4713
|
+
consume();
|
|
4714
|
+
const start = nextToConsumeIdx;
|
|
4715
|
+
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
4716
|
+
consume();
|
|
4717
|
+
}
|
|
4718
|
+
return vData.substring(start, nextToConsumeIdx);
|
|
4719
|
+
};
|
|
4720
|
+
while (peek() !== 0) {
|
|
4721
|
+
callback(peek, consumeValue, consume, nextToConsumeIdx);
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4835
4724
|
var vnode_getNextSibling = (vnode) => {
|
|
4836
4725
|
return vnode[3 /* nextSibling */];
|
|
4837
4726
|
};
|
|
@@ -4916,7 +4805,7 @@ var vnode_getPropStartIndex = (vnode) => {
|
|
|
4916
4805
|
} else if (type === 2 /* Virtual */) {
|
|
4917
4806
|
return 6 /* PROPS_OFFSET */;
|
|
4918
4807
|
}
|
|
4919
|
-
throw
|
|
4808
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
4920
4809
|
};
|
|
4921
4810
|
var vnode_getParent = (vnode) => {
|
|
4922
4811
|
return vnode[1 /* parent */] || null;
|
|
@@ -4931,7 +4820,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4931
4820
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4932
4821
|
return vnode[4 /* node */];
|
|
4933
4822
|
};
|
|
4934
|
-
function vnode_toString(depth = 10, offset = "",
|
|
4823
|
+
function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
|
|
4935
4824
|
let vnode = this;
|
|
4936
4825
|
if (depth === 0) {
|
|
4937
4826
|
return "...";
|
|
@@ -4983,7 +4872,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
|
|
|
4983
4872
|
}
|
|
4984
4873
|
}
|
|
4985
4874
|
strings.push("<" + tag + attrs.join("") + ">");
|
|
4986
|
-
if (vnode_isMaterialized(vnode) ||
|
|
4875
|
+
if (vnode_isMaterialized(vnode) || materialize2) {
|
|
4987
4876
|
const child = vnode_getFirstChild(vnode);
|
|
4988
4877
|
child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
|
|
4989
4878
|
} else {
|
|
@@ -5006,25 +4895,9 @@ var isLowercase = (ch) => (
|
|
|
5006
4895
|
var stack = [];
|
|
5007
4896
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
5008
4897
|
let idx = 0;
|
|
5009
|
-
let nextToConsumeIdx = 0;
|
|
5010
4898
|
let vFirst = null;
|
|
5011
4899
|
let vLast = null;
|
|
5012
4900
|
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
4901
|
const addVNode = (node) => {
|
|
5029
4902
|
node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
|
|
5030
4903
|
idx++;
|
|
@@ -5036,25 +4909,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5036
4909
|
}
|
|
5037
4910
|
vLast = node;
|
|
5038
4911
|
};
|
|
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
4912
|
let textIdx = 0;
|
|
5048
4913
|
let combinedText = null;
|
|
5049
4914
|
let container = null;
|
|
5050
|
-
|
|
4915
|
+
processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
|
|
5051
4916
|
if (isNumber(peek())) {
|
|
5052
4917
|
while (!isElement(child)) {
|
|
5053
4918
|
child = fastNextSibling(child);
|
|
5054
4919
|
if (!child) {
|
|
5055
|
-
|
|
5056
|
-
"Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
|
|
5057
|
-
);
|
|
4920
|
+
throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
|
|
5058
4921
|
}
|
|
5059
4922
|
}
|
|
5060
4923
|
while (isQStyleElement(child)) {
|
|
@@ -5081,7 +4944,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5081
4944
|
}
|
|
5082
4945
|
const id = consumeValue();
|
|
5083
4946
|
container.$setRawState$(parseInt(id), vParent);
|
|
5084
|
-
|
|
4947
|
+
isDev6 && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
5085
4948
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
5086
4949
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
5087
4950
|
} else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
@@ -5092,6 +4955,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5092
4955
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
5093
4956
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
5094
4957
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
4958
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
4959
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
5095
4960
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
5096
4961
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
5097
4962
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -5134,7 +4999,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5134
4999
|
);
|
|
5135
5000
|
textIdx += length;
|
|
5136
5001
|
}
|
|
5137
|
-
}
|
|
5002
|
+
});
|
|
5138
5003
|
vParent[5 /* lastChild */] = vLast;
|
|
5139
5004
|
return vFirst;
|
|
5140
5005
|
}
|
|
@@ -5147,7 +5012,7 @@ var vnode_getType = (vnode) => {
|
|
|
5147
5012
|
} else if (type & 4 /* Text */) {
|
|
5148
5013
|
return 3;
|
|
5149
5014
|
}
|
|
5150
|
-
throw
|
|
5015
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
5151
5016
|
};
|
|
5152
5017
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5153
5018
|
1;
|
|
@@ -5228,7 +5093,7 @@ var VNodeArray = class VNode extends Array {
|
|
|
5228
5093
|
constructor(flags, parent, previousSibling, nextSibling) {
|
|
5229
5094
|
super();
|
|
5230
5095
|
this.push(flags, parent, previousSibling, nextSibling);
|
|
5231
|
-
if (
|
|
5096
|
+
if (isDev6) {
|
|
5232
5097
|
this.toString = vnode_toString;
|
|
5233
5098
|
}
|
|
5234
5099
|
}
|
|
@@ -5309,6 +5174,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
|
|
|
5309
5174
|
trackInvocation.$container$ = previousContainer;
|
|
5310
5175
|
}
|
|
5311
5176
|
};
|
|
5177
|
+
var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
5178
|
+
if (value instanceof WrappedSignal && value.$hostElement$ !== host && host) {
|
|
5179
|
+
value.$hostElement$ = host;
|
|
5180
|
+
}
|
|
5181
|
+
return trackSignal(() => value.value, host, property, container, data);
|
|
5182
|
+
};
|
|
5312
5183
|
|
|
5313
5184
|
// packages/qwik/src/core/use/use-context.ts
|
|
5314
5185
|
var createContextId = (name) => {
|
|
@@ -5330,7 +5201,7 @@ var isRecoverable = (err) => {
|
|
|
5330
5201
|
};
|
|
5331
5202
|
|
|
5332
5203
|
// packages/qwik/src/core/client/process-vnode-data.ts
|
|
5333
|
-
function
|
|
5204
|
+
function processVNodeData2(document2) {
|
|
5334
5205
|
const Q_CONTAINER = "q:container";
|
|
5335
5206
|
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
5336
5207
|
const Q_PROPS_SEPARATOR2 = ":";
|
|
@@ -5582,7 +5453,7 @@ function processVNodeData(document2) {
|
|
|
5582
5453
|
function getDomContainer(element) {
|
|
5583
5454
|
const qContainerElement = _getQContainerElement(element);
|
|
5584
5455
|
if (!qContainerElement) {
|
|
5585
|
-
|
|
5456
|
+
throw qError(41 /* containerNotFound */);
|
|
5586
5457
|
}
|
|
5587
5458
|
return getDomContainerFromQContainerElement(qContainerElement);
|
|
5588
5459
|
}
|
|
@@ -5653,7 +5524,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5653
5524
|
});
|
|
5654
5525
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
5655
5526
|
if (!this.qContainer) {
|
|
5656
|
-
|
|
5527
|
+
throw qError(42 /* elementWithoutContainer */);
|
|
5657
5528
|
}
|
|
5658
5529
|
this.$journal$ = [
|
|
5659
5530
|
// The first time we render we need to hoist the styles.
|
|
@@ -5674,7 +5545,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5674
5545
|
this.stateData = null;
|
|
5675
5546
|
const document2 = this.element.ownerDocument;
|
|
5676
5547
|
if (!document2.qVNodeData) {
|
|
5677
|
-
|
|
5548
|
+
processVNodeData2(document2);
|
|
5678
5549
|
}
|
|
5679
5550
|
this.$rawStateData$ = [];
|
|
5680
5551
|
this.stateData = [];
|
|
@@ -5684,7 +5555,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5684
5555
|
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
5685
5556
|
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
5686
5557
|
}
|
|
5687
|
-
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) ||
|
|
5558
|
+
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
5688
5559
|
}
|
|
5689
5560
|
$setRawState$(id, vParent) {
|
|
5690
5561
|
this.stateData[id] = vParent;
|
|
@@ -5788,12 +5659,12 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5788
5659
|
}
|
|
5789
5660
|
processChores() {
|
|
5790
5661
|
let renderCount = this.$renderCount$;
|
|
5791
|
-
const result = this.$scheduler$(
|
|
5662
|
+
const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5792
5663
|
if (isPromise(result)) {
|
|
5793
5664
|
return result.then(async () => {
|
|
5794
5665
|
while (renderCount !== this.$renderCount$) {
|
|
5795
5666
|
renderCount = this.$renderCount$;
|
|
5796
|
-
await this.$scheduler$(
|
|
5667
|
+
await this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5797
5668
|
}
|
|
5798
5669
|
this.renderDone = null;
|
|
5799
5670
|
});
|
|
@@ -6028,7 +5899,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6028
5899
|
signal.$args$ = d[1];
|
|
6029
5900
|
signal.$effectDependencies$ = d[2];
|
|
6030
5901
|
signal.$untrackedValue$ = d[3];
|
|
6031
|
-
signal.$
|
|
5902
|
+
signal.$hostElement$ = d[4];
|
|
5903
|
+
signal.$effects$ = d.slice(5);
|
|
6032
5904
|
break;
|
|
6033
5905
|
}
|
|
6034
5906
|
case 24 /* ComputedSignal */: {
|
|
@@ -6124,11 +5996,12 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6124
5996
|
break;
|
|
6125
5997
|
case 30 /* EffectData */: {
|
|
6126
5998
|
const effectData = target;
|
|
6127
|
-
effectData.data = data[0];
|
|
5999
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
6000
|
+
effectData.data.$isConst$ = data[1];
|
|
6128
6001
|
break;
|
|
6129
6002
|
}
|
|
6130
6003
|
default:
|
|
6131
|
-
|
|
6004
|
+
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6132
6005
|
}
|
|
6133
6006
|
};
|
|
6134
6007
|
var _constants = [
|
|
@@ -6137,7 +6010,7 @@ var _constants = [
|
|
|
6137
6010
|
true,
|
|
6138
6011
|
false,
|
|
6139
6012
|
"",
|
|
6140
|
-
|
|
6013
|
+
EMPTY_ARRAY,
|
|
6141
6014
|
EMPTY_OBJ,
|
|
6142
6015
|
NEEDS_COMPUTATION,
|
|
6143
6016
|
Slot,
|
|
@@ -6241,12 +6114,12 @@ var allocate = (container, typeId, value) => {
|
|
|
6241
6114
|
if (vnode_isVNode(vNode)) {
|
|
6242
6115
|
return vnode_getNode(vNode);
|
|
6243
6116
|
} else {
|
|
6244
|
-
|
|
6117
|
+
throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
6245
6118
|
}
|
|
6246
6119
|
case 30 /* EffectData */:
|
|
6247
|
-
return new
|
|
6120
|
+
return new EffectPropData({});
|
|
6248
6121
|
default:
|
|
6249
|
-
|
|
6122
|
+
throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
|
|
6250
6123
|
}
|
|
6251
6124
|
};
|
|
6252
6125
|
function retrieveVNodeOrDocument(container, value) {
|
|
@@ -6319,7 +6192,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6319
6192
|
$getRootId$: (obj) => {
|
|
6320
6193
|
const id = map.get(obj);
|
|
6321
6194
|
if (!id || id === -1) {
|
|
6322
|
-
|
|
6195
|
+
throw qError(36 /* serializeErrorMissingRootId */, [obj]);
|
|
6323
6196
|
}
|
|
6324
6197
|
return id;
|
|
6325
6198
|
},
|
|
@@ -6408,16 +6281,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6408
6281
|
if (obj.$args$) {
|
|
6409
6282
|
discoveredValues.push(...obj.$args$);
|
|
6410
6283
|
}
|
|
6284
|
+
if (obj.$hostElement$) {
|
|
6285
|
+
discoveredValues.push(obj.$hostElement$);
|
|
6286
|
+
}
|
|
6411
6287
|
} else if (obj instanceof ComputedSignal) {
|
|
6412
6288
|
discoveredValues.push(obj.$computeQrl$);
|
|
6413
6289
|
}
|
|
6414
6290
|
} else if (obj instanceof Task) {
|
|
6415
6291
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6416
6292
|
} else if (isSsrNode(obj)) {
|
|
6417
|
-
|
|
6293
|
+
discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
|
|
6294
|
+
if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
6295
|
+
for (const data of obj.childrenVNodeData) {
|
|
6296
|
+
discoverValuesForVNodeData(data, discoveredValues);
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6418
6299
|
} else if (isDomRef(obj)) {
|
|
6419
6300
|
discoveredValues.push(obj.$ssrNode$.id);
|
|
6420
|
-
} else if (
|
|
6301
|
+
} else if (isJSXNode(obj)) {
|
|
6421
6302
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6422
6303
|
} else if (Array.isArray(obj)) {
|
|
6423
6304
|
discoveredValues.push(...obj);
|
|
@@ -6437,14 +6318,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6437
6318
|
}
|
|
6438
6319
|
);
|
|
6439
6320
|
promises.push(obj);
|
|
6440
|
-
} else if (obj instanceof
|
|
6321
|
+
} else if (obj instanceof EffectPropData) {
|
|
6441
6322
|
discoveredValues.push(obj.data);
|
|
6442
6323
|
} else if (isObjectLiteral(obj)) {
|
|
6443
6324
|
Object.entries(obj).forEach(([key, value]) => {
|
|
6444
6325
|
discoveredValues.push(key, value);
|
|
6445
6326
|
});
|
|
6446
6327
|
} else {
|
|
6447
|
-
|
|
6328
|
+
throw qError(37 /* serializeErrorUnknownType */, [obj]);
|
|
6448
6329
|
}
|
|
6449
6330
|
};
|
|
6450
6331
|
for (const root of roots) {
|
|
@@ -6464,9 +6345,23 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6464
6345
|
$addRoot$(obj);
|
|
6465
6346
|
}
|
|
6466
6347
|
}
|
|
6467
|
-
await Promise.allSettled(promises);
|
|
6468
|
-
promises.length = 0;
|
|
6469
|
-
} while (discoveredValues.length);
|
|
6348
|
+
await Promise.allSettled(promises);
|
|
6349
|
+
promises.length = 0;
|
|
6350
|
+
} while (discoveredValues.length);
|
|
6351
|
+
}
|
|
6352
|
+
};
|
|
6353
|
+
var isSsrAttrs = (value) => Array.isArray(value) && value.length > 0;
|
|
6354
|
+
var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
|
|
6355
|
+
for (const value of vnodeData) {
|
|
6356
|
+
if (isSsrAttrs(value)) {
|
|
6357
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
6358
|
+
if (value[i - 1] === ELEMENT_KEY) {
|
|
6359
|
+
continue;
|
|
6360
|
+
}
|
|
6361
|
+
const attrValue = value[i];
|
|
6362
|
+
discoveredValues.push(attrValue);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6470
6365
|
}
|
|
6471
6366
|
};
|
|
6472
6367
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
@@ -6550,7 +6445,7 @@ function serialize(serializationContext) {
|
|
|
6550
6445
|
output(2 /* Number */, value);
|
|
6551
6446
|
}
|
|
6552
6447
|
} else if (typeof value === "object") {
|
|
6553
|
-
if (value ===
|
|
6448
|
+
if (value === EMPTY_ARRAY) {
|
|
6554
6449
|
output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
6555
6450
|
} else if (value === EMPTY_OBJ) {
|
|
6556
6451
|
output(1 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
@@ -6579,7 +6474,7 @@ function serialize(serializationContext) {
|
|
|
6579
6474
|
} else if (value === NEEDS_COMPUTATION) {
|
|
6580
6475
|
output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
6581
6476
|
} else {
|
|
6582
|
-
|
|
6477
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6583
6478
|
}
|
|
6584
6479
|
};
|
|
6585
6480
|
const writeObjectValue = (value, idx) => {
|
|
@@ -6596,14 +6491,14 @@ function serialize(serializationContext) {
|
|
|
6596
6491
|
const constProps = value[_CONST_PROPS];
|
|
6597
6492
|
const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
|
|
6598
6493
|
output(29 /* PropsProxy */, out);
|
|
6599
|
-
} else if (value instanceof
|
|
6600
|
-
output(30 /* EffectData */, [value.data]);
|
|
6494
|
+
} else if (value instanceof EffectPropData) {
|
|
6495
|
+
output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
|
|
6601
6496
|
} else if (isStore(value)) {
|
|
6602
6497
|
if (isResource(value)) {
|
|
6603
6498
|
serializationContext.$resources$.add(value);
|
|
6604
6499
|
const res = promiseResults.get(value.value);
|
|
6605
6500
|
if (!res) {
|
|
6606
|
-
|
|
6501
|
+
throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
|
|
6607
6502
|
}
|
|
6608
6503
|
output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
|
|
6609
6504
|
} else {
|
|
@@ -6640,7 +6535,7 @@ function serialize(serializationContext) {
|
|
|
6640
6535
|
output(13 /* Object */, out);
|
|
6641
6536
|
}
|
|
6642
6537
|
} else if ($isDomRef$(value)) {
|
|
6643
|
-
value.$ssrNode$.vnodeData[0] |=
|
|
6538
|
+
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
6644
6539
|
output(9 /* RefVNode */, value.$ssrNode$.id);
|
|
6645
6540
|
} else if (value instanceof Signal) {
|
|
6646
6541
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
@@ -6649,6 +6544,7 @@ function serialize(serializationContext) {
|
|
|
6649
6544
|
...serializeWrappingFn(serializationContext, value),
|
|
6650
6545
|
value.$effectDependencies$,
|
|
6651
6546
|
v,
|
|
6547
|
+
value.$hostElement$,
|
|
6652
6548
|
...value.$effects$ || []
|
|
6653
6549
|
]);
|
|
6654
6550
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -6687,11 +6583,11 @@ function serialize(serializationContext) {
|
|
|
6687
6583
|
const vNodeData = value.vnodeData;
|
|
6688
6584
|
if (vNodeData) {
|
|
6689
6585
|
serializationContext.$prepVNodeData$?.(vNodeData);
|
|
6690
|
-
vNodeData[0] |=
|
|
6586
|
+
vNodeData[0] |= 16 /* SERIALIZE */;
|
|
6691
6587
|
}
|
|
6692
6588
|
if (value.childrenVNodeData) {
|
|
6693
6589
|
for (const vNodeData2 of value.childrenVNodeData) {
|
|
6694
|
-
vNodeData2[0] |=
|
|
6590
|
+
vNodeData2[0] |= 16 /* SERIALIZE */;
|
|
6695
6591
|
}
|
|
6696
6592
|
}
|
|
6697
6593
|
} else {
|
|
@@ -6718,7 +6614,7 @@ function serialize(serializationContext) {
|
|
|
6718
6614
|
combined.push(k, v);
|
|
6719
6615
|
}
|
|
6720
6616
|
output(16 /* Map */, combined);
|
|
6721
|
-
} else if (
|
|
6617
|
+
} else if (isJSXNode(value)) {
|
|
6722
6618
|
output(28 /* JSXNode */, [
|
|
6723
6619
|
value.type,
|
|
6724
6620
|
value.varProps,
|
|
@@ -6743,7 +6639,7 @@ function serialize(serializationContext) {
|
|
|
6743
6639
|
} else if (isPromise(value)) {
|
|
6744
6640
|
const res = promiseResults.get(value);
|
|
6745
6641
|
if (!res) {
|
|
6746
|
-
|
|
6642
|
+
throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
|
|
6747
6643
|
}
|
|
6748
6644
|
output(14 /* Promise */, res);
|
|
6749
6645
|
} else if (value instanceof Uint8Array) {
|
|
@@ -6754,7 +6650,7 @@ function serialize(serializationContext) {
|
|
|
6754
6650
|
const out = btoa(buf).replace(/=+$/, "");
|
|
6755
6651
|
output(17 /* Uint8Array */, out);
|
|
6756
6652
|
} else {
|
|
6757
|
-
|
|
6653
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6758
6654
|
}
|
|
6759
6655
|
};
|
|
6760
6656
|
writeValue(serializationContext.$roots$, -1);
|
|
@@ -6800,7 +6696,7 @@ function qrlToString(serializationContext, value) {
|
|
|
6800
6696
|
}
|
|
6801
6697
|
}
|
|
6802
6698
|
if (!chunk) {
|
|
6803
|
-
|
|
6699
|
+
throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
|
|
6804
6700
|
}
|
|
6805
6701
|
if (chunk.startsWith("./")) {
|
|
6806
6702
|
chunk = chunk.slice(2);
|
|
@@ -6855,7 +6751,7 @@ function isResource(value) {
|
|
|
6855
6751
|
return "__brand" in value && value.__brand === "resource";
|
|
6856
6752
|
}
|
|
6857
6753
|
var frameworkType = (obj) => {
|
|
6858
|
-
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task ||
|
|
6754
|
+
return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
|
|
6859
6755
|
};
|
|
6860
6756
|
var canSerialize = (value) => {
|
|
6861
6757
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
@@ -6885,7 +6781,7 @@ var canSerialize = (value) => {
|
|
|
6885
6781
|
return true;
|
|
6886
6782
|
} else if (isPromise(value)) {
|
|
6887
6783
|
return true;
|
|
6888
|
-
} else if (
|
|
6784
|
+
} else if (isJSXNode(value)) {
|
|
6889
6785
|
return true;
|
|
6890
6786
|
} else if (value instanceof Error) {
|
|
6891
6787
|
return true;
|
|
@@ -6951,7 +6847,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
6951
6847
|
let expectIndex = 0;
|
|
6952
6848
|
unwrapped.forEach((v, i) => {
|
|
6953
6849
|
if (i !== expectIndex) {
|
|
6954
|
-
throw qError(
|
|
6850
|
+
throw qError(3 /* verifySerializable */, [unwrapped]);
|
|
6955
6851
|
}
|
|
6956
6852
|
_verifySerializable(v, seen, ctx + "[" + i + "]");
|
|
6957
6853
|
expectIndex = i + 1;
|
|
@@ -6991,8 +6887,7 @@ const ${fnName} = $(${String(
|
|
|
6991
6887
|
|
|
6992
6888
|
Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
|
|
6993
6889
|
}
|
|
6994
|
-
|
|
6995
|
-
throwErrorAndStop(message);
|
|
6890
|
+
throw qError(3 /* verifySerializable */, [message]);
|
|
6996
6891
|
}
|
|
6997
6892
|
return value;
|
|
6998
6893
|
};
|
|
@@ -7044,7 +6939,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7044
6939
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
7045
6940
|
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
7046
6941
|
if (!isFunction(fn)) {
|
|
7047
|
-
throw qError(
|
|
6942
|
+
throw qError(10 /* qrlIsNotFunction */);
|
|
7048
6943
|
}
|
|
7049
6944
|
if (beforeFn && beforeFn() === false) {
|
|
7050
6945
|
return;
|
|
@@ -7145,7 +7040,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7145
7040
|
if (symbolRef) {
|
|
7146
7041
|
symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
|
|
7147
7042
|
}
|
|
7148
|
-
if (
|
|
7043
|
+
if (isDev7) {
|
|
7149
7044
|
Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
7150
7045
|
get() {
|
|
7151
7046
|
return symbolRef;
|
|
@@ -7236,7 +7131,7 @@ var stringifyStyle = (obj) => {
|
|
|
7236
7131
|
}
|
|
7237
7132
|
if (typeof obj == "object") {
|
|
7238
7133
|
if (isArray(obj)) {
|
|
7239
|
-
throw qError(
|
|
7134
|
+
throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
|
|
7240
7135
|
} else {
|
|
7241
7136
|
const chunks = [];
|
|
7242
7137
|
for (const key in obj) {
|
|
@@ -7300,12 +7195,12 @@ function getValidManifest(manifest) {
|
|
|
7300
7195
|
|
|
7301
7196
|
// packages/qwik/src/server/ssr-container.ts
|
|
7302
7197
|
import {
|
|
7198
|
+
_EffectData as EffectData,
|
|
7303
7199
|
_SharedContainer as _SharedContainer2,
|
|
7304
7200
|
_jsxSorted as _jsxSorted3,
|
|
7305
7201
|
_jsxSplit as _jsxSplit2,
|
|
7306
7202
|
_walkJSX as _walkJSX2,
|
|
7307
|
-
isSignal as isSignal2
|
|
7308
|
-
_EffectData as EffectData2
|
|
7203
|
+
isSignal as isSignal2
|
|
7309
7204
|
} from "@qwik.dev/core";
|
|
7310
7205
|
import { isDev as isDev9 } from "@qwik.dev/core/build";
|
|
7311
7206
|
|
|
@@ -7482,6 +7377,165 @@ var PrefetchImplementationDefault = {
|
|
|
7482
7377
|
prefetchEvent: "always"
|
|
7483
7378
|
};
|
|
7484
7379
|
|
|
7380
|
+
// packages/qwik/src/server/ssr-node.ts
|
|
7381
|
+
import { _isJSXNode as isJSXNode2, _EMPTY_ARRAY } from "@qwik.dev/core";
|
|
7382
|
+
import { isDev as isDev8 } from "@qwik.dev/core/build";
|
|
7383
|
+
var SsrNode = class {
|
|
7384
|
+
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
|
|
7385
|
+
this.attrs = attrs;
|
|
7386
|
+
this.cleanupQueue = cleanupQueue;
|
|
7387
|
+
this.vnodeData = vnodeData;
|
|
7388
|
+
__publicField(this, "__brand__");
|
|
7389
|
+
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
|
|
7390
|
+
__publicField(this, "nodeType");
|
|
7391
|
+
/**
|
|
7392
|
+
* ID which the deserialize will use to retrieve the node.
|
|
7393
|
+
*
|
|
7394
|
+
* @param refId - Unique id for the node.
|
|
7395
|
+
*/
|
|
7396
|
+
__publicField(this, "id");
|
|
7397
|
+
/** Local props which don't serialize; */
|
|
7398
|
+
__publicField(this, "locals", null);
|
|
7399
|
+
__publicField(this, "currentComponentNode");
|
|
7400
|
+
__publicField(this, "childrenVNodeData", null);
|
|
7401
|
+
this.currentComponentNode = currentComponentNode;
|
|
7402
|
+
this.currentComponentNode?.addChildVNodeData(this.vnodeData);
|
|
7403
|
+
this.nodeType = nodeType;
|
|
7404
|
+
this.id = id;
|
|
7405
|
+
if (isDev8 && id.indexOf("undefined") != -1) {
|
|
7406
|
+
throw new Error(`Invalid SSR node id: ${id}`);
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
setProp(name, value) {
|
|
7410
|
+
if (this.attrs === _EMPTY_ARRAY) {
|
|
7411
|
+
this.attrs = [];
|
|
7412
|
+
}
|
|
7413
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7414
|
+
mapArray_set(this.locals || (this.locals = []), name, value, 0);
|
|
7415
|
+
} else {
|
|
7416
|
+
mapArray_set(this.attrs, name, value, 0);
|
|
7417
|
+
}
|
|
7418
|
+
if (name == ELEMENT_SEQ && value) {
|
|
7419
|
+
this.cleanupQueue.push(value);
|
|
7420
|
+
}
|
|
7421
|
+
}
|
|
7422
|
+
getProp(name) {
|
|
7423
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7424
|
+
return this.locals ? mapArray_get(this.locals, name, 0) : null;
|
|
7425
|
+
} else {
|
|
7426
|
+
return mapArray_get(this.attrs, name, 0);
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
removeProp(name) {
|
|
7430
|
+
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
7431
|
+
if (this.locals) {
|
|
7432
|
+
mapApp_remove(this.locals, name, 0);
|
|
7433
|
+
}
|
|
7434
|
+
} else {
|
|
7435
|
+
mapApp_remove(this.attrs, name, 0);
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
addChildVNodeData(child) {
|
|
7439
|
+
if (!this.childrenVNodeData) {
|
|
7440
|
+
this.childrenVNodeData = [];
|
|
7441
|
+
}
|
|
7442
|
+
this.childrenVNodeData.push(child);
|
|
7443
|
+
}
|
|
7444
|
+
toString() {
|
|
7445
|
+
let stringifiedAttrs = "";
|
|
7446
|
+
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
7447
|
+
const key = this.attrs[i];
|
|
7448
|
+
const value = this.attrs[i + 1];
|
|
7449
|
+
stringifiedAttrs += `${key}=`;
|
|
7450
|
+
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
7451
|
+
if (i < this.attrs.length - 2) {
|
|
7452
|
+
stringifiedAttrs += ", ";
|
|
7453
|
+
}
|
|
7454
|
+
}
|
|
7455
|
+
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
7456
|
+
}
|
|
7457
|
+
};
|
|
7458
|
+
__publicField(SsrNode, "ELEMENT_NODE", 1);
|
|
7459
|
+
__publicField(SsrNode, "TEXT_NODE", 3);
|
|
7460
|
+
__publicField(SsrNode, "DOCUMENT_NODE", 9);
|
|
7461
|
+
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
|
|
7462
|
+
var DomRef = class {
|
|
7463
|
+
constructor($ssrNode$) {
|
|
7464
|
+
this.$ssrNode$ = $ssrNode$;
|
|
7465
|
+
}
|
|
7466
|
+
};
|
|
7467
|
+
var SsrComponentFrame = class {
|
|
7468
|
+
constructor(componentNode) {
|
|
7469
|
+
this.componentNode = componentNode;
|
|
7470
|
+
__publicField(this, "slots", []);
|
|
7471
|
+
__publicField(this, "projectionDepth", 0);
|
|
7472
|
+
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
|
|
7473
|
+
__publicField(this, "projectionScopedStyle", null);
|
|
7474
|
+
__publicField(this, "projectionComponentFrame", null);
|
|
7475
|
+
}
|
|
7476
|
+
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
7477
|
+
this.projectionScopedStyle = projectionScopedStyle;
|
|
7478
|
+
this.projectionComponentFrame = projectionComponentFrame;
|
|
7479
|
+
if (isJSXNode2(children)) {
|
|
7480
|
+
const slotName = this.getSlotName(children);
|
|
7481
|
+
mapArray_set(this.slots, slotName, children, 0);
|
|
7482
|
+
} else if (Array.isArray(children)) {
|
|
7483
|
+
const defaultSlot = [];
|
|
7484
|
+
for (let i = 0; i < children.length; i++) {
|
|
7485
|
+
const child = children[i];
|
|
7486
|
+
if (isJSXNode2(child)) {
|
|
7487
|
+
const slotName = this.getSlotName(child);
|
|
7488
|
+
if (slotName === QDefaultSlot) {
|
|
7489
|
+
defaultSlot.push(child);
|
|
7490
|
+
} else {
|
|
7491
|
+
this.updateSlot(slotName, child);
|
|
7492
|
+
}
|
|
7493
|
+
} else {
|
|
7494
|
+
defaultSlot.push(child);
|
|
7495
|
+
}
|
|
7496
|
+
}
|
|
7497
|
+
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7498
|
+
} else {
|
|
7499
|
+
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7500
|
+
}
|
|
7501
|
+
}
|
|
7502
|
+
updateSlot(slotName, child) {
|
|
7503
|
+
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
7504
|
+
if (existingSlots === null) {
|
|
7505
|
+
existingSlots = child;
|
|
7506
|
+
} else if (Array.isArray(existingSlots)) {
|
|
7507
|
+
existingSlots.push(child);
|
|
7508
|
+
} else {
|
|
7509
|
+
existingSlots = [existingSlots, child];
|
|
7510
|
+
}
|
|
7511
|
+
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
7512
|
+
}
|
|
7513
|
+
getSlotName(jsx2) {
|
|
7514
|
+
if (jsx2.props[QSlot]) {
|
|
7515
|
+
return jsx2.props[QSlot];
|
|
7516
|
+
}
|
|
7517
|
+
return QDefaultSlot;
|
|
7518
|
+
}
|
|
7519
|
+
hasSlot(slotName) {
|
|
7520
|
+
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
7521
|
+
}
|
|
7522
|
+
consumeChildrenForSlot(projectionNode, slotName) {
|
|
7523
|
+
const children = mapApp_remove(this.slots, slotName, 0);
|
|
7524
|
+
if (children !== null) {
|
|
7525
|
+
this.componentNode.setProp(slotName, projectionNode.id);
|
|
7526
|
+
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
7527
|
+
}
|
|
7528
|
+
return children;
|
|
7529
|
+
}
|
|
7530
|
+
releaseUnclaimedProjections(unclaimedProjections) {
|
|
7531
|
+
if (this.slots.length) {
|
|
7532
|
+
unclaimedProjections.push(this);
|
|
7533
|
+
unclaimedProjections.push(this.projectionScopedStyle);
|
|
7534
|
+
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
7535
|
+
}
|
|
7536
|
+
}
|
|
7537
|
+
};
|
|
7538
|
+
|
|
7485
7539
|
// packages/qwik/src/server/tag-nesting.ts
|
|
7486
7540
|
var allowedContent = (state) => {
|
|
7487
7541
|
switch (state) {
|
|
@@ -7752,6 +7806,110 @@ function isInPhrasing(text, allowInput) {
|
|
|
7752
7806
|
}
|
|
7753
7807
|
}
|
|
7754
7808
|
|
|
7809
|
+
// packages/qwik/src/server/vnode-data.ts
|
|
7810
|
+
import { _EMPTY_ARRAY as _EMPTY_ARRAY2 } from "@qwik.dev/core";
|
|
7811
|
+
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
7812
|
+
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
7813
|
+
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
|
|
7814
|
+
function vNodeData_incrementElementCount(vNodeData) {
|
|
7815
|
+
const length = vNodeData.length;
|
|
7816
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7817
|
+
if (lastValue >= 0) {
|
|
7818
|
+
vNodeData.push(-1);
|
|
7819
|
+
} else {
|
|
7820
|
+
vNodeData[length - 1] = lastValue - 1;
|
|
7821
|
+
}
|
|
7822
|
+
}
|
|
7823
|
+
function vNodeData_addTextSize(vNodeData, size) {
|
|
7824
|
+
const length = vNodeData.length;
|
|
7825
|
+
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
7826
|
+
if (length > 1 && lastValue >= 0) {
|
|
7827
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7828
|
+
}
|
|
7829
|
+
vNodeData.push(size);
|
|
7830
|
+
if (size == 0) {
|
|
7831
|
+
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
7832
|
+
}
|
|
7833
|
+
}
|
|
7834
|
+
function vNodeData_openFragment(vNodeData, attrs) {
|
|
7835
|
+
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
7836
|
+
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
7837
|
+
}
|
|
7838
|
+
function vNodeData_closeFragment(vNodeData) {
|
|
7839
|
+
vNodeData.push(CLOSE_FRAGMENT);
|
|
7840
|
+
}
|
|
7841
|
+
function vNodeData_openElement(vNodeData) {
|
|
7842
|
+
vNodeData.push([], WRITE_ELEMENT_ATTRS);
|
|
7843
|
+
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
7844
|
+
}
|
|
7845
|
+
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
7846
|
+
vNodeData[0] |= 8 /* REFERENCE */;
|
|
7847
|
+
let fragmentAttrs = _EMPTY_ARRAY2;
|
|
7848
|
+
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
7849
|
+
for (let i = 1; i < vNodeData.length; i++) {
|
|
7850
|
+
const value = vNodeData[i];
|
|
7851
|
+
if (Array.isArray(value)) {
|
|
7852
|
+
fragmentAttrs = value;
|
|
7853
|
+
i++;
|
|
7854
|
+
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
7855
|
+
stack2[stack2.length - 1]++;
|
|
7856
|
+
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
7857
|
+
}
|
|
7858
|
+
} else if (value === CLOSE_FRAGMENT) {
|
|
7859
|
+
stack2.pop();
|
|
7860
|
+
stack2.pop();
|
|
7861
|
+
fragmentAttrs = _EMPTY_ARRAY2;
|
|
7862
|
+
} else if (value < 0) {
|
|
7863
|
+
const numberOfElements = 0 - value;
|
|
7864
|
+
stack2[stack2.length - 1] += numberOfElements;
|
|
7865
|
+
} else {
|
|
7866
|
+
stack2[stack2.length - 1]++;
|
|
7867
|
+
}
|
|
7868
|
+
}
|
|
7869
|
+
let refId = String(depthFirstElementIdx);
|
|
7870
|
+
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
7871
|
+
for (let i = 1; i < stack2.length; i += 2) {
|
|
7872
|
+
const childCount = stack2[i];
|
|
7873
|
+
if (childCount >= 0) {
|
|
7874
|
+
refId += encodeAsAlphanumeric(childCount);
|
|
7875
|
+
}
|
|
7876
|
+
}
|
|
7877
|
+
}
|
|
7878
|
+
const type = stack2[stack2.length - 2];
|
|
7879
|
+
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
7880
|
+
}
|
|
7881
|
+
var ALPHANUMERIC = [];
|
|
7882
|
+
function encodeAsAlphanumeric(value) {
|
|
7883
|
+
while (ALPHANUMERIC.length <= value) {
|
|
7884
|
+
let value2 = ALPHANUMERIC.length;
|
|
7885
|
+
let text = "";
|
|
7886
|
+
do {
|
|
7887
|
+
text = String.fromCharCode(
|
|
7888
|
+
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
7889
|
+
/* A-Z */
|
|
7890
|
+
) + text;
|
|
7891
|
+
value2 = Math.floor(
|
|
7892
|
+
value2 / 26
|
|
7893
|
+
/* A-Z */
|
|
7894
|
+
);
|
|
7895
|
+
} while (value2 !== 0);
|
|
7896
|
+
ALPHANUMERIC.push(text);
|
|
7897
|
+
}
|
|
7898
|
+
return ALPHANUMERIC[value];
|
|
7899
|
+
}
|
|
7900
|
+
|
|
7901
|
+
// packages/qwik/src/server/scripts.ts
|
|
7902
|
+
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)})()';
|
|
7903
|
+
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})()';
|
|
7904
|
+
function getQwikLoaderScript(opts = {}) {
|
|
7905
|
+
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
7906
|
+
}
|
|
7907
|
+
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
7908
|
+
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
7909
|
+
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
7910
|
+
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7755
7913
|
// packages/qwik/src/server/ssr-container.ts
|
|
7756
7914
|
function ssrCreateContainer(opts) {
|
|
7757
7915
|
opts.renderOptions || (opts.renderOptions = {});
|
|
@@ -7951,6 +8109,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
7951
8109
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
7952
8110
|
}
|
|
7953
8111
|
this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
|
|
8112
|
+
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
7954
8113
|
this.write("<");
|
|
7955
8114
|
this.write(elementName);
|
|
7956
8115
|
if (varAttrs) {
|
|
@@ -8036,7 +8195,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8036
8195
|
this.openFragment(attrs);
|
|
8037
8196
|
const vNode = this.currentElementFrame?.vNodeData;
|
|
8038
8197
|
if (vNode) {
|
|
8039
|
-
vNode[0] |=
|
|
8198
|
+
vNode[0] |= 16 /* SERIALIZE */;
|
|
8040
8199
|
}
|
|
8041
8200
|
const componentFrame = this.getComponentFrame();
|
|
8042
8201
|
if (componentFrame) {
|
|
@@ -8199,12 +8358,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8199
8358
|
for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
|
|
8200
8359
|
const vNode = vNodeData[elementIdx];
|
|
8201
8360
|
const flag = vNode[0];
|
|
8202
|
-
if (flag &
|
|
8361
|
+
if (flag & 16 /* SERIALIZE */) {
|
|
8203
8362
|
lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
|
|
8204
|
-
if (flag &
|
|
8363
|
+
if (flag & 8 /* REFERENCE */) {
|
|
8205
8364
|
this.write(VNodeDataSeparator.REFERENCE_CH);
|
|
8206
8365
|
}
|
|
8207
|
-
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
|
|
8366
|
+
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
|
|
8208
8367
|
let fragmentAttrs = null;
|
|
8209
8368
|
let depth = 0;
|
|
8210
8369
|
for (let i = 1; i < vNode.length; i++) {
|
|
@@ -8222,6 +8381,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8222
8381
|
}
|
|
8223
8382
|
depth--;
|
|
8224
8383
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
8384
|
+
} else if (value === WRITE_ELEMENT_ATTRS) {
|
|
8385
|
+
if (fragmentAttrs && fragmentAttrs.length) {
|
|
8386
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8387
|
+
writeFragmentAttrs(this.write.bind(this), this.addRoot.bind(this), fragmentAttrs);
|
|
8388
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
8389
|
+
fragmentAttrs = vNodeAttrsStack.pop();
|
|
8390
|
+
}
|
|
8225
8391
|
} else if (value >= 0) {
|
|
8226
8392
|
this.write(encodeAsAlphanumeric(value));
|
|
8227
8393
|
} else {
|
|
@@ -8274,6 +8440,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8274
8440
|
case ELEMENT_SEQ_IDX:
|
|
8275
8441
|
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
8276
8442
|
break;
|
|
8443
|
+
case QSubscribers:
|
|
8444
|
+
write(VNodeDataChar.SUBS_CHAR);
|
|
8445
|
+
break;
|
|
8277
8446
|
// Skipping `\` character for now because it is used for escaping.
|
|
8278
8447
|
case QCtxAttr:
|
|
8279
8448
|
write(VNodeDataChar.CONTEXT_CHAR);
|
|
@@ -8473,7 +8642,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8473
8642
|
);
|
|
8474
8643
|
const lastNode = this.getLastNode();
|
|
8475
8644
|
if (lastNode.vnodeData) {
|
|
8476
|
-
lastNode.vnodeData[0] |=
|
|
8645
|
+
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
8477
8646
|
}
|
|
8478
8647
|
ssrComponentNode?.setProp(value, lastNode.id);
|
|
8479
8648
|
await _walkJSX2(this, children, {
|
|
@@ -8596,7 +8765,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8596
8765
|
let styleScopedId = null;
|
|
8597
8766
|
if (isSSRUnsafeAttr(key)) {
|
|
8598
8767
|
if (isDev9) {
|
|
8599
|
-
throw
|
|
8768
|
+
throw qError(51 /* unsafeAttr */);
|
|
8600
8769
|
}
|
|
8601
8770
|
continue;
|
|
8602
8771
|
}
|
|
@@ -8613,11 +8782,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8613
8782
|
} else if (typeof value === "function") {
|
|
8614
8783
|
value(new DomRef(lastNode));
|
|
8615
8784
|
continue;
|
|
8785
|
+
} else {
|
|
8786
|
+
throw qError(32 /* invalidRefValue */);
|
|
8616
8787
|
}
|
|
8617
8788
|
}
|
|
8618
8789
|
if (isSignal2(value)) {
|
|
8619
8790
|
const lastNode = this.getLastNode();
|
|
8620
|
-
const signalData = new
|
|
8791
|
+
const signalData = new EffectData({
|
|
8621
8792
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
8622
8793
|
$isConst$: isConst
|
|
8623
8794
|
});
|
|
@@ -8634,7 +8805,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8634
8805
|
if (tag === "textarea" && key === "value") {
|
|
8635
8806
|
if (typeof value !== "string") {
|
|
8636
8807
|
if (isDev9) {
|
|
8637
|
-
throw
|
|
8808
|
+
throw qError(40 /* wrongTextareaValue */);
|
|
8638
8809
|
}
|
|
8639
8810
|
continue;
|
|
8640
8811
|
}
|
|
@@ -8670,7 +8841,7 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
8670
8841
|
return false;
|
|
8671
8842
|
};
|
|
8672
8843
|
function newTagError(text) {
|
|
8673
|
-
return
|
|
8844
|
+
return qError(29 /* tagError */, [text]);
|
|
8674
8845
|
}
|
|
8675
8846
|
function hasDestroy(obj) {
|
|
8676
8847
|
return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
|
|
@@ -8884,18 +9055,6 @@ function resolveManifest(manifest) {
|
|
|
8884
9055
|
}
|
|
8885
9056
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8886
9057
|
|
|
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
9058
|
// packages/qwik/src/server/index.ts
|
|
8900
9059
|
async function setServerPlatform2(manifest) {
|
|
8901
9060
|
const platform = createPlatform({ manifest }, resolveManifest(manifest));
|