lwc 2.27.0 → 2.28.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.
Files changed (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +95 -32
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +95 -32
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +79 -30
  5. package/dist/engine-dom/iife/es5/engine-dom.js +134 -46
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +115 -44
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +95 -32
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +79 -30
  11. package/dist/engine-dom/umd/es5/engine-dom.js +134 -46
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +115 -44
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +57 -26
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +57 -26
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +4 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +4 -4
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
  26. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  28. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  29. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  31. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  37. package/package.json +7 -7
@@ -43,7 +43,7 @@ var assert = /*#__PURE__*/Object.freeze({
43
43
  */
44
44
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
45
45
  const { isArray: isArray$1 } = Array;
46
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
46
+ const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
47
47
  const { fromCharCode: StringFromCharCode } = String;
48
48
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
49
49
  function isUndefined$1(obj) {
@@ -299,9 +299,9 @@ function htmlPropertyToAttribute(propName) {
299
299
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
300
300
  */
301
301
  // Increment whenever the LWC template compiler changes
302
- const LWC_VERSION = "2.27.0";
302
+ const LWC_VERSION = "2.28.0";
303
303
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
304
- /** version: 2.27.0 */
304
+ /** version: 2.28.0 */
305
305
 
306
306
  /**
307
307
  * Copyright (C) 2018 salesforce.com, inc.
@@ -383,7 +383,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
383
383
  patch$1(propName);
384
384
  }
385
385
  }
386
- /** version: 2.27.0 */
386
+ /** version: 2.28.0 */
387
387
 
388
388
  /**
389
389
  * Copyright (C) 2018 salesforce.com, inc.
@@ -463,7 +463,7 @@ function setFeatureFlagForTest(name, value) {
463
463
  setFeatureFlag(name, value);
464
464
  }
465
465
  }
466
- /** version: 2.27.0 */
466
+ /** version: 2.28.0 */
467
467
 
468
468
  /*
469
469
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4213,9 +4213,14 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4213
4213
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4214
4214
  disconnectRootElement(elm);
4215
4215
  }
4216
- };
4216
+ }; // Should never get a tag with upper case letter at this point; the compiler
4217
+ // should produce only tags with lowercase letters. However, the Java
4218
+ // compiler may generate tagnames with uppercase letters so - for backwards
4219
+ // compatibility, we lower case the tagname here.
4220
+
4217
4221
 
4218
- const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
4222
+ const normalizedTagname = sel.toLowerCase();
4223
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
4219
4224
  vnode.elm = elm;
4220
4225
  vnode.vm = vm;
4221
4226
  linkNodeToShadow(elm, owner, renderer);
@@ -4517,6 +4522,17 @@ function allocateChildren(vnode, vm) {
4517
4522
  shadowMode
4518
4523
  } = vm;
4519
4524
 
4525
+ if (process.env.NODE_ENV !== 'production') {
4526
+ // If any of the children being allocated is a scoped slot fragment, make sure the receiving
4527
+ // component is a light DOM component. This is mainly to validate light dom parent running
4528
+ // in native shadow mode.
4529
+ if (renderMode !== 0
4530
+ /* RenderMode.Light */
4531
+ && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4532
+ logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
4533
+ }
4534
+ }
4535
+
4520
4536
  if (shadowMode === 1
4521
4537
  /* ShadowMode.Synthetic */
4522
4538
  || renderMode === 0
@@ -4911,27 +4927,42 @@ function s(slotName, data, children, slotset) {
4911
4927
  !isUndefined$1(slotset.slotAssignments) &&
4912
4928
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
4913
4929
  slotset.slotAssignments[slotName].length !== 0) {
4914
- children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
4915
- // If the passed slot content is factory, evaluate it and use the produced vnodes
4916
- if (vnode && isVScopedSlotFragment(vnode)) {
4917
- const vmBeingRenderedInception = getVMBeingRendered();
4918
- let children = [];
4919
- // Evaluate in the scope of the slot content's owner
4920
- // if a slotset is provided, there will always be an owner. The only case where owner is
4921
- // undefined is for root components, but root components cannot accept slotted content
4922
- setVMBeingRendered(slotset.owner);
4923
- try {
4924
- children = vnode.factory(data.slotData);
4930
+ children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4931
+ if (vnode) {
4932
+ const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4933
+ // The only sniff test for a scoped <slot> element is the presence of `slotData`
4934
+ const isScopedSlotElement = !isUndefined$1(data.slotData);
4935
+ // Check if slot types of parent and child are matching
4936
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4937
+ if (process.env.NODE_ENV !== 'production') {
4938
+ logError(`Mismatched slot types for ${slotName === '' ? '(default)' : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
4939
+ }
4940
+ // Ignore slot content from parent
4941
+ return accumulator;
4925
4942
  }
4926
- finally {
4927
- setVMBeingRendered(vmBeingRenderedInception);
4943
+ // If the passed slot content is factory, evaluate it and add the produced vnodes
4944
+ if (assignedNodeIsScopedSlot) {
4945
+ const vmBeingRenderedInception = getVMBeingRendered();
4946
+ let scopedSlotChildren = [];
4947
+ // Evaluate in the scope of the slot content's owner
4948
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4949
+ // undefined is for root components, but root components cannot accept slotted content
4950
+ setVMBeingRendered(slotset.owner);
4951
+ try {
4952
+ scopedSlotChildren = vnode.factory(data.slotData);
4953
+ }
4954
+ finally {
4955
+ setVMBeingRendered(vmBeingRenderedInception);
4956
+ }
4957
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4958
+ }
4959
+ else {
4960
+ // If the slot content is standard type, the content is static, no additional
4961
+ // processing needed on the vnode
4962
+ return ArrayConcat$1.call(accumulator, vnode);
4928
4963
  }
4929
- return ArrayConcat$1.call(acc, children);
4930
- }
4931
- else {
4932
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
4933
- return ArrayConcat$1.call(acc, vnode);
4934
4964
  }
4965
+ return accumulator;
4935
4966
  }, []);
4936
4967
  }
4937
4968
  const vmBeingRendered = getVMBeingRendered();
@@ -7299,7 +7330,7 @@ function getComponentConstructor(elm) {
7299
7330
  }
7300
7331
  return ctor;
7301
7332
  }
7302
- /* version: 2.27.0 */
7333
+ /* version: 2.28.0 */
7303
7334
 
7304
7335
  /*
7305
7336
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7573,10 +7604,12 @@ function createScopedRegistry() {
7573
7604
  const pendingRegistryForElement = new WeakMap();
7574
7605
  const definitionForConstructor = new WeakMap();
7575
7606
  const registeredUserCtors = new WeakSet();
7607
+ const registeredPivotCtors = new WeakSet();
7576
7608
  const pivotCtorByTag = new Map();
7577
7609
  const globalDefinitionsByTag = new Map();
7578
7610
  const globalDefinitionsByClass = new Map();
7579
7611
  const awaitingUpgrade = new Map();
7612
+ const pendingWhenDefinedCallbacks = new Map();
7580
7613
  const EMPTY_SET = new Set();
7581
7614
  function createDefinitionRecord(constructor) {
7582
7615
  var _a;
@@ -7682,6 +7715,7 @@ function createScopedRegistry() {
7682
7715
  }
7683
7716
  }
7684
7717
  PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
7718
+ registeredPivotCtors.add(PivotCtor);
7685
7719
  return PivotCtor;
7686
7720
  }
7687
7721
  function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
@@ -7815,6 +7849,27 @@ function createScopedRegistry() {
7815
7849
  }
7816
7850
  return createDefinitionRecord(constructor);
7817
7851
  }
7852
+ // Defer a `whenDefined()` callback until an externally-visible custom element is defined
7853
+ function createPendingWhenDefinedCallback(tagName) {
7854
+ return new Promise((resolve) => {
7855
+ let resolvers = pendingWhenDefinedCallbacks.get(tagName);
7856
+ if (isUndefined$1(resolvers)) {
7857
+ resolvers = [];
7858
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
7859
+ }
7860
+ resolvers.push(resolve);
7861
+ });
7862
+ }
7863
+ // Call any pending `whenDefined()` callbacks
7864
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7865
+ const resolvers = pendingWhenDefinedCallbacks.get(tagName);
7866
+ if (!isUndefined$1(resolvers)) {
7867
+ for (const resolver of resolvers) {
7868
+ resolver(ctor);
7869
+ }
7870
+ }
7871
+ pendingWhenDefinedCallbacks.delete(tagName);
7872
+ }
7818
7873
  const { customElements: nativeRegistry } = window;
7819
7874
  const { define: nativeDefine, whenDefined: nativeWhenDefined, get: nativeGet } = nativeRegistry;
7820
7875
  // patch for the global registry define mechanism
@@ -7869,6 +7924,8 @@ function createScopedRegistry() {
7869
7924
  }
7870
7925
  }
7871
7926
  }
7927
+ // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
7928
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
7872
7929
  };
7873
7930
  CustomElementRegistry.prototype.get = function get(tagName) {
7874
7931
  const NativeCtor = nativeGet.call(nativeRegistry, tagName);
@@ -7877,8 +7934,10 @@ function createScopedRegistry() {
7877
7934
  if (!isUndefined$1(definition)) {
7878
7935
  return definition.UserCtor; // defined by the patched custom elements registry
7879
7936
  }
7880
- // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7881
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
7937
+ if (registeredPivotCtors.has(NativeCtor)) {
7938
+ return undefined; // pivot constructors should not be observable, return undefined
7939
+ }
7940
+ return NativeCtor; // constructor that existed before patching
7882
7941
  }
7883
7942
  };
7884
7943
  CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
@@ -7887,13 +7946,17 @@ function createScopedRegistry() {
7887
7946
  if (!isUndefined$1(definition)) {
7888
7947
  return definition.UserCtor;
7889
7948
  }
7890
- // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7891
7949
  // In this case, the custom element must have been defined before the registry patches
7892
7950
  // were applied. So return the non-pivot constructor
7893
7951
  if (isUndefined$1(NativeCtor)) {
7894
7952
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7895
7953
  // We can patch the correct behavior using customElements.get()
7896
- return nativeGet.call(nativeRegistry, tagName);
7954
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
7955
+ }
7956
+ if (registeredPivotCtors.has(NativeCtor)) {
7957
+ // Pivot constructors should not be observable. Wait to resolve the promise
7958
+ // if a constructor is ever defined in userland
7959
+ return createPendingWhenDefinedCallback(tagName);
7897
7960
  }
7898
7961
  return NativeCtor;
7899
7962
  });
@@ -8123,7 +8186,7 @@ function rendererFactory(baseRenderer) {
8123
8186
  function isNull(obj) {
8124
8187
  return obj === null;
8125
8188
  }
8126
- /** version: 2.27.0 */
8189
+ /** version: 2.28.0 */
8127
8190
 
8128
8191
  /*
8129
8192
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8702,6 +8765,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8702
8765
  });
8703
8766
  freeze(LightningElement);
8704
8767
  seal(LightningElement.prototype);
8705
- /* version: 2.27.0 */
8768
+ /* version: 2.28.0 */
8706
8769
 
8707
8770
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
@@ -46,7 +46,7 @@ var LWC = (function (exports) {
46
46
  */
47
47
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
48
48
  const { isArray: isArray$1 } = Array;
49
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
49
+ const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
50
50
  const { fromCharCode: StringFromCharCode } = String;
51
51
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
52
52
  function isUndefined$1(obj) {
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
302
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
303
303
  */
304
304
  // Increment whenever the LWC template compiler changes
305
- const LWC_VERSION = "2.27.0";
305
+ const LWC_VERSION = "2.28.0";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.27.0 */
307
+ /** version: 2.28.0 */
308
308
 
309
309
  /**
310
310
  * Copyright (C) 2018 salesforce.com, inc.
@@ -386,7 +386,7 @@ var LWC = (function (exports) {
386
386
  patch$1(propName);
387
387
  }
388
388
  }
389
- /** version: 2.27.0 */
389
+ /** version: 2.28.0 */
390
390
 
391
391
  /**
392
392
  * Copyright (C) 2018 salesforce.com, inc.
@@ -466,7 +466,7 @@ var LWC = (function (exports) {
466
466
  setFeatureFlag(name, value);
467
467
  }
468
468
  }
469
- /** version: 2.27.0 */
469
+ /** version: 2.28.0 */
470
470
 
471
471
  /*
472
472
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4216,9 +4216,14 @@ var LWC = (function (exports) {
4216
4216
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4217
4217
  disconnectRootElement(elm);
4218
4218
  }
4219
- };
4219
+ }; // Should never get a tag with upper case letter at this point; the compiler
4220
+ // should produce only tags with lowercase letters. However, the Java
4221
+ // compiler may generate tagnames with uppercase letters so - for backwards
4222
+ // compatibility, we lower case the tagname here.
4223
+
4220
4224
 
4221
- const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
4225
+ const normalizedTagname = sel.toLowerCase();
4226
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
4222
4227
  vnode.elm = elm;
4223
4228
  vnode.vm = vm;
4224
4229
  linkNodeToShadow(elm, owner, renderer);
@@ -4520,6 +4525,17 @@ var LWC = (function (exports) {
4520
4525
  shadowMode
4521
4526
  } = vm;
4522
4527
 
4528
+ if (process.env.NODE_ENV !== 'production') {
4529
+ // If any of the children being allocated is a scoped slot fragment, make sure the receiving
4530
+ // component is a light DOM component. This is mainly to validate light dom parent running
4531
+ // in native shadow mode.
4532
+ if (renderMode !== 0
4533
+ /* RenderMode.Light */
4534
+ && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4535
+ logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
4536
+ }
4537
+ }
4538
+
4523
4539
  if (shadowMode === 1
4524
4540
  /* ShadowMode.Synthetic */
4525
4541
  || renderMode === 0
@@ -4914,27 +4930,42 @@ var LWC = (function (exports) {
4914
4930
  !isUndefined$1(slotset.slotAssignments) &&
4915
4931
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
4916
4932
  slotset.slotAssignments[slotName].length !== 0) {
4917
- children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
4918
- // If the passed slot content is factory, evaluate it and use the produced vnodes
4919
- if (vnode && isVScopedSlotFragment(vnode)) {
4920
- const vmBeingRenderedInception = getVMBeingRendered();
4921
- let children = [];
4922
- // Evaluate in the scope of the slot content's owner
4923
- // if a slotset is provided, there will always be an owner. The only case where owner is
4924
- // undefined is for root components, but root components cannot accept slotted content
4925
- setVMBeingRendered(slotset.owner);
4926
- try {
4927
- children = vnode.factory(data.slotData);
4933
+ children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4934
+ if (vnode) {
4935
+ const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4936
+ // The only sniff test for a scoped <slot> element is the presence of `slotData`
4937
+ const isScopedSlotElement = !isUndefined$1(data.slotData);
4938
+ // Check if slot types of parent and child are matching
4939
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4940
+ if (process.env.NODE_ENV !== 'production') {
4941
+ logError(`Mismatched slot types for ${slotName === '' ? '(default)' : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
4942
+ }
4943
+ // Ignore slot content from parent
4944
+ return accumulator;
4928
4945
  }
4929
- finally {
4930
- setVMBeingRendered(vmBeingRenderedInception);
4946
+ // If the passed slot content is factory, evaluate it and add the produced vnodes
4947
+ if (assignedNodeIsScopedSlot) {
4948
+ const vmBeingRenderedInception = getVMBeingRendered();
4949
+ let scopedSlotChildren = [];
4950
+ // Evaluate in the scope of the slot content's owner
4951
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4952
+ // undefined is for root components, but root components cannot accept slotted content
4953
+ setVMBeingRendered(slotset.owner);
4954
+ try {
4955
+ scopedSlotChildren = vnode.factory(data.slotData);
4956
+ }
4957
+ finally {
4958
+ setVMBeingRendered(vmBeingRenderedInception);
4959
+ }
4960
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4961
+ }
4962
+ else {
4963
+ // If the slot content is standard type, the content is static, no additional
4964
+ // processing needed on the vnode
4965
+ return ArrayConcat$1.call(accumulator, vnode);
4931
4966
  }
4932
- return ArrayConcat$1.call(acc, children);
4933
- }
4934
- else {
4935
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
4936
- return ArrayConcat$1.call(acc, vnode);
4937
4967
  }
4968
+ return accumulator;
4938
4969
  }, []);
4939
4970
  }
4940
4971
  const vmBeingRendered = getVMBeingRendered();
@@ -7302,7 +7333,7 @@ var LWC = (function (exports) {
7302
7333
  }
7303
7334
  return ctor;
7304
7335
  }
7305
- /* version: 2.27.0 */
7336
+ /* version: 2.28.0 */
7306
7337
 
7307
7338
  /*
7308
7339
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7576,10 +7607,12 @@ var LWC = (function (exports) {
7576
7607
  const pendingRegistryForElement = new WeakMap();
7577
7608
  const definitionForConstructor = new WeakMap();
7578
7609
  const registeredUserCtors = new WeakSet();
7610
+ const registeredPivotCtors = new WeakSet();
7579
7611
  const pivotCtorByTag = new Map();
7580
7612
  const globalDefinitionsByTag = new Map();
7581
7613
  const globalDefinitionsByClass = new Map();
7582
7614
  const awaitingUpgrade = new Map();
7615
+ const pendingWhenDefinedCallbacks = new Map();
7583
7616
  const EMPTY_SET = new Set();
7584
7617
  function createDefinitionRecord(constructor) {
7585
7618
  var _a;
@@ -7685,6 +7718,7 @@ var LWC = (function (exports) {
7685
7718
  }
7686
7719
  }
7687
7720
  PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
7721
+ registeredPivotCtors.add(PivotCtor);
7688
7722
  return PivotCtor;
7689
7723
  }
7690
7724
  function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
@@ -7818,6 +7852,27 @@ var LWC = (function (exports) {
7818
7852
  }
7819
7853
  return createDefinitionRecord(constructor);
7820
7854
  }
7855
+ // Defer a `whenDefined()` callback until an externally-visible custom element is defined
7856
+ function createPendingWhenDefinedCallback(tagName) {
7857
+ return new Promise((resolve) => {
7858
+ let resolvers = pendingWhenDefinedCallbacks.get(tagName);
7859
+ if (isUndefined$1(resolvers)) {
7860
+ resolvers = [];
7861
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
7862
+ }
7863
+ resolvers.push(resolve);
7864
+ });
7865
+ }
7866
+ // Call any pending `whenDefined()` callbacks
7867
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7868
+ const resolvers = pendingWhenDefinedCallbacks.get(tagName);
7869
+ if (!isUndefined$1(resolvers)) {
7870
+ for (const resolver of resolvers) {
7871
+ resolver(ctor);
7872
+ }
7873
+ }
7874
+ pendingWhenDefinedCallbacks.delete(tagName);
7875
+ }
7821
7876
  const { customElements: nativeRegistry } = window;
7822
7877
  const { define: nativeDefine, whenDefined: nativeWhenDefined, get: nativeGet } = nativeRegistry;
7823
7878
  // patch for the global registry define mechanism
@@ -7872,6 +7927,8 @@ var LWC = (function (exports) {
7872
7927
  }
7873
7928
  }
7874
7929
  }
7930
+ // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
7931
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
7875
7932
  };
7876
7933
  CustomElementRegistry.prototype.get = function get(tagName) {
7877
7934
  const NativeCtor = nativeGet.call(nativeRegistry, tagName);
@@ -7880,8 +7937,10 @@ var LWC = (function (exports) {
7880
7937
  if (!isUndefined$1(definition)) {
7881
7938
  return definition.UserCtor; // defined by the patched custom elements registry
7882
7939
  }
7883
- // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7884
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
7940
+ if (registeredPivotCtors.has(NativeCtor)) {
7941
+ return undefined; // pivot constructors should not be observable, return undefined
7942
+ }
7943
+ return NativeCtor; // constructor that existed before patching
7885
7944
  }
7886
7945
  };
7887
7946
  CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
@@ -7890,13 +7949,17 @@ var LWC = (function (exports) {
7890
7949
  if (!isUndefined$1(definition)) {
7891
7950
  return definition.UserCtor;
7892
7951
  }
7893
- // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7894
7952
  // In this case, the custom element must have been defined before the registry patches
7895
7953
  // were applied. So return the non-pivot constructor
7896
7954
  if (isUndefined$1(NativeCtor)) {
7897
7955
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7898
7956
  // We can patch the correct behavior using customElements.get()
7899
- return nativeGet.call(nativeRegistry, tagName);
7957
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
7958
+ }
7959
+ if (registeredPivotCtors.has(NativeCtor)) {
7960
+ // Pivot constructors should not be observable. Wait to resolve the promise
7961
+ // if a constructor is ever defined in userland
7962
+ return createPendingWhenDefinedCallback(tagName);
7900
7963
  }
7901
7964
  return NativeCtor;
7902
7965
  });
@@ -8126,7 +8189,7 @@ var LWC = (function (exports) {
8126
8189
  function isNull(obj) {
8127
8190
  return obj === null;
8128
8191
  }
8129
- /** version: 2.27.0 */
8192
+ /** version: 2.28.0 */
8130
8193
 
8131
8194
  /*
8132
8195
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8705,7 +8768,7 @@ var LWC = (function (exports) {
8705
8768
  });
8706
8769
  freeze(LightningElement);
8707
8770
  seal(LightningElement.prototype);
8708
- /* version: 2.27.0 */
8771
+ /* version: 2.28.0 */
8709
8772
 
8710
8773
  exports.LightningElement = LightningElement;
8711
8774
  exports.__unstable__ProfilerControl = profilerControl;