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