lwc 2.20.3 → 2.20.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 (31) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +5 -5
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +5 -5
  3. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3 -3
  4. package/dist/engine-dom/iife/es5/engine-dom.js +5 -5
  5. package/dist/engine-dom/iife/es5/engine-dom_debug.js +3 -3
  6. package/dist/engine-dom/umd/es2017/engine-dom.js +5 -5
  7. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3 -3
  8. package/dist/engine-dom/umd/es5/engine-dom.js +5 -5
  9. package/dist/engine-dom/umd/es5/engine-dom_debug.js +3 -3
  10. package/dist/engine-server/commonjs/es2017/engine-server.js +108 -94
  11. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  12. package/dist/engine-server/esm/es2017/engine-server.js +108 -94
  13. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  14. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  15. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  16. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  17. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  18. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  23. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  24. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  25. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  26. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  27. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  30. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  31. package/package.json +7 -7
@@ -419,9 +419,9 @@ function htmlEscape(str, attrMode = false) {
419
419
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
420
420
  */
421
421
  // Increment whenever the LWC template compiler changes
422
- const LWC_VERSION = "2.20.3";
422
+ const LWC_VERSION = "2.20.4";
423
423
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
424
- /** version: 2.20.3 */
424
+ /** version: 2.20.4 */
425
425
 
426
426
  /*
427
427
  * Copyright (c) 2020, salesforce.com, inc.
@@ -530,7 +530,7 @@ function setFeatureFlagForTest(name, value) {
530
530
  setFeatureFlag(name, value);
531
531
  }
532
532
  }
533
- /** version: 2.20.3 */
533
+ /** version: 2.20.4 */
534
534
 
535
535
  /* proxy-compat-disable */
536
536
 
@@ -6281,7 +6281,7 @@ function freezeTemplate(tmpl) {
6281
6281
  });
6282
6282
  }
6283
6283
  }
6284
- /* version: 2.20.3 */
6284
+ /* version: 2.20.4 */
6285
6285
 
6286
6286
  /*
6287
6287
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6289,6 +6289,16 @@ function freezeTemplate(tmpl) {
6289
6289
  * SPDX-License-Identifier: MIT
6290
6290
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6291
6291
  */
6292
+ // We use Symbols as the keys for HostElement properties to avoid conflicting
6293
+ // with public component properties defined by a component author.
6294
+ const HostNamespaceKey = Symbol('namespace');
6295
+ const HostTypeKey = Symbol('type');
6296
+ const HostParentKey = Symbol('parent');
6297
+ const HostShadowRootKey = Symbol('shadow-root');
6298
+ const HostChildrenKey = Symbol('children');
6299
+ const HostAttributesKey = Symbol('attributes');
6300
+ const HostEventListenersKey = Symbol('event-listeners');
6301
+ const HostValueKey = Symbol('value');
6292
6302
  var HostNodeType;
