@qwik.dev/core 2.0.0-beta.8 → 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 +2 -2
- package/dist/core-internal.d.ts +105 -55
- package/dist/core.cjs +976 -456
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +974 -456
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +638 -351
- package/dist/core.prod.mjs +709 -362
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +75 -73
- package/dist/optimizer.mjs +75 -75
- package/dist/server.cjs +143 -42
- package/dist/server.d.ts +9 -0
- package/dist/server.mjs +140 -42
- package/dist/testing/index.cjs +3749 -927
- package/dist/testing/index.d.ts +972 -1
- package/dist/testing/index.mjs +3735 -921
- package/dist/testing/package.json +1 -1
- package/package.json +4 -2
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.8-dev+434cd18";
|
|
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) => {
|
|
@@ -859,25 +862,23 @@ const log = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToS
|
|
|
859
862
|
class ComputedSignalImpl extends SignalImpl {
|
|
860
863
|
$computeQrl$;
|
|
861
864
|
$flags$;
|
|
862
|
-
$forceRunEffects$=!1;
|
|
863
865
|
[_EFFECT_BACK_REF]=null;
|
|
864
|
-
constructor(container, fn, flags =
|
|
866
|
+
constructor(container, fn, flags = 33) {
|
|
865
867
|
super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
|
|
866
868
|
}
|
|
867
869
|
invalidate() {
|
|
868
|
-
this.$flags$ |= 1, this.$
|
|
870
|
+
this.$flags$ |= 1, this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
869
871
|
}
|
|
870
872
|
force() {
|
|
871
|
-
this.$
|
|
873
|
+
this.$flags$ |= 2, super.force();
|
|
872
874
|
}
|
|
873
875
|
get untrackedValue() {
|
|
874
|
-
|
|
875
|
-
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
876
|
+
return this.$computeIfNeeded$(), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state"),
|
|
876
877
|
this.$untrackedValue$;
|
|
877
878
|
}
|
|
878
879
|
$computeIfNeeded$() {
|
|
879
880
|
if (!(1 & this.$flags$)) {
|
|
880
|
-
return
|
|
881
|
+
return;
|
|
881
882
|
}
|
|
882
883
|
const computeQrl = this.$computeQrl$;
|
|
883
884
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -890,8 +891,8 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
890
891
|
throw qError(29, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
|
|
891
892
|
}
|
|
892
893
|
this.$flags$ &= -2;
|
|
893
|
-
|
|
894
|
-
|
|
894
|
+
untrackedValue !== this.$untrackedValue$ && (this.$untrackedValue$ !== NEEDS_COMPUTATION && (this.$flags$ |= 2),
|
|
895
|
+
this.$untrackedValue$ = untrackedValue);
|
|
895
896
|
} finally {
|
|
896
897
|
ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
|
|
897
898
|
}
|
|
@@ -906,12 +907,12 @@ class ComputedSignalImpl extends SignalImpl {
|
|
|
906
907
|
|
|
907
908
|
class SerializerSignalImpl extends ComputedSignalImpl {
|
|
908
909
|
constructor(container, argQrl) {
|
|
909
|
-
super(container, argQrl,
|
|
910
|
+
super(container, argQrl, 33);
|
|
910
911
|
}
|
|
911
912
|
$didInitialize$=!1;
|
|
912
913
|
$computeIfNeeded$() {
|
|
913
914
|
if (!(1 & this.$flags$)) {
|
|
914
|
-
return
|
|
915
|
+
return;
|
|
915
916
|
}
|
|
916
917
|
throwIfQRLNotResolved(this.$computeQrl$);
|
|
917
918
|
let arg = this.$computeQrl$.resolved;
|
|
@@ -921,8 +922,8 @@ class SerializerSignalImpl extends ComputedSignalImpl {
|
|
|
921
922
|
const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
|
|
922
923
|
const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) || currentValue : deserialize(currentValue), this, ".", this.$container$);
|
|
923
924
|
const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
|
|
924
|
-
|
|
925
|
-
|
|
925
|
+
this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$flags$ |= 2,
|
|
926
|
+
this.$untrackedValue$ = untrackedValue);
|
|
926
927
|
}
|
|
927
928
|
}
|
|
928
929
|
|
|
@@ -930,6 +931,16 @@ const getStoreHandler = value => value[STORE_HANDLER];
|
|
|
930
931
|
|
|
931
932
|
const getStoreTarget = value => value?.[STORE_TARGET] || null;
|
|
932
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
|
+
|
|
933
944
|
const unwrapStore = value => getStoreTarget(value) || value;
|
|
934
945
|
|
|
935
946
|
const isStore = value => STORE_TARGET in value;
|
|
@@ -957,6 +968,10 @@ class StoreHandler {
|
|
|
957
968
|
toString() {
|
|
958
969
|
return "[Store]";
|
|
959
970
|
}
|
|
971
|
+
force(prop) {
|
|
972
|
+
const target = getStoreTarget(this);
|
|
973
|
+
this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$));
|
|
974
|
+
}
|
|
960
975
|
get(target, prop) {
|
|
961
976
|
if ("symbol" == typeof prop) {
|
|
962
977
|
return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
|
|
@@ -993,7 +1008,7 @@ class StoreHandler {
|
|
|
993
1008
|
return !0;
|
|
994
1009
|
}
|
|
995
1010
|
deleteProperty(target, prop) {
|
|
996
|
-
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$)),
|
|
997
1012
|
!0);
|
|
998
1013
|
}
|
|
999
1014
|
has(target, prop) {
|
|
@@ -1032,7 +1047,9 @@ function addStoreEffect(target, prop, store, effectSubscription) {
|
|
|
1032
1047
|
}
|
|
1033
1048
|
|
|
1034
1049
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
1035
|
-
target[prop] = value
|
|
1050
|
+
target[prop] = value;
|
|
1051
|
+
const effects = getEffects(target, prop, currentStore.$effects$);
|
|
1052
|
+
effects && currentStore.$container$?.$scheduler$(7, null, currentStore, effects);
|
|
1036
1053
|
}
|
|
1037
1054
|
|
|
1038
1055
|
function getEffects(target, prop, storeEffects) {
|
|
@@ -1129,7 +1146,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
|
|
|
1129
1146
|
}
|
|
1130
1147
|
$computeIfNeeded$() {
|
|
1131
1148
|
if (!(1 & this.$flags$)) {
|
|
1132
|
-
return
|
|
1149
|
+
return;
|
|
1133
1150
|
}
|
|
1134
1151
|
const computeQrl = this.$computeQrl$;
|
|
1135
1152
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -1147,7 +1164,8 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
|
|
|
1147
1164
|
}
|
|
1148
1165
|
this.$promiseValue$ = NEEDS_COMPUTATION, this.$flags$ &= -2;
|
|
1149
1166
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
1150
|
-
return didChange && (this.$untrackedValue$ = untrackedValue),
|
|
1167
|
+
return didChange && (this.$flags$ |= 2, this.$untrackedValue$ = untrackedValue),
|
|
1168
|
+
didChange;
|
|
1151
1169
|
}
|
|
1152
1170
|
}
|
|
1153
1171
|
|
|
@@ -1181,7 +1199,7 @@ const _wrapProp = (...args) => {
|
|
|
1181
1199
|
}
|
|
1182
1200
|
if (isSignal(obj)) {
|
|
1183
1201
|
return obj instanceof AsyncComputedSignalImpl || assertEqual(prop, "value", "Left side is a signal, prop must be value"),
|
|
1184
|
-
obj instanceof WrappedSignalImpl &&
|
|
1202
|
+
obj instanceof WrappedSignalImpl && 4 & obj.flags ? obj : getWrapped(args);
|
|
1185
1203
|
}
|
|
1186
1204
|
if (isPropsProxy(obj)) {
|
|
1187
1205
|
const constProps = obj[_CONST_PROPS];
|
|
@@ -1220,7 +1238,7 @@ function isSlotProp(prop) {
|
|
|
1220
1238
|
return !prop.startsWith("q:") && !prop.startsWith(":");
|
|
1221
1239
|
}
|
|
1222
1240
|
|
|
1223
|
-
const _restProps = (props, omit, target = {}) => {
|
|
1241
|
+
const _restProps = (props, omit = [], target = {}) => {
|
|
1224
1242
|
let constPropsTarget = null;
|
|
1225
1243
|
const constProps = props[_CONST_PROPS];
|
|
1226
1244
|
if (constProps) {
|
|
@@ -1500,8 +1518,8 @@ function addUseOnEvents(jsx, useOnEvents) {
|
|
|
1500
1518
|
}
|
|
1501
1519
|
targetElement = placeholderElement;
|
|
1502
1520
|
}
|
|
1503
|
-
targetElement && ("script" === targetElement.type && "onQvisible$" === key && (eventKey = "document:
|
|
1504
|
-
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.')),
|
|
1505
1523
|
addUseOnEvent(targetElement, eventKey, useOnEvents[key]));
|
|
1506
1524
|
}
|
|
1507
1525
|
}
|
|
@@ -1573,10 +1591,10 @@ const applyQwikComponentBody = (ssr, jsx, component) => {
|
|
|
1573
1591
|
const host = ssr.getOrCreateLastNode();
|
|
1574
1592
|
const [componentQrl] = component[SERIALIZABLE_STATE];
|
|
1575
1593
|
const srcProps = jsx.props;
|
|
1576
|
-
srcProps && srcProps.children && delete srcProps.children
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
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);
|
|
1580
1598
|
};
|
|
1581
1599
|
|
|
1582
1600
|
class ParentComponentData {
|
|
@@ -1658,7 +1676,14 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
1658
1676
|
appendClassIfScopedStyleExists(jsx, options.styleScoped);
|
|
1659
1677
|
let qwikInspectorAttrValue = null;
|
|
1660
1678
|
isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
|
|
1661
|
-
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);
|
|
1662
1687
|
innerHTML && ssr.htmlNode(innerHTML), enqueue(ssr.closeElement), "head" === type ? (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1663
1688
|
ssr.emitPreloaderPre(), enqueue(ssr.additionalHeadNodes)) : "body" === type ? enqueue(ssr.additionalBodyNodes) : ssr.isHtml || ssr._didAddQwikLoader || (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1664
1689
|
ssr.emitPreloaderPre(), ssr._didAddQwikLoader = !0);
|
|
@@ -1726,18 +1751,19 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
1726
1751
|
}
|
|
1727
1752
|
}
|
|
1728
1753
|
|
|
1729
|
-
function varPropsToSsrAttrs(varProps, constProps,
|
|
1730
|
-
return toSsrAttrs(varProps, constProps,
|
|
1754
|
+
function varPropsToSsrAttrs(varProps, constProps, options) {
|
|
1755
|
+
return toSsrAttrs(varProps, constProps, !1, options);
|
|
1731
1756
|
}
|
|
1732
1757
|
|
|
1733
|
-
function constPropsToSsrAttrs(constProps, varProps,
|
|
1734
|
-
return toSsrAttrs(constProps, varProps,
|
|
1758
|
+
function constPropsToSsrAttrs(constProps, varProps, options) {
|
|
1759
|
+
return toSsrAttrs(constProps, varProps, !0, options);
|
|
1735
1760
|
}
|
|
1736
1761
|
|
|
1737
|
-
function toSsrAttrs(record, anotherRecord,
|
|
1762
|
+
function toSsrAttrs(record, anotherRecord, isConst, options) {
|
|
1738
1763
|
if (null == record) {
|
|
1739
1764
|
return null;
|
|
1740
1765
|
}
|
|
1766
|
+
const pushMergedEventProps = !isConst;
|
|
1741
1767
|
const ssrAttrs = [];
|
|
1742
1768
|
for (const key in record) {
|
|
1743
1769
|
let value = record[key];
|
|
@@ -1751,14 +1777,14 @@ function toSsrAttrs(record, anotherRecord, serializationCtx, pushMergedEventProp
|
|
|
1751
1777
|
value = getMergedEventPropValues(value, anotherValue);
|
|
1752
1778
|
}
|
|
1753
1779
|
}
|
|
1754
|
-
const eventValue = setEvent(serializationCtx, key, value);
|
|
1780
|
+
const eventValue = setEvent(options.serializationCtx, key, value);
|
|
1755
1781
|
eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
|
|
1756
1782
|
continue;
|
|
1757
1783
|
}
|
|
1758
|
-
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
|
|
1759
|
-
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));
|
|
1760
1786
|
}
|
|
1761
|
-
return null != key && ssrAttrs.push("q:key", key), ssrAttrs;
|
|
1787
|
+
return null != options.key && ssrAttrs.push("q:key", options.key), ssrAttrs;
|
|
1762
1788
|
}
|
|
1763
1789
|
|
|
1764
1790
|
function getMergedEventPropValues(value, anotherValue) {
|
|
@@ -1783,7 +1809,7 @@ function setEvent(serializationCtx, key, rawValue) {
|
|
|
1783
1809
|
const appendToValue = valueToAppend => {
|
|
1784
1810
|
value = (null == value ? "" : value + "\n") + valueToAppend;
|
|
1785
1811
|
};
|
|
1786
|
-
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 ])),
|
|
1787
1813
|
qrlToString(serializationCtx, qrl));
|
|
1788
1814
|
if (Array.isArray(qrls)) {
|
|
1789
1815
|
for (let i = 0; i <= qrls.length; i++) {
|
|
@@ -1839,8 +1865,10 @@ const useTaskQrl = qrl => {
|
|
|
1839
1865
|
assertQrl(qrl), set(1);
|
|
1840
1866
|
const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
1841
1867
|
set(task);
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1868
|
+
const result = runTask(task, iCtx.$container$, iCtx.$hostElement$);
|
|
1869
|
+
if (isPromise(result)) {
|
|
1870
|
+
throw result;
|
|
1871
|
+
}
|
|
1844
1872
|
};
|
|
1845
1873
|
|
|
1846
1874
|
const runTask = (task, container, host) => {
|
|
@@ -1891,7 +1919,7 @@ const isTask = value => value instanceof Task;
|
|
|
1891
1919
|
|
|
1892
1920
|
const scheduleTask = (_event, element) => {
|
|
1893
1921
|
const [task] = useLexicalScope();
|
|
1894
|
-
const type = 1 & task.$flags$ ?
|
|
1922
|
+
const type = 1 & task.$flags$ ? 16 : 3;
|
|
1895
1923
|
getDomContainer(element).$scheduler$(type, task);
|
|
1896
1924
|
};
|
|
1897
1925
|
|
|
@@ -2012,7 +2040,7 @@ class PropsProxyHandler {
|
|
|
2012
2040
|
return this.$children$;
|
|
2013
2041
|
}
|
|
2014
2042
|
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
2015
|
-
return value instanceof WrappedSignalImpl &&
|
|
2043
|
+
return value instanceof WrappedSignalImpl && 4 & value.$flags$ ? value.value : value;
|
|
2016
2044
|
}
|
|
2017
2045
|
set(_, prop, value) {
|
|
2018
2046
|
return prop === _CONST_PROPS ? (this.$constProps$ = value, !0) : prop === _VAR_PROPS ? (this.$varProps$ = value,
|
|
@@ -2275,36 +2303,38 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2275
2303
|
}
|
|
2276
2304
|
}();
|
|
2277
2305
|
function diff(jsxNode, vStartNode) {
|
|
2278
|
-
|
|
2306
|
+
if (assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode"), assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode"),
|
|
2279
2307
|
vParent = vStartNode, vNewNode = null, vCurrent = vnode_getFirstChild(vStartNode),
|
|
2280
|
-
stackPush(jsxNode, !0)
|
|
2281
|
-
for (;
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
if (
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
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("");
|
|
2301
2333
|
}
|
|
2302
|
-
|
|
2303
|
-
jsxValue === SkipRender ? journal = [] : expectText("");
|
|
2334
|
+
advance();
|
|
2304
2335
|
}
|
|
2305
|
-
|
|
2336
|
+
expectNoMore(), ascend();
|
|
2306
2337
|
}
|
|
2307
|
-
expectNoMore(), ascend();
|
|
2308
2338
|
}
|
|
2309
2339
|
}
|
|
2310
2340
|
function advance() {
|
|
@@ -2566,8 +2596,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
2566
2596
|
let returnValue = !1;
|
|
2567
2597
|
return qrls.flat(2).forEach(qrl => {
|
|
2568
2598
|
if (qrl) {
|
|
2569
|
-
|
|
2570
|
-
|
|
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
|
+
}
|
|
2571
2605
|
}
|
|
2572
2606
|
}), returnValue;
|
|
2573
2607
|
}));
|
|
@@ -2762,7 +2796,7 @@ function cleanup(container, vNode) {
|
|
|
2762
2796
|
const obj = seq[i];
|
|
2763
2797
|
if (isTask(obj)) {
|
|
2764
2798
|
const task = obj;
|
|
2765
|
-
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(
|
|
2799
|
+
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(32, task) : cleanupTask(task);
|
|
2766
2800
|
}
|
|
2767
2801
|
}
|
|
2768
2802
|
}
|
|
@@ -2788,7 +2822,9 @@ function cleanup(container, vNode) {
|
|
|
2788
2822
|
if (vCursor === vNode) {
|
|
2789
2823
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
2790
2824
|
if (vFirstChild) {
|
|
2791
|
-
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
|
+
});
|
|
2792
2828
|
}
|
|
2793
2829
|
}
|
|
2794
2830
|
} else {
|
|
@@ -2849,8 +2885,9 @@ const useResourceQrl = (qrl, opts) => {
|
|
|
2849
2885
|
assertQrl(qrl);
|
|
2850
2886
|
const container = iCtx.$container$;
|
|
2851
2887
|
const resource = createResourceReturn(container, opts);
|
|
2852
|
-
const
|
|
2853
|
-
|
|
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;
|
|
2854
2891
|
};
|
|
2855
2892
|
|
|
2856
2893
|
const Resource = props => _jsxSorted(Fragment, null, null, getResourceValueAsPromise(props), 0, null);
|
|
@@ -2858,8 +2895,8 @@ const Resource = props => _jsxSorted(Fragment, null, null, getResourceValueAsPro
|
|
|
2858
2895
|
function getResourceValueAsPromise(props) {
|
|
2859
2896
|
const resource = props.value;
|
|
2860
2897
|
if (isResourceReturn(resource)) {
|
|
2898
|
+
const state = resource._state;
|
|
2861
2899
|
if (!isServerPlatform()) {
|
|
2862
|
-
const state = resource._state;
|
|
2863
2900
|
if ("pending" === state && props.onPending) {
|
|
2864
2901
|
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
2865
2902
|
}
|
|
@@ -2873,8 +2910,7 @@ function getResourceValueAsPromise(props) {
|
|
|
2873
2910
|
}
|
|
2874
2911
|
}
|
|
2875
2912
|
}
|
|
2876
|
-
|
|
2877
|
-
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));
|
|
2878
2914
|
}
|
|
2879
2915
|
if (isPromise(resource)) {
|
|
2880
2916
|
return resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
@@ -2927,21 +2963,21 @@ const runResource = (task, container, host) => {
|
|
|
2927
2963
|
let reject;
|
|
2928
2964
|
let done = !1;
|
|
2929
2965
|
const setState = (resolved, value) => !done && (done = !0, resolved ? (done = !0,
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
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);
|
|
2933
2970
|
cleanups.push(() => {
|
|
2934
2971
|
if (!0 === untrack(() => resource.loading)) {
|
|
2935
2972
|
const value = untrack(() => resource._resolved);
|
|
2936
2973
|
setState(!0, value);
|
|
2937
2974
|
}
|
|
2938
2975
|
}), invoke(iCtx, () => {
|
|
2939
|
-
resource._state = "pending", resource.loading = !isServerPlatform()
|
|
2940
|
-
(resource.value = new Promise((r, re) => {
|
|
2976
|
+
resource._state = "pending", resource.loading = !isServerPlatform(), resource.value = new Promise((r, re) => {
|
|
2941
2977
|
resolve = r, reject = re;
|
|
2942
|
-
})
|
|
2978
|
+
});
|
|
2943
2979
|
});
|
|
2944
|
-
const promise = safeCall(() =>
|
|
2980
|
+
const promise = safeCall(() => taskFn(opts), value => {
|
|
2945
2981
|
setState(!0, value);
|
|
2946
2982
|
}, err => {
|
|
2947
2983
|
if (isPromise(err)) {
|
|
@@ -2955,8 +2991,6 @@ const runResource = (task, container, host) => {
|
|
|
2955
2991
|
}) ]) : promise;
|
|
2956
2992
|
};
|
|
2957
2993
|
|
|
2958
|
-
const ignoreErrorToPreventNodeFromCrashing = () => {};
|
|
2959
|
-
|
|
2960
2994
|
const aVNodePath = [];
|
|
2961
2995
|
|
|
2962
2996
|
const bVNodePath = [];
|
|
@@ -3005,10 +3039,10 @@ const ssrNodeDocumentPosition = (a, b) => {
|
|
|
3005
3039
|
let aDepth = -1;
|
|
3006
3040
|
let bDepth = -1;
|
|
3007
3041
|
for (;a; ) {
|
|
3008
|
-
a = (aSsrNodePath[++aDepth] = a).
|
|
3042
|
+
a = (aSsrNodePath[++aDepth] = a).parentComponent;
|
|
3009
3043
|
}
|
|
3010
3044
|
for (;b; ) {
|
|
3011
|
-
b = (bSsrNodePath[++bDepth] = b).
|
|
3045
|
+
b = (bSsrNodePath[++bDepth] = b).parentComponent;
|
|
3012
3046
|
}
|
|
3013
3047
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
3014
3048
|
if ((a = aSsrNodePath[aDepth]) !== (b = bSsrNodePath[bDepth])) {
|
|
@@ -3019,26 +3053,199 @@ const ssrNodeDocumentPosition = (a, b) => {
|
|
|
3019
3053
|
return aDepth < bDepth ? -1 : 1;
|
|
3020
3054
|
};
|
|
3021
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
|
+
|
|
3022
3219
|
const DEBUG = !1;
|
|
3023
3220
|
|
|
3024
|
-
|
|
3025
|
-
chore.$resolve$ = resolve;
|
|
3026
|
-
});
|
|
3221
|
+
var ChoreState;
|
|
3027
3222
|
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
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;
|
|
3032
3234
|
let drainScheduled = !1;
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
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;
|
|
3042
3249
|
isTask && (hostOrTask.$flags$ |= 8);
|
|
3043
3250
|
let chore = {
|
|
3044
3251
|
$type$: type,
|
|
@@ -3046,184 +3253,218 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3046
3253
|
$host$: isTask ? hostOrTask.$el$ : hostOrTask,
|
|
3047
3254
|
$target$: targetOrQrl,
|
|
3048
3255
|
$payload$: isTask ? hostOrTask : payload,
|
|
3049
|
-
$
|
|
3050
|
-
$
|
|
3051
|
-
$
|
|
3052
|
-
$
|
|
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
|
|
3053
3263
|
};
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$);
|
|
3077
|
-
existing.$executed$ && (existing.$executed$ = !1);
|
|
3078
|
-
return existing;
|
|
3079
|
-
}(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
|
|
3080
|
-
schedule(16), scheduleDrain()?.catch?.(() => {}));
|
|
3081
|
-
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;
|
|
3082
3286
|
};
|
|
3083
|
-
function
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
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;
|
|
3093
3316
|
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
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();
|
|
3098
3353
|
}
|
|
3099
|
-
} else {
|
|
3100
|
-
vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer);
|
|
3101
3354
|
}
|
|
3355
|
+
} catch (e) {
|
|
3356
|
+
handleError(currentChore, e), scheduleBlockedChoresAndDrainIfNeeded(currentChore);
|
|
3357
|
+
} finally {
|
|
3358
|
+
isDraining = !1, maybeFinishDrain();
|
|
3102
3359
|
}
|
|
3103
|
-
|
|
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$);
|
|
3104
3368
|
}
|
|
3105
3369
|
function executeChore(chore, isServer) {
|
|
3106
3370
|
const host = chore.$host$;
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
break;
|
|
3114
|
-
|
|
3115
|
-
case 16:
|
|
3116
|
-
returnValue = journalFlush(), drainScheduled = !1;
|
|
3117
|
-
break;
|
|
3118
|
-
|
|
3119
|
-
case 6:
|
|
3120
|
-
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
3121
|
-
if (isServer) {
|
|
3122
|
-
return jsx;
|
|
3123
|
-
}
|
|
3124
|
-
{
|
|
3125
|
-
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
3126
|
-
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
3127
|
-
}
|
|
3128
|
-
}, err => container.handleError(err, host));
|
|
3129
|
-
break;
|
|
3130
|
-
|
|
3131
|
-
case 2:
|
|
3132
|
-
{
|
|
3133
|
-
const fn = chore.$target$.getFn();
|
|
3134
|
-
const result = retryOnPromise(() => fn(...chore.$payload$));
|
|
3135
|
-
if (isPromise(result)) {
|
|
3136
|
-
const handled = result.finally(() => {
|
|
3137
|
-
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
3138
|
-
}).catch(error => {
|
|
3139
|
-
container.handleError(error, chore.$host$);
|
|
3140
|
-
});
|
|
3141
|
-
return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
|
|
3142
|
-
currentChore = null, void (chore.$executed$ = !0);
|
|
3143
|
-
}
|
|
3144
|
-
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;
|
|
3145
3377
|
}
|
|
3146
|
-
break;
|
|
3147
|
-
|
|
3148
|
-
case 3:
|
|
3149
|
-
case 32:
|
|
3150
3378
|
{
|
|
3151
|
-
const
|
|
3152
|
-
|
|
3153
|
-
const result = runResource(payload, container, host);
|
|
3154
|
-
returnValue = isServer ? result : null;
|
|
3155
|
-
} else {
|
|
3156
|
-
returnValue = runTask(payload, container, host);
|
|
3157
|
-
}
|
|
3379
|
+
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
3380
|
+
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
3158
3381
|
}
|
|
3159
|
-
|
|
3382
|
+
}, err => {
|
|
3383
|
+
handleError(chore, err);
|
|
3384
|
+
});
|
|
3385
|
+
break;
|
|
3160
3386
|
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3387
|
+
case 2:
|
|
3388
|
+
{
|
|
3389
|
+
const fn = chore.$target$.getFn();
|
|
3390
|
+
returnValue = retryOnPromise(() => fn(...chore.$payload$));
|
|
3391
|
+
}
|
|
3392
|
+
break;
|
|
3164
3393
|
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
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;
|
|
3172
3401
|
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
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 {
|
|
3183
3427
|
if (isConst) {
|
|
3184
3428
|
journal.push(2, virtualNode[6], property, serializedValue);
|
|
3185
3429
|
} else {
|
|
3186
3430
|
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
3187
3431
|
}
|
|
3432
|
+
returnValue = void 0;
|
|
3188
3433
|
}
|
|
3189
|
-
|
|
3434
|
+
}
|
|
3435
|
+
break;
|
|
3190
3436
|
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3437
|
+
case 1:
|
|
3438
|
+
{
|
|
3439
|
+
const target = chore.$target$;
|
|
3440
|
+
returnValue = target.resolved ? null : target.resolve();
|
|
3441
|
+
}
|
|
3442
|
+
break;
|
|
3197
3443
|
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
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) {
|
|
3202
3454
|
const ctx = newInvokeContext();
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
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));
|
|
3207
3458
|
}
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
} else {
|
|
3214
|
-
returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
|
|
3215
|
-
}
|
|
3459
|
+
});
|
|
3460
|
+
} else {
|
|
3461
|
+
returnValue = retryOnPromise(() => {
|
|
3462
|
+
triggerEffects(container, target, effects);
|
|
3463
|
+
});
|
|
3216
3464
|
}
|
|
3217
3465
|
}
|
|
3218
|
-
} catch (e) {
|
|
3219
|
-
returnValue = Promise.reject(e);
|
|
3220
3466
|
}
|
|
3221
|
-
|
|
3222
|
-
currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
|
|
3223
|
-
chore.$resolve$?.(value));
|
|
3224
|
-
};
|
|
3225
|
-
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, error => after(void 0, error)),
|
|
3226
|
-
chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
|
|
3467
|
+
return returnValue;
|
|
3227
3468
|
}
|
|
3228
3469
|
function choreComparator(a, b, rootVNode) {
|
|
3229
3470
|
const macroTypeDiff = (240 & a.$type$) - (240 & b.$type$);
|
|
@@ -3241,8 +3482,6 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3241
3482
|
} else {
|
|
3242
3483
|
assertFalse(vnode_isVNode(aHost), "expected aHost to be SSRNode but it is a VNode"),
|
|
3243
3484
|
assertFalse(vnode_isVNode(bHost), "expected bHost to be SSRNode but it is a VNode");
|
|
3244
|
-
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()}`;
|
|
3245
|
-
logWarn(errorMessage);
|
|
3246
3485
|
const hostDiff = ssrNodeDocumentPosition(aHost, bHost);
|
|
3247
3486
|
if (0 !== hostDiff) {
|
|
3248
3487
|
return hostDiff;
|
|
@@ -3254,7 +3493,39 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
3254
3493
|
return microTypeDiff;
|
|
3255
3494
|
}
|
|
3256
3495
|
const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
|
|
3257
|
-
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;
|
|
3258
3529
|
}
|
|
3259
3530
|
};
|
|
3260
3531
|
|
|
@@ -3264,6 +3535,26 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
3264
3535
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
|
|
3265
3536
|
}
|
|
3266
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
|
+
|
|
3267
3558
|
function debugChoreTypeToString(type) {
|
|
3268
3559
|
return {
|
|
3269
3560
|
1: "QRL_RESOLVE",
|
|
@@ -3273,26 +3564,53 @@ function debugChoreTypeToString(type) {
|
|
|
3273
3564
|
5: "NODE_PROP",
|
|
3274
3565
|
6: "COMPONENT",
|
|
3275
3566
|
7: "RECOMPUTE_SIGNAL",
|
|
3276
|
-
16: "
|
|
3277
|
-
32: "
|
|
3278
|
-
|
|
3279
|
-
255: "WAIT_FOR_ALL"
|
|
3567
|
+
16: "VISIBLE",
|
|
3568
|
+
32: "CLEANUP_VISIBLE",
|
|
3569
|
+
255: "WAIT_FOR_QUEUE"
|
|
3280
3570
|
}[type] || "UNKNOWN: " + type;
|
|
3281
3571
|
}
|
|
3282
3572
|
|
|
3283
|
-
function
|
|
3284
|
-
const
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
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");
|
|
3296
3614
|
}
|
|
3297
3615
|
|
|
3298
3616
|
class _SharedContainer {
|
|
@@ -3305,11 +3623,12 @@ class _SharedContainer {
|
|
|
3305
3623
|
$currentUniqueId$=0;
|
|
3306
3624
|
$instanceHash$=null;
|
|
3307
3625
|
$buildBase$=null;
|
|
3308
|
-
|
|
3626
|
+
$flushEpoch$=0;
|
|
3627
|
+
constructor(journalFlush, serverData, locale) {
|
|
3309
3628
|
this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version,
|
|
3310
3629
|
this.$storeProxyMap$ = new WeakMap, this.$getObjectById$ = () => {
|
|
3311
3630
|
throw Error("Not implemented");
|
|
3312
|
-
}, this.$scheduler$ = createScheduler(this,
|
|
3631
|
+
}, this.$scheduler$ = createScheduler(this, journalFlush);
|
|
3313
3632
|
}
|
|
3314
3633
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3315
3634
|
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
@@ -3477,7 +3796,10 @@ function processVNodeData$1(document) {
|
|
|
3477
3796
|
nextNode = nextSibling(node);
|
|
3478
3797
|
const shadowRootContainer = node;
|
|
3479
3798
|
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
3480
|
-
|
|
3799
|
+
if (shadowRoot) {
|
|
3800
|
+
const firstShadowRootChild = firstChild(shadowRoot);
|
|
3801
|
+
walkContainer(document.createTreeWalker(firstShadowRootChild, 129), null, firstShadowRootChild, null, "", null);
|
|
3802
|
+
}
|
|
3481
3803
|
}
|
|
3482
3804
|
if (!(2 & ~nodeType)) {
|
|
3483
3805
|
if (vNodeElementIndex < elementIdx) {
|
|
@@ -3518,7 +3840,7 @@ function getDomContainerFromQContainerElement(qContainerElement) {
|
|
|
3518
3840
|
}
|
|
3519
3841
|
|
|
3520
3842
|
function _getQContainerElement(element) {
|
|
3521
|
-
return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
|
|
3843
|
+
return (Array.isArray(element) ? vnode_getDomParent(element, !0) : element).closest(QContainerSelector);
|
|
3522
3844
|
}
|
|
3523
3845
|
|
|
3524
3846
|
const isDomContainer = container => container instanceof DomContainer;
|
|
@@ -3530,7 +3852,6 @@ class DomContainer extends _SharedContainer {
|
|
|
3530
3852
|
rootVNode;
|
|
3531
3853
|
document;
|
|
3532
3854
|
$journal$;
|
|
3533
|
-
renderDone=null;
|
|
3534
3855
|
$rawStateData$;
|
|
3535
3856
|
$storeProxyMap$=new WeakMap;
|
|
3536
3857
|
$qFuncs$;
|
|
@@ -3540,10 +3861,11 @@ class DomContainer extends _SharedContainer {
|
|
|
3540
3861
|
vNodeLocate=id => vnode_locate(this.rootVNode, id);
|
|
3541
3862
|
$stateData$;
|
|
3542
3863
|
$styleIds$=null;
|
|
3543
|
-
$renderCount$=0;
|
|
3544
3864
|
constructor(element) {
|
|
3545
|
-
if (super(() =>
|
|
3546
|
-
|
|
3865
|
+
if (super(() => {
|
|
3866
|
+
this.$flushEpoch$++, vnode_applyJournal(this.$journal$);
|
|
3867
|
+
}, {}, element.getAttribute("q:locale")), this.qContainer = element.getAttribute("q:container"),
|
|
3868
|
+
!this.qContainer) {
|
|
3547
3869
|
throw qError(25);
|
|
3548
3870
|
}
|
|
3549
3871
|
this.$journal$ = [ 3, element.ownerDocument ], this.document = element.ownerDocument,
|
|
@@ -3621,26 +3943,6 @@ class DomContainer extends _SharedContainer {
|
|
|
3621
3943
|
}
|
|
3622
3944
|
return vnode_getProp(vNode, name, getObjectById);
|
|
3623
3945
|
}
|
|
3624
|
-
scheduleRender() {
|
|
3625
|
-
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick(() => this.processChores()),
|
|
3626
|
-
this.renderDone.finally(() => emitEvent("qrender", {
|
|
3627
|
-
instanceHash: this.$instanceHash$,
|
|
3628
|
-
renderCount: this.$renderCount$
|
|
3629
|
-
}));
|
|
3630
|
-
}
|
|
3631
|
-
processChores() {
|
|
3632
|
-
let renderCount = this.$renderCount$;
|
|
3633
|
-
const result = this.$scheduler$(255);
|
|
3634
|
-
if (isPromise(result)) {
|
|
3635
|
-
return result.then(async () => {
|
|
3636
|
-
for (;renderCount !== this.$renderCount$; ) {
|
|
3637
|
-
renderCount = this.$renderCount$, await this.$scheduler$(255);
|
|
3638
|
-
}
|
|
3639
|
-
this.renderDone = null;
|
|
3640
|
-
});
|
|
3641
|
-
}
|
|
3642
|
-
renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
|
|
3643
|
-
}
|
|
3644
3946
|
ensureProjectionResolved(vNode) {
|
|
3645
3947
|
if (!(16 & vNode[0])) {
|
|
3646
3948
|
vNode[0] |= 16;
|
|
@@ -3648,7 +3950,10 @@ class DomContainer extends _SharedContainer {
|
|
|
3648
3950
|
for (let i = 0; i < props.length; i += 2) {
|
|
3649
3951
|
if (isSlotProp(props[i])) {
|
|
3650
3952
|
const value = props[i + 1];
|
|
3651
|
-
"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
|
+
}
|
|
3652
3957
|
}
|
|
3653
3958
|
}
|
|
3654
3959
|
}
|
|
@@ -3723,7 +4028,7 @@ const addQrlToSerializationCtx = (effectSubscriber, container) => {
|
|
|
3723
4028
|
};
|
|
3724
4029
|
|
|
3725
4030
|
const triggerEffects = (container, signal, effects) => {
|
|
3726
|
-
const isBrowser =
|
|
4031
|
+
const isBrowser = !isServerPlatform();
|
|
3727
4032
|
if (effects) {
|
|
3728
4033
|
const scheduleEffect = effectSubscription => {
|
|
3729
4034
|
const consumer = effectSubscription[0];
|
|
@@ -3731,7 +4036,7 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
3731
4036
|
if (assertDefined(container, "Container must be defined."), isTask(consumer)) {
|
|
3732
4037
|
consumer.$flags$ |= 8;
|
|
3733
4038
|
let choreType = 3;
|
|
3734
|
-
1 & consumer.$flags$ && (choreType =
|
|
4039
|
+
1 & consumer.$flags$ && (choreType = 16), container.$scheduler$(choreType, consumer);
|
|
3735
4040
|
} else if (consumer instanceof SignalImpl) {
|
|
3736
4041
|
consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)),
|
|
3737
4042
|
consumer.invalidate();
|
|
@@ -3741,18 +4046,18 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
3741
4046
|
assertDefined(qrl, "Component must have QRL");
|
|
3742
4047
|
const props = container.getHostProp(host, "q:props");
|
|
3743
4048
|
container.$scheduler$(6, host, qrl, props);
|
|
3744
|
-
} else if (
|
|
3745
|
-
if (
|
|
4049
|
+
} else if ("." === property) {
|
|
4050
|
+
if (isBrowser) {
|
|
3746
4051
|
container.$scheduler$(4, consumer, consumer, signal);
|
|
3747
|
-
}
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
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);
|
|
3756
4061
|
}
|
|
3757
4062
|
}
|
|
3758
4063
|
};
|
|
@@ -3768,11 +4073,11 @@ const getComputedSignalFlags = serializationStrategy => {
|
|
|
3768
4073
|
let flags = 1;
|
|
3769
4074
|
switch (serializationStrategy) {
|
|
3770
4075
|
case "never":
|
|
3771
|
-
flags |=
|
|
4076
|
+
flags |= 16;
|
|
3772
4077
|
break;
|
|
3773
4078
|
|
|
3774
4079
|
case "always":
|
|
3775
|
-
flags |=
|
|
4080
|
+
flags |= 32;
|
|
3776
4081
|
}
|
|
3777
4082
|
return flags;
|
|
3778
4083
|
};
|
|
@@ -3966,13 +4271,16 @@ const vnode_ensureElementInflated = vnode => {
|
|
|
3966
4271
|
}
|
|
3967
4272
|
};
|
|
3968
4273
|
|
|
3969
|
-
function vnode_walkVNode(vNode) {
|
|
4274
|
+
function vnode_walkVNode(vNode, callback) {
|
|
3970
4275
|
let vCursor = vNode;
|
|
3971
4276
|
if (vnode_isTextVNode(vNode)) {
|
|
3972
4277
|
return;
|
|
3973
4278
|
}
|
|
3974
4279
|
let vParent = null;
|
|
3975
4280
|
for (;;) {
|
|
4281
|
+
if (callback?.(vCursor, vParent)) {
|
|
4282
|
+
return;
|
|
4283
|
+
}
|
|
3976
4284
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
3977
4285
|
if (vFirstChild) {
|
|
3978
4286
|
vCursor = vFirstChild;
|
|
@@ -4071,6 +4379,7 @@ const vnode_ensureTextInflated = (journal, vnode) => {
|
|
|
4071
4379
|
const textVNode = ensureTextVNode(vnode);
|
|
4072
4380
|
if (!(8 & textVNode[0])) {
|
|
4073
4381
|
const parentNode = vnode_getDomParent(vnode);
|
|
4382
|
+
assertDefined(parentNode, "Missing parent node.");
|
|
4074
4383
|
const sharedTextNode = textVNode[4];
|
|
4075
4384
|
const doc = parentNode.ownerDocument;
|
|
4076
4385
|
let cursor = vnode_getDomSibling(vnode, !1, !0);
|
|
@@ -4187,6 +4496,17 @@ const indexOfAlphanumeric = (id, length) => {
|
|
|
4187
4496
|
return length;
|
|
4188
4497
|
};
|
|
4189
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
|
+
|
|
4190
4510
|
const parseBoolean = value => "false" !== value && Boolean(value);
|
|
4191
4511
|
|
|
4192
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;
|
|
@@ -4247,26 +4567,29 @@ const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
|
|
|
4247
4567
|
}
|
|
4248
4568
|
insertBefore = null;
|
|
4249
4569
|
}
|
|
4250
|
-
const domParentVNode = vnode_getDomParentVNode(parent);
|
|
4570
|
+
const domParentVNode = vnode_getDomParentVNode(parent, !1);
|
|
4251
4571
|
const parentNode = domParentVNode && domParentVNode[6];
|
|
4252
4572
|
let domChildren = null;
|
|
4253
4573
|
domParentVNode && (domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild)),
|
|
4254
4574
|
newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, !1);
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
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
|
+
}
|
|
4259
4582
|
const vNext = insertBefore;
|
|
4260
4583
|
const vPrevious = vNext ? vNext[2] : parent[5];
|
|
4261
4584
|
vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild,
|
|
4262
|
-
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
|
|
4585
|
+
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent, parentIsDeleted && (newChild[0] |= 32);
|
|
4263
4586
|
};
|
|
4264
4587
|
|
|
4265
|
-
const vnode_getDomParent = vnode => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
|
|
4588
|
+
const vnode_getDomParent = (vnode, includeProjection = !0) => (vnode = vnode_getDomParentVNode(vnode, includeProjection)) && vnode[6];
|
|
4266
4589
|
|
|
4267
|
-
const vnode_getDomParentVNode = vnode => {
|
|
4590
|
+
const vnode_getDomParentVNode = (vnode, includeProjection = !0) => {
|
|
4268
4591
|
for (;vnode && !vnode_isElementVNode(vnode); ) {
|
|
4269
|
-
vnode = vnode[1];
|
|
4592
|
+
vnode = vnode[1] || (includeProjection ? vnode_getProp(vnode, "q:sparent", id => vnode_isVNode(id) ? id : null) : null);
|
|
4270
4593
|
}
|
|
4271
4594
|
return vnode;
|
|
4272
4595
|
};
|
|
@@ -4274,7 +4597,7 @@ const vnode_getDomParentVNode = vnode => {
|
|
|
4274
4597
|
const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
4275
4598
|
if (assertEqual(vParent, vnode_getParent(vToRemove), "Parent mismatch."), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove),
|
|
4276
4599
|
removeDOM) {
|
|
4277
|
-
const domParent = vnode_getDomParent(vParent);
|
|
4600
|
+
const domParent = vnode_getDomParent(vParent, !1);
|
|
4278
4601
|
if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
|
|
4279
4602
|
return;
|
|
4280
4603
|
}
|
|
@@ -4598,6 +4921,27 @@ const vnode_getProps = vnode => vnode[vnode_getPropStartIndex(vnode)];
|
|
|
4598
4921
|
|
|
4599
4922
|
const vnode_getParent = vnode => vnode[1] || null;
|
|
4600
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
|
+
|
|
4601
4945
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node."),
|
|
4602
4946
|
vnode[4]);
|
|
4603
4947
|
|
|
@@ -4832,9 +5176,9 @@ class DeserializationHandler {
|
|
|
4832
5176
|
}
|
|
4833
5177
|
const container = this.$container$;
|
|
4834
5178
|
let propValue = allocate(container, typeId, value);
|
|
4835
|
-
return
|
|
4836
|
-
|
|
4837
|
-
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;
|
|
4838
5182
|
}
|
|
4839
5183
|
has(target, property) {
|
|
4840
5184
|
return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
|
|
@@ -4962,7 +5306,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
4962
5306
|
const d = data;
|
|
4963
5307
|
computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
|
|
4964
5308
|
d.length > 2 ? (computed.$untrackedValue$ = d[2], 29 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
|
|
4965
|
-
computed.$computeQrl$.resolve(), container.$scheduler
|
|
5309
|
+
computed.$computeQrl$.resolve(), container.$scheduler$(1, null, computed.$computeQrl$));
|
|
4966
5310
|
break;
|
|
4967
5311
|
}
|
|
4968
5312
|
|
|
@@ -5529,8 +5873,8 @@ async function serialize(serializationContext) {
|
|
|
5529
5873
|
output(26, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
5530
5874
|
} else if (value instanceof ComputedSignalImpl) {
|
|
5531
5875
|
let v = value.$untrackedValue$;
|
|
5532
|
-
const shouldAlwaysSerialize =
|
|
5533
|
-
const shouldNeverSerialize =
|
|
5876
|
+
const shouldAlwaysSerialize = 32 & value.$flags$;
|
|
5877
|
+
const shouldNeverSerialize = 16 & value.$flags$;
|
|
5534
5878
|
const isInvalid = 1 & value.$flags$;
|
|
5535
5879
|
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
5536
5880
|
shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION),
|
|
@@ -6190,7 +6534,7 @@ const render = async (parent, jsxNode, opts = {}) => {
|
|
|
6190
6534
|
const container = getDomContainer(parent);
|
|
6191
6535
|
container.$serverData$ = opts.serverData || {};
|
|
6192
6536
|
const host = container.rootVNode;
|
|
6193
|
-
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255)
|
|
6537
|
+
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255).$returnValue$,
|
|
6194
6538
|
{
|
|
6195
6539
|
cleanup: () => {
|
|
6196
6540
|
cleanup(container, container.rootVNode);
|
|
@@ -6544,7 +6888,7 @@ const useVisibleTaskQrl = (qrl, opts) => {
|
|
|
6544
6888
|
assertQrl(qrl);
|
|
6545
6889
|
const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
6546
6890
|
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
|
|
6547
|
-
iCtx.$container$.$scheduler$(
|
|
6891
|
+
iCtx.$container$.$scheduler$(16, task));
|
|
6548
6892
|
};
|
|
6549
6893
|
|
|
6550
6894
|
const useRunTask = (task, eagerness) => {
|
|
@@ -6604,4 +6948,7 @@ const PREFETCH_CODE = /*#__PURE__*/ (c => {
|
|
|
6604
6948
|
|
|
6605
6949
|
const PrefetchGraph = () => null;
|
|
6606
6950
|
|
|
6607
|
-
|
|
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 };
|