@qwik.dev/core 2.0.0-beta.7 → 2.0.0-beta.9
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/backpatch/index.cjs +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/backpatch/package.json +8 -0
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +17 -17
- package/dist/core-internal.d.ts +112 -56
- package/dist/core.cjs +1022 -469
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1018 -469
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +654 -361
- package/dist/core.prod.mjs +729 -373
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +78 -76
- package/dist/optimizer.mjs +78 -78
- package/dist/qwikloader.debug.js +0 -13
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +217 -63
- package/dist/server.d.ts +9 -0
- package/dist/server.mjs +213 -63
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/localize/package.json +3 -3
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/playwright/playwright-report/index.html +943 -903
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/tailwind/package.json +2 -2
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/testing/index.cjs +3826 -952
- package/dist/testing/index.d.ts +972 -1
- package/dist/testing/index.mjs +3811 -946
- package/dist/testing/package.json +1 -1
- package/package.json +8 -6
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
package/dist/core.prod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.9-dev+6b582c7
|
|
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
|
|
@@ -11,6 +11,8 @@ export { isBrowser, isDev, isServer } from "@qwik.dev/core/build";
|
|
|
11
11
|
|
|
12
12
|
import { p } from "@qwik.dev/core/preloader";
|
|
13
13
|
|
|
14
|
+
const version = "2.0.0-beta.9-dev+6b582c7";
|
|
15
|
+
|
|
14
16
|
const qDev = !1;
|
|
15
17
|
|
|
16
18
|
const qInspector = !1;
|
|
@@ -66,6 +68,8 @@ const isArray = v => Array.isArray(v);
|
|
|
66
68
|
|
|
67
69
|
const isString = v => "string" == typeof v;
|
|
68
70
|
|
|
71
|
+
const isNumber$1 = v => "number" == typeof v;
|
|
72
|
+
|
|
69
73
|
const isFunction = v => "function" == typeof v;
|
|
70
74
|
|
|
71
75
|
const isPrimitive = v => "object" != typeof v && "function" != typeof v && null != v;
|
|
@@ -222,11 +226,6 @@ const createPlatform = () => ({
|
|
|
222
226
|
resolve(fn());
|
|
223
227
|
});
|
|
224
228
|
}),
|
|
225
|
-
nextTick: fn => new Promise(resolve => {
|
|
226
|
-
setTimeout(() => {
|
|
227
|
-
resolve(fn());
|
|
228
|
-
});
|
|
229
|
-
}),
|
|
230
229
|
chunkForSymbol: (symbolName, chunk) => [ symbolName, chunk ?? "_" ]
|
|
231
230
|
});
|
|
232
231
|
|
|
@@ -360,6 +359,9 @@ class SignalImpl {
|
|
|
360
359
|
constructor(container, value) {
|
|
361
360
|
this.$container$ = container, this.$untrackedValue$ = value;
|
|
362
361
|
}
|
|
362
|
+
force() {
|
|
363
|
+
this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
364
|
+
}
|
|
363
365
|
get untrackedValue() {
|
|
364
366
|
return this.$untrackedValue$;
|
|
365
367
|
}
|
|
@@ -370,7 +372,7 @@ class SignalImpl {
|
|
|
370
372
|
return setupSignalValueAccess(this, () => this.$effects$ ||= new Set, () => this.untrackedValue);
|
|
371
373
|
}
|
|
372
374
|
set value(value) {
|
|
373
|
-
value !== this.$untrackedValue$ && (this.$untrackedValue$ = value,
|
|
375
|
+
value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, this.$container$?.$scheduler$(7, null, this, this.$effects$));
|
|
374
376
|
}
|
|
375
377
|
valueOf() {
|
|
376
378
|
qDev;
|
|
@@ -413,30 +415,27 @@ class WrappedSignalImpl extends SignalImpl {
|
|
|
413
415
|
$funcStr$;
|
|
414
416
|
$flags$;
|
|
415
417
|
$hostElement$=null;
|
|
416
|
-
$forceRunEffects$=!1;
|
|
417
418
|
[_EFFECT_BACK_REF]=null;
|
|
418
|
-
constructor(container, fn, args, fnStr, flags =
|
|
419
|
+
constructor(container, fn, args, fnStr, flags = 5) {
|
|
419
420
|
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
|
|
420
421
|
this.$flags$ = flags;
|
|
421
422
|
}
|
|
422
423
|
invalidate() {
|
|
423
|
-
this.$flags$ |= 1, this.$
|
|
424
|
+
this.$flags$ |= 1, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
424
425
|
}
|
|
425
426
|
force() {
|
|
426
|
-
this.$
|
|
427
|
+
this.$flags$ |= 2, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
427
428
|
}
|
|
428
429
|
get untrackedValue() {
|
|
429
|
-
|
|
430
|
-
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
430
|
+
return this.$computeIfNeeded$(), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
431
431
|
this.$untrackedValue$;
|
|
432
432
|
}
|
|
433
433
|
$computeIfNeeded$() {
|
|
434
434
|
if (!(1 & this.$flags$)) {
|
|
435
|
-
return
|
|
435
|
+
return;
|
|
436
436
|
}
|
|
437
437
|
const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
|
|
438
|
-
|
|
439
|
-
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
438
|
+
untrackedValue !== this.$untrackedValue$ && (this.$flags$ |= 2, this.$untrackedValue$ = untrackedValue);
|
|
440
439
|
}
|
|
441
440
|
set value(_) {
|
|
442
441
|
throw qError(31);
|
|
@@ -581,12 +580,17 @@ const _getContextContainer = () => {
|
|
|
581
580
|
const _jsxBranch = input => input;
|
|
582
581
|
|
|
583
582
|
const _waitUntilRendered = elm => {
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
583
|
+
const container = _getQContainerElement(elm)?.qContainer;
|
|
584
|
+
return container ? (async () => {
|
|
585
|
+
for (;;) {
|
|
586
|
+
await container.$scheduler$(255).$returnValue$;
|
|
587
|
+
const firstEpoch = container.$flushEpoch$ || 0;
|
|
588
|
+
await Promise.resolve();
|
|
589
|
+
if (firstEpoch === (container.$flushEpoch$ || 0)) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
})() : Promise.resolve();
|
|
590
594
|
};
|
|
591
595
|
|
|
592
596
|
const useSequentialScope = () => {
|
|
@@ -717,8 +721,6 @@ const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
|
|
|
717
721
|
|
|
718
722
|
const isRecoverable = err => !(err && err instanceof Error && "plugin" in err);
|
|
719
723
|
|
|
720
|
-
const version = "2.0.0-beta.7-dev+2dd89a6";
|
|
721
|
-
|
|
722
724
|
const EMPTY_ARRAY = [];
|
|
723
725
|
|
|
724
726
|
const EMPTY_OBJ = {};
|
|
@@ -799,7 +801,7 @@ const useLexicalScope = () => {
|
|
|
799
801
|
return qrl.$captureRef$;
|
|
800
802
|
};
|
|
801
803
|
|
|
802
|
-
const
|
|
804
|
+
const _run = (...args) => {
|
|
803
805
|
const [runQrl] = useLexicalScope();
|
|
804
806
|
const context = getInvokeContext();
|
|
805
807
|
const hostElement = context.$hostElement$;
|
|
@@ -810,7 +812,8 @@ const queueQRL = (...args) => {
|
|
|
810
812
|
if (!scheduler) {
|
|
811
813
|
throw qError(1);
|
|
812
814
|
}
|
|
813
|
-
|
|
815
|
+
const chore = scheduler(2, hostElement, runQrl, args);
|
|
816
|
+
return getChorePromise(chore);
|
|
814
817
|
};
|
|
815
818
|
|
|
816
819
|
const mapApp_findIndx = (array, key, start) => {
|
|
@@ -828,9 +831,9 @@ const mapApp_findIndx = (array, key, start) => {
|
|
|
828
831
|
return ~(bottom << 1);
|
|
829
832
|
};
|
|
830
833
|
|
|
831
|
-
const mapArray_set = (array, key, value, start) => {
|
|
834
|
+
const mapArray_set = (array, key, value, start, allowNullValue = !1) => {
|
|
832
835
|
const indx = mapApp_findIndx(array, key, start);
|
|
833
|
-
indx >= 0 ? null
|
|
836
|
+
indx >= 0 ? null != value || allowNullValue ? array[indx + 1] = value : array.splice(indx, 2) : (null != value || allowNullValue) && array.splice(-1 ^ indx, 0, key, value);
|
|
834
837
|
};
|
|
835
838
|
|
|
836
839
|
const mapArray_get = (array, key, start) => {
|
|
@@ -838,6 +841,8 @@ const mapArray_get = (array, key, start) => {
|
|
|
838
841
|
return indx >= 0 ? array[indx + 1] : null;
|
|
839
842
|
};
|
|
840
843
|
|
|
844
|
+
const mapArray_has = (array, key, start) => mapApp_findIndx(array, key, start) >= 0;
|
|
845
|
+
|
|
841
846
|
const _CONST_PROPS = Symbol("CONST");
|
|
842
847
|
|
|
843
848
|
const _VAR_PROPS = Symbol("VAR");
|
|
@@ -857,25 +862,23 @@ const log = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToS
|
|
|
857
862
|
class ComputedSignalImpl extends SignalImpl {
|
|
858
863
|
$computeQrl$;
|
|
859
864
|
$flags$;
|
|
860
|
-
$forceRunEffects$=!1;
|
|
861
865
|
[_EFFECT_BACK_REF]=null;
|
|
862
|
-
constructor(container, fn, flags =
|
|
866
|
+
constructor(container, fn, flags = 33) {
|
|
863
867
|
super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
|
|
864
868
|
}
|
|
865
869
|
invalidate() {
|
|
866
|
-
this.$flags$ |= 1, this.$
|
|
870
|
+
this.$flags$ |= 1, this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
867
871
|
}
|
|
868
872
|
force() {
|
|
869
|
-
this.$
|
|
873
|
+
this.$flags$ |= 2, super.force();
|
|
870
874
|
}
|
|
871
875
|
get untrackedValue() {
|
|
872
|
-
|
|
873
|
-
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
876
|
+
return this.$computeIfNeeded$(), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
874
877
|
this.$untrackedValue$;
|
|
875
878
|
}
|
|
876
879
|
$computeIfNeeded$() {
|
|
877
880
|
if (!(1 & this.$flags$)) {
|
|
878
|
-
return
|
|
881
|
+
return;
|
|
879
882
|
}
|
|
880
883
|
const computeQrl = this.$computeQrl$;
|
|
881
884
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -888,8 +891,8 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
888
891
|
throw qError(29, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
|
|
889
892
|
}
|
|
890
893
|
this.$flags$ &= -2;
|
|
891
|
-
|
|
892
|
-
|
|
894
|
+
untrackedValue !== this.$untrackedValue$ && (this.$untrackedValue$ !== NEEDS_COMPUTATION && (this.$flags$ |= 2),
|
|
895
|
+
this.$untrackedValue$ = untrackedValue);
|
|
893
896
|
} finally {
|
|
894
897
|
ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
|
|
895
898
|
}
|
|
@@ -904,12 +907,12 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
904
907
|
|
|
905
908
|
class SerializerSignalImpl extends ComputedSignalImpl {
|
|
906
909
|
constructor(container, argQrl) {
|
|
907
|
-
super(container, argQrl,
|
|
910
|
+
super(container, argQrl, 33);
|
|
908
911
|
}
|
|
909
912
|
$didInitialize$=!1;
|
|
910
913
|
$computeIfNeeded$() {
|
|
911
914
|
if (!(1 & this.$flags$)) {
|
|
912
|
-
return
|
|
915
|
+
return;
|
|
913
916
|
}
|
|
914
917
|
throwIfQRLNotResolved(this.$computeQrl$);
|
|
915
918
|
let arg = this.$computeQrl$.resolved;
|
|
@@ -919,8 +922,8 @@ class SerializerSignalImpl extends ComputedSignalImpl {
|
|
|
919
922
|
const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
|
|
920
923
|
const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) || currentValue : deserialize(currentValue), this, ".", this.$container$);
|
|
921
924
|
const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
|
|
922
|
-
|
|
923
|
-
|
|
925
|
+
this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$flags$ |= 2,
|
|
926
|
+
this.$untrackedValue$ = untrackedValue);
|
|
924
927
|
}
|
|
925
928
|
}
|
|
926
929
|
|
|
@@ -928,6 +931,16 @@ const getStoreHandler = value => value[STORE_HANDLER];
|
|
|
928
931
|
|
|
929
932
|
const getStoreTarget = value => value?.[STORE_TARGET] || null;
|
|
930
933
|
|
|
934
|
+
const forceStoreEffects = (value, prop) => {
|
|
935
|
+
const handler = getStoreHandler(value);
|
|
936
|
+
handler && handler.force(prop);
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
const _hasStoreEffects = (value, prop) => {
|
|
940
|
+
const handler = getStoreHandler(value);
|
|
941
|
+
return !!handler && (handler.$effects$?.get(prop)?.size ?? 0) > 0;
|
|
942
|
+
};
|
|
943
|
+
|
|
931
944
|
const unwrapStore = value => getStoreTarget(value) || value;
|
|
932
945
|
|
|
933
946
|
const isStore = value => STORE_TARGET in value;
|
|
@@ -955,6 +968,10 @@ class StoreHandler {
|
|
|
955
968
|
toString() {
|
|
956
969
|
return "[Store]";
|
|
957
970
|
}
|
|
971
|
+
force(prop) {
|
|
972
|
+
const target = getStoreTarget(this);
|
|
973
|
+
this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$));
|
|
974
|
+
}
|
|
958
975
|
get(target, prop) {
|
|
959
976
|
if ("symbol" == typeof prop) {
|
|
960
977
|
return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
|
|
@@ -991,7 +1008,7 @@ class StoreHandler {
|
|
|
991
1008
|
return !0;
|
|
992
1009
|
}
|
|
993
1010
|
deleteProperty(target, prop) {
|
|
994
|
-
return "string" == typeof prop && delete target[prop] && (
|
|
1011
|
+
return "string" == typeof prop && delete target[prop] && (Array.isArray(target) || this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$)),
|
|
995
1012
|
!0);
|
|
996
1013
|
}
|
|
997
1014
|
has(target, prop) {
|
|
@@ -1030,7 +1047,9 @@ function addStoreEffect(target, prop, store, effectSubscription) {
|
|
|
1030
1047
|
}
|
|
1031
1048
|
|
|
1032
1049
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
1033
|
-
target[prop] = value
|
|
1050
|
+
target[prop] = value;
|
|
1051
|
+
const effects = getEffects(target, prop, currentStore.$effects$);
|
|
1052
|
+
effects && currentStore.$container$?.$scheduler$(7, null, currentStore, effects);
|
|
1034
1053
|
}
|
|
1035
1054
|
|
|
1036
1055
|
function getEffects(target, prop, storeEffects) {
|
|
@@ -1127,7 +1146,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
|
|
|
1127
1146
|
}
|
|
1128
1147
|
$computeIfNeeded$() {
|
|
1129
1148
|
if (!(1 & this.$flags$)) {
|
|
1130
|
-
return
|
|
1149
|
+
return;
|
|
1131
1150
|
}
|
|
1132
1151
|
const computeQrl = this.$computeQrl$;
|
|
1133
1152
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -1145,7 +1164,8 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
|
|
|
1145
1164
|
}
|
|
1146
1165
|
this.$promiseValue$ = NEEDS_COMPUTATION, this.$flags$ &= -2;
|
|
1147
1166
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
1148
|
-
return didChange && (this.$untrackedValue$ = untrackedValue),
|
|
1167
|
+
return didChange && (this.$flags$ |= 2, this.$untrackedValue$ = untrackedValue),
|
|
1168
|
+
didChange;
|
|
1149
1169
|
}
|
|
1150
1170
|
}
|
|
1151
1171
|
|
|
@@ -1179,7 +1199,7 @@ const _wrapProp = (...args) => {
|
|
|
1179
1199
|
}
|
|
1180
1200
|
if (isSignal(obj)) {
|
|
1181
1201
|
return obj instanceof AsyncComputedSignalImpl || assertEqual(prop, "value", "Left side is a signal, prop must be value"),
|
|
1182
|
-
obj instanceof WrappedSignalImpl &&
|
|
1202
|
+
obj instanceof WrappedSignalImpl && 4 & obj.flags ? obj : getWrapped(args);
|
|
1183
1203
|
}
|
|
1184
1204
|
if (isPropsProxy(obj)) {
|
|
1185
1205
|
const constProps = obj[_CONST_PROPS];
|
|
@@ -1218,7 +1238,7 @@ function isSlotProp(prop) {
|
|
|
1218
1238
|
return !prop.startsWith("q:") && !prop.startsWith(":");
|
|
1219
1239
|
}
|
|
1220
1240
|
|
|
1221
|
-
const _restProps = (props, omit, target = {}) => {
|
|
1241
|
+
const _restProps = (props, omit = [], target = {}) => {
|
|
1222
1242
|
let constPropsTarget = null;
|
|
1223
1243
|
const constProps = props[_CONST_PROPS];
|
|
1224
1244
|
if (constProps) {
|
|
@@ -1498,8 +1518,8 @@ function addUseOnEvents(jsx, useOnEvents) {
|
|
|
1498
1518
|
}
|
|
1499
1519
|
targetElement = placeholderElement;
|
|
1500
1520
|
}
|
|
1501
|
-
targetElement && ("script" === targetElement.type && "onQvisible$" === key && (eventKey = "document:
|
|
1502
|
-
logWarn('You are trying to add an event "' + key + '" using `useVisibleTask$` hook, but a node to which you can add an event is not found. Using document:
|
|
1521
|
+
targetElement && ("script" === targetElement.type && "onQvisible$" === key && (eventKey = "document:onQInit$",
|
|
1522
|
+
logWarn('You are trying to add an event "' + key + '" using `useVisibleTask$` hook, but a node to which you can add an event is not found. Using document:onQInit$ instead.')),
|
|
1503
1523
|
addUseOnEvent(targetElement, eventKey, useOnEvents[key]));
|
|
1504
1524
|
}
|
|
1505
1525
|
}
|
|
@@ -1571,10 +1591,10 @@ const applyQwikComponentBody = (ssr, jsx, component) => {
|
|
|
1571
1591
|
const host = ssr.getOrCreateLastNode();
|
|
1572
1592
|
const [componentQrl] = component[SERIALIZABLE_STATE];
|
|
1573
1593
|
const srcProps = jsx.props;
|
|
1574
|
-
srcProps && srcProps.children && delete srcProps.children
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1594
|
+
srcProps && srcProps.children && delete srcProps.children, host.setProp("q:renderFn", componentQrl),
|
|
1595
|
+
host.setProp("q:props", srcProps), null !== jsx.key && host.setProp("q:key", jsx.key);
|
|
1596
|
+
const componentChore = ssr.$scheduler$(6, host, componentQrl, srcProps);
|
|
1597
|
+
return getChorePromise(componentChore);
|
|
1578
1598
|
};
|
|
1579
1599
|
|
|
1580
1600
|
class ParentComponentData {
|
|
@@ -1656,7 +1676,14 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
1656
1676
|
appendClassIfScopedStyleExists(jsx, options.styleScoped);
|
|
1657
1677
|
let qwikInspectorAttrValue = null;
|
|
1658
1678
|
isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
|
|
1659
|
-
const innerHTML = ssr.openElement(type, varPropsToSsrAttrs(jsx.varProps, jsx.constProps,
|
|
1679
|
+
const innerHTML = ssr.openElement(type, varPropsToSsrAttrs(jsx.varProps, jsx.constProps, {
|
|
1680
|
+
serializationCtx: ssr.serializationCtx,
|
|
1681
|
+
styleScopedId: options.styleScoped,
|
|
1682
|
+
key: jsx.key
|
|
1683
|
+
}), constPropsToSsrAttrs(jsx.constProps, jsx.varProps, {
|
|
1684
|
+
serializationCtx: ssr.serializationCtx,
|
|
1685
|
+
styleScopedId: options.styleScoped
|
|
1686
|
+
}), qwikInspectorAttrValue);
|
|
1660
1687
|
innerHTML && ssr.htmlNode(innerHTML), enqueue(ssr.closeElement), "head" === type ? (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1661
1688
|
ssr.emitPreloaderPre(), enqueue(ssr.additionalHeadNodes)) : "body" === type ? enqueue(ssr.additionalBodyNodes) : ssr.isHtml || ssr._didAddQwikLoader || (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1662
1689
|
ssr.emitPreloaderPre(), ssr._didAddQwikLoader = !0);
|
|
@@ -1724,18 +1751,19 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
1724
1751
|
}
|
|
1725
1752
|
}
|
|
1726
1753
|
|
|
1727
|
-
function varPropsToSsrAttrs(varProps, constProps,
|
|
1728
|
-
return toSsrAttrs(varProps, constProps,
|
|
1754
|
+
function varPropsToSsrAttrs(varProps, constProps, options) {
|
|
1755
|
+
return toSsrAttrs(varProps, constProps, !1, options);
|
|
1729
1756
|
}
|
|
1730
1757
|
|
|
1731
|
-
function constPropsToSsrAttrs(constProps, varProps,
|
|
1732
|
-
return toSsrAttrs(constProps, varProps,
|
|
1758
|
+
function constPropsToSsrAttrs(constProps, varProps, options) {
|
|
1759
|
+
return toSsrAttrs(constProps, varProps, !0, options);
|
|
1733
1760
|
}
|
|
1734
1761
|
|
|
1735
|
-
function toSsrAttrs(record, anotherRecord,
|
|
1762
|
+
function toSsrAttrs(record, anotherRecord, isConst, options) {
|
|
1736
1763
|
if (null == record) {
|
|
1737
1764
|
return null;
|
|
1738
1765
|
}
|
|
1766
|
+
const pushMergedEventProps = !isConst;
|
|
1739
1767
|
const ssrAttrs = [];
|
|
1740
1768
|
for (const key in record) {
|
|
1741
1769
|
let value = record[key];
|
|
@@ -1749,14 +1777,14 @@ function toSsrAttrs(record, anotherRecord, serializationCtx, pushMergedEventProp
|
|
|
1749
1777
|
value = getMergedEventPropValues(value, anotherValue);
|
|
1750
1778
|
}
|
|
1751
1779
|
}
|
|
1752
|
-
const eventValue = setEvent(serializationCtx, key, value);
|
|
1780
|
+
const eventValue = setEvent(options.serializationCtx, key, value);
|
|
1753
1781
|
eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
|
|
1754
1782
|
continue;
|
|
1755
1783
|
}
|
|
1756
|
-
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
|
|
1757
|
-
value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
|
|
1784
|
+
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, options.styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(options.serializationCtx, key),
|
|
1785
|
+
value = serializeAttribute(key, value, options.styleScopedId), ssrAttrs.push(key, value));
|
|
1758
1786
|
}
|
|
1759
|
-
return null != key && ssrAttrs.push("q:key", key), ssrAttrs;
|
|
1787
|
+
return null != options.key && ssrAttrs.push("q:key", options.key), ssrAttrs;
|
|
1760
1788
|
}
|
|
1761
1789
|
|
|
1762
1790
|
function getMergedEventPropValues(value, anotherValue) {
|
|
@@ -1781,7 +1809,7 @@ function setEvent(serializationCtx, key, rawValue) {
|
|
|
1781
1809
|
const appendToValue = valueToAppend => {
|
|
1782
1810
|
value = (null == value ? "" : value + "\n") + valueToAppend;
|
|
1783
1811
|
};
|
|
1784
|
-
const getQrlString = qrl => (qrl.$symbol$.startsWith("_") || !qrl.$captureRef$ && !qrl.$capture$ || (qrl = createQRL(null, "_run",
|
|
1812
|
+
const getQrlString = qrl => (qrl.$symbol$.startsWith("_") || !qrl.$captureRef$ && !qrl.$capture$ || (qrl = createQRL(null, "_run", _run, null, null, [ qrl ])),
|
|
1785
1813
|
qrlToString(serializationCtx, qrl));
|
|
1786
1814
|
if (Array.isArray(qrls)) {
|
|
1787
1815
|
for (let i = 0; i <= qrls.length; i++) {
|
|
@@ -1837,8 +1865,10 @@ const useTaskQrl = qrl => {
|
|
|
1837
1865
|
assertQrl(qrl), set(1);
|
|
1838
1866
|
const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
1839
1867
|
set(task);
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1868
|
+
const result = runTask(task, iCtx.$container$, iCtx.$hostElement$);
|
|
1869
|
+
if (isPromise(result)) {
|
|
1870
|
+
throw result;
|
|
1871
|
+
}
|
|
1842
1872
|
};
|
|
1843
1873
|
|
|
1844
1874
|
const runTask = (task, container, host) => {
|
|
@@ -1889,7 +1919,7 @@ const isTask = value => value instanceof Task;
|
|
|
1889
1919
|
|
|
1890
1920
|
const scheduleTask = (_event, element) => {
|
|
1891
1921
|
const [task] = useLexicalScope();
|
|
1892
|
-
const type = 1 & task.$flags$ ?
|
|
1922
|
+
const type = 1 & task.$flags$ ? 16 : 3;
|
|
1893
1923
|
getDomContainer(element).$scheduler$(type, task);
|
|
1894
1924
|
};
|
|
1895
1925
|
|
|
@@ -2010,7 +2040,7 @@ class PropsProxyHandler {
|
|
|
2010
2040
|
return this.$children$;
|
|
2011
2041
|
}
|
|
2012
2042
|
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
2013
|
-
return value instanceof WrappedSignalImpl &&
|
|
2043
|
+
return value instanceof WrappedSignalImpl && 4 & value.$flags$ ? value.value : value;
|
|
2014
2044
|
}
|
|
2015
2045
|
set(_, prop, value) {
|
|
2016
2046
|
return prop === _CONST_PROPS ? (this.$constProps$ = value, !0) : prop === _VAR_PROPS ? (this.$varProps$ = value,
|
|
@@ -2049,6 +2079,13 @@ class PropsProxyHandler {
|
|
|
2049
2079
|
|
|
2050
2080
|
const directGetPropsProxyProp = (jsx, prop) => jsx.constProps && prop in jsx.constProps ? jsx.constProps[prop] : jsx.varProps[prop];
|
|
2051
2081
|
|
|
2082
|
+
const _getVarProps = props => props ? _VAR_PROPS in props ? "children" in props ? {
|
|
2083
|
+
...props[_VAR_PROPS],
|
|
2084
|
+
children: props.children
|
|
2085
|
+
} : props[_VAR_PROPS] : props : null;
|
|
2086
|
+
|
|
2087
|
+
const _getConstProps = props => props && _CONST_PROPS in props ? props[_CONST_PROPS] : null;
|
|
2088
|
+
|
|
2052
2089
|
const isForeignObjectElement = elementName => isDev ? "foreignobject" === elementName.toLowerCase() : "foreignObject" === elementName;
|
|
2053
2090
|
|
|
2054
2091
|
const isSvgElement = elementName => "svg" === elementName || isForeignObjectElement(elementName);
|
|
@@ -2266,36 +2303,38 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2266
2303
|
}
|
|
2267
2304
|
}();
|
|
2268
2305
|
function diff(jsxNode, vStartNode) {
|
|
2269
|
-
|
|
2306
|
+
if (assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode"), assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode"),
|
|
2270
2307
|
vParent = vStartNode, vNewNode = null, vCurrent = vnode_getFirstChild(vStartNode),
|
|
2271
|
-
stackPush(jsxNode, !0)
|
|
2272
|
-
for (;
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
if (
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2308
|
+
stackPush(jsxNode, !0), !(32 & vParent[0])) {
|
|
2309
|
+
for (;stack.length; ) {
|
|
2310
|
+
for (;jsxIdx < jsxCount; ) {
|
|
2311
|
+
if (assertFalse(vParent === vCurrent, "Parent and current can't be the same"), "string" == typeof jsxValue) {
|
|
2312
|
+
expectText(jsxValue);
|
|
2313
|
+
} else if ("number" == typeof jsxValue) {
|
|
2314
|
+
expectText(String(jsxValue));
|
|
2315
|
+
} else if (jsxValue && "object" == typeof jsxValue) {
|
|
2316
|
+
if (Array.isArray(jsxValue)) {
|
|
2317
|
+
descend(jsxValue, !1);
|
|
2318
|
+
} else if (isSignal(jsxValue)) {
|
|
2319
|
+
vCurrent && clearAllEffects(container, vCurrent), expectVirtual("S", null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), !0);
|
|
2320
|
+
} else if (isPromise(jsxValue)) {
|
|
2321
|
+
expectVirtual("A", null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
2322
|
+
} else if (isJSXNode(jsxValue)) {
|
|
2323
|
+
const type = jsxValue.type;
|
|
2324
|
+
"string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type),
|
|
2325
|
+
descend(jsxValue.children, !0)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(),
|
|
2326
|
+
expectVirtual("F", jsxValue.key), descend(jsxValue.children, !0)) : type === Slot ? (expectNoMoreTextNodes(),
|
|
2327
|
+
expectSlot() || descend(jsxValue.children, !0)) : type === Projection ? (expectProjection(),
|
|
2328
|
+
descend(jsxValue.children, !0)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(),
|
|
2329
|
+
expectComponent(type)));
|
|
2330
|
+
}
|
|
2331
|
+
} else {
|
|
2332
|
+
jsxValue === SkipRender ? journal = [] : expectText("");
|
|
2292
2333
|
}
|
|
2293
|
-
|
|
2294
|
-
jsxValue === SkipRender ? journal = [] : expectText("");
|
|
2334
|
+
advance();
|
|
2295
2335
|
}
|
|
2296
|
-
|
|
2336
|
+
expectNoMore(), ascend();
|
|
2297
2337
|
}
|
|
2298
|
-
expectNoMore(), ascend();
|
|
2299
2338
|
}
|
|
2300
2339
|
}
|
|
2301
2340
|
function advance() {
|
|
@@ -2458,7 +2497,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2458
2497
|
element.value = escapeHTML(value || "");
|
|
2459
2498
|
}
|
|
2460
2499
|
} else {
|
|
2461
|
-
element.innerHTML = value, element.setAttribute("q:container", "html");
|
|
2500
|
+
value && (element.innerHTML = String(value), element.setAttribute("q:container", "html"));
|
|
2462
2501
|
}
|
|
2463
2502
|
}
|
|
2464
2503
|
}
|
|
@@ -2557,8 +2596,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2557
2596
|
let returnValue = !1;
|
|
2558
2597
|
return qrls.flat(2).forEach(qrl => {
|
|
2559
2598
|
if (qrl) {
|
|
2560
|
-
|
|
2561
|
-
|
|
2599
|
+
if (isSyncQrl(qrl)) {
|
|
2600
|
+
qrl(event, element);
|
|
2601
|
+
} else {
|
|
2602
|
+
const value = container.$scheduler$(2, vNode, qrl, [ event, element ]);
|
|
2603
|
+
returnValue = returnValue || !0 === value;
|
|
2604
|
+
}
|
|
2562
2605
|
}
|
|
2563
2606
|
}), returnValue;
|
|
2564
2607
|
}));
|
|
@@ -2753,7 +2796,7 @@ function cleanup(container, vNode) {
|
|
|
2753
2796
|
const obj = seq[i];
|
|
2754
2797
|
if (isTask(obj)) {
|
|
2755
2798
|
const task = obj;
|
|
2756
|
-
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(
|
|
2799
|
+
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(32, task) : cleanupTask(task);
|
|
2757
2800
|
}
|
|
2758
2801
|
}
|
|
2759
2802
|
}
|
|
@@ -2779,7 +2822,9 @@ function cleanup(container, vNode) {
|
|
|
2779
2822
|
if (vCursor === vNode) {
|
|
2780
2823
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
2781
2824
|
if (vFirstChild) {
|
|
2782
|
-
return void vnode_walkVNode(vFirstChild
|
|
2825
|
+
return void vnode_walkVNode(vFirstChild, vNode => {
|
|
2826
|
+
2 & vNode[0] && vnode_getProp(vNode, "q:sparent", id => vnode_locate(container.rootVNode, id));
|
|
2827
|
+
});
|
|
2783
2828
|
}
|
|
2784
2829
|
}
|
|
2785
2830
|
} else {
|
|
@@ -2840,8 +2885,9 @@ const useResourceQrl = (qrl, opts) => {
|
|
|
2840
2885
|
assertQrl(qrl);
|
|
2841
2886
|
const container = iCtx.$container$;
|
|
2842
2887
|
const resource = createResourceReturn(container, opts);
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2888
|
+
const el = iCtx.$hostElement$;
|
|
2889
|
+
const task = new Task(12, i, el, qrl, resource, null);
|
|
2890
|
+
return set(resource), runResource(task, container, el), resource;
|
|
2845
2891
|
};
|
|
2846
2892
|
|
|
2847
2893
|
const Resource = props => _jsxSorted(Fragment, null, null, getResourceValueAsPromise(props), 0, null);
|
|
@@ -2849,8 +2895,8 @@ const Resource = props => _jsxSorted(Fragment, null, null, getResourceValueAsPro
|
|
|
2849
2895
|
function getResourceValueAsPromise(props) {
|
|
2850
2896
|
const resource = props.value;
|
|
2851
2897
|
if (isResourceReturn(resource)) {
|
|
2898
|
+
const state = resource._state;
|
|
2852
2899
|
if (!isServerPlatform()) {
|
|
2853
|
-
const state = resource._state;
|
|
2854
2900
|
if ("pending" === state && props.onPending) {
|
|
2855
2901
|
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
2856
2902
|
}
|
|
@@ -2864,8 +2910,7 @@ function getResourceValueAsPromise(props) {
|
|
|
2864
2910
|
}
|
|
2865
2911
|
}
|
|
2866
2912
|
}
|
|
2867
|
-
|
|
2868
|
-
return value ? value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : Promise.resolve(void 0);
|
|
2913
|
+
return untrack(() => resource.value).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
2869
2914
|
}
|
|
2870
2915
|
if (isPromise(resource)) {
|
|
2871
2916
|
return resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
@@ -2918,21 +2963,21 @@ const runResource = (task, container, host) => {
|
|
|
2918
2963
|
let reject;
|
|
2919
2964
|
let done = !1;
|
|
2920
2965
|
const setState = (resolved, value) => !done && (done = !0, resolved ? (done = !0,
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2966
|
+
resourceTarget.loading = !1, resourceTarget._state = "resolved", resourceTarget._resolved = value,
|
|
2967
|
+
resourceTarget._error = void 0, resolve(value)) : (done = !0, resourceTarget.loading = !1,
|
|
2968
|
+
resourceTarget._state = "rejected", resourceTarget._error = value, reject(value)),
|
|
2969
|
+
isServerPlatform() || forceStoreEffects(resource, "_state"), !0);
|
|
2924
2970
|
cleanups.push(() => {
|
|
2925
2971
|
if (!0 === untrack(() => resource.loading)) {
|
|
2926
2972
|
const value = untrack(() => resource._resolved);
|
|
2927
2973
|
setState(!0, value);
|
|
2928
2974
|
}
|
|
2929
2975
|
}), invoke(iCtx, () => {
|
|
2930
|
-
resource._state = "pending", resource.loading = !isServerPlatform()
|
|
2931
|
-
(resource.value = new Promise((r, re) => {
|
|
2976
|
+
resource._state = "pending", resource.loading = !isServerPlatform(), resource.value = new Promise((r, re) => {
|
|
2932
2977
|
resolve = r, reject = re;
|
|
2933
|
-
})
|
|
2978
|
+
});
|
|
2934
2979
|
});
|
|
2935
|
-
const promise = safeCall(() =>
|
|
2980
|
+
const promise = safeCall(() => taskFn(opts), value => {
|
|
2936
2981
|
setState(!0, value);
|
|
2937
2982
|
}, err => {
|
|
2938
2983
|
if (isPromise(err)) {
|
|
@@ -2946,8 +2991,6 @@ const runResource = (task, container, host) => {
|
|
|
2946
2991
|
}) ]) : promise;
|
|
2947
2992
|
};
|
|
2948
2993
|
|
|
2949
|
-
const ignoreErrorToPreventNodeFromCrashing = () => {};
|
|
2950
|
-
|
|
2951
2994
|
const aVNodePath = [];
|
|
2952
2995
|
|
|
2953
2996
|
const bVNodePath = [];
|
|
@@ -2996,10 +3039,10 @@ const ssrNodeDocumentPosition = (a, b) => {
|
|
|
2996
3039
|
let aDepth = -1;
|
|
2997
3040
|
let bDepth = -1;
|
|
2998
3041
|
for (;a; ) {
|
|
2999
|
-
a = (aSsrNodePath[++aDepth] = a).
|
|
3042
|
+
a = (aSsrNodePath[++aDepth] = a).parentComponent;
|
|
3000
3043
|
}
|
|
3001
3044
|
for (;b; ) {
|
|
3002
|
-
b = (bSsrNodePath[++bDepth] = b).
|
|
3045
|
+
b = (bSsrNodePath[++bDepth] = b).parentComponent;
|
|
3003
3046
|
}
|
|
3004
3047
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
3005
3048
|
if ((a = aSsrNodePath[aDepth]) !== (b = bSsrNodePath[bDepth])) {
|
|
@@ -3010,26 +3053,199 @@ const ssrNodeDocumentPosition = (a, b) => {
|
|
|
3010
3053
|
return aDepth < bDepth ? -1 : 1;
|
|
3011
3054
|
};
|
|
3012
3055
|
|
|
3056
|
+
const VISIBLE_BLOCKING_RULES = [ {
|
|
3057
|
+
blockedType: 16,
|
|
3058
|
+
blockingType: 4,
|
|
3059
|
+
match: (blocked, blocking, container) => isDescendant(blocked, blocking, container) || isDescendant(blocking, blocked, container)
|
|
3060
|
+
}, {
|
|
3061
|
+
blockedType: 16,
|
|
3062
|
+
blockingType: 6,
|
|
3063
|
+
match: (blocked, blocking, container) => isDescendant(blocked, blocking, container) || isDescendant(blocking, blocked, container)
|
|
3064
|
+
} ];
|
|
3065
|
+
|
|
3066
|
+
const BLOCKING_RULES = [ {
|
|
3067
|
+
blockedType: 2,
|
|
3068
|
+
blockingType: 1,
|
|
3069
|
+
match: (blocked, blocking) => {
|
|
3070
|
+
const blockedQrl = blocked.$target$;
|
|
3071
|
+
const blockingQrl = blocking.$target$;
|
|
3072
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedQrl, blockingQrl);
|
|
3073
|
+
}
|
|
3074
|
+
}, {
|
|
3075
|
+
blockedType: 3,
|
|
3076
|
+
blockingType: 1,
|
|
3077
|
+
match: (blocked, blocking) => {
|
|
3078
|
+
const blockedTask = blocked.$payload$;
|
|
3079
|
+
const blockingQrl = blocking.$target$;
|
|
3080
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedTask.$qrl$, blockingQrl);
|
|
3081
|
+
}
|
|
3082
|
+
}, {
|
|
3083
|
+
blockedType: 16,
|
|
3084
|
+
blockingType: 1,
|
|
3085
|
+
match: (blocked, blocking) => {
|
|
3086
|
+
const blockedTask = blocked.$payload$;
|
|
3087
|
+
const blockingQrl = blocking.$target$;
|
|
3088
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedTask.$qrl$, blockingQrl);
|
|
3089
|
+
}
|
|
3090
|
+
}, {
|
|
3091
|
+
blockedType: 4,
|
|
3092
|
+
blockingType: 6,
|
|
3093
|
+
match: (blocked, blocking) => blocked.$host$ === blocking.$host$
|
|
3094
|
+
}, {
|
|
3095
|
+
blockedType: 5,
|
|
3096
|
+
blockingType: 6,
|
|
3097
|
+
match: (blocked, blocking) => blocked.$host$ === blocking.$host$
|
|
3098
|
+
}, ...VISIBLE_BLOCKING_RULES, {
|
|
3099
|
+
blockedType: 3,
|
|
3100
|
+
blockingType: 3,
|
|
3101
|
+
match: (blocked, blocking, container) => {
|
|
3102
|
+
if (blocked.$host$ !== blocking.$host$) {
|
|
3103
|
+
return !1;
|
|
3104
|
+
}
|
|
3105
|
+
const blockedIdx = blocked.$idx$;
|
|
3106
|
+
if (!isNumber$1(blockedIdx) || blockedIdx <= 0) {
|
|
3107
|
+
return !1;
|
|
3108
|
+
}
|
|
3109
|
+
return findPreviousTaskInComponent(blocked.$host$, blockedIdx, container) === blocking.$payload$;
|
|
3110
|
+
}
|
|
3111
|
+
} ];
|
|
3112
|
+
|
|
3113
|
+
function isDescendant(descendantChore, ancestorChore, container) {
|
|
3114
|
+
const descendantHost = descendantChore.$host$;
|
|
3115
|
+
const ancestorHost = ancestorChore.$host$;
|
|
3116
|
+
return !(!vnode_isVNode(descendantHost) || !vnode_isVNode(ancestorHost)) && vnode_isDescendantOf(descendantHost, ancestorHost, container.rootVNode);
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
function isSameHost(a, b) {
|
|
3120
|
+
return a.$host$ === b.$host$;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
function isSameQrl(a, b) {
|
|
3124
|
+
return a.$symbol$ === b.$symbol$;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
function findBlockingChoreInQueue(chore, choreQueue, container) {
|
|
3128
|
+
for (const candidate of choreQueue) {
|
|
3129
|
+
if (!(candidate.$type$ >= 16 || 3 === candidate.$type$) && isDescendant(chore, candidate, container)) {
|
|
3130
|
+
return candidate;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
return null;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
function findBlockingChore(chore, choreQueue, blockedChores, runningChores, container) {
|
|
3137
|
+
const blockingChoreInChoreQueue = findBlockingChoreInQueue(chore, choreQueue, container);
|
|
3138
|
+
if (blockingChoreInChoreQueue) {
|
|
3139
|
+
return blockingChoreInChoreQueue;
|
|
3140
|
+
}
|
|
3141
|
+
const blockingChoreInBlockedChores = findBlockingChoreInQueue(chore, Array.from(blockedChores), container);
|
|
3142
|
+
if (blockingChoreInBlockedChores) {
|
|
3143
|
+
return blockingChoreInBlockedChores;
|
|
3144
|
+
}
|
|
3145
|
+
const blockingChoreInRunningChores = findBlockingChoreInQueue(chore, Array.from(runningChores), container);
|
|
3146
|
+
if (blockingChoreInRunningChores) {
|
|
3147
|
+
return blockingChoreInRunningChores;
|
|
3148
|
+
}
|
|
3149
|
+
for (const rule of BLOCKING_RULES) {
|
|
3150
|
+
if (chore.$type$ === rule.blockedType) {
|
|
3151
|
+
for (const candidate of choreQueue) {
|
|
3152
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
3153
|
+
return candidate;
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
for (const candidate of blockedChores) {
|
|
3157
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
3158
|
+
return candidate;
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
for (const candidate of runningChores) {
|
|
3162
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
3163
|
+
return candidate;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
return null;
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
function findPreviousTaskInComponent(host, currentTaskIdx, container) {
|
|
3172
|
+
const elementSeq = container.getHostProp(host, "q:seq");
|
|
3173
|
+
if (!elementSeq || elementSeq.length <= currentTaskIdx) {
|
|
3174
|
+
return null;
|
|
3175
|
+
}
|
|
3176
|
+
for (let i = currentTaskIdx - 1; i >= 0; i--) {
|
|
3177
|
+
const candidate = elementSeq[i];
|
|
3178
|
+
if (candidate instanceof Task && 2 & candidate.$flags$) {
|
|
3179
|
+
return candidate;
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
return null;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
function findBlockingChoreForVisible(chore, runningChores, container) {
|
|
3186
|
+
for (const rule of VISIBLE_BLOCKING_RULES) {
|
|
3187
|
+
if (chore.$type$ === rule.blockedType) {
|
|
3188
|
+
for (const candidate of runningChores) {
|
|
3189
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
3190
|
+
return candidate;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
return null;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
const createNextTick = fn => {
|
|
3199
|
+
let nextTick;
|
|
3200
|
+
if ("function" == typeof setImmediate) {
|
|
3201
|
+
nextTick = () => {
|
|
3202
|
+
setImmediate(fn);
|
|
3203
|
+
};
|
|
3204
|
+
} else if ("undefined" != typeof MessageChannel) {
|
|
3205
|
+
const channel = new MessageChannel;
|
|
3206
|
+
channel.port1.onmessage = () => {
|
|
3207
|
+
fn();
|
|
3208
|
+
}, nextTick = () => {
|
|
3209
|
+
channel.port2.postMessage(null);
|
|
3210
|
+
};
|
|
3211
|
+
} else {
|
|
3212
|
+
nextTick = () => {
|
|
3213
|
+
setTimeout(fn);
|
|
3214
|
+
};
|
|
3215
|
+
}
|
|
3216
|
+
return nextTick;
|
|
3217
|
+
};
|
|
3218
|
+
|
|
3013
3219
|
const DEBUG = !1;
|
|
3014
3220
|
|
|
3015
|
-
|
|
3016
|
-
chore.$resolve$ = resolve;
|
|
3017
|
-
});
|
|
3221
|
+
var ChoreState;
|
|
3018
3222
|
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3223
|
+
!function(ChoreState) {
|
|
3224
|
+
ChoreState[ChoreState.NONE = 0] = "NONE", ChoreState[ChoreState.RUNNING = 1] = "RUNNING",
|
|
3225
|
+
ChoreState[ChoreState.FAILED = 2] = "FAILED", ChoreState[ChoreState.DONE = 3] = "DONE";
|
|
3226
|
+
}(ChoreState || (ChoreState = {}));
|
|
3227
|
+
|
|
3228
|
+
const getChorePromise = chore => chore.$state$ === ChoreState.NONE ? chore.$returnValue$ ||= new Promise((resolve, reject) => {
|
|
3229
|
+
chore.$resolve$ = resolve, chore.$reject$ = reject;
|
|
3230
|
+
}) : chore.$returnValue$;
|
|
3231
|
+
|
|
3232
|
+
const createScheduler = (container, journalFlush, choreQueue = [], blockedChores = new Set, runningChores = new Set) => {
|
|
3233
|
+
let drainChore = null;
|
|
3023
3234
|
let drainScheduled = !1;
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3235
|
+
let isDraining = !1;
|
|
3236
|
+
let isJournalFlushRunning = !1;
|
|
3237
|
+
let flushBudgetStart = 0;
|
|
3238
|
+
let currentTime = performance.now();
|
|
3239
|
+
const nextTick = createNextTick(drainChoreQueue);
|
|
3240
|
+
function drainInNextTick() {
|
|
3241
|
+
drainScheduled || (drainScheduled = !0, nextTick());
|
|
3242
|
+
}
|
|
3243
|
+
const FREQUENCY_MS = Math.floor(1e3 / 60);
|
|
3244
|
+
return function(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
3245
|
+
if (255 === type && drainChore) {
|
|
3246
|
+
return drainChore;
|
|
3247
|
+
}
|
|
3248
|
+
const isTask = 3 === type || 16 === type || 32 === type;
|
|
3033
3249
|
isTask && (hostOrTask.$flags$ |= 8);
|
|
3034
3250
|
let chore = {
|
|
3035
3251
|
$type$: type,
|
|
@@ -3037,184 +3253,218 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3037
3253
|
$host$: isTask ? hostOrTask.$el$ : hostOrTask,
|
|
3038
3254
|
$target$: targetOrQrl,
|
|
3039
3255
|
$payload$: isTask ? hostOrTask : payload,
|
|
3040
|
-
$
|
|
3041
|
-
$
|
|
3042
|
-
$
|
|
3043
|
-
$
|
|
3256
|
+
$state$: ChoreState.NONE,
|
|
3257
|
+
$blockedChores$: null,
|
|
3258
|
+
$startTime$: void 0,
|
|
3259
|
+
$endTime$: void 0,
|
|
3260
|
+
$resolve$: void 0,
|
|
3261
|
+
$reject$: void 0,
|
|
3262
|
+
$returnValue$: null
|
|
3044
3263
|
};
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$);
|
|
3068
|
-
existing.$executed$ && (existing.$executed$ = !1);
|
|
3069
|
-
return existing;
|
|
3070
|
-
}(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
|
|
3071
|
-
schedule(16), scheduleDrain()?.catch?.(() => {}));
|
|
3072
|
-
return runLater ? getPromise(chore) : drainUpTo(chore, isServer);
|
|
3264
|
+
if (255 === type) {
|
|
3265
|
+
return getChorePromise(chore), drainChore = chore, drainInNextTick(), chore;
|
|
3266
|
+
}
|
|
3267
|
+
const isServer = isServerPlatform();
|
|
3268
|
+
const isClientOnly = 4 === type || 1 === type;
|
|
3269
|
+
if (isServer && isClientOnly) {
|
|
3270
|
+
return finishChore(chore, void 0), chore;
|
|
3271
|
+
}
|
|
3272
|
+
if (isServer && chore.$host$ && isSsrNode(chore.$host$)) {
|
|
3273
|
+
if (!!!(1 & chore.$host$.flags) && 5 !== chore.$type$ && 7 !== chore.$type$) {
|
|
3274
|
+
const warningMessage = `A '${choreTypeToName(chore.$type$)}' chore was scheduled on a host element that has already been streamed to the client.\nThis can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n\nProblematic chore:\n - Type: ${choreTypeToName(chore.$type$)}\n - Host: ${chore.$host$.toString()}\n - Nearest element location: ${chore.$host$.currentFile}\n\nThis is often caused by modifying a signal in an already rendered component during SSR.`;
|
|
3275
|
+
return logWarn(warningMessage), chore;
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
const blockingChore = findBlockingChore(chore, choreQueue, blockedChores, runningChores, container);
|
|
3279
|
+
if (blockingChore) {
|
|
3280
|
+
return addBlockedChore(chore, blockingChore, blockedChores), chore;
|
|
3281
|
+
}
|
|
3282
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
3283
|
+
const runImmediately = isServer && 6 === type || 2 === type;
|
|
3284
|
+
runImmediately && !isDraining ? (drainScheduled = !0, drainChoreQueue()) : drainInNextTick();
|
|
3285
|
+
return chore;
|
|
3073
3286
|
};
|
|
3074
|
-
function
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3287
|
+
function applyJournalFlush() {
|
|
3288
|
+
isJournalFlushRunning || (isJournalFlushRunning = !0, journalFlush(), isJournalFlushRunning = !1,
|
|
3289
|
+
flushBudgetStart = performance.now());
|
|
3290
|
+
}
|
|
3291
|
+
function shouldApplyJournalFlush(isServer) {
|
|
3292
|
+
return !isServer && currentTime - flushBudgetStart >= FREQUENCY_MS;
|
|
3293
|
+
}
|
|
3294
|
+
function drainChoreQueue() {
|
|
3295
|
+
const isServer = isServerPlatform();
|
|
3296
|
+
if (drainScheduled = !1, isDraining) {
|
|
3297
|
+
return;
|
|
3298
|
+
}
|
|
3299
|
+
if (!choreQueue.length) {
|
|
3300
|
+
return applyJournalFlush(), void (drainChore && !runningChores.size && (drainChore.$resolve$(null),
|
|
3301
|
+
drainChore = null));
|
|
3302
|
+
}
|
|
3303
|
+
isDraining = !0, flushBudgetStart = performance.now();
|
|
3304
|
+
const maybeFinishDrain = () => choreQueue.length ? (drainInNextTick(), !1) : drainChore && runningChores.size ? (shouldApplyJournalFlush(isServer) && applyJournalFlush(),
|
|
3305
|
+
!1) : (currentChore = null, applyJournalFlush(), drainChore?.$resolve$(null), drainChore = null,
|
|
3306
|
+
!0);
|
|
3307
|
+
const scheduleBlockedChoresAndDrainIfNeeded = chore => {
|
|
3308
|
+
let blockedChoresScheduled = !1;
|
|
3309
|
+
if (chore.$blockedChores$) {
|
|
3310
|
+
for (const blockedChore of chore.$blockedChores$) {
|
|
3311
|
+
const blockingChore = findBlockingChore(blockedChore, choreQueue, blockedChores, runningChores, container);
|
|
3312
|
+
blockingChore ? addBlockedChore(blockedChore, blockingChore, blockedChores) : (blockedChores.delete(blockedChore),
|
|
3313
|
+
sortedInsert(choreQueue, blockedChore, container.rootVNode || null), blockedChoresScheduled = !0);
|
|
3314
|
+
}
|
|
3315
|
+
chore.$blockedChores$ = null;
|
|
3084
3316
|
}
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3317
|
+
blockedChoresScheduled && !isDraining && drainInNextTick();
|
|
3318
|
+
};
|
|
3319
|
+
let currentChore = null;
|
|
3320
|
+
try {
|
|
3321
|
+
for (;choreQueue.length; ) {
|
|
3322
|
+
currentTime = performance.now();
|
|
3323
|
+
const chore = currentChore = choreQueue.shift();
|
|
3324
|
+
if (chore.$state$ !== ChoreState.NONE) {
|
|
3325
|
+
continue;
|
|
3326
|
+
}
|
|
3327
|
+
if (vNodeAlreadyDeleted(chore) && 32 !== chore.$type$) {
|
|
3328
|
+
continue;
|
|
3329
|
+
}
|
|
3330
|
+
if (16 === chore.$type$) {
|
|
3331
|
+
applyJournalFlush();
|
|
3332
|
+
const blockingChore = findBlockingChoreForVisible(chore, runningChores, container);
|
|
3333
|
+
if (blockingChore && blockingChore.$state$ === ChoreState.RUNNING) {
|
|
3334
|
+
addBlockedChore(chore, blockingChore, blockedChores);
|
|
3335
|
+
continue;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
chore.$startTime$ = performance.now();
|
|
3339
|
+
const result = executeChore(chore, isServer);
|
|
3340
|
+
if (chore.$returnValue$ = result, isPromise(result) ? (runningChores.add(chore),
|
|
3341
|
+
chore.$state$ = ChoreState.RUNNING, result.then(value => {
|
|
3342
|
+
finishChore(chore, value);
|
|
3343
|
+
}).catch(e => {
|
|
3344
|
+
chore.$state$ === ChoreState.RUNNING && handleError(chore, e);
|
|
3345
|
+
}).finally(() => {
|
|
3346
|
+
if (runningChores.delete(chore), scheduleBlockedChoresAndDrainIfNeeded(chore), !runningChores.size) {
|
|
3347
|
+
let finished = !1;
|
|
3348
|
+
drainChore && (finished = maybeFinishDrain()), finished || isDraining || applyJournalFlush();
|
|
3349
|
+
}
|
|
3350
|
+
})) : (finishChore(chore, result), scheduleBlockedChoresAndDrainIfNeeded(chore)),
|
|
3351
|
+
shouldApplyJournalFlush(isServer)) {
|
|
3352
|
+
return applyJournalFlush(), void drainInNextTick();
|
|
3089
3353
|
}
|
|
3090
|
-
} else {
|
|
3091
|
-
vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer);
|
|
3092
3354
|
}
|
|
3355
|
+
} catch (e) {
|
|
3356
|
+
handleError(currentChore, e), scheduleBlockedChoresAndDrainIfNeeded(currentChore);
|
|
3357
|
+
} finally {
|
|
3358
|
+
isDraining = !1, maybeFinishDrain();
|
|
3093
3359
|
}
|
|
3094
|
-
|
|
3360
|
+
}
|
|
3361
|
+
function finishChore(chore, value) {
|
|
3362
|
+
chore.$endTime$ = performance.now(), chore.$state$ = ChoreState.DONE, chore.$returnValue$ = value,
|
|
3363
|
+
chore.$resolve$?.(value);
|
|
3364
|
+
}
|
|
3365
|
+
function handleError(chore, e) {
|
|
3366
|
+
chore.$endTime$ = performance.now(), chore.$state$ = ChoreState.FAILED, chore.$reject$?.(e),
|
|
3367
|
+
container.handleError(e, chore.$host$);
|
|
3095
3368
|
}
|
|
3096
3369
|
function executeChore(chore, isServer) {
|
|
3097
3370
|
const host = chore.$host$;
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
break;
|
|
3105
|
-
|
|
3106
|
-
case 16:
|
|
3107
|
-
returnValue = journalFlush(), drainScheduled = !1;
|
|
3108
|
-
break;
|
|
3109
|
-
|
|
3110
|
-
case 6:
|
|
3111
|
-
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
3112
|
-
if (isServer) {
|
|
3113
|
-
return jsx;
|
|
3114
|
-
}
|
|
3115
|
-
{
|
|
3116
|
-
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
3117
|
-
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
3118
|
-
}
|
|
3119
|
-
}, err => container.handleError(err, host));
|
|
3120
|
-
break;
|
|
3121
|
-
|
|
3122
|
-
case 2:
|
|
3123
|
-
{
|
|
3124
|
-
const fn = chore.$target$.getFn();
|
|
3125
|
-
const result = retryOnPromise(() => fn(...chore.$payload$));
|
|
3126
|
-
if (isPromise(result)) {
|
|
3127
|
-
const handled = result.finally(() => {
|
|
3128
|
-
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
3129
|
-
}).catch(error => {
|
|
3130
|
-
container.handleError(error, chore.$host$);
|
|
3131
|
-
});
|
|
3132
|
-
return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
|
|
3133
|
-
currentChore = null, void (chore.$executed$ = !0);
|
|
3134
|
-
}
|
|
3135
|
-
returnValue = null;
|
|
3371
|
+
let returnValue;
|
|
3372
|
+
switch (chore.$type$) {
|
|
3373
|
+
case 6:
|
|
3374
|
+
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
3375
|
+
if (isServer) {
|
|
3376
|
+
return jsx;
|
|
3136
3377
|
}
|
|
3137
|
-
break;
|
|
3138
|
-
|
|
3139
|
-
case 3:
|
|
3140
|
-
case 32:
|
|
3141
3378
|
{
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3144
|
-
const result = runResource(payload, container, host);
|
|
3145
|
-
returnValue = isServer ? result : null;
|
|
3146
|
-
} else {
|
|
3147
|
-
returnValue = runTask(payload, container, host);
|
|
3148
|
-
}
|
|
3379
|
+
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
3380
|
+
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
3149
3381
|
}
|
|
3150
|
-
|
|
3382
|
+
}, err => {
|
|
3383
|
+
handleError(chore, err);
|
|
3384
|
+
});
|
|
3385
|
+
break;
|
|
3151
3386
|
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3387
|
+
case 2:
|
|
3388
|
+
{
|
|
3389
|
+
const fn = chore.$target$.getFn();
|
|
3390
|
+
returnValue = retryOnPromise(() => fn(...chore.$payload$));
|
|
3391
|
+
}
|
|
3392
|
+
break;
|
|
3155
3393
|
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3394
|
+
case 3:
|
|
3395
|
+
case 16:
|
|
3396
|
+
{
|
|
3397
|
+
const payload = chore.$payload$;
|
|
3398
|
+
returnValue = 4 & payload.$flags$ ? runResource(payload, container, host) : runTask(payload, container, host);
|
|
3399
|
+
}
|
|
3400
|
+
break;
|
|
3163
3401
|
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3402
|
+
case 32:
|
|
3403
|
+
cleanupTask(chore.$payload$);
|
|
3404
|
+
break;
|
|
3405
|
+
|
|
3406
|
+
case 4:
|
|
3407
|
+
{
|
|
3408
|
+
const parentVirtualNode = chore.$target$;
|
|
3409
|
+
let jsx = chore.$payload$;
|
|
3410
|
+
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx, parentVirtualNode, null));
|
|
3411
|
+
}
|
|
3412
|
+
break;
|
|
3413
|
+
|
|
3414
|
+
case 5:
|
|
3415
|
+
{
|
|
3416
|
+
const virtualNode = chore.$host$;
|
|
3417
|
+
const payload = chore.$payload$;
|
|
3418
|
+
let value = payload.$value$;
|
|
3419
|
+
isSignal(value) && (value = value.value);
|
|
3420
|
+
const isConst = payload.$isConst$;
|
|
3421
|
+
const journal = container.$journal$;
|
|
3422
|
+
const property = chore.$idx$;
|
|
3423
|
+
const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
|
|
3424
|
+
if (isServer) {
|
|
3425
|
+
container.addBackpatchEntry(chore.$host$.id, property, serializedValue), returnValue = null;
|
|
3426
|
+
} else {
|
|
3174
3427
|
if (isConst) {
|
|
3175
3428
|
journal.push(2, virtualNode[6], property, serializedValue);
|
|
3176
3429
|
} else {
|
|
3177
3430
|
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
3178
3431
|
}
|
|
3432
|
+
returnValue = void 0;
|
|
3179
3433
|
}
|
|
3180
|
-
|
|
3434
|
+
}
|
|
3435
|
+
break;
|
|
3181
3436
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3437
|
+
case 1:
|
|
3438
|
+
{
|
|
3439
|
+
const target = chore.$target$;
|
|
3440
|
+
returnValue = target.resolved ? null : target.resolve();
|
|
3441
|
+
}
|
|
3442
|
+
break;
|
|
3188
3443
|
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3444
|
+
case 7:
|
|
3445
|
+
{
|
|
3446
|
+
const target = chore.$target$;
|
|
3447
|
+
const effects = chore.$payload$;
|
|
3448
|
+
if (!effects?.size) {
|
|
3449
|
+
break;
|
|
3450
|
+
}
|
|
3451
|
+
let shouldCompute = target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl;
|
|
3452
|
+
if (target instanceof AsyncComputedSignalImpl && effects !== target.$effects$ && (shouldCompute = !1),
|
|
3453
|
+
shouldCompute) {
|
|
3193
3454
|
const ctx = newInvokeContext();
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
break;
|
|
3455
|
+
ctx.$container$ = container, returnValue = maybeThen(retryOnPromise(() => invoke.call(target, ctx, target.$computeIfNeeded$)), () => {
|
|
3456
|
+
if (2 & target.$flags$) {
|
|
3457
|
+
return target.$flags$ &= -3, retryOnPromise(() => triggerEffects(container, target, effects));
|
|
3198
3458
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
} else {
|
|
3205
|
-
returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
|
|
3206
|
-
}
|
|
3459
|
+
});
|
|
3460
|
+
} else {
|
|
3461
|
+
returnValue = retryOnPromise(() => {
|
|
3462
|
+
triggerEffects(container, target, effects);
|
|
3463
|
+
});
|
|
3207
3464
|
}
|
|
3208
3465
|
}
|
|
3209
|
-
} catch (e) {
|
|
3210
|
-
returnValue = Promise.reject(e);
|
|
3211
3466
|
}
|
|
3212
|
-
|
|
3213
|
-
currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
|
|
3214
|
-
chore.$resolve$?.(value));
|
|
3215
|
-
};
|
|
3216
|
-
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, error => after(void 0, error)),
|
|
3217
|
-
chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
|
|
3467
|
+
return returnValue;
|
|
3218
3468
|
}
|
|
3219
3469
|
function choreComparator(a, b, rootVNode) {
|
|
3220
3470
|
const macroTypeDiff = (240 & a.$type$) - (240 & b.$type$);
|
|
@@ -3232,8 +3482,6 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3232
3482
|
} else {
|
|
3233
3483
|
assertFalse(vnode_isVNode(aHost), "expected aHost to be SSRNode but it is a VNode"),
|
|
3234
3484
|
assertFalse(vnode_isVNode(bHost), "expected bHost to be SSRNode but it is a VNode");
|
|
3235
|
-
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
3236
|
-
logWarn(errorMessage);
|
|
3237
3485
|
const hostDiff = ssrNodeDocumentPosition(aHost, bHost);
|
|
3238
3486
|
if (0 !== hostDiff) {
|
|
3239
3487
|
return hostDiff;
|
|
@@ -3245,7 +3493,39 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3245
3493
|
return microTypeDiff;
|
|
3246
3494
|
}
|
|
3247
3495
|
const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
|
|
3248
|
-
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 :
|
|
3496
|
+
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 : 7 === a.$type$ && 7 === b.$type$ && (a.$target$ instanceof StoreHandler && b.$target$ instanceof StoreHandler || a.$target$ instanceof AsyncComputedSignalImpl && b.$target$ instanceof AsyncComputedSignalImpl) && a.$payload$ !== b.$payload$ ? 1 : 0;
|
|
3497
|
+
}
|
|
3498
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
3499
|
+
const idx = function(sortedArray, value, rootVNode) {
|
|
3500
|
+
let bottom = 0;
|
|
3501
|
+
let top = sortedArray.length;
|
|
3502
|
+
for (;bottom < top; ) {
|
|
3503
|
+
const middle = bottom + (top - bottom >> 1);
|
|
3504
|
+
const comp = choreComparator(value, sortedArray[middle], rootVNode);
|
|
3505
|
+
if (comp < 0) {
|
|
3506
|
+
top = middle;
|
|
3507
|
+
} else {
|
|
3508
|
+
if (!(comp > 0)) {
|
|
3509
|
+
return middle;
|
|
3510
|
+
}
|
|
3511
|
+
bottom = middle + 1;
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
return ~bottom;
|
|
3515
|
+
}(sortedArray, value, rootVNode);
|
|
3516
|
+
if (idx < 0 && runningChores.size) {
|
|
3517
|
+
for (const chore of runningChores) {
|
|
3518
|
+
if (0 === choreComparator(value, chore, rootVNode)) {
|
|
3519
|
+
return chore;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
if (idx < 0) {
|
|
3524
|
+
return sortedArray.splice(~idx, 0, value), value;
|
|
3525
|
+
}
|
|
3526
|
+
const existing = sortedArray[idx];
|
|
3527
|
+
return existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$),
|
|
3528
|
+
existing;
|
|
3249
3529
|
}
|
|
3250
3530
|
};
|
|
3251
3531
|
|
|
@@ -3255,6 +3535,26 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
3255
3535
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
|
|
3256
3536
|
}
|
|
3257
3537
|
|
|
3538
|
+
function addBlockedChore(blockedChore, blockingChore, blockedChores) {
|
|
3539
|
+
blockingChore.$blockedChores$ ||= [], blockingChore.$blockedChores$.push(blockedChore),
|
|
3540
|
+
blockedChores.add(blockedChore);
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
function choreTypeToName(type) {
|
|
3544
|
+
return {
|
|
3545
|
+
1: "Resolve QRL",
|
|
3546
|
+
2: "Run QRL",
|
|
3547
|
+
3: "Task",
|
|
3548
|
+
4: "Changes diffing",
|
|
3549
|
+
5: "Updating node property",
|
|
3550
|
+
6: "Component",
|
|
3551
|
+
7: "Signal recompute",
|
|
3552
|
+
16: "Visible",
|
|
3553
|
+
32: "Cleanup visible",
|
|
3554
|
+
255: "Wait for queue"
|
|
3555
|
+
}[type] || "Unknown: " + type;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3258
3558
|
function debugChoreTypeToString(type) {
|
|
3259
3559
|
return {
|
|
3260
3560
|
1: "QRL_RESOLVE",
|
|
@@ -3264,26 +3564,53 @@ function debugChoreTypeToString(type) {
|
|
|
3264
3564
|
5: "NODE_PROP",
|
|
3265
3565
|
6: "COMPONENT",
|
|
3266
3566
|
7: "RECOMPUTE_SIGNAL",
|
|
3267
|
-
16: "
|
|
3268
|
-
32: "
|
|
3269
|
-
|
|
3270
|
-
255: "WAIT_FOR_ALL"
|
|
3567
|
+
16: "VISIBLE",
|
|
3568
|
+
32: "CLEANUP_VISIBLE",
|
|
3569
|
+
255: "WAIT_FOR_QUEUE"
|
|
3271
3570
|
}[type] || "UNKNOWN: " + type;
|
|
3272
3571
|
}
|
|
3273
3572
|
|
|
3274
|
-
function
|
|
3275
|
-
const
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3573
|
+
function debugTrace(action, arg, queue, blockedChores) {
|
|
3574
|
+
const lines = [];
|
|
3575
|
+
if (lines.push(`Scheduler: ${action}`), arg) {
|
|
3576
|
+
if (lines.push(""), arg && "$type$" in arg) {
|
|
3577
|
+
const chore = arg;
|
|
3578
|
+
const type = debugChoreTypeToString(chore.$type$);
|
|
3579
|
+
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
3580
|
+
const qrlTarget = chore.$target$?.$symbol$;
|
|
3581
|
+
const targetOrHost = 1 === chore.$type$ || 2 === chore.$type$ ? qrlTarget : host;
|
|
3582
|
+
if (lines.push("🎯 Current Chore:"), lines.push(` Type: ${type}`), lines.push(` Host: ${targetOrHost}`),
|
|
3583
|
+
chore.$startTime$ && chore.$endTime$) {
|
|
3584
|
+
lines.push(` Time: ${(chore.$endTime$ - chore.$startTime$).toFixed(2)}ms`);
|
|
3585
|
+
} else if (chore.$startTime$) {
|
|
3586
|
+
const elapsedTime = performance.now() - chore.$startTime$;
|
|
3587
|
+
lines.push(` Time: ${elapsedTime.toFixed(2)}ms (running)`);
|
|
3588
|
+
}
|
|
3589
|
+
chore.$blockedChores$ && chore.$blockedChores$.length > 0 && (lines.push(" ⛔ Blocked Chores:"),
|
|
3590
|
+
chore.$blockedChores$.forEach((blockedChore, index) => {
|
|
3591
|
+
const blockedType = debugChoreTypeToString(blockedChore.$type$);
|
|
3592
|
+
const blockedTarget = String(blockedChore.$host$).replaceAll(/\n.*/gim, "");
|
|
3593
|
+
lines.push(` ${index + 1}. ${blockedType} ${blockedTarget} ${blockedChore.$idx$}`);
|
|
3594
|
+
}));
|
|
3595
|
+
} else {
|
|
3596
|
+
lines.push(`📝 Argument: ${String(arg).replaceAll(/\n.*/gim, "")}`);
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
queue && queue.length > 0 && (lines.push(""), lines.push(`📋 Queue (${queue.length} items):`),
|
|
3600
|
+
queue.forEach(chore => {
|
|
3601
|
+
const activeMarker = chore === arg ? "▶ " : " ";
|
|
3602
|
+
const type = debugChoreTypeToString(chore.$type$);
|
|
3603
|
+
const state = chore.$state$ ? `[${ChoreState[chore.$state$]}]` : "";
|
|
3604
|
+
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
3605
|
+
const qrlTarget = chore.$target$?.$symbol$;
|
|
3606
|
+
lines.push(`${activeMarker}${state} ${type} ${1 === chore.$type$ || 2 === chore.$type$ ? qrlTarget : host} ${chore.$idx$}`);
|
|
3607
|
+
})), blockedChores && blockedChores.size > 0 && (lines.push(""), lines.push(`🚫 Blocked Chores (${blockedChores.size} items):`),
|
|
3608
|
+
Array.from(blockedChores).forEach((chore, index) => {
|
|
3609
|
+
const type = debugChoreTypeToString(chore.$type$);
|
|
3610
|
+
const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
|
|
3611
|
+
const qrlTarget = chore.$target$?.$symbol$;
|
|
3612
|
+
lines.push(` ${index + 1}. ${type} ${1 === chore.$type$ || 2 === chore.$type$ ? qrlTarget : host} ${chore.$idx$}`);
|
|
3613
|
+
})), lines.push(""), lines.push("─".repeat(60)), console.log(lines.join("\n") + "\n");
|
|
3287
3614
|
}
|
|
3288
3615
|
|
|
3289
3616
|
class _SharedContainer {
|
|
@@ -3296,11 +3623,12 @@ class _SharedContainer {
|
|
|
3296
3623
|
$currentUniqueId$=0;
|
|
3297
3624
|
$instanceHash$=null;
|
|
3298
3625
|
$buildBase$=null;
|
|
3299
|
-
|
|
3626
|
+
$flushEpoch$=0;
|
|
3627
|
+
constructor(journalFlush, serverData, locale) {
|
|
3300
3628
|
this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version,
|
|
3301
3629
|
this.$storeProxyMap$ = new WeakMap, this.$getObjectById$ = () => {
|
|
3302
3630
|
throw Error("Not implemented");
|
|
3303
|
-
}, this.$scheduler$ = createScheduler(this,
|
|
3631
|
+
}, this.$scheduler$ = createScheduler(this, journalFlush);
|
|
3304
3632
|
}
|
|
3305
3633
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3306
3634
|
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
@@ -3468,7 +3796,10 @@ function processVNodeData$1(document) {
|
|
|
3468
3796
|
nextNode = nextSibling(node);
|
|
3469
3797
|
const shadowRootContainer = node;
|
|
3470
3798
|
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
3471
|
-
|
|
3799
|
+
if (shadowRoot) {
|
|
3800
|
+
const firstShadowRootChild = firstChild(shadowRoot);
|
|
3801
|
+
walkContainer(document.createTreeWalker(firstShadowRootChild, 129), null, firstShadowRootChild, null, "", null);
|
|
3802
|
+
}
|
|
3472
3803
|
}
|
|
3473
3804
|
if (!(2 & ~nodeType)) {
|
|
3474
3805
|
if (vNodeElementIndex < elementIdx) {
|
|
@@ -3509,7 +3840,7 @@ function getDomContainerFromQContainerElement(qContainerElement) {
|
|
|
3509
3840
|
}
|
|
3510
3841
|
|
|
3511
3842
|
function _getQContainerElement(element) {
|
|
3512
|
-
return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
|
|
3843
|
+
return (Array.isArray(element) ? vnode_getDomParent(element, !0) : element).closest(QContainerSelector);
|
|
3513
3844
|
}
|
|
3514
3845
|
|
|
3515
3846
|
const isDomContainer = container => container instanceof DomContainer;
|
|
@@ -3521,7 +3852,6 @@ class DomContainer extends _SharedContainer {
|
|
|
3521
3852
|
rootVNode;
|
|
3522
3853
|
document;
|
|
3523
3854
|
$journal$;
|
|
3524
|
-
renderDone=null;
|
|
3525
3855
|
$rawStateData$;
|
|
3526
3856
|
$storeProxyMap$=new WeakMap;
|
|
3527
3857
|
$qFuncs$;
|
|
@@ -3531,10 +3861,11 @@ class DomContainer extends _SharedContainer {
|
|
|
3531
3861
|
vNodeLocate=id => vnode_locate(this.rootVNode, id);
|
|
3532
3862
|
$stateData$;
|
|
3533
3863
|
$styleIds$=null;
|
|
3534
|
-
$renderCount$=0;
|
|
3535
3864
|
constructor(element) {
|
|
3536
|
-
if (super(() =>
|
|
3537
|
-
|
|
3865
|
+
if (super(() => {
|
|
3866
|
+
this.$flushEpoch$++, vnode_applyJournal(this.$journal$);
|
|
3867
|
+
}, {}, element.getAttribute("q:locale")), this.qContainer = element.getAttribute("q:container"),
|
|
3868
|
+
!this.qContainer) {
|
|
3538
3869
|
throw qError(25);
|
|
3539
3870
|
}
|
|
3540
3871
|
this.$journal$ = [ 3, element.ownerDocument ], this.document = element.ownerDocument,
|
|
@@ -3566,16 +3897,13 @@ class DomContainer extends _SharedContainer {
|
|
|
3566
3897
|
}
|
|
3567
3898
|
setContext(host, context, value) {
|
|
3568
3899
|
let ctx = this.getHostProp(host, "q:ctx");
|
|
3569
|
-
ctx
|
|
3900
|
+
null == ctx && this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0, !0);
|
|
3570
3901
|
}
|
|
3571
3902
|
resolveContext(host, contextId) {
|
|
3572
3903
|
for (;host; ) {
|
|
3573
3904
|
const ctx = this.getHostProp(host, "q:ctx");
|
|
3574
|
-
if (ctx) {
|
|
3575
|
-
|
|
3576
|
-
if (value) {
|
|
3577
|
-
return value;
|
|
3578
|
-
}
|
|
3905
|
+
if (null != ctx && mapArray_has(ctx, contextId.id, 0)) {
|
|
3906
|
+
return mapArray_get(ctx, contextId.id, 0);
|
|
3579
3907
|
}
|
|
3580
3908
|
host = this.getParentHost(host);
|
|
3581
3909
|
}
|
|
@@ -3615,26 +3943,6 @@ class DomContainer extends _SharedContainer {
|
|
|
3615
3943
|
}
|
|
3616
3944
|
return vnode_getProp(vNode, name, getObjectById);
|
|
3617
3945
|
}
|
|
3618
|
-
scheduleRender() {
|
|
3619
|
-
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick(() => this.processChores()),
|
|
3620
|
-
this.renderDone.finally(() => emitEvent("qrender", {
|
|
3621
|
-
instanceHash: this.$instanceHash$,
|
|
3622
|
-
renderCount: this.$renderCount$
|
|
3623
|
-
}));
|
|
3624
|
-
}
|
|
3625
|
-
processChores() {
|
|
3626
|
-
let renderCount = this.$renderCount$;
|
|
3627
|
-
const result = this.$scheduler$(255);
|
|
3628
|
-
if (isPromise(result)) {
|
|
3629
|
-
return result.then(async () => {
|
|
3630
|
-
for (;renderCount !== this.$renderCount$; ) {
|
|
3631
|
-
renderCount = this.$renderCount$, await this.$scheduler$(255);
|
|
3632
|
-
}
|
|
3633
|
-
this.renderDone = null;
|
|
3634
|
-
});
|
|
3635
|
-
}
|
|
3636
|
-
renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
|
|
3637
|
-
}
|
|
3638
3946
|
ensureProjectionResolved(vNode) {
|
|
3639
3947
|
if (!(16 & vNode[0])) {
|
|
3640
3948
|
vNode[0] |= 16;
|
|
@@ -3642,7 +3950,10 @@ class DomContainer extends _SharedContainer {
|
|
|
3642
3950
|
for (let i = 0; i < props.length; i += 2) {
|
|
3643
3951
|
if (isSlotProp(props[i])) {
|
|
3644
3952
|
const value = props[i + 1];
|
|
3645
|
-
"string" == typeof value
|
|
3953
|
+
if ("string" == typeof value) {
|
|
3954
|
+
const projection = this.vNodeLocate(value);
|
|
3955
|
+
props[i + 1] = projection, vnode_getProp(projection, "q:sparent", id => this.vNodeLocate(id));
|
|
3956
|
+
}
|
|
3646
3957
|
}
|
|
3647
3958
|
}
|
|
3648
3959
|
}
|
|
@@ -3717,7 +4028,7 @@ const addQrlToSerializationCtx = (effectSubscriber, container) => {
|
|
|
3717
4028
|
};
|
|
3718
4029
|
|
|
3719
4030
|
const triggerEffects = (container, signal, effects) => {
|
|
3720
|
-
const isBrowser =
|
|
4031
|
+
const isBrowser = !isServerPlatform();
|
|
3721
4032
|
if (effects) {
|
|
3722
4033
|
const scheduleEffect = effectSubscription => {
|
|
3723
4034
|
const consumer = effectSubscription[0];
|
|
@@ -3725,7 +4036,7 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
3725
4036
|
if (assertDefined(container, "Container must be defined."), isTask(consumer)) {
|
|
3726
4037
|
consumer.$flags$ |= 8;
|
|
3727
4038
|
let choreType = 3;
|
|
3728
|
-
1 & consumer.$flags$ && (choreType =
|
|
4039
|
+
1 & consumer.$flags$ && (choreType = 16), container.$scheduler$(choreType, consumer);
|
|
3729
4040
|
} else if (consumer instanceof SignalImpl) {
|
|
3730
4041
|
consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)),
|
|
3731
4042
|
consumer.invalidate();
|
|
@@ -3735,18 +4046,18 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
3735
4046
|
assertDefined(qrl, "Component must have QRL");
|
|
3736
4047
|
const props = container.getHostProp(host, "q:props");
|
|
3737
4048
|
container.$scheduler$(6, host, qrl, props);
|
|
3738
|
-
} else if (
|
|
3739
|
-
if (
|
|
4049
|
+
} else if ("." === property) {
|
|
4050
|
+
if (isBrowser) {
|
|
3740
4051
|
container.$scheduler$(4, consumer, consumer, signal);
|
|
3741
|
-
}
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
4052
|
+
}
|
|
4053
|
+
} else {
|
|
4054
|
+
const effectData = effectSubscription[3];
|
|
4055
|
+
if (effectData instanceof SubscriptionData) {
|
|
4056
|
+
const payload = {
|
|
4057
|
+
...effectData.data,
|
|
4058
|
+
$value$: signal
|
|
4059
|
+
};
|
|
4060
|
+
container.$scheduler$(5, consumer, property, payload);
|
|
3750
4061
|
}
|
|
3751
4062
|
}
|
|
3752
4063
|
};
|
|
@@ -3762,11 +4073,11 @@ const getComputedSignalFlags = serializationStrategy => {
|
|
|
3762
4073
|
let flags = 1;
|
|
3763
4074
|
switch (serializationStrategy) {
|
|
3764
4075
|
case "never":
|
|
3765
|
-
flags |=
|
|
4076
|
+
flags |= 16;
|
|
3766
4077
|
break;
|
|
3767
4078
|
|
|
3768
4079
|
case "always":
|
|
3769
|
-
flags |=
|
|
4080
|
+
flags |= 32;
|
|
3770
4081
|
}
|
|
3771
4082
|
return flags;
|
|
3772
4083
|
};
|
|
@@ -3960,13 +4271,16 @@ const vnode_ensureElementInflated = vnode => {
|
|
|
3960
4271
|
}
|
|
3961
4272
|
};
|
|
3962
4273
|
|
|
3963
|
-
function vnode_walkVNode(vNode) {
|
|
4274
|
+
function vnode_walkVNode(vNode, callback) {
|
|
3964
4275
|
let vCursor = vNode;
|
|
3965
4276
|
if (vnode_isTextVNode(vNode)) {
|
|
3966
4277
|
return;
|
|
3967
4278
|
}
|
|
3968
4279
|
let vParent = null;
|
|
3969
4280
|
for (;;) {
|
|
4281
|
+
if (callback?.(vCursor, vParent)) {
|
|
4282
|
+
return;
|
|
4283
|
+
}
|
|
3970
4284
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
3971
4285
|
if (vFirstChild) {
|
|
3972
4286
|
vCursor = vFirstChild;
|
|
@@ -4065,6 +4379,7 @@ const vnode_ensureTextInflated = (journal, vnode) => {
|
|
|
4065
4379
|
const textVNode = ensureTextVNode(vnode);
|
|
4066
4380
|
if (!(8 & textVNode[0])) {
|
|
4067
4381
|
const parentNode = vnode_getDomParent(vnode);
|
|
4382
|
+
assertDefined(parentNode, "Missing parent node.");
|
|
4068
4383
|
const sharedTextNode = textVNode[4];
|
|
4069
4384
|
const doc = parentNode.ownerDocument;
|
|
4070
4385
|
let cursor = vnode_getDomSibling(vnode, !1, !0);
|
|
@@ -4181,6 +4496,17 @@ const indexOfAlphanumeric = (id, length) => {
|
|
|
4181
4496
|
return length;
|
|
4182
4497
|
};
|
|
4183
4498
|
|
|
4499
|
+
const vnode_createErrorDiv = (document, host, err, journal) => {
|
|
4500
|
+
const errorDiv = document.createElement("errored-host");
|
|
4501
|
+
err && err instanceof Error && (errorDiv.props = {
|
|
4502
|
+
error: err
|
|
4503
|
+
}), errorDiv.setAttribute("q:key", "_error_");
|
|
4504
|
+
const vErrorDiv = vnode_newElement(errorDiv, "errored-host");
|
|
4505
|
+
return vnode_getDOMChildNodes(journal, host, !0).forEach(child => {
|
|
4506
|
+
vnode_insertBefore(journal, vErrorDiv, child, null);
|
|
4507
|
+
}), vErrorDiv;
|
|
4508
|
+
};
|
|
4509
|
+
|
|
4184
4510
|
const parseBoolean = value => "false" !== value && Boolean(value);
|
|
4185
4511
|
|
|
4186
4512
|
const isBooleanAttr = (element, key) => ("allowfullscreen" == key || "async" == key || "autofocus" == key || "autoplay" == key || "checked" == key || "controls" == key || "default" == key || "defer" == key || "disabled" == key || "formnovalidate" == key || "inert" == key || "ismap" == key || "itemscope" == key || "loop" == key || "multiple" == key || "muted" == key || "nomodule" == key || "novalidate" == key || "open" == key || "playsinline" == key || "readonly" == key || "required" == key || "reversed" == key || "selected" == key) && key in element;
|
|
@@ -4241,26 +4567,29 @@ const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
|
|
|
4241
4567
|
}
|
|
4242
4568
|
insertBefore = null;
|
|
4243
4569
|
}
|
|
4244
|
-
const domParentVNode = vnode_getDomParentVNode(parent);
|
|
4570
|
+
const domParentVNode = vnode_getDomParentVNode(parent, !1);
|
|
4245
4571
|
const parentNode = domParentVNode && domParentVNode[6];
|
|
4246
4572
|
let domChildren = null;
|
|
4247
4573
|
domParentVNode && (domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild)),
|
|
4248
4574
|
newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, !1);
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4575
|
+
const parentIsDeleted = 32 & parent[0];
|
|
4576
|
+
if (!parentIsDeleted) {
|
|
4577
|
+
let adjustedInsertBefore = null;
|
|
4578
|
+
null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore,
|
|
4579
|
+
adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore),
|
|
4580
|
+
domChildren && domChildren.length && journal.push(5, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
|
|
4581
|
+
}
|
|
4253
4582
|
const vNext = insertBefore;
|
|
4254
4583
|
const vPrevious = vNext ? vNext[2] : parent[5];
|
|
4255
4584
|
vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild,
|
|
4256
|
-
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
|
|
4585
|
+
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent, parentIsDeleted && (newChild[0] |= 32);
|
|
4257
4586
|
};
|
|
4258
4587
|
|
|
4259
|
-
const vnode_getDomParent = vnode => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
|
|
4588
|
+
const vnode_getDomParent = (vnode, includeProjection = !0) => (vnode = vnode_getDomParentVNode(vnode, includeProjection)) && vnode[6];
|
|
4260
4589
|
|
|
4261
|
-
const vnode_getDomParentVNode = vnode => {
|
|
4590
|
+
const vnode_getDomParentVNode = (vnode, includeProjection = !0) => {
|
|
4262
4591
|
for (;vnode && !vnode_isElementVNode(vnode); ) {
|
|
4263
|
-
vnode = vnode[1];
|
|
4592
|
+
vnode = vnode[1] || (includeProjection ? vnode_getProp(vnode, "q:sparent", id => vnode_isVNode(id) ? id : null) : null);
|
|
4264
4593
|
}
|
|
4265
4594
|
return vnode;
|
|
4266
4595
|
};
|
|
@@ -4268,7 +4597,7 @@ const vnode_getDomParentVNode = vnode => {
|
|
|
4268
4597
|
const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
4269
4598
|
if (assertEqual(vParent, vnode_getParent(vToRemove), "Parent mismatch."), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove),
|
|
4270
4599
|
removeDOM) {
|
|
4271
|
-
const domParent = vnode_getDomParent(vParent);
|
|
4600
|
+
const domParent = vnode_getDomParent(vParent, !1);
|
|
4272
4601
|
if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
|
|
4273
4602
|
return;
|
|
4274
4603
|
}
|
|
@@ -4592,6 +4921,27 @@ const vnode_getProps = vnode => vnode[vnode_getPropStartIndex(vnode)];
|
|
|
4592
4921
|
|
|
4593
4922
|
const vnode_getParent = vnode => vnode[1] || null;
|
|
4594
4923
|
|
|
4924
|
+
const vnode_isDescendantOf = (vnode, ancestor, rootVNode) => {
|
|
4925
|
+
let parent = vnode_getParentOrProjectionParent(vnode, rootVNode);
|
|
4926
|
+
for (;parent; ) {
|
|
4927
|
+
if (parent === ancestor) {
|
|
4928
|
+
return !0;
|
|
4929
|
+
}
|
|
4930
|
+
parent = vnode_getParentOrProjectionParent(parent, rootVNode);
|
|
4931
|
+
}
|
|
4932
|
+
return !1;
|
|
4933
|
+
};
|
|
4934
|
+
|
|
4935
|
+
const vnode_getParentOrProjectionParent = (vnode, rootVNode) => {
|
|
4936
|
+
if (rootVNode) {
|
|
4937
|
+
const parentProjection = vnode_getProp(vnode, "q:sparent", id => vnode_locate(rootVNode, id));
|
|
4938
|
+
if (parentProjection) {
|
|
4939
|
+
return parentProjection;
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
return vnode_getParent(vnode);
|
|
4943
|
+
};
|
|
4944
|
+
|
|
4595
4945
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node."),
|
|
4596
4946
|
vnode[4]);
|
|
4597
4947
|
|
|
@@ -4826,9 +5176,9 @@ class DeserializationHandler {
|
|
|
4826
5176
|
}
|
|
4827
5177
|
const container = this.$container$;
|
|
4828
5178
|
let propValue = allocate(container, typeId, value);
|
|
4829
|
-
return
|
|
4830
|
-
|
|
4831
|
-
propValue;
|
|
5179
|
+
return Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue,
|
|
5180
|
+
typeId >= 14 && (propValue = inflate(container, propValue, typeId, value), Reflect.set(target, property, propValue),
|
|
5181
|
+
this.$data$[idx + 1] = propValue), propValue;
|
|
4832
5182
|
}
|
|
4833
5183
|
has(target, property) {
|
|
4834
5184
|
return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
|
|
@@ -4956,7 +5306,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
4956
5306
|
const d = data;
|
|
4957
5307
|
computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
|
|
4958
5308
|
d.length > 2 ? (computed.$untrackedValue$ = d[2], 29 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
|
|
4959
|
-
computed.$computeQrl$.resolve(), container.$scheduler
|
|
5309
|
+
computed.$computeQrl$.resolve(), container.$scheduler$(1, null, computed.$computeQrl$));
|
|
4960
5310
|
break;
|
|
4961
5311
|
}
|
|
4962
5312
|
|
|
@@ -5523,8 +5873,8 @@ async function serialize(serializationContext) {
|
|
|
5523
5873
|
output(26, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
5524
5874
|
} else if (value instanceof ComputedSignalImpl) {
|
|
5525
5875
|
let v = value.$untrackedValue$;
|
|
5526
|
-
const shouldAlwaysSerialize =
|
|
5527
|
-
const shouldNeverSerialize =
|
|
5876
|
+
const shouldAlwaysSerialize = 32 & value.$flags$;
|
|
5877
|
+
const shouldNeverSerialize = 16 & value.$flags$;
|
|
5528
5878
|
const isInvalid = 1 & value.$flags$;
|
|
5529
5879
|
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
5530
5880
|
shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION),
|
|
@@ -6184,7 +6534,7 @@ const render = async (parent, jsxNode, opts = {}) => {
|
|
|
6184
6534
|
const container = getDomContainer(parent);
|
|
6185
6535
|
container.$serverData$ = opts.serverData || {};
|
|
6186
6536
|
const host = container.rootVNode;
|
|
6187
|
-
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255)
|
|
6537
|
+
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255).$returnValue$,
|
|
6188
6538
|
{
|
|
6189
6539
|
cleanup: () => {
|
|
6190
6540
|
cleanup(container, container.rootVNode);
|
|
@@ -6538,7 +6888,7 @@ const useVisibleTaskQrl = (qrl, opts) => {
|
|
|
6538
6888
|
assertQrl(qrl);
|
|
6539
6889
|
const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
6540
6890
|
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
|
|
6541
|
-
iCtx.$container$.$scheduler$(
|
|
6891
|
+
iCtx.$container$.$scheduler$(16, task));
|
|
6542
6892
|
};
|
|
6543
6893
|
|
|
6544
6894
|
const useRunTask = (task, eagerness) => {
|
|
@@ -6576,7 +6926,7 @@ const PrefetchServiceWorker = opts => {
|
|
|
6576
6926
|
...opts
|
|
6577
6927
|
};
|
|
6578
6928
|
resolvedOpts.path = opts?.path?.startsWith?.("/") ? opts.path : baseUrl + resolvedOpts.path;
|
|
6579
|
-
let code = PREFETCH_CODE.replace("
|
|
6929
|
+
let code = PREFETCH_CODE.replace('"_URL_"', JSON.stringify(resolvedOpts.path.split("/").pop()));
|
|
6580
6930
|
isDev || (code = code.replaceAll(/\s\s+/gm, ""));
|
|
6581
6931
|
const props = {
|
|
6582
6932
|
dangerouslySetInnerHTML: [ "(" + code + ")(", [ "navigator.serviceWorker" ].join(","), ");" ].join(""),
|
|
@@ -6590,9 +6940,15 @@ const PREFETCH_CODE = /*#__PURE__*/ (c => {
|
|
|
6590
6940
|
registrations.forEach(registration => {
|
|
6591
6941
|
registration.active && registration.active.scriptURL.endsWith("_URL_") && registration.unregister().catch(console.error);
|
|
6592
6942
|
});
|
|
6593
|
-
})
|
|
6943
|
+
}), "caches" in window && caches.keys().then(names => {
|
|
6944
|
+
const cacheName = names.find(name => name.startsWith("QwikBundles"));
|
|
6945
|
+
cacheName && caches.delete(cacheName).catch(console.error);
|
|
6946
|
+
}).catch(console.error);
|
|
6594
6947
|
}).toString();
|
|
6595
6948
|
|
|
6596
6949
|
const PrefetchGraph = () => null;
|
|
6597
6950
|
|
|
6598
|
-
|
|
6951
|
+
globalThis.__qwik && console.error(`==============================================\nQwik version ${globalThis.__qwik} already imported while importing ${version}. Verify external vs bundled imports etc. This can lead to issues due to duplicated shared structures.\n==============================================\n`),
|
|
6952
|
+
globalThis.__qwik = version;
|
|
6953
|
+
|
|
6954
|
+
export { $, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, SkipRender, Slot, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, EMPTY_ARRAY as _EMPTY_ARRAY, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, _UNINITIALIZED, _VAR_PROPS, _deserialize, dumpState as _dumpState, _fnSignal, _getConstProps, _getContextContainer, _getContextElement, _getContextEvent, getDomContainer as _getDomContainer, _getQContainerElement, _getVarProps, _hasStoreEffects, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, _regSymbol, _resolveContextWithoutSequentialScope, _restProps, _run, _serializationWeakRef, _serialize, scheduleTask as _task, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttr as _vnode_getAttr, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getFirstChild as _vnode_getFirstChild, vnode_getNextSibling as _vnode_getNextSibling, vnode_getPropStartIndex as _vnode_getPropStartIndex, vnode_getProps as _vnode_getProps, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncComputed$, createAsyncComputedSignal as createAsyncComputedQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsx as jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsyncComputed$, useAsyncComputedQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
|