@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.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-alpha.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
|
|
@@ -243,7 +243,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
243
243
|
// 30
|
|
244
244
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
245
245
|
// 31
|
|
246
|
-
"
|
|
246
|
+
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
247
247
|
// 32
|
|
248
248
|
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
249
249
|
// 33
|
|
@@ -259,7 +259,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
259
259
|
// 38
|
|
260
260
|
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
261
261
|
// 39
|
|
262
|
-
"
|
|
262
|
+
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
263
263
|
// 40
|
|
264
264
|
"Unable to find q:container",
|
|
265
265
|
// 41
|
|
@@ -269,8 +269,6 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
269
269
|
// 43
|
|
270
270
|
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
271
271
|
// 44
|
|
272
|
-
"SsrError: {{0}}",
|
|
273
|
-
// 45
|
|
274
272
|
"Cannot coerce a Signal, use `.value` instead",
|
|
275
273
|
// 46
|
|
276
274
|
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
|
|
@@ -527,6 +525,106 @@ function assertNumber(value1, text, ...parts) {
|
|
|
527
525
|
|
|
528
526
|
// packages/qwik/src/core/shared/platform/platform.ts
|
|
529
527
|
var import_build = require("@qwik.dev/core/build");
|
|
528
|
+
|
|
529
|
+
// packages/qwik/src/core/shared/types.ts
|
|
530
|
+
var DEBUG_TYPE = "q:type";
|
|
531
|
+
var START = "\x1B[34m";
|
|
532
|
+
var END = "\x1B[0m";
|
|
533
|
+
var VirtualTypeName = {
|
|
534
|
+
["V" /* Virtual */]: (
|
|
535
|
+
/* ********* */
|
|
536
|
+
START + "Virtual" + END
|
|
537
|
+
),
|
|
538
|
+
//
|
|
539
|
+
["F" /* Fragment */]: (
|
|
540
|
+
/* ******** */
|
|
541
|
+
START + "Fragment" + END
|
|
542
|
+
),
|
|
543
|
+
//
|
|
544
|
+
["S" /* WrappedSignal */]: (
|
|
545
|
+
/* *** */
|
|
546
|
+
START + "Signal" + END
|
|
547
|
+
),
|
|
548
|
+
//
|
|
549
|
+
["A" /* Awaited */]: (
|
|
550
|
+
/* ********* */
|
|
551
|
+
START + "Awaited" + END
|
|
552
|
+
),
|
|
553
|
+
//
|
|
554
|
+
["C" /* Component */]: (
|
|
555
|
+
/* ******* */
|
|
556
|
+
START + "Component" + END
|
|
557
|
+
),
|
|
558
|
+
//
|
|
559
|
+
["I" /* InlineComponent */]: (
|
|
560
|
+
/* * */
|
|
561
|
+
START + "InlineComponent" + END
|
|
562
|
+
),
|
|
563
|
+
//
|
|
564
|
+
["P" /* Projection */]: (
|
|
565
|
+
/* ****** */
|
|
566
|
+
START + "Projection" + END
|
|
567
|
+
)
|
|
568
|
+
//
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// packages/qwik/src/core/shared/utils/markers.ts
|
|
572
|
+
var OnRenderProp = "q:renderFn";
|
|
573
|
+
var ComponentStylesPrefixContent = "\u2B50\uFE0F";
|
|
574
|
+
var QSlot = "q:slot";
|
|
575
|
+
var QSlotParent = ":";
|
|
576
|
+
var QSlotRef = "q:sref";
|
|
577
|
+
var QSlotS = "q:s";
|
|
578
|
+
var QStyle = "q:style";
|
|
579
|
+
var QStyleSelector = "style[q\\:style]";
|
|
580
|
+
var QStyleSSelector = "style[q\\:sstyle]";
|
|
581
|
+
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
|
|
582
|
+
var QScopedStyle = "q:sstyle";
|
|
583
|
+
var QCtxAttr = "q:ctx";
|
|
584
|
+
var QSubscribers = "q:subs";
|
|
585
|
+
var QFuncsPrefix = "qFuncs_";
|
|
586
|
+
var getQFuncs = (document2, hash2) => {
|
|
587
|
+
return document2[QFuncsPrefix + hash2] || [];
|
|
588
|
+
};
|
|
589
|
+
var QRenderAttr = "q:render";
|
|
590
|
+
var QRuntimeAttr = "q:runtime";
|
|
591
|
+
var QVersionAttr = "q:version";
|
|
592
|
+
var QBaseAttr = "q:base";
|
|
593
|
+
var QLocaleAttr = "q:locale";
|
|
594
|
+
var QManifestHashAttr = "q:manifest-hash";
|
|
595
|
+
var QInstanceAttr = "q:instance";
|
|
596
|
+
var QContainerIsland = "q:container-island";
|
|
597
|
+
var QContainerIslandEnd = "/" + QContainerIsland;
|
|
598
|
+
var QIgnore = "q:ignore";
|
|
599
|
+
var QIgnoreEnd = "/" + QIgnore;
|
|
600
|
+
var QContainerAttr = "q:container";
|
|
601
|
+
var QContainerAttrEnd = "/" + QContainerAttr;
|
|
602
|
+
var QTemplate = "q:template";
|
|
603
|
+
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
604
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
605
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
606
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
607
|
+
var ResourceEvent = "qResource";
|
|
608
|
+
var RenderEvent = "qRender";
|
|
609
|
+
var TaskEvent = "qTask";
|
|
610
|
+
var QDefaultSlot = "";
|
|
611
|
+
var ELEMENT_ID = "q:id";
|
|
612
|
+
var ELEMENT_KEY = "q:key";
|
|
613
|
+
var ELEMENT_PROPS = "q:props";
|
|
614
|
+
var ELEMENT_SEQ = "q:seq";
|
|
615
|
+
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
616
|
+
var Q_PREFIX = "q:";
|
|
617
|
+
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
618
|
+
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
619
|
+
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
620
|
+
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
621
|
+
var FLUSH_COMMENT = "qkssr-f";
|
|
622
|
+
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
|
|
623
|
+
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
|
|
624
|
+
var Q_PROPS_SEPARATOR = ":";
|
|
625
|
+
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
626
|
+
|
|
627
|
+
// packages/qwik/src/core/shared/platform/platform.ts
|
|
530
628
|
var createPlatform2 = () => {
|
|
531
629
|
return {
|
|
532
630
|
isServer: import_build.isServer,
|
|
@@ -577,7 +675,7 @@ var createPlatform2 = () => {
|
|
|
577
675
|
};
|
|
578
676
|
var toUrl = (doc, containerEl, url) => {
|
|
579
677
|
const baseURI = doc.baseURI;
|
|
580
|
-
const base = new URL(containerEl.getAttribute(
|
|
678
|
+
const base = new URL(containerEl.getAttribute(QBaseAttr) ?? baseURI, baseURI);
|
|
581
679
|
return new URL(url, base);
|
|
582
680
|
};
|
|
583
681
|
var _platform = /* @__PURE__ */ createPlatform2();
|
|
@@ -628,117 +726,26 @@ var delay = (timeout) => {
|
|
|
628
726
|
});
|
|
629
727
|
};
|
|
630
728
|
function retryOnPromise(fn, retryCount = 0) {
|
|
631
|
-
|
|
632
|
-
return fn();
|
|
633
|
-
} catch (e) {
|
|
729
|
+
const retryOrThrow = (e) => {
|
|
634
730
|
if (isPromise(e) && retryCount < MAX_RETRY_ON_PROMISE_COUNT) {
|
|
635
731
|
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
636
732
|
}
|
|
637
733
|
throw e;
|
|
734
|
+
};
|
|
735
|
+
try {
|
|
736
|
+
const result = fn();
|
|
737
|
+
if (isPromise(result)) {
|
|
738
|
+
return result.catch((e) => retryOrThrow(e));
|
|
739
|
+
}
|
|
740
|
+
return result;
|
|
741
|
+
} catch (e) {
|
|
742
|
+
return retryOrThrow(e);
|
|
638
743
|
}
|
|
639
744
|
}
|
|
640
745
|
|
|
641
746
|
// packages/qwik/src/build/index.dev.ts
|
|
642
747
|
var isDev = true;
|
|
643
748
|
|
|
644
|
-
// packages/qwik/src/core/shared/types.ts
|
|
645
|
-
var DEBUG_TYPE = "q:type";
|
|
646
|
-
var START = "\x1B[34m";
|
|
647
|
-
var END = "\x1B[0m";
|
|
648
|
-
var VirtualTypeName = {
|
|
649
|
-
["V" /* Virtual */]: (
|
|
650
|
-
/* ********* */
|
|
651
|
-
START + "Virtual" + END
|
|
652
|
-
),
|
|
653
|
-
//
|
|
654
|
-
["F" /* Fragment */]: (
|
|
655
|
-
/* ******** */
|
|
656
|
-
START + "Fragment" + END
|
|
657
|
-
),
|
|
658
|
-
//
|
|
659
|
-
["S" /* WrappedSignal */]: (
|
|
660
|
-
/* *** */
|
|
661
|
-
START + "Signal" + END
|
|
662
|
-
),
|
|
663
|
-
//
|
|
664
|
-
["A" /* Awaited */]: (
|
|
665
|
-
/* ********* */
|
|
666
|
-
START + "Awaited" + END
|
|
667
|
-
),
|
|
668
|
-
//
|
|
669
|
-
["C" /* Component */]: (
|
|
670
|
-
/* ******* */
|
|
671
|
-
START + "Component" + END
|
|
672
|
-
),
|
|
673
|
-
//
|
|
674
|
-
["I" /* InlineComponent */]: (
|
|
675
|
-
/* * */
|
|
676
|
-
START + "InlineComponent" + END
|
|
677
|
-
),
|
|
678
|
-
//
|
|
679
|
-
["P" /* Projection */]: (
|
|
680
|
-
/* ****** */
|
|
681
|
-
START + "Projection" + END
|
|
682
|
-
)
|
|
683
|
-
//
|
|
684
|
-
};
|
|
685
|
-
|
|
686
|
-
// packages/qwik/src/core/shared/utils/markers.ts
|
|
687
|
-
var OnRenderProp = "q:renderFn";
|
|
688
|
-
var ComponentStylesPrefixContent = "\u2B50\uFE0F";
|
|
689
|
-
var QSlot = "q:slot";
|
|
690
|
-
var QSlotParent = ":";
|
|
691
|
-
var QSlotRef = "q:sref";
|
|
692
|
-
var QSlotS = "q:s";
|
|
693
|
-
var QStyle = "q:style";
|
|
694
|
-
var QStyleSelector = "style[q\\:style]";
|
|
695
|
-
var QStyleSSelector = "style[q\\:sstyle]";
|
|
696
|
-
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
|
|
697
|
-
var QScopedStyle = "q:sstyle";
|
|
698
|
-
var QCtxAttr = "q:ctx";
|
|
699
|
-
var QSubscribers = "q:subs";
|
|
700
|
-
var QFuncsPrefix = "qFuncs_";
|
|
701
|
-
var getQFuncs = (document2, hash2) => {
|
|
702
|
-
return document2[QFuncsPrefix + hash2] || [];
|
|
703
|
-
};
|
|
704
|
-
var QRenderAttr = "q:render";
|
|
705
|
-
var QRuntimeAttr = "q:runtime";
|
|
706
|
-
var QVersionAttr = "q:version";
|
|
707
|
-
var QBaseAttr = "q:base";
|
|
708
|
-
var QLocaleAttr = "q:locale";
|
|
709
|
-
var QManifestHashAttr = "q:manifest-hash";
|
|
710
|
-
var QInstanceAttr = "q:instance";
|
|
711
|
-
var QContainerIsland = "q:container-island";
|
|
712
|
-
var QContainerIslandEnd = "/" + QContainerIsland;
|
|
713
|
-
var QIgnore = "q:ignore";
|
|
714
|
-
var QIgnoreEnd = "/" + QIgnore;
|
|
715
|
-
var QContainerAttr = "q:container";
|
|
716
|
-
var QContainerAttrEnd = "/" + QContainerAttr;
|
|
717
|
-
var QTemplate = "q:template";
|
|
718
|
-
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
|
|
719
|
-
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
720
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
721
|
-
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
722
|
-
var ResourceEvent = "qResource";
|
|
723
|
-
var RenderEvent = "qRender";
|
|
724
|
-
var TaskEvent = "qTask";
|
|
725
|
-
var QDefaultSlot = "";
|
|
726
|
-
var ELEMENT_ID = "q:id";
|
|
727
|
-
var ELEMENT_KEY = "q:key";
|
|
728
|
-
var ELEMENT_PROPS = "q:props";
|
|
729
|
-
var ELEMENT_SEQ = "q:seq";
|
|
730
|
-
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
731
|
-
var Q_PREFIX = "q:";
|
|
732
|
-
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
733
|
-
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
734
|
-
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
735
|
-
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
736
|
-
var FLUSH_COMMENT = "qkssr-f";
|
|
737
|
-
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
|
|
738
|
-
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
|
|
739
|
-
var Q_PROPS_SEPARATOR = ":";
|
|
740
|
-
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
741
|
-
|
|
742
749
|
// packages/qwik/src/core/use/use-locale.ts
|
|
743
750
|
var _locale = void 0;
|
|
744
751
|
function setLocale(locale) {
|
|
@@ -775,7 +782,7 @@ function getBuildBase(opts) {
|
|
|
775
782
|
return `${import_meta.env.BASE_URL}build/`;
|
|
776
783
|
}
|
|
777
784
|
var versions = {
|
|
778
|
-
qwik: "2.0.0-alpha.
|
|
785
|
+
qwik: "2.0.0-alpha.6-dev+d848ba5",
|
|
779
786
|
qwikDom: "2.1.19"
|
|
780
787
|
};
|
|
781
788
|
|
|
@@ -941,7 +948,6 @@ var StoreHandler = class {
|
|
|
941
948
|
}
|
|
942
949
|
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
943
950
|
set(target, prop, value) {
|
|
944
|
-
target = unwrapDeserializerProxy(target);
|
|
945
951
|
if (typeof prop === "symbol") {
|
|
946
952
|
target[prop] = value;
|
|
947
953
|
return true;
|
|
@@ -1009,6 +1015,11 @@ function addEffect(target, prop, store, effectSubscriber) {
|
|
|
1009
1015
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
1010
1016
|
ensureContainsEffect(effects, effectSubscriber);
|
|
1011
1017
|
ensureContains(effectSubscriber, target);
|
|
1018
|
+
ensureEffectContainsSubscriber(
|
|
1019
|
+
effectSubscriber[0 /* EFFECT */],
|
|
1020
|
+
target,
|
|
1021
|
+
store.$container$
|
|
1022
|
+
);
|
|
1012
1023
|
DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
|
|
1013
1024
|
}
|
|
1014
1025
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -1046,32 +1057,39 @@ function clearVNodeEffectDependencies(container, value) {
|
|
|
1046
1057
|
}
|
|
1047
1058
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1048
1059
|
const subscriber = effects[i];
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1060
|
+
clearEffects(subscriber, value, effects, i, container);
|
|
1061
|
+
}
|
|
1062
|
+
if (effects.length === 0) {
|
|
1063
|
+
vnode_setProp(value, QSubscribers, null);
|
|
1053
1064
|
}
|
|
1054
1065
|
}
|
|
1055
|
-
function clearSubscriberEffectDependencies(value) {
|
|
1066
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
1056
1067
|
if (value.$effectDependencies$) {
|
|
1057
1068
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
1058
1069
|
const subscriber = value.$effectDependencies$[i];
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1070
|
+
clearEffects(subscriber, value, value.$effectDependencies$, i, container);
|
|
1071
|
+
}
|
|
1072
|
+
if (value.$effectDependencies$.length === 0) {
|
|
1073
|
+
value.$effectDependencies$ = null;
|
|
1063
1074
|
}
|
|
1064
1075
|
}
|
|
1065
1076
|
}
|
|
1066
|
-
function clearEffects(subscriber, value) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1077
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
1078
|
+
let subscriptionRemoved = false;
|
|
1079
|
+
const seenSet = /* @__PURE__ */ new Set();
|
|
1080
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1081
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
1082
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
1083
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
1084
|
+
const handler = getStoreHandler(store);
|
|
1085
|
+
subscriptionRemoved = clearStoreEffects(handler, value);
|
|
1069
1086
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
if (hostElement && hostElement === value) {
|
|
1073
|
-
subscriber.$hostElement$ = null;
|
|
1087
|
+
if (subscriptionRemoved) {
|
|
1088
|
+
effectArray.splice(indexToRemove, 1);
|
|
1074
1089
|
}
|
|
1090
|
+
}
|
|
1091
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
1092
|
+
const effectSubscriptions = subscriber.$effects$;
|
|
1075
1093
|
let subscriptionRemoved = false;
|
|
1076
1094
|
if (effectSubscriptions) {
|
|
1077
1095
|
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
@@ -1082,14 +1100,76 @@ function clearEffects(subscriber, value) {
|
|
|
1082
1100
|
}
|
|
1083
1101
|
}
|
|
1084
1102
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1103
|
+
if (subscriber instanceof WrappedSignal) {
|
|
1104
|
+
const hostElement = subscriber.$hostElement$;
|
|
1105
|
+
if (hostElement && hostElement === value) {
|
|
1106
|
+
subscriber.$hostElement$ = null;
|
|
1107
|
+
}
|
|
1108
|
+
const args = subscriber.$args$;
|
|
1109
|
+
if (args) {
|
|
1110
|
+
clearArgsEffects(args, subscriber, seenSet);
|
|
1089
1111
|
}
|
|
1090
1112
|
}
|
|
1091
1113
|
return subscriptionRemoved;
|
|
1092
1114
|
}
|
|
1115
|
+
function clearStoreEffects(storeHandler, value) {
|
|
1116
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
1117
|
+
if (!effectSubscriptions) {
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
let subscriptionRemoved = false;
|
|
1121
|
+
for (const key in effectSubscriptions) {
|
|
1122
|
+
const effects = effectSubscriptions[key];
|
|
1123
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
1124
|
+
const effect = effects[i];
|
|
1125
|
+
if (effect[0 /* EFFECT */] === value) {
|
|
1126
|
+
effects.splice(i, 1);
|
|
1127
|
+
subscriptionRemoved = true;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
if (effects.length === 0) {
|
|
1131
|
+
delete effectSubscriptions[key];
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return subscriptionRemoved;
|
|
1135
|
+
}
|
|
1136
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
1137
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
1138
|
+
const arg = args[i];
|
|
1139
|
+
clearArgEffect(arg, subscriber, seenSet);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
1143
|
+
if (seenSet.has(arg)) {
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
seenSet.add(arg);
|
|
1147
|
+
if (isSignal(arg)) {
|
|
1148
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
1149
|
+
} else if (typeof arg === "object" && arg !== null) {
|
|
1150
|
+
if (isStore(arg)) {
|
|
1151
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
1152
|
+
} else if (isPropsProxy(arg)) {
|
|
1153
|
+
const constProps = arg[_CONST_PROPS];
|
|
1154
|
+
const varProps = arg[_VAR_PROPS];
|
|
1155
|
+
if (constProps) {
|
|
1156
|
+
for (const key in constProps) {
|
|
1157
|
+
clearArgEffect(constProps[key], subscriber, seenSet);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
for (const key in varProps) {
|
|
1161
|
+
clearArgEffect(varProps[key], subscriber, seenSet);
|
|
1162
|
+
}
|
|
1163
|
+
} else {
|
|
1164
|
+
for (const key in arg) {
|
|
1165
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
} else if (Array.isArray(arg)) {
|
|
1169
|
+
clearArgsEffects(arg, subscriber, seenSet);
|
|
1170
|
+
} else {
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1093
1173
|
|
|
1094
1174
|
// packages/qwik/src/core/use/use-resource.ts
|
|
1095
1175
|
var _createResourceReturn = (opts) => {
|
|
@@ -1115,7 +1195,7 @@ var runResource = (task, container, host) => {
|
|
|
1115
1195
|
cleanupTask(task);
|
|
1116
1196
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
|
|
1117
1197
|
iCtx.$container$ = container;
|
|
1118
|
-
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
|
|
1198
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
|
|
1119
1199
|
const resource = task.$state$;
|
|
1120
1200
|
assertDefined(
|
|
1121
1201
|
resource,
|
|
@@ -1603,6 +1683,19 @@ function escapeHTML(html) {
|
|
|
1603
1683
|
}
|
|
1604
1684
|
}
|
|
1605
1685
|
|
|
1686
|
+
// packages/qwik/src/core/shared/utils/jsx-filename.ts
|
|
1687
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1688
|
+
var _a;
|
|
1689
|
+
if (!jsxDev) {
|
|
1690
|
+
return null;
|
|
1691
|
+
}
|
|
1692
|
+
const sanitizedFileName = (_a = jsxDev.fileName) == null ? void 0 : _a.replace(/\\/g, "/");
|
|
1693
|
+
if (sanitizedFileName) {
|
|
1694
|
+
return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
|
|
1695
|
+
}
|
|
1696
|
+
return null;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1606
1699
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
1607
1700
|
var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1608
1701
|
let journal = container.$journal$;
|
|
@@ -1943,7 +2036,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1943
2036
|
vnode_remove(journal, vParent, toRemove, true);
|
|
1944
2037
|
}
|
|
1945
2038
|
}
|
|
1946
|
-
function createNewElement(jsx2, elementName) {
|
|
2039
|
+
function createNewElement(jsx2, elementName, currentFile) {
|
|
1947
2040
|
const element = createElementWithNamespace(elementName);
|
|
1948
2041
|
const { constProps } = jsx2;
|
|
1949
2042
|
let needsQDispatchEventPatch = false;
|
|
@@ -1971,6 +2064,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1971
2064
|
} else if (typeof value === "function") {
|
|
1972
2065
|
value(element);
|
|
1973
2066
|
continue;
|
|
2067
|
+
} else {
|
|
2068
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
1974
2069
|
}
|
|
1975
2070
|
}
|
|
1976
2071
|
if (isSignal(value)) {
|
|
@@ -1992,13 +2087,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1992
2087
|
continue;
|
|
1993
2088
|
}
|
|
1994
2089
|
if (elementName === "textarea" && key2 === "value") {
|
|
1995
|
-
if (typeof value !== "string") {
|
|
2090
|
+
if (value && typeof value !== "string") {
|
|
1996
2091
|
if (import_build4.isDev) {
|
|
1997
|
-
throw qError(40 /* wrongTextareaValue
|
|
2092
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
1998
2093
|
}
|
|
1999
2094
|
continue;
|
|
2000
2095
|
}
|
|
2001
|
-
element.value = escapeHTML(value);
|
|
2096
|
+
element.value = escapeHTML(value || "");
|
|
2002
2097
|
continue;
|
|
2003
2098
|
}
|
|
2004
2099
|
value = serializeAttribute(key2, value, scopedStyleIdPrefix);
|
|
@@ -2034,19 +2129,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2034
2129
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
2035
2130
|
const jsxKey = jsx2.key;
|
|
2036
2131
|
let needsQDispatchEventPatch = false;
|
|
2132
|
+
const currentFile = getFileLocationFromJsx(jsx2.dev);
|
|
2037
2133
|
if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
|
|
2038
2134
|
vNewNode = retrieveChildWithKey(elementName, jsxKey);
|
|
2039
2135
|
if (vNewNode === null) {
|
|
2040
2136
|
needsQDispatchEventPatch = createNewElement(jsx2, elementName);
|
|
2041
2137
|
} else {
|
|
2042
2138
|
vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
|
|
2139
|
+
vCurrent = vNewNode;
|
|
2140
|
+
vNewNode = null;
|
|
2141
|
+
if (vSiblings !== null) {
|
|
2142
|
+
vSiblingsIdx -= 3 /* Size */;
|
|
2143
|
+
}
|
|
2043
2144
|
}
|
|
2044
2145
|
}
|
|
2045
2146
|
const jsxAttrs = [];
|
|
2046
2147
|
const props = jsx2.varProps;
|
|
2047
2148
|
for (const key in props) {
|
|
2048
|
-
|
|
2049
|
-
value = serializeAttribute(key, value, scopedStyleIdPrefix);
|
|
2149
|
+
const value = props[key];
|
|
2050
2150
|
if (value != null) {
|
|
2051
2151
|
mapArray_set(jsxAttrs, key, value, 0);
|
|
2052
2152
|
}
|
|
@@ -2055,7 +2155,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2055
2155
|
mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
|
|
2056
2156
|
}
|
|
2057
2157
|
const vNode = vNewNode || vCurrent;
|
|
2058
|
-
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
|
|
2158
|
+
needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
|
|
2059
2159
|
if (needsQDispatchEventPatch) {
|
|
2060
2160
|
const element = vnode_getNode(vNode);
|
|
2061
2161
|
if (!element.qDispatchEvent) {
|
|
@@ -2078,7 +2178,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2078
2178
|
}
|
|
2079
2179
|
}
|
|
2080
2180
|
}
|
|
2081
|
-
function setBulkProps(vnode, srcAttrs) {
|
|
2181
|
+
function setBulkProps(vnode, srcAttrs, currentFile) {
|
|
2082
2182
|
vnode_ensureElementInflated(vnode);
|
|
2083
2183
|
const dstAttrs = vnode;
|
|
2084
2184
|
let srcIdx = 0;
|
|
@@ -2101,12 +2201,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2101
2201
|
} else if (typeof value === "function") {
|
|
2102
2202
|
value(element);
|
|
2103
2203
|
return;
|
|
2204
|
+
} else {
|
|
2205
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
2104
2206
|
}
|
|
2105
2207
|
}
|
|
2106
2208
|
if (isSignal(value)) {
|
|
2107
|
-
|
|
2209
|
+
const signalData = new EffectPropData({
|
|
2210
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
2211
|
+
$isConst$: false
|
|
2212
|
+
});
|
|
2213
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
2108
2214
|
}
|
|
2109
|
-
vnode_setAttr(journal, vnode, key, value);
|
|
2215
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
|
|
2110
2216
|
if (value === null) {
|
|
2111
2217
|
dstLength = dstAttrs.length;
|
|
2112
2218
|
}
|
|
@@ -2148,6 +2254,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2148
2254
|
}
|
|
2149
2255
|
srcIdx++;
|
|
2150
2256
|
srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
2257
|
+
dstIdx++;
|
|
2258
|
+
dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
2151
2259
|
} else if (srcKey == dstKey) {
|
|
2152
2260
|
const srcValue = srcAttrs[srcIdx++];
|
|
2153
2261
|
const dstValue = dstAttrs[dstIdx++];
|
|
@@ -2224,7 +2332,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2224
2332
|
vnode_insertBefore(
|
|
2225
2333
|
journal,
|
|
2226
2334
|
vParent,
|
|
2227
|
-
vNewNode
|
|
2335
|
+
vNewNode,
|
|
2228
2336
|
vCurrent && getInsertBefore()
|
|
2229
2337
|
);
|
|
2230
2338
|
return;
|
|
@@ -2422,7 +2530,7 @@ function cleanup(container, vNode) {
|
|
|
2422
2530
|
const obj = seq[i];
|
|
2423
2531
|
if (isTask(obj)) {
|
|
2424
2532
|
const task = obj;
|
|
2425
|
-
clearSubscriberEffectDependencies(task);
|
|
2533
|
+
clearSubscriberEffectDependencies(container, task);
|
|
2426
2534
|
if (task.$flags$ & 1 /* VISIBLE_TASK */) {
|
|
2427
2535
|
container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
|
|
2428
2536
|
} else {
|
|
@@ -2507,6 +2615,81 @@ function markVNodeAsDeleted(vCursor) {
|
|
|
2507
2615
|
var HANDLER_PREFIX = ":";
|
|
2508
2616
|
var count = 0;
|
|
2509
2617
|
|
|
2618
|
+
// packages/qwik/src/core/shared/scheduler-document-position.ts
|
|
2619
|
+
var aVNodePath = [];
|
|
2620
|
+
var bVNodePath = [];
|
|
2621
|
+
var vnode_documentPosition = (a, b, rootVNode) => {
|
|
2622
|
+
if (a === b) {
|
|
2623
|
+
return 0;
|
|
2624
|
+
}
|
|
2625
|
+
let aDepth = -1;
|
|
2626
|
+
let bDepth = -1;
|
|
2627
|
+
while (a) {
|
|
2628
|
+
const vNode = aVNodePath[++aDepth] = a;
|
|
2629
|
+
a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
2630
|
+
}
|
|
2631
|
+
while (b) {
|
|
2632
|
+
const vNode = bVNodePath[++bDepth] = b;
|
|
2633
|
+
b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
|
|
2634
|
+
}
|
|
2635
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
2636
|
+
a = aVNodePath[aDepth];
|
|
2637
|
+
b = bVNodePath[bDepth];
|
|
2638
|
+
if (a === b) {
|
|
2639
|
+
aDepth--;
|
|
2640
|
+
bDepth--;
|
|
2641
|
+
} else {
|
|
2642
|
+
let cursor = b;
|
|
2643
|
+
do {
|
|
2644
|
+
cursor = vnode_getNextSibling(cursor);
|
|
2645
|
+
if (cursor === a) {
|
|
2646
|
+
return 1;
|
|
2647
|
+
}
|
|
2648
|
+
} while (cursor);
|
|
2649
|
+
cursor = b;
|
|
2650
|
+
do {
|
|
2651
|
+
cursor = vnode_getPreviousSibling(cursor);
|
|
2652
|
+
if (cursor === a) {
|
|
2653
|
+
return -1;
|
|
2654
|
+
}
|
|
2655
|
+
} while (cursor);
|
|
2656
|
+
if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
|
|
2657
|
+
return -1;
|
|
2658
|
+
}
|
|
2659
|
+
return 1;
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
return aDepth < bDepth ? -1 : 1;
|
|
2663
|
+
};
|
|
2664
|
+
var aSsrNodePath = [];
|
|
2665
|
+
var bSsrNodePath = [];
|
|
2666
|
+
var ssrNodeDocumentPosition = (a, b) => {
|
|
2667
|
+
if (a === b) {
|
|
2668
|
+
return 0;
|
|
2669
|
+
}
|
|
2670
|
+
let aDepth = -1;
|
|
2671
|
+
let bDepth = -1;
|
|
2672
|
+
while (a) {
|
|
2673
|
+
const ssrNode = aSsrNodePath[++aDepth] = a;
|
|
2674
|
+
a = ssrNode.currentComponentNode;
|
|
2675
|
+
}
|
|
2676
|
+
while (b) {
|
|
2677
|
+
const ssrNode = bSsrNodePath[++bDepth] = b;
|
|
2678
|
+
b = ssrNode.currentComponentNode;
|
|
2679
|
+
}
|
|
2680
|
+
while (aDepth >= 0 && bDepth >= 0) {
|
|
2681
|
+
a = aSsrNodePath[aDepth];
|
|
2682
|
+
b = bSsrNodePath[bDepth];
|
|
2683
|
+
if (a === b) {
|
|
2684
|
+
aDepth--;
|
|
2685
|
+
bDepth--;
|
|
2686
|
+
} else {
|
|
2687
|
+
return 1;
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
return aDepth < bDepth ? -1 : 1;
|
|
2691
|
+
};
|
|
2692
|
+
|
|
2510
2693
|
// packages/qwik/src/core/shared/scheduler.ts
|
|
2511
2694
|
var DEBUG2 = false;
|
|
2512
2695
|
var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
@@ -2533,7 +2716,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2533
2716
|
};
|
|
2534
2717
|
chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
|
|
2535
2718
|
DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
|
|
2536
|
-
chore = sortedInsert(choreQueue, chore);
|
|
2719
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2537
2720
|
if (!journalFlushScheduled && runLater) {
|
|
2538
2721
|
journalFlushScheduled = true;
|
|
2539
2722
|
schedule(16 /* JOURNAL_FLUSH */);
|
|
@@ -2542,10 +2725,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2542
2725
|
if (runLater) {
|
|
2543
2726
|
return chore.$promise$;
|
|
2544
2727
|
} else {
|
|
2545
|
-
return drainUpTo(chore);
|
|
2728
|
+
return drainUpTo(chore, container.rootVNode || null);
|
|
2546
2729
|
}
|
|
2547
2730
|
}
|
|
2548
|
-
function drainUpTo(runUptoChore) {
|
|
2731
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
2549
2732
|
if (runUptoChore.$executed$) {
|
|
2550
2733
|
return runUptoChore.$returnValue$;
|
|
2551
2734
|
}
|
|
@@ -2554,7 +2737,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2554
2737
|
}
|
|
2555
2738
|
while (choreQueue.length) {
|
|
2556
2739
|
const nextChore = choreQueue.shift();
|
|
2557
|
-
const order = choreComparator(nextChore, runUptoChore,
|
|
2740
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode);
|
|
2558
2741
|
if (order === null) {
|
|
2559
2742
|
continue;
|
|
2560
2743
|
}
|
|
@@ -2569,7 +2752,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2569
2752
|
}
|
|
2570
2753
|
const returnValue = executeChore(nextChore);
|
|
2571
2754
|
if (isPromise(returnValue)) {
|
|
2572
|
-
const promise = returnValue.then(() => drainUpTo(runUptoChore));
|
|
2755
|
+
const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
|
|
2573
2756
|
return promise;
|
|
2574
2757
|
}
|
|
2575
2758
|
}
|
|
@@ -2600,11 +2783,13 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2600
2783
|
(jsx3) => {
|
|
2601
2784
|
if (chore.$type$ === 7 /* COMPONENT */) {
|
|
2602
2785
|
const styleScopedId = container.getHostProp(host, QScopedStyle);
|
|
2603
|
-
return
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2786
|
+
return retryOnPromise(
|
|
2787
|
+
() => vnode_diff(
|
|
2788
|
+
container,
|
|
2789
|
+
jsx3,
|
|
2790
|
+
host,
|
|
2791
|
+
addComponentStylePrefix(styleScopedId)
|
|
2792
|
+
)
|
|
2608
2793
|
);
|
|
2609
2794
|
} else {
|
|
2610
2795
|
return jsx3;
|
|
@@ -2633,7 +2818,9 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
2633
2818
|
if (isSignal(jsx2)) {
|
|
2634
2819
|
jsx2 = jsx2.value;
|
|
2635
2820
|
}
|
|
2636
|
-
returnValue =
|
|
2821
|
+
returnValue = retryOnPromise(
|
|
2822
|
+
() => vnode_diff(container, jsx2, parentVirtualNode, null)
|
|
2823
|
+
);
|
|
2637
2824
|
break;
|
|
2638
2825
|
case 5 /* NODE_PROP */:
|
|
2639
2826
|
const virtualNode = chore.$host$;
|
|
@@ -2696,7 +2883,7 @@ var choreUpdate = (existing, newChore) => {
|
|
|
2696
2883
|
function vNodeAlreadyDeleted(chore) {
|
|
2697
2884
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
|
|
2698
2885
|
}
|
|
2699
|
-
function choreComparator(a, b,
|
|
2886
|
+
function choreComparator(a, b, rootVNode) {
|
|
2700
2887
|
const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
|
|
2701
2888
|
if (macroTypeDiff !== 0) {
|
|
2702
2889
|
return macroTypeDiff;
|
|
@@ -2706,7 +2893,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2706
2893
|
const bHost = b.$host$;
|
|
2707
2894
|
if (aHost !== bHost && aHost !== null && bHost !== null) {
|
|
2708
2895
|
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
2709
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2896
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2710
2897
|
if (hostDiff !== 0) {
|
|
2711
2898
|
return hostDiff;
|
|
2712
2899
|
}
|
|
@@ -2715,11 +2902,11 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2715
2902
|
You are attempting to change a state that has already been streamed to the client.
|
|
2716
2903
|
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2717
2904
|
Problematic Node: ${aHost.toString()}`;
|
|
2718
|
-
if (shouldThrowOnHostMismatch) {
|
|
2719
|
-
throw qError(45 /* serverHostMismatch */, [errorMessage]);
|
|
2720
|
-
}
|
|
2721
2905
|
logWarn(errorMessage);
|
|
2722
|
-
|
|
2906
|
+
const hostDiff = ssrNodeDocumentPosition(aHost, bHost);
|
|
2907
|
+
if (hostDiff !== 0) {
|
|
2908
|
+
return hostDiff;
|
|
2909
|
+
}
|
|
2723
2910
|
}
|
|
2724
2911
|
}
|
|
2725
2912
|
const microTypeDiff = (a.$type$ & 15 /* MICRO */) - (b.$type$ & 15 /* MICRO */);
|
|
@@ -2736,13 +2923,13 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2736
2923
|
}
|
|
2737
2924
|
return 0;
|
|
2738
2925
|
}
|
|
2739
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2926
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2740
2927
|
let bottom = 0;
|
|
2741
2928
|
let top = sortedArray.length;
|
|
2742
2929
|
while (bottom < top) {
|
|
2743
2930
|
const middle = bottom + (top - bottom >> 1);
|
|
2744
2931
|
const midChore = sortedArray[middle];
|
|
2745
|
-
const comp = choreComparator(value, midChore,
|
|
2932
|
+
const comp = choreComparator(value, midChore, rootVNode);
|
|
2746
2933
|
if (comp < 0) {
|
|
2747
2934
|
top = middle;
|
|
2748
2935
|
} else if (comp > 0) {
|
|
@@ -2753,8 +2940,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2753
2940
|
}
|
|
2754
2941
|
return ~bottom;
|
|
2755
2942
|
}
|
|
2756
|
-
function sortedInsert(sortedArray, value) {
|
|
2757
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2943
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2944
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2758
2945
|
if (idx < 0) {
|
|
2759
2946
|
sortedArray.splice(~idx, 0, value);
|
|
2760
2947
|
return value;
|
|
@@ -2807,7 +2994,10 @@ var runTask = (task, container, host) => {
|
|
|
2807
2994
|
cleanupTask(task);
|
|
2808
2995
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
|
|
2809
2996
|
iCtx.$container$ = container;
|
|
2810
|
-
const taskFn = task.$qrl$.getFn(
|
|
2997
|
+
const taskFn = task.$qrl$.getFn(
|
|
2998
|
+
iCtx,
|
|
2999
|
+
() => clearSubscriberEffectDependencies(container, task)
|
|
3000
|
+
);
|
|
2811
3001
|
const track = (obj, prop) => {
|
|
2812
3002
|
const ctx = newInvokeContext();
|
|
2813
3003
|
ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
|
|
@@ -2964,7 +3154,7 @@ var Signal = class {
|
|
|
2964
3154
|
// prevent accidental use as value
|
|
2965
3155
|
valueOf() {
|
|
2966
3156
|
if (qDev) {
|
|
2967
|
-
throw qError(
|
|
3157
|
+
throw qError(45 /* cannotCoerceSignal */);
|
|
2968
3158
|
}
|
|
2969
3159
|
}
|
|
2970
3160
|
toString() {
|
|
@@ -3131,7 +3321,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3131
3321
|
try {
|
|
3132
3322
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
3133
3323
|
if (isPromise(untrackedValue)) {
|
|
3134
|
-
throw qError(
|
|
3324
|
+
throw qError(46 /* computedNotSync */, [
|
|
3135
3325
|
computeQrl.dev ? computeQrl.dev.file : "",
|
|
3136
3326
|
computeQrl.$hash$
|
|
3137
3327
|
]);
|
|
@@ -3154,7 +3344,7 @@ var ComputedSignal = class extends Signal {
|
|
|
3154
3344
|
return super.value;
|
|
3155
3345
|
}
|
|
3156
3346
|
set value(_) {
|
|
3157
|
-
throw qError(
|
|
3347
|
+
throw qError(47 /* computedReadOnly */);
|
|
3158
3348
|
}
|
|
3159
3349
|
};
|
|
3160
3350
|
var WrappedSignal = class extends Signal {
|
|
@@ -3221,12 +3411,12 @@ var WrappedSignal = class extends Signal {
|
|
|
3221
3411
|
return super.value;
|
|
3222
3412
|
}
|
|
3223
3413
|
set value(_) {
|
|
3224
|
-
throw qError(
|
|
3414
|
+
throw qError(48 /* wrappedReadOnly */);
|
|
3225
3415
|
}
|
|
3226
3416
|
};
|
|
3227
3417
|
|
|
3228
3418
|
// packages/qwik/src/core/version.ts
|
|
3229
|
-
var version = "2.0.0-alpha.
|
|
3419
|
+
var version = "2.0.0-alpha.6-dev+d848ba5";
|
|
3230
3420
|
|
|
3231
3421
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3232
3422
|
var _SharedContainer = class {
|
|
@@ -4873,7 +5063,7 @@ var vnode_getNode = (vnode) => {
|
|
|
4873
5063
|
assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
|
|
4874
5064
|
return vnode[4 /* node */];
|
|
4875
5065
|
};
|
|
4876
|
-
function vnode_toString(depth =
|
|
5066
|
+
function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
|
|
4877
5067
|
var _a;
|
|
4878
5068
|
let vnode = this;
|
|
4879
5069
|
if (depth === 0) {
|
|
@@ -5070,52 +5260,15 @@ var vnode_getType = (vnode) => {
|
|
|
5070
5260
|
};
|
|
5071
5261
|
var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
|
|
5072
5262
|
1;
|
|
5073
|
-
var aPath = [];
|
|
5074
|
-
var bPath = [];
|
|
5075
|
-
var vnode_documentPosition = (a, b) => {
|
|
5076
|
-
if (a === b) {
|
|
5077
|
-
return 0;
|
|
5078
|
-
}
|
|
5079
|
-
let aDepth = -1;
|
|
5080
|
-
let bDepth = -1;
|
|
5081
|
-
while (a) {
|
|
5082
|
-
a = (aPath[++aDepth] = a)[1 /* parent */];
|
|
5083
|
-
}
|
|
5084
|
-
while (b) {
|
|
5085
|
-
b = (bPath[++bDepth] = b)[1 /* parent */];
|
|
5086
|
-
}
|
|
5087
|
-
while (aDepth >= 0 && bDepth >= 0) {
|
|
5088
|
-
a = aPath[aDepth];
|
|
5089
|
-
b = bPath[bDepth];
|
|
5090
|
-
if (a === b) {
|
|
5091
|
-
aDepth--;
|
|
5092
|
-
bDepth--;
|
|
5093
|
-
} else {
|
|
5094
|
-
let cursor = b;
|
|
5095
|
-
do {
|
|
5096
|
-
cursor = vnode_getNextSibling(cursor);
|
|
5097
|
-
if (cursor === a) {
|
|
5098
|
-
return 1;
|
|
5099
|
-
}
|
|
5100
|
-
} while (cursor);
|
|
5101
|
-
cursor = b;
|
|
5102
|
-
do {
|
|
5103
|
-
cursor = vnode_getPreviousSibling(cursor);
|
|
5104
|
-
if (cursor === a) {
|
|
5105
|
-
return -1;
|
|
5106
|
-
}
|
|
5107
|
-
} while (cursor);
|
|
5108
|
-
return 1;
|
|
5109
|
-
}
|
|
5110
|
-
}
|
|
5111
|
-
return aDepth < bDepth ? -1 : 1;
|
|
5112
|
-
};
|
|
5113
5263
|
var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
5114
5264
|
let projectionDepth = 1;
|
|
5115
5265
|
while (projectionDepth--) {
|
|
5116
5266
|
while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
|
|
5117
|
-
const
|
|
5118
|
-
|
|
5267
|
+
const qSlotParent = vnode_getProp(
|
|
5268
|
+
vHost,
|
|
5269
|
+
QSlotParent,
|
|
5270
|
+
(id) => vnode_locate(rootVNode, id)
|
|
5271
|
+
);
|
|
5119
5272
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
5120
5273
|
if (vProjectionParent) {
|
|
5121
5274
|
projectionDepth++;
|
|
@@ -5665,13 +5818,11 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5665
5818
|
if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
|
|
5666
5819
|
return vNode;
|
|
5667
5820
|
}
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
}
|
|
5821
|
+
vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
|
|
5822
|
+
vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
|
|
5823
|
+
} else {
|
|
5824
|
+
vNode = vnode_getParent(vNode);
|
|
5673
5825
|
}
|
|
5674
|
-
vNode = vnode_getParent(vNode);
|
|
5675
5826
|
}
|
|
5676
5827
|
return null;
|
|
5677
5828
|
}
|
|
@@ -5774,10 +5925,6 @@ var DomContainer = class extends _SharedContainer {
|
|
|
5774
5925
|
|
|
5775
5926
|
// packages/qwik/src/core/shared/shared-serialization.ts
|
|
5776
5927
|
var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
|
|
5777
|
-
var unwrapDeserializerProxy = (value) => {
|
|
5778
|
-
const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
|
|
5779
|
-
return unwrapped ? unwrapped : value;
|
|
5780
|
-
};
|
|
5781
5928
|
var isDeserializerProxy = (value) => {
|
|
5782
5929
|
return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
|
|
5783
5930
|
};
|
|
@@ -5819,13 +5966,13 @@ var DeserializationHandler = class {
|
|
|
5819
5966
|
return value;
|
|
5820
5967
|
}
|
|
5821
5968
|
const container = this.$container$;
|
|
5822
|
-
|
|
5969
|
+
let propValue = allocate(container, typeId, value);
|
|
5970
|
+
if (typeId >= 12 /* Error */) {
|
|
5971
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
5972
|
+
}
|
|
5823
5973
|
Reflect.set(target, property, propValue);
|
|
5824
5974
|
this.$data$[idx] = void 0;
|
|
5825
5975
|
this.$data$[idx + 1] = propValue;
|
|
5826
|
-
if (typeId >= 12 /* Error */) {
|
|
5827
|
-
inflate(container, propValue, typeId, value);
|
|
5828
|
-
}
|
|
5829
5976
|
return propValue;
|
|
5830
5977
|
}
|
|
5831
5978
|
has(target, property) {
|
|
@@ -5860,7 +6007,7 @@ var resolvers = /* @__PURE__ */ new WeakMap();
|
|
|
5860
6007
|
var inflate = (container, target, typeId, data) => {
|
|
5861
6008
|
var _a;
|
|
5862
6009
|
if (typeId === void 0) {
|
|
5863
|
-
return;
|
|
6010
|
+
return target;
|
|
5864
6011
|
}
|
|
5865
6012
|
if (typeId !== 13 /* Object */ && Array.isArray(data)) {
|
|
5866
6013
|
data = _eagerDeserializeArray(container, data);
|
|
@@ -5931,14 +6078,13 @@ var inflate = (container, target, typeId, data) => {
|
|
|
5931
6078
|
case 25 /* Store */:
|
|
5932
6079
|
case 26 /* StoreArray */: {
|
|
5933
6080
|
const [value, flags, effects2, storeEffect] = data;
|
|
5934
|
-
const
|
|
5935
|
-
|
|
5936
|
-
Object.assign(getStoreTarget(target), value);
|
|
6081
|
+
const store = getOrCreateStore(value, flags, container);
|
|
6082
|
+
const storeHandler = getStoreHandler(store);
|
|
5937
6083
|
if (storeEffect) {
|
|
5938
6084
|
effects2[STORE_ARRAY_PROP] = storeEffect;
|
|
5939
6085
|
}
|
|
5940
|
-
|
|
5941
|
-
|
|
6086
|
+
storeHandler.$effects$ = effects2;
|
|
6087
|
+
target = store;
|
|
5942
6088
|
break;
|
|
5943
6089
|
}
|
|
5944
6090
|
case 22 /* Signal */: {
|
|
@@ -6060,6 +6206,7 @@ var inflate = (container, target, typeId, data) => {
|
|
|
6060
6206
|
default:
|
|
6061
6207
|
throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
|
|
6062
6208
|
}
|
|
6209
|
+
return target;
|
|
6063
6210
|
};
|
|
6064
6211
|
var _constants = [
|
|
6065
6212
|
void 0,
|
|
@@ -6127,9 +6274,8 @@ var allocate = (container, typeId, value) => {
|
|
|
6127
6274
|
case 24 /* ComputedSignal */:
|
|
6128
6275
|
return new ComputedSignal(container, null);
|
|
6129
6276
|
case 25 /* Store */:
|
|
6130
|
-
return createStore(container, {}, 0);
|
|
6131
6277
|
case 26 /* StoreArray */:
|
|
6132
|
-
return
|
|
6278
|
+
return null;
|
|
6133
6279
|
case 11 /* URLSearchParams */:
|
|
6134
6280
|
return new URLSearchParams(value);
|
|
6135
6281
|
case 27 /* FormData */:
|
|
@@ -6781,15 +6927,15 @@ function qrlToString(serializationContext, value) {
|
|
|
6781
6927
|
}
|
|
6782
6928
|
return qrlStringInline;
|
|
6783
6929
|
}
|
|
6784
|
-
function deserializeData(container, typeId,
|
|
6930
|
+
function deserializeData(container, typeId, value) {
|
|
6785
6931
|
if (typeId === void 0) {
|
|
6786
|
-
return
|
|
6932
|
+
return value;
|
|
6787
6933
|
}
|
|
6788
|
-
|
|
6934
|
+
let propValue = allocate(container, typeId, value);
|
|
6789
6935
|
if (typeId >= 12 /* Error */) {
|
|
6790
|
-
inflate(container,
|
|
6936
|
+
propValue = inflate(container, propValue, typeId, value);
|
|
6791
6937
|
}
|
|
6792
|
-
return
|
|
6938
|
+
return propValue;
|
|
6793
6939
|
}
|
|
6794
6940
|
function shouldTrackObj(obj) {
|
|
6795
6941
|
return (
|
|
@@ -7533,7 +7679,7 @@ var SsrComponentFrame = class {
|
|
|
7533
7679
|
if ((0, import_core2._isJSXNode)(children)) {
|
|
7534
7680
|
const slotName = this.getSlotName(children);
|
|
7535
7681
|
mapArray_set(this.slots, slotName, children, 0);
|
|
7536
|
-
} else if (Array.isArray(children)) {
|
|
7682
|
+
} else if (Array.isArray(children) && children.length > 0) {
|
|
7537
7683
|
const defaultSlot = [];
|
|
7538
7684
|
for (let i = 0; i < children.length; i++) {
|
|
7539
7685
|
const child = children[i];
|
|
@@ -7548,7 +7694,7 @@ var SsrComponentFrame = class {
|
|
|
7548
7694
|
defaultSlot.push(child);
|
|
7549
7695
|
}
|
|
7550
7696
|
}
|
|
7551
|
-
defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7697
|
+
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
|
|
7552
7698
|
} else {
|
|
7553
7699
|
mapArray_set(this.slots, QDefaultSlot, children, 0);
|
|
7554
7700
|
}
|
|
@@ -8165,12 +8311,12 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8165
8311
|
this.write("<");
|
|
8166
8312
|
this.write(elementName);
|
|
8167
8313
|
if (varAttrs) {
|
|
8168
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false);
|
|
8314
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
8169
8315
|
}
|
|
8170
8316
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
8171
8317
|
import_build10.isDev && this.write('=""');
|
|
8172
8318
|
if (constAttrs && constAttrs.length) {
|
|
8173
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
|
|
8319
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
8174
8320
|
}
|
|
8175
8321
|
this.write(">");
|
|
8176
8322
|
this.lastNode = null;
|
|
@@ -8245,14 +8391,10 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8245
8391
|
}
|
|
8246
8392
|
}
|
|
8247
8393
|
openProjection(attrs) {
|
|
8248
|
-
var _a;
|
|
8249
8394
|
this.openFragment(attrs);
|
|
8250
|
-
const vNode = (_a = this.currentElementFrame) == null ? void 0 : _a.vNodeData;
|
|
8251
|
-
if (vNode) {
|
|
8252
|
-
vNode[0] |= 16 /* SERIALIZE */;
|
|
8253
|
-
}
|
|
8254
8395
|
const componentFrame = this.getComponentFrame();
|
|
8255
8396
|
if (componentFrame) {
|
|
8397
|
+
this.serializationCtx.$addRoot$(componentFrame.componentNode);
|
|
8256
8398
|
componentFrame.projectionDepth++;
|
|
8257
8399
|
}
|
|
8258
8400
|
}
|
|
@@ -8818,7 +8960,7 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8818
8960
|
this.write(element);
|
|
8819
8961
|
}
|
|
8820
8962
|
}
|
|
8821
|
-
writeAttrs(tag, attrs, isConst) {
|
|
8963
|
+
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
8822
8964
|
let innerHTML = void 0;
|
|
8823
8965
|
if (attrs.length) {
|
|
8824
8966
|
for (let i = 0; i < attrs.length; i++) {
|
|
@@ -8827,7 +8969,7 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8827
8969
|
let styleScopedId = null;
|
|
8828
8970
|
if (isSSRUnsafeAttr(key)) {
|
|
8829
8971
|
if (import_build10.isDev) {
|
|
8830
|
-
throw qError(
|
|
8972
|
+
throw qError(50 /* unsafeAttr */);
|
|
8831
8973
|
}
|
|
8832
8974
|
continue;
|
|
8833
8975
|
}
|
|
@@ -8845,7 +8987,7 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8845
8987
|
value(new DomRef(lastNode));
|
|
8846
8988
|
continue;
|
|
8847
8989
|
} else {
|
|
8848
|
-
throw qError(32 /* invalidRefValue
|
|
8990
|
+
throw qError(32 /* invalidRefValue */, [currentFile]);
|
|
8849
8991
|
}
|
|
8850
8992
|
}
|
|
8851
8993
|
if ((0, import_core4.isSignal)(value)) {
|
|
@@ -8865,13 +9007,13 @@ var SSRContainer = class extends import_core4._SharedContainer {
|
|
|
8865
9007
|
}
|
|
8866
9008
|
}
|
|
8867
9009
|
if (tag === "textarea" && key === "value") {
|
|
8868
|
-
if (typeof value !== "string") {
|
|
9010
|
+
if (value && typeof value !== "string") {
|
|
8869
9011
|
if (import_build10.isDev) {
|
|
8870
|
-
throw qError(40 /* wrongTextareaValue
|
|
9012
|
+
throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
|
|
8871
9013
|
}
|
|
8872
9014
|
continue;
|
|
8873
9015
|
}
|
|
8874
|
-
innerHTML = escapeHTML(value);
|
|
9016
|
+
innerHTML = escapeHTML(value || "");
|
|
8875
9017
|
key = QContainerAttr;
|
|
8876
9018
|
value = "text" /* TEXT */;
|
|
8877
9019
|
}
|