@lwc/engine-core 2.6.2 → 2.6.3

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.
@@ -70,6 +70,170 @@ function parseStyleText(cssText) {
70
70
  return styleMap;
71
71
  }
72
72
 
73
+ //
74
+ // Primitives
75
+ //
76
+ let ssr;
77
+ function setSsr(ssrImpl) {
78
+ ssr = ssrImpl;
79
+ }
80
+ let isNativeShadowDefined;
81
+ function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
82
+ isNativeShadowDefined = isNativeShadowDefinedImpl;
83
+ }
84
+ let isSyntheticShadowDefined;
85
+ function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
86
+ isSyntheticShadowDefined = isSyntheticShadowDefinedImpl;
87
+ }
88
+ let HTMLElementExported;
89
+ function setHTMLElement(HTMLElementImpl) {
90
+ HTMLElementExported = HTMLElementImpl;
91
+ }
92
+ let isHydrating;
93
+ function setIsHydrating(isHydratingImpl) {
94
+ isHydrating = isHydratingImpl;
95
+ }
96
+ let insert;
97
+ function setInsert(insertImpl) {
98
+ insert = insertImpl;
99
+ }
100
+ let remove;
101
+ function setRemove(removeImpl) {
102
+ remove = removeImpl;
103
+ }
104
+ let createElement;
105
+ function setCreateElement(createElementImpl) {
106
+ createElement = createElementImpl;
107
+ }
108
+ let createText;
109
+ function setCreateText(createTextImpl) {
110
+ createText = createTextImpl;
111
+ }
112
+ let createComment;
113
+ function setCreateComment(createCommentImpl) {
114
+ createComment = createCommentImpl;
115
+ }
116
+ let nextSibling;
117
+ function setNextSibling(nextSiblingImpl) {
118
+ nextSibling = nextSiblingImpl;
119
+ }
120
+ let attachShadow;
121
+ function setAttachShadow(attachShadowImpl) {
122
+ attachShadow = attachShadowImpl;
123
+ }
124
+ let getProperty;
125
+ function setGetProperty(getPropertyImpl) {
126
+ getProperty = getPropertyImpl;
127
+ }
128
+ let setProperty;
129
+ function setSetProperty(setPropertyImpl) {
130
+ setProperty = setPropertyImpl;
131
+ }
132
+ let setText;
133
+ function setSetText(setTextImpl) {
134
+ setText = setTextImpl;
135
+ }
136
+ let getAttribute;
137
+ function setGetAttribute(getAttributeImpl) {
138
+ getAttribute = getAttributeImpl;
139
+ }
140
+ let setAttribute;
141
+ function setSetAttribute(setAttributeImpl) {
142
+ setAttribute = setAttributeImpl;
143
+ }
144
+ let removeAttribute;
145
+ function setRemoveAttribute(removeAttributeImpl) {
146
+ removeAttribute = removeAttributeImpl;
147
+ }
148
+ let addEventListener;
149
+ function setAddEventListener(addEventListenerImpl) {
150
+ addEventListener = addEventListenerImpl;
151
+ }
152
+ let removeEventListener;
153
+ function setRemoveEventListener(removeEventListenerImpl) {
154
+ removeEventListener = removeEventListenerImpl;
155
+ }
156
+ let dispatchEvent;
157
+ function setDispatchEvent(dispatchEventImpl) {
158
+ dispatchEvent = dispatchEventImpl;
159
+ }
160
+ let getClassList;
161
+ function setGetClassList(getClassListImpl) {
162
+ getClassList = getClassListImpl;
163
+ }
164
+ let setCSSStyleProperty;
165
+ function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
166
+ setCSSStyleProperty = setCSSStylePropertyImpl;
167
+ }
168
+ let getBoundingClientRect;
169
+ function setGetBoundingClientRect(getBoundingClientRectImpl) {
170
+ getBoundingClientRect = getBoundingClientRectImpl;
171
+ }
172
+ let querySelector;
173
+ function setQuerySelector(querySelectorImpl) {
174
+ querySelector = querySelectorImpl;
175
+ }
176
+ let querySelectorAll;
177
+ function setQuerySelectorAll(querySelectorAllImpl) {
178
+ querySelectorAll = querySelectorAllImpl;
179
+ }
180
+ let getElementsByTagName;
181
+ function setGetElementsByTagName(getElementsByTagNameImpl) {
182
+ getElementsByTagName = getElementsByTagNameImpl;
183
+ }
184
+ let getElementsByClassName;
185
+ function setGetElementsByClassName(getElementsByClassNameImpl) {
186
+ getElementsByClassName = getElementsByClassNameImpl;
187
+ }
188
+ let getChildren;
189
+ function setGetChildren(getChildrenImpl) {
190
+ getChildren = getChildrenImpl;
191
+ }
192
+ let getChildNodes;
193
+ function setGetChildNodes(getChildNodesImpl) {
194
+ getChildNodes = getChildNodesImpl;
195
+ }
196
+ let getFirstChild;
197
+ function setGetFirstChild(getFirstChildImpl) {
198
+ getFirstChild = getFirstChildImpl;
199
+ }
200
+ let getFirstElementChild;
201
+ function setGetFirstElementChild(getFirstElementChildImpl) {
202
+ getFirstElementChild = getFirstElementChildImpl;
203
+ }
204
+ let getLastChild;
205
+ function setGetLastChild(getLastChildImpl) {
206
+ getLastChild = getLastChildImpl;
207
+ }
208
+ let getLastElementChild;
209
+ function setGetLastElementChild(getLastElementChildImpl) {
210
+ getLastElementChild = getLastElementChildImpl;
211
+ }
212
+ let isConnected;
213
+ function setIsConnected(isConnectedImpl) {
214
+ isConnected = isConnectedImpl;
215
+ }
216
+ let insertGlobalStylesheet;
217
+ function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
218
+ insertGlobalStylesheet = insertGlobalStylesheetImpl;
219
+ }
220
+ let insertStylesheet;
221
+ function setInsertStylesheet(insertStylesheetImpl) {
222
+ insertStylesheet = insertStylesheetImpl;
223
+ }
224
+ let assertInstanceOfHTMLElement;
225
+ function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
226
+ assertInstanceOfHTMLElement = assertInstanceOfHTMLElementImpl;
227
+ }
228
+ let defineCustomElement;
229
+ function setDefineCustomElement(defineCustomElementImpl) {
230
+ defineCustomElement = defineCustomElementImpl;
231
+ }
232
+ let getCustomElement;
233
+ function setGetCustomElement(getCustomElementImpl) {
234
+ getCustomElement = getCustomElementImpl;
235
+ }
236
+
73
237
  /*
74
238
  * Copyright (c) 2019, salesforce.com, inc.
75
239
  * All rights reserved.
@@ -311,9 +475,6 @@ function createAllEventListeners(vnode) {
311
475
  elm,
312
476
  data: {
313
477
  on
314
- },
315
- owner: {
316
- renderer
317
478
  }
318
479
  } = vnode;
319
480
 
@@ -326,7 +487,7 @@ function createAllEventListeners(vnode) {
326
487
  let name;
327
488
 
328
489
  for (name in on) {
329
- renderer.addEventListener(elm, name, listener);
490
+ addEventListener(elm, name, listener);
330
491
  }
331
492
  }
332
493
 
@@ -465,9 +626,6 @@ function updateAttrs(oldVnode, vnode) {
465
626
  const {
466
627
  data: {
467
628
  attrs
468
- },
469
- owner: {
470
- renderer
471
629
  }
472
630
  } = vnode;
473
631
 
@@ -490,10 +648,6 @@ function updateAttrs(oldVnode, vnode) {
490
648
  }
491
649
 
492
650
  const elm = vnode.elm;
493
- const {
494
- setAttribute,
495
- removeAttribute
496
- } = renderer;
497
651
  let key;
498
652
  oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
499
653
  // this routine is only useful for data-* attributes in all kind of elements
@@ -512,7 +666,7 @@ function updateAttrs(oldVnode, vnode) {
512
666
  } else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
513
667
  // Assume xlink namespace
514
668
  setAttribute(elm, key, cur, xlinkNS);
515
- } else if (isNull(cur)) {
669
+ } else if (isNull(cur) || isUndefined$1(cur)) {
516
670
  removeAttribute(elm, key);
517
671
  } else {
518
672
  setAttribute(elm, key, cur);
@@ -564,17 +718,14 @@ function update(oldVnode, vnode) {
564
718
  const isFirstPatch = isUndefined$1(oldProps);
565
719
  const {
566
720
  elm,
567
- sel,
568
- owner: {
569
- renderer
570
- }
721
+ sel
571
722
  } = vnode;
572
723
 
573
724
  for (const key in props) {
574
725
  const cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
575
726
 
576
- if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? renderer.getProperty(elm, key) : oldProps[key])) {
577
- renderer.setProperty(elm, key, cur);
727
+ if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
728
+ setProperty(elm, key, cur);
578
729
  }
579
730
  }
580
731
  }
@@ -643,9 +794,6 @@ function updateClassAttribute(oldVnode, vnode) {
643
794
  elm,
644
795
  data: {
645
796
  className: newClass
646
- },
647
- owner: {
648
- renderer
649
797
  }
650
798
  } = vnode;
651
799
  const {
@@ -658,7 +806,7 @@ function updateClassAttribute(oldVnode, vnode) {
658
806
  return;
659
807
  }
660
808
 
661
- const classList = renderer.getClassList(elm);
809
+ const classList = getClassList(elm);
662
810
  const newClassMap = getMapFromClassName(newClass);
663
811
  const oldClassMap = getMapFromClassName(oldClass);
664
812
  let name;
@@ -697,15 +845,8 @@ function updateStyleAttribute(oldVnode, vnode) {
697
845
  elm,
698
846
  data: {
699
847
  style: newStyle
700
- },
701
- owner: {
702
- renderer
703
848
  }
704
849
  } = vnode;
705
- const {
706
- setAttribute,
707
- removeAttribute
708
- } = renderer;
709
850
 
710
851
  if (oldVnode.data.style === newStyle) {
711
852
  return;
@@ -740,9 +881,6 @@ function createClassAttribute(vnode) {
740
881
  elm,
741
882
  data: {
742
883
  classMap
743
- },
744
- owner: {
745
- renderer
746
884
  }
747
885
  } = vnode;
748
886
 
@@ -750,7 +888,7 @@ function createClassAttribute(vnode) {
750
888
  return;
751
889
  }
752
890
 
753
- const classList = renderer.getClassList(elm);
891
+ const classList = getClassList(elm);
754
892
 
755
893
  for (const name in classMap) {
756
894
  classList.add(name);
@@ -775,9 +913,6 @@ function createStyleAttribute(vnode) {
775
913
  elm,
776
914
  data: {
777
915
  styleDecls
778
- },
779
- owner: {
780
- renderer
781
916
  }
782
917
  } = vnode;
783
918
 
@@ -787,7 +922,7 @@ function createStyleAttribute(vnode) {
787
922
 
788
923
  for (let i = 0; i < styleDecls.length; i++) {
789
924
  const [prop, value, important] = styleDecls[i];
790
- renderer.setCSSStyleProperty(elm, prop, value, important);
925
+ setCSSStyleProperty(elm, prop, value, important);
791
926
  }
792
927
  }
793
928
 
@@ -802,14 +937,6 @@ var modStaticStyle = {
802
937
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
803
938
  */
