@lwc/engine-core 7.0.2 → 7.0.3-alpha.0
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/framework/utils.d.ts +1 -0
- package/dist/index.cjs.js +18 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -6,6 +6,7 @@ export declare const EmptyObject: any;
|
|
|
6
6
|
export declare const EmptyArray: never[];
|
|
7
7
|
export declare function addCallbackToNextTick(callback: Callback): void;
|
|
8
8
|
export declare function guid(): string;
|
|
9
|
+
export declare function shouldUseNativeCustomElementLifecycle(ctor: LightningElementConstructor): boolean;
|
|
9
10
|
export declare function parseStyleText(cssText: string): {
|
|
10
11
|
[name: string]: string;
|
|
11
12
|
};
|
package/dist/index.cjs.js
CHANGED
|
@@ -449,6 +449,14 @@ function guid() {
|
|
|
449
449
|
}
|
|
450
450
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
451
451
|
}
|
|
452
|
+
function shouldUseNativeCustomElementLifecycle(ctor) {
|
|
453
|
+
if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
454
|
+
// temporary "kill switch"
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
const apiVersion = getComponentAPIVersion(ctor);
|
|
458
|
+
return shared.isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
|
459
|
+
}
|
|
452
460
|
// Borrowed from Vue template compiler.
|
|
453
461
|
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
454
462
|
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
@@ -499,7 +507,7 @@ function assertNotProd() {
|
|
|
499
507
|
function shouldBeFormAssociated(Ctor) {
|
|
500
508
|
const ctorFormAssociated = Boolean(Ctor.formAssociated);
|
|
501
509
|
const apiVersion = getComponentAPIVersion(Ctor);
|
|
502
|
-
const apiFeatureEnabled = shared.isAPIFeatureEnabled(
|
|
510
|
+
const apiFeatureEnabled = shared.isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
|
|
503
511
|
if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
|
|
504
512
|
const tagName = getComponentRegisteredName(Ctor);
|
|
505
513
|
logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` +
|
|
@@ -1742,7 +1750,7 @@ LightningElement.prototype = {
|
|
|
1742
1750
|
attachInternals() {
|
|
1743
1751
|
const vm = getAssociatedVM(this);
|
|
1744
1752
|
const { elm, apiVersion, renderer: { attachInternals }, } = vm;
|
|
1745
|
-
if (!shared.isAPIFeatureEnabled(
|
|
1753
|
+
if (!shared.isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
|
|
1746
1754
|
throw new Error(`The attachInternals API is only supported in API version 61 and above. ` +
|
|
1747
1755
|
`The current version is ${apiVersion}. ` +
|
|
1748
1756
|
`To use this API, update the LWC component API version. https://lwc.dev/guide/versioning`);
|
|
@@ -1782,7 +1790,7 @@ LightningElement.prototype = {
|
|
|
1782
1790
|
shared.assert.fail('this.hostElement is not supported in this environment');
|
|
1783
1791
|
}
|
|
1784
1792
|
const apiVersion = getComponentAPIVersion(vm.def.ctor);
|
|
1785
|
-
if (!shared.isAPIFeatureEnabled(
|
|
1793
|
+
if (!shared.isAPIFeatureEnabled(9 /* APIFeature.ENABLE_THIS_DOT_HOST_ELEMENT */, apiVersion)) {
|
|
1786
1794
|
if (process.env.NODE_ENV !== 'production') {
|
|
1787
1795
|
logWarnOnce('The `this.hostElement` API within LightningElement is ' +
|
|
1788
1796
|
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
@@ -1924,7 +1932,7 @@ LightningElement.prototype = {
|
|
|
1924
1932
|
get style() {
|
|
1925
1933
|
const { elm, renderer, def } = getAssociatedVM(this);
|
|
1926
1934
|
const apiVersion = getComponentAPIVersion(def.ctor);
|
|
1927
|
-
if (!shared.isAPIFeatureEnabled(
|
|
1935
|
+
if (!shared.isAPIFeatureEnabled(10 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
|
|
1928
1936
|
if (process.env.NODE_ENV !== 'production') {
|
|
1929
1937
|
logWarnOnce('The `this.style` API within LightningElement returning the CSSStyleDeclaration is ' +
|
|
1930
1938
|
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
@@ -4496,7 +4504,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4496
4504
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
4497
4505
|
// compatibility, we lower case the tagname here.
|
|
4498
4506
|
const normalizedTagname = sel.toLowerCase();
|
|
4499
|
-
const useNativeLifecycle =
|
|
4507
|
+
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
|
4500
4508
|
const isFormAssociated = shouldBeFormAssociated(ctor);
|
|
4501
4509
|
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle, isFormAssociated);
|
|
4502
4510
|
vnode.elm = elm;
|
|
@@ -5643,11 +5651,8 @@ function ncls(value) {
|
|
|
5643
5651
|
}
|
|
5644
5652
|
}
|
|
5645
5653
|
}
|
|
5646
|
-
else if (shared.isObject(value)
|
|
5647
|
-
|
|
5648
|
-
const keys = shared.keys(value);
|
|
5649
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
5650
|
-
const key = keys[i];
|
|
5654
|
+
else if (shared.isObject(value)) {
|
|
5655
|
+
for (const key in value) {
|
|
5651
5656
|
if (value[key]) {
|
|
5652
5657
|
res += key + ' ';
|
|
5653
5658
|
}
|
|
@@ -6376,7 +6381,7 @@ function resetComponentStateWhenRemoved(vm) {
|
|
|
6376
6381
|
// old vnode.children is removed from the DOM.
|
|
6377
6382
|
function removeVM(vm) {
|
|
6378
6383
|
if (process.env.NODE_ENV !== 'production') {
|
|
6379
|
-
if (
|
|
6384
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
|
|
6380
6385
|
// With native lifecycle, we cannot be certain that connectedCallback was called before a component
|
|
6381
6386
|
// was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
|
|
6382
6387
|
// in native mode, although it will fire in synthetic mode due to appendChild triggering it.
|
|
@@ -6700,7 +6705,7 @@ function runConnectedCallback(vm) {
|
|
|
6700
6705
|
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
|
6701
6706
|
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
|
6702
6707
|
if (process.env.IS_BROWSER &&
|
|
6703
|
-
|
|
6708
|
+
!shouldUseNativeCustomElementLifecycle(vm.component.constructor) &&
|
|
6704
6709
|
(process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
|
6705
6710
|
if (!vm.renderer.isConnected(vm.elm)) {
|
|
6706
6711
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -8071,5 +8076,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8071
8076
|
exports.track = track;
|
|
8072
8077
|
exports.unwrap = unwrap;
|
|
8073
8078
|
exports.wire = wire;
|
|
8074
|
-
/** version: 7.0.
|
|
8079
|
+
/** version: 7.0.0 */
|
|
8075
8080
|
//# sourceMappingURL=index.cjs.js.map
|