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