lwc 2.5.3 → 2.5.7

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 +151 -101
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +151 -100
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +139 -80
  5. package/dist/engine-dom/iife/es5/engine-dom.js +181 -109
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +167 -87
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +151 -100
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +139 -80
  11. package/dist/engine-dom/umd/es5/engine-dom.js +181 -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 +167 -87
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +151 -107
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +151 -108
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +46 -40
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +46 -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 +45 -39
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +46 -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 +45 -39
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +46 -40
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +45 -39
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +46 -40
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +45 -39
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  41. package/package.json +8 -8
@@ -301,7 +301,7 @@
301
301
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
302
302
  return attributeName;
303
303
  }
304
- /** version: 2.5.3 */
304
+ /** version: 2.5.7 */
305
305
 
306
306
  /*
307
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -473,7 +473,7 @@
473
473
 
474
474
  function setFeatureFlagForTest(name, value) {
475
475
  }
476
- /** version: 2.5.3 */
476
+ /** version: 2.5.7 */
477
477
 
478
478
  /* proxy-compat-disable */
479
479
 
@@ -2376,54 +2376,6 @@
2376
2376
  return getBoundingClientRect(elm);
2377
2377
  },
2378
2378
 
2379
- querySelector(selectors) {
2380
- const vm = getAssociatedVM(this);
2381
- const {
2382
- elm,
2383
- renderer: {
2384
- querySelector
2385
- }
2386
- } = vm;
2387
-
2388
- return querySelector(elm, selectors);
2389
- },
2390
-
2391
- querySelectorAll(selectors) {
2392
- const vm = getAssociatedVM(this);
2393
- const {
2394
- elm,
2395
- renderer: {
2396
- querySelectorAll
2397
- }
2398
- } = vm;
2399
-
2400
- return querySelectorAll(elm, selectors);
2401
- },
2402
-
2403
- getElementsByTagName(tagNameOrWildCard) {
2404
- const vm = getAssociatedVM(this);
2405
- const {
2406
- elm,
2407
- renderer: {
2408
- getElementsByTagName
2409
- }
2410
- } = vm;
2411
-
2412
- return getElementsByTagName(elm, tagNameOrWildCard);
2413
- },
2414
-
2415
- getElementsByClassName(names) {
2416
- const vm = getAssociatedVM(this);
2417
- const {
2418
- elm,
2419
- renderer: {
2420
- getElementsByClassName
2421
- }
2422
- } = vm;
2423
-
2424
- return getElementsByClassName(elm, names);
2425
- },
2426
-
2427
2379
  get isConnected() {
2428
2380
  const {
2429
2381
  elm,
@@ -2469,6 +2421,47 @@
2469
2421
  }
2470
2422
 
2471
2423
  };
2424
+ const queryAndChildGetterDescriptors = create(null);
2425
+ 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
2426
+
2427
+ for (const [elementProp, rendererMethod] of childGetters) {
2428
+ queryAndChildGetterDescriptors[elementProp] = {
2429
+ get() {
2430
+ const vm = getAssociatedVM(this);
2431
+ const {
2432
+ elm,
2433
+ renderer
2434
+ } = vm;
2435
+
2436
+ return renderer[rendererMethod](elm);
2437
+ },
2438
+
2439
+ configurable: true,
2440
+ enumerable: true
2441
+ };
2442
+ }
2443
+
2444
+ const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll']; // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2445
+
2446
+ for (const queryMethod of queryMethods) {
2447
+ queryAndChildGetterDescriptors[queryMethod] = {
2448
+ value(arg) {
2449
+ const vm = getAssociatedVM(this);
2450
+ const {
2451
+ elm,
2452
+ renderer
2453
+ } = vm;
2454
+
2455
+ return renderer[queryMethod](elm, arg);
2456
+ },
2457
+
2458
+ configurable: true,
2459
+ enumerable: true,
2460
+ writable: true
2461
+ };
2462
+ }
2463
+
2464
+ defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
2472
2465
  const lightningBasedDescriptors = create(null);
2473
2466
 
2474
2467
  for (const propName in HTMLElementOriginalDescriptors) {
@@ -2896,15 +2889,14 @@
2896
2889
  return tpl;
2897
2890
  }
2898
2891
  /**
2899
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker
2900
- * Service and other similar libraries to sanitize vulnerable attributes.
2901
- * This API is subject to change or being removed.
2892
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
2893
+ * libraries to sanitize vulnerable attributes.
2902
2894
  */
2903
2895
 
2904
2896
 
2905
2897
  function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
2906
- // locker-service patches this function during runtime to sanitize vulnerable attributes.
2907
- // when ran off-core this function becomes a noop and returns the user authored value.
2898
+ // locker-service patches this function during runtime to sanitize vulnerable attributes. When
2899
+ // ran off-core this function becomes a noop and returns the user authored value.
2908
2900
  return attrValue;
2909
2901
  }
2910
2902
  /*
@@ -3316,7 +3308,7 @@
3316
3308
  renderMode: 1
3317
3309
  /* Shadow */
3318
3310
  ,
3319
- shadowSupportMode: "default"
3311
+ shadowSupportMode: "reset"
3320
3312
  /* Default */
3321
3313
  ,
3322
3314
  wire: EmptyObject,
@@ -3968,7 +3960,7 @@
3968
3960
  next = iterator.next();
3969
3961
  last = next.done; // template factory logic based on the previous collected value
3970
3962
 
3971
- const vnode = factory(value, j, j === 0, last);
3963
+ const vnode = factory(value, j, j === 0, last === true);
3972
3964
 
