lwc 2.14.0 → 2.15.0
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 +637 -554
- package/dist/engine-dom/iife/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/iife/es5/engine-dom.js +807 -694
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +729 -634
- package/dist/engine-dom/umd/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/umd/es5/engine-dom.js +807 -694
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +729 -634
- package/dist/engine-server/commonjs/es2017/engine-server.js +494 -473
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +492 -474
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +29 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +29 -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
|
@@ -236,6 +236,7 @@
|
|
|
236
236
|
*/
|
|
237
237
|
const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
|
|
238
238
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
239
|
+
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
239
240
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
240
241
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
241
242
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
@@ -304,9 +305,9 @@
|
|
|
304
305
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
305
306
|
*/
|
|
306
307
|
// Increment whenever the LWC template compiler changes
|
|
307
|
-
const LWC_VERSION = "2.
|
|
308
|
+
const LWC_VERSION = "2.15.0";
|
|
308
309
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.
|
|
310
|
+
/** version: 2.15.0 */
|
|
310
311
|
|
|
311
312
|
/*
|
|
312
313
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -460,7 +461,32 @@
|
|
|
460
461
|
setFeatureFlag(name, value);
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
|
-
/** version: 2.
|
|
464
|
+
/** version: 2.15.0 */
|
|
465
|
+
|
|
466
|
+
/*
|
|
467
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
468
|
+
* All rights reserved.
|
|
469
|
+
* SPDX-License-Identifier: MIT
|
|
470
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
471
|
+
*/
|
|
472
|
+
// @ts-ignore
|
|
473
|
+
|
|
474
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
475
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
476
|
+
let hasFlag = false;
|
|
477
|
+
|
|
478
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
479
|
+
hasFlag = true;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
483
|
+
detail: {
|
|
484
|
+
package: '@lwc/engine-dom',
|
|
485
|
+
hasFlag
|
|
486
|
+
}
|
|
487
|
+
}));
|
|
488
|
+
});
|
|
489
|
+
}
|
|
464
490
|
|
|
465
491
|
/* proxy-compat-disable */
|
|
466
492
|
|
|
@@ -570,162 +596,6 @@
|
|
|
570
596
|
return list;
|
|
571
597
|
}
|
|
572
598
|
|
|
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
599
|
/*
|
|
730
600
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
731
601
|
* All rights reserved.
|
|
@@ -2030,7 +1900,8 @@
|
|
|
2030
1900
|
const { def, elm } = vm;
|
|
2031
1901
|
const { bridge } = def;
|
|
2032
1902
|
if (process.env.NODE_ENV !== 'production') {
|
|
2033
|
-
|
|
1903
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1904
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2034
1905
|
}
|
|
2035
1906
|
const component = this;
|
|
2036
1907
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2064,8 +1935,8 @@
|
|
|
2064
1935
|
return this;
|
|
2065
1936
|
};
|
|
2066
1937
|
function doAttachShadow(vm) {
|
|
2067
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2068
|
-
const shadowRoot = attachShadow
|
|
1938
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1939
|
+
const shadowRoot = attachShadow(elm, {
|
|
2069
1940
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2070
1941
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2071
1942
|
mode,
|
|
@@ -2086,12 +1957,13 @@
|
|
|
2086
1957
|
LightningElement.prototype = {
|
|
2087
1958
|
constructor: LightningElement,
|
|
2088
1959
|
dispatchEvent(event) {
|
|
2089
|
-
const
|
|
2090
|
-
|
|
1960
|
+
const vm = getAssociatedVM(this);
|
|
1961
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1962
|
+
return dispatchEvent(elm, event);
|
|
2091
1963
|
},
|
|
2092
1964
|
addEventListener(type, listener, options) {
|
|
2093
1965
|
const vm = getAssociatedVM(this);
|
|
2094
|
-
const { elm } = vm;
|
|
1966
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2095
1967
|
if (process.env.NODE_ENV !== 'production') {
|
|
2096
1968
|
const vmBeingRendered = getVMBeingRendered();
|
|
2097
1969
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2099,83 +1971,91 @@
|
|
|
2099
1971
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2100
1972
|
}
|
|
2101
1973
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2102
|
-
addEventListener
|
|
1974
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2103
1975
|
},
|
|
2104
1976
|
removeEventListener(type, listener, options) {
|
|
2105
1977
|
const vm = getAssociatedVM(this);
|
|
2106
|
-
const { elm } = vm;
|
|
1978
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2107
1979
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2108
|
-
removeEventListener
|
|
1980
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2109
1981
|
},
|
|
2110
1982
|
hasAttribute(name) {
|
|
2111
|
-
const
|
|
2112
|
-
|
|
1983
|
+
const vm = getAssociatedVM(this);
|
|
1984
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1985
|
+
return !isNull(getAttribute(elm, name));
|
|
2113
1986
|
},
|
|
2114
1987
|
hasAttributeNS(namespace, name) {
|
|
2115
|
-
const
|
|
2116
|
-
|
|
1988
|
+
const vm = getAssociatedVM(this);
|
|
1989
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1990
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2117
1991
|
},
|
|
2118
1992
|
removeAttribute(name) {
|
|
2119
|
-
const
|
|
1993
|
+
const vm = getAssociatedVM(this);
|
|
1994
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2120
1995
|
unlockAttribute(elm, name);
|
|
2121
|
-
removeAttribute
|
|
1996
|
+
removeAttribute(elm, name);
|
|
2122
1997
|
lockAttribute();
|
|
2123
1998
|
},
|
|
2124
1999
|
removeAttributeNS(namespace, name) {
|
|
2125
|
-
const { elm } = getAssociatedVM(this);
|
|
2000
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2126
2001
|
unlockAttribute(elm, name);
|
|
2127
|
-
removeAttribute
|
|
2002
|
+
removeAttribute(elm, name, namespace);
|
|
2128
2003
|
lockAttribute();
|
|
2129
2004
|
},
|
|
2130
2005
|
getAttribute(name) {
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2006
|
+
const vm = getAssociatedVM(this);
|
|
2007
|
+
const { elm } = vm;
|
|
2008
|
+
const { getAttribute } = vm.renderer;
|
|
2009
|
+
return getAttribute(elm, name);
|
|
2133
2010
|
},
|
|
2134
2011
|
getAttributeNS(namespace, name) {
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2012
|
+
const vm = getAssociatedVM(this);
|
|
2013
|
+
const { elm } = vm;
|
|
2014
|
+
const { getAttribute } = vm.renderer;
|
|
2015
|
+
return getAttribute(elm, name, namespace);
|
|
2137
2016
|
},
|
|
2138
2017
|
setAttribute(name, value) {
|
|
2139
2018
|
const vm = getAssociatedVM(this);
|
|
2140
|
-
const { elm } = vm;
|
|
2019
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2141
2020
|
if (process.env.NODE_ENV !== 'production') {
|
|
2142
2021
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2143
2022
|
}
|
|
2144
2023
|
unlockAttribute(elm, name);
|
|
2145
|
-
setAttribute
|
|
2024
|
+
setAttribute(elm, name, value);
|
|
2146
2025
|
lockAttribute();
|
|
2147
2026
|
},
|
|
2148
2027
|
setAttributeNS(namespace, name, value) {
|
|
2149
2028
|
const vm = getAssociatedVM(this);
|
|
2150
|
-
const { elm } = vm;
|
|
2029
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2151
2030
|
if (process.env.NODE_ENV !== 'production') {
|
|
2152
2031
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2153
2032
|
}
|
|
2154
2033
|
unlockAttribute(elm, name);
|
|
2155
|
-
setAttribute
|
|
2034
|
+
setAttribute(elm, name, value, namespace);
|
|
2156
2035
|
lockAttribute();
|
|
2157
2036
|
},
|
|
2158
2037
|
getBoundingClientRect() {
|
|
2159
2038
|
const vm = getAssociatedVM(this);
|
|
2160
|
-
const { elm } = vm;
|
|
2039
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2161
2040
|
if (process.env.NODE_ENV !== 'production') {
|
|
2162
2041
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2163
2042
|
}
|
|
2164
|
-
return getBoundingClientRect
|
|
2043
|
+
return getBoundingClientRect(elm);
|
|
2165
2044
|
},
|
|
2166
2045
|
get isConnected() {
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2046
|
+
const vm = getAssociatedVM(this);
|
|
2047
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2048
|
+
return isConnected(elm);
|
|
2169
2049
|
},
|
|
2170
2050
|
get classList() {
|
|
2171
2051
|
const vm = getAssociatedVM(this);
|
|
2172
|
-
const { elm } = vm;
|
|
2052
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2173
2053
|
if (process.env.NODE_ENV !== 'production') {
|
|
2174
2054
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2175
2055
|
// just throw in all modes
|
|
2176
2056
|
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
2057
|
}
|
|
2178
|
-
return getClassList
|
|
2058
|
+
return getClassList(elm);
|
|
2179
2059
|
},
|
|
2180
2060
|
get template() {
|
|
2181
2061
|
const vm = getAssociatedVM(this);
|
|
@@ -2191,6 +2071,54 @@
|
|
|
2191
2071
|
// Authors should rely on this.template instead.
|
|
2192
2072
|
return null;
|
|
2193
2073
|
},
|
|
2074
|
+
get children() {
|
|
2075
|
+
const vm = getAssociatedVM(this);
|
|
2076
|
+
const renderer = vm.renderer;
|
|
2077
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2078
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2079
|
+
}
|
|
2080
|
+
return renderer.getChildren(vm.elm);
|
|
2081
|
+
},
|
|
2082
|
+
get childNodes() {
|
|
2083
|
+
const vm = getAssociatedVM(this);
|
|
2084
|
+
const renderer = vm.renderer;
|
|
2085
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2086
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2087
|
+
}
|
|
2088
|
+
return renderer.getChildNodes(vm.elm);
|
|
2089
|
+
},
|
|
2090
|
+
get firstChild() {
|
|
2091
|
+
const vm = getAssociatedVM(this);
|
|
2092
|
+
const renderer = vm.renderer;
|
|
2093
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2094
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2095
|
+
}
|
|
2096
|
+
return renderer.getFirstChild(vm.elm);
|
|
2097
|
+
},
|
|
2098
|
+
get firstElementChild() {
|
|
2099
|
+
const vm = getAssociatedVM(this);
|
|
2100
|
+
const renderer = vm.renderer;
|
|
2101
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2102
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2103
|
+
}
|
|
2104
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2105
|
+
},
|
|
2106
|
+
get lastChild() {
|
|
2107
|
+
const vm = getAssociatedVM(this);
|
|
2108
|
+
const renderer = vm.renderer;
|
|
2109
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2110
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2111
|
+
}
|
|
2112
|
+
return renderer.getLastChild(vm.elm);
|
|
2113
|
+
},
|
|
2114
|
+
get lastElementChild() {
|
|
2115
|
+
const vm = getAssociatedVM(this);
|
|
2116
|
+
const renderer = vm.renderer;
|
|
2117
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2118
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2119
|
+
}
|
|
2120
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2121
|
+
},
|
|
2194
2122
|
render() {
|
|
2195
2123
|
const vm = getAssociatedVM(this);
|
|
2196
2124
|
return vm.def.template;
|
|
@@ -2201,76 +2129,22 @@
|
|
|
2201
2129
|
},
|
|
2202
2130
|
};
|
|
2203
2131
|
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
2132
|
const queryMethods = [
|
|
2247
2133
|
'getElementsByClassName',
|
|
2248
2134
|
'getElementsByTagName',
|
|
2249
2135
|
'querySelector',
|
|
2250
2136
|
'querySelectorAll',
|
|
2251
2137
|
];
|
|
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
2138
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2265
2139
|
for (const queryMethod of queryMethods) {
|
|
2266
2140
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2267
2141
|
value(arg) {
|
|
2268
2142
|
const vm = getAssociatedVM(this);
|
|
2269
|
-
const { elm } = vm;
|
|
2143
|
+
const { elm, renderer } = vm;
|
|
2270
2144
|
if (process.env.NODE_ENV !== 'production') {
|
|
2271
2145
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2272
2146
|
}
|
|
2273
|
-
return
|
|
2147
|
+
return renderer[queryMethod](elm, arg);
|
|
2274
2148
|
},
|
|
2275
2149
|
configurable: true,
|
|
2276
2150
|
enumerable: true,
|
|
@@ -2775,7 +2649,8 @@
|
|
|
2775
2649
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2776
2650
|
*/
|
|
2777
2651
|
let warned = false;
|
|
2778
|
-
|
|
2652
|
+
// @ts-ignore
|
|
2653
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2779
2654
|
// @ts-ignore
|
|
2780
2655
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2781
2656
|
warned = false;
|
|
@@ -3493,12 +3368,13 @@
|
|
|
3493
3368
|
* SPDX-License-Identifier: MIT
|
|
3494
3369
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3495
3370
|
*/
|
|
3496
|
-
function getUpgradableConstructor(tagName) {
|
|
3371
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3372
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3497
3373
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3498
3374
|
// produce only tags with lowercase letters
|
|
3499
3375
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3500
3376
|
tagName = tagName.toLowerCase();
|
|
3501
|
-
let CE = getCustomElement
|
|
3377
|
+
let CE = getCustomElement(tagName);
|
|
3502
3378
|
if (!isUndefined$1(CE)) {
|
|
3503
3379
|
return CE;
|
|
3504
3380
|
}
|
|
@@ -3506,7 +3382,7 @@
|
|
|
3506
3382
|
* LWC Upgradable Element reference to an element that was created
|
|
3507
3383
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3508
3384
|
*/
|
|
3509
|
-
CE = class LWCUpgradableElement extends
|
|
3385
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3510
3386
|
constructor(upgradeCallback) {
|
|
3511
3387
|
super();
|
|
3512
3388
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3514,7 +3390,7 @@
|
|
|
3514
3390
|
}
|
|
3515
3391
|
}
|
|
3516
3392
|
};
|
|
3517
|
-
defineCustomElement
|
|
3393
|
+
defineCustomElement(tagName, CE);
|
|
3518
3394
|
return CE;
|
|
3519
3395
|
}
|
|
3520
3396
|
|
|
@@ -3539,7 +3415,7 @@
|
|
|
3539
3415
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3540
3416
|
*/
|
|
3541
3417
|
const ColonCharCode = 58;
|
|
3542
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3418
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3543
3419
|
const { attrs } = vnode.data;
|
|
3544
3420
|
if (isUndefined$1(attrs)) {
|
|
3545
3421
|
return;
|
|
@@ -3549,6 +3425,7 @@
|
|
|
3549
3425
|
return;
|
|
3550
3426
|
}
|
|
3551
3427
|
const { elm } = vnode;
|
|
3428
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3552
3429
|
for (const key in attrs) {
|
|
3553
3430
|
const cur = attrs[key];
|
|
3554
3431
|
const old = oldAttrs[key];
|
|
@@ -3556,17 +3433,17 @@
|
|
|
3556
3433
|
unlockAttribute(elm, key);
|
|
3557
3434
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3558
3435
|
// Assume xml namespace
|
|
3559
|
-
setAttribute
|
|
3436
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3560
3437
|
}
|
|
3561
3438
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3562
3439
|
// Assume xlink namespace
|
|
3563
|
-
setAttribute
|
|
3440
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3564
3441
|
}
|
|
3565
3442
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3566
|
-
removeAttribute
|
|
3443
|
+
removeAttribute(elm, key);
|
|
3567
3444
|
}
|
|
3568
3445
|
else {
|
|
3569
|
-
setAttribute
|
|
3446
|
+
setAttribute(elm, key, cur);
|
|
3570
3447
|
}
|
|
3571
3448
|
lockAttribute();
|
|
3572
3449
|
}
|
|
@@ -3584,7 +3461,7 @@
|
|
|
3584
3461
|
// instead of relying on internally tracked values.
|
|
3585
3462
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3586
3463
|
}
|
|
3587
|
-
function patchProps(oldVnode, vnode) {
|
|
3464
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3588
3465
|
const { props } = vnode.data;
|
|
3589
3466
|
if (isUndefined$1(props)) {
|
|
3590
3467
|
return;
|
|
@@ -3595,13 +3472,14 @@
|
|
|
3595
3472
|
}
|
|
3596
3473
|
const isFirstPatch = isNull(oldVnode);
|
|
3597
3474
|
const { elm, sel } = vnode;
|
|
3475
|
+
const { getProperty, setProperty } = renderer;
|
|
3598
3476
|
for (const key in props) {
|
|
3599
3477
|
const cur = props[key];
|
|
3600
3478
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3601
3479
|
// different than the one previously set.
|
|
3602
3480
|
if (isFirstPatch ||
|
|
3603
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3604
|
-
setProperty
|
|
3481
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3482
|
+
setProperty(elm, key, cur);
|
|
3605
3483
|
}
|
|
3606
3484
|
}
|
|
3607
3485
|
}
|
|
@@ -3646,13 +3524,14 @@
|
|
|
3646
3524
|
}
|
|
3647
3525
|
return map;
|
|
3648
3526
|
}
|
|
3649
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3527
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3650
3528
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3651
3529
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3652
3530
|
if (oldClass === newClass) {
|
|
3653
3531
|
return;
|
|
3654
3532
|
}
|
|
3655
|
-
const
|
|
3533
|
+
const { getClassList } = renderer;
|
|
3534
|
+
const classList = getClassList(elm);
|
|
3656
3535
|
const newClassMap = getMapFromClassName(newClass);
|
|
3657
3536
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3658
3537
|
let name;
|
|
@@ -3676,17 +3555,18 @@
|
|
|
3676
3555
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3677
3556
|
*/
|
|
3678
3557
|
// The style property is a string when defined via an expression in the template.
|
|
3679
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3558
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3680
3559
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3681
3560
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3682
3561
|
if (oldStyle === newStyle) {
|
|
3683
3562
|
return;
|
|
3684
3563
|
}
|
|
3564
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3685
3565
|
if (!isString(newStyle) || newStyle === '') {
|
|
3686
|
-
removeAttribute
|
|
3566
|
+
removeAttribute(elm, 'style');
|
|
3687
3567
|
}
|
|
3688
3568
|
else {
|
|
3689
|
-
setAttribute
|
|
3569
|
+
setAttribute(elm, 'style', newStyle);
|
|
3690
3570
|
}
|
|
3691
3571
|
}
|
|
3692
3572
|
|
|
@@ -3696,14 +3576,15 @@
|
|
|
3696
3576
|
* SPDX-License-Identifier: MIT
|
|
3697
3577
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3698
3578
|
*/
|
|
3699
|
-
function applyEventListeners(vnode) {
|
|
3579
|
+
function applyEventListeners(vnode, renderer) {
|
|
3700
3580
|
const { elm, data: { on }, } = vnode;
|
|
3701
3581
|
if (isUndefined$1(on)) {
|
|
3702
3582
|
return;
|
|
3703
3583
|
}
|
|
3584
|
+
const { addEventListener } = renderer;
|
|
3704
3585
|
for (const name in on) {
|
|
3705
3586
|
const handler = on[name];
|
|
3706
|
-
addEventListener
|
|
3587
|
+
addEventListener(elm, name, handler);
|
|
3707
3588
|
}
|
|
3708
3589
|
}
|
|
3709
3590
|
|
|
@@ -3716,12 +3597,13 @@
|
|
|
3716
3597
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3717
3598
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3718
3599
|
// different classnames properties individually instead of via a string.
|
|
3719
|
-
function applyStaticClassAttribute(vnode) {
|
|
3600
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3720
3601
|
const { elm, data: { classMap }, } = vnode;
|
|
3721
3602
|
if (isUndefined$1(classMap)) {
|
|
3722
3603
|
return;
|
|
3723
3604
|
}
|
|
3724
|
-
const
|
|
3605
|
+
const { getClassList } = renderer;
|
|
3606
|
+
const classList = getClassList(elm);
|
|
3725
3607
|
for (const name in classMap) {
|
|
3726
3608
|
classList.add(name);
|
|
3727
3609
|
}
|
|
@@ -3736,14 +3618,15 @@
|
|
|
3736
3618
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3737
3619
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3738
3620
|
// different style properties individually instead of via a string.
|
|
3739
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3621
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3740
3622
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3741
3623
|
if (isUndefined$1(styleDecls)) {
|
|
3742
3624
|
return;
|
|
3743
3625
|
}
|
|
3626
|
+
const { setCSSStyleProperty } = renderer;
|
|
3744
3627
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3745
3628
|
const [prop, value, important] = styleDecls[i];
|
|
3746
|
-
setCSSStyleProperty
|
|
3629
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3747
3630
|
}
|
|
3748
3631
|
}
|
|
3749
3632
|
|
|
@@ -3753,15 +3636,16 @@
|
|
|
3753
3636
|
* SPDX-License-Identifier: MIT
|
|
3754
3637
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3755
3638
|
*/
|
|
3756
|
-
function patchChildren(c1, c2, parent) {
|
|
3639
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3757
3640
|
if (hasDynamicChildren(c2)) {
|
|
3758
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3641
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3759
3642
|
}
|
|
3760
3643
|
else {
|
|
3761
|
-
updateStaticChildren(c1, c2, parent);
|
|
3644
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3762
3645
|
}
|
|
3763
3646
|
}
|
|
3764
|
-
function patch(n1, n2) {
|
|
3647
|
+
function patch(n1, n2, renderer) {
|
|
3648
|
+
var _a, _b;
|
|
3765
3649
|
if (n1 === n2) {
|
|
3766
3650
|
return;
|
|
3767
3651
|
}
|
|
@@ -3775,80 +3659,115 @@
|
|
|
3775
3659
|
}
|
|
3776
3660
|
switch (n2.type) {
|
|
3777
3661
|
case 0 /* Text */:
|
|
3778
|
-
|
|
3662
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3663
|
+
patchText(n1, n2, renderer);
|
|
3779
3664
|
break;
|
|
3780
3665
|
case 1 /* Comment */:
|
|
3781
|
-
|
|
3666
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3667
|
+
patchComment(n1, n2, renderer);
|
|
3668
|
+
break;
|
|
3669
|
+
case 4 /* Static */:
|
|
3670
|
+
n2.elm = n1.elm;
|
|
3782
3671
|
break;
|
|
3783
3672
|
case 2 /* Element */:
|
|
3784
|
-
patchElement(n1, n2);
|
|
3673
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3785
3674
|
break;
|
|
3786
3675
|
case 3 /* CustomElement */:
|
|
3787
|
-
patchCustomElement(n1, n2);
|
|
3676
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3788
3677
|
break;
|
|
3789
3678
|
}
|
|
3790
3679
|
}
|
|
3791
|
-
function mount(node, parent, anchor) {
|
|
3680
|
+
function mount(node, parent, renderer, anchor) {
|
|
3681
|
+
var _a, _b;
|
|
3792
3682
|
switch (node.type) {
|
|
3793
3683
|
case 0 /* Text */:
|
|
3794
|
-
|
|
3684
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3685
|
+
mountText(node, parent, anchor, renderer);
|
|
3795
3686
|
break;
|
|
3796
3687
|
case 1 /* Comment */:
|
|
3797
|
-
|
|
3688
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3689
|
+
mountComment(node, parent, anchor, renderer);
|
|
3690
|
+
break;
|
|
3691
|
+
case 4 /* Static */:
|
|
3692
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3693
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3798
3694
|
break;
|
|
3799
3695
|
case 2 /* Element */:
|
|
3800
|
-
|
|
3696
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3697
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3801
3698
|
break;
|
|
3802
3699
|
case 3 /* CustomElement */:
|
|
3803
|
-
|
|
3700
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3701
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3804
3702
|
break;
|
|
3805
3703
|
}
|
|
3806
3704
|
}
|
|
3807
|
-
function patchText(n1, n2) {
|
|
3705
|
+
function patchText(n1, n2, renderer) {
|
|
3808
3706
|
n2.elm = n1.elm;
|
|
3809
3707
|
if (n2.text !== n1.text) {
|
|
3810
|
-
updateTextContent(n2);
|
|
3708
|
+
updateTextContent(n2, renderer);
|
|
3811
3709
|
}
|
|
3812
3710
|
}
|
|
3813
|
-
function mountText(
|
|
3814
|
-
const { owner } =
|
|
3815
|
-
const
|
|
3816
|
-
|
|
3817
|
-
|
|
3711
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3712
|
+
const { owner } = vnode;
|
|
3713
|
+
const { createText } = renderer;
|
|
3714
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3715
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3716
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3818
3717
|
}
|
|
3819
|
-
function patchComment(n1, n2) {
|
|
3718
|
+
function patchComment(n1, n2, renderer) {
|
|
3820
3719
|
n2.elm = n1.elm;
|
|
3821
3720
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3822
3721
|
// it is the case today.
|
|
3823
3722
|
if (n2.text !== n1.text) {
|
|
3824
|
-
updateTextContent(n2);
|
|
3723
|
+
updateTextContent(n2, renderer);
|
|
3825
3724
|
}
|
|
3826
3725
|
}
|
|
3827
|
-
function mountComment(
|
|
3828
|
-
const { owner } =
|
|
3829
|
-
const
|
|
3830
|
-
|
|
3831
|
-
|
|
3726
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3727
|
+
const { owner } = vnode;
|
|
3728
|
+
const { createComment } = renderer;
|
|
3729
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3730
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3731
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3832
3732
|
}
|
|
3833
|
-
function mountElement(vnode, parent, anchor) {
|
|
3733
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3834
3734
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3735
|
+
const { createElement } = renderer;
|
|
3835
3736
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3836
|
-
const elm = createElement
|
|
3837
|
-
linkNodeToShadow(elm, owner);
|
|
3838
|
-
fallbackElmHook(elm, vnode);
|
|
3737
|
+
const elm = createElement(sel, namespace);
|
|
3738
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3739
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3839
3740
|
vnode.elm = elm;
|
|
3840
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3841
|
-
insertNode(elm, parent, anchor);
|
|
3842
|
-
mountVNodes(vnode.children, elm, null);
|
|
3741
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3742
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3743
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3843
3744
|
}
|
|
3844
|
-
function patchElement(n1, n2) {
|
|
3745
|
+
function patchElement(n1, n2, renderer) {
|
|
3845
3746
|
const elm = (n2.elm = n1.elm);
|
|
3846
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3847
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3747
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3748
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3749
|
+
}
|
|
3750
|
+
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3751
|
+
const { owner } = vnode;
|
|
3752
|
+
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
3753
|
+
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
3754
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3755
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3756
|
+
const { renderMode, shadowMode } = owner;
|
|
3757
|
+
if (isSyntheticShadowDefined) {
|
|
3758
|
+
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3759
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3763
|
+
const isLight = renderMode === 0 /* Light */;
|
|
3764
|
+
patchElementWithRestrictions(elm, { isPortal: false, isLight });
|
|
3765
|
+
}
|
|
3766
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3848
3767
|
}
|
|
3849
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3768
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3850
3769
|
const { sel, owner } = vnode;
|
|
3851
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3770
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3852
3771
|
/**
|
|
3853
3772
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3854
3773
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3858,9 +3777,9 @@
|
|
|
3858
3777
|
let vm;
|
|
3859
3778
|
const elm = new UpgradableConstructor((elm) => {
|
|
3860
3779
|
// the custom element from the registry is expecting an upgrade callback
|
|
3861
|
-
vm = createViewModelHook(elm, vnode);
|
|
3780
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3862
3781
|
});
|
|
3863
|
-
linkNodeToShadow(elm, owner);
|
|
3782
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3864
3783
|
vnode.elm = elm;
|
|
3865
3784
|
vnode.vm = vm;
|
|
3866
3785
|
if (vm) {
|
|
@@ -3869,23 +3788,23 @@
|
|
|
3869
3788
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3870
3789
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3871
3790
|
}
|
|
3872
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3873
|
-
insertNode(elm, parent, anchor);
|
|
3791
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3792
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3874
3793
|
if (vm) {
|
|
3875
3794
|
if (process.env.NODE_ENV !== 'production') {
|
|
3876
3795
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3877
3796
|
}
|
|
3878
3797
|
runConnectedCallback(vm);
|
|
3879
3798
|
}
|
|
3880
|
-
mountVNodes(vnode.children, elm, null);
|
|
3799
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3881
3800
|
if (vm) {
|
|
3882
3801
|
appendVM(vm);
|
|
3883
3802
|
}
|
|
3884
3803
|
}
|
|
3885
|
-
function patchCustomElement(n1, n2) {
|
|
3804
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3886
3805
|
const elm = (n2.elm = n1.elm);
|
|
3887
3806
|
const vm = (n2.vm = n1.vm);
|
|
3888
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3807
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3889
3808
|
if (!isUndefined$1(vm)) {
|
|
3890
3809
|
// in fallback mode, the allocation will always set children to
|
|
3891
3810
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3893,33 +3812,38 @@
|
|
|
3893
3812
|
}
|
|
3894
3813
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3895
3814
|
// will happen, but in native, it does allocate the light dom
|
|
3896
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3815
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3897
3816
|
if (!isUndefined$1(vm)) {
|
|
3898
3817
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3899
3818
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3900
3819
|
rerenderVM(vm);
|
|
3901
3820
|
}
|
|
3902
3821
|
}
|
|
3903
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3822
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3904
3823
|
for (; start < end; ++start) {
|
|
3905
3824
|
const vnode = vnodes[start];
|
|
3906
3825
|
if (isVNode(vnode)) {
|
|
3907
|
-
mount(vnode, parent, anchor);
|
|
3826
|
+
mount(vnode, parent, renderer, anchor);
|
|
3908
3827
|
}
|
|
3909
3828
|
}
|
|
3910
3829
|
}
|
|
3911
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3830
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3912
3831
|
const { type, elm, sel } = vnode;
|
|
3913
3832
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3914
3833
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3915
3834
|
if (doRemove) {
|
|
3916
|
-
|
|
3835
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3836
|
+
// but the removal used here is from the owner instead.
|
|
3837
|
+
removeNode(elm, parent, renderer);
|
|
3917
3838
|
}
|
|
3918
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3919
3839
|
switch (type) {
|
|
3920
|
-
case 2 /* Element */:
|
|
3921
|
-
|
|
3840
|
+
case 2 /* Element */: {
|
|
3841
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3842
|
+
// Only required for synthetic shadow.
|
|
3843
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3844
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3922
3845
|
break;
|
|
3846
|
+
}
|
|
3923
3847
|
case 3 /* CustomElement */: {
|
|
3924
3848
|
const { vm } = vnode;
|
|
3925
3849
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -3930,11 +3854,11 @@
|
|
|
3930
3854
|
}
|
|
3931
3855
|
}
|
|
3932
3856
|
}
|
|
3933
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3857
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3934
3858
|
for (; start < end; ++start) {
|
|
3935
3859
|
const ch = vnodes[start];
|
|
3936
3860
|
if (isVNode(ch)) {
|
|
3937
|
-
unmount(ch, parent, doRemove);
|
|
3861
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3938
3862
|
}
|
|
3939
3863
|
}
|
|
3940
3864
|
}
|
|
@@ -3948,66 +3872,71 @@
|
|
|
3948
3872
|
elm.$shadowToken$ = token;
|
|
3949
3873
|
}
|
|
3950
3874
|
// Set the scope token class for *.scoped.css styles
|
|
3951
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3875
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3952
3876
|
const { cmpTemplate, context } = owner;
|
|
3877
|
+
const { getClassList } = renderer;
|
|
3953
3878
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3954
3879
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3955
|
-
|
|
3880
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3881
|
+
// probably we should have a renderer api for just the add operation
|
|
3882
|
+
getClassList(elm).add(token);
|
|
3956
3883
|
}
|
|
3957
3884
|
}
|
|
3958
|
-
function linkNodeToShadow(elm, owner) {
|
|
3885
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3959
3886
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3887
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3960
3888
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3961
|
-
if (isSyntheticShadowDefined
|
|
3889
|
+
if (isSyntheticShadowDefined) {
|
|
3962
3890
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3963
3891
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3964
3892
|
}
|
|
3965
3893
|
}
|
|
3966
3894
|
}
|
|
3967
|
-
function updateTextContent(vnode) {
|
|
3895
|
+
function updateTextContent(vnode, renderer) {
|
|
3968
3896
|
const { elm, text } = vnode;
|
|
3897
|
+
const { setText } = renderer;
|
|
3969
3898
|
if (process.env.NODE_ENV !== 'production') {
|
|
3970
3899
|
unlockDomMutation();
|
|
3971
3900
|
}
|
|
3972
|
-
setText
|
|
3901
|
+
setText(elm, text);
|
|
3973
3902
|
if (process.env.NODE_ENV !== 'production') {
|
|
3974
3903
|
lockDomMutation();
|
|
3975
3904
|
}
|
|
3976
3905
|
}
|
|
3977
|
-
function insertNode(node, parent, anchor) {
|
|
3906
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3978
3907
|
if (process.env.NODE_ENV !== 'production') {
|
|
3979
3908
|
unlockDomMutation();
|
|
3980
3909
|
}
|
|
3981
|
-
insert
|
|
3910
|
+
renderer.insert(node, parent, anchor);
|
|
3982
3911
|
if (process.env.NODE_ENV !== 'production') {
|
|
3983
3912
|
lockDomMutation();
|
|
3984
3913
|
}
|
|
3985
3914
|
}
|
|
3986
|
-
function removeNode(node, parent) {
|
|
3915
|
+
function removeNode(node, parent, renderer) {
|
|
3987
3916
|
if (process.env.NODE_ENV !== 'production') {
|
|
3988
3917
|
unlockDomMutation();
|
|
3989
3918
|
}
|
|
3990
|
-
remove
|
|
3919
|
+
renderer.remove(node, parent);
|
|
3991
3920
|
if (process.env.NODE_ENV !== 'production') {
|
|
3992
3921
|
lockDomMutation();
|
|
3993
3922
|
}
|
|
3994
3923
|
}
|
|
3995
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3924
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3996
3925
|
if (isNull(oldVnode)) {
|
|
3997
|
-
applyEventListeners(vnode);
|
|
3998
|
-
applyStaticClassAttribute(vnode);
|
|
3999
|
-
applyStaticStyleAttribute(vnode);
|
|
3926
|
+
applyEventListeners(vnode, renderer);
|
|
3927
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3928
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4000
3929
|
}
|
|
4001
3930
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4002
3931
|
// value is set before type=radio.
|
|
4003
|
-
patchClassAttribute(oldVnode, vnode);
|
|
4004
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
4005
|
-
patchAttributes(oldVnode, vnode);
|
|
4006
|
-
patchProps(oldVnode, vnode);
|
|
3932
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3933
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3934
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3935
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4007
3936
|
}
|
|
4008
|
-
function fallbackElmHook(elm, vnode) {
|
|
3937
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
4009
3938
|
const { owner } = vnode;
|
|
4010
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3939
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4011
3940
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4012
3941
|
const { data: { context }, } = vnode;
|
|
4013
3942
|
const { stylesheetToken } = owner.context;
|
|
@@ -4055,7 +3984,7 @@
|
|
|
4055
3984
|
vnode.children = EmptyArray;
|
|
4056
3985
|
}
|
|
4057
3986
|
}
|
|
4058
|
-
function createViewModelHook(elm, vnode) {
|
|
3987
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4059
3988
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4060
3989
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4061
3990
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -4064,7 +3993,7 @@
|
|
|
4064
3993
|
return vm;
|
|
4065
3994
|
}
|
|
4066
3995
|
const { sel, mode, ctor, owner } = vnode;
|
|
4067
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3996
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4068
3997
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4069
3998
|
const { stylesheetToken } = owner.context;
|
|
4070
3999
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -4073,7 +4002,7 @@
|
|
|
4073
4002
|
setElementShadowToken(elm, stylesheetToken);
|
|
4074
4003
|
}
|
|
4075
4004
|
}
|
|
4076
|
-
vm = createVM(elm, ctor, {
|
|
4005
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4077
4006
|
mode,
|
|
4078
4007
|
owner,
|
|
4079
4008
|
tagName: sel,
|
|
@@ -4148,7 +4077,7 @@
|
|
|
4148
4077
|
}
|
|
4149
4078
|
return map;
|
|
4150
4079
|
}
|
|
4151
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4080
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4152
4081
|
let oldStartIdx = 0;
|
|
4153
4082
|
let newStartIdx = 0;
|
|
4154
4083
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4177,26 +4106,26 @@
|
|
|
4177
4106
|
newEndVnode = newCh[--newEndIdx];
|
|
4178
4107
|
}
|
|
4179
4108
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4180
|
-
patch(oldStartVnode, newStartVnode);
|
|
4109
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4181
4110
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4182
4111
|
newStartVnode = newCh[++newStartIdx];
|
|
4183
4112
|
}
|
|
4184
4113
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4185
|
-
patch(oldEndVnode, newEndVnode);
|
|
4114
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4186
4115
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4187
4116
|
newEndVnode = newCh[--newEndIdx];
|
|
4188
4117
|
}
|
|
4189
4118
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4190
4119
|
// Vnode moved right
|
|
4191
|
-
patch(oldStartVnode, newEndVnode);
|
|
4192
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4120
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4121
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4193
4122
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4194
4123
|
newEndVnode = newCh[--newEndIdx];
|
|
4195
4124
|
}
|
|
4196
4125
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4197
4126
|
// Vnode moved left
|
|
4198
|
-
patch(oldEndVnode, newStartVnode);
|
|
4199
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4127
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4128
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4200
4129
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4201
4130
|
newStartVnode = newCh[++newStartIdx];
|
|
4202
4131
|
}
|
|
@@ -4207,7 +4136,7 @@
|
|
|
4207
4136
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4208
4137
|
if (isUndefined$1(idxInOld)) {
|
|
4209
4138
|
// New element
|
|
4210
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4139
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4211
4140
|
newStartVnode = newCh[++newStartIdx];
|
|
4212
4141
|
}
|
|
4213
4142
|
else {
|
|
@@ -4215,10 +4144,10 @@
|
|
|
4215
4144
|
if (isVNode(elmToMove)) {
|
|
4216
4145
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4217
4146
|
// New element
|
|
4218
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4147
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4219
4148
|
}
|
|
4220
4149
|
else {
|
|
4221
|
-
patch(elmToMove, newStartVnode);
|
|
4150
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4222
4151
|
// Delete the old child, but copy the array since it is read-only.
|
|
4223
4152
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4224
4153
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4230,7 +4159,7 @@
|
|
|
4230
4159
|
}
|
|
4231
4160
|
// We've already cloned at least once, so it's no longer read-only
|
|
4232
4161
|
oldCh[idxInOld] = undefined;
|
|
4233
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4162
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4234
4163
|
}
|
|
4235
4164
|
}
|
|
4236
4165
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4247,25 +4176,25 @@
|
|
|
4247
4176
|
n = newCh[++i];
|
|
4248
4177
|
} while (!isVNode(n) && i < newChEnd);
|
|
4249
4178
|
before = isVNode(n) ? n.elm : null;
|
|
4250
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4179
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4251
4180
|
}
|
|
4252
4181
|
else {
|
|
4253
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4182
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4254
4183
|
}
|
|
4255
4184
|
}
|
|
4256
4185
|
}
|
|
4257
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4186
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4258
4187
|
const c1Length = c1.length;
|
|
4259
4188
|
const c2Length = c2.length;
|
|
4260
4189
|
if (c1Length === 0) {
|
|
4261
4190
|
// the old list is empty, we can directly insert anything new
|
|
4262
|
-
mountVNodes(c2, parent, null);
|
|
4191
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4263
4192
|
return;
|
|
4264
4193
|
}
|
|
4265
4194
|
if (c2Length === 0) {
|
|
4266
4195
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4267
4196
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4268
|
-
unmountVNodes(c1, parent, true);
|
|
4197
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4269
4198
|
return;
|
|
4270
4199
|
}
|
|
4271
4200
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4278,16 +4207,16 @@
|
|
|
4278
4207
|
if (isVNode(n1)) {
|
|
4279
4208
|
if (isVNode(n2)) {
|
|
4280
4209
|
// both vnodes are equivalent, and we just need to patch them
|
|
4281
|
-
patch(n1, n2);
|
|
4210
|
+
patch(n1, n2, renderer);
|
|
4282
4211
|
anchor = n2.elm;
|
|
4283
4212
|
}
|
|
4284
4213
|
else {
|
|
4285
4214
|
// removing the old vnode since the new one is null
|
|
4286
|
-
unmount(n1, parent, true);
|
|
4215
|
+
unmount(n1, parent, renderer, true);
|
|
4287
4216
|
}
|
|
4288
4217
|
}
|
|
4289
4218
|
else if (isVNode(n2)) {
|
|
4290
|
-
mount(n2, parent, anchor);
|
|
4219
|
+
mount(n2, parent, renderer, anchor);
|
|
4291
4220
|
anchor = n2.elm;
|
|
4292
4221
|
}
|
|
4293
4222
|
}
|
|
@@ -4304,6 +4233,17 @@
|
|
|
4304
4233
|
function addVNodeToChildLWC(vnode) {
|
|
4305
4234
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4306
4235
|
}
|
|
4236
|
+
// [st]atic node
|
|
4237
|
+
function st(fragment, key) {
|
|
4238
|
+
return {
|
|
4239
|
+
type: 4 /* Static */,
|
|
4240
|
+
sel: undefined,
|
|
4241
|
+
key,
|
|
4242
|
+
elm: undefined,
|
|
4243
|
+
fragment,
|
|
4244
|
+
owner: getVMBeingRendered(),
|
|
4245
|
+
};
|
|
4246
|
+
}
|
|
4307
4247
|
// [h]tml node
|
|
4308
4248
|
function h(sel, data, children = EmptyArray) {
|
|
4309
4249
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -4693,6 +4633,7 @@
|
|
|
4693
4633
|
co,
|
|
4694
4634
|
dc,
|
|
4695
4635
|
ti,
|
|
4636
|
+
st,
|
|
4696
4637
|
gid,
|
|
4697
4638
|
fid,
|
|
4698
4639
|
shc,
|
|
@@ -4716,7 +4657,7 @@
|
|
|
4716
4657
|
}, [api.t(content)]);
|
|
4717
4658
|
}
|
|
4718
4659
|
function updateStylesheetToken(vm, template) {
|
|
4719
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4660
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4720
4661
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4721
4662
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4722
4663
|
const { hasScopedStyles } = context;
|
|
@@ -4727,10 +4668,10 @@
|
|
|
4727
4668
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4728
4669
|
if (!isUndefined$1(oldToken)) {
|
|
4729
4670
|
if (oldHasTokenInClass) {
|
|
4730
|
-
getClassList
|
|
4671
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4731
4672
|
}
|
|
4732
4673
|
if (oldHasTokenInAttribute) {
|
|
4733
|
-
removeAttribute
|
|
4674
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4734
4675
|
}
|
|
4735
4676
|
}
|
|
4736
4677
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4741,11 +4682,11 @@
|
|
|
4741
4682
|
// Set the new styling token on the host element
|
|
4742
4683
|
if (!isUndefined$1(newToken)) {
|
|
4743
4684
|
if (hasScopedStyles) {
|
|
4744
|
-
getClassList
|
|
4685
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4745
4686
|
newHasTokenInClass = true;
|
|
4746
4687
|
}
|
|
4747
4688
|
if (isSyntheticShadow) {
|
|
4748
|
-
setAttribute
|
|
4689
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4749
4690
|
newHasTokenInAttribute = true;
|
|
4750
4691
|
}
|
|
4751
4692
|
}
|
|
@@ -4833,19 +4774,18 @@
|
|
|
4833
4774
|
return owner;
|
|
4834
4775
|
}
|
|
4835
4776
|
function createStylesheet(vm, stylesheets) {
|
|
4836
|
-
const { renderMode, shadowMode } = vm;
|
|
4777
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4837
4778
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4838
4779
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4839
|
-
insertStylesheet
|
|
4780
|
+
insertStylesheet(stylesheets[i]);
|
|
4840
4781
|
}
|
|
4841
4782
|
}
|
|
4842
|
-
else if (ssr
|
|
4783
|
+
else if (ssr || vm.hydrated) {
|
|
4843
4784
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4844
4785
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4845
4786
|
// the first time the VM renders.
|
|
4846
4787
|
// native shadow or light DOM, SSR
|
|
4847
|
-
|
|
4848
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
4788
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4849
4789
|
}
|
|
4850
4790
|
else {
|
|
4851
4791
|
// native shadow or light DOM, DOM renderer
|
|
@@ -4853,7 +4793,7 @@
|
|
|
4853
4793
|
// null root means a global style
|
|
4854
4794
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4855
4795
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4856
|
-
insertStylesheet
|
|
4796
|
+
insertStylesheet(stylesheets[i], target);
|
|
4857
4797
|
}
|
|
4858
4798
|
}
|
|
4859
4799
|
return null;
|
|
@@ -5013,6 +4953,59 @@
|
|
|
5013
4953
|
assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
|
|
5014
4954
|
}
|
|
5015
4955
|
}
|
|
4956
|
+
function buildParseFragmentFn(createFragmentFn) {
|
|
4957
|
+
return (strings, ...keys) => {
|
|
4958
|
+
const cache = create(null);
|
|
4959
|
+
return function () {
|
|
4960
|
+
const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
4961
|
+
const hasStyleToken = !isUndefined$1(stylesheetToken);
|
|
4962
|
+
const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
|
|
4963
|
+
let cacheKey = 0;
|
|
4964
|
+
if (hasStyleToken && hasScopedStyles) {
|
|
4965
|
+
cacheKey |= 1 /* HAS_SCOPED_STYLE */;
|
|
4966
|
+
}
|
|
4967
|
+
if (hasStyleToken && isSyntheticShadow) {
|
|
4968
|
+
cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
|
|
4969
|
+
}
|
|
4970
|
+
if (!isUndefined$1(cache[cacheKey])) {
|
|
4971
|
+
return cache[cacheKey];
|
|
4972
|
+
}
|
|
4973
|
+
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
|
|
4974
|
+
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
|
|
4975
|
+
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
4976
|
+
let htmlFragment = '';
|
|
4977
|
+
for (let i = 0, n = keys.length; i < n; i++) {
|
|
4978
|
+
switch (keys[i]) {
|
|
4979
|
+
case 0: // styleToken in existing class attr
|
|
4980
|
+
htmlFragment += strings[i] + classToken;
|
|
4981
|
+
break;
|
|
4982
|
+
case 1: // styleToken for added class attr
|
|
4983
|
+
htmlFragment += strings[i] + classAttrToken;
|
|
4984
|
+
break;
|
|
4985
|
+
case 2: // styleToken as attr
|
|
4986
|
+
htmlFragment += strings[i] + attrToken;
|
|
4987
|
+
break;
|
|
4988
|
+
case 3: // ${1}${2}
|
|
4989
|
+
htmlFragment += strings[i] + classAttrToken + attrToken;
|
|
4990
|
+
break;
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
htmlFragment += strings[strings.length - 1];
|
|
4994
|
+
cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
|
|
4995
|
+
return cache[cacheKey];
|
|
4996
|
+
};
|
|
4997
|
+
};
|
|
4998
|
+
}
|
|
4999
|
+
// Note: at the moment this code executes, we don't have a renderer yet.
|
|
5000
|
+
const parseFragment = buildParseFragmentFn((html, renderer) => {
|
|
5001
|
+
const { createFragment } = renderer;
|
|
5002
|
+
return createFragment(html);
|
|
5003
|
+
});
|
|
5004
|
+
const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
|
|
5005
|
+
const { createFragment, getFirstChild } = renderer;
|
|
5006
|
+
const fragment = createFragment('<svg>' + html + '</svg>');
|
|
5007
|
+
return getFirstChild(fragment);
|
|
5008
|
+
});
|
|
5016
5009
|
function evaluateTemplate(vm, html) {
|
|
5017
5010
|
if (process.env.NODE_ENV !== 'production') {
|
|
5018
5011
|
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
|
@@ -5059,7 +5052,7 @@
|
|
|
5059
5052
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
5060
5053
|
// re-rendering.
|
|
5061
5054
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5062
|
-
context.
|
|
5055
|
+
context.styleVNodes =
|
|
5063
5056
|
stylesheetsContent.length === 0
|
|
5064
5057
|
? null
|
|
5065
5058
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -5076,9 +5069,9 @@
|
|
|
5076
5069
|
// Set the global flag that template is being updated
|
|
5077
5070
|
isUpdatingTemplate = true;
|
|
5078
5071
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
5079
|
-
const {
|
|
5080
|
-
if (!isNull(
|
|
5081
|
-
ArrayUnshift.
|
|
5072
|
+
const { styleVNodes } = context;
|
|
5073
|
+
if (!isNull(styleVNodes)) {
|
|
5074
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
5082
5075
|
}
|
|
5083
5076
|
});
|
|
5084
5077
|
}, () => {
|
|
@@ -5395,9 +5388,20 @@
|
|
|
5395
5388
|
|
|
5396
5389
|
resetComponentStateWhenRemoved(vm);
|
|
5397
5390
|
}
|
|
5398
|
-
function createVM(elm, ctor, options) {
|
|
5399
|
-
var _a;
|
|
5400
5391
|
|
|
5392
|
+
function getNearestShadowAncestor(vm) {
|
|
5393
|
+
let ancestor = vm.owner;
|
|
5394
|
+
|
|
5395
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5396
|
+
/* Light */
|
|
5397
|
+
) {
|
|
5398
|
+
ancestor = ancestor.owner;
|
|
5399
|
+
}
|
|
5400
|
+
|
|
5401
|
+
return ancestor;
|
|
5402
|
+
}
|
|
5403
|
+
|
|
5404
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5401
5405
|
const {
|
|
5402
5406
|
mode,
|
|
5403
5407
|
owner,
|
|
@@ -5427,28 +5431,29 @@
|
|
|
5427
5431
|
cmpTemplate: null,
|
|
5428
5432
|
hydrated: Boolean(hydrated),
|
|
5429
5433
|
renderMode: def.renderMode,
|
|
5430
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5431
|
-
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
5432
5434
|
context: {
|
|
5433
5435
|
stylesheetToken: undefined,
|
|
5434
5436
|
hasTokenInClass: undefined,
|
|
5435
5437
|
hasTokenInAttribute: undefined,
|
|
5436
5438
|
hasScopedStyles: undefined,
|
|
5437
|
-
|
|
5439
|
+
styleVNodes: null,
|
|
5438
5440
|
tplCache: EmptyObject,
|
|
5439
5441
|
wiredConnecting: EmptyArray,
|
|
5440
5442
|
wiredDisconnecting: EmptyArray
|
|
5441
5443
|
},
|
|
5442
5444
|
// Properties set right after VM creation.
|
|
5443
5445
|
tro: null,
|
|
5446
|
+
shadowMode: null,
|
|
5444
5447
|
// Properties set by the LightningElement constructor.
|
|
5445
5448
|
component: null,
|
|
5446
5449
|
shadowRoot: null,
|
|
5447
5450
|
renderRoot: null,
|
|
5448
5451
|
callHook,
|
|
5449
5452
|
setHook,
|
|
5450
|
-
getHook
|
|
5453
|
+
getHook,
|
|
5454
|
+
renderer
|
|
5451
5455
|
};
|
|
5456
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5452
5457
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5453
5458
|
|
|
5454
5459
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5473,12 +5478,17 @@
|
|
|
5473
5478
|
return vm;
|
|
5474
5479
|
}
|
|
5475
5480
|
|
|
5476
|
-
function computeShadowMode(
|
|
5477
|
-
|
|
5478
|
-
|
|
5481
|
+
function computeShadowMode(vm, renderer) {
|
|
5482
|
+
const {
|
|
5483
|
+
def
|
|
5484
|
+
} = vm;
|
|
5485
|
+
const {
|
|
5486
|
+
isSyntheticShadowDefined,
|
|
5487
|
+
isNativeShadowDefined
|
|
5488
|
+
} = renderer;
|
|
5479
5489
|
let shadowMode;
|
|
5480
5490
|
|
|
5481
|
-
if (isSyntheticShadowDefined
|
|
5491
|
+
if (isSyntheticShadowDefined) {
|
|
5482
5492
|
if (def.renderMode === 0
|
|
5483
5493
|
/* Light */
|
|
5484
5494
|
) {
|
|
@@ -5487,7 +5497,7 @@
|
|
|
5487
5497
|
shadowMode = 0
|
|
5488
5498
|
/* Native */
|
|
5489
5499
|
;
|
|
5490
|
-
} else if (isNativeShadowDefined
|
|
5500
|
+
} else if (isNativeShadowDefined) {
|
|
5491
5501
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5492
5502
|
// the if-condition.
|
|
5493
5503
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5498,13 +5508,23 @@
|
|
|
5498
5508
|
/* Native */
|
|
5499
5509
|
;
|
|
5500
5510
|
} else {
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5511
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5512
|
+
|
|
5513
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5514
|
+
/* Native */
|
|
5515
|
+
) {
|
|
5516
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5517
|
+
// transitively opts all of its descendants into native.
|
|
5518
|
+
shadowMode = 0
|
|
5519
|
+
/* Native */
|
|
5520
|
+
;
|
|
5521
|
+
} else {
|
|
5522
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5523
|
+
// to be native.
|
|
5524
|
+
shadowMode = 1
|
|
5525
|
+
/* Synthetic */
|
|
5526
|
+
;
|
|
5527
|
+
}
|
|
5508
5528
|
}
|
|
5509
5529
|
} else {
|
|
5510
5530
|
shadowMode = 1
|
|
@@ -5567,7 +5587,8 @@
|
|
|
5567
5587
|
function patchShadowRoot(vm, newCh) {
|
|
5568
5588
|
const {
|
|
5569
5589
|
renderRoot,
|
|
5570
|
-
children: oldCh
|
|
5590
|
+
children: oldCh,
|
|
5591
|
+
renderer
|
|
5571
5592
|
} = vm; // caching the new children collection
|
|
5572
5593
|
|
|
5573
5594
|
vm.children = newCh;
|
|
@@ -5583,7 +5604,7 @@
|
|
|
5583
5604
|
, vm);
|
|
5584
5605
|
}, () => {
|
|
5585
5606
|
// job
|
|
5586
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5607
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5587
5608
|
}, () => {
|
|
5588
5609
|
// post
|
|
5589
5610
|
logOperationEnd(2
|
|
@@ -5608,10 +5629,13 @@
|
|
|
5608
5629
|
const {
|
|
5609
5630
|
def: {
|
|
5610
5631
|
renderedCallback
|
|
5632
|
+
},
|
|
5633
|
+
renderer: {
|
|
5634
|
+
ssr
|
|
5611
5635
|
}
|
|
5612
5636
|
} = vm;
|
|
5613
5637
|
|
|
5614
|
-
if (isTrue(ssr
|
|
5638
|
+
if (isTrue(ssr)) {
|
|
5615
5639
|
return;
|
|
5616
5640
|
}
|
|
5617
5641
|
|
|
@@ -5845,14 +5869,17 @@
|
|
|
5845
5869
|
function resetComponentRoot(vm) {
|
|
5846
5870
|
const {
|
|
5847
5871
|
children,
|
|
5848
|
-
renderRoot
|
|
5872
|
+
renderRoot,
|
|
5873
|
+
renderer: {
|
|
5874
|
+
remove
|
|
5875
|
+
}
|
|
5849
5876
|
} = vm;
|
|
5850
5877
|
|
|
5851
5878
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5852
5879
|
const child = children[i];
|
|
5853
5880
|
|
|
5854
5881
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5855
|
-
remove
|
|
5882
|
+
remove(child.elm, renderRoot);
|
|
5856
5883
|
}
|
|
5857
5884
|
}
|
|
5858
5885
|
|
|
@@ -5861,7 +5888,13 @@
|
|
|
5861
5888
|
vm.velements = EmptyArray;
|
|
5862
5889
|
}
|
|
5863
5890
|
function scheduleRehydration(vm) {
|
|
5864
|
-
|
|
5891
|
+
const {
|
|
5892
|
+
renderer: {
|
|
5893
|
+
ssr
|
|
5894
|
+
}
|
|
5895
|
+
} = vm;
|
|
5896
|
+
|
|
5897
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5865
5898
|
return;
|
|
5866
5899
|
}
|
|
5867
5900
|
|
|
@@ -6037,6 +6070,9 @@
|
|
|
6037
6070
|
context: {
|
|
6038
6071
|
wiredConnecting,
|
|
6039
6072
|
wiredDisconnecting
|
|
6073
|
+
},
|
|
6074
|
+
renderer: {
|
|
6075
|
+
dispatchEvent
|
|
6040
6076
|
}
|
|
6041
6077
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
6042
6078
|
|
|
@@ -6060,7 +6096,7 @@
|
|
|
6060
6096
|
}
|
|
6061
6097
|
|
|
6062
6098
|
});
|
|
6063
|
-
dispatchEvent
|
|
6099
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6064
6100
|
});
|
|
6065
6101
|
}
|
|
6066
6102
|
|
|
@@ -6308,95 +6344,116 @@
|
|
|
6308
6344
|
function hydrateVM(vm) {
|
|
6309
6345
|
const children = renderComponent(vm);
|
|
6310
6346
|
vm.children = children;
|
|
6311
|
-
const parentNode = vm
|
|
6312
|
-
hydrateChildren(getFirstChild
|
|
6347
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6348
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6313
6349
|
runRenderedCallback(vm);
|
|
6314
6350
|
}
|
|
6315
|
-
function hydrateNode(node, vnode) {
|
|
6351
|
+
function hydrateNode(node, vnode, renderer) {
|
|
6352
|
+
var _a, _b;
|
|
6316
6353
|
let hydratedNode;
|
|
6317
6354
|
switch (vnode.type) {
|
|
6318
6355
|
case 0 /* Text */:
|
|
6319
|
-
|
|
6356
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
6357
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
6320
6358
|
break;
|
|
6321
6359
|
case 1 /* Comment */:
|
|
6322
|
-
|
|
6360
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
6361
|
+
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
6362
|
+
break;
|
|
6363
|
+
case 4 /* Static */:
|
|
6364
|
+
// VStatic are cacheable and cannot have custom renderer associated to them
|
|
6365
|
+
hydratedNode = hydrateStaticElement(node, vnode, renderer);
|
|
6323
6366
|
break;
|
|
6324
6367
|
case 2 /* Element */:
|
|
6325
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
6368
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
6326
6369
|
break;
|
|
6327
6370
|
case 3 /* CustomElement */:
|
|
6328
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6371
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
6329
6372
|
break;
|
|
6330
6373
|
}
|
|
6331
|
-
return nextSibling
|
|
6374
|
+
return renderer.nextSibling(hydratedNode);
|
|
6332
6375
|
}
|
|
6333
|
-
function hydrateText(node, vnode) {
|
|
6376
|
+
function hydrateText(node, vnode, renderer) {
|
|
6334
6377
|
var _a;
|
|
6335
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
6336
|
-
return handleMismatch(node, vnode);
|
|
6378
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
6379
|
+
return handleMismatch(node, vnode, renderer);
|
|
6337
6380
|
}
|
|
6338
6381
|
if (process.env.NODE_ENV !== 'production') {
|
|
6339
|
-
const
|
|
6382
|
+
const { getProperty } = renderer;
|
|
6383
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6340
6384
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6341
6385
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6342
6386
|
}
|
|
6343
6387
|
}
|
|
6344
|
-
setText
|
|
6388
|
+
const { setText } = renderer;
|
|
6389
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6345
6390
|
vnode.elm = node;
|
|
6346
6391
|
return node;
|
|
6347
6392
|
}
|
|
6348
|
-
function hydrateComment(node, vnode) {
|
|
6393
|
+
function hydrateComment(node, vnode, renderer) {
|
|
6349
6394
|
var _a;
|
|
6350
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
6351
|
-
return handleMismatch(node, vnode);
|
|
6395
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
6396
|
+
return handleMismatch(node, vnode, renderer);
|
|
6352
6397
|
}
|
|
6353
6398
|
if (process.env.NODE_ENV !== 'production') {
|
|
6354
|
-
const
|
|
6399
|
+
const { getProperty } = renderer;
|
|
6400
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6355
6401
|
if (nodeValue !== vnode.text) {
|
|
6356
6402
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6357
6403
|
}
|
|
6358
6404
|
}
|
|
6359
|
-
setProperty
|
|
6405
|
+
const { setProperty } = renderer;
|
|
6406
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6360
6407
|
vnode.elm = node;
|
|
6361
6408
|
return node;
|
|
6362
6409
|
}
|
|
6363
|
-
function
|
|
6364
|
-
if (!
|
|
6365
|
-
|
|
6366
|
-
return handleMismatch(elm, vnode);
|
|
6410
|
+
function hydrateStaticElement(elm, vnode, renderer) {
|
|
6411
|
+
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
6412
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6367
6413
|
}
|
|
6368
6414
|
vnode.elm = elm;
|
|
6415
|
+
return elm;
|
|
6416
|
+
}
|
|
6417
|
+
function hydrateElement(elm, vnode, renderer) {
|
|
6418
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6419
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6420
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6421
|
+
}
|
|
6422
|
+
vnode.elm = elm;
|
|
6423
|
+
const { owner } = vnode;
|
|
6369
6424
|
const { context } = vnode.data;
|
|
6370
6425
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6371
6426
|
if (isDomManual) {
|
|
6372
6427
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6373
6428
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6374
|
-
const { props } = vnode
|
|
6429
|
+
const { data: { props }, } = vnode;
|
|
6430
|
+
const { getProperty } = renderer;
|
|
6375
6431
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6376
|
-
if (getProperty
|
|
6432
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6377
6433
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6378
6434
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6379
6435
|
}
|
|
6380
6436
|
else {
|
|
6381
6437
|
if (process.env.NODE_ENV !== 'production') {
|
|
6382
|
-
logWarn(`Mismatch hydrating element <${getProperty
|
|
6438
|
+
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
|
|
6383
6439
|
}
|
|
6384
6440
|
}
|
|
6385
6441
|
}
|
|
6386
6442
|
}
|
|
6387
|
-
patchElementPropsAndAttrs(vnode);
|
|
6443
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6388
6444
|
if (!isDomManual) {
|
|
6389
|
-
|
|
6445
|
+
const { getFirstChild } = renderer;
|
|
6446
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6390
6447
|
}
|
|
6391
6448
|
return elm;
|
|
6392
6449
|
}
|
|
6393
|
-
function hydrateCustomElement(elm, vnode) {
|
|
6394
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6395
|
-
!isMatchingElement(vnode, elm)) {
|
|
6396
|
-
return handleMismatch(elm, vnode);
|
|
6450
|
+
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6451
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
6452
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
6453
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6397
6454
|
}
|
|
6398
6455
|
const { sel, mode, ctor, owner } = vnode;
|
|
6399
|
-
const vm = createVM(elm, ctor, {
|
|
6456
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
6400
6457
|
mode,
|
|
6401
6458
|
owner,
|
|
6402
6459
|
tagName: sel,
|
|
@@ -6405,16 +6462,17 @@
|
|
|
6405
6462
|
vnode.elm = elm;
|
|
6406
6463
|
vnode.vm = vm;
|
|
6407
6464
|
allocateChildren(vnode, vm);
|
|
6408
|
-
patchElementPropsAndAttrs(vnode);
|
|
6465
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6409
6466
|
// Insert hook section:
|
|
6410
6467
|
if (process.env.NODE_ENV !== 'production') {
|
|
6411
6468
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6412
6469
|
}
|
|
6413
6470
|
runConnectedCallback(vm);
|
|
6414
6471
|
if (vm.renderMode !== 0 /* Light */) {
|
|
6472
|
+
const { getFirstChild } = renderer;
|
|
6415
6473
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6416
6474
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6417
|
-
hydrateChildren(getFirstChild
|
|
6475
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6418
6476
|
}
|
|
6419
6477
|
hydrateVM(vm);
|
|
6420
6478
|
return elm;
|
|
@@ -6423,11 +6481,12 @@
|
|
|
6423
6481
|
let hasWarned = false;
|
|
6424
6482
|
let nextNode = node;
|
|
6425
6483
|
let anchor = null;
|
|
6484
|
+
const { renderer } = owner;
|
|
6426
6485
|
for (let i = 0; i < children.length; i++) {
|
|
6427
6486
|
const childVnode = children[i];
|
|
6428
6487
|
if (!isNull(childVnode)) {
|
|
6429
6488
|
if (nextNode) {
|
|
6430
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
6489
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6431
6490
|
anchor = childVnode.elm;
|
|
6432
6491
|
}
|
|
6433
6492
|
else {
|
|
@@ -6438,7 +6497,7 @@
|
|
|
6438
6497
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6439
6498
|
}
|
|
6440
6499
|
}
|
|
6441
|
-
mount(childVnode, parentNode, anchor);
|
|
6500
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
6442
6501
|
anchor = childVnode.elm;
|
|
6443
6502
|
}
|
|
6444
6503
|
}
|
|
@@ -6450,31 +6509,33 @@
|
|
|
6450
6509
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6451
6510
|
}
|
|
6452
6511
|
}
|
|
6512
|
+
// nextSibling is mostly harmless, and since we don't have
|
|
6513
|
+
// a good reference to what element to act upon, we instead
|
|
6514
|
+
// rely on the vm's associated renderer for navigating to the
|
|
6515
|
+
// next node in the list to be hydrated.
|
|
6516
|
+
const { nextSibling } = renderer;
|
|
6453
6517
|
do {
|
|
6454
6518
|
const current = nextNode;
|
|
6455
|
-
nextNode = nextSibling
|
|
6456
|
-
removeNode(current, parentNode);
|
|
6519
|
+
nextNode = nextSibling(nextNode);
|
|
6520
|
+
removeNode(current, parentNode, renderer);
|
|
6457
6521
|
} while (nextNode);
|
|
6458
6522
|
}
|
|
6459
6523
|
}
|
|
6460
|
-
function handleMismatch(node, vnode,
|
|
6524
|
+
function handleMismatch(node, vnode, renderer) {
|
|
6461
6525
|
hasMismatch = true;
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
}
|
|
6467
|
-
const parentNode = getProperty$1(node, 'parentNode');
|
|
6468
|
-
mount(vnode, parentNode, node);
|
|
6469
|
-
removeNode(node, parentNode);
|
|
6526
|
+
const { getProperty } = renderer;
|
|
6527
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
6528
|
+
mount(vnode, parentNode, renderer, node);
|
|
6529
|
+
removeNode(node, parentNode, renderer);
|
|
6470
6530
|
return vnode.elm;
|
|
6471
6531
|
}
|
|
6472
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6473
|
-
applyEventListeners(vnode);
|
|
6474
|
-
patchProps(null, vnode);
|
|
6532
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
6533
|
+
applyEventListeners(vnode, renderer);
|
|
6534
|
+
patchProps(null, vnode, renderer);
|
|
6475
6535
|
}
|
|
6476
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6477
|
-
|
|
6536
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
6537
|
+
const { getProperty } = renderer;
|
|
6538
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
6478
6539
|
if (process.env.NODE_ENV !== 'production') {
|
|
6479
6540
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6480
6541
|
}
|
|
@@ -6482,46 +6543,51 @@
|
|
|
6482
6543
|
}
|
|
6483
6544
|
return true;
|
|
6484
6545
|
}
|
|
6485
|
-
function isMatchingElement(vnode, elm) {
|
|
6486
|
-
|
|
6546
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
6547
|
+
const { getProperty } = renderer;
|
|
6548
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6487
6549
|
if (process.env.NODE_ENV !== 'production') {
|
|
6488
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty
|
|
6550
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6489
6551
|
}
|
|
6490
6552
|
return false;
|
|
6491
6553
|
}
|
|
6492
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6493
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6494
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6554
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
|
|
6555
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
|
|
6556
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
|
|
6495
6557
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6496
6558
|
}
|
|
6497
|
-
function validateAttrs(vnode, elm) {
|
|
6559
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
6498
6560
|
const { data: { attrs = {} }, } = vnode;
|
|
6499
6561
|
let nodesAreCompatible = true;
|
|
6500
6562
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6501
6563
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6502
6564
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6503
|
-
const
|
|
6565
|
+
const { owner } = vnode;
|
|
6566
|
+
const { getAttribute } = renderer;
|
|
6567
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
6504
6568
|
if (String(attrValue) !== elmAttrValue) {
|
|
6505
6569
|
if (process.env.NODE_ENV !== 'production') {
|
|
6506
|
-
|
|
6570
|
+
const { getProperty } = renderer;
|
|
6571
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
6507
6572
|
}
|
|
6508
6573
|
nodesAreCompatible = false;
|
|
6509
6574
|
}
|
|
6510
6575
|
}
|
|
6511
6576
|
return nodesAreCompatible;
|
|
6512
6577
|
}
|
|
6513
|
-
function validateClassAttr(vnode, elm) {
|
|
6578
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
6514
6579
|
const { data: { className, classMap }, } = vnode;
|
|
6580
|
+
const { getProperty, getClassList } = renderer;
|
|
6515
6581
|
let nodesAreCompatible = true;
|
|
6516
6582
|
let vnodeClassName;
|
|
6517
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
6583
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
6518
6584
|
// className is used when class is bound to an expr.
|
|
6519
6585
|
nodesAreCompatible = false;
|
|
6520
6586
|
vnodeClassName = className;
|
|
6521
6587
|
}
|
|
6522
6588
|
else if (!isUndefined$1(classMap)) {
|
|
6523
6589
|
// classMap is used when class is set to static value.
|
|
6524
|
-
const classList = getClassList
|
|
6590
|
+
const classList = getClassList(elm);
|
|
6525
6591
|
let computedClassName = '';
|
|
6526
6592
|
// all classes from the vnode should be in the element.classList
|
|
6527
6593
|
for (const name in classMap) {
|
|
@@ -6537,14 +6603,15 @@
|
|
|
6537
6603
|
}
|
|
6538
6604
|
if (!nodesAreCompatible) {
|
|
6539
6605
|
if (process.env.NODE_ENV !== 'production') {
|
|
6540
|
-
logError(`Mismatch hydrating element <${getProperty
|
|
6606
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
|
|
6541
6607
|
}
|
|
6542
6608
|
}
|
|
6543
6609
|
return nodesAreCompatible;
|
|
6544
6610
|
}
|
|
6545
|
-
function validateStyleAttr(vnode, elm) {
|
|
6611
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
6546
6612
|
const { data: { style, styleDecls }, } = vnode;
|
|
6547
|
-
const
|
|
6613
|
+
const { getAttribute } = renderer;
|
|
6614
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
6548
6615
|
let vnodeStyle;
|
|
6549
6616
|
let nodesAreCompatible = true;
|
|
6550
6617
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
@@ -6576,11 +6643,45 @@
|
|
|
6576
6643
|
}
|
|
6577
6644
|
if (!nodesAreCompatible) {
|
|
6578
6645
|
if (process.env.NODE_ENV !== 'production') {
|
|
6579
|
-
|
|
6646
|
+
const { getProperty } = renderer;
|
|
6647
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6580
6648
|
}
|
|
6581
6649
|
}
|
|
6582
6650
|
return nodesAreCompatible;
|
|
6583
6651
|
}
|
|
6652
|
+
function areCompatibleNodes(client, ssr, vnode, renderer) {
|
|
6653
|
+
const { getProperty, getAttribute } = renderer;
|
|
6654
|
+
if (getProperty(client, 'nodeType') === 3 /* TEXT */) {
|
|
6655
|
+
if (!hasCorrectNodeType(vnode, ssr, 3 /* TEXT */, renderer)) {
|
|
6656
|
+
return false;
|
|
6657
|
+
}
|
|
6658
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
6659
|
+
}
|
|
6660
|
+
if (getProperty(client, 'nodeType') === 8 /* COMMENT */) {
|
|
6661
|
+
if (!hasCorrectNodeType(vnode, ssr, 8 /* COMMENT */, renderer)) {
|
|
6662
|
+
return false;
|
|
6663
|
+
}
|
|
6664
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
6665
|
+
}
|
|
6666
|
+
if (!hasCorrectNodeType(vnode, ssr, 1 /* ELEMENT */, renderer)) {
|
|
6667
|
+
return false;
|
|
6668
|
+
}
|
|
6669
|
+
let isCompatibleElements = true;
|
|
6670
|
+
if (getProperty(client, 'tagName') !== getProperty(ssr, 'tagName')) {
|
|
6671
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6672
|
+
logError(`Hydration mismatch: expecting element with tag "${getProperty(client, 'tagName').toLowerCase()}" but found "${getProperty(ssr, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6673
|
+
}
|
|
6674
|
+
return false;
|
|
6675
|
+
}
|
|
6676
|
+
const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
|
|
6677
|
+
clientAttrsNames.forEach((attrName) => {
|
|
6678
|
+
if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
|
|
6679
|
+
logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
|
|
6680
|
+
isCompatibleElements = false;
|
|
6681
|
+
}
|
|
6682
|
+
});
|
|
6683
|
+
return isCompatibleElements;
|
|
6684
|
+
}
|
|
6584
6685
|
|
|
6585
6686
|
/*
|
|
6586
6687
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6716,7 +6817,7 @@
|
|
|
6716
6817
|
}
|
|
6717
6818
|
return ctor;
|
|
6718
6819
|
}
|
|
6719
|
-
/* version: 2.
|
|
6820
|
+
/* version: 2.15.0 */
|
|
6720
6821
|
|
|
6721
6822
|
/*
|
|
6722
6823
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6875,7 +6976,7 @@
|
|
|
6875
6976
|
try {
|
|
6876
6977
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6877
6978
|
// _wrapNativeSuper()
|
|
6878
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
6979
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6879
6980
|
// get wrapped by babel.
|
|
6880
6981
|
const HTMLElementAlias = HTMLElement;
|
|
6881
6982
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -6929,8 +7030,17 @@
|
|
|
6929
7030
|
hydrating = value;
|
|
6930
7031
|
}
|
|
6931
7032
|
const ssr = false;
|
|
7033
|
+
function isHydrating() {
|
|
7034
|
+
return hydrating;
|
|
7035
|
+
}
|
|
6932
7036
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6933
7037
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
7038
|
+
function cloneNode(node, deep) {
|
|
7039
|
+
return node.cloneNode(deep);
|
|
7040
|
+
}
|
|
7041
|
+
function createFragment(html) {
|
|
7042
|
+
return document.createRange().createContextualFragment(html).firstChild;
|
|
7043
|
+
}
|
|
6934
7044
|
function createElement$1(tagName, namespace) {
|
|
6935
7045
|
return isUndefined$1(namespace)
|
|
6936
7046
|
? document.createElement(tagName)
|
|
@@ -7047,76 +7157,49 @@
|
|
|
7047
7157
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7048
7158
|
}
|
|
7049
7159
|
const HTMLElementExported = HTMLElementConstructor;
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
setAddEventListener(addEventListener);
|
|
7094
|
-
setInsertStylesheet(insertStylesheet);
|
|
7095
|
-
|
|
7096
|
-
/*
|
|
7097
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7098
|
-
* All rights reserved.
|
|
7099
|
-
* SPDX-License-Identifier: MIT
|
|
7100
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7101
|
-
*/
|
|
7102
|
-
// @ts-ignore
|
|
7103
|
-
|
|
7104
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7105
|
-
window.addEventListener('test-dummy-flag', () => {
|
|
7106
|
-
let hasFlag = false;
|
|
7107
|
-
|
|
7108
|
-
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7109
|
-
hasFlag = true;
|
|
7110
|
-
}
|
|
7111
|
-
|
|
7112
|
-
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7113
|
-
detail: {
|
|
7114
|
-
package: '@lwc/engine-dom',
|
|
7115
|
-
hasFlag
|
|
7116
|
-
}
|
|
7117
|
-
}));
|
|
7118
|
-
});
|
|
7119
|
-
}
|
|
7160
|
+
const renderer = {
|
|
7161
|
+
ssr,
|
|
7162
|
+
isNativeShadowDefined,
|
|
7163
|
+
isSyntheticShadowDefined,
|
|
7164
|
+
HTMLElementExported,
|
|
7165
|
+
isHydrating,
|
|
7166
|
+
insert,
|
|
7167
|
+
remove,
|
|
7168
|
+
cloneNode,
|
|
7169
|
+
createFragment,
|
|
7170
|
+
createElement: createElement$1,
|
|
7171
|
+
createText,
|
|
7172
|
+
createComment,
|
|
7173
|
+
nextSibling,
|
|
7174
|
+
attachShadow,
|
|
7175
|
+
getProperty,
|
|
7176
|
+
setProperty,
|
|
7177
|
+
setText,
|
|
7178
|
+
getAttribute,
|
|
7179
|
+
setAttribute,
|
|
7180
|
+
removeAttribute,
|
|
7181
|
+
addEventListener,
|
|
7182
|
+
removeEventListener,
|
|
7183
|
+
dispatchEvent,
|
|
7184
|
+
getClassList,
|
|
7185
|
+
setCSSStyleProperty,
|
|
7186
|
+
getBoundingClientRect,
|
|
7187
|
+
querySelector,
|
|
7188
|
+
querySelectorAll,
|
|
7189
|
+
getElementsByTagName,
|
|
7190
|
+
getElementsByClassName,
|
|
7191
|
+
getChildren,
|
|
7192
|
+
getChildNodes,
|
|
7193
|
+
getFirstChild,
|
|
7194
|
+
getFirstElementChild,
|
|
7195
|
+
getLastChild,
|
|
7196
|
+
getLastElementChild,
|
|
7197
|
+
isConnected,
|
|
7198
|
+
insertStylesheet,
|
|
7199
|
+
assertInstanceOfHTMLElement,
|
|
7200
|
+
defineCustomElement,
|
|
7201
|
+
getCustomElement,
|
|
7202
|
+
};
|
|
7120
7203
|
|
|
7121
7204
|
/*
|
|
7122
7205
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7138,7 +7221,7 @@
|
|
|
7138
7221
|
}
|
|
7139
7222
|
}
|
|
7140
7223
|
function createVMWithProps(element, Ctor, props) {
|
|
7141
|
-
const vm = createVM(element, Ctor, {
|
|
7224
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
7142
7225
|
mode: 'open',
|
|
7143
7226
|
owner: null,
|
|
7144
7227
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -7234,7 +7317,7 @@
|
|
|
7234
7317
|
hydratedCustomElements.add(this);
|
|
7235
7318
|
}
|
|
7236
7319
|
else {
|
|
7237
|
-
createVM(this, Ctor, {
|
|
7320
|
+
createVM(this, Ctor, renderer, {
|
|
7238
7321
|
mode: 'open',
|
|
7239
7322
|
owner: null,
|
|
7240
7323
|
tagName: this.tagName,
|
|
@@ -7319,7 +7402,7 @@
|
|
|
7319
7402
|
if (!isFunction$1(Ctor)) {
|
|
7320
7403
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7321
7404
|
}
|
|
7322
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
7405
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7323
7406
|
let wasComponentUpgraded = false;
|
|
7324
7407
|
// the custom element from the registry is expecting an upgrade callback
|
|
7325
7408
|
/**
|
|
@@ -7329,7 +7412,7 @@
|
|
|
7329
7412
|
* an upgradable custom element.
|
|
7330
7413
|
*/
|
|
7331
7414
|
const element = new UpgradableConstructor((elm) => {
|
|
7332
|
-
createVM(elm, Ctor, {
|
|
7415
|
+
createVM(elm, Ctor, renderer, {
|
|
7333
7416
|
tagName: sel,
|
|
7334
7417
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7335
7418
|
owner: null,
|
|
@@ -7413,7 +7496,7 @@
|
|
|
7413
7496
|
});
|
|
7414
7497
|
freeze(LightningElement);
|
|
7415
7498
|
seal(LightningElement.prototype);
|
|
7416
|
-
/* version: 2.
|
|
7499
|
+
/* version: 2.15.0 */
|
|
7417
7500
|
|
|
7418
7501
|
exports.LightningElement = LightningElement;
|
|
7419
7502
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7427,11 +7510,14 @@
|
|
|
7427
7510
|
exports.hydrateComponent = hydrateComponent;
|
|
7428
7511
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7429
7512
|
exports.isNodeFromTemplate = isNodeShadowed;
|
|
7513
|
+
exports.parseFragment = parseFragment;
|
|
7514
|
+
exports.parseSVGFragment = parseSVGFragment;
|
|
7430
7515
|
exports.readonly = readonly;
|
|
7431
7516
|
exports.register = register;
|
|
7432
7517
|
exports.registerComponent = registerComponent;
|
|
7433
7518
|
exports.registerDecorators = registerDecorators;
|
|
7434
7519
|
exports.registerTemplate = registerTemplate;
|
|
7520
|
+
exports.renderer = renderer;
|
|
7435
7521
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7436
7522
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7437
7523
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|