lwc 2.23.5 → 2.24.0

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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +216 -69
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +216 -69
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +194 -67
  5. package/dist/engine-dom/iife/es5/engine-dom.js +494 -313
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +463 -299
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +216 -69
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +194 -67
  11. package/dist/engine-dom/umd/es5/engine-dom.js +494 -313
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +463 -299
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +124 -16
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +124 -16
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +205 -168
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +205 -168
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +195 -158
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +25 -11
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +25 -11
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +205 -168
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +195 -158
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +25 -11
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +25 -11
  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_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -368,9 +368,9 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.23.5";
371
+ var LWC_VERSION = "2.24.0";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.23.5 */
373
+ /** version: 2.24.0 */
374
374
 
375
375
  /**
376
376
  * Copyright (C) 2018 salesforce.com, inc.
@@ -464,7 +464,7 @@
464
464
  patch$1(propName);
465
465
  }
466
466
  }
467
- /** version: 2.23.5 */
467
+ /** version: 2.24.0 */
468
468
 
469
469
  /**
470
470
  * Copyright (C) 2018 salesforce.com, inc.
@@ -557,7 +557,7 @@
557
557
  setFeatureFlag(name, value);
558
558
  }
559
559
  }
560
- /** version: 2.23.5 */
560
+ /** version: 2.24.0 */
561
561
 
562
562
  /*
563
563
  * Copyright (c) 2018, salesforce.com, inc.
@@ -735,6 +735,22 @@
735
735
  }
736
736
 
737
737
  return list;
738
+ } // Set a ref (lwc:ref) on a VM, from a template API
739
+
740
+
741
+ function setRefVNode(vm, ref, vnode) {
742
+ if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
743
+ throw new Error('refVNodes must be defined when setting a ref');
744
+ } // If this method is called, then vm.refVNodes is set as the template has refs.
745
+ // If not, then something went wrong and we threw an error above.
746
+
747
+
748
+ var refVNodes = vm.refVNodes; // In cases of conflict (two elements with the same ref), prefer, the last one,
749
+ // in depth-first traversal order.
750
+
751
+ if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
752
+ refVNodes[ref] = vnode;
753
+ }
738
754
  }
739
755
  /*
740
756
  * Copyright (c) 2019, salesforce.com, inc.
@@ -2397,13 +2413,15 @@
2397
2413
  }
2398
2414
  };
2399
2415
  }
2416
+
2417
+ var EMPTY_REFS = freeze(create(null));
2418
+ var refsCache = new WeakMap();
2400
2419
  /**
2401
2420
  * This class is the base class for any LWC element.
2402
2421
  * Some elements directly extends this class, others implement it via inheritance.
2403
2422
  **/
2404
2423
  // @ts-ignore
2405
2424
 
