lwc 2.14.1 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +598 -541
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +600 -540
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +537 -485
  5. package/dist/engine-dom/iife/es5/engine-dom.js +768 -679
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +692 -621
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +600 -540
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +537 -485
  11. package/dist/engine-dom/umd/es5/engine-dom.js +768 -679
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +692 -621
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +455 -460
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +453 -461
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +24 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +24 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +24 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +29 -3
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +29 -3
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +24 -4
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +24 -4
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +29 -3
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +29 -3
  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_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -225,6 +225,7 @@ const _globalThis = /*@__PURE__*/ (function () {
225
225
  return _globalThis;
226
226
  })();
227
227
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
228
+ const KEY__SHADOW_STATIC = '$shadowStaticNode$';
228
229
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
229
230
  const KEY__SCOPED_CSS = '$scoped$';
230
231
 
@@ -406,6 +407,24 @@ function htmlPropertyToAttribute(propName) {
406
407
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
407
408
  return attributeName;
408
409
  }
410
+
411
+ /*
412
+ * Copyright (c) 2020, salesforce.com, inc.
413
+ * All rights reserved.
414
+ * SPDX-License-Identifier: MIT
415
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
416
+ */
417
+ const ESCAPED_CHARS = {
418
+ '"': '"',
419
+ "'": ''',
420
+ '<': '&lt;',
421
+ '>': '&gt;',
422
+ '&': '&amp;',
423
+ };
424
+ function htmlEscape(str, attrMode = false) {
425
+ const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
426
+ return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
427
+ }
409
428
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
410
429
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
411
430
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
@@ -417,9 +436,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
417
436
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
418
437
  */
419
438
  // Increment whenever the LWC template compiler changes
420
- const LWC_VERSION = "2.14.1";
439
+ const LWC_VERSION = "2.16.0";
421
440
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
422
- /** version: 2.14.1 */
441
+ /** version: 2.16.0 */
423
442
 
424
443
  /*
425
444
  * Copyright (c) 2020, salesforce.com, inc.
@@ -528,7 +547,7 @@ function setFeatureFlagForTest(name, value) {
528
547
  setFeatureFlag(name, value);
529
548
  }
530
549
  }
531
- /** version: 2.14.1 */
550
+ /** version: 2.16.0 */
532
551
 
533
552
  /* proxy-compat-disable */
534
553
 
@@ -611,162 +630,6 @@ function flattenStylesheets(stylesheets) {
611
630
  return list;
612
631
  }
613
632
 
614
- //
615
- // Primitives
616
- //
617
- let ssr$1;
618
- function setSsr(ssrImpl) {
619
- ssr$1 = ssrImpl;
620
- }
621
- let isNativeShadowDefined$1;
622
- function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
623
- isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
624
- }
625
- let isSyntheticShadowDefined$1;
626
- function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
627
- isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
628
- }
629
- let HTMLElementExported$1;
630
- function setHTMLElement(HTMLElementImpl) {
631
- HTMLElementExported$1 = HTMLElementImpl;
632
- }
633
- let insert$1;
634
- function setInsert(insertImpl) {
635
- insert$1 = insertImpl;
636
- }
637
- let remove$1;
638
- function setRemove(removeImpl) {
639
- remove$1 = removeImpl;
640
- }
641
- let createElement$1;
642
- function setCreateElement(createElementImpl) {
643
- createElement$1 = createElementImpl;
644
- }
645
- let createText$1;
646
- function setCreateText(createTextImpl) {
647
- createText$1 = createTextImpl;
648
- }
649
- let createComment$1;
650
- function setCreateComment(createCommentImpl) {
651
- createComment$1 = createCommentImpl;
652
- }
653
- let nextSibling$1;
654
- function setNextSibling(nextSiblingImpl) {
655
- nextSibling$1 = nextSiblingImpl;
656
- }
657
- let attachShadow$1;
658
- function setAttachShadow(attachShadowImpl) {
659
- attachShadow$1 = attachShadowImpl;
660
- }
661
- let getProperty$1;
662
- function setGetProperty(getPropertyImpl) {
663
- getProperty$1 = getPropertyImpl;
664
- }
665
- let setProperty$1;
666
- function setSetProperty(setPropertyImpl) {
667
- setProperty$1 = setPropertyImpl;
668
- }
669
- let setText$1;
670
- function setSetText(setTextImpl) {
671
- setText$1 = setTextImpl;
672
- }
673
- let getAttribute$1;
674
- function setGetAttribute(getAttributeImpl) {
675
- getAttribute$1 = getAttributeImpl;
676
- }
677
- let setAttribute$1;
678
- function setSetAttribute(setAttributeImpl) {
679
- setAttribute$1 = setAttributeImpl;
680
- }
681
- let removeAttribute$1;
682
- function setRemoveAttribute(removeAttributeImpl) {
683
- removeAttribute$1 = removeAttributeImpl;
684
- }
685
- let addEventListener$1;
686
- function setAddEventListener(addEventListenerImpl) {
687
- addEventListener$1 = addEventListenerImpl;
688
- }
689
- let removeEventListener$1;
690
- function setRemoveEventListener(removeEventListenerImpl) {
691
- removeEventListener$1 = removeEventListenerImpl;
692
- }
693
- let dispatchEvent$1;
694
- function setDispatchEvent(dispatchEventImpl) {
695
- dispatchEvent$1 = dispatchEventImpl;
696
- }
697
- let getClassList$1;
698
- function setGetClassList(getClassListImpl) {
699
- getClassList$1 = getClassListImpl;
700
- }
701
- let setCSSStyleProperty$1;
702
- function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
703
- setCSSStyleProperty$1 = setCSSStylePropertyImpl;
704
- }
705
- let getBoundingClientRect$1;
706
- function setGetBoundingClientRect(getBoundingClientRectImpl) {
707
- getBoundingClientRect$1 = getBoundingClientRectImpl;
708
- }
709
- let querySelector$1;
710
- function setQuerySelector(querySelectorImpl) {
711
- querySelector$1 = querySelectorImpl;
712
- }
713
- let querySelectorAll$1;
714
- function setQuerySelectorAll(querySelectorAllImpl) {
715
- querySelectorAll$1 = querySelectorAllImpl;
716
- }
717
- let getElementsByTagName$1;
718
- function setGetElementsByTagName(getElementsByTagNameImpl) {
719
- getElementsByTagName$1 = getElementsByTagNameImpl;
720
- }
721
- let getElementsByClassName$1;
722
- function setGetElementsByClassName(getElementsByClassNameImpl) {
723
- getElementsByClassName$1 = getElementsByClassNameImpl;
724
- }
725
- let getChildren$1;
726
- function setGetChildren(getChildrenImpl) {
727
- getChildren$1 = getChildrenImpl;
728
- }
729
- let getChildNodes$1;
730
- function setGetChildNodes(getChildNodesImpl) {
731
- getChildNodes$1 = getChildNodesImpl;
732
- }
733
- let getFirstChild$1;
734
- function setGetFirstChild(getFirstChildImpl) {
735
- getFirstChild$1 = getFirstChildImpl;
736
- }
737
- let getFirstElementChild$1;
738
- function setGetFirstElementChild(getFirstElementChildImpl) {
739
- getFirstElementChild$1 = getFirstElementChildImpl;
740
- }
741
- let getLastChild$1;
742
- function setGetLastChild(getLastChildImpl) {
743
- getLastChild$1 = getLastChildImpl;
744
- }
745
- let getLastElementChild$1;
746
- function setGetLastElementChild(getLastElementChildImpl) {
747
- getLastElementChild$1 = getLastElementChildImpl;
748
- }
749
- let isConnected$1;
750
- function setIsConnected(isConnectedImpl) {
751
- isConnected$1 = isConnectedImpl;
752
- }
753
- let insertStylesheet$1;
754
- function setInsertStylesheet(insertStylesheetImpl) {
755
- insertStylesheet$1 = insertStylesheetImpl;
756
- }
757
- let assertInstanceOfHTMLElement$1;
758
- function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
759
- assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
760
- }
761
- let defineCustomElement$1;
762
- function setDefineCustomElement(defineCustomElementImpl) {
763
- defineCustomElement$1 = defineCustomElementImpl;
764
- }
765
- let getCustomElement$1;
766
- function setGetCustomElement(getCustomElementImpl) {
767
- getCustomElement$1 = getCustomElementImpl;
768
- }
769
-
770
633
  /*
771
634
  * Copyright (c) 2019, salesforce.com, inc.
772
635
  * All rights reserved.
@@ -2068,7 +1931,8 @@ const LightningElement = function () {
2068
1931
  const { def, elm } = vm;
2069
1932
  const { bridge } = def;
2070
1933
  if (process.env.NODE_ENV !== 'production') {
2071
- assertInstanceOfHTMLElement$1(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
1934
+ const { assertInstanceOfHTMLElement } = vm.renderer;
1935
+ assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
2072
1936
  }
2073
1937
  const component = this;
2074
1938
  setPrototypeOf(elm, bridge.prototype);
@@ -2102,8 +1966,8 @@ const LightningElement = function () {
2102
1966
  return this;
2103
1967
  };
2104
1968
  function doAttachShadow(vm) {
2105
- const { elm, mode, shadowMode, def: { ctor }, } = vm;
2106
- const shadowRoot = attachShadow$1(elm, {
1969
+ const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
1970
+ const shadowRoot = attachShadow(elm, {
2107
1971
  [KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
2108
1972
  delegatesFocus: Boolean(ctor.delegatesFocus),
2109
1973
  mode,
@@ -2124,12 +1988,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
2124
1988
  LightningElement.prototype = {
2125
1989
  constructor: LightningElement,
2126
1990
  dispatchEvent(event) {
2127
- const { elm } = getAssociatedVM(this);
2128
- return dispatchEvent$1(elm, event);
1991
+ const vm = getAssociatedVM(this);
1992
+ const { elm, renderer: { dispatchEvent }, } = vm;
1993
+ return dispatchEvent(elm, event);
2129
1994
  },
2130
1995
  addEventListener(type, listener, options) {
2131
1996
  const vm = getAssociatedVM(this);
2132
- const { elm } = vm;
1997
+ const { elm, renderer: { addEventListener }, } = vm;
2133
1998
  if (process.env.NODE_ENV !== 'production') {
2134
1999
  const vmBeingRendered = getVMBeingRendered();
2135
2000
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
@@ -2137,83 +2002,91 @@ LightningElement.prototype = {
2137
2002
  assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
2138
2003
  }
2139
2004
  const wrappedListener = getWrappedComponentsListener(vm, listener);
2140
- addEventListener$1(elm, type, wrappedListener, options);
2005
+ addEventListener(elm, type, wrappedListener, options);
2141
2006
  },
2142
2007
  removeEventListener(type, listener, options) {
2143
2008
  const vm = getAssociatedVM(this);
2144
- const { elm } = vm;
2009
+ const { elm, renderer: { removeEventListener }, } = vm;
2145
2010
  const wrappedListener = getWrappedComponentsListener(vm, listener);
2146
- removeEventListener$1(elm, type, wrappedListener, options);
2011
+ removeEventListener(elm, type, wrappedListener, options);
2147
2012
  },
2148
2013
  hasAttribute(name) {
2149
- const { elm } = getAssociatedVM(this);
2150
- return !isNull(getAttribute$1(elm, name));
2014
+ const vm = getAssociatedVM(this);
2015
+ const { elm, renderer: { getAttribute }, } = vm;
2016
+ return !isNull(getAttribute(elm, name));
2151
2017
  },
2152
2018
  hasAttributeNS(namespace, name) {
2153
- const { elm } = getAssociatedVM(this);
2154
- return !isNull(getAttribute$1(elm, name, namespace));
2019
+ const vm = getAssociatedVM(this);
2020
+ const { elm, renderer: { getAttribute }, } = vm;
2021
+ return !isNull(getAttribute(elm, name, namespace));
2155
2022
  },
2156
2023
  removeAttribute(name) {
2157
- const { elm } = getAssociatedVM(this);
2024
+ const vm = getAssociatedVM(this);
2025
+ const { elm, renderer: { removeAttribute }, } = vm;
2158
2026
  unlockAttribute(elm, name);
2159
- removeAttribute$1(elm, name);
2027
+ removeAttribute(elm, name);
2160
2028
  lockAttribute();
2161
2029
  },
2162
2030
  removeAttributeNS(namespace, name) {
2163
- const { elm } = getAssociatedVM(this);
2031
+ const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
2164
2032
  unlockAttribute(elm, name);
2165
- removeAttribute$1(elm, name, namespace);
2033
+ removeAttribute(elm, name, namespace);
2166
2034
  lockAttribute();
2167
2035
  },
2168
2036
  getAttribute(name) {
2169
- const { elm } = getAssociatedVM(this);
2170
- return getAttribute$1(elm, name);
2037
+ const vm = getAssociatedVM(this);
2038
+ const { elm } = vm;
2039
+ const { getAttribute } = vm.renderer;
2040
+ return getAttribute(elm, name);
2171
2041
  },
2172
2042
  getAttributeNS(namespace, name) {
2173
- const { elm } = getAssociatedVM(this);
2174
- return getAttribute$1(elm, name, namespace);
2043
+ const vm = getAssociatedVM(this);
2044
+ const { elm } = vm;
2045
+ const { getAttribute } = vm.renderer;
2046
+ return getAttribute(elm, name, namespace);
2175
2047
  },
2176
2048
  setAttribute(name, value) {
2177
2049
  const vm = getAssociatedVM(this);
2178
- const { elm } = vm;
2050
+ const { elm, renderer: { setAttribute }, } = vm;
2179
2051
  if (process.env.NODE_ENV !== 'production') {
2180
2052
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2181
2053
  }
2182
2054
  unlockAttribute(elm, name);
2183
- setAttribute$1(elm, name, value);
2055
+ setAttribute(elm, name, value);
2184
2056
  lockAttribute();
2185
2057
  },
2186
2058
  setAttributeNS(namespace, name, value) {
2187
2059
  const vm = getAssociatedVM(this);
2188
- const { elm } = vm;
2060
+ const { elm, renderer: { setAttribute }, } = vm;
2189
2061
  if (process.env.NODE_ENV !== 'production') {
2190
2062
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2191
2063
  }
2192
2064
  unlockAttribute(elm, name);
2193
- setAttribute$1(elm, name, value, namespace);
2065
+ setAttribute(elm, name, value, namespace);
2194
2066
  lockAttribute();
2195
2067
  },
2196
2068
  getBoundingClientRect() {
2197
2069
  const vm = getAssociatedVM(this);
2198
- const { elm } = vm;
2070
+ const { elm, renderer: { getBoundingClientRect }, } = vm;
2199
2071
  if (process.env.NODE_ENV !== 'production') {
2200
2072
  warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
2201
2073
  }
2202
- return getBoundingClientRect$1(elm);
2074
+ return getBoundingClientRect(elm);
2203
2075
  },
2204
2076
  get isConnected() {
2205
- const { elm } = getAssociatedVM(this);
2206
- return isConnected$1(elm);
2077
+ const vm = getAssociatedVM(this);
2078
+ const { elm, renderer: { isConnected }, } = vm;
2079
+ return isConnected(elm);
2207
2080
  },
2208
2081
  get classList() {
2209
2082
  const vm = getAssociatedVM(this);
2210
- const { elm } = vm;
2083
+ const { elm, renderer: { getClassList }, } = vm;
2211
2084
  if (process.env.NODE_ENV !== 'production') {
2212
2085
  // TODO [#1290]: this still fails in dev but works in production, eventually, we should
2213
2086
  // just throw in all modes
2214
2087
  assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
2215
2088
  }
2216
- return getClassList$1(elm);
2089
+ return getClassList(elm);
2217
2090
  },
2218
2091
  get template() {
2219
2092
  const vm = getAssociatedVM(this);
@@ -2229,6 +2102,54 @@ LightningElement.prototype = {
2229
2102
  // Authors should rely on this.template instead.
2230
2103
  return null;
2231
2104
  },
2105
+ get children() {
2106
+ const vm = getAssociatedVM(this);
2107
+ const renderer = vm.renderer;
2108
+ if (process.env.NODE_ENV !== 'production') {
2109
+ warnIfInvokedDuringConstruction(vm, 'children');
2110
+ }
2111
+ return renderer.getChildren(vm.elm);
2112
+ },
2113
+ get childNodes() {
2114
+ const vm = getAssociatedVM(this);
2115
+ const renderer = vm.renderer;
2116
+ if (process.env.NODE_ENV !== 'production') {
2117
+ warnIfInvokedDuringConstruction(vm, 'childNodes');
2118
+ }
2119
+ return renderer.getChildNodes(vm.elm);
2120
+ },
2121
+ get firstChild() {
2122
+ const vm = getAssociatedVM(this);
2123
+ const renderer = vm.renderer;
2124
+ if (process.env.NODE_ENV !== 'production') {
2125
+ warnIfInvokedDuringConstruction(vm, 'firstChild');
2126
+ }
2127
+ return renderer.getFirstChild(vm.elm);
2128
+ },
2129
+ get firstElementChild() {
2130
+ const vm = getAssociatedVM(this);
2131
+ const renderer = vm.renderer;
2132
+ if (process.env.NODE_ENV !== 'production') {
2133
+ warnIfInvokedDuringConstruction(vm, 'firstElementChild');
2134
+ }
2135
+ return renderer.getFirstElementChild(vm.elm);
2136
+ },
2137
+ get lastChild() {
2138
+ const vm = getAssociatedVM(this);
2139
+ const renderer = vm.renderer;
2140
+ if (process.env.NODE_ENV !== 'production') {
2141
+ warnIfInvokedDuringConstruction(vm, 'lastChild');
2142
+ }
2143
+ return renderer.getLastChild(vm.elm);
2144
+ },
2145
+ get lastElementChild() {
2146
+ const vm = getAssociatedVM(this);
2147
+ const renderer = vm.renderer;
2148
+ if (process.env.NODE_ENV !== 'production') {
2149
+ warnIfInvokedDuringConstruction(vm, 'lastElementChild');
2150
+ }
2151
+ return renderer.getLastElementChild(vm.elm);
2152
+ },
2232
2153
  render() {
2233
2154
  const vm = getAssociatedVM(this);
2234
2155
  return vm.def.template;
@@ -2239,76 +2160,22 @@ LightningElement.prototype = {
2239
2160
  },
2240
2161
  };
2241
2162
  const queryAndChildGetterDescriptors = create(null);
2242
- // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
2243
- // is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
2244
- // object representing the renderer, with a lot of methods we don't actually need.
2245
- const childGetters = [
2246
- 'children',
2247
- 'childNodes',
2248
- 'firstChild',
2249
- 'firstElementChild',
2250
- 'lastChild',
2251
- 'lastElementChild',
2252
- ];
2253
- function getChildGetter(methodName) {
2254
- switch (methodName) {
2255
- case 'children':
2256
- return getChildren$1;
2257
- case 'childNodes':
2258
- return getChildNodes$1;
2259
- case 'firstChild':
2260
- return getFirstChild$1;
2261
- case 'firstElementChild':
2262
- return getFirstElementChild$1;
2263
- case 'lastChild':
2264
- return getLastChild$1;
2265
- case 'lastElementChild':
2266
- return getLastElementChild$1;
2267
- }
2268
- }
2269
- // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
2270
- for (const childGetter of childGetters) {
2271
- queryAndChildGetterDescriptors[childGetter] = {
2272
- get() {
2273
- const vm = getAssociatedVM(this);
2274
- const { elm } = vm;
2275
- if (process.env.NODE_ENV !== 'production') {
2276
- warnIfInvokedDuringConstruction(vm, childGetter);
2277
- }
2278
- return getChildGetter(childGetter)(elm);
2279
- },
2280
- configurable: true,
2281
- enumerable: true,
2282
- };
2283
- }
2284
2163
  const queryMethods = [
2285
2164
  'getElementsByClassName',
2286
2165
  'getElementsByTagName',
2287
2166
  'querySelector',
2288
2167
  'querySelectorAll',
2289
2168
  ];
2290
- function getQueryMethod(methodName) {
2291
- switch (methodName) {
2292
- case 'getElementsByClassName':
2293
- return getElementsByClassName$1;
2294
- case 'getElementsByTagName':
2295
- return getElementsByTagName$1;
2296
- case 'querySelector':
2297
- return querySelector$1;
2298
- case 'querySelectorAll':
2299
- return querySelectorAll$1;
2300
- }
2301
- }
2302
2169
  // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2303
2170
  for (const queryMethod of queryMethods) {
2304
2171
  queryAndChildGetterDescriptors[queryMethod] = {
2305
2172
  value(arg) {
2306
2173
  const vm = getAssociatedVM(this);
2307
- const { elm } = vm;
2174
+ const { elm, renderer } = vm;
2308
2175
  if (process.env.NODE_ENV !== 'production') {
2309
2176
  warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
2310
2177
  }
2311
- return getQueryMethod(queryMethod)(elm, arg);
2178
+ return renderer[queryMethod](elm, arg);
2312
2179
  },
2313
2180
  configurable: true,
2314
2181
  enumerable: true,
@@ -3411,12 +3278,13 @@ function getComponentDef(Ctor) {
3411
3278
  * SPDX-License-Identifier: MIT
3412
3279
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3413
3280
  */
3414
- function getUpgradableConstructor(tagName) {
3281
+ function getUpgradableConstructor(tagName, renderer) {
3282
+ const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
3415
3283
  // Should never get a tag with upper case letter at this point, the compiler should
3416
3284
  // produce only tags with lowercase letters
3417
3285
  // But, for backwards compatibility, we will lower case the tagName
3418
3286
  tagName = tagName.toLowerCase();
3419
- let CE = getCustomElement$1(tagName);
3287
+ let CE = getCustomElement(tagName);
3420
3288
  if (!isUndefined$1(CE)) {
3421
3289
  return CE;
3422
3290
  }
@@ -3424,7 +3292,7 @@ function getUpgradableConstructor(tagName) {
3424
3292
  * LWC Upgradable Element reference to an element that was created
3425
3293
  * via the scoped registry mechanism, and that is ready to be upgraded.
3426
3294
  */
3427
- CE = class LWCUpgradableElement extends HTMLElementExported$1 {
3295
+ CE = class LWCUpgradableElement extends RendererHTMLElement {
3428
3296
  constructor(upgradeCallback) {
3429
3297
  super();
3430
3298
  if (isFunction$1(upgradeCallback)) {
@@ -3432,7 +3300,7 @@ function getUpgradableConstructor(tagName) {
3432
3300
  }
3433
3301
  }
3434
3302
  };
3435
- defineCustomElement$1(tagName, CE);
3303
+ defineCustomElement(tagName, CE);
3436
3304
  return CE;
3437
3305
  }
3438
3306
 
@@ -3457,7 +3325,7 @@ function isSameVnode(vnode1, vnode2) {
3457
3325
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3458
3326
  */
3459
3327
  const ColonCharCode = 58;
3460
- function patchAttributes(oldVnode, vnode) {
3328
+ function patchAttributes(oldVnode, vnode, renderer) {
3461
3329
  const { attrs } = vnode.data;
3462
3330
  if (isUndefined$1(attrs)) {
3463
3331
  return;
@@ -3467,6 +3335,7 @@ function patchAttributes(oldVnode, vnode) {
3467
3335
  return;
3468
3336
  }
3469
3337
  const { elm } = vnode;
3338
+ const { setAttribute, removeAttribute } = renderer;
3470
3339
  for (const key in attrs) {
3471
3340
  const cur = attrs[key];
3472
3341
  const old = oldAttrs[key];
@@ -3474,17 +3343,17 @@ function patchAttributes(oldVnode, vnode) {
3474
3343
  unlockAttribute(elm, key);
3475
3344
  if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
3476
3345
  // Assume xml namespace
3477
- setAttribute$1(elm, key, cur, XML_NAMESPACE);
3346
+ setAttribute(elm, key, cur, XML_NAMESPACE);
3478
3347
  }
3479
3348
  else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
3480
3349
  // Assume xlink namespace
3481
- setAttribute$1(elm, key, cur, XLINK_NAMESPACE);
3350
+ setAttribute(elm, key, cur, XLINK_NAMESPACE);
3482
3351
  }
3483
3352
  else if (isNull(cur) || isUndefined$1(cur)) {
3484
- removeAttribute$1(elm, key);
3353
+ removeAttribute(elm, key);
3485
3354
  }
3486
3355
  else {
3487
- setAttribute$1(elm, key, cur);
3356
+ setAttribute(elm, key, cur);
3488
3357
  }
3489
3358
  lockAttribute();
3490
3359
  }
@@ -3502,7 +3371,7 @@ function isLiveBindingProp(sel, key) {
3502
3371
  // instead of relying on internally tracked values.
3503
3372
  return sel === 'input' && (key === 'value' || key === 'checked');
3504
3373
  }
3505
- function patchProps(oldVnode, vnode) {
3374
+ function patchProps(oldVnode, vnode, renderer) {
3506
3375
  const { props } = vnode.data;
3507
3376
  if (isUndefined$1(props)) {
3508
3377
  return;
@@ -3513,13 +3382,14 @@ function patchProps(oldVnode, vnode) {
3513
3382
  }
3514
3383
  const isFirstPatch = isNull(oldVnode);
3515
3384
  const { elm, sel } = vnode;
3385
+ const { getProperty, setProperty } = renderer;
3516
3386
  for (const key in props) {
3517
3387
  const cur = props[key];
3518
3388
  // Set the property if it's the first time is is patched or if the previous property is
3519
3389
  // different than the one previously set.
3520
3390
  if (isFirstPatch ||
3521
- cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
3522
- setProperty$1(elm, key, cur);
3391
+ cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
3392
+ setProperty(elm, key, cur);
3523
3393
  }
3524
3394
  }
3525
3395
  }
@@ -3564,13 +3434,14 @@ function getMapFromClassName(className) {
3564
3434
  }
3565
3435
  return map;
3566
3436
  }
3567
- function patchClassAttribute(oldVnode, vnode) {
3437
+ function patchClassAttribute(oldVnode, vnode, renderer) {
3568
3438
  const { elm, data: { className: newClass }, } = vnode;
3569
3439
  const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
3570
3440
  if (oldClass === newClass) {
3571
3441
  return;
3572
3442
  }
3573
- const classList = getClassList$1(elm);
3443
+ const { getClassList } = renderer;
3444
+ const classList = getClassList(elm);
3574
3445
  const newClassMap = getMapFromClassName(newClass);
3575
3446
  const oldClassMap = getMapFromClassName(oldClass);
3576
3447
  let name;
@@ -3594,17 +3465,18 @@ function patchClassAttribute(oldVnode, vnode) {
3594
3465
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3595
3466
  */
3596
3467
  // The style property is a string when defined via an expression in the template.
3597
- function patchStyleAttribute(oldVnode, vnode) {
3468
+ function patchStyleAttribute(oldVnode, vnode, renderer) {
3598
3469
  const { elm, data: { style: newStyle }, } = vnode;
3599
3470
  const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
3600
3471
  if (oldStyle === newStyle) {
3601
3472
  return;
3602
3473
  }
3474
+ const { setAttribute, removeAttribute } = renderer;
3603
3475
  if (!isString(newStyle) || newStyle === '') {
3604
- removeAttribute$1(elm, 'style');
3476
+ removeAttribute(elm, 'style');
3605
3477
  }
3606
3478
  else {
3607
- setAttribute$1(elm, 'style', newStyle);
3479
+ setAttribute(elm, 'style', newStyle);
3608
3480
  }
3609
3481
  }
3610
3482
 
@@ -3614,14 +3486,15 @@ function patchStyleAttribute(oldVnode, vnode) {
3614
3486
  * SPDX-License-Identifier: MIT
3615
3487
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3616
3488
  */
3617
- function applyEventListeners(vnode) {
3489
+ function applyEventListeners(vnode, renderer) {
3618
3490
  const { elm, data: { on }, } = vnode;
3619
3491
  if (isUndefined$1(on)) {
3620
3492
  return;
3621
3493
  }
3494
+ const { addEventListener } = renderer;
3622
3495
  for (const name in on) {
3623
3496
  const handler = on[name];
3624
- addEventListener$1(elm, name, handler);
3497
+ addEventListener(elm, name, handler);
3625
3498
  }
3626
3499
  }
3627
3500
 
@@ -3634,12 +3507,13 @@ function applyEventListeners(vnode) {
3634
3507
  // The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
3635
3508
  // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
3636
3509
  // different classnames properties individually instead of via a string.
3637
- function applyStaticClassAttribute(vnode) {
3510
+ function applyStaticClassAttribute(vnode, renderer) {
3638
3511
  const { elm, data: { classMap }, } = vnode;
3639
3512
  if (isUndefined$1(classMap)) {
3640
3513
  return;
3641
3514
  }
3642
- const classList = getClassList$1(elm);
3515
+ const { getClassList } = renderer;
3516
+ const classList = getClassList(elm);
3643
3517
  for (const name in classMap) {
3644
3518
  classList.add(name);
3645
3519
  }
@@ -3654,14 +3528,15 @@ function applyStaticClassAttribute(vnode) {
3654
3528
  // The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
3655
3529
  // The compiler takes care of transforming the inline style into an object. It's faster to set the
3656
3530
  // different style properties individually instead of via a string.
3657
- function applyStaticStyleAttribute(vnode) {
3531
+ function applyStaticStyleAttribute(vnode, renderer) {
3658
3532
  const { elm, data: { styleDecls }, } = vnode;
3659
3533
  if (isUndefined$1(styleDecls)) {
3660
3534
  return;
3661
3535
  }
3536
+ const { setCSSStyleProperty } = renderer;
3662
3537
  for (let i = 0; i < styleDecls.length; i++) {
3663
3538
  const [prop, value, important] = styleDecls[i];
3664
- setCSSStyleProperty$1(elm, prop, value, important);
3539
+ setCSSStyleProperty(elm, prop, value, important);
3665
3540
  }
3666
3541
  }
3667
3542
 
@@ -3671,15 +3546,16 @@ function applyStaticStyleAttribute(vnode) {
3671
3546
  * SPDX-License-Identifier: MIT
3672
3547
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3673
3548
  */
3674
- function patchChildren(c1, c2, parent) {
3549
+ function patchChildren(c1, c2, parent, renderer) {
3675
3550
  if (hasDynamicChildren(c2)) {
3676
- updateDynamicChildren(c1, c2, parent);
3551
+ updateDynamicChildren(c1, c2, parent, renderer);
3677
3552
  }
3678
3553
  else {
3679
- updateStaticChildren(c1, c2, parent);
3554
+ updateStaticChildren(c1, c2, parent, renderer);
3680
3555
  }
3681
3556
  }
3682
- function patch(n1, n2) {
3557
+ function patch(n1, n2, renderer) {
3558
+ var _a, _b;
3683
3559
  if (n1 === n2) {
3684
3560
  return;
3685
3561
  }
@@ -3693,80 +3569,115 @@ function patch(n1, n2) {
3693
3569
  }
3694
3570
  switch (n2.type) {
3695
3571
  case 0 /* Text */:
3696
- patchText(n1, n2);
3572
+ // VText has no special capability, fallback to the owner's renderer
3573
+ patchText(n1, n2, renderer);
3697
3574
  break;
3698
3575
  case 1 /* Comment */:
3699
- patchComment(n1, n2);
3576
+ // VComment has no special capability, fallback to the owner's renderer
3577
+ patchComment(n1, n2, renderer);
3578
+ break;
3579
+ case 4 /* Static */:
3580
+ n2.elm = n1.elm;
3700
3581
  break;
3701
3582
  case 2 /* Element */:
3702
- patchElement(n1, n2);
3583
+ patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3703
3584
  break;
3704
3585
  case 3 /* CustomElement */:
3705
- patchCustomElement(n1, n2);
3586
+ patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3706
3587
  break;
3707
3588
  }
3708
3589
  }
3709
- function mount(node, parent, anchor) {
3590
+ function mount(node, parent, renderer, anchor) {
3591
+ var _a, _b;
3710
3592
  switch (node.type) {
3711
3593
  case 0 /* Text */:
3712
- mountText(node, parent, anchor);
3594
+ // VText has no special capability, fallback to the owner's renderer
3595
+ mountText(node, parent, anchor, renderer);
3713
3596
  break;
3714
3597
  case 1 /* Comment */:
3715
- mountComment(node, parent, anchor);
3598
+ // VComment has no special capability, fallback to the owner's renderer
3599
+ mountComment(node, parent, anchor, renderer);
3600
+ break;
3601
+ case 4 /* Static */:
3602
+ // VStatic cannot have a custom renderer associated to them, using owner's renderer
3603
+ mountStatic(node, parent, anchor, renderer);
3716
3604
  break;
3717
3605
  case 2 /* Element */:
3718
- mountElement(node, parent, anchor);
3606
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3607
+ mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3719
3608
  break;
3720
3609
  case 3 /* CustomElement */:
3721
- mountCustomElement(node, parent, anchor);
3610
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3611
+ mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3722
3612
  break;
3723
3613
  }
3724
3614
  }
3725
- function patchText(n1, n2) {
3615
+ function patchText(n1, n2, renderer) {
3726
3616
  n2.elm = n1.elm;
3727
3617
  if (n2.text !== n1.text) {
3728
- updateTextContent(n2);
3618
+ updateTextContent(n2, renderer);
3729
3619
  }
3730
3620
  }
3731
- function mountText(node, parent, anchor) {
3732
- const { owner } = node;
3733
- const textNode = (node.elm = createText$1(node.text));
3734
- linkNodeToShadow(textNode, owner);
3735
- insertNode(textNode, parent, anchor);
3621
+ function mountText(vnode, parent, anchor, renderer) {
3622
+ const { owner } = vnode;
3623
+ const { createText } = renderer;
3624
+ const textNode = (vnode.elm = createText(vnode.text));
3625
+ linkNodeToShadow(textNode, owner, renderer);
3626
+ insertNode(textNode, parent, anchor, renderer);
3736
3627
  }
3737
- function patchComment(n1, n2) {
3628
+ function patchComment(n1, n2, renderer) {
3738
3629
  n2.elm = n1.elm;
3739
3630
  // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3740
3631
  // it is the case today.
3741
3632
  if (n2.text !== n1.text) {
3742
- updateTextContent(n2);
3633
+ updateTextContent(n2, renderer);
3743
3634
  }
3744
3635
  }
3745
- function mountComment(node, parent, anchor) {
3746
- const { owner } = node;
3747
- const commentNode = (node.elm = createComment$1(node.text));
3748
- linkNodeToShadow(commentNode, owner);
3749
- insertNode(commentNode, parent, anchor);
3636
+ function mountComment(vnode, parent, anchor, renderer) {
3637
+ const { owner } = vnode;
3638
+ const { createComment } = renderer;
3639
+ const commentNode = (vnode.elm = createComment(vnode.text));
3640
+ linkNodeToShadow(commentNode, owner, renderer);
3641
+ insertNode(commentNode, parent, anchor, renderer);
3750
3642
  }
3751
- function mountElement(vnode, parent, anchor) {
3643
+ function mountElement(vnode, parent, anchor, renderer) {
3752
3644
  const { sel, owner, data: { svg }, } = vnode;
3645
+ const { createElement } = renderer;
3753
3646
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3754
- const elm = createElement$1(sel, namespace);
3755
- linkNodeToShadow(elm, owner);
3756
- fallbackElmHook(elm, vnode);
3647
+ const elm = createElement(sel, namespace);
3648
+ linkNodeToShadow(elm, owner, renderer);
3649
+ fallbackElmHook(elm, vnode, renderer);
3757
3650
  vnode.elm = elm;
3758
- patchElementPropsAndAttrs$1(null, vnode);
3759
- insertNode(elm, parent, anchor);
3760
- mountVNodes(vnode.children, elm, null);
3651
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3652
+ insertNode(elm, parent, anchor, renderer);
3653
+ mountVNodes(vnode.children, elm, renderer, null);
3761
3654
  }
3762
- function patchElement(n1, n2) {
3655
+ function patchElement(n1, n2, renderer) {
3763
3656
  const elm = (n2.elm = n1.elm);
3764
- patchElementPropsAndAttrs$1(n1, n2);
3765
- patchChildren(n1.children, n2.children, elm);
3657
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3658
+ patchChildren(n1.children, n2.children, elm, renderer);
3659
+ }
3660
+ function mountStatic(vnode, parent, anchor, renderer) {
3661
+ const { owner } = vnode;
3662
+ const { cloneNode, isSyntheticShadowDefined } = renderer;
3663
+ const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3664
+ linkNodeToShadow(elm, owner, renderer);
3665
+ // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3666
+ const { renderMode, shadowMode } = owner;
3667
+ if (isSyntheticShadowDefined) {
3668
+ if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
3669
+ elm[KEY__SHADOW_STATIC] = true;
3670
+ }
3671
+ }
3672
+ if (process.env.NODE_ENV !== 'production') {
3673
+ const isLight = renderMode === 0 /* Light */;
3674
+ patchElementWithRestrictions(elm, { isPortal: false, isLight });
3675
+ }
3676
+ insertNode(elm, parent, anchor, renderer);
3766
3677
  }
3767
- function mountCustomElement(vnode, parent, anchor) {
3678
+ function mountCustomElement(vnode, parent, anchor, renderer) {
3768
3679
  const { sel, owner } = vnode;
3769
- const UpgradableConstructor = getUpgradableConstructor(sel);
3680
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
3770
3681
  /**
3771
3682
  * Note: if the upgradable constructor does not expect, or throw when we new it
3772
3683
  * with a callback as the first argument, we could implement a more advanced
@@ -3776,9 +3687,9 @@ function mountCustomElement(vnode, parent, anchor) {
3776
3687
  let vm;
3777
3688
  const elm = new UpgradableConstructor((elm) => {
3778
3689
  // the custom element from the registry is expecting an upgrade callback
3779
- vm = createViewModelHook(elm, vnode);
3690
+ vm = createViewModelHook(elm, vnode, renderer);
3780
3691
  });
3781
- linkNodeToShadow(elm, owner);
3692
+ linkNodeToShadow(elm, owner, renderer);
3782
3693
  vnode.elm = elm;
3783
3694
  vnode.vm = vm;
3784
3695
  if (vm) {
@@ -3787,23 +3698,23 @@ function mountCustomElement(vnode, parent, anchor) {
3787
3698
  else if (vnode.ctor !== UpgradableConstructor) {
3788
3699
  throw new TypeError(`Incorrect Component Constructor`);
3789
3700
  }
3790
- patchElementPropsAndAttrs$1(null, vnode);
3791
- insertNode(elm, parent, anchor);
3701
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3702
+ insertNode(elm, parent, anchor, renderer);
3792
3703
  if (vm) {
3793
3704
  if (process.env.NODE_ENV !== 'production') {
3794
3705
  assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
3795
3706
  }
3796
3707
  runConnectedCallback(vm);
3797
3708
  }
3798
- mountVNodes(vnode.children, elm, null);
3709
+ mountVNodes(vnode.children, elm, renderer, null);
3799
3710
  if (vm) {
3800
3711
  appendVM(vm);
3801
3712
  }
3802
3713
  }
3803
- function patchCustomElement(n1, n2) {
3714
+ function patchCustomElement(n1, n2, renderer) {
3804
3715
  const elm = (n2.elm = n1.elm);
3805
3716
  const vm = (n2.vm = n1.vm);
3806
- patchElementPropsAndAttrs$1(n1, n2);
3717
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3807
3718
  if (!isUndefined$1(vm)) {
3808
3719
  // in fallback mode, the allocation will always set children to
3809
3720
  // empty and delegate the real allocation to the slot elements
@@ -3811,34 +3722,36 @@ function patchCustomElement(n1, n2) {
3811
3722
  }
3812
3723
  // in fallback mode, the children will be always empty, so, nothing
3813
3724
  // will happen, but in native, it does allocate the light dom
3814
- patchChildren(n1.children, n2.children, elm);
3725
+ patchChildren(n1.children, n2.children, elm, renderer);
3815
3726
  if (!isUndefined$1(vm)) {
3816
3727
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
3817
3728
  // this is important to preserve the top to bottom synchronous rendering phase.
3818
3729
  rerenderVM(vm);
3819
3730
  }
3820
3731
  }
3821
- function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
3732
+ function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
3822
3733
  for (; start < end; ++start) {
3823
3734
  const vnode = vnodes[start];
3824
3735
  if (isVNode(vnode)) {
3825
- mount(vnode, parent, anchor);
3736
+ mount(vnode, parent, renderer, anchor);
3826
3737
  }
3827
3738
  }
3828
3739
  }
3829
- function unmount(vnode, parent, doRemove = false) {
3740
+ function unmount(vnode, parent, renderer, doRemove = false) {
3830
3741
  const { type, elm, sel } = vnode;
3831
3742
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3832
3743
  // subtree root, is the only element worth unmounting from the subtree.
3833
3744
  if (doRemove) {
3834
- removeNode(elm, parent);
3745
+ // The vnode might or might not have a data.renderer associated to it
3746
+ // but the removal used here is from the owner instead.
3747
+ removeNode(elm, parent, renderer);
3835
3748
  }
3836
3749
  switch (type) {
3837
3750
  case 2 /* Element */: {
3838
3751
  // Slot content is removed to trigger slotchange event when removing slot.
3839
3752
  // Only required for synthetic shadow.
3840
- const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3841
- unmountVNodes(vnode.children, elm, removeChildren);
3753
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3754
+ unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
3842
3755
  break;
3843
3756
  }
3844
3757
  case 3 /* CustomElement */: {
@@ -3851,11 +3764,11 @@ function unmount(vnode, parent, doRemove = false) {
3851
3764
  }
3852
3765
  }
3853
3766
  }
3854
- function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
3767
+ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
3855
3768
  for (; start < end; ++start) {
3856
3769
  const ch = vnodes[start];
3857
3770
  if (isVNode(ch)) {
3858
- unmount(ch, parent, doRemove);
3771
+ unmount(ch, parent, renderer, doRemove);
3859
3772
  }
3860
3773
  }
3861
3774
  }
@@ -3869,66 +3782,71 @@ function setElementShadowToken(elm, token) {
3869
3782
  elm.$shadowToken$ = token;
3870
3783
  }
3871
3784
  // Set the scope token class for *.scoped.css styles
3872
- function setScopeTokenClassIfNecessary(elm, owner) {
3785
+ function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3873
3786
  const { cmpTemplate, context } = owner;
3787
+ const { getClassList } = renderer;
3874
3788
  const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3875
3789
  if (!isUndefined$1(token) && context.hasScopedStyles) {
3876
- getClassList$1(elm).add(token);
3790
+ // TODO [#2762]: this dot notation with add is probably problematic
3791
+ // probably we should have a renderer api for just the add operation
3792
+ getClassList(elm).add(token);
3877
3793
  }
3878
3794
  }
3879
- function linkNodeToShadow(elm, owner) {
3795
+ function linkNodeToShadow(elm, owner, renderer) {
3880
3796
  const { renderRoot, renderMode, shadowMode } = owner;
3797
+ const { isSyntheticShadowDefined } = renderer;
3881
3798
  // TODO [#1164]: this should eventually be done by the polyfill directly
3882
- if (isSyntheticShadowDefined$1) {
3799
+ if (isSyntheticShadowDefined) {
3883
3800
  if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
3884
3801
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
3885
3802
  }
3886
3803
  }
3887
3804
  }
3888
- function updateTextContent(vnode) {
3805
+ function updateTextContent(vnode, renderer) {
3889
3806
  const { elm, text } = vnode;
3807
+ const { setText } = renderer;
3890
3808
  if (process.env.NODE_ENV !== 'production') {
3891
3809
  unlockDomMutation();
3892
3810
  }
3893
- setText$1(elm, text);
3811
+ setText(elm, text);
3894
3812
  if (process.env.NODE_ENV !== 'production') {
3895
3813
  lockDomMutation();
3896
3814
  }
3897
3815
  }
3898
- function insertNode(node, parent, anchor) {
3816
+ function insertNode(node, parent, anchor, renderer) {
3899
3817
  if (process.env.NODE_ENV !== 'production') {
3900
3818
  unlockDomMutation();
3901
3819
  }
3902
- insert$1(node, parent, anchor);
3820
+ renderer.insert(node, parent, anchor);
3903
3821
  if (process.env.NODE_ENV !== 'production') {
3904
3822
  lockDomMutation();
3905
3823
  }
3906
3824
  }
3907
- function removeNode(node, parent) {
3825
+ function removeNode(node, parent, renderer) {
3908
3826
  if (process.env.NODE_ENV !== 'production') {
3909
3827
  unlockDomMutation();
3910
3828
  }
3911
- remove$1(node, parent);
3829
+ renderer.remove(node, parent);
3912
3830
  if (process.env.NODE_ENV !== 'production') {
3913
3831
  lockDomMutation();
3914
3832
  }
3915
3833
  }
3916
- function patchElementPropsAndAttrs$1(oldVnode, vnode) {
3834
+ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3917
3835
  if (isNull(oldVnode)) {
3918
- applyEventListeners(vnode);
3919
- applyStaticClassAttribute(vnode);
3920
- applyStaticStyleAttribute(vnode);
3836
+ applyEventListeners(vnode, renderer);
3837
+ applyStaticClassAttribute(vnode, renderer);
3838
+ applyStaticStyleAttribute(vnode, renderer);
3921
3839
  }
3922
3840
  // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
3923
3841
  // value is set before type=radio.
3924
- patchClassAttribute(oldVnode, vnode);
3925
- patchStyleAttribute(oldVnode, vnode);
3926
- patchAttributes(oldVnode, vnode);
3927
- patchProps(oldVnode, vnode);
3842
+ patchClassAttribute(oldVnode, vnode, renderer);
3843
+ patchStyleAttribute(oldVnode, vnode, renderer);
3844
+ patchAttributes(oldVnode, vnode, renderer);
3845
+ patchProps(oldVnode, vnode, renderer);
3928
3846
  }
3929
- function fallbackElmHook(elm, vnode) {
3847
+ function fallbackElmHook(elm, vnode, renderer) {
3930
3848
  const { owner } = vnode;
3931
- setScopeTokenClassIfNecessary(elm, owner);
3849
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
3932
3850
  if (owner.shadowMode === 1 /* Synthetic */) {
3933
3851
  const { data: { context }, } = vnode;
3934
3852
  const { stylesheetToken } = owner.context;
@@ -3976,7 +3894,7 @@ function allocateChildren(vnode, vm) {
3976
3894
  vnode.children = EmptyArray;
3977
3895
  }
3978
3896
  }
3979
- function createViewModelHook(elm, vnode) {
3897
+ function createViewModelHook(elm, vnode, renderer) {
3980
3898
  let vm = getAssociatedVMIfPresent(elm);
3981
3899
  // There is a possibility that a custom element is registered under tagName, in which case, the
3982
3900
  // initialization is already carry on, and there is nothing else to do here since this hook is
@@ -3985,7 +3903,7 @@ function createViewModelHook(elm, vnode) {
3985
3903
  return vm;
3986
3904
  }
3987
3905
  const { sel, mode, ctor, owner } = vnode;
3988
- setScopeTokenClassIfNecessary(elm, owner);
3906
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
3989
3907
  if (owner.shadowMode === 1 /* Synthetic */) {
3990
3908
  const { stylesheetToken } = owner.context;
3991
3909
  // when running in synthetic shadow mode, we need to set the shadowToken value
@@ -3994,7 +3912,7 @@ function createViewModelHook(elm, vnode) {
3994
3912
  setElementShadowToken(elm, stylesheetToken);
3995
3913
  }
3996
3914
  }
3997
- vm = createVM(elm, ctor, {
3915
+ vm = createVM(elm, ctor, renderer, {
3998
3916
  mode,
3999
3917
  owner,
4000
3918
  tagName: sel,
@@ -4069,7 +3987,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
4069
3987
  }
4070
3988
  return map;
4071
3989
  }
4072
- function updateDynamicChildren(oldCh, newCh, parent) {
3990
+ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4073
3991
  let oldStartIdx = 0;
4074
3992
  let newStartIdx = 0;
4075
3993
  let oldEndIdx = oldCh.length - 1;
@@ -4098,26 +4016,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
4098
4016
  newEndVnode = newCh[--newEndIdx];
4099
4017
  }
4100
4018
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
4101
- patch(oldStartVnode, newStartVnode);
4019
+ patch(oldStartVnode, newStartVnode, renderer);
4102
4020
  oldStartVnode = oldCh[++oldStartIdx];
4103
4021
  newStartVnode = newCh[++newStartIdx];
4104
4022
  }
4105
4023
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
4106
- patch(oldEndVnode, newEndVnode);
4024
+ patch(oldEndVnode, newEndVnode, renderer);
4107
4025
  oldEndVnode = oldCh[--oldEndIdx];
4108
4026
  newEndVnode = newCh[--newEndIdx];
4109
4027
  }
4110
4028
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
4111
4029
  // Vnode moved right
4112
- patch(oldStartVnode, newEndVnode);
4113
- insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
4030
+ patch(oldStartVnode, newEndVnode, renderer);
4031
+ insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4114
4032
  oldStartVnode = oldCh[++oldStartIdx];
4115
4033
  newEndVnode = newCh[--newEndIdx];
4116
4034
  }
4117
4035
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
4118
4036
  // Vnode moved left
4119
- patch(oldEndVnode, newStartVnode);
4120
- insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
4037
+ patch(oldEndVnode, newStartVnode, renderer);
4038
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4121
4039
  oldEndVnode = oldCh[--oldEndIdx];
4122
4040
  newStartVnode = newCh[++newStartIdx];
4123
4041
  }
@@ -4128,7 +4046,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
4128
4046
  idxInOld = oldKeyToIdx[newStartVnode.key];
4129
4047
  if (isUndefined$1(idxInOld)) {
4130
4048
  // New element
4131
- mount(newStartVnode, parent, oldStartVnode.elm);
4049
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4132
4050
  newStartVnode = newCh[++newStartIdx];
4133
4051
  }
4134
4052
  else {
@@ -4136,10 +4054,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
4136
4054
  if (isVNode(elmToMove)) {
4137
4055
  if (elmToMove.sel !== newStartVnode.sel) {
4138
4056
  // New element
4139
- mount(newStartVnode, parent, oldStartVnode.elm);
4057
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4140
4058
  }
4141
4059
  else {
4142
- patch(elmToMove, newStartVnode);
4060
+ patch(elmToMove, newStartVnode, renderer);
4143
4061
  // Delete the old child, but copy the array since it is read-only.
4144
4062
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4145
4063
  // so we only care about the `oldCh` object inside this function.
@@ -4151,7 +4069,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
4151
4069
  }
4152
4070
  // We've already cloned at least once, so it's no longer read-only
4153
4071
  oldCh[idxInOld] = undefined;
4154
- insertNode(elmToMove.elm, parent, oldStartVnode.elm);
4072
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4155
4073
  }
4156
4074
  }
4157
4075
  newStartVnode = newCh[++newStartIdx];
@@ -4168,25 +4086,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
4168
4086
  n = newCh[++i];
4169
4087
  } while (!isVNode(n) && i < newChEnd);
4170
4088
  before = isVNode(n) ? n.elm : null;
4171
- mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
4089
+ mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4172
4090
  }
4173
4091
  else {
4174
- unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
4092
+ unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
4175
4093
  }
4176
4094
  }
4177
4095
  }
4178
- function updateStaticChildren(c1, c2, parent) {
4096
+ function updateStaticChildren(c1, c2, parent, renderer) {
4179
4097
  const c1Length = c1.length;
4180
4098
  const c2Length = c2.length;
4181
4099
  if (c1Length === 0) {
4182
4100
  // the old list is empty, we can directly insert anything new
4183
- mountVNodes(c2, parent, null);
4101
+ mountVNodes(c2, parent, renderer, null);
4184
4102
  return;
4185
4103
  }
4186
4104
  if (c2Length === 0) {
4187
4105
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4188
4106
  // this is the case in which the dynamic children of an if-directive should be removed
4189
- unmountVNodes(c1, parent, true);
4107
+ unmountVNodes(c1, parent, renderer, true);
4190
4108
  return;
4191
4109
  }
4192
4110
  // if the old list is not empty, the new list MUST have the same
@@ -4199,16 +4117,16 @@ function updateStaticChildren(c1, c2, parent) {
4199
4117
  if (isVNode(n1)) {
4200
4118
  if (isVNode(n2)) {
4201
4119
  // both vnodes are equivalent, and we just need to patch them
4202
- patch(n1, n2);
4120
+ patch(n1, n2, renderer);
4203
4121
  anchor = n2.elm;
4204
4122
  }
4205
4123
  else {
4206
4124
  // removing the old vnode since the new one is null
4207
- unmount(n1, parent, true);
4125
+ unmount(n1, parent, renderer, true);
4208
4126
  }
4209
4127
  }
4210
4128
  else if (isVNode(n2)) {
4211
- mount(n2, parent, anchor);
4129
+ mount(n2, parent, renderer, anchor);
4212
4130
  anchor = n2.elm;
4213
4131
  }
4214
4132
  }
@@ -4225,6 +4143,17 @@ const SymbolIterator = Symbol.iterator;
4225
4143
  function addVNodeToChildLWC(vnode) {
4226
4144
  ArrayPush$1.call(getVMBeingRendered().velements, vnode);
4227
4145
  }
4146
+ // [st]atic node
4147
+ function st(fragment, key) {
4148
+ return {
4149
+ type: 4 /* Static */,
4150
+ sel: undefined,
4151
+ key,
4152
+ elm: undefined,
4153
+ fragment,
4154
+ owner: getVMBeingRendered(),
4155
+ };
4156
+ }
4228
4157
  // [h]tml node
4229
4158
  function h(sel, data, children = EmptyArray) {
4230
4159
  const vmBeingRendered = getVMBeingRendered();
@@ -4614,6 +4543,7 @@ const api = freeze({
4614
4543
  co,
4615
4544
  dc,
4616
4545
  ti,
4546
+ st,
4617
4547
  gid,
4618
4548
  fid,
4619
4549
  shc,
@@ -4637,7 +4567,7 @@ function createInlineStyleVNode(content) {
4637
4567
  }, [api.t(content)]);
4638
4568
  }
4639
4569
  function updateStylesheetToken(vm, template) {
4640
- const { elm, context, renderMode, shadowMode } = vm;
4570
+ const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
4641
4571
  const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
4642
4572
  const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
4643
4573
  const { hasScopedStyles } = context;
@@ -4648,10 +4578,10 @@ function updateStylesheetToken(vm, template) {
4648
4578
  const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
4649
4579
  if (!isUndefined$1(oldToken)) {
4650
4580
  if (oldHasTokenInClass) {
4651
- getClassList$1(elm).remove(makeHostToken(oldToken));
4581
+ getClassList(elm).remove(makeHostToken(oldToken));
4652
4582
  }
4653
4583
  if (oldHasTokenInAttribute) {
4654
- removeAttribute$1(elm, makeHostToken(oldToken));
4584
+ removeAttribute(elm, makeHostToken(oldToken));
4655
4585
  }
4656
4586
  }
4657
4587
  // Apply the new template styling token to the host element, if the new template has any
@@ -4662,11 +4592,11 @@ function updateStylesheetToken(vm, template) {
4662
4592
  // Set the new styling token on the host element
4663
4593
  if (!isUndefined$1(newToken)) {
4664
4594
  if (hasScopedStyles) {
4665
- getClassList$1(elm).add(makeHostToken(newToken));
4595
+ getClassList(elm).add(makeHostToken(newToken));
4666
4596
  newHasTokenInClass = true;
4667
4597
  }
4668
4598
  if (isSyntheticShadow) {
4669
- setAttribute$1(elm, makeHostToken(newToken), '');
4599
+ setAttribute(elm, makeHostToken(newToken), '');
4670
4600
  newHasTokenInAttribute = true;
4671
4601
  }
4672
4602
  }
@@ -4754,19 +4684,18 @@ function getNearestNativeShadowComponent(vm) {
4754
4684
  return owner;
4755
4685
  }
4756
4686
  function createStylesheet(vm, stylesheets) {
4757
- const { renderMode, shadowMode } = vm;
4687
+ const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
4758
4688
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4759
4689
  for (let i = 0; i < stylesheets.length; i++) {
4760
- insertStylesheet$1(stylesheets[i]);
4690
+ insertStylesheet(stylesheets[i]);
4761
4691
  }
4762
4692
  }
4763
- else if (ssr$1 || vm.hydrated) {
4693
+ else if (ssr || vm.hydrated) {
4764
4694
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4765
4695
  // This works in the client, because the stylesheets are created, and cached in the VM
4766
4696
  // the first time the VM renders.
4767
4697
  // native shadow or light DOM, SSR
4768
- const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
4769
- return createInlineStyleVNode(combinedStylesheetContent);
4698
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
4770
4699
  }
4771
4700
  else {
4772
4701
  // native shadow or light DOM, DOM renderer
@@ -4774,7 +4703,7 @@ function createStylesheet(vm, stylesheets) {
4774
4703
  // null root means a global style
4775
4704
  const target = isNull(root) ? undefined : root.shadowRoot;
4776
4705
  for (let i = 0; i < stylesheets.length; i++) {
4777
- insertStylesheet$1(stylesheets[i], target);
4706
+ insertStylesheet(stylesheets[i], target);
4778
4707
  }
4779
4708
  }
4780
4709
  return null;
@@ -4900,6 +4829,54 @@ function validateLightDomTemplate(template, vm) {
4900
4829
  assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
4901
4830
  }
4902
4831
  }
4832
+ function buildParseFragmentFn(createFragmentFn) {
4833
+ return (strings, ...keys) => {
4834
+ const cache = create(null);
4835
+ return function () {
4836
+ const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
4837
+ const hasStyleToken = !isUndefined$1(stylesheetToken);
4838
+ const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
4839
+ let cacheKey = 0;
4840
+ if (hasStyleToken && hasScopedStyles) {
4841
+ cacheKey |= 1 /* HAS_SCOPED_STYLE */;
4842
+ }
4843
+ if (hasStyleToken && isSyntheticShadow) {
4844
+ cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
4845
+ }
4846
+ if (!isUndefined$1(cache[cacheKey])) {
4847
+ return cache[cacheKey];
4848
+ }
4849
+ const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
4850
+ const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
4851
+ const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
4852
+ let htmlFragment = '';
4853
+ for (let i = 0, n = keys.length; i < n; i++) {
4854
+ switch (keys[i]) {
4855
+ case 0: // styleToken in existing class attr
4856
+ htmlFragment += strings[i] + classToken;
4857
+ break;
4858
+ case 1: // styleToken for added class attr
4859
+ htmlFragment += strings[i] + classAttrToken;
4860
+ break;
4861
+ case 2: // styleToken as attr
4862
+ htmlFragment += strings[i] + attrToken;
4863
+ break;
4864
+ case 3: // ${1}${2}
4865
+ htmlFragment += strings[i] + classAttrToken + attrToken;
4866
+ break;
4867
+ }
4868
+ }
4869
+ htmlFragment += strings[strings.length - 1];
4870
+ cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
4871
+ return cache[cacheKey];
4872
+ };
4873
+ };
4874
+ }
4875
+ // Note: at the moment this code executes, we don't have a renderer yet.
4876
+ const parseFragment = buildParseFragmentFn((html, renderer) => {
4877
+ const { createFragment } = renderer;
4878
+ return createFragment(html);
4879
+ });
4903
4880
  function evaluateTemplate(vm, html) {
4904
4881
  if (process.env.NODE_ENV !== 'production') {
4905
4882
  assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
@@ -4946,7 +4923,7 @@ function evaluateTemplate(vm, html) {
4946
4923
  // Evaluate, create stylesheet and cache the produced VNode for future
4947
4924
  // re-rendering.
4948
4925
  const stylesheetsContent = getStylesheetsContent(vm, html);
4949
- context.styleVNode =
4926
+ context.styleVNodes =
4950
4927
  stylesheetsContent.length === 0
4951
4928
  ? null
4952
4929
  : createStylesheet(vm, stylesheetsContent);
@@ -4963,9 +4940,9 @@ function evaluateTemplate(vm, html) {
4963
4940
  // Set the global flag that template is being updated
4964
4941
  isUpdatingTemplate = true;
4965
4942
  vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
4966
- const { styleVNode } = context;
4967
- if (!isNull(styleVNode)) {
4968
- ArrayUnshift.call(vnodes, styleVNode);
4943
+ const { styleVNodes } = context;
4944
+ if (!isNull(styleVNodes)) {
4945
+ ArrayUnshift.apply(vnodes, styleVNodes);
4969
4946
  }
4970
4947
  });
4971
4948
  }, () => {
@@ -5295,7 +5272,7 @@ function getNearestShadowAncestor(vm) {
5295
5272
  return ancestor;
5296
5273
  }
5297
5274
 
5298
- function createVM(elm, ctor, options) {
5275
+ function createVM(elm, ctor, renderer, options) {
5299
5276
  const {
5300
5277
  mode,
5301
5278
  owner,
@@ -5330,7 +5307,7 @@ function createVM(elm, ctor, options) {
5330
5307
  hasTokenInClass: undefined,
5331
5308
  hasTokenInAttribute: undefined,
5332
5309
  hasScopedStyles: undefined,
5333
- styleVNode: null,
5310
+ styleVNodes: null,
5334
5311
  tplCache: EmptyObject,
5335
5312
  wiredConnecting: EmptyArray,
5336
5313
  wiredDisconnecting: EmptyArray
@@ -5344,9 +5321,10 @@ function createVM(elm, ctor, options) {
5344
5321
  renderRoot: null,
5345
5322
  callHook,
5346
5323
  setHook,
5347
- getHook
5324
+ getHook,
5325
+ renderer
5348
5326
  };
5349
- vm.shadowMode = computeShadowMode(vm);
5327
+ vm.shadowMode = computeShadowMode(vm, renderer);
5350
5328
  vm.tro = getTemplateReactiveObserver(vm);
5351
5329
 
5352
5330
  if (process.env.NODE_ENV !== 'production') {
@@ -5371,13 +5349,17 @@ function createVM(elm, ctor, options) {
5371
5349
  return vm;
5372
5350
  }
5373
5351
 
5374
- function computeShadowMode(vm) {
5352
+ function computeShadowMode(vm, renderer) {
5375
5353
  const {
5376
5354
  def
5377
5355
  } = vm;
5356
+ const {
5357
+ isSyntheticShadowDefined,
5358
+ isNativeShadowDefined
5359
+ } = renderer;
5378
5360
  let shadowMode;
5379
5361
 
5380
- if (isSyntheticShadowDefined$1) {
5362
+ if (isSyntheticShadowDefined) {
5381
5363
  if (def.renderMode === 0
5382
5364
  /* Light */
5383
5365
  ) {
@@ -5386,7 +5368,7 @@ function computeShadowMode(vm) {
5386
5368
  shadowMode = 0
5387
5369
  /* Native */
5388
5370
  ;
5389
- } else if (isNativeShadowDefined$1) {
5371
+ } else if (isNativeShadowDefined) {
5390
5372
  // Not combined with above condition because @lwc/features only supports identifiers in
5391
5373
  // the if-condition.
5392
5374
  if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
@@ -5476,7 +5458,8 @@ function rehydrate(vm) {
5476
5458
  function patchShadowRoot(vm, newCh) {
5477
5459
  const {
5478
5460
  renderRoot,
5479
- children: oldCh
5461
+ children: oldCh,
5462
+ renderer
5480
5463
  } = vm; // caching the new children collection
5481
5464
 
5482
5465
  vm.children = newCh;
@@ -5492,7 +5475,7 @@ function patchShadowRoot(vm, newCh) {
5492
5475
  , vm);
5493
5476
  }, () => {
5494
5477
  // job
5495
- patchChildren(oldCh, newCh, renderRoot);
5478
+ patchChildren(oldCh, newCh, renderRoot, renderer);
5496
5479
  }, () => {
5497
5480
  // post
5498
5481
  logOperationEnd(2
@@ -5517,10 +5500,13 @@ function runRenderedCallback(vm) {
5517
5500
  const {
5518
5501
  def: {
5519
5502
  renderedCallback
5503
+ },
5504
+ renderer: {
5505
+ ssr
5520
5506
  }
5521
5507
  } = vm;
5522
5508
 
5523
- if (isTrue(ssr$1)) {
5509
+ if (isTrue(ssr)) {
5524
5510
  return;
5525
5511
  }
5526
5512
 
@@ -5754,14 +5740,17 @@ function recursivelyDisconnectChildren(vnodes) {
5754
5740
  function resetComponentRoot(vm) {
5755
5741
  const {
5756
5742
  children,
5757
- renderRoot
5743
+ renderRoot,
5744
+ renderer: {
5745
+ remove
5746
+ }
5758
5747
  } = vm;
5759
5748
 
5760
5749
  for (let i = 0, len = children.length; i < len; i++) {
5761
5750
  const child = children[i];
5762
5751
 
5763
5752
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5764
- remove$1(child.elm, renderRoot);
5753
+ remove(child.elm, renderRoot);
5765
5754
  }
5766
5755
  }
5767
5756
 
@@ -5770,7 +5759,13 @@ function resetComponentRoot(vm) {
5770
5759
  vm.velements = EmptyArray;
5771
5760
  }
5772
5761
  function scheduleRehydration(vm) {
5773
- if (isTrue(ssr$1) || isTrue(vm.isScheduled)) {
5762
+ const {
5763
+ renderer: {
5764
+ ssr
5765
+ }
5766
+ } = vm;
5767
+
5768
+ if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5774
5769
  return;
5775
5770
  }
5776
5771
 
@@ -5929,6 +5924,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
5929
5924
  context: {
5930
5925
  wiredConnecting,
5931
5926
  wiredDisconnecting
5927
+ },
5928
+ renderer: {
5929
+ dispatchEvent
5932
5930
  }
5933
5931
  } = vm; // waiting for the component to be connected to formally request the context via the token
5934
5932
 
@@ -5952,7 +5950,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
5952
5950
  }
5953
5951
 
5954
5952
  });
5955
- dispatchEvent$1(elm, contextRegistrationEvent);
5953
+ dispatchEvent(elm, contextRegistrationEvent);
5956
5954
  });
5957
5955
  }
5958
5956
 
@@ -6292,7 +6290,7 @@ function freezeTemplate(tmpl) {
6292
6290
  });
6293
6291
  }
6294
6292
  }
6295
- /* version: 2.14.1 */
6293
+ /* version: 2.16.0 */
6296
6294
 
6297
6295
  /*
6298
6296
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6365,6 +6363,9 @@ class HTMLElementImpl {
6365
6363
  }
6366
6364
  }
6367
6365
  const ssr = true;
6366
+ function isHydrating() {
6367
+ return false;
6368
+ }
6368
6369
  const isNativeShadowDefined = false;
6369
6370
  const isSyntheticShadowDefined = false;
6370
6371
  function insert(node, parent, anchor) {
@@ -6385,6 +6386,16 @@ function remove(node, parent) {
6385
6386
  const nodeIndex = parent.children.indexOf(node);
6386
6387
  parent.children.splice(nodeIndex, 1);
6387
6388
  }
6389
+ function cloneNode(node) {
6390
+ return node;
6391
+ }
6392
+ function createFragment(html) {
6393
+ return {
6394
+ type: HostNodeType.Raw,
6395
+ parent: null,
6396
+ value: html,
6397
+ };
6398
+ }
6388
6399
  function createText(content) {
6389
6400
  return {
6390
6401
  type: HostNodeType.Text,
@@ -6591,68 +6602,49 @@ function getCustomElement(name) {
6591
6602
  const HTMLElementExported = HTMLElementImpl;
6592
6603
  /* noop */
6593
6604
  const assertInstanceOfHTMLElement = noop;
6594
-
6595
- /*
6596
- * Copyright (c) 2020, 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
- setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElement);
6602
- setAttachShadow(attachShadow);
6603
- setCreateComment(createComment);
6604
- setCreateElement(createElement);
6605
- setCreateText(createText);
6606
- setDefineCustomElement(defineCustomElement);
6607
- setDispatchEvent(dispatchEvent);
6608
- setGetAttribute(getAttribute);
6609
- setGetBoundingClientRect(getBoundingClientRect);
6610
- setGetChildNodes(getChildNodes);
6611
- setGetChildren(getChildren);
6612
- setGetClassList(getClassList);
6613
- setGetCustomElement(getCustomElement);
6614
- setGetElementsByClassName(getElementsByClassName);
6615
- setGetElementsByTagName(getElementsByTagName);
6616
- setGetFirstChild(getFirstChild);
6617
- setGetFirstElementChild(getFirstElementChild);
6618
- setGetLastChild(getLastChild);
6619
- setGetLastElementChild(getLastElementChild);
6620
- setGetProperty(getProperty);
6621
- setHTMLElement(HTMLElementExported);
6622
- setInsert(insert);
6623
- setIsConnected(isConnected);
6624
- setIsNativeShadowDefined(isNativeShadowDefined);
6625
- setIsSyntheticShadowDefined(isSyntheticShadowDefined);
6626
- setNextSibling(nextSibling);
6627
- setQuerySelector(querySelector);
6628
- setQuerySelectorAll(querySelectorAll);
6629
- setRemove(remove);
6630
- setRemoveAttribute(removeAttribute);
6631
- setRemoveEventListener(removeEventListener);
6632
- setSetAttribute(setAttribute);
6633
- setSetCSSStyleProperty(setCSSStyleProperty);
6634
- setSetProperty(setProperty);
6635
- setSetText(setText);
6636
- setSsr(ssr);
6637
- setAddEventListener(addEventListener);
6638
- setInsertStylesheet(insertStylesheet);
6639
-
6640
- /*
6641
- * Copyright (c) 2020, salesforce.com, inc.
6642
- * All rights reserved.
6643
- * SPDX-License-Identifier: MIT
6644
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6645
- */
6646
- const ESCAPED_CHARS = {
6647
- '"': '&quot;',
6648
- "'": '&#x27;',
6649
- '<': '&lt;',
6650
- '>': '&gt;',
6651
- '&': '&amp;',
6605
+ const renderer = {
6606
+ ssr,
6607
+ isNativeShadowDefined,
6608
+ isSyntheticShadowDefined,
6609
+ HTMLElementExported,
6610
+ isHydrating,
6611
+ insert,
6612
+ remove,
6613
+ cloneNode,
6614
+ createFragment,
6615
+ createElement,
6616
+ createText,
6617
+ createComment,
6618
+ nextSibling,
6619
+ attachShadow,
6620
+ getProperty,
6621
+ setProperty,
6622
+ setText,
6623
+ getAttribute,
6624
+ setAttribute,
6625
+ removeAttribute,
6626
+ addEventListener,
6627
+ removeEventListener,
6628
+ dispatchEvent,
6629
+ getClassList,
6630
+ setCSSStyleProperty,
6631
+ getBoundingClientRect,
6632
+ querySelector,
6633
+ querySelectorAll,
6634
+ getElementsByTagName,
6635
+ getElementsByClassName,
6636
+ getChildren,
6637
+ getChildNodes,
6638
+ getFirstChild,
6639
+ getFirstElementChild,
6640
+ getLastChild,
6641
+ getLastElementChild,
6642
+ isConnected,
6643
+ insertStylesheet,
6644
+ assertInstanceOfHTMLElement,
6645
+ defineCustomElement,
6646
+ getCustomElement,
6652
6647
  };
6653
- function htmlEscape(str) {
6654
- return str.replace(/["'<>&]/g, (char) => ESCAPED_CHARS[char]);
6655
- }
6656
6648
 
6657
6649
  /*
6658
6650
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6729,8 +6721,8 @@ function renderComponent(tagName, Ctor, props = {}) {
6729
6721
  if (!isObject(props) || isNull(props)) {
6730
6722
  throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
6731
6723
  }
6732
- const element = createElement(tagName);
6733
- createVM(element, Ctor, {
6724
+ const element = renderer.createElement(tagName);
6725
+ createVM(element, Ctor, renderer, {
6734
6726
  mode: 'open',
6735
6727
  owner: null,
6736
6728
  tagName,
@@ -6751,6 +6743,6 @@ function renderComponent(tagName, Ctor, props = {}) {
6751
6743
  */
6752
6744
  freeze(LightningElement);
6753
6745
  seal(LightningElement.prototype);
6754
- /* version: 2.14.1 */
6746
+ /* version: 2.16.0 */
6755
6747
 
6756
- export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
6748
+ export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };