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
@@ -233,6 +233,7 @@ var LWC = (function (exports) {
233
233
  */
234
234
  const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
235
235
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
236
+ const KEY__SHADOW_STATIC = '$shadowStaticNode$';
236
237
  const KEY__SHADOW_TOKEN = '$shadowToken$';
237
238
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
238
239
  const KEY__SCOPED_CSS = '$scoped$';
@@ -301,9 +302,9 @@ var LWC = (function (exports) {
301
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
302
303
  */
303
304
  // Increment whenever the LWC template compiler changes
304
- const LWC_VERSION = "2.14.1";
305
+ const LWC_VERSION = "2.16.0";
305
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
306
- /** version: 2.14.1 */
307
+ /** version: 2.16.0 */
307
308
 
308
309
  /*
309
310
  * Copyright (c) 2018, salesforce.com, inc.
@@ -457,7 +458,32 @@ var LWC = (function (exports) {
457
458
  setFeatureFlag(name, value);
458
459
  }
459
460
  }
460
- /** version: 2.14.1 */
461
+ /** version: 2.16.0 */
462
+
463
+ /*
464
+ * Copyright (c) 2018, salesforce.com, inc.
465
+ * All rights reserved.
466
+ * SPDX-License-Identifier: MIT
467
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
468
+ */
469
+ // @ts-ignore
470
+
471
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
472
+ window.addEventListener('test-dummy-flag', () => {
473
+ let hasFlag = false;
474
+
475
+ if (runtimeFlags.DUMMY_TEST_FLAG) {
476
+ hasFlag = true;
477
+ }
478
+
479
+ window.dispatchEvent(new CustomEvent('has-dummy-flag', {
480
+ detail: {
481
+ package: '@lwc/engine-dom',
482
+ hasFlag
483
+ }
484
+ }));
485
+ });
486
+ }
461
487
 
462
488
  /* proxy-compat-disable */
463
489
 
@@ -567,162 +593,6 @@ var LWC = (function (exports) {
567
593
  return list;
568
594
  }
569
595
 
570
- //
571
- // Primitives
572
- //
573
- let ssr$1;
574
- function setSsr(ssrImpl) {
575
- ssr$1 = ssrImpl;
576
- }
577
- let isNativeShadowDefined$1;
578
- function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
579
- isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
580
- }
581
- let isSyntheticShadowDefined$1;
582
- function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
583
- isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
584
- }
585
- let HTMLElementExported$1;
586
- function setHTMLElement(HTMLElementImpl) {
587
- HTMLElementExported$1 = HTMLElementImpl;
588
- }
589
- let insert$1;
590
- function setInsert(insertImpl) {
591
- insert$1 = insertImpl;
592
- }
593
- let remove$1;
594
- function setRemove(removeImpl) {
595
- remove$1 = removeImpl;
596
- }
597
- let createElement$2;
598
- function setCreateElement(createElementImpl) {
599
- createElement$2 = createElementImpl;
600
- }
601
- let createText$1;
602
- function setCreateText(createTextImpl) {
603
- createText$1 = createTextImpl;
604
- }
605
- let createComment$1;
606
- function setCreateComment(createCommentImpl) {
607
- createComment$1 = createCommentImpl;
608
- }
609
- let nextSibling$1;
610
- function setNextSibling(nextSiblingImpl) {
611
- nextSibling$1 = nextSiblingImpl;
612
- }
613
- let attachShadow$1;
614
- function setAttachShadow(attachShadowImpl) {
615
- attachShadow$1 = attachShadowImpl;
616
- }
617
- let getProperty$1;
618
- function setGetProperty(getPropertyImpl) {
619
- getProperty$1 = getPropertyImpl;
620
- }
621
- let setProperty$1;
622
- function setSetProperty(setPropertyImpl) {
623
- setProperty$1 = setPropertyImpl;
624
- }
625
- let setText$1;
626
- function setSetText(setTextImpl) {
627
- setText$1 = setTextImpl;
628
- }
629
- let getAttribute$1;
630
- function setGetAttribute(getAttributeImpl) {
631
- getAttribute$1 = getAttributeImpl;
632
- }
633
- let setAttribute$1;
634
- function setSetAttribute(setAttributeImpl) {
635
- setAttribute$1 = setAttributeImpl;
636
- }
637
- let removeAttribute$1;
638
- function setRemoveAttribute(removeAttributeImpl) {
639
- removeAttribute$1 = removeAttributeImpl;
640
- }
641
- let addEventListener$1;
642
- function setAddEventListener(addEventListenerImpl) {
643
- addEventListener$1 = addEventListenerImpl;
644
- }
645
- let removeEventListener$1;
646
- function setRemoveEventListener(removeEventListenerImpl) {
647
- removeEventListener$1 = removeEventListenerImpl;
648
- }
649
- let dispatchEvent$1;
650
- function setDispatchEvent(dispatchEventImpl) {
651
- dispatchEvent$1 = dispatchEventImpl;
652
- }
653
- let getClassList$1;
654
- function setGetClassList(getClassListImpl) {
655
- getClassList$1 = getClassListImpl;
656
- }
657
- let setCSSStyleProperty$1;
658
- function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
659
- setCSSStyleProperty$1 = setCSSStylePropertyImpl;
660
- }
661
- let getBoundingClientRect$1;
662
- function setGetBoundingClientRect(getBoundingClientRectImpl) {
663
- getBoundingClientRect$1 = getBoundingClientRectImpl;
664
- }
665
- let querySelector$1;
666
- function setQuerySelector(querySelectorImpl) {
667
- querySelector$1 = querySelectorImpl;
668
- }
669
- let querySelectorAll$1;
670
- function setQuerySelectorAll(querySelectorAllImpl) {
671
- querySelectorAll$1 = querySelectorAllImpl;
672
- }
673
- let getElementsByTagName$1;
674
- function setGetElementsByTagName(getElementsByTagNameImpl) {
675
- getElementsByTagName$1 = getElementsByTagNameImpl;
676
- }
677
- let getElementsByClassName$1;
678
- function setGetElementsByClassName(getElementsByClassNameImpl) {
679
- getElementsByClassName$1 = getElementsByClassNameImpl;
680
- }
681
- let getChildren$1;
682
- function setGetChildren(getChildrenImpl) {
683
- getChildren$1 = getChildrenImpl;
684
- }
685
- let getChildNodes$1;
686
- function setGetChildNodes(getChildNodesImpl) {
687
- getChildNodes$1 = getChildNodesImpl;
688
- }
689
- let getFirstChild$1;
690
- function setGetFirstChild(getFirstChildImpl) {
691
- getFirstChild$1 = getFirstChildImpl;
692
- }
693
- let getFirstElementChild$1;
694
- function setGetFirstElementChild(getFirstElementChildImpl) {
695
- getFirstElementChild$1 = getFirstElementChildImpl;
696
- }
697
- let getLastChild$1;
698
- function setGetLastChild(getLastChildImpl) {
699
- getLastChild$1 = getLastChildImpl;
700
- }
701
- let getLastElementChild$1;
702
- function setGetLastElementChild(getLastElementChildImpl) {
703
- getLastElementChild$1 = getLastElementChildImpl;
704
- }
705
- let isConnected$1;
706
- function setIsConnected(isConnectedImpl) {
707
- isConnected$1 = isConnectedImpl;
708
- }
709
- let insertStylesheet$1;
710
- function setInsertStylesheet(insertStylesheetImpl) {
711
- insertStylesheet$1 = insertStylesheetImpl;
712
- }
713
- let assertInstanceOfHTMLElement$1;
714
- function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
715
- assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
716
- }
717
- let defineCustomElement$1;
718
- function setDefineCustomElement(defineCustomElementImpl) {
719
- defineCustomElement$1 = defineCustomElementImpl;
720
- }
721
- let getCustomElement$1;
722
- function setGetCustomElement(getCustomElementImpl) {
723
- getCustomElement$1 = getCustomElementImpl;
724
- }
725
-
726
596
  /*
727
597
  * Copyright (c) 2019, salesforce.com, inc.
728
598
  * All rights reserved.
@@ -2027,7 +1897,8 @@ var LWC = (function (exports) {
2027
1897
  const { def, elm } = vm;
2028
1898
  const { bridge } = def;
2029
1899
  if (process.env.NODE_ENV !== 'production') {
2030
- assertInstanceOfHTMLElement$1(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
1900
+ const { assertInstanceOfHTMLElement } = vm.renderer;
1901
+ assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
2031
1902
  }
2032
1903
  const component = this;
2033
1904
  setPrototypeOf(elm, bridge.prototype);
@@ -2061,8 +1932,8 @@ var LWC = (function (exports) {
2061
1932
  return this;
2062
1933
  };
2063
1934
  function doAttachShadow(vm) {
2064
- const { elm, mode, shadowMode, def: { ctor }, } = vm;
2065
- const shadowRoot = attachShadow$1(elm, {
1935
+ const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
1936
+ const shadowRoot = attachShadow(elm, {
2066
1937
  [KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
2067
1938
  delegatesFocus: Boolean(ctor.delegatesFocus),
2068
1939
  mode,
@@ -2083,12 +1954,13 @@ var LWC = (function (exports) {
2083
1954
  LightningElement.prototype = {
2084
1955
  constructor: LightningElement,
2085
1956
  dispatchEvent(event) {
2086
- const { elm } = getAssociatedVM(this);
2087
- return dispatchEvent$1(elm, event);
1957
+ const vm = getAssociatedVM(this);
1958
+ const { elm, renderer: { dispatchEvent }, } = vm;
1959
+ return dispatchEvent(elm, event);
2088
1960
  },
2089
1961
  addEventListener(type, listener, options) {
2090
1962
  const vm = getAssociatedVM(this);
2091
- const { elm } = vm;
1963
+ const { elm, renderer: { addEventListener }, } = vm;
2092
1964
  if (process.env.NODE_ENV !== 'production') {
2093
1965
  const vmBeingRendered = getVMBeingRendered();
2094
1966
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
@@ -2096,83 +1968,91 @@ var LWC = (function (exports) {
2096
1968
  assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
2097
1969
  }
2098
1970
  const wrappedListener = getWrappedComponentsListener(vm, listener);
2099
- addEventListener$1(elm, type, wrappedListener, options);
1971
+ addEventListener(elm, type, wrappedListener, options);
2100
1972
  },
2101
1973
  removeEventListener(type, listener, options) {
2102
1974
  const vm = getAssociatedVM(this);
2103
- const { elm } = vm;
1975
+ const { elm, renderer: { removeEventListener }, } = vm;
2104
1976
  const wrappedListener = getWrappedComponentsListener(vm, listener);
2105
- removeEventListener$1(elm, type, wrappedListener, options);
1977
+ removeEventListener(elm, type, wrappedListener, options);
2106
1978
  },
2107
1979
  hasAttribute(name) {
2108
- const { elm } = getAssociatedVM(this);
2109
- return !isNull(getAttribute$1(elm, name));
1980
+ const vm = getAssociatedVM(this);
1981
+ const { elm, renderer: { getAttribute }, } = vm;
1982
+ return !isNull(getAttribute(elm, name));
2110
1983
  },
2111
1984
  hasAttributeNS(namespace, name) {
2112
- const { elm } = getAssociatedVM(this);
2113
- return !isNull(getAttribute$1(elm, name, namespace));
1985
+ const vm = getAssociatedVM(this);
1986
+ const { elm, renderer: { getAttribute }, } = vm;
1987
+ return !isNull(getAttribute(elm, name, namespace));
2114
1988
  },
2115
1989
  removeAttribute(name) {
2116
- const { elm } = getAssociatedVM(this);
1990
+ const vm = getAssociatedVM(this);
1991
+ const { elm, renderer: { removeAttribute }, } = vm;
2117
1992
  unlockAttribute(elm, name);
2118
- removeAttribute$1(elm, name);
1993
+ removeAttribute(elm, name);
2119
1994
  lockAttribute();
2120
1995
  },
2121
1996
  removeAttributeNS(namespace, name) {
2122
- const { elm } = getAssociatedVM(this);
1997
+ const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
2123
1998
  unlockAttribute(elm, name);
2124
- removeAttribute$1(elm, name, namespace);
1999
+ removeAttribute(elm, name, namespace);
2125
2000
  lockAttribute();
2126
2001
  },
2127
2002
  getAttribute(name) {
2128
- const { elm } = getAssociatedVM(this);
2129
- return getAttribute$1(elm, name);
2003
+ const vm = getAssociatedVM(this);
2004
+ const { elm } = vm;
2005
+ const { getAttribute } = vm.renderer;
2006
+ return getAttribute(elm, name);
2130
2007
  },
2131
2008
  getAttributeNS(namespace, name) {
2132
- const { elm } = getAssociatedVM(this);
2133
- return getAttribute$1(elm, name, namespace);
2009
+ const vm = getAssociatedVM(this);
2010
+ const { elm } = vm;
2011
+ const { getAttribute } = vm.renderer;
2012
+ return getAttribute(elm, name, namespace);
2134
2013
  },
2135
2014
  setAttribute(name, value) {
2136
2015
  const vm = getAssociatedVM(this);
2137
- const { elm } = vm;
2016
+ const { elm, renderer: { setAttribute }, } = vm;
2138
2017
  if (process.env.NODE_ENV !== 'production') {
2139
2018
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2140
2019
  }
2141
2020
  unlockAttribute(elm, name);
2142
- setAttribute$1(elm, name, value);
2021
+ setAttribute(elm, name, value);
2143
2022
  lockAttribute();
2144
2023
  },
2145
2024
  setAttributeNS(namespace, name, value) {
2146
2025
  const vm = getAssociatedVM(this);
2147
- const { elm } = vm;
2026
+ const { elm, renderer: { setAttribute }, } = vm;
2148
2027
  if (process.env.NODE_ENV !== 'production') {
2149
2028
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
2150
2029
  }
2151
2030
  unlockAttribute(elm, name);
2152
- setAttribute$1(elm, name, value, namespace);
2031
+ setAttribute(elm, name, value, namespace);
2153
2032
  lockAttribute();
2154
2033
  },
2155
2034
  getBoundingClientRect() {
2156
2035
  const vm = getAssociatedVM(this);
2157
- const { elm } = vm;
2036
+ const { elm, renderer: { getBoundingClientRect }, } = vm;
2158
2037
  if (process.env.NODE_ENV !== 'production') {
2159
2038
  warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
2160
2039
  }
2161
- return getBoundingClientRect$1(elm);
2040
+ return getBoundingClientRect(elm);
2162
2041
  },
2163
2042
  get isConnected() {
2164
- const { elm } = getAssociatedVM(this);
2165
- return isConnected$1(elm);
2043
+ const vm = getAssociatedVM(this);
2044
+ const { elm, renderer: { isConnected }, } = vm;
2045
+ return isConnected(elm);
2166
2046
  },
2167
2047
  get classList() {
2168
2048
  const vm = getAssociatedVM(this);
2169
- const { elm } = vm;
2049
+ const { elm, renderer: { getClassList }, } = vm;
2170
2050
  if (process.env.NODE_ENV !== 'production') {
2171
2051
  // TODO [#1290]: this still fails in dev but works in production, eventually, we should
2172
2052
  // just throw in all modes
2173
2053
  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.`);
2174
2054
  }
2175
- return getClassList$1(elm);
2055
+ return getClassList(elm);
2176
2056
  },
2177
2057
  get template() {
2178
2058
  const vm = getAssociatedVM(this);
@@ -2188,6 +2068,54 @@ var LWC = (function (exports) {
2188
2068
  // Authors should rely on this.template instead.
2189
2069
  return null;
2190
2070
  },
2071
+ get children() {
2072
+ const vm = getAssociatedVM(this);
2073
+ const renderer = vm.renderer;
2074
+ if (process.env.NODE_ENV !== 'production') {
2075
+ warnIfInvokedDuringConstruction(vm, 'children');
2076
+ }
2077
+ return renderer.getChildren(vm.elm);
2078
+ },
2079
+ get childNodes() {
2080
+ const vm = getAssociatedVM(this);
2081
+ const renderer = vm.renderer;
2082
+ if (process.env.NODE_ENV !== 'production') {
2083
+ warnIfInvokedDuringConstruction(vm, 'childNodes');
2084
+ }
2085
+ return renderer.getChildNodes(vm.elm);
2086
+ },
2087
+ get firstChild() {
2088
+ const vm = getAssociatedVM(this);
2089
+ const renderer = vm.renderer;
2090
+ if (process.env.NODE_ENV !== 'production') {
2091
+ warnIfInvokedDuringConstruction(vm, 'firstChild');
2092
+ }
2093
+ return renderer.getFirstChild(vm.elm);
2094
+ },
2095
+ get firstElementChild() {
2096
+ const vm = getAssociatedVM(this);
2097
+ const renderer = vm.renderer;
2098
+ if (process.env.NODE_ENV !== 'production') {
2099
+ warnIfInvokedDuringConstruction(vm, 'firstElementChild');
2100
+ }
2101
+ return renderer.getFirstElementChild(vm.elm);
2102
+ },
2103
+ get lastChild() {
2104
+ const vm = getAssociatedVM(this);
2105
+ const renderer = vm.renderer;
2106
+ if (process.env.NODE_ENV !== 'production') {
2107
+ warnIfInvokedDuringConstruction(vm, 'lastChild');
2108
+ }
2109
+ return renderer.getLastChild(vm.elm);
2110
+ },
2111
+ get lastElementChild() {
2112
+ const vm = getAssociatedVM(this);
2113
+ const renderer = vm.renderer;
2114
+ if (process.env.NODE_ENV !== 'production') {
2115
+ warnIfInvokedDuringConstruction(vm, 'lastElementChild');
2116
+ }
2117
+ return renderer.getLastElementChild(vm.elm);
2118
+ },
2191
2119
  render() {
2192
2120
  const vm = getAssociatedVM(this);
2193
2121
  return vm.def.template;
@@ -2198,76 +2126,22 @@ var LWC = (function (exports) {
2198
2126
  },
2199
2127
  };
2200
2128
  const queryAndChildGetterDescriptors = create(null);
2201
- // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
2202
- // is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
2203
- // object representing the renderer, with a lot of methods we don't actually need.
2204
- const childGetters = [
2205
- 'children',
2206
- 'childNodes',
2207
- 'firstChild',
2208
- 'firstElementChild',
2209
- 'lastChild',
2210
- 'lastElementChild',
2211
- ];
2212
- function getChildGetter(methodName) {
2213
- switch (methodName) {
2214
- case 'children':
2215
- return getChildren$1;
2216
- case 'childNodes':
2217
- return getChildNodes$1;
2218
- case 'firstChild':
2219
- return getFirstChild$1;
2220
- case 'firstElementChild':
2221
- return getFirstElementChild$1;
2222
- case 'lastChild':
2223
- return getLastChild$1;
2224
- case 'lastElementChild':
2225
- return getLastElementChild$1;
2226
- }
2227
- }
2228
- // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
2229
- for (const childGetter of childGetters) {
2230
- queryAndChildGetterDescriptors[childGetter] = {
2231
- get() {
2232
- const vm = getAssociatedVM(this);
2233
- const { elm } = vm;
2234
- if (process.env.NODE_ENV !== 'production') {
2235
- warnIfInvokedDuringConstruction(vm, childGetter);
2236
- }
2237
- return getChildGetter(childGetter)(elm);
2238
- },
2239
- configurable: true,
2240
- enumerable: true,
2241
- };
2242
- }
2243
2129
  const queryMethods = [
2244
2130
  'getElementsByClassName',
2245
2131
  'getElementsByTagName',
2246
2132
  'querySelector',
2247
2133
  'querySelectorAll',
2248
2134
  ];
2249
- function getQueryMethod(methodName) {
2250
- switch (methodName) {
2251
- case 'getElementsByClassName':
2252
- return getElementsByClassName$1;
2253
- case 'getElementsByTagName':
2254
- return getElementsByTagName$1;
2255
- case 'querySelector':
2256
- return querySelector$1;
2257
- case 'querySelectorAll':
2258
- return querySelectorAll$1;
2259
- }
2260
- }
2261
2135
  // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2262
2136
  for (const queryMethod of queryMethods) {
2263
2137
  queryAndChildGetterDescriptors[queryMethod] = {
2264
2138
  value(arg) {
2265
2139
  const vm = getAssociatedVM(this);
2266
- const { elm } = vm;
2140
+ const { elm, renderer } = vm;
2267
2141
  if (process.env.NODE_ENV !== 'production') {
2268
2142
  warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
2269
2143
  }
2270
- return getQueryMethod(queryMethod)(elm, arg);
2144
+ return renderer[queryMethod](elm, arg);
2271
2145
  },
2272
2146
  configurable: true,
2273
2147
  enumerable: true,
@@ -3491,12 +3365,13 @@ var LWC = (function (exports) {
3491
3365
  * SPDX-License-Identifier: MIT
3492
3366
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3493
3367
  */
