@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.cjs
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
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"object" == typeof exports && "undefined" != typeof module ? factory(exports, require("@qwik.dev/core/build"), require("@qwik.dev/core/preloader")) : "function" == typeof define && define.amd ? define([ "exports", "@qwik.dev/core/build", "@qwik.dev/core/preloader" ], factory) : factory((global = "undefined" != typeof globalThis ? globalThis : global || self).qwikCore = {}, global.qwikBuild, global.qwikPreloader);
|
|
10
10
|
}(this, function(exports, build, preloader) {
|
|
11
11
|
"use strict";
|
|
12
|
+
const version = "2.0.0-beta.9-dev+6b582c7";
|
|
12
13
|
const qDev = !1;
|
|
13
14
|
const seal = () => {
|
|
14
15
|
qDev;
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
const text = (code => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`)(code, ...errorMessageArgs);
|
|
39
40
|
return ((message, ...optionalParams) => createAndLogError(qDev, message, ...optionalParams))(text, ...errorMessageArgs);
|
|
40
41
|
};
|
|
42
|
+
const isSyncQrl = value => isQrl(value) && "<sync>" == value.$symbol$;
|
|
41
43
|
const isQrl = value => "function" == typeof value && "function" == typeof value.getSymbol;
|
|
42
44
|
function assertQrl(qrl) {
|
|
43
45
|
if (build.isDev && !isQrl(qrl)) {
|
|
@@ -80,11 +82,6 @@
|
|
|
80
82
|
resolve(fn());
|
|
81
83
|
});
|
|
82
84
|
}),
|
|
83
|
-
nextTick: fn => new Promise(resolve => {
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
resolve(fn());
|
|
86
|
-
});
|
|
87
|
-
}),
|
|
88
85
|
chunkForSymbol: (symbolName, chunk) => [ symbolName, chunk ?? "_" ]
|
|
89
86
|
});
|
|
90
87
|
const toUrl = (doc, containerEl, url) => {
|
|
@@ -156,6 +153,9 @@
|
|
|
156
153
|
constructor(container, value) {
|
|
157
154
|
this.$container$ = container, this.$untrackedValue$ = value;
|
|
158
155
|
}
|
|
156
|
+
force() {
|
|
157
|
+
this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
158
|
+
}
|
|
159
159
|
get untrackedValue() {
|
|
160
160
|
return this.$untrackedValue$;
|
|
161
161
|
}
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
return setupSignalValueAccess(this, () => this.$effects$ ||= new Set, () => this.untrackedValue);
|
|
167
167
|
}
|
|
168
168
|
set value(value) {
|
|
169
|
-
value !== this.$untrackedValue$ && (this.$untrackedValue$ = value,
|
|
169
|
+
value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, this.$container$?.$scheduler$(7, null, this, this.$effects$));
|
|
170
170
|
}
|
|
171
171
|
valueOf() {
|
|
172
172
|
qDev;
|
|
@@ -205,29 +205,26 @@
|
|
|
205
205
|
$funcStr$;
|
|
206
206
|
$flags$;
|
|
207
207
|
$hostElement$=null;
|
|
208
|
-
$forceRunEffects$=!1;
|
|
209
208
|
[_EFFECT_BACK_REF]=null;
|
|
210
|
-
constructor(container, fn, args, fnStr, flags =
|
|
209
|
+
constructor(container, fn, args, fnStr, flags = 5) {
|
|
211
210
|
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
|
|
212
211
|
this.$flags$ = flags;
|
|
213
212
|
}
|
|
214
213
|
invalidate() {
|
|
215
|
-
this.$flags$ |= 1, this.$
|
|
214
|
+
this.$flags$ |= 1, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
216
215
|
}
|
|
217
216
|
force() {
|
|
218
|
-
this.$
|
|
217
|
+
this.$flags$ |= 2, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
219
218
|
}
|
|
220
219
|
get untrackedValue() {
|
|
221
|
-
|
|
222
|
-
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
|
|
220
|
+
return this.$computeIfNeeded$(), assertFalse(), this.$untrackedValue$;
|
|
223
221
|
}
|
|
224
222
|
$computeIfNeeded$() {
|
|
225
223
|
if (!(1 & this.$flags$)) {
|
|
226
|
-
return
|
|
224
|
+
return;
|
|
227
225
|
}
|
|
228
226
|
const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
|
|
229
|
-
|
|
230
|
-
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
227
|
+
untrackedValue !== this.$untrackedValue$ && (this.$flags$ |= 2, this.$untrackedValue$ = untrackedValue);
|
|
231
228
|
}
|
|
232
229
|
set value(_) {
|
|
233
230
|
throw qError(31);
|
|
@@ -237,13 +234,15 @@
|
|
|
237
234
|
}
|
|
238
235
|
}
|
|
239
236
|
function getSubscriber(effect, prop, data) {
|
|
240
|
-
|
|
241
|
-
effect[_EFFECT_BACK_REF] || (build.isServer && ("__brand__" in (value = effect) && "SsrNode" === value.__brand__) ? effect.setProp("q:brefs", new Map) : effect[_EFFECT_BACK_REF] = new Map);
|
|
237
|
+
effect[_EFFECT_BACK_REF] || (build.isServer && isSsrNode(effect) ? effect.setProp("q:brefs", new Map) : effect[_EFFECT_BACK_REF] = new Map);
|
|
242
238
|
const subMap = effect[_EFFECT_BACK_REF];
|
|
243
239
|
let sub = subMap.get(prop);
|
|
244
240
|
return sub || (sub = [ effect, prop ], subMap.set(prop, sub)), data && (sub[3] = data),
|
|
245
241
|
sub;
|
|
246
242
|
}
|
|
243
|
+
function isSsrNode(value) {
|
|
244
|
+
return "__brand__" in value && "SsrNode" === value.__brand__;
|
|
245
|
+
}
|
|
247
246
|
let _context;
|
|
248
247
|
const tryGetInvokeContext = () => {
|
|
249
248
|
if (!_context) {
|
|
@@ -400,7 +399,6 @@
|
|
|
400
399
|
set(1));
|
|
401
400
|
};
|
|
402
401
|
const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
|
|
403
|
-
const version = "2.0.0-beta.7-dev+2dd89a6";
|
|
404
402
|
const EMPTY_ARRAY = [];
|
|
405
403
|
const EMPTY_OBJ = {};
|
|
406
404
|
Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
|
|
@@ -453,7 +451,7 @@
|
|
|
453
451
|
}
|
|
454
452
|
return qrl.$captureRef$;
|
|
455
453
|
};
|
|
456
|
-
const
|
|
454
|
+
const _run = (...args) => {
|
|
457
455
|
const [runQrl] = useLexicalScope();
|
|
458
456
|
const context = getInvokeContext();
|
|
459
457
|
const hostElement = context.$hostElement$;
|
|
@@ -464,7 +462,8 @@
|
|
|
464
462
|
if (!scheduler) {
|
|
465
463
|
throw qError(1);
|
|
466
464
|
}
|
|
467
|
-
|
|
465
|
+
const chore = scheduler(2, hostElement, runQrl, args);
|
|
466
|
+
return getChorePromise(chore);
|
|
468
467
|
};
|
|
469
468
|
const mapApp_findIndx = (array, key, start) => {
|
|
470
469
|
assertTrue();
|
|
@@ -480,14 +479,15 @@
|
|
|
480
479
|
}
|
|
481
480
|
return ~(bottom << 1);
|
|
482
481
|
};
|
|
483
|
-
const mapArray_set = (array, key, value, start) => {
|
|
482
|
+
const mapArray_set = (array, key, value, start, allowNullValue = !1) => {
|
|
484
483
|
const indx = mapApp_findIndx(array, key, start);
|
|
485
|
-
indx >= 0 ? null
|
|
484
|
+
indx >= 0 ? null != value || allowNullValue ? array[indx + 1] = value : array.splice(indx, 2) : (null != value || allowNullValue) && array.splice(-1 ^ indx, 0, key, value);
|
|
486
485
|
};
|
|
487
486
|
const mapArray_get = (array, key, start) => {
|
|
488
487
|
const indx = mapApp_findIndx(array, key, start);
|
|
489
488
|
return indx >= 0 ? array[indx + 1] : null;
|
|
490
489
|
};
|
|
490
|
+
const mapArray_has = (array, key, start) => mapApp_findIndx(array, key, start) >= 0;
|
|
491
491
|
const _CONST_PROPS = Symbol("CONST");
|
|
492
492
|
const _VAR_PROPS = Symbol("VAR");
|
|
493
493
|
const _IMMUTABLE = Symbol("IMMUTABLE");
|
|
@@ -498,24 +498,22 @@
|
|
|
498
498
|
class ComputedSignalImpl extends SignalImpl {
|
|
499
499
|
$computeQrl$;
|
|
500
500
|
$flags$;
|
|
501
|
-
$forceRunEffects$=!1;
|
|
502
501
|
[_EFFECT_BACK_REF]=null;
|
|
503
|
-
constructor(container, fn, flags =
|
|
502
|
+
constructor(container, fn, flags = 33) {
|
|
504
503
|
super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
|
|
505
504
|
}
|
|
506
505
|
invalidate() {
|
|
507
|
-
this.$flags$ |= 1, this.$
|
|
506
|
+
this.$flags$ |= 1, this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
508
507
|
}
|
|
509
508
|
force() {
|
|
510
|
-
this.$
|
|
509
|
+
this.$flags$ |= 2, super.force();
|
|
511
510
|
}
|
|
512
511
|
get untrackedValue() {
|
|
513
|
-
|
|
514
|
-
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
|
|
512
|
+
return this.$computeIfNeeded$(), assertFalse(), this.$untrackedValue$;
|
|
515
513
|
}
|
|
516
514
|
$computeIfNeeded$() {
|
|
517
515
|
if (!(1 & this.$flags$)) {
|
|
518
|
-
return
|
|
516
|
+
return;
|
|
519
517
|
}
|
|
520
518
|
const computeQrl = this.$computeQrl$;
|
|
521
519
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -528,8 +526,8 @@
|
|
|
528
526
|
throw qError(29, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
|
|
529
527
|
}
|
|
530
528
|
this.$flags$ &= -2;
|
|
531
|
-
|
|
532
|
-
|
|
529
|
+
untrackedValue !== this.$untrackedValue$ && (this.$untrackedValue$ !== NEEDS_COMPUTATION && (this.$flags$ |= 2),
|
|
530
|
+
this.$untrackedValue$ = untrackedValue);
|
|
533
531
|
} finally {
|
|
534
532
|
ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
|
|
535
533
|
}
|
|
@@ -543,12 +541,12 @@
|
|
|
543
541
|
}
|
|
544
542
|
class SerializerSignalImpl extends ComputedSignalImpl {
|
|
545
543
|
constructor(container, argQrl) {
|
|
546
|
-
super(container, argQrl,
|
|
544
|
+
super(container, argQrl, 33);
|
|
547
545
|
}
|
|
548
546
|
$didInitialize$=!1;
|
|
549
547
|
$computeIfNeeded$() {
|
|
550
548
|
if (!(1 & this.$flags$)) {
|
|
551
|
-
return
|
|
549
|
+
return;
|
|
552
550
|
}
|
|
553
551
|
throwIfQRLNotResolved(this.$computeQrl$);
|
|
554
552
|
let arg = this.$computeQrl$.resolved;
|
|
@@ -558,12 +556,16 @@
|
|
|
558
556
|
const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
|
|
559
557
|
const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) || currentValue : deserialize(currentValue), this, ".", this.$container$);
|
|
560
558
|
const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$flags$ |= 2,
|
|
560
|
+
this.$untrackedValue$ = untrackedValue);
|
|
563
561
|
}
|
|
564
562
|
}
|
|
565
563
|
const getStoreHandler = value => value[STORE_HANDLER];
|
|
566
564
|
const getStoreTarget = value => value?.[STORE_TARGET] || null;
|
|
565
|
+
const forceStoreEffects = (value, prop) => {
|
|
566
|
+
const handler = getStoreHandler(value);
|
|
567
|
+
handler && handler.force(prop);
|
|
568
|
+
};
|
|
567
569
|
const unwrapStore = value => getStoreTarget(value) || value;
|
|
568
570
|
const isStore = value => STORE_TARGET in value;
|
|
569
571
|
function createStore(container, obj, flags) {
|
|
@@ -587,6 +589,10 @@
|
|
|
587
589
|
toString() {
|
|
588
590
|
return "[Store]";
|
|
589
591
|
}
|
|
592
|
+
force(prop) {
|
|
593
|
+
const target = getStoreTarget(this);
|
|
594
|
+
this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$));
|
|
595
|
+
}
|
|
590
596
|
get(target, prop) {
|
|
591
597
|
if ("symbol" == typeof prop) {
|
|
592
598
|
return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
|
|
@@ -623,7 +629,7 @@
|
|
|
623
629
|
return !0;
|
|
624
630
|
}
|
|
625
631
|
deleteProperty(target, prop) {
|
|
626
|
-
return "string" == typeof prop && delete target[prop] && (
|
|
632
|
+
return "string" == typeof prop && delete target[prop] && (Array.isArray(target) || this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$)),
|
|
627
633
|
!0);
|
|
628
634
|
}
|
|
629
635
|
has(target, prop) {
|
|
@@ -660,7 +666,9 @@
|
|
|
660
666
|
ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
|
|
661
667
|
}
|
|
662
668
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
663
|
-
target[prop] = value
|
|
669
|
+
target[prop] = value;
|
|
670
|
+
const effects = getEffects(target, prop, currentStore.$effects$);
|
|
671
|
+
effects && currentStore.$container$?.$scheduler$(7, null, currentStore, effects);
|
|
664
672
|
}
|
|
665
673
|
function getEffects(target, prop, storeEffects) {
|
|
666
674
|
let effectsToTrigger;
|
|
@@ -753,7 +761,7 @@
|
|
|
753
761
|
}
|
|
754
762
|
$computeIfNeeded$() {
|
|
755
763
|
if (!(1 & this.$flags$)) {
|
|
756
|
-
return
|
|
764
|
+
return;
|
|
757
765
|
}
|
|
758
766
|
const computeQrl = this.$computeQrl$;
|
|
759
767
|
throwIfQRLNotResolved(computeQrl);
|
|
@@ -771,7 +779,8 @@
|
|
|
771
779
|
}
|
|
772
780
|
this.$promiseValue$ = NEEDS_COMPUTATION, this.$flags$ &= -2;
|
|
773
781
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
774
|
-
return didChange && (this.$untrackedValue$ = untrackedValue),
|
|
782
|
+
return didChange && (this.$flags$ |= 2, this.$untrackedValue$ = untrackedValue),
|
|
783
|
+
didChange;
|
|
775
784
|
}
|
|
776
785
|
}
|
|
777
786
|
const createComputedSignal = (qrl, options) => new ComputedSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "always"));
|
|
@@ -791,7 +800,7 @@
|
|
|
791
800
|
return obj[prop];
|
|
792
801
|
}
|
|
793
802
|
if (isSignal(obj)) {
|
|
794
|
-
return obj instanceof AsyncComputedSignalImpl || assertEqual(), obj instanceof WrappedSignalImpl &&
|
|
803
|
+
return obj instanceof AsyncComputedSignalImpl || assertEqual(), obj instanceof WrappedSignalImpl && 4 & obj.flags ? obj : getWrapped(args);
|
|
795
804
|
}
|
|
796
805
|
if (isPropsProxy(obj)) {
|
|
797
806
|
const constProps = obj[_CONST_PROPS];
|
|
@@ -1013,8 +1022,8 @@
|
|
|
1013
1022
|
}
|
|
1014
1023
|
targetElement = placeholderElement;
|
|
1015
1024
|
}
|
|
1016
|
-
targetElement && ("script" === targetElement.type && key === qVisibleEvent && (eventKey = "document:
|
|
1017
|
-
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:
|
|
1025
|
+
targetElement && ("script" === targetElement.type && key === qVisibleEvent && (eventKey = "document:onQInit$",
|
|
1026
|
+
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.')),
|
|
1018
1027
|
addUseOnEvent(targetElement, eventKey, useOnEvents[key]));
|
|
1019
1028
|
}
|
|
1020
1029
|
}
|
|
@@ -1166,9 +1175,18 @@
|
|
|
1166
1175
|
}(jsx, options.styleScoped);
|
|
1167
1176
|
let qwikInspectorAttrValue = null;
|
|
1168
1177
|
build.isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
|
|
1169
|
-
const innerHTML = ssr.openElement(type,
|
|
1170
|
-
return toSsrAttrs(
|
|
1171
|
-
}(jsx.
|
|
1178
|
+
const innerHTML = ssr.openElement(type, function(varProps, constProps, options) {
|
|
1179
|
+
return toSsrAttrs(varProps, constProps, !1, options);
|
|
1180
|
+
}(jsx.varProps, jsx.constProps, {
|
|
1181
|
+
serializationCtx: ssr.serializationCtx,
|
|
1182
|
+
styleScopedId: options.styleScoped,
|
|
1183
|
+
key: jsx.key
|
|
1184
|
+
}), function(constProps, varProps, options) {
|
|
1185
|
+
return toSsrAttrs(constProps, varProps, !0, options);
|
|
1186
|
+
}(jsx.constProps, jsx.varProps, {
|
|
1187
|
+
serializationCtx: ssr.serializationCtx,
|
|
1188
|
+
styleScopedId: options.styleScoped
|
|
1189
|
+
}), qwikInspectorAttrValue);
|
|
1172
1190
|
innerHTML && ssr.htmlNode(innerHTML), enqueue(ssr.closeElement), "head" === type ? (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1173
1191
|
ssr.emitPreloaderPre(), enqueue(ssr.additionalHeadNodes)) : "body" === type ? enqueue(ssr.additionalBodyNodes) : ssr.isHtml || ssr._didAddQwikLoader || (ssr.emitQwikLoaderAtTopIfNeeded(),
|
|
1174
1192
|
ssr.emitPreloaderPre(), ssr._didAddQwikLoader = !0);
|
|
@@ -1232,10 +1250,10 @@
|
|
|
1232
1250
|
const host = ssr.getOrCreateLastNode();
|
|
1233
1251
|
const [componentQrl] = component[SERIALIZABLE_STATE];
|
|
1234
1252
|
const srcProps = jsx.props;
|
|
1235
|
-
srcProps && srcProps.children && delete srcProps.children
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1253
|
+
srcProps && srcProps.children && delete srcProps.children, host.setProp("q:renderFn", componentQrl),
|
|
1254
|
+
host.setProp("q:props", srcProps), null !== jsx.key && host.setProp("q:key", jsx.key);
|
|
1255
|
+
const componentChore = ssr.$scheduler$(6, host, componentQrl, srcProps);
|
|
1256
|
+
return getChorePromise(componentChore);
|
|
1239
1257
|
})(ssr, jsx, type);
|
|
1240
1258
|
const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
|
|
1241
1259
|
enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame)),
|
|
@@ -1256,10 +1274,11 @@
|
|
|
1256
1274
|
}
|
|
1257
1275
|
}
|
|
1258
1276
|
}
|
|
1259
|
-
function toSsrAttrs(record, anotherRecord,
|
|
1277
|
+
function toSsrAttrs(record, anotherRecord, isConst, options) {
|
|
1260
1278
|
if (null == record) {
|
|
1261
1279
|
return null;
|
|
1262
1280
|
}
|
|
1281
|
+
const pushMergedEventProps = !isConst;
|
|
1263
1282
|
const ssrAttrs = [];
|
|
1264
1283
|
for (const key in record) {
|
|
1265
1284
|
let value = record[key];
|
|
@@ -1273,14 +1292,14 @@
|
|
|
1273
1292
|
value = getMergedEventPropValues(value, anotherValue);
|
|
1274
1293
|
}
|
|
1275
1294
|
}
|
|
1276
|
-
const eventValue = setEvent(serializationCtx, key, value);
|
|
1295
|
+
const eventValue = setEvent(options.serializationCtx, key, value);
|
|
1277
1296
|
eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
|
|
1278
1297
|
continue;
|
|
1279
1298
|
}
|
|
1280
|
-
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
|
|
1281
|
-
value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
|
|
1299
|
+
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, options.styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(options.serializationCtx, key),
|
|
1300
|
+
value = serializeAttribute(key, value, options.styleScopedId), ssrAttrs.push(key, value));
|
|
1282
1301
|
}
|
|
1283
|
-
return null != key && ssrAttrs.push("q:key", key), ssrAttrs;
|
|
1302
|
+
return null != options.key && ssrAttrs.push("q:key", options.key), ssrAttrs;
|
|
1284
1303
|
}
|
|
1285
1304
|
function getMergedEventPropValues(value, anotherValue) {
|
|
1286
1305
|
let mergedValue = value;
|
|
@@ -1302,7 +1321,7 @@
|
|
|
1302
1321
|
const appendToValue = valueToAppend => {
|
|
1303
1322
|
value = (null == value ? "" : value + "\n") + valueToAppend;
|
|
1304
1323
|
};
|
|
1305
|
-
const getQrlString = qrl => (qrl.$symbol$.startsWith("_") || !qrl.$captureRef$ && !qrl.$capture$ || (qrl = createQRL(null, "_run",
|
|
1324
|
+
const getQrlString = qrl => (qrl.$symbol$.startsWith("_") || !qrl.$captureRef$ && !qrl.$capture$ || (qrl = createQRL(null, "_run", _run, null, null, [ qrl ])),
|
|
1306
1325
|
qrlToString(serializationCtx, qrl));
|
|
1307
1326
|
if (Array.isArray(qrls)) {
|
|
1308
1327
|
for (let i = 0; i <= qrls.length; i++) {
|
|
@@ -1335,8 +1354,10 @@
|
|
|
1335
1354
|
assertQrl(qrl), set(1);
|
|
1336
1355
|
const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
1337
1356
|
set(task);
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1357
|
+
const result = runTask(task, iCtx.$container$, iCtx.$hostElement$);
|
|
1358
|
+
if (isPromise(result)) {
|
|
1359
|
+
throw result;
|
|
1360
|
+
}
|
|
1340
1361
|
};
|
|
1341
1362
|
const runTask = (task, container, host) => {
|
|
1342
1363
|
task.$flags$ &= -9, cleanupTask(task);
|
|
@@ -1384,7 +1405,7 @@
|
|
|
1384
1405
|
const isTask = value => value instanceof Task;
|
|
1385
1406
|
const scheduleTask = (_event, element) => {
|
|
1386
1407
|
const [task] = useLexicalScope();
|
|
1387
|
-
const type = 1 & task.$flags$ ?
|
|
1408
|
+
const type = 1 & task.$flags$ ? 16 : 3;
|
|
1388
1409
|
getDomContainer(element).$scheduler$(type, task);
|
|
1389
1410
|
};
|
|
1390
1411
|
const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
|
|
@@ -1465,7 +1486,7 @@
|
|
|
1465
1486
|
return this.$children$;
|
|
1466
1487
|
}
|
|
1467
1488
|
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
1468
|
-
return value instanceof WrappedSignalImpl &&
|
|
1489
|
+
return value instanceof WrappedSignalImpl && 4 & value.$flags$ ? value.value : value;
|
|
1469
1490
|
}
|
|
1470
1491
|
set(_, prop, value) {
|
|
1471
1492
|
return prop === _CONST_PROPS ? (this.$constProps$ = value, !0) : prop === _VAR_PROPS ? (this.$varProps$ = value,
|
|
@@ -1670,36 +1691,38 @@
|
|
|
1670
1691
|
}
|
|
1671
1692
|
}();
|
|
1672
1693
|
function diff(jsxNode, vStartNode) {
|
|
1673
|
-
|
|
1694
|
+
if (assertFalse(vnode_isVNode(jsxNode)), assertTrue(vnode_isVNode(vStartNode)),
|
|
1674
1695
|
vParent = vStartNode, vNewNode = null, vCurrent = vnode_getFirstChild(vStartNode),
|
|
1675
|
-
stackPush(jsxNode, !0)
|
|
1676
|
-
for (;
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
if (
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
+
stackPush(jsxNode, !0), !(32 & vParent[0])) {
|
|
1697
|
+
for (;stack.length; ) {
|
|
1698
|
+
for (;jsxIdx < jsxCount; ) {
|
|
1699
|
+
if (assertFalse(), "string" == typeof jsxValue) {
|
|
1700
|
+
expectText(jsxValue);
|
|
1701
|
+
} else if ("number" == typeof jsxValue) {
|
|
1702
|
+
expectText(String(jsxValue));
|
|
1703
|
+
} else if (jsxValue && "object" == typeof jsxValue) {
|
|
1704
|
+
if (Array.isArray(jsxValue)) {
|
|
1705
|
+
descend(jsxValue, !1);
|
|
1706
|
+
} else if (isSignal(jsxValue)) {
|
|
1707
|
+
vCurrent && clearAllEffects(container, vCurrent), expectVirtual("S", null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), !0);
|
|
1708
|
+
} else if (isPromise(jsxValue)) {
|
|
1709
|
+
expectVirtual("A", null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
1710
|
+
} else if (isJSXNode(jsxValue)) {
|
|
1711
|
+
const type = jsxValue.type;
|
|
1712
|
+
"string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type),
|
|
1713
|
+
descend(jsxValue.children, !0)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(),
|
|
1714
|
+
expectVirtual("F", jsxValue.key), descend(jsxValue.children, !0)) : type === Slot ? (expectNoMoreTextNodes(),
|
|
1715
|
+
expectSlot() || descend(jsxValue.children, !0)) : type === Projection ? (expectProjection(),
|
|
1716
|
+
descend(jsxValue.children, !0)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(),
|
|
1717
|
+
expectComponent(type)));
|
|
1718
|
+
}
|
|
1719
|
+
} else {
|
|
1720
|
+
jsxValue === SkipRender ? journal = [] : expectText("");
|
|
1696
1721
|
}
|
|
1697
|
-
|
|
1698
|
-
jsxValue === SkipRender ? journal = [] : expectText("");
|
|
1722
|
+
advance();
|
|
1699
1723
|
}
|
|
1700
|
-
|
|
1724
|
+
expectNoMore(), ascend();
|
|
1701
1725
|
}
|
|
1702
|
-
expectNoMore(), ascend();
|
|
1703
1726
|
}
|
|
1704
1727
|
}
|
|
1705
1728
|
function advance() {
|
|
@@ -1862,7 +1885,7 @@
|
|
|
1862
1885
|
element.value = escapeHTML(value || "");
|
|
1863
1886
|
}
|
|
1864
1887
|
} else {
|
|
1865
|
-
element.innerHTML = value, element.setAttribute("q:container", "html");
|
|
1888
|
+
value && (element.innerHTML = String(value), element.setAttribute("q:container", "html"));
|
|
1866
1889
|
}
|
|
1867
1890
|
}
|
|
1868
1891
|
}
|
|
@@ -1961,8 +1984,12 @@
|
|
|
1961
1984
|
let returnValue = !1;
|
|
1962
1985
|
return qrls.flat(2).forEach(qrl => {
|
|
1963
1986
|
if (qrl) {
|
|
1964
|
-
|
|
1965
|
-
|
|
1987
|
+
if (isSyncQrl(qrl)) {
|
|
1988
|
+
qrl(event, element);
|
|
1989
|
+
} else {
|
|
1990
|
+
const value = container.$scheduler$(2, vNode, qrl, [ event, element ]);
|
|
1991
|
+
returnValue = returnValue || !0 === value;
|
|
1992
|
+
}
|
|
1966
1993
|
}
|
|
1967
1994
|
}), returnValue;
|
|
1968
1995
|
}));
|
|
@@ -2149,7 +2176,7 @@
|
|
|
2149
2176
|
const obj = seq[i];
|
|
2150
2177
|
if (isTask(obj)) {
|
|
2151
2178
|
const task = obj;
|
|
2152
|
-
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(
|
|
2179
|
+
clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(32, task) : cleanupTask(task);
|
|
2153
2180
|
}
|
|
2154
2181
|
}
|
|
2155
2182
|
}
|
|
@@ -2175,7 +2202,9 @@
|
|
|
2175
2202
|
if (vCursor === vNode) {
|
|
2176
2203
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
2177
2204
|
if (vFirstChild) {
|
|
2178
|
-
return void vnode_walkVNode(vFirstChild
|
|
2205
|
+
return void vnode_walkVNode(vFirstChild, vNode => {
|
|
2206
|
+
2 & vNode[0] && vnode_getProp(vNode, "q:sparent", id => vnode_locate(container.rootVNode, id));
|
|
2207
|
+
});
|
|
2179
2208
|
}
|
|
2180
2209
|
}
|
|
2181
2210
|
} else {
|
|
@@ -2231,8 +2260,9 @@
|
|
|
2231
2260
|
assertQrl(qrl);
|
|
2232
2261
|
const container = iCtx.$container$;
|
|
2233
2262
|
const resource = createResourceReturn(container, opts);
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2263
|
+
const el = iCtx.$hostElement$;
|
|
2264
|
+
const task = new Task(12, i, el, qrl, resource, null);
|
|
2265
|
+
return set(resource), runResource(task, container, el), resource;
|
|
2236
2266
|
};
|
|
2237
2267
|
const createResourceReturn = (container, opts, initialPromise) => {
|
|
2238
2268
|
const result = (opts => ({
|
|
@@ -2271,21 +2301,21 @@
|
|
|
2271
2301
|
let reject;
|
|
2272
2302
|
let done = !1;
|
|
2273
2303
|
const setState = (resolved, value) => !done && (done = !0, resolved ? (done = !0,
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2304
|
+
resourceTarget.loading = !1, resourceTarget._state = "resolved", resourceTarget._resolved = value,
|
|
2305
|
+
resourceTarget._error = void 0, resolve(value)) : (done = !0, resourceTarget.loading = !1,
|
|
2306
|
+
resourceTarget._state = "rejected", resourceTarget._error = value, reject(value)),
|
|
2307
|
+
isServerPlatform() || forceStoreEffects(resource, "_state"), !0);
|
|
2277
2308
|
cleanups.push(() => {
|
|
2278
2309
|
if (!0 === untrack(() => resource.loading)) {
|
|
2279
2310
|
const value = untrack(() => resource._resolved);
|
|
2280
2311
|
setState(!0, value);
|
|
2281
2312
|
}
|
|
2282
2313
|
}), invoke(iCtx, () => {
|
|
2283
|
-
resource._state = "pending", resource.loading = !isServerPlatform()
|
|
2284
|
-
(resource.value = new Promise((r, re) => {
|
|
2314
|
+
resource._state = "pending", resource.loading = !isServerPlatform(), resource.value = new Promise((r, re) => {
|
|
2285
2315
|
resolve = r, reject = re;
|
|
2286
|
-
})
|
|
2316
|
+
});
|
|
2287
2317
|
});
|
|
2288
|
-
const promise = safeCall(() =>
|
|
2318
|
+
const promise = safeCall(() => taskFn(opts), value => {
|
|
2289
2319
|
setState(!0, value);
|
|
2290
2320
|
}, err => {
|
|
2291
2321
|
if (isPromise(err)) {
|
|
@@ -2298,28 +2328,187 @@
|
|
|
2298
2328
|
setState(!1, new Error("timeout")) && cleanupTask(task);
|
|
2299
2329
|
}) ]) : promise;
|
|
2300
2330
|
};
|
|
2301
|
-
const ignoreErrorToPreventNodeFromCrashing = () => {};
|
|
2302
2331
|
const aVNodePath = [];
|
|
2303
2332
|
const bVNodePath = [];
|
|
2304
2333
|
const aSsrNodePath = [];
|
|
2305
2334
|
const bSsrNodePath = [];
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2335
|
+
const VISIBLE_BLOCKING_RULES = [ {
|
|
2336
|
+
blockedType: 16,
|
|
2337
|
+
blockingType: 4,
|
|
2338
|
+
match: (blocked, blocking, container) => isDescendant(blocked, blocking, container) || isDescendant(blocking, blocked, container)
|
|
2339
|
+
}, {
|
|
2340
|
+
blockedType: 16,
|
|
2341
|
+
blockingType: 6,
|
|
2342
|
+
match: (blocked, blocking, container) => isDescendant(blocked, blocking, container) || isDescendant(blocking, blocked, container)
|
|
2343
|
+
} ];
|
|
2344
|
+
const BLOCKING_RULES = [ {
|
|
2345
|
+
blockedType: 2,
|
|
2346
|
+
blockingType: 1,
|
|
2347
|
+
match: (blocked, blocking) => {
|
|
2348
|
+
const blockedQrl = blocked.$target$;
|
|
2349
|
+
const blockingQrl = blocking.$target$;
|
|
2350
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedQrl, blockingQrl);
|
|
2351
|
+
}
|
|
2352
|
+
}, {
|
|
2353
|
+
blockedType: 3,
|
|
2354
|
+
blockingType: 1,
|
|
2355
|
+
match: (blocked, blocking) => {
|
|
2356
|
+
const blockedTask = blocked.$payload$;
|
|
2357
|
+
const blockingQrl = blocking.$target$;
|
|
2358
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedTask.$qrl$, blockingQrl);
|
|
2359
|
+
}
|
|
2360
|
+
}, {
|
|
2361
|
+
blockedType: 16,
|
|
2362
|
+
blockingType: 1,
|
|
2363
|
+
match: (blocked, blocking) => {
|
|
2364
|
+
const blockedTask = blocked.$payload$;
|
|
2365
|
+
const blockingQrl = blocking.$target$;
|
|
2366
|
+
return isSameHost(blocked, blocking) && isSameQrl(blockedTask.$qrl$, blockingQrl);
|
|
2367
|
+
}
|
|
2368
|
+
}, {
|
|
2369
|
+
blockedType: 4,
|
|
2370
|
+
blockingType: 6,
|
|
2371
|
+
match: (blocked, blocking) => blocked.$host$ === blocking.$host$
|
|
2372
|
+
}, {
|
|
2373
|
+
blockedType: 5,
|
|
2374
|
+
blockingType: 6,
|
|
2375
|
+
match: (blocked, blocking) => blocked.$host$ === blocking.$host$
|
|
2376
|
+
}, ...VISIBLE_BLOCKING_RULES, {
|
|
2377
|
+
blockedType: 3,
|
|
2378
|
+
blockingType: 3,
|
|
2379
|
+
match: (blocked, blocking, container) => {
|
|
2380
|
+
if (blocked.$host$ !== blocking.$host$) {
|
|
2381
|
+
return !1;
|
|
2382
|
+
}
|
|
2383
|
+
const blockedIdx = blocked.$idx$;
|
|
2384
|
+
if ("number" != typeof blockedIdx || blockedIdx <= 0) {
|
|
2385
|
+
return !1;
|
|
2386
|
+
}
|
|
2387
|
+
const previousTask = function(host, currentTaskIdx, container) {
|
|
2388
|
+
const elementSeq = container.getHostProp(host, "q:seq");
|
|
2389
|
+
if (!elementSeq || elementSeq.length <= currentTaskIdx) {
|
|
2390
|
+
return null;
|
|
2391
|
+
}
|
|
2392
|
+
for (let i = currentTaskIdx - 1; i >= 0; i--) {
|
|
2393
|
+
const candidate = elementSeq[i];
|
|
2394
|
+
if (candidate instanceof Task && 2 & candidate.$flags$) {
|
|
2395
|
+
return candidate;
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
return null;
|
|
2399
|
+
}(blocked.$host$, blockedIdx, container);
|
|
2400
|
+
return previousTask === blocking.$payload$;
|
|
2401
|
+
}
|
|
2402
|
+
} ];
|
|
2403
|
+
function isDescendant(descendantChore, ancestorChore, container) {
|
|
2404
|
+
const descendantHost = descendantChore.$host$;
|
|
2405
|
+
const ancestorHost = ancestorChore.$host$;
|
|
2406
|
+
return !(!vnode_isVNode(descendantHost) || !vnode_isVNode(ancestorHost)) && vnode_isDescendantOf(descendantHost, ancestorHost, container.rootVNode);
|
|
2407
|
+
}
|
|
2408
|
+
function isSameHost(a, b) {
|
|
2409
|
+
return a.$host$ === b.$host$;
|
|
2410
|
+
}
|
|
2411
|
+
function isSameQrl(a, b) {
|
|
2412
|
+
return a.$symbol$ === b.$symbol$;
|
|
2413
|
+
}
|
|
2414
|
+
function findBlockingChoreInQueue(chore, choreQueue, container) {
|
|
2415
|
+
for (const candidate of choreQueue) {
|
|
2416
|
+
if (!(candidate.$type$ >= 16 || 3 === candidate.$type$) && isDescendant(chore, candidate, container)) {
|
|
2417
|
+
return candidate;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
return null;
|
|
2421
|
+
}
|
|
2422
|
+
function findBlockingChore(chore, choreQueue, blockedChores, runningChores, container) {
|
|
2423
|
+
const blockingChoreInChoreQueue = findBlockingChoreInQueue(chore, choreQueue, container);
|
|
2424
|
+
if (blockingChoreInChoreQueue) {
|
|
2425
|
+
return blockingChoreInChoreQueue;
|
|
2426
|
+
}
|
|
2427
|
+
const blockingChoreInBlockedChores = findBlockingChoreInQueue(chore, Array.from(blockedChores), container);
|
|
2428
|
+
if (blockingChoreInBlockedChores) {
|
|
2429
|
+
return blockingChoreInBlockedChores;
|
|
2430
|
+
}
|
|
2431
|
+
const blockingChoreInRunningChores = findBlockingChoreInQueue(chore, Array.from(runningChores), container);
|
|
2432
|
+
if (blockingChoreInRunningChores) {
|
|
2433
|
+
return blockingChoreInRunningChores;
|
|
2434
|
+
}
|
|
2435
|
+
for (const rule of BLOCKING_RULES) {
|
|
2436
|
+
if (chore.$type$ === rule.blockedType) {
|
|
2437
|
+
for (const candidate of choreQueue) {
|
|
2438
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
2439
|
+
return candidate;
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
for (const candidate of blockedChores) {
|
|
2443
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
2444
|
+
return candidate;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
for (const candidate of runningChores) {
|
|
2448
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
2449
|
+
return candidate;
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
return null;
|
|
2455
|
+
}
|
|
2456
|
+
function findBlockingChoreForVisible(chore, runningChores, container) {
|
|
2457
|
+
for (const rule of VISIBLE_BLOCKING_RULES) {
|
|
2458
|
+
if (chore.$type$ === rule.blockedType) {
|
|
2459
|
+
for (const candidate of runningChores) {
|
|
2460
|
+
if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
|
|
2461
|
+
return candidate;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
return null;
|
|
2467
|
+
}
|
|
2468
|
+
var ChoreState;
|
|
2469
|
+
!function(ChoreState) {
|
|
2470
|
+
ChoreState[ChoreState.NONE = 0] = "NONE", ChoreState[ChoreState.RUNNING = 1] = "RUNNING",
|
|
2471
|
+
ChoreState[ChoreState.FAILED = 2] = "FAILED", ChoreState[ChoreState.DONE = 3] = "DONE";
|
|
2472
|
+
}(ChoreState || (ChoreState = {}));
|
|
2473
|
+
const getChorePromise = chore => chore.$state$ === ChoreState.NONE ? chore.$returnValue$ ||= new Promise((resolve, reject) => {
|
|
2474
|
+
chore.$resolve$ = resolve, chore.$reject$ = reject;
|
|
2475
|
+
}) : chore.$returnValue$;
|
|
2476
|
+
const createScheduler = (container, journalFlush, choreQueue = [], blockedChores = new Set, runningChores = new Set) => {
|
|
2477
|
+
let drainChore = null;
|
|
2313
2478
|
let drainScheduled = !1;
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
if (
|
|
2321
|
-
|
|
2479
|
+
let isDraining = !1;
|
|
2480
|
+
let isJournalFlushRunning = !1;
|
|
2481
|
+
let flushBudgetStart = 0;
|
|
2482
|
+
let currentTime = performance.now();
|
|
2483
|
+
const nextTick = (fn => {
|
|
2484
|
+
let nextTick;
|
|
2485
|
+
if ("function" == typeof setImmediate) {
|
|
2486
|
+
nextTick = () => {
|
|
2487
|
+
setImmediate(fn);
|
|
2488
|
+
};
|
|
2489
|
+
} else if ("undefined" != typeof MessageChannel) {
|
|
2490
|
+
const channel = new MessageChannel;
|
|
2491
|
+
channel.port1.onmessage = () => {
|
|
2492
|
+
fn();
|
|
2493
|
+
}, nextTick = () => {
|
|
2494
|
+
channel.port2.postMessage(null);
|
|
2495
|
+
};
|
|
2496
|
+
} else {
|
|
2497
|
+
nextTick = () => {
|
|
2498
|
+
setTimeout(fn);
|
|
2499
|
+
};
|
|
2322
2500
|
}
|
|
2501
|
+
return nextTick;
|
|
2502
|
+
})(drainChoreQueue);
|
|
2503
|
+
function drainInNextTick() {
|
|
2504
|
+
drainScheduled || (drainScheduled = !0, nextTick());
|
|
2505
|
+
}
|
|
2506
|
+
const FREQUENCY_MS = Math.floor(1e3 / 60);
|
|
2507
|
+
return function(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
2508
|
+
if (255 === type && drainChore) {
|
|
2509
|
+
return drainChore;
|
|
2510
|
+
}
|
|
2511
|
+
const isTask = 3 === type || 16 === type || 32 === type;
|
|
2323
2512
|
isTask && (hostOrTask.$flags$ |= 8);
|
|
2324
2513
|
let chore = {
|
|
2325
2514
|
$type$: type,
|
|
@@ -2327,184 +2516,217 @@
|
|
|
2327
2516
|
$host$: isTask ? hostOrTask.$el$ : hostOrTask,
|
|
2328
2517
|
$target$: targetOrQrl,
|
|
2329
2518
|
$payload$: isTask ? hostOrTask : payload,
|
|
2330
|
-
$
|
|
2331
|
-
$
|
|
2332
|
-
$
|
|
2333
|
-
$
|
|
2519
|
+
$state$: ChoreState.NONE,
|
|
2520
|
+
$blockedChores$: null,
|
|
2521
|
+
$startTime$: void 0,
|
|
2522
|
+
$endTime$: void 0,
|
|
2523
|
+
$resolve$: void 0,
|
|
2524
|
+
$reject$: void 0,
|
|
2525
|
+
$returnValue$: null
|
|
2334
2526
|
};
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
}
|
|
2348
|
-
bottom = middle + 1;
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
return ~bottom;
|
|
2352
|
-
}(sortedArray, value, rootVNode);
|
|
2353
|
-
if (idx < 0) {
|
|
2354
|
-
return sortedArray.splice(~idx, 0, value), value;
|
|
2527
|
+
if (255 === type) {
|
|
2528
|
+
return getChorePromise(chore), drainChore = chore, drainInNextTick(), chore;
|
|
2529
|
+
}
|
|
2530
|
+
const isServer = isServerPlatform();
|
|
2531
|
+
const isClientOnly = 4 === type || 1 === type;
|
|
2532
|
+
if (isServer && isClientOnly) {
|
|
2533
|
+
return finishChore(chore, void 0), chore;
|
|
2534
|
+
}
|
|
2535
|
+
if (isServer && chore.$host$ && isSsrNode(chore.$host$)) {
|
|
2536
|
+
if (!!!(1 & chore.$host$.flags) && 5 !== chore.$type$ && 7 !== chore.$type$) {
|
|
2537
|
+
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.`;
|
|
2538
|
+
return logWarn(warningMessage), chore;
|
|
2355
2539
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
return
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2540
|
+
}
|
|
2541
|
+
const blockingChore = findBlockingChore(chore, choreQueue, blockedChores, runningChores, container);
|
|
2542
|
+
if (blockingChore) {
|
|
2543
|
+
return addBlockedChore(chore, blockingChore, blockedChores), chore;
|
|
2544
|
+
}
|
|
2545
|
+
chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
|
|
2546
|
+
(isServer && 6 === type || 2 === type) && !isDraining ? (drainScheduled = !0, drainChoreQueue()) : drainInNextTick();
|
|
2547
|
+
return chore;
|
|
2363
2548
|
};
|
|
2364
|
-
function
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2549
|
+
function applyJournalFlush() {
|
|
2550
|
+
isJournalFlushRunning || (isJournalFlushRunning = !0, journalFlush(), isJournalFlushRunning = !1,
|
|
2551
|
+
flushBudgetStart = performance.now());
|
|
2552
|
+
}
|
|
2553
|
+
function shouldApplyJournalFlush(isServer) {
|
|
2554
|
+
return !isServer && currentTime - flushBudgetStart >= FREQUENCY_MS;
|
|
2555
|
+
}
|
|
2556
|
+
function drainChoreQueue() {
|
|
2557
|
+
const isServer = isServerPlatform();
|
|
2558
|
+
if (drainScheduled = !1, isDraining) {
|
|
2559
|
+
return;
|
|
2560
|
+
}
|
|
2561
|
+
if (!choreQueue.length) {
|
|
2562
|
+
return applyJournalFlush(), void (drainChore && !runningChores.size && (drainChore.$resolve$(null),
|
|
2563
|
+
drainChore = null));
|
|
2564
|
+
}
|
|
2565
|
+
isDraining = !0, flushBudgetStart = performance.now();
|
|
2566
|
+
const maybeFinishDrain = () => choreQueue.length ? (drainInNextTick(), !1) : drainChore && runningChores.size ? (shouldApplyJournalFlush(isServer) && applyJournalFlush(),
|
|
2567
|
+
!1) : (currentChore = null, applyJournalFlush(), drainChore?.$resolve$(null), drainChore = null,
|
|
2568
|
+
!0);
|
|
2569
|
+
const scheduleBlockedChoresAndDrainIfNeeded = chore => {
|
|
2570
|
+
let blockedChoresScheduled = !1;
|
|
2571
|
+
if (chore.$blockedChores$) {
|
|
2572
|
+
for (const blockedChore of chore.$blockedChores$) {
|
|
2573
|
+
const blockingChore = findBlockingChore(blockedChore, choreQueue, blockedChores, runningChores, container);
|
|
2574
|
+
blockingChore ? addBlockedChore(blockedChore, blockingChore, blockedChores) : (blockedChores.delete(blockedChore),
|
|
2575
|
+
sortedInsert(choreQueue, blockedChore, container.rootVNode || null), blockedChoresScheduled = !0);
|
|
2576
|
+
}
|
|
2577
|
+
chore.$blockedChores$ = null;
|
|
2374
2578
|
}
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2579
|
+
blockedChoresScheduled && !isDraining && drainInNextTick();
|
|
2580
|
+
};
|
|
2581
|
+
let currentChore = null;
|
|
2582
|
+
try {
|
|
2583
|
+
for (;choreQueue.length; ) {
|
|
2584
|
+
currentTime = performance.now();
|
|
2585
|
+
const chore = currentChore = choreQueue.shift();
|
|
2586
|
+
if (chore.$state$ !== ChoreState.NONE) {
|
|
2587
|
+
continue;
|
|
2588
|
+
}
|
|
2589
|
+
if (vNodeAlreadyDeleted(chore) && 32 !== chore.$type$) {
|
|
2590
|
+
continue;
|
|
2591
|
+
}
|
|
2592
|
+
if (16 === chore.$type$) {
|
|
2593
|
+
applyJournalFlush();
|
|
2594
|
+
const blockingChore = findBlockingChoreForVisible(chore, runningChores, container);
|
|
2595
|
+
if (blockingChore && blockingChore.$state$ === ChoreState.RUNNING) {
|
|
2596
|
+
addBlockedChore(chore, blockingChore, blockedChores);
|
|
2597
|
+
continue;
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
chore.$startTime$ = performance.now();
|
|
2601
|
+
const result = executeChore(chore, isServer);
|
|
2602
|
+
if (chore.$returnValue$ = result, isPromise(result) ? (runningChores.add(chore),
|
|
2603
|
+
chore.$state$ = ChoreState.RUNNING, result.then(value => {
|
|
2604
|
+
finishChore(chore, value);
|
|
2605
|
+
}).catch(e => {
|
|
2606
|
+
chore.$state$ === ChoreState.RUNNING && handleError(chore, e);
|
|
2607
|
+
}).finally(() => {
|
|
2608
|
+
if (runningChores.delete(chore), scheduleBlockedChoresAndDrainIfNeeded(chore), !runningChores.size) {
|
|
2609
|
+
let finished = !1;
|
|
2610
|
+
drainChore && (finished = maybeFinishDrain()), finished || isDraining || applyJournalFlush();
|
|
2611
|
+
}
|
|
2612
|
+
})) : (finishChore(chore, result), scheduleBlockedChoresAndDrainIfNeeded(chore)),
|
|
2613
|
+
shouldApplyJournalFlush(isServer)) {
|
|
2614
|
+
return applyJournalFlush(), void drainInNextTick();
|
|
2379
2615
|
}
|
|
2380
|
-
} else {
|
|
2381
|
-
vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer);
|
|
2382
2616
|
}
|
|
2617
|
+
} catch (e) {
|
|
2618
|
+
handleError(currentChore, e), scheduleBlockedChoresAndDrainIfNeeded(currentChore);
|
|
2619
|
+
} finally {
|
|
2620
|
+
isDraining = !1, maybeFinishDrain();
|
|
2383
2621
|
}
|
|
2384
|
-
|
|
2622
|
+
}
|
|
2623
|
+
function finishChore(chore, value) {
|
|
2624
|
+
chore.$endTime$ = performance.now(), chore.$state$ = ChoreState.DONE, chore.$returnValue$ = value,
|
|
2625
|
+
chore.$resolve$?.(value);
|
|
2626
|
+
}
|
|
2627
|
+
function handleError(chore, e) {
|
|
2628
|
+
chore.$endTime$ = performance.now(), chore.$state$ = ChoreState.FAILED, chore.$reject$?.(e),
|
|
2629
|
+
container.handleError(e, chore.$host$);
|
|
2385
2630
|
}
|
|
2386
2631
|
function executeChore(chore, isServer) {
|
|
2387
2632
|
const host = chore.$host$;
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
break;
|
|
2395
|
-
|
|
2396
|
-
case 16:
|
|
2397
|
-
returnValue = journalFlush(), drainScheduled = !1;
|
|
2398
|
-
break;
|
|
2399
|
-
|
|
2400
|
-
case 6:
|
|
2401
|
-
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
2402
|
-
if (isServer) {
|
|
2403
|
-
return jsx;
|
|
2404
|
-
}
|
|
2405
|
-
{
|
|
2406
|
-
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
2407
|
-
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
2408
|
-
}
|
|
2409
|
-
}, err => container.handleError(err, host));
|
|
2410
|
-
break;
|
|
2411
|
-
|
|
2412
|
-
case 2:
|
|
2413
|
-
{
|
|
2414
|
-
const fn = chore.$target$.getFn();
|
|
2415
|
-
const result = retryOnPromise(() => fn(...chore.$payload$));
|
|
2416
|
-
if (isPromise(result)) {
|
|
2417
|
-
const handled = result.finally(() => {
|
|
2418
|
-
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
2419
|
-
}).catch(error => {
|
|
2420
|
-
container.handleError(error, chore.$host$);
|
|
2421
|
-
});
|
|
2422
|
-
return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
|
|
2423
|
-
currentChore = null, void (chore.$executed$ = !0);
|
|
2424
|
-
}
|
|
2425
|
-
returnValue = null;
|
|
2633
|
+
let returnValue;
|
|
2634
|
+
switch (chore.$type$) {
|
|
2635
|
+
case 6:
|
|
2636
|
+
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
2637
|
+
if (isServer) {
|
|
2638
|
+
return jsx;
|
|
2426
2639
|
}
|
|
2427
|
-
break;
|
|
2428
|
-
|
|
2429
|
-
case 3:
|
|
2430
|
-
case 32:
|
|
2431
2640
|
{
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2434
|
-
const result = runResource(payload, container, host);
|
|
2435
|
-
returnValue = isServer ? result : null;
|
|
2436
|
-
} else {
|
|
2437
|
-
returnValue = runTask(payload, container, host);
|
|
2438
|
-
}
|
|
2641
|
+
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
2642
|
+
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
2439
2643
|
}
|
|
2440
|
-
|
|
2644
|
+
}, err => {
|
|
2645
|
+
handleError(chore, err);
|
|
2646
|
+
});
|
|
2647
|
+
break;
|
|
2441
2648
|
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2649
|
+
case 2:
|
|
2650
|
+
{
|
|
2651
|
+
const fn = chore.$target$.getFn();
|
|
2652
|
+
returnValue = retryOnPromise(() => fn(...chore.$payload$));
|
|
2653
|
+
}
|
|
2654
|
+
break;
|
|
2445
2655
|
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2656
|
+
case 3:
|
|
2657
|
+
case 16:
|
|
2658
|
+
{
|
|
2659
|
+
const payload = chore.$payload$;
|
|
2660
|
+
returnValue = 4 & payload.$flags$ ? runResource(payload, container, host) : runTask(payload, container, host);
|
|
2661
|
+
}
|
|
2662
|
+
break;
|
|
2453
2663
|
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2664
|
+
case 32:
|
|
2665
|
+
cleanupTask(chore.$payload$);
|
|
2666
|
+
break;
|
|
2667
|
+
|
|
2668
|
+
case 4:
|
|
2669
|
+
{
|
|
2670
|
+
const parentVirtualNode = chore.$target$;
|
|
2671
|
+
let jsx = chore.$payload$;
|
|
2672
|
+
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx, parentVirtualNode, null));
|
|
2673
|
+
}
|
|
2674
|
+
break;
|
|
2675
|
+
|
|
2676
|
+
case 5:
|
|
2677
|
+
{
|
|
2678
|
+
const virtualNode = chore.$host$;
|
|
2679
|
+
const payload = chore.$payload$;
|
|
2680
|
+
let value = payload.$value$;
|
|
2681
|
+
isSignal(value) && (value = value.value);
|
|
2682
|
+
const isConst = payload.$isConst$;
|
|
2683
|
+
const journal = container.$journal$;
|
|
2684
|
+
const property = chore.$idx$;
|
|
2685
|
+
const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
|
|
2686
|
+
if (isServer) {
|
|
2687
|
+
container.addBackpatchEntry(chore.$host$.id, property, serializedValue), returnValue = null;
|
|
2688
|
+
} else {
|
|
2464
2689
|
if (isConst) {
|
|
2465
2690
|
journal.push(2, virtualNode[6], property, serializedValue);
|
|
2466
2691
|
} else {
|
|
2467
2692
|
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
2468
2693
|
}
|
|
2694
|
+
returnValue = void 0;
|
|
2469
2695
|
}
|
|
2470
|
-
|
|
2696
|
+
}
|
|
2697
|
+
break;
|
|
2471
2698
|
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2699
|
+
case 1:
|
|
2700
|
+
{
|
|
2701
|
+
const target = chore.$target$;
|
|
2702
|
+
returnValue = target.resolved ? null : target.resolve();
|
|
2703
|
+
}
|
|
2704
|
+
break;
|
|
2478
2705
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2706
|
+
case 7:
|
|
2707
|
+
{
|
|
2708
|
+
const target = chore.$target$;
|
|
2709
|
+
const effects = chore.$payload$;
|
|
2710
|
+
if (!effects?.size) {
|
|
2711
|
+
break;
|
|
2712
|
+
}
|
|
2713
|
+
let shouldCompute = target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl;
|
|
2714
|
+
if (target instanceof AsyncComputedSignalImpl && effects !== target.$effects$ && (shouldCompute = !1),
|
|
2715
|
+
shouldCompute) {
|
|
2483
2716
|
const ctx = newInvokeContext();
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
break;
|
|
2717
|
+
ctx.$container$ = container, returnValue = maybeThen(retryOnPromise(() => invoke.call(target, ctx, target.$computeIfNeeded$)), () => {
|
|
2718
|
+
if (2 & target.$flags$) {
|
|
2719
|
+
return target.$flags$ &= -3, retryOnPromise(() => triggerEffects(container, target, effects));
|
|
2488
2720
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
} else {
|
|
2495
|
-
returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
|
|
2496
|
-
}
|
|
2721
|
+
});
|
|
2722
|
+
} else {
|
|
2723
|
+
returnValue = retryOnPromise(() => {
|
|
2724
|
+
triggerEffects(container, target, effects);
|
|
2725
|
+
});
|
|
2497
2726
|
}
|
|
2498
2727
|
}
|
|
2499
|
-
} catch (e) {
|
|
2500
|
-
returnValue = Promise.reject(e);
|
|
2501
2728
|
}
|
|
2502
|
-
|
|
2503
|
-
currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
|
|
2504
|
-
chore.$resolve$?.(value));
|
|
2505
|
-
};
|
|
2506
|
-
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, error => after(void 0, error)),
|
|
2507
|
-
chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
|
|
2729
|
+
return returnValue;
|
|
2508
2730
|
}
|
|
2509
2731
|
function choreComparator(a, b, rootVNode) {
|
|
2510
2732
|
const macroTypeDiff = (240 & a.$type$) - (240 & b.$type$);
|
|
@@ -2552,8 +2774,6 @@
|
|
|
2552
2774
|
}
|
|
2553
2775
|
} else {
|
|
2554
2776
|
assertFalse(vnode_isVNode(aHost)), assertFalse(vnode_isVNode(bHost));
|
|
2555
|
-
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()}`;
|
|
2556
|
-
logWarn(errorMessage);
|
|
2557
2777
|
const hostDiff = ((a, b) => {
|
|
2558
2778
|
if (a === b) {
|
|
2559
2779
|
return 0;
|
|
@@ -2561,10 +2781,10 @@
|
|
|
2561
2781
|
let aDepth = -1;
|
|
2562
2782
|
let bDepth = -1;
|
|
2563
2783
|
for (;a; ) {
|
|
2564
|
-
a = (aSsrNodePath[++aDepth] = a).
|
|
2784
|
+
a = (aSsrNodePath[++aDepth] = a).parentComponent;
|
|
2565
2785
|
}
|
|
2566
2786
|
for (;b; ) {
|
|
2567
|
-
b = (bSsrNodePath[++bDepth] = b).
|
|
2787
|
+
b = (bSsrNodePath[++bDepth] = b).parentComponent;
|
|
2568
2788
|
}
|
|
2569
2789
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
2570
2790
|
if ((a = aSsrNodePath[aDepth]) !== (b = bSsrNodePath[bDepth])) {
|
|
@@ -2584,13 +2804,63 @@
|
|
|
2584
2804
|
return microTypeDiff;
|
|
2585
2805
|
}
|
|
2586
2806
|
const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
|
|
2587
|
-
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 :
|
|
2807
|
+
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;
|
|
2808
|
+
}
|
|
2809
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2810
|
+
const idx = function(sortedArray, value, rootVNode) {
|
|
2811
|
+
let bottom = 0;
|
|
2812
|
+
let top = sortedArray.length;
|
|
2813
|
+
for (;bottom < top; ) {
|
|
2814
|
+
const middle = bottom + (top - bottom >> 1);
|
|
2815
|
+
const comp = choreComparator(value, sortedArray[middle], rootVNode);
|
|
2816
|
+
if (comp < 0) {
|
|
2817
|
+
top = middle;
|
|
2818
|
+
} else {
|
|
2819
|
+
if (!(comp > 0)) {
|
|
2820
|
+
return middle;
|
|
2821
|
+
}
|
|
2822
|
+
bottom = middle + 1;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
return ~bottom;
|
|
2826
|
+
}(sortedArray, value, rootVNode);
|
|
2827
|
+
if (idx < 0 && runningChores.size) {
|
|
2828
|
+
for (const chore of runningChores) {
|
|
2829
|
+
if (0 === choreComparator(value, chore, rootVNode)) {
|
|
2830
|
+
return chore;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
if (idx < 0) {
|
|
2835
|
+
return sortedArray.splice(~idx, 0, value), value;
|
|
2836
|
+
}
|
|
2837
|
+
const existing = sortedArray[idx];
|
|
2838
|
+
return existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$),
|
|
2839
|
+
existing;
|
|
2588
2840
|
}
|
|
2589
2841
|
};
|
|
2590
2842
|
const toNumber = value => "number" == typeof value ? value : -1;
|
|
2591
2843
|
function vNodeAlreadyDeleted(chore) {
|
|
2592
2844
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
|
|
2593
2845
|
}
|
|
2846
|
+
function addBlockedChore(blockedChore, blockingChore, blockedChores) {
|
|
2847
|
+
blockingChore.$blockedChores$ ||= [], blockingChore.$blockedChores$.push(blockedChore),
|
|
2848
|
+
blockedChores.add(blockedChore);
|
|
2849
|
+
}
|
|
2850
|
+
function choreTypeToName(type) {
|
|
2851
|
+
return {
|
|
2852
|
+
1: "Resolve QRL",
|
|
2853
|
+
2: "Run QRL",
|
|
2854
|
+
3: "Task",
|
|
2855
|
+
4: "Changes diffing",
|
|
2856
|
+
5: "Updating node property",
|
|
2857
|
+
6: "Component",
|
|
2858
|
+
7: "Signal recompute",
|
|
2859
|
+
16: "Visible",
|
|
2860
|
+
32: "Cleanup visible",
|
|
2861
|
+
255: "Wait for queue"
|
|
2862
|
+
}[type] || "Unknown: " + type;
|
|
2863
|
+
}
|
|
2594
2864
|
class _SharedContainer {
|
|
2595
2865
|
$version$;
|
|
2596
2866
|
$scheduler$;
|
|
@@ -2601,11 +2871,12 @@
|
|
|
2601
2871
|
$currentUniqueId$=0;
|
|
2602
2872
|
$instanceHash$=null;
|
|
2603
2873
|
$buildBase$=null;
|
|
2604
|
-
|
|
2874
|
+
$flushEpoch$=0;
|
|
2875
|
+
constructor(journalFlush, serverData, locale) {
|
|
2605
2876
|
this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version,
|
|
2606
2877
|
this.$storeProxyMap$ = new WeakMap, this.$getObjectById$ = () => {
|
|
2607
2878
|
throw Error("Not implemented");
|
|
2608
|
-
}, this.$scheduler$ = createScheduler(this,
|
|
2879
|
+
}, this.$scheduler$ = createScheduler(this, journalFlush);
|
|
2609
2880
|
}
|
|
2610
2881
|
trackSignalValue(signal, subscriber, property, data) {
|
|
2611
2882
|
return trackSignalAndAssignHost(signal, subscriber, property, this, data);
|
|
@@ -2628,9 +2899,8 @@
|
|
|
2628
2899
|
return container || (container = new DomContainer(qContainerElement)), container;
|
|
2629
2900
|
}
|
|
2630
2901
|
function _getQContainerElement(element) {
|
|
2631
|
-
return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
|
|
2902
|
+
return (Array.isArray(element) ? vnode_getDomParent(element, !0) : element).closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
|
|
2632
2903
|
}
|
|
2633
|
-
const isDomContainer = container => container instanceof DomContainer;
|
|
2634
2904
|
class DomContainer extends _SharedContainer {
|
|
2635
2905
|
element;
|
|
2636
2906
|
qContainer;
|
|
@@ -2638,7 +2908,6 @@
|
|
|
2638
2908
|
rootVNode;
|
|
2639
2909
|
document;
|
|
2640
2910
|
$journal$;
|
|
2641
|
-
renderDone=null;
|
|
2642
2911
|
$rawStateData$;
|
|
2643
2912
|
$storeProxyMap$=new WeakMap;
|
|
2644
2913
|
$qFuncs$;
|
|
@@ -2648,10 +2917,11 @@
|
|
|
2648
2917
|
vNodeLocate=id => vnode_locate(this.rootVNode, id);
|
|
2649
2918
|
$stateData$;
|
|
2650
2919
|
$styleIds$=null;
|
|
2651
|
-
$renderCount$=0;
|
|
2652
2920
|
constructor(element) {
|
|
2653
|
-
if (super(() =>
|
|
2654
|
-
|
|
2921
|
+
if (super(() => {
|
|
2922
|
+
this.$flushEpoch$++, vnode_applyJournal(this.$journal$);
|
|
2923
|
+
}, {}, element.getAttribute("q:locale")), this.qContainer = element.getAttribute("q:container"),
|
|
2924
|
+
!this.qContainer) {
|
|
2655
2925
|
throw qError(25);
|
|
2656
2926
|
}
|
|
2657
2927
|
this.$journal$ = [ 3, element.ownerDocument ], this.document = element.ownerDocument,
|
|
@@ -2788,7 +3058,10 @@
|
|
|
2788
3058
|
nextNode = nextSibling(node);
|
|
2789
3059
|
const shadowRootContainer = node;
|
|
2790
3060
|
const shadowRoot = shadowRootContainer?.shadowRoot;
|
|
2791
|
-
|
|
3061
|
+
if (shadowRoot) {
|
|
3062
|
+
const firstShadowRootChild = firstChild(shadowRoot);
|
|
3063
|
+
walkContainer(document.createTreeWalker(firstShadowRootChild, 129), null, firstShadowRootChild, null, "", null);
|
|
3064
|
+
}
|
|
2792
3065
|
}
|
|
2793
3066
|
if (!(2 & ~nodeType)) {
|
|
2794
3067
|
if (vNodeElementIndex < elementIdx && (-1 === vNodeElementIndex && (vNodeElementIndex = 0),
|
|
@@ -2831,16 +3104,13 @@
|
|
|
2831
3104
|
}
|
|
2832
3105
|
setContext(host, context, value) {
|
|
2833
3106
|
let ctx = this.getHostProp(host, "q:ctx");
|
|
2834
|
-
ctx
|
|
3107
|
+
null == ctx && this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0, !0);
|
|
2835
3108
|
}
|
|
2836
3109
|
resolveContext(host, contextId) {
|
|
2837
3110
|
for (;host; ) {
|
|
2838
3111
|
const ctx = this.getHostProp(host, "q:ctx");
|
|
2839
|
-
if (ctx) {
|
|
2840
|
-
|
|
2841
|
-
if (value) {
|
|
2842
|
-
return value;
|
|
2843
|
-
}
|
|
3112
|
+
if (null != ctx && mapArray_has(ctx, contextId.id, 0)) {
|
|
3113
|
+
return mapArray_get(ctx, contextId.id, 0);
|
|
2844
3114
|
}
|
|
2845
3115
|
host = this.getParentHost(host);
|
|
2846
3116
|
}
|
|
@@ -2880,26 +3150,6 @@
|
|
|
2880
3150
|
}
|
|
2881
3151
|
return vnode_getProp(vNode, name, getObjectById);
|
|
2882
3152
|
}
|
|
2883
|
-
scheduleRender() {
|
|
2884
|
-
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick(() => this.processChores()),
|
|
2885
|
-
this.renderDone.finally(() => emitEvent("qrender", {
|
|
2886
|
-
instanceHash: this.$instanceHash$,
|
|
2887
|
-
renderCount: this.$renderCount$
|
|
2888
|
-
}));
|
|
2889
|
-
}
|
|
2890
|
-
processChores() {
|
|
2891
|
-
let renderCount = this.$renderCount$;
|
|
2892
|
-
const result = this.$scheduler$(255);
|
|
2893
|
-
if (isPromise(result)) {
|
|
2894
|
-
return result.then(async () => {
|
|
2895
|
-
for (;renderCount !== this.$renderCount$; ) {
|
|
2896
|
-
renderCount = this.$renderCount$, await this.$scheduler$(255);
|
|
2897
|
-
}
|
|
2898
|
-
this.renderDone = null;
|
|
2899
|
-
});
|
|
2900
|
-
}
|
|
2901
|
-
renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
|
|
2902
|
-
}
|
|
2903
3153
|
ensureProjectionResolved(vNode) {
|
|
2904
3154
|
if (!(16 & vNode[0])) {
|
|
2905
3155
|
vNode[0] |= 16;
|
|
@@ -2907,7 +3157,10 @@
|
|
|
2907
3157
|
for (let i = 0; i < props.length; i += 2) {
|
|
2908
3158
|
if (isSlotProp(props[i])) {
|
|
2909
3159
|
const value = props[i + 1];
|
|
2910
|
-
"string" == typeof value
|
|
3160
|
+
if ("string" == typeof value) {
|
|
3161
|
+
const projection = this.vNodeLocate(value);
|
|
3162
|
+
props[i + 1] = projection, vnode_getProp(projection, "q:sparent", id => this.vNodeLocate(id));
|
|
3163
|
+
}
|
|
2911
3164
|
}
|
|
2912
3165
|
}
|
|
2913
3166
|
}
|
|
@@ -2971,7 +3224,7 @@
|
|
|
2971
3224
|
array[2] ||= new Set, array[2].add(value);
|
|
2972
3225
|
};
|
|
2973
3226
|
const addQrlToSerializationCtx = (effectSubscriber, container) => {
|
|
2974
|
-
if (container && !
|
|
3227
|
+
if (container && !(container => container instanceof DomContainer)(container)) {
|
|
2975
3228
|
const effect = effectSubscriber[0];
|
|
2976
3229
|
const property = effectSubscriber[1];
|
|
2977
3230
|
let qrl = null;
|
|
@@ -2980,7 +3233,7 @@
|
|
|
2980
3233
|
}
|
|
2981
3234
|
};
|
|
2982
3235
|
const triggerEffects = (container, signal, effects) => {
|
|
2983
|
-
const isBrowser =
|
|
3236
|
+
const isBrowser = !isServerPlatform();
|
|
2984
3237
|
if (effects) {
|
|
2985
3238
|
const scheduleEffect = effectSubscription => {
|
|
2986
3239
|
const consumer = effectSubscription[0];
|
|
@@ -2988,7 +3241,7 @@
|
|
|
2988
3241
|
if (assertDefined(), isTask(consumer)) {
|
|
2989
3242
|
consumer.$flags$ |= 8;
|
|
2990
3243
|
let choreType = 3;
|
|
2991
|
-
1 & consumer.$flags$ && (choreType =
|
|
3244
|
+
1 & consumer.$flags$ && (choreType = 16), container.$scheduler$(choreType, consumer);
|
|
2992
3245
|
} else if (consumer instanceof SignalImpl) {
|
|
2993
3246
|
consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)),
|
|
2994
3247
|
consumer.invalidate();
|
|
@@ -2998,18 +3251,18 @@
|
|
|
2998
3251
|
assertDefined();
|
|
2999
3252
|
const props = container.getHostProp(host, "q:props");
|
|
3000
3253
|
container.$scheduler$(6, host, qrl, props);
|
|
3001
|
-
} else if (
|
|
3002
|
-
if (
|
|
3254
|
+
} else if ("." === property) {
|
|
3255
|
+
if (isBrowser) {
|
|
3003
3256
|
container.$scheduler$(4, consumer, consumer, signal);
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3257
|
+
}
|
|
3258
|
+
} else {
|
|
3259
|
+
const effectData = effectSubscription[3];
|
|
3260
|
+
if (effectData instanceof SubscriptionData) {
|
|
3261
|
+
const payload = {
|
|
3262
|
+
...effectData.data,
|
|
3263
|
+
$value$: signal
|
|
3264
|
+
};
|
|
3265
|
+
container.$scheduler$(5, consumer, property, payload);
|
|
3013
3266
|
}
|
|
3014
3267
|
}
|
|
3015
3268
|
};
|
|
@@ -3022,11 +3275,11 @@
|
|
|
3022
3275
|
let flags = 1;
|
|
3023
3276
|
switch (serializationStrategy) {
|
|
3024
3277
|
case "never":
|
|
3025
|
-
flags |=
|
|
3278
|
+
flags |= 16;
|
|
3026
3279
|
break;
|
|
3027
3280
|
|
|
3028
3281
|
case "always":
|
|
3029
|
-
flags |=
|
|
3282
|
+
flags |= 32;
|
|
3030
3283
|
}
|
|
3031
3284
|
return flags;
|
|
3032
3285
|
};
|
|
@@ -3181,13 +3434,16 @@
|
|
|
3181
3434
|
}
|
|
3182
3435
|
}
|
|
3183
3436
|
};
|
|
3184
|
-
function vnode_walkVNode(vNode) {
|
|
3437
|
+
function vnode_walkVNode(vNode, callback) {
|
|
3185
3438
|
let vCursor = vNode;
|
|
3186
3439
|
if (vnode_isTextVNode(vNode)) {
|
|
3187
3440
|
return;
|
|
3188
3441
|
}
|
|
3189
3442
|
let vParent = null;
|
|
3190
3443
|
for (;;) {
|
|
3444
|
+
if (callback?.(vCursor, vParent)) {
|
|
3445
|
+
return;
|
|
3446
|
+
}
|
|
3191
3447
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
3192
3448
|
if (vFirstChild) {
|
|
3193
3449
|
vCursor = vFirstChild;
|
|
@@ -3279,6 +3535,7 @@
|
|
|
3279
3535
|
const textVNode = ensureTextVNode(vnode);
|
|
3280
3536
|
if (!(8 & textVNode[0])) {
|
|
3281
3537
|
const parentNode = vnode_getDomParent(vnode);
|
|
3538
|
+
assertDefined();
|
|
3282
3539
|
const sharedTextNode = textVNode[4];
|
|
3283
3540
|
const doc = parentNode.ownerDocument;
|
|
3284
3541
|
let cursor = vnode_getDomSibling(vnode, !1, !0);
|
|
@@ -3444,7 +3701,7 @@
|
|
|
3444
3701
|
}
|
|
3445
3702
|
insertBefore = null;
|
|
3446
3703
|
}
|
|
3447
|
-
const domParentVNode = vnode_getDomParentVNode(parent);
|
|
3704
|
+
const domParentVNode = vnode_getDomParentVNode(parent, !1);
|
|
3448
3705
|
const parentNode = domParentVNode && domParentVNode[6];
|
|
3449
3706
|
let domChildren = null;
|
|
3450
3707
|
domParentVNode && (domChildren = function(journal, domParentVNode, newChild) {
|
|
@@ -3470,27 +3727,30 @@
|
|
|
3470
3727
|
}
|
|
3471
3728
|
return domChildren;
|
|
3472
3729
|
}(journal, domParentVNode, newChild)), newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, !1);
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3730
|
+
const parentIsDeleted = 32 & parent[0];
|
|
3731
|
+
if (!parentIsDeleted) {
|
|
3732
|
+
let adjustedInsertBefore = null;
|
|
3733
|
+
null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore,
|
|
3734
|
+
adjustedInsertBefore && ((journal, vNode) => {
|
|
3735
|
+
vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
|
|
3736
|
+
})(journal, adjustedInsertBefore), domChildren && domChildren.length && journal.push(5, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
|
|
3737
|
+
}
|
|
3478
3738
|
const vNext = insertBefore;
|
|
3479
3739
|
const vPrevious = vNext ? vNext[2] : parent[5];
|
|
3480
3740
|
vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild,
|
|
3481
|
-
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
|
|
3741
|
+
newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent, parentIsDeleted && (newChild[0] |= 32);
|
|
3482
3742
|
};
|
|
3483
|
-
const vnode_getDomParent = vnode => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
|
|
3484
|
-
const vnode_getDomParentVNode = vnode => {
|
|
3743
|
+
const vnode_getDomParent = (vnode, includeProjection = !0) => (vnode = vnode_getDomParentVNode(vnode, includeProjection)) && vnode[6];
|
|
3744
|
+
const vnode_getDomParentVNode = (vnode, includeProjection = !0) => {
|
|
3485
3745
|
for (;vnode && !vnode_isElementVNode(vnode); ) {
|
|
3486
|
-
vnode = vnode[1];
|
|
3746
|
+
vnode = vnode[1] || (includeProjection ? vnode_getProp(vnode, "q:sparent", id => vnode_isVNode(id) ? id : null) : null);
|
|
3487
3747
|
}
|
|
3488
3748
|
return vnode;
|
|
3489
3749
|
};
|
|
3490
3750
|
const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
3491
3751
|
if (assertEqual(vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove),
|
|
3492
3752
|
removeDOM) {
|
|
3493
|
-
const domParent = vnode_getDomParent(vParent);
|
|
3753
|
+
const domParent = vnode_getDomParent(vParent, !1);
|
|
3494
3754
|
if (vnode_getAttr(vParent, "dangerouslySetInnerHTML")) {
|
|
3495
3755
|
return;
|
|
3496
3756
|
}
|
|
@@ -3870,6 +4130,25 @@
|
|
|
3870
4130
|
};
|
|
3871
4131
|
const vnode_getProps = vnode => vnode[vnode_getPropStartIndex(vnode)];
|
|
3872
4132
|
const vnode_getParent = vnode => vnode[1] || null;
|
|
4133
|
+
const vnode_isDescendantOf = (vnode, ancestor, rootVNode) => {
|
|
4134
|
+
let parent = vnode_getParentOrProjectionParent(vnode, rootVNode);
|
|
4135
|
+
for (;parent; ) {
|
|
4136
|
+
if (parent === ancestor) {
|
|
4137
|
+
return !0;
|
|
4138
|
+
}
|
|
4139
|
+
parent = vnode_getParentOrProjectionParent(parent, rootVNode);
|
|
4140
|
+
}
|
|
4141
|
+
return !1;
|
|
4142
|
+
};
|
|
4143
|
+
const vnode_getParentOrProjectionParent = (vnode, rootVNode) => {
|
|
4144
|
+
if (rootVNode) {
|
|
4145
|
+
const parentProjection = vnode_getProp(vnode, "q:sparent", id => vnode_locate(rootVNode, id));
|
|
4146
|
+
if (parentProjection) {
|
|
4147
|
+
return parentProjection;
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
return vnode_getParent(vnode);
|
|
4151
|
+
};
|
|
3873
4152
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode)),
|
|
3874
4153
|
vnode[4]);
|
|
3875
4154
|
function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1, colorize = !0) {
|
|
@@ -4010,9 +4289,9 @@
|
|
|
4010
4289
|
}
|
|
4011
4290
|
const container = this.$container$;
|
|
4012
4291
|
let propValue = allocate(container, typeId, value);
|
|
4013
|
-
return
|
|
4014
|
-
|
|
4015
|
-
propValue;
|
|
4292
|
+
return Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue,
|
|
4293
|
+
typeId >= 14 && (propValue = inflate(container, propValue, typeId, value), Reflect.set(target, property, propValue),
|
|
4294
|
+
this.$data$[idx + 1] = propValue), propValue;
|
|
4016
4295
|
}
|
|
4017
4296
|
has(target, property) {
|
|
4018
4297
|
return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
|
|
@@ -4135,7 +4414,7 @@
|
|
|
4135
4414
|
const d = data;
|
|
4136
4415
|
computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
|
|
4137
4416
|
d.length > 2 ? (computed.$untrackedValue$ = d[2], 29 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
|
|
4138
|
-
computed.$computeQrl$.resolve(), container.$scheduler
|
|
4417
|
+
computed.$computeQrl$.resolve(), container.$scheduler$(1, null, computed.$computeQrl$));
|
|
4139
4418
|
break;
|
|
4140
4419
|
}
|
|
4141
4420
|
|
|
@@ -4615,8 +4894,8 @@
|
|
|
4615
4894
|
output(26, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
4616
4895
|
} else if (value instanceof ComputedSignalImpl) {
|
|
4617
4896
|
let v = value.$untrackedValue$;
|
|
4618
|
-
const shouldAlwaysSerialize =
|
|
4619
|
-
const shouldNeverSerialize =
|
|
4897
|
+
const shouldAlwaysSerialize = 32 & value.$flags$;
|
|
4898
|
+
const shouldNeverSerialize = 16 & value.$flags$;
|
|
4620
4899
|
const isInvalid = 1 & value.$flags$;
|
|
4621
4900
|
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
4622
4901
|
shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION),
|
|
@@ -4853,8 +5132,7 @@
|
|
|
4853
5132
|
const result = platform.chunkForSymbol(symbol, chunk, value.dev?.file);
|
|
4854
5133
|
result && (chunk = result[1], symbol = result[0]);
|
|
4855
5134
|
}
|
|
4856
|
-
|
|
4857
|
-
if (isSync) {
|
|
5135
|
+
if (isSyncQrl(value)) {
|
|
4858
5136
|
chunk = "", symbol = String(serializationContext.$addSyncFn$(null, 0, value.resolved));
|
|
4859
5137
|
} else {
|
|
4860
5138
|
chunk || (chunk = serializationContext.$symbolToChunkResolver$(value.$hash$));
|
|
@@ -5473,7 +5751,7 @@
|
|
|
5473
5751
|
assertQrl(qrl);
|
|
5474
5752
|
const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
5475
5753
|
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
|
|
5476
|
-
iCtx.$container$.$scheduler$(
|
|
5754
|
+
iCtx.$container$.$scheduler$(16, task));
|
|
5477
5755
|
};
|
|
5478
5756
|
const useRunTask = (task, eagerness) => {
|
|
5479
5757
|
"intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "document-idle" === eagerness && useOnDocument("qidle", getTaskHandlerQrl(task));
|
|
@@ -5488,9 +5766,13 @@
|
|
|
5488
5766
|
registrations.forEach(registration => {
|
|
5489
5767
|
registration.active && registration.active.scriptURL.endsWith("_URL_") && registration.unregister().catch(console.error);
|
|
5490
5768
|
});
|
|
5491
|
-
})
|
|
5769
|
+
}), "caches" in window && caches.keys().then(names => {
|
|
5770
|
+
const cacheName = names.find(name => name.startsWith("QwikBundles"));
|
|
5771
|
+
cacheName && caches.delete(cacheName).catch(console.error);
|
|
5772
|
+
}).catch(console.error);
|
|
5492
5773
|
}).toString();
|
|
5493
|
-
|
|
5774
|
+
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`),
|
|
5775
|
+
globalThis.__qwik = version, Object.defineProperty(exports, "isBrowser", {
|
|
5494
5776
|
enumerable: !0,
|
|
5495
5777
|
get: function() {
|
|
5496
5778
|
return build.isBrowser;
|
|
@@ -5519,7 +5801,7 @@
|
|
|
5519
5801
|
...opts
|
|
5520
5802
|
};
|
|
5521
5803
|
resolvedOpts.path = opts?.path?.startsWith?.("/") ? opts.path : baseUrl + resolvedOpts.path;
|
|
5522
|
-
let code = PREFETCH_CODE.replace("
|
|
5804
|
+
let code = PREFETCH_CODE.replace('"_URL_"', JSON.stringify(resolvedOpts.path.split("/").pop()));
|
|
5523
5805
|
build.isDev || (code = code.replaceAll(/\s\s+/gm, ""));
|
|
5524
5806
|
const props = {
|
|
5525
5807
|
dangerouslySetInnerHTML: [ "(" + code + ")(", [ "navigator.serviceWorker" ].join(","), ");" ].join(""),
|
|
@@ -5529,8 +5811,8 @@
|
|
|
5529
5811
|
}, exports.RenderOnce = RenderOnce, exports.Resource = props => _jsxSorted(Fragment, null, null, function(props) {
|
|
5530
5812
|
const resource = props.value;
|
|
5531
5813
|
if (isResourceReturn(resource)) {
|
|
5814
|
+
const state = resource._state;
|
|
5532
5815
|
if (!isServerPlatform()) {
|
|
5533
|
-
const state = resource._state;
|
|
5534
5816
|
if ("pending" === state && props.onPending) {
|
|
5535
5817
|
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
5536
5818
|
}
|
|
@@ -5544,8 +5826,7 @@
|
|
|
5544
5826
|
}
|
|
5545
5827
|
}
|
|
5546
5828
|
}
|
|
5547
|
-
|
|
5548
|
-
return value ? value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : Promise.resolve(void 0);
|
|
5829
|
+
return untrack(() => resource.value).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
5549
5830
|
}
|
|
5550
5831
|
if (isPromise(resource)) {
|
|
5551
5832
|
return resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
@@ -5580,6 +5861,7 @@
|
|
|
5580
5861
|
}
|
|
5581
5862
|
return output;
|
|
5582
5863
|
}, exports._dumpState = dumpState, exports._fnSignal = (fn, args, fnStr) => new WrappedSignalImpl(null, fn, args, fnStr || null),
|
|
5864
|
+
exports._getConstProps = props => props && _CONST_PROPS in props ? props[_CONST_PROPS] : null,
|
|
5583
5865
|
exports._getContextContainer = () => {
|
|
5584
5866
|
const iCtx = tryGetInvokeContext();
|
|
5585
5867
|
if (iCtx) {
|
|
@@ -5599,7 +5881,13 @@
|
|
|
5599
5881
|
return iCtx.$event$;
|
|
5600
5882
|
}
|
|
5601
5883
|
}, exports._getDomContainer = getDomContainer, exports._getQContainerElement = _getQContainerElement,
|
|
5602
|
-
exports.
|
|
5884
|
+
exports._getVarProps = props => props ? _VAR_PROPS in props ? "children" in props ? {
|
|
5885
|
+
...props[_VAR_PROPS],
|
|
5886
|
+
children: props.children
|
|
5887
|
+
} : props[_VAR_PROPS] : props : null, exports._hasStoreEffects = (value, prop) => {
|
|
5888
|
+
const handler = getStoreHandler(value);
|
|
5889
|
+
return !!handler && (handler.$effects$?.get(prop)?.size ?? 0) > 0;
|
|
5890
|
+
}, exports._isJSXNode = isJSXNode, exports._isStore = isStore, exports._isStringifiable = function(value) {
|
|
5603
5891
|
return null === value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value;
|
|
5604
5892
|
}, exports._isTask = isTask, exports._jsxBranch = input => input, exports._jsxC = (type, mutable, _flags, key) => jsx(type, mutable, key),
|
|
5605
5893
|
exports._jsxQ = (type, mutable, immutable, children, _flags, key) => jsx(type, {
|
|
@@ -5624,7 +5912,7 @@
|
|
|
5624
5912
|
if (hostElement) {
|
|
5625
5913
|
return iCtx.$container$?.resolveContext(hostElement, context);
|
|
5626
5914
|
}
|
|
5627
|
-
}, exports._restProps = (props, omit, target = {}) => {
|
|
5915
|
+
}, exports._restProps = (props, omit = [], target = {}) => {
|
|
5628
5916
|
let constPropsTarget = null;
|
|
5629
5917
|
const constProps = props[_CONST_PROPS];
|
|
5630
5918
|
if (constProps) {
|
|
@@ -5638,7 +5926,7 @@
|
|
|
5638
5926
|
omit.includes(key) || (varPropsTarget[key] = varProps[key]);
|
|
5639
5927
|
}
|
|
5640
5928
|
return createPropsProxy(varPropsTarget, constPropsTarget);
|
|
5641
|
-
}, exports._run =
|
|
5929
|
+
}, exports._run = _run, exports._serializationWeakRef = obj => new SerializationWeakRef(obj),
|
|
5642
5930
|
exports._serialize = async function(data) {
|
|
5643
5931
|
const serializationContext = createSerializationContext(null, null, () => "", () => "", () => {}, new WeakMap);
|
|
5644
5932
|
for (const root of data) {
|
|
@@ -5652,12 +5940,17 @@
|
|
|
5652
5940
|
exports._vnode_getProps = vnode_getProps, exports._vnode_isMaterialized = vnode_isMaterialized,
|
|
5653
5941
|
exports._vnode_isTextVNode = vnode_isTextVNode, exports._vnode_isVirtualVNode = vnode_isVirtualVNode,
|
|
5654
5942
|
exports._vnode_toString = vnode_toString, exports._waitUntilRendered = elm => {
|
|
5655
|
-
const
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5943
|
+
const container = _getQContainerElement(elm)?.qContainer;
|
|
5944
|
+
return container ? (async () => {
|
|
5945
|
+
for (;;) {
|
|
5946
|
+
await container.$scheduler$(255).$returnValue$;
|
|
5947
|
+
const firstEpoch = container.$flushEpoch$ || 0;
|
|
5948
|
+
await Promise.resolve();
|
|
5949
|
+
if (firstEpoch === (container.$flushEpoch$ || 0)) {
|
|
5950
|
+
return;
|
|
5951
|
+
}
|
|
5952
|
+
}
|
|
5953
|
+
})() : Promise.resolve();
|
|
5661
5954
|
}, exports._walkJSX = _walkJSX, exports._wrapProp = _wrapProp, exports._wrapSignal = (obj, prop) => {
|
|
5662
5955
|
const r = _wrapProp(obj, prop);
|
|
5663
5956
|
return r === _IMMUTABLE ? obj[prop] : r;
|
|
@@ -5666,8 +5959,8 @@
|
|
|
5666
5959
|
exports.createComputed$ = createComputed$, exports.createComputedQrl = createComputedSignal,
|
|
5667
5960
|
exports.createContextId = createContextId, exports.createElement = h, exports.createSerializer$ = createSerializer$,
|
|
5668
5961
|
exports.createSerializerQrl = createSerializerSignal, exports.createSignal = createSignal,
|
|
5669
|
-
exports.event$ = event$, exports.eventQrl = eventQrl, exports.
|
|
5670
|
-
exports.getLocale = function(defaultLocale) {
|
|
5962
|
+
exports.event$ = event$, exports.eventQrl = eventQrl, exports.forceStoreEffects = forceStoreEffects,
|
|
5963
|
+
exports.getDomContainer = getDomContainer, exports.getLocale = function(defaultLocale) {
|
|
5671
5964
|
if (void 0 === _locale) {
|
|
5672
5965
|
const ctx = tryGetInvokeContext();
|
|
5673
5966
|
if (ctx && ctx.$locale$) {
|
|
@@ -5710,7 +6003,7 @@
|
|
|
5710
6003
|
const container = getDomContainer(parent);
|
|
5711
6004
|
container.$serverData$ = opts.serverData || {};
|
|
5712
6005
|
const host = container.rootVNode;
|
|
5713
|
-
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255)
|
|
6006
|
+
return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255).$returnValue$,
|
|
5714
6007
|
{
|
|
5715
6008
|
cleanup: () => {
|
|
5716
6009
|
cleanup(container, container.rootVNode);
|