lwc 2.5.1 → 2.5.4

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 (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +84 -73
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +85 -74
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +68 -55
  5. package/dist/engine-dom/iife/es5/engine-dom.js +125 -93
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +106 -72
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +86 -75
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +69 -56
  11. package/dist/engine-dom/umd/es5/engine-dom.js +126 -94
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +107 -73
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +66 -73
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +66 -73
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +75 -39
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +76 -40
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +75 -39
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +76 -40
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +75 -39
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +77 -41
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +76 -40
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +77 -41
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +76 -40
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +3 -3
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
  33. package/dist/wire-service/iife/es5/wire-service.js +3 -3
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
  36. package/dist/wire-service/umd/es2017/wire-service.js +4 -4
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
  38. package/dist/wire-service/umd/es5/wire-service.js +4 -4
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
  41. package/package.json +8 -8
@@ -299,7 +299,7 @@ function htmlPropertyToAttribute(propName) {
299
299
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
300
300
  return attributeName;
301
301
  }
302
- /** version: 2.5.1 */
302
+ /** version: 2.5.4 */
303
303
 
304
304
  /*
305
305
  * Copyright (c) 2018, salesforce.com, inc.
@@ -409,6 +409,7 @@ const features = {
409
409
  ENABLE_HMR: null,
410
410
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
411
411
  ENABLE_ELEMENT_PATCH: null,
412
+ ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
412
413
  ENABLE_NODE_LIST_PATCH: null,
413
414
  ENABLE_HTML_COLLECTIONS_PATCH: null,
414
415
  ENABLE_NODE_PATCH: null,
@@ -478,7 +479,7 @@ function setFeatureFlagForTest(name, value) {
478
479
  setFeatureFlag(name, value);
479
480
  }
480
481
  }
481
- /** version: 2.5.1 */
482
+ /** version: 2.5.4 */
482
483
 
483
484
  /* proxy-compat-disable */
484
485
 
@@ -2850,9 +2851,9 @@ function attachShadow(vm) {
2850
2851
  }
2851
2852
  }
2852
2853
 
