lwc 2.14.1 → 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 +449 -534
- package/dist/engine-dom/iife/es2017/engine-dom.js +449 -533
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +393 -478
- package/dist/engine-dom/iife/es5/engine-dom.js +561 -700
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +498 -642
- package/dist/engine-dom/umd/es2017/engine-dom.js +449 -533
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +393 -478
- package/dist/engine-dom/umd/es5/engine-dom.js +561 -700
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +498 -642
- package/dist/engine-server/commonjs/es2017/engine-server.js +332 -437
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +332 -438
- 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.14.
|
|
424
|
+
const LWC_VERSION = "2.14.2";
|
|
425
425
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
426
|
-
/** version: 2.14.
|
|
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.14.
|
|
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,
|
|
@@ -3415,12 +3263,13 @@ function getComponentDef(Ctor) {
|
|
|
3415
3263
|
* SPDX-License-Identifier: MIT
|
|
3416
3264
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3417
3265
|
*/
|
|
3418
|
-
function getUpgradableConstructor(tagName) {
|
|
3266
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3267
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3419
3268
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3420
3269
|
// produce only tags with lowercase letters
|
|
3421
3270
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3422
3271
|
tagName = tagName.toLowerCase();
|
|
3423
|
-
let CE = getCustomElement
|
|
3272
|
+
let CE = getCustomElement(tagName);
|
|
3424
3273
|
if (!isUndefined$1(CE)) {
|
|
3425
3274
|
return CE;
|
|
3426
3275
|
}
|
|
@@ -3428,7 +3277,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3428
3277
|
* LWC Upgradable Element reference to an element that was created
|
|
3429
3278
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3430
3279
|
*/
|
|
3431
|
-
CE = class LWCUpgradableElement extends
|
|
3280
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3432
3281
|
constructor(upgradeCallback) {
|
|
3433
3282
|
super();
|
|
3434
3283
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3436,7 +3285,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3436
3285
|
}
|
|
3437
3286
|
}
|
|
3438
3287
|
};
|
|
3439
|
-
defineCustomElement
|
|
3288
|
+
defineCustomElement(tagName, CE);
|
|
3440
3289
|
return CE;
|
|
3441
3290
|
}
|
|
3442
3291
|
|
|
@@ -3461,7 +3310,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3461
3310
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3462
3311
|
*/
|
|
3463
3312
|
const ColonCharCode = 58;
|
|
3464
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3313
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3465
3314
|
const { attrs } = vnode.data;
|
|
3466
3315
|
if (isUndefined$1(attrs)) {
|
|
3467
3316
|
return;
|
|
@@ -3471,6 +3320,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3471
3320
|
return;
|
|
3472
3321
|
}
|
|
3473
3322
|
const { elm } = vnode;
|
|
3323
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3474
3324
|
for (const key in attrs) {
|
|
3475
3325
|
const cur = attrs[key];
|
|
3476
3326
|
const old = oldAttrs[key];
|
|
@@ -3478,17 +3328,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3478
3328
|
unlockAttribute(elm, key);
|
|
3479
3329
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3480
3330
|
// Assume xml namespace
|
|
3481
|
-
setAttribute
|
|
3331
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3482
3332
|
}
|
|
3483
3333
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3484
3334
|
// Assume xlink namespace
|
|
3485
|
-
setAttribute
|
|
3335
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3486
3336
|
}
|
|
3487
3337
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3488
|
-
removeAttribute
|
|
3338
|
+
removeAttribute(elm, key);
|
|
3489
3339
|
}
|
|
3490
3340
|
else {
|
|
3491
|
-
setAttribute
|
|
3341
|
+
setAttribute(elm, key, cur);
|
|
3492
3342
|
}
|
|
3493
3343
|
lockAttribute();
|
|
3494
3344
|
}
|
|
@@ -3506,7 +3356,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3506
3356
|
// instead of relying on internally tracked values.
|
|
3507
3357
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3508
3358
|
}
|
|
3509
|
-
function patchProps(oldVnode, vnode) {
|
|
3359
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3510
3360
|
const { props } = vnode.data;
|
|
3511
3361
|
if (isUndefined$1(props)) {
|
|
3512
3362
|
return;
|
|
@@ -3517,13 +3367,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3517
3367
|
}
|
|
3518
3368
|
const isFirstPatch = isNull(oldVnode);
|
|
3519
3369
|
const { elm, sel } = vnode;
|
|
3370
|
+
const { getProperty, setProperty } = renderer;
|
|
3520
3371
|
for (const key in props) {
|
|
3521
3372
|
const cur = props[key];
|
|
3522
3373
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3523
3374
|
// different than the one previously set.
|
|
3524
3375
|
if (isFirstPatch ||
|
|
3525
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3526
|
-
setProperty
|
|
3376
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3377
|
+
setProperty(elm, key, cur);
|
|
3527
3378
|
}
|
|
3528
3379
|
}
|
|
3529
3380
|
}
|
|
@@ -3568,13 +3419,14 @@ function getMapFromClassName(className) {
|
|
|
3568
3419
|
}
|
|
3569
3420
|
return map;
|
|
3570
3421
|
}
|
|
3571
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3422
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3572
3423
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3573
3424
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3574
3425
|
if (oldClass === newClass) {
|
|
3575
3426
|
return;
|
|
3576
3427
|
}
|
|
3577
|
-
const
|
|
3428
|
+
const { getClassList } = renderer;
|
|
3429
|
+
const classList = getClassList(elm);
|
|
3578
3430
|
const newClassMap = getMapFromClassName(newClass);
|
|
3579
3431
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3580
3432
|
let name;
|
|
@@ -3598,17 +3450,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3598
3450
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3599
3451
|
*/
|
|
3600
3452
|
// The style property is a string when defined via an expression in the template.
|
|
3601
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3453
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3602
3454
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3603
3455
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3604
3456
|
if (oldStyle === newStyle) {
|
|
3605
3457
|
return;
|
|
3606
3458
|
}
|
|
3459
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3607
3460
|
if (!isString(newStyle) || newStyle === '') {
|
|
3608
|
-
removeAttribute
|
|
3461
|
+
removeAttribute(elm, 'style');
|
|
3609
3462
|
}
|
|
3610
3463
|
else {
|
|
3611
|
-
setAttribute
|
|
3464
|
+
setAttribute(elm, 'style', newStyle);
|
|
3612
3465
|
}
|
|
3613
3466
|
}
|
|
3614
3467
|
|
|
@@ -3618,14 +3471,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3618
3471
|
* SPDX-License-Identifier: MIT
|
|
3619
3472
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3620
3473
|
*/
|
|
3621
|
-
function applyEventListeners(vnode) {
|
|
3474
|
+
function applyEventListeners(vnode, renderer) {
|
|
3622
3475
|
const { elm, data: { on }, } = vnode;
|
|
3623
3476
|
if (isUndefined$1(on)) {
|
|
3624
3477
|
return;
|
|
3625
3478
|
}
|
|
3479
|
+
const { addEventListener } = renderer;
|
|
3626
3480
|
for (const name in on) {
|
|
3627
3481
|
const handler = on[name];
|
|
3628
|
-
addEventListener
|
|
3482
|
+
addEventListener(elm, name, handler);
|
|
3629
3483
|
}
|
|
3630
3484
|
}
|
|
3631
3485
|
|
|
@@ -3638,12 +3492,13 @@ function applyEventListeners(vnode) {
|
|
|
3638
3492
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3639
3493
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3640
3494
|
// different classnames properties individually instead of via a string.
|
|
3641
|
-
function applyStaticClassAttribute(vnode) {
|
|
3495
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3642
3496
|
const { elm, data: { classMap }, } = vnode;
|
|
3643
3497
|
if (isUndefined$1(classMap)) {
|
|
3644
3498
|
return;
|
|
3645
3499
|
}
|
|
3646
|
-
const
|
|
3500
|
+
const { getClassList } = renderer;
|
|
3501
|
+
const classList = getClassList(elm);
|
|
3647
3502
|
for (const name in classMap) {
|
|
3648
3503
|
classList.add(name);
|
|
3649
3504
|
}
|
|
@@ -3658,14 +3513,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3658
3513
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3659
3514
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3660
3515
|
// different style properties individually instead of via a string.
|
|
3661
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3516
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3662
3517
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3663
3518
|
if (isUndefined$1(styleDecls)) {
|
|
3664
3519
|
return;
|
|
3665
3520
|
}
|
|
3521
|
+
const { setCSSStyleProperty } = renderer;
|
|
3666
3522
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3667
3523
|
const [prop, value, important] = styleDecls[i];
|
|
3668
|
-
setCSSStyleProperty
|
|
3524
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3669
3525
|
}
|
|
3670
3526
|
}
|
|
3671
3527
|
|
|
@@ -3675,15 +3531,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3675
3531
|
* SPDX-License-Identifier: MIT
|
|
3676
3532
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3677
3533
|
*/
|
|
3678
|
-
function patchChildren(c1, c2, parent) {
|
|
3534
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3679
3535
|
if (hasDynamicChildren(c2)) {
|
|
3680
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3536
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3681
3537
|
}
|
|
3682
3538
|
else {
|
|
3683
|
-
updateStaticChildren(c1, c2, parent);
|
|
3539
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3684
3540
|
}
|
|
3685
3541
|
}
|
|
3686
|
-
function patch(n1, n2) {
|
|
3542
|
+
function patch(n1, n2, renderer) {
|
|
3543
|
+
var _a, _b;
|
|
3687
3544
|
if (n1 === n2) {
|
|
3688
3545
|
return;
|
|
3689
3546
|
}
|
|
@@ -3697,80 +3554,90 @@ function patch(n1, n2) {
|
|
|
3697
3554
|
}
|
|
3698
3555
|
switch (n2.type) {
|
|
3699
3556
|
case 0 /* Text */:
|
|
3700
|
-
|
|
3557
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3558
|
+
patchText(n1, n2, renderer);
|
|
3701
3559
|
break;
|
|
3702
3560
|
case 1 /* Comment */:
|
|
3703
|
-
|
|
3561
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3562
|
+
patchComment(n1, n2, renderer);
|
|
3704
3563
|
break;
|
|
3705
3564
|
case 2 /* Element */:
|
|
3706
|
-
patchElement(n1, n2);
|
|
3565
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3707
3566
|
break;
|
|
3708
3567
|
case 3 /* CustomElement */:
|
|
3709
|
-
patchCustomElement(n1, n2);
|
|
3568
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3710
3569
|
break;
|
|
3711
3570
|
}
|
|
3712
3571
|
}
|
|
3713
|
-
function mount(node, parent, anchor) {
|
|
3572
|
+
function mount(node, parent, renderer, anchor) {
|
|
3573
|
+
var _a, _b;
|
|
3714
3574
|
switch (node.type) {
|
|
3715
3575
|
case 0 /* Text */:
|
|
3716
|
-
|
|
3576
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3577
|
+
mountText(node, parent, anchor, renderer);
|
|
3717
3578
|
break;
|
|
3718
3579
|
case 1 /* Comment */:
|
|
3719
|
-
|
|
3580
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3581
|
+
mountComment(node, parent, anchor, renderer);
|
|
3720
3582
|
break;
|
|
3721
3583
|
case 2 /* Element */:
|
|
3722
|
-
|
|
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);
|
|
3723
3586
|
break;
|
|
3724
3587
|
case 3 /* CustomElement */:
|
|
3725
|
-
|
|
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);
|
|
3726
3590
|
break;
|
|
3727
3591
|
}
|
|
3728
3592
|
}
|
|
3729
|
-
function patchText(n1, n2) {
|
|
3593
|
+
function patchText(n1, n2, renderer) {
|
|
3730
3594
|
n2.elm = n1.elm;
|
|
3731
3595
|
if (n2.text !== n1.text) {
|
|
3732
|
-
updateTextContent(n2);
|
|
3596
|
+
updateTextContent(n2, renderer);
|
|
3733
3597
|
}
|
|
3734
3598
|
}
|
|
3735
|
-
function mountText(
|
|
3736
|
-
const { owner } =
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3739
|
-
|
|
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);
|
|
3740
3605
|
}
|
|
3741
|
-
function patchComment(n1, n2) {
|
|
3606
|
+
function patchComment(n1, n2, renderer) {
|
|
3742
3607
|
n2.elm = n1.elm;
|
|
3743
3608
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3744
3609
|
// it is the case today.
|
|
3745
3610
|
if (n2.text !== n1.text) {
|
|
3746
|
-
updateTextContent(n2);
|
|
3611
|
+
updateTextContent(n2, renderer);
|
|
3747
3612
|
}
|
|
3748
3613
|
}
|
|
3749
|
-
function mountComment(
|
|
3750
|
-
const { owner } =
|
|
3751
|
-
const
|
|
3752
|
-
|
|
3753
|
-
|
|
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);
|
|
3754
3620
|
}
|
|
3755
|
-
function mountElement(vnode, parent, anchor) {
|
|
3621
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3756
3622
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3623
|
+
const { createElement } = renderer;
|
|
3757
3624
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3758
|
-
const elm = createElement
|
|
3759
|
-
linkNodeToShadow(elm, owner);
|
|
3760
|
-
fallbackElmHook(elm, vnode);
|
|
3625
|
+
const elm = createElement(sel, namespace);
|
|
3626
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3627
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3761
3628
|
vnode.elm = elm;
|
|
3762
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3763
|
-
insertNode(elm, parent, anchor);
|
|
3764
|
-
mountVNodes(vnode.children, elm, null);
|
|
3629
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3630
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3631
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3765
3632
|
}
|
|
3766
|
-
function patchElement(n1, n2) {
|
|
3633
|
+
function patchElement(n1, n2, renderer) {
|
|
3767
3634
|
const elm = (n2.elm = n1.elm);
|
|
3768
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3769
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3635
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3636
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3770
3637
|
}
|
|
3771
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3638
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3772
3639
|
const { sel, owner } = vnode;
|
|
3773
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3640
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3774
3641
|
/**
|
|
3775
3642
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3776
3643
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3780,9 +3647,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3780
3647
|
let vm;
|
|
3781
3648
|
const elm = new UpgradableConstructor((elm) => {
|
|
3782
3649
|
// the custom element from the registry is expecting an upgrade callback
|
|
3783
|
-
vm = createViewModelHook(elm, vnode);
|
|
3650
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3784
3651
|
});
|
|
3785
|
-
linkNodeToShadow(elm, owner);
|
|
3652
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3786
3653
|
vnode.elm = elm;
|
|
3787
3654
|
vnode.vm = vm;
|
|
3788
3655
|
if (vm) {
|
|
@@ -3791,23 +3658,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3791
3658
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3792
3659
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3793
3660
|
}
|
|
3794
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3795
|
-
insertNode(elm, parent, anchor);
|
|
3661
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3662
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3796
3663
|
if (vm) {
|
|
3797
3664
|
if (process.env.NODE_ENV !== 'production') {
|
|
3798
3665
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3799
3666
|
}
|
|
3800
3667
|
runConnectedCallback(vm);
|
|
3801
3668
|
}
|
|
3802
|
-
mountVNodes(vnode.children, elm, null);
|
|
3669
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3803
3670
|
if (vm) {
|
|
3804
3671
|
appendVM(vm);
|
|
3805
3672
|
}
|
|
3806
3673
|
}
|
|
3807
|
-
function patchCustomElement(n1, n2) {
|
|
3674
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3808
3675
|
const elm = (n2.elm = n1.elm);
|
|
3809
3676
|
const vm = (n2.vm = n1.vm);
|
|
3810
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3677
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3811
3678
|
if (!isUndefined$1(vm)) {
|
|
3812
3679
|
// in fallback mode, the allocation will always set children to
|
|
3813
3680
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3815,34 +3682,36 @@ function patchCustomElement(n1, n2) {
|
|
|
3815
3682
|
}
|
|
3816
3683
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3817
3684
|
// will happen, but in native, it does allocate the light dom
|
|
3818
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3685
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3819
3686
|
if (!isUndefined$1(vm)) {
|
|
3820
3687
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3821
3688
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3822
3689
|
rerenderVM(vm);
|
|
3823
3690
|
}
|
|
3824
3691
|
}
|
|
3825
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3692
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3826
3693
|
for (; start < end; ++start) {
|
|
3827
3694
|
const vnode = vnodes[start];
|
|
3828
3695
|
if (isVNode(vnode)) {
|
|
3829
|
-
mount(vnode, parent, anchor);
|
|
3696
|
+
mount(vnode, parent, renderer, anchor);
|
|
3830
3697
|
}
|
|
3831
3698
|
}
|
|
3832
3699
|
}
|
|
3833
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3700
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3834
3701
|
const { type, elm, sel } = vnode;
|
|
3835
3702
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3836
3703
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3837
3704
|
if (doRemove) {
|
|
3838
|
-
|
|
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);
|
|
3839
3708
|
}
|
|
3840
3709
|
switch (type) {
|
|
3841
3710
|
case 2 /* Element */: {
|
|
3842
3711
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3843
3712
|
// Only required for synthetic shadow.
|
|
3844
|
-
const
|
|
3845
|
-
unmountVNodes(vnode.children, elm,
|
|
3713
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3714
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3846
3715
|
break;
|
|
3847
3716
|
}
|
|
3848
3717
|
case 3 /* CustomElement */: {
|
|
@@ -3855,11 +3724,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3855
3724
|
}
|
|
3856
3725
|
}
|
|
3857
3726
|
}
|
|
3858
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3727
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3859
3728
|
for (; start < end; ++start) {
|
|
3860
3729
|
const ch = vnodes[start];
|
|
3861
3730
|
if (isVNode(ch)) {
|
|
3862
|
-
unmount(ch, parent, doRemove);
|
|
3731
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3863
3732
|
}
|
|
3864
3733
|
}
|
|
3865
3734
|
}
|
|
@@ -3873,66 +3742,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3873
3742
|
elm.$shadowToken$ = token;
|
|
3874
3743
|
}
|
|
3875
3744
|
// Set the scope token class for *.scoped.css styles
|
|
3876
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3745
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3877
3746
|
const { cmpTemplate, context } = owner;
|
|
3747
|
+
const { getClassList } = renderer;
|
|
3878
3748
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3879
3749
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3880
|
-
|
|
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);
|
|
3881
3753
|
}
|
|
3882
3754
|
}
|
|
3883
|
-
function linkNodeToShadow(elm, owner) {
|
|
3755
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3884
3756
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3757
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3885
3758
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3886
|
-
if (isSyntheticShadowDefined
|
|
3759
|
+
if (isSyntheticShadowDefined) {
|
|
3887
3760
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3888
3761
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3889
3762
|
}
|
|
3890
3763
|
}
|
|
3891
3764
|
}
|
|
3892
|
-
function updateTextContent(vnode) {
|
|
3765
|
+
function updateTextContent(vnode, renderer) {
|
|
3893
3766
|
const { elm, text } = vnode;
|
|
3767
|
+
const { setText } = renderer;
|
|
3894
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3895
3769
|
unlockDomMutation();
|
|
3896
3770
|
}
|
|
3897
|
-
setText
|
|
3771
|
+
setText(elm, text);
|
|
3898
3772
|
if (process.env.NODE_ENV !== 'production') {
|
|
3899
3773
|
lockDomMutation();
|
|
3900
3774
|
}
|
|
3901
3775
|
}
|
|
3902
|
-
function insertNode(node, parent, anchor) {
|
|
3776
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3903
3777
|
if (process.env.NODE_ENV !== 'production') {
|
|
3904
3778
|
unlockDomMutation();
|
|
3905
3779
|
}
|
|
3906
|
-
insert
|
|
3780
|
+
renderer.insert(node, parent, anchor);
|
|
3907
3781
|
if (process.env.NODE_ENV !== 'production') {
|
|
3908
3782
|
lockDomMutation();
|
|
3909
3783
|
}
|
|
3910
3784
|
}
|
|
3911
|
-
function removeNode(node, parent) {
|
|
3785
|
+
function removeNode(node, parent, renderer) {
|
|
3912
3786
|
if (process.env.NODE_ENV !== 'production') {
|
|
3913
3787
|
unlockDomMutation();
|
|
3914
3788
|
}
|
|
3915
|
-
remove
|
|
3789
|
+
renderer.remove(node, parent);
|
|
3916
3790
|
if (process.env.NODE_ENV !== 'production') {
|
|
3917
3791
|
lockDomMutation();
|
|
3918
3792
|
}
|
|
3919
3793
|
}
|
|
3920
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3794
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3921
3795
|
if (isNull(oldVnode)) {
|
|
3922
|
-
applyEventListeners(vnode);
|
|
3923
|
-
applyStaticClassAttribute(vnode);
|
|
3924
|
-
applyStaticStyleAttribute(vnode);
|
|
3796
|
+
applyEventListeners(vnode, renderer);
|
|
3797
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3798
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3925
3799
|
}
|
|
3926
3800
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3927
3801
|
// value is set before type=radio.
|
|
3928
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3929
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3930
|
-
patchAttributes(oldVnode, vnode);
|
|
3931
|
-
patchProps(oldVnode, vnode);
|
|
3802
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3803
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3804
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3805
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3932
3806
|
}
|
|
3933
|
-
function fallbackElmHook(elm, vnode) {
|
|
3807
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3934
3808
|
const { owner } = vnode;
|
|
3935
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3809
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3936
3810
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3937
3811
|
const { data: { context }, } = vnode;
|
|
3938
3812
|
const { stylesheetToken } = owner.context;
|
|
@@ -3980,7 +3854,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3980
3854
|
vnode.children = EmptyArray;
|
|
3981
3855
|
}
|
|
3982
3856
|
}
|
|
3983
|
-
function createViewModelHook(elm, vnode) {
|
|
3857
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3984
3858
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3985
3859
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3986
3860
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3989,7 +3863,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3989
3863
|
return vm;
|
|
3990
3864
|
}
|
|
3991
3865
|
const { sel, mode, ctor, owner } = vnode;
|
|
3992
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3866
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3993
3867
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3994
3868
|
const { stylesheetToken } = owner.context;
|
|
3995
3869
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3998,7 +3872,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3998
3872
|
setElementShadowToken(elm, stylesheetToken);
|
|
3999
3873
|
}
|
|
4000
3874
|
}
|
|
4001
|
-
vm = createVM(elm, ctor, {
|
|
3875
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4002
3876
|
mode,
|
|
4003
3877
|
owner,
|
|
4004
3878
|
tagName: sel,
|
|
@@ -4073,7 +3947,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4073
3947
|
}
|
|
4074
3948
|
return map;
|
|
4075
3949
|
}
|
|
4076
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3950
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4077
3951
|
let oldStartIdx = 0;
|
|
4078
3952
|
let newStartIdx = 0;
|
|
4079
3953
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4102,26 +3976,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4102
3976
|
newEndVnode = newCh[--newEndIdx];
|
|
4103
3977
|
}
|
|
4104
3978
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4105
|
-
patch(oldStartVnode, newStartVnode);
|
|
3979
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4106
3980
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4107
3981
|
newStartVnode = newCh[++newStartIdx];
|
|
4108
3982
|
}
|
|
4109
3983
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4110
|
-
patch(oldEndVnode, newEndVnode);
|
|
3984
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4111
3985
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4112
3986
|
newEndVnode = newCh[--newEndIdx];
|
|
4113
3987
|
}
|
|
4114
3988
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4115
3989
|
// Vnode moved right
|
|
4116
|
-
patch(oldStartVnode, newEndVnode);
|
|
4117
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3990
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3991
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4118
3992
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4119
3993
|
newEndVnode = newCh[--newEndIdx];
|
|
4120
3994
|
}
|
|
4121
3995
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4122
3996
|
// Vnode moved left
|
|
4123
|
-
patch(oldEndVnode, newStartVnode);
|
|
4124
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3997
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3998
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4125
3999
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4126
4000
|
newStartVnode = newCh[++newStartIdx];
|
|
4127
4001
|
}
|
|
@@ -4132,7 +4006,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4132
4006
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4133
4007
|
if (isUndefined$1(idxInOld)) {
|
|
4134
4008
|
// New element
|
|
4135
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4009
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4136
4010
|
newStartVnode = newCh[++newStartIdx];
|
|
4137
4011
|
}
|
|
4138
4012
|
else {
|
|
@@ -4140,10 +4014,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4140
4014
|
if (isVNode(elmToMove)) {
|
|
4141
4015
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4142
4016
|
// New element
|
|
4143
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4017
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4144
4018
|
}
|
|
4145
4019
|
else {
|
|
4146
|
-
patch(elmToMove, newStartVnode);
|
|
4020
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4147
4021
|
// Delete the old child, but copy the array since it is read-only.
|
|
4148
4022
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4149
4023
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4155,7 +4029,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4155
4029
|
}
|
|
4156
4030
|
// We've already cloned at least once, so it's no longer read-only
|
|
4157
4031
|
oldCh[idxInOld] = undefined;
|
|
4158
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4032
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4159
4033
|
}
|
|
4160
4034
|
}
|
|
4161
4035
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4172,25 +4046,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4172
4046
|
n = newCh[++i];
|
|
4173
4047
|
} while (!isVNode(n) && i < newChEnd);
|
|
4174
4048
|
before = isVNode(n) ? n.elm : null;
|
|
4175
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4049
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4176
4050
|
}
|
|
4177
4051
|
else {
|
|
4178
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4052
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4179
4053
|
}
|
|
4180
4054
|
}
|
|
4181
4055
|
}
|
|
4182
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4056
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4183
4057
|
const c1Length = c1.length;
|
|
4184
4058
|
const c2Length = c2.length;
|
|
4185
4059
|
if (c1Length === 0) {
|
|
4186
4060
|
// the old list is empty, we can directly insert anything new
|
|
4187
|
-
mountVNodes(c2, parent, null);
|
|
4061
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4188
4062
|
return;
|
|
4189
4063
|
}
|
|
4190
4064
|
if (c2Length === 0) {
|
|
4191
4065
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4192
4066
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4193
|
-
unmountVNodes(c1, parent, true);
|
|
4067
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4194
4068
|
return;
|
|
4195
4069
|
}
|
|
4196
4070
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4203,16 +4077,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4203
4077
|
if (isVNode(n1)) {
|
|
4204
4078
|
if (isVNode(n2)) {
|
|
4205
4079
|
// both vnodes are equivalent, and we just need to patch them
|
|
4206
|
-
patch(n1, n2);
|
|
4080
|
+
patch(n1, n2, renderer);
|
|
4207
4081
|
anchor = n2.elm;
|
|
4208
4082
|
}
|
|
4209
4083
|
else {
|
|
4210
4084
|
// removing the old vnode since the new one is null
|
|
4211
|
-
unmount(n1, parent, true);
|
|
4085
|
+
unmount(n1, parent, renderer, true);
|
|
4212
4086
|
}
|
|
4213
4087
|
}
|
|
4214
4088
|
else if (isVNode(n2)) {
|
|
4215
|
-
mount(n2, parent, anchor);
|
|
4089
|
+
mount(n2, parent, renderer, anchor);
|
|
4216
4090
|
anchor = n2.elm;
|
|
4217
4091
|
}
|
|
4218
4092
|
}
|
|
@@ -4641,7 +4515,7 @@ function createInlineStyleVNode(content) {
|
|
|
4641
4515
|
}, [api.t(content)]);
|
|
4642
4516
|
}
|
|
4643
4517
|
function updateStylesheetToken(vm, template) {
|
|
4644
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4518
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4645
4519
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4646
4520
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4647
4521
|
const { hasScopedStyles } = context;
|
|
@@ -4652,10 +4526,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4652
4526
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4653
4527
|
if (!isUndefined$1(oldToken)) {
|
|
4654
4528
|
if (oldHasTokenInClass) {
|
|
4655
|
-
getClassList
|
|
4529
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4656
4530
|
}
|
|
4657
4531
|
if (oldHasTokenInAttribute) {
|
|
4658
|
-
removeAttribute
|
|
4532
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4659
4533
|
}
|
|
4660
4534
|
}
|
|
4661
4535
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4666,11 +4540,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4666
4540
|
// Set the new styling token on the host element
|
|
4667
4541
|
if (!isUndefined$1(newToken)) {
|
|
4668
4542
|
if (hasScopedStyles) {
|
|
4669
|
-
getClassList
|
|
4543
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4670
4544
|
newHasTokenInClass = true;
|
|
4671
4545
|
}
|
|
4672
4546
|
if (isSyntheticShadow) {
|
|
4673
|
-
setAttribute
|
|
4547
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4674
4548
|
newHasTokenInAttribute = true;
|
|
4675
4549
|
}
|
|
4676
4550
|
}
|
|
@@ -4758,13 +4632,13 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4758
4632
|
return owner;
|
|
4759
4633
|
}
|
|
4760
4634
|
function createStylesheet(vm, stylesheets) {
|
|
4761
|
-
const { renderMode, shadowMode } = vm;
|
|
4635
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4762
4636
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4763
4637
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4764
|
-
insertStylesheet
|
|
4638
|
+
insertStylesheet(stylesheets[i]);
|
|
4765
4639
|
}
|
|
4766
4640
|
}
|
|
4767
|
-
else if (ssr
|
|
4641
|
+
else if (ssr || vm.hydrated) {
|
|
4768
4642
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4769
4643
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4770
4644
|
// the first time the VM renders.
|
|
@@ -4778,7 +4652,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4778
4652
|
// null root means a global style
|
|
4779
4653
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4780
4654
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4781
|
-
insertStylesheet
|
|
4655
|
+
insertStylesheet(stylesheets[i], target);
|
|
4782
4656
|
}
|
|
4783
4657
|
}
|
|
4784
4658
|
return null;
|
|
@@ -5299,7 +5173,7 @@ function getNearestShadowAncestor(vm) {
|
|
|
5299
5173
|
return ancestor;
|
|
5300
5174
|
}
|
|
5301
5175
|
|
|
5302
|
-
function createVM(elm, ctor, options) {
|
|
5176
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5303
5177
|
const {
|
|
5304
5178
|
mode,
|
|
5305
5179
|
owner,
|
|
@@ -5348,9 +5222,10 @@ function createVM(elm, ctor, options) {
|
|
|
5348
5222
|
renderRoot: null,
|
|
5349
5223
|
callHook,
|
|
5350
5224
|
setHook,
|
|
5351
|
-
getHook
|
|
5225
|
+
getHook,
|
|
5226
|
+
renderer
|
|
5352
5227
|
};
|
|
5353
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5228
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5354
5229
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5355
5230
|
|
|
5356
5231
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5375,13 +5250,17 @@ function createVM(elm, ctor, options) {
|
|
|
5375
5250
|
return vm;
|
|
5376
5251
|
}
|
|
5377
5252
|
|
|
5378
|
-
function computeShadowMode(vm) {
|
|
5253
|
+
function computeShadowMode(vm, renderer) {
|
|
5379
5254
|
const {
|
|
5380
5255
|
def
|
|
5381
5256
|
} = vm;
|
|
5257
|
+
const {
|
|
5258
|
+
isSyntheticShadowDefined,
|
|
5259
|
+
isNativeShadowDefined
|
|
5260
|
+
} = renderer;
|
|
5382
5261
|
let shadowMode;
|
|
5383
5262
|
|
|
5384
|
-
if (isSyntheticShadowDefined
|
|
5263
|
+
if (isSyntheticShadowDefined) {
|
|
5385
5264
|
if (def.renderMode === 0
|
|
5386
5265
|
/* Light */
|
|
5387
5266
|
) {
|
|
@@ -5390,7 +5269,7 @@ function computeShadowMode(vm) {
|
|
|
5390
5269
|
shadowMode = 0
|
|
5391
5270
|
/* Native */
|
|
5392
5271
|
;
|
|
5393
|
-
} else if (isNativeShadowDefined
|
|
5272
|
+
} else if (isNativeShadowDefined) {
|
|
5394
5273
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5395
5274
|
// the if-condition.
|
|
5396
5275
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5480,7 +5359,8 @@ function rehydrate(vm) {
|
|
|
5480
5359
|
function patchShadowRoot(vm, newCh) {
|
|
5481
5360
|
const {
|
|
5482
5361
|
renderRoot,
|
|
5483
|
-
children: oldCh
|
|
5362
|
+
children: oldCh,
|
|
5363
|
+
renderer
|
|
5484
5364
|
} = vm; // caching the new children collection
|
|
5485
5365
|
|
|
5486
5366
|
vm.children = newCh;
|
|
@@ -5496,7 +5376,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5496
5376
|
, vm);
|
|
5497
5377
|
}, () => {
|
|
5498
5378
|
// job
|
|
5499
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5379
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5500
5380
|
}, () => {
|
|
5501
5381
|
// post
|
|
5502
5382
|
logOperationEnd(2
|
|
@@ -5521,10 +5401,13 @@ function runRenderedCallback(vm) {
|
|
|
5521
5401
|
const {
|
|
5522
5402
|
def: {
|
|
5523
5403
|
renderedCallback
|
|
5404
|
+
},
|
|
5405
|
+
renderer: {
|
|
5406
|
+
ssr
|
|
5524
5407
|
}
|
|
5525
5408
|
} = vm;
|
|
5526
5409
|
|
|
5527
|
-
if (isTrue(ssr
|
|
5410
|
+
if (isTrue(ssr)) {
|
|
5528
5411
|
return;
|
|
5529
5412
|
}
|
|
5530
5413
|
|
|
@@ -5758,14 +5641,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5758
5641
|
function resetComponentRoot(vm) {
|
|
5759
5642
|
const {
|
|
5760
5643
|
children,
|
|
5761
|
-
renderRoot
|
|
5644
|
+
renderRoot,
|
|
5645
|
+
renderer: {
|
|
5646
|
+
remove
|
|
5647
|
+
}
|
|
5762
5648
|
} = vm;
|
|
5763
5649
|
|
|
5764
5650
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5765
5651
|
const child = children[i];
|
|
5766
5652
|
|
|
5767
5653
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5768
|
-
remove
|
|
5654
|
+
remove(child.elm, renderRoot);
|
|
5769
5655
|
}
|
|
5770
5656
|
}
|
|
5771
5657
|
|
|
@@ -5774,7 +5660,13 @@ function resetComponentRoot(vm) {
|
|
|
5774
5660
|
vm.velements = EmptyArray;
|
|
5775
5661
|
}
|
|
5776
5662
|
function scheduleRehydration(vm) {
|
|
5777
|
-
|
|
5663
|
+
const {
|
|
5664
|
+
renderer: {
|
|
5665
|
+
ssr
|
|
5666
|
+
}
|
|
5667
|
+
} = vm;
|
|
5668
|
+
|
|
5669
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5778
5670
|
return;
|
|
5779
5671
|
}
|
|
5780
5672
|
|
|
@@ -5933,6 +5825,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5933
5825
|
context: {
|
|
5934
5826
|
wiredConnecting,
|
|
5935
5827
|
wiredDisconnecting
|
|
5828
|
+
},
|
|
5829
|
+
renderer: {
|
|
5830
|
+
dispatchEvent
|
|
5936
5831
|
}
|
|
5937
5832
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5938
5833
|
|
|
@@ -5956,7 +5851,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5956
5851
|
}
|
|
5957
5852
|
|
|
5958
5853
|
});
|
|
5959
|
-
dispatchEvent
|
|
5854
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5960
5855
|
});
|
|
5961
5856
|
}
|
|
5962
5857
|
|
|
@@ -6296,7 +6191,7 @@ function freezeTemplate(tmpl) {
|
|
|
6296
6191
|
});
|
|
6297
6192
|
}
|
|
6298
6193
|
}
|
|
6299
|
-
/* version: 2.14.
|
|
6194
|
+
/* version: 2.14.2 */
|
|
6300
6195
|
|
|
6301
6196
|
/*
|
|
6302
6197
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6369,6 +6264,9 @@ class HTMLElementImpl {
|
|
|
6369
6264
|
}
|
|
6370
6265
|
}
|
|
6371
6266
|
const ssr = true;
|
|
6267
|
+
function isHydrating() {
|
|
6268
|
+
return false;
|
|
6269
|
+
}
|
|
6372
6270
|
const isNativeShadowDefined = false;
|
|
6373
6271
|
const isSyntheticShadowDefined = false;
|
|
6374
6272
|
function insert(node, parent, anchor) {
|
|
@@ -6595,51 +6493,47 @@ function getCustomElement(name) {
|
|
|
6595
6493
|
const HTMLElementExported = HTMLElementImpl;
|
|
6596
6494
|
/* noop */
|
|
6597
6495
|
const assertInstanceOfHTMLElement = noop;
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
setSetText(setText);
|
|
6640
|
-
setSsr(ssr);
|
|
6641
|
-
setAddEventListener(addEventListener);
|
|
6642
|
-
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
|
+
};
|
|
6643
6537
|
|
|
6644
6538
|
/*
|
|
6645
6539
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6733,8 +6627,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6733
6627
|
if (!isObject(props) || isNull(props)) {
|
|
6734
6628
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6735
6629
|
}
|
|
6736
|
-
const element = createElement(tagName);
|
|
6737
|
-
createVM(element, Ctor, {
|
|
6630
|
+
const element = renderer.createElement(tagName);
|
|
6631
|
+
createVM(element, Ctor, renderer, {
|
|
6738
6632
|
mode: 'open',
|
|
6739
6633
|
owner: null,
|
|
6740
6634
|
tagName,
|
|
@@ -6755,7 +6649,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6755
6649
|
*/
|
|
6756
6650
|
freeze(LightningElement);
|
|
6757
6651
|
seal(LightningElement.prototype);
|
|
6758
|
-
/* version: 2.14.
|
|
6652
|
+
/* version: 2.14.2 */
|
|
6759
6653
|
|
|
6760
6654
|
exports.LightningElement = LightningElement;
|
|
6761
6655
|
exports.api = api$1;
|
|
@@ -6769,6 +6663,7 @@ exports.registerComponent = registerComponent;
|
|
|
6769
6663
|
exports.registerDecorators = registerDecorators;
|
|
6770
6664
|
exports.registerTemplate = registerTemplate;
|
|
6771
6665
|
exports.renderComponent = renderComponent;
|
|
6666
|
+
exports.renderer = renderer;
|
|
6772
6667
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
6773
6668
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6774
6669
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|