lwc 2.23.1 → 2.23.2

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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +1182 -856
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +1182 -855
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1101 -803
  5. package/dist/engine-dom/iife/es5/engine-dom.js +449 -368
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +409 -335
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +1182 -855
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1101 -803
  11. package/dist/engine-dom/umd/es5/engine-dom.js +449 -368
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +409 -335
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +782 -521
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +782 -521
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -349,7 +349,7 @@
349
349
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
350
350
  return attributeName;
351
351
  }
352
- /** version: 2.23.1 */
352
+ /** version: 2.23.2 */
353
353
 
354
354
  /**
355
355
  * Copyright (C) 2018 salesforce.com, inc.
@@ -443,7 +443,7 @@
443
443
  patch$1(propName);
444
444
  }
445
445
  }
446
- /** version: 2.23.1 */
446
+ /** version: 2.23.2 */
447
447
 
448
448
  /**
449
449
  * Copyright (C) 2018 salesforce.com, inc.
@@ -465,6 +465,7 @@
465
465
  ENABLE_HTML_COLLECTIONS_PATCH: null,
466
466
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
467
467
  ENABLE_MIXED_SHADOW_MODE: null,
468
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
468
469
  ENABLE_NODE_LIST_PATCH: null,
469
470
  ENABLE_NODE_PATCH: null,
470
471
  ENABLE_REACTIVE_SETTER: null,
@@ -869,8 +870,8 @@
869
870
  // to inject at runtime.
870
871
 
871
872
 
872
- var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
873
- var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
873
+ var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
874
+ var HTMLElementPrototype = HTMLElementConstructor.prototype;
874
875
  /*
875
876
  * Copyright (c) 2018, salesforce.com, inc.
876
877
  * All rights reserved.
@@ -2672,7 +2673,7 @@
2672
2673
  return HTMLBridgeElement;
2673
2674
  }
2674
2675
 
2675
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2676
+ var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2676
2677
  freeze(BaseBridgeElement);
2677
2678
  seal(BaseBridgeElement.prototype);
2678
2679
 
@@ -3174,6 +3175,12 @@
3174
3175
  */
3175
3176
 
3176
3177
 
3178
+ function checkHasVM(elm) {
3179
+ var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
3180
+
3181
+ return hasVM;
3182
+ }
3183
+
3177
3184
  function getUpgradableConstructor(tagName, renderer) {
3178
3185
  var getCustomElement = renderer.getCustomElement,
3179
3186
  RendererHTMLElement = renderer.HTMLElementExported,
@@ -3215,6 +3222,20 @@
3215
3222
  return _createClass(LWCUpgradableElement);
3216
3223
  }(RendererHTMLElement);
3217
3224
 
3225
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3226
+ CE.prototype.connectedCallback = function () {
3227
+ if (checkHasVM(this)) {
3228
+ connectRootElement(this);
3229
+ }
3230
+ };
3231
+
3232
+ CE.prototype.disconnectedCallback = function () {
3233
+ if (checkHasVM(this)) {
3234
+ disconnectRootElement(this);
3235
+ }
3236
+ };
3237
+ }
3238
+
3218
3239
  defineCustomElement(tagName, CE);
3219
3240
  return CE;
3220
3241
  }
@@ -3326,6 +3347,7 @@
3326
3347
  // different than the one previously set.
3327
3348
 
3328
3349
  if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
3350
+
3329
3351
  setProperty(elm, key, cur);
3330
3352
  }
3331
3353
  }
@@ -3719,8 +3741,12 @@
3719
3741
  insertNode(elm, parent, anchor, renderer);
3720
3742
 
3721
3743
  if (vm) {
3744
+ {
3745
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3722
3746
 
3723
- runConnectedCallback(vm);
3747
+ runConnectedCallback(vm);
3748
+ }
3749
+ }
3724
3750
  }
3725
3751
 
3726
3752
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3888,10 +3914,10 @@
3888
3914
  var scopeToken = getScopeTokenClass(owner);
3889
3915
 
3890
3916
  if (!isNull(scopeToken)) {
3891
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
3917
+ var getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
3892
3918
  // probably we should have a renderer api for just the add operation
3893
3919
 
3894
- _getClassList(elm).add(scopeToken);
3920
+ getClassList(elm).add(scopeToken);
3895
3921
  } // Set property element for synthetic shadow DOM style scoping.
3896
3922
 
3897
3923
 
@@ -6056,6 +6082,8 @@
6056
6082
  return renderer.nextSibling(hydratedNode);
6057
6083
  }
6058
6084
 
6085
+ var NODE_VALUE_PROP = 'nodeValue';
6086
+
6059
6087
  function hydrateText(node, vnode, renderer) {
6060
6088
  var _a;
6061
6089
 
@@ -6081,7 +6109,7 @@
6081
6109
  }
