@qwik.dev/core 2.0.0-alpha.4 → 2.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +2 -23
- package/dist/core-internal.d.ts +3 -3
- package/dist/core.cjs +446 -278
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +446 -278
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +406 -308
- package/dist/core.prod.mjs +493 -386
- package/dist/insights/index.qwik.cjs +8 -8
- package/dist/insights/index.qwik.mjs +8 -8
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +306 -189
- package/dist/optimizer.mjs +362 -239
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +396 -254
- package/dist/server.mjs +395 -253
- package/dist/starters/features/turso/src/utils/turso.ts +1 -1
- package/dist/testing/index.cjs +394 -252
- package/dist/testing/index.mjs +393 -251
- package/dist/testing/package.json +1 -1
- package/package.json +3 -3
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.6-dev+d848ba5
|
|
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
|
|
@@ -201,7 +201,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
201
201
|
// 30
|
|
202
202
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
203
203
|
// 31
|
|
204
|
-
"
|
|
204
|
+
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
205
205
|
// 32
|
|
206
206
|
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
207
207
|
// 33
|
|
@@ -217,7 +217,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
217
217
|
// 38
|
|
218
218
|
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
219
219
|
// 39
|
|
220
|
-
"
|
|
220
|
+
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
221
221
|
// 40
|
|
222
222
|
"Unable to find q:container",
|
|
223
223
|
// 41
|
|
@@ -227,8 +227,6 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
227
227
|
// 43
|
|
228
228
|
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
229
229
|
// 44
|
|
230
|
-
"SsrError: {{0}}",
|
|
231
|
-
// 45
|
|
232
230
|
"Cannot coerce a Signal, use `.value` instead",
|
|
233
231
|
// 46
|
|
234
232
|
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
|
|
@@ -485,6 +483,106 @@ function assertNumber(value1, text, ...parts) {
|
|
|
485
483
|
|
|
486
484
|
// packages/qwik/src/core/shared/platform/platform.ts
|
|
487
485
|
import { isServer } from "@qwik.dev/core/build";
|
|
486
|
+
|
|
487
|
+
// packages/qwik/src/core/shared/types.ts
|
|
488
|
+
var DEBUG_TYPE = "q:type";
|
|
489
|
+
var START = "\x1B[34m";
|
|
490
|
+
var END = "\x1B[0m";
|
|
491
|
+
var VirtualTypeName = {
|
|
492
|
+
["V" /* Virtual */]: (
|
|
493
|
+
/* ********* */
|
|
494
|
+
START + "Virtual" + END
|
|
495
|
+
),
|
|
496
|
+
//
|
|
497
|
+
["F" /* Fragment */]: (
|
|
498
|
+
/* ******** */
|
|
499
|
+
START + "Fragment" + END
|
|
500
|
+
),
|
|
501
|
+
//
|
|
502
|
+
["S" /* WrappedSignal */]: (
|
|
503
|
+
/* *** */
|
|
504
|
+
START + "Signal" + END
|
|
505
|
+
),
|
|
506
|
+
//
|
|
507
|
+
["A" /* Awaited */]: (
|
|
508
|
+
/* ********* */
|
|
509
|
+
START + "Awaited" + END
|
|
510
|
+
),
|
|
511
|
+
//
|
|
512
|
+
["C" /* Component */]: (
|
|
513
|
+
/* ******* */
|
|
514
|
+
START + "Component" + END
|
|
515
|
+
),
|
|
516
|
+
//
|
|
517
|
+
["I" /* InlineComponent */]: (
|
|
518
|
+
/* * */
|
|
519
|
+
START + "InlineComponent" + END
|
|
520
|
+
),
|
|
521
|
+
//
|
|
522
|
+
["P" /* Projection */]: (
|
|
523
|
+
/* ****** */
|
|
524
|
+
START + "Projection" + END
|
|
525
|
+
)
|
|
526
|
+
//
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// packages/qwik/src/core/shared/utils/markers.ts
|
|
530
|
+
var OnRenderProp = "q:renderFn";
|
|
531
|
+
var ComponentStylesPrefixContent = "\u2B50\uFE0F";
|
|
532
|
+
var QSlot = "q:slot";
|
|
533
|
+
var QSlotParent = ":";
|
|
534
|
+
var QSlotRef = "q:sref";
|
|
535
|
+
var QSlotS = "q:s";
|
|
536
|
+
var QStyle = "q:style";
|
|
537
|
+
var QStyleSelector = "style[q\\:style]";
|
|
538
|
+
var QStyleSSelector = "style[q\\:sstyle]";
|
|
539
|
+
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
|
|
540
|
+
var QScopedStyle = "q:sstyle";
|
|
541
|
+
var QCtxAttr = "q:ctx";
|
|
542
|
+
var QSubscribers = "q:subs";
|
|
543
|
+
var QFuncsPrefix = "qFuncs_";
|
|
544
|
+
var getQFuncs = (document2, hash2) => {
|
|
545
|
+
return document2[QFuncsPrefix + hash2] || [];
|
|
546
|
+
};
|
|
547
|
+
var QRenderAttr = "q:render";
|
|
548
|
+
var QRuntimeAttr = "q:runtime";
|
|
549
|
+
var QVersionAttr = "q:version";
|
|
550
|
+
var QBaseAttr = "q:base";
|
|
551
|
+
var QLocaleAttr = "q:locale";
|
|
552
|
+
var QManifestHashAttr = "q:manifest-hash";
|
|
553
|
+
var QInstanceAttr = "q:instance";
|
|
554
|
+
var QContainerIsland = "q:container-island";
|
|
555
|
+
var QContainerIslandEnd = "/" + QContainerIsland;
|
|
556
|
+
var QIgnore = "q:ignore";
|
|
557
|
+
var QIgnoreEnd = "/" + QIgnore;
|
|
558
|
+
var QContainerAttr = "q:container";
|
|
559
|
+
var QContainerAttrEnd = "/" + QContainerAttr;
|
|
560
|
+
var QTemplate = "q:template";
|
|
561
|
+
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
562
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
563
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
564
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
565
|
+
var ResourceEvent = "qResource";
|
|
566
|
+
var RenderEvent = "qRender";
|
|
567
|
+
var TaskEvent = "qTask";
|
|
568
|
+
var QDefaultSlot = "";
|
|
569
|
+
var ELEMENT_ID = "q:id";
|
|
570
|
+
var ELEMENT_KEY = "q:key";
|
|
571
|
+
var ELEMENT_PROPS = "q:props";
|
|
572
|
+
var ELEMENT_SEQ = "q:seq";
|
|
573
|
+
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
574
|
+
var Q_PREFIX = "q:";
|
|
575
|
+
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
576
|
+
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
577
|
+
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
578
|
+
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
579
|
+
var FLUSH_COMMENT = "qkssr-f";
|
|
580
|
+
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
|
|
581
|
+
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
|
|
582
|
+
var Q_PROPS_SEPARATOR = ":";
|
|
583
|
+
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
584
|
+
|
|
585
|
+
// packages/qwik/src/core/shared/platform/platform.ts
|
|
488
586
|
var createPlatform2 = () => {
|
|
489
587
|
return {
|
|
490
588
|
isServer,
|
|
@@ -534,7 +632,7 @@ var createPlatform2 = () => {
|
|
|
534
632
|
};
|
|
535
633
|
var toUrl = (doc, containerEl, url) => {
|
|
536
634
|
const baseURI = doc.baseURI;
|
|
537
|
-
const base = new URL(containerEl.getAttribute(
|
|
635
|
+
const base = new URL(containerEl.getAttribute(QBaseAttr) ?? baseURI, baseURI);
|
|
538
636
|
return new URL(url, base);
|
|
539
637
|
};
|
|
540
638
|
var _platform = /* @__PURE__ */ createPlatform2();
|
|
@@ -585,117 +683,26 @@ var delay = (timeout) => {
|
|
|
585
683
|
});
|
|
586
684
|
};
|
|
587
685
|
function retryOnPromise(fn, retryCount = 0) {
|
|
588
|
-
|
|
589
|
-
return fn();
|
|
590
|
-
} catch (e) {
|
|
686
|
+
const retryOrThrow = (e) => {
|
|
591
687
|
if (isPromise(e) && retryCount < MAX_RETRY_ON_PROMISE_COUNT) {
|
|
592
688
|
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
593
689
|
}
|
|
594
690
|
throw e;
|
|
691
|
+
};
|
|
692
|
+
try {
|
|
693
|
+
const result = fn();
|
|
694
|
+
if (isPromise(result)) {
|
|
695
|
+
return result.catch((e) => retryOrThrow(e));
|
|
696
|
+
}
|
|
697
|
+
return result;
|
|
698
|
+
} catch (e) {
|
|
699
|
+
return retryOrThrow(e);
|
|
595
700
|
}
|
|
596
701
|
}
|
|
597
702
|
|
|
598
703
|
// packages/qwik/src/build/index.dev.ts
|
|
599
704
|
var isDev = true;
|
|
600
705
|
|
|
601
|
-
// packages/qwik/src/core/shared/types.ts
|
|
602
|
-
var DEBUG_TYPE = "q:type";
|
|
603
|
-
var START = "\x1B[34m";
|
|
604
|
-
var END = "\x1B[0m";
|
|
605
|
-
var VirtualTypeName = {
|
|
606
|
-
["V" /* Virtual */]: (
|
|
607
|
-
/* ********* */
|
|
608
|
-
START + "Virtual" + END
|
|
609
|
-
),
|
|
610
|
-
//
|
|
611
|
-
["F" /* Fragment */]: (
|
|
612
|
-
/* ******** */
|
|
613
|
-
START + "Fragment" + END
|
|
614
|
-
),
|
|
615
|
-
//
|
|
616
|
-
["S" /* WrappedSignal */]: (
|
|
617
|
-
/* *** */
|
|
618
|
-
START + "Signal" + END
|
|
619
|
-
),
|
|
620
|
-
//
|
|
621
|
-
["A" /* Awaited */]: (
|
|
622
|
-
/* ********* */
|
|
623
|
-
START + "Awaited" + END
|
|
624
|
-
),
|
|
625
|
-
//
|
|
626
|
-
["C" /* Component */]: (
|
|
627
|
-
/* ******* */
|
|
628
|
-
START + "Component" + END
|
|
629
|
-
),
|
|
630
|
-
//
|
|
631
|
-
["I" /* InlineComponent */]: (
|
|
632
|
-
/* * */
|
|
633
|
-
START + "InlineComponent" + END
|
|
634
|
-
),
|
|
635
|
-
//
|
|
636
|
-
["P" /* Projection */]: (
|
|
637
|
-
/* ****** */
|
|
638
|
-
START + "Projection" + END
|
|
639
|
-
)
|
|
640
|
-
//
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
// packages/qwik/src/core/shared/utils/markers.ts
|
|
644
|
-
var OnRenderProp = "q:renderFn";
|
|
645
|
-
var ComponentStylesPrefixContent = "\u2B50\uFE0F";
|
|
646
|
-
var QSlot = "q:slot";
|
|
647
|
-
var QSlotParent = ":";
|
|
648
|
-
var QSlotRef = "q:sref";
|
|
649
|
-
var QSlotS = "q:s";
|
|
650
|
-
var QStyle = "q:style";
|
|
651
|
-
var QStyleSelector = "style[q\\:style]";
|
|
652
|
-
var QStyleSSelector = "style[q\\:sstyle]";
|
|
653
|
-
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
|
|
654
|
-
var QScopedStyle = "q:sstyle";
|
|
655
|
-
var QCtxAttr = "q:ctx";
|
|
656
|
-
var QSubscribers = "q:subs";
|
|
657
|
-
var QFuncsPrefix = "qFuncs_";
|
|
658
|
-
var getQFuncs = (document2, hash2) => {
|
|
659
|
-
return document2[QFuncsPrefix + hash2] || [];
|
|
660
|
-
};
|
|
661
|
-
var QRenderAttr = "q:render";
|
|
662
|
-
var QRuntimeAttr = "q:runtime";
|
|
663
|
-
var QVersionAttr = "q:version";
|
|
664
|
-
var QBaseAttr = "q:base";
|
|
665
|
-
var QLocaleAttr = "q:locale";
|
|
666
|
-
var QManifestHashAttr = "q:manifest-hash";
|
|
667
|
-
var QInstanceAttr = "q:instance";
|
|
668
|
-
var QContainerIsland = "q:container-island";
|
|
669
|
-
var QContainerIslandEnd = "/" + QContainerIsland;
|
|
670
|
-
var QIgnore = "q:ignore";
|
|
671
|
-
var QIgnoreEnd = "/" + QIgnore;
|
|
672
|
-
var QContainerAttr = "q:container";
|
|
673
|
-
var QContainerAttrEnd = "/" + QContainerAttr;
|
|
674
|
-
var QTemplate = "q:template";
|
|
675
|
-
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
676
|
-
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
677
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
678
|
-
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
679
|
-
var ResourceEvent = "qResource";
|
|
680
|
-
var RenderEvent = "qRender";
|
|
681
|
-
var TaskEvent = "qTask";
|
|
682
|
-
var QDefaultSlot = "";
|
|
683
|
-
var ELEMENT_ID = "q:id";
|
|
684
|
-
var ELEMENT_KEY = "q:key";
|
|
685
|
-
var ELEMENT_PROPS = "q:props";
|
|
686
|
-
var ELEMENT_SEQ = "q:seq";
|
|
687
|
-
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
688
|
-
var Q_PREFIX = "q:";
|
|
689
|
-
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
690
|
-
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
691
|
-
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
692
|
-
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
693
|
-
var FLUSH_COMMENT = "qkssr-f";
|
|
694
|
-
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
|
|
695
|
-
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
|
|
696
|
-
var Q_PROPS_SEPARATOR = ":";
|
|
697
|
-
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
698
|
-
|
|
699
706
|
// packages/qwik/src/core/use/use-locale.ts
|
|
700
707
|
var _locale = void 0;
|
|
701
708
|
function setLocale(locale) {
|
|
@@ -731,7 +738,7 @@ function getBuildBase(opts) {
|
|
|
731
738
|
return `${import.meta.env.BASE_URL}build/`;
|
|
732
739
|
}
|
|
733
740
|
var versions = {
|
|
734
|
-
qwik: "2.0.0-alpha.
|
|
741
|
+
qwik: "2.0.0-alpha.6-dev+d848ba5",
|
|
735
742
|
qwikDom: "2.1.19"
|
|
736
743
|
};
|
|
737
744
|
|
|
@@ -897,7 +904,6 @@ var StoreHandler = class {
|
|
|
897
904
|
}
|
|
898
905
|
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
899
906
|
set(target, prop, value) {
|
|
900
|
-
target = unwrapDeserializerProxy(target);
|
|
901
907
|
if (typeof prop === "symbol") {
|
|
902
908
|
target[prop] = value;
|
|
903
909
|
return true;
|
|
@@ -965,6 +971,11 @@ function addEffect(target, prop, store, effectSubscriber) {
|
|
|
965
971
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
966
972
|
ensureContainsEffect(effects, effectSubscriber);
|
|
967
973
|
ensureContains(effectSubscriber, target);
|
|
974
|
+
ensureEffectContainsSubscriber(
|
|
975
|
+
effectSubscriber[0 /* EFFECT */],
|
|
976
|
+
target,
|
|
977
|
+
store.$container$
|
|
978
|
+
);
|
|
968
979
|
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
969
980
|
}
|
|
970
981
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -1004,32 +1015,39 @@ function clearVNodeEffectDependencies(container, value) {
|
|
|
1004
1015
|
}
|
|
1005
1016
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1006
1017
|
const subscriber = effects[i];
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1018
|
+
clearEffects(subscriber, value, effects, i, container);
|
|
1019
|
+
}
|
|
1020
|
+
if (effects.length === 0) {
|
|
1021
|
+
vnode_setProp(value, QSubscribers, null);
|
|
1011
1022
|
}
|
|
1012
1023
|
}
|
|
1013
|
-
function clearSubscriberEffectDependencies(value) {
|
|
1024
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
1014
1025
|
if (value.$effectDependencies$) {
|
|
1015
1026
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
1016
1027
|
const subscriber = value.$effectDependencies$[i];
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1028
|
+
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
1029
|
+
}
|
|
1030
|
+
if (value.$effectDependencies$.length === 0) {
|
|
1031
|
+
value.$effectDependencies$ = null;
|
|
1021
1032
|
}
|
|
1022
1033
|
}
|
|
1023
1034
|
}
|
|
1024
|
-
function clearEffects(subscriber, value) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1035
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
1036
|
+
let subscriptionRemoved = false;
|
|
1037
|
+
const seenSet = /* @__PURE__ */ new Set();
|
|
1038
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1039
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
1040
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
1041
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
1042
|
+
const handler = getStoreHandler(store);
|
|
1043
|
+
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
1027
1044
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
if (hostElement && hostElement === value) {
|
|
1031
|
-
subscriber.$hostElement$ = null;
|
|
1045
|
+
if (subscriptionRemoved) {
|
|
1046
|
+
effectArray.splice(indexToRemove, 1);
|
|
1032
1047
|
}
|
|
1048
|
+
}
|
|
1049
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
1050
|
+
const effectSubscriptions = subscriber.$effects$;
|
|
1033
1051
|
let subscriptionRemoved = false;
|
|
1034
1052
|
if (effectSubscriptions) {
|
|
1035
1053
|
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
@@ -1040,14 +1058,76 @@ function clearEffects(subscriber, value) {
|
|
|
1040
1058
|
}
|
|
1041
1059
|
}
|
|
1042
1060
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1061
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1062
|
+
const hostElement = subscriber.$hostElement$;
|
|
1063
|
+
if (hostElement && hostElement === value) {
|
|
1064
|
+
subscriber.$hostElement$ = null;
|
|
1065
|
+
}
|
|
1066
|
+
const args = subscriber.$args$;
|
|
1067
|
+
if (args) {
|
|
1068
|
+
clearArgsEffects(args, subscriber, seenSet);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
return subscriptionRemoved;
|
|
1072
|
+
}
|
|
1073
|
+
function clearStoreEffects(storeHandler, value) {
|
|
1074
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
1075
|
+
if (!effectSubscriptions) {
|
|
1076
|
+
return false;
|
|
1077
|
+
}
|
|
1078
|
+
let subscriptionRemoved = false;
|
|
1079
|
+
for (const key in effectSubscriptions) {
|
|
1080
|
+
const effects = effectSubscriptions[key];
|
|
1081
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1082
|
+
const effect = effects[i];
|
|
1083
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1084
|
+
effects.splice(i, 1);
|
|
1085
|
+
subscriptionRemoved = true;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (effects.length === 0) {
|
|
1089
|
+
delete effectSubscriptions[key];
|
|
1047
1090
|
}
|
|
1048
1091
|
}
|
|
1049
1092
|
return subscriptionRemoved;
|
|
1050
1093
|
}
|
|
1094
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
1095
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1096
|
+
const arg = args[i];
|
|
1097
|
+
clearArgEffect(arg, subscriber, seenSet);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
1101
|
+
if (seenSet.has(arg)) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
seenSet.add(arg);
|
|
1105
|
+
if (isSignal(arg)) {
|
|
1106
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
1107
|
+
} else if (typeof arg === "object" && arg !== null) {
|
|
1108
|
+
if (isStore(arg)) {
|
|
1109
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
1110
|
+
} else if (isPropsProxy(arg)) {
|
|
1111
|
+
const constProps = arg[_CONST_PROPS];
|
|
1112
|
+
const varProps = arg[_VAR_PROPS];
|
|
1113
|
+
if (constProps) {
|
|
1114
|
+
for (const key in constProps) {
|
|
1115
|
+
clearArgEffect(constProps[key], subscriber, seenSet);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
for (const key in varProps) {
|
|
1119
|
+
clearArgEffect(varProps[key], subscriber, seenSet);
|
|
1120
|
+
}
|
|
1121
|
+
} else {
|
|
1122
|
+
for (const key in arg) {
|
|
1123
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
} else if (Array.isArray(arg)) {
|
|
1127
|
+
clearArgsEffects(arg, subscriber, seenSet);
|
|
1128
|
+
} else {
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1051
1131
|
|
|
1052
1132
|
// packages/qwik/src/core/use/use-resource.ts
|
|
1053
1133
|
var _createResourceReturn = (opts) => {
|
|
@@ -1073,7 +1153,7 @@ var runResource = (task, container, host) => {
|
|
|
1073
1153
|
cleanupTask(task);
|
|
1074
1154
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
1075
1155
|
iCtx.$container$ = container;
|
|
1076
|
-
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
|
|
1156
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
|
|
1077
1157
|
const resource = task.$state$;
|
|
1078
1158
|
assertDefined(
|
|
1079
1159
|
resource,
|
|
@@ -1561,6 +1641,18 @@ function escapeHTML(html) {
|
|
|
1561
1641
|
}
|
|
1562
1642
|
}
|
|
1563
1643
|
|
|
1644
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
1645
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1646
|
+
if (!jsxDev) {
|
|
1647
|
+
return null;
|
|
1648
|
+
}
|
|
1649
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
1650
|
+
if (sanitizedFileName) {
|
|
1651
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
1652
|
+
}
|
|
1653
|
+
return null;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1564
1656
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1565
1657
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1566
1658
|
let journal = container.$journal$;
|
|
@@ -1901,7 +1993,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1901
1993
|
vnode_remove(journal, vParent, toRemove, true);
|
|
1902
1994
|
}
|
|
1903
1995
|
}
|
|
1904
|
-
function createNewElement(jsx2, elementName) {
|
|
1996
|
+
function createNewElement(jsx2, elementName, currentFile) {
|
|
1905
1997
|
const element = createElementWithNamespace(elementName);
|
|
1906
1998
|
const { constProps } = jsx2;
|
|
1907
1999
|
let needsQDispatchEventPatch = false;
|
|
@@ -1929,6 +2021,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1929
2021
|
} else if (typeof value === "function") {
|
|
1930
2022
|
value(element);
|
|
1931
2023
|
continue;
|
|
2024
|
+
} else {
|
|
2025
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
1932
2026
|
}
|
|
1933
2027
|
}
|
|
1934
2028
|
if (isSignal(value)) {
|
|
@@ -1950,13 +2044,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1950
2044
|
continue;
|
|
1951
2045
|
}
|
|
1952
2046
|
if (elementName === "textarea" && key2 === "value") {
|
|
1953
|
-
if (typeof value !== "string") {
|
|
2047
|
+
if (value && typeof value !== "string") {
|
|
1954
2048
|
if (isDev4) {
|
|
1955
|
-
throw qError(40 /* wrongTextareaValue
|
|
2049
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
1956
2050
|
}
|
|
1957
2051
|
continue;
|
|
1958
2052
|
}
|
|
1959
|
-
element.value = escapeHTML(value);
|
|
2053
|
+
element.value = escapeHTML(value || "");
|
|
1960
2054
|
continue;
|
|
1961
2055
|
}
|
|
1962
2056
|
value = serializeAttribute(key2, value, scopedStyleIdPrefix);
|
|
@@ -1992,19 +2086,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1992
2086
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
1993
2087
|
const jsxKey = jsx2.key;
|
|
1994
2088
|
let needsQDispatchEventPatch = false;
|
|
2089
|
+
const currentFile = getFileLocationFromJsx(jsx2.dev);
|
|
1995
2090
|
if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
|
|
1996
2091
|
vNewNode = retrieveChildWithKey(elementName, jsxKey);
|
|
1997
2092
|
if (vNewNode === null) {
|
|
1998
2093
|
needsQDispatchEventPatch = createNewElement(jsx2, elementName);
|
|
1999
2094
|
} else {
|
|
2000
2095
|
vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
|
|
2096
|
+
vCurrent = vNewNode;
|
|
2097
|
+
vNewNode = null;
|
|
2098
|
+
if (vSiblings !== null) {
|
|
2099
|
+
vSiblingsIdx -= 3 /* Size */;
|
|
2100
|
+
}
|
|
2001
2101
|
}
|
|
2002
2102
|
}
|
|
2003
2103
|
const jsxAttrs = [];
|
|
2004
2104
|
const props = jsx2.varProps;
|
|
2005
2105
|
for (const key in props) {
|
|
2006
|
-
|
|
2007
|
-
value = serializeAttribute(key, value, scopedStyleIdPrefix);
|
|
2106
|
+
const value = props[key];
|
|
2008
2107
|
if (value != null) {
|
|
2009
2108
|
mapArray_set(jsxAttrs, key, value, 0);
|
|
2010
2109
|
}
|
|
@@ -2013,7 +2112,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2013
2112
|
mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
|
|
2014
2113
|
}
|
|
2015
2114
|
const vNode = vNewNode || vCurrent;
|
|
2016
|
-
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
|
|
2115
|
+
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
|
|
2017
2116
|
if (needsQDispatchEventPatch) {
|
|
2018
2117
|
const element = vnode_getNode(vNode);
|
|
2019
2118
|
if (!element.qDispatchEvent) {
|
|
@@ -2036,7 +2135,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2036
2135
|
}
|
|
2037
2136
|
}
|
|
2038
2137
|
}
|
|
2039
|
-
function setBulkProps(vnode, srcAttrs) {
|
|
2138
|
+
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
2040
2139
|
vnode_ensureElementInflated(vnode);
|
|
2041
2140
|
const dstAttrs = vnode;
|
|
2042
2141
|
let srcIdx = 0;
|
|
@@ -2059,12 +2158,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2059
2158
|
} else if (typeof value === "function") {
|
|
2060
2159
|
value(element);
|
|
2061
2160
|
return;
|
|
2161
|
+
} else {
|
|
2162
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2062
2163
|
}
|
|
2063
2164
|
}
|
|
2064
2165
|
if (isSignal(value)) {
|
|
2065
|
-
|
|
2166
|
+
const signalData = new EffectPropData({
|
|
2167
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2168
|
+
$isConst$: false
|
|
2169
|
+
});
|
|
2170
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
2066
2171
|
}
|
|
2067
|
-
vnode_setAttr(journal, vnode, key, value);
|
|
2172
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
|
|
2068
2173
|
if (value === null) {
|
|
2069
2174
|
dstLength = dstAttrs.length;
|
|
2070
2175
|
}
|
|
@@ -2106,6 +2211,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2106
2211
|
}
|
|
2107
2212
|
srcIdx++;
|
|
2108
2213
|
srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
2214
|
+
dstIdx++;
|
|
2215
|
+
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2109
2216
|
} else if (srcKey == dstKey) {
|
|
2110
2217
|
const srcValue = srcAttrs[srcIdx++];
|
|
2111
2218
|
const dstValue = dstAttrs[dstIdx++];
|
|
@@ -2182,7 +2289,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2182
2289
|
vnode_insertBefore(
|
|
2183
2290
|
journal,
|
|
2184
2291
|
vParent,
|
|
2185
|
-
vNewNode
|
|
2292
|
+
vNewNode,
|
|
2186
2293
|
vCurrent && getInsertBefore()
|
|
2187
2294
|
);
|
|
2188
2295
|
return;
|
|
@@ -2380,7 +2487,7 @@ function cleanup(container, vNode) {
|
|
|
2380
2487
|
const obj = seq[i];
|
|
2381
2488
|
if (isTask(obj)) {
|
|
2382
2489
|
const task = obj;
|
|
2383
|
-
clearSubscriberEffectDependencies(task);
|
|
2490
|
+
clearSubscriberEffectDependencies(container, task);
|
|
2384
2491
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2385
2492
|
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2386
2493
|
} else {
|
|
@@ -2465,6 +2572,81 @@ function markVNodeAsDeleted(vCursor) {
|
|
|
2465
2572
|
var HANDLER_PREFIX = ":";
|
|
2466
2573
|
var count = 0;
|
|
2467
2574
|
|
|
2575
|
+
// packages/qwik/src/core/shared/scheduler-document-position.ts
|
|
2576
|
+
var aVNodePath = [];
|
|
2577
|
+
var bVNodePath = [];
|
|
2578
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
2579
|
+
if (a === b) {
|
|
2580
|
+
return 0;
|
|
2581
|
+
}
|
|
2582
|
+
let aDepth = -1;
|
|
2583
|
+
let bDepth = -1;
|
|
2584
|
+
while (a) {
|
|
2585
|
+
const vNode = aVNodePath[++aDepth] = a;
|
|
2586
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
2587
|
+
}
|
|
2588
|
+
while (b) {
|
|
2589
|
+
const vNode = bVNodePath[++bDepth] = b;
|
|
2590
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
2591
|
+
}
|
|
2592
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
2593
|
+
a = aVNodePath[aDepth];
|
|
2594
|
+
b = bVNodePath[bDepth];
|
|
2595
|
+
if (a === b) {
|
|
2596
|
+
aDepth--;
|
|
2597
|
+
bDepth--;
|
|
2598
|
+
} else {
|
|
2599
|
+
let cursor = b;
|
|
2600
|
+
do {
|
|
2601
|
+
cursor = vnode_getNextSibling(cursor);
|
|
2602
|
+
if (cursor === a) {
|
|
2603
|
+
return 1;
|
|
2604
|
+
}
|
|
2605
|
+
} while (cursor);
|
|
2606
|
+
cursor = b;
|
|
2607
|
+
do {
|
|
2608
|
+
cursor = vnode_getPreviousSibling(cursor);
|
|
2609
|
+
if (cursor === a) {
|
|
2610
|
+
return -1;
|
|
2611
|
+
}
|
|
2612
|
+
} while (cursor);
|
|
2613
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
2614
|
+
return -1;
|
|
2615
|
+
}
|
|
2616
|
+
return 1;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
return aDepth < bDepth ? -1 : 1;
|
|
2620
|
+
};
|
|
2621
|
+
var aSsrNodePath = [];
|
|
2622
|
+
var bSsrNodePath = [];
|
|
2623
|
+
var ssrNodeDocumentPosition = (a, b) => {
|
|
2624
|
+
if (a === b) {
|
|
2625
|
+
return 0;
|
|
2626
|
+
}
|
|
2627
|
+
let aDepth = -1;
|
|
2628
|
+
let bDepth = -1;
|
|
2629
|
+
while (a) {
|
|
2630
|
+
const ssrNode = aSsrNodePath[++aDepth] = a;
|
|
2631
|
+
a = ssrNode.currentComponentNode;
|
|
2632
|
+
}
|
|
2633
|
+
while (b) {
|
|
2634
|
+
const ssrNode = bSsrNodePath[++bDepth] = b;
|
|
2635
|
+
b = ssrNode.currentComponentNode;
|
|
2636
|
+
}
|
|
2637
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
2638
|
+
a = aSsrNodePath[aDepth];
|
|
2639
|
+
b = bSsrNodePath[bDepth];
|
|
2640
|
+
if (a === b) {
|
|
2641
|
+
aDepth--;
|
|
2642
|
+
bDepth--;
|
|
2643
|
+
} else {
|
|
2644
|
+
return 1;
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
return aDepth < bDepth ? -1 : 1;
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2468
2650
|
// packages/qwik/src/core/shared/scheduler.ts
|
|
2469
2651
|
var DEBUG2 = false;
|
|
2470
2652
|
var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
@@ -2491,7 +2673,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2491
2673
|
};
|
|
2492
2674
|
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
2493
2675
|
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
2494
|
-
chore = sortedInsert(choreQueue, chore);
|
|
2676
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2495
2677
|
if (!journalFlushScheduled && runLater) {
|
|
2496
2678
|
journalFlushScheduled = true;
|
|
2497
2679
|
schedule(16 /* JOURNAL_FLUSH */);
|
|
@@ -2500,10 +2682,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2500
2682
|
if (runLater) {
|
|
2501
2683
|
return chore.$promise$;
|
|
2502
2684
|
} else {
|
|
2503
|
-
return drainUpTo(chore);
|
|
2685
|
+
return drainUpTo(chore, container.rootVNode || null);
|
|
2504
2686
|
}
|
|
2505
2687
|
}
|
|
2506
|
-
function drainUpTo(runUptoChore) {
|
|
2688
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
2507
2689
|
if (runUptoChore.$executed$) {
|
|
2508
2690
|
return runUptoChore.$returnValue$;
|
|
2509
2691
|
}
|
|
@@ -2512,7 +2694,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2512
2694
|
}
|
|
2513
2695
|
while (choreQueue.length) {
|
|
2514
2696
|
const nextChore = choreQueue.shift();
|
|
2515
|
-
const order = choreComparator(nextChore, runUptoChore,
|
|
2697
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode);
|
|
2516
2698
|
if (order === null) {
|
|
2517
2699
|
continue;
|
|
2518
2700
|
}
|
|
@@ -2527,7 +2709,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2527
2709
|
}
|
|
2528
2710
|
const returnValue = executeChore(nextChore);
|
|
2529
2711
|
if (isPromise(returnValue)) {
|
|
2530
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore));
|
|
2712
|
+
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
2531
2713
|
return promise;
|
|
2532
2714
|
}
|
|
2533
2715
|
}
|
|
@@ -2557,11 +2739,13 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2557
2739
|
(jsx3) => {
|
|
2558
2740
|
if (chore.$type$ === 7 /* COMPONENT */) {
|
|
2559
2741
|
const styleScopedId = container.getHostProp(host, QScopedStyle);
|
|
2560
|
-
return
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2742
|
+
return retryOnPromise(
|
|
2743
|
+
() => vnode_diff(
|
|
2744
|
+
container,
|
|
2745
|
+
jsx3,
|
|
2746
|
+
host,
|
|
2747
|
+
addComponentStylePrefix(styleScopedId)
|
|
2748
|
+
)
|
|
2565
2749
|
);
|
|
2566
2750
|
} else {
|
|
2567
2751
|
return jsx3;
|
|
@@ -2590,7 +2774,9 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2590
2774
|
if (isSignal(jsx2)) {
|
|
2591
2775
|
jsx2 = jsx2.value;
|
|
2592
2776
|
}
|
|
2593
|
-
returnValue =
|
|
2777
|
+
returnValue = retryOnPromise(
|
|
2778
|
+
() => vnode_diff(container, jsx2, parentVirtualNode, null)
|
|
2779
|
+
);
|
|
2594
2780
|
break;
|
|
2595
2781
|
case 5 /* NODE_PROP */:
|
|
2596
2782
|
const virtualNode = chore.$host$;
|
|
@@ -2652,7 +2838,7 @@ var choreUpdate = (existing, newChore) => {
|
|
|
2652
2838
|
function vNodeAlreadyDeleted(chore) {
|
|
2653
2839
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2654
2840
|
}
|
|
2655
|
-
function choreComparator(a, b,
|
|
2841
|
+
function choreComparator(a, b, rootVNode) {
|
|
2656
2842
|
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2657
2843
|
if (macroTypeDiff !== 0) {
|
|
2658
2844
|
return macroTypeDiff;
|
|
@@ -2662,7 +2848,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2662
2848
|
const bHost = b.$host$;
|
|
2663
2849
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
2664
2850
|
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
2665
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2851
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2666
2852
|
if (hostDiff !== 0) {
|
|
2667
2853
|
return hostDiff;
|
|
2668
2854
|
}
|
|
@@ -2671,11 +2857,11 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2671
2857
|
You are attempting to change a state that has already been streamed to the client.
|
|
2672
2858
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2673
2859
|
Problematic Node: ${aHost.toString()}`;
|
|
2674
|
-
if (shouldThrowOnHostMismatch) {
|
|
2675
|
-
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2676
|
-
}
|
|
2677
2860
|
logWarn(errorMessage);
|
|
2678
|
-
|
|
2861
|
+
const hostDiff = ssrNodeDocumentPosition(aHost, bHost);
|
|
2862
|
+
if (hostDiff !== 0) {
|
|
2863
|
+
return hostDiff;
|
|
2864
|
+
}
|
|
2679
2865
|
}
|
|
2680
2866
|
}
|
|
2681
2867
|
const microTypeDiff = (a.$type$ & 15 /* MICRO */) - (b.$type$ & 15 /* MICRO */);
|
|
@@ -2692,13 +2878,13 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2692
2878
|
}
|
|
2693
2879
|
return 0;
|
|
2694
2880
|
}
|
|
2695
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2881
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2696
2882
|
let bottom = 0;
|
|
2697
2883
|
let top = sortedArray.length;
|
|
2698
2884
|
while (bottom < top) {
|
|
2699
2885
|
const middle = bottom + (top - bottom >> 1);
|
|
2700
2886
|
const midChore = sortedArray[middle];
|
|
2701
|
-
const comp = choreComparator(value, midChore,
|
|
2887
|
+
const comp = choreComparator(value, midChore, rootVNode);
|
|
2702
2888
|
if (comp < 0) {
|
|
2703
2889
|
top = middle;
|
|
2704
2890
|
} else if (comp > 0) {
|
|
@@ -2709,8 +2895,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2709
2895
|
}
|
|
2710
2896
|
return ~bottom;
|
|
2711
2897
|
}
|
|
2712
|
-
function sortedInsert(sortedArray, value) {
|
|
2713
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2898
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2899
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2714
2900
|
if (idx < 0) {
|
|
2715
2901
|
sortedArray.splice(~idx, 0, value);
|
|
2716
2902
|
return value;
|
|
@@ -2762,7 +2948,10 @@ var runTask = (task, container, host) => {
|
|
|
2762
2948
|
cleanupTask(task);
|
|
2763
2949
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
2764
2950
|
iCtx.$container$ = container;
|
|
2765
|
-
const taskFn = task.$qrl$.getFn(
|
|
2951
|
+
const taskFn = task.$qrl$.getFn(
|
|
2952
|
+
iCtx,
|
|
2953
|
+
() => clearSubscriberEffectDependencies(container, task)
|
|
2954
|
+
);
|
|
2766
2955
|
const track = (obj, prop) => {
|
|
2767
2956
|
const ctx = newInvokeContext();
|
|
2768
2957
|
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
@@ -2919,7 +3108,7 @@ var Signal = class {
|
|
|
2919
3108
|
// prevent accidental use as value
|
|
2920
3109
|
valueOf() {
|
|
2921
3110
|
if (qDev) {
|
|
2922
|
-
throw qError(
|
|
3111
|
+
throw qError(45 /* cannotCoerceSignal */);
|
|
2923
3112
|
}
|
|
2924
3113
|
}
|
|
2925
3114
|
toString() {
|
|
@@ -3084,7 +3273,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3084
3273
|
try {
|
|
3085
3274
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3086
3275
|
if (isPromise(untrackedValue)) {
|
|
3087
|
-
throw qError(
|
|
3276
|
+
throw qError(46 /* computedNotSync */, [
|
|
3088
3277
|
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3089
3278
|
computeQrl.$hash$
|
|
3090
3279
|
]);
|
|
@@ -3107,7 +3296,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3107
3296
|
return super.value;
|
|
3108
3297
|
}
|
|
3109
3298
|
set value(_) {
|
|
3110
|
-
throw qError(
|
|
3299
|
+
throw qError(47 /* computedReadOnly */);
|
|
3111
3300
|
}
|
|
3112
3301
|
};
|
|
3113
3302
|
var WrappedSignal = class extends Signal {
|
|
@@ -3173,12 +3362,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3173
3362
|
return super.value;
|
|
3174
3363
|
}
|
|
3175
3364
|
set value(_) {
|
|
3176
|
-
throw qError(
|
|
3365
|
+
throw qError(48 /* wrappedReadOnly */);
|
|
3177
3366
|
}
|
|
3178
3367
|
};
|
|
3179
3368
|
|
|
3180
3369
|
// packages/qwik/src/core/version.ts
|
|
3181
|
-
var version = "2.0.0-alpha.
|
|
3370
|
+
var version = "2.0.0-alpha.6-dev+d848ba5";
|
|
3182
3371
|
|
|
3183
3372
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3184
3373
|
var _SharedContainer = class {
|
|
@@ -4820,7 +5009,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4820
5009
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4821
5010
|
return vnode[4 /* node */];
|
|
4822
5011
|
};
|
|
4823
|
-
function vnode_toString(depth =
|
|
5012
|
+
function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
|
|
4824
5013
|
let vnode = this;
|
|
4825
5014
|
if (depth === 0) {
|
|
4826
5015
|
return "...";
|
|
@@ -5016,52 +5205,15 @@ var vnode_getType = (vnode) => {
|
|
|
5016
5205
|
};
|
|
5017
5206
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5018
5207
|
1;
|
|
5019
|
-
var aPath = [];
|
|
5020
|
-
var bPath = [];
|
|
5021
|
-
var vnode_documentPosition = (a, b) => {
|
|
5022
|
-
if (a === b) {
|
|
5023
|
-
return 0;
|
|
5024
|
-
}
|
|
5025
|
-
let aDepth = -1;
|
|
5026
|
-
let bDepth = -1;
|
|
5027
|
-
while (a) {
|
|
5028
|
-
a = (aPath[++aDepth] = a)[1 /* parent */];
|
|
5029
|
-
}
|
|
5030
|
-
while (b) {
|
|
5031
|
-
b = (bPath[++bDepth] = b)[1 /* parent */];
|
|
5032
|
-
}
|
|
5033
|
-
while (aDepth >= 0 && bDepth >= 0) {
|
|
5034
|
-
a = aPath[aDepth];
|
|
5035
|
-
b = bPath[bDepth];
|
|
5036
|
-
if (a === b) {
|
|
5037
|
-
aDepth--;
|
|
5038
|
-
bDepth--;
|
|
5039
|
-
} else {
|
|
5040
|
-
let cursor = b;
|
|
5041
|
-
do {
|
|
5042
|
-
cursor = vnode_getNextSibling(cursor);
|
|
5043
|
-
if (cursor === a) {
|
|
5044
|
-
return 1;
|
|
5045
|
-
}
|
|
5046
|
-
} while (cursor);
|
|
5047
|
-
cursor = b;
|
|
5048
|
-
do {
|
|
5049
|
-
cursor = vnode_getPreviousSibling(cursor);
|
|
5050
|
-
if (cursor === a) {
|
|
5051
|
-
return -1;
|
|
5052
|
-
}
|
|
5053
|
-
} while (cursor);
|
|
5054
|
-
return 1;
|
|
5055
|
-
}
|
|
5056
|
-
}
|
|
5057
|
-
return aDepth < bDepth ? -1 : 1;
|
|
5058
|
-
};
|
|
5059
5208
|
var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
5060
5209
|
let projectionDepth = 1;
|
|
5061
5210
|
while (projectionDepth--) {
|
|
5062
5211
|
while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
|
|
5063
|
-
const
|
|
5064
|
-
|
|
5212
|
+
const qSlotParent = vnode_getProp(
|
|
5213
|
+
vHost,
|
|
5214
|
+
QSlotParent,
|
|
5215
|
+
(id) => vnode_locate(rootVNode, id)
|
|
5216
|
+
);
|
|
5065
5217
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
5066
5218
|
if (vProjectionParent) {
|
|
5067
5219
|
projectionDepth++;
|
|
@@ -5620,13 +5772,11 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5620
5772
|
if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
|
|
5621
5773
|
return vNode;
|
|
5622
5774
|
}
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
}
|
|
5775
|
+
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
5776
|
+
vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5777
|
+
} else {
|
|
5778
|
+
vNode = vnode_getParent(vNode);
|
|
5628
5779
|
}
|
|
5629
|
-
vNode = vnode_getParent(vNode);
|
|
5630
5780
|
}
|
|
5631
5781
|
return null;
|
|
5632
5782
|
}
|
|
@@ -5719,10 +5869,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5719
5869
|
|
|
5720
5870
|
// packages/qwik/src/core/shared/shared-serialization.ts
|
|
5721
5871
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
5722
|
-
var unwrapDeserializerProxy = (value) => {
|
|
5723
|
-
const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
|
|
5724
|
-
return unwrapped ? unwrapped : value;
|
|
5725
|
-
};
|
|
5726
5872
|
var isDeserializerProxy = (value) => {
|
|
5727
5873
|
return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
|
|
5728
5874
|
};
|
|
@@ -5764,13 +5910,13 @@ var DeserializationHandler = class {
|
|
|
5764
5910
|
return value;
|
|
5765
5911
|
}
|
|
5766
5912
|
const container = this.$container$;
|
|
5767
|
-
|
|
5913
|
+
let propValue = allocate(container, typeId, value);
|
|
5914
|
+
if (typeId >= 12 /* Error */) {
|
|
5915
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
5916
|
+
}
|
|
5768
5917
|
Reflect.set(target, property, propValue);
|
|
5769
5918
|
this.$data$[idx] = void 0;
|
|
5770
5919
|
this.$data$[idx + 1] = propValue;
|
|
5771
|
-
if (typeId >= 12 /* Error */) {
|
|
5772
|
-
inflate(container, propValue, typeId, value);
|
|
5773
|
-
}
|
|
5774
5920
|
return propValue;
|
|
5775
5921
|
}
|
|
5776
5922
|
has(target, property) {
|
|
@@ -5804,7 +5950,7 @@ var _eagerDeserializeArray = (container, data) => {
|
|
|
5804
5950
|
var resolvers = /* @__PURE__ */ new WeakMap();
|
|
5805
5951
|
var inflate = (container, target, typeId, data) => {
|
|
5806
5952
|
if (typeId === void 0) {
|
|
5807
|
-
return;
|
|
5953
|
+
return target;
|
|
5808
5954
|
}
|
|
5809
5955
|
if (typeId !== 13 /* Object */ && Array.isArray(data)) {
|
|
5810
5956
|
data = _eagerDeserializeArray(container, data);
|
|
@@ -5875,14 +6021,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
5875
6021
|
case 25 /* Store */:
|
|
5876
6022
|
case 26 /* StoreArray */: {
|
|
5877
6023
|
const [value, flags, effects2, storeEffect] = data;
|
|
5878
|
-
const
|
|
5879
|
-
|
|
5880
|
-
Object.assign(getStoreTarget(target), value);
|
|
6024
|
+
const store = getOrCreateStore(value, flags, container);
|
|
6025
|
+
const storeHandler = getStoreHandler(store);
|
|
5881
6026
|
if (storeEffect) {
|
|
5882
6027
|
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
5883
6028
|
}
|
|
5884
|
-
|
|
5885
|
-
|
|
6029
|
+
storeHandler.$effects$ = effects2;
|
|
6030
|
+
target = store;
|
|
5886
6031
|
break;
|
|
5887
6032
|
}
|
|
5888
6033
|
case 22 /* Signal */: {
|
|
@@ -6003,6 +6148,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6003
6148
|
default:
|
|
6004
6149
|
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6005
6150
|
}
|
|
6151
|
+
return target;
|
|
6006
6152
|
};
|
|
6007
6153
|
var _constants = [
|
|
6008
6154
|
void 0,
|
|
@@ -6070,9 +6216,8 @@ var allocate = (container, typeId, value) => {
|
|
|
6070
6216
|
case 24 /* ComputedSignal */:
|
|
6071
6217
|
return new ComputedSignal(container, null);
|
|
6072
6218
|
case 25 /* Store */:
|
|
6073
|
-
return createStore(container, {}, 0);
|
|
6074
6219
|
case 26 /* StoreArray */:
|
|
6075
|
-
return
|
|
6220
|
+
return null;
|
|
6076
6221
|
case 11 /* URLSearchParams */:
|
|
6077
6222
|
return new URLSearchParams(value);
|
|
6078
6223
|
case 27 /* FormData */:
|
|
@@ -6721,15 +6866,15 @@ function qrlToString(serializationContext, value) {
|
|
|
6721
6866
|
}
|
|
6722
6867
|
return qrlStringInline;
|
|
6723
6868
|
}
|
|
6724
|
-
function deserializeData(container, typeId,
|
|
6869
|
+
function deserializeData(container, typeId, value) {
|
|
6725
6870
|
if (typeId === void 0) {
|
|
6726
|
-
return
|
|
6871
|
+
return value;
|
|
6727
6872
|
}
|
|
6728
|
-
|
|
6873
|
+
let propValue = allocate(container, typeId, value);
|
|
6729
6874
|
if (typeId >= 12 /* Error */) {
|
|
6730
|
-
inflate(container,
|
|
6875
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
6731
6876
|
}
|
|
6732
|
-
return
|
|
6877
|
+
return propValue;
|
|
6733
6878
|
}
|
|
6734
6879
|
function shouldTrackObj(obj) {
|
|
6735
6880
|
return (
|
|
@@ -7479,7 +7624,7 @@ var SsrComponentFrame = class {
|
|
|
7479
7624
|
if (isJSXNode2(children)) {
|
|
7480
7625
|
const slotName = this.getSlotName(children);
|
|
7481
7626
|
mapArray_set(this.slots, slotName, children, 0);
|
|
7482
|
-
} else if (Array.isArray(children)) {
|
|
7627
|
+
} else if (Array.isArray(children) && children.length > 0) {
|
|
7483
7628
|
const defaultSlot = [];
|
|
7484
7629
|
for (let i = 0; i < children.length; i++) {
|
|
7485
7630
|
const child = children[i];
|
|
@@ -7494,7 +7639,7 @@ var SsrComponentFrame = class {
|
|
|
7494
7639
|
defaultSlot.push(child);
|
|
7495
7640
|
}
|
|
7496
7641
|
}
|
|
7497
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7642
|
+
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7498
7643
|
} else {
|
|
7499
7644
|
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7500
7645
|
}
|
|
@@ -8113,12 +8258,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8113
8258
|
this.write("<");
|
|
8114
8259
|
this.write(elementName);
|
|
8115
8260
|
if (varAttrs) {
|
|
8116
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false);
|
|
8261
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
8117
8262
|
}
|
|
8118
8263
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
8119
8264
|
isDev9 && this.write('=""');
|
|
8120
8265
|
if (constAttrs && constAttrs.length) {
|
|
8121
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
|
|
8266
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
8122
8267
|
}
|
|
8123
8268
|
this.write(">");
|
|
8124
8269
|
this.lastNode = null;
|
|
@@ -8193,12 +8338,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8193
8338
|
}
|
|
8194
8339
|
openProjection(attrs) {
|
|
8195
8340
|
this.openFragment(attrs);
|
|
8196
|
-
const vNode = this.currentElementFrame?.vNodeData;
|
|
8197
|
-
if (vNode) {
|
|
8198
|
-
vNode[0] |= 16 /* SERIALIZE */;
|
|
8199
|
-
}
|
|
8200
8341
|
const componentFrame = this.getComponentFrame();
|
|
8201
8342
|
if (componentFrame) {
|
|
8343
|
+
this.serializationCtx.$addRoot$(componentFrame.componentNode);
|
|
8202
8344
|
componentFrame.projectionDepth++;
|
|
8203
8345
|
}
|
|
8204
8346
|
}
|
|
@@ -8756,7 +8898,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8756
8898
|
this.write(element);
|
|
8757
8899
|
}
|
|
8758
8900
|
}
|
|
8759
|
-
writeAttrs(tag, attrs, isConst) {
|
|
8901
|
+
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
8760
8902
|
let innerHTML = void 0;
|
|
8761
8903
|
if (attrs.length) {
|
|
8762
8904
|
for (let i = 0; i < attrs.length; i++) {
|
|
@@ -8765,7 +8907,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8765
8907
|
let styleScopedId = null;
|
|
8766
8908
|
if (isSSRUnsafeAttr(key)) {
|
|
8767
8909
|
if (isDev9) {
|
|
8768
|
-
throw qError(
|
|
8910
|
+
throw qError(50 /* unsafeAttr */);
|
|
8769
8911
|
}
|
|
8770
8912
|
continue;
|
|
8771
8913
|
}
|
|
@@ -8783,7 +8925,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8783
8925
|
value(new DomRef(lastNode));
|
|
8784
8926
|
continue;
|
|
8785
8927
|
} else {
|
|
8786
|
-
throw qError(32 /* invalidRefValue
|
|
8928
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
8787
8929
|
}
|
|
8788
8930
|
}
|
|
8789
8931
|
if (isSignal2(value)) {
|
|
@@ -8803,13 +8945,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
8803
8945
|
}
|
|
8804
8946
|
}
|
|
8805
8947
|
if (tag === "textarea" && key === "value") {
|
|
8806
|
-
if (typeof value !== "string") {
|
|
8948
|
+
if (value && typeof value !== "string") {
|
|
8807
8949
|
if (isDev9) {
|
|
8808
|
-
throw qError(40 /* wrongTextareaValue
|
|
8950
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
8809
8951
|
}
|
|
8810
8952
|
continue;
|
|
8811
8953
|
}
|
|
8812
|
-
innerHTML = escapeHTML(value);
|
|
8954
|
+
innerHTML = escapeHTML(value || "");
|
|
8813
8955
|
key = QContainerAttr;
|
|
8814
8956
|
value = "text" /* TEXT */;
|
|
8815
8957
|
}
|