lwc 2.26.2 → 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 +137 -31
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +137 -31
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +119 -27
  5. package/dist/engine-dom/iife/es5/engine-dom.js +179 -44
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +158 -40
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +137 -31
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +119 -27
  11. package/dist/engine-dom/umd/es5/engine-dom.js +179 -44
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +158 -40
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +99 -25
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +99 -25
  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 +8 -8
@@ -120,6 +120,7 @@ var LWC = (function (exports) {
120
120
  setPrototypeOf = Object.setPrototypeOf;
121
121
  var isArray$1 = Array.isArray;
122
122
  var _Array$prototype = Array.prototype,
123
+ ArrayConcat$1 = _Array$prototype.concat,
123
124
  ArrayFilter = _Array$prototype.filter,
124
125
  ArrayIndexOf = _Array$prototype.indexOf,
125
126
  ArrayJoin = _Array$prototype.join,
@@ -347,7 +348,7 @@ var LWC = (function (exports) {
347
348
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
348
349
  return attributeName;
349
350
  }
350
- /** version: 2.26.2 */
351
+ /** version: 2.28.0 */
351
352
 
352
353
  /**
353
354
  * Copyright (C) 2018 salesforce.com, inc.
@@ -441,7 +442,7 @@ var LWC = (function (exports) {
441
442
  patch$1(propName);
442
443
  }
443
444
  }
444
- /** version: 2.26.2 */
445
+ /** version: 2.28.0 */
445
446
 
446
447
  /**
447
448
  * Copyright (C) 2018 salesforce.com, inc.
@@ -3294,6 +3295,12 @@ var LWC = (function (exports) {
3294
3295
  /* VNodeType.CustomElement */
3295
3296
  ;
3296
3297
  }
3298
+
3299
+ function isVScopedSlotFragment(vnode) {
3300
+ return vnode.type === 6
3301
+ /* VNodeType.ScopedSlotFragment */
3302
+ ;
3303
+ }
3297
3304
  /*
3298
3305
  * Copyright (c) 2018, salesforce.com, inc.
3299
3306
  * All rights reserved.
@@ -4078,7 +4085,7 @@ var LWC = (function (exports) {
4078
4085
  /* RenderMode.Light */
4079
4086
  ) {
4080
4087
  // slow path
4081
- allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
4088
+ allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
4082
4089
 
4083
4090
  vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4084
4091
 
@@ -4108,11 +4115,15 @@ var LWC = (function (exports) {
4108
4115
  return vm;
4109
4116
  }
4110
4117
 
4111
- function allocateInSlot(vm, children) {
4112
- var _a;
4118
+ function allocateInSlot(vm, children, owner) {
4119
+ var _a, _b;
4113
4120
 
4114
- var oldSlots = vm.cmpSlots;
4115
- var cmpSlots = vm.cmpSlots = create(null);
4121
+ var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4122
+ var cmpSlotsMapping = create(null);
4123
+ vm.cmpSlots = {
4124
+ owner: owner,
4125
+ slotAssignments: cmpSlotsMapping
4126
+ };
4116
4127
 
4117
4128
  for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
4118
4129
  var vnode = children[_i15];
@@ -4124,19 +4135,21 @@ var LWC = (function (exports) {
4124
4135
  var slotName = '';
4125
4136
 
4126
4137
  if (isVBaseElement(vnode)) {
4127
- slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
4138
+ slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
4139
+ } else if (isVScopedSlotFragment(vnode)) {
4140
+ slotName = vnode.slotName;
4128
4141
  }
4129
4142
 
4130
- var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
4143
+ var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4131
4144
  ArrayPush$1.call(vnodes, vnode);
4132
4145
  }
4133
4146
 
4134
4147
  if (isFalse(vm.isDirty)) {
4135
4148
  // We need to determine if the old allocation is really different from the new one
4136
4149
  // and mark the vm as dirty
4137
- var oldKeys = keys(oldSlots);
4150
+ var oldKeys = keys(oldSlotsMapping);
4138
4151
 
4139
- if (oldKeys.length !== keys(cmpSlots).length) {
4152
+ if (oldKeys.length !== keys(cmpSlotsMapping).length) {
4140
4153
  markComponentAsDirty(vm);
4141
4154
  return;
4142
4155
  }
@@ -4144,15 +4157,15 @@ var LWC = (function (exports) {
4144
4157
  for (var _i16 = 0, _len4 = oldKeys.length; _i16 < _len4; _i16 += 1) {
4145
4158
  var key = oldKeys[_i16];
4146
4159
 
4147
- if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
4160
+ if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4148
4161
  markComponentAsDirty(vm);
4149
4162
  return;
4150
4163
  }
4151
4164
 
4152
- var oldVNodes = oldSlots[key];
4153
- var _vnodes = cmpSlots[key];
4165
+ var oldVNodes = oldSlotsMapping[key];
4166
+ var _vnodes = cmpSlotsMapping[key];
4154
4167
 
4155
- for (var j = 0, a = cmpSlots[key].length; j < a; j += 1) {
4168
+ for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4156
4169
  if (oldVNodes[j] !== _vnodes[j]) {
4157
4170
  markComponentAsDirty(vm);
4158
4171
  return;
@@ -4351,6 +4364,21 @@ var LWC = (function (exports) {
4351
4364
 
4352
4365
  function addVNodeToChildLWC(vnode) {
4353
4366
  ArrayPush$1.call(getVMBeingRendered().velements, vnode);
4367
+ } // [s]coped [s]lot [f]actory
4368
+
4369
+
4370
+ function ssf(slotName, factory) {
4371
+ return {
4372
+ type: 6
4373
+ /* VNodeType.ScopedSlotFragment */
4374
+ ,
4375
+ factory: factory,
4376
+ owner: getVMBeingRendered(),
4377
+ elm: undefined,
4378
+ sel: undefined,
4379
+ key: undefined,
4380
+ slotName: slotName
4381
+ };
4354
4382
  } // [st]atic node
4355
4383
 
4356
4384
 
@@ -4421,8 +4449,44 @@ var LWC = (function (exports) {
4421
4449
 
4422
4450
  function s(slotName, data, children, slotset) {
4423
4451
 
4424
- if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {
4425
- children = slotset[slotName];
4452
+ if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
4453
+ children = slotset.slotAssignments[slotName].reduce(function (accumulator, vnode) {
4454
+ if (vnode) {
4455
+ var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode); // The only sniff test for a scoped <slot> element is the presence of `slotData`
4456
+
4457
+ var isScopedSlotElement = !isUndefined$1(data.slotData); // Check if slot types of parent and child are matching
4458
+
4459
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
4460
+
4461
+
4462
+ return accumulator;
4463
+ } // If the passed slot content is factory, evaluate it and add the produced vnodes
4464
+
4465
+
4466
+ if (assignedNodeIsScopedSlot) {
4467
+ var vmBeingRenderedInception = getVMBeingRendered();
4468
+ var scopedSlotChildren = []; // Evaluate in the scope of the slot content's owner
4469
+ // if a slotset is provided, there will always be an owner. The only case where owner is
4470
+ // undefined is for root components, but root components cannot accept slotted content
4471
+
4472
+ setVMBeingRendered(slotset.owner);
4473
+
4474
+ try {
4475
+ scopedSlotChildren = vnode.factory(data.slotData);
4476
+ } finally {
4477
+ setVMBeingRendered(vmBeingRenderedInception);
4478
+ }
4479
+
4480
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4481
+ } else {
4482
+ // If the slot content is standard type, the content is static, no additional
4483
+ // processing needed on the vnode
4484
+ return ArrayConcat$1.call(accumulator, vnode);
4485
+ }
4486
+ }
4487
+
4488
+ return accumulator;
4489
+ }, []);
4426
4490
  }
4427
4491
 
4428
4492
  var vmBeingRendered = getVMBeingRendered();
@@ -4739,7 +4803,8 @@ var LWC = (function (exports) {
4739
4803
  st: st,
4740
4804
  gid: gid,
4741
4805
  fid: fid,
4742
- shc: shc
4806
+ shc: shc,
4807
+ ssf: ssf
4743
4808
  });
4744
4809
  /** Indicates if operations should be logged by the profiler. */
4745
4810
 
@@ -5350,7 +5415,9 @@ var LWC = (function (exports) {
5350
5415
  velements: EmptyArray,
5351
5416
  cmpProps: create(null),
5352
5417
  cmpFields: create(null),
5353
- cmpSlots: create(null),
5418
+ cmpSlots: {
5419
+ slotAssignments: create(null)
5420
+ },
5354
5421
  oar: create(null),
5355
5422
  cmpTemplate: null,
5356
5423
  hydrated: Boolean(hydrated),
@@ -6666,7 +6733,7 @@ var LWC = (function (exports) {
6666
6733
 
6667
6734
  return ctor;
6668
6735
  }
6669
- /* version: 2.26.2 */
6736
+ /* version: 2.28.0 */
6670
6737
 
6671
6738
  /*
6672
6739
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6992,10 +7059,12 @@ var LWC = (function (exports) {
6992
7059
  var pendingRegistryForElement = new WeakMap();
6993
7060
  var definitionForConstructor = new WeakMap();
6994
7061
  var registeredUserCtors = new WeakSet();
7062
+ var registeredPivotCtors = new WeakSet();
6995
7063
  var pivotCtorByTag = new Map();
6996
7064
  var globalDefinitionsByTag = new Map();
6997
7065
  var globalDefinitionsByClass = new Map();
6998
7066
  var awaitingUpgrade = new Map();
7067
+ var pendingWhenDefinedCallbacks = new Map();
6999
7068
  var EMPTY_SET = new Set();
7000
7069
 
7001
7070
  function createDefinitionRecord(constructor) {
@@ -7137,6 +7206,7 @@ var LWC = (function (exports) {
7137
7206
  }(NativeHTMLElement);
7138
7207
 
7139
7208
  PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
7209
+ registeredPivotCtors.add(PivotCtor);
7140
7210
  return PivotCtor;
7141
7211
  }
7142
7212
 
@@ -7287,6 +7357,43 @@ var LWC = (function (exports) {
7287
7357
  }
7288
7358
 
7289
7359
  return createDefinitionRecord(constructor);
7360
+ } // Defer a `whenDefined()` callback until an externally-visible custom element is defined
7361
+
7362
+
7363
+ function createPendingWhenDefinedCallback(tagName) {
7364
+ return new Promise(function (resolve) {
7365
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7366
+
7367
+ if (isUndefined$1(resolvers)) {
7368
+ resolvers = [];
7369
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
7370
+ }
7371
+
7372
+ resolvers.push(resolve);
7373
+ });
7374
+ } // Call any pending `whenDefined()` callbacks
7375
+
7376
+
7377
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
7378
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
7379
+
7380
+ if (!isUndefined$1(resolvers)) {
7381
+ var _iterator6 = _createForOfIteratorHelper(resolvers),
7382
+ _step6;
7383
+
7384
+ try {
7385
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7386
+ var resolver = _step6.value;
7387
+ resolver(ctor);
7388
+ }
7389
+ } catch (err) {
7390
+ _iterator6.e(err);
7391
+ } finally {
7392
+ _iterator6.f();
7393
+ }
7394
+ }
7395
+
7396
+ pendingWhenDefinedCallbacks.delete(tagName);
7290
7397
  }
7291
7398
 
7292
7399
  var _window2 = window,
@@ -7341,12 +7448,12 @@ var LWC = (function (exports) {
7341
7448
  if (!isUndefined$1(awaiting)) {
7342
7449
  awaitingUpgrade.delete(tagName);
7343
7450
 
7344
- var _iterator6 = _createForOfIteratorHelper(awaiting),
7345
- _step6;
7451
+ var _iterator7 = _createForOfIteratorHelper(awaiting),
7452
+ _step7;
7346
7453
 
7347
7454
  try {
7348
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7349
- var element = _step6.value;
7455
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7456
+ var element = _step7.value;
7350
7457
  var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
7351
7458
  // is only populated when we haven't run internalUpgrade yet, and we only populate
7352
7459
  // pendingRegistryForElement when internalUpgrade hasn't run yet.
@@ -7358,11 +7465,14 @@ var LWC = (function (exports) {
7358
7465
  }
7359
7466
  }
7360
7467
  } catch (err) {
7361
- _iterator6.e(err);
7468
+ _iterator7.e(err);
7362
7469
  } finally {
7363
- _iterator6.f();
7470
+ _iterator7.f();
7364
7471
  }
7365
- }
7472
+ } // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
7473
+
7474
+
7475
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
7366
7476
  };
7367
7477
 
7368
7478
  CustomElementRegistry.prototype.get = function get(tagName) {
@@ -7373,10 +7483,13 @@ var LWC = (function (exports) {
7373
7483
 
7374
7484
  if (!isUndefined$1(definition)) {
7375
7485
  return definition.UserCtor; // defined by the patched custom elements registry
7376
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7486
+ }
7377
7487
 
7488
+ if (registeredPivotCtors.has(NativeCtor)) {
7489
+ return undefined; // pivot constructors should not be observable, return undefined
7490
+ }
7378
7491
 
7379
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
7492
+ return NativeCtor; // constructor that existed before patching
7380
7493
  }
7381
7494
  };
7382
7495
 
@@ -7386,15 +7499,20 @@ var LWC = (function (exports) {
7386
7499
 
7387
7500
  if (!isUndefined$1(definition)) {
7388
7501
  return definition.UserCtor;
7389
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
7390
- // In this case, the custom element must have been defined before the registry patches
7502
+ } // In this case, the custom element must have been defined before the registry patches
7391
7503
  // were applied. So return the non-pivot constructor
7392
7504
 
7393
7505
 
7394
7506
  if (isUndefined$1(NativeCtor)) {
7395
7507
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
7396
7508
  // We can patch the correct behavior using customElements.get()
7397
- return nativeGet.call(nativeRegistry, tagName);
7509
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
7510
+ }
7511
+
7512
+ if (registeredPivotCtors.has(NativeCtor)) {
7513
+ // Pivot constructors should not be observable. Wait to resolve the promise
7514
+ // if a constructor is ever defined in userland
7515
+ return createPendingWhenDefinedCallback(tagName);
7398
7516
  }
7399
7517
 
7400
7518
  return NativeCtor;
@@ -7658,7 +7776,7 @@ var LWC = (function (exports) {
7658
7776
  function isNull(obj) {
7659
7777
  return obj === null;
7660
7778
  }
7661
- /** version: 2.26.2 */
7779
+ /** version: 2.28.0 */
7662
7780
 
7663
7781
  /*
7664
7782
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7726,18 +7844,18 @@ var LWC = (function (exports) {
7726
7844
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
7727
7845
 
7728
7846
  if (!isUndefined(wrapperTags)) {
7729
- var _iterator7 = _createForOfIteratorHelper(wrapperTags),
7730
- _step7;
7847
+ var _iterator8 = _createForOfIteratorHelper(wrapperTags),
7848
+ _step8;
7731
7849
 
7732
7850
  try {
7733
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7734
- var wrapperTag = _step7.value;
7851
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7852
+ var wrapperTag = _step8.value;
7735
7853
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
7736
7854
  }
7737
7855
  } catch (err) {
7738
- _iterator7.e(err);
7856
+ _iterator8.e(err);
7739
7857
  } finally {
7740
- _iterator7.f();
7858
+ _iterator8.f();
7741
7859
  }
7742
7860
  } // For IE11, the document title must not be undefined, but it can be an empty string
7743
7861
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -8318,7 +8436,7 @@ var LWC = (function (exports) {
8318
8436
  });
8319
8437
  freeze(LightningElement);
8320
8438
  seal(LightningElement.prototype);
8321
- /* version: 2.26.2 */
8439
+ /* version: 2.28.0 */
8322
8440
 
8323
8441
  exports.LightningElement = LightningElement;
8324
8442
  exports.__unstable__ProfilerControl = profilerControl;