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
@@ -43,7 +43,7 @@ var assert = /*#__PURE__*/Object.freeze({
43
43
  */
44
44
  const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
45
45
  const { isArray: isArray$1 } = Array;
46
- 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;
46
+ 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;
47
47
  const { fromCharCode: StringFromCharCode } = String;
48
48
  const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
49
49
  function isUndefined$1(obj) {
@@ -298,9 +298,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
298
298
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
299
299
  */
300
300
  // Increment whenever the LWC template compiler changes
301
- const LWC_VERSION = "2.13.3";
301
+ const LWC_VERSION = "2.13.4";
302
302
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
303
- /** version: 2.13.3 */
303
+ /** version: 2.13.4 */
304
304
 
305
305
  /*
306
306
  * Copyright (c) 2018, salesforce.com, inc.
@@ -390,6 +390,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
390
390
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
391
391
  */
392
392
  const features = {
393
+ DUMMY_TEST_FLAG: null,
393
394
  ENABLE_ELEMENT_PATCH: null,
394
395
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
395
396
  ENABLE_HMR: null,
@@ -453,10 +454,35 @@ function setFeatureFlagForTest(name, value) {
453
454
  setFeatureFlag(name, value);
454
455
  }
455
456
  }
456
- /** version: 2.13.3 */
457
+ /** version: 2.13.4 */
457
458
 
458
459
  /* proxy-compat-disable */
459
460
 
461
+ /*
462
+ * Copyright (c) 2018, salesforce.com, inc.
463
+ * All rights reserved.
464
+ * SPDX-License-Identifier: MIT
465
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
466
+ */
467
+ // @ts-ignore
468
+
469
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
470
+ window.addEventListener('test-dummy-flag', () => {
471
+ let hasFlag = false;
472
+
473
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
474
+ hasFlag = true;
475
+ }
476
+
477
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
478
+ detail: {
479
+ package: '@lwc/engine-core',
480
+ hasFlag
481
+ }
482
+ }));
483
+ });
484
+ }
485
+
460
486
  /*
461
487
  * Copyright (c) 2018, salesforce.com, inc.
462
488
  * All rights reserved.
@@ -557,10 +583,6 @@ let HTMLElementExported$1;
557
583
  function setHTMLElement(HTMLElementImpl) {
558
584
  HTMLElementExported$1 = HTMLElementImpl;
559
585
  }
560
- let isHydrating$1;
561
- function setIsHydrating$1(isHydratingImpl) {
562
- isHydrating$1 = isHydratingImpl;
563
- }
564
586
  let insert$1;
565
587
  function setInsert(insertImpl) {
566
588
  insert$1 = insertImpl;
@@ -681,10 +703,6 @@ let isConnected$1;
681
703
  function setIsConnected(isConnectedImpl) {
682
704
  isConnected$1 = isConnectedImpl;
683
705
  }
684
- let insertGlobalStylesheet$1;
685
- function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
686
- insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
687
- }
688
706
  let insertStylesheet$1;
689
707
  function setInsertStylesheet(insertStylesheetImpl) {
690
708
  insertStylesheet$1 = insertStylesheetImpl;
@@ -2800,6 +2818,8 @@ function registerTemplate(tpl) {
2800
2818
  // on top of stylesheetToken for anyone who is accessing the old internal API.
2801
2819
  // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2802
2820
  defineProperty(tpl, 'stylesheetTokens', {
2821
+ enumerable: true,
2822
+ configurable: true,
2803
2823
  get() {
2804
2824
  const { stylesheetToken } = this;
2805
2825
  if (isUndefined$1(stylesheetToken)) {
@@ -3883,15 +3903,16 @@ function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
3883
3903
  }
3884
3904
  }
3885
3905
  function unmount(vnode, parent, doRemove = false) {
3886
- const { type, elm } = vnode;
3906
+ const { type, elm, sel } = vnode;
3887
3907
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3888
3908
  // subtree root, is the only element worth unmounting from the subtree.
3889
3909
  if (doRemove) {
3890
3910
  removeNode(elm, parent);
3891
3911
  }
3912
+ const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3892
3913
  switch (type) {
3893
3914
  case 2 /* Element */:
