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
@@ -135,6 +135,7 @@
135
135
  ArrayReverse = _Array$prototype.reverse,
136
136
  ArrayShift = _Array$prototype.shift,
137
137
  ArraySlice = _Array$prototype.slice,
138
+ ArraySome = _Array$prototype.some,
138
139
  ArraySort = _Array$prototype.sort,
139
140
  ArraySplice = _Array$prototype.splice,
140
141
  ArrayUnshift = _Array$prototype.unshift,
@@ -370,9 +371,9 @@
370
371
  // Increment whenever the LWC template compiler changes
371
372
 
372
373
 
373
- var LWC_VERSION = "2.27.0";
374
+ var LWC_VERSION = "2.28.0";
374
375
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
375
- /** version: 2.27.0 */
376
+ /** version: 2.28.0 */
376
377
 
377
378
  /**
378
379
  * Copyright (C) 2018 salesforce.com, inc.
@@ -466,7 +467,7 @@
466
467
  patch$1(propName);
467
468
  }
468
469
  }
469
- /** version: 2.27.0 */
470
+ /** version: 2.28.0 */
470
471
 
471
472
  /**
472
473
  * Copyright (C) 2018 salesforce.com, inc.
@@ -560,7 +561,7 @@
560
561
  setFeatureFlag(name, value);
561
562
  }
562
563
  }
563
- /** version: 2.27.0 */
564
+ /** version: 2.28.0 */
564
565
 
565
566
  /*
566
567
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5082,9 +5083,14 @@
5082
5083
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
5083
5084
  disconnectRootElement(elm);
5084
5085
  }
5085
- };
5086
+ }; // Should never get a tag with upper case letter at this point; the compiler
5087
+ // should produce only tags with lowercase letters. However, the Java
5088
+ // compiler may generate tagnames with uppercase letters so - for backwards
5089
+ // compatibility, we lower case the tagname here.
5090
+
5086
5091
 
5087
- var elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
5092
+ var normalizedTagname = sel.toLowerCase();
5093
+ var elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
5088
5094
  vnode.elm = elm;
5089
5095
  vnode.vm = vm;
5090
5096
  linkNodeToShadow(elm, owner, renderer);
@@ -5372,6 +5378,19 @@
5372
5378
  var renderMode = vm.renderMode,
5373
5379
  shadowMode = vm.shadowMode;
5374
5380
 
5381
+ if (process.env.NODE_ENV !== 'production') {
5382
+ // If any of the children being allocated is a scoped slot fragment, make sure the receiving
5383
+ // component is a light DOM component. This is mainly to validate light dom parent running
5384
+ // in native shadow mode.
5385
+ if (renderMode !== 0
5386
+ /* RenderMode.Light */
5387
+ && ArraySome.call(children, function (child) {
5388
+ return !isNull(child) && isVScopedSlotFragment(child);
5389
+ })) {
5390
+ logError("Invalid usage of 'lwc:slot-data' on ".concat(getComponentTag(vm), " tag. Scoped slot content can only be passed to a light dom child."));
5391
+ }
5392
+ }
5393
+
5375
5394
  if (shadowMode === 1
5376
5395
  /* ShadowMode.Synthetic */
5377
5396
  || renderMode === 0
@@ -5780,27 +5799,45 @@
5780
5799
  }
5781
5800
 