2406
-
2407
2425
  var LightningElement = function LightningElement() {
2408
2426
  // This should be as performant as possible, while any initialization should be done lazily
2409
2427
  if (isNull(vmBeingConstructed)) {
@@ -2630,6 +2648,91 @@
2630
2648
  return vm.shadowRoot;
2631
2649
  },
2632
2650
 
2651
+ get refs() {
2652
+ var vm = getAssociatedVM(this);
2653
+
2654
+ if (isUpdatingTemplate) {
2655
+ if (process.env.NODE_ENV !== 'production') {
2656
+ logError("this.refs should not be called while ".concat(getComponentTag(vm), " is rendering. Use this.refs only when the DOM is stable, e.g. in renderedCallback()."));
2657
+ } // If the template is in the process of being updated, then we don't want to go through the normal
2658
+ // process of returning the refs and caching them, because the state of the refs is unstable.
2659
+ // This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
2660
+ // based on `this.refs.bar`.
2661
+
2662
+
2663
+ return;
2664
+ }
2665
+
2666
+ if (process.env.NODE_ENV !== 'production') {
2667
+ warnIfInvokedDuringConstruction(vm, 'refs');
2668
+ }
2669
+
2670
+ var refVNodes = vm.refVNodes,
2671
+ hasRefVNodes = vm.hasRefVNodes,
2672
+ cmpTemplate = vm.cmpTemplate; // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
2673
+ // if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
2674
+ // so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
2675
+ // `warnIfInvokedDuringConstruction` above).
2676
+
2677
+ if (process.env.NODE_ENV !== 'production' && isNull(cmpTemplate) && !isBeingConstructed(vm)) {
2678
+ logError("this.refs is undefined for ".concat(getComponentTag(vm), ". This is either because the attached template has no \"lwc:ref\" directive, or this.refs was ") + "invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have " + "been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().");
2679
+ } // For backwards compatibility with component written before template refs
2680
+ // were introduced, we return undefined if the template has no refs defined
2681
+ // anywhere. This fixes components that may want to add an expando called `refs`
2682
+ // and are checking if it exists with `if (this.refs)` before adding it.
2683
+ // Note it is not sufficient to just check if `refVNodes` is null or empty,
2684
+ // because a template may have `lwc:ref` defined within a falsy `if:true` block.
2685
+
2686
+
2687
+ if (!hasRefVNodes) {
2688
+ return;
2689
+ } // For templates that are using `lwc:ref`, if there are no refs currently available
2690
+ // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
2691
+
2692
+
2693
+ if (isNull(refVNodes)) {
2694
+ return EMPTY_REFS;
2695
+ } // The refNodes can be cached based on the refVNodes, since the refVNodes
2696
+ // are recreated from scratch every time the template is rendered.
2697
+ // This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
2698
+
2699
+
2700
+ var refs = refsCache.get(refVNodes);
2701
+
2702
+ if (isUndefined$1(refs)) {
2703
+ refs = create(null);
2704
+
2705
+ var _iterator3 = _createForOfIteratorHelper(keys(refVNodes)),
2706
+ _step3;
2707
+
2708
+ try {
2709
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2710
+ var key = _step3.value;
2711
+ refs[key] = refVNodes[key].elm;
2712
+ }
2713
+ } catch (err) {
2714
+ _iterator3.e(err);
2715
+ } finally {
2716
+ _iterator3.f();
2717
+ }
2718
+
2719
+ freeze(refs);
2720
+ refsCache.set(refVNodes, refs);
2721
+ }
2722
+
2723
+ return refs;
2724
+ },
2725
+
2726
+ // For backwards compat, we allow component authors to set `refs` as an expando
2727
+ set refs(value) {
2728
+ defineProperty(this, 'refs', {
2729
+ configurable: true,
2730
+ enumerable: true,
2731
+ writable: true,
2732
+ value: value
2733
+ });
2734
+ },
2735
+
2633
2736
  get shadowRoot() {
2634
2737
  // From within the component instance, the shadowRoot is always reported as "closed".
2635
2738
  // Authors should rely on this.template instead.
@@ -4545,15 +4648,33 @@
4545
4648
 
4546
4649
  function patchProps(oldVnode, vnode, renderer) {
4547
4650
  var props = vnode.data.props;
4651
+ var spread = vnode.data.spread;
4548
4652
 
4549
- if (isUndefined$1(props)) {
4653
+ if (isUndefined$1(props) && isUndefined$1(spread)) {
4550
4654
  return;
4551
4655
  }
4552
4656
 
4553
- var oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;
4657
+ var oldProps;
4554
4658
 
4555
- if (oldProps === props) {
4556
- return;
4659
+ if (!isNull(oldVnode)) {
4660
+ oldProps = oldVnode.data.props;
4661
+ var oldSpread = oldVnode.data.spread;
4662
+
4663
+ if (oldProps === props && oldSpread === spread) {
4664
+ return;
4665
+ }
4666
+
4667
+ if (isUndefined$1(oldProps)) {
4668
+ oldProps = EmptyObject;
4669
+ }
4670
+
4671
+ if (!isUndefined$1(oldSpread)) {
4672
+ oldProps = assign({}, oldProps, oldSpread);
4673
+ }
4674
+ }
4675
+
4676
+ if (!isUndefined$1(spread)) {
4677
+ props = assign({}, props, spread);
4557
4678
  }
4558
4679
 
4559
4680
  var isFirstPatch = isNull(oldVnode);
@@ -4566,7 +4687,8 @@
4566
4687
  var cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is
4567
4688
  // different than the one previously set.
4568
4689
 
4569
- if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
4690
+ if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) || !(key in oldProps) // this is required because the above case will pass when `cur` is `undefined` and key is missing in `oldProps`
4691
+ ) {
4570
4692
  // Additional verification if properties are supported by the element
4571
4693
  // Validation relies on html properties and public properties being defined on the element,
4572
4694
  // SSR has its own custom validation.
@@ -5634,19 +5756,25 @@
5634
5756
  });
5635
5757
  }
5636
5758
 
5637
- var elm;
5638
- var key = data.key;
5639
- return {
5759
+ var key = data.key,
5760
+ ref = data.ref;
5761
+ var vnode = {
5640
5762
  type: 2
5641
5763
  /* VNodeType.Element */
5642
5764
  ,
5643
5765
  sel: sel,
5644
5766
  data: data,
5645
5767
  children: children,
5646
- elm: elm,
5768
+ elm: undefined,
5647
5769
  key: key,
5648
5770
  owner: vmBeingRendered
5649
5771
  };
5772
+
5773
+ if (!isUndefined$1(ref)) {
5774
+ setRefVNode(vmBeingRendered, ref, vnode);
5775
+ }
5776
+
5777
+ return vnode;
5650
5778
  } // [t]ab[i]ndex function
