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
@@ -49,7 +49,7 @@
49
49
  */
50
50
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
51
51
  const { isArray: isArray$1 } = Array;
52
- 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;
52
+ 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;
53
53
  const { fromCharCode: StringFromCharCode } = String;
54
54
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
55
55
  function isUndefined$1(obj) {
@@ -304,9 +304,9 @@
304
304
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
305
305
  */
306
306
  // Increment whenever the LWC template compiler changes
307
- const LWC_VERSION = "2.13.3";
307
+ const LWC_VERSION = "2.13.4";
308
308
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
309
- /** version: 2.13.3 */
309
+ /** version: 2.13.4 */
310
310
 
311
311
  /*
312
312
  * Copyright (c) 2018, salesforce.com, inc.
@@ -396,6 +396,7 @@
396
396
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
397
397
  */
398
398
  const features = {
399
+ DUMMY_TEST_FLAG: null,
399
400
  ENABLE_ELEMENT_PATCH: null,
400
401
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
401
402
  ENABLE_HMR: null,
@@ -459,10 +460,35 @@
459
460
  setFeatureFlag(name, value);
460
461
  }
461
462
  }
462
- /** version: 2.13.3 */
463
+ /** version: 2.13.4 */
463
464
 
464
465
  /* proxy-compat-disable */
465
466
 
467
+ /*
468
+ * Copyright (c) 2018, salesforce.com, inc.
469
+ * All rights reserved.
470
+ * SPDX-License-Identifier: MIT
471
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
472
+ */
473
+ // @ts-ignore
474
+
475
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
476
+ window.addEventListener('test-dummy-flag', () => {
477
+ let hasFlag = false;
478
+
479
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
480
+ hasFlag = true;
481
+ }
482
+
483
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
484
+ detail: {
485
+ package: '@lwc/engine-core',
486
+ hasFlag
487
+ }
488
+ }));
489
+ });
490
+ }
491
+
466
492
  /*
467
493
  * Copyright (c) 2018, salesforce.com, inc.
468
494
  * All rights reserved.
@@ -563,10 +589,6 @@
563
589
  function setHTMLElement(HTMLElementImpl) {
564
590
  HTMLElementExported$1 = HTMLElementImpl;
565
591
  }
566
- let isHydrating$1;
567
- function setIsHydrating$1(isHydratingImpl) {
568
- isHydrating$1 = isHydratingImpl;
569
- }
570
592
  let insert$1;
571
593
  function setInsert(insertImpl) {
572
594
  insert$1 = insertImpl;
@@ -687,10 +709,6 @@
687
709
  function setIsConnected(isConnectedImpl) {
688
710
  isConnected$1 = isConnectedImpl;
689
711
  }
690
- let insertGlobalStylesheet$1;
691
- function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
692
- insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
693
- }
694
712
  let insertStylesheet$1;
695
713
  function setInsertStylesheet(insertStylesheetImpl) {
696
714
  insertStylesheet$1 = insertStylesheetImpl;
@@ -2806,6 +2824,8 @@
2806
2824
  // on top of stylesheetToken for anyone who is accessing the old internal API.
2807
2825
  // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2808
2826
  defineProperty(tpl, 'stylesheetTokens', {
2827
+ enumerable: true,
2828
+ configurable: true,
2809
2829
  get() {
2810
2830
  const { stylesheetToken } = this;
2811
2831
  if (isUndefined$1(stylesheetToken)) {
@@ -3889,15 +3909,16 @@
3889
3909
  }
3890
3910
  }
3891
3911
  function unmount(vnode, parent, doRemove = false) {
3892
- const { type, elm } = vnode;
3912
+ const { type, elm, sel } = vnode;
3893
3913
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3894
3914
  // subtree root, is the only element worth unmounting from the subtree.
3895
3915
  if (doRemove) {
3896
3916
  removeNode(elm, parent);
3897
3917
  }
3918
+ const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3898
3919
  switch (type) {
3899
3920
  case 2 /* Element */:
