@lwc/engine-core 2.13.4 → 2.14.2

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.
@@ -112,164 +112,6 @@ function flattenStylesheets(stylesheets) {
112
112
  return list;
113
113
  }
114
114
 
115
- //
116
- // Primitives
117
- //
118
- let ssr;
119
- function setSsr(ssrImpl) {
120
- ssr = ssrImpl;
121
- }
122
- let isNativeShadowDefined;
123
- function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
124
- isNativeShadowDefined = isNativeShadowDefinedImpl;
125
- }
126
- let isSyntheticShadowDefined;
127
- function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
128
- isSyntheticShadowDefined = isSyntheticShadowDefinedImpl;
129
- }
130
- let HTMLElementExported;
131
- function setHTMLElement(HTMLElementImpl) {
132
- HTMLElementExported = HTMLElementImpl;
133
- }
134
- function setIsHydrating(isHydratingImpl) {
135
- }
136
- let insert;
137
- function setInsert(insertImpl) {
138
- insert = insertImpl;
139
- }
140
- let remove;
141
- function setRemove(removeImpl) {
142
- remove = removeImpl;
143
- }
144
- let createElement;
145
- function setCreateElement(createElementImpl) {
146
- createElement = createElementImpl;
147
- }
148
- let createText;
149
- function setCreateText(createTextImpl) {
150
- createText = createTextImpl;
151
- }
152
- let createComment;
153
- function setCreateComment(createCommentImpl) {
154
- createComment = createCommentImpl;
155
- }
156
- let nextSibling;
157
- function setNextSibling(nextSiblingImpl) {
158
- nextSibling = nextSiblingImpl;
159
- }
160
- let attachShadow;
161
- function setAttachShadow(attachShadowImpl) {
162
- attachShadow = attachShadowImpl;
163
- }
164
- let getProperty;
165
- function setGetProperty(getPropertyImpl) {
166
- getProperty = getPropertyImpl;
167
- }
168
- let setProperty;
169
- function setSetProperty(setPropertyImpl) {
170
- setProperty = setPropertyImpl;
171
- }
172
- let setText;
173
- function setSetText(setTextImpl) {
174
- setText = setTextImpl;
175
- }
176
- let getAttribute;
177
- function setGetAttribute(getAttributeImpl) {
178
- getAttribute = getAttributeImpl;
179
- }
180
- let setAttribute;
181
- function setSetAttribute(setAttributeImpl) {
182
- setAttribute = setAttributeImpl;
183
- }
184
- let removeAttribute;
185
- function setRemoveAttribute(removeAttributeImpl) {
186
- removeAttribute = removeAttributeImpl;
187
- }
188
- let addEventListener;
189
- function setAddEventListener(addEventListenerImpl) {
190
- addEventListener = addEventListenerImpl;
191
- }
192
- let removeEventListener;
193
- function setRemoveEventListener(removeEventListenerImpl) {
194
- removeEventListener = removeEventListenerImpl;
195
- }
196
- let dispatchEvent;
197
- function setDispatchEvent(dispatchEventImpl) {
198
- dispatchEvent = dispatchEventImpl;
199
- }
200
- let getClassList;
201
- function setGetClassList(getClassListImpl) {
202
- getClassList = getClassListImpl;
203
- }
204
- let setCSSStyleProperty;
205
- function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
206
- setCSSStyleProperty = setCSSStylePropertyImpl;
207
- }
208
- let getBoundingClientRect;
209
- function setGetBoundingClientRect(getBoundingClientRectImpl) {
210
- getBoundingClientRect = getBoundingClientRectImpl;
211
- }
212
- let querySelector;
213
- function setQuerySelector(querySelectorImpl) {
214
- querySelector = querySelectorImpl;
215
- }
216
- let querySelectorAll;
217
- function setQuerySelectorAll(querySelectorAllImpl) {
218
- querySelectorAll = querySelectorAllImpl;
219
- }
220
- let getElementsByTagName;
221
- function setGetElementsByTagName(getElementsByTagNameImpl) {
222
- getElementsByTagName = getElementsByTagNameImpl;
223
- }
224
- let getElementsByClassName;
225
- function setGetElementsByClassName(getElementsByClassNameImpl) {
226
- getElementsByClassName = getElementsByClassNameImpl;
227
- }
228
- let getChildren;
229
- function setGetChildren(getChildrenImpl) {
230
- getChildren = getChildrenImpl;
231
- }
232
- let getChildNodes;
233
- function setGetChildNodes(getChildNodesImpl) {
234
- getChildNodes = getChildNodesImpl;
235
- }
236
- let getFirstChild;
237
- function setGetFirstChild(getFirstChildImpl) {
238
- getFirstChild = getFirstChildImpl;
239
- }
240
- let getFirstElementChild;
241
- function setGetFirstElementChild(getFirstElementChildImpl) {
242
- getFirstElementChild = getFirstElementChildImpl;
243
- }
244
- let getLastChild;
245
- function setGetLastChild(getLastChildImpl) {
246
- getLastChild = getLastChildImpl;
247
- }
248
- let getLastElementChild;
249
- function setGetLastElementChild(getLastElementChildImpl) {
250
- getLastElementChild = getLastElementChildImpl;
251
- }
252
- let isConnected;
253
- function setIsConnected(isConnectedImpl) {
254
- isConnected = isConnectedImpl;
255
- }
256
- let insertStylesheet;
257
- function setInsertStylesheet(insertStylesheetImpl) {
258
- insertStylesheet = insertStylesheetImpl;
259
- }
260
- let assertInstanceOfHTMLElement;
261
- function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
262
- assertInstanceOfHTMLElement = assertInstanceOfHTMLElementImpl;
263
- }
264
- let defineCustomElement;
265
- function setDefineCustomElement(defineCustomElementImpl) {
266
- defineCustomElement = defineCustomElementImpl;
267
- }
268
- let getCustomElement;
269
- function setGetCustomElement(getCustomElementImpl) {
270
- getCustomElement = getCustomElementImpl;
271
- }
272
-
273
115
  /*
274
116
  * Copyright (c) 2019, salesforce.com, inc.
275
117
  * All rights reserved.
@@ -1574,6 +1416,7 @@ const LightningElement = function () {
1574
1416
  const { def, elm } = vm;
1575
1417
  const { bridge } = def;
1576
1418
  if (process.env.NODE_ENV !== 'production') {
1419
+ const { assertInstanceOfHTMLElement } = vm.renderer;
1577
1420
  assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
1578
1421
  }
1579
1422
  const component = this;
@@ -1608,7 +1451,7 @@ const LightningElement = function () {
1608
1451
  return this;
1609
1452
  };
1610
1453
  function doAttachShadow(vm) {
1611
- const { elm, mode, shadowMode, def: { ctor }, } = vm;
1454
+ const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
1612
1455
  const shadowRoot = attachShadow(elm, {
1613
1456
  [shared.KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
1614
1457
  delegatesFocus: Boolean(ctor.delegatesFocus),
@@ -1630,12 +1473,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
1630
1473
  LightningElement.prototype = {
1631
1474
  constructor: LightningElement,
1632
1475
  dispatchEvent(event) {
1633
- const { elm } = getAssociatedVM(this);
1476
+ const vm = getAssociatedVM(this);
1477
+ const { elm, renderer: { dispatchEvent }, } = vm;
1634
1478
  return dispatchEvent(elm, event);
1635
1479
  },
1636
1480
  addEventListener(type, listener, options) {
1637
1481
  const vm = getAssociatedVM(this);
1638
- const { elm } = vm;
1482
+ const { elm, renderer: { addEventListener }, } = vm;
1639
1483
  if (process.env.NODE_ENV !== 'production') {
1640
1484
  const vmBeingRendered = getVMBeingRendered();
1641
1485
  shared.assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
@@ -1647,41 +1491,48 @@ LightningElement.prototype = {
1647
1491
  },
1648
1492
  removeEventListener(type, listener, options) {
1649
1493
  const vm = getAssociatedVM(this);
1650
- const { elm } = vm;
1494
+ const { elm, renderer: { removeEventListener }, } = vm;
1651
1495
  const wrappedListener = getWrappedComponentsListener(vm, listener);
1652
1496
  removeEventListener(elm, type, wrappedListener, options);
1653
1497
  },
1654
1498
  hasAttribute(name) {
1655
- const { elm } = getAssociatedVM(this);
1499
+ const vm = getAssociatedVM(this);
1500
+ const { elm, renderer: { getAttribute }, } = vm;
1656
1501
  return !shared.isNull(getAttribute(elm, name));
1657
1502
  },
1658
1503
  hasAttributeNS(namespace, name) {
1659
- const { elm } = getAssociatedVM(this);
1504
+ const vm = getAssociatedVM(this);
1505
+ const { elm, renderer: { getAttribute }, } = vm;
1660
1506
  return !shared.isNull(getAttribute(elm, name, namespace));
1661
1507
  },
1662
1508
  removeAttribute(name) {
1663
- const { elm } = getAssociatedVM(this);
1509
+ const vm = getAssociatedVM(this);
1510
+ const { elm, renderer: { removeAttribute }, } = vm;
1664
1511
  unlockAttribute(elm, name);
1665
1512
  removeAttribute(elm, name);
1666
1513
  lockAttribute();
1667
1514
  },
1668
1515
  removeAttributeNS(namespace, name) {
1669
- const { elm } = getAssociatedVM(this);
1516
+ const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
1670
1517
  unlockAttribute(elm, name);
1671
1518
  removeAttribute(elm, name, namespace);
1672
1519
  lockAttribute();
1673
1520
  },
1674
1521
  getAttribute(name) {
1675
- const { elm } = getAssociatedVM(this);
1522
+ const vm = getAssociatedVM(this);
1523
+ const { elm } = vm;
1524
+ const { getAttribute } = vm.renderer;
1676
1525
  return getAttribute(elm, name);
1677
1526
  },
1678
1527
  getAttributeNS(namespace, name) {
1679
- const { elm } = getAssociatedVM(this);
1528
+ const vm = getAssociatedVM(this);
1529
+ const { elm } = vm;
1530
+ const { getAttribute } = vm.renderer;
1680
1531
  return getAttribute(elm, name, namespace);
1681
1532
  },
1682
1533
  setAttribute(name, value) {
1683
1534
  const vm = getAssociatedVM(this);
1684
- const { elm } = vm;
1535
+ const { elm, renderer: { setAttribute }, } = vm;
1685
1536
  if (process.env.NODE_ENV !== 'production') {
1686
1537
  shared.assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1687
1538
  }
@@ -1691,7 +1542,7 @@ LightningElement.prototype = {
1691
1542
  },
1692
1543
  setAttributeNS(namespace, name, value) {
1693
1544
  const vm = getAssociatedVM(this);
1694
- const { elm } = vm;
1545
+ const { elm, renderer: { setAttribute }, } = vm;
1695
1546
  if (process.env.NODE_ENV !== 'production') {
1696
1547
  shared.assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1697
1548
  }
@@ -1701,19 +1552,20 @@ LightningElement.prototype = {
1701
1552
  },
1702
1553
  getBoundingClientRect() {
1703
1554
  const vm = getAssociatedVM(this);
1704
- const { elm } = vm;
1555
+ const { elm, renderer: { getBoundingClientRect }, } = vm;
1705
1556
  if (process.env.NODE_ENV !== 'production') {
1706
1557
  warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
1707
1558
  }
1708
1559
  return getBoundingClientRect(elm);
1709
1560
  },
1710
1561
  get isConnected() {
1711
- const { elm } = getAssociatedVM(this);
1562
+ const vm = getAssociatedVM(this);
1563
+ const { elm, renderer: { isConnected }, } = vm;
1712
1564
  return isConnected(elm);
1713
1565
  },
1714
1566
  get classList() {
1715
1567
  const vm = getAssociatedVM(this);
1716
- const { elm } = vm;
1568
+ const { elm, renderer: { getClassList }, } = vm;
1717
1569
  if (process.env.NODE_ENV !== 'production') {
1718
1570
  // TODO [#1290]: this still fails in dev but works in production, eventually, we should
1719
1571
  // just throw in all modes
@@ -1735,6 +1587,54 @@ LightningElement.prototype = {
1735
1587
  // Authors should rely on this.template instead.
1736
1588
  return null;
1737
1589
  },
1590
+ get children() {
1591
+ const vm = getAssociatedVM(this);
1592
+ const renderer = vm.renderer;
1593
+ if (process.env.NODE_ENV !== 'production') {
1594
+ warnIfInvokedDuringConstruction(vm, 'children');
1595
+ }
1596
+ return renderer.getChildren(vm.elm);
1597
+ },
1598
+ get childNodes() {
1599
+ const vm = getAssociatedVM(this);
1600
+ const renderer = vm.renderer;
1601
+ if (process.env.NODE_ENV !== 'production') {
1602
+ warnIfInvokedDuringConstruction(vm, 'childNodes');
1603
+ }
1604
+ return renderer.getChildNodes(vm.elm);
1605
+ },
1606
+ get firstChild() {
1607
+ const vm = getAssociatedVM(this);
1608
+ const renderer = vm.renderer;
1609
+ if (process.env.NODE_ENV !== 'production') {
1610
+ warnIfInvokedDuringConstruction(vm, 'firstChild');
1611
+ }
1612
+ return renderer.getFirstChild(vm.elm);
1613
+ },
1614
+ get firstElementChild() {
1615
+ const vm = getAssociatedVM(this);
1616
+ const renderer = vm.renderer;
1617
+ if (process.env.NODE_ENV !== 'production') {
1618
+ warnIfInvokedDuringConstruction(vm, 'firstElementChild');
1619
+ }
1620
+ return renderer.getFirstElementChild(vm.elm);
1621
+ },
1622
+ get lastChild() {
1623
+ const vm = getAssociatedVM(this);
1624
+ const renderer = vm.renderer;
1625
+ if (process.env.NODE_ENV !== 'production') {
1626
+ warnIfInvokedDuringConstruction(vm, 'lastChild');
1627
+ }
1628
+ return renderer.getLastChild(vm.elm);
1629
+ },
1630
+ get lastElementChild() {
1631
+ const vm = getAssociatedVM(this);
1632
+ const renderer = vm.renderer;
1633
+ if (process.env.NODE_ENV !== 'production') {
1634
+ warnIfInvokedDuringConstruction(vm, 'lastElementChild');
1635
+ }
1636
+ return renderer.getLastElementChild(vm.elm);
1637
+ },
1738
1638
  render() {
1739
1639
  const vm = getAssociatedVM(this);
1740
1640
  return vm.def.template;
@@ -1745,76 +1645,22 @@ LightningElement.prototype = {
1745
1645
  },
1746
1646
  };
1747
1647
  const queryAndChildGetterDescriptors = shared.create(null);
1748
- // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
1749
- // is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
1750
- // object representing the renderer, with a lot of methods we don't actually need.
1751
- const childGetters = [
1752
- 'children',
1753
- 'childNodes',
1754
- 'firstChild',
1755
- 'firstElementChild',
1756
- 'lastChild',
1757
- 'lastElementChild',
1758
- ];
1759
- function getChildGetter(methodName) {
1760
- switch (methodName) {
1761
- case 'children':
1762
- return getChildren;
1763
- case 'childNodes':
1764
- return getChildNodes;
1765
- case 'firstChild':
1766
- return getFirstChild;
1767
- case 'firstElementChild':
1768
- return getFirstElementChild;
1769
- case 'lastChild':
1770
- return getLastChild;
1771
- case 'lastElementChild':
1772
- return getLastElementChild;
1773
- }
1774
- }
1775
- // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
1776
- for (const childGetter of childGetters) {
1777
- queryAndChildGetterDescriptors[childGetter] = {
1778
- get() {
1779
- const vm = getAssociatedVM(this);
1780
- const { elm } = vm;
1781
- if (process.env.NODE_ENV !== 'production') {
1782
- warnIfInvokedDuringConstruction(vm, childGetter);
1783
- }
1784
- return getChildGetter(childGetter)(elm);
1785
- },
1786
- configurable: true,
1787
- enumerable: true,
1788
- };
1789
- }
1790
1648
  const queryMethods = [
1791
1649
  'getElementsByClassName',
1792
1650
  'getElementsByTagName',
1793
1651
  'querySelector',
1794
1652
  'querySelectorAll',
1795
1653
  ];
1796
- function getQueryMethod(methodName) {
1797
- switch (methodName) {
1798
- case 'getElementsByClassName':
1799
- return getElementsByClassName;
1800
- case 'getElementsByTagName':
1801
- return getElementsByTagName;
1802
- case 'querySelector':
1803
- return querySelector;
1804
- case 'querySelectorAll':
1805
- return querySelectorAll;
1806
- }
1807
- }
1808
1654
  // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
1809
1655
  for (const queryMethod of queryMethods) {
1810
1656
  queryAndChildGetterDescriptors[queryMethod] = {
1811
1657
  value(arg) {
1812
1658
  const vm = getAssociatedVM(this);
1813
- const { elm } = vm;
1659
+ const { elm, renderer } = vm;
1814
1660
  if (process.env.NODE_ENV !== 'production') {
1815
1661
  warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
1816
1662
  }
1817
- return getQueryMethod(queryMethod)(elm, arg);
1663
+ return renderer[queryMethod](elm, arg);
1818
1664
  },
1819
1665
  configurable: true,
1820
1666
  enumerable: true,
@@ -2319,7 +2165,8 @@ function getDecoratorsMeta(Ctor) {
2319
2165
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2320
2166
  */
