lwc 2.13.3 → 2.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +309 -113
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +309 -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 +155 -107
  5. package/dist/engine-dom/iife/es5/engine-dom.js +7556 -5772
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +5938 -4597
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +309 -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 +155 -107
  11. package/dist/engine-dom/umd/es5/engine-dom.js +7556 -5772
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +5938 -4597
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +146 -36
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +146 -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.3";
304
+ const LWC_VERSION = "2.13.4";
305
305
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
306
- /** version: 2.13.3 */
306
+ /** version: 2.13.4 */
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.3 */
460
+ /** version: 2.13.4 */
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;
@@ -2803,6 +2821,8 @@ var LWC = (function (exports) {
2803
2821
  // on top of stylesheetToken for anyone who is accessing the old internal API.
2804
2822
  // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2805
2823
  defineProperty(tpl, 'stylesheetTokens', {
2824
+ enumerable: true,
2825
+ configurable: true,
2806
2826
  get() {
2807
2827
  const { stylesheetToken } = this;
2808
2828
  if (isUndefined$1(stylesheetToken)) {
@@ -3886,15 +3906,16 @@ var LWC = (function (exports) {
3886
3906
  }
3887
3907
  }
3888
3908
  function unmount(vnode, parent, doRemove = false) {
3889
- const { type, elm } = vnode;
3909
+ const { type, elm, sel } = vnode;
3890
3910
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3891
3911
  // subtree root, is the only element worth unmounting from the subtree.
3892
3912
  if (doRemove) {
3893
3913
  removeNode(elm, parent);
3894
3914
  }
3915
+ const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3895
3916
  switch (type) {
3896
3917
  case 2 /* Element */:
3897
- unmountVNodes(vnode.children, elm);
3918
+ unmountVNodes(vnode.children, elm, removeChildren);
3898
3919
  break;
3899
3920
  case 3 /* CustomElement */: {
3900
3921
  const { vm } = vnode;
@@ -4812,10 +4833,10 @@ var LWC = (function (exports) {
4812
4833
  const { renderMode, shadowMode } = vm;
4813
4834
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4814
4835
  for (let i = 0; i < stylesheets.length; i++) {
4815
- insertGlobalStylesheet$1(stylesheets[i]);
4836
+ insertStylesheet$1(stylesheets[i]);
4816
4837
  }
4817
4838
  }
4818
- else if (ssr$1 || isHydrating$1()) {
4839
+ else if (ssr$1 || vm.hydrated) {
4819
4840
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4820
4841
  // This works in the client, because the stylesheets are created, and cached in the VM
4821
4842
  // the first time the VM renders.
@@ -4826,15 +4847,10 @@ var LWC = (function (exports) {
4826
4847
  else {
4827
4848
  // native shadow or light DOM, DOM renderer
4828
4849
  const root = getNearestNativeShadowComponent(vm);
4829
- const isGlobal = isNull(root);
4850
+ // null root means a global style
4851
+ const target = isNull(root) ? undefined : root.shadowRoot;
4830
4852
  for (let i = 0; i < stylesheets.length; i++) {
4831
- if (isGlobal) {
4832
- insertGlobalStylesheet$1(stylesheets[i]);
4833
- }
4834
- else {
4835
- // local level
4836
- insertStylesheet$1(stylesheets[i], root.shadowRoot);
4837
- }
4853
+ insertStylesheet$1(stylesheets[i], target);
4838
4854
  }
4839
4855
  }
4840
4856
  return null;
@@ -5382,7 +5398,8 @@ var LWC = (function (exports) {
5382
5398
  const {
5383
5399
  mode,
5384
5400
  owner,
5385
- tagName
5401
+ tagName,
5402
+ hydrated
5386
5403
  } = options;
5387
5404
  const def = getComponentInternalDef(ctor);
5388
5405
  const vm = {
@@ -5405,6 +5422,7 @@ var LWC = (function (exports) {
5405
5422
  cmpSlots: create(null),
5406
5423
  oar: create(null),
5407
5424
  cmpTemplate: null,
5425
+ hydrated: Boolean(hydrated),
5408
5426
  renderMode: def.renderMode,
5409
5427
  shadowMode: computeShadowMode(def, owner),
5410
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,
@@ -6379,6 +6397,7 @@ var LWC = (function (exports) {
6379
6397
  mode,
6380
6398
  owner,
6381
6399
  tagName: sel,
6400
+ hydrated: true,
6382
6401
  });
6383
6402
  vnode.elm = elm;
6384
6403
  vnode.vm = vm;
@@ -6573,6 +6592,105 @@ var LWC = (function (exports) {
6573
6592
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6574
6593
  }
6575
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
+
6576
6694
  /*
6577
6695
  * Copyright (c) 2018, salesforce.com, inc.
6578
6696
  * All rights reserved.
@@ -6595,7 +6713,7 @@ var LWC = (function (exports) {
6595
6713
  }
6596
6714
  return ctor;
6597
6715
  }
6598
- /* version: 2.13.3 */
6716
+ /* version: 2.13.4 */
6599
6717
 
6600
6718
  /*
6601
6719
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6603,25 +6721,147 @@ var LWC = (function (exports) {
6603
6721
  * SPDX-License-Identifier: MIT
6604
6722
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6605
6723
  */
6606
- 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
+ //
6607
6743
  if (process.env.NODE_ENV === 'development') {
6608
6744
  // @ts-ignore
6609
6745
  window.__lwcResetGlobalStylesheets = () => {
6610
- for (const key of Object.keys(globalStylesheets)) {
6611
- delete globalStylesheets[key];
6612
- }
6746
+ stylesheetCache.clear();
6613
6747
  };
6614
6748
  }
6615
- const globalStylesheetsParentElement = document.head || document.body || document;
6616
- // This check for constructable stylesheets is similar to Fast's:
6617
- // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6618
- // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6619
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6620
- const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets &&
6621
- getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6622
- const styleElements = create(null);
6623
- const styleSheets = create(null);
6624
- 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
+ */
6625
6865
  let getCustomElement;
6626
6866
  let defineCustomElement;
6627
6867
  let HTMLElementConstructor;
@@ -6648,52 +6888,6 @@ var LWC = (function (exports) {
6648
6888
  return false;
6649
6889
  }
6650
6890
  }
6651
- function insertConstructableStyleSheet(content, target) {
6652
- // It's important for CSSStyleSheets to be unique based on their content, so that
6653
- // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
6654
- let styleSheet = styleSheets[content];
6655
- if (isUndefined$1(styleSheet)) {
6656
- styleSheet = new CSSStyleSheet();
6657
- styleSheet.replaceSync(content);
6658
- styleSheets[content] = styleSheet;
6659
- }
6660
- const { adoptedStyleSheets } = target;
6661
- if (!adoptedStyleSheets.includes(styleSheet)) {
6662
- if (supportsMutableAdoptedStyleSheets) {
6663
- // This is only supported in later versions of Chromium:
6664
- // https://chromestatus.com/feature/5638996492288000
6665
- adoptedStyleSheets.push(styleSheet);
6666
- }
6667
- else {
6668
- target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
6669
- }
6670
- }
6671
- }
6672
- function insertStyleElement(content, target) {
6673
- // Avoid inserting duplicate `<style>`s
6674
- let sheets = shadowRootsToStyleSheets.get(target);
6675
- if (isUndefined$1(sheets)) {
6676
- sheets = create(null);
6677
- shadowRootsToStyleSheets.set(target, sheets);
6678
- }
6679
- if (sheets[content]) {
6680
- return;
6681
- }
6682
- sheets[content] = true;
6683
- // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6684
- // faster to call `cloneNode()` on an existing node than to recreate it every time.
6685
- let elm = styleElements[content];
6686
- if (isUndefined$1(elm)) {
6687
- elm = document.createElement('style');
6688
- elm.type = 'text/css';
6689
- elm.textContent = content;
6690
- styleElements[content] = elm;
6691
- }
6692
- else {
6693
- elm = elm.cloneNode(true);
6694
- }
6695
- target.appendChild(elm);
6696
- }
6697
6891
  if (isCustomElementRegistryAvailable()) {
6698
6892
  getCustomElement = customElements.get.bind(customElements);
6699
6893
  defineCustomElement = customElements.define.bind(customElements);
@@ -6732,9 +6926,6 @@ var LWC = (function (exports) {
6732
6926
  hydrating = value;
6733
6927
  }
6734
6928
  const ssr = false;
6735
- function isHydrating() {
6736
- return hydrating;
6737
- }
6738
6929
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6739
6930
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6740
6931
  function createElement$1(tagName, namespace) {
@@ -6849,25 +7040,6 @@ var LWC = (function (exports) {
6849
7040
  function isConnected(node) {
6850
7041
  return node.isConnected;
6851
7042
  }
6852
- function insertGlobalStylesheet(content) {
6853
- if (!isUndefined$1(globalStylesheets[content])) {
6854
- return;
6855
- }
6856
- globalStylesheets[content] = true;
6857
- const elm = document.createElement('style');
6858
- elm.type = 'text/css';
6859
- elm.textContent = content;
6860
- globalStylesheetsParentElement.appendChild(elm);
6861
- }
6862
- function insertStylesheet(content, target) {
6863
- if (supportsConstructableStyleSheets) {
6864
- insertConstructableStyleSheet(content, target);
6865
- }
6866
- else {
6867
- // Fall back to <style> element
6868
- insertStyleElement(content, target);
6869
- }
6870
- }
6871
7043
  function assertInstanceOfHTMLElement(elm, msg) {
6872
7044
  assert.invariant(elm instanceof HTMLElement, msg);
6873
7045
  }
@@ -6901,10 +7073,7 @@ var LWC = (function (exports) {
6901
7073
  setGetProperty(getProperty);
6902
7074
  setHTMLElement(HTMLElementExported);
6903
7075
  setInsert(insert);
6904
- setInsertGlobalStylesheet(insertGlobalStylesheet);
6905
- setInsertStylesheet(insertStylesheet);
6906
7076
  setIsConnected(isConnected);
6907
- setIsHydrating$1(isHydrating);
6908
7077
  setIsNativeShadowDefined(isNativeShadowDefined);
6909
7078
  setIsSyntheticShadowDefined(isSyntheticShadowDefined);
6910
7079
  setNextSibling(nextSibling);
@@ -6919,6 +7088,32 @@ var LWC = (function (exports) {
6919
7088
  setSetText(setText);
6920
7089
  setSsr(ssr);
6921
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
+ }
6922
7117
 
6923
7118
  /*
6924
7119
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6944,6 +7139,7 @@ var LWC = (function (exports) {
6944
7139
  mode: 'open',
6945
7140
  owner: null,
6946
7141
  tagName: element.tagName.toLowerCase(),
7142
+ hydrated: true,
6947
7143
  });
6948
7144
  for (const [key, value] of Object.entries(props)) {
6949
7145
  element[key] = value;
@@ -7214,7 +7410,7 @@ var LWC = (function (exports) {
7214
7410
  });
7215
7411
  freeze(LightningElement);
7216
7412
  seal(LightningElement.prototype);
7217
- /* version: 2.13.3 */
7413
+ /* version: 2.13.4 */
7218
7414
 
7219
7415
  exports.LightningElement = LightningElement;
7220
7416
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7222,6 +7418,7 @@ var LWC = (function (exports) {
7222
7418
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
7223
7419
  exports.createContextProvider = createContextProvider;
7224
7420
  exports.createElement = createElement;
7421
+ exports.freezeTemplate = freezeTemplate;
7225
7422
  exports.getComponentConstructor = getComponentConstructor;
7226
7423
  exports.getComponentDef = getComponentDef;
7227
7424
  exports.hydrateComponent = hydrateComponent;