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
@@ -348,7 +348,7 @@ var LWC = (function (exports) {
348
348
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
349
349
  return attributeName;
350
350
  }
351
- /** version: 2.27.0 */
351
+ /** version: 2.28.1 */
352
352
 
353
353
  /**
354
354
  * Copyright (C) 2018 salesforce.com, inc.
@@ -442,7 +442,7 @@ var LWC = (function (exports) {
442
442
  patch$1(propName);
443
443
  }
444
444
  }
445
- /** version: 2.27.0 */
445
+ /** version: 2.28.1 */
446
446
 
447
447
  /**
448
448
  * Copyright (C) 2018 salesforce.com, inc.
@@ -3296,6 +3296,12 @@ var LWC = (function (exports) {
3296
3296
  ;
3297
3297
  }
3298
3298
 
3299
+ function isVFragment(vnode) {
3300
+ return vnode.type === 5
3301
+ /* VNodeType.Fragment */
3302
+ ;
3303
+ }
3304
+
3299
3305
  function isVScopedSlotFragment(vnode) {
3300
3306
  return vnode.type === 6
3301
3307
  /* VNodeType.ScopedSlotFragment */
@@ -3832,9 +3838,14 @@ var LWC = (function (exports) {
3832
3838
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3833
3839
  disconnectRootElement(elm);
3834
3840
  }
3835
- };
3841
+ }; // Should never get a tag with upper case letter at this point; the compiler
3842
+ // should produce only tags with lowercase letters. However, the Java
3843
+ // compiler may generate tagnames with uppercase letters so - for backwards
3844
+ // compatibility, we lower case the tagname here.
3845
+
3836
3846
 
3837
- var elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
3847
+ var normalizedTagname = sel.toLowerCase();
3848
+ var elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3838
3849
  vnode.elm = elm;
3839
3850
  vnode.vm = vm;
3840
3851
  linkNodeToShadow(elm, owner, renderer);
