@lwc/engine-core 7.0.1-alpha.0 → 7.0.2

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/index.js CHANGED
@@ -445,14 +445,6 @@ 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
- }
456
448
  // Borrowed from Vue template compiler.
457
449
  // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
458
450
  const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
@@ -503,7 +495,7 @@ function assertNotProd() {
503
495
  function shouldBeFormAssociated(Ctor) {
504
496
  const ctorFormAssociated = Boolean(Ctor.formAssociated);
505
497
  const apiVersion = getComponentAPIVersion(Ctor);
506
- const apiFeatureEnabled = isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
498
+ const apiFeatureEnabled = isAPIFeatureEnabled(7 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
507
499
  if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
508
500
  const tagName = getComponentRegisteredName(Ctor);
509
501
  logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` +
@@ -1746,7 +1738,7 @@ LightningElement.prototype = {
1746
1738
  attachInternals() {
1747
1739
  const vm = getAssociatedVM(this);
1748
1740
  const { elm, apiVersion, renderer: { attachInternals }, } = vm;
1749
- if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
1741
+ if (!isAPIFeatureEnabled(7 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
1750
1742
  throw new Error(`The attachInternals API is only supported in API version 61 and above. ` +
1751
1743
  `The current version is ${apiVersion}. ` +
1752
1744
  `To use this API, update the LWC component API version. https://lwc.dev/guide/versioning`);
@@ -1786,7 +1778,7 @@ LightningElement.prototype = {
1786
1778
  assert.fail('this.hostElement is not supported in this environment');
1787
1779
  }
1788
1780
  const apiVersion = getComponentAPIVersion(vm.def.ctor);
1789
- if (!isAPIFeatureEnabled(9 /* APIFeature.ENABLE_THIS_DOT_HOST_ELEMENT */, apiVersion)) {
1781
+ if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_THIS_DOT_HOST_ELEMENT */, apiVersion)) {
1790
1782
  if (process.env.NODE_ENV !== 'production') {
1791
1783
  logWarnOnce('The `this.hostElement` API within LightningElement is ' +
1792
1784
  'only supported in API version 62 and above. Increase the API version to use it.');
@@ -1928,7 +1920,7 @@ LightningElement.prototype = {
1928
1920
  get style() {
1929
1921
  const { elm, renderer, def } = getAssociatedVM(this);
1930
1922
  const apiVersion = getComponentAPIVersion(def.ctor);
1931
- if (!isAPIFeatureEnabled(10 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
1923
+ if (!isAPIFeatureEnabled(9 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
1932
1924
  if (process.env.NODE_ENV !== 'production') {
1933
1925
  logWarnOnce('The `this.style` API within LightningElement returning the CSSStyleDeclaration is ' +
1934
1926
  'only supported in API version 62 and above. Increase the API version to use it.');
@@ -4500,7 +4492,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4500
4492
  // compiler may generate tagnames with uppercase letters so - for backwards
4501
4493
  // compatibility, we lower case the tagname here.
4502
4494
  const normalizedTagname = sel.toLowerCase();
4503
- const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
4495
+ const useNativeLifecycle = !lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE;
4504
4496
  const isFormAssociated = shouldBeFormAssociated(ctor);
4505
4497
  const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle, isFormAssociated);
4506
4498
  vnode.elm = elm;
@@ -5647,8 +5639,11 @@ function ncls(value) {
5647
5639
  }
5648
5640
  }
5649
5641
  }
5650
- else if (isObject(value)) {
5651
- for (const key in value) {
5642
+ else if (isObject(value) && !isNull(value)) {
5643
+ // Iterate own enumerable keys of the object
5644
+ const keys$1 = keys(value);
5645
+ for (let i = 0; i < keys$1.length; i += 1) {
5646
+ const key = keys$1[i];
5652
5647
  if (value[key]) {
5653
5648
  res += key + ' ';
5654
5649
  }
@@ -6377,7 +6372,7 @@ function resetComponentStateWhenRemoved(vm) {
6377
6372
  // old vnode.children is removed from the DOM.
6378
6373
  function removeVM(vm) {
6379
6374
  if (process.env.NODE_ENV !== 'production') {
6380
- if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
6375
+ if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6381
6376
  // With native lifecycle, we cannot be certain that connectedCallback was called before a component
6382
6377
  // was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
6383
6378
  // in native mode, although it will fire in synthetic mode due to appendChild triggering it.
@@ -6701,7 +6696,7 @@ function runConnectedCallback(vm) {
6701
6696
  // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
6702
6697
  // we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
6703
6698
  if (process.env.IS_BROWSER &&
6704
- !shouldUseNativeCustomElementLifecycle(vm.component.constructor) &&
6699
+ lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE &&
6705
6700
  (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6706
6701
  if (!vm.renderer.isConnected(vm.elm)) {
6707
6702
  if (process.env.NODE_ENV !== 'production') {
@@ -8029,5 +8024,5 @@ function readonly(obj) {
8029
8024
  }
8030
8025
 
8031
8026
  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 };
8032
- /** version: 7.0.0 */
8027
+ /** version: 7.0.2 */
8033
8028
  //# sourceMappingURL=index.js.map