3494
- function getUpgradableConstructor(tagName) {
3368
+ function getUpgradableConstructor(tagName, renderer) {
3369
+ const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
3495
3370
  // Should never get a tag with upper case letter at this point, the compiler should
3496
3371
  // produce only tags with lowercase letters
3497
3372
  // But, for backwards compatibility, we will lower case the tagName
3498
3373
  tagName = tagName.toLowerCase();
3499
- let CE = getCustomElement$1(tagName);
3374
+ let CE = getCustomElement(tagName);
3500
3375
  if (!isUndefined$1(CE)) {
3501
3376
  return CE;
3502
3377
  }
@@ -3504,7 +3379,7 @@ var LWC = (function (exports) {
3504
3379
  * LWC Upgradable Element reference to an element that was created
3505
3380
  * via the scoped registry mechanism, and that is ready to be upgraded.
3506
3381
  */
3507
- CE = class LWCUpgradableElement extends HTMLElementExported$1 {
3382
+ CE = class LWCUpgradableElement extends RendererHTMLElement {
3508
3383
  constructor(upgradeCallback) {
3509
3384
  super();
3510
3385
  if (isFunction$1(upgradeCallback)) {
@@ -3512,7 +3387,7 @@ var LWC = (function (exports) {
3512
3387
  }
3513
3388
  }
3514
3389
  };
3515
- defineCustomElement$1(tagName, CE);
3390
+ defineCustomElement(tagName, CE);
3516
3391
  return CE;
3517
3392
  }
3518
3393
 
@@ -3537,7 +3412,7 @@ var LWC = (function (exports) {
3537
3412
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3538
3413
  */
3539
3414
  const ColonCharCode = 58;
3540
- function patchAttributes(oldVnode, vnode) {
3415
+ function patchAttributes(oldVnode, vnode, renderer) {
3541
3416
  const { attrs } = vnode.data;
3542
3417
  if (isUndefined$1(attrs)) {
3543
3418
  return;
@@ -3547,6 +3422,7 @@ var LWC = (function (exports) {
3547
3422
  return;
3548
3423
  }
3549
3424
  const { elm } = vnode;
3425
+ const { setAttribute, removeAttribute } = renderer;
3550
3426
  for (const key in attrs) {
3551
3427
  const cur = attrs[key];
3552
3428
  const old = oldAttrs[key];
@@ -3554,17 +3430,17 @@ var LWC = (function (exports) {
3554
3430
  unlockAttribute(elm, key);
3555
3431
  if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
3556
3432
  // Assume xml namespace
3557
- setAttribute$1(elm, key, cur, XML_NAMESPACE);
3433
+ setAttribute(elm, key, cur, XML_NAMESPACE);
3558
3434
  }
3559
3435
  else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
3560
3436
  // Assume xlink namespace
3561
- setAttribute$1(elm, key, cur, XLINK_NAMESPACE);
3437
+ setAttribute(elm, key, cur, XLINK_NAMESPACE);
3562
3438
  }
3563
3439
  else if (isNull(cur) || isUndefined$1(cur)) {
3564
- removeAttribute$1(elm, key);
3440
+ removeAttribute(elm, key);
3565
3441
  }
3566
3442
  else {
3567
- setAttribute$1(elm, key, cur);
3443
+ setAttribute(elm, key, cur);
3568
3444
  }
3569
3445
  lockAttribute();
3570
3446
  }
@@ -3582,7 +3458,7 @@ var LWC = (function (exports) {
3582
3458
  // instead of relying on internally tracked values.
3583
3459
  return sel === 'input' && (key === 'value' || key === 'checked');
3584
3460
  }
3585
- function patchProps(oldVnode, vnode) {
3461
+ function patchProps(oldVnode, vnode, renderer) {
3586
3462
  const { props } = vnode.data;
3587
3463
  if (isUndefined$1(props)) {
3588
3464
  return;
@@ -3593,13 +3469,14 @@ var LWC = (function (exports) {
3593
3469
  }
3594
3470
  const isFirstPatch = isNull(oldVnode);
3595
3471
  const { elm, sel } = vnode;
3472
+ const { getProperty, setProperty } = renderer;
3596
3473
  for (const key in props) {
3597
3474
  const cur = props[key];
3598
3475
  // Set the property if it's the first time is is patched or if the previous property is
3599
3476
  // different than the one previously set.
3600
3477
  if (isFirstPatch ||
3601
- cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
3602
- setProperty$1(elm, key, cur);
3478
+ cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
3479
+ setProperty(elm, key, cur);
3603
3480
  }
3604
3481
  }
3605
3482
  }
@@ -3644,13 +3521,14 @@ var LWC = (function (exports) {
3644
3521
  }
3645
3522
  return map;
3646
3523
  }
3647
- function patchClassAttribute(oldVnode, vnode) {
3524
+ function patchClassAttribute(oldVnode, vnode, renderer) {
3648
3525
  const { elm, data: { className: newClass }, } = vnode;
3649
3526
  const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
3650
3527
  if (oldClass === newClass) {
3651
3528
  return;
3652
3529
  }
3653
- const classList = getClassList$1(elm);
3530
+ const { getClassList } = renderer;
3531
+ const classList = getClassList(elm);
3654
3532
  const newClassMap = getMapFromClassName(newClass);
3655
3533
  const oldClassMap = getMapFromClassName(oldClass);
3656
3534
  let name;
@@ -3674,17 +3552,18 @@ var LWC = (function (exports) {
3674
3552
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3675
3553
  */
3676
3554
  // The style property is a string when defined via an expression in the template.
3677
- function patchStyleAttribute(oldVnode, vnode) {
3555
+ function patchStyleAttribute(oldVnode, vnode, renderer) {
3678
3556
  const { elm, data: { style: newStyle }, } = vnode;
3679
3557
  const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
3680
3558
  if (oldStyle === newStyle) {
3681
3559
  return;
3682
3560
  }
3561
+ const { setAttribute, removeAttribute } = renderer;
3683
3562
  if (!isString(newStyle) || newStyle === '') {
3684
- removeAttribute$1(elm, 'style');
3563
+ removeAttribute(elm, 'style');
3685
3564
  }
3686
3565
  else {
3687
- setAttribute$1(elm, 'style', newStyle);
3566
+ setAttribute(elm, 'style', newStyle);
3688
3567
  }
3689
3568
  }
3690
3569
 
@@ -3694,14 +3573,15 @@ var LWC = (function (exports) {
3694
3573
  * SPDX-License-Identifier: MIT
3695
3574
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3696
3575
  */
3697
- function applyEventListeners(vnode) {
3576
+ function applyEventListeners(vnode, renderer) {
3698
3577
  const { elm, data: { on }, } = vnode;
3699
3578
  if (isUndefined$1(on)) {
3700
3579
  return;
3701
3580
  }
3581
+ const { addEventListener } = renderer;
3702
3582
  for (const name in on) {
3703
3583
  const handler = on[name];
3704
- addEventListener$1(elm, name, handler);
3584
+ addEventListener(elm, name, handler);
3705
3585
  }
3706
3586
  }
3707
3587
 
@@ -3714,12 +3594,13 @@ var LWC = (function (exports) {
3714
3594
  // The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
3715
3595
  // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
3716
3596
  // different classnames properties individually instead of via a string.
3717
- function applyStaticClassAttribute(vnode) {
3597
+ function applyStaticClassAttribute(vnode, renderer) {
3718
3598
  const { elm, data: { classMap }, } = vnode;
3719
3599
  if (isUndefined$1(classMap)) {
3720
3600
  return;
3721
3601
  }
3722
- const classList = getClassList$1(elm);
3602
+ const { getClassList } = renderer;
3603
+ const classList = getClassList(elm);
3723
3604
  for (const name in classMap) {
3724
3605
  classList.add(name);
3725
3606
  }
@@ -3734,14 +3615,15 @@ var LWC = (function (exports) {
3734
3615
  // The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
3735
3616
  // The compiler takes care of transforming the inline style into an object. It's faster to set the
3736
3617
  // different style properties individually instead of via a string.
3737
- function applyStaticStyleAttribute(vnode) {
3618
+ function applyStaticStyleAttribute(vnode, renderer) {
3738
3619
  const { elm, data: { styleDecls }, } = vnode;
3739
3620
  if (isUndefined$1(styleDecls)) {
3740
3621
  return;
3741
3622
  }
3623
+ const { setCSSStyleProperty } = renderer;
3742
3624
  for (let i = 0; i < styleDecls.length; i++) {
3743
3625
  const [prop, value, important] = styleDecls[i];
3744
- setCSSStyleProperty$1(elm, prop, value, important);
3626
+ setCSSStyleProperty(elm, prop, value, important);
3745
3627
  }
3746
3628
  }
3747
3629
 
@@ -3751,15 +3633,16 @@ var LWC = (function (exports) {
3751
3633
  * SPDX-License-Identifier: MIT
3752
3634
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3753
3635
  */
3754
- function patchChildren(c1, c2, parent) {
3636
+ function patchChildren(c1, c2, parent, renderer) {
3755
3637
  if (hasDynamicChildren(c2)) {
3756
- updateDynamicChildren(c1, c2, parent);
3638
+ updateDynamicChildren(c1, c2, parent, renderer);
3757
3639
  }
3758
3640
  else {
3759
- updateStaticChildren(c1, c2, parent);
3641
+ updateStaticChildren(c1, c2, parent, renderer);
3760
3642
  }
3761
3643
  }
3762
- function patch(n1, n2) {
3644
+ function patch(n1, n2, renderer) {
3645
+ var _a, _b;
3763
3646
  if (n1 === n2) {
3764
3647
  return;
3765
3648
  }
@@ -3773,80 +3656,115 @@ var LWC = (function (exports) {
3773
3656
  }
3774
3657
  switch (n2.type) {
3775
3658
  case 0 /* Text */:
3776
- patchText(n1, n2);
3659
+ // VText has no special capability, fallback to the owner's renderer
3660
+ patchText(n1, n2, renderer);
3777
3661
  break;
3778
3662
  case 1 /* Comment */:
3779
- patchComment(n1, n2);
3663
+ // VComment has no special capability, fallback to the owner's renderer
3664
+ patchComment(n1, n2, renderer);
3665
+ break;
3666
+ case 4 /* Static */:
3667
+ n2.elm = n1.elm;
3780
3668
  break;
3781
3669
  case 2 /* Element */:
3782
- patchElement(n1, n2);
3670
+ patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3783
3671
  break;
3784
3672
  case 3 /* CustomElement */:
3785
- patchCustomElement(n1, n2);
3673
+ patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3786
3674
  break;
3787
3675
  }
3788
3676
  }
3789
- function mount(node, parent, anchor) {
3677
+ function mount(node, parent, renderer, anchor) {
3678
+ var _a, _b;
3790
3679
  switch (node.type) {
3791
3680
  case 0 /* Text */:
3792
- mountText(node, parent, anchor);
3681
+ // VText has no special capability, fallback to the owner's renderer
3682
+ mountText(node, parent, anchor, renderer);
3793
3683
  break;
3794
3684
  case 1 /* Comment */:
3795
- mountComment(node, parent, anchor);
3685
+ // VComment has no special capability, fallback to the owner's renderer
3686
+ mountComment(node, parent, anchor, renderer);
3687
+ break;
3688
+ case 4 /* Static */:
3689
+ // VStatic cannot have a custom renderer associated to them, using owner's renderer
3690
+ mountStatic(node, parent, anchor, renderer);
3796
3691
  break;
3797
3692
  case 2 /* Element */:
3798
- mountElement(node, parent, anchor);
3693
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3694
+ mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3799
3695
  break;
3800
3696
  case 3 /* CustomElement */:
3801
- mountCustomElement(node, parent, anchor);
3697
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3698
+ mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3802
3699
  break;
3803
3700
  }
3804
3701
  }
3805
- function patchText(n1, n2) {
3702
+ function patchText(n1, n2, renderer) {
3806
3703
  n2.elm = n1.elm;
3807
3704
  if (n2.text !== n1.text) {
3808
- updateTextContent(n2);
3705
+ updateTextContent(n2, renderer);
3809
3706
  }
3810
3707
  }
3811
- function mountText(node, parent, anchor) {
3812
- const { owner } = node;
3813
- const textNode = (node.elm = createText$1(node.text));
3814
- linkNodeToShadow(textNode, owner);
3815
- insertNode(textNode, parent, anchor);
3708
+ function mountText(vnode, parent, anchor, renderer) {
3709
+ const { owner } = vnode;
3710
+ const { createText } = renderer;
3711
+ const textNode = (vnode.elm = createText(vnode.text));
3712
+ linkNodeToShadow(textNode, owner, renderer);
3713
+ insertNode(textNode, parent, anchor, renderer);
3816
3714
  }
3817
- function patchComment(n1, n2) {
3715
+ function patchComment(n1, n2, renderer) {
3818
3716
  n2.elm = n1.elm;
3819
3717
  // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3820
3718
  // it is the case today.
3821
3719
  if (n2.text !== n1.text) {
3822
- updateTextContent(n2);
3720
+ updateTextContent(n2, renderer);
3823
3721
  }
3824
3722
  }
3825
- function mountComment(node, parent, anchor) {
3826
- const { owner } = node;
3827
- const commentNode = (node.elm = createComment$1(node.text));
3828
- linkNodeToShadow(commentNode, owner);
3829
- insertNode(commentNode, parent, anchor);
3723
+ function mountComment(vnode, parent, anchor, renderer) {
3724
+ const { owner } = vnode;
3725
+ const { createComment } = renderer;
3726
+ const commentNode = (vnode.elm = createComment(vnode.text));
3727
+ linkNodeToShadow(commentNode, owner, renderer);
3728
+ insertNode(commentNode, parent, anchor, renderer);
3830
3729
  }
3831
- function mountElement(vnode, parent, anchor) {
3730
+ function mountElement(vnode, parent, anchor, renderer) {
3832
3731
  const { sel, owner, data: { svg }, } = vnode;
3732
+ const { createElement } = renderer;
3833
3733
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3834
- const elm = createElement$2(sel, namespace);
3835
- linkNodeToShadow(elm, owner);
3836
- fallbackElmHook(elm, vnode);
3734
+ const elm = createElement(sel, namespace);
3735
+ linkNodeToShadow(elm, owner, renderer);
3736
+ fallbackElmHook(elm, vnode, renderer);
3837
3737
  vnode.elm = elm;
3838
- patchElementPropsAndAttrs$1(null, vnode);
3839
- insertNode(elm, parent, anchor);
3840
- mountVNodes(vnode.children, elm, null);
3738
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3739
+ insertNode(elm, parent, anchor, renderer);
3740
+ mountVNodes(vnode.children, elm, renderer, null);
3841
3741
  }
3842
- function patchElement(n1, n2) {
3742
+ function patchElement(n1, n2, renderer) {
3843
3743
  const elm = (n2.elm = n1.elm);
3844
- patchElementPropsAndAttrs$1(n1, n2);
3845
- patchChildren(n1.children, n2.children, elm);
3744
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3745
+ patchChildren(n1.children, n2.children, elm, renderer);
3846
3746
  }
3847
- function mountCustomElement(vnode, parent, anchor) {
3747
+ function mountStatic(vnode, parent, anchor, renderer) {
3748
+ const { owner } = vnode;
3749
+ const { cloneNode, isSyntheticShadowDefined } = renderer;
3750
+ const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3751
+ linkNodeToShadow(elm, owner, renderer);
3752
+ // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3753
+ const { renderMode, shadowMode } = owner;
3754
+ if (isSyntheticShadowDefined) {
3755
+ if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
3756
+ elm[KEY__SHADOW_STATIC] = true;
3757
+ }
3758
+ }
3759
+ if (process.env.NODE_ENV !== 'production') {
3760
+ const isLight = renderMode === 0 /* Light */;
3761
+ patchElementWithRestrictions(elm, { isPortal: false, isLight });
3762
+ }
3763
+ insertNode(elm, parent, anchor, renderer);
3764
+ }
3765
+ function mountCustomElement(vnode, parent, anchor, renderer) {
3848
3766
  const { sel, owner } = vnode;
3849
- const UpgradableConstructor = getUpgradableConstructor(sel);
3767
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
3850
3768
  /**
3851
3769
  * Note: if the upgradable constructor does not expect, or throw when we new it
3852
3770
  * with a callback as the first argument, we could implement a more advanced
@@ -3856,9 +3774,9 @@ var LWC = (function (exports) {
3856
3774
  let vm;
3857
3775
  const elm = new UpgradableConstructor((elm) => {
3858
3776
  // the custom element from the registry is expecting an upgrade callback
3859
- vm = createViewModelHook(elm, vnode);
3777
+ vm = createViewModelHook(elm, vnode, renderer);
3860
3778
  });
3861
- linkNodeToShadow(elm, owner);
3779
+ linkNodeToShadow(elm, owner, renderer);
3862
3780
  vnode.elm = elm;
3863
3781
  vnode.vm = vm;
3864
3782
  if (vm) {
@@ -3867,23 +3785,23 @@ var LWC = (function (exports) {
3867
3785
  else if (vnode.ctor !== UpgradableConstructor) {
3868
3786
  throw new TypeError(`Incorrect Component Constructor`);
3869
3787
  }
3870
- patchElementPropsAndAttrs$1(null, vnode);
3871
- insertNode(elm, parent, anchor);
3788
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3789
+ insertNode(elm, parent, anchor, renderer);
3872
3790
  if (vm) {
3873
3791
  if (process.env.NODE_ENV !== 'production') {
3874
3792
  assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
3875
3793
  }
3876
3794
  runConnectedCallback(vm);
3877
3795
  }
3878
- mountVNodes(vnode.children, elm, null);
3796
+ mountVNodes(vnode.children, elm, renderer, null);
3879
3797
  if (vm) {
3880
3798
  appendVM(vm);
3881
3799
  }
3882
3800
  }
3883
- function patchCustomElement(n1, n2) {
3801
+ function patchCustomElement(n1, n2, renderer) {
3884
3802
  const elm = (n2.elm = n1.elm);
3885
3803
  const vm = (n2.vm = n1.vm);
3886
- patchElementPropsAndAttrs$1(n1, n2);
3804
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3887
3805
  if (!isUndefined$1(vm)) {
3888
3806
  // in fallback mode, the allocation will always set children to
3889
3807
  // empty and delegate the real allocation to the slot elements
@@ -3891,34 +3809,36 @@ var LWC = (function (exports) {
3891
3809
  }
3892
3810
  // in fallback mode, the children will be always empty, so, nothing
3893
3811
  // will happen, but in native, it does allocate the light dom
3894
- patchChildren(n1.children, n2.children, elm);
3812
+ patchChildren(n1.children, n2.children, elm, renderer);
3895
3813
  if (!isUndefined$1(vm)) {
3896
3814
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
3897
3815
  // this is important to preserve the top to bottom synchronous rendering phase.
3898
3816
  rerenderVM(vm);
3899
3817
  }
3900
3818
  }
3901
- function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
3819
+ function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
3902
3820
  for (; start < end; ++start) {
3903
3821
  const vnode = vnodes[start];
3904
3822
  if (isVNode(vnode)) {
3905
- mount(vnode, parent, anchor);
3823
+ mount(vnode, parent, renderer, anchor);
3906
3824
  }
3907
3825
  }
3908
3826
  }
3909
- function unmount(vnode, parent, doRemove = false) {
3827
+ function unmount(vnode, parent, renderer, doRemove = false) {
3910
3828
  const { type, elm, sel } = vnode;
3911
3829
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3912
3830
  // subtree root, is the only element worth unmounting from the subtree.
3913
3831
  if (doRemove) {
3914
- removeNode(elm, parent);
3832
+ // The vnode might or might not have a data.renderer associated to it
3833
+ // but the removal used here is from the owner instead.
3834
+ removeNode(elm, parent, renderer);
3915
3835
  }
3916
3836
  switch (type) {
3917
3837
  case 2 /* Element */: {
3918
3838
  // Slot content is removed to trigger slotchange event when removing slot.
3919
3839
  // Only required for synthetic shadow.
3920
- const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3921
- unmountVNodes(vnode.children, elm, removeChildren);
3840
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3841
+ unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
3922
3842
  break;
3923
3843
  }
3924
3844
  case 3 /* CustomElement */: {
@@ -3931,11 +3851,11 @@ var LWC = (function (exports) {
3931
3851
  }
3932
3852
  }
3933
3853
  }
3934
- function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
3854
+ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
3935
3855
  for (; start < end; ++start) {
3936
3856
  const ch = vnodes[start];
3937
3857
  if (isVNode(ch)) {
3938
- unmount(ch, parent, doRemove);
3858
+ unmount(ch, parent, renderer, doRemove);
3939
3859
  }
3940
3860
  }
3941
3861
  }
@@ -3949,66 +3869,71 @@ var LWC = (function (exports) {
3949
3869
  elm.$shadowToken$ = token;
3950
3870
  }
3951
3871
  // Set the scope token class for *.scoped.css styles
3952
- function setScopeTokenClassIfNecessary(elm, owner) {
3872
+ function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3953
3873
  const { cmpTemplate, context } = owner;
3874
+ const { getClassList } = renderer;
3954
3875
  const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3955
3876
  if (!isUndefined$1(token) && context.hasScopedStyles) {
3956
- getClassList$1(elm).add(token);
3877
+ // TODO [#2762]: this dot notation with add is probably problematic
3878
+ // probably we should have a renderer api for just the add operation
3879
+ getClassList(elm).add(token);
3957
3880
  }
3958
3881
  }
3959
- function linkNodeToShadow(elm, owner) {
3882
+ function linkNodeToShadow(elm, owner, renderer) {
3960
3883
  const { renderRoot, renderMode, shadowMode } = owner;
3884
+ const { isSyntheticShadowDefined } = renderer;
3961
3885
  // TODO [#1164]: this should eventually be done by the polyfill directly
3962
- if (isSyntheticShadowDefined$1) {
3886
+ if (isSyntheticShadowDefined) {
3963
3887
  if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
3964
3888
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
3965
3889
  }
3966
3890
  }
3967
3891
  }
3968
- function updateTextContent(vnode) {
3892
+ function updateTextContent(vnode, renderer) {
3969
3893
  const { elm, text } = vnode;
3894
+ const { setText } = renderer;
3970
3895
  if (process.env.NODE_ENV !== 'production') {
3971
3896
  unlockDomMutation();
3972
3897
  }
3973
- setText$1(elm, text);
3898
+ setText(elm, text);
3974
3899
  if (process.env.NODE_ENV !== 'production') {
3975
3900
  lockDomMutation();
3976
3901
  }
3977
3902
  }
3978
- function insertNode(node, parent, anchor) {
3903
+ function insertNode(node, parent, anchor, renderer) {
3979
3904
  if (process.env.NODE_ENV !== 'production') {
3980
3905
  unlockDomMutation();
3981
3906
  }
3982
- insert$1(node, parent, anchor);
3907
+ renderer.insert(node, parent, anchor);
3983
3908
  if (process.env.NODE_ENV !== 'production') {
3984
3909
  lockDomMutation();
3985
3910
  }
3986
3911
  }
3987
- function removeNode(node, parent) {
3912
+ function removeNode(node, parent, renderer) {
3988
3913
  if (process.env.NODE_ENV !== 'production') {
3989
3914
  unlockDomMutation();
3990
3915
  }
3991
- remove$1(node, parent);
3916
+ renderer.remove(node, parent);
3992
3917
  if (process.env.NODE_ENV !== 'production') {
3993
3918
  lockDomMutation();
3994
3919
  }
3995
3920
  }
3996
- function patchElementPropsAndAttrs$1(oldVnode, vnode) {
3921
+ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3997
3922
  if (isNull(oldVnode)) {
3998
- applyEventListeners(vnode);
3999
- applyStaticClassAttribute(vnode);
4000
- applyStaticStyleAttribute(vnode);
3923
+ applyEventListeners(vnode, renderer);
3924
+ applyStaticClassAttribute(vnode, renderer);
3925
+ applyStaticStyleAttribute(vnode, renderer);
4001
3926
  }
4002
3927
  // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4003
3928
  // value is set before type=radio.
4004
- patchClassAttribute(oldVnode, vnode);
4005
- patchStyleAttribute(oldVnode, vnode);
4006
- patchAttributes(oldVnode, vnode);
4007
- patchProps(oldVnode, vnode);
3929
+ patchClassAttribute(oldVnode, vnode, renderer);
3930
+ patchStyleAttribute(oldVnode, vnode, renderer);
3931
+ patchAttributes(oldVnode, vnode, renderer);
3932
+ patchProps(oldVnode, vnode, renderer);
4008
3933
  }
4009
- function fallbackElmHook(elm, vnode) {
3934
+ function fallbackElmHook(elm, vnode, renderer) {
4010
3935
  const { owner } = vnode;
4011
- setScopeTokenClassIfNecessary(elm, owner);
3936
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
4012
3937
  if (owner.shadowMode === 1 /* Synthetic */) {
4013
3938
  const { data: { context }, } = vnode;
4014
3939
  const { stylesheetToken } = owner.context;
@@ -4056,7 +3981,7 @@ var LWC = (function (exports) {
4056
3981
  vnode.children = EmptyArray;
4057
3982
  }
4058
3983
  }
4059
- function createViewModelHook(elm, vnode) {
3984
+ function createViewModelHook(elm, vnode, renderer) {
4060
3985
  let vm = getAssociatedVMIfPresent(elm);
4061
3986
  // There is a possibility that a custom element is registered under tagName, in which case, the
4062
3987
  // initialization is already carry on, and there is nothing else to do here since this hook is
@@ -4065,7 +3990,7 @@ var LWC = (function (exports) {
4065
3990
  return vm;
4066
3991
  }
4067
3992
  const { sel, mode, ctor, owner } = vnode;
4068
- setScopeTokenClassIfNecessary(elm, owner);
3993
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
4069
3994
  if (owner.shadowMode === 1 /* Synthetic */) {
4070
3995
  const { stylesheetToken } = owner.context;
4071
3996
  // when running in synthetic shadow mode, we need to set the shadowToken value
@@ -4074,7 +3999,7 @@ var LWC = (function (exports) {
4074
3999
  setElementShadowToken(elm, stylesheetToken);
4075
4000
  }
4076
4001
  }
4077
- vm = createVM(elm, ctor, {
4002
+ vm = createVM(elm, ctor, renderer, {
4078
4003
  mode,
4079
4004
  owner,
4080
4005
  tagName: sel,
@@ -4149,7 +4074,7 @@ var LWC = (function (exports) {
4149
4074
  }
4150
4075
  return map;
4151
4076
  }
4152
- function updateDynamicChildren(oldCh, newCh, parent) {
4077
+ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4153
4078
  let oldStartIdx = 0;
4154
4079
  let newStartIdx = 0;
4155
4080
  let oldEndIdx = oldCh.length - 1;
@@ -4178,26 +4103,26 @@ var LWC = (function (exports) {
4178
4103
  newEndVnode = newCh[--newEndIdx];
4179
4104
  }
4180
4105
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
4181
- patch(oldStartVnode, newStartVnode);
4106
+ patch(oldStartVnode, newStartVnode, renderer);
4182
4107
  oldStartVnode = oldCh[++oldStartIdx];
4183
4108
  newStartVnode = newCh[++newStartIdx];
4184
4109
  }
4185
4110
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
4186
- patch(oldEndVnode, newEndVnode);
4111
+ patch(oldEndVnode, newEndVnode, renderer);
4187
4112
  oldEndVnode = oldCh[--oldEndIdx];
4188
4113
  newEndVnode = newCh[--newEndIdx];
4189
4114
  }
4190
4115
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
4191
4116
  // Vnode moved right
4192
- patch(oldStartVnode, newEndVnode);
4193
- insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
4117
+ patch(oldStartVnode, newEndVnode, renderer);
4118
+ insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4194
4119
  oldStartVnode = oldCh[++oldStartIdx];
4195
4120
  newEndVnode = newCh[--newEndIdx];
4196
4121
  }
4197
4122
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
4198
4123
  // Vnode moved left
4199
- patch(oldEndVnode, newStartVnode);
4200
- insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
4124
+ patch(oldEndVnode, newStartVnode, renderer);
4125
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4201
4126
  oldEndVnode = oldCh[--oldEndIdx];
4202
4127
  newStartVnode = newCh[++newStartIdx];
4203
4128
  }
@@ -4208,7 +4133,7 @@ var LWC = (function (exports) {
4208
4133
  idxInOld = oldKeyToIdx[newStartVnode.key];
4209
4134
  if (isUndefined$1(idxInOld)) {
4210
4135
  // New element
4211
- mount(newStartVnode, parent, oldStartVnode.elm);
4136
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4212
4137
  newStartVnode = newCh[++newStartIdx];
4213
4138
  }
4214
4139
  else {
@@ -4216,10 +4141,10 @@ var LWC = (function (exports) {
4216
4141
  if (isVNode(elmToMove)) {
4217
4142
  if (elmToMove.sel !== newStartVnode.sel) {
4218
4143
  // New element
4219
- mount(newStartVnode, parent, oldStartVnode.elm);
4144
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4220
4145
  }
4221
4146
  else {
4222
- patch(elmToMove, newStartVnode);
4147
+ patch(elmToMove, newStartVnode, renderer);
4223
4148
  // Delete the old child, but copy the array since it is read-only.
4224
4149
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4225
4150
  // so we only care about the `oldCh` object inside this function.
@@ -4231,7 +4156,7 @@ var LWC = (function (exports) {
4231
4156
  }
4232
4157
  // We've already cloned at least once, so it's no longer read-only
4233
4158
  oldCh[idxInOld] = undefined;
4234
- insertNode(elmToMove.elm, parent, oldStartVnode.elm);
4159
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4235
4160
  }
4236
4161
  }
4237
4162
  newStartVnode = newCh[++newStartIdx];
@@ -4248,25 +4173,25 @@ var LWC = (function (exports) {
4248
4173
  n = newCh[++i];
4249
4174
  } while (!isVNode(n) && i < newChEnd);
4250
4175
  before = isVNode(n) ? n.elm : null;
4251
- mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
4176
+ mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4252
4177
  }
4253
4178
  else {
4254
- unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
4179
+ unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
4255
4180
  }
4256
4181
  }
4257
4182
  }
4258
- function updateStaticChildren(c1, c2, parent) {
4183
+ function updateStaticChildren(c1, c2, parent, renderer) {
4259
4184
  const c1Length = c1.length;
4260
4185
  const c2Length = c2.length;
4261
4186
  if (c1Length === 0) {
4262
4187
  // the old list is empty, we can directly insert anything new
4263
- mountVNodes(c2, parent, null);
4188
+ mountVNodes(c2, parent, renderer, null);
4264
4189
  return;
4265
4190
  }
4266
4191
  if (c2Length === 0) {
4267
4192
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4268
4193
  // this is the case in which the dynamic children of an if-directive should be removed
4269
- unmountVNodes(c1, parent, true);
4194
+ unmountVNodes(c1, parent, renderer, true);
4270
4195
  return;
4271
4196
  }
4272
4197
  // if the old list is not empty, the new list MUST have the same
@@ -4279,16 +4204,16 @@ var LWC = (function (exports) {
4279
4204
  if (isVNode(n1)) {
4280
4205
  if (isVNode(n2)) {
4281
4206
  // both vnodes are equivalent, and we just need to patch them
4282
- patch(n1, n2);
4207
+ patch(n1, n2, renderer);
4283
4208
  anchor = n2.elm;
4284
4209
  }
4285
4210
  else {
4286
4211
  // removing the old vnode since the new one is null
4287
- unmount(n1, parent, true);
4212
+ unmount(n1, parent, renderer, true);
4288
4213
  }
4289
4214
  }
4290
4215
  else if (isVNode(n2)) {
4291
- mount(n2, parent, anchor);
4216
+ mount(n2, parent, renderer, anchor);
4292
4217
  anchor = n2.elm;
4293
4218
  }
4294
4219
  }
@@ -4305,6 +4230,17 @@ var LWC = (function (exports) {
4305
4230
  function addVNodeToChildLWC(vnode) {
4306
4231
  ArrayPush$1.call(getVMBeingRendered().velements, vnode);
4307
4232
  }
4233
+ // [st]atic node
4234
+ function st(fragment, key) {
4235
+ return {
4236
+ type: 4 /* Static */,
4237
+ sel: undefined,
4238
+ key,
4239
+ elm: undefined,
4240
+ fragment,
4241
+ owner: getVMBeingRendered(),
4242
+ };
4243
+ }
4308
4244
  // [h]tml node
4309
4245
  function h(sel, data, children = EmptyArray) {
4310
4246
  const vmBeingRendered = getVMBeingRendered();
@@ -4694,6 +4630,7 @@ var LWC = (function (exports) {
4694
4630
  co,
4695
4631
  dc,
4696
4632
  ti,
4633
+ st,
4697
4634
  gid,
4698
4635
  fid,
4699
4636
  shc,
@@ -4717,7 +4654,7 @@ var LWC = (function (exports) {
4717
4654
  }, [api.t(content)]);
4718
4655
  }
4719
4656
  function updateStylesheetToken(vm, template) {
4720
- const { elm, context, renderMode, shadowMode } = vm;
4657
+ const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
4721
4658
  const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
4722
4659
  const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
4723
4660
  const { hasScopedStyles } = context;
@@ -4728,10 +4665,10 @@ var LWC = (function (exports) {
4728
4665
  const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
4729
4666
  if (!isUndefined$1(oldToken)) {
4730
4667
  if (oldHasTokenInClass) {
4731
- getClassList$1(elm).remove(makeHostToken(oldToken));
4668
+ getClassList(elm).remove(makeHostToken(oldToken));
4732
4669
  }
4733
4670
  if (oldHasTokenInAttribute) {
4734
- removeAttribute$1(elm, makeHostToken(oldToken));
4671
+ removeAttribute(elm, makeHostToken(oldToken));
4735
4672
  }
4736
4673
  }
4737
4674
  // Apply the new template styling token to the host element, if the new template has any
@@ -4742,11 +4679,11 @@ var LWC = (function (exports) {
4742
4679
  // Set the new styling token on the host element
4743
4680
  if (!isUndefined$1(newToken)) {
4744
4681
  if (hasScopedStyles) {
4745
- getClassList$1(elm).add(makeHostToken(newToken));
4682
+ getClassList(elm).add(makeHostToken(newToken));
4746
4683
  newHasTokenInClass = true;
4747
4684
  }
4748
4685
  if (isSyntheticShadow) {
4749
- setAttribute$1(elm, makeHostToken(newToken), '');
4686
+ setAttribute(elm, makeHostToken(newToken), '');
4750
4687
  newHasTokenInAttribute = true;
4751
4688
  }
4752
4689
  }
@@ -4834,19 +4771,18 @@ var LWC = (function (exports) {
4834
4771
  return owner;
4835
4772
  }
4836
4773
  function createStylesheet(vm, stylesheets) {
4837
- const { renderMode, shadowMode } = vm;
4774
+ const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
4838
4775
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4839
4776
  for (let i = 0; i < stylesheets.length; i++) {
4840
- insertStylesheet$1(stylesheets[i]);
4777
+ insertStylesheet(stylesheets[i]);
4841
4778
  }
4842
4779
  }
4843
- else if (ssr$1 || vm.hydrated) {
4780
+ else if (ssr || vm.hydrated) {
4844
4781
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4845
4782
  // This works in the client, because the stylesheets are created, and cached in the VM
4846
4783
  // the first time the VM renders.
4847
4784
  // native shadow or light DOM, SSR
4848
- const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
4849
- return createInlineStyleVNode(combinedStylesheetContent);
4785
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
4850
4786
  }
4851
4787
  else {
4852
4788
  // native shadow or light DOM, DOM renderer
@@ -4854,7 +4790,7 @@ var LWC = (function (exports) {
4854
4790
  // null root means a global style
4855
4791
  const target = isNull(root) ? undefined : root.shadowRoot;
4856
4792
  for (let i = 0; i < stylesheets.length; i++) {
4857
- insertStylesheet$1(stylesheets[i], target);
4793
+ insertStylesheet(stylesheets[i], target);
4858
4794
  }
4859
4795
  }
4860
4796
  return null;
@@ -5014,6 +4950,59 @@ var LWC = (function (exports) {
5014
4950
  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"`);
5015
4951
  }
5016
4952
  }
4953
+ function buildParseFragmentFn(createFragmentFn) {
4954
+ return (strings, ...keys) => {
4955
+ const cache = create(null);
4956
+ return function () {
4957
+ const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
4958
+ const hasStyleToken = !isUndefined$1(stylesheetToken);
4959
+ const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
4960
+ let cacheKey = 0;
4961
+ if (hasStyleToken && hasScopedStyles) {
4962
+ cacheKey |= 1 /* HAS_SCOPED_STYLE */;
4963
+ }
4964
+ if (hasStyleToken && isSyntheticShadow) {
4965
+ cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
4966
+ }
4967
+ if (!isUndefined$1(cache[cacheKey])) {
4968
+ return cache[cacheKey];
4969
+ }
4970
+ const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
4971
+ const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
4972
+ const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
4973
+ let htmlFragment = '';
4974
+ for (let i = 0, n = keys.length; i < n; i++) {
4975
+ switch (keys[i]) {
4976
+ case 0: // styleToken in existing class attr
4977
+ htmlFragment += strings[i] + classToken;
4978
+ break;
4979
+ case 1: // styleToken for added class attr
4980
+ htmlFragment += strings[i] + classAttrToken;
4981
+ break;
4982
+ case 2: // styleToken as attr
4983
+ htmlFragment += strings[i] + attrToken;
4984
+ break;
4985
+ case 3: // ${1}${2}
4986
+ htmlFragment += strings[i] + classAttrToken + attrToken;
4987
+ break;
4988
+ }
4989
+ }
4990
+ htmlFragment += strings[strings.length - 1];
4991
+ cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
4992
+ return cache[cacheKey];
4993
+ };
4994
+ };
4995
+ }
4996
+ // Note: at the moment this code executes, we don't have a renderer yet.
4997
+ const parseFragment = buildParseFragmentFn((html, renderer) => {
4998
+ const { createFragment } = renderer;
4999
+ return createFragment(html);
5000
+ });
5001
+ const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
5002
+ const { createFragment, getFirstChild } = renderer;
5003
+ const fragment = createFragment('<svg>' + html + '</svg>');
5004
+ return getFirstChild(fragment);
5005
+ });
5017
5006
  function evaluateTemplate(vm, html) {
5018
5007
  if (process.env.NODE_ENV !== 'production') {
5019
5008
  assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
@@ -5060,7 +5049,7 @@ var LWC = (function (exports) {
5060
5049
  // Evaluate, create stylesheet and cache the produced VNode for future
5061
5050
  // re-rendering.
5062
5051
  const stylesheetsContent = getStylesheetsContent(vm, html);
5063
- context.styleVNode =
5052
+ context.styleVNodes =
5064
5053
  stylesheetsContent.length === 0
5065
5054
  ? null
5066
5055
  : createStylesheet(vm, stylesheetsContent);
@@ -5077,9 +5066,9 @@ var LWC = (function (exports) {
5077
5066
  // Set the global flag that template is being updated
5078
5067
  isUpdatingTemplate = true;
5079
5068
  vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
5080
- const { styleVNode } = context;
5081
- if (!isNull(styleVNode)) {
5082
- ArrayUnshift.call(vnodes, styleVNode);
5069
+ const { styleVNodes } = context;
5070
+ if (!isNull(styleVNodes)) {
5071
+ ArrayUnshift.apply(vnodes, styleVNodes);
5083
5072
  }
5084
5073
  });
5085
5074
  }, () => {
@@ -5409,7 +5398,7 @@ var LWC = (function (exports) {
5409
5398
  return ancestor;
5410
5399
  }
5411
5400
 
5412
- function createVM(elm, ctor, options) {
5401
+ function createVM(elm, ctor, renderer, options) {
5413
5402
  const {
5414
5403
  mode,
5415
5404
  owner,
@@ -5444,7 +5433,7 @@ var LWC = (function (exports) {
5444
5433
  hasTokenInClass: undefined,
5445
5434
  hasTokenInAttribute: undefined,
5446
5435
  hasScopedStyles: undefined,
5447
- styleVNode: null,
5436
+ styleVNodes: null,
5448
5437
  tplCache: EmptyObject,
5449
5438
  wiredConnecting: EmptyArray,
5450
5439
  wiredDisconnecting: EmptyArray
@@ -5458,9 +5447,10 @@ var LWC = (function (exports) {
5458
5447
  renderRoot: null,
5459
5448
  callHook,
5460
5449
  setHook,
5461
- getHook
5450
+ getHook,
5451
+ renderer
5462
5452
  };
5463
- vm.shadowMode = computeShadowMode(vm);
5453
+ vm.shadowMode = computeShadowMode(vm, renderer);
5464
5454
  vm.tro = getTemplateReactiveObserver(vm);
5465
5455
 
5466
5456
  if (process.env.NODE_ENV !== 'production') {
@@ -5485,13 +5475,17 @@ var LWC = (function (exports) {
5485
5475
  return vm;
5486
5476
  }
5487
5477
 
5488
- function computeShadowMode(vm) {
5478
+ function computeShadowMode(vm, renderer) {
5489
5479
  const {
5490
5480
  def
5491
5481
  } = vm;
5482
+ const {
5483
+ isSyntheticShadowDefined,
5484
+ isNativeShadowDefined
5485
+ } = renderer;
5492
5486
  let shadowMode;
5493
5487
 
5494
- if (isSyntheticShadowDefined$1) {
5488
+ if (isSyntheticShadowDefined) {
5495
5489
  if (def.renderMode === 0
5496
5490
  /* Light */
5497
5491
  ) {
@@ -5500,7 +5494,7 @@ var LWC = (function (exports) {
5500
5494
  shadowMode = 0
5501
5495
  /* Native */
5502
5496
  ;
5503
- } else if (isNativeShadowDefined$1) {
5497
+ } else if (isNativeShadowDefined) {
5504
5498
  // Not combined with above condition because @lwc/features only supports identifiers in
5505
5499
  // the if-condition.
5506
5500
  if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
@@ -5590,7 +5584,8 @@ var LWC = (function (exports) {
5590
5584
  function patchShadowRoot(vm, newCh) {
5591
5585
  const {
5592
5586
  renderRoot,
5593
- children: oldCh
5587
+ children: oldCh,
5588
+ renderer
5594
5589
  } = vm; // caching the new children collection
5595
5590
 
5596
5591
  vm.children = newCh;
@@ -5606,7 +5601,7 @@ var LWC = (function (exports) {
5606
5601
  , vm);
5607
5602
  }, () => {
5608
5603
  // job
5609
- patchChildren(oldCh, newCh, renderRoot);
5604
+ patchChildren(oldCh, newCh, renderRoot, renderer);
5610
5605
  }, () => {
5611
5606
  // post
5612
5607
  logOperationEnd(2
@@ -5631,10 +5626,13 @@ var LWC = (function (exports) {
5631
5626
  const {
5632
5627
  def: {
5633
5628
  renderedCallback
5629
+ },
5630
+ renderer: {
5631
+ ssr
5634
5632
  }
5635
5633
  } = vm;
5636
5634
 
5637
- if (isTrue(ssr$1)) {
5635
+ if (isTrue(ssr)) {
5638
5636
  return;
5639
5637
  }
5640
5638
 
@@ -5868,14 +5866,17 @@ var LWC = (function (exports) {
5868
5866
  function resetComponentRoot(vm) {
5869
5867
  const {
5870
5868
  children,
5871
- renderRoot
5869
+ renderRoot,
5870
+ renderer: {
5871
+ remove
5872
+ }
5872
5873
  } = vm;
5873
5874
 
5874
5875
  for (let i = 0, len = children.length; i < len; i++) {
5875
5876
  const child = children[i];
5876
5877
 
5877
5878
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5878
- remove$1(child.elm, renderRoot);
5879
+ remove(child.elm, renderRoot);
5879
5880
  }
5880
5881
  }
5881
5882
 
@@ -5884,7 +5885,13 @@ var LWC = (function (exports) {
5884
5885
  vm.velements = EmptyArray;
5885
5886
  }
5886
5887
  function scheduleRehydration(vm) {
5887
- if (isTrue(ssr$1) || isTrue(vm.isScheduled)) {
5888
+ const {
5889
+ renderer: {
5890
+ ssr
5891
+ }
5892
+ } = vm;
5893
+
5894
+ if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5888
5895
  return;
5889
5896
  }
5890
5897
 
@@ -6060,6 +6067,9 @@ var LWC = (function (exports) {
6060
6067
  context: {
6061
6068
  wiredConnecting,
6062
6069
  wiredDisconnecting
6070
+ },
6071
+ renderer: {
6072
+ dispatchEvent
6063
6073
  }
6064
6074
  } = vm; // waiting for the component to be connected to formally request the context via the token
6065
6075
 
@@ -6083,7 +6093,7 @@ var LWC = (function (exports) {
6083
6093
  }
6084
6094
 
6085
6095
  });
6086
- dispatchEvent$1(elm, contextRegistrationEvent);
6096
+ dispatchEvent(elm, contextRegistrationEvent);
6087
6097
  });
6088
6098
  }
6089
6099
 
@@ -6331,95 +6341,116 @@ var LWC = (function (exports) {
6331
6341
  function hydrateVM(vm) {
6332
6342
  const children = renderComponent(vm);
6333
6343
  vm.children = children;
6334
- const parentNode = vm.renderRoot;
6335
- hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
6344
+ const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
6345
+ hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
6336
6346
  runRenderedCallback(vm);
6337
6347
  }
6338
- function hydrateNode(node, vnode) {
6348
+ function hydrateNode(node, vnode, renderer) {
6349
+ var _a, _b;
6339
6350
  let hydratedNode;
6340
6351
  switch (vnode.type) {
6341
6352
  case 0 /* Text */:
6342
- hydratedNode = hydrateText(node, vnode);
6353
+ // VText has no special capability, fallback to the owner's renderer
6354
+ hydratedNode = hydrateText(node, vnode, renderer);
6343
6355
  break;
6344
6356
  case 1 /* Comment */:
6345
- hydratedNode = hydrateComment(node, vnode);
6357
+ // VComment has no special capability, fallback to the owner's renderer
6358
+ hydratedNode = hydrateComment(node, vnode, renderer);
6359
+ break;
6360
+ case 4 /* Static */:
6361
+ // VStatic are cacheable and cannot have custom renderer associated to them
6362
+ hydratedNode = hydrateStaticElement(node, vnode, renderer);
6346
6363
  break;
6347
6364
  case 2 /* Element */:
6348
- hydratedNode = hydrateElement(node, vnode);
6365
+ hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
6349
6366
  break;
6350
6367
  case 3 /* CustomElement */:
6351
- hydratedNode = hydrateCustomElement(node, vnode);
6368
+ hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
6352
6369
  break;
6353
6370
  }
6354
- return nextSibling$1(hydratedNode);
6371
+ return renderer.nextSibling(hydratedNode);
6355
6372
  }
6356
- function hydrateText(node, vnode) {
6373
+ function hydrateText(node, vnode, renderer) {
6357
6374
  var _a;
6358
- if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
6359
- return handleMismatch(node, vnode);
6375
+ if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
6376
+ return handleMismatch(node, vnode, renderer);
6360
6377
  }
6361
6378
  if (process.env.NODE_ENV !== 'production') {
6362
- const nodeValue = getProperty$1(node, 'nodeValue');
6379
+ const { getProperty } = renderer;
6380
+ const nodeValue = getProperty(node, 'nodeValue');
6363
6381
  if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
6364
6382
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
6365
6383
  }
6366
6384
  }
6367
- setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6385
+ const { setText } = renderer;
6386
+ setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6368
6387
  vnode.elm = node;
6369
6388
  return node;
6370
6389
  }
6371
- function hydrateComment(node, vnode) {
6390
+ function hydrateComment(node, vnode, renderer) {
6372
6391
  var _a;
6373
- if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
6374
- return handleMismatch(node, vnode);
6392
+ if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
6393
+ return handleMismatch(node, vnode, renderer);
6375
6394
  }
6376
6395
  if (process.env.NODE_ENV !== 'production') {
6377
- const nodeValue = getProperty$1(node, 'nodeValue');
6396
+ const { getProperty } = renderer;
6397
+ const nodeValue = getProperty(node, 'nodeValue');
6378
6398
  if (nodeValue !== vnode.text) {
6379
6399
  logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
6380
6400
  }
6381
6401
  }
6382
- setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6402
+ const { setProperty } = renderer;
6403
+ setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6383
6404
  vnode.elm = node;
6384
6405
  return node;
6385
6406
  }
6386
- function hydrateElement(elm, vnode) {
6387
- if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
6388
- !isMatchingElement(vnode, elm)) {
6389
- return handleMismatch(elm, vnode);
6407
+ function hydrateStaticElement(elm, vnode, renderer) {
6408
+ if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
6409
+ return handleMismatch(elm, vnode, renderer);
6390
6410
  }
6391
6411
  vnode.elm = elm;
6412
+ return elm;
6413
+ }
6414
+ function hydrateElement(elm, vnode, renderer) {
6415
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
6416
+ !isMatchingElement(vnode, elm, renderer)) {
6417
+ return handleMismatch(elm, vnode, renderer);
6418
+ }
6419
+ vnode.elm = elm;
6420
+ const { owner } = vnode;
6392
6421
  const { context } = vnode.data;
6393
6422
  const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
6394
6423
  if (isDomManual) {
6395
6424
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
6396
6425
  // remove the innerHTML from props so it reuses the existing dom elements.
6397
- const { props } = vnode.data;
6426
+ const { data: { props }, } = vnode;
6427
+ const { getProperty } = renderer;
6398
6428
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6399
- if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
6429
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
6400
6430
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6401
6431
  vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
6402
6432
  }
6403
6433
  else {
6404
6434
  if (process.env.NODE_ENV !== 'production') {
6405
- logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
6435
+ logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
6406
6436
  }
6407
6437
  }
6408
6438
  }
6409
6439
  }
6410
- patchElementPropsAndAttrs(vnode);
6440
+ patchElementPropsAndAttrs(vnode, renderer);
6411
6441
  if (!isDomManual) {
6412
- hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
6442
+ const { getFirstChild } = renderer;
6443
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
6413
6444
  }
6414
6445
  return elm;
6415
6446
  }
6416
- function hydrateCustomElement(elm, vnode) {
6417
- if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
6418
- !isMatchingElement(vnode, elm)) {
6419
- return handleMismatch(elm, vnode);
6447
+ function hydrateCustomElement(elm, vnode, renderer) {
6448
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
6449
+ !isMatchingElement(vnode, elm, renderer)) {
6450
+ return handleMismatch(elm, vnode, renderer);
6420
6451
  }
6421
6452
  const { sel, mode, ctor, owner } = vnode;
6422
- const vm = createVM(elm, ctor, {
6453
+ const vm = createVM(elm, ctor, renderer, {
6423
6454
  mode,
6424
6455
  owner,
6425
6456
  tagName: sel,
@@ -6428,16 +6459,17 @@ var LWC = (function (exports) {
6428
6459
  vnode.elm = elm;
6429
6460
  vnode.vm = vm;
6430
6461
  allocateChildren(vnode, vm);
6431
- patchElementPropsAndAttrs(vnode);
6462
+ patchElementPropsAndAttrs(vnode, renderer);
6432
6463
  // Insert hook section:
6433
6464
  if (process.env.NODE_ENV !== 'production') {
6434
6465
  assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
6435
6466
  }
6436
6467
  runConnectedCallback(vm);
6437
6468
  if (vm.renderMode !== 0 /* Light */) {
6469
+ const { getFirstChild } = renderer;
6438
6470
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6439
6471
  // Note: for Light DOM, this is handled while hydrating the VM
6440
- hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
6472
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
6441
6473
  }
6442
6474
  hydrateVM(vm);
6443
6475
  return elm;
@@ -6446,11 +6478,12 @@ var LWC = (function (exports) {
6446
6478
  let hasWarned = false;
6447
6479
  let nextNode = node;
6448
6480
  let anchor = null;
6481
+ const { renderer } = owner;
6449
6482
  for (let i = 0; i < children.length; i++) {
6450
6483
  const childVnode = children[i];
6451
6484
  if (!isNull(childVnode)) {
6452
6485
  if (nextNode) {
6453
- nextNode = hydrateNode(nextNode, childVnode);
6486
+ nextNode = hydrateNode(nextNode, childVnode, renderer);
6454
6487
  anchor = childVnode.elm;
6455
6488
  }
6456
6489
  else {
@@ -6461,7 +6494,7 @@ var LWC = (function (exports) {
6461
6494
  logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
6462
6495
  }
6463
6496
  }
6464
- mount(childVnode, parentNode, anchor);
6497
+ mount(childVnode, parentNode, renderer, anchor);
6465
6498
  anchor = childVnode.elm;
6466
6499
  }
6467
6500
  }
@@ -6473,31 +6506,33 @@ var LWC = (function (exports) {
6473
6506
  logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
6474
6507
  }
6475
6508
  }
6509
+ // nextSibling is mostly harmless, and since we don't have
6510
+ // a good reference to what element to act upon, we instead
6511
+ // rely on the vm's associated renderer for navigating to the
6512
+ // next node in the list to be hydrated.
6513
+ const { nextSibling } = renderer;
6476
6514
  do {
6477
6515
  const current = nextNode;
6478
- nextNode = nextSibling$1(nextNode);
6479
- removeNode(current, parentNode);
6516
+ nextNode = nextSibling(nextNode);
6517
+ removeNode(current, parentNode, renderer);
6480
6518
  } while (nextNode);
6481
6519
  }
6482
6520
  }
6483
- function handleMismatch(node, vnode, msg) {
6521
+ function handleMismatch(node, vnode, renderer) {
6484
6522
  hasMismatch = true;
6485
- if (!isUndefined$1(msg)) {
6486
- if (process.env.NODE_ENV !== 'production') {
6487
- logError(msg, vnode.owner);
6488
- }
6489
- }
6490
- const parentNode = getProperty$1(node, 'parentNode');
6491
- mount(vnode, parentNode, node);
6492
- removeNode(node, parentNode);
6523
+ const { getProperty } = renderer;
6524
+ const parentNode = getProperty(node, 'parentNode');
6525
+ mount(vnode, parentNode, renderer, node);
6526
+ removeNode(node, parentNode, renderer);
6493
6527
  return vnode.elm;
6494
6528
  }
6495
- function patchElementPropsAndAttrs(vnode) {
6496
- applyEventListeners(vnode);
6497
- patchProps(null, vnode);
6529
+ function patchElementPropsAndAttrs(vnode, renderer) {
6530
+ applyEventListeners(vnode, renderer);
6531
+ patchProps(null, vnode, renderer);
6498
6532
  }
6499
- function hasCorrectNodeType(vnode, node, nodeType) {
6500
- if (getProperty$1(node, 'nodeType') !== nodeType) {
6533
+ function hasCorrectNodeType(vnode, node, nodeType, renderer) {
6534
+ const { getProperty } = renderer;
6535
+ if (getProperty(node, 'nodeType') !== nodeType) {
6501
6536
  if (process.env.NODE_ENV !== 'production') {
6502
6537
  logError('Hydration mismatch: incorrect node type received', vnode.owner);
6503
6538
  }
@@ -6505,46 +6540,51 @@ var LWC = (function (exports) {
6505
6540
  }
6506
6541
  return true;
6507
6542
  }
6508
- function isMatchingElement(vnode, elm) {
6509
- if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
6543
+ function isMatchingElement(vnode, elm, renderer) {
6544
+ const { getProperty } = renderer;
6545
+ if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
6510
6546
  if (process.env.NODE_ENV !== 'production') {
6511
- logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
6547
+ logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
6512
6548
  }
6513
6549
  return false;
6514
6550
  }
6515
- const hasIncompatibleAttrs = validateAttrs(vnode, elm);
6516
- const hasIncompatibleClass = validateClassAttr(vnode, elm);
6517
- const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
6551
+ const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
6552
+ const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
6553
+ const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
6518
6554
  return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
6519
6555
  }
6520
- function validateAttrs(vnode, elm) {
6556
+ function validateAttrs(vnode, elm, renderer) {
6521
6557
  const { data: { attrs = {} }, } = vnode;
6522
6558
  let nodesAreCompatible = true;
6523
6559
  // Validate attributes, though we could always recovery from those by running the update mods.
6524
6560
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6525
6561
  for (const [attrName, attrValue] of Object.entries(attrs)) {
6526
- const elmAttrValue = getAttribute$1(elm, attrName);
6562
+ const { owner } = vnode;
6563
+ const { getAttribute } = renderer;
6564
+ const elmAttrValue = getAttribute(elm, attrName);
6527
6565
  if (String(attrValue) !== elmAttrValue) {
6528
6566
  if (process.env.NODE_ENV !== 'production') {
6529
- logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
6567
+ const { getProperty } = renderer;
6568
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
6530
6569
  }
6531
6570
  nodesAreCompatible = false;
6532
6571
  }
6533
6572
  }
6534
6573
  return nodesAreCompatible;
6535
6574
  }
6536
- function validateClassAttr(vnode, elm) {
6575
+ function validateClassAttr(vnode, elm, renderer) {
6537
6576
  const { data: { className, classMap }, } = vnode;
6577
+ const { getProperty, getClassList } = renderer;
6538
6578
  let nodesAreCompatible = true;
6539
6579
  let vnodeClassName;
6540
- if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
6580
+ if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
6541
6581
  // className is used when class is bound to an expr.
6542
6582
  nodesAreCompatible = false;
6543
6583
  vnodeClassName = className;
6544
6584
  }
6545
6585
  else if (!isUndefined$1(classMap)) {
6546
6586
  // classMap is used when class is set to static value.
6547
- const classList = getClassList$1(elm);
6587
+ const classList = getClassList(elm);
6548
6588
  let computedClassName = '';
6549
6589
  // all classes from the vnode should be in the element.classList
6550
6590
  for (const name in classMap) {
@@ -6560,14 +6600,15 @@ var LWC = (function (exports) {
6560
6600
  }
6561
6601
  if (!nodesAreCompatible) {
6562
6602
  if (process.env.NODE_ENV !== 'production') {
6563
- logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
6603
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
6564
6604
  }
6565
6605
  }
6566
6606
  return nodesAreCompatible;
6567
6607
  }
6568
- function validateStyleAttr(vnode, elm) {
6608
+ function validateStyleAttr(vnode, elm, renderer) {
6569
6609
  const { data: { style, styleDecls }, } = vnode;
6570
- const elmStyle = getAttribute$1(elm, 'style') || '';
6610
+ const { getAttribute } = renderer;
6611
+ const elmStyle = getAttribute(elm, 'style') || '';
6571
6612
  let vnodeStyle;
6572
6613
  let nodesAreCompatible = true;
6573
6614
  if (!isUndefined$1(style) && style !== elmStyle) {
@@ -6599,11 +6640,45 @@ var LWC = (function (exports) {
6599
6640
  }
6600
6641
  if (!nodesAreCompatible) {
6601
6642
  if (process.env.NODE_ENV !== 'production') {
6602
- logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
6643
+ const { getProperty } = renderer;
6644
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
6603
6645
  }
6604
6646
  }
6605
6647
  return nodesAreCompatible;
6606
6648
  }
6649
+ function areCompatibleNodes(client, ssr, vnode, renderer) {
6650
+ const { getProperty, getAttribute } = renderer;
6651
+ if (getProperty(client, 'nodeType') === 3 /* TEXT */) {
6652
+ if (!hasCorrectNodeType(vnode, ssr, 3 /* TEXT */, renderer)) {
6653
+ return false;
6654
+ }
6655
+ return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6656
+ }
6657
+ if (getProperty(client, 'nodeType') === 8 /* COMMENT */) {
6658
+ if (!hasCorrectNodeType(vnode, ssr, 8 /* COMMENT */, renderer)) {
6659
+ return false;
6660
+ }
6661
+ return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6662
+ }
6663
+ if (!hasCorrectNodeType(vnode, ssr, 1 /* ELEMENT */, renderer)) {
6664
+ return false;
6665
+ }
6666
+ let isCompatibleElements = true;
6667
+ if (getProperty(client, 'tagName') !== getProperty(ssr, 'tagName')) {
6668
+ if (process.env.NODE_ENV !== 'production') {
6669
+ logError(`Hydration mismatch: expecting element with tag "${getProperty(client, 'tagName').toLowerCase()}" but found "${getProperty(ssr, 'tagName').toLowerCase()}".`, vnode.owner);
6670
+ }
6671
+ return false;
6672
+ }
6673
+ const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
6674
+ clientAttrsNames.forEach((attrName) => {
6675
+ if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
6676
+ logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
6677
+ isCompatibleElements = false;
6678
+ }
6679
+ });
6680
+ return isCompatibleElements;
6681
+ }
6607
6682
 
6608
6683
  /*
6609
6684
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6739,7 +6814,7 @@ var LWC = (function (exports) {
6739
6814
  }
6740
6815
  return ctor;
6741
6816
  }
6742
- /* version: 2.14.1 */
6817
+ /* version: 2.16.0 */
6743
6818
 
6744
6819
  /*
6745
6820
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6898,7 +6973,7 @@ var LWC = (function (exports) {
6898
6973
  try {
6899
6974
  // dereference HTMLElement global because babel wraps globals in compat mode with a
6900
6975
  // _wrapNativeSuper()
6901
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
6976
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
6902
6977
  // get wrapped by babel.
6903
6978
  const HTMLElementAlias = HTMLElement;
6904
6979
  // In case we use compat mode with a modern browser, the compat mode transformation
@@ -6952,8 +7027,17 @@ var LWC = (function (exports) {
6952
7027
  hydrating = value;
6953
7028
  }
6954
7029
  const ssr = false;
7030
+ function isHydrating() {
7031
+ return hydrating;
7032
+ }
6955
7033
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6956
7034
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
7035
+ function cloneNode(node, deep) {
7036
+ return node.cloneNode(deep);
7037
+ }
7038
+ function createFragment(html) {
7039
+ return document.createRange().createContextualFragment(html).firstChild;
7040
+ }
6957
7041
  function createElement$1(tagName, namespace) {
6958
7042
  return isUndefined$1(namespace)
6959
7043
  ? document.createElement(tagName)
@@ -7070,76 +7154,49 @@ var LWC = (function (exports) {
7070
7154
  assert.invariant(elm instanceof HTMLElement, msg);
7071
7155
  }
7072
7156
  const HTMLElementExported = HTMLElementConstructor;
7073
-
7074
- /*
7075
- * Copyright (c) 2020, salesforce.com, inc.
7076
- * All rights reserved.
7077
- * SPDX-License-Identifier: MIT
7078
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7079
- */
7080
- setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElement);
7081
- setAttachShadow(attachShadow);
7082
- setCreateComment(createComment);
7083
- setCreateElement(createElement$1);
7084
- setCreateText(createText);
7085
- setDefineCustomElement(defineCustomElement);
7086
- setDispatchEvent(dispatchEvent);
7087
- setGetAttribute(getAttribute);
7088
- setGetBoundingClientRect(getBoundingClientRect);
7089
- setGetChildNodes(getChildNodes);
7090
- setGetChildren(getChildren);
7091
- setGetClassList(getClassList);
7092
- setGetCustomElement(getCustomElement);
7093
- setGetElementsByClassName(getElementsByClassName);
7094
- setGetElementsByTagName(getElementsByTagName);
7095
- setGetFirstChild(getFirstChild);
7096
- setGetFirstElementChild(getFirstElementChild);
7097
- setGetLastChild(getLastChild);
7098
- setGetLastElementChild(getLastElementChild);
7099
- setGetProperty(getProperty);
7100
- setHTMLElement(HTMLElementExported);
7101
- setInsert(insert);
7102
- setIsConnected(isConnected);
7103
- setIsNativeShadowDefined(isNativeShadowDefined);
7104
- setIsSyntheticShadowDefined(isSyntheticShadowDefined);
7105
- setNextSibling(nextSibling);
7106
- setQuerySelector(querySelector);
7107
- setQuerySelectorAll(querySelectorAll);
7108
- setRemove(remove);
7109
- setRemoveAttribute(removeAttribute);
7110
- setRemoveEventListener(removeEventListener);
7111
- setSetAttribute(setAttribute);
7112
- setSetCSSStyleProperty(setCSSStyleProperty);
7113
- setSetProperty(setProperty);
7114
- setSetText(setText);
7115
- setSsr(ssr);
7116
- setAddEventListener(addEventListener);
7117
- setInsertStylesheet(insertStylesheet);
7118
-
7119
- /*
7120
- * Copyright (c) 2018, salesforce.com, inc.
7121
- * All rights reserved.
7122
- * SPDX-License-Identifier: MIT
7123
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7124
- */
7125
- // @ts-ignore
7126
-
7127
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7128
- window.addEventListener('test-dummy-flag', () => {
7129
- let hasFlag = false;
7130
-
7131
- if (runtimeFlags.DUMMY_TEST_FLAG) {
7132
- hasFlag = true;
7133
- }
7134
-
7135
- window.dispatchEvent(new CustomEvent('has-dummy-flag', {
7136
- detail: {
7137
- package: '@lwc/engine-dom',
7138
- hasFlag
7139
- }
7140
- }));
7141
- });
7142
- }
7157
+ const renderer = {
7158
+ ssr,
7159
+ isNativeShadowDefined,
7160
+ isSyntheticShadowDefined,
7161
+ HTMLElementExported,
7162
+ isHydrating,
7163
+ insert,
7164
+ remove,
7165
+ cloneNode,
7166
+ createFragment,
7167
+ createElement: createElement$1,
7168
+ createText,
7169
+ createComment,
7170
+ nextSibling,
7171
+ attachShadow,
7172
+ getProperty,
7173
+ setProperty,
7174
+ setText,
7175
+ getAttribute,
7176
+ setAttribute,
7177
+ removeAttribute,
7178
+ addEventListener,
7179
+ removeEventListener,
7180
+ dispatchEvent,
7181
+ getClassList,
7182
+ setCSSStyleProperty,
7183
+ getBoundingClientRect,
7184
+ querySelector,
7185
+ querySelectorAll,
7186
+ getElementsByTagName,
7187
+ getElementsByClassName,
7188
+ getChildren,
7189
+ getChildNodes,
7190
+ getFirstChild,
7191
+ getFirstElementChild,
7192
+ getLastChild,
7193
+ getLastElementChild,
7194
+ isConnected,
7195
+ insertStylesheet,
7196
+ assertInstanceOfHTMLElement,
7197
+ defineCustomElement,
7198
+ getCustomElement,
7199
+ };
7143
7200
 
7144
7201
  /*
7145
7202
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7161,7 +7218,7 @@ var LWC = (function (exports) {
7161
7218
  }
7162
7219
  }
7163
7220
  function createVMWithProps(element, Ctor, props) {
7164
- const vm = createVM(element, Ctor, {
7221
+ const vm = createVM(element, Ctor, renderer, {
7165
7222
  mode: 'open',
7166
7223
  owner: null,
7167
7224
  tagName: element.tagName.toLowerCase(),
@@ -7257,7 +7314,7 @@ var LWC = (function (exports) {
7257
7314
  hydratedCustomElements.add(this);
7258
7315
  }
7259
7316
  else {
7260
- createVM(this, Ctor, {
7317
+ createVM(this, Ctor, renderer, {
7261
7318
  mode: 'open',
7262
7319
  owner: null,
7263
7320
  tagName: this.tagName,
@@ -7342,7 +7399,7 @@ var LWC = (function (exports) {
7342
7399
  if (!isFunction$1(Ctor)) {
7343
7400
  throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
7344
7401
  }
7345
- const UpgradableConstructor = getUpgradableConstructor(sel);
7402
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
7346
7403
  let wasComponentUpgraded = false;
7347
7404
  // the custom element from the registry is expecting an upgrade callback
7348
7405
  /**
@@ -7352,7 +7409,7 @@ var LWC = (function (exports) {
7352
7409
  * an upgradable custom element.
7353
7410
  */
7354
7411
  const element = new UpgradableConstructor((elm) => {
7355
- createVM(elm, Ctor, {
7412
+ createVM(elm, Ctor, renderer, {
7356
7413
  tagName: sel,
7357
7414
  mode: options.mode !== 'closed' ? 'open' : 'closed',
7358
7415
  owner: null,
@@ -7436,7 +7493,7 @@ var LWC = (function (exports) {
7436
7493
  });
7437
7494
  freeze(LightningElement);
7438
7495
  seal(LightningElement.prototype);
7439
- /* version: 2.14.1 */
7496
+ /* version: 2.16.0 */
7440
7497
 
7441
7498
  exports.LightningElement = LightningElement;
7442
7499
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7450,11 +7507,14 @@ var LWC = (function (exports) {
7450
7507
  exports.hydrateComponent = hydrateComponent;
7451
7508
  exports.isComponentConstructor = isComponentConstructor;
7452
7509
  exports.isNodeFromTemplate = isNodeShadowed;
7510
+ exports.parseFragment = parseFragment;
7511
+ exports.parseSVGFragment = parseSVGFragment;
7453
7512
  exports.readonly = readonly;
7454
7513
  exports.register = register;
7455
7514
  exports.registerComponent = registerComponent;
7456
7515
  exports.registerDecorators = registerDecorators;
7457
7516
  exports.registerTemplate = registerTemplate;
7517
+ exports.renderer = renderer;
7458
7518
  exports.sanitizeAttribute = sanitizeAttribute;
7459
7519
  exports.setFeatureFlag = setFeatureFlag;
7460
7520
  exports.setFeatureFlagForTest = setFeatureFlagForTest;