lwc 2.13.1 → 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 +376 -170
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +376 -169
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +222 -164
  5. package/dist/engine-dom/iife/es5/engine-dom.js +7562 -5758
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +5947 -4586
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +376 -169
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +222 -164
  11. package/dist/engine-dom/umd/es5/engine-dom.js +7562 -5758
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +5947 -4586
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +190 -72
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +190 -73
  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) {
@@ -290,7 +290,7 @@ var LWC = (function (exports) {
290
290
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
291
291
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
292
292
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
293
- /** version: 2.13.1 */
293
+ /** version: 2.13.4 */
294
294
 
295
295
  /*
296
296
  * Copyright (c) 2018, salesforce.com, inc.
@@ -380,6 +380,7 @@ var LWC = (function (exports) {
380
380
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
381
381
  */
382
382
  const features = {
383
+ DUMMY_TEST_FLAG: null,
383
384
  ENABLE_ELEMENT_PATCH: null,
384
385
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
385
386
  ENABLE_HMR: null,
@@ -433,9 +434,6 @@ var LWC = (function (exports) {
433
434
  */
434
435
  function setFeatureFlagForTest(name, value) {
435
436
  }
436
- /** version: 2.13.1 */
437
-
438
- /* proxy-compat-disable */
439
437
 
440
438
  /*
441
439
  * Copyright (c) 2018, salesforce.com, inc.
@@ -515,10 +513,6 @@ var LWC = (function (exports) {
515
513
  function setHTMLElement(HTMLElementImpl) {
516
514
  HTMLElementExported$1 = HTMLElementImpl;
517
515
  }
518
- let isHydrating$1;
519
- function setIsHydrating$1(isHydratingImpl) {
520
- isHydrating$1 = isHydratingImpl;
521
- }
522
516
  let insert$1;
523
517
  function setInsert(insertImpl) {
524
518
  insert$1 = insertImpl;
@@ -639,10 +633,6 @@ var LWC = (function (exports) {
639
633
  function setIsConnected(isConnectedImpl) {
640
634
  isConnected$1 = isConnectedImpl;
641
635
  }
642
- let insertGlobalStylesheet$1;
643
- function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
644
- insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
645
- }
646
636
  let insertStylesheet$1;
647
637
  function setInsertStylesheet(insertStylesheetImpl) {
648
638
  insertStylesheet$1 = insertStylesheetImpl;
@@ -2051,6 +2041,12 @@ var LWC = (function (exports) {
2051
2041
  return isUndefined$1(meta) ? defaultMeta : meta;
2052
2042
  }
2053
2043
 
2044
+ /*
2045
+ * Copyright (c) 2018, salesforce.com, inc.
2046
+ * All rights reserved.
2047
+ * SPDX-License-Identifier: MIT
2048
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2049
+ */
2054
2050
  const signedTemplateSet = new Set();
2055
2051
  function defaultEmptyTemplate() {
2056
2052
  return [];
@@ -2065,6 +2061,32 @@ var LWC = (function (exports) {
2065
2061
  */
2066
2062
  function registerTemplate(tpl) {
2067
2063
  signedTemplateSet.add(tpl);
2064
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2065
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2066
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2067
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2068
+ defineProperty(tpl, 'stylesheetTokens', {
2069
+ enumerable: true,
2070
+ configurable: true,
2071
+ get() {
2072
+ const { stylesheetToken } = this;
2073
+ if (isUndefined$1(stylesheetToken)) {
2074
+ return stylesheetToken;
2075
+ }
2076
+ // Shim for the old `stylesheetTokens` property
2077
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2078
+ return {
2079
+ hostAttribute: `${stylesheetToken}-host`,
2080
+ shadowAttribute: stylesheetToken,
2081
+ };
2082
+ },
2083
+ set(value) {
2084
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2085
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2086
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2087
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2088
+ },
2089
+ });
2068
2090
  // chaining this method as a way to wrap existing
2069
2091
  // assignment of templates easily, without too much transformation
2070
2092
  return tpl;
@@ -2838,15 +2860,16 @@ var LWC = (function (exports) {
2838
2860
  }
2839
2861
  }
2840
2862
  function unmount(vnode, parent, doRemove = false) {
2841
- const { type, elm } = vnode;
2863
+ const { type, elm, sel } = vnode;
2842
2864
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
2843
2865
  // subtree root, is the only element worth unmounting from the subtree.
2844
2866
  if (doRemove) {
2845
2867
  removeNode(elm, parent);
2846
2868
  }
2869
+ const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
2847
2870
  switch (type) {
2848
2871
  case 2 /* Element */:
2849
- unmountVNodes(vnode.children, elm);
2872
+ unmountVNodes(vnode.children, elm, removeChildren);
2850
2873
  break;
2851
2874
  case 3 /* CustomElement */: {
2852
2875
  const { vm } = vnode;
@@ -3614,10 +3637,10 @@ var LWC = (function (exports) {
3614
3637
  const { renderMode, shadowMode } = vm;
3615
3638
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
3616
3639
  for (let i = 0; i < stylesheets.length; i++) {
3617
- insertGlobalStylesheet$1(stylesheets[i]);
3640
+ insertStylesheet$1(stylesheets[i]);
3618
3641
  }
3619
3642
  }
3620
- else if (ssr$1 || isHydrating$1()) {
3643
+ else if (ssr$1 || vm.hydrated) {
3621
3644
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3622
3645
  // This works in the client, because the stylesheets are created, and cached in the VM
3623
3646
  // the first time the VM renders.
@@ -3628,15 +3651,10 @@ var LWC = (function (exports) {
3628
3651
  else {
3629
3652
  // native shadow or light DOM, DOM renderer
3630
3653
  const root = getNearestNativeShadowComponent(vm);
3631
- const isGlobal = isNull(root);
3654
+ // null root means a global style
3655
+ const target = isNull(root) ? undefined : root.shadowRoot;
3632
3656
  for (let i = 0; i < stylesheets.length; i++) {
3633
- if (isGlobal) {
3634
- insertGlobalStylesheet$1(stylesheets[i]);
3635
- }
3636
- else {
3637
- // local level
3638
- insertStylesheet$1(stylesheets[i], root.shadowRoot);
3639
- }
3657
+ insertStylesheet$1(stylesheets[i], target);
3640
3658
  }
3641
3659
  }
3642
3660
  return null;
@@ -4035,24 +4053,14 @@ var LWC = (function (exports) {
4035
4053
 
4036
4054
  resetComponentStateWhenRemoved(vm);
4037
4055
  }
4038
-
4039
- function getNearestShadowAncestor(vm) {
4040
- let ancestor = vm.owner;
4041
-
4042
- while (!isNull(ancestor) && ancestor.renderMode === 0
4043
- /* Light */
4044
- ) {
4045
- ancestor = ancestor.owner;
4046
- }
4047
-
4048
- return ancestor;
4049
- }
4050
-
4051
4056
  function createVM(elm, ctor, options) {
4057
+ var _a;
4058
+
4052
4059
  const {
4053
4060
  mode,
4054
4061
  owner,
4055
- tagName
4062
+ tagName,
4063
+ hydrated
4056
4064
  } = options;
4057
4065
  const def = getComponentInternalDef(ctor);
4058
4066
  const vm = {
@@ -4075,7 +4083,10 @@ var LWC = (function (exports) {
4075
4083
  cmpSlots: create(null),
4076
4084
  oar: create(null),
4077
4085
  cmpTemplate: null,
4086
+ hydrated: Boolean(hydrated),
4078
4087
  renderMode: def.renderMode,
4088
+ shadowMode: computeShadowMode(def, owner),
4089
+ 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,
4079
4090
  context: {
4080
4091
  stylesheetToken: undefined,
4081
4092
  hasTokenInClass: undefined,
@@ -4088,7 +4099,6 @@ var LWC = (function (exports) {
4088
4099
  },
4089
4100
  // Properties set right after VM creation.
4090
4101
  tro: null,
4091
- shadowMode: null,
4092
4102
  // Properties set by the LightningElement constructor.
4093
4103
  component: null,
4094
4104
  shadowRoot: null,
@@ -4097,7 +4107,6 @@ var LWC = (function (exports) {
4097
4107
  setHook,
4098
4108
  getHook
4099
4109
  };
4100
- vm.shadowMode = computeShadowMode(vm);
4101
4110
  vm.tro = getTemplateReactiveObserver(vm);
4102
4111
 
4103
4112
 
@@ -4110,10 +4119,9 @@ var LWC = (function (exports) {
4110
4119
  return vm;
4111
4120
  }
4112
4121
 
4113
- function computeShadowMode(vm) {
4114
- const {
4115
- def
4116
- } = vm;
4122
+ function computeShadowMode(def, owner) {
4123
+ var _a;
4124
+
4117
4125
  let shadowMode;
4118
4126
 
4119
4127
  if (isSyntheticShadowDefined$1) {
@@ -4136,23 +4144,13 @@ var LWC = (function (exports) {
4136
4144
  /* Native */
4137
4145
  ;
4138
4146
  } else {
4139
- const shadowAncestor = getNearestShadowAncestor(vm);
4140
-
4141
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4142
- /* Native */
4143
- ) {
4144
- // Transitive support for native Shadow DOM. A component in native mode
4145
- // transitively opts all of its descendants into native.
4146
- shadowMode = 0
4147
- /* Native */
4148
- ;
4149
- } else {
4150
- // Synthetic if neither this component nor any of its ancestors are configured
4151
- // to be native.
4152
- shadowMode = 1
4153
- /* Synthetic */
4154
- ;
4155
- }
4147
+ // Transitive support for native Shadow DOM. A component in native mode
4148
+ // transitively opts all of its descendants into native.
4149
+ // Synthetic if neither this component nor any of its ancestors are configured
4150
+ // to be native.
4151
+ shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
4152
+ /* Synthetic */
4153
+ ;
4156
4154
  }
4157
4155
  } else {
4158
4156
  shadowMode = 1
@@ -4979,6 +4977,7 @@ var LWC = (function (exports) {
4979
4977
  mode,
4980
4978
  owner,
4981
4979
  tagName: sel,
4980
+ hydrated: true,
4982
4981
  });
4983
4982
  vnode.elm = elm;
4984
4983
  vnode.vm = vm;
@@ -5128,7 +5127,10 @@ var LWC = (function (exports) {
5128
5127
  hooksAreSet = true;
5129
5128
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5130
5129
  }
5131
- /* version: 2.13.1 */
5130
+ // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
5131
+ // just warns on mutation.
5132
+ function freezeTemplate(tmpl) {
5133
+ }
5132
5134
 
5133
5135
  /*
5134
5136
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5136,17 +5138,162 @@ var LWC = (function (exports) {
5136
5138
  * SPDX-License-Identifier: MIT
5137
5139
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5138
5140
  */
5139
- const globalStylesheets = create(null);
5140
- const globalStylesheetsParentElement = document.head || document.body || document;
5141
- // This check for constructable stylesheets is similar to Fast's:
5141
+ /**
5142
+ * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
5143
+ * This API is subject to change or being removed.
5144
+ */
5145
+ function getComponentConstructor(elm) {
5146
+ let ctor = null;
5147
+ // intentionally checking for undefined due to some funky libraries patching weakmap.get
5148
+ // to throw when undefined.
5149
+ if (!isUndefined$1(elm)) {
5150
+ const vm = getAssociatedVMIfPresent(elm);
5151
+ if (!isUndefined$1(vm)) {
5152
+ ctor = vm.def.ctor;
5153
+ }
5154
+ }
5155
+ return ctor;
5156
+ }
5157
+ /* version: 2.13.4 */
5158
+
5159
+ /*
5160
+ * Copyright (c) 2018, salesforce.com, inc.
5161
+ * All rights reserved.
5162
+ * SPDX-License-Identifier: MIT
5163
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5164
+ */
5165
+ //
5166
+ // Feature detection
5167
+ //
5168
+ // This check for constructable style sheets is similar to Fast's:
5142
5169
  // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
5143
5170
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
5144
- const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
5145
- const supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets &&
5171
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
5172
+ // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
5173
+ // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
5174
+ // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
5175
+ // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
5176
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
5146
5177
  getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
5147
- const styleElements = create(null);
5148
- const styleSheets = create(null);
5149
- const shadowRootsToStyleSheets = new WeakMap();
5178
+ // Detect IE, via https://stackoverflow.com/a/9851769
5179
+ const isIE11 = !isUndefined$1(document.documentMode);
5180
+ const stylesheetCache = new Map();
5181
+ function isDocument(target) {
5182
+ return !isUndefined$1(target.head);
5183
+ }
5184
+ function createFreshStyleElement(content) {
5185
+ const elm = document.createElement('style');
5186
+ elm.type = 'text/css';
5187
+ elm.textContent = content;
5188
+ return elm;
5189
+ }
5190
+ function createStyleElement(content, cacheData) {
5191
+ const { stylesheet, used } = cacheData;
5192
+ // If the <style> was already used, then we should clone it. We cannot insert
5193
+ // the same <style> in two places in the DOM.
5194
+ if (used) {
5195
+ // For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
5196
+ // and will render the incorrect styles if we do things that way. It's just
5197
+ // a perf optimization, so we can skip it for IE11.
5198
+ if (isIE11) {
5199
+ return createFreshStyleElement(content);
5200
+ }
5201
+ // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
5202
+ // faster to call `cloneNode()` on an existing node than to recreate it every time.
5203
+ return stylesheet.cloneNode(true);
5204
+ }
5205
+ // We don't clone every time, because that would be a perf tax on the first time
5206
+ cacheData.used = true;
5207
+ return stylesheet;
5208
+ }
5209
+ function createConstructableStylesheet(content) {
5210
+ const stylesheet = new CSSStyleSheet();
5211
+ stylesheet.replaceSync(content);
5212
+ return stylesheet;
5213
+ }
5214
+ function insertConstructableStylesheet(content, target, cacheData) {
5215
+ const { adoptedStyleSheets } = target;
5216
+ const { stylesheet } = cacheData;
5217
+ // Mutable adopted stylesheets are only supported in certain browsers.
5218
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
5219
+ if (supportsMutableAdoptedStyleSheets) {
5220
+ adoptedStyleSheets.push(stylesheet);
5221
+ }
5222
+ else {
5223
+ target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
5224
+ }
5225
+ }
5226
+ function insertStyleElement(content, target, cacheData) {
5227
+ const elm = createStyleElement(content, cacheData);
5228
+ const targetAnchorPoint = isDocument(target) ? target.head : target;
5229
+ targetAnchorPoint.appendChild(elm);
5230
+ }
5231
+ function doInsertStylesheet(content, target, cacheData) {
5232
+ // Constructable stylesheets are only supported in certain browsers:
5233
+ // https://caniuse.com/mdn-api_document_adoptedstylesheets
5234
+ // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
5235
+ if (supportsConstructableStylesheets) {
5236
+ insertConstructableStylesheet(content, target, cacheData);
5237
+ }
5238
+ else {
5239
+ // Fall back to <style> element
5240
+ insertStyleElement(content, target, cacheData);
5241
+ }
5242
+ }
5243
+ function getCacheData(content) {
5244
+ let cacheData = stylesheetCache.get(content);
5245
+ if (isUndefined$1(cacheData)) {
5246
+ cacheData = {
5247
+ stylesheet: supportsConstructableStylesheets
5248
+ ? createConstructableStylesheet(content)
5249
+ : createFreshStyleElement(content),
5250
+ roots: undefined,
5251
+ global: false,
5252
+ used: false,
5253
+ };
5254
+ stylesheetCache.set(content, cacheData);
5255
+ }
5256
+ return cacheData;
5257
+ }
5258
+ function insertGlobalStylesheet(content) {
5259
+ const cacheData = getCacheData(content);
5260
+ if (cacheData.global) {
5261
+ // already inserted
5262
+ return;
5263
+ }
5264
+ cacheData.global = true; // mark inserted
5265
+ doInsertStylesheet(content, document, cacheData);
5266
+ }
5267
+ function insertLocalStylesheet(content, target) {
5268
+ const cacheData = getCacheData(content);
5269
+ let { roots } = cacheData;
5270
+ if (isUndefined$1(roots)) {
5271
+ roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
5272
+ }
5273
+ else if (roots.has(target)) {
5274
+ // already inserted
5275
+ return;
5276
+ }
5277
+ roots.add(target); // mark inserted
5278
+ doInsertStylesheet(content, target, cacheData);
5279
+ }
5280
+ function insertStylesheet(content, target) {
5281
+ if (isUndefined$1(target)) {
5282
+ // global
5283
+ insertGlobalStylesheet(content);
5284
+ }
5285
+ else {
5286
+ // local
5287
+ insertLocalStylesheet(content, target);
5288
+ }
5289
+ }
5290
+
5291
+ /*
5292
+ * Copyright (c) 2018, salesforce.com, inc.
5293
+ * All rights reserved.
5294
+ * SPDX-License-Identifier: MIT
5295
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5296
+ */
5150
5297
  let getCustomElement;
5151
5298
  let defineCustomElement;
5152
5299
  let HTMLElementConstructor;
@@ -5173,52 +5320,6 @@ var LWC = (function (exports) {
5173
5320
  return false;
5174
5321
  }
5175
5322
  }
5176
- function insertConstructableStyleSheet(content, target) {
5177
- // It's important for CSSStyleSheets to be unique based on their content, so that
5178
- // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
5179
- let styleSheet = styleSheets[content];
5180
- if (isUndefined$1(styleSheet)) {
5181
- styleSheet = new CSSStyleSheet();
5182
- styleSheet.replaceSync(content);
5183
- styleSheets[content] = styleSheet;
5184
- }
5185
- const { adoptedStyleSheets } = target;
5186
- if (!adoptedStyleSheets.includes(styleSheet)) {
5187
- if (supportsMutableAdoptedStyleSheets) {
5188
- // This is only supported in later versions of Chromium:
5189
- // https://chromestatus.com/feature/5638996492288000
5190
- adoptedStyleSheets.push(styleSheet);
5191
- }
5192
- else {
5193
- target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
5194
- }
5195
- }
5196
- }
5197
- function insertStyleElement(content, target) {
5198
- // Avoid inserting duplicate `<style>`s
5199
- let sheets = shadowRootsToStyleSheets.get(target);
5200
- if (isUndefined$1(sheets)) {
5201
- sheets = create(null);
5202
- shadowRootsToStyleSheets.set(target, sheets);
5203
- }
5204
- if (sheets[content]) {
5205
- return;
5206
- }
5207
- sheets[content] = true;
5208
- // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
5209
- // faster to call `cloneNode()` on an existing node than to recreate it every time.
5210
- let elm = styleElements[content];
5211
- if (isUndefined$1(elm)) {
5212
- elm = document.createElement('style');
5213
- elm.type = 'text/css';
5214
- elm.textContent = content;
5215
- styleElements[content] = elm;
5216
- }
5217
- else {
5218
- elm = elm.cloneNode(true);
5219
- }
5220
- target.appendChild(elm);
5221
- }
5222
5323
  if (isCustomElementRegistryAvailable()) {
5223
5324
  getCustomElement = customElements.get.bind(customElements);
5224
5325
  defineCustomElement = customElements.define.bind(customElements);
@@ -5257,9 +5358,6 @@ var LWC = (function (exports) {
5257
5358
  hydrating = value;
5258
5359
  }
5259
5360
  const ssr = false;
5260
- function isHydrating() {
5261
- return hydrating;
5262
- }
5263
5361
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
5264
5362
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
5265
5363
  function createElement$1(tagName, namespace) {
@@ -5368,25 +5466,6 @@ var LWC = (function (exports) {
5368
5466
  function isConnected(node) {
5369
5467
  return node.isConnected;
5370
5468
  }
5371
- function insertGlobalStylesheet(content) {
5372
- if (!isUndefined$1(globalStylesheets[content])) {
5373
- return;
5374
- }
5375
- globalStylesheets[content] = true;
5376
- const elm = document.createElement('style');
5377
- elm.type = 'text/css';
5378
- elm.textContent = content;
5379
- globalStylesheetsParentElement.appendChild(elm);
5380
- }
5381
- function insertStylesheet(content, target) {
5382
- if (supportsConstructableStyleSheets) {
5383
- insertConstructableStyleSheet(content, target);
5384
- }
5385
- else {
5386
- // Fall back to <style> element
5387
- insertStyleElement(content, target);
5388
- }
5389
- }
5390
5469
  const HTMLElementExported = HTMLElementConstructor;
5391
5470
  setAttachShadow(attachShadow);
5392
5471
  setCreateComment(createComment);
@@ -5409,10 +5488,7 @@ var LWC = (function (exports) {
5409
5488
  setGetProperty(getProperty);
5410
5489
  setHTMLElement(HTMLElementExported);
5411
5490
  setInsert(insert);
5412
- setInsertGlobalStylesheet(insertGlobalStylesheet);
5413
- setInsertStylesheet(insertStylesheet);
5414
5491
  setIsConnected(isConnected);
5415
- setIsHydrating$1(isHydrating);
5416
5492
  setIsNativeShadowDefined(isNativeShadowDefined);
5417
5493
  setIsSyntheticShadowDefined(isSyntheticShadowDefined);
5418
5494
  setNextSibling(nextSibling);
@@ -5427,6 +5503,7 @@ var LWC = (function (exports) {
5427
5503
  setSetText(setText);
5428
5504
  setSsr(ssr);
5429
5505
  setAddEventListener(addEventListener);
5506
+ setInsertStylesheet(insertStylesheet);
5430
5507
 
5431
5508
  /*
5432
5509
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5452,6 +5529,7 @@ var LWC = (function (exports) {
5452
5529
  mode: 'open',
5453
5530
  owner: null,
5454
5531
  tagName: element.tagName.toLowerCase(),
5532
+ hydrated: true,
5455
5533
  });
5456
5534
  for (const [key, value] of Object.entries(props)) {
5457
5535
  element[key] = value;
@@ -5646,27 +5724,6 @@ var LWC = (function (exports) {
5646
5724
  return element;
5647
5725
  }
5648
5726
 
5649
- /*
5650
- * Copyright (c) 2018, salesforce.com, inc.
5651
- * All rights reserved.
5652
- * SPDX-License-Identifier: MIT
5653
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5654
- */
5655
- /**
5656
- * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
5657
- * This API is subject to change or being removed.
5658
- */
5659
- function getComponentConstructor(elm) {
5660
- let ctor = null;
5661
- if (elm instanceof HTMLElement) {
5662
- const vm = getAssociatedVMIfPresent(elm);
5663
- if (!isUndefined$1(vm)) {
5664
- ctor = vm.def.ctor;
5665
- }
5666
- }
5667
- return ctor;
5668
- }
5669
-
5670
5727
  /*
5671
5728
  * Copyright (c) 2018, salesforce.com, inc.
5672
5729
  * All rights reserved.
@@ -5735,7 +5792,7 @@ var LWC = (function (exports) {
5735
5792
  });
5736
5793
  freeze(LightningElement);
5737
5794
  seal(LightningElement.prototype);
5738
- /* version: 2.13.1 */
5795
+ /* version: 2.13.4 */
5739
5796
 
5740
5797
  exports.LightningElement = LightningElement;
5741
5798
  exports.__unstable__ProfilerControl = profilerControl;
@@ -5743,6 +5800,7 @@ var LWC = (function (exports) {
5743
5800
  exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
5744
5801
  exports.createContextProvider = createContextProvider;
5745
5802
  exports.createElement = createElement;
5803
+ exports.freezeTemplate = freezeTemplate;
5746
5804
  exports.getComponentConstructor = getComponentConstructor;
5747
5805
  exports.getComponentDef = getComponentDef;
5748
5806
  exports.hydrateComponent = hydrateComponent;