2853
- function warnIfInvokedDuringConstruction(vm, methodName) {
2854
+ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
2854
2855
  if (isBeingConstructed(vm)) {
2855
- logError(`this.${methodName}() should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
2856
+ logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
2856
2857
  }
2857
2858
  } // @ts-ignore
2858
2859
 
@@ -3012,76 +3013,12 @@ LightningElement.prototype = {
3012
3013
  } = vm;
3013
3014
 
3014
3015
  if (process.env.NODE_ENV !== 'production') {
3015
- warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect');
3016
+ warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
3016
3017
  }
3017
3018
 
3018
3019
  return getBoundingClientRect(elm);
3019
3020
  },
3020
3021
 
3021
- querySelector(selectors) {
3022
- const vm = getAssociatedVM(this);
3023
- const {
3024
- elm,
3025
- renderer: {
3026
- querySelector
3027
- }
3028
- } = vm;
3029
-
3030
- if (process.env.NODE_ENV !== 'production') {
3031
- warnIfInvokedDuringConstruction(vm, 'querySelector');
3032
- }
3033
-
3034
- return querySelector(elm, selectors);
3035
- },
3036
-
3037
- querySelectorAll(selectors) {
3038
- const vm = getAssociatedVM(this);
3039
- const {
3040
- elm,
3041
- renderer: {
3042
- querySelectorAll
3043
- }
3044
- } = vm;
3045
-
3046
- if (process.env.NODE_ENV !== 'production') {
3047
- warnIfInvokedDuringConstruction(vm, 'querySelectorAll');
3048
- }
3049
-
3050
- return querySelectorAll(elm, selectors);
3051
- },
3052
-
3053
- getElementsByTagName(tagNameOrWildCard) {
3054
- const vm = getAssociatedVM(this);
3055
- const {
3056
- elm,
3057
- renderer: {
3058
- getElementsByTagName
3059
- }
3060
- } = vm;
3061
-
3062
- if (process.env.NODE_ENV !== 'production') {
3063
- warnIfInvokedDuringConstruction(vm, 'getElementsByTagName');
3064
- }
3065
-
3066
- return getElementsByTagName(elm, tagNameOrWildCard);
3067
- },
3068
-
3069
- getElementsByClassName(names) {
3070
- const vm = getAssociatedVM(this);
3071
- const {
3072
- elm,
3073
- renderer: {
3074
- getElementsByClassName
3075
- }
3076
- } = vm;
3077
-
3078
- if (process.env.NODE_ENV !== 'production') {
3079
- warnIfInvokedDuringConstruction(vm, 'getElementsByClassName');
3080
- }
3081
-
3082
- return getElementsByClassName(elm, names);
3083
- },
3084
-
3085
3022
  get isConnected() {
3086
3023
  const {
3087
3024
  elm,
@@ -3141,6 +3078,50 @@ LightningElement.prototype = {
3141
3078
  }
3142
3079
 
3143
3080
  };
3081
+ const queryAndChildGetterDescriptors = create(null);
3082
+ const childGetters = [['children', 'getChildren'], ['childNodes', 'getChildNodes'], ['firstChild', 'getFirstChild'], ['firstElementChild', 'getFirstElementChild'], ['lastChild', 'getLastChild'], ['lastElementChild', 'getLastElementChild']]; // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
3083
+
3084
+ for (const [elementProp, rendererMethod] of childGetters) {
3085
+ queryAndChildGetterDescriptors[elementProp] = {
3086
+ get() {
3087
+ const vm = getAssociatedVM(this);
3088
+ const {
3089
+ elm,
3090
+ renderer
3091
+ } = vm;
3092
+
3093
+ if (process.env.NODE_ENV !== 'production') {
3094
+ warnIfInvokedDuringConstruction(vm, elementProp);
3095
+ }
3096
+
3097
+ return renderer[rendererMethod](elm);
3098
+ }
3099
+
3100
+ };
3101
+ }
3102
+
3103
+ const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll']; // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
3104
+
3105
+ for (const queryMethod of queryMethods) {
3106
+ queryAndChildGetterDescriptors[queryMethod] = {
3107
+ value(arg) {
3108
+ const vm = getAssociatedVM(this);
3109
+ const {
3110
+ elm,
3111
+ renderer
3112
+ } = vm;
3113
+
3114
+ if (process.env.NODE_ENV !== 'production') {
3115
+ warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
3116
+ }
3117
+
3118
+ return renderer[queryMethod](elm, arg);
3119
+ }
3120
+
3121
+ };
3122
+ }
3123
+
3124
+ defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
3144
3125
  const lightningBasedDescriptors = create(null);
3145
3126
 
3146
3127
  for (const propName in HTMLElementOriginalDescriptors) {
@@ -5885,9 +5866,9 @@ function validateLightDomTemplate(template, vm) {
5885
5866
  if (vm.renderMode === 0
5886
5867
  /* Light */
5887
5868
  ) {
5888
- assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive on the root template tag.`);
5869
+ assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
5889
5870
  } else {
5890
- assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive or set it to 'lwc:render-mode="shadow"`);
5871
+ assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
5891
5872
  }
5892
5873
  }
5893
5874
 
@@ -6437,6 +6418,12 @@ function createVM(elm, def, options) {
6437
6418
  vm.toString = () => {
6438
6419
  return `[object:vm ${def.name} (${vm.idx})]`;
6439
6420
  };
6421
+
6422
+ if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6423
+ vm.shadowMode = 0
6424
+ /* Native */
6425
+ ;
6426
+ }
6440
6427
  } // Create component instance associated to the vm and the element.
6441
6428
 
6442
6429
 
@@ -7366,7 +7353,7 @@ function readonly(obj) {
7366
7353
 
7367
7354
  return reactiveMembrane.getReadOnlyProxy(obj);
7368
7355
  }
7369
- /* version: 2.5.1 */
7356
+ /* version: 2.5.4 */
7370
7357
 
7371
7358
  /*
7372
7359
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7617,6 +7604,30 @@ const renderer = {
7617
7604
  return element.getElementsByClassName(names);
7618
7605
  },
7619
7606
 
7607
+ getChildren(element) {
7608
+ return element.children;
7609
+ },
7610
+
7611
+ getChildNodes(element) {
7612
+ return element.childNodes;
7613
+ },
7614
+
7615
+ getFirstChild(element) {
7616
+ return element.firstChild;
7617
+ },
7618
+
7619
+ getFirstElementChild(element) {
7620
+ return element.firstElementChild;
7621
+ },
7622
+
7623
+ getLastChild(element) {
7624
+ return element.lastChild;
7625
+ },
7626
+
7627
+ getLastElementChild(element) {
7628
+ return element.lastElementChild;
7629
+ },
7630
+
7620
7631
  isConnected(node) {
7621
7632
  return node.isConnected;
7622
7633
  },
@@ -7924,6 +7935,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
7924
7935
  });
7925
7936
  freeze(LightningElement);
7926
7937
  seal(LightningElement.prototype);
7927
- /* version: 2.5.1 */
7938
+ /* version: 2.5.4 */
7928
7939
 