@@ -4109,22 +4120,26 @@ var LWC = (function (exports) {
4109
4120
 
4110
4121
  return vm;
4111
4122
  }
4123
+ /**
4124
+ * Collects all slots into a SlotSet, traversing through VFragment Nodes
4125
+ */
4112
4126
 
4113
- function allocateInSlot(vm, children, owner) {
4114
- var _a, _b;
4115
4127
 
4116
- var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4117
- var cmpSlotsMapping = create(null);
4118
- vm.cmpSlots = {
4119
- owner: owner,
4120
- slotAssignments: cmpSlotsMapping
4121
- };
4128
+ function collectSlots(vm, children, cmpSlotsMapping) {
4129
+ var _a, _b;
4122
4130
 
4123
4131
  for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
4124
4132
  var vnode = children[_i15];
4125
4133
 
4126
4134
  if (isNull(vnode)) {
4127
4135
  continue;
4136
+ } // Dive further iff the content is wrapped in a VFragment
4137
+
4138
+
4139
+ if (isVFragment(vnode)) {
4140
+ // Remove the text delimiter nodes to avoid overriding default slot content
4141
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4142
+ continue;
4128
4143
  }
4129
4144
 
4130
4145
  var slotName = '';
@@ -4138,6 +4153,16 @@ var LWC = (function (exports) {
4138
4153
  var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4139
4154
  ArrayPush$1.call(vnodes, vnode);
4140
4155
  }
4156
+ }
4157
+
4158
+ function allocateInSlot(vm, children, owner) {
4159
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4160
+ var cmpSlotsMapping = create(null);
4161
+ collectSlots(vm, children, cmpSlotsMapping);
4162
+ vm.cmpSlots = {
4163
+ owner: owner,
4164
+ slotAssignments: cmpSlotsMapping
4165
+ };
4141
4166
 
4142
4167
  if (isFalse(vm.isDirty)) {
4143
4168
  // We need to determine if the old allocation is really different from the new one
@@ -4149,7 +4174,7 @@ var LWC = (function (exports) {
4149
4174
  return;
4150
4175
  }
4151
4176
 
4152
- for (var _i16 = 0, _len4 = oldKeys.length; _i16 < _len4; _i16 += 1) {
4177
+ for (var _i16 = 0, len = oldKeys.length; _i16 < len; _i16 += 1) {
4153
4178
  var key = oldKeys[_i16];
4154
4179
 
4155
4180
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
@@ -4158,10 +4183,10 @@ var LWC = (function (exports) {
4158
4183
  }
4159
4184
 
4160
4185
  var oldVNodes = oldSlotsMapping[key];
4161
- var _vnodes = cmpSlotsMapping[key];
4186
+ var vnodes = cmpSlotsMapping[key];
4162
4187
 
4163
4188
  for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4164
- if (oldVNodes[j] !== _vnodes[j]) {
4189
+ if (oldVNodes[j] !== vnodes[j]) {
4165
4190
  markComponentAsDirty(vm);
4166
4191
  return;
4167
4192
  }
@@ -4445,27 +4470,42 @@ var LWC = (function (exports) {
4445
4470
  function s(slotName, data, children, slotset) {
4446
4471
 
4447
4472
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
4448
- children = slotset.slotAssignments[slotName].reduce(function (acc, vnode) {
4449
- // If the passed slot content is factory, evaluate it and use the produced vnodes
4450
- if (vnode && isVScopedSlotFragment(vnode)) {
4451
- var vmBeingRenderedInception = getVMBeingRendered();
4452
- var _children = []; // Evaluate in the scope of the slot content's owner
4453
- // if a slotset is provided, there will always be an owner. The only case where owner is
4454
- // undefined is for root components, but root components cannot accept slotted content
4455
-
4456
- setVMBeingRendered(slotset.owner);
4457
-
4458
- try {
4459
- _children = vnode.factory(data.slotData);
4460
- } finally {
4461
- setVMBeingRendered(vmBeingRenderedInception);
4462
- }
4473
+ children = slotset.slotAssignments[slotName].reduce(function (accumulator, vnode) {
4474
+ if (vnode) {
4475
+ var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode); // The only sniff test for a scoped <slot> element is the presence of `slotData`
4463
4476
 
4464
- return ArrayConcat$1.call(acc, _children);
4465
- } else {
4466
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
4467
- return ArrayConcat$1.call(acc, vnode);
4477
+ var isScopedSlotElement = !isUndefined$1(data.slotData); // Check if slot types of parent and child are matching
4478
+
4479
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4480
+
4481
+
4482
+ return accumulator;
4483
+ } // If the passed slot content is factory, evaluate it and add the produced vnodes
4484
+
4485
+
4486
+ if (assignedNodeIsScopedSlot) {
4487
+ var vmBeingRenderedInception = getVMBeingRendered();
4488
+ var scopedSlotChildren = []; // Evaluate in the scope of the slot content's owner
4489
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4490
+ // undefined is for root components, but root components cannot accept slotted content
4491
+
4492
+ setVMBeingRendered(slotset.owner);
4493
+
4494
+ try {
4495
+ scopedSlotChildren = vnode.factory(data.slotData);
4496
+ } finally {
4497
+ setVMBeingRendered(vmBeingRenderedInception);
4498
+ }
4499
+
4500
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4501
+ } else {
4502
+ // If the slot content is standard type, the content is static, no additional
4503
+ // processing needed on the vnode
4504
+ return ArrayConcat$1.call(accumulator, vnode);
4505
+ }
4468
4506
  }
4507
+
4508
+ return accumulator;
4469
4509
  }, []);
4470
4510
  }
4471
4511
 
@@ -4886,7 +4926,7 @@ var LWC = (function (exports) {
4886
4926
 
4887
4927
  function buildParseFragmentFn(createFragmentFn) {
4888
4928
  return function (strings) {
4889
- for (var _len5 = arguments.length, keys = new Array(_len5 > 1 ? _len5 - 1 : 0), _key3 = 1; _key3 < _len5; _key3++) {
4929
+ for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key3 = 1; _key3 < _len4; _key3++) {
4890
4930
  keys[_key3 - 1] = arguments[_key3];
4891
4931
  }
4892
4932
 
@@ -6547,8 +6587,9 @@ var LWC = (function (exports) {
6547
6587
  }
6548
6588
 
6549
6589
  var nodesAreCompatible = true;
6590
+ var elmClassName = getProperty(elm, 'className');
6550
6591
 
6551
- if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
6592
+ if (!isUndefined$1(className) && String(className) !== elmClassName) {
6552
6593
  // className is used when class is bound to an expr.
6553
6594
  nodesAreCompatible = false;
6554
6595
  } else if (!isUndefined$1(classMap)) {
@@ -6569,6 +6610,9 @@ var LWC = (function (exports) {
6569
6610
  if (classList.length > keys(classMap).length) {
6570
6611
  nodesAreCompatible = false;
6571
6612
  }
6613
+ } else if (isUndefined$1(className) && elmClassName !== '') {
6614
+ // SSR contains a className but client-side VDOM does not
6615
+ nodesAreCompatible = false;
6572
6616
  }
6573
6617
 
6574
6618
  return nodesAreCompatible;
@@ -6713,7 +6757,7 @@ var LWC = (function (exports) {
6713
6757
 
6714
6758
  return ctor;
6715
6759
  }
6716
- /* version: 2.27.0 */
6760
+ /* version: 2.28.1 */
6717
6761
 
6718
6762
  /*
6719
6763
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7039,10 +7083,12 @@ var LWC = (function (exports) {
7039
7083
  var pendingRegistryForElement = new WeakMap();
7040
7084
  var definitionForConstructor = new WeakMap();
7041
7085
  var registeredUserCtors = new WeakSet();
7086
+ var registeredPivotCtors = new WeakSet();
7042
7087
  var pivotCtorByTag = new Map();
7043
7088
  var globalDefinitionsByTag = new Map();
7044
7089
  var globalDefinitionsByClass = new Map();
7045
7090
  var awaitingUpgrade = new Map();
7091
+ var pendingWhenDefinedCallbacks = new Map();
7046
7092
  var EMPTY_SET = new Set();
7047
7093
 
7048
7094
  function createDefinitionRecord(constructor) {
@@ -7184,6 +7230,7 @@ var LWC = (function (exports) {
7184
7230
  }(NativeHTMLElement);
7185
7231
 
7186
7232
  PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
7233
+ registeredPivotCtors.add(PivotCtor);
7187
7234
  return PivotCtor;
7188
7235
  }
7189
7236
 
@@ -7334,6 +7381,43 @@ var LWC = (function (exports) {
7334
7381
  }
7335
7382
 
7336
7383
  return createDefinitionRecord(constructor);
7384
+ } // Defer a `whenDefined()` callback until an externally-visible custom element is defined
7385
+
7386
+
7387
+ function createPendingWhenDefinedCallback(tagName) {
7388
+ return new Promise(function (resolve) {
7389
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7390
+
7391
+ if (isUndefined$1(resolvers)) {
7392
+ resolvers = [];
7393
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
7394
+ }
7395
+
7396
+ resolvers.push(resolve);
7397
+ });
7398
+ } // Call any pending `whenDefined()` callbacks
7399
+
7400
+
7401
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7402
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7403
+
7404
+ if (!isUndefined$1(resolvers)) {
7405
+ var _iterator6 = _createForOfIteratorHelper(resolvers),
7406
+ _step6;
7407
+
7408
+ try {
7409
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7410
+ var resolver = _step6.value;
7411
+ resolver(ctor);
7412
+ }
7413
+ } catch (err) {
7414
+ _iterator6.e(err);
7415
+ } finally {
7416
+ _iterator6.f();
7417
+ }
7418
+ }
7419
+
7420
+ pendingWhenDefinedCallbacks.delete(tagName);
7337
7421
  }
7338
7422
 
7339
7423
  var _window2 = window,
@@ -7388,12 +7472,12 @@ var LWC = (function (exports) {
7388
7472
  if (!isUndefined$1(awaiting)) {
7389
7473
  awaitingUpgrade.delete(tagName);
7390
7474
 
7391
- var _iterator6 = _createForOfIteratorHelper(awaiting),
7392
- _step6;
7475
+ var _iterator7 = _createForOfIteratorHelper(awaiting),
7476
+ _step7;
7393
7477
 
7394
7478
  try {
7395
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7396
- var element = _step6.value;
7479
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7480
+ var element = _step7.value;
7397
7481
  var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7398
7482
  // is only populated when we haven't run internalUpgrade yet, and we only populate
7399
7483
  // pendingRegistryForElement when internalUpgrade hasn't run yet.
@@ -7405,11 +7489,14 @@ var LWC = (function (exports) {
7405
7489
  }
7406
7490
  }
7407
7491
  } catch (err) {
7408
- _iterator6.e(err);
7492
+ _iterator7.e(err);
7409
7493
  } finally {
7410
- _iterator6.f();
7494
+ _iterator7.f();
7411
7495
  }
7412
- }
7496
+ } // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
7497
+
7498
+
7499
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
7413
7500
  };
7414
7501
 
7415
7502
  CustomElementRegistry.prototype.get = function get(tagName) {
@@ -7420,10 +7507,13 @@ var LWC = (function (exports) {
7420
7507
 
7421
7508
  if (!isUndefined$1(definition)) {
7422
7509
  return definition.UserCtor; // defined by the patched custom elements registry
7423
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7510
+ }
7424
7511
 
7512
+ if (registeredPivotCtors.has(NativeCtor)) {
7513
+ return undefined; // pivot constructors should not be observable, return undefined
7514
+ }
7425
7515
 
7426
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
7516
+ return NativeCtor; // constructor that existed before patching
7427
7517
  }
7428
7518
  };
7429
7519
 
@@ -7433,15 +7523,20 @@ var LWC = (function (exports) {
7433
7523
 
7434
7524
  if (!isUndefined$1(definition)) {
7435
7525
  return definition.UserCtor;
7436
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7437
- // In this case, the custom element must have been defined before the registry patches
7526
+ } // In this case, the custom element must have been defined before the registry patches
7438
7527
  // were applied. So return the non-pivot constructor
7439
7528
 
7440
7529
 
7441
7530
  if (isUndefined$1(NativeCtor)) {
7442
7531
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7443
7532
  // We can patch the correct behavior using customElements.get()
7444
- return nativeGet.call(nativeRegistry, tagName);
7533
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
7534
+ }
7535
+
7536
+ if (registeredPivotCtors.has(NativeCtor)) {
7537
+ // Pivot constructors should not be observable. Wait to resolve the promise
7538
+ // if a constructor is ever defined in userland
7539
+ return createPendingWhenDefinedCallback(tagName);
7445
7540
  }
7446
7541
 
7447
7542
  return NativeCtor;
@@ -7705,7 +7800,7 @@ var LWC = (function (exports) {
7705
7800
  function isNull(obj) {
7706
7801
  return obj === null;
7707
7802
  }
7708
- /** version: 2.27.0 */
7803
+ /** version: 2.28.1 */
7709
7804
 
7710
7805
  /*
7711
7806
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7773,18 +7868,18 @@ var LWC = (function (exports) {
7773
7868
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
7774
7869
 
7775
7870
  if (!isUndefined(wrapperTags)) {
7776
- var _iterator7 = _createForOfIteratorHelper(wrapperTags),
7777
- _step7;
7871
+ var _iterator8 = _createForOfIteratorHelper(wrapperTags),
7872
+ _step8;
7778
7873
 
7779
7874
  try {
7780
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7781
- var wrapperTag = _step7.value;
7875
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7876
+ var wrapperTag = _step8.value;
7782
7877
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
7783
7878
  }
7784
7879
  } catch (err) {
7785
- _iterator7.e(err);
7880
+ _iterator8.e(err);
7786
7881
  } finally {
7787
- _iterator7.f();
7882
+ _iterator8.f();
7788
7883
  }
7789
7884
  } // For IE11, the document title must not be undefined, but it can be an empty string
7790
7885
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -8365,7 +8460,7 @@ var LWC = (function (exports) {
8365
8460
  });
8366
8461
  freeze(LightningElement);
8367
8462
  seal(LightningElement.prototype);
8368
- /* version: 2.27.0 */
8463
+ /* version: 2.28.1 */
8369
8464
 
8370
8465
  exports.LightningElement = LightningElement;
8371
8466
  exports.__unstable__ProfilerControl = profilerControl;