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
|
@@ -421,9 +421,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
421
421
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
422
422
|
*/
|
|
423
423
|
// Increment whenever the LWC template compiler changes
|
|
424
|
-
const LWC_VERSION = "2.
|
|
424
|
+
const LWC_VERSION = "2.14.2";
|
|
425
425
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
426
|
-
/** version: 2.
|
|
426
|
+
/** version: 2.14.2 */
|
|
427
427
|
|
|
428
428
|
/*
|
|
429
429
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -532,7 +532,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
532
532
|
setFeatureFlag(name, value);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
/** version: 2.
|
|
535
|
+
/** version: 2.14.2 */
|
|
536
536
|
|
|
537
537
|
/* proxy-compat-disable */
|
|
538
538
|
|
|
@@ -615,162 +615,6 @@ function flattenStylesheets(stylesheets) {
|
|
|
615
615
|
return list;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
//
|
|
619
|
-
// Primitives
|
|
620
|
-
//
|
|
621
|
-
let ssr$1;
|
|
622
|
-
function setSsr(ssrImpl) {
|
|
623
|
-
ssr$1 = ssrImpl;
|
|
624
|
-
}
|
|
625
|
-
let isNativeShadowDefined$1;
|
|
626
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
627
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
628
|
-
}
|
|
629
|
-
let isSyntheticShadowDefined$1;
|
|
630
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
631
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
632
|
-
}
|
|
633
|
-
let HTMLElementExported$1;
|
|
634
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
635
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
636
|
-
}
|
|
637
|
-
let insert$1;
|
|
638
|
-
function setInsert(insertImpl) {
|
|
639
|
-
insert$1 = insertImpl;
|
|
640
|
-
}
|
|
641
|
-
let remove$1;
|
|
642
|
-
function setRemove(removeImpl) {
|
|
643
|
-
remove$1 = removeImpl;
|
|
644
|
-
}
|
|
645
|
-
let createElement$1;
|
|
646
|
-
function setCreateElement(createElementImpl) {
|
|
647
|
-
createElement$1 = createElementImpl;
|
|
648
|
-
}
|
|
649
|
-
let createText$1;
|
|
650
|
-
function setCreateText(createTextImpl) {
|
|
651
|
-
createText$1 = createTextImpl;
|
|
652
|
-
}
|
|
653
|
-
let createComment$1;
|
|
654
|
-
function setCreateComment(createCommentImpl) {
|
|
655
|
-
createComment$1 = createCommentImpl;
|
|
656
|
-
}
|
|
657
|
-
let nextSibling$1;
|
|
658
|
-
function setNextSibling(nextSiblingImpl) {
|
|
659
|
-
nextSibling$1 = nextSiblingImpl;
|
|
660
|
-
}
|
|
661
|
-
let attachShadow$1;
|
|
662
|
-
function setAttachShadow(attachShadowImpl) {
|
|
663
|
-
attachShadow$1 = attachShadowImpl;
|
|
664
|
-
}
|
|
665
|
-
let getProperty$1;
|
|
666
|
-
function setGetProperty(getPropertyImpl) {
|
|
667
|
-
getProperty$1 = getPropertyImpl;
|
|
668
|
-
}
|
|
669
|
-
let setProperty$1;
|
|
670
|
-
function setSetProperty(setPropertyImpl) {
|
|
671
|
-
setProperty$1 = setPropertyImpl;
|
|
672
|
-
}
|
|
673
|
-
let setText$1;
|
|
674
|
-
function setSetText(setTextImpl) {
|
|
675
|
-
setText$1 = setTextImpl;
|
|
676
|
-
}
|
|
677
|
-
let getAttribute$1;
|
|
678
|
-
function setGetAttribute(getAttributeImpl) {
|
|
679
|
-
getAttribute$1 = getAttributeImpl;
|
|
680
|
-
}
|
|
681
|
-
let setAttribute$1;
|
|
682
|
-
function setSetAttribute(setAttributeImpl) {
|
|
683
|
-
setAttribute$1 = setAttributeImpl;
|
|
684
|
-
}
|
|
685
|
-
let removeAttribute$1;
|
|
686
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
687
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
688
|
-
}
|
|
689
|
-
let addEventListener$1;
|
|
690
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
691
|
-
addEventListener$1 = addEventListenerImpl;
|
|
692
|
-
}
|
|
693
|
-
let removeEventListener$1;
|
|
694
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
695
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
696
|
-
}
|
|
697
|
-
let dispatchEvent$1;
|
|
698
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
699
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
700
|
-
}
|
|
701
|
-
let getClassList$1;
|
|
702
|
-
function setGetClassList(getClassListImpl) {
|
|
703
|
-
getClassList$1 = getClassListImpl;
|
|
704
|
-
}
|
|
705
|
-
let setCSSStyleProperty$1;
|
|
706
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
707
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
708
|
-
}
|
|
709
|
-
let getBoundingClientRect$1;
|
|
710
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
711
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
712
|
-
}
|
|
713
|
-
let querySelector$1;
|
|
714
|
-
function setQuerySelector(querySelectorImpl) {
|
|
715
|
-
querySelector$1 = querySelectorImpl;
|
|
716
|
-
}
|
|
717
|
-
let querySelectorAll$1;
|
|
718
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
719
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
720
|
-
}
|
|
721
|
-
let getElementsByTagName$1;
|
|
722
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
723
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
724
|
-
}
|
|
725
|
-
let getElementsByClassName$1;
|
|
726
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
727
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
728
|
-
}
|
|
729
|
-
let getChildren$1;
|
|
730
|
-
function setGetChildren(getChildrenImpl) {
|
|
731
|
-
getChildren$1 = getChildrenImpl;
|
|
732
|
-
}
|
|
733
|
-
let getChildNodes$1;
|
|
734
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
735
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
736
|
-
}
|
|
737
|
-
let getFirstChild$1;
|
|
738
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
739
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
740
|
-
}
|
|
741
|
-
let getFirstElementChild$1;
|
|
742
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
743
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
744
|
-
}
|
|
745
|
-
let getLastChild$1;
|
|
746
|
-
function setGetLastChild(getLastChildImpl) {
|
|
747
|
-
getLastChild$1 = getLastChildImpl;
|
|
748
|
-
}
|
|
749
|
-
let getLastElementChild$1;
|
|
750
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
751
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
752
|
-
}
|
|
753
|
-
let isConnected$1;
|
|
754
|
-
function setIsConnected(isConnectedImpl) {
|
|
755
|
-
isConnected$1 = isConnectedImpl;
|
|
756
|
-
}
|
|
757
|
-
let insertStylesheet$1;
|
|
758
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
759
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
760
|
-
}
|
|
761
|
-
let assertInstanceOfHTMLElement$1;
|
|
762
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
763
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
764
|
-
}
|
|
765
|
-
let defineCustomElement$1;
|
|
766
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
767
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
768
|
-
}
|
|
769
|
-
let getCustomElement$1;
|
|
770
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
771
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
618
|
/*
|
|
775
619
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
776
620
|
* All rights reserved.
|
|
@@ -2072,7 +1916,8 @@ const LightningElement = function () {
|
|
|
2072
1916
|
const { def, elm } = vm;
|
|
2073
1917
|
const { bridge } = def;
|
|
2074
1918
|
if (process.env.NODE_ENV !== 'production') {
|
|
2075
|
-
|
|
1919
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1920
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2076
1921
|
}
|
|
2077
1922
|
const component = this;
|
|
2078
1923
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2106,8 +1951,8 @@ const LightningElement = function () {
|
|
|
2106
1951
|
return this;
|
|
2107
1952
|
};
|
|
2108
1953
|
function doAttachShadow(vm) {
|
|
2109
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2110
|
-
const shadowRoot = attachShadow
|
|
1954
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1955
|
+
const shadowRoot = attachShadow(elm, {
|
|
2111
1956
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2112
1957
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2113
1958
|
mode,
|
|
@@ -2128,12 +1973,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
2128
1973
|
LightningElement.prototype = {
|
|
2129
1974
|
constructor: LightningElement,
|
|
2130
1975
|
dispatchEvent(event) {
|
|
2131
|
-
const
|
|
2132
|
-
|
|
1976
|
+
const vm = getAssociatedVM(this);
|
|
1977
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1978
|
+
return dispatchEvent(elm, event);
|
|
2133
1979
|
},
|
|
2134
1980
|
addEventListener(type, listener, options) {
|
|
2135
1981
|
const vm = getAssociatedVM(this);
|
|
2136
|
-
const { elm } = vm;
|
|
1982
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2137
1983
|
if (process.env.NODE_ENV !== 'production') {
|
|
2138
1984
|
const vmBeingRendered = getVMBeingRendered();
|
|
2139
1985
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2141,83 +1987,91 @@ LightningElement.prototype = {
|
|
|
2141
1987
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2142
1988
|
}
|
|
2143
1989
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2144
|
-
addEventListener
|
|
1990
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2145
1991
|
},
|
|
2146
1992
|
removeEventListener(type, listener, options) {
|
|
2147
1993
|
const vm = getAssociatedVM(this);
|
|
2148
|
-
const { elm } = vm;
|
|
1994
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2149
1995
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2150
|
-
removeEventListener
|
|
1996
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2151
1997
|
},
|
|
2152
1998
|
hasAttribute(name) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
1999
|
+
const vm = getAssociatedVM(this);
|
|
2000
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2001
|
+
return !isNull(getAttribute(elm, name));
|
|
2155
2002
|
},
|
|
2156
2003
|
hasAttributeNS(namespace, name) {
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2004
|
+
const vm = getAssociatedVM(this);
|
|
2005
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2006
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2159
2007
|
},
|
|
2160
2008
|
removeAttribute(name) {
|
|
2161
|
-
const
|
|
2009
|
+
const vm = getAssociatedVM(this);
|
|
2010
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2162
2011
|
unlockAttribute(elm, name);
|
|
2163
|
-
removeAttribute
|
|
2012
|
+
removeAttribute(elm, name);
|
|
2164
2013
|
lockAttribute();
|
|
2165
2014
|
},
|
|
2166
2015
|
removeAttributeNS(namespace, name) {
|
|
2167
|
-
const { elm } = getAssociatedVM(this);
|
|
2016
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2168
2017
|
unlockAttribute(elm, name);
|
|
2169
|
-
removeAttribute
|
|
2018
|
+
removeAttribute(elm, name, namespace);
|
|
2170
2019
|
lockAttribute();
|
|
2171
2020
|
},
|
|
2172
2021
|
getAttribute(name) {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2022
|
+
const vm = getAssociatedVM(this);
|
|
2023
|
+
const { elm } = vm;
|
|
2024
|
+
const { getAttribute } = vm.renderer;
|
|
2025
|
+
return getAttribute(elm, name);
|
|
2175
2026
|
},
|
|
2176
2027
|
getAttributeNS(namespace, name) {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2028
|
+
const vm = getAssociatedVM(this);
|
|
2029
|
+
const { elm } = vm;
|
|
2030
|
+
const { getAttribute } = vm.renderer;
|
|
2031
|
+
return getAttribute(elm, name, namespace);
|
|
2179
2032
|
},
|
|
2180
2033
|
setAttribute(name, value) {
|
|
2181
2034
|
const vm = getAssociatedVM(this);
|
|
2182
|
-
const { elm } = vm;
|
|
2035
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2183
2036
|
if (process.env.NODE_ENV !== 'production') {
|
|
2184
2037
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2185
2038
|
}
|
|
2186
2039
|
unlockAttribute(elm, name);
|
|
2187
|
-
setAttribute
|
|
2040
|
+
setAttribute(elm, name, value);
|
|
2188
2041
|
lockAttribute();
|
|
2189
2042
|
},
|
|
2190
2043
|
setAttributeNS(namespace, name, value) {
|
|
2191
2044
|
const vm = getAssociatedVM(this);
|
|
2192
|
-
const { elm } = vm;
|
|
2045
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2193
2046
|
if (process.env.NODE_ENV !== 'production') {
|
|
2194
2047
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2195
2048
|
}
|
|
2196
2049
|
unlockAttribute(elm, name);
|
|
2197
|
-
setAttribute
|
|
2050
|
+
setAttribute(elm, name, value, namespace);
|
|
2198
2051
|
lockAttribute();
|
|
2199
2052
|
},
|
|
2200
2053
|
getBoundingClientRect() {
|
|
2201
2054
|
const vm = getAssociatedVM(this);
|
|
2202
|
-
const { elm } = vm;
|
|
2055
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2203
2056
|
if (process.env.NODE_ENV !== 'production') {
|
|
2204
2057
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2205
2058
|
}
|
|
2206
|
-
return getBoundingClientRect
|
|
2059
|
+
return getBoundingClientRect(elm);
|
|
2207
2060
|
},
|
|
2208
2061
|
get isConnected() {
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2062
|
+
const vm = getAssociatedVM(this);
|
|
2063
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2064
|
+
return isConnected(elm);
|
|
2211
2065
|
},
|
|
2212
2066
|
get classList() {
|
|
2213
2067
|
const vm = getAssociatedVM(this);
|
|
2214
|
-
const { elm } = vm;
|
|
2068
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2215
2069
|
if (process.env.NODE_ENV !== 'production') {
|
|
2216
2070
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2217
2071
|
// just throw in all modes
|
|
2218
2072
|
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.`);
|
|
2219
2073
|
}
|
|
2220
|
-
return getClassList
|
|
2074
|
+
return getClassList(elm);
|
|
2221
2075
|
},
|
|
2222
2076
|
get template() {
|
|
2223
2077
|
const vm = getAssociatedVM(this);
|
|
@@ -2233,6 +2087,54 @@ LightningElement.prototype = {
|
|
|
2233
2087
|
// Authors should rely on this.template instead.
|
|
2234
2088
|
return null;
|
|
2235
2089
|
},
|
|
2090
|
+
get children() {
|
|
2091
|
+
const vm = getAssociatedVM(this);
|
|
2092
|
+
const renderer = vm.renderer;
|
|
2093
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2094
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2095
|
+
}
|
|
2096
|
+
return renderer.getChildren(vm.elm);
|
|
2097
|
+
},
|
|
2098
|
+
get childNodes() {
|
|
2099
|
+
const vm = getAssociatedVM(this);
|
|
2100
|
+
const renderer = vm.renderer;
|
|
2101
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2102
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2103
|
+
}
|
|
2104
|
+
return renderer.getChildNodes(vm.elm);
|
|
2105
|
+
},
|
|
2106
|
+
get firstChild() {
|
|
2107
|
+
const vm = getAssociatedVM(this);
|
|
2108
|
+
const renderer = vm.renderer;
|
|
2109
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2110
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2111
|
+
}
|
|
2112
|
+
return renderer.getFirstChild(vm.elm);
|
|
2113
|
+
},
|
|
2114
|
+
get firstElementChild() {
|
|
2115
|
+
const vm = getAssociatedVM(this);
|
|
2116
|
+
const renderer = vm.renderer;
|
|
2117
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2118
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2119
|
+
}
|
|
2120
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2121
|
+
},
|
|
2122
|
+
get lastChild() {
|
|
2123
|
+
const vm = getAssociatedVM(this);
|
|
2124
|
+
const renderer = vm.renderer;
|
|
2125
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2126
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2127
|
+
}
|
|
2128
|
+
return renderer.getLastChild(vm.elm);
|
|
2129
|
+
},
|
|
2130
|
+
get lastElementChild() {
|
|
2131
|
+
const vm = getAssociatedVM(this);
|
|
2132
|
+
const renderer = vm.renderer;
|
|
2133
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2134
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2135
|
+
}
|
|
2136
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2137
|
+
},
|
|
2236
2138
|
render() {
|
|
2237
2139
|
const vm = getAssociatedVM(this);
|
|
2238
2140
|
return vm.def.template;
|
|
@@ -2243,76 +2145,22 @@ LightningElement.prototype = {
|
|
|
2243
2145
|
},
|
|
2244
2146
|
};
|
|
2245
2147
|
const queryAndChildGetterDescriptors = create(null);
|
|
2246
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2247
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2248
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2249
|
-
const childGetters = [
|
|
2250
|
-
'children',
|
|
2251
|
-
'childNodes',
|
|
2252
|
-
'firstChild',
|
|
2253
|
-
'firstElementChild',
|
|
2254
|
-
'lastChild',
|
|
2255
|
-
'lastElementChild',
|
|
2256
|
-
];
|
|
2257
|
-
function getChildGetter(methodName) {
|
|
2258
|
-
switch (methodName) {
|
|
2259
|
-
case 'children':
|
|
2260
|
-
return getChildren$1;
|
|
2261
|
-
case 'childNodes':
|
|
2262
|
-
return getChildNodes$1;
|
|
2263
|
-
case 'firstChild':
|
|
2264
|
-
return getFirstChild$1;
|
|
2265
|
-
case 'firstElementChild':
|
|
2266
|
-
return getFirstElementChild$1;
|
|
2267
|
-
case 'lastChild':
|
|
2268
|
-
return getLastChild$1;
|
|
2269
|
-
case 'lastElementChild':
|
|
2270
|
-
return getLastElementChild$1;
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2274
|
-
for (const childGetter of childGetters) {
|
|
2275
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2276
|
-
get() {
|
|
2277
|
-
const vm = getAssociatedVM(this);
|
|
2278
|
-
const { elm } = vm;
|
|
2279
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2280
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2281
|
-
}
|
|
2282
|
-
return getChildGetter(childGetter)(elm);
|
|
2283
|
-
},
|
|
2284
|
-
configurable: true,
|
|
2285
|
-
enumerable: true,
|
|
2286
|
-
};
|
|
2287
|
-
}
|
|
2288
2148
|
const queryMethods = [
|
|
2289
2149
|
'getElementsByClassName',
|
|
2290
2150
|
'getElementsByTagName',
|
|
2291
2151
|
'querySelector',
|
|
2292
2152
|
'querySelectorAll',
|
|
2293
2153
|
];
|
|
2294
|
-
function getQueryMethod(methodName) {
|
|
2295
|
-
switch (methodName) {
|
|
2296
|
-
case 'getElementsByClassName':
|
|
2297
|
-
return getElementsByClassName$1;
|
|
2298
|
-
case 'getElementsByTagName':
|
|
2299
|
-
return getElementsByTagName$1;
|
|
2300
|
-
case 'querySelector':
|
|
2301
|
-
return querySelector$1;
|
|
2302
|
-
case 'querySelectorAll':
|
|
2303
|
-
return querySelectorAll$1;
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
2154
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2307
2155
|
for (const queryMethod of queryMethods) {
|
|
2308
2156
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2309
2157
|
value(arg) {
|
|
2310
2158
|
const vm = getAssociatedVM(this);
|
|
2311
|
-
const { elm } = vm;
|
|
2159
|
+
const { elm, renderer } = vm;
|
|
2312
2160
|
if (process.env.NODE_ENV !== 'production') {
|
|
2313
2161
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2314
2162
|
}
|
|
2315
|
-
return
|
|
2163
|
+
return renderer[queryMethod](elm, arg);
|
|
2316
2164
|
},
|
|
2317
2165
|
configurable: true,
|
|
2318
2166
|
enumerable: true,
|
|
@@ -2817,7 +2665,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2817
2665
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2818
2666
|
*/
|
|
2819
2667
|
let warned = false;
|
|
2820
|
-
|
|
2668
|
+
// @ts-ignore
|
|
2669
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2821
2670
|
// @ts-ignore
|
|
2822
2671
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2823
2672
|
warned = false;
|
|
@@ -3414,12 +3263,13 @@ function getComponentDef(Ctor) {
|
|
|
3414
3263
|
* SPDX-License-Identifier: MIT
|
|
3415
3264
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3416
3265
|
*/
|
|
3417
|
-
function getUpgradableConstructor(tagName) {
|
|
3266
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3267
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3418
3268
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3419
3269
|
// produce only tags with lowercase letters
|
|
3420
3270
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3421
3271
|
tagName = tagName.toLowerCase();
|
|
3422
|
-
let CE = getCustomElement
|
|
3272
|
+
let CE = getCustomElement(tagName);
|
|
3423
3273
|
if (!isUndefined$1(CE)) {
|
|
3424
3274
|
return CE;
|
|
3425
3275
|
}
|
|
@@ -3427,7 +3277,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3427
3277
|
* LWC Upgradable Element reference to an element that was created
|
|
3428
3278
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3429
3279
|
*/
|
|
3430
|
-
CE = class LWCUpgradableElement extends
|
|
3280
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3431
3281
|
constructor(upgradeCallback) {
|
|
3432
3282
|
super();
|
|
3433
3283
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3435,7 +3285,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3435
3285
|
}
|
|
3436
3286
|
}
|
|
3437
3287
|
};
|
|
3438
|
-
defineCustomElement
|
|
3288
|
+
defineCustomElement(tagName, CE);
|
|
3439
3289
|
return CE;
|
|
3440
3290
|
}
|
|
3441
3291
|
|
|
@@ -3460,7 +3310,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3460
3310
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3461
3311
|
*/
|
|
3462
3312
|
const ColonCharCode = 58;
|
|
3463
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3313
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3464
3314
|
const { attrs } = vnode.data;
|
|
3465
3315
|
if (isUndefined$1(attrs)) {
|
|
3466
3316
|
return;
|
|
@@ -3470,6 +3320,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3470
3320
|
return;
|
|
3471
3321
|
}
|
|
3472
3322
|
const { elm } = vnode;
|
|
3323
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3473
3324
|
for (const key in attrs) {
|
|
3474
3325
|
const cur = attrs[key];
|
|
3475
3326
|
const old = oldAttrs[key];
|
|
@@ -3477,17 +3328,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3477
3328
|
unlockAttribute(elm, key);
|
|
3478
3329
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3479
3330
|
// Assume xml namespace
|
|
3480
|
-
setAttribute
|
|
3331
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3481
3332
|
}
|
|
3482
3333
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3483
3334
|
// Assume xlink namespace
|
|
3484
|
-
setAttribute
|
|
3335
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3485
3336
|
}
|
|
3486
3337
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3487
|
-
removeAttribute
|
|
3338
|
+
removeAttribute(elm, key);
|
|
3488
3339
|
}
|
|
3489
3340
|
else {
|
|
3490
|
-
setAttribute
|
|
3341
|
+
setAttribute(elm, key, cur);
|
|
3491
3342
|
}
|
|
3492
3343
|
lockAttribute();
|
|
3493
3344
|
}
|
|
@@ -3505,7 +3356,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3505
3356
|
// instead of relying on internally tracked values.
|
|
3506
3357
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3507
3358
|
}
|
|
3508
|
-
function patchProps(oldVnode, vnode) {
|
|
3359
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3509
3360
|
const { props } = vnode.data;
|
|
3510
3361
|
if (isUndefined$1(props)) {
|
|
3511
3362
|
return;
|
|
@@ -3516,13 +3367,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3516
3367
|
}
|
|
3517
3368
|
const isFirstPatch = isNull(oldVnode);
|
|
3518
3369
|
const { elm, sel } = vnode;
|
|
3370
|
+
const { getProperty, setProperty } = renderer;
|
|
3519
3371
|
for (const key in props) {
|
|
3520
3372
|
const cur = props[key];
|
|
3521
3373
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3522
3374
|
// different than the one previously set.
|
|
3523
3375
|
if (isFirstPatch ||
|
|
3524
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3525
|
-
setProperty
|
|
3376
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3377
|
+
setProperty(elm, key, cur);
|
|
3526
3378
|
}
|
|
3527
3379
|
}
|
|
3528
3380
|
}
|
|
@@ -3567,13 +3419,14 @@ function getMapFromClassName(className) {
|
|
|
3567
3419
|
}
|
|
3568
3420
|
return map;
|
|
3569
3421
|
}
|
|
3570
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3422
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3571
3423
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3572
3424
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3573
3425
|
if (oldClass === newClass) {
|
|
3574
3426
|
return;
|
|
3575
3427
|
}
|
|
3576
|
-
const
|
|
3428
|
+
const { getClassList } = renderer;
|
|
3429
|
+
const classList = getClassList(elm);
|
|
3577
3430
|
const newClassMap = getMapFromClassName(newClass);
|
|
3578
3431
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3579
3432
|
let name;
|
|
@@ -3597,17 +3450,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3597
3450
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3598
3451
|
*/
|
|
3599
3452
|
// The style property is a string when defined via an expression in the template.
|
|
3600
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3453
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3601
3454
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3602
3455
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3603
3456
|
if (oldStyle === newStyle) {
|
|
3604
3457
|
return;
|
|
3605
3458
|
}
|
|
3459
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3606
3460
|
if (!isString(newStyle) || newStyle === '') {
|
|
3607
|
-
removeAttribute
|
|
3461
|
+
removeAttribute(elm, 'style');
|
|
3608
3462
|
}
|
|
3609
3463
|
else {
|
|
3610
|
-
setAttribute
|
|
3464
|
+
setAttribute(elm, 'style', newStyle);
|
|
3611
3465
|
}
|
|
3612
3466
|
}
|
|
3613
3467
|
|
|
@@ -3617,14 +3471,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3617
3471
|
* SPDX-License-Identifier: MIT
|
|
3618
3472
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3619
3473
|
*/
|
|
3620
|
-
function applyEventListeners(vnode) {
|
|
3474
|
+
function applyEventListeners(vnode, renderer) {
|
|
3621
3475
|
const { elm, data: { on }, } = vnode;
|
|
3622
3476
|
if (isUndefined$1(on)) {
|
|
3623
3477
|
return;
|
|
3624
3478
|
}
|
|
3479
|
+
const { addEventListener } = renderer;
|
|
3625
3480
|
for (const name in on) {
|
|
3626
3481
|
const handler = on[name];
|
|
3627
|
-
addEventListener
|
|
3482
|
+
addEventListener(elm, name, handler);
|
|
3628
3483
|
}
|
|
3629
3484
|
}
|
|
3630
3485
|
|
|
@@ -3637,12 +3492,13 @@ function applyEventListeners(vnode) {
|
|
|
3637
3492
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3638
3493
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3639
3494
|
// different classnames properties individually instead of via a string.
|
|
3640
|
-
function applyStaticClassAttribute(vnode) {
|
|
3495
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3641
3496
|
const { elm, data: { classMap }, } = vnode;
|
|
3642
3497
|
if (isUndefined$1(classMap)) {
|
|
3643
3498
|
return;
|
|
3644
3499
|
}
|
|
3645
|
-
const
|
|
3500
|
+
const { getClassList } = renderer;
|
|
3501
|
+
const classList = getClassList(elm);
|
|
3646
3502
|
for (const name in classMap) {
|
|
3647
3503
|
classList.add(name);
|
|
3648
3504
|
}
|
|
@@ -3657,14 +3513,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3657
3513
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3658
3514
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3659
3515
|
// different style properties individually instead of via a string.
|
|
3660
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3516
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3661
3517
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3662
3518
|
if (isUndefined$1(styleDecls)) {
|
|
3663
3519
|
return;
|
|
3664
3520
|
}
|
|
3521
|
+
const { setCSSStyleProperty } = renderer;
|
|
3665
3522
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3666
3523
|
const [prop, value, important] = styleDecls[i];
|
|
3667
|
-
setCSSStyleProperty
|
|
3524
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3668
3525
|
}
|
|
3669
3526
|
}
|
|
3670
3527
|
|
|
@@ -3674,15 +3531,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3674
3531
|
* SPDX-License-Identifier: MIT
|
|
3675
3532
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3676
3533
|
*/
|
|
3677
|
-
function patchChildren(c1, c2, parent) {
|
|
3534
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3678
3535
|
if (hasDynamicChildren(c2)) {
|
|
3679
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3536
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3680
3537
|
}
|
|
3681
3538
|
else {
|
|
3682
|
-
updateStaticChildren(c1, c2, parent);
|
|
3539
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3683
3540
|
}
|
|
3684
3541
|
}
|
|
3685
|
-
function patch(n1, n2) {
|
|
3542
|
+
function patch(n1, n2, renderer) {
|
|
3543
|
+
var _a, _b;
|
|
3686
3544
|
if (n1 === n2) {
|
|
3687
3545
|
return;
|
|
3688
3546
|
}
|
|
@@ -3696,80 +3554,90 @@ function patch(n1, n2) {
|
|
|
3696
3554
|
}
|
|
3697
3555
|
switch (n2.type) {
|
|
3698
3556
|
case 0 /* Text */:
|
|
3699
|
-
|
|
3557
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3558
|
+
patchText(n1, n2, renderer);
|
|
3700
3559
|
break;
|
|
3701
3560
|
case 1 /* Comment */:
|
|
3702
|
-
|
|
3561
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3562
|
+
patchComment(n1, n2, renderer);
|
|
3703
3563
|
break;
|
|
3704
3564
|
case 2 /* Element */:
|
|
3705
|
-
patchElement(n1, n2);
|
|
3565
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3706
3566
|
break;
|
|
3707
3567
|
case 3 /* CustomElement */:
|
|
3708
|
-
patchCustomElement(n1, n2);
|
|
3568
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3709
3569
|
break;
|
|
3710
3570
|
}
|
|
3711
3571
|
}
|
|
3712
|
-
function mount(node, parent, anchor) {
|
|
3572
|
+
function mount(node, parent, renderer, anchor) {
|
|
3573
|
+
var _a, _b;
|
|
3713
3574
|
switch (node.type) {
|
|
3714
3575
|
case 0 /* Text */:
|
|
3715
|
-
|
|
3576
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3577
|
+
mountText(node, parent, anchor, renderer);
|
|
3716
3578
|
break;
|
|
3717
3579
|
case 1 /* Comment */:
|
|
3718
|
-
|
|
3580
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3581
|
+
mountComment(node, parent, anchor, renderer);
|
|
3719
3582
|
break;
|
|
3720
3583
|
case 2 /* Element */:
|
|
3721
|
-
|
|
3584
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3585
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3722
3586
|
break;
|
|
3723
3587
|
case 3 /* CustomElement */:
|
|
3724
|
-
|
|
3588
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3589
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3725
3590
|
break;
|
|
3726
3591
|
}
|
|
3727
3592
|
}
|
|
3728
|
-
function patchText(n1, n2) {
|
|
3593
|
+
function patchText(n1, n2, renderer) {
|
|
3729
3594
|
n2.elm = n1.elm;
|
|
3730
3595
|
if (n2.text !== n1.text) {
|
|
3731
|
-
updateTextContent(n2);
|
|
3596
|
+
updateTextContent(n2, renderer);
|
|
3732
3597
|
}
|
|
3733
3598
|
}
|
|
3734
|
-
function mountText(
|
|
3735
|
-
const { owner } =
|
|
3736
|
-
const
|
|
3737
|
-
|
|
3738
|
-
|
|
3599
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3600
|
+
const { owner } = vnode;
|
|
3601
|
+
const { createText } = renderer;
|
|
3602
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3603
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3604
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3739
3605
|
}
|
|
3740
|
-
function patchComment(n1, n2) {
|
|
3606
|
+
function patchComment(n1, n2, renderer) {
|
|
3741
3607
|
n2.elm = n1.elm;
|
|
3742
3608
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3743
3609
|
// it is the case today.
|
|
3744
3610
|
if (n2.text !== n1.text) {
|
|
3745
|
-
updateTextContent(n2);
|
|
3611
|
+
updateTextContent(n2, renderer);
|
|
3746
3612
|
}
|
|
3747
3613
|
}
|
|
3748
|
-
function mountComment(
|
|
3749
|
-
const { owner } =
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3752
|
-
|
|
3614
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3615
|
+
const { owner } = vnode;
|
|
3616
|
+
const { createComment } = renderer;
|
|
3617
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3618
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3619
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3753
3620
|
}
|
|
3754
|
-
function mountElement(vnode, parent, anchor) {
|
|
3621
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3755
3622
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3623
|
+
const { createElement } = renderer;
|
|
3756
3624
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3757
|
-
const elm = createElement
|
|
3758
|
-
linkNodeToShadow(elm, owner);
|
|
3759
|
-
fallbackElmHook(elm, vnode);
|
|
3625
|
+
const elm = createElement(sel, namespace);
|
|
3626
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3627
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3760
3628
|
vnode.elm = elm;
|
|
3761
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3762
|
-
insertNode(elm, parent, anchor);
|
|
3763
|
-
mountVNodes(vnode.children, elm, null);
|
|
3629
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3630
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3631
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3764
3632
|
}
|
|
3765
|
-
function patchElement(n1, n2) {
|
|
3633
|
+
function patchElement(n1, n2, renderer) {
|
|
3766
3634
|
const elm = (n2.elm = n1.elm);
|
|
3767
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3768
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3635
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3636
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3769
3637
|
}
|
|
3770
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3638
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3771
3639
|
const { sel, owner } = vnode;
|
|
3772
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3640
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3773
3641
|
/**
|
|
3774
3642
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3775
3643
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3779,9 +3647,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3779
3647
|
let vm;
|
|
3780
3648
|
const elm = new UpgradableConstructor((elm) => {
|
|
3781
3649
|
// the custom element from the registry is expecting an upgrade callback
|
|
3782
|
-
vm = createViewModelHook(elm, vnode);
|
|
3650
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3783
3651
|
});
|
|
3784
|
-
linkNodeToShadow(elm, owner);
|
|
3652
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3785
3653
|
vnode.elm = elm;
|
|
3786
3654
|
vnode.vm = vm;
|
|
3787
3655
|
if (vm) {
|
|
@@ -3790,23 +3658,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3790
3658
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3791
3659
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3792
3660
|
}
|
|
3793
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3794
|
-
insertNode(elm, parent, anchor);
|
|
3661
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3662
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3795
3663
|
if (vm) {
|
|
3796
3664
|
if (process.env.NODE_ENV !== 'production') {
|
|
3797
3665
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3798
3666
|
}
|
|
3799
3667
|
runConnectedCallback(vm);
|
|
3800
3668
|
}
|
|
3801
|
-
mountVNodes(vnode.children, elm, null);
|
|
3669
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3802
3670
|
if (vm) {
|
|
3803
3671
|
appendVM(vm);
|
|
3804
3672
|
}
|
|
3805
3673
|
}
|
|
3806
|
-
function patchCustomElement(n1, n2) {
|
|
3674
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3807
3675
|
const elm = (n2.elm = n1.elm);
|
|
3808
3676
|
const vm = (n2.vm = n1.vm);
|
|
3809
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3677
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3810
3678
|
if (!isUndefined$1(vm)) {
|
|
3811
3679
|
// in fallback mode, the allocation will always set children to
|
|
3812
3680
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3814,33 +3682,38 @@ function patchCustomElement(n1, n2) {
|
|
|
3814
3682
|
}
|
|
3815
3683
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3816
3684
|
// will happen, but in native, it does allocate the light dom
|
|
3817
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3685
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3818
3686
|
if (!isUndefined$1(vm)) {
|
|
3819
3687
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3820
3688
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3821
3689
|
rerenderVM(vm);
|
|
3822
3690
|
}
|
|
3823
3691
|
}
|
|
3824
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3692
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3825
3693
|
for (; start < end; ++start) {
|
|
3826
3694
|
const vnode = vnodes[start];
|
|
3827
3695
|
if (isVNode(vnode)) {
|
|
3828
|
-
mount(vnode, parent, anchor);
|
|
3696
|
+
mount(vnode, parent, renderer, anchor);
|
|
3829
3697
|
}
|
|
3830
3698
|
}
|
|
3831
3699
|
}
|
|
3832
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3700
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3833
3701
|
const { type, elm, sel } = vnode;
|
|
3834
3702
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3835
3703
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3836
3704
|
if (doRemove) {
|
|
3837
|
-
|
|
3705
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3706
|
+
// but the removal used here is from the owner instead.
|
|
3707
|
+
removeNode(elm, parent, renderer);
|
|
3838
3708
|
}
|
|
3839
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3840
3709
|
switch (type) {
|
|
3841
|
-
case 2 /* Element */:
|
|
3842
|
-
|
|
3710
|
+
case 2 /* Element */: {
|
|
3711
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3712
|
+
// Only required for synthetic shadow.
|
|
3713
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3714
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3843
3715
|
break;
|
|
3716
|
+
}
|
|
3844
3717
|
case 3 /* CustomElement */: {
|
|
3845
3718
|
const { vm } = vnode;
|
|
3846
3719
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -3851,11 +3724,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3851
3724
|
}
|
|
3852
3725
|
}
|
|
3853
3726
|
}
|
|
3854
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3727
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3855
3728
|
for (; start < end; ++start) {
|
|
3856
3729
|
const ch = vnodes[start];
|
|
3857
3730
|
if (isVNode(ch)) {
|
|
3858
|
-
unmount(ch, parent, doRemove);
|
|
3731
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3859
3732
|
}
|
|
3860
3733
|
}
|
|
3861
3734
|
}
|
|
@@ -3869,66 +3742,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3869
3742
|
elm.$shadowToken$ = token;
|
|
3870
3743
|
}
|
|
3871
3744
|
// Set the scope token class for *.scoped.css styles
|
|
3872
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3745
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3873
3746
|
const { cmpTemplate, context } = owner;
|
|
3747
|
+
const { getClassList } = renderer;
|
|
3874
3748
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3875
3749
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3876
|
-
|
|
3750
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3751
|
+
// probably we should have a renderer api for just the add operation
|
|
3752
|
+
getClassList(elm).add(token);
|
|
3877
3753
|
}
|
|
3878
3754
|
}
|
|
3879
|
-
function linkNodeToShadow(elm, owner) {
|
|
3755
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3880
3756
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3757
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3881
3758
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3882
|
-
if (isSyntheticShadowDefined
|
|
3759
|
+
if (isSyntheticShadowDefined) {
|
|
3883
3760
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3884
3761
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3885
3762
|
}
|
|
3886
3763
|
}
|
|
3887
3764
|
}
|
|
3888
|
-
function updateTextContent(vnode) {
|
|
3765
|
+
function updateTextContent(vnode, renderer) {
|
|
3889
3766
|
const { elm, text } = vnode;
|
|
3767
|
+
const { setText } = renderer;
|
|
3890
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3891
3769
|
unlockDomMutation();
|
|
3892
3770
|
}
|
|
3893
|
-
setText
|
|
3771
|
+
setText(elm, text);
|
|
3894
3772
|
if (process.env.NODE_ENV !== 'production') {
|
|
3895
3773
|
lockDomMutation();
|
|
3896
3774
|
}
|
|
3897
3775
|
}
|
|
3898
|
-
function insertNode(node, parent, anchor) {
|
|
3776
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3899
3777
|
if (process.env.NODE_ENV !== 'production') {
|
|
3900
3778
|
unlockDomMutation();
|
|
3901
3779
|
}
|
|
3902
|
-
insert
|
|
3780
|
+
renderer.insert(node, parent, anchor);
|
|
3903
3781
|
if (process.env.NODE_ENV !== 'production') {
|
|
3904
3782
|
lockDomMutation();
|
|
3905
3783
|
}
|
|
3906
3784
|
}
|
|
3907
|
-
function removeNode(node, parent) {
|
|
3785
|
+
function removeNode(node, parent, renderer) {
|
|
3908
3786
|
if (process.env.NODE_ENV !== 'production') {
|
|
3909
3787
|
unlockDomMutation();
|
|
3910
3788
|
}
|
|
3911
|
-
remove
|
|
3789
|
+
renderer.remove(node, parent);
|
|
3912
3790
|
if (process.env.NODE_ENV !== 'production') {
|
|
3913
3791
|
lockDomMutation();
|
|
3914
3792
|
}
|
|
3915
3793
|
}
|
|
3916
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3794
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3917
3795
|
if (isNull(oldVnode)) {
|
|
3918
|
-
applyEventListeners(vnode);
|
|
3919
|
-
applyStaticClassAttribute(vnode);
|
|
3920
|
-
applyStaticStyleAttribute(vnode);
|
|
3796
|
+
applyEventListeners(vnode, renderer);
|
|
3797
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3798
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3921
3799
|
}
|
|
3922
3800
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3923
3801
|
// value is set before type=radio.
|
|
3924
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3925
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3926
|
-
patchAttributes(oldVnode, vnode);
|
|
3927
|
-
patchProps(oldVnode, vnode);
|
|
3802
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3803
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3804
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3805
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3928
3806
|
}
|
|
3929
|
-
function fallbackElmHook(elm, vnode) {
|
|
3807
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3930
3808
|
const { owner } = vnode;
|
|
3931
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3809
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3932
3810
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3933
3811
|
const { data: { context }, } = vnode;
|
|
3934
3812
|
const { stylesheetToken } = owner.context;
|
|
@@ -3976,7 +3854,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3976
3854
|
vnode.children = EmptyArray;
|
|
3977
3855
|
}
|
|
3978
3856
|
}
|
|
3979
|
-
function createViewModelHook(elm, vnode) {
|
|
3857
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3980
3858
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3981
3859
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3982
3860
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3985,7 +3863,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3985
3863
|
return vm;
|
|
3986
3864
|
}
|
|
3987
3865
|
const { sel, mode, ctor, owner } = vnode;
|
|
3988
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3866
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3989
3867
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3990
3868
|
const { stylesheetToken } = owner.context;
|
|
3991
3869
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3994,7 +3872,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3994
3872
|
setElementShadowToken(elm, stylesheetToken);
|
|
3995
3873
|
}
|
|
3996
3874
|
}
|
|
3997
|
-
vm = createVM(elm, ctor, {
|
|
3875
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3998
3876
|
mode,
|
|
3999
3877
|
owner,
|
|
4000
3878
|
tagName: sel,
|
|
@@ -4069,7 +3947,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4069
3947
|
}
|
|
4070
3948
|
return map;
|
|
4071
3949
|
}
|
|
4072
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3950
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4073
3951
|
let oldStartIdx = 0;
|
|
4074
3952
|
let newStartIdx = 0;
|
|
4075
3953
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4098,26 +3976,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4098
3976
|
newEndVnode = newCh[--newEndIdx];
|
|
4099
3977
|
}
|
|
4100
3978
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4101
|
-
patch(oldStartVnode, newStartVnode);
|
|
3979
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4102
3980
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4103
3981
|
newStartVnode = newCh[++newStartIdx];
|
|
4104
3982
|
}
|
|
4105
3983
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4106
|
-
patch(oldEndVnode, newEndVnode);
|
|
3984
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4107
3985
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4108
3986
|
newEndVnode = newCh[--newEndIdx];
|
|
4109
3987
|
}
|
|
4110
3988
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4111
3989
|
// Vnode moved right
|
|
4112
|
-
patch(oldStartVnode, newEndVnode);
|
|
4113
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3990
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3991
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4114
3992
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4115
3993
|
newEndVnode = newCh[--newEndIdx];
|
|
4116
3994
|
}
|
|
4117
3995
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4118
3996
|
// Vnode moved left
|
|
4119
|
-
patch(oldEndVnode, newStartVnode);
|
|
4120
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3997
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3998
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4121
3999
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4122
4000
|
newStartVnode = newCh[++newStartIdx];
|
|
4123
4001
|
}
|
|
@@ -4128,7 +4006,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4128
4006
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4129
4007
|
if (isUndefined$1(idxInOld)) {
|
|
4130
4008
|
// New element
|
|
4131
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4009
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4132
4010
|
newStartVnode = newCh[++newStartIdx];
|
|
4133
4011
|
}
|
|
4134
4012
|
else {
|
|
@@ -4136,10 +4014,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4136
4014
|
if (isVNode(elmToMove)) {
|
|
4137
4015
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4138
4016
|
// New element
|
|
4139
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4017
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4140
4018
|
}
|
|
4141
4019
|
else {
|
|
4142
|
-
patch(elmToMove, newStartVnode);
|
|
4020
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4143
4021
|
// Delete the old child, but copy the array since it is read-only.
|
|
4144
4022
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4145
4023
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4151,7 +4029,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4151
4029
|
}
|
|
4152
4030
|
// We've already cloned at least once, so it's no longer read-only
|
|
4153
4031
|
oldCh[idxInOld] = undefined;
|
|
4154
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4032
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4155
4033
|
}
|
|
4156
4034
|
}
|
|
4157
4035
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4168,25 +4046,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4168
4046
|
n = newCh[++i];
|
|
4169
4047
|
} while (!isVNode(n) && i < newChEnd);
|
|
4170
4048
|
before = isVNode(n) ? n.elm : null;
|
|
4171
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4049
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4172
4050
|
}
|
|
4173
4051
|
else {
|
|
4174
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4052
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4175
4053
|
}
|
|
4176
4054
|
}
|
|
4177
4055
|
}
|
|
4178
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4056
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4179
4057
|
const c1Length = c1.length;
|
|
4180
4058
|
const c2Length = c2.length;
|
|
4181
4059
|
if (c1Length === 0) {
|
|
4182
4060
|
// the old list is empty, we can directly insert anything new
|
|
4183
|
-
mountVNodes(c2, parent, null);
|
|
4061
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4184
4062
|
return;
|
|
4185
4063
|
}
|
|
4186
4064
|
if (c2Length === 0) {
|
|
4187
4065
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4188
4066
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4189
|
-
unmountVNodes(c1, parent, true);
|
|
4067
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4190
4068
|
return;
|
|
4191
4069
|
}
|
|
4192
4070
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4199,16 +4077,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4199
4077
|
if (isVNode(n1)) {
|
|
4200
4078
|
if (isVNode(n2)) {
|
|
4201
4079
|
// both vnodes are equivalent, and we just need to patch them
|
|
4202
|
-
patch(n1, n2);
|
|
4080
|
+
patch(n1, n2, renderer);
|
|
4203
4081
|
anchor = n2.elm;
|
|
4204
4082
|
}
|
|
4205
4083
|
else {
|
|
4206
4084
|
// removing the old vnode since the new one is null
|
|
4207
|
-
unmount(n1, parent, true);
|
|
4085
|
+
unmount(n1, parent, renderer, true);
|
|
4208
4086
|
}
|
|
4209
4087
|
}
|
|
4210
4088
|
else if (isVNode(n2)) {
|
|
4211
|
-
mount(n2, parent, anchor);
|
|
4089
|
+
mount(n2, parent, renderer, anchor);
|
|
4212
4090
|
anchor = n2.elm;
|
|
4213
4091
|
}
|
|
4214
4092
|
}
|
|
@@ -4637,7 +4515,7 @@ function createInlineStyleVNode(content) {
|
|
|
4637
4515
|
}, [api.t(content)]);
|
|
4638
4516
|
}
|
|
4639
4517
|
function updateStylesheetToken(vm, template) {
|
|
4640
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4518
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4641
4519
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4642
4520
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4643
4521
|
const { hasScopedStyles } = context;
|
|
@@ -4648,10 +4526,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4648
4526
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4649
4527
|
if (!isUndefined$1(oldToken)) {
|
|
4650
4528
|
if (oldHasTokenInClass) {
|
|
4651
|
-
getClassList
|
|
4529
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4652
4530
|
}
|
|
4653
4531
|
if (oldHasTokenInAttribute) {
|
|
4654
|
-
removeAttribute
|
|
4532
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4655
4533
|
}
|
|
4656
4534
|
}
|
|
4657
4535
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4662,11 +4540,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4662
4540
|
// Set the new styling token on the host element
|
|
4663
4541
|
if (!isUndefined$1(newToken)) {
|
|
4664
4542
|
if (hasScopedStyles) {
|
|
4665
|
-
getClassList
|
|
4543
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4666
4544
|
newHasTokenInClass = true;
|
|
4667
4545
|
}
|
|
4668
4546
|
if (isSyntheticShadow) {
|
|
4669
|
-
setAttribute
|
|
4547
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4670
4548
|
newHasTokenInAttribute = true;
|
|
4671
4549
|
}
|
|
4672
4550
|
}
|
|
@@ -4754,13 +4632,13 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4754
4632
|
return owner;
|
|
4755
4633
|
}
|
|
4756
4634
|
function createStylesheet(vm, stylesheets) {
|
|
4757
|
-
const { renderMode, shadowMode } = vm;
|
|
4635
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4758
4636
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4759
4637
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4760
|
-
insertStylesheet
|
|
4638
|
+
insertStylesheet(stylesheets[i]);
|
|
4761
4639
|
}
|
|
4762
4640
|
}
|
|
4763
|
-
else if (ssr
|
|
4641
|
+
else if (ssr || vm.hydrated) {
|
|
4764
4642
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4765
4643
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4766
4644
|
// the first time the VM renders.
|
|
@@ -4774,7 +4652,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4774
4652
|
// null root means a global style
|
|
4775
4653
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4776
4654
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4777
|
-
insertStylesheet
|
|
4655
|
+
insertStylesheet(stylesheets[i], target);
|
|
4778
4656
|
}
|
|
4779
4657
|
}
|
|
4780
4658
|
return null;
|
|
@@ -5282,9 +5160,20 @@ function removeVM(vm) {
|
|
|
5282
5160
|
|
|
5283
5161
|
resetComponentStateWhenRemoved(vm);
|
|
5284
5162
|
}
|
|
5285
|
-
function createVM(elm, ctor, options) {
|
|
5286
|
-
var _a;
|
|
5287
5163
|
|
|
5164
|
+
function getNearestShadowAncestor(vm) {
|
|
5165
|
+
let ancestor = vm.owner;
|
|
5166
|
+
|
|
5167
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5168
|
+
/* Light */
|
|
5169
|
+
) {
|
|
5170
|
+
ancestor = ancestor.owner;
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5173
|
+
return ancestor;
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5288
5177
|
const {
|
|
5289
5178
|
mode,
|
|
5290
5179
|
owner,
|
|
@@ -5314,8 +5203,6 @@ function createVM(elm, ctor, options) {
|
|
|
5314
5203
|
cmpTemplate: null,
|
|
5315
5204
|
hydrated: Boolean(hydrated),
|
|
5316
5205
|
renderMode: def.renderMode,
|
|
5317
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5318
|
-
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,
|
|
5319
5206
|
context: {
|
|
5320
5207
|
stylesheetToken: undefined,
|
|
5321
5208
|
hasTokenInClass: undefined,
|
|
@@ -5328,14 +5215,17 @@ function createVM(elm, ctor, options) {
|
|
|
5328
5215
|
},
|
|
5329
5216
|
// Properties set right after VM creation.
|
|
5330
5217
|
tro: null,
|
|
5218
|
+
shadowMode: null,
|
|
5331
5219
|
// Properties set by the LightningElement constructor.
|
|
5332
5220
|
component: null,
|
|
5333
5221
|
shadowRoot: null,
|
|
5334
5222
|
renderRoot: null,
|
|
5335
5223
|
callHook,
|
|
5336
5224
|
setHook,
|
|
5337
|
-
getHook
|
|
5225
|
+
getHook,
|
|
5226
|
+
renderer
|
|
5338
5227
|
};
|
|
5228
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5339
5229
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5340
5230
|
|
|
5341
5231
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5360,12 +5250,17 @@ function createVM(elm, ctor, options) {
|
|
|
5360
5250
|
return vm;
|
|
5361
5251
|
}
|
|
5362
5252
|
|
|
5363
|
-
function computeShadowMode(
|
|
5364
|
-
|
|
5365
|
-
|
|
5253
|
+
function computeShadowMode(vm, renderer) {
|
|
5254
|
+
const {
|
|
5255
|
+
def
|
|
5256
|
+
} = vm;
|
|
5257
|
+
const {
|
|
5258
|
+
isSyntheticShadowDefined,
|
|
5259
|
+
isNativeShadowDefined
|
|
5260
|
+
} = renderer;
|
|
5366
5261
|
let shadowMode;
|
|
5367
5262
|
|
|
5368
|
-
if (isSyntheticShadowDefined
|
|
5263
|
+
if (isSyntheticShadowDefined) {
|
|
5369
5264
|
if (def.renderMode === 0
|
|
5370
5265
|
/* Light */
|
|
5371
5266
|
) {
|
|
@@ -5374,7 +5269,7 @@ function computeShadowMode(def, owner) {
|
|
|
5374
5269
|
shadowMode = 0
|
|
5375
5270
|
/* Native */
|
|
5376
5271
|
;
|
|
5377
|
-
} else if (isNativeShadowDefined
|
|
5272
|
+
} else if (isNativeShadowDefined) {
|
|
5378
5273
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5379
5274
|
// the if-condition.
|
|
5380
5275
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5385,13 +5280,23 @@ function computeShadowMode(def, owner) {
|
|
|
5385
5280
|
/* Native */
|
|
5386
5281
|
;
|
|
5387
5282
|
} else {
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5283
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5284
|
+
|
|
5285
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5286
|
+
/* Native */
|
|
5287
|
+
) {
|
|
5288
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5289
|
+
// transitively opts all of its descendants into native.
|
|
5290
|
+
shadowMode = 0
|
|
5291
|
+
/* Native */
|
|
5292
|
+
;
|
|
5293
|
+
} else {
|
|
5294
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5295
|
+
// to be native.
|
|
5296
|
+
shadowMode = 1
|
|
5297
|
+
/* Synthetic */
|
|
5298
|
+
;
|
|
5299
|
+
}
|
|
5395
5300
|
}
|
|
5396
5301
|
} else {
|
|
5397
5302
|
shadowMode = 1
|
|
@@ -5454,7 +5359,8 @@ function rehydrate(vm) {
|
|
|
5454
5359
|
function patchShadowRoot(vm, newCh) {
|
|
5455
5360
|
const {
|
|
5456
5361
|
renderRoot,
|
|
5457
|
-
children: oldCh
|
|
5362
|
+
children: oldCh,
|
|
5363
|
+
renderer
|
|
5458
5364
|
} = vm; // caching the new children collection
|
|
5459
5365
|
|
|
5460
5366
|
vm.children = newCh;
|
|
@@ -5470,7 +5376,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5470
5376
|
, vm);
|
|
5471
5377
|
}, () => {
|
|
5472
5378
|
// job
|
|
5473
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5379
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5474
5380
|
}, () => {
|
|
5475
5381
|
// post
|
|
5476
5382
|
logOperationEnd(2
|
|
@@ -5495,10 +5401,13 @@ function runRenderedCallback(vm) {
|
|
|
5495
5401
|
const {
|
|
5496
5402
|
def: {
|
|
5497
5403
|
renderedCallback
|
|
5404
|
+
},
|
|
5405
|
+
renderer: {
|
|
5406
|
+
ssr
|
|
5498
5407
|
}
|
|
5499
5408
|
} = vm;
|
|
5500
5409
|
|
|
5501
|
-
if (isTrue(ssr
|
|
5410
|
+
if (isTrue(ssr)) {
|
|
5502
5411
|
return;
|
|
5503
5412
|
}
|
|
5504
5413
|
|
|
@@ -5732,14 +5641,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5732
5641
|
function resetComponentRoot(vm) {
|
|
5733
5642
|
const {
|
|
5734
5643
|
children,
|
|
5735
|
-
renderRoot
|
|
5644
|
+
renderRoot,
|
|
5645
|
+
renderer: {
|
|
5646
|
+
remove
|
|
5647
|
+
}
|
|
5736
5648
|
} = vm;
|
|
5737
5649
|
|
|
5738
5650
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5739
5651
|
const child = children[i];
|
|
5740
5652
|
|
|
5741
5653
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5742
|
-
remove
|
|
5654
|
+
remove(child.elm, renderRoot);
|
|
5743
5655
|
}
|
|
5744
5656
|
}
|
|
5745
5657
|
|
|
@@ -5748,7 +5660,13 @@ function resetComponentRoot(vm) {
|
|
|
5748
5660
|
vm.velements = EmptyArray;
|
|
5749
5661
|
}
|
|
5750
5662
|
function scheduleRehydration(vm) {
|
|
5751
|
-
|
|
5663
|
+
const {
|
|
5664
|
+
renderer: {
|
|
5665
|
+
ssr
|
|
5666
|
+
}
|
|
5667
|
+
} = vm;
|
|
5668
|
+
|
|
5669
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5752
5670
|
return;
|
|
5753
5671
|
}
|
|
5754
5672
|
|
|
@@ -5907,6 +5825,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5907
5825
|
context: {
|
|
5908
5826
|
wiredConnecting,
|
|
5909
5827
|
wiredDisconnecting
|
|
5828
|
+
},
|
|
5829
|
+
renderer: {
|
|
5830
|
+
dispatchEvent
|
|
5910
5831
|
}
|
|
5911
5832
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5912
5833
|
|
|
@@ -5930,7 +5851,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5930
5851
|
}
|
|
5931
5852
|
|
|
5932
5853
|
});
|
|
5933
|
-
dispatchEvent
|
|
5854
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5934
5855
|
});
|
|
5935
5856
|
}
|
|
5936
5857
|
|
|
@@ -6270,7 +6191,7 @@ function freezeTemplate(tmpl) {
|
|
|
6270
6191
|
});
|
|
6271
6192
|
}
|
|
6272
6193
|
}
|
|
6273
|
-
/* version: 2.
|
|
6194
|
+
/* version: 2.14.2 */
|
|
6274
6195
|
|
|
6275
6196
|
/*
|
|
6276
6197
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6343,6 +6264,9 @@ class HTMLElementImpl {
|
|
|
6343
6264
|
}
|
|
6344
6265
|
}
|
|
6345
6266
|
const ssr = true;
|
|
6267
|
+
function isHydrating() {
|
|
6268
|
+
return false;
|
|
6269
|
+
}
|
|
6346
6270
|
const isNativeShadowDefined = false;
|
|
6347
6271
|
const isSyntheticShadowDefined = false;
|
|
6348
6272
|
function insert(node, parent, anchor) {
|
|
@@ -6569,51 +6493,47 @@ function getCustomElement(name) {
|
|
|
6569
6493
|
const HTMLElementExported = HTMLElementImpl;
|
|
6570
6494
|
/* noop */
|
|
6571
6495
|
const assertInstanceOfHTMLElement = noop;
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
setSetText(setText);
|
|
6614
|
-
setSsr(ssr);
|
|
6615
|
-
setAddEventListener(addEventListener);
|
|
6616
|
-
setInsertStylesheet(insertStylesheet);
|
|
6496
|
+
const renderer = {
|
|
6497
|
+
ssr,
|
|
6498
|
+
isNativeShadowDefined,
|
|
6499
|
+
isSyntheticShadowDefined,
|
|
6500
|
+
HTMLElementExported,
|
|
6501
|
+
isHydrating,
|
|
6502
|
+
insert,
|
|
6503
|
+
remove,
|
|
6504
|
+
createElement,
|
|
6505
|
+
createText,
|
|
6506
|
+
createComment,
|
|
6507
|
+
nextSibling,
|
|
6508
|
+
attachShadow,
|
|
6509
|
+
getProperty,
|
|
6510
|
+
setProperty,
|
|
6511
|
+
setText,
|
|
6512
|
+
getAttribute,
|
|
6513
|
+
setAttribute,
|
|
6514
|
+
removeAttribute,
|
|
6515
|
+
addEventListener,
|
|
6516
|
+
removeEventListener,
|
|
6517
|
+
dispatchEvent,
|
|
6518
|
+
getClassList,
|
|
6519
|
+
setCSSStyleProperty,
|
|
6520
|
+
getBoundingClientRect,
|
|
6521
|
+
querySelector,
|
|
6522
|
+
querySelectorAll,
|
|
6523
|
+
getElementsByTagName,
|
|
6524
|
+
getElementsByClassName,
|
|
6525
|
+
getChildren,
|
|
6526
|
+
getChildNodes,
|
|
6527
|
+
getFirstChild,
|
|
6528
|
+
getFirstElementChild,
|
|
6529
|
+
getLastChild,
|
|
6530
|
+
getLastElementChild,
|
|
6531
|
+
isConnected,
|
|
6532
|
+
insertStylesheet,
|
|
6533
|
+
assertInstanceOfHTMLElement,
|
|
6534
|
+
defineCustomElement,
|
|
6535
|
+
getCustomElement,
|
|
6536
|
+
};
|
|
6617
6537
|
|
|
6618
6538
|
/*
|
|
6619
6539
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6707,8 +6627,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6707
6627
|
if (!isObject(props) || isNull(props)) {
|
|
6708
6628
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6709
6629
|
}
|
|
6710
|
-
const element = createElement(tagName);
|
|
6711
|
-
createVM(element, Ctor, {
|
|
6630
|
+
const element = renderer.createElement(tagName);
|
|
6631
|
+
createVM(element, Ctor, renderer, {
|
|
6712
6632
|
mode: 'open',
|
|
6713
6633
|
owner: null,
|
|
6714
6634
|
tagName,
|
|
@@ -6729,7 +6649,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6729
6649
|
*/
|
|
6730
6650
|
freeze(LightningElement);
|
|
6731
6651
|
seal(LightningElement.prototype);
|
|
6732
|
-
/* version: 2.
|
|
6652
|
+
/* version: 2.14.2 */
|
|
6733
6653
|
|
|
6734
6654
|
exports.LightningElement = LightningElement;
|
|
6735
6655
|
exports.api = api$1;
|
|
@@ -6743,6 +6663,7 @@ exports.registerComponent = registerComponent;
|
|
|
6743
6663
|
exports.registerDecorators = registerDecorators;
|
|
6744
6664
|
exports.registerTemplate = registerTemplate;
|
|
6745
6665
|
exports.renderComponent = renderComponent;
|
|
6666
|
+
exports.renderer = renderer;
|
|
6746
6667
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
6747
6668
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6748
6669
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|