lwc 2.27.0 → 2.28.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.
Files changed (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +135 -49
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +135 -49
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +114 -43
  5. package/dist/engine-dom/iife/es5/engine-dom.js +176 -63
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +152 -57
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +135 -49
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +114 -43
  11. package/dist/engine-dom/umd/es5/engine-dom.js +176 -63
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +152 -57
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +93 -39
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +93 -39
  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
@@ -351,7 +351,7 @@
351
351
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
352
352
  return attributeName;
353
353
  }
354
- /** version: 2.27.0 */
354
+ /** version: 2.28.1 */
355
355
 
356
356
  /**
357
357
  * Copyright (C) 2018 salesforce.com, inc.
@@ -445,7 +445,7 @@
445
445
  patch$1(propName);
446
446
  }
447
447
  }
448
- /** version: 2.27.0 */
448
+ /** version: 2.28.1 */
449
449
 
450
450
  /**
451
451
  * Copyright (C) 2018 salesforce.com, inc.
@@ -3299,6 +3299,12 @@
3299
3299
  ;
3300
3300
  }
3301
3301
 
3302
+ function isVFragment(vnode) {
3303
+ return vnode.type === 5
3304
+ /* VNodeType.Fragment */
3305
+ ;
3306
+ }
3307
+
3302
3308
  function isVScopedSlotFragment(vnode) {
3303
3309
  return vnode.type === 6
3304
3310
  /* VNodeType.ScopedSlotFragment */
@@ -3835,9 +3841,14 @@
3835
3841
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3836
3842
  disconnectRootElement(elm);
3837
3843
  }
3838
- };
3844
+ }; // Should never get a tag with upper case letter at this point; the compiler
3845
+ // should produce only tags with lowercase letters. However, the Java
3846
+ // compiler may generate tagnames with uppercase letters so - for backwards
3847
+ // compatibility, we lower case the tagname here.
3848
+
3839
3849
 
3840
- var elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
3850
+ var normalizedTagname = sel.toLowerCase();
3851
+ var elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3841
3852
  vnode.elm = elm;
3842
3853
  vnode.vm = vm;
3843
3854
  linkNodeToShadow(elm, owner, renderer);
@@ -4112,22 +4123,26 @@
4112
4123
 
4113
4124
  return vm;
4114
4125
  }
4126
+ /**
4127
+ * Collects all slots into a SlotSet, traversing through VFragment Nodes
4128
+ */
4115
4129
 