3900
- unmountVNodes(vnode.children, elm);
3921
+ unmountVNodes(vnode.children, elm, removeChildren);
3901
3922
  break;
3902
3923
  case 3 /* CustomElement */: {
3903
3924
  const { vm } = vnode;
@@ -4815,10 +4836,10 @@
4815
4836
  const { renderMode, shadowMode } = vm;
4816
4837
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4817
4838
  for (let i = 0; i < stylesheets.length; i++) {
4818
- insertGlobalStylesheet$1(stylesheets[i]);
4839
+ insertStylesheet$1(stylesheets[i]);
4819
4840
  }
4820
4841
  }
4821
- else if (ssr$1 || isHydrating$1()) {
4842
+ else if (ssr$1 || vm.hydrated) {
4822
4843
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4823
4844
  // This works in the client, because the stylesheets are created, and cached in the VM
4824
4845
  // the first time the VM renders.
@@ -4829,15 +4850,10 @@
4829
4850
  else {
4830
4851
  // native shadow or light DOM, DOM renderer
4831
4852
  const root = getNearestNativeShadowComponent(vm);
4832
- const isGlobal = isNull(root);
4853
+ // null root means a global style
4854
+ const target = isNull(root) ? undefined : root.shadowRoot;
4833
4855
  for (let i = 0; i < stylesheets.length; i++) {
4834
- if (isGlobal) {
4835
- insertGlobalStylesheet$1(stylesheets[i]);
4836
- }
4837
- else {
4838
- // local level
4839
- insertStylesheet$1(stylesheets[i], root.shadowRoot);
4840
- }
4856
+ insertStylesheet$1(stylesheets[i], target);
4841
4857
  }
4842
4858
  }
4843
4859
  return null;
@@ -5385,7 +5401,8 @@
5385
5401
  const {
5386
5402
  mode,
5387
5403
  owner,
5388
- tagName
5404
+ tagName,
5405
+ hydrated
5389
5406
  } = options;
5390
5407
  const def = getComponentInternalDef(ctor);
5391
5408
  const vm = {
@@ -5408,6 +5425,7 @@
5408
5425
  cmpSlots: create(null),
5409
5426
  oar: create(null),
5410
5427
  cmpTemplate: null,
5428
+ hydrated: Boolean(hydrated),
5411
5429
  renderMode: def.renderMode,
5412
5430
  shadowMode: computeShadowMode(def, owner),
5413
5431
  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,
@@ -6382,6 +6400,7 @@
6382
6400
  mode,
6383
6401
  owner,
6384
6402
  tagName: sel,
6403
+ hydrated: true,
6385
6404
  });
6386
6405
  vnode.elm = elm;
6387
6406
  vnode.vm = vm;
@@ -6576,6 +6595,105 @@
6576
6595
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6577
6596
  }
6578
6597
 
