lwc 2.13.2 → 2.14.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 (43) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +339 -113
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +339 -112
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +185 -107
  5. package/dist/engine-dom/iife/es5/engine-dom.js +7560 -5747
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +5942 -4572
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +339 -112
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +185 -107
  11. package/dist/engine-dom/umd/es5/engine-dom.js +7560 -5747
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +5942 -4572
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +176 -36
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +176 -37
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +10 -13
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4601 -3603
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +10 -1
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4424 -3481
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -4
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +10 -13
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +4601 -3603
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +10 -1
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +4424 -3481
  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.min.js +1 -1
  33. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service.js +243 -258
  35. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  36. package/dist/wire-service/iife/es5/wire-service_debug.js +243 -258
  37. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  39. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  40. package/dist/wire-service/umd/es5/wire-service.js +243 -258
  41. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  42. package/dist/wire-service/umd/es5/wire-service_debug.js +243 -258
  43. package/package.json +7 -7
@@ -46,7 +46,7 @@ var LWC = (function (exports) {
46
46
  */
47
47
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
48
48
  const { isArray: isArray$1 } = Array;
49
- const { filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, slice: ArraySlice, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
49
+ const { copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
50
50
  const { fromCharCode: StringFromCharCode } = String;
51
51
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
52
52
  function isUndefined$1(obj) {
@@ -301,9 +301,9 @@ var LWC = (function (exports) {
301
301
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
302
302
  */
303
303
  // Increment whenever the LWC template compiler changes
304
- const LWC_VERSION = "2.13.2";
304
+ const LWC_VERSION = "2.14.0";
305
305
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
306
- /** version: 2.13.2 */
306
+ /** version: 2.14.0 */
307
307
 
308
308
  /*
309
309
  * Copyright (c) 2018, salesforce.com, inc.
@@ -393,6 +393,7 @@ var LWC = (function (exports) {
393
393
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
394
394
  */
395
395
  const features = {
396
+ DUMMY_TEST_FLAG: null,
396
397
  ENABLE_ELEMENT_PATCH: null,
397
398
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
398
399
  ENABLE_HMR: null,
@@ -456,10 +457,35 @@ var LWC = (function (exports) {
456
457
  setFeatureFlag(name, value);
457
458
  }
458
459
  }
459
- /** version: 2.13.2 */
460
+ /** version: 2.14.0 */
460
461
 
461
462
  /* proxy-compat-disable */
462
463
 
464
+ /*
465
+ * Copyright (c) 2018, salesforce.com, inc.
466
+ * All rights reserved.
467
+ * SPDX-License-Identifier: MIT
468
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
469
+ */
470
+ // @ts-ignore
471
+
472
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
473
+ window.addEventListener('test-dummy-flag', () => {
474
+ let hasFlag = false;
475
+
476
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
477
+ hasFlag = true;
478
+ }
479
+
480
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
481
+ detail: {
482
+ package: '@lwc/engine-core',
483
+ hasFlag
484
+ }
485
+ }));
486
+ });
487
+ }
488
+
463
489
  /*
464
490
  * Copyright (c) 2018, salesforce.com, inc.
465
491
  * All rights reserved.
@@ -560,10 +586,6 @@ var LWC = (function (exports) {
560
586
  function setHTMLElement(HTMLElementImpl) {
561
587
  HTMLElementExported$1 = HTMLElementImpl;
562
588
  }
563
- let isHydrating$1;
564
- function setIsHydrating$1(isHydratingImpl) {
565
- isHydrating$1 = isHydratingImpl;
566
- }
567
589
  let insert$1;
568
590
  function setInsert(insertImpl) {
569
591
  insert$1 = insertImpl;
@@ -684,10 +706,6 @@ var LWC = (function (exports) {
684
706
  function setIsConnected(isConnectedImpl) {
685
707
  isConnected$1 = isConnectedImpl;
686
708
  }
687
- let insertGlobalStylesheet$1;
688
- function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
689
- insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
690
- }
691
709
  let insertStylesheet$1;
692
710
  function setInsertStylesheet(insertStylesheetImpl) {
693
711
  insertStylesheet$1 = insertStylesheetImpl;
@@ -2775,6 +2793,12 @@ var LWC = (function (exports) {
2775
2793
  }
2776
2794
  }
2777
2795
 
2796
+ /*
2797
+ * Copyright (c) 2018, salesforce.com, inc.
2798
+ * All rights reserved.
2799
+ * SPDX-License-Identifier: MIT
2800
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2801
+ */
2778
2802
  const signedTemplateSet = new Set();
2779
2803
  function defaultEmptyTemplate() {
2780
2804
  return [];
@@ -2792,6 +2816,32 @@ var LWC = (function (exports) {
2792
2816
  checkVersionMismatch(tpl, 'template');
2793
2817
  }
2794
2818
  signedTemplateSet.add(tpl);
2819
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2820
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2821
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2822
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2823
+ defineProperty(tpl, 'stylesheetTokens', {
2824
+ enumerable: true,
2825
+ configurable: true,
2826
+ get() {
2827
+ const { stylesheetToken } = this;
2828
+ if (isUndefined$1(stylesheetToken)) {
2829
+ return stylesheetToken;
2830
+ }
2831
+ // Shim for the old `stylesheetTokens` property
2832
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2833
+ return {
2834
+ hostAttribute: `${stylesheetToken}-host`,
2835
+ shadowAttribute: stylesheetToken,
2836
+ };
2837
+ },
2838
+ set(value) {
2839
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2840
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2841
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2842
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2843
+ },
2844
+ });
2795
2845
  // chaining this method as a way to wrap existing
2796
2846
  // assignment of templates easily, without too much transformation
2797
2847
  return tpl;
@@ -3856,15 +3906,16 @@ var LWC = (function (exports) {
3856
3906
  }
3857
3907
  }
3858
3908
  function unmount(vnode, parent, doRemove = false) {
3859
- const { type, elm } = vnode;
3909
+ const { type, elm, sel } = vnode;
3860
3910
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3861
3911
  // subtree root, is the only element worth unmounting from the subtree.
3862
3912
  if (doRemove) {
3863
3913
  removeNode(elm, parent);
3864
3914
  }
3915
+ const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3865
3916
  switch (type) {
3866
3917
  case 2 /* Element */:
3867
- unmountVNodes(vnode.children, elm);
3918
+ unmountVNodes(vnode.children, elm, removeChildren);
3868
3919
  break;
3869
3920
  case 3 /* CustomElement */: {
3870
3921
  const { vm } = vnode;
@@ -4782,10 +4833,10 @@ var LWC = (function (exports) {
4782
4833
  const { renderMode, shadowMode } = vm;
4783
4834
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4784
4835
  for (let i = 0; i < stylesheets.length; i++) {
4785
- insertGlobalStylesheet$1(stylesheets[i]);
4836
+ insertStylesheet$1(stylesheets[i]);
4786
4837
  }
4787
4838
  }
4788
- else if (ssr$1 || isHydrating$1()) {
4839
+ else if (ssr$1 || vm.hydrated) {
4789
4840
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4790
4841
  // This works in the client, because the stylesheets are created, and cached in the VM
4791
4842
  // the first time the VM renders.
@@ -4796,15 +4847,10 @@ var LWC = (function (exports) {
4796
4847
  else {
4797
4848
  // native shadow or light DOM, DOM renderer
4798
4849
  const root = getNearestNativeShadowComponent(vm);
4799
- const isGlobal = isNull(root);
4850
+ // null root means a global style
4851
+ const target = isNull(root) ? undefined : root.shadowRoot;
4800
4852
  for (let i = 0; i < stylesheets.length; i++) {
4801
- if (isGlobal) {
4802
- insertGlobalStylesheet$1(stylesheets[i]);
4803
- }
4804
- else {
4805
- // local level
4806
- insertStylesheet$1(stylesheets[i], root.shadowRoot);
4807
- }
4853
+ insertStylesheet$1(stylesheets[i], target);
4808
4854
  }
4809
4855
  }
4810
4856
  return null;
@@ -5352,7 +5398,8 @@ var LWC = (function (exports) {
5352
5398
  const {
5353
5399
  mode,
5354
5400
  owner,
5355
- tagName
5401
+ tagName,
5402
+ hydrated
5356
5403
  } = options;
5357
5404
  const def = getComponentInternalDef(ctor);
5358
5405
  const vm = {
@@ -5375,6 +5422,7 @@ var LWC = (function (exports) {
5375
5422
  cmpSlots: create(null),
5376
5423
  oar: create(null),
5377
5424
  cmpTemplate: null,
5425
+ hydrated: Boolean(hydrated),
5378
5426
  renderMode: def.renderMode,
5379
5427
  shadowMode: computeShadowMode(def, owner),
5380
5428
  nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
@@ -6349,6 +6397,7 @@ var LWC = (function (exports) {
6349
6397
  mode,
6350
6398
  owner,
6351
6399
  tagName: sel,
6400
+ hydrated: true,
6352
6401
  });
6353
6402
  vnode.elm = elm;
6354
6403
  vnode.vm = vm;
@@ -6543,6 +6592,105 @@ var LWC = (function (exports) {
6543
6592
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6544
6593
  }
6545
6594
 
6595
+ /*
6596
+ * Copyright (c) 2018, salesforce.com, inc.
6597
+ * All rights reserved.
6598
+ * SPDX-License-Identifier: MIT
6599
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6600
+ */
6601
+ // See @lwc/engine-core/src/framework/template.ts
6602
+ const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
6603
+ // Via https://www.npmjs.com/package/object-observer
6604
+ const ARRAY_MUTATION_METHODS = [
6605
+ 'pop',
6606
+ 'push',
6607
+ 'shift',
6608
+ 'unshift',
6609
+ 'reverse',
6610
+ 'sort',
6611
+ 'fill',
6612
+ 'splice',
6613
+ 'copyWithin',
6614
+ ];
6615
+ function getOriginalArrayMethod(prop) {
6616
+ switch (prop) {
6617
+ case 'pop':
6618
+ return ArrayPop;
6619
+ case 'push':
6620
+ return ArrayPush$1;
6621
+ case 'shift':
6622
+ return ArrayShift;
6623
+ case 'unshift':
6624
+ return ArrayUnshift;
6625
+ case 'reverse':
6626
+ return ArrayReverse;
6627
+ case 'sort':
6628
+ return ArraySort;
6629
+ case 'fill':
6630
+ return ArrayFill;
6631
+ case 'splice':
6632
+ return ArraySplice;
6633
+ case 'copyWithin':
6634
+ return ArrayCopyWithin;
6635
+ }
6636
+ }
6637
+ let mutationWarningsSilenced = false;
6638
+ // Warn if the user tries to mutate tmpl.stylesheets, e.g.:
6639
+ // `tmpl.stylesheets.push(someStylesheetFunction)`
6640
+ function warnOnArrayMutation(stylesheets) {
6641
+ // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
6642
+ // we can at least warn when they use the most common mutation methods.
6643
+ for (const prop of ARRAY_MUTATION_METHODS) {
6644
+ const originalArrayMethod = getOriginalArrayMethod(prop);
6645
+ stylesheets[prop] = function arrayMutationWarningWrapper() {
6646
+ logError(`Mutating the "stylesheets" array on a template function ` +
6647
+ `is deprecated and may be removed in a future version of LWC.`);
6648
+ // @ts-ignore
6649
+ return originalArrayMethod.apply(this, arguments);
6650
+ };
6651
+ }
6652
+ }
6653
+ // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
6654
+ // just warns on mutation.
6655
+ function freezeTemplate(tmpl) {
6656
+ if (process.env.NODE_ENV !== 'production') {
6657
+ if (!isUndefined$1(tmpl.stylesheets)) {
6658
+ warnOnArrayMutation(tmpl.stylesheets);
6659
+ }
6660
+ for (const prop of TEMPLATE_PROPS) {
6661
+ let value = tmpl[prop];
6662
+ defineProperty(tmpl, prop, {
6663
+ enumerable: true,
6664
+ configurable: true,
6665
+ get() {
6666
+ return value;
6667
+ },
6668
+ set(newValue) {
6669
+ if (!mutationWarningsSilenced) {
6670
+ logError(`Dynamically setting the "${prop}" property on a template function ` +
6671
+ `is deprecated and may be removed in a future version of LWC.`);
6672
+ }
6673
+ value = newValue;
6674
+ },
6675
+ });
6676
+ }
6677
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
6678
+ defineProperty(tmpl, 'stylesheetTokens', {
6679
+ enumerable: true,
6680
+ configurable: true,
6681
+ get: originalDescriptor.get,
6682
+ set(value) {
6683
+ logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
6684
+ `is deprecated and may be removed in a future version of LWC.`);
6685
+ // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
6686
+ mutationWarningsSilenced = true;
6687
+ originalDescriptor.set.call(this, value);
6688
+ mutationWarningsSilenced = false;
6689
+ },
6690
+ });
6691
+ }
6692
+ }
6693
+
6546
6694
  /*
6547
6695
  * Copyright (c) 2018, salesforce.com, inc.
6548
6696
  * All rights reserved.
@@ -6565,7 +6713,7 @@ var LWC = (function (exports) {
6565
6713
  }
6566
6714
  return ctor;
6567
6715
  }
6568
- /* version: 2.13.2 */
6716
+ /* version: 2.14.0 */
6569
6717
 
6570
6718
  /*
6571
6719
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6573,25 +6721,147 @@ var LWC = (function (exports) {
6573
6721
  * SPDX-License-Identifier: MIT
6574
6722
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6575
6723
  */
6576
- const globalStylesheets = create(null);
6724
+ //
6725
+ // Feature detection
6726
+ //
6727
+ // This check for constructable style sheets is similar to Fast's:
6728
+ // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6729
+ // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6730
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6731
+ // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
6732
+ // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
6733
+ // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
6734
+ // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
6735
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
6736
+ getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6737
+ // Detect IE, via https://stackoverflow.com/a/9851769
6738
+ const isIE11 = !isUndefined$1(document.documentMode);
6739
+ const stylesheetCache = new Map();
6740
+ //
6741
+ // Test utilities
6742
+ //
6577
6743
  if (process.env.NODE_ENV === 'development') {
6578
6744
  // @ts-ignore
6579
6745
  window.__lwcResetGlobalStylesheets = () => {
6580
- for (const key of Object.keys(globalStylesheets)) {
6581
- delete globalStylesheets[key];
6582
- }
6746
+ stylesheetCache.clear();
6583
6747
  };
6584
6748
  }
6585
- const globalStylesheetsParentElement = document.head || document.body || document;
6586
- // This check for constructable stylesheets is similar to Fast's:
6587
- // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6588
- // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6589
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6590
- const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets &&
6591
- getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6592
- const styleElements = create(null);
6593
- const styleSheets = create(null);
6594
- const shadowRootsToStyleSheets = new WeakMap();
6749
+ function isDocument(target) {
6750
+ return !isUndefined$1(target.head);
6751
+ }
6752
+ function createFreshStyleElement(content) {
6753
+ const elm = document.createElement('style');
6754
+ elm.type = 'text/css';
6755
+ elm.textContent = content;
6756
+ return elm;
6757
+ }
6758
+ function createStyleElement(content, cacheData) {
6759
+ const { stylesheet, used } = cacheData;
6760
+ // If the <style> was already used, then we should clone it. We cannot insert
6761
+ // the same <style> in two places in the DOM.
6762
+ if (used) {
6763
+ // For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
6764
+ // and will render the incorrect styles if we do things that way. It's just
6765
+ // a perf optimization, so we can skip it for IE11.
6766
+ if (isIE11) {
6767
+ return createFreshStyleElement(content);
6768
+ }
6769
+ // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6770
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
6771
+ return stylesheet.cloneNode(true);
6772
+ }
6773
+ // We don't clone every time, because that would be a perf tax on the first time
6774
+ cacheData.used = true;
6775
+ return stylesheet;
6776
+ }
6777
+ function createConstructableStylesheet(content) {
6778
+ const stylesheet = new CSSStyleSheet();
6779
+ stylesheet.replaceSync(content);
6780
+ return stylesheet;
6781
+ }
6782
+ function insertConstructableStylesheet(content, target, cacheData) {
6783
+ const { adoptedStyleSheets } = target;
6784
+ const { stylesheet } = cacheData;
6785
+ // Mutable adopted stylesheets are only supported in certain browsers.
6786
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
6787
+ if (supportsMutableAdoptedStyleSheets) {
6788
+ adoptedStyleSheets.push(stylesheet);
6789
+ }
6790
+ else {
6791
+ target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
6792
+ }
6793
+ }
6794
+ function insertStyleElement(content, target, cacheData) {
6795
+ const elm = createStyleElement(content, cacheData);
6796
+ const targetAnchorPoint = isDocument(target) ? target.head : target;
6797
+ targetAnchorPoint.appendChild(elm);
6798
+ }
6799
+ function doInsertStylesheet(content, target, cacheData) {
6800
+ // Constructable stylesheets are only supported in certain browsers:
6801
+ // https://caniuse.com/mdn-api_document_adoptedstylesheets
6802
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
6803
+ if (supportsConstructableStylesheets) {
6804
+ insertConstructableStylesheet(content, target, cacheData);
6805
+ }
6806
+ else {
6807
+ // Fall back to <style> element
6808
+ insertStyleElement(content, target, cacheData);
6809
+ }
6810
+ }
6811
+ function getCacheData(content) {
6812
+ let cacheData = stylesheetCache.get(content);
6813
+ if (isUndefined$1(cacheData)) {
6814
+ cacheData = {
6815
+ stylesheet: supportsConstructableStylesheets
6816
+ ? createConstructableStylesheet(content)
6817
+ : createFreshStyleElement(content),
6818
+ roots: undefined,
6819
+ global: false,
6820
+ used: false,
6821
+ };
6822
+ stylesheetCache.set(content, cacheData);
6823
+ }
6824
+ return cacheData;
6825
+ }
6826
+ function insertGlobalStylesheet(content) {
6827
+ const cacheData = getCacheData(content);
6828
+ if (cacheData.global) {
6829
+ // already inserted
6830
+ return;
6831
+ }
6832
+ cacheData.global = true; // mark inserted
6833
+ doInsertStylesheet(content, document, cacheData);
6834
+ }
6835
+ function insertLocalStylesheet(content, target) {
6836
+ const cacheData = getCacheData(content);
6837
+ let { roots } = cacheData;
6838
+ if (isUndefined$1(roots)) {
6839
+ roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
6840
+ }
6841
+ else if (roots.has(target)) {
6842
+ // already inserted
6843
+ return;
6844
+ }
6845
+ roots.add(target); // mark inserted
6846
+ doInsertStylesheet(content, target, cacheData);
6847
+ }
6848
+ function insertStylesheet(content, target) {
6849
+ if (isUndefined$1(target)) {
6850
+ // global
6851
+ insertGlobalStylesheet(content);
6852
+ }
6853
+ else {
6854
+ // local
6855
+ insertLocalStylesheet(content, target);
6856
+ }
6857
+ }
6858
+
6859
+ /*
6860
+ * Copyright (c) 2018, salesforce.com, inc.
6861
+ * All rights reserved.
6862
+ * SPDX-License-Identifier: MIT
6863
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6864
+ */
6595
6865
  let getCustomElement;
6596
6866
  let defineCustomElement;
6597
6867
  let HTMLElementConstructor;
@@ -6618,52 +6888,6 @@ var LWC = (function (exports) {
6618
6888
  return false;
6619
6889
  }
6620
6890
  }
6621
- function insertConstructableStyleSheet(content, target) {
6622
- // It's important for CSSStyleSheets to be unique based on their content, so that
6623
- // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
6624
- let styleSheet = styleSheets[content];
6625
- if (isUndefined$1(styleSheet)) {
6626
- styleSheet = new CSSStyleSheet();
6627
- styleSheet.replaceSync(content);
6628
- styleSheets[content] = styleSheet;
6629
- }
6630
- const { adoptedStyleSheets } = target;
6631
- if (!adoptedStyleSheets.includes(styleSheet)) {
6632
- if (supportsMutableAdoptedStyleSheets) {
6633
- // This is only supported in later versions of Chromium:
6634
- // https://chromestatus.com/feature/5638996492288000
6635
- adoptedStyleSheets.push(styleSheet);
6636
- }
6637
- else {
6638
- target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
6639
- }
6640
- }
6641
- }
6642
- function insertStyleElement(content, target) {
6643
- // Avoid inserting duplicate `<style>`s
6644
- let sheets = shadowRootsToStyleSheets.get(target);
6645
- if (isUndefined$1(sheets)) {
6646
- sheets = create(null);
6647
- shadowRootsToStyleSheets.set(target, sheets);
6648
- }
6649
- if (sheets[content]) {
6650
- return;
6651
- }
6652
- sheets[content] = true;
6653
- // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6654
- // faster to call `cloneNode()` on an existing node than to recreate it every time.
6655
- let elm = styleElements[content];
6656
- if (isUndefined$1(elm)) {
6657
- elm = document.createElement('style');
6658
- elm.type = 'text/css';
6659
- elm.textContent = content;
6660
- styleElements[content] = elm;
6661
- }
6662
- else {
6663
- elm = elm.cloneNode(true);
6664
- }
6665
- target.appendChild(elm);
6666
- }
6667
6891
  if (isCustomElementRegistryAvailable()) {
6668
6892
  getCustomElement = customElements.get.bind(customElements);
6669
6893
  defineCustomElement = customElements.define.bind(customElements);
@@ -6702,9 +6926,6 @@ var LWC = (function (exports) {
6702
6926
  hydrating = value;
6703
6927
  }
6704
6928
  const ssr = false;
6705
- function isHydrating() {
6706
- return hydrating;
6707
- }
6708
6929
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6709
6930
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6710
6931
  function createElement$1(tagName, namespace) {
@@ -6819,25 +7040,6 @@ var LWC = (function (exports) {
6819
7040
  function isConnected(node) {
6820
7041
  return node.isConnected;
6821
7042
  }
6822
- function insertGlobalStylesheet(content) {
6823
- if (!isUndefined$1(globalStylesheets[content])) {
6824
- return;
6825
- }
6826
- globalStylesheets[content] = true;
6827
- const elm = document.createElement('style');
6828
- elm.type = 'text/css';
6829
- elm.textContent = content;
6830
- globalStylesheetsParentElement.appendChild(elm);
6831
- }
6832
- function insertStylesheet(content, target) {
6833
- if (supportsConstructableStyleSheets) {
6834
- insertConstructableStyleSheet(content, target);
6835
- }
6836
- else {
6837
- // Fall back to <style> element
6838
- insertStyleElement(content, target);
6839
- }
6840
- }
6841
7043
  function assertInstanceOfHTMLElement(elm, msg) {
6842
7044
  assert.invariant(elm instanceof HTMLElement, msg);
6843
7045
  }
@@ -6871,10 +7073,7 @@ var LWC = (function (exports) {
6871
7073
  setGetProperty(getProperty);
6872
7074
  setHTMLElement(HTMLElementExported);
6873
7075
  setInsert(insert);
6874
- setInsertGlobalStylesheet(insertGlobalStylesheet);
6875
- setInsertStylesheet(insertStylesheet);
6876
7076
  setIsConnected(isConnected);
6877
- setIsHydrating$1(isHydrating);
6878
7077
  setIsNativeShadowDefined(isNativeShadowDefined);
6879
7078
  setIsSyntheticShadowDefined(isSyntheticShadowDefined);
6880
7079
  setNextSibling(nextSibling);
@@ -6889,6 +7088,32 @@ var LWC = (function (exports) {
6889
7088
  setSetText(setText);
6890
7089
  setSsr(ssr);
6891
7090
  setAddEventListener(addEventListener);
7091
+ setInsertStylesheet(insertStylesheet);
7092
+
7093
+ /*
7094
+ * Copyright (c) 2018, salesforce.com, inc.
7095
+ * All rights reserved.
7096
+ * SPDX-License-Identifier: MIT
7097
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7098
+ */
7099
+ // @ts-ignore
7100
+
7101
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7102
+ window.addEventListener('test-dummy-flag', () => {
7103
+ let hasFlag = false;
7104
+
7105
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
7106
+ hasFlag = true;
7107
+ }
7108
+
7109
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
7110
+ detail: {
7111
+ package: '@lwc/engine-dom',
7112
+ hasFlag
7113
+ }
7114
+ }));
7115
+ });
7116
+ }
6892
7117
 
6893
7118
  /*
6894
7119
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6914,6 +7139,7 @@ var LWC = (function (exports) {
6914
7139
  mode: 'open',
6915
7140
  owner: null,
6916
7141
  tagName: element.tagName.toLowerCase(),
7142
+ hydrated: true,
6917
7143
  });
6918
7144
  for (const [key, value] of Object.entries(props)) {
6919
7145
  element[key] = value;
@@ -7184,7 +7410,7 @@ var LWC = (function (exports) {
7184
7410
  });
7185
7411
  freeze(LightningElement);
7186
7412
  seal(LightningElement.prototype);
7187
- /* version: 2.13.2 */
7413
+ /* version: 2.14.0 */
7188
7414
 
7189
7415
  exports.LightningElement = LightningElement;
7190
7416
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7192,6 +7418,7 @@ var LWC = (function (exports) {
7192
7418
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
7193
7419
  exports.createContextProvider = createContextProvider;
7194
7420
  exports.createElement = createElement;
7421
+ exports.freezeTemplate = freezeTemplate;
7195
7422
  exports.getComponentConstructor = getComponentConstructor;
7196
7423
  exports.getComponentDef = getComponentDef;
7197
7424
  exports.hydrateComponent = hydrateComponent;