lwc 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.
- package/dist/engine-dom/esm/es2017/engine-dom.js +488 -547
- package/dist/engine-dom/iife/es2017/engine-dom.js +488 -546
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +430 -490
- package/dist/engine-dom/iife/es5/engine-dom.js +600 -715
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +535 -655
- package/dist/engine-dom/umd/es2017/engine-dom.js +488 -546
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +430 -490
- package/dist/engine-dom/umd/es5/engine-dom.js +600 -715
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +535 -655
- package/dist/engine-server/commonjs/es2017/engine-server.js +371 -450
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +371 -451
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -304,9 +304,9 @@
|
|
|
304
304
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
305
305
|
*/
|
|
306
306
|
// Increment whenever the LWC template compiler changes
|
|
307
|
-
const LWC_VERSION = "2.
|
|
307
|
+
const LWC_VERSION = "2.14.2";
|
|
308
308
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.
|
|
309
|
+
/** version: 2.14.2 */
|
|
310
310
|
|
|
311
311
|
/*
|
|
312
312
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -460,7 +460,32 @@
|
|
|
460
460
|
setFeatureFlag(name, value);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
/** version: 2.
|
|
463
|
+
/** version: 2.14.2 */
|
|
464
|
+
|
|
465
|
+
/*
|
|
466
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
467
|
+
* All rights reserved.
|
|
468
|
+
* SPDX-License-Identifier: MIT
|
|
469
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
470
|
+
*/
|
|
471
|
+
// @ts-ignore
|
|
472
|
+
|
|
473
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
474
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
475
|
+
let hasFlag = false;
|
|
476
|
+
|
|
477
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
478
|
+
hasFlag = true;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
482
|
+
detail: {
|
|
483
|
+
package: '@lwc/engine-dom',
|
|
484
|
+
hasFlag
|
|
485
|
+
}
|
|
486
|
+
}));
|
|
487
|
+
});
|
|
488
|
+
}
|
|
464
489
|
|
|
465
490
|
/* proxy-compat-disable */
|
|
466
491
|
|
|
@@ -570,162 +595,6 @@
|
|
|
570
595
|
return list;
|
|
571
596
|
}
|
|
572
597
|
|
|
573
|
-
//
|
|
574
|
-
// Primitives
|
|
575
|
-
//
|
|
576
|
-
let ssr$1;
|
|
577
|
-
function setSsr(ssrImpl) {
|
|
578
|
-
ssr$1 = ssrImpl;
|
|
579
|
-
}
|
|
580
|
-
let isNativeShadowDefined$1;
|
|
581
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
582
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
583
|
-
}
|
|
584
|
-
let isSyntheticShadowDefined$1;
|
|
585
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
586
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
587
|
-
}
|
|
588
|
-
let HTMLElementExported$1;
|
|
589
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
590
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
591
|
-
}
|
|
592
|
-
let insert$1;
|
|
593
|
-
function setInsert(insertImpl) {
|
|
594
|
-
insert$1 = insertImpl;
|
|
595
|
-
}
|
|
596
|
-
let remove$1;
|
|
597
|
-
function setRemove(removeImpl) {
|
|
598
|
-
remove$1 = removeImpl;
|
|
599
|
-
}
|
|
600
|
-
let createElement$2;
|
|
601
|
-
function setCreateElement(createElementImpl) {
|
|
602
|
-
createElement$2 = createElementImpl;
|
|
603
|
-
}
|
|
604
|
-
let createText$1;
|
|
605
|
-
function setCreateText(createTextImpl) {
|
|
606
|
-
createText$1 = createTextImpl;
|
|
607
|
-
}
|
|
608
|
-
let createComment$1;
|
|
609
|
-
function setCreateComment(createCommentImpl) {
|
|
610
|
-
createComment$1 = createCommentImpl;
|
|
611
|
-
}
|
|
612
|
-
let nextSibling$1;
|
|
613
|
-
function setNextSibling(nextSiblingImpl) {
|
|
614
|
-
nextSibling$1 = nextSiblingImpl;
|
|
615
|
-
}
|
|
616
|
-
let attachShadow$1;
|
|
617
|
-
function setAttachShadow(attachShadowImpl) {
|
|
618
|
-
attachShadow$1 = attachShadowImpl;
|
|
619
|
-
}
|
|
620
|
-
let getProperty$1;
|
|
621
|
-
function setGetProperty(getPropertyImpl) {
|
|
622
|
-
getProperty$1 = getPropertyImpl;
|
|
623
|
-
}
|
|
624
|
-
let setProperty$1;
|
|
625
|
-
function setSetProperty(setPropertyImpl) {
|
|
626
|
-
setProperty$1 = setPropertyImpl;
|
|
627
|
-
}
|
|
628
|
-
let setText$1;
|
|
629
|
-
function setSetText(setTextImpl) {
|
|
630
|
-
setText$1 = setTextImpl;
|
|
631
|
-
}
|
|
632
|
-
let getAttribute$1;
|
|
633
|
-
function setGetAttribute(getAttributeImpl) {
|
|
634
|
-
getAttribute$1 = getAttributeImpl;
|
|
635
|
-
}
|
|
636
|
-
let setAttribute$1;
|
|
637
|
-
function setSetAttribute(setAttributeImpl) {
|
|
638
|
-
setAttribute$1 = setAttributeImpl;
|
|
639
|
-
}
|
|
640
|
-
let removeAttribute$1;
|
|
641
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
642
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
643
|
-
}
|
|
644
|
-
let addEventListener$1;
|
|
645
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
646
|
-
addEventListener$1 = addEventListenerImpl;
|
|
647
|
-
}
|
|
648
|
-
let removeEventListener$1;
|
|
649
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
650
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
651
|
-
}
|
|
652
|
-
let dispatchEvent$1;
|
|
653
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
654
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
655
|
-
}
|
|
656
|
-
let getClassList$1;
|
|
657
|
-
function setGetClassList(getClassListImpl) {
|
|
658
|
-
getClassList$1 = getClassListImpl;
|
|
659
|
-
}
|
|
660
|
-
let setCSSStyleProperty$1;
|
|
661
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
662
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
663
|
-
}
|
|
664
|
-
let getBoundingClientRect$1;
|
|
665
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
666
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
667
|
-
}
|
|
668
|
-
let querySelector$1;
|
|
669
|
-
function setQuerySelector(querySelectorImpl) {
|
|
670
|
-
querySelector$1 = querySelectorImpl;
|
|
671
|
-
}
|
|
672
|
-
let querySelectorAll$1;
|
|
673
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
674
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
675
|
-
}
|
|
676
|
-
let getElementsByTagName$1;
|
|
677
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
678
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
679
|
-
}
|
|
680
|
-
let getElementsByClassName$1;
|
|
681
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
682
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
683
|
-
}
|
|
684
|
-
let getChildren$1;
|
|
685
|
-
function setGetChildren(getChildrenImpl) {
|
|
686
|
-
getChildren$1 = getChildrenImpl;
|
|
687
|
-
}
|
|
688
|
-
let getChildNodes$1;
|
|
689
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
690
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
691
|
-
}
|
|
692
|
-
let getFirstChild$1;
|
|
693
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
694
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
695
|
-
}
|
|
696
|
-
let getFirstElementChild$1;
|
|
697
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
698
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
699
|
-
}
|
|
700
|
-
let getLastChild$1;
|
|
701
|
-
function setGetLastChild(getLastChildImpl) {
|
|
702
|
-
getLastChild$1 = getLastChildImpl;
|
|
703
|
-
}
|
|
704
|
-
let getLastElementChild$1;
|
|
705
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
706
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
707
|
-
}
|
|
708
|
-
let isConnected$1;
|
|
709
|
-
function setIsConnected(isConnectedImpl) {
|
|
710
|
-
isConnected$1 = isConnectedImpl;
|
|
711
|
-
}
|
|
712
|
-
let insertStylesheet$1;
|
|
713
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
714
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
715
|
-
}
|
|
716
|
-
let assertInstanceOfHTMLElement$1;
|
|
717
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
718
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
719
|
-
}
|
|
720
|
-
let defineCustomElement$1;
|
|
721
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
722
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
723
|
-
}
|
|
724
|
-
let getCustomElement$1;
|
|
725
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
726
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
598
|
/*
|
|
730
599
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
731
600
|
* All rights reserved.
|
|
@@ -2030,7 +1899,8 @@
|
|
|
2030
1899
|
const { def, elm } = vm;
|
|
2031
1900
|
const { bridge } = def;
|
|
2032
1901
|
if (process.env.NODE_ENV !== 'production') {
|
|
2033
|
-
|
|
1902
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1903
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2034
1904
|
}
|
|
2035
1905
|
const component = this;
|
|
2036
1906
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2064,8 +1934,8 @@
|
|
|
2064
1934
|
return this;
|
|
2065
1935
|
};
|
|
2066
1936
|
function doAttachShadow(vm) {
|
|
2067
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2068
|
-
const shadowRoot = attachShadow
|
|
1937
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1938
|
+
const shadowRoot = attachShadow(elm, {
|
|
2069
1939
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2070
1940
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2071
1941
|
mode,
|
|
@@ -2086,12 +1956,13 @@
|
|
|
2086
1956
|
LightningElement.prototype = {
|
|
2087
1957
|
constructor: LightningElement,
|
|
2088
1958
|
dispatchEvent(event) {
|
|
2089
|
-
const
|
|
2090
|
-
|
|
1959
|
+
const vm = getAssociatedVM(this);
|
|
1960
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1961
|
+
return dispatchEvent(elm, event);
|
|
2091
1962
|
},
|
|
2092
1963
|
addEventListener(type, listener, options) {
|
|
2093
1964
|
const vm = getAssociatedVM(this);
|
|
2094
|
-
const { elm } = vm;
|
|
1965
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2095
1966
|
if (process.env.NODE_ENV !== 'production') {
|
|
2096
1967
|
const vmBeingRendered = getVMBeingRendered();
|
|
2097
1968
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2099,83 +1970,91 @@
|
|
|
2099
1970
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2100
1971
|
}
|
|
2101
1972
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2102
|
-
addEventListener
|
|
1973
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2103
1974
|
},
|
|
2104
1975
|
removeEventListener(type, listener, options) {
|
|
2105
1976
|
const vm = getAssociatedVM(this);
|
|
2106
|
-
const { elm } = vm;
|
|
1977
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2107
1978
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2108
|
-
removeEventListener
|
|
1979
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2109
1980
|
},
|
|
2110
1981
|
hasAttribute(name) {
|
|
2111
|
-
const
|
|
2112
|
-
|
|
1982
|
+
const vm = getAssociatedVM(this);
|
|
1983
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1984
|
+
return !isNull(getAttribute(elm, name));
|
|
2113
1985
|
},
|
|
2114
1986
|
hasAttributeNS(namespace, name) {
|
|
2115
|
-
const
|
|
2116
|
-
|
|
1987
|
+
const vm = getAssociatedVM(this);
|
|
1988
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1989
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2117
1990
|
},
|
|
2118
1991
|
removeAttribute(name) {
|
|
2119
|
-
const
|
|
1992
|
+
const vm = getAssociatedVM(this);
|
|
1993
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2120
1994
|
unlockAttribute(elm, name);
|
|
2121
|
-
removeAttribute
|
|
1995
|
+
removeAttribute(elm, name);
|
|
2122
1996
|
lockAttribute();
|
|
2123
1997
|
},
|
|
2124
1998
|
removeAttributeNS(namespace, name) {
|
|
2125
|
-
const { elm } = getAssociatedVM(this);
|
|
1999
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2126
2000
|
unlockAttribute(elm, name);
|
|
2127
|
-
removeAttribute
|
|
2001
|
+
removeAttribute(elm, name, namespace);
|
|
2128
2002
|
lockAttribute();
|
|
2129
2003
|
},
|
|
2130
2004
|
getAttribute(name) {
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2005
|
+
const vm = getAssociatedVM(this);
|
|
2006
|
+
const { elm } = vm;
|
|
2007
|
+
const { getAttribute } = vm.renderer;
|
|
2008
|
+
return getAttribute(elm, name);
|
|
2133
2009
|
},
|
|
2134
2010
|
getAttributeNS(namespace, name) {
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2011
|
+
const vm = getAssociatedVM(this);
|
|
2012
|
+
const { elm } = vm;
|
|
2013
|
+
const { getAttribute } = vm.renderer;
|
|
2014
|
+
return getAttribute(elm, name, namespace);
|
|
2137
2015
|
},
|
|
2138
2016
|
setAttribute(name, value) {
|
|
2139
2017
|
const vm = getAssociatedVM(this);
|
|
2140
|
-
const { elm } = vm;
|
|
2018
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2141
2019
|
if (process.env.NODE_ENV !== 'production') {
|
|
2142
2020
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2143
2021
|
}
|
|
2144
2022
|
unlockAttribute(elm, name);
|
|
2145
|
-
setAttribute
|
|
2023
|
+
setAttribute(elm, name, value);
|
|
2146
2024
|
lockAttribute();
|
|
2147
2025
|
},
|
|
2148
2026
|
setAttributeNS(namespace, name, value) {
|
|
2149
2027
|
const vm = getAssociatedVM(this);
|
|
2150
|
-
const { elm } = vm;
|
|
2028
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2151
2029
|
if (process.env.NODE_ENV !== 'production') {
|
|
2152
2030
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2153
2031
|
}
|
|
2154
2032
|
unlockAttribute(elm, name);
|
|
2155
|
-
setAttribute
|
|
2033
|
+
setAttribute(elm, name, value, namespace);
|
|
2156
2034
|
lockAttribute();
|
|
2157
2035
|
},
|
|
2158
2036
|
getBoundingClientRect() {
|
|
2159
2037
|
const vm = getAssociatedVM(this);
|
|
2160
|
-
const { elm } = vm;
|
|
2038
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2161
2039
|
if (process.env.NODE_ENV !== 'production') {
|
|
2162
2040
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2163
2041
|
}
|
|
2164
|
-
return getBoundingClientRect
|
|
2042
|
+
return getBoundingClientRect(elm);
|
|
2165
2043
|
},
|
|
2166
2044
|
get isConnected() {
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2045
|
+
const vm = getAssociatedVM(this);
|
|
2046
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2047
|
+
return isConnected(elm);
|
|
2169
2048
|
},
|
|
2170
2049
|
get classList() {
|
|
2171
2050
|
const vm = getAssociatedVM(this);
|
|
2172
|
-
const { elm } = vm;
|
|
2051
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2173
2052
|
if (process.env.NODE_ENV !== 'production') {
|
|
2174
2053
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2175
2054
|
// just throw in all modes
|
|
2176
2055
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
|
|
2177
2056
|
}
|
|
2178
|
-
return getClassList
|
|
2057
|
+
return getClassList(elm);
|
|
2179
2058
|
},
|
|
2180
2059
|
get template() {
|
|
2181
2060
|
const vm = getAssociatedVM(this);
|
|
@@ -2191,6 +2070,54 @@
|
|
|
2191
2070
|
// Authors should rely on this.template instead.
|
|
2192
2071
|
return null;
|
|
2193
2072
|
},
|
|
2073
|
+
get children() {
|
|
2074
|
+
const vm = getAssociatedVM(this);
|
|
2075
|
+
const renderer = vm.renderer;
|
|
2076
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2077
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2078
|
+
}
|
|
2079
|
+
return renderer.getChildren(vm.elm);
|
|
2080
|
+
},
|
|
2081
|
+
get childNodes() {
|
|
2082
|
+
const vm = getAssociatedVM(this);
|
|
2083
|
+
const renderer = vm.renderer;
|
|
2084
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2085
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2086
|
+
}
|
|
2087
|
+
return renderer.getChildNodes(vm.elm);
|
|
2088
|
+
},
|
|
2089
|
+
get firstChild() {
|
|
2090
|
+
const vm = getAssociatedVM(this);
|
|
2091
|
+
const renderer = vm.renderer;
|
|
2092
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2093
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2094
|
+
}
|
|
2095
|
+
return renderer.getFirstChild(vm.elm);
|
|
2096
|
+
},
|
|
2097
|
+
get firstElementChild() {
|
|
2098
|
+
const vm = getAssociatedVM(this);
|
|
2099
|
+
const renderer = vm.renderer;
|
|
2100
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2101
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2102
|
+
}
|
|
2103
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2104
|
+
},
|
|
2105
|
+
get lastChild() {
|
|
2106
|
+
const vm = getAssociatedVM(this);
|
|
2107
|
+
const renderer = vm.renderer;
|
|
2108
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2109
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2110
|
+
}
|
|
2111
|
+
return renderer.getLastChild(vm.elm);
|
|
2112
|
+
},
|
|
2113
|
+
get lastElementChild() {
|
|
2114
|
+
const vm = getAssociatedVM(this);
|
|
2115
|
+
const renderer = vm.renderer;
|
|
2116
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2117
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2118
|
+
}
|
|
2119
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2120
|
+
},
|
|
2194
2121
|
render() {
|
|
2195
2122
|
const vm = getAssociatedVM(this);
|
|
2196
2123
|
return vm.def.template;
|
|
@@ -2201,76 +2128,22 @@
|
|
|
2201
2128
|
},
|
|
2202
2129
|
};
|
|
2203
2130
|
const queryAndChildGetterDescriptors = create(null);
|
|
2204
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2205
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2206
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2207
|
-
const childGetters = [
|
|
2208
|
-
'children',
|
|
2209
|
-
'childNodes',
|
|
2210
|
-
'firstChild',
|
|
2211
|
-
'firstElementChild',
|
|
2212
|
-
'lastChild',
|
|
2213
|
-
'lastElementChild',
|
|
2214
|
-
];
|
|
2215
|
-
function getChildGetter(methodName) {
|
|
2216
|
-
switch (methodName) {
|
|
2217
|
-
case 'children':
|
|
2218
|
-
return getChildren$1;
|
|
2219
|
-
case 'childNodes':
|
|
2220
|
-
return getChildNodes$1;
|
|
2221
|
-
case 'firstChild':
|
|
2222
|
-
return getFirstChild$1;
|
|
2223
|
-
case 'firstElementChild':
|
|
2224
|
-
return getFirstElementChild$1;
|
|
2225
|
-
case 'lastChild':
|
|
2226
|
-
return getLastChild$1;
|
|
2227
|
-
case 'lastElementChild':
|
|
2228
|
-
return getLastElementChild$1;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2232
|
-
for (const childGetter of childGetters) {
|
|
2233
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2234
|
-
get() {
|
|
2235
|
-
const vm = getAssociatedVM(this);
|
|
2236
|
-
const { elm } = vm;
|
|
2237
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2238
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2239
|
-
}
|
|
2240
|
-
return getChildGetter(childGetter)(elm);
|
|
2241
|
-
},
|
|
2242
|
-
configurable: true,
|
|
2243
|
-
enumerable: true,
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
2131
|
const queryMethods = [
|
|
2247
2132
|
'getElementsByClassName',
|
|
2248
2133
|
'getElementsByTagName',
|
|
2249
2134
|
'querySelector',
|
|
2250
2135
|
'querySelectorAll',
|
|
2251
2136
|
];
|
|
2252
|
-
function getQueryMethod(methodName) {
|
|
2253
|
-
switch (methodName) {
|
|
2254
|
-
case 'getElementsByClassName':
|
|
2255
|
-
return getElementsByClassName$1;
|
|
2256
|
-
case 'getElementsByTagName':
|
|
2257
|
-
return getElementsByTagName$1;
|
|
2258
|
-
case 'querySelector':
|
|
2259
|
-
return querySelector$1;
|
|
2260
|
-
case 'querySelectorAll':
|
|
2261
|
-
return querySelectorAll$1;
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
2137
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2265
2138
|
for (const queryMethod of queryMethods) {
|
|
2266
2139
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2267
2140
|
value(arg) {
|
|
2268
2141
|
const vm = getAssociatedVM(this);
|
|
2269
|
-
const { elm } = vm;
|
|
2142
|
+
const { elm, renderer } = vm;
|
|
2270
2143
|
if (process.env.NODE_ENV !== 'production') {
|
|
2271
2144
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2272
2145
|
}
|
|
2273
|
-
return
|
|
2146
|
+
return renderer[queryMethod](elm, arg);
|
|
2274
2147
|
},
|
|
2275
2148
|
configurable: true,
|
|
2276
2149
|
enumerable: true,
|
|
@@ -2775,7 +2648,8 @@
|
|
|
2775
2648
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2776
2649
|
*/
|
|
2777
2650
|
let warned = false;
|
|
2778
|
-
|
|
2651
|
+
// @ts-ignore
|
|
2652
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2779
2653
|
// @ts-ignore
|
|
2780
2654
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2781
2655
|
warned = false;
|
|
@@ -3493,12 +3367,13 @@
|
|
|
3493
3367
|
* SPDX-License-Identifier: MIT
|
|
3494
3368
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3495
3369
|
*/
|
|
3496
|
-
function getUpgradableConstructor(tagName) {
|
|
3370
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3371
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3497
3372
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3498
3373
|
// produce only tags with lowercase letters
|
|
3499
3374
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3500
3375
|
tagName = tagName.toLowerCase();
|
|
3501
|
-
let CE = getCustomElement
|
|
3376
|
+
let CE = getCustomElement(tagName);
|
|
3502
3377
|
if (!isUndefined$1(CE)) {
|
|
3503
3378
|
return CE;
|
|
3504
3379
|
}
|
|
@@ -3506,7 +3381,7 @@
|
|
|
3506
3381
|
* LWC Upgradable Element reference to an element that was created
|
|
3507
3382
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3508
3383
|
*/
|
|
3509
|
-
CE = class LWCUpgradableElement extends
|
|
3384
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3510
3385
|
constructor(upgradeCallback) {
|
|
3511
3386
|
super();
|
|
3512
3387
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3514,7 +3389,7 @@
|
|
|
3514
3389
|
}
|
|
3515
3390
|
}
|
|
3516
3391
|
};
|
|
3517
|
-
defineCustomElement
|
|
3392
|
+
defineCustomElement(tagName, CE);
|
|
3518
3393
|
return CE;
|
|
3519
3394
|
}
|
|
3520
3395
|
|
|
@@ -3539,7 +3414,7 @@
|
|
|
3539
3414
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3540
3415
|
*/
|
|
3541
3416
|
const ColonCharCode = 58;
|
|
3542
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3417
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3543
3418
|
const { attrs } = vnode.data;
|
|
3544
3419
|
if (isUndefined$1(attrs)) {
|
|
3545
3420
|
return;
|
|
@@ -3549,6 +3424,7 @@
|
|
|
3549
3424
|
return;
|
|
3550
3425
|
}
|
|
3551
3426
|
const { elm } = vnode;
|
|
3427
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3552
3428
|
for (const key in attrs) {
|
|
3553
3429
|
const cur = attrs[key];
|
|
3554
3430
|
const old = oldAttrs[key];
|
|
@@ -3556,17 +3432,17 @@
|
|
|
3556
3432
|
unlockAttribute(elm, key);
|
|
3557
3433
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3558
3434
|
// Assume xml namespace
|
|
3559
|
-
setAttribute
|
|
3435
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3560
3436
|
}
|
|
3561
3437
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3562
3438
|
// Assume xlink namespace
|
|
3563
|
-
setAttribute
|
|
3439
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3564
3440
|
}
|
|
3565
3441
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3566
|
-
removeAttribute
|
|
3442
|
+
removeAttribute(elm, key);
|
|
3567
3443
|
}
|
|
3568
3444
|
else {
|
|
3569
|
-
setAttribute
|
|
3445
|
+
setAttribute(elm, key, cur);
|
|
3570
3446
|
}
|
|
3571
3447
|
lockAttribute();
|
|
3572
3448
|
}
|
|
@@ -3584,7 +3460,7 @@
|
|
|
3584
3460
|
// instead of relying on internally tracked values.
|
|
3585
3461
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3586
3462
|
}
|
|
3587
|
-
function patchProps(oldVnode, vnode) {
|
|
3463
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3588
3464
|
const { props } = vnode.data;
|
|
3589
3465
|
if (isUndefined$1(props)) {
|
|
3590
3466
|
return;
|
|
@@ -3595,13 +3471,14 @@
|
|
|
3595
3471
|
}
|
|
3596
3472
|
const isFirstPatch = isNull(oldVnode);
|
|
3597
3473
|
const { elm, sel } = vnode;
|
|
3474
|
+
const { getProperty, setProperty } = renderer;
|
|
3598
3475
|
for (const key in props) {
|
|
3599
3476
|
const cur = props[key];
|
|
3600
3477
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3601
3478
|
// different than the one previously set.
|
|
3602
3479
|
if (isFirstPatch ||
|
|
3603
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3604
|
-
setProperty
|
|
3480
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3481
|
+
setProperty(elm, key, cur);
|
|
3605
3482
|
}
|
|
3606
3483
|
}
|
|
3607
3484
|
}
|
|
@@ -3646,13 +3523,14 @@
|
|
|
3646
3523
|
}
|
|
3647
3524
|
return map;
|
|
3648
3525
|
}
|
|
3649
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3526
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3650
3527
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3651
3528
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3652
3529
|
if (oldClass === newClass) {
|
|
3653
3530
|
return;
|
|
3654
3531
|
}
|
|
3655
|
-
const
|
|
3532
|
+
const { getClassList } = renderer;
|
|
3533
|
+
const classList = getClassList(elm);
|
|
3656
3534
|
const newClassMap = getMapFromClassName(newClass);
|
|
3657
3535
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3658
3536
|
let name;
|
|
@@ -3676,17 +3554,18 @@
|
|
|
3676
3554
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3677
3555
|
*/
|
|
3678
3556
|
// The style property is a string when defined via an expression in the template.
|
|
3679
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3557
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3680
3558
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3681
3559
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3682
3560
|
if (oldStyle === newStyle) {
|
|
3683
3561
|
return;
|
|
3684
3562
|
}
|
|
3563
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3685
3564
|
if (!isString(newStyle) || newStyle === '') {
|
|
3686
|
-
removeAttribute
|
|
3565
|
+
removeAttribute(elm, 'style');
|
|
3687
3566
|
}
|
|
3688
3567
|
else {
|
|
3689
|
-
setAttribute
|
|
3568
|
+
setAttribute(elm, 'style', newStyle);
|
|
3690
3569
|
}
|
|
3691
3570
|
}
|
|
3692
3571
|
|
|
@@ -3696,14 +3575,15 @@
|
|
|
3696
3575
|
* SPDX-License-Identifier: MIT
|
|
3697
3576
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3698
3577
|
*/
|
|
3699
|
-
function applyEventListeners(vnode) {
|
|
3578
|
+
function applyEventListeners(vnode, renderer) {
|
|
3700
3579
|
const { elm, data: { on }, } = vnode;
|
|
3701
3580
|
if (isUndefined$1(on)) {
|
|
3702
3581
|
return;
|
|
3703
3582
|
}
|
|
3583
|
+
const { addEventListener } = renderer;
|
|
3704
3584
|
for (const name in on) {
|
|
3705
3585
|
const handler = on[name];
|
|
3706
|
-
addEventListener
|
|
3586
|
+
addEventListener(elm, name, handler);
|
|
3707
3587
|
}
|
|
3708
3588
|
}
|
|
3709
3589
|
|
|
@@ -3716,12 +3596,13 @@
|
|
|
3716
3596
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3717
3597
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3718
3598
|
// different classnames properties individually instead of via a string.
|
|
3719
|
-
function applyStaticClassAttribute(vnode) {
|
|
3599
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3720
3600
|
const { elm, data: { classMap }, } = vnode;
|
|
3721
3601
|
if (isUndefined$1(classMap)) {
|
|
3722
3602
|
return;
|
|
3723
3603
|
}
|
|
3724
|
-
const
|
|
3604
|
+
const { getClassList } = renderer;
|
|
3605
|
+
const classList = getClassList(elm);
|
|
3725
3606
|
for (const name in classMap) {
|
|
3726
3607
|
classList.add(name);
|
|
3727
3608
|
}
|
|
@@ -3736,14 +3617,15 @@
|
|
|
3736
3617
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3737
3618
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3738
3619
|
// different style properties individually instead of via a string.
|
|
3739
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3620
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3740
3621
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3741
3622
|
if (isUndefined$1(styleDecls)) {
|
|
3742
3623
|
return;
|
|
3743
3624
|
}
|
|
3625
|
+
const { setCSSStyleProperty } = renderer;
|
|
3744
3626
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3745
3627
|
const [prop, value, important] = styleDecls[i];
|
|
3746
|
-
setCSSStyleProperty
|
|
3628
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3747
3629
|
}
|
|
3748
3630
|
}
|
|
3749
3631
|
|
|
@@ -3753,15 +3635,16 @@
|
|
|
3753
3635
|
* SPDX-License-Identifier: MIT
|
|
3754
3636
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3755
3637
|
*/
|
|
3756
|
-
function patchChildren(c1, c2, parent) {
|
|
3638
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3757
3639
|
if (hasDynamicChildren(c2)) {
|
|
3758
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3640
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3759
3641
|
}
|
|
3760
3642
|
else {
|
|
3761
|
-
updateStaticChildren(c1, c2, parent);
|
|
3643
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3762
3644
|
}
|
|
3763
3645
|
}
|
|
3764
|
-
function patch(n1, n2) {
|
|
3646
|
+
function patch(n1, n2, renderer) {
|
|
3647
|
+
var _a, _b;
|
|
3765
3648
|
if (n1 === n2) {
|
|
3766
3649
|
return;
|
|
3767
3650
|
}
|
|
@@ -3775,80 +3658,90 @@
|
|
|
3775
3658
|
}
|
|
3776
3659
|
switch (n2.type) {
|
|
3777
3660
|
case 0 /* Text */:
|
|
3778
|
-
|
|
3661
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3662
|
+
patchText(n1, n2, renderer);
|
|
3779
3663
|
break;
|
|
3780
3664
|
case 1 /* Comment */:
|
|
3781
|
-
|
|
3665
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3666
|
+
patchComment(n1, n2, renderer);
|
|
3782
3667
|
break;
|
|
3783
3668
|
case 2 /* Element */:
|
|
3784
|
-
patchElement(n1, n2);
|
|
3669
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3785
3670
|
break;
|
|
3786
3671
|
case 3 /* CustomElement */:
|
|
3787
|
-
patchCustomElement(n1, n2);
|
|
3672
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3788
3673
|
break;
|
|
3789
3674
|
}
|
|
3790
3675
|
}
|
|
3791
|
-
function mount(node, parent, anchor) {
|
|
3676
|
+
function mount(node, parent, renderer, anchor) {
|
|
3677
|
+
var _a, _b;
|
|
3792
3678
|
switch (node.type) {
|
|
3793
3679
|
case 0 /* Text */:
|
|
3794
|
-
|
|
3680
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3681
|
+
mountText(node, parent, anchor, renderer);
|
|
3795
3682
|
break;
|
|
3796
3683
|
case 1 /* Comment */:
|
|
3797
|
-
|
|
3684
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3685
|
+
mountComment(node, parent, anchor, renderer);
|
|
3798
3686
|
break;
|
|
3799
3687
|
case 2 /* Element */:
|
|
3800
|
-
|
|
3688
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3689
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3801
3690
|
break;
|
|
3802
3691
|
case 3 /* CustomElement */:
|
|
3803
|
-
|
|
3692
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3693
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3804
3694
|
break;
|
|
3805
3695
|
}
|
|
3806
3696
|
}
|
|
3807
|
-
function patchText(n1, n2) {
|
|
3697
|
+
function patchText(n1, n2, renderer) {
|
|
3808
3698
|
n2.elm = n1.elm;
|
|
3809
3699
|
if (n2.text !== n1.text) {
|
|
3810
|
-
updateTextContent(n2);
|
|
3700
|
+
updateTextContent(n2, renderer);
|
|
3811
3701
|
}
|
|
3812
3702
|
}
|
|
3813
|
-
function mountText(
|
|
3814
|
-
const { owner } =
|
|
3815
|
-
const
|
|
3816
|
-
|
|
3817
|
-
|
|
3703
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3704
|
+
const { owner } = vnode;
|
|
3705
|
+
const { createText } = renderer;
|
|
3706
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3707
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3708
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3818
3709
|
}
|
|
3819
|
-
function patchComment(n1, n2) {
|
|
3710
|
+
function patchComment(n1, n2, renderer) {
|
|
3820
3711
|
n2.elm = n1.elm;
|
|
3821
3712
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3822
3713
|
// it is the case today.
|
|
3823
3714
|
if (n2.text !== n1.text) {
|
|
3824
|
-
updateTextContent(n2);
|
|
3715
|
+
updateTextContent(n2, renderer);
|
|
3825
3716
|
}
|
|
3826
3717
|
}
|
|
3827
|
-
function mountComment(
|
|
3828
|
-
const { owner } =
|
|
3829
|
-
const
|
|
3830
|
-
|
|
3831
|
-
|
|
3718
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3719
|
+
const { owner } = vnode;
|
|
3720
|
+
const { createComment } = renderer;
|
|
3721
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3722
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3723
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3832
3724
|
}
|
|
3833
|
-
function mountElement(vnode, parent, anchor) {
|
|
3725
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3834
3726
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3727
|
+
const { createElement } = renderer;
|
|
3835
3728
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3836
|
-
const elm = createElement
|
|
3837
|
-
linkNodeToShadow(elm, owner);
|
|
3838
|
-
fallbackElmHook(elm, vnode);
|
|
3729
|
+
const elm = createElement(sel, namespace);
|
|
3730
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3731
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3839
3732
|
vnode.elm = elm;
|
|
3840
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3841
|
-
insertNode(elm, parent, anchor);
|
|
3842
|
-
mountVNodes(vnode.children, elm, null);
|
|
3733
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3734
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3735
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3843
3736
|
}
|
|
3844
|
-
function patchElement(n1, n2) {
|
|
3737
|
+
function patchElement(n1, n2, renderer) {
|
|
3845
3738
|
const elm = (n2.elm = n1.elm);
|
|
3846
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3847
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3739
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3740
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3848
3741
|
}
|
|
3849
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3742
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3850
3743
|
const { sel, owner } = vnode;
|
|
3851
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3744
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3852
3745
|
/**
|
|
3853
3746
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3854
3747
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3858,9 +3751,9 @@
|
|
|
3858
3751
|
let vm;
|
|
3859
3752
|
const elm = new UpgradableConstructor((elm) => {
|
|
3860
3753
|
// the custom element from the registry is expecting an upgrade callback
|
|
3861
|
-
vm = createViewModelHook(elm, vnode);
|
|
3754
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3862
3755
|
});
|
|
3863
|
-
linkNodeToShadow(elm, owner);
|
|
3756
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3864
3757
|
vnode.elm = elm;
|
|
3865
3758
|
vnode.vm = vm;
|
|
3866
3759
|
if (vm) {
|
|
@@ -3869,23 +3762,23 @@
|
|
|
3869
3762
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3870
3763
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3871
3764
|
}
|
|
3872
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3873
|
-
insertNode(elm, parent, anchor);
|
|
3765
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3766
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3874
3767
|
if (vm) {
|
|
3875
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3876
3769
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3877
3770
|
}
|
|
3878
3771
|
runConnectedCallback(vm);
|
|
3879
3772
|
}
|
|
3880
|
-
mountVNodes(vnode.children, elm, null);
|
|
3773
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3881
3774
|
if (vm) {
|
|
3882
3775
|
appendVM(vm);
|
|
3883
3776
|
}
|
|
3884
3777
|
}
|
|
3885
|
-
function patchCustomElement(n1, n2) {
|
|
3778
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3886
3779
|
const elm = (n2.elm = n1.elm);
|
|
3887
3780
|
const vm = (n2.vm = n1.vm);
|
|
3888
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3781
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3889
3782
|
if (!isUndefined$1(vm)) {
|
|
3890
3783
|
// in fallback mode, the allocation will always set children to
|
|
3891
3784
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3893,33 +3786,38 @@
|
|
|
3893
3786
|
}
|
|
3894
3787
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3895
3788
|
// will happen, but in native, it does allocate the light dom
|
|
3896
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3789
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3897
3790
|
if (!isUndefined$1(vm)) {
|
|
3898
3791
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3899
3792
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3900
3793
|
rerenderVM(vm);
|
|
3901
3794
|
}
|
|
3902
3795
|
}
|
|
3903
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3796
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3904
3797
|
for (; start < end; ++start) {
|
|
3905
3798
|
const vnode = vnodes[start];
|
|
3906
3799
|
if (isVNode(vnode)) {
|
|
3907
|
-
mount(vnode, parent, anchor);
|
|
3800
|
+
mount(vnode, parent, renderer, anchor);
|
|
3908
3801
|
}
|
|
3909
3802
|
}
|
|
3910
3803
|
}
|
|
3911
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3804
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3912
3805
|
const { type, elm, sel } = vnode;
|
|
3913
3806
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3914
3807
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3915
3808
|
if (doRemove) {
|
|
3916
|
-
|
|
3809
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3810
|
+
// but the removal used here is from the owner instead.
|
|
3811
|
+
removeNode(elm, parent, renderer);
|
|
3917
3812
|
}
|
|
3918
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3919
3813
|
switch (type) {
|
|
3920
|
-
case 2 /* Element */:
|
|
3921
|
-
|
|
3814
|
+
case 2 /* Element */: {
|
|
3815
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3816
|
+
// Only required for synthetic shadow.
|
|
3817
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3818
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3922
3819
|
break;
|
|
3820
|
+
}
|
|
3923
3821
|
case 3 /* CustomElement */: {
|
|
3924
3822
|
const { vm } = vnode;
|
|
3925
3823
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -3930,11 +3828,11 @@
|
|
|
3930
3828
|
}
|
|
3931
3829
|
}
|
|
3932
3830
|
}
|
|
3933
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3831
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3934
3832
|
for (; start < end; ++start) {
|
|
3935
3833
|
const ch = vnodes[start];
|
|
3936
3834
|
if (isVNode(ch)) {
|
|
3937
|
-
unmount(ch, parent, doRemove);
|
|
3835
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3938
3836
|
}
|
|
3939
3837
|
}
|
|
3940
3838
|
}
|
|
@@ -3948,66 +3846,71 @@
|
|
|
3948
3846
|
elm.$shadowToken$ = token;
|
|
3949
3847
|
}
|
|
3950
3848
|
// Set the scope token class for *.scoped.css styles
|
|
3951
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3849
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3952
3850
|
const { cmpTemplate, context } = owner;
|
|
3851
|
+
const { getClassList } = renderer;
|
|
3953
3852
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3954
3853
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3955
|
-
|
|
3854
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3855
|
+
// probably we should have a renderer api for just the add operation
|
|
3856
|
+
getClassList(elm).add(token);
|
|
3956
3857
|
}
|
|
3957
3858
|
}
|
|
3958
|
-
function linkNodeToShadow(elm, owner) {
|
|
3859
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3959
3860
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3861
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3960
3862
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3961
|
-
if (isSyntheticShadowDefined
|
|
3863
|
+
if (isSyntheticShadowDefined) {
|
|
3962
3864
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3963
3865
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3964
3866
|
}
|
|
3965
3867
|
}
|
|
3966
3868
|
}
|
|
3967
|
-
function updateTextContent(vnode) {
|
|
3869
|
+
function updateTextContent(vnode, renderer) {
|
|
3968
3870
|
const { elm, text } = vnode;
|
|
3871
|
+
const { setText } = renderer;
|
|
3969
3872
|
if (process.env.NODE_ENV !== 'production') {
|
|
3970
3873
|
unlockDomMutation();
|
|
3971
3874
|
}
|
|
3972
|
-
setText
|
|
3875
|
+
setText(elm, text);
|
|
3973
3876
|
if (process.env.NODE_ENV !== 'production') {
|
|
3974
3877
|
lockDomMutation();
|
|
3975
3878
|
}
|
|
3976
3879
|
}
|
|
3977
|
-
function insertNode(node, parent, anchor) {
|
|
3880
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3978
3881
|
if (process.env.NODE_ENV !== 'production') {
|
|
3979
3882
|
unlockDomMutation();
|
|
3980
3883
|
}
|
|
3981
|
-
insert
|
|
3884
|
+
renderer.insert(node, parent, anchor);
|
|
3982
3885
|
if (process.env.NODE_ENV !== 'production') {
|
|
3983
3886
|
lockDomMutation();
|
|
3984
3887
|
}
|
|
3985
3888
|
}
|
|
3986
|
-
function removeNode(node, parent) {
|
|
3889
|
+
function removeNode(node, parent, renderer) {
|
|
3987
3890
|
if (process.env.NODE_ENV !== 'production') {
|
|
3988
3891
|
unlockDomMutation();
|
|
3989
3892
|
}
|
|
3990
|
-
remove
|
|
3893
|
+
renderer.remove(node, parent);
|
|
3991
3894
|
if (process.env.NODE_ENV !== 'production') {
|
|
3992
3895
|
lockDomMutation();
|
|
3993
3896
|
}
|
|
3994
3897
|
}
|
|
3995
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3898
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3996
3899
|
if (isNull(oldVnode)) {
|
|
3997
|
-
applyEventListeners(vnode);
|
|
3998
|
-
applyStaticClassAttribute(vnode);
|
|
3999
|
-
applyStaticStyleAttribute(vnode);
|
|
3900
|
+
applyEventListeners(vnode, renderer);
|
|
3901
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3902
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4000
3903
|
}
|
|
4001
3904
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4002
3905
|
// value is set before type=radio.
|
|
4003
|
-
patchClassAttribute(oldVnode, vnode);
|
|
4004
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
4005
|
-
patchAttributes(oldVnode, vnode);
|
|
4006
|
-
patchProps(oldVnode, vnode);
|
|
3906
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3907
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3908
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3909
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4007
3910
|
}
|
|
4008
|
-
function fallbackElmHook(elm, vnode) {
|
|
3911
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
4009
3912
|
const { owner } = vnode;
|
|
4010
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3913
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4011
3914
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4012
3915
|
const { data: { context }, } = vnode;
|
|
4013
3916
|
const { stylesheetToken } = owner.context;
|
|
@@ -4055,7 +3958,7 @@
|
|
|
4055
3958
|
vnode.children = EmptyArray;
|
|
4056
3959
|
}
|
|
4057
3960
|
}
|
|
4058
|
-
function createViewModelHook(elm, vnode) {
|
|
3961
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4059
3962
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4060
3963
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4061
3964
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -4064,7 +3967,7 @@
|
|
|
4064
3967
|
return vm;
|
|
4065
3968
|
}
|
|
4066
3969
|
const { sel, mode, ctor, owner } = vnode;
|
|
4067
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3970
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4068
3971
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4069
3972
|
const { stylesheetToken } = owner.context;
|
|
4070
3973
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -4073,7 +3976,7 @@
|
|
|
4073
3976
|
setElementShadowToken(elm, stylesheetToken);
|
|
4074
3977
|
}
|
|
4075
3978
|
}
|
|
4076
|
-
vm = createVM(elm, ctor, {
|
|
3979
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4077
3980
|
mode,
|
|
4078
3981
|
owner,
|
|
4079
3982
|
tagName: sel,
|
|
@@ -4148,7 +4051,7 @@
|
|
|
4148
4051
|
}
|
|
4149
4052
|
return map;
|
|
4150
4053
|
}
|
|
4151
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4054
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4152
4055
|
let oldStartIdx = 0;
|
|
4153
4056
|
let newStartIdx = 0;
|
|
4154
4057
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4177,26 +4080,26 @@
|
|
|
4177
4080
|
newEndVnode = newCh[--newEndIdx];
|
|
4178
4081
|
}
|
|
4179
4082
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4180
|
-
patch(oldStartVnode, newStartVnode);
|
|
4083
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4181
4084
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4182
4085
|
newStartVnode = newCh[++newStartIdx];
|
|
4183
4086
|
}
|
|
4184
4087
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4185
|
-
patch(oldEndVnode, newEndVnode);
|
|
4088
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4186
4089
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4187
4090
|
newEndVnode = newCh[--newEndIdx];
|
|
4188
4091
|
}
|
|
4189
4092
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4190
4093
|
// Vnode moved right
|
|
4191
|
-
patch(oldStartVnode, newEndVnode);
|
|
4192
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4094
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4095
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4193
4096
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4194
4097
|
newEndVnode = newCh[--newEndIdx];
|
|
4195
4098
|
}
|
|
4196
4099
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4197
4100
|
// Vnode moved left
|
|
4198
|
-
patch(oldEndVnode, newStartVnode);
|
|
4199
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4101
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4102
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4200
4103
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4201
4104
|
newStartVnode = newCh[++newStartIdx];
|
|
4202
4105
|
}
|
|
@@ -4207,7 +4110,7 @@
|
|
|
4207
4110
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4208
4111
|
if (isUndefined$1(idxInOld)) {
|
|
4209
4112
|
// New element
|
|
4210
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4113
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4211
4114
|
newStartVnode = newCh[++newStartIdx];
|
|
4212
4115
|
}
|
|
4213
4116
|
else {
|
|
@@ -4215,10 +4118,10 @@
|
|
|
4215
4118
|
if (isVNode(elmToMove)) {
|
|
4216
4119
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4217
4120
|
// New element
|
|
4218
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4121
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4219
4122
|
}
|
|
4220
4123
|
else {
|
|
4221
|
-
patch(elmToMove, newStartVnode);
|
|
4124
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4222
4125
|
// Delete the old child, but copy the array since it is read-only.
|
|
4223
4126
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4224
4127
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4230,7 +4133,7 @@
|
|
|
4230
4133
|
}
|
|
4231
4134
|
// We've already cloned at least once, so it's no longer read-only
|
|
4232
4135
|
oldCh[idxInOld] = undefined;
|
|
4233
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4136
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4234
4137
|
}
|
|
4235
4138
|
}
|
|
4236
4139
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4247,25 +4150,25 @@
|
|
|
4247
4150
|
n = newCh[++i];
|
|
4248
4151
|
} while (!isVNode(n) && i < newChEnd);
|
|
4249
4152
|
before = isVNode(n) ? n.elm : null;
|
|
4250
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4153
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4251
4154
|
}
|
|
4252
4155
|
else {
|
|
4253
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4156
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4254
4157
|
}
|
|
4255
4158
|
}
|
|
4256
4159
|
}
|
|
4257
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4160
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4258
4161
|
const c1Length = c1.length;
|
|
4259
4162
|
const c2Length = c2.length;
|
|
4260
4163
|
if (c1Length === 0) {
|
|
4261
4164
|
// the old list is empty, we can directly insert anything new
|
|
4262
|
-
mountVNodes(c2, parent, null);
|
|
4165
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4263
4166
|
return;
|
|
4264
4167
|
}
|
|
4265
4168
|
if (c2Length === 0) {
|
|
4266
4169
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4267
4170
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4268
|
-
unmountVNodes(c1, parent, true);
|
|
4171
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4269
4172
|
return;
|
|
4270
4173
|
}
|
|
4271
4174
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4278,16 +4181,16 @@
|
|
|
4278
4181
|
if (isVNode(n1)) {
|
|
4279
4182
|
if (isVNode(n2)) {
|
|
4280
4183
|
// both vnodes are equivalent, and we just need to patch them
|
|
4281
|
-
patch(n1, n2);
|
|
4184
|
+
patch(n1, n2, renderer);
|
|
4282
4185
|
anchor = n2.elm;
|
|
4283
4186
|
}
|
|
4284
4187
|
else {
|
|
4285
4188
|
// removing the old vnode since the new one is null
|
|
4286
|
-
unmount(n1, parent, true);
|
|
4189
|
+
unmount(n1, parent, renderer, true);
|
|
4287
4190
|
}
|
|
4288
4191
|
}
|
|
4289
4192
|
else if (isVNode(n2)) {
|
|
4290
|
-
mount(n2, parent, anchor);
|
|
4193
|
+
mount(n2, parent, renderer, anchor);
|
|
4291
4194
|
anchor = n2.elm;
|
|
4292
4195
|
}
|
|
4293
4196
|
}
|
|
@@ -4716,7 +4619,7 @@
|
|
|
4716
4619
|
}, [api.t(content)]);
|
|
4717
4620
|
}
|
|
4718
4621
|
function updateStylesheetToken(vm, template) {
|
|
4719
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4622
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4720
4623
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4721
4624
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4722
4625
|
const { hasScopedStyles } = context;
|
|
@@ -4727,10 +4630,10 @@
|
|
|
4727
4630
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4728
4631
|
if (!isUndefined$1(oldToken)) {
|
|
4729
4632
|
if (oldHasTokenInClass) {
|
|
4730
|
-
getClassList
|
|
4633
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4731
4634
|
}
|
|
4732
4635
|
if (oldHasTokenInAttribute) {
|
|
4733
|
-
removeAttribute
|
|
4636
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4734
4637
|
}
|
|
4735
4638
|
}
|
|
4736
4639
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4741,11 +4644,11 @@
|
|
|
4741
4644
|
// Set the new styling token on the host element
|
|
4742
4645
|
if (!isUndefined$1(newToken)) {
|
|
4743
4646
|
if (hasScopedStyles) {
|
|
4744
|
-
getClassList
|
|
4647
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4745
4648
|
newHasTokenInClass = true;
|
|
4746
4649
|
}
|
|
4747
4650
|
if (isSyntheticShadow) {
|
|
4748
|
-
setAttribute
|
|
4651
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4749
4652
|
newHasTokenInAttribute = true;
|
|
4750
4653
|
}
|
|
4751
4654
|
}
|
|
@@ -4833,13 +4736,13 @@
|
|
|
4833
4736
|
return owner;
|
|
4834
4737
|
}
|
|
4835
4738
|
function createStylesheet(vm, stylesheets) {
|
|
4836
|
-
const { renderMode, shadowMode } = vm;
|
|
4739
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4837
4740
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4838
4741
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4839
|
-
insertStylesheet
|
|
4742
|
+
insertStylesheet(stylesheets[i]);
|
|
4840
4743
|
}
|
|
4841
4744
|
}
|
|
4842
|
-
else if (ssr
|
|
4745
|
+
else if (ssr || vm.hydrated) {
|
|
4843
4746
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4844
4747
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4845
4748
|
// the first time the VM renders.
|
|
@@ -4853,7 +4756,7 @@
|
|
|
4853
4756
|
// null root means a global style
|
|
4854
4757
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4855
4758
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4856
|
-
insertStylesheet
|
|
4759
|
+
insertStylesheet(stylesheets[i], target);
|
|
4857
4760
|
}
|
|
4858
4761
|
}
|
|
4859
4762
|
return null;
|
|
@@ -5395,9 +5298,20 @@
|
|
|
5395
5298
|
|
|
5396
5299
|
resetComponentStateWhenRemoved(vm);
|
|
5397
5300
|
}
|
|
5398
|
-
function createVM(elm, ctor, options) {
|
|
5399
|
-
var _a;
|
|
5400
5301
|
|
|
5302
|
+
function getNearestShadowAncestor(vm) {
|
|
5303
|
+
let ancestor = vm.owner;
|
|
5304
|
+
|
|
5305
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5306
|
+
/* Light */
|
|
5307
|
+
) {
|
|
5308
|
+
ancestor = ancestor.owner;
|
|
5309
|
+
}
|
|
5310
|
+
|
|
5311
|
+
return ancestor;
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5314
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5401
5315
|
const {
|
|
5402
5316
|
mode,
|
|
5403
5317
|
owner,
|
|
@@ -5427,8 +5341,6 @@
|
|
|
5427
5341
|
cmpTemplate: null,
|
|
5428
5342
|
hydrated: Boolean(hydrated),
|
|
5429
5343
|
renderMode: def.renderMode,
|
|
5430
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5431
|
-
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,
|
|
5432
5344
|
context: {
|
|
5433
5345
|
stylesheetToken: undefined,
|
|
5434
5346
|
hasTokenInClass: undefined,
|
|
@@ -5441,14 +5353,17 @@
|
|
|
5441
5353
|
},
|
|
5442
5354
|
// Properties set right after VM creation.
|
|
5443
5355
|
tro: null,
|
|
5356
|
+
shadowMode: null,
|
|
5444
5357
|
// Properties set by the LightningElement constructor.
|
|
5445
5358
|
component: null,
|
|
5446
5359
|
shadowRoot: null,
|
|
5447
5360
|
renderRoot: null,
|
|
5448
5361
|
callHook,
|
|
5449
5362
|
setHook,
|
|
5450
|
-
getHook
|
|
5363
|
+
getHook,
|
|
5364
|
+
renderer
|
|
5451
5365
|
};
|
|
5366
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5452
5367
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5453
5368
|
|
|
5454
5369
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5473,12 +5388,17 @@
|
|
|
5473
5388
|
return vm;
|
|
5474
5389
|
}
|
|
5475
5390
|
|
|
5476
|
-
function computeShadowMode(
|
|
5477
|
-
|
|
5478
|
-
|
|
5391
|
+
function computeShadowMode(vm, renderer) {
|
|
5392
|
+
const {
|
|
5393
|
+
def
|
|
5394
|
+
} = vm;
|
|
5395
|
+
const {
|
|
5396
|
+
isSyntheticShadowDefined,
|
|
5397
|
+
isNativeShadowDefined
|
|
5398
|
+
} = renderer;
|
|
5479
5399
|
let shadowMode;
|
|
5480
5400
|
|
|
5481
|
-
if (isSyntheticShadowDefined
|
|
5401
|
+
if (isSyntheticShadowDefined) {
|
|
5482
5402
|
if (def.renderMode === 0
|
|
5483
5403
|
/* Light */
|
|
5484
5404
|
) {
|
|
@@ -5487,7 +5407,7 @@
|
|
|
5487
5407
|
shadowMode = 0
|
|
5488
5408
|
/* Native */
|
|
5489
5409
|
;
|
|
5490
|
-
} else if (isNativeShadowDefined
|
|
5410
|
+
} else if (isNativeShadowDefined) {
|
|
5491
5411
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5492
5412
|
// the if-condition.
|
|
5493
5413
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5498,13 +5418,23 @@
|
|
|
5498
5418
|
/* Native */
|
|
5499
5419
|
;
|
|
5500
5420
|
} else {
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5421
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5422
|
+
|
|
5423
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5424
|
+
/* Native */
|
|
5425
|
+
) {
|
|
5426
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5427
|
+
// transitively opts all of its descendants into native.
|
|
5428
|
+
shadowMode = 0
|
|
5429
|
+
/* Native */
|
|
5430
|
+
;
|
|
5431
|
+
} else {
|
|
5432
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5433
|
+
// to be native.
|
|
5434
|
+
shadowMode = 1
|
|
5435
|
+
/* Synthetic */
|
|
5436
|
+
;
|
|
5437
|
+
}
|
|
5508
5438
|
}
|
|
5509
5439
|
} else {
|
|
5510
5440
|
shadowMode = 1
|
|
@@ -5567,7 +5497,8 @@
|
|
|
5567
5497
|
function patchShadowRoot(vm, newCh) {
|
|
5568
5498
|
const {
|
|
5569
5499
|
renderRoot,
|
|
5570
|
-
children: oldCh
|
|
5500
|
+
children: oldCh,
|
|
5501
|
+
renderer
|
|
5571
5502
|
} = vm; // caching the new children collection
|
|
5572
5503
|
|
|
5573
5504
|
vm.children = newCh;
|
|
@@ -5583,7 +5514,7 @@
|
|
|
5583
5514
|
, vm);
|
|
5584
5515
|
}, () => {
|
|
5585
5516
|
// job
|
|
5586
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5517
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5587
5518
|
}, () => {
|
|
5588
5519
|
// post
|
|
5589
5520
|
logOperationEnd(2
|
|
@@ -5608,10 +5539,13 @@
|
|
|
5608
5539
|
const {
|
|
5609
5540
|
def: {
|
|
5610
5541
|
renderedCallback
|
|
5542
|
+
},
|
|
5543
|
+
renderer: {
|
|
5544
|
+
ssr
|
|
5611
5545
|
}
|
|
5612
5546
|
} = vm;
|
|
5613
5547
|
|
|
5614
|
-
if (isTrue(ssr
|
|
5548
|
+
if (isTrue(ssr)) {
|
|
5615
5549
|
return;
|
|
5616
5550
|
}
|
|
5617
5551
|
|
|
@@ -5845,14 +5779,17 @@
|
|
|
5845
5779
|
function resetComponentRoot(vm) {
|
|
5846
5780
|
const {
|
|
5847
5781
|
children,
|
|
5848
|
-
renderRoot
|
|
5782
|
+
renderRoot,
|
|
5783
|
+
renderer: {
|
|
5784
|
+
remove
|
|
5785
|
+
}
|
|
5849
5786
|
} = vm;
|
|
5850
5787
|
|
|
5851
5788
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5852
5789
|
const child = children[i];
|
|
5853
5790
|
|
|
5854
5791
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5855
|
-
remove
|
|
5792
|
+
remove(child.elm, renderRoot);
|
|
5856
5793
|
}
|
|
5857
5794
|
}
|
|
5858
5795
|
|
|
@@ -5861,7 +5798,13 @@
|
|
|
5861
5798
|
vm.velements = EmptyArray;
|
|
5862
5799
|
}
|
|
5863
5800
|
function scheduleRehydration(vm) {
|
|
5864
|
-
|
|
5801
|
+
const {
|
|
5802
|
+
renderer: {
|
|
5803
|
+
ssr
|
|
5804
|
+
}
|
|
5805
|
+
} = vm;
|
|
5806
|
+
|
|
5807
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5865
5808
|
return;
|
|
5866
5809
|
}
|
|
5867
5810
|
|
|
@@ -6037,6 +5980,9 @@
|
|
|
6037
5980
|
context: {
|
|
6038
5981
|
wiredConnecting,
|
|
6039
5982
|
wiredDisconnecting
|
|
5983
|
+
},
|
|
5984
|
+
renderer: {
|
|
5985
|
+
dispatchEvent
|
|
6040
5986
|
}
|
|
6041
5987
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
6042
5988
|
|
|
@@ -6060,7 +6006,7 @@
|
|
|
6060
6006
|
}
|
|
6061
6007
|
|
|
6062
6008
|
});
|
|
6063
|
-
dispatchEvent
|
|
6009
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6064
6010
|
});
|
|
6065
6011
|
}
|
|
6066
6012
|
|
|
@@ -6308,95 +6254,105 @@
|
|
|
6308
6254
|
function hydrateVM(vm) {
|
|
6309
6255
|
const children = renderComponent(vm);
|
|
6310
6256
|
vm.children = children;
|
|
6311
|
-
const parentNode = vm
|
|
6312
|
-
hydrateChildren(getFirstChild
|
|
6257
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6258
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6313
6259
|
runRenderedCallback(vm);
|
|
6314
6260
|
}
|
|
6315
|
-
function hydrateNode(node, vnode) {
|
|
6261
|
+
function hydrateNode(node, vnode, renderer) {
|
|
6262
|
+
var _a, _b;
|
|
6316
6263
|
let hydratedNode;
|
|
6317
6264
|
switch (vnode.type) {
|
|
6318
6265
|
case 0 /* Text */:
|
|
6319
|
-
|
|
6266
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
6267
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
6320
6268
|
break;
|
|
6321
6269
|
case 1 /* Comment */:
|
|
6322
|
-
|
|
6270
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
6271
|
+
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
6323
6272
|
break;
|
|
6324
6273
|
case 2 /* Element */:
|
|
6325
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
6274
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
6326
6275
|
break;
|
|
6327
6276
|
case 3 /* CustomElement */:
|
|
6328
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6277
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
6329
6278
|
break;
|
|
6330
6279
|
}
|
|
6331
|
-
return nextSibling
|
|
6280
|
+
return renderer.nextSibling(hydratedNode);
|
|
6332
6281
|
}
|
|
6333
|
-
function hydrateText(node, vnode) {
|
|
6282
|
+
function hydrateText(node, vnode, renderer) {
|
|
6334
6283
|
var _a;
|
|
6335
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
6336
|
-
return handleMismatch(node, vnode);
|
|
6284
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
6285
|
+
return handleMismatch(node, vnode, renderer);
|
|
6337
6286
|
}
|
|
6338
6287
|
if (process.env.NODE_ENV !== 'production') {
|
|
6339
|
-
const
|
|
6288
|
+
const { getProperty } = renderer;
|
|
6289
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6340
6290
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6341
6291
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6342
6292
|
}
|
|
6343
6293
|
}
|
|
6344
|
-
setText
|
|
6294
|
+
const { setText } = renderer;
|
|
6295
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6345
6296
|
vnode.elm = node;
|
|
6346
6297
|
return node;
|
|
6347
6298
|
}
|
|
6348
|
-
function hydrateComment(node, vnode) {
|
|
6299
|
+
function hydrateComment(node, vnode, renderer) {
|
|
6349
6300
|
var _a;
|
|
6350
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
6351
|
-
return handleMismatch(node, vnode);
|
|
6301
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
6302
|
+
return handleMismatch(node, vnode, renderer);
|
|
6352
6303
|
}
|
|
6353
6304
|
if (process.env.NODE_ENV !== 'production') {
|
|
6354
|
-
const
|
|
6305
|
+
const { getProperty } = renderer;
|
|
6306
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6355
6307
|
if (nodeValue !== vnode.text) {
|
|
6356
6308
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6357
6309
|
}
|
|
6358
6310
|
}
|
|
6359
|
-
setProperty
|
|
6311
|
+
const { setProperty } = renderer;
|
|
6312
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6360
6313
|
vnode.elm = node;
|
|
6361
6314
|
return node;
|
|
6362
6315
|
}
|
|
6363
|
-
function hydrateElement(elm, vnode) {
|
|
6364
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6365
|
-
!isMatchingElement(vnode, elm)) {
|
|
6366
|
-
return handleMismatch(elm, vnode);
|
|
6316
|
+
function hydrateElement(elm, vnode, renderer) {
|
|
6317
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6318
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6319
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6367
6320
|
}
|
|
6368
6321
|
vnode.elm = elm;
|
|
6322
|
+
const { owner } = vnode;
|
|
6369
6323
|
const { context } = vnode.data;
|
|
6370
6324
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6371
6325
|
if (isDomManual) {
|
|
6372
6326
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6373
6327
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6374
|
-
const { props } = vnode
|
|
6328
|
+
const { data: { props }, } = vnode;
|
|
6329
|
+
const { getProperty } = renderer;
|
|
6375
6330
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6376
|
-
if (getProperty
|
|
6331
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6377
6332
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6378
6333
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6379
6334
|
}
|
|
6380
6335
|
else {
|
|
6381
6336
|
if (process.env.NODE_ENV !== 'production') {
|
|
6382
|
-
logWarn(`Mismatch hydrating element <${getProperty
|
|
6337
|
+
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
|
|
6383
6338
|
}
|
|
6384
6339
|
}
|
|
6385
6340
|
}
|
|
6386
6341
|
}
|
|
6387
|
-
patchElementPropsAndAttrs(vnode);
|
|
6342
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6388
6343
|
if (!isDomManual) {
|
|
6389
|
-
|
|
6344
|
+
const { getFirstChild } = renderer;
|
|
6345
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6390
6346
|
}
|
|
6391
6347
|
return elm;
|
|
6392
6348
|
}
|
|
6393
|
-
function hydrateCustomElement(elm, vnode) {
|
|
6394
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6395
|
-
!isMatchingElement(vnode, elm)) {
|
|
6396
|
-
return handleMismatch(elm, vnode);
|
|
6349
|
+
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6350
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6351
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6352
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6397
6353
|
}
|
|
6398
6354
|
const { sel, mode, ctor, owner } = vnode;
|
|
6399
|
-
const vm = createVM(elm, ctor, {
|
|
6355
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
6400
6356
|
mode,
|
|
6401
6357
|
owner,
|
|
6402
6358
|
tagName: sel,
|
|
@@ -6405,16 +6361,17 @@
|
|
|
6405
6361
|
vnode.elm = elm;
|
|
6406
6362
|
vnode.vm = vm;
|
|
6407
6363
|
allocateChildren(vnode, vm);
|
|
6408
|
-
patchElementPropsAndAttrs(vnode);
|
|
6364
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6409
6365
|
// Insert hook section:
|
|
6410
6366
|
if (process.env.NODE_ENV !== 'production') {
|
|
6411
6367
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6412
6368
|
}
|
|
6413
6369
|
runConnectedCallback(vm);
|
|
6414
6370
|
if (vm.renderMode !== 0 /* Light */) {
|
|
6371
|
+
const { getFirstChild } = renderer;
|
|
6415
6372
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6416
6373
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6417
|
-
hydrateChildren(getFirstChild
|
|
6374
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6418
6375
|
}
|
|
6419
6376
|
hydrateVM(vm);
|
|
6420
6377
|
return elm;
|
|
@@ -6423,11 +6380,12 @@
|
|
|
6423
6380
|
let hasWarned = false;
|
|
6424
6381
|
let nextNode = node;
|
|
6425
6382
|
let anchor = null;
|
|
6383
|
+
const { renderer } = owner;
|
|
6426
6384
|
for (let i = 0; i < children.length; i++) {
|
|
6427
6385
|
const childVnode = children[i];
|
|
6428
6386
|
if (!isNull(childVnode)) {
|
|
6429
6387
|
if (nextNode) {
|
|
6430
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
6388
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6431
6389
|
anchor = childVnode.elm;
|
|
6432
6390
|
}
|
|
6433
6391
|
else {
|
|
@@ -6438,7 +6396,7 @@
|
|
|
6438
6396
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6439
6397
|
}
|
|
6440
6398
|
}
|
|
6441
|
-
mount(childVnode, parentNode, anchor);
|
|
6399
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
6442
6400
|
anchor = childVnode.elm;
|
|
6443
6401
|
}
|
|
6444
6402
|
}
|
|
@@ -6450,31 +6408,33 @@
|
|
|
6450
6408
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6451
6409
|
}
|
|
6452
6410
|
}
|
|
6411
|
+
// nextSibling is mostly harmless, and since we don't have
|
|
6412
|
+
// a good reference to what element to act upon, we instead
|
|
6413
|
+
// rely on the vm's associated renderer for navigating to the
|
|
6414
|
+
// next node in the list to be hydrated.
|
|
6415
|
+
const { nextSibling } = renderer;
|
|
6453
6416
|
do {
|
|
6454
6417
|
const current = nextNode;
|
|
6455
|
-
nextNode = nextSibling
|
|
6456
|
-
removeNode(current, parentNode);
|
|
6418
|
+
nextNode = nextSibling(nextNode);
|
|
6419
|
+
removeNode(current, parentNode, renderer);
|
|
6457
6420
|
} while (nextNode);
|
|
6458
6421
|
}
|
|
6459
6422
|
}
|
|
6460
|
-
function handleMismatch(node, vnode,
|
|
6423
|
+
function handleMismatch(node, vnode, renderer) {
|
|
6461
6424
|
hasMismatch = true;
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
}
|
|
6467
|
-
const parentNode = getProperty$1(node, 'parentNode');
|
|
6468
|
-
mount(vnode, parentNode, node);
|
|
6469
|
-
removeNode(node, parentNode);
|
|
6425
|
+
const { getProperty } = renderer;
|
|
6426
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
6427
|
+
mount(vnode, parentNode, renderer, node);
|
|
6428
|
+
removeNode(node, parentNode, renderer);
|
|
6470
6429
|
return vnode.elm;
|
|
6471
6430
|
}
|
|
6472
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6473
|
-
applyEventListeners(vnode);
|
|
6474
|
-
patchProps(null, vnode);
|
|
6431
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
6432
|
+
applyEventListeners(vnode, renderer);
|
|
6433
|
+
patchProps(null, vnode, renderer);
|
|
6475
6434
|
}
|
|
6476
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6477
|
-
|
|
6435
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
6436
|
+
const { getProperty } = renderer;
|
|
6437
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
6478
6438
|
if (process.env.NODE_ENV !== 'production') {
|
|
6479
6439
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6480
6440
|
}
|
|
@@ -6482,46 +6442,51 @@
|
|
|
6482
6442
|
}
|
|
6483
6443
|
return true;
|
|
6484
6444
|
}
|
|
6485
|
-
function isMatchingElement(vnode, elm) {
|
|
6486
|
-
|
|
6445
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
6446
|
+
const { getProperty } = renderer;
|
|
6447
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6487
6448
|
if (process.env.NODE_ENV !== 'production') {
|
|
6488
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty
|
|
6449
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6489
6450
|
}
|
|
6490
6451
|
return false;
|
|
6491
6452
|
}
|
|
6492
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6493
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6494
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6453
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
|
|
6454
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
|
|
6455
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
|
|
6495
6456
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6496
6457
|
}
|
|
6497
|
-
function validateAttrs(vnode, elm) {
|
|
6458
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
6498
6459
|
const { data: { attrs = {} }, } = vnode;
|
|
6499
6460
|
let nodesAreCompatible = true;
|
|
6500
6461
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6501
6462
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6502
6463
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6503
|
-
const
|
|
6464
|
+
const { owner } = vnode;
|
|
6465
|
+
const { getAttribute } = renderer;
|
|
6466
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
6504
6467
|
if (String(attrValue) !== elmAttrValue) {
|
|
6505
6468
|
if (process.env.NODE_ENV !== 'production') {
|
|
6506
|
-
|
|
6469
|
+
const { getProperty } = renderer;
|
|
6470
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
6507
6471
|
}
|
|
6508
6472
|
nodesAreCompatible = false;
|
|
6509
6473
|
}
|
|
6510
6474
|
}
|
|
6511
6475
|
return nodesAreCompatible;
|
|
6512
6476
|
}
|
|
6513
|
-
function validateClassAttr(vnode, elm) {
|
|
6477
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
6514
6478
|
const { data: { className, classMap }, } = vnode;
|
|
6479
|
+
const { getProperty, getClassList } = renderer;
|
|
6515
6480
|
let nodesAreCompatible = true;
|
|
6516
6481
|
let vnodeClassName;
|
|
6517
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
6482
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
6518
6483
|
// className is used when class is bound to an expr.
|
|
6519
6484
|
nodesAreCompatible = false;
|
|
6520
6485
|
vnodeClassName = className;
|
|
6521
6486
|
}
|
|
6522
6487
|
else if (!isUndefined$1(classMap)) {
|
|
6523
6488
|
// classMap is used when class is set to static value.
|
|
6524
|
-
const classList = getClassList
|
|
6489
|
+
const classList = getClassList(elm);
|
|
6525
6490
|
let computedClassName = '';
|
|
6526
6491
|
// all classes from the vnode should be in the element.classList
|
|
6527
6492
|
for (const name in classMap) {
|
|
@@ -6537,14 +6502,15 @@
|
|
|
6537
6502
|
}
|
|
6538
6503
|
if (!nodesAreCompatible) {
|
|
6539
6504
|
if (process.env.NODE_ENV !== 'production') {
|
|
6540
|
-
logError(`Mismatch hydrating element <${getProperty
|
|
6505
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
|
|
6541
6506
|
}
|
|
6542
6507
|
}
|
|
6543
6508
|
return nodesAreCompatible;
|
|
6544
6509
|
}
|
|
6545
|
-
function validateStyleAttr(vnode, elm) {
|
|
6510
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
6546
6511
|
const { data: { style, styleDecls }, } = vnode;
|
|
6547
|
-
const
|
|
6512
|
+
const { getAttribute } = renderer;
|
|
6513
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
6548
6514
|
let vnodeStyle;
|
|
6549
6515
|
let nodesAreCompatible = true;
|
|
6550
6516
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
@@ -6576,7 +6542,8 @@
|
|
|
6576
6542
|
}
|
|
6577
6543
|
if (!nodesAreCompatible) {
|
|
6578
6544
|
if (process.env.NODE_ENV !== 'production') {
|
|
6579
|
-
|
|
6545
|
+
const { getProperty } = renderer;
|
|
6546
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6580
6547
|
}
|
|
6581
6548
|
}
|
|
6582
6549
|
return nodesAreCompatible;
|
|
@@ -6716,7 +6683,7 @@
|
|
|
6716
6683
|
}
|
|
6717
6684
|
return ctor;
|
|
6718
6685
|
}
|
|
6719
|
-
/* version: 2.
|
|
6686
|
+
/* version: 2.14.2 */
|
|
6720
6687
|
|
|
6721
6688
|
/*
|
|
6722
6689
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6875,7 +6842,7 @@
|
|
|
6875
6842
|
try {
|
|
6876
6843
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6877
6844
|
// _wrapNativeSuper()
|
|
6878
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
6845
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6879
6846
|
// get wrapped by babel.
|
|
6880
6847
|
const HTMLElementAlias = HTMLElement;
|
|
6881
6848
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -6929,6 +6896,9 @@
|
|
|
6929
6896
|
hydrating = value;
|
|
6930
6897
|
}
|
|
6931
6898
|
const ssr = false;
|
|
6899
|
+
function isHydrating() {
|
|
6900
|
+
return hydrating;
|
|
6901
|
+
}
|
|
6932
6902
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6933
6903
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6934
6904
|
function createElement$1(tagName, namespace) {
|
|
@@ -7047,76 +7017,47 @@
|
|
|
7047
7017
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7048
7018
|
}
|
|
7049
7019
|
const HTMLElementExported = HTMLElementConstructor;
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
setSetText(setText);
|
|
7092
|
-
setSsr(ssr);
|
|
7093
|
-
setAddEventListener(addEventListener);
|
|
7094
|
-
setInsertStylesheet(insertStylesheet);
|
|
7095
|
-
|
|
7096
|
-
/*
|
|
7097
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7098
|
-
* All rights reserved.
|
|
7099
|
-
* SPDX-License-Identifier: MIT
|
|
7100
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7101
|
-
*/
|
|
7102
|
-
// @ts-ignore
|
|
7103
|
-
|
|
7104
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7105
|
-
window.addEventListener('test-dummy-flag', () => {
|
|
7106
|
-
let hasFlag = false;
|
|
7107
|
-
|
|
7108
|
-
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7109
|
-
hasFlag = true;
|
|
7110
|
-
}
|
|
7111
|
-
|
|
7112
|
-
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7113
|
-
detail: {
|
|
7114
|
-
package: '@lwc/engine-dom',
|
|
7115
|
-
hasFlag
|
|
7116
|
-
}
|
|
7117
|
-
}));
|
|
7118
|
-
});
|
|
7119
|
-
}
|
|
7020
|
+
const renderer = {
|
|
7021
|
+
ssr,
|
|
7022
|
+
isNativeShadowDefined,
|
|
7023
|
+
isSyntheticShadowDefined,
|
|
7024
|
+
HTMLElementExported,
|
|
7025
|
+
isHydrating,
|
|
7026
|
+
insert,
|
|
7027
|
+
remove,
|
|
7028
|
+
createElement: createElement$1,
|
|
7029
|
+
createText,
|
|
7030
|
+
createComment,
|
|
7031
|
+
nextSibling,
|
|
7032
|
+
attachShadow,
|
|
7033
|
+
getProperty,
|
|
7034
|
+
setProperty,
|
|
7035
|
+
setText,
|
|
7036
|
+
getAttribute,
|
|
7037
|
+
setAttribute,
|
|
7038
|
+
removeAttribute,
|
|
7039
|
+
addEventListener,
|
|
7040
|
+
removeEventListener,
|
|
7041
|
+
dispatchEvent,
|
|
7042
|
+
getClassList,
|
|
7043
|
+
setCSSStyleProperty,
|
|
7044
|
+
getBoundingClientRect,
|
|
7045
|
+
querySelector,
|
|
7046
|
+
querySelectorAll,
|
|
7047
|
+
getElementsByTagName,
|
|
7048
|
+
getElementsByClassName,
|
|
7049
|
+
getChildren,
|
|
7050
|
+
getChildNodes,
|
|
7051
|
+
getFirstChild,
|
|
7052
|
+
getFirstElementChild,
|
|
7053
|
+
getLastChild,
|
|
7054
|
+
getLastElementChild,
|
|
7055
|
+
isConnected,
|
|
7056
|
+
insertStylesheet,
|
|
7057
|
+
assertInstanceOfHTMLElement,
|
|
7058
|
+
defineCustomElement,
|
|
7059
|
+
getCustomElement,
|
|
7060
|
+
};
|
|
7120
7061
|
|
|
7121
7062
|
/*
|
|
7122
7063
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7138,7 +7079,7 @@
|
|
|
7138
7079
|
}
|
|
7139
7080
|
}
|
|
7140
7081
|
function createVMWithProps(element, Ctor, props) {
|
|
7141
|
-
const vm = createVM(element, Ctor, {
|
|
7082
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
7142
7083
|
mode: 'open',
|
|
7143
7084
|
owner: null,
|
|
7144
7085
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -7234,7 +7175,7 @@
|
|
|
7234
7175
|
hydratedCustomElements.add(this);
|
|
7235
7176
|
}
|
|
7236
7177
|
else {
|
|
7237
|
-
createVM(this, Ctor, {
|
|
7178
|
+
createVM(this, Ctor, renderer, {
|
|
7238
7179
|
mode: 'open',
|
|
7239
7180
|
owner: null,
|
|
7240
7181
|
tagName: this.tagName,
|
|
@@ -7319,7 +7260,7 @@
|
|
|
7319
7260
|
if (!isFunction$1(Ctor)) {
|
|
7320
7261
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7321
7262
|
}
|
|
7322
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
7263
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7323
7264
|
let wasComponentUpgraded = false;
|
|
7324
7265
|
// the custom element from the registry is expecting an upgrade callback
|
|
7325
7266
|
/**
|
|
@@ -7329,7 +7270,7 @@
|
|
|
7329
7270
|
* an upgradable custom element.
|
|
7330
7271
|
*/
|
|
7331
7272
|
const element = new UpgradableConstructor((elm) => {
|
|
7332
|
-
createVM(elm, Ctor, {
|
|
7273
|
+
createVM(elm, Ctor, renderer, {
|
|
7333
7274
|
tagName: sel,
|
|
7334
7275
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7335
7276
|
owner: null,
|
|
@@ -7413,7 +7354,7 @@
|
|
|
7413
7354
|
});
|
|
7414
7355
|
freeze(LightningElement);
|
|
7415
7356
|
seal(LightningElement.prototype);
|
|
7416
|
-
/* version: 2.
|
|
7357
|
+
/* version: 2.14.2 */
|
|
7417
7358
|
|
|
7418
7359
|
exports.LightningElement = LightningElement;
|
|
7419
7360
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7432,6 +7373,7 @@
|
|
|
7432
7373
|
exports.registerComponent = registerComponent;
|
|
7433
7374
|
exports.registerDecorators = registerDecorators;
|
|
7434
7375
|
exports.registerTemplate = registerTemplate;
|
|
7376
|
+
exports.renderer = renderer;
|
|
7435
7377
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7436
7378
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7437
7379
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|