@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.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
|
|
@@ -316,8 +316,7 @@
|
|
|
316
316
|
const ComponentStylesPrefixContent = '⚡️';
|
|
317
317
|
/** `<some-element q:slot="...">` */
|
|
318
318
|
const QSlot = 'q:slot';
|
|
319
|
-
const QSlotParent = ':';
|
|
320
|
-
const QSlotRef = 'q:sref';
|
|
319
|
+
const QSlotParent = 'q:sparent';
|
|
321
320
|
const QSlotS = 'q:s';
|
|
322
321
|
const QStyle = 'q:style';
|
|
323
322
|
const QStyleSelector = 'style[q\\:style]';
|
|
@@ -354,6 +353,7 @@
|
|
|
354
353
|
const ResourceEvent = 'qResource';
|
|
355
354
|
const RenderEvent = 'qRender';
|
|
356
355
|
const TaskEvent = 'qTask';
|
|
356
|
+
/** `<q:slot name="...">` */
|
|
357
357
|
const QDefaultSlot = '';
|
|
358
358
|
/**
|
|
359
359
|
* Attribute to mark that this VNode has a pointer to itself from the `qwik/json` state.
|
|
@@ -1153,7 +1153,7 @@
|
|
|
1153
1153
|
|
|
1154
1154
|
const STORE_TARGET = Symbol('store.target');
|
|
1155
1155
|
const STORE_HANDLER = Symbol('store.handler');
|
|
1156
|
-
const
|
|
1156
|
+
const STORE_ALL_PROPS = Symbol('store.all');
|
|
1157
1157
|
var StoreFlags;
|
|
1158
1158
|
(function (StoreFlags) {
|
|
1159
1159
|
StoreFlags[StoreFlags["NONE"] = 0] = "NONE";
|
|
@@ -1228,7 +1228,7 @@
|
|
|
1228
1228
|
}
|
|
1229
1229
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1230
1230
|
if (effectSubscriber) {
|
|
1231
|
-
|
|
1231
|
+
addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
1234
|
if (prop === 'toString' && value === Object.prototype.toString) {
|
|
@@ -1279,7 +1279,7 @@
|
|
|
1279
1279
|
if (ctx) {
|
|
1280
1280
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1281
1281
|
if (effectSubscriber) {
|
|
1282
|
-
|
|
1282
|
+
addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
@@ -1289,7 +1289,7 @@
|
|
|
1289
1289
|
const ctx = tryGetInvokeContext();
|
|
1290
1290
|
const effectSubscriber = ctx?.$effectSubscriber$;
|
|
1291
1291
|
if (effectSubscriber) {
|
|
1292
|
-
|
|
1292
|
+
addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber);
|
|
1293
1293
|
}
|
|
1294
1294
|
return Reflect.ownKeys(target);
|
|
1295
1295
|
}
|
|
@@ -1307,7 +1307,7 @@
|
|
|
1307
1307
|
};
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1310
|
+
function addStoreEffect(target, prop, store, effectSubscription) {
|
|
1311
1311
|
const effectsMap = (store.$effects$ ||= new Map());
|
|
1312
1312
|
let effects = effectsMap.get(prop);
|
|
1313
1313
|
if (!effects) {
|
|
@@ -1343,7 +1343,7 @@
|
|
|
1343
1343
|
effectsToTrigger = storeEffects.get(prop);
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
|
-
const storeArrayValue = storeEffects?.get(
|
|
1346
|
+
const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
|
|
1347
1347
|
if (storeArrayValue) {
|
|
1348
1348
|
effectsToTrigger ||= new Set();
|
|
1349
1349
|
for (const effect of storeArrayValue) {
|
|
@@ -1592,6 +1592,11 @@
|
|
|
1592
1592
|
else if (isSignal(obj)) {
|
|
1593
1593
|
return obj.value;
|
|
1594
1594
|
}
|
|
1595
|
+
else if (isStore(obj)) {
|
|
1596
|
+
// track whole store
|
|
1597
|
+
addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$);
|
|
1598
|
+
return obj;
|
|
1599
|
+
}
|
|
1595
1600
|
else {
|
|
1596
1601
|
throw qError(QError.trackObjectWithoutProp);
|
|
1597
1602
|
}
|
|
@@ -1749,13 +1754,13 @@
|
|
|
1749
1754
|
VirtualVNodeProps[VirtualVNodeProps["PROPS_OFFSET"] = 6] = "PROPS_OFFSET";
|
|
1750
1755
|
})(VirtualVNodeProps || (VirtualVNodeProps = {}));
|
|
1751
1756
|
|
|
1752
|
-
const mapApp_findIndx = (
|
|
1757
|
+
const mapApp_findIndx = (array, key, start) => {
|
|
1753
1758
|
assertTrue(start % 2 === 0, 'Expecting even number.');
|
|
1754
1759
|
let bottom = start >> 1;
|
|
1755
|
-
let top = (
|
|
1760
|
+
let top = (array.length - 2) >> 1;
|
|
1756
1761
|
while (bottom <= top) {
|
|
1757
1762
|
const mid = bottom + ((top - bottom) >> 1);
|
|
1758
|
-
const midKey =
|
|
1763
|
+
const midKey = array[mid << 1];
|
|
1759
1764
|
if (midKey === key) {
|
|
1760
1765
|
return mid << 1;
|
|
1761
1766
|
}
|
|
@@ -1768,24 +1773,24 @@
|
|
|
1768
1773
|
}
|
|
1769
1774
|
return (bottom << 1) ^ -1;
|
|
1770
1775
|
};
|
|
1771
|
-
const mapArray_set = (
|
|
1772
|
-
const indx = mapApp_findIndx(
|
|
1776
|
+
const mapArray_set = (array, key, value, start) => {
|
|
1777
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
1773
1778
|
if (indx >= 0) {
|
|
1774
1779
|
if (value == null) {
|
|
1775
|
-
|
|
1780
|
+
array.splice(indx, 2);
|
|
1776
1781
|
}
|
|
1777
1782
|
else {
|
|
1778
|
-
|
|
1783
|
+
array[indx + 1] = value;
|
|
1779
1784
|
}
|
|
1780
1785
|
}
|
|
1781
1786
|
else if (value != null) {
|
|
1782
|
-
|
|
1787
|
+
array.splice(indx ^ -1, 0, key, value);
|
|
1783
1788
|
}
|
|
1784
1789
|
};
|
|
1785
|
-
const mapArray_get = (
|
|
1786
|
-
const indx = mapApp_findIndx(
|
|
1790
|
+
const mapArray_get = (array, key, start) => {
|
|
1791
|
+
const indx = mapApp_findIndx(array, key, start);
|
|
1787
1792
|
if (indx >= 0) {
|
|
1788
|
-
return
|
|
1793
|
+
return array[indx + 1];
|
|
1789
1794
|
}
|
|
1790
1795
|
else {
|
|
1791
1796
|
return null;
|
|
@@ -2353,9 +2358,6 @@
|
|
|
2353
2358
|
function isSlotProp(prop) {
|
|
2354
2359
|
return !prop.startsWith('q:') && !prop.startsWith(NON_SERIALIZABLE_MARKER_PREFIX);
|
|
2355
2360
|
}
|
|
2356
|
-
function isParentSlotProp(prop) {
|
|
2357
|
-
return prop.startsWith(QSlotParent);
|
|
2358
|
-
}
|
|
2359
2361
|
/** @internal */
|
|
2360
2362
|
const _restProps = (props, omit, target = {}) => {
|
|
2361
2363
|
let constPropsTarget = null;
|
|
@@ -2749,6 +2751,8 @@
|
|
|
2749
2751
|
// console.log('expectProjection', JSON.stringify(slotName));
|
|
2750
2752
|
vCurrent = vnode_getProp(vParent, // The parent is the component and it should have our portal.
|
|
2751
2753
|
slotName, (id) => vnode_locate(container.rootVNode, id));
|
|
2754
|
+
// if projection is marked as deleted then we need to create a new one
|
|
2755
|
+
vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent;
|
|
2752
2756
|
if (vCurrent == null) {
|
|
2753
2757
|
vNewNode = vnode_newVirtual();
|
|
2754
2758
|
// you may be tempted to add the projection into the current parent, but
|
|
@@ -2785,6 +2789,19 @@
|
|
|
2785
2789
|
}
|
|
2786
2790
|
else if (vProjectedNode === vCurrent) ;
|
|
2787
2791
|
else {
|
|
2792
|
+
const parent = vnode_getParent(vProjectedNode);
|
|
2793
|
+
const isAlreadyProjected = !!parent && !(vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate);
|
|
2794
|
+
if (isAlreadyProjected && vParent !== parent) {
|
|
2795
|
+
/**
|
|
2796
|
+
* The node is already projected, but structure has been changed. In next steps we will
|
|
2797
|
+
* insert the vProjectedNode at the end. However we will find existing projection elements
|
|
2798
|
+
* (from already projected THE SAME projection as vProjectedNode!) during
|
|
2799
|
+
* vnode_insertBefore. We need to remove vnode from the vnode tree to avoid referencing it
|
|
2800
|
+
* to self and cause infinite loop. Don't remove it from DOM to avoid additional operations
|
|
2801
|
+
* and flickering.
|
|
2802
|
+
*/
|
|
2803
|
+
vnode_remove(journal, parent, vProjectedNode, false);
|
|
2804
|
+
}
|
|
2788
2805
|
// move from q:template to the target node
|
|
2789
2806
|
vnode_insertBefore(journal, vParent, (vNewNode = vProjectedNode), vCurrent && getInsertBefore());
|
|
2790
2807
|
vnode_setProp(vNewNode, QSlot, slotNameKey);
|
|
@@ -2838,8 +2855,8 @@
|
|
|
2838
2855
|
while (vCurrent) {
|
|
2839
2856
|
const toRemove = vCurrent;
|
|
2840
2857
|
advanceToNextSibling();
|
|
2841
|
-
cleanup(container, toRemove);
|
|
2842
2858
|
if (vParent === vnode_getParent(toRemove)) {
|
|
2859
|
+
cleanup(container, toRemove);
|
|
2843
2860
|
// If we are diffing projection than the parent is not the parent of the node.
|
|
2844
2861
|
// If that is the case we don't want to remove the node from the parent.
|
|
2845
2862
|
vnode_remove(journal, vParent, toRemove, true);
|
|
@@ -3279,10 +3296,8 @@
|
|
|
3279
3296
|
}
|
|
3280
3297
|
else if (!hashesAreEqual) {
|
|
3281
3298
|
insertNewComponent(host, componentQRL, jsxProps);
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
shouldRender = true;
|
|
3285
|
-
}
|
|
3299
|
+
host = vNewNode;
|
|
3300
|
+
shouldRender = true;
|
|
3286
3301
|
}
|
|
3287
3302
|
if (host) {
|
|
3288
3303
|
const vNodeProps = vnode_getProp(host, ELEMENT_PROPS, container.$getObjectById$);
|
|
@@ -3303,6 +3318,7 @@
|
|
|
3303
3318
|
const lookupKey = jsxNode.key;
|
|
3304
3319
|
const vNodeLookupKey = getKey(host);
|
|
3305
3320
|
const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
|
|
3321
|
+
const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
|
|
3306
3322
|
if (!lookupKeysAreEqual) {
|
|
3307
3323
|
// See if we already have this inline component later on.
|
|
3308
3324
|
vNewNode = retrieveChildWithKey(null, lookupKey);
|
|
@@ -3316,6 +3332,11 @@
|
|
|
3316
3332
|
}
|
|
3317
3333
|
host = vNewNode;
|
|
3318
3334
|
}
|
|
3335
|
+
// inline components don't have component hash - q:renderFn prop, so it should be null
|
|
3336
|
+
else if (vNodeComponentHash != null) {
|
|
3337
|
+
insertNewInlineComponent();
|
|
3338
|
+
host = vNewNode;
|
|
3339
|
+
}
|
|
3319
3340
|
if (host) {
|
|
3320
3341
|
let componentHost = host;
|
|
3321
3342
|
// Find the closest component host which has `OnRender` prop. This is need for subscriptions context.
|
|
@@ -3460,6 +3481,7 @@
|
|
|
3460
3481
|
let vCursor = vNode;
|
|
3461
3482
|
// Depth first traversal
|
|
3462
3483
|
if (vnode_isTextVNode(vNode)) {
|
|
3484
|
+
markVNodeAsDeleted(vCursor);
|
|
3463
3485
|
// Text nodes don't have subscriptions or children;
|
|
3464
3486
|
return;
|
|
3465
3487
|
}
|
|
@@ -3495,7 +3517,7 @@
|
|
|
3495
3517
|
const attrs = vnode_getProps(vCursor);
|
|
3496
3518
|
for (let i = 0; i < attrs.length; i = i + 2) {
|
|
3497
3519
|
const key = attrs[i];
|
|
3498
|
-
if (
|
|
3520
|
+
if (isSlotProp(key)) {
|
|
3499
3521
|
const value = attrs[i + 1];
|
|
3500
3522
|
if (value) {
|
|
3501
3523
|
attrs[i + 1] = null; // prevent infinite loop
|
|
@@ -3512,7 +3534,7 @@
|
|
|
3512
3534
|
}
|
|
3513
3535
|
}
|
|
3514
3536
|
}
|
|
3515
|
-
const isProjection =
|
|
3537
|
+
const isProjection = vnode_isProjection(vCursor);
|
|
3516
3538
|
// Descend into children
|
|
3517
3539
|
if (!isProjection) {
|
|
3518
3540
|
// Only if it is not a projection
|
|
@@ -3535,6 +3557,9 @@
|
|
|
3535
3557
|
}
|
|
3536
3558
|
}
|
|
3537
3559
|
}
|
|
3560
|
+
else if (type & VNodeFlags.Text) {
|
|
3561
|
+
markVNodeAsDeleted(vCursor);
|
|
3562
|
+
}
|
|
3538
3563
|
// Out of children
|
|
3539
3564
|
if (vCursor === vNode) {
|
|
3540
3565
|
// we are where we started, this means that vNode has no children, so we are done.
|
|
@@ -4473,6 +4498,15 @@
|
|
|
4473
4498
|
const DEBUG = false;
|
|
4474
4499
|
// eslint-disable-next-line no-console
|
|
4475
4500
|
const log = (...args) => console.log('SIGNAL', ...args.map(qwikDebugToString));
|
|
4501
|
+
var SignalFlags;
|
|
4502
|
+
(function (SignalFlags) {
|
|
4503
|
+
SignalFlags[SignalFlags["INVALID"] = 1] = "INVALID";
|
|
4504
|
+
})(SignalFlags || (SignalFlags = {}));
|
|
4505
|
+
var WrappedSignalFlags;
|
|
4506
|
+
(function (WrappedSignalFlags) {
|
|
4507
|
+
// should subscribe to value and be unwrapped for PropsProxy
|
|
4508
|
+
WrappedSignalFlags[WrappedSignalFlags["UNWRAP"] = 2] = "UNWRAP";
|
|
4509
|
+
})(WrappedSignalFlags || (WrappedSignalFlags = {}));
|
|
4476
4510
|
const throwIfQRLNotResolved = (qrl) => {
|
|
4477
4511
|
const resolved = qrl.resolved;
|
|
4478
4512
|
if (!resolved) {
|
|
@@ -4565,7 +4599,7 @@
|
|
|
4565
4599
|
}
|
|
4566
4600
|
}
|
|
4567
4601
|
toString() {
|
|
4568
|
-
return (`[${this.constructor.name}${this.$
|
|
4602
|
+
return (`[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? ' INVALID' : ''} ${String(this.$untrackedValue$)}]` +
|
|
4569
4603
|
(Array.from(this.$effects$ || [])
|
|
4570
4604
|
.map((e) => '\n -> ' + pad(qwikDebugToString(e[0]), ' '))
|
|
4571
4605
|
.join('\n') || ''));
|
|
@@ -4672,18 +4706,21 @@
|
|
|
4672
4706
|
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
|
|
4673
4707
|
*/
|
|
4674
4708
|
$computeQrl$;
|
|
4709
|
+
$flags$;
|
|
4710
|
+
$forceRunEffects$ = false;
|
|
4711
|
+
[_EFFECT_BACK_REF] = null;
|
|
4712
|
+
constructor(container, fn,
|
|
4675
4713
|
// We need a separate flag to know when the computation needs running because
|
|
4676
4714
|
// we need the old value to know if effects need running after computation
|
|
4677
|
-
|
|
4678
|
-
$forceRunEffects$ = false;
|
|
4679
|
-
constructor(container, fn) {
|
|
4715
|
+
flags = SignalFlags.INVALID) {
|
|
4680
4716
|
// The value is used for comparison when signals trigger, which can only happen
|
|
4681
4717
|
// when it was calculated before. Therefore we can pass whatever we like.
|
|
4682
4718
|
super(container, NEEDS_COMPUTATION);
|
|
4683
4719
|
this.$computeQrl$ = fn;
|
|
4720
|
+
this.$flags$ = flags;
|
|
4684
4721
|
}
|
|
4685
4722
|
$invalidate$() {
|
|
4686
|
-
this.$
|
|
4723
|
+
this.$flags$ |= SignalFlags.INVALID;
|
|
4687
4724
|
this.$forceRunEffects$ = false;
|
|
4688
4725
|
// We should only call subscribers if the calculation actually changed.
|
|
4689
4726
|
// Therefore, we need to calculate the value now.
|
|
@@ -4694,7 +4731,7 @@
|
|
|
4694
4731
|
* remained the same object
|
|
4695
4732
|
*/
|
|
4696
4733
|
force() {
|
|
4697
|
-
this.$
|
|
4734
|
+
this.$flags$ |= SignalFlags.INVALID;
|
|
4698
4735
|
this.$forceRunEffects$ = false;
|
|
4699
4736
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
4700
4737
|
}
|
|
@@ -4707,7 +4744,7 @@
|
|
|
4707
4744
|
return this.$untrackedValue$;
|
|
4708
4745
|
}
|
|
4709
4746
|
$computeIfNeeded$() {
|
|
4710
|
-
if (!this.$
|
|
4747
|
+
if (!(this.$flags$ & SignalFlags.INVALID)) {
|
|
4711
4748
|
return false;
|
|
4712
4749
|
}
|
|
4713
4750
|
const computeQrl = this.$computeQrl$;
|
|
@@ -4724,7 +4761,7 @@
|
|
|
4724
4761
|
]);
|
|
4725
4762
|
}
|
|
4726
4763
|
DEBUG && log('Signal.$compute$', untrackedValue);
|
|
4727
|
-
this.$
|
|
4764
|
+
this.$flags$ &= ~SignalFlags.INVALID;
|
|
4728
4765
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
4729
4766
|
if (didChange) {
|
|
4730
4767
|
this.$untrackedValue$ = untrackedValue;
|
|
@@ -4749,20 +4786,22 @@
|
|
|
4749
4786
|
$args$;
|
|
4750
4787
|
$func$;
|
|
4751
4788
|
$funcStr$;
|
|
4752
|
-
|
|
4753
|
-
// we need the old value to know if effects need running after computation
|
|
4754
|
-
$invalid$ = true;
|
|
4789
|
+
$flags$;
|
|
4755
4790
|
$hostElement$ = null;
|
|
4756
4791
|
$forceRunEffects$ = false;
|
|
4757
4792
|
[_EFFECT_BACK_REF] = null;
|
|
4758
|
-
constructor(container, fn, args, fnStr
|
|
4793
|
+
constructor(container, fn, args, fnStr,
|
|
4794
|
+
// We need a separate flag to know when the computation needs running because
|
|
4795
|
+
// we need the old value to know if effects need running after computation
|
|
4796
|
+
flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
|
|
4759
4797
|
super(container, NEEDS_COMPUTATION);
|
|
4760
4798
|
this.$args$ = args;
|
|
4761
4799
|
this.$func$ = fn;
|
|
4762
4800
|
this.$funcStr$ = fnStr;
|
|
4801
|
+
this.$flags$ = flags;
|
|
4763
4802
|
}
|
|
4764
4803
|
$invalidate$() {
|
|
4765
|
-
this.$
|
|
4804
|
+
this.$flags$ |= SignalFlags.INVALID;
|
|
4766
4805
|
this.$forceRunEffects$ = false;
|
|
4767
4806
|
// We should only call subscribers if the calculation actually changed.
|
|
4768
4807
|
// Therefore, we need to calculate the value now.
|
|
@@ -4773,7 +4812,7 @@
|
|
|
4773
4812
|
* remained the same object
|
|
4774
4813
|
*/
|
|
4775
4814
|
force() {
|
|
4776
|
-
this.$
|
|
4815
|
+
this.$flags$ |= SignalFlags.INVALID;
|
|
4777
4816
|
this.$forceRunEffects$ = false;
|
|
4778
4817
|
triggerEffects(this.$container$, this, this.$effects$);
|
|
4779
4818
|
}
|
|
@@ -4786,10 +4825,12 @@
|
|
|
4786
4825
|
return this.$untrackedValue$;
|
|
4787
4826
|
}
|
|
4788
4827
|
$computeIfNeeded$() {
|
|
4789
|
-
if (!this.$
|
|
4828
|
+
if (!(this.$flags$ & SignalFlags.INVALID)) {
|
|
4790
4829
|
return false;
|
|
4791
4830
|
}
|
|
4792
4831
|
const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
|
|
4832
|
+
// TODO: we should remove invalid flag here
|
|
4833
|
+
// this.$flags$ &= ~SignalFlags.INVALID;
|
|
4793
4834
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
4794
4835
|
if (didChange) {
|
|
4795
4836
|
this.$untrackedValue$ = untrackedValue;
|
|
@@ -4951,7 +4992,7 @@
|
|
|
4951
4992
|
if (componentFrame) {
|
|
4952
4993
|
const compId = componentFrame.componentNode.id || '';
|
|
4953
4994
|
const projectionAttrs = build.isDev ? [DEBUG_TYPE, VirtualType.Projection] : [];
|
|
4954
|
-
projectionAttrs.push(
|
|
4995
|
+
projectionAttrs.push(QSlotParent, compId);
|
|
4955
4996
|
ssr.openProjection(projectionAttrs);
|
|
4956
4997
|
const host = componentFrame.componentNode;
|
|
4957
4998
|
const node = ssr.getLastNode();
|
|
@@ -5219,7 +5260,7 @@
|
|
|
5219
5260
|
*
|
|
5220
5261
|
* @public
|
|
5221
5262
|
*/
|
|
5222
|
-
const version = "2.0.0-alpha.
|
|
5263
|
+
const version = "2.0.0-alpha.8-dev+66037b5";
|
|
5223
5264
|
|
|
5224
5265
|
/** @internal */
|
|
5225
5266
|
class _SharedContainer {
|
|
@@ -5274,7 +5315,7 @@
|
|
|
5274
5315
|
}
|
|
5275
5316
|
if (isSignal(obj)) {
|
|
5276
5317
|
assertEqual(prop, 'value', 'Left side is a signal, prop must be value');
|
|
5277
|
-
if (obj instanceof WrappedSignal) {
|
|
5318
|
+
if (obj instanceof WrappedSignal && obj.flags & WrappedSignalFlags.UNWRAP) {
|
|
5278
5319
|
return obj;
|
|
5279
5320
|
}
|
|
5280
5321
|
return getWrapped(args);
|
|
@@ -5300,6 +5341,17 @@
|
|
|
5300
5341
|
// We need to forward the access to the original object
|
|
5301
5342
|
return getWrapped(args);
|
|
5302
5343
|
};
|
|
5344
|
+
/** @internal */
|
|
5345
|
+
const _wrapStore = (obj, prop) => {
|
|
5346
|
+
const target = getStoreTarget(obj);
|
|
5347
|
+
const value = target[prop];
|
|
5348
|
+
if (isSignal(value)) {
|
|
5349
|
+
return value;
|
|
5350
|
+
}
|
|
5351
|
+
else {
|
|
5352
|
+
return new WrappedSignal(null, getProp, [obj, prop], null, SignalFlags.INVALID);
|
|
5353
|
+
}
|
|
5354
|
+
};
|
|
5303
5355
|
/** @internal @deprecated v1 compat */
|
|
5304
5356
|
const _wrapSignal = (obj, prop) => {
|
|
5305
5357
|
const r = _wrapProp(obj, prop);
|
|
@@ -5570,7 +5622,9 @@
|
|
|
5570
5622
|
? this.$constProps$[prop]
|
|
5571
5623
|
: this.$varProps$[prop];
|
|
5572
5624
|
// a proxied value that the optimizer made
|
|
5573
|
-
return value instanceof WrappedSignal
|
|
5625
|
+
return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP
|
|
5626
|
+
? value.value
|
|
5627
|
+
: value;
|
|
5574
5628
|
}
|
|
5575
5629
|
set(_, prop, value) {
|
|
5576
5630
|
if (prop === _CONST_PROPS) {
|
|
@@ -5804,8 +5858,8 @@
|
|
|
5804
5858
|
ID_CHAR: /* ********* */ '=',
|
|
5805
5859
|
PROPS: /* ************** */ 62, // `>` - `q:props' - Component Props
|
|
5806
5860
|
PROPS_CHAR: /* ****** */ '>',
|
|
5807
|
-
|
|
5808
|
-
|
|
5861
|
+
SLOT_PARENT: /* ******** */ 63, // `?` - `q:sparent` - Slot parent.
|
|
5862
|
+
SLOT_PARENT_CHAR: /* */ '?',
|
|
5809
5863
|
KEY: /* **************** */ 64, // `@` - `q:key` - Element key.
|
|
5810
5864
|
KEY_CHAR: /* ******** */ '@',
|
|
5811
5865
|
SEQ: /* **************** */ 91, // `[` - `q:seq' - Seq value from `useSequentialScope()`
|
|
@@ -6053,6 +6107,12 @@
|
|
|
6053
6107
|
const flag = vNode[VNodeProps.flags];
|
|
6054
6108
|
return (flag & VNodeFlags.Virtual) === VNodeFlags.Virtual;
|
|
6055
6109
|
};
|
|
6110
|
+
const vnode_isProjection = (vNode) => {
|
|
6111
|
+
assertDefined(vNode, 'Missing vNode');
|
|
6112
|
+
const flag = vNode[VNodeProps.flags];
|
|
6113
|
+
return ((flag & VNodeFlags.Virtual) === VNodeFlags.Virtual &&
|
|
6114
|
+
vnode_getProp(vNode, QSlot, null) !== null);
|
|
6115
|
+
};
|
|
6056
6116
|
const ensureTextVNode = (vNode) => {
|
|
6057
6117
|
assertTrue(vnode_isTextVNode(vNode), 'Expecting TextVNode was: ' + vnode_getNodeTypeName(vNode));
|
|
6058
6118
|
return vNode;
|
|
@@ -6497,7 +6557,7 @@
|
|
|
6497
6557
|
element[key] = parseBoolean(value);
|
|
6498
6558
|
}
|
|
6499
6559
|
else if (key === 'value' && key in element) {
|
|
6500
|
-
element.value =
|
|
6560
|
+
element.value = String(value);
|
|
6501
6561
|
}
|
|
6502
6562
|
else if (key === dangerouslySetInnerHTML) {
|
|
6503
6563
|
element.innerHTML = value;
|
|
@@ -7249,9 +7309,6 @@
|
|
|
7249
7309
|
else if (peek() === VNodeDataChar.PROPS) {
|
|
7250
7310
|
vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
|
|
7251
7311
|
}
|
|
7252
|
-
else if (peek() === VNodeDataChar.SLOT_REF) {
|
|
7253
|
-
vnode_setAttr(null, vParent, QSlotRef, consumeValue());
|
|
7254
|
-
}
|
|
7255
7312
|
else if (peek() === VNodeDataChar.KEY) {
|
|
7256
7313
|
vnode_setAttr(null, vParent, ELEMENT_KEY, consumeValue());
|
|
7257
7314
|
}
|
|
@@ -7267,6 +7324,9 @@
|
|
|
7267
7324
|
}
|
|
7268
7325
|
setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
|
|
7269
7326
|
}
|
|
7327
|
+
else if (peek() === VNodeDataChar.SLOT_PARENT) {
|
|
7328
|
+
vnode_setProp(vParent, QSlotParent, consumeValue());
|
|
7329
|
+
}
|
|
7270
7330
|
else if (peek() === VNodeDataChar.CONTEXT) {
|
|
7271
7331
|
vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
|
|
7272
7332
|
}
|
|
@@ -8169,7 +8229,7 @@
|
|
|
8169
8229
|
$styleIds$ = null;
|
|
8170
8230
|
$renderCount$ = 0;
|
|
8171
8231
|
constructor(element) {
|
|
8172
|
-
super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute(
|
|
8232
|
+
super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute(QLocaleAttr));
|
|
8173
8233
|
this.qContainer = element.getAttribute(QContainerAttr);
|
|
8174
8234
|
if (!this.qContainer) {
|
|
8175
8235
|
throw qError(QError.elementWithoutContainer);
|
|
@@ -8569,8 +8629,9 @@
|
|
|
8569
8629
|
signal.$args$ = d[1];
|
|
8570
8630
|
signal[_EFFECT_BACK_REF] = d[2];
|
|
8571
8631
|
signal.$untrackedValue$ = d[3];
|
|
8572
|
-
signal.$
|
|
8573
|
-
signal.$
|
|
8632
|
+
signal.$flags$ = d[4];
|
|
8633
|
+
signal.$hostElement$ = d[5];
|
|
8634
|
+
signal.$effects$ = new Set(d.slice(6));
|
|
8574
8635
|
break;
|
|
8575
8636
|
}
|
|
8576
8637
|
case TypeIds.ComputedSignal: {
|
|
@@ -8582,7 +8643,7 @@
|
|
|
8582
8643
|
computed.$untrackedValue$ = d[2];
|
|
8583
8644
|
}
|
|
8584
8645
|
else {
|
|
8585
|
-
computed.$
|
|
8646
|
+
computed.$flags$ |= SignalFlags.INVALID;
|
|
8586
8647
|
/**
|
|
8587
8648
|
* If we try to compute value and the qrl is not resolved, then system throws an error with
|
|
8588
8649
|
* qrl promise. To prevent that we should early resolve computed qrl while computed
|
|
@@ -8690,7 +8751,7 @@
|
|
|
8690
8751
|
EMPTY_ARRAY,
|
|
8691
8752
|
EMPTY_OBJ,
|
|
8692
8753
|
NEEDS_COMPUTATION,
|
|
8693
|
-
|
|
8754
|
+
STORE_ALL_PROPS,
|
|
8694
8755
|
Slot,
|
|
8695
8756
|
Fragment,
|
|
8696
8757
|
NaN,
|
|
@@ -8995,14 +9056,15 @@
|
|
|
8995
9056
|
*/
|
|
8996
9057
|
const v = obj instanceof WrappedSignal
|
|
8997
9058
|
? obj.untrackedValue
|
|
8998
|
-
: obj instanceof ComputedSignal &&
|
|
9059
|
+
: obj instanceof ComputedSignal &&
|
|
9060
|
+
(obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj))
|
|
8999
9061
|
? NEEDS_COMPUTATION
|
|
9000
9062
|
: obj.$untrackedValue$;
|
|
9001
9063
|
if (v !== NEEDS_COMPUTATION) {
|
|
9002
9064
|
discoveredValues.push(v);
|
|
9003
9065
|
}
|
|
9004
9066
|
if (obj.$effects$) {
|
|
9005
|
-
discoveredValues.push(
|
|
9067
|
+
discoveredValues.push(obj.$effects$);
|
|
9006
9068
|
}
|
|
9007
9069
|
// WrappedSignal uses syncQrl which has no captured refs
|
|
9008
9070
|
if (obj instanceof WrappedSignal) {
|
|
@@ -9015,6 +9077,7 @@
|
|
|
9015
9077
|
}
|
|
9016
9078
|
}
|
|
9017
9079
|
else if (obj instanceof ComputedSignal) {
|
|
9080
|
+
discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
9018
9081
|
discoveredValues.push(obj.$computeQrl$);
|
|
9019
9082
|
}
|
|
9020
9083
|
}
|
|
@@ -9111,18 +9174,7 @@
|
|
|
9111
9174
|
};
|
|
9112
9175
|
const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
|
|
9113
9176
|
if (effectsBackRefs) {
|
|
9114
|
-
|
|
9115
|
-
let hasBackRefs = false;
|
|
9116
|
-
for (const [, effect] of effectsBackRefs) {
|
|
9117
|
-
const backRefs = effect[EffectSubscriptionProp.BACK_REF];
|
|
9118
|
-
if (backRefs) {
|
|
9119
|
-
hasBackRefs = true;
|
|
9120
|
-
break;
|
|
9121
|
-
}
|
|
9122
|
-
}
|
|
9123
|
-
if (hasBackRefs) {
|
|
9124
|
-
discoveredValues.push(effectsBackRefs);
|
|
9125
|
-
}
|
|
9177
|
+
discoveredValues.push(effectsBackRefs);
|
|
9126
9178
|
}
|
|
9127
9179
|
};
|
|
9128
9180
|
const promiseResults = new WeakMap();
|
|
@@ -9271,8 +9323,8 @@
|
|
|
9271
9323
|
else if (value === NEEDS_COMPUTATION) {
|
|
9272
9324
|
output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
|
|
9273
9325
|
}
|
|
9274
|
-
else if (value ===
|
|
9275
|
-
output(TypeIds.Constant, Constants.
|
|
9326
|
+
else if (value === STORE_ALL_PROPS) {
|
|
9327
|
+
output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
|
|
9276
9328
|
}
|
|
9277
9329
|
else {
|
|
9278
9330
|
throw qError(QError.serializeErrorUnknownType, [typeof value]);
|
|
@@ -9371,7 +9423,7 @@
|
|
|
9371
9423
|
* It can never be meant to become a vNode, because vNodes are internal only.
|
|
9372
9424
|
*/
|
|
9373
9425
|
const v = value instanceof ComputedSignal &&
|
|
9374
|
-
(value.$
|
|
9426
|
+
(value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$))
|
|
9375
9427
|
? NEEDS_COMPUTATION
|
|
9376
9428
|
: value.$untrackedValue$;
|
|
9377
9429
|
if (value instanceof WrappedSignal) {
|
|
@@ -9379,6 +9431,7 @@
|
|
|
9379
9431
|
...serializeWrappingFn(serializationContext, value),
|
|
9380
9432
|
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
9381
9433
|
v,
|
|
9434
|
+
value.$flags$,
|
|
9382
9435
|
value.$hostElement$,
|
|
9383
9436
|
...(value.$effects$ || []),
|
|
9384
9437
|
]);
|
|
@@ -9856,7 +9909,7 @@
|
|
|
9856
9909
|
Constants[Constants["EMPTY_ARRAY"] = 5] = "EMPTY_ARRAY";
|
|
9857
9910
|
Constants[Constants["EMPTY_OBJ"] = 6] = "EMPTY_OBJ";
|
|
9858
9911
|
Constants[Constants["NEEDS_COMPUTATION"] = 7] = "NEEDS_COMPUTATION";
|
|
9859
|
-
Constants[Constants["
|
|
9912
|
+
Constants[Constants["STORE_ALL_PROPS"] = 8] = "STORE_ALL_PROPS";
|
|
9860
9913
|
Constants[Constants["Slot"] = 9] = "Slot";
|
|
9861
9914
|
Constants[Constants["Fragment"] = 10] = "Fragment";
|
|
9862
9915
|
Constants[Constants["NaN"] = 11] = "NaN";
|
|
@@ -11409,6 +11462,7 @@
|
|
|
11409
11462
|
exports._weakSerialize = _weakSerialize;
|
|
11410
11463
|
exports._wrapProp = _wrapProp;
|
|
11411
11464
|
exports._wrapSignal = _wrapSignal;
|
|
11465
|
+
exports._wrapStore = _wrapStore;
|
|
11412
11466
|
exports.component$ = component$;
|
|
11413
11467
|
exports.componentQrl = componentQrl;
|
|
11414
11468
|
exports.createComputed$ = createComputed$;
|