6293
6303
  (function (HostNodeType) {
6294
6304
  HostNodeType["Text"] = "text";
@@ -6323,16 +6333,16 @@ function unsupportedMethod(name) {
6323
6333
  throw new TypeError(`"${name}" is not supported in this environment`);
6324
6334
  };
6325
6335
  }
6326
- function createElement(name, namespace) {
6336
+ function createElement(tagName, namespace) {
6327
6337
  return {
6328
- type: HostNodeType.Element,
6329
- name,
6330
- namespace: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
6331
- parent: null,
6332
- shadowRoot: null,
6333
- children: [],
6334
- attributes: [],
6335
- eventListeners: {},
6338
+ [HostTypeKey]: HostNodeType.Element,
6339
+ tagName,
6340
+ [HostNamespaceKey]: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
6341
+ [HostParentKey]: null,
6342
+ [HostShadowRootKey]: null,
6343
+ [HostChildrenKey]: [],
6344
+ [HostAttributesKey]: [],
6345
+ [HostEventListenersKey]: {},
6336
6346
  };
6337
6347
  }
6338
6348
  const registry = create(null);
@@ -6347,11 +6357,11 @@ function registerCustomElement(name, ctor) {
6347
6357
  class HTMLElementImpl {
6348
6358
  constructor() {
6349
6359
  const { constructor } = this;
6350
- const name = reverseRegistry.get(constructor);
6351
- if (!name) {
6360
+ const tagName = reverseRegistry.get(constructor);
6361
+ if (!tagName) {
6352
6362
  throw new TypeError(`Invalid Construction`);
6353
6363
  }
6354
- return createElement(name);
6364
+ return createElement(tagName);
6355
6365
  }
6356
6366
  }
6357
6367
  const ssr = true;
@@ -6361,73 +6371,74 @@ function isHydrating() {
6361
6371
  const isNativeShadowDefined = false;
6362
6372
  const isSyntheticShadowDefined = false;
6363
6373
  function insert(node, parent, anchor) {
6364
- if (node.parent !== null && node.parent !== parent) {
6365
- const nodeIndex = node.parent.children.indexOf(node);
6366
- node.parent.children.splice(nodeIndex, 1);
6374
+ const nodeParent = node[HostParentKey];
6375
+ if (nodeParent !== null && nodeParent !== parent) {
6376
+ const nodeIndex = nodeParent[HostChildrenKey].indexOf(node);
6377
+ nodeParent[HostChildrenKey].splice(nodeIndex, 1);
6367
6378
  }
6368
- node.parent = parent;
6369
- const anchorIndex = isNull(anchor) ? -1 : parent.children.indexOf(anchor);
6379
+ node[HostParentKey] = parent;
6380
+ const anchorIndex = isNull(anchor) ? -1 : parent[HostChildrenKey].indexOf(anchor);
6370
6381
  if (anchorIndex === -1) {
6371
- parent.children.push(node);
6382
+ parent[HostChildrenKey].push(node);
6372
6383
  }
6373
6384
  else {
6374
- parent.children.splice(anchorIndex, 0, node);
6385
+ parent[HostChildrenKey].splice(anchorIndex, 0, node);
6375
6386
  }
6376
6387
  }
6377
6388
  function remove(node, parent) {
6378
- const nodeIndex = parent.children.indexOf(node);
6379
- parent.children.splice(nodeIndex, 1);
6389
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6390
+ parent[HostChildrenKey].splice(nodeIndex, 1);
6380
6391
  }
6381
6392
  function cloneNode(node) {
6382
6393
  return node;
6383
6394
  }
6384
6395
  function createFragment(html) {
6385
6396
  return {
6386
- type: HostNodeType.Raw,
6387
- parent: null,
6388
- value: html,
6397
+ [HostTypeKey]: HostNodeType.Raw,
6398
+ [HostParentKey]: null,
6399
+ [HostValueKey]: html,
6389
6400
  };
6390
6401
  }
6391
6402
  function createText(content) {
6392
6403
  return {
6393
- type: HostNodeType.Text,
6394
- value: String(content),
6395
- parent: null,
6404
+ [HostTypeKey]: HostNodeType.Text,
6405
+ [HostValueKey]: String(content),
6406
+ [HostParentKey]: null,
6396
6407
  };
6397
6408
  }
6398
6409
  function createComment(content) {
6399
6410
  return {
6400
- type: HostNodeType.Comment,
6401
- value: content,
6402
- parent: null,
6411
+ [HostTypeKey]: HostNodeType.Comment,
6412
+ [HostValueKey]: content,
6413
+ [HostParentKey]: null,
6403
6414
  };
6404
6415
  }
6405
6416
  function nextSibling(node) {
6406
- const { parent } = node;
6417
+ const parent = node[HostParentKey];
6407
6418
  if (isNull(parent)) {
6408
6419
  return null;
6409
6420
  }
6410
- const nodeIndex = parent.children.indexOf(node);
6411
- return parent.children[nodeIndex + 1] || null;
6421
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6422
+ return parent[HostChildrenKey][nodeIndex + 1] || null;
6412
6423
  }
6413
6424
  function attachShadow(element, config) {
6414
- element.shadowRoot = {
6415
- type: HostNodeType.ShadowRoot,
6416
- children: [],
6425
+ element[HostShadowRootKey] = {
6426
+ [HostTypeKey]: HostNodeType.ShadowRoot,
6427
+ [HostChildrenKey]: [],
6417
6428
  mode: config.mode,
6418
6429
  delegatesFocus: !!config.delegatesFocus,
6419
6430
  };
6420
- return element.shadowRoot;
6431
+ return element[HostShadowRootKey];
6421
6432
  }
6422
6433
  function getProperty(node, key) {
6423
6434
  var _a, _b;
6424
6435
  if (key in node) {
6425
6436
  return node[key];
6426
6437
  }
6427
- if (node.type === HostNodeType.Element) {
6438
+ if (node[HostTypeKey] === HostNodeType.Element) {
6428
6439
  const attrName = htmlPropertyToAttribute(key);
6429
6440
  // Handle all the boolean properties.
6430
- if (isBooleanAttribute(attrName, node.name)) {
6441
+ if (isBooleanAttribute(attrName, node.tagName)) {
6431
6442
  return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
6432
6443
  }
6433
6444
  // Handle global html attributes and AOM.
@@ -6436,7 +6447,7 @@ function getProperty(node, key) {
6436
6447
  }
6437
6448
  // Handle special elements live bindings. The checked property is already handled above
6438
6449
  // in the boolean case.
6439
- if (node.name === 'input' && key === 'value') {
6450
+ if (node.tagName === 'input' && key === 'value') {
6440
6451
  return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
6441
6452
  }
6442
6453
  }
@@ -6449,20 +6460,20 @@ function setProperty(node, key, value) {
6449
6460
  if (key in node) {
6450
6461
  return (node[key] = value);
6451
6462
  }
6452
- if (node.type === HostNodeType.Element) {
6463
+ if (node[HostTypeKey] === HostNodeType.Element) {
6453
6464
  const attrName = htmlPropertyToAttribute(key);
6454
6465
  if (key === 'innerHTML') {
6455
- node.children = [
6466
+ node[HostChildrenKey] = [
6456
6467
  {
6457
- type: HostNodeType.Raw,
6458
- parent: node,
6459
- value,
6468
+ [HostTypeKey]: HostNodeType.Raw,
6469
+ [HostParentKey]: node,
6470
+ [HostValueKey]: value,
6460
6471
  },
6461
6472
  ];
6462
6473
  return;
6463
6474
  }
6464
6475
  // Handle all the boolean properties.
6465
- if (isBooleanAttribute(attrName, node.name)) {
6476
+ if (isBooleanAttribute(attrName, node.tagName)) {
6466
6477
  return value === true
6467
6478
  ? setAttribute(node, attrName, '')
6468
6479
  : removeAttribute(node, attrName);
@@ -6473,7 +6484,7 @@ function setProperty(node, key, value) {
6473
6484
  }
6474
6485
  // Handle special elements live bindings. The checked property is already handled above
6475
6486
  // in the boolean case.
6476
- if (node.name === 'input' && attrName === 'value') {
6487
+ if (node.tagName === 'input' && attrName === 'value') {
6477
6488
  return isNull(value) || isUndefined$1(value)
6478
6489
  ? removeAttribute(node, 'value')
6479
6490
  : setAttribute(node, 'value', value);
@@ -6485,32 +6496,32 @@ function setProperty(node, key, value) {
6485
6496
  }
6486
6497
  }
6487
6498
  function setText(node, content) {
6488
- if (node.type === HostNodeType.Text) {
6489
- node.value = content;
6499
+ if (node[HostTypeKey] === HostNodeType.Text) {
6500
+ node[HostValueKey] = content;
6490
6501
  }
6491
- else if (node.type === HostNodeType.Element) {
6492
- node.children = [
6502
+ else if (node[HostTypeKey] === HostNodeType.Element) {
6503
+ node[HostChildrenKey] = [
6493
6504
  {
6494
- type: HostNodeType.Text,
6495
- parent: node,
6496
- value: content,
6505
+ [HostTypeKey]: HostNodeType.Text,
6506
+ [HostParentKey]: node,
6507
+ [HostValueKey]: content,
6497
6508
  },
6498
6509
  ];
6499
6510
  }
6500
6511
  }
6501
6512
  function getAttribute(element, name, namespace = null) {
6502
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6513
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6503
6514
  return attribute ? attribute.value : null;
6504
6515
  }
6505
6516
  function setAttribute(element, name, value, namespace = null) {
6506
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6517
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6507
6518
  if (isUndefined$1(namespace)) {
6508
6519
  namespace = null;
6509
6520
  }
6510
6521
  if (isUndefined$1(attribute)) {
6511
- element.attributes.push({
6522
+ element[HostAttributesKey].push({
6512
6523
  name,
6513
- namespace,
6524
+ [HostNamespaceKey]: namespace,
6514
6525
  value: String(value),
6515
6526
  });
6516
6527
  }
@@ -6519,18 +6530,18 @@ function setAttribute(element, name, value, namespace = null) {
6519
6530
  }
6520
6531
  }
6521
6532
  function removeAttribute(element, name, namespace) {
6522
- element.attributes = element.attributes.filter((attr) => attr.name !== name && attr.namespace !== namespace);
6533
+ element[HostAttributesKey] = element[HostAttributesKey].filter((attr) => attr.name !== name && attr[HostNamespaceKey] !== namespace);
6523
6534
  }
6524
6535
  function getClassList(element) {
6525
6536
  function getClassAttribute() {
6526
- let classAttribute = element.attributes.find((attr) => attr.name === 'class' && isNull(attr.namespace));
6537
+ let classAttribute = element[HostAttributesKey].find((attr) => attr.name === 'class' && isNull(attr[HostNamespaceKey]));
6527
6538
  if (isUndefined$1(classAttribute)) {
6528
6539
  classAttribute = {
6529
6540
  name: 'class',
6530
- namespace: null,
6541
+ [HostNamespaceKey]: null,
6531
6542
  value: '',
6532
6543
  };
6533
- element.attributes.push(classAttribute);
6544
+ element[HostAttributesKey].push(classAttribute);
6534
6545
  }
6535
6546
  return classAttribute;
6536
6547
  }
@@ -6550,12 +6561,12 @@ function getClassList(element) {
6550
6561
  };
6551
6562
  }
6552
6563
  function setCSSStyleProperty(element, name, value, important) {
6553
- const styleAttribute = element.attributes.find((attr) => attr.name === 'style' && isNull(attr.namespace));
6564
+ const styleAttribute = element[HostAttributesKey].find((attr) => attr.name === 'style' && isNull(attr[HostNamespaceKey]));
6554
6565
  const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
6555
6566
  if (isUndefined$1(styleAttribute)) {
6556
- element.attributes.push({
6567
+ element[HostAttributesKey].push({
6557
6568
  name: 'style',
6558
- namespace: null,
6569
+ [HostNamespaceKey]: null,
6559
6570
  value: serializedProperty,
6560
6571
  });
6561
6572
  }
@@ -6564,7 +6575,7 @@ function setCSSStyleProperty(element, name, value, important) {
6564
6575
  }
6565
6576
  }
6566
6577
  function isConnected(node) {
6567
- return !isNull(node.parent);
6578
+ return !isNull(node[HostParentKey]);
6568
6579
  }
6569
6580
  // Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
6570
6581
  // synthetic shadow.
@@ -6652,13 +6663,13 @@ function serializeAttributes(attributes) {
6652
6663
  function serializeChildNodes(children) {
6653
6664
  return children
6654
6665
  .map((child) => {
6655
- switch (child.type) {
6666
+ switch (child[HostTypeKey]) {
6656
6667
  case HostNodeType.Text:
6657
- return child.value === '' ? '\u200D' : htmlEscape(child.value);
6668
+ return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6658
6669
  case HostNodeType.Comment:
6659
- return `<!--${htmlEscape(child.value)}-->`;
6670
+ return `<!--${htmlEscape(child[HostValueKey])}-->`;
6660
6671
  case HostNodeType.Raw:
6661
- return child.value;
6672
+ return child[HostValueKey];
6662
6673
  case HostNodeType.Element:
6663
6674
  return serializeElement(child);
6664
6675
  }
@@ -6670,27 +6681,30 @@ function serializeShadowRoot(shadowRoot) {
6670
6681
  if (shadowRoot.delegatesFocus) {
6671
6682
  attrs.push('shadowrootdelegatesfocus');
6672
6683
  }
6673
- return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot.children)}</template>`;
6684
+ return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot[HostChildrenKey])}</template>`;
6674
6685
  }
6675
6686
  function serializeElement(element) {
6676
6687
  let output = '';
6677
- const { name, namespace } = element;
6688
+ const tagName = element.tagName;
6689
+ const namespace = element[HostNamespaceKey];
6678
6690
  const isForeignElement = namespace !== HTML_NAMESPACE;
6679
- const hasChildren = element.children.length > 0;
6680
- const attrs = element.attributes.length ? ` ${serializeAttributes(element.attributes)}` : '';
6681
- output += `<${name}${attrs}`;
6691
+ const hasChildren = element[HostChildrenKey].length > 0;
6692
+ const attrs = element[HostAttributesKey].length
6693
+ ? ` ${serializeAttributes(element[HostAttributesKey])}`
6694
+ : '';
6695
+ output += `<${tagName}${attrs}`;
6682
6696
  // Note that foreign elements can have children but not shadow roots
6683
6697
  if (isForeignElement && !hasChildren) {
6684
6698
  output += '/>';
6685
6699
  return output;
6686
6700
  }
6687
6701
  output += '>';
6688
- if (element.shadowRoot) {
6689
- output += serializeShadowRoot(element.shadowRoot);
6702
+ if (element[HostShadowRootKey]) {
6703
+ output += serializeShadowRoot(element[HostShadowRootKey]);
6690
6704
  }
6691
- output += serializeChildNodes(element.children);
6692
- if (!isVoidElement(name, namespace) || hasChildren) {
6693
- output += `</${name}>`;
6705
+ output += serializeChildNodes(element[HostChildrenKey]);
6706
+ if (!isVoidElement(tagName, namespace) || hasChildren) {
6707
+ output += `</${tagName}>`;
6694
6708
  }
6695
6709
  return output;
6696
6710
  }
@@ -6702,14 +6716,14 @@ function serializeElement(element) {
6702
6716
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6703
6717
  */
6704
6718
  const FakeRootElement = {
6705
- type: HostNodeType.Element,
6706
- name: 'fake-root-element',
6707
- namespace: HTML_NAMESPACE,
6708
- parent: null,
6709
- shadowRoot: null,
6710
- children: [],
6711
- attributes: [],
6712
- eventListeners: {},
6719
+ [HostTypeKey]: HostNodeType.Element,
6720
+ tagName: 'fake-root-element',
6721
+ [HostNamespaceKey]: HTML_NAMESPACE,
6722
+ [HostParentKey]: null,
6723
+ [HostShadowRootKey]: null,
6724
+ [HostChildrenKey]: [],
6725
+ [HostAttributesKey]: [],
6726
+ [HostEventListenersKey]: {},
6713
6727
  };
6714
6728
  function renderComponent(tagName, Ctor, props = {}) {
6715
6729
  if (!isString(tagName)) {
@@ -6730,7 +6744,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6730
6744
  for (const [key, value] of Object.entries(props)) {
6731
6745
  element[key] = value;
6732
6746
  }
6733
- element.parent = FakeRootElement;
6747
+ element[HostParentKey] = FakeRootElement;
6734
6748
  connectRootElement(element);
6735
6749
  return serializeElement(element);
6736
6750
  }
@@ -6743,7 +6757,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6743
6757
  */
6744
6758
  freeze(LightningElement);
6745
6759
  seal(LightningElement.prototype);
6746
- /* version: 2.20.3 */
6760
+ /* version: 2.20.4 */
6747
6761
 
6748
6762
  exports.LightningElement = LightningElement;
6749
6763
  exports.api = api$1;