804
939
 
805
- /**
806
- @license
807
- Copyright (c) 2015 Simon Friis Vindum.
808
- This code may only be used under the MIT License found at
809
- https://github.com/snabbdom/snabbdom/blob/master/LICENSE
810
- Code distributed by Snabbdom as part of the Snabbdom project at
811
- https://github.com/snabbdom/snabbdom/
812
- */
813
940
  function isUndef(s) {
814
941
  return s === undefined;
815
942
  }
@@ -897,7 +1024,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
897
1024
  } else if (sameVnode(oldStartVnode, newEndVnode)) {
898
1025
  // Vnode moved right
899
1026
  patchVnode(oldStartVnode, newEndVnode);
900
- newEndVnode.hook.move(oldStartVnode, parentElm, oldEndVnode.owner.renderer.nextSibling(oldEndVnode.elm));
1027
+ newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling(oldEndVnode.elm));
901
1028
  oldStartVnode = oldCh[++oldStartIdx];
902
1029
  newEndVnode = newCh[--newEndIdx];
903
1030
  } else if (sameVnode(oldEndVnode, newStartVnode)) {
@@ -1374,7 +1501,7 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
1374
1501
  }
1375
1502
 
1376
1503
  /*
1377
- * Copyright (c) 2020, salesforce.com, inc.
1504
+ * Copyright (c) 2018, salesforce.com, inc.
1378
1505
  * All rights reserved.
1379
1506
  * SPDX-License-Identifier: MIT
1380
1507
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -2289,9 +2416,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
2289
2416
 
2290
2417
 
2291
2418
  const LightningElement = function () {
2292
- var _a; // This should be as performant as possible, while any initialization should be done lazily
2293
-
2294
-
2419
+ // This should be as performant as possible, while any initialization should be done lazily
2295
2420
  if (isNull(vmBeingConstructed)) {
2296
2421
  throw new ReferenceError('Illegal constructor');
2297
2422
  }
@@ -2299,15 +2424,14 @@ const LightningElement = function () {
2299
2424
  const vm = vmBeingConstructed;
2300
2425
  const {
2301
2426
  def,
2302
- elm,
2303
- renderer
2427
+ elm
2304
2428
  } = vm;
2305
2429
  const {
2306
2430
  bridge
2307
2431
  } = def;
2308
2432
 
2309
2433
  if (process.env.NODE_ENV !== 'production') {
2310
- (_a = renderer.assertInstanceOfHTMLElement) === null || _a === void 0 ? void 0 : _a.call(renderer, vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
2434
+ assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
2311
2435
  }
2312
2436
 
2313
2437
  const component = this;
@@ -2337,7 +2461,7 @@ const LightningElement = function () {
2337
2461
  if (vm.renderMode === 1
2338
2462
  /* Shadow */
