@qwik.dev/core 2.0.0-alpha.7 → 2.0.0-alpha.8
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/dist/build/package.json +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/core-internal.d.ts +16 -3
- package/dist/core.cjs +132 -78
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +132 -79
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +112 -85
- package/dist/core.prod.mjs +121 -94
- package/dist/insights/index.qwik.cjs +96 -82
- package/dist/insights/index.qwik.mjs +96 -82
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +20 -3
- package/dist/optimizer.mjs +19 -3
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +32 -32
- package/dist/server.mjs +32 -32
- package/dist/testing/index.cjs +111 -91
- package/dist/testing/index.mjs +118 -97
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
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.8-dev+66037b5
|
|
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
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || unitlessNumbers.has(styleName) ? value : value + "px";
|
|
417
417
|
const STORE_TARGET = Symbol("store.target");
|
|
418
418
|
const STORE_HANDLER = Symbol("store.handler");
|
|
419
|
-
const
|
|
419
|
+
const STORE_ALL_PROPS = Symbol("store.all");
|
|
420
420
|
var StoreFlags;
|
|
421
421
|
!function(StoreFlags) {
|
|
422
422
|
StoreFlags[StoreFlags.NONE = 0] = "NONE", StoreFlags[StoreFlags.RECURSIVE = 1] = "RECURSIVE",
|
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
assertTrue();
|
|
464
464
|
}
|
|
465
465
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
466
|
-
effectSubscriber &&
|
|
466
|
+
effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
|
|
467
467
|
}
|
|
468
468
|
if ("toString" === prop && value === Object.prototype.toString) {
|
|
469
469
|
return this.toString;
|
|
@@ -494,7 +494,7 @@
|
|
|
494
494
|
const ctx = tryGetInvokeContext();
|
|
495
495
|
if (ctx) {
|
|
496
496
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
497
|
-
effectSubscriber &&
|
|
497
|
+
effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
@@ -502,7 +502,7 @@
|
|
|
502
502
|
ownKeys(target) {
|
|
503
503
|
const ctx = tryGetInvokeContext();
|
|
504
504
|
const effectSubscriber = ctx?.$effectSubscriber$;
|
|
505
|
-
return effectSubscriber &&
|
|
505
|
+
return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber),
|
|
506
506
|
Reflect.ownKeys(target);
|
|
507
507
|
}
|
|
508
508
|
getOwnPropertyDescriptor(target, prop) {
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function addStoreEffect(target, prop, store, effectSubscription) {
|
|
517
517
|
const effectsMap = store.$effects$ ||= new Map;
|
|
518
518
|
let effects = effectsMap.get(prop);
|
|
519
519
|
effects || (effects = new Set, effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription),
|
|
@@ -536,7 +536,7 @@
|
|
|
536
536
|
effectsToTrigger = storeEffects.get(prop);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const storeArrayValue = storeEffects?.get(
|
|
539
|
+
const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
|
|
540
540
|
if (storeArrayValue) {
|
|
541
541
|
effectsToTrigger ||= new Set;
|
|
542
542
|
for (const effect of storeArrayValue) {
|
|
@@ -660,6 +660,10 @@
|
|
|
660
660
|
if (isSignal(obj)) {
|
|
661
661
|
return obj.value;
|
|
662
662
|
}
|
|
663
|
+
if (isStore(obj)) {
|
|
664
|
+
return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$),
|
|
665
|
+
obj;
|
|
666
|
+
}
|
|
663
667
|
throw qError(QError.trackObjectWithoutProp);
|
|
664
668
|
}));
|
|
665
669
|
},
|
|
@@ -735,13 +739,13 @@
|
|
|
735
739
|
VirtualVNodeProps[VirtualVNodeProps.firstChild = 4] = "firstChild", VirtualVNodeProps[VirtualVNodeProps.lastChild = 5] = "lastChild",
|
|
736
740
|
VirtualVNodeProps[VirtualVNodeProps.PROPS_OFFSET = 6] = "PROPS_OFFSET";
|
|
737
741
|
}(VirtualVNodeProps || (VirtualVNodeProps = {}));
|
|
738
|
-
const mapApp_findIndx = (
|
|
742
|
+
const mapApp_findIndx = (array, key, start) => {
|
|
739
743
|
assertTrue();
|
|
740
744
|
let bottom = start >> 1;
|
|
741
|
-
let top =
|
|
745
|
+
let top = array.length - 2 >> 1;
|
|
742
746
|
for (;bottom <= top; ) {
|
|
743
747
|
const mid = bottom + (top - bottom >> 1);
|
|
744
|
-
const midKey =
|
|
748
|
+
const midKey = array[mid << 1];
|
|
745
749
|
if (midKey === key) {
|
|
746
750
|
return mid << 1;
|
|
747
751
|
}
|
|
@@ -749,13 +753,13 @@
|
|
|
749
753
|
}
|
|
750
754
|
return ~(bottom << 1);
|
|
751
755
|
};
|
|
752
|
-
const mapArray_set = (
|
|
753
|
-
const indx = mapApp_findIndx(
|
|
754
|
-
indx >= 0 ? null == value ?
|
|
756
|
+
const mapArray_set = (array, key, value, start) => {
|
|
757
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
758
|
+
indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(~indx, 0, key, value);
|
|
755
759
|
};
|
|
756
|
-
const mapArray_get = (
|
|
757
|
-
const indx = mapApp_findIndx(
|
|
758
|
-
return indx >= 0 ?
|
|
760
|
+
const mapArray_get = (array, key, start) => {
|
|
761
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
762
|
+
return indx >= 0 ? array[indx + 1] : null;
|
|
759
763
|
};
|
|
760
764
|
const isForeignObjectElement = elementName => build.isDev ? "foreignobject" === elementName.toLowerCase() : "foreignObject" === elementName;
|
|
761
765
|
function cloneElementWithNamespace(element, elementName, namespace) {
|
|
@@ -1140,9 +1144,10 @@
|
|
|
1140
1144
|
function expectProjection() {
|
|
1141
1145
|
const slotName = jsxValue.key;
|
|
1142
1146
|
vCurrent = vnode_getProp(vParent, slotName, (id => vnode_locate(container.rootVNode, id))),
|
|
1147
|
+
vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent,
|
|
1143
1148
|
null == vCurrent && (vNewNode = vnode_newVirtual(), build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection),
|
|
1144
1149
|
build.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection"), vnode_setProp(vNewNode, QSlot, slotName),
|
|
1145
|
-
vnode_setProp(vNewNode, ":", vParent), vnode_setProp(vParent, slotName, vNewNode));
|
|
1150
|
+
vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
|
|
1146
1151
|
}
|
|
1147
1152
|
function expectSlot() {
|
|
1148
1153
|
const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
|
|
@@ -1158,19 +1163,27 @@
|
|
|
1158
1163
|
return directGetPropsProxyProp(jsxNode, "name") || "";
|
|
1159
1164
|
}(vHost);
|
|
1160
1165
|
const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1166
|
+
if (null == vProjectedNode) {
|
|
1167
|
+
return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
|
|
1168
|
+
vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
|
|
1169
|
+
build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++),
|
|
1170
|
+
!1;
|
|
1171
|
+
}
|
|
1172
|
+
if (vProjectedNode === vCurrent) {} else {
|
|
1173
|
+
const parent = vnode_getParent(vProjectedNode);
|
|
1174
|
+
!(!parent || vnode_isElementVNode(parent) && "q:template" === vnode_getElementName(parent)) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, !1),
|
|
1175
|
+
vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()),
|
|
1176
|
+
vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
|
|
1177
|
+
build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
|
|
1178
|
+
}
|
|
1179
|
+
return !0;
|
|
1168
1180
|
}
|
|
1169
1181
|
function expectNoMore() {
|
|
1170
1182
|
if (assertFalse(), null !== vCurrent) {
|
|
1171
1183
|
for (;vCurrent; ) {
|
|
1172
1184
|
const toRemove = vCurrent;
|
|
1173
|
-
advanceToNextSibling(),
|
|
1185
|
+
advanceToNextSibling(), vParent === vnode_getParent(toRemove) && (cleanup(container, toRemove),
|
|
1186
|
+
vnode_remove(journal, vParent, toRemove, !0));
|
|
1174
1187
|
}
|
|
1175
1188
|
}
|
|
1176
1189
|
}
|
|
@@ -1390,7 +1403,7 @@
|
|
|
1390
1403
|
const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
|
|
1391
1404
|
const lookupKey = jsxNode.key || componentHash;
|
|
1392
1405
|
if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps),
|
|
1393
|
-
|
|
1406
|
+
host = vNewNode, shouldRender = !0) : (vNewNode = retrieveChildWithKey(null, lookupKey),
|
|
1394
1407
|
vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps),
|
|
1395
1408
|
host = vNewNode, shouldRender = !0), host) {
|
|
1396
1409
|
const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
|
|
@@ -1446,13 +1459,11 @@
|
|
|
1446
1459
|
}(jsxNode.children, host);
|
|
1447
1460
|
} else {
|
|
1448
1461
|
const lookupKey = jsxNode.key;
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
jsxNode.key && vnode_setProp(vNewNode, "q:key", jsxNode.key);
|
|
1455
|
-
}(), host = vNewNode), host) {
|
|
1462
|
+
const lookupKeysAreEqual = lookupKey === getKey(host);
|
|
1463
|
+
const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
|
|
1464
|
+
if (lookupKeysAreEqual ? null != vNodeComponentHash && (insertNewInlineComponent(),
|
|
1465
|
+
host = vNewNode) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewInlineComponent(),
|
|
1466
|
+
host = vNewNode), host) {
|
|
1456
1467
|
let componentHost = host;
|
|
1457
1468
|
for (;componentHost && (!vnode_isVirtualVNode(componentHost) || null === vnode_getProp(componentHost, "q:renderFn", null)); ) {
|
|
1458
1469
|
componentHost = vnode_getParent(componentHost);
|
|
@@ -1468,6 +1479,12 @@
|
|
|
1468
1479
|
build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Component), container.setHostProp(vNewNode, "q:renderFn", componentQRL),
|
|
1469
1480
|
container.setHostProp(vNewNode, "q:props", jsxProps), container.setHostProp(vNewNode, "q:key", jsxNode.key);
|
|
1470
1481
|
}
|
|
1482
|
+
function insertNewInlineComponent() {
|
|
1483
|
+
vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
|
|
1484
|
+
const jsxNode = jsxValue;
|
|
1485
|
+
build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.InlineComponent), vnode_setProp(vNewNode, "q:props", jsxNode.props),
|
|
1486
|
+
jsxNode.key && vnode_setProp(vNewNode, "q:key", jsxNode.key);
|
|
1487
|
+
}
|
|
1471
1488
|
function expectText(text) {
|
|
1472
1489
|
if (null !== vCurrent) {
|
|
1473
1490
|
if (3 === vnode_getType(vCurrent)) {
|
|
@@ -1498,7 +1515,7 @@
|
|
|
1498
1515
|
function cleanup(container, vNode) {
|
|
1499
1516
|
let vCursor = vNode;
|
|
1500
1517
|
if (vnode_isTextVNode(vNode)) {
|
|
1501
|
-
return;
|
|
1518
|
+
return void markVNodeAsDeleted(vCursor);
|
|
1502
1519
|
}
|
|
1503
1520
|
let vParent = null;
|
|
1504
1521
|
for (;;) {
|
|
@@ -1519,8 +1536,7 @@
|
|
|
1519
1536
|
if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
|
|
1520
1537
|
const attrs = vnode_getProps(vCursor);
|
|
1521
1538
|
for (let i = 0; i < attrs.length; i += 2) {
|
|
1522
|
-
|
|
1523
|
-
if (!key.startsWith(":") && isSlotProp(key)) {
|
|
1539
|
+
if (isSlotProp(attrs[i])) {
|
|
1524
1540
|
const value = attrs[i + 1];
|
|
1525
1541
|
if (value) {
|
|
1526
1542
|
attrs[i + 1] = null;
|
|
@@ -1534,7 +1550,7 @@
|
|
|
1534
1550
|
}
|
|
1535
1551
|
}
|
|
1536
1552
|
}
|
|
1537
|
-
if (
|
|
1553
|
+
if (vnode_isProjection(vCursor)) {
|
|
1538
1554
|
if (vCursor === vNode) {
|
|
1539
1555
|
const vFirstChild = vnode_getFirstChild(vCursor);
|
|
1540
1556
|
if (vFirstChild) {
|
|
@@ -1548,6 +1564,8 @@
|
|
|
1548
1564
|
continue;
|
|
1549
1565
|
}
|
|
1550
1566
|
}
|
|
1567
|
+
} else {
|
|
1568
|
+
type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
|
|
1551
1569
|
}
|
|
1552
1570
|
if (vCursor === vNode) {
|
|
1553
1571
|
return;
|
|
@@ -1896,10 +1914,10 @@
|
|
|
1896
1914
|
let aDepth = -1;
|
|
1897
1915
|
let bDepth = -1;
|
|
1898
1916
|
for (;a; ) {
|
|
1899
|
-
a = (aVNodePath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, ":", (id => vnode_locate(rootVNode, id)));
|
|
1917
|
+
a = (aVNodePath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, "q:sparent", (id => vnode_locate(rootVNode, id)));
|
|
1900
1918
|
}
|
|
1901
1919
|
for (;b; ) {
|
|
1902
|
-
b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id)));
|
|
1920
|
+
b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id)));
|
|
1903
1921
|
}
|
|
1904
1922
|
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
1905
1923
|
if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
|
|
@@ -1915,7 +1933,7 @@
|
|
|
1915
1933
|
return -1;
|
|
1916
1934
|
}
|
|
1917
1935
|
} while (cursor);
|
|
1918
|
-
return rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
1936
|
+
return rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
1919
1937
|
}
|
|
1920
1938
|
aDepth--, bDepth--;
|
|
1921
1939
|
}
|
|
@@ -1962,6 +1980,13 @@
|
|
|
1962
1980
|
}
|
|
1963
1981
|
};
|
|
1964
1982
|
const toNumber = value => "number" == typeof value ? value : -1;
|
|
1983
|
+
var SignalFlags;
|
|
1984
|
+
var WrappedSignalFlags;
|
|
1985
|
+
!function(SignalFlags) {
|
|
1986
|
+
SignalFlags[SignalFlags.INVALID = 1] = "INVALID";
|
|
1987
|
+
}(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags) {
|
|
1988
|
+
WrappedSignalFlags[WrappedSignalFlags.UNWRAP = 2] = "UNWRAP";
|
|
1989
|
+
}(WrappedSignalFlags || (WrappedSignalFlags = {}));
|
|
1965
1990
|
const throwIfQRLNotResolved = qrl => {
|
|
1966
1991
|
if (!qrl.resolved) {
|
|
1967
1992
|
throw qrl.resolve();
|
|
@@ -2022,7 +2047,7 @@
|
|
|
2022
2047
|
qDev;
|
|
2023
2048
|
}
|
|
2024
2049
|
toString() {
|
|
2025
|
-
return `[${this.constructor.name}${this.$
|
|
2050
|
+
return `[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "");
|
|
2026
2051
|
}
|
|
2027
2052
|
toJSON() {
|
|
2028
2053
|
return {
|
|
@@ -2086,23 +2111,24 @@
|
|
|
2086
2111
|
};
|
|
2087
2112
|
class ComputedSignal extends Signal {
|
|
2088
2113
|
$computeQrl$;
|
|
2089
|
-
$
|
|
2114
|
+
$flags$;
|
|
2090
2115
|
$forceRunEffects$=!1;
|
|
2091
|
-
|
|
2092
|
-
|
|
2116
|
+
[_EFFECT_BACK_REF]=null;
|
|
2117
|
+
constructor(container, fn, flags = SignalFlags.INVALID) {
|
|
2118
|
+
super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
|
|
2093
2119
|
}
|
|
2094
2120
|
$invalidate$() {
|
|
2095
|
-
this.$
|
|
2121
|
+
this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
|
|
2096
2122
|
}
|
|
2097
2123
|
force() {
|
|
2098
|
-
this.$
|
|
2124
|
+
this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, triggerEffects(this.$container$, this, this.$effects$);
|
|
2099
2125
|
}
|
|
2100
2126
|
get untrackedValue() {
|
|
2101
2127
|
const didChange = this.$computeIfNeeded$();
|
|
2102
2128
|
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
|
|
2103
2129
|
}
|
|
2104
2130
|
$computeIfNeeded$() {
|
|
2105
|
-
if (!this.$
|
|
2131
|
+
if (!(this.$flags$ & SignalFlags.INVALID)) {
|
|
2106
2132
|
return !1;
|
|
2107
2133
|
}
|
|
2108
2134
|
const computeQrl = this.$computeQrl$;
|
|
@@ -2115,7 +2141,7 @@
|
|
|
2115
2141
|
if (isPromise(untrackedValue)) {
|
|
2116
2142
|
throw qError(QError.computedNotSync, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
|
|
2117
2143
|
}
|
|
2118
|
-
this.$
|
|
2144
|
+
this.$flags$ &= ~SignalFlags.INVALID;
|
|
2119
2145
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
2120
2146
|
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
2121
2147
|
} finally {
|
|
@@ -2133,25 +2159,26 @@
|
|
|
2133
2159
|
$args$;
|
|
2134
2160
|
$func$;
|
|
2135
2161
|
$funcStr$;
|
|
2136
|
-
$
|
|
2162
|
+
$flags$;
|
|
2137
2163
|
$hostElement$=null;
|
|
2138
2164
|
$forceRunEffects$=!1;
|
|
2139
2165
|
[_EFFECT_BACK_REF]=null;
|
|
2140
|
-
constructor(container, fn, args, fnStr) {
|
|
2141
|
-
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr
|
|
2166
|
+
constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
|
|
2167
|
+
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
|
|
2168
|
+
this.$flags$ = flags;
|
|
2142
2169
|
}
|
|
2143
2170
|
$invalidate$() {
|
|
2144
|
-
this.$
|
|
2171
|
+
this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
|
|
2145
2172
|
}
|
|
2146
2173
|
force() {
|
|
2147
|
-
this.$
|
|
2174
|
+
this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, triggerEffects(this.$container$, this, this.$effects$);
|
|
2148
2175
|
}
|
|
2149
2176
|
get untrackedValue() {
|
|
2150
2177
|
const didChange = this.$computeIfNeeded$();
|
|
2151
2178
|
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
|
|
2152
2179
|
}
|
|
2153
2180
|
$computeIfNeeded$() {
|
|
2154
|
-
if (!this.$
|
|
2181
|
+
if (!(this.$flags$ & SignalFlags.INVALID)) {
|
|
2155
2182
|
return !1;
|
|
2156
2183
|
}
|
|
2157
2184
|
const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, EffectProperty.VNODE, this.$container$);
|
|
@@ -2256,7 +2283,7 @@
|
|
|
2256
2283
|
const componentFrame = options.parentComponentFrame || ssr.unclaimedProjectionComponentFrameQueue.shift();
|
|
2257
2284
|
if (componentFrame) {
|
|
2258
2285
|
const projectionAttrs = build.isDev ? [ "q:type", VirtualType.Projection ] : [];
|
|
2259
|
-
projectionAttrs.push(":", componentFrame.componentNode.id || ""), ssr.openProjection(projectionAttrs);
|
|
2286
|
+
projectionAttrs.push("q:sparent", componentFrame.componentNode.id || ""), ssr.openProjection(projectionAttrs);
|
|
2260
2287
|
const host = componentFrame.componentNode;
|
|
2261
2288
|
const node = ssr.getLastNode();
|
|
2262
2289
|
const slotName = function(host, jsx, ssr) {
|
|
@@ -2399,7 +2426,7 @@
|
|
|
2399
2426
|
const eventName = key.substring(15);
|
|
2400
2427
|
eventName && serializationCtx.$eventNames$.add(eventName);
|
|
2401
2428
|
}
|
|
2402
|
-
const version = "2.0.0-alpha.
|
|
2429
|
+
const version = "2.0.0-alpha.8-dev+66037b5";
|
|
2403
2430
|
class _SharedContainer {
|
|
2404
2431
|
$version$;
|
|
2405
2432
|
$scheduler$;
|
|
@@ -2432,7 +2459,7 @@
|
|
|
2432
2459
|
return obj[prop];
|
|
2433
2460
|
}
|
|
2434
2461
|
if (isSignal(obj)) {
|
|
2435
|
-
return assertEqual(), obj instanceof WrappedSignal ? obj : getWrapped(args);
|
|
2462
|
+
return assertEqual(), obj instanceof WrappedSignal && obj.flags & WrappedSignalFlags.UNWRAP ? obj : getWrapped(args);
|
|
2436
2463
|
}
|
|
2437
2464
|
if (isPropsProxy(obj)) {
|
|
2438
2465
|
const constProps = obj[_CONST_PROPS];
|
|
@@ -2526,7 +2553,7 @@
|
|
|
2526
2553
|
return this.$children$;
|
|
2527
2554
|
}
|
|
2528
2555
|
const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
|
|
2529
|
-
return value instanceof WrappedSignal ? value.value : value;
|
|
2556
|
+
return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
|
|
2530
2557
|
}
|
|
2531
2558
|
set(_, prop, value) {
|
|
2532
2559
|
return prop === _CONST_PROPS ? (this.$constProps$ = value, !0) : prop === _VAR_PROPS ? (this.$varProps$ = value,
|
|
@@ -2626,7 +2653,7 @@
|
|
|
2626
2653
|
return String(value);
|
|
2627
2654
|
};
|
|
2628
2655
|
const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
|
|
2629
|
-
const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62,
|
|
2656
|
+
const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62, VNodeDataChar_SLOT_PARENT = 63, VNodeDataChar_KEY = 64, VNodeDataChar_SEQ = 91, VNodeDataChar_CONTEXT = 93, VNodeDataChar_SEQ_IDX = 94, VNodeDataChar_BACK_REFS = 96, VNodeDataChar_SEPARATOR = 124, VNodeDataChar_SLOT = 126;
|
|
2630
2657
|
var VNodeJournalOpCode;
|
|
2631
2658
|
!function(VNodeJournalOpCode) {
|
|
2632
2659
|
VNodeJournalOpCode[VNodeJournalOpCode.SetText = 1] = "SetText", VNodeJournalOpCode[VNodeJournalOpCode.SetAttribute = 2] = "SetAttribute",
|
|
@@ -2677,6 +2704,10 @@
|
|
|
2677
2704
|
assertDefined();
|
|
2678
2705
|
return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
|
|
2679
2706
|
};
|
|
2707
|
+
const vnode_isProjection = vNode => {
|
|
2708
|
+
assertDefined();
|
|
2709
|
+
return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
|
|
2710
|
+
};
|
|
2680
2711
|
const ensureTextVNode = vNode => (assertTrue(vnode_isTextVNode(vNode), vnode_getNodeTypeName(vNode)),
|
|
2681
2712
|
vNode);
|
|
2682
2713
|
const ensureElementOrVirtualVNode = vNode => {
|
|
@@ -2935,7 +2966,7 @@
|
|
|
2935
2966
|
let key = journal[idx++];
|
|
2936
2967
|
"className" === key && (key = "class");
|
|
2937
2968
|
const value = journal[idx++];
|
|
2938
|
-
isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value =
|
|
2969
|
+
isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : "dangerouslySetInnerHTML" === key ? element.innerHTML = value : null == value || !1 === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
|
|
2939
2970
|
break;
|
|
2940
2971
|
|
|
2941
2972
|
case VNodeJournalOpCode.HoistStyles:
|
|
@@ -3138,8 +3169,6 @@
|
|
|
3138
3169
|
container.$setRawState$(parseInt(id), vParent), build.isDev && vnode_setAttr(null, vParent, "q:id", id);
|
|
3139
3170
|
} else if (peek() === VNodeDataChar_PROPS) {
|
|
3140
3171
|
vnode_setAttr(null, vParent, "q:props", consumeValue());
|
|
3141
|
-
} else if (peek() === VNodeDataChar_SLOT_REF) {
|
|
3142
|
-
vnode_setAttr(null, vParent, "q:sref", consumeValue());
|
|
3143
3172
|
} else if (peek() === VNodeDataChar_KEY) {
|
|
3144
3173
|
vnode_setAttr(null, vParent, "q:key", consumeValue());
|
|
3145
3174
|
} else if (peek() === VNodeDataChar_SEQ) {
|
|
@@ -3148,6 +3177,8 @@
|
|
|
3148
3177
|
vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
|
|
3149
3178
|
} else if (peek() === VNodeDataChar_BACK_REFS) {
|
|
3150
3179
|
container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
|
|
3180
|
+
} else if (peek() === VNodeDataChar_SLOT_PARENT) {
|
|
3181
|
+
vnode_setProp(vParent, "q:sparent", consumeValue());
|
|
3151
3182
|
} else if (peek() === VNodeDataChar_CONTEXT) {
|
|
3152
3183
|
vnode_setAttr(null, vParent, "q:ctx", consumeValue());
|
|
3153
3184
|
} else if (peek() === VNodeDataChar_OPEN) {
|
|
@@ -3484,7 +3515,7 @@
|
|
|
3484
3515
|
let projectionDepth = 1;
|
|
3485
3516
|
for (;projectionDepth--; ) {
|
|
3486
3517
|
for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
|
|
3487
|
-
const qSlotParent = vnode_getProp(vHost, ":", (id => vnode_locate(rootVNode, id)));
|
|
3518
|
+
const qSlotParent = vnode_getProp(vHost, "q:sparent", (id => vnode_locate(rootVNode, id)));
|
|
3488
3519
|
const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
|
|
3489
3520
|
vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
|
|
3490
3521
|
}
|
|
@@ -3858,7 +3889,7 @@
|
|
|
3858
3889
|
if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
|
|
3859
3890
|
return vNode;
|
|
3860
3891
|
}
|
|
3861
|
-
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.vNodeLocate);
|
|
3892
|
+
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
|
|
3862
3893
|
} else {
|
|
3863
3894
|
vNode = vnode_getParent(vNode);
|
|
3864
3895
|
}
|
|
@@ -4082,7 +4113,8 @@
|
|
|
4082
4113
|
const signal = target;
|
|
4083
4114
|
const d = data;
|
|
4084
4115
|
signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2],
|
|
4085
|
-
signal.$untrackedValue$ = d[3], signal.$
|
|
4116
|
+
signal.$untrackedValue$ = d[3], signal.$flags$ = d[4], signal.$hostElement$ = d[5],
|
|
4117
|
+
signal.$effects$ = new Set(d.slice(6));
|
|
4086
4118
|
break;
|
|
4087
4119
|
}
|
|
4088
4120
|
|
|
@@ -4090,7 +4122,7 @@
|
|
|
4090
4122
|
{
|
|
4091
4123
|
const computed = target;
|
|
4092
4124
|
const d = data;
|
|
4093
|
-
computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$
|
|
4125
|
+
computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID,
|
|
4094
4126
|
computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
|
|
4095
4127
|
break;
|
|
4096
4128
|
}
|
|
@@ -4185,7 +4217,7 @@
|
|
|
4185
4217
|
}
|
|
4186
4218
|
return target;
|
|
4187
4219
|
};
|
|
4188
|
-
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION,
|
|
4220
|
+
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 ];
|
|
4189
4221
|
const allocate = (container, typeId, value) => {
|
|
4190
4222
|
if (void 0 === value) {
|
|
4191
4223
|
return typeId;
|
|
@@ -4412,10 +4444,10 @@
|
|
|
4412
4444
|
} else if (value === NEEDS_COMPUTATION) {
|
|
4413
4445
|
output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
|
|
4414
4446
|
} else {
|
|
4415
|
-
if (value !==
|
|
4447
|
+
if (value !== STORE_ALL_PROPS) {
|
|
4416
4448
|
throw qError(QError.serializeErrorUnknownType, [ typeof value ]);
|
|
4417
4449
|
}
|
|
4418
|
-
output(TypeIds.Constant, Constants.
|
|
4450
|
+
output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
|
|
4419
4451
|
}
|
|
4420
4452
|
};
|
|
4421
4453
|
const writeObjectValue = (value, idx) => {
|
|
@@ -4475,9 +4507,9 @@
|
|
|
4475
4507
|
} else if ($isDomRef$(value)) {
|
|
4476
4508
|
value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
|
|
4477
4509
|
} else if (value instanceof Signal) {
|
|
4478
|
-
const v = value instanceof ComputedSignal && (value.$
|
|
4510
|
+
const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
4479
4511
|
if (value instanceof WrappedSignal) {
|
|
4480
|
-
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
4512
|
+
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
4481
4513
|
} else if (value instanceof ComputedSignal) {
|
|
4482
4514
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
4483
4515
|
v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
|
|
@@ -4618,10 +4650,11 @@
|
|
|
4618
4650
|
discoveredValues.push(k, v);
|
|
4619
4651
|
}));
|
|
4620
4652
|
} else if (obj instanceof Signal) {
|
|
4621
|
-
const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$
|
|
4622
|
-
v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(
|
|
4653
|
+
const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
|
|
4654
|
+
v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$),
|
|
4623
4655
|
obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
|
|
4624
|
-
obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal &&
|
|
4656
|
+
obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
|
|
4657
|
+
discoveredValues.push(obj.$computeQrl$));
|
|
4625
4658
|
} else if (obj instanceof Task) {
|
|
4626
4659
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
4627
4660
|
} else if (isSsrNode(obj)) {
|
|
@@ -4694,16 +4727,7 @@
|
|
|
4694
4727
|
}
|
|
4695
4728
|
};
|
|
4696
4729
|
const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
|
|
4697
|
-
|
|
4698
|
-
let hasBackRefs = !1;
|
|
4699
|
-
for (const [, effect] of effectsBackRefs) {
|
|
4700
|
-
if (effect[EffectSubscriptionProp.BACK_REF]) {
|
|
4701
|
-
hasBackRefs = !0;
|
|
4702
|
-
break;
|
|
4703
|
-
}
|
|
4704
|
-
}
|
|
4705
|
-
hasBackRefs && discoveredValues.push(effectsBackRefs);
|
|
4706
|
-
}
|
|
4730
|
+
effectsBackRefs && discoveredValues.push(effectsBackRefs);
|
|
4707
4731
|
};
|
|
4708
4732
|
const promiseResults = new WeakMap;
|
|
4709
4733
|
function filterEffectBackRefs(effectBackRef) {
|
|
@@ -4880,7 +4904,7 @@
|
|
|
4880
4904
|
Constants[Constants.True = 2] = "True", Constants[Constants.False = 3] = "False",
|
|
4881
4905
|
Constants[Constants.EmptyString = 4] = "EmptyString", Constants[Constants.EMPTY_ARRAY = 5] = "EMPTY_ARRAY",
|
|
4882
4906
|
Constants[Constants.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants[Constants.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION",
|
|
4883
|
-
Constants[Constants.
|
|
4907
|
+
Constants[Constants.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants[Constants.Slot = 9] = "Slot",
|
|
4884
4908
|
Constants[Constants.Fragment = 10] = "Fragment", Constants[Constants.NaN = 11] = "NaN",
|
|
4885
4909
|
Constants[Constants.PositiveInfinity = 12] = "PositiveInfinity", Constants[Constants.NegativeInfinity = 13] = "NegativeInfinity",
|
|
4886
4910
|
Constants[Constants.MaxSafeInt = 14] = "MaxSafeInt", Constants[Constants.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt",
|
|
@@ -5450,6 +5474,9 @@
|
|
|
5450
5474
|
input), exports._wrapProp = _wrapProp, exports._wrapSignal = (obj, prop) => {
|
|
5451
5475
|
const r = _wrapProp(obj, prop);
|
|
5452
5476
|
return r === _IMMUTABLE ? obj[prop] : r;
|
|
5477
|
+
}, exports._wrapStore = (obj, prop) => {
|
|
5478
|
+
const value = getStoreTarget(obj)[prop];
|
|
5479
|
+
return isSignal(value) ? value : new WrappedSignal(null, getProp, [ obj, prop ], null, SignalFlags.INVALID);
|
|
5453
5480
|
}, exports.component$ = onMount => componentQrl(dollar(onMount)), exports.componentQrl = componentQrl,
|
|
5454
5481
|
exports.createComputed$ = createComputed$, exports.createComputedQrl = createComputedQrl,
|
|
5455
5482
|
exports.createContextId = createContextId, exports.createElement = h, exports.createSignal = createSignal,
|