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
|
@@ -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.14.
|
|
420
|
+
const LWC_VERSION = "2.14.2";
|
|
421
421
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
422
|
-
/** version: 2.14.
|
|
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.14.
|
|
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,
|
|
@@ -3411,12 +3259,13 @@ function getComponentDef(Ctor) {
|
|
|
3411
3259
|
* SPDX-License-Identifier: MIT
|
|
3412
3260
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3413
3261
|
*/
|
|
3414
|
-
function getUpgradableConstructor(tagName) {
|
|
3262
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3263
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3415
3264
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3416
3265
|
// produce only tags with lowercase letters
|
|
3417
3266
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3418
3267
|
tagName = tagName.toLowerCase();
|
|
3419
|
-
let CE = getCustomElement
|
|
3268
|
+
let CE = getCustomElement(tagName);
|
|
3420
3269
|
if (!isUndefined$1(CE)) {
|
|
3421
3270
|
return CE;
|
|
3422
3271
|
}
|
|
@@ -3424,7 +3273,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3424
3273
|
* LWC Upgradable Element reference to an element that was created
|
|
3425
3274
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3426
3275
|
*/
|
|
3427
|
-
CE = class LWCUpgradableElement extends
|
|
3276
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3428
3277
|
constructor(upgradeCallback) {
|
|
3429
3278
|
super();
|
|
3430
3279
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3432,7 +3281,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3432
3281
|
}
|
|
3433
3282
|
}
|
|
3434
3283
|
};
|
|
3435
|
-
defineCustomElement
|
|
3284
|
+
defineCustomElement(tagName, CE);
|
|
3436
3285
|
return CE;
|
|
3437
3286
|
}
|
|
3438
3287
|
|
|
@@ -3457,7 +3306,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3457
3306
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3458
3307
|
*/
|
|
3459
3308
|
const ColonCharCode = 58;
|
|
3460
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3309
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3461
3310
|
const { attrs } = vnode.data;
|
|
3462
3311
|
if (isUndefined$1(attrs)) {
|
|
3463
3312
|
return;
|
|
@@ -3467,6 +3316,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3467
3316
|
return;
|
|
3468
3317
|
}
|
|
3469
3318
|
const { elm } = vnode;
|
|
3319
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3470
3320
|
for (const key in attrs) {
|
|
3471
3321
|
const cur = attrs[key];
|
|
3472
3322
|
const old = oldAttrs[key];
|
|
@@ -3474,17 +3324,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3474
3324
|
unlockAttribute(elm, key);
|
|
3475
3325
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3476
3326
|
// Assume xml namespace
|
|
3477
|
-
setAttribute
|
|
3327
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3478
3328
|
}
|
|
3479
3329
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3480
3330
|
// Assume xlink namespace
|
|
3481
|
-
setAttribute
|
|
3331
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3482
3332
|
}
|
|
3483
3333
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3484
|
-
removeAttribute
|
|
3334
|
+
removeAttribute(elm, key);
|
|
3485
3335
|
}
|
|
3486
3336
|
else {
|
|
3487
|
-
setAttribute
|
|
3337
|
+
setAttribute(elm, key, cur);
|
|
3488
3338
|
}
|
|
3489
3339
|
lockAttribute();
|
|
3490
3340
|
}
|
|
@@ -3502,7 +3352,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3502
3352
|
// instead of relying on internally tracked values.
|
|
3503
3353
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3504
3354
|
}
|
|
3505
|
-
function patchProps(oldVnode, vnode) {
|
|
3355
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3506
3356
|
const { props } = vnode.data;
|
|
3507
3357
|
if (isUndefined$1(props)) {
|
|
3508
3358
|
return;
|
|
@@ -3513,13 +3363,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3513
3363
|
}
|
|
3514
3364
|
const isFirstPatch = isNull(oldVnode);
|
|
3515
3365
|
const { elm, sel } = vnode;
|
|
3366
|
+
const { getProperty, setProperty } = renderer;
|
|
3516
3367
|
for (const key in props) {
|
|
3517
3368
|
const cur = props[key];
|
|
3518
3369
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3519
3370
|
// different than the one previously set.
|
|
3520
3371
|
if (isFirstPatch ||
|
|
3521
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3522
|
-
setProperty
|
|
3372
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3373
|
+
setProperty(elm, key, cur);
|
|
3523
3374
|
}
|
|
3524
3375
|
}
|
|
3525
3376
|
}
|
|
@@ -3564,13 +3415,14 @@ function getMapFromClassName(className) {
|
|
|
3564
3415
|
}
|
|
3565
3416
|
return map;
|
|
3566
3417
|
}
|
|
3567
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3418
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3568
3419
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3569
3420
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3570
3421
|
if (oldClass === newClass) {
|
|
3571
3422
|
return;
|
|
3572
3423
|
}
|
|
3573
|
-
const
|
|
3424
|
+
const { getClassList } = renderer;
|
|
3425
|
+
const classList = getClassList(elm);
|
|
3574
3426
|
const newClassMap = getMapFromClassName(newClass);
|
|
3575
3427
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3576
3428
|
let name;
|
|
@@ -3594,17 +3446,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3594
3446
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3595
3447
|
*/
|
|
3596
3448
|
// The style property is a string when defined via an expression in the template.
|
|
3597
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3449
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3598
3450
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3599
3451
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3600
3452
|
if (oldStyle === newStyle) {
|
|
3601
3453
|
return;
|
|
3602
3454
|
}
|
|
3455
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3603
3456
|
if (!isString(newStyle) || newStyle === '') {
|
|
3604
|
-
removeAttribute
|
|
3457
|
+
removeAttribute(elm, 'style');
|
|
3605
3458
|
}
|
|
3606
3459
|
else {
|
|
3607
|
-
setAttribute
|
|
3460
|
+
setAttribute(elm, 'style', newStyle);
|
|
3608
3461
|
}
|
|
3609
3462
|
}
|
|
3610
3463
|
|
|
@@ -3614,14 +3467,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3614
3467
|
* SPDX-License-Identifier: MIT
|
|
3615
3468
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3616
3469
|
*/
|
|
3617
|
-
function applyEventListeners(vnode) {
|
|
3470
|
+
function applyEventListeners(vnode, renderer) {
|
|
3618
3471
|
const { elm, data: { on }, } = vnode;
|
|
3619
3472
|
if (isUndefined$1(on)) {
|
|
3620
3473
|
return;
|
|
3621
3474
|
}
|
|
3475
|
+
const { addEventListener } = renderer;
|
|
3622
3476
|
for (const name in on) {
|
|
3623
3477
|
const handler = on[name];
|
|
3624
|
-
addEventListener
|
|
3478
|
+
addEventListener(elm, name, handler);
|
|
3625
3479
|
}
|
|
3626
3480
|
}
|
|
3627
3481
|
|
|
@@ -3634,12 +3488,13 @@ function applyEventListeners(vnode) {
|
|
|
3634
3488
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3635
3489
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3636
3490
|
// different classnames properties individually instead of via a string.
|
|
3637
|
-
function applyStaticClassAttribute(vnode) {
|
|
3491
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3638
3492
|
const { elm, data: { classMap }, } = vnode;
|
|
3639
3493
|
if (isUndefined$1(classMap)) {
|
|
3640
3494
|
return;
|
|
3641
3495
|
}
|
|
3642
|
-
const
|
|
3496
|
+
const { getClassList } = renderer;
|
|
3497
|
+
const classList = getClassList(elm);
|
|
3643
3498
|
for (const name in classMap) {
|
|
3644
3499
|
classList.add(name);
|
|
3645
3500
|
}
|
|
@@ -3654,14 +3509,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3654
3509
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3655
3510
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3656
3511
|
// different style properties individually instead of via a string.
|
|
3657
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3512
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3658
3513
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3659
3514
|
if (isUndefined$1(styleDecls)) {
|
|
3660
3515
|
return;
|
|
3661
3516
|
}
|
|
3517
|
+
const { setCSSStyleProperty } = renderer;
|
|
3662
3518
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3663
3519
|
const [prop, value, important] = styleDecls[i];
|
|
3664
|
-
setCSSStyleProperty
|
|
3520
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3665
3521
|
}
|
|
3666
3522
|
}
|
|
3667
3523
|
|
|
@@ -3671,15 +3527,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3671
3527
|
* SPDX-License-Identifier: MIT
|
|
3672
3528
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3673
3529
|
*/
|
|
3674
|
-
function patchChildren(c1, c2, parent) {
|
|
3530
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3675
3531
|
if (hasDynamicChildren(c2)) {
|
|
3676
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3532
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3677
3533
|
}
|
|
3678
3534
|
else {
|
|
3679
|
-
updateStaticChildren(c1, c2, parent);
|
|
3535
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3680
3536
|
}
|
|
3681
3537
|
}
|
|
3682
|
-
function patch(n1, n2) {
|
|
3538
|
+
function patch(n1, n2, renderer) {
|
|
3539
|
+
var _a, _b;
|
|
3683
3540
|
if (n1 === n2) {
|
|
3684
3541
|
return;
|
|
3685
3542
|
}
|
|
@@ -3693,80 +3550,90 @@ function patch(n1, n2) {
|
|
|
3693
3550
|
}
|
|
3694
3551
|
switch (n2.type) {
|
|
3695
3552
|
case 0 /* Text */:
|
|
3696
|
-
|
|
3553
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3554
|
+
patchText(n1, n2, renderer);
|
|
3697
3555
|
break;
|
|
3698
3556
|
case 1 /* Comment */:
|
|
3699
|
-
|
|
3557
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3558
|
+
patchComment(n1, n2, renderer);
|
|
3700
3559
|
break;
|
|
3701
3560
|
case 2 /* Element */:
|
|
3702
|
-
patchElement(n1, n2);
|
|
3561
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3703
3562
|
break;
|
|
3704
3563
|
case 3 /* CustomElement */:
|
|
3705
|
-
patchCustomElement(n1, n2);
|
|
3564
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3706
3565
|
break;
|
|
3707
3566
|
}
|
|
3708
3567
|
}
|
|
3709
|
-
function mount(node, parent, anchor) {
|
|
3568
|
+
function mount(node, parent, renderer, anchor) {
|
|
3569
|
+
var _a, _b;
|
|
3710
3570
|
switch (node.type) {
|
|
3711
3571
|
case 0 /* Text */:
|
|
3712
|
-
|
|
3572
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3573
|
+
mountText(node, parent, anchor, renderer);
|
|
3713
3574
|
break;
|
|
3714
3575
|
case 1 /* Comment */:
|
|
3715
|
-
|
|
3576
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3577
|
+
mountComment(node, parent, anchor, renderer);
|
|
3716
3578
|
break;
|
|
3717
3579
|
case 2 /* Element */:
|
|
3718
|
-
|
|
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);
|
|
3719
3582
|
break;
|
|
3720
3583
|
case 3 /* CustomElement */:
|
|
3721
|
-
|
|
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);
|
|
3722
3586
|
break;
|
|
3723
3587
|
}
|
|
3724
3588
|
}
|
|
3725
|
-
function patchText(n1, n2) {
|
|
3589
|
+
function patchText(n1, n2, renderer) {
|
|
3726
3590
|
n2.elm = n1.elm;
|
|
3727
3591
|
if (n2.text !== n1.text) {
|
|
3728
|
-
updateTextContent(n2);
|
|
3592
|
+
updateTextContent(n2, renderer);
|
|
3729
3593
|
}
|
|
3730
3594
|
}
|
|
3731
|
-
function mountText(
|
|
3732
|
-
const { owner } =
|
|
3733
|
-
const
|
|
3734
|
-
|
|
3735
|
-
|
|
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);
|
|
3736
3601
|
}
|
|
3737
|
-
function patchComment(n1, n2) {
|
|
3602
|
+
function patchComment(n1, n2, renderer) {
|
|
3738
3603
|
n2.elm = n1.elm;
|
|
3739
3604
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3740
3605
|
// it is the case today.
|
|
3741
3606
|
if (n2.text !== n1.text) {
|
|
3742
|
-
updateTextContent(n2);
|
|
3607
|
+
updateTextContent(n2, renderer);
|
|
3743
3608
|
}
|
|
3744
3609
|
}
|
|
3745
|
-
function mountComment(
|
|
3746
|
-
const { owner } =
|
|
3747
|
-
const
|
|
3748
|
-
|
|
3749
|
-
|
|
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);
|
|
3750
3616
|
}
|
|
3751
|
-
function mountElement(vnode, parent, anchor) {
|
|
3617
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3752
3618
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3619
|
+
const { createElement } = renderer;
|
|
3753
3620
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3754
|
-
const elm = createElement
|
|
3755
|
-
linkNodeToShadow(elm, owner);
|
|
3756
|
-
fallbackElmHook(elm, vnode);
|
|
3621
|
+
const elm = createElement(sel, namespace);
|
|
3622
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3623
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3757
3624
|
vnode.elm = elm;
|
|
3758
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3759
|
-
insertNode(elm, parent, anchor);
|
|
3760
|
-
mountVNodes(vnode.children, elm, null);
|
|
3625
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3626
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3627
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3761
3628
|
}
|
|
3762
|
-
function patchElement(n1, n2) {
|
|
3629
|
+
function patchElement(n1, n2, renderer) {
|
|
3763
3630
|
const elm = (n2.elm = n1.elm);
|
|
3764
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3765
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3631
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3632
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3766
3633
|
}
|
|
3767
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3634
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3768
3635
|
const { sel, owner } = vnode;
|
|
3769
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3636
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3770
3637
|
/**
|
|
3771
3638
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3772
3639
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3776,9 +3643,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3776
3643
|
let vm;
|
|
3777
3644
|
const elm = new UpgradableConstructor((elm) => {
|
|
3778
3645
|
// the custom element from the registry is expecting an upgrade callback
|
|
3779
|
-
vm = createViewModelHook(elm, vnode);
|
|
3646
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3780
3647
|
});
|
|
3781
|
-
linkNodeToShadow(elm, owner);
|
|
3648
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3782
3649
|
vnode.elm = elm;
|
|
3783
3650
|
vnode.vm = vm;
|
|
3784
3651
|
if (vm) {
|
|
@@ -3787,23 +3654,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3787
3654
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3788
3655
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3789
3656
|
}
|
|
3790
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3791
|
-
insertNode(elm, parent, anchor);
|
|
3657
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3658
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3792
3659
|
if (vm) {
|
|
3793
3660
|
if (process.env.NODE_ENV !== 'production') {
|
|
3794
3661
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3795
3662
|
}
|
|
3796
3663
|
runConnectedCallback(vm);
|
|
3797
3664
|
}
|
|
3798
|
-
mountVNodes(vnode.children, elm, null);
|
|
3665
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3799
3666
|
if (vm) {
|
|
3800
3667
|
appendVM(vm);
|
|
3801
3668
|
}
|
|
3802
3669
|
}
|
|
3803
|
-
function patchCustomElement(n1, n2) {
|
|
3670
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3804
3671
|
const elm = (n2.elm = n1.elm);
|
|
3805
3672
|
const vm = (n2.vm = n1.vm);
|
|
3806
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3673
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3807
3674
|
if (!isUndefined$1(vm)) {
|
|
3808
3675
|
// in fallback mode, the allocation will always set children to
|
|
3809
3676
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3811,34 +3678,36 @@ function patchCustomElement(n1, n2) {
|
|
|
3811
3678
|
}
|
|
3812
3679
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3813
3680
|
// will happen, but in native, it does allocate the light dom
|
|
3814
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3681
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3815
3682
|
if (!isUndefined$1(vm)) {
|
|
3816
3683
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3817
3684
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3818
3685
|
rerenderVM(vm);
|
|
3819
3686
|
}
|
|
3820
3687
|
}
|
|
3821
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3688
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3822
3689
|
for (; start < end; ++start) {
|
|
3823
3690
|
const vnode = vnodes[start];
|
|
3824
3691
|
if (isVNode(vnode)) {
|
|
3825
|
-
mount(vnode, parent, anchor);
|
|
3692
|
+
mount(vnode, parent, renderer, anchor);
|
|
3826
3693
|
}
|
|
3827
3694
|
}
|
|
3828
3695
|
}
|
|
3829
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3696
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3830
3697
|
const { type, elm, sel } = vnode;
|
|
3831
3698
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3832
3699
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3833
3700
|
if (doRemove) {
|
|
3834
|
-
|
|
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);
|
|
3835
3704
|
}
|
|
3836
3705
|
switch (type) {
|
|
3837
3706
|
case 2 /* Element */: {
|
|
3838
3707
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3839
3708
|
// Only required for synthetic shadow.
|
|
3840
|
-
const
|
|
3841
|
-
unmountVNodes(vnode.children, elm,
|
|
3709
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3710
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3842
3711
|
break;
|
|
3843
3712
|
}
|
|
3844
3713
|
case 3 /* CustomElement */: {
|
|
@@ -3851,11 +3720,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3851
3720
|
}
|
|
3852
3721
|
}
|
|
3853
3722
|
}
|
|
3854
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3723
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3855
3724
|
for (; start < end; ++start) {
|
|
3856
3725
|
const ch = vnodes[start];
|
|
3857
3726
|
if (isVNode(ch)) {
|
|
3858
|
-
unmount(ch, parent, doRemove);
|
|
3727
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3859
3728
|
}
|
|
3860
3729
|
}
|
|
3861
3730
|
}
|
|
@@ -3869,66 +3738,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3869
3738
|
elm.$shadowToken$ = token;
|
|
3870
3739
|
}
|
|
3871
3740
|
// Set the scope token class for *.scoped.css styles
|
|
3872
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3741
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3873
3742
|
const { cmpTemplate, context } = owner;
|
|
3743
|
+
const { getClassList } = renderer;
|
|
3874
3744
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3875
3745
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3876
|
-
|
|
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);
|
|
3877
3749
|
}
|
|
3878
3750
|
}
|
|
3879
|
-
function linkNodeToShadow(elm, owner) {
|
|
3751
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3880
3752
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3753
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3881
3754
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3882
|
-
if (isSyntheticShadowDefined
|
|
3755
|
+
if (isSyntheticShadowDefined) {
|
|
3883
3756
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3884
3757
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3885
3758
|
}
|
|
3886
3759
|
}
|
|
3887
3760
|
}
|
|
3888
|
-
function updateTextContent(vnode) {
|
|
3761
|
+
function updateTextContent(vnode, renderer) {
|
|
3889
3762
|
const { elm, text } = vnode;
|
|
3763
|
+
const { setText } = renderer;
|
|
3890
3764
|
if (process.env.NODE_ENV !== 'production') {
|
|
3891
3765
|
unlockDomMutation();
|
|
3892
3766
|
}
|
|
3893
|
-
setText
|
|
3767
|
+
setText(elm, text);
|
|
3894
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3895
3769
|
lockDomMutation();
|
|
3896
3770
|
}
|
|
3897
3771
|
}
|
|
3898
|
-
function insertNode(node, parent, anchor) {
|
|
3772
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3899
3773
|
if (process.env.NODE_ENV !== 'production') {
|
|
3900
3774
|
unlockDomMutation();
|
|
3901
3775
|
}
|
|
3902
|
-
insert
|
|
3776
|
+
renderer.insert(node, parent, anchor);
|
|
3903
3777
|
if (process.env.NODE_ENV !== 'production') {
|
|
3904
3778
|
lockDomMutation();
|
|
3905
3779
|
}
|
|
3906
3780
|
}
|
|
3907
|
-
function removeNode(node, parent) {
|
|
3781
|
+
function removeNode(node, parent, renderer) {
|
|
3908
3782
|
if (process.env.NODE_ENV !== 'production') {
|
|
3909
3783
|
unlockDomMutation();
|
|
3910
3784
|
}
|
|
3911
|
-
remove
|
|
3785
|
+
renderer.remove(node, parent);
|
|
3912
3786
|
if (process.env.NODE_ENV !== 'production') {
|
|
3913
3787
|
lockDomMutation();
|
|
3914
3788
|
}
|
|
3915
3789
|
}
|
|
3916
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3790
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3917
3791
|
if (isNull(oldVnode)) {
|
|
3918
|
-
applyEventListeners(vnode);
|
|
3919
|
-
applyStaticClassAttribute(vnode);
|
|
3920
|
-
applyStaticStyleAttribute(vnode);
|
|
3792
|
+
applyEventListeners(vnode, renderer);
|
|
3793
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3794
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3921
3795
|
}
|
|
3922
3796
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3923
3797
|
// value is set before type=radio.
|
|
3924
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3925
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3926
|
-
patchAttributes(oldVnode, vnode);
|
|
3927
|
-
patchProps(oldVnode, vnode);
|
|
3798
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3799
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3800
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3801
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3928
3802
|
}
|
|
3929
|
-
function fallbackElmHook(elm, vnode) {
|
|
3803
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3930
3804
|
const { owner } = vnode;
|
|
3931
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3805
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3932
3806
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3933
3807
|
const { data: { context }, } = vnode;
|
|
3934
3808
|
const { stylesheetToken } = owner.context;
|
|
@@ -3976,7 +3850,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3976
3850
|
vnode.children = EmptyArray;
|
|
3977
3851
|
}
|
|
3978
3852
|
}
|
|
3979
|
-
function createViewModelHook(elm, vnode) {
|
|
3853
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3980
3854
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3981
3855
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3982
3856
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3985,7 +3859,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3985
3859
|
return vm;
|
|
3986
3860
|
}
|
|
3987
3861
|
const { sel, mode, ctor, owner } = vnode;
|
|
3988
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3862
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3989
3863
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3990
3864
|
const { stylesheetToken } = owner.context;
|
|
3991
3865
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3994,7 +3868,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3994
3868
|
setElementShadowToken(elm, stylesheetToken);
|
|
3995
3869
|
}
|
|
3996
3870
|
}
|
|
3997
|
-
vm = createVM(elm, ctor, {
|
|
3871
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3998
3872
|
mode,
|
|
3999
3873
|
owner,
|
|
4000
3874
|
tagName: sel,
|
|
@@ -4069,7 +3943,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4069
3943
|
}
|
|
4070
3944
|
return map;
|
|
4071
3945
|
}
|
|
4072
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3946
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4073
3947
|
let oldStartIdx = 0;
|
|
4074
3948
|
let newStartIdx = 0;
|
|
4075
3949
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4098,26 +3972,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4098
3972
|
newEndVnode = newCh[--newEndIdx];
|
|
4099
3973
|
}
|
|
4100
3974
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4101
|
-
patch(oldStartVnode, newStartVnode);
|
|
3975
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4102
3976
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4103
3977
|
newStartVnode = newCh[++newStartIdx];
|
|
4104
3978
|
}
|
|
4105
3979
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4106
|
-
patch(oldEndVnode, newEndVnode);
|
|
3980
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4107
3981
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4108
3982
|
newEndVnode = newCh[--newEndIdx];
|
|
4109
3983
|
}
|
|
4110
3984
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4111
3985
|
// Vnode moved right
|
|
4112
|
-
patch(oldStartVnode, newEndVnode);
|
|
4113
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3986
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3987
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4114
3988
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4115
3989
|
newEndVnode = newCh[--newEndIdx];
|
|
4116
3990
|
}
|
|
4117
3991
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4118
3992
|
// Vnode moved left
|
|
4119
|
-
patch(oldEndVnode, newStartVnode);
|
|
4120
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3993
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3994
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4121
3995
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4122
3996
|
newStartVnode = newCh[++newStartIdx];
|
|
4123
3997
|
}
|
|
@@ -4128,7 +4002,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4128
4002
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4129
4003
|
if (isUndefined$1(idxInOld)) {
|
|
4130
4004
|
// New element
|
|
4131
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4005
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4132
4006
|
newStartVnode = newCh[++newStartIdx];
|
|
4133
4007
|
}
|
|
4134
4008
|
else {
|
|
@@ -4136,10 +4010,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4136
4010
|
if (isVNode(elmToMove)) {
|
|
4137
4011
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4138
4012
|
// New element
|
|
4139
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4013
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4140
4014
|
}
|
|
4141
4015
|
else {
|
|
4142
|
-
patch(elmToMove, newStartVnode);
|
|
4016
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4143
4017
|
// Delete the old child, but copy the array since it is read-only.
|
|
4144
4018
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4145
4019
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4151,7 +4025,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4151
4025
|
}
|
|
4152
4026
|
// We've already cloned at least once, so it's no longer read-only
|
|
4153
4027
|
oldCh[idxInOld] = undefined;
|
|
4154
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4028
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4155
4029
|
}
|
|
4156
4030
|
}
|
|
4157
4031
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4168,25 +4042,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4168
4042
|
n = newCh[++i];
|
|
4169
4043
|
} while (!isVNode(n) && i < newChEnd);
|
|
4170
4044
|
before = isVNode(n) ? n.elm : null;
|
|
4171
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4045
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4172
4046
|
}
|
|
4173
4047
|
else {
|
|
4174
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4048
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4175
4049
|
}
|
|
4176
4050
|
}
|
|
4177
4051
|
}
|
|
4178
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4052
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4179
4053
|
const c1Length = c1.length;
|
|
4180
4054
|
const c2Length = c2.length;
|
|
4181
4055
|
if (c1Length === 0) {
|
|
4182
4056
|
// the old list is empty, we can directly insert anything new
|
|
4183
|
-
mountVNodes(c2, parent, null);
|
|
4057
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4184
4058
|
return;
|
|
4185
4059
|
}
|
|
4186
4060
|
if (c2Length === 0) {
|
|
4187
4061
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4188
4062
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4189
|
-
unmountVNodes(c1, parent, true);
|
|
4063
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4190
4064
|
return;
|
|
4191
4065
|
}
|
|
4192
4066
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4199,16 +4073,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4199
4073
|
if (isVNode(n1)) {
|
|
4200
4074
|
if (isVNode(n2)) {
|
|
4201
4075
|
// both vnodes are equivalent, and we just need to patch them
|
|
4202
|
-
patch(n1, n2);
|
|
4076
|
+
patch(n1, n2, renderer);
|
|
4203
4077
|
anchor = n2.elm;
|
|
4204
4078
|
}
|
|
4205
4079
|
else {
|
|
4206
4080
|
// removing the old vnode since the new one is null
|
|
4207
|
-
unmount(n1, parent, true);
|
|
4081
|
+
unmount(n1, parent, renderer, true);
|
|
4208
4082
|
}
|
|
4209
4083
|
}
|
|
4210
4084
|
else if (isVNode(n2)) {
|
|
4211
|
-
mount(n2, parent, anchor);
|
|
4085
|
+
mount(n2, parent, renderer, anchor);
|
|
4212
4086
|
anchor = n2.elm;
|
|
4213
4087
|
}
|
|
4214
4088
|
}
|
|
@@ -4637,7 +4511,7 @@ function createInlineStyleVNode(content) {
|
|
|
4637
4511
|
}, [api.t(content)]);
|
|
4638
4512
|
}
|
|
4639
4513
|
function updateStylesheetToken(vm, template) {
|
|
4640
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4514
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4641
4515
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4642
4516
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4643
4517
|
const { hasScopedStyles } = context;
|
|
@@ -4648,10 +4522,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4648
4522
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4649
4523
|
if (!isUndefined$1(oldToken)) {
|
|
4650
4524
|
if (oldHasTokenInClass) {
|
|
4651
|
-
getClassList
|
|
4525
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4652
4526
|
}
|
|
4653
4527
|
if (oldHasTokenInAttribute) {
|
|
4654
|
-
removeAttribute
|
|
4528
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4655
4529
|
}
|
|
4656
4530
|
}
|
|
4657
4531
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4662,11 +4536,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4662
4536
|
// Set the new styling token on the host element
|
|
4663
4537
|
if (!isUndefined$1(newToken)) {
|
|
4664
4538
|
if (hasScopedStyles) {
|
|
4665
|
-
getClassList
|
|
4539
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4666
4540
|
newHasTokenInClass = true;
|
|
4667
4541
|
}
|
|
4668
4542
|
if (isSyntheticShadow) {
|
|
4669
|
-
setAttribute
|
|
4543
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4670
4544
|
newHasTokenInAttribute = true;
|
|
4671
4545
|
}
|
|
4672
4546
|
}
|
|
@@ -4754,13 +4628,13 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4754
4628
|
return owner;
|
|
4755
4629
|
}
|
|
4756
4630
|
function createStylesheet(vm, stylesheets) {
|
|
4757
|
-
const { renderMode, shadowMode } = vm;
|
|
4631
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4758
4632
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4759
4633
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4760
|
-
insertStylesheet
|
|
4634
|
+
insertStylesheet(stylesheets[i]);
|
|
4761
4635
|
}
|
|
4762
4636
|
}
|
|
4763
|
-
else if (ssr
|
|
4637
|
+
else if (ssr || vm.hydrated) {
|
|
4764
4638
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4765
4639
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4766
4640
|
// the first time the VM renders.
|
|
@@ -4774,7 +4648,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4774
4648
|
// null root means a global style
|
|
4775
4649
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4776
4650
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4777
|
-
insertStylesheet
|
|
4651
|
+
insertStylesheet(stylesheets[i], target);
|
|
4778
4652
|
}
|
|
4779
4653
|
}
|
|
4780
4654
|
return null;
|
|
@@ -5295,7 +5169,7 @@ function getNearestShadowAncestor(vm) {
|
|
|
5295
5169
|
return ancestor;
|
|
5296
5170
|
}
|
|
5297
5171
|
|
|
5298
|
-
function createVM(elm, ctor, options) {
|
|
5172
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5299
5173
|
const {
|
|
5300
5174
|
mode,
|
|
5301
5175
|
owner,
|
|
@@ -5344,9 +5218,10 @@ function createVM(elm, ctor, options) {
|
|
|
5344
5218
|
renderRoot: null,
|
|
5345
5219
|
callHook,
|
|
5346
5220
|
setHook,
|
|
5347
|
-
getHook
|
|
5221
|
+
getHook,
|
|
5222
|
+
renderer
|
|
5348
5223
|
};
|
|
5349
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5224
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5350
5225
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5351
5226
|
|
|
5352
5227
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5371,13 +5246,17 @@ function createVM(elm, ctor, options) {
|
|
|
5371
5246
|
return vm;
|
|
5372
5247
|
}
|
|
5373
5248
|
|
|
5374
|
-
function computeShadowMode(vm) {
|
|
5249
|
+
function computeShadowMode(vm, renderer) {
|
|
5375
5250
|
const {
|
|
5376
5251
|
def
|
|
5377
5252
|
} = vm;
|
|
5253
|
+
const {
|
|
5254
|
+
isSyntheticShadowDefined,
|
|
5255
|
+
isNativeShadowDefined
|
|
5256
|
+
} = renderer;
|
|
5378
5257
|
let shadowMode;
|
|
5379
5258
|
|
|
5380
|
-
if (isSyntheticShadowDefined
|
|
5259
|
+
if (isSyntheticShadowDefined) {
|
|
5381
5260
|
if (def.renderMode === 0
|
|
5382
5261
|
/* Light */
|
|
5383
5262
|
) {
|
|
@@ -5386,7 +5265,7 @@ function computeShadowMode(vm) {
|
|
|
5386
5265
|
shadowMode = 0
|
|
5387
5266
|
/* Native */
|
|
5388
5267
|
;
|
|
5389
|
-
} else if (isNativeShadowDefined
|
|
5268
|
+
} else if (isNativeShadowDefined) {
|
|
5390
5269
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5391
5270
|
// the if-condition.
|
|
5392
5271
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5476,7 +5355,8 @@ function rehydrate(vm) {
|
|
|
5476
5355
|
function patchShadowRoot(vm, newCh) {
|
|
5477
5356
|
const {
|
|
5478
5357
|
renderRoot,
|
|
5479
|
-
children: oldCh
|
|
5358
|
+
children: oldCh,
|
|
5359
|
+
renderer
|
|
5480
5360
|
} = vm; // caching the new children collection
|
|
5481
5361
|
|
|
5482
5362
|
vm.children = newCh;
|
|
@@ -5492,7 +5372,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5492
5372
|
, vm);
|
|
5493
5373
|
}, () => {
|
|
5494
5374
|
// job
|
|
5495
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5375
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5496
5376
|
}, () => {
|
|
5497
5377
|
// post
|
|
5498
5378
|
logOperationEnd(2
|
|
@@ -5517,10 +5397,13 @@ function runRenderedCallback(vm) {
|
|
|
5517
5397
|
const {
|
|
5518
5398
|
def: {
|
|
5519
5399
|
renderedCallback
|
|
5400
|
+
},
|
|
5401
|
+
renderer: {
|
|
5402
|
+
ssr
|
|
5520
5403
|
}
|
|
5521
5404
|
} = vm;
|
|
5522
5405
|
|
|
5523
|
-
if (isTrue(ssr
|
|
5406
|
+
if (isTrue(ssr)) {
|
|
5524
5407
|
return;
|
|
5525
5408
|
}
|
|
5526
5409
|
|
|
@@ -5754,14 +5637,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5754
5637
|
function resetComponentRoot(vm) {
|
|
5755
5638
|
const {
|
|
5756
5639
|
children,
|
|
5757
|
-
renderRoot
|
|
5640
|
+
renderRoot,
|
|
5641
|
+
renderer: {
|
|
5642
|
+
remove
|
|
5643
|
+
}
|
|
5758
5644
|
} = vm;
|
|
5759
5645
|
|
|
5760
5646
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5761
5647
|
const child = children[i];
|
|
5762
5648
|
|
|
5763
5649
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5764
|
-
remove
|
|
5650
|
+
remove(child.elm, renderRoot);
|
|
5765
5651
|
}
|
|
5766
5652
|
}
|
|
5767
5653
|
|
|
@@ -5770,7 +5656,13 @@ function resetComponentRoot(vm) {
|
|
|
5770
5656
|
vm.velements = EmptyArray;
|
|
5771
5657
|
}
|
|
5772
5658
|
function scheduleRehydration(vm) {
|
|
5773
|
-
|
|
5659
|
+
const {
|
|
5660
|
+
renderer: {
|
|
5661
|
+
ssr
|
|
5662
|
+
}
|
|
5663
|
+
} = vm;
|
|
5664
|
+
|
|
5665
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5774
5666
|
return;
|
|
5775
5667
|
}
|
|
5776
5668
|
|
|
@@ -5929,6 +5821,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5929
5821
|
context: {
|
|
5930
5822
|
wiredConnecting,
|
|
5931
5823
|
wiredDisconnecting
|
|
5824
|
+
},
|
|
5825
|
+
renderer: {
|
|
5826
|
+
dispatchEvent
|
|
5932
5827
|
}
|
|
5933
5828
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5934
5829
|
|
|
@@ -5952,7 +5847,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5952
5847
|
}
|
|
5953
5848
|
|
|
5954
5849
|
});
|
|
5955
|
-
dispatchEvent
|
|
5850
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5956
5851
|
});
|
|
5957
5852
|
}
|
|
5958
5853
|
|
|
@@ -6292,7 +6187,7 @@ function freezeTemplate(tmpl) {
|
|
|
6292
6187
|
});
|
|
6293
6188
|
}
|
|
6294
6189
|
}
|
|
6295
|
-
/* version: 2.14.
|
|
6190
|
+
/* version: 2.14.2 */
|
|
6296
6191
|
|
|
6297
6192
|
/*
|
|
6298
6193
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6365,6 +6260,9 @@ class HTMLElementImpl {
|
|
|
6365
6260
|
}
|
|
6366
6261
|
}
|
|
6367
6262
|
const ssr = true;
|
|
6263
|
+
function isHydrating() {
|
|
6264
|
+
return false;
|
|
6265
|
+
}
|
|
6368
6266
|
const isNativeShadowDefined = false;
|
|
6369
6267
|
const isSyntheticShadowDefined = false;
|
|
6370
6268
|
function insert(node, parent, anchor) {
|
|
@@ -6591,51 +6489,47 @@ function getCustomElement(name) {
|
|
|
6591
6489
|
const HTMLElementExported = HTMLElementImpl;
|
|
6592
6490
|
/* noop */
|
|
6593
6491
|
const assertInstanceOfHTMLElement = noop;
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
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
|
-
setSetText(setText);
|
|
6636
|
-
setSsr(ssr);
|
|
6637
|
-
setAddEventListener(addEventListener);
|
|
6638
|
-
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
|
+
};
|
|
6639
6533
|
|
|
6640
6534
|
/*
|
|
6641
6535
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6729,8 +6623,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6729
6623
|
if (!isObject(props) || isNull(props)) {
|
|
6730
6624
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6731
6625
|
}
|
|
6732
|
-
const element = createElement(tagName);
|
|
6733
|
-
createVM(element, Ctor, {
|
|
6626
|
+
const element = renderer.createElement(tagName);
|
|
6627
|
+
createVM(element, Ctor, renderer, {
|
|
6734
6628
|
mode: 'open',
|
|
6735
6629
|
owner: null,
|
|
6736
6630
|
tagName,
|
|
@@ -6751,6 +6645,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6751
6645
|
*/
|
|
6752
6646
|
freeze(LightningElement);
|
|
6753
6647
|
seal(LightningElement.prototype);
|
|
6754
|
-
/* version: 2.14.
|
|
6648
|
+
/* version: 2.14.2 */
|
|
6755
6649
|
|
|
6756
|
-
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 };
|