5651
5779
 
5652
5780
 
@@ -5727,7 +5855,8 @@
5727
5855
  }
5728
5856
  }
5729
5857
 
5730
- var key = data.key;
5858
+ var key = data.key,
5859
+ ref = data.ref;
5731
5860
  var elm, aChildren, vm;
5732
5861
  var vnode = {
5733
5862
  type: 3
@@ -5745,6 +5874,11 @@
5745
5874
  vm: vm
5746
5875
  };
5747
5876
  addVNodeToChildLWC(vnode);
5877
+
5878
+ if (!isUndefined$1(ref)) {
5879
+ setRefVNode(vmBeingRendered, ref, vnode);
5880
+ }
5881
+
5748
5882
  return vnode;
5749
5883
  } // [i]terable node
5750
5884
 
@@ -6399,9 +6533,13 @@
6399
6533
  validateSlots(vm, html); // add the VM to the list of host VMs that can be re-rendered if html is swapped
6400
6534
 
6401
6535
  setActiveVM(vm);
6402
- } // right before producing the vnodes, we clear up all internal references
6403
- // to custom elements from the template.
6536
+ } // reset the refs; they will be set during the tmpl() instantiation
6537
+
6404
6538
 
6539
+ var hasRefVNodes = Boolean(html.hasRefs);
6540
+ vm.hasRefVNodes = hasRefVNodes;
6541
+ vm.refVNodes = hasRefVNodes ? create(null) : null; // right before producing the vnodes, we clear up all internal references
6542
+ // to custom elements from the template.
6405
6543
 
6406
6544
  vm.velements = []; // Set the global flag that template is being updated
6407
6545
 
@@ -6814,6 +6952,8 @@
6814
6952
  tagName: tagName,
6815
6953
  mode: mode,
6816
6954
  owner: owner,
6955
+ refVNodes: null,
6956
+ hasRefVNodes: false,
6817
6957
  children: EmptyArray,
6818
6958
  aChildren: EmptyArray,
6819
6959
  velements: EmptyArray,
@@ -8275,12 +8415,12 @@
8275
8415
  function warnOnArrayMutation(stylesheets) {
8276
8416
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
8277
8417
  // we can at least warn when they use the most common mutation methods.
8278
- var _iterator3 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
8279
- _step3;
8418
+ var _iterator4 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
8419
+ _step4;
8280
8420
 
8281
8421
  try {
8282
8422
  var _loop2 = function _loop2() {
8283
- var prop = _step3.value;
8423
+ var prop = _step4.value;
8284
8424
  var originalArrayMethod = getOriginalArrayMethod(prop);
8285
8425
 
8286
8426
  stylesheets[prop] = function arrayMutationWarningWrapper() {
@@ -8290,13 +8430,13 @@
8290
8430
  };
8291
8431
  };
8292
8432
 
8293
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
8433
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
8294
8434
  _loop2();
8295
8435
  }
8296
8436
  } catch (err) {
8297
- _iterator3.e(err);
8437
+ _iterator4.e(err);
8298
8438
  } finally {
8299
- _iterator3.f();
8439
+ _iterator4.f();
8300
8440
  }
8301
8441
  } // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
8302
8442
  // just warns on mutation.
@@ -8308,12 +8448,12 @@
8308
8448
  warnOnArrayMutation(tmpl.stylesheets);
8309
8449
  }
8310
8450
 
8311
- var _iterator4 = _createForOfIteratorHelper(TEMPLATE_PROPS),
8312
- _step4;
8451
+ var _iterator5 = _createForOfIteratorHelper(TEMPLATE_PROPS),
8452
+ _step5;
8313
8453
 
8314
8454
  try {
8315
8455
  var _loop3 = function _loop3() {
8316
- var prop = _step4.value;
8456
+ var prop = _step5.value;
8317
8457
  var value = tmpl[prop];
8318
8458
  defineProperty(tmpl, prop, {
8319
8459
  enumerable: true,
@@ -8331,13 +8471,13 @@
8331
8471
  });
8332
8472
  };
8333
8473
 
8334
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
8474
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8335
8475
  _loop3();
8336
8476
  }
8337
8477
  } catch (err) {
8338
- _iterator4.e(err);
8478
+ _iterator5.e(err);
8339
8479
  } finally {
8340
- _iterator4.f();
8480
+ _iterator5.f();
8341
8481
  }
8342
8482
 
8343
8483
  var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
@@ -8382,7 +8522,7 @@
8382
8522
 
8383
8523
  return ctor;
8384
8524
  }
8385
- /* version: 2.23.5 */
8525
+ /* version: 2.24.0 */
8386
8526
 