4116
- function allocateInSlot(vm, children, owner) {
4117
- var _a, _b;
4118
4130
 
4119
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4120
- var cmpSlotsMapping = create(null);
4121
- vm.cmpSlots = {
4122
- owner: owner,
4123
- slotAssignments: cmpSlotsMapping
4124
- };
4131
+ function collectSlots(vm, children, cmpSlotsMapping) {
4132
+ var _a, _b;
4125
4133
 
4126
4134
  for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
4127
4135
  var vnode = children[_i15];
4128
4136
 
4129
4137
  if (isNull(vnode)) {
4130
4138
  continue;
4139
+ } // Dive further iff the content is wrapped in a VFragment
4140
+
4141
+
4142
+ if (isVFragment(vnode)) {
4143
+ // Remove the text delimiter nodes to avoid overriding default slot content
4144
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4145
+ continue;
4131
4146
  }
4132
4147
 
4133
4148
  var slotName = '';
@@ -4141,6 +4156,16 @@
4141
4156
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4142
4157
  ArrayPush$1.call(vnodes, vnode);
4143
4158
  }
4159
+ }
4160
+
4161
+ function allocateInSlot(vm, children, owner) {
4162
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4163
+ var cmpSlotsMapping = create(null);
4164
+ collectSlots(vm, children, cmpSlotsMapping);
4165
+ vm.cmpSlots = {
4166
+ owner: owner,
4167
+ slotAssignments: cmpSlotsMapping
4168
+ };
4144
4169
 
4145
4170
  if (isFalse(vm.isDirty)) {
4146
4171
  // We need to determine if the old allocation is really different from the new one
@@ -4152,7 +4177,7 @@
4152
4177
  return;
4153
4178
  }
4154
4179
 
4155
- for (var _i16 = 0, _len4 = oldKeys.length; _i16 < _len4; _i16 += 1) {
4180
+ for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
4156
4181
  var key = oldKeys[_i16];
4157
4182
 
4158
4183
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
@@ -4161,10 +4186,10 @@
4161
4186
  }
4162
4187
 
4163
4188
  var oldVNodes = oldSlotsMapping[key];
4164
- var _vnodes = cmpSlotsMapping[key];
4189
+ var vnodes = cmpSlotsMapping[key];
4165
4190
 
4166
4191
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4167
- if (oldVNodes[j] !== _vnodes[j]) {
4192
+ if (oldVNodes[j] !== vnodes[j]) {
4168
4193
  markComponentAsDirty(vm);
4169
4194
  return;
4170
4195
  }
@@ -4448,27 +4473,42 @@
4448
4473
  function s(slotName, data, children, slotset) {
4449
4474
 
4450
4475
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
4451
- children = slotset.slotAssignments[slotName].reduce(function (acc, vnode) {
4452
- // If the passed slot content is factory, evaluate it and use the produced vnodes
4453
- if (vnode && isVScopedSlotFragment(vnode)) {
4454
- var vmBeingRenderedInception = getVMBeingRendered();
4455
- var _children = []; // Evaluate in the scope of the slot content's owner
4456
- // if a slotset is provided, there will always be an owner. The only case where owner is
4457
- // undefined is for root components, but root components cannot accept slotted content
4458
-
4459
- setVMBeingRendered(slotset.owner);
4460
-
4461
- try {
4462
- _children = vnode.factory(data.slotData);
4463
- } finally {
4464
- setVMBeingRendered(vmBeingRenderedInception);
4465
- }
4476
+ children = slotset.slotAssignments[slotName].reduce(function (accumulator, vnode) {
4477
+ if (vnode) {
4478
+ var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode); // The only sniff test for a scoped <slot> element is the presence of `slotData`
4466
4479
 
4467
- return ArrayConcat$1.call(acc, _children);
4468
- } else {
4469
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
4470
- return ArrayConcat$1.call(acc, vnode);
4480
+ var isScopedSlotElement = !isUndefined$1(data.slotData); // Check if slot types of parent and child are matching
4481
+
4482
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4483
+
4484
+
4485
+ return accumulator;
4486
+ } // If the passed slot content is factory, evaluate it and add the produced vnodes
4487
+
4488
+
4489
+ if (assignedNodeIsScopedSlot) {
4490
+ var vmBeingRenderedInception = getVMBeingRendered();
4491
+ var scopedSlotChildren = []; // Evaluate in the scope of the slot content's owner
4492
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4493
+ // undefined is for root components, but root components cannot accept slotted content
4494
+
4495
+ setVMBeingRendered(slotset.owner);
4496
+
4497
+ try {
4498
+ scopedSlotChildren = vnode.factory(data.slotData);
4499
+ } finally {
4500
+ setVMBeingRendered(vmBeingRenderedInception);
4501
+ }
4502
+
4503
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4504
+ } else {
4505
+ // If the slot content is standard type, the content is static, no additional
4506
+ // processing needed on the vnode
4507
+ return ArrayConcat$1.call(accumulator, vnode);
4508
+ }
4471
4509
  }
4510
+
4511
+ return accumulator;
4472
4512
  }, []);
4473
4513
  }
4474
4514
 
@@ -4889,7 +4929,7 @@
4889
4929
 
4890
4930
  function buildParseFragmentFn(createFragmentFn) {
4891
4931
  return function (strings) {
4892
- for (var _len5 = arguments.length, keys = new Array(_len5 > 1 ? _len5 - 1 : 0), _key3 = 1; _key3 < _len5; _key3++) {
4932
+ for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
4893
4933
  keys[_key3 - 1] = arguments[_key3];
4894
4934
  }
4895
4935
 
@@ -6550,8 +6590,9 @@
6550
6590
  }
6551
6591
 
6552
6592
  var nodesAreCompatible = true;
6593
+ var elmClassName = getProperty(elm, 'className');
6553
6594
 
6554
- if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
6595
+ if (!isUndefined$1(className) && String(className) !== elmClassName) {
6555
6596
  // className is used when class is bound to an expr.
6556
6597
  nodesAreCompatible = false;
6557
6598
  } else if (!isUndefined$1(classMap)) {
@@ -6572,6 +6613,9 @@
6572
6613
  if (classList.length > keys(classMap).length) {
6573
6614
  nodesAreCompatible = false;
6574
6615
  }
6616
+ } else if (isUndefined$1(className) && elmClassName !== '') {
6617
+ // SSR contains a className but client-side VDOM does not
6618
+ nodesAreCompatible = false;
6575
6619
  }
6576
6620
 
6577
6621
  return nodesAreCompatible;
@@ -6716,7 +6760,7 @@
6716
6760
 
6717
6761
  return ctor;
6718
6762
  }
6719
- /* version: 2.27.0 */
6763
+ /* version: 2.28.1 */
6720
6764
 
6721
6765
  /*
6722
6766
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7042,10 +7086,12 @@
7042
7086
  var pendingRegistryForElement = new WeakMap();
7043
7087
  var definitionForConstructor = new WeakMap();
7044
7088
  var registeredUserCtors = new WeakSet();
7089
+ var registeredPivotCtors = new WeakSet();
7045
7090
  var pivotCtorByTag = new Map();
7046
7091
  var globalDefinitionsByTag = new Map();
7047
7092
  var globalDefinitionsByClass = new Map();
7048
7093
  var awaitingUpgrade = new Map();
7094
+ var pendingWhenDefinedCallbacks = new Map();
7049
7095
  var EMPTY_SET = new Set();
7050
7096
 
7051
7097
  function createDefinitionRecord(constructor) {
@@ -7187,6 +7233,7 @@
7187
7233
  }(NativeHTMLElement);
7188
7234
 
7189
7235
  PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
7236
+ registeredPivotCtors.add(PivotCtor);
7190
7237
  return PivotCtor;
7191
7238
  }
7192
7239
 
@@ -7337,6 +7384,43 @@
7337
7384
  }
7338
7385
 
7339
7386
  return createDefinitionRecord(constructor);
7387
+ } // Defer a `whenDefined()` callback until an externally-visible custom element is defined
7388
+
7389
+
7390
+ function createPendingWhenDefinedCallback(tagName) {
7391
+ return new Promise(function (resolve) {
7392
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7393
+
7394
+ if (isUndefined$1(resolvers)) {
7395
+ resolvers = [];
7396
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
7397
+ }
7398
+
7399
+ resolvers.push(resolve);
7400
+ });
7401
+ } // Call any pending `whenDefined()` callbacks
7402
+
7403
+
7404
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7405
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7406
+
7407
+ if (!isUndefined$1(resolvers)) {
7408
+ var _iterator6 = _createForOfIteratorHelper(resolvers),
7409
+ _step6;
7410
+
7411
+ try {
7412
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7413
+ var resolver = _step6.value;
7414
+ resolver(ctor);
7415
+ }
7416
+ } catch (err) {
7417
+ _iterator6.e(err);
7418
+ } finally {
7419
+ _iterator6.f();
7420
+ }
7421
+ }
7422
+
7423
+ pendingWhenDefinedCallbacks.delete(tagName);
7340
7424
  }
7341
7425
 
7342
7426
  var _window2 = window,
@@ -7391,12 +7475,12 @@
7391
7475
  if (!isUndefined$1(awaiting)) {
7392
7476
  awaitingUpgrade.delete(tagName);
7393
7477
 
7394
- var _iterator6 = _createForOfIteratorHelper(awaiting),
7395
- _step6;
7478
+ var _iterator7 = _createForOfIteratorHelper(awaiting),
7479
+ _step7;
7396
7480
 
7397
7481
  try {
7398
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7399
- var element = _step6.value;
7482
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7483
+ var element = _step7.value;
7400
7484
  var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7401
7485
  // is only populated when we haven't run internalUpgrade yet, and we only populate
7402
7486
  // pendingRegistryForElement when internalUpgrade hasn't run yet.
@@ -7408,11 +7492,14 @@
7408
7492
  }
7409
7493
  }
7410
7494
  } catch (err) {
7411
- _iterator6.e(err);
7495
+ _iterator7.e(err);
7412
7496
  } finally {
7413
- _iterator6.f();
7497
+ _iterator7.f();
7414
7498
  }
7415
- }
7499
+ } // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
7500
+
7501
+
7502
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
7416
7503
  };
7417
7504
 
7418
7505
  CustomElementRegistry.prototype.get = function get(tagName) {
@@ -7423,10 +7510,13 @@
7423
7510
 
7424
7511
  if (!isUndefined$1(definition)) {
7425
7512
  return definition.UserCtor; // defined by the patched custom elements registry
7426
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7513
+ }
7427
7514
 
7515
+ if (registeredPivotCtors.has(NativeCtor)) {
7516
+ return undefined; // pivot constructors should not be observable, return undefined
7517
+ }
7428
7518
 
7429
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
7519
+ return NativeCtor; // constructor that existed before patching
7430
7520
  }
7431
7521
  };
7432
7522
 
@@ -7436,15 +7526,20 @@
7436
7526
 
7437
7527
  if (!isUndefined$1(definition)) {
7438
7528
  return definition.UserCtor;
7439
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7440
- // In this case, the custom element must have been defined before the registry patches
7529
+ } // In this case, the custom element must have been defined before the registry patches
7441
7530
  // were applied. So return the non-pivot constructor
7442
7531
 
7443
7532
 
7444
7533
  if (isUndefined$1(NativeCtor)) {
7445
7534
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7446
7535
  // We can patch the correct behavior using customElements.get()
7447
- return nativeGet.call(nativeRegistry, tagName);
7536
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
7537
+ }
7538
+
7539
+ if (registeredPivotCtors.has(NativeCtor)) {
7540
+ // Pivot constructors should not be observable. Wait to resolve the promise
7541
+ // if a constructor is ever defined in userland
7542
+ return createPendingWhenDefinedCallback(tagName);
7448
7543
  }
7449
7544
 
7450
7545
  return NativeCtor;
@@ -7708,7 +7803,7 @@
7708
7803
  function isNull(obj) {
7709
7804
  return obj === null;
7710
7805
  }
7711
- /** version: 2.27.0 */
7806
+ /** version: 2.28.1 */
7712
7807
 
7713
7808
  /*
7714
7809
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7776,18 +7871,18 @@
7776
7871
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
7777
7872
 
7778
7873
  if (!isUndefined(wrapperTags)) {
7779
- var _iterator7 = _createForOfIteratorHelper(wrapperTags),
7780
- _step7;
7874
+ var _iterator8 = _createForOfIteratorHelper(wrapperTags),
7875
+ _step8;
7781
7876
 
7782
7877
  try {
7783
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7784
- var wrapperTag = _step7.value;
7878
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7879
+ var wrapperTag = _step8.value;
7785
7880
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
7786
7881
  }
7787
7882
  } catch (err) {
7788
- _iterator7.e(err);
7883
+ _iterator8.e(err);
7789
7884
  } finally {
7790
- _iterator7.f();
7885
+ _iterator8.f();
7791
7886
  }
7792
7887
  } // For IE11, the document title must not be undefined, but it can be an empty string
7793
7888
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -8368,7 +8463,7 @@
8368
8463
  });
8369
8464
  freeze(LightningElement);
8370
8465
  seal(LightningElement.prototype);
8371
- /* version: 2.27.0 */
8466
+ /* version: 2.28.1 */
8372
8467
 
8373
8468
  exports.LightningElement = LightningElement;
8374
8469
  exports.__unstable__ProfilerControl = profilerControl;
@@ -47,7 +47,7 @@ var assert = /*#__PURE__*/Object.freeze({
47
47
  */
48
48
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
49
49
  const { isArray: isArray$1 } = Array;
50
- 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;
50
+ 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;
51
51
  const { fromCharCode: StringFromCharCode } = String;
52
52
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
53
53
  function isUndefined$1(obj) {
@@ -436,9 +436,9 @@ function htmlEscape(str, attrMode = false) {
436
436
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
437
437
  */
438
438
  // Increment whenever the LWC template compiler changes
439
- const LWC_VERSION = "2.27.0";
439
+ const LWC_VERSION = "2.28.1";
440
440
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
441
- /** version: 2.27.0 */
441
+ /** version: 2.28.1 */
442
442
 
443
443
  /*
444
444
  * Copyright (c) 2020, salesforce.com, inc.
@@ -550,7 +550,7 @@ function setFeatureFlagForTest(name, value) {
550
550
  setFeatureFlag(name, value);
551
551
  }
552
552
  }
553
- /** version: 2.27.0 */
553
+ /** version: 2.28.1 */
554
554
 
555
555
  /* proxy-compat-disable */
556
556
 
@@ -3441,6 +3441,9 @@ function isVBaseElement(vnode) {
3441
3441
  function isSameVnode(vnode1, vnode2) {
3442
3442
  return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
3443
3443
  }
3444
+ function isVFragment(vnode) {
3445
+ return vnode.type === 5 /* VNodeType.Fragment */;
3446
+ }
3444
3447
  function isVScopedSlotFragment(vnode) {
3445
3448
  return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
3446
3449
  }
@@ -3960,9 +3963,14 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3960
3963
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3961
3964
  disconnectRootElement(elm);
3962
3965
  }
3963
- };
3966
+ }; // Should never get a tag with upper case letter at this point; the compiler
3967
+ // should produce only tags with lowercase letters. However, the Java
3968
+ // compiler may generate tagnames with uppercase letters so - for backwards
3969
+ // compatibility, we lower case the tagname here.
3964
3970
 
3965
- const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
3971
+
3972
+ const normalizedTagname = sel.toLowerCase();
3973
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3966
3974
  vnode.elm = elm;
3967
3975
  vnode.vm = vm;
3968
3976
  linkNodeToShadow(elm, owner, renderer);
@@ -4256,6 +4264,17 @@ function allocateChildren(vnode, vm) {
4256
4264
  shadowMode
4257
4265
  } = vm;
4258
4266
 
4267
+ if (process.env.NODE_ENV !== 'production') {
4268
+ // If any of the children being allocated is a scoped slot fragment, make sure the receiving
4269
+ // component is a light DOM component. This is mainly to validate light dom parent running
4270
+ // in native shadow mode.
4271
+ if (renderMode !== 0
4272
+ /* RenderMode.Light */
4273
+ && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4274
+ logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
4275
+ }
4276
+ }
4277
+
4259
4278
  if (shadowMode === 1
4260
4279
  /* ShadowMode.Synthetic */
4261
4280
  || renderMode === 0
@@ -4297,26 +4316,26 @@ function createViewModelHook(elm, vnode, renderer) {
4297
4316
 
4298
4317
  return vm;
4299
4318
  }
4319
+ /**
4320
+ * Collects all slots into a SlotSet, traversing through VFragment Nodes
4321
+ */
4300
4322
 
4301
- function allocateInSlot(vm, children, owner) {
4302
- var _a, _b;
4303
4323
 
4304
- const {
4305
- cmpSlots: {
4306
- slotAssignments: oldSlotsMapping
4307
- }
4308
- } = vm;
4309
- const cmpSlotsMapping = create(null);
4310
- vm.cmpSlots = {
4311
- owner,
4312
- slotAssignments: cmpSlotsMapping
4313
- };
4324
+ function collectSlots(vm, children, cmpSlotsMapping) {
4325
+ var _a, _b;
4314
4326
 
4315
4327
  for (let i = 0, len = children.length; i < len; i += 1) {
4316
4328
  const vnode = children[i];
4317
4329
 
4318
4330
  if (isNull(vnode)) {
4319
4331
  continue;
4332
+ } // Dive further iff the content is wrapped in a VFragment
4333
+
4334
+
4335
+ if (isVFragment(vnode)) {
4336
+ // Remove the text delimiter nodes to avoid overriding default slot content
4337
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4338
+ continue;
4320
4339
  }
4321
4340
 
4322
4341
  let slotName = '';
@@ -4330,6 +4349,20 @@ function allocateInSlot(vm, children, owner) {
4330
4349
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4331
4350
  ArrayPush$1.call(vnodes, vnode);
4332
4351
  }
4352
+ }
4353
+
4354
+ function allocateInSlot(vm, children, owner) {
4355
+ const {
4356
+ cmpSlots: {
4357
+ slotAssignments: oldSlotsMapping
4358
+ }
4359
+ } = vm;
4360
+ const cmpSlotsMapping = create(null);
4361
+ collectSlots(vm, children, cmpSlotsMapping);
4362
+ vm.cmpSlots = {
4363
+ owner,
4364
+ slotAssignments: cmpSlotsMapping
4365
+ };
4333
4366
 
4334
4367
  if (isFalse(vm.isDirty)) {
4335
4368
  // We need to determine if the old allocation is really different from the new one
@@ -4650,27 +4683,42 @@ function s(slotName, data, children, slotset) {
4650
4683
  !isUndefined$1(slotset.slotAssignments) &&
4651
4684
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
4652
4685
  slotset.slotAssignments[slotName].length !== 0) {
4653
- children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
4654
- // If the passed slot content is factory, evaluate it and use the produced vnodes
4655
- if (vnode && isVScopedSlotFragment(vnode)) {
4656
- const vmBeingRenderedInception = getVMBeingRendered();
4657
- let children = [];
4658
- // Evaluate in the scope of the slot content's owner
4659
- // if a slotset is provided, there will always be an owner. The only case where owner is
4660
- // undefined is for root components, but root components cannot accept slotted content
4661
- setVMBeingRendered(slotset.owner);
4662
- try {
4663
- children = vnode.factory(data.slotData);
4686
+ children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4687
+ if (vnode) {
4688
+ const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4689
+ // The only sniff test for a scoped <slot> element is the presence of `slotData`
4690
+ const isScopedSlotElement = !isUndefined$1(data.slotData);
4691
+ // Check if slot types of parent and child are matching
4692
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4693
+ if (process.env.NODE_ENV !== 'production') {
4694
+ 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);
4695
+ }
4696
+ // Ignore slot content from parent
4697
+ return accumulator;
4664
4698
  }
4665
- finally {
4666
- setVMBeingRendered(vmBeingRenderedInception);
4699
+ // If the passed slot content is factory, evaluate it and add the produced vnodes
4700
+ if (assignedNodeIsScopedSlot) {
4701
+ const vmBeingRenderedInception = getVMBeingRendered();
4702
+ let scopedSlotChildren = [];
4703
+ // Evaluate in the scope of the slot content's owner
4704
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4705
+ // undefined is for root components, but root components cannot accept slotted content
4706
+ setVMBeingRendered(slotset.owner);
4707
+ try {
4708
+ scopedSlotChildren = vnode.factory(data.slotData);
4709
+ }
4710
+ finally {
4711
+ setVMBeingRendered(vmBeingRenderedInception);
4712
+ }
4713
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4714
+ }
4715
+ else {
4716
+ // If the slot content is standard type, the content is static, no additional
4717
+ // processing needed on the vnode
4718
+ return ArrayConcat$1.call(accumulator, vnode);
4667
4719
  }
4668
- return ArrayConcat$1.call(acc, children);
4669
- }
4670
- else {
4671
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
4672
- return ArrayConcat$1.call(acc, vnode);
4673
4720
  }
4721
+ return accumulator;
4674
4722
  }, []);
4675
4723
  }
4676
4724
  const vmBeingRendered = getVMBeingRendered();
@@ -6456,7 +6504,7 @@ function freezeTemplate(tmpl) {
6456
6504
  });
6457
6505
  }
6458
6506
  }
6459
- /* version: 2.27.0 */
6507
+ /* version: 2.28.1 */
6460
6508
 
6461
6509
  /*
6462
6510
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6542,7 +6590,13 @@ function remove(node, parent) {
6542
6590
  parent[HostChildrenKey].splice(nodeIndex, 1);
6543
6591
  }
6544
6592
  function cloneNode(node) {
6545
- return node;
6593
+ // Note: no need to deep clone as cloneNode is only used for nodes of type HostNodeType.Raw.
6594
+ if (process.env.NODE_ENV !== 'production') {
6595
+ if (node[HostTypeKey] !== HostNodeType.Raw) {
6596
+ throw new TypeError(`SSR: cloneNode was called with invalid NodeType <${node[HostTypeKey]}>, only HostNodeType.Raw is supported.`);
6597
+ }
6598
+ }
6599
+ return Object.assign({}, node);
6546
6600
  }
6547
6601
  function createFragment(html) {
6548
6602
  return {
@@ -6921,7 +6975,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6921
6975
  */
6922
6976
  freeze(LightningElement);
6923
6977
  seal(LightningElement.prototype);
6924
- /* version: 2.27.0 */
6978
+ /* version: 2.28.1 */
6925
6979
 
6926
6980
  exports.LightningElement = LightningElement;
6927
6981
  exports.api = api$1;