6082
6110
 
6083
6111
  var setProperty = renderer.setProperty;
6084
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6112
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6085
6113
  vnode.elm = node;
6086
6114
  return node;
6087
6115
  }
@@ -6113,10 +6141,10 @@
6113
6141
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
6114
6142
  // remove the innerHTML from props so it reuses the existing dom elements.
6115
6143
  var props = vnode.data.props;
6116
- var _getProperty3 = renderer.getProperty;
6144
+ var getProperty = renderer.getProperty;
6117
6145
 
6118
6146
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6119
- if (_getProperty3(elm, 'innerHTML') === props.innerHTML) {
6147
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
6120
6148
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6121
6149
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
6122
6150
  props: cloneAndOmitKey(props, 'innerHTML')
@@ -6128,8 +6156,8 @@
6128
6156
  patchElementPropsAndAttrs(vnode, renderer);
6129
6157
 
6130
6158
  if (!isDomManual) {
6131
- var _getFirstChild = renderer.getFirstChild;
6132
- hydrateChildren(_getFirstChild(elm), vnode.children, elm, owner);
6159
+ var getFirstChild = renderer.getFirstChild;
6160
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
6133
6161
  }
6134
6162
 
6135
6163
  return elm;
@@ -6162,10 +6190,10 @@
6162
6190
  if (vm.renderMode !== 0
6163
6191
  /* RenderMode.Light */
6164
6192
  ) {
6165
- var _getFirstChild2 = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6193
+ var getFirstChild = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6166
6194
  // Note: for Light DOM, this is handled while hydrating the VM
6167
6195
 
6168
- hydrateChildren(_getFirstChild2(elm), vnode.children, elm, vm);
6196
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
6169
6197
  }
6170
6198
 
6171
6199
  hydrateVM(vm);
@@ -6200,11 +6228,11 @@
6200
6228
  // next node in the list to be hydrated.
6201
6229
 
6202
6230
 
6203
- var _nextSibling = renderer.nextSibling;
6231
+ var nextSibling = renderer.nextSibling;
6204
6232
 
6205
6233
  do {
6206
6234
  var current = nextNode;
6207
- nextNode = _nextSibling(nextNode);
6235
+ nextNode = nextSibling(nextNode);
6208
6236
  removeNode(current, parentNode, renderer);
6209
6237
  } while (nextNode);
6210
6238
  }
@@ -6261,9 +6289,8 @@
6261
6289
  attrValue = _Object$entries$_i[1];
6262
6290
 
6263
6291
  vnode.owner;
6264
- var _getAttribute = renderer.getAttribute;
6265
-
6266
- var elmAttrValue = _getAttribute(elm, attrName);
6292
+ var getAttribute = renderer.getAttribute;
6293
+ var elmAttrValue = getAttribute(elm, attrName);
6267
6294
 
6268
6295
  if (String(attrValue) !== elmAttrValue) {
6269
6296
 
@@ -6379,7 +6406,7 @@
6379
6406
  return false;
6380
6407
  }
6381
6408
 
6382
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6409
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6383
6410
  }
6384
6411
 
6385
6412
  if (getProperty(client, 'nodeType') === 8
@@ -6391,7 +6418,7 @@
6391
6418
  return false;
6392
6419
  }
6393
6420
 
6394
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6421
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6395
6422
  }
6396
6423
 
