@qwik.dev/core 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/core-internal.d.ts +112 -30
- package/dist/core.cjs +343 -227
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +338 -226
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +404 -328
- package/dist/core.prod.mjs +406 -330
- package/dist/insights/vite/index.cjs +1 -1
- package/dist/insights/vite/index.mjs +10 -10
- package/dist/loader/index.cjs +1 -1
- package/dist/loader/index.mjs +1 -1
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +108 -108
- package/dist/optimizer.mjs +106 -106
- package/dist/preloader.cjs +3 -3
- package/dist/preloader.mjs +3 -3
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +27 -14
- package/dist/server.mjs +27 -14
- package/dist/starters/features/playwright/playwright-report/index.html +10 -8
- package/dist/testing/index.cjs +242 -141
- package/dist/testing/index.mjs +233 -133
- package/dist/testing/package.json +1 -1
- package/package.json +6 -6
- package/public.d.ts +1 -0
package/dist/core.prod.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.4-dev+9849dcf
|
|
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
|
|
7
7
|
*/
|
|
8
8
|
!function(global, factory) {
|
|
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
|
-
}(this,
|
|
10
|
+
}(this, function(exports, build, preloader) {
|
|
11
11
|
"use strict";
|
|
12
12
|
const qDev = !1;
|
|
13
13
|
const seal = () => {
|
|
@@ -22,10 +22,18 @@
|
|
|
22
22
|
const createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
23
23
|
const err = message instanceof Error ? message : new Error(message);
|
|
24
24
|
return console.error("%cQWIK ERROR", "", err.message, ...optionalParams, err.stack),
|
|
25
|
-
asyncThrow && setTimeout((
|
|
25
|
+
asyncThrow && setTimeout(() => {
|
|
26
26
|
throw err;
|
|
27
|
-
}
|
|
27
|
+
}, 0), err;
|
|
28
28
|
};
|
|
29
|
+
const isSerializableObject = v => {
|
|
30
|
+
const proto = Object.getPrototypeOf(v);
|
|
31
|
+
return proto === Object.prototype || proto === Array.prototype || null === proto;
|
|
32
|
+
};
|
|
33
|
+
const isObject = v => "object" == typeof v && null !== v;
|
|
34
|
+
const isArray = v => Array.isArray(v);
|
|
35
|
+
const isString = v => "string" == typeof v;
|
|
36
|
+
const isFunction = v => "function" == typeof v;
|
|
29
37
|
const qError = (code, errorMessageArgs = []) => {
|
|
30
38
|
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);
|
|
31
39
|
return ((message, ...optionalParams) => createAndLogError(qDev, message, ...optionalParams))(text, ...errorMessageArgs);
|
|
@@ -65,18 +73,18 @@
|
|
|
65
73
|
const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
|
|
66
74
|
const urlCopy = new URL(urlDoc);
|
|
67
75
|
urlCopy.hash = "";
|
|
68
|
-
return import(urlCopy.href).then(
|
|
76
|
+
return import(urlCopy.href).then(mod => mod[symbolName]);
|
|
69
77
|
},
|
|
70
|
-
raf: fn => new Promise(
|
|
71
|
-
requestAnimationFrame((
|
|
78
|
+
raf: fn => new Promise(resolve => {
|
|
79
|
+
requestAnimationFrame(() => {
|
|
72
80
|
resolve(fn());
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
nextTick: fn => new Promise(
|
|
76
|
-
setTimeout((
|
|
81
|
+
});
|
|
82
|
+
}),
|
|
83
|
+
nextTick: fn => new Promise(resolve => {
|
|
84
|
+
setTimeout(() => {
|
|
77
85
|
resolve(fn());
|
|
78
|
-
})
|
|
79
|
-
})
|
|
86
|
+
});
|
|
87
|
+
}),
|
|
80
88
|
chunkForSymbol: (symbolName, chunk) => [ symbolName, chunk ?? "_" ]
|
|
81
89
|
});
|
|
82
90
|
const toUrl = (doc, containerEl, url) => {
|
|
@@ -102,9 +110,9 @@
|
|
|
102
110
|
const shouldNotError = reason => {
|
|
103
111
|
throwErrorAndStop(reason);
|
|
104
112
|
};
|
|
105
|
-
const delay = timeout => new Promise(
|
|
113
|
+
const delay = timeout => new Promise(resolve => {
|
|
106
114
|
setTimeout(resolve, timeout);
|
|
107
|
-
})
|
|
115
|
+
});
|
|
108
116
|
function retryOnPromise(fn, retryCount = 0) {
|
|
109
117
|
const retryOrThrow = e => {
|
|
110
118
|
if (isPromise(e) && retryCount < 100) {
|
|
@@ -114,7 +122,7 @@
|
|
|
114
122
|
};
|
|
115
123
|
try {
|
|
116
124
|
const result = fn();
|
|
117
|
-
return isPromise(result) ? result.catch(
|
|
125
|
+
return isPromise(result) ? result.catch(e => retryOrThrow(e)) : result;
|
|
118
126
|
} catch (e) {
|
|
119
127
|
if (build.isDev && build.isServer && e instanceof ReferenceError && e.message.includes("window")) {
|
|
120
128
|
throw e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message,
|
|
@@ -123,14 +131,6 @@
|
|
|
123
131
|
return retryOrThrow(e);
|
|
124
132
|
}
|
|
125
133
|
}
|
|
126
|
-
const isSerializableObject = v => {
|
|
127
|
-
const proto = Object.getPrototypeOf(v);
|
|
128
|
-
return proto === Object.prototype || proto === Array.prototype || null === proto;
|
|
129
|
-
};
|
|
130
|
-
const isObject = v => !!v && "object" == typeof v;
|
|
131
|
-
const isArray = v => Array.isArray(v);
|
|
132
|
-
const isString = v => "string" == typeof v;
|
|
133
|
-
const isFunction = v => "function" == typeof v;
|
|
134
134
|
function assertDefined() {
|
|
135
135
|
qDev;
|
|
136
136
|
}
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
this.$untrackedValue$ = value;
|
|
164
164
|
}
|
|
165
165
|
get value() {
|
|
166
|
-
return setupSignalValueAccess(this, (
|
|
166
|
+
return setupSignalValueAccess(this, () => this.$effects$ ||= new Set, () => this.untrackedValue);
|
|
167
167
|
}
|
|
168
168
|
set value(value) {
|
|
169
169
|
value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
qDev;
|
|
173
173
|
}
|
|
174
174
|
toString() {
|
|
175
|
-
return build.isDev ? `[${this.constructor.name}${1 & this.$flags$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map(
|
|
175
|
+
return build.isDev ? `[${this.constructor.name}${1 & this.$flags$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map(e => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "") : this.constructor.name;
|
|
176
176
|
}
|
|
177
177
|
toJSON() {
|
|
178
178
|
return {
|
|
@@ -211,11 +211,11 @@
|
|
|
211
211
|
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
|
|
212
212
|
this.$flags$ = flags;
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
invalidate() {
|
|
215
215
|
this.$flags$ |= 1, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
216
216
|
}
|
|
217
217
|
force() {
|
|
218
|
-
this.$
|
|
218
|
+
this.$forceRunEffects$ = !0, this.$container$?.$scheduler$(7, this.$hostElement$, this, this.$effects$);
|
|
219
219
|
}
|
|
220
220
|
get untrackedValue() {
|
|
221
221
|
const didChange = this.$computeIfNeeded$();
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
if (!(1 & this.$flags$)) {
|
|
226
226
|
return !1;
|
|
227
227
|
}
|
|
228
|
-
const untrackedValue = trackSignal((
|
|
228
|
+
const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
|
|
229
229
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
230
230
|
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
231
231
|
}
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
$event$: event,
|
|
309
309
|
$qrl$: void 0,
|
|
310
310
|
$effectSubscriber$: void 0,
|
|
311
|
-
$locale$: locale || (
|
|
311
|
+
$locale$: locale || (event && isObject(event) && "locale" in event ? event.locale : void 0),
|
|
312
312
|
$container$: void 0
|
|
313
313
|
};
|
|
314
314
|
return seal(), ctx;
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
328
|
const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignalImpl && value.$hostElement$ !== host && host && (value.$hostElement$ = host),
|
|
329
|
-
trackSignal((
|
|
329
|
+
trackSignal(() => value.value, host, property, container, data));
|
|
330
330
|
const useSequentialScope = () => {
|
|
331
331
|
const iCtx = useInvokeContext();
|
|
332
332
|
const host = iCtx.$hostElement$;
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
set(1));
|
|
401
401
|
};
|
|
402
402
|
const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
|
|
403
|
-
const version = "2.0.0-beta.
|
|
403
|
+
const version = "2.0.0-beta.4-dev+9849dcf";
|
|
404
404
|
const EMPTY_ARRAY = [];
|
|
405
405
|
const EMPTY_OBJ = {};
|
|
406
406
|
Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
|
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
{
|
|
425
425
|
const ref = "QWIK-SELF";
|
|
426
426
|
const frames = new Error(ref).stack.split("\n");
|
|
427
|
-
const start = frames.findIndex(
|
|
427
|
+
const start = frames.findIndex(f => f.includes(ref));
|
|
428
428
|
match = frames[start + 2 + stackOffset].match(EXTRACT_FILE_NAME), chunk = match ? match[1] : "main";
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -469,6 +469,7 @@
|
|
|
469
469
|
const _CONST_PROPS = Symbol("CONST");
|
|
470
470
|
const _VAR_PROPS = Symbol("VAR");
|
|
471
471
|
const _IMMUTABLE = Symbol("IMMUTABLE");
|
|
472
|
+
const _UNINITIALIZED = Symbol("UNINITIALIZED");
|
|
472
473
|
const implicit$FirstArg = fn => function(first, ...rest) {
|
|
473
474
|
return fn.call(null, dollar(first), ...rest);
|
|
474
475
|
};
|
|
@@ -477,10 +478,10 @@
|
|
|
477
478
|
$flags$;
|
|
478
479
|
$forceRunEffects$=!1;
|
|
479
480
|
[_EFFECT_BACK_REF]=null;
|
|
480
|
-
constructor(container, fn, flags =
|
|
481
|
+
constructor(container, fn, flags = 17) {
|
|
481
482
|
super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
|
|
482
483
|
}
|
|
483
|
-
|
|
484
|
+
invalidate() {
|
|
484
485
|
this.$flags$ |= 1, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(7, null, this, this.$effects$);
|
|
485
486
|
}
|
|
486
487
|
force() {
|
|
@@ -520,7 +521,7 @@
|
|
|
520
521
|
}
|
|
521
522
|
class SerializerSignalImpl extends ComputedSignalImpl {
|
|
522
523
|
constructor(container, argQrl) {
|
|
523
|
-
super(container, argQrl);
|
|
524
|
+
super(container, argQrl, 17);
|
|
524
525
|
}
|
|
525
526
|
$didInitialize$=!1;
|
|
526
527
|
$computeIfNeeded$() {
|
|
@@ -533,7 +534,7 @@
|
|
|
533
534
|
const {deserialize, initial} = arg;
|
|
534
535
|
const update = arg.update;
|
|
535
536
|
const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
|
|
536
|
-
const untrackedValue = trackSignal((
|
|
537
|
+
const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) || currentValue : deserialize(currentValue), this, ".", this.$container$);
|
|
537
538
|
const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
|
|
538
539
|
return this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$untrackedValue$ = untrackedValue),
|
|
539
540
|
didChange;
|
|
@@ -585,7 +586,7 @@
|
|
|
585
586
|
if ("toString" === prop && value === Object.prototype.toString) {
|
|
586
587
|
return this.toString;
|
|
587
588
|
}
|
|
588
|
-
return 1 & this.$flags$ &&
|
|
589
|
+
return 1 & this.$flags$ && isObject(value) && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
|
|
589
590
|
}
|
|
590
591
|
set(target, prop, value) {
|
|
591
592
|
if ("symbol" == typeof prop) {
|
|
@@ -665,7 +666,7 @@
|
|
|
665
666
|
const trackFn = (target, container) => (obj, prop) => {
|
|
666
667
|
const ctx = newInvokeContext();
|
|
667
668
|
return ctx.$effectSubscriber$ = getSubscriber(target, ":"), ctx.$container$ = container || void 0,
|
|
668
|
-
invoke(ctx, (
|
|
669
|
+
invoke(ctx, () => {
|
|
669
670
|
if (isFunction(obj)) {
|
|
670
671
|
return obj();
|
|
671
672
|
}
|
|
@@ -680,20 +681,20 @@
|
|
|
680
681
|
obj;
|
|
681
682
|
}
|
|
682
683
|
throw qError(2);
|
|
683
|
-
})
|
|
684
|
+
});
|
|
684
685
|
};
|
|
685
686
|
const cleanupFn = (target, handleError) => {
|
|
686
687
|
let cleanupFns = null;
|
|
687
688
|
return [ fn => {
|
|
688
|
-
"function" == typeof fn && (cleanupFns || (cleanupFns = [], target.$destroy$ = noSerialize((
|
|
689
|
-
target.$destroy$ = null, cleanupFns.forEach(
|
|
689
|
+
"function" == typeof fn && (cleanupFns || (cleanupFns = [], target.$destroy$ = noSerialize(() => {
|
|
690
|
+
target.$destroy$ = null, cleanupFns.forEach(fn => {
|
|
690
691
|
try {
|
|
691
692
|
fn();
|
|
692
693
|
} catch (err) {
|
|
693
694
|
handleError(err);
|
|
694
695
|
}
|
|
695
|
-
})
|
|
696
|
-
}))
|
|
696
|
+
});
|
|
697
|
+
})), cleanupFns.push(fn));
|
|
697
698
|
}, cleanupFns ?? [] ];
|
|
698
699
|
};
|
|
699
700
|
class AsyncComputedSignalImpl extends ComputedSignalImpl {
|
|
@@ -702,13 +703,13 @@
|
|
|
702
703
|
$loadingEffects$=null;
|
|
703
704
|
$errorEffects$=null;
|
|
704
705
|
$destroy$;
|
|
705
|
-
$promiseValue$=
|
|
706
|
+
$promiseValue$=NEEDS_COMPUTATION;
|
|
706
707
|
[_EFFECT_BACK_REF]=null;
|
|
707
708
|
constructor(container, fn, flags = 1) {
|
|
708
709
|
super(container, fn, flags);
|
|
709
710
|
}
|
|
710
711
|
get loading() {
|
|
711
|
-
return setupSignalValueAccess(this, (
|
|
712
|
+
return setupSignalValueAccess(this, () => this.$loadingEffects$ ||= new Set, () => this.untrackedLoading);
|
|
712
713
|
}
|
|
713
714
|
set untrackedLoading(value) {
|
|
714
715
|
value !== this.$untrackedLoading$ && (this.$untrackedLoading$ = value, this.$container$?.$scheduler$(7, null, this, this.$loadingEffects$));
|
|
@@ -717,7 +718,7 @@
|
|
|
717
718
|
return this.$untrackedLoading$;
|
|
718
719
|
}
|
|
719
720
|
get error() {
|
|
720
|
-
return setupSignalValueAccess(this, (
|
|
721
|
+
return setupSignalValueAccess(this, () => this.$errorEffects$ ||= new Set, () => this.untrackedError);
|
|
721
722
|
}
|
|
722
723
|
set untrackedError(value) {
|
|
723
724
|
value !== this.$untrackedError$ && (this.$untrackedError$ = value, this.$container$?.$scheduler$(7, null, this, this.$errorEffects$));
|
|
@@ -725,33 +726,38 @@
|
|
|
725
726
|
get untrackedError() {
|
|
726
727
|
return this.$untrackedError$;
|
|
727
728
|
}
|
|
729
|
+
invalidate() {
|
|
730
|
+
super.invalidate(), this.$promiseValue$ = NEEDS_COMPUTATION;
|
|
731
|
+
}
|
|
728
732
|
$computeIfNeeded$() {
|
|
729
733
|
if (!(1 & this.$flags$)) {
|
|
730
734
|
return !1;
|
|
731
735
|
}
|
|
732
736
|
const computeQrl = this.$computeQrl$;
|
|
733
737
|
throwIfQRLNotResolved(computeQrl);
|
|
734
|
-
const [cleanup] = cleanupFn(this,
|
|
735
|
-
const untrackedValue = this.$promiseValue$
|
|
738
|
+
const [cleanup] = cleanupFn(this, err => this.$container$?.handleError(err, null));
|
|
739
|
+
const untrackedValue = this.$promiseValue$ === NEEDS_COMPUTATION ? computeQrl.getFn()({
|
|
736
740
|
track: trackFn(this, this.$container$),
|
|
737
741
|
cleanup
|
|
738
|
-
})
|
|
742
|
+
}) : this.$promiseValue$;
|
|
739
743
|
if (isPromise(untrackedValue)) {
|
|
740
|
-
throw this.untrackedLoading = !0, this.untrackedError = null, untrackedValue.then(
|
|
744
|
+
throw this.untrackedLoading = !0, this.untrackedError = null, untrackedValue.then(promiseValue => {
|
|
741
745
|
this.$promiseValue$ = promiseValue, this.untrackedLoading = !1, this.untrackedError = null;
|
|
742
|
-
})
|
|
743
|
-
this.untrackedLoading = !1, this.untrackedError = err;
|
|
744
|
-
})
|
|
746
|
+
}).catch(err => {
|
|
747
|
+
this.$promiseValue$ = err, this.untrackedLoading = !1, this.untrackedError = err;
|
|
748
|
+
});
|
|
745
749
|
}
|
|
746
|
-
this.$promiseValue$ =
|
|
750
|
+
this.$promiseValue$ = NEEDS_COMPUTATION, this.$flags$ &= -2;
|
|
747
751
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
748
752
|
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
749
753
|
}
|
|
750
754
|
}
|
|
751
|
-
const createComputedSignal = qrl =>
|
|
752
|
-
const
|
|
755
|
+
const createComputedSignal = (qrl, options) => new ComputedSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "always"));
|
|
756
|
+
const createAsyncComputedSignal = (qrl, options) => new AsyncComputedSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "never"));
|
|
757
|
+
const createSerializerSignal = arg => new SerializerSignalImpl(null, arg);
|
|
753
758
|
const createSignal = value => new SignalImpl(null, value);
|
|
754
759
|
const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedSignal);
|
|
760
|
+
const createAsyncComputed$ = /*#__PURE__*/ implicit$FirstArg(createAsyncComputedSignal);
|
|
755
761
|
const createSerializer$ = implicit$FirstArg(createSerializerSignal);
|
|
756
762
|
const getValueProp = p0 => p0.value;
|
|
757
763
|
const getProp = (p0, p1) => p0[p1];
|
|
@@ -863,6 +869,7 @@
|
|
|
863
869
|
}
|
|
864
870
|
return classes.join(" ");
|
|
865
871
|
};
|
|
872
|
+
const fromCamelToKebabCaseWithDash = text => text.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
866
873
|
function serializeAttribute(key, value, styleScopedId) {
|
|
867
874
|
if (isClassAttr(key)) {
|
|
868
875
|
const serializedClass = serializeClass(value);
|
|
@@ -881,7 +888,7 @@
|
|
|
881
888
|
for (const key in obj) {
|
|
882
889
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
883
890
|
const value = obj[key];
|
|
884
|
-
null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(key
|
|
891
|
+
null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
|
|
885
892
|
}
|
|
886
893
|
}
|
|
887
894
|
return chunks.join(";");
|
|
@@ -958,14 +965,14 @@
|
|
|
958
965
|
const inlineComponent = componentQRL;
|
|
959
966
|
componentFn = () => invokeApply(iCtx, inlineComponent, [ props || EMPTY_OBJ ]);
|
|
960
967
|
}
|
|
961
|
-
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((
|
|
962
|
-
container.setHostProp(renderHost, ":onIdx", null),
|
|
963
|
-
|
|
968
|
+
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
969
|
+
container.setHostProp(renderHost, ":onIdx", null)), vnode_isVNode(renderHost) && clearAllEffects(container, renderHost),
|
|
970
|
+
componentFn(props)), jsx => {
|
|
964
971
|
const useOnEvents = container.getHostProp(renderHost, ":on");
|
|
965
972
|
return useOnEvents ? function(jsx, useOnEvents) {
|
|
966
973
|
const jsxElement = findFirstStringJSX(jsx);
|
|
967
974
|
let jsxResult = jsx;
|
|
968
|
-
return maybeThen(jsxElement,
|
|
975
|
+
return maybeThen(jsxElement, jsxElement => {
|
|
969
976
|
let isInvisibleComponent = !1;
|
|
970
977
|
jsxElement || (isInvisibleComponent = !0);
|
|
971
978
|
for (const key in useOnEvents) {
|
|
@@ -986,14 +993,17 @@
|
|
|
986
993
|
}
|
|
987
994
|
}
|
|
988
995
|
return jsxResult;
|
|
989
|
-
})
|
|
996
|
+
});
|
|
990
997
|
}(jsx, useOnEvents) : jsx;
|
|
991
|
-
}
|
|
998
|
+
}, err => {
|
|
992
999
|
if (isPromise(err) && retryCount < 100) {
|
|
993
|
-
return err.then((
|
|
1000
|
+
return err.then(() => executeComponentWithPromiseExceptionRetry(++retryCount));
|
|
1001
|
+
}
|
|
1002
|
+
if (retryCount >= 100) {
|
|
1003
|
+
throw new Error("Max retry count of component execution reached");
|
|
994
1004
|
}
|
|
995
1005
|
throw err;
|
|
996
|
-
})
|
|
1006
|
+
});
|
|
997
1007
|
return executeComponentWithPromiseExceptionRetry();
|
|
998
1008
|
};
|
|
999
1009
|
function addUseOnEvent(jsxElement, key, value) {
|
|
@@ -1016,10 +1026,10 @@
|
|
|
1016
1026
|
queue.push(...jsx);
|
|
1017
1027
|
} else {
|
|
1018
1028
|
if (isPromise(jsx)) {
|
|
1019
|
-
return maybeThen(jsx,
|
|
1029
|
+
return maybeThen(jsx, jsx => findFirstStringJSX(jsx));
|
|
1020
1030
|
}
|
|
1021
1031
|
if (isSignal(jsx)) {
|
|
1022
|
-
return findFirstStringJSX(untrack((
|
|
1032
|
+
return findFirstStringJSX(untrack(() => jsx.value));
|
|
1023
1033
|
}
|
|
1024
1034
|
}
|
|
1025
1035
|
}
|
|
@@ -1056,7 +1066,12 @@
|
|
|
1056
1066
|
const value = stack.pop();
|
|
1057
1067
|
if (value instanceof ParentComponentData) {
|
|
1058
1068
|
options.currentStyleScoped = value.$scopedStyle$, options.parentComponentFrame = value.$componentFrame$;
|
|
1059
|
-
} else
|
|
1069
|
+
} else {
|
|
1070
|
+
if (value === MaybeAsyncSignal) {
|
|
1071
|
+
const trackFn = stack.pop();
|
|
1072
|
+
await retryOnPromise(() => stack.push(trackFn()));
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1060
1075
|
if ("function" != typeof value) {
|
|
1061
1076
|
processJSXNode(ssr, enqueue, value, {
|
|
1062
1077
|
styleScoped: options.currentStyleScoped,
|
|
@@ -1069,9 +1084,6 @@
|
|
|
1069
1084
|
}
|
|
1070
1085
|
await value.apply(ssr);
|
|
1071
1086
|
}
|
|
1072
|
-
} else {
|
|
1073
|
-
const trackFn = stack.pop();
|
|
1074
|
-
await retryOnPromise((() => stack.push(trackFn())));
|
|
1075
1087
|
}
|
|
1076
1088
|
}
|
|
1077
1089
|
})();
|
|
@@ -1093,22 +1105,22 @@
|
|
|
1093
1105
|
} else if (isSignal(value)) {
|
|
1094
1106
|
ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "S" ] : EMPTY_ARRAY);
|
|
1095
1107
|
const signalNode = ssr.getOrCreateLastNode();
|
|
1096
|
-
enqueue(ssr.closeFragment), enqueue((
|
|
1108
|
+
enqueue(ssr.closeFragment), enqueue(() => trackSignalAndAssignHost(value, signalNode, ".", ssr)),
|
|
1097
1109
|
enqueue(MaybeAsyncSignal);
|
|
1098
1110
|
} else if (isPromise(value)) {
|
|
1099
1111
|
ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "A" ] : EMPTY_ARRAY), enqueue(ssr.closeFragment),
|
|
1100
|
-
enqueue(value), enqueue(Promise), enqueue((
|
|
1112
|
+
enqueue(value), enqueue(Promise), enqueue(() => ssr.commentNode("qkssr-f"));
|
|
1101
1113
|
} else if (function(value) {
|
|
1102
1114
|
return !!value[Symbol.asyncIterator];
|
|
1103
1115
|
}(value)) {
|
|
1104
|
-
enqueue(
|
|
1116
|
+
enqueue(async () => {
|
|
1105
1117
|
for await (const chunk of value) {
|
|
1106
1118
|
await _walkJSX(ssr, chunk, {
|
|
1107
1119
|
currentStyleScoped: options.styleScoped,
|
|
1108
1120
|
parentComponentFrame: options.parentComponentFrame
|
|
1109
1121
|
}), ssr.commentNode("qkssr-f");
|
|
1110
1122
|
}
|
|
1111
|
-
})
|
|
1123
|
+
});
|
|
1112
1124
|
} else {
|
|
1113
1125
|
const jsx = value;
|
|
1114
1126
|
const type = jsx.type;
|
|
@@ -1229,10 +1241,10 @@
|
|
|
1229
1241
|
}
|
|
1230
1242
|
const eventValue = setEvent(serializationCtx, key, value);
|
|
1231
1243
|
eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
|
|
1232
|
-
|
|
1233
|
-
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
|
|
1234
|
-
value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
|
|
1244
|
+
continue;
|
|
1235
1245
|
}
|
|
1246
|
+
isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
|
|
1247
|
+
value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
|
|
1236
1248
|
}
|
|
1237
1249
|
return null != key && ssrAttrs.push("q:key", key), ssrAttrs;
|
|
1238
1250
|
}
|
|
@@ -1290,25 +1302,25 @@
|
|
|
1290
1302
|
const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
1291
1303
|
set(task);
|
|
1292
1304
|
const promise = iCtx.$container$.$scheduler$(3, task);
|
|
1293
|
-
isPromise(promise) && promise.catch((
|
|
1305
|
+
isPromise(promise) && promise.catch(() => {});
|
|
1294
1306
|
};
|
|
1295
1307
|
const runTask = (task, container, host) => {
|
|
1296
1308
|
task.$flags$ &= -9, cleanupTask(task);
|
|
1297
1309
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
|
|
1298
1310
|
iCtx.$container$ = container;
|
|
1299
|
-
const taskFn = task.$qrl$.getFn(iCtx, (
|
|
1311
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
|
|
1300
1312
|
const track = trackFn(task, container);
|
|
1301
|
-
const [cleanup] = cleanupFn(task,
|
|
1313
|
+
const [cleanup] = cleanupFn(task, reason => container.handleError(reason, host));
|
|
1302
1314
|
const taskApi = {
|
|
1303
1315
|
track,
|
|
1304
1316
|
cleanup
|
|
1305
1317
|
};
|
|
1306
|
-
return safeCall((
|
|
1318
|
+
return safeCall(() => taskFn(taskApi), cleanup, err => {
|
|
1307
1319
|
if (isPromise(err)) {
|
|
1308
|
-
return err.then((
|
|
1320
|
+
return err.then(() => runTask(task, container, host));
|
|
1309
1321
|
}
|
|
1310
1322
|
throw err;
|
|
1311
|
-
})
|
|
1323
|
+
});
|
|
1312
1324
|
};
|
|
1313
1325
|
const cleanupTask = task => {
|
|
1314
1326
|
const destroy = task.$destroy$;
|
|
@@ -1348,11 +1360,11 @@
|
|
|
1348
1360
|
};
|
|
1349
1361
|
const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
1350
1362
|
let sortedProps;
|
|
1351
|
-
return sortedProps = varProps ? Object.fromEntries(untrack((
|
|
1363
|
+
return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter(entry => {
|
|
1352
1364
|
const attr = entry[0];
|
|
1353
1365
|
return "children" === attr ? (children ??= entry[1], !1) : "key" === attr ? (key = entry[1],
|
|
1354
1366
|
!1) : !constProps || !(attr in constProps) || /^on[A-Z].*\$$/.test(attr);
|
|
1355
|
-
})
|
|
1367
|
+
}).sort(([a], [b]) => a < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {},
|
|
1356
1368
|
constProps && "children" in constProps && (children = constProps.children, constProps.children = void 0),
|
|
1357
1369
|
_jsxSorted(type, sortedProps, constProps, children, flags, key, dev);
|
|
1358
1370
|
};
|
|
@@ -1472,7 +1484,7 @@
|
|
|
1472
1484
|
};
|
|
1473
1485
|
const mapArray_set = (array, key, value, start) => {
|
|
1474
1486
|
const indx = mapApp_findIndx(array, key, start);
|
|
1475
|
-
indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(
|
|
1487
|
+
indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(-1 ^ indx, 0, key, value);
|
|
1476
1488
|
};
|
|
1477
1489
|
const mapArray_get = (array, key, start) => {
|
|
1478
1490
|
const indx = mapApp_findIndx(array, key, start);
|
|
@@ -1620,7 +1632,7 @@
|
|
|
1620
1632
|
const jsxNode = asyncQueue.shift();
|
|
1621
1633
|
const vHostNode = asyncQueue.shift();
|
|
1622
1634
|
if (isPromise(jsxNode)) {
|
|
1623
|
-
return jsxNode.then(
|
|
1635
|
+
return jsxNode.then(jsxNode => (diff(jsxNode, vHostNode), drainAsyncQueue()));
|
|
1624
1636
|
}
|
|
1625
1637
|
diff(jsxNode, vHostNode);
|
|
1626
1638
|
}
|
|
@@ -1707,7 +1719,7 @@
|
|
|
1707
1719
|
}
|
|
1708
1720
|
function expectProjection() {
|
|
1709
1721
|
const slotName = jsxValue.key;
|
|
1710
|
-
vCurrent = vnode_getProp(vParent, slotName,
|
|
1722
|
+
vCurrent = vnode_getProp(vParent, slotName, id => vnode_locate(container.rootVNode, id)),
|
|
1711
1723
|
vCurrent = vCurrent && 32 & vCurrent[0] ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(),
|
|
1712
1724
|
build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P"), build.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection"),
|
|
1713
1725
|
vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent),
|
|
@@ -1773,43 +1785,43 @@
|
|
|
1773
1785
|
htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
|
|
1774
1786
|
}
|
|
1775
1787
|
needsQDispatchEventPatch = !0;
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
value.value = element;
|
|
1780
|
-
continue;
|
|
1781
|
-
}
|
|
1782
|
-
if ("function" == typeof value) {
|
|
1783
|
-
value(element);
|
|
1784
|
-
continue;
|
|
1785
|
-
}
|
|
1786
|
-
if (null == value) {
|
|
1787
|
-
continue;
|
|
1788
|
-
}
|
|
1789
|
-
throw qError(15, [ currentFile ]);
|
|
1790
|
-
}
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1790
|
+
if ("ref" === key) {
|
|
1791
1791
|
if (isSignal(value)) {
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
$isConst$: !0
|
|
1795
|
-
});
|
|
1796
|
-
value = trackSignalAndAssignHost(value, vNewNode, key, container, signalData);
|
|
1792
|
+
value.value = element;
|
|
1793
|
+
continue;
|
|
1797
1794
|
}
|
|
1798
|
-
if ("
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1795
|
+
if ("function" == typeof value) {
|
|
1796
|
+
value(element);
|
|
1797
|
+
continue;
|
|
1798
|
+
}
|
|
1799
|
+
if (null == value) {
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
1802
|
+
throw qError(15, [ currentFile ]);
|
|
1803
|
+
}
|
|
1804
|
+
if (isSignal(value)) {
|
|
1805
|
+
const signalData = new SubscriptionData({
|
|
1806
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
1807
|
+
$isConst$: !0
|
|
1808
|
+
});
|
|
1809
|
+
value = trackSignalAndAssignHost(value, vNewNode, key, container, signalData);
|
|
1810
|
+
}
|
|
1811
|
+
if ("dangerouslySetInnerHTML" !== key) {
|
|
1812
|
+
if ("textarea" !== elementName || "value" !== key) {
|
|
1813
|
+
value = serializeAttribute(key, value, scopedStyleIdPrefix), null != value && element.setAttribute(key, String(value));
|
|
1814
|
+
} else {
|
|
1815
|
+
if (value && "string" != typeof value) {
|
|
1816
|
+
if (build.isDev) {
|
|
1817
|
+
throw qError(23, [ currentFile, value ]);
|
|
1807
1818
|
}
|
|
1808
|
-
|
|
1819
|
+
continue;
|
|
1809
1820
|
}
|
|
1810
|
-
|
|
1811
|
-
element.innerHTML = value, element.setAttribute("q:container", "html");
|
|
1821
|
+
element.value = escapeHTML(value || "");
|
|
1812
1822
|
}
|
|
1823
|
+
} else {
|
|
1824
|
+
element.innerHTML = value, element.setAttribute("q:container", "html");
|
|
1813
1825
|
}
|
|
1814
1826
|
}
|
|
1815
1827
|
}
|
|
@@ -1906,12 +1918,12 @@
|
|
|
1906
1918
|
const eventProp = ":" + scope.substring(1) + ":" + eventName;
|
|
1907
1919
|
const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
|
|
1908
1920
|
let returnValue = !1;
|
|
1909
|
-
return qrls.flat(2).forEach(
|
|
1921
|
+
return qrls.flat(2).forEach(qrl => {
|
|
1910
1922
|
if (qrl) {
|
|
1911
1923
|
const value = container.$scheduler$(2, vNode, qrl, [ event, element ]);
|
|
1912
1924
|
returnValue = returnValue || !0 === value;
|
|
1913
1925
|
}
|
|
1914
|
-
})
|
|
1926
|
+
}), returnValue;
|
|
1915
1927
|
}));
|
|
1916
1928
|
}
|
|
1917
1929
|
function registerQwikLoaderEvent(eventName) {
|
|
@@ -1963,8 +1975,8 @@
|
|
|
1963
1975
|
host = vNewNode, shouldRender = !0) : (vNewNode = retrieveChildWithKey(null, lookupKey),
|
|
1964
1976
|
vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : (insertNewComponent(host, componentQRL, jsxProps),
|
|
1965
1977
|
shouldRender = !0), host = vNewNode), host) {
|
|
1966
|
-
|
|
1967
|
-
|
|
1978
|
+
let vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
|
|
1979
|
+
const propsAreDifferent = function(src, dst) {
|
|
1968
1980
|
const srcEmpty = isPropsEmpty(src);
|
|
1969
1981
|
const dstEmpty = isPropsEmpty(dst);
|
|
1970
1982
|
if (srcEmpty && dstEmpty) {
|
|
@@ -1987,7 +1999,11 @@
|
|
|
1987
1999
|
}
|
|
1988
2000
|
}
|
|
1989
2001
|
return !1;
|
|
1990
|
-
}(jsxProps, vNodeProps)
|
|
2002
|
+
}(jsxProps, vNodeProps);
|
|
2003
|
+
shouldRender = shouldRender || propsAreDifferent, shouldRender && (propsAreDifferent && (vNodeProps ? (vNodeProps[_CONST_PROPS] = jsxProps[_CONST_PROPS],
|
|
2004
|
+
vNodeProps[_VAR_PROPS] = jsxProps[_VAR_PROPS]) : jsxProps && (vnode_setProp(host, "q:props", jsxProps),
|
|
2005
|
+
vNodeProps = jsxProps)), vnode_setProp(host, "q:renderFn", componentQRL), host[0] &= -33,
|
|
2006
|
+
container.$scheduler$(6, host, componentQRL, vNodeProps));
|
|
1991
2007
|
}
|
|
1992
2008
|
!function(children, host) {
|
|
1993
2009
|
const projectionChildren = Array.isArray(children) ? children : [ children ];
|
|
@@ -2195,11 +2211,11 @@
|
|
|
2195
2211
|
task.$flags$ &= -9, cleanupTask(task);
|
|
2196
2212
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
|
|
2197
2213
|
iCtx.$container$ = container;
|
|
2198
|
-
const taskFn = task.$qrl$.getFn(iCtx, (
|
|
2214
|
+
const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
|
|
2199
2215
|
const resource = task.$state$;
|
|
2200
2216
|
assertDefined();
|
|
2201
2217
|
const track = trackFn(task, container);
|
|
2202
|
-
const [cleanup, cleanups] = cleanupFn(task,
|
|
2218
|
+
const [cleanup, cleanups] = cleanupFn(task, reason => container.handleError(reason, host));
|
|
2203
2219
|
const resourceTarget = unwrapStore(resource);
|
|
2204
2220
|
const opts = {
|
|
2205
2221
|
track,
|
|
@@ -2217,38 +2233,38 @@
|
|
|
2217
2233
|
resource.loading = !1, resource._state = "resolved", resource._resolved = value,
|
|
2218
2234
|
resource._error = void 0, resolve(value)) : (done = !0, resource.loading = !1, resource._state = "rejected",
|
|
2219
2235
|
resource._error = value, reject(value)), !0);
|
|
2220
|
-
cleanups.push((
|
|
2221
|
-
if (!0 === untrack((
|
|
2222
|
-
const value = untrack((
|
|
2236
|
+
cleanups.push(() => {
|
|
2237
|
+
if (!0 === untrack(() => resource.loading)) {
|
|
2238
|
+
const value = untrack(() => resource._resolved);
|
|
2223
2239
|
setState(!0, value);
|
|
2224
2240
|
}
|
|
2225
|
-
})
|
|
2241
|
+
}), invoke(iCtx, () => {
|
|
2226
2242
|
resource._state = "pending", resource.loading = !isServerPlatform();
|
|
2227
|
-
(resource.value = new Promise((
|
|
2243
|
+
(resource.value = new Promise((r, re) => {
|
|
2228
2244
|
resolve = r, reject = re;
|
|
2229
|
-
}))
|
|
2230
|
-
})
|
|
2231
|
-
const promise = safeCall((
|
|
2245
|
+
})).catch(ignoreErrorToPreventNodeFromCrashing);
|
|
2246
|
+
});
|
|
2247
|
+
const promise = safeCall(() => Promise.resolve(taskFn(opts)), value => {
|
|
2232
2248
|
setState(!0, value);
|
|
2233
|
-
}
|
|
2249
|
+
}, err => {
|
|
2234
2250
|
if (isPromise(err)) {
|
|
2235
|
-
return err.then((
|
|
2251
|
+
return err.then(() => runResource(task, container, host));
|
|
2236
2252
|
}
|
|
2237
2253
|
setState(!1, err);
|
|
2238
|
-
})
|
|
2254
|
+
});
|
|
2239
2255
|
const timeout = resourceTarget._timeout;
|
|
2240
|
-
return timeout > 0 ? Promise.race([ promise, delay(timeout).then((
|
|
2256
|
+
return timeout > 0 ? Promise.race([ promise, delay(timeout).then(() => {
|
|
2241
2257
|
setState(!1, new Error("timeout")) && cleanupTask(task);
|
|
2242
|
-
})
|
|
2258
|
+
}) ]) : promise;
|
|
2243
2259
|
};
|
|
2244
2260
|
const ignoreErrorToPreventNodeFromCrashing = () => {};
|
|
2245
2261
|
const aVNodePath = [];
|
|
2246
2262
|
const bVNodePath = [];
|
|
2247
2263
|
const aSsrNodePath = [];
|
|
2248
2264
|
const bSsrNodePath = [];
|
|
2249
|
-
const getPromise = chore => chore.$promise$ ||= new Promise(
|
|
2265
|
+
const getPromise = chore => chore.$promise$ ||= new Promise(resolve => {
|
|
2250
2266
|
chore.$resolve$ = resolve;
|
|
2251
|
-
})
|
|
2267
|
+
});
|
|
2252
2268
|
const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
2253
2269
|
const choreQueue = [];
|
|
2254
2270
|
const qrlRuns = [];
|
|
@@ -2297,11 +2313,11 @@
|
|
|
2297
2313
|
return sortedArray.splice(~idx, 0, value), value;
|
|
2298
2314
|
}
|
|
2299
2315
|
const existing = sortedArray[idx];
|
|
2300
|
-
|
|
2316
|
+
existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$);
|
|
2301
2317
|
existing.$executed$ && (existing.$executed$ = !1);
|
|
2302
2318
|
return existing;
|
|
2303
2319
|
}(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
|
|
2304
|
-
schedule(16), scheduleDrain()?.catch?.((
|
|
2320
|
+
schedule(16), scheduleDrain()?.catch?.(() => {}));
|
|
2305
2321
|
return runLater ? getPromise(chore) : drainUpTo(chore, isServer);
|
|
2306
2322
|
};
|
|
2307
2323
|
function drainUpTo(runUptoChore, isServer) {
|
|
@@ -2311,9 +2327,9 @@
|
|
|
2311
2327
|
throw new Error("drainUpTo: max retries reached");
|
|
2312
2328
|
}
|
|
2313
2329
|
if (currentChore) {
|
|
2314
|
-
return getPromise(currentChore).then((
|
|
2330
|
+
return getPromise(currentChore).then(() => drainUpTo(runUptoChore, isServer)).catch(e => {
|
|
2315
2331
|
container.handleError(e, currentChore?.$host$);
|
|
2316
|
-
})
|
|
2332
|
+
});
|
|
2317
2333
|
}
|
|
2318
2334
|
const nextChore = choreQueue[0];
|
|
2319
2335
|
if (nextChore.$executed$) {
|
|
@@ -2321,10 +2337,9 @@
|
|
|
2321
2337
|
break;
|
|
2322
2338
|
}
|
|
2323
2339
|
} else {
|
|
2324
|
-
(
|
|
2340
|
+
vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer);
|
|
2325
2341
|
}
|
|
2326
2342
|
}
|
|
2327
|
-
var chore;
|
|
2328
2343
|
return runUptoChore.$returnValue$;
|
|
2329
2344
|
}
|
|
2330
2345
|
function executeChore(chore, isServer) {
|
|
@@ -2342,27 +2357,27 @@
|
|
|
2342
2357
|
break;
|
|
2343
2358
|
|
|
2344
2359
|
case 6:
|
|
2345
|
-
returnValue = safeCall((
|
|
2360
|
+
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
|
|
2346
2361
|
if (isServer) {
|
|
2347
2362
|
return jsx;
|
|
2348
2363
|
}
|
|
2349
2364
|
{
|
|
2350
2365
|
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
2351
|
-
return retryOnPromise((
|
|
2366
|
+
return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
|
|
2352
2367
|
}
|
|
2353
|
-
}
|
|
2368
|
+
}, err => container.handleError(err, host));
|
|
2354
2369
|
break;
|
|
2355
2370
|
|
|
2356
2371
|
case 2:
|
|
2357
2372
|
{
|
|
2358
2373
|
const fn = chore.$target$.getFn();
|
|
2359
|
-
const result = retryOnPromise((
|
|
2374
|
+
const result = retryOnPromise(() => fn(...chore.$payload$));
|
|
2360
2375
|
if (isPromise(result)) {
|
|
2361
|
-
const handled = result.finally((
|
|
2376
|
+
const handled = result.finally(() => {
|
|
2362
2377
|
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
2363
|
-
})
|
|
2378
|
+
}).catch(error => {
|
|
2364
2379
|
container.handleError(error, chore.$host$);
|
|
2365
|
-
})
|
|
2380
|
+
});
|
|
2366
2381
|
return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
|
|
2367
2382
|
currentChore = null, void (chore.$executed$ = !0);
|
|
2368
2383
|
}
|
|
@@ -2391,7 +2406,7 @@
|
|
|
2391
2406
|
{
|
|
2392
2407
|
const parentVirtualNode = chore.$target$;
|
|
2393
2408
|
let jsx = chore.$payload$;
|
|
2394
|
-
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise((
|
|
2409
|
+
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx, parentVirtualNode, null));
|
|
2395
2410
|
}
|
|
2396
2411
|
break;
|
|
2397
2412
|
|
|
@@ -2424,18 +2439,19 @@
|
|
|
2424
2439
|
{
|
|
2425
2440
|
const target = chore.$target$;
|
|
2426
2441
|
const effects = chore.$payload$;
|
|
2427
|
-
|
|
2442
|
+
const ctx = newInvokeContext();
|
|
2443
|
+
if (ctx.$container$ = container, target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl) {
|
|
2428
2444
|
const forceRunEffects = target.$forceRunEffects$;
|
|
2429
|
-
if (target.$forceRunEffects$ = !1, !
|
|
2445
|
+
if (target.$forceRunEffects$ = !1, !effects?.size && !forceRunEffects) {
|
|
2430
2446
|
break;
|
|
2431
2447
|
}
|
|
2432
|
-
returnValue = retryOnPromise((() => {
|
|
2433
|
-
(
|
|
2434
|
-
|
|
2448
|
+
returnValue = maybeThen(retryOnPromise(() => invoke.call(target, ctx, target.$computeIfNeeded$)), didChange => {
|
|
2449
|
+
if (didChange || forceRunEffects) {
|
|
2450
|
+
return retryOnPromise(() => triggerEffects(container, target, effects));
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2435
2453
|
} else {
|
|
2436
|
-
returnValue = retryOnPromise((
|
|
2437
|
-
triggerEffects(container, target, effects);
|
|
2438
|
-
}));
|
|
2454
|
+
returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
|
|
2439
2455
|
}
|
|
2440
2456
|
}
|
|
2441
2457
|
}
|
|
@@ -2446,7 +2462,7 @@
|
|
|
2446
2462
|
currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
|
|
2447
2463
|
chore.$resolve$?.(value));
|
|
2448
2464
|
};
|
|
2449
|
-
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after,
|
|
2465
|
+
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, error => after(void 0, error)),
|
|
2450
2466
|
chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
|
|
2451
2467
|
}
|
|
2452
2468
|
function choreComparator(a, b, rootVNode) {
|
|
@@ -2465,10 +2481,10 @@
|
|
|
2465
2481
|
let aDepth = -1;
|
|
2466
2482
|
let bDepth = -1;
|
|
2467
2483
|
for (;a; ) {
|
|
2468
|
-
a = (aVNodePath[++aDepth] = a)[1] || rootVNode && vnode_getProp(a, "q:sparent",
|
|
2484
|
+
a = (aVNodePath[++aDepth] = a)[1] || rootVNode && vnode_getProp(a, "q:sparent", id => vnode_locate(rootVNode, id));
|
|
2469
2485
|
}
|
|
2470
2486
|
for (;b; ) {
|
|
2471
|
-
b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent",
|
|
2487
|
+
b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", id => vnode_locate(rootVNode, id));
|
|
2472
2488
|
}
|
|
2473
2489
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
2474
2490
|
if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
|
|
@@ -2484,7 +2500,7 @@
|
|
|
2484
2500
|
return -1;
|
|
2485
2501
|
}
|
|
2486
2502
|
} while (cursor);
|
|
2487
|
-
return rootVNode && vnode_getProp(b, "q:sparent",
|
|
2503
|
+
return rootVNode && vnode_getProp(b, "q:sparent", id => vnode_locate(rootVNode, id)) ? -1 : 1;
|
|
2488
2504
|
}
|
|
2489
2505
|
aDepth--, bDepth--;
|
|
2490
2506
|
}
|
|
@@ -2527,10 +2543,13 @@
|
|
|
2527
2543
|
return microTypeDiff;
|
|
2528
2544
|
}
|
|
2529
2545
|
const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
|
|
2530
|
-
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$
|
|
2546
|
+
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 : b === currentChore ? 1 : 0;
|
|
2531
2547
|
}
|
|
2532
2548
|
};
|
|
2533
2549
|
const toNumber = value => "number" == typeof value ? value : -1;
|
|
2550
|
+
function vNodeAlreadyDeleted(chore) {
|
|
2551
|
+
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
|
|
2552
|
+
}
|
|
2534
2553
|
class _SharedContainer {
|
|
2535
2554
|
$version$;
|
|
2536
2555
|
$scheduler$;
|
|
@@ -2590,7 +2609,7 @@
|
|
|
2590
2609
|
$styleIds$=null;
|
|
2591
2610
|
$renderCount$=0;
|
|
2592
2611
|
constructor(element) {
|
|
2593
|
-
if (super((
|
|
2612
|
+
if (super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale")),
|
|
2594
2613
|
this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
|
|
2595
2614
|
throw qError(25);
|
|
2596
2615
|
}
|
|
@@ -2614,14 +2633,14 @@
|
|
|
2614
2633
|
};
|
|
2615
2634
|
})(prototype, "nodeType");
|
|
2616
2635
|
const attachVnodeDataAndRefs = element => {
|
|
2617
|
-
Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach(
|
|
2636
|
+
Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach(script => {
|
|
2618
2637
|
script.setAttribute("type", "x-qwik/vnode");
|
|
2619
2638
|
const qContainerElement = script.closest("[q\\:container]");
|
|
2620
2639
|
qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = new Map;
|
|
2621
|
-
})
|
|
2640
|
+
}), element.querySelectorAll("[q\\:shadowroot]").forEach(parent => {
|
|
2622
2641
|
const shadowRoot = parent.shadowRoot;
|
|
2623
2642
|
shadowRoot && attachVnodeDataAndRefs(shadowRoot);
|
|
2624
|
-
})
|
|
2643
|
+
});
|
|
2625
2644
|
};
|
|
2626
2645
|
attachVnodeDataAndRefs(document);
|
|
2627
2646
|
const getFastNodeType = node => {
|
|
@@ -2821,22 +2840,22 @@
|
|
|
2821
2840
|
return vnode_getProp(vNode, name, getObjectById);
|
|
2822
2841
|
}
|
|
2823
2842
|
scheduleRender() {
|
|
2824
|
-
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick((
|
|
2825
|
-
this.renderDone.finally((
|
|
2843
|
+
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick(() => this.processChores()),
|
|
2844
|
+
this.renderDone.finally(() => emitEvent("qrender", {
|
|
2826
2845
|
instanceHash: this.$instanceHash$,
|
|
2827
2846
|
renderCount: this.$renderCount$
|
|
2828
|
-
}))
|
|
2847
|
+
}));
|
|
2829
2848
|
}
|
|
2830
2849
|
processChores() {
|
|
2831
2850
|
let renderCount = this.$renderCount$;
|
|
2832
2851
|
const result = this.$scheduler$(255);
|
|
2833
2852
|
if (isPromise(result)) {
|
|
2834
|
-
return result.then(
|
|
2853
|
+
return result.then(async () => {
|
|
2835
2854
|
for (;renderCount !== this.$renderCount$; ) {
|
|
2836
2855
|
renderCount = this.$renderCount$, await this.$scheduler$(255);
|
|
2837
2856
|
}
|
|
2838
2857
|
this.renderDone = null;
|
|
2839
|
-
})
|
|
2858
|
+
});
|
|
2840
2859
|
}
|
|
2841
2860
|
renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
|
|
2842
2861
|
}
|
|
@@ -2867,9 +2886,9 @@
|
|
|
2867
2886
|
return Array.from(scopedStyleIds).join(" ");
|
|
2868
2887
|
}(scopedStyleIds));
|
|
2869
2888
|
}
|
|
2870
|
-
if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll("style[q\\:style]").forEach(
|
|
2889
|
+
if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll("style[q\\:style]").forEach(style => {
|
|
2871
2890
|
this.$styleIds$.add(style.getAttribute("q:style"));
|
|
2872
|
-
}))
|
|
2891
|
+
})), !this.$styleIds$.has(styleId)) {
|
|
2873
2892
|
this.$styleIds$.add(styleId);
|
|
2874
2893
|
const styleElement = this.document.createElement("style");
|
|
2875
2894
|
styleElement.setAttribute("q:style", styleId), styleElement.textContent = content,
|
|
@@ -2931,7 +2950,7 @@
|
|
|
2931
2950
|
1 & consumer.$flags$ && (choreType = 32), container.$scheduler$(choreType, consumer);
|
|
2932
2951
|
} else if (consumer instanceof SignalImpl) {
|
|
2933
2952
|
consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)),
|
|
2934
|
-
consumer
|
|
2953
|
+
consumer.invalidate();
|
|
2935
2954
|
} else if (":" === property) {
|
|
2936
2955
|
const host = consumer;
|
|
2937
2956
|
const qrl = container.getHostProp(host, "q:renderFn");
|
|
@@ -2958,6 +2977,18 @@
|
|
|
2958
2977
|
}
|
|
2959
2978
|
}
|
|
2960
2979
|
};
|
|
2980
|
+
const getComputedSignalFlags = serializationStrategy => {
|
|
2981
|
+
let flags = 1;
|
|
2982
|
+
switch (serializationStrategy) {
|
|
2983
|
+
case "never":
|
|
2984
|
+
flags |= 8;
|
|
2985
|
+
break;
|
|
2986
|
+
|
|
2987
|
+
case "always":
|
|
2988
|
+
flags |= 16;
|
|
2989
|
+
}
|
|
2990
|
+
return flags;
|
|
2991
|
+
};
|
|
2961
2992
|
const stringifyPath = [];
|
|
2962
2993
|
function qwikDebugToString(value) {
|
|
2963
2994
|
if (null === value) {
|
|
@@ -3001,7 +3032,7 @@
|
|
|
3001
3032
|
}
|
|
3002
3033
|
return value;
|
|
3003
3034
|
}
|
|
3004
|
-
const pad = (text, prefix) => String(text).split("\n").map((
|
|
3035
|
+
const pad = (text, prefix) => String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
|
|
3005
3036
|
const jsxToString = value => {
|
|
3006
3037
|
if (isJSXNode(value)) {
|
|
3007
3038
|
let str = "<" + value.type;
|
|
@@ -3010,9 +3041,9 @@
|
|
|
3010
3041
|
str += " " + key + "=" + qwikDebugToString(val);
|
|
3011
3042
|
}
|
|
3012
3043
|
const children = value.children;
|
|
3013
|
-
null != children ? (str += ">", Array.isArray(children) ? children.forEach(
|
|
3044
|
+
null != children ? (str += ">", Array.isArray(children) ? children.forEach(child => {
|
|
3014
3045
|
str += jsxToString(child);
|
|
3015
|
-
})
|
|
3046
|
+
}) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
|
|
3016
3047
|
}
|
|
3017
3048
|
return str;
|
|
3018
3049
|
}
|
|
@@ -3502,16 +3533,13 @@
|
|
|
3502
3533
|
let textIdx = 0;
|
|
3503
3534
|
let combinedText = null;
|
|
3504
3535
|
let container = null;
|
|
3505
|
-
return processVNodeData(vData, (
|
|
3536
|
+
return processVNodeData(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
|
|
3506
3537
|
if (isNumber(peek())) {
|
|
3507
|
-
for (;!isElement(child); ) {
|
|
3538
|
+
for (;!isElement(child) || isQStyleElement(child); ) {
|
|
3508
3539
|
if (!(child = fastNextSibling(child))) {
|
|
3509
3540
|
throw qError(27, [ vData, peek(), nextToConsumeIdx ]);
|
|
3510
3541
|
}
|
|
3511
3542
|
}
|
|
3512
|
-
for (;isQStyleElement(child); ) {
|
|
3513
|
-
child = fastNextSibling(child);
|
|
3514
|
-
}
|
|
3515
3543
|
combinedText = null, previousTextNode = null;
|
|
3516
3544
|
let value = 0;
|
|
3517
3545
|
for (;isNumber(peek()); ) {
|
|
@@ -3531,7 +3559,9 @@
|
|
|
3531
3559
|
} else if (peek() === VNodeDataChar_PROPS) {
|
|
3532
3560
|
vnode_setAttr(null, vParent, "q:props", consumeValue());
|
|
3533
3561
|
} else if (peek() === VNodeDataChar_KEY) {
|
|
3534
|
-
|
|
3562
|
+
let value;
|
|
3563
|
+
getChar(nextToConsumeIdx + 1) === VNodeDataChar_SEPARATOR ? (consume(), value = decodeURI(consumeValue()),
|
|
3564
|
+
consume()) : value = consumeValue(), vnode_setAttr(null, vParent, "q:key", value);
|
|
3535
3565
|
} else if (peek() === VNodeDataChar_SEQ) {
|
|
3536
3566
|
vnode_setAttr(null, vParent, "q:seq", consumeValue());
|
|
3537
3567
|
} else if (peek() === VNodeDataChar_SEQ_IDX) {
|
|
@@ -3555,6 +3585,9 @@
|
|
|
3555
3585
|
} else if (peek() === VNodeDataChar_SLOT) {
|
|
3556
3586
|
vnode_setAttr(null, vParent, QSlot, consumeValue());
|
|
3557
3587
|
} else {
|
|
3588
|
+
for (;isQStyleElement(child); ) {
|
|
3589
|
+
child = fastNextSibling(child);
|
|
3590
|
+
}
|
|
3558
3591
|
const textNode = child && 3 === fastNodeType(child) ? child : null;
|
|
3559
3592
|
null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
|
|
3560
3593
|
let length = 0;
|
|
@@ -3570,7 +3603,7 @@
|
|
|
3570
3603
|
assertFalse(vnode_isVirtualVNode(vnode)), vnode;
|
|
3571
3604
|
})(previousTextNode, textNode, text)), textIdx += length;
|
|
3572
3605
|
}
|
|
3573
|
-
})
|
|
3606
|
+
}), vParent[5] = vLast, vFirst;
|
|
3574
3607
|
}(vNode, vNodeData, element, firstChild);
|
|
3575
3608
|
}
|
|
3576
3609
|
return materializeFromDOM(vNode, firstChild);
|
|
@@ -3679,7 +3712,7 @@
|
|
|
3679
3712
|
}
|
|
3680
3713
|
if (vParent[5] = vChild || null, vParent[4] = vFirstChild, vData) {
|
|
3681
3714
|
let container = null;
|
|
3682
|
-
processVNodeData(vData, (
|
|
3715
|
+
processVNodeData(vData, (peek, consumeValue) => {
|
|
3683
3716
|
if (peek() === VNodeDataChar_ID) {
|
|
3684
3717
|
container || (container = getDomContainer(vParent[6]));
|
|
3685
3718
|
const id = consumeValue();
|
|
@@ -3688,7 +3721,7 @@
|
|
|
3688
3721
|
peek() === VNodeDataChar_BACK_REFS ? (container || (container = getDomContainer(vParent[6])),
|
|
3689
3722
|
setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
|
|
3690
3723
|
}
|
|
3691
|
-
})
|
|
3724
|
+
});
|
|
3692
3725
|
}
|
|
3693
3726
|
return vFirstChild;
|
|
3694
3727
|
};
|
|
@@ -3710,7 +3743,8 @@
|
|
|
3710
3743
|
let nextToConsumeIdx = 0;
|
|
3711
3744
|
let ch = 0;
|
|
3712
3745
|
let peekCh = 0;
|
|
3713
|
-
const
|
|
3746
|
+
const getChar = idx => idx < vData.length ? vData.charCodeAt(idx) : 0;
|
|
3747
|
+
const peek = () => 0 !== peekCh ? peekCh : peekCh = getChar(nextToConsumeIdx);
|
|
3714
3748
|
const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
|
|
3715
3749
|
const consumeValue = () => {
|
|
3716
3750
|
consume();
|
|
@@ -3721,7 +3755,7 @@
|
|
|
3721
3755
|
return vData.substring(start, nextToConsumeIdx);
|
|
3722
3756
|
};
|
|
3723
3757
|
for (;0 !== peek(); ) {
|
|
3724
|
-
callback(peek, consumeValue, consume, nextToConsumeIdx);
|
|
3758
|
+
callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
|
|
3725
3759
|
}
|
|
3726
3760
|
};
|
|
3727
3761
|
const vnode_getNextSibling = vnode => vnode[3];
|
|
@@ -3750,7 +3784,7 @@
|
|
|
3750
3784
|
journal && journal.push(2, vnode[6], key, value);
|
|
3751
3785
|
}
|
|
3752
3786
|
null == value ? props.splice(idx, 2) : props[idx + 1] = value;
|
|
3753
|
-
} else if (null != value && (props.splice(
|
|
3787
|
+
} else if (null != value && (props.splice(-1 ^ idx, 0, key, value), 1 & type)) {
|
|
3754
3788
|
journal && journal.push(2, vnode[6], key, value);
|
|
3755
3789
|
}
|
|
3756
3790
|
}
|
|
@@ -3781,7 +3815,7 @@
|
|
|
3781
3815
|
ensureElementOrVirtualVNode(vnode);
|
|
3782
3816
|
const props = vnode_getProps(vnode);
|
|
3783
3817
|
const idx = mapApp_findIndx(props, key, 0);
|
|
3784
|
-
idx >= 0 ? props[idx + 1] = value : null != value && props.splice(
|
|
3818
|
+
idx >= 0 ? props[idx + 1] = value : null != value && props.splice(-1 ^ idx, 0, key, value);
|
|
3785
3819
|
};
|
|
3786
3820
|
const vnode_getProps = vnode => vnode[(vnode => {
|
|
3787
3821
|
const type = 7 & vnode[0];
|
|
@@ -3813,12 +3847,12 @@
|
|
|
3813
3847
|
strings.push(qwikDebugToString(vnode_getText(vnode)));
|
|
3814
3848
|
} else if (vnode_isVirtualVNode(vnode)) {
|
|
3815
3849
|
const attrs = [ "[" + String(vnode[0] >>> 8) + "]" ];
|
|
3816
|
-
vnode_getAttrKeys(vnode).forEach(
|
|
3850
|
+
vnode_getAttrKeys(vnode).forEach(key => {
|
|
3817
3851
|
if (key !== DEBUG_TYPE) {
|
|
3818
3852
|
const value = vnode_getAttr(vnode, key);
|
|
3819
3853
|
attrs.push(" " + key + "=" + qwikDebugToString(value));
|
|
3820
3854
|
}
|
|
3821
|
-
})
|
|
3855
|
+
});
|
|
3822
3856
|
const name = (colorize ? "[34m" : "") + (VirtualTypeName[vnode_getAttr(vnode, DEBUG_TYPE) || "V"] || VirtualTypeName.V) + (colorize ? "[0m" : "");
|
|
3823
3857
|
strings.push("<" + name + attrs.join("") + ">");
|
|
3824
3858
|
const child = vnode_getFirstChild(vnode);
|
|
@@ -3828,10 +3862,10 @@
|
|
|
3828
3862
|
const tag = vnode_getElementName(vnode);
|
|
3829
3863
|
const attrs = [];
|
|
3830
3864
|
const keys = vnode_getAttrKeys(vnode);
|
|
3831
|
-
keys.forEach(
|
|
3865
|
+
keys.forEach(key => {
|
|
3832
3866
|
const value = vnode_getAttr(vnode, key);
|
|
3833
3867
|
attrs.push(" " + key + "=" + qwikDebugToString(value));
|
|
3834
|
-
})
|
|
3868
|
+
});
|
|
3835
3869
|
const node = vnode_getNode(vnode);
|
|
3836
3870
|
if (node) {
|
|
3837
3871
|
const vnodeData = node.ownerDocument.qVNodeData?.get(node);
|
|
@@ -3875,7 +3909,7 @@
|
|
|
3875
3909
|
let projectionDepth = 1;
|
|
3876
3910
|
for (;projectionDepth--; ) {
|
|
3877
3911
|
for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
|
|
3878
|
-
const qSlotParent = vnode_getProp(vHost, "q:sparent",
|
|
3912
|
+
const qSlotParent = vnode_getProp(vHost, "q:sparent", id => vnode_locate(rootVNode, id));
|
|
3879
3913
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
3880
3914
|
vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
|
|
3881
3915
|
}
|
|
@@ -3900,7 +3934,7 @@
|
|
|
3900
3934
|
const deserializedProxyMap = new WeakMap;
|
|
3901
3935
|
const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
|
|
3902
3936
|
const wrapDeserializerProxy = (container, data) => {
|
|
3903
|
-
if (!Array.isArray(data) || vnode_isVNode(data) ||
|
|
3937
|
+
if (!Array.isArray(data) || vnode_isVNode(data) || isObject(value = data) && SERIALIZER_PROXY_UNWRAP in value) {
|
|
3904
3938
|
return data;
|
|
3905
3939
|
}
|
|
3906
3940
|
var value;
|
|
@@ -4048,7 +4082,7 @@
|
|
|
4048
4082
|
asyncComputed.$computeQrl$ = d[0], asyncComputed.$effects$ = new Set(d[1]), asyncComputed.$loadingEffects$ = new Set(d[2]),
|
|
4049
4083
|
asyncComputed.$errorEffects$ = new Set(d[3]), asyncComputed.$untrackedLoading$ = d[4],
|
|
4050
4084
|
asyncComputed.$untrackedError$ = d[5];
|
|
4051
|
-
d.length > 6
|
|
4085
|
+
d.length > 6 && (asyncComputed.$untrackedValue$ = d[6]), asyncComputed.$flags$ |= 1;
|
|
4052
4086
|
break;
|
|
4053
4087
|
}
|
|
4054
4088
|
|
|
@@ -4147,8 +4181,8 @@
|
|
|
4147
4181
|
}
|
|
4148
4182
|
return target;
|
|
4149
4183
|
};
|
|
4150
|
-
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ALL_PROPS, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
4151
|
-
const _constantNames = [ "undefined", "null", "true", "false", "''", "EMPTY_ARRAY", "EMPTY_OBJ", "NEEDS_COMPUTATION", "STORE_ALL_PROPS", "Slot", "Fragment", "NaN", "Infinity", "-Infinity", "MAX_SAFE_INTEGER", "MAX_SAFE_INTEGER-1", "MIN_SAFE_INTEGER" ];
|
|
4184
|
+
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ALL_PROPS, _UNINITIALIZED, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
4185
|
+
const _constantNames = [ "undefined", "null", "true", "false", "''", "EMPTY_ARRAY", "EMPTY_OBJ", "NEEDS_COMPUTATION", "STORE_ALL_PROPS", "_UNINITIALIZED", "Slot", "Fragment", "NaN", "Infinity", "-Infinity", "MAX_SAFE_INTEGER", "MAX_SAFE_INTEGER-1", "MIN_SAFE_INTEGER" ];
|
|
4152
4186
|
const allocate = (container, typeId, value) => {
|
|
4153
4187
|
if (void 0 === value) {
|
|
4154
4188
|
return typeId;
|
|
@@ -4161,7 +4195,8 @@
|
|
|
4161
4195
|
if (!container.$forwardRefs$) {
|
|
4162
4196
|
throw qError(18, [ "forward ref" ]);
|
|
4163
4197
|
}
|
|
4164
|
-
|
|
4198
|
+
const rootRef = container.$forwardRefs$[value];
|
|
4199
|
+
return -1 === rootRef ? _UNINITIALIZED : container.$getObjectById$(rootRef);
|
|
4165
4200
|
|
|
4166
4201
|
case 2:
|
|
4167
4202
|
case 4:
|
|
@@ -4246,10 +4281,10 @@
|
|
|
4246
4281
|
case 16:
|
|
4247
4282
|
let resolve;
|
|
4248
4283
|
let reject;
|
|
4249
|
-
const promise = new Promise((
|
|
4284
|
+
const promise = new Promise((res, rej) => {
|
|
4250
4285
|
resolve = res, reject = rej;
|
|
4251
|
-
})
|
|
4252
|
-
return resolvers.set(promise, [ resolve, reject ]), promise.catch((
|
|
4286
|
+
});
|
|
4287
|
+
return resolvers.set(promise, [ resolve, reject ]), promise.catch(() => {}), promise;
|
|
4253
4288
|
|
|
4254
4289
|
case 19:
|
|
4255
4290
|
const encodedLength = value.length;
|
|
@@ -4285,7 +4320,7 @@
|
|
|
4285
4320
|
const captureEnd = qrl.indexOf("]", captureStart);
|
|
4286
4321
|
const chunk = qrl.slice(0, hashIdx > -1 ? hashIdx : captureStart);
|
|
4287
4322
|
const symbol = captureStart > -1 ? qrl.slice(hashIdx + 1, captureStart) : qrl.slice(hashIdx + 1);
|
|
4288
|
-
const captureIds = captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter(
|
|
4323
|
+
const captureIds = captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter(v => v.length).map(s => parseInt(s, 10)) : null;
|
|
4289
4324
|
let qrlRef = null;
|
|
4290
4325
|
if (chunk === QRL_RUNTIME_CHUNK) {
|
|
4291
4326
|
const backChannel = globalThis.__qrl_back_channel__;
|
|
@@ -4295,7 +4330,7 @@
|
|
|
4295
4330
|
}
|
|
4296
4331
|
function inflateQRL(container, qrl) {
|
|
4297
4332
|
const captureIds = qrl.$capture$;
|
|
4298
|
-
return qrl.$captureRef$ = captureIds ? captureIds.map(
|
|
4333
|
+
return qrl.$captureRef$ = captureIds ? captureIds.map(id => container.$getObjectById$(id)) : null,
|
|
4299
4334
|
container.element && qrl.$setContainer$(container.element), qrl;
|
|
4300
4335
|
}
|
|
4301
4336
|
let isDomRef = () => !1;
|
|
@@ -4308,12 +4343,12 @@
|
|
|
4308
4343
|
};
|
|
4309
4344
|
}
|
|
4310
4345
|
const seenObjsMap = new Map;
|
|
4311
|
-
const
|
|
4346
|
+
const objectPathStringCache = new Map;
|
|
4312
4347
|
const syncFnMap = new Map;
|
|
4313
4348
|
const syncFns = [];
|
|
4314
4349
|
const roots = [];
|
|
4315
4350
|
const $addRootPath$ = obj => {
|
|
4316
|
-
const rootPath =
|
|
4351
|
+
const rootPath = objectPathStringCache.get(obj);
|
|
4317
4352
|
if (rootPath) {
|
|
4318
4353
|
return rootPath;
|
|
4319
4354
|
}
|
|
@@ -4327,19 +4362,21 @@
|
|
|
4327
4362
|
current = seenObjsMap.get(current.$parent$);
|
|
4328
4363
|
}
|
|
4329
4364
|
const pathStr = path.length > 1 ? path.join(" ") : path.length ? path[0] : seen.$index$;
|
|
4330
|
-
return
|
|
4365
|
+
return objectPathStringCache.set(obj, pathStr), pathStr;
|
|
4331
4366
|
};
|
|
4332
4367
|
const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => !1;
|
|
4333
4368
|
return isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => !1,
|
|
4334
4369
|
{
|
|
4335
4370
|
async $serialize$() {
|
|
4336
4371
|
return await async function(serializationContext) {
|
|
4337
|
-
const {$writer$, $isSsrNode$, $isDomRef$, $storeProxyMap$, $addRoot$, $
|
|
4372
|
+
const {$writer$, $isSsrNode$, $isDomRef$, $storeProxyMap$, $addRoot$, $objectPathStringCache$, $wasSeen$} = serializationContext;
|
|
4338
4373
|
let depth = 0;
|
|
4374
|
+
let rootIdx = 0;
|
|
4339
4375
|
const forwardRefs = [];
|
|
4340
4376
|
let forwardRefsId = 0;
|
|
4341
4377
|
const promises = new Set;
|
|
4342
4378
|
const preloadQrls = new Set;
|
|
4379
|
+
const s11nWeakRefs = new Map;
|
|
4343
4380
|
let parent = null;
|
|
4344
4381
|
const isRootObject = () => 0 === depth;
|
|
4345
4382
|
const outputArray = (value, writeFn) => {
|
|
@@ -4362,29 +4399,41 @@
|
|
|
4362
4399
|
}
|
|
4363
4400
|
$writer$.write(0 === lastIdx ? s : s.slice(lastIdx));
|
|
4364
4401
|
} else {
|
|
4365
|
-
depth++, outputArray(value, (
|
|
4402
|
+
depth++, outputArray(value, (valueItem, idx) => {
|
|
4366
4403
|
!function(serializationContext, obj, parent, index) {
|
|
4367
4404
|
const {$wasSeen$, $seen$, $addRoot$} = serializationContext;
|
|
4368
4405
|
if (!function(obj) {
|
|
4369
|
-
return
|
|
4406
|
+
return isObject(obj) || "string" == typeof obj && obj.length > 1;
|
|
4370
4407
|
}(obj) && !frameworkType(obj)) {
|
|
4371
4408
|
return;
|
|
4372
4409
|
}
|
|
4373
4410
|
const seen = $wasSeen$(obj);
|
|
4374
4411
|
void 0 === seen ? $seen$(obj, parent, index) : $addRoot$(obj, parent);
|
|
4375
4412
|
}(serializationContext, valueItem, parent, idx), writeValue(valueItem);
|
|
4376
|
-
})
|
|
4413
|
+
}), depth--;
|
|
4377
4414
|
}
|
|
4378
4415
|
};
|
|
4379
4416
|
const addPreloadQrl = qrl => {
|
|
4380
|
-
preloadQrls.add(qrl), serializationContext.$addRoot$(qrl
|
|
4417
|
+
preloadQrls.add(qrl), serializationContext.$addRoot$(qrl);
|
|
4381
4418
|
};
|
|
4382
|
-
const
|
|
4419
|
+
const outputAsRootRef = (value, rootDepth = 0) => {
|
|
4383
4420
|
const seen = $wasSeen$(value);
|
|
4384
|
-
const rootRefPath = $
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4421
|
+
const rootRefPath = $objectPathStringCache$.get(value);
|
|
4422
|
+
if (rootDepth === depth && seen && null !== seen.$parent$ && rootRefPath) {
|
|
4423
|
+
return output(0, rootRefPath), !0;
|
|
4424
|
+
}
|
|
4425
|
+
if (depth > rootDepth && seen && -1 !== seen.$rootIndex$) {
|
|
4426
|
+
return output(0, seen.$rootIndex$), !0;
|
|
4427
|
+
}
|
|
4428
|
+
if (s11nWeakRefs.has(value)) {
|
|
4429
|
+
const forwardRefId = s11nWeakRefs.get(value);
|
|
4430
|
+
if (rootDepth !== depth) {
|
|
4431
|
+
const rootRef = $addRoot$(value);
|
|
4432
|
+
return output(0, rootRef), forwardRefs[forwardRefId] = rootRef, !0;
|
|
4433
|
+
}
|
|
4434
|
+
forwardRefs[forwardRefId] = rootIdx;
|
|
4435
|
+
}
|
|
4436
|
+
return !1;
|
|
4388
4437
|
};
|
|
4389
4438
|
const writeValue = value => {
|
|
4390
4439
|
if (fastSkipSerialize(value)) {
|
|
@@ -4395,11 +4444,11 @@
|
|
|
4395
4444
|
output(3, value ? 2 : 3);
|
|
4396
4445
|
} else if ("function" == typeof value) {
|
|
4397
4446
|
if (value === Slot) {
|
|
4398
|
-
output(3, 9);
|
|
4399
|
-
} else if (value === Fragment) {
|
|
4400
4447
|
output(3, 10);
|
|
4448
|
+
} else if (value === Fragment) {
|
|
4449
|
+
output(3, 11);
|
|
4401
4450
|
} else if (isQrl(value)) {
|
|
4402
|
-
if (!
|
|
4451
|
+
if (!outputAsRootRef(value)) {
|
|
4403
4452
|
const qrl = qrlToString(serializationContext, value);
|
|
4404
4453
|
const type = preloadQrls.has(value) ? 21 : 20;
|
|
4405
4454
|
if (isRootObject()) {
|
|
@@ -4419,7 +4468,7 @@
|
|
|
4419
4468
|
}
|
|
4420
4469
|
}
|
|
4421
4470
|
} else if ("number" == typeof value) {
|
|
4422
|
-
Number.isNaN(value) ? output(3,
|
|
4471
|
+
Number.isNaN(value) ? output(3, 12) : Number.isFinite(value) ? value === Number.MAX_SAFE_INTEGER ? output(3, 15) : value === Number.MAX_SAFE_INTEGER - 1 ? output(3, 16) : value === Number.MIN_SAFE_INTEGER ? output(3, 17) : output(4, value) : output(3, value < 0 ? 14 : 13);
|
|
4423
4472
|
} else if ("object" == typeof value) {
|
|
4424
4473
|
if (value === EMPTY_ARRAY) {
|
|
4425
4474
|
output(3, 5);
|
|
@@ -4433,21 +4482,23 @@
|
|
|
4433
4482
|
parent = value, writeObjectValue(value), parent = oldParent, depth--;
|
|
4434
4483
|
}
|
|
4435
4484
|
} else if ("string" == typeof value) {
|
|
4436
|
-
0 === value.length ? output(3, 4) :
|
|
4485
|
+
0 === value.length ? output(3, 4) : outputAsRootRef(value) || output(5, value);
|
|
4437
4486
|
} else if (void 0 === value) {
|
|
4438
4487
|
output(3, 0);
|
|
4439
4488
|
} else if (value === NEEDS_COMPUTATION) {
|
|
4440
4489
|
output(3, 7);
|
|
4490
|
+
} else if (value === STORE_ALL_PROPS) {
|
|
4491
|
+
output(3, 8);
|
|
4441
4492
|
} else {
|
|
4442
|
-
if (value !==
|
|
4493
|
+
if (value !== _UNINITIALIZED) {
|
|
4443
4494
|
throw qError(20, [ typeof value ]);
|
|
4444
4495
|
}
|
|
4445
|
-
output(3,
|
|
4496
|
+
output(3, 9);
|
|
4446
4497
|
}
|
|
4447
4498
|
};
|
|
4448
4499
|
const writeObjectValue = value => {
|
|
4449
4500
|
var obj;
|
|
4450
|
-
if (!
|
|
4501
|
+
if (!outputAsRootRef(value, 1)) {
|
|
4451
4502
|
if (isPropsProxy(value)) {
|
|
4452
4503
|
const varProps = value[_VAR_PROPS];
|
|
4453
4504
|
const constProps = value[_CONST_PROPS];
|
|
@@ -4460,7 +4511,7 @@
|
|
|
4460
4511
|
return "__brand" in value && "resource" === value.__brand;
|
|
4461
4512
|
}(value)) {
|
|
4462
4513
|
serializationContext.$resources$.add(value);
|
|
4463
|
-
const forwardRefId = $resolvePromise$(value.value, $addRoot$, (
|
|
4514
|
+
const forwardRefId = $resolvePromise$(value.value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(23, resolved, resolvedValue, getStoreHandler(value).$effects$));
|
|
4464
4515
|
output(1, forwardRefId);
|
|
4465
4516
|
} else {
|
|
4466
4517
|
const storeHandler = getStoreHandler(value);
|
|
@@ -4481,10 +4532,10 @@
|
|
|
4481
4532
|
}
|
|
4482
4533
|
output(Array.isArray(storeTarget) ? 31 : 30, out);
|
|
4483
4534
|
}
|
|
4484
|
-
} else if (
|
|
4535
|
+
} else if (isObject(obj = value) && "function" == typeof obj[SerializerSymbol]) {
|
|
4485
4536
|
const result = value[SerializerSymbol](value);
|
|
4486
4537
|
if (isPromise(result)) {
|
|
4487
|
-
const forwardRef = $resolvePromise$(result, $addRoot$, (
|
|
4538
|
+
const forwardRef = $resolvePromise$(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, null, null));
|
|
4488
4539
|
output(1, forwardRef);
|
|
4489
4540
|
} else {
|
|
4490
4541
|
depth--, writeValue(result), depth++;
|
|
@@ -4508,29 +4559,32 @@
|
|
|
4508
4559
|
if (value instanceof SerializerSignalImpl) {
|
|
4509
4560
|
addPreloadQrl(value.$computeQrl$);
|
|
4510
4561
|
const forwardRefId = $resolvePromise$(function(signal, value) {
|
|
4511
|
-
return new Promise(
|
|
4512
|
-
signal.$computeQrl$.resolve().then(
|
|
4562
|
+
return new Promise(resolve => {
|
|
4563
|
+
signal.$computeQrl$.resolve().then(arg => {
|
|
4513
4564
|
let data;
|
|
4514
4565
|
arg.serialize ? data = arg.serialize(value) : SerializerSymbol in value && (data = value[SerializerSymbol](value)),
|
|
4515
4566
|
void 0 === data && (data = NEEDS_COMPUTATION), resolve(data);
|
|
4516
|
-
})
|
|
4517
|
-
})
|
|
4518
|
-
}(value, value.$untrackedValue$), $addRoot$, (
|
|
4567
|
+
});
|
|
4568
|
+
});
|
|
4569
|
+
}(value, value.$untrackedValue$), $addRoot$, (resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
|
|
4519
4570
|
return void output(1, forwardRefId);
|
|
4520
4571
|
}
|
|
4521
|
-
const v = value instanceof ComputedSignalImpl && (1 & value.$flags$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
4522
4572
|
if (value instanceof WrappedSignalImpl) {
|
|
4523
4573
|
output(26, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
4524
|
-
} else if (value instanceof AsyncComputedSignalImpl) {
|
|
4525
|
-
addPreloadQrl(value.$computeQrl$);
|
|
4526
|
-
const out = [ value.$computeQrl$, value.$effects$, value.$loadingEffects$, value.$errorEffects$, value.$untrackedLoading$, value.$untrackedError$ ];
|
|
4527
|
-
v !== NEEDS_COMPUTATION && out.push(v), output(28, out);
|
|
4528
4574
|
} else if (value instanceof ComputedSignalImpl) {
|
|
4575
|
+
let v = value.$untrackedValue$;
|
|
4576
|
+
const shouldAlwaysSerialize = 16 & value.$flags$;
|
|
4577
|
+
const shouldNeverSerialize = 8 & value.$flags$;
|
|
4578
|
+
const isInvalid = 1 & value.$flags$;
|
|
4579
|
+
const isSkippable = fastSkipSerialize(value.$untrackedValue$);
|
|
4580
|
+
shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION),
|
|
4529
4581
|
addPreloadQrl(value.$computeQrl$);
|
|
4530
4582
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
4531
|
-
|
|
4583
|
+
const isAsync = value instanceof AsyncComputedSignalImpl;
|
|
4584
|
+
isAsync && out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedLoading$, value.$untrackedError$),
|
|
4585
|
+
v !== NEEDS_COMPUTATION && out.push(v), output(isAsync ? 28 : 27, out);
|
|
4532
4586
|
} else {
|
|
4533
|
-
output(25, [
|
|
4587
|
+
output(25, [ value.$untrackedValue$, ...value.$effects$ || [] ]);
|
|
4534
4588
|
}
|
|
4535
4589
|
} else if (value instanceof URL) {
|
|
4536
4590
|
output(7, value.href);
|
|
@@ -4545,14 +4599,14 @@
|
|
|
4545
4599
|
const rootIndex = $addRoot$(value);
|
|
4546
4600
|
serializationContext.$setProp$(value, "q:id", String(rootIndex)), output(10, value.id);
|
|
4547
4601
|
const vNodeData = value.vnodeData;
|
|
4548
|
-
if (vNodeData && (discoverValuesForVNodeData(vNodeData,
|
|
4602
|
+
if (vNodeData && (discoverValuesForVNodeData(vNodeData, vNodeDataValue => $addRoot$(vNodeDataValue)),
|
|
4549
4603
|
vNodeData[0] |= 16), value.children) {
|
|
4550
4604
|
for (const child of value.children) {
|
|
4551
4605
|
const childVNodeData = child.vnodeData;
|
|
4552
4606
|
if (childVNodeData) {
|
|
4553
4607
|
for (const value of childVNodeData) {
|
|
4554
4608
|
if (isSsrAttrs(value)) {
|
|
4555
|
-
const backRefKeyIndex = value.findIndex(
|
|
4609
|
+
const backRefKeyIndex = value.findIndex(v => "q:brefs" === v);
|
|
4556
4610
|
-1 !== backRefKeyIndex && $addRoot$(value[backRefKeyIndex + 1]);
|
|
4557
4611
|
}
|
|
4558
4612
|
}
|
|
@@ -4562,9 +4616,9 @@
|
|
|
4562
4616
|
}
|
|
4563
4617
|
} else if ("undefined" != typeof FormData && value instanceof FormData) {
|
|
4564
4618
|
const array = [];
|
|
4565
|
-
value.forEach((
|
|
4619
|
+
value.forEach((value, key) => {
|
|
4566
4620
|
array.push(key, "string" == typeof value ? value : value.name);
|
|
4567
|
-
})
|
|
4621
|
+
}), output(32, array);
|
|
4568
4622
|
} else if (value instanceof URLSearchParams) {
|
|
4569
4623
|
output(13, value.toString());
|
|
4570
4624
|
} else if (value instanceof Set) {
|
|
@@ -4584,7 +4638,7 @@
|
|
|
4584
4638
|
}
|
|
4585
4639
|
output(22, out);
|
|
4586
4640
|
} else if (isPromise(value)) {
|
|
4587
|
-
const forwardRefId = $resolvePromise$(value, $addRoot$, (
|
|
4641
|
+
const forwardRefId = $resolvePromise$(value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(16, resolved, resolvedValue));
|
|
4588
4642
|
output(1, forwardRefId);
|
|
4589
4643
|
} else if (value instanceof PromiseResult) {
|
|
4590
4644
|
if (23 === value.$type$) {
|
|
@@ -4608,6 +4662,9 @@
|
|
|
4608
4662
|
}
|
|
4609
4663
|
const out = btoa(buf).replace(/=+$/, "");
|
|
4610
4664
|
output(19, out);
|
|
4665
|
+
} else if (value instanceof SerializationWeakRef) {
|
|
4666
|
+
const forwardRefId = forwardRefsId++;
|
|
4667
|
+
s11nWeakRefs.set(value.$obj$, forwardRefId), forwardRefs[forwardRefId] = -1, output(1, forwardRefId);
|
|
4611
4668
|
} else {
|
|
4612
4669
|
if (!vnode_isVNode(value)) {
|
|
4613
4670
|
throw qError(20, [ typeof value ]);
|
|
@@ -4618,32 +4675,31 @@
|
|
|
4618
4675
|
};
|
|
4619
4676
|
function $resolvePromise$(promise, $addRoot$, classCreator) {
|
|
4620
4677
|
const forwardRefId = forwardRefsId++;
|
|
4621
|
-
return promise.then(
|
|
4678
|
+
return promise.then(resolvedValue => {
|
|
4622
4679
|
promises.delete(promise), forwardRefs[forwardRefId] = $addRoot$(classCreator(!0, resolvedValue));
|
|
4623
|
-
})
|
|
4680
|
+
}).catch(err => {
|
|
4624
4681
|
promises.delete(promise), forwardRefs[forwardRefId] = $addRoot$(classCreator(!1, err));
|
|
4625
|
-
})
|
|
4682
|
+
}), promises.add(promise), forwardRefId;
|
|
4626
4683
|
}
|
|
4627
4684
|
const outputRoots = async () => {
|
|
4628
4685
|
$writer$.write("[");
|
|
4629
|
-
let lastRootsLength = 0;
|
|
4630
4686
|
let rootsLength = serializationContext.$roots$.length;
|
|
4631
|
-
for (;
|
|
4632
|
-
0 !==
|
|
4687
|
+
for (;rootIdx < rootsLength || promises.size; ) {
|
|
4688
|
+
0 !== rootIdx && $writer$.write(",");
|
|
4633
4689
|
let separator = !1;
|
|
4634
|
-
for (
|
|
4635
|
-
separator ? $writer$.write(",") : separator = !0, writeValue(serializationContext.$roots$[
|
|
4690
|
+
for (;rootIdx < rootsLength; rootIdx++) {
|
|
4691
|
+
separator ? $writer$.write(",") : separator = !0, writeValue(serializationContext.$roots$[rootIdx]);
|
|
4636
4692
|
}
|
|
4637
4693
|
if (promises.size) {
|
|
4638
4694
|
try {
|
|
4639
4695
|
await Promise.race(promises);
|
|
4640
4696
|
} catch {}
|
|
4641
4697
|
}
|
|
4642
|
-
|
|
4698
|
+
rootsLength = serializationContext.$roots$.length;
|
|
4643
4699
|
}
|
|
4644
|
-
forwardRefs.length && ($writer$.write(","), $writer$.write("2,"), outputArray(forwardRefs,
|
|
4700
|
+
forwardRefs.length && ($writer$.write(","), $writer$.write("2,"), outputArray(forwardRefs, value => {
|
|
4645
4701
|
$writer$.write(String(value));
|
|
4646
|
-
}))
|
|
4702
|
+
})), $writer$.write("]");
|
|
4647
4703
|
};
|
|
4648
4704
|
await outputRoots();
|
|
4649
4705
|
}(this);
|
|
@@ -4703,7 +4759,7 @@
|
|
|
4703
4759
|
$storeProxyMap$: storeProxyMap,
|
|
4704
4760
|
$getProp$: getProp,
|
|
4705
4761
|
$setProp$: setProp,
|
|
4706
|
-
$
|
|
4762
|
+
$objectPathStringCache$: objectPathStringCache
|
|
4707
4763
|
};
|
|
4708
4764
|
};
|
|
4709
4765
|
const isSsrAttrs = value => Array.isArray(value) && value.length > 0;
|
|
@@ -4712,7 +4768,7 @@
|
|
|
4712
4768
|
if (isSsrAttrs(value)) {
|
|
4713
4769
|
for (let i = 1; i < value.length; i += 2) {
|
|
4714
4770
|
const attrValue = value[i];
|
|
4715
|
-
"string" == typeof attrValue || "q:props" === value[i - 1] && 0 === Object.keys(attrValue).length || callback(attrValue);
|
|
4771
|
+
null == attrValue || "string" == typeof attrValue || "q:props" === value[i - 1] && 0 === Object.keys(attrValue).length || callback(attrValue);
|
|
4716
4772
|
}
|
|
4717
4773
|
}
|
|
4718
4774
|
}
|
|
@@ -4728,6 +4784,12 @@
|
|
|
4728
4784
|
this.$qrl$ = $qrl$;
|
|
4729
4785
|
}
|
|
4730
4786
|
}
|
|
4787
|
+
class SerializationWeakRef {
|
|
4788
|
+
$obj$;
|
|
4789
|
+
constructor($obj$) {
|
|
4790
|
+
this.$obj$ = $obj$;
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4731
4793
|
function filterEffectBackRefs(effectBackRef) {
|
|
4732
4794
|
let effectBackRefToSerialize = null;
|
|
4733
4795
|
if (effectBackRef) {
|
|
@@ -4802,6 +4864,7 @@
|
|
|
4802
4864
|
container.$state$ = state, element && (container.element = element), container;
|
|
4803
4865
|
}
|
|
4804
4866
|
function preprocessState(data, container) {
|
|
4867
|
+
const isRootDeepRef = (type, value) => 0 === type && "string" == typeof value;
|
|
4805
4868
|
const isForwardRefsMap = type => 2 === type;
|
|
4806
4869
|
const isPreloadQrlType = type => 21 === type;
|
|
4807
4870
|
const processRootRef = index => {
|
|
@@ -4822,12 +4885,11 @@
|
|
|
4822
4885
|
data[index + 1] = object;
|
|
4823
4886
|
};
|
|
4824
4887
|
for (let i = 0; i < data.length; i += 2) {
|
|
4825
|
-
|
|
4888
|
+
isRootDeepRef(data[i], data[i + 1]) ? processRootRef(i) : isForwardRefsMap(data[i]) ? container.$forwardRefs$ = data[i + 1] : isPreloadQrlType(data[i]) && (container.$initialQRLsIndexes$ ||= [],
|
|
4826
4889
|
container.$initialQRLsIndexes$.push(i / 2));
|
|
4827
4890
|
}
|
|
4828
|
-
var value;
|
|
4829
4891
|
}
|
|
4830
|
-
const frameworkType = obj =>
|
|
4892
|
+
const frameworkType = obj => isObject(obj) && (obj instanceof SignalImpl || obj instanceof Task || isJSXNode(obj)) || isQrl(obj);
|
|
4831
4893
|
const canSerialize = (value, seen = new WeakSet) => {
|
|
4832
4894
|
if (null == value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value || "bigint" == typeof value) {
|
|
4833
4895
|
return !0;
|
|
@@ -4840,7 +4902,7 @@
|
|
|
4840
4902
|
const proto = Object.getPrototypeOf(value);
|
|
4841
4903
|
if (isStore(value) && (value = getStoreTarget(value)), proto == Object.prototype) {
|
|
4842
4904
|
for (const key in value) {
|
|
4843
|
-
if (!canSerialize(untrack((
|
|
4905
|
+
if (!canSerialize(untrack(() => value[key]), seen)) {
|
|
4844
4906
|
return !1;
|
|
4845
4907
|
}
|
|
4846
4908
|
}
|
|
@@ -4896,25 +4958,29 @@
|
|
|
4896
4958
|
if (isDomRef?.(value)) {
|
|
4897
4959
|
return !0;
|
|
4898
4960
|
}
|
|
4899
|
-
} else if ("function" == typeof value
|
|
4961
|
+
} else if ("function" == typeof value) {
|
|
4962
|
+
if (isQrl(value) || isQwikComponent(value)) {
|
|
4963
|
+
return !0;
|
|
4964
|
+
}
|
|
4965
|
+
} else if (value === _UNINITIALIZED) {
|
|
4900
4966
|
return !0;
|
|
4901
4967
|
}
|
|
4902
4968
|
return !1;
|
|
4903
4969
|
};
|
|
4904
4970
|
const QRL_RUNTIME_CHUNK = "mock-chunk";
|
|
4905
|
-
const _typeIdNames = [ "RootRef", "ForwardRef", "ForwardRefs", "Constant", "Number", "String", "Array", "URL", "Date", "Regex", "VNode", "RefVNode", "BigInt", "URLSearchParams", "Error", "Object", "Promise", "Set", "Map", "Uint8Array", "QRL", "PreloadQRL", "Task", "Resource", "Component", "Signal", "WrappedSignal", "ComputedSignal", "AsyncComputedSignal", "SerializerSignal", "Store", "StoreArray", "FormData", "JSXNode", "PropsProxy", "
|
|
4971
|
+
const _typeIdNames = [ "RootRef", "ForwardRef", "ForwardRefs", "Constant", "Number", "String", "Array", "URL", "Date", "Regex", "VNode", "RefVNode", "BigInt", "URLSearchParams", "Error", "Object", "Promise", "Set", "Map", "Uint8Array", "QRL", "PreloadQRL", "Task", "Resource", "Component", "Signal", "WrappedSignal", "ComputedSignal", "AsyncComputedSignal", "SerializerSignal", "Store", "StoreArray", "FormData", "JSXNode", "PropsProxy", "SubscriptionData" ];
|
|
4906
4972
|
const printRaw = (value, prefix) => {
|
|
4907
4973
|
let result = vnode_isVNode(value) ? vnode_toString.call(value, 1, "", !0).replaceAll(/\n.*/gm, "") : "function" == typeof value ? String(value) : ((obj, indent) => {
|
|
4908
4974
|
const seen = new WeakSet;
|
|
4909
|
-
return JSON.stringify(obj, (
|
|
4910
|
-
if (
|
|
4975
|
+
return JSON.stringify(obj, (_, value) => {
|
|
4976
|
+
if (isObject(value)) {
|
|
4911
4977
|
if (seen.has(value)) {
|
|
4912
4978
|
return `[Circular ${value.constructor.name}]`;
|
|
4913
4979
|
}
|
|
4914
4980
|
seen.add(value);
|
|
4915
4981
|
}
|
|
4916
4982
|
return value;
|
|
4917
|
-
}
|
|
4983
|
+
}, indent);
|
|
4918
4984
|
})(value, 2);
|
|
4919
4985
|
return result.length > 500 && (result = result.slice(0, 500) + '"...'), result = result.replace(/\n/g, "\n" + prefix),
|
|
4920
4986
|
result.includes("\n") ? result = `\n${prefix}${result}` : result;
|
|
@@ -4932,11 +4998,11 @@
|
|
|
4932
4998
|
}
|
|
4933
4999
|
const key = state[i];
|
|
4934
5000
|
let value = state[++i];
|
|
4935
|
-
void 0 === key ? (hasRaw = !0, out.push(`${RED}[raw${
|
|
5001
|
+
void 0 === key ? (hasRaw = !0, out.push(`${RED}[raw${isObject(value) ? ` ${value.constructor.name}` : ""}]${RESET} ${printRaw(value, `${prefix} `)}`)) : (3 === key ? value = constantToName(value) : "string" == typeof value ? (value = JSON.stringify(value),
|
|
4936
5002
|
value.length > 120 && (value = value.slice(0, 120) + '"...')) : 2 === key ? value = `[\n${prefix} ${value.join(`\n${prefix} `)}\n${prefix}]` : Array.isArray(value) && (value = value.length ? `[\n${dumpState(value, color, `${prefix} `)}\n${prefix}]` : "[]"),
|
|
4937
5003
|
out.push(`${RED}${typeIdToName(key)}${RESET} ${value}`));
|
|
4938
5004
|
}
|
|
4939
|
-
const result = out.map((
|
|
5005
|
+
const result = out.map((v, i) => `${prefix}${isRoot ? `${i} ` : ""}${v}`).join("\n");
|
|
4940
5006
|
if (isRoot) {
|
|
4941
5007
|
const count = hasRaw ? "" : `(${JSON.stringify(state).length} chars)`;
|
|
4942
5008
|
return hasRaw = !1, `\n${result}\n${count}`;
|
|
@@ -4978,12 +5044,12 @@
|
|
|
4978
5044
|
}
|
|
4979
5045
|
if (isArray(unwrapped)) {
|
|
4980
5046
|
let expectIndex = 0;
|
|
4981
|
-
return unwrapped.forEach((
|
|
5047
|
+
return unwrapped.forEach((v, i) => {
|
|
4982
5048
|
if (i !== expectIndex) {
|
|
4983
5049
|
throw qError(3, [ unwrapped ]);
|
|
4984
5050
|
}
|
|
4985
5051
|
_verifySerializable(v, seen, ctx + "[" + i + "]"), expectIndex = i + 1;
|
|
4986
|
-
})
|
|
5052
|
+
}), value;
|
|
4987
5053
|
}
|
|
4988
5054
|
if (isSerializableObject(unwrapped)) {
|
|
4989
5055
|
for (const [key, item] of Object.entries(unwrapped)) {
|
|
@@ -5011,13 +5077,13 @@
|
|
|
5011
5077
|
return value;
|
|
5012
5078
|
};
|
|
5013
5079
|
const noSerializeSet = /*#__PURE__*/ new WeakSet;
|
|
5014
|
-
const weakSerializeSet = /*#__PURE__*/ new WeakSet;
|
|
5015
5080
|
const shouldSerialize = obj => !isObject(obj) && !isFunction(obj) || !noSerializeSet.has(obj);
|
|
5016
|
-
const fastSkipSerialize = obj => obj && (
|
|
5017
|
-
const noSerialize = input => ((
|
|
5081
|
+
const fastSkipSerialize = obj => obj && (isObject(obj) || "function" == typeof obj) && (NoSerializeSymbol in obj || noSerializeSet.has(obj));
|
|
5082
|
+
const noSerialize = input => ((isObject(input) && null !== input || "function" == typeof input) && noSerializeSet.add(input),
|
|
5018
5083
|
input);
|
|
5019
5084
|
const NoSerializeSymbol = Symbol("noSerialize");
|
|
5020
5085
|
const SerializerSymbol = Symbol("serialize");
|
|
5086
|
+
const resolvedSymbol = Symbol("resolved");
|
|
5021
5087
|
const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
|
|
5022
5088
|
let _containerEl;
|
|
5023
5089
|
const qrl = async function(...args) {
|
|
@@ -5028,12 +5094,12 @@
|
|
|
5028
5094
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
5029
5095
|
const bound = (...args) => {
|
|
5030
5096
|
if (!qrl.resolved) {
|
|
5031
|
-
return retryOnPromise((
|
|
5097
|
+
return retryOnPromise(() => qrl.resolve()).then(fn => {
|
|
5032
5098
|
if (!isFunction(fn)) {
|
|
5033
5099
|
throw qError(5);
|
|
5034
5100
|
}
|
|
5035
5101
|
return bound(...args);
|
|
5036
|
-
})
|
|
5102
|
+
});
|
|
5037
5103
|
}
|
|
5038
5104
|
if (beforeFn && !1 === beforeFn()) {
|
|
5039
5105
|
return;
|
|
@@ -5067,7 +5133,8 @@
|
|
|
5067
5133
|
return context = newInvokeContext(), context.$qrl$ = qrl, context.$event$ = this,
|
|
5068
5134
|
invoke.call(this, context, fn, ...args);
|
|
5069
5135
|
};
|
|
5070
|
-
|
|
5136
|
+
symbolFn && resolvedSymbol in symbolFn && (symbolRef = symbolFn[resolvedSymbol]);
|
|
5137
|
+
const resolve = symbolRef ? async () => symbolRef : async containerEl => {
|
|
5071
5138
|
if (null !== symbolRef) {
|
|
5072
5139
|
return symbolRef;
|
|
5073
5140
|
}
|
|
@@ -5081,14 +5148,17 @@
|
|
|
5081
5148
|
const start = now();
|
|
5082
5149
|
const ctx = tryGetInvokeContext();
|
|
5083
5150
|
if (null !== symbolFn) {
|
|
5084
|
-
symbolRef = symbolFn().then(
|
|
5151
|
+
symbolRef = symbolFn().then(module => {
|
|
5152
|
+
const resolved = wrapFn(symbolRef = module[symbol]);
|
|
5153
|
+
return symbolFn[resolvedSymbol] = resolved, qrl.resolved = resolved, resolved;
|
|
5154
|
+
});
|
|
5085
5155
|
} else {
|
|
5086
5156
|
const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
|
|
5087
|
-
symbolRef = maybeThen(imported,
|
|
5157
|
+
symbolRef = maybeThen(imported, ref => qrl.resolved = wrapFn(symbolRef = ref));
|
|
5088
5158
|
}
|
|
5089
|
-
return
|
|
5159
|
+
return isPromise(symbolRef) && symbolRef.then(() => emitUsedSymbol(symbol, ctx?.$element$, start), err => {
|
|
5090
5160
|
console.error(`qrl ${symbol} failed to load`, err), symbolRef = null;
|
|
5091
|
-
})
|
|
5161
|
+
}), symbolRef;
|
|
5092
5162
|
};
|
|
5093
5163
|
const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
|
|
5094
5164
|
const hash = getSymbolHash(symbol);
|
|
@@ -5097,7 +5167,6 @@
|
|
|
5097
5167
|
getHash: () => hash,
|
|
5098
5168
|
getCaptured: () => captureRef,
|
|
5099
5169
|
resolve,
|
|
5100
|
-
$resolveLazy$: containerEl => null !== symbolRef ? symbolRef : resolve(containerEl),
|
|
5101
5170
|
$setContainer$: setContainer,
|
|
5102
5171
|
$chunk$: chunk,
|
|
5103
5172
|
$symbol$: symbol,
|
|
@@ -5107,7 +5176,7 @@
|
|
|
5107
5176
|
$captureRef$: captureRef,
|
|
5108
5177
|
dev: null,
|
|
5109
5178
|
resolved: void 0
|
|
5110
|
-
}), symbolRef && (symbolRef = maybeThen(symbolRef,
|
|
5179
|
+
}), symbolRef && (symbolRef = maybeThen(symbolRef, resolved => qrl.resolved = wrapFn(symbolRef = resolved))),
|
|
5111
5180
|
build.isDev && Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
5112
5181
|
get: () => symbolRef
|
|
5113
5182
|
}), build.isBrowser && symbol && preloader.p(symbol, .8), qrl;
|
|
@@ -5275,7 +5344,7 @@
|
|
|
5275
5344
|
const STRINGS_COMMENTS = [ [ ANY, 39, 14 ], [ ANY, 34, 15 ], [ ANY, 47, 16, "*" ] ];
|
|
5276
5345
|
const STATE_MACHINE = [ [ [ ANY, 42, starSelector ], [ ANY, OPEN_BRACKET, 7 ], [ ANY, COLON, pseudoElement, ":", "before", "after", "first-letter", "first-line" ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, COLON, 3, "has", "host-context", "not", "where", "is", "matches", "any" ], [ ANY, COLON, 4 ], [ ANY, IDENT, 1 ], [ ANY, DOT, 1 ], [ ANY, HASH, 1 ], [ ANY, 64, atRuleSelector, "keyframe" ], [ ANY, 64, atRuleBlock, "media", "supports", "container" ], [ ANY, 64, atRuleInert ], [ ANY, 123, 13 ], [ 47, 42, 16 ], [ ANY, 59, EXIT ], [ ANY, 125, EXIT ], [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, rule ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, 8 ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, rule ], [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, 93, EXIT_INSERT_SCOPE ], [ ANY, 39, 14 ], [ ANY, 34, 15 ] ], [ [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], [ WHITESPACE, IDENT, 1 ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, 123, 13 ], ...STRINGS_COMMENTS ], [ [ ANY, 123, rule ], [ ANY, 59, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 59, EXIT ], [ ANY, 123, 9 ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], [ ANY, 123, 13 ], [ ANY, 40, 8 ], ...STRINGS_COMMENTS ], [ [ ANY, 39, EXIT ] ], [ [ ANY, 34, EXIT ] ], [ [ 42, 47, EXIT ] ] ];
|
|
5277
5346
|
const useStylesQrl = styles => ({
|
|
5278
|
-
styleId: _useStyles(styles,
|
|
5347
|
+
styleId: _useStyles(styles, str => str, !1)
|
|
5279
5348
|
});
|
|
5280
5349
|
const useStyles$ = /*#__PURE__*/ implicit$FirstArg(useStylesQrl);
|
|
5281
5350
|
const useStylesScopedQrl = styles => ({
|
|
@@ -5291,13 +5360,10 @@
|
|
|
5291
5360
|
const styleId = (index = i, assertQrl(qStyles = styleQrl), `${hashCode(qStyles.$hash$)}-${index}`);
|
|
5292
5361
|
var qStyles, index;
|
|
5293
5362
|
const host = iCtx.$hostElement$;
|
|
5294
|
-
set(styleId)
|
|
5295
|
-
|
|
5296
|
-
if (isPromise(value)) {
|
|
5297
|
-
throw value.then((val => iCtx.$container$.$appendStyle$(transform(val, styleId), styleId, host, scoped))),
|
|
5298
|
-
value;
|
|
5363
|
+
if (set(styleId), !styleQrl.resolved) {
|
|
5364
|
+
throw styleQrl.resolve().then(val => iCtx.$container$.$appendStyle$(transform(val, styleId), styleId, host, scoped));
|
|
5299
5365
|
}
|
|
5300
|
-
return iCtx.$container$.$appendStyle$(transform(
|
|
5366
|
+
return iCtx.$container$.$appendStyle$(transform(styleQrl.resolved, styleId), styleId, host, scoped),
|
|
5301
5367
|
styleId;
|
|
5302
5368
|
};
|
|
5303
5369
|
const useOn = (event, eventQrl) => {
|
|
@@ -5317,7 +5383,7 @@
|
|
|
5317
5383
|
};
|
|
5318
5384
|
const _useOn = (eventName, eventQrl) => {
|
|
5319
5385
|
const {isAdded, addEvent} = useOnEventsSequentialScope();
|
|
5320
|
-
isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach(
|
|
5386
|
+
isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach(event => addEvent(event, eventQrl)) : addEvent(eventName, eventQrl));
|
|
5321
5387
|
};
|
|
5322
5388
|
const useOnEventsSequentialScope = () => {
|
|
5323
5389
|
const iCtx = useInvokeContext();
|
|
@@ -5343,18 +5409,18 @@
|
|
|
5343
5409
|
const {val, set} = useSequentialScope();
|
|
5344
5410
|
return null != val ? val : set(value = isFunction(value) && !isQwikComponent(value) ? value() : value);
|
|
5345
5411
|
};
|
|
5346
|
-
const useComputedCommon = (qrl,
|
|
5412
|
+
const useComputedCommon = (qrl, createFn, options) => {
|
|
5347
5413
|
const {val, set} = useSequentialScope();
|
|
5348
5414
|
if (val) {
|
|
5349
5415
|
return val;
|
|
5350
5416
|
}
|
|
5351
5417
|
assertQrl(qrl);
|
|
5352
|
-
const signal =
|
|
5418
|
+
const signal = createFn(qrl, options);
|
|
5353
5419
|
return set(signal), throwIfQRLNotResolved(qrl), signal;
|
|
5354
5420
|
};
|
|
5355
|
-
const useComputedQrl = qrl => useComputedCommon(qrl,
|
|
5421
|
+
const useComputedQrl = (qrl, options) => useComputedCommon(qrl, createComputedSignal, options);
|
|
5356
5422
|
const useComputed$ = implicit$FirstArg(useComputedQrl);
|
|
5357
|
-
const useSerializerQrl = qrl => useComputedCommon(qrl,
|
|
5423
|
+
const useSerializerQrl = qrl => useComputedCommon(qrl, createSerializerSignal);
|
|
5358
5424
|
const useSerializer$ = implicit$FirstArg(useSerializerQrl);
|
|
5359
5425
|
const useVisibleTaskQrl = (qrl, opts) => {
|
|
5360
5426
|
const {val, set, i, iCtx} = useSequentialScope();
|
|
@@ -5364,7 +5430,7 @@
|
|
|
5364
5430
|
}
|
|
5365
5431
|
assertQrl(qrl);
|
|
5366
5432
|
const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
5367
|
-
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl
|
|
5433
|
+
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
|
|
5368
5434
|
iCtx.$container$.$scheduler$(32, task));
|
|
5369
5435
|
};
|
|
5370
5436
|
const useRunTask = (task, eagerness) => {
|
|
@@ -5373,14 +5439,14 @@
|
|
|
5373
5439
|
const getTaskHandlerQrl = task => createQRL(null, "_task", scheduleTask, null, null, [ task ]);
|
|
5374
5440
|
const useTask$ = /*#__PURE__*/ implicit$FirstArg(useTaskQrl);
|
|
5375
5441
|
const useVisibleTask$ = /*#__PURE__*/ implicit$FirstArg(useVisibleTaskQrl);
|
|
5376
|
-
const useAsyncComputedQrl = qrl => useComputedCommon(qrl,
|
|
5442
|
+
const useAsyncComputedQrl = (qrl, options) => useComputedCommon(qrl, createAsyncComputedSignal, options);
|
|
5377
5443
|
const useAsyncComputed$ = implicit$FirstArg(useAsyncComputedQrl);
|
|
5378
5444
|
const PREFETCH_CODE = /*#__PURE__*/ (c => {
|
|
5379
|
-
"getRegistrations" in c && c.getRegistrations().then(
|
|
5380
|
-
registrations.forEach(
|
|
5445
|
+
"getRegistrations" in c && c.getRegistrations().then(registrations => {
|
|
5446
|
+
registrations.forEach(registration => {
|
|
5381
5447
|
registration.active && registration.active.scriptURL.endsWith("_URL_") && registration.unregister().catch(console.error);
|
|
5382
|
-
})
|
|
5383
|
-
})
|
|
5448
|
+
});
|
|
5449
|
+
});
|
|
5384
5450
|
}).toString();
|
|
5385
5451
|
Object.defineProperty(exports, "isBrowser", {
|
|
5386
5452
|
enumerable: !0,
|
|
@@ -5430,7 +5496,7 @@
|
|
|
5430
5496
|
return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
|
|
5431
5497
|
}
|
|
5432
5498
|
{
|
|
5433
|
-
const resolvedValue = untrack((
|
|
5499
|
+
const resolvedValue = untrack(() => resource._resolved);
|
|
5434
5500
|
if (void 0 !== resolvedValue) {
|
|
5435
5501
|
return Promise.resolve(resolvedValue).then(useBindInvokeContext(props.onResolved));
|
|
5436
5502
|
}
|
|
@@ -5439,7 +5505,14 @@
|
|
|
5439
5505
|
const value = resource.value;
|
|
5440
5506
|
return value ? value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : Promise.resolve(void 0);
|
|
5441
5507
|
}
|
|
5442
|
-
|
|
5508
|
+
if (isPromise(resource)) {
|
|
5509
|
+
return resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
5510
|
+
}
|
|
5511
|
+
if (isSignal(resource)) {
|
|
5512
|
+
const value = retryOnPromise(() => resource.value);
|
|
5513
|
+
return (isPromise(value) ? value : Promise.resolve(value)).then(useBindInvokeContext(props.onResolved));
|
|
5514
|
+
}
|
|
5515
|
+
return Promise.resolve(resource).then(useBindInvokeContext(props.onResolved));
|
|
5443
5516
|
}(props), 0, null), exports.SSRComment = SSRComment, exports.SSRRaw = SSRRaw, exports.SSRStream = SSRStream,
|
|
5444
5517
|
exports.SSRStreamBlock = props => [ jsx(SSRComment, {
|
|
5445
5518
|
data: "qkssr-pu"
|
|
@@ -5449,7 +5522,7 @@
|
|
|
5449
5522
|
exports.Slot = Slot, exports._CONST_PROPS = _CONST_PROPS, exports._DomContainer = DomContainer,
|
|
5450
5523
|
exports._EFFECT_BACK_REF = _EFFECT_BACK_REF, exports._EMPTY_ARRAY = EMPTY_ARRAY,
|
|
5451
5524
|
exports._IMMUTABLE = _IMMUTABLE, exports._SharedContainer = _SharedContainer, exports._SubscriptionData = SubscriptionData,
|
|
5452
|
-
exports._VAR_PROPS = _VAR_PROPS, exports._deserialize = function(rawStateData, element) {
|
|
5525
|
+
exports._UNINITIALIZED = _UNINITIALIZED, exports._VAR_PROPS = _VAR_PROPS, exports._deserialize = function(rawStateData, element) {
|
|
5453
5526
|
if (null == rawStateData) {
|
|
5454
5527
|
return [];
|
|
5455
5528
|
}
|
|
@@ -5465,7 +5538,12 @@
|
|
|
5465
5538
|
}
|
|
5466
5539
|
return output;
|
|
5467
5540
|
}, exports._dumpState = dumpState, exports._fnSignal = (fn, args, fnStr) => new WrappedSignalImpl(null, fn, args, fnStr || null),
|
|
5468
|
-
exports.
|
|
5541
|
+
exports._getContextContainer = () => {
|
|
5542
|
+
const iCtx = tryGetInvokeContext();
|
|
5543
|
+
if (iCtx) {
|
|
5544
|
+
return iCtx.$container$;
|
|
5545
|
+
}
|
|
5546
|
+
}, exports._getContextElement = () => {
|
|
5469
5547
|
const iCtx = tryGetInvokeContext();
|
|
5470
5548
|
if (iCtx) {
|
|
5471
5549
|
const hostElement = iCtx.$hostElement$;
|
|
@@ -5511,13 +5589,14 @@
|
|
|
5511
5589
|
omit.includes(key) || (varPropsTarget[key] = varProps[key]);
|
|
5512
5590
|
}
|
|
5513
5591
|
return createPropsProxy(varPropsTarget, constPropsTarget);
|
|
5514
|
-
}, exports._run = queueQRL, exports.
|
|
5515
|
-
|
|
5592
|
+
}, exports._run = queueQRL, exports._serializationWeakRef = obj => new SerializationWeakRef(obj),
|
|
5593
|
+
exports._serialize = async function(data) {
|
|
5594
|
+
const serializationContext = createSerializationContext(null, null, () => "", () => "", () => {}, new WeakMap);
|
|
5516
5595
|
for (const root of data) {
|
|
5517
5596
|
serializationContext.$addRoot$(root);
|
|
5518
5597
|
}
|
|
5519
5598
|
return await serializationContext.$serialize$(), serializationContext.$writer$.toString();
|
|
5520
|
-
}, exports._task = scheduleTask, exports._verifySerializable = verifySerializable,
|
|
5599
|
+
}, exports._task = scheduleTask, exports._useInvokeContext = useInvokeContext, exports._verifySerializable = verifySerializable,
|
|
5521
5600
|
exports._vnode_toString = vnode_toString, exports._waitUntilRendered = elm => {
|
|
5522
5601
|
const containerEl = _getQContainerElement(elm);
|
|
5523
5602
|
if (!containerEl) {
|
|
@@ -5525,14 +5604,11 @@
|
|
|
5525
5604
|
}
|
|
5526
5605
|
const container = containerEl.qContainer;
|
|
5527
5606
|
return container?.renderDone ?? Promise.resolve();
|
|
5528
|
-
}, exports._walkJSX = _walkJSX, exports.
|
|
5529
|
-
input), exports._wrapProp = _wrapProp, exports._wrapSignal = (obj, prop) => {
|
|
5607
|
+
}, exports._walkJSX = _walkJSX, exports._wrapProp = _wrapProp, exports._wrapSignal = (obj, prop) => {
|
|
5530
5608
|
const r = _wrapProp(obj, prop);
|
|
5531
5609
|
return r === _IMMUTABLE ? obj[prop] : r;
|
|
5532
|
-
}, exports._wrapStore = (obj, prop) => {
|
|
5533
|
-
const value = getStoreTarget(obj)[prop];
|
|
5534
|
-
return isSignal(value) ? value : new WrappedSignalImpl(null, getProp, [ obj, prop ], null, 1);
|
|
5535
5610
|
}, exports.component$ = onMount => componentQrl(dollar(onMount)), exports.componentQrl = componentQrl,
|
|
5611
|
+
exports.createAsyncComputed$ = createAsyncComputed$, exports.createAsyncComputedQrl = createAsyncComputedSignal,
|
|
5536
5612
|
exports.createComputed$ = createComputed$, exports.createComputedQrl = createComputedSignal,
|
|
5537
5613
|
exports.createContextId = createContextId, exports.createElement = h, exports.createSerializer$ = createSerializer$,
|
|
5538
5614
|
exports.createSerializerQrl = createSerializerSignal, exports.createSignal = createSignal,
|
|
@@ -5555,10 +5631,10 @@
|
|
|
5555
5631
|
return qrl.dev = opts, qrl;
|
|
5556
5632
|
}, exports.isSignal = isSignal, exports.jsx = jsx, exports.jsxDEV = (type, props, key, _isStatic, opts) => {
|
|
5557
5633
|
const processed = null == key ? null : String(key);
|
|
5558
|
-
const children = untrack((
|
|
5634
|
+
const children = untrack(() => {
|
|
5559
5635
|
const c = props.children;
|
|
5560
5636
|
return "string" == typeof type && delete props.children, c;
|
|
5561
|
-
})
|
|
5637
|
+
});
|
|
5562
5638
|
isString(type) && "className" in props && (props.class = props.className, delete props.className);
|
|
5563
5639
|
const node = new JSXNodeImpl(type, props, null, children, 0, processed);
|
|
5564
5640
|
return node.dev = {
|
|
@@ -5630,10 +5706,10 @@
|
|
|
5630
5706
|
exports.useSerializerQrl = useSerializerQrl, exports.useServerData = function(key, defaultValue) {
|
|
5631
5707
|
const ctx = tryGetInvokeContext();
|
|
5632
5708
|
return ctx?.$container$?.$serverData$[key] ?? defaultValue;
|
|
5633
|
-
}, exports.useSignal = initialState => useConstant((
|
|
5709
|
+
}, exports.useSignal = initialState => useConstant(() => {
|
|
5634
5710
|
const value = isFunction(initialState) && !isQwikComponent(initialState) ? invoke(void 0, initialState) : initialState;
|
|
5635
5711
|
return createSignal(value);
|
|
5636
|
-
})
|
|
5712
|
+
}), exports.useStore = useStore, exports.useStyles$ = useStyles$, exports.useStylesQrl = useStylesQrl,
|
|
5637
5713
|
exports.useStylesScoped$ = useStylesScoped$, exports.useStylesScopedQrl = useStylesScopedQrl,
|
|
5638
5714
|
exports.useTask$ = useTask$, exports.useTaskQrl = useTaskQrl, exports.useVisibleTask$ = useVisibleTask$,
|
|
5639
5715
|
exports.useVisibleTaskQrl = useVisibleTaskQrl, exports.version = version, exports.withLocale = function(locale, fn) {
|
|
@@ -5644,4 +5720,4 @@
|
|
|
5644
5720
|
_locale = previousLang;
|
|
5645
5721
|
}
|
|
5646
5722
|
};
|
|
5647
|
-
})
|
|
5723
|
+
});
|