3973
3965
  if (isArray$1(vnode)) {
3974
3966
  ArrayPush$1.apply(list, vnode);
@@ -4184,24 +4176,48 @@
4184
4176
  markAsDynamicChildren(vnodes);
4185
4177
  return vnodes;
4186
4178
  }
4179
+ /**
4180
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
4181
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
4182
+ * lwc:inner-html directive.
4183
+ * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
4184
+ */
4187
4185
 
4188
- var api = /*#__PURE__*/Object.freeze({
4189
- __proto__: null,
4190
- h: h,
4191
- ti: ti,
4192
- s: s,
4193
- c: c,
4194
- i: i,
4195
- f: f,
4196
- t: t,
4197
- co: co,
4198
- d: d,
4199
- b: b,
4200
- k: k,
4201
- gid: gid,
4202
- fid: fid,
4203
- dc: dc,
4204
- sc: sc
4186
+
4187
+ let sanitizeHtmlContentHook = () => {
4188
+ // locker-service patches this function during runtime to sanitize HTML content.
4189
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
4190
+ };
4191
+ /**
4192
+ * Sets the sanitizeHtmlContentHook.
4193
+ */
4194
+
4195
+
4196
+ function setSanitizeHtmlContentHook(newHookImpl) {
4197
+ sanitizeHtmlContentHook = newHookImpl;
4198
+ } // [s]anitize [h]tml [c]ontent
4199
+
4200
+
4201
+ function shc(content) {
4202
+ return sanitizeHtmlContentHook(content);
4203
+ }
4204
+
4205
+ const api = freeze({
4206
+ s,
4207
+ h,
4208
+ c,
4209
+ i,
4210
+ f,
4211
+ t,
4212
+ d,
4213
+ b,
4214
+ k,
4215
+ co,
4216
+ dc,
4217
+ ti,
4218
+ gid,
4219
+ fid,
4220
+ shc
4205
4221
  });
4206
4222
  /*
4207
4223
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4215,12 +4231,12 @@
4215
4231
  }
4216
4232
 
4217
4233
  function createInlineStyleVNode(content) {
4218
- return h('style', {
4234
+ return api.h('style', {
4219
4235
  key: 'style',
4220
4236
  attrs: {
4221
4237
  type: 'text/css'
4222
4238
  }
4223
- }, [t(content)]);
4239
+ }, [api.t(content)]);
4224
4240
  }
4225
4241
 
4226
4242
  function updateStylesheetToken(vm, template) {
@@ -5846,7 +5862,22 @@
5846
5862
 
5847
5863
  return reactiveMembrane.getReadOnlyProxy(obj);
5848
5864
  }
5849
- /* version: 2.5.3 */
5865
+ /*
5866
+ * Copyright (c) 2018, salesforce.com, inc.
5867
+ * All rights reserved.
5868
+ * SPDX-License-Identifier: MIT
5869
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5870
+ */
5871
+
5872
+
5873
+ let hooksAreSet = false;
5874
+
5875
+ function setHooks(hooks) {
5876
+ assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
5877
+ hooksAreSet = true;
5878
+ setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5879
+ }
5880
+ /* version: 2.5.7 */
5850
5881
 
5851
5882
  /*
5852
5883
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5858,8 +5889,11 @@
5858
5889
 
5859
5890
  const globalStylesheets = create(null);
5860
5891
 
5861
- const globalStylesheetsParentElement = document.head || document.body || document;
5862
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
5892
+ const globalStylesheetsParentElement = document.head || document.body || document; // This check for constructable stylesheets is similar to Fast's:
5893
+ // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
5894
+ // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
5895
+
5896
+ const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
5863
5897
  const styleElements = create(null);
5864
5898
  const styleSheets = create(null);
5865
5899
  const nodesToStyleSheets = new WeakMap();
@@ -6082,6 +6116,30 @@
6082
6116
  return element.getElementsByClassName(names);
6083
6117
  },
6084
6118
 
6119
+ getChildren(element) {
6120
+ return element.children;
6121
+ },
6122
+
6123
+ getChildNodes(element) {
6124
+ return element.childNodes;
6125
+ },
6126
+
6127
+ getFirstChild(element) {
6128
+ return element.firstChild;
6129
+ },
6130
+
6131
+ getFirstElementChild(element) {
6132
+ return element.firstElementChild;
6133
+ },
6134
+
6135
+ getLastChild(element) {
6136
+ return element.lastChild;
6137
+ },
6138
+
6139
+ getLastElementChild(element) {
6140
+ return element.lastElementChild;
6141
+ },
6142
+
6085
6143
  isConnected(node) {
6086
6144
  return node.isConnected;
6087
6145
  },
@@ -6382,7 +6440,7 @@
6382
6440
  });
6383
6441
  freeze(LightningElement);
6384
6442
  seal(LightningElement.prototype);
6385
- /* version: 2.5.3 */
6443
+ /* version: 2.5.7 */
6386
6444
 
6387
6445
  exports.LightningElement = LightningElement;
6388
6446
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6402,6 +6460,7 @@
6402
6460
  exports.sanitizeAttribute = sanitizeAttribute;
6403
6461
  exports.setFeatureFlag = setFeatureFlag;
6404
6462
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
6463
+ exports.setHooks = setHooks;
6405
6464
  exports.swapComponent = swapComponent;
6406
6465
  exports.swapStyle = swapStyle;
6407
6466
  exports.swapTemplate = swapTemplate;