@qwik.dev/core 2.0.0-alpha.4 → 2.0.0-alpha.5
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 +2 -2
- package/dist/core.cjs +196 -106
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +196 -106
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +297 -234
- package/dist/core.prod.mjs +297 -229
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +152 -78
- package/dist/optimizer.mjs +157 -80
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +188 -98
- package/dist/server.mjs +187 -97
- package/dist/testing/index.cjs +186 -96
- package/dist/testing/index.mjs +185 -95
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
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.5-dev+cb53bbd
|
|
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
|
|
@@ -717,7 +717,7 @@ class StoreHandler {
|
|
|
717
717
|
return this.$flags$ & StoreFlags.RECURSIVE && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
|
|
718
718
|
}
|
|
719
719
|
set(target, prop, value) {
|
|
720
|
-
if (
|
|
720
|
+
if ("symbol" == typeof prop) {
|
|
721
721
|
return target[prop] = value, !0;
|
|
722
722
|
}
|
|
723
723
|
const newValue = this.$flags$ & StoreFlags.RECURSIVE ? unwrapStore(value) : value;
|
|
@@ -762,7 +762,8 @@ class StoreHandler {
|
|
|
762
762
|
function addEffect(target, prop, store, effectSubscriber) {
|
|
763
763
|
const effectsMap = store.$effects$ ||= {};
|
|
764
764
|
const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
|
|
765
|
-
ensureContainsEffect(effects, effectSubscriber), ensureContains(effectSubscriber, target)
|
|
765
|
+
ensureContainsEffect(effects, effectSubscriber), ensureContains(effectSubscriber, target),
|
|
766
|
+
ensureEffectContainsSubscriber(effectSubscriber[EffectSubscriptionsProp.EFFECT], target, store.$container$);
|
|
766
767
|
}
|
|
767
768
|
|
|
768
769
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
@@ -806,26 +807,35 @@ function clearVNodeEffectDependencies(container, value) {
|
|
|
806
807
|
const effects = vnode_getProp(value, "q:subs", container.$getObjectById$);
|
|
807
808
|
if (effects) {
|
|
808
809
|
for (let i = effects.length - 1; i >= 0; i--) {
|
|
809
|
-
clearEffects(effects[i], value
|
|
810
|
+
clearEffects(effects[i], value, effects, i, container);
|
|
810
811
|
}
|
|
812
|
+
0 === effects.length && vnode_setProp(value, "q:subs", null);
|
|
811
813
|
}
|
|
812
814
|
}
|
|
813
815
|
|
|
814
|
-
function clearSubscriberEffectDependencies(value) {
|
|
816
|
+
function clearSubscriberEffectDependencies(container, value) {
|
|
815
817
|
if (value.$effectDependencies$) {
|
|
816
818
|
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
817
|
-
clearEffects(value.$effectDependencies$[i], value
|
|
819
|
+
clearEffects(value.$effectDependencies$[i], value, value.$effectDependencies$, i, container);
|
|
818
820
|
}
|
|
821
|
+
0 === value.$effectDependencies$.length && (value.$effectDependencies$ = null);
|
|
819
822
|
}
|
|
820
823
|
}
|
|
821
824
|
|
|
822
|
-
function clearEffects(subscriber, value) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
825
|
+
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
826
|
+
let subscriptionRemoved = !1;
|
|
827
|
+
const seenSet = new Set;
|
|
828
|
+
if (subscriber instanceof WrappedSignal) {
|
|
829
|
+
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
830
|
+
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
831
|
+
const store = container.$storeProxyMap$.get(subscriber);
|
|
832
|
+
subscriptionRemoved = clearStoreEffects(getStoreHandler(store), value);
|
|
833
|
+
}
|
|
834
|
+
subscriptionRemoved && effectArray.splice(indexToRemove, 1);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
function clearSignalEffects(subscriber, value, seenSet) {
|
|
826
838
|
const effectSubscriptions = subscriber.$effects$;
|
|
827
|
-
const hostElement = subscriber.$hostElement$;
|
|
828
|
-
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
829
839
|
let subscriptionRemoved = !1;
|
|
830
840
|
if (effectSubscriptions) {
|
|
831
841
|
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
@@ -833,15 +843,55 @@ function clearEffects(subscriber, value) {
|
|
|
833
843
|
subscriptionRemoved = !0);
|
|
834
844
|
}
|
|
835
845
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
846
|
+
if (subscriber instanceof WrappedSignal) {
|
|
847
|
+
const hostElement = subscriber.$hostElement$;
|
|
848
|
+
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
849
|
+
const args = subscriber.$args$;
|
|
850
|
+
args && clearArgsEffects(args, subscriber, seenSet);
|
|
851
|
+
}
|
|
852
|
+
return subscriptionRemoved;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function clearStoreEffects(storeHandler, value) {
|
|
856
|
+
const effectSubscriptions = storeHandler.$effects$;
|
|
857
|
+
if (!effectSubscriptions) {
|
|
858
|
+
return !1;
|
|
859
|
+
}
|
|
860
|
+
let subscriptionRemoved = !1;
|
|
861
|
+
for (const key in effectSubscriptions) {
|
|
862
|
+
const effects = effectSubscriptions[key];
|
|
863
|
+
for (let i = effects.length - 1; i >= 0; i--) {
|
|
864
|
+
effects[i][EffectSubscriptionsProp.EFFECT] === value && (effects.splice(i, 1), subscriptionRemoved = !0);
|
|
840
865
|
}
|
|
866
|
+
0 === effects.length && delete effectSubscriptions[key];
|
|
841
867
|
}
|
|
842
868
|
return subscriptionRemoved;
|
|
843
869
|
}
|
|
844
870
|
|
|
871
|
+
function clearArgsEffects(args, subscriber, seenSet) {
|
|
872
|
+
for (let i = args.length - 1; i >= 0; i--) {
|
|
873
|
+
clearArgEffect(args[i], subscriber, seenSet);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function clearArgEffect(arg, subscriber, seenSet) {
|
|
878
|
+
if (!seenSet.has(arg)) {
|
|
879
|
+
if (seenSet.add(arg), isSignal(arg)) {
|
|
880
|
+
clearSignalEffects(arg, subscriber, seenSet);
|
|
881
|
+
} else if ("object" == typeof arg && null !== arg) {
|
|
882
|
+
if (isStore(arg)) {
|
|
883
|
+
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
884
|
+
} else {
|
|
885
|
+
for (const key in arg) {
|
|
886
|
+
clearArgEffect(arg[key], subscriber, seenSet);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
} else {
|
|
890
|
+
Array.isArray(arg) && clearArgsEffects(arg, subscriber, seenSet);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
845
895
|
const useResourceQrl = (qrl, opts) => {
|
|
846
896
|
const {val, set, i, iCtx} = useSequentialScope();
|
|
847
897
|
if (null != val) {
|
|
@@ -861,7 +911,18 @@ function getResourceValueAsPromise(props) {
|
|
|
861
911
|
if (isResourceReturn(resource)) {
|
|
862
912
|
if (!isServerPlatform()) {
|
|
863
913
|
const state = resource._state;
|
|
864
|
-
|
|
914
|
+
if ("pending" === state && props.onPending) {
|
|
915
|
+
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
916
|
+
}
|
|
917
|
+
if ("rejected" === state && props.onRejected) {
|
|
918
|
+
return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
|
|
919
|
+
}
|
|
920
|
+
{
|
|
921
|
+
const resolvedValue = untrack((() => resource._resolved));
|
|
922
|
+
if (void 0 !== resolvedValue) {
|
|
923
|
+
return Promise.resolve(resolvedValue).then(useBindInvokeContext(props.onResolved));
|
|
924
|
+
}
|
|
925
|
+
}
|
|
865
926
|
}
|
|
866
927
|
return resource.value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
|
|
867
928
|
}
|
|
@@ -890,7 +951,7 @@ const runResource = (task, container, host) => {
|
|
|
890
951
|
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
891
952
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
|
|
892
953
|
iCtx.$container$ = container;
|
|
893
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(task)));
|
|
954
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(container, task)));
|
|
894
955
|
const resource = task.$state$;
|
|
895
956
|
assertDefined(resource, 'useResource: when running a resource, "task.resource" must be a defined.', task);
|
|
896
957
|
const cleanups = [];
|
|
@@ -1299,6 +1360,14 @@ function escapeHTML(html) {
|
|
|
1299
1360
|
return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
|
|
1300
1361
|
}
|
|
1301
1362
|
|
|
1363
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
1364
|
+
if (!jsxDev) {
|
|
1365
|
+
return null;
|
|
1366
|
+
}
|
|
1367
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
1368
|
+
return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1302
1371
|
const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
1303
1372
|
let journal = container.$journal$;
|
|
1304
1373
|
const stack = [];
|
|
@@ -1459,7 +1528,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1459
1528
|
advanceToNextSibling(), vnode_remove(journal, vParent, toRemove, !0);
|
|
1460
1529
|
}
|
|
1461
1530
|
}
|
|
1462
|
-
function createNewElement(jsx, elementName) {
|
|
1531
|
+
function createNewElement(jsx, elementName, currentFile) {
|
|
1463
1532
|
const element = function(elementName) {
|
|
1464
1533
|
const domParentVNode = vnode_getDomParentVNode(vParent);
|
|
1465
1534
|
const {elementNamespace, elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, elementName);
|
|
@@ -1487,6 +1556,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1487
1556
|
value(element);
|
|
1488
1557
|
continue;
|
|
1489
1558
|
}
|
|
1559
|
+
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1490
1560
|
}
|
|
1491
1561
|
if (isSignal(value)) {
|
|
1492
1562
|
const signalData = new EffectPropData({
|
|
@@ -1499,13 +1569,13 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1499
1569
|
if ("textarea" !== elementName || "value" !== key) {
|
|
1500
1570
|
value = serializeAttribute(key, value, scopedStyleIdPrefix), null != value && element.setAttribute(key, String(value));
|
|
1501
1571
|
} else {
|
|
1502
|
-
if ("string" != typeof value) {
|
|
1572
|
+
if (value && "string" != typeof value) {
|
|
1503
1573
|
if (isDev) {
|
|
1504
|
-
throw qError(QError.wrongTextareaValue);
|
|
1574
|
+
throw qError(QError.wrongTextareaValue, [ currentFile, value ]);
|
|
1505
1575
|
}
|
|
1506
1576
|
continue;
|
|
1507
1577
|
}
|
|
1508
|
-
element.value = escapeHTML(value);
|
|
1578
|
+
element.value = escapeHTML(value || "");
|
|
1509
1579
|
}
|
|
1510
1580
|
} else {
|
|
1511
1581
|
element.innerHTML = value, element.setAttribute("q:container", QContainerValue.HTML);
|
|
@@ -1522,17 +1592,19 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1522
1592
|
const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
|
|
1523
1593
|
const jsxKey = jsx.key;
|
|
1524
1594
|
let needsQDispatchEventPatch = !1;
|
|
1595
|
+
const currentFile = getFileLocationFromJsx(jsx.dev);
|
|
1525
1596
|
isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey),
|
|
1526
|
-
null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx, elementName) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent)
|
|
1597
|
+
null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent),
|
|
1598
|
+
vCurrent = vNewNode, vNewNode = null, null !== vSiblings && (vSiblingsIdx -= SiblingsArray.Size)));
|
|
1527
1599
|
const jsxAttrs = [];
|
|
1528
1600
|
const props = jsx.varProps;
|
|
1529
1601
|
for (const key in props) {
|
|
1530
|
-
|
|
1531
|
-
|
|
1602
|
+
const value = props[key];
|
|
1603
|
+
null != value && mapArray_set(jsxAttrs, key, value, 0);
|
|
1532
1604
|
}
|
|
1533
1605
|
null !== jsxKey && mapArray_set(jsxAttrs, "q:key", jsxKey, 0);
|
|
1534
1606
|
const vNode = vNewNode || vCurrent;
|
|
1535
|
-
if (needsQDispatchEventPatch = function(vnode, srcAttrs) {
|
|
1607
|
+
if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile) {
|
|
1536
1608
|
vnode_ensureElementInflated(vnode);
|
|
1537
1609
|
const dstAttrs = vnode;
|
|
1538
1610
|
let srcIdx = 0;
|
|
@@ -1554,8 +1626,16 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1554
1626
|
if ("function" == typeof value) {
|
|
1555
1627
|
return void value(element);
|
|
1556
1628
|
}
|
|
1629
|
+
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1630
|
+
}
|
|
1631
|
+
if (isSignal(value)) {
|
|
1632
|
+
const signalData = new EffectPropData({
|
|
1633
|
+
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
1634
|
+
$isConst$: !1
|
|
1635
|
+
});
|
|
1636
|
+
value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
|
|
1557
1637
|
}
|
|
1558
|
-
|
|
1638
|
+
vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix)),
|
|
1559
1639
|
null === value && (dstLength = dstAttrs.length);
|
|
1560
1640
|
}
|
|
1561
1641
|
};
|
|
@@ -1576,7 +1656,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1576
1656
|
dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
1577
1657
|
} else if (null == dstKey) {
|
|
1578
1658
|
isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = !0, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]),
|
|
1579
|
-
srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
1659
|
+
srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
1580
1660
|
} else if (srcKey == dstKey) {
|
|
1581
1661
|
const srcValue = srcAttrs[srcIdx++];
|
|
1582
1662
|
srcValue !== dstAttrs[dstIdx++] && record(dstKey, srcValue), srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null,
|
|
@@ -1589,7 +1669,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1589
1669
|
}
|
|
1590
1670
|
}
|
|
1591
1671
|
return patchEventDispatch;
|
|
1592
|
-
}(vNode, jsxAttrs) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
|
|
1672
|
+
}(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
|
|
1593
1673
|
const element = vnode_getNode(vNode);
|
|
1594
1674
|
element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
|
|
1595
1675
|
const eventName = event.type;
|
|
@@ -1633,7 +1713,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
1633
1713
|
function expectVirtual(type, jsxKey) {
|
|
1634
1714
|
vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey),
|
|
1635
1715
|
null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
|
|
1636
|
-
vnode_setProp(vNewNode, "q:key", jsxKey), isDev && vnode_setProp(vNewNode || vCurrent, "q:type", type)) : vnode_insertBefore(journal, vParent, vNewNode
|
|
1716
|
+
vnode_setProp(vNewNode, "q:key", jsxKey), isDev && vnode_setProp(vNewNode || vCurrent, "q:type", type)) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
|
|
1637
1717
|
}
|
|
1638
1718
|
function expectComponent(component) {
|
|
1639
1719
|
const componentMeta = component[SERIALIZABLE_STATE];
|
|
@@ -1775,7 +1855,7 @@ function cleanup(container, vNode) {
|
|
|
1775
1855
|
const obj = seq[i];
|
|
1776
1856
|
if (isTask(obj)) {
|
|
1777
1857
|
const task = obj;
|
|
1778
|
-
clearSubscriberEffectDependencies(task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
|
|
1858
|
+
clearSubscriberEffectDependencies(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
|
|
1779
1859
|
}
|
|
1780
1860
|
}
|
|
1781
1861
|
}
|
|
@@ -1906,12 +1986,12 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
1906
1986
|
$returnValue$: null,
|
|
1907
1987
|
$executed$: !1
|
|
1908
1988
|
};
|
|
1909
|
-
chore.$promise$ = new Promise((resolve => chore.$resolve$ = resolve)), chore = sortedInsert(choreQueue, chore),
|
|
1989
|
+
chore.$promise$ = new Promise((resolve => chore.$resolve$ = resolve)), chore = sortedInsert(choreQueue, chore, container.rootVNode || null),
|
|
1910
1990
|
!journalFlushScheduled && runLater && (journalFlushScheduled = !0, schedule(ChoreType.JOURNAL_FLUSH),
|
|
1911
1991
|
scheduleDrain());
|
|
1912
|
-
return runLater ? chore.$promise$ : drainUpTo(chore);
|
|
1992
|
+
return runLater ? chore.$promise$ : drainUpTo(chore, container.rootVNode || null);
|
|
1913
1993
|
};
|
|
1914
|
-
function drainUpTo(runUptoChore) {
|
|
1994
|
+
function drainUpTo(runUptoChore, rootVNode) {
|
|
1915
1995
|
if (runUptoChore.$executed$) {
|
|
1916
1996
|
return runUptoChore.$returnValue$;
|
|
1917
1997
|
}
|
|
@@ -1920,7 +2000,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
1920
2000
|
}
|
|
1921
2001
|
for (;choreQueue.length; ) {
|
|
1922
2002
|
const nextChore = choreQueue.shift();
|
|
1923
|
-
const order = choreComparator(nextChore, runUptoChore, !1);
|
|
2003
|
+
const order = choreComparator(nextChore, runUptoChore, rootVNode, !1);
|
|
1924
2004
|
if (null === order) {
|
|
1925
2005
|
continue;
|
|
1926
2006
|
}
|
|
@@ -1932,7 +2012,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
1932
2012
|
}
|
|
1933
2013
|
const returnValue = executeChore(nextChore);
|
|
1934
2014
|
if (isPromise(returnValue)) {
|
|
1935
|
-
return returnValue.then((() => drainUpTo(runUptoChore)));
|
|
2015
|
+
return returnValue.then((() => drainUpTo(runUptoChore, rootVNode)));
|
|
1936
2016
|
}
|
|
1937
2017
|
}
|
|
1938
2018
|
return runUptoChore.$returnValue$;
|
|
@@ -2028,7 +2108,7 @@ function vNodeAlreadyDeleted(chore) {
|
|
|
2028
2108
|
return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted);
|
|
2029
2109
|
}
|
|
2030
2110
|
|
|
2031
|
-
function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
2111
|
+
function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
|
|
2032
2112
|
const macroTypeDiff = (a.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
|
|
2033
2113
|
if (0 !== macroTypeDiff) {
|
|
2034
2114
|
return macroTypeDiff;
|
|
@@ -2045,7 +2125,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2045
2125
|
return logWarn(errorMessage), null;
|
|
2046
2126
|
}
|
|
2047
2127
|
{
|
|
2048
|
-
const hostDiff = vnode_documentPosition(aHost, bHost);
|
|
2128
|
+
const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
|
|
2049
2129
|
if (0 !== hostDiff) {
|
|
2050
2130
|
return hostDiff;
|
|
2051
2131
|
}
|
|
@@ -2066,12 +2146,12 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2066
2146
|
return 0;
|
|
2067
2147
|
}
|
|
2068
2148
|
|
|
2069
|
-
function sortedFindIndex(sortedArray, value) {
|
|
2149
|
+
function sortedFindIndex(sortedArray, value, rootVNode) {
|
|
2070
2150
|
let bottom = 0;
|
|
2071
2151
|
let top = sortedArray.length;
|
|
2072
2152
|
for (;bottom < top; ) {
|
|
2073
2153
|
const middle = bottom + (top - bottom >> 1);
|
|
2074
|
-
const comp = choreComparator(value, sortedArray[middle], !0);
|
|
2154
|
+
const comp = choreComparator(value, sortedArray[middle], rootVNode, !0);
|
|
2075
2155
|
if (comp < 0) {
|
|
2076
2156
|
top = middle;
|
|
2077
2157
|
} else {
|
|
@@ -2084,8 +2164,8 @@ function sortedFindIndex(sortedArray, value) {
|
|
|
2084
2164
|
return ~bottom;
|
|
2085
2165
|
}
|
|
2086
2166
|
|
|
2087
|
-
function sortedInsert(sortedArray, value) {
|
|
2088
|
-
const idx = sortedFindIndex(sortedArray, value);
|
|
2167
|
+
function sortedInsert(sortedArray, value, rootVNode) {
|
|
2168
|
+
const idx = sortedFindIndex(sortedArray, value, rootVNode);
|
|
2089
2169
|
if (idx < 0) {
|
|
2090
2170
|
return sortedArray.splice(~idx, 0, value), value;
|
|
2091
2171
|
}
|
|
@@ -2135,7 +2215,7 @@ const runTask = (task, container, host) => {
|
|
|
2135
2215
|
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
2136
2216
|
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
|
|
2137
2217
|
iCtx.$container$ = container;
|
|
2138
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(task)));
|
|
2218
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(container, task)));
|
|
2139
2219
|
const handleError = reason => container.handleError(reason, host);
|
|
2140
2220
|
let cleanupFns = null;
|
|
2141
2221
|
const cleanup = fn => {
|
|
@@ -2552,7 +2632,7 @@ function processJSXNode(ssr, enqueue, value, options) {
|
|
|
2552
2632
|
if ("string" == typeof type) {
|
|
2553
2633
|
appendClassIfScopedStyleExists(jsx, options.styleScoped);
|
|
2554
2634
|
let qwikInspectorAttrValue = null;
|
|
2555
|
-
isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue =
|
|
2635
|
+
isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
|
|
2556
2636
|
const innerHTML = ssr.openElement(type, varPropsToSsrAttrs(jsx.varProps, jsx.constProps, ssr.serializationCtx, options.styleScoped, jsx.key), constPropsToSsrAttrs(jsx.constProps, jsx.varProps, ssr.serializationCtx, options.styleScoped), qwikInspectorAttrValue);
|
|
2557
2637
|
innerHTML && ssr.htmlNode(innerHTML), enqueue(ssr.closeElement), "head" === type ? (enqueue(ssr.additionalHeadNodes),
|
|
2558
2638
|
enqueue(ssr.emitQwikLoaderAtTopIfNeeded)) : "body" === type && enqueue(ssr.additionalBodyNodes);
|
|
@@ -2716,11 +2796,6 @@ function getSlotName(host, jsx, ssr) {
|
|
|
2716
2796
|
return directGetPropsProxyProp(jsx, "name") || "";
|
|
2717
2797
|
}
|
|
2718
2798
|
|
|
2719
|
-
function getQwikInspectorAttributeValue(jsxDev) {
|
|
2720
|
-
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
2721
|
-
return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
|
|
2722
|
-
}
|
|
2723
|
-
|
|
2724
2799
|
function appendQwikInspectorAttribute(jsx, qwikInspectorAttrValue) {
|
|
2725
2800
|
!qwikInspectorAttrValue || jsx.constProps && qwikInspectorAttr in jsx.constProps || ((jsx.constProps ||= {})[qwikInspectorAttr] = qwikInspectorAttrValue);
|
|
2726
2801
|
}
|
|
@@ -2730,7 +2805,7 @@ function appendClassIfScopedStyleExists(jsx, styleScoped) {
|
|
|
2730
2805
|
jsx.constProps.class = "");
|
|
2731
2806
|
}
|
|
2732
2807
|
|
|
2733
|
-
const version = "2.0.0-alpha.
|
|
2808
|
+
const version = "2.0.0-alpha.5-dev+cb53bbd";
|
|
2734
2809
|
|
|
2735
2810
|
class _SharedContainer {
|
|
2736
2811
|
$version$;
|
|
@@ -3827,7 +3902,7 @@ const vnode_getParent = vnode => vnode[VNodeProps.parent] || null;
|
|
|
3827
3902
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node."),
|
|
3828
3903
|
vnode[TextVNodeProps.node]);
|
|
3829
3904
|
|
|
3830
|
-
function vnode_toString(depth =
|
|
3905
|
+
function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1) {
|
|
3831
3906
|
let vnode = this;
|
|
3832
3907
|
if (0 === depth) {
|
|
3833
3908
|
return "...";
|
|
@@ -3993,17 +4068,17 @@ const aPath = [];
|
|
|
3993
4068
|
|
|
3994
4069
|
const bPath = [];
|
|
3995
4070
|
|
|
3996
|
-
const vnode_documentPosition = (a, b) => {
|
|
4071
|
+
const vnode_documentPosition = (a, b, rootVNode) => {
|
|
3997
4072
|
if (a === b) {
|
|
3998
4073
|
return 0;
|
|
3999
4074
|
}
|
|
4000
4075
|
let aDepth = -1;
|
|
4001
4076
|
let bDepth = -1;
|
|
4002
4077
|
for (;a; ) {
|
|
4003
|
-
a = (aPath[++aDepth] = a)[VNodeProps.parent];
|
|
4078
|
+
a = (aPath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, ":", (id => vnode_locate(rootVNode, id)));
|
|
4004
4079
|
}
|
|
4005
4080
|
for (;b; ) {
|
|
4006
|
-
b = (bPath[++bDepth] = b)[VNodeProps.parent];
|
|
4081
|
+
b = (bPath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id)));
|
|
4007
4082
|
}
|
|
4008
4083
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
4009
4084
|
if ((a = aPath[aDepth]) !== (b = bPath[bDepth])) {
|
|
@@ -4019,7 +4094,7 @@ const vnode_documentPosition = (a, b) => {
|
|
|
4019
4094
|
return -1;
|
|
4020
4095
|
}
|
|
4021
4096
|
} while (cursor);
|
|
4022
|
-
return 1;
|
|
4097
|
+
return rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
4023
4098
|
}
|
|
4024
4099
|
aDepth--, bDepth--;
|
|
4025
4100
|
}
|
|
@@ -4030,8 +4105,7 @@ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
|
4030
4105
|
let projectionDepth = 1;
|
|
4031
4106
|
for (;projectionDepth--; ) {
|
|
4032
4107
|
for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
|
|
4033
|
-
const
|
|
4034
|
-
const qSlotParent = qSlotParentProp && ("string" == typeof qSlotParentProp ? vnode_locate(rootVNode, qSlotParentProp) : qSlotParentProp);
|
|
4108
|
+
const qSlotParent = vnode_getProp(vHost, ":", (id => vnode_locate(rootVNode, id)));
|
|
4035
4109
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
4036
4110
|
vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
|
|
4037
4111
|
}
|
|
@@ -4497,13 +4571,10 @@ class DomContainer extends _SharedContainer {
|
|
|
4497
4571
|
if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
|
|
4498
4572
|
return vNode;
|
|
4499
4573
|
}
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
continue;
|
|
4504
|
-
}
|
|
4574
|
+
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.$vnodeLocate$);
|
|
4575
|
+
} else {
|
|
4576
|
+
vNode = vnode_getParent(vNode);
|
|
4505
4577
|
}
|
|
4506
|
-
vNode = vnode_getParent(vNode);
|
|
4507
4578
|
}
|
|
4508
4579
|
return null;
|
|
4509
4580
|
}
|
|
@@ -4581,11 +4652,6 @@ class DomContainer extends _SharedContainer {
|
|
|
4581
4652
|
|
|
4582
4653
|
const deserializedProxyMap = new WeakMap;
|
|
4583
4654
|
|
|
4584
|
-
const unwrapDeserializerProxy = value => {
|
|
4585
|
-
const unwrapped = "object" == typeof value && null !== value && value[SERIALIZER_PROXY_UNWRAP];
|
|
4586
|
-
return unwrapped || value;
|
|
4587
|
-
};
|
|
4588
|
-
|
|
4589
4655
|
const isDeserializerProxy = value => "object" == typeof value && null !== value && SERIALIZER_PROXY_UNWRAP in value;
|
|
4590
4656
|
|
|
4591
4657
|
const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
|
|
@@ -4624,9 +4690,10 @@ class DeserializationHandler {
|
|
|
4624
4690
|
return value;
|
|
4625
4691
|
}
|
|
4626
4692
|
const container = this.$container$;
|
|
4627
|
-
|
|
4628
|
-
return
|
|
4629
|
-
|
|
4693
|
+
let propValue = allocate(container, typeId, value);
|
|
4694
|
+
return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
|
|
4695
|
+
Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue,
|
|
4696
|
+
propValue;
|
|
4630
4697
|
}
|
|
4631
4698
|
has(target, property) {
|
|
4632
4699
|
return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
|
|
@@ -4656,181 +4723,184 @@ const _eagerDeserializeArray = (container, data) => {
|
|
|
4656
4723
|
const resolvers = new WeakMap;
|
|
4657
4724
|
|
|
4658
4725
|
const inflate = (container, target, typeId, data) => {
|
|
4659
|
-
if (void 0
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
inflateQRL(container, target);
|
|
4688
|
-
break;
|
|
4726
|
+
if (void 0 === typeId) {
|
|
4727
|
+
return target;
|
|
4728
|
+
}
|
|
4729
|
+
switch (typeId !== TypeIds.Object && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)),
|
|
4730
|
+
typeId) {
|
|
4731
|
+
case TypeIds.Object:
|
|
4732
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
4733
|
+
const key = deserializeData(container, data[i], data[i + 1]);
|
|
4734
|
+
const valType = data[i + 2];
|
|
4735
|
+
const valData = data[i + 3];
|
|
4736
|
+
valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
|
|
4737
|
+
get() {
|
|
4738
|
+
const value = deserializeData(container, valType, valData);
|
|
4739
|
+
return target[key] = value, value;
|
|
4740
|
+
},
|
|
4741
|
+
set(value) {
|
|
4742
|
+
Object.defineProperty(target, key, {
|
|
4743
|
+
value,
|
|
4744
|
+
writable: !0,
|
|
4745
|
+
enumerable: !0,
|
|
4746
|
+
configurable: !0
|
|
4747
|
+
});
|
|
4748
|
+
},
|
|
4749
|
+
enumerable: !0,
|
|
4750
|
+
configurable: !0
|
|
4751
|
+
}) : target[key] = deserializeData(container, valType, valData);
|
|
4752
|
+
}
|
|
4753
|
+
break;
|
|
4689
4754
|
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
|
|
4694
|
-
task.$el$ = v[3], task.$effectDependencies$ = v[4], task.$state$ = v[5];
|
|
4695
|
-
break;
|
|
4755
|
+
case TypeIds.QRL:
|
|
4756
|
+
inflateQRL(container, target);
|
|
4757
|
+
break;
|
|
4696
4758
|
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
break;
|
|
4759
|
+
case TypeIds.Task:
|
|
4760
|
+
const task = target;
|
|
4761
|
+
const v = data;
|
|
4762
|
+
task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
|
|
4763
|
+
task.$el$ = v[3], task.$effectDependencies$ = v[4], task.$state$ = v[5];
|
|
4764
|
+
break;
|
|
4704
4765
|
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4766
|
+
case TypeIds.Resource:
|
|
4767
|
+
const [resolved, result, effects] = data;
|
|
4768
|
+
const resource = target;
|
|
4769
|
+
resolved ? (resource.value = Promise.resolve(result), resource._resolved = result,
|
|
4770
|
+
resource._state = "resolved") : (resource.value = Promise.reject(result), resource._error = result,
|
|
4771
|
+
resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
|
|
4772
|
+
break;
|
|
4708
4773
|
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
const [value, flags, effects, storeEffect] = data;
|
|
4713
|
-
const handler = getStoreHandler(target);
|
|
4714
|
-
handler.$flags$ = flags, Object.assign(getStoreTarget(target), value), storeEffect && (effects[STORE_ARRAY_PROP] = storeEffect),
|
|
4715
|
-
handler.$effects$ = effects, container.$storeProxyMap$.set(value, target);
|
|
4716
|
-
break;
|
|
4717
|
-
}
|
|
4774
|
+
case TypeIds.Component:
|
|
4775
|
+
target[SERIALIZABLE_STATE][0] = data[0];
|
|
4776
|
+
break;
|
|
4718
4777
|
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4778
|
+
case TypeIds.Store:
|
|
4779
|
+
case TypeIds.StoreArray:
|
|
4780
|
+
{
|
|
4781
|
+
const [value, flags, effects, storeEffect] = data;
|
|
4782
|
+
const store = getOrCreateStore(value, flags, container);
|
|
4783
|
+
const storeHandler = getStoreHandler(store);
|
|
4784
|
+
storeEffect && (effects[STORE_ARRAY_PROP] = storeEffect), storeHandler.$effects$ = effects,
|
|
4785
|
+
target = store;
|
|
4786
|
+
break;
|
|
4787
|
+
}
|
|
4726
4788
|
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
}
|
|
4789
|
+
case TypeIds.Signal:
|
|
4790
|
+
{
|
|
4791
|
+
const signal = target;
|
|
4792
|
+
const d = data;
|
|
4793
|
+
signal.$untrackedValue$ = d[0], signal.$effects$ = d.slice(1);
|
|
4794
|
+
break;
|
|
4795
|
+
}
|
|
4735
4796
|
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4797
|
+
case TypeIds.WrappedSignal:
|
|
4798
|
+
{
|
|
4799
|
+
const signal = target;
|
|
4800
|
+
const d = data;
|
|
4801
|
+
signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal.$effectDependencies$ = d[2],
|
|
4802
|
+
signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = d.slice(5);
|
|
4803
|
+
break;
|
|
4804
|
+
}
|
|
4744
4805
|
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
}
|
|
4754
|
-
target.stack = d[2];
|
|
4755
|
-
} else {
|
|
4756
|
-
target.stack = second;
|
|
4757
|
-
}
|
|
4758
|
-
break;
|
|
4759
|
-
}
|
|
4806
|
+
case TypeIds.ComputedSignal:
|
|
4807
|
+
{
|
|
4808
|
+
const computed = target;
|
|
4809
|
+
const d = data;
|
|
4810
|
+
computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$invalid$ = !0,
|
|
4811
|
+
computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
|
|
4812
|
+
break;
|
|
4813
|
+
}
|
|
4760
4814
|
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4815
|
+
case TypeIds.Error:
|
|
4816
|
+
{
|
|
4817
|
+
const d = data;
|
|
4818
|
+
target.message = d[0];
|
|
4819
|
+
const second = d[1];
|
|
4820
|
+
if (second && Array.isArray(second)) {
|
|
4821
|
+
for (let i = 0; i < second.length; i++) {
|
|
4822
|
+
target[second[i++]] = d[i];
|
|
4767
4823
|
}
|
|
4768
|
-
|
|
4769
|
-
}
|
|
4770
|
-
|
|
4771
|
-
case TypeIds.JSXNode:
|
|
4772
|
-
{
|
|
4773
|
-
const jsx = target;
|
|
4774
|
-
const [type, varProps, constProps, children, flags, key] = data;
|
|
4775
|
-
jsx.type = type, jsx.varProps = varProps, jsx.constProps = constProps, jsx.children = children,
|
|
4776
|
-
jsx.flags = flags, jsx.key = key;
|
|
4777
|
-
break;
|
|
4824
|
+
target.stack = d[2];
|
|
4825
|
+
} else {
|
|
4826
|
+
target.stack = second;
|
|
4778
4827
|
}
|
|
4828
|
+
break;
|
|
4829
|
+
}
|
|
4779
4830
|
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
}
|
|
4787
|
-
break;
|
|
4831
|
+
case TypeIds.FormData:
|
|
4832
|
+
{
|
|
4833
|
+
const formData = target;
|
|
4834
|
+
const d = data;
|
|
4835
|
+
for (let i = 0; i < d.length; i++) {
|
|
4836
|
+
formData.append(d[i++], d[i]);
|
|
4788
4837
|
}
|
|
4838
|
+
break;
|
|
4839
|
+
}
|
|
4789
4840
|
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
}
|
|
4841
|
+
case TypeIds.JSXNode:
|
|
4842
|
+
{
|
|
4843
|
+
const jsx = target;
|
|
4844
|
+
const [type, varProps, constProps, children, flags, key] = data;
|
|
4845
|
+
jsx.type = type, jsx.varProps = varProps, jsx.constProps = constProps, jsx.children = children,
|
|
4846
|
+
jsx.flags = flags, jsx.key = key;
|
|
4847
|
+
break;
|
|
4848
|
+
}
|
|
4799
4849
|
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
break;
|
|
4850
|
+
case TypeIds.Set:
|
|
4851
|
+
{
|
|
4852
|
+
const set = target;
|
|
4853
|
+
const d = data;
|
|
4854
|
+
for (let i = 0; i < d.length; i++) {
|
|
4855
|
+
set.add(d[i]);
|
|
4807
4856
|
}
|
|
4857
|
+
break;
|
|
4858
|
+
}
|
|
4808
4859
|
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
const
|
|
4812
|
-
|
|
4813
|
-
for (
|
|
4814
|
-
|
|
4860
|
+
case TypeIds.Map:
|
|
4861
|
+
{
|
|
4862
|
+
const map = target;
|
|
4863
|
+
const d = data;
|
|
4864
|
+
for (let i = 0; i < d.length; i++) {
|
|
4865
|
+
map.set(d[i++], d[i]);
|
|
4815
4866
|
}
|
|
4816
4867
|
break;
|
|
4868
|
+
}
|
|
4817
4869
|
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4870
|
+
case TypeIds.Promise:
|
|
4871
|
+
{
|
|
4872
|
+
const promise = target;
|
|
4873
|
+
const [resolved, result] = data;
|
|
4874
|
+
const [resolve, reject] = resolvers.get(promise);
|
|
4875
|
+
resolved ? resolve(result) : reject(result);
|
|
4821
4876
|
break;
|
|
4877
|
+
}
|
|
4822
4878
|
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4879
|
+
case TypeIds.Uint8Array:
|
|
4880
|
+
const bytes = target;
|
|
4881
|
+
const buf = atob(data);
|
|
4882
|
+
let i = 0;
|
|
4883
|
+
for (const s of buf) {
|
|
4884
|
+
bytes[i++] = s.charCodeAt(0);
|
|
4885
|
+
}
|
|
4886
|
+
break;
|
|
4887
|
+
|
|
4888
|
+
case TypeIds.PropsProxy:
|
|
4889
|
+
const propsProxy = target;
|
|
4890
|
+
propsProxy[_VAR_PROPS] = 0 === data ? {} : data[0], propsProxy[_CONST_PROPS] = data[1];
|
|
4891
|
+
break;
|
|
4829
4892
|
|
|
4830
|
-
|
|
4831
|
-
|
|
4893
|
+
case TypeIds.EffectData:
|
|
4894
|
+
{
|
|
4895
|
+
const effectData = target;
|
|
4896
|
+
effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
|
|
4897
|
+
break;
|
|
4832
4898
|
}
|
|
4899
|
+
|
|
4900
|
+
default:
|
|
4901
|
+
throw qError(QError.serializeErrorNotImplemented, [ typeId ]);
|
|
4833
4902
|
}
|
|
4903
|
+
return target;
|
|
4834
4904
|
};
|
|
4835
4905
|
|
|
4836
4906
|
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
@@ -4893,10 +4963,8 @@ const allocate = (container, typeId, value) => {
|
|
|
4893
4963
|
return new ComputedSignal(container, null);
|
|
4894
4964
|
|
|
4895
4965
|
case TypeIds.Store:
|
|
4896
|
-
return createStore(container, {}, 0);
|
|
4897
|
-
|
|
4898
4966
|
case TypeIds.StoreArray:
|
|
4899
|
-
return
|
|
4967
|
+
return null;
|
|
4900
4968
|
|
|
4901
4969
|
case TypeIds.URLSearchParams:
|
|
4902
4970
|
return new URLSearchParams(value);
|
|
@@ -5424,13 +5492,13 @@ function _deserialize(rawStateData, element) {
|
|
|
5424
5492
|
return output;
|
|
5425
5493
|
}
|
|
5426
5494
|
|
|
5427
|
-
function deserializeData(container, typeId,
|
|
5495
|
+
function deserializeData(container, typeId, value) {
|
|
5428
5496
|
if (void 0 === typeId) {
|
|
5429
|
-
return
|
|
5497
|
+
return value;
|
|
5430
5498
|
}
|
|
5431
|
-
|
|
5432
|
-
return typeId >= TypeIds.Error && inflate(container,
|
|
5433
|
-
|
|
5499
|
+
let propValue = allocate(container, typeId, value);
|
|
5500
|
+
return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
|
|
5501
|
+
propValue;
|
|
5434
5502
|
}
|
|
5435
5503
|
|
|
5436
5504
|
function getObjectById(id, stateData) {
|