@lwc/engine-core 2.50.0 → 3.0.1

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
@@ -1,8 +1,7 @@
1
- /* proxy-compat-disable */
2
1
  /**
3
2
  * Copyright (C) 2023 salesforce.com, inc.
4
3
  */
5
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, freeze, KEY__SYNTHETIC_MODE, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, globalThis as globalThis$1, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift } from '@lwc/shared';
4
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, freeze, KEY__SYNTHETIC_MODE, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, LOWEST_API_VERSION, globalThis as globalThis$1, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift } from '@lwc/shared';
6
5
  import { applyAriaReflection } from '@lwc/aria-reflection';
7
6
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
8
7
 
@@ -252,10 +251,18 @@ class ReactiveObserver {
252
251
  const { listeners } = this;
253
252
  const len = listeners.length;
254
253
  if (len > 0) {
255
- for (let i = 0; i < len; i += 1) {
254
+ for (let i = 0; i < len; i++) {
256
255
  const set = listeners[i];
257
- const pos = ArrayIndexOf.call(listeners[i], this);
258
- ArraySplice.call(set, pos, 1);
256
+ if (set.length === 1) {
257
+ // Perf optimization for the common case - the length is usually 1, so avoid the indexOf+splice.
258
+ // If the length is 1, we can also be sure that `this` is the first item in the array.
259
+ set.length = 0;
260
+ }
261
+ else {
262
+ // Slow case
263
+ const pos = ArrayIndexOf.call(set, this);
264
+ ArraySplice.call(set, pos, 1);
265
+ }
259
266
  }
260
267
  listeners.length = 0;
261
268
  }
@@ -5265,6 +5272,17 @@ function getComponentRegisteredName(Ctor) {
5265
5272
  var _a;
5266
5273
  return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
5267
5274
  }
5275
+ function getComponentAPIVersion(Ctor) {
5276
+ const metadata = registeredComponentMap.get(Ctor);
5277
+ const apiVersion = metadata === null || metadata === void 0 ? void 0 : metadata.apiVersion;
5278
+ if (isUndefined$1(apiVersion)) {
5279
+ // This should only occur in our Karma tests; in practice every component
5280
+ // is registered, and so this code path should not get hit. But to be safe,
5281
+ // return the lowest possible version.
5282
+ return LOWEST_API_VERSION;
5283
+ }
5284
+ return apiVersion;
5285
+ }
5268
5286
  function getTemplateReactiveObserver(vm) {
5269
5287
  return createReactiveObserver(() => {
5270
5288
  const { isDirty } = vm;
@@ -6884,6 +6902,6 @@ function readonly(obj) {
6884
6902
  return getReadOnlyProxy(obj);
6885
6903
  }
6886
6904
 
6887
- export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6888
- /** version: 2.50.0 */
6905
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6906
+ /** version: 3.0.1 */
6889
6907
  //# sourceMappingURL=index.js.map