7929
7940
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, isComponentConstructor, isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
@@ -302,7 +302,7 @@ var LWC = (function (exports) {
302
302
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
303
303
  return attributeName;
304
304
  }
305
- /** version: 2.5.1 */
305
+ /** version: 2.5.4 */
306
306
 
307
307
  /*
308
308
  * Copyright (c) 2018, salesforce.com, inc.
@@ -412,6 +412,7 @@ var LWC = (function (exports) {
412
412
  ENABLE_HMR: null,
413
413
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
414
414
  ENABLE_ELEMENT_PATCH: null,
415
+ ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
415
416
  ENABLE_NODE_LIST_PATCH: null,
416
417
  ENABLE_HTML_COLLECTIONS_PATCH: null,
417
418
  ENABLE_NODE_PATCH: null,
@@ -481,7 +482,7 @@ var LWC = (function (exports) {
481
482
  setFeatureFlag(name, value);
482
483
  }
483
484
  }
484
- /** version: 2.5.1 */
485
+ /** version: 2.5.4 */
485
486
 
486
487
  /* proxy-compat-disable */
487
488
 
@@ -2853,9 +2854,9 @@ var LWC = (function (exports) {
2853
2854
  }
2854
2855
  }
2855
2856
 
2856
- function warnIfInvokedDuringConstruction(vm, methodName) {
2857
+ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
2857
2858
  if (isBeingConstructed(vm)) {
2858
- logError(`this.${methodName}() should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
2859
+ logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
2859
2860
  }
2860
2861
  } // @ts-ignore
2861
2862
 
@@ -3015,76 +3016,12 @@ var LWC = (function (exports) {
3015
3016
  } = vm;
3016
3017
 
3017
3018
  if (process.env.NODE_ENV !== 'production') {
3018
- warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect');
3019
+ warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
3019
3020
  }
3020
3021
 
3021
3022
  return getBoundingClientRect(elm);
3022
3023
  },
3023
3024
 
3024
- querySelector(selectors) {
3025
- const vm = getAssociatedVM(this);
3026
- const {
3027
- elm,
3028
- renderer: {
3029
- querySelector
3030
- }
3031
- } = vm;
3032
-
3033
- if (process.env.NODE_ENV !== 'production') {
3034
- warnIfInvokedDuringConstruction(vm, 'querySelector');
3035
- }
3036
-
3037
- return querySelector(elm, selectors);
3038
- },
3039
-
3040
- querySelectorAll(selectors) {
3041
- const vm = getAssociatedVM(this);
3042
- const {
3043
- elm,
3044
- renderer: {
3045
- querySelectorAll
3046
- }
3047
- } = vm;
3048
-
3049
- if (process.env.NODE_ENV !== 'production') {
3050
- warnIfInvokedDuringConstruction(vm, 'querySelectorAll');
3051
- }
3052
-
3053
- return querySelectorAll(elm, selectors);
3054
- },
3055
-
3056
- getElementsByTagName(tagNameOrWildCard) {
3057
- const vm = getAssociatedVM(this);
3058
- const {
3059
- elm,
3060
- renderer: {
3061
- getElementsByTagName
3062
- }
3063
- } = vm;
3064
-
3065
- if (process.env.NODE_ENV !== 'production') {
3066
- warnIfInvokedDuringConstruction(vm, 'getElementsByTagName');
3067
- }
3068
-
3069
- return getElementsByTagName(elm, tagNameOrWildCard);
3070
- },
3071
-
3072
- getElementsByClassName(names) {
3073
- const vm = getAssociatedVM(this);
3074
- const {
3075
- elm,
3076
- renderer: {
3077
- getElementsByClassName
3078
- }
3079
- } = vm;
3080
-
3081
- if (process.env.NODE_ENV !== 'production') {
3082
- warnIfInvokedDuringConstruction(vm, 'getElementsByClassName');
3083
- }
3084
-
3085
- return getElementsByClassName(elm, names);
3086
- },
3087
-
3088
3025
  get isConnected() {
3089
3026
  const {
3090
3027
  elm,
@@ -3144,6 +3081,50 @@ var LWC = (function (exports) {
3144
3081
  }
3145
3082
 
3146
3083
  };
3084
+ const queryAndChildGetterDescriptors = create(null);
3085
+ const childGetters = [['children', 'getChildren'], ['childNodes', 'getChildNodes'], ['firstChild', 'getFirstChild'], ['firstElementChild', 'getFirstElementChild'], ['lastChild', 'getLastChild'], ['lastElementChild', 'getLastElementChild']]; // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
3086
+
3087
+ for (const [elementProp, rendererMethod] of childGetters) {
3088
+ queryAndChildGetterDescriptors[elementProp] = {
3089
+ get() {
3090
+ const vm = getAssociatedVM(this);
3091
+ const {
3092
+ elm,
3093
+ renderer
3094
+ } = vm;
3095
+
3096
+ if (process.env.NODE_ENV !== 'production') {
3097
+ warnIfInvokedDuringConstruction(vm, elementProp);
3098
+ }
3099
+
3100
+ return renderer[rendererMethod](elm);
3101
+ }
3102
+
3103
+ };
3104
+ }
3105
+
3106
+ const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll']; // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
3107
+
3108
+ for (const queryMethod of queryMethods) {
3109
+ queryAndChildGetterDescriptors[queryMethod] = {
3110
+ value(arg) {
3111
+ const vm = getAssociatedVM(this);
3112
+ const {
3113
+ elm,
3114
+ renderer
3115
+ } = vm;
3116
+
3117
+ if (process.env.NODE_ENV !== 'production') {
3118
+ warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
3119
+ }
3120
+
3121
+ return renderer[queryMethod](elm, arg);
3122
+ }
3123
+
3124
+ };
3125
+ }
3126
+
3127
+ defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
3147
3128
  const lightningBasedDescriptors = create(null);
3148
3129
 
3149
3130
  for (const propName in HTMLElementOriginalDescriptors) {
@@ -5888,9 +5869,9 @@ var LWC = (function (exports) {
5888
5869
  if (vm.renderMode === 0
5889
5870
  /* Light */
5890
5871
  ) {
5891
- assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive on the root template tag.`);
5872
+ assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
5892
5873
  } else {
5893
- assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive or set it to 'lwc:render-mode="shadow"`);
5874
+ assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
5894
5875
  }
5895
5876
  }
5896
5877
 
@@ -6440,6 +6421,12 @@ var LWC = (function (exports) {
6440
6421
  vm.toString = () => {
6441
6422
  return `[object:vm ${def.name} (${vm.idx})]`;
6442
6423
  };
6424
+
6425
+ if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6426
+ vm.shadowMode = 0
6427
+ /* Native */
6428
+ ;
6429
+ }
6443
6430
  } // Create component instance associated to the vm and the element.
6444
6431
 
6445
6432
 
@@ -7369,7 +7356,7 @@ var LWC = (function (exports) {
7369
7356
 
7370
7357
  return reactiveMembrane.getReadOnlyProxy(obj);
7371
7358
  }
7372
- /* version: 2.5.1 */
7359
+ /* version: 2.5.4 */
7373
7360
 
7374
7361
  /*
7375
7362
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7620,6 +7607,30 @@ var LWC = (function (exports) {
7620
7607
  return element.getElementsByClassName(names);
7621
7608
  },
7622
7609
 
7610
+ getChildren(element) {
7611
+ return element.children;
7612
+ },
7613
+
7614
+ getChildNodes(element) {
7615
+ return element.childNodes;
7616
+ },
7617
+
7618
+ getFirstChild(element) {
7619
+ return element.firstChild;
7620
+ },
7621
+
7622
+ getFirstElementChild(element) {
7623
+ return element.firstElementChild;
7624
+ },
7625
+
7626
+ getLastChild(element) {
7627
+ return element.lastChild;
7628
+ },
7629
+
7630
+ getLastElementChild(element) {
7631
+ return element.lastElementChild;
7632
+ },
7633
+
7623
7634
  isConnected(node) {
7624
7635
  return node.isConnected;
7625
7636
  },
@@ -7927,7 +7938,7 @@ var LWC = (function (exports) {
7927
7938
  });
7928
7939
  freeze(LightningElement);
7929
7940
  seal(LightningElement.prototype);
7930
- /* version: 2.5.1 */
7941
+ /* version: 2.5.4 */
7931
7942
 
7932
7943
  exports.LightningElement = LightningElement;
7933
7944
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7958,4 +7969,4 @@ var LWC = (function (exports) {
7958
7969
 
7959
7970
  return exports;
7960
7971
 
7961
- }({}));
7972
+ })({});