8387
8527
  /*
8388
8528
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8562,356 +8702,397 @@
8562
8702
 
8563
8703
 
8564
8704
  function rendererFactory(baseRenderer) {
8565
- // Util functions
8566
- function assertInvariant(value, msg) {
8567
- if (!value) {
8568
- throw new Error("Invariant Violation: ".concat(msg));
8705
+ var renderer = function (exports) {
8706
+ /**
8707
+ * Copyright (C) 2018 salesforce.com, inc.
8708
+ */
8709
+
8710
+ /*
8711
+ * Copyright (c) 2018, salesforce.com, inc.
8712
+ * All rights reserved.
8713
+ * SPDX-License-Identifier: MIT
8714
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8715
+ */
8716
+ function invariant(value, msg) {
8717
+ if (!value) {
8718
+ throw new Error("Invariant Violation: ".concat(msg));
8719
+ }
8569
8720
  }
8570
- }
8571
8721
 
8572
- function isNull(obj) {
8573
- return obj === null;
8574
- }
8722
+ function isTrue$1(value, msg) {
8723
+ if (!value) {
8724
+ throw new Error("Assert Violation: ".concat(msg));
8725
+ }
8726
+ }
8575
8727
 
8576
- function isUndefined(obj) {
8577
- return obj === undefined;
8578
- }
8728
+ function isFalse$1(value, msg) {
8729
+ if (value) {
8730
+ throw new Error("Assert Violation: ".concat(msg));
8731
+ }
8732
+ }
8579
8733
 
8580
- var getCustomElement;
8581
- var defineCustomElement;
8582
- var HTMLElementConstructor;
8734
+ function fail(msg) {
8735
+ throw new Error(msg);
8736
+ }
8583
8737
 
8584
- function isCustomElementRegistryAvailable() {
8585
- if (typeof customElements === 'undefined') {
8586
- return false;
8738
+ var assert = /*#__PURE__*/Object.freeze({
8739
+ __proto__: null,
8740
+ invariant: invariant,
8741
+ isTrue: isTrue$1,
8742
+ isFalse: isFalse$1,
8743
+ fail: fail
8744
+ });
8745
+
8746
+ function isUndefined(obj) {
8747
+ return obj === undefined;
8587
8748
  }
8588
8749
 
8589
- try {
8590
- // dereference HTMLElement global because babel wraps globals in compat mode with a
8591
- // _wrapNativeSuper()
8592
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8593
- // get wrapped by babel.
8594
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8595
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8596
- // which are not equipped to be initialized that way.
8750
+ function isNull(obj) {
8751
+ return obj === null;
8752
+ }
8753
+ /** version: 2.24.0 */
8597
8754
 
8598
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8599
- _inherits(clazz, _HTMLElementAlias);
8755
+ /*
8756
+ * Copyright (c) 2018, salesforce.com, inc.
8757
+ * All rights reserved.
8758
+ * SPDX-License-Identifier: MIT
8759
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8760
+ */
8600
8761
 
8601
- var _super7 = _createSuper(clazz);
8602
8762
 
8603
- function clazz() {
8604
- _classCallCheck(this, clazz);
8763
+ exports.getCustomElement = void 0;
8764
+ exports.defineCustomElement = void 0;
8765
+ var HTMLElementConstructor;
8605
8766
 
8606
- return _super7.apply(this, arguments);
8607
- }
8767
+ function isCustomElementRegistryAvailable() {
8768
+ if (typeof customElements === 'undefined') {
8769
+ return false;
8770
+ }
8608
8771
 
8609
- return _createClass(clazz);
8610
- }(HTMLElementAlias);
8772
+ try {
8773
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
8774
+ // _wrapNativeSuper()
8775
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8776
+ // get wrapped by babel.
8777
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8778
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8779
+ // which are not equipped to be initialized that way.
8611
8780
 
8612
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8613
- new clazz();
8614
- return true;
8615
- } catch (_a) {
8616
- return false;
8617
- }
8618
- }
8781
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8782
+ _inherits(clazz, _HTMLElementAlias);
8619
8783
 
8620
- if (isCustomElementRegistryAvailable()) {
8621
- getCustomElement = customElements.get.bind(customElements);
8622
- defineCustomElement = customElements.define.bind(customElements);
8623
- HTMLElementConstructor = HTMLElement;
8624
- } else {
8625
- var registry = Object.create(null);
8626
- var reverseRegistry = new WeakMap();
8784
+ var _super7 = _createSuper(clazz);
8627
8785
 
8628
- defineCustomElement = function define(name, ctor) {
8629
- if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
8630
- throw new TypeError("Invalid Registration");
8631
- }
8786
+ function clazz() {
8787
+ _classCallCheck(this, clazz);
8632
8788
 
8633
- registry[name] = ctor;
8634
- reverseRegistry.set(ctor, name);
8635
- };
8789
+ return _super7.apply(this, arguments);
8790
+ }
8636
8791
 
8637
- getCustomElement = function get(name) {
8638
- return registry[name];
8639
- };
8792
+ return _createClass(clazz);
8793
+ }(HTMLElementAlias);
8640
8794
 
8641
- HTMLElementConstructor = function HTMLElement() {
8642
- if (!(this instanceof HTMLElement)) {
8643
- throw new TypeError("Invalid Invocation");
8795
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8796
+ new clazz();
8797
+ return true;
8798
+ } catch (_a) {
8799
+ return false;
8644
8800
  }
8801
+ }
8645
8802
 
8646
- var constructor = this.constructor;
8647
- var name = reverseRegistry.get(constructor);
8803
+ if (isCustomElementRegistryAvailable()) {
8804
+ exports.getCustomElement = customElements.get.bind(customElements);
8805
+ exports.defineCustomElement = customElements.define.bind(customElements);
8806
+ HTMLElementConstructor = HTMLElement;
8807
+ } else {
8808
+ var registry = Object.create(null);
8809
+ var reverseRegistry = new WeakMap();
8648
8810
 
8649
- if (!name) {
8650
- throw new TypeError("Invalid Construction");
8651
- }
8811
+ exports.defineCustomElement = function define(name, ctor) {
8812
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
8813
+ throw new TypeError("Invalid Registration");
8814
+ }
8652
8815
 
8653
- var elm = document.createElement(name);
8654
- Object.setPrototypeOf(elm, constructor.prototype);
8655
- return elm;
8656
- };
8816
+ registry[name] = ctor;
8817
+ reverseRegistry.set(ctor, name);
8818
+ };
8657
8819
 