5782
5801
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
5783
- children = slotset.slotAssignments[slotName].reduce(function (acc, vnode) {
5784
- // If the passed slot content is factory, evaluate it and use the produced vnodes
5785
- if (vnode && isVScopedSlotFragment(vnode)) {
5786
- var vmBeingRenderedInception = getVMBeingRendered();
5787
- var _children = []; // Evaluate in the scope of the slot content's owner
5788
- // if a slotset is provided, there will always be an owner. The only case where owner is
5789
- // undefined is for root components, but root components cannot accept slotted content
5790
-
5791
- setVMBeingRendered(slotset.owner);
5792
-
5793
- try {
5794
- _children = vnode.factory(data.slotData);
5795
- } finally {
5796
- setVMBeingRendered(vmBeingRenderedInception);
5797
- }
5802
+ children = slotset.slotAssignments[slotName].reduce(function (accumulator, vnode) {
5803
+ if (vnode) {
5804
+ var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode); // The only sniff test for a scoped <slot> element is the presence of `slotData`
5798
5805
 
5799
- return ArrayConcat$1.call(acc, _children);
5800
- } else {
5801
- // If the slot content is a static list of child nodes provided by the parent, nothing to do
5802
- return ArrayConcat$1.call(acc, vnode);
5806
+ var isScopedSlotElement = !isUndefined$1(data.slotData); // Check if slot types of parent and child are matching
5807
+
5808
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
5809
+ if (process.env.NODE_ENV !== 'production') {
5810
+ logError("Mismatched slot types for ".concat(slotName === '' ? '(default)' : slotName, " slot. Both parent and child component must use standard type or scoped type for a given slot."), slotset.owner);
5811
+ } // Ignore slot content from parent
5812
+
5813
+
5814
+ return accumulator;
5815
+ } // If the passed slot content is factory, evaluate it and add the produced vnodes
5816
+
5817
+
5818
+ if (assignedNodeIsScopedSlot) {
5819
+ var vmBeingRenderedInception = getVMBeingRendered();
5820
+ var scopedSlotChildren = []; // Evaluate in the scope of the slot content's owner
5821
+ // if a slotset is provided, there will always be an owner. The only case where owner is
5822
+ // undefined is for root components, but root components cannot accept slotted content
5823
+
5824
+ setVMBeingRendered(slotset.owner);
5825
+
5826
+ try {
5827
+ scopedSlotChildren = vnode.factory(data.slotData);
5828
+ } finally {
5829
+ setVMBeingRendered(vmBeingRenderedInception);
5830
+ }
5831
+
5832
+ return ArrayConcat$1.call(accumulator, scopedSlotChildren);
5833
+ } else {
5834
+ // If the slot content is standard type, the content is static, no additional
5835
+ // processing needed on the vnode
5836
+ return ArrayConcat$1.call(accumulator, vnode);
5837
+ }
5803
5838
  }
5839
+
5840
+ return accumulator;
5804
5841
  }, []);
5805
5842
  }
5806
5843
 
@@ -8539,7 +8576,7 @@
8539
8576
 
8540
8577
  return ctor;
8541
8578
  }
8542
- /* version: 2.27.0 */
8579
+ /* version: 2.28.0 */
8543
8580
 