2321
2167
  let warned = false;
2322
- if (process.env.NODE_ENV === 'development') {
2168
+ // @ts-ignore
2169
+ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
2323
2170
  // @ts-ignore
2324
2171
  window.__lwcResetWarnedOnVersionMismatch = () => {
2325
2172
  warned = false;
@@ -3037,7 +2884,8 @@ function getComponentDef(Ctor) {
3037
2884
  * SPDX-License-Identifier: MIT
3038
2885
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3039
2886
  */
3040
- function getUpgradableConstructor(tagName) {
2887
+ function getUpgradableConstructor(tagName, renderer) {
2888
+ const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
3041
2889
  // Should never get a tag with upper case letter at this point, the compiler should
3042
2890
  // produce only tags with lowercase letters
3043
2891
  // But, for backwards compatibility, we will lower case the tagName
@@ -3050,7 +2898,7 @@ function getUpgradableConstructor(tagName) {
3050
2898
  * LWC Upgradable Element reference to an element that was created
3051
2899
  * via the scoped registry mechanism, and that is ready to be upgraded.
3052
2900
  */
3053
- CE = class LWCUpgradableElement extends HTMLElementExported {
2901
+ CE = class LWCUpgradableElement extends RendererHTMLElement {
3054
2902
  constructor(upgradeCallback) {
3055
2903
  super();
3056
2904
  if (shared.isFunction(upgradeCallback)) {
@@ -3083,7 +2931,7 @@ function isSameVnode(vnode1, vnode2) {
3083
2931
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3084
2932
  */
3085
2933
  const ColonCharCode = 58;
3086
- function patchAttributes(oldVnode, vnode) {
2934
+ function patchAttributes(oldVnode, vnode, renderer) {
3087
2935
  const { attrs } = vnode.data;
3088
2936
  if (shared.isUndefined(attrs)) {
3089
2937
  return;
@@ -3093,6 +2941,7 @@ function patchAttributes(oldVnode, vnode) {
3093
2941
  return;
3094
2942
  }
3095
2943
  const { elm } = vnode;
2944
+ const { setAttribute, removeAttribute } = renderer;
3096
2945
  for (const key in attrs) {
3097
2946
  const cur = attrs[key];
3098
2947
  const old = oldAttrs[key];
@@ -3128,7 +2977,7 @@ function isLiveBindingProp(sel, key) {
3128
2977
  // instead of relying on internally tracked values.
3129
2978
  return sel === 'input' && (key === 'value' || key === 'checked');
3130
2979
  }
3131
- function patchProps(oldVnode, vnode) {
2980
+ function patchProps(oldVnode, vnode, renderer) {
3132
2981
  const { props } = vnode.data;
3133
2982
  if (shared.isUndefined(props)) {
3134
2983
  return;
@@ -3139,6 +2988,7 @@ function patchProps(oldVnode, vnode) {
3139
2988
  }
3140
2989
  const isFirstPatch = shared.isNull(oldVnode);
3141
2990
  const { elm, sel } = vnode;
2991
+ const { getProperty, setProperty } = renderer;
3142
2992
  for (const key in props) {
3143
2993
  const cur = props[key];
3144
2994
  // Set the property if it's the first time is is patched or if the previous property is
@@ -3190,12 +3040,13 @@ function getMapFromClassName(className) {
3190
3040
  }
3191
3041
  return map;
3192
3042
  }
3193
- function patchClassAttribute(oldVnode, vnode) {
3043
+ function patchClassAttribute(oldVnode, vnode, renderer) {
3194
3044
  const { elm, data: { className: newClass }, } = vnode;
3195
3045
  const oldClass = shared.isNull(oldVnode) ? undefined : oldVnode.data.className;
3196
3046
  if (oldClass === newClass) {
3197
3047
  return;
3198
3048
  }
3049
+ const { getClassList } = renderer;
3199
3050
  const classList = getClassList(elm);
3200
3051
  const newClassMap = getMapFromClassName(newClass);
3201
3052
  const oldClassMap = getMapFromClassName(oldClass);
@@ -3220,12 +3071,13 @@ function patchClassAttribute(oldVnode, vnode) {
3220
3071
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3221
3072
  */
3222
3073
  // The style property is a string when defined via an expression in the template.
3223
- function patchStyleAttribute(oldVnode, vnode) {
3074
+ function patchStyleAttribute(oldVnode, vnode, renderer) {
3224
3075
  const { elm, data: { style: newStyle }, } = vnode;
3225
3076
  const oldStyle = shared.isNull(oldVnode) ? undefined : oldVnode.data.style;
3226
3077
  if (oldStyle === newStyle) {
3227
3078
  return;
3228
3079
  }
3080
+ const { setAttribute, removeAttribute } = renderer;
3229
3081
  if (!shared.isString(newStyle) || newStyle === '') {
3230
3082
  removeAttribute(elm, 'style');
3231
3083
  }
@@ -3240,11 +3092,12 @@ function patchStyleAttribute(oldVnode, vnode) {
3240
3092
  * SPDX-License-Identifier: MIT
3241
3093
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3242
3094
  */
3243
- function applyEventListeners(vnode) {
3095
+ function applyEventListeners(vnode, renderer) {
3244
3096
  const { elm, data: { on }, } = vnode;
3245
3097
  if (shared.isUndefined(on)) {
3246
3098
  return;
3247
3099
  }
3100
+ const { addEventListener } = renderer;
3248
3101
  for (const name in on) {
3249
3102
  const handler = on[name];
3250
3103
  addEventListener(elm, name, handler);
@@ -3260,11 +3113,12 @@ function applyEventListeners(vnode) {
3260
3113
  // The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
3261
3114
  // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
3262
3115
  // different classnames properties individually instead of via a string.
3263
- function applyStaticClassAttribute(vnode) {
3116
+ function applyStaticClassAttribute(vnode, renderer) {
3264
3117
  const { elm, data: { classMap }, } = vnode;
3265
3118
  if (shared.isUndefined(classMap)) {
3266
3119
  return;
3267
3120
  }
3121
+ const { getClassList } = renderer;
3268
3122
  const classList = getClassList(elm);
3269
3123
  for (const name in classMap) {
3270
3124
  classList.add(name);
@@ -3280,11 +3134,12 @@ function applyStaticClassAttribute(vnode) {
3280
3134
  // The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
3281
3135
  // The compiler takes care of transforming the inline style into an object. It's faster to set the
3282
3136
  // different style properties individually instead of via a string.
3283
- function applyStaticStyleAttribute(vnode) {
3137
+ function applyStaticStyleAttribute(vnode, renderer) {
3284
3138
  const { elm, data: { styleDecls }, } = vnode;
3285
3139
  if (shared.isUndefined(styleDecls)) {
3286
3140
  return;
3287
3141
  }
3142
+ const { setCSSStyleProperty } = renderer;
3288
3143
  for (let i = 0; i < styleDecls.length; i++) {
3289
3144
  const [prop, value, important] = styleDecls[i];
3290
3145
  setCSSStyleProperty(elm, prop, value, important);
@@ -3297,15 +3152,16 @@ function applyStaticStyleAttribute(vnode) {
3297
3152
  * SPDX-License-Identifier: MIT
3298
3153
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3299
3154
  */
3300
- function patchChildren(c1, c2, parent) {
3155
+ function patchChildren(c1, c2, parent, renderer) {
3301
3156
  if (hasDynamicChildren(c2)) {
3302
- updateDynamicChildren(c1, c2, parent);
3157
+ updateDynamicChildren(c1, c2, parent, renderer);
3303
3158
  }
3304
3159
  else {
3305
- updateStaticChildren(c1, c2, parent);
3160
+ updateStaticChildren(c1, c2, parent, renderer);
3306
3161
  }
3307
3162
  }
3308
- function patch(n1, n2) {
3163
+ function patch(n1, n2, renderer) {
3164
+ var _a, _b;
3309
3165
  if (n1 === n2) {
3310
3166
  return;
3311
3167
  }
@@ -3319,80 +3175,90 @@ function patch(n1, n2) {
3319
3175
  }
3320
3176
  switch (n2.type) {
3321
3177
  case 0 /* Text */:
3322
- patchText(n1, n2);
3178
+ // VText has no special capability, fallback to the owner's renderer
3179
+ patchText(n1, n2, renderer);
3323
3180
  break;
3324
3181
  case 1 /* Comment */:
3325
- patchComment(n1, n2);
3182
+ // VComment has no special capability, fallback to the owner's renderer
3183
+ patchComment(n1, n2, renderer);
3326
3184
  break;
3327
3185
  case 2 /* Element */:
3328
- patchElement(n1, n2);
3186
+ patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3329
3187
  break;
3330
3188
  case 3 /* CustomElement */:
3331
- patchCustomElement(n1, n2);
3189
+ patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3332
3190
  break;
3333
3191
  }
3334
3192
  }
3335
- function mount(node, parent, anchor) {
3193
+ function mount(node, parent, renderer, anchor) {
3194
+ var _a, _b;
3336
3195
  switch (node.type) {
3337
3196
  case 0 /* Text */:
3338
- mountText(node, parent, anchor);
3197
+ // VText has no special capability, fallback to the owner's renderer
3198
+ mountText(node, parent, anchor, renderer);
3339
3199
  break;
3340
3200
  case 1 /* Comment */:
3341
- mountComment(node, parent, anchor);
3201
+ // VComment has no special capability, fallback to the owner's renderer
3202
+ mountComment(node, parent, anchor, renderer);
3342
3203
  break;
3343
3204
  case 2 /* Element */:
3344
- mountElement(node, parent, anchor);
3205
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3206
+ mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3345
3207
  break;
3346
3208
  case 3 /* CustomElement */:
3347
- mountCustomElement(node, parent, anchor);
3209
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3210
+ mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3348
3211
  break;
3349
3212
  }
3350
3213
  }
3351
- function patchText(n1, n2) {
3214
+ function patchText(n1, n2, renderer) {
3352
3215
  n2.elm = n1.elm;
3353
3216
  if (n2.text !== n1.text) {
3354
- updateTextContent(n2);
3217
+ updateTextContent(n2, renderer);
3355
3218
  }
3356
3219
  }
3357
- function mountText(node, parent, anchor) {
3358
- const { owner } = node;
3359
- const textNode = (node.elm = createText(node.text));
3360
- linkNodeToShadow(textNode, owner);
3361
- insertNode(textNode, parent, anchor);
3220
+ function mountText(vnode, parent, anchor, renderer) {
3221
+ const { owner } = vnode;
3222
+ const { createText } = renderer;
3223
+ const textNode = (vnode.elm = createText(vnode.text));
3224
+ linkNodeToShadow(textNode, owner, renderer);
3225
+ insertNode(textNode, parent, anchor, renderer);
3362
3226
  }
3363
- function patchComment(n1, n2) {
3227
+ function patchComment(n1, n2, renderer) {
3364
3228
  n2.elm = n1.elm;
3365
3229
  // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3366
3230
  // it is the case today.
3367
3231
  if (n2.text !== n1.text) {
3368
- updateTextContent(n2);
3232
+ updateTextContent(n2, renderer);
3369
3233
  }
3370
3234
  }
3371
- function mountComment(node, parent, anchor) {
3372
- const { owner } = node;
3373
- const commentNode = (node.elm = createComment(node.text));
3374
- linkNodeToShadow(commentNode, owner);
3375
- insertNode(commentNode, parent, anchor);
3235
+ function mountComment(vnode, parent, anchor, renderer) {
3236
+ const { owner } = vnode;
3237
+ const { createComment } = renderer;
3238
+ const commentNode = (vnode.elm = createComment(vnode.text));
3239
+ linkNodeToShadow(commentNode, owner, renderer);
3240
+ insertNode(commentNode, parent, anchor, renderer);
3376
3241
  }
3377
- function mountElement(vnode, parent, anchor) {
3242
+ function mountElement(vnode, parent, anchor, renderer) {
3378
3243
  const { sel, owner, data: { svg }, } = vnode;
3244
+ const { createElement } = renderer;
3379
3245
  const namespace = shared.isTrue(svg) ? shared.SVG_NAMESPACE : undefined;
3380
3246
  const elm = createElement(sel, namespace);
3381
- linkNodeToShadow(elm, owner);
3382
- fallbackElmHook(elm, vnode);
3247
+ linkNodeToShadow(elm, owner, renderer);
3248
+ fallbackElmHook(elm, vnode, renderer);
3383
3249
  vnode.elm = elm;
3384
- patchElementPropsAndAttrs$1(null, vnode);
3385
- insertNode(elm, parent, anchor);
3386
- mountVNodes(vnode.children, elm, null);
3250
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3251
+ insertNode(elm, parent, anchor, renderer);
3252
+ mountVNodes(vnode.children, elm, renderer, null);
3387
3253
  }
3388
- function patchElement(n1, n2) {
3254
+ function patchElement(n1, n2, renderer) {
3389
3255
  const elm = (n2.elm = n1.elm);
3390
- patchElementPropsAndAttrs$1(n1, n2);
3391
- patchChildren(n1.children, n2.children, elm);
3256
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3257
+ patchChildren(n1.children, n2.children, elm, renderer);
3392
3258
  }
3393
- function mountCustomElement(vnode, parent, anchor) {
3259
+ function mountCustomElement(vnode, parent, anchor, renderer) {
3394
3260
  const { sel, owner } = vnode;
3395
- const UpgradableConstructor = getUpgradableConstructor(sel);
3261
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
3396
3262
  /**
3397
3263
  * Note: if the upgradable constructor does not expect, or throw when we new it
3398
3264
  * with a callback as the first argument, we could implement a more advanced
@@ -3402,9 +3268,9 @@ function mountCustomElement(vnode, parent, anchor) {
3402
3268
  let vm;
3403
3269
  const elm = new UpgradableConstructor((elm) => {
3404
3270
  // the custom element from the registry is expecting an upgrade callback
3405
- vm = createViewModelHook(elm, vnode);
3271
+ vm = createViewModelHook(elm, vnode, renderer);
3406
3272
  });
3407
- linkNodeToShadow(elm, owner);
3273
+ linkNodeToShadow(elm, owner, renderer);
3408
3274
  vnode.elm = elm;
3409
3275
  vnode.vm = vm;
3410
3276
  if (vm) {
@@ -3413,23 +3279,23 @@ function mountCustomElement(vnode, parent, anchor) {
3413
3279
  else if (vnode.ctor !== UpgradableConstructor) {
3414
3280
  throw new TypeError(`Incorrect Component Constructor`);
3415
3281
  }
3416
- patchElementPropsAndAttrs$1(null, vnode);
3417
- insertNode(elm, parent, anchor);
3282
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
3283
+ insertNode(elm, parent, anchor, renderer);
3418
3284
  if (vm) {
3419
3285
  if (process.env.NODE_ENV !== 'production') {
3420
3286
  shared.assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
3421
3287
  }
3422
3288
  runConnectedCallback(vm);
3423
3289
  }
3424
- mountVNodes(vnode.children, elm, null);
3290
+ mountVNodes(vnode.children, elm, renderer, null);
3425
3291
  if (vm) {
3426
3292
  appendVM(vm);
3427
3293
  }
3428
3294
  }
3429
- function patchCustomElement(n1, n2) {
3295
+ function patchCustomElement(n1, n2, renderer) {
3430
3296
  const elm = (n2.elm = n1.elm);
3431
3297
  const vm = (n2.vm = n1.vm);
3432
- patchElementPropsAndAttrs$1(n1, n2);
3298
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3433
3299
  if (!shared.isUndefined(vm)) {
3434
3300
  // in fallback mode, the allocation will always set children to
3435
3301
  // empty and delegate the real allocation to the slot elements
@@ -3437,33 +3303,38 @@ function patchCustomElement(n1, n2) {
3437
3303
  }
3438
3304
  // in fallback mode, the children will be always empty, so, nothing
3439
3305
  // will happen, but in native, it does allocate the light dom
3440
- patchChildren(n1.children, n2.children, elm);
3306
+ patchChildren(n1.children, n2.children, elm, renderer);
3441
3307
  if (!shared.isUndefined(vm)) {
3442
3308
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
3443
3309
  // this is important to preserve the top to bottom synchronous rendering phase.
3444
3310
  rerenderVM(vm);
3445
3311
  }
3446
3312
  }
3447
- function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
3313
+ function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
3448
3314
  for (; start < end; ++start) {
3449
3315
  const vnode = vnodes[start];
3450
3316
  if (isVNode(vnode)) {
3451
- mount(vnode, parent, anchor);
3317
+ mount(vnode, parent, renderer, anchor);
3452
3318
  }
3453
3319
  }
3454
3320
  }
3455
- function unmount(vnode, parent, doRemove = false) {
3321
+ function unmount(vnode, parent, renderer, doRemove = false) {
3456
3322
  const { type, elm, sel } = vnode;
3457
3323
  // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3458
3324
  // subtree root, is the only element worth unmounting from the subtree.
3459
3325
  if (doRemove) {
3460
- removeNode(elm, parent);
3326
+ // The vnode might or might not have a data.renderer associated to it
3327
+ // but the removal used here is from the owner instead.
3328
+ removeNode(elm, parent, renderer);
3461
3329
  }
3462
- const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
3463
3330
  switch (type) {
3464
- case 2 /* Element */:
3465
- unmountVNodes(vnode.children, elm, removeChildren);
3331
+ case 2 /* Element */: {
3332
+ // Slot content is removed to trigger slotchange event when removing slot.
3333
+ // Only required for synthetic shadow.
3334
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
3335
+ unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
3466
3336
  break;
3337
+ }
3467
3338
  case 3 /* CustomElement */: {
3468
3339
  const { vm } = vnode;
3469
3340
  // No need to unmount the children here, `removeVM` will take care of removing the
@@ -3474,11 +3345,11 @@ function unmount(vnode, parent, doRemove = false) {
3474
3345
  }
3475
3346
  }
3476
3347
  }
3477
- function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
3348
+ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
3478
3349
  for (; start < end; ++start) {
3479
3350
  const ch = vnodes[start];
3480
3351
  if (isVNode(ch)) {
3481
- unmount(ch, parent, doRemove);
3352
+ unmount(ch, parent, renderer, doRemove);
3482
3353
  }
3483
3354
  }
3484
3355
  }
@@ -3492,15 +3363,19 @@ function setElementShadowToken(elm, token) {
3492
3363
  elm.$shadowToken$ = token;
3493
3364
  }
3494
3365
  // Set the scope token class for *.scoped.css styles
3495
- function setScopeTokenClassIfNecessary(elm, owner) {
3366
+ function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3496
3367
  const { cmpTemplate, context } = owner;
3368
+ const { getClassList } = renderer;
3497
3369
  const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3498
3370
  if (!shared.isUndefined(token) && context.hasScopedStyles) {
3371
+ // TODO [#2762]: this dot notation with add is probably problematic
3372
+ // probably we should have a renderer api for just the add operation
3499
3373
  getClassList(elm).add(token);
3500
3374
  }
3501
3375
  }
3502
- function linkNodeToShadow(elm, owner) {
3376
+ function linkNodeToShadow(elm, owner, renderer) {
3503
3377
  const { renderRoot, renderMode, shadowMode } = owner;
3378
+ const { isSyntheticShadowDefined } = renderer;
3504
3379
  // TODO [#1164]: this should eventually be done by the polyfill directly
3505
3380
  if (isSyntheticShadowDefined) {
3506
3381
  if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
@@ -3508,8 +3383,9 @@ function linkNodeToShadow(elm, owner) {
3508
3383
  }
3509
3384
  }
3510
3385
  }
3511
- function updateTextContent(vnode) {
3386
+ function updateTextContent(vnode, renderer) {
3512
3387
  const { elm, text } = vnode;
3388
+ const { setText } = renderer;
3513
3389
  if (process.env.NODE_ENV !== 'production') {
3514
3390
  unlockDomMutation();
3515
3391
  }
@@ -3518,40 +3394,40 @@ function updateTextContent(vnode) {
3518
3394
  lockDomMutation();
3519
3395
  }
3520
3396
  }
3521
- function insertNode(node, parent, anchor) {
3397
+ function insertNode(node, parent, anchor, renderer) {
3522
3398
  if (process.env.NODE_ENV !== 'production') {
3523
3399
  unlockDomMutation();
3524
3400
  }
3525
- insert(node, parent, anchor);
3401
+ renderer.insert(node, parent, anchor);
3526
3402
  if (process.env.NODE_ENV !== 'production') {
3527
3403
  lockDomMutation();
3528
3404
  }
3529
3405
  }
3530
- function removeNode(node, parent) {
3406
+ function removeNode(node, parent, renderer) {
3531
3407
  if (process.env.NODE_ENV !== 'production') {
3532
3408
  unlockDomMutation();
3533
3409
  }
3534
- remove(node, parent);
3410
+ renderer.remove(node, parent);
3535
3411
  if (process.env.NODE_ENV !== 'production') {
3536
3412
  lockDomMutation();
3537
3413
  }
3538
3414
  }
3539
- function patchElementPropsAndAttrs$1(oldVnode, vnode) {
3415
+ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3540
3416
  if (shared.isNull(oldVnode)) {
3541
- applyEventListeners(vnode);
3542
- applyStaticClassAttribute(vnode);
3543
- applyStaticStyleAttribute(vnode);
3417
+ applyEventListeners(vnode, renderer);
3418
+ applyStaticClassAttribute(vnode, renderer);
3419
+ applyStaticStyleAttribute(vnode, renderer);
3544
3420
  }
3545
3421
  // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
3546
3422
  // value is set before type=radio.
3547
- patchClassAttribute(oldVnode, vnode);
3548
- patchStyleAttribute(oldVnode, vnode);
3549
- patchAttributes(oldVnode, vnode);
3550
- patchProps(oldVnode, vnode);
3423
+ patchClassAttribute(oldVnode, vnode, renderer);
3424
+ patchStyleAttribute(oldVnode, vnode, renderer);
3425
+ patchAttributes(oldVnode, vnode, renderer);
3426
+ patchProps(oldVnode, vnode, renderer);
3551
3427
  }
3552
- function fallbackElmHook(elm, vnode) {
3428
+ function fallbackElmHook(elm, vnode, renderer) {
3553
3429
  const { owner } = vnode;
3554
- setScopeTokenClassIfNecessary(elm, owner);
3430
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
3555
3431
  if (owner.shadowMode === 1 /* Synthetic */) {
3556
3432
  const { data: { context }, } = vnode;
3557
3433
  const { stylesheetToken } = owner.context;
@@ -3599,7 +3475,7 @@ function allocateChildren(vnode, vm) {
3599
3475
  vnode.children = EmptyArray;
3600
3476
  }
3601
3477
  }
3602
- function createViewModelHook(elm, vnode) {
3478
+ function createViewModelHook(elm, vnode, renderer) {
3603
3479
  let vm = getAssociatedVMIfPresent(elm);
3604
3480
  // There is a possibility that a custom element is registered under tagName, in which case, the
3605
3481
  // initialization is already carry on, and there is nothing else to do here since this hook is
@@ -3608,7 +3484,7 @@ function createViewModelHook(elm, vnode) {
3608
3484
  return vm;
3609
3485
  }
3610
3486
  const { sel, mode, ctor, owner } = vnode;
3611
- setScopeTokenClassIfNecessary(elm, owner);
3487
+ setScopeTokenClassIfNecessary(elm, owner, renderer);
3612
3488
  if (owner.shadowMode === 1 /* Synthetic */) {
3613
3489
  const { stylesheetToken } = owner.context;
3614
3490
  // when running in synthetic shadow mode, we need to set the shadowToken value
@@ -3617,7 +3493,7 @@ function createViewModelHook(elm, vnode) {
3617
3493
  setElementShadowToken(elm, stylesheetToken);
3618
3494
  }
3619
3495
  }
3620
- vm = createVM(elm, ctor, {
3496
+ vm = createVM(elm, ctor, renderer, {
3621
3497
  mode,
3622
3498
  owner,
3623
3499
  tagName: sel,
@@ -3692,7 +3568,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
3692
3568
  }
3693
3569
  return map;
3694
3570
  }
3695
- function updateDynamicChildren(oldCh, newCh, parent) {
3571
+ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3696
3572
  let oldStartIdx = 0;
3697
3573
  let newStartIdx = 0;
3698
3574
  let oldEndIdx = oldCh.length - 1;
@@ -3721,26 +3597,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
3721
3597
  newEndVnode = newCh[--newEndIdx];
3722
3598
  }
3723
3599
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
3724
- patch(oldStartVnode, newStartVnode);
3600
+ patch(oldStartVnode, newStartVnode, renderer);
3725
3601
  oldStartVnode = oldCh[++oldStartIdx];
3726
3602
  newStartVnode = newCh[++newStartIdx];
3727
3603
  }
3728
3604
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
3729
- patch(oldEndVnode, newEndVnode);
3605
+ patch(oldEndVnode, newEndVnode, renderer);
3730
3606
  oldEndVnode = oldCh[--oldEndIdx];
3731
3607
  newEndVnode = newCh[--newEndIdx];
3732
3608
  }
3733
3609
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
3734
3610
  // Vnode moved right
3735
- patch(oldStartVnode, newEndVnode);
3736
- insertNode(oldStartVnode.elm, parent, nextSibling(oldEndVnode.elm));
3611
+ patch(oldStartVnode, newEndVnode, renderer);
3612
+ insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
3737
3613
  oldStartVnode = oldCh[++oldStartIdx];
3738
3614
  newEndVnode = newCh[--newEndIdx];
3739
3615
  }
3740
3616
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
3741
3617
  // Vnode moved left
3742
- patch(oldEndVnode, newStartVnode);
3743
- insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
3618
+ patch(oldEndVnode, newStartVnode, renderer);
3619
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
3744
3620
  oldEndVnode = oldCh[--oldEndIdx];
3745
3621
  newStartVnode = newCh[++newStartIdx];
3746
3622
  }
@@ -3751,7 +3627,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
3751
3627
  idxInOld = oldKeyToIdx[newStartVnode.key];
3752
3628
  if (shared.isUndefined(idxInOld)) {
3753
3629
  // New element
3754
- mount(newStartVnode, parent, oldStartVnode.elm);
3630
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3755
3631
  newStartVnode = newCh[++newStartIdx];
3756
3632
  }
3757
3633
  else {
@@ -3759,10 +3635,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
3759
3635
  if (isVNode(elmToMove)) {
3760
3636
  if (elmToMove.sel !== newStartVnode.sel) {
3761
3637
  // New element
3762
- mount(newStartVnode, parent, oldStartVnode.elm);
3638
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3763
3639
  }
3764
3640
  else {
3765
- patch(elmToMove, newStartVnode);
3641
+ patch(elmToMove, newStartVnode, renderer);
3766
3642
  // Delete the old child, but copy the array since it is read-only.
3767
3643
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3768
3644
  // so we only care about the `oldCh` object inside this function.
@@ -3774,7 +3650,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
3774
3650
  }
3775
3651
  // We've already cloned at least once, so it's no longer read-only
3776
3652
  oldCh[idxInOld] = undefined;
3777
- insertNode(elmToMove.elm, parent, oldStartVnode.elm);
3653
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
3778
3654
  }
3779
3655
  }
3780
3656
  newStartVnode = newCh[++newStartIdx];
@@ -3791,25 +3667,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
3791
3667
  n = newCh[++i];
3792
3668
  } while (!isVNode(n) && i < newChEnd);
3793
3669
  before = isVNode(n) ? n.elm : null;
3794
- mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
3670
+ mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
3795
3671
  }
3796
3672
  else {
3797
- unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
3673
+ unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
3798
3674
  }
3799
3675
  }
3800
3676
  }
3801
- function updateStaticChildren(c1, c2, parent) {
3677
+ function updateStaticChildren(c1, c2, parent, renderer) {
3802
3678
  const c1Length = c1.length;
3803
3679
  const c2Length = c2.length;
3804
3680
  if (c1Length === 0) {
3805
3681
  // the old list is empty, we can directly insert anything new
3806
- mountVNodes(c2, parent, null);
3682
+ mountVNodes(c2, parent, renderer, null);
3807
3683
  return;
3808
3684
  }
3809
3685
  if (c2Length === 0) {
3810
3686
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
3811
3687
  // this is the case in which the dynamic children of an if-directive should be removed
3812
- unmountVNodes(c1, parent, true);
3688
+ unmountVNodes(c1, parent, renderer, true);
3813
3689
  return;
3814
3690
  }
3815
3691
  // if the old list is not empty, the new list MUST have the same
@@ -3822,16 +3698,16 @@ function updateStaticChildren(c1, c2, parent) {
3822
3698
  if (isVNode(n1)) {
3823
3699
  if (isVNode(n2)) {
3824
3700
  // both vnodes are equivalent, and we just need to patch them
3825
- patch(n1, n2);
3701
+ patch(n1, n2, renderer);
3826
3702
  anchor = n2.elm;
3827
3703
  }
3828
3704
  else {
3829
3705
  // removing the old vnode since the new one is null
3830
- unmount(n1, parent, true);
3706
+ unmount(n1, parent, renderer, true);
3831
3707
  }
3832
3708
  }
3833
3709
  else if (isVNode(n2)) {
3834
- mount(n2, parent, anchor);
3710
+ mount(n2, parent, renderer, anchor);
3835
3711
  anchor = n2.elm;
3836
3712
  }
3837
3713
  }
@@ -4260,7 +4136,7 @@ function createInlineStyleVNode(content) {
4260
4136
  }, [api.t(content)]);
4261
4137
  }
4262
4138
  function updateStylesheetToken(vm, template) {
4263
- const { elm, context, renderMode, shadowMode } = vm;
4139
+ const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
4264
4140
  const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
4265
4141
  const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
4266
4142
  const { hasScopedStyles } = context;
@@ -4377,7 +4253,7 @@ function getNearestNativeShadowComponent(vm) {
4377
4253
  return owner;
4378
4254
  }
4379
4255
  function createStylesheet(vm, stylesheets) {
4380
- const { renderMode, shadowMode } = vm;
4256
+ const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
4381
4257
  if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
4382
4258
  for (let i = 0; i < stylesheets.length; i++) {
4383
4259
  insertStylesheet(stylesheets[i]);
@@ -4939,9 +4815,20 @@ function removeVM(vm) {
4939
4815
 
4940
4816
  resetComponentStateWhenRemoved(vm);
4941
4817
  }
4942
- function createVM(elm, ctor, options) {
4943
- var _a;
4944
4818
 
4819
+ function getNearestShadowAncestor(vm) {
4820
+ let ancestor = vm.owner;
4821
+
4822
+ while (!shared.isNull(ancestor) && ancestor.renderMode === 0
4823
+ /* Light */
4824
+ ) {
4825
+ ancestor = ancestor.owner;
4826
+ }
4827
+
4828
+ return ancestor;
4829
+ }
4830
+
4831
+ function createVM(elm, ctor, renderer, options) {
4945
4832
  const {
4946
4833
  mode,
4947
4834
  owner,
@@ -4971,8 +4858,6 @@ function createVM(elm, ctor, options) {
4971
4858
  cmpTemplate: null,
4972
4859
  hydrated: Boolean(hydrated),
4973
4860
  renderMode: def.renderMode,
4974
- shadowMode: computeShadowMode(def, owner),
4975
- nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
4976
4861
  context: {
4977
4862
  stylesheetToken: undefined,
4978
4863
  hasTokenInClass: undefined,
@@ -4985,14 +4870,17 @@ function createVM(elm, ctor, options) {
4985
4870
  },
4986
4871
  // Properties set right after VM creation.
4987
4872
  tro: null,
4873
+ shadowMode: null,
4988
4874
  // Properties set by the LightningElement constructor.
4989
4875
  component: null,
4990
4876
  shadowRoot: null,
4991
4877
  renderRoot: null,
4992
4878
  callHook,
4993
4879
  setHook,
4994
- getHook
4880
+ getHook,
4881
+ renderer
4995
4882
  };
4883
+ vm.shadowMode = computeShadowMode(vm, renderer);
4996
4884
  vm.tro = getTemplateReactiveObserver(vm);
4997
4885
 
4998
4886
  if (process.env.NODE_ENV !== 'production') {
@@ -5017,9 +4905,14 @@ function createVM(elm, ctor, options) {
5017
4905
  return vm;
5018
4906
  }
5019
4907
 
5020
- function computeShadowMode(def, owner) {
5021
- var _a;
5022
-
4908
+ function computeShadowMode(vm, renderer) {
4909
+ const {
4910
+ def
4911
+ } = vm;
4912
+ const {
4913
+ isSyntheticShadowDefined,
4914
+ isNativeShadowDefined
4915
+ } = renderer;
5023
4916
  let shadowMode;
5024
4917
 
5025
4918
  if (isSyntheticShadowDefined) {
@@ -5042,13 +4935,23 @@ function computeShadowMode(def, owner) {
5042
4935
  /* Native */
5043
4936
  ;
5044
4937
  } else {
5045
- // Transitive support for native Shadow DOM. A component in native mode
5046
- // transitively opts all of its descendants into native.
5047
- // Synthetic if neither this component nor any of its ancestors are configured
5048
- // to be native.
5049
- shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
5050
- /* Synthetic */
5051
- ;
4938
+ const shadowAncestor = getNearestShadowAncestor(vm);
4939
+
4940
+ if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4941
+ /* Native */
4942
+ ) {
4943
+ // Transitive support for native Shadow DOM. A component in native mode
4944
+ // transitively opts all of its descendants into native.
4945
+ shadowMode = 0
4946
+ /* Native */
4947
+ ;
4948
+ } else {
4949
+ // Synthetic if neither this component nor any of its ancestors are configured
4950
+ // to be native.
4951
+ shadowMode = 1
4952
+ /* Synthetic */
4953
+ ;
4954
+ }
5052
4955
  }
5053
4956
  } else {
5054
4957
  shadowMode = 1
@@ -5111,7 +5014,8 @@ function rehydrate(vm) {
5111
5014
  function patchShadowRoot(vm, newCh) {
5112
5015
  const {
5113
5016
  renderRoot,
5114
- children: oldCh
5017
+ children: oldCh,
5018
+ renderer
5115
5019
  } = vm; // caching the new children collection
5116
5020
 
5117
5021
  vm.children = newCh;
@@ -5127,7 +5031,7 @@ function patchShadowRoot(vm, newCh) {
5127
5031
  , vm);
5128
5032
  }, () => {
5129
5033
  // job
5130
- patchChildren(oldCh, newCh, renderRoot);
5034
+ patchChildren(oldCh, newCh, renderRoot, renderer);
5131
5035
  }, () => {
5132
5036
  // post
5133
5037
  logOperationEnd(2
@@ -5152,6 +5056,9 @@ function runRenderedCallback(vm) {
5152
5056
  const {
5153
5057
  def: {
5154
5058
  renderedCallback
5059
+ },
5060
+ renderer: {
5061
+ ssr
5155
5062
  }
5156
5063
  } = vm;
5157
5064
 
@@ -5389,7 +5296,10 @@ function recursivelyDisconnectChildren(vnodes) {
5389
5296
  function resetComponentRoot(vm) {
5390
5297
  const {
5391
5298
  children,
5392
- renderRoot
5299
+ renderRoot,
5300
+ renderer: {
5301
+ remove
5302
+ }
5393
5303
  } = vm;
5394
5304
 
5395
5305
  for (let i = 0, len = children.length; i < len; i++) {
@@ -5405,6 +5315,12 @@ function resetComponentRoot(vm) {
5405
5315
  vm.velements = EmptyArray;
5406
5316
  }
5407
5317
  function scheduleRehydration(vm) {
5318
+ const {
5319
+ renderer: {
5320
+ ssr
5321
+ }
5322
+ } = vm;
5323
+
5408
5324
  if (shared.isTrue(ssr) || shared.isTrue(vm.isScheduled)) {
5409
5325
  return;
5410
5326
  }
@@ -5581,6 +5497,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
5581
5497
  context: {
5582
5498
  wiredConnecting,
5583
5499
  wiredDisconnecting
5500
+ },
5501
+ renderer: {
5502
+ dispatchEvent
5584
5503
  }
5585
5504
  } = vm; // waiting for the component to be connected to formally request the context via the token
5586
5505
 
@@ -5852,70 +5771,79 @@ function hydrateRoot(vm) {
5852
5771
  function hydrateVM(vm) {
5853
5772
  const children = renderComponent(vm);
5854
5773
  vm.children = children;
5855
- const parentNode = vm.renderRoot;
5774
+ const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
5856
5775
  hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
5857
5776
  runRenderedCallback(vm);
5858
5777
  }
5859
- function hydrateNode(node, vnode) {
5778
+ function hydrateNode(node, vnode, renderer) {
5779
+ var _a, _b;
5860
5780
  let hydratedNode;
5861
5781
  switch (vnode.type) {
5862
5782
  case 0 /* Text */:
5863
- hydratedNode = hydrateText(node, vnode);
5783
+ // VText has no special capability, fallback to the owner's renderer
5784
+ hydratedNode = hydrateText(node, vnode, renderer);
5864
5785
  break;
5865
5786
  case 1 /* Comment */:
5866
- hydratedNode = hydrateComment(node, vnode);
5787
+ // VComment has no special capability, fallback to the owner's renderer
5788
+ hydratedNode = hydrateComment(node, vnode, renderer);
5867
5789
  break;
5868
5790
  case 2 /* Element */:
5869
- hydratedNode = hydrateElement(node, vnode);
5791
+ hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
5870
5792
  break;
5871
5793
  case 3 /* CustomElement */:
5872
- hydratedNode = hydrateCustomElement(node, vnode);
5794
+ hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
5873
5795
  break;
5874
5796
  }
5875
- return nextSibling(hydratedNode);
5797
+ return renderer.nextSibling(hydratedNode);
5876
5798
  }
5877
- function hydrateText(node, vnode) {
5799
+ function hydrateText(node, vnode, renderer) {
5878
5800
  var _a;
5879
- if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
5880
- return handleMismatch(node, vnode);
5801
+ if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
5802
+ return handleMismatch(node, vnode, renderer);
5881
5803
  }
5882
5804
  if (process.env.NODE_ENV !== 'production') {
5805
+ const { getProperty } = renderer;
5883
5806
  const nodeValue = getProperty(node, 'nodeValue');
5884
5807
  if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
5885
5808
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
5886
5809
  }
5887
5810
  }
5811
+ const { setText } = renderer;
5888
5812
  setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5889
5813
  vnode.elm = node;
5890
5814
  return node;
5891
5815
  }
5892
- function hydrateComment(node, vnode) {
5816
+ function hydrateComment(node, vnode, renderer) {
5893
5817
  var _a;
5894
- if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
5895
- return handleMismatch(node, vnode);
5818
+ if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
5819
+ return handleMismatch(node, vnode, renderer);
5896
5820
  }
5897
5821
  if (process.env.NODE_ENV !== 'production') {
5822
+ const { getProperty } = renderer;
5898
5823
  const nodeValue = getProperty(node, 'nodeValue');
5899
5824
  if (nodeValue !== vnode.text) {
5900
5825
  logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
5901
5826
  }
5902
5827
  }
5828
+ const { setProperty } = renderer;
5903
5829
  setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5904
5830
  vnode.elm = node;
5905
5831
  return node;
5906
5832
  }
5907
- function hydrateElement(elm, vnode) {
5908
- if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
5909
- !isMatchingElement(vnode, elm)) {
5910
- return handleMismatch(elm, vnode);
5833
+ function hydrateElement(elm, vnode, renderer) {
5834
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
5835
+ !isMatchingElement(vnode, elm, renderer)) {
5836
+ return handleMismatch(elm, vnode, renderer);
5911
5837
  }
5912
5838
  vnode.elm = elm;
5839
+ const { owner } = vnode;
5913
5840
  const { context } = vnode.data;
5914
5841
  const isDomManual = Boolean(!shared.isUndefined(context) && !shared.isUndefined(context.lwc) && context.lwc.dom === "manual" /* Manual */);
5915
5842
  if (isDomManual) {
5916
5843
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5917
5844
  // remove the innerHTML from props so it reuses the existing dom elements.
5918
- const { props } = vnode.data;
5845
+ const { data: { props }, } = vnode;
5846
+ const { getProperty } = renderer;
5919
5847
  if (!shared.isUndefined(props) && !shared.isUndefined(props.innerHTML)) {
5920
5848
  if (getProperty(elm, 'innerHTML') === props.innerHTML) {
5921
5849
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
@@ -5923,24 +5851,25 @@ function hydrateElement(elm, vnode) {
5923
5851
  }
5924
5852
  else {
5925
5853
  if (process.env.NODE_ENV !== 'production') {
5926
- logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
5854
+ logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
5927
5855
  }
5928
5856
  }
5929
5857
  }
5930
5858
  }
5931
- patchElementPropsAndAttrs(vnode);
5859
+ patchElementPropsAndAttrs(vnode, renderer);
5932
5860
  if (!isDomManual) {
5933
- hydrateChildren(getFirstChild(elm), vnode.children, elm, vnode.owner);
5861
+ const { getFirstChild } = renderer;
5862
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
5934
5863
  }
5935
5864
  return elm;
5936
5865
  }
5937
- function hydrateCustomElement(elm, vnode) {
5938
- if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
5939
- !isMatchingElement(vnode, elm)) {
5940
- return handleMismatch(elm, vnode);
5866
+ function hydrateCustomElement(elm, vnode, renderer) {
5867
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
5868
+ !isMatchingElement(vnode, elm, renderer)) {
5869
+ return handleMismatch(elm, vnode, renderer);
5941
5870
  }
5942
5871
  const { sel, mode, ctor, owner } = vnode;
5943
- const vm = createVM(elm, ctor, {
5872
+ const vm = createVM(elm, ctor, renderer, {
5944
5873
  mode,
5945
5874
  owner,
5946
5875
  tagName: sel,
@@ -5949,13 +5878,14 @@ function hydrateCustomElement(elm, vnode) {
5949
5878
  vnode.elm = elm;
5950
5879
  vnode.vm = vm;
5951
5880
  allocateChildren(vnode, vm);
5952
- patchElementPropsAndAttrs(vnode);
5881
+ patchElementPropsAndAttrs(vnode, renderer);
5953
5882
  // Insert hook section:
5954
5883
  if (process.env.NODE_ENV !== 'production') {
5955
5884
  shared.assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
5956
5885
  }
5957
5886
  runConnectedCallback(vm);
5958
5887
  if (vm.renderMode !== 0 /* Light */) {
5888
+ const { getFirstChild } = renderer;
5959
5889
  // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5960
5890
  // Note: for Light DOM, this is handled while hydrating the VM
5961
5891
  hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
@@ -5967,11 +5897,12 @@ function hydrateChildren(node, children, parentNode, owner) {
5967
5897
  let hasWarned = false;
5968
5898
  let nextNode = node;
5969
5899
  let anchor = null;
5900
+ const { renderer } = owner;
5970
5901
  for (let i = 0; i < children.length; i++) {
5971
5902
  const childVnode = children[i];
5972
5903
  if (!shared.isNull(childVnode)) {
5973
5904
  if (nextNode) {
5974
- nextNode = hydrateNode(nextNode, childVnode);
5905
+ nextNode = hydrateNode(nextNode, childVnode, renderer);
5975
5906
  anchor = childVnode.elm;
5976
5907
  }
5977
5908
  else {
@@ -5982,7 +5913,7 @@ function hydrateChildren(node, children, parentNode, owner) {
5982
5913
  logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
5983
5914
  }
5984
5915
  }
5985
- mount(childVnode, parentNode, anchor);
5916
+ mount(childVnode, parentNode, renderer, anchor);
5986
5917
  anchor = childVnode.elm;
5987
5918
  }
5988
5919
  }
@@ -5994,30 +5925,32 @@ function hydrateChildren(node, children, parentNode, owner) {
5994
5925
  logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
5995
5926
  }
5996
5927
  }
5928
+ // nextSibling is mostly harmless, and since we don't have
5929
+ // a good reference to what element to act upon, we instead
5930
+ // rely on the vm's associated renderer for navigating to the
5931
+ // next node in the list to be hydrated.
5932
+ const { nextSibling } = renderer;
5997
5933
  do {
5998
5934
  const current = nextNode;
5999
5935
  nextNode = nextSibling(nextNode);
6000
- removeNode(current, parentNode);
5936
+ removeNode(current, parentNode, renderer);
6001
5937
  } while (nextNode);
6002
5938
  }
6003
5939
  }
6004
- function handleMismatch(node, vnode, msg) {
5940
+ function handleMismatch(node, vnode, renderer) {
6005
5941
  hasMismatch = true;
6006
- if (!shared.isUndefined(msg)) {
6007
- if (process.env.NODE_ENV !== 'production') {
6008
- logError(msg, vnode.owner);
6009
- }
6010
- }
5942
+ const { getProperty } = renderer;
6011
5943
  const parentNode = getProperty(node, 'parentNode');
6012
- mount(vnode, parentNode, node);
6013
- removeNode(node, parentNode);
5944
+ mount(vnode, parentNode, renderer, node);
5945
+ removeNode(node, parentNode, renderer);
6014
5946
  return vnode.elm;
6015
5947
  }
6016
- function patchElementPropsAndAttrs(vnode) {
6017
- applyEventListeners(vnode);
6018
- patchProps(null, vnode);
5948
+ function patchElementPropsAndAttrs(vnode, renderer) {
5949
+ applyEventListeners(vnode, renderer);
5950
+ patchProps(null, vnode, renderer);
6019
5951
  }
6020
- function hasCorrectNodeType(vnode, node, nodeType) {
5952
+ function hasCorrectNodeType(vnode, node, nodeType, renderer) {
5953
+ const { getProperty } = renderer;
6021
5954
  if (getProperty(node, 'nodeType') !== nodeType) {
6022
5955
  if (process.env.NODE_ENV !== 'production') {
6023
5956
  logError('Hydration mismatch: incorrect node type received', vnode.owner);
@@ -6026,36 +5959,41 @@ function hasCorrectNodeType(vnode, node, nodeType) {
6026
5959
  }
6027
5960
  return true;
6028
5961
  }
6029
- function isMatchingElement(vnode, elm) {
5962
+ function isMatchingElement(vnode, elm, renderer) {
5963
+ const { getProperty } = renderer;
6030
5964
  if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
6031
5965
  if (process.env.NODE_ENV !== 'production') {
6032
5966
  logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
6033
5967
  }
6034
5968
  return false;
6035
5969
  }
6036
- const hasIncompatibleAttrs = validateAttrs(vnode, elm);
6037
- const hasIncompatibleClass = validateClassAttr(vnode, elm);
6038
- const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
5970
+ const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
5971
+ const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
5972
+ const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
6039
5973
  return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
6040
5974
  }
6041
- function validateAttrs(vnode, elm) {
5975
+ function validateAttrs(vnode, elm, renderer) {
6042
5976
  const { data: { attrs = {} }, } = vnode;
6043
5977
  let nodesAreCompatible = true;
6044
5978
  // Validate attributes, though we could always recovery from those by running the update mods.
6045
5979
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6046
5980
  for (const [attrName, attrValue] of Object.entries(attrs)) {
5981
+ const { owner } = vnode;
5982
+ const { getAttribute } = renderer;
6047
5983
  const elmAttrValue = getAttribute(elm, attrName);
6048
5984
  if (String(attrValue) !== elmAttrValue) {
6049
5985
  if (process.env.NODE_ENV !== 'production') {
6050
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
5986
+ const { getProperty } = renderer;
5987
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
6051
5988
  }
6052
5989
  nodesAreCompatible = false;
6053
5990
  }
6054
5991
  }
6055
5992
  return nodesAreCompatible;
6056
5993
  }
6057
- function validateClassAttr(vnode, elm) {
5994
+ function validateClassAttr(vnode, elm, renderer) {
6058
5995
  const { data: { className, classMap }, } = vnode;
5996
+ const { getProperty, getClassList } = renderer;
6059
5997
  let nodesAreCompatible = true;
6060
5998
  let vnodeClassName;
6061
5999
  if (!shared.isUndefined(className) && String(className) !== getProperty(elm, 'className')) {
@@ -6086,8 +6024,9 @@ function validateClassAttr(vnode, elm) {
6086
6024
  }
6087
6025
  return nodesAreCompatible;
6088
6026
  }
6089
- function validateStyleAttr(vnode, elm) {
6027
+ function validateStyleAttr(vnode, elm, renderer) {
6090
6028
  const { data: { style, styleDecls }, } = vnode;
6029
+ const { getAttribute } = renderer;
6091
6030
  const elmStyle = getAttribute(elm, 'style') || '';
6092
6031
  let vnodeStyle;
6093
6032
  let nodesAreCompatible = true;
@@ -6120,6 +6059,7 @@ function validateStyleAttr(vnode, elm) {
6120
6059
  }
6121
6060
  if (!nodesAreCompatible) {
6122
6061
  if (process.env.NODE_ENV !== 'production') {
6062
+ const { getProperty } = renderer;
6123
6063
  logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
6124
6064
  }
6125
6065
  }
@@ -6290,50 +6230,11 @@ exports.registerComponent = registerComponent;
6290
6230
  exports.registerDecorators = registerDecorators;
6291
6231
  exports.registerTemplate = registerTemplate;
6292
6232
  exports.sanitizeAttribute = sanitizeAttribute;
6293
- exports.setAddEventListener = setAddEventListener;
6294
- exports.setAssertInstanceOfHTMLElement = setAssertInstanceOfHTMLElement;
6295
- exports.setAttachShadow = setAttachShadow;
6296
- exports.setCreateComment = setCreateComment;
6297
- exports.setCreateElement = setCreateElement;
6298
- exports.setCreateText = setCreateText;
6299
- exports.setDefineCustomElement = setDefineCustomElement;
6300
- exports.setDispatchEvent = setDispatchEvent;
6301
- exports.setGetAttribute = setGetAttribute;
6302
- exports.setGetBoundingClientRect = setGetBoundingClientRect;
6303
- exports.setGetChildNodes = setGetChildNodes;
6304
- exports.setGetChildren = setGetChildren;
6305
- exports.setGetClassList = setGetClassList;
6306
- exports.setGetCustomElement = setGetCustomElement;
6307
- exports.setGetElementsByClassName = setGetElementsByClassName;
6308
- exports.setGetElementsByTagName = setGetElementsByTagName;
6309
- exports.setGetFirstChild = setGetFirstChild;
6310
- exports.setGetFirstElementChild = setGetFirstElementChild;
6311
- exports.setGetLastChild = setGetLastChild;
6312
- exports.setGetLastElementChild = setGetLastElementChild;
6313
- exports.setGetProperty = setGetProperty;
6314
- exports.setHTMLElement = setHTMLElement;
6315
6233
  exports.setHooks = setHooks;
6316
- exports.setInsert = setInsert;
6317
- exports.setInsertStylesheet = setInsertStylesheet;
6318
- exports.setIsConnected = setIsConnected;
6319
- exports.setIsHydrating = setIsHydrating;
6320
- exports.setIsNativeShadowDefined = setIsNativeShadowDefined;
6321
- exports.setIsSyntheticShadowDefined = setIsSyntheticShadowDefined;
6322
- exports.setNextSibling = setNextSibling;
6323
- exports.setQuerySelector = setQuerySelector;
6324
- exports.setQuerySelectorAll = setQuerySelectorAll;
6325
- exports.setRemove = setRemove;
6326
- exports.setRemoveAttribute = setRemoveAttribute;
6327
- exports.setRemoveEventListener = setRemoveEventListener;
6328
- exports.setSetAttribute = setSetAttribute;
6329
- exports.setSetCSSStyleProperty = setSetCSSStyleProperty;
6330
- exports.setSetProperty = setSetProperty;
6331
- exports.setSetText = setSetText;
6332
- exports.setSsr = setSsr;
6333
6234
  exports.swapComponent = swapComponent;
6334
6235
  exports.swapStyle = swapStyle;
6335
6236
  exports.swapTemplate = swapTemplate;
6336
6237
  exports.track = track;
6337
6238
  exports.unwrap = unwrap;
6338
6239
  exports.wire = wire;
6339
- /* version: 2.13.4 */
6240
+ /* version: 2.14.2 */