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
|
@@ -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.14.
|
|
304
|
+
const LWC_VERSION = "2.14.2";
|
|
305
305
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
306
|
-
/** version: 2.14.
|
|
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.14.
|
|
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,
|
|
@@ -3491,12 +3364,13 @@ var LWC = (function (exports) {
|
|
|
3491
3364
|
* SPDX-License-Identifier: MIT
|
|
3492
3365
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3493
3366
|
*/
|
|
3494
|
-
function getUpgradableConstructor(tagName) {
|
|
3367
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3368
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3495
3369
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3496
3370
|
// produce only tags with lowercase letters
|
|
3497
3371
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3498
3372
|
tagName = tagName.toLowerCase();
|
|
3499
|
-
let CE = getCustomElement
|
|
3373
|
+
let CE = getCustomElement(tagName);
|
|
3500
3374
|
if (!isUndefined$1(CE)) {
|
|
3501
3375
|
return CE;
|
|
3502
3376
|
}
|
|
@@ -3504,7 +3378,7 @@ var LWC = (function (exports) {
|
|
|
3504
3378
|
* LWC Upgradable Element reference to an element that was created
|
|
3505
3379
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3506
3380
|
*/
|
|
3507
|
-
CE = class LWCUpgradableElement extends
|
|
3381
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3508
3382
|
constructor(upgradeCallback) {
|
|
3509
3383
|
super();
|
|
3510
3384
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3512,7 +3386,7 @@ var LWC = (function (exports) {
|
|
|
3512
3386
|
}
|
|
3513
3387
|
}
|
|
3514
3388
|
};
|
|
3515
|
-
defineCustomElement
|
|
3389
|
+
defineCustomElement(tagName, CE);
|
|
3516
3390
|
return CE;
|
|
3517
3391
|
}
|
|
3518
3392
|
|
|
@@ -3537,7 +3411,7 @@ var LWC = (function (exports) {
|
|
|
3537
3411
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3538
3412
|
*/
|
|
3539
3413
|
const ColonCharCode = 58;
|
|
3540
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3414
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3541
3415
|
const { attrs } = vnode.data;
|
|
3542
3416
|
if (isUndefined$1(attrs)) {
|
|
3543
3417
|
return;
|
|
@@ -3547,6 +3421,7 @@ var LWC = (function (exports) {
|
|
|
3547
3421
|
return;
|
|
3548
3422
|
}
|
|
3549
3423
|
const { elm } = vnode;
|
|
3424
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3550
3425
|
for (const key in attrs) {
|
|
3551
3426
|
const cur = attrs[key];
|
|
3552
3427
|
const old = oldAttrs[key];
|
|
@@ -3554,17 +3429,17 @@ var LWC = (function (exports) {
|
|
|
3554
3429
|
unlockAttribute(elm, key);
|
|
3555
3430
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3556
3431
|
// Assume xml namespace
|
|
3557
|
-
setAttribute
|
|
3432
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3558
3433
|
}
|
|
3559
3434
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3560
3435
|
// Assume xlink namespace
|
|
3561
|
-
setAttribute
|
|
3436
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3562
3437
|
}
|
|
3563
3438
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3564
|
-
removeAttribute
|
|
3439
|
+
removeAttribute(elm, key);
|
|
3565
3440
|
}
|
|
3566
3441
|
else {
|
|
3567
|
-
setAttribute
|
|
3442
|
+
setAttribute(elm, key, cur);
|
|
3568
3443
|
}
|
|
3569
3444
|
lockAttribute();
|
|
3570
3445
|
}
|
|
@@ -3582,7 +3457,7 @@ var LWC = (function (exports) {
|
|
|
3582
3457
|
// instead of relying on internally tracked values.
|
|
3583
3458
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3584
3459
|
}
|
|
3585
|
-
function patchProps(oldVnode, vnode) {
|
|
3460
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3586
3461
|
const { props } = vnode.data;
|
|
3587
3462
|
if (isUndefined$1(props)) {
|
|
3588
3463
|
return;
|
|
@@ -3593,13 +3468,14 @@ var LWC = (function (exports) {
|
|
|
3593
3468
|
}
|
|
3594
3469
|
const isFirstPatch = isNull(oldVnode);
|
|
3595
3470
|
const { elm, sel } = vnode;
|
|
3471
|
+
const { getProperty, setProperty } = renderer;
|
|
3596
3472
|
for (const key in props) {
|
|
3597
3473
|
const cur = props[key];
|
|
3598
3474
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3599
3475
|
// different than the one previously set.
|
|
3600
3476
|
if (isFirstPatch ||
|
|
3601
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3602
|
-
setProperty
|
|
3477
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3478
|
+
setProperty(elm, key, cur);
|
|
3603
3479
|
}
|
|
3604
3480
|
}
|
|
3605
3481
|
}
|
|
@@ -3644,13 +3520,14 @@ var LWC = (function (exports) {
|
|
|
3644
3520
|
}
|
|
3645
3521
|
return map;
|
|
3646
3522
|
}
|
|
3647
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3523
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3648
3524
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3649
3525
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3650
3526
|
if (oldClass === newClass) {
|
|
3651
3527
|
return;
|
|
3652
3528
|
}
|
|
3653
|
-
const
|
|
3529
|
+
const { getClassList } = renderer;
|
|
3530
|
+
const classList = getClassList(elm);
|
|
3654
3531
|
const newClassMap = getMapFromClassName(newClass);
|
|
3655
3532
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3656
3533
|
let name;
|
|
@@ -3674,17 +3551,18 @@ var LWC = (function (exports) {
|
|
|
3674
3551
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3675
3552
|
*/
|
|
3676
3553
|
// The style property is a string when defined via an expression in the template.
|
|
3677
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3554
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3678
3555
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3679
3556
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3680
3557
|
if (oldStyle === newStyle) {
|
|
3681
3558
|
return;
|
|
3682
3559
|
}
|
|
3560
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3683
3561
|
if (!isString(newStyle) || newStyle === '') {
|
|
3684
|
-
removeAttribute
|
|
3562
|
+
removeAttribute(elm, 'style');
|
|
3685
3563
|
}
|
|
3686
3564
|
else {
|
|
3687
|
-
setAttribute
|
|
3565
|
+
setAttribute(elm, 'style', newStyle);
|
|
3688
3566
|
}
|
|
3689
3567
|
}
|
|
3690
3568
|
|
|
@@ -3694,14 +3572,15 @@ var LWC = (function (exports) {
|
|
|
3694
3572
|
* SPDX-License-Identifier: MIT
|
|
3695
3573
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3696
3574
|
*/
|
|
3697
|
-
function applyEventListeners(vnode) {
|
|
3575
|
+
function applyEventListeners(vnode, renderer) {
|
|
3698
3576
|
const { elm, data: { on }, } = vnode;
|
|
3699
3577
|
if (isUndefined$1(on)) {
|
|
3700
3578
|
return;
|
|
3701
3579
|
}
|
|
3580
|
+
const { addEventListener } = renderer;
|
|
3702
3581
|
for (const name in on) {
|
|
3703
3582
|
const handler = on[name];
|
|
3704
|
-
addEventListener
|
|
3583
|
+
addEventListener(elm, name, handler);
|
|
3705
3584
|
}
|
|
3706
3585
|
}
|
|
3707
3586
|
|
|
@@ -3714,12 +3593,13 @@ var LWC = (function (exports) {
|
|
|
3714
3593
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3715
3594
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3716
3595
|
// different classnames properties individually instead of via a string.
|
|
3717
|
-
function applyStaticClassAttribute(vnode) {
|
|
3596
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3718
3597
|
const { elm, data: { classMap }, } = vnode;
|
|
3719
3598
|
if (isUndefined$1(classMap)) {
|
|
3720
3599
|
return;
|
|
3721
3600
|
}
|
|
3722
|
-
const
|
|
3601
|
+
const { getClassList } = renderer;
|
|
3602
|
+
const classList = getClassList(elm);
|
|
3723
3603
|
for (const name in classMap) {
|
|
3724
3604
|
classList.add(name);
|
|
3725
3605
|
}
|
|
@@ -3734,14 +3614,15 @@ var LWC = (function (exports) {
|
|
|
3734
3614
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3735
3615
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3736
3616
|
// different style properties individually instead of via a string.
|
|
3737
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3617
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3738
3618
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3739
3619
|
if (isUndefined$1(styleDecls)) {
|
|
3740
3620
|
return;
|
|
3741
3621
|
}
|
|
3622
|
+
const { setCSSStyleProperty } = renderer;
|
|
3742
3623
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3743
3624
|
const [prop, value, important] = styleDecls[i];
|
|
3744
|
-
setCSSStyleProperty
|
|
3625
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3745
3626
|
}
|
|
3746
3627
|
}
|
|
3747
3628
|
|
|
@@ -3751,15 +3632,16 @@ var LWC = (function (exports) {
|
|
|
3751
3632
|
* SPDX-License-Identifier: MIT
|
|
3752
3633
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3753
3634
|
*/
|
|
3754
|
-
function patchChildren(c1, c2, parent) {
|
|
3635
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3755
3636
|
if (hasDynamicChildren(c2)) {
|
|
3756
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3637
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3757
3638
|
}
|
|
3758
3639
|
else {
|
|
3759
|
-
updateStaticChildren(c1, c2, parent);
|
|
3640
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3760
3641
|
}
|
|
3761
3642
|
}
|
|
3762
|
-
function patch(n1, n2) {
|
|
3643
|
+
function patch(n1, n2, renderer) {
|
|
3644
|
+
var _a, _b;
|
|
3763
3645
|
if (n1 === n2) {
|
|
3764
3646
|
return;
|
|
3765
3647
|
}
|
|
@@ -3773,80 +3655,90 @@ var LWC = (function (exports) {
|
|
|
3773
3655
|
}
|
|
3774
3656
|
switch (n2.type) {
|
|
3775
3657
|
case 0 /* Text */:
|
|
3776
|
-
|
|
3658
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3659
|
+
patchText(n1, n2, renderer);
|
|
3777
3660
|
break;
|
|
3778
3661
|
case 1 /* Comment */:
|
|
3779
|
-
|
|
3662
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3663
|
+
patchComment(n1, n2, renderer);
|
|
3780
3664
|
break;
|
|
3781
3665
|
case 2 /* Element */:
|
|
3782
|
-
patchElement(n1, n2);
|
|
3666
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3783
3667
|
break;
|
|
3784
3668
|
case 3 /* CustomElement */:
|
|
3785
|
-
patchCustomElement(n1, n2);
|
|
3669
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3786
3670
|
break;
|
|
3787
3671
|
}
|
|
3788
3672
|
}
|
|
3789
|
-
function mount(node, parent, anchor) {
|
|
3673
|
+
function mount(node, parent, renderer, anchor) {
|
|
3674
|
+
var _a, _b;
|
|
3790
3675
|
switch (node.type) {
|
|
3791
3676
|
case 0 /* Text */:
|
|
3792
|
-
|
|
3677
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3678
|
+
mountText(node, parent, anchor, renderer);
|
|
3793
3679
|
break;
|
|
3794
3680
|
case 1 /* Comment */:
|
|
3795
|
-
|
|
3681
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3682
|
+
mountComment(node, parent, anchor, renderer);
|
|
3796
3683
|
break;
|
|
3797
3684
|
case 2 /* Element */:
|
|
3798
|
-
|
|
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);
|
|
3799
3687
|
break;
|
|
3800
3688
|
case 3 /* CustomElement */:
|
|
3801
|
-
|
|
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);
|
|
3802
3691
|
break;
|
|
3803
3692
|
}
|
|
3804
3693
|
}
|
|
3805
|
-
function patchText(n1, n2) {
|
|
3694
|
+
function patchText(n1, n2, renderer) {
|
|
3806
3695
|
n2.elm = n1.elm;
|
|
3807
3696
|
if (n2.text !== n1.text) {
|
|
3808
|
-
updateTextContent(n2);
|
|
3697
|
+
updateTextContent(n2, renderer);
|
|
3809
3698
|
}
|
|
3810
3699
|
}
|
|
3811
|
-
function mountText(
|
|
3812
|
-
const { owner } =
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3815
|
-
|
|
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);
|
|
3816
3706
|
}
|
|
3817
|
-
function patchComment(n1, n2) {
|
|
3707
|
+
function patchComment(n1, n2, renderer) {
|
|
3818
3708
|
n2.elm = n1.elm;
|
|
3819
3709
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3820
3710
|
// it is the case today.
|
|
3821
3711
|
if (n2.text !== n1.text) {
|
|
3822
|
-
updateTextContent(n2);
|
|
3712
|
+
updateTextContent(n2, renderer);
|
|
3823
3713
|
}
|
|
3824
3714
|
}
|
|
3825
|
-
function mountComment(
|
|
3826
|
-
const { owner } =
|
|
3827
|
-
const
|
|
3828
|
-
|
|
3829
|
-
|
|
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);
|
|
3830
3721
|
}
|
|
3831
|
-
function mountElement(vnode, parent, anchor) {
|
|
3722
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3832
3723
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3724
|
+
const { createElement } = renderer;
|
|
3833
3725
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3834
|
-
const elm = createElement
|
|
3835
|
-
linkNodeToShadow(elm, owner);
|
|
3836
|
-
fallbackElmHook(elm, vnode);
|
|
3726
|
+
const elm = createElement(sel, namespace);
|
|
3727
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3728
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3837
3729
|
vnode.elm = elm;
|
|
3838
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3839
|
-
insertNode(elm, parent, anchor);
|
|
3840
|
-
mountVNodes(vnode.children, elm, null);
|
|
3730
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3731
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3732
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3841
3733
|
}
|
|
3842
|
-
function patchElement(n1, n2) {
|
|
3734
|
+
function patchElement(n1, n2, renderer) {
|
|
3843
3735
|
const elm = (n2.elm = n1.elm);
|
|
3844
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3845
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3736
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3737
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3846
3738
|
}
|
|
3847
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3739
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3848
3740
|
const { sel, owner } = vnode;
|
|
3849
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3741
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3850
3742
|
/**
|
|
3851
3743
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3852
3744
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3856,9 +3748,9 @@ var LWC = (function (exports) {
|
|
|
3856
3748
|
let vm;
|
|
3857
3749
|
const elm = new UpgradableConstructor((elm) => {
|
|
3858
3750
|
// the custom element from the registry is expecting an upgrade callback
|
|
3859
|
-
vm = createViewModelHook(elm, vnode);
|
|
3751
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3860
3752
|
});
|
|
3861
|
-
linkNodeToShadow(elm, owner);
|
|
3753
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3862
3754
|
vnode.elm = elm;
|
|
3863
3755
|
vnode.vm = vm;
|
|
3864
3756
|
if (vm) {
|
|
@@ -3867,23 +3759,23 @@ var LWC = (function (exports) {
|
|
|
3867
3759
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3868
3760
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3869
3761
|
}
|
|
3870
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3871
|
-
insertNode(elm, parent, anchor);
|
|
3762
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3763
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3872
3764
|
if (vm) {
|
|
3873
3765
|
if (process.env.NODE_ENV !== 'production') {
|
|
3874
3766
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3875
3767
|
}
|
|
3876
3768
|
runConnectedCallback(vm);
|
|
3877
3769
|
}
|
|
3878
|
-
mountVNodes(vnode.children, elm, null);
|
|
3770
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3879
3771
|
if (vm) {
|
|
3880
3772
|
appendVM(vm);
|
|
3881
3773
|
}
|
|
3882
3774
|
}
|
|
3883
|
-
function patchCustomElement(n1, n2) {
|
|
3775
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3884
3776
|
const elm = (n2.elm = n1.elm);
|
|
3885
3777
|
const vm = (n2.vm = n1.vm);
|
|
3886
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3778
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3887
3779
|
if (!isUndefined$1(vm)) {
|
|
3888
3780
|
// in fallback mode, the allocation will always set children to
|
|
3889
3781
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3891,34 +3783,36 @@ var LWC = (function (exports) {
|
|
|
3891
3783
|
}
|
|
3892
3784
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3893
3785
|
// will happen, but in native, it does allocate the light dom
|
|
3894
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3786
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3895
3787
|
if (!isUndefined$1(vm)) {
|
|
3896
3788
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3897
3789
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3898
3790
|
rerenderVM(vm);
|
|
3899
3791
|
}
|
|
3900
3792
|
}
|
|
3901
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3793
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3902
3794
|
for (; start < end; ++start) {
|
|
3903
3795
|
const vnode = vnodes[start];
|
|
3904
3796
|
if (isVNode(vnode)) {
|
|
3905
|
-
mount(vnode, parent, anchor);
|
|
3797
|
+
mount(vnode, parent, renderer, anchor);
|
|
3906
3798
|
}
|
|
3907
3799
|
}
|
|
3908
3800
|
}
|
|
3909
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3801
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3910
3802
|
const { type, elm, sel } = vnode;
|
|
3911
3803
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3912
3804
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3913
3805
|
if (doRemove) {
|
|
3914
|
-
|
|
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);
|
|
3915
3809
|
}
|
|
3916
3810
|
switch (type) {
|
|
3917
3811
|
case 2 /* Element */: {
|
|
3918
3812
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3919
3813
|
// Only required for synthetic shadow.
|
|
3920
|
-
const
|
|
3921
|
-
unmountVNodes(vnode.children, elm,
|
|
3814
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3815
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3922
3816
|
break;
|
|
3923
3817
|
}
|
|
3924
3818
|
case 3 /* CustomElement */: {
|
|
@@ -3931,11 +3825,11 @@ var LWC = (function (exports) {
|
|
|
3931
3825
|
}
|
|
3932
3826
|
}
|
|
3933
3827
|
}
|
|
3934
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3828
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3935
3829
|
for (; start < end; ++start) {
|
|
3936
3830
|
const ch = vnodes[start];
|
|
3937
3831
|
if (isVNode(ch)) {
|
|
3938
|
-
unmount(ch, parent, doRemove);
|
|
3832
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3939
3833
|
}
|
|
3940
3834
|
}
|
|
3941
3835
|
}
|
|
@@ -3949,66 +3843,71 @@ var LWC = (function (exports) {
|
|
|
3949
3843
|
elm.$shadowToken$ = token;
|
|
3950
3844
|
}
|
|
3951
3845
|
// Set the scope token class for *.scoped.css styles
|
|
3952
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3846
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3953
3847
|
const { cmpTemplate, context } = owner;
|
|
3848
|
+
const { getClassList } = renderer;
|
|
3954
3849
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3955
3850
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3956
|
-
|
|
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);
|
|
3957
3854
|
}
|
|
3958
3855
|
}
|
|
3959
|
-
function linkNodeToShadow(elm, owner) {
|
|
3856
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3960
3857
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3858
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3961
3859
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3962
|
-
if (isSyntheticShadowDefined
|
|
3860
|
+
if (isSyntheticShadowDefined) {
|
|
3963
3861
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3964
3862
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3965
3863
|
}
|
|
3966
3864
|
}
|
|
3967
3865
|
}
|
|
3968
|
-
function updateTextContent(vnode) {
|
|
3866
|
+
function updateTextContent(vnode, renderer) {
|
|
3969
3867
|
const { elm, text } = vnode;
|
|
3868
|
+
const { setText } = renderer;
|
|
3970
3869
|
if (process.env.NODE_ENV !== 'production') {
|
|
3971
3870
|
unlockDomMutation();
|
|
3972
3871
|
}
|
|
3973
|
-
setText
|
|
3872
|
+
setText(elm, text);
|
|
3974
3873
|
if (process.env.NODE_ENV !== 'production') {
|
|
3975
3874
|
lockDomMutation();
|
|
3976
3875
|
}
|
|
3977
3876
|
}
|
|
3978
|
-
function insertNode(node, parent, anchor) {
|
|
3877
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3979
3878
|
if (process.env.NODE_ENV !== 'production') {
|
|
3980
3879
|
unlockDomMutation();
|
|
3981
3880
|
}
|
|
3982
|
-
insert
|
|
3881
|
+
renderer.insert(node, parent, anchor);
|
|
3983
3882
|
if (process.env.NODE_ENV !== 'production') {
|
|
3984
3883
|
lockDomMutation();
|
|
3985
3884
|
}
|
|
3986
3885
|
}
|
|
3987
|
-
function removeNode(node, parent) {
|
|
3886
|
+
function removeNode(node, parent, renderer) {
|
|
3988
3887
|
if (process.env.NODE_ENV !== 'production') {
|
|
3989
3888
|
unlockDomMutation();
|
|
3990
3889
|
}
|
|
3991
|
-
remove
|
|
3890
|
+
renderer.remove(node, parent);
|
|
3992
3891
|
if (process.env.NODE_ENV !== 'production') {
|
|
3993
3892
|
lockDomMutation();
|
|
3994
3893
|
}
|
|
3995
3894
|
}
|
|
3996
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3895
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3997
3896
|
if (isNull(oldVnode)) {
|
|
3998
|
-
applyEventListeners(vnode);
|
|
3999
|
-
applyStaticClassAttribute(vnode);
|
|
4000
|
-
applyStaticStyleAttribute(vnode);
|
|
3897
|
+
applyEventListeners(vnode, renderer);
|
|
3898
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3899
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4001
3900
|
}
|
|
4002
3901
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4003
3902
|
// value is set before type=radio.
|
|
4004
|
-
patchClassAttribute(oldVnode, vnode);
|
|
4005
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
4006
|
-
patchAttributes(oldVnode, vnode);
|
|
4007
|
-
patchProps(oldVnode, vnode);
|
|
3903
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3904
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3905
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3906
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4008
3907
|
}
|
|
4009
|
-
function fallbackElmHook(elm, vnode) {
|
|
3908
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
4010
3909
|
const { owner } = vnode;
|
|
4011
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3910
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4012
3911
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4013
3912
|
const { data: { context }, } = vnode;
|
|
4014
3913
|
const { stylesheetToken } = owner.context;
|
|
@@ -4056,7 +3955,7 @@ var LWC = (function (exports) {
|
|
|
4056
3955
|
vnode.children = EmptyArray;
|
|
4057
3956
|
}
|
|
4058
3957
|
}
|
|
4059
|
-
function createViewModelHook(elm, vnode) {
|
|
3958
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4060
3959
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4061
3960
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4062
3961
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -4065,7 +3964,7 @@ var LWC = (function (exports) {
|
|
|
4065
3964
|
return vm;
|
|
4066
3965
|
}
|
|
4067
3966
|
const { sel, mode, ctor, owner } = vnode;
|
|
4068
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3967
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4069
3968
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4070
3969
|
const { stylesheetToken } = owner.context;
|
|
4071
3970
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -4074,7 +3973,7 @@ var LWC = (function (exports) {
|
|
|
4074
3973
|
setElementShadowToken(elm, stylesheetToken);
|
|
4075
3974
|
}
|
|
4076
3975
|
}
|
|
4077
|
-
vm = createVM(elm, ctor, {
|
|
3976
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4078
3977
|
mode,
|
|
4079
3978
|
owner,
|
|
4080
3979
|
tagName: sel,
|
|
@@ -4149,7 +4048,7 @@ var LWC = (function (exports) {
|
|
|
4149
4048
|
}
|
|
4150
4049
|
return map;
|
|
4151
4050
|
}
|
|
4152
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4051
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4153
4052
|
let oldStartIdx = 0;
|
|
4154
4053
|
let newStartIdx = 0;
|
|
4155
4054
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4178,26 +4077,26 @@ var LWC = (function (exports) {
|
|
|
4178
4077
|
newEndVnode = newCh[--newEndIdx];
|
|
4179
4078
|
}
|
|
4180
4079
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4181
|
-
patch(oldStartVnode, newStartVnode);
|
|
4080
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4182
4081
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4183
4082
|
newStartVnode = newCh[++newStartIdx];
|
|
4184
4083
|
}
|
|
4185
4084
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4186
|
-
patch(oldEndVnode, newEndVnode);
|
|
4085
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4187
4086
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4188
4087
|
newEndVnode = newCh[--newEndIdx];
|
|
4189
4088
|
}
|
|
4190
4089
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4191
4090
|
// Vnode moved right
|
|
4192
|
-
patch(oldStartVnode, newEndVnode);
|
|
4193
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4091
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4092
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4194
4093
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4195
4094
|
newEndVnode = newCh[--newEndIdx];
|
|
4196
4095
|
}
|
|
4197
4096
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4198
4097
|
// Vnode moved left
|
|
4199
|
-
patch(oldEndVnode, newStartVnode);
|
|
4200
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4098
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4099
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4201
4100
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4202
4101
|
newStartVnode = newCh[++newStartIdx];
|
|
4203
4102
|
}
|
|
@@ -4208,7 +4107,7 @@ var LWC = (function (exports) {
|
|
|
4208
4107
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4209
4108
|
if (isUndefined$1(idxInOld)) {
|
|
4210
4109
|
// New element
|
|
4211
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4110
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4212
4111
|
newStartVnode = newCh[++newStartIdx];
|
|
4213
4112
|
}
|
|
4214
4113
|
else {
|
|
@@ -4216,10 +4115,10 @@ var LWC = (function (exports) {
|
|
|
4216
4115
|
if (isVNode(elmToMove)) {
|
|
4217
4116
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4218
4117
|
// New element
|
|
4219
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4118
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4220
4119
|
}
|
|
4221
4120
|
else {
|
|
4222
|
-
patch(elmToMove, newStartVnode);
|
|
4121
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4223
4122
|
// Delete the old child, but copy the array since it is read-only.
|
|
4224
4123
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4225
4124
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4231,7 +4130,7 @@ var LWC = (function (exports) {
|
|
|
4231
4130
|
}
|
|
4232
4131
|
// We've already cloned at least once, so it's no longer read-only
|
|
4233
4132
|
oldCh[idxInOld] = undefined;
|
|
4234
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4133
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4235
4134
|
}
|
|
4236
4135
|
}
|
|
4237
4136
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4248,25 +4147,25 @@ var LWC = (function (exports) {
|
|
|
4248
4147
|
n = newCh[++i];
|
|
4249
4148
|
} while (!isVNode(n) && i < newChEnd);
|
|
4250
4149
|
before = isVNode(n) ? n.elm : null;
|
|
4251
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4150
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4252
4151
|
}
|
|
4253
4152
|
else {
|
|
4254
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4153
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4255
4154
|
}
|
|
4256
4155
|
}
|
|
4257
4156
|
}
|
|
4258
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4157
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4259
4158
|
const c1Length = c1.length;
|
|
4260
4159
|
const c2Length = c2.length;
|
|
4261
4160
|
if (c1Length === 0) {
|
|
4262
4161
|
// the old list is empty, we can directly insert anything new
|
|
4263
|
-
mountVNodes(c2, parent, null);
|
|
4162
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4264
4163
|
return;
|
|
4265
4164
|
}
|
|
4266
4165
|
if (c2Length === 0) {
|
|
4267
4166
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4268
4167
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4269
|
-
unmountVNodes(c1, parent, true);
|
|
4168
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4270
4169
|
return;
|
|
4271
4170
|
}
|
|
4272
4171
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4279,16 +4178,16 @@ var LWC = (function (exports) {
|
|
|
4279
4178
|
if (isVNode(n1)) {
|
|
4280
4179
|
if (isVNode(n2)) {
|
|
4281
4180
|
// both vnodes are equivalent, and we just need to patch them
|
|
4282
|
-
patch(n1, n2);
|
|
4181
|
+
patch(n1, n2, renderer);
|
|
4283
4182
|
anchor = n2.elm;
|
|
4284
4183
|
}
|
|
4285
4184
|
else {
|
|
4286
4185
|
// removing the old vnode since the new one is null
|
|
4287
|
-
unmount(n1, parent, true);
|
|
4186
|
+
unmount(n1, parent, renderer, true);
|
|
4288
4187
|
}
|
|
4289
4188
|
}
|
|
4290
4189
|
else if (isVNode(n2)) {
|
|
4291
|
-
mount(n2, parent, anchor);
|
|
4190
|
+
mount(n2, parent, renderer, anchor);
|
|
4292
4191
|
anchor = n2.elm;
|
|
4293
4192
|
}
|
|
4294
4193
|
}
|
|
@@ -4717,7 +4616,7 @@ var LWC = (function (exports) {
|
|
|
4717
4616
|
}, [api.t(content)]);
|
|
4718
4617
|
}
|
|
4719
4618
|
function updateStylesheetToken(vm, template) {
|
|
4720
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4619
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4721
4620
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4722
4621
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4723
4622
|
const { hasScopedStyles } = context;
|
|
@@ -4728,10 +4627,10 @@ var LWC = (function (exports) {
|
|
|
4728
4627
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4729
4628
|
if (!isUndefined$1(oldToken)) {
|
|
4730
4629
|
if (oldHasTokenInClass) {
|
|
4731
|
-
getClassList
|
|
4630
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4732
4631
|
}
|
|
4733
4632
|
if (oldHasTokenInAttribute) {
|
|
4734
|
-
removeAttribute
|
|
4633
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4735
4634
|
}
|
|
4736
4635
|
}
|
|
4737
4636
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4742,11 +4641,11 @@ var LWC = (function (exports) {
|
|
|
4742
4641
|
// Set the new styling token on the host element
|
|
4743
4642
|
if (!isUndefined$1(newToken)) {
|
|
4744
4643
|
if (hasScopedStyles) {
|
|
4745
|
-
getClassList
|
|
4644
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4746
4645
|
newHasTokenInClass = true;
|
|
4747
4646
|
}
|
|
4748
4647
|
if (isSyntheticShadow) {
|
|
4749
|
-
setAttribute
|
|
4648
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4750
4649
|
newHasTokenInAttribute = true;
|
|
4751
4650
|
}
|
|
4752
4651
|
}
|
|
@@ -4834,13 +4733,13 @@ var LWC = (function (exports) {
|
|
|
4834
4733
|
return owner;
|
|
4835
4734
|
}
|
|
4836
4735
|
function createStylesheet(vm, stylesheets) {
|
|
4837
|
-
const { renderMode, shadowMode } = vm;
|
|
4736
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4838
4737
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4839
4738
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4840
|
-
insertStylesheet
|
|
4739
|
+
insertStylesheet(stylesheets[i]);
|
|
4841
4740
|
}
|
|
4842
4741
|
}
|
|
4843
|
-
else if (ssr
|
|
4742
|
+
else if (ssr || vm.hydrated) {
|
|
4844
4743
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4845
4744
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4846
4745
|
// the first time the VM renders.
|
|
@@ -4854,7 +4753,7 @@ var LWC = (function (exports) {
|
|
|
4854
4753
|
// null root means a global style
|
|
4855
4754
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4856
4755
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4857
|
-
insertStylesheet
|
|
4756
|
+
insertStylesheet(stylesheets[i], target);
|
|
4858
4757
|
}
|
|
4859
4758
|
}
|
|
4860
4759
|
return null;
|
|
@@ -5409,7 +5308,7 @@ var LWC = (function (exports) {
|
|
|
5409
5308
|
return ancestor;
|
|
5410
5309
|
}
|
|
5411
5310
|
|
|
5412
|
-
function createVM(elm, ctor, options) {
|
|
5311
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5413
5312
|
const {
|
|
5414
5313
|
mode,
|
|
5415
5314
|
owner,
|
|
@@ -5458,9 +5357,10 @@ var LWC = (function (exports) {
|
|
|
5458
5357
|
renderRoot: null,
|
|
5459
5358
|
callHook,
|
|
5460
5359
|
setHook,
|
|
5461
|
-
getHook
|
|
5360
|
+
getHook,
|
|
5361
|
+
renderer
|
|
5462
5362
|
};
|
|
5463
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5363
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5464
5364
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5465
5365
|
|
|
5466
5366
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5485,13 +5385,17 @@ var LWC = (function (exports) {
|
|
|
5485
5385
|
return vm;
|
|
5486
5386
|
}
|
|
5487
5387
|
|
|
5488
|
-
function computeShadowMode(vm) {
|
|
5388
|
+
function computeShadowMode(vm, renderer) {
|
|
5489
5389
|
const {
|
|
5490
5390
|
def
|
|
5491
5391
|
} = vm;
|
|
5392
|
+
const {
|
|
5393
|
+
isSyntheticShadowDefined,
|
|
5394
|
+
isNativeShadowDefined
|
|
5395
|
+
} = renderer;
|
|
5492
5396
|
let shadowMode;
|
|
5493
5397
|
|
|
5494
|
-
if (isSyntheticShadowDefined
|
|
5398
|
+
if (isSyntheticShadowDefined) {
|
|
5495
5399
|
if (def.renderMode === 0
|
|
5496
5400
|
/* Light */
|
|
5497
5401
|
) {
|
|
@@ -5500,7 +5404,7 @@ var LWC = (function (exports) {
|
|
|
5500
5404
|
shadowMode = 0
|
|
5501
5405
|
/* Native */
|
|
5502
5406
|
;
|
|
5503
|
-
} else if (isNativeShadowDefined
|
|
5407
|
+
} else if (isNativeShadowDefined) {
|
|
5504
5408
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5505
5409
|
// the if-condition.
|
|
5506
5410
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5590,7 +5494,8 @@ var LWC = (function (exports) {
|
|
|
5590
5494
|
function patchShadowRoot(vm, newCh) {
|
|
5591
5495
|
const {
|
|
5592
5496
|
renderRoot,
|
|
5593
|
-
children: oldCh
|
|
5497
|
+
children: oldCh,
|
|
5498
|
+
renderer
|
|
5594
5499
|
} = vm; // caching the new children collection
|
|
5595
5500
|
|
|
5596
5501
|
vm.children = newCh;
|
|
@@ -5606,7 +5511,7 @@ var LWC = (function (exports) {
|
|
|
5606
5511
|
, vm);
|
|
5607
5512
|
}, () => {
|
|
5608
5513
|
// job
|
|
5609
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5514
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5610
5515
|
}, () => {
|
|
5611
5516
|
// post
|
|
5612
5517
|
logOperationEnd(2
|
|
@@ -5631,10 +5536,13 @@ var LWC = (function (exports) {
|
|
|
5631
5536
|
const {
|
|
5632
5537
|
def: {
|
|
5633
5538
|
renderedCallback
|
|
5539
|
+
},
|
|
5540
|
+
renderer: {
|
|
5541
|
+
ssr
|
|
5634
5542
|
}
|
|
5635
5543
|
} = vm;
|
|
5636
5544
|
|
|
5637
|
-
if (isTrue(ssr
|
|
5545
|
+
if (isTrue(ssr)) {
|
|
5638
5546
|
return;
|
|
5639
5547
|
}
|
|
5640
5548
|
|
|
@@ -5868,14 +5776,17 @@ var LWC = (function (exports) {
|
|
|
5868
5776
|
function resetComponentRoot(vm) {
|
|
5869
5777
|
const {
|
|
5870
5778
|
children,
|
|
5871
|
-
renderRoot
|
|
5779
|
+
renderRoot,
|
|
5780
|
+
renderer: {
|
|
5781
|
+
remove
|
|
5782
|
+
}
|
|
5872
5783
|
} = vm;
|
|
5873
5784
|
|
|
5874
5785
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5875
5786
|
const child = children[i];
|
|
5876
5787
|
|
|
5877
5788
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5878
|
-
remove
|
|
5789
|
+
remove(child.elm, renderRoot);
|
|
5879
5790
|
}
|
|
5880
5791
|
}
|
|
5881
5792
|
|
|
@@ -5884,7 +5795,13 @@ var LWC = (function (exports) {
|
|
|
5884
5795
|
vm.velements = EmptyArray;
|
|
5885
5796
|
}
|
|
5886
5797
|
function scheduleRehydration(vm) {
|
|
5887
|
-
|
|
5798
|
+
const {
|
|
5799
|
+
renderer: {
|
|
5800
|
+
ssr
|
|
5801
|
+
}
|
|
5802
|
+
} = vm;
|
|
5803
|
+
|
|
5804
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5888
5805
|
return;
|
|
5889
5806
|
}
|
|
5890
5807
|
|
|
@@ -6060,6 +5977,9 @@ var LWC = (function (exports) {
|
|
|
6060
5977
|
context: {
|
|
6061
5978
|
wiredConnecting,
|
|
6062
5979
|
wiredDisconnecting
|
|
5980
|
+
},
|
|
5981
|
+
renderer: {
|
|
5982
|
+
dispatchEvent
|
|
6063
5983
|
}
|
|
6064
5984
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
6065
5985
|
|
|
@@ -6083,7 +6003,7 @@ var LWC = (function (exports) {
|
|
|
6083
6003
|
}
|
|
6084
6004
|
|
|
6085
6005
|
});
|
|
6086
|
-
dispatchEvent
|
|
6006
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6087
6007
|
});
|
|
6088
6008
|
}
|
|
6089
6009
|
|
|
@@ -6331,95 +6251,105 @@ var LWC = (function (exports) {
|
|
|
6331
6251
|
function hydrateVM(vm) {
|
|
6332
6252
|
const children = renderComponent(vm);
|
|
6333
6253
|
vm.children = children;
|
|
6334
|
-
const parentNode = vm
|
|
6335
|
-
hydrateChildren(getFirstChild
|
|
6254
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6255
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6336
6256
|
runRenderedCallback(vm);
|
|
6337
6257
|
}
|
|
6338
|
-
function hydrateNode(node, vnode) {
|
|
6258
|
+
function hydrateNode(node, vnode, renderer) {
|
|
6259
|
+
var _a, _b;
|
|
6339
6260
|
let hydratedNode;
|
|
6340
6261
|
switch (vnode.type) {
|
|
6341
6262
|
case 0 /* Text */:
|
|
6342
|
-
|
|
6263
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
6264
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
6343
6265
|
break;
|
|
6344
6266
|
case 1 /* Comment */:
|
|
6345
|
-
|
|
6267
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
6268
|
+
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
6346
6269
|
break;
|
|
6347
6270
|
case 2 /* Element */:
|
|
6348
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
6271
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
6349
6272
|
break;
|
|
6350
6273
|
case 3 /* CustomElement */:
|
|
6351
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6274
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
6352
6275
|
break;
|
|
6353
6276
|
}
|
|
6354
|
-
return nextSibling
|
|
6277
|
+
return renderer.nextSibling(hydratedNode);
|
|
6355
6278
|
}
|
|
6356
|
-
function hydrateText(node, vnode) {
|
|
6279
|
+
function hydrateText(node, vnode, renderer) {
|
|
6357
6280
|
var _a;
|
|
6358
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
6359
|
-
return handleMismatch(node, vnode);
|
|
6281
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
6282
|
+
return handleMismatch(node, vnode, renderer);
|
|
6360
6283
|
}
|
|
6361
6284
|
if (process.env.NODE_ENV !== 'production') {
|
|
6362
|
-
const
|
|
6285
|
+
const { getProperty } = renderer;
|
|
6286
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6363
6287
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6364
6288
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6365
6289
|
}
|
|
6366
6290
|
}
|
|
6367
|
-
setText
|
|
6291
|
+
const { setText } = renderer;
|
|
6292
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6368
6293
|
vnode.elm = node;
|
|
6369
6294
|
return node;
|
|
6370
6295
|
}
|
|
6371
|
-
function hydrateComment(node, vnode) {
|
|
6296
|
+
function hydrateComment(node, vnode, renderer) {
|
|
6372
6297
|
var _a;
|
|
6373
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
6374
|
-
return handleMismatch(node, vnode);
|
|
6298
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
6299
|
+
return handleMismatch(node, vnode, renderer);
|
|
6375
6300
|
}
|
|
6376
6301
|
if (process.env.NODE_ENV !== 'production') {
|
|
6377
|
-
const
|
|
6302
|
+
const { getProperty } = renderer;
|
|
6303
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6378
6304
|
if (nodeValue !== vnode.text) {
|
|
6379
6305
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6380
6306
|
}
|
|
6381
6307
|
}
|
|
6382
|
-
setProperty
|
|
6308
|
+
const { setProperty } = renderer;
|
|
6309
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6383
6310
|
vnode.elm = node;
|
|
6384
6311
|
return node;
|
|
6385
6312
|
}
|
|
6386
|
-
function hydrateElement(elm, vnode) {
|
|
6387
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6388
|
-
!isMatchingElement(vnode, elm)) {
|
|
6389
|
-
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);
|
|
6390
6317
|
}
|
|
6391
6318
|
vnode.elm = elm;
|
|
6319
|
+
const { owner } = vnode;
|
|
6392
6320
|
const { context } = vnode.data;
|
|
6393
6321
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6394
6322
|
if (isDomManual) {
|
|
6395
6323
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6396
6324
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6397
|
-
const { props } = vnode
|
|
6325
|
+
const { data: { props }, } = vnode;
|
|
6326
|
+
const { getProperty } = renderer;
|
|
6398
6327
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6399
|
-
if (getProperty
|
|
6328
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6400
6329
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6401
6330
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6402
6331
|
}
|
|
6403
6332
|
else {
|
|
6404
6333
|
if (process.env.NODE_ENV !== 'production') {
|
|
6405
|
-
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);
|
|
6406
6335
|
}
|
|
6407
6336
|
}
|
|
6408
6337
|
}
|
|
6409
6338
|
}
|
|
6410
|
-
patchElementPropsAndAttrs(vnode);
|
|
6339
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6411
6340
|
if (!isDomManual) {
|
|
6412
|
-
|
|
6341
|
+
const { getFirstChild } = renderer;
|
|
6342
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6413
6343
|
}
|
|
6414
6344
|
return elm;
|
|
6415
6345
|
}
|
|
6416
|
-
function hydrateCustomElement(elm, vnode) {
|
|
6417
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6418
|
-
!isMatchingElement(vnode, elm)) {
|
|
6419
|
-
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);
|
|
6420
6350
|
}
|
|
6421
6351
|
const { sel, mode, ctor, owner } = vnode;
|
|
6422
|
-
const vm = createVM(elm, ctor, {
|
|
6352
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
6423
6353
|
mode,
|
|
6424
6354
|
owner,
|
|
6425
6355
|
tagName: sel,
|
|
@@ -6428,16 +6358,17 @@ var LWC = (function (exports) {
|
|
|
6428
6358
|
vnode.elm = elm;
|
|
6429
6359
|
vnode.vm = vm;
|
|
6430
6360
|
allocateChildren(vnode, vm);
|
|
6431
|
-
patchElementPropsAndAttrs(vnode);
|
|
6361
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6432
6362
|
// Insert hook section:
|
|
6433
6363
|
if (process.env.NODE_ENV !== 'production') {
|
|
6434
6364
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6435
6365
|
}
|
|
6436
6366
|
runConnectedCallback(vm);
|
|
6437
6367
|
if (vm.renderMode !== 0 /* Light */) {
|
|
6368
|
+
const { getFirstChild } = renderer;
|
|
6438
6369
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6439
6370
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6440
|
-
hydrateChildren(getFirstChild
|
|
6371
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6441
6372
|
}
|
|
6442
6373
|
hydrateVM(vm);
|
|
6443
6374
|
return elm;
|
|
@@ -6446,11 +6377,12 @@ var LWC = (function (exports) {
|
|
|
6446
6377
|
let hasWarned = false;
|
|
6447
6378
|
let nextNode = node;
|
|
6448
6379
|
let anchor = null;
|
|
6380
|
+
const { renderer } = owner;
|
|
6449
6381
|
for (let i = 0; i < children.length; i++) {
|
|
6450
6382
|
const childVnode = children[i];
|
|
6451
6383
|
if (!isNull(childVnode)) {
|
|
6452
6384
|
if (nextNode) {
|
|
6453
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
6385
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6454
6386
|
anchor = childVnode.elm;
|
|
6455
6387
|
}
|
|
6456
6388
|
else {
|
|
@@ -6461,7 +6393,7 @@ var LWC = (function (exports) {
|
|
|
6461
6393
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6462
6394
|
}
|
|
6463
6395
|
}
|
|
6464
|
-
mount(childVnode, parentNode, anchor);
|
|
6396
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
6465
6397
|
anchor = childVnode.elm;
|
|
6466
6398
|
}
|
|
6467
6399
|
}
|
|
@@ -6473,31 +6405,33 @@ var LWC = (function (exports) {
|
|
|
6473
6405
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6474
6406
|
}
|
|
6475
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;
|
|
6476
6413
|
do {
|
|
6477
6414
|
const current = nextNode;
|
|
6478
|
-
nextNode = nextSibling
|
|
6479
|
-
removeNode(current, parentNode);
|
|
6415
|
+
nextNode = nextSibling(nextNode);
|
|
6416
|
+
removeNode(current, parentNode, renderer);
|
|
6480
6417
|
} while (nextNode);
|
|
6481
6418
|
}
|
|
6482
6419
|
}
|
|
6483
|
-
function handleMismatch(node, vnode,
|
|
6420
|
+
function handleMismatch(node, vnode, renderer) {
|
|
6484
6421
|
hasMismatch = true;
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
}
|
|
6490
|
-
const parentNode = getProperty$1(node, 'parentNode');
|
|
6491
|
-
mount(vnode, parentNode, node);
|
|
6492
|
-
removeNode(node, parentNode);
|
|
6422
|
+
const { getProperty } = renderer;
|
|
6423
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
6424
|
+
mount(vnode, parentNode, renderer, node);
|
|
6425
|
+
removeNode(node, parentNode, renderer);
|
|
6493
6426
|
return vnode.elm;
|
|
6494
6427
|
}
|
|
6495
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6496
|
-
applyEventListeners(vnode);
|
|
6497
|
-
patchProps(null, vnode);
|
|
6428
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
6429
|
+
applyEventListeners(vnode, renderer);
|
|
6430
|
+
patchProps(null, vnode, renderer);
|
|
6498
6431
|
}
|
|
6499
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6500
|
-
|
|
6432
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
6433
|
+
const { getProperty } = renderer;
|
|
6434
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
6501
6435
|
if (process.env.NODE_ENV !== 'production') {
|
|
6502
6436
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6503
6437
|
}
|
|
@@ -6505,46 +6439,51 @@ var LWC = (function (exports) {
|
|
|
6505
6439
|
}
|
|
6506
6440
|
return true;
|
|
6507
6441
|
}
|
|
6508
|
-
function isMatchingElement(vnode, elm) {
|
|
6509
|
-
|
|
6442
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
6443
|
+
const { getProperty } = renderer;
|
|
6444
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6510
6445
|
if (process.env.NODE_ENV !== 'production') {
|
|
6511
|
-
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);
|
|
6512
6447
|
}
|
|
6513
6448
|
return false;
|
|
6514
6449
|
}
|
|
6515
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6516
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6517
|
-
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);
|
|
6518
6453
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6519
6454
|
}
|
|
6520
|
-
function validateAttrs(vnode, elm) {
|
|
6455
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
6521
6456
|
const { data: { attrs = {} }, } = vnode;
|
|
6522
6457
|
let nodesAreCompatible = true;
|
|
6523
6458
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6524
6459
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6525
6460
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6526
|
-
const
|
|
6461
|
+
const { owner } = vnode;
|
|
6462
|
+
const { getAttribute } = renderer;
|
|
6463
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
6527
6464
|
if (String(attrValue) !== elmAttrValue) {
|
|
6528
6465
|
if (process.env.NODE_ENV !== 'production') {
|
|
6529
|
-
|
|
6466
|
+
const { getProperty } = renderer;
|
|
6467
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
6530
6468
|
}
|
|
6531
6469
|
nodesAreCompatible = false;
|
|
6532
6470
|
}
|
|
6533
6471
|
}
|
|
6534
6472
|
return nodesAreCompatible;
|
|
6535
6473
|
}
|
|
6536
|
-
function validateClassAttr(vnode, elm) {
|
|
6474
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
6537
6475
|
const { data: { className, classMap }, } = vnode;
|
|
6476
|
+
const { getProperty, getClassList } = renderer;
|
|
6538
6477
|
let nodesAreCompatible = true;
|
|
6539
6478
|
let vnodeClassName;
|
|
6540
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
6479
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
6541
6480
|
// className is used when class is bound to an expr.
|
|
6542
6481
|
nodesAreCompatible = false;
|
|
6543
6482
|
vnodeClassName = className;
|
|
6544
6483
|
}
|
|
6545
6484
|
else if (!isUndefined$1(classMap)) {
|
|
6546
6485
|
// classMap is used when class is set to static value.
|
|
6547
|
-
const classList = getClassList
|
|
6486
|
+
const classList = getClassList(elm);
|
|
6548
6487
|
let computedClassName = '';
|
|
6549
6488
|
// all classes from the vnode should be in the element.classList
|
|
6550
6489
|
for (const name in classMap) {
|
|
@@ -6560,14 +6499,15 @@ var LWC = (function (exports) {
|
|
|
6560
6499
|
}
|
|
6561
6500
|
if (!nodesAreCompatible) {
|
|
6562
6501
|
if (process.env.NODE_ENV !== 'production') {
|
|
6563
|
-
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);
|
|
6564
6503
|
}
|
|
6565
6504
|
}
|
|
6566
6505
|
return nodesAreCompatible;
|
|
6567
6506
|
}
|
|
6568
|
-
function validateStyleAttr(vnode, elm) {
|
|
6507
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
6569
6508
|
const { data: { style, styleDecls }, } = vnode;
|
|
6570
|
-
const
|
|
6509
|
+
const { getAttribute } = renderer;
|
|
6510
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
6571
6511
|
let vnodeStyle;
|
|
6572
6512
|
let nodesAreCompatible = true;
|
|
6573
6513
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
@@ -6599,7 +6539,8 @@ var LWC = (function (exports) {
|
|
|
6599
6539
|
}
|
|
6600
6540
|
if (!nodesAreCompatible) {
|
|
6601
6541
|
if (process.env.NODE_ENV !== 'production') {
|
|
6602
|
-
|
|
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);
|
|
6603
6544
|
}
|
|
6604
6545
|
}
|
|
6605
6546
|
return nodesAreCompatible;
|
|
@@ -6739,7 +6680,7 @@ var LWC = (function (exports) {
|
|
|
6739
6680
|
}
|
|
6740
6681
|
return ctor;
|
|
6741
6682
|
}
|
|
6742
|
-
/* version: 2.14.
|
|
6683
|
+
/* version: 2.14.2 */
|
|
6743
6684
|
|
|
6744
6685
|
/*
|
|
6745
6686
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6898,7 +6839,7 @@ var LWC = (function (exports) {
|
|
|
6898
6839
|
try {
|
|
6899
6840
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6900
6841
|
// _wrapNativeSuper()
|
|
6901
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
6842
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6902
6843
|
// get wrapped by babel.
|
|
6903
6844
|
const HTMLElementAlias = HTMLElement;
|
|
6904
6845
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -6952,6 +6893,9 @@ var LWC = (function (exports) {
|
|
|
6952
6893
|
hydrating = value;
|
|
6953
6894
|
}
|
|
6954
6895
|
const ssr = false;
|
|
6896
|
+
function isHydrating() {
|
|
6897
|
+
return hydrating;
|
|
6898
|
+
}
|
|
6955
6899
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6956
6900
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6957
6901
|
function createElement$1(tagName, namespace) {
|
|
@@ -7070,76 +7014,47 @@ var LWC = (function (exports) {
|
|
|
7070
7014
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7071
7015
|
}
|
|
7072
7016
|
const HTMLElementExported = HTMLElementConstructor;
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
setSetText(setText);
|
|
7115
|
-
setSsr(ssr);
|
|
7116
|
-
setAddEventListener(addEventListener);
|
|
7117
|
-
setInsertStylesheet(insertStylesheet);
|
|
7118
|
-
|
|
7119
|
-
/*
|
|
7120
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7121
|
-
* All rights reserved.
|
|
7122
|
-
* SPDX-License-Identifier: MIT
|
|
7123
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7124
|
-
*/
|
|
7125
|
-
// @ts-ignore
|
|
7126
|
-
|
|
7127
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7128
|
-
window.addEventListener('test-dummy-flag', () => {
|
|
7129
|
-
let hasFlag = false;
|
|
7130
|
-
|
|
7131
|
-
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7132
|
-
hasFlag = true;
|
|
7133
|
-
}
|
|
7134
|
-
|
|
7135
|
-
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7136
|
-
detail: {
|
|
7137
|
-
package: '@lwc/engine-dom',
|
|
7138
|
-
hasFlag
|
|
7139
|
-
}
|
|
7140
|
-
}));
|
|
7141
|
-
});
|
|
7142
|
-
}
|
|
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
|
+
};
|
|
7143
7058
|
|
|
7144
7059
|
/*
|
|
7145
7060
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7161,7 +7076,7 @@ var LWC = (function (exports) {
|
|
|
7161
7076
|
}
|
|
7162
7077
|
}
|
|
7163
7078
|
function createVMWithProps(element, Ctor, props) {
|
|
7164
|
-
const vm = createVM(element, Ctor, {
|
|
7079
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
7165
7080
|
mode: 'open',
|
|
7166
7081
|
owner: null,
|
|
7167
7082
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -7257,7 +7172,7 @@ var LWC = (function (exports) {
|
|
|
7257
7172
|
hydratedCustomElements.add(this);
|
|
7258
7173
|
}
|
|
7259
7174
|
else {
|
|
7260
|
-
createVM(this, Ctor, {
|
|
7175
|
+
createVM(this, Ctor, renderer, {
|
|
7261
7176
|
mode: 'open',
|
|
7262
7177
|
owner: null,
|
|
7263
7178
|
tagName: this.tagName,
|
|
@@ -7342,7 +7257,7 @@ var LWC = (function (exports) {
|
|
|
7342
7257
|
if (!isFunction$1(Ctor)) {
|
|
7343
7258
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7344
7259
|
}
|
|
7345
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
7260
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7346
7261
|
let wasComponentUpgraded = false;
|
|
7347
7262
|
// the custom element from the registry is expecting an upgrade callback
|
|
7348
7263
|
/**
|
|
@@ -7352,7 +7267,7 @@ var LWC = (function (exports) {
|
|
|
7352
7267
|
* an upgradable custom element.
|
|
7353
7268
|
*/
|
|
7354
7269
|
const element = new UpgradableConstructor((elm) => {
|
|
7355
|
-
createVM(elm, Ctor, {
|
|
7270
|
+
createVM(elm, Ctor, renderer, {
|
|
7356
7271
|
tagName: sel,
|
|
7357
7272
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7358
7273
|
owner: null,
|
|
@@ -7436,7 +7351,7 @@ var LWC = (function (exports) {
|
|
|
7436
7351
|
});
|
|
7437
7352
|
freeze(LightningElement);
|
|
7438
7353
|
seal(LightningElement.prototype);
|
|
7439
|
-
/* version: 2.14.
|
|
7354
|
+
/* version: 2.14.2 */
|
|
7440
7355
|
|
|
7441
7356
|
exports.LightningElement = LightningElement;
|
|
7442
7357
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7455,6 +7370,7 @@ var LWC = (function (exports) {
|
|
|
7455
7370
|
exports.registerComponent = registerComponent;
|
|
7456
7371
|
exports.registerDecorators = registerDecorators;
|
|
7457
7372
|
exports.registerTemplate = registerTemplate;
|
|
7373
|
+
exports.renderer = renderer;
|
|
7458
7374
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7459
7375
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7460
7376
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|