@qwik.dev/core 2.0.0-alpha.0 → 2.0.0-alpha.2
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 +1384 -761
- package/dist/core-internal.d.ts +15 -2
- package/dist/core.cjs +75 -61
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +75 -61
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +56 -46
- package/dist/core.prod.mjs +58 -49
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +57 -60
- package/dist/optimizer.mjs +59 -63
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +1 -0
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +81 -53
- package/dist/server.mjs +81 -53
- package/dist/starters/features/auth/package.json +3 -1
- package/dist/starters/features/drizzle/package.json +2 -1
- package/dist/starters/features/postcss/package.json +3 -0
- package/dist/starters/features/prisma/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +3 -0
- package/dist/starters/features/turso/package.json +4 -1
- package/dist/testing/index.cjs +77 -49
- package/dist/testing/index.mjs +77 -49
- package/dist/testing/package.json +1 -1
- package/package.json +13 -11
- package/public.d.ts +2 -0
package/dist/core.prod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core 2.0.0-alpha.2-dev+58b6f8d
|
|
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
|
|
@@ -824,7 +824,17 @@
|
|
|
824
824
|
!0);
|
|
825
825
|
}
|
|
826
826
|
has(target, prop) {
|
|
827
|
-
|
|
827
|
+
if (prop === STORE_TARGET) {
|
|
828
|
+
return !0;
|
|
829
|
+
}
|
|
830
|
+
if ("string" == typeof prop) {
|
|
831
|
+
const ctx = tryGetInvokeContext();
|
|
832
|
+
if (ctx) {
|
|
833
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
834
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
828
838
|
}
|
|
829
839
|
ownKeys(target) {
|
|
830
840
|
const ctx = tryGetInvokeContext();
|
|
@@ -1076,8 +1086,10 @@
|
|
|
1076
1086
|
const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1077
1087
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, "qRender");
|
|
1078
1088
|
let componentFn;
|
|
1079
|
-
|
|
1080
|
-
container.ensureProjectionResolved(renderHost)
|
|
1089
|
+
iCtx.$effectSubscriber$ = [ subscriptionHost, EffectProperty.COMPONENT ], iCtx.$container$ = container,
|
|
1090
|
+
container.ensureProjectionResolved(renderHost);
|
|
1091
|
+
let isInlineComponent = !1;
|
|
1092
|
+
if (null === componentQRL && (componentQRL = componentQRL || container.getHostProp(renderHost, "q:renderFn"),
|
|
1081
1093
|
assertDefined()), isQrl(componentQRL)) {
|
|
1082
1094
|
(props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ) && props.children && delete props.children,
|
|
1083
1095
|
componentFn = componentQRL.getFn(iCtx);
|
|
@@ -1085,11 +1097,12 @@
|
|
|
1085
1097
|
const qComponentFn = componentQRL;
|
|
1086
1098
|
componentFn = () => invokeApply(iCtx, qComponentFn, [ props || EMPTY_OBJ, null, 0 ]);
|
|
1087
1099
|
} else {
|
|
1100
|
+
isInlineComponent = !0;
|
|
1088
1101
|
const inlineComponent = componentQRL;
|
|
1089
1102
|
componentFn = () => invokeApply(iCtx, inlineComponent, [ props || EMPTY_OBJ ]);
|
|
1090
1103
|
}
|
|
1091
|
-
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
1092
|
-
container.setHostProp(renderHost, ":onIdx", null), container.setHostProp(renderHost, "q:props", props),
|
|
1104
|
+
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
1105
|
+
container.setHostProp(renderHost, ":onIdx", null), container.getHostProp(renderHost, "q:props") !== props && container.setHostProp(renderHost, "q:props", props)),
|
|
1093
1106
|
vnode_isVNode(renderHost) && clearVNodeEffectDependencies(renderHost), componentFn(props))), (jsx => {
|
|
1094
1107
|
const useOnEvents = container.getHostProp(renderHost, ":on");
|
|
1095
1108
|
return useOnEvents ? maybeThen(function(jsx, useOnEvents) {
|
|
@@ -1876,7 +1889,7 @@
|
|
|
1876
1889
|
const bHost = b.$host$;
|
|
1877
1890
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
1878
1891
|
if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
|
|
1879
|
-
const errorMessage =
|
|
1892
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
1880
1893
|
return shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage), logWarn(errorMessage),
|
|
1881
1894
|
null;
|
|
1882
1895
|
}
|
|
@@ -1901,7 +1914,7 @@
|
|
|
1901
1914
|
}
|
|
1902
1915
|
return 0;
|
|
1903
1916
|
}
|
|
1904
|
-
const version = "2.0.0-alpha.
|
|
1917
|
+
const version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
1905
1918
|
class _SharedContainer {
|
|
1906
1919
|
$version$;
|
|
1907
1920
|
$scheduler$;
|
|
@@ -1920,8 +1933,8 @@
|
|
|
1920
1933
|
trackSignalValue(signal, subscriber, property, data) {
|
|
1921
1934
|
return trackSignal((() => signal.value), subscriber, property, this, data);
|
|
1922
1935
|
}
|
|
1923
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
1924
|
-
return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
1936
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
1937
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
1925
1938
|
}
|
|
1926
1939
|
}
|
|
1927
1940
|
const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
|
|
@@ -4050,13 +4063,7 @@
|
|
|
4050
4063
|
return qrl.$captureRef$ = captureIds ? captureIds.map((id => container.$getObjectById$(id))) : null,
|
|
4051
4064
|
container.element && qrl.$setContainer$(container.element), qrl;
|
|
4052
4065
|
}
|
|
4053
|
-
|
|
4054
|
-
id;
|
|
4055
|
-
constructor(id) {
|
|
4056
|
-
this.id = id;
|
|
4057
|
-
}
|
|
4058
|
-
}
|
|
4059
|
-
const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
4066
|
+
const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
4060
4067
|
if (!writer) {
|
|
4061
4068
|
const buffer = [];
|
|
4062
4069
|
writer = {
|
|
@@ -4076,10 +4083,11 @@
|
|
|
4076
4083
|
roots.push(obj)), id;
|
|
4077
4084
|
};
|
|
4078
4085
|
const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => !1;
|
|
4086
|
+
const isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => !1;
|
|
4079
4087
|
return {
|
|
4080
4088
|
$serialize$() {
|
|
4081
4089
|
!function(serializationContext) {
|
|
4082
|
-
const {$writer$, $isSsrNode$, $setProp$, $storeProxyMap$} = serializationContext;
|
|
4090
|
+
const {$writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$} = serializationContext;
|
|
4083
4091
|
let depth = -1;
|
|
4084
4092
|
let writeType = !1;
|
|
4085
4093
|
const output = (type, value) => {
|
|
@@ -4197,12 +4205,11 @@
|
|
|
4197
4205
|
}
|
|
4198
4206
|
output(TypeIds.Object, out);
|
|
4199
4207
|
}
|
|
4200
|
-
} else if (value
|
|
4208
|
+
} else if ($isDomRef$(value)) {
|
|
4201
4209
|
output(TypeIds.RefVNode, value.id);
|
|
4202
4210
|
} else if (value instanceof Signal) {
|
|
4203
|
-
|
|
4204
|
-
if (
|
|
4205
|
-
value instanceof WrappedSignal) {
|
|
4211
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
4212
|
+
if (value instanceof WrappedSignal) {
|
|
4206
4213
|
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
|
|
4207
4214
|
} else if (value instanceof ComputedSignal) {
|
|
4208
4215
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
@@ -4280,6 +4287,7 @@
|
|
|
4280
4287
|
}(this);
|
|
4281
4288
|
},
|
|
4282
4289
|
$isSsrNode$: isSsrNode,
|
|
4290
|
+
$isDomRef$: isDomRef,
|
|
4283
4291
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
4284
4292
|
$wasSeen$,
|
|
4285
4293
|
$roots$: roots,
|
|
@@ -4348,6 +4356,8 @@
|
|
|
4348
4356
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
4349
4357
|
} else if (isSsrNode(obj)) {
|
|
4350
4358
|
discoveredValues.push(obj.vnodeData);
|
|
4359
|
+
} else if (isDomRef(obj)) {
|
|
4360
|
+
discoveredValues.push(obj.id);
|
|
4351
4361
|
} else if (isJSXNode(obj)) {
|
|
4352
4362
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
4353
4363
|
} else if (Array.isArray(obj)) {
|
|
@@ -4630,10 +4640,30 @@
|
|
|
4630
4640
|
const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
|
|
4631
4641
|
let _containerEl;
|
|
4632
4642
|
const qrl = async function(...args) {
|
|
4633
|
-
const
|
|
4634
|
-
return await
|
|
4643
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
4644
|
+
return await boundedFn(...args);
|
|
4635
4645
|
};
|
|
4636
4646
|
const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
|
|
4647
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
4648
|
+
return (...args) => maybeThen(resolveLazy(), (fn => {
|
|
4649
|
+
if (!isFunction(fn)) {
|
|
4650
|
+
throw qError(10);
|
|
4651
|
+
}
|
|
4652
|
+
if (beforeFn && !1 === beforeFn()) {
|
|
4653
|
+
return;
|
|
4654
|
+
}
|
|
4655
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
4656
|
+
const prevQrl = context.$qrl$;
|
|
4657
|
+
const prevEvent = context.$event$;
|
|
4658
|
+
context.$qrl$ = qrl, context.$event$ ||= this;
|
|
4659
|
+
try {
|
|
4660
|
+
return invoke.call(this, context, fn, ...args);
|
|
4661
|
+
} finally {
|
|
4662
|
+
context.$qrl$ = prevQrl, context.$event$ = prevEvent;
|
|
4663
|
+
}
|
|
4664
|
+
}));
|
|
4665
|
+
}
|
|
4666
|
+
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
4637
4667
|
const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
|
|
4638
4668
|
let context = tryGetInvokeContext();
|
|
4639
4669
|
return context ? fn.apply(this, args) : (context = newInvokeContext(), context.$qrl$ = qrl,
|
|
@@ -4661,26 +4691,6 @@
|
|
|
4661
4691
|
throw console.error(`qrl ${symbol} failed to load`, err), symbolRef = null, err;
|
|
4662
4692
|
})), symbolRef;
|
|
4663
4693
|
};
|
|
4664
|
-
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
4665
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
4666
|
-
return (...args) => maybeThen(resolveLazy(), (f => {
|
|
4667
|
-
if (!isFunction(f)) {
|
|
4668
|
-
throw qError(10);
|
|
4669
|
-
}
|
|
4670
|
-
if (beforeFn && !1 === beforeFn()) {
|
|
4671
|
-
return;
|
|
4672
|
-
}
|
|
4673
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
4674
|
-
const prevQrl = context.$qrl$;
|
|
4675
|
-
const prevEvent = context.$event$;
|
|
4676
|
-
context.$qrl$ = qrl, context.$event$ ||= this;
|
|
4677
|
-
try {
|
|
4678
|
-
return invoke.call(this, context, f, ...args);
|
|
4679
|
-
} finally {
|
|
4680
|
-
context.$qrl$ = prevQrl, context.$event$ = prevEvent;
|
|
4681
|
-
}
|
|
4682
|
-
}));
|
|
4683
|
-
}
|
|
4684
4694
|
const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
|
|
4685
4695
|
const resolvedSymbol = refSymbol ?? symbol;
|
|
4686
4696
|
const hash = getSymbolHash(resolvedSymbol);
|
|
@@ -4695,7 +4705,7 @@
|
|
|
4695
4705
|
$symbol$: symbol,
|
|
4696
4706
|
$refSymbol$: refSymbol,
|
|
4697
4707
|
$hash$: hash,
|
|
4698
|
-
getFn:
|
|
4708
|
+
getFn: bindFnToContext,
|
|
4699
4709
|
$capture$: capture,
|
|
4700
4710
|
$captureRef$: captureRef,
|
|
4701
4711
|
dev: null,
|
|
@@ -5056,7 +5066,7 @@
|
|
|
5056
5066
|
}
|
|
5057
5067
|
return target;
|
|
5058
5068
|
}, exports._serialize = async function(data) {
|
|
5059
|
-
const serializationContext = createSerializationContext(null, (() => ""), (() => ""), (() => {}), new WeakMap);
|
|
5069
|
+
const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
|
|
5060
5070
|
for (const root of data) {
|
|
5061
5071
|
serializationContext.$addRoot$(root);
|
|
5062
5072
|
}
|
package/dist/core.prod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core 2.0.0-alpha.2-dev+58b6f8d
|
|
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
|
|
@@ -736,10 +736,10 @@ function clearEffects(subscriber, value) {
|
|
|
736
736
|
return subscriptionRemoved;
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
const DEBUG = !1;
|
|
740
|
-
|
|
741
739
|
const NEEDS_COMPUTATION = Symbol("invalid");
|
|
742
740
|
|
|
741
|
+
const DEBUG = !1;
|
|
742
|
+
|
|
743
743
|
const log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
744
744
|
|
|
745
745
|
const throwIfQRLNotResolved = qrl => {
|
|
@@ -1232,7 +1232,17 @@ class StoreHandler {
|
|
|
1232
1232
|
!0);
|
|
1233
1233
|
}
|
|
1234
1234
|
has(target, prop) {
|
|
1235
|
-
|
|
1235
|
+
if (prop === STORE_TARGET) {
|
|
1236
|
+
return !0;
|
|
1237
|
+
}
|
|
1238
|
+
if ("string" == typeof prop) {
|
|
1239
|
+
const ctx = tryGetInvokeContext();
|
|
1240
|
+
if (ctx) {
|
|
1241
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1242
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
1236
1246
|
}
|
|
1237
1247
|
ownKeys(target) {
|
|
1238
1248
|
const ctx = tryGetInvokeContext();
|
|
@@ -1552,8 +1562,10 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
|
1552
1562
|
const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
1553
1563
|
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, "qRender");
|
|
1554
1564
|
let componentFn;
|
|
1555
|
-
|
|
1556
|
-
container.ensureProjectionResolved(renderHost)
|
|
1565
|
+
iCtx.$effectSubscriber$ = [ subscriptionHost, EffectProperty.COMPONENT ], iCtx.$container$ = container,
|
|
1566
|
+
container.ensureProjectionResolved(renderHost);
|
|
1567
|
+
let isInlineComponent = !1;
|
|
1568
|
+
if (null === componentQRL && assertDefined(componentQRL = componentQRL || container.getHostProp(renderHost, "q:renderFn"), "No Component found at this location"),
|
|
1557
1569
|
isQrl(componentQRL)) {
|
|
1558
1570
|
(props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ) && props.children && delete props.children,
|
|
1559
1571
|
componentFn = componentQRL.getFn(iCtx);
|
|
@@ -1561,11 +1573,12 @@ const executeComponent = (container, renderHost, subscriptionHost, componentQRL,
|
|
|
1561
1573
|
const qComponentFn = componentQRL;
|
|
1562
1574
|
componentFn = () => invokeApply(iCtx, qComponentFn, [ props || EMPTY_OBJ, null, 0 ]);
|
|
1563
1575
|
} else {
|
|
1576
|
+
isInlineComponent = !0;
|
|
1564
1577
|
const inlineComponent = componentQRL;
|
|
1565
1578
|
componentFn = () => invokeApply(iCtx, inlineComponent, [ props || EMPTY_OBJ ]);
|
|
1566
1579
|
}
|
|
1567
|
-
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
1568
|
-
container.setHostProp(renderHost, ":onIdx", null), container.setHostProp(renderHost, "q:props", props),
|
|
1580
|
+
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
1581
|
+
container.setHostProp(renderHost, ":onIdx", null), container.getHostProp(renderHost, "q:props") !== props && container.setHostProp(renderHost, "q:props", props)),
|
|
1569
1582
|
vnode_isVNode(renderHost) && clearVNodeEffectDependencies(renderHost), componentFn(props))), (jsx => {
|
|
1570
1583
|
const useOnEvents = container.getHostProp(renderHost, ":on");
|
|
1571
1584
|
return useOnEvents ? maybeThen(addUseOnEvents(jsx, useOnEvents), (() => jsx)) : jsx;
|
|
@@ -2357,7 +2370,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2357
2370
|
const bHost = b.$host$;
|
|
2358
2371
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
2359
2372
|
if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
|
|
2360
|
-
const errorMessage =
|
|
2373
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
2361
2374
|
return shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage), logWarn(errorMessage),
|
|
2362
2375
|
null;
|
|
2363
2376
|
}
|
|
@@ -2410,7 +2423,7 @@ function sortedInsert(sortedArray, value) {
|
|
|
2410
2423
|
return choreUpdate(existing, value), existing;
|
|
2411
2424
|
}
|
|
2412
2425
|
|
|
2413
|
-
const version = "2.0.0-alpha.
|
|
2426
|
+
const version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
2414
2427
|
|
|
2415
2428
|
class _SharedContainer {
|
|
2416
2429
|
$version$;
|
|
@@ -2430,8 +2443,8 @@ class _SharedContainer {
|
|
|
2430
2443
|
trackSignalValue(signal, subscriber, property, data) {
|
|
2431
2444
|
return trackSignal((() => signal.value), subscriber, property, this, data);
|
|
2432
2445
|
}
|
|
2433
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
2434
|
-
return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
2446
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
2447
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
2435
2448
|
}
|
|
2436
2449
|
}
|
|
2437
2450
|
|
|
@@ -4857,14 +4870,7 @@ function inflateQRL(container, qrl) {
|
|
|
4857
4870
|
container.element && qrl.$setContainer$(container.element), qrl;
|
|
4858
4871
|
}
|
|
4859
4872
|
|
|
4860
|
-
|
|
4861
|
-
id;
|
|
4862
|
-
constructor(id) {
|
|
4863
|
-
this.id = id;
|
|
4864
|
-
}
|
|
4865
|
-
}
|
|
4866
|
-
|
|
4867
|
-
const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
4873
|
+
const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
4868
4874
|
if (!writer) {
|
|
4869
4875
|
const buffer = [];
|
|
4870
4876
|
writer = {
|
|
@@ -4884,11 +4890,13 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
|
|
|
4884
4890
|
roots.push(obj)), id;
|
|
4885
4891
|
};
|
|
4886
4892
|
const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => !1;
|
|
4893
|
+
const isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => !1;
|
|
4887
4894
|
return {
|
|
4888
4895
|
$serialize$() {
|
|
4889
4896
|
serialize(this);
|
|
4890
4897
|
},
|
|
4891
4898
|
$isSsrNode$: isSsrNode,
|
|
4899
|
+
$isDomRef$: isDomRef,
|
|
4892
4900
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
4893
4901
|
$wasSeen$,
|
|
4894
4902
|
$roots$: roots,
|
|
@@ -4957,6 +4965,8 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
|
|
|
4957
4965
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
4958
4966
|
} else if (isSsrNode(obj)) {
|
|
4959
4967
|
discoveredValues.push(obj.vnodeData);
|
|
4968
|
+
} else if (isDomRef(obj)) {
|
|
4969
|
+
discoveredValues.push(obj.id);
|
|
4960
4970
|
} else if (isJSXNode(obj)) {
|
|
4961
4971
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
4962
4972
|
} else if (Array.isArray(obj)) {
|
|
@@ -5011,7 +5021,7 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
|
|
|
5011
5021
|
const promiseResults = new WeakMap;
|
|
5012
5022
|
|
|
5013
5023
|
function serialize(serializationContext) {
|
|
5014
|
-
const {$writer$, $isSsrNode$, $setProp$, $storeProxyMap$} = serializationContext;
|
|
5024
|
+
const {$writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$} = serializationContext;
|
|
5015
5025
|
let depth = -1;
|
|
5016
5026
|
let writeType = !1;
|
|
5017
5027
|
const output = (type, value) => {
|
|
@@ -5127,12 +5137,11 @@ function serialize(serializationContext) {
|
|
|
5127
5137
|
}
|
|
5128
5138
|
output(TypeIds.Object, out);
|
|
5129
5139
|
}
|
|
5130
|
-
} else if (value
|
|
5140
|
+
} else if ($isDomRef$(value)) {
|
|
5131
5141
|
output(TypeIds.RefVNode, value.id);
|
|
5132
5142
|
} else if (value instanceof Signal) {
|
|
5133
|
-
|
|
5134
|
-
if (
|
|
5135
|
-
value instanceof WrappedSignal) {
|
|
5143
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
5144
|
+
if (value instanceof WrappedSignal) {
|
|
5136
5145
|
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
|
|
5137
5146
|
} else if (value instanceof ComputedSignal) {
|
|
5138
5147
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
@@ -5248,7 +5257,7 @@ function qrlToString(serializationContext, value) {
|
|
|
5248
5257
|
}
|
|
5249
5258
|
|
|
5250
5259
|
async function _serialize(data) {
|
|
5251
|
-
const serializationContext = createSerializationContext(null, (() => ""), (() => ""), (() => {}), new WeakMap);
|
|
5260
|
+
const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
|
|
5252
5261
|
for (const root of data) {
|
|
5253
5262
|
serializationContext.$addRoot$(root);
|
|
5254
5263
|
}
|
|
@@ -5498,10 +5507,30 @@ const isSyncQrl = value => isQrl(value) && "<sync>" == value.$symbol$;
|
|
|
5498
5507
|
const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
|
|
5499
5508
|
let _containerEl;
|
|
5500
5509
|
const qrl = async function(...args) {
|
|
5501
|
-
const
|
|
5502
|
-
return await
|
|
5510
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
5511
|
+
return await boundedFn(...args);
|
|
5503
5512
|
};
|
|
5504
5513
|
const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
|
|
5514
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
5515
|
+
return (...args) => maybeThen(resolveLazy(), (fn => {
|
|
5516
|
+
if (!isFunction(fn)) {
|
|
5517
|
+
throw qError(10);
|
|
5518
|
+
}
|
|
5519
|
+
if (beforeFn && !1 === beforeFn()) {
|
|
5520
|
+
return;
|
|
5521
|
+
}
|
|
5522
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
5523
|
+
const prevQrl = context.$qrl$;
|
|
5524
|
+
const prevEvent = context.$event$;
|
|
5525
|
+
context.$qrl$ = qrl, context.$event$ ||= this;
|
|
5526
|
+
try {
|
|
5527
|
+
return invoke.call(this, context, fn, ...args);
|
|
5528
|
+
} finally {
|
|
5529
|
+
context.$qrl$ = prevQrl, context.$event$ = prevEvent;
|
|
5530
|
+
}
|
|
5531
|
+
}));
|
|
5532
|
+
}
|
|
5533
|
+
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
5505
5534
|
const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
|
|
5506
5535
|
let context = tryGetInvokeContext();
|
|
5507
5536
|
return context ? fn.apply(this, args) : (context = newInvokeContext(), context.$qrl$ = qrl,
|
|
@@ -5529,26 +5558,6 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refS
|
|
|
5529
5558
|
throw console.error(`qrl ${symbol} failed to load`, err), symbolRef = null, err;
|
|
5530
5559
|
})), symbolRef;
|
|
5531
5560
|
};
|
|
5532
|
-
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
5533
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
5534
|
-
return (...args) => maybeThen(resolveLazy(), (f => {
|
|
5535
|
-
if (!isFunction(f)) {
|
|
5536
|
-
throw qError(10);
|
|
5537
|
-
}
|
|
5538
|
-
if (beforeFn && !1 === beforeFn()) {
|
|
5539
|
-
return;
|
|
5540
|
-
}
|
|
5541
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
5542
|
-
const prevQrl = context.$qrl$;
|
|
5543
|
-
const prevEvent = context.$event$;
|
|
5544
|
-
context.$qrl$ = qrl, context.$event$ ||= this;
|
|
5545
|
-
try {
|
|
5546
|
-
return invoke.call(this, context, f, ...args);
|
|
5547
|
-
} finally {
|
|
5548
|
-
context.$qrl$ = prevQrl, context.$event$ = prevEvent;
|
|
5549
|
-
}
|
|
5550
|
-
}));
|
|
5551
|
-
}
|
|
5552
5561
|
const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
|
|
5553
5562
|
const resolvedSymbol = refSymbol ?? symbol;
|
|
5554
5563
|
const hash = getSymbolHash(resolvedSymbol);
|
|
@@ -5563,7 +5572,7 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refS
|
|
|
5563
5572
|
$symbol$: symbol,
|
|
5564
5573
|
$refSymbol$: refSymbol,
|
|
5565
5574
|
$hash$: hash,
|
|
5566
|
-
getFn:
|
|
5575
|
+
getFn: bindFnToContext,
|
|
5567
5576
|
$capture$: capture,
|
|
5568
5577
|
$captureRef$: captureRef,
|
|
5569
5578
|
dev: null,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
6
6
|
const core = require("@qwik.dev/core");
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
9
|
+
* @qwik.dev/core 2.0.0-alpha.2-dev+58b6f8d
|
|
10
10
|
* Copyright QwikDev. All Rights Reserved.
|
|
11
11
|
* Use of this source code is governed by an MIT-style license that can be
|
|
12
12
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import { sync$, component$ } from "@qwik.dev/core";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
7
|
+
* @qwik.dev/core 2.0.0-alpha.2-dev+58b6f8d
|
|
8
8
|
* Copyright QwikDev. All Rights Reserved.
|
|
9
9
|
* Use of this source code is governed by an MIT-style license that can be
|
|
10
10
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
package/dist/loader/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const QWIK_LOADER = "(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
2
|
-
const QWIK_LOADER_DEBUG = "(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = \"__q_context__\";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && \"function\" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll(\"[on\" + infix + \"\\\\:\" + type + \"]\").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if (\"SCRIPT\" === script.tagName && \"qwik/json\" === script.getAttribute(\"type\")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = \"on\" + scope + \":\" + eventName;\n element.hasAttribute(\"preventdefault:\" + eventName) && ev.preventDefault();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");\n const qBase = container.getAttribute(\"q:base\");\n const qVersion = container.getAttribute(\"q:version\") || \"unknown\";\n const qManifest = container.getAttribute(\"q:manifest-hash\") || \"dev\";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split(\"\\n\")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, \"$1\") || \"default\";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith(\"#\");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute(\"q:instance\");\n handler = (doc[\"qFuncs_\" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = \"sync\";\n error = new Error(\"sync handler error for symbol: \" + symbol);\n }\n } else {\n const uri = url.href.split(\"#\")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = \"no-symbol\";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = \"async\");\n error = err;\n }\n }\n if (!handler) {\n emitEvent(\"qerror\", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent(\"qsymbol\", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent(\"qerror\", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => \"-\" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast(\"-document\", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, \"\", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute(\"stoppropagation:\" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast(\"-window\", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (\"interactive\" == readyState || \"complete\" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent(\"qinit\");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent(\"qidle\")));\n if (events.has(\"qvisible\")) {\n const results = querySelectorAll(\"[on\\\\:qvisible]\");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, \"\", createEvent(\"qvisible\", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (\"string\" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()";
|
|
1
|
+
const QWIK_LOADER = "(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n=\"__q_context__\",o=window,r=new Set,a=new Set([e]),i=\"replace\",c=\"forEach\",l=\"target\",f=\"getAttribute\",p=\"isConnected\",b=\"qvisible\",u=\"_qwikjson_\",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,\"[q\\\\:shadowroot]\").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&\"function\"==typeof e.then,m=(e,t,n=t.type)=>{y(\"[on\"+e+\"\\\\:\"+n+\"]\")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if(\"SCRIPT\"===n.tagName&&\"qwik/json\"===n[f](\"type\")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,\"<$1\"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c=\"on\"+o+\":\"+a;t.hasAttribute(\"preventdefault:\"+a)&&r.preventDefault(),t.hasAttribute(\"stoppropagation:\"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),a=o[f](\"q:base\"),c=o[f](\"q:version\")||\"unknown\",l=o[f](\"q:manifest-hash\")||\"dev\",b=new URL(a,e.baseURI);for(const f of h.split(\"\\n\")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,\"$1\")||\"default\",d=performance.now();let m,v,g;const A=f.startsWith(\"#\"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute(\"q:instance\");m=(e[\"qFuncs_\"+t]||[])[Number.parseInt(y)],m||(v=\"sync\",g=Error(\"sync handler error for symbol: \"+y))}else{const e=u.href.split(\"#\")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v=\"no-symbol\",g=Error(`${y} not in ${e}`))}catch(e){v||(v=\"async\"),g=e}}if(!m){E(\"qerror\",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E(\"qsymbol\",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E(\"qerror\",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>\"-\"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m(\"-document\",e,t);n&&n[f];){const o=g(n,\"\",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute(\"stoppropagation:\"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m(\"-window\",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&(\"interactive\"==s||\"complete\"==s)&&(a.forEach(d),t=1,E(\"qinit\"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E(\"qidle\"))),r.has(b))){const e=y(\"[on\\\\:\"+b+\"]\"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],\"\",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)\"string\"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,\"readystatechange\",C),C()}})(document)})()";
|
|
2
|
+
const QWIK_LOADER_DEBUG = "(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = \"__q_context__\";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && \"function\" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll(\"[on\" + infix + \"\\\\:\" + type + \"]\").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if (\"SCRIPT\" === script.tagName && \"qwik/json\" === script.getAttribute(\"type\")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = \"on\" + scope + \":\" + eventName;\n element.hasAttribute(\"preventdefault:\" + eventName) && ev.preventDefault();\n element.hasAttribute(\"stoppropagation:\" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");\n const qBase = container.getAttribute(\"q:base\");\n const qVersion = container.getAttribute(\"q:version\") || \"unknown\";\n const qManifest = container.getAttribute(\"q:manifest-hash\") || \"dev\";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split(\"\\n\")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, \"$1\") || \"default\";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith(\"#\");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute(\"q:instance\");\n handler = (doc[\"qFuncs_\" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = \"sync\";\n error = new Error(\"sync handler error for symbol: \" + symbol);\n }\n } else {\n const uri = url.href.split(\"#\")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = \"no-symbol\";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = \"async\");\n error = err;\n }\n }\n if (!handler) {\n emitEvent(\"qerror\", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent(\"qsymbol\", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent(\"qerror\", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => \"-\" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast(\"-document\", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, \"\", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute(\"stoppropagation:\" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast(\"-window\", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (\"interactive\" == readyState || \"complete\" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent(\"qinit\");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent(\"qidle\")));\n if (events.has(\"qvisible\")) {\n const results = querySelectorAll(\"[on\\\\:qvisible]\");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, \"\", createEvent(\"qvisible\", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (\"string\" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()";
|
|
3
3
|
exports.QWIK_LOADER = QWIK_LOADER;
|
|
4
4
|
exports.QWIK_LOADER_DEBUG = QWIK_LOADER_DEBUG;
|