8658
- HTMLElementConstructor.prototype = HTMLElement.prototype;
8659
- }
8820
+ exports.getCustomElement = function get(name) {
8821
+ return registry[name];
8822
+ };
8660
8823
 
8661
- function cloneNode(node, deep) {
8662
- return node.cloneNode(deep);
8663
- }
8824
+ HTMLElementConstructor = function HTMLElement() {
8825
+ if (!(this instanceof HTMLElement)) {
8826
+ throw new TypeError("Invalid Invocation");
8827
+ }
8664
8828
 
8665
- function createElement(tagName, namespace) {
8666
- return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8667
- }
8829
+ var constructor = this.constructor;
8830
+ var name = reverseRegistry.get(constructor);
8668
8831
 
8669
- function createText(content) {
8670
- return document.createTextNode(content);
8671
- }
8832
+ if (!name) {
8833
+ throw new TypeError("Invalid Construction");
8834
+ }
8672
8835
 
8673
- function createComment(content) {
8674
- return document.createComment(content);
8675
- }
8836
+ var elm = document.createElement(name);
8837
+ Object.setPrototypeOf(elm, constructor.prototype);
8838
+ return elm;
8839
+ };
8676
8840
 
8677
- var createFragment; // IE11 lacks support for this feature
8841
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
8842
+ }
8678
8843
 
8679
- var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8844
+ function cloneNode(node, deep) {
8845
+ return node.cloneNode(deep);
8846
+ }
8680
8847
 
