@qwik.dev/core 2.0.0-alpha.2 → 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.wasm.cjs +259 -272
- package/bindings/qwik.wasm.mjs +259 -272
- 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 +41 -22
- package/dist/core.cjs +6313 -6125
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +6300 -6124
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +1574 -1407
- package/dist/core.prod.mjs +3043 -2898
- 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 +1946 -1927
- package/dist/optimizer.mjs +2410 -2444
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +745 -578
- package/dist/server.mjs +736 -570
- package/dist/testing/index.cjs +3297 -3119
- package/dist/testing/index.mjs +3267 -3090
- package/dist/testing/package.json +1 -1
- package/package.json +4 -4
- 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,260 +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
|
-
/** @id is the same id as for SsrNode */
|
|
652
|
-
constructor(id) {
|
|
653
|
-
this.id = id;
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
var SsrComponentFrame = class {
|
|
657
|
-
constructor(componentNode) {
|
|
658
|
-
this.componentNode = componentNode;
|
|
659
|
-
__publicField(this, "slots", []);
|
|
660
|
-
__publicField(this, "projectionDepth", 0);
|
|
661
|
-
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
|
|
662
|
-
__publicField(this, "projectionScopedStyle", null);
|
|
663
|
-
__publicField(this, "projectionComponentFrame", null);
|
|
664
|
-
}
|
|
665
|
-
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
666
|
-
this.projectionScopedStyle = projectionScopedStyle;
|
|
667
|
-
this.projectionComponentFrame = projectionComponentFrame;
|
|
668
|
-
if (isJSXNode(children)) {
|
|
669
|
-
const slotName = this.getSlotName(children);
|
|
670
|
-
mapArray_set(this.slots, slotName, children, 0);
|
|
671
|
-
} else if (Array.isArray(children)) {
|
|
672
|
-
const defaultSlot = [];
|
|
673
|
-
for (let i = 0; i < children.length; i++) {
|
|
674
|
-
const child = children[i];
|
|
675
|
-
if (isJSXNode(child)) {
|
|
676
|
-
const slotName = this.getSlotName(child);
|
|
677
|
-
if (slotName === QDefaultSlot) {
|
|
678
|
-
defaultSlot.push(child);
|
|
679
|
-
} else {
|
|
680
|
-
this.updateSlot(slotName, child);
|
|
681
|
-
}
|
|
682
|
-
} else {
|
|
683
|
-
defaultSlot.push(child);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
687
|
-
} else {
|
|
688
|
-
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
updateSlot(slotName, child) {
|
|
692
|
-
let existingSlots = mapArray_get(this.slots, slotName, 0);
|
|
693
|
-
if (existingSlots === null) {
|
|
694
|
-
existingSlots = child;
|
|
695
|
-
} else if (Array.isArray(existingSlots)) {
|
|
696
|
-
existingSlots.push(child);
|
|
697
|
-
} else {
|
|
698
|
-
existingSlots = [existingSlots, child];
|
|
699
|
-
}
|
|
700
|
-
mapArray_set(this.slots, slotName, existingSlots, 0);
|
|
701
|
-
}
|
|
702
|
-
getSlotName(jsx2) {
|
|
703
|
-
if (jsx2.props[QSlot]) {
|
|
704
|
-
return jsx2.props[QSlot];
|
|
705
|
-
}
|
|
706
|
-
return QDefaultSlot;
|
|
707
|
-
}
|
|
708
|
-
hasSlot(slotName) {
|
|
709
|
-
return mapArray_get(this.slots, slotName, 0) !== null;
|
|
710
|
-
}
|
|
711
|
-
consumeChildrenForSlot(projectionNode, slotName) {
|
|
712
|
-
const children = mapApp_remove(this.slots, slotName, 0);
|
|
713
|
-
if (children !== null) {
|
|
714
|
-
this.componentNode.setProp(slotName, projectionNode.id);
|
|
715
|
-
projectionNode.setProp(QSlotParent, this.componentNode.id);
|
|
716
|
-
}
|
|
717
|
-
return children;
|
|
718
|
-
}
|
|
719
|
-
releaseUnclaimedProjections(unclaimedProjections) {
|
|
720
|
-
if (this.slots.length) {
|
|
721
|
-
unclaimedProjections.push(this);
|
|
722
|
-
unclaimedProjections.push(this.projectionScopedStyle);
|
|
723
|
-
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
// packages/qwik/src/server/vnode-data.ts
|
|
729
|
-
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
730
|
-
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
731
|
-
var EMPTY_ARRAY = [];
|
|
732
|
-
function vNodeData_incrementElementCount(vNodeData) {
|
|
733
|
-
const length = vNodeData.length;
|
|
734
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
735
|
-
if (lastValue >= 0) {
|
|
736
|
-
vNodeData.push(-1);
|
|
737
|
-
} else {
|
|
738
|
-
vNodeData[length - 1] = lastValue - 1;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function vNodeData_addTextSize(vNodeData, size) {
|
|
742
|
-
const length = vNodeData.length;
|
|
743
|
-
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
|
|
744
|
-
if (length > 1 && lastValue >= 0) {
|
|
745
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
746
|
-
}
|
|
747
|
-
vNodeData.push(size);
|
|
748
|
-
if (size == 0) {
|
|
749
|
-
vNodeData[0] |= 1 /* TEXT_DATA */;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
function vNodeData_openFragment(vNodeData, attrs) {
|
|
753
|
-
vNodeData.push(attrs, OPEN_FRAGMENT);
|
|
754
|
-
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
|
|
755
|
-
}
|
|
756
|
-
function vNodeData_closeFragment(vNodeData) {
|
|
757
|
-
vNodeData.push(CLOSE_FRAGMENT);
|
|
758
|
-
}
|
|
759
|
-
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
760
|
-
vNodeData[0] |= 4 /* REFERENCE */;
|
|
761
|
-
if (vNodeData.length == 1) {
|
|
762
|
-
return new SsrNode(
|
|
763
|
-
currentComponentNode,
|
|
764
|
-
SsrNode.ELEMENT_NODE,
|
|
765
|
-
String(depthFirstElementIdx),
|
|
766
|
-
EMPTY_ARRAY,
|
|
767
|
-
cleanupQueue,
|
|
768
|
-
vNodeData
|
|
769
|
-
);
|
|
770
|
-
} else {
|
|
771
|
-
let fragmentAttrs = EMPTY_ARRAY;
|
|
772
|
-
const stack2 = [SsrNode.ELEMENT_NODE, -1];
|
|
773
|
-
for (let i = 1; i < vNodeData.length; i++) {
|
|
774
|
-
const value = vNodeData[i];
|
|
775
|
-
if (Array.isArray(value)) {
|
|
776
|
-
fragmentAttrs = value;
|
|
777
|
-
i++;
|
|
778
|
-
stack2[stack2.length - 1]++;
|
|
779
|
-
stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
|
|
780
|
-
} else if (value === CLOSE_FRAGMENT) {
|
|
781
|
-
stack2.pop();
|
|
782
|
-
stack2.pop();
|
|
783
|
-
fragmentAttrs = EMPTY_ARRAY;
|
|
784
|
-
} else if (value < 0) {
|
|
785
|
-
const numberOfElements = 0 - value;
|
|
786
|
-
stack2[stack2.length - 1] += numberOfElements;
|
|
787
|
-
} else {
|
|
788
|
-
stack2[stack2.length - 1]++;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
let refId = String(depthFirstElementIdx);
|
|
792
|
-
for (let i = 1; i < stack2.length; i += 2) {
|
|
793
|
-
const childCount = stack2[i];
|
|
794
|
-
if (childCount >= 0) {
|
|
795
|
-
refId += encodeAsAlphanumeric(childCount);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
const type = stack2[stack2.length - 2];
|
|
799
|
-
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
var ALPHANUMERIC = [];
|
|
803
|
-
function encodeAsAlphanumeric(value) {
|
|
804
|
-
while (ALPHANUMERIC.length <= value) {
|
|
805
|
-
let value2 = ALPHANUMERIC.length;
|
|
806
|
-
let text = "";
|
|
807
|
-
do {
|
|
808
|
-
text = String.fromCharCode(
|
|
809
|
-
(text.length === 0 ? 65 : 97) + value2 % 26
|
|
810
|
-
/* A-Z */
|
|
811
|
-
) + text;
|
|
812
|
-
value2 = Math.floor(
|
|
813
|
-
value2 / 26
|
|
814
|
-
/* A-Z */
|
|
815
|
-
);
|
|
816
|
-
} while (value2 !== 0);
|
|
817
|
-
ALPHANUMERIC.push(text);
|
|
818
|
-
}
|
|
819
|
-
return ALPHANUMERIC[value];
|
|
820
|
-
}
|
|
821
|
-
|
|
822
601
|
// packages/qwik/src/core/shared/types.ts
|
|
823
602
|
var DEBUG_TYPE = "q:type";
|
|
824
603
|
var START = "\x1B[34m";
|
|
@@ -906,6 +685,7 @@ var ELEMENT_KEY = "q:key";
|
|
|
906
685
|
var ELEMENT_PROPS = "q:props";
|
|
907
686
|
var ELEMENT_SEQ = "q:seq";
|
|
908
687
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
688
|
+
var Q_PREFIX = "q:";
|
|
909
689
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
910
690
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
911
691
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
@@ -923,7 +703,7 @@ function setLocale(locale) {
|
|
|
923
703
|
}
|
|
924
704
|
|
|
925
705
|
// packages/qwik/src/core/client/vnode.ts
|
|
926
|
-
import { isDev as
|
|
706
|
+
import { isDev as isDev6 } from "@qwik.dev/core/build";
|
|
927
707
|
|
|
928
708
|
// packages/qwik/src/server/utils.ts
|
|
929
709
|
function createTimer() {
|
|
@@ -951,12 +731,12 @@ function getBuildBase(opts) {
|
|
|
951
731
|
return `${import.meta.env.BASE_URL}build/`;
|
|
952
732
|
}
|
|
953
733
|
var versions = {
|
|
954
|
-
qwik: "2.0.0-alpha.
|
|
734
|
+
qwik: "2.0.0-alpha.4-dev+374e0d6",
|
|
955
735
|
qwikDom: "2.1.19"
|
|
956
736
|
};
|
|
957
737
|
|
|
958
738
|
// packages/qwik/src/server/prefetch-strategy.ts
|
|
959
|
-
import { isDev as
|
|
739
|
+
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
960
740
|
function getPrefetchResources(qrls, opts, resolvedManifest) {
|
|
961
741
|
if (!resolvedManifest) {
|
|
962
742
|
return [];
|
|
@@ -994,7 +774,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
|
|
|
994
774
|
return prefetchResources;
|
|
995
775
|
}
|
|
996
776
|
function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
|
|
997
|
-
const url =
|
|
777
|
+
const url = isDev2 ? bundleFileName : buildBase + bundleFileName;
|
|
998
778
|
let prefetchResource = urls.get(url);
|
|
999
779
|
if (!prefetchResource) {
|
|
1000
780
|
prefetchResource = {
|
|
@@ -1018,13 +798,13 @@ var isQrl = (value) => {
|
|
|
1018
798
|
};
|
|
1019
799
|
|
|
1020
800
|
// packages/qwik/src/core/shared/utils/flyweight.ts
|
|
1021
|
-
var
|
|
801
|
+
var EMPTY_ARRAY = [];
|
|
1022
802
|
var EMPTY_OBJ = {};
|
|
1023
|
-
Object.freeze(
|
|
803
|
+
Object.freeze(EMPTY_ARRAY);
|
|
1024
804
|
Object.freeze(EMPTY_OBJ);
|
|
1025
805
|
|
|
1026
806
|
// packages/qwik/src/core/ssr/ssr-render-jsx.ts
|
|
1027
|
-
import { isDev as
|
|
807
|
+
import { isDev as isDev5 } from "@qwik.dev/core/build";
|
|
1028
808
|
|
|
1029
809
|
// packages/qwik/src/core/shared/jsx/slot.public.ts
|
|
1030
810
|
var Slot = (props) => {
|
|
@@ -1214,8 +994,11 @@ var Subscriber = class {
|
|
|
1214
994
|
function isSubscriber(value) {
|
|
1215
995
|
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
1216
996
|
}
|
|
1217
|
-
function clearVNodeEffectDependencies(value) {
|
|
1218
|
-
|
|
997
|
+
function clearVNodeEffectDependencies(container, value) {
|
|
998
|
+
if (vnode_isElementVNode(value)) {
|
|
999
|
+
ensureMaterialized(value);
|
|
1000
|
+
}
|
|
1001
|
+
const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
|
|
1219
1002
|
if (!effects) {
|
|
1220
1003
|
return;
|
|
1221
1004
|
}
|
|
@@ -1243,15 +1026,24 @@ function clearEffects(subscriber, value) {
|
|
|
1243
1026
|
return false;
|
|
1244
1027
|
}
|
|
1245
1028
|
const effectSubscriptions = subscriber.$effects$;
|
|
1246
|
-
|
|
1247
|
-
|
|
1029
|
+
const hostElement = subscriber.$hostElement$;
|
|
1030
|
+
if (hostElement && hostElement === value) {
|
|
1031
|
+
subscriber.$hostElement$ = null;
|
|
1248
1032
|
}
|
|
1249
1033
|
let subscriptionRemoved = false;
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
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);
|
|
1255
1047
|
}
|
|
1256
1048
|
}
|
|
1257
1049
|
return subscriptionRemoved;
|
|
@@ -1405,7 +1197,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
|
|
|
1405
1197
|
};
|
|
1406
1198
|
|
|
1407
1199
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1408
|
-
import { isDev as
|
|
1200
|
+
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
1409
1201
|
|
|
1410
1202
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
1411
1203
|
var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
|
|
@@ -1577,7 +1369,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
1577
1369
|
}
|
|
1578
1370
|
|
|
1579
1371
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
1580
|
-
import { isDev as
|
|
1372
|
+
import { isDev as isDev3 } from "@qwik.dev/core/build";
|
|
1581
1373
|
var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1582
1374
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
|
|
1583
1375
|
iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
|
|
@@ -1613,7 +1405,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1613
1405
|
}
|
|
1614
1406
|
}
|
|
1615
1407
|
if (vnode_isVNode(renderHost)) {
|
|
1616
|
-
clearVNodeEffectDependencies(renderHost);
|
|
1408
|
+
clearVNodeEffectDependencies(container, renderHost);
|
|
1617
1409
|
}
|
|
1618
1410
|
return componentFn(props);
|
|
1619
1411
|
},
|
|
@@ -1656,7 +1448,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
1656
1448
|
if (jsxElement2) {
|
|
1657
1449
|
addUseOnEvent(jsxElement2, key, useOnEvents[key]);
|
|
1658
1450
|
}
|
|
1659
|
-
} else if (
|
|
1451
|
+
} else if (isDev3) {
|
|
1660
1452
|
logWarn(
|
|
1661
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. '
|
|
1662
1454
|
);
|
|
@@ -1687,7 +1479,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1687
1479
|
const queue = [jsx2];
|
|
1688
1480
|
while (queue.length) {
|
|
1689
1481
|
const jsx3 = queue.shift();
|
|
1690
|
-
if (
|
|
1482
|
+
if (isJSXNode(jsx3)) {
|
|
1691
1483
|
if (typeof jsx3.type === "string") {
|
|
1692
1484
|
return jsx3;
|
|
1693
1485
|
}
|
|
@@ -1706,7 +1498,7 @@ function findFirstStringJSX(jsx2) {
|
|
|
1706
1498
|
return null;
|
|
1707
1499
|
}
|
|
1708
1500
|
function addScriptNodeForInvisibleComponents(jsx2) {
|
|
1709
|
-
if (
|
|
1501
|
+
if (isJSXNode(jsx2)) {
|
|
1710
1502
|
const jsxElement = new JSXNodeImpl(
|
|
1711
1503
|
"script",
|
|
1712
1504
|
{},
|
|
@@ -1805,12 +1597,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1805
1597
|
descend(jsxValue, false);
|
|
1806
1598
|
} else if (isSignal(jsxValue)) {
|
|
1807
1599
|
if (vCurrent) {
|
|
1808
|
-
clearVNodeEffectDependencies(vCurrent);
|
|
1600
|
+
clearVNodeEffectDependencies(container, vCurrent);
|
|
1809
1601
|
}
|
|
1810
1602
|
expectVirtual("S" /* WrappedSignal */, null);
|
|
1811
1603
|
descend(
|
|
1812
|
-
|
|
1813
|
-
|
|
1604
|
+
trackSignalAndAssignHost(
|
|
1605
|
+
jsxValue,
|
|
1814
1606
|
vNewNode || vCurrent,
|
|
1815
1607
|
"." /* VNODE */,
|
|
1816
1608
|
container
|
|
@@ -1820,7 +1612,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1820
1612
|
} else if (isPromise(jsxValue)) {
|
|
1821
1613
|
expectVirtual("A" /* Awaited */, null);
|
|
1822
1614
|
asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
1823
|
-
} else if (
|
|
1615
|
+
} else if (isJSXNode(jsxValue)) {
|
|
1824
1616
|
const type = jsxValue.type;
|
|
1825
1617
|
if (typeof type === "string") {
|
|
1826
1618
|
expectNoMoreTextNodes();
|
|
@@ -1956,46 +1748,45 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1956
1748
|
}
|
|
1957
1749
|
}
|
|
1958
1750
|
function descendContentToProject(children, host) {
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
const slotName = prop;
|
|
1972
|
-
projections.push(slotName);
|
|
1973
|
-
projections.push(createProjectionJSXNode(slotName));
|
|
1974
|
-
}
|
|
1751
|
+
const projectionChildren = Array.isArray(children) ? children : [children];
|
|
1752
|
+
const createProjectionJSXNode = (slotName) => {
|
|
1753
|
+
return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
|
|
1754
|
+
};
|
|
1755
|
+
const projections = [];
|
|
1756
|
+
if (host) {
|
|
1757
|
+
for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
|
|
1758
|
+
const prop = host[i];
|
|
1759
|
+
if (isSlotProp(prop)) {
|
|
1760
|
+
const slotName = prop;
|
|
1761
|
+
projections.push(slotName);
|
|
1762
|
+
projections.push(createProjectionJSXNode(slotName));
|
|
1975
1763
|
}
|
|
1976
1764
|
}
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1765
|
+
}
|
|
1766
|
+
if (projections.length === 0 && children == null) {
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
for (let i = 0; i < projectionChildren.length; i++) {
|
|
1770
|
+
const child = projectionChildren[i];
|
|
1771
|
+
const slotName = String(
|
|
1772
|
+
isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
|
|
1773
|
+
);
|
|
1774
|
+
const idx = mapApp_findIndx(projections, slotName, 0);
|
|
1775
|
+
let jsxBucket;
|
|
1776
|
+
if (idx >= 0) {
|
|
1777
|
+
jsxBucket = projections[idx + 1];
|
|
1778
|
+
} else {
|
|
1779
|
+
projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
|
|
1993
1780
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1781
|
+
const removeProjection = child === false;
|
|
1782
|
+
if (!removeProjection) {
|
|
1783
|
+
jsxBucket.children.push(child);
|
|
1996
1784
|
}
|
|
1997
|
-
descend(projections, true);
|
|
1998
1785
|
}
|
|
1786
|
+
for (let i = projections.length - 2; i >= 0; i = i - 2) {
|
|
1787
|
+
projections.splice(i, 1);
|
|
1788
|
+
}
|
|
1789
|
+
descend(projections, true);
|
|
1999
1790
|
}
|
|
2000
1791
|
function expectProjection() {
|
|
2001
1792
|
const jsxNode2 = jsxValue;
|
|
@@ -2008,8 +1799,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2008
1799
|
);
|
|
2009
1800
|
if (vCurrent == null) {
|
|
2010
1801
|
vNewNode = vnode_newVirtual();
|
|
2011
|
-
|
|
2012
|
-
|
|
1802
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1803
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectProjection");
|
|
2013
1804
|
vnode_setProp(vNewNode, QSlot, slotName);
|
|
2014
1805
|
vnode_setProp(vNewNode, QSlotParent, vParent);
|
|
2015
1806
|
vnode_setProp(vParent, slotName, vNewNode);
|
|
@@ -2035,8 +1826,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2035
1826
|
);
|
|
2036
1827
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2037
1828
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2038
|
-
|
|
2039
|
-
|
|
1829
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1830
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2040
1831
|
return false;
|
|
2041
1832
|
} else if (vProjectedNode === vCurrent) {
|
|
2042
1833
|
} else {
|
|
@@ -2048,8 +1839,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2048
1839
|
);
|
|
2049
1840
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
2050
1841
|
vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
|
|
2051
|
-
|
|
2052
|
-
|
|
1842
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
1843
|
+
isDev4 && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
2053
1844
|
}
|
|
2054
1845
|
return true;
|
|
2055
1846
|
}
|
|
@@ -2059,7 +1850,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2059
1850
|
if (constProps && typeof constProps == "object" && "name" in constProps) {
|
|
2060
1851
|
const constValue = constProps.name;
|
|
2061
1852
|
if (vHost && constValue instanceof WrappedSignal) {
|
|
2062
|
-
return
|
|
1853
|
+
return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
|
|
2063
1854
|
}
|
|
2064
1855
|
}
|
|
2065
1856
|
return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
|
|
@@ -2141,12 +1932,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2141
1932
|
}
|
|
2142
1933
|
}
|
|
2143
1934
|
if (isSignal(value)) {
|
|
2144
|
-
const signalData = new
|
|
1935
|
+
const signalData = new EffectPropData({
|
|
2145
1936
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2146
1937
|
$isConst$: true
|
|
2147
1938
|
});
|
|
2148
|
-
value =
|
|
2149
|
-
|
|
1939
|
+
value = trackSignalAndAssignHost(
|
|
1940
|
+
value,
|
|
2150
1941
|
vNewNode,
|
|
2151
1942
|
key2,
|
|
2152
1943
|
container,
|
|
@@ -2160,8 +1951,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2160
1951
|
}
|
|
2161
1952
|
if (elementName === "textarea" && key2 === "value") {
|
|
2162
1953
|
if (typeof value !== "string") {
|
|
2163
|
-
if (
|
|
2164
|
-
|
|
1954
|
+
if (isDev4) {
|
|
1955
|
+
throw qError(40 /* wrongTextareaValue */);
|
|
2165
1956
|
}
|
|
2166
1957
|
continue;
|
|
2167
1958
|
}
|
|
@@ -2293,7 +2084,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2293
2084
|
}
|
|
2294
2085
|
};
|
|
2295
2086
|
while (srcKey !== null || dstKey !== null) {
|
|
2296
|
-
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey
|
|
2087
|
+
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith(Q_PREFIX)) {
|
|
2297
2088
|
dstIdx++;
|
|
2298
2089
|
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2299
2090
|
} else if (srcKey == null) {
|
|
@@ -2404,7 +2195,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2404
2195
|
vCurrent && getInsertBefore()
|
|
2405
2196
|
);
|
|
2406
2197
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
|
|
2407
|
-
|
|
2198
|
+
isDev4 && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
|
|
2408
2199
|
}
|
|
2409
2200
|
function expectComponent(component) {
|
|
2410
2201
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -2447,7 +2238,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2447
2238
|
container.$scheduler$(7 /* COMPONENT */, host, componentQRL, jsxProps);
|
|
2448
2239
|
}
|
|
2449
2240
|
}
|
|
2450
|
-
|
|
2241
|
+
descendContentToProject(jsxNode2.children, host);
|
|
2451
2242
|
} else {
|
|
2452
2243
|
const lookupKey = jsxNode2.key;
|
|
2453
2244
|
const vNodeLookupKey = getKey(host);
|
|
@@ -2479,7 +2270,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2479
2270
|
}
|
|
2480
2271
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
2481
2272
|
if (host) {
|
|
2482
|
-
clearVNodeEffectDependencies(host);
|
|
2273
|
+
clearVNodeEffectDependencies(container, host);
|
|
2483
2274
|
}
|
|
2484
2275
|
vnode_insertBefore(
|
|
2485
2276
|
journal,
|
|
@@ -2488,7 +2279,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2488
2279
|
vCurrent && getInsertBefore()
|
|
2489
2280
|
);
|
|
2490
2281
|
const jsxNode2 = jsxValue;
|
|
2491
|
-
|
|
2282
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
2492
2283
|
container.setHostProp(vNewNode, OnRenderProp, componentQRL);
|
|
2493
2284
|
container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
|
|
2494
2285
|
container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2501,7 +2292,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2501
2292
|
vCurrent && getInsertBefore()
|
|
2502
2293
|
);
|
|
2503
2294
|
const jsxNode2 = jsxValue;
|
|
2504
|
-
|
|
2295
|
+
isDev4 && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
2505
2296
|
vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
|
|
2506
2297
|
if (jsxNode2.key) {
|
|
2507
2298
|
vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
|
|
@@ -2545,8 +2336,8 @@ function propsDiffer(src, dst) {
|
|
|
2545
2336
|
if (!src || !dst) {
|
|
2546
2337
|
return true;
|
|
2547
2338
|
}
|
|
2548
|
-
let srcKeys =
|
|
2549
|
-
let dstKeys =
|
|
2339
|
+
let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
|
|
2340
|
+
let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
|
|
2550
2341
|
if (srcKeys.length !== dstKeys.length) {
|
|
2551
2342
|
return true;
|
|
2552
2343
|
}
|
|
@@ -2561,10 +2352,13 @@ function propsDiffer(src, dst) {
|
|
|
2561
2352
|
}
|
|
2562
2353
|
return false;
|
|
2563
2354
|
}
|
|
2564
|
-
function
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
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
|
+
}
|
|
2568
2362
|
}
|
|
2569
2363
|
return keys;
|
|
2570
2364
|
}
|
|
@@ -2577,9 +2371,9 @@ function cleanup(container, vNode) {
|
|
|
2577
2371
|
do {
|
|
2578
2372
|
const type = vCursor[0 /* flags */];
|
|
2579
2373
|
if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
|
|
2374
|
+
clearVNodeEffectDependencies(container, vCursor);
|
|
2375
|
+
markVNodeAsDeleted(vCursor);
|
|
2580
2376
|
if (type & 2 /* Virtual */) {
|
|
2581
|
-
clearVNodeEffectDependencies(vCursor);
|
|
2582
|
-
markVNodeAsDeleted(vCursor);
|
|
2583
2377
|
const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
|
|
2584
2378
|
if (seq) {
|
|
2585
2379
|
for (let i = 0; i < seq.length; i++) {
|
|
@@ -2588,7 +2382,7 @@ function cleanup(container, vNode) {
|
|
|
2588
2382
|
const task = obj;
|
|
2589
2383
|
clearSubscriberEffectDependencies(task);
|
|
2590
2384
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2591
|
-
container.$scheduler$(
|
|
2385
|
+
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2592
2386
|
} else {
|
|
2593
2387
|
cleanupTask(task);
|
|
2594
2388
|
}
|
|
@@ -2679,8 +2473,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2679
2473
|
let journalFlushScheduled = false;
|
|
2680
2474
|
return schedule;
|
|
2681
2475
|
function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
2682
|
-
const runLater = type !==
|
|
2683
|
-
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 */;
|
|
2684
2478
|
if (isTask2) {
|
|
2685
2479
|
hostOrTask.$flags$ |= 8 /* DIRTY */;
|
|
2686
2480
|
}
|
|
@@ -2700,7 +2494,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2700
2494
|
chore = sortedInsert(choreQueue, chore);
|
|
2701
2495
|
if (!journalFlushScheduled && runLater) {
|
|
2702
2496
|
journalFlushScheduled = true;
|
|
2703
|
-
schedule(
|
|
2497
|
+
schedule(16 /* JOURNAL_FLUSH */);
|
|
2704
2498
|
scheduleDrain();
|
|
2705
2499
|
}
|
|
2706
2500
|
if (runLater) {
|
|
@@ -2727,7 +2521,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2727
2521
|
}
|
|
2728
2522
|
const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
|
|
2729
2523
|
if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
|
|
2730
|
-
nextChore.$type$ !==
|
|
2524
|
+
nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
|
|
2731
2525
|
DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
|
|
2732
2526
|
continue;
|
|
2733
2527
|
}
|
|
@@ -2746,7 +2540,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2746
2540
|
currentChore = chore;
|
|
2747
2541
|
let returnValue = null;
|
|
2748
2542
|
switch (chore.$type$) {
|
|
2749
|
-
case
|
|
2543
|
+
case 16 /* JOURNAL_FLUSH */:
|
|
2750
2544
|
returnValue = journalFlush();
|
|
2751
2545
|
journalFlushScheduled = false;
|
|
2752
2546
|
break;
|
|
@@ -2761,7 +2555,17 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2761
2555
|
chore.$payload$
|
|
2762
2556
|
),
|
|
2763
2557
|
(jsx3) => {
|
|
2764
|
-
|
|
2558
|
+
if (chore.$type$ === 7 /* COMPONENT */) {
|
|
2559
|
+
const styleScopedId = container.getHostProp(host, QScopedStyle);
|
|
2560
|
+
return vnode_diff(
|
|
2561
|
+
container,
|
|
2562
|
+
jsx3,
|
|
2563
|
+
host,
|
|
2564
|
+
addComponentStylePrefix(styleScopedId)
|
|
2565
|
+
);
|
|
2566
|
+
} else {
|
|
2567
|
+
return jsx3;
|
|
2568
|
+
}
|
|
2765
2569
|
},
|
|
2766
2570
|
(err) => container.handleError(err, host)
|
|
2767
2571
|
);
|
|
@@ -2773,10 +2577,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2773
2577
|
case 3 /* TASK */:
|
|
2774
2578
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2775
2579
|
break;
|
|
2776
|
-
case
|
|
2580
|
+
case 32 /* VISIBLE */:
|
|
2777
2581
|
returnValue = runTask(chore.$payload$, container, host);
|
|
2778
2582
|
break;
|
|
2779
|
-
case
|
|
2583
|
+
case 48 /* CLEANUP_VISIBLE */:
|
|
2780
2584
|
const task = chore.$payload$;
|
|
2781
2585
|
cleanupTask(task);
|
|
2782
2586
|
break;
|
|
@@ -2811,6 +2615,20 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2811
2615
|
returnValue = !target.resolved ? target.resolve() : null;
|
|
2812
2616
|
break;
|
|
2813
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
|
+
}
|
|
2814
2632
|
}
|
|
2815
2633
|
return maybeThenPassError(returnValue, (value) => {
|
|
2816
2634
|
DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
|
|
@@ -2835,11 +2653,11 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
2835
2653
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2836
2654
|
}
|
|
2837
2655
|
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2838
|
-
const macroTypeDiff = (a.$type$ &
|
|
2656
|
+
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2839
2657
|
if (macroTypeDiff !== 0) {
|
|
2840
2658
|
return macroTypeDiff;
|
|
2841
2659
|
}
|
|
2842
|
-
if (a.$type$ !==
|
|
2660
|
+
if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
|
|
2843
2661
|
const aHost = a.$host$;
|
|
2844
2662
|
const bHost = b.$host$;
|
|
2845
2663
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
@@ -2854,7 +2672,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2854
2672
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2855
2673
|
Problematic Node: ${aHost.toString()}`;
|
|
2856
2674
|
if (shouldThrowOnHostMismatch) {
|
|
2857
|
-
|
|
2675
|
+
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2858
2676
|
}
|
|
2859
2677
|
logWarn(errorMessage);
|
|
2860
2678
|
return null;
|
|
@@ -2868,7 +2686,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2868
2686
|
if (idxDiff !== 0) {
|
|
2869
2687
|
return idxDiff;
|
|
2870
2688
|
}
|
|
2871
|
-
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 */)) {
|
|
2872
2690
|
return 1;
|
|
2873
2691
|
}
|
|
2874
2692
|
}
|
|
@@ -2910,11 +2728,11 @@ function debugChoreToString(chore) {
|
|
|
2910
2728
|
[5 /* NODE_PROP */]: "NODE_PROP",
|
|
2911
2729
|
[7 /* COMPONENT */]: "COMPONENT",
|
|
2912
2730
|
[6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
|
|
2913
|
-
[
|
|
2914
|
-
[
|
|
2915
|
-
[
|
|
2916
|
-
[
|
|
2917
|
-
[
|
|
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"
|
|
2918
2736
|
}[chore.$type$] || "UNKNOWN: " + chore.$type$;
|
|
2919
2737
|
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
2920
2738
|
const qrlTarget = chore.$target$?.$symbol$;
|
|
@@ -3037,7 +2855,7 @@ var throwIfQRLNotResolved = (qrl) => {
|
|
|
3037
2855
|
var isSignal = (value) => {
|
|
3038
2856
|
return value instanceof Signal;
|
|
3039
2857
|
};
|
|
3040
|
-
var
|
|
2858
|
+
var EffectPropData = class {
|
|
3041
2859
|
constructor(data) {
|
|
3042
2860
|
__publicField(this, "data");
|
|
3043
2861
|
this.data = data;
|
|
@@ -3101,7 +2919,7 @@ var Signal = class {
|
|
|
3101
2919
|
// prevent accidental use as value
|
|
3102
2920
|
valueOf() {
|
|
3103
2921
|
if (qDev) {
|
|
3104
|
-
|
|
2922
|
+
throw qError(46 /* cannotCoerceSignal */);
|
|
3105
2923
|
}
|
|
3106
2924
|
}
|
|
3107
2925
|
toString() {
|
|
@@ -3133,7 +2951,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
|
3133
2951
|
return;
|
|
3134
2952
|
}
|
|
3135
2953
|
effect.$effectDependencies$.push(subscriber);
|
|
3136
|
-
} else if (vnode_isVNode(effect) &&
|
|
2954
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
3137
2955
|
let subscribers = vnode_getProp(
|
|
3138
2956
|
effect,
|
|
3139
2957
|
QSubscribers,
|
|
@@ -3177,7 +2995,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3177
2995
|
DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
|
|
3178
2996
|
let choreType = 3 /* TASK */;
|
|
3179
2997
|
if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
3180
|
-
choreType =
|
|
2998
|
+
choreType = 32 /* VISIBLE */;
|
|
3181
2999
|
} else if (effect.$flags$ & 4 /* RESOURCE */) {
|
|
3182
3000
|
choreType = 2 /* RESOURCE */;
|
|
3183
3001
|
}
|
|
@@ -3188,13 +3006,7 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3188
3006
|
container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
|
|
3189
3007
|
}
|
|
3190
3008
|
}
|
|
3191
|
-
|
|
3192
|
-
retryOnPromise(
|
|
3193
|
-
() => effect.$invalidate$()
|
|
3194
|
-
);
|
|
3195
|
-
} catch (e) {
|
|
3196
|
-
logError(e);
|
|
3197
|
-
}
|
|
3009
|
+
effect.$invalidate$();
|
|
3198
3010
|
} else if (property === ":" /* COMPONENT */) {
|
|
3199
3011
|
const host = effect;
|
|
3200
3012
|
const qrl = container.getHostProp(host, OnRenderProp);
|
|
@@ -3207,9 +3019,8 @@ var triggerEffects = (container, signal, effects) => {
|
|
|
3207
3019
|
container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
|
|
3208
3020
|
} else {
|
|
3209
3021
|
const host = effect;
|
|
3210
|
-
|
|
3211
|
-
if (effectData instanceof
|
|
3212
|
-
effectData = effectData;
|
|
3022
|
+
const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
|
|
3023
|
+
if (effectData instanceof EffectPropData) {
|
|
3213
3024
|
const data = effectData.data;
|
|
3214
3025
|
const payload = {
|
|
3215
3026
|
...data,
|
|
@@ -3236,16 +3047,13 @@ var ComputedSignal = class extends Signal {
|
|
|
3236
3047
|
// We need a separate flag to know when the computation needs running because
|
|
3237
3048
|
// we need the old value to know if effects need running after computation
|
|
3238
3049
|
__publicField(this, "$invalid$", true);
|
|
3050
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3239
3051
|
this.$computeQrl$ = fn;
|
|
3240
3052
|
}
|
|
3241
3053
|
$invalidate$() {
|
|
3242
3054
|
this.$invalid$ = true;
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
}
|
|
3246
|
-
if (this.$computeIfNeeded$()) {
|
|
3247
|
-
triggerEffects(this.$container$, this, this.$effects$);
|
|
3248
|
-
}
|
|
3055
|
+
this.$forceRunEffects$ = false;
|
|
3056
|
+
this.$container$?.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
|
|
3249
3057
|
}
|
|
3250
3058
|
/**
|
|
3251
3059
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3253,10 +3061,14 @@ var ComputedSignal = class extends Signal {
|
|
|
3253
3061
|
*/
|
|
3254
3062
|
force() {
|
|
3255
3063
|
this.$invalid$ = true;
|
|
3064
|
+
this.$forceRunEffects$ = false;
|
|
3256
3065
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3257
3066
|
}
|
|
3258
3067
|
get untrackedValue() {
|
|
3259
|
-
this.$computeIfNeeded$();
|
|
3068
|
+
const didChange = this.$computeIfNeeded$();
|
|
3069
|
+
if (didChange) {
|
|
3070
|
+
this.$forceRunEffects$ = didChange;
|
|
3071
|
+
}
|
|
3260
3072
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3261
3073
|
return this.$untrackedValue$;
|
|
3262
3074
|
}
|
|
@@ -3272,9 +3084,10 @@ var ComputedSignal = class extends Signal {
|
|
|
3272
3084
|
try {
|
|
3273
3085
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3274
3086
|
if (isPromise(untrackedValue)) {
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3087
|
+
throw qError(47 /* computedNotSync */, [
|
|
3088
|
+
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3089
|
+
computeQrl.$hash$
|
|
3090
|
+
]);
|
|
3278
3091
|
}
|
|
3279
3092
|
DEBUG3 && log2("Signal.$compute$", untrackedValue);
|
|
3280
3093
|
this.$invalid$ = false;
|
|
@@ -3294,7 +3107,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3294
3107
|
return super.value;
|
|
3295
3108
|
}
|
|
3296
3109
|
set value(_) {
|
|
3297
|
-
|
|
3110
|
+
throw qError(48 /* computedReadOnly */);
|
|
3298
3111
|
}
|
|
3299
3112
|
};
|
|
3300
3113
|
var WrappedSignal = class extends Signal {
|
|
@@ -3307,18 +3120,20 @@ var WrappedSignal = class extends Signal {
|
|
|
3307
3120
|
// we need the old value to know if effects need running after computation
|
|
3308
3121
|
__publicField(this, "$invalid$", true);
|
|
3309
3122
|
__publicField(this, "$effectDependencies$", null);
|
|
3123
|
+
__publicField(this, "$hostElement$", null);
|
|
3124
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
3310
3125
|
this.$args$ = args;
|
|
3311
3126
|
this.$func$ = fn;
|
|
3312
3127
|
this.$funcStr$ = fnStr;
|
|
3313
3128
|
}
|
|
3314
3129
|
$invalidate$() {
|
|
3315
3130
|
this.$invalid$ = true;
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3131
|
+
this.$forceRunEffects$ = false;
|
|
3132
|
+
this.$container$?.$scheduler$(
|
|
3133
|
+
8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
|
|
3134
|
+
this.$hostElement$,
|
|
3135
|
+
this
|
|
3136
|
+
);
|
|
3322
3137
|
}
|
|
3323
3138
|
/**
|
|
3324
3139
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -3326,10 +3141,14 @@ var WrappedSignal = class extends Signal {
|
|
|
3326
3141
|
*/
|
|
3327
3142
|
force() {
|
|
3328
3143
|
this.$invalid$ = true;
|
|
3144
|
+
this.$forceRunEffects$ = false;
|
|
3329
3145
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
3330
3146
|
}
|
|
3331
3147
|
get untrackedValue() {
|
|
3332
|
-
this.$computeIfNeeded$();
|
|
3148
|
+
const didChange = this.$computeIfNeeded$();
|
|
3149
|
+
if (didChange) {
|
|
3150
|
+
this.$forceRunEffects$ = didChange;
|
|
3151
|
+
}
|
|
3333
3152
|
assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
3334
3153
|
return this.$untrackedValue$;
|
|
3335
3154
|
}
|
|
@@ -3354,12 +3173,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3354
3173
|
return super.value;
|
|
3355
3174
|
}
|
|
3356
3175
|
set value(_) {
|
|
3357
|
-
|
|
3176
|
+
throw qError(49 /* wrappedReadOnly */);
|
|
3358
3177
|
}
|
|
3359
3178
|
};
|
|
3360
3179
|
|
|
3361
3180
|
// packages/qwik/src/core/version.ts
|
|
3362
|
-
var version = "2.0.0-alpha.
|
|
3181
|
+
var version = "2.0.0-alpha.4-dev+374e0d6";
|
|
3363
3182
|
|
|
3364
3183
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3365
3184
|
var _SharedContainer = class {
|
|
@@ -3384,7 +3203,7 @@ var _SharedContainer = class {
|
|
|
3384
3203
|
this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
|
|
3385
3204
|
}
|
|
3386
3205
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3387
|
-
return
|
|
3206
|
+
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
3388
3207
|
}
|
|
3389
3208
|
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3390
3209
|
return createSerializationContext(
|
|
@@ -3506,7 +3325,7 @@ var JSXNodeImpl = class {
|
|
|
3506
3325
|
}
|
|
3507
3326
|
};
|
|
3508
3327
|
var Virtual = (props) => props.children;
|
|
3509
|
-
var
|
|
3328
|
+
var isJSXNode = (n) => {
|
|
3510
3329
|
if (qDev) {
|
|
3511
3330
|
if (n instanceof JSXNodeImpl) {
|
|
3512
3331
|
return true;
|
|
@@ -3642,7 +3461,7 @@ function qwikDebugToString(value) {
|
|
|
3642
3461
|
}
|
|
3643
3462
|
} else if (isStore(value)) {
|
|
3644
3463
|
return "Store";
|
|
3645
|
-
} else if (
|
|
3464
|
+
} else if (isJSXNode(value)) {
|
|
3646
3465
|
return jsxToString(value);
|
|
3647
3466
|
}
|
|
3648
3467
|
} finally {
|
|
@@ -3655,7 +3474,7 @@ var pad = (text, prefix) => {
|
|
|
3655
3474
|
return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
|
|
3656
3475
|
};
|
|
3657
3476
|
var jsxToString = (value) => {
|
|
3658
|
-
if (
|
|
3477
|
+
if (isJSXNode(value)) {
|
|
3659
3478
|
let type = value.type;
|
|
3660
3479
|
if (typeof type === "function") {
|
|
3661
3480
|
type = type.name || "Component";
|
|
@@ -3844,7 +3663,7 @@ var VNodeDataChar = {
|
|
|
3844
3663
|
/* ************** */
|
|
3845
3664
|
123
|
|
3846
3665
|
),
|
|
3847
|
-
// `{` is the start of the VNodeData.
|
|
3666
|
+
// `{` is the start of the VNodeData for a virtual element.
|
|
3848
3667
|
OPEN_CHAR: (
|
|
3849
3668
|
/* ****** */
|
|
3850
3669
|
"{"
|
|
@@ -3853,7 +3672,7 @@ var VNodeDataChar = {
|
|
|
3853
3672
|
/* ************* */
|
|
3854
3673
|
125
|
|
3855
3674
|
),
|
|
3856
|
-
// `}` is the end of the VNodeData.
|
|
3675
|
+
// `}` is the end of the VNodeData for a virtual element.
|
|
3857
3676
|
CLOSE_CHAR: (
|
|
3858
3677
|
/* ***** */
|
|
3859
3678
|
"}"
|
|
@@ -3923,7 +3742,7 @@ var VNodeDataChar = {
|
|
|
3923
3742
|
),
|
|
3924
3743
|
DON_T_USE: (
|
|
3925
3744
|
/* ********** */
|
|
3926
|
-
|
|
3745
|
+
92
|
|
3927
3746
|
),
|
|
3928
3747
|
// `\` - SKIP because `\` is used as escaping
|
|
3929
3748
|
DON_T_USE_CHAR: "\\",
|
|
@@ -3945,6 +3764,15 @@ var VNodeDataChar = {
|
|
|
3945
3764
|
/* **** */
|
|
3946
3765
|
"^"
|
|
3947
3766
|
),
|
|
3767
|
+
SUBS: (
|
|
3768
|
+
/* *************** */
|
|
3769
|
+
96
|
|
3770
|
+
),
|
|
3771
|
+
// '`' - `q:subs' - Effect dependencies/subscriptions
|
|
3772
|
+
SUBS_CHAR: (
|
|
3773
|
+
/* ******* */
|
|
3774
|
+
"`"
|
|
3775
|
+
),
|
|
3948
3776
|
SEPARATOR: (
|
|
3949
3777
|
/* ********* */
|
|
3950
3778
|
124
|
|
@@ -4664,9 +4492,32 @@ var vnode_materialize = (vNode) => {
|
|
|
4664
4492
|
const element = vNode[6 /* element */];
|
|
4665
4493
|
const firstChild = fastFirstChild(element);
|
|
4666
4494
|
const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
|
|
4667
|
-
const vFirstChild =
|
|
4495
|
+
const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
|
|
4668
4496
|
return vFirstChild;
|
|
4669
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
|
+
};
|
|
4670
4521
|
var ensureMaterialized = (vnode) => {
|
|
4671
4522
|
const vParent = ensureElementVNode(vnode);
|
|
4672
4523
|
let vFirstChild = vParent[4 /* firstChild */];
|
|
@@ -4788,7 +4639,7 @@ var fastGetter = (prototype, name) => {
|
|
|
4788
4639
|
var isQStyleElement = (node) => {
|
|
4789
4640
|
return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
|
|
4790
4641
|
};
|
|
4791
|
-
var materializeFromDOM = (vParent, firstChild) => {
|
|
4642
|
+
var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
4792
4643
|
let vFirstChild = null;
|
|
4793
4644
|
const skipStyleElements = () => {
|
|
4794
4645
|
while (isQStyleElement(child)) {
|
|
@@ -4822,8 +4673,54 @@ var materializeFromDOM = (vParent, firstChild) => {
|
|
|
4822
4673
|
}
|
|
4823
4674
|
vParent[5 /* lastChild */] = vChild || null;
|
|
4824
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
|
+
}
|
|
4825
4693
|
return vFirstChild;
|
|
4826
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
|
+
};
|
|
4827
4724
|
var vnode_getNextSibling = (vnode) => {
|
|
4828
4725
|
return vnode[3 /* nextSibling */];
|
|
4829
4726
|
};
|
|
@@ -4908,7 +4805,7 @@ var vnode_getPropStartIndex = (vnode) => {
|
|
|
4908
4805
|
} else if (type === 2 /* Virtual */) {
|
|
4909
4806
|
return 6 /* PROPS_OFFSET */;
|
|
4910
4807
|
}
|
|
4911
|
-
throw
|
|
4808
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
4912
4809
|
};
|
|
4913
4810
|
var vnode_getParent = (vnode) => {
|
|
4914
4811
|
return vnode[1 /* parent */] || null;
|
|
@@ -4923,7 +4820,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4923
4820
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4924
4821
|
return vnode[4 /* node */];
|
|
4925
4822
|
};
|
|
4926
|
-
function vnode_toString(depth = 10, offset = "",
|
|
4823
|
+
function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
|
|
4927
4824
|
let vnode = this;
|
|
4928
4825
|
if (depth === 0) {
|
|
4929
4826
|
return "...";
|
|
@@ -4975,7 +4872,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
|
|
|
4975
4872
|
}
|
|
4976
4873
|
}
|
|
4977
4874
|
strings.push("<" + tag + attrs.join("") + ">");
|
|
4978
|
-
if (vnode_isMaterialized(vnode) ||
|
|
4875
|
+
if (vnode_isMaterialized(vnode) || materialize2) {
|
|
4979
4876
|
const child = vnode_getFirstChild(vnode);
|
|
4980
4877
|
child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
|
|
4981
4878
|
} else {
|
|
@@ -4998,25 +4895,9 @@ var isLowercase = (ch) => (
|
|
|
4998
4895
|
var stack = [];
|
|
4999
4896
|
function materializeFromVNodeData(vParent, vData, element, child) {
|
|
5000
4897
|
let idx = 0;
|
|
5001
|
-
let nextToConsumeIdx = 0;
|
|
5002
4898
|
let vFirst = null;
|
|
5003
4899
|
let vLast = null;
|
|
5004
4900
|
let previousTextNode = null;
|
|
5005
|
-
let ch = 0;
|
|
5006
|
-
let peekCh = 0;
|
|
5007
|
-
const peek = () => {
|
|
5008
|
-
if (peekCh !== 0) {
|
|
5009
|
-
return peekCh;
|
|
5010
|
-
} else {
|
|
5011
|
-
return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
|
|
5012
|
-
}
|
|
5013
|
-
};
|
|
5014
|
-
const consume = () => {
|
|
5015
|
-
ch = peek();
|
|
5016
|
-
peekCh = 0;
|
|
5017
|
-
nextToConsumeIdx++;
|
|
5018
|
-
return ch;
|
|
5019
|
-
};
|
|
5020
4901
|
const addVNode = (node) => {
|
|
5021
4902
|
node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
|
|
5022
4903
|
idx++;
|
|
@@ -5028,25 +4909,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5028
4909
|
}
|
|
5029
4910
|
vLast = node;
|
|
5030
4911
|
};
|
|
5031
|
-
const consumeValue = () => {
|
|
5032
|
-
consume();
|
|
5033
|
-
const start = nextToConsumeIdx;
|
|
5034
|
-
while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
|
|
5035
|
-
consume();
|
|
5036
|
-
}
|
|
5037
|
-
return vData.substring(start, nextToConsumeIdx);
|
|
5038
|
-
};
|
|
5039
4912
|
let textIdx = 0;
|
|
5040
4913
|
let combinedText = null;
|
|
5041
4914
|
let container = null;
|
|
5042
|
-
|
|
4915
|
+
processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
|
|
5043
4916
|
if (isNumber(peek())) {
|
|
5044
4917
|
while (!isElement(child)) {
|
|
5045
4918
|
child = fastNextSibling(child);
|
|
5046
4919
|
if (!child) {
|
|
5047
|
-
|
|
5048
|
-
"Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
|
|
5049
|
-
);
|
|
4920
|
+
throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
|
|
5050
4921
|
}
|
|
5051
4922
|
}
|
|
5052
4923
|
while (isQStyleElement(child)) {
|
|
@@ -5073,7 +4944,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5073
4944
|
}
|
|
5074
4945
|
const id = consumeValue();
|
|
5075
4946
|
container.$setRawState$(parseInt(id), vParent);
|
|
5076
|
-
|
|
4947
|
+
isDev6 && vnode_setAttr(null, vParent, ELEMENT_ID, id);
|
|
5077
4948
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
5078
4949
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
5079
4950
|
} else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
@@ -5084,6 +4955,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5084
4955
|
vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
|
|
5085
4956
|
} else if (peek() === VNodeDataChar.SEQ_IDX) {
|
|
5086
4957
|
vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
|
|
4958
|
+
} else if (peek() === VNodeDataChar.SUBS) {
|
|
4959
|
+
vnode_setProp(vParent, QSubscribers, consumeValue());
|
|
5087
4960
|
} else if (peek() === VNodeDataChar.CONTEXT) {
|
|
5088
4961
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
5089
4962
|
} else if (peek() === VNodeDataChar.OPEN) {
|
|
@@ -5126,7 +4999,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
5126
4999
|
);
|
|
5127
5000
|
textIdx += length;
|
|
5128
5001
|
}
|
|
5129
|
-
}
|
|
5002
|
+
});
|
|
5130
5003
|
vParent[5 /* lastChild */] = vLast;
|
|
5131
5004
|
return vFirst;
|
|
5132
5005
|
}
|
|
@@ -5139,7 +5012,7 @@ var vnode_getType = (vnode) => {
|
|
|
5139
5012
|
} else if (type & 4 /* Text */) {
|
|
5140
5013
|
return 3;
|
|
5141
5014
|
}
|
|
5142
|
-
throw
|
|
5015
|
+
throw qError(43 /* invalidVNodeType */, [type]);
|
|
5143
5016
|
};
|
|
5144
5017
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5145
5018
|
1;
|
|
@@ -5220,7 +5093,7 @@ var VNodeArray = class VNode extends Array {
|
|
|
5220
5093
|
constructor(flags, parent, previousSibling, nextSibling) {
|
|
5221
5094
|
super();
|
|
5222
5095
|
this.push(flags, parent, previousSibling, nextSibling);
|
|
5223
|
-
if (
|
|
5096
|
+
if (isDev6) {
|
|
5224
5097
|
this.toString = vnode_toString;
|
|
5225
5098
|
}
|
|
5226
5099
|
}
|
|
@@ -5301,6 +5174,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
|
|
|
5301
5174
|
trackInvocation.$container$ = previousContainer;
|
|
5302
5175
|
}
|
|
5303
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
|
+
};
|
|
5304
5183
|
|
|
5305
5184
|
// packages/qwik/src/core/use/use-context.ts
|
|
5306
5185
|
var createContextId = (name) => {
|
|
@@ -5322,7 +5201,7 @@ var isRecoverable = (err) => {
|
|
|
5322
5201
|
};
|
|
5323
5202
|
|
|
5324
5203
|
// packages/qwik/src/core/client/process-vnode-data.ts
|
|
5325
|
-
function
|
|
5204
|
+
function processVNodeData2(document2) {
|
|
5326
5205
|
const Q_CONTAINER = "q:container";
|
|
5327
5206
|
const Q_CONTAINER_END = "/" + Q_CONTAINER;
|
|
5328
5207
|
const Q_PROPS_SEPARATOR2 = ":";
|
|
@@ -5574,7 +5453,7 @@ function processVNodeData(document2) {
|
|
|
5574
5453
|
function getDomContainer(element) {
|
|
5575
5454
|
const qContainerElement = _getQContainerElement(element);
|
|
5576
5455
|
if (!qContainerElement) {
|
|
5577
|
-
|
|
5456
|
+
throw qError(41 /* containerNotFound */);
|
|
5578
5457
|
}
|
|
5579
5458
|
return getDomContainerFromQContainerElement(qContainerElement);
|
|
5580
5459
|
}
|
|
@@ -5645,7 +5524,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5645
5524
|
});
|
|
5646
5525
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
5647
5526
|
if (!this.qContainer) {
|
|
5648
|
-
|
|
5527
|
+
throw qError(42 /* elementWithoutContainer */);
|
|
5649
5528
|
}
|
|
5650
5529
|
this.$journal$ = [
|
|
5651
5530
|
// The first time we render we need to hoist the styles.
|
|
@@ -5666,7 +5545,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5666
5545
|
this.stateData = null;
|
|
5667
5546
|
const document2 = this.element.ownerDocument;
|
|
5668
5547
|
if (!document2.qVNodeData) {
|
|
5669
|
-
|
|
5548
|
+
processVNodeData2(document2);
|
|
5670
5549
|
}
|
|
5671
5550
|
this.$rawStateData$ = [];
|
|
5672
5551
|
this.stateData = [];
|
|
@@ -5676,7 +5555,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5676
5555
|
this.$rawStateData$ = JSON.parse(lastState.textContent);
|
|
5677
5556
|
this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
5678
5557
|
}
|
|
5679
|
-
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) ||
|
|
5558
|
+
this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
|
|
5680
5559
|
}
|
|
5681
5560
|
$setRawState$(id, vParent) {
|
|
5682
5561
|
this.stateData[id] = vParent;
|
|
@@ -5684,10 +5563,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5684
5563
|
parseQRL(qrl) {
|
|
5685
5564
|
return inflateQRL(this, parseQRL(qrl));
|
|
5686
5565
|
}
|
|
5687
|
-
processJsx(host, jsx2) {
|
|
5688
|
-
const styleScopedId = this.getHostProp(host, QScopedStyle);
|
|
5689
|
-
return vnode_diff(this, jsx2, host, addComponentStylePrefix(styleScopedId));
|
|
5690
|
-
}
|
|
5691
5566
|
handleError(err, host) {
|
|
5692
5567
|
if (qDev) {
|
|
5693
5568
|
if (typeof document !== "undefined") {
|
|
@@ -5784,12 +5659,12 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5784
5659
|
}
|
|
5785
5660
|
processChores() {
|
|
5786
5661
|
let renderCount = this.$renderCount$;
|
|
5787
|
-
const result = this.$scheduler$(
|
|
5662
|
+
const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5788
5663
|
if (isPromise(result)) {
|
|
5789
5664
|
return result.then(async () => {
|
|
5790
5665
|
while (renderCount !== this.$renderCount$) {
|
|
5791
5666
|
renderCount = this.$renderCount$;
|
|
5792
|
-
await this.$scheduler$(
|
|
5667
|
+
await this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
5793
5668
|
}
|
|
5794
5669
|
this.renderDone = null;
|
|
5795
5670
|
});
|
|
@@ -5947,7 +5822,9 @@ var inflate = (container, target, typeId, data) => {
|
|
|
5947
5822
|
if (valType === 0 /* RootRef */ || valType >= 12 /* Error */) {
|
|
5948
5823
|
Object.defineProperty(target, key, {
|
|
5949
5824
|
get() {
|
|
5950
|
-
|
|
5825
|
+
const value = deserializeData(container, valType, valData);
|
|
5826
|
+
target[key] = value;
|
|
5827
|
+
return value;
|
|
5951
5828
|
},
|
|
5952
5829
|
set(value) {
|
|
5953
5830
|
Object.defineProperty(target, key, {
|
|
@@ -6022,7 +5899,8 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6022
5899
|
signal.$args$ = d[1];
|
|
6023
5900
|
signal.$effectDependencies$ = d[2];
|
|
6024
5901
|
signal.$untrackedValue$ = d[3];
|
|
6025
|
-
signal.$
|
|
5902
|
+
signal.$hostElement$ = d[4];
|
|
5903
|
+
signal.$effects$ = d.slice(5);
|
|
6026
5904
|
break;
|
|
6027
5905
|
}
|
|
6028
5906
|
case 24 /* ComputedSignal */: {
|
|
@@ -6118,11 +5996,12 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6118
5996
|
break;
|
|
6119
5997
|
case 30 /* EffectData */: {
|
|
6120
5998
|
const effectData = target;
|
|
6121
|
-
effectData.data = data[0];
|
|
5999
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0];
|
|
6000
|
+
effectData.data.$isConst$ = data[1];
|
|
6122
6001
|
break;
|
|
6123
6002
|
}
|
|
6124
6003
|
default:
|
|
6125
|
-
|
|
6004
|
+
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6126
6005
|
}
|
|
6127
6006
|
};
|
|
6128
6007
|
var _constants = [
|
|
@@ -6131,7 +6010,7 @@ var _constants = [
|
|
|
6131
6010
|
true,
|
|
6132
6011
|
false,
|
|
6133
6012
|
"",
|
|
6134
|
-
|
|
6013
|
+
EMPTY_ARRAY,
|
|
6135
6014
|
EMPTY_OBJ,
|
|
6136
6015
|
NEEDS_COMPUTATION,
|
|
6137
6016
|
Slot,
|
|
@@ -6235,12 +6114,12 @@ var allocate = (container, typeId, value) => {
|
|
|
6235
6114
|
if (vnode_isVNode(vNode)) {
|
|
6236
6115
|
return vnode_getNode(vNode);
|
|
6237
6116
|
} else {
|
|
6238
|
-
|
|
6117
|
+
throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
|
|
6239
6118
|
}
|
|
6240
6119
|
case 30 /* EffectData */:
|
|
6241
|
-
return new
|
|
6120
|
+
return new EffectPropData({});
|
|
6242
6121
|
default:
|
|
6243
|
-
|
|
6122
|
+
throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
|
|
6244
6123
|
}
|
|
6245
6124
|
};
|
|
6246
6125
|
function retrieveVNodeOrDocument(container, value) {
|
|
@@ -6269,6 +6148,7 @@ function inflateQRL(container, qrl) {
|
|
|
6269
6148
|
}
|
|
6270
6149
|
return qrl;
|
|
6271
6150
|
}
|
|
6151
|
+
var isDomRef = (obj) => false;
|
|
6272
6152
|
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
6273
6153
|
if (!writer) {
|
|
6274
6154
|
const buffer = [];
|
|
@@ -6293,7 +6173,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6293
6173
|
return id;
|
|
6294
6174
|
};
|
|
6295
6175
|
const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
6296
|
-
|
|
6176
|
+
isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
6297
6177
|
return {
|
|
6298
6178
|
$serialize$() {
|
|
6299
6179
|
serialize(this);
|
|
@@ -6312,7 +6192,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6312
6192
|
$getRootId$: (obj) => {
|
|
6313
6193
|
const id = map.get(obj);
|
|
6314
6194
|
if (!id || id === -1) {
|
|
6315
|
-
|
|
6195
|
+
throw qError(36 /* serializeErrorMissingRootId */, [obj]);
|
|
6316
6196
|
}
|
|
6317
6197
|
return id;
|
|
6318
6198
|
},
|
|
@@ -6401,16 +6281,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6401
6281
|
if (obj.$args$) {
|
|
6402
6282
|
discoveredValues.push(...obj.$args$);
|
|
6403
6283
|
}
|
|
6284
|
+
if (obj.$hostElement$) {
|
|
6285
|
+
discoveredValues.push(obj.$hostElement$);
|
|
6286
|
+
}
|
|
6404
6287
|
} else if (obj instanceof ComputedSignal) {
|
|
6405
6288
|
discoveredValues.push(obj.$computeQrl$);
|
|
6406
6289
|
}
|
|
6407
6290
|
} else if (obj instanceof Task) {
|
|
6408
6291
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6409
6292
|
} else if (isSsrNode(obj)) {
|
|
6410
|
-
|
|
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
|
+
}
|
|
6411
6299
|
} else if (isDomRef(obj)) {
|
|
6412
|
-
discoveredValues.push(obj
|
|
6413
|
-
} else if (
|
|
6300
|
+
discoveredValues.push(obj.$ssrNode$.id);
|
|
6301
|
+
} else if (isJSXNode(obj)) {
|
|
6414
6302
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6415
6303
|
} else if (Array.isArray(obj)) {
|
|
6416
6304
|
discoveredValues.push(...obj);
|
|
@@ -6430,14 +6318,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6430
6318
|
}
|
|
6431
6319
|
);
|
|
6432
6320
|
promises.push(obj);
|
|
6433
|
-
} else if (obj instanceof
|
|
6321
|
+
} else if (obj instanceof EffectPropData) {
|
|
6434
6322
|
discoveredValues.push(obj.data);
|
|
6435
6323
|
} else if (isObjectLiteral(obj)) {
|
|
6436
6324
|
Object.entries(obj).forEach(([key, value]) => {
|
|
6437
6325
|
discoveredValues.push(key, value);
|
|
6438
6326
|
});
|
|
6439
6327
|
} else {
|
|
6440
|
-
|
|
6328
|
+
throw qError(37 /* serializeErrorUnknownType */, [obj]);
|
|
6441
6329
|
}
|
|
6442
6330
|
};
|
|
6443
6331
|
for (const root of roots) {
|
|
@@ -6457,9 +6345,23 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
6457
6345
|
$addRoot$(obj);
|
|
6458
6346
|
}
|
|
6459
6347
|
}
|
|
6460
|
-
await Promise.allSettled(promises);
|
|
6461
|
-
promises.length = 0;
|
|
6462
|
-
} 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
|
+
}
|
|
6463
6365
|
}
|
|
6464
6366
|
};
|
|
6465
6367
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
@@ -6543,7 +6445,7 @@ function serialize(serializationContext) {
|
|
|
6543
6445
|
output(2 /* Number */, value);
|
|
6544
6446
|
}
|
|
6545
6447
|
} else if (typeof value === "object") {
|
|
6546
|
-
if (value ===
|
|
6448
|
+
if (value === EMPTY_ARRAY) {
|
|
6547
6449
|
output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
6548
6450
|
} else if (value === EMPTY_OBJ) {
|
|
6549
6451
|
output(1 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
@@ -6572,7 +6474,7 @@ function serialize(serializationContext) {
|
|
|
6572
6474
|
} else if (value === NEEDS_COMPUTATION) {
|
|
6573
6475
|
output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
6574
6476
|
} else {
|
|
6575
|
-
|
|
6477
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6576
6478
|
}
|
|
6577
6479
|
};
|
|
6578
6480
|
const writeObjectValue = (value, idx) => {
|
|
@@ -6589,14 +6491,14 @@ function serialize(serializationContext) {
|
|
|
6589
6491
|
const constProps = value[_CONST_PROPS];
|
|
6590
6492
|
const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
|
|
6591
6493
|
output(29 /* PropsProxy */, out);
|
|
6592
|
-
} else if (value instanceof
|
|
6593
|
-
output(30 /* EffectData */, [value.data]);
|
|
6494
|
+
} else if (value instanceof EffectPropData) {
|
|
6495
|
+
output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
|
|
6594
6496
|
} else if (isStore(value)) {
|
|
6595
6497
|
if (isResource(value)) {
|
|
6596
6498
|
serializationContext.$resources$.add(value);
|
|
6597
6499
|
const res = promiseResults.get(value.value);
|
|
6598
6500
|
if (!res) {
|
|
6599
|
-
|
|
6501
|
+
throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
|
|
6600
6502
|
}
|
|
6601
6503
|
output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
|
|
6602
6504
|
} else {
|
|
@@ -6633,7 +6535,8 @@ function serialize(serializationContext) {
|
|
|
6633
6535
|
output(13 /* Object */, out);
|
|
6634
6536
|
}
|
|
6635
6537
|
} else if ($isDomRef$(value)) {
|
|
6636
|
-
|
|
6538
|
+
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
6539
|
+
output(9 /* RefVNode */, value.$ssrNode$.id);
|
|
6637
6540
|
} else if (value instanceof Signal) {
|
|
6638
6541
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
6639
6542
|
if (value instanceof WrappedSignal) {
|
|
@@ -6641,6 +6544,7 @@ function serialize(serializationContext) {
|
|
|
6641
6544
|
...serializeWrappingFn(serializationContext, value),
|
|
6642
6545
|
value.$effectDependencies$,
|
|
6643
6546
|
v,
|
|
6547
|
+
value.$hostElement$,
|
|
6644
6548
|
...value.$effects$ || []
|
|
6645
6549
|
]);
|
|
6646
6550
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -6679,11 +6583,11 @@ function serialize(serializationContext) {
|
|
|
6679
6583
|
const vNodeData = value.vnodeData;
|
|
6680
6584
|
if (vNodeData) {
|
|
6681
6585
|
serializationContext.$prepVNodeData$?.(vNodeData);
|
|
6682
|
-
vNodeData[0] |=
|
|
6586
|
+
vNodeData[0] |= 16 /* SERIALIZE */;
|
|
6683
6587
|
}
|
|
6684
6588
|
if (value.childrenVNodeData) {
|
|
6685
6589
|
for (const vNodeData2 of value.childrenVNodeData) {
|
|
6686
|
-
vNodeData2[0] |=
|
|
6590
|
+
vNodeData2[0] |= 16 /* SERIALIZE */;
|
|
6687
6591
|
}
|
|
6688
6592
|
}
|
|
6689
6593
|
} else {
|
|
@@ -6710,7 +6614,7 @@ function serialize(serializationContext) {
|
|
|
6710
6614
|
combined.push(k, v);
|
|
6711
6615
|
}
|
|
6712
6616
|
output(16 /* Map */, combined);
|
|
6713
|
-
} else if (
|
|
6617
|
+
} else if (isJSXNode(value)) {
|
|
6714
6618
|
output(28 /* JSXNode */, [
|
|
6715
6619
|
value.type,
|
|
6716
6620
|
value.varProps,
|
|
@@ -6735,7 +6639,7 @@ function serialize(serializationContext) {
|
|
|
6735
6639
|
} else if (isPromise(value)) {
|
|
6736
6640
|
const res = promiseResults.get(value);
|
|
6737
6641
|
if (!res) {
|
|
6738
|
-
|
|
6642
|
+
throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
|
|
6739
6643
|
}
|
|
6740
6644
|
output(14 /* Promise */, res);
|
|
6741
6645
|
} else if (value instanceof Uint8Array) {
|
|
@@ -6746,7 +6650,7 @@ function serialize(serializationContext) {
|
|
|
6746
6650
|
const out = btoa(buf).replace(/=+$/, "");
|
|
6747
6651
|
output(17 /* Uint8Array */, out);
|
|
6748
6652
|
} else {
|
|
6749
|
-
|
|
6653
|
+
throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
|
|
6750
6654
|
}
|
|
6751
6655
|
};
|
|
6752
6656
|
writeValue(serializationContext.$roots$, -1);
|
|
@@ -6792,7 +6696,7 @@ function qrlToString(serializationContext, value) {
|
|
|
6792
6696
|
}
|
|
6793
6697
|
}
|
|
6794
6698
|
if (!chunk) {
|
|
6795
|
-
|
|
6699
|
+
throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
|
|
6796
6700
|
}
|
|
6797
6701
|
if (chunk.startsWith("./")) {
|
|
6798
6702
|
chunk = chunk.slice(2);
|
|
@@ -6847,7 +6751,7 @@ function isResource(value) {
|
|
|
6847
6751
|
return "__brand" in value && value.__brand === "resource";
|
|
6848
6752
|
}
|
|
6849
6753
|
var frameworkType = (obj) => {
|
|
6850
|
-
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);
|
|
6851
6755
|
};
|
|
6852
6756
|
var canSerialize = (value) => {
|
|
6853
6757
|
if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
@@ -6877,7 +6781,7 @@ var canSerialize = (value) => {
|
|
|
6877
6781
|
return true;
|
|
6878
6782
|
} else if (isPromise(value)) {
|
|
6879
6783
|
return true;
|
|
6880
|
-
} else if (
|
|
6784
|
+
} else if (isJSXNode(value)) {
|
|
6881
6785
|
return true;
|
|
6882
6786
|
} else if (value instanceof Error) {
|
|
6883
6787
|
return true;
|
|
@@ -6897,6 +6801,8 @@ var canSerialize = (value) => {
|
|
|
6897
6801
|
return true;
|
|
6898
6802
|
} else if (value instanceof Uint8Array) {
|
|
6899
6803
|
return true;
|
|
6804
|
+
} else if (isDomRef?.(value)) {
|
|
6805
|
+
return true;
|
|
6900
6806
|
}
|
|
6901
6807
|
} else if (typeof value === "function") {
|
|
6902
6808
|
if (isQrl2(value) || isQwikComponent(value)) {
|
|
@@ -6941,7 +6847,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
|
6941
6847
|
let expectIndex = 0;
|
|
6942
6848
|
unwrapped.forEach((v, i) => {
|
|
6943
6849
|
if (i !== expectIndex) {
|
|
6944
|
-
throw qError(
|
|
6850
|
+
throw qError(3 /* verifySerializable */, [unwrapped]);
|
|
6945
6851
|
}
|
|
6946
6852
|
_verifySerializable(v, seen, ctx + "[" + i + "]");
|
|
6947
6853
|
expectIndex = i + 1;
|
|
@@ -6981,8 +6887,7 @@ const ${fnName} = $(${String(
|
|
|
6981
6887
|
|
|
6982
6888
|
Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
|
|
6983
6889
|
}
|
|
6984
|
-
|
|
6985
|
-
throwErrorAndStop(message);
|
|
6890
|
+
throw qError(3 /* verifySerializable */, [message]);
|
|
6986
6891
|
}
|
|
6987
6892
|
return value;
|
|
6988
6893
|
};
|
|
@@ -7034,7 +6939,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7034
6939
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
7035
6940
|
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
7036
6941
|
if (!isFunction(fn)) {
|
|
7037
|
-
throw qError(
|
|
6942
|
+
throw qError(10 /* qrlIsNotFunction */);
|
|
7038
6943
|
}
|
|
7039
6944
|
if (beforeFn && beforeFn() === false) {
|
|
7040
6945
|
return;
|
|
@@ -7135,7 +7040,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7135
7040
|
if (symbolRef) {
|
|
7136
7041
|
symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
|
|
7137
7042
|
}
|
|
7138
|
-
if (
|
|
7043
|
+
if (isDev7) {
|
|
7139
7044
|
Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
7140
7045
|
get() {
|
|
7141
7046
|
return symbolRef;
|
|
@@ -7226,7 +7131,7 @@ var stringifyStyle = (obj) => {
|
|
|
7226
7131
|
}
|
|
7227
7132
|
if (typeof obj == "object") {
|
|
7228
7133
|
if (isArray(obj)) {
|
|
7229
|
-
throw qError(
|
|
7134
|
+
throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
|
|
7230
7135
|
} else {
|
|
7231
7136
|
const chunks = [];
|
|
7232
7137
|
for (const key in obj) {
|
|
@@ -7290,12 +7195,12 @@ function getValidManifest(manifest) {
|
|
|
7290
7195
|
|
|
7291
7196
|
// packages/qwik/src/server/ssr-container.ts
|
|
7292
7197
|
import {
|
|
7198
|
+
_EffectData as EffectData,
|
|
7293
7199
|
_SharedContainer as _SharedContainer2,
|
|
7294
7200
|
_jsxSorted as _jsxSorted3,
|
|
7295
7201
|
_jsxSplit as _jsxSplit2,
|
|
7296
7202
|
_walkJSX as _walkJSX2,
|
|
7297
|
-
isSignal as isSignal2
|
|
7298
|
-
_EffectData as EffectData2
|
|
7203
|
+
isSignal as isSignal2
|
|
7299
7204
|
} from "@qwik.dev/core";
|
|
7300
7205
|
import { isDev as isDev9 } from "@qwik.dev/core/build";
|
|
7301
7206
|
|
|
@@ -7472,6 +7377,165 @@ var PrefetchImplementationDefault = {
|
|
|
7472
7377
|
prefetchEvent: "always"
|
|
7473
7378
|
};
|
|
7474
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
|
+
|
|
7475
7539
|
// packages/qwik/src/server/tag-nesting.ts
|
|
7476
7540
|
var allowedContent = (state) => {
|
|
7477
7541
|
switch (state) {
|
|
@@ -7742,6 +7806,110 @@ function isInPhrasing(text, allowInput) {
|
|
|
7742
7806
|
}
|
|
7743
7807
|
}
|
|
7744
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
|
+
|
|
7745
7913
|
// packages/qwik/src/server/ssr-container.ts
|
|
7746
7914
|
function ssrCreateContainer(opts) {
|
|
7747
7915
|
opts.renderOptions || (opts.renderOptions = {});
|
|
@@ -7853,9 +8021,6 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
7853
8021
|
}
|
|
7854
8022
|
ensureProjectionResolved(host) {
|
|
7855
8023
|
}
|
|
7856
|
-
processJsx(host, jsx2) {
|
|
7857
|
-
throw new Error("Should not get here.");
|
|
7858
|
-
}
|
|
7859
8024
|
handleError(err, $host$) {
|
|
7860
8025
|
throw err;
|
|
7861
8026
|
}
|
|
@@ -7944,6 +8109,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
7944
8109
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
7945
8110
|
}
|
|
7946
8111
|
this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
|
|
8112
|
+
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
7947
8113
|
this.write("<");
|
|
7948
8114
|
this.write(elementName);
|
|
7949
8115
|
if (varAttrs) {
|
|
@@ -8029,7 +8195,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8029
8195
|
this.openFragment(attrs);
|
|
8030
8196
|
const vNode = this.currentElementFrame?.vNodeData;
|
|
8031
8197
|
if (vNode) {
|
|
8032
|
-
vNode[0] |=
|
|
8198
|
+
vNode[0] |= 16 /* SERIALIZE */;
|
|
8033
8199
|
}
|
|
8034
8200
|
const componentFrame = this.getComponentFrame();
|
|
8035
8201
|
if (componentFrame) {
|
|
@@ -8192,12 +8358,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8192
8358
|
for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
|
|
8193
8359
|
const vNode = vNodeData[elementIdx];
|
|
8194
8360
|
const flag = vNode[0];
|
|
8195
|
-
if (flag &
|
|
8361
|
+
if (flag & 16 /* SERIALIZE */) {
|
|
8196
8362
|
lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
|
|
8197
|
-
if (flag &
|
|
8363
|
+
if (flag & 8 /* REFERENCE */) {
|
|
8198
8364
|
this.write(VNodeDataSeparator.REFERENCE_CH);
|
|
8199
8365
|
}
|
|
8200
|
-
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
|
|
8366
|
+
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
|
|
8201
8367
|
let fragmentAttrs = null;
|
|
8202
8368
|
let depth = 0;
|
|
8203
8369
|
for (let i = 1; i < vNode.length; i++) {
|
|
@@ -8215,6 +8381,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8215
8381
|
}
|
|
8216
8382
|
depth--;
|
|
8217
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
|
+
}
|
|
8218
8391
|
} else if (value >= 0) {
|
|
8219
8392
|
this.write(encodeAsAlphanumeric(value));
|
|
8220
8393
|
} else {
|
|
@@ -8267,6 +8440,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8267
8440
|
case ELEMENT_SEQ_IDX:
|
|
8268
8441
|
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
8269
8442
|
break;
|
|
8443
|
+
case QSubscribers:
|
|
8444
|
+
write(VNodeDataChar.SUBS_CHAR);
|
|
8445
|
+
break;
|
|
8270
8446
|
// Skipping `\` character for now because it is used for escaping.
|
|
8271
8447
|
case QCtxAttr:
|
|
8272
8448
|
write(VNodeDataChar.CONTEXT_CHAR);
|
|
@@ -8466,7 +8642,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8466
8642
|
);
|
|
8467
8643
|
const lastNode = this.getLastNode();
|
|
8468
8644
|
if (lastNode.vnodeData) {
|
|
8469
|
-
lastNode.vnodeData[0] |=
|
|
8645
|
+
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
8470
8646
|
}
|
|
8471
8647
|
ssrComponentNode?.setProp(value, lastNode.id);
|
|
8472
8648
|
await _walkJSX2(this, children, {
|
|
@@ -8589,7 +8765,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8589
8765
|
let styleScopedId = null;
|
|
8590
8766
|
if (isSSRUnsafeAttr(key)) {
|
|
8591
8767
|
if (isDev9) {
|
|
8592
|
-
throw
|
|
8768
|
+
throw qError(51 /* unsafeAttr */);
|
|
8593
8769
|
}
|
|
8594
8770
|
continue;
|
|
8595
8771
|
}
|
|
@@ -8601,16 +8777,18 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8601
8777
|
if (key === "ref") {
|
|
8602
8778
|
const lastNode = this.getLastNode();
|
|
8603
8779
|
if (isSignal2(value)) {
|
|
8604
|
-
value.value = new DomRef(lastNode
|
|
8780
|
+
value.value = new DomRef(lastNode);
|
|
8605
8781
|
continue;
|
|
8606
8782
|
} else if (typeof value === "function") {
|
|
8607
|
-
value(new DomRef(lastNode
|
|
8783
|
+
value(new DomRef(lastNode));
|
|
8608
8784
|
continue;
|
|
8785
|
+
} else {
|
|
8786
|
+
throw qError(32 /* invalidRefValue */);
|
|
8609
8787
|
}
|
|
8610
8788
|
}
|
|
8611
8789
|
if (isSignal2(value)) {
|
|
8612
8790
|
const lastNode = this.getLastNode();
|
|
8613
|
-
const signalData = new
|
|
8791
|
+
const signalData = new EffectData({
|
|
8614
8792
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
8615
8793
|
$isConst$: isConst
|
|
8616
8794
|
});
|
|
@@ -8627,7 +8805,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8627
8805
|
if (tag === "textarea" && key === "value") {
|
|
8628
8806
|
if (typeof value !== "string") {
|
|
8629
8807
|
if (isDev9) {
|
|
8630
|
-
throw
|
|
8808
|
+
throw qError(40 /* wrongTextareaValue */);
|
|
8631
8809
|
}
|
|
8632
8810
|
continue;
|
|
8633
8811
|
}
|
|
@@ -8663,7 +8841,7 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
8663
8841
|
return false;
|
|
8664
8842
|
};
|
|
8665
8843
|
function newTagError(text) {
|
|
8666
|
-
return
|
|
8844
|
+
return qError(29 /* tagError */, [text]);
|
|
8667
8845
|
}
|
|
8668
8846
|
function hasDestroy(obj) {
|
|
8669
8847
|
return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
|
|
@@ -8877,18 +9055,6 @@ function resolveManifest(manifest) {
|
|
|
8877
9055
|
}
|
|
8878
9056
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8879
9057
|
|
|
8880
|
-
// packages/qwik/src/server/scripts.ts
|
|
8881
|
-
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)})()';
|
|
8882
|
-
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})()';
|
|
8883
|
-
function getQwikLoaderScript(opts = {}) {
|
|
8884
|
-
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8885
|
-
}
|
|
8886
|
-
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
8887
|
-
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
8888
|
-
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
8889
|
-
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
8890
|
-
}
|
|
8891
|
-
|
|
8892
9058
|
// packages/qwik/src/server/index.ts
|
|
8893
9059
|
async function setServerPlatform2(manifest) {
|
|
8894
9060
|
const platform = createPlatform({ manifest }, resolveManifest(manifest));
|