6397
6424
  if (!hasCorrectNodeType(vnode, ssr, 1
@@ -6463,7 +6490,7 @@
6463
6490
 
6464
6491
  return ctor;
6465
6492
  }
6466
- /* version: 2.23.1 */
6493
+ /* version: 2.23.2 */
6467
6494
 
6468
6495
  /*
6469
6496
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6621,355 +6648,395 @@
6621
6648
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6622
6649
  */
6623
6650
 
6651
+ /**
6652
+ * A factory function that produces a renderer.
6653
+ * Renderer encapsulates operations that are required to render an LWC component into the underlying
6654
+ * runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
6655
+ * Example usage:
6656
+ * import { renderer, rendererFactory } from 'lwc';
6657
+ * const customRenderer = rendererFactory(renderer);
6658
+ *
6659
+ * @param baseRenderer Either null or the base renderer imported from 'lwc'.
6660
+ */
6624
6661
 
6625
- var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6626
- var createFragment;
6627
6662
 
6628
- if (SUPPORTS_TEMPLATE) {
6629
- // Parse the fragment HTML string into DOM
6630
- createFragment = function createFragment(html) {
6631
- var template = document.createElement('template');
6632
- template.innerHTML = html;
6633
- return template.content.firstChild;
6634
- };
6635
- } else {
6636
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6637
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6638
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6639
- // With other elements added from:
6640
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6641
- // Using the test:
6642
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6643
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6644
- var topLevelWrappingMap = {
6645
- caption: ['table'],
6646
- col: ['colgroup', 'table'],
6647
- colgroup: ['table'],
6648
- option: ['select'],
6649
- tbody: ['table'],
6650
- td: ['tr', 'tbody', 'table'],
6651
- th: ['tr', 'tbody', 'table'],
6652
- thead: ['table'],
6653
- tfoot: ['table'],
6654
- tr: ['tbody', 'table']
6655
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6656
-
6657
- var getTagName = function getTagName(text) {
6658
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6659
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6660
-
6661
-
6662
- createFragment = function createFragment(html) {
6663
- var wrapperTags = topLevelWrappingMap[getTagName(html)];
6664
-
6665
- if (!isUndefined$1(wrapperTags)) {
6666
- var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6667
- _step5;
6663
+ function rendererFactory(baseRenderer) {
6664
+ // Util functions
6665
+ function assertInvariant(value, msg) {
6666
+ if (!value) {
6667
+ throw new Error("Invariant Violation: ".concat(msg));
6668
+ }
6669
+ }
6668
6670
 
6669
- try {
6670
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6671
- var wrapperTag = _step5.value;
6672
- html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6673
- }
6674
- } catch (err) {
6675
- _iterator5.e(err);
6676
- } finally {
6677
- _iterator5.f();
6678
- }
6679
- } // For IE11, the document title must not be undefined, but it can be an empty string
6680
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6671
+ function isNull(obj) {
6672
+ return obj === null;
6673
+ }
6681
6674
 
6675
+ function isUndefined(obj) {
6676
+ return obj === undefined;
6677
+ }
6682
6678
 
6683
- var doc = document.implementation.createHTMLDocument('');
6684
- doc.body.innerHTML = html;
6685
- var content = doc.body;
6679
+ var getCustomElement;
6680
+ var defineCustomElement;
6681
+ var HTMLElementConstructor;
6686
6682
 
6687
- if (!isUndefined$1(wrapperTags)) {
6688
- for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6689
- content = content.firstChild;
6690
- }
6683
+ function isCustomElementRegistryAvailable() {
6684
+ if (typeof customElements === 'undefined') {
6685
+ return false;
6691
6686
  }
6692
6687
 
6693
- return content.firstChild;
6694
- };
6695
- }
6696
- /*
6697
- * Copyright (c) 2018, salesforce.com, inc.
6698
- * All rights reserved.
6699
- * SPDX-License-Identifier: MIT
6700
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6701
- */
6688
+ try {
6689
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
6690
+ // _wrapNativeSuper()
6691
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
6692
+ // get wrapped by babel.
6693
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
6694
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
6695
+ // which are not equipped to be initialized that way.
6702
6696
 
6697
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
6698
+ _inherits(clazz, _HTMLElementAlias);
6703
6699
 
6704
- var getCustomElement;
6705
- var defineCustomElement;
6706
- var HTMLElementConstructor;
6700
+ var _super7 = _createSuper(clazz);
6707
6701
 
6708
- function isCustomElementRegistryAvailable() {
6709
- if (typeof customElements === 'undefined') {
6710
- return false;
6702
+ function clazz() {
6703
+ _classCallCheck(this, clazz);
6704
+
6705
+ return _super7.apply(this, arguments);
6706
+ }
6707
+
6708
+ return _createClass(clazz);
6709
+ }(HTMLElementAlias);
6710
+
6711
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
6712
+ new clazz();
6713
+ return true;
6714
+ } catch (_a) {
6715
+ return false;
6716
+ }
6711
6717
  }
6712
6718
 
6713
- try {
6714
- // dereference HTMLElement global because babel wraps globals in compat mode with a
6715
- // _wrapNativeSuper()
6716
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
6717
- // get wrapped by babel.
6718
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
6719
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
6720
- // which are not equipped to be initialized that way.
6719
+ if (isCustomElementRegistryAvailable()) {
6720
+ getCustomElement = customElements.get.bind(customElements);
6721
+ defineCustomElement = customElements.define.bind(customElements);
6722
+ HTMLElementConstructor = HTMLElement;
6723
+ } else {
6724
+ var registry = Object.create(null);
6725
+ var reverseRegistry = new WeakMap();
6721
6726
 
6722
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
6723
- _inherits(clazz, _HTMLElementAlias);
6727
+ defineCustomElement = function define(name, ctor) {
6728
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
6729
+ throw new TypeError("Invalid Registration");
6730
+ }
6724
6731
 
6725
- var _super7 = _createSuper(clazz);
6732
+ registry[name] = ctor;
6733
+ reverseRegistry.set(ctor, name);
6734
+ };
6726
6735
 
6727
- function clazz() {
6728
- _classCallCheck(this, clazz);
6736
+ getCustomElement = function get(name) {
6737
+ return registry[name];
6738
+ };
6729
6739
 
6730
- return _super7.apply(this, arguments);
6740
+ HTMLElementConstructor = function HTMLElement() {
6741
+ if (!(this instanceof HTMLElement)) {
6742
+ throw new TypeError("Invalid Invocation");
6731
6743
  }
6732
6744
 
6733
- return _createClass(clazz);
6734
- }(HTMLElementAlias);
6745
+ var constructor = this.constructor;
6746
+ var name = reverseRegistry.get(constructor);
6735
6747
 
6736
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
6737
- new clazz();
6738
- return true;
6739
- } catch (_a) {
6740
- return false;
6748
+ if (!name) {
6749
+ throw new TypeError("Invalid Construction");
6750
+ }
6751
+
6752
+ var elm = document.createElement(name);
6753
+ Object.setPrototypeOf(elm, constructor.prototype);
6754
+ return elm;
6755
+ };
6756
+
6757
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
6741
6758
  }
6742
- }
6743
6759
 
6744
- if (isCustomElementRegistryAvailable()) {
6745
- getCustomElement = customElements.get.bind(customElements);
6746
- defineCustomElement = customElements.define.bind(customElements);
6747
- HTMLElementConstructor = HTMLElement;
6748
- } else {
6749
- var registry = create(null);
6750
- var reverseRegistry = new WeakMap();
6760
+ function cloneNode(node, deep) {
6761
+ return node.cloneNode(deep);
6762
+ }
6751
6763
 
6752
- defineCustomElement = function define(name, ctor) {
6753
- if (name !== StringToLowerCase.call(name) || registry[name]) {
6754
- throw new TypeError("Invalid Registration");
6755
- }
6764
+ function createElement(tagName, namespace) {
6765
+ return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6766
+ }
6756
6767
 
6757
- registry[name] = ctor;
6758
- reverseRegistry.set(ctor, name);
6759
- };
6768
+ function createText(content) {
6769
+ return document.createTextNode(content);
6770
+ }
6760
6771
 
6761
- getCustomElement = function get(name) {
6762
- return registry[name];
6763
- };
6772
+ function createComment(content) {
6773
+ return document.createComment(content);
6774
+ }
6764
6775
 
6765
- HTMLElementConstructor = function HTMLElement() {
6766
- if (!(this instanceof HTMLElement)) {
6767
- throw new TypeError("Invalid Invocation");
6768
- }
6776
+ var createFragment; // IE11 lacks support for this feature
6769
6777
 
6770
- var constructor = this.constructor;
6771
- var name = reverseRegistry.get(constructor);
6778
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6772
6779
 
6773
- if (!name) {
6774
- throw new TypeError("Invalid Construction");
6775
- }
6780
+ if (SUPPORTS_TEMPLATE) {
6781
+ // Parse the fragment HTML string into DOM
6782
+ createFragment = function createFragment(html) {
6783
+ var template = document.createElement('template');
6784
+ template.innerHTML = html;
6785
+ return template.content.firstChild;
6786
+ };
6787
+ } else {
6788
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6789
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6790
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6791
+ // With other elements added from:
6792
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6793
+ // Using the test:
6794
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6795
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6796
+ var topLevelWrappingMap = {
6797
+ caption: ['table'],
6798
+ col: ['colgroup', 'table'],
6799
+ colgroup: ['table'],
6800
+ option: ['select'],
6801
+ tbody: ['table'],
6802
+ td: ['tr', 'tbody', 'table'],
6803
+ th: ['tr', 'tbody', 'table'],
6804
+ thead: ['table'],
6805
+ tfoot: ['table'],
6806
+ tr: ['tbody', 'table']
6807
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6808
+
6809
+ var getTagName = function getTagName(text) {
6810
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6811
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6812
+
6813
+
6814
+ createFragment = function createFragment(html) {
6815
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
6816
+
6817
+ if (!isUndefined(wrapperTags)) {
6818
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6819
+ _step5;
6820
+
6821
+ try {
6822
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6823
+ var wrapperTag = _step5.value;
6824
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6825
+ }
6826
+ } catch (err) {
6827
+ _iterator5.e(err);
6828
+ } finally {
6829
+ _iterator5.f();
6830
+ }
6831
+ } // For IE11, the document title must not be undefined, but it can be an empty string
6832
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6776
6833
 
6777
- var elm = document.createElement(name);
6778
- setPrototypeOf(elm, constructor.prototype);
6779
- return elm;
6780
- };
6781
6834
 
6782
- HTMLElementConstructor.prototype = HTMLElement.prototype;
6783
- }
6835
+ var doc = document.implementation.createHTMLDocument('');
6836
+ doc.body.innerHTML = html;
6837
+ var content = doc.body;
6784
6838
 
6785
- var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6786
- var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6839
+ if (!isUndefined(wrapperTags)) {
6840
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6841
+ content = content.firstChild;
6842
+ }
6843
+ }
6787
6844
 
6788
- function cloneNode(node, deep) {
6789
- return node.cloneNode(deep);
6790
- }
6845
+ return content.firstChild;
6846
+ };
6847
+ }
6791
6848
 
6792
- function createElement$1(tagName, namespace) {
6793
- return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6794
- }
6849
+ function insert(node, parent, anchor) {
6850
+ parent.insertBefore(node, anchor);
6851
+ }
6795
6852
 
6796
- function createText(content) {
6797
- return document.createTextNode(content);
6798
- }
6853
+ function remove(node, parent) {
6854
+ parent.removeChild(node);
6855
+ }
6799
6856
 
6800
- function createComment(content) {
6801
- return document.createComment(content);
6802
- }
6857
+ function nextSibling(node) {
6858
+ return node.nextSibling;
6859
+ }
6803
6860
 
6804
- function insert(node, parent, anchor) {
6805
- parent.insertBefore(node, anchor);
6806
- }
6861
+ function attachShadow(element, options) {
6862
+ // `shadowRoot` will be non-null in two cases:
6863
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
6864
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
6865
+ // root component with customElement.define('c-app', Ctor)
6866
+ if (!isNull(element.shadowRoot)) {
6867
+ return element.shadowRoot;
6868
+ }
6807
6869
 
6808
- function remove(node, parent) {
6809
- parent.removeChild(node);
6810
- }
6870
+ return element.attachShadow(options);
6871
+ }
6811
6872
 
6812
- function nextSibling(node) {
6813
- return node.nextSibling;
6814
- }
6873
+ function setText(node, content) {
6874
+ node.nodeValue = content;
6875
+ }
6815
6876
 
6816
- function attachShadow(element, options) {
6817
- // `shadowRoot` will be non-null in two cases:
6818
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
6819
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
6820
- // root component with customElement.define('c-app', Ctor)
6821
- if (!isNull(element.shadowRoot)) {
6822
- return element.shadowRoot;
6877
+ function getProperty(node, key) {
6878
+ return node[key];
6823
6879
  }
6824
6880
 
6825
- return element.attachShadow(options);
6826
- }
6881
+ function setProperty(node, key, value) {
6882
+ node[key] = value;
6883
+ }
6827
6884
 
6828
- function setText(node, content) {
6829
- node.nodeValue = content;
6830
- }
6885
+ function getAttribute(element, name, namespace) {
6886
+ return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
6887
+ }
6831
6888
 
6832
- function getProperty(node, key) {
6833
- return node[key];
6834
- }
6889
+ function setAttribute(element, name, value, namespace) {
6890
+ return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6891
+ }
6835
6892
 
6836
- function setProperty(node, key, value) {
6893
+ function removeAttribute(element, name, namespace) {
6894
+ if (isUndefined(namespace)) {
6895
+ element.removeAttribute(name);
6896
+ } else {
6897
+ element.removeAttributeNS(namespace, name);
6898
+ }
6899
+ }
6837
6900
 
6838
- node[key] = value;
6839
- }
6901
+ function addEventListener(target, type, callback, options) {
6902
+ target.addEventListener(type, callback, options);
6903
+ }
6840
6904
 
6841
- function getAttribute(element, name, namespace) {
6842
- return isUndefined$1(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
6843
- }
6905
+ function removeEventListener(target, type, callback, options) {
6906
+ target.removeEventListener(type, callback, options);
6907
+ }
6844
6908
 
6845
- function setAttribute(element, name, value, namespace) {
6846
- return isUndefined$1(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6847
- }
6909
+ function dispatchEvent(target, event) {
6910
+ return target.dispatchEvent(event);
6911
+ }
6848
6912
 
6849
- function removeAttribute(element, name, namespace) {
6850
- if (isUndefined$1(namespace)) {
6851
- element.removeAttribute(name);
6852
- } else {
6853
- element.removeAttributeNS(namespace, name);
6913
+ function getClassList(element) {
6914
+ return element.classList;
6854
6915
  }
6855
- }
6856
6916
 
6857
- function addEventListener(target, type, callback, options) {
6858
- target.addEventListener(type, callback, options);
6859
- }
6917
+ function setCSSStyleProperty(element, name, value, important) {
6918
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
6919
+ // represent elements in the engine?
6920
+ element.style.setProperty(name, value, important ? 'important' : '');
6921
+ }
6860
6922
 
6861
- function removeEventListener(target, type, callback, options) {
6862
- target.removeEventListener(type, callback, options);
6863
- }
6923
+ function getBoundingClientRect(element) {
6924
+ return element.getBoundingClientRect();
6925
+ }
6864
6926
 
6865
- function dispatchEvent(target, event) {
6866
- return target.dispatchEvent(event);
6867
- }
6927
+ function querySelector(element, selectors) {
6928
+ return element.querySelector(selectors);
6929
+ }
6868
6930
 
6869
- function getClassList(element) {
6870
- return element.classList;
6871
- }
6931
+ function querySelectorAll(element, selectors) {
6932
+ return element.querySelectorAll(selectors);
6933
+ }
6872
6934
 
6873
- function setCSSStyleProperty(element, name, value, important) {
6874
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
6875
- // represent elements in the engine?
6876
- element.style.setProperty(name, value, important ? 'important' : '');
6877
- }
6935
+ function getElementsByTagName(element, tagNameOrWildCard) {
6936
+ return element.getElementsByTagName(tagNameOrWildCard);
6937
+ }
6878
6938
 
6879
- function getBoundingClientRect(element) {
6880
- return element.getBoundingClientRect();
6881
- }
6939
+ function getElementsByClassName(element, names) {
6940
+ return element.getElementsByClassName(names);
6941
+ }
6882
6942
 
6883
- function querySelector(element, selectors) {
6884
- return element.querySelector(selectors);
6885
- }
6943
+ function getChildren(element) {
6944
+ return element.children;
6945
+ }
6886
6946
 
6887
- function querySelectorAll(element, selectors) {
6888
- return element.querySelectorAll(selectors);
6889
- }
6947
+ function getChildNodes(element) {
6948
+ return element.childNodes;
6949
+ }
6890
6950
 
6891
- function getElementsByTagName(element, tagNameOrWildCard) {
6892
- return element.getElementsByTagName(tagNameOrWildCard);
6893
- }
6951
+ function getFirstChild(element) {
6952
+ return element.firstChild;
6953
+ }
6894
6954
 
6895
- function getElementsByClassName(element, names) {
6896
- return element.getElementsByClassName(names);
6897
- }
6955
+ function getFirstElementChild(element) {
6956
+ return element.firstElementChild;
6957
+ }
6898
6958
 
6899
- function getChildren(element) {
6900
- return element.children;
6901
- }
6959
+ function getLastChild(element) {
6960
+ return element.lastChild;
6961
+ }
6902
6962
 
6903
- function getChildNodes(element) {
6904
- return element.childNodes;
6905
- }
6963
+ function getLastElementChild(element) {
6964
+ return element.lastElementChild;
6965
+ }
6906
6966
 
6907
- function getFirstChild(element) {
6908
- return element.firstChild;
6909
- }
6967
+ function isConnected(node) {
6968
+ return node.isConnected;
6969
+ }
6910
6970
 
6911
- function getFirstElementChild(element) {
6912
- return element.firstElementChild;
6913
- }
6971
+ function assertInstanceOfHTMLElement(elm, msg) {
6972
+ assertInvariant(elm instanceof HTMLElement, msg);
6973
+ }
6914
6974
 
6915
- function getLastChild(element) {
6916
- return element.lastChild;
6917
- }
6975
+ var HTMLElementExported = HTMLElementConstructor;
6976
+ var renderer = {
6977
+ HTMLElementExported: HTMLElementExported,
6978
+ insert: insert,
6979
+ remove: remove,
6980
+ cloneNode: cloneNode,
6981
+ createFragment: createFragment,
6982
+ createElement: createElement,
6983
+ createText: createText,
6984
+ createComment: createComment,
6985
+ nextSibling: nextSibling,
6986
+ attachShadow: attachShadow,
6987
+ getProperty: getProperty,
6988
+ setProperty: setProperty,
6989
+ setText: setText,
6990
+ getAttribute: getAttribute,
6991
+ setAttribute: setAttribute,
6992
+ removeAttribute: removeAttribute,
6993
+ addEventListener: addEventListener,
6994
+ removeEventListener: removeEventListener,
6995
+ dispatchEvent: dispatchEvent,
6996
+ getClassList: getClassList,
6997
+ setCSSStyleProperty: setCSSStyleProperty,
6998
+ getBoundingClientRect: getBoundingClientRect,
6999
+ querySelector: querySelector,
7000
+ querySelectorAll: querySelectorAll,
7001
+ getElementsByTagName: getElementsByTagName,
7002
+ getElementsByClassName: getElementsByClassName,
7003
+ getChildren: getChildren,
7004
+ getChildNodes: getChildNodes,
7005
+ getFirstChild: getFirstChild,
7006
+ getFirstElementChild: getFirstElementChild,
7007
+ getLastChild: getLastChild,
7008
+ getLastElementChild: getLastElementChild,
7009
+ isConnected: isConnected,
7010
+ assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
7011
+ defineCustomElement: defineCustomElement,
7012
+ getCustomElement: getCustomElement
7013
+ }; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
6918
7014
 
6919
- function getLastElementChild(element) {
6920
- return element.lastElementChild;
7015
+ Object.setPrototypeOf(renderer, baseRenderer);
7016
+ return renderer;
6921
7017
  }
7018
+ /*
7019
+ * Copyright (c) 2018, salesforce.com, inc.
7020
+ * All rights reserved.
7021
+ * SPDX-License-Identifier: MIT
7022
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7023
+ */
6922
7024
 
6923
- function isConnected(node) {
6924
- return node.isConnected;
6925
- }
7025
+ /**
7026
+ * The base renderer that will be used by engine-core.
7027
+ * This will be used for DOM operations when lwc is running in a browser environment.
7028
+ */
6926
7029
 
6927
- function assertInstanceOfHTMLElement(elm, msg) {
6928
- assert.invariant(elm instanceof HTMLElement, msg);
6929
- }
6930
7030
 
6931
- var HTMLElementExported = HTMLElementConstructor;
6932
- var renderer = {
6933
- isNativeShadowDefined: isNativeShadowDefined,
6934
- isSyntheticShadowDefined: isSyntheticShadowDefined,
6935
- HTMLElementExported: HTMLElementExported,
6936
- insert: insert,
6937
- remove: remove,
6938
- cloneNode: cloneNode,
6939
- createFragment: createFragment,
6940
- createElement: createElement$1,
6941
- createText: createText,
6942
- createComment: createComment,
6943
- nextSibling: nextSibling,
6944
- attachShadow: attachShadow,
6945
- getProperty: getProperty,
6946
- setProperty: setProperty,
6947
- setText: setText,
6948
- getAttribute: getAttribute,
6949
- setAttribute: setAttribute,
6950
- removeAttribute: removeAttribute,
6951
- addEventListener: addEventListener,
6952
- removeEventListener: removeEventListener,
6953
- dispatchEvent: dispatchEvent,
6954
- getClassList: getClassList,
6955
- setCSSStyleProperty: setCSSStyleProperty,
6956
- getBoundingClientRect: getBoundingClientRect,
6957
- querySelector: querySelector,
6958
- querySelectorAll: querySelectorAll,
6959
- getElementsByTagName: getElementsByTagName,
6960
- getElementsByClassName: getElementsByClassName,
6961
- getChildren: getChildren,
6962
- getChildNodes: getChildNodes,
6963
- getFirstChild: getFirstChild,
6964
- getFirstElementChild: getFirstElementChild,
6965
- getLastChild: getLastChild,
6966
- getLastElementChild: getLastElementChild,
6967
- isConnected: isConnected,
7031
+ var renderer = assign( // The base renderer will invoke the factory with null and assign additional properties that are
7032
+ // shared across renderers
7033
+ rendererFactory(null), // Properties that are either not required to be sandboxed or rely on a globally shared information
7034
+ {
7035
+ // insertStyleSheet implementation shares a global cache of stylesheet data
6968
7036
  insertStylesheet: insertStylesheet,
6969
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
6970
- defineCustomElement: defineCustomElement,
6971
- getCustomElement: getCustomElement
6972
- };
7037
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7038
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
7039
+ });
6973
7040
  /*
6974
7041
  * Copyright (c) 2018, salesforce.com, inc.
6975
7042
  * All rights reserved.
@@ -7137,7 +7204,6 @@
7137
7204
  * SPDX-License-Identifier: MIT
7138
7205
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7139
7206
  */
7140
- // TODO [#2472]: Remove this workaround when appropriate.
7141
7207
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
7142
7208
 
7143
7209
 
@@ -7154,39 +7220,41 @@
7154
7220
  }
7155
7221
 
7156
7222
  return node; // for convenience
7157
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7158
- // created via createElement.
7159
-
7223
+ }
7160
7224
 
7161
- var _Node$1$prototype = _Node$1.prototype,
7162
- _appendChild2 = _Node$1$prototype.appendChild,
7163
- _insertBefore2 = _Node$1$prototype.insertBefore,
7164
- _removeChild2 = _Node$1$prototype.removeChild,
7165
- _replaceChild2 = _Node$1$prototype.replaceChild;
7166
- assign(_Node$1.prototype, {
7167
- appendChild: function appendChild(newChild) {
7168
- var appendedNode = _appendChild2.call(this, newChild);
7225
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7226
+ // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7227
+ // created via createElement.
7228
+ var _Node$1$prototype = _Node$1.prototype,
7229
+ _appendChild = _Node$1$prototype.appendChild,
7230
+ _insertBefore = _Node$1$prototype.insertBefore,
7231
+ _removeChild = _Node$1$prototype.removeChild,
7232
+ _replaceChild = _Node$1$prototype.replaceChild;
7233
+ assign(_Node$1.prototype, {
7234
+ appendChild: function appendChild(newChild) {
7235
+ var appendedNode = _appendChild.call(this, newChild);
7169
7236
 
7170
- return callNodeSlot(appendedNode, ConnectingSlot);
7171
- },
7172
- insertBefore: function insertBefore(newChild, referenceNode) {
7173
- var insertedNode = _insertBefore2.call(this, newChild, referenceNode);
7237
+ return callNodeSlot(appendedNode, ConnectingSlot);
7238
+ },
7239
+ insertBefore: function insertBefore(newChild, referenceNode) {
7240
+ var insertedNode = _insertBefore.call(this, newChild, referenceNode);
7174
7241
 
7175
- return callNodeSlot(insertedNode, ConnectingSlot);
7176
- },
7177
- removeChild: function removeChild(oldChild) {
7178
- var removedNode = _removeChild2.call(this, oldChild);
7242
+ return callNodeSlot(insertedNode, ConnectingSlot);
7243
+ },
7244
+ removeChild: function removeChild(oldChild) {
7245
+ var removedNode = _removeChild.call(this, oldChild);
7179
7246
 
7180
- return callNodeSlot(removedNode, DisconnectingSlot);
7181
- },
7182
- replaceChild: function replaceChild(newChild, oldChild) {
7183
- var replacedNode = _replaceChild2.call(this, newChild, oldChild);
7247
+ return callNodeSlot(removedNode, DisconnectingSlot);
7248
+ },
7249
+ replaceChild: function replaceChild(newChild, oldChild) {
7250
+ var replacedNode = _replaceChild.call(this, newChild, oldChild);
7184
7251
 
7185
- callNodeSlot(replacedNode, DisconnectingSlot);
7186
- callNodeSlot(newChild, ConnectingSlot);
7187
- return replacedNode;
7188
- }
7189
- });
7252
+ callNodeSlot(replacedNode, DisconnectingSlot);
7253
+ callNodeSlot(newChild, ConnectingSlot);
7254
+ return replacedNode;
7255
+ }
7256
+ });
7257
+ }
7190
7258
  /**
7191
7259
  * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
7192
7260
  * difference that in the options, you can pass the `is` property set to a Constructor instead of
@@ -7199,6 +7267,7 @@
7199
7267
  * ```
7200
7268
  */
7201
7269
 
7270
+
7202
7271
  function createElement(sel, options) {
7203
7272
  if (!isObject(options) || isNull(options)) {
7204
7273
  throw new TypeError("\"createElement\" function expects an object as second parameter but received \"".concat(toString$1(options), "\"."));
@@ -7226,8 +7295,12 @@
7226
7295
  mode: options.mode !== 'closed' ? 'open' : 'closed',
7227
7296
  owner: null
7228
7297
  });
7229
- ConnectingSlot.set(elm, connectRootElement);
7230
- DisconnectingSlot.set(elm, disconnectRootElement);
7298
+
7299
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7300
+ ConnectingSlot.set(elm, connectRootElement);
7301
+ DisconnectingSlot.set(elm, disconnectRootElement);
7302
+ }
7303
+
7231
7304
  wasComponentUpgraded = true;
7232
7305
  });
7233
7306
 
@@ -7274,7 +7347,7 @@
7274
7347
  // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
7275
7348
 
7276
7349
 
7277
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7350
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7278
7351
  }
7279
7352
  /*
7280
7353
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7318,7 +7391,7 @@
7318
7391
  });
7319
7392
  freeze(LightningElement);
7320
7393
  seal(LightningElement.prototype);
7321
- /* version: 2.23.1 */
7394
+ /* version: 2.23.2 */
7322
7395
 
7323
7396
  exports.LightningElement = LightningElement;
7324
7397
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7340,6 +7413,7 @@
7340
7413
  exports.registerDecorators = registerDecorators;
7341
7414
  exports.registerTemplate = registerTemplate;
7342
7415
  exports.renderer = renderer;
7416
+ exports.rendererFactory = rendererFactory;
7343
7417
  exports.sanitizeAttribute = sanitizeAttribute;
7344
7418
  exports.setFeatureFlag = setFeatureFlag;
7345
7419
  exports.setFeatureFlagForTest = setFeatureFlagForTest;