8681
- if (SUPPORTS_TEMPLATE) {
8682
- // Parse the fragment HTML string into DOM
8683
- createFragment = function createFragment(html) {
8684
- var template = document.createElement('template');
8685
- template.innerHTML = html;
8686
- return template.content.firstChild;
8687
- };
8688
- } else {
8689
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8690
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8691
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8692
- // With other elements added from:
8693
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8694
- // Using the test:
8695
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8696
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8697
- var topLevelWrappingMap = {
8698
- caption: ['table'],
8699
- col: ['colgroup', 'table'],
8700
- colgroup: ['table'],
8701
- option: ['select'],
8702
- tbody: ['table'],
8703
- td: ['tr', 'tbody', 'table'],
8704
- th: ['tr', 'tbody', 'table'],
8705
- thead: ['table'],
8706
- tfoot: ['table'],
8707
- tr: ['tbody', 'table']
8708
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8709
-
8710
- var getTagName = function getTagName(text) {
8711
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8712
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8713
-
8714
-
8715
- createFragment = function createFragment(html) {
8716
- var wrapperTags = topLevelWrappingMap[getTagName(html)];
8717
-
8718
- if (!isUndefined(wrapperTags)) {
8719
- var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8720
- _step5;
8721
-
8722
- try {
8723
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8724
- var wrapperTag = _step5.value;
8725
- html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8848
+ function createElement(tagName, namespace) {
8849
+ return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8850
+ }
8851
+
8852
+ function createText(content) {
8853
+ return document.createTextNode(content);
8854
+ }
8855
+
8856
+ function createComment(content) {
8857
+ return document.createComment(content);
8858
+ }
8859
+
8860
+ exports.createFragment = void 0; // IE11 lacks support for this feature
8861
+
8862
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8863
+
8864
+ if (SUPPORTS_TEMPLATE) {
8865
+ // Parse the fragment HTML string into DOM
8866
+ exports.createFragment = function (html) {
8867
+ var template = document.createElement('template');
8868
+ template.innerHTML = html;
8869
+ return template.content.firstChild;
8870
+ };
8871
+ } else {
8872
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8873
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8874
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8875
+ // With other elements added from:
8876
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8877
+ // Using the test:
8878
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8879
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8880
+ var topLevelWrappingMap = {
8881
+ caption: ['table'],
8882
+ col: ['colgroup', 'table'],
8883
+ colgroup: ['table'],
8884
+ option: ['select'],
8885
+ tbody: ['table'],
8886
+ td: ['tr', 'tbody', 'table'],
8887
+ th: ['tr', 'tbody', 'table'],
8888
+ thead: ['table'],
8889
+ tfoot: ['table'],
8890
+ tr: ['tbody', 'table']
8891
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8892
+
8893
+ var getTagName = function getTagName(text) {
8894
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8895
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8896
+
8897
+
8898
+ exports.createFragment = function (html) {
8899
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8900
+
8901
+ if (!isUndefined(wrapperTags)) {
8902
+ var _iterator6 = _createForOfIteratorHelper(wrapperTags),
8903
+ _step6;
8904
+
8905
+ try {
8906
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
8907
+ var wrapperTag = _step6.value;
8908
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8909
+ }
8910
+ } catch (err) {
8911
+ _iterator6.e(err);
8912
+ } finally {
8913
+ _iterator6.f();
8726
8914
  }
8727
- } catch (err) {
8728
- _iterator5.e(err);
8729
- } finally {
8730
- _iterator5.f();
8731
- }
8732
- } // For IE11, the document title must not be undefined, but it can be an empty string
8733
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8915
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8916
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8734
8917
 
8735
8918
 
8736
- var doc = document.implementation.createHTMLDocument('');
8737
- doc.body.innerHTML = html;
8738
- var content = doc.body;
8919
+ var doc = document.implementation.createHTMLDocument('');
8920
+ doc.body.innerHTML = html;
8921
+ var content = doc.body;
8739
8922
 
8740
- if (!isUndefined(wrapperTags)) {
8741
- for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8742
- content = content.firstChild;
8923
+ if (!isUndefined(wrapperTags)) {
8924
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8925
+ content = content.firstChild;
8926
+ }
8743
8927
  }
8744
- }
8745
8928
 
8746
- return content.firstChild;
8747
- };
8748
- }
8929
+ return content.firstChild;
8930
+ };
8931
+ }
8749
8932
 
8750
- function insert(node, parent, anchor) {
8751
- parent.insertBefore(node, anchor);
8752
- }
8933
+ function insert(node, parent, anchor) {
8934
+ parent.insertBefore(node, anchor);
8935
+ }
8753
8936
 
8754
- function remove(node, parent) {
8755
- parent.removeChild(node);
8756
- }
8937
+ function remove(node, parent) {
8938
+ parent.removeChild(node);
8939
+ }
8757
8940
 
8758
- function nextSibling(node) {
8759
- return node.nextSibling;
8760
- }
8941
+ function nextSibling(node) {
8942
+ return node.nextSibling;
8943
+ }
8761
8944
 
8762
- function attachShadow(element, options) {
8763
- // `shadowRoot` will be non-null in two cases:
8764
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8765
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
8766
- // root component with customElement.define('c-app', Ctor)
8767
- if (!isNull(element.shadowRoot)) {
8768
- return element.shadowRoot;
8945
+ function attachShadow(element, options) {
8946
+ // `shadowRoot` will be non-null in two cases:
8947
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8948
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
8949
+ // root component with customElement.define('c-app', Ctor)
8950
+ if (!isNull(element.shadowRoot)) {
8951
+ return element.shadowRoot;
8952
+ }
8953
+
8954
+ return element.attachShadow(options);
8769
8955
  }
8770
8956
 
8771
- return element.attachShadow(options);
8772
- }
8957
+ function setText(node, content) {
8958
+ node.nodeValue = content;
8959
+ }
8773
8960
 
8774
- function setText(node, content) {
8775
- node.nodeValue = content;
8776
- }
8961
+ function getProperty(node, key) {
8962
+ return node[key];
8963
+ }
8777
8964
 
8778
- function getProperty(node, key) {
8779
- return node[key];
8780
- }
8965
+ function setProperty(node, key, value) {
8966
+ node[key] = value;
8967
+ }
8781
8968
 
8782
- function setProperty(node, key, value) {
8783
- node[key] = value;
8784
- }
8969
+ function getAttribute(element, name, namespace) {
8970
+ return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8971
+ }
8785
8972
 
8786
- function getAttribute(element, name, namespace) {
8787
- return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8788
- }
8973
+ function setAttribute(element, name, value, namespace) {
8974
+ return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8975
+ }
8789
8976
 
8790
- function setAttribute(element, name, value, namespace) {
8791
- return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8792
- }
8977
+ function removeAttribute(element, name, namespace) {
8978
+ if (isUndefined(namespace)) {
8979
+ element.removeAttribute(name);
8980
+ } else {
8981
+ element.removeAttributeNS(namespace, name);
8982
+ }
8983
+ }
8793
8984
 
8794
- function removeAttribute(element, name, namespace) {
8795
- if (isUndefined(namespace)) {
8796
- element.removeAttribute(name);
8797
- } else {
8798
- element.removeAttributeNS(namespace, name);
8985
+ function addEventListener(target, type, callback, options) {
8986
+ target.addEventListener(type, callback, options);
8799
8987
  }
8800
- }
8801
8988
 
8802
- function addEventListener(target, type, callback, options) {
8803
- target.addEventListener(type, callback, options);
8804
- }
8989
+ function removeEventListener(target, type, callback, options) {
8990
+ target.removeEventListener(type, callback, options);
8991
+ }
8805
8992
 
8806
- function removeEventListener(target, type, callback, options) {
8807
- target.removeEventListener(type, callback, options);
8808
- }
8993
+ function dispatchEvent(target, event) {
8994
+ return target.dispatchEvent(event);
8995
+ }
8809
8996
 
8810
- function dispatchEvent(target, event) {
8811
- return target.dispatchEvent(event);
8812
- }
8997
+ function getClassList(element) {
8998
+ return element.classList;
8999
+ }
8813
9000
 
8814
- function getClassList(element) {
8815
- return element.classList;
8816
- }
9001
+ function setCSSStyleProperty(element, name, value, important) {
9002
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
9003
+ // represent elements in the engine?
9004
+ element.style.setProperty(name, value, important ? 'important' : '');
9005
+ }
8817
9006
 
8818
- function setCSSStyleProperty(element, name, value, important) {
8819
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
8820
- // represent elements in the engine?
8821
- element.style.setProperty(name, value, important ? 'important' : '');
8822
- }
9007
+ function getBoundingClientRect(element) {
9008
+ return element.getBoundingClientRect();
9009
+ }
8823
9010
 
8824
- function getBoundingClientRect(element) {
8825
- return element.getBoundingClientRect();
8826
- }
9011
+ function querySelector(element, selectors) {
9012
+ return element.querySelector(selectors);
9013
+ }
8827
9014
 
8828
- function querySelector(element, selectors) {
8829
- return element.querySelector(selectors);
8830
- }
9015
+ function querySelectorAll(element, selectors) {
9016
+ return element.querySelectorAll(selectors);
9017
+ }
8831
9018
 
8832
- function querySelectorAll(element, selectors) {
8833
- return element.querySelectorAll(selectors);
8834
- }
9019
+ function getElementsByTagName(element, tagNameOrWildCard) {
9020
+ return element.getElementsByTagName(tagNameOrWildCard);
9021
+ }
8835
9022
 
8836
- function getElementsByTagName(element, tagNameOrWildCard) {
8837
- return element.getElementsByTagName(tagNameOrWildCard);
8838
- }
9023
+ function getElementsByClassName(element, names) {
9024
+ return element.getElementsByClassName(names);
9025
+ }
8839
9026
 
8840
- function getElementsByClassName(element, names) {
8841
- return element.getElementsByClassName(names);
8842
- }
9027
+ function getChildren(element) {
9028
+ return element.children;
9029
+ }
8843
9030
 
8844
- function getChildren(element) {
8845
- return element.children;
8846
- }
9031
+ function getChildNodes(element) {
9032
+ return element.childNodes;
9033
+ }
8847
9034
 
8848
- function getChildNodes(element) {
8849
- return element.childNodes;
8850
- }
9035
+ function getFirstChild(element) {
9036
+ return element.firstChild;
9037
+ }
8851
9038
 
8852
- function getFirstChild(element) {
8853
- return element.firstChild;
8854
- }
9039
+ function getFirstElementChild(element) {
9040
+ return element.firstElementChild;
9041
+ }
8855
9042
 
8856
- function getFirstElementChild(element) {
8857
- return element.firstElementChild;
8858
- }
9043
+ function getLastChild(element) {
9044
+ return element.lastChild;
9045
+ }
8859
9046
 
8860
- function getLastChild(element) {
8861
- return element.lastChild;
8862
- }
9047
+ function getLastElementChild(element) {
9048
+ return element.lastElementChild;
9049
+ }
8863
9050
 
8864
- function getLastElementChild(element) {
8865
- return element.lastElementChild;
8866
- }
9051
+ function isConnected(node) {
9052
+ return node.isConnected;
9053
+ }
8867
9054
 
8868
- function isConnected(node) {
8869
- return node.isConnected;
8870
- }
9055
+ function assertInstanceOfHTMLElement(elm, msg) {
9056
+ assert.invariant(elm instanceof HTMLElement, msg);
9057
+ }
8871
9058
 
8872
- function assertInstanceOfHTMLElement(elm, msg) {
8873
- assertInvariant(elm instanceof HTMLElement, msg);
8874
- }
9059
+ var HTMLElementExported = HTMLElementConstructor;
9060
+ exports.HTMLElementExported = HTMLElementExported;
9061
+ exports.addEventListener = addEventListener;
9062
+ exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
9063
+ exports.attachShadow = attachShadow;
9064
+ exports.cloneNode = cloneNode;
9065
+ exports.createComment = createComment;
9066
+ exports.createElement = createElement;
9067
+ exports.createText = createText;
9068
+ exports.dispatchEvent = dispatchEvent;
9069
+ exports.getAttribute = getAttribute;
9070
+ exports.getBoundingClientRect = getBoundingClientRect;
9071
+ exports.getChildNodes = getChildNodes;
9072
+ exports.getChildren = getChildren;
9073
+ exports.getClassList = getClassList;
9074
+ exports.getElementsByClassName = getElementsByClassName;
9075
+ exports.getElementsByTagName = getElementsByTagName;
9076
+ exports.getFirstChild = getFirstChild;
9077
+ exports.getFirstElementChild = getFirstElementChild;
9078
+ exports.getLastChild = getLastChild;
9079
+ exports.getLastElementChild = getLastElementChild;
9080
+ exports.getProperty = getProperty;
9081
+ exports.insert = insert;
9082
+ exports.isConnected = isConnected;
9083
+ exports.nextSibling = nextSibling;
9084
+ exports.querySelector = querySelector;
9085
+ exports.querySelectorAll = querySelectorAll;
9086
+ exports.remove = remove;
9087
+ exports.removeAttribute = removeAttribute;
9088
+ exports.removeEventListener = removeEventListener;
9089
+ exports.setAttribute = setAttribute;
9090
+ exports.setCSSStyleProperty = setCSSStyleProperty;
9091
+ exports.setProperty = setProperty;
9092
+ exports.setText = setText;
9093
+ return exports;
9094
+ }({}); // Meant to inherit any properties passed via the base renderer as the argument to the factory.
8875
9095
 
8876
- var HTMLElementExported = HTMLElementConstructor;
8877
- var renderer = {
8878
- HTMLElementExported: HTMLElementExported,
8879
- insert: insert,
8880
- remove: remove,
8881
- cloneNode: cloneNode,
8882
- createFragment: createFragment,
8883
- createElement: createElement,
8884
- createText: createText,
8885
- createComment: createComment,
8886
- nextSibling: nextSibling,
8887
- attachShadow: attachShadow,
8888
- getProperty: getProperty,
8889
- setProperty: setProperty,
8890
- setText: setText,
8891
- getAttribute: getAttribute,
8892
- setAttribute: setAttribute,
8893
- removeAttribute: removeAttribute,
8894
- addEventListener: addEventListener,
8895
- removeEventListener: removeEventListener,
8896
- dispatchEvent: dispatchEvent,
8897
- getClassList: getClassList,
8898
- setCSSStyleProperty: setCSSStyleProperty,
8899
- getBoundingClientRect: getBoundingClientRect,
8900
- querySelector: querySelector,
8901
- querySelectorAll: querySelectorAll,
8902
- getElementsByTagName: getElementsByTagName,
8903
- getElementsByClassName: getElementsByClassName,
8904
- getChildren: getChildren,
8905
- getChildNodes: getChildNodes,
8906
- getFirstChild: getFirstChild,
8907
- getFirstElementChild: getFirstElementChild,
8908
- getLastChild: getLastChild,
8909
- getLastElementChild: getLastElementChild,
8910
- isConnected: isConnected,
8911
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
8912
- defineCustomElement: defineCustomElement,
8913
- getCustomElement: getCustomElement
8914
- }; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
8915
9096
 
8916
9097
  Object.setPrototypeOf(renderer, baseRenderer);
8917
9098
  return renderer;
@@ -9299,7 +9480,7 @@
9299
9480
  });
9300
9481
  freeze(LightningElement);
9301
9482
  seal(LightningElement.prototype);
9302
- /* version: 2.23.5 */
9483
+ /* version: 2.24.0 */
9303
9484
 
9304
9485
  exports.LightningElement = LightningElement;
9305
9486
  exports.__unstable__ProfilerControl = profilerControl;