2339
2463
  ) {
2340
- attachShadow(vm);
2464
+ doAttachShadow(vm);
2341
2465
  } // Adding extra guard rails in DEV mode.
2342
2466
 
2343
2467
 
@@ -2349,17 +2473,16 @@ const LightningElement = function () {
2349
2473
  return this;
2350
2474
  };
2351
2475
 
2352
- function attachShadow(vm) {
2476
+ function doAttachShadow(vm) {
2353
2477
  const {
2354
2478
  elm,
2355
2479
  mode,
2356
- renderer,
2357
2480
  shadowMode,
2358
2481
  def: {
2359
2482
  ctor
2360
2483
  }
2361
2484
  } = vm;
2362
- const cmpRoot = renderer.attachShadow(elm, {
2485
+ const cmpRoot = attachShadow(elm, {
2363
2486
  [KEY__SYNTHETIC_MODE]: shadowMode === 1
2364
2487
  /* Synthetic */
2365
2488
  ,
@@ -2386,10 +2509,7 @@ LightningElement.prototype = {
2386
2509
 
2387
2510
  dispatchEvent(event) {
2388
2511
  const {
2389
- elm,
2390
- renderer: {
2391
- dispatchEvent
2392
- }
2512
+ elm
2393
2513
  } = getAssociatedVM(this);
2394
2514
  return dispatchEvent(elm, event);
2395
2515
  },
@@ -2397,10 +2517,7 @@ LightningElement.prototype = {
2397
2517
  addEventListener(type, listener, options) {
2398
2518
  const vm = getAssociatedVM(this);
2399
2519
  const {
2400
- elm,
2401
- renderer: {
2402
- addEventListener
2403
- }
2520
+ elm
2404
2521
  } = vm;
2405
2522
 
2406
2523
  if (process.env.NODE_ENV !== 'production') {
@@ -2417,10 +2534,7 @@ LightningElement.prototype = {
2417
2534
  removeEventListener(type, listener, options) {
2418
2535
  const vm = getAssociatedVM(this);
2419
2536
  const {
2420
- elm,
2421
- renderer: {
2422
- removeEventListener
2423
- }
2537
+ elm
2424
2538
  } = vm;
2425
2539
  const wrappedListener = getWrappedComponentsListener(vm, listener);
2426
2540
  removeEventListener(elm, type, wrappedListener, options);
@@ -2428,30 +2542,21 @@ LightningElement.prototype = {
2428
2542
 
2429
2543
  hasAttribute(name) {
2430
2544
  const {
2431
- elm,
2432
- renderer: {
2433
- getAttribute
2434
- }
2545
+ elm
2435
2546
  } = getAssociatedVM(this);
2436
2547
  return !isNull(getAttribute(elm, name));
2437
2548
  },
2438
2549
 
2439
2550
  hasAttributeNS(namespace, name) {
2440
2551
  const {
2441
- elm,
2442
- renderer: {
2443
- getAttribute
2444
- }
2552
+ elm
2445
2553
  } = getAssociatedVM(this);
2446
2554
  return !isNull(getAttribute(elm, name, namespace));
2447
2555
  },
2448
2556
 
2449
2557
  removeAttribute(name) {
2450
2558
  const {
2451
- elm,
2452
- renderer: {
2453
- removeAttribute
2454
- }
2559
+ elm
2455
2560
  } = getAssociatedVM(this);
2456
2561
  unlockAttribute(elm, name);
2457
2562
  removeAttribute(elm, name);
@@ -2460,10 +2565,7 @@ LightningElement.prototype = {
2460
2565
 
2461
2566
  removeAttributeNS(namespace, name) {
2462
2567
  const {
2463
- elm,
2464
- renderer: {
2465
- removeAttribute
2466
- }
2568
+ elm
2467
2569
  } = getAssociatedVM(this);
2468
2570
  unlockAttribute(elm, name);
2469
2571
  removeAttribute(elm, name, namespace);
@@ -2472,20 +2574,14 @@ LightningElement.prototype = {
2472
2574
 
2473
2575
  getAttribute(name) {
2474
2576
  const {
2475
- elm,
2476
- renderer: {
2477
- getAttribute
2478
- }
2577
+ elm
2479
2578
  } = getAssociatedVM(this);
2480
2579
  return getAttribute(elm, name);
2481
2580
  },
2482
2581
 
2483
2582
  getAttributeNS(namespace, name) {
2484
2583
  const {
2485
- elm,
2486
- renderer: {
2487
- getAttribute
2488
- }
2584
+ elm
2489
2585
  } = getAssociatedVM(this);
2490
2586
  return getAttribute(elm, name, namespace);
2491
2587
  },
@@ -2493,10 +2589,7 @@ LightningElement.prototype = {
2493
2589
  setAttribute(name, value) {
2494
2590
  const vm = getAssociatedVM(this);
2495
2591
  const {
2496
- elm,
2497
- renderer: {
2498
- setAttribute
2499
- }
2592
+ elm
2500
2593
  } = vm;
2501
2594
 
2502
2595
  if (process.env.NODE_ENV !== 'production') {
@@ -2511,10 +2604,7 @@ LightningElement.prototype = {
2511
2604
  setAttributeNS(namespace, name, value) {
2512
2605
  const vm = getAssociatedVM(this);
2513
2606
  const {
2514
- elm,
2515
- renderer: {
2516
- setAttribute
2517
- }
2607
+ elm
2518
2608
  } = vm;
2519
2609
 
2520
2610
  if (process.env.NODE_ENV !== 'production') {
@@ -2529,10 +2619,7 @@ LightningElement.prototype = {
2529
2619
  getBoundingClientRect() {
2530
2620
  const vm = getAssociatedVM(this);
2531
2621
  const {
2532
- elm,
2533
- renderer: {
2534
- getBoundingClientRect
2535
- }
2622
+ elm
2536
2623
  } = vm;
2537
2624
 
2538
2625
  if (process.env.NODE_ENV !== 'production') {
@@ -2544,10 +2631,7 @@ LightningElement.prototype = {
2544
2631
 
2545
2632
  get isConnected() {
2546
2633
  const {
2547
- elm,
2548
- renderer: {
2549
- isConnected
2550
- }
2634
+ elm
2551
2635
  } = getAssociatedVM(this);
2552
2636
  return isConnected(elm);
2553
2637
  },
@@ -2555,10 +2639,7 @@ LightningElement.prototype = {
2555
2639
  get classList() {
2556
2640
  const vm = getAssociatedVM(this);
2557
2641
  const {
2558
- elm,
2559
- renderer: {
2560
- getClassList
2561
- }
2642
+ elm
2562
2643
  } = vm;
2563
2644
 
2564
2645
  if (process.env.NODE_ENV !== 'production') {
@@ -2601,23 +2682,48 @@ LightningElement.prototype = {
2601
2682
  }
2602
2683
 
2603
2684
  };
2604
- const queryAndChildGetterDescriptors = create(null);
2605
- const childGetters = [['children', 'getChildren'], ['childNodes', 'getChildNodes'], ['firstChild', 'getFirstChild'], ['firstElementChild', 'getFirstElementChild'], ['lastChild', 'getLastChild'], ['lastElementChild', 'getLastElementChild']]; // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
2685
+ const queryAndChildGetterDescriptors = create(null); // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
2686
+ // is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
2687
+ // object representing the renderer, with a lot of methods we don't actually need.
2688
+
2689
+ const childGetters = ['children', 'childNodes', 'firstChild', 'firstElementChild', 'lastChild', 'lastElementChild'];
2690
+
2691
+ function getChildGetter(methodName) {
2692
+ switch (methodName) {
2693
+ case 'children':
2694
+ return getChildren;
2695
+
2696
+ case 'childNodes':
2697
+ return getChildNodes;
2698
+
2699
+ case 'firstChild':
2700
+ return getFirstChild;
2701
+
2702
+ case 'firstElementChild':
2703
+ return getFirstElementChild;
2606
2704
 
2607
- for (const [elementProp, rendererMethod] of childGetters) {
2608
- queryAndChildGetterDescriptors[elementProp] = {
2705
+ case 'lastChild':
2706
+ return getLastChild;
2707
+
2708
+ case 'lastElementChild':
2709
+ return getLastElementChild;
2710
+ }
2711
+ } // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
2712
+
2713
+
2714
+ for (const childGetter of childGetters) {
2715
+ queryAndChildGetterDescriptors[childGetter] = {
2609
2716
  get() {
2610
2717
  const vm = getAssociatedVM(this);
2611
2718
  const {
2612
- elm,
2613
- renderer
2719
+ elm
2614
2720
  } = vm;
2615
2721
 
2616
2722
  if (process.env.NODE_ENV !== 'production') {
2617
- warnIfInvokedDuringConstruction(vm, elementProp);
2723
+ warnIfInvokedDuringConstruction(vm, childGetter);
2618
2724
  }
2619
2725
 
2620
- return renderer[rendererMethod](elm);
2726
+ return getChildGetter(childGetter)(elm);
2621
2727
  },
2622
2728
 
2623
2729
  configurable: true,
@@ -2625,22 +2731,38 @@ for (const [elementProp, rendererMethod] of childGetters) {
2625
2731
  };
2626
2732
  }
2627
2733
 
2628
- const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll']; // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2734
+ const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
2735
+
2736
+ function getQueryMethod(methodName) {
2737
+ switch (methodName) {
2738
+ case 'getElementsByClassName':
2739
+ return getElementsByClassName;
2740
+
2741
+ case 'getElementsByTagName':
2742
+ return getElementsByTagName;
2743
+
2744
+ case 'querySelector':
2745
+ return querySelector;
2746
+
2747
+ case 'querySelectorAll':
2748
+ return querySelectorAll;
2749
+ }
2750
+ } // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2751
+
2629
2752
 
2630
2753
  for (const queryMethod of queryMethods) {
2631
2754
  queryAndChildGetterDescriptors[queryMethod] = {
2632
2755
  value(arg) {
2633
2756
  const vm = getAssociatedVM(this);
2634
2757
  const {
2635
- elm,
2636
- renderer
2758
+ elm
2637
2759
  } = vm;
2638
2760
 
2639
2761
  if (process.env.NODE_ENV !== 'production') {
2640
2762
  warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
2641
2763
  }
2642
2764
 
2643
- return renderer[queryMethod](elm, arg);
2765
+ return getQueryMethod(queryMethod)(elm, arg);
2644
2766
  },
2645
2767
 
2646
2768
  configurable: true,
@@ -3770,10 +3892,6 @@ function createComponentDef(Ctor) {
3770
3892
 
3771
3893
  assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3772
3894
 
3773
- if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
3774
- assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
3775
- }
3776
-
3777
3895
  if (!isUndefined$1(ctorShadowSupportMode)) {
3778
3896
  assert.invariant(ctorShadowSupportMode === "any"
3779
3897
  /* Any */
@@ -4015,17 +4133,14 @@ function setScopeTokenClassIfNecessary(elm, owner) {
4015
4133
  const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
4016
4134
 
4017
4135
  if (!isUndefined$1(token) && context.hasScopedStyles) {
4018
- owner.renderer.getClassList(elm).add(token);
4136
+ getClassList(elm).add(token);
4019
4137
  }
4020
4138
  }
4021
4139
 
4022
4140
  function updateNodeHook(oldVnode, vnode) {
4023
4141
  const {
4024
4142
  elm,
4025
- text,
4026
- owner: {
4027
- renderer
4028
- }
4143
+ text
4029
4144
  } = vnode;
4030
4145
 
4031
4146
  if (oldVnode.text !== text) {
@@ -4033,7 +4148,7 @@ function updateNodeHook(oldVnode, vnode) {
4033
4148
  unlockDomMutation();
4034
4149
  }
4035
4150
 
4036
- renderer.setText(elm, text);
4151
+ setText(elm, text);
4037
4152
 
4038
4153
  if (process.env.NODE_ENV !== 'production') {
4039
4154
  lockDomMutation();
@@ -4041,30 +4156,22 @@ function updateNodeHook(oldVnode, vnode) {
4041
4156
  }
4042
4157
  }
4043
4158
  function insertNodeHook(vnode, parentNode, referenceNode) {
4044
- const {
4045
- renderer
4046
- } = vnode.owner;
4047
-
4048
4159
  if (process.env.NODE_ENV !== 'production') {
4049
4160
  unlockDomMutation();
4050
4161
  }
4051
4162
 
4052
- renderer.insert(vnode.elm, parentNode, referenceNode);
4163
+ insert(vnode.elm, parentNode, referenceNode);
4053
4164
 
4054
4165
  if (process.env.NODE_ENV !== 'production') {
4055
4166
  lockDomMutation();
4056
4167
  }
4057
4168
  }
4058
4169
  function removeNodeHook(vnode, parentNode) {
4059
- const {
4060
- renderer
4061
- } = vnode.owner;
4062
-
4063
4170
  if (process.env.NODE_ENV !== 'production') {
4064
4171
  unlockDomMutation();
4065
4172
  }
4066
4173
 
4067
- renderer.remove(vnode.elm, parentNode);
4174
+ remove(vnode.elm, parentNode);
4068
4175
 
4069
4176
  if (process.env.NODE_ENV !== 'production') {
4070
4177
  lockDomMutation();
@@ -4223,8 +4330,7 @@ function createViewModelHook(elm, vnode) {
4223
4330
  createVM(elm, def, {
4224
4331
  mode,
4225
4332
  owner,
4226
- tagName: sel,
4227
- renderer: owner.renderer
4333
+ tagName: sel
4228
4334
  });
4229
4335
 
4230
4336
  if (process.env.NODE_ENV !== 'production') {
@@ -4268,16 +4374,13 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4268
4374
  const {
4269
4375
  data: {
4270
4376
  attrs = {}
4271
- },
4272
- owner: {
4273
- renderer
4274
4377
  }
4275
4378
  } = vnode;
4276
4379
  let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
4277
4380
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
4278
4381
 
4279
4382
  for (const [attrName, attrValue] of Object.entries(attrs)) {
4280
- const elmAttrValue = renderer.getAttribute(elm, attrName);
4383
+ const elmAttrValue = getAttribute(elm, attrName);
4281
4384
 
4282
4385
  if (String(attrValue) !== elmAttrValue) {
4283
4386
  logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
@@ -4293,9 +4396,6 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4293
4396
  data: {
4294
4397
  className,
4295
4398
  classMap
4296
- },
4297
- owner: {
4298
- renderer
4299
4399
  }
4300
4400
  } = vnode;
4301
4401
  let nodesAreCompatible = true;
@@ -4307,7 +4407,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4307
4407
  vnodeClassName = className;
4308
4408
  } else if (!isUndefined$1(classMap)) {
4309
4409
  // classMap is used when class is set to static value.
4310
- const classList = renderer.getClassList(elm);
4410
+ const classList = getClassList(elm);
4311
4411
  let computedClassName = ''; // all classes from the vnode should be in the element.classList
4312
4412
 
4313
4413
  for (const name in classMap) {
@@ -4337,12 +4437,9 @@ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
4337
4437
  data: {
4338
4438
  style,
4339
4439
  styleDecls
4340
- },
4341
- owner: {
4342
- renderer
4343
4440
  }
4344
4441
  } = vnode;
4345
- const elmStyle = renderer.getAttribute(elm, 'style') || '';
4442
+ const elmStyle = getAttribute(elm, 'style') || '';
4346
4443
  let vnodeStyle;
4347
4444
  let nodesAreCompatible = true;
4348
4445
 
@@ -4474,12 +4571,12 @@ function hasDynamicChildren(children) {
4474
4571
  * SPDX-License-Identifier: MIT
4475
4572
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4476
4573
  */
4477
- function getUpgradableConstructor(tagName, renderer) {
4574
+ function getUpgradableConstructor(tagName) {
4478
4575
  // Should never get a tag with upper case letter at this point, the compiler should
4479
4576
  // produce only tags with lowercase letters
4480
4577
  // But, for backwards compatibility, we will lower case the tagName
4481
4578
  tagName = tagName.toLowerCase();
4482
- let CE = renderer.getCustomElement(tagName);
4579
+ let CE = getCustomElement(tagName);
4483
4580
 
4484
4581
  if (!isUndefined$1(CE)) {
4485
4582
  return CE;
@@ -4490,7 +4587,7 @@ function getUpgradableConstructor(tagName, renderer) {
4490
4587
  */
4491
4588
 
4492
4589
 
4493
- CE = class LWCUpgradableElement extends renderer.HTMLElement {
4590
+ CE = class LWCUpgradableElement extends HTMLElementExported {
4494
4591
  constructor(upgradeCallback) {
4495
4592
  super();
4496
4593
 
@@ -4500,7 +4597,7 @@ function getUpgradableConstructor(tagName, renderer) {
4500
4597
  }
4501
4598
 
4502
4599
  };
4503
- renderer.defineCustomElement(tagName, CE);
4600
+ defineCustomElement(tagName, CE);
4504
4601
  return CE;
4505
4602
  }
4506
4603
 
@@ -4517,10 +4614,7 @@ const TextHook = {
4517
4614
  const {
4518
4615
  owner
4519
4616
  } = vnode;
4520
- const {
4521
- renderer
4522
- } = owner;
4523
- const elm = renderer.createText(vnode.text);
4617
+ const elm = createText(vnode.text);
4524
4618
  linkNodeToShadow(elm, owner);
4525
4619
  vnode.elm = elm;
4526
4620
  },
@@ -4554,10 +4648,7 @@ const CommentHook = {
4554
4648
  owner,
4555
4649
  text
4556
4650
  } = vnode;
4557
- const {
4558
- renderer
4559
- } = owner;
4560
- const elm = renderer.createComment(text);
4651
+ const elm = createComment(text);
4561
4652
  linkNodeToShadow(elm, owner);
4562
4653
  vnode.elm = elm;
4563
4654
  },
@@ -4599,11 +4690,8 @@ const ElementHook = {
4599
4690
  svg
4600
4691
  }
4601
4692
  } = vnode;
4602
- const {
4603
- renderer
4604
- } = owner;
4605
4693
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
4606
- const elm = renderer.createElement(sel, namespace);
4694
+ const elm = createElement(sel, namespace);
4607
4695
  linkNodeToShadow(elm, owner);
4608
4696
  fallbackElmHook(elm, vnode);
4609
4697
  vnode.elm = elm;
@@ -4663,10 +4751,7 @@ const CustomElementHook = {
4663
4751
  sel,
4664
4752
  owner
4665
4753
  } = vnode;
4666
- const {
4667
- renderer
4668
- } = owner;
4669
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
4754
+ const UpgradableConstructor = getUpgradableConstructor(sel);
4670
4755
  /**
4671
4756
  * Note: if the upgradable constructor does not expect, or throw when we new it
4672
4757
  * with a callback as the first argument, we could implement a more advanced
@@ -4759,8 +4844,7 @@ const CustomElementHook = {
4759
4844
  createVM(elm, def, {
4760
4845
  mode,
4761
4846
  owner,
4762
- tagName: sel,
4763
- renderer: owner.renderer
4847
+ tagName: sel
4764
4848
  });
4765
4849
  vnode.elm = elm;
4766
4850
  const vm = getAssociatedVM(elm);
@@ -4789,12 +4873,11 @@ const CustomElementHook = {
4789
4873
 
4790
4874
  function linkNodeToShadow(elm, owner) {
4791
4875
  const {
4792
- renderer,
4793
4876
  renderMode,
4794
4877
  shadowMode
4795
4878
  } = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
4796
4879
 
4797
- if (renderer.isSyntheticShadowDefined) {
4880
+ if (isSyntheticShadowDefined) {
4798
4881
  if (shadowMode === 1
4799
4882
  /* Synthetic */
4800
4883
  || renderMode === 0
@@ -5326,7 +5409,6 @@ function updateStylesheetToken(vm, template) {
5326
5409
  const {
5327
5410
  elm,
5328
5411
  context,
5329
- renderer,
5330
5412
  renderMode,
5331
5413
  shadowMode
5332
5414
  } = vm;
@@ -5353,11 +5435,11 @@ function updateStylesheetToken(vm, template) {
5353
5435
  } = context;
5354
5436
 
5355
5437
  if (oldHasTokenInClass) {
5356
- renderer.getClassList(elm).remove(makeHostToken(oldToken));
5438
+ getClassList(elm).remove(makeHostToken(oldToken));
5357
5439
  }
5358
5440
 
5359
5441
  if (oldHasTokenInAttribute) {
5360
- renderer.removeAttribute(elm, makeHostToken(oldToken));
5442
+ removeAttribute(elm, makeHostToken(oldToken));
5361
5443
  } // Apply the new template styling token to the host element, if the new template has any
5362
5444
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
5363
5445
 
@@ -5369,12 +5451,12 @@ function updateStylesheetToken(vm, template) {
5369
5451
 
5370
5452
  if (!isUndefined$1(newToken)) {
5371
5453
  if (hasScopedStyles) {
5372
- renderer.getClassList(elm).add(makeHostToken(newToken));
5454
+ getClassList(elm).add(makeHostToken(newToken));
5373
5455
  newHasTokenInClass = true;
5374
5456
  }
5375
5457
 
5376
5458
  if (isSyntheticShadow) {
5377
- renderer.setAttribute(elm, makeHostToken(newToken), '');
5459
+ setAttribute(elm, makeHostToken(newToken), '');
5378
5460
  newHasTokenInAttribute = true;
5379
5461
  }
5380
5462
  } // Update the styling tokens present on the context object.
@@ -5494,7 +5576,6 @@ function getNearestNativeShadowComponent(vm) {
5494
5576
 
5495
5577
  function createStylesheet(vm, stylesheets) {
5496
5578
  const {
5497
- renderer,
5498
5579
  renderMode,
5499
5580
  shadowMode
5500
5581
  } = vm;
@@ -5505,9 +5586,9 @@ function createStylesheet(vm, stylesheets) {
5505
5586
  /* Synthetic */
5506
5587
  ) {
5507
5588
  for (let i = 0; i < stylesheets.length; i++) {
5508
- renderer.insertGlobalStylesheet(stylesheets[i]);
5589
+ insertGlobalStylesheet(stylesheets[i]);
5509
5590
  }
5510
- } else if (renderer.ssr || renderer.isHydrating()) {
5591
+ } else if (ssr || isHydrating()) {
5511
5592
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5512
5593
  // This works in the client, because the stylesheets are created, and cached in the VM
5513
5594
  // the first time the VM renders.
@@ -5521,10 +5602,10 @@ function createStylesheet(vm, stylesheets) {
5521
5602
 
5522
5603
  for (let i = 0; i < stylesheets.length; i++) {
5523
5604
  if (isGlobal) {
5524
- renderer.insertGlobalStylesheet(stylesheets[i]);
5605
+ insertGlobalStylesheet(stylesheets[i]);
5525
5606
  } else {
5526
5607
  // local level
5527
- renderer.insertStylesheet(stylesheets[i], root.cmpRoot);
5608
+ insertStylesheet(stylesheets[i], root.cmpRoot);
5528
5609
  }
5529
5610
  }
5530
5611
  }
@@ -6185,7 +6266,6 @@ function createVM(elm, def, options) {
6185
6266
  const {
6186
6267
  mode,
6187
6268
  owner,
6188
- renderer,
6189
6269
  tagName
6190
6270
  } = options;
6191
6271
  const vm = {
@@ -6200,7 +6280,6 @@ function createVM(elm, def, options) {
6200
6280
  tagName,
6201
6281
  mode,
6202
6282
  owner,
6203
- renderer,
6204
6283
  children: EmptyArray,
6205
6284
  aChildren: EmptyArray,
6206
6285
  velements: EmptyArray,
@@ -6255,13 +6334,8 @@ function createVM(elm, def, options) {
6255
6334
 
6256
6335
  function computeShadowMode(vm) {
6257
6336
  const {
6258
- def,
6259
- renderer
6337
+ def
6260
6338
  } = vm;
6261
- const {
6262
- isNativeShadowDefined,
6263
- isSyntheticShadowDefined
6264
- } = renderer;
6265
6339
  let shadowMode;
6266
6340
 
6267
6341
  if (isSyntheticShadowDefined) {
@@ -6411,13 +6485,12 @@ function patchShadowRoot(vm, newCh) {
6411
6485
 
6412
6486
  function runRenderedCallback(vm) {
6413
6487
  const {
6414
- renderer,
6415
6488
  def: {
6416
6489
  renderedCallback
6417
6490
  }
6418
6491
  } = vm;
6419
6492
 
6420
- if (isTrue(renderer.ssr)) {
6493
+ if (isTrue(ssr)) {
6421
6494
  return;
6422
6495
  }
6423
6496
 
@@ -6643,8 +6716,7 @@ function recursivelyDisconnectChildren(vnodes) {
6643
6716
 
6644
6717
  function resetComponentRoot(vm) {
6645
6718
  const {
6646
- children,
6647
- renderer
6719
+ children
6648
6720
  } = vm;
6649
6721
  const rootNode = getRenderRoot(vm);
6650
6722
 
@@ -6652,7 +6724,7 @@ function resetComponentRoot(vm) {
6652
6724
  const child = children[i];
6653
6725
 
6654
6726
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6655
- renderer.remove(child.elm, rootNode);
6727
+ remove(child.elm, rootNode);
6656
6728
  }
6657
6729
  }
6658
6730
 
@@ -6661,7 +6733,7 @@ function resetComponentRoot(vm) {
6661
6733
  vm.velements = EmptyArray;
6662
6734
  }
6663
6735
  function scheduleRehydration(vm) {
6664
- if (isTrue(vm.renderer.ssr) || isTrue(vm.isScheduled)) {
6736
+ if (isTrue(ssr) || isTrue(vm.isScheduled)) {
6665
6737
  return;
6666
6738
  }
6667
6739
 
@@ -6901,7 +6973,6 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6901
6973
 
6902
6974
  const {
6903
6975
  elm,
6904
- renderer,
6905
6976
  context: {
6906
6977
  wiredConnecting,
6907
6978
  wiredDisconnecting
@@ -6928,7 +6999,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6928
6999
  }
6929
7000
 
6930
7001
  });
6931
- renderer.dispatchEvent(elm, contextRegistrationEvent);
7002
+ dispatchEvent(elm, contextRegistrationEvent);
6932
7003
  });
6933
7004
  }
6934
7005
 
@@ -7184,5 +7255,5 @@ function setHooks(hooks) {
7184
7255
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7185
7256
  }
7186
7257
 
7187
- export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7188
- /* version: 2.6.2 */
7258
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertGlobalStylesheet, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7259
+ /* version: 2.6.3 */