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
|
@@ -304,9 +304,9 @@
|
|
|
304
304
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
305
305
|
*/
|
|
306
306
|
// Increment whenever the LWC template compiler changes
|
|
307
|
-
const LWC_VERSION = "2.14.
|
|
307
|
+
const LWC_VERSION = "2.14.2";
|
|
308
308
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.14.
|
|
309
|
+
/** version: 2.14.2 */
|
|
310
310
|
|
|
311
311
|
/*
|
|
312
312
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -460,7 +460,32 @@
|
|
|
460
460
|
setFeatureFlag(name, value);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
/** version: 2.14.
|
|
463
|
+
/** version: 2.14.2 */
|
|
464
|
+
|
|
465
|
+
/*
|
|
466
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
467
|
+
* All rights reserved.
|
|
468
|
+
* SPDX-License-Identifier: MIT
|
|
469
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
470
|
+
*/
|
|
471
|
+
// @ts-ignore
|
|
472
|
+
|
|
473
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
474
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
475
|
+
let hasFlag = false;
|
|
476
|
+
|
|
477
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
478
|
+
hasFlag = true;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
482
|
+
detail: {
|
|
483
|
+
package: '@lwc/engine-dom',
|
|
484
|
+
hasFlag
|
|
485
|
+
}
|
|
486
|
+
}));
|
|
487
|
+
});
|
|
488
|
+
}
|
|
464
489
|
|
|
465
490
|
/* proxy-compat-disable */
|
|
466
491
|
|
|
@@ -570,162 +595,6 @@
|
|
|
570
595
|
return list;
|
|
571
596
|
}
|
|
572
597
|
|
|
573
|
-
//
|
|
574
|
-
// Primitives
|
|
575
|
-
//
|
|
576
|
-
let ssr$1;
|
|
577
|
-
function setSsr(ssrImpl) {
|
|
578
|
-
ssr$1 = ssrImpl;
|
|
579
|
-
}
|
|
580
|
-
let isNativeShadowDefined$1;
|
|
581
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
582
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
583
|
-
}
|
|
584
|
-
let isSyntheticShadowDefined$1;
|
|
585
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
586
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
587
|
-
}
|
|
588
|
-
let HTMLElementExported$1;
|
|
589
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
590
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
591
|
-
}
|
|
592
|
-
let insert$1;
|
|
593
|
-
function setInsert(insertImpl) {
|
|
594
|
-
insert$1 = insertImpl;
|
|
595
|
-
}
|
|
596
|
-
let remove$1;
|
|
597
|
-
function setRemove(removeImpl) {
|
|
598
|
-
remove$1 = removeImpl;
|
|
599
|
-
}
|
|
600
|
-
let createElement$2;
|
|
601
|
-
function setCreateElement(createElementImpl) {
|
|
602
|
-
createElement$2 = createElementImpl;
|
|
603
|
-
}
|
|
604
|
-
let createText$1;
|
|
605
|
-
function setCreateText(createTextImpl) {
|
|
606
|
-
createText$1 = createTextImpl;
|
|
607
|
-
}
|
|
608
|
-
let createComment$1;
|
|
609
|
-
function setCreateComment(createCommentImpl) {
|
|
610
|
-
createComment$1 = createCommentImpl;
|
|
611
|
-
}
|
|
612
|
-
let nextSibling$1;
|
|
613
|
-
function setNextSibling(nextSiblingImpl) {
|
|
614
|
-
nextSibling$1 = nextSiblingImpl;
|
|
615
|
-
}
|
|
616
|
-
let attachShadow$1;
|
|
617
|
-
function setAttachShadow(attachShadowImpl) {
|
|
618
|
-
attachShadow$1 = attachShadowImpl;
|
|
619
|
-
}
|
|
620
|
-
let getProperty$1;
|
|
621
|
-
function setGetProperty(getPropertyImpl) {
|
|
622
|
-
getProperty$1 = getPropertyImpl;
|
|
623
|
-
}
|
|
624
|
-
let setProperty$1;
|
|
625
|
-
function setSetProperty(setPropertyImpl) {
|
|
626
|
-
setProperty$1 = setPropertyImpl;
|
|
627
|
-
}
|
|
628
|
-
let setText$1;
|
|
629
|
-
function setSetText(setTextImpl) {
|
|
630
|
-
setText$1 = setTextImpl;
|
|
631
|
-
}
|
|
632
|
-
let getAttribute$1;
|
|
633
|
-
function setGetAttribute(getAttributeImpl) {
|
|
634
|
-
getAttribute$1 = getAttributeImpl;
|
|
635
|
-
}
|
|
636
|
-
let setAttribute$1;
|
|
637
|
-
function setSetAttribute(setAttributeImpl) {
|
|
638
|
-
setAttribute$1 = setAttributeImpl;
|
|
639
|
-
}
|
|
640
|
-
let removeAttribute$1;
|
|
641
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
642
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
643
|
-
}
|
|
644
|
-
let addEventListener$1;
|
|
645
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
646
|
-
addEventListener$1 = addEventListenerImpl;
|
|
647
|
-
}
|
|
648
|
-
let removeEventListener$1;
|
|
649
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
650
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
651
|
-
}
|
|
652
|
-
let dispatchEvent$1;
|
|
653
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
654
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
655
|
-
}
|
|
656
|
-
let getClassList$1;
|
|
657
|
-
function setGetClassList(getClassListImpl) {
|
|
658
|
-
getClassList$1 = getClassListImpl;
|
|
659
|
-
}
|
|
660
|
-
let setCSSStyleProperty$1;
|
|
661
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
662
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
663
|
-
}
|
|
664
|
-
let getBoundingClientRect$1;
|
|
665
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
666
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
667
|
-
}
|
|
668
|
-
let querySelector$1;
|
|
669
|
-
function setQuerySelector(querySelectorImpl) {
|
|
670
|
-
querySelector$1 = querySelectorImpl;
|
|
671
|
-
}
|
|
672
|
-
let querySelectorAll$1;
|
|
673
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
674
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
675
|
-
}
|
|
676
|
-
let getElementsByTagName$1;
|
|
677
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
678
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
679
|
-
}
|
|
680
|
-
let getElementsByClassName$1;
|
|
681
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
682
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
683
|
-
}
|
|
684
|
-
let getChildren$1;
|
|
685
|
-
function setGetChildren(getChildrenImpl) {
|
|
686
|
-
getChildren$1 = getChildrenImpl;
|
|
687
|
-
}
|
|
688
|
-
let getChildNodes$1;
|
|
689
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
690
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
691
|
-
}
|
|
692
|
-
let getFirstChild$1;
|
|
693
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
694
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
695
|
-
}
|
|
696
|
-
let getFirstElementChild$1;
|
|
697
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
698
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
699
|
-
}
|
|
700
|
-
let getLastChild$1;
|
|
701
|
-
function setGetLastChild(getLastChildImpl) {
|
|
702
|
-
getLastChild$1 = getLastChildImpl;
|
|
703
|
-
}
|
|
704
|
-
let getLastElementChild$1;
|
|
705
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
706
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
707
|
-
}
|
|
708
|
-
let isConnected$1;
|
|
709
|
-
function setIsConnected(isConnectedImpl) {
|
|
710
|
-
isConnected$1 = isConnectedImpl;
|
|
711
|
-
}
|
|
712
|
-
let insertStylesheet$1;
|
|
713
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
714
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
715
|
-
}
|
|
716
|
-
let assertInstanceOfHTMLElement$1;
|
|
717
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
718
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
719
|
-
}
|
|
720
|
-
let defineCustomElement$1;
|
|
721
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
722
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
723
|
-
}
|
|
724
|
-
let getCustomElement$1;
|
|
725
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
726
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
598
|
/*
|
|
730
599
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
731
600
|
* All rights reserved.
|
|
@@ -2030,7 +1899,8 @@
|
|
|
2030
1899
|
const { def, elm } = vm;
|
|
2031
1900
|
const { bridge } = def;
|
|
2032
1901
|
if (process.env.NODE_ENV !== 'production') {
|
|
2033
|
-
|
|
1902
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1903
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2034
1904
|
}
|
|
2035
1905
|
const component = this;
|
|
2036
1906
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2064,8 +1934,8 @@
|
|
|
2064
1934
|
return this;
|
|
2065
1935
|
};
|
|
2066
1936
|
function doAttachShadow(vm) {
|
|
2067
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2068
|
-
const shadowRoot = attachShadow
|
|
1937
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1938
|
+
const shadowRoot = attachShadow(elm, {
|
|
2069
1939
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2070
1940
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2071
1941
|
mode,
|
|
@@ -2086,12 +1956,13 @@
|
|
|
2086
1956
|
LightningElement.prototype = {
|
|
2087
1957
|
constructor: LightningElement,
|
|
2088
1958
|
dispatchEvent(event) {
|
|
2089
|
-
const
|
|
2090
|
-
|
|
1959
|
+
const vm = getAssociatedVM(this);
|
|
1960
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1961
|
+
return dispatchEvent(elm, event);
|
|
2091
1962
|
},
|
|
2092
1963
|
addEventListener(type, listener, options) {
|
|
2093
1964
|
const vm = getAssociatedVM(this);
|
|
2094
|
-
const { elm } = vm;
|
|
1965
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2095
1966
|
if (process.env.NODE_ENV !== 'production') {
|
|
2096
1967
|
const vmBeingRendered = getVMBeingRendered();
|
|
2097
1968
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2099,83 +1970,91 @@
|
|
|
2099
1970
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2100
1971
|
}
|
|
2101
1972
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2102
|
-
addEventListener
|
|
1973
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2103
1974
|
},
|
|
2104
1975
|
removeEventListener(type, listener, options) {
|
|
2105
1976
|
const vm = getAssociatedVM(this);
|
|
2106
|
-
const { elm } = vm;
|
|
1977
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2107
1978
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2108
|
-
removeEventListener
|
|
1979
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2109
1980
|
},
|
|
2110
1981
|
hasAttribute(name) {
|
|
2111
|
-
const
|
|
2112
|
-
|
|
1982
|
+
const vm = getAssociatedVM(this);
|
|
1983
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1984
|
+
return !isNull(getAttribute(elm, name));
|
|
2113
1985
|
},
|
|
2114
1986
|
hasAttributeNS(namespace, name) {
|
|
2115
|
-
const
|
|
2116
|
-
|
|
1987
|
+
const vm = getAssociatedVM(this);
|
|
1988
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1989
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2117
1990
|
},
|
|
2118
1991
|
removeAttribute(name) {
|
|
2119
|
-
const
|
|
1992
|
+
const vm = getAssociatedVM(this);
|
|
1993
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2120
1994
|
unlockAttribute(elm, name);
|
|
2121
|
-
removeAttribute
|
|
1995
|
+
removeAttribute(elm, name);
|
|
2122
1996
|
lockAttribute();
|
|
2123
1997
|
},
|
|
2124
1998
|
removeAttributeNS(namespace, name) {
|
|
2125
|
-
const { elm } = getAssociatedVM(this);
|
|
1999
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2126
2000
|
unlockAttribute(elm, name);
|
|
2127
|
-
removeAttribute
|
|
2001
|
+
removeAttribute(elm, name, namespace);
|
|
2128
2002
|
lockAttribute();
|
|
2129
2003
|
},
|
|
2130
2004
|
getAttribute(name) {
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2005
|
+
const vm = getAssociatedVM(this);
|
|
2006
|
+
const { elm } = vm;
|
|
2007
|
+
const { getAttribute } = vm.renderer;
|
|
2008
|
+
return getAttribute(elm, name);
|
|
2133
2009
|
},
|
|
2134
2010
|
getAttributeNS(namespace, name) {
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2011
|
+
const vm = getAssociatedVM(this);
|
|
2012
|
+
const { elm } = vm;
|
|
2013
|
+
const { getAttribute } = vm.renderer;
|
|
2014
|
+
return getAttribute(elm, name, namespace);
|
|
2137
2015
|
},
|
|
2138
2016
|
setAttribute(name, value) {
|
|
2139
2017
|
const vm = getAssociatedVM(this);
|
|
2140
|
-
const { elm } = vm;
|
|
2018
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2141
2019
|
if (process.env.NODE_ENV !== 'production') {
|
|
2142
2020
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2143
2021
|
}
|
|
2144
2022
|
unlockAttribute(elm, name);
|
|
2145
|
-
setAttribute
|
|
2023
|
+
setAttribute(elm, name, value);
|
|
2146
2024
|
lockAttribute();
|
|
2147
2025
|
},
|
|
2148
2026
|
setAttributeNS(namespace, name, value) {
|
|
2149
2027
|
const vm = getAssociatedVM(this);
|
|
2150
|
-
const { elm } = vm;
|
|
2028
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2151
2029
|
if (process.env.NODE_ENV !== 'production') {
|
|
2152
2030
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2153
2031
|
}
|
|
2154
2032
|
unlockAttribute(elm, name);
|
|
2155
|
-
setAttribute
|
|
2033
|
+
setAttribute(elm, name, value, namespace);
|
|
2156
2034
|
lockAttribute();
|
|
2157
2035
|
},
|
|
2158
2036
|
getBoundingClientRect() {
|
|
2159
2037
|
const vm = getAssociatedVM(this);
|
|
2160
|
-
const { elm } = vm;
|
|
2038
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2161
2039
|
if (process.env.NODE_ENV !== 'production') {
|
|
2162
2040
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2163
2041
|
}
|
|
2164
|
-
return getBoundingClientRect
|
|
2042
|
+
return getBoundingClientRect(elm);
|
|
2165
2043
|
},
|
|
2166
2044
|
get isConnected() {
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2045
|
+
const vm = getAssociatedVM(this);
|
|
2046
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2047
|
+
return isConnected(elm);
|
|
2169
2048
|
},
|
|
2170
2049
|
get classList() {
|
|
2171
2050
|
const vm = getAssociatedVM(this);
|
|
2172
|
-
const { elm } = vm;
|
|
2051
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2173
2052
|
if (process.env.NODE_ENV !== 'production') {
|
|
2174
2053
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2175
2054
|
// just throw in all modes
|
|
2176
2055
|
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.`);
|
|
2177
2056
|
}
|
|
2178
|
-
return getClassList
|
|
2057
|
+
return getClassList(elm);
|
|
2179
2058
|
},
|
|
2180
2059
|
get template() {
|
|
2181
2060
|
const vm = getAssociatedVM(this);
|
|
@@ -2191,6 +2070,54 @@
|
|
|
2191
2070
|
// Authors should rely on this.template instead.
|
|
2192
2071
|
return null;
|
|
2193
2072
|
},
|
|
2073
|
+
get children() {
|
|
2074
|
+
const vm = getAssociatedVM(this);
|
|
2075
|
+
const renderer = vm.renderer;
|
|
2076
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2077
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2078
|
+
}
|
|
2079
|
+
return renderer.getChildren(vm.elm);
|
|
2080
|
+
},
|
|
2081
|
+
get childNodes() {
|
|
2082
|
+
const vm = getAssociatedVM(this);
|
|
2083
|
+
const renderer = vm.renderer;
|
|
2084
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2085
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2086
|
+
}
|
|
2087
|
+
return renderer.getChildNodes(vm.elm);
|
|
2088
|
+
},
|
|
2089
|
+
get firstChild() {
|
|
2090
|
+
const vm = getAssociatedVM(this);
|
|
2091
|
+
const renderer = vm.renderer;
|
|
2092
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2093
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2094
|
+
}
|
|
2095
|
+
return renderer.getFirstChild(vm.elm);
|
|
2096
|
+
},
|
|
2097
|
+
get firstElementChild() {
|
|
2098
|
+
const vm = getAssociatedVM(this);
|
|
2099
|
+
const renderer = vm.renderer;
|
|
2100
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2101
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2102
|
+
}
|
|
2103
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2104
|
+
},
|
|
2105
|
+
get lastChild() {
|
|
2106
|
+
const vm = getAssociatedVM(this);
|
|
2107
|
+
const renderer = vm.renderer;
|
|
2108
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2109
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2110
|
+
}
|
|
2111
|
+
return renderer.getLastChild(vm.elm);
|
|
2112
|
+
},
|
|
2113
|
+
get lastElementChild() {
|
|
2114
|
+
const vm = getAssociatedVM(this);
|
|
2115
|
+
const renderer = vm.renderer;
|
|
2116
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2117
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2118
|
+
}
|
|
2119
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2120
|
+
},
|
|
2194
2121
|
render() {
|
|
2195
2122
|
const vm = getAssociatedVM(this);
|
|
2196
2123
|
return vm.def.template;
|
|
@@ -2201,76 +2128,22 @@
|
|
|
2201
2128
|
},
|
|
2202
2129
|
};
|
|
2203
2130
|
const queryAndChildGetterDescriptors = create(null);
|
|
2204
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2205
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2206
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2207
|
-
const childGetters = [
|
|
2208
|
-
'children',
|
|
2209
|
-
'childNodes',
|
|
2210
|
-
'firstChild',
|
|
2211
|
-
'firstElementChild',
|
|
2212
|
-
'lastChild',
|
|
2213
|
-
'lastElementChild',
|
|
2214
|
-
];
|
|
2215
|
-
function getChildGetter(methodName) {
|
|
2216
|
-
switch (methodName) {
|
|
2217
|
-
case 'children':
|
|
2218
|
-
return getChildren$1;
|
|
2219
|
-
case 'childNodes':
|
|
2220
|
-
return getChildNodes$1;
|
|
2221
|
-
case 'firstChild':
|
|
2222
|
-
return getFirstChild$1;
|
|
2223
|
-
case 'firstElementChild':
|
|
2224
|
-
return getFirstElementChild$1;
|
|
2225
|
-
case 'lastChild':
|
|
2226
|
-
return getLastChild$1;
|
|
2227
|
-
case 'lastElementChild':
|
|
2228
|
-
return getLastElementChild$1;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2232
|
-
for (const childGetter of childGetters) {
|
|
2233
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2234
|
-
get() {
|
|
2235
|
-
const vm = getAssociatedVM(this);
|
|
2236
|
-
const { elm } = vm;
|
|
2237
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2238
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2239
|
-
}
|
|
2240
|
-
return getChildGetter(childGetter)(elm);
|
|
2241
|
-
},
|
|
2242
|
-
configurable: true,
|
|
2243
|
-
enumerable: true,
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
2131
|
const queryMethods = [
|
|
2247
2132
|
'getElementsByClassName',
|
|
2248
2133
|
'getElementsByTagName',
|
|
2249
2134
|
'querySelector',
|
|
2250
2135
|
'querySelectorAll',
|
|
2251
2136
|
];
|
|
2252
|
-
function getQueryMethod(methodName) {
|
|
2253
|
-
switch (methodName) {
|
|
2254
|
-
case 'getElementsByClassName':
|
|
2255
|
-
return getElementsByClassName$1;
|
|
2256
|
-
case 'getElementsByTagName':
|
|
2257
|
-
return getElementsByTagName$1;
|
|
2258
|
-
case 'querySelector':
|
|
2259
|
-
return querySelector$1;
|
|
2260
|
-
case 'querySelectorAll':
|
|
2261
|
-
return querySelectorAll$1;
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
2137
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2265
2138
|
for (const queryMethod of queryMethods) {
|
|
2266
2139
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2267
2140
|
value(arg) {
|
|
2268
2141
|
const vm = getAssociatedVM(this);
|
|
2269
|
-
const { elm } = vm;
|
|
2142
|
+
const { elm, renderer } = vm;
|
|
2270
2143
|
if (process.env.NODE_ENV !== 'production') {
|
|
2271
2144
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2272
2145
|
}
|
|
2273
|
-
return
|
|
2146
|
+
return renderer[queryMethod](elm, arg);
|
|
2274
2147
|
},
|
|
2275
2148
|
configurable: true,
|
|
2276
2149
|
enumerable: true,
|
|
@@ -3494,12 +3367,13 @@
|
|
|
3494
3367
|
* SPDX-License-Identifier: MIT
|
|
3495
3368
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3496
3369
|
*/
|
|
3497
|
-
function getUpgradableConstructor(tagName) {
|
|
3370
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3371
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3498
3372
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3499
3373
|
// produce only tags with lowercase letters
|
|
3500
3374
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3501
3375
|
tagName = tagName.toLowerCase();
|
|
3502
|
-
let CE = getCustomElement
|
|
3376
|
+
let CE = getCustomElement(tagName);
|
|
3503
3377
|
if (!isUndefined$1(CE)) {
|
|
3504
3378
|
return CE;
|
|
3505
3379
|
}
|
|
@@ -3507,7 +3381,7 @@
|
|
|
3507
3381
|
* LWC Upgradable Element reference to an element that was created
|
|
3508
3382
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3509
3383
|
*/
|
|
3510
|
-
CE = class LWCUpgradableElement extends
|
|
3384
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3511
3385
|
constructor(upgradeCallback) {
|
|
3512
3386
|
super();
|
|
3513
3387
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3515,7 +3389,7 @@
|
|
|
3515
3389
|
}
|
|
3516
3390
|
}
|
|
3517
3391
|
};
|
|
3518
|
-
defineCustomElement
|
|
3392
|
+
defineCustomElement(tagName, CE);
|
|
3519
3393
|
return CE;
|
|
3520
3394
|
}
|
|
3521
3395
|
|
|
@@ -3540,7 +3414,7 @@
|
|
|
3540
3414
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3541
3415
|
*/
|
|
3542
3416
|
const ColonCharCode = 58;
|
|
3543
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3417
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3544
3418
|
const { attrs } = vnode.data;
|
|
3545
3419
|
if (isUndefined$1(attrs)) {
|
|
3546
3420
|
return;
|
|
@@ -3550,6 +3424,7 @@
|
|
|
3550
3424
|
return;
|
|
3551
3425
|
}
|
|
3552
3426
|
const { elm } = vnode;
|
|
3427
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3553
3428
|
for (const key in attrs) {
|
|
3554
3429
|
const cur = attrs[key];
|
|
3555
3430
|
const old = oldAttrs[key];
|
|
@@ -3557,17 +3432,17 @@
|
|
|
3557
3432
|
unlockAttribute(elm, key);
|
|
3558
3433
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3559
3434
|
// Assume xml namespace
|
|
3560
|
-
setAttribute
|
|
3435
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3561
3436
|
}
|
|
3562
3437
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3563
3438
|
// Assume xlink namespace
|
|
3564
|
-
setAttribute
|
|
3439
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3565
3440
|
}
|
|
3566
3441
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3567
|
-
removeAttribute
|
|
3442
|
+
removeAttribute(elm, key);
|
|
3568
3443
|
}
|
|
3569
3444
|
else {
|
|
3570
|
-
setAttribute
|
|
3445
|
+
setAttribute(elm, key, cur);
|
|
3571
3446
|
}
|
|
3572
3447
|
lockAttribute();
|
|
3573
3448
|
}
|
|
@@ -3585,7 +3460,7 @@
|
|
|
3585
3460
|
// instead of relying on internally tracked values.
|
|
3586
3461
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3587
3462
|
}
|
|
3588
|
-
function patchProps(oldVnode, vnode) {
|
|
3463
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3589
3464
|
const { props } = vnode.data;
|
|
3590
3465
|
if (isUndefined$1(props)) {
|
|
3591
3466
|
return;
|
|
@@ -3596,13 +3471,14 @@
|
|
|
3596
3471
|
}
|
|
3597
3472
|
const isFirstPatch = isNull(oldVnode);
|
|
3598
3473
|
const { elm, sel } = vnode;
|
|
3474
|
+
const { getProperty, setProperty } = renderer;
|
|
3599
3475
|
for (const key in props) {
|
|
3600
3476
|
const cur = props[key];
|
|
3601
3477
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3602
3478
|
// different than the one previously set.
|
|
3603
3479
|
if (isFirstPatch ||
|
|
3604
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3605
|
-
setProperty
|
|
3480
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3481
|
+
setProperty(elm, key, cur);
|
|
3606
3482
|
}
|
|
3607
3483
|
}
|
|
3608
3484
|
}
|
|
@@ -3647,13 +3523,14 @@
|
|
|
3647
3523
|
}
|
|
3648
3524
|
return map;
|
|
3649
3525
|
}
|
|
3650
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3526
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3651
3527
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3652
3528
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3653
3529
|
if (oldClass === newClass) {
|
|
3654
3530
|
return;
|
|
3655
3531
|
}
|
|
3656
|
-
const
|
|
3532
|
+
const { getClassList } = renderer;
|
|
3533
|
+
const classList = getClassList(elm);
|
|
3657
3534
|
const newClassMap = getMapFromClassName(newClass);
|
|
3658
3535
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3659
3536
|
let name;
|
|
@@ -3677,17 +3554,18 @@
|
|
|
3677
3554
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3678
3555
|
*/
|
|
3679
3556
|
// The style property is a string when defined via an expression in the template.
|
|
3680
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3557
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3681
3558
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3682
3559
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3683
3560
|
if (oldStyle === newStyle) {
|
|
3684
3561
|
return;
|
|
3685
3562
|
}
|
|
3563
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3686
3564
|
if (!isString(newStyle) || newStyle === '') {
|
|
3687
|
-
removeAttribute
|
|
3565
|
+
removeAttribute(elm, 'style');
|
|
3688
3566
|
}
|
|
3689
3567
|
else {
|
|
3690
|
-
setAttribute
|
|
3568
|
+
setAttribute(elm, 'style', newStyle);
|
|
3691
3569
|
}
|
|
3692
3570
|
}
|
|
3693
3571
|
|
|
@@ -3697,14 +3575,15 @@
|
|
|
3697
3575
|
* SPDX-License-Identifier: MIT
|
|
3698
3576
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3699
3577
|
*/
|
|
3700
|
-
function applyEventListeners(vnode) {
|
|
3578
|
+
function applyEventListeners(vnode, renderer) {
|
|
3701
3579
|
const { elm, data: { on }, } = vnode;
|
|
3702
3580
|
if (isUndefined$1(on)) {
|
|
3703
3581
|
return;
|
|
3704
3582
|
}
|
|
3583
|
+
const { addEventListener } = renderer;
|
|
3705
3584
|
for (const name in on) {
|
|
3706
3585
|
const handler = on[name];
|
|
3707
|
-
addEventListener
|
|
3586
|
+
addEventListener(elm, name, handler);
|
|
3708
3587
|
}
|
|
3709
3588
|
}
|
|
3710
3589
|
|
|
@@ -3717,12 +3596,13 @@
|
|
|
3717
3596
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3718
3597
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3719
3598
|
// different classnames properties individually instead of via a string.
|
|
3720
|
-
function applyStaticClassAttribute(vnode) {
|
|
3599
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3721
3600
|
const { elm, data: { classMap }, } = vnode;
|
|
3722
3601
|
if (isUndefined$1(classMap)) {
|
|
3723
3602
|
return;
|
|
3724
3603
|
}
|
|
3725
|
-
const
|
|
3604
|
+
const { getClassList } = renderer;
|
|
3605
|
+
const classList = getClassList(elm);
|
|
3726
3606
|
for (const name in classMap) {
|
|
3727
3607
|
classList.add(name);
|
|
3728
3608
|
}
|
|
@@ -3737,14 +3617,15 @@
|
|
|
3737
3617
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3738
3618
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3739
3619
|
// different style properties individually instead of via a string.
|
|
3740
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3620
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3741
3621
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3742
3622
|
if (isUndefined$1(styleDecls)) {
|
|
3743
3623
|
return;
|
|
3744
3624
|
}
|
|
3625
|
+
const { setCSSStyleProperty } = renderer;
|
|
3745
3626
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3746
3627
|
const [prop, value, important] = styleDecls[i];
|
|
3747
|
-
setCSSStyleProperty
|
|
3628
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3748
3629
|
}
|
|
3749
3630
|
}
|
|
3750
3631
|
|
|
@@ -3754,15 +3635,16 @@
|
|
|
3754
3635
|
* SPDX-License-Identifier: MIT
|
|
3755
3636
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3756
3637
|
*/
|
|
3757
|
-
function patchChildren(c1, c2, parent) {
|
|
3638
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3758
3639
|
if (hasDynamicChildren(c2)) {
|
|
3759
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3640
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3760
3641
|
}
|
|
3761
3642
|
else {
|
|
3762
|
-
updateStaticChildren(c1, c2, parent);
|
|
3643
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3763
3644
|
}
|
|
3764
3645
|
}
|
|
3765
|
-
function patch(n1, n2) {
|
|
3646
|
+
function patch(n1, n2, renderer) {
|
|
3647
|
+
var _a, _b;
|
|
3766
3648
|
if (n1 === n2) {
|
|
3767
3649
|
return;
|
|
3768
3650
|
}
|
|
@@ -3776,80 +3658,90 @@
|
|
|
3776
3658
|
}
|
|
3777
3659
|
switch (n2.type) {
|
|
3778
3660
|
case 0 /* Text */:
|
|
3779
|
-
|
|
3661
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3662
|
+
patchText(n1, n2, renderer);
|
|
3780
3663
|
break;
|
|
3781
3664
|
case 1 /* Comment */:
|
|
3782
|
-
|
|
3665
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3666
|
+
patchComment(n1, n2, renderer);
|
|
3783
3667
|
break;
|
|
3784
3668
|
case 2 /* Element */:
|
|
3785
|
-
patchElement(n1, n2);
|
|
3669
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3786
3670
|
break;
|
|
3787
3671
|
case 3 /* CustomElement */:
|
|
3788
|
-
patchCustomElement(n1, n2);
|
|
3672
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3789
3673
|
break;
|
|
3790
3674
|
}
|
|
3791
3675
|
}
|
|
3792
|
-
function mount(node, parent, anchor) {
|
|
3676
|
+
function mount(node, parent, renderer, anchor) {
|
|
3677
|
+
var _a, _b;
|
|
3793
3678
|
switch (node.type) {
|
|
3794
3679
|
case 0 /* Text */:
|
|
3795
|
-
|
|
3680
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3681
|
+
mountText(node, parent, anchor, renderer);
|
|
3796
3682
|
break;
|
|
3797
3683
|
case 1 /* Comment */:
|
|
3798
|
-
|
|
3684
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3685
|
+
mountComment(node, parent, anchor, renderer);
|
|
3799
3686
|
break;
|
|
3800
3687
|
case 2 /* Element */:
|
|
3801
|
-
|
|
3688
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3689
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3802
3690
|
break;
|
|
3803
3691
|
case 3 /* CustomElement */:
|
|
3804
|
-
|
|
3692
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3693
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3805
3694
|
break;
|
|
3806
3695
|
}
|
|
3807
3696
|
}
|
|
3808
|
-
function patchText(n1, n2) {
|
|
3697
|
+
function patchText(n1, n2, renderer) {
|
|
3809
3698
|
n2.elm = n1.elm;
|
|
3810
3699
|
if (n2.text !== n1.text) {
|
|
3811
|
-
updateTextContent(n2);
|
|
3700
|
+
updateTextContent(n2, renderer);
|
|
3812
3701
|
}
|
|
3813
3702
|
}
|
|
3814
|
-
function mountText(
|
|
3815
|
-
const { owner } =
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
|
|
3703
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3704
|
+
const { owner } = vnode;
|
|
3705
|
+
const { createText } = renderer;
|
|
3706
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3707
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3708
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3819
3709
|
}
|
|
3820
|
-
function patchComment(n1, n2) {
|
|
3710
|
+
function patchComment(n1, n2, renderer) {
|
|
3821
3711
|
n2.elm = n1.elm;
|
|
3822
3712
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3823
3713
|
// it is the case today.
|
|
3824
3714
|
if (n2.text !== n1.text) {
|
|
3825
|
-
updateTextContent(n2);
|
|
3715
|
+
updateTextContent(n2, renderer);
|
|
3826
3716
|
}
|
|
3827
3717
|
}
|
|
3828
|
-
function mountComment(
|
|
3829
|
-
const { owner } =
|
|
3830
|
-
const
|
|
3831
|
-
|
|
3832
|
-
|
|
3718
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3719
|
+
const { owner } = vnode;
|
|
3720
|
+
const { createComment } = renderer;
|
|
3721
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3722
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3723
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3833
3724
|
}
|
|
3834
|
-
function mountElement(vnode, parent, anchor) {
|
|
3725
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3835
3726
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3727
|
+
const { createElement } = renderer;
|
|
3836
3728
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3837
|
-
const elm = createElement
|
|
3838
|
-
linkNodeToShadow(elm, owner);
|
|
3839
|
-
fallbackElmHook(elm, vnode);
|
|
3729
|
+
const elm = createElement(sel, namespace);
|
|
3730
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3731
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3840
3732
|
vnode.elm = elm;
|
|
3841
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3842
|
-
insertNode(elm, parent, anchor);
|
|
3843
|
-
mountVNodes(vnode.children, elm, null);
|
|
3733
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3734
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3735
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3844
3736
|
}
|
|
3845
|
-
function patchElement(n1, n2) {
|
|
3737
|
+
function patchElement(n1, n2, renderer) {
|
|
3846
3738
|
const elm = (n2.elm = n1.elm);
|
|
3847
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3848
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3739
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3740
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3849
3741
|
}
|
|
3850
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3742
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3851
3743
|
const { sel, owner } = vnode;
|
|
3852
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3744
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3853
3745
|
/**
|
|
3854
3746
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3855
3747
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3859,9 +3751,9 @@
|
|
|
3859
3751
|
let vm;
|
|
3860
3752
|
const elm = new UpgradableConstructor((elm) => {
|
|
3861
3753
|
// the custom element from the registry is expecting an upgrade callback
|
|
3862
|
-
vm = createViewModelHook(elm, vnode);
|
|
3754
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3863
3755
|
});
|
|
3864
|
-
linkNodeToShadow(elm, owner);
|
|
3756
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3865
3757
|
vnode.elm = elm;
|
|
3866
3758
|
vnode.vm = vm;
|
|
3867
3759
|
if (vm) {
|
|
@@ -3870,23 +3762,23 @@
|
|
|
3870
3762
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3871
3763
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3872
3764
|
}
|
|
3873
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3874
|
-
insertNode(elm, parent, anchor);
|
|
3765
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3766
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3875
3767
|
if (vm) {
|
|
3876
3768
|
if (process.env.NODE_ENV !== 'production') {
|
|
3877
3769
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3878
3770
|
}
|
|
3879
3771
|
runConnectedCallback(vm);
|
|
3880
3772
|
}
|
|
3881
|
-
mountVNodes(vnode.children, elm, null);
|
|
3773
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3882
3774
|
if (vm) {
|
|
3883
3775
|
appendVM(vm);
|
|
3884
3776
|
}
|
|
3885
3777
|
}
|
|
3886
|
-
function patchCustomElement(n1, n2) {
|
|
3778
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3887
3779
|
const elm = (n2.elm = n1.elm);
|
|
3888
3780
|
const vm = (n2.vm = n1.vm);
|
|
3889
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3781
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3890
3782
|
if (!isUndefined$1(vm)) {
|
|
3891
3783
|
// in fallback mode, the allocation will always set children to
|
|
3892
3784
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3894,34 +3786,36 @@
|
|
|
3894
3786
|
}
|
|
3895
3787
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3896
3788
|
// will happen, but in native, it does allocate the light dom
|
|
3897
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3789
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3898
3790
|
if (!isUndefined$1(vm)) {
|
|
3899
3791
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3900
3792
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3901
3793
|
rerenderVM(vm);
|
|
3902
3794
|
}
|
|
3903
3795
|
}
|
|
3904
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3796
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3905
3797
|
for (; start < end; ++start) {
|
|
3906
3798
|
const vnode = vnodes[start];
|
|
3907
3799
|
if (isVNode(vnode)) {
|
|
3908
|
-
mount(vnode, parent, anchor);
|
|
3800
|
+
mount(vnode, parent, renderer, anchor);
|
|
3909
3801
|
}
|
|
3910
3802
|
}
|
|
3911
3803
|
}
|
|
3912
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3804
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3913
3805
|
const { type, elm, sel } = vnode;
|
|
3914
3806
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3915
3807
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3916
3808
|
if (doRemove) {
|
|
3917
|
-
|
|
3809
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3810
|
+
// but the removal used here is from the owner instead.
|
|
3811
|
+
removeNode(elm, parent, renderer);
|
|
3918
3812
|
}
|
|
3919
3813
|
switch (type) {
|
|
3920
3814
|
case 2 /* Element */: {
|
|
3921
3815
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3922
3816
|
// Only required for synthetic shadow.
|
|
3923
|
-
const
|
|
3924
|
-
unmountVNodes(vnode.children, elm,
|
|
3817
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3818
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3925
3819
|
break;
|
|
3926
3820
|
}
|
|
3927
3821
|
case 3 /* CustomElement */: {
|
|
@@ -3934,11 +3828,11 @@
|
|
|
3934
3828
|
}
|
|
3935
3829
|
}
|
|
3936
3830
|
}
|
|
3937
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3831
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3938
3832
|
for (; start < end; ++start) {
|
|
3939
3833
|
const ch = vnodes[start];
|
|
3940
3834
|
if (isVNode(ch)) {
|
|
3941
|
-
unmount(ch, parent, doRemove);
|
|
3835
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3942
3836
|
}
|
|
3943
3837
|
}
|
|
3944
3838
|
}
|
|
@@ -3952,66 +3846,71 @@
|
|
|
3952
3846
|
elm.$shadowToken$ = token;
|
|
3953
3847
|
}
|
|
3954
3848
|
// Set the scope token class for *.scoped.css styles
|
|
3955
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3849
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3956
3850
|
const { cmpTemplate, context } = owner;
|
|
3851
|
+
const { getClassList } = renderer;
|
|
3957
3852
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3958
3853
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3959
|
-
|
|
3854
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3855
|
+
// probably we should have a renderer api for just the add operation
|
|
3856
|
+
getClassList(elm).add(token);
|
|
3960
3857
|
}
|
|
3961
3858
|
}
|
|
3962
|
-
function linkNodeToShadow(elm, owner) {
|
|
3859
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3963
3860
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3861
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3964
3862
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3965
|
-
if (isSyntheticShadowDefined
|
|
3863
|
+
if (isSyntheticShadowDefined) {
|
|
3966
3864
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3967
3865
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3968
3866
|
}
|
|
3969
3867
|
}
|
|
3970
3868
|
}
|
|
3971
|
-
function updateTextContent(vnode) {
|
|
3869
|
+
function updateTextContent(vnode, renderer) {
|
|
3972
3870
|
const { elm, text } = vnode;
|
|
3871
|
+
const { setText } = renderer;
|
|
3973
3872
|
if (process.env.NODE_ENV !== 'production') {
|
|
3974
3873
|
unlockDomMutation();
|
|
3975
3874
|
}
|
|
3976
|
-
setText
|
|
3875
|
+
setText(elm, text);
|
|
3977
3876
|
if (process.env.NODE_ENV !== 'production') {
|
|
3978
3877
|
lockDomMutation();
|
|
3979
3878
|
}
|
|
3980
3879
|
}
|
|
3981
|
-
function insertNode(node, parent, anchor) {
|
|
3880
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3982
3881
|
if (process.env.NODE_ENV !== 'production') {
|
|
3983
3882
|
unlockDomMutation();
|
|
3984
3883
|
}
|
|
3985
|
-
insert
|
|
3884
|
+
renderer.insert(node, parent, anchor);
|
|
3986
3885
|
if (process.env.NODE_ENV !== 'production') {
|
|
3987
3886
|
lockDomMutation();
|
|
3988
3887
|
}
|
|
3989
3888
|
}
|
|
3990
|
-
function removeNode(node, parent) {
|
|
3889
|
+
function removeNode(node, parent, renderer) {
|
|
3991
3890
|
if (process.env.NODE_ENV !== 'production') {
|
|
3992
3891
|
unlockDomMutation();
|
|
3993
3892
|
}
|
|
3994
|
-
remove
|
|
3893
|
+
renderer.remove(node, parent);
|
|
3995
3894
|
if (process.env.NODE_ENV !== 'production') {
|
|
3996
3895
|
lockDomMutation();
|
|
3997
3896
|
}
|
|
3998
3897
|
}
|
|
3999
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3898
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
4000
3899
|
if (isNull(oldVnode)) {
|
|
4001
|
-
applyEventListeners(vnode);
|
|
4002
|
-
applyStaticClassAttribute(vnode);
|
|
4003
|
-
applyStaticStyleAttribute(vnode);
|
|
3900
|
+
applyEventListeners(vnode, renderer);
|
|
3901
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3902
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4004
3903
|
}
|
|
4005
3904
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4006
3905
|
// value is set before type=radio.
|
|
4007
|
-
patchClassAttribute(oldVnode, vnode);
|
|
4008
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
4009
|
-
patchAttributes(oldVnode, vnode);
|
|
4010
|
-
patchProps(oldVnode, vnode);
|
|
3906
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3907
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3908
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3909
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4011
3910
|
}
|
|
4012
|
-
function fallbackElmHook(elm, vnode) {
|
|
3911
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
4013
3912
|
const { owner } = vnode;
|
|
4014
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3913
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4015
3914
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4016
3915
|
const { data: { context }, } = vnode;
|
|
4017
3916
|
const { stylesheetToken } = owner.context;
|
|
@@ -4059,7 +3958,7 @@
|
|
|
4059
3958
|
vnode.children = EmptyArray;
|
|
4060
3959
|
}
|
|
4061
3960
|
}
|
|
4062
|
-
function createViewModelHook(elm, vnode) {
|
|
3961
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4063
3962
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4064
3963
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4065
3964
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -4068,7 +3967,7 @@
|
|
|
4068
3967
|
return vm;
|
|
4069
3968
|
}
|
|
4070
3969
|
const { sel, mode, ctor, owner } = vnode;
|
|
4071
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3970
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4072
3971
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4073
3972
|
const { stylesheetToken } = owner.context;
|
|
4074
3973
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -4077,7 +3976,7 @@
|
|
|
4077
3976
|
setElementShadowToken(elm, stylesheetToken);
|
|
4078
3977
|
}
|
|
4079
3978
|
}
|
|
4080
|
-
vm = createVM(elm, ctor, {
|
|
3979
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4081
3980
|
mode,
|
|
4082
3981
|
owner,
|
|
4083
3982
|
tagName: sel,
|
|
@@ -4152,7 +4051,7 @@
|
|
|
4152
4051
|
}
|
|
4153
4052
|
return map;
|
|
4154
4053
|
}
|
|
4155
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4054
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4156
4055
|
let oldStartIdx = 0;
|
|
4157
4056
|
let newStartIdx = 0;
|
|
4158
4057
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4181,26 +4080,26 @@
|
|
|
4181
4080
|
newEndVnode = newCh[--newEndIdx];
|
|
4182
4081
|
}
|
|
4183
4082
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4184
|
-
patch(oldStartVnode, newStartVnode);
|
|
4083
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4185
4084
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4186
4085
|
newStartVnode = newCh[++newStartIdx];
|
|
4187
4086
|
}
|
|
4188
4087
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4189
|
-
patch(oldEndVnode, newEndVnode);
|
|
4088
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4190
4089
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4191
4090
|
newEndVnode = newCh[--newEndIdx];
|
|
4192
4091
|
}
|
|
4193
4092
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4194
4093
|
// Vnode moved right
|
|
4195
|
-
patch(oldStartVnode, newEndVnode);
|
|
4196
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4094
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4095
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4197
4096
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4198
4097
|
newEndVnode = newCh[--newEndIdx];
|
|
4199
4098
|
}
|
|
4200
4099
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4201
4100
|
// Vnode moved left
|
|
4202
|
-
patch(oldEndVnode, newStartVnode);
|
|
4203
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4101
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4102
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4204
4103
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4205
4104
|
newStartVnode = newCh[++newStartIdx];
|
|
4206
4105
|
}
|
|
@@ -4211,7 +4110,7 @@
|
|
|
4211
4110
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4212
4111
|
if (isUndefined$1(idxInOld)) {
|
|
4213
4112
|
// New element
|
|
4214
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4113
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4215
4114
|
newStartVnode = newCh[++newStartIdx];
|
|
4216
4115
|
}
|
|
4217
4116
|
else {
|
|
@@ -4219,10 +4118,10 @@
|
|
|
4219
4118
|
if (isVNode(elmToMove)) {
|
|
4220
4119
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4221
4120
|
// New element
|
|
4222
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4121
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4223
4122
|
}
|
|
4224
4123
|
else {
|
|
4225
|
-
patch(elmToMove, newStartVnode);
|
|
4124
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4226
4125
|
// Delete the old child, but copy the array since it is read-only.
|
|
4227
4126
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4228
4127
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4234,7 +4133,7 @@
|
|
|
4234
4133
|
}
|
|
4235
4134
|
// We've already cloned at least once, so it's no longer read-only
|
|
4236
4135
|
oldCh[idxInOld] = undefined;
|
|
4237
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4136
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4238
4137
|
}
|
|
4239
4138
|
}
|
|
4240
4139
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4251,25 +4150,25 @@
|
|
|
4251
4150
|
n = newCh[++i];
|
|
4252
4151
|
} while (!isVNode(n) && i < newChEnd);
|
|
4253
4152
|
before = isVNode(n) ? n.elm : null;
|
|
4254
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4153
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4255
4154
|
}
|
|
4256
4155
|
else {
|
|
4257
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4156
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4258
4157
|
}
|
|
4259
4158
|
}
|
|
4260
4159
|
}
|
|
4261
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4160
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4262
4161
|
const c1Length = c1.length;
|
|
4263
4162
|
const c2Length = c2.length;
|
|
4264
4163
|
if (c1Length === 0) {
|
|
4265
4164
|
// the old list is empty, we can directly insert anything new
|
|
4266
|
-
mountVNodes(c2, parent, null);
|
|
4165
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4267
4166
|
return;
|
|
4268
4167
|
}
|
|
4269
4168
|
if (c2Length === 0) {
|
|
4270
4169
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4271
4170
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4272
|
-
unmountVNodes(c1, parent, true);
|
|
4171
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4273
4172
|
return;
|
|
4274
4173
|
}
|
|
4275
4174
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4282,16 +4181,16 @@
|
|
|
4282
4181
|
if (isVNode(n1)) {
|
|
4283
4182
|
if (isVNode(n2)) {
|
|
4284
4183
|
// both vnodes are equivalent, and we just need to patch them
|
|
4285
|
-
patch(n1, n2);
|
|
4184
|
+
patch(n1, n2, renderer);
|
|
4286
4185
|
anchor = n2.elm;
|
|
4287
4186
|
}
|
|
4288
4187
|
else {
|
|
4289
4188
|
// removing the old vnode since the new one is null
|
|
4290
|
-
unmount(n1, parent, true);
|
|
4189
|
+
unmount(n1, parent, renderer, true);
|
|
4291
4190
|
}
|
|
4292
4191
|
}
|
|
4293
4192
|
else if (isVNode(n2)) {
|
|
4294
|
-
mount(n2, parent, anchor);
|
|
4193
|
+
mount(n2, parent, renderer, anchor);
|
|
4295
4194
|
anchor = n2.elm;
|
|
4296
4195
|
}
|
|
4297
4196
|
}
|
|
@@ -4720,7 +4619,7 @@
|
|
|
4720
4619
|
}, [api.t(content)]);
|
|
4721
4620
|
}
|
|
4722
4621
|
function updateStylesheetToken(vm, template) {
|
|
4723
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4622
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4724
4623
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4725
4624
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4726
4625
|
const { hasScopedStyles } = context;
|
|
@@ -4731,10 +4630,10 @@
|
|
|
4731
4630
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4732
4631
|
if (!isUndefined$1(oldToken)) {
|
|
4733
4632
|
if (oldHasTokenInClass) {
|
|
4734
|
-
getClassList
|
|
4633
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4735
4634
|
}
|
|
4736
4635
|
if (oldHasTokenInAttribute) {
|
|
4737
|
-
removeAttribute
|
|
4636
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4738
4637
|
}
|
|
4739
4638
|
}
|
|
4740
4639
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4745,11 +4644,11 @@
|
|
|
4745
4644
|
// Set the new styling token on the host element
|
|
4746
4645
|
if (!isUndefined$1(newToken)) {
|
|
4747
4646
|
if (hasScopedStyles) {
|
|
4748
|
-
getClassList
|
|
4647
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4749
4648
|
newHasTokenInClass = true;
|
|
4750
4649
|
}
|
|
4751
4650
|
if (isSyntheticShadow) {
|
|
4752
|
-
setAttribute
|
|
4651
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4753
4652
|
newHasTokenInAttribute = true;
|
|
4754
4653
|
}
|
|
4755
4654
|
}
|
|
@@ -4837,13 +4736,13 @@
|
|
|
4837
4736
|
return owner;
|
|
4838
4737
|
}
|
|
4839
4738
|
function createStylesheet(vm, stylesheets) {
|
|
4840
|
-
const { renderMode, shadowMode } = vm;
|
|
4739
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4841
4740
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4842
4741
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4843
|
-
insertStylesheet
|
|
4742
|
+
insertStylesheet(stylesheets[i]);
|
|
4844
4743
|
}
|
|
4845
4744
|
}
|
|
4846
|
-
else if (ssr
|
|
4745
|
+
else if (ssr || vm.hydrated) {
|
|
4847
4746
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4848
4747
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4849
4748
|
// the first time the VM renders.
|
|
@@ -4857,7 +4756,7 @@
|
|
|
4857
4756
|
// null root means a global style
|
|
4858
4757
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4859
4758
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4860
|
-
insertStylesheet
|
|
4759
|
+
insertStylesheet(stylesheets[i], target);
|
|
4861
4760
|
}
|
|
4862
4761
|
}
|
|
4863
4762
|
return null;
|
|
@@ -5412,7 +5311,7 @@
|
|
|
5412
5311
|
return ancestor;
|
|
5413
5312
|
}
|
|
5414
5313
|
|
|
5415
|
-
function createVM(elm, ctor, options) {
|
|
5314
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5416
5315
|
const {
|
|
5417
5316
|
mode,
|
|
5418
5317
|
owner,
|
|
@@ -5461,9 +5360,10 @@
|
|
|
5461
5360
|
renderRoot: null,
|
|
5462
5361
|
callHook,
|
|
5463
5362
|
setHook,
|
|
5464
|
-
getHook
|
|
5363
|
+
getHook,
|
|
5364
|
+
renderer
|
|
5465
5365
|
};
|
|
5466
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5366
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5467
5367
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5468
5368
|
|
|
5469
5369
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5488,13 +5388,17 @@
|
|
|
5488
5388
|
return vm;
|
|
5489
5389
|
}
|
|
5490
5390
|
|
|
5491
|
-
function computeShadowMode(vm) {
|
|
5391
|
+
function computeShadowMode(vm, renderer) {
|
|
5492
5392
|
const {
|
|
5493
5393
|
def
|
|
5494
5394
|
} = vm;
|
|
5395
|
+
const {
|
|
5396
|
+
isSyntheticShadowDefined,
|
|
5397
|
+
isNativeShadowDefined
|
|
5398
|
+
} = renderer;
|
|
5495
5399
|
let shadowMode;
|
|
5496
5400
|
|
|
5497
|
-
if (isSyntheticShadowDefined
|
|
5401
|
+
if (isSyntheticShadowDefined) {
|
|
5498
5402
|
if (def.renderMode === 0
|
|
5499
5403
|
/* Light */
|
|
5500
5404
|
) {
|
|
@@ -5503,7 +5407,7 @@
|
|
|
5503
5407
|
shadowMode = 0
|
|
5504
5408
|
/* Native */
|
|
5505
5409
|
;
|
|
5506
|
-
} else if (isNativeShadowDefined
|
|
5410
|
+
} else if (isNativeShadowDefined) {
|
|
5507
5411
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5508
5412
|
// the if-condition.
|
|
5509
5413
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5593,7 +5497,8 @@
|
|
|
5593
5497
|
function patchShadowRoot(vm, newCh) {
|
|
5594
5498
|
const {
|
|
5595
5499
|
renderRoot,
|
|
5596
|
-
children: oldCh
|
|
5500
|
+
children: oldCh,
|
|
5501
|
+
renderer
|
|
5597
5502
|
} = vm; // caching the new children collection
|
|
5598
5503
|
|
|
5599
5504
|
vm.children = newCh;
|
|
@@ -5609,7 +5514,7 @@
|
|
|
5609
5514
|
, vm);
|
|
5610
5515
|
}, () => {
|
|
5611
5516
|
// job
|
|
5612
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5517
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5613
5518
|
}, () => {
|
|
5614
5519
|
// post
|
|
5615
5520
|
logOperationEnd(2
|
|
@@ -5634,10 +5539,13 @@
|
|
|
5634
5539
|
const {
|
|
5635
5540
|
def: {
|
|
5636
5541
|
renderedCallback
|
|
5542
|
+
},
|
|
5543
|
+
renderer: {
|
|
5544
|
+
ssr
|
|
5637
5545
|
}
|
|
5638
5546
|
} = vm;
|
|
5639
5547
|
|
|
5640
|
-
if (isTrue(ssr
|
|
5548
|
+
if (isTrue(ssr)) {
|
|
5641
5549
|
return;
|
|
5642
5550
|
}
|
|
5643
5551
|
|
|
@@ -5871,14 +5779,17 @@
|
|
|
5871
5779
|
function resetComponentRoot(vm) {
|
|
5872
5780
|
const {
|
|
5873
5781
|
children,
|
|
5874
|
-
renderRoot
|
|
5782
|
+
renderRoot,
|
|
5783
|
+
renderer: {
|
|
5784
|
+
remove
|
|
5785
|
+
}
|
|
5875
5786
|
} = vm;
|
|
5876
5787
|
|
|
5877
5788
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5878
5789
|
const child = children[i];
|
|
5879
5790
|
|
|
5880
5791
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5881
|
-
remove
|
|
5792
|
+
remove(child.elm, renderRoot);
|
|
5882
5793
|
}
|
|
5883
5794
|
}
|
|
5884
5795
|
|
|
@@ -5887,7 +5798,13 @@
|
|
|
5887
5798
|
vm.velements = EmptyArray;
|
|
5888
5799
|
}
|
|
5889
5800
|
function scheduleRehydration(vm) {
|
|
5890
|
-
|
|
5801
|
+
const {
|
|
5802
|
+
renderer: {
|
|
5803
|
+
ssr
|
|
5804
|
+
}
|
|
5805
|
+
} = vm;
|
|
5806
|
+
|
|
5807
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5891
5808
|
return;
|
|
5892
5809
|
}
|
|
5893
5810
|
|
|
@@ -6063,6 +5980,9 @@
|
|
|
6063
5980
|
context: {
|
|
6064
5981
|
wiredConnecting,
|
|
6065
5982
|
wiredDisconnecting
|
|
5983
|
+
},
|
|
5984
|
+
renderer: {
|
|
5985
|
+
dispatchEvent
|
|
6066
5986
|
}
|
|
6067
5987
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
6068
5988
|
|
|
@@ -6086,7 +6006,7 @@
|
|
|
6086
6006
|
}
|
|
6087
6007
|
|
|
6088
6008
|
});
|
|
6089
|
-
dispatchEvent
|
|
6009
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6090
6010
|
});
|
|
6091
6011
|
}
|
|
6092
6012
|
|
|
@@ -6334,95 +6254,105 @@
|
|
|
6334
6254
|
function hydrateVM(vm) {
|
|
6335
6255
|
const children = renderComponent(vm);
|
|
6336
6256
|
vm.children = children;
|
|
6337
|
-
const parentNode = vm
|
|
6338
|
-
hydrateChildren(getFirstChild
|
|
6257
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6258
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6339
6259
|
runRenderedCallback(vm);
|
|
6340
6260
|
}
|
|
6341
|
-
function hydrateNode(node, vnode) {
|
|
6261
|
+
function hydrateNode(node, vnode, renderer) {
|
|
6262
|
+
var _a, _b;
|
|
6342
6263
|
let hydratedNode;
|
|
6343
6264
|
switch (vnode.type) {
|
|
6344
6265
|
case 0 /* Text */:
|
|
6345
|
-
|
|
6266
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
6267
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
6346
6268
|
break;
|
|
6347
6269
|
case 1 /* Comment */:
|
|
6348
|
-
|
|
6270
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
6271
|
+
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
6349
6272
|
break;
|
|
6350
6273
|
case 2 /* Element */:
|
|
6351
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
6274
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
6352
6275
|
break;
|
|
6353
6276
|
case 3 /* CustomElement */:
|
|
6354
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6277
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
6355
6278
|
break;
|
|
6356
6279
|
}
|
|
6357
|
-
return nextSibling
|
|
6280
|
+
return renderer.nextSibling(hydratedNode);
|
|
6358
6281
|
}
|
|
6359
|
-
function hydrateText(node, vnode) {
|
|
6282
|
+
function hydrateText(node, vnode, renderer) {
|
|
6360
6283
|
var _a;
|
|
6361
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
6362
|
-
return handleMismatch(node, vnode);
|
|
6284
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
6285
|
+
return handleMismatch(node, vnode, renderer);
|
|
6363
6286
|
}
|
|
6364
6287
|
if (process.env.NODE_ENV !== 'production') {
|
|
6365
|
-
const
|
|
6288
|
+
const { getProperty } = renderer;
|
|
6289
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6366
6290
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6367
6291
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6368
6292
|
}
|
|
6369
6293
|
}
|
|
6370
|
-
setText
|
|
6294
|
+
const { setText } = renderer;
|
|
6295
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6371
6296
|
vnode.elm = node;
|
|
6372
6297
|
return node;
|
|
6373
6298
|
}
|
|
6374
|
-
function hydrateComment(node, vnode) {
|
|
6299
|
+
function hydrateComment(node, vnode, renderer) {
|
|
6375
6300
|
var _a;
|
|
6376
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
6377
|
-
return handleMismatch(node, vnode);
|
|
6301
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
6302
|
+
return handleMismatch(node, vnode, renderer);
|
|
6378
6303
|
}
|
|
6379
6304
|
if (process.env.NODE_ENV !== 'production') {
|
|
6380
|
-
const
|
|
6305
|
+
const { getProperty } = renderer;
|
|
6306
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6381
6307
|
if (nodeValue !== vnode.text) {
|
|
6382
6308
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6383
6309
|
}
|
|
6384
6310
|
}
|
|
6385
|
-
setProperty
|
|
6311
|
+
const { setProperty } = renderer;
|
|
6312
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6386
6313
|
vnode.elm = node;
|
|
6387
6314
|
return node;
|
|
6388
6315
|
}
|
|
6389
|
-
function hydrateElement(elm, vnode) {
|
|
6390
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6391
|
-
!isMatchingElement(vnode, elm)) {
|
|
6392
|
-
return handleMismatch(elm, vnode);
|
|
6316
|
+
function hydrateElement(elm, vnode, renderer) {
|
|
6317
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6318
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6319
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6393
6320
|
}
|
|
6394
6321
|
vnode.elm = elm;
|
|
6322
|
+
const { owner } = vnode;
|
|
6395
6323
|
const { context } = vnode.data;
|
|
6396
6324
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6397
6325
|
if (isDomManual) {
|
|
6398
6326
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6399
6327
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6400
|
-
const { props } = vnode
|
|
6328
|
+
const { data: { props }, } = vnode;
|
|
6329
|
+
const { getProperty } = renderer;
|
|
6401
6330
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6402
|
-
if (getProperty
|
|
6331
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6403
6332
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6404
6333
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6405
6334
|
}
|
|
6406
6335
|
else {
|
|
6407
6336
|
if (process.env.NODE_ENV !== 'production') {
|
|
6408
|
-
logWarn(`Mismatch hydrating element <${getProperty
|
|
6337
|
+
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
|
|
6409
6338
|
}
|
|
6410
6339
|
}
|
|
6411
6340
|
}
|
|
6412
6341
|
}
|
|
6413
|
-
patchElementPropsAndAttrs(vnode);
|
|
6342
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6414
6343
|
if (!isDomManual) {
|
|
6415
|
-
|
|
6344
|
+
const { getFirstChild } = renderer;
|
|
6345
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6416
6346
|
}
|
|
6417
6347
|
return elm;
|
|
6418
6348
|
}
|
|
6419
|
-
function hydrateCustomElement(elm, vnode) {
|
|
6420
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6421
|
-
!isMatchingElement(vnode, elm)) {
|
|
6422
|
-
return handleMismatch(elm, vnode);
|
|
6349
|
+
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6350
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6351
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6352
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6423
6353
|
}
|
|
6424
6354
|
const { sel, mode, ctor, owner } = vnode;
|
|
6425
|
-
const vm = createVM(elm, ctor, {
|
|
6355
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
6426
6356
|
mode,
|
|
6427
6357
|
owner,
|
|
6428
6358
|
tagName: sel,
|
|
@@ -6431,16 +6361,17 @@
|
|
|
6431
6361
|
vnode.elm = elm;
|
|
6432
6362
|
vnode.vm = vm;
|
|
6433
6363
|
allocateChildren(vnode, vm);
|
|
6434
|
-
patchElementPropsAndAttrs(vnode);
|
|
6364
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6435
6365
|
// Insert hook section:
|
|
6436
6366
|
if (process.env.NODE_ENV !== 'production') {
|
|
6437
6367
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6438
6368
|
}
|
|
6439
6369
|
runConnectedCallback(vm);
|
|
6440
6370
|
if (vm.renderMode !== 0 /* Light */) {
|
|
6371
|
+
const { getFirstChild } = renderer;
|
|
6441
6372
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6442
6373
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6443
|
-
hydrateChildren(getFirstChild
|
|
6374
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6444
6375
|
}
|
|
6445
6376
|
hydrateVM(vm);
|
|
6446
6377
|
return elm;
|
|
@@ -6449,11 +6380,12 @@
|
|
|
6449
6380
|
let hasWarned = false;
|
|
6450
6381
|
let nextNode = node;
|
|
6451
6382
|
let anchor = null;
|
|
6383
|
+
const { renderer } = owner;
|
|
6452
6384
|
for (let i = 0; i < children.length; i++) {
|
|
6453
6385
|
const childVnode = children[i];
|
|
6454
6386
|
if (!isNull(childVnode)) {
|
|
6455
6387
|
if (nextNode) {
|
|
6456
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
6388
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6457
6389
|
anchor = childVnode.elm;
|
|
6458
6390
|
}
|
|
6459
6391
|
else {
|
|
@@ -6464,7 +6396,7 @@
|
|
|
6464
6396
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6465
6397
|
}
|
|
6466
6398
|
}
|
|
6467
|
-
mount(childVnode, parentNode, anchor);
|
|
6399
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
6468
6400
|
anchor = childVnode.elm;
|
|
6469
6401
|
}
|
|
6470
6402
|
}
|
|
@@ -6476,31 +6408,33 @@
|
|
|
6476
6408
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6477
6409
|
}
|
|
6478
6410
|
}
|
|
6411
|
+
// nextSibling is mostly harmless, and since we don't have
|
|
6412
|
+
// a good reference to what element to act upon, we instead
|
|
6413
|
+
// rely on the vm's associated renderer for navigating to the
|
|
6414
|
+
// next node in the list to be hydrated.
|
|
6415
|
+
const { nextSibling } = renderer;
|
|
6479
6416
|
do {
|
|
6480
6417
|
const current = nextNode;
|
|
6481
|
-
nextNode = nextSibling
|
|
6482
|
-
removeNode(current, parentNode);
|
|
6418
|
+
nextNode = nextSibling(nextNode);
|
|
6419
|
+
removeNode(current, parentNode, renderer);
|
|
6483
6420
|
} while (nextNode);
|
|
6484
6421
|
}
|
|
6485
6422
|
}
|
|
6486
|
-
function handleMismatch(node, vnode,
|
|
6423
|
+
function handleMismatch(node, vnode, renderer) {
|
|
6487
6424
|
hasMismatch = true;
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
}
|
|
6493
|
-
const parentNode = getProperty$1(node, 'parentNode');
|
|
6494
|
-
mount(vnode, parentNode, node);
|
|
6495
|
-
removeNode(node, parentNode);
|
|
6425
|
+
const { getProperty } = renderer;
|
|
6426
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
6427
|
+
mount(vnode, parentNode, renderer, node);
|
|
6428
|
+
removeNode(node, parentNode, renderer);
|
|
6496
6429
|
return vnode.elm;
|
|
6497
6430
|
}
|
|
6498
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6499
|
-
applyEventListeners(vnode);
|
|
6500
|
-
patchProps(null, vnode);
|
|
6431
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
6432
|
+
applyEventListeners(vnode, renderer);
|
|
6433
|
+
patchProps(null, vnode, renderer);
|
|
6501
6434
|
}
|
|
6502
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6503
|
-
|
|
6435
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
6436
|
+
const { getProperty } = renderer;
|
|
6437
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
6504
6438
|
if (process.env.NODE_ENV !== 'production') {
|
|
6505
6439
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6506
6440
|
}
|
|
@@ -6508,46 +6442,51 @@
|
|
|
6508
6442
|
}
|
|
6509
6443
|
return true;
|
|
6510
6444
|
}
|
|
6511
|
-
function isMatchingElement(vnode, elm) {
|
|
6512
|
-
|
|
6445
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
6446
|
+
const { getProperty } = renderer;
|
|
6447
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6513
6448
|
if (process.env.NODE_ENV !== 'production') {
|
|
6514
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty
|
|
6449
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6515
6450
|
}
|
|
6516
6451
|
return false;
|
|
6517
6452
|
}
|
|
6518
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6519
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6520
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6453
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
|
|
6454
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
|
|
6455
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
|
|
6521
6456
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6522
6457
|
}
|
|
6523
|
-
function validateAttrs(vnode, elm) {
|
|
6458
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
6524
6459
|
const { data: { attrs = {} }, } = vnode;
|
|
6525
6460
|
let nodesAreCompatible = true;
|
|
6526
6461
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6527
6462
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6528
6463
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6529
|
-
const
|
|
6464
|
+
const { owner } = vnode;
|
|
6465
|
+
const { getAttribute } = renderer;
|
|
6466
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
6530
6467
|
if (String(attrValue) !== elmAttrValue) {
|
|
6531
6468
|
if (process.env.NODE_ENV !== 'production') {
|
|
6532
|
-
|
|
6469
|
+
const { getProperty } = renderer;
|
|
6470
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
6533
6471
|
}
|
|
6534
6472
|
nodesAreCompatible = false;
|
|
6535
6473
|
}
|
|
6536
6474
|
}
|
|
6537
6475
|
return nodesAreCompatible;
|
|
6538
6476
|
}
|
|
6539
|
-
function validateClassAttr(vnode, elm) {
|
|
6477
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
6540
6478
|
const { data: { className, classMap }, } = vnode;
|
|
6479
|
+
const { getProperty, getClassList } = renderer;
|
|
6541
6480
|
let nodesAreCompatible = true;
|
|
6542
6481
|
let vnodeClassName;
|
|
6543
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
6482
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
6544
6483
|
// className is used when class is bound to an expr.
|
|
6545
6484
|
nodesAreCompatible = false;
|
|
6546
6485
|
vnodeClassName = className;
|
|
6547
6486
|
}
|
|
6548
6487
|
else if (!isUndefined$1(classMap)) {
|
|
6549
6488
|
// classMap is used when class is set to static value.
|
|
6550
|
-
const classList = getClassList
|
|
6489
|
+
const classList = getClassList(elm);
|
|
6551
6490
|
let computedClassName = '';
|
|
6552
6491
|
// all classes from the vnode should be in the element.classList
|
|
6553
6492
|
for (const name in classMap) {
|
|
@@ -6563,14 +6502,15 @@
|
|
|
6563
6502
|
}
|
|
6564
6503
|
if (!nodesAreCompatible) {
|
|
6565
6504
|
if (process.env.NODE_ENV !== 'production') {
|
|
6566
|
-
logError(`Mismatch hydrating element <${getProperty
|
|
6505
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
|
|
6567
6506
|
}
|
|
6568
6507
|
}
|
|
6569
6508
|
return nodesAreCompatible;
|
|
6570
6509
|
}
|
|
6571
|
-
function validateStyleAttr(vnode, elm) {
|
|
6510
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
6572
6511
|
const { data: { style, styleDecls }, } = vnode;
|
|
6573
|
-
const
|
|
6512
|
+
const { getAttribute } = renderer;
|
|
6513
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
6574
6514
|
let vnodeStyle;
|
|
6575
6515
|
let nodesAreCompatible = true;
|
|
6576
6516
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
@@ -6602,7 +6542,8 @@
|
|
|
6602
6542
|
}
|
|
6603
6543
|
if (!nodesAreCompatible) {
|
|
6604
6544
|
if (process.env.NODE_ENV !== 'production') {
|
|
6605
|
-
|
|
6545
|
+
const { getProperty } = renderer;
|
|
6546
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6606
6547
|
}
|
|
6607
6548
|
}
|
|
6608
6549
|
return nodesAreCompatible;
|
|
@@ -6742,7 +6683,7 @@
|
|
|
6742
6683
|
}
|
|
6743
6684
|
return ctor;
|
|
6744
6685
|
}
|
|
6745
|
-
/* version: 2.14.
|
|
6686
|
+
/* version: 2.14.2 */
|
|
6746
6687
|
|
|
6747
6688
|
/*
|
|
6748
6689
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6901,7 +6842,7 @@
|
|
|
6901
6842
|
try {
|
|
6902
6843
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6903
6844
|
// _wrapNativeSuper()
|
|
6904
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
6845
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6905
6846
|
// get wrapped by babel.
|
|
6906
6847
|
const HTMLElementAlias = HTMLElement;
|
|
6907
6848
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -6955,6 +6896,9 @@
|
|
|
6955
6896
|
hydrating = value;
|
|
6956
6897
|
}
|
|
6957
6898
|
const ssr = false;
|
|
6899
|
+
function isHydrating() {
|
|
6900
|
+
return hydrating;
|
|
6901
|
+
}
|
|
6958
6902
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6959
6903
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6960
6904
|
function createElement$1(tagName, namespace) {
|
|
@@ -7073,76 +7017,47 @@
|
|
|
7073
7017
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7074
7018
|
}
|
|
7075
7019
|
const HTMLElementExported = HTMLElementConstructor;
|
|
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
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
setSetText(setText);
|
|
7118
|
-
setSsr(ssr);
|
|
7119
|
-
setAddEventListener(addEventListener);
|
|
7120
|
-
setInsertStylesheet(insertStylesheet);
|
|
7121
|
-
|
|
7122
|
-
/*
|
|
7123
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7124
|
-
* All rights reserved.
|
|
7125
|
-
* SPDX-License-Identifier: MIT
|
|
7126
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7127
|
-
*/
|
|
7128
|
-
// @ts-ignore
|
|
7129
|
-
|
|
7130
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7131
|
-
window.addEventListener('test-dummy-flag', () => {
|
|
7132
|
-
let hasFlag = false;
|
|
7133
|
-
|
|
7134
|
-
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7135
|
-
hasFlag = true;
|
|
7136
|
-
}
|
|
7137
|
-
|
|
7138
|
-
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7139
|
-
detail: {
|
|
7140
|
-
package: '@lwc/engine-dom',
|
|
7141
|
-
hasFlag
|
|
7142
|
-
}
|
|
7143
|
-
}));
|
|
7144
|
-
});
|
|
7145
|
-
}
|
|
7020
|
+
const renderer = {
|
|
7021
|
+
ssr,
|
|
7022
|
+
isNativeShadowDefined,
|
|
7023
|
+
isSyntheticShadowDefined,
|
|
7024
|
+
HTMLElementExported,
|
|
7025
|
+
isHydrating,
|
|
7026
|
+
insert,
|
|
7027
|
+
remove,
|
|
7028
|
+
createElement: createElement$1,
|
|
7029
|
+
createText,
|
|
7030
|
+
createComment,
|
|
7031
|
+
nextSibling,
|
|
7032
|
+
attachShadow,
|
|
7033
|
+
getProperty,
|
|
7034
|
+
setProperty,
|
|
7035
|
+
setText,
|
|
7036
|
+
getAttribute,
|
|
7037
|
+
setAttribute,
|
|
7038
|
+
removeAttribute,
|
|
7039
|
+
addEventListener,
|
|
7040
|
+
removeEventListener,
|
|
7041
|
+
dispatchEvent,
|
|
7042
|
+
getClassList,
|
|
7043
|
+
setCSSStyleProperty,
|
|
7044
|
+
getBoundingClientRect,
|
|
7045
|
+
querySelector,
|
|
7046
|
+
querySelectorAll,
|
|
7047
|
+
getElementsByTagName,
|
|
7048
|
+
getElementsByClassName,
|
|
7049
|
+
getChildren,
|
|
7050
|
+
getChildNodes,
|
|
7051
|
+
getFirstChild,
|
|
7052
|
+
getFirstElementChild,
|
|
7053
|
+
getLastChild,
|
|
7054
|
+
getLastElementChild,
|
|
7055
|
+
isConnected,
|
|
7056
|
+
insertStylesheet,
|
|
7057
|
+
assertInstanceOfHTMLElement,
|
|
7058
|
+
defineCustomElement,
|
|
7059
|
+
getCustomElement,
|
|
7060
|
+
};
|
|
7146
7061
|
|
|
7147
7062
|
/*
|
|
7148
7063
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7164,7 +7079,7 @@
|
|
|
7164
7079
|
}
|
|
7165
7080
|
}
|
|
7166
7081
|
function createVMWithProps(element, Ctor, props) {
|
|
7167
|
-
const vm = createVM(element, Ctor, {
|
|
7082
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
7168
7083
|
mode: 'open',
|
|
7169
7084
|
owner: null,
|
|
7170
7085
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -7260,7 +7175,7 @@
|
|
|
7260
7175
|
hydratedCustomElements.add(this);
|
|
7261
7176
|
}
|
|
7262
7177
|
else {
|
|
7263
|
-
createVM(this, Ctor, {
|
|
7178
|
+
createVM(this, Ctor, renderer, {
|
|
7264
7179
|
mode: 'open',
|
|
7265
7180
|
owner: null,
|
|
7266
7181
|
tagName: this.tagName,
|
|
@@ -7345,7 +7260,7 @@
|
|
|
7345
7260
|
if (!isFunction$1(Ctor)) {
|
|
7346
7261
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7347
7262
|
}
|
|
7348
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
7263
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7349
7264
|
let wasComponentUpgraded = false;
|
|
7350
7265
|
// the custom element from the registry is expecting an upgrade callback
|
|
7351
7266
|
/**
|
|
@@ -7355,7 +7270,7 @@
|
|
|
7355
7270
|
* an upgradable custom element.
|
|
7356
7271
|
*/
|
|
7357
7272
|
const element = new UpgradableConstructor((elm) => {
|
|
7358
|
-
createVM(elm, Ctor, {
|
|
7273
|
+
createVM(elm, Ctor, renderer, {
|
|
7359
7274
|
tagName: sel,
|
|
7360
7275
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7361
7276
|
owner: null,
|
|
@@ -7439,7 +7354,7 @@
|
|
|
7439
7354
|
});
|
|
7440
7355
|
freeze(LightningElement);
|
|
7441
7356
|
seal(LightningElement.prototype);
|
|
7442
|
-
/* version: 2.14.
|
|
7357
|
+
/* version: 2.14.2 */
|
|
7443
7358
|
|
|
7444
7359
|
exports.LightningElement = LightningElement;
|
|
7445
7360
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7458,6 +7373,7 @@
|
|
|
7458
7373
|
exports.registerComponent = registerComponent;
|
|
7459
7374
|
exports.registerDecorators = registerDecorators;
|
|
7460
7375
|
exports.registerTemplate = registerTemplate;
|
|
7376
|
+
exports.renderer = renderer;
|
|
7461
7377
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7462
7378
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7463
7379
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|