8544
8581
  /*
8545
8582
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8874,10 +8911,12 @@
8874
8911
  var pendingRegistryForElement = new WeakMap();
8875
8912
  var definitionForConstructor = new WeakMap();
8876
8913
  var registeredUserCtors = new WeakSet();
8914
+ var registeredPivotCtors = new WeakSet();
8877
8915
  var pivotCtorByTag = new Map();
8878
8916
  var globalDefinitionsByTag = new Map();
8879
8917
  var globalDefinitionsByClass = new Map();
8880
8918
  var awaitingUpgrade = new Map();
8919
+ var pendingWhenDefinedCallbacks = new Map();
8881
8920
  var EMPTY_SET = new Set();
8882
8921
 
8883
8922
  function createDefinitionRecord(constructor) {
@@ -9019,6 +9058,7 @@
9019
9058
  }(NativeHTMLElement);
9020
9059
 
9021
9060
  PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
9061
+ registeredPivotCtors.add(PivotCtor);
9022
9062
  return PivotCtor;
9023
9063
  }
9024
9064
 
@@ -9169,6 +9209,43 @@
9169
9209
  }
9170
9210
 
9171
9211
  return createDefinitionRecord(constructor);
9212
+ } // Defer a `whenDefined()` callback until an externally-visible custom element is defined
9213
+
9214
+
9215
+ function createPendingWhenDefinedCallback(tagName) {
9216
+ return new Promise(function (resolve) {
9217
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
9218
+
9219
+ if (isUndefined$1(resolvers)) {
9220
+ resolvers = [];
9221
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
9222
+ }
9223
+
9224
+ resolvers.push(resolve);
9225
+ });
9226
+ } // Call any pending `whenDefined()` callbacks
9227
+
9228
+
9229
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
9230
+ var resolvers = pendingWhenDefinedCallbacks.get(tagName);
9231
+
9232
+ if (!isUndefined$1(resolvers)) {
9233
+ var _iterator6 = _createForOfIteratorHelper(resolvers),
9234
+ _step6;
9235
+
9236
+ try {
9237
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
9238
+ var resolver = _step6.value;
9239
+ resolver(ctor);
9240
+ }
9241
+ } catch (err) {
9242
+ _iterator6.e(err);
9243
+ } finally {
9244
+ _iterator6.f();
9245
+ }
9246
+ }
9247
+
9248
+ pendingWhenDefinedCallbacks.delete(tagName);
9172
9249
  }
9173
9250
 
9174
9251
  var _window2 = window,
@@ -9223,12 +9300,12 @@
9223
9300
  if (!isUndefined$1(awaiting)) {
9224
9301
  awaitingUpgrade.delete(tagName);
9225
9302
 
9226
- var _iterator6 = _createForOfIteratorHelper(awaiting),
9227
- _step6;
9303
+ var _iterator7 = _createForOfIteratorHelper(awaiting),
9304
+ _step7;
9228
9305
 
9229
9306
  try {
9230
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
9231
- var element = _step6.value;
9307
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
9308
+ var element = _step7.value;
9232
9309
  var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
9233
9310
  // is only populated when we haven't run internalUpgrade yet, and we only populate
9234
9311
  // pendingRegistryForElement when internalUpgrade hasn't run yet.
@@ -9240,11 +9317,14 @@
9240
9317
  }
9241
9318
  }
9242
9319
  } catch (err) {
9243
- _iterator6.e(err);
9320
+ _iterator7.e(err);
9244
9321
  } finally {
9245
- _iterator6.f();
9322
+ _iterator7.f();
9246
9323
  }
9247
- }
9324
+ } // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
9325
+
9326
+
9327
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
9248
9328
  };
9249
9329
 
9250
9330
  CustomElementRegistry.prototype.get = function get(tagName) {
@@ -9255,10 +9335,13 @@
9255
9335
 
9256
9336
  if (!isUndefined$1(definition)) {
9257
9337
  return definition.UserCtor; // defined by the patched custom elements registry
9258
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9338
+ }
9259
9339
 
9340
+ if (registeredPivotCtors.has(NativeCtor)) {
9341
+ return undefined; // pivot constructors should not be observable, return undefined
9342
+ }
9260
9343
 
9261
- return NativeCtor; // return the pivot constructor or constructor that existed before patching
9344
+ return NativeCtor; // constructor that existed before patching
9262
9345
  }
9263
9346
  };
9264
9347
 
@@ -9268,15 +9351,20 @@
9268
9351
 
9269
9352
  if (!isUndefined$1(definition)) {
9270
9353
  return definition.UserCtor;
9271
- } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9272
- // In this case, the custom element must have been defined before the registry patches
9354
+ } // In this case, the custom element must have been defined before the registry patches
9273
9355
  // were applied. So return the non-pivot constructor
9274
9356
 
9275
9357
 
9276
9358
  if (isUndefined$1(NativeCtor)) {
9277
9359
  // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
9278
9360
  // We can patch the correct behavior using customElements.get()
9279
- return nativeGet.call(nativeRegistry, tagName);
9361
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
9362
+ }
9363
+
9364
+ if (registeredPivotCtors.has(NativeCtor)) {
9365
+ // Pivot constructors should not be observable. Wait to resolve the promise
9366
+ // if a constructor is ever defined in userland
9367
+ return createPendingWhenDefinedCallback(tagName);
9280
9368
  }
9281
9369
 
9282
9370
  return NativeCtor;
@@ -9540,7 +9628,7 @@
9540
9628
  function isNull(obj) {
9541
9629
  return obj === null;
9542
9630
  }
9543
- /** version: 2.27.0 */
9631
+ /** version: 2.28.0 */
9544
9632
 
9545
9633
  /*
9546
9634
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9608,18 +9696,18 @@
9608
9696
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
9609
9697
 
9610
9698
  if (!isUndefined(wrapperTags)) {
9611
- var _iterator7 = _createForOfIteratorHelper(wrapperTags),
9612
- _step7;
9699
+ var _iterator8 = _createForOfIteratorHelper(wrapperTags),
9700
+ _step8;
9613
9701
 
9614
9702
  try {
9615
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
9616
- var wrapperTag = _step7.value;
9703
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
9704
+ var wrapperTag = _step8.value;
9617
9705
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
9618
9706
  }
9619
9707
  } catch (err) {
9620
- _iterator7.e(err);
9708
+ _iterator8.e(err);
9621
9709
  } finally {
9622
- _iterator7.f();
9710
+ _iterator8.f();
9623
9711
  }
9624
9712
  } // For IE11, the document title must not be undefined, but it can be an empty string
9625
9713
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -10207,7 +10295,7 @@
10207
10295
  });
10208
10296
  freeze(LightningElement);
10209
10297
  seal(LightningElement.prototype);
10210
- /* version: 2.27.0 */
10298
+ /* version: 2.28.0 */
10211
10299
 
10212
10300
  exports.LightningElement = LightningElement;
10213
10301
  exports.__unstable__ProfilerControl = profilerControl;