3894
- unmountVNodes(vnode.children, elm);
3915
+ unmountVNodes(vnode.children, elm, removeChildren);
3895
3916
  break;
3896
3917
  case 3 /* CustomElement */: {
3897
3918
  const { vm } = vnode;
@@ -4809,10 +4830,10 @@ function createStylesheet(vm, stylesheets) {
4809
4830
  const { renderMode, shadowMode } = vm;
4810
4831
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4811
4832
  for (let i = 0; i < stylesheets.length; i++) {
4812
- insertGlobalStylesheet$1(stylesheets[i]);
4833
+ insertStylesheet$1(stylesheets[i]);
4813
4834
  }
4814
4835
  }
4815
- else if (ssr$1 || isHydrating$1()) {
4836
+ else if (ssr$1 || vm.hydrated) {
4816
4837
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4817
4838
  // This works in the client, because the stylesheets are created, and cached in the VM
4818
4839
  // the first time the VM renders.
@@ -4823,15 +4844,10 @@ function createStylesheet(vm, stylesheets) {
4823
4844
  else {
4824
4845
  // native shadow or light DOM, DOM renderer
4825
4846
  const root = getNearestNativeShadowComponent(vm);
4826
- const isGlobal = isNull(root);
4847
+ // null root means a global style
4848
+ const target = isNull(root) ? undefined : root.shadowRoot;
4827
4849
  for (let i = 0; i < stylesheets.length; i++) {
4828
- if (isGlobal) {
4829
- insertGlobalStylesheet$1(stylesheets[i]);
4830
- }
4831
- else {
4832
- // local level
4833
- insertStylesheet$1(stylesheets[i], root.shadowRoot);
4834
- }
4850
+ insertStylesheet$1(stylesheets[i], target);
4835
4851
  }
4836
4852
  }
4837
4853
  return null;
@@ -5379,7 +5395,8 @@ function createVM(elm, ctor, options) {
5379
5395
  const {
5380
5396
  mode,
5381
5397
  owner,
5382
- tagName
5398
+ tagName,
5399
+ hydrated
5383
5400
  } = options;
5384
5401
  const def = getComponentInternalDef(ctor);
5385
5402
  const vm = {
@@ -5402,6 +5419,7 @@ function createVM(elm, ctor, options) {
5402
5419
  cmpSlots: create(null),
5403
5420
  oar: create(null),
5404
5421
  cmpTemplate: null,
5422
+ hydrated: Boolean(hydrated),
5405
5423
  renderMode: def.renderMode,
5406
5424
  shadowMode: computeShadowMode(def, owner),
5407
5425
  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,
@@ -6376,6 +6394,7 @@ function hydrateCustomElement(elm, vnode) {
6376
6394
  mode,
6377
6395
  owner,
6378
6396
  tagName: sel,
6397
+ hydrated: true,
6379
6398
  });
6380
6399
  vnode.elm = elm;
6381
6400
  vnode.vm = vm;
@@ -6570,6 +6589,105 @@ function setHooks(hooks) {
6570
6589
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6571
6590
  }
6572
6591
 
6592
+ /*
6593
+ * Copyright (c) 2018, salesforce.com, inc.
6594
+ * All rights reserved.
6595
+ * SPDX-License-Identifier: MIT
6596
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6597
+ */
6598
+ // See @lwc/engine-core/src/framework/template.ts
6599
+ const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
6600
+ // Via https://www.npmjs.com/package/object-observer
6601
+ const ARRAY_MUTATION_METHODS = [
6602
+ 'pop',
6603
+ 'push',
6604
+ 'shift',
6605
+ 'unshift',
6606
+ 'reverse',
6607
+ 'sort',
6608
+ 'fill',
6609
+ 'splice',
6610
+ 'copyWithin',
6611
+ ];
6612
+ function getOriginalArrayMethod(prop) {
6613
+ switch (prop) {
6614
+ case 'pop':
6615
+ return ArrayPop;
6616
+ case 'push':
6617
+ return ArrayPush$1;
6618
+ case 'shift':
6619
+ return ArrayShift;
6620
+ case 'unshift':
6621
+ return ArrayUnshift;
6622
+ case 'reverse':
6623
+ return ArrayReverse;
6624
+ case 'sort':
6625
+ return ArraySort;
6626
+ case 'fill':
6627
+ return ArrayFill;
6628
+ case 'splice':
6629
+ return ArraySplice;
6630
+ case 'copyWithin':
6631
+ return ArrayCopyWithin;
6632
+ }
6633
+ }
6634
+ let mutationWarningsSilenced = false;
6635
+ // Warn if the user tries to mutate tmpl.stylesheets, e.g.:
6636
+ // `tmpl.stylesheets.push(someStylesheetFunction)`
6637
+ function warnOnArrayMutation(stylesheets) {
6638
+ // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
6639
+ // we can at least warn when they use the most common mutation methods.
6640
+ for (const prop of ARRAY_MUTATION_METHODS) {
6641
+ const originalArrayMethod = getOriginalArrayMethod(prop);
6642
+ stylesheets[prop] = function arrayMutationWarningWrapper() {
6643
+ logError(`Mutating the "stylesheets" array on a template function ` +
6644
+ `is deprecated and may be removed in a future version of LWC.`);
6645
+ // @ts-ignore
6646
+ return originalArrayMethod.apply(this, arguments);
6647
+ };
6648
+ }
6649
+ }
6650
+ // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
6651
+ // just warns on mutation.
6652
+ function freezeTemplate(tmpl) {
6653
+ if (process.env.NODE_ENV !== 'production') {
6654
+ if (!isUndefined$1(tmpl.stylesheets)) {
6655
+ warnOnArrayMutation(tmpl.stylesheets);
6656
+ }
6657
+ for (const prop of TEMPLATE_PROPS) {
6658
+ let value = tmpl[prop];
6659
+ defineProperty(tmpl, prop, {
6660
+ enumerable: true,
6661
+ configurable: true,
6662
+ get() {
6663
+ return value;
6664
+ },
6665
+ set(newValue) {
6666
+ if (!mutationWarningsSilenced) {
6667
+ logError(`Dynamically setting the "${prop}" property on a template function ` +
6668
+ `is deprecated and may be removed in a future version of LWC.`);
6669
+ }
6670
+ value = newValue;
6671
+ },
6672
+ });
6673
+ }
6674
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
6675
+ defineProperty(tmpl, 'stylesheetTokens', {
6676
+ enumerable: true,
6677
+ configurable: true,
6678
+ get: originalDescriptor.get,
6679
+ set(value) {
6680
+ logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
6681
+ `is deprecated and may be removed in a future version of LWC.`);
6682
+ // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
6683
+ mutationWarningsSilenced = true;
6684
+ originalDescriptor.set.call(this, value);
6685
+ mutationWarningsSilenced = false;
6686
+ },
6687
+ });
6688
+ }
6689
+ }
6690
+
6573
6691
  /*
6574
6692
  * Copyright (c) 2018, salesforce.com, inc.
6575
6693
  * All rights reserved.
@@ -6592,7 +6710,7 @@ function getComponentConstructor(elm) {
6592
6710
  }
6593
6711
  return ctor;
6594
6712
  }
6595
- /* version: 2.13.3 */
6713
+ /* version: 2.13.4 */
6596
6714
 
6597
6715
  /*
6598
6716
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6600,25 +6718,147 @@ function getComponentConstructor(elm) {
6600
6718
  * SPDX-License-Identifier: MIT
6601
6719
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6602
6720
  */
6603
- const globalStylesheets = create(null);
6721
+ //
6722
+ // Feature detection
6723
+ //
6724
+ // This check for constructable style sheets is similar to Fast's:
6725
+ // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6726
+ // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6727
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6728
+ // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
6729
+ // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
6730
+ // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
6731
+ // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
6732
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
6733
+ getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6734
+ // Detect IE, via https://stackoverflow.com/a/9851769
6735
+ const isIE11 = !isUndefined$1(document.documentMode);
6736
+ const stylesheetCache = new Map();
6737
+ //
6738
+ // Test utilities
6739
+ //
6604
6740
  if (process.env.NODE_ENV === 'development') {
6605
6741
  // @ts-ignore
6606
6742
  window.__lwcResetGlobalStylesheets = () => {
6607
- for (const key of Object.keys(globalStylesheets)) {
6608
- delete globalStylesheets[key];
6609
- }
6743
+ stylesheetCache.clear();
6610
6744
  };
6611
6745
  }
6612
- const globalStylesheetsParentElement = document.head || document.body || document;
6613
- // This check for constructable stylesheets is similar to Fast's:
6614
- // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
6615
- // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
6616
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
6617
- const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets &&
6618
- getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
6619
- const styleElements = create(null);
6620
- const styleSheets = create(null);
6621
- const shadowRootsToStyleSheets = new WeakMap();
6746
+ function isDocument(target) {
6747
+ return !isUndefined$1(target.head);
6748
+ }
6749
+ function createFreshStyleElement(content) {
6750
+ const elm = document.createElement('style');
6751
+ elm.type = 'text/css';
6752
+ elm.textContent = content;
6753
+ return elm;
6754
+ }
6755
+ function createStyleElement(content, cacheData) {
6756
+ const { stylesheet, used } = cacheData;
6757
+ // If the <style> was already used, then we should clone it. We cannot insert
6758
+ // the same <style> in two places in the DOM.
6759
+ if (used) {
6760
+ // For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
6761
+ // and will render the incorrect styles if we do things that way. It's just
6762
+ // a perf optimization, so we can skip it for IE11.
6763
+ if (isIE11) {
6764
+ return createFreshStyleElement(content);
6765
+ }
6766
+ // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6767
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
6768
+ return stylesheet.cloneNode(true);
6769
+ }
6770
+ // We don't clone every time, because that would be a perf tax on the first time
6771
+ cacheData.used = true;
6772
+ return stylesheet;
6773
+ }
6774
+ function createConstructableStylesheet(content) {
6775
+ const stylesheet = new CSSStyleSheet();
6776
+ stylesheet.replaceSync(content);
6777
+ return stylesheet;
6778
+ }
6779
+ function insertConstructableStylesheet(content, target, cacheData) {
6780
+ const { adoptedStyleSheets } = target;
6781
+ const { stylesheet } = cacheData;
6782
+ // Mutable adopted stylesheets are only supported in certain browsers.
6783
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
6784
+ if (supportsMutableAdoptedStyleSheets) {
6785
+ adoptedStyleSheets.push(stylesheet);
6786
+ }
6787
+ else {
6788
+ target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
6789
+ }
6790
+ }
6791
+ function insertStyleElement(content, target, cacheData) {
6792
+ const elm = createStyleElement(content, cacheData);
6793
+ const targetAnchorPoint = isDocument(target) ? target.head : target;
6794
+ targetAnchorPoint.appendChild(elm);
6795
+ }
6796
+ function doInsertStylesheet(content, target, cacheData) {
6797
+ // Constructable stylesheets are only supported in certain browsers:
6798
+ // https://caniuse.com/mdn-api_document_adoptedstylesheets
6799
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
6800
+ if (supportsConstructableStylesheets) {
6801
+ insertConstructableStylesheet(content, target, cacheData);
6802
+ }
6803
+ else {
6804
+ // Fall back to <style> element
6805
+ insertStyleElement(content, target, cacheData);
6806
+ }
6807
+ }
6808
+ function getCacheData(content) {
6809
+ let cacheData = stylesheetCache.get(content);
6810
+ if (isUndefined$1(cacheData)) {
6811
+ cacheData = {
6812
+ stylesheet: supportsConstructableStylesheets
6813
+ ? createConstructableStylesheet(content)
6814
+ : createFreshStyleElement(content),
6815
+ roots: undefined,
6816
+ global: false,
6817
+ used: false,
6818
+ };
6819
+ stylesheetCache.set(content, cacheData);
6820
+ }
6821
+ return cacheData;
6822
+ }
6823
+ function insertGlobalStylesheet(content) {
6824
+ const cacheData = getCacheData(content);
6825
+ if (cacheData.global) {
6826
+ // already inserted
6827
+ return;
6828
+ }
6829
+ cacheData.global = true; // mark inserted
6830
+ doInsertStylesheet(content, document, cacheData);
6831
+ }
6832
+ function insertLocalStylesheet(content, target) {
6833
+ const cacheData = getCacheData(content);
6834
+ let { roots } = cacheData;
6835
+ if (isUndefined$1(roots)) {
6836
+ roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
6837
+ }
6838
+ else if (roots.has(target)) {
6839
+ // already inserted
6840
+ return;
6841
+ }
6842
+ roots.add(target); // mark inserted
6843
+ doInsertStylesheet(content, target, cacheData);
6844
+ }
6845
+ function insertStylesheet(content, target) {
6846
+ if (isUndefined$1(target)) {
6847
+ // global
6848
+ insertGlobalStylesheet(content);
6849
+ }
6850
+ else {
6851
+ // local
6852
+ insertLocalStylesheet(content, target);
6853
+ }
6854
+ }
6855
+
6856
+ /*
6857
+ * Copyright (c) 2018, salesforce.com, inc.
6858
+ * All rights reserved.
6859
+ * SPDX-License-Identifier: MIT
6860
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6861
+ */
6622
6862
  let getCustomElement;
6623
6863
  let defineCustomElement;
6624
6864
  let HTMLElementConstructor;
@@ -6645,52 +6885,6 @@ function isCustomElementRegistryAvailable() {
6645
6885
  return false;
6646
6886
  }
6647
6887
  }
6648
- function insertConstructableStyleSheet(content, target) {
6649
- // It's important for CSSStyleSheets to be unique based on their content, so that
6650
- // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
6651
- let styleSheet = styleSheets[content];
6652
- if (isUndefined$1(styleSheet)) {
6653
- styleSheet = new CSSStyleSheet();
6654
- styleSheet.replaceSync(content);
6655
- styleSheets[content] = styleSheet;
6656
- }
6657
- const { adoptedStyleSheets } = target;
6658
- if (!adoptedStyleSheets.includes(styleSheet)) {
6659
- if (supportsMutableAdoptedStyleSheets) {
6660
- // This is only supported in later versions of Chromium:
6661
- // https://chromestatus.com/feature/5638996492288000
6662
- adoptedStyleSheets.push(styleSheet);
6663
- }
6664
- else {
6665
- target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
6666
- }
6667
- }
6668
- }
6669
- function insertStyleElement(content, target) {
6670
- // Avoid inserting duplicate `<style>`s
6671
- let sheets = shadowRootsToStyleSheets.get(target);
6672
- if (isUndefined$1(sheets)) {
6673
- sheets = create(null);
6674
- shadowRootsToStyleSheets.set(target, sheets);
6675
- }
6676
- if (sheets[content]) {
6677
- return;
6678
- }
6679
- sheets[content] = true;
6680
- // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
6681
- // faster to call `cloneNode()` on an existing node than to recreate it every time.
6682
- let elm = styleElements[content];
6683
- if (isUndefined$1(elm)) {
6684
- elm = document.createElement('style');
6685
- elm.type = 'text/css';
6686
- elm.textContent = content;
6687
- styleElements[content] = elm;
6688
- }
6689
- else {
6690
- elm = elm.cloneNode(true);
6691
- }
6692
- target.appendChild(elm);
6693
- }
6694
6888
  if (isCustomElementRegistryAvailable()) {
6695
6889
  getCustomElement = customElements.get.bind(customElements);
6696
6890
  defineCustomElement = customElements.define.bind(customElements);
@@ -6729,9 +6923,6 @@ function setIsHydrating(value) {
6729
6923
  hydrating = value;
6730
6924
  }
6731
6925
  const ssr = false;
6732
- function isHydrating() {
6733
- return hydrating;
6734
- }
6735
6926
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6736
6927
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6737
6928
  function createElement$1(tagName, namespace) {
@@ -6846,25 +7037,6 @@ function getLastElementChild(element) {
6846
7037
  function isConnected(node) {
6847
7038
  return node.isConnected;
6848
7039
  }
6849
- function insertGlobalStylesheet(content) {
6850
- if (!isUndefined$1(globalStylesheets[content])) {
6851
- return;
6852
- }
6853
- globalStylesheets[content] = true;
6854
- const elm = document.createElement('style');
6855
- elm.type = 'text/css';
6856
- elm.textContent = content;
6857
- globalStylesheetsParentElement.appendChild(elm);
6858
- }
6859
- function insertStylesheet(content, target) {
6860
- if (supportsConstructableStyleSheets) {
6861
- insertConstructableStyleSheet(content, target);
6862
- }
6863
- else {
6864
- // Fall back to <style> element
6865
- insertStyleElement(content, target);
6866
- }
6867
- }
6868
7040
  function assertInstanceOfHTMLElement(elm, msg) {
6869
7041
  assert.invariant(elm instanceof HTMLElement, msg);
6870
7042
  }
@@ -6898,10 +7070,7 @@ setGetLastElementChild(getLastElementChild);
6898
7070
  setGetProperty(getProperty);
6899
7071
  setHTMLElement(HTMLElementExported);
6900
7072
  setInsert(insert);
6901
- setInsertGlobalStylesheet(insertGlobalStylesheet);
6902
- setInsertStylesheet(insertStylesheet);
6903
7073
  setIsConnected(isConnected);
6904
- setIsHydrating$1(isHydrating);
6905
7074
  setIsNativeShadowDefined(isNativeShadowDefined);
6906
7075
  setIsSyntheticShadowDefined(isSyntheticShadowDefined);
6907
7076
  setNextSibling(nextSibling);
@@ -6916,6 +7085,32 @@ setSetProperty(setProperty);
6916
7085
  setSetText(setText);
6917
7086
  setSsr(ssr);
6918
7087
  setAddEventListener(addEventListener);
7088
+ setInsertStylesheet(insertStylesheet);
7089
+
7090
+ /*
7091
+ * Copyright (c) 2018, salesforce.com, inc.
7092
+ * All rights reserved.
7093
+ * SPDX-License-Identifier: MIT
7094
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7095
+ */
7096
+ // @ts-ignore
7097
+
7098
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7099
+ window.addEventListener('test-dummy-flag', () => {
7100
+ let hasFlag = false;
7101
+
7102
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
7103
+ hasFlag = true;
7104
+ }
7105
+
7106
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
7107
+ detail: {
7108
+ package: '@lwc/engine-dom',
7109
+ hasFlag
7110
+ }
7111
+ }));
7112
+ });
7113
+ }
6919
7114
 
6920
7115
  /*
6921
7116
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6941,6 +7136,7 @@ function createVMWithProps(element, Ctor, props) {
6941
7136
  mode: 'open',
6942
7137
  owner: null,
6943
7138
  tagName: element.tagName.toLowerCase(),
7139
+ hydrated: true,
6944
7140
  });
6945
7141
  for (const [key, value] of Object.entries(props)) {
6946
7142
  element[key] = value;
@@ -7211,6 +7407,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
7211
7407
  });
7212
7408
  freeze(LightningElement);
7213
7409
  seal(LightningElement.prototype);
7214
- /* version: 2.13.3 */
7410
+ /* version: 2.13.4 */
7215
7411
 
7216
- export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7412
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };