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
|
@@ -417,9 +417,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
417
417
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
418
418
|
*/
|
|
419
419
|
// Increment whenever the LWC template compiler changes
|
|
420
|
-
const LWC_VERSION = "2.
|
|
420
|
+
const LWC_VERSION = "2.14.2";
|
|
421
421
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
422
|
-
/** version: 2.
|
|
422
|
+
/** version: 2.14.2 */
|
|
423
423
|
|
|
424
424
|
/*
|
|
425
425
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -528,7 +528,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
528
528
|
setFeatureFlag(name, value);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
/** version: 2.
|
|
531
|
+
/** version: 2.14.2 */
|
|
532
532
|
|
|
533
533
|
/* proxy-compat-disable */
|
|
534
534
|
|
|
@@ -611,162 +611,6 @@ function flattenStylesheets(stylesheets) {
|
|
|
611
611
|
return list;
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
-
//
|
|
615
|
-
// Primitives
|
|
616
|
-
//
|
|
617
|
-
let ssr$1;
|
|
618
|
-
function setSsr(ssrImpl) {
|
|
619
|
-
ssr$1 = ssrImpl;
|
|
620
|
-
}
|
|
621
|
-
let isNativeShadowDefined$1;
|
|
622
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
623
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
624
|
-
}
|
|
625
|
-
let isSyntheticShadowDefined$1;
|
|
626
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
627
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
628
|
-
}
|
|
629
|
-
let HTMLElementExported$1;
|
|
630
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
631
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
632
|
-
}
|
|
633
|
-
let insert$1;
|
|
634
|
-
function setInsert(insertImpl) {
|
|
635
|
-
insert$1 = insertImpl;
|
|
636
|
-
}
|
|
637
|
-
let remove$1;
|
|
638
|
-
function setRemove(removeImpl) {
|
|
639
|
-
remove$1 = removeImpl;
|
|
640
|
-
}
|
|
641
|
-
let createElement$1;
|
|
642
|
-
function setCreateElement(createElementImpl) {
|
|
643
|
-
createElement$1 = createElementImpl;
|
|
644
|
-
}
|
|
645
|
-
let createText$1;
|
|
646
|
-
function setCreateText(createTextImpl) {
|
|
647
|
-
createText$1 = createTextImpl;
|
|
648
|
-
}
|
|
649
|
-
let createComment$1;
|
|
650
|
-
function setCreateComment(createCommentImpl) {
|
|
651
|
-
createComment$1 = createCommentImpl;
|
|
652
|
-
}
|
|
653
|
-
let nextSibling$1;
|
|
654
|
-
function setNextSibling(nextSiblingImpl) {
|
|
655
|
-
nextSibling$1 = nextSiblingImpl;
|
|
656
|
-
}
|
|
657
|
-
let attachShadow$1;
|
|
658
|
-
function setAttachShadow(attachShadowImpl) {
|
|
659
|
-
attachShadow$1 = attachShadowImpl;
|
|
660
|
-
}
|
|
661
|
-
let getProperty$1;
|
|
662
|
-
function setGetProperty(getPropertyImpl) {
|
|
663
|
-
getProperty$1 = getPropertyImpl;
|
|
664
|
-
}
|
|
665
|
-
let setProperty$1;
|
|
666
|
-
function setSetProperty(setPropertyImpl) {
|
|
667
|
-
setProperty$1 = setPropertyImpl;
|
|
668
|
-
}
|
|
669
|
-
let setText$1;
|
|
670
|
-
function setSetText(setTextImpl) {
|
|
671
|
-
setText$1 = setTextImpl;
|
|
672
|
-
}
|
|
673
|
-
let getAttribute$1;
|
|
674
|
-
function setGetAttribute(getAttributeImpl) {
|
|
675
|
-
getAttribute$1 = getAttributeImpl;
|
|
676
|
-
}
|
|
677
|
-
let setAttribute$1;
|
|
678
|
-
function setSetAttribute(setAttributeImpl) {
|
|
679
|
-
setAttribute$1 = setAttributeImpl;
|
|
680
|
-
}
|
|
681
|
-
let removeAttribute$1;
|
|
682
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
683
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
684
|
-
}
|
|
685
|
-
let addEventListener$1;
|
|
686
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
687
|
-
addEventListener$1 = addEventListenerImpl;
|
|
688
|
-
}
|
|
689
|
-
let removeEventListener$1;
|
|
690
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
691
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
692
|
-
}
|
|
693
|
-
let dispatchEvent$1;
|
|
694
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
695
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
696
|
-
}
|
|
697
|
-
let getClassList$1;
|
|
698
|
-
function setGetClassList(getClassListImpl) {
|
|
699
|
-
getClassList$1 = getClassListImpl;
|
|
700
|
-
}
|
|
701
|
-
let setCSSStyleProperty$1;
|
|
702
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
703
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
704
|
-
}
|
|
705
|
-
let getBoundingClientRect$1;
|
|
706
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
707
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
708
|
-
}
|
|
709
|
-
let querySelector$1;
|
|
710
|
-
function setQuerySelector(querySelectorImpl) {
|
|
711
|
-
querySelector$1 = querySelectorImpl;
|
|
712
|
-
}
|
|
713
|
-
let querySelectorAll$1;
|
|
714
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
715
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
716
|
-
}
|
|
717
|
-
let getElementsByTagName$1;
|
|
718
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
719
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
720
|
-
}
|
|
721
|
-
let getElementsByClassName$1;
|
|
722
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
723
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
724
|
-
}
|
|
725
|
-
let getChildren$1;
|
|
726
|
-
function setGetChildren(getChildrenImpl) {
|
|
727
|
-
getChildren$1 = getChildrenImpl;
|
|
728
|
-
}
|
|
729
|
-
let getChildNodes$1;
|
|
730
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
731
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
732
|
-
}
|
|
733
|
-
let getFirstChild$1;
|
|
734
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
735
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
736
|
-
}
|
|
737
|
-
let getFirstElementChild$1;
|
|
738
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
739
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
740
|
-
}
|
|
741
|
-
let getLastChild$1;
|
|
742
|
-
function setGetLastChild(getLastChildImpl) {
|
|
743
|
-
getLastChild$1 = getLastChildImpl;
|
|
744
|
-
}
|
|
745
|
-
let getLastElementChild$1;
|
|
746
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
747
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
748
|
-
}
|
|
749
|
-
let isConnected$1;
|
|
750
|
-
function setIsConnected(isConnectedImpl) {
|
|
751
|
-
isConnected$1 = isConnectedImpl;
|
|
752
|
-
}
|
|
753
|
-
let insertStylesheet$1;
|
|
754
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
755
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
756
|
-
}
|
|
757
|
-
let assertInstanceOfHTMLElement$1;
|
|
758
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
759
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
760
|
-
}
|
|
761
|
-
let defineCustomElement$1;
|
|
762
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
763
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
764
|
-
}
|
|
765
|
-
let getCustomElement$1;
|
|
766
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
767
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
614
|
/*
|
|
771
615
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
772
616
|
* All rights reserved.
|
|
@@ -2068,7 +1912,8 @@ const LightningElement = function () {
|
|
|
2068
1912
|
const { def, elm } = vm;
|
|
2069
1913
|
const { bridge } = def;
|
|
2070
1914
|
if (process.env.NODE_ENV !== 'production') {
|
|
2071
|
-
|
|
1915
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1916
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2072
1917
|
}
|
|
2073
1918
|
const component = this;
|
|
2074
1919
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2102,8 +1947,8 @@ const LightningElement = function () {
|
|
|
2102
1947
|
return this;
|
|
2103
1948
|
};
|
|
2104
1949
|
function doAttachShadow(vm) {
|
|
2105
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2106
|
-
const shadowRoot = attachShadow
|
|
1950
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1951
|
+
const shadowRoot = attachShadow(elm, {
|
|
2107
1952
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2108
1953
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2109
1954
|
mode,
|
|
@@ -2124,12 +1969,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
2124
1969
|
LightningElement.prototype = {
|
|
2125
1970
|
constructor: LightningElement,
|
|
2126
1971
|
dispatchEvent(event) {
|
|
2127
|
-
const
|
|
2128
|
-
|
|
1972
|
+
const vm = getAssociatedVM(this);
|
|
1973
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1974
|
+
return dispatchEvent(elm, event);
|
|
2129
1975
|
},
|
|
2130
1976
|
addEventListener(type, listener, options) {
|
|
2131
1977
|
const vm = getAssociatedVM(this);
|
|
2132
|
-
const { elm } = vm;
|
|
1978
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2133
1979
|
if (process.env.NODE_ENV !== 'production') {
|
|
2134
1980
|
const vmBeingRendered = getVMBeingRendered();
|
|
2135
1981
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2137,83 +1983,91 @@ LightningElement.prototype = {
|
|
|
2137
1983
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2138
1984
|
}
|
|
2139
1985
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2140
|
-
addEventListener
|
|
1986
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2141
1987
|
},
|
|
2142
1988
|
removeEventListener(type, listener, options) {
|
|
2143
1989
|
const vm = getAssociatedVM(this);
|
|
2144
|
-
const { elm } = vm;
|
|
1990
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2145
1991
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2146
|
-
removeEventListener
|
|
1992
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2147
1993
|
},
|
|
2148
1994
|
hasAttribute(name) {
|
|
2149
|
-
const
|
|
2150
|
-
|
|
1995
|
+
const vm = getAssociatedVM(this);
|
|
1996
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1997
|
+
return !isNull(getAttribute(elm, name));
|
|
2151
1998
|
},
|
|
2152
1999
|
hasAttributeNS(namespace, name) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2000
|
+
const vm = getAssociatedVM(this);
|
|
2001
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2002
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2155
2003
|
},
|
|
2156
2004
|
removeAttribute(name) {
|
|
2157
|
-
const
|
|
2005
|
+
const vm = getAssociatedVM(this);
|
|
2006
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2158
2007
|
unlockAttribute(elm, name);
|
|
2159
|
-
removeAttribute
|
|
2008
|
+
removeAttribute(elm, name);
|
|
2160
2009
|
lockAttribute();
|
|
2161
2010
|
},
|
|
2162
2011
|
removeAttributeNS(namespace, name) {
|
|
2163
|
-
const { elm } = getAssociatedVM(this);
|
|
2012
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2164
2013
|
unlockAttribute(elm, name);
|
|
2165
|
-
removeAttribute
|
|
2014
|
+
removeAttribute(elm, name, namespace);
|
|
2166
2015
|
lockAttribute();
|
|
2167
2016
|
},
|
|
2168
2017
|
getAttribute(name) {
|
|
2169
|
-
const
|
|
2170
|
-
|
|
2018
|
+
const vm = getAssociatedVM(this);
|
|
2019
|
+
const { elm } = vm;
|
|
2020
|
+
const { getAttribute } = vm.renderer;
|
|
2021
|
+
return getAttribute(elm, name);
|
|
2171
2022
|
},
|
|
2172
2023
|
getAttributeNS(namespace, name) {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2024
|
+
const vm = getAssociatedVM(this);
|
|
2025
|
+
const { elm } = vm;
|
|
2026
|
+
const { getAttribute } = vm.renderer;
|
|
2027
|
+
return getAttribute(elm, name, namespace);
|
|
2175
2028
|
},
|
|
2176
2029
|
setAttribute(name, value) {
|
|
2177
2030
|
const vm = getAssociatedVM(this);
|
|
2178
|
-
const { elm } = vm;
|
|
2031
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2179
2032
|
if (process.env.NODE_ENV !== 'production') {
|
|
2180
2033
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2181
2034
|
}
|
|
2182
2035
|
unlockAttribute(elm, name);
|
|
2183
|
-
setAttribute
|
|
2036
|
+
setAttribute(elm, name, value);
|
|
2184
2037
|
lockAttribute();
|
|
2185
2038
|
},
|
|
2186
2039
|
setAttributeNS(namespace, name, value) {
|
|
2187
2040
|
const vm = getAssociatedVM(this);
|
|
2188
|
-
const { elm } = vm;
|
|
2041
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2189
2042
|
if (process.env.NODE_ENV !== 'production') {
|
|
2190
2043
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2191
2044
|
}
|
|
2192
2045
|
unlockAttribute(elm, name);
|
|
2193
|
-
setAttribute
|
|
2046
|
+
setAttribute(elm, name, value, namespace);
|
|
2194
2047
|
lockAttribute();
|
|
2195
2048
|
},
|
|
2196
2049
|
getBoundingClientRect() {
|
|
2197
2050
|
const vm = getAssociatedVM(this);
|
|
2198
|
-
const { elm } = vm;
|
|
2051
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2199
2052
|
if (process.env.NODE_ENV !== 'production') {
|
|
2200
2053
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2201
2054
|
}
|
|
2202
|
-
return getBoundingClientRect
|
|
2055
|
+
return getBoundingClientRect(elm);
|
|
2203
2056
|
},
|
|
2204
2057
|
get isConnected() {
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2058
|
+
const vm = getAssociatedVM(this);
|
|
2059
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2060
|
+
return isConnected(elm);
|
|
2207
2061
|
},
|
|
2208
2062
|
get classList() {
|
|
2209
2063
|
const vm = getAssociatedVM(this);
|
|
2210
|
-
const { elm } = vm;
|
|
2064
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2211
2065
|
if (process.env.NODE_ENV !== 'production') {
|
|
2212
2066
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2213
2067
|
// just throw in all modes
|
|
2214
2068
|
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.`);
|
|
2215
2069
|
}
|
|
2216
|
-
return getClassList
|
|
2070
|
+
return getClassList(elm);
|
|
2217
2071
|
},
|
|
2218
2072
|
get template() {
|
|
2219
2073
|
const vm = getAssociatedVM(this);
|
|
@@ -2229,6 +2083,54 @@ LightningElement.prototype = {
|
|
|
2229
2083
|
// Authors should rely on this.template instead.
|
|
2230
2084
|
return null;
|
|
2231
2085
|
},
|
|
2086
|
+
get children() {
|
|
2087
|
+
const vm = getAssociatedVM(this);
|
|
2088
|
+
const renderer = vm.renderer;
|
|
2089
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2090
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2091
|
+
}
|
|
2092
|
+
return renderer.getChildren(vm.elm);
|
|
2093
|
+
},
|
|
2094
|
+
get childNodes() {
|
|
2095
|
+
const vm = getAssociatedVM(this);
|
|
2096
|
+
const renderer = vm.renderer;
|
|
2097
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2098
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2099
|
+
}
|
|
2100
|
+
return renderer.getChildNodes(vm.elm);
|
|
2101
|
+
},
|
|
2102
|
+
get firstChild() {
|
|
2103
|
+
const vm = getAssociatedVM(this);
|
|
2104
|
+
const renderer = vm.renderer;
|
|
2105
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2106
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2107
|
+
}
|
|
2108
|
+
return renderer.getFirstChild(vm.elm);
|
|
2109
|
+
},
|
|
2110
|
+
get firstElementChild() {
|
|
2111
|
+
const vm = getAssociatedVM(this);
|
|
2112
|
+
const renderer = vm.renderer;
|
|
2113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2114
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2115
|
+
}
|
|
2116
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2117
|
+
},
|
|
2118
|
+
get lastChild() {
|
|
2119
|
+
const vm = getAssociatedVM(this);
|
|
2120
|
+
const renderer = vm.renderer;
|
|
2121
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2122
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2123
|
+
}
|
|
2124
|
+
return renderer.getLastChild(vm.elm);
|
|
2125
|
+
},
|
|
2126
|
+
get lastElementChild() {
|
|
2127
|
+
const vm = getAssociatedVM(this);
|
|
2128
|
+
const renderer = vm.renderer;
|
|
2129
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2130
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2131
|
+
}
|
|
2132
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2133
|
+
},
|
|
2232
2134
|
render() {
|
|
2233
2135
|
const vm = getAssociatedVM(this);
|
|
2234
2136
|
return vm.def.template;
|
|
@@ -2239,76 +2141,22 @@ LightningElement.prototype = {
|
|
|
2239
2141
|
},
|
|
2240
2142
|
};
|
|
2241
2143
|
const queryAndChildGetterDescriptors = create(null);
|
|
2242
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2243
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2244
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2245
|
-
const childGetters = [
|
|
2246
|
-
'children',
|
|
2247
|
-
'childNodes',
|
|
2248
|
-
'firstChild',
|
|
2249
|
-
'firstElementChild',
|
|
2250
|
-
'lastChild',
|
|
2251
|
-
'lastElementChild',
|
|
2252
|
-
];
|
|
2253
|
-
function getChildGetter(methodName) {
|
|
2254
|
-
switch (methodName) {
|
|
2255
|
-
case 'children':
|
|
2256
|
-
return getChildren$1;
|
|
2257
|
-
case 'childNodes':
|
|
2258
|
-
return getChildNodes$1;
|
|
2259
|
-
case 'firstChild':
|
|
2260
|
-
return getFirstChild$1;
|
|
2261
|
-
case 'firstElementChild':
|
|
2262
|
-
return getFirstElementChild$1;
|
|
2263
|
-
case 'lastChild':
|
|
2264
|
-
return getLastChild$1;
|
|
2265
|
-
case 'lastElementChild':
|
|
2266
|
-
return getLastElementChild$1;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2270
|
-
for (const childGetter of childGetters) {
|
|
2271
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2272
|
-
get() {
|
|
2273
|
-
const vm = getAssociatedVM(this);
|
|
2274
|
-
const { elm } = vm;
|
|
2275
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2276
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2277
|
-
}
|
|
2278
|
-
return getChildGetter(childGetter)(elm);
|
|
2279
|
-
},
|
|
2280
|
-
configurable: true,
|
|
2281
|
-
enumerable: true,
|
|
2282
|
-
};
|
|
2283
|
-
}
|
|
2284
2144
|
const queryMethods = [
|
|
2285
2145
|
'getElementsByClassName',
|
|
2286
2146
|
'getElementsByTagName',
|
|
2287
2147
|
'querySelector',
|
|
2288
2148
|
'querySelectorAll',
|
|
2289
2149
|
];
|
|
2290
|
-
function getQueryMethod(methodName) {
|
|
2291
|
-
switch (methodName) {
|
|
2292
|
-
case 'getElementsByClassName':
|
|
2293
|
-
return getElementsByClassName$1;
|
|
2294
|
-
case 'getElementsByTagName':
|
|
2295
|
-
return getElementsByTagName$1;
|
|
2296
|
-
case 'querySelector':
|
|
2297
|
-
return querySelector$1;
|
|
2298
|
-
case 'querySelectorAll':
|
|
2299
|
-
return querySelectorAll$1;
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
2150
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2303
2151
|
for (const queryMethod of queryMethods) {
|
|
2304
2152
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2305
2153
|
value(arg) {
|
|
2306
2154
|
const vm = getAssociatedVM(this);
|
|
2307
|
-
const { elm } = vm;
|
|
2155
|
+
const { elm, renderer } = vm;
|
|
2308
2156
|
if (process.env.NODE_ENV !== 'production') {
|
|
2309
2157
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2310
2158
|
}
|
|
2311
|
-
return
|
|
2159
|
+
return renderer[queryMethod](elm, arg);
|
|
2312
2160
|
},
|
|
2313
2161
|
configurable: true,
|
|
2314
2162
|
enumerable: true,
|
|
@@ -2813,7 +2661,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2813
2661
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2814
2662
|
*/
|
|
2815
2663
|
let warned = false;
|
|
2816
|
-
|
|
2664
|
+
// @ts-ignore
|
|
2665
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2817
2666
|
// @ts-ignore
|
|
2818
2667
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2819
2668
|
warned = false;
|
|
@@ -3410,12 +3259,13 @@ function getComponentDef(Ctor) {
|
|
|
3410
3259
|
* SPDX-License-Identifier: MIT
|
|
3411
3260
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3412
3261
|
*/
|
|
3413
|
-
function getUpgradableConstructor(tagName) {
|
|
3262
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3263
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3414
3264
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3415
3265
|
// produce only tags with lowercase letters
|
|
3416
3266
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3417
3267
|
tagName = tagName.toLowerCase();
|
|
3418
|
-
let CE = getCustomElement
|
|
3268
|
+
let CE = getCustomElement(tagName);
|
|
3419
3269
|
if (!isUndefined$1(CE)) {
|
|
3420
3270
|
return CE;
|
|
3421
3271
|
}
|
|
@@ -3423,7 +3273,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3423
3273
|
* LWC Upgradable Element reference to an element that was created
|
|
3424
3274
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3425
3275
|
*/
|
|
3426
|
-
CE = class LWCUpgradableElement extends
|
|
3276
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3427
3277
|
constructor(upgradeCallback) {
|
|
3428
3278
|
super();
|
|
3429
3279
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3431,7 +3281,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3431
3281
|
}
|
|
3432
3282
|
}
|
|
3433
3283
|
};
|
|
3434
|
-
defineCustomElement
|
|
3284
|
+
defineCustomElement(tagName, CE);
|
|
3435
3285
|
return CE;
|
|
3436
3286
|
}
|
|
3437
3287
|
|
|
@@ -3456,7 +3306,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3456
3306
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3457
3307
|
*/
|
|
3458
3308
|
const ColonCharCode = 58;
|
|
3459
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3309
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3460
3310
|
const { attrs } = vnode.data;
|
|
3461
3311
|
if (isUndefined$1(attrs)) {
|
|
3462
3312
|
return;
|
|
@@ -3466,6 +3316,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3466
3316
|
return;
|
|
3467
3317
|
}
|
|
3468
3318
|
const { elm } = vnode;
|
|
3319
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3469
3320
|
for (const key in attrs) {
|
|
3470
3321
|
const cur = attrs[key];
|
|
3471
3322
|
const old = oldAttrs[key];
|
|
@@ -3473,17 +3324,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3473
3324
|
unlockAttribute(elm, key);
|
|
3474
3325
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3475
3326
|
// Assume xml namespace
|
|
3476
|
-
setAttribute
|
|
3327
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3477
3328
|
}
|
|
3478
3329
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3479
3330
|
// Assume xlink namespace
|
|
3480
|
-
setAttribute
|
|
3331
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3481
3332
|
}
|
|
3482
3333
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3483
|
-
removeAttribute
|
|
3334
|
+
removeAttribute(elm, key);
|
|
3484
3335
|
}
|
|
3485
3336
|
else {
|
|
3486
|
-
setAttribute
|
|
3337
|
+
setAttribute(elm, key, cur);
|
|
3487
3338
|
}
|
|
3488
3339
|
lockAttribute();
|
|
3489
3340
|
}
|
|
@@ -3501,7 +3352,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3501
3352
|
// instead of relying on internally tracked values.
|
|
3502
3353
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3503
3354
|
}
|
|
3504
|
-
function patchProps(oldVnode, vnode) {
|
|
3355
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3505
3356
|
const { props } = vnode.data;
|
|
3506
3357
|
if (isUndefined$1(props)) {
|
|
3507
3358
|
return;
|
|
@@ -3512,13 +3363,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3512
3363
|
}
|
|
3513
3364
|
const isFirstPatch = isNull(oldVnode);
|
|
3514
3365
|
const { elm, sel } = vnode;
|
|
3366
|
+
const { getProperty, setProperty } = renderer;
|
|
3515
3367
|
for (const key in props) {
|
|
3516
3368
|
const cur = props[key];
|
|
3517
3369
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3518
3370
|
// different than the one previously set.
|
|
3519
3371
|
if (isFirstPatch ||
|
|
3520
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3521
|
-
setProperty
|
|
3372
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3373
|
+
setProperty(elm, key, cur);
|
|
3522
3374
|
}
|
|
3523
3375
|
}
|
|
3524
3376
|
}
|
|
@@ -3563,13 +3415,14 @@ function getMapFromClassName(className) {
|
|
|
3563
3415
|
}
|
|
3564
3416
|
return map;
|
|
3565
3417
|
}
|
|
3566
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3418
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3567
3419
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3568
3420
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3569
3421
|
if (oldClass === newClass) {
|
|
3570
3422
|
return;
|
|
3571
3423
|
}
|
|
3572
|
-
const
|
|
3424
|
+
const { getClassList } = renderer;
|
|
3425
|
+
const classList = getClassList(elm);
|
|
3573
3426
|
const newClassMap = getMapFromClassName(newClass);
|
|
3574
3427
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3575
3428
|
let name;
|
|
@@ -3593,17 +3446,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3593
3446
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3594
3447
|
*/
|
|
3595
3448
|
// The style property is a string when defined via an expression in the template.
|
|
3596
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3449
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3597
3450
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3598
3451
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3599
3452
|
if (oldStyle === newStyle) {
|
|
3600
3453
|
return;
|
|
3601
3454
|
}
|
|
3455
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3602
3456
|
if (!isString(newStyle) || newStyle === '') {
|
|
3603
|
-
removeAttribute
|
|
3457
|
+
removeAttribute(elm, 'style');
|
|
3604
3458
|
}
|
|
3605
3459
|
else {
|
|
3606
|
-
setAttribute
|
|
3460
|
+
setAttribute(elm, 'style', newStyle);
|
|
3607
3461
|
}
|
|
3608
3462
|
}
|
|
3609
3463
|
|
|
@@ -3613,14 +3467,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3613
3467
|
* SPDX-License-Identifier: MIT
|
|
3614
3468
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3615
3469
|
*/
|
|
3616
|
-
function applyEventListeners(vnode) {
|
|
3470
|
+
function applyEventListeners(vnode, renderer) {
|
|
3617
3471
|
const { elm, data: { on }, } = vnode;
|
|
3618
3472
|
if (isUndefined$1(on)) {
|
|
3619
3473
|
return;
|
|
3620
3474
|
}
|
|
3475
|
+
const { addEventListener } = renderer;
|
|
3621
3476
|
for (const name in on) {
|
|
3622
3477
|
const handler = on[name];
|
|
3623
|
-
addEventListener
|
|
3478
|
+
addEventListener(elm, name, handler);
|
|
3624
3479
|
}
|
|
3625
3480
|
}
|
|
3626
3481
|
|
|
@@ -3633,12 +3488,13 @@ function applyEventListeners(vnode) {
|
|
|
3633
3488
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3634
3489
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3635
3490
|
// different classnames properties individually instead of via a string.
|
|
3636
|
-
function applyStaticClassAttribute(vnode) {
|
|
3491
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3637
3492
|
const { elm, data: { classMap }, } = vnode;
|
|
3638
3493
|
if (isUndefined$1(classMap)) {
|
|
3639
3494
|
return;
|
|
3640
3495
|
}
|
|
3641
|
-
const
|
|
3496
|
+
const { getClassList } = renderer;
|
|
3497
|
+
const classList = getClassList(elm);
|
|
3642
3498
|
for (const name in classMap) {
|
|
3643
3499
|
classList.add(name);
|
|
3644
3500
|
}
|
|
@@ -3653,14 +3509,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3653
3509
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3654
3510
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3655
3511
|
// different style properties individually instead of via a string.
|
|
3656
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3512
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3657
3513
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3658
3514
|
if (isUndefined$1(styleDecls)) {
|
|
3659
3515
|
return;
|
|
3660
3516
|
}
|
|
3517
|
+
const { setCSSStyleProperty } = renderer;
|
|
3661
3518
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3662
3519
|
const [prop, value, important] = styleDecls[i];
|
|
3663
|
-
setCSSStyleProperty
|
|
3520
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3664
3521
|
}
|
|
3665
3522
|
}
|
|
3666
3523
|
|
|
@@ -3670,15 +3527,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3670
3527
|
* SPDX-License-Identifier: MIT
|
|
3671
3528
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3672
3529
|
*/
|
|
3673
|
-
function patchChildren(c1, c2, parent) {
|
|
3530
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3674
3531
|
if (hasDynamicChildren(c2)) {
|
|
3675
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3532
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3676
3533
|
}
|
|
3677
3534
|
else {
|
|
3678
|
-
updateStaticChildren(c1, c2, parent);
|
|
3535
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3679
3536
|
}
|
|
3680
3537
|
}
|
|
3681
|
-
function patch(n1, n2) {
|
|
3538
|
+
function patch(n1, n2, renderer) {
|
|
3539
|
+
var _a, _b;
|
|
3682
3540
|
if (n1 === n2) {
|
|
3683
3541
|
return;
|
|
3684
3542
|
}
|
|
@@ -3692,80 +3550,90 @@ function patch(n1, n2) {
|
|
|
3692
3550
|
}
|
|
3693
3551
|
switch (n2.type) {
|
|
3694
3552
|
case 0 /* Text */:
|
|
3695
|
-
|
|
3553
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3554
|
+
patchText(n1, n2, renderer);
|
|
3696
3555
|
break;
|
|
3697
3556
|
case 1 /* Comment */:
|
|
3698
|
-
|
|
3557
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3558
|
+
patchComment(n1, n2, renderer);
|
|
3699
3559
|
break;
|
|
3700
3560
|
case 2 /* Element */:
|
|
3701
|
-
patchElement(n1, n2);
|
|
3561
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3702
3562
|
break;
|
|
3703
3563
|
case 3 /* CustomElement */:
|
|
3704
|
-
patchCustomElement(n1, n2);
|
|
3564
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3705
3565
|
break;
|
|
3706
3566
|
}
|
|
3707
3567
|
}
|
|
3708
|
-
function mount(node, parent, anchor) {
|
|
3568
|
+
function mount(node, parent, renderer, anchor) {
|
|
3569
|
+
var _a, _b;
|
|
3709
3570
|
switch (node.type) {
|
|
3710
3571
|
case 0 /* Text */:
|
|
3711
|
-
|
|
3572
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3573
|
+
mountText(node, parent, anchor, renderer);
|
|
3712
3574
|
break;
|
|
3713
3575
|
case 1 /* Comment */:
|
|
3714
|
-
|
|
3576
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3577
|
+
mountComment(node, parent, anchor, renderer);
|
|
3715
3578
|
break;
|
|
3716
3579
|
case 2 /* Element */:
|
|
3717
|
-
|
|
3580
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3581
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3718
3582
|
break;
|
|
3719
3583
|
case 3 /* CustomElement */:
|
|
3720
|
-
|
|
3584
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3585
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3721
3586
|
break;
|
|
3722
3587
|
}
|
|
3723
3588
|
}
|
|
3724
|
-
function patchText(n1, n2) {
|
|
3589
|
+
function patchText(n1, n2, renderer) {
|
|
3725
3590
|
n2.elm = n1.elm;
|
|
3726
3591
|
if (n2.text !== n1.text) {
|
|
3727
|
-
updateTextContent(n2);
|
|
3592
|
+
updateTextContent(n2, renderer);
|
|
3728
3593
|
}
|
|
3729
3594
|
}
|
|
3730
|
-
function mountText(
|
|
3731
|
-
const { owner } =
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
|
|
3595
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3596
|
+
const { owner } = vnode;
|
|
3597
|
+
const { createText } = renderer;
|
|
3598
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3599
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3600
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3735
3601
|
}
|
|
3736
|
-
function patchComment(n1, n2) {
|
|
3602
|
+
function patchComment(n1, n2, renderer) {
|
|
3737
3603
|
n2.elm = n1.elm;
|
|
3738
3604
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3739
3605
|
// it is the case today.
|
|
3740
3606
|
if (n2.text !== n1.text) {
|
|
3741
|
-
updateTextContent(n2);
|
|
3607
|
+
updateTextContent(n2, renderer);
|
|
3742
3608
|
}
|
|
3743
3609
|
}
|
|
3744
|
-
function mountComment(
|
|
3745
|
-
const { owner } =
|
|
3746
|
-
const
|
|
3747
|
-
|
|
3748
|
-
|
|
3610
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3611
|
+
const { owner } = vnode;
|
|
3612
|
+
const { createComment } = renderer;
|
|
3613
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3614
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3615
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3749
3616
|
}
|
|
3750
|
-
function mountElement(vnode, parent, anchor) {
|
|
3617
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3751
3618
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3619
|
+
const { createElement } = renderer;
|
|
3752
3620
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3753
|
-
const elm = createElement
|
|
3754
|
-
linkNodeToShadow(elm, owner);
|
|
3755
|
-
fallbackElmHook(elm, vnode);
|
|
3621
|
+
const elm = createElement(sel, namespace);
|
|
3622
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3623
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3756
3624
|
vnode.elm = elm;
|
|
3757
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3758
|
-
insertNode(elm, parent, anchor);
|
|
3759
|
-
mountVNodes(vnode.children, elm, null);
|
|
3625
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3626
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3627
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3760
3628
|
}
|
|
3761
|
-
function patchElement(n1, n2) {
|
|
3629
|
+
function patchElement(n1, n2, renderer) {
|
|
3762
3630
|
const elm = (n2.elm = n1.elm);
|
|
3763
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3764
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3631
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3632
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3765
3633
|
}
|
|
3766
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3634
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3767
3635
|
const { sel, owner } = vnode;
|
|
3768
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3636
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3769
3637
|
/**
|
|
3770
3638
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3771
3639
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3775,9 +3643,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3775
3643
|
let vm;
|
|
3776
3644
|
const elm = new UpgradableConstructor((elm) => {
|
|
3777
3645
|
// the custom element from the registry is expecting an upgrade callback
|
|
3778
|
-
vm = createViewModelHook(elm, vnode);
|
|
3646
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3779
3647
|
});
|
|
3780
|
-
linkNodeToShadow(elm, owner);
|
|
3648
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3781
3649
|
vnode.elm = elm;
|
|
3782
3650
|
vnode.vm = vm;
|
|
3783
3651
|
if (vm) {
|
|
@@ -3786,23 +3654,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3786
3654
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3787
3655
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3788
3656
|
}
|
|
3789
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3790
|
-
insertNode(elm, parent, anchor);
|
|
3657
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3658
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3791
3659
|
if (vm) {
|
|
3792
3660
|
if (process.env.NODE_ENV !== 'production') {
|
|
3793
3661
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3794
3662
|
}
|
|
3795
3663
|
runConnectedCallback(vm);
|
|
3796
3664
|
}
|
|
3797
|
-
mountVNodes(vnode.children, elm, null);
|
|
3665
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3798
3666
|
if (vm) {
|
|
3799
3667
|
appendVM(vm);
|
|
3800
3668
|
}
|
|
3801
3669
|
}
|
|
3802
|
-
function patchCustomElement(n1, n2) {
|
|
3670
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3803
3671
|
const elm = (n2.elm = n1.elm);
|
|
3804
3672
|
const vm = (n2.vm = n1.vm);
|
|
3805
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3673
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3806
3674
|
if (!isUndefined$1(vm)) {
|
|
3807
3675
|
// in fallback mode, the allocation will always set children to
|
|
3808
3676
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3810,33 +3678,38 @@ function patchCustomElement(n1, n2) {
|
|
|
3810
3678
|
}
|
|
3811
3679
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3812
3680
|
// will happen, but in native, it does allocate the light dom
|
|
3813
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3681
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3814
3682
|
if (!isUndefined$1(vm)) {
|
|
3815
3683
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3816
3684
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3817
3685
|
rerenderVM(vm);
|
|
3818
3686
|
}
|
|
3819
3687
|
}
|
|
3820
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3688
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3821
3689
|
for (; start < end; ++start) {
|
|
3822
3690
|
const vnode = vnodes[start];
|
|
3823
3691
|
if (isVNode(vnode)) {
|
|
3824
|
-
mount(vnode, parent, anchor);
|
|
3692
|
+
mount(vnode, parent, renderer, anchor);
|
|
3825
3693
|
}
|
|
3826
3694
|
}
|
|
3827
3695
|
}
|
|
3828
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3696
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3829
3697
|
const { type, elm, sel } = vnode;
|
|
3830
3698
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3831
3699
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3832
3700
|
if (doRemove) {
|
|
3833
|
-
|
|
3701
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3702
|
+
// but the removal used here is from the owner instead.
|
|
3703
|
+
removeNode(elm, parent, renderer);
|
|
3834
3704
|
}
|
|
3835
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3836
3705
|
switch (type) {
|
|
3837
|
-
case 2 /* Element */:
|
|
3838
|
-
|
|
3706
|
+
case 2 /* Element */: {
|
|
3707
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3708
|
+
// Only required for synthetic shadow.
|
|
3709
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3710
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3839
3711
|
break;
|
|
3712
|
+
}
|
|
3840
3713
|
case 3 /* CustomElement */: {
|
|
3841
3714
|
const { vm } = vnode;
|
|
3842
3715
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -3847,11 +3720,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3847
3720
|
}
|
|
3848
3721
|
}
|
|
3849
3722
|
}
|
|
3850
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3723
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3851
3724
|
for (; start < end; ++start) {
|
|
3852
3725
|
const ch = vnodes[start];
|
|
3853
3726
|
if (isVNode(ch)) {
|
|
3854
|
-
unmount(ch, parent, doRemove);
|
|
3727
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3855
3728
|
}
|
|
3856
3729
|
}
|
|
3857
3730
|
}
|
|
@@ -3865,66 +3738,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3865
3738
|
elm.$shadowToken$ = token;
|
|
3866
3739
|
}
|
|
3867
3740
|
// Set the scope token class for *.scoped.css styles
|
|
3868
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3741
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3869
3742
|
const { cmpTemplate, context } = owner;
|
|
3743
|
+
const { getClassList } = renderer;
|
|
3870
3744
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3871
3745
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3872
|
-
|
|
3746
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3747
|
+
// probably we should have a renderer api for just the add operation
|
|
3748
|
+
getClassList(elm).add(token);
|
|
3873
3749
|
}
|
|
3874
3750
|
}
|
|
3875
|
-
function linkNodeToShadow(elm, owner) {
|
|
3751
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3876
3752
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3753
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3877
3754
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3878
|
-
if (isSyntheticShadowDefined
|
|
3755
|
+
if (isSyntheticShadowDefined) {
|
|
3879
3756
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3880
3757
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3881
3758
|
}
|
|
3882
3759
|
}
|
|
3883
3760
|
}
|
|
3884
|
-
function updateTextContent(vnode) {
|
|
3761
|
+
function updateTextContent(vnode, renderer) {
|
|
3885
3762
|
const { elm, text } = vnode;
|
|
3763
|
+
const { setText } = renderer;
|
|
3886
3764
|
if (process.env.NODE_ENV !== 'production') {
|
|
3887
3765
|
unlockDomMutation();
|
|
3888
3766
|
}
|
|
3889
|
-
setText
|
|
3767
|
+
setText(elm, text);
|
|
3890
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3891
3769
|
lockDomMutation();
|
|
3892
3770
|
}
|
|
3893
3771
|
}
|
|
3894
|
-
function insertNode(node, parent, anchor) {
|
|
3772
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3895
3773
|
if (process.env.NODE_ENV !== 'production') {
|
|
3896
3774
|
unlockDomMutation();
|
|
3897
3775
|
}
|
|
3898
|
-
insert
|
|
3776
|
+
renderer.insert(node, parent, anchor);
|
|
3899
3777
|
if (process.env.NODE_ENV !== 'production') {
|
|
3900
3778
|
lockDomMutation();
|
|
3901
3779
|
}
|
|
3902
3780
|
}
|
|
3903
|
-
function removeNode(node, parent) {
|
|
3781
|
+
function removeNode(node, parent, renderer) {
|
|
3904
3782
|
if (process.env.NODE_ENV !== 'production') {
|
|
3905
3783
|
unlockDomMutation();
|
|
3906
3784
|
}
|
|
3907
|
-
remove
|
|
3785
|
+
renderer.remove(node, parent);
|
|
3908
3786
|
if (process.env.NODE_ENV !== 'production') {
|
|
3909
3787
|
lockDomMutation();
|
|
3910
3788
|
}
|
|
3911
3789
|
}
|
|
3912
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3790
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3913
3791
|
if (isNull(oldVnode)) {
|
|
3914
|
-
applyEventListeners(vnode);
|
|
3915
|
-
applyStaticClassAttribute(vnode);
|
|
3916
|
-
applyStaticStyleAttribute(vnode);
|
|
3792
|
+
applyEventListeners(vnode, renderer);
|
|
3793
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3794
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3917
3795
|
}
|
|
3918
3796
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3919
3797
|
// value is set before type=radio.
|
|
3920
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3921
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3922
|
-
patchAttributes(oldVnode, vnode);
|
|
3923
|
-
patchProps(oldVnode, vnode);
|
|
3798
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3799
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3800
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3801
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3924
3802
|
}
|
|
3925
|
-
function fallbackElmHook(elm, vnode) {
|
|
3803
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3926
3804
|
const { owner } = vnode;
|
|
3927
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3805
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3928
3806
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3929
3807
|
const { data: { context }, } = vnode;
|
|
3930
3808
|
const { stylesheetToken } = owner.context;
|
|
@@ -3972,7 +3850,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3972
3850
|
vnode.children = EmptyArray;
|
|
3973
3851
|
}
|
|
3974
3852
|
}
|
|
3975
|
-
function createViewModelHook(elm, vnode) {
|
|
3853
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3976
3854
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3977
3855
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3978
3856
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3981,7 +3859,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3981
3859
|
return vm;
|
|
3982
3860
|
}
|
|
3983
3861
|
const { sel, mode, ctor, owner } = vnode;
|
|
3984
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3862
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3985
3863
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3986
3864
|
const { stylesheetToken } = owner.context;
|
|
3987
3865
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3990,7 +3868,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3990
3868
|
setElementShadowToken(elm, stylesheetToken);
|
|
3991
3869
|
}
|
|
3992
3870
|
}
|
|
3993
|
-
vm = createVM(elm, ctor, {
|
|
3871
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3994
3872
|
mode,
|
|
3995
3873
|
owner,
|
|
3996
3874
|
tagName: sel,
|
|
@@ -4065,7 +3943,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4065
3943
|
}
|
|
4066
3944
|
return map;
|
|
4067
3945
|
}
|
|
4068
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3946
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4069
3947
|
let oldStartIdx = 0;
|
|
4070
3948
|
let newStartIdx = 0;
|
|
4071
3949
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4094,26 +3972,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4094
3972
|
newEndVnode = newCh[--newEndIdx];
|
|
4095
3973
|
}
|
|
4096
3974
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4097
|
-
patch(oldStartVnode, newStartVnode);
|
|
3975
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4098
3976
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4099
3977
|
newStartVnode = newCh[++newStartIdx];
|
|
4100
3978
|
}
|
|
4101
3979
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4102
|
-
patch(oldEndVnode, newEndVnode);
|
|
3980
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4103
3981
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4104
3982
|
newEndVnode = newCh[--newEndIdx];
|
|
4105
3983
|
}
|
|
4106
3984
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4107
3985
|
// Vnode moved right
|
|
4108
|
-
patch(oldStartVnode, newEndVnode);
|
|
4109
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3986
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3987
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4110
3988
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4111
3989
|
newEndVnode = newCh[--newEndIdx];
|
|
4112
3990
|
}
|
|
4113
3991
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4114
3992
|
// Vnode moved left
|
|
4115
|
-
patch(oldEndVnode, newStartVnode);
|
|
4116
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3993
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3994
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4117
3995
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4118
3996
|
newStartVnode = newCh[++newStartIdx];
|
|
4119
3997
|
}
|
|
@@ -4124,7 +4002,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4124
4002
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4125
4003
|
if (isUndefined$1(idxInOld)) {
|
|
4126
4004
|
// New element
|
|
4127
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4005
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4128
4006
|
newStartVnode = newCh[++newStartIdx];
|
|
4129
4007
|
}
|
|
4130
4008
|
else {
|
|
@@ -4132,10 +4010,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4132
4010
|
if (isVNode(elmToMove)) {
|
|
4133
4011
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4134
4012
|
// New element
|
|
4135
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4013
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4136
4014
|
}
|
|
4137
4015
|
else {
|
|
4138
|
-
patch(elmToMove, newStartVnode);
|
|
4016
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4139
4017
|
// Delete the old child, but copy the array since it is read-only.
|
|
4140
4018
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4141
4019
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4147,7 +4025,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4147
4025
|
}
|
|
4148
4026
|
// We've already cloned at least once, so it's no longer read-only
|
|
4149
4027
|
oldCh[idxInOld] = undefined;
|
|
4150
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4028
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4151
4029
|
}
|
|
4152
4030
|
}
|
|
4153
4031
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4164,25 +4042,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4164
4042
|
n = newCh[++i];
|
|
4165
4043
|
} while (!isVNode(n) && i < newChEnd);
|
|
4166
4044
|
before = isVNode(n) ? n.elm : null;
|
|
4167
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4045
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4168
4046
|
}
|
|
4169
4047
|
else {
|
|
4170
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4048
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4171
4049
|
}
|
|
4172
4050
|
}
|
|
4173
4051
|
}
|
|
4174
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4052
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4175
4053
|
const c1Length = c1.length;
|
|
4176
4054
|
const c2Length = c2.length;
|
|
4177
4055
|
if (c1Length === 0) {
|
|
4178
4056
|
// the old list is empty, we can directly insert anything new
|
|
4179
|
-
mountVNodes(c2, parent, null);
|
|
4057
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4180
4058
|
return;
|
|
4181
4059
|
}
|
|
4182
4060
|
if (c2Length === 0) {
|
|
4183
4061
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4184
4062
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4185
|
-
unmountVNodes(c1, parent, true);
|
|
4063
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4186
4064
|
return;
|
|
4187
4065
|
}
|
|
4188
4066
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4195,16 +4073,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4195
4073
|
if (isVNode(n1)) {
|
|
4196
4074
|
if (isVNode(n2)) {
|
|
4197
4075
|
// both vnodes are equivalent, and we just need to patch them
|
|
4198
|
-
patch(n1, n2);
|
|
4076
|
+
patch(n1, n2, renderer);
|
|
4199
4077
|
anchor = n2.elm;
|
|
4200
4078
|
}
|
|
4201
4079
|
else {
|
|
4202
4080
|
// removing the old vnode since the new one is null
|
|
4203
|
-
unmount(n1, parent, true);
|
|
4081
|
+
unmount(n1, parent, renderer, true);
|
|
4204
4082
|
}
|
|
4205
4083
|
}
|
|
4206
4084
|
else if (isVNode(n2)) {
|
|
4207
|
-
mount(n2, parent, anchor);
|
|
4085
|
+
mount(n2, parent, renderer, anchor);
|
|
4208
4086
|
anchor = n2.elm;
|
|
4209
4087
|
}
|
|
4210
4088
|
}
|
|
@@ -4633,7 +4511,7 @@ function createInlineStyleVNode(content) {
|
|
|
4633
4511
|
}, [api.t(content)]);
|
|
4634
4512
|
}
|
|
4635
4513
|
function updateStylesheetToken(vm, template) {
|
|
4636
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4514
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4637
4515
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4638
4516
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4639
4517
|
const { hasScopedStyles } = context;
|
|
@@ -4644,10 +4522,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4644
4522
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4645
4523
|
if (!isUndefined$1(oldToken)) {
|
|
4646
4524
|
if (oldHasTokenInClass) {
|
|
4647
|
-
getClassList
|
|
4525
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4648
4526
|
}
|
|
4649
4527
|
if (oldHasTokenInAttribute) {
|
|
4650
|
-
removeAttribute
|
|
4528
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4651
4529
|
}
|
|
4652
4530
|
}
|
|
4653
4531
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4658,11 +4536,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4658
4536
|
// Set the new styling token on the host element
|
|
4659
4537
|
if (!isUndefined$1(newToken)) {
|
|
4660
4538
|
if (hasScopedStyles) {
|
|
4661
|
-
getClassList
|
|
4539
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4662
4540
|
newHasTokenInClass = true;
|
|
4663
4541
|
}
|
|
4664
4542
|
if (isSyntheticShadow) {
|
|
4665
|
-
setAttribute
|
|
4543
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4666
4544
|
newHasTokenInAttribute = true;
|
|
4667
4545
|
}
|
|
4668
4546
|
}
|
|
@@ -4750,13 +4628,13 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4750
4628
|
return owner;
|
|
4751
4629
|
}
|
|
4752
4630
|
function createStylesheet(vm, stylesheets) {
|
|
4753
|
-
const { renderMode, shadowMode } = vm;
|
|
4631
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4754
4632
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4755
4633
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4756
|
-
insertStylesheet
|
|
4634
|
+
insertStylesheet(stylesheets[i]);
|
|
4757
4635
|
}
|
|
4758
4636
|
}
|
|
4759
|
-
else if (ssr
|
|
4637
|
+
else if (ssr || vm.hydrated) {
|
|
4760
4638
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4761
4639
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4762
4640
|
// the first time the VM renders.
|
|
@@ -4770,7 +4648,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4770
4648
|
// null root means a global style
|
|
4771
4649
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4772
4650
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4773
|
-
insertStylesheet
|
|
4651
|
+
insertStylesheet(stylesheets[i], target);
|
|
4774
4652
|
}
|
|
4775
4653
|
}
|
|
4776
4654
|
return null;
|
|
@@ -5278,9 +5156,20 @@ function removeVM(vm) {
|
|
|
5278
5156
|
|
|
5279
5157
|
resetComponentStateWhenRemoved(vm);
|
|
5280
5158
|
}
|
|
5281
|
-
function createVM(elm, ctor, options) {
|
|
5282
|
-
var _a;
|
|
5283
5159
|
|
|
5160
|
+
function getNearestShadowAncestor(vm) {
|
|
5161
|
+
let ancestor = vm.owner;
|
|
5162
|
+
|
|
5163
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5164
|
+
/* Light */
|
|
5165
|
+
) {
|
|
5166
|
+
ancestor = ancestor.owner;
|
|
5167
|
+
}
|
|
5168
|
+
|
|
5169
|
+
return ancestor;
|
|
5170
|
+
}
|
|
5171
|
+
|
|
5172
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5284
5173
|
const {
|
|
5285
5174
|
mode,
|
|
5286
5175
|
owner,
|
|
@@ -5310,8 +5199,6 @@ function createVM(elm, ctor, options) {
|
|
|
5310
5199
|
cmpTemplate: null,
|
|
5311
5200
|
hydrated: Boolean(hydrated),
|
|
5312
5201
|
renderMode: def.renderMode,
|
|
5313
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5314
|
-
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,
|
|
5315
5202
|
context: {
|
|
5316
5203
|
stylesheetToken: undefined,
|
|
5317
5204
|
hasTokenInClass: undefined,
|
|
@@ -5324,14 +5211,17 @@ function createVM(elm, ctor, options) {
|
|
|
5324
5211
|
},
|
|
5325
5212
|
// Properties set right after VM creation.
|
|
5326
5213
|
tro: null,
|
|
5214
|
+
shadowMode: null,
|
|
5327
5215
|
// Properties set by the LightningElement constructor.
|
|
5328
5216
|
component: null,
|
|
5329
5217
|
shadowRoot: null,
|
|
5330
5218
|
renderRoot: null,
|
|
5331
5219
|
callHook,
|
|
5332
5220
|
setHook,
|
|
5333
|
-
getHook
|
|
5221
|
+
getHook,
|
|
5222
|
+
renderer
|
|
5334
5223
|
};
|
|
5224
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5335
5225
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5336
5226
|
|
|
5337
5227
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5356,12 +5246,17 @@ function createVM(elm, ctor, options) {
|
|
|
5356
5246
|
return vm;
|
|
5357
5247
|
}
|
|
5358
5248
|
|
|
5359
|
-
function computeShadowMode(
|
|
5360
|
-
|
|
5361
|
-
|
|
5249
|
+
function computeShadowMode(vm, renderer) {
|
|
5250
|
+
const {
|
|
5251
|
+
def
|
|
5252
|
+
} = vm;
|
|
5253
|
+
const {
|
|
5254
|
+
isSyntheticShadowDefined,
|
|
5255
|
+
isNativeShadowDefined
|
|
5256
|
+
} = renderer;
|
|
5362
5257
|
let shadowMode;
|
|
5363
5258
|
|
|
5364
|
-
if (isSyntheticShadowDefined
|
|
5259
|
+
if (isSyntheticShadowDefined) {
|
|
5365
5260
|
if (def.renderMode === 0
|
|
5366
5261
|
/* Light */
|
|
5367
5262
|
) {
|
|
@@ -5370,7 +5265,7 @@ function computeShadowMode(def, owner) {
|
|
|
5370
5265
|
shadowMode = 0
|
|
5371
5266
|
/* Native */
|
|
5372
5267
|
;
|
|
5373
|
-
} else if (isNativeShadowDefined
|
|
5268
|
+
} else if (isNativeShadowDefined) {
|
|
5374
5269
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5375
5270
|
// the if-condition.
|
|
5376
5271
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5381,13 +5276,23 @@ function computeShadowMode(def, owner) {
|
|
|
5381
5276
|
/* Native */
|
|
5382
5277
|
;
|
|
5383
5278
|
} else {
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5279
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5280
|
+
|
|
5281
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5282
|
+
/* Native */
|
|
5283
|
+
) {
|
|
5284
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5285
|
+
// transitively opts all of its descendants into native.
|
|
5286
|
+
shadowMode = 0
|
|
5287
|
+
/* Native */
|
|
5288
|
+
;
|
|
5289
|
+
} else {
|
|
5290
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5291
|
+
// to be native.
|
|
5292
|
+
shadowMode = 1
|
|
5293
|
+
/* Synthetic */
|
|
5294
|
+
;
|
|
5295
|
+
}
|
|
5391
5296
|
}
|
|
5392
5297
|
} else {
|
|
5393
5298
|
shadowMode = 1
|
|
@@ -5450,7 +5355,8 @@ function rehydrate(vm) {
|
|
|
5450
5355
|
function patchShadowRoot(vm, newCh) {
|
|
5451
5356
|
const {
|
|
5452
5357
|
renderRoot,
|
|
5453
|
-
children: oldCh
|
|
5358
|
+
children: oldCh,
|
|
5359
|
+
renderer
|
|
5454
5360
|
} = vm; // caching the new children collection
|
|
5455
5361
|
|
|
5456
5362
|
vm.children = newCh;
|
|
@@ -5466,7 +5372,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5466
5372
|
, vm);
|
|
5467
5373
|
}, () => {
|
|
5468
5374
|
// job
|
|
5469
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5375
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5470
5376
|
}, () => {
|
|
5471
5377
|
// post
|
|
5472
5378
|
logOperationEnd(2
|
|
@@ -5491,10 +5397,13 @@ function runRenderedCallback(vm) {
|
|
|
5491
5397
|
const {
|
|
5492
5398
|
def: {
|
|
5493
5399
|
renderedCallback
|
|
5400
|
+
},
|
|
5401
|
+
renderer: {
|
|
5402
|
+
ssr
|
|
5494
5403
|
}
|
|
5495
5404
|
} = vm;
|
|
5496
5405
|
|
|
5497
|
-
if (isTrue(ssr
|
|
5406
|
+
if (isTrue(ssr)) {
|
|
5498
5407
|
return;
|
|
5499
5408
|
}
|
|
5500
5409
|
|
|
@@ -5728,14 +5637,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5728
5637
|
function resetComponentRoot(vm) {
|
|
5729
5638
|
const {
|
|
5730
5639
|
children,
|
|
5731
|
-
renderRoot
|
|
5640
|
+
renderRoot,
|
|
5641
|
+
renderer: {
|
|
5642
|
+
remove
|
|
5643
|
+
}
|
|
5732
5644
|
} = vm;
|
|
5733
5645
|
|
|
5734
5646
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5735
5647
|
const child = children[i];
|
|
5736
5648
|
|
|
5737
5649
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5738
|
-
remove
|
|
5650
|
+
remove(child.elm, renderRoot);
|
|
5739
5651
|
}
|
|
5740
5652
|
}
|
|
5741
5653
|
|
|
@@ -5744,7 +5656,13 @@ function resetComponentRoot(vm) {
|
|
|
5744
5656
|
vm.velements = EmptyArray;
|
|
5745
5657
|
}
|
|
5746
5658
|
function scheduleRehydration(vm) {
|
|
5747
|
-
|
|
5659
|
+
const {
|
|
5660
|
+
renderer: {
|
|
5661
|
+
ssr
|
|
5662
|
+
}
|
|
5663
|
+
} = vm;
|
|
5664
|
+
|
|
5665
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5748
5666
|
return;
|
|
5749
5667
|
}
|
|
5750
5668
|
|
|
@@ -5903,6 +5821,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5903
5821
|
context: {
|
|
5904
5822
|
wiredConnecting,
|
|
5905
5823
|
wiredDisconnecting
|
|
5824
|
+
},
|
|
5825
|
+
renderer: {
|
|
5826
|
+
dispatchEvent
|
|
5906
5827
|
}
|
|
5907
5828
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5908
5829
|
|
|
@@ -5926,7 +5847,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5926
5847
|
}
|
|
5927
5848
|
|
|
5928
5849
|
});
|
|
5929
|
-
dispatchEvent
|
|
5850
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5930
5851
|
});
|
|
5931
5852
|
}
|
|
5932
5853
|
|
|
@@ -6266,7 +6187,7 @@ function freezeTemplate(tmpl) {
|
|
|
6266
6187
|
});
|
|
6267
6188
|
}
|
|
6268
6189
|
}
|
|
6269
|
-
/* version: 2.
|
|
6190
|
+
/* version: 2.14.2 */
|
|
6270
6191
|
|
|
6271
6192
|
/*
|
|
6272
6193
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6339,6 +6260,9 @@ class HTMLElementImpl {
|
|
|
6339
6260
|
}
|
|
6340
6261
|
}
|
|
6341
6262
|
const ssr = true;
|
|
6263
|
+
function isHydrating() {
|
|
6264
|
+
return false;
|
|
6265
|
+
}
|
|
6342
6266
|
const isNativeShadowDefined = false;
|
|
6343
6267
|
const isSyntheticShadowDefined = false;
|
|
6344
6268
|
function insert(node, parent, anchor) {
|
|
@@ -6565,51 +6489,47 @@ function getCustomElement(name) {
|
|
|
6565
6489
|
const HTMLElementExported = HTMLElementImpl;
|
|
6566
6490
|
/* noop */
|
|
6567
6491
|
const assertInstanceOfHTMLElement = noop;
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
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
|
-
setSetText(setText);
|
|
6610
|
-
setSsr(ssr);
|
|
6611
|
-
setAddEventListener(addEventListener);
|
|
6612
|
-
setInsertStylesheet(insertStylesheet);
|
|
6492
|
+
const renderer = {
|
|
6493
|
+
ssr,
|
|
6494
|
+
isNativeShadowDefined,
|
|
6495
|
+
isSyntheticShadowDefined,
|
|
6496
|
+
HTMLElementExported,
|
|
6497
|
+
isHydrating,
|
|
6498
|
+
insert,
|
|
6499
|
+
remove,
|
|
6500
|
+
createElement,
|
|
6501
|
+
createText,
|
|
6502
|
+
createComment,
|
|
6503
|
+
nextSibling,
|
|
6504
|
+
attachShadow,
|
|
6505
|
+
getProperty,
|
|
6506
|
+
setProperty,
|
|
6507
|
+
setText,
|
|
6508
|
+
getAttribute,
|
|
6509
|
+
setAttribute,
|
|
6510
|
+
removeAttribute,
|
|
6511
|
+
addEventListener,
|
|
6512
|
+
removeEventListener,
|
|
6513
|
+
dispatchEvent,
|
|
6514
|
+
getClassList,
|
|
6515
|
+
setCSSStyleProperty,
|
|
6516
|
+
getBoundingClientRect,
|
|
6517
|
+
querySelector,
|
|
6518
|
+
querySelectorAll,
|
|
6519
|
+
getElementsByTagName,
|
|
6520
|
+
getElementsByClassName,
|
|
6521
|
+
getChildren,
|
|
6522
|
+
getChildNodes,
|
|
6523
|
+
getFirstChild,
|
|
6524
|
+
getFirstElementChild,
|
|
6525
|
+
getLastChild,
|
|
6526
|
+
getLastElementChild,
|
|
6527
|
+
isConnected,
|
|
6528
|
+
insertStylesheet,
|
|
6529
|
+
assertInstanceOfHTMLElement,
|
|
6530
|
+
defineCustomElement,
|
|
6531
|
+
getCustomElement,
|
|
6532
|
+
};
|
|
6613
6533
|
|
|
6614
6534
|
/*
|
|
6615
6535
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6703,8 +6623,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6703
6623
|
if (!isObject(props) || isNull(props)) {
|
|
6704
6624
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6705
6625
|
}
|
|
6706
|
-
const element = createElement(tagName);
|
|
6707
|
-
createVM(element, Ctor, {
|
|
6626
|
+
const element = renderer.createElement(tagName);
|
|
6627
|
+
createVM(element, Ctor, renderer, {
|
|
6708
6628
|
mode: 'open',
|
|
6709
6629
|
owner: null,
|
|
6710
6630
|
tagName,
|
|
@@ -6725,6 +6645,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6725
6645
|
*/
|
|
6726
6646
|
freeze(LightningElement);
|
|
6727
6647
|
seal(LightningElement.prototype);
|
|
6728
|
-
/* version: 2.
|
|
6648
|
+
/* version: 2.14.2 */
|
|
6729
6649
|
|
|
6730
|
-
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|
|
6650
|
+
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|