@lwc/engine-core 7.0.1 → 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 +16 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -445,6 +445,14 @@ function guid() {
|
|
|
445
445
|
}
|
|
446
446
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
447
447
|
}
|
|
448
|
+
function shouldUseNativeCustomElementLifecycle(ctor) {
|
|
449
|
+
if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
450
|
+
// temporary "kill switch"
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
const apiVersion = getComponentAPIVersion(ctor);
|
|
454
|
+
return isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
|
455
|
+
}
|
|
448
456
|
// Borrowed from Vue template compiler.
|
|
449
457
|
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
450
458
|
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
@@ -495,7 +503,7 @@ function assertNotProd() {
|
|
|
495
503
|
function shouldBeFormAssociated(Ctor) {
|
|
496
504
|
const ctorFormAssociated = Boolean(Ctor.formAssociated);
|
|
497
505
|
const apiVersion = getComponentAPIVersion(Ctor);
|
|
498
|
-
const apiFeatureEnabled = isAPIFeatureEnabled(
|
|
506
|
+
const apiFeatureEnabled = isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
|
|
499
507
|
if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
|
|
500
508
|
const tagName = getComponentRegisteredName(Ctor);
|
|
501
509
|
logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` +
|
|
@@ -1738,7 +1746,7 @@ LightningElement.prototype = {
|
|
|
1738
1746
|
attachInternals() {
|
|
1739
1747
|
const vm = getAssociatedVM(this);
|
|
1740
1748
|
const { elm, apiVersion, renderer: { attachInternals }, } = vm;
|
|
1741
|
-
if (!isAPIFeatureEnabled(
|
|
1749
|
+
if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
|
|
1742
1750
|
throw new Error(`The attachInternals API is only supported in API version 61 and above. ` +
|
|
1743
1751
|
`The current version is ${apiVersion}. ` +
|
|
1744
1752
|
`To use this API, update the LWC component API version. https://lwc.dev/guide/versioning`);
|
|
@@ -1778,7 +1786,7 @@ LightningElement.prototype = {
|
|
|
1778
1786
|
assert.fail('this.hostElement is not supported in this environment');
|
|
1779
1787
|
}
|
|
1780
1788
|
const apiVersion = getComponentAPIVersion(vm.def.ctor);
|
|
1781
|
-
if (!isAPIFeatureEnabled(
|
|
1789
|
+
if (!isAPIFeatureEnabled(9 /* APIFeature.ENABLE_THIS_DOT_HOST_ELEMENT */, apiVersion)) {
|
|
1782
1790
|
if (process.env.NODE_ENV !== 'production') {
|
|
1783
1791
|
logWarnOnce('The `this.hostElement` API within LightningElement is ' +
|
|
1784
1792
|
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
@@ -1920,7 +1928,7 @@ LightningElement.prototype = {
|
|
|
1920
1928
|
get style() {
|
|
1921
1929
|
const { elm, renderer, def } = getAssociatedVM(this);
|
|
1922
1930
|
const apiVersion = getComponentAPIVersion(def.ctor);
|
|
1923
|
-
if (!isAPIFeatureEnabled(
|
|
1931
|
+
if (!isAPIFeatureEnabled(10 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
|
|
1924
1932
|
if (process.env.NODE_ENV !== 'production') {
|
|
1925
1933
|
logWarnOnce('The `this.style` API within LightningElement returning the CSSStyleDeclaration is ' +
|
|
1926
1934
|
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
@@ -4492,7 +4500,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4492
4500
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
4493
4501
|
// compatibility, we lower case the tagname here.
|
|
4494
4502
|
const normalizedTagname = sel.toLowerCase();
|
|
4495
|
-
const useNativeLifecycle =
|
|
4503
|
+
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
|
4496
4504
|
const isFormAssociated = shouldBeFormAssociated(ctor);
|
|
4497
4505
|
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle, isFormAssociated);
|
|
4498
4506
|
vnode.elm = elm;
|
|
@@ -6369,7 +6377,7 @@ function resetComponentStateWhenRemoved(vm) {
|
|
|
6369
6377
|
// old vnode.children is removed from the DOM.
|
|
6370
6378
|
function removeVM(vm) {
|
|
6371
6379
|
if (process.env.NODE_ENV !== 'production') {
|
|
6372
|
-
if (
|
|
6380
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
|
|
6373
6381
|
// With native lifecycle, we cannot be certain that connectedCallback was called before a component
|
|
6374
6382
|
// was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
|
|
6375
6383
|
// in native mode, although it will fire in synthetic mode due to appendChild triggering it.
|
|
@@ -6693,7 +6701,7 @@ function runConnectedCallback(vm) {
|
|
|
6693
6701
|
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
|
6694
6702
|
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
|
6695
6703
|
if (process.env.IS_BROWSER &&
|
|
6696
|
-
|
|
6704
|
+
!shouldUseNativeCustomElementLifecycle(vm.component.constructor) &&
|
|
6697
6705
|
(process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
|
6698
6706
|
if (!vm.renderer.isConnected(vm.elm)) {
|
|
6699
6707
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -8021,5 +8029,5 @@ function readonly(obj) {
|
|
|
8021
8029
|
}
|
|
8022
8030
|
|
|
8023
8031
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
8024
|
-
/** version: 7.0.
|
|
8032
|
+
/** version: 7.0.0 */
|
|
8025
8033
|
//# sourceMappingURL=index.js.map
|