lwc 2.5.2 → 2.5.6

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 +181 -101
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +183 -101
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +163 -82
  5. package/dist/engine-dom/iife/es5/engine-dom.js +211 -108
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +189 -87
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +184 -102
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +164 -83
  11. package/dist/engine-dom/umd/es5/engine-dom.js +212 -109
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +190 -88
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +174 -99
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +173 -100
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +46 -40
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +47 -41
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +46 -40
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +47 -41
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +46 -40
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +48 -42
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +47 -41
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +48 -42
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +47 -41
  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
@@ -298,7 +298,7 @@ var LWC = (function (exports) {
298
298
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
299
299
  return attributeName;
300
300
  }
301
- /** version: 2.5.2 */
301
+ /** version: 2.5.6 */
302
302
 
303
303
  /*
304
304
  * Copyright (c) 2018, salesforce.com, inc.
@@ -408,6 +408,7 @@ var LWC = (function (exports) {
408
408
  ENABLE_HMR: null,
409
409
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
410
410
  ENABLE_ELEMENT_PATCH: null,
411
+ ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
411
412
  ENABLE_NODE_LIST_PATCH: null,
412
413
  ENABLE_HTML_COLLECTIONS_PATCH: null,
413
414
  ENABLE_NODE_PATCH: null,
@@ -469,7 +470,7 @@ var LWC = (function (exports) {
469
470
 
470
471
  function setFeatureFlagForTest(name, value) {
471
472
  }
472
- /** version: 2.5.2 */
473
+ /** version: 2.5.6 */
473
474
 
474
475
  /* proxy-compat-disable */
475
476
 
@@ -2372,54 +2373,6 @@ var LWC = (function (exports) {
2372
2373
  return getBoundingClientRect(elm);
2373
2374
  },
2374
2375
 
2375
- querySelector(selectors) {
2376
- const vm = getAssociatedVM(this);
2377
- const {
2378
- elm,
2379
- renderer: {
2380
- querySelector
2381
- }
2382
- } = vm;
2383
-
2384
- return querySelector(elm, selectors);
2385
- },
2386
-
2387
- querySelectorAll(selectors) {
2388
- const vm = getAssociatedVM(this);
2389
- const {
2390
- elm,
2391
- renderer: {
2392
- querySelectorAll
2393
- }
2394
- } = vm;
2395
-
2396
- return querySelectorAll(elm, selectors);
2397
- },
2398
-
2399
- getElementsByTagName(tagNameOrWildCard) {
2400
- const vm = getAssociatedVM(this);
2401
- const {
2402
- elm,
2403
- renderer: {
2404
- getElementsByTagName
2405
- }
2406
- } = vm;
2407
-
2408
- return getElementsByTagName(elm, tagNameOrWildCard);
2409
- },
2410
-
2411
- getElementsByClassName(names) {
2412
- const vm = getAssociatedVM(this);
2413
- const {
2414
- elm,
2415
- renderer: {
2416
- getElementsByClassName
2417
- }
2418
- } = vm;
2419
-
2420
- return getElementsByClassName(elm, names);
2421
- },
2422
-
2423
2376
  get isConnected() {
2424
2377
  const {
2425
2378
  elm,
@@ -2465,6 +2418,42 @@ var LWC = (function (exports) {
2465
2418
  }
2466
2419
 
2467
2420
  };
2421
+ const queryAndChildGetterDescriptors = create(null);
2422
+ 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
2423
+
2424
+ for (const [elementProp, rendererMethod] of childGetters) {
2425
+ queryAndChildGetterDescriptors[elementProp] = {
2426
+ get() {
2427
+ const vm = getAssociatedVM(this);
2428
+ const {
2429
+ elm,
2430
+ renderer
2431
+ } = vm;
2432
+
2433
+ return renderer[rendererMethod](elm);
2434
+ }
2435
+
2436
+ };
2437
+ }
2438
+
2439
+ const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll']; // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2440
+
2441
+ for (const queryMethod of queryMethods) {
2442
+ queryAndChildGetterDescriptors[queryMethod] = {
2443
+ value(arg) {
2444
+ const vm = getAssociatedVM(this);
2445
+ const {
2446
+ elm,
2447
+ renderer
2448
+ } = vm;
2449
+
2450
+ return renderer[queryMethod](elm, arg);
2451
+ }
2452
+
2453
+ };
2454
+ }
2455
+
2456
+ defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
2468
2457
  const lightningBasedDescriptors = create(null);
2469
2458
 
2470
2459
  for (const propName in HTMLElementOriginalDescriptors) {
@@ -2892,15 +2881,14 @@ var LWC = (function (exports) {
2892
2881
  return tpl;
2893
2882
  }
2894
2883
  /**
2895
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker
2896
- * Service and other similar libraries to sanitize vulnerable attributes.
2897
- * This API is subject to change or being removed.
2884
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
2885
+ * libraries to sanitize vulnerable attributes.
2898
2886
  */
2899
2887
 
2900
2888
 
2901
2889
  function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
2902
- // locker-service patches this function during runtime to sanitize vulnerable attributes.
2903
- // when ran off-core this function becomes a noop and returns the user authored value.
2890
+ // locker-service patches this function during runtime to sanitize vulnerable attributes. When
2891
+ // ran off-core this function becomes a noop and returns the user authored value.
2904
2892
  return attrValue;
2905
2893
  }
2906
2894
  /*
@@ -3670,6 +3658,38 @@ var LWC = (function (exports) {
3670
3658
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3671
3659
  */
3672
3660
 
3661
+ /**
3662
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
3663
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
3664
+ * lwc:inner-html directive.
3665
+ * It is meant to be overridden with setSanitizeHtmlContentHook
3666
+ */
3667
+
3668
+
3669
+ let sanitizeHtmlContentHook = () => {
3670
+ // locker-service patches this function during runtime to sanitize HTML content.
3671
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
3672
+ };
3673
+ /**
3674
+ * Sets the sanitizeHtmlContentHook.
3675
+ *
3676
+ * @param newHookImpl
3677
+ * @returns oldHookImplementation.
3678
+ */
3679
+
3680
+
3681
+ function setSanitizeHtmlContentHook(newHookImpl) {
3682
+ const currentHook = sanitizeHtmlContentHook;
3683
+ sanitizeHtmlContentHook = newHookImpl;
3684
+ return currentHook;
3685
+ }
3686
+ /*
3687
+ * Copyright (c) 2018, salesforce.com, inc.
3688
+ * All rights reserved.
3689
+ * SPDX-License-Identifier: MIT
3690
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3691
+ */
3692
+
3673
3693
 
3674
3694
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
3675
3695
  const SymbolIterator = Symbol.iterator;
@@ -3964,7 +3984,7 @@ var LWC = (function (exports) {
3964
3984
  next = iterator.next();
3965
3985
  last = next.done; // template factory logic based on the previous collected value
3966
3986
 
3967
- const vnode = factory(value, j, j === 0, last);
3987
+ const vnode = factory(value, j, j === 0, last === true);
3968
3988
 
3969
3989
  if (isArray$1(vnode)) {
3970
3990
  ArrayPush$1.apply(list, vnode);
@@ -4179,25 +4199,29 @@ var LWC = (function (exports) {
4179
4199
 
4180
4200
  markAsDynamicChildren(vnodes);
4181
4201
  return vnodes;
4182
- }
4183
-
4184
- var api = /*#__PURE__*/Object.freeze({
4185
- __proto__: null,
4186
- h: h,
4187
- ti: ti,
4188
- s: s,
4189
- c: c,
4190
- i: i,
4191
- f: f,
4192
- t: t,
4193
- co: co,
4194
- d: d,
4195
- b: b,
4196
- k: k,
4197
- gid: gid,
4198
- fid: fid,
4199
- dc: dc,
4200
- sc: sc
4202
+ } // [s]anitize [h]tml [c]ontent
4203
+
4204
+
4205
+ function shc(content) {
4206
+ return sanitizeHtmlContentHook(content);
4207
+ }
4208
+
4209
+ const api = freeze({
4210
+ s,
4211
+ h,
4212
+ c,
4213
+ i,
4214
+ f,
4215
+ t,
4216
+ d,
4217
+ b,
4218
+ k,
4219
+ co,
4220
+ dc,
4221
+ ti,
4222
+ gid,
4223
+ fid,
4224
+ shc
4201
4225
  });
4202
4226
  /*
4203
4227
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4211,12 +4235,12 @@ var LWC = (function (exports) {
4211
4235
  }
4212
4236
 
4213
4237
  function createInlineStyleVNode(content) {
4214
- return h('style', {
4238
+ return api.h('style', {
4215
4239
  key: 'style',
4216
4240
  attrs: {
4217
4241
  type: 'text/css'
4218
4242
  }
4219
- }, [t(content)]);
4243
+ }, [api.t(content)]);
4220
4244
  }
4221
4245
 
4222
4246
  function updateStylesheetToken(vm, template) {
@@ -5842,7 +5866,35 @@ var LWC = (function (exports) {
5842
5866
 
5843
5867
  return reactiveMembrane.getReadOnlyProxy(obj);
5844
5868
  }
5845
- /* version: 2.5.2 */
5869
+ /*
5870
+ * Copyright (c) 2018, salesforce.com, inc.
5871
+ * All rights reserved.
5872
+ * SPDX-License-Identifier: MIT
5873
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5874
+ */
5875
+
5876
+
5877
+ let hooksAreSet = false;
5878
+
5879
+ function overrideHooks(hooks) {
5880
+ const oldHooks = {};
5881
+
5882
+ if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
5883
+ oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5884
+ }
5885
+
5886
+ return oldHooks;
5887
+ }
5888
+
5889
+ function setHooks(hooks) {
5890
+ assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
5891
+ overrideHooks(hooks);
5892
+ hooksAreSet = true;
5893
+ }
5894
+
5895
+ function setHooksForTest(hooks) {
5896
+ }
5897
+ /* version: 2.5.6 */
5846
5898
 
5847
5899
  /*
5848
5900
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5854,8 +5906,11 @@ var LWC = (function (exports) {
5854
5906
 
5855
5907
  const globalStylesheets = create(null);
5856
5908
 
5857
- const globalStylesheetsParentElement = document.head || document.body || document;
5858
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
5909
+ const globalStylesheetsParentElement = document.head || document.body || document; // This check for constructable stylesheets is similar to Fast's:
5910
+ // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
5911
+ // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
5912
+
5913
+ const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
5859
5914
  const styleElements = create(null);
5860
5915
  const styleSheets = create(null);
5861
5916
  const nodesToStyleSheets = new WeakMap();
@@ -6078,6 +6133,30 @@ var LWC = (function (exports) {
6078
6133
  return element.getElementsByClassName(names);
6079
6134
  },
6080
6135
 
6136
+ getChildren(element) {
6137
+ return element.children;
6138
+ },
6139
+
6140
+ getChildNodes(element) {
6141
+ return element.childNodes;
6142
+ },
6143
+
6144
+ getFirstChild(element) {
6145
+ return element.firstChild;
6146
+ },
6147
+
6148
+ getFirstElementChild(element) {
6149
+ return element.firstElementChild;
6150
+ },
6151
+
6152
+ getLastChild(element) {
6153
+ return element.lastChild;
6154
+ },
6155
+
6156
+ getLastElementChild(element) {
6157
+ return element.lastElementChild;
6158
+ },
6159
+
6081
6160
  isConnected(node) {
6082
6161
  return node.isConnected;
6083
6162
  },
@@ -6378,7 +6457,7 @@ var LWC = (function (exports) {
6378
6457
  });
6379
6458
  freeze(LightningElement);
6380
6459
  seal(LightningElement.prototype);
6381
- /* version: 2.5.2 */
6460
+ /* version: 2.5.6 */
6382
6461
 
6383
6462
  exports.LightningElement = LightningElement;
6384
6463
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6398,6 +6477,8 @@ var LWC = (function (exports) {
6398
6477
  exports.sanitizeAttribute = sanitizeAttribute;
6399
6478
  exports.setFeatureFlag = setFeatureFlag;
6400
6479
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
6480
+ exports.setHooks = setHooks;
6481
+ exports.setHooksForTest = setHooksForTest;
6401
6482
  exports.swapComponent = swapComponent;
6402
6483
  exports.swapStyle = swapStyle;
6403
6484
  exports.swapTemplate = swapTemplate;
@@ -6409,4 +6490,4 @@ var LWC = (function (exports) {
6409
6490
 
6410
6491
  return exports;
6411
6492
 
6412
- }({}));
6493
+ })({});