6598
+ /*
6599
+ * Copyright (c) 2018, salesforce.com, inc.
6600
+ * All rights reserved.
6601
+ * SPDX-License-Identifier: MIT
6602
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6603
+ */
6604
+ // See @lwc/engine-core/src/framework/template.ts
6605
+ const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
6606
+ // Via https://www.npmjs.com/package/object-observer
6607
+ const ARRAY_MUTATION_METHODS = [
6608
+ 'pop',
6609
+ 'push',
6610
+ 'shift',
6611
+ 'unshift',
6612
+ 'reverse',
6613
+ 'sort',
6614
+ 'fill',
6615
+ 'splice',
6616
+ 'copyWithin',
6617
+ ];
6618
+ function getOriginalArrayMethod(prop) {
6619
+ switch (prop) {
6620
+ case 'pop':
6621
+ return ArrayPop;
6622
+ case 'push':
6623
+ return ArrayPush$1;
6624
+ case 'shift':
6625
+ return ArrayShift;
6626
+ case 'unshift':
6627
+ return ArrayUnshift;
6628
+ case 'reverse':
6629
+ return ArrayReverse;
6630
+ case 'sort':
6631
+ return ArraySort;
6632
+ case 'fill':
6633
+ return ArrayFill;
6634
+ case 'splice':
6635
+ return ArraySplice;
6636
+ case 'copyWithin':
6637
+ return ArrayCopyWithin;
6638
+ }
6639
+ }
6640
+ let mutationWarningsSilenced = false;
6641
+ // Warn if the user tries to mutate tmpl.stylesheets, e.g.:
6642
+ // `tmpl.stylesheets.push(someStylesheetFunction)`
6643
+ function warnOnArrayMutation(stylesheets) {
6644
+ // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
6645
+ // we can at least warn when they use the most common mutation methods.
6646
+ for (const prop of ARRAY_MUTATION_METHODS) {
6647
+ const originalArrayMethod = getOriginalArrayMethod(prop);
6648
+ stylesheets[prop] = function arrayMutationWarningWrapper() {
6649
+ logError(`Mutating the "stylesheets" array on a template function ` +
6650
+ `is deprecated and may be removed in a future version of LWC.`);
6651
+ // @ts-ignore
6652
+ return originalArrayMethod.apply(this, arguments);
6653
+ };
6654
+ }
6655
+ }
6656
+ // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
6657
+ // just warns on mutation.
6658
+ function freezeTemplate(tmpl) {
6659
+ if (process.env.NODE_ENV !== 'production') {
6660
+ if (!isUndefined$1(tmpl.stylesheets)) {
6661
+ warnOnArrayMutation(tmpl.stylesheets);
6662
+ }
6663
+ for (const prop of TEMPLATE_PROPS) {
6664
+ let value = tmpl[prop];
6665
+ defineProperty(tmpl, prop, {
6666
+ enumerable: true,
6667
+ configurable: true,
6668
+ get() {
6669
+ return value;
6670
+ },
6671
+ set(newValue) {
6672
+ if (!mutationWarningsSilenced) {
6673
+ logError(`Dynamically setting the "${prop}" property on a template function ` +
6674
+ `is deprecated and may be removed in a future version of LWC.`);
6675
+ }
6676
+ value = newValue;
6677
+ },
6678
+ });
6679
+ }
6680
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
6681
+ defineProperty(tmpl, 'stylesheetTokens', {
6682
+ enumerable: true,
6683
+ configurable: true,
6684
+ get: originalDescriptor.get,
6685
+ set(value) {
6686
+ logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
6687
+ `is deprecated and may be removed in a future version of LWC.`);
6688
+ // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
6689
+ mutationWarningsSilenced = true;
6690
+ originalDescriptor.set.call(this, value);
6691
+ mutationWarningsSilenced = false;
6692
+ },
6693
+ });
6694
+ }
6695
+ }
6696
+
6579
6697
  /*
6580
6698
  * Copyright (c) 2018, salesforce.com, inc.
6581
6699
  * All rights reserved.
@@ -6598,7 +6716,7 @@
6598
6716
  }
6599
6717
  return ctor;
6600
6718
  }
6601
- /* version: 2.13.3 */
6719
+ /* version: 2.13.4 */
6602
6720
 
6603
6721
  /*
6604
6722
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6606,25 +6724,147 @@
6606
6724
  * SPDX-License-Identifier: MIT
6607
6725
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6608
6726
  */
6609
- const globalStylesheets = create(null);
6727
+ //
6728
+ // Feature detection
6729
+ //
6730
+ // This check for constructable style sheets is similar to Fast's:
6731
+ // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6732
+ // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6733
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6734
+ // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
6735
+ // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
6736
+ // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
6737
+ // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
6738
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
6739
+ getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6740
+ // Detect IE, via https://stackoverflow.com/a/9851769
6741
+ const isIE11 = !isUndefined$1(document.documentMode);
6742
+ const stylesheetCache = new Map();
6743
+ //
6744
+ // Test utilities
6745
+ //
6610
6746
  if (process.env.NODE_ENV === 'development') {
6611
6747
  // @ts-ignore
6612
6748
  window.__lwcResetGlobalStylesheets = () => {
6613
- for (const key of Object.keys(globalStylesheets)) {
6614
- delete globalStylesheets[key];
6615
- }
6749
+ stylesheetCache.clear();
6616
6750
  };
6617
6751
  }
6618
- const globalStylesheetsParentElement = document.head || document.body || document;
6619
- // This check for constructable stylesheets is similar to Fast's:
6620
- // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6621
- // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6622
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6623
- const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets &&
6624
- getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6625
- const styleElements = create(null);
6626
- const styleSheets = create(null);
6627
- const shadowRootsToStyleSheets = new WeakMap();
6752
+ function isDocument(target) {
6753
+ return !isUndefined$1(target.head);
6754
+ }
6755
+ function createFreshStyleElement(content) {
6756
+ const elm = document.createElement('style');
6757
+ elm.type = 'text/css';
6758
+ elm.textContent = content;
6759
+ return elm;
6760
+ }
6761
+ function createStyleElement(content, cacheData) {
6762
+ const { stylesheet, used } = cacheData;
6763
+ // If the <style> was already used, then we should clone it. We cannot insert
6764
+ // the same <style> in two places in the DOM.
6765
+ if (used) {
6766
+ // For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
6767
+ // and will render the incorrect styles if we do things that way. It's just
6768
+ // a perf optimization, so we can skip it for IE11.
6769
+ if (isIE11) {
6770
+ return createFreshStyleElement(content);
6771
+ }
6772
+ // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6773
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
6774
+ return stylesheet.cloneNode(true);
6775
+ }
6776
+ // We don't clone every time, because that would be a perf tax on the first time
6777
+ cacheData.used = true;
6778
+ return stylesheet;
6779
+ }
6780
+ function createConstructableStylesheet(content) {
6781
+ const stylesheet = new CSSStyleSheet();
6782
+ stylesheet.replaceSync(content);
6783
+ return stylesheet;
6784
+ }
6785
+ function insertConstructableStylesheet(content, target, cacheData) {
6786
+ const { adoptedStyleSheets } = target;
6787
+ const { stylesheet } = cacheData;
6788
+ // Mutable adopted stylesheets are only supported in certain browsers.
6789
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
6790
+ if (supportsMutableAdoptedStyleSheets) {
6791
+ adoptedStyleSheets.push(stylesheet);
6792
+ }
6793
+ else {
6794
+ target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
6795
+ }
6796
+ }
6797
+ function insertStyleElement(content, target, cacheData) {
6798
+ const elm = createStyleElement(content, cacheData);
6799
+ const targetAnchorPoint = isDocument(target) ? target.head : target;
6800
+ targetAnchorPoint.appendChild(elm);
6801
+ }
6802
+ function doInsertStylesheet(content, target, cacheData) {
6803
+ // Constructable stylesheets are only supported in certain browsers:
6804
+ // https://caniuse.com/mdn-api_document_adoptedstylesheets
6805
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
6806
+ if (supportsConstructableStylesheets) {
6807
+ insertConstructableStylesheet(content, target, cacheData);
6808
+ }
6809
+ else {
6810
+ // Fall back to <style> element
6811
+ insertStyleElement(content, target, cacheData);
6812
+ }
6813
+ }
6814
+ function getCacheData(content) {
6815
+ let cacheData = stylesheetCache.get(content);
6816
+ if (isUndefined$1(cacheData)) {
6817
+ cacheData = {
6818
+ stylesheet: supportsConstructableStylesheets
6819
+ ? createConstructableStylesheet(content)
6820
+ : createFreshStyleElement(content),
6821
+ roots: undefined,
6822
+ global: false,
6823
+ used: false,
6824
+ };
6825
+ stylesheetCache.set(content, cacheData);
6826
+ }
6827
+ return cacheData;
6828
+ }
6829
+ function insertGlobalStylesheet(content) {
6830
+ const cacheData = getCacheData(content);
6831
+ if (cacheData.global) {
6832
+ // already inserted
6833
+ return;
6834
+ }
6835
+ cacheData.global = true; // mark inserted
6836
+ doInsertStylesheet(content, document, cacheData);
6837
+ }
6838
+ function insertLocalStylesheet(content, target) {
6839
+ const cacheData = getCacheData(content);
6840
+ let { roots } = cacheData;
6841
+ if (isUndefined$1(roots)) {
6842
+ roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
6843
+ }
6844
+ else if (roots.has(target)) {
6845
+ // already inserted
6846
+ return;
6847
+ }
6848
+ roots.add(target); // mark inserted
6849
+ doInsertStylesheet(content, target, cacheData);
6850
+ }
6851
+ function insertStylesheet(content, target) {
6852
+ if (isUndefined$1(target)) {
6853
+ // global
6854
+ insertGlobalStylesheet(content);
6855
+ }
6856
+ else {
6857
+ // local
6858
+ insertLocalStylesheet(content, target);
6859
+ }
6860
+ }
6861
+
6862
+ /*
6863
+ * Copyright (c) 2018, salesforce.com, inc.
6864
+ * All rights reserved.
6865
+ * SPDX-License-Identifier: MIT
6866
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6867
+ */
6628
6868
  let getCustomElement;
6629
6869
  let defineCustomElement;
6630
6870
  let HTMLElementConstructor;
@@ -6651,52 +6891,6 @@
6651
6891
  return false;
6652
6892
  }
6653
6893
  }
6654
- function insertConstructableStyleSheet(content, target) {
6655
- // It's important for CSSStyleSheets to be unique based on their content, so that
6656
- // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
6657
- let styleSheet = styleSheets[content];
6658
- if (isUndefined$1(styleSheet)) {
6659
- styleSheet = new CSSStyleSheet();
6660
- styleSheet.replaceSync(content);
6661
- styleSheets[content] = styleSheet;
6662
- }
6663
- const { adoptedStyleSheets } = target;
6664
- if (!adoptedStyleSheets.includes(styleSheet)) {
6665
- if (supportsMutableAdoptedStyleSheets) {
6666
- // This is only supported in later versions of Chromium:
6667
- // https://chromestatus.com/feature/5638996492288000
6668
- adoptedStyleSheets.push(styleSheet);
6669
- }
6670
- else {
6671
- target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
6672
- }
6673
- }
6674
- }
6675
- function insertStyleElement(content, target) {
6676
- // Avoid inserting duplicate `<style>`s
6677
- let sheets = shadowRootsToStyleSheets.get(target);
6678
- if (isUndefined$1(sheets)) {
6679
- sheets = create(null);
6680
- shadowRootsToStyleSheets.set(target, sheets);
6681
- }
6682
- if (sheets[content]) {
6683
- return;
6684
- }
6685
- sheets[content] = true;
6686
- // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6687
- // faster to call `cloneNode()` on an existing node than to recreate it every time.
6688
- let elm = styleElements[content];
6689
- if (isUndefined$1(elm)) {
6690
- elm = document.createElement('style');
6691
- elm.type = 'text/css';
6692
- elm.textContent = content;
6693
- styleElements[content] = elm;
6694
- }
6695
- else {
6696
- elm = elm.cloneNode(true);
6697
- }
6698
- target.appendChild(elm);
6699
- }
6700
6894
  if (isCustomElementRegistryAvailable()) {
6701
6895
  getCustomElement = customElements.get.bind(customElements);
6702
6896
  defineCustomElement = customElements.define.bind(customElements);
@@ -6735,9 +6929,6 @@
6735
6929
  hydrating = value;
6736
6930
  }
6737
6931
  const ssr = false;
6738
- function isHydrating() {
6739
- return hydrating;
6740
- }
6741
6932
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6742
6933
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6743
6934
  function createElement$1(tagName, namespace) {
@@ -6852,25 +7043,6 @@
6852
7043
  function isConnected(node) {
6853
7044
  return node.isConnected;
6854
7045
  }
6855
- function insertGlobalStylesheet(content) {
6856
- if (!isUndefined$1(globalStylesheets[content])) {
6857
- return;
6858
- }
6859
- globalStylesheets[content] = true;
6860
- const elm = document.createElement('style');
6861
- elm.type = 'text/css';
6862
- elm.textContent = content;
6863
- globalStylesheetsParentElement.appendChild(elm);
6864
- }
6865
- function insertStylesheet(content, target) {
6866
- if (supportsConstructableStyleSheets) {
6867
- insertConstructableStyleSheet(content, target);
6868
- }
6869
- else {
6870
- // Fall back to <style> element
6871
- insertStyleElement(content, target);
6872
- }
6873
- }
6874
7046
  function assertInstanceOfHTMLElement(elm, msg) {
6875
7047
  assert.invariant(elm instanceof HTMLElement, msg);
6876
7048
  }
@@ -6904,10 +7076,7 @@
6904
7076
  setGetProperty(getProperty);
6905
7077
  setHTMLElement(HTMLElementExported);
6906
7078
  setInsert(insert);
6907
- setInsertGlobalStylesheet(insertGlobalStylesheet);
6908
- setInsertStylesheet(insertStylesheet);
6909
7079
  setIsConnected(isConnected);
6910
- setIsHydrating$1(isHydrating);
6911
7080
  setIsNativeShadowDefined(isNativeShadowDefined);
6912
7081
  setIsSyntheticShadowDefined(isSyntheticShadowDefined);
6913
7082
  setNextSibling(nextSibling);
@@ -6922,6 +7091,32 @@
6922
7091
  setSetText(setText);
6923
7092
  setSsr(ssr);
6924
7093
  setAddEventListener(addEventListener);
7094
+ setInsertStylesheet(insertStylesheet);
7095
+
7096
+ /*
7097
+ * Copyright (c) 2018, salesforce.com, inc.
7098
+ * All rights reserved.
7099
+ * SPDX-License-Identifier: MIT
7100
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7101
+ */
7102
+ // @ts-ignore
7103
+
7104
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7105
+ window.addEventListener('test-dummy-flag', () => {
7106
+ let hasFlag = false;
7107
+
7108
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
7109
+ hasFlag = true;
7110
+ }
7111
+
7112
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
7113
+ detail: {
7114
+ package: '@lwc/engine-dom',
7115
+ hasFlag
7116
+ }
7117
+ }));
7118
+ });
7119
+ }
6925
7120
 
6926
7121
  /*
6927
7122
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6947,6 +7142,7 @@
6947
7142
  mode: 'open',
6948
7143
  owner: null,
6949
7144
  tagName: element.tagName.toLowerCase(),
7145
+ hydrated: true,
6950
7146
  });
6951
7147
  for (const [key, value] of Object.entries(props)) {
6952
7148
  element[key] = value;
@@ -7217,7 +7413,7 @@
7217
7413
  });
7218
7414
  freeze(LightningElement);
7219
7415
  seal(LightningElement.prototype);
7220
- /* version: 2.13.3 */
7416
+ /* version: 2.13.4 */
7221
7417
 
7222
7418
  exports.LightningElement = LightningElement;
7223
7419
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7225,6 +7421,7 @@
7225
7421
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
7226
7422
  exports.createContextProvider = createContextProvider;
7227
7423
  exports.createElement = createElement;
7424
+ exports.freezeTemplate = freezeTemplate;
7228
7425
  exports.getComponentConstructor = getComponentConstructor;
7229
7426
  exports.getComponentDef = getComponentDef;
7230
7427
  exports.